|
|
- Metadata-Version: 2.1
- Name: anytree
- Version: 2.4.3
- Summary: Powerful and Lightweight Python Tree Data Structure..
- Home-page: https://github.com/c0fec0de/anytree
- Author: c0fec0de
- Author-email: c0fec0de@gmail.com
- License: Apache 2.0
- Keywords: tree,tree data,treelib,tree walk,tree structure
- Platform: UNKNOWN
- Classifier: Development Status :: 5 - Production/Stable
- Classifier: Programming Language :: Python :: 2
- Classifier: Programming Language :: Python :: 2.6
- Classifier: Programming Language :: Python :: 2.7
- Classifier: Programming Language :: Python :: 3
- Classifier: Programming Language :: Python :: 3.4
- Classifier: Programming Language :: Python :: 3.5
- Classifier: Programming Language :: Python :: 3.6
- Requires-Dist: six (>=1.9.0)
- Provides-Extra: dev
- Requires-Dist: check-manifest ; extra == 'dev'
- Provides-Extra: test
- Requires-Dist: coverage ; extra == 'test'
-
- .. image:: https://badge.fury.io/py/anytree.svg
- :target: https://badge.fury.io/py/anytree
-
- .. image:: https://travis-ci.org/c0fec0de/anytree.svg?branch=master
- :target: https://travis-ci.org/c0fec0de/anytree
-
- .. image:: https://coveralls.io/repos/github/c0fec0de/anytree/badge.svg
- :target: https://coveralls.io/github/c0fec0de/anytree
-
- .. image:: https://readthedocs.org/projects/anytree/badge/?version=2.4.3
- :target: http://anytree.readthedocs.io/en/2.4.3/?badge=2.4.3
-
- .. image:: https://codeclimate.com/github/c0fec0de/anytree.png
- :target: https://codeclimate.com/github/c0fec0de/anytree
-
- .. image:: https://img.shields.io/pypi/pyversions/anytree.svg
- :target: https://pypi.python.org/pypi/anytree
-
- .. image:: https://landscape.io/github/c0fec0de/anytree/master/landscape.svg?style=flat
- :target: https://landscape.io/github/c0fec0de/anytree/master
-
- .. image:: https://img.shields.io/badge/code%20style-pep8-brightgreen.svg
- :target: https://www.python.org/dev/peps/pep-0008/
-
- .. image:: https://img.shields.io/badge/code%20style-pep257-brightgreen.svg
- :target: https://www.python.org/dev/peps/pep-0257/
-
- Documentation
- =============
-
- The Documentation_ is hosted on http://anytree.readthedocs.io/en/2.4.3/
-
- .. _Documentation: http://anytree.readthedocs.io/en/2.4.3/
-
- Getting started
- ===============
-
- .. _getting_started:
-
- Usage is simple.
-
- **Construction**
-
- >>> from anytree import Node, RenderTree
- >>> udo = Node("Udo")
- >>> marc = Node("Marc", parent=udo)
- >>> lian = Node("Lian", parent=marc)
- >>> dan = Node("Dan", parent=udo)
- >>> jet = Node("Jet", parent=dan)
- >>> jan = Node("Jan", parent=dan)
- >>> joe = Node("Joe", parent=dan)
-
- **Node**
-
- >>> print(udo)
- Node('/Udo')
- >>> print(joe)
- Node('/Udo/Dan/Joe')
-
- **Tree**
-
- >>> for pre, fill, node in RenderTree(udo):
- ... print("%s%s" % (pre, node.name))
- Udo
- ├── Marc
- │ └── Lian
- └── Dan
- ├── Jet
- ├── Jan
- └── Joe
-
- >>> from anytree.exporter import DotExporter
- >>> # graphviz needs to be installed for the next line!
- >>> DotExporter(udo).to_picture("udo.png")
-
- .. image:: http://anytree.readthedocs.io/en/latest/_images/udo.png
-
- **Manipulation**
-
- A second tree:
-
- >>> mary = Node("Mary")
- >>> urs = Node("Urs", parent=mary)
- >>> chris = Node("Chris", parent=mary)
- >>> marta = Node("Marta", parent=mary)
- >>> print(RenderTree(mary))
- Node('/Mary')
- ├── Node('/Mary/Urs')
- ├── Node('/Mary/Chris')
- └── Node('/Mary/Marta')
-
- Append:
-
- >>> udo.parent = mary
- >>> print(RenderTree(mary))
- Node('/Mary')
- ├── Node('/Mary/Urs')
- ├── Node('/Mary/Chris')
- ├── Node('/Mary/Marta')
- └── Node('/Mary/Udo')
- ├── Node('/Mary/Udo/Marc')
- │ └── Node('/Mary/Udo/Marc/Lian')
- └── Node('/Mary/Udo/Dan')
- ├── Node('/Mary/Udo/Dan/Jet')
- ├── Node('/Mary/Udo/Dan/Jan')
- └── Node('/Mary/Udo/Dan/Joe')
-
- Subtree rendering:
-
- >>> print(RenderTree(marc))
- Node('/Mary/Udo/Marc')
- └── Node('/Mary/Udo/Marc/Lian')
-
- Cut:
-
- >>> dan.parent = None
- >>> print(RenderTree(dan))
- Node('/Dan')
- ├── Node('/Dan/Jet')
- ├── Node('/Dan/Jan')
- └── Node('/Dan/Joe')
-
-
- Installation
- ============
-
- To install the `anytree` module run::
-
- pip install anytree
-
- If you do not have write-permissions to the python installation, try::
-
- pip install anytree --user
-
-
|