├── dalia ├── tests │ ├── __init__.py │ ├── test_hierarchy.py │ └── test_csvv.py ├── __init__.py ├── hierarchy.py └── csvv.py ├── docs ├── authors.rst ├── history.rst ├── readme.rst ├── contributing.rst ├── .gitignore ├── requirements.txt ├── api.rst ├── usage.rst ├── index.rst ├── installation.rst ├── Makefile ├── make.bat └── conf.py ├── .github ├── PULL_REQUEST_TEMPLATE.md └── ISSUE_TEMPLATE.md ├── AUTHORS.rst ├── MANIFEST.in ├── .pre-commit-config.yaml ├── setup.cfg ├── .editorconfig ├── README.rst ├── HISTORY.rst ├── .gitignore ├── setup.py ├── .travis.yml ├── Makefile ├── CONTRIBUTING.rst └── LICENSE /dalia/tests/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /docs/authors.rst: -------------------------------------------------------------------------------- 1 | .. include:: ../AUTHORS.rst 2 | -------------------------------------------------------------------------------- /docs/history.rst: -------------------------------------------------------------------------------- 1 | .. include:: ../HISTORY.rst 2 | -------------------------------------------------------------------------------- /docs/readme.rst: -------------------------------------------------------------------------------- 1 | .. include:: ../README.rst 2 | -------------------------------------------------------------------------------- /docs/contributing.rst: -------------------------------------------------------------------------------- 1 | .. include:: ../CONTRIBUTING.rst 2 | -------------------------------------------------------------------------------- /docs/.gitignore: -------------------------------------------------------------------------------- 1 | /dalia.rst 2 | /dalia.*.rst 3 | /modules.rst 4 | -------------------------------------------------------------------------------- /dalia/__init__.py: -------------------------------------------------------------------------------- 1 | # flake8: noqa 2 | __version__ = "0.2.2" 3 | 4 | 5 | from dalia.csvv import read_csvv 6 | from dalia.hierarchy import read_hierarchy 7 | -------------------------------------------------------------------------------- /docs/requirements.txt: -------------------------------------------------------------------------------- 1 | numpy 2 | pyyaml 3 | anytree 4 | wheel 5 | Sphinx 6 | PyYAML 7 | pytest 8 | sphinx_rtd_theme 9 | numpydoc 10 | ipython 11 | -------------------------------------------------------------------------------- /.github/PULL_REQUEST_TEMPLATE.md: -------------------------------------------------------------------------------- 1 | - [ ] closes #xxxx 2 | - [ ] tests added / passed 3 | - [ ] docs reflect changes 4 | - [ ] passes ``flake8 dalia tests docs`` 5 | - [ ] entry in HISTORY.rst 6 | 7 | [summarize your pull request here] -------------------------------------------------------------------------------- /AUTHORS.rst: -------------------------------------------------------------------------------- 1 | ======= 2 | Credits 3 | ======= 4 | 5 | Development Lead 6 | ---------------- 7 | 8 | * Brewster Malevich 9 | 10 | Contributors 11 | ------------ 12 | 13 | None yet. Why not be the first? 14 | -------------------------------------------------------------------------------- /docs/api.rst: -------------------------------------------------------------------------------- 1 | .. currentmodule:: dalia 2 | 3 | ############# 4 | API reference 5 | ############# 6 | 7 | This page provides an auto-generated summary of dalia's API. 8 | 9 | .. autosummary:: 10 | :toctree: generated/ 11 | 12 | read_csvv 13 | 14 | csvv.Csvv 15 | -------------------------------------------------------------------------------- /docs/usage.rst: -------------------------------------------------------------------------------- 1 | .. currentmodule:: dalia 2 | 3 | ########## 4 | User Guide 5 | ########## 6 | 7 | To use dalia in a project:: 8 | 9 | import dalia 10 | 11 | IO 12 | == 13 | 14 | To read CSVV files, use :py:func:`read_csvv`. Afraid that's all we got right now. 15 | -------------------------------------------------------------------------------- /MANIFEST.in: -------------------------------------------------------------------------------- 1 | include AUTHORS.rst 2 | include CONTRIBUTING.rst 3 | include HISTORY.rst 4 | include LICENSE 5 | include README.rst 6 | 7 | recursive-include tests * 8 | recursive-exclude * __pycache__ 9 | recursive-exclude * *.py[co] 10 | 11 | recursive-include docs *.rst conf.py Makefile make.bat *.jpg *.png *.gif 12 | -------------------------------------------------------------------------------- /.pre-commit-config.yaml: -------------------------------------------------------------------------------- 1 | # https://pre-commit.com/ 2 | # https://github.com/python/black#version-control-integration 3 | repos: 4 | - repo: https://github.com/python/black 5 | rev: stable 6 | hooks: 7 | - id: black 8 | language_version: python3.7 9 | - repo: https://github.com/pre-commit/pre-commit-hooks 10 | rev: v2.2.3 11 | hooks: 12 | - id: flake8 13 | -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE.md: -------------------------------------------------------------------------------- 1 | * dalia version: 2 | * Python version: 3 | * Operating System: 4 | 5 | ### Description 6 | 7 | Describe what you were trying to get done. 8 | Tell us what happened, what went wrong, and what you expected to happen. 9 | 10 | ### What I Did 11 | 12 | ``` 13 | Paste the command(s) you ran and the output. 14 | If there was a crash, please include the traceback here. 15 | ``` 16 | -------------------------------------------------------------------------------- /docs/index.rst: -------------------------------------------------------------------------------- 1 | Welcome to dalia's documentation! 2 | ==================================================================================================== 3 | 4 | Contents: 5 | 6 | .. toctree:: 7 | :maxdepth: 2 8 | 9 | readme 10 | installation 11 | usage 12 | api 13 | contributing 14 | authors 15 | history 16 | 17 | Indices and tables 18 | ================== 19 | 20 | * :ref:`genindex` 21 | * :ref:`modindex` 22 | * :ref:`search` 23 | -------------------------------------------------------------------------------- /setup.cfg: -------------------------------------------------------------------------------- 1 | [bumpversion] 2 | current_version = 0.2.2 3 | commit = True 4 | tag = True 5 | 6 | [bumpversion:file:setup.py] 7 | search = version="{current_version}" 8 | replace = version="{new_version}" 9 | 10 | [bumpversion:file:dalia/__init__.py] 11 | search = __version__ = "{current_version}" 12 | replace = __version__ = "{new_version}" 13 | 14 | [bdist_wheel] 15 | universal = 1 16 | 17 | [flake8] 18 | ignore = 19 | E203 20 | E402 21 | E501 22 | E731 23 | W503 24 | exclude = 25 | docs 26 | 27 | [aliases] 28 | test = pytest 29 | 30 | -------------------------------------------------------------------------------- /.editorconfig: -------------------------------------------------------------------------------- 1 | # http://editorconfig.org 2 | 3 | root = true 4 | 5 | [*] 6 | indent_style = space 7 | indent_size = 4 8 | trim_trailing_whitespace = true 9 | insert_final_newline = true 10 | charset = utf-8 11 | end_of_line = lf 12 | 13 | [*.{yml,yaml}] 14 | indent_style = space 15 | indent_size = 2 16 | trim_trailing_whitespace = true 17 | insert_final_newline = true 18 | charset = utf-8 19 | end_of_line = lf 20 | 21 | [*.bat] 22 | indent_style = tab 23 | end_of_line = crlf 24 | 25 | [LICENSE] 26 | insert_final_newline = false 27 | 28 | [Makefile] 29 | indent_style = tab 30 | -------------------------------------------------------------------------------- /dalia/tests/test_hierarchy.py: -------------------------------------------------------------------------------- 1 | import io 2 | 3 | import pytest 4 | 5 | from dalia import read_hierarchy 6 | 7 | 8 | @pytest.fixture 9 | def hiercsv_filebuffer(): 10 | fl_content = """region-key,parent-key,name,alternatives,is_terminal,gadmid,agglomid,notes 11 | CAmericas,World,Americas,,False,,, 12 | U021,CAmericas,North America,,False,,, 13 | """ 14 | return io.StringIO(fl_content) 15 | 16 | 17 | def test_read_hierarchy(hiercsv_filebuffer): 18 | """Test that we get a root, populated with children, skips files lines 19 | """ 20 | victim = read_hierarchy(hiercsv_filebuffer, skiplines=1) 21 | assert victim.region_key == "World" 22 | assert victim.children[0].region_key == "CAmericas" 23 | assert victim.children[0].children[0].region_key == "U021" 24 | -------------------------------------------------------------------------------- /README.rst: -------------------------------------------------------------------------------- 1 | ===== 2 | dalia 3 | ===== 4 | 5 | 6 | .. image:: https://img.shields.io/pypi/v/dalia.svg 7 | :target: https://pypi.python.org/pypi/dalia 8 | 9 | .. image:: https://img.shields.io/travis/brews/dalia.svg 10 | :target: https://travis-ci.org/brews/dalia 11 | 12 | .. image:: https://readthedocs.org/projects/dalia/badge/?version=latest 13 | :target: https://dalia.readthedocs.io/en/latest/?badge=latest 14 | :alt: Documentation Status 15 | 16 | 17 | This code is under heavy development. Don't use it. 18 | 19 | * Documentation: https://dalia.readthedocs.io. 20 | * Free software: Apache License 2.0 21 | 22 | Features 23 | -------- 24 | 25 | * Read CSVV files with ``dalia.read_csvv()``. 26 | * Read regional hierarchy files as a tree with ``dalia.read_hierarchy()``. 27 | 28 | Installation 29 | ------------ 30 | 31 | To install with ``pip``:: 32 | 33 | pip install dalia 34 | 35 | -------------------------------------------------------------------------------- /HISTORY.rst: -------------------------------------------------------------------------------- 1 | ======= 2 | History 3 | ======= 4 | 5 | 0.3.0 (2019-12-25) 6 | -------------------- 7 | 8 | * ``read_hierarchy()`` now explicitly sets each entry from the "name" column to the "namelong" attribute and the "name" attribute is the region key. In past versions, these metadata would clobber important node attribute names. 9 | 10 | 11 | 0.2.2 (2019-12-25) 12 | -------------------- 13 | 14 | * Patch minor additional issues package version metadata. 15 | 16 | 17 | 0.2.1 (2019-12-25) 18 | -------------------- 19 | 20 | * Patch minor issue with deployment and package version metadata. 21 | 22 | 23 | 0.2.0 (2019-12-25) 24 | -------------------- 25 | 26 | * Add ``read_hierarchy()`` to read regional hierarchy CSV files. 27 | 28 | 29 | 0.1.2a2 (2019-10-31) 30 | -------------------- 31 | 32 | * Add ``read_csvv()`` and ``dalia.csvv.Csvv`` to read and represent CSVV files. 33 | * Initial documentation. 34 | 35 | 36 | 0.0.1a1 (2019-10-10) 37 | -------------------- 38 | 39 | * First release on PyPI. 40 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # Byte-compiled / optimized / DLL files 2 | __pycache__/ 3 | *.py[cod] 4 | *$py.class 5 | 6 | # C extensions 7 | *.so 8 | 9 | # Distribution / packaging 10 | .Python 11 | env/ 12 | build/ 13 | develop-eggs/ 14 | dist/ 15 | downloads/ 16 | eggs/ 17 | .eggs/ 18 | lib/ 19 | lib64/ 20 | parts/ 21 | sdist/ 22 | var/ 23 | *.egg-info/ 24 | .installed.cfg 25 | *.egg 26 | 27 | # PyInstaller 28 | # Usually these files are written by a python script from a template 29 | # before PyInstaller builds the exe, so as to inject date/other infos into it. 30 | *.manifest 31 | *.spec 32 | 33 | # Installer logs 34 | pip-log.txt 35 | pip-delete-this-directory.txt 36 | 37 | # Unit test / coverage reports 38 | htmlcov/ 39 | .tox/ 40 | .coverage 41 | .coverage.* 42 | .cache 43 | nosetests.xml 44 | coverage.xml 45 | *,cover 46 | .hypothesis/ 47 | .pytest_cache 48 | dask-worker-space/ 49 | 50 | # Translations 51 | *.mo 52 | *.pot 53 | 54 | # Django stuff: 55 | *.log 56 | 57 | # Sphinx documentation 58 | docs/_build/ 59 | docs/generated/ 60 | 61 | # IDEs 62 | .idea 63 | *.swp 64 | .DS_Store 65 | .vscode/ 66 | 67 | # PyBuilder 68 | target/ 69 | 70 | # pyenv python configuration file 71 | .python-version 72 | 73 | .ipynb_checkpoints 74 | -------------------------------------------------------------------------------- /docs/installation.rst: -------------------------------------------------------------------------------- 1 | .. highlight:: shell 2 | 3 | ============ 4 | Installation 5 | ============ 6 | 7 | 8 | Stable release 9 | -------------- 10 | 11 | To install dalia, run this command in your terminal: 12 | 13 | .. code-block:: console 14 | 15 | $ pip install dalia 16 | 17 | This is the preferred method to install dalia, as it will always install the most recent stable release. 18 | 19 | If you don't have `pip`_ installed, this `Python installation guide`_ can guide 20 | you through the process. 21 | 22 | .. _pip: https://pip.pypa.io 23 | .. _Python installation guide: http://docs.python-guide.org/en/latest/starting/installation/ 24 | 25 | 26 | From sources 27 | ------------ 28 | 29 | The sources for dalia can be downloaded from the `Github repo`_. 30 | 31 | You can either clone the public repository: 32 | 33 | .. code-block:: console 34 | 35 | $ git clone git://github.com/brews/dalia 36 | 37 | Or download the `tarball`_: 38 | 39 | .. code-block:: console 40 | 41 | $ curl -OL https://github.com/brews/dalia/tarball/master 42 | 43 | Once you have a copy of the source, you can install it with: 44 | 45 | .. code-block:: console 46 | 47 | $ python setup.py install 48 | 49 | 50 | .. _Github repo: https://github.com/brews/dalia 51 | .. _tarball: https://github.com/brews/dalia/tarball/master 52 | -------------------------------------------------------------------------------- /setup.py: -------------------------------------------------------------------------------- 1 | from setuptools import setup, find_packages 2 | 3 | 4 | with open("README.rst") as readme_file: 5 | readme = readme_file.read() 6 | 7 | with open("HISTORY.rst") as history_file: 8 | history = history_file.read() 9 | 10 | setup( 11 | name="dalia", 12 | version="0.2.2", 13 | description="Goddess of fate, giver and taker of goods", 14 | long_description=readme + "\n\n" + history, 15 | long_description_content_type="text/x-rst", 16 | author="Brewster Malevich", 17 | author_email="bmalevich@rhg.com", 18 | url="https://github.com/brews/dalia", 19 | packages=find_packages(), 20 | python_requires=">=3.7", 21 | include_package_data=True, 22 | install_requires=["numpy", "pyyaml", "anytree"], 23 | zip_safe=False, 24 | keywords="dalia", 25 | classifiers=[ 26 | "Development Status :: 2 - Pre-Alpha", 27 | "Intended Audience :: Developers", 28 | "Intended Audience :: Science/Research", 29 | "License :: OSI Approved :: Apache Software License", 30 | "Natural Language :: English", 31 | "Programming Language :: Python :: 3 :: Only", 32 | "Programming Language :: Python :: 3", 33 | "Programming Language :: Python :: 3.7", 34 | "Topic :: Scientific/Engineering", 35 | "Topic :: Sociology", 36 | ], 37 | extras_require={ 38 | "test": ["pytest"], 39 | "dev": ["pytest", "pytest-cov", "wheel", "flake8", "pytest", "black", "twine"], 40 | "doc": ["sphinx", "sphinx_rtd_theme", "numpydoc", "ipython"], 41 | }, 42 | ) 43 | -------------------------------------------------------------------------------- /dalia/hierarchy.py: -------------------------------------------------------------------------------- 1 | """ 2 | Utility functions to read and parse regional hierarchy CSV files 3 | """ 4 | 5 | from csv import reader as csvreader 6 | from anytree import Node 7 | 8 | 9 | def _parse_csv_buffer(b, skiplines): 10 | reader = csvreader(b) 11 | 12 | root = Node( 13 | name="World", 14 | region_key="World", 15 | parent_key="", 16 | namelong="World", 17 | alternatives="", 18 | is_terminal="", 19 | gadmin="", 20 | agglomid="", 21 | notes="", 22 | ) 23 | nodes = {"World": root} 24 | 25 | for ln in reader: 26 | if reader.line_num <= skiplines: 27 | continue 28 | 29 | region_key = str(ln[0]) 30 | parent_key = str(ln[1]) 31 | 32 | nodes[region_key] = Node( 33 | name=region_key, 34 | parent=nodes[parent_key], 35 | region_key=region_key, 36 | parent_key=parent_key, 37 | namelong=str(ln[2]), 38 | alternatives=str(ln[3]), 39 | is_terminal=str(ln[4]), 40 | gadmin=str(ln[5]), 41 | agglomid=str(ln[6]), 42 | notes=str(ln[7]), 43 | ) 44 | return root 45 | 46 | 47 | def read_hierarchy(path_or_buffer, skiplines=32): 48 | """Read a region hierarchy CSV file, return hier root 49 | """ 50 | root = None 51 | if isinstance(path_or_buffer, str): 52 | with open(path_or_buffer, "r") as fl: 53 | root = _parse_csv_buffer(fl, skiplines=skiplines) 54 | else: 55 | root = _parse_csv_buffer(path_or_buffer, skiplines=skiplines) 56 | return root 57 | -------------------------------------------------------------------------------- /.travis.yml: -------------------------------------------------------------------------------- 1 | dist: bionic 2 | notifications: 3 | email: on_failure 4 | 5 | language: python 6 | python: 7 | - 3.7 8 | - 3.8 9 | 10 | install: pip install .[test] 11 | script: pytest -v --doctest-modules --pyargs dalia 12 | 13 | jobs: 14 | include: 15 | - stage: test 16 | name: 'Package' 17 | install: 18 | - pip install twine 19 | - python setup.py bdist_wheel sdist 20 | script: twine check dist/* 21 | - name: 'Code format' 22 | install: pip install .[dev] 23 | script: 24 | - flake8 25 | - black -v --check dalia/* 26 | - name: 'Documentation' 27 | install: pip install .[doc] 28 | script: sphinx-build -W -b html -d docs/_build/doctrees docs/. docs/_build/html 29 | 30 | - stage: deploy 31 | name: 'PyPI' 32 | install: skip 33 | script: skip 34 | deploy: 35 | on: 36 | tags: true 37 | branch: master 38 | provider: pypi 39 | distributions: sdist bdist_wheel 40 | user: __token__ 41 | password: 42 | secure: boKPPgLHYEgBMul1+9dIm9F2PEp1knsSHhBPTAJbd7fNZ1l+CMEIZTGg0FUi1ceLyfWZ0gtWGJHMH8cB2AktLH5jB2pebXI0mOXIv2igitQ4M+UIG4AZEeMMvi3B5kPdHDDj04q0tpk+JdsVCWhir2SyUVpBEI5id4LvqJJpnvcP3wNWZzsWEpid38Hq7NR43i50LzNu+S2pS3S0VxUcoQNL5wIi5UjYe8HlLyPe3JtpCkmAj2pGlg0IGX41r4giK2l920QtoraTY2Q+7h/IuKjm+XQSsIZOyGMG75Q/NvIeQssmAjmEDH8Tj/SW1j8XqLYZ4ixNMrN6kAeWPgBkpe+2muF+AjHfw8zdIP1hZuCaCI2jfS0Mc0z3ibC/iaXYFA7wzKPiJ5CJ6ekoD0HHAo3J6iKhQzWz40gMa6YzZIvMyojvP6Y44MVy0SLD+1Fx/cEJ+pm/lhqtpwqaEz7vDqSNyfXQ8As+4eyGTOo/7MjUm/OJAHR72+2T8MbMxsfDytW67VFeDsWqaMa0PkuiWAb6B0BWcPKn1XLMNmFwGYl1ZyFoMpJki01Wa+EU1h4C+Uz/aye0erYAw4VPQI29V34JPtObOmGzkLP7uZD0n/Rajv3lqkd0k4EuUpH/w78ga24zVb2LUjV7iIc9fC0IeTNDQqc4gRP9ZNT/SG9gvuQ= 43 | skip_existing: true 44 | -------------------------------------------------------------------------------- /dalia/tests/test_csvv.py: -------------------------------------------------------------------------------- 1 | import io 2 | 3 | import pytest 4 | import numpy as np 5 | 6 | from dalia import read_csvv 7 | 8 | 9 | @pytest.fixture 10 | def csvv_filebuffer(): 11 | fl_content = """--- 12 | oneline: oneline 13 | version: version 14 | dependencies: dependencies 15 | description: description 16 | csvv-version: csvv_version 17 | variables: 18 | k1: v1 19 | ... 20 | observations 21 | 123 22 | prednames 23 | a,b,c 24 | covarnames 25 | 1,1,1 26 | gamma 27 | 1.0,2.0,3.0 28 | gammavcv 29 | 1.0,2.0,3.0 30 | 1.0,2.0,3.0 31 | 1.0,2.0,3.0 32 | residvcv 33 | 123.0 34 | """ 35 | return io.StringIO(fl_content) 36 | 37 | 38 | @pytest.mark.parametrize( 39 | "target_attr,expected", 40 | [ 41 | ("oneline", "oneline"), 42 | ("version", "version"), 43 | ("dependencies", "dependencies"), 44 | ("csvv_version", "csvv_version"), 45 | ("variables", {"k1": "v1"}), 46 | ("observations", 123), 47 | ("prednames", ["a", "b", "c"]), 48 | ("covarnames", ["1", "1", "1"]), 49 | ("residvcv", 123.0), 50 | ], 51 | ) 52 | def test_read_csvv(csvv_filebuffer, target_attr, expected): 53 | """Test that read_csvv() gives Csvv with correct non-ndarray attributes""" 54 | csvv = read_csvv(csvv_filebuffer) 55 | assert getattr(csvv, target_attr) == expected 56 | 57 | 58 | @pytest.mark.parametrize( 59 | "target_attr,expected", 60 | [ 61 | ("gamma", np.array([1, 2, 3], dtype="float")), 62 | ( 63 | "gammavcv", 64 | np.repeat(np.array([[1, 2, 3]], dtype="float"), repeats=3, axis=0), 65 | ), 66 | ], 67 | ) 68 | def test_read_csvv_arrays(csvv_filebuffer, target_attr, expected): 69 | """Test that read_csvv() gives Csvv with correct ndarray attributes""" 70 | csvv = read_csvv(csvv_filebuffer) 71 | np.testing.assert_allclose(getattr(csvv, target_attr), expected) 72 | -------------------------------------------------------------------------------- /Makefile: -------------------------------------------------------------------------------- 1 | .PHONY: clean clean-test clean-pyc clean-build docs help 2 | .DEFAULT_GOAL := help 3 | define BROWSER_PYSCRIPT 4 | import os, webbrowser, sys 5 | try: 6 | from urllib import pathname2url 7 | except: 8 | from urllib.request import pathname2url 9 | 10 | webbrowser.open("file://" + pathname2url(os.path.abspath(sys.argv[1]))) 11 | endef 12 | export BROWSER_PYSCRIPT 13 | 14 | define PRINT_HELP_PYSCRIPT 15 | import re, sys 16 | 17 | for line in sys.stdin: 18 | match = re.match(r'^([a-zA-Z_-]+):.*?## (.*)$$', line) 19 | if match: 20 | target, help = match.groups() 21 | print("%-20s %s" % (target, help)) 22 | endef 23 | export PRINT_HELP_PYSCRIPT 24 | BROWSER := python -c "$$BROWSER_PYSCRIPT" 25 | 26 | help: 27 | @python -c "$$PRINT_HELP_PYSCRIPT" < $(MAKEFILE_LIST) 28 | 29 | clean: clean-build clean-pyc clean-test ## remove all build, test, coverage and Python artifacts 30 | 31 | 32 | clean-build: ## remove build artifacts 33 | rm -fr build/ 34 | rm -fr dist/ 35 | rm -fr .eggs/ 36 | find . -name '*.egg-info' -exec rm -fr {} + 37 | find . -name '*.egg' -exec rm -f {} + 38 | 39 | clean-pyc: ## remove Python file artifacts 40 | find . -name '*.pyc' -exec rm -f {} + 41 | find . -name '*.pyo' -exec rm -f {} + 42 | find . -name '*~' -exec rm -f {} + 43 | find . -name '__pycache__' -exec rm -fr {} + 44 | 45 | clean-test: ## remove test and coverage artifacts 46 | rm -fr .tox/ 47 | rm -f .coverage 48 | rm -fr htmlcov/ 49 | 50 | lint: ## check style with flake8 51 | flake8 dalia 52 | 53 | test: ## run tests quickly with the default Python 54 | pytest 55 | 56 | coverage: ## check code coverage quickly with the default Python 57 | coverage run --source dalia -m pytest 58 | coverage report -m 59 | coverage html 60 | $(BROWSER) htmlcov/index.html 61 | 62 | docs: ## generate Sphinx HTML documentation, including API docs 63 | rm -f docs/dalia.rst 64 | rm -f docs/modules.rst 65 | sphinx-apidoc -o docs/ dalia 66 | $(MAKE) -C docs clean 67 | $(MAKE) -C docs html 68 | $(BROWSER) docs/_build/html/index.html 69 | 70 | servedocs: docs ## compile the docs watching for changes 71 | watchmedo shell-command -p '*.rst' -c '$(MAKE) -C docs html' -R -D . 72 | 73 | release: clean ## package and upload a release 74 | python setup.py sdist upload 75 | python setup.py bdist_wheel upload 76 | 77 | dist: clean ## builds source and wheel package 78 | python setup.py sdist 79 | python setup.py bdist_wheel 80 | ls -l dist 81 | 82 | install: clean ## install the package to the active Python's site-packages 83 | python setup.py install 84 | -------------------------------------------------------------------------------- /CONTRIBUTING.rst: -------------------------------------------------------------------------------- 1 | .. highlight:: shell 2 | 3 | ============ 4 | Contributing 5 | ============ 6 | 7 | Contributions are welcome, and they are greatly appreciated! Every 8 | little bit helps, and credit will always be given. 9 | 10 | You can contribute in many ways: 11 | 12 | Types of Contributions 13 | ---------------------- 14 | 15 | Report Bugs 16 | ~~~~~~~~~~~ 17 | 18 | Report bugs at https://github.com/brews/dalia/issues. 19 | 20 | If you are reporting a bug, please include: 21 | 22 | * Your operating system name and version. 23 | * Any details about your local setup that might be helpful in troubleshooting. 24 | * Detailed steps to reproduce the bug. 25 | 26 | Fix Bugs 27 | ~~~~~~~~ 28 | 29 | Look through the GitHub issues for bugs. Anything tagged with "bug" 30 | and "help wanted" is open to whoever wants to implement it. 31 | 32 | Implement Features 33 | ~~~~~~~~~~~~~~~~~~ 34 | 35 | Look through the GitHub issues for features. Anything tagged with "enhancement" 36 | and "help wanted" is open to whoever wants to implement it. 37 | 38 | Write Documentation 39 | ~~~~~~~~~~~~~~~~~~~ 40 | 41 | dalia could always use more documentation, whether as part of the 42 | official dalia docs, in docstrings, or even on the web in blog posts, 43 | articles, and such. 44 | 45 | Submit Feedback 46 | ~~~~~~~~~~~~~~~ 47 | 48 | The best way to send feedback is to file an issue at https://github.com/brews/dalia/issues. 49 | 50 | If you are proposing a feature: 51 | 52 | * Explain in detail how it would work. 53 | * Keep the scope as narrow as possible, to make it easier to implement. 54 | * Remember that this is a volunteer-driven project, and that contributions 55 | are welcome :) 56 | 57 | Get Started! 58 | ------------ 59 | 60 | Ready to contribute? Here's how to set up `dalia` for local development. 61 | 62 | 1. Fork the `dalia` repo on GitHub. 63 | 2. Clone your fork locally:: 64 | 65 | $ git clone git@github.com:your_name_here/dalia.git 66 | 67 | 3. Install your local copy into a virtualenv. Assuming you have virtualenvwrapper installed, this is how you set up your fork for local development:: 68 | 69 | $ mkvirtualenv dalia 70 | $ cd dalia/ 71 | $ python setup.py develop 72 | 73 | 4. Create a branch for local development:: 74 | 75 | $ git checkout -b name-of-your-bugfix-or-feature 76 | 77 | Now you can make your changes locally. 78 | 79 | 5. When you're done making changes, check that your changes pass flake8 and the tests, including testing other Python versions with tox:: 80 | 81 | $ flake8 dalia 82 | $ pytest 83 | 84 | To get flake8, just pip install them into your environment. 85 | 86 | 6. Commit your changes and push your branch to GitHub:: 87 | 88 | $ git add . 89 | $ git commit -m "Your detailed description of your changes." 90 | $ git push origin name-of-your-bugfix-or-feature 91 | 92 | 7. Submit a pull request through the GitHub website. 93 | 94 | Pull Request Guidelines 95 | ----------------------- 96 | 97 | Before you submit a pull request, check that it meets these guidelines: 98 | 99 | 1. The pull request should include tests. 100 | 2. If the pull request adds functionality, the docs should be updated. Put 101 | your new functionality into a function with a docstring, and add the 102 | feature to the list in README.rst. 103 | 3. The pull request should work for Python 2.6, 2.7, 3.3, 3.4 and 3.5, and for PyPy. Check 104 | https://travis-ci.org/brews/dalia/pull_requests 105 | and make sure that the tests pass for all supported Python versions. 106 | 107 | Tips 108 | ---- 109 | 110 | To run a subset of tests:: 111 | 112 | $ pytest dalia.tests.test_io 113 | 114 | -------------------------------------------------------------------------------- /dalia/csvv.py: -------------------------------------------------------------------------------- 1 | """ 2 | Reading and representing CSVV text files 3 | """ 4 | from collections import defaultdict 5 | from dataclasses import dataclass 6 | from typing import List, Dict 7 | 8 | import numpy as np 9 | import yaml 10 | 11 | 12 | @dataclass 13 | class Csvv: 14 | """Data from a CSVV file 15 | """ 16 | 17 | oneline: str 18 | version: str 19 | dependencies: str 20 | description: str 21 | csvv_version: str 22 | variables: Dict[str, str] 23 | observations: int 24 | prednames: List[str] 25 | covarnames: List[str] 26 | gamma: np.ndarray 27 | gammavcv: np.ndarray 28 | residvcv: float 29 | 30 | 31 | def _parse_csvvlines(lines, sep=","): 32 | """List of str from CSVV file to dict 33 | 34 | Parameters 35 | ---------- 36 | lines : sequence of str 37 | To parse. 38 | sep : str or None, optional 39 | Value delimiter for the body of the CSVV file. If None, delimits white 40 | space. 41 | 42 | Returns 43 | ------- 44 | meta : dict 45 | """ 46 | # This all could be done better... 47 | header_sections = [ 48 | "oneline", 49 | "version", 50 | "dependencies", 51 | "description", 52 | "csvv-version", 53 | "variables", 54 | ] 55 | body_sections = [ 56 | "observations", 57 | "prednames", 58 | "covarnames", 59 | "gamma", 60 | "gammavcv", 61 | "residvcv", 62 | ] 63 | # Divide into header an body 64 | header_lines = [] 65 | body = defaultdict(list) 66 | 67 | inheader = False 68 | inbody = False 69 | 70 | # Grab header. Find start idx of body. 71 | n_lines = len(lines) 72 | for idx, l in enumerate(lines): 73 | 74 | if l.strip() == "---": 75 | # First line of file, indicates header incoming. 76 | inheader = True 77 | inbody = False 78 | continue 79 | 80 | if l.strip() == "..." and n_lines > idx: 81 | # First transition to body. 82 | inheader = False 83 | inbody = True 84 | continue 85 | elif l.strip() == "...": 86 | raise IndexError("CSVV body has too few lines") 87 | 88 | if inheader: 89 | header_lines.append(l.rstrip()) 90 | continue 91 | 92 | if inbody: 93 | if l.strip() in body_sections: 94 | # This is a body section. 95 | inbody = l.strip() 96 | continue 97 | elif inbody in body_sections: 98 | # This is a data section. 99 | body[inbody].append([x.strip() for x in l.split(sep)]) 100 | 101 | meta = yaml.load("\n".join(header_lines), Loader=yaml.SafeLoader) 102 | # Combine sections 103 | meta.update(body) 104 | 105 | assert set(list(meta.keys())) == set(header_sections + body_sections) 106 | 107 | # Clean body data 108 | # Flatten nested lists where needed. 109 | for k in ["prednames", "covarnames", "gamma", "residvcv", "observations"]: 110 | meta[k] = [item for sublist in meta[k] for item in sublist] 111 | 112 | # Check for correct len. 113 | n = len(meta["gammavcv"]) 114 | for k in ["prednames", "covarnames", "gamma"]: 115 | assert len(meta[k]) == n, f"{k} does not contain {n} elements" 116 | 117 | # Cast numerics from strings 118 | for k in ["gamma", "gammavcv", "residvcv"]: 119 | meta[k] = np.array(meta[k], dtype="float") 120 | meta["observations"] = np.array(meta["observations"], dtype="int") 121 | 122 | # Arrays to scalars 123 | meta["observations"] = meta["observations"].item() 124 | meta["residvcv"] = meta["residvcv"].item() 125 | 126 | # meta keys eventually become attrs, so remove "-" 127 | meta["csvv_version"] = meta.pop("csvv-version") 128 | return meta 129 | 130 | 131 | def read_csvv(filepath_or_buffer, sep=","): 132 | """Read a CSVV file into a CSVV object 133 | 134 | Parameters 135 | ---------- 136 | filepath_or_buffer 137 | str path to target file or opened buffer. 138 | sep : str or None, optional 139 | Value delimiter for the body of the CSVV file. If None, delimits 140 | whitespace. 141 | 142 | Returns 143 | ------- 144 | Csvv 145 | """ 146 | if isinstance(filepath_or_buffer, str): 147 | with open(filepath_or_buffer, "r") as fl: 148 | fl_guts = fl.readlines() 149 | else: 150 | fl_guts = filepath_or_buffer.readlines() 151 | 152 | return Csvv(**_parse_csvvlines(fl_guts, sep=sep)) 153 | -------------------------------------------------------------------------------- /docs/Makefile: -------------------------------------------------------------------------------- 1 | # Makefile for Sphinx documentation 2 | # 3 | 4 | # You can set these variables from the command line. 5 | SPHINXOPTS = 6 | SPHINXBUILD = sphinx-build 7 | PAPER = 8 | BUILDDIR = _build 9 | 10 | # User-friendly check for sphinx-build 11 | ifeq ($(shell which $(SPHINXBUILD) >/dev/null 2>&1; echo $$?), 1) 12 | $(error The '$(SPHINXBUILD)' command was not found. Make sure you have Sphinx installed, then set the SPHINXBUILD environment variable to point to the full path of the '$(SPHINXBUILD)' executable. Alternatively you can add the directory with the executable to your PATH. If you don't have Sphinx installed, grab it from http://sphinx-doc.org/) 13 | endif 14 | 15 | # Internal variables. 16 | PAPEROPT_a4 = -D latex_paper_size=a4 17 | PAPEROPT_letter = -D latex_paper_size=letter 18 | ALLSPHINXOPTS = -d $(BUILDDIR)/doctrees $(PAPEROPT_$(PAPER)) $(SPHINXOPTS) . 19 | # the i18n builder cannot share the environment and doctrees with the others 20 | I18NSPHINXOPTS = $(PAPEROPT_$(PAPER)) $(SPHINXOPTS) . 21 | 22 | .PHONY: help clean html dirhtml singlehtml pickle json htmlhelp qthelp devhelp epub latex latexpdf text man changes linkcheck doctest gettext 23 | 24 | help: 25 | @echo "Please use \`make ' where is one of" 26 | @echo " html to make standalone HTML files" 27 | @echo " dirhtml to make HTML files named index.html in directories" 28 | @echo " singlehtml to make a single large HTML file" 29 | @echo " pickle to make pickle files" 30 | @echo " json to make JSON files" 31 | @echo " htmlhelp to make HTML files and a HTML help project" 32 | @echo " qthelp to make HTML files and a qthelp project" 33 | @echo " devhelp to make HTML files and a Devhelp project" 34 | @echo " epub to make an epub" 35 | @echo " latex to make LaTeX files, you can set PAPER=a4 or PAPER=letter" 36 | @echo " latexpdf to make LaTeX files and run them through pdflatex" 37 | @echo " latexpdfja to make LaTeX files and run them through platex/dvipdfmx" 38 | @echo " text to make text files" 39 | @echo " man to make manual pages" 40 | @echo " texinfo to make Texinfo files" 41 | @echo " info to make Texinfo files and run them through makeinfo" 42 | @echo " gettext to make PO message catalogs" 43 | @echo " changes to make an overview of all changed/added/deprecated items" 44 | @echo " xml to make Docutils-native XML files" 45 | @echo " pseudoxml to make pseudoxml-XML files for display purposes" 46 | @echo " linkcheck to check all external links for integrity" 47 | @echo " doctest to run all doctests embedded in the documentation (if enabled)" 48 | 49 | clean: 50 | rm -rf $(BUILDDIR)/* 51 | 52 | html: 53 | $(SPHINXBUILD) -b html $(ALLSPHINXOPTS) $(BUILDDIR)/html 54 | @echo 55 | @echo "Build finished. The HTML pages are in $(BUILDDIR)/html." 56 | 57 | dirhtml: 58 | $(SPHINXBUILD) -b dirhtml $(ALLSPHINXOPTS) $(BUILDDIR)/dirhtml 59 | @echo 60 | @echo "Build finished. The HTML pages are in $(BUILDDIR)/dirhtml." 61 | 62 | singlehtml: 63 | $(SPHINXBUILD) -b singlehtml $(ALLSPHINXOPTS) $(BUILDDIR)/singlehtml 64 | @echo 65 | @echo "Build finished. The HTML page is in $(BUILDDIR)/singlehtml." 66 | 67 | pickle: 68 | $(SPHINXBUILD) -b pickle $(ALLSPHINXOPTS) $(BUILDDIR)/pickle 69 | @echo 70 | @echo "Build finished; now you can process the pickle files." 71 | 72 | json: 73 | $(SPHINXBUILD) -b json $(ALLSPHINXOPTS) $(BUILDDIR)/json 74 | @echo 75 | @echo "Build finished; now you can process the JSON files." 76 | 77 | htmlhelp: 78 | $(SPHINXBUILD) -b htmlhelp $(ALLSPHINXOPTS) $(BUILDDIR)/htmlhelp 79 | @echo 80 | @echo "Build finished; now you can run HTML Help Workshop with the" \ 81 | ".hhp project file in $(BUILDDIR)/htmlhelp." 82 | 83 | qthelp: 84 | $(SPHINXBUILD) -b qthelp $(ALLSPHINXOPTS) $(BUILDDIR)/qthelp 85 | @echo 86 | @echo "Build finished; now you can run "qcollectiongenerator" with the" \ 87 | ".qhcp project file in $(BUILDDIR)/qthelp, like this:" 88 | @echo "# qcollectiongenerator $(BUILDDIR)/qthelp/dalia.qhcp" 89 | @echo "To view the help file:" 90 | @echo "# assistant -collectionFile $(BUILDDIR)/qthelp/dalia.qhc" 91 | 92 | devhelp: 93 | $(SPHINXBUILD) -b devhelp $(ALLSPHINXOPTS) $(BUILDDIR)/devhelp 94 | @echo 95 | @echo "Build finished." 96 | @echo "To view the help file:" 97 | @echo "# mkdir -p $$HOME/.local/share/devhelp/dalia" 98 | @echo "# ln -s $(BUILDDIR)/devhelp $$HOME/.local/share/devhelp/dalia" 99 | @echo "# devhelp" 100 | 101 | epub: 102 | $(SPHINXBUILD) -b epub $(ALLSPHINXOPTS) $(BUILDDIR)/epub 103 | @echo 104 | @echo "Build finished. The epub file is in $(BUILDDIR)/epub." 105 | 106 | latex: 107 | $(SPHINXBUILD) -b latex $(ALLSPHINXOPTS) $(BUILDDIR)/latex 108 | @echo 109 | @echo "Build finished; the LaTeX files are in $(BUILDDIR)/latex." 110 | @echo "Run \`make' in that directory to run these through (pdf)latex" \ 111 | "(use \`make latexpdf' here to do that automatically)." 112 | 113 | latexpdf: 114 | $(SPHINXBUILD) -b latex $(ALLSPHINXOPTS) $(BUILDDIR)/latex 115 | @echo "Running LaTeX files through pdflatex..." 116 | $(MAKE) -C $(BUILDDIR)/latex all-pdf 117 | @echo "pdflatex finished; the PDF files are in $(BUILDDIR)/latex." 118 | 119 | latexpdfja: 120 | $(SPHINXBUILD) -b latex $(ALLSPHINXOPTS) $(BUILDDIR)/latex 121 | @echo "Running LaTeX files through platex and dvipdfmx..." 122 | $(MAKE) -C $(BUILDDIR)/latex all-pdf-ja 123 | @echo "pdflatex finished; the PDF files are in $(BUILDDIR)/latex." 124 | 125 | text: 126 | $(SPHINXBUILD) -b text $(ALLSPHINXOPTS) $(BUILDDIR)/text 127 | @echo 128 | @echo "Build finished. The text files are in $(BUILDDIR)/text." 129 | 130 | man: 131 | $(SPHINXBUILD) -b man $(ALLSPHINXOPTS) $(BUILDDIR)/man 132 | @echo 133 | @echo "Build finished. The manual pages are in $(BUILDDIR)/man." 134 | 135 | texinfo: 136 | $(SPHINXBUILD) -b texinfo $(ALLSPHINXOPTS) $(BUILDDIR)/texinfo 137 | @echo 138 | @echo "Build finished. The Texinfo files are in $(BUILDDIR)/texinfo." 139 | @echo "Run \`make' in that directory to run these through makeinfo" \ 140 | "(use \`make info' here to do that automatically)." 141 | 142 | info: 143 | $(SPHINXBUILD) -b texinfo $(ALLSPHINXOPTS) $(BUILDDIR)/texinfo 144 | @echo "Running Texinfo files through makeinfo..." 145 | make -C $(BUILDDIR)/texinfo info 146 | @echo "makeinfo finished; the Info files are in $(BUILDDIR)/texinfo." 147 | 148 | gettext: 149 | $(SPHINXBUILD) -b gettext $(I18NSPHINXOPTS) $(BUILDDIR)/locale 150 | @echo 151 | @echo "Build finished. The message catalogs are in $(BUILDDIR)/locale." 152 | 153 | changes: 154 | $(SPHINXBUILD) -b changes $(ALLSPHINXOPTS) $(BUILDDIR)/changes 155 | @echo 156 | @echo "The overview file is in $(BUILDDIR)/changes." 157 | 158 | linkcheck: 159 | $(SPHINXBUILD) -b linkcheck $(ALLSPHINXOPTS) $(BUILDDIR)/linkcheck 160 | @echo 161 | @echo "Link check complete; look for any errors in the above output " \ 162 | "or in $(BUILDDIR)/linkcheck/output.txt." 163 | 164 | doctest: 165 | $(SPHINXBUILD) -b doctest $(ALLSPHINXOPTS) $(BUILDDIR)/doctest 166 | @echo "Testing of doctests in the sources finished, look at the " \ 167 | "results in $(BUILDDIR)/doctest/output.txt." 168 | 169 | xml: 170 | $(SPHINXBUILD) -b xml $(ALLSPHINXOPTS) $(BUILDDIR)/xml 171 | @echo 172 | @echo "Build finished. The XML files are in $(BUILDDIR)/xml." 173 | 174 | pseudoxml: 175 | $(SPHINXBUILD) -b pseudoxml $(ALLSPHINXOPTS) $(BUILDDIR)/pseudoxml 176 | @echo 177 | @echo "Build finished. The pseudo-XML files are in $(BUILDDIR)/pseudoxml." 178 | -------------------------------------------------------------------------------- /docs/make.bat: -------------------------------------------------------------------------------- 1 | @ECHO OFF 2 | 3 | REM Command file for Sphinx documentation 4 | 5 | if "%SPHINXBUILD%" == "" ( 6 | set SPHINXBUILD=sphinx-build 7 | ) 8 | set BUILDDIR=_build 9 | set ALLSPHINXOPTS=-d %BUILDDIR%/doctrees %SPHINXOPTS% . 10 | set I18NSPHINXOPTS=%SPHINXOPTS% . 11 | if NOT "%PAPER%" == "" ( 12 | set ALLSPHINXOPTS=-D latex_paper_size=%PAPER% %ALLSPHINXOPTS% 13 | set I18NSPHINXOPTS=-D latex_paper_size=%PAPER% %I18NSPHINXOPTS% 14 | ) 15 | 16 | if "%1" == "" goto help 17 | 18 | if "%1" == "help" ( 19 | :help 20 | echo.Please use `make ^` where ^ is one of 21 | echo. html to make standalone HTML files 22 | echo. dirhtml to make HTML files named index.html in directories 23 | echo. singlehtml to make a single large HTML file 24 | echo. pickle to make pickle files 25 | echo. json to make JSON files 26 | echo. htmlhelp to make HTML files and a HTML help project 27 | echo. qthelp to make HTML files and a qthelp project 28 | echo. devhelp to make HTML files and a Devhelp project 29 | echo. epub to make an epub 30 | echo. latex to make LaTeX files, you can set PAPER=a4 or PAPER=letter 31 | echo. text to make text files 32 | echo. man to make manual pages 33 | echo. texinfo to make Texinfo files 34 | echo. gettext to make PO message catalogs 35 | echo. changes to make an overview over all changed/added/deprecated items 36 | echo. xml to make Docutils-native XML files 37 | echo. pseudoxml to make pseudoxml-XML files for display purposes 38 | echo. linkcheck to check all external links for integrity 39 | echo. doctest to run all doctests embedded in the documentation if enabled 40 | goto end 41 | ) 42 | 43 | if "%1" == "clean" ( 44 | for /d %%i in (%BUILDDIR%\*) do rmdir /q /s %%i 45 | del /q /s %BUILDDIR%\* 46 | goto end 47 | ) 48 | 49 | 50 | %SPHINXBUILD% 2> nul 51 | if errorlevel 9009 ( 52 | echo. 53 | echo.The 'sphinx-build' command was not found. Make sure you have Sphinx 54 | echo.installed, then set the SPHINXBUILD environment variable to point 55 | echo.to the full path of the 'sphinx-build' executable. Alternatively you 56 | echo.may add the Sphinx directory to PATH. 57 | echo. 58 | echo.If you don't have Sphinx installed, grab it from 59 | echo.http://sphinx-doc.org/ 60 | exit /b 1 61 | ) 62 | 63 | if "%1" == "html" ( 64 | %SPHINXBUILD% -b html %ALLSPHINXOPTS% %BUILDDIR%/html 65 | if errorlevel 1 exit /b 1 66 | echo. 67 | echo.Build finished. The HTML pages are in %BUILDDIR%/html. 68 | goto end 69 | ) 70 | 71 | if "%1" == "dirhtml" ( 72 | %SPHINXBUILD% -b dirhtml %ALLSPHINXOPTS% %BUILDDIR%/dirhtml 73 | if errorlevel 1 exit /b 1 74 | echo. 75 | echo.Build finished. The HTML pages are in %BUILDDIR%/dirhtml. 76 | goto end 77 | ) 78 | 79 | if "%1" == "singlehtml" ( 80 | %SPHINXBUILD% -b singlehtml %ALLSPHINXOPTS% %BUILDDIR%/singlehtml 81 | if errorlevel 1 exit /b 1 82 | echo. 83 | echo.Build finished. The HTML pages are in %BUILDDIR%/singlehtml. 84 | goto end 85 | ) 86 | 87 | if "%1" == "pickle" ( 88 | %SPHINXBUILD% -b pickle %ALLSPHINXOPTS% %BUILDDIR%/pickle 89 | if errorlevel 1 exit /b 1 90 | echo. 91 | echo.Build finished; now you can process the pickle files. 92 | goto end 93 | ) 94 | 95 | if "%1" == "json" ( 96 | %SPHINXBUILD% -b json %ALLSPHINXOPTS% %BUILDDIR%/json 97 | if errorlevel 1 exit /b 1 98 | echo. 99 | echo.Build finished; now you can process the JSON files. 100 | goto end 101 | ) 102 | 103 | if "%1" == "htmlhelp" ( 104 | %SPHINXBUILD% -b htmlhelp %ALLSPHINXOPTS% %BUILDDIR%/htmlhelp 105 | if errorlevel 1 exit /b 1 106 | echo. 107 | echo.Build finished; now you can run HTML Help Workshop with the ^ 108 | .hhp project file in %BUILDDIR%/htmlhelp. 109 | goto end 110 | ) 111 | 112 | if "%1" == "qthelp" ( 113 | %SPHINXBUILD% -b qthelp %ALLSPHINXOPTS% %BUILDDIR%/qthelp 114 | if errorlevel 1 exit /b 1 115 | echo. 116 | echo.Build finished; now you can run "qcollectiongenerator" with the ^ 117 | .qhcp project file in %BUILDDIR%/qthelp, like this: 118 | echo.^> qcollectiongenerator %BUILDDIR%\qthelp\dalia.qhcp 119 | echo.To view the help file: 120 | echo.^> assistant -collectionFile %BUILDDIR%\qthelp\dalia.ghc 121 | goto end 122 | ) 123 | 124 | if "%1" == "devhelp" ( 125 | %SPHINXBUILD% -b devhelp %ALLSPHINXOPTS% %BUILDDIR%/devhelp 126 | if errorlevel 1 exit /b 1 127 | echo. 128 | echo.Build finished. 129 | goto end 130 | ) 131 | 132 | if "%1" == "epub" ( 133 | %SPHINXBUILD% -b epub %ALLSPHINXOPTS% %BUILDDIR%/epub 134 | if errorlevel 1 exit /b 1 135 | echo. 136 | echo.Build finished. The epub file is in %BUILDDIR%/epub. 137 | goto end 138 | ) 139 | 140 | if "%1" == "latex" ( 141 | %SPHINXBUILD% -b latex %ALLSPHINXOPTS% %BUILDDIR%/latex 142 | if errorlevel 1 exit /b 1 143 | echo. 144 | echo.Build finished; the LaTeX files are in %BUILDDIR%/latex. 145 | goto end 146 | ) 147 | 148 | if "%1" == "latexpdf" ( 149 | %SPHINXBUILD% -b latex %ALLSPHINXOPTS% %BUILDDIR%/latex 150 | cd %BUILDDIR%/latex 151 | make all-pdf 152 | cd %BUILDDIR%/.. 153 | echo. 154 | echo.Build finished; the PDF files are in %BUILDDIR%/latex. 155 | goto end 156 | ) 157 | 158 | if "%1" == "latexpdfja" ( 159 | %SPHINXBUILD% -b latex %ALLSPHINXOPTS% %BUILDDIR%/latex 160 | cd %BUILDDIR%/latex 161 | make all-pdf-ja 162 | cd %BUILDDIR%/.. 163 | echo. 164 | echo.Build finished; the PDF files are in %BUILDDIR%/latex. 165 | goto end 166 | ) 167 | 168 | if "%1" == "text" ( 169 | %SPHINXBUILD% -b text %ALLSPHINXOPTS% %BUILDDIR%/text 170 | if errorlevel 1 exit /b 1 171 | echo. 172 | echo.Build finished. The text files are in %BUILDDIR%/text. 173 | goto end 174 | ) 175 | 176 | if "%1" == "man" ( 177 | %SPHINXBUILD% -b man %ALLSPHINXOPTS% %BUILDDIR%/man 178 | if errorlevel 1 exit /b 1 179 | echo. 180 | echo.Build finished. The manual pages are in %BUILDDIR%/man. 181 | goto end 182 | ) 183 | 184 | if "%1" == "texinfo" ( 185 | %SPHINXBUILD% -b texinfo %ALLSPHINXOPTS% %BUILDDIR%/texinfo 186 | if errorlevel 1 exit /b 1 187 | echo. 188 | echo.Build finished. The Texinfo files are in %BUILDDIR%/texinfo. 189 | goto end 190 | ) 191 | 192 | if "%1" == "gettext" ( 193 | %SPHINXBUILD% -b gettext %I18NSPHINXOPTS% %BUILDDIR%/locale 194 | if errorlevel 1 exit /b 1 195 | echo. 196 | echo.Build finished. The message catalogs are in %BUILDDIR%/locale. 197 | goto end 198 | ) 199 | 200 | if "%1" == "changes" ( 201 | %SPHINXBUILD% -b changes %ALLSPHINXOPTS% %BUILDDIR%/changes 202 | if errorlevel 1 exit /b 1 203 | echo. 204 | echo.The overview file is in %BUILDDIR%/changes. 205 | goto end 206 | ) 207 | 208 | if "%1" == "linkcheck" ( 209 | %SPHINXBUILD% -b linkcheck %ALLSPHINXOPTS% %BUILDDIR%/linkcheck 210 | if errorlevel 1 exit /b 1 211 | echo. 212 | echo.Link check complete; look for any errors in the above output ^ 213 | or in %BUILDDIR%/linkcheck/output.txt. 214 | goto end 215 | ) 216 | 217 | if "%1" == "doctest" ( 218 | %SPHINXBUILD% -b doctest %ALLSPHINXOPTS% %BUILDDIR%/doctest 219 | if errorlevel 1 exit /b 1 220 | echo. 221 | echo.Testing of doctests in the sources finished, look at the ^ 222 | results in %BUILDDIR%/doctest/output.txt. 223 | goto end 224 | ) 225 | 226 | if "%1" == "xml" ( 227 | %SPHINXBUILD% -b xml %ALLSPHINXOPTS% %BUILDDIR%/xml 228 | if errorlevel 1 exit /b 1 229 | echo. 230 | echo.Build finished. The XML files are in %BUILDDIR%/xml. 231 | goto end 232 | ) 233 | 234 | if "%1" == "pseudoxml" ( 235 | %SPHINXBUILD% -b pseudoxml %ALLSPHINXOPTS% %BUILDDIR%/pseudoxml 236 | if errorlevel 1 exit /b 1 237 | echo. 238 | echo.Build finished. The pseudo-XML files are in %BUILDDIR%/pseudoxml. 239 | goto end 240 | ) 241 | 242 | :end 243 | -------------------------------------------------------------------------------- /docs/conf.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | # -*- coding: utf-8 -*- 3 | # 4 | # dalia documentation build configuration file, created by 5 | # sphinx-quickstart on Tue Jul 9 22:26:36 2013. 6 | # 7 | # This file is execfile()d with the current directory set to its 8 | # containing dir. 9 | # 10 | # Note that not all possible configuration values are present in this 11 | # autogenerated file. 12 | # 13 | # All configuration values have a default; values that are commented out 14 | # serve to show the default. 15 | 16 | import sys 17 | import os 18 | 19 | # If extensions (or modules to document with autodoc) are in another 20 | # directory, add these directories to sys.path here. If the directory is 21 | # relative to the documentation root, use os.path.abspath to make it 22 | # absolute, like shown here. 23 | # sys.path.insert(0, os.path.abspath('.')) 24 | 25 | # Get the project root dir, which is the parent dir of this 26 | cwd = os.getcwd() 27 | project_root = os.path.dirname(cwd) 28 | 29 | # Insert the project root dir as the first element in the PYTHONPATH. 30 | # This lets us ensure that the source package is imported, and that its 31 | # version is used. 32 | sys.path.insert(0, project_root) 33 | 34 | import dalia 35 | 36 | # -- General configuration --------------------------------------------- 37 | 38 | # If your documentation needs a minimal Sphinx version, state it here. 39 | # needs_sphinx = '1.0' 40 | 41 | # Add any Sphinx extension module names here, as strings. They can be 42 | # extensions coming with Sphinx (named 'sphinx.ext.*') or your custom ones. 43 | extensions = [ 44 | "sphinx.ext.autodoc", 45 | "sphinx.ext.autosummary", 46 | "sphinx.ext.mathjax", 47 | "sphinx.ext.todo", 48 | "numpydoc", 49 | "sphinx.ext.viewcode", 50 | "sphinx.ext.extlinks", 51 | "sphinx.ext.napoleon", 52 | "sphinx.ext.intersphinx", 53 | "IPython.sphinxext.ipython_directive", 54 | "IPython.sphinxext.ipython_console_highlighting", 55 | ] 56 | 57 | extlinks = { 58 | "issue": ("https://github.com/brews/dalia/issues/%s", "GH #"), 59 | "pull": ("https://github.com/brews/dalia/pull/%s", "PR #"), 60 | } 61 | 62 | 63 | autosummary_generate = True 64 | autodoc_typehints = "none" 65 | 66 | napoleon_use_param = True 67 | napoleon_use_rtype = True 68 | 69 | numpydoc_class_members_toctree = True 70 | numpydoc_show_class_members = False 71 | 72 | 73 | # Add any paths that contain templates here, relative to this directory. 74 | templates_path = ["_templates"] 75 | 76 | # The suffix of source filenames. 77 | source_suffix = ".rst" 78 | 79 | # The encoding of source files. 80 | # source_encoding = 'utf-8-sig' 81 | 82 | # The master toctree document. 83 | master_doc = "index" 84 | 85 | # General information about the project. 86 | project = u"dalia" 87 | copyright = u"2019, ClimateImpactLab" 88 | 89 | # The version info for the project you're documenting, acts as replacement 90 | # for |version| and |release|, also used in various other places throughout 91 | # the built documents. 92 | # 93 | # The short X.Y version. 94 | version = dalia.__version__ 95 | # The full version, including alpha/beta/rc tags. 96 | release = dalia.__version__ 97 | 98 | # The language for content autogenerated by Sphinx. Refer to documentation 99 | # for a list of supported languages. 100 | # language = None 101 | 102 | # There are two options for replacing |today|: either, you set today to 103 | # some non-false value, then it is used: 104 | # today = '' 105 | # Else, today_fmt is used as the format for a strftime call. 106 | # today_fmt = '%B %d, %Y' 107 | 108 | # List of patterns, relative to source directory, that match files and 109 | # directories to ignore when looking for source files. 110 | exclude_patterns = ["_build"] 111 | 112 | # The reST default role (used for this markup: `text`) to use for all 113 | # documents. 114 | # default_role = None 115 | 116 | # If true, '()' will be appended to :func: etc. cross-reference text. 117 | # add_function_parentheses = True 118 | 119 | # If true, the current module name will be prepended to all description 120 | # unit titles (such as .. function::). 121 | # add_module_names = True 122 | 123 | # If true, sectionauthor and moduleauthor directives will be shown in the 124 | # output. They are ignored by default. 125 | # show_authors = False 126 | 127 | # The name of the Pygments (syntax highlighting) style to use. 128 | pygments_style = "sphinx" 129 | 130 | # A list of ignored prefixes for module index sorting. 131 | # modindex_common_prefix = [] 132 | 133 | # If true, keep warnings as "system message" paragraphs in the built 134 | # documents. 135 | # keep_warnings = False 136 | 137 | 138 | # -- Options for HTML output ------------------------------------------- 139 | 140 | # The theme to use for HTML and HTML Help pages. See the documentation for 141 | # a list of builtin themes. 142 | html_theme = "sphinx_rtd_theme" 143 | 144 | # Theme options are theme-specific and customize the look and feel of a 145 | # theme further. For a list of options available for each theme, see the 146 | # documentation. 147 | # html_theme_options = {} 148 | 149 | # Add any paths that contain custom themes here, relative to this directory. 150 | # html_theme_path = [] 151 | 152 | # The name for this set of Sphinx documents. If None, it defaults to 153 | # " v documentation". 154 | # html_title = None 155 | 156 | # A shorter title for the navigation bar. Default is the same as 157 | # html_title. 158 | # html_short_title = None 159 | 160 | # The name of an image file (relative to this directory) to place at the 161 | # top of the sidebar. 162 | # html_logo = None 163 | 164 | # The name of an image file (within the static path) to use as favicon 165 | # of the docs. This file should be a Windows icon file (.ico) being 166 | # 16x16 or 32x32 pixels large. 167 | # html_favicon = None 168 | 169 | # Add any paths that contain custom static files (such as style sheets) 170 | # here, relative to this directory. They are copied after the builtin 171 | # static files, so a file named "default.css" will overwrite the builtin 172 | # "default.css". 173 | # html_static_path = ['_static'] 174 | html_static_path = [] 175 | 176 | # If not '', a 'Last updated on:' timestamp is inserted at every page 177 | # bottom, using the given strftime format. 178 | # html_last_updated_fmt = '%b %d, %Y' 179 | 180 | # If true, SmartyPants will be used to convert quotes and dashes to 181 | # typographically correct entities. 182 | # html_use_smartypants = True 183 | 184 | # Custom sidebar templates, maps document names to template names. 185 | # html_sidebars = {} 186 | 187 | # Additional templates that should be rendered to pages, maps page names 188 | # to template names. 189 | # html_additional_pages = {} 190 | 191 | # If false, no module index is generated. 192 | # html_domain_indices = True 193 | 194 | # If false, no index is generated. 195 | # html_use_index = True 196 | 197 | # If true, the index is split into individual pages for each letter. 198 | # html_split_index = False 199 | 200 | # If true, links to the reST sources are added to the pages. 201 | # html_show_sourcelink = True 202 | 203 | # If true, "Created using Sphinx" is shown in the HTML footer. 204 | # Default is True. 205 | # html_show_sphinx = True 206 | 207 | # If true, "(C) Copyright ..." is shown in the HTML footer. 208 | # Default is True. 209 | # html_show_copyright = True 210 | 211 | # If true, an OpenSearch description file will be output, and all pages 212 | # will contain a tag referring to it. The value of this option 213 | # must be the base URL from which the finished HTML is served. 214 | # html_use_opensearch = '' 215 | 216 | # This is the file name suffix for HTML files (e.g. ".xhtml"). 217 | # html_file_suffix = None 218 | 219 | # Output file base name for HTML help builder. 220 | htmlhelp_basename = "daliadoc" 221 | 222 | 223 | # -- Options for LaTeX output ------------------------------------------ 224 | 225 | latex_elements = { 226 | # The paper size ('letterpaper' or 'a4paper'). 227 | #'papersize': 'letterpaper', 228 | # The font size ('10pt', '11pt' or '12pt'). 229 | #'pointsize': '10pt', 230 | # Additional stuff for the LaTeX preamble. 231 | #'preamble': '', 232 | } 233 | 234 | # Grouping the document tree into LaTeX files. List of tuples 235 | # (source start file, target name, title, author, documentclass 236 | # [howto/manual]). 237 | latex_documents = [ 238 | ("index", "dalia.tex", u"dalia Documentation", u"ClimateImpactLab", "manual"), 239 | ] 240 | 241 | # The name of an image file (relative to this directory) to place at 242 | # the top of the title page. 243 | # latex_logo = None 244 | 245 | # For "manual" documents, if this is true, then toplevel headings 246 | # are parts, not chapters. 247 | # latex_use_parts = False 248 | 249 | # If true, show page references after internal links. 250 | # latex_show_pagerefs = False 251 | 252 | # If true, show URL addresses after external links. 253 | # latex_show_urls = False 254 | 255 | # Documents to append as an appendix to all manuals. 256 | # latex_appendices = [] 257 | 258 | # If false, no module index is generated. 259 | # latex_domain_indices = True 260 | 261 | 262 | # -- Options for manual page output ------------------------------------ 263 | 264 | # One entry per manual page. List of tuples 265 | # (source start file, name, description, authors, manual section). 266 | man_pages = [("index", "dalia", u"dalia Documentation", [u"ClimateImpactLab"], 1)] 267 | 268 | # If true, show URL addresses after external links. 269 | # man_show_urls = False 270 | 271 | 272 | # -- Options for Texinfo output ---------------------------------------- 273 | 274 | # Grouping the document tree into Texinfo files. List of tuples 275 | # (source start file, target name, title, author, 276 | # dir menu entry, description, category) 277 | texinfo_documents = [ 278 | ( 279 | "index", 280 | "dalia", 281 | u"dalia Documentation", 282 | u"ClimateImpactLab", 283 | "dalia", 284 | "One line description of project.", 285 | "Miscellaneous", 286 | ), 287 | ] 288 | 289 | # Documents to append as an appendix to all manuals. 290 | # texinfo_appendices = [] 291 | 292 | # If false, no module index is generated. 293 | # texinfo_domain_indices = True 294 | 295 | # How to display URL addresses: 'footnote', 'no', or 'inline'. 296 | # texinfo_show_urls = 'footnote' 297 | 298 | # If true, do not generate a @detailmenu in the "Top" node's menu. 299 | # texinfo_no_detailmenu = False 300 | 301 | 302 | intersphinx_mapping = { 303 | "python": ("https://docs.python.org/3/", None), 304 | "pandas": ("https://pandas.pydata.org/pandas-docs/stable/", None), 305 | "numpy": ("https://docs.scipy.org/doc/numpy/", None), 306 | "numba": ("https://numba.pydata.org/numba-doc/latest/", None), 307 | "matplotlib": ("https://matplotlib.org/", None), 308 | "xarray": ("https://xarray.pydata.org/en/stable/", None), 309 | } 310 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | Apache License 2 | Version 2.0, January 2004 3 | http://www.apache.org/licenses/ 4 | 5 | TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION 6 | 7 | 1. Definitions. 8 | 9 | "License" shall mean the terms and conditions for use, reproduction, 10 | and distribution as defined by Sections 1 through 9 of this document. 11 | 12 | "Licensor" shall mean the copyright owner or entity authorized by 13 | the copyright owner that is granting the License. 14 | 15 | "Legal Entity" shall mean the union of the acting entity and all 16 | other entities that control, are controlled by, or are under common 17 | control with that entity. For the purposes of this definition, 18 | "control" means (i) the power, direct or indirect, to cause the 19 | direction or management of such entity, whether by contract or 20 | otherwise, or (ii) ownership of fifty percent (50%) or more of the 21 | outstanding shares, or (iii) beneficial ownership of such entity. 22 | 23 | "You" (or "Your") shall mean an individual or Legal Entity 24 | exercising permissions granted by this License. 25 | 26 | "Source" form shall mean the preferred form for making modifications, 27 | including but not limited to software source code, documentation 28 | source, and configuration files. 29 | 30 | "Object" form shall mean any form resulting from mechanical 31 | transformation or translation of a Source form, including but 32 | not limited to compiled object code, generated documentation, 33 | and conversions to other media types. 34 | 35 | "Work" shall mean the work of authorship, whether in Source or 36 | Object form, made available under the License, as indicated by a 37 | copyright notice that is included in or attached to the work 38 | (an example is provided in the Appendix below). 39 | 40 | "Derivative Works" shall mean any work, whether in Source or Object 41 | form, that is based on (or derived from) the Work and for which the 42 | editorial revisions, annotations, elaborations, or other modifications 43 | represent, as a whole, an original work of authorship. For the purposes 44 | of this License, Derivative Works shall not include works that remain 45 | separable from, or merely link (or bind by name) to the interfaces of, 46 | the Work and Derivative Works thereof. 47 | 48 | "Contribution" shall mean any work of authorship, including 49 | the original version of the Work and any modifications or additions 50 | to that Work or Derivative Works thereof, that is intentionally 51 | submitted to Licensor for inclusion in the Work by the copyright owner 52 | or by an individual or Legal Entity authorized to submit on behalf of 53 | the copyright owner. For the purposes of this definition, "submitted" 54 | means any form of electronic, verbal, or written communication sent 55 | to the Licensor or its representatives, including but not limited to 56 | communication on electronic mailing lists, source code control systems, 57 | and issue tracking systems that are managed by, or on behalf of, the 58 | Licensor for the purpose of discussing and improving the Work, but 59 | excluding communication that is conspicuously marked or otherwise 60 | designated in writing by the copyright owner as "Not a Contribution." 61 | 62 | "Contributor" shall mean Licensor and any individual or Legal Entity 63 | on behalf of whom a Contribution has been received by Licensor and 64 | subsequently incorporated within the Work. 65 | 66 | 2. Grant of Copyright License. Subject to the terms and conditions of 67 | this License, each Contributor hereby grants to You a perpetual, 68 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable 69 | copyright license to reproduce, prepare Derivative Works of, 70 | publicly display, publicly perform, sublicense, and distribute the 71 | Work and such Derivative Works in Source or Object form. 72 | 73 | 3. Grant of Patent License. Subject to the terms and conditions of 74 | this License, each Contributor hereby grants to You a perpetual, 75 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable 76 | (except as stated in this section) patent license to make, have made, 77 | use, offer to sell, sell, import, and otherwise transfer the Work, 78 | where such license applies only to those patent claims licensable 79 | by such Contributor that are necessarily infringed by their 80 | Contribution(s) alone or by combination of their Contribution(s) 81 | with the Work to which such Contribution(s) was submitted. If You 82 | institute patent litigation against any entity (including a 83 | cross-claim or counterclaim in a lawsuit) alleging that the Work 84 | or a Contribution incorporated within the Work constitutes direct 85 | or contributory patent infringement, then any patent licenses 86 | granted to You under this License for that Work shall terminate 87 | as of the date such litigation is filed. 88 | 89 | 4. Redistribution. You may reproduce and distribute copies of the 90 | Work or Derivative Works thereof in any medium, with or without 91 | modifications, and in Source or Object form, provided that You 92 | meet the following conditions: 93 | 94 | (a) You must give any other recipients of the Work or 95 | Derivative Works a copy of this License; and 96 | 97 | (b) You must cause any modified files to carry prominent notices 98 | stating that You changed the files; and 99 | 100 | (c) You must retain, in the Source form of any Derivative Works 101 | that You distribute, all copyright, patent, trademark, and 102 | attribution notices from the Source form of the Work, 103 | excluding those notices that do not pertain to any part of 104 | the Derivative Works; and 105 | 106 | (d) If the Work includes a "NOTICE" text file as part of its 107 | distribution, then any Derivative Works that You distribute must 108 | include a readable copy of the attribution notices contained 109 | within such NOTICE file, excluding those notices that do not 110 | pertain to any part of the Derivative Works, in at least one 111 | of the following places: within a NOTICE text file distributed 112 | as part of the Derivative Works; within the Source form or 113 | documentation, if provided along with the Derivative Works; or, 114 | within a display generated by the Derivative Works, if and 115 | wherever such third-party notices normally appear. The contents 116 | of the NOTICE file are for informational purposes only and 117 | do not modify the License. You may add Your own attribution 118 | notices within Derivative Works that You distribute, alongside 119 | or as an addendum to the NOTICE text from the Work, provided 120 | that such additional attribution notices cannot be construed 121 | as modifying the License. 122 | 123 | You may add Your own copyright statement to Your modifications and 124 | may provide additional or different license terms and conditions 125 | for use, reproduction, or distribution of Your modifications, or 126 | for any such Derivative Works as a whole, provided Your use, 127 | reproduction, and distribution of the Work otherwise complies with 128 | the conditions stated in this License. 129 | 130 | 5. Submission of Contributions. Unless You explicitly state otherwise, 131 | any Contribution intentionally submitted for inclusion in the Work 132 | by You to the Licensor shall be under the terms and conditions of 133 | this License, without any additional terms or conditions. 134 | Notwithstanding the above, nothing herein shall supersede or modify 135 | the terms of any separate license agreement you may have executed 136 | with Licensor regarding such Contributions. 137 | 138 | 6. Trademarks. This License does not grant permission to use the trade 139 | names, trademarks, service marks, or product names of the Licensor, 140 | except as required for reasonable and customary use in describing the 141 | origin of the Work and reproducing the content of the NOTICE file. 142 | 143 | 7. Disclaimer of Warranty. Unless required by applicable law or 144 | agreed to in writing, Licensor provides the Work (and each 145 | Contributor provides its Contributions) on an "AS IS" BASIS, 146 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or 147 | implied, including, without limitation, any warranties or conditions 148 | of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A 149 | PARTICULAR PURPOSE. You are solely responsible for determining the 150 | appropriateness of using or redistributing the Work and assume any 151 | risks associated with Your exercise of permissions under this License. 152 | 153 | 8. Limitation of Liability. In no event and under no legal theory, 154 | whether in tort (including negligence), contract, or otherwise, 155 | unless required by applicable law (such as deliberate and grossly 156 | negligent acts) or agreed to in writing, shall any Contributor be 157 | liable to You for damages, including any direct, indirect, special, 158 | incidental, or consequential damages of any character arising as a 159 | result of this License or out of the use or inability to use the 160 | Work (including but not limited to damages for loss of goodwill, 161 | work stoppage, computer failure or malfunction, or any and all 162 | other commercial damages or losses), even if such Contributor 163 | has been advised of the possibility of such damages. 164 | 165 | 9. Accepting Warranty or Additional Liability. While redistributing 166 | the Work or Derivative Works thereof, You may choose to offer, 167 | and charge a fee for, acceptance of support, warranty, indemnity, 168 | or other liability obligations and/or rights consistent with this 169 | License. However, in accepting such obligations, You may act only 170 | on Your own behalf and on Your sole responsibility, not on behalf 171 | of any other Contributor, and only if You agree to indemnify, 172 | defend, and hold each Contributor harmless for any liability 173 | incurred by, or claims asserted against, such Contributor by reason 174 | of your accepting any such warranty or additional liability. 175 | 176 | END OF TERMS AND CONDITIONS 177 | 178 | APPENDIX: How to apply the Apache License to your work. 179 | 180 | To apply the Apache License to your work, attach the following 181 | boilerplate notice, with the fields enclosed by brackets "[]" 182 | replaced with your own identifying information. (Don't include 183 | the brackets!) The text should be enclosed in the appropriate 184 | comment syntax for the file format. We also recommend that a 185 | file or class name and description of purpose be included on the 186 | same "printed page" as the copyright notice for easier 187 | identification within third-party archives. 188 | 189 | Copyright [yyyy] [name of copyright owner] 190 | 191 | Licensed under the Apache License, Version 2.0 (the "License"); 192 | you may not use this file except in compliance with the License. 193 | You may obtain a copy of the License at 194 | 195 | http://www.apache.org/licenses/LICENSE-2.0 196 | 197 | Unless required by applicable law or agreed to in writing, software 198 | distributed under the License is distributed on an "AS IS" BASIS, 199 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 200 | See the License for the specific language governing permissions and 201 | limitations under the License. 202 | --------------------------------------------------------------------------------