├── docs ├── .nojekyll ├── objects.inv ├── _static │ ├── file.png │ ├── minus.png │ ├── plus.png │ ├── documentation_options.js │ ├── sidebar.js │ ├── doctools.js │ ├── pygments.css │ ├── classic.css │ ├── language_data.js │ ├── sphinx_highlight.js │ ├── basic.css │ └── searchtools.js ├── .buildinfo ├── _sources │ └── index.rst.txt ├── _modules │ └── index.html ├── search.html ├── py-modindex.html ├── searchindex.js └── genindex.html ├── .tests ├── test_escaped.tre ├── test.nex.gz ├── test.nexml.gz ├── test.tre.gz ├── test.nexml ├── test.tre ├── test.nex └── tests.py ├── compile.sh ├── MANIFEST.in ├── treeswift ├── __init__.py └── Node.py ├── .travis.yml ├── docs_src ├── source │ ├── index.rst │ └── conf.py └── Makefile ├── setup.cfg ├── .github └── workflows │ └── treeswift_tests.yml ├── README.md ├── .gitignore ├── setup.py ├── CODE_OF_CONDUCT.md └── LICENSE /docs/.nojekyll: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /.tests/test_escaped.tre: -------------------------------------------------------------------------------- 1 | [&R] ('https://youtube.com','&'); 2 | -------------------------------------------------------------------------------- /docs/objects.inv: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/niemasd/TreeSwift/HEAD/docs/objects.inv -------------------------------------------------------------------------------- /.tests/test.nex.gz: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/niemasd/TreeSwift/HEAD/.tests/test.nex.gz -------------------------------------------------------------------------------- /.tests/test.nexml.gz: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/niemasd/TreeSwift/HEAD/.tests/test.nexml.gz -------------------------------------------------------------------------------- /.tests/test.tre.gz: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/niemasd/TreeSwift/HEAD/.tests/test.tre.gz -------------------------------------------------------------------------------- /docs/_static/file.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/niemasd/TreeSwift/HEAD/docs/_static/file.png -------------------------------------------------------------------------------- /docs/_static/minus.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/niemasd/TreeSwift/HEAD/docs/_static/minus.png -------------------------------------------------------------------------------- /docs/_static/plus.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/niemasd/TreeSwift/HEAD/docs/_static/plus.png -------------------------------------------------------------------------------- /compile.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | rm -rf build dist treeswift.* 3 | python3 setup.py sdist 4 | python3 setup.py bdist_wheel --universal 5 | twine upload dist/* 6 | -------------------------------------------------------------------------------- /MANIFEST.in: -------------------------------------------------------------------------------- 1 | # Include the README 2 | include *.md 3 | 4 | # Include the license file 5 | include LICENSE 6 | 7 | # Include the data files 8 | #recursive-include data * 9 | -------------------------------------------------------------------------------- /docs/.buildinfo: -------------------------------------------------------------------------------- 1 | # Sphinx build info version 1 2 | # This file records the configuration used when building these files. When it is not found, a full rebuild will be done. 3 | config: 7062db21fc60825e1e7ee52afe62bac4 4 | tags: 645f666f9bcd5a90fca523b33c5a78b7 5 | -------------------------------------------------------------------------------- /treeswift/__init__.py: -------------------------------------------------------------------------------- 1 | from treeswift.Tree import Tree,plot_ltt,read_tree,read_tree_dendropy,read_tree_newick,read_tree_nexml,read_tree_nexus 2 | from treeswift.Node import Node 3 | __all__ = ['Node','Tree','read_tree','read_tree_dendropy','read_tree_newick','read_tree_nexml','read_tree_nexus'] 4 | -------------------------------------------------------------------------------- /.travis.yml: -------------------------------------------------------------------------------- 1 | # .travis.yml setup 2 | sudo: 3 | - enabled 4 | os: 5 | - linux 6 | dist: 7 | - trusty 8 | language: 9 | - python 10 | python: 11 | - "3.7" 12 | - "3.8" 13 | - "3.9" 14 | - "3.10" 15 | - "3.11" 16 | 17 | install: 18 | - pip install -e . 19 | 20 | # run tests 21 | script: 22 | - .travis_tests/tests.py 23 | -------------------------------------------------------------------------------- /docs/_static/documentation_options.js: -------------------------------------------------------------------------------- 1 | const DOCUMENTATION_OPTIONS = { 2 | VERSION: '', 3 | LANGUAGE: 'en', 4 | COLLAPSE_INDEX: false, 5 | BUILDER: 'html', 6 | FILE_SUFFIX: '.html', 7 | LINK_SUFFIX: '.html', 8 | HAS_SOURCE: true, 9 | SOURCELINK_SUFFIX: '.txt', 10 | NAVIGATION_WITH_KEYS: false, 11 | SHOW_SEARCH_SUMMARY: true, 12 | ENABLE_SEARCH_SHORTCUTS: true, 13 | }; -------------------------------------------------------------------------------- /docs_src/source/index.rst: -------------------------------------------------------------------------------- 1 | treeswift package 2 | ================= 3 | 4 | `TreeSwift `_ is a Python library for parsing, manipulating, and iterating over (rooted) tree structures. TreeSwift places an emphasis on speed. 5 | 6 | Module contents 7 | --------------- 8 | 9 | .. automodule:: treeswift 10 | :members: 11 | :undoc-members: 12 | :show-inheritance: 13 | -------------------------------------------------------------------------------- /docs/_sources/index.rst.txt: -------------------------------------------------------------------------------- 1 | treeswift package 2 | ================= 3 | 4 | `TreeSwift `_ is a Python library for parsing, manipulating, and iterating over (rooted) tree structures. TreeSwift places an emphasis on speed. 5 | 6 | Module contents 7 | --------------- 8 | 9 | .. automodule:: treeswift 10 | :members: 11 | :undoc-members: 12 | :show-inheritance: 13 | -------------------------------------------------------------------------------- /setup.cfg: -------------------------------------------------------------------------------- 1 | [metadata] 2 | # This includes the license file in the wheel. 3 | license_file = LICENSE 4 | 5 | [bdist_wheel] 6 | # This flag says to generate wheels that support both Python 2 and Python 7 | # 3. If your code will not run unchanged on both Python 2 and 3, you will 8 | # need to generate separate wheels for each Python version that you 9 | # support. Removing this line (or setting universal to 0) will prevent 10 | # bdist_wheel from trying to make a universal wheel. For more see: 11 | # https://packaging.python.org/tutorials/distributing-packages/#wheels 12 | universal=1 13 | -------------------------------------------------------------------------------- /docs_src/Makefile: -------------------------------------------------------------------------------- 1 | # Minimal makefile for Sphinx documentation 2 | SHELL := /bin/bash 3 | 4 | # You can set these variables from the command line. 5 | SPHINXOPTS = 6 | SPHINXBUILD = sphinx-build 7 | SPHINXPROJ = TreeSwift 8 | SOURCEDIR = source 9 | BUILDDIR = build 10 | DOCSDIR = ../docs 11 | 12 | # Put it first so that "make" without argument is like "make help". 13 | help: 14 | @$(SPHINXBUILD) -M help "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O) 15 | 16 | .PHONY: help Makefile 17 | 18 | # Catch-all target: route all unknown targets to Sphinx using the new 19 | # "make mode" option. $(O) is meant as a shortcut for $(SPHINXOPTS). 20 | %: Makefile 21 | $(SPHINXBUILD) -M $@ "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O) 22 | if [ "$(@)" == "clean" ]; then \ 23 | rm -rf "$(DOCSDIR)" "$(BUILDDIR)" ; \ 24 | fi 25 | if [ "$(@)" == "html" ]; then \ 26 | rm -rf "$(DOCSDIR)" && cp -R "$(BUILDDIR)/html" "$(DOCSDIR)" && rm -rf "$(BUILDDIR)" ; \ 27 | fi 28 | -------------------------------------------------------------------------------- /.github/workflows/treeswift_tests.yml: -------------------------------------------------------------------------------- 1 | name: TreeSwift Tests 2 | on: [push] 3 | 4 | jobs: 5 | treeswift_tests: 6 | runs-on: ubuntu-latest 7 | steps: 8 | - name: Set up Git repository 9 | uses: actions/checkout@v2 10 | - name: Run TreeSwift Tests 11 | run: | 12 | sudo apt-get update && sudo apt-get install -y python3 python3-pip && \ 13 | sudo -H pip3 install git+https://github.com/niemasd/TreeSwift.git && \ 14 | for f in .tests/*.tre* ; do echo "$f" | rev | cut -d'/' -f1 | rev && python3 -c "from treeswift import read_tree_newick; read_tree_newick('$f')" && echo "" || exit 1 ; done && \ 15 | for f in .tests/*.nex .tests/*.nex.* ; do echo "$f" | rev | cut -d'/' -f1 | rev && python3 -c "from treeswift import read_tree_nexus; read_tree_nexus('$f')" && echo "" || exit 1 ; done && \ 16 | for f in .tests/*.nexml* ; do echo "$f" | rev | cut -d'/' -f1 | rev && python3 -c "from treeswift import read_tree_nexml; read_tree_nexml('$f')" && echo "" || exit 1 ; done 17 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # TreeSwift 2 | TreeSwift is a pure Python library for parsing, manipulating, and iterating over (rooted) tree structures. TreeSwift places an emphasis on speed. 3 | 4 | We strongly recommend that you consider our new package, [CompactTree](https://github.com/niemasd/CompactTree) (a header-only C++ library that has a Python package wrapper with similar functionality as TreeSwift), though we will continue maintaining TreeSwift in parallel with CompactTree. 5 | 6 | ## Installation 7 | TreeSwift can be installed using `pip`: 8 | 9 | ```bash 10 | sudo pip install treeswift 11 | ``` 12 | 13 | If you are using a machine on which you lack administrative powers, TreeSwift can be installed locally using `pip`: 14 | 15 | ```bash 16 | pip install --user treeswift 17 | ``` 18 | 19 | ## Usage 20 | Typical usage should be as follows: 21 | 22 | 1. Import the `treeswift` package 23 | 2. Use `treeswift.read_tree_newick` to load your Newick tree 24 | 3. Use the various `Tree` class functions on the resulting object as you need 25 | 26 | ```python 27 | import treeswift 28 | tree = treeswift.read_tree_newick(my_newick_string) 29 | for node in tree.traverse_postorder(): 30 | print(node) 31 | ``` 32 | 33 | Full documentation can be found at [https://niema.net/TreeSwift](https://niema.net/TreeSwift), and more examples can be found in the [TreeSwift Wiki](https://github.com/niemasd/TreeSwift/wiki). 34 | 35 | ## Citing TreeSwift 36 | If you use TreeSwift in your work, please cite: 37 | 38 | > **Moshiri N** (2020). "TreeSwift: a massively scalable Python package for trees." *SoftwareX*. 11:100436. [doi:10.1016/j.softx.2020.100436](https://doi.org/10.1016/j.softx.2020.100436) 39 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # force keep 2 | !docs/ 3 | 4 | # tree files 5 | *.tre 6 | *.tree 7 | *.trees 8 | *.nex 9 | *.nexus 10 | *.nwk 11 | 12 | # Byte-compiled / optimized / DLL files 13 | __pycache__/ 14 | *.py[cod] 15 | *$py.class 16 | 17 | # C extensions 18 | *.so 19 | 20 | # Distribution / packaging 21 | .Python 22 | env/ 23 | build/ 24 | develop-eggs/ 25 | dist/ 26 | downloads/ 27 | eggs/ 28 | .eggs/ 29 | lib/ 30 | lib64/ 31 | parts/ 32 | sdist/ 33 | var/ 34 | wheels/ 35 | *.egg-info/ 36 | .installed.cfg 37 | *.egg 38 | 39 | # PyInstaller 40 | # Usually these files are written by a python script from a template 41 | # before PyInstaller builds the exe, so as to inject date/other infos into it. 42 | *.manifest 43 | *.spec 44 | 45 | # Installer logs 46 | pip-log.txt 47 | pip-delete-this-directory.txt 48 | 49 | # Unit test / coverage reports 50 | htmlcov/ 51 | .tox/ 52 | .coverage 53 | .coverage.* 54 | .cache 55 | nosetests.xml 56 | coverage.xml 57 | *.cover 58 | .hypothesis/ 59 | 60 | # Translations 61 | *.mo 62 | *.pot 63 | 64 | # Django stuff: 65 | *.log 66 | local_settings.py 67 | 68 | # Flask stuff: 69 | instance/ 70 | .webassets-cache 71 | 72 | # Scrapy stuff: 73 | .scrapy 74 | 75 | # Sphinx documentation 76 | docs/_build/ 77 | 78 | # PyBuilder 79 | target/ 80 | 81 | # Jupyter Notebook 82 | .ipynb_checkpoints 83 | 84 | # pyenv 85 | .python-version 86 | 87 | # celery beat schedule file 88 | celerybeat-schedule 89 | 90 | # SageMath parsed files 91 | *.sage.py 92 | 93 | # dotenv 94 | .env 95 | 96 | # virtualenv 97 | .venv 98 | venv/ 99 | ENV/ 100 | 101 | # Spyder project settings 102 | .spyderproject 103 | .spyproject 104 | 105 | # Rope project settings 106 | .ropeproject 107 | 108 | # mkdocs documentation 109 | /site 110 | 111 | # mypy 112 | .mypy_cache/ 113 | -------------------------------------------------------------------------------- /.tests/test.nexml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | -------------------------------------------------------------------------------- /setup.py: -------------------------------------------------------------------------------- 1 | """A setuptools based setup module. 2 | 3 | See: 4 | https://packaging.python.org/en/latest/distributing.html 5 | https://github.com/pypa/sampleproject 6 | """ 7 | 8 | # Always prefer setuptools over distutils 9 | from setuptools import setup, find_packages 10 | # To use a consistent encoding 11 | from codecs import open 12 | from os import path 13 | 14 | here = path.abspath(path.dirname(__file__)) 15 | setup( 16 | name='treeswift', # Required 17 | version='1.1.45', # Required 18 | description='TreeSwift: Fast tree module for Python 2 and 3', # Required 19 | long_description='TreeSwift is a Python library for parsing, manipulating, and iterating over (rooted) tree structures. TreeSwift places an emphasis on speed.', # Optional 20 | long_description_content_type='text/plain', # Optional (see note above) 21 | url='https://github.com/niemasd/TreeSwift', # Optional 22 | author='Niema Moshiri', # Optional 23 | author_email='niemamoshiri@gmail.com', # Optional 24 | classifiers=[ # Optional 25 | # How mature is this project? Common values are 26 | # 3 - Alpha 27 | # 4 - Beta 28 | # 5 - Production/Stable 29 | 'Development Status :: 3 - Alpha', 30 | 31 | # Indicate who your project is intended for 32 | 'Intended Audience :: Developers', 33 | 'Topic :: Software Development :: Build Tools', 34 | 35 | # Pick your license as you wish 36 | 'License :: OSI Approved :: GNU General Public License v3 or later (GPLv3+)', 37 | 38 | # Specify the Python versions you support here. In particular, ensure 39 | # that you indicate whether you support Python 2, Python 3 or both. 40 | 'Programming Language :: Python :: 3', 41 | 'Programming Language :: Python :: 3.7', 42 | 'Programming Language :: Python :: 3.8', 43 | 'Programming Language :: Python :: 3.9', 44 | 'Programming Language :: Python :: 3.10', 45 | 'Programming Language :: Python :: 3.11', 46 | ], 47 | keywords='tree phylogenetics fast', # Optional 48 | packages=find_packages(exclude=['contrib', 'docs', 'tests']), # Required 49 | extras_require={ # Optional 50 | 'dev': ['check-manifest'], 51 | }, 52 | project_urls={ # Optional 53 | 'Bug Reports': 'https://github.com/niemasd/TreeSwift/issues', 54 | 'Source': 'https://github.com/niemasd/TreeSwift', 55 | }, 56 | ) 57 | -------------------------------------------------------------------------------- /docs/_static/sidebar.js: -------------------------------------------------------------------------------- 1 | /* 2 | * This script makes the Sphinx sidebar collapsible. 3 | * 4 | * .sphinxsidebar contains .sphinxsidebarwrapper. This script adds 5 | * in .sphixsidebar, after .sphinxsidebarwrapper, the #sidebarbutton 6 | * used to collapse and expand the sidebar. 7 | * 8 | * When the sidebar is collapsed the .sphinxsidebarwrapper is hidden 9 | * and the width of the sidebar and the margin-left of the document 10 | * are decreased. When the sidebar is expanded the opposite happens. 11 | * This script saves a per-browser/per-session cookie used to 12 | * remember the position of the sidebar among the pages. 13 | * Once the browser is closed the cookie is deleted and the position 14 | * reset to the default (expanded). 15 | * 16 | */ 17 | 18 | const initialiseSidebar = () => { 19 | 20 | 21 | 22 | 23 | // global elements used by the functions. 24 | const bodyWrapper = document.getElementsByClassName("bodywrapper")[0] 25 | const sidebar = document.getElementsByClassName("sphinxsidebar")[0] 26 | const sidebarWrapper = document.getElementsByClassName('sphinxsidebarwrapper')[0] 27 | const sidebarButton = document.getElementById("sidebarbutton") 28 | const sidebarArrow = sidebarButton.querySelector('span') 29 | 30 | // for some reason, the document has no sidebar; do not run into errors 31 | if (typeof sidebar === "undefined") return; 32 | 33 | const flipArrow = element => element.innerText = (element.innerText === "»") ? "«" : "»" 34 | 35 | const collapse_sidebar = () => { 36 | bodyWrapper.style.marginLeft = ".8em"; 37 | sidebar.style.width = ".8em" 38 | sidebarWrapper.style.display = "none" 39 | flipArrow(sidebarArrow) 40 | sidebarButton.title = _('Expand sidebar') 41 | window.localStorage.setItem("sidebar", "collapsed") 42 | } 43 | 44 | const expand_sidebar = () => { 45 | bodyWrapper.style.marginLeft = "" 46 | sidebar.style.removeProperty("width") 47 | sidebarWrapper.style.display = "" 48 | flipArrow(sidebarArrow) 49 | sidebarButton.title = _('Collapse sidebar') 50 | window.localStorage.setItem("sidebar", "expanded") 51 | } 52 | 53 | sidebarButton.addEventListener("click", () => { 54 | (sidebarWrapper.style.display === "none") ? expand_sidebar() : collapse_sidebar() 55 | }) 56 | 57 | if (!window.localStorage.getItem("sidebar")) return 58 | const value = window.localStorage.getItem("sidebar") 59 | if (value === "collapsed") collapse_sidebar(); 60 | else if (value === "expanded") expand_sidebar(); 61 | } 62 | 63 | if (document.readyState !== "loading") initialiseSidebar() 64 | else document.addEventListener("DOMContentLoaded", initialiseSidebar) -------------------------------------------------------------------------------- /.tests/test.tre: -------------------------------------------------------------------------------- 1 | ((((((L147:0.324701,(L175:0.162508,L176:0.162508)I148:0.162193)I29:1.62347,((L183:0.0724336,L184:0.0724336)I181:0.0359448,L182:0.108378)I30:1.83979)I19:0.271253,((L69:1.20308,(L143:0.331782,L144:0.331782)I70:0.871297)I27:0.75577,(L35:1.88978,(L57:1.42021,((L189:0.0395976,L190:0.0395976)I95:0.637178,(L139:0.36855,L140:0.36855)I96:0.308226)I58:0.743433)I36:0.469573)I28:0.0690669)I20:0.260577)I7:1.10718,(L9:3.25292,(((((L75:1.14979,(L89:0.744407,L90:0.744407)I76:0.405379)I33:0.74263,((L127:0.39989,L128:0.39989)I105:0.214571,L106:0.61446)I34:1.27796)I31:0.0278664,((((((L137:0.378239,L138:0.378239)I111:0.225106,L112:0.603346)I109:0.00133224,(L113:0.555049,L114:0.555049)I110:0.0496291)I71:0.549486,(L131:0.385135,(L169:0.207639,L170:0.207639)I132:0.177496)I72:0.769029)I55:0.266169,(((L167:0.216587,L168:0.216587)I63:1.01811,L64:1.23469)I59:0.134541,L60:1.36923)I56:0.0510984)I37:0.420969,((L195:0.0157525,L196:0.0157525)I119:0.4918,(L135:0.379121,L136:0.379121)I120:0.128432)I38:1.33375)I32:0.0789811)I17:0.412423,(((L49:1.56867,((L83:0.878255,(L149:0.31829,L150:0.31829)I84:0.559965)I51:0.608044,((L165:0.216912,L166:0.216912)I163:0.00113418,L164:0.218047)I52:1.26825)I50:0.082368)I39:0.177888,(((L121:0.501006,L122:0.501006)I87:0.332514,L88:0.83352)I43:0.875992,(L45:1.64687,(L197:0.0101516,L198:0.0101516)I46:1.63672)I44:0.0626436)I40:0.0370436)I23:0.327625,(((L191:0.0283096,L192:0.0283096)I157:0.244775,L158:0.273085)I47:1.34044,(((L155:0.280689,L156:0.280689)I99:0.355457,(L115:0.540277,(L129:0.398734,L130:0.398734)I116:0.141543)I100:0.0958687)I65:0.597191,((L117:0.508884,(L151:0.288475,L152:0.288475)I118:0.220409)I91:0.221151,L92:0.730035)I66:0.503301)I48:0.38019)I24:0.460654)I18:0.258526)I11:0.388327,((((L185:0.0553334,L186:0.0553334)I133:0.325215,L134:0.380548)I53:1.10324,((L179:0.127113,L180:0.127113)I73:1.02664,(L123:0.486099,((L171:0.19954,(L177:0.130493,L178:0.130493)I172:0.0690462)I153:0.0813941,L154:0.280934)I124:0.205165)I74:0.667651)I54:0.330035)I13:0.935043,(((L85:0.875518,L86:0.875518)I61:0.377524,(L107:0.611435,(L141:0.354415,(L173:0.180134,L174:0.180134)I142:0.174281)I108:0.25702)I62:0.641607)I25:0.713319,((L101:0.624081,(L187:0.0402426,L188:0.0402426)I102:0.583838)I41:1.11449,(L161:0.224613,L162:0.224613)I42:1.51396)I26:0.227792)I14:0.452467)I12:0.302205)I10:0.53189)I8:0.073686)I5:0.580838,((L21:2.13854,((L125:0.459897,L126:0.459897)I81:0.497392,L82:0.957289)I22:1.18125)I15:0.27409,L16:2.41263)I6:1.49482)I1:0.196532,(((L103:0.615274,(L193:0.0175106,L194:0.0175106)I104:0.597763)I77:0.441009,L78:1.05628)I3:2.99065,((L79:1.02514,((L145:0.329653,L146:0.329653)I93:0.369685,(L159:0.267641,L160:0.267641)I94:0.431698)I80:0.3258)I67:0.183439,(L97:0.649737,L98:0.649737)I68:0.558841)I4:2.83836)I2:0.0570458)I0:2.5469; 2 | -------------------------------------------------------------------------------- /CODE_OF_CONDUCT.md: -------------------------------------------------------------------------------- 1 | # Contributor Covenant Code of Conduct 2 | 3 | ## Our Pledge 4 | 5 | In the interest of fostering an open and welcoming environment, we as contributors and maintainers pledge to making participation in our project and our community a harassment-free experience for everyone, regardless of age, body size, disability, ethnicity, gender identity and expression, level of experience, nationality, personal appearance, race, religion, or sexual identity and orientation. 6 | 7 | ## Our Standards 8 | 9 | Examples of behavior that contributes to creating a positive environment include: 10 | 11 | * Using welcoming and inclusive language 12 | * Being respectful of differing viewpoints and experiences 13 | * Gracefully accepting constructive criticism 14 | * Focusing on what is best for the community 15 | * Showing empathy towards other community members 16 | 17 | Examples of unacceptable behavior by participants include: 18 | 19 | * The use of sexualized language or imagery and unwelcome sexual attention or advances 20 | * Trolling, insulting/derogatory comments, and personal or political attacks 21 | * Public or private harassment 22 | * Publishing others' private information, such as a physical or electronic address, without explicit permission 23 | * Other conduct which could reasonably be considered inappropriate in a professional setting 24 | 25 | ## Our Responsibilities 26 | 27 | Project maintainers are responsible for clarifying the standards of acceptable behavior and are expected to take appropriate and fair corrective action in response to any instances of unacceptable behavior. 28 | 29 | Project maintainers have the right and responsibility to remove, edit, or reject comments, commits, code, wiki edits, issues, and other contributions that are not aligned to this Code of Conduct, or to ban temporarily or permanently any contributor for other behaviors that they deem inappropriate, threatening, offensive, or harmful. 30 | 31 | ## Scope 32 | 33 | This Code of Conduct applies both within project spaces and in public spaces when an individual is representing the project or its community. Examples of representing a project or community include using an official project e-mail address, posting via an official social media account, or acting as an appointed representative at an online or offline event. Representation of a project may be further defined and clarified by project maintainers. 34 | 35 | ## Enforcement 36 | 37 | Instances of abusive, harassing, or otherwise unacceptable behavior may be reported by contacting the project team at niemamoshiri@gmail.com. The project team will review and investigate all complaints, and will respond in a way that it deems appropriate to the circumstances. The project team is obligated to maintain confidentiality with regard to the reporter of an incident. Further details of specific enforcement policies may be posted separately. 38 | 39 | Project maintainers who do not follow or enforce the Code of Conduct in good faith may face temporary or permanent repercussions as determined by other members of the project's leadership. 40 | 41 | ## Attribution 42 | 43 | This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4, available at [http://contributor-covenant.org/version/1/4][version] 44 | 45 | [homepage]: http://contributor-covenant.org 46 | [version]: http://contributor-covenant.org/version/1/4/ 47 | -------------------------------------------------------------------------------- /docs/_modules/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | Overview: module code — TreeSwift documentation 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 31 | 32 |
33 |
34 |
35 |
36 | 37 |

All modules for which code is available

38 | 41 | 42 |
43 |
44 |
45 |
46 | 60 |
61 |
62 | 75 | 79 | 80 | -------------------------------------------------------------------------------- /docs/search.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | Search — TreeSwift documentation 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 38 | 39 |
40 |
41 |
42 |
43 | 44 |

Search

45 | 46 | 54 | 55 | 56 |

57 | Searching for multiple words only shows matches that contain 58 | all words. 59 |

60 | 61 | 62 |
63 | 64 | 65 | 66 |
67 | 68 | 69 |
70 | 71 | 72 |
73 |
74 |
75 |
76 | 80 |
81 |
82 | 95 | 99 | 100 | -------------------------------------------------------------------------------- /docs/py-modindex.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | Python Module Index — TreeSwift documentation 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 22 | 23 | 24 | 25 | 38 | 39 |
40 |
41 |
42 |
43 | 44 | 45 |

Python Module Index

46 | 47 |
48 | t 49 |
50 | 51 | 52 | 53 | 55 | 56 | 57 | 60 |
 
54 | t
58 | treeswift 59 |
61 | 62 | 63 |
64 |
65 |
66 |
67 | 81 |
82 |
83 | 96 | 100 | 101 | -------------------------------------------------------------------------------- /docs/_static/doctools.js: -------------------------------------------------------------------------------- 1 | /* 2 | * Base JavaScript utilities for all Sphinx HTML documentation. 3 | */ 4 | "use strict"; 5 | 6 | const BLACKLISTED_KEY_CONTROL_ELEMENTS = new Set([ 7 | "TEXTAREA", 8 | "INPUT", 9 | "SELECT", 10 | "BUTTON", 11 | ]); 12 | 13 | const _ready = (callback) => { 14 | if (document.readyState !== "loading") { 15 | callback(); 16 | } else { 17 | document.addEventListener("DOMContentLoaded", callback); 18 | } 19 | }; 20 | 21 | /** 22 | * Small JavaScript module for the documentation. 23 | */ 24 | const Documentation = { 25 | init: () => { 26 | Documentation.initDomainIndexTable(); 27 | Documentation.initOnKeyListeners(); 28 | }, 29 | 30 | /** 31 | * i18n support 32 | */ 33 | TRANSLATIONS: {}, 34 | PLURAL_EXPR: (n) => (n === 1 ? 0 : 1), 35 | LOCALE: "unknown", 36 | 37 | // gettext and ngettext don't access this so that the functions 38 | // can safely bound to a different name (_ = Documentation.gettext) 39 | gettext: (string) => { 40 | const translated = Documentation.TRANSLATIONS[string]; 41 | switch (typeof translated) { 42 | case "undefined": 43 | return string; // no translation 44 | case "string": 45 | return translated; // translation exists 46 | default: 47 | return translated[0]; // (singular, plural) translation tuple exists 48 | } 49 | }, 50 | 51 | ngettext: (singular, plural, n) => { 52 | const translated = Documentation.TRANSLATIONS[singular]; 53 | if (typeof translated !== "undefined") 54 | return translated[Documentation.PLURAL_EXPR(n)]; 55 | return n === 1 ? singular : plural; 56 | }, 57 | 58 | addTranslations: (catalog) => { 59 | Object.assign(Documentation.TRANSLATIONS, catalog.messages); 60 | Documentation.PLURAL_EXPR = new Function( 61 | "n", 62 | `return (${catalog.plural_expr})` 63 | ); 64 | Documentation.LOCALE = catalog.locale; 65 | }, 66 | 67 | /** 68 | * helper function to focus on search bar 69 | */ 70 | focusSearchBar: () => { 71 | document.querySelectorAll("input[name=q]")[0]?.focus(); 72 | }, 73 | 74 | /** 75 | * Initialise the domain index toggle buttons 76 | */ 77 | initDomainIndexTable: () => { 78 | const toggler = (el) => { 79 | const idNumber = el.id.substr(7); 80 | const toggledRows = document.querySelectorAll(`tr.cg-${idNumber}`); 81 | if (el.src.substr(-9) === "minus.png") { 82 | el.src = `${el.src.substr(0, el.src.length - 9)}plus.png`; 83 | toggledRows.forEach((el) => (el.style.display = "none")); 84 | } else { 85 | el.src = `${el.src.substr(0, el.src.length - 8)}minus.png`; 86 | toggledRows.forEach((el) => (el.style.display = "")); 87 | } 88 | }; 89 | 90 | const togglerElements = document.querySelectorAll("img.toggler"); 91 | togglerElements.forEach((el) => 92 | el.addEventListener("click", (event) => toggler(event.currentTarget)) 93 | ); 94 | togglerElements.forEach((el) => (el.style.display = "")); 95 | if (DOCUMENTATION_OPTIONS.COLLAPSE_INDEX) togglerElements.forEach(toggler); 96 | }, 97 | 98 | initOnKeyListeners: () => { 99 | // only install a listener if it is really needed 100 | if ( 101 | !DOCUMENTATION_OPTIONS.NAVIGATION_WITH_KEYS && 102 | !DOCUMENTATION_OPTIONS.ENABLE_SEARCH_SHORTCUTS 103 | ) 104 | return; 105 | 106 | document.addEventListener("keydown", (event) => { 107 | // bail for input elements 108 | if (BLACKLISTED_KEY_CONTROL_ELEMENTS.has(document.activeElement.tagName)) return; 109 | // bail with special keys 110 | if (event.altKey || event.ctrlKey || event.metaKey) return; 111 | 112 | if (!event.shiftKey) { 113 | switch (event.key) { 114 | case "ArrowLeft": 115 | if (!DOCUMENTATION_OPTIONS.NAVIGATION_WITH_KEYS) break; 116 | 117 | const prevLink = document.querySelector('link[rel="prev"]'); 118 | if (prevLink && prevLink.href) { 119 | window.location.href = prevLink.href; 120 | event.preventDefault(); 121 | } 122 | break; 123 | case "ArrowRight": 124 | if (!DOCUMENTATION_OPTIONS.NAVIGATION_WITH_KEYS) break; 125 | 126 | const nextLink = document.querySelector('link[rel="next"]'); 127 | if (nextLink && nextLink.href) { 128 | window.location.href = nextLink.href; 129 | event.preventDefault(); 130 | } 131 | break; 132 | } 133 | } 134 | 135 | // some keyboard layouts may need Shift to get / 136 | switch (event.key) { 137 | case "/": 138 | if (!DOCUMENTATION_OPTIONS.ENABLE_SEARCH_SHORTCUTS) break; 139 | Documentation.focusSearchBar(); 140 | event.preventDefault(); 141 | } 142 | }); 143 | }, 144 | }; 145 | 146 | // quick alias for translations 147 | const _ = Documentation.gettext; 148 | 149 | _ready(Documentation.init); 150 | -------------------------------------------------------------------------------- /docs/_static/pygments.css: -------------------------------------------------------------------------------- 1 | pre { line-height: 125%; } 2 | td.linenos .normal { color: inherit; background-color: transparent; padding-left: 5px; padding-right: 5px; } 3 | span.linenos { color: inherit; background-color: transparent; padding-left: 5px; padding-right: 5px; } 4 | td.linenos .special { color: #000000; background-color: #ffffc0; padding-left: 5px; padding-right: 5px; } 5 | span.linenos.special { color: #000000; background-color: #ffffc0; padding-left: 5px; padding-right: 5px; } 6 | .highlight .hll { background-color: #ffffcc } 7 | .highlight { background: #eeffcc; } 8 | .highlight .c { color: #408090; font-style: italic } /* Comment */ 9 | .highlight .err { border: 1px solid #FF0000 } /* Error */ 10 | .highlight .k { color: #007020; font-weight: bold } /* Keyword */ 11 | .highlight .o { color: #666666 } /* Operator */ 12 | .highlight .ch { color: #408090; font-style: italic } /* Comment.Hashbang */ 13 | .highlight .cm { color: #408090; font-style: italic } /* Comment.Multiline */ 14 | .highlight .cp { color: #007020 } /* Comment.Preproc */ 15 | .highlight .cpf { color: #408090; font-style: italic } /* Comment.PreprocFile */ 16 | .highlight .c1 { color: #408090; font-style: italic } /* Comment.Single */ 17 | .highlight .cs { color: #408090; background-color: #fff0f0 } /* Comment.Special */ 18 | .highlight .gd { color: #A00000 } /* Generic.Deleted */ 19 | .highlight .ge { font-style: italic } /* Generic.Emph */ 20 | .highlight .ges { font-weight: bold; font-style: italic } /* Generic.EmphStrong */ 21 | .highlight .gr { color: #FF0000 } /* Generic.Error */ 22 | .highlight .gh { color: #000080; font-weight: bold } /* Generic.Heading */ 23 | .highlight .gi { color: #00A000 } /* Generic.Inserted */ 24 | .highlight .go { color: #333333 } /* Generic.Output */ 25 | .highlight .gp { color: #c65d09; font-weight: bold } /* Generic.Prompt */ 26 | .highlight .gs { font-weight: bold } /* Generic.Strong */ 27 | .highlight .gu { color: #800080; font-weight: bold } /* Generic.Subheading */ 28 | .highlight .gt { color: #0044DD } /* Generic.Traceback */ 29 | .highlight .kc { color: #007020; font-weight: bold } /* Keyword.Constant */ 30 | .highlight .kd { color: #007020; font-weight: bold } /* Keyword.Declaration */ 31 | .highlight .kn { color: #007020; font-weight: bold } /* Keyword.Namespace */ 32 | .highlight .kp { color: #007020 } /* Keyword.Pseudo */ 33 | .highlight .kr { color: #007020; font-weight: bold } /* Keyword.Reserved */ 34 | .highlight .kt { color: #902000 } /* Keyword.Type */ 35 | .highlight .m { color: #208050 } /* Literal.Number */ 36 | .highlight .s { color: #4070a0 } /* Literal.String */ 37 | .highlight .na { color: #4070a0 } /* Name.Attribute */ 38 | .highlight .nb { color: #007020 } /* Name.Builtin */ 39 | .highlight .nc { color: #0e84b5; font-weight: bold } /* Name.Class */ 40 | .highlight .no { color: #60add5 } /* Name.Constant */ 41 | .highlight .nd { color: #555555; font-weight: bold } /* Name.Decorator */ 42 | .highlight .ni { color: #d55537; font-weight: bold } /* Name.Entity */ 43 | .highlight .ne { color: #007020 } /* Name.Exception */ 44 | .highlight .nf { color: #06287e } /* Name.Function */ 45 | .highlight .nl { color: #002070; font-weight: bold } /* Name.Label */ 46 | .highlight .nn { color: #0e84b5; font-weight: bold } /* Name.Namespace */ 47 | .highlight .nt { color: #062873; font-weight: bold } /* Name.Tag */ 48 | .highlight .nv { color: #bb60d5 } /* Name.Variable */ 49 | .highlight .ow { color: #007020; font-weight: bold } /* Operator.Word */ 50 | .highlight .w { color: #bbbbbb } /* Text.Whitespace */ 51 | .highlight .mb { color: #208050 } /* Literal.Number.Bin */ 52 | .highlight .mf { color: #208050 } /* Literal.Number.Float */ 53 | .highlight .mh { color: #208050 } /* Literal.Number.Hex */ 54 | .highlight .mi { color: #208050 } /* Literal.Number.Integer */ 55 | .highlight .mo { color: #208050 } /* Literal.Number.Oct */ 56 | .highlight .sa { color: #4070a0 } /* Literal.String.Affix */ 57 | .highlight .sb { color: #4070a0 } /* Literal.String.Backtick */ 58 | .highlight .sc { color: #4070a0 } /* Literal.String.Char */ 59 | .highlight .dl { color: #4070a0 } /* Literal.String.Delimiter */ 60 | .highlight .sd { color: #4070a0; font-style: italic } /* Literal.String.Doc */ 61 | .highlight .s2 { color: #4070a0 } /* Literal.String.Double */ 62 | .highlight .se { color: #4070a0; font-weight: bold } /* Literal.String.Escape */ 63 | .highlight .sh { color: #4070a0 } /* Literal.String.Heredoc */ 64 | .highlight .si { color: #70a0d0; font-style: italic } /* Literal.String.Interpol */ 65 | .highlight .sx { color: #c65d09 } /* Literal.String.Other */ 66 | .highlight .sr { color: #235388 } /* Literal.String.Regex */ 67 | .highlight .s1 { color: #4070a0 } /* Literal.String.Single */ 68 | .highlight .ss { color: #517918 } /* Literal.String.Symbol */ 69 | .highlight .bp { color: #007020 } /* Name.Builtin.Pseudo */ 70 | .highlight .fm { color: #06287e } /* Name.Function.Magic */ 71 | .highlight .vc { color: #bb60d5 } /* Name.Variable.Class */ 72 | .highlight .vg { color: #bb60d5 } /* Name.Variable.Global */ 73 | .highlight .vi { color: #bb60d5 } /* Name.Variable.Instance */ 74 | .highlight .vm { color: #bb60d5 } /* Name.Variable.Magic */ 75 | .highlight .il { color: #208050 } /* Literal.Number.Integer.Long */ -------------------------------------------------------------------------------- /.tests/test.nex: -------------------------------------------------------------------------------- 1 | begin trees; 2 | translate 3 | 1 Ephedra, 4 | 2 Gnetum, 5 | 3 Welwitschia, 6 | 4 Ginkgo, 7 | 5 Pinus 8 | ; 9 | tree one = [&U] ((((((L147:0.324701,(L175:0.162508,L176:0.162508)I148:0.162193)I29:1.62347,((L183:0.0724336,L184:0.0724336)I181:0.0359448,L182:0.108378)I30:1.83979)I19:0.271253,((L69:1.20308,(L143:0.331782,L144:0.331782)I70:0.871297)I27:0.75577,(L35:1.88978,(L57:1.42021,((L189:0.0395976,L190:0.0395976)I95:0.637178,(L139:0.36855,L140:0.36855)I96:0.308226)I58:0.743433)I36:0.469573)I28:0.0690669)I20:0.260577)I7:1.10718,(L9:3.25292,(((((L75:1.14979,(L89:0.744407,L90:0.744407)I76:0.405379)I33:0.74263,((L127:0.39989,L128:0.39989)I105:0.214571,L106:0.61446)I34:1.27796)I31:0.0278664,((((((L137:0.378239,L138:0.378239)I111:0.225106,L112:0.603346)I109:0.00133224,(L113:0.555049,L114:0.555049)I110:0.0496291)I71:0.549486,(L131:0.385135,(L169:0.207639,L170:0.207639)I132:0.177496)I72:0.769029)I55:0.266169,(((L167:0.216587,L168:0.216587)I63:1.01811,L64:1.23469)I59:0.134541,L60:1.36923)I56:0.0510984)I37:0.420969,((L195:0.0157525,L196:0.0157525)I119:0.4918,(L135:0.379121,L136:0.379121)I120:0.128432)I38:1.33375)I32:0.0789811)I17:0.412423,(((L49:1.56867,((L83:0.878255,(L149:0.31829,L150:0.31829)I84:0.559965)I51:0.608044,((L165:0.216912,L166:0.216912)I163:0.00113418,L164:0.218047)I52:1.26825)I50:0.082368)I39:0.177888,(((L121:0.501006,L122:0.501006)I87:0.332514,L88:0.83352)I43:0.875992,(L45:1.64687,(L197:0.0101516,L198:0.0101516)I46:1.63672)I44:0.0626436)I40:0.0370436)I23:0.327625,(((L191:0.0283096,L192:0.0283096)I157:0.244775,L158:0.273085)I47:1.34044,(((L155:0.280689,L156:0.280689)I99:0.355457,(L115:0.540277,(L129:0.398734,L130:0.398734)I116:0.141543)I100:0.0958687)I65:0.597191,((L117:0.508884,(L151:0.288475,L152:0.288475)I118:0.220409)I91:0.221151,L92:0.730035)I66:0.503301)I48:0.38019)I24:0.460654)I18:0.258526)I11:0.388327,((((L185:0.0553334,L186:0.0553334)I133:0.325215,L134:0.380548)I53:1.10324,((L179:0.127113,L180:0.127113)I73:1.02664,(L123:0.486099,((L171:0.19954,(L177:0.130493,L178:0.130493)I172:0.0690462)I153:0.0813941,L154:0.280934)I124:0.205165)I74:0.667651)I54:0.330035)I13:0.935043,(((L85:0.875518,L86:0.875518)I61:0.377524,(L107:0.611435,(L141:0.354415,(L173:0.180134,L174:0.180134)I142:0.174281)I108:0.25702)I62:0.641607)I25:0.713319,((L101:0.624081,(L187:0.0402426,L188:0.0402426)I102:0.583838)I41:1.11449,(L161:0.224613,L162:0.224613)I42:1.51396)I26:0.227792)I14:0.452467)I12:0.302205)I10:0.53189)I8:0.073686)I5:0.580838,((L21:2.13854,((L125:0.459897,L126:0.459897)I81:0.497392,L82:0.957289)I22:1.18125)I15:0.27409,L16:2.41263)I6:1.49482)I1:0.196532,(((L103:0.615274,(L193:0.0175106,L194:0.0175106)I104:0.597763)I77:0.441009,L78:1.05628)I3:2.99065,((L79:1.02514,((L145:0.329653,L146:0.329653)I93:0.369685,(L159:0.267641,L160:0.267641)I94:0.431698)I80:0.3258)I67:0.183439,(L97:0.649737,L98:0.649737)I68:0.558841)I4:2.83836)I2:0.0570458)I0:2.5469; 10 | tree two = [&U] ((((((L147:0.324701,(L175:0.162508,L176:0.162508)I148:0.162193)I29:1.62347,((L183:0.0724336,L184:0.0724336)I181:0.0359448,L182:0.108378)I30:1.83979)I19:0.271253,((L69:1.20308,(L143:0.331782,L144:0.331782)I70:0.871297)I27:0.75577,(L35:1.88978,(L57:1.42021,((L189:0.0395976,L190:0.0395976)I95:0.637178,(L139:0.36855,L140:0.36855)I96:0.308226)I58:0.743433)I36:0.469573)I28:0.0690669)I20:0.260577)I7:1.10718,(L9:3.25292,(((((L75:1.14979,(L89:0.744407,L90:0.744407)I76:0.405379)I33:0.74263,((L127:0.39989,L128:0.39989)I105:0.214571,L106:0.61446)I34:1.27796)I31:0.0278664,((((((L137:0.378239,L138:0.378239)I111:0.225106,L112:0.603346)I109:0.00133224,(L113:0.555049,L114:0.555049)I110:0.0496291)I71:0.549486,(L131:0.385135,(L169:0.207639,L170:0.207639)I132:0.177496)I72:0.769029)I55:0.266169,(((L167:0.216587,L168:0.216587)I63:1.01811,L64:1.23469)I59:0.134541,L60:1.36923)I56:0.0510984)I37:0.420969,((L195:0.0157525,L196:0.0157525)I119:0.4918,(L135:0.379121,L136:0.379121)I120:0.128432)I38:1.33375)I32:0.0789811)I17:0.412423,(((L49:1.56867,((L83:0.878255,(L149:0.31829,L150:0.31829)I84:0.559965)I51:0.608044,((L165:0.216912,L166:0.216912)I163:0.00113418,L164:0.218047)I52:1.26825)I50:0.082368)I39:0.177888,(((L121:0.501006,L122:0.501006)I87:0.332514,L88:0.83352)I43:0.875992,(L45:1.64687,(L197:0.0101516,L198:0.0101516)I46:1.63672)I44:0.0626436)I40:0.0370436)I23:0.327625,(((L191:0.0283096,L192:0.0283096)I157:0.244775,L158:0.273085)I47:1.34044,(((L155:0.280689,L156:0.280689)I99:0.355457,(L115:0.540277,(L129:0.398734,L130:0.398734)I116:0.141543)I100:0.0958687)I65:0.597191,((L117:0.508884,(L151:0.288475,L152:0.288475)I118:0.220409)I91:0.221151,L92:0.730035)I66:0.503301)I48:0.38019)I24:0.460654)I18:0.258526)I11:0.388327,((((L185:0.0553334,L186:0.0553334)I133:0.325215,L134:0.380548)I53:1.10324,((L179:0.127113,L180:0.127113)I73:1.02664,(L123:0.486099,((L171:0.19954,(L177:0.130493,L178:0.130493)I172:0.0690462)I153:0.0813941,L154:0.280934)I124:0.205165)I74:0.667651)I54:0.330035)I13:0.935043,(((L85:0.875518,L86:0.875518)I61:0.377524,(L107:0.611435,(L141:0.354415,(L173:0.180134,L174:0.180134)I142:0.174281)I108:0.25702)I62:0.641607)I25:0.713319,((L101:0.624081,(L187:0.0402426,L188:0.0402426)I102:0.583838)I41:1.11449,(L161:0.224613,L162:0.224613)I42:1.51396)I26:0.227792)I14:0.452467)I12:0.302205)I10:0.53189)I8:0.073686)I5:0.580838,((L21:2.13854,((L125:0.459897,L126:0.459897)I81:0.497392,L82:0.957289)I22:1.18125)I15:0.27409,L16:2.41263)I6:1.49482)I1:0.196532,(((L103:0.615274,(L193:0.0175106,L194:0.0175106)I104:0.597763)I77:0.441009,L78:1.05628)I3:2.99065,((L79:1.02514,((L145:0.329653,L146:0.329653)I93:0.369685,(L159:0.267641,L160:0.267641)I94:0.431698)I80:0.3258)I67:0.183439,(L97:0.649737,L98:0.649737)I68:0.558841)I4:2.83836)I2:0.0570458)I0:2.5469; 11 | end; 12 | -------------------------------------------------------------------------------- /docs/_static/classic.css: -------------------------------------------------------------------------------- 1 | /* 2 | * Sphinx stylesheet -- classic theme. 3 | */ 4 | 5 | @import url("basic.css"); 6 | 7 | /* -- page layout ----------------------------------------------------------- */ 8 | 9 | html { 10 | /* CSS hack for macOS's scrollbar (see #1125) */ 11 | background-color: #FFFFFF; 12 | } 13 | 14 | body { 15 | font-family: sans-serif; 16 | font-size: 100%; 17 | background-color: #11303d; 18 | color: #000; 19 | margin: 0; 20 | padding: 0; 21 | } 22 | 23 | div.document { 24 | display: flex; 25 | background-color: #1c4e63; 26 | } 27 | 28 | div.documentwrapper { 29 | float: left; 30 | width: 100%; 31 | } 32 | 33 | div.bodywrapper { 34 | margin: 0 0 0 230px; 35 | } 36 | 37 | div.body { 38 | background-color: #ffffff; 39 | color: #000000; 40 | padding: 0 20px 30px 20px; 41 | } 42 | 43 | div.footer { 44 | color: #ffffff; 45 | width: 100%; 46 | padding: 9px 0 9px 0; 47 | text-align: center; 48 | font-size: 75%; 49 | } 50 | 51 | div.footer a { 52 | color: #ffffff; 53 | text-decoration: underline; 54 | } 55 | 56 | div.related { 57 | background-color: #133f52; 58 | line-height: 30px; 59 | color: #ffffff; 60 | } 61 | 62 | div.related a { 63 | color: #ffffff; 64 | } 65 | 66 | div.sphinxsidebar { 67 | } 68 | 69 | div.sphinxsidebar h3 { 70 | font-family: 'Trebuchet MS', sans-serif; 71 | color: #ffffff; 72 | font-size: 1.4em; 73 | font-weight: normal; 74 | margin: 0; 75 | padding: 0; 76 | } 77 | 78 | div.sphinxsidebar h3 a { 79 | color: #ffffff; 80 | } 81 | 82 | div.sphinxsidebar h4 { 83 | font-family: 'Trebuchet MS', sans-serif; 84 | color: #ffffff; 85 | font-size: 1.3em; 86 | font-weight: normal; 87 | margin: 5px 0 0 0; 88 | padding: 0; 89 | } 90 | 91 | div.sphinxsidebar p { 92 | color: #ffffff; 93 | } 94 | 95 | div.sphinxsidebar p.topless { 96 | margin: 5px 10px 10px 10px; 97 | } 98 | 99 | div.sphinxsidebar ul { 100 | margin: 10px; 101 | padding: 0; 102 | color: #ffffff; 103 | } 104 | 105 | div.sphinxsidebar a { 106 | color: #98dbcc; 107 | } 108 | 109 | div.sphinxsidebar input { 110 | border: 1px solid #98dbcc; 111 | font-family: sans-serif; 112 | font-size: 1em; 113 | } 114 | 115 | 116 | 117 | /* -- hyperlink styles ------------------------------------------------------ */ 118 | 119 | a { 120 | color: #355f7c; 121 | text-decoration: none; 122 | } 123 | 124 | a:visited { 125 | color: #551a8b; 126 | text-decoration: none; 127 | } 128 | 129 | a:hover { 130 | text-decoration: underline; 131 | } 132 | 133 | 134 | 135 | /* -- body styles ----------------------------------------------------------- */ 136 | 137 | div.body h1, 138 | div.body h2, 139 | div.body h3, 140 | div.body h4, 141 | div.body h5, 142 | div.body h6 { 143 | font-family: 'Trebuchet MS', sans-serif; 144 | background-color: #f2f2f2; 145 | font-weight: normal; 146 | color: #20435c; 147 | border-bottom: 1px solid #ccc; 148 | margin: 20px -20px 10px -20px; 149 | padding: 3px 0 3px 10px; 150 | } 151 | 152 | div.body h1 { margin-top: 0; font-size: 200%; } 153 | div.body h2 { font-size: 160%; } 154 | div.body h3 { font-size: 140%; } 155 | div.body h4 { font-size: 120%; } 156 | div.body h5 { font-size: 110%; } 157 | div.body h6 { font-size: 100%; } 158 | 159 | a.headerlink { 160 | color: #c60f0f; 161 | font-size: 0.8em; 162 | padding: 0 4px 0 4px; 163 | text-decoration: none; 164 | } 165 | 166 | a.headerlink:hover { 167 | background-color: #c60f0f; 168 | color: white; 169 | } 170 | 171 | div.body p, div.body dd, div.body li, div.body blockquote { 172 | text-align: justify; 173 | line-height: 130%; 174 | } 175 | 176 | div.admonition p.admonition-title + p { 177 | display: inline; 178 | } 179 | 180 | div.admonition p { 181 | margin-bottom: 5px; 182 | } 183 | 184 | div.admonition pre { 185 | margin-bottom: 5px; 186 | } 187 | 188 | div.admonition ul, div.admonition ol { 189 | margin-bottom: 5px; 190 | } 191 | 192 | div.note { 193 | background-color: #eee; 194 | border: 1px solid #ccc; 195 | } 196 | 197 | div.seealso { 198 | background-color: #ffc; 199 | border: 1px solid #ff6; 200 | } 201 | 202 | nav.contents, 203 | aside.topic, 204 | div.topic { 205 | background-color: #eee; 206 | } 207 | 208 | div.warning { 209 | background-color: #ffe4e4; 210 | border: 1px solid #f66; 211 | } 212 | 213 | p.admonition-title { 214 | display: inline; 215 | } 216 | 217 | p.admonition-title:after { 218 | content: ":"; 219 | } 220 | 221 | pre { 222 | padding: 5px; 223 | background-color: unset; 224 | color: unset; 225 | line-height: 120%; 226 | border: 1px solid #ac9; 227 | border-left: none; 228 | border-right: none; 229 | } 230 | 231 | code { 232 | background-color: #ecf0f3; 233 | padding: 0 1px 0 1px; 234 | font-size: 0.95em; 235 | } 236 | 237 | th, dl.field-list > dt { 238 | background-color: #ede; 239 | } 240 | 241 | .warning code { 242 | background: #efc2c2; 243 | } 244 | 245 | .note code { 246 | background: #d6d6d6; 247 | } 248 | 249 | .viewcode-back { 250 | font-family: sans-serif; 251 | } 252 | 253 | div.viewcode-block:target { 254 | background-color: #f4debf; 255 | border-top: 1px solid #ac9; 256 | border-bottom: 1px solid #ac9; 257 | } 258 | 259 | div.code-block-caption { 260 | color: #efefef; 261 | background-color: #1c4e63; 262 | } -------------------------------------------------------------------------------- /docs/_static/language_data.js: -------------------------------------------------------------------------------- 1 | /* 2 | * This script contains the language-specific data used by searchtools.js, 3 | * namely the list of stopwords, stemmer, scorer and splitter. 4 | */ 5 | 6 | var stopwords = ["a", "and", "are", "as", "at", "be", "but", "by", "for", "if", "in", "into", "is", "it", "near", "no", "not", "of", "on", "or", "such", "that", "the", "their", "then", "there", "these", "they", "this", "to", "was", "will", "with"]; 7 | 8 | 9 | /* Non-minified version is copied as a separate JS file, if available */ 10 | 11 | /** 12 | * Porter Stemmer 13 | */ 14 | var Stemmer = function() { 15 | 16 | var step2list = { 17 | ational: 'ate', 18 | tional: 'tion', 19 | enci: 'ence', 20 | anci: 'ance', 21 | izer: 'ize', 22 | bli: 'ble', 23 | alli: 'al', 24 | entli: 'ent', 25 | eli: 'e', 26 | ousli: 'ous', 27 | ization: 'ize', 28 | ation: 'ate', 29 | ator: 'ate', 30 | alism: 'al', 31 | iveness: 'ive', 32 | fulness: 'ful', 33 | ousness: 'ous', 34 | aliti: 'al', 35 | iviti: 'ive', 36 | biliti: 'ble', 37 | logi: 'log' 38 | }; 39 | 40 | var step3list = { 41 | icate: 'ic', 42 | ative: '', 43 | alize: 'al', 44 | iciti: 'ic', 45 | ical: 'ic', 46 | ful: '', 47 | ness: '' 48 | }; 49 | 50 | var c = "[^aeiou]"; // consonant 51 | var v = "[aeiouy]"; // vowel 52 | var C = c + "[^aeiouy]*"; // consonant sequence 53 | var V = v + "[aeiou]*"; // vowel sequence 54 | 55 | var mgr0 = "^(" + C + ")?" + V + C; // [C]VC... is m>0 56 | var meq1 = "^(" + C + ")?" + V + C + "(" + V + ")?$"; // [C]VC[V] is m=1 57 | var mgr1 = "^(" + C + ")?" + V + C + V + C; // [C]VCVC... is m>1 58 | var s_v = "^(" + C + ")?" + v; // vowel in stem 59 | 60 | this.stemWord = function (w) { 61 | var stem; 62 | var suffix; 63 | var firstch; 64 | var origword = w; 65 | 66 | if (w.length < 3) 67 | return w; 68 | 69 | var re; 70 | var re2; 71 | var re3; 72 | var re4; 73 | 74 | firstch = w.substr(0,1); 75 | if (firstch == "y") 76 | w = firstch.toUpperCase() + w.substr(1); 77 | 78 | // Step 1a 79 | re = /^(.+?)(ss|i)es$/; 80 | re2 = /^(.+?)([^s])s$/; 81 | 82 | if (re.test(w)) 83 | w = w.replace(re,"$1$2"); 84 | else if (re2.test(w)) 85 | w = w.replace(re2,"$1$2"); 86 | 87 | // Step 1b 88 | re = /^(.+?)eed$/; 89 | re2 = /^(.+?)(ed|ing)$/; 90 | if (re.test(w)) { 91 | var fp = re.exec(w); 92 | re = new RegExp(mgr0); 93 | if (re.test(fp[1])) { 94 | re = /.$/; 95 | w = w.replace(re,""); 96 | } 97 | } 98 | else if (re2.test(w)) { 99 | var fp = re2.exec(w); 100 | stem = fp[1]; 101 | re2 = new RegExp(s_v); 102 | if (re2.test(stem)) { 103 | w = stem; 104 | re2 = /(at|bl|iz)$/; 105 | re3 = new RegExp("([^aeiouylsz])\\1$"); 106 | re4 = new RegExp("^" + C + v + "[^aeiouwxy]$"); 107 | if (re2.test(w)) 108 | w = w + "e"; 109 | else if (re3.test(w)) { 110 | re = /.$/; 111 | w = w.replace(re,""); 112 | } 113 | else if (re4.test(w)) 114 | w = w + "e"; 115 | } 116 | } 117 | 118 | // Step 1c 119 | re = /^(.+?)y$/; 120 | if (re.test(w)) { 121 | var fp = re.exec(w); 122 | stem = fp[1]; 123 | re = new RegExp(s_v); 124 | if (re.test(stem)) 125 | w = stem + "i"; 126 | } 127 | 128 | // Step 2 129 | re = /^(.+?)(ational|tional|enci|anci|izer|bli|alli|entli|eli|ousli|ization|ation|ator|alism|iveness|fulness|ousness|aliti|iviti|biliti|logi)$/; 130 | if (re.test(w)) { 131 | var fp = re.exec(w); 132 | stem = fp[1]; 133 | suffix = fp[2]; 134 | re = new RegExp(mgr0); 135 | if (re.test(stem)) 136 | w = stem + step2list[suffix]; 137 | } 138 | 139 | // Step 3 140 | re = /^(.+?)(icate|ative|alize|iciti|ical|ful|ness)$/; 141 | if (re.test(w)) { 142 | var fp = re.exec(w); 143 | stem = fp[1]; 144 | suffix = fp[2]; 145 | re = new RegExp(mgr0); 146 | if (re.test(stem)) 147 | w = stem + step3list[suffix]; 148 | } 149 | 150 | // Step 4 151 | re = /^(.+?)(al|ance|ence|er|ic|able|ible|ant|ement|ment|ent|ou|ism|ate|iti|ous|ive|ize)$/; 152 | re2 = /^(.+?)(s|t)(ion)$/; 153 | if (re.test(w)) { 154 | var fp = re.exec(w); 155 | stem = fp[1]; 156 | re = new RegExp(mgr1); 157 | if (re.test(stem)) 158 | w = stem; 159 | } 160 | else if (re2.test(w)) { 161 | var fp = re2.exec(w); 162 | stem = fp[1] + fp[2]; 163 | re2 = new RegExp(mgr1); 164 | if (re2.test(stem)) 165 | w = stem; 166 | } 167 | 168 | // Step 5 169 | re = /^(.+?)e$/; 170 | if (re.test(w)) { 171 | var fp = re.exec(w); 172 | stem = fp[1]; 173 | re = new RegExp(mgr1); 174 | re2 = new RegExp(meq1); 175 | re3 = new RegExp("^" + C + v + "[^aeiouwxy]$"); 176 | if (re.test(stem) || (re2.test(stem) && !(re3.test(stem)))) 177 | w = stem; 178 | } 179 | re = /ll$/; 180 | re2 = new RegExp(mgr1); 181 | if (re.test(w) && re2.test(w)) { 182 | re = /.$/; 183 | w = w.replace(re,""); 184 | } 185 | 186 | // and turn initial Y back to y 187 | if (firstch == "y") 188 | w = firstch.toLowerCase() + w.substr(1); 189 | return w; 190 | } 191 | } 192 | 193 | -------------------------------------------------------------------------------- /docs/_static/sphinx_highlight.js: -------------------------------------------------------------------------------- 1 | /* Highlighting utilities for Sphinx HTML documentation. */ 2 | "use strict"; 3 | 4 | const SPHINX_HIGHLIGHT_ENABLED = true 5 | 6 | /** 7 | * highlight a given string on a node by wrapping it in 8 | * span elements with the given class name. 9 | */ 10 | const _highlight = (node, addItems, text, className) => { 11 | if (node.nodeType === Node.TEXT_NODE) { 12 | const val = node.nodeValue; 13 | const parent = node.parentNode; 14 | const pos = val.toLowerCase().indexOf(text); 15 | if ( 16 | pos >= 0 && 17 | !parent.classList.contains(className) && 18 | !parent.classList.contains("nohighlight") 19 | ) { 20 | let span; 21 | 22 | const closestNode = parent.closest("body, svg, foreignObject"); 23 | const isInSVG = closestNode && closestNode.matches("svg"); 24 | if (isInSVG) { 25 | span = document.createElementNS("http://www.w3.org/2000/svg", "tspan"); 26 | } else { 27 | span = document.createElement("span"); 28 | span.classList.add(className); 29 | } 30 | 31 | span.appendChild(document.createTextNode(val.substr(pos, text.length))); 32 | const rest = document.createTextNode(val.substr(pos + text.length)); 33 | parent.insertBefore( 34 | span, 35 | parent.insertBefore( 36 | rest, 37 | node.nextSibling 38 | ) 39 | ); 40 | node.nodeValue = val.substr(0, pos); 41 | /* There may be more occurrences of search term in this node. So call this 42 | * function recursively on the remaining fragment. 43 | */ 44 | _highlight(rest, addItems, text, className); 45 | 46 | if (isInSVG) { 47 | const rect = document.createElementNS( 48 | "http://www.w3.org/2000/svg", 49 | "rect" 50 | ); 51 | const bbox = parent.getBBox(); 52 | rect.x.baseVal.value = bbox.x; 53 | rect.y.baseVal.value = bbox.y; 54 | rect.width.baseVal.value = bbox.width; 55 | rect.height.baseVal.value = bbox.height; 56 | rect.setAttribute("class", className); 57 | addItems.push({ parent: parent, target: rect }); 58 | } 59 | } 60 | } else if (node.matches && !node.matches("button, select, textarea")) { 61 | node.childNodes.forEach((el) => _highlight(el, addItems, text, className)); 62 | } 63 | }; 64 | const _highlightText = (thisNode, text, className) => { 65 | let addItems = []; 66 | _highlight(thisNode, addItems, text, className); 67 | addItems.forEach((obj) => 68 | obj.parent.insertAdjacentElement("beforebegin", obj.target) 69 | ); 70 | }; 71 | 72 | /** 73 | * Small JavaScript module for the documentation. 74 | */ 75 | const SphinxHighlight = { 76 | 77 | /** 78 | * highlight the search words provided in localstorage in the text 79 | */ 80 | highlightSearchWords: () => { 81 | if (!SPHINX_HIGHLIGHT_ENABLED) return; // bail if no highlight 82 | 83 | // get and clear terms from localstorage 84 | const url = new URL(window.location); 85 | const highlight = 86 | localStorage.getItem("sphinx_highlight_terms") 87 | || url.searchParams.get("highlight") 88 | || ""; 89 | localStorage.removeItem("sphinx_highlight_terms") 90 | url.searchParams.delete("highlight"); 91 | window.history.replaceState({}, "", url); 92 | 93 | // get individual terms from highlight string 94 | const terms = highlight.toLowerCase().split(/\s+/).filter(x => x); 95 | if (terms.length === 0) return; // nothing to do 96 | 97 | // There should never be more than one element matching "div.body" 98 | const divBody = document.querySelectorAll("div.body"); 99 | const body = divBody.length ? divBody[0] : document.querySelector("body"); 100 | window.setTimeout(() => { 101 | terms.forEach((term) => _highlightText(body, term, "highlighted")); 102 | }, 10); 103 | 104 | const searchBox = document.getElementById("searchbox"); 105 | if (searchBox === null) return; 106 | searchBox.appendChild( 107 | document 108 | .createRange() 109 | .createContextualFragment( 110 | '" 114 | ) 115 | ); 116 | }, 117 | 118 | /** 119 | * helper function to hide the search marks again 120 | */ 121 | hideSearchWords: () => { 122 | document 123 | .querySelectorAll("#searchbox .highlight-link") 124 | .forEach((el) => el.remove()); 125 | document 126 | .querySelectorAll("span.highlighted") 127 | .forEach((el) => el.classList.remove("highlighted")); 128 | localStorage.removeItem("sphinx_highlight_terms") 129 | }, 130 | 131 | initEscapeListener: () => { 132 | // only install a listener if it is really needed 133 | if (!DOCUMENTATION_OPTIONS.ENABLE_SEARCH_SHORTCUTS) return; 134 | 135 | document.addEventListener("keydown", (event) => { 136 | // bail for input elements 137 | if (BLACKLISTED_KEY_CONTROL_ELEMENTS.has(document.activeElement.tagName)) return; 138 | // bail with special keys 139 | if (event.shiftKey || event.altKey || event.ctrlKey || event.metaKey) return; 140 | if (DOCUMENTATION_OPTIONS.ENABLE_SEARCH_SHORTCUTS && (event.key === "Escape")) { 141 | SphinxHighlight.hideSearchWords(); 142 | event.preventDefault(); 143 | } 144 | }); 145 | }, 146 | }; 147 | 148 | _ready(() => { 149 | /* Do not call highlightSearchWords() when we are on the search page. 150 | * It will highlight words from the *previous* search query. 151 | */ 152 | if (typeof Search === "undefined") SphinxHighlight.highlightSearchWords(); 153 | SphinxHighlight.initEscapeListener(); 154 | }); 155 | -------------------------------------------------------------------------------- /docs_src/source/conf.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | # 3 | # Configuration file for the Sphinx documentation builder. 4 | # 5 | # This file does only contain a selection of the most common options. For a 6 | # full list see the documentation: 7 | # http://www.sphinx-doc.org/en/master/config 8 | 9 | # -- Path setup -------------------------------------------------------------- 10 | 11 | # If extensions (or modules to document with autodoc) are in another directory, 12 | # add these directories to sys.path here. If the directory is relative to the 13 | # documentation root, use os.path.abspath to make it absolute, like shown here. 14 | # 15 | # import os 16 | # import sys 17 | # sys.path.insert(0, os.path.abspath('.')) 18 | 19 | 20 | # -- Project information ----------------------------------------------------- 21 | 22 | project = 'TreeSwift' 23 | copyright = '2018, Niema Moshiri' 24 | author = 'Niema Moshiri' 25 | 26 | # The short X.Y version 27 | version = '' 28 | # The full version, including alpha/beta/rc tags 29 | release = '' 30 | 31 | 32 | # -- General configuration --------------------------------------------------- 33 | 34 | # If your documentation needs a minimal Sphinx version, state it here. 35 | # 36 | # needs_sphinx = '1.0' 37 | 38 | # Add any Sphinx extension module names here, as strings. They can be 39 | # extensions coming with Sphinx (named 'sphinx.ext.*') or your custom 40 | # ones. 41 | extensions = [ 42 | 'sphinx.ext.autodoc', 43 | 'sphinx.ext.doctest', 44 | 'sphinx.ext.mathjax', 45 | 'sphinx.ext.viewcode', 46 | 'sphinx.ext.githubpages', 47 | ] 48 | 49 | # Add any paths that contain templates here, relative to this directory. 50 | templates_path = ['.templates'] 51 | 52 | # The suffix(es) of source filenames. 53 | # You can specify multiple suffix as a list of string: 54 | # 55 | # source_suffix = ['.rst', '.md'] 56 | source_suffix = '.rst' 57 | 58 | # The master toctree document. 59 | master_doc = 'index' 60 | 61 | # The language for content autogenerated by Sphinx. Refer to documentation 62 | # for a list of supported languages. 63 | # 64 | # This is also used if you do content translation via gettext catalogs. 65 | # Usually you set "language" from the command line for these cases. 66 | language = None 67 | 68 | # List of patterns, relative to source directory, that match files and 69 | # directories to ignore when looking for source files. 70 | # This pattern also affects html_static_path and html_extra_path . 71 | exclude_patterns = [] 72 | 73 | # The name of the Pygments (syntax highlighting) style to use. 74 | pygments_style = 'sphinx' 75 | 76 | 77 | # -- Options for HTML output ------------------------------------------------- 78 | 79 | # The theme to use for HTML and HTML Help pages. See the documentation for 80 | # a list of builtin themes. 81 | # 82 | html_theme = 'classic' 83 | 84 | # Theme options are theme-specific and customize the look and feel of a theme 85 | # further. For a list of options available for each theme, see the 86 | # documentation. 87 | # 88 | # html_theme_options = {} 89 | 90 | # Add any paths that contain custom static files (such as style sheets) here, 91 | # relative to this directory. They are copied after the builtin static files, 92 | # so a file named "default.css" will overwrite the builtin "default.css". 93 | html_static_path = ['.static'] 94 | 95 | # Custom sidebar templates, must be a dictionary that maps document names 96 | # to template names. 97 | # 98 | # The default sidebars (for documents that don't match any pattern) are 99 | # defined by theme itself. Builtin themes are using these templates by 100 | # default: ``['localtoc.html', 'relations.html', 'sourcelink.html', 101 | # 'searchbox.html']``. 102 | # 103 | # html_sidebars = {} 104 | 105 | 106 | # -- Options for HTMLHelp output --------------------------------------------- 107 | 108 | # Output file base name for HTML help builder. 109 | htmlhelp_basename = 'TreeSwiftdoc' 110 | 111 | 112 | # -- Options for LaTeX output ------------------------------------------------ 113 | 114 | latex_elements = { 115 | # The paper size ('letterpaper' or 'a4paper'). 116 | # 117 | # 'papersize': 'letterpaper', 118 | 119 | # The font size ('10pt', '11pt' or '12pt'). 120 | # 121 | # 'pointsize': '10pt', 122 | 123 | # Additional stuff for the LaTeX preamble. 124 | # 125 | # 'preamble': '', 126 | 127 | # Latex figure (float) alignment 128 | # 129 | # 'figure_align': 'htbp', 130 | } 131 | 132 | # Grouping the document tree into LaTeX files. List of tuples 133 | # (source start file, target name, title, 134 | # author, documentclass [howto, manual, or own class]). 135 | latex_documents = [ 136 | (master_doc, 'TreeSwift.tex', 'TreeSwift Documentation', 137 | 'Niema Moshiri', 'manual'), 138 | ] 139 | 140 | 141 | # -- Options for manual page output ------------------------------------------ 142 | 143 | # One entry per manual page. List of tuples 144 | # (source start file, name, description, authors, manual section). 145 | man_pages = [ 146 | (master_doc, 'treeswift', 'TreeSwift Documentation', 147 | [author], 1) 148 | ] 149 | 150 | 151 | # -- Options for Texinfo output ---------------------------------------------- 152 | 153 | # Grouping the document tree into Texinfo files. List of tuples 154 | # (source start file, target name, title, author, 155 | # dir menu entry, description, category) 156 | texinfo_documents = [ 157 | (master_doc, 'TreeSwift', 'TreeSwift Documentation', 158 | author, 'TreeSwift', 'One line description of project.', 159 | 'Miscellaneous'), 160 | ] 161 | 162 | 163 | # -- Options for Epub output ------------------------------------------------- 164 | 165 | # Bibliographic Dublin Core info. 166 | epub_title = project 167 | epub_author = author 168 | epub_publisher = author 169 | epub_copyright = copyright 170 | 171 | # The unique identifier of the text. This can be a ISBN number 172 | # or the project homepage. 173 | # 174 | # epub_identifier = '' 175 | 176 | # A unique identification for the text. 177 | # 178 | # epub_uid = '' 179 | 180 | # A list of files that should not be packed into the epub file. 181 | epub_exclude_files = ['search.html'] 182 | 183 | 184 | # -- Extension configuration ------------------------------------------------- 185 | -------------------------------------------------------------------------------- /.tests/tests.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | from copy import copy 3 | from os.path import dirname, realpath 4 | from random import sample 5 | from treeswift import read_tree_newick, read_tree_nexml, read_tree_nexus 6 | PATH = dirname(realpath(__file__)) 7 | NEWICK_FILE = '%s/test.tre' % PATH 8 | NEWICK_GZIP = '%s/test.tre.gz' % PATH 9 | NEWICK_STR = open(NEWICK_FILE).read().strip() 10 | NEXUS_FILE = '%s/test.nex' % PATH 11 | NEXUS_GZIP = '%s/test.nex.gz' % PATH 12 | NEXUS_STR = open(NEXUS_FILE).read().strip() 13 | NEXML_FILE = '%s/test.nexml' % PATH 14 | NEXML_GZIP = '%s/test.nexml.gz' % PATH 15 | NEXML_STR = open(NEXML_FILE).read().strip() 16 | 17 | # tests 18 | def test_avg_branch_length(t): 19 | o = t.avg_branch_length() 20 | o = t.avg_branch_length(terminal=False) 21 | o = t.avg_branch_length(internal=False) 22 | def test_branch_lengths(t): 23 | o = t.branch_lengths() 24 | o = t.branch_lengths(terminal=False) 25 | o = t.branch_lengths(internal=False) 26 | def test_closest_leaf_to_root(t): 27 | l,d = t.closest_leaf_to_root() 28 | def test_coalescence_times(t): 29 | for d in t.coalescence_times(): 30 | pass 31 | for d in t.coalescence_times(backward=False): 32 | pass 33 | def test_coalescence_waiting_times(t): 34 | for l in t.coalescence_waiting_times(): 35 | pass 36 | for l in t.coalescence_waiting_times(backward=False): 37 | pass 38 | def test_collapse_short_branches(t): 39 | copy(t).collapse_short_branches(float('inf')) 40 | def test_contract_low_support(t): 41 | copy(t).contract_low_support(float('inf')) 42 | def test_copy(t): 43 | o = copy(t) 44 | def test_diameter(t): 45 | d = t.diameter() 46 | def test_distance_between(t): 47 | u,v = list(t.traverse_leaves())[:2] 48 | d = t.distance_between(u,v) 49 | def test_distance_matrix(t): 50 | m = t.distance_matrix() 51 | def test_distances_from_parent(t): 52 | for n,d in t.distances_from_parent(): 53 | pass 54 | for n,d in t.distances_from_parent(leaves=False): 55 | pass 56 | for n,d in t.distances_from_parent(internal=False): 57 | pass 58 | for n,d in t.distances_from_parent(unlabeled=True): 59 | pass 60 | for n,d in t.distances_from_parent(leaves=False, internal=False, unlabeled=True): 61 | pass 62 | def test_distances_from_root(t): 63 | for n,d in t.distances_from_root(): 64 | pass 65 | for n,d in t.distances_from_root(leaves=False): 66 | pass 67 | for n,d in t.distances_from_root(internal=False): 68 | pass 69 | for n,d in t.distances_from_root(unlabeled=True): 70 | pass 71 | for n,d in t.distances_from_root(leaves=False, internal=False, unlabeled=True): 72 | pass 73 | def test_edge_length_sum(t): 74 | o = t.edge_length_sum() 75 | o = t.edge_length_sum(terminal=False) 76 | o = t.edge_length_sum(internal=False) 77 | o = t.edge_length_sum(terminal=False, internal=False) 78 | def test_extract_tree_with(t): 79 | o = t.extract_tree_with(sample([str(l) for l in t.traverse_leaves()],10)) 80 | def test_extract_tree_without(t): 81 | o = t.extract_tree_without(sample([str(l) for l in t.traverse_leaves()],10)) 82 | def test_furthest_from_root(t): 83 | n,d = t.furthest_from_root() 84 | def test_gamma_statistic(t): 85 | g = t.gamma_statistic() 86 | def test_get_edge_length(t): 87 | for n in t.traverse_preorder(): 88 | l = n.get_edge_length() 89 | def test_get_label(t): 90 | for n in t.traverse_preorder(): 91 | l = n.get_label() 92 | def test_height(t): 93 | h = t.height() 94 | def test_indent(t): 95 | s = t.indent() 96 | def test_label_to_node(t): 97 | for l,n in t.label_to_node().items(): 98 | pass 99 | def test_labels(t): 100 | for l in t.labels(): 101 | pass 102 | for l in t.labels(leaves=False): 103 | pass 104 | for l in t.labels(internal=False): 105 | pass 106 | for l in t.labels(leaves=False,internal=False): 107 | pass 108 | def test_ladderize(t): 109 | t.ladderize() 110 | t.ladderize(ascending=False) 111 | def test_mrca(t): 112 | o = t.mrca(sample([str(l) for l in t.traverse_leaves()],10)) 113 | def test_mrca_matrix(t): 114 | m = t.mrca_matrix() 115 | def test_newick(t): 116 | s = t.newick(); s = str(t) 117 | def test_num_lineages_at(t): 118 | o = t.num_lineages_at(0) 119 | o = t.num_lineages_at(1) 120 | o = t.num_lineages_at(float('inf')) 121 | def test_num_nodes(t): 122 | o = t.num_nodes() 123 | o = t.num_nodes(leaves=False) 124 | o = t.num_nodes(internal=False) 125 | o = t.num_nodes(leaves=False,internal=False) 126 | def test_order(t): 127 | t.order('edge_length') 128 | t.order('edge_length_then_label') 129 | t.order('edge_length_then_label_then_num_descendants') 130 | t.order('edge_length_then_num_descendants') 131 | t.order('edge_length_then_num_descendants_then_label') 132 | t.order('label') 133 | t.order('label_then_edge_length') 134 | t.order('label_then_edge_length_then_num_descendants') 135 | t.order('label_then_num_descendants') 136 | t.order('label_then_num_descendants_then_edge_length') 137 | t.order('num_descendants') 138 | t.order('num_descendants_then_label') 139 | t.order('num_descendants_then_label_then_edge_length') 140 | t.order('num_descendants_then_edge_length') 141 | t.order('num_descendants_then_edge_length_then_label') 142 | def test_rename_nodes_condense(t): 143 | m = dict() 144 | for l in t.traverse_leaves(): 145 | m[str(l)] = 'NIEMA' 146 | t2 = copy(t) 147 | t2.rename_nodes(m) 148 | t2.condense() 149 | def test_resolve_polytomies(t): 150 | t2 = copy(t) 151 | t2.collapse_short_branches(float('inf')) 152 | t2.resolve_polytomies() 153 | def test_sackin(t): 154 | o = t.sackin() 155 | o = t.sackin(None) 156 | o = t.sackin('yule') 157 | o = t.sackin('pda') 158 | def test_scale_edges(t): 159 | copy(t).scale_edges(1.5) 160 | def test_set_edge_length(t): 161 | for n in copy(t).traverse_preorder(): 162 | n.set_edge_length(0) 163 | def test_set_label(t): 164 | for n in copy(t).traverse_preorder(): 165 | n.set_label('NIEMA') 166 | def test_traverse_inorder(t): 167 | for n in t.traverse_inorder(): 168 | pass 169 | def test_traverse_leaves(t): 170 | for l in t.traverse_leaves(): 171 | pass 172 | def test_traverse_levelorder(t): 173 | for n in t.traverse_levelorder(): 174 | pass 175 | def test_traverse_postorder(t): 176 | for n in t.traverse_postorder(): 177 | pass 178 | def test_traverse_preorder(t): 179 | for n in t.traverse_preorder(): 180 | pass 181 | def test_traverse_rootdistorder(t): 182 | for n in t.traverse_rootdistorder(ascending=True): 183 | pass 184 | for n in t.traverse_rootdistorder(ascending=False): 185 | pass 186 | def test_treeness(t): 187 | o = t.treeness() 188 | def test_write_tree_newick(t): 189 | t.write_tree_newick('test_write_tree_newick.tre') 190 | read_tree_newick('test_write_tree_newick.tre') 191 | t.write_tree_newick('test_write_tree_newick.tre.gz') 192 | read_tree_newick('test_write_tree_newick.tre.gz') 193 | 194 | # run tests 195 | if __name__ == "__main__": 196 | tests = [v for k,v in locals().items() if callable(v) and v.__module__ == __name__] 197 | trees = [read_tree_newick(NEWICK_FILE), read_tree_newick(NEWICK_GZIP), read_tree_newick(NEWICK_STR)] 198 | for nex in [NEXUS_FILE, NEXUS_GZIP, NEXUS_STR]: 199 | trees += read_tree_nexus(nex).values() 200 | for t in trees: 201 | for test in tests: 202 | test(t) 203 | for nexml in [NEXML_FILE, NEXML_GZIP, NEXML_STR]: 204 | read_tree_nexml(nexml) 205 | -------------------------------------------------------------------------------- /treeswift/Node.py: -------------------------------------------------------------------------------- 1 | #! /usr/bin/env python 2 | from collections import deque 3 | from copy import copy 4 | UNSAFE_SYMBOLS = {';', '(', ')', ',', '[', ']', ':', "'"} 5 | INORDER_NONBINARY = "Can't do inorder traversal on non-binary tree" 6 | INVALID_NEWICK = "Tree not valid Newick tree" 7 | 8 | class Node: 9 | '''``Node`` class''' 10 | def __init__(self, label=None, edge_length=None): 11 | '''``Node`` constructor 12 | 13 | Args: 14 | ``label`` (``str``): Label of this ``Node`` 15 | 16 | ``edge_length`` (``float``): Length of the edge incident to this ``Node`` 17 | 18 | Returns: 19 | ``Node`` object 20 | ''' 21 | self.children = [] # list of child Node objects 22 | self.parent = None # parent Node object (None for root) 23 | self.label = label # label 24 | self.edge_length = edge_length # length of incident edge 25 | 26 | def __lt__(self, other): 27 | '''Less Than operator. Just compares labels''' 28 | if not isinstance(other,Node): 29 | raise TypeError(f"'<' not supported between instances of '{type(self).__name__}' and '{type(other).__name__}'") 30 | elif self.label is None and other.label is not None: 31 | return True 32 | elif other.label is None: 33 | return False 34 | try: 35 | return float(self.label) < float(other.label) 36 | except: 37 | return str(self.label) < str(other.label) 38 | 39 | def __str__(self): 40 | '''Represent ``Node`` as a string (currently returns ``Node`` label as a string) 41 | 42 | Returns: 43 | ``str``: string representation of this ``Node`` 44 | ''' 45 | if self.label is None: 46 | return '' 47 | else: 48 | return str(self.label) 49 | 50 | def __copy__(self): 51 | '''Copy this ``Node`` 52 | 53 | Returns: 54 | ``Node``: A copy of this ``Node`` 55 | ''' 56 | out = Node(label=copy(self.label), edge_length=copy(self.edge_length)) 57 | out.children = copy(self.children) 58 | out.parent = self.parent 59 | return out 60 | 61 | def add_child(self, child): 62 | '''Add child to ``Node`` object 63 | 64 | Args: 65 | ``child`` (``Node``): The child ``Node`` to be added 66 | ''' 67 | if not isinstance(child, Node): 68 | raise TypeError("child must be a Node") 69 | self.children.append(child); child.parent = self 70 | 71 | def child_nodes(self): 72 | '''Return a ``list`` containing this ``Node`` object's children 73 | 74 | Returns: 75 | ``list``: A ``list`` containing this ``Node`` object's children 76 | ''' 77 | return copy(self.children) 78 | 79 | def contract(self): 80 | '''Contract this ``Node`` by directly connecting its children to its parent''' 81 | if self.is_root(): 82 | return 83 | for c in self.children: 84 | if self.edge_length is not None and c.edge_length is not None: 85 | c.edge_length += self.edge_length 86 | self.parent.add_child(c) 87 | self.parent.remove_child(self) 88 | 89 | def get_edge_length(self): 90 | '''Return the length of the edge incident to this ``Node`` 91 | 92 | Returns: 93 | ``float``: The length of the edge incident to this ``Node`` 94 | ''' 95 | return self.edge_length 96 | 97 | def get_label(self): 98 | '''Return the label of this ``Node`` 99 | 100 | Returns: 101 | ``object``: The label of this ``Node`` 102 | ''' 103 | return self.label 104 | 105 | def get_parent(self): 106 | '''Return the parent of this ``Node`` 107 | 108 | Returns: 109 | ``Node``: The parent of this ``Node`` 110 | ''' 111 | return self.parent 112 | 113 | def is_leaf(self): 114 | '''Returns ``True`` if this is a leaf 115 | 116 | Returns: 117 | ``bool``: ``True`` if this is a leaf, otherwise ``False`` 118 | ''' 119 | return len(self.children) == 0 120 | 121 | def is_root(self): 122 | '''Returns ``True`` if this is the ``root`` 123 | 124 | Returns: 125 | ``bool``: ``True`` if this is the root, otherwise ``False`` 126 | ''' 127 | return self.parent is None 128 | 129 | def newick(self): 130 | '''Newick string conversion starting at this ``Node`` object 131 | 132 | Returns: 133 | ``str``: Newick string conversion starting at this ``Node`` object 134 | ''' 135 | for node in self.traverse_postorder(): 136 | # handle current node's label 137 | if node.label is None: 138 | str_label = '' 139 | else: 140 | str_label = str(node.label) 141 | for c in UNSAFE_SYMBOLS: 142 | if c in str_label: 143 | str_label = f"'{str_label}'"; break 144 | 145 | # leaf Newick representation is just its label 146 | if node.is_leaf(): 147 | node.string_rep = str_label 148 | 149 | # handle internal node Newick representation 150 | else: 151 | out = ['('] 152 | for c in node.children: 153 | out.append(c.string_rep) 154 | if hasattr(c, 'node_params'): 155 | out.append(f'[{str(c.node_params)}]') 156 | if c.edge_length is not None or hasattr(c, 'edge_params'): 157 | out.append(':') 158 | if hasattr(c, 'edge_params'): 159 | out.append(f'[{str(c.edge_params)}]') 160 | if isinstance(c.edge_length, float) and c.edge_length.is_integer(): 161 | out.append(str(int(c.edge_length))) 162 | elif c.edge_length is not None: 163 | out.append(str(c.edge_length)) 164 | out.append(',') 165 | del c.string_rep 166 | out.pop() # trailing comma 167 | out.append(')') 168 | if node.label is not None: 169 | out.append(str_label) 170 | node.string_rep = ''.join(out) 171 | out = self.string_rep; del self.string_rep 172 | return out 173 | 174 | def num_children(self): 175 | '''Returns the number of children of this ``Node`` 176 | 177 | Returns: 178 | ``int``: The number of children of this ``Node`` 179 | ''' 180 | return len(self.children) 181 | 182 | def num_nodes(self, leaves=True, internal=True): 183 | '''Compute the total number of selected nodes in the subtree rooted by this ``Node`` (including itself) 184 | 185 | Args: 186 | ``leaves`` (``bool``): ``True`` to include leaves, otherwise ``False`` 187 | 188 | ``internal`` (``bool``): ``True`` to include internal nodes, otherwise ``False`` 189 | 190 | Returns: 191 | ``int``: The total number of selected nodes in this ``Tree`` 192 | ''' 193 | if not isinstance(leaves, bool): 194 | raise TypeError("leaves must be a bool") 195 | if not isinstance(internal, bool): 196 | raise TypeError("internal must be a bool") 197 | return sum((leaves and node.is_leaf()) or (internal and not node.is_leaf()) for node in self.traverse_preorder()) 198 | 199 | def remove_child(self, child): 200 | '''Remove child from ``Node`` object 201 | 202 | Args: 203 | ``child`` (``Node``): The child to remove 204 | ''' 205 | if not isinstance(child, Node): 206 | raise TypeError("child must be a Node") 207 | try: 208 | self.children.remove(child); child.parent = None 209 | except: 210 | raise RuntimeError("Attempting to remove non-existent child") 211 | 212 | def resolve_polytomies(self): 213 | '''Arbitrarily resolve polytomies below this ``Node`` with 0-lengthed edges.''' 214 | q = deque(); q.append(self) 215 | while len(q) != 0: 216 | node = q.popleft() 217 | while len(node.children) > 2: 218 | c1 = node.children.pop(); c2 = node.children.pop() 219 | nn = Node(edge_length=0); node.add_child(nn) 220 | nn.add_child(c1); nn.add_child(c2) 221 | q.extend(node.children) 222 | 223 | def set_edge_length(self, length): 224 | '''Set the length of the edge incident to this ``Node`` 225 | 226 | Args: 227 | ``length``: The new length of the edge incident to this ``Node`` 228 | ''' 229 | try: 230 | self.edge_length = float(length) 231 | except: 232 | raise TypeError("length must be a float") 233 | 234 | def set_label(self, label): 235 | '''Set the label of this ``Node`` object 236 | 237 | Args: 238 | ``label``: The new label 239 | ''' 240 | self.label = label 241 | 242 | def set_parent(self, parent): 243 | '''Set the parent of this ``Node`` object. Use this carefully, otherwise you may damage the structure of this ``Tree`` object. 244 | 245 | Args: 246 | ``Node``: The new parent of this ``Node`` 247 | ''' 248 | if not isinstance(parent, Node): 249 | raise TypeError("parent must be a Node") 250 | self.parent = parent 251 | 252 | def traverse_ancestors(self, include_self=True): 253 | '''Traverse over the ancestors of this ``Node`` 254 | 255 | Args: 256 | ``include_self`` (``bool``): ``True`` to include self in the traversal, otherwise ``False`` 257 | ''' 258 | if not isinstance(include_self, bool): 259 | raise TypeError("include_self must be a bool") 260 | if include_self: 261 | c = self 262 | else: 263 | c = self.parent 264 | while c is not None: 265 | yield c; c = c.parent 266 | 267 | def traverse_bfs(self, include_self=True): 268 | '''Perform a Breadth-First Search (BFS) starting at this ``Node`` object'. Yields (``Node``, distance) tuples 269 | 270 | Args: 271 | ``include_self`` (``bool``): ``True`` to include self in the traversal, otherwise ``False`` 272 | ''' 273 | if not isinstance(include_self, bool): 274 | raise TypeError("include_self must be a bool") 275 | q = deque(); dist = {self: 0}; q.append((self,0)) 276 | while len(q) != 0: 277 | curr = q.popleft(); yield curr 278 | for c in curr[0].children: 279 | if c not in dist: 280 | if c.edge_length is None: 281 | el = 0 282 | else: 283 | el = c.edge_length 284 | dist[c] = dist[curr[0]] + el; q.append((c,dist[c])) 285 | if curr[0].parent is not None and curr[0].parent not in dist: 286 | if curr[0].edge_length is None: 287 | el = 0 288 | else: 289 | el = curr[0].edge_length 290 | dist[curr[0].parent] = dist[curr[0]] + el; q.append((curr[0].parent,dist[curr[0].parent])) 291 | 292 | def traverse_inorder(self, leaves=True, internal=True): 293 | '''Perform an inorder traversal starting at this ``Node`` object 294 | 295 | Args: 296 | ``leaves`` (``bool``): ``True`` to include leaves, otherwise ``False`` 297 | 298 | ``internal`` (``bool``): ``True`` to include internal nodes, otherwise ``False`` 299 | ''' 300 | c = self; s = deque(); done = False 301 | while not done: 302 | if c is None: 303 | if len(s) == 0: 304 | done = True 305 | else: 306 | c = s.pop() 307 | if (leaves and c.is_leaf()) or (internal and not c.is_leaf()): 308 | yield c 309 | if len(c.children) == 0: 310 | c = None 311 | elif len(c.children) == 2: 312 | c = c.children[1] 313 | else: 314 | raise RuntimeError(INORDER_NONBINARY) 315 | else: 316 | s.append(c) 317 | if len(c.children) == 0: 318 | c = None 319 | elif len(c.children) == 2: 320 | c = c.children[0] 321 | else: 322 | raise RuntimeError(INORDER_NONBINARY) 323 | 324 | def traverse_internal(self): 325 | '''Traverse over the internal nodes below (and including) this ``Node`` object''' 326 | yield from self.traverse_preorder(leaves=False) 327 | 328 | def traverse_leaves(self): 329 | '''Traverse over the leaves below this ``Node`` object''' 330 | yield from self.traverse_preorder(internal=False) 331 | 332 | def traverse_levelorder(self, leaves=True, internal=True): 333 | '''Perform a levelorder traversal starting at this ``Node`` object 334 | 335 | Args: 336 | ``leaves`` (``bool``): ``True`` to include leaves, otherwise ``False`` 337 | 338 | ``internal`` (``bool``): ``True`` to include internal nodes, otherwise ``False`` 339 | ''' 340 | q = deque(); q.append(self) 341 | while len(q) != 0: 342 | n = q.popleft() 343 | if (leaves and n.is_leaf()) or (internal and not n.is_leaf()): 344 | yield n 345 | q.extend(n.children) 346 | 347 | def traverse_postorder(self, leaves=True, internal=True): 348 | '''Perform a postorder traversal starting at this ``Node`` object 349 | 350 | Args: 351 | ``leaves`` (``bool``): ``True`` to include leaves, otherwise ``False`` 352 | 353 | ``internal`` (``bool``): ``True`` to include internal nodes, otherwise ``False`` 354 | ''' 355 | s1 = deque(); s2 = deque(); s1.append(self) 356 | while len(s1) != 0: 357 | n = s1.pop(); s2.append(n); s1.extend(n.children) 358 | while len(s2) != 0: 359 | n = s2.pop() 360 | if (leaves and n.is_leaf()) or (internal and not n.is_leaf()): 361 | yield n 362 | 363 | def traverse_preorder(self, leaves=True, internal=True): 364 | '''Perform a preorder traversal starting at this ``Node`` object 365 | 366 | Args: 367 | ``leaves`` (``bool``): ``True`` to include leaves, otherwise ``False`` 368 | 369 | ``internal`` (``bool``): ``True`` to include internal nodes, otherwise ``False`` 370 | ''' 371 | s = deque(); s.append(self) 372 | while len(s) != 0: 373 | n = s.pop() 374 | if (leaves and n.is_leaf()) or (internal and not n.is_leaf()): 375 | yield n 376 | s.extend(n.children) 377 | 378 | def traverse_rootdistorder(self, ascending=True, leaves=True, internal=True): 379 | '''Perform a traversal of the ``Node`` objects in the subtree rooted at this ``Node`` in either ascending (``ascending=True``) or descending (``ascending=False``) order of distance from this ``Node`` 380 | 381 | Args: 382 | ``ascending`` (``bool``): ``True`` to perform traversal in ascending distance from the root, otherwise ``False`` for descending 383 | 384 | ``leaves`` (``bool``): ``True`` to include leaves, otherwise ``False`` 385 | 386 | ``internal`` (``bool``): ``True`` to include internal nodes, otherwise ``False`` 387 | ''' 388 | if not isinstance(ascending, bool): 389 | raise TypeError("ascending must be a bool") 390 | nodes = []; dist_from_root = {} 391 | for node in self.traverse_preorder(): 392 | if node == self: 393 | d = 0 394 | else: 395 | d = dist_from_root[node.parent] 396 | if node.edge_length is not None: 397 | d += node.edge_length 398 | dist_from_root[node] = d 399 | if (leaves and node.is_leaf()) or (internal and not node.is_leaf()): 400 | nodes.append((d,node)) 401 | nodes.sort(reverse=(not ascending)) 402 | yield from nodes 403 | -------------------------------------------------------------------------------- /docs/searchindex.js: -------------------------------------------------------------------------------- 1 | Search.setIndex({"alltitles": {"Module contents": [[0, "module-treeswift"]], "treeswift package": [[0, null]]}, "docnames": ["index"], "envversion": {"sphinx": 64, "sphinx.domains.c": 3, "sphinx.domains.changeset": 1, "sphinx.domains.citation": 1, "sphinx.domains.cpp": 9, "sphinx.domains.index": 1, "sphinx.domains.javascript": 3, "sphinx.domains.math": 2, "sphinx.domains.python": 4, "sphinx.domains.rst": 2, "sphinx.domains.std": 2, "sphinx.ext.viewcode": 1}, "filenames": ["index.rst"], "indexentries": {"add_child() (treeswift.node method)": [[0, "treeswift.Node.add_child", false]], "avg_branch_length() (treeswift.tree method)": [[0, "treeswift.Tree.avg_branch_length", false]], "branch_lengths() (treeswift.tree method)": [[0, "treeswift.Tree.branch_lengths", false]], "child_nodes() (treeswift.node method)": [[0, "treeswift.Node.child_nodes", false]], "closest_leaf_to_root() (treeswift.tree method)": [[0, "treeswift.Tree.closest_leaf_to_root", false]], "coalescence_times() (treeswift.tree method)": [[0, "treeswift.Tree.coalescence_times", false]], "coalescence_waiting_times() (treeswift.tree method)": [[0, "treeswift.Tree.coalescence_waiting_times", false]], "collapse_short_branches() (treeswift.tree method)": [[0, "treeswift.Tree.collapse_short_branches", false]], "colless() (treeswift.tree method)": [[0, "treeswift.Tree.colless", false]], "condense() (treeswift.tree method)": [[0, "treeswift.Tree.condense", false]], "contract() (treeswift.node method)": [[0, "treeswift.Node.contract", false]], "contract_low_support() (treeswift.tree method)": [[0, "treeswift.Tree.contract_low_support", false]], "deroot() (treeswift.tree method)": [[0, "treeswift.Tree.deroot", false]], "diameter() (treeswift.tree method)": [[0, "treeswift.Tree.diameter", false]], "distance_between() (treeswift.tree method)": [[0, "treeswift.Tree.distance_between", false]], "distance_matrix() (treeswift.tree method)": [[0, "treeswift.Tree.distance_matrix", false]], "distances_from_parent() (treeswift.tree method)": [[0, "treeswift.Tree.distances_from_parent", false]], "distances_from_root() (treeswift.tree method)": [[0, "treeswift.Tree.distances_from_root", false]], "draw() (treeswift.tree method)": [[0, "treeswift.Tree.draw", false]], "drop_edge_length_at_root() (treeswift.tree method)": [[0, "treeswift.Tree.drop_edge_length_at_root", false]], "edge_length_sum() (treeswift.tree method)": [[0, "treeswift.Tree.edge_length_sum", false]], "extract_subtree() (treeswift.tree method)": [[0, "treeswift.Tree.extract_subtree", false]], "extract_tree() (treeswift.tree method)": [[0, "treeswift.Tree.extract_tree", false]], "extract_tree_with() (treeswift.tree method)": [[0, "treeswift.Tree.extract_tree_with", false]], "extract_tree_without() (treeswift.tree method)": [[0, "treeswift.Tree.extract_tree_without", false]], "find_node() (treeswift.tree method)": [[0, "treeswift.Tree.find_node", false]], "furthest_from_root() (treeswift.tree method)": [[0, "treeswift.Tree.furthest_from_root", false]], "gamma_statistic() (treeswift.tree method)": [[0, "treeswift.Tree.gamma_statistic", false]], "get_edge_length() (treeswift.node method)": [[0, "treeswift.Node.get_edge_length", false]], "get_label() (treeswift.node method)": [[0, "treeswift.Node.get_label", false]], "get_parent() (treeswift.node method)": [[0, "treeswift.Node.get_parent", false]], "height() (treeswift.tree method)": [[0, "treeswift.Tree.height", false]], "indent() (treeswift.tree method)": [[0, "treeswift.Tree.indent", false]], "is_leaf() (treeswift.node method)": [[0, "treeswift.Node.is_leaf", false]], "is_root() (treeswift.node method)": [[0, "treeswift.Node.is_root", false]], "label_to_node() (treeswift.tree method)": [[0, "treeswift.Tree.label_to_node", false]], "labels() (treeswift.tree method)": [[0, "treeswift.Tree.labels", false]], "ladderize() (treeswift.tree method)": [[0, "treeswift.Tree.ladderize", false]], "lineages_through_time() (treeswift.tree method)": [[0, "treeswift.Tree.lineages_through_time", false]], "ltt() (treeswift.tree method)": [[0, "treeswift.Tree.ltt", false]], "module": [[0, "module-treeswift", false]], "mrca() (treeswift.tree method)": [[0, "treeswift.Tree.mrca", false]], "mrca_matrix() (treeswift.tree method)": [[0, "treeswift.Tree.mrca_matrix", false]], "newick() (treeswift.node method)": [[0, "treeswift.Node.newick", false]], "newick() (treeswift.tree method)": [[0, "treeswift.Tree.newick", false]], "node (class in treeswift)": [[0, "treeswift.Node", false]], "num_cherries() (treeswift.tree method)": [[0, "treeswift.Tree.num_cherries", false]], "num_children() (treeswift.node method)": [[0, "treeswift.Node.num_children", false]], "num_lineages_at() (treeswift.tree method)": [[0, "treeswift.Tree.num_lineages_at", false]], "num_nodes() (treeswift.node method)": [[0, "treeswift.Node.num_nodes", false]], "num_nodes() (treeswift.tree method)": [[0, "treeswift.Tree.num_nodes", false]], "order() (treeswift.tree method)": [[0, "treeswift.Tree.order", false]], "read_tree() (in module treeswift)": [[0, "treeswift.read_tree", false]], "read_tree_dendropy() (in module treeswift)": [[0, "treeswift.read_tree_dendropy", false]], "read_tree_newick() (in module treeswift)": [[0, "treeswift.read_tree_newick", false]], "read_tree_nexml() (in module treeswift)": [[0, "treeswift.read_tree_nexml", false]], "read_tree_nexus() (in module treeswift)": [[0, "treeswift.read_tree_nexus", false]], "remove_child() (treeswift.node method)": [[0, "treeswift.Node.remove_child", false]], "rename_nodes() (treeswift.tree method)": [[0, "treeswift.Tree.rename_nodes", false]], "reroot() (treeswift.tree method)": [[0, "treeswift.Tree.reroot", false]], "resolve_polytomies() (treeswift.node method)": [[0, "treeswift.Node.resolve_polytomies", false]], "resolve_polytomies() (treeswift.tree method)": [[0, "treeswift.Tree.resolve_polytomies", false]], "sackin() (treeswift.tree method)": [[0, "treeswift.Tree.sackin", false]], "scale_edges() (treeswift.tree method)": [[0, "treeswift.Tree.scale_edges", false]], "set_edge_length() (treeswift.node method)": [[0, "treeswift.Node.set_edge_length", false]], "set_label() (treeswift.node method)": [[0, "treeswift.Node.set_label", false]], "set_parent() (treeswift.node method)": [[0, "treeswift.Node.set_parent", false]], "suppress_unifurcations() (treeswift.tree method)": [[0, "treeswift.Tree.suppress_unifurcations", false]], "traverse_ancestors() (treeswift.node method)": [[0, "treeswift.Node.traverse_ancestors", false]], "traverse_bfs() (treeswift.node method)": [[0, "treeswift.Node.traverse_bfs", false]], "traverse_inorder() (treeswift.node method)": [[0, "treeswift.Node.traverse_inorder", false]], "traverse_inorder() (treeswift.tree method)": [[0, "treeswift.Tree.traverse_inorder", false]], "traverse_internal() (treeswift.node method)": [[0, "treeswift.Node.traverse_internal", false]], "traverse_internal() (treeswift.tree method)": [[0, "treeswift.Tree.traverse_internal", false]], "traverse_leaves() (treeswift.node method)": [[0, "treeswift.Node.traverse_leaves", false]], "traverse_leaves() (treeswift.tree method)": [[0, "treeswift.Tree.traverse_leaves", false]], "traverse_levelorder() (treeswift.node method)": [[0, "treeswift.Node.traverse_levelorder", false]], "traverse_levelorder() (treeswift.tree method)": [[0, "treeswift.Tree.traverse_levelorder", false]], "traverse_postorder() (treeswift.node method)": [[0, "treeswift.Node.traverse_postorder", false]], "traverse_postorder() (treeswift.tree method)": [[0, "treeswift.Tree.traverse_postorder", false]], "traverse_preorder() (treeswift.node method)": [[0, "treeswift.Node.traverse_preorder", false]], "traverse_preorder() (treeswift.tree method)": [[0, "treeswift.Tree.traverse_preorder", false]], "traverse_rootdistorder() (treeswift.node method)": [[0, "treeswift.Node.traverse_rootdistorder", false]], "traverse_rootdistorder() (treeswift.tree method)": [[0, "treeswift.Tree.traverse_rootdistorder", false]], "tree (class in treeswift)": [[0, "treeswift.Tree", false]], "treeness() (treeswift.tree method)": [[0, "treeswift.Tree.treeness", false]], "treeswift": [[0, "module-treeswift", false]], "write_tree_newick() (treeswift.tree method)": [[0, "treeswift.Tree.write_tree_newick", false]], "write_tree_nexus() (treeswift.tree method)": [[0, "treeswift.Tree.write_tree_nexus", false]]}, "objects": {"": [[0, 0, 0, "-", "treeswift"]], "treeswift": [[0, 1, 1, "", "Node"], [0, 1, 1, "", "Tree"], [0, 3, 1, "", "read_tree"], [0, 3, 1, "", "read_tree_dendropy"], [0, 3, 1, "", "read_tree_newick"], [0, 3, 1, "", "read_tree_nexml"], [0, 3, 1, "", "read_tree_nexus"]], "treeswift.Node": [[0, 2, 1, "", "add_child"], [0, 2, 1, "", "child_nodes"], [0, 2, 1, "", "contract"], [0, 2, 1, "", "get_edge_length"], [0, 2, 1, "", "get_label"], [0, 2, 1, "", "get_parent"], [0, 2, 1, "", "is_leaf"], [0, 2, 1, "", "is_root"], [0, 2, 1, "", "newick"], [0, 2, 1, "", "num_children"], [0, 2, 1, "", "num_nodes"], [0, 2, 1, "", "remove_child"], [0, 2, 1, "", "resolve_polytomies"], [0, 2, 1, "", "set_edge_length"], [0, 2, 1, "", "set_label"], [0, 2, 1, "", "set_parent"], [0, 2, 1, "", "traverse_ancestors"], [0, 2, 1, "", "traverse_bfs"], [0, 2, 1, "", "traverse_inorder"], [0, 2, 1, "", "traverse_internal"], [0, 2, 1, "", "traverse_leaves"], [0, 2, 1, "", "traverse_levelorder"], [0, 2, 1, "", "traverse_postorder"], [0, 2, 1, "", "traverse_preorder"], [0, 2, 1, "", "traverse_rootdistorder"]], "treeswift.Tree": [[0, 2, 1, "", "avg_branch_length"], [0, 2, 1, "", "branch_lengths"], [0, 2, 1, "", "closest_leaf_to_root"], [0, 2, 1, "", "coalescence_times"], [0, 2, 1, "", "coalescence_waiting_times"], [0, 2, 1, "", "collapse_short_branches"], [0, 2, 1, "", "colless"], [0, 2, 1, "", "condense"], [0, 2, 1, "", "contract_low_support"], [0, 2, 1, "", "deroot"], [0, 2, 1, "", "diameter"], [0, 2, 1, "", "distance_between"], [0, 2, 1, "", "distance_matrix"], [0, 2, 1, "", "distances_from_parent"], [0, 2, 1, "", "distances_from_root"], [0, 2, 1, "", "draw"], [0, 2, 1, "", "drop_edge_length_at_root"], [0, 2, 1, "", "edge_length_sum"], [0, 2, 1, "", "extract_subtree"], [0, 2, 1, "", "extract_tree"], [0, 2, 1, "", "extract_tree_with"], [0, 2, 1, "", "extract_tree_without"], [0, 2, 1, "", "find_node"], [0, 2, 1, "", "furthest_from_root"], [0, 2, 1, "", "gamma_statistic"], [0, 2, 1, "", "height"], [0, 2, 1, "", "indent"], [0, 2, 1, "", "label_to_node"], [0, 2, 1, "", "labels"], [0, 2, 1, "", "ladderize"], [0, 2, 1, "", "lineages_through_time"], [0, 2, 1, "", "ltt"], [0, 2, 1, "", "mrca"], [0, 2, 1, "", "mrca_matrix"], [0, 2, 1, "", "newick"], [0, 2, 1, "", "num_cherries"], [0, 2, 1, "", "num_lineages_at"], [0, 2, 1, "", "num_nodes"], [0, 2, 1, "", "order"], [0, 2, 1, "", "rename_nodes"], [0, 2, 1, "", "reroot"], [0, 2, 1, "", "resolve_polytomies"], [0, 2, 1, "", "sackin"], [0, 2, 1, "", "scale_edges"], [0, 2, 1, "", "suppress_unifurcations"], [0, 2, 1, "", "traverse_inorder"], [0, 2, 1, "", "traverse_internal"], [0, 2, 1, "", "traverse_leaves"], [0, 2, 1, "", "traverse_levelorder"], [0, 2, 1, "", "traverse_postorder"], [0, 2, 1, "", "traverse_preorder"], [0, 2, 1, "", "traverse_rootdistorder"], [0, 2, 1, "", "treeness"], [0, 2, 1, "", "write_tree_newick"], [0, 2, 1, "", "write_tree_nexus"]]}, "objnames": {"0": ["py", "module", "Python module"], "1": ["py", "class", "Python class"], "2": ["py", "method", "Python method"], "3": ["py", "function", "Python function"]}, "objtypes": {"0": "py:module", "1": "py:class", "2": "py:method", "3": "py:function"}, "terms": {"": 0, "0": 0, "000000": 0, "1": 0, "1in": 0, "2000": 0, "2d": 0, "4": 0, "72pt": 0, "8": 0, "8pt": 0, "9in": 0, "A": 0, "If": 0, "The": 0, "To": 0, "ad": 0, "add": 0, "add_child": 0, "align": 0, "align_label": 0, "all": 0, "an": 0, "ancestor": 0, "ani": 0, "ar": 0, "arbitrarili": 0, "arg": 0, "arrang": 0, "ascend": 0, "associ": 0, "attach": 0, "attribut": 0, "averag": 0, "avg_branch_length": 0, "awai": 0, "axi": 0, "backward": 0, "balanc": 0, "base": 0, "becaus": 0, "below": 0, "between": 0, "bf": 0, "bifurc": 0, "bool": 0, "branch": 0, "branch_length": 0, "branch_support": 0, "breadth": 0, "call": 0, "carefulli": 0, "cherri": 0, "child": 0, "child_nod": 0, "children": 0, "class": 0, "closest": 0, "closest_leaf_to_root": 0, "coalesc": 0, "coalescence_tim": 0, "coalescence_waiting_tim": 0, "collaps": 0, "collapse_short_branch": 0, "colless": 0, "color": 0, "comput": 0, "condens": 0, "connect": 0, "consid": 0, "contain": 0, "contract": 0, "contract_low_support": 0, "convers": 0, "copi": 0, "correspond": 0, "count": 0, "creat": 0, "damag": 0, "datamodel": 0, "default": 0, "default_color": 0, "defin": 0, "dendropi": 0, "denot": 0, "deroot": 0, "descend": 0, "desir": 0, "diamet": 0, "dict": 0, "dictionari": 0, "directli": 0, "distanc": 0, "distance_between": 0, "distance_matrix": 0, "distances_from_par": 0, "distances_from_root": 0, "distinguish": 0, "doesn": 0, "draw": 0, "drop": 0, "drop_edge_length_at_root": 0, "e": 0, "each": 0, "edg": 0, "edge_length": 0, "edge_length_sum": 0, "edge_length_then_label": 0, "edge_length_then_label_then_num_descend": 0, "edge_length_then_num_descend": 0, "edge_length_then_num_descendants_then_label": 0, "either": 0, "emphasi": 0, "equal": 0, "event": 0, "exclud": 0, "exist": 0, "exlud": 0, "export": 0, "export_filenam": 0, "extract": 0, "extract_subtre": 0, "extract_tre": 0, "extract_tree_": 0, "extract_tree_with": 0, "extract_tree_without": 0, "fals": 0, "figur": 0, "file": 0, "filenam": 0, "find": 0, "find_nod": 0, "first": 0, "float": 0, "font": 0, "from": 0, "function": 0, "furthest": 0, "furthest_from_root": 0, "g": 0, "gamma": 0, "gamma_statist": 0, "gener": 0, "get": 0, "get_edge_length": 0, "get_label": 0, "get_par": 0, "given": 0, "go": 0, "gzip": 0, "ha": 0, "had": 0, "handl": 0, "harvei": 0, "have": 0, "height": 0, "helper": 0, "hide": 0, "hide_rooted_prefix": 0, "horizont": 0, "how": 0, "i": 0, "id": 0, "incid": 0, "includ": 0, "include_self": 0, "indent": 0, "index": 0, "info": 0, "inform": 0, "inord": 0, "input": 0, "instal": 0, "int": 0, "intern": 0, "is_leaf": 0, "is_root": 0, "iter": 0, "its": 0, "itself": 0, "just": 0, "kei": 0, "label": 0, "label_fonts": 0, "label_then_edge_length": 0, "label_then_edge_length_then_num_descend": 0, "label_then_num_descend": 0, "label_then_num_descendants_then_edge_length": 0, "label_to_nod": 0, "ladder": 0, "larger": 0, "last": 0, "leaf": 0, "leaf_label": 0, "leav": 0, "legend": 0, "length": 0, "less": 0, "levelord": 0, "librari": 0, "like": 0, "line": 0, "lineag": 0, "lineages_through_tim": 0, "linear": 0, "linkag": 0, "list": 0, "ltt": 0, "m": 0, "mai": 0, "manipul": 0, "map": 0, "matplotlib": 0, "matrix": 0, "maximum": 0, "merg": 0, "minimum": 0, "mode": 0, "model": 0, "mrca": 0, "mrca_matrix": 0, "multipl": 0, "multipli": 0, "n": 0, "name": 0, "new": 0, "newick": 0, "nexml": 0, "nexu": 0, "node": 0, "non": 0, "none": 0, "normal": 0, "note": 0, "num_cherri": 0, "num_children": 0, "num_descend": 0, "num_descendants_then_edge_length": 0, "num_descendants_then_edge_length_then_label": 0, "num_descendants_then_label": 0, "num_descendants_then_label_then_edge_length": 0, "num_lineages_at": 0, "num_nod": 0, "number": 0, "nw_indent": 0, "object": 0, "obtain": 0, "old": 0, "oldroot": 0, "one": 0, "onli": 0, "order": 0, "origin": 0, "otherwis": 0, "output": 0, "over": 0, "pair": 0, "pairwis": 0, "parent": 0, "pars": 0, "patch": 0, "path": 0, "pda": 0, "per": 0, "perform": 0, "place": 0, "plain": 0, "plot": 0, "point": 0, "polytomi": 0, "postord": 0, "prefix": 0, "preorder": 0, "present_dai": 0, "proport": 0, "put": 0, "pybu": 0, "python": 0, "r": 0, "randomli": 0, "read": 0, "read_tre": 0, "read_tree_dendropi": 0, "read_tree_newick": 0, "read_tree_nexml": 0, "read_tree_nexu": 0, "remov": 0, "remove_child": 0, "renam": 0, "rename_nod": 0, "renaming_map": 0, "repres": 0, "reroot": 0, "resolv": 0, "resolve_polytomi": 0, "result": 0, "return": 0, "root": 0, "sackin": 0, "same": 0, "save": 0, "scale_edg": 0, "schema": 0, "seaborn": 0, "search": 0, "second": 0, "section": 0, "select": 0, "self": 0, "set": 0, "set_edge_length": 0, "set_label": 0, "set_par": 0, "should": 0, "show": 0, "show_label": 0, "show_plot": 0, "shown": 0, "sibl": 0, "singl": 0, "size": 0, "so": 0, "sort": 0, "sourc": 0, "space": 0, "specifi": 0, "speed": 0, "start": 0, "start_tim": 0, "state_0": 0, "statist": 0, "store": 0, "str": 0, "string": 0, "structur": 0, "subtre": 0, "success": 0, "sum": 0, "support": 0, "suppress": 0, "suppress_unifurc": 0, "t": 0, "tab": 0, "taxlabel": 0, "taxon": 0, "termin": 0, "text": 0, "than": 0, "thei": 0, "them": 0, "thi": 0, "threshold": 0, "through": 0, "time": 0, "tip": 0, "titl": 0, "top": 0, "total": 0, "translat": 0, "travers": 0, "traverse_ancestor": 0, "traverse_bf": 0, "traverse_inord": 0, "traverse_intern": 0, "traverse_leav": 0, "traverse_levelord": 0, "traverse_postord": 0, "traverse_preord": 0, "traverse_rootdistord": 0, "treat": 0, "tree": 0, "treemodel": 0, "treeness": 0, "trifurc": 0, "true": 0, "tupl": 0, "u": 0, "unifurc": 0, "unlabel": 0, "unweight": 0, "up": 0, "us": 0, "util": 0, "v": 0, "valu": 0, "vertic": 0, "wa": 0, "wait": 0, "weight": 0, "well": 0, "when": 0, "where": 0, "which": 0, "whose": 0, "without": 0, "write": 0, "write_tree_newick": 0, "write_tree_nexu": 0, "x": 0, "xlabel": 0, "xmax": 0, "xmin": 0, "yield": 0, "ylabel": 0, "ymax": 0, "ymin": 0, "you": 0, "yule": 0}, "titles": ["treeswift package"], "titleterms": {"content": 0, "modul": 0, "packag": 0, "treeswift": 0}}) -------------------------------------------------------------------------------- /docs/genindex.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | Index — TreeSwift documentation 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 31 | 32 |
33 |
34 |
35 |
36 | 37 | 38 |

Index

39 | 40 |
41 | A 42 | | B 43 | | C 44 | | D 45 | | E 46 | | F 47 | | G 48 | | H 49 | | I 50 | | L 51 | | M 52 | | N 53 | | O 54 | | R 55 | | S 56 | | T 57 | | W 58 | 59 |
60 |

A

61 | 62 | 66 | 70 |
71 | 72 |

B

73 | 74 | 78 |
79 | 80 |

C

81 | 82 | 92 | 104 |
105 | 106 |

D

107 | 108 | 118 | 128 |
129 | 130 |

E

131 | 132 | 138 | 146 |
147 | 148 |

F

149 | 150 | 154 | 158 |
159 | 160 |

G

161 | 162 | 168 | 174 |
175 | 176 |

H

177 | 178 | 182 |
183 | 184 |

I

185 | 186 | 190 | 196 |
197 | 198 |

L

199 | 200 | 206 | 214 |
215 | 216 |

M

217 | 218 | 227 | 233 |
    219 |
  • 220 | module 221 | 222 |
  • 226 |
234 | 235 |

N

236 | 237 | 249 | 261 |
262 | 263 |

O

264 | 265 | 269 |
270 | 271 |

R

272 | 273 | 285 | 299 |
300 | 301 |

S

302 | 303 | 311 | 319 |
320 | 321 |

T

322 | 323 | 353 | 384 |
385 | 386 |

W

387 | 388 | 392 | 396 |
397 | 398 | 399 | 400 |
401 |
402 |
403 |
404 | 418 |
419 |
420 | 433 | 437 | 438 | -------------------------------------------------------------------------------- /docs/_static/basic.css: -------------------------------------------------------------------------------- 1 | /* 2 | * Sphinx stylesheet -- basic theme. 3 | */ 4 | 5 | /* -- main layout ----------------------------------------------------------- */ 6 | 7 | div.clearer { 8 | clear: both; 9 | } 10 | 11 | div.section::after { 12 | display: block; 13 | content: ''; 14 | clear: left; 15 | } 16 | 17 | /* -- relbar ---------------------------------------------------------------- */ 18 | 19 | div.related { 20 | width: 100%; 21 | font-size: 90%; 22 | } 23 | 24 | div.related h3 { 25 | display: none; 26 | } 27 | 28 | div.related ul { 29 | margin: 0; 30 | padding: 0 0 0 10px; 31 | list-style: none; 32 | } 33 | 34 | div.related li { 35 | display: inline; 36 | } 37 | 38 | div.related li.right { 39 | float: right; 40 | margin-right: 5px; 41 | } 42 | 43 | /* -- sidebar --------------------------------------------------------------- */ 44 | 45 | div.sphinxsidebarwrapper { 46 | padding: 10px 5px 0 10px; 47 | } 48 | 49 | div.sphinxsidebar { 50 | float: left; 51 | width: 230px; 52 | margin-left: -100%; 53 | font-size: 90%; 54 | word-wrap: break-word; 55 | overflow-wrap : break-word; 56 | } 57 | 58 | div.sphinxsidebar ul { 59 | list-style: none; 60 | } 61 | 62 | div.sphinxsidebar ul ul, 63 | div.sphinxsidebar ul.want-points { 64 | margin-left: 20px; 65 | list-style: square; 66 | } 67 | 68 | div.sphinxsidebar ul ul { 69 | margin-top: 0; 70 | margin-bottom: 0; 71 | } 72 | 73 | div.sphinxsidebar form { 74 | margin-top: 10px; 75 | } 76 | 77 | div.sphinxsidebar input { 78 | border: 1px solid #98dbcc; 79 | font-family: sans-serif; 80 | font-size: 1em; 81 | } 82 | 83 | div.sphinxsidebar #searchbox form.search { 84 | overflow: hidden; 85 | } 86 | 87 | div.sphinxsidebar #searchbox input[type="text"] { 88 | float: left; 89 | width: 80%; 90 | padding: 0.25em; 91 | box-sizing: border-box; 92 | } 93 | 94 | div.sphinxsidebar #searchbox input[type="submit"] { 95 | float: left; 96 | width: 20%; 97 | border-left: none; 98 | padding: 0.25em; 99 | box-sizing: border-box; 100 | } 101 | 102 | 103 | img { 104 | border: 0; 105 | max-width: 100%; 106 | } 107 | 108 | /* -- search page ----------------------------------------------------------- */ 109 | 110 | ul.search { 111 | margin-top: 10px; 112 | } 113 | 114 | ul.search li { 115 | padding: 5px 0; 116 | } 117 | 118 | ul.search li a { 119 | font-weight: bold; 120 | } 121 | 122 | ul.search li p.context { 123 | color: #888; 124 | margin: 2px 0 0 30px; 125 | text-align: left; 126 | } 127 | 128 | ul.keywordmatches li.goodmatch a { 129 | font-weight: bold; 130 | } 131 | 132 | /* -- index page ------------------------------------------------------------ */ 133 | 134 | table.contentstable { 135 | width: 90%; 136 | margin-left: auto; 137 | margin-right: auto; 138 | } 139 | 140 | table.contentstable p.biglink { 141 | line-height: 150%; 142 | } 143 | 144 | a.biglink { 145 | font-size: 1.3em; 146 | } 147 | 148 | span.linkdescr { 149 | font-style: italic; 150 | padding-top: 5px; 151 | font-size: 90%; 152 | } 153 | 154 | /* -- general index --------------------------------------------------------- */ 155 | 156 | table.indextable { 157 | width: 100%; 158 | } 159 | 160 | table.indextable td { 161 | text-align: left; 162 | vertical-align: top; 163 | } 164 | 165 | table.indextable ul { 166 | margin-top: 0; 167 | margin-bottom: 0; 168 | list-style-type: none; 169 | } 170 | 171 | table.indextable > tbody > tr > td > ul { 172 | padding-left: 0em; 173 | } 174 | 175 | table.indextable tr.pcap { 176 | height: 10px; 177 | } 178 | 179 | table.indextable tr.cap { 180 | margin-top: 10px; 181 | background-color: #f2f2f2; 182 | } 183 | 184 | img.toggler { 185 | margin-right: 3px; 186 | margin-top: 3px; 187 | cursor: pointer; 188 | } 189 | 190 | div.modindex-jumpbox { 191 | border-top: 1px solid #ddd; 192 | border-bottom: 1px solid #ddd; 193 | margin: 1em 0 1em 0; 194 | padding: 0.4em; 195 | } 196 | 197 | div.genindex-jumpbox { 198 | border-top: 1px solid #ddd; 199 | border-bottom: 1px solid #ddd; 200 | margin: 1em 0 1em 0; 201 | padding: 0.4em; 202 | } 203 | 204 | /* -- domain module index --------------------------------------------------- */ 205 | 206 | table.modindextable td { 207 | padding: 2px; 208 | border-collapse: collapse; 209 | } 210 | 211 | /* -- general body styles --------------------------------------------------- */ 212 | 213 | div.body { 214 | min-width: 360px; 215 | max-width: 800px; 216 | } 217 | 218 | div.body p, div.body dd, div.body li, div.body blockquote { 219 | -moz-hyphens: auto; 220 | -ms-hyphens: auto; 221 | -webkit-hyphens: auto; 222 | hyphens: auto; 223 | } 224 | 225 | a.headerlink { 226 | visibility: hidden; 227 | } 228 | 229 | a:visited { 230 | color: #551A8B; 231 | } 232 | 233 | h1:hover > a.headerlink, 234 | h2:hover > a.headerlink, 235 | h3:hover > a.headerlink, 236 | h4:hover > a.headerlink, 237 | h5:hover > a.headerlink, 238 | h6:hover > a.headerlink, 239 | dt:hover > a.headerlink, 240 | caption:hover > a.headerlink, 241 | p.caption:hover > a.headerlink, 242 | div.code-block-caption:hover > a.headerlink { 243 | visibility: visible; 244 | } 245 | 246 | div.body p.caption { 247 | text-align: inherit; 248 | } 249 | 250 | div.body td { 251 | text-align: left; 252 | } 253 | 254 | .first { 255 | margin-top: 0 !important; 256 | } 257 | 258 | p.rubric { 259 | margin-top: 30px; 260 | font-weight: bold; 261 | } 262 | 263 | img.align-left, figure.align-left, .figure.align-left, object.align-left { 264 | clear: left; 265 | float: left; 266 | margin-right: 1em; 267 | } 268 | 269 | img.align-right, figure.align-right, .figure.align-right, object.align-right { 270 | clear: right; 271 | float: right; 272 | margin-left: 1em; 273 | } 274 | 275 | img.align-center, figure.align-center, .figure.align-center, object.align-center { 276 | display: block; 277 | margin-left: auto; 278 | margin-right: auto; 279 | } 280 | 281 | img.align-default, figure.align-default, .figure.align-default { 282 | display: block; 283 | margin-left: auto; 284 | margin-right: auto; 285 | } 286 | 287 | .align-left { 288 | text-align: left; 289 | } 290 | 291 | .align-center { 292 | text-align: center; 293 | } 294 | 295 | .align-default { 296 | text-align: center; 297 | } 298 | 299 | .align-right { 300 | text-align: right; 301 | } 302 | 303 | /* -- sidebars -------------------------------------------------------------- */ 304 | 305 | div.sidebar, 306 | aside.sidebar { 307 | margin: 0 0 0.5em 1em; 308 | border: 1px solid #ddb; 309 | padding: 7px; 310 | background-color: #ffe; 311 | width: 40%; 312 | float: right; 313 | clear: right; 314 | overflow-x: auto; 315 | } 316 | 317 | p.sidebar-title { 318 | font-weight: bold; 319 | } 320 | 321 | nav.contents, 322 | aside.topic, 323 | div.admonition, div.topic, blockquote { 324 | clear: left; 325 | } 326 | 327 | /* -- topics ---------------------------------------------------------------- */ 328 | 329 | nav.contents, 330 | aside.topic, 331 | div.topic { 332 | border: 1px solid #ccc; 333 | padding: 7px; 334 | margin: 10px 0 10px 0; 335 | } 336 | 337 | p.topic-title { 338 | font-size: 1.1em; 339 | font-weight: bold; 340 | margin-top: 10px; 341 | } 342 | 343 | /* -- admonitions ----------------------------------------------------------- */ 344 | 345 | div.admonition { 346 | margin-top: 10px; 347 | margin-bottom: 10px; 348 | padding: 7px; 349 | } 350 | 351 | div.admonition dt { 352 | font-weight: bold; 353 | } 354 | 355 | p.admonition-title { 356 | margin: 0px 10px 5px 0px; 357 | font-weight: bold; 358 | } 359 | 360 | div.body p.centered { 361 | text-align: center; 362 | margin-top: 25px; 363 | } 364 | 365 | /* -- content of sidebars/topics/admonitions -------------------------------- */ 366 | 367 | div.sidebar > :last-child, 368 | aside.sidebar > :last-child, 369 | nav.contents > :last-child, 370 | aside.topic > :last-child, 371 | div.topic > :last-child, 372 | div.admonition > :last-child { 373 | margin-bottom: 0; 374 | } 375 | 376 | div.sidebar::after, 377 | aside.sidebar::after, 378 | nav.contents::after, 379 | aside.topic::after, 380 | div.topic::after, 381 | div.admonition::after, 382 | blockquote::after { 383 | display: block; 384 | content: ''; 385 | clear: both; 386 | } 387 | 388 | /* -- tables ---------------------------------------------------------------- */ 389 | 390 | table.docutils { 391 | margin-top: 10px; 392 | margin-bottom: 10px; 393 | border: 0; 394 | border-collapse: collapse; 395 | } 396 | 397 | table.align-center { 398 | margin-left: auto; 399 | margin-right: auto; 400 | } 401 | 402 | table.align-default { 403 | margin-left: auto; 404 | margin-right: auto; 405 | } 406 | 407 | table caption span.caption-number { 408 | font-style: italic; 409 | } 410 | 411 | table caption span.caption-text { 412 | } 413 | 414 | table.docutils td, table.docutils th { 415 | padding: 1px 8px 1px 5px; 416 | border-top: 0; 417 | border-left: 0; 418 | border-right: 0; 419 | border-bottom: 1px solid #aaa; 420 | } 421 | 422 | th { 423 | text-align: left; 424 | padding-right: 5px; 425 | } 426 | 427 | table.citation { 428 | border-left: solid 1px gray; 429 | margin-left: 1px; 430 | } 431 | 432 | table.citation td { 433 | border-bottom: none; 434 | } 435 | 436 | th > :first-child, 437 | td > :first-child { 438 | margin-top: 0px; 439 | } 440 | 441 | th > :last-child, 442 | td > :last-child { 443 | margin-bottom: 0px; 444 | } 445 | 446 | /* -- figures --------------------------------------------------------------- */ 447 | 448 | div.figure, figure { 449 | margin: 0.5em; 450 | padding: 0.5em; 451 | } 452 | 453 | div.figure p.caption, figcaption { 454 | padding: 0.3em; 455 | } 456 | 457 | div.figure p.caption span.caption-number, 458 | figcaption span.caption-number { 459 | font-style: italic; 460 | } 461 | 462 | div.figure p.caption span.caption-text, 463 | figcaption span.caption-text { 464 | } 465 | 466 | /* -- field list styles ----------------------------------------------------- */ 467 | 468 | table.field-list td, table.field-list th { 469 | border: 0 !important; 470 | } 471 | 472 | .field-list ul { 473 | margin: 0; 474 | padding-left: 1em; 475 | } 476 | 477 | .field-list p { 478 | margin: 0; 479 | } 480 | 481 | .field-name { 482 | -moz-hyphens: manual; 483 | -ms-hyphens: manual; 484 | -webkit-hyphens: manual; 485 | hyphens: manual; 486 | } 487 | 488 | /* -- hlist styles ---------------------------------------------------------- */ 489 | 490 | table.hlist { 491 | margin: 1em 0; 492 | } 493 | 494 | table.hlist td { 495 | vertical-align: top; 496 | } 497 | 498 | /* -- object description styles --------------------------------------------- */ 499 | 500 | .sig { 501 | font-family: 'Consolas', 'Menlo', 'DejaVu Sans Mono', 'Bitstream Vera Sans Mono', monospace; 502 | } 503 | 504 | .sig-name, code.descname { 505 | background-color: transparent; 506 | font-weight: bold; 507 | } 508 | 509 | .sig-name { 510 | font-size: 1.1em; 511 | } 512 | 513 | code.descname { 514 | font-size: 1.2em; 515 | } 516 | 517 | .sig-prename, code.descclassname { 518 | background-color: transparent; 519 | } 520 | 521 | .optional { 522 | font-size: 1.3em; 523 | } 524 | 525 | .sig-paren { 526 | font-size: larger; 527 | } 528 | 529 | .sig-param.n { 530 | font-style: italic; 531 | } 532 | 533 | /* C++ specific styling */ 534 | 535 | .sig-inline.c-texpr, 536 | .sig-inline.cpp-texpr { 537 | font-family: unset; 538 | } 539 | 540 | .sig.c .k, .sig.c .kt, 541 | .sig.cpp .k, .sig.cpp .kt { 542 | color: #0033B3; 543 | } 544 | 545 | .sig.c .m, 546 | .sig.cpp .m { 547 | color: #1750EB; 548 | } 549 | 550 | .sig.c .s, .sig.c .sc, 551 | .sig.cpp .s, .sig.cpp .sc { 552 | color: #067D17; 553 | } 554 | 555 | 556 | /* -- other body styles ----------------------------------------------------- */ 557 | 558 | ol.arabic { 559 | list-style: decimal; 560 | } 561 | 562 | ol.loweralpha { 563 | list-style: lower-alpha; 564 | } 565 | 566 | ol.upperalpha { 567 | list-style: upper-alpha; 568 | } 569 | 570 | ol.lowerroman { 571 | list-style: lower-roman; 572 | } 573 | 574 | ol.upperroman { 575 | list-style: upper-roman; 576 | } 577 | 578 | :not(li) > ol > li:first-child > :first-child, 579 | :not(li) > ul > li:first-child > :first-child { 580 | margin-top: 0px; 581 | } 582 | 583 | :not(li) > ol > li:last-child > :last-child, 584 | :not(li) > ul > li:last-child > :last-child { 585 | margin-bottom: 0px; 586 | } 587 | 588 | ol.simple ol p, 589 | ol.simple ul p, 590 | ul.simple ol p, 591 | ul.simple ul p { 592 | margin-top: 0; 593 | } 594 | 595 | ol.simple > li:not(:first-child) > p, 596 | ul.simple > li:not(:first-child) > p { 597 | margin-top: 0; 598 | } 599 | 600 | ol.simple p, 601 | ul.simple p { 602 | margin-bottom: 0; 603 | } 604 | 605 | aside.footnote > span, 606 | div.citation > span { 607 | float: left; 608 | } 609 | aside.footnote > span:last-of-type, 610 | div.citation > span:last-of-type { 611 | padding-right: 0.5em; 612 | } 613 | aside.footnote > p { 614 | margin-left: 2em; 615 | } 616 | div.citation > p { 617 | margin-left: 4em; 618 | } 619 | aside.footnote > p:last-of-type, 620 | div.citation > p:last-of-type { 621 | margin-bottom: 0em; 622 | } 623 | aside.footnote > p:last-of-type:after, 624 | div.citation > p:last-of-type:after { 625 | content: ""; 626 | clear: both; 627 | } 628 | 629 | dl.field-list { 630 | display: grid; 631 | grid-template-columns: fit-content(30%) auto; 632 | } 633 | 634 | dl.field-list > dt { 635 | font-weight: bold; 636 | word-break: break-word; 637 | padding-left: 0.5em; 638 | padding-right: 5px; 639 | } 640 | 641 | dl.field-list > dd { 642 | padding-left: 0.5em; 643 | margin-top: 0em; 644 | margin-left: 0em; 645 | margin-bottom: 0em; 646 | } 647 | 648 | dl { 649 | margin-bottom: 15px; 650 | } 651 | 652 | dd > :first-child { 653 | margin-top: 0px; 654 | } 655 | 656 | dd ul, dd table { 657 | margin-bottom: 10px; 658 | } 659 | 660 | dd { 661 | margin-top: 3px; 662 | margin-bottom: 10px; 663 | margin-left: 30px; 664 | } 665 | 666 | .sig dd { 667 | margin-top: 0px; 668 | margin-bottom: 0px; 669 | } 670 | 671 | .sig dl { 672 | margin-top: 0px; 673 | margin-bottom: 0px; 674 | } 675 | 676 | dl > dd:last-child, 677 | dl > dd:last-child > :last-child { 678 | margin-bottom: 0; 679 | } 680 | 681 | dt:target, span.highlighted { 682 | background-color: #fbe54e; 683 | } 684 | 685 | rect.highlighted { 686 | fill: #fbe54e; 687 | } 688 | 689 | dl.glossary dt { 690 | font-weight: bold; 691 | font-size: 1.1em; 692 | } 693 | 694 | .versionmodified { 695 | font-style: italic; 696 | } 697 | 698 | .system-message { 699 | background-color: #fda; 700 | padding: 5px; 701 | border: 3px solid red; 702 | } 703 | 704 | .footnote:target { 705 | background-color: #ffa; 706 | } 707 | 708 | .line-block { 709 | display: block; 710 | margin-top: 1em; 711 | margin-bottom: 1em; 712 | } 713 | 714 | .line-block .line-block { 715 | margin-top: 0; 716 | margin-bottom: 0; 717 | margin-left: 1.5em; 718 | } 719 | 720 | .guilabel, .menuselection { 721 | font-family: sans-serif; 722 | } 723 | 724 | .accelerator { 725 | text-decoration: underline; 726 | } 727 | 728 | .classifier { 729 | font-style: oblique; 730 | } 731 | 732 | .classifier:before { 733 | font-style: normal; 734 | margin: 0 0.5em; 735 | content: ":"; 736 | display: inline-block; 737 | } 738 | 739 | abbr, acronym { 740 | border-bottom: dotted 1px; 741 | cursor: help; 742 | } 743 | 744 | .translated { 745 | background-color: rgba(207, 255, 207, 0.2) 746 | } 747 | 748 | .untranslated { 749 | background-color: rgba(255, 207, 207, 0.2) 750 | } 751 | 752 | /* -- code displays --------------------------------------------------------- */ 753 | 754 | pre { 755 | overflow: auto; 756 | overflow-y: hidden; /* fixes display issues on Chrome browsers */ 757 | } 758 | 759 | pre, div[class*="highlight-"] { 760 | clear: both; 761 | } 762 | 763 | span.pre { 764 | -moz-hyphens: none; 765 | -ms-hyphens: none; 766 | -webkit-hyphens: none; 767 | hyphens: none; 768 | white-space: nowrap; 769 | } 770 | 771 | div[class*="highlight-"] { 772 | margin: 1em 0; 773 | } 774 | 775 | td.linenos pre { 776 | border: 0; 777 | background-color: transparent; 778 | color: #aaa; 779 | } 780 | 781 | table.highlighttable { 782 | display: block; 783 | } 784 | 785 | table.highlighttable tbody { 786 | display: block; 787 | } 788 | 789 | table.highlighttable tr { 790 | display: flex; 791 | } 792 | 793 | table.highlighttable td { 794 | margin: 0; 795 | padding: 0; 796 | } 797 | 798 | table.highlighttable td.linenos { 799 | padding-right: 0.5em; 800 | } 801 | 802 | table.highlighttable td.code { 803 | flex: 1; 804 | overflow: hidden; 805 | } 806 | 807 | .highlight .hll { 808 | display: block; 809 | } 810 | 811 | div.highlight pre, 812 | table.highlighttable pre { 813 | margin: 0; 814 | } 815 | 816 | div.code-block-caption + div { 817 | margin-top: 0; 818 | } 819 | 820 | div.code-block-caption { 821 | margin-top: 1em; 822 | padding: 2px 5px; 823 | font-size: small; 824 | } 825 | 826 | div.code-block-caption code { 827 | background-color: transparent; 828 | } 829 | 830 | table.highlighttable td.linenos, 831 | span.linenos, 832 | div.highlight span.gp { /* gp: Generic.Prompt */ 833 | user-select: none; 834 | -webkit-user-select: text; /* Safari fallback only */ 835 | -webkit-user-select: none; /* Chrome/Safari */ 836 | -moz-user-select: none; /* Firefox */ 837 | -ms-user-select: none; /* IE10+ */ 838 | } 839 | 840 | div.code-block-caption span.caption-number { 841 | padding: 0.1em 0.3em; 842 | font-style: italic; 843 | } 844 | 845 | div.code-block-caption span.caption-text { 846 | } 847 | 848 | div.literal-block-wrapper { 849 | margin: 1em 0; 850 | } 851 | 852 | code.xref, a code { 853 | background-color: transparent; 854 | font-weight: bold; 855 | } 856 | 857 | h1 code, h2 code, h3 code, h4 code, h5 code, h6 code { 858 | background-color: transparent; 859 | } 860 | 861 | .viewcode-link { 862 | float: right; 863 | } 864 | 865 | .viewcode-back { 866 | float: right; 867 | font-family: sans-serif; 868 | } 869 | 870 | div.viewcode-block:target { 871 | margin: -1px -10px; 872 | padding: 0 10px; 873 | } 874 | 875 | /* -- math display ---------------------------------------------------------- */ 876 | 877 | img.math { 878 | vertical-align: middle; 879 | } 880 | 881 | div.body div.math p { 882 | text-align: center; 883 | } 884 | 885 | span.eqno { 886 | float: right; 887 | } 888 | 889 | span.eqno a.headerlink { 890 | position: absolute; 891 | z-index: 1; 892 | } 893 | 894 | div.math:hover a.headerlink { 895 | visibility: visible; 896 | } 897 | 898 | /* -- printout stylesheet --------------------------------------------------- */ 899 | 900 | @media print { 901 | div.document, 902 | div.documentwrapper, 903 | div.bodywrapper { 904 | margin: 0 !important; 905 | width: 100%; 906 | } 907 | 908 | div.sphinxsidebar, 909 | div.related, 910 | div.footer, 911 | #top-link { 912 | display: none; 913 | } 914 | } -------------------------------------------------------------------------------- /docs/_static/searchtools.js: -------------------------------------------------------------------------------- 1 | /* 2 | * Sphinx JavaScript utilities for the full-text search. 3 | */ 4 | "use strict"; 5 | 6 | /** 7 | * Simple result scoring code. 8 | */ 9 | if (typeof Scorer === "undefined") { 10 | var Scorer = { 11 | // Implement the following function to further tweak the score for each result 12 | // The function takes a result array [docname, title, anchor, descr, score, filename] 13 | // and returns the new score. 14 | /* 15 | score: result => { 16 | const [docname, title, anchor, descr, score, filename, kind] = result 17 | return score 18 | }, 19 | */ 20 | 21 | // query matches the full name of an object 22 | objNameMatch: 11, 23 | // or matches in the last dotted part of the object name 24 | objPartialMatch: 6, 25 | // Additive scores depending on the priority of the object 26 | objPrio: { 27 | 0: 15, // used to be importantResults 28 | 1: 5, // used to be objectResults 29 | 2: -5, // used to be unimportantResults 30 | }, 31 | // Used when the priority is not in the mapping. 32 | objPrioDefault: 0, 33 | 34 | // query found in title 35 | title: 15, 36 | partialTitle: 7, 37 | // query found in terms 38 | term: 5, 39 | partialTerm: 2, 40 | }; 41 | } 42 | 43 | // Global search result kind enum, used by themes to style search results. 44 | class SearchResultKind { 45 | static get index() { return "index"; } 46 | static get object() { return "object"; } 47 | static get text() { return "text"; } 48 | static get title() { return "title"; } 49 | } 50 | 51 | const _removeChildren = (element) => { 52 | while (element && element.lastChild) element.removeChild(element.lastChild); 53 | }; 54 | 55 | /** 56 | * See https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Regular_Expressions#escaping 57 | */ 58 | const _escapeRegExp = (string) => 59 | string.replace(/[.*+\-?^${}()|[\]\\]/g, "\\$&"); // $& means the whole matched string 60 | 61 | const _displayItem = (item, searchTerms, highlightTerms) => { 62 | const docBuilder = DOCUMENTATION_OPTIONS.BUILDER; 63 | const docFileSuffix = DOCUMENTATION_OPTIONS.FILE_SUFFIX; 64 | const docLinkSuffix = DOCUMENTATION_OPTIONS.LINK_SUFFIX; 65 | const showSearchSummary = DOCUMENTATION_OPTIONS.SHOW_SEARCH_SUMMARY; 66 | const contentRoot = document.documentElement.dataset.content_root; 67 | 68 | const [docName, title, anchor, descr, score, _filename, kind] = item; 69 | 70 | let listItem = document.createElement("li"); 71 | // Add a class representing the item's type: 72 | // can be used by a theme's CSS selector for styling 73 | // See SearchResultKind for the class names. 74 | listItem.classList.add(`kind-${kind}`); 75 | let requestUrl; 76 | let linkUrl; 77 | if (docBuilder === "dirhtml") { 78 | // dirhtml builder 79 | let dirname = docName + "/"; 80 | if (dirname.match(/\/index\/$/)) 81 | dirname = dirname.substring(0, dirname.length - 6); 82 | else if (dirname === "index/") dirname = ""; 83 | requestUrl = contentRoot + dirname; 84 | linkUrl = requestUrl; 85 | } else { 86 | // normal html builders 87 | requestUrl = contentRoot + docName + docFileSuffix; 88 | linkUrl = docName + docLinkSuffix; 89 | } 90 | let linkEl = listItem.appendChild(document.createElement("a")); 91 | linkEl.href = linkUrl + anchor; 92 | linkEl.dataset.score = score; 93 | linkEl.innerHTML = title; 94 | if (descr) { 95 | listItem.appendChild(document.createElement("span")).innerHTML = 96 | " (" + descr + ")"; 97 | // highlight search terms in the description 98 | if (SPHINX_HIGHLIGHT_ENABLED) // set in sphinx_highlight.js 99 | highlightTerms.forEach((term) => _highlightText(listItem, term, "highlighted")); 100 | } 101 | else if (showSearchSummary) 102 | fetch(requestUrl) 103 | .then((responseData) => responseData.text()) 104 | .then((data) => { 105 | if (data) 106 | listItem.appendChild( 107 | Search.makeSearchSummary(data, searchTerms, anchor) 108 | ); 109 | // highlight search terms in the summary 110 | if (SPHINX_HIGHLIGHT_ENABLED) // set in sphinx_highlight.js 111 | highlightTerms.forEach((term) => _highlightText(listItem, term, "highlighted")); 112 | }); 113 | Search.output.appendChild(listItem); 114 | }; 115 | const _finishSearch = (resultCount) => { 116 | Search.stopPulse(); 117 | Search.title.innerText = _("Search Results"); 118 | if (!resultCount) 119 | Search.status.innerText = Documentation.gettext( 120 | "Your search did not match any documents. Please make sure that all words are spelled correctly and that you've selected enough categories." 121 | ); 122 | else 123 | Search.status.innerText = Documentation.ngettext( 124 | "Search finished, found one page matching the search query.", 125 | "Search finished, found ${resultCount} pages matching the search query.", 126 | resultCount, 127 | ).replace('${resultCount}', resultCount); 128 | }; 129 | const _displayNextItem = ( 130 | results, 131 | resultCount, 132 | searchTerms, 133 | highlightTerms, 134 | ) => { 135 | // results left, load the summary and display it 136 | // this is intended to be dynamic (don't sub resultsCount) 137 | if (results.length) { 138 | _displayItem(results.pop(), searchTerms, highlightTerms); 139 | setTimeout( 140 | () => _displayNextItem(results, resultCount, searchTerms, highlightTerms), 141 | 5 142 | ); 143 | } 144 | // search finished, update title and status message 145 | else _finishSearch(resultCount); 146 | }; 147 | // Helper function used by query() to order search results. 148 | // Each input is an array of [docname, title, anchor, descr, score, filename, kind]. 149 | // Order the results by score (in opposite order of appearance, since the 150 | // `_displayNextItem` function uses pop() to retrieve items) and then alphabetically. 151 | const _orderResultsByScoreThenName = (a, b) => { 152 | const leftScore = a[4]; 153 | const rightScore = b[4]; 154 | if (leftScore === rightScore) { 155 | // same score: sort alphabetically 156 | const leftTitle = a[1].toLowerCase(); 157 | const rightTitle = b[1].toLowerCase(); 158 | if (leftTitle === rightTitle) return 0; 159 | return leftTitle > rightTitle ? -1 : 1; // inverted is intentional 160 | } 161 | return leftScore > rightScore ? 1 : -1; 162 | }; 163 | 164 | /** 165 | * Default splitQuery function. Can be overridden in ``sphinx.search`` with a 166 | * custom function per language. 167 | * 168 | * The regular expression works by splitting the string on consecutive characters 169 | * that are not Unicode letters, numbers, underscores, or emoji characters. 170 | * This is the same as ``\W+`` in Python, preserving the surrogate pair area. 171 | */ 172 | if (typeof splitQuery === "undefined") { 173 | var splitQuery = (query) => query 174 | .split(/[^\p{Letter}\p{Number}_\p{Emoji_Presentation}]+/gu) 175 | .filter(term => term) // remove remaining empty strings 176 | } 177 | 178 | /** 179 | * Search Module 180 | */ 181 | const Search = { 182 | _index: null, 183 | _queued_query: null, 184 | _pulse_status: -1, 185 | 186 | htmlToText: (htmlString, anchor) => { 187 | const htmlElement = new DOMParser().parseFromString(htmlString, 'text/html'); 188 | for (const removalQuery of [".headerlink", "script", "style"]) { 189 | htmlElement.querySelectorAll(removalQuery).forEach((el) => { el.remove() }); 190 | } 191 | if (anchor) { 192 | const anchorContent = htmlElement.querySelector(`[role="main"] ${anchor}`); 193 | if (anchorContent) return anchorContent.textContent; 194 | 195 | console.warn( 196 | `Anchored content block not found. Sphinx search tries to obtain it via DOM query '[role=main] ${anchor}'. Check your theme or template.` 197 | ); 198 | } 199 | 200 | // if anchor not specified or not found, fall back to main content 201 | const docContent = htmlElement.querySelector('[role="main"]'); 202 | if (docContent) return docContent.textContent; 203 | 204 | console.warn( 205 | "Content block not found. Sphinx search tries to obtain it via DOM query '[role=main]'. Check your theme or template." 206 | ); 207 | return ""; 208 | }, 209 | 210 | init: () => { 211 | const query = new URLSearchParams(window.location.search).get("q"); 212 | document 213 | .querySelectorAll('input[name="q"]') 214 | .forEach((el) => (el.value = query)); 215 | if (query) Search.performSearch(query); 216 | }, 217 | 218 | loadIndex: (url) => 219 | (document.body.appendChild(document.createElement("script")).src = url), 220 | 221 | setIndex: (index) => { 222 | Search._index = index; 223 | if (Search._queued_query !== null) { 224 | const query = Search._queued_query; 225 | Search._queued_query = null; 226 | Search.query(query); 227 | } 228 | }, 229 | 230 | hasIndex: () => Search._index !== null, 231 | 232 | deferQuery: (query) => (Search._queued_query = query), 233 | 234 | stopPulse: () => (Search._pulse_status = -1), 235 | 236 | startPulse: () => { 237 | if (Search._pulse_status >= 0) return; 238 | 239 | const pulse = () => { 240 | Search._pulse_status = (Search._pulse_status + 1) % 4; 241 | Search.dots.innerText = ".".repeat(Search._pulse_status); 242 | if (Search._pulse_status >= 0) window.setTimeout(pulse, 500); 243 | }; 244 | pulse(); 245 | }, 246 | 247 | /** 248 | * perform a search for something (or wait until index is loaded) 249 | */ 250 | performSearch: (query) => { 251 | // create the required interface elements 252 | const searchText = document.createElement("h2"); 253 | searchText.textContent = _("Searching"); 254 | const searchSummary = document.createElement("p"); 255 | searchSummary.classList.add("search-summary"); 256 | searchSummary.innerText = ""; 257 | const searchList = document.createElement("ul"); 258 | searchList.setAttribute("role", "list"); 259 | searchList.classList.add("search"); 260 | 261 | const out = document.getElementById("search-results"); 262 | Search.title = out.appendChild(searchText); 263 | Search.dots = Search.title.appendChild(document.createElement("span")); 264 | Search.status = out.appendChild(searchSummary); 265 | Search.output = out.appendChild(searchList); 266 | 267 | const searchProgress = document.getElementById("search-progress"); 268 | // Some themes don't use the search progress node 269 | if (searchProgress) { 270 | searchProgress.innerText = _("Preparing search..."); 271 | } 272 | Search.startPulse(); 273 | 274 | // index already loaded, the browser was quick! 275 | if (Search.hasIndex()) Search.query(query); 276 | else Search.deferQuery(query); 277 | }, 278 | 279 | _parseQuery: (query) => { 280 | // stem the search terms and add them to the correct list 281 | const stemmer = new Stemmer(); 282 | const searchTerms = new Set(); 283 | const excludedTerms = new Set(); 284 | const highlightTerms = new Set(); 285 | const objectTerms = new Set(splitQuery(query.toLowerCase().trim())); 286 | splitQuery(query.trim()).forEach((queryTerm) => { 287 | const queryTermLower = queryTerm.toLowerCase(); 288 | 289 | // maybe skip this "word" 290 | // stopwords array is from language_data.js 291 | if ( 292 | stopwords.indexOf(queryTermLower) !== -1 || 293 | queryTerm.match(/^\d+$/) 294 | ) 295 | return; 296 | 297 | // stem the word 298 | let word = stemmer.stemWord(queryTermLower); 299 | // select the correct list 300 | if (word[0] === "-") excludedTerms.add(word.substr(1)); 301 | else { 302 | searchTerms.add(word); 303 | highlightTerms.add(queryTermLower); 304 | } 305 | }); 306 | 307 | if (SPHINX_HIGHLIGHT_ENABLED) { // set in sphinx_highlight.js 308 | localStorage.setItem("sphinx_highlight_terms", [...highlightTerms].join(" ")) 309 | } 310 | 311 | // console.debug("SEARCH: searching for:"); 312 | // console.info("required: ", [...searchTerms]); 313 | // console.info("excluded: ", [...excludedTerms]); 314 | 315 | return [query, searchTerms, excludedTerms, highlightTerms, objectTerms]; 316 | }, 317 | 318 | /** 319 | * execute search (requires search index to be loaded) 320 | */ 321 | _performSearch: (query, searchTerms, excludedTerms, highlightTerms, objectTerms) => { 322 | const filenames = Search._index.filenames; 323 | const docNames = Search._index.docnames; 324 | const titles = Search._index.titles; 325 | const allTitles = Search._index.alltitles; 326 | const indexEntries = Search._index.indexentries; 327 | 328 | // Collect multiple result groups to be sorted separately and then ordered. 329 | // Each is an array of [docname, title, anchor, descr, score, filename, kind]. 330 | const normalResults = []; 331 | const nonMainIndexResults = []; 332 | 333 | _removeChildren(document.getElementById("search-progress")); 334 | 335 | const queryLower = query.toLowerCase().trim(); 336 | for (const [title, foundTitles] of Object.entries(allTitles)) { 337 | if (title.toLowerCase().trim().includes(queryLower) && (queryLower.length >= title.length/2)) { 338 | for (const [file, id] of foundTitles) { 339 | const score = Math.round(Scorer.title * queryLower.length / title.length); 340 | const boost = titles[file] === title ? 1 : 0; // add a boost for document titles 341 | normalResults.push([ 342 | docNames[file], 343 | titles[file] !== title ? `${titles[file]} > ${title}` : title, 344 | id !== null ? "#" + id : "", 345 | null, 346 | score + boost, 347 | filenames[file], 348 | SearchResultKind.title, 349 | ]); 350 | } 351 | } 352 | } 353 | 354 | // search for explicit entries in index directives 355 | for (const [entry, foundEntries] of Object.entries(indexEntries)) { 356 | if (entry.includes(queryLower) && (queryLower.length >= entry.length/2)) { 357 | for (const [file, id, isMain] of foundEntries) { 358 | const score = Math.round(100 * queryLower.length / entry.length); 359 | const result = [ 360 | docNames[file], 361 | titles[file], 362 | id ? "#" + id : "", 363 | null, 364 | score, 365 | filenames[file], 366 | SearchResultKind.index, 367 | ]; 368 | if (isMain) { 369 | normalResults.push(result); 370 | } else { 371 | nonMainIndexResults.push(result); 372 | } 373 | } 374 | } 375 | } 376 | 377 | // lookup as object 378 | objectTerms.forEach((term) => 379 | normalResults.push(...Search.performObjectSearch(term, objectTerms)) 380 | ); 381 | 382 | // lookup as search terms in fulltext 383 | normalResults.push(...Search.performTermsSearch(searchTerms, excludedTerms)); 384 | 385 | // let the scorer override scores with a custom scoring function 386 | if (Scorer.score) { 387 | normalResults.forEach((item) => (item[4] = Scorer.score(item))); 388 | nonMainIndexResults.forEach((item) => (item[4] = Scorer.score(item))); 389 | } 390 | 391 | // Sort each group of results by score and then alphabetically by name. 392 | normalResults.sort(_orderResultsByScoreThenName); 393 | nonMainIndexResults.sort(_orderResultsByScoreThenName); 394 | 395 | // Combine the result groups in (reverse) order. 396 | // Non-main index entries are typically arbitrary cross-references, 397 | // so display them after other results. 398 | let results = [...nonMainIndexResults, ...normalResults]; 399 | 400 | // remove duplicate search results 401 | // note the reversing of results, so that in the case of duplicates, the highest-scoring entry is kept 402 | let seen = new Set(); 403 | results = results.reverse().reduce((acc, result) => { 404 | let resultStr = result.slice(0, 4).concat([result[5]]).map(v => String(v)).join(','); 405 | if (!seen.has(resultStr)) { 406 | acc.push(result); 407 | seen.add(resultStr); 408 | } 409 | return acc; 410 | }, []); 411 | 412 | return results.reverse(); 413 | }, 414 | 415 | query: (query) => { 416 | const [searchQuery, searchTerms, excludedTerms, highlightTerms, objectTerms] = Search._parseQuery(query); 417 | const results = Search._performSearch(searchQuery, searchTerms, excludedTerms, highlightTerms, objectTerms); 418 | 419 | // for debugging 420 | //Search.lastresults = results.slice(); // a copy 421 | // console.info("search results:", Search.lastresults); 422 | 423 | // print the results 424 | _displayNextItem(results, results.length, searchTerms, highlightTerms); 425 | }, 426 | 427 | /** 428 | * search for object names 429 | */ 430 | performObjectSearch: (object, objectTerms) => { 431 | const filenames = Search._index.filenames; 432 | const docNames = Search._index.docnames; 433 | const objects = Search._index.objects; 434 | const objNames = Search._index.objnames; 435 | const titles = Search._index.titles; 436 | 437 | const results = []; 438 | 439 | const objectSearchCallback = (prefix, match) => { 440 | const name = match[4] 441 | const fullname = (prefix ? prefix + "." : "") + name; 442 | const fullnameLower = fullname.toLowerCase(); 443 | if (fullnameLower.indexOf(object) < 0) return; 444 | 445 | let score = 0; 446 | const parts = fullnameLower.split("."); 447 | 448 | // check for different match types: exact matches of full name or 449 | // "last name" (i.e. last dotted part) 450 | if (fullnameLower === object || parts.slice(-1)[0] === object) 451 | score += Scorer.objNameMatch; 452 | else if (parts.slice(-1)[0].indexOf(object) > -1) 453 | score += Scorer.objPartialMatch; // matches in last name 454 | 455 | const objName = objNames[match[1]][2]; 456 | const title = titles[match[0]]; 457 | 458 | // If more than one term searched for, we require other words to be 459 | // found in the name/title/description 460 | const otherTerms = new Set(objectTerms); 461 | otherTerms.delete(object); 462 | if (otherTerms.size > 0) { 463 | const haystack = `${prefix} ${name} ${objName} ${title}`.toLowerCase(); 464 | if ( 465 | [...otherTerms].some((otherTerm) => haystack.indexOf(otherTerm) < 0) 466 | ) 467 | return; 468 | } 469 | 470 | let anchor = match[3]; 471 | if (anchor === "") anchor = fullname; 472 | else if (anchor === "-") anchor = objNames[match[1]][1] + "-" + fullname; 473 | 474 | const descr = objName + _(", in ") + title; 475 | 476 | // add custom score for some objects according to scorer 477 | if (Scorer.objPrio.hasOwnProperty(match[2])) 478 | score += Scorer.objPrio[match[2]]; 479 | else score += Scorer.objPrioDefault; 480 | 481 | results.push([ 482 | docNames[match[0]], 483 | fullname, 484 | "#" + anchor, 485 | descr, 486 | score, 487 | filenames[match[0]], 488 | SearchResultKind.object, 489 | ]); 490 | }; 491 | Object.keys(objects).forEach((prefix) => 492 | objects[prefix].forEach((array) => 493 | objectSearchCallback(prefix, array) 494 | ) 495 | ); 496 | return results; 497 | }, 498 | 499 | /** 500 | * search for full-text terms in the index 501 | */ 502 | performTermsSearch: (searchTerms, excludedTerms) => { 503 | // prepare search 504 | const terms = Search._index.terms; 505 | const titleTerms = Search._index.titleterms; 506 | const filenames = Search._index.filenames; 507 | const docNames = Search._index.docnames; 508 | const titles = Search._index.titles; 509 | 510 | const scoreMap = new Map(); 511 | const fileMap = new Map(); 512 | 513 | // perform the search on the required terms 514 | searchTerms.forEach((word) => { 515 | const files = []; 516 | const arr = [ 517 | { files: terms[word], score: Scorer.term }, 518 | { files: titleTerms[word], score: Scorer.title }, 519 | ]; 520 | // add support for partial matches 521 | if (word.length > 2) { 522 | const escapedWord = _escapeRegExp(word); 523 | if (!terms.hasOwnProperty(word)) { 524 | Object.keys(terms).forEach((term) => { 525 | if (term.match(escapedWord)) 526 | arr.push({ files: terms[term], score: Scorer.partialTerm }); 527 | }); 528 | } 529 | if (!titleTerms.hasOwnProperty(word)) { 530 | Object.keys(titleTerms).forEach((term) => { 531 | if (term.match(escapedWord)) 532 | arr.push({ files: titleTerms[term], score: Scorer.partialTitle }); 533 | }); 534 | } 535 | } 536 | 537 | // no match but word was a required one 538 | if (arr.every((record) => record.files === undefined)) return; 539 | 540 | // found search word in contents 541 | arr.forEach((record) => { 542 | if (record.files === undefined) return; 543 | 544 | let recordFiles = record.files; 545 | if (recordFiles.length === undefined) recordFiles = [recordFiles]; 546 | files.push(...recordFiles); 547 | 548 | // set score for the word in each file 549 | recordFiles.forEach((file) => { 550 | if (!scoreMap.has(file)) scoreMap.set(file, {}); 551 | scoreMap.get(file)[word] = record.score; 552 | }); 553 | }); 554 | 555 | // create the mapping 556 | files.forEach((file) => { 557 | if (!fileMap.has(file)) fileMap.set(file, [word]); 558 | else if (fileMap.get(file).indexOf(word) === -1) fileMap.get(file).push(word); 559 | }); 560 | }); 561 | 562 | // now check if the files don't contain excluded terms 563 | const results = []; 564 | for (const [file, wordList] of fileMap) { 565 | // check if all requirements are matched 566 | 567 | // as search terms with length < 3 are discarded 568 | const filteredTermCount = [...searchTerms].filter( 569 | (term) => term.length > 2 570 | ).length; 571 | if ( 572 | wordList.length !== searchTerms.size && 573 | wordList.length !== filteredTermCount 574 | ) 575 | continue; 576 | 577 | // ensure that none of the excluded terms is in the search result 578 | if ( 579 | [...excludedTerms].some( 580 | (term) => 581 | terms[term] === file || 582 | titleTerms[term] === file || 583 | (terms[term] || []).includes(file) || 584 | (titleTerms[term] || []).includes(file) 585 | ) 586 | ) 587 | break; 588 | 589 | // select one (max) score for the file. 590 | const score = Math.max(...wordList.map((w) => scoreMap.get(file)[w])); 591 | // add result to the result list 592 | results.push([ 593 | docNames[file], 594 | titles[file], 595 | "", 596 | null, 597 | score, 598 | filenames[file], 599 | SearchResultKind.text, 600 | ]); 601 | } 602 | return results; 603 | }, 604 | 605 | /** 606 | * helper function to return a node containing the 607 | * search summary for a given text. keywords is a list 608 | * of stemmed words. 609 | */ 610 | makeSearchSummary: (htmlText, keywords, anchor) => { 611 | const text = Search.htmlToText(htmlText, anchor); 612 | if (text === "") return null; 613 | 614 | const textLower = text.toLowerCase(); 615 | const actualStartPosition = [...keywords] 616 | .map((k) => textLower.indexOf(k.toLowerCase())) 617 | .filter((i) => i > -1) 618 | .slice(-1)[0]; 619 | const startWithContext = Math.max(actualStartPosition - 120, 0); 620 | 621 | const top = startWithContext === 0 ? "" : "..."; 622 | const tail = startWithContext + 240 < text.length ? "..." : ""; 623 | 624 | let summary = document.createElement("p"); 625 | summary.classList.add("context"); 626 | summary.textContent = top + text.substr(startWithContext, 240).trim() + tail; 627 | 628 | return summary; 629 | }, 630 | }; 631 | 632 | _ready(Search.init); 633 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | GNU GENERAL PUBLIC LICENSE 2 | Version 3, 29 June 2007 3 | 4 | Copyright (C) 2007 Free Software Foundation, Inc. 5 | Everyone is permitted to copy and distribute verbatim copies 6 | of this license document, but changing it is not allowed. 7 | 8 | Preamble 9 | 10 | The GNU General Public License is a free, copyleft license for 11 | software and other kinds of works. 12 | 13 | The licenses for most software and other practical works are designed 14 | to take away your freedom to share and change the works. By contrast, 15 | the GNU General Public License is intended to guarantee your freedom to 16 | share and change all versions of a program--to make sure it remains free 17 | software for all its users. We, the Free Software Foundation, use the 18 | GNU General Public License for most of our software; it applies also to 19 | any other work released this way by its authors. You can apply it to 20 | your programs, too. 21 | 22 | When we speak of free software, we are referring to freedom, not 23 | price. Our General Public Licenses are designed to make sure that you 24 | have the freedom to distribute copies of free software (and charge for 25 | them if you wish), that you receive source code or can get it if you 26 | want it, that you can change the software or use pieces of it in new 27 | free programs, and that you know you can do these things. 28 | 29 | To protect your rights, we need to prevent others from denying you 30 | these rights or asking you to surrender the rights. Therefore, you have 31 | certain responsibilities if you distribute copies of the software, or if 32 | you modify it: responsibilities to respect the freedom of others. 33 | 34 | For example, if you distribute copies of such a program, whether 35 | gratis or for a fee, you must pass on to the recipients the same 36 | freedoms that you received. You must make sure that they, too, receive 37 | or can get the source code. And you must show them these terms so they 38 | know their rights. 39 | 40 | Developers that use the GNU GPL protect your rights with two steps: 41 | (1) assert copyright on the software, and (2) offer you this License 42 | giving you legal permission to copy, distribute and/or modify it. 43 | 44 | For the developers' and authors' protection, the GPL clearly explains 45 | that there is no warranty for this free software. For both users' and 46 | authors' sake, the GPL requires that modified versions be marked as 47 | changed, so that their problems will not be attributed erroneously to 48 | authors of previous versions. 49 | 50 | Some devices are designed to deny users access to install or run 51 | modified versions of the software inside them, although the manufacturer 52 | can do so. This is fundamentally incompatible with the aim of 53 | protecting users' freedom to change the software. The systematic 54 | pattern of such abuse occurs in the area of products for individuals to 55 | use, which is precisely where it is most unacceptable. Therefore, we 56 | have designed this version of the GPL to prohibit the practice for those 57 | products. If such problems arise substantially in other domains, we 58 | stand ready to extend this provision to those domains in future versions 59 | of the GPL, as needed to protect the freedom of users. 60 | 61 | Finally, every program is threatened constantly by software patents. 62 | States should not allow patents to restrict development and use of 63 | software on general-purpose computers, but in those that do, we wish to 64 | avoid the special danger that patents applied to a free program could 65 | make it effectively proprietary. To prevent this, the GPL assures that 66 | patents cannot be used to render the program non-free. 67 | 68 | The precise terms and conditions for copying, distribution and 69 | modification follow. 70 | 71 | TERMS AND CONDITIONS 72 | 73 | 0. Definitions. 74 | 75 | "This License" refers to version 3 of the GNU General Public License. 76 | 77 | "Copyright" also means copyright-like laws that apply to other kinds of 78 | works, such as semiconductor masks. 79 | 80 | "The Program" refers to any copyrightable work licensed under this 81 | License. Each licensee is addressed as "you". "Licensees" and 82 | "recipients" may be individuals or organizations. 83 | 84 | To "modify" a work means to copy from or adapt all or part of the work 85 | in a fashion requiring copyright permission, other than the making of an 86 | exact copy. The resulting work is called a "modified version" of the 87 | earlier work or a work "based on" the earlier work. 88 | 89 | A "covered work" means either the unmodified Program or a work based 90 | on the Program. 91 | 92 | To "propagate" a work means to do anything with it that, without 93 | permission, would make you directly or secondarily liable for 94 | infringement under applicable copyright law, except executing it on a 95 | computer or modifying a private copy. Propagation includes copying, 96 | distribution (with or without modification), making available to the 97 | public, and in some countries other activities as well. 98 | 99 | To "convey" a work means any kind of propagation that enables other 100 | parties to make or receive copies. Mere interaction with a user through 101 | a computer network, with no transfer of a copy, is not conveying. 102 | 103 | An interactive user interface displays "Appropriate Legal Notices" 104 | to the extent that it includes a convenient and prominently visible 105 | feature that (1) displays an appropriate copyright notice, and (2) 106 | tells the user that there is no warranty for the work (except to the 107 | extent that warranties are provided), that licensees may convey the 108 | work under this License, and how to view a copy of this License. If 109 | the interface presents a list of user commands or options, such as a 110 | menu, a prominent item in the list meets this criterion. 111 | 112 | 1. Source Code. 113 | 114 | The "source code" for a work means the preferred form of the work 115 | for making modifications to it. "Object code" means any non-source 116 | form of a work. 117 | 118 | A "Standard Interface" means an interface that either is an official 119 | standard defined by a recognized standards body, or, in the case of 120 | interfaces specified for a particular programming language, one that 121 | is widely used among developers working in that language. 122 | 123 | The "System Libraries" of an executable work include anything, other 124 | than the work as a whole, that (a) is included in the normal form of 125 | packaging a Major Component, but which is not part of that Major 126 | Component, and (b) serves only to enable use of the work with that 127 | Major Component, or to implement a Standard Interface for which an 128 | implementation is available to the public in source code form. A 129 | "Major Component", in this context, means a major essential component 130 | (kernel, window system, and so on) of the specific operating system 131 | (if any) on which the executable work runs, or a compiler used to 132 | produce the work, or an object code interpreter used to run it. 133 | 134 | The "Corresponding Source" for a work in object code form means all 135 | the source code needed to generate, install, and (for an executable 136 | work) run the object code and to modify the work, including scripts to 137 | control those activities. However, it does not include the work's 138 | System Libraries, or general-purpose tools or generally available free 139 | programs which are used unmodified in performing those activities but 140 | which are not part of the work. For example, Corresponding Source 141 | includes interface definition files associated with source files for 142 | the work, and the source code for shared libraries and dynamically 143 | linked subprograms that the work is specifically designed to require, 144 | such as by intimate data communication or control flow between those 145 | subprograms and other parts of the work. 146 | 147 | The Corresponding Source need not include anything that users 148 | can regenerate automatically from other parts of the Corresponding 149 | Source. 150 | 151 | The Corresponding Source for a work in source code form is that 152 | same work. 153 | 154 | 2. Basic Permissions. 155 | 156 | All rights granted under this License are granted for the term of 157 | copyright on the Program, and are irrevocable provided the stated 158 | conditions are met. This License explicitly affirms your unlimited 159 | permission to run the unmodified Program. The output from running a 160 | covered work is covered by this License only if the output, given its 161 | content, constitutes a covered work. This License acknowledges your 162 | rights of fair use or other equivalent, as provided by copyright law. 163 | 164 | You may make, run and propagate covered works that you do not 165 | convey, without conditions so long as your license otherwise remains 166 | in force. You may convey covered works to others for the sole purpose 167 | of having them make modifications exclusively for you, or provide you 168 | with facilities for running those works, provided that you comply with 169 | the terms of this License in conveying all material for which you do 170 | not control copyright. Those thus making or running the covered works 171 | for you must do so exclusively on your behalf, under your direction 172 | and control, on terms that prohibit them from making any copies of 173 | your copyrighted material outside their relationship with you. 174 | 175 | Conveying under any other circumstances is permitted solely under 176 | the conditions stated below. Sublicensing is not allowed; section 10 177 | makes it unnecessary. 178 | 179 | 3. Protecting Users' Legal Rights From Anti-Circumvention Law. 180 | 181 | No covered work shall be deemed part of an effective technological 182 | measure under any applicable law fulfilling obligations under article 183 | 11 of the WIPO copyright treaty adopted on 20 December 1996, or 184 | similar laws prohibiting or restricting circumvention of such 185 | measures. 186 | 187 | When you convey a covered work, you waive any legal power to forbid 188 | circumvention of technological measures to the extent such circumvention 189 | is effected by exercising rights under this License with respect to 190 | the covered work, and you disclaim any intention to limit operation or 191 | modification of the work as a means of enforcing, against the work's 192 | users, your or third parties' legal rights to forbid circumvention of 193 | technological measures. 194 | 195 | 4. Conveying Verbatim Copies. 196 | 197 | You may convey verbatim copies of the Program's source code as you 198 | receive it, in any medium, provided that you conspicuously and 199 | appropriately publish on each copy an appropriate copyright notice; 200 | keep intact all notices stating that this License and any 201 | non-permissive terms added in accord with section 7 apply to the code; 202 | keep intact all notices of the absence of any warranty; and give all 203 | recipients a copy of this License along with the Program. 204 | 205 | You may charge any price or no price for each copy that you convey, 206 | and you may offer support or warranty protection for a fee. 207 | 208 | 5. Conveying Modified Source Versions. 209 | 210 | You may convey a work based on the Program, or the modifications to 211 | produce it from the Program, in the form of source code under the 212 | terms of section 4, provided that you also meet all of these conditions: 213 | 214 | a) The work must carry prominent notices stating that you modified 215 | it, and giving a relevant date. 216 | 217 | b) The work must carry prominent notices stating that it is 218 | released under this License and any conditions added under section 219 | 7. This requirement modifies the requirement in section 4 to 220 | "keep intact all notices". 221 | 222 | c) You must license the entire work, as a whole, under this 223 | License to anyone who comes into possession of a copy. This 224 | License will therefore apply, along with any applicable section 7 225 | additional terms, to the whole of the work, and all its parts, 226 | regardless of how they are packaged. This License gives no 227 | permission to license the work in any other way, but it does not 228 | invalidate such permission if you have separately received it. 229 | 230 | d) If the work has interactive user interfaces, each must display 231 | Appropriate Legal Notices; however, if the Program has interactive 232 | interfaces that do not display Appropriate Legal Notices, your 233 | work need not make them do so. 234 | 235 | A compilation of a covered work with other separate and independent 236 | works, which are not by their nature extensions of the covered work, 237 | and which are not combined with it such as to form a larger program, 238 | in or on a volume of a storage or distribution medium, is called an 239 | "aggregate" if the compilation and its resulting copyright are not 240 | used to limit the access or legal rights of the compilation's users 241 | beyond what the individual works permit. Inclusion of a covered work 242 | in an aggregate does not cause this License to apply to the other 243 | parts of the aggregate. 244 | 245 | 6. Conveying Non-Source Forms. 246 | 247 | You may convey a covered work in object code form under the terms 248 | of sections 4 and 5, provided that you also convey the 249 | machine-readable Corresponding Source under the terms of this License, 250 | in one of these ways: 251 | 252 | a) Convey the object code in, or embodied in, a physical product 253 | (including a physical distribution medium), accompanied by the 254 | Corresponding Source fixed on a durable physical medium 255 | customarily used for software interchange. 256 | 257 | b) Convey the object code in, or embodied in, a physical product 258 | (including a physical distribution medium), accompanied by a 259 | written offer, valid for at least three years and valid for as 260 | long as you offer spare parts or customer support for that product 261 | model, to give anyone who possesses the object code either (1) a 262 | copy of the Corresponding Source for all the software in the 263 | product that is covered by this License, on a durable physical 264 | medium customarily used for software interchange, for a price no 265 | more than your reasonable cost of physically performing this 266 | conveying of source, or (2) access to copy the 267 | Corresponding Source from a network server at no charge. 268 | 269 | c) Convey individual copies of the object code with a copy of the 270 | written offer to provide the Corresponding Source. This 271 | alternative is allowed only occasionally and noncommercially, and 272 | only if you received the object code with such an offer, in accord 273 | with subsection 6b. 274 | 275 | d) Convey the object code by offering access from a designated 276 | place (gratis or for a charge), and offer equivalent access to the 277 | Corresponding Source in the same way through the same place at no 278 | further charge. You need not require recipients to copy the 279 | Corresponding Source along with the object code. If the place to 280 | copy the object code is a network server, the Corresponding Source 281 | may be on a different server (operated by you or a third party) 282 | that supports equivalent copying facilities, provided you maintain 283 | clear directions next to the object code saying where to find the 284 | Corresponding Source. Regardless of what server hosts the 285 | Corresponding Source, you remain obligated to ensure that it is 286 | available for as long as needed to satisfy these requirements. 287 | 288 | e) Convey the object code using peer-to-peer transmission, provided 289 | you inform other peers where the object code and Corresponding 290 | Source of the work are being offered to the general public at no 291 | charge under subsection 6d. 292 | 293 | A separable portion of the object code, whose source code is excluded 294 | from the Corresponding Source as a System Library, need not be 295 | included in conveying the object code work. 296 | 297 | A "User Product" is either (1) a "consumer product", which means any 298 | tangible personal property which is normally used for personal, family, 299 | or household purposes, or (2) anything designed or sold for incorporation 300 | into a dwelling. In determining whether a product is a consumer product, 301 | doubtful cases shall be resolved in favor of coverage. For a particular 302 | product received by a particular user, "normally used" refers to a 303 | typical or common use of that class of product, regardless of the status 304 | of the particular user or of the way in which the particular user 305 | actually uses, or expects or is expected to use, the product. A product 306 | is a consumer product regardless of whether the product has substantial 307 | commercial, industrial or non-consumer uses, unless such uses represent 308 | the only significant mode of use of the product. 309 | 310 | "Installation Information" for a User Product means any methods, 311 | procedures, authorization keys, or other information required to install 312 | and execute modified versions of a covered work in that User Product from 313 | a modified version of its Corresponding Source. The information must 314 | suffice to ensure that the continued functioning of the modified object 315 | code is in no case prevented or interfered with solely because 316 | modification has been made. 317 | 318 | If you convey an object code work under this section in, or with, or 319 | specifically for use in, a User Product, and the conveying occurs as 320 | part of a transaction in which the right of possession and use of the 321 | User Product is transferred to the recipient in perpetuity or for a 322 | fixed term (regardless of how the transaction is characterized), the 323 | Corresponding Source conveyed under this section must be accompanied 324 | by the Installation Information. But this requirement does not apply 325 | if neither you nor any third party retains the ability to install 326 | modified object code on the User Product (for example, the work has 327 | been installed in ROM). 328 | 329 | The requirement to provide Installation Information does not include a 330 | requirement to continue to provide support service, warranty, or updates 331 | for a work that has been modified or installed by the recipient, or for 332 | the User Product in which it has been modified or installed. Access to a 333 | network may be denied when the modification itself materially and 334 | adversely affects the operation of the network or violates the rules and 335 | protocols for communication across the network. 336 | 337 | Corresponding Source conveyed, and Installation Information provided, 338 | in accord with this section must be in a format that is publicly 339 | documented (and with an implementation available to the public in 340 | source code form), and must require no special password or key for 341 | unpacking, reading or copying. 342 | 343 | 7. Additional Terms. 344 | 345 | "Additional permissions" are terms that supplement the terms of this 346 | License by making exceptions from one or more of its conditions. 347 | Additional permissions that are applicable to the entire Program shall 348 | be treated as though they were included in this License, to the extent 349 | that they are valid under applicable law. If additional permissions 350 | apply only to part of the Program, that part may be used separately 351 | under those permissions, but the entire Program remains governed by 352 | this License without regard to the additional permissions. 353 | 354 | When you convey a copy of a covered work, you may at your option 355 | remove any additional permissions from that copy, or from any part of 356 | it. (Additional permissions may be written to require their own 357 | removal in certain cases when you modify the work.) You may place 358 | additional permissions on material, added by you to a covered work, 359 | for which you have or can give appropriate copyright permission. 360 | 361 | Notwithstanding any other provision of this License, for material you 362 | add to a covered work, you may (if authorized by the copyright holders of 363 | that material) supplement the terms of this License with terms: 364 | 365 | a) Disclaiming warranty or limiting liability differently from the 366 | terms of sections 15 and 16 of this License; or 367 | 368 | b) Requiring preservation of specified reasonable legal notices or 369 | author attributions in that material or in the Appropriate Legal 370 | Notices displayed by works containing it; or 371 | 372 | c) Prohibiting misrepresentation of the origin of that material, or 373 | requiring that modified versions of such material be marked in 374 | reasonable ways as different from the original version; or 375 | 376 | d) Limiting the use for publicity purposes of names of licensors or 377 | authors of the material; or 378 | 379 | e) Declining to grant rights under trademark law for use of some 380 | trade names, trademarks, or service marks; or 381 | 382 | f) Requiring indemnification of licensors and authors of that 383 | material by anyone who conveys the material (or modified versions of 384 | it) with contractual assumptions of liability to the recipient, for 385 | any liability that these contractual assumptions directly impose on 386 | those licensors and authors. 387 | 388 | All other non-permissive additional terms are considered "further 389 | restrictions" within the meaning of section 10. If the Program as you 390 | received it, or any part of it, contains a notice stating that it is 391 | governed by this License along with a term that is a further 392 | restriction, you may remove that term. If a license document contains 393 | a further restriction but permits relicensing or conveying under this 394 | License, you may add to a covered work material governed by the terms 395 | of that license document, provided that the further restriction does 396 | not survive such relicensing or conveying. 397 | 398 | If you add terms to a covered work in accord with this section, you 399 | must place, in the relevant source files, a statement of the 400 | additional terms that apply to those files, or a notice indicating 401 | where to find the applicable terms. 402 | 403 | Additional terms, permissive or non-permissive, may be stated in the 404 | form of a separately written license, or stated as exceptions; 405 | the above requirements apply either way. 406 | 407 | 8. Termination. 408 | 409 | You may not propagate or modify a covered work except as expressly 410 | provided under this License. Any attempt otherwise to propagate or 411 | modify it is void, and will automatically terminate your rights under 412 | this License (including any patent licenses granted under the third 413 | paragraph of section 11). 414 | 415 | However, if you cease all violation of this License, then your 416 | license from a particular copyright holder is reinstated (a) 417 | provisionally, unless and until the copyright holder explicitly and 418 | finally terminates your license, and (b) permanently, if the copyright 419 | holder fails to notify you of the violation by some reasonable means 420 | prior to 60 days after the cessation. 421 | 422 | Moreover, your license from a particular copyright holder is 423 | reinstated permanently if the copyright holder notifies you of the 424 | violation by some reasonable means, this is the first time you have 425 | received notice of violation of this License (for any work) from that 426 | copyright holder, and you cure the violation prior to 30 days after 427 | your receipt of the notice. 428 | 429 | Termination of your rights under this section does not terminate the 430 | licenses of parties who have received copies or rights from you under 431 | this License. If your rights have been terminated and not permanently 432 | reinstated, you do not qualify to receive new licenses for the same 433 | material under section 10. 434 | 435 | 9. Acceptance Not Required for Having Copies. 436 | 437 | You are not required to accept this License in order to receive or 438 | run a copy of the Program. Ancillary propagation of a covered work 439 | occurring solely as a consequence of using peer-to-peer transmission 440 | to receive a copy likewise does not require acceptance. However, 441 | nothing other than this License grants you permission to propagate or 442 | modify any covered work. These actions infringe copyright if you do 443 | not accept this License. Therefore, by modifying or propagating a 444 | covered work, you indicate your acceptance of this License to do so. 445 | 446 | 10. Automatic Licensing of Downstream Recipients. 447 | 448 | Each time you convey a covered work, the recipient automatically 449 | receives a license from the original licensors, to run, modify and 450 | propagate that work, subject to this License. You are not responsible 451 | for enforcing compliance by third parties with this License. 452 | 453 | An "entity transaction" is a transaction transferring control of an 454 | organization, or substantially all assets of one, or subdividing an 455 | organization, or merging organizations. If propagation of a covered 456 | work results from an entity transaction, each party to that 457 | transaction who receives a copy of the work also receives whatever 458 | licenses to the work the party's predecessor in interest had or could 459 | give under the previous paragraph, plus a right to possession of the 460 | Corresponding Source of the work from the predecessor in interest, if 461 | the predecessor has it or can get it with reasonable efforts. 462 | 463 | You may not impose any further restrictions on the exercise of the 464 | rights granted or affirmed under this License. For example, you may 465 | not impose a license fee, royalty, or other charge for exercise of 466 | rights granted under this License, and you may not initiate litigation 467 | (including a cross-claim or counterclaim in a lawsuit) alleging that 468 | any patent claim is infringed by making, using, selling, offering for 469 | sale, or importing the Program or any portion of it. 470 | 471 | 11. Patents. 472 | 473 | A "contributor" is a copyright holder who authorizes use under this 474 | License of the Program or a work on which the Program is based. The 475 | work thus licensed is called the contributor's "contributor version". 476 | 477 | A contributor's "essential patent claims" are all patent claims 478 | owned or controlled by the contributor, whether already acquired or 479 | hereafter acquired, that would be infringed by some manner, permitted 480 | by this License, of making, using, or selling its contributor version, 481 | but do not include claims that would be infringed only as a 482 | consequence of further modification of the contributor version. For 483 | purposes of this definition, "control" includes the right to grant 484 | patent sublicenses in a manner consistent with the requirements of 485 | this License. 486 | 487 | Each contributor grants you a non-exclusive, worldwide, royalty-free 488 | patent license under the contributor's essential patent claims, to 489 | make, use, sell, offer for sale, import and otherwise run, modify and 490 | propagate the contents of its contributor version. 491 | 492 | In the following three paragraphs, a "patent license" is any express 493 | agreement or commitment, however denominated, not to enforce a patent 494 | (such as an express permission to practice a patent or covenant not to 495 | sue for patent infringement). To "grant" such a patent license to a 496 | party means to make such an agreement or commitment not to enforce a 497 | patent against the party. 498 | 499 | If you convey a covered work, knowingly relying on a patent license, 500 | and the Corresponding Source of the work is not available for anyone 501 | to copy, free of charge and under the terms of this License, through a 502 | publicly available network server or other readily accessible means, 503 | then you must either (1) cause the Corresponding Source to be so 504 | available, or (2) arrange to deprive yourself of the benefit of the 505 | patent license for this particular work, or (3) arrange, in a manner 506 | consistent with the requirements of this License, to extend the patent 507 | license to downstream recipients. "Knowingly relying" means you have 508 | actual knowledge that, but for the patent license, your conveying the 509 | covered work in a country, or your recipient's use of the covered work 510 | in a country, would infringe one or more identifiable patents in that 511 | country that you have reason to believe are valid. 512 | 513 | If, pursuant to or in connection with a single transaction or 514 | arrangement, you convey, or propagate by procuring conveyance of, a 515 | covered work, and grant a patent license to some of the parties 516 | receiving the covered work authorizing them to use, propagate, modify 517 | or convey a specific copy of the covered work, then the patent license 518 | you grant is automatically extended to all recipients of the covered 519 | work and works based on it. 520 | 521 | A patent license is "discriminatory" if it does not include within 522 | the scope of its coverage, prohibits the exercise of, or is 523 | conditioned on the non-exercise of one or more of the rights that are 524 | specifically granted under this License. You may not convey a covered 525 | work if you are a party to an arrangement with a third party that is 526 | in the business of distributing software, under which you make payment 527 | to the third party based on the extent of your activity of conveying 528 | the work, and under which the third party grants, to any of the 529 | parties who would receive the covered work from you, a discriminatory 530 | patent license (a) in connection with copies of the covered work 531 | conveyed by you (or copies made from those copies), or (b) primarily 532 | for and in connection with specific products or compilations that 533 | contain the covered work, unless you entered into that arrangement, 534 | or that patent license was granted, prior to 28 March 2007. 535 | 536 | Nothing in this License shall be construed as excluding or limiting 537 | any implied license or other defenses to infringement that may 538 | otherwise be available to you under applicable patent law. 539 | 540 | 12. No Surrender of Others' Freedom. 541 | 542 | If conditions are imposed on you (whether by court order, agreement or 543 | otherwise) that contradict the conditions of this License, they do not 544 | excuse you from the conditions of this License. If you cannot convey a 545 | covered work so as to satisfy simultaneously your obligations under this 546 | License and any other pertinent obligations, then as a consequence you may 547 | not convey it at all. For example, if you agree to terms that obligate you 548 | to collect a royalty for further conveying from those to whom you convey 549 | the Program, the only way you could satisfy both those terms and this 550 | License would be to refrain entirely from conveying the Program. 551 | 552 | 13. Use with the GNU Affero General Public License. 553 | 554 | Notwithstanding any other provision of this License, you have 555 | permission to link or combine any covered work with a work licensed 556 | under version 3 of the GNU Affero General Public License into a single 557 | combined work, and to convey the resulting work. The terms of this 558 | License will continue to apply to the part which is the covered work, 559 | but the special requirements of the GNU Affero General Public License, 560 | section 13, concerning interaction through a network will apply to the 561 | combination as such. 562 | 563 | 14. Revised Versions of this License. 564 | 565 | The Free Software Foundation may publish revised and/or new versions of 566 | the GNU General Public License from time to time. Such new versions will 567 | be similar in spirit to the present version, but may differ in detail to 568 | address new problems or concerns. 569 | 570 | Each version is given a distinguishing version number. If the 571 | Program specifies that a certain numbered version of the GNU General 572 | Public License "or any later version" applies to it, you have the 573 | option of following the terms and conditions either of that numbered 574 | version or of any later version published by the Free Software 575 | Foundation. If the Program does not specify a version number of the 576 | GNU General Public License, you may choose any version ever published 577 | by the Free Software Foundation. 578 | 579 | If the Program specifies that a proxy can decide which future 580 | versions of the GNU General Public License can be used, that proxy's 581 | public statement of acceptance of a version permanently authorizes you 582 | to choose that version for the Program. 583 | 584 | Later license versions may give you additional or different 585 | permissions. However, no additional obligations are imposed on any 586 | author or copyright holder as a result of your choosing to follow a 587 | later version. 588 | 589 | 15. Disclaimer of Warranty. 590 | 591 | THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY 592 | APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT 593 | HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY 594 | OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, 595 | THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 596 | PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM 597 | IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF 598 | ALL NECESSARY SERVICING, REPAIR OR CORRECTION. 599 | 600 | 16. Limitation of Liability. 601 | 602 | IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING 603 | WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS 604 | THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY 605 | GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE 606 | USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF 607 | DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD 608 | PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), 609 | EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF 610 | SUCH DAMAGES. 611 | 612 | 17. Interpretation of Sections 15 and 16. 613 | 614 | If the disclaimer of warranty and limitation of liability provided 615 | above cannot be given local legal effect according to their terms, 616 | reviewing courts shall apply local law that most closely approximates 617 | an absolute waiver of all civil liability in connection with the 618 | Program, unless a warranty or assumption of liability accompanies a 619 | copy of the Program in return for a fee. 620 | 621 | END OF TERMS AND CONDITIONS 622 | 623 | How to Apply These Terms to Your New Programs 624 | 625 | If you develop a new program, and you want it to be of the greatest 626 | possible use to the public, the best way to achieve this is to make it 627 | free software which everyone can redistribute and change under these terms. 628 | 629 | To do so, attach the following notices to the program. It is safest 630 | to attach them to the start of each source file to most effectively 631 | state the exclusion of warranty; and each file should have at least 632 | the "copyright" line and a pointer to where the full notice is found. 633 | 634 | 635 | Copyright (C) 636 | 637 | This program is free software: you can redistribute it and/or modify 638 | it under the terms of the GNU General Public License as published by 639 | the Free Software Foundation, either version 3 of the License, or 640 | (at your option) any later version. 641 | 642 | This program is distributed in the hope that it will be useful, 643 | but WITHOUT ANY WARRANTY; without even the implied warranty of 644 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 645 | GNU General Public License for more details. 646 | 647 | You should have received a copy of the GNU General Public License 648 | along with this program. If not, see . 649 | 650 | Also add information on how to contact you by electronic and paper mail. 651 | 652 | If the program does terminal interaction, make it output a short 653 | notice like this when it starts in an interactive mode: 654 | 655 | Copyright (C) 656 | This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'. 657 | This is free software, and you are welcome to redistribute it 658 | under certain conditions; type `show c' for details. 659 | 660 | The hypothetical commands `show w' and `show c' should show the appropriate 661 | parts of the General Public License. Of course, your program's commands 662 | might be different; for a GUI interface, you would use an "about box". 663 | 664 | You should also get your employer (if you work as a programmer) or school, 665 | if any, to sign a "copyright disclaimer" for the program, if necessary. 666 | For more information on this, and how to apply and follow the GNU GPL, see 667 | . 668 | 669 | The GNU General Public License does not permit incorporating your program 670 | into proprietary programs. If your program is a subroutine library, you 671 | may consider it more useful to permit linking proprietary applications with 672 | the library. If this is what you want to do, use the GNU Lesser General 673 | Public License instead of this License. But first, please read 674 | . 675 | --------------------------------------------------------------------------------