{ "info": { "author": "salpreh", "author_email": "salva.perez46@gmail.com", "bugtrack_url": null, "classifiers": [], "description": "# lxtree\n\n[![PyPI version](https://badge.fury.io/py/lxtree.svg)](https://badge.fury.io/py/lxtree)\n[![PyPI version](https://img.shields.io/github/license/salpreh/lxtree.svg)](https://img.shields.io/github/license/salpreh/lxtree.svg)\n\n**Package to draw tree structures (tree linux command style)**\n\n---\n## Basic usage\nBuild the tree structure using `TreeNode`s. A `TreeNode` can contain other `TreeNode`s\nto represent the tree. When builded you car get a string representation of it,\nor get string of a sub-tree using some child as root.\n\n### Code samples\n```py\nfrom lxtree import TreeNode\n\n\n# Creating root\nroot = TreeNode('root')\n\n# Adding a list of nodes\nroot.children = [TreeNode('branch1'), TreeNode('branch3')]\n\n# Insert node\nroot.insert_child(TreeNode('branch2'), 1)\n\n# Appending to a branch 1 by index\nroot[0].append_child(TreeNode('branch11'))\n\n# Using index to assign children to branch11\nroot[0][0] = [TreeNode('leaf111'), TreeNode('leaf112')]\n\n# Use `set_children` to add nodes as argv\nroot[1].set_children(TreeNode('leaf21'), TreeNode('leaf22'), TreeNode('leaf23'))\n\n# Print tree\nprint(root)\n```\n\n##### Creating all structure at once\n```py\nroot = TreeNode('root').set_children(\n TreeNode('branch1').append_child(\n TreeNode('branch11').set_children(\n TreeNode('leaf111'),\n TreeNode('leaf112')\n )\n ),\n TreeNode('branch2').set_children(\n TreeNode('leaf21'),\n TreeNode('leaf22'),\n TreeNode('leaf23')\n ),\n TreeNode('branch3')\n)\n\nprint(root)\n```\n##### Creating the tree from a dict\n```py\ntree_data = {\n 'root': {\n 'branch1': {\n 'branch11': {\n 'leaf111': None,\n 'leaf112': None\n }\n },\n 'branch2': {\n 'leaf21': None,\n 'leaf22': None,\n 'leaf23': None\n },\n 'branch3': None\n }\n}\n\nprint(TreeNode.tree_from_dict(tree_data))\n```\n#### Output\n\"tree_output\"\n\n\n", "description_content_type": "text/markdown", "docs_url": null, "download_url": "", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "https://github.com/salpreh/lxtree", "keywords": "", "license": "MIT License", "maintainer": "", "maintainer_email": "", "name": "lxtree", "package_url": "https://pypi.org/project/lxtree/", "platform": "", "project_url": "https://pypi.org/project/lxtree/", "project_urls": { "Homepage": "https://github.com/salpreh/lxtree" }, "release_url": "https://pypi.org/project/lxtree/0.1.0/", "requires_dist": null, "requires_python": "", "summary": "Package to draw tree structures (tree linux command style)", "version": "0.1.0" }, "last_serial": 5142166, "releases": { "0.1.0": [ { "comment_text": "", "digests": { "md5": "df4d6ba8a27871b10fda636d30995c46", "sha256": "9b7f07175dc2005848220a34cfac6944a959d778eeae622b74298844840140eb" }, "downloads": -1, "filename": "lxtree-0.1.0-py3-none-any.whl", "has_sig": false, "md5_digest": "df4d6ba8a27871b10fda636d30995c46", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": null, "size": 4629, "upload_time": "2019-04-14T22:30:01", "url": "https://files.pythonhosted.org/packages/32/4f/fea3b16a689d04a482e3af0500715fcf26346f9f5052d19208add725fcc8/lxtree-0.1.0-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "b7eeadd17a3b11dfc50ebbb1cccda487", "sha256": "1fd8b781457cafecc5e6b1d772cda1ec1c89c2ea229b47b4a984c02fd5f0186b" }, "downloads": -1, "filename": "lxtree-0.1.0.tar.gz", "has_sig": false, "md5_digest": "b7eeadd17a3b11dfc50ebbb1cccda487", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 4287, "upload_time": "2019-04-14T22:30:04", "url": "https://files.pythonhosted.org/packages/9e/ae/1a1f125c14a4b3f624def964711ed2ef5d7d8423017c13a77a2bcbbb8c17/lxtree-0.1.0.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "df4d6ba8a27871b10fda636d30995c46", "sha256": "9b7f07175dc2005848220a34cfac6944a959d778eeae622b74298844840140eb" }, "downloads": -1, "filename": "lxtree-0.1.0-py3-none-any.whl", "has_sig": false, "md5_digest": "df4d6ba8a27871b10fda636d30995c46", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": null, "size": 4629, "upload_time": "2019-04-14T22:30:01", "url": "https://files.pythonhosted.org/packages/32/4f/fea3b16a689d04a482e3af0500715fcf26346f9f5052d19208add725fcc8/lxtree-0.1.0-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "b7eeadd17a3b11dfc50ebbb1cccda487", "sha256": "1fd8b781457cafecc5e6b1d772cda1ec1c89c2ea229b47b4a984c02fd5f0186b" }, "downloads": -1, "filename": "lxtree-0.1.0.tar.gz", "has_sig": false, "md5_digest": "b7eeadd17a3b11dfc50ebbb1cccda487", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 4287, "upload_time": "2019-04-14T22:30:04", "url": "https://files.pythonhosted.org/packages/9e/ae/1a1f125c14a4b3f624def964711ed2ef5d7d8423017c13a77a2bcbbb8c17/lxtree-0.1.0.tar.gz" } ] }