diff --git a/.buildinfo b/.buildinfo new file mode 100644 index 0000000..354a6e6 --- /dev/null +++ b/.buildinfo @@ -0,0 +1,4 @@ +# Sphinx build info version 1 +# This file records the configuration used when building these files. When it is not found, a full rebuild will be done. +config: 51e410b3f95cb2f7c3417117dec7e2c3 +tags: 645f666f9bcd5a90fca523b33c5a78b7 diff --git a/.coveragerc b/.coveragerc deleted file mode 100644 index 4f7d564..0000000 --- a/.coveragerc +++ /dev/null @@ -1,28 +0,0 @@ -# .coveragerc to control coverage.py -[run] -branch = True -source = delayedarray -# omit = bad_file.py - -[paths] -source = - src/ - */site-packages/ - -[report] -# Regexes for lines to exclude from consideration -exclude_lines = - # Have to re-enable the standard pragma - pragma: no cover - - # Don't complain about missing debug-only code: - def __repr__ - if self\.debug - - # Don't complain if tests don't hit defensive assertion code: - raise AssertionError - raise NotImplementedError - - # Don't complain if non-runnable code isn't run: - if 0: - if __name__ == .__main__.: diff --git a/.github/workflows/pypi-publish.yml b/.github/workflows/pypi-publish.yml deleted file mode 100644 index d77c711..0000000 --- a/.github/workflows/pypi-publish.yml +++ /dev/null @@ -1,60 +0,0 @@ -# This workflow will install Python dependencies, run tests and lint with a single version of Python -# For more information see: https://help.github.com/actions/language-and-framework-guides/using-python-with-github-actions - -name: Publish to PyPI - -on: - push: - tags: "*" - -permissions: - contents: write # Required to publish docs - id-token: write # Required for OIDC - -jobs: - build: - runs-on: ubuntu-latest - - steps: - - uses: actions/checkout@v4 - - - name: Set up Python - uses: actions/setup-python@v6 - with: - python-version: 3.14 - - - name: Install dependencies - run: | - python -m pip install --upgrade pip - pip install flake8 pytest tox - - # - name: Lint with flake8 - # run: | - # # stop the build if there are Python syntax errors or undefined names - # flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics - # # exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide - # # flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics - - - name: Test with tox - run: | - tox - - - name: Build docs - run: | - tox -e docs - - - run: touch ./docs/_build/html/.nojekyll - - - name: GH Pages Deployment - uses: JamesIves/github-pages-deploy-action@v4 - with: - branch: gh-pages # The branch the action should deploy to. - folder: ./docs/_build/html - clean: true # Automatically remove deleted files from the deploy branch - - - name: Build Project and Publish - run: | - python -m tox -e clean,build - - - name: Publish package - uses: pypa/gh-action-pypi-publish@release/v1 diff --git a/.github/workflows/pypi-test.yml b/.github/workflows/pypi-test.yml deleted file mode 100644 index 5d0dfb5..0000000 --- a/.github/workflows/pypi-test.yml +++ /dev/null @@ -1,40 +0,0 @@ -name: Unit tests - -on: - push: - branches: [ master ] - pull_request: - branches: [ master ] - -jobs: - build: - - runs-on: ubuntu-latest - strategy: - matrix: - python-version: [ '3.10', '3.11', '3.12', '3.13', '3.14' ] - - name: Python ${{ matrix.python-version }} - steps: - - uses: actions/checkout@v4 - - - name: Setup Python - uses: actions/setup-python@v6 - with: - python-version: ${{ matrix.python-version }} - cache: 'pip' - - - name: Install dependencies - run: | - python -m pip install --upgrade pip - pip install flake8 pytest tox - # - name: Lint with flake8 - # run: | - # # stop the build if there are Python syntax errors or undefined names - # flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics - # # exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide - # # flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics - - - name: Test with tox - run: | - tox diff --git a/.gitignore b/.gitignore deleted file mode 100644 index e9e1e9b..0000000 --- a/.gitignore +++ /dev/null @@ -1,54 +0,0 @@ -# Temporary and binary files -*~ -*.py[cod] -*.so -*.cfg -!.isort.cfg -!setup.cfg -*.orig -*.log -*.pot -__pycache__/* -.cache/* -.*.swp -*/.ipynb_checkpoints/* -.DS_Store - -# Project files -.ropeproject -.project -.pydevproject -.settings -.idea -.vscode -tags - -# Package files -*.egg -*.eggs/ -.installed.cfg -*.egg-info - -# Unittest and coverage -htmlcov/* -.coverage -.coverage.* -.tox -junit*.xml -coverage.xml -.pytest_cache/ - -# Build and docs folder/files -build/* -dist/* -sdist/* -docs/api/* -docs/_rst/* -docs/_build/* -cover/* -MANIFEST - -# Per-project virtualenvs -.venv*/ -.conda*/ -.python-version diff --git a/.nojekyll b/.nojekyll new file mode 100644 index 0000000..e69de29 diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml deleted file mode 100644 index e60a5f4..0000000 --- a/.pre-commit-config.yaml +++ /dev/null @@ -1,53 +0,0 @@ -exclude: '^docs/conf.py' - -repos: -- repo: https://github.com/pre-commit/pre-commit-hooks - rev: v4.6.0 - hooks: - - id: trailing-whitespace - - id: check-added-large-files - - id: check-ast - - id: check-json - - id: check-merge-conflict - - id: check-xml - - id: check-yaml - - id: debug-statements - - id: end-of-file-fixer - - id: requirements-txt-fixer - - id: mixed-line-ending - args: ['--fix=auto'] # replace 'auto' with 'lf' to enforce Linux/Mac line endings or 'crlf' for Windows - -# - repo: https://github.com/PyCQA/docformatter -# rev: master -# hooks: -# - id: docformatter -# additional_dependencies: [tomli] -# args: [--in-place, --wrap-descriptions=120, --wrap-summaries=120] -# # --config, ./pyproject.toml - -# - repo: https://github.com/psf/black -# rev: 24.8.0 -# hooks: -# - id: black -# language_version: python3 - -- repo: https://github.com/astral-sh/ruff-pre-commit - # Ruff version. - rev: v0.6.8 - hooks: - - id: ruff - args: [--fix, --exit-non-zero-on-fix] - - id: ruff-format - -## If like to embrace black styles even in the docs: -# - repo: https://github.com/asottile/blacken-docs -# rev: v1.13.0 -# hooks: -# - id: blacken-docs -# additional_dependencies: [black] - -## Check for misspells in documentation files: -# - repo: https://github.com/codespell-project/codespell -# rev: v2.2.5 -# hooks: -# - id: codespell diff --git a/.readthedocs.yml b/.readthedocs.yml deleted file mode 100644 index a2bcab3..0000000 --- a/.readthedocs.yml +++ /dev/null @@ -1,27 +0,0 @@ -# Read the Docs configuration file -# See https://docs.readthedocs.io/en/stable/config-file/v2.html for details - -# Required -version: 2 - -# Build documentation in the docs/ directory with Sphinx -sphinx: - configuration: docs/conf.py - -# Build documentation with MkDocs -#mkdocs: -# configuration: mkdocs.yml - -# Optionally build your docs in additional formats such as PDF -formats: - - pdf - -build: - os: ubuntu-22.04 - tools: - python: "3.11" - -python: - install: - - requirements: docs/requirements.txt - - {path: ., method: pip} diff --git a/AUTHORS.md b/AUTHORS.md deleted file mode 100644 index 281a44d..0000000 --- a/AUTHORS.md +++ /dev/null @@ -1,4 +0,0 @@ -# Contributors - -* Aaron Lun [infinite.monkeys.with.keyboards@gmail.com](mailto:infinite.monkeys.with.keyboards@gmail.com) -* Jayaram Kancherla [jayaram.kancherla@gmail.com](mailto:jayaram.kancherla@gmail.com) diff --git a/CHANGELOG.md b/CHANGELOG.md deleted file mode 100644 index bfc9fc9..0000000 --- a/CHANGELOG.md +++ /dev/null @@ -1,92 +0,0 @@ -# Changelog - -## Version 0.6.2 - -- Centralized the choice of default buffer size in the `default_buffer_size()` function. - -## Version 0.6.1 - -- Support single-integer slicing for `DelayedArray`s and `SparseNdArray`s. -- Silence NumPy warnings about numerical operations with zero. -- Collapse repeated operations to remove redundant delayed layers. - -## Version 0.6.0 - -- chore: Remove Python 3.8 (EOL). -- precommit: Replace docformatter with ruff's formatter. - -## Version 0.5.3 - -- Coerce `numpy.generic` instances to `dtype` in the `SparseNdarray` constructor, for consistency with NumPy functions. -- Avoid cast to float when operating on uint64 indices in a `SparseNdarray`. - -## Version 0.5.2 - -- Support `dtype=` and `copy=` arguments in `__array__()`, as required by NumPy v2. -- Added getters for the `RegularTick` properties, for convenience. - -## Version 0.5.1 - -- Add support for more numpy functions to dense and sparse `DelayedArrays`. - -## Version 0.5.0 - -- Switch to `Grid` classes to control how iteration is performed. This supercedes the previous `chunk_shape()` generic. - -## Version 0.4.0 - -- Added a `buffer_size=` option to the `apply*` functions. -- Provide converter generics to SciPy classes, with methods for `SparseNdarray` and sparse `DelayedArray`s. -- Converted th `to_*_array()` functions into generics. -- Correctly handle zero-extent arrays in the `apply*` functions. -- Added methods to compute basic statistics (e.g., sum, variance) from a `SparseNdarray`. -- Added a copy method for `SparseNdarray`. -- Use block processing to compute basic statistics from a `DelayedArray`. -- Do not require Fortran storage order from `extract_dense_array()`. -- The `subset=` argument is now mandatory in `extract_*_array()` calls. -- Bugfix to respect changes in index dtype upon `SparseNdarray` concatenation. - -## Version 0.3.5 - -- Support masking throughout the various operations and methods. - -## Version 0.3.4 - -- Fixes to maintain support for Python 3.8. - -## Version 0.3.3 - -- Support the delayed unary `logical_not` operation. -- Added utilities like `choose_block_shape_for_iteration()` and `apply_over_blocks()` to iterate over the dimensions or blocks. - -## Version 0.3.2 - -- Bugfix for row-wise combining of 2-dimensional `SparseNdarray`s. - -## Version 0.3.1 - -- Added a `wrap()` method that dispatches to different `DelayedArray` subclasses based on the seed. - -## Version 0.3.0 - -- Replace the `__DelayedArray` methods with generics, for easier extensibility to classes outside of our control. -- Restored the `SparseNdarray` class, to provide everyone with a consistent type during sparse operations. -- Adapted `extract_array()` into the `extract_dense_array()` generic, which now always returns a (Fortran-order) NumPy array. -- Added the `extract_sparse_array()` generic, which always returns a `SparseNdarray` object for sparse arrays. -- Added the `is_sparse()` generic, which determines whether an object is sparse. -- Minor fixes to the `repr()` method for `DelayedArray` objects. -- **scipy** is no longer required for installation but will be used if available. - -## Version 0.2.3 - -- Added a `chunk_shape()` generic to identify the "best" direction for iterating over the matrix. -- Added an easy way to compute iteration widths over the desired dimension. -- Corrected the reported `dtype` from a delayed `Cast`. - -## Version 0.0.3 - -- separate dense and sparse matrix classes - -## Version 0.0.1 - -- initial classes for H5 backed matrices diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md deleted file mode 100644 index 2118332..0000000 --- a/CONTRIBUTING.md +++ /dev/null @@ -1,371 +0,0 @@ -```{todo} THIS IS SUPPOSED TO BE AN EXAMPLE. MODIFY IT ACCORDING TO YOUR NEEDS! - - The document assumes you are using a source repository service that promotes a - contribution model similar to [GitHub's fork and pull request workflow]. - While this is true for the majority of services (like GitHub, GitLab, - BitBucket), it might not be the case for private repositories (e.g., when - using Gerrit). - - Also notice that the code examples might refer to GitHub URLs or the text - might use GitHub specific terminology (e.g., *Pull Request* instead of *Merge - Request*). - - Please make sure to check the document having these assumptions in mind - and update things accordingly. -``` - -```{todo} Provide the correct links/replacements at the bottom of the document. -``` - -```{todo} You might want to have a look on [PyScaffold's contributor's guide], - - especially if your project is open source. The text should be very similar to - this template, but there are a few extra contents that you might decide to - also include, like mentioning labels of your issue tracker or automated - releases. -``` - -# Contributing - -Welcome to `DelayedArray` contributor's guide. - -This document focuses on getting any potential contributor familiarized with -the development processes, but [other kinds of contributions] are also appreciated. - -If you are new to using [git] or have never collaborated in a project previously, -please have a look at [contribution-guide.org]. Other resources are also -listed in the excellent [guide created by FreeCodeCamp] [^contrib1]. - -Please notice, all users and contributors are expected to be **open, -considerate, reasonable, and respectful**. When in doubt, -[Python Software Foundation's Code of Conduct] is a good reference in terms of -behavior guidelines. - -## Issue Reports - -If you experience bugs or general issues with `DelayedArray`, please have a look -on the [issue tracker]. -If you don't see anything useful there, please feel free to fire an issue report. - -:::{tip} -Please don't forget to include the closed issues in your search. -Sometimes a solution was already reported, and the problem is considered -**solved**. -::: - -New issue reports should include information about your programming environment -(e.g., operating system, Python version) and steps to reproduce the problem. -Please try also to simplify the reproduction steps to a very minimal example -that still illustrates the problem you are facing. By removing other factors, -you help us to identify the root cause of the issue. - -## Documentation Improvements - -You can help improve `DelayedArray` docs by making them more readable and coherent, or -by adding missing information and correcting mistakes. - -`DelayedArray` documentation uses [Sphinx] as its main documentation compiler. -This means that the docs are kept in the same repository as the project code, and -that any documentation update is done in the same way was a code contribution. - -```{todo} Don't forget to mention which markup language you are using. - - e.g., [reStructuredText] or [CommonMark] with [MyST] extensions. -``` - -```{todo} If your project is hosted on GitHub, you can also mention the following tip: - - :::{tip} - Please notice that the [GitHub web interface] provides a quick way of - propose changes in `DelayedArray`'s files. While this mechanism can - be tricky for normal code contributions, it works perfectly fine for - contributing to the docs, and can be quite handy. - - If you are interested in trying this method out, please navigate to - the `docs` folder in the source [repository], find which file you - would like to propose changes and click in the little pencil icon at the - top, to open [GitHub's code editor]. Once you finish editing the file, - please write a message in the form at the bottom of the page describing - which changes have you made and what are the motivations behind them and - submit your proposal. - ::: -``` - -When working on documentation changes in your local machine, you can -compile them using [tox] : - -``` -tox -e docs -``` - -and use Python's built-in web server for a preview in your web browser -(`http://localhost:8000`): - -``` -python3 -m http.server --directory 'docs/_build/html' -``` - -## Code Contributions - -```{todo} Please include a reference or explanation about the internals of the project. - - An architecture description, design principles or at least a summary of the - main concepts will make it easy for potential contributors to get started - quickly. -``` - -### Submit an issue - -Before you work on any non-trivial code contribution it's best to first create -a report in the [issue tracker] to start a discussion on the subject. -This often provides additional considerations and avoids unnecessary work. - -### Create an environment - -Before you start coding, we recommend creating an isolated [virtual environment] -to avoid any problems with your installed Python packages. -This can easily be done via either [virtualenv]: - -``` -virtualenv -source /bin/activate -``` - -or [Miniconda]: - -``` -conda create -n DelayedArray python=3 six virtualenv pytest pytest-cov -conda activate DelayedArray -``` - -### Clone the repository - -1. Create an user account on GitHub if you do not already have one. - -2. Fork the project [repository]: click on the *Fork* button near the top of the - page. This creates a copy of the code under your account on GitHub. - -3. Clone this copy to your local disk: - - ``` - git clone git@github.com:YourLogin/DelayedArray.git - cd DelayedArray - ``` - -4. You should run: - - ``` - pip install -U pip setuptools -e . - ``` - - to be able to import the package under development in the Python REPL. - - ```{todo} if you are not using pre-commit, please remove the following item: - ``` - -5. Install [pre-commit]: - - ``` - pip install pre-commit - pre-commit install - ``` - - `DelayedArray` comes with a lot of hooks configured to automatically help the - developer to check the code being written. - -### Implement your changes - -1. Create a branch to hold your changes: - - ``` - git checkout -b my-feature - ``` - - and start making changes. Never work on the main branch! - -2. Start your work on this branch. Don't forget to add [docstrings] to new - functions, modules and classes, especially if they are part of public APIs. - -3. Add yourself to the list of contributors in `AUTHORS.rst`. - -4. When you’re done editing, do: - - ``` - git add - git commit - ``` - - to record your changes in [git]. - - ```{todo} if you are not using pre-commit, please remove the following item: - ``` - - Please make sure to see the validation messages from [pre-commit] and fix - any eventual issues. - This should automatically use [flake8]/[black] to check/fix the code style - in a way that is compatible with the project. - - :::{important} - Don't forget to add unit tests and documentation in case your - contribution adds an additional feature and is not just a bugfix. - - Moreover, writing a [descriptive commit message] is highly recommended. - In case of doubt, you can check the commit history with: - - ``` - git log --graph --decorate --pretty=oneline --abbrev-commit --all - ``` - - to look for recurring communication patterns. - ::: - -5. Please check that your changes don't break any unit tests with: - - ``` - tox - ``` - - (after having installed [tox] with `pip install tox` or `pipx`). - - You can also use [tox] to run several other pre-configured tasks in the - repository. Try `tox -av` to see a list of the available checks. - -### Submit your contribution - -1. If everything works fine, push your local branch to the remote server with: - - ``` - git push -u origin my-feature - ``` - -2. Go to the web page of your fork and click "Create pull request" - to send your changes for review. - - ```{todo} if you are using GitHub, you can uncomment the following paragraph - - Find more detailed information in [creating a PR]. You might also want to open - the PR as a draft first and mark it as ready for review after the feedbacks - from the continuous integration (CI) system or any required fixes. - - ``` - -### Troubleshooting - -The following tips can be used when facing problems to build or test the -package: - -1. Make sure to fetch all the tags from the upstream [repository]. - The command `git describe --abbrev=0 --tags` should return the version you - are expecting. If you are trying to run CI scripts in a fork repository, - make sure to push all the tags. - You can also try to remove all the egg files or the complete egg folder, i.e., - `.eggs`, as well as the `*.egg-info` folders in the `src` folder or - potentially in the root of your project. - -2. Sometimes [tox] misses out when new dependencies are added, especially to - `setup.cfg` and `docs/requirements.txt`. If you find any problems with - missing dependencies when running a command with [tox], try to recreate the - `tox` environment using the `-r` flag. For example, instead of: - - ``` - tox -e docs - ``` - - Try running: - - ``` - tox -r -e docs - ``` - -3. Make sure to have a reliable [tox] installation that uses the correct - Python version (e.g., 3.7+). When in doubt you can run: - - ``` - tox --version - # OR - which tox - ``` - - If you have trouble and are seeing weird errors upon running [tox], you can - also try to create a dedicated [virtual environment] with a [tox] binary - freshly installed. For example: - - ``` - virtualenv .venv - source .venv/bin/activate - .venv/bin/pip install tox - .venv/bin/tox -e all - ``` - -4. [Pytest can drop you] in an interactive session in the case an error occurs. - In order to do that you need to pass a `--pdb` option (for example by - running `tox -- -k --pdb`). - You can also setup breakpoints manually instead of using the `--pdb` option. - -## Maintainer tasks - -### Releases - -```{todo} This section assumes you are using PyPI to publicly release your package. - - If instead you are using a different/private package index, please update - the instructions accordingly. -``` - -If you are part of the group of maintainers and have correct user permissions -on [PyPI], the following steps can be used to release a new version for -`DelayedArray`: - -1. Make sure all unit tests are successful. -2. Tag the current commit on the main branch with a release tag, e.g., `v1.2.3`. -3. Push the new tag to the upstream [repository], - e.g., `git push upstream v1.2.3` -4. Clean up the `dist` and `build` folders with `tox -e clean` - (or `rm -rf dist build`) - to avoid confusion with old builds and Sphinx docs. -5. Run `tox -e build` and check that the files in `dist` have - the correct version (no `.dirty` or [git] hash) according to the [git] tag. - Also check the sizes of the distributions, if they are too big (e.g., > - 500KB), unwanted clutter may have been accidentally included. -6. Run `tox -e publish -- --repository pypi` and check that everything was - uploaded to [PyPI] correctly. - -[^contrib1]: Even though, these resources focus on open source projects and - communities, the general ideas behind collaborating with other developers - to collectively create software are general and can be applied to all sorts - of environments, including private companies and proprietary code bases. - - -[black]: https://pypi.org/project/black/ -[commonmark]: https://commonmark.org/ -[contribution-guide.org]: http://www.contribution-guide.org/ -[creating a pr]: https://docs.github.com/en/pull-requests/collaborating-with-pull-requests/proposing-changes-to-your-work-with-pull-requests/creating-a-pull-request -[descriptive commit message]: https://chris.beams.io/posts/git-commit -[docstrings]: https://www.sphinx-doc.org/en/master/usage/extensions/napoleon.html -[first-contributions tutorial]: https://github.com/firstcontributions/first-contributions -[flake8]: https://flake8.pycqa.org/en/stable/ -[git]: https://git-scm.com -[github web interface]: https://docs.github.com/en/github/managing-files-in-a-repository/managing-files-on-github/editing-files-in-your-repository -[github's code editor]: https://docs.github.com/en/github/managing-files-in-a-repository/managing-files-on-github/editing-files-in-your-repository -[github's fork and pull request workflow]: https://guides.github.com/activities/forking/ -[guide created by freecodecamp]: https://github.com/freecodecamp/how-to-contribute-to-open-source -[miniconda]: https://docs.conda.io/en/latest/miniconda.html -[myst]: https://myst-parser.readthedocs.io/en/latest/syntax/syntax.html -[other kinds of contributions]: https://opensource.guide/how-to-contribute -[pre-commit]: https://pre-commit.com/ -[pypi]: https://pypi.org/ -[pyscaffold's contributor's guide]: https://pyscaffold.org/en/stable/contributing.html -[pytest can drop you]: https://docs.pytest.org/en/stable/usage.html#dropping-to-pdb-python-debugger-at-the-start-of-a-test -[python software foundation's code of conduct]: https://www.python.org/psf/conduct/ -[restructuredtext]: https://www.sphinx-doc.org/en/master/usage/restructuredtext/ -[sphinx]: https://www.sphinx-doc.org/en/master/ -[tox]: https://tox.readthedocs.io/en/stable/ -[virtual environment]: https://realpython.com/python-virtual-environments-a-primer/ -[virtualenv]: https://virtualenv.pypa.io/en/stable/ - - -```{todo} Please review and change the following definitions: -``` - -[repository]: https://github.com//DelayedArray -[issue tracker]: https://github.com//DelayedArray/issues diff --git a/LICENSE.txt b/LICENSE.txt deleted file mode 100644 index fd54984..0000000 --- a/LICENSE.txt +++ /dev/null @@ -1,21 +0,0 @@ -The MIT License (MIT) - -Copyright (c) 2023 Aaron Lun - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in all -copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -SOFTWARE. diff --git a/README.md b/README.md deleted file mode 100644 index c4c82ab..0000000 --- a/README.md +++ /dev/null @@ -1,287 +0,0 @@ - - -[![Project generated with PyScaffold](https://img.shields.io/badge/-PyScaffold-005CA0?logo=pyscaffold)](https://pyscaffold.org/) -[![PyPI-Server](https://img.shields.io/pypi/v/DelayedArray.svg)](https://pypi.org/project/DelayedArray/) -[![Monthly Downloads](https://pepy.tech/badge/DelayedArray/month)](https://pepy.tech/project/DelayedArray) -![Unit tests](https://github.com/BiocPy/DelayedArray/actions/workflows/pypi-test.yml/badge.svg) - -# DelayedArrays, in Python - -## Introduction - -This package implements classes for delayed array operations, mirroring the [Bioconductor package](https://bioconductor.org/packages/DelayedArray) of the same name. -It allows BiocPy-based packages to easily inteoperate with delayed arrays from the Bioconductor ecosystem, -with focus on serialization to/from file with [**chihaya**](https://github.com/ArtifactDB/chihaya)/[**rds2py**](https://github.com/BiocPy/rds2py) -and entry into [**tatami**](https://github.com/tatami-inc/tatami)-compatible C++ libraries via [**mattress**](https://github.com/BiocPy/mattress). - -## Quick start - -This package is published to [PyPI](https://pypi.org/project/delayedarray/) and can be installed via the usual methods: - -```shell -pip install delayedarray -``` - -We can create a `DelayedArray` from any object that respects the seed contract, -i.e., has the `shape`/`dtype` properties and supports NumPy slicing. -For example, a typical NumPy array qualifies: - -```python -import numpy -x = numpy.random.rand(100, 20) -``` - -We can wrap this in a `DelayedArray` class: - -```python -import delayedarray -d = delayedarray.wrap(x) -## <100 x 20> DelayedArray object of type 'float64' -## [[0.58969193, 0.36342181, 0.03111773, ..., 0.72036247, 0.40297173, -## 0.48654955], -## [0.96346008, 0.57956493, 0.24247029, ..., 0.49717933, 0.589535 , -## 0.22806832], -## [0.61699438, 0.02493104, 0.87487081, ..., 0.44039656, 0.13967301, -## 0.57966883], -## ..., -## [0.91583856, 0.94079754, 0.47546576, ..., 0.46866948, 0.87952439, -## 0.81316896], -## [0.68721591, 0.22789395, 0.51079888, ..., 0.86483248, 0.43933065, -## 0.84304794], -## [0.47763457, 0.54973367, 0.01159327, ..., 0.47338943, 0.86443755, -## 0.2047926 ]] -``` - -And then we can use it in a variety of operations. -For example, in genomics, a typical quality control task is to slice the matrix to remove uninteresting features (rows) or samples (columns): - -```python -filtered = d[1:100:2,1:8] -filtered.shape -## (50, 7) -``` - -We then divide by the total sum of each column to compute normalized values between samples. - -```python -total = filtered.sum(axis=0) -normalized = filtered / total -normalized.dtype -## dtype('float64') -``` - -And finally we compute a log-transformation to get some log-normalized values for visualization. - -```python -transformed = numpy.log1p(normalized) -transformed[1:5,:] -## <4 x 7> DelayedArray object of type 'float64' -## [[0.03202309, 0.03256592, 0.02281872, ..., 0.03193778, 0.01735653, -## 0.02323571], -## [0.02668759, 0.0152978 , 0.03818753, ..., 0.00280113, 0.00737041, -## 0.00852137], -## [0.02125275, 0.01473594, 0.01299548, ..., 0.03092256, 0.01225808, -## 0.0030042 ], -## [0.02334768, 0.00499055, 0.01804982, ..., 0.00467121, 0.02921965, -## 0.02118322]] -``` - -Each operation just returns a `DelayedArray` with an increasing stack of delayed operations, without evaluating anything or making any copies. -Check out the [documentation](https://biocpy.github.io/DelayedArray/) for more information. - -## Extracting data - -### Block processing - -A `DelayedArray` is typically used by iteratively extracting blocks into memory for further calculations. -This "block processing" strategy improves memory efficiency by only realizing the delayed operations for a subset of the data. -For example, to iterate over the rows with 100 MB blocks: - -```python -block_size = delayedarray.choose_block_size_for_1d_iteration(d, dimension=0, memory=1e8) -block_coords = [ None, range(d.shape[1]) ] - -for start in range(0, d.shape[0], block_size): - end = min(d.shape[0], start + block_size) - block_coords[0] = range(start, end) - current = delayedarray.extract_dense_array(d, (*block_coords,)) -``` - -Each call to `extract_dense_array()` yields a NumPy array containing the the specified rows and columns. -If the `DelayedArray` might contain masked values, a NumPy `MaskedArray` is returned instead; -this can be determined by checking whether `is_masked(d)` returns `True`. - -The above iteration can be simplified with the `apply_over_dimension()` function, which handles the block coordinate calculations for us. -We could also use the `apply_over_blocks()` function to iterate over arbitrary block shapes, which may be more efficient if the best dimension for iteration is not known. - -```python -# To iterate over a single dimension: -delayedarray.apply_over_dimension( - d, - dimension=0, - fun=some_user_supplied_function, - block_size=block_size, -) - -# To iterate over arbitrary blocks. -delayedarray.apply_over_blocks( - d, - fun=another_user_supplied_function, - block_shape=(20, 100), -) -``` - -### Handling sparse data - -If the `DelayedArray` contains sparse data, `is_sparse(d)` will return `True`. -This allows callers to instead use the `extract_sparse_array()` function for block processing: - -```python -if delayedarray.is_sparse(d): - current = delayedarray.extract_sparse_array(d, (*block_coords,)) -``` - -This returns a `SparseNdarray` consisting of a tree of sparse vectors for the specified block. -Users can retrieve the sparse vectors by inspecting the `contents` property of the `SparseNdarray`: - -- In the one-dimensional case, this is a tuple of two 1-dimensional NumPy arrays storing data about the non-zero elements. - The first array contains sorted indices while the secon array contains the associated values. - If `is_masked(d)` returns `True`, the values will be represented as NumPy `MaskedArray` objects. -- For the two-dimensional case, this is a list of such tuples, with one tuple per column. - This is roughly analogous to a compressed sparse column matrix. - An entry of the list may also be `None`, indicating that no non-zero elements are present in that column. -- For higher-dimensionals, the tree is a nested list of lists of tuples. - Each nesting level corresponds to a dimension; the outermost level contains elements of the last dimension, - the next nesting level contains elements of the second-last dimension, and so on, - with the indices in the tuple referring to the first dimension. - Any list element may be `None` indicating that the corresponding element of the dimension has no non-zero elements. -- In all cases, it is possible for `contents` to be `None`, indicating that there are no non-zero elements in the entire array. - -The `apply_over_*` functions can also be instructed to iteratively extract blocks as `SparseNdarray` objects. -This only occurs if the input array is sparse (as specified by `is_sparse`). - -```python -# To iterate over a single dimension: -delayedarray.apply_over_dimension( - d, - dimension=0, - fun=some_user_supplied_function, - block_size=block_size, - allow_sparse=True, -) -``` - -### Other coercions - -A `DelayedArray` can be converted to a (possibly masked) NumPy array with the `to_dense_array()` function. -Similarly, sparse `DelayedArray`s can be converted to `SparseNdarray`s with the `to_sparse_array()` function. - -```python -delayedarray.to_dense_array(d) -delayedarray.to_sparse_array(d) -``` - -Users can easily convert a 2-dimensional `SparseNdarray` to some of the common SciPy sparse matrix classes downstream calculations. - -```python -delayedarray.to_scipy_sparse_matrix(current, "csc") -``` - -More simply, users can just call `numpy.array()` to realize the delayed operations into a standard NumPy array for consumption. -Note that this discards any masking information so should not be called if `is_masked()` returns `True`. - -```python -simple = numpy.array(n) -type(simple) -## -``` - -Users can also call `delayedarray.create_dask_array()`, to obtain a **dask** array that contains the delayed operations: - -```python -# Note: requires installation as 'delayedarray[dask]'. -dasky = delayedarray.create_dask_array(n) -type(dasky) -## -``` - -## Interoperability with other packages - -The general idea is that `DelayedArray`s should be a drop-in replacement for NumPy arrays, at least for [BiocPy](https://github.com/BiocPy) applications. -So, for example, we can stuff the `DelayedArray` inside a `SummarizedExperiment`: - -```python -import summarizedexperiment as SE -se = SE.SummarizedExperiment({ "counts": filtered, "lognorm": transformed }) -print(se) -## Class SummarizedExperiment with 50 features and 7 samples -## assays: ['counts', 'lognorm'] -## features: [] -## sample data: [] -``` - -One of the main goals of the **DelayedArray** package is to make it easier for Bioconductor developers to inspect the delayed operations. -(See the [developer notes](https://biocpy.github.io/DelayedArray/developers.html) for some comments on **dask**.) -For example, we can pull out the "seed" object underlying our `DelayedArray` instance: - -```python -n.seed -## -``` - -Each layer has its own specific attributes that define the operation, e.g., - -```python -n.seed.subset -## (range(1, 5), range(0, 20)) -``` - -Recursively drilling through the object will eventually reach the underlying array(s): - -```python -n.seed.seed.seed.seed.seed -## array([[0.78811524, 0.87684408, 0.56980128, ..., 0.92659988, 0.8716243 , -## 0.8855508 ], -## [0.96611119, 0.36928726, 0.30364589, ..., 0.14349135, 0.92921468, -## 0.85097595], -## [0.98374144, 0.98197003, 0.18126507, ..., 0.5854122 , 0.48733974, -## 0.90127042], -## ..., -## [0.05566008, 0.24581195, 0.4092705 , ..., 0.79169303, 0.36982844, -## 0.59997214], -## [0.81744194, 0.78499666, 0.80940409, ..., 0.65706498, 0.16220355, -## 0.46912681], -## [0.41896894, 0.58066043, 0.57069833, ..., 0.61640286, 0.47174326, -## 0.7149704 ]]) -``` - -All attributes required to reconstruct a delayed operation are public and considered part of the stable `DelayedArray` interface. - -## Developing seeds - -Any array-like object can be used as a "seed" in a `DelayedArray` provided it has the following: - -- `dtype` and `shape` properties, like those in NumPy arrays. -- a method for the `extract_dense_array()` generic. -- a method for the `is_masked()` generic. -- a method for the `chunk_grid()` generic. - -If the object may contain sparse data, it should also implement: - -- a method for the `is_sparse()` generic. -- a method for the `extract_sparse_generic()` generic. - -It may also be desirable to implement: - -- a method for the `create_dask_array()` generic. -- a method for the `wrap()` generic. - -Developers are referred to the [documentation for each generic](https://biocpy.github.io/DelayedArray/api/delayedarray.html) for more details. diff --git a/_modules/delayedarray/BinaryIsometricOp.html b/_modules/delayedarray/BinaryIsometricOp.html new file mode 100644 index 0000000..ca6c983 --- /dev/null +++ b/_modules/delayedarray/BinaryIsometricOp.html @@ -0,0 +1,464 @@ + + + + + + + + delayedarray.BinaryIsometricOp - DelayedArray 0.6.2 documentation + + + + + + + + + + + + + + + + + Contents + + + + + + Menu + + + + + + + + Expand + + + + + + Light mode + + + + + + + + + + + + + + Dark mode + + + + + + + Auto light/dark, in light mode + + + + + + + + + + + + + + + Auto light/dark, in dark mode + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +Skip to content + + + +
+
+
+ +
+ +
+
+ +
+ +
+
+ +
+
+
+ + + + + Back to top + +
+
+ +
+ +
+
+

Source code for delayedarray.BinaryIsometricOp

+import warnings
+from typing import Callable, Tuple, Sequence
+import numpy
+
+from .DelayedOp import DelayedOp
+from ._isometric import ISOMETRIC_OP_WITH_ARGS, _execute
+from .extract_dense_array import extract_dense_array
+from .extract_sparse_array import extract_sparse_array
+from .create_dask_array import create_dask_array
+from .chunk_grid import chunk_grid
+from .is_sparse import is_sparse
+from .is_masked import is_masked
+
+__author__ = "ltla"
+__copyright__ = "ltla"
+__license__ = "MIT"
+
+
+
+[docs] +class BinaryIsometricOp(DelayedOp): + """Binary isometric operation involving two n-dimensional seed arrays with the same dimension extents. + This is based on Bioconductor's ``DelayedArray::DelayedNaryIsoOp`` class. + + The data type of the result is determined by NumPy casting given the ``seed`` and ``value`` + data types. It is probably safest to cast at least one array to floating-point + to avoid problems due to integer overflow. + + This class is intended for developers to construct new :py:class:`~delayedarray.DelayedArray.DelayedArray` + instances. In general, end users should not be interacting with ``BinaryIsometricOp`` objects directly. + """ + +
+[docs] + def __init__(self, left, right, operation: ISOMETRIC_OP_WITH_ARGS): + """ + Args: + left: + Any object satisfying the seed contract, + see :py:meth:`~delayedarray.DelayedArray.DelayedArray` for details. + + right: + Any object of the same dimensions as ``left`` that satisfies the seed contract, + see :py:meth:`~delayedarray.DelayedArray.DelayedArray` for details. + + operation: + String specifying the operation. + """ + + if left.shape != right.shape: + raise ValueError("'left' and 'right' shapes should be the same") + + ldummy = numpy.zeros(1, dtype=left.dtype) + rdummy = numpy.zeros(1, dtype=right.dtype) + with warnings.catch_warnings(): # silence warnings from divide by zero. + warnings.simplefilter("ignore") + dummy = _execute(ldummy, rdummy, operation) + dtype = dummy.dtype + + self._left = left + self._right = right + self._op = operation + self._dtype = dtype + self._sparse = is_sparse(self._left) and is_sparse(self._right) and dummy[0] == 0
+ + + @property + def shape(self) -> Tuple[int, ...]: + """ + Returns: + Tuple of integers specifying the extent of each dimension of this + object. As the name of the class suggests, this is the same as the + shapes of the ``left`` and ``right`` objects. + """ + return self._left.shape + + @property + def dtype(self) -> numpy.dtype: + """ + Returns: + NumPy type for the data after the operation. This may or may not be + the same as the ``left`` or ``right`` objects, depending on how + NumPy does the casting for the requested operation. + """ + return self._dtype + + @property + def left(self): + """ + Returns: + The seed object on the left-hand-side of the operation. + """ + return self._left + + @property + def right(self): + """ + Returns: + The seed object on the right-hand-side of the operation. + """ + return self._right + + @property + def operation(self) -> ISOMETRIC_OP_WITH_ARGS: + """ + Returns: + Name of the operation. + """ + return self._op
+ + + +def _extract_array(x: BinaryIsometricOp, subset: Tuple[Sequence[int], ...], f: Callable): + ls = f(x._left, subset) + rs = f(x._right, subset) + return _execute(ls, rs, x._op) + + +
+[docs] +@extract_dense_array.register +def extract_dense_array_BinaryIsometricOp(x: BinaryIsometricOp, subset: Tuple[Sequence[int], ...]): + """See :py:meth:`~delayedarray.extract_dense_array.extract_dense_array`.""" + return _extract_array(x, subset, extract_dense_array)
+ + + +
+[docs] +@extract_sparse_array.register +def extract_sparse_array_BinaryIsometricOp(x: BinaryIsometricOp, subset: Tuple[Sequence[int], ...]): + """See :py:meth:`~delayedarray.extract_sparse_array.extract_sparse_array`.""" + return _extract_array(x, subset, extract_sparse_array)
+ + + +
+[docs] +@create_dask_array.register +def create_dask_array_BinaryIsometricOp(x: BinaryIsometricOp): + """See :py:meth:`~delayedarray.create_dask_array.create_dask_array`.""" + ls = create_dask_array(x._left) + rs = create_dask_array(x._right) + return _execute(ls, rs, x._op)
+ + + +
+[docs] +@chunk_grid.register +def chunk_grid_BinaryIsometricOp(x: BinaryIsometricOp): + """See :py:meth:`~delayedarray.chunk_grid.chunk_grid`.""" + lchunk = chunk_grid(x._left) + rchunk = chunk_grid(x._right) + + # Favor the chunking for the more expensive grid, to avoid being penalized + # heavily from suboptimal chunking for that array. + # + # Technically, we could optimize for the case where multiple dimensions + # have the same boundaries, in which case we should favor full extraction + # of the other dimensions and just iterate over the common dimensions. + # This avoids any chunk discrepancies but seems like a pretty unlikely case + # - if two arrays of the same shape disagree on the chunk boundaries of one + # dimension, they'd probably disagree on the others as well. + # + # The other solution is to figure out some high-dimensional caching scheme + # for the partially consumed chunks. Sounds like a royal pain. + if lchunk.cost > rchunk.cost: + return lchunk + else: + return rchunk
+ + + +
+[docs] +@is_sparse.register +def is_sparse_BinaryIsometricOp(x: BinaryIsometricOp): + """See :py:meth:`~delayedarray.is_sparse.is_sparse`.""" + return x._sparse
+ + + +
+[docs] +@is_masked.register +def is_masked_BinaryIsometricOp(x: BinaryIsometricOp): + """See :py:meth:`~delayedarray.is_masked.is_masked`.""" + return is_masked(x._left) or is_masked(x._right)
+ +
+
+
+
+ + +
+
+ + Made with Sphinx and @pradyunsg's + + Furo + +
+
+ +
+
+ +
+
+ +
+
+ + + + + \ No newline at end of file diff --git a/_modules/delayedarray/Cast.html b/_modules/delayedarray/Cast.html new file mode 100644 index 0000000..96ebbcb --- /dev/null +++ b/_modules/delayedarray/Cast.html @@ -0,0 +1,400 @@ + + + + + + + + delayedarray.Cast - DelayedArray 0.6.2 documentation + + + + + + + + + + + + + + + + + Contents + + + + + + Menu + + + + + + + + Expand + + + + + + Light mode + + + + + + + + + + + + + + Dark mode + + + + + + + Auto light/dark, in light mode + + + + + + + + + + + + + + + Auto light/dark, in dark mode + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +Skip to content + + + +
+
+
+ +
+ +
+
+ +
+ +
+
+ +
+
+
+ + + + + Back to top + +
+
+ +
+ +
+
+

Source code for delayedarray.Cast

+from typing import Callable, Tuple, Sequence
+from numpy import dtype
+
+from .DelayedOp import DelayedOp
+from .extract_dense_array import extract_dense_array
+from .extract_sparse_array import extract_sparse_array
+from .create_dask_array import create_dask_array
+from .chunk_grid import chunk_grid
+from .is_sparse import is_sparse
+from .is_masked import is_masked
+
+__author__ = "ltla"
+__copyright__ = "ltla"
+__license__ = "MIT"
+
+
+
+[docs] +class Cast(DelayedOp): + """Delayed cast to a different NumPy type. This is most useful for promoting integer matrices to floating point to + avoid problems with integer overflow in arithmetic operations. + + This class is intended for developers to construct new :py:class:`~delayedarray.DelayedArray.DelayedArray` + instances. End users should not be interacting with ``Cast`` objects directly. + """ + +
+[docs] + def __init__(self, seed, dtype: dtype): + """ + Args: + seed: + Any object that satisfies the seed contract, + see :py:class:`~delayedarray.DelayedArray.DelayedArray` for details. + + dtype: + The desired type. + """ + self._seed = seed + self._dtype = dtype
+ + + @property + def shape(self) -> Tuple[int, ...]: + """ + Returns: + Tuple of integers specifying the extent of each dimension of this + object. This is the same as the ``seed`` object. + """ + return self._seed.shape + + @property + def dtype(self) -> dtype: + """ + Returns: + NumPy type for the contents after casting. + """ + return dtype(self._dtype) + + @property + def seed(self): + """ + Returns: + The seed object. + """ + return self._seed
+ + + +def _extract_array(x: Cast, subset: Tuple[Sequence[int], ...], f: Callable): + return f(x._seed, subset).astype(x._dtype, copy=False) + + +
+[docs] +@extract_dense_array.register +def extract_dense_array_Cast(x: Cast, subset: Tuple[Sequence[int], ...] = None): + """See :py:meth:`~delayedarray.extract_dense_array.extract_dense_array`.""" + return _extract_array(x, subset, extract_dense_array)
+ + + +
+[docs] +@extract_sparse_array.register +def extract_sparse_array_Cast(x: Cast, subset: Tuple[Sequence[int], ...] = None): + """See :py:meth:`~delayedarray.extract_sparse_array.extract_sparse_array`.""" + return _extract_array(x, subset, extract_sparse_array)
+ + + +
+[docs] +@create_dask_array.register +def create_dask_array_Cast(x: Cast): + """See :py:meth:`~delayedarray.create_dask_array.create_dask_array`.""" + target = create_dask_array(x._seed) + return target.astype(x._dtype)
+ + + +
+[docs] +@chunk_grid.register +def chunk_grid_Cast(x: Cast): + """See :py:meth:`~delayedarray.chunk_grid.chunk_grid`.""" + return chunk_grid(x._seed)
+ + + +
+[docs] +@is_sparse.register +def is_sparse_Cast(x: Cast): + """See :py:meth:`~delayedarray.is_sparse.is_sparse`.""" + return is_sparse(x._seed)
+ + + +
+[docs] +@is_masked.register +def is_masked_Cast(x: Cast): + """See :py:meth:`~delayedarray.is_masked.is_masked`.""" + return is_masked(x._seed)
+ +
+
+
+
+ + +
+
+ + Made with Sphinx and @pradyunsg's + + Furo + +
+
+ +
+
+ +
+
+ +
+
+ + + + + \ No newline at end of file diff --git a/_modules/delayedarray/Combine.html b/_modules/delayedarray/Combine.html new file mode 100644 index 0000000..4e7b307 --- /dev/null +++ b/_modules/delayedarray/Combine.html @@ -0,0 +1,491 @@ + + + + + + + + delayedarray.Combine - DelayedArray 0.6.2 documentation + + + + + + + + + + + + + + + + + Contents + + + + + + Menu + + + + + + + + Expand + + + + + + Light mode + + + + + + + + + + + + + + Dark mode + + + + + + + Auto light/dark, in light mode + + + + + + + + + + + + + + + Auto light/dark, in dark mode + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +Skip to content + + + +
+
+
+ +
+ +
+
+ +
+ +
+
+ +
+
+
+ + + + + Back to top + +
+
+ +
+ +
+
+

Source code for delayedarray.Combine

+from typing import Callable, Tuple, Sequence, Any
+import numpy
+import copy
+
+from .DelayedOp import DelayedOp
+from ._mask import _concatenate_unmasked_ndarrays, _concatenate_maybe_masked_ndarrays
+from .extract_dense_array import extract_dense_array
+from .SparseNdarray import _concatenate_SparseNdarrays
+from .extract_sparse_array import extract_sparse_array
+from .create_dask_array import create_dask_array
+from .chunk_grid import chunk_grid
+from .Grid import CompositeGrid
+from .is_sparse import is_sparse
+from .is_masked import is_masked
+
+__author__ = "ltla"
+__copyright__ = "ltla"
+__license__ = "MIT"
+
+
+
+[docs] +class Combine(DelayedOp): + """Delayed combine operation, based on Bioconductor's ``DelayedArray::DelayedAbind`` class. + + This will combine multiple arrays along a specified dimension, provided the extents of all other dimensions are + the same. + + This class is intended for developers to construct new :py:class:`~delayedarray.DelayedArray.DelayedArray` + instances. In general, end users should not be interacting with ``Combine`` objects directly. + """ + +
+[docs] + def __init__(self, seeds: list, along: int): + """ + Args: + seeds: + List of objects that satisfy the seed contract, + see :py:class:`~delayedarray.DelayedArray.DelayedArray` for details. + + along: + Dimension along which the seeds are to be combined. + """ + + self._seeds = seeds + if len(seeds) == 0: + raise ValueError("expected at least one object in 'seeds'") + + shape = list(seeds[0].shape) + ndim = len(shape) + + for i in range(1, len(seeds)): + curshape = seeds[i].shape + for d in range(ndim): + if d == along: + shape[d] += curshape[d] + elif shape[d] != curshape[d]: + raise ValueError( + "expected seeds to have the same extent for non-'along' dimensions" + ) + + self._shape = (*shape,) + self._along = along + + # Guessing the dtype. + to_combine = [] + for i in range(len(seeds)): + to_combine.append(numpy.ndarray((0,), dtype=seeds[i].dtype)) + self._dtype = _concatenate_unmasked_ndarrays(to_combine, axis=0).dtype + + self._is_masked = any(is_masked(y) for y in self._seeds)
+ + + @property + def shape(self) -> Tuple[int, ...]: + """ + Returns: + Tuple of integers specifying the extent of each dimension of the + object after seeds were combined along the specified dimension. + """ + return self._shape + + @property + def dtype(self) -> numpy.dtype: + """ + Returns: + NumPy type for the combined data. This may or may not be + the same as those in ``seeds``, depending on casting rules. + """ + return self._dtype + + @property + def seeds(self) -> list: + """ + Returns: + List of seed objects to be combined. + """ + return self._seeds + + @property + def along(self) -> int: + """ + Returns: + Dimension along which the seeds are combined. + """ + return self._along
+ + + +def _simplify_combine(x: Combine) -> Any: + if len(x.seeds) == 1: + return x.seeds[0] + all_seeds = [] + simplified = False + for ss in x.seeds: + if type(ss) is Combine and x.along == ss.along: + # Don't use isinstance, we don't want to collapse for Combine + # subclasses that might be doing god knows what. + all_seeds += ss.seeds + simplified = True + else: + all_seeds.append(ss) + if not simplified: + return x + new_x = copy.copy(x) + new_x._seeds = all_seeds + return new_x + + +def _extract_subarrays(x: Combine, subset: Tuple[Sequence[int], ...], f: Callable): + # Figuring out which slices belong to who. + chosen = subset[x._along] + limit = 0 + fragmented = [] + position = 0 + for s in x._seeds: + start = limit + limit += s.shape[x._along] + current = [] + while position < len(chosen) and chosen[position] < limit: + current.append(chosen[position] - start) + position += 1 + fragmented.append(current) + + # Extracting the desired slice from each seed. + extracted = [] + flexargs = list(subset) + for i, s in enumerate(x._seeds): + if len(fragmented[i]): + flexargs[x._along] = fragmented[i] + extracted.append(f(s, (*flexargs,))) + + return extracted + + +
+[docs] +@extract_dense_array.register +def extract_dense_array_Combine(x: Combine, subset: Tuple[Sequence[int], ...]): + """See :py:meth:`~delayedarray.extract_dense_array.extract_dense_array`.""" + fragments = _extract_subarrays(x, subset, extract_dense_array) + return _concatenate_maybe_masked_ndarrays(fragments, axis=x._along, masked=x._is_masked)
+ + + +
+[docs] +@extract_sparse_array.register +def extract_sparse_array_Combine(x: Combine, subset: Tuple[Sequence[int], ...]): + """See :py:meth:`~delayedarray.extract_sparse_array.extract_sparse_array`.""" + fragments = _extract_subarrays(x, subset, extract_sparse_array) + return _concatenate_SparseNdarrays(fragments, along=x._along)
+ + + +
+[docs] +@create_dask_array.register +def create_dask_array_Combine(x: Combine): + """See :py:meth:`~delayedarray.create_dask_array.create_dask_array`.""" + extracted = [] + for s in x._seeds: + extracted.append(create_dask_array(s)) + return numpy.concatenate((*extracted,), axis=x._along)
+ + + +
+[docs] +@chunk_grid.register +def chunk_grid_Combine(x: Combine): + """See :py:meth:`~delayedarray.chunk_grid.chunk_grid`.""" + chunks = [chunk_grid(s) for s in x._seeds] + return CompositeGrid(chunks, x._along)
+ + + +
+[docs] +@is_sparse.register +def is_sparse_Combine(x: Combine): + """See :py:meth:`~delayedarray.is_sparse.is_sparse`.""" + for s in x._seeds: + if not is_sparse(s): + return False + return len(x._seeds) > 0
+ + + +
+[docs] +@is_masked.register +def is_masked_Combine(x: Combine): + """See :py:meth:`~delayedarray.is_masked.is_masked`.""" + return x._is_masked
+ +
+
+
+
+ + +
+
+ + Made with Sphinx and @pradyunsg's + + Furo + +
+
+ +
+
+ +
+
+ +
+
+ + + + + \ No newline at end of file diff --git a/_modules/delayedarray/DelayedArray.html b/_modules/delayedarray/DelayedArray.html new file mode 100644 index 0000000..54b8a43 --- /dev/null +++ b/_modules/delayedarray/DelayedArray.html @@ -0,0 +1,1565 @@ + + + + + + + + delayedarray.DelayedArray - DelayedArray 0.6.2 documentation + + + + + + + + + + + + + + + + + Contents + + + + + + Menu + + + + + + + + Expand + + + + + + Light mode + + + + + + + + + + + + + + Dark mode + + + + + + + Auto light/dark, in light mode + + + + + + + + + + + + + + + Auto light/dark, in dark mode + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +Skip to content + + + +
+
+
+ +
+ +
+
+ +
+ +
+
+ +
+
+
+ + + + + Back to top + +
+
+ +
+ +
+
+

Source code for delayedarray.DelayedArray

+from typing import Sequence, Tuple, Union, Optional, List, Callable
+import numpy
+from numpy import dtype, ndarray, array2string
+from collections import namedtuple
+
+from .SparseNdarray import SparseNdarray
+from .BinaryIsometricOp import BinaryIsometricOp
+from .Cast import Cast
+from .Combine import Combine, _simplify_combine
+from .Round import Round
+from .Subset import Subset, _simplify_subset
+from .Transpose import Transpose, _simplify_transpose
+from .UnaryIsometricOpSimple import UnaryIsometricOpSimple
+from .UnaryIsometricOpWithArgs import UnaryIsometricOpWithArgs
+
+from .extract_dense_array import extract_dense_array
+from .to_dense_array import to_dense_array
+from .extract_sparse_array import extract_sparse_array
+from .apply_over_blocks import apply_over_blocks
+from .create_dask_array import create_dask_array
+from .chunk_grid import chunk_grid
+from .is_sparse import is_sparse
+from .is_masked import is_masked
+
+from ._subset import _getitem_subset_preserves_dimensions, _getitem_subset_discards_dimensions, _repr_subset
+from ._isometric import translate_ufunc_to_op_simple, translate_ufunc_to_op_with_args
+from ._statistics import array_mean, array_var, array_sum, _create_offset_multipliers, array_any, array_all
+
+__author__ = "ltla"
+__copyright__ = "ltla"
+__license__ = "MIT"
+
+
+def _wrap_isometric_with_args(x, other, operation, right):
+    if hasattr(other, "shape") and other.shape == x.shape:
+        if right:
+            left = x
+            right = other
+        else:
+            left = other
+            right = x
+        return DelayedArray(
+            BinaryIsometricOp(_extract_seed(left), _extract_seed(right), operation)
+        )
+
+    return DelayedArray(
+        UnaryIsometricOpWithArgs(
+            _extract_seed(x),
+            value=other,
+            operation=operation,
+            right=right,
+        )
+    )
+
+
+def _extract_seed(x):
+    if isinstance(x, DelayedArray):
+        return x._seed
+    else:
+        return x
+
+
+
+[docs] +class DelayedArray: + """Array containing delayed operations. This is equivalent to the class of + the same name from the `R/Bioconductor package + <https://bioconductor.org/packages/DelayedArray>`_ of the same name. It + allows users to efficiently operate on large matrices without actually + evaluating the operation or creating new copies; instead, the operations + will transparently return another ``DelayedArray`` instance containing the + delayed operations, which can be realized by calling + :py:meth:`~numpy.array` or related methods. + + Any object that satisfies the "seed contract" can be wrapped by a + ``DelayedArray``. Specifically, a seed should have: + + - The :py:attr:`~shape` and :py:attr:`~dtype` properties, which are of the + same type as the corresponding properties of NumPy arrays. + - A method for the + :py:meth:`~delayedarray.extract_dense_array.extract_dense_array` generic. + - A method for the :py:meth:`~delayedarray.is_masked.is_masked` generic. + - A method for the :py:meth:`~delayedarray.chunk_grid.chunk_grid` generic. + + If the seed contains sparse data, it should also implement: + + - A method for the :py:meth:`~delayedarray.is_sparse.is_sparse` generic. + - A method for the + :py:meth:`~delayedarray.extract_sparse_array.extract_sparse_array` + generic. + + Optionally, a seed class may have: + + - A method for the + :py:meth:`~delayedarray.create_dask_array.create_dask_array` generic, + if the seed is not already compatible with the **dask** package. + - a method for the `wrap()` generic, to create a ``DelayedArray`` + subclass that is specific to this seed class. + """ + +
+[docs] + def __init__(self, seed): + """Most users should use :py:meth:`~delayedarray.wrap.wrap` + instead, as this can be specialized by developers to construct + subclasses that are optimized for custom seed types. + + Args: + seed: Any array-like object that satisfies the seed contract. + """ + self._seed = seed
+ + + @property + def shape(self) -> Tuple[int, ...]: + """ + Returns: + Tuple of integers specifying the extent of each dimension of the ``DelayedArray``. + """ + return self._seed.shape + + @property + def dtype(self) -> dtype: + """ + Returns: + NumPy type of the elements in the ``DelayedArray``. + """ + return self._seed.dtype + + @property + def seed(self): + """ + Returns: + The seed object. + """ + return self._seed + + @property + def T(self) -> "DelayedArray": + """ + Returns: + A ``DelayedArray`` containing the delayed transpose. + """ + tout = Transpose(self._seed, perm=None) + tout = _simplify_transpose(tout) + return DelayedArray(tout) + +
+[docs] + def __repr__(self) -> str: + """Pretty-print this ``DelayedArray``. This uses + :py:meth:`~numpy.array2string` and responds to all of its options. + + Returns: + String containing a prettified display of the array contents. + """ + preamble = "<" + " x ".join([str(x) for x in self._seed.shape]) + ">" + if is_sparse(self._seed): + preamble += " sparse" + preamble += " " + type(self).__name__ + " object of type '" + self._seed.dtype.name + "'" + + indices = _repr_subset(self._seed.shape) + bits_and_pieces = extract_dense_array(self._seed, indices) + converted = array2string(bits_and_pieces, separator=", ", threshold=0) + return preamble + "\n" + converted
+ + + # For NumPy: +
+[docs] + def __array__(self, dtype: Optional[numpy.dtype] = None, copy: bool = True) -> ndarray: + """Convert a ``DelayedArray`` to a NumPy array, to be used by + :py:meth:`~numpy.array`. + + Args: + dtype: + The desired NumPy type of the output array. If None, the + type of the seed is used. + + copy: + Currently ignored. The output is never a reference to the + underlying seed, even if the seed is another NumPy array. + + Returns: + NumPy array of the same type as :py:attr:`~dtype` and shape as + :py:attr:`~shape`. + """ + if dtype is None or dtype == self.dtype: + return to_dense_array(self._seed) + else: + # Filling it chunk by chunk rather than doing a big coercion, + # to avoid creating an unnecessary intermediate full matrix. + output = numpy.ndarray(self.shape, dtype=dtype) + if is_masked(self._seed): + output = numpy.ma.array(output, mask=False) + def fill_output(job, part): + subsets = (*(slice(s, e) for s, e in job),) + output[subsets] = part + apply_over_blocks(self._seed, fill_output) + return output
+ + +
+[docs] + def __array_ufunc__(self, ufunc, method, *inputs, **kwargs) -> "DelayedArray": + """Interface with NumPy array methods. This is used to implement + mathematical operations like NumPy's :py:meth:`~numpy.log`, or to + override operations between NumPy class instances and ``DelayedArray`` + objects where the former is on the left hand side. + + Check out NumPy's ``__array_ufunc__`` `documentation + <https://numpy.org/doc/stable/reference/arrays.classes.html#numpy.class.__array_ufunc__>`_ + for more details. + + Returns: + A ``DelayedArray`` instance containing the requested delayed operation. + """ + if ( + ufunc.__name__ in translate_ufunc_to_op_with_args + or ufunc.__name__ == "true_divide" + ): + # This is required to support situations where the NumPy array is on + # the LHS, such that the ndarray method gets called first. + op = ufunc.__name__ + if ufunc.__name__ == "true_divide": + op = "divide" + + first_is_da = isinstance(inputs[0], DelayedArray) + da = inputs[1 - int(first_is_da)] + v = inputs[int(first_is_da)] + return _wrap_isometric_with_args( + _extract_seed(da), v, operation=op, right=first_is_da + ) + elif ufunc.__name__ in translate_ufunc_to_op_simple: + return DelayedArray( + UnaryIsometricOpSimple( + _extract_seed(inputs[0]), operation=ufunc.__name__ + ) + ) + elif ufunc.__name__ == "absolute": + return DelayedArray( + UnaryIsometricOpSimple(_extract_seed(inputs[0]), operation="abs") + ) + elif ufunc.__name__ == "logical_not": + return DelayedArray( + UnaryIsometricOpSimple(_extract_seed(inputs[0]), operation="logical_not") + ) + + raise NotImplementedError(f"'{ufunc.__name__}' is not implemented!")
+ + + # Just get the array priority above that of the numpy MaskedArray so that + # we call DelayedArray's __array_ufunc__ override instead... annoyingly, it + # doesn't actually work (https://github.com/numpy/numpy/issues/15200). + __array_priority__ = numpy.ma.MaskedArray.__array_priority__ + 1 + +
+[docs] + def __array_function__(self, func, types, args, kwargs) -> "DelayedArray": + """Interface to NumPy's high-level array functions. This is used to + implement array operations like NumPy's :py:meth:`~numpy.concatenate`, + + Check out NumPy's ``__array_function__`` `documentation + <https://numpy.org/doc/stable/reference/arrays.classes.html#numpy.class.__array_function__>`_ + for more details. + + Returns: + A ``DelayedArray`` instance containing the requested delayed operation. + """ + if func == numpy.concatenate: + seeds = [] + for x in args[0]: + seeds.append(_extract_seed(x)) + if "axis" in kwargs: + axis = kwargs["axis"] + else: + axis = 0 + cout = Combine(seeds, along=axis) + cout = _simplify_combine(cout) + return DelayedArray(cout) + + if func == numpy.transpose: + seed = _extract_seed(args[0]) + if "axes" in kwargs: + axes = kwargs["axes"] + else: + axes = None + tout = Transpose(seed, perm=axes) + tout = _simplify_transpose(tout) + return DelayedArray(tout) + + if func == numpy.round: + seed = _extract_seed(args[0]) + if "decimals" in kwargs: + decimals = kwargs["decimals"] + else: + decimals = 0 + return DelayedArray(Round(seed, decimals=decimals)) + + if func == numpy.mean: + return self.mean(**kwargs) + + if func == numpy.sum: + return self.sum(**kwargs) + + if func == numpy.var: + return self.var(**kwargs) + + if func == numpy.any: + return self.any(**kwargs) + + if func == numpy.all: + return self.all(**kwargs) + + if func == numpy.shape: + return self.shape + + raise NotImplementedError(f"'{func.__name__}' is not implemented!")
+ + +
+[docs] + def astype(self, dtype, **kwargs): + """See :py:meth:`~numpy.ndarray.astype` for details. + + All keyword arguments are currently ignored. + """ + return DelayedArray(Cast(self._seed, dtype))
+ + + # Assorted dunder methods. +
+[docs] + def __add__(self, other) -> "DelayedArray": + """Add something to the right-hand-side of a ``DelayedArray``. + + Args: + other: + A numeric scalar; + or a NumPy array with dimensions as described in + :py:class:`~delayedarray.UnaryIsometricOpWithArgs.UnaryIsometricOpWithArgs`; + or a ``DelayedArray`` of the same dimensions as :py:attr:`~shape`. + + Returns: + A ``DelayedArray`` containing the delayed addition operation. + """ + return _wrap_isometric_with_args(self, other, operation="add", right=True)
+ + +
+[docs] + def __radd__(self, other) -> "DelayedArray": + """Add something to the left-hand-side of a ``DelayedArray``. + + Args: + other: + A numeric scalar; + or a NumPy array with dimensions as described in + :py:class:`~delayedarray.UnaryIsometricOpWithArgs.UnaryIsometricOpWithArgs`; + or a ``DelayedArray`` of the same dimensions as :py:attr:`~shape`. + + Returns: + A ``DelayedArray`` containing the delayed addition operation. + """ + return _wrap_isometric_with_args(self, other, operation="add", right=False)
+ + +
+[docs] + def __sub__(self, other) -> "DelayedArray": + """Subtract something from the right-hand-side of a ``DelayedArray``. + + Args: + other: + A numeric scalar; + or a NumPy array with dimensions as described in + :py:class:`~delayedarray.UnaryIsometricOpWithArgs.UnaryIsometricOpWithArgs`; + or a ``DelayedArray`` of the same dimensions as :py:attr:`~shape`. + + Returns: + A ``DelayedArray`` containing the delayed subtraction operation. + """ + return _wrap_isometric_with_args(self, other, operation="subtract", right=True)
+ + +
+[docs] + def __rsub__(self, other): + """Subtract a ``DelayedArray`` from something else. + + Args: + other: + A numeric scalar; + or a NumPy array with dimensions as described in + :py:class:`~delayedarray.UnaryIsometricOpWithArgs.UnaryIsometricOpWithArgs`; + or a ``DelayedArray`` of the same dimensions as :py:attr:`~shape`. + + Returns: + A ``DelayedArray`` containing the delayed subtraction operation. + """ + return _wrap_isometric_with_args(self, other, operation="subtract", right=False)
+ + +
+[docs] + def __mul__(self, other): + """Multiply a ``DelayedArray`` with something on the right hand side. + + Args: + other: + A numeric scalar; + or a NumPy array with dimensions as described in + :py:class:`~delayedarray.UnaryIsometricOpWithArgs.UnaryIsometricOpWithArgs`; + or a ``DelayedArray`` of the same dimensions as :py:attr:`~shape`. + + Returns: + A ``DelayedArray`` containing the delayed multiplication operation. + """ + return _wrap_isometric_with_args(self, other, operation="multiply", right=True)
+ + +
+[docs] + def __rmul__(self, other): + """Multiply a ``DelayedArray`` with something on the left hand side. + + Args: + other: + A numeric scalar; + or a NumPy array with dimensions as described in + :py:class:`~delayedarray.UnaryIsometricOpWithArgs.UnaryIsometricOpWithArgs`; + or a ``DelayedArray`` of the same dimensions as :py:attr:`~shape`. + + Returns: + A ``DelayedArray`` containing the delayed multiplication operation. + """ + return _wrap_isometric_with_args(self, other, operation="multiply", right=False)
+ + +
+[docs] + def __truediv__(self, other): + """Divide a ``DelayedArray`` by something. + + Args: + other: + A numeric scalar; + or a NumPy array with dimensions as described in + :py:class:`~delayedarray.UnaryIsometricOpWithArgs.UnaryIsometricOpWithArgs`; + or a ``DelayedArray`` of the same dimensions as :py:attr:`~shape`. + + Returns: + A ``DelayedArray`` containing the delayed division operation. + """ + return _wrap_isometric_with_args(self, other, operation="divide", right=True)
+ + +
+[docs] + def __rtruediv__(self, other): + """Divide something by a ``DelayedArray``. + + Args: + other: + A numeric scalar; + or a NumPy array with dimensions as described in + :py:class:`~delayedarray.UnaryIsometricOpWithArgs.UnaryIsometricOpWithArgs`; + or a ``DelayedArray`` of the same dimensions as :py:attr:`~shape`. + + Returns: + A ``DelayedArray`` containing the delayed division operation. + """ + return _wrap_isometric_with_args(self, other, operation="divide", right=False)
+ + +
+[docs] + def __mod__(self, other): + """Take the remainder after dividing a ``DelayedArray`` by something. + + Args: + other: + A numeric scalar; + or a NumPy array with dimensions as described in + :py:class:`~delayedarray.UnaryIsometricOpWithArgs.UnaryIsometricOpWithArgs`; + or a ``DelayedArray`` object of the same dimensions as :py:attr:`~shape`. + + Returns: + A ``DelayedArray`` containing the delayed modulo operation. + """ + return _wrap_isometric_with_args(self, other, operation="remainder", right=True)
+ + +
+[docs] + def __rmod__(self, other): + """Take the remainder after dividing something by a ``DelayedArray``. + + Args: + other: + A numeric scalar; + or a NumPy array with dimensions as described in + :py:class:`~delayedarray.UnaryIsometricOpWithArgs.UnaryIsometricOpWithArgs`; + or a ``DelayedArray`` of the same dimensions as :py:attr:`~shape`. + + Returns: + A ``DelayedArray`` containing the delayed modulo operation. + """ + return _wrap_isometric_with_args( + self, other, operation="remainder", right=False + )
+ + +
+[docs] + def __floordiv__(self, other): + """Divide a ``DelayedArray`` by something and take the floor. + + Args: + other: + A numeric scalar; + or a NumPy array with dimensions as described in + :py:class:`~delayedarray.UnaryIsometricOpWithArgs.UnaryIsometricOpWithArgs`; + or a ``DelayedArray`` of the same dimensions as :py:attr:`~shape`. + + Returns: + A ``DelayedArray`` containing the delayed floor division operation. + """ + return _wrap_isometric_with_args( + self, other, operation="floor_divide", right=True + )
+ + +
+[docs] + def __rfloordiv__(self, other): + """Divide something by a ``DelayedArray`` and take the floor. + + Args: + other: + A numeric scalar; + or a NumPy array with dimensions as described in + :py:class:`~delayedarray.UnaryIsometricOpWithArgs.UnaryIsometricOpWithArgs`; + or a ``DelayedArray`` of the same dimensions as :py:attr:`~shape`. + + Returns: + A ``DelayedArray`` containing the delayed floor division operation. + """ + return _wrap_isometric_with_args( + self, other, operation="floor_divide", right=False + )
+ + +
+[docs] + def __pow__(self, other): + """Raise a ``DelayedArray`` to the power of something. + + Args: + other: + A numeric scalar; + or a NumPy array with dimensions as described in + :py:class:`~delayedarray.UnaryIsometricOpWithArgs.UnaryIsometricOpWithArgs`; + or a ``DelayedArray`` of the same dimensions as :py:attr:`~shape`. + + Returns: + A ``DelayedArray`` containing the delayed power operation. + """ + return _wrap_isometric_with_args(self, other, operation="power", right=True)
+ + +
+[docs] + def __rpow__(self, other): + """Raise something to the power of the contents of a ``DelayedArray``. + + Args: + other: + A numeric scalar; + or a NumPy array with dimensions as described in + :py:class:`~delayedarray.UnaryIsometricOpWithArgs.UnaryIsometricOpWithArgs`; + or a ``DelayedArray`` of the same dimensions as :py:attr:`~shape`. + + Returns: + A ``DelayedArray`` containing the delayed power operation. + """ + return _wrap_isometric_with_args(self, other, operation="power", right=False)
+ + +
+[docs] + def __eq__(self, other) -> "DelayedArray": + """Check for equality between a ``DelayedArray`` and something. + + Args: + other: + A numeric scalar; + or a NumPy array with dimensions as described in + :py:class:`~delayedarray.UnaryIsometricOpWithArgs.UnaryIsometricOpWithArgs`; + or a ``DelayedArray`` of the same dimensions as :py:attr:`~shape`. + + Returns: + A ``DelayedArray`` containing the delayed check. + """ + return _wrap_isometric_with_args(self, other, operation="equal", right=True)
+ + +
+[docs] + def __req__(self, other) -> "DelayedArray": + """Check for equality between something and a ``DelayedArray``. + + Args: + other: + A numeric scalar; + or a NumPy array with dimensions as described in + :py:class:`~delayedarray.UnaryIsometricOpWithArgs.UnaryIsometricOpWithArgs`; + or a ``DelayedArray`` of the same dimensions as :py:attr:`~shape`. + + Returns: + A ``DelayedArray`` containing the delayed check. + """ + return _wrap_isometric_with_args(self, other, operation="equal", right=False)
+ + +
+[docs] + def __ne__(self, other) -> "DelayedArray": + """Check for non-equality between a ``DelayedArray`` and something. + + Args: + other: + A numeric scalar; + or a NumPy array with dimensions as described in + :py:class:`~delayedarray.UnaryIsometricOpWithArgs.UnaryIsometricOpWithArgs`; + or a ``DelayedArray`` of the same dimensions as :py:attr:`~shape`. + + Returns: + A ``DelayedArray`` containing the delayed check. + """ + return _wrap_isometric_with_args(self, other, operation="not_equal", right=True)
+ + +
+[docs] + def __rne__(self, other) -> "DelayedArray": + """Check for non-equality between something and a ``DelayedArray``. + + Args: + other: + A numeric scalar; + or a NumPy array with dimensions as described in + :py:class:`~delayedarray.UnaryIsometricOpWithArgs.UnaryIsometricOpWithArgs`; + or a ``DelayedArray`` of the same dimensions as :py:attr:`~shape`. + + Returns: + A ``DelayedArray`` containing the delayed check. + """ + return _wrap_isometric_with_args( + self, other, operation="not_equal", right=False + )
+ + +
+[docs] + def __ge__(self, other) -> "DelayedArray": + """Check whether a ``DelayedArray`` is greater than or equal to something. + + Args: + other: + A numeric scalar; + or a NumPy array with dimensions as described in + :py:class:`~delayedarray.UnaryIsometricOpWithArgs.UnaryIsometricOpWithArgs`; + or a ``DelayedArray`` of the same dimensions as :py:attr:`~shape`. + + Returns: + A ``DelayedArray`` containing the delayed check. + """ + return _wrap_isometric_with_args( + self, other, operation="greater_equal", right=True + )
+ + +
+[docs] + def __rge__(self, other) -> "DelayedArray": + """Check whether something is greater than or equal to a ``DelayedArray``. + + Args: + other: + A numeric scalar; + or a NumPy array with dimensions as described in + :py:class:`~delayedarray.UnaryIsometricOpWithArgs.UnaryIsometricOpWithArgs`; + or a ``DelayedArray`` of the same dimensions as :py:attr:`~shape`. + + Returns: + A ``DelayedArray`` containing the delayed check. + """ + return _wrap_isometric_with_args( + self, other, operation="greater_equal", right=False + )
+ + +
+[docs] + def __le__(self, other) -> "DelayedArray": + """Check whether a ``DelayedArray`` is less than or equal to something. + + Args: + other: + A numeric scalar; + or a NumPy array with dimensions as described in + :py:class:`~delayedarray.UnaryIsometricOpWithArgs.UnaryIsometricOpWithArgs`; + or a ``DelayedArray`` of the same dimensions as :py:attr:`~shape`. + + Returns: + A ``DelayedArray`` containing the delayed check. + """ + return _wrap_isometric_with_args( + self, other, operation="less_equal", right=True + )
+ + +
+[docs] + def __rle__(self, other) -> "DelayedArray": + """Check whether something is greater than or equal to a ``DelayedArray``. + + Args: + other: + A numeric scalar; + or a NumPy array with dimensions as described in + :py:class:`~delayedarray.UnaryIsometricOpWithArgs.UnaryIsometricOpWithArgs`; + or a ``DelayedArray`` of the same dimensions as :py:attr:`~shape`. + + Returns: + A ``DelayedArray`` containing the delayed check. + """ + return _wrap_isometric_with_args( + self, other, operation="less_equal", right=False + )
+ + +
+[docs] + def __gt__(self, other) -> "DelayedArray": + """Check whether a ``DelayedArray`` is greater than something. + + Args: + other: + A numeric scalar; + or a NumPy array with dimensions as described in + :py:class:`~delayedarray.UnaryIsometricOpWithArgs.UnaryIsometricOpWithArgs`; + or a ``DelayedArray`` of the same dimensions as :py:attr:`~shape`. + + Returns: + A ``DelayedArray`` containing the delayed check. + """ + return _wrap_isometric_with_args(self, other, operation="greater", right=True)
+ + +
+[docs] + def __rgt__(self, other) -> "DelayedArray": + """Check whether something is greater than a ``DelayedArray``. + + Args: + other: + A numeric scalar; + or a NumPy array with dimensions as described in + :py:class:`~delayedarray.UnaryIsometricOpWithArgs.UnaryIsometricOpWithArgs`; + or a ``DelayedArray`` of the same dimensions as :py:attr:`~shape`. + + Returns: + A ``DelayedArray`` containing the delayed check. + """ + return _wrap_isometric_with_args(self, other, operation="greater", right=False)
+ + +
+[docs] + def __lt__(self, other) -> "DelayedArray": + """Check whether a ``DelayedArray`` is less than something. + + Args: + other: + A numeric scalar; + or a NumPy array with dimensions as described in + :py:class:`~delayedarray.UnaryIsometricOpWithArgs.UnaryIsometricOpWithArgs`; + or a ``DelayedArray`` of the same dimensions as :py:attr:`~shape`. + + Returns: + A ``DelayedArray`` containing the delayed check. + """ + return _wrap_isometric_with_args(self, other, operation="less", right=True)
+ + +
+[docs] + def __rlt__(self, other) -> "DelayedArray": + """Check whether something is less than a ``DelayedArray``. + + Args: + other: + A numeric scalar; + or a NumPy array with dimensions as described in + :py:class:`~delayedarray.UnaryIsometricOpWithArgs.UnaryIsometricOpWithArgs`; + or a ``DelayedArray`` of the same dimensions as :py:attr:`~shape`. + + Returns: + A ``DelayedArray`` containing the delayed check. + """ + return _wrap_isometric_with_args(self, other, operation="less", right=False)
+ + + # Simple methods. +
+[docs] + def __neg__(self) -> "DelayedArray": + """Negate the contents of a ``DelayedArray``. + + Returns: + A ``DelayedArray`` containing the delayed negation. + """ + return _wrap_isometric_with_args(self, 0, operation="subtract", right=False)
+ + +
+[docs] + def __abs__(self) -> "DelayedArray": + """Take the absolute value of the contents of a ``DelayedArray``. + + Returns: + A ``DelayedArray`` containing the delayed absolute value operation. + """ + return DelayedArray(UnaryIsometricOpSimple(self._seed, operation="abs"))
+ + +
+[docs] + def __or__(self, other) -> "DelayedArray": + """Element-wise OR with something. + + Args: + other: + A numeric scalar; + or a NumPy array with dimensions as described in + :py:class:`~delayedarray.UnaryIsometricOpWithArgs.UnaryIsometricOpWithArgs`; + or a ``DelayedArray`` of the same dimensions as :py:attr:`~shape`. + + Returns: + A ``DelayedArray`` containing the delayed OR operation. + """ + return _wrap_isometric_with_args(self, other, operation="logical_or", right=True)
+ + +
+[docs] + def __ror__(self, other) -> "DelayedArray": + """Element-wise OR with the right-hand-side of a ``DelayedArray``. + + Args: + other: + A numeric scalar; + or a NumPy array with dimensions as described in + :py:class:`~delayedarray.UnaryIsometricOpWithArgs.UnaryIsometricOpWithArgs`; + or a ``DelayedArray`` of the same dimensions as :py:attr:`~shape`. + + Returns: + A ``DelayedArray`` containing the delayed OR operation. + """ + return _wrap_isometric_with_args(self, other, operation="logical_or", right=False)
+ + +
+[docs] + def __and__(self, other) -> "DelayedArray": + """Element-wise AND with something. + + Args: + other: + A numeric scalar; + or a NumPy array with dimensions as described in + :py:class:`~delayedarray.UnaryIsometricOpWithArgs.UnaryIsometricOpWithArgs`; + or a ``DelayedArray`` of the same dimensions as :py:attr:`~shape`. + + Returns: + A ``DelayedArray`` containing the delayed AND operation. + """ + return _wrap_isometric_with_args(self, other, operation="logical_and", right=True)
+ + +
+[docs] + def __rand__(self, other) -> "DelayedArray": + """Element-wise AND with the right-hand-side of a ``DelayedArray``. + + Args: + other: + A numeric scalar; + or a NumPy array with dimensions as described in + :py:class:`~delayedarray.UnaryIsometricOpWithArgs.UnaryIsometricOpWithArgs`; + or a ``DelayedArray`` of the same dimensions as :py:attr:`~shape`. + + Returns: + A ``DelayedArray`` containing the delayed AND operation. + """ + return _wrap_isometric_with_args(self, other, operation="logical_and", right=False)
+ + + # Subsetting. +
+[docs] + def __getitem__(self, subset) -> Union["DelayedArray", ndarray]: + """Take a subset of this ``DelayedArray``. This follows the same logic as NumPy slicing and will generate a + :py:class:`~delayedarray.Subset.Subset` object when the subset operation preserves the dimensionality of the + seed, i.e., ``args`` is defined using the :py:meth:`~numpy.ix_` function. + + Args: + subset: + A :py:class:`tuple` of length equal to the dimensionality of this ``DelayedArray``, or a single integer specifying an index on the first dimension. + We attempt to support most types of NumPy slicing; however, only subsets that preserve dimensionality will generate a delayed subset operation. + + Returns: + If the dimensionality is preserved by ``subset``, a ``DelayedArray`` containing a delayed subset operation is returned. + Otherwise, a :py:class:`~numpy.ndarray` is returned containing the realized subset. + """ + if not isinstance(subset, Tuple): + replacement = [slice(None)] * len(self.shape) + replacement[0] = subset + subset = (*replacement,) + + cleaned = _getitem_subset_preserves_dimensions(self.shape, subset) + if cleaned is not None: + sout = Subset(self._seed, cleaned) + sout = _simplify_subset(sout) + return DelayedArray(sout) + + return _getitem_subset_discards_dimensions(self._seed, subset, extract_dense_array)
+ + + + # For python-level compute. +
+[docs] + def sum(self, axis: Optional[Union[int, Tuple[int, ...]]] = None, dtype: Optional[numpy.dtype] = None, buffer_size: Optional[int] = None) -> numpy.ndarray: + """ + Take the sum of values across the ``DelayedArray``, possibly over a + given axis or set of axes. If the seed has a ``sum()`` method, that + method is called directly with the supplied arguments. + + Args: + axis: + A single integer specifying the axis over which to calculate + the sum. Alternatively, a tuple (multiple axes) or None (no + axes), see :py:func:`~numpy.sum` for details. + + dtype: + NumPy type for the output array. If None, this is automatically + chosen based on the type of the ``DelayedArray``, see + :py:func:`~numpy.sum` for details. + + buffer_size: + Buffer size in bytes to use for block processing. + Larger values generally improve speed at the cost of memory. + If ``None``, defaults to the value returned by :py:func:`~delayedarray.default_buffer_size.default_buffer_size`. + + Returns: + A NumPy array containing the sums. If ``axis = None``, this will be + a NumPy scalar instead. + """ + if hasattr(self._seed, "sum"): + return self._seed.sum(axis=axis, dtype=dtype) + else: + return array_sum( + self, + axis=axis, + dtype=dtype, + reduce_over_x=lambda x, axes, op : _reduce(x, axes, op, buffer_size), + masked=is_masked(self), + )
+ + + +
+[docs] + def mean(self, axis: Optional[Union[int, Tuple[int, ...]]] = None, dtype: Optional[numpy.dtype] = None, buffer_size: Optional[int] = None) -> numpy.ndarray: + """ + Take the mean of values across the ``DelayedArray``, possibly over a + given axis or set of axes. If the seed has a ``mean()`` method, that + method is called directly with the supplied arguments. + + Args: + axis: + A single integer specifying the axis over which to calculate + the mean. Alternatively, a tuple (multiple axes) or None (no + axes), see :py:func:`~numpy.mean` for details. + + dtype: + NumPy type for the output array. If None, this is automatically + chosen based on the type of the ``DelayedArray``, see + :py:func:`~numpy.mean` for details. + + buffer_size: + Buffer size in bytes to use for block processing. + Larger values generally improve speed at the cost of memory. + If ``None``, defaults to the value returned by :py:func:`~delayedarray.default_buffer_size.default_buffer_size`. + + Returns: + A NumPy array containing the means. If ``axis = None``, this will + be a NumPy scalar instead. + """ + if hasattr(self._seed, "mean"): + return self._seed.mean(axis=axis, dtype=dtype) + else: + return array_mean( + self, + axis=axis, + dtype=dtype, + reduce_over_x=lambda x, axes, op : _reduce(x, axes, op, buffer_size), + masked=is_masked(self), + )
+ + + +
+[docs] + def var(self, axis: Optional[Union[int, Tuple[int, ...]]] = None, dtype: Optional[numpy.dtype] = None, ddof: int = 0, buffer_size: Optional[int] = None) -> numpy.ndarray: + """ + Take the variances of values across the ``DelayedArray``, possibly over + a given axis or set of axes. If the seed has a ``var()`` method, that + method is called directly with the supplied arguments. + + Args: + axis: + A single integer specifying the axis over which to calculate + the variance. Alternatively, a tuple (multiple axes) or None + (no axes), see :py:func:`~numpy.var` for details. + + dtype: + NumPy type for the output array. If None, this is automatically + chosen based on the type of the ``DelayedArray``, see + :py:func:`~numpy.var` for details. + + ddof: + Delta in the degrees of freedom to subtract from the denominator. + Typically set to 1 to obtain the sample variance. + + buffer_size: + Buffer size in bytes to use for block processing. + Larger values generally improve speed at the cost of memory. + If ``None``, defaults to the value returned by :py:func:`~delayedarray.default_buffer_size.default_buffer_size`. + + Returns: + A NumPy array containing the variances. If ``axis = None``, + this will be a NumPy scalar instead. + """ + if hasattr(self._seed, "var"): + return self._seed.var(axis=axis, dtype=dtype, ddof=ddof) + else: + return array_var( + self, + axis=axis, + dtype=dtype, + ddof=ddof, + reduce_over_x=lambda x, axes, op : _reduce(x, axes, op, buffer_size), + masked=is_masked(self), + )
+ + +
+[docs] + def any(self, axis: Optional[Union[int, Tuple[int, ...]]] = None, dtype: Optional[numpy.dtype] = None, buffer_size: Optional[int] = None) -> numpy.ndarray: + """Test whether any array element along a given axis evaluates to True. + + Compute this test across the ``DelayedArray``, possibly over a + given axis or set of axes. If the seed has a ``any()`` method, that + method is called directly with the supplied arguments. + + Args: + axis: + A single integer specifying the axis over which to test + for any. Alternatively, a tuple (multiple axes) or None (no + axes), see :py:func:`~numpy.any` for details. + + dtype: + NumPy type for the output array. If None, this is automatically + chosen based on the type of the ``DelayedArray``, see + :py:func:`~numpy.any` for details. + + buffer_size: + Buffer size in bytes to use for block processing. + Larger values generally improve speed at the cost of memory. + If ``None``, defaults to the value returned by :py:func:`~delayedarray.default_buffer_size.default_buffer_size`. + + Returns: + A NumPy array containing the boolean values. If ``axis = None``, this will + be a NumPy scalar instead. + """ + if hasattr(self._seed, "any"): + return self._seed.any(axis=axis).astype(dtype) + else: + return array_any( + self, + axis=axis, + dtype=dtype, + reduce_over_x=lambda x, axes, op : _reduce(x, axes, op, buffer_size), + masked=is_masked(self), + )
+ + +
+[docs] + def all(self, axis: Optional[Union[int, Tuple[int, ...]]] = None, dtype: Optional[numpy.dtype] = None, buffer_size: Optional[int] = None) -> numpy.ndarray: + """Test whether all array elements along a given axis evaluate to True. + + Compute this test across the ``DelayedArray``, possibly over a + given axis or set of axes. If the seed has a ``all()`` method, that + method is called directly with the supplied arguments. + + Args: + axis: + A single integer specifying the axis over which to test + for all. Alternatively, a tuple (multiple axes) or None (no + axes), see :py:func:`~numpy.all` for details. + + dtype: + NumPy type for the output array. If None, this is automatically + chosen based on the type of the ``DelayedArray``, see + :py:func:`~numpy.all` for details. + + buffer_size: + Buffer size in bytes to use for block processing. + Larger values generally improve speed at the cost of memory. + If ``None``, defaults to the value returned by :py:func:`~delayedarray.default_buffer_size.default_buffer_size`. + + Returns: + A NumPy array containing the boolean values. If ``axis = None``, this will + be a NumPy scalar instead. + """ + if hasattr(self._seed, "all"): + return self._seed.all(axis=axis).astype(dtype) + else: + return array_all( + self, + axis=axis, + dtype=dtype, + reduce_over_x=lambda x, axes, op : _reduce(x, axes, op, buffer_size), + masked=is_masked(self), + )
+
+ + +
+[docs] +@extract_dense_array.register +def extract_dense_array_DelayedArray(x: DelayedArray, subset: Tuple[Sequence[int], ...]) -> numpy.ndarray: + """See :py:meth:`~delayedarray.extract_dense_array.extract_dense_array`.""" + return extract_dense_array(x._seed, subset)
+ + + +
+[docs] +@extract_sparse_array.register +def extract_sparse_array_DelayedArray(x: DelayedArray, subset: Tuple[Sequence[int], ...]) -> SparseNdarray: + """See :py:meth:`~delayedarray.extract_sparse_array.extract_sparse_array`.""" + return extract_sparse_array(x._seed, subset)
+ + + +
+[docs] +@create_dask_array.register +def create_dask_array_DelayedArray(x: DelayedArray): + """See :py:meth:`~delayedarray.create_dask_array.create_dask_array`.""" + return create_dask_array(x._seed)
+ + + +
+[docs] +@chunk_grid.register +def chunk_grid_DelayedArray(x: DelayedArray): + """See :py:meth:`~delayedarray.chunk_grid.chunk_grid`.""" + return chunk_grid(x._seed)
+ + + +
+[docs] +@is_sparse.register +def is_sparse_DelayedArray(x: DelayedArray): + """See :py:meth:`~delayedarray.is_sparse.is_sparse`.""" + return is_sparse(x._seed)
+ + + +
+[docs] +@is_masked.register +def is_masked_DelayedArray(x: DelayedArray): + """See :py:meth:`~delayedarray.is_masked.is_masked`.""" + return is_masked(x._seed)
+ + + +######################################################### +######################################################### + + +_StatisticsPayload = namedtuple("_StatisticsPayload", [ "operation", "multipliers", "starts" ]) + + +def _reduce_1darray(val: numpy.ndarray, payload: _StatisticsPayload, offset: int = 0): + for i, v in enumerate(val): + extra = payload.multipliers[-1] * (i + payload.starts[-1]) + payload.operation(offset + extra, v) + return + + +def _recursive_reduce_ndarray(x: numpy.ndarray, payload: _StatisticsPayload, dim: int, offset: int = 0): + mult = payload.multipliers[dim] + shift = payload.starts[dim] + if len(x.shape) == 2: + for i in range(x.shape[0]): + _reduce_1darray(x[i], payload, offset = offset + mult * (shift + i)) + else: + for i in range(x.shape[0]): + _recursive_reduce_ndarray(x[i], payload, dim = dim + 1, offset = offset + mult * (shift + i)) + return + + +def _reduce_ndarray(block: numpy.ndarray, multipliers: List[int], axes: List[int], position: Tuple[Tuple[int, int], ...], operation: Callable): + ndim = len(block.shape) + payload = _StatisticsPayload(operation=operation, multipliers=multipliers, starts=(*(s[0] for s in position),)) + if ndim == 1: + _reduce_1darray(block, payload) + else: + _recursive_reduce_ndarray(block, payload, dim=0) + return + + +def _reduce_sparse_vector(idx: numpy.ndarray, val: numpy.ndarray, payload: _StatisticsPayload, offset: int = 0): + for j, ix in enumerate(idx): + extra = payload.multipliers[0] * (ix + payload.starts[0]) + payload.operation(offset + extra, val[j]) + return + + +def _recursive_reduce_SparseNdarray(contents, payload: _StatisticsPayload, dim: int, offset: int = 0): + mult = payload.multipliers[dim] + start = payload.starts[dim] + if dim == 1: + for i, con in enumerate(contents): + if con is not None: + _reduce_sparse_vector(con[0], con[1], payload, offset = offset + mult * (i + start)) + else: + for i, con in enumerate(contents): + if con is not None: + _recursive_reduce_SparseNdarray(con, payload, dim = dim - 1, offset = offset + mult * (i + start)) + return + + +def _reduce_SparseNdarray(x: SparseNdarray, multipliers: List[int], axes: List[int], position: Tuple[Tuple[int, int], ...], operation: Callable): + if x.contents is not None: + payload = _StatisticsPayload(operation=operation, multipliers=multipliers, starts=(*(s[0] for s in position),)) + ndim = len(x.shape) + if ndim == 1: + _reduce_sparse_vector(x.contents[0], x.contents[1], payload) + else: + _recursive_reduce_SparseNdarray(x.contents, payload, dim=ndim - 1) + return + + +def _reduce(x: DelayedArray, axes: List[int], operation: Callable, buffer_size: Optional[int]): + multipliers = _create_offset_multipliers(x.shape, axes) + if is_sparse(x): + apply_over_blocks( + x, + lambda position, block : _reduce_SparseNdarray(block, multipliers, axes, position, operation), + buffer_size=buffer_size, + allow_sparse=True, + ) + else: + apply_over_blocks( + x, + lambda position, block : _reduce_ndarray(block, multipliers, axes, position, operation), + buffer_size=buffer_size, + ) + return +
+
+
+
+ + +
+
+ + Made with Sphinx and @pradyunsg's + + Furo + +
+
+ +
+
+ +
+
+ +
+
+ + + + + \ No newline at end of file diff --git a/_modules/delayedarray/DelayedOp.html b/_modules/delayedarray/DelayedOp.html new file mode 100644 index 0000000..6b557e0 --- /dev/null +++ b/_modules/delayedarray/DelayedOp.html @@ -0,0 +1,288 @@ + + + + + + + + delayedarray.DelayedOp - DelayedArray 0.6.2 documentation + + + + + + + + + + + + + + + + + Contents + + + + + + Menu + + + + + + + + Expand + + + + + + Light mode + + + + + + + + + + + + + + Dark mode + + + + + + + Auto light/dark, in light mode + + + + + + + + + + + + + + + Auto light/dark, in dark mode + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +Skip to content + + + +
+
+
+ +
+ +
+
+ +
+ +
+
+ +
+
+
+ + + + + Back to top + +
+
+ +
+ +
+
+

Source code for delayedarray.DelayedOp

+
+[docs] +class DelayedOp: + """ + Abstract delayed operation class. This is used to distinguish + delayed operations from seed classes, e.g., for use in + :py:meth:`~delayedarray.is_pristine.is_pristine`. + """ +
+[docs] + def __init__(): + pass
+
+ +
+
+
+
+ + +
+
+ + Made with Sphinx and @pradyunsg's + + Furo + +
+
+ +
+
+ +
+
+ +
+
+ + + + + \ No newline at end of file diff --git a/_modules/delayedarray/Grid.html b/_modules/delayedarray/Grid.html new file mode 100644 index 0000000..9a5b851 --- /dev/null +++ b/_modules/delayedarray/Grid.html @@ -0,0 +1,938 @@ + + + + + + + + delayedarray.Grid - DelayedArray 0.6.2 documentation + + + + + + + + + + + + + + + + + Contents + + + + + + Menu + + + + + + + + Expand + + + + + + Light mode + + + + + + + + + + + + + + Dark mode + + + + + + + Auto light/dark, in light mode + + + + + + + + + + + + + + + Auto light/dark, in dark mode + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +Skip to content + + + +
+
+
+ +
+ +
+
+ +
+ +
+
+ +
+
+
+ + + + + Back to top + +
+
+ +
+ +
+
+

Source code for delayedarray.Grid

+from typing import Tuple, Sequence, Optional, List, Generator, Dict
+import bisect
+import abc
+
+from ._subset import _is_single_subset_noop
+
+
+
+[docs] +class AbstractGrid(abc.ABC): + """ + Abstract base class for array grids. Each grid subdivides an array to + determine how it should be iterated over; this is useful for ensuring that + iteration respects the physical layout of an array. + + Subclasses should define the ``shape``, ``boundaries`` and ``cost`` + properties, as well as the ``subset``, ``transpose`` and ``iterate`` + methods; see the :py:class:`~SimpleGrid` and :py:class:`~CompositeGrid` + subclasses for examples. + """ + + @property + @abc.abstractmethod + def shape(self) -> Tuple[int, ...]: + pass + + + @property + @abc.abstractmethod + def cost(self) -> int: + pass + + + @property + @abc.abstractmethod + def boundaries(self) -> Tuple[Sequence[int], ...]: + pass + + +
+[docs] + @abc.abstractmethod + def transpose(self, perm: Tuple[int, ...]) -> "AbstractGrid": + pass
+ + + +
+[docs] + @abc.abstractmethod + def subset(self, subset: Tuple[Sequence[int], ...]) -> "AbstractGrid": + pass
+ + + +
+[docs] + @abc.abstractmethod + def iterate(self, dimensions: Tuple[int, ...], buffer_elements: int = 1e6) -> Generator[Tuple, None, None]: + pass
+
+ + + +############################################################ +############################################################ + + +
+[docs] +class SimpleGrid(AbstractGrid): + """ + A simple grid to subdivide an array, involving arbitrary boundaries on each + dimension. Each grid element is defined by boundaries on each dimension. + """ + +
+[docs] + def __init__(self, boundaries: Tuple[Sequence[int], ...], cost_factor: float, internals: Optional[Dict] = None): + """ + Args: + boundaries: + Tuple of length equal to the number of dimensions. Each entry + should be a strictly increasing sequence of integers specifying + the position of the grid boundaries; the last element should be + equal to the extent of the dimension for the array. A tuple + entry may also be an empty list for a zero-extent dimension. + + cost_factor: + Positive number representing the cost of iteration over each + element of the grid's array. The actual cost is defined by the + product of the cost factor by the array size. This is used to + choose between iteration schemes; as a reference, extraction + from an in-memory NumPy array has a cost factor of 1. + + internals: + Internal use only. + """ + self._boundaries = boundaries + + if internals is not None and "shape" in internals: + shape = internals["shape"] + else: + new_shape = [] + for bounds in boundaries: + if len(bounds): + new_shape.append(bounds[-1]) + else: + new_shape.append(0) + shape = (*new_shape,) + self._shape = shape + + if internals is not None and "maxgap" in internals: + maxgap = internals["maxgap"] + else: + maxgap = (*(SimpleGrid._define_maxgap(b) for b in boundaries),) + self._maxgap = maxgap + + if internals is not None and "cost" in internals: + cost = internals["cost"] + else: + cost = cost_factor + for s in shape: + cost *= s + self._cost = cost + self._cost_factor = cost_factor
+ + + + @staticmethod + def _define_maxgap(bounds): + last = 0 + curmax = 0 + for d in bounds: + gap = d - last + if gap > curmax: + curmax = gap + last = d + return curmax + + + @property + def shape(self) -> Tuple[int, ...]: + """ + Returns: + Shape of the grid, equivalent to the array's shape. + """ + return self._shape + + + @property + def boundaries(self) -> Tuple[Sequence[int], ...]: + """ + Returns: + Boundaries on each dimension of the grid. + """ + return self._boundaries + + + @property + def cost(self) -> float: + """ + Returns: + Cost of iteration over the underlying array. + """ + return self._cost + + +
+[docs] + def transpose(self, perm: Tuple[int, ...]) -> "SimpleGrid": + """ + Transpose a grid to reflect the same operation on the associated array. + + Args: + perm: + Tuple of length equal to the dimensionality of the array, + containing the permutation of dimensions. + + Returns: + A new ``SimpleGrid`` object. + """ + return SimpleGrid( + (*(self._boundaries[p] for p in perm),), + self._cost_factor, + internals = { # Save ourselves the trouble of recomputing these. + "shape": (*(self._shape[p] for p in perm),), + "maxgap": (*(self._maxgap[p] for p in perm),), + "cost": self._cost, + } + )
+ + + +
+[docs] + def subset(self, subset: Tuple[Sequence[int], ...]) -> "SimpleGrid": + """ + Subset a grid to reflect the same operation on the associated array. + For any given dimension, consecutive elements in the subset are only + placed in the same grid interval in the subsetted grid if they belong + to the same grid interval in the original grid. + + Args: + subset: + Tuple of length equal to the number of grid dimensions. Each + entry should be a (possibly unsorted) sequence of integers, + specifying the subset to apply to each dimension of the grid. + + Returns: + A new ``SimpleGrid`` object. + """ + if len(subset) != len(self._shape): + raise ValueError("'shape' and 'subset' should have the same length") + + new_boundaries = [] + new_shape = [] + new_maxgap = [] + for i, bounds in enumerate(self._boundaries): + cursub = subset[i] + if _is_single_subset_noop(self._shape[i], cursub): + new_boundaries.append(bounds) + new_shape.append(self._shape[i]) + new_maxgap.append(self._maxgap[i]) + else: + my_boundaries = [] + counter = 0 + if len(bounds): + last_chunk = -1 + for y in cursub: + cur_chunk = bisect.bisect_right(bounds, y) + if cur_chunk != last_chunk: + if counter > 0: + my_boundaries.append(counter) + last_chunk = cur_chunk + counter += 1 + my_boundaries.append(counter) + + new_boundaries.append(my_boundaries) + new_shape.append(counter) + new_maxgap.append(SimpleGrid._define_maxgap(my_boundaries)) + + return SimpleGrid( + (*new_boundaries,), + self._cost_factor, + internals = { + "shape": (*new_shape,), + "maxgap": (*new_maxgap,), + } + )
+ + + + def _recursive_iterate(self, dimension: int, used: List[bool], starts: List[int], ends: List[int], buffer_elements: int, prescale: List[int]): + bounds = self._boundaries[dimension] + full_end = self._shape[dimension] + + if used[dimension]: + # 'prescale' holds the worst-case minimum block sizes of the + # remaining dimensions (i.e., in the subsequent recursion levels). + # These are the worst-case because we assume that all remaining + # dimensions are using their maximum gap for a single grid interval + # to form a block, hence it's a conservative estimate of the space + # we have left to play with on the current dimenion. Note that this + # should only differ from buffer_elements when dimension > 0. + conservative_buffer_elements = max(1, buffer_elements // prescale[dimension]) + + start = 0 + pos = 0 + nb = len(bounds) + + while True: + if pos == nb: + # Wrapping up the last block, if the grid-breaking code + # has not already iterated to the end of the dimension. + if start != full_end: + starts[dimension] = start + ends[dimension] = full_end + if dimension == 0: + yield (*zip(starts, ends),) + else: + yield from self._recursive_iterate(dimension - 1, used, starts, ends, buffer_elements // (full_end - start), prescale) + break + + # Check if we can keep going to make a larger block. + current_end = bounds[pos] + if current_end - start <= conservative_buffer_elements: + pos += 1 + continue + + if pos: + previous_end = bounds[pos - 1] + else: + previous_end = 0 + + # Break grid intervals to force compliance with the buffer element limit. + if previous_end == start: + while start < current_end: + starts[dimension] = start + breaking_end = min(current_end, start + conservative_buffer_elements) + ends[dimension] = breaking_end + if dimension == 0: + yield (*zip(starts, ends),) + else: + # Next level of recursion uses buffer_elements, not its + # conservative counterpart, as the next level actually has + # knowledge of the boundaries for that dimension. + yield from self._recursive_iterate(dimension - 1, used, starts, ends, buffer_elements // (breaking_end - start), prescale) + start = breaking_end + pos += 1 + continue + + # Falling back to the last boundary that fit in the buffer limit. + starts[dimension] = start + ends[dimension] = previous_end + if dimension == 0: + yield (*zip(starts, ends),) + else: + yield from self._recursive_iterate(dimension - 1, used, starts, ends, buffer_elements // (previous_end - start), prescale) + start = previous_end + + else: + # If this dimension is not used, we return its entire extent. + starts[dimension] = 0 + ends[dimension] = full_end + if dimension == 0: + yield (*zip(starts, ends),) + else: + yield from self._recursive_iterate(dimension - 1, used, starts, ends, buffer_elements // full_end, prescale) + + +
+[docs] + def iterate(self, dimensions: Tuple[int, ...], buffer_elements: int = 1e6) -> Generator[Tuple, None, None]: + """ + Iterate over an array grid. This assembles blocks of contiguous grid + intervals to reduce the number of iterations (and associated overhead) + at the cost of increased memory usage during data extraction. + + Args: + dimensions: + Dimensions over which to perform the iteration. Any dimensions + not listed here are extracted in their entirety, i.e., each + block consists of the full extent of unlisted dimensions. + + buffer_elements: + Total number of elements in each block. Larger values increase + the block size and reduce the number of iterations, at the cost + of increased memory usage at each iteration. + + Returns: + A generator that returns a tuple of length equal to the number of + dimensions. Each element contains the start and end of the block + on its corresponding dimension. + """ + if 0 in self._shape: + return + + ndim = len(self._shape) + used = [False] * ndim + for d in dimensions: + used[d] = True + + # See comments above about 'prescale'. For each dimension, this + # contains the worst-case minimum block size from the remaining + # dimensions. For used dimensions, this is computed from the max gap; + # for unused dimensions, the full extent is applied. + prescale = [1] + for i in range(ndim - 1): + last = prescale[-1] + if used[i]: + last *= self._maxgap[i] + else: + last *= self._shape[i] + prescale.append(last) + + starts = [0] * ndim + ends = [0] * ndim + yield from self._recursive_iterate(ndim - 1, used, starts, ends, buffer_elements, prescale)
+
+ + + +############################################################ +############################################################ + + +
+[docs] +class CompositeGrid(AbstractGrid): + """ + A grid to subdivide an array, constructed by combining component grids + along a specified dimension. This aims to mirror the same combining + operation for the arrays associated with the component grids. + """ + +
+[docs] + def __init__(self, components: Tuple[AbstractGrid, ...], along: int, internals: Optional[Dict] = None): + """ + Args: + components: + Component grids to be combined to form the composite grid. + Each grid should have the same dimension extents, except for + the ``along`` dimension. + + along: + Dimension over which to combine entries of ``components``. + + internals: + Internal use only. + """ + self._components = components + self._along = along + + if internals is not None and "shape" in internals: + shape = internals["shape"] + else: + first = components[0] + new_shape = list(first.shape) + for i in range(1, len(components)): + current = components[i] + for j, d in enumerate(current.shape): + if j == along: + new_shape[j] += d + elif new_shape[j] != d: + raise ValueError("entries of 'components' should have the same shape on all dimensions except 'along'") + shape = (*new_shape,) + self._shape = shape + + if internals is not None and "boundaries" in internals: + boundaries = internals["boundaries"] + else: + boundaries = None + self._boundaries = boundaries + + if internals is not None and "cost" in internals: + cost = internals["cost"] + else: + cost = 0 + for comp in self._components: + cost += comp.cost + self._cost = cost
+ + + + @property + def shape(self) -> Tuple[int, ...]: + """ + Returns: + Shape of the grid, equivalent to the array's shape. + """ + return self._shape + + + @property + def boundaries(self) -> Tuple[Sequence[int], ...]: + """ + Returns: + Boundaries on each dimension of the grid. For the ``along`` + dimension, this is a concatenation of the boundaries for the + component grids. For all other dimensions, the boundaries are + set to those of the most costly component grid. + """ + if self._boundaries is None: # Lazy evaluation + chosen, maxcost = self._maxcost() + new_boundaries = list(self._components[chosen].boundaries) + replacement = [] + offset = 0 + + for i, comp in enumerate(self._components): + if i == chosen: + addition = new_boundaries[self._along] + else: + addition = comp.boundaries[self._along] + for a in addition: + replacement.append(a + offset) + offset += comp.shape[self._along] + + new_boundaries[self._along] = replacement + self._boundaries = (*new_boundaries,) + + return self._boundaries + + + @property + def cost(self) -> float: + """ + Returns: + Cost of iteration over the underlying array. This is defined + as the sum of the costs of the component arrays. + """ + return self._cost + + + def _maxcost(self) -> Tuple[int, float]: + chosen = 0 + maxcost = 0 + for i, comp in enumerate(self._components): + if isinstance(comp, CompositeGrid): + tmp, curcost = comp._maxcost() + else: + curcost = comp.cost + if curcost > maxcost: + maxcost = curcost + chosen = i + return chosen, maxcost + + +
+[docs] + def transpose(self, perm: Tuple[int, ...]) -> "CompositeGrid": + """ + Transpose a grid to reflect the same operation on the associated array. + + Args: + perm: + Tuple of length equal to the dimensionality of the array, + containing the permutation of dimensions. + + Returns: + A new ``CompositeGrid`` object. + """ + new_components = [grid.transpose(perm) for grid in self._components] + + new_along = 0 + for i, p in enumerate(perm): + if p == self._along: + new_along = i + + internals = { "cost": self._cost } + if self._boundaries is not None: + internals["boundaries"] = (*(self._boundaries[p] for p in perm),) + + return CompositeGrid( + new_components, + new_along, + internals = internals, + )
+ + + +
+[docs] + def subset(self, subset: Tuple[Sequence[int], ...]) -> "CompositeGrid": + """ + Subset a grid to reflect the same operation on the associated array. + This splits up the subset sequence for the ``along`` dimension and + distributes it to each of the component grids. + + Args: + subset: + Tuple of length equal to the number of grid dimensions. Each + entry should be a (possibly unsorted) sequence of integers, + specifying the subset to apply to each dimension of the grid. + + Returns: + A new ``CompositeGrid`` object. + """ + if len(subset) != len(self._shape): + raise ValueError("'shape' and 'subset' should have the same length") + + if _is_single_subset_noop(self._shape[self._along], subset[self._along]): + new_components = [] + new_subset = list(subset) + for grid in self._components: + new_subset[self._along] = range(grid.shape[self._along]) + new_components.append(grid.subset((*new_subset,))) + return CompositeGrid(new_components, self._along) + + component_limits = [] + counter = 0 + for y in self._components: + counter += y.shape[self._along] + component_limits.append(counter) + + last_choice = -1 + new_components = [] + sofar = [] + raw_subset = list(subset) + + for s in subset[self._along]: + choice = bisect.bisect_left(component_limits, s) + if choice != last_choice: + if len(sofar): + raw_subset[self._along] = sofar + new_components.append(self._components[last_choice].subset((*raw_subset,))) + sofar = [] + last_choice = choice + if choice: + sofar.append(s - component_limits[choice - 1]) + else: + sofar.append(s) + + if len(sofar): + raw_subset[self._along] = sofar + new_components.append(self._components[last_choice].subset((*raw_subset,))) + + new_shape = [] + for i, s in enumerate(subset): + if s is None: + new_shape.append(self._shape[i]) + else: + new_shape.append(len(s)) + + return CompositeGrid( + new_components, + self._along, + internals = { + "shape": (*new_shape,), + } + )
+ + + +
+[docs] + def iterate(self, dimensions: Tuple[int, ...], buffer_elements: int = 1e6) -> Generator[Tuple, None, None]: + """ + Iterate over an array grid. This assembles blocks of contiguous grid + intervals to reduce the number of iterations (and associated overhead) + at the cost of increased memory usage during data extraction. For any + iteration over the ``along`` dimension (i.e., ``along`` is in + ``dimensions``), this function dispatches to the component grids; + otherwise the iteration is performed based on :py:meth:`~boundaries`. + + Args: + dimensions: + Dimensions over which to perform the iteration. Any dimensions + not listed here are extracted in their entirety, i.e., each + block consists of the full extent of unlisted dimensions. + + buffer_elements: + Total number of elements in each block. Larger values increase + the block size and reduce the number of iterations, at the cost + of increased memory usage at each iteration. + + Returns: + A generator that returns a tuple of length equal to the number of + dimensions. Each element contains the start and end of the block + on its corresponding dimension. + """ + if 0 in self._shape: + return + + if self._along in dimensions: + first = True + offset = 0 + for grid in self._components: + for block in grid.iterate(dimensions=dimensions, buffer_elements=buffer_elements): + if offset == 0: + yield block + else: + copy = list(block) + comp = copy[self._along] + copy[self._along] = (comp[0] + offset, comp[1] + offset) + yield (*copy,) + offset += grid.shape[self._along] + return + + temp = SimpleGrid(self.boundaries, cost_factor=1) + yield from temp.iterate(dimensions=dimensions, buffer_elements=buffer_elements)
+
+ +
+
+
+
+ + +
+
+ + Made with Sphinx and @pradyunsg's + + Furo + +
+
+ +
+
+ +
+
+ +
+
+ + + + + \ No newline at end of file diff --git a/_modules/delayedarray/RegularTicks.html b/_modules/delayedarray/RegularTicks.html new file mode 100644 index 0000000..4d8b59c --- /dev/null +++ b/_modules/delayedarray/RegularTicks.html @@ -0,0 +1,354 @@ + + + + + + + + delayedarray.RegularTicks - DelayedArray 0.6.2 documentation + + + + + + + + + + + + + + + + + Contents + + + + + + Menu + + + + + + + + Expand + + + + + + Light mode + + + + + + + + + + + + + + Dark mode + + + + + + + Auto light/dark, in light mode + + + + + + + + + + + + + + + Auto light/dark, in dark mode + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +Skip to content + + + +
+
+
+ +
+ +
+
+ +
+ +
+
+ +
+
+
+ + + + + Back to top + +
+
+ +
+ +
+
+

Source code for delayedarray.RegularTicks

+import collections
+
+
+
+[docs] +class RegularTicks(collections.abc.Sequence): + """ + Regular ticks of equal spacing until a limit is reached, at which point the + sequence terminates at that limit. This is intended for use as grid + boundaries in :py:class:`~delayedarray.Grid.SimpleGrid`, where the last + element of the boundary sequence needs to be equal to the grid extent. (We + do not use :py:class:`~range` as it may omit the last element if the extent + is not a multiple of the spacing.) + """ + +
+[docs] + def __init__(self, spacing: int, final: int): + """ + Args: + spacing: + Positive integer specifying the spacing between ticks. + + final: + Position of the final tick, should be non-negative. + """ + if spacing <= 0: + raise ValueError("spacing should be positive") + if final < 0: + raise ValueError("final should be positive") + self._spacing = spacing + self._final = final + self._len = (final // spacing) + (final % spacing > 0)
+ + +
+[docs] + def __len__(self) -> int: + """ + Returns: + Length of the tick sequence. + """ + return self._len
+ + +
+[docs] + def __getitem__(self, i: int) -> int: + """ + Args: + i: Index of the tick of interest. + + Returns: + Position of tick ``i``. + """ + if i < 0: + i += self._len + if i < 0: + raise IndexError("'i' is out of range") + elif i >= self._len: + raise IndexError("'i' is out of range") + return min(self._final, self._spacing * (i + 1))
+ + + @property + def spacing(self) -> int: + """ + Returns: + The spacing between ticks. + """ + return self._spacing + + @property + def final(self) -> int: + """ + Returns: + Position of the final tick. + """ + return self._final
+ +
+
+
+
+ + +
+
+ + Made with Sphinx and @pradyunsg's + + Furo + +
+
+ +
+
+ +
+
+ +
+
+ + + + + \ No newline at end of file diff --git a/_modules/delayedarray/Round.html b/_modules/delayedarray/Round.html new file mode 100644 index 0000000..5f03df7 --- /dev/null +++ b/_modules/delayedarray/Round.html @@ -0,0 +1,415 @@ + + + + + + + + delayedarray.Round - DelayedArray 0.6.2 documentation + + + + + + + + + + + + + + + + + Contents + + + + + + Menu + + + + + + + + Expand + + + + + + Light mode + + + + + + + + + + + + + + Dark mode + + + + + + + Auto light/dark, in light mode + + + + + + + + + + + + + + + Auto light/dark, in dark mode + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +Skip to content + + + +
+
+
+ +
+ +
+
+ +
+ +
+
+ +
+
+
+ + + + + Back to top + +
+
+ +
+ +
+
+

Source code for delayedarray.Round

+from typing import Callable, Tuple, Sequence
+import numpy
+from numpy import dtype
+
+from .DelayedOp import DelayedOp
+from .SparseNdarray import SparseNdarray
+from .extract_dense_array import extract_dense_array
+from .extract_sparse_array import extract_sparse_array
+from .create_dask_array import create_dask_array
+from .chunk_grid import chunk_grid
+from .is_sparse import is_sparse
+from .is_masked import is_masked
+
+__author__ = "ltla"
+__copyright__ = "ltla"
+__license__ = "MIT"
+
+
+
+[docs] +class Round(DelayedOp): + """ + Delayed rounding from :py:meth:`~numpy.round`. This is very similar to + :py:class:`~delayedarray.UnaryIsometricOpSimple.UnaryIsometricOpSimple` but + accepts an argument for the number of decimal places. + + This class is intended for developers to construct new + :py:class:`~delayedarray.DelayedArray.DelayedArray` instances. End users + should not be interacting with ``Round`` objects directly. + """ + +
+[docs] + def __init__(self, seed, decimals: int): + """ + Args: + seed: + Any object that satisfies the seed contract, + see :py:class:`~delayedarray.DelayedArray.DelayedArray` for details. + + decimals (int): + Number of decimal places, possibly negative. + """ + self._seed = seed + self._decimals = decimals
+ + + @property + def shape(self) -> Tuple[int, ...]: + """ + Returns: + Tuple of integers specifying the extent of each dimension of the + ``Round`` object. This is the same as the ``seed`` array. + """ + return self._seed.shape + + @property + def dtype(self) -> dtype: + """ + + Returns: + NumPy type for the ``Round``, same as the ``seed`` array. + """ + return self._seed.dtype + + @property + def seed(self): + """ + Returns: + The seed object. + """ + return self._seed + + @property + def decimals(self) -> int: + """ + Returns: + Number of decimal places to round to. + """ + return self._decimals
+ + + +def _extract_array(x: Round, subset: Tuple[Sequence[int], ...], f: Callable): + target = f(x._seed, subset) + return numpy.round(target, decimals=x._decimals) + + +
+[docs] +@extract_dense_array.register +def extract_dense_array_Round(x: Round, subset: Tuple[Sequence[int], ...]) -> numpy.ndarray: + """See :py:meth:`~delayedarray.extract_dense_array.extract_dense_array`.""" + return _extract_array(x, subset, extract_dense_array)
+ + + +
+[docs] +@extract_sparse_array.register +def extract_sparse_array_Round(x: Round, subset: Tuple[Sequence[int], ...]) -> SparseNdarray: + """See :py:meth:`~delayedarray.extract_sparse_array.extract_sparse_array`.""" + return _extract_array(x, subset, extract_sparse_array)
+ + + +
+[docs] +@create_dask_array.register +def create_dask_array_Round(x: Round): + """See :py:meth:`~delayedarray.create_dask_array.create_dask_array`.""" + target = create_dask_array(x._seed) + return numpy.round(target, decimals=x._decimals)
+ + + +
+[docs] +@chunk_grid.register +def chunk_grid_Round(x: Round): + """See :py:meth:`~delayedarray.chunk_grid.chunk_grid`.""" + return chunk_grid(x._seed)
+ + + +
+[docs] +@is_sparse.register +def is_sparse_Round(x: Round): + """See :py:meth:`~delayedarray.is_sparse.is_sparse`.""" + return is_sparse(x._seed)
+ + + +
+[docs] +@is_masked.register +def is_masked_Round(x: Round): + """See :py:meth:`~delayedarray.is_masked.is_masked`.""" + return is_masked(x._seed)
+ +
+
+
+
+ + +
+
+ + Made with Sphinx and @pradyunsg's + + Furo + +
+
+ +
+
+ +
+
+ +
+
+ + + + + \ No newline at end of file diff --git a/_modules/delayedarray/SparseNdarray.html b/_modules/delayedarray/SparseNdarray.html new file mode 100644 index 0000000..4c5ca52 --- /dev/null +++ b/_modules/delayedarray/SparseNdarray.html @@ -0,0 +1,2320 @@ + + + + + + + + delayedarray.SparseNdarray - DelayedArray 0.6.2 documentation + + + + + + + + + + + + + + + + + Contents + + + + + + Menu + + + + + + + + Expand + + + + + + Light mode + + + + + + + + + + + + + + Dark mode + + + + + + + Auto light/dark, in light mode + + + + + + + + + + + + + + + Auto light/dark, in dark mode + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +Skip to content + + + +
+
+
+ +
+ +
+
+ +
+ +
+
+ +
+
+
+ + + + + Back to top + +
+
+ +
+ +
+
+

Source code for delayedarray.SparseNdarray

+from bisect import bisect_left
+from typing import Callable, List, Optional, Sequence, Tuple, Union
+from collections import namedtuple
+import numpy
+import copy
+
+from ._isometric import translate_ufunc_to_op_simple, translate_ufunc_to_op_with_args, ISOMETRIC_OP_WITH_ARGS, _choose_operator, _infer_along_with_args
+from ._subset import _spawn_indices, _getitem_subset_preserves_dimensions, _getitem_subset_discards_dimensions, _repr_subset
+from ._mask import (
+    _allocate_unmasked_ndarray, 
+    _allocate_maybe_masked_ndarray, 
+    _convert_to_unmasked_1darray, 
+    _convert_to_maybe_masked_1darray,
+    _concatenate_unmasked_ndarrays,
+    _concatenate_maybe_masked_ndarrays
+)
+from ._statistics import array_mean, array_var, array_sum, _create_offset_multipliers, array_all, array_any
+
+__author__ = "ltla"
+__copyright__ = "ltla"
+__license__ = "MIT"
+
+
+
+[docs] +class SparseNdarray: + """ + The ``SparseNdarray``, as its name suggests, is a sparse n-dimensional + array. It is inspired by the ``SVT_Array`` class from the `DelayedArray + R/Bioconductor package <https://bioconductor.org/packages/DelayedArray>`_. + + Internally, the ``SparseNdarray`` is represented as a nested list where + each nesting level corresponds to a dimension in reverse order, i.e., the + outer-most list corresponds to elements of the last dimension in ``shape``. + The list at each level has length equal to the extent of its dimension, + where each entry contains another list representing the contents of the + corresponding element of that dimension. This recursion continues until the + second dimension (i.e., the penultimate nesting level), where each entry + instead contains ``(index, value)`` tuples. In effect, this is a tree where + the non-leaf nodes are lists and the leaf nodes are tuples. + + Each ``(index, value)`` tuple represents a sparse vector for the + corresponding element of the first dimension of the ``SparseNdarray``. + ``index`` should be a :py:class:`~numpy.ndarray` of integers where entries + are strictly increasing and less than the extent of the first dimension. + All ``index`` objects in the same ``SparseNdarray`` should have the same + ``dtype`` (defined by the ``index_dtype`` property). ``value`` may be any + numeric/boolean :py:class:`~numpy.ndarray` but the ``dtype`` should be + consistent across all ``value`` objects in the ``SparseNdarray``. If the + array contains masked values, all ``value`` objects should be a + ``MaskedArray``, otherwise they should be regular NumPy arrays. + + Any entry of any (nested) list may also be None, indicating that the + corresponding element of the dimension contains no non-zero values. In + fact, the entire tree may be None, indicating that there are no non-zero + values in the entire array. + + For 1-dimensional arrays, the contents should be a single ``(index, + value)`` tuple containing the sparse contents. This may also be None if + there are no non-zero values in the array. + """ + +
+[docs] + def __init__( + self, + shape: Tuple[int, ...], + contents, + dtype: Optional[numpy.dtype] = None, + index_dtype: Optional[numpy.dtype] = None, + is_masked: Optional[bool] = None, + check: bool = True, + ): + """ + Args: + shape: + Tuple specifying the dimensions of the array. + + contents: + For ``n``-dimensional arrays where ``n`` > 1, a nested list representing a + tree where each leaf node is a tuple containing a sparse vector (or None). + + For 1-dimensional arrays, a tuple containing a sparse vector. + + Alternatively None, if the array is empty. + + dtype: + NumPy type of the array values. + If None, this is inferred from ``contents``. + + index_dtype: + NumPy type of the array indices. + If None, this is inferred from ``contents``. + + is_masked: + Whether ``contents`` contains masked values. + If None, this is inferred from ``contents``. + + check: + Whether to check the consistency of the ``contents`` during construction. + This can be set to False for speed. + """ + + self._shape = shape + self._contents = contents + ndim = len(shape) + + if dtype is None or index_dtype is None or is_masked is None: + if contents is not None: + if ndim > 1: + info = _peek(contents, dim=ndim-1) + if info is not None: + index_dtype0 = info[0] + dtype0 = info[1] + is_masked0 = info[2] + else: + dtype0 = None + index_dtype0 = None + is_masked0 = False + else: + index_dtype0 = contents[0].dtype + dtype0 = contents[1].dtype + is_masked0 = numpy.ma.isMaskedArray(contents[1]) + + if dtype is None: + dtype = dtype0 + if index_dtype is None: + index_dtype = index_dtype0 + if is_masked is None: + is_masked = is_masked0 + + if dtype is None: + raise ValueError("cannot infer 'dtype' from 'contents'") + if index_dtype is None: + raise ValueError("cannot infer 'index_dtype' from 'contents'") + if is_masked is None: + is_masked = False + + # Sometimes people put the numpy data class instead of the dtype. + # It's a common enough mistake that we ought to catch it here. + if not isinstance(dtype, numpy.dtype): + dtype = numpy.dtype(dtype) + if not isinstance(index_dtype, numpy.dtype): + index_dtype = numpy.dtype(index_dtype) + + self._dtype = dtype + self._index_dtype = index_dtype + self._is_masked = is_masked + + if check is True and contents is not None: + payload = _CheckPayload(dtype=self._dtype, index_dtype=self._index_dtype, is_masked=self._is_masked, max_index=self._shape[0]) + if len(shape) > 1: + _recursive_check(self._contents, self._shape, payload=payload, dim=ndim-1) + else: + _check_sparse_tuple(self._contents[0], self._contents[1], payload=payload)
+ + + @property + def shape(self) -> Tuple[int, ...]: + """ + Returns: + Tuple of integers specifying the extent of each dimension. + """ + return self._shape + + @property + def dtype(self) -> numpy.dtype: + """ + Returns: + NumPy type of the values. + """ + return self._dtype + + + @property + def index_dtype(self) -> numpy.dtype: + """ + Returns: + NumPy type of the indices. + """ + return self._index_dtype + + + @property + def is_masked(self) -> bool: + """ + Returns: + Whether the values are masked. + """ + return self._is_masked + + + @property + def contents(self): + """Contents of the array. This is intended to be read-only and + should only be modified if you really know what you're doing. + + Returns: + A nested list, for a n-dimensional array where n > 1. + + A tuple containing a sparse vector (i.e., indices and values), for a 1-dimensional array. + + Alternatively None, if the array contains no non-zero elements. + """ + return self._contents + + +
+[docs] + def __repr__(self) -> str: + """ + Pretty-print this ``SparseNdarray``. This uses + :py:func:`~numpy.array2string` and responds to all of its options. + + Returns: + String containing a prettified display of the array contents. + """ + preamble = "<" + " x ".join([str(x) for x in self._shape]) + ">" + preamble += " " + type(self).__name__ + " object of type '" + self._dtype.name + "'" + indices = _repr_subset(self._shape) + bits_and_pieces = _extract_dense_array_from_SparseNdarray(self, indices) + converted = numpy.array2string(bits_and_pieces, separator=", ", threshold=0) + return preamble + "\n" + converted
+ + + + # For NumPy: +
+[docs] + def __array__(self, dtype: Optional[numpy.dtype] = None, copy: bool = True) -> numpy.ndarray: + """Convert a ``SparseNdarray`` to a NumPy array. + + Args: + dtype: + The desired NumPy type of the output array. If None, the + type of the seed is used. + + copy: + Currently ignored. The output is never a reference to the + underlying seed, even if the seed is another NumPy array. + + Returns: + Dense array of the same type as :py:attr:`~dtype` and shape as + :py:attr:`~shape`. + """ + indices = _spawn_indices(self._shape) + return _extract_dense_array_from_SparseNdarray(self, indices, dtype=dtype)
+ + + # Assorted dunder methods. +
+[docs] + def __add__(self, other) -> Union["SparseNdarray", numpy.ndarray]: + """Add something to the right-hand-side of a ``SparseNdarray``. + + Args: + other: + A numeric scalar; + or a NumPy array with dimensions as described in + :py:class:`~delayedarray.UnaryIsometricOpWithArgs.UnaryIsometricOpWithArgs`; + or any seed object of the same dimensions as :py:attr:`~shape`. + + Returns: + Array containing the result of the addition. + This may or may not be sparse depending on ``other``. + """ + return _operate_with_args_on_SparseNdarray(self, other, operation="add", right=True)
+ + +
+[docs] + def __radd__(self, other) -> Union["SparseNdarray", numpy.ndarray]: + """Add something to the left-hand-side of a ``SparseNdarray``. + + Args: + other: + A numeric scalar; + or a NumPy array with dimensions as described in + :py:class:`~delayedarray.UnaryIsometricOpWithArgs.UnaryIsometricOpWithArgs`; + or any seed object of the same dimensions as :py:attr:`~shape`. + + Returns: + Array containing the result of the addition. + This may or may not be sparse depending on ``other``. + """ + return _operate_with_args_on_SparseNdarray(self, other, operation="add", right=False)
+ + +
+[docs] + def __sub__(self, other) -> Union["SparseNdarray", numpy.ndarray]: + """Subtract something from the right-hand-side of a ``SparseNdarray``. + + Args: + other: + A numeric scalar; + or a NumPy array with dimensions as described in + :py:class:`~delayedarray.UnaryIsometricOpWithArgs.UnaryIsometricOpWithArgs`; + or any seed object of the same dimensions as :py:attr:`~shape`. + + Returns: + Array containing the result of the subtraction. + This may or may not be sparse depending on ``other``. + """ + return _operate_with_args_on_SparseNdarray(self, other, operation="subtract", right=True)
+ + +
+[docs] + def __rsub__(self, other): + """Subtract a ``SparseNdarray`` from something else. + + Args: + other: + A numeric scalar; + or a NumPy array with dimensions as described in + :py:class:`~delayedarray.UnaryIsometricOpWithArgs.UnaryIsometricOpWithArgs`; + or any seed object of the same dimensions as :py:attr:`~shape`. + + Returns: + Array containing the result of the subtraction. + This may or may not be sparse depending on ``other``. + """ + return _operate_with_args_on_SparseNdarray(self, other, operation="subtract", right=False)
+ + +
+[docs] + def __mul__(self, other): + """Multiply a ``SparseNdarray`` with something on the right hand side. + + Args: + other: + A numeric scalar; + or a NumPy array with dimensions as described in + :py:class:`~delayedarray.UnaryIsometricOpWithArgs.UnaryIsometricOpWithArgs`; + or any seed object of the same dimensions as :py:attr:`~shape`. + + Returns: + Array containing the result of the multiplication. + This may or may not be sparse depending on ``other``. + """ + return _operate_with_args_on_SparseNdarray(self, other, operation="multiply", right=True)
+ + +
+[docs] + def __rmul__(self, other): + """Multiply a ``SparseNdarray`` with something on the left hand side. + + Args: + other: + A numeric scalar; + or a NumPy array with dimensions as described in + :py:class:`~delayedarray.UnaryIsometricOpWithArgs.UnaryIsometricOpWithArgs`; + or any seed object of the same dimensions as :py:attr:`~shape`. + + Returns: + Array containing the result of the multiplication. + This may or may not be sparse depending on ``other``. + """ + return _operate_with_args_on_SparseNdarray(self, other, operation="multiply", right=False)
+ + +
+[docs] + def __truediv__(self, other): + """Divide a ``SparseNdarray`` by something. + + Args: + other: + A numeric scalar; + or a NumPy array with dimensions as described in + :py:class:`~delayedarray.UnaryIsometricOpWithArgs.UnaryIsometricOpWithArgs`; + or any seed object of the same dimensions as :py:attr:`~shape`. + + Returns: + Array containing the result of the division. + This may or may not be sparse depending on ``other``. + """ + return _operate_with_args_on_SparseNdarray(self, other, operation="divide", right=True)
+ + +
+[docs] + def __rtruediv__(self, other): + """Divide something by a ``SparseNdarray``. + + Args: + other: + A numeric scalar; + or a NumPy array with dimensions as described in + :py:class:`~delayedarray.UnaryIsometricOpWithArgs.UnaryIsometricOpWithArgs`; + or any seed object of the same dimensions as :py:attr:`~shape`. + + Returns: + Array containing the result of the division. + This may or may not be sparse depending on ``other``. + """ + return _operate_with_args_on_SparseNdarray(self, other, operation="divide", right=False)
+ + +
+[docs] + def __mod__(self, other): + """Take the remainder after dividing a ``SparseNdarray`` by something. + + Args: + other: + A numeric scalar; + or a NumPy array with dimensions as described in + :py:class:`~delayedarray.UnaryIsometricOpWithArgs.UnaryIsometricOpWithArgs`; + or any seed object of the same dimensions as :py:attr:`~shape`. + + Returns: + Array containing the result of the modulo. + This may or may not be sparse depending on ``other``. + """ + return _operate_with_args_on_SparseNdarray(self, other, operation="remainder", right=True)
+ + +
+[docs] + def __rmod__(self, other): + """Take the remainder after dividing something by a ``SparseNdarray``. + + Args: + other: + A numeric scalar; + or a NumPy array with dimensions as described in + :py:class:`~delayedarray.UnaryIsometricOpWithArgs.UnaryIsometricOpWithArgs`; + or any seed object of the same dimensions as :py:attr:`~shape`. + + Returns: + Array containing the result of the modulo. + This may or may not be sparse depending on ``other``. + """ + return _operate_with_args_on_SparseNdarray( + self, other, operation="remainder", right=False + )
+ + +
+[docs] + def __floordiv__(self, other): + """Divide a ``SparseNdarray`` by something and take the floor. + + Args: + other: + A numeric scalar; + or a NumPy array with dimensions as described in + :py:class:`~delayedarray.UnaryIsometricOpWithArgs.UnaryIsometricOpWithArgs`; + or any seed object of the same dimensions as :py:attr:`~shape`. + + Returns: + Array containing the result of the floor division. + This may or may not be sparse depending on ``other``. + """ + return _operate_with_args_on_SparseNdarray( + self, other, operation="floor_divide", right=True + )
+ + +
+[docs] + def __rfloordiv__(self, other): + """Divide something by a ``SparseNdarray`` and take the floor. + + Args: + other: + A numeric scalar; + or a NumPy array with dimensions as described in + :py:class:`~delayedarray.UnaryIsometricOpWithArgs.UnaryIsometricOpWithArgs`; + or any seed object of the same dimensions as :py:attr:`~shape`. + + Returns: + Array containing the result of the floor division. + This may or may not be sparse depending on ``other``. + """ + return _operate_with_args_on_SparseNdarray( + self, other, operation="floor_divide", right=False + )
+ + +
+[docs] + def __pow__(self, other): + """Raise a ``SparseNdarray`` to the power of something. + + Args: + other: + A numeric scalar; + or a NumPy array with dimensions as described in + :py:class:`~delayedarray.UnaryIsometricOpWithArgs.UnaryIsometricOpWithArgs`; + or any seed object of the same dimensions as :py:attr:`~shape`. + + Returns: + Array containing the result of the power operation. + This may or may not be sparse depending on ``other``. + """ + return _operate_with_args_on_SparseNdarray(self, other, operation="power", right=True)
+ + +
+[docs] + def __rpow__(self, other): + """Raise something to the power of the contents of a ``SparseNdarray``. + + Args: + other: + A numeric scalar; + or a NumPy array with dimensions as described in + :py:class:`~delayedarray.UnaryIsometricOpWithArgs.UnaryIsometricOpWithArgs`; + or any seed object of the same dimensions as :py:attr:`~shape`. + + Returns: + Array containing the result of the power operation. + This may or may not be sparse depending on ``other``. + """ + return _operate_with_args_on_SparseNdarray(self, other, operation="power", right=False)
+ + +
+[docs] + def __eq__(self, other) -> Union["SparseNdarray", numpy.ndarray]: + """Check for equality between a ``SparseNdarray`` and something. + + Args: + other: + A numeric scalar; + or a NumPy array with dimensions as described in + :py:class:`~delayedarray.UnaryIsometricOpWithArgs.UnaryIsometricOpWithArgs`; + or any seed object of the same dimensions as :py:attr:`~shape`. + + Returns: + Array containing the result of the check. + This may or may not be sparse depending on ``other``. + """ + return _operate_with_args_on_SparseNdarray(self, other, operation="equal", right=True)
+ + +
+[docs] + def __req__(self, other) -> Union["SparseNdarray", numpy.ndarray]: + """Check for equality between something and a ``SparseNdarray``. + + Args: + other: + A numeric scalar; + or a NumPy array with dimensions as described in + :py:class:`~delayedarray.UnaryIsometricOpWithArgs.UnaryIsometricOpWithArgs`; + or any seed object of the same dimensions as :py:attr:`~shape`. + + Returns: + Array containing the result of the check. + This may or may not be sparse depending on ``other``. + """ + return _operate_with_args_on_SparseNdarray(self, other, operation="equal", right=False)
+ + +
+[docs] + def __ne__(self, other) -> Union["SparseNdarray", numpy.ndarray]: + """Check for non-equality between a ``SparseNdarray`` and something. + + Args: + other: + A numeric scalar; + or a NumPy array with dimensions as described in + :py:class:`~delayedarray.UnaryIsometricOpWithArgs.UnaryIsometricOpWithArgs`; + or any seed object of the same dimensions as :py:attr:`~shape`. + + Returns: + Array containing the result of the check. + This may or may not be sparse depending on ``other``. + """ + return _operate_with_args_on_SparseNdarray(self, other, operation="not_equal", right=True)
+ + +
+[docs] + def __rne__(self, other) -> Union["SparseNdarray", numpy.ndarray]: + """Check for non-equality between something and a ``SparseNdarray``. + + Args: + other: + A numeric scalar; + or a NumPy array with dimensions as described in + :py:class:`~delayedarray.UnaryIsometricOpWithArgs.UnaryIsometricOpWithArgs`; + or any seed object of the same dimensions as :py:attr:`~shape`. + + Returns: + Array containing the result of the check. + This may or may not be sparse depending on ``other``. + """ + return _operate_with_args_on_SparseNdarray(self, other, operation="not_equal", right=False)
+ + +
+[docs] + def __ge__(self, other) -> Union["SparseNdarray", numpy.ndarray]: + """Check whether a ``SparseNdarray`` is greater than or equal to something. + + Args: + other: + A numeric scalar; + or a NumPy array with dimensions as described in + :py:class:`~delayedarray.UnaryIsometricOpWithArgs.UnaryIsometricOpWithArgs`; + or any seed object of the same dimensions as :py:attr:`~shape`. + + Returns: + Array containing the result of the check. + This may or may not be sparse depending on ``other``. + """ + return _operate_with_args_on_SparseNdarray(self, other, operation="greater_equal", right=True)
+ + +
+[docs] + def __rge__(self, other) -> Union["SparseNdarray", numpy.ndarray]: + """Check whether something is greater than or equal to a ``SparseNdarray``. + + Args: + other: + A numeric scalar; + or a NumPy array with dimensions as described in + :py:class:`~delayedarray.UnaryIsometricOpWithArgs.UnaryIsometricOpWithArgs`; + or any seed object of the same dimensions as :py:attr:`~shape`. + + Returns: + Array containing the result of the check. + This may or may not be sparse depending on ``other``. + """ + return _operate_with_args_on_SparseNdarray( + self, other, operation="greater_equal", right=False + )
+ + +
+[docs] + def __le__(self, other) -> Union["SparseNdarray", numpy.ndarray]: + """Check whether a ``SparseNdarray`` is less than or equal to something. + + Args: + other: + A numeric scalar; + or a NumPy array with dimensions as described in + :py:class:`~delayedarray.UnaryIsometricOpWithArgs.UnaryIsometricOpWithArgs`; + or any seed object of the same dimensions as :py:attr:`~shape`. + + Returns: + Array containing the result of the check. + This may or may not be sparse depending on ``other``. + """ + return _operate_with_args_on_SparseNdarray( + self, other, operation="less_equal", right=True + )
+ + +
+[docs] + def __rle__(self, other) -> Union["SparseNdarray", numpy.ndarray]: + """Check whether something is greater than or equal to a ``SparseNdarray``. + + Args: + other: + A numeric scalar; + or a NumPy array with dimensions as described in + :py:class:`~delayedarray.UnaryIsometricOpWithArgs.UnaryIsometricOpWithArgs`; + or any seed object of the same dimensions as :py:attr:`~shape`. + + Returns: + Array containing the result of the check. + This may or may not be sparse depending on ``other``. + """ + return _operate_with_args_on_SparseNdarray( + self, other, operation="less_equal", right=False + )
+ + +
+[docs] + def __gt__(self, other) -> Union["SparseNdarray", numpy.ndarray]: + """Check whether a ``SparseNdarray`` is greater than something. + + Args: + other: + A numeric scalar; + or a NumPy array with dimensions as described in + :py:class:`~delayedarray.UnaryIsometricOpWithArgs.UnaryIsometricOpWithArgs`; + or any seed object of the same dimensions as :py:attr:`~shape`. + + Returns: + Array containing the result of the check. + This may or may not be sparse depending on ``other``. + """ + return _operate_with_args_on_SparseNdarray(self, other, operation="greater", right=True)
+ + +
+[docs] + def __rgt__(self, other) -> Union["SparseNdarray", numpy.ndarray]: + """Check whether something is greater than a ``SparseNdarray``. + + Args: + other: + A numeric scalar; + or a NumPy array with dimensions as described in + :py:class:`~delayedarray.UnaryIsometricOpWithArgs.UnaryIsometricOpWithArgs`; + or any seed object of the same dimensions as :py:attr:`~shape`. + + Returns: + Array containing the result of the check. + This may or may not be sparse depending on ``other``. + """ + return _operate_with_args_on_SparseNdarray(self, other, operation="greater", right=False)
+ + +
+[docs] + def __lt__(self, other) -> Union["SparseNdarray", numpy.ndarray]: + """Check whether a ``SparseNdarray`` is less than something. + + Args: + other: + A numeric scalar; + or a NumPy array with dimensions as described in + :py:class:`~delayedarray.UnaryIsometricOpWithArgs.UnaryIsometricOpWithArgs`; + or any seed object of the same dimensions as :py:attr:`~shape`. + + Returns: + Array containing the result of the check. + This may or may not be sparse depending on ``other``. + """ + return _operate_with_args_on_SparseNdarray(self, other, operation="less", right=True)
+ + +
+[docs] + def __rlt__(self, other) -> Union["SparseNdarray", numpy.ndarray]: + """Check whether something is less than a ``SparseNdarray``. + + Args: + other: + A numeric scalar; + or a NumPy array with dimensions as described in + :py:class:`~delayedarray.UnaryIsometricOpWithArgs.UnaryIsometricOpWithArgs`; + or any seed object of the same dimensions as :py:attr:`~shape`. + + Returns: + Array containing the result of the check. + This may or may not be sparse depending on ``other``. + """ + return _operate_with_args_on_SparseNdarray(self, other, operation="less", right=False)
+ + + # Simple methods. +
+[docs] + def __neg__(self): + """Negate the contents of a ``SparseNdarray``. + + Returns: + A ``SparseNdarray`` containing the delayed negation. + """ + return _transform_sparse_array_from_SparseNdarray(self, lambda l, i, v : (i, -v), self._dtype)
+ + +
+[docs] + def __abs__(self): + """Take the absolute value of the contents of a ``SparseNdarray``. + + Returns: + A ``SparseNdarray`` containing the delayed absolute value operation. + """ + return _transform_sparse_array_from_SparseNdarray(self, lambda l, i, v : (i, abs(v)), self._dtype)
+ + +
+[docs] + def __or__(self, other) -> Union["SparseNdarray", numpy.ndarray]: + """Element-wise OR with something. + + Args: + other: + A numeric scalar; + or a NumPy array with dimensions as described in + :py:class:`~delayedarray.UnaryIsometricOpWithArgs.UnaryIsometricOpWithArgs`; + or a ``DelayedArray`` of the same dimensions as :py:attr:`~shape`. + + Returns: + Array containing the result of the check. + This may or may not be sparse depending on ``other``. + """ + return _operate_with_args_on_SparseNdarray(self, other, operation="logical_or", right=True)
+ + +
+[docs] + def __ror__(self, other) -> Union["SparseNdarray", numpy.ndarray]: + """Element-wise OR with the right-hand-side of a ``DelayedArray``. + + Args: + other: + A numeric scalar; + or a NumPy array with dimensions as described in + :py:class:`~delayedarray.UnaryIsometricOpWithArgs.UnaryIsometricOpWithArgs`; + or a ``DelayedArray`` of the same dimensions as :py:attr:`~shape`. + + Returns: + Array containing the result of the check. + This may or may not be sparse depending on ``other``. + """ + return _operate_with_args_on_SparseNdarray(self, other, operation="logical_or", right=False)
+ + +
+[docs] + def __and__(self, other) -> Union["SparseNdarray", numpy.ndarray]: + """Element-wise AND with something. + + Args: + other: + A numeric scalar; + or a NumPy array with dimensions as described in + :py:class:`~delayedarray.UnaryIsometricOpWithArgs.UnaryIsometricOpWithArgs`; + or a ``DelayedArray`` of the same dimensions as :py:attr:`~shape`. + + Returns: + Array containing the result of the check. + This may or may not be sparse depending on ``other``. + """ + return _operate_with_args_on_SparseNdarray(self, other, operation="logical_and", right=True)
+ + +
+[docs] + def __rand__(self, other) -> Union["SparseNdarray", numpy.ndarray]: + """Element-wise AND with the right-hand-side of a ``DelayedArray``. + + Args: + other: + A numeric scalar; + or a NumPy array with dimensions as described in + :py:class:`~delayedarray.UnaryIsometricOpWithArgs.UnaryIsometricOpWithArgs`; + or a ``DelayedArray`` of the same dimensions as :py:attr:`~shape`. + + Returns: + Array containing the result of the check. + This may or may not be sparse depending on ``other``. + """ + return _operate_with_args_on_SparseNdarray(self, other, operation="logical_and", right=False)
+ + + + # Subsetting. +
+[docs] + def __getitem__(self, subset) -> Union["SparseNdarray", numpy.ndarray]: + """Take a subset of this ``SparseNdarray``. This follows the same logic as NumPy slicing and will generate a + :py:class:`~delayedarray.Subset.Subset` object when the subset operation preserves the dimensionality of the + seed, i.e., ``args`` is defined using the :py:meth:`~numpy.ix_` function. + + Args: + subset: + A :py:class:`tuple` of length equal to the dimensionality of this ``SparseNdarray``, or a single integer specfying an index on the first dimension. + We attempt to support most types of NumPy slicing; however, only subsets that preserve dimensionality will generate a ``SparseNdarray``. + + Raises: + ValueError: If ``args`` contain more dimensions than the shape of the array. + + Returns: + If the dimensionality is preserved by ``subset``, a ``SparseNdarray`` containing the specified subset is returned. + Otherwise, a :py:class:`~numpy.ndarray` is returned containing the realized subset. + """ + if not isinstance(subset, Tuple): + replacement = [slice(None)] * len(self.shape) + replacement[0] = subset + subset = (*replacement,) + + cleaned = _getitem_subset_preserves_dimensions(self.shape, subset) + if cleaned is not None: + # No need to sanitize here, as the extractors can take unsorted subsets. + return _extract_sparse_array_from_SparseNdarray(self, cleaned) + return _getitem_subset_discards_dimensions(self, subset, _extract_dense_array_from_SparseNdarray)
+ + + + # NumPy methods. +
+[docs] + def __array_ufunc__(self, ufunc, method, *inputs, **kwargs) -> "SparseNdarray": + """Interface with NumPy array methods. This is used to implement + mathematical operations like NumPy's :py:meth:`~numpy.log`, or to + override operations between NumPy class instances and ``SparseNdarray`` + objects where the former is on the left hand side. + + Check out NumPy's ``__array_ufunc__`` `documentation + <https://numpy.org/doc/stable/reference/arrays.classes.html#numpy.class.__array_ufunc__>`_ + for more details. + + Returns: + A ``SparseNdarray`` instance containing the requested delayed operation. + """ + if ufunc.__name__ in translate_ufunc_to_op_with_args or ufunc.__name__ == "true_divide": + # This is required to support situations where the NumPy array is on + # the LHS, such that the numpy.ndarray method gets called first. + + op = ufunc.__name__ + if ufunc.__name__ == "true_divide": + op = "divide" + + first_is_da = isinstance(inputs[0], SparseNdarray) + da = inputs[1 - int(first_is_da)] + v = inputs[int(first_is_da)] + return _operate_with_args_on_SparseNdarray(self, v, op, right=False) + + elif ufunc.__name__ in translate_ufunc_to_op_simple: + dummy = ufunc(numpy.zeros(1, dtype=self._dtype)) + if dummy[0] == 0: + return _transform_sparse_array_from_SparseNdarray(self, lambda l, i, v : (i, ufunc(v)), dummy.dtype) + else: + return ufunc(self.__array__()) + + elif ufunc.__name__ == "absolute": + return self.__abs__() + + raise NotImplementedError(f"'{ufunc.__name__}' is not implemented!")
+ + + +
+[docs] + def __array_function__(self, func, types, args, kwargs) -> "SparseNdarray": + """Interface to NumPy's high-level array functions. + This is used to implement array operations like NumPy's :py:meth:`~numpy.concatenate`, + + Check out NumPy's ``__array_function__`` + `documentation <https://numpy.org/doc/stable/reference/arrays.classes.html#numpy.class.__array_function__>`_ + for more details. + + Returns: + A ``SparseNdarray`` instance containing the requested operation. + """ + if func == numpy.concatenate: + if "axis" in kwargs: + axis = kwargs["axis"] + else: + axis = 0 + return _concatenate_SparseNdarrays(args[0], along=axis) + + if func == numpy.transpose: + if "axes" in kwargs: + axes = kwargs["axes"] + else: + axes = list(range(len(self._shape) - 1, -1, -1)) + return _transpose_SparseNdarray(self, axes) + + if func == numpy.round: + return _transform_sparse_array_from_SparseNdarray(self, lambda l, i, v : (i, func(v, **kwargs)), self._dtype) + + if func == numpy.mean: + return self.mean(**kwargs) + + if func == numpy.sum: + return self.sum(**kwargs) + + if func == numpy.var: + return self.var(**kwargs) + + if func == numpy.any: + return self.any(**kwargs) + + if func == numpy.all: + return self.all(**kwargs) + + raise NotImplementedError(f"'{func.__name__}' is not implemented!")
+ + + +
+[docs] + def astype(self, dtype: numpy.dtype, **kwargs) -> "SparseNdarray": + """See :py:meth:`~numpy.ndarray.astype` for details. + + All keyword arguments are currently ignored. + """ + return _transform_sparse_array_from_SparseNdarray(self, lambda l, i, v : (i, v.astype(dtype)), dtype)
+ + + + @property + def T(self) -> "SparseNdarray": + """ + Returns: + A ``SparseNdarray`` containing the transposed contents. + """ + axes = list(range(len(self._shape) - 1, -1, -1)) + return _transpose_SparseNdarray(self, axes) + + +
+[docs] + def sum(self, axis: Optional[Union[int, Tuple[int, ...]]] = None, dtype: Optional[numpy.dtype] = None) -> numpy.ndarray: + """ + Take the sum of values across the ``SparseNdarray``, possibly over a + given axis or set of axes. + + Args: + axis: + A single integer specifying the axis over which to calculate + the sum. Alternatively, a tuple (multiple axes) or None (no + axes), see :py:func:`~numpy.sum` for details. + + dtype: + NumPy type for the output array. If None, this is automatically + chosen based on the type of the ``SparseNdarray``, see + :py:func:`~numpy.sum` for details. + + Returns: + A NumPy array containing the summed values. If ``axis = None``, + this will be a NumPy scalar instead. + """ + return array_sum( + self, + axis=axis, + dtype=dtype, + reduce_over_x=_reduce_SparseNdarray, + masked=self._is_masked, + )
+ + + +
+[docs] + def mean(self, axis: Optional[Union[int, Tuple[int, ...]]] = None, dtype: Optional[numpy.dtype] = None) -> numpy.ndarray: + """ + Take the mean of values across the ``SparseNdarray``, possibly over a + given axis or set of axes. + + Args: + axis: + A single integer specifying the axis over which to calculate + the mean. Alternatively, a tuple (multiple axes) or None (no + axes), see :py:func:`~numpy.mean` for details. + + dtype: + NumPy type for the output array. If None, this is automatically + chosen based on the type of the ``SparseNdarray``, see + :py:func:`~numpy.mean` for details. + + Returns: + A NumPy array containing the mean values. If ``axis = None``, + this will be a NumPy scalar instead. + """ + return array_mean( + self, + axis=axis, + dtype=dtype, + reduce_over_x=_reduce_SparseNdarray, + masked=self._is_masked, + )
+ + + +
+[docs] + def var(self, axis: Optional[Union[int, Tuple[int, ...]]] = None, dtype: Optional[numpy.dtype] = None, ddof: int = 0) -> numpy.ndarray: + """ + Take the variances of values across the ``SparseNdarray``, possibly + over a given axis or set of axes. + + Args: + axis: + A single integer specifying the axis over which to calculate + the variance. Alternatively, a tuple (multiple axes) or None + (no axes), see :py:func:`~numpy.var` for details. + + dtype: + NumPy type for the output array. If None, this is automatically + chosen based on the type of the ``SparseNdarray``, see + :py:func:`~numpy.var` for details. + + ddof: + Delta in the degrees of freedom to subtract from the denominator. + Typically set to 1 to obtain the sample variance. + + Returns: + A NumPy array containing the variances. If ``axis = None``, + this will be a NumPy scalar instead. + """ + return array_var( + self, + axis=axis, + dtype=dtype, + ddof=ddof, + reduce_over_x=_reduce_SparseNdarray, + masked=self._is_masked, + )
+ + +
+[docs] + def any(self, axis: Optional[Union[int, Tuple[int, ...]]] = None, dtype: Optional[numpy.dtype] = None) -> numpy.ndarray: + """Test whether any array element along a given axis evaluates to True. + + Compute this test across the ``SparseNdarray``, possibly over a + given axis or set of axes. If the seed has a ``any()`` method, that + method is called directly with the supplied arguments. + + Args: + axis: + A single integer specifying the axis over which to test + for any. Alternatively, a tuple (multiple axes) or None + (no axes), see :py:func:`~numpy.any` for details. + + dtype: + NumPy type for the output array. If None, this is automatically + chosen based on the type of the ``SparseNdarray``, see + :py:func:`~numpy.any` for details. + + Returns: + A NumPy array containing the variances. If ``axis = None``, + this will be a NumPy scalar instead. + """ + return array_any( + self, + axis=axis, + dtype=dtype, + reduce_over_x=_reduce_SparseNdarray, + masked=self._is_masked, + )
+ + +
+[docs] + def all(self, axis: Optional[Union[int, Tuple[int, ...]]] = None, dtype: Optional[numpy.dtype] = None) -> numpy.ndarray: + """Test whether all array elements along a given axis evaluate to True. + + Compute this test across the ``SparseNdarray``, possibly over a + given axis or set of axes. If the seed has a ``all()`` method, that + method is called directly with the supplied arguments. + Args: + axis: + A single integer specifying the axis over which to test + for any. Alternatively, a tuple (multiple axes) or None + (no axes), see :py:func:`~numpy.any` for details. + + dtype: + NumPy type for the output array. If None, this is automatically + chosen based on the type of the ``SparseNdarray``, see + :py:func:`~numpy.any` for details. + + Returns: + A NumPy array containing the variances. If ``axis = None``, + this will be a NumPy scalar instead. + """ + return array_all( + self, + axis=axis, + dtype=dtype, + reduce_over_x=_reduce_SparseNdarray, + masked=self._is_masked, + )
+ + + # Other stuff +
+[docs] + def __copy__(self) -> "SparseNdarray": + """ + Returns: + A deep copy of this object. + """ + return SparseNdarray( + shape=self._shape, + contents=copy.deepcopy(self._contents), + index_dtype=self._index_dtype, + dtype=self._dtype, + is_masked=self._is_masked, + check=False + )
+ + + +
+[docs] + def copy(self) -> "SparseNdarray": + """ + Returns: + A deep copy of this object. + """ + return self.__copy__()
+
+ + + +######################################################### +######################################################### + + +def _peek(contents: list, dim: int): + if dim == 1: + for x in contents: + if x is not None: + return x[0].dtype, x[1].dtype, numpy.ma.isMaskedArray(x[1]) + else: + for x in contents: + if x is not None: + out = _peek(x, dim - 1) + if out is not None: + return out + return None + + +_CheckPayload = namedtuple("_CheckPayload", [ "max_index", "dtype", "index_dtype", "is_masked" ]) + + +def _check_sparse_tuple(indices: numpy.ndarray, values: numpy.ndarray, payload: _CheckPayload): + if len(indices) != len(values): + raise ValueError("length of index and value vectors should be the same") + + if values.dtype != payload.dtype: + raise ValueError("inconsistent data types for different value vectors") + + if indices.dtype != payload.index_dtype: + raise ValueError("inconsistent data types for different index vectors") + + for i, ix in enumerate(indices): + if ix < 0 or ix >= payload.max_index: + raise ValueError("index vectors out of range for the last dimension") + + for i in range(1, len(indices)): + if indices[i] <= indices[i - 1]: + raise ValueError("index vectors should be sorted in strictly increasing order") + + if payload.is_masked != numpy.ma.isMaskedArray(values): + raise ValueError("inconsistent masking status for different value vectors") + + +def _recursive_check(contents: list, shape: Tuple[int, ...], payload: _CheckPayload, dim: int): + if len(contents) != shape[dim]: + raise ValueError("length of 'contents' or its components should match the extent of the corresponding dimension") + + if dim == 1: + for x in contents: + if x is not None: + _check_sparse_tuple(x[0], x[1], payload) + else: + for x in contents: + if x is not None: + _recursive_check(x, shape, payload, dim=dim-1) + + +######################################################### +######################################################### + + +_SubsetSummary = namedtuple("_SubsetSummary", [ "subset", "increasing", "consecutive", "search_first", "search_last", "first_index", "past_last_index", "random_map" ]) + + +def _characterize_indices(subset: Sequence[int], dim_extent: int): + if len(subset) == 0: + return _SubsetSummary( + subset = subset, + increasing = False, + consecutive = False, + first_index = None, + past_last_index = None, + search_first = None, + search_last = None, + random_map = None, + ) + + for i in range(1, len(subset)): + if subset[i] <= subset[i-1]: + random_map = {} + for i, x in enumerate(subset): + if x in random_map: + if isinstance(random_map[x], list): + random_map[x].append(i) + else: + random_map[x] = [random_map[x], i] + else: + random_map[x] = i + first = min(subset) + return _SubsetSummary( + subset = subset, + increasing = False, + consecutive = False, + first_index = first, + past_last_index = None, + search_first = (first > 0), + search_last = None, + random_map = random_map + ) + + consecutive = True + for i in range(1, len(subset)): + if subset[i] != subset[i - 1] + 1: + consecutive = False + break + + first = subset[0] + last = subset[-1] + 1 + return _SubsetSummary( + subset = subset, + increasing = True, + consecutive = consecutive, + first_index = first, + past_last_index = last, + search_first = (first > 0), + search_last = (last < dim_extent), + random_map = None, + ) + + +def _extract_sparse_vector_internal(indices: numpy.ndarray, values: numpy.ndarray, subset_summary: _SubsetSummary, f: Callable): + subset = subset_summary.subset + + start_pos = 0 + if subset_summary.search_first: + start_pos = bisect_left(indices, subset_summary.first_index) + end_pos = len(indices) + + if subset_summary.increasing: + pos = 0 + x = start_pos + for i in subset: + while x < end_pos and i > indices[x]: + x += 1 + if x == end_pos: + break + if i == indices[x]: + f(pos, i, values[x]) + pos += 1 + else: + for x in range(start_pos, end_pos): + ix = indices[x] + if ix in subset_summary.random_map: + targets = subset_summary.random_map[ix] + if isinstance(targets, int): + f(targets, ix, values[x]) + else: + for t in targets: + f(t, ix, values[x]) + + +def _extract_sparse_vector_to_dense(indices: numpy.ndarray, values: numpy.ndarray, subset_summary: _SubsetSummary, output: numpy.ndarray): + if len(subset_summary.subset) == 0: + pass + elif subset_summary.consecutive: + start_pos = 0 + first = indices.dtype.type(subset_summary.first_index) # avoid casting of uint64s to floats during subtraction. + if subset_summary.search_first: + start_pos = bisect_left(indices, first) + + end_pos = len(indices) + if subset_summary.search_last: + end_pos = bisect_left(indices, subset_summary.past_last_index, lo=start_pos, hi=end_pos) + + for x in range(start_pos, end_pos): + output[indices[x] - first] = values[x] + else: + def f(p, i, v): + output[p] = v + _extract_sparse_vector_internal(indices, values, subset_summary, f) + + +def _recursive_extract_dense_array(contents: numpy.ndarray, subset: Tuple[Sequence[int], ...], subset_summary: _SubsetSummary, output: numpy.ndarray, dim: int): + curdex = subset[dim] + if dim == 1: + pos = 0 + for i in curdex: + x = contents[i] + if x is not None: + _extract_sparse_vector_to_dense(x[0], x[1], subset_summary=subset_summary, output=output[pos]) + pos += 1 + else: + pos = 0 + for i in curdex: + x = contents[i] + if x is not None: + _recursive_extract_dense_array( + contents=x, + subset=subset, + subset_summary=subset_summary, + output=output[pos], + dim=dim - 1, + ) + pos += 1 + + +def _extract_dense_array_from_SparseNdarray(x: SparseNdarray, subset: Tuple[Sequence[int], ...], dtype: Optional[numpy.dtype] = None) -> numpy.ndarray: + idims = [len(y) for y in subset] + subset_summary = _characterize_indices(subset[0], x._shape[0]) + + # We reverse the dimensions so that we use F-contiguous storage. This also + # makes it slightly easier to do the recursion as we can just index by + # the first dimension to obtain a subarray at each recursive step. + if dtype is None: + dtype = x._dtype + output = numpy.zeros((*reversed(idims),), dtype=dtype) + if x._is_masked: + output = numpy.ma.MaskedArray(output, mask=False) + + if x._contents is not None: + ndim = len(x._shape) + if ndim > 1: + _recursive_extract_dense_array(x._contents, subset, subset_summary=subset_summary, output=output, dim=ndim-1) + else: + _extract_sparse_vector_to_dense(x._contents[0], x._contents[1], subset_summary=subset_summary, output=output) + + return output.T + + +def _extract_sparse_vector_to_sparse(indices: numpy.ndarray, values: numpy.ndarray, subset_summary: _SubsetSummary): + if len(subset_summary.subset) == 0: + pass + + elif subset_summary.consecutive: + start_pos = 0 + first = indices.dtype.type(subset_summary.first_index) # avoid casting of uint64's to floats during subtraction. + if subset_summary.search_first: + start_pos = bisect_left(indices, first) + + end_pos = len(indices) + if subset_summary.search_last: + end_pos = bisect_left(indices, subset_summary.past_last_index, lo=start_pos, hi=end_pos) + + if start_pos == 0 and end_pos == len(indices): + new_indices = indices + new_values = values + else: + new_indices = indices[start_pos:end_pos] + new_values = values[start_pos:end_pos] + + if first: + new_indices = new_indices - first + return new_indices, new_values + + elif subset_summary.increasing: + new_indices = [] + new_values = [] + def f(p, i, v): + new_indices.append(p) + new_values.append(v) + _extract_sparse_vector_internal(indices, values, subset_summary, f) + + if len(new_indices) == 0: + return None + return ( + _convert_to_unmasked_1darray(new_indices, dtype=indices.dtype), + _convert_to_maybe_masked_1darray(new_values, dtype=values.dtype, masked=numpy.ma.isMaskedArray(values)) + ) + + else: + new_pairs = [] + def f(p, i, v): + new_pairs.append((p, v)) + _extract_sparse_vector_internal(indices, values, subset_summary, f) + new_pairs.sort() + + shape = (len(new_pairs),) + new_indices = _allocate_unmasked_ndarray(shape, dtype=indices.dtype) + new_values = _allocate_maybe_masked_ndarray(shape, dtype=values.dtype, masked=numpy.ma.isMaskedArray(values)) + for i, pair in enumerate(new_pairs): + new_indices[i] = pair[0] + new_values[i] = pair[1] + + return new_indices, new_values + + +def _recursive_extract_sparse_array(contents: list, shape: Tuple[int, ...], subset: Tuple[Sequence[int], ...], subset_summary: _SubsetSummary, dim: int): + curdex = subset[dim] + new_contents = [] + + if dim == 1: + for i in curdex: + x = contents[i] + if x is not None: + y = _extract_sparse_vector_to_sparse(x[0], x[1], subset_summary) + new_contents.append(y) + else: + new_contents.append(None) + else: + for i in curdex: + if contents[i] is not None: + y = _recursive_extract_sparse_array( + contents[i], + shape, + subset=subset, + subset_summary=subset_summary, + dim=dim - 1, + ) + new_contents.append(y) + else: + new_contents.append(None) + + for x in new_contents: + if x is not None: + return new_contents + return None + + +def _extract_sparse_array_from_SparseNdarray(x: SparseNdarray, subset: Tuple[Sequence[int], ...]) -> SparseNdarray: + idims = [len(y) for y in subset] + subset_summary = _characterize_indices(subset[0], x._shape[0]) + + new_contents = None + if x._contents is not None: + ndim = len(x.shape) + if ndim > 1: + new_contents = _recursive_extract_sparse_array(x._contents, x._shape, subset=subset, subset_summary=subset_summary, dim=ndim-1) + else: + new_contents = _extract_sparse_vector_to_sparse(x._contents[0], x._contents[1], subset_summary) + + return SparseNdarray(shape=(*idims,), contents=new_contents, index_dtype=x.index_dtype, dtype=x.dtype, is_masked=x.is_masked, check=False) + + +######################################################### +######################################################### + + +_TransformPayload = namedtuple("_TransformPayload", [ "fun", "output_dtype" ]) + + +def _transform_sparse_vector(location: Sequence[int], indices: numpy.ndarray, values: numpy.ndarray, payload: _TransformPayload): + idx, val = payload.fun(location, indices, values) + return (idx.astype(indices.dtype, copy=False), val.astype(payload.output_dtype, copy=False)) # a bit of safety with respect to types. + + +def _recursive_transform_sparse_array(contents: list, shape: Tuple[int, ...], payload: _TransformPayload, dim: int, location: Sequence[int] = []): + new_contents = [] + location.append(0) + + if dim == 1: + for i in range(shape[dim]): + location[-1] = i + x = contents[i] + if x is not None: + new_contents.append(_transform_sparse_vector(location, x[0], x[1], payload)) + else: + new_contents.append(None) + else: + for i in range(shape[dim]): + if contents[i] is not None: + location[-1] = i + y = _recursive_transform_sparse_array( + contents=contents[i], + shape=shape, + payload=payload, + dim=dim-1, + location=location, + ) + new_contents.append(y) + else: + new_contents.append(None) + + location.pop() + + for x in new_contents: + if x is not None: + return new_contents + return None + + +def _transform_sparse_array_from_SparseNdarray(x: SparseNdarray, f: Callable, output_dtype: numpy.dtype) -> SparseNdarray: + new_contents = None + if x._contents is not None: + payload = _TransformPayload(fun=f, output_dtype=output_dtype) + ndim = len(x._shape) + if ndim > 1: + new_contents = _recursive_transform_sparse_array(contents=x._contents, shape=x._shape, payload=payload, dim=ndim-1) + else: + new_contents = _transform_sparse_vector((), indices=x._contents[0], values=x._contents[1], payload=payload) + + return SparseNdarray(shape=x._shape, contents=new_contents, index_dtype=x.index_dtype, dtype=output_dtype, is_masked=x.is_masked, check=False) + + +######################################################### +######################################################### + + +_BinaryOpPayload = namedtuple("_BinaryOpPayload", [ "fun", "dtype1", "dtype2", "output_dtype", "output_index_dtype" ]) + + +def _binary_operate_sparse_vector(vector1: Tuple[numpy.ndarray, numpy.ndarray], vector2: Tuple[numpy.ndarray, numpy.ndarray], payload: _BinaryOpPayload): + if vector1 is None and vector2 is None: + return None + + elif vector1 is not None and vector2 is None: + indices1, values1 = vector1 + mock = numpy.zeros((1,), dtype=payload.dtype2) # get vector of length 1 for correct type coercion. + return indices1.astype(payload.output_index_dtype, copy=False), payload.fun(values1, mock).astype(payload.output_dtype, copy=False) + + elif vector1 is None and vector2 is not None: + indices2, values2 = vector2 + mock = numpy.zeros((1,), dtype=payload.dtype1) + return indices2.astype(payload.output_index_dtype, copy=False), payload.fun(mock, values2).astype(payload.output_dtype, copy=False) + + else: + indices1, values1 = vector1 + indices2, values2 = vector2 + f = payload.fun + + i1 = 0 + len1 = len(indices1) + z1 = values1.dtype.type(0) + i2 = 0 + len2 = len(indices2) + z2 = values2.dtype.type(0) + outval = [] + outidx = [] + + while i1 < len1 and i2 < len2: + ix1 = indices1[i1] + ix2 = indices2[i2] + if ix1 > ix2: + outval.append(f(z1, values2[i2])) + outidx.append(ix2) + i2 += 1 + elif ix1 < ix2: + outval.append(f(values1[i1], z2)) + outidx.append(ix1) + i1 += 1 + else: + outval.append(f(values1[i1], values2[i2])) + outidx.append(ix1) + i1 += 1 + i2 += 1 + + # Only one of the following should be called. + while i2 < len2: + outval.append(f(z1, values2[i2])) + outidx.append(indices2[i2]) + i2 += 1 + + while i1 < len1: + outval.append(f(values1[i1], z2)) + outidx.append(indices1[i1]) + i1 += 1 + + return ( + _convert_to_unmasked_1darray(outidx, dtype=payload.output_index_dtype), + _convert_to_maybe_masked_1darray(outval, dtype=payload.output_dtype, masked=numpy.ma.isMaskedArray(values1) or numpy.ma.isMaskedArray(values2)) + ) + + +def _recursive_binary_operation_on_SparseNdarray(contents1: list, contents2: list, payload: _BinaryOpPayload, dim: int): + if contents1 is None and contents2 is None: + return None + + new_contents = [] + if contents1 is not None and contents2 is None: + if dim == 1: + for con1 in contents1: + new_contents.append(_binary_operate_sparse_vector(con1, None, payload)) + else: + for con1 in contents1: + new_contents.append(_recursive_binary_operation_on_SparseNdarray(con1, None, payload, dim=dim - 1)) + + elif contents1 is None and contents2 is not None: + if dim == 1: + for con2 in contents2: + new_contents.append(_binary_operate_sparse_vector(None, con2, payload)) + else: + for con2 in contents2: + new_contents.append(_recursive_binary_operation_on_SparseNdarray(None, con2, payload, dim=dim - 1)) + + else: + if dim == 1: + for i, con1 in enumerate(contents1): + new_contents.append(_binary_operate_sparse_vector(con1, contents2[i], payload)) + else: + for i, con1 in enumerate(contents1): + new_contents.append(_recursive_binary_operation_on_SparseNdarray(con1, contents2[i], payload, dim=dim - 1)) + + for x in new_contents: + if x is not None: + return new_contents + return None + + +def _binary_operation_on_SparseNdarray(x: SparseNdarray, y: SparseNdarray, operation: ISOMETRIC_OP_WITH_ARGS): + op = _choose_operator(operation) + + dummy1 = numpy.zeros(1, dtype=x._dtype) + dummy2 = numpy.zeros(1, dtype=y._dtype) + dummy = op(dummy1, dummy2) + if dummy[0] != 0: + return op(x.__array__(), y.__array__()) + + if x._contents is None and y._contents is None: + new_contents = None + else: + payload = _BinaryOpPayload(fun=op, dtype1=x._dtype, dtype2=y._dtype, output_index_dtype=x.index_dtype, output_dtype=dummy.dtype) + ndim = len(x._shape) + if ndim > 1: + new_contents = _recursive_binary_operation_on_SparseNdarray(x._contents, y._contents, payload=payload, dim = ndim - 1) + else: + new_contents = _binary_operate_sparse_vector(x._contents, y._contents, payload=payload) + + return SparseNdarray(shape=x._shape, contents=new_contents, index_dtype=x.index_dtype, dtype=dummy.dtype, is_masked=x.is_masked, check=False) + + +######################################################### +######################################################### + + +def _operate_with_args_on_SparseNdarray(x: SparseNdarray, other, operation: ISOMETRIC_OP_WITH_ARGS, right: bool) -> SparseNdarray: + if isinstance(other, SparseNdarray): + return _binary_operation_on_SparseNdarray(x, other, operation) + + along = _infer_along_with_args(x._shape, other) + num_other = 1 + + op = _choose_operator(operation) + dummy = numpy.zeros(num_other, dtype=x._dtype) + if right: + dummy = op(dummy, other) + else: + dummy = op(other, dummy) + + if num_other and not (dummy == 0).all(): # densifying. + if right: + return op(x.__array__(), other) + else: + return op(other, x.__array__()) + + if isinstance(other, numpy.ndarray): + num_other = numpy.prod(other.shape) + other = other.reshape((num_other,)) # flattening + + if along is None: + if right: + def f2(location, indices, values): + return indices, op(values, other) + else: + def f2(location, indices, values): + return indices, op(other, values) + elif along > 0: + if right: + def f2(location, indices, values): + p = location[-along] # remember, location is (i) reversed and (ii) missing the final dimension, so '-along' works. + return indices, op(values, other[p:p+1]) # get vector of length 1 for correct type coercion. + else: + def f2(location, indices, values): + p = location[-along] + return indices, op(other[p:p+1], values) + else: + if right: + def f2(location, indices, values): + return indices, op(values, other[indices]) + else: + def f2(location, indices, values): + return indices, op(other[indices], values) + + return _transform_sparse_array_from_SparseNdarray(x, f2, dummy.dtype) + + +######################################################### +######################################################### + + +_TransposeFillPayload = namedtuple("_TransposeFillPayload", [ "perm", "new_shape", "new_contents" ]) + + +def _transpose_SparseNdarray_contents_internal(location: Sequence[int], indices: numpy.ndarray, values: numpy.ndarray, payload: _TransposeFillPayload): + destination = [] + final = None + for i, p in enumerate(payload.perm): + if p == 0: + final = i + destination.append(None) + else: + destination.append(location[-p]) # remember, location is (i) reversed and (ii) missing the final dimension, so '-p' works. + + ndim = len(payload.new_shape) + for i, ix in enumerate(indices): + destination[final] = ix + + target = payload.new_contents + for j in range(ndim - 1, 1, -1): # walking backwards from the later dimensions to fill 'new_contents' correctly. + d = destination[j] + if target[d] is None: + replacement = [None] * payload.new_shape[j - 1] + target[d] = replacement + target = target[d] + + d = destination[1] + if target[d] is None: + target[d] = ([], []) + outi, outv = target[d] + outi.append(destination[0]) + outv.append(values[i]) + + +def _recursive_transpose_SparseNdarray_fill(contents: list, payload: _TransposeFillPayload, dim: int, location: Sequence[int] = []): + location.append(0) + + if dim == 1: + for i, con in enumerate(contents): + if con is not None: + location[-1] = i + _transpose_SparseNdarray_contents_internal(location, con[0], con[1], payload) + else: + for i, con in enumerate(contents): + if con is not None: + location[-1] = i + _recursive_transpose_SparseNdarray_fill(con, payload, location=location, dim=dim - 1) + + location.pop() + + +_TransposeReallocPayload = namedtuple("_TransposeReallocatePayload", [ "output_dtype", "output_index_dtype", "output_is_masked" ]) + + +def _recursive_transpose_SparseNdarray_reallocate(contents: list, payload: _TransposeReallocPayload, dim: int): + if dim == 1: + for i, con in enumerate(contents): + if con is not None: + contents[i] = ( + _convert_to_unmasked_1darray(con[0], dtype=payload.output_index_dtype), + _convert_to_maybe_masked_1darray(con[1], dtype=payload.output_dtype, masked=payload.output_is_masked) + ) + else: + for i, con in enumerate(contents): + if con is not None: + _recursive_transpose_SparseNdarray_reallocate(con, payload, dim=dim - 1) + + +def _transpose_SparseNdarray(x: SparseNdarray, perm): + ndim = len(x._shape) + if ndim == 1: + return x + + new_shape = [] + for p in perm: + new_shape.append(x._shape[p]) + + new_contents = None + if x._contents is not None: + new_contents = [None] * new_shape[-1] + + _recursive_transpose_SparseNdarray_fill( + x._contents, + _TransposeFillPayload(perm=perm, new_shape=new_shape, new_contents=new_contents), + dim=ndim - 1, + ) + + _recursive_transpose_SparseNdarray_reallocate( + new_contents, + _TransposeReallocPayload(output_dtype=x._dtype, output_index_dtype=x._index_dtype, output_is_masked=x._is_masked), + dim=ndim - 1, + ) + + return SparseNdarray(shape=(*new_shape,), contents=new_contents, index_dtype=x._index_dtype, dtype=x._dtype, is_masked=x.is_masked, check=False) + + +######################################################### +######################################################### + + +_ConcatenatePayload = namedtuple("_ConcatenatePayload", [ "shapes", "offset", "output_dtype", "output_index_dtype", "output_is_masked"]) + + +def _concatenate_sparse_vectors(idx: List[numpy.ndarray], val: List[numpy.ndarray], payload: _ConcatenatePayload): + newidx = _concatenate_unmasked_ndarrays(idx, axis=0).astype(payload.output_index_dtype, copy=False) + newval = _concatenate_maybe_masked_ndarrays(val, axis=0, masked=payload.output_is_masked).astype(payload.output_dtype, copy=False) + return (newidx, newval) + + +def _coerce_concatenated_SparseNdarray_types(contents: list, payload: _ConcatenatePayload, dim: int): + if dim == 1: + for i, con in enumerate(contents): + if con is not None: + idx2 = con[0].astype(payload.output_index_dtype, copy=False) + val2 = con[1].astype(payload.output_dtype, copy=False) + contents[i] = (idx2, val2) + else: + for i, con in enumerate(contents): + if con is not None: + _coerce_concatenated_SparseNdarray_types(con, payload, dim=dim - 1) + + +def _recursive_concatenate_SparseNdarrays(contents: list, final_shape: Tuple[int, ...], along: int, payload: _ConcatenatePayload, dim: int): + if along == dim: + all_none = True + for x in contents: + if x is not None: + all_none = False + + new_contents = None + if not all_none: + new_contents = [] + for i, x in enumerate(contents): + if x is not None: + new_contents += x + else: + new_contents += [None] * payload.shapes[i][along] + _coerce_concatenated_SparseNdarray_types(new_contents, payload=payload, dim=dim) + return new_contents + + elif dim == 1: + new_contents = [] + for i in range(final_shape[dim]): + outidx = [] + outval = [] + for j, c in enumerate(contents): + if c is not None and c[i] is not None: + outidx.append(c[i][0] + payload.offset[j]) + outval.append(c[i][1]) + if len(outval): + new_contents.append(_concatenate_sparse_vectors(outidx, outval, payload)) + else: + new_contents.append(None) + return new_contents + + else: + new_contents = [] + collected = [None] * len(contents) + for i in range(final_shape[dim]): + for j, c in enumerate(contents): + if c is not None: + collected[j] = c[i] + new_contents.append(_recursive_concatenate_SparseNdarrays(collected, final_shape, along, payload, dim=dim-1)) + return new_contents + + +def _concatenate_SparseNdarrays(xs: List[SparseNdarray], along: int): + all_contents = [] + all_shapes = [] + for x in xs: + all_contents.append(x._contents) + all_shapes.append(x._shape) + + combined = 0 + ref_shape = all_shapes[0] + for shape in all_shapes: + if len(shape) != len(ref_shape): + raise ValueError("inconsistent dimensionalities for combining SparseNdarrays") + for d, s in enumerate(shape): + if d == along: + combined += s + elif s != ref_shape[d]: + raise ValueError("inconsistent shapes for combining SparseNdarrays along axis " + str(along)) + + new_shape = list(ref_shape) + new_shape[along] = combined + + dummy_collected = [] + dummy_collected_index = [] + for x in xs: + dummy_collected.append(numpy.zeros(1, dtype=x._dtype)) + dummy_collected_index.append(numpy.zeros(1, dtype=x._index_dtype)) + + output_dtype = _concatenate_unmasked_ndarrays(dummy_collected, axis=0).dtype + output_index_dtype = _concatenate_unmasked_ndarrays(dummy_collected_index, axis=0).dtype + output_is_masked = any(y._is_masked for y in xs) + + all_none = True + for con in all_contents: + if con is not None: + all_none = False + + new_contents = None + if not all_none: + offset = None + ndim = len(new_shape) + + # Upgrading the index type to ensure we can hold the output, if we're + # concatenating on the first dimension (and thus possibly increasing + # the indices in the leaves of the subsequent SparseNdarrays). + if along == 0: + last = 0 + offset = [] + for i, shape in enumerate(all_shapes): + offset.append(last) + last += shape[along] + + for candidate in [output_index_dtype, numpy.uint32, numpy.uint64]: + if last < numpy.iinfo(candidate).max: + output_index_dtype = candidate + break + + payload = _ConcatenatePayload( + shapes=all_shapes, + offset=offset, + output_dtype=output_dtype, + output_index_dtype=output_index_dtype, + output_is_masked=output_is_masked + ) + + if ndim > 1: + new_contents = _recursive_concatenate_SparseNdarrays(all_contents, new_shape, along=along, payload=payload, dim=ndim-1) + else: + outidx = [] + outval = [] + for j, c in enumerate(all_contents): + if c is not None: + outidx.append(c[0] + offset[j]) + outval.append(c[1]) + new_contents = _concatenate_sparse_vectors(outidx, outval, payload) + + return SparseNdarray(shape=(*new_shape,), contents=new_contents, dtype=output_dtype, index_dtype=output_index_dtype, is_masked=output_is_masked, check=False) + + +######################################################### +######################################################### + + +_ReductionPayload = namedtuple("_ReductionPayload", [ "multipliers", "operation" ]) + + +def _reduce_sparse_vector(idx: numpy.ndarray, val: numpy.ndarray, payload: _ReductionPayload, offset: int = 0): + for j, ix in enumerate(idx): + extra = payload.multipliers[0] * ix + payload.operation(offset + extra, val[j]) + return + + +def _recursive_reduce_SparseNdarray(contents, payload: _ReductionPayload, dim: int, offset: int = 0): + mult = payload.multipliers[dim] + if dim == 1: + for i, con in enumerate(contents): + if con is not None: + _reduce_sparse_vector(con[0], con[1], payload, offset = offset + mult * i) + else: + for i, con in enumerate(contents): + if con is not None: + _recursive_reduce_SparseNdarray(con, payload, dim = dim - 1, offset = offset + mult * i) + return + + +def _reduce_SparseNdarray(x: SparseNdarray, axes: List[int], operation: Callable): + if x.contents is not None: + multipliers = _create_offset_multipliers(x.shape, axes) + payload = _ReductionPayload(operation=operation, multipliers=multipliers) + ndim = len(x.shape) + if ndim == 1: + _reduce_sparse_vector(x.contents[0], x.contents[1], payload) + else: + _recursive_reduce_SparseNdarray(x.contents, payload, dim=ndim - 1) + return +
+
+
+
+ + +
+
+ + Made with Sphinx and @pradyunsg's + + Furo + +
+
+ +
+
+ +
+
+ +
+
+ + + + + \ No newline at end of file diff --git a/_modules/delayedarray/Subset.html b/_modules/delayedarray/Subset.html new file mode 100644 index 0000000..c9fd170 --- /dev/null +++ b/_modules/delayedarray/Subset.html @@ -0,0 +1,481 @@ + + + + + + + + delayedarray.Subset - DelayedArray 0.6.2 documentation + + + + + + + + + + + + + + + + + Contents + + + + + + Menu + + + + + + + + Expand + + + + + + Light mode + + + + + + + + + + + + + + Dark mode + + + + + + + Auto light/dark, in light mode + + + + + + + + + + + + + + + Auto light/dark, in dark mode + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +Skip to content + + + +
+
+
+ +
+ +
+
+ +
+ +
+
+ +
+
+
+ + + + + Back to top + +
+
+ +
+ +
+
+

Source code for delayedarray.Subset

+from typing import Callable, Sequence, Tuple, Any
+from numpy import dtype, ndarray, ix_
+import numpy
+import biocutils
+import copy
+
+from .DelayedOp import DelayedOp
+from .SparseNdarray import SparseNdarray
+from ._subset import _sanitize_subset, _is_single_subset_noop
+from .extract_dense_array import extract_dense_array
+from .extract_sparse_array import extract_sparse_array
+from .create_dask_array import create_dask_array
+from .chunk_grid import chunk_grid
+from .is_sparse import is_sparse
+from .is_masked import is_masked
+
+__author__ = "ltla"
+__copyright__ = "ltla"
+__license__ = "MIT"
+
+
+
+[docs] +class Subset(DelayedOp): + """Delayed subset operation, based on Bioconductor's ``DelayedArray::DelayedSubset`` class. + This will slice the array along one or more dimensions, equivalent to the outer product of subset indices. + + This class is intended for developers to construct new :py:class:`~delayedarray.DelayedArray.DelayedArray` + instances. In general, end users should not be interacting with ``Subset`` objects directly. + """ + +
+[docs] + def __init__(self, seed, subset: Tuple[Sequence[int], ...]): + """ + Args: + seed: + Any object that satisfies the seed contract, see + :py:class:`~delayedarray.DelayedArray.DelayedArray` for + details. + + subset: + Tuple of length equal to the dimensionality of ``seed``, + containing the subsetted elements for each dimension. Each + entry should be a vector of integer indices specifying the + elements of the corresponding dimension to retain, where each + integer is non-negative and less than the extent of the + dimension. Unsorted and/or duplicate indices are allowed. + """ + self._seed = seed + if len(subset) != len(seed.shape): + raise ValueError( + "Dimensionality of 'seed' and 'subset' should be the same." + ) + + self._subset = subset + final_shape = [] + for idx in subset: + final_shape.append(len(idx)) + self._shape = (*final_shape,)
+ + + @property + def shape(self) -> Tuple[int, ...]: + """ + Returns: + Tuple of integers specifying the extent of each dimension of the + subsetted object. + """ + return self._shape + + @property + def dtype(self) -> dtype: + """ + Returns: + NumPy type for the subsetted contents, same as ``seed``. + """ + return self._seed.dtype + + @property + def seed(self): + """ + Returns: + The seed object. + """ + return self._seed + + @property + def subset(self) -> Tuple[Sequence[int], ...]: + """ + Returns: + Subset sequences to be applied to each dimension of the seed. + """ + return self._subset
+ + + +def _simplify_subset(x: Subset) -> Any: + seed = x.seed + if not type(seed) is Subset: + # Don't use isinstance, we don't want to collapse for Subset + # subclasses that might be doing god knows what. + return x + all_subsets = [] + noop = True + for i, sub in enumerate(x.subset): + seed_sub = seed.subset[i] + new_sub = biocutils.subset_sequence(seed_sub, sub) + if noop and not _is_single_subset_noop(seed.seed.shape[i], new_sub): + noop = False + all_subsets.append(new_sub) + if noop: + return seed.seed + new_x = copy.copy(x) + new_x._seed = seed.seed + new_x._subset = (*all_subsets,) + return new_x + + +def _extract_array(x: Subset, subset: Tuple[Sequence[int], ...], f: Callable): + newsub = list(subset) + expanded = [] + is_safe = 0 + + for i, s in enumerate(newsub): + cursub = x._subset[i] + replacement = biocutils.subset_sequence(cursub, s) + san_sub, san_remap = _sanitize_subset(replacement) + newsub[i] = san_sub + + if san_remap is None: + is_safe += 1 + san_remap = range(len(san_sub)) + expanded.append(san_remap) + + raw = f(x._seed, (*newsub,)) + if is_safe != len(subset): + raw = raw[ix_(*expanded)] + return raw + + +
+[docs] +@extract_dense_array.register +def extract_dense_array_Subset(x: Subset, subset: Tuple[Sequence[int], ...]) -> numpy.ndarray: + """See :py:meth:`~delayedarray.extract_dense_array.extract_dense_array`.""" + return _extract_array(x, subset, extract_dense_array)
+ + + +
+[docs] +@extract_sparse_array.register +def extract_sparse_array_Subset(x: Subset, subset: Tuple[Sequence[int], ...]) -> SparseNdarray: + """See :py:meth:`~delayedarray.extract_sparse_array.extract_sparse_array`.""" + return _extract_array(x, subset, extract_sparse_array)
+ + + +
+[docs] +@create_dask_array.register +def create_dask_array_Subset(x: Subset): + """See :py:meth:`~delayedarray.create_dask_array.create_dask_array`.""" + target = create_dask_array(x._seed) + + # Oh god, this is horrible. But dask doesn't support ix_ yet. + ndim = len(target.shape) + for i in range(ndim): + replacement = x._subset[i] + if isinstance(replacement, range): + replacement = list(replacement) + + current = [slice(None)] * ndim + current[i] = replacement + target = target[(..., *current)] + + return target
+ + + +
+[docs] +@chunk_grid.register +def chunk_grid_Subset(x: Subset): + """See :py:meth:`~delayedarray.chunk_grid.chunk_grid`.""" + chunk = chunk_grid(x._seed) + return chunk.subset(x._subset)
+ + + +
+[docs] +@is_sparse.register +def is_sparse_Subset(x: Subset): + """See :py:meth:`~delayedarray.is_sparse.is_sparse`.""" + return is_sparse(x._seed)
+ + + +
+[docs] +@is_masked.register +def is_masked_Subset(x: Subset): + """See :py:meth:`~delayedarray.is_masked.is_masked`.""" + return is_masked(x._seed)
+ +
+
+
+
+ + +
+
+ + Made with Sphinx and @pradyunsg's + + Furo + +
+
+ +
+
+ +
+
+ +
+
+ + + + + \ No newline at end of file diff --git a/_modules/delayedarray/Transpose.html b/_modules/delayedarray/Transpose.html new file mode 100644 index 0000000..e868c62 --- /dev/null +++ b/_modules/delayedarray/Transpose.html @@ -0,0 +1,461 @@ + + + + + + + + delayedarray.Transpose - DelayedArray 0.6.2 documentation + + + + + + + + + + + + + + + + + Contents + + + + + + Menu + + + + + + + + Expand + + + + + + Light mode + + + + + + + + + + + + + + Dark mode + + + + + + + Auto light/dark, in light mode + + + + + + + + + + + + + + + Auto light/dark, in dark mode + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +Skip to content + + + +
+
+
+ +
+ +
+
+ +
+ +
+
+ +
+
+
+ + + + + Back to top + +
+
+ +
+ +
+
+

Source code for delayedarray.Transpose

+from typing import Callable, Optional, Tuple, Sequence, Any
+from numpy import dtype, transpose
+import numpy
+import copy
+
+from .DelayedOp import DelayedOp
+from .SparseNdarray import SparseNdarray
+from .extract_dense_array import extract_dense_array
+from .extract_sparse_array import extract_sparse_array
+from .create_dask_array import create_dask_array
+from .chunk_grid import chunk_grid
+from .is_sparse import is_sparse
+from .is_masked import is_masked
+
+
+__author__ = "ltla"
+__copyright__ = "ltla"
+__license__ = "MIT"
+
+
+
+[docs] +class Transpose(DelayedOp): + """Delayed transposition, based on Bioconductor's ``DelayedArray::DelayedAperm`` class. + + This will create a matrix transpose in the 2-dimensional case; for a high-dimensional array, it will permute the + dimensions. + + This class is intended for developers to construct new :py:class:`~delayedarray.DelayedArray.DelayedArray` + instances. In general, end users should not be interacting with ``Transpose`` objects directly. + """ + +
+[docs] + def __init__(self, seed, perm: Optional[Tuple[int, ...]]): + """ + Args: + seed: + Any object that satisfies the seed contract, + see :py:class:`~delayedarray.DelayedArray.DelayedArray` for details. + + perm: + Tuple of length equal to the dimensionality of ``seed``, + containing the permutation of dimensions. If None, the + dimension ordering is assumed to be reversed. + """ + + curshape = seed.shape + ndim = len(curshape) + if perm is not None: + if len(perm) != ndim: + raise ValueError( + "Dimensionality of 'seed' and 'perm' should be the same." + ) + else: + perm = (*range(ndim - 1, -1, -1),) + + final_shape = [] + for x in perm: + final_shape.append(curshape[x]) + + self._seed = seed + self._perm = perm + self._shape = (*final_shape,)
+ + + @property + def shape(self) -> Tuple[int, ...]: + """ + Returns: + Tuple of integers specifying the extent of each dimension of the + transposed object. + """ + return self._shape + + @property + def dtype(self) -> dtype: + """ + Returns: + NumPy type for the transposed contents, same as ``seed``. + """ + return self._seed.dtype + + @property + def seed(self): + """ + Returns: + The seed object. + """ + return self._seed + + @property + def perm(self) -> Tuple[int, ...]: + """ + Returns: + Permutation of dimensions in the transposition. + """ + return self._perm
+ + + +def _simplify_transpose(x: Transpose) -> Any: + seed = x.seed + if not type(seed) is Transpose: + # Don't use isinstance, we don't want to collapse for Transpose + # subclasses that might be doing god knows what. + return x + + new_perm = [] + noop = True + for i, p in enumerate(x.perm): + new_p = seed.perm[p] + if new_p != i: + noop = False + new_perm.append(new_p) + if noop: + return seed.seed + + new_x = copy.copy(x) + new_x._seed = seed.seed + new_x._perm = (*new_perm,) + return new_x + + +def _extract_array(x: Transpose, subset: Tuple[Sequence[int], ...], f: Callable): + permsub = [None] * len(subset) + for i, j in enumerate(x._perm): + permsub[j] = subset[i] + + target = f(x._seed, (*permsub,)) + return transpose(target, axes=x._perm) + + +
+[docs] +@extract_dense_array.register +def extract_dense_array_Transpose(x: Transpose, subset: Tuple[Sequence[int], ...]) -> numpy.ndarray: + """See :py:meth:`~delayedarray.extract_dense_array.extract_dense_array`.""" + return _extract_array(x, subset, extract_dense_array)
+ + + +
+[docs] +@extract_sparse_array.register +def extract_sparse_array_Transpose(x: Transpose, subset: Tuple[Sequence[int], ...]) -> SparseNdarray: + """See :py:meth:`~delayedarray.extract_sparse_array.extract_sparse_array`.""" + return _extract_array(x, subset, extract_sparse_array)
+ + + +
+[docs] +@create_dask_array.register +def create_dask_array_Transpose(x: Transpose): + """See :py:meth:`~delayedarray.create_dask_array.create_dask_array`.""" + target = create_dask_array(x._seed) + return transpose(target, axes=x._perm)
+ + + +
+[docs] +@chunk_grid.register +def chunk_grid_Transpose(x: Transpose): + """See :py:meth:`~delayedarray.chunk_grid.chunk_grid`.""" + chunks = chunk_grid(x._seed) + return chunks.transpose(x._perm)
+ + + +
+[docs] +@is_sparse.register +def is_sparse_Transpose(x: Transpose): + """See :py:meth:`~delayedarray.is_sparse.is_sparse`.""" + return is_sparse(x._seed)
+ + + +
+[docs] +@is_masked.register +def is_masked_Transpose(x: Transpose): + """See :py:meth:`~delayedarray.is_masked.is_masked`.""" + return is_masked(x._seed)
+ +
+
+
+
+ + +
+
+ + Made with Sphinx and @pradyunsg's + + Furo + +
+
+ +
+
+ +
+
+ +
+
+ + + + + \ No newline at end of file diff --git a/_modules/delayedarray/UnaryIsometricOpSimple.html b/_modules/delayedarray/UnaryIsometricOpSimple.html new file mode 100644 index 0000000..9bb4d6e --- /dev/null +++ b/_modules/delayedarray/UnaryIsometricOpSimple.html @@ -0,0 +1,456 @@ + + + + + + + + delayedarray.UnaryIsometricOpSimple - DelayedArray 0.6.2 documentation + + + + + + + + + + + + + + + + + Contents + + + + + + Menu + + + + + + + + Expand + + + + + + Light mode + + + + + + + + + + + + + + Dark mode + + + + + + + Auto light/dark, in light mode + + + + + + + + + + + + + + + Auto light/dark, in dark mode + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +Skip to content + + + +
+
+
+ +
+ +
+
+ +
+ +
+
+ +
+
+
+ + + + + Back to top + +
+
+ +
+ +
+
+

Source code for delayedarray.UnaryIsometricOpSimple

+from typing import Callable, Literal, Tuple, Sequence
+import numpy
+from numpy import dtype, zeros
+import warnings
+
+from .DelayedOp import DelayedOp
+from .SparseNdarray import SparseNdarray
+from .extract_dense_array import extract_dense_array
+from .extract_sparse_array import extract_sparse_array
+from .create_dask_array import create_dask_array
+from .chunk_grid import chunk_grid
+from .is_sparse import is_sparse
+from .is_masked import is_masked
+
+__author__ = "ltla"
+__copyright__ = "ltla"
+__license__ = "MIT"
+
+OP = Literal[
+    "log",
+    "log1p",
+    "log2",
+    "log10",
+    "exp",
+    "expm1",
+    "sqrt",
+    "abs",
+    "sin",
+    "cos",
+    "tan",
+    "sinh",
+    "cosh",
+    "tanh",
+    "arcsin",
+    "arccos",
+    "arctan",
+    "arcsinh",
+    "arccosh",
+    "arctanh",
+    "ceil",
+    "floor",
+    "trunc",
+    "sign",
+    "logical_not",
+]
+
+
+def _choose_operator(op: OP):
+    return getattr(numpy, op)
+
+
+
+[docs] +class UnaryIsometricOpSimple(DelayedOp): + """Delayed unary isometric operation involving an n-dimensional seed array with no additional arguments, + similar to Bioconductor's ``DelayedArray::DelayedUnaryIsoOpStack`` class. + This is used for simple mathematical operations like NumPy's :py:meth:`~numpy.log`. + + This class is intended for developers to construct new :py:class:`~delayedarray.DelayedArray.DelayedArray` + instances. End-users should not be interacting with ``UnaryIsometricOpSimple`` objects directly. + """ + +
+[docs] + def __init__(self, seed, operation: OP): + """ + Args: + seed: + Any object that satisfies the seed contract, + see :py:class:`~delayedarray.DelayedArray.DelayedArray` for details. + + operation: + String specifying the unary operation. + """ + f = _choose_operator(operation) + with warnings.catch_warnings(): # silence warnings from divide by zero. + warnings.simplefilter("ignore") + dummy = f(zeros(1, dtype=seed.dtype)) + + self._seed = seed + self._op = operation + self._dtype = dummy.dtype + self._sparse = is_sparse(self._seed) and dummy[0] == 0
+ + + @property + def shape(self) -> Tuple[int, ...]: + """ + Returns: + Tuple of integers specifying the extent of each dimension of the + object after the operation. This should be the same as ``seed``. + """ + return self._seed.shape + + @property + def dtype(self) -> dtype: + """ + Returns: + NumPy type for the contents of the object after the operation. + This may or may not be the same as the ``seed`` array, depending on + how NumPy does the casting for the requested operation. + """ + return self._dtype + + @property + def seed(self): + """ + Returns: + The seed object. + """ + return self._seed + + @property + def operation(self) -> OP: + """ + Returns: + Name of the operation. + """ + return self._op
+ + + +def _extract_array(x: UnaryIsometricOpSimple, subset: Tuple[Sequence[int], ...], f: Callable): + target = f(x._seed, subset) + g = _choose_operator(x._op) + return g(target) + + +
+[docs] +@extract_dense_array.register +def extract_dense_array_UnaryIsometricOpSimple(x: UnaryIsometricOpSimple, subset: Tuple[Sequence[int], ...]) -> numpy.ndarray: + """See :py:meth:`~delayedarray.extract_dense_array.extract_dense_array`.""" + return _extract_array(x, subset, extract_dense_array)
+ + + +
+[docs] +@extract_sparse_array.register +def extract_sparse_array_UnaryIsometricOpSimple(x: UnaryIsometricOpSimple, subset: Tuple[Sequence[int], ...]) -> SparseNdarray: + """See :py:meth:`~delayedarray.extract_sparse_array.extract_sparse_array`.""" + return _extract_array(x, subset, extract_sparse_array)
+ + + +
+[docs] +@create_dask_array.register +def create_dask_array_UnaryIsometricOpSimple(x: UnaryIsometricOpSimple): + """See :py:meth:`~delayedarray.create_dask_array.create_dask_array`.""" + target = create_dask_array(x._seed) + f = _choose_operator(x._op) + return f(target)
+ + + +
+[docs] +@chunk_grid.register +def chunk_grid_UnaryIsometricOpSimple(x: UnaryIsometricOpSimple): + """See :py:meth:`~delayedarray.chunk_grid.chunk_grid`.""" + return chunk_grid(x._seed)
+ + + +
+[docs] +@is_sparse.register +def is_sparse_UnaryIsometricOpSimple(x: UnaryIsometricOpSimple): + """See :py:meth:`~delayedarray.is_sparse.is_sparse`.""" + return x._sparse
+ + + +
+[docs] +@is_masked.register +def is_masked_UnaryIsometricOpSimple(x: UnaryIsometricOpSimple): + """See :py:meth:`~delayedarray.is_masked.is_masked`.""" + return is_masked(x._seed)
+ +
+
+
+
+ + +
+
+ + Made with Sphinx and @pradyunsg's + + Furo + +
+
+ +
+
+ +
+
+ +
+
+ + + + + \ No newline at end of file diff --git a/_modules/delayedarray/UnaryIsometricOpWithArgs.html b/_modules/delayedarray/UnaryIsometricOpWithArgs.html new file mode 100644 index 0000000..95ff1dc --- /dev/null +++ b/_modules/delayedarray/UnaryIsometricOpWithArgs.html @@ -0,0 +1,502 @@ + + + + + + + + delayedarray.UnaryIsometricOpWithArgs - DelayedArray 0.6.2 documentation + + + + + + + + + + + + + + + + + Contents + + + + + + Menu + + + + + + + + Expand + + + + + + Light mode + + + + + + + + + + + + + + Dark mode + + + + + + + Auto light/dark, in light mode + + + + + + + + + + + + + + + Auto light/dark, in dark mode + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +Skip to content + + + +
+
+
+ +
+ +
+
+ +
+ +
+
+ +
+
+
+ + + + + Back to top + +
+
+ +
+ +
+
+

Source code for delayedarray.UnaryIsometricOpWithArgs

+import warnings
+from typing import Callable, Tuple, Union, Sequence
+import numpy
+from numpy import ndarray
+
+from .DelayedOp import DelayedOp
+from .SparseNdarray import SparseNdarray
+from ._isometric import ISOMETRIC_OP_WITH_ARGS, _execute, _infer_along_with_args
+from .extract_dense_array import extract_dense_array
+from .extract_sparse_array import extract_sparse_array
+from .create_dask_array import create_dask_array
+from .chunk_grid import chunk_grid
+from .is_sparse import is_sparse
+from .is_masked import is_masked
+
+__author__ = "ltla"
+__copyright__ = "ltla"
+__license__ = "MIT"
+
+
+
+[docs] +class UnaryIsometricOpWithArgs(DelayedOp): + """Unary isometric operation involving an n-dimensional seed array with a scalar or 1-dimensional vector, + based on Bioconductor's ``DelayedArray::DelayedUnaryIsoOpWithArgs`` class. + Only one n-dimensional array is involved here, hence the "unary" in the name. + (Hey, I don't make the rules.) + + The data type of the result is determined by NumPy casting given the ``seed`` and ``value`` + data types. We suggest supplying a floating-point ``value`` to avoid unexpected results from + integer truncation or overflow. + + This class is intended for developers to construct new :py:class:`~delayedarray.DelayedArray.DelayedArray` + instances. In general, end-users should not be interacting with ``UnaryIsometricOpWithArgs`` objects directly. + """ + +
+[docs] + def __init__(self, seed, value: Union[float, ndarray], operation: ISOMETRIC_OP_WITH_ARGS, right: bool = True): + """ + Args: + seed: + Any object satisfying the seed contract, see + :py:meth:`~delayedarray.DelayedArray.DelayedArray` for details. + + value: + A scalar or NumPy array with which to perform an operation on the ``seed``. + + If scalar, the operation is applied element-wise to all entries of ``seed``. + + If a 1-dimensional NumPy array, the operation is broadcast along the last dimension of ``seed``. + + If an n-dimensional NumPy array, the number of dimensions should be equal to the dmensionality of ``seed``. + All dimensions should be of extent 1, except for exactly one dimension that should have extent equal to the + corresponding dimension of ``seed``. The operation is then broadcast along that dimension. + + operation: + String specifying the operation. + + right: + Whether ``value`` is to the right of ``seed`` in the operation. + If False, ``value`` is put to the left of ``seed``. Ignored + for commutative operations in ``op``. + """ + + along = _infer_along_with_args(seed.shape, value) + if along is None and isinstance(value, ndarray): + ndim = len(value.shape) + value = value[(*([0] * ndim),)] + + with warnings.catch_warnings(): # silence warnings from divide by zero. + warnings.simplefilter("ignore") + if isinstance(value, ndarray): + dummy = numpy.zeros(value.shape, dtype=seed.dtype) + dummy = _execute(dummy, value, operation) + else: + dummy = numpy.zeros(1, dtype=seed.dtype) + dummy = _execute(dummy, value, operation) + + self._seed = seed + self._value = value + self._op = operation + self._right = right + self._along = along + self._dtype = dummy.dtype + self._sparse = is_sparse(self._seed) and (dummy == 0).all()
+ + + @property + def shape(self) -> Tuple[int, ...]: + """ + Returns: + Tuple of integers specifying the extent of each dimension of this + object. This should be the same as ``seed``. + """ + return self._seed.shape + + @property + def dtype(self) -> numpy.dtype: + """ + Returns: + NumPy type for the data after the operation was applied. This may + or may not be the same as the ``seed`` array, depending on how + NumPy does the casting for the requested operation. + """ + return self._dtype + + @property + def seed(self): + """ + Returns: + The seed object. + """ + return self._seed + + @property + def operation(self) -> ISOMETRIC_OP_WITH_ARGS: + """ + Returns: + Name of the operation. + """ + return self._op + + @property + def value(self) -> Union[float, ndarray]: + """ + Returns: + The other operand used in the operation. + """ + return self._value + + @property + def right(self) -> bool: + """ + Returns: + Whether the operation was applied to the right of the seed. + """ + return self._right + + @property + def along(self) -> Union[int, None]: + """ + Returns: + The dimension of :py:attr:``~seed`` along which the array values + are broadcast, for an array :py:attr:`~value`. Otherwise None, if + ``value`` is a scalar. + """ + return self._along
+ + + +def _extract_array(x: UnaryIsometricOpWithArgs, subset: Tuple[Sequence[int], ...], f: Callable): + target = f(x._seed, subset) + + subvalue = x._value + if isinstance(subvalue, ndarray) and not subvalue is numpy.ma.masked: + if len(subvalue.shape) == 1: + subvalue = subvalue[subset[-1]] + else: + resub = [slice(None)] * len(subset) + subdim = x.along + resub[subdim] = subset[subdim] + subvalue = subvalue[(*resub,)] + + if x._right: + return _execute(target, subvalue, x._op) + else: + return _execute(subvalue, target, x._op) + + +
+[docs] +@extract_dense_array.register +def extract_dense_array_UnaryIsometricOpWithArgs(x: UnaryIsometricOpWithArgs, subset: Tuple[Sequence[int], ...]) -> numpy.ndarray: + """See :py:meth:`~delayedarray.extract_dense_array.extract_dense_array`.""" + return _extract_array(x, subset, extract_dense_array)
+ + + +
+[docs] +@extract_sparse_array.register +def extract_sparse_array_UnaryIsometricOpWithArgs(x: UnaryIsometricOpWithArgs, subset: Tuple[Sequence[int], ...]) -> SparseNdarray: + """See :py:meth:`~delayedarray.extract_sparse_array.extract_sparse_array`.""" + return _extract_array(x, subset, extract_sparse_array)
+ + + +
+[docs] +@create_dask_array.register +def create_dask_array_UnaryIsometricOpWithArgs(x: UnaryIsometricOpWithArgs): + """See :py:meth:`~delayedarray.create_dask_array.create_dask_array`.""" + target = create_dask_array(x._seed) + operand = x._value + if x._right: + return _execute(target, operand, x._op) + else: + return _execute(operand, target, x._op)
+ + + +
+[docs] +@chunk_grid.register +def chunk_grid_UnaryIsometricOpWithArgs(x: UnaryIsometricOpWithArgs): + """See :py:meth:`~delayedarray.chunk_grid.chunk_grid`.""" + return chunk_grid(x._seed)
+ + + +
+[docs] +@is_sparse.register +def is_sparse_UnaryIsometricOpWithArgs(x: UnaryIsometricOpWithArgs): + """See :py:meth:`~delayedarray.is_sparse.is_sparse`.""" + return x._sparse
+ + + +
+[docs] +@is_masked.register +def is_masked_UnaryIsometricOpWithArgs(x: UnaryIsometricOpWithArgs): + """See :py:meth:`~delayedarray.is_masked.is_masked`.""" + return is_masked(x._seed) or numpy.ma.isMaskedArray(x._value) or x._value is numpy.ma.masked
+ + +
+
+
+
+ + +
+
+ + Made with Sphinx and @pradyunsg's + + Furo + +
+
+ +
+
+ +
+
+ +
+
+ + + + + \ No newline at end of file diff --git a/_modules/delayedarray/apply_over_blocks.html b/_modules/delayedarray/apply_over_blocks.html new file mode 100644 index 0000000..45dfd6c --- /dev/null +++ b/_modules/delayedarray/apply_over_blocks.html @@ -0,0 +1,346 @@ + + + + + + + + delayedarray.apply_over_blocks - DelayedArray 0.6.2 documentation + + + + + + + + + + + + + + + + + Contents + + + + + + Menu + + + + + + + + Expand + + + + + + Light mode + + + + + + + + + + + + + + Dark mode + + + + + + + Auto light/dark, in light mode + + + + + + + + + + + + + + + Auto light/dark, in dark mode + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +Skip to content + + + +
+
+
+ +
+ +
+
+ +
+ +
+
+ +
+
+
+ + + + + Back to top + +
+
+ +
+ +
+
+

Source code for delayedarray.apply_over_blocks

+from typing import Callable, Optional, Tuple
+import math
+
+from .chunk_grid import chunk_grid
+from .Grid import AbstractGrid
+from .is_sparse import is_sparse
+from .extract_dense_array import extract_dense_array
+from .extract_sparse_array import extract_sparse_array
+from .default_buffer_size import default_buffer_size
+
+__author__ = "ltla"
+__copyright__ = "ltla"
+__license__ = "MIT"
+
+
+
+[docs] +def apply_over_blocks(x, fun: Callable, allow_sparse: bool = False, grid: Optional[AbstractGrid] = None, buffer_size: Optional[int] = None) -> list: + """ + Iterate over an array by blocks. We apply a user-provided function and + collect the results before proceeding to the next block. + + Args: + x: An array-like object. + + fun: + Function to apply to each block. This should accept two arguments; + the first is a list containing the start/end of the current block + on each dimension, and the second is the block contents. Each + block is typically provided as a :py:class:`~numpy.ndarray`. + + allow_sparse: + Whether to allow extraction of sparse subarrays. If true and ``x`` + contains a sparse array, the block contents are instead represented + by a :py:class:`~delayedarray.SparseNdarray.SparseNdarray`. + + grid: + Grid to subdivide ``x`` for iteration. Specifically, iteration will + attempt to extract blocks that are aligned with the grid boundaries, + e.g., to optimize extraction of chunked data. Defaults to the output + of :py:func:`~delayedarray.chunk_grid.chunk_grid` on ``x``. + + buffer_size: + Buffer_size in bytes, to hold a single block per iteration. + Larger values generally improve speed at the cost of memory. + If ``None``, defaults to the value returned by :py:func:`~delayedarray.default_buffer_size.default_buffer_size`. + + Returns: + List containing the output of ``fun`` on each block. + """ + if grid is None: + grid = chunk_grid(x) + + if allow_sparse and is_sparse(x): + extractor = extract_sparse_array + else: + extractor = extract_dense_array + + dims = (*range(len(x.shape)),) + collected = [] + + if buffer_size is None: + buffer_size = default_buffer_size() + buffer_elements = buffer_size // x.dtype.itemsize + + for job in grid.iterate(dims, buffer_elements = buffer_elements): + subsets = (*(range(s, e) for s, e in job),) + output = fun(job, extractor(x, subsets)) + collected.append(output) + + return collected
+ +
+
+
+
+ + +
+
+ + Made with Sphinx and @pradyunsg's + + Furo + +
+
+ +
+
+ +
+
+ +
+
+ + + + + \ No newline at end of file diff --git a/_modules/delayedarray/apply_over_dimension.html b/_modules/delayedarray/apply_over_dimension.html new file mode 100644 index 0000000..d1e9fe1 --- /dev/null +++ b/_modules/delayedarray/apply_over_dimension.html @@ -0,0 +1,349 @@ + + + + + + + + delayedarray.apply_over_dimension - DelayedArray 0.6.2 documentation + + + + + + + + + + + + + + + + + Contents + + + + + + Menu + + + + + + + + Expand + + + + + + Light mode + + + + + + + + + + + + + + Dark mode + + + + + + + Auto light/dark, in light mode + + + + + + + + + + + + + + + Auto light/dark, in dark mode + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +Skip to content + + + +
+
+
+ +
+ +
+
+ +
+ +
+
+ +
+
+
+ + + + + Back to top + +
+
+ +
+ +
+
+

Source code for delayedarray.apply_over_dimension

+from typing import Callable, Optional
+import math
+
+from .chunk_grid import chunk_grid
+from .Grid import AbstractGrid
+from .is_sparse import is_sparse
+from .extract_dense_array import extract_dense_array
+from .extract_sparse_array import extract_sparse_array
+from .default_buffer_size import default_buffer_size
+
+__author__ = "ltla"
+__copyright__ = "ltla"
+__license__ = "MIT"
+
+
+
+[docs] +def apply_over_dimension(x, dimension: int, fun: Callable, allow_sparse: bool = False, grid: Optional[AbstractGrid] = None, buffer_size: Optional[int] = None) -> list: + """ + Iterate over an array on a certain dimension. At each iteration, the block + of observations consists of the full extent of all dimensions other than + the one being iterated over. We apply a user-provided function and collect + the results before proceeding to the next block. + + Args: + x: An array-like object. + + dimension: Dimension to iterate over. + + fun: + Function to apply to each block. This should accept two arguments; + the first is a tuple containing the start/end of the current block + on the chosen ``dimension``, and the second is the block contents. + Each block is typically provided as a :py:class:`~numpy.ndarray`. + + allow_sparse: + Whether to allow extraction of sparse subarrays. If true and ``x`` + contains a sparse array, the block contents are instead represented + by a :py:class:`~delayedarray.SparseNdarray.SparseNdarray`. + + grid: + Grid to subdivide ``x`` for iteration. Specifically, iteration will + attempt to extract blocks that are aligned with the grid boundaries, + e.g., to optimize extraction of chunked data. Defaults to the output + of :py:func:`~delayedarray.chunk_grid.chunk_grid` on ``x``. + + buffer_size: + Buffer_size in bytes, to hold a single block per iteration. + Larger values generally improve speed at the cost of memory. + If ``None``, defaults to the value returned by :py:func:`~delayedarray.default_buffer_size.default_buffer_size`. + + Returns: + List containing the output of ``fun`` on each block. + """ + if grid is None: + grid = chunk_grid(x) + + components = [range(n) for n in x.shape] + if allow_sparse and is_sparse(x): + extractor = extract_sparse_array + else: + extractor = extract_dense_array + + if buffer_size is None: + buffer_size = default_buffer_size() + buffer_elements = buffer_size // x.dtype.itemsize + + collected = [] + for job in grid.iterate((dimension,), buffer_elements = buffer_elements): + subsets = (*(range(s, e) for s, e in job),) + output = fun(job[dimension], extractor(x, subsets)) + collected.append(output) + + return collected
+ +
+
+
+
+ + +
+
+ + Made with Sphinx and @pradyunsg's + + Furo + +
+
+ +
+
+ +
+
+ +
+
+ + + + + \ No newline at end of file diff --git a/_modules/delayedarray/chunk_grid.html b/_modules/delayedarray/chunk_grid.html new file mode 100644 index 0000000..632d619 --- /dev/null +++ b/_modules/delayedarray/chunk_grid.html @@ -0,0 +1,434 @@ + + + + + + + + delayedarray.chunk_grid - DelayedArray 0.6.2 documentation + + + + + + + + + + + + + + + + + Contents + + + + + + Menu + + + + + + + + Expand + + + + + + Light mode + + + + + + + + + + + + + + Dark mode + + + + + + + Auto light/dark, in light mode + + + + + + + + + + + + + + + Auto light/dark, in dark mode + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +Skip to content + + + +
+
+
+ +
+ +
+
+ +
+ +
+
+ +
+
+
+ + + + + Back to top + +
+
+ +
+ +
+
+

Source code for delayedarray.chunk_grid

+from functools import singledispatch
+from typing import Any, Tuple, Sequence
+from numpy import ndarray
+from biocutils.package_utils import is_package_installed
+
+from .SparseNdarray import SparseNdarray
+from .RegularTicks import RegularTicks
+from .Grid import SimpleGrid, AbstractGrid
+
+__author__ = "ltla"
+__copyright__ = "ltla"
+__license__ = "MIT"
+
+
+
+[docs] +def chunk_shape_to_grid(chunks: Sequence[int], shape: Tuple[int, ...], cost_factor: int) -> SimpleGrid: + """ + Convert a chunk shape to a :py:class:`~delayedarray.Grid.SimpleGrid`. + This assumes that the underlying array is split up into regular intervals + on each dimension; the first chunk should start from zero, and only the + last chunk may be of a different size (bounded by the dimension extent). + + Args: + chunks: + Chunk size for each dimension. These should be positive. + + shape: + Extent of each dimension of the array. These should be non-negative + and of the same length as ``chunks``. + + cost_factor: + Cost factor for iterating over each element of the associated + array. This is used to decide between iteration schemes and can be + increased for more expensive types, e.g., file-backed arrays. As a + reference, in-memory NumPy arrays are assigned a cost factor of 1. + + Returns: + A ``SimpleGrid`` object with the chunk shape as the boundaries. + """ + out = [] + for i, ch in enumerate(chunks): + sh = shape[i] + if sh == 0: + out.append([]) + elif ch == sh: + out.append([sh]) + else: + out.append(RegularTicks(ch, sh)) + return SimpleGrid((*out,), cost_factor=cost_factor)
+ + + +
+[docs] +@singledispatch +def chunk_grid(x: Any) -> AbstractGrid: + """ + Create a grid over the array, used to determine how a caller should iterate + over that array. The intervals of the grid usually reflects a particular + layout of the data on disk or in memory. + + Args: + x: An array-like object. + + Returns: + An instance of a :py:class:`~delayedarray.Grid.AbstractGrid`. + """ + raise NotImplementedError("'chunk_grid(" + str(type(x)) + ")' has not yet been implemented")
+ + + +
+[docs] +@chunk_grid.register +def chunk_grid_ndarray(x: ndarray) -> SimpleGrid: + """ + See :py:meth:`~delayedarray.chunk_grid.chunk_grid`. + + The cost factor for iteration is set to 1, which is considered the lowest + cost for data extraction given that everything is stored in memory. + """ + raw = [1] * len(x.shape) + if x.flags.f_contiguous: + raw[0] = x.shape[0] + else: + # Not sure how to deal with strided views here; not even sure how + # to figure that out from NumPy flags. Guess we should just assume + # that it's C-contiguous, given that most things are. + raw[-1] = x.shape[-1] + return chunk_shape_to_grid(raw, x.shape, cost_factor=1)
+ + + +
+[docs] +@chunk_grid.register +def chunk_grid_SparseNdarray(x: SparseNdarray) -> SimpleGrid: + """ + See :py:meth:`~delayedarray.chunk_grid.chunk_grid`. + + The cost factor for iteration is set to 1.5. This is slightly higher than + that of dense NumPy arrays as the ``SparseNdarray`` is a bit more expensive + for random access on the first dimension. + """ + raw = [1] * len(x.shape) + raw[0] = x.shape[0] + return chunk_shape_to_grid(raw, x.shape, cost_factor=1.5)
+ + + +# If scipy is installed, we add all the methods for the various scipy.sparse matrices. + +if is_package_installed("scipy"): + import scipy.sparse as sp + + +
+[docs] + @chunk_grid.register + def chunk_grid_csc_matrix(x: sp.csc_matrix) -> SimpleGrid: + """ + See :py:meth:`~delayedarray.chunk_grid.chunk_grid`. + + The cost factor for iteration is set to 1.5. This is slightly higher + than that of dense NumPy arrays as CSC matrices are a bit more + expensive for random row access. + """ + return chunk_shape_to_grid((x.shape[0], 1), x.shape, cost_factor=1.5)
+ + + +
+[docs] + @chunk_grid.register + def chunk_grid_csr_matrix(x: sp.csr_matrix) -> SimpleGrid: + """ + See :py:meth:`~delayedarray.chunk_grid.chunk_grid`. + + The cost factor for iteration is set to 1.5. This is slightly higher + than that of dense NumPy arrays as CSR matrices are a bit more + expensive for random column access. + """ + return chunk_shape_to_grid((1, x.shape[1]), x.shape, cost_factor=1.5)
+ + + +
+[docs] + @chunk_grid.register + def chunk_grid_coo_matrix(x: sp.coo_matrix) -> SimpleGrid: + """ + See :py:meth:`~delayedarray.chunk_grid.chunk_grid`. + + The cost factor for iteration is set to 5, as any extraction from a COO + matrix requires a full scan through all elements. + """ + # ???? let's just do our best here, there's no nice way to access COO. + return chunk_shape_to_grid(x.shape, x.shape, cost_factor=5)
+ +
+
+
+
+ + +
+
+ + Made with Sphinx and @pradyunsg's + + Furo + +
+
+ +
+
+ +
+
+ +
+
+ + + + + \ No newline at end of file diff --git a/_modules/delayedarray/create_dask_array.html b/_modules/delayedarray/create_dask_array.html new file mode 100644 index 0000000..439d907 --- /dev/null +++ b/_modules/delayedarray/create_dask_array.html @@ -0,0 +1,303 @@ + + + + + + + + delayedarray.create_dask_array - DelayedArray 0.6.2 documentation + + + + + + + + + + + + + + + + + Contents + + + + + + Menu + + + + + + + + Expand + + + + + + Light mode + + + + + + + + + + + + + + Dark mode + + + + + + + Auto light/dark, in light mode + + + + + + + + + + + + + + + Auto light/dark, in dark mode + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +Skip to content + + + +
+
+
+ +
+ +
+
+ +
+ +
+
+ +
+
+
+ + + + + Back to top + +
+
+ +
+ +
+
+

Source code for delayedarray.create_dask_array

+from functools import singledispatch
+from typing import Any, TYPE_CHECKING
+if TYPE_CHECKING:
+    import dask.array
+
+__author__ = "ltla"
+__copyright__ = "ltla"
+__license__ = "MIT"
+
+
+
+[docs] +@singledispatch +def create_dask_array(x: Any) -> "dask.array.core.Array": + """Create a dask array containing the delayed operations, assuming + the **dask** package is installed. + + Args: + x: Any array-like object. + + Returns: + A dask array, possibly containing delayed operations. + """ + import dask.array + if isinstance(x, dask.array.core.Array): + return x + else: + return dask.array.from_array(x)
+ +
+
+
+
+ + +
+
+ + Made with Sphinx and @pradyunsg's + + Furo + +
+
+ +
+
+ +
+
+ +
+
+ + + + + \ No newline at end of file diff --git a/_modules/delayedarray/default_buffer_size.html b/_modules/delayedarray/default_buffer_size.html new file mode 100644 index 0000000..a8a1924 --- /dev/null +++ b/_modules/delayedarray/default_buffer_size.html @@ -0,0 +1,310 @@ + + + + + + + + delayedarray.default_buffer_size - DelayedArray 0.6.2 documentation + + + + + + + + + + + + + + + + + Contents + + + + + + Menu + + + + + + + + Expand + + + + + + Light mode + + + + + + + + + + + + + + Dark mode + + + + + + + Auto light/dark, in light mode + + + + + + + + + + + + + + + Auto light/dark, in dark mode + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +Skip to content + + + +
+
+
+ +
+ +
+
+ +
+ +
+
+ +
+
+
+ + + + + Back to top + +
+
+ +
+ +
+
+

Source code for delayedarray.default_buffer_size

+from typing import Optional
+
+__author__ = "ltla"
+__copyright__ = "ltla"
+__license__ = "MIT"
+
+
+old_buffer_size = 1e8
+
+
+
+[docs] +def default_buffer_size(buffer_size: Optional[int] = None) -> int: + """ + Get or set the default buffer size used by :py:func:`~delayedarray.apply_over_blocks.apply_over_blocks`, + :py:func:`~delayedarray.apply_over_dimension.apply_over_dimension`, etc. + + Args: + buffer_size: + Buffer size in bytes. + The buffer is typically used to load a block of an array in memory for further processing. + Alternatively ``None``. + + Returns: + If ``buffer_size = None``, the current default buffer size is returned. + + If ``buffer_size`` is an integer, the default buffer size is set to this value, and the previous buffer size is returned. + """ + global old_buffer_size + if buffer_size is None: + return old_buffer_size + + previous = old_buffer_size + old_buffer_size = buffer_size + return previous
+ +
+
+
+
+ + +
+
+ + Made with Sphinx and @pradyunsg's + + Furo + +
+
+ +
+
+ +
+
+ +
+
+ + + + + \ No newline at end of file diff --git a/_modules/delayedarray/extract_dense_array.html b/_modules/delayedarray/extract_dense_array.html new file mode 100644 index 0000000..7d9e011 --- /dev/null +++ b/_modules/delayedarray/extract_dense_array.html @@ -0,0 +1,388 @@ + + + + + + + + delayedarray.extract_dense_array - DelayedArray 0.6.2 documentation + + + + + + + + + + + + + + + + + Contents + + + + + + Menu + + + + + + + + Expand + + + + + + Light mode + + + + + + + + + + + + + + Dark mode + + + + + + + Auto light/dark, in light mode + + + + + + + + + + + + + + + Auto light/dark, in dark mode + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +Skip to content + + + +
+
+
+ +
+ +
+
+ +
+ +
+
+ +
+
+
+ + + + + Back to top + +
+
+ +
+ +
+
+

Source code for delayedarray.extract_dense_array

+from functools import singledispatch
+import numpy
+from typing import Any, Tuple, Sequence
+from biocutils.package_utils import is_package_installed
+
+from ._subset import _is_subset_noop
+from .SparseNdarray import SparseNdarray, _extract_dense_array_from_SparseNdarray
+
+__author__ = "ltla"
+__copyright__ = "ltla"
+__license__ = "MIT"
+
+
+
+[docs] +@singledispatch +def extract_dense_array(x: Any, subset: Tuple[Sequence[int], ...]) -> numpy.ndarray: + """ + Extract a subset of an array-like object into a dense NumPy array. + + Args: + x: + Any array-like object. + + subset: + Tuple of length equal to the number of dimensions, each containing + a sorted and unique sequence of integers specifying the elements of + each dimension to extract. + + Returns: + NumPy array for the specified subset. This may be a view so callers + should create a copy if they intend to modify it. + + If :py:func:`~delayedarray.is_masked.is_masked` is True for ``x``, a NumPy + ``MaskedArray`` is returned instead. + """ + raise NotImplementedError("'extract_dense_array(" + str(type(x)) + ")' has not yet been implemented")
+ + + +
+[docs] +@extract_dense_array.register +def extract_dense_array_ndarray(x: numpy.ndarray, subset: Tuple[Sequence[int], ...]) -> numpy.ndarray: + """See :py:meth:`~delayedarray.extract_dense_array.extract_dense_array`.""" + if _is_subset_noop(x.shape, subset): + return x + else: + return x[numpy.ix_(*subset)]
+ + + +
+[docs] +@extract_dense_array.register +def extract_dense_array_SparseNdarray(x: SparseNdarray, subset: Tuple[Sequence[int], ...]) -> numpy.ndarray: + """See :py:meth:`~delayedarray.extract_dense_array.extract_dense_array`.""" + return _extract_dense_array_from_SparseNdarray(x, subset)
+ + + +if is_package_installed("scipy"): + import scipy.sparse as sp + + def _extract_dense_array_sparse(x, subset: Tuple[Sequence[int], ...]) -> numpy.ndarray: + if _is_subset_noop(x.shape, subset): + tmp = x + else: + # This just drops any masking on the scipy data; so, not our fault. + # I am inclined to believe that scipy.sparse does not support + # masked arrays, which is fine with me. + tmp = x[numpy.ix_(*subset)] + return tmp.toarray() + + +
+[docs] + @extract_dense_array.register + def extract_dense_array_csc_matrix(x: sp.csc_matrix, subset: Tuple[Sequence[int], ...]) -> numpy.ndarray: + """See :py:meth:`~delayedarray.extract_dense_array.extract_dense_array`.""" + return _extract_dense_array_sparse(x, subset)
+ + + +
+[docs] + @extract_dense_array.register + def extract_dense_array_csr_matrix(x: sp.csr_matrix, subset: Tuple[Sequence[int], ...]) -> numpy.ndarray: + """See :py:meth:`~delayedarray.extract_dense_array.extract_dense_array`.""" + return _extract_dense_array_sparse(x, subset)
+ + + +
+[docs] + @extract_dense_array.register + def extract_dense_array_coo_matrix(x: sp.coo_matrix, subset: Tuple[Sequence[int], ...]) -> numpy.ndarray: + """See :py:meth:`~delayedarray.extract_dense_array.extract_dense_array`.""" + return _extract_dense_array_sparse(x, subset)
+ + + +
+[docs] + def extract_dense_array_sparse_array(x, subset: Tuple[Sequence[int], ...]) -> numpy.ndarray: + """See :py:meth:`~delayedarray.extract_dense_array.extract_dense_array`.""" + return _extract_dense_array_sparse(x, subset)
+ + + + try: + extract_dense_array.register(sp.sparray, extract_dense_array_sparse_array) + except Exception: + pass +
+
+
+
+ + +
+
+ + Made with Sphinx and @pradyunsg's + + Furo + +
+
+ +
+
+ +
+
+ +
+
+ + + + + \ No newline at end of file diff --git a/_modules/delayedarray/extract_sparse_array.html b/_modules/delayedarray/extract_sparse_array.html new file mode 100644 index 0000000..242b6d0 --- /dev/null +++ b/_modules/delayedarray/extract_sparse_array.html @@ -0,0 +1,508 @@ + + + + + + + + delayedarray.extract_sparse_array - DelayedArray 0.6.2 documentation + + + + + + + + + + + + + + + + + Contents + + + + + + Menu + + + + + + + + Expand + + + + + + Light mode + + + + + + + + + + + + + + Dark mode + + + + + + + Auto light/dark, in light mode + + + + + + + + + + + + + + + Auto light/dark, in dark mode + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +Skip to content + + + +
+
+
+ +
+ +
+
+ +
+ +
+
+ +
+
+
+ + + + + Back to top + +
+
+ +
+ +
+
+

Source code for delayedarray.extract_sparse_array

+from functools import singledispatch
+import numpy
+from bisect import bisect_left
+from typing import Any, Tuple, Sequence, List, Union
+from biocutils.package_utils import is_package_installed
+
+from ._subset import _is_subset_noop, _is_subset_consecutive
+from ._mask import _convert_to_unmasked_1darray, _convert_to_maybe_masked_1darray, _allocate_unmasked_ndarray, _allocate_maybe_masked_ndarray
+from .SparseNdarray import SparseNdarray, _extract_sparse_array_from_SparseNdarray
+
+__author__ = "ltla"
+__copyright__ = "ltla"
+__license__ = "MIT"
+
+
+
+[docs] +@singledispatch +def extract_sparse_array(x: Any, subset: Tuple[Sequence[int], ...]) -> SparseNdarray: + """Extract the contents of ``x`` (or a subset thereof) into a + :py:class:`~delayedarray.SparseNdarray.SparseNdarray`. This should only be + used for ``x`` where :py:meth:`~delayedarray.is_sparse.is_sparse` is True. + + Args: + x: + Any array-like object containing sparse data. + + subset: + Tuple of length equal to the number of dimensions, each containing + a sorted and unique sequence of integers specifying the elements of + each dimension to extract. + + Returns: + ``SparseNdarray`` for the requested subset. This may be a view so + callers should create a copy if they intend to modify it. + + If :py:func:`~delayedarray.is_masked.is_masked` is True for ``x``, the + ``SparseNdarray`` will contain NumPy ``MaskedArray``s internally. + """ + raise NotImplementedError("'extract_sparse_array(" + str(type(x)) + ")' has not yet been implemented")
+ + + +
+[docs] +@extract_sparse_array.register +def extract_sparse_array_SparseNdarray(x: SparseNdarray, subset: Tuple[Sequence[int], ...]) -> SparseNdarray: + """See :py:meth:`~delayedarray.extract_sparse_array.extract_sparse_array`.""" + if _is_subset_noop(x.shape, subset): + return x + else: + return _extract_sparse_array_from_SparseNdarray(x, subset)
+ + + +if is_package_installed("scipy"): + import scipy.sparse as sp + + + def _set_empty_contents(contents: List) -> Union[List, None]: + for x in contents: + if x is not None: + return contents + return None + + +
+[docs] + @extract_sparse_array.register + def extract_sparse_array_csc_matrix(x: sp.csc_matrix, subset: Tuple[Sequence[int], ...]) -> SparseNdarray: + """See :py:meth:`~delayedarray.extract_sparse_array.extract_sparse_array`.""" + final_shape = [len(s) for s in subset] + new_contents = None + + if final_shape[0] != 0 and final_shape[1] != 0: + rowsub = subset[0] + row_consecutive = _is_subset_consecutive(rowsub) + first = rowsub[0] + last = rowsub[-1] + 1 + + new_contents = [] + for ci in subset[1]: + start_pos = x.indptr[ci] + end_pos = x.indptr[ci + 1] + if first != 0: + start_pos = bisect_left(x.indices, first, lo=start_pos, hi=end_pos) + + if row_consecutive: + if last != x.shape[0]: + end_pos = bisect_left(x.indices, last, lo=start_pos, hi=end_pos) + + if end_pos > start_pos: + tmp = x.indices[start_pos:end_pos] + if first: + tmp = tmp - first # don't use -=, this might modify the view by reference. + new_contents.append((tmp, x.data[start_pos:end_pos])) + else: + new_contents.append(None) + + else: + new_val = [] + new_idx = [] + pos = 0 + for p in range(start_pos, end_pos): + ri = x.indices[p] + while pos < len(rowsub) and ri > rowsub[pos]: + pos += 1 + if pos == len(rowsub): + break + if ri == rowsub[pos]: + new_idx.append(pos) + new_val.append(x.data[p]) + pos += 1 + + if len(new_val): + new_contents.append(( + _convert_to_unmasked_1darray(new_idx, dtype=x.indices.dtype), + _convert_to_maybe_masked_1darray(new_val, dtype=x.data.dtype, masked=numpy.ma.isMaskedArray(x.data)) + )) + else: + new_contents.append(None) + + new_contents = _set_empty_contents(new_contents) + + return SparseNdarray((*final_shape,), new_contents, dtype=x.dtype, index_dtype=x.indices.dtype, is_masked=False, check=False)
+ + + +
+[docs] + @extract_sparse_array.register + def extract_sparse_array_csr_matrix(x: sp.csr_matrix, subset: Tuple[Sequence[int], ...]) -> SparseNdarray: + """See :py:meth:`~delayedarray.extract_sparse_array.extract_sparse_array`.""" + final_shape = [len(s) for s in subset] + new_contents = None + + if final_shape[0] != 0 and final_shape[1] != 0: + colsub = subset[1] + col_consecutive = _is_subset_consecutive(colsub) + cfirst = colsub[0] + clast = colsub[-1] + 1 + + new_contents = [] + for i in range(len(colsub)): + new_contents.append(([], [])) + + for rpos, ri in enumerate(subset[0]): + start_pos = x.indptr[ri] + end_pos = x.indptr[ri + 1] + if cfirst != 0: + start_pos = bisect_left(x.indices, cfirst, lo=start_pos, hi=end_pos) + + if col_consecutive: + if clast != x.shape[1]: + end_pos = bisect_left(x.indices, clast, lo=start_pos, hi=end_pos) + + for p in range(start_pos, end_pos): + ci = x.indices[p] + idx, val = new_contents[ci - cfirst] + idx.append(rpos) + val.append(x.data[p]) + + else: + cpos = 0 + for p in range(start_pos, end_pos): + ci = x.indices[p] + while cpos < len(colsub) and ci > colsub[cpos]: + cpos += 1 + if cpos == len(colsub): + break + if ci == colsub[cpos]: + idx, val = new_contents[cpos] + idx.append(rpos) + val.append(x.data[p]) + cpos += 1 + + for i in range(len(new_contents)): + idx, val = new_contents[i] + if len(idx): + new_contents[i] = ( + _convert_to_unmasked_1darray(idx, dtype=x.indices.dtype), + _convert_to_maybe_masked_1darray(val, dtype=x.data.dtype, masked=numpy.ma.isMaskedArray(x.data)) + ) + else: + new_contents[i] = None + + new_contents = _set_empty_contents(new_contents) + + return SparseNdarray((*final_shape,), new_contents, dtype=x.dtype, index_dtype=x.indices.dtype, is_masked=False, check=False)
+ + + +
+[docs] + @extract_sparse_array.register + def extract_sparse_array_coo_matrix(x: sp.coo_matrix, subset: Tuple[Sequence[int], ...]) -> SparseNdarray: + """See :py:meth:`~delayedarray.extract_sparse_array.extract_sparse_array`.""" + final_shape = [len(s) for s in subset] + new_contents = None + + if final_shape[0] != 0 and final_shape[1] != 0: + in_row = {} + for i, y in enumerate(subset[0]): + in_row[y] = i + + in_col = {} + new_contents = [] + for i, y in enumerate(subset[1]): + in_col[y] = i + new_contents.append([]) + + for i, v in enumerate(x.data): + r = x.row[i] + c = x.col[i] + if r in in_row and c in in_col: + new_contents[in_col[c]].append((in_row[r], v)) + + for i, con in enumerate(new_contents): + if len(con): + con.sort() + shape = (len(con),) + idx = _allocate_unmasked_ndarray(shape, dtype=x.row.dtype) + val = _allocate_maybe_masked_ndarray(shape, dtype=x.data.dtype, masked=numpy.ma.isMaskedArray(x.data)) + for j, y in enumerate(con): + idx[j] = y[0] + val[j] = y[1] + new_contents[i] = (idx, val) + else: + new_contents[i] = None + + new_contents = _set_empty_contents(new_contents) + + return SparseNdarray((*final_shape,), new_contents, dtype=x.dtype, index_dtype=x.row.dtype, is_masked=False, check=False)
+ +
+
+
+
+ + +
+
+ + Made with Sphinx and @pradyunsg's + + Furo + +
+
+ +
+
+ +
+
+ +
+
+ + + + + \ No newline at end of file diff --git a/_modules/delayedarray/is_masked.html b/_modules/delayedarray/is_masked.html new file mode 100644 index 0000000..179233d --- /dev/null +++ b/_modules/delayedarray/is_masked.html @@ -0,0 +1,362 @@ + + + + + + + + delayedarray.is_masked - DelayedArray 0.6.2 documentation + + + + + + + + + + + + + + + + + Contents + + + + + + Menu + + + + + + + + Expand + + + + + + Light mode + + + + + + + + + + + + + + Dark mode + + + + + + + Auto light/dark, in light mode + + + + + + + + + + + + + + + Auto light/dark, in dark mode + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +Skip to content + + + +
+
+
+ +
+ +
+
+ +
+ +
+
+ +
+
+
+ + + + + Back to top + +
+
+ +
+ +
+
+

Source code for delayedarray.is_masked

+from functools import singledispatch
+from typing import Any
+import numpy
+from biocutils.package_utils import is_package_installed
+
+from .SparseNdarray import SparseNdarray
+
+
+
+[docs] +@singledispatch +def is_masked(x: Any) -> bool: + """ + Determine whether an array-like object contains masked values, + equivalent to those in NumPy's ``MaskedArray`` class. + + Args: + x: Any array-like object. + + Returns: + Whether ``x`` contains masked values. + """ + raise NotImplementedError("'is_masked(" + str(type(x)) + ")' has not yet been implemented")
+ + + +
+[docs] +@is_masked.register +def is_masked_ndarray(x: numpy.ndarray): + """See :py:meth:`~delayedarray.is_masked.is_masked`.""" + return False
+ + + +
+[docs] +@is_masked.register +def is_masked_MaskedArray(x: numpy.ma.core.MaskedArray): + """See :py:meth:`~delayedarray.is_masked.is_masked`.""" + return True
+ + + +
+[docs] +@is_masked.register +def is_masked_SparseNdarray(x: SparseNdarray): + """See :py:meth:`~delayedarray.is_masked.is_masked`.""" + return x._is_masked
+ + +# If scipy is installed, we add all the methods for the various scipy.sparse +# matrices. Currently, it seems like scipy's sparse matrices are not intended +# to be masked, seeing as how any subsetting discards the masks, e.g., +# +# >>> y = (scipy.sparse.random(1000, 200, 0.1)).tocsr() +# >>> y.data = numpy.ma.MaskedArray(y.data, y.data > 0.5) +# >>> y[0:5,:].data # gives back a regulary NumPy array. +# +# So we won't bother capturing the mask state (as of scipy 1.11.1). + +if is_package_installed("scipy"): + import scipy.sparse as sp + +
+[docs] + @is_masked.register + def is_masked_csc_matrix(x: sp.csc_matrix): + """See :py:meth:`~delayedarray.is_masked.is_masked`.""" + return False
+ + +
+[docs] + @is_masked.register + def is_masked_csr_matrix(x: sp.csr_matrix): + """See :py:meth:`~delayedarray.is_masked.is_masked`.""" + return False
+ + +
+[docs] + @is_masked.register + def is_masked_coo_matrix(x: sp.coo_matrix): + """See :py:meth:`~delayedarray.is_masked.is_masked`.""" + return False
+ +
+
+
+
+ + +
+
+ + Made with Sphinx and @pradyunsg's + + Furo + +
+
+ +
+
+ +
+
+ +
+
+ + + + + \ No newline at end of file diff --git a/_modules/delayedarray/is_pristine.html b/_modules/delayedarray/is_pristine.html new file mode 100644 index 0000000..082d11a --- /dev/null +++ b/_modules/delayedarray/is_pristine.html @@ -0,0 +1,294 @@ + + + + + + + + delayedarray.is_pristine - DelayedArray 0.6.2 documentation + + + + + + + + + + + + + + + + + Contents + + + + + + Menu + + + + + + + + Expand + + + + + + Light mode + + + + + + + + + + + + + + Dark mode + + + + + + + Auto light/dark, in light mode + + + + + + + + + + + + + + + Auto light/dark, in dark mode + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +Skip to content + + + +
+
+
+ +
+ +
+
+ +
+ +
+
+ +
+
+
+ + + + + Back to top + +
+
+ +
+ +
+
+

Source code for delayedarray.is_pristine

+from .DelayedArray import DelayedArray
+from .DelayedOp import DelayedOp
+
+
+
+[docs] +def is_pristine(x) -> bool: + """Determine whether an object is pristine, i.e., has no delayed operations. + + Args: + x: Some array-like object. + + Returns: + Whether ``x`` is a :py:class:`~delayedarray.DelayedArray.DelayedArray` + containing delayed operations. + """ + if isinstance(x, DelayedArray): + x = x.seed + return not isinstance(x, DelayedOp)
+ +
+
+
+
+ + +
+
+ + Made with Sphinx and @pradyunsg's + + Furo + +
+
+ +
+
+ +
+
+ +
+
+ + + + + \ No newline at end of file diff --git a/_modules/delayedarray/is_sparse.html b/_modules/delayedarray/is_sparse.html new file mode 100644 index 0000000..39a4bfb --- /dev/null +++ b/_modules/delayedarray/is_sparse.html @@ -0,0 +1,339 @@ + + + + + + + + delayedarray.is_sparse - DelayedArray 0.6.2 documentation + + + + + + + + + + + + + + + + + Contents + + + + + + Menu + + + + + + + + Expand + + + + + + Light mode + + + + + + + + + + + + + + Dark mode + + + + + + + Auto light/dark, in light mode + + + + + + + + + + + + + + + Auto light/dark, in dark mode + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +Skip to content + + + +
+
+
+ +
+ +
+
+ +
+ +
+
+ +
+
+
+ + + + + Back to top + +
+
+ +
+ +
+
+

Source code for delayedarray.is_sparse

+from functools import singledispatch
+from typing import Any
+from biocutils.package_utils import is_package_installed
+
+from .SparseNdarray import SparseNdarray
+
+__author__ = "ltla"
+__copyright__ = "ltla"
+__license__ = "MIT"
+
+
+
+[docs] +@singledispatch +def is_sparse(x: Any) -> bool: + """Determine whether an array-like object contains sparse data. + + Args: + x: Any array-like object. + + Returns: + Whether ``x`` contains sparse data. If no method is defined + for ``x``, False is returned by default. + """ + return False
+ + + +
+[docs] +@is_sparse.register +def is_sparse_SparseNdarray(x: SparseNdarray): + """See :py:meth:`~delayedarray.is_sparse.is_sparse`.""" + return True
+ + + +# If scipy is installed, we add all the methods for the various scipy.sparse matrices. + +if is_package_installed("scipy"): + import scipy.sparse as sp + +
+[docs] + @is_sparse.register + def is_sparse_csc_matrix(x: sp.csc_matrix): + """See :py:meth:`~delayedarray.is_sparse.is_sparse`.""" + return True
+ + +
+[docs] + @is_sparse.register + def is_sparse_csr_matrix(x: sp.csr_matrix): + """See :py:meth:`~delayedarray.is_sparse.is_sparse`.""" + return True
+ + +
+[docs] + @is_sparse.register + def is_sparse_coo_matrix(x: sp.coo_matrix): + """See :py:meth:`~delayedarray.is_sparse.is_sparse`.""" + return True
+ +
+
+
+
+ + +
+
+ + Made with Sphinx and @pradyunsg's + + Furo + +
+
+ +
+
+ +
+
+ +
+
+ + + + + \ No newline at end of file diff --git a/_modules/delayedarray/to_dense_array.html b/_modules/delayedarray/to_dense_array.html new file mode 100644 index 0000000..0f9e1c1 --- /dev/null +++ b/_modules/delayedarray/to_dense_array.html @@ -0,0 +1,299 @@ + + + + + + + + delayedarray.to_dense_array - DelayedArray 0.6.2 documentation + + + + + + + + + + + + + + + + + Contents + + + + + + Menu + + + + + + + + Expand + + + + + + Light mode + + + + + + + + + + + + + + Dark mode + + + + + + + Auto light/dark, in light mode + + + + + + + + + + + + + + + Auto light/dark, in dark mode + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +Skip to content + + + +
+
+
+ +
+ +
+
+ +
+ +
+
+ +
+
+
+ + + + + Back to top + +
+
+ +
+ +
+
+

Source code for delayedarray.to_dense_array

+from functools import singledispatch
+from typing import Any
+import numpy
+
+from .extract_dense_array import extract_dense_array
+from ._subset import _spawn_indices
+
+
+
+[docs] +@singledispatch +def to_dense_array(x: Any) -> numpy.ndarray: + """ + Extract ``x`` as a dense NumPy array. The default method simply calls + :py:func:`~delayedarray.extract_dense_array.extract_dense_array` with + ``subset`` set to the full extent of all dimensions. + + Args: + x: Any array-like object. + + Returns: + NumPy array contains the full contents of ``x``. This may be masked. + """ + return extract_dense_array(x, _spawn_indices(x.shape))
+ +
+
+
+
+ + +
+
+ + Made with Sphinx and @pradyunsg's + + Furo + +
+
+ +
+
+ +
+
+ +
+
+ + + + + \ No newline at end of file diff --git a/_modules/delayedarray/to_scipy_sparse_matrix.html b/_modules/delayedarray/to_scipy_sparse_matrix.html new file mode 100644 index 0000000..e9f764c --- /dev/null +++ b/_modules/delayedarray/to_scipy_sparse_matrix.html @@ -0,0 +1,410 @@ + + + + + + + + delayedarray.to_scipy_sparse_matrix - DelayedArray 0.6.2 documentation + + + + + + + + + + + + + + + + + Contents + + + + + + Menu + + + + + + + + Expand + + + + + + Light mode + + + + + + + + + + + + + + Dark mode + + + + + + + Auto light/dark, in light mode + + + + + + + + + + + + + + + Auto light/dark, in dark mode + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +Skip to content + + + +
+
+
+ +
+ +
+
+ +
+ +
+
+ +
+
+
+ + + + + Back to top + +
+
+ +
+ +
+
+

Source code for delayedarray.to_scipy_sparse_matrix

+import numpy
+from functools import singledispatch
+from typing import Any, Literal
+from biocutils.package_utils import is_package_installed
+
+from .SparseNdarray import SparseNdarray
+from .to_sparse_array import to_sparse_array
+
+
+if is_package_installed("scipy"):
+    import scipy.sparse
+
+
+    def _to_csc(x: Any) -> scipy.sparse.csc_matrix:
+        all_indptrs = numpy.zeros(x.shape[1] + 1, dtype=numpy.uint64)
+        if x.contents is not None:
+            all_indices = []
+            all_values = []
+            counter = 0
+            for i, y in enumerate(x.contents):
+                if y is not None:
+                    counter += len(y[0])
+                    all_indices.append(y[0])
+                    all_values.append(y[1])
+                all_indptrs[i + 1] = counter
+            all_indices = numpy.concatenate(all_indices)
+            all_values = numpy.concatenate(all_values)
+        else:
+            all_indices = numpy.zeros(0, dtype=x.index_dtype)
+            all_values = numpy.zeros(0, dtype=x.dtype)
+
+        return scipy.sparse.csc_matrix((all_values, all_indices, all_indptrs), shape=x.shape)
+
+
+    def _to_csr(x: Any) -> scipy.sparse.csr_matrix:
+        all_indptrs = numpy.zeros(x.shape[0] + 1, dtype=numpy.uint64)
+        if x.contents is not None:
+            # First pass (in memory) to obtain the total sizes.
+            for i, y in enumerate(x.contents):
+                if y is not None:
+                    for ix in y[0]:
+                        all_indptrs[ix + 1] += 1
+
+            for i in range(1, len(all_indptrs)):
+                all_indptrs[i] += all_indptrs[i - 1]
+            all_indices = numpy.ndarray(all_indptrs[-1], dtype=x.index_dtype)
+            all_values = numpy.ndarray(all_indptrs[-1], dtype=x.dtype)
+
+            # Second pass to fill the allocations that we just made.
+            offsets = all_indptrs.copy()
+            for i, y in enumerate(x.contents):
+                if y is not None:
+                    vals = y[1]
+                    for j, ix in enumerate(y[0]):
+                        o = offsets[ix]
+                        all_indices[o] = i
+                        all_values[o] = vals[j]
+                        offsets[ix] += 1
+        else:
+            all_indices = numpy.zeros(0, dtype=x.index_dtype)
+            all_values = numpy.zeros(0, dtype=x.dtype)
+
+        return scipy.sparse.csr_matrix((all_values, all_indices, all_indptrs), shape=x.shape)
+
+
+    def _to_coo(x: Any) -> scipy.sparse.coo_matrix:
+        if x.contents is not None:
+            # First pass (in memory) to obtain the total sizes.
+            total_count = 0
+            for i, y in enumerate(x.contents):
+                if y is not None:
+                    total_count += len(y[0])
+
+            all_rows = numpy.ndarray(total_count, dtype=x.index_dtype)
+            all_cols = numpy.ndarray(total_count, dtype=numpy.uint64)
+            all_values = numpy.ndarray(total_count, dtype=x.dtype)
+
+            # Second pass to fill the allocations that we just made.
+            counter = 0
+            for i, y in enumerate(x.contents):
+                if y is not None:
+                    vals = y[1]
+                    for j, ix in enumerate(y[0]):
+                        all_rows[counter] = ix
+                        all_cols[counter] = i
+                        all_values[counter] = vals[j]
+                        counter += 1
+        else:
+            all_indices = numpy.zeros(0, dtype=x.index_dtype)
+            all_values = numpy.zeros(0, dtype=x.dtype)
+
+        return scipy.sparse.coo_matrix((all_values, (all_rows, all_cols)), shape=x.shape)
+
+
+
+[docs] + @singledispatch + def to_scipy_sparse_matrix(x: Any, format: Literal["coo", "csr", "csc"] = "csc") -> scipy.sparse.spmatrix: + """ + Convert a 2-dimensional array into a SciPy sparse matrix. + + Args: + x: + Input matrix where :py:func:`~delayedarray.is_sparse.is_sparse` + returns True and :py:func:`~delayedarray.is_masked.is_masked` + returns False. + + format: + Type of SciPy matrix to create - coordinate (coo), compressed + sparse row (csr) or compressed sparse column (csc). + + Returns: + A SciPy sparse matrix with the contents of ``x``. + """ + # One might think that we could be more memory-efficient by doing block + # processing. However, there is no advantage from doing so as we eventually + # need to hold all the blocks in memory before concatenation. We'd only + # avoid this if we did two passes; one to collect the total size for + # allocation, and another to actually fill the vectors; not good, so we + # just forget about it and load it all into memory up-front. + return to_scipy_sparse_matrix_from_SparseNdarray(to_sparse_array(x), format=format)
+ + + +
+[docs] + @to_scipy_sparse_matrix.register + def to_scipy_sparse_matrix_from_SparseNdarray(x: SparseNdarray, format: Literal["coo", "csr", "csc"] = "csc") -> scipy.sparse.spmatrix: + """See :py:meth:`~to_scipy_sparse_matrix`.""" + if format == "csc": + return _to_csc(x) + elif format == "csr": + return _to_csr(x) + else: + return _to_coo(x)
+ +
+
+
+
+ + +
+
+ + Made with Sphinx and @pradyunsg's + + Furo + +
+
+ +
+
+ +
+
+ +
+
+ + + + + \ No newline at end of file diff --git a/_modules/delayedarray/to_sparse_array.html b/_modules/delayedarray/to_sparse_array.html new file mode 100644 index 0000000..8c8cfe0 --- /dev/null +++ b/_modules/delayedarray/to_sparse_array.html @@ -0,0 +1,300 @@ + + + + + + + + delayedarray.to_sparse_array - DelayedArray 0.6.2 documentation + + + + + + + + + + + + + + + + + Contents + + + + + + Menu + + + + + + + + Expand + + + + + + Light mode + + + + + + + + + + + + + + Dark mode + + + + + + + Auto light/dark, in light mode + + + + + + + + + + + + + + + Auto light/dark, in dark mode + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +Skip to content + + + +
+
+
+ +
+ +
+
+ +
+ +
+
+ +
+
+
+ + + + + Back to top + +
+
+ +
+ +
+
+

Source code for delayedarray.to_sparse_array

+from functools import singledispatch
+from typing import Any
+import numpy
+
+from ._subset import _spawn_indices
+from .extract_sparse_array import extract_sparse_array
+from .SparseNdarray import SparseNdarray
+
+
+
+[docs] +@singledispatch +def to_sparse_array(x: Any) -> SparseNdarray: + """ + Convert ``x`` to a :py:class:`~delayedarray.SparseNdarray.SparseNdarray`. + This calls :py:func:`~delayedarray.delayedarray.extract_sparse_array` with + ``subset`` set to the full extent of all dimensions. + + Args: + x: Any array-like object containing sparse data. + + Returns: + ``SparseNdarray`` with the full contents of ``x``. + """ + return extract_sparse_array(x, _spawn_indices(x.shape))
+ +
+
+
+
+ + +
+
+ + Made with Sphinx and @pradyunsg's + + Furo + +
+
+ +
+
+ +
+
+ +
+
+ + + + + \ No newline at end of file diff --git a/_modules/delayedarray/wrap.html b/_modules/delayedarray/wrap.html new file mode 100644 index 0000000..786da63 --- /dev/null +++ b/_modules/delayedarray/wrap.html @@ -0,0 +1,307 @@ + + + + + + + + delayedarray.wrap - DelayedArray 0.6.2 documentation + + + + + + + + + + + + + + + + + Contents + + + + + + Menu + + + + + + + + Expand + + + + + + Light mode + + + + + + + + + + + + + + Dark mode + + + + + + + Auto light/dark, in light mode + + + + + + + + + + + + + + + Auto light/dark, in dark mode + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +Skip to content + + + +
+
+
+ +
+ +
+
+ +
+ +
+
+ +
+
+
+ + + + + Back to top + +
+
+ +
+ +
+
+

Source code for delayedarray.wrap

+from functools import singledispatch
+from typing import Any
+
+from .DelayedArray import DelayedArray
+
+
+
+[docs] +@singledispatch +def wrap(x: Any) -> DelayedArray: + """Create a :py:class:`~delayedarray.DelayedArray.DelayedArray` from an + object satisfying the seed contract. Developers can implement methods for + this generic to create ``DelayedArray`` subclasses based on the seed type. + + Args: + x: + Any object satisfiying the seed contract, see documentation for + :py:class:`~delayedarray.DelayedArray.DelayedArray` for details. + + Returns: + A ``DelayedArray`` or one of its subclasses. + """ + return DelayedArray(x)
+ + + +
+[docs] +@wrap.register +def wrap_DelayedArray(x: DelayedArray): + """See :py:meth:`~delayedarray.wrap.wrap`.""" + return x
+ +
+
+
+
+ + +
+
+ + Made with Sphinx and @pradyunsg's + + Furo + +
+
+ +
+
+ +
+
+ +
+
+ + + + + \ No newline at end of file diff --git a/_modules/index.html b/_modules/index.html new file mode 100644 index 0000000..5b0c02c --- /dev/null +++ b/_modules/index.html @@ -0,0 +1,301 @@ + + + + + + + + Overview: module code - DelayedArray 0.6.2 documentation + + + + + + + + + + + + + + + + + Contents + + + + + + Menu + + + + + + + + Expand + + + + + + Light mode + + + + + + + + + + + + + + Dark mode + + + + + + + Auto light/dark, in light mode + + + + + + + + + + + + + + + Auto light/dark, in dark mode + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +Skip to content + + + + + + + + + \ No newline at end of file diff --git a/_sources/api/delayedarray.rst.txt b/_sources/api/delayedarray.rst.txt new file mode 100644 index 0000000..9cb0b39 --- /dev/null +++ b/_sources/api/delayedarray.rst.txt @@ -0,0 +1,229 @@ +delayedarray package +==================== + +Submodules +---------- + +delayedarray.BinaryIsometricOp module +------------------------------------- + +.. automodule:: delayedarray.BinaryIsometricOp + :members: + :show-inheritance: + :undoc-members: + +delayedarray.Cast module +------------------------ + +.. automodule:: delayedarray.Cast + :members: + :show-inheritance: + :undoc-members: + +delayedarray.Combine module +--------------------------- + +.. automodule:: delayedarray.Combine + :members: + :show-inheritance: + :undoc-members: + +delayedarray.DelayedArray module +-------------------------------- + +.. automodule:: delayedarray.DelayedArray + :members: + :show-inheritance: + :undoc-members: + +delayedarray.DelayedOp module +----------------------------- + +.. automodule:: delayedarray.DelayedOp + :members: + :show-inheritance: + :undoc-members: + +delayedarray.Grid module +------------------------ + +.. automodule:: delayedarray.Grid + :members: + :show-inheritance: + :undoc-members: + +delayedarray.RegularTicks module +-------------------------------- + +.. automodule:: delayedarray.RegularTicks + :members: + :show-inheritance: + :undoc-members: + +delayedarray.Round module +------------------------- + +.. automodule:: delayedarray.Round + :members: + :show-inheritance: + :undoc-members: + +delayedarray.SparseNdarray module +--------------------------------- + +.. automodule:: delayedarray.SparseNdarray + :members: + :show-inheritance: + :undoc-members: + +delayedarray.Subset module +-------------------------- + +.. automodule:: delayedarray.Subset + :members: + :show-inheritance: + :undoc-members: + +delayedarray.Transpose module +----------------------------- + +.. automodule:: delayedarray.Transpose + :members: + :show-inheritance: + :undoc-members: + +delayedarray.UnaryIsometricOpSimple module +------------------------------------------ + +.. automodule:: delayedarray.UnaryIsometricOpSimple + :members: + :show-inheritance: + :undoc-members: + +delayedarray.UnaryIsometricOpWithArgs module +-------------------------------------------- + +.. automodule:: delayedarray.UnaryIsometricOpWithArgs + :members: + :show-inheritance: + :undoc-members: + +delayedarray.apply\_over\_blocks module +--------------------------------------- + +.. automodule:: delayedarray.apply_over_blocks + :members: + :show-inheritance: + :undoc-members: + +delayedarray.apply\_over\_dimension module +------------------------------------------ + +.. automodule:: delayedarray.apply_over_dimension + :members: + :show-inheritance: + :undoc-members: + +delayedarray.chunk\_grid module +------------------------------- + +.. automodule:: delayedarray.chunk_grid + :members: + :show-inheritance: + :undoc-members: + +delayedarray.create\_dask\_array module +--------------------------------------- + +.. automodule:: delayedarray.create_dask_array + :members: + :show-inheritance: + :undoc-members: + +delayedarray.default\_buffer\_size module +----------------------------------------- + +.. automodule:: delayedarray.default_buffer_size + :members: + :show-inheritance: + :undoc-members: + +delayedarray.extract\_dense\_array module +----------------------------------------- + +.. automodule:: delayedarray.extract_dense_array + :members: + :show-inheritance: + :undoc-members: + +delayedarray.extract\_sparse\_array module +------------------------------------------ + +.. automodule:: delayedarray.extract_sparse_array + :members: + :show-inheritance: + :undoc-members: + +delayedarray.is\_masked module +------------------------------ + +.. automodule:: delayedarray.is_masked + :members: + :show-inheritance: + :undoc-members: + +delayedarray.is\_pristine module +-------------------------------- + +.. automodule:: delayedarray.is_pristine + :members: + :show-inheritance: + :undoc-members: + +delayedarray.is\_sparse module +------------------------------ + +.. automodule:: delayedarray.is_sparse + :members: + :show-inheritance: + :undoc-members: + +delayedarray.to\_dense\_array module +------------------------------------ + +.. automodule:: delayedarray.to_dense_array + :members: + :show-inheritance: + :undoc-members: + +delayedarray.to\_scipy\_sparse\_matrix module +--------------------------------------------- + +.. automodule:: delayedarray.to_scipy_sparse_matrix + :members: + :show-inheritance: + :undoc-members: + +delayedarray.to\_sparse\_array module +------------------------------------- + +.. automodule:: delayedarray.to_sparse_array + :members: + :show-inheritance: + :undoc-members: + +delayedarray.wrap module +------------------------ + +.. automodule:: delayedarray.wrap + :members: + :show-inheritance: + :undoc-members: + +Module contents +--------------- + +.. automodule:: delayedarray + :members: + :show-inheritance: + :undoc-members: diff --git a/_sources/api/modules.rst.txt b/_sources/api/modules.rst.txt new file mode 100644 index 0000000..895ef47 --- /dev/null +++ b/_sources/api/modules.rst.txt @@ -0,0 +1,7 @@ +delayedarray +============ + +.. toctree:: + :maxdepth: 4 + + delayedarray diff --git a/docs/authors.md b/_sources/authors.md.txt similarity index 100% rename from docs/authors.md rename to _sources/authors.md.txt diff --git a/docs/changelog.md b/_sources/changelog.md.txt similarity index 100% rename from docs/changelog.md rename to _sources/changelog.md.txt diff --git a/docs/contributing.md b/_sources/contributing.md.txt similarity index 100% rename from docs/contributing.md rename to _sources/contributing.md.txt diff --git a/docs/developers.md b/_sources/developers.md.txt similarity index 100% rename from docs/developers.md rename to _sources/developers.md.txt diff --git a/docs/index.md b/_sources/index.md.txt similarity index 100% rename from docs/index.md rename to _sources/index.md.txt diff --git a/docs/license.md b/_sources/license.md.txt similarity index 100% rename from docs/license.md rename to _sources/license.md.txt diff --git a/docs/readme.md b/_sources/readme.md.txt similarity index 100% rename from docs/readme.md rename to _sources/readme.md.txt diff --git a/_static/basic.css b/_static/basic.css new file mode 100644 index 0000000..4738b2e --- /dev/null +++ b/_static/basic.css @@ -0,0 +1,906 @@ +/* + * Sphinx stylesheet -- basic theme. + */ + +/* -- main layout ----------------------------------------------------------- */ + +div.clearer { + clear: both; +} + +div.section::after { + display: block; + content: ''; + clear: left; +} + +/* -- relbar ---------------------------------------------------------------- */ + +div.related { + width: 100%; + font-size: 90%; +} + +div.related h3 { + display: none; +} + +div.related ul { + margin: 0; + padding: 0 0 0 10px; + list-style: none; +} + +div.related li { + display: inline; +} + +div.related li.right { + float: right; + margin-right: 5px; +} + +/* -- sidebar --------------------------------------------------------------- */ + +div.sphinxsidebarwrapper { + padding: 10px 5px 0 10px; +} + +div.sphinxsidebar { + float: left; + width: 230px; + margin-left: -100%; + font-size: 90%; + word-wrap: break-word; + overflow-wrap : break-word; +} + +div.sphinxsidebar ul { + list-style: none; +} + +div.sphinxsidebar ul ul, +div.sphinxsidebar ul.want-points { + margin-left: 20px; + list-style: square; +} + +div.sphinxsidebar ul ul { + margin-top: 0; + margin-bottom: 0; +} + +div.sphinxsidebar form { + margin-top: 10px; +} + +div.sphinxsidebar input { + border: 1px solid #98dbcc; + font-family: sans-serif; + font-size: 1em; +} + +div.sphinxsidebar #searchbox form.search { + overflow: hidden; +} + +div.sphinxsidebar #searchbox input[type="text"] { + float: left; + width: 80%; + padding: 0.25em; + box-sizing: border-box; +} + +div.sphinxsidebar #searchbox input[type="submit"] { + float: left; + width: 20%; + border-left: none; + padding: 0.25em; + box-sizing: border-box; +} + + +img { + border: 0; + max-width: 100%; +} + +/* -- search page ----------------------------------------------------------- */ + +ul.search { + margin-top: 10px; +} + +ul.search li { + padding: 5px 0; +} + +ul.search li a { + font-weight: bold; +} + +ul.search li p.context { + color: #888; + margin: 2px 0 0 30px; + text-align: left; +} + +ul.keywordmatches li.goodmatch a { + font-weight: bold; +} + +/* -- index page ------------------------------------------------------------ */ + +table.contentstable { + width: 90%; + margin-left: auto; + margin-right: auto; +} + +table.contentstable p.biglink { + line-height: 150%; +} + +a.biglink { + font-size: 1.3em; +} + +span.linkdescr { + font-style: italic; + padding-top: 5px; + font-size: 90%; +} + +/* -- general index --------------------------------------------------------- */ + +table.indextable { + width: 100%; +} + +table.indextable td { + text-align: left; + vertical-align: top; +} + +table.indextable ul { + margin-top: 0; + margin-bottom: 0; + list-style-type: none; +} + +table.indextable > tbody > tr > td > ul { + padding-left: 0em; +} + +table.indextable tr.pcap { + height: 10px; +} + +table.indextable tr.cap { + margin-top: 10px; + background-color: #f2f2f2; +} + +img.toggler { + margin-right: 3px; + margin-top: 3px; + cursor: pointer; +} + +div.modindex-jumpbox { + border-top: 1px solid #ddd; + border-bottom: 1px solid #ddd; + margin: 1em 0 1em 0; + padding: 0.4em; +} + +div.genindex-jumpbox { + border-top: 1px solid #ddd; + border-bottom: 1px solid #ddd; + margin: 1em 0 1em 0; + padding: 0.4em; +} + +/* -- domain module index --------------------------------------------------- */ + +table.modindextable td { + padding: 2px; + border-collapse: collapse; +} + +/* -- general body styles --------------------------------------------------- */ + +div.body { + min-width: 360px; + max-width: 800px; +} + +div.body p, div.body dd, div.body li, div.body blockquote { + -moz-hyphens: auto; + -ms-hyphens: auto; + -webkit-hyphens: auto; + hyphens: auto; +} + +a.headerlink { + visibility: hidden; +} + +a:visited { + color: #551A8B; +} + +h1:hover > a.headerlink, +h2:hover > a.headerlink, +h3:hover > a.headerlink, +h4:hover > a.headerlink, +h5:hover > a.headerlink, +h6:hover > a.headerlink, +dt:hover > a.headerlink, +caption:hover > a.headerlink, +p.caption:hover > a.headerlink, +div.code-block-caption:hover > a.headerlink { + visibility: visible; +} + +div.body p.caption { + text-align: inherit; +} + +div.body td { + text-align: left; +} + +.first { + margin-top: 0 !important; +} + +p.rubric { + margin-top: 30px; + font-weight: bold; +} + +img.align-left, figure.align-left, .figure.align-left, object.align-left { + clear: left; + float: left; + margin-right: 1em; +} + +img.align-right, figure.align-right, .figure.align-right, object.align-right { + clear: right; + float: right; + margin-left: 1em; +} + +img.align-center, figure.align-center, .figure.align-center, object.align-center { + display: block; + margin-left: auto; + margin-right: auto; +} + +img.align-default, figure.align-default, .figure.align-default { + display: block; + margin-left: auto; + margin-right: auto; +} + +.align-left { + text-align: left; +} + +.align-center { + text-align: center; +} + +.align-default { + text-align: center; +} + +.align-right { + text-align: right; +} + +/* -- sidebars -------------------------------------------------------------- */ + +div.sidebar, +aside.sidebar { + margin: 0 0 0.5em 1em; + border: 1px solid #ddb; + padding: 7px; + background-color: #ffe; + width: 40%; + float: right; + clear: right; + overflow-x: auto; +} + +p.sidebar-title { + font-weight: bold; +} + +nav.contents, +aside.topic, +div.admonition, div.topic, blockquote { + clear: left; +} + +/* -- topics ---------------------------------------------------------------- */ + +nav.contents, +aside.topic, +div.topic { + border: 1px solid #ccc; + padding: 7px; + margin: 10px 0 10px 0; +} + +p.topic-title { + font-size: 1.1em; + font-weight: bold; + margin-top: 10px; +} + +/* -- admonitions ----------------------------------------------------------- */ + +div.admonition { + margin-top: 10px; + margin-bottom: 10px; + padding: 7px; +} + +div.admonition dt { + font-weight: bold; +} + +p.admonition-title { + margin: 0px 10px 5px 0px; + font-weight: bold; +} + +div.body p.centered { + text-align: center; + margin-top: 25px; +} + +/* -- content of sidebars/topics/admonitions -------------------------------- */ + +div.sidebar > :last-child, +aside.sidebar > :last-child, +nav.contents > :last-child, +aside.topic > :last-child, +div.topic > :last-child, +div.admonition > :last-child { + margin-bottom: 0; +} + +div.sidebar::after, +aside.sidebar::after, +nav.contents::after, +aside.topic::after, +div.topic::after, +div.admonition::after, +blockquote::after { + display: block; + content: ''; + clear: both; +} + +/* -- tables ---------------------------------------------------------------- */ + +table.docutils { + margin-top: 10px; + margin-bottom: 10px; + border: 0; + border-collapse: collapse; +} + +table.align-center { + margin-left: auto; + margin-right: auto; +} + +table.align-default { + margin-left: auto; + margin-right: auto; +} + +table caption span.caption-number { + font-style: italic; +} + +table caption span.caption-text { +} + +table.docutils td, table.docutils th { + padding: 1px 8px 1px 5px; + border-top: 0; + border-left: 0; + border-right: 0; + border-bottom: 1px solid #aaa; +} + +th { + text-align: left; + padding-right: 5px; +} + +table.citation { + border-left: solid 1px gray; + margin-left: 1px; +} + +table.citation td { + border-bottom: none; +} + +th > :first-child, +td > :first-child { + margin-top: 0px; +} + +th > :last-child, +td > :last-child { + margin-bottom: 0px; +} + +/* -- figures --------------------------------------------------------------- */ + +div.figure, figure { + margin: 0.5em; + padding: 0.5em; +} + +div.figure p.caption, figcaption { + padding: 0.3em; +} + +div.figure p.caption span.caption-number, +figcaption span.caption-number { + font-style: italic; +} + +div.figure p.caption span.caption-text, +figcaption span.caption-text { +} + +/* -- field list styles ----------------------------------------------------- */ + +table.field-list td, table.field-list th { + border: 0 !important; +} + +.field-list ul { + margin: 0; + padding-left: 1em; +} + +.field-list p { + margin: 0; +} + +.field-name { + -moz-hyphens: manual; + -ms-hyphens: manual; + -webkit-hyphens: manual; + hyphens: manual; +} + +/* -- hlist styles ---------------------------------------------------------- */ + +table.hlist { + margin: 1em 0; +} + +table.hlist td { + vertical-align: top; +} + +/* -- object description styles --------------------------------------------- */ + +.sig { + font-family: 'Consolas', 'Menlo', 'DejaVu Sans Mono', 'Bitstream Vera Sans Mono', monospace; +} + +.sig-name, code.descname { + background-color: transparent; + font-weight: bold; +} + +.sig-name { + font-size: 1.1em; +} + +code.descname { + font-size: 1.2em; +} + +.sig-prename, code.descclassname { + background-color: transparent; +} + +.optional { + font-size: 1.3em; +} + +.sig-paren { + font-size: larger; +} + +.sig-param.n { + font-style: italic; +} + +/* C++ specific styling */ + +.sig-inline.c-texpr, +.sig-inline.cpp-texpr { + font-family: unset; +} + +.sig.c .k, .sig.c .kt, +.sig.cpp .k, .sig.cpp .kt { + color: #0033B3; +} + +.sig.c .m, +.sig.cpp .m { + color: #1750EB; +} + +.sig.c .s, .sig.c .sc, +.sig.cpp .s, .sig.cpp .sc { + color: #067D17; +} + + +/* -- other body styles ----------------------------------------------------- */ + +ol.arabic { + list-style: decimal; +} + +ol.loweralpha { + list-style: lower-alpha; +} + +ol.upperalpha { + list-style: upper-alpha; +} + +ol.lowerroman { + list-style: lower-roman; +} + +ol.upperroman { + list-style: upper-roman; +} + +:not(li) > ol > li:first-child > :first-child, +:not(li) > ul > li:first-child > :first-child { + margin-top: 0px; +} + +:not(li) > ol > li:last-child > :last-child, +:not(li) > ul > li:last-child > :last-child { + margin-bottom: 0px; +} + +ol.simple ol p, +ol.simple ul p, +ul.simple ol p, +ul.simple ul p { + margin-top: 0; +} + +ol.simple > li:not(:first-child) > p, +ul.simple > li:not(:first-child) > p { + margin-top: 0; +} + +ol.simple p, +ul.simple p { + margin-bottom: 0; +} + +aside.footnote > span, +div.citation > span { + float: left; +} +aside.footnote > span:last-of-type, +div.citation > span:last-of-type { + padding-right: 0.5em; +} +aside.footnote > p { + margin-left: 2em; +} +div.citation > p { + margin-left: 4em; +} +aside.footnote > p:last-of-type, +div.citation > p:last-of-type { + margin-bottom: 0em; +} +aside.footnote > p:last-of-type:after, +div.citation > p:last-of-type:after { + content: ""; + clear: both; +} + +dl.field-list { + display: grid; + grid-template-columns: fit-content(30%) auto; +} + +dl.field-list > dt { + font-weight: bold; + word-break: break-word; + padding-left: 0.5em; + padding-right: 5px; +} + +dl.field-list > dd { + padding-left: 0.5em; + margin-top: 0em; + margin-left: 0em; + margin-bottom: 0em; +} + +dl { + margin-bottom: 15px; +} + +dd > :first-child { + margin-top: 0px; +} + +dd ul, dd table { + margin-bottom: 10px; +} + +dd { + margin-top: 3px; + margin-bottom: 10px; + margin-left: 30px; +} + +.sig dd { + margin-top: 0px; + margin-bottom: 0px; +} + +.sig dl { + margin-top: 0px; + margin-bottom: 0px; +} + +dl > dd:last-child, +dl > dd:last-child > :last-child { + margin-bottom: 0; +} + +dt:target, span.highlighted { + background-color: #fbe54e; +} + +rect.highlighted { + fill: #fbe54e; +} + +dl.glossary dt { + font-weight: bold; + font-size: 1.1em; +} + +.versionmodified { + font-style: italic; +} + +.system-message { + background-color: #fda; + padding: 5px; + border: 3px solid red; +} + +.footnote:target { + background-color: #ffa; +} + +.line-block { + display: block; + margin-top: 1em; + margin-bottom: 1em; +} + +.line-block .line-block { + margin-top: 0; + margin-bottom: 0; + margin-left: 1.5em; +} + +.guilabel, .menuselection { + font-family: sans-serif; +} + +.accelerator { + text-decoration: underline; +} + +.classifier { + font-style: oblique; +} + +.classifier:before { + font-style: normal; + margin: 0 0.5em; + content: ":"; + display: inline-block; +} + +abbr, acronym { + border-bottom: dotted 1px; + cursor: help; +} + +/* -- code displays --------------------------------------------------------- */ + +pre { + overflow: auto; + overflow-y: hidden; /* fixes display issues on Chrome browsers */ +} + +pre, div[class*="highlight-"] { + clear: both; +} + +span.pre { + -moz-hyphens: none; + -ms-hyphens: none; + -webkit-hyphens: none; + hyphens: none; + white-space: nowrap; +} + +div[class*="highlight-"] { + margin: 1em 0; +} + +td.linenos pre { + border: 0; + background-color: transparent; + color: #aaa; +} + +table.highlighttable { + display: block; +} + +table.highlighttable tbody { + display: block; +} + +table.highlighttable tr { + display: flex; +} + +table.highlighttable td { + margin: 0; + padding: 0; +} + +table.highlighttable td.linenos { + padding-right: 0.5em; +} + +table.highlighttable td.code { + flex: 1; + overflow: hidden; +} + +.highlight .hll { + display: block; +} + +div.highlight pre, +table.highlighttable pre { + margin: 0; +} + +div.code-block-caption + div { + margin-top: 0; +} + +div.code-block-caption { + margin-top: 1em; + padding: 2px 5px; + font-size: small; +} + +div.code-block-caption code { + background-color: transparent; +} + +table.highlighttable td.linenos, +span.linenos, +div.highlight span.gp { /* gp: Generic.Prompt */ + user-select: none; + -webkit-user-select: text; /* Safari fallback only */ + -webkit-user-select: none; /* Chrome/Safari */ + -moz-user-select: none; /* Firefox */ + -ms-user-select: none; /* IE10+ */ +} + +div.code-block-caption span.caption-number { + padding: 0.1em 0.3em; + font-style: italic; +} + +div.code-block-caption span.caption-text { +} + +div.literal-block-wrapper { + margin: 1em 0; +} + +code.xref, a code { + background-color: transparent; + font-weight: bold; +} + +h1 code, h2 code, h3 code, h4 code, h5 code, h6 code { + background-color: transparent; +} + +.viewcode-link { + float: right; +} + +.viewcode-back { + float: right; + font-family: sans-serif; +} + +div.viewcode-block:target { + margin: -1px -10px; + padding: 0 10px; +} + +/* -- math display ---------------------------------------------------------- */ + +img.math { + vertical-align: middle; +} + +div.body div.math p { + text-align: center; +} + +span.eqno { + float: right; +} + +span.eqno a.headerlink { + position: absolute; + z-index: 1; +} + +div.math:hover a.headerlink { + visibility: visible; +} + +/* -- printout stylesheet --------------------------------------------------- */ + +@media print { + div.document, + div.documentwrapper, + div.bodywrapper { + margin: 0 !important; + width: 100%; + } + + div.sphinxsidebar, + div.related, + div.footer, + #top-link { + display: none; + } +} \ No newline at end of file diff --git a/_static/debug.css b/_static/debug.css new file mode 100644 index 0000000..74d4aec --- /dev/null +++ b/_static/debug.css @@ -0,0 +1,69 @@ +/* + This CSS file should be overridden by the theme authors. It's + meant for debugging and developing the skeleton that this theme provides. +*/ +body { + font-family: -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif, + "Apple Color Emoji", "Segoe UI Emoji"; + background: lavender; +} +.sb-announcement { + background: rgb(131, 131, 131); +} +.sb-announcement__inner { + background: black; + color: white; +} +.sb-header { + background: lightskyblue; +} +.sb-header__inner { + background: royalblue; + color: white; +} +.sb-header-secondary { + background: lightcyan; +} +.sb-header-secondary__inner { + background: cornflowerblue; + color: white; +} +.sb-sidebar-primary { + background: lightgreen; +} +.sb-main { + background: blanchedalmond; +} +.sb-main__inner { + background: antiquewhite; +} +.sb-header-article { + background: lightsteelblue; +} +.sb-article-container { + background: snow; +} +.sb-article-main { + background: white; +} +.sb-footer-article { + background: lightpink; +} +.sb-sidebar-secondary { + background: lightgoldenrodyellow; +} +.sb-footer-content { + background: plum; +} +.sb-footer-content__inner { + background: palevioletred; +} +.sb-footer { + background: pink; +} +.sb-footer__inner { + background: salmon; +} +.sb-article { + background: white; +} diff --git a/_static/doctools.js b/_static/doctools.js new file mode 100644 index 0000000..0398ebb --- /dev/null +++ b/_static/doctools.js @@ -0,0 +1,149 @@ +/* + * Base JavaScript utilities for all Sphinx HTML documentation. + */ +"use strict"; + +const BLACKLISTED_KEY_CONTROL_ELEMENTS = new Set([ + "TEXTAREA", + "INPUT", + "SELECT", + "BUTTON", +]); + +const _ready = (callback) => { + if (document.readyState !== "loading") { + callback(); + } else { + document.addEventListener("DOMContentLoaded", callback); + } +}; + +/** + * Small JavaScript module for the documentation. + */ +const Documentation = { + init: () => { + Documentation.initDomainIndexTable(); + Documentation.initOnKeyListeners(); + }, + + /** + * i18n support + */ + TRANSLATIONS: {}, + PLURAL_EXPR: (n) => (n === 1 ? 0 : 1), + LOCALE: "unknown", + + // gettext and ngettext don't access this so that the functions + // can safely bound to a different name (_ = Documentation.gettext) + gettext: (string) => { + const translated = Documentation.TRANSLATIONS[string]; + switch (typeof translated) { + case "undefined": + return string; // no translation + case "string": + return translated; // translation exists + default: + return translated[0]; // (singular, plural) translation tuple exists + } + }, + + ngettext: (singular, plural, n) => { + const translated = Documentation.TRANSLATIONS[singular]; + if (typeof translated !== "undefined") + return translated[Documentation.PLURAL_EXPR(n)]; + return n === 1 ? singular : plural; + }, + + addTranslations: (catalog) => { + Object.assign(Documentation.TRANSLATIONS, catalog.messages); + Documentation.PLURAL_EXPR = new Function( + "n", + `return (${catalog.plural_expr})` + ); + Documentation.LOCALE = catalog.locale; + }, + + /** + * helper function to focus on search bar + */ + focusSearchBar: () => { + document.querySelectorAll("input[name=q]")[0]?.focus(); + }, + + /** + * Initialise the domain index toggle buttons + */ + initDomainIndexTable: () => { + const toggler = (el) => { + const idNumber = el.id.substr(7); + const toggledRows = document.querySelectorAll(`tr.cg-${idNumber}`); + if (el.src.substr(-9) === "minus.png") { + el.src = `${el.src.substr(0, el.src.length - 9)}plus.png`; + toggledRows.forEach((el) => (el.style.display = "none")); + } else { + el.src = `${el.src.substr(0, el.src.length - 8)}minus.png`; + toggledRows.forEach((el) => (el.style.display = "")); + } + }; + + const togglerElements = document.querySelectorAll("img.toggler"); + togglerElements.forEach((el) => + el.addEventListener("click", (event) => toggler(event.currentTarget)) + ); + togglerElements.forEach((el) => (el.style.display = "")); + if (DOCUMENTATION_OPTIONS.COLLAPSE_INDEX) togglerElements.forEach(toggler); + }, + + initOnKeyListeners: () => { + // only install a listener if it is really needed + if ( + !DOCUMENTATION_OPTIONS.NAVIGATION_WITH_KEYS && + !DOCUMENTATION_OPTIONS.ENABLE_SEARCH_SHORTCUTS + ) + return; + + document.addEventListener("keydown", (event) => { + // bail for input elements + if (BLACKLISTED_KEY_CONTROL_ELEMENTS.has(document.activeElement.tagName)) return; + // bail with special keys + if (event.altKey || event.ctrlKey || event.metaKey) return; + + if (!event.shiftKey) { + switch (event.key) { + case "ArrowLeft": + if (!DOCUMENTATION_OPTIONS.NAVIGATION_WITH_KEYS) break; + + const prevLink = document.querySelector('link[rel="prev"]'); + if (prevLink && prevLink.href) { + window.location.href = prevLink.href; + event.preventDefault(); + } + break; + case "ArrowRight": + if (!DOCUMENTATION_OPTIONS.NAVIGATION_WITH_KEYS) break; + + const nextLink = document.querySelector('link[rel="next"]'); + if (nextLink && nextLink.href) { + window.location.href = nextLink.href; + event.preventDefault(); + } + break; + } + } + + // some keyboard layouts may need Shift to get / + switch (event.key) { + case "/": + if (!DOCUMENTATION_OPTIONS.ENABLE_SEARCH_SHORTCUTS) break; + Documentation.focusSearchBar(); + event.preventDefault(); + } + }); + }, +}; + +// quick alias for translations +const _ = Documentation.gettext; + +_ready(Documentation.init); diff --git a/_static/documentation_options.js b/_static/documentation_options.js new file mode 100644 index 0000000..711011c --- /dev/null +++ b/_static/documentation_options.js @@ -0,0 +1,13 @@ +const DOCUMENTATION_OPTIONS = { + VERSION: '0.6.2', + LANGUAGE: 'en', + COLLAPSE_INDEX: false, + BUILDER: 'html', + FILE_SUFFIX: '.html', + LINK_SUFFIX: '.html', + HAS_SOURCE: true, + SOURCELINK_SUFFIX: '.txt', + NAVIGATION_WITH_KEYS: false, + SHOW_SEARCH_SUMMARY: true, + ENABLE_SEARCH_SHORTCUTS: true, +}; \ No newline at end of file diff --git a/_static/file.png b/_static/file.png new file mode 100644 index 0000000..a858a41 Binary files /dev/null and b/_static/file.png differ diff --git a/_static/language_data.js b/_static/language_data.js new file mode 100644 index 0000000..c7fe6c6 --- /dev/null +++ b/_static/language_data.js @@ -0,0 +1,192 @@ +/* + * This script contains the language-specific data used by searchtools.js, + * namely the list of stopwords, stemmer, scorer and splitter. + */ + +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"]; + + +/* Non-minified version is copied as a separate JS file, if available */ + +/** + * Porter Stemmer + */ +var Stemmer = function() { + + var step2list = { + ational: 'ate', + tional: 'tion', + enci: 'ence', + anci: 'ance', + izer: 'ize', + bli: 'ble', + alli: 'al', + entli: 'ent', + eli: 'e', + ousli: 'ous', + ization: 'ize', + ation: 'ate', + ator: 'ate', + alism: 'al', + iveness: 'ive', + fulness: 'ful', + ousness: 'ous', + aliti: 'al', + iviti: 'ive', + biliti: 'ble', + logi: 'log' + }; + + var step3list = { + icate: 'ic', + ative: '', + alize: 'al', + iciti: 'ic', + ical: 'ic', + ful: '', + ness: '' + }; + + var c = "[^aeiou]"; // consonant + var v = "[aeiouy]"; // vowel + var C = c + "[^aeiouy]*"; // consonant sequence + var V = v + "[aeiou]*"; // vowel sequence + + var mgr0 = "^(" + C + ")?" + V + C; // [C]VC... is m>0 + var meq1 = "^(" + C + ")?" + V + C + "(" + V + ")?$"; // [C]VC[V] is m=1 + var mgr1 = "^(" + C + ")?" + V + C + V + C; // [C]VCVC... is m>1 + var s_v = "^(" + C + ")?" + v; // vowel in stem + + this.stemWord = function (w) { + var stem; + var suffix; + var firstch; + var origword = w; + + if (w.length < 3) + return w; + + var re; + var re2; + var re3; + var re4; + + firstch = w.substr(0,1); + if (firstch == "y") + w = firstch.toUpperCase() + w.substr(1); + + // Step 1a + re = /^(.+?)(ss|i)es$/; + re2 = /^(.+?)([^s])s$/; + + if (re.test(w)) + w = w.replace(re,"$1$2"); + else if (re2.test(w)) + w = w.replace(re2,"$1$2"); + + // Step 1b + re = /^(.+?)eed$/; + re2 = /^(.+?)(ed|ing)$/; + if (re.test(w)) { + var fp = re.exec(w); + re = new RegExp(mgr0); + if (re.test(fp[1])) { + re = /.$/; + w = w.replace(re,""); + } + } + else if (re2.test(w)) { + var fp = re2.exec(w); + stem = fp[1]; + re2 = new RegExp(s_v); + if (re2.test(stem)) { + w = stem; + re2 = /(at|bl|iz)$/; + re3 = new RegExp("([^aeiouylsz])\\1$"); + re4 = new RegExp("^" + C + v + "[^aeiouwxy]$"); + if (re2.test(w)) + w = w + "e"; + else if (re3.test(w)) { + re = /.$/; + w = w.replace(re,""); + } + else if (re4.test(w)) + w = w + "e"; + } + } + + // Step 1c + re = /^(.+?)y$/; + if (re.test(w)) { + var fp = re.exec(w); + stem = fp[1]; + re = new RegExp(s_v); + if (re.test(stem)) + w = stem + "i"; + } + + // Step 2 + re = /^(.+?)(ational|tional|enci|anci|izer|bli|alli|entli|eli|ousli|ization|ation|ator|alism|iveness|fulness|ousness|aliti|iviti|biliti|logi)$/; + if (re.test(w)) { + var fp = re.exec(w); + stem = fp[1]; + suffix = fp[2]; + re = new RegExp(mgr0); + if (re.test(stem)) + w = stem + step2list[suffix]; + } + + // Step 3 + re = /^(.+?)(icate|ative|alize|iciti|ical|ful|ness)$/; + if (re.test(w)) { + var fp = re.exec(w); + stem = fp[1]; + suffix = fp[2]; + re = new RegExp(mgr0); + if (re.test(stem)) + w = stem + step3list[suffix]; + } + + // Step 4 + re = /^(.+?)(al|ance|ence|er|ic|able|ible|ant|ement|ment|ent|ou|ism|ate|iti|ous|ive|ize)$/; + re2 = /^(.+?)(s|t)(ion)$/; + if (re.test(w)) { + var fp = re.exec(w); + stem = fp[1]; + re = new RegExp(mgr1); + if (re.test(stem)) + w = stem; + } + else if (re2.test(w)) { + var fp = re2.exec(w); + stem = fp[1] + fp[2]; + re2 = new RegExp(mgr1); + if (re2.test(stem)) + w = stem; + } + + // Step 5 + re = /^(.+?)e$/; + if (re.test(w)) { + var fp = re.exec(w); + stem = fp[1]; + re = new RegExp(mgr1); + re2 = new RegExp(meq1); + re3 = new RegExp("^" + C + v + "[^aeiouwxy]$"); + if (re.test(stem) || (re2.test(stem) && !(re3.test(stem)))) + w = stem; + } + re = /ll$/; + re2 = new RegExp(mgr1); + if (re.test(w) && re2.test(w)) { + re = /.$/; + w = w.replace(re,""); + } + + // and turn initial Y back to y + if (firstch == "y") + w = firstch.toLowerCase() + w.substr(1); + return w; + } +} + diff --git a/_static/minus.png b/_static/minus.png new file mode 100644 index 0000000..d96755f Binary files /dev/null and b/_static/minus.png differ diff --git a/_static/mystnb.8ecb98da25f57f5357bf6f572d296f466b2cfe2517ffebfabe82451661e28f02.css b/_static/mystnb.8ecb98da25f57f5357bf6f572d296f466b2cfe2517ffebfabe82451661e28f02.css new file mode 100644 index 0000000..14edf62 --- /dev/null +++ b/_static/mystnb.8ecb98da25f57f5357bf6f572d296f466b2cfe2517ffebfabe82451661e28f02.css @@ -0,0 +1,2474 @@ +/* Variables */ +:root { + /* + Following palettes are generated by using https://m2.material.io/design/color/the-color-system.html#tools-for-picking-colors + - neutral palette with #fcfcfc and danger palette with #ffdddd as base colors. + 50 means lightest, 900 means darkest; less used intermediate shades are omitted + but can be added when needed by accessing full palette from the above link. + */ + --mystnb-neutral-palette-50: #fcfcfc; + --mystnb-neutral-palette-100: #f7f7f7; + --mystnb-neutral-palette-400: #cccccc; + --mystnb-neutral-palette-500: #afafaf; + --mystnb-neutral-palette-800: #505050; + --mystnb-neutral-palette-900: #2d2d2d; + + --mystnb-danger-palette-50: #ffdddd; + --mystnb-danger-palette-100: #f5acad; + --mystnb-danger-palette-400: #c42029; + --mystnb-danger-palette-500: #b40008; + --mystnb-danger-palette-800: #850010; + --mystnb-danger-palette-900: #680010; + + /* MyST-NB specific variables; colors should be logically picked from palettes */ + --mystnb-source-bg-color: var(--mystnb-neutral-palette-100); + --mystnb-stdout-bg-color: var(--mystnb-neutral-palette-50); + --mystnb-stderr-bg-color: var(--mystnb-danger-palette-50); + --mystnb-traceback-bg-color: var(--mystnb-neutral-palette-50); + --mystnb-source-border-color: var(--mystnb-neutral-palette-400); + --mystnb-source-margin-color: green; + --mystnb-stdout-border-color: var(--mystnb-neutral-palette-100); + --mystnb-stderr-border-color: var(--mystnb-neutral-palette-100); + --mystnb-traceback-border-color: var(--mystnb-danger-palette-100); + --mystnb-hide-prompt-opacity: 70%; + --mystnb-source-border-radius: .4em; + --mystnb-source-border-width: 1px; + --mystnb-scrollbar-width: 0.3rem; + --mystnb-scrollbar-height: 0.3rem; + --mystnb-scrollbar-thumb-color: var(--mystnb-neutral-palette-400); + --mystnb-scrollbar-thumb-hover-color: var(--mystnb-neutral-palette-500); + --mystnb-scrollbar-thumb-border-radius: 0.25rem; +} + +/* Override colors in dark theme */ +html[data-theme="dark"] { + --mystnb-source-bg-color: var(--mystnb-neutral-palette-800); + --mystnb-stdout-bg-color: var(--mystnb-neutral-palette-900); + --mystnb-stderr-bg-color: var(--mystnb-danger-palette-900); + --mystnb-traceback-bg-color: var(--mystnb-neutral-palette-900); + --mystnb-source-border-color: var(--mystnb-neutral-palette-500); + --mystnb-stdout-border-color: var(--mystnb-neutral-palette-800); + --mystnb-stderr-border-color: var(--mystnb-neutral-palette-800); + --mystnb-traceback-border-color: var(--mystnb-danger-palette-800); + --mystnb-scrollbar-thumb-color: var(--mystnb-neutral-palette-500); + --mystnb-scrollbar-thumb-hover-color: var(--mystnb-neutral-palette-400); +} + + +/* Whole cell */ +div.container.cell { + padding-left: 0; + margin-bottom: 1em; +} + +/* Removing all background formatting so we can control at the div level */ +.cell_input div.highlight, +.cell_output pre, +.cell_input pre, +.cell_output .output { + border: none; + box-shadow: none; +} + +.cell_output .output pre, +.cell_input pre { + margin: 0px; +} + +/* Input cells */ +div.cell > div.cell_input { + padding-left: 0em; + padding-right: 0em; + border: var(--mystnb-source-border-width) var(--mystnb-source-border-color) solid; + background-color: var(--mystnb-source-bg-color); + border-left-color: var(--mystnb-source-margin-color); + border-left-width: medium; + border-radius: var(--mystnb-source-border-radius); +} + +div.cell_input>div, +div.cell_output div.output>div.highlight { + margin: 0em !important; + border: none !important; +} + +/* All cell outputs */ +.cell_output { + padding-left: 1em; + padding-right: 0em; + margin-top: 1em; +} + +/* Text outputs from cells */ +.cell_output .output.text_plain, +.cell_output .output.traceback, +.cell_output .output.stream, +.cell_output .output.stderr { + margin-top: 1em; + margin-bottom: 0em; + box-shadow: none; +} + +.cell_output .output.text_plain:not(:has(.highlight)), +.cell_output .output.stream:not(:has(.highlight)) { + /* plain (or stream of) output, not containing a pygments-highlighted block */ + background: var(--mystnb-stdout-bg-color); + border: 1px solid var(--mystnb-stdout-border-color); +} + +.cell_output .output.stderr { + background: var(--mystnb-stderr-bg-color); + border: 1px solid var(--mystnb-stderr-border-color); +} + +.cell_output .output.traceback { + background: var(--mystnb-traceback-bg-color); + border: 1px solid var(--mystnb-traceback-border-color); +} + +/* --- Collapsible cell content --- */ + +/* +encourage summary container to blend in with its parent. +p.admonition-title should hold the title styles. +*/ +div.cell details.hide summary { + border-left: unset; + padding: inherit; + margin: inherit; + background-color: inherit; +} + +/* Neighboring input/output elements - spacing, borders */ +div.cell details.hide.above-input + details.below-input, +div.cell div.cell_input + details.below-input +{ + margin-top: 0; +} + +div.cell details.hide.above-input:has(+ details.below-input), +div.cell div.cell_input:has(+ details.below-input) +{ + margin-bottom: 0; +} + +div.cell:has(> *:nth-child(2)) div.cell_input:first-child, +div.cell:has(> *:nth-child(2)) details:first-child +{ + border-bottom-left-radius: 0; + border-bottom-right-radius: 0; +} + +div.cell:has(> *:nth-child(2)) div.cell_input:last-child, +div.cell:has(> *:nth-child(2)) details:last-child +{ + border-top-left-radius: 0; + border-top-right-radius: 0; +} + +/* intra-label styles for collapsibles */ +div.cell.container details.hide.above-input>summary, +div.cell.container details.hide.below-input>summary, +div.cell.container details.hide.above-output>summary +{ + display: block; + border-left: none; +} + +div.cell details.hide>summary>p.admonition-title { + display: list-item; + margin-bottom: 0; +} + +div.cell details.hide:not([open]) { + padding-bottom: 0; +} + +div.cell details.hide[open]>summary>p.collapsed { + display: none; +} + +div.cell details.hide:not([open])>summary>p.expanded { + display: none; +} + +@keyframes collapsed-fade-in { + 0% { + opacity: 0; + } + + 100% { + opacity: 1; + } +} +div.cell details.hide[open]>summary~* { + -moz-animation: collapsed-fade-in 0.3s ease-in-out; + -webkit-animation: collapsed-fade-in 0.3s ease-in-out; + animation: collapsed-fade-in 0.3s ease-in-out; +} + +/* Clear conflicting styles for details and admonitions set by some themes */ +div.cell details.admonition summary::before { + content: unset; +} + +/* Math align to the left */ +.cell_output .MathJax_Display { + text-align: left !important; +} + +/* Pandas tables. Pulled from the Jupyter / nbsphinx CSS */ +div.cell_output table { + border: none; + border-collapse: collapse; + border-spacing: 0; + color: black; + font-size: 1em; + table-layout: fixed; +} + +div.cell_output thead { + border-bottom: 1px solid black; + vertical-align: bottom; +} + +div.cell_output tr, +div.cell_output th, +div.cell_output td { + text-align: right; + vertical-align: middle; + padding: 0.5em 0.5em; + line-height: normal; + white-space: normal; + max-width: none; + border: none; +} + +div.cell_output th { + font-weight: bold; +} + +div.cell_output tbody tr:nth-child(odd) { + background: #f5f5f5; +} + +div.cell_output tbody tr:hover { + background: rgba(66, 165, 245, 0.2); +} + +/** source code line numbers **/ +span.linenos { + opacity: 0.5; +} + +/* Inline text from `paste` operation */ + +span.pasted-text { + font-weight: bold; +} + +span.pasted-inline img { + max-height: 2em; +} + +tbody span.pasted-inline img { + max-height: none; +} + + +/* Adding scroll bars if tags: output_scroll, scroll-output, and scroll-input + * On screens, we want to scroll, but on print show all + * + * It was before in https://github.com/executablebooks/sphinx-book-theme/blob/eb1b6baf098b27605e8f2b7b2979b17ebf1b9540/src/sphinx_book_theme/assets/styles/extensions/_myst-nb.scss +*/ +div.cell:is( + .tag_output_scroll, + .tag_scroll-output, + .config_scroll_outputs + ) + div.cell_output, +div.cell.tag_scroll-input div.cell_input { + max-height: 24em; + overflow-y: auto; + max-width: 100%; + overflow-x: auto; +} + +div.cell.config_scroll_outputs div.cell_output:has(img) { + /* If the output cell has image(s), allow it to take 90% of viewport height + but still bounded between 24em and 60em */ + max-height: clamp(24em, 90vh, 60em); +} + +/* Custom scrollbars */ +div.cell:is( + .tag_output_scroll, + .tag_scroll-output, + .config_scroll_outputs + ) + div.cell_output::-webkit-scrollbar, +div.cell.tag_scroll-input div.cell_input::-webkit-scrollbar { + width: var(--mystnb-scrollbar-width); + height: var(--mystnb-scrollbar-height); +} + +div.cell:is( + .tag_output_scroll, + .tag_scroll-output, + .config_scroll_outputs + ) + div.cell_output::-webkit-scrollbar-thumb, +div.cell.tag_scroll-input div.cell_input::-webkit-scrollbar-thumb { + background: var(--mystnb-scrollbar-thumb-color); + border-radius: var(--mystnb-scrollbar-thumb-border-radius); +} + +div.cell:is( + .tag_output_scroll, + .tag_scroll-output, + .config_scroll_outputs + ) + div.cell_output::-webkit-scrollbar-thumb:hover, +div.cell.tag_scroll-input div.cell_input::-webkit-scrollbar-thumb:hover { + background: var(--mystnb-scrollbar-thumb-hover-color); +} + +/* In print mode, unset scroll styles */ +@media print { + div.cell:is( + .tag_output_scroll, + .tag_scroll-output, + .config_scroll_outputs + ) + div.cell_output, + div.cell.tag_scroll-input div.cell_input { + max-height: unset; + overflow-y: visible; + max-width: unset; + overflow-x: visible; + } +} + +/* Font colors for translated ANSI escape sequences +Color values are copied from Jupyter Notebook +https://github.com/jupyter/notebook/blob/52581f8eda9b319eb0390ac77fe5903c38f81e3e/notebook/static/notebook/less/ansicolors.less#L14-L21 +Background colors from +https://nbsphinx.readthedocs.io/en/latest/code-cells.html#ANSI-Colors +*/ +div.highlight .-Color-Bold { + font-weight: bold; +} + +div.highlight .-Color[class*=-Black] { + color: #3E424D +} + +div.highlight .-Color[class*=-Red] { + color: #E75C58 +} + +div.highlight .-Color[class*=-Green] { + color: #00A250 +} + +div.highlight .-Color[class*=-Yellow] { + color: #DDB62B +} + +div.highlight .-Color[class*=-Blue] { + color: #208FFB +} + +div.highlight .-Color[class*=-Magenta] { + color: #D160C4 +} + +div.highlight .-Color[class*=-Cyan] { + color: #60C6C8 +} + +div.highlight .-Color[class*=-White] { + color: #C5C1B4 +} + +div.highlight .-Color[class*=-BGBlack] { + background-color: #3E424D +} + +div.highlight .-Color[class*=-BGRed] { + background-color: #E75C58 +} + +div.highlight .-Color[class*=-BGGreen] { + background-color: #00A250 +} + +div.highlight .-Color[class*=-BGYellow] { + background-color: #DDB62B +} + +div.highlight .-Color[class*=-BGBlue] { + background-color: #208FFB +} + +div.highlight .-Color[class*=-BGMagenta] { + background-color: #D160C4 +} + +div.highlight .-Color[class*=-BGCyan] { + background-color: #60C6C8 +} + +div.highlight .-Color[class*=-BGWhite] { + background-color: #C5C1B4 +} + +/* Font colors for 8-bit ANSI */ + +div.highlight .-Color[class*=-C0] { + color: #000000 +} + +div.highlight .-Color[class*=-BGC0] { + background-color: #000000 +} + +div.highlight .-Color[class*=-C1] { + color: #800000 +} + +div.highlight .-Color[class*=-BGC1] { + background-color: #800000 +} + +div.highlight .-Color[class*=-C2] { + color: #008000 +} + +div.highlight .-Color[class*=-BGC2] { + background-color: #008000 +} + +div.highlight .-Color[class*=-C3] { + color: #808000 +} + +div.highlight .-Color[class*=-BGC3] { + background-color: #808000 +} + +div.highlight .-Color[class*=-C4] { + color: #000080 +} + +div.highlight .-Color[class*=-BGC4] { + background-color: #000080 +} + +div.highlight .-Color[class*=-C5] { + color: #800080 +} + +div.highlight .-Color[class*=-BGC5] { + background-color: #800080 +} + +div.highlight .-Color[class*=-C6] { + color: #008080 +} + +div.highlight .-Color[class*=-BGC6] { + background-color: #008080 +} + +div.highlight .-Color[class*=-C7] { + color: #C0C0C0 +} + +div.highlight .-Color[class*=-BGC7] { + background-color: #C0C0C0 +} + +div.highlight .-Color[class*=-C8] { + color: #808080 +} + +div.highlight .-Color[class*=-BGC8] { + background-color: #808080 +} + +div.highlight .-Color[class*=-C9] { + color: #FF0000 +} + +div.highlight .-Color[class*=-BGC9] { + background-color: #FF0000 +} + +div.highlight .-Color[class*=-C10] { + color: #00FF00 +} + +div.highlight .-Color[class*=-BGC10] { + background-color: #00FF00 +} + +div.highlight .-Color[class*=-C11] { + color: #FFFF00 +} + +div.highlight .-Color[class*=-BGC11] { + background-color: #FFFF00 +} + +div.highlight .-Color[class*=-C12] { + color: #0000FF +} + +div.highlight .-Color[class*=-BGC12] { + background-color: #0000FF +} + +div.highlight .-Color[class*=-C13] { + color: #FF00FF +} + +div.highlight .-Color[class*=-BGC13] { + background-color: #FF00FF +} + +div.highlight .-Color[class*=-C14] { + color: #00FFFF +} + +div.highlight .-Color[class*=-BGC14] { + background-color: #00FFFF +} + +div.highlight .-Color[class*=-C15] { + color: #FFFFFF +} + +div.highlight .-Color[class*=-BGC15] { + background-color: #FFFFFF +} + +div.highlight .-Color[class*=-C16] { + color: #000000 +} + +div.highlight .-Color[class*=-BGC16] { + background-color: #000000 +} + +div.highlight .-Color[class*=-C17] { + color: #00005F +} + +div.highlight .-Color[class*=-BGC17] { + background-color: #00005F +} + +div.highlight .-Color[class*=-C18] { + color: #000087 +} + +div.highlight .-Color[class*=-BGC18] { + background-color: #000087 +} + +div.highlight .-Color[class*=-C19] { + color: #0000AF +} + +div.highlight .-Color[class*=-BGC19] { + background-color: #0000AF +} + +div.highlight .-Color[class*=-C20] { + color: #0000D7 +} + +div.highlight .-Color[class*=-BGC20] { + background-color: #0000D7 +} + +div.highlight .-Color[class*=-C21] { + color: #0000FF +} + +div.highlight .-Color[class*=-BGC21] { + background-color: #0000FF +} + +div.highlight .-Color[class*=-C22] { + color: #005F00 +} + +div.highlight .-Color[class*=-BGC22] { + background-color: #005F00 +} + +div.highlight .-Color[class*=-C23] { + color: #005F5F +} + +div.highlight .-Color[class*=-BGC23] { + background-color: #005F5F +} + +div.highlight .-Color[class*=-C24] { + color: #005F87 +} + +div.highlight .-Color[class*=-BGC24] { + background-color: #005F87 +} + +div.highlight .-Color[class*=-C25] { + color: #005FAF +} + +div.highlight .-Color[class*=-BGC25] { + background-color: #005FAF +} + +div.highlight .-Color[class*=-C26] { + color: #005FD7 +} + +div.highlight .-Color[class*=-BGC26] { + background-color: #005FD7 +} + +div.highlight .-Color[class*=-C27] { + color: #005FFF +} + +div.highlight .-Color[class*=-BGC27] { + background-color: #005FFF +} + +div.highlight .-Color[class*=-C28] { + color: #008700 +} + +div.highlight .-Color[class*=-BGC28] { + background-color: #008700 +} + +div.highlight .-Color[class*=-C29] { + color: #00875F +} + +div.highlight .-Color[class*=-BGC29] { + background-color: #00875F +} + +div.highlight .-Color[class*=-C30] { + color: #008787 +} + +div.highlight .-Color[class*=-BGC30] { + background-color: #008787 +} + +div.highlight .-Color[class*=-C31] { + color: #0087AF +} + +div.highlight .-Color[class*=-BGC31] { + background-color: #0087AF +} + +div.highlight .-Color[class*=-C32] { + color: #0087D7 +} + +div.highlight .-Color[class*=-BGC32] { + background-color: #0087D7 +} + +div.highlight .-Color[class*=-C33] { + color: #0087FF +} + +div.highlight .-Color[class*=-BGC33] { + background-color: #0087FF +} + +div.highlight .-Color[class*=-C34] { + color: #00AF00 +} + +div.highlight .-Color[class*=-BGC34] { + background-color: #00AF00 +} + +div.highlight .-Color[class*=-C35] { + color: #00AF5F +} + +div.highlight .-Color[class*=-BGC35] { + background-color: #00AF5F +} + +div.highlight .-Color[class*=-C36] { + color: #00AF87 +} + +div.highlight .-Color[class*=-BGC36] { + background-color: #00AF87 +} + +div.highlight .-Color[class*=-C37] { + color: #00AFAF +} + +div.highlight .-Color[class*=-BGC37] { + background-color: #00AFAF +} + +div.highlight .-Color[class*=-C38] { + color: #00AFD7 +} + +div.highlight .-Color[class*=-BGC38] { + background-color: #00AFD7 +} + +div.highlight .-Color[class*=-C39] { + color: #00AFFF +} + +div.highlight .-Color[class*=-BGC39] { + background-color: #00AFFF +} + +div.highlight .-Color[class*=-C40] { + color: #00D700 +} + +div.highlight .-Color[class*=-BGC40] { + background-color: #00D700 +} + +div.highlight .-Color[class*=-C41] { + color: #00D75F +} + +div.highlight .-Color[class*=-BGC41] { + background-color: #00D75F +} + +div.highlight .-Color[class*=-C42] { + color: #00D787 +} + +div.highlight .-Color[class*=-BGC42] { + background-color: #00D787 +} + +div.highlight .-Color[class*=-C43] { + color: #00D7AF +} + +div.highlight .-Color[class*=-BGC43] { + background-color: #00D7AF +} + +div.highlight .-Color[class*=-C44] { + color: #00D7D7 +} + +div.highlight .-Color[class*=-BGC44] { + background-color: #00D7D7 +} + +div.highlight .-Color[class*=-C45] { + color: #00D7FF +} + +div.highlight .-Color[class*=-BGC45] { + background-color: #00D7FF +} + +div.highlight .-Color[class*=-C46] { + color: #00FF00 +} + +div.highlight .-Color[class*=-BGC46] { + background-color: #00FF00 +} + +div.highlight .-Color[class*=-C47] { + color: #00FF5F +} + +div.highlight .-Color[class*=-BGC47] { + background-color: #00FF5F +} + +div.highlight .-Color[class*=-C48] { + color: #00FF87 +} + +div.highlight .-Color[class*=-BGC48] { + background-color: #00FF87 +} + +div.highlight .-Color[class*=-C49] { + color: #00FFAF +} + +div.highlight .-Color[class*=-BGC49] { + background-color: #00FFAF +} + +div.highlight .-Color[class*=-C50] { + color: #00FFD7 +} + +div.highlight .-Color[class*=-BGC50] { + background-color: #00FFD7 +} + +div.highlight .-Color[class*=-C51] { + color: #00FFFF +} + +div.highlight .-Color[class*=-BGC51] { + background-color: #00FFFF +} + +div.highlight .-Color[class*=-C52] { + color: #5F0000 +} + +div.highlight .-Color[class*=-BGC52] { + background-color: #5F0000 +} + +div.highlight .-Color[class*=-C53] { + color: #5F005F +} + +div.highlight .-Color[class*=-BGC53] { + background-color: #5F005F +} + +div.highlight .-Color[class*=-C54] { + color: #5F0087 +} + +div.highlight .-Color[class*=-BGC54] { + background-color: #5F0087 +} + +div.highlight .-Color[class*=-C55] { + color: #5F00AF +} + +div.highlight .-Color[class*=-BGC55] { + background-color: #5F00AF +} + +div.highlight .-Color[class*=-C56] { + color: #5F00D7 +} + +div.highlight .-Color[class*=-BGC56] { + background-color: #5F00D7 +} + +div.highlight .-Color[class*=-C57] { + color: #5F00FF +} + +div.highlight .-Color[class*=-BGC57] { + background-color: #5F00FF +} + +div.highlight .-Color[class*=-C58] { + color: #5F5F00 +} + +div.highlight .-Color[class*=-BGC58] { + background-color: #5F5F00 +} + +div.highlight .-Color[class*=-C59] { + color: #5F5F5F +} + +div.highlight .-Color[class*=-BGC59] { + background-color: #5F5F5F +} + +div.highlight .-Color[class*=-C60] { + color: #5F5F87 +} + +div.highlight .-Color[class*=-BGC60] { + background-color: #5F5F87 +} + +div.highlight .-Color[class*=-C61] { + color: #5F5FAF +} + +div.highlight .-Color[class*=-BGC61] { + background-color: #5F5FAF +} + +div.highlight .-Color[class*=-C62] { + color: #5F5FD7 +} + +div.highlight .-Color[class*=-BGC62] { + background-color: #5F5FD7 +} + +div.highlight .-Color[class*=-C63] { + color: #5F5FFF +} + +div.highlight .-Color[class*=-BGC63] { + background-color: #5F5FFF +} + +div.highlight .-Color[class*=-C64] { + color: #5F8700 +} + +div.highlight .-Color[class*=-BGC64] { + background-color: #5F8700 +} + +div.highlight .-Color[class*=-C65] { + color: #5F875F +} + +div.highlight .-Color[class*=-BGC65] { + background-color: #5F875F +} + +div.highlight .-Color[class*=-C66] { + color: #5F8787 +} + +div.highlight .-Color[class*=-BGC66] { + background-color: #5F8787 +} + +div.highlight .-Color[class*=-C67] { + color: #5F87AF +} + +div.highlight .-Color[class*=-BGC67] { + background-color: #5F87AF +} + +div.highlight .-Color[class*=-C68] { + color: #5F87D7 +} + +div.highlight .-Color[class*=-BGC68] { + background-color: #5F87D7 +} + +div.highlight .-Color[class*=-C69] { + color: #5F87FF +} + +div.highlight .-Color[class*=-BGC69] { + background-color: #5F87FF +} + +div.highlight .-Color[class*=-C70] { + color: #5FAF00 +} + +div.highlight .-Color[class*=-BGC70] { + background-color: #5FAF00 +} + +div.highlight .-Color[class*=-C71] { + color: #5FAF5F +} + +div.highlight .-Color[class*=-BGC71] { + background-color: #5FAF5F +} + +div.highlight .-Color[class*=-C72] { + color: #5FAF87 +} + +div.highlight .-Color[class*=-BGC72] { + background-color: #5FAF87 +} + +div.highlight .-Color[class*=-C73] { + color: #5FAFAF +} + +div.highlight .-Color[class*=-BGC73] { + background-color: #5FAFAF +} + +div.highlight .-Color[class*=-C74] { + color: #5FAFD7 +} + +div.highlight .-Color[class*=-BGC74] { + background-color: #5FAFD7 +} + +div.highlight .-Color[class*=-C75] { + color: #5FAFFF +} + +div.highlight .-Color[class*=-BGC75] { + background-color: #5FAFFF +} + +div.highlight .-Color[class*=-C76] { + color: #5FD700 +} + +div.highlight .-Color[class*=-BGC76] { + background-color: #5FD700 +} + +div.highlight .-Color[class*=-C77] { + color: #5FD75F +} + +div.highlight .-Color[class*=-BGC77] { + background-color: #5FD75F +} + +div.highlight .-Color[class*=-C78] { + color: #5FD787 +} + +div.highlight .-Color[class*=-BGC78] { + background-color: #5FD787 +} + +div.highlight .-Color[class*=-C79] { + color: #5FD7AF +} + +div.highlight .-Color[class*=-BGC79] { + background-color: #5FD7AF +} + +div.highlight .-Color[class*=-C80] { + color: #5FD7D7 +} + +div.highlight .-Color[class*=-BGC80] { + background-color: #5FD7D7 +} + +div.highlight .-Color[class*=-C81] { + color: #5FD7FF +} + +div.highlight .-Color[class*=-BGC81] { + background-color: #5FD7FF +} + +div.highlight .-Color[class*=-C82] { + color: #5FFF00 +} + +div.highlight .-Color[class*=-BGC82] { + background-color: #5FFF00 +} + +div.highlight .-Color[class*=-C83] { + color: #5FFF5F +} + +div.highlight .-Color[class*=-BGC83] { + background-color: #5FFF5F +} + +div.highlight .-Color[class*=-C84] { + color: #5FFF87 +} + +div.highlight .-Color[class*=-BGC84] { + background-color: #5FFF87 +} + +div.highlight .-Color[class*=-C85] { + color: #5FFFAF +} + +div.highlight .-Color[class*=-BGC85] { + background-color: #5FFFAF +} + +div.highlight .-Color[class*=-C86] { + color: #5FFFD7 +} + +div.highlight .-Color[class*=-BGC86] { + background-color: #5FFFD7 +} + +div.highlight .-Color[class*=-C87] { + color: #5FFFFF +} + +div.highlight .-Color[class*=-BGC87] { + background-color: #5FFFFF +} + +div.highlight .-Color[class*=-C88] { + color: #870000 +} + +div.highlight .-Color[class*=-BGC88] { + background-color: #870000 +} + +div.highlight .-Color[class*=-C89] { + color: #87005F +} + +div.highlight .-Color[class*=-BGC89] { + background-color: #87005F +} + +div.highlight .-Color[class*=-C90] { + color: #870087 +} + +div.highlight .-Color[class*=-BGC90] { + background-color: #870087 +} + +div.highlight .-Color[class*=-C91] { + color: #8700AF +} + +div.highlight .-Color[class*=-BGC91] { + background-color: #8700AF +} + +div.highlight .-Color[class*=-C92] { + color: #8700D7 +} + +div.highlight .-Color[class*=-BGC92] { + background-color: #8700D7 +} + +div.highlight .-Color[class*=-C93] { + color: #8700FF +} + +div.highlight .-Color[class*=-BGC93] { + background-color: #8700FF +} + +div.highlight .-Color[class*=-C94] { + color: #875F00 +} + +div.highlight .-Color[class*=-BGC94] { + background-color: #875F00 +} + +div.highlight .-Color[class*=-C95] { + color: #875F5F +} + +div.highlight .-Color[class*=-BGC95] { + background-color: #875F5F +} + +div.highlight .-Color[class*=-C96] { + color: #875F87 +} + +div.highlight .-Color[class*=-BGC96] { + background-color: #875F87 +} + +div.highlight .-Color[class*=-C97] { + color: #875FAF +} + +div.highlight .-Color[class*=-BGC97] { + background-color: #875FAF +} + +div.highlight .-Color[class*=-C98] { + color: #875FD7 +} + +div.highlight .-Color[class*=-BGC98] { + background-color: #875FD7 +} + +div.highlight .-Color[class*=-C99] { + color: #875FFF +} + +div.highlight .-Color[class*=-BGC99] { + background-color: #875FFF +} + +div.highlight .-Color[class*=-C100] { + color: #878700 +} + +div.highlight .-Color[class*=-BGC100] { + background-color: #878700 +} + +div.highlight .-Color[class*=-C101] { + color: #87875F +} + +div.highlight .-Color[class*=-BGC101] { + background-color: #87875F +} + +div.highlight .-Color[class*=-C102] { + color: #878787 +} + +div.highlight .-Color[class*=-BGC102] { + background-color: #878787 +} + +div.highlight .-Color[class*=-C103] { + color: #8787AF +} + +div.highlight .-Color[class*=-BGC103] { + background-color: #8787AF +} + +div.highlight .-Color[class*=-C104] { + color: #8787D7 +} + +div.highlight .-Color[class*=-BGC104] { + background-color: #8787D7 +} + +div.highlight .-Color[class*=-C105] { + color: #8787FF +} + +div.highlight .-Color[class*=-BGC105] { + background-color: #8787FF +} + +div.highlight .-Color[class*=-C106] { + color: #87AF00 +} + +div.highlight .-Color[class*=-BGC106] { + background-color: #87AF00 +} + +div.highlight .-Color[class*=-C107] { + color: #87AF5F +} + +div.highlight .-Color[class*=-BGC107] { + background-color: #87AF5F +} + +div.highlight .-Color[class*=-C108] { + color: #87AF87 +} + +div.highlight .-Color[class*=-BGC108] { + background-color: #87AF87 +} + +div.highlight .-Color[class*=-C109] { + color: #87AFAF +} + +div.highlight .-Color[class*=-BGC109] { + background-color: #87AFAF +} + +div.highlight .-Color[class*=-C110] { + color: #87AFD7 +} + +div.highlight .-Color[class*=-BGC110] { + background-color: #87AFD7 +} + +div.highlight .-Color[class*=-C111] { + color: #87AFFF +} + +div.highlight .-Color[class*=-BGC111] { + background-color: #87AFFF +} + +div.highlight .-Color[class*=-C112] { + color: #87D700 +} + +div.highlight .-Color[class*=-BGC112] { + background-color: #87D700 +} + +div.highlight .-Color[class*=-C113] { + color: #87D75F +} + +div.highlight .-Color[class*=-BGC113] { + background-color: #87D75F +} + +div.highlight .-Color[class*=-C114] { + color: #87D787 +} + +div.highlight .-Color[class*=-BGC114] { + background-color: #87D787 +} + +div.highlight .-Color[class*=-C115] { + color: #87D7AF +} + +div.highlight .-Color[class*=-BGC115] { + background-color: #87D7AF +} + +div.highlight .-Color[class*=-C116] { + color: #87D7D7 +} + +div.highlight .-Color[class*=-BGC116] { + background-color: #87D7D7 +} + +div.highlight .-Color[class*=-C117] { + color: #87D7FF +} + +div.highlight .-Color[class*=-BGC117] { + background-color: #87D7FF +} + +div.highlight .-Color[class*=-C118] { + color: #87FF00 +} + +div.highlight .-Color[class*=-BGC118] { + background-color: #87FF00 +} + +div.highlight .-Color[class*=-C119] { + color: #87FF5F +} + +div.highlight .-Color[class*=-BGC119] { + background-color: #87FF5F +} + +div.highlight .-Color[class*=-C120] { + color: #87FF87 +} + +div.highlight .-Color[class*=-BGC120] { + background-color: #87FF87 +} + +div.highlight .-Color[class*=-C121] { + color: #87FFAF +} + +div.highlight .-Color[class*=-BGC121] { + background-color: #87FFAF +} + +div.highlight .-Color[class*=-C122] { + color: #87FFD7 +} + +div.highlight .-Color[class*=-BGC122] { + background-color: #87FFD7 +} + +div.highlight .-Color[class*=-C123] { + color: #87FFFF +} + +div.highlight .-Color[class*=-BGC123] { + background-color: #87FFFF +} + +div.highlight .-Color[class*=-C124] { + color: #AF0000 +} + +div.highlight .-Color[class*=-BGC124] { + background-color: #AF0000 +} + +div.highlight .-Color[class*=-C125] { + color: #AF005F +} + +div.highlight .-Color[class*=-BGC125] { + background-color: #AF005F +} + +div.highlight .-Color[class*=-C126] { + color: #AF0087 +} + +div.highlight .-Color[class*=-BGC126] { + background-color: #AF0087 +} + +div.highlight .-Color[class*=-C127] { + color: #AF00AF +} + +div.highlight .-Color[class*=-BGC127] { + background-color: #AF00AF +} + +div.highlight .-Color[class*=-C128] { + color: #AF00D7 +} + +div.highlight .-Color[class*=-BGC128] { + background-color: #AF00D7 +} + +div.highlight .-Color[class*=-C129] { + color: #AF00FF +} + +div.highlight .-Color[class*=-BGC129] { + background-color: #AF00FF +} + +div.highlight .-Color[class*=-C130] { + color: #AF5F00 +} + +div.highlight .-Color[class*=-BGC130] { + background-color: #AF5F00 +} + +div.highlight .-Color[class*=-C131] { + color: #AF5F5F +} + +div.highlight .-Color[class*=-BGC131] { + background-color: #AF5F5F +} + +div.highlight .-Color[class*=-C132] { + color: #AF5F87 +} + +div.highlight .-Color[class*=-BGC132] { + background-color: #AF5F87 +} + +div.highlight .-Color[class*=-C133] { + color: #AF5FAF +} + +div.highlight .-Color[class*=-BGC133] { + background-color: #AF5FAF +} + +div.highlight .-Color[class*=-C134] { + color: #AF5FD7 +} + +div.highlight .-Color[class*=-BGC134] { + background-color: #AF5FD7 +} + +div.highlight .-Color[class*=-C135] { + color: #AF5FFF +} + +div.highlight .-Color[class*=-BGC135] { + background-color: #AF5FFF +} + +div.highlight .-Color[class*=-C136] { + color: #AF8700 +} + +div.highlight .-Color[class*=-BGC136] { + background-color: #AF8700 +} + +div.highlight .-Color[class*=-C137] { + color: #AF875F +} + +div.highlight .-Color[class*=-BGC137] { + background-color: #AF875F +} + +div.highlight .-Color[class*=-C138] { + color: #AF8787 +} + +div.highlight .-Color[class*=-BGC138] { + background-color: #AF8787 +} + +div.highlight .-Color[class*=-C139] { + color: #AF87AF +} + +div.highlight .-Color[class*=-BGC139] { + background-color: #AF87AF +} + +div.highlight .-Color[class*=-C140] { + color: #AF87D7 +} + +div.highlight .-Color[class*=-BGC140] { + background-color: #AF87D7 +} + +div.highlight .-Color[class*=-C141] { + color: #AF87FF +} + +div.highlight .-Color[class*=-BGC141] { + background-color: #AF87FF +} + +div.highlight .-Color[class*=-C142] { + color: #AFAF00 +} + +div.highlight .-Color[class*=-BGC142] { + background-color: #AFAF00 +} + +div.highlight .-Color[class*=-C143] { + color: #AFAF5F +} + +div.highlight .-Color[class*=-BGC143] { + background-color: #AFAF5F +} + +div.highlight .-Color[class*=-C144] { + color: #AFAF87 +} + +div.highlight .-Color[class*=-BGC144] { + background-color: #AFAF87 +} + +div.highlight .-Color[class*=-C145] { + color: #AFAFAF +} + +div.highlight .-Color[class*=-BGC145] { + background-color: #AFAFAF +} + +div.highlight .-Color[class*=-C146] { + color: #AFAFD7 +} + +div.highlight .-Color[class*=-BGC146] { + background-color: #AFAFD7 +} + +div.highlight .-Color[class*=-C147] { + color: #AFAFFF +} + +div.highlight .-Color[class*=-BGC147] { + background-color: #AFAFFF +} + +div.highlight .-Color[class*=-C148] { + color: #AFD700 +} + +div.highlight .-Color[class*=-BGC148] { + background-color: #AFD700 +} + +div.highlight .-Color[class*=-C149] { + color: #AFD75F +} + +div.highlight .-Color[class*=-BGC149] { + background-color: #AFD75F +} + +div.highlight .-Color[class*=-C150] { + color: #AFD787 +} + +div.highlight .-Color[class*=-BGC150] { + background-color: #AFD787 +} + +div.highlight .-Color[class*=-C151] { + color: #AFD7AF +} + +div.highlight .-Color[class*=-BGC151] { + background-color: #AFD7AF +} + +div.highlight .-Color[class*=-C152] { + color: #AFD7D7 +} + +div.highlight .-Color[class*=-BGC152] { + background-color: #AFD7D7 +} + +div.highlight .-Color[class*=-C153] { + color: #AFD7FF +} + +div.highlight .-Color[class*=-BGC153] { + background-color: #AFD7FF +} + +div.highlight .-Color[class*=-C154] { + color: #AFFF00 +} + +div.highlight .-Color[class*=-BGC154] { + background-color: #AFFF00 +} + +div.highlight .-Color[class*=-C155] { + color: #AFFF5F +} + +div.highlight .-Color[class*=-BGC155] { + background-color: #AFFF5F +} + +div.highlight .-Color[class*=-C156] { + color: #AFFF87 +} + +div.highlight .-Color[class*=-BGC156] { + background-color: #AFFF87 +} + +div.highlight .-Color[class*=-C157] { + color: #AFFFAF +} + +div.highlight .-Color[class*=-BGC157] { + background-color: #AFFFAF +} + +div.highlight .-Color[class*=-C158] { + color: #AFFFD7 +} + +div.highlight .-Color[class*=-BGC158] { + background-color: #AFFFD7 +} + +div.highlight .-Color[class*=-C159] { + color: #AFFFFF +} + +div.highlight .-Color[class*=-BGC159] { + background-color: #AFFFFF +} + +div.highlight .-Color[class*=-C160] { + color: #D70000 +} + +div.highlight .-Color[class*=-BGC160] { + background-color: #D70000 +} + +div.highlight .-Color[class*=-C161] { + color: #D7005F +} + +div.highlight .-Color[class*=-BGC161] { + background-color: #D7005F +} + +div.highlight .-Color[class*=-C162] { + color: #D70087 +} + +div.highlight .-Color[class*=-BGC162] { + background-color: #D70087 +} + +div.highlight .-Color[class*=-C163] { + color: #D700AF +} + +div.highlight .-Color[class*=-BGC163] { + background-color: #D700AF +} + +div.highlight .-Color[class*=-C164] { + color: #D700D7 +} + +div.highlight .-Color[class*=-BGC164] { + background-color: #D700D7 +} + +div.highlight .-Color[class*=-C165] { + color: #D700FF +} + +div.highlight .-Color[class*=-BGC165] { + background-color: #D700FF +} + +div.highlight .-Color[class*=-C166] { + color: #D75F00 +} + +div.highlight .-Color[class*=-BGC166] { + background-color: #D75F00 +} + +div.highlight .-Color[class*=-C167] { + color: #D75F5F +} + +div.highlight .-Color[class*=-BGC167] { + background-color: #D75F5F +} + +div.highlight .-Color[class*=-C168] { + color: #D75F87 +} + +div.highlight .-Color[class*=-BGC168] { + background-color: #D75F87 +} + +div.highlight .-Color[class*=-C169] { + color: #D75FAF +} + +div.highlight .-Color[class*=-BGC169] { + background-color: #D75FAF +} + +div.highlight .-Color[class*=-C170] { + color: #D75FD7 +} + +div.highlight .-Color[class*=-BGC170] { + background-color: #D75FD7 +} + +div.highlight .-Color[class*=-C171] { + color: #D75FFF +} + +div.highlight .-Color[class*=-BGC171] { + background-color: #D75FFF +} + +div.highlight .-Color[class*=-C172] { + color: #D78700 +} + +div.highlight .-Color[class*=-BGC172] { + background-color: #D78700 +} + +div.highlight .-Color[class*=-C173] { + color: #D7875F +} + +div.highlight .-Color[class*=-BGC173] { + background-color: #D7875F +} + +div.highlight .-Color[class*=-C174] { + color: #D78787 +} + +div.highlight .-Color[class*=-BGC174] { + background-color: #D78787 +} + +div.highlight .-Color[class*=-C175] { + color: #D787AF +} + +div.highlight .-Color[class*=-BGC175] { + background-color: #D787AF +} + +div.highlight .-Color[class*=-C176] { + color: #D787D7 +} + +div.highlight .-Color[class*=-BGC176] { + background-color: #D787D7 +} + +div.highlight .-Color[class*=-C177] { + color: #D787FF +} + +div.highlight .-Color[class*=-BGC177] { + background-color: #D787FF +} + +div.highlight .-Color[class*=-C178] { + color: #D7AF00 +} + +div.highlight .-Color[class*=-BGC178] { + background-color: #D7AF00 +} + +div.highlight .-Color[class*=-C179] { + color: #D7AF5F +} + +div.highlight .-Color[class*=-BGC179] { + background-color: #D7AF5F +} + +div.highlight .-Color[class*=-C180] { + color: #D7AF87 +} + +div.highlight .-Color[class*=-BGC180] { + background-color: #D7AF87 +} + +div.highlight .-Color[class*=-C181] { + color: #D7AFAF +} + +div.highlight .-Color[class*=-BGC181] { + background-color: #D7AFAF +} + +div.highlight .-Color[class*=-C182] { + color: #D7AFD7 +} + +div.highlight .-Color[class*=-BGC182] { + background-color: #D7AFD7 +} + +div.highlight .-Color[class*=-C183] { + color: #D7AFFF +} + +div.highlight .-Color[class*=-BGC183] { + background-color: #D7AFFF +} + +div.highlight .-Color[class*=-C184] { + color: #D7D700 +} + +div.highlight .-Color[class*=-BGC184] { + background-color: #D7D700 +} + +div.highlight .-Color[class*=-C185] { + color: #D7D75F +} + +div.highlight .-Color[class*=-BGC185] { + background-color: #D7D75F +} + +div.highlight .-Color[class*=-C186] { + color: #D7D787 +} + +div.highlight .-Color[class*=-BGC186] { + background-color: #D7D787 +} + +div.highlight .-Color[class*=-C187] { + color: #D7D7AF +} + +div.highlight .-Color[class*=-BGC187] { + background-color: #D7D7AF +} + +div.highlight .-Color[class*=-C188] { + color: #D7D7D7 +} + +div.highlight .-Color[class*=-BGC188] { + background-color: #D7D7D7 +} + +div.highlight .-Color[class*=-C189] { + color: #D7D7FF +} + +div.highlight .-Color[class*=-BGC189] { + background-color: #D7D7FF +} + +div.highlight .-Color[class*=-C190] { + color: #D7FF00 +} + +div.highlight .-Color[class*=-BGC190] { + background-color: #D7FF00 +} + +div.highlight .-Color[class*=-C191] { + color: #D7FF5F +} + +div.highlight .-Color[class*=-BGC191] { + background-color: #D7FF5F +} + +div.highlight .-Color[class*=-C192] { + color: #D7FF87 +} + +div.highlight .-Color[class*=-BGC192] { + background-color: #D7FF87 +} + +div.highlight .-Color[class*=-C193] { + color: #D7FFAF +} + +div.highlight .-Color[class*=-BGC193] { + background-color: #D7FFAF +} + +div.highlight .-Color[class*=-C194] { + color: #D7FFD7 +} + +div.highlight .-Color[class*=-BGC194] { + background-color: #D7FFD7 +} + +div.highlight .-Color[class*=-C195] { + color: #D7FFFF +} + +div.highlight .-Color[class*=-BGC195] { + background-color: #D7FFFF +} + +div.highlight .-Color[class*=-C196] { + color: #FF0000 +} + +div.highlight .-Color[class*=-BGC196] { + background-color: #FF0000 +} + +div.highlight .-Color[class*=-C197] { + color: #FF005F +} + +div.highlight .-Color[class*=-BGC197] { + background-color: #FF005F +} + +div.highlight .-Color[class*=-C198] { + color: #FF0087 +} + +div.highlight .-Color[class*=-BGC198] { + background-color: #FF0087 +} + +div.highlight .-Color[class*=-C199] { + color: #FF00AF +} + +div.highlight .-Color[class*=-BGC199] { + background-color: #FF00AF +} + +div.highlight .-Color[class*=-C200] { + color: #FF00D7 +} + +div.highlight .-Color[class*=-BGC200] { + background-color: #FF00D7 +} + +div.highlight .-Color[class*=-C201] { + color: #FF00FF +} + +div.highlight .-Color[class*=-BGC201] { + background-color: #FF00FF +} + +div.highlight .-Color[class*=-C202] { + color: #FF5F00 +} + +div.highlight .-Color[class*=-BGC202] { + background-color: #FF5F00 +} + +div.highlight .-Color[class*=-C203] { + color: #FF5F5F +} + +div.highlight .-Color[class*=-BGC203] { + background-color: #FF5F5F +} + +div.highlight .-Color[class*=-C204] { + color: #FF5F87 +} + +div.highlight .-Color[class*=-BGC204] { + background-color: #FF5F87 +} + +div.highlight .-Color[class*=-C205] { + color: #FF5FAF +} + +div.highlight .-Color[class*=-BGC205] { + background-color: #FF5FAF +} + +div.highlight .-Color[class*=-C206] { + color: #FF5FD7 +} + +div.highlight .-Color[class*=-BGC206] { + background-color: #FF5FD7 +} + +div.highlight .-Color[class*=-C207] { + color: #FF5FFF +} + +div.highlight .-Color[class*=-BGC207] { + background-color: #FF5FFF +} + +div.highlight .-Color[class*=-C208] { + color: #FF8700 +} + +div.highlight .-Color[class*=-BGC208] { + background-color: #FF8700 +} + +div.highlight .-Color[class*=-C209] { + color: #FF875F +} + +div.highlight .-Color[class*=-BGC209] { + background-color: #FF875F +} + +div.highlight .-Color[class*=-C210] { + color: #FF8787 +} + +div.highlight .-Color[class*=-BGC210] { + background-color: #FF8787 +} + +div.highlight .-Color[class*=-C211] { + color: #FF87AF +} + +div.highlight .-Color[class*=-BGC211] { + background-color: #FF87AF +} + +div.highlight .-Color[class*=-C212] { + color: #FF87D7 +} + +div.highlight .-Color[class*=-BGC212] { + background-color: #FF87D7 +} + +div.highlight .-Color[class*=-C213] { + color: #FF87FF +} + +div.highlight .-Color[class*=-BGC213] { + background-color: #FF87FF +} + +div.highlight .-Color[class*=-C214] { + color: #FFAF00 +} + +div.highlight .-Color[class*=-BGC214] { + background-color: #FFAF00 +} + +div.highlight .-Color[class*=-C215] { + color: #FFAF5F +} + +div.highlight .-Color[class*=-BGC215] { + background-color: #FFAF5F +} + +div.highlight .-Color[class*=-C216] { + color: #FFAF87 +} + +div.highlight .-Color[class*=-BGC216] { + background-color: #FFAF87 +} + +div.highlight .-Color[class*=-C217] { + color: #FFAFAF +} + +div.highlight .-Color[class*=-BGC217] { + background-color: #FFAFAF +} + +div.highlight .-Color[class*=-C218] { + color: #FFAFD7 +} + +div.highlight .-Color[class*=-BGC218] { + background-color: #FFAFD7 +} + +div.highlight .-Color[class*=-C219] { + color: #FFAFFF +} + +div.highlight .-Color[class*=-BGC219] { + background-color: #FFAFFF +} + +div.highlight .-Color[class*=-C220] { + color: #FFD700 +} + +div.highlight .-Color[class*=-BGC220] { + background-color: #FFD700 +} + +div.highlight .-Color[class*=-C221] { + color: #FFD75F +} + +div.highlight .-Color[class*=-BGC221] { + background-color: #FFD75F +} + +div.highlight .-Color[class*=-C222] { + color: #FFD787 +} + +div.highlight .-Color[class*=-BGC222] { + background-color: #FFD787 +} + +div.highlight .-Color[class*=-C223] { + color: #FFD7AF +} + +div.highlight .-Color[class*=-BGC223] { + background-color: #FFD7AF +} + +div.highlight .-Color[class*=-C224] { + color: #FFD7D7 +} + +div.highlight .-Color[class*=-BGC224] { + background-color: #FFD7D7 +} + +div.highlight .-Color[class*=-C225] { + color: #FFD7FF +} + +div.highlight .-Color[class*=-BGC225] { + background-color: #FFD7FF +} + +div.highlight .-Color[class*=-C226] { + color: #FFFF00 +} + +div.highlight .-Color[class*=-BGC226] { + background-color: #FFFF00 +} + +div.highlight .-Color[class*=-C227] { + color: #FFFF5F +} + +div.highlight .-Color[class*=-BGC227] { + background-color: #FFFF5F +} + +div.highlight .-Color[class*=-C228] { + color: #FFFF87 +} + +div.highlight .-Color[class*=-BGC228] { + background-color: #FFFF87 +} + +div.highlight .-Color[class*=-C229] { + color: #FFFFAF +} + +div.highlight .-Color[class*=-BGC229] { + background-color: #FFFFAF +} + +div.highlight .-Color[class*=-C230] { + color: #FFFFD7 +} + +div.highlight .-Color[class*=-BGC230] { + background-color: #FFFFD7 +} + +div.highlight .-Color[class*=-C231] { + color: #FFFFFF +} + +div.highlight .-Color[class*=-BGC231] { + background-color: #FFFFFF +} + +div.highlight .-Color[class*=-C232] { + color: #080808 +} + +div.highlight .-Color[class*=-BGC232] { + background-color: #080808 +} + +div.highlight .-Color[class*=-C233] { + color: #121212 +} + +div.highlight .-Color[class*=-BGC233] { + background-color: #121212 +} + +div.highlight .-Color[class*=-C234] { + color: #1C1C1C +} + +div.highlight .-Color[class*=-BGC234] { + background-color: #1C1C1C +} + +div.highlight .-Color[class*=-C235] { + color: #262626 +} + +div.highlight .-Color[class*=-BGC235] { + background-color: #262626 +} + +div.highlight .-Color[class*=-C236] { + color: #303030 +} + +div.highlight .-Color[class*=-BGC236] { + background-color: #303030 +} + +div.highlight .-Color[class*=-C237] { + color: #3A3A3A +} + +div.highlight .-Color[class*=-BGC237] { + background-color: #3A3A3A +} + +div.highlight .-Color[class*=-C238] { + color: #444444 +} + +div.highlight .-Color[class*=-BGC238] { + background-color: #444444 +} + +div.highlight .-Color[class*=-C239] { + color: #4E4E4E +} + +div.highlight .-Color[class*=-BGC239] { + background-color: #4E4E4E +} + +div.highlight .-Color[class*=-C240] { + color: #585858 +} + +div.highlight .-Color[class*=-BGC240] { + background-color: #585858 +} + +div.highlight .-Color[class*=-C241] { + color: #626262 +} + +div.highlight .-Color[class*=-BGC241] { + background-color: #626262 +} + +div.highlight .-Color[class*=-C242] { + color: #6C6C6C +} + +div.highlight .-Color[class*=-BGC242] { + background-color: #6C6C6C +} + +div.highlight .-Color[class*=-C243] { + color: #767676 +} + +div.highlight .-Color[class*=-BGC243] { + background-color: #767676 +} + +div.highlight .-Color[class*=-C244] { + color: #808080 +} + +div.highlight .-Color[class*=-BGC244] { + background-color: #808080 +} + +div.highlight .-Color[class*=-C245] { + color: #8A8A8A +} + +div.highlight .-Color[class*=-BGC245] { + background-color: #8A8A8A +} + +div.highlight .-Color[class*=-C246] { + color: #949494 +} + +div.highlight .-Color[class*=-BGC246] { + background-color: #949494 +} + +div.highlight .-Color[class*=-C247] { + color: #9E9E9E +} + +div.highlight .-Color[class*=-BGC247] { + background-color: #9E9E9E +} + +div.highlight .-Color[class*=-C248] { + color: #A8A8A8 +} + +div.highlight .-Color[class*=-BGC248] { + background-color: #A8A8A8 +} + +div.highlight .-Color[class*=-C249] { + color: #B2B2B2 +} + +div.highlight .-Color[class*=-BGC249] { + background-color: #B2B2B2 +} + +div.highlight .-Color[class*=-C250] { + color: #BCBCBC +} + +div.highlight .-Color[class*=-BGC250] { + background-color: #BCBCBC +} + +div.highlight .-Color[class*=-C251] { + color: #C6C6C6 +} + +div.highlight .-Color[class*=-BGC251] { + background-color: #C6C6C6 +} + +div.highlight .-Color[class*=-C252] { + color: #D0D0D0 +} + +div.highlight .-Color[class*=-BGC252] { + background-color: #D0D0D0 +} + +div.highlight .-Color[class*=-C253] { + color: #DADADA +} + +div.highlight .-Color[class*=-BGC253] { + background-color: #DADADA +} + +div.highlight .-Color[class*=-C254] { + color: #E4E4E4 +} + +div.highlight .-Color[class*=-BGC254] { + background-color: #E4E4E4 +} + +div.highlight .-Color[class*=-C255] { + color: #EEEEEE +} + +div.highlight .-Color[class*=-BGC255] { + background-color: #EEEEEE +} diff --git a/_static/plus.png b/_static/plus.png new file mode 100644 index 0000000..7107cec Binary files /dev/null and b/_static/plus.png differ diff --git a/_static/pygments.css b/_static/pygments.css new file mode 100644 index 0000000..cb16a42 --- /dev/null +++ b/_static/pygments.css @@ -0,0 +1,249 @@ +.highlight pre { line-height: 125%; } +.highlight td.linenos .normal { color: inherit; background-color: transparent; padding-left: 5px; padding-right: 5px; } +.highlight span.linenos { color: inherit; background-color: transparent; padding-left: 5px; padding-right: 5px; } +.highlight td.linenos .special { color: #000000; background-color: #ffffc0; padding-left: 5px; padding-right: 5px; } +.highlight span.linenos.special { color: #000000; background-color: #ffffc0; padding-left: 5px; padding-right: 5px; } +.highlight .hll { background-color: #ffffcc } +.highlight { background: #eeffcc; } +.highlight .c { color: #408090; font-style: italic } /* Comment */ +.highlight .err { border: 1px solid #F00 } /* Error */ +.highlight .k { color: #007020; font-weight: bold } /* Keyword */ +.highlight .o { color: #666 } /* Operator */ +.highlight .ch { color: #408090; font-style: italic } /* Comment.Hashbang */ +.highlight .cm { color: #408090; font-style: italic } /* Comment.Multiline */ +.highlight .cp { color: #007020 } /* Comment.Preproc */ +.highlight .cpf { color: #408090; font-style: italic } /* Comment.PreprocFile */ +.highlight .c1 { color: #408090; font-style: italic } /* Comment.Single */ +.highlight .cs { color: #408090; background-color: #FFF0F0 } /* Comment.Special */ +.highlight .gd { color: #A00000 } /* Generic.Deleted */ +.highlight .ge { font-style: italic } /* Generic.Emph */ +.highlight .ges { font-weight: bold; font-style: italic } /* Generic.EmphStrong */ +.highlight .gr { color: #F00 } /* Generic.Error */ +.highlight .gh { color: #000080; font-weight: bold } /* Generic.Heading */ +.highlight .gi { color: #00A000 } /* Generic.Inserted */ +.highlight .go { color: #333 } /* Generic.Output */ +.highlight .gp { color: #C65D09; font-weight: bold } /* Generic.Prompt */ +.highlight .gs { font-weight: bold } /* Generic.Strong */ +.highlight .gu { color: #800080; font-weight: bold } /* Generic.Subheading */ +.highlight .gt { color: #04D } /* Generic.Traceback */ +.highlight .kc { color: #007020; font-weight: bold } /* Keyword.Constant */ +.highlight .kd { color: #007020; font-weight: bold } /* Keyword.Declaration */ +.highlight .kn { color: #007020; font-weight: bold } /* Keyword.Namespace */ +.highlight .kp { color: #007020 } /* Keyword.Pseudo */ +.highlight .kr { color: #007020; font-weight: bold } /* Keyword.Reserved */ +.highlight .kt { color: #902000 } /* Keyword.Type */ +.highlight .m { color: #208050 } /* Literal.Number */ +.highlight .s { color: #4070A0 } /* Literal.String */ +.highlight .na { color: #4070A0 } /* Name.Attribute */ +.highlight .nb { color: #007020 } /* Name.Builtin */ +.highlight .nc { color: #0E84B5; font-weight: bold } /* Name.Class */ +.highlight .no { color: #60ADD5 } /* Name.Constant */ +.highlight .nd { color: #555; font-weight: bold } /* Name.Decorator */ +.highlight .ni { color: #D55537; font-weight: bold } /* Name.Entity */ +.highlight .ne { color: #007020 } /* Name.Exception */ +.highlight .nf { color: #06287E } /* Name.Function */ +.highlight .nl { color: #002070; font-weight: bold } /* Name.Label */ +.highlight .nn { color: #0E84B5; font-weight: bold } /* Name.Namespace */ +.highlight .nt { color: #062873; font-weight: bold } /* Name.Tag */ +.highlight .nv { color: #BB60D5 } /* Name.Variable */ +.highlight .ow { color: #007020; font-weight: bold } /* Operator.Word */ +.highlight .w { color: #BBB } /* Text.Whitespace */ +.highlight .mb { color: #208050 } /* Literal.Number.Bin */ +.highlight .mf { color: #208050 } /* Literal.Number.Float */ +.highlight .mh { color: #208050 } /* Literal.Number.Hex */ +.highlight .mi { color: #208050 } /* Literal.Number.Integer */ +.highlight .mo { color: #208050 } /* Literal.Number.Oct */ +.highlight .sa { color: #4070A0 } /* Literal.String.Affix */ +.highlight .sb { color: #4070A0 } /* Literal.String.Backtick */ +.highlight .sc { color: #4070A0 } /* Literal.String.Char */ +.highlight .dl { color: #4070A0 } /* Literal.String.Delimiter */ +.highlight .sd { color: #4070A0; font-style: italic } /* Literal.String.Doc */ +.highlight .s2 { color: #4070A0 } /* Literal.String.Double */ +.highlight .se { color: #4070A0; font-weight: bold } /* Literal.String.Escape */ +.highlight .sh { color: #4070A0 } /* Literal.String.Heredoc */ +.highlight .si { color: #70A0D0; font-style: italic } /* Literal.String.Interpol */ +.highlight .sx { color: #C65D09 } /* Literal.String.Other */ +.highlight .sr { color: #235388 } /* Literal.String.Regex */ +.highlight .s1 { color: #4070A0 } /* Literal.String.Single */ +.highlight .ss { color: #517918 } /* Literal.String.Symbol */ +.highlight .bp { color: #007020 } /* Name.Builtin.Pseudo */ +.highlight .fm { color: #06287E } /* Name.Function.Magic */ +.highlight .vc { color: #BB60D5 } /* Name.Variable.Class */ +.highlight .vg { color: #BB60D5 } /* Name.Variable.Global */ +.highlight .vi { color: #BB60D5 } /* Name.Variable.Instance */ +.highlight .vm { color: #BB60D5 } /* Name.Variable.Magic */ +.highlight .il { color: #208050 } /* Literal.Number.Integer.Long */ +@media not print { +body[data-theme="dark"] .highlight pre { line-height: 125%; } +body[data-theme="dark"] .highlight td.linenos .normal { color: #aaaaaa; background-color: transparent; padding-left: 5px; padding-right: 5px; } +body[data-theme="dark"] .highlight span.linenos { color: #aaaaaa; background-color: transparent; padding-left: 5px; padding-right: 5px; } +body[data-theme="dark"] .highlight td.linenos .special { color: #000000; background-color: #ffffc0; padding-left: 5px; padding-right: 5px; } +body[data-theme="dark"] .highlight span.linenos.special { color: #000000; background-color: #ffffc0; padding-left: 5px; padding-right: 5px; } +body[data-theme="dark"] .highlight .hll { background-color: #404040 } +body[data-theme="dark"] .highlight { background: #202020; color: #D0D0D0 } +body[data-theme="dark"] .highlight .c { color: #ABABAB; font-style: italic } /* Comment */ +body[data-theme="dark"] .highlight .err { color: #A61717; background-color: #E3D2D2 } /* Error */ +body[data-theme="dark"] .highlight .esc { color: #D0D0D0 } /* Escape */ +body[data-theme="dark"] .highlight .g { color: #D0D0D0 } /* Generic */ +body[data-theme="dark"] .highlight .k { color: #6EBF26; font-weight: bold } /* Keyword */ +body[data-theme="dark"] .highlight .l { color: #D0D0D0 } /* Literal */ +body[data-theme="dark"] .highlight .n { color: #D0D0D0 } /* Name */ +body[data-theme="dark"] .highlight .o { color: #D0D0D0 } /* Operator */ +body[data-theme="dark"] .highlight .x { color: #D0D0D0 } /* Other */ +body[data-theme="dark"] .highlight .p { color: #D0D0D0 } /* Punctuation */ +body[data-theme="dark"] .highlight .ch { color: #ABABAB; font-style: italic } /* Comment.Hashbang */ +body[data-theme="dark"] .highlight .cm { color: #ABABAB; font-style: italic } /* Comment.Multiline */ +body[data-theme="dark"] .highlight .cp { color: #FF3A3A; font-weight: bold } /* Comment.Preproc */ +body[data-theme="dark"] .highlight .cpf { color: #ABABAB; font-style: italic } /* Comment.PreprocFile */ +body[data-theme="dark"] .highlight .c1 { color: #ABABAB; font-style: italic } /* Comment.Single */ +body[data-theme="dark"] .highlight .cs { color: #E50808; font-weight: bold; background-color: #520000 } /* Comment.Special */ +body[data-theme="dark"] .highlight .gd { color: #FF3A3A } /* Generic.Deleted */ +body[data-theme="dark"] .highlight .ge { color: #D0D0D0; font-style: italic } /* Generic.Emph */ +body[data-theme="dark"] .highlight .ges { color: #D0D0D0; font-weight: bold; font-style: italic } /* Generic.EmphStrong */ +body[data-theme="dark"] .highlight .gr { color: #FF3A3A } /* Generic.Error */ +body[data-theme="dark"] .highlight .gh { color: #FFF; font-weight: bold } /* Generic.Heading */ +body[data-theme="dark"] .highlight .gi { color: #589819 } /* Generic.Inserted */ +body[data-theme="dark"] .highlight .go { color: #CCC } /* Generic.Output */ +body[data-theme="dark"] .highlight .gp { color: #AAA } /* Generic.Prompt */ +body[data-theme="dark"] .highlight .gs { color: #D0D0D0; font-weight: bold } /* Generic.Strong */ +body[data-theme="dark"] .highlight .gu { color: #FFF; text-decoration: underline } /* Generic.Subheading */ +body[data-theme="dark"] .highlight .gt { color: #FF3A3A } /* Generic.Traceback */ +body[data-theme="dark"] .highlight .kc { color: #6EBF26; font-weight: bold } /* Keyword.Constant */ +body[data-theme="dark"] .highlight .kd { color: #6EBF26; font-weight: bold } /* Keyword.Declaration */ +body[data-theme="dark"] .highlight .kn { color: #6EBF26; font-weight: bold } /* Keyword.Namespace */ +body[data-theme="dark"] .highlight .kp { color: #6EBF26 } /* Keyword.Pseudo */ +body[data-theme="dark"] .highlight .kr { color: #6EBF26; font-weight: bold } /* Keyword.Reserved */ +body[data-theme="dark"] .highlight .kt { color: #6EBF26; font-weight: bold } /* Keyword.Type */ +body[data-theme="dark"] .highlight .ld { color: #D0D0D0 } /* Literal.Date */ +body[data-theme="dark"] .highlight .m { color: #51B2FD } /* Literal.Number */ +body[data-theme="dark"] .highlight .s { color: #ED9D13 } /* Literal.String */ +body[data-theme="dark"] .highlight .na { color: #BBB } /* Name.Attribute */ +body[data-theme="dark"] .highlight .nb { color: #2FBCCD } /* Name.Builtin */ +body[data-theme="dark"] .highlight .nc { color: #71ADFF; text-decoration: underline } /* Name.Class */ +body[data-theme="dark"] .highlight .no { color: #40FFFF } /* Name.Constant */ +body[data-theme="dark"] .highlight .nd { color: #FFA500 } /* Name.Decorator */ +body[data-theme="dark"] .highlight .ni { color: #D0D0D0 } /* Name.Entity */ +body[data-theme="dark"] .highlight .ne { color: #BBB } /* Name.Exception */ +body[data-theme="dark"] .highlight .nf { color: #71ADFF } /* Name.Function */ +body[data-theme="dark"] .highlight .nl { color: #D0D0D0 } /* Name.Label */ +body[data-theme="dark"] .highlight .nn { color: #71ADFF; text-decoration: underline } /* Name.Namespace */ +body[data-theme="dark"] .highlight .nx { color: #D0D0D0 } /* Name.Other */ +body[data-theme="dark"] .highlight .py { color: #D0D0D0 } /* Name.Property */ +body[data-theme="dark"] .highlight .nt { color: #6EBF26; font-weight: bold } /* Name.Tag */ +body[data-theme="dark"] .highlight .nv { color: #40FFFF } /* Name.Variable */ +body[data-theme="dark"] .highlight .ow { color: #6EBF26; font-weight: bold } /* Operator.Word */ +body[data-theme="dark"] .highlight .pm { color: #D0D0D0 } /* Punctuation.Marker */ +body[data-theme="dark"] .highlight .w { color: #666 } /* Text.Whitespace */ +body[data-theme="dark"] .highlight .mb { color: #51B2FD } /* Literal.Number.Bin */ +body[data-theme="dark"] .highlight .mf { color: #51B2FD } /* Literal.Number.Float */ +body[data-theme="dark"] .highlight .mh { color: #51B2FD } /* Literal.Number.Hex */ +body[data-theme="dark"] .highlight .mi { color: #51B2FD } /* Literal.Number.Integer */ +body[data-theme="dark"] .highlight .mo { color: #51B2FD } /* Literal.Number.Oct */ +body[data-theme="dark"] .highlight .sa { color: #ED9D13 } /* Literal.String.Affix */ +body[data-theme="dark"] .highlight .sb { color: #ED9D13 } /* Literal.String.Backtick */ +body[data-theme="dark"] .highlight .sc { color: #ED9D13 } /* Literal.String.Char */ +body[data-theme="dark"] .highlight .dl { color: #ED9D13 } /* Literal.String.Delimiter */ +body[data-theme="dark"] .highlight .sd { color: #ED9D13 } /* Literal.String.Doc */ +body[data-theme="dark"] .highlight .s2 { color: #ED9D13 } /* Literal.String.Double */ +body[data-theme="dark"] .highlight .se { color: #ED9D13 } /* Literal.String.Escape */ +body[data-theme="dark"] .highlight .sh { color: #ED9D13 } /* Literal.String.Heredoc */ +body[data-theme="dark"] .highlight .si { color: #ED9D13 } /* Literal.String.Interpol */ +body[data-theme="dark"] .highlight .sx { color: #FFA500 } /* Literal.String.Other */ +body[data-theme="dark"] .highlight .sr { color: #ED9D13 } /* Literal.String.Regex */ +body[data-theme="dark"] .highlight .s1 { color: #ED9D13 } /* Literal.String.Single */ +body[data-theme="dark"] .highlight .ss { color: #ED9D13 } /* Literal.String.Symbol */ +body[data-theme="dark"] .highlight .bp { color: #2FBCCD } /* Name.Builtin.Pseudo */ +body[data-theme="dark"] .highlight .fm { color: #71ADFF } /* Name.Function.Magic */ +body[data-theme="dark"] .highlight .vc { color: #40FFFF } /* Name.Variable.Class */ +body[data-theme="dark"] .highlight .vg { color: #40FFFF } /* Name.Variable.Global */ +body[data-theme="dark"] .highlight .vi { color: #40FFFF } /* Name.Variable.Instance */ +body[data-theme="dark"] .highlight .vm { color: #40FFFF } /* Name.Variable.Magic */ +body[data-theme="dark"] .highlight .il { color: #51B2FD } /* Literal.Number.Integer.Long */ +@media (prefers-color-scheme: dark) { +body:not([data-theme="light"]) .highlight pre { line-height: 125%; } +body:not([data-theme="light"]) .highlight td.linenos .normal { color: #aaaaaa; background-color: transparent; padding-left: 5px; padding-right: 5px; } +body:not([data-theme="light"]) .highlight span.linenos { color: #aaaaaa; background-color: transparent; padding-left: 5px; padding-right: 5px; } +body:not([data-theme="light"]) .highlight td.linenos .special { color: #000000; background-color: #ffffc0; padding-left: 5px; padding-right: 5px; } +body:not([data-theme="light"]) .highlight span.linenos.special { color: #000000; background-color: #ffffc0; padding-left: 5px; padding-right: 5px; } +body:not([data-theme="light"]) .highlight .hll { background-color: #404040 } +body:not([data-theme="light"]) .highlight { background: #202020; color: #D0D0D0 } +body:not([data-theme="light"]) .highlight .c { color: #ABABAB; font-style: italic } /* Comment */ +body:not([data-theme="light"]) .highlight .err { color: #A61717; background-color: #E3D2D2 } /* Error */ +body:not([data-theme="light"]) .highlight .esc { color: #D0D0D0 } /* Escape */ +body:not([data-theme="light"]) .highlight .g { color: #D0D0D0 } /* Generic */ +body:not([data-theme="light"]) .highlight .k { color: #6EBF26; font-weight: bold } /* Keyword */ +body:not([data-theme="light"]) .highlight .l { color: #D0D0D0 } /* Literal */ +body:not([data-theme="light"]) .highlight .n { color: #D0D0D0 } /* Name */ +body:not([data-theme="light"]) .highlight .o { color: #D0D0D0 } /* Operator */ +body:not([data-theme="light"]) .highlight .x { color: #D0D0D0 } /* Other */ +body:not([data-theme="light"]) .highlight .p { color: #D0D0D0 } /* Punctuation */ +body:not([data-theme="light"]) .highlight .ch { color: #ABABAB; font-style: italic } /* Comment.Hashbang */ +body:not([data-theme="light"]) .highlight .cm { color: #ABABAB; font-style: italic } /* Comment.Multiline */ +body:not([data-theme="light"]) .highlight .cp { color: #FF3A3A; font-weight: bold } /* Comment.Preproc */ +body:not([data-theme="light"]) .highlight .cpf { color: #ABABAB; font-style: italic } /* Comment.PreprocFile */ +body:not([data-theme="light"]) .highlight .c1 { color: #ABABAB; font-style: italic } /* Comment.Single */ +body:not([data-theme="light"]) .highlight .cs { color: #E50808; font-weight: bold; background-color: #520000 } /* Comment.Special */ +body:not([data-theme="light"]) .highlight .gd { color: #FF3A3A } /* Generic.Deleted */ +body:not([data-theme="light"]) .highlight .ge { color: #D0D0D0; font-style: italic } /* Generic.Emph */ +body:not([data-theme="light"]) .highlight .ges { color: #D0D0D0; font-weight: bold; font-style: italic } /* Generic.EmphStrong */ +body:not([data-theme="light"]) .highlight .gr { color: #FF3A3A } /* Generic.Error */ +body:not([data-theme="light"]) .highlight .gh { color: #FFF; font-weight: bold } /* Generic.Heading */ +body:not([data-theme="light"]) .highlight .gi { color: #589819 } /* Generic.Inserted */ +body:not([data-theme="light"]) .highlight .go { color: #CCC } /* Generic.Output */ +body:not([data-theme="light"]) .highlight .gp { color: #AAA } /* Generic.Prompt */ +body:not([data-theme="light"]) .highlight .gs { color: #D0D0D0; font-weight: bold } /* Generic.Strong */ +body:not([data-theme="light"]) .highlight .gu { color: #FFF; text-decoration: underline } /* Generic.Subheading */ +body:not([data-theme="light"]) .highlight .gt { color: #FF3A3A } /* Generic.Traceback */ +body:not([data-theme="light"]) .highlight .kc { color: #6EBF26; font-weight: bold } /* Keyword.Constant */ +body:not([data-theme="light"]) .highlight .kd { color: #6EBF26; font-weight: bold } /* Keyword.Declaration */ +body:not([data-theme="light"]) .highlight .kn { color: #6EBF26; font-weight: bold } /* Keyword.Namespace */ +body:not([data-theme="light"]) .highlight .kp { color: #6EBF26 } /* Keyword.Pseudo */ +body:not([data-theme="light"]) .highlight .kr { color: #6EBF26; font-weight: bold } /* Keyword.Reserved */ +body:not([data-theme="light"]) .highlight .kt { color: #6EBF26; font-weight: bold } /* Keyword.Type */ +body:not([data-theme="light"]) .highlight .ld { color: #D0D0D0 } /* Literal.Date */ +body:not([data-theme="light"]) .highlight .m { color: #51B2FD } /* Literal.Number */ +body:not([data-theme="light"]) .highlight .s { color: #ED9D13 } /* Literal.String */ +body:not([data-theme="light"]) .highlight .na { color: #BBB } /* Name.Attribute */ +body:not([data-theme="light"]) .highlight .nb { color: #2FBCCD } /* Name.Builtin */ +body:not([data-theme="light"]) .highlight .nc { color: #71ADFF; text-decoration: underline } /* Name.Class */ +body:not([data-theme="light"]) .highlight .no { color: #40FFFF } /* Name.Constant */ +body:not([data-theme="light"]) .highlight .nd { color: #FFA500 } /* Name.Decorator */ +body:not([data-theme="light"]) .highlight .ni { color: #D0D0D0 } /* Name.Entity */ +body:not([data-theme="light"]) .highlight .ne { color: #BBB } /* Name.Exception */ +body:not([data-theme="light"]) .highlight .nf { color: #71ADFF } /* Name.Function */ +body:not([data-theme="light"]) .highlight .nl { color: #D0D0D0 } /* Name.Label */ +body:not([data-theme="light"]) .highlight .nn { color: #71ADFF; text-decoration: underline } /* Name.Namespace */ +body:not([data-theme="light"]) .highlight .nx { color: #D0D0D0 } /* Name.Other */ +body:not([data-theme="light"]) .highlight .py { color: #D0D0D0 } /* Name.Property */ +body:not([data-theme="light"]) .highlight .nt { color: #6EBF26; font-weight: bold } /* Name.Tag */ +body:not([data-theme="light"]) .highlight .nv { color: #40FFFF } /* Name.Variable */ +body:not([data-theme="light"]) .highlight .ow { color: #6EBF26; font-weight: bold } /* Operator.Word */ +body:not([data-theme="light"]) .highlight .pm { color: #D0D0D0 } /* Punctuation.Marker */ +body:not([data-theme="light"]) .highlight .w { color: #666 } /* Text.Whitespace */ +body:not([data-theme="light"]) .highlight .mb { color: #51B2FD } /* Literal.Number.Bin */ +body:not([data-theme="light"]) .highlight .mf { color: #51B2FD } /* Literal.Number.Float */ +body:not([data-theme="light"]) .highlight .mh { color: #51B2FD } /* Literal.Number.Hex */ +body:not([data-theme="light"]) .highlight .mi { color: #51B2FD } /* Literal.Number.Integer */ +body:not([data-theme="light"]) .highlight .mo { color: #51B2FD } /* Literal.Number.Oct */ +body:not([data-theme="light"]) .highlight .sa { color: #ED9D13 } /* Literal.String.Affix */ +body:not([data-theme="light"]) .highlight .sb { color: #ED9D13 } /* Literal.String.Backtick */ +body:not([data-theme="light"]) .highlight .sc { color: #ED9D13 } /* Literal.String.Char */ +body:not([data-theme="light"]) .highlight .dl { color: #ED9D13 } /* Literal.String.Delimiter */ +body:not([data-theme="light"]) .highlight .sd { color: #ED9D13 } /* Literal.String.Doc */ +body:not([data-theme="light"]) .highlight .s2 { color: #ED9D13 } /* Literal.String.Double */ +body:not([data-theme="light"]) .highlight .se { color: #ED9D13 } /* Literal.String.Escape */ +body:not([data-theme="light"]) .highlight .sh { color: #ED9D13 } /* Literal.String.Heredoc */ +body:not([data-theme="light"]) .highlight .si { color: #ED9D13 } /* Literal.String.Interpol */ +body:not([data-theme="light"]) .highlight .sx { color: #FFA500 } /* Literal.String.Other */ +body:not([data-theme="light"]) .highlight .sr { color: #ED9D13 } /* Literal.String.Regex */ +body:not([data-theme="light"]) .highlight .s1 { color: #ED9D13 } /* Literal.String.Single */ +body:not([data-theme="light"]) .highlight .ss { color: #ED9D13 } /* Literal.String.Symbol */ +body:not([data-theme="light"]) .highlight .bp { color: #2FBCCD } /* Name.Builtin.Pseudo */ +body:not([data-theme="light"]) .highlight .fm { color: #71ADFF } /* Name.Function.Magic */ +body:not([data-theme="light"]) .highlight .vc { color: #40FFFF } /* Name.Variable.Class */ +body:not([data-theme="light"]) .highlight .vg { color: #40FFFF } /* Name.Variable.Global */ +body:not([data-theme="light"]) .highlight .vi { color: #40FFFF } /* Name.Variable.Instance */ +body:not([data-theme="light"]) .highlight .vm { color: #40FFFF } /* Name.Variable.Magic */ +body:not([data-theme="light"]) .highlight .il { color: #51B2FD } /* Literal.Number.Integer.Long */ +} +} \ No newline at end of file diff --git a/_static/scripts/furo-extensions.js b/_static/scripts/furo-extensions.js new file mode 100644 index 0000000..e69de29 diff --git a/_static/scripts/furo.js b/_static/scripts/furo.js new file mode 100644 index 0000000..87e1767 --- /dev/null +++ b/_static/scripts/furo.js @@ -0,0 +1,3 @@ +/*! For license information please see furo.js.LICENSE.txt */ +(()=>{var t={856:function(t,e,n){var o,r;r=void 0!==n.g?n.g:"undefined"!=typeof window?window:this,o=function(){return function(t){"use strict";var e={navClass:"active",contentClass:"active",nested:!1,nestedClass:"active",offset:0,reflow:!1,events:!0},n=function(t,e,n){if(n.settings.events){var o=new CustomEvent(t,{bubbles:!0,cancelable:!0,detail:n});e.dispatchEvent(o)}},o=function(t){var e=0;if(t.offsetParent)for(;t;)e+=t.offsetTop,t=t.offsetParent;return e>=0?e:0},r=function(t){t&&t.sort(function(t,e){return o(t.content)=Math.max(document.body.scrollHeight,document.documentElement.scrollHeight,document.body.offsetHeight,document.documentElement.offsetHeight,document.body.clientHeight,document.documentElement.clientHeight)},l=function(t,e){var n=t[t.length-1];if(function(t,e){return!(!s()||!c(t.content,e,!0))}(n,e))return n;for(var o=t.length-1;o>=0;o--)if(c(t[o].content,e))return t[o]},a=function(t,e){if(e.nested&&t.parentNode){var n=t.parentNode.closest("li");n&&(n.classList.remove(e.nestedClass),a(n,e))}},i=function(t,e){if(t){var o=t.nav.closest("li");o&&(o.classList.remove(e.navClass),t.content.classList.remove(e.contentClass),a(o,e),n("gumshoeDeactivate",o,{link:t.nav,content:t.content,settings:e}))}},u=function(t,e){if(e.nested){var n=t.parentNode.closest("li");n&&(n.classList.add(e.nestedClass),u(n,e))}};return function(o,c){var s,a,d,f,m,v={setup:function(){s=document.querySelectorAll(o),a=[],Array.prototype.forEach.call(s,function(t){var e=document.getElementById(decodeURIComponent(t.hash.substr(1)));e&&a.push({nav:t,content:e})}),r(a)},detect:function(){var t=l(a,m);t?d&&t.content===d.content||(i(d,m),function(t,e){if(t){var o=t.nav.closest("li");o&&(o.classList.add(e.navClass),t.content.classList.add(e.contentClass),u(o,e),n("gumshoeActivate",o,{link:t.nav,content:t.content,settings:e}))}}(t,m),d=t):d&&(i(d,m),d=null)}},h=function(e){f&&t.cancelAnimationFrame(f),f=t.requestAnimationFrame(v.detect)},g=function(e){f&&t.cancelAnimationFrame(f),f=t.requestAnimationFrame(function(){r(a),v.detect()})};return v.destroy=function(){d&&i(d,m),t.removeEventListener("scroll",h,!1),m.reflow&&t.removeEventListener("resize",g,!1),a=null,s=null,d=null,f=null,m=null},m=function(){var t={};return Array.prototype.forEach.call(arguments,function(e){for(var n in e){if(!e.hasOwnProperty(n))return;t[n]=e[n]}}),t}(e,c||{}),v.setup(),v.detect(),t.addEventListener("scroll",h,!1),m.reflow&&t.addEventListener("resize",g,!1),v}}(r)}.apply(e,[]),void 0===o||(t.exports=o)}},e={};function n(o){var r=e[o];if(void 0!==r)return r.exports;var c=e[o]={exports:{}};return t[o].call(c.exports,c,c.exports,n),c.exports}n.n=t=>{var e=t&&t.__esModule?()=>t.default:()=>t;return n.d(e,{a:e}),e},n.d=(t,e)=>{for(var o in e)n.o(e,o)&&!n.o(t,o)&&Object.defineProperty(t,o,{enumerable:!0,get:e[o]})},n.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(t){if("object"==typeof window)return window}}(),n.o=(t,e)=>Object.prototype.hasOwnProperty.call(t,e),(()=>{"use strict";var t=n(856),e=n.n(t),o=null,r=null,c=document.documentElement.scrollTop;function s(){const t=localStorage.getItem("theme")||"auto";var e;"light"!==(e=window.matchMedia("(prefers-color-scheme: dark)").matches?"auto"===t?"light":"light"==t?"dark":"auto":"auto"===t?"dark":"dark"==t?"light":"auto")&&"dark"!==e&&"auto"!==e&&(console.error(`Got invalid theme mode: ${e}. Resetting to auto.`),e="auto"),document.body.dataset.theme=e,localStorage.setItem("theme",e),console.log(`Changed to ${e} mode.`)}function l(){!function(){const t=document.getElementsByClassName("theme-toggle");Array.from(t).forEach(t=>{t.addEventListener("click",s)})}(),function(){let t=0,e=!1;window.addEventListener("scroll",function(n){t=window.scrollY,e||(window.requestAnimationFrame(function(){var n;(function(t){t>0?r.classList.add("scrolled"):r.classList.remove("scrolled")})(n=t),function(t){t<64?document.documentElement.classList.remove("show-back-to-top"):tc&&document.documentElement.classList.remove("show-back-to-top"),c=t}(n),function(t){null!==o&&(0==t?o.scrollTo(0,0):Math.ceil(t)>=Math.floor(document.documentElement.scrollHeight-window.innerHeight)?o.scrollTo(0,o.scrollHeight):document.querySelector(".scroll-current"))}(n),e=!1}),e=!0)}),window.scroll()}(),null!==o&&new(e())(".toc-tree a",{reflow:!0,recursive:!0,navClass:"scroll-current",offset:()=>{let t=parseFloat(getComputedStyle(document.documentElement).fontSize);const e=r.getBoundingClientRect();return e.top+e.height+2.5*t+1}})}document.addEventListener("DOMContentLoaded",function(){document.body.parentNode.classList.remove("no-js"),r=document.querySelector("header"),o=document.querySelector(".toc-scroll"),l()})})()})(); +//# sourceMappingURL=furo.js.map \ No newline at end of file diff --git a/_static/scripts/furo.js.LICENSE.txt b/_static/scripts/furo.js.LICENSE.txt new file mode 100644 index 0000000..1632189 --- /dev/null +++ b/_static/scripts/furo.js.LICENSE.txt @@ -0,0 +1,7 @@ +/*! + * gumshoejs v5.1.2 (patched by @pradyunsg) + * A simple, framework-agnostic scrollspy script. + * (c) 2019 Chris Ferdinandi + * MIT License + * http://github.com/cferdinandi/gumshoe + */ diff --git a/_static/scripts/furo.js.map b/_static/scripts/furo.js.map new file mode 100644 index 0000000..3b316f3 --- /dev/null +++ b/_static/scripts/furo.js.map @@ -0,0 +1 @@ +{"version":3,"file":"scripts/furo.js","mappings":";iCAAA,MAQWA,SAWS,IAAX,EAAAC,EACH,EAAAA,EACkB,oBAAXC,OACLA,OACAC,KAbO,EAAF,WACP,OAaJ,SAAUD,GACR,aAMA,IAAIE,EAAW,CAEbC,SAAU,SACVC,aAAc,SAGdC,QAAQ,EACRC,YAAa,SAGbC,OAAQ,EACRC,QAAQ,EAGRC,QAAQ,GA6BNC,EAAY,SAAUC,EAAMC,EAAMC,GAEpC,GAAKA,EAAOC,SAASL,OAArB,CAGA,IAAIM,EAAQ,IAAIC,YAAYL,EAAM,CAChCM,SAAS,EACTC,YAAY,EACZL,OAAQA,IAIVD,EAAKO,cAAcJ,EAVgB,CAWrC,EAOIK,EAAe,SAAUR,GAC3B,IAAIS,EAAW,EACf,GAAIT,EAAKU,aACP,KAAOV,GACLS,GAAYT,EAAKW,UACjBX,EAAOA,EAAKU,aAGhB,OAAOD,GAAY,EAAIA,EAAW,CACpC,EAMIG,EAAe,SAAUC,GACvBA,GACFA,EAASC,KAAK,SAAUC,EAAOC,GAG7B,OAFcR,EAAaO,EAAME,SACnBT,EAAaQ,EAAMC,UACF,EACxB,CACT,EAEJ,EAwCIC,EAAW,SAAUlB,EAAME,EAAUiB,GACvC,IAAIC,EAASpB,EAAKqB,wBACd1B,EAnCU,SAAUO,GAExB,MAA+B,mBAApBA,EAASP,OACX2B,WAAWpB,EAASP,UAItB2B,WAAWpB,EAASP,OAC7B,CA2Be4B,CAAUrB,GACvB,OAAIiB,EAEAK,SAASJ,EAAOD,OAAQ,KACvB/B,EAAOqC,aAAeC,SAASC,gBAAgBC,cAG7CJ,SAASJ,EAAOS,IAAK,KAAOlC,CACrC,EAMImC,EAAa,WACf,OACEC,KAAKC,KAAK5C,EAAOqC,YAAcrC,EAAO6C,cAnCjCF,KAAKG,IACVR,SAASS,KAAKC,aACdV,SAASC,gBAAgBS,aACzBV,SAASS,KAAKE,aACdX,SAASC,gBAAgBU,aACzBX,SAASS,KAAKP,aACdF,SAASC,gBAAgBC,aAkC7B,EAmBIU,EAAY,SAAUzB,EAAUX,GAClC,IAAIqC,EAAO1B,EAASA,EAAS2B,OAAS,GACtC,GAbgB,SAAUC,EAAMvC,GAChC,SAAI4B,MAAgBZ,EAASuB,EAAKxB,QAASf,GAAU,GAEvD,CAUMwC,CAAYH,EAAMrC,GAAW,OAAOqC,EACxC,IAAK,IAAII,EAAI9B,EAAS2B,OAAS,EAAGG,GAAK,EAAGA,IACxC,GAAIzB,EAASL,EAAS8B,GAAG1B,QAASf,GAAW,OAAOW,EAAS8B,EAEjE,EAOIC,EAAmB,SAAUC,EAAK3C,GAEpC,GAAKA,EAAST,QAAWoD,EAAIC,WAA7B,CAGA,IAAIC,EAAKF,EAAIC,WAAWE,QAAQ,MAC3BD,IAGLA,EAAGE,UAAUC,OAAOhD,EAASR,aAG7BkD,EAAiBG,EAAI7C,GAV0B,CAWjD,EAOIiD,EAAa,SAAUC,EAAOlD,GAEhC,GAAKkD,EAAL,CAGA,IAAIL,EAAKK,EAAMP,IAAIG,QAAQ,MACtBD,IAGLA,EAAGE,UAAUC,OAAOhD,EAASX,UAC7B6D,EAAMnC,QAAQgC,UAAUC,OAAOhD,EAASV,cAGxCoD,EAAiBG,EAAI7C,GAGrBJ,EAAU,oBAAqBiD,EAAI,CACjCM,KAAMD,EAAMP,IACZ5B,QAASmC,EAAMnC,QACff,SAAUA,IAjBM,CAmBpB,EAOIoD,EAAiB,SAAUT,EAAK3C,GAElC,GAAKA,EAAST,OAAd,CAGA,IAAIsD,EAAKF,EAAIC,WAAWE,QAAQ,MAC3BD,IAGLA,EAAGE,UAAUM,IAAIrD,EAASR,aAG1B4D,EAAeP,EAAI7C,GAVS,CAW9B,EA6LA,OA1JkB,SAAUsD,EAAUC,GAKpC,IACIC,EAAU7C,EAAU8C,EAASC,EAAS1D,EADtC2D,EAAa,CAUjBA,MAAmB,WAEjBH,EAAWhC,SAASoC,iBAAiBN,GAGrC3C,EAAW,GAGXkD,MAAMC,UAAUC,QAAQC,KAAKR,EAAU,SAAUjB,GAE/C,IAAIxB,EAAUS,SAASyC,eACrBC,mBAAmB3B,EAAK4B,KAAKC,OAAO,KAEjCrD,GAGLJ,EAAS0D,KAAK,CACZ1B,IAAKJ,EACLxB,QAASA,GAEb,GAGAL,EAAaC,EACf,EAKAgD,OAAoB,WAElB,IAAIW,EAASlC,EAAUzB,EAAUX,GAG5BsE,EASDb,GAAWa,EAAOvD,UAAY0C,EAAQ1C,UAG1CkC,EAAWQ,EAASzD,GAzFT,SAAUkD,EAAOlD,GAE9B,GAAKkD,EAAL,CAGA,IAAIL,EAAKK,EAAMP,IAAIG,QAAQ,MACtBD,IAGLA,EAAGE,UAAUM,IAAIrD,EAASX,UAC1B6D,EAAMnC,QAAQgC,UAAUM,IAAIrD,EAASV,cAGrC8D,EAAeP,EAAI7C,GAGnBJ,EAAU,kBAAmBiD,EAAI,CAC/BM,KAAMD,EAAMP,IACZ5B,QAASmC,EAAMnC,QACff,SAAUA,IAjBM,CAmBpB,CAqEIuE,CAASD,EAAQtE,GAGjByD,EAAUa,GAfJb,IACFR,EAAWQ,EAASzD,GACpByD,EAAU,KAchB,GAMIe,EAAgB,SAAUvE,GAExByD,GACFxE,EAAOuF,qBAAqBf,GAI9BA,EAAUxE,EAAOwF,sBAAsBf,EAAWgB,OACpD,EAMIC,EAAgB,SAAU3E,GAExByD,GACFxE,EAAOuF,qBAAqBf,GAI9BA,EAAUxE,EAAOwF,sBAAsB,WACrChE,EAAaC,GACbgD,EAAWgB,QACb,EACF,EAkDA,OA7CAhB,EAAWkB,QAAU,WAEfpB,GACFR,EAAWQ,EAASzD,GAItBd,EAAO4F,oBAAoB,SAAUN,GAAe,GAChDxE,EAASN,QACXR,EAAO4F,oBAAoB,SAAUF,GAAe,GAItDjE,EAAW,KACX6C,EAAW,KACXC,EAAU,KACVC,EAAU,KACV1D,EAAW,IACb,EAOEA,EA3XS,WACX,IAAI+E,EAAS,CAAC,EAOd,OANAlB,MAAMC,UAAUC,QAAQC,KAAKgB,UAAW,SAAUC,GAChD,IAAK,IAAIC,KAAOD,EAAK,CACnB,IAAKA,EAAIE,eAAeD,GAAM,OAC9BH,EAAOG,GAAOD,EAAIC,EACpB,CACF,GACOH,CACT,CAkXeK,CAAOhG,EAAUmE,GAAW,CAAC,GAGxCI,EAAW0B,QAGX1B,EAAWgB,SAGXzF,EAAOoG,iBAAiB,SAAUd,GAAe,GAC7CxE,EAASN,QACXR,EAAOoG,iBAAiB,SAAUV,GAAe,GAS9CjB,CACT,CAOF,CArcW4B,CAAQvG,EAChB,UAFM,SAEN,oB,GCXDwG,EAA2B,CAAC,EAGhC,SAASC,EAAoBC,GAE5B,IAAIC,EAAeH,EAAyBE,GAC5C,QAAqBE,IAAjBD,EACH,OAAOA,EAAaE,QAGrB,IAAIC,EAASN,EAAyBE,GAAY,CAGjDG,QAAS,CAAC,GAOX,OAHAE,EAAoBL,GAAU1B,KAAK8B,EAAOD,QAASC,EAAQA,EAAOD,QAASJ,GAGpEK,EAAOD,OACf,CCrBAJ,EAAoBO,EAAKF,IACxB,IAAIG,EAASH,GAAUA,EAAOI,WAC7B,IAAOJ,EAAiB,QACxB,IAAM,EAEP,OADAL,EAAoBU,EAAEF,EAAQ,CAAEG,EAAGH,IAC5BA,GCLRR,EAAoBU,EAAI,CAACN,EAASQ,KACjC,IAAI,IAAInB,KAAOmB,EACXZ,EAAoBa,EAAED,EAAYnB,KAASO,EAAoBa,EAAET,EAASX,IAC5EqB,OAAOC,eAAeX,EAASX,EAAK,CAAEuB,YAAY,EAAMC,IAAKL,EAAWnB,MCJ3EO,EAAoBxG,EAAI,WACvB,GAA0B,iBAAf0H,WAAyB,OAAOA,WAC3C,IACC,OAAOxH,MAAQ,IAAIyH,SAAS,cAAb,EAChB,CAAE,MAAOC,GACR,GAAsB,iBAAX3H,OAAqB,OAAOA,MACxC,CACA,CAPuB,GCAxBuG,EAAoBa,EAAI,CAACrB,EAAK6B,IAAUP,OAAOzC,UAAUqB,eAAenB,KAAKiB,EAAK6B,G,yCCK9EC,EAAY,KACZC,EAAS,KACTC,EAAgBzF,SAASC,gBAAgByF,UA4E7C,SAASC,IACP,MAAMC,EAAeC,aAAaC,QAAQ,UAAY,OAZxD,IAAkBC,EACH,WADGA,EAaIrI,OAAOsI,WAAW,gCAAgCC,QAI/C,SAAjBL,EACO,QACgB,SAAhBA,EACA,OAEA,OAIU,SAAjBA,EACO,OACgB,QAAhBA,EACA,QAEA,SA9BoB,SAATG,GAA4B,SAATA,IACzCG,QAAQC,MAAM,2BAA2BJ,yBACzCA,EAAO,QAGT/F,SAASS,KAAK2F,QAAQC,MAAQN,EAC9BF,aAAaS,QAAQ,QAASP,GAC9BG,QAAQK,IAAI,cAAcR,UA0B5B,CAmDA,SAASlC,KART,WAEE,MAAM2C,EAAUxG,SAASyG,uBAAuB,gBAChDpE,MAAMqE,KAAKF,GAASjE,QAASoE,IAC3BA,EAAI7C,iBAAiB,QAAS6B,IAElC,CAGEiB,GA/CF,WAEE,IAAIC,EAA6B,EAC7BC,GAAU,EAEdpJ,OAAOoG,iBAAiB,SAAU,SAAUuB,GAC1CwB,EAA6BnJ,OAAOqJ,QAE/BD,IACHpJ,OAAOwF,sBAAsB,WAzDnC,IAAuB8D,GArDvB,SAAgCA,GAC1BA,EAAY,EACdxB,EAAOjE,UAAUM,IAAI,YAErB2D,EAAOjE,UAAUC,OAAO,WAE5B,EAgDEyF,CADqBD,EA0DDH,GAvGtB,SAAmCG,GAC7BA,EAXmB,GAYrBhH,SAASC,gBAAgBsB,UAAUC,OAAO,oBAEtCwF,EAAYvB,EACdzF,SAASC,gBAAgBsB,UAAUM,IAAI,oBAC9BmF,EAAYvB,GACrBzF,SAASC,gBAAgBsB,UAAUC,OAAO,oBAG9CiE,EAAgBuB,CAClB,CAoCEE,CAA0BF,GAlC5B,SAA6BA,GACT,OAAdzB,IAKa,GAAbyB,EACFzB,EAAU4B,SAAS,EAAG,GAGtB9G,KAAKC,KAAK0G,IACV3G,KAAK+G,MAAMpH,SAASC,gBAAgBS,aAAehD,OAAOqC,aAE1DwF,EAAU4B,SAAS,EAAG5B,EAAU7E,cAGhBV,SAASqH,cAAc,mBAc3C,CAKEC,CAAoBN,GAwDdF,GAAU,CACZ,GAEAA,GAAU,EAEd,GACApJ,OAAO6J,QACT,CA8BEC,GA3BkB,OAAdjC,GAKJ,IAAI,IAAJ,CAAY,cAAe,CACzBrH,QAAQ,EACRuJ,WAAW,EACX5J,SAAU,iBACVI,OAAQ,KACN,IAAIyJ,EAAM9H,WAAW+H,iBAAiB3H,SAASC,iBAAiB2H,UAChE,MAAMC,EAAarC,EAAO7F,wBAC1B,OAAOkI,EAAW1H,IAAM0H,EAAWC,OAAS,IAAMJ,EAAM,IAiB9D,CAcA1H,SAAS8D,iBAAiB,mBAT1B,WACE9D,SAASS,KAAKW,WAAWG,UAAUC,OAAO,SAE1CgE,EAASxF,SAASqH,cAAc,UAChC9B,EAAYvF,SAASqH,cAAc,eAEnCxD,GACF,E","sources":["webpack:///./src/furo/assets/scripts/gumshoe-patched.js","webpack:///webpack/bootstrap","webpack:///webpack/runtime/compat get default export","webpack:///webpack/runtime/define property getters","webpack:///webpack/runtime/global","webpack:///webpack/runtime/hasOwnProperty shorthand","webpack:///./src/furo/assets/scripts/furo.js"],"sourcesContent":["/*!\n * gumshoejs v5.1.2 (patched by @pradyunsg)\n * A simple, framework-agnostic scrollspy script.\n * (c) 2019 Chris Ferdinandi\n * MIT License\n * http://github.com/cferdinandi/gumshoe\n */\n\n(function (root, factory) {\n if (typeof define === \"function\" && define.amd) {\n define([], function () {\n return factory(root);\n });\n } else if (typeof exports === \"object\") {\n module.exports = factory(root);\n } else {\n root.Gumshoe = factory(root);\n }\n})(\n typeof global !== \"undefined\"\n ? global\n : typeof window !== \"undefined\"\n ? window\n : this,\n function (window) {\n \"use strict\";\n\n //\n // Defaults\n //\n\n var defaults = {\n // Active classes\n navClass: \"active\",\n contentClass: \"active\",\n\n // Nested navigation\n nested: false,\n nestedClass: \"active\",\n\n // Offset & reflow\n offset: 0,\n reflow: false,\n\n // Event support\n events: true,\n };\n\n //\n // Methods\n //\n\n /**\n * Merge two or more objects together.\n * @param {Object} objects The objects to merge together\n * @returns {Object} Merged values of defaults and options\n */\n var extend = function () {\n var merged = {};\n Array.prototype.forEach.call(arguments, function (obj) {\n for (var key in obj) {\n if (!obj.hasOwnProperty(key)) return;\n merged[key] = obj[key];\n }\n });\n return merged;\n };\n\n /**\n * Emit a custom event\n * @param {String} type The event type\n * @param {Node} elem The element to attach the event to\n * @param {Object} detail Any details to pass along with the event\n */\n var emitEvent = function (type, elem, detail) {\n // Make sure events are enabled\n if (!detail.settings.events) return;\n\n // Create a new event\n var event = new CustomEvent(type, {\n bubbles: true,\n cancelable: true,\n detail: detail,\n });\n\n // Dispatch the event\n elem.dispatchEvent(event);\n };\n\n /**\n * Get an element's distance from the top of the Document.\n * @param {Node} elem The element\n * @return {Number} Distance from the top in pixels\n */\n var getOffsetTop = function (elem) {\n var location = 0;\n if (elem.offsetParent) {\n while (elem) {\n location += elem.offsetTop;\n elem = elem.offsetParent;\n }\n }\n return location >= 0 ? location : 0;\n };\n\n /**\n * Sort content from first to last in the DOM\n * @param {Array} contents The content areas\n */\n var sortContents = function (contents) {\n if (contents) {\n contents.sort(function (item1, item2) {\n var offset1 = getOffsetTop(item1.content);\n var offset2 = getOffsetTop(item2.content);\n if (offset1 < offset2) return -1;\n return 1;\n });\n }\n };\n\n /**\n * Get the offset to use for calculating position\n * @param {Object} settings The settings for this instantiation\n * @return {Float} The number of pixels to offset the calculations\n */\n var getOffset = function (settings) {\n // if the offset is a function run it\n if (typeof settings.offset === \"function\") {\n return parseFloat(settings.offset());\n }\n\n // Otherwise, return it as-is\n return parseFloat(settings.offset);\n };\n\n /**\n * Get the document element's height\n * @private\n * @returns {Number}\n */\n var getDocumentHeight = function () {\n return Math.max(\n document.body.scrollHeight,\n document.documentElement.scrollHeight,\n document.body.offsetHeight,\n document.documentElement.offsetHeight,\n document.body.clientHeight,\n document.documentElement.clientHeight,\n );\n };\n\n /**\n * Determine if an element is in view\n * @param {Node} elem The element\n * @param {Object} settings The settings for this instantiation\n * @param {Boolean} bottom If true, check if element is above bottom of viewport instead\n * @return {Boolean} Returns true if element is in the viewport\n */\n var isInView = function (elem, settings, bottom) {\n var bounds = elem.getBoundingClientRect();\n var offset = getOffset(settings);\n if (bottom) {\n return (\n parseInt(bounds.bottom, 10) <\n (window.innerHeight || document.documentElement.clientHeight)\n );\n }\n return parseInt(bounds.top, 10) <= offset;\n };\n\n /**\n * Check if at the bottom of the viewport\n * @return {Boolean} If true, page is at the bottom of the viewport\n */\n var isAtBottom = function () {\n if (\n Math.ceil(window.innerHeight + window.pageYOffset) >=\n getDocumentHeight()\n )\n return true;\n return false;\n };\n\n /**\n * Check if the last item should be used (even if not at the top of the page)\n * @param {Object} item The last item\n * @param {Object} settings The settings for this instantiation\n * @return {Boolean} If true, use the last item\n */\n var useLastItem = function (item, settings) {\n if (isAtBottom() && isInView(item.content, settings, true)) return true;\n return false;\n };\n\n /**\n * Get the active content\n * @param {Array} contents The content areas\n * @param {Object} settings The settings for this instantiation\n * @return {Object} The content area and matching navigation link\n */\n var getActive = function (contents, settings) {\n var last = contents[contents.length - 1];\n if (useLastItem(last, settings)) return last;\n for (var i = contents.length - 1; i >= 0; i--) {\n if (isInView(contents[i].content, settings)) return contents[i];\n }\n };\n\n /**\n * Deactivate parent navs in a nested navigation\n * @param {Node} nav The starting navigation element\n * @param {Object} settings The settings for this instantiation\n */\n var deactivateNested = function (nav, settings) {\n // If nesting isn't activated, bail\n if (!settings.nested || !nav.parentNode) return;\n\n // Get the parent navigation\n var li = nav.parentNode.closest(\"li\");\n if (!li) return;\n\n // Remove the active class\n li.classList.remove(settings.nestedClass);\n\n // Apply recursively to any parent navigation elements\n deactivateNested(li, settings);\n };\n\n /**\n * Deactivate a nav and content area\n * @param {Object} items The nav item and content to deactivate\n * @param {Object} settings The settings for this instantiation\n */\n var deactivate = function (items, settings) {\n // Make sure there are items to deactivate\n if (!items) return;\n\n // Get the parent list item\n var li = items.nav.closest(\"li\");\n if (!li) return;\n\n // Remove the active class from the nav and content\n li.classList.remove(settings.navClass);\n items.content.classList.remove(settings.contentClass);\n\n // Deactivate any parent navs in a nested navigation\n deactivateNested(li, settings);\n\n // Emit a custom event\n emitEvent(\"gumshoeDeactivate\", li, {\n link: items.nav,\n content: items.content,\n settings: settings,\n });\n };\n\n /**\n * Activate parent navs in a nested navigation\n * @param {Node} nav The starting navigation element\n * @param {Object} settings The settings for this instantiation\n */\n var activateNested = function (nav, settings) {\n // If nesting isn't activated, bail\n if (!settings.nested) return;\n\n // Get the parent navigation\n var li = nav.parentNode.closest(\"li\");\n if (!li) return;\n\n // Add the active class\n li.classList.add(settings.nestedClass);\n\n // Apply recursively to any parent navigation elements\n activateNested(li, settings);\n };\n\n /**\n * Activate a nav and content area\n * @param {Object} items The nav item and content to activate\n * @param {Object} settings The settings for this instantiation\n */\n var activate = function (items, settings) {\n // Make sure there are items to activate\n if (!items) return;\n\n // Get the parent list item\n var li = items.nav.closest(\"li\");\n if (!li) return;\n\n // Add the active class to the nav and content\n li.classList.add(settings.navClass);\n items.content.classList.add(settings.contentClass);\n\n // Activate any parent navs in a nested navigation\n activateNested(li, settings);\n\n // Emit a custom event\n emitEvent(\"gumshoeActivate\", li, {\n link: items.nav,\n content: items.content,\n settings: settings,\n });\n };\n\n /**\n * Create the Constructor object\n * @param {String} selector The selector to use for navigation items\n * @param {Object} options User options and settings\n */\n var Constructor = function (selector, options) {\n //\n // Variables\n //\n\n var publicAPIs = {};\n var navItems, contents, current, timeout, settings;\n\n //\n // Methods\n //\n\n /**\n * Set variables from DOM elements\n */\n publicAPIs.setup = function () {\n // Get all nav items\n navItems = document.querySelectorAll(selector);\n\n // Create contents array\n contents = [];\n\n // Loop through each item, get it's matching content, and push to the array\n Array.prototype.forEach.call(navItems, function (item) {\n // Get the content for the nav item\n var content = document.getElementById(\n decodeURIComponent(item.hash.substr(1)),\n );\n if (!content) return;\n\n // Push to the contents array\n contents.push({\n nav: item,\n content: content,\n });\n });\n\n // Sort contents by the order they appear in the DOM\n sortContents(contents);\n };\n\n /**\n * Detect which content is currently active\n */\n publicAPIs.detect = function () {\n // Get the active content\n var active = getActive(contents, settings);\n\n // if there's no active content, deactivate and bail\n if (!active) {\n if (current) {\n deactivate(current, settings);\n current = null;\n }\n return;\n }\n\n // If the active content is the one currently active, do nothing\n if (current && active.content === current.content) return;\n\n // Deactivate the current content and activate the new content\n deactivate(current, settings);\n activate(active, settings);\n\n // Update the currently active content\n current = active;\n };\n\n /**\n * Detect the active content on scroll\n * Debounced for performance\n */\n var scrollHandler = function (event) {\n // If there's a timer, cancel it\n if (timeout) {\n window.cancelAnimationFrame(timeout);\n }\n\n // Setup debounce callback\n timeout = window.requestAnimationFrame(publicAPIs.detect);\n };\n\n /**\n * Update content sorting on resize\n * Debounced for performance\n */\n var resizeHandler = function (event) {\n // If there's a timer, cancel it\n if (timeout) {\n window.cancelAnimationFrame(timeout);\n }\n\n // Setup debounce callback\n timeout = window.requestAnimationFrame(function () {\n sortContents(contents);\n publicAPIs.detect();\n });\n };\n\n /**\n * Destroy the current instantiation\n */\n publicAPIs.destroy = function () {\n // Undo DOM changes\n if (current) {\n deactivate(current, settings);\n }\n\n // Remove event listeners\n window.removeEventListener(\"scroll\", scrollHandler, false);\n if (settings.reflow) {\n window.removeEventListener(\"resize\", resizeHandler, false);\n }\n\n // Reset variables\n contents = null;\n navItems = null;\n current = null;\n timeout = null;\n settings = null;\n };\n\n /**\n * Initialize the current instantiation\n */\n var init = function () {\n // Merge user options into defaults\n settings = extend(defaults, options || {});\n\n // Setup variables based on the current DOM\n publicAPIs.setup();\n\n // Find the currently active content\n publicAPIs.detect();\n\n // Setup event listeners\n window.addEventListener(\"scroll\", scrollHandler, false);\n if (settings.reflow) {\n window.addEventListener(\"resize\", resizeHandler, false);\n }\n };\n\n //\n // Initialize and return the public APIs\n //\n\n init();\n return publicAPIs;\n };\n\n //\n // Return the Constructor\n //\n\n return Constructor;\n },\n);\n","// The module cache\nvar __webpack_module_cache__ = {};\n\n// The require function\nfunction __webpack_require__(moduleId) {\n\t// Check if module is in cache\n\tvar cachedModule = __webpack_module_cache__[moduleId];\n\tif (cachedModule !== undefined) {\n\t\treturn cachedModule.exports;\n\t}\n\t// Create a new module (and put it into the cache)\n\tvar module = __webpack_module_cache__[moduleId] = {\n\t\t// no module.id needed\n\t\t// no module.loaded needed\n\t\texports: {}\n\t};\n\n\t// Execute the module function\n\t__webpack_modules__[moduleId].call(module.exports, module, module.exports, __webpack_require__);\n\n\t// Return the exports of the module\n\treturn module.exports;\n}\n\n","// getDefaultExport function for compatibility with non-harmony modules\n__webpack_require__.n = (module) => {\n\tvar getter = module && module.__esModule ?\n\t\t() => (module['default']) :\n\t\t() => (module);\n\t__webpack_require__.d(getter, { a: getter });\n\treturn getter;\n};","// define getter functions for harmony exports\n__webpack_require__.d = (exports, definition) => {\n\tfor(var key in definition) {\n\t\tif(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) {\n\t\t\tObject.defineProperty(exports, key, { enumerable: true, get: definition[key] });\n\t\t}\n\t}\n};","__webpack_require__.g = (function() {\n\tif (typeof globalThis === 'object') return globalThis;\n\ttry {\n\t\treturn this || new Function('return this')();\n\t} catch (e) {\n\t\tif (typeof window === 'object') return window;\n\t}\n})();","__webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop))","import Gumshoe from \"./gumshoe-patched.js\";\n\n////////////////////////////////////////////////////////////////////////////////\n// Scroll Handling\n////////////////////////////////////////////////////////////////////////////////\nvar tocScroll = null;\nvar header = null;\nvar lastScrollTop = document.documentElement.scrollTop;\nconst GO_TO_TOP_OFFSET = 64;\n\nfunction scrollHandlerForHeader(positionY) {\n if (positionY > 0) {\n header.classList.add(\"scrolled\");\n } else {\n header.classList.remove(\"scrolled\");\n }\n}\n\nfunction scrollHandlerForBackToTop(positionY) {\n if (positionY < GO_TO_TOP_OFFSET) {\n document.documentElement.classList.remove(\"show-back-to-top\");\n } else {\n if (positionY < lastScrollTop) {\n document.documentElement.classList.add(\"show-back-to-top\");\n } else if (positionY > lastScrollTop) {\n document.documentElement.classList.remove(\"show-back-to-top\");\n }\n }\n lastScrollTop = positionY;\n}\n\nfunction scrollHandlerForTOC(positionY) {\n if (tocScroll === null) {\n return;\n }\n\n // top of page.\n if (positionY == 0) {\n tocScroll.scrollTo(0, 0);\n } else if (\n // bottom of page.\n Math.ceil(positionY) >=\n Math.floor(document.documentElement.scrollHeight - window.innerHeight)\n ) {\n tocScroll.scrollTo(0, tocScroll.scrollHeight);\n } else {\n // somewhere in the middle.\n const current = document.querySelector(\".scroll-current\");\n if (current == null) {\n return;\n }\n\n // https://github.com/pypa/pip/issues/9159 This breaks scroll behaviours.\n // // scroll the currently \"active\" heading in toc, into view.\n // const rect = current.getBoundingClientRect();\n // if (0 > rect.top) {\n // current.scrollIntoView(true); // the argument is \"alignTop\"\n // } else if (rect.bottom > window.innerHeight) {\n // current.scrollIntoView(false);\n // }\n }\n}\n\nfunction scrollHandler(positionY) {\n scrollHandlerForHeader(positionY);\n scrollHandlerForBackToTop(positionY);\n scrollHandlerForTOC(positionY);\n}\n\n////////////////////////////////////////////////////////////////////////////////\n// Theme Toggle\n////////////////////////////////////////////////////////////////////////////////\nfunction setTheme(mode) {\n if (mode !== \"light\" && mode !== \"dark\" && mode !== \"auto\") {\n console.error(`Got invalid theme mode: ${mode}. Resetting to auto.`);\n mode = \"auto\";\n }\n\n document.body.dataset.theme = mode;\n localStorage.setItem(\"theme\", mode);\n console.log(`Changed to ${mode} mode.`);\n}\n\nfunction cycleThemeOnce() {\n const currentTheme = localStorage.getItem(\"theme\") || \"auto\";\n const prefersDark = window.matchMedia(\"(prefers-color-scheme: dark)\").matches;\n\n if (prefersDark) {\n // Auto (dark) -> Light -> Dark\n if (currentTheme === \"auto\") {\n setTheme(\"light\");\n } else if (currentTheme == \"light\") {\n setTheme(\"dark\");\n } else {\n setTheme(\"auto\");\n }\n } else {\n // Auto (light) -> Dark -> Light\n if (currentTheme === \"auto\") {\n setTheme(\"dark\");\n } else if (currentTheme == \"dark\") {\n setTheme(\"light\");\n } else {\n setTheme(\"auto\");\n }\n }\n}\n\n////////////////////////////////////////////////////////////////////////////////\n// Setup\n////////////////////////////////////////////////////////////////////////////////\nfunction setupScrollHandler() {\n // Taken from https://developer.mozilla.org/en-US/docs/Web/API/Document/scroll_event\n let last_known_scroll_position = 0;\n let ticking = false;\n\n window.addEventListener(\"scroll\", function (e) {\n last_known_scroll_position = window.scrollY;\n\n if (!ticking) {\n window.requestAnimationFrame(function () {\n scrollHandler(last_known_scroll_position);\n ticking = false;\n });\n\n ticking = true;\n }\n });\n window.scroll();\n}\n\nfunction setupScrollSpy() {\n if (tocScroll === null) {\n return;\n }\n\n // Scrollspy -- highlight table on contents, based on scroll\n new Gumshoe(\".toc-tree a\", {\n reflow: true,\n recursive: true,\n navClass: \"scroll-current\",\n offset: () => {\n let rem = parseFloat(getComputedStyle(document.documentElement).fontSize);\n const headerRect = header.getBoundingClientRect();\n return headerRect.top + headerRect.height + 2.5 * rem + 1;\n },\n });\n}\n\nfunction setupTheme() {\n // Attach event handlers for toggling themes\n const buttons = document.getElementsByClassName(\"theme-toggle\");\n Array.from(buttons).forEach((btn) => {\n btn.addEventListener(\"click\", cycleThemeOnce);\n });\n}\n\nfunction setup() {\n setupTheme();\n setupScrollHandler();\n setupScrollSpy();\n}\n\n////////////////////////////////////////////////////////////////////////////////\n// Main entrypoint\n////////////////////////////////////////////////////////////////////////////////\nfunction main() {\n document.body.parentNode.classList.remove(\"no-js\");\n\n header = document.querySelector(\"header\");\n tocScroll = document.querySelector(\".toc-scroll\");\n\n setup();\n}\n\ndocument.addEventListener(\"DOMContentLoaded\", main);\n"],"names":["root","g","window","this","defaults","navClass","contentClass","nested","nestedClass","offset","reflow","events","emitEvent","type","elem","detail","settings","event","CustomEvent","bubbles","cancelable","dispatchEvent","getOffsetTop","location","offsetParent","offsetTop","sortContents","contents","sort","item1","item2","content","isInView","bottom","bounds","getBoundingClientRect","parseFloat","getOffset","parseInt","innerHeight","document","documentElement","clientHeight","top","isAtBottom","Math","ceil","pageYOffset","max","body","scrollHeight","offsetHeight","getActive","last","length","item","useLastItem","i","deactivateNested","nav","parentNode","li","closest","classList","remove","deactivate","items","link","activateNested","add","selector","options","navItems","current","timeout","publicAPIs","querySelectorAll","Array","prototype","forEach","call","getElementById","decodeURIComponent","hash","substr","push","active","activate","scrollHandler","cancelAnimationFrame","requestAnimationFrame","detect","resizeHandler","destroy","removeEventListener","merged","arguments","obj","key","hasOwnProperty","extend","setup","addEventListener","factory","__webpack_module_cache__","__webpack_require__","moduleId","cachedModule","undefined","exports","module","__webpack_modules__","n","getter","__esModule","d","a","definition","o","Object","defineProperty","enumerable","get","globalThis","Function","e","prop","tocScroll","header","lastScrollTop","scrollTop","cycleThemeOnce","currentTheme","localStorage","getItem","mode","matchMedia","matches","console","error","dataset","theme","setItem","log","buttons","getElementsByClassName","from","btn","setupTheme","last_known_scroll_position","ticking","scrollY","positionY","scrollHandlerForHeader","scrollHandlerForBackToTop","scrollTo","floor","querySelector","scrollHandlerForTOC","scroll","setupScrollHandler","recursive","rem","getComputedStyle","fontSize","headerRect","height"],"sourceRoot":""} \ No newline at end of file diff --git a/_static/searchtools.js b/_static/searchtools.js new file mode 100644 index 0000000..91f4be5 --- /dev/null +++ b/_static/searchtools.js @@ -0,0 +1,635 @@ +/* + * Sphinx JavaScript utilities for the full-text search. + */ +"use strict"; + +/** + * Simple result scoring code. + */ +if (typeof Scorer === "undefined") { + var Scorer = { + // Implement the following function to further tweak the score for each result + // The function takes a result array [docname, title, anchor, descr, score, filename] + // and returns the new score. + /* + score: result => { + const [docname, title, anchor, descr, score, filename, kind] = result + return score + }, + */ + + // query matches the full name of an object + objNameMatch: 11, + // or matches in the last dotted part of the object name + objPartialMatch: 6, + // Additive scores depending on the priority of the object + objPrio: { + 0: 15, // used to be importantResults + 1: 5, // used to be objectResults + 2: -5, // used to be unimportantResults + }, + // Used when the priority is not in the mapping. + objPrioDefault: 0, + + // query found in title + title: 15, + partialTitle: 7, + // query found in terms + term: 5, + partialTerm: 2, + }; +} + +// Global search result kind enum, used by themes to style search results. +class SearchResultKind { + static get index() { return "index"; } + static get object() { return "object"; } + static get text() { return "text"; } + static get title() { return "title"; } +} + +const _removeChildren = (element) => { + while (element && element.lastChild) element.removeChild(element.lastChild); +}; + +/** + * See https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Regular_Expressions#escaping + */ +const _escapeRegExp = (string) => + string.replace(/[.*+\-?^${}()|[\]\\]/g, "\\$&"); // $& means the whole matched string + +const _displayItem = (item, searchTerms, highlightTerms) => { + const docBuilder = DOCUMENTATION_OPTIONS.BUILDER; + const docFileSuffix = DOCUMENTATION_OPTIONS.FILE_SUFFIX; + const docLinkSuffix = DOCUMENTATION_OPTIONS.LINK_SUFFIX; + const showSearchSummary = DOCUMENTATION_OPTIONS.SHOW_SEARCH_SUMMARY; + const contentRoot = document.documentElement.dataset.content_root; + + const [docName, title, anchor, descr, score, _filename, kind] = item; + + let listItem = document.createElement("li"); + // Add a class representing the item's type: + // can be used by a theme's CSS selector for styling + // See SearchResultKind for the class names. + listItem.classList.add(`kind-${kind}`); + let requestUrl; + let linkUrl; + if (docBuilder === "dirhtml") { + // dirhtml builder + let dirname = docName + "/"; + if (dirname.match(/\/index\/$/)) + dirname = dirname.substring(0, dirname.length - 6); + else if (dirname === "index/") dirname = ""; + requestUrl = contentRoot + dirname; + linkUrl = requestUrl; + } else { + // normal html builders + requestUrl = contentRoot + docName + docFileSuffix; + linkUrl = docName + docLinkSuffix; + } + let linkEl = listItem.appendChild(document.createElement("a")); + linkEl.href = linkUrl + anchor; + linkEl.dataset.score = score; + linkEl.innerHTML = title; + if (descr) { + listItem.appendChild(document.createElement("span")).innerHTML = + " (" + descr + ")"; + // highlight search terms in the description + if (SPHINX_HIGHLIGHT_ENABLED) // set in sphinx_highlight.js + highlightTerms.forEach((term) => _highlightText(listItem, term, "highlighted")); + } + else if (showSearchSummary) + fetch(requestUrl) + .then((responseData) => responseData.text()) + .then((data) => { + if (data) + listItem.appendChild( + Search.makeSearchSummary(data, searchTerms, anchor) + ); + // highlight search terms in the summary + if (SPHINX_HIGHLIGHT_ENABLED) // set in sphinx_highlight.js + highlightTerms.forEach((term) => _highlightText(listItem, term, "highlighted")); + }); + Search.output.appendChild(listItem); +}; +const _finishSearch = (resultCount) => { + Search.stopPulse(); + Search.title.innerText = _("Search Results"); + if (!resultCount) + Search.status.innerText = Documentation.gettext( + "Your search did not match any documents. Please make sure that all words are spelled correctly and that you've selected enough categories." + ); + else + Search.status.innerText = Documentation.ngettext( + "Search finished, found one page matching the search query.", + "Search finished, found ${resultCount} pages matching the search query.", + resultCount, + ).replace('${resultCount}', resultCount); +}; +const _displayNextItem = ( + results, + resultCount, + searchTerms, + highlightTerms, +) => { + // results left, load the summary and display it + // this is intended to be dynamic (don't sub resultsCount) + if (results.length) { + _displayItem(results.pop(), searchTerms, highlightTerms); + setTimeout( + () => _displayNextItem(results, resultCount, searchTerms, highlightTerms), + 5 + ); + } + // search finished, update title and status message + else _finishSearch(resultCount); +}; +// Helper function used by query() to order search results. +// Each input is an array of [docname, title, anchor, descr, score, filename, kind]. +// Order the results by score (in opposite order of appearance, since the +// `_displayNextItem` function uses pop() to retrieve items) and then alphabetically. +const _orderResultsByScoreThenName = (a, b) => { + const leftScore = a[4]; + const rightScore = b[4]; + if (leftScore === rightScore) { + // same score: sort alphabetically + const leftTitle = a[1].toLowerCase(); + const rightTitle = b[1].toLowerCase(); + if (leftTitle === rightTitle) return 0; + return leftTitle > rightTitle ? -1 : 1; // inverted is intentional + } + return leftScore > rightScore ? 1 : -1; +}; + +/** + * Default splitQuery function. Can be overridden in ``sphinx.search`` with a + * custom function per language. + * + * The regular expression works by splitting the string on consecutive characters + * that are not Unicode letters, numbers, underscores, or emoji characters. + * This is the same as ``\W+`` in Python, preserving the surrogate pair area. + */ +if (typeof splitQuery === "undefined") { + var splitQuery = (query) => query + .split(/[^\p{Letter}\p{Number}_\p{Emoji_Presentation}]+/gu) + .filter(term => term) // remove remaining empty strings +} + +/** + * Search Module + */ +const Search = { + _index: null, + _queued_query: null, + _pulse_status: -1, + + htmlToText: (htmlString, anchor) => { + const htmlElement = new DOMParser().parseFromString(htmlString, 'text/html'); + for (const removalQuery of [".headerlink", "script", "style"]) { + htmlElement.querySelectorAll(removalQuery).forEach((el) => { el.remove() }); + } + if (anchor) { + const anchorContent = htmlElement.querySelector(`[role="main"] ${anchor}`); + if (anchorContent) return anchorContent.textContent; + + console.warn( + `Anchored content block not found. Sphinx search tries to obtain it via DOM query '[role=main] ${anchor}'. Check your theme or template.` + ); + } + + // if anchor not specified or not found, fall back to main content + const docContent = htmlElement.querySelector('[role="main"]'); + if (docContent) return docContent.textContent; + + console.warn( + "Content block not found. Sphinx search tries to obtain it via DOM query '[role=main]'. Check your theme or template." + ); + return ""; + }, + + init: () => { + const query = new URLSearchParams(window.location.search).get("q"); + document + .querySelectorAll('input[name="q"]') + .forEach((el) => (el.value = query)); + if (query) Search.performSearch(query); + }, + + loadIndex: (url) => + (document.body.appendChild(document.createElement("script")).src = url), + + setIndex: (index) => { + Search._index = index; + if (Search._queued_query !== null) { + const query = Search._queued_query; + Search._queued_query = null; + Search.query(query); + } + }, + + hasIndex: () => Search._index !== null, + + deferQuery: (query) => (Search._queued_query = query), + + stopPulse: () => (Search._pulse_status = -1), + + startPulse: () => { + if (Search._pulse_status >= 0) return; + + const pulse = () => { + Search._pulse_status = (Search._pulse_status + 1) % 4; + Search.dots.innerText = ".".repeat(Search._pulse_status); + if (Search._pulse_status >= 0) window.setTimeout(pulse, 500); + }; + pulse(); + }, + + /** + * perform a search for something (or wait until index is loaded) + */ + performSearch: (query) => { + // create the required interface elements + const searchText = document.createElement("h2"); + searchText.textContent = _("Searching"); + const searchSummary = document.createElement("p"); + searchSummary.classList.add("search-summary"); + searchSummary.innerText = ""; + const searchList = document.createElement("ul"); + searchList.setAttribute("role", "list"); + searchList.classList.add("search"); + + const out = document.getElementById("search-results"); + Search.title = out.appendChild(searchText); + Search.dots = Search.title.appendChild(document.createElement("span")); + Search.status = out.appendChild(searchSummary); + Search.output = out.appendChild(searchList); + + const searchProgress = document.getElementById("search-progress"); + // Some themes don't use the search progress node + if (searchProgress) { + searchProgress.innerText = _("Preparing search..."); + } + Search.startPulse(); + + // index already loaded, the browser was quick! + if (Search.hasIndex()) Search.query(query); + else Search.deferQuery(query); + }, + + _parseQuery: (query) => { + // stem the search terms and add them to the correct list + const stemmer = new Stemmer(); + const searchTerms = new Set(); + const excludedTerms = new Set(); + const highlightTerms = new Set(); + const objectTerms = new Set(splitQuery(query.toLowerCase().trim())); + splitQuery(query.trim()).forEach((queryTerm) => { + const queryTermLower = queryTerm.toLowerCase(); + + // maybe skip this "word" + // stopwords array is from language_data.js + if ( + stopwords.indexOf(queryTermLower) !== -1 || + queryTerm.match(/^\d+$/) + ) + return; + + // stem the word + let word = stemmer.stemWord(queryTermLower); + // select the correct list + if (word[0] === "-") excludedTerms.add(word.substr(1)); + else { + searchTerms.add(word); + highlightTerms.add(queryTermLower); + } + }); + + if (SPHINX_HIGHLIGHT_ENABLED) { // set in sphinx_highlight.js + localStorage.setItem("sphinx_highlight_terms", [...highlightTerms].join(" ")) + } + + // console.debug("SEARCH: searching for:"); + // console.info("required: ", [...searchTerms]); + // console.info("excluded: ", [...excludedTerms]); + + return [query, searchTerms, excludedTerms, highlightTerms, objectTerms]; + }, + + /** + * execute search (requires search index to be loaded) + */ + _performSearch: (query, searchTerms, excludedTerms, highlightTerms, objectTerms) => { + const filenames = Search._index.filenames; + const docNames = Search._index.docnames; + const titles = Search._index.titles; + const allTitles = Search._index.alltitles; + const indexEntries = Search._index.indexentries; + + // Collect multiple result groups to be sorted separately and then ordered. + // Each is an array of [docname, title, anchor, descr, score, filename, kind]. + const normalResults = []; + const nonMainIndexResults = []; + + _removeChildren(document.getElementById("search-progress")); + + const queryLower = query.toLowerCase().trim(); + for (const [title, foundTitles] of Object.entries(allTitles)) { + if (title.toLowerCase().trim().includes(queryLower) && (queryLower.length >= title.length/2)) { + for (const [file, id] of foundTitles) { + const score = Math.round(Scorer.title * queryLower.length / title.length); + const boost = titles[file] === title ? 1 : 0; // add a boost for document titles + normalResults.push([ + docNames[file], + titles[file] !== title ? `${titles[file]} > ${title}` : title, + id !== null ? "#" + id : "", + null, + score + boost, + filenames[file], + SearchResultKind.title, + ]); + } + } + } + + // search for explicit entries in index directives + for (const [entry, foundEntries] of Object.entries(indexEntries)) { + if (entry.includes(queryLower) && (queryLower.length >= entry.length/2)) { + for (const [file, id, isMain] of foundEntries) { + const score = Math.round(100 * queryLower.length / entry.length); + const result = [ + docNames[file], + titles[file], + id ? "#" + id : "", + null, + score, + filenames[file], + SearchResultKind.index, + ]; + if (isMain) { + normalResults.push(result); + } else { + nonMainIndexResults.push(result); + } + } + } + } + + // lookup as object + objectTerms.forEach((term) => + normalResults.push(...Search.performObjectSearch(term, objectTerms)) + ); + + // lookup as search terms in fulltext + normalResults.push(...Search.performTermsSearch(searchTerms, excludedTerms)); + + // let the scorer override scores with a custom scoring function + if (Scorer.score) { + normalResults.forEach((item) => (item[4] = Scorer.score(item))); + nonMainIndexResults.forEach((item) => (item[4] = Scorer.score(item))); + } + + // Sort each group of results by score and then alphabetically by name. + normalResults.sort(_orderResultsByScoreThenName); + nonMainIndexResults.sort(_orderResultsByScoreThenName); + + // Combine the result groups in (reverse) order. + // Non-main index entries are typically arbitrary cross-references, + // so display them after other results. + let results = [...nonMainIndexResults, ...normalResults]; + + // remove duplicate search results + // note the reversing of results, so that in the case of duplicates, the highest-scoring entry is kept + let seen = new Set(); + results = results.reverse().reduce((acc, result) => { + let resultStr = result.slice(0, 4).concat([result[5]]).map(v => String(v)).join(','); + if (!seen.has(resultStr)) { + acc.push(result); + seen.add(resultStr); + } + return acc; + }, []); + + return results.reverse(); + }, + + query: (query) => { + const [searchQuery, searchTerms, excludedTerms, highlightTerms, objectTerms] = Search._parseQuery(query); + const results = Search._performSearch(searchQuery, searchTerms, excludedTerms, highlightTerms, objectTerms); + + // for debugging + //Search.lastresults = results.slice(); // a copy + // console.info("search results:", Search.lastresults); + + // print the results + _displayNextItem(results, results.length, searchTerms, highlightTerms); + }, + + /** + * search for object names + */ + performObjectSearch: (object, objectTerms) => { + const filenames = Search._index.filenames; + const docNames = Search._index.docnames; + const objects = Search._index.objects; + const objNames = Search._index.objnames; + const titles = Search._index.titles; + + const results = []; + + const objectSearchCallback = (prefix, match) => { + const name = match[4] + const fullname = (prefix ? prefix + "." : "") + name; + const fullnameLower = fullname.toLowerCase(); + if (fullnameLower.indexOf(object) < 0) return; + + let score = 0; + const parts = fullnameLower.split("."); + + // check for different match types: exact matches of full name or + // "last name" (i.e. last dotted part) + if (fullnameLower === object || parts.slice(-1)[0] === object) + score += Scorer.objNameMatch; + else if (parts.slice(-1)[0].indexOf(object) > -1) + score += Scorer.objPartialMatch; // matches in last name + + const objName = objNames[match[1]][2]; + const title = titles[match[0]]; + + // If more than one term searched for, we require other words to be + // found in the name/title/description + const otherTerms = new Set(objectTerms); + otherTerms.delete(object); + if (otherTerms.size > 0) { + const haystack = `${prefix} ${name} ${objName} ${title}`.toLowerCase(); + if ( + [...otherTerms].some((otherTerm) => haystack.indexOf(otherTerm) < 0) + ) + return; + } + + let anchor = match[3]; + if (anchor === "") anchor = fullname; + else if (anchor === "-") anchor = objNames[match[1]][1] + "-" + fullname; + + const descr = objName + _(", in ") + title; + + // add custom score for some objects according to scorer + if (Scorer.objPrio.hasOwnProperty(match[2])) + score += Scorer.objPrio[match[2]]; + else score += Scorer.objPrioDefault; + + results.push([ + docNames[match[0]], + fullname, + "#" + anchor, + descr, + score, + filenames[match[0]], + SearchResultKind.object, + ]); + }; + Object.keys(objects).forEach((prefix) => + objects[prefix].forEach((array) => + objectSearchCallback(prefix, array) + ) + ); + return results; + }, + + /** + * search for full-text terms in the index + */ + performTermsSearch: (searchTerms, excludedTerms) => { + // prepare search + const terms = Search._index.terms; + const titleTerms = Search._index.titleterms; + const filenames = Search._index.filenames; + const docNames = Search._index.docnames; + const titles = Search._index.titles; + + const scoreMap = new Map(); + const fileMap = new Map(); + + // perform the search on the required terms + searchTerms.forEach((word) => { + const files = []; + // find documents, if any, containing the query word in their text/title term indices + // use Object.hasOwnProperty to avoid mismatching against prototype properties + const arr = [ + { files: terms.hasOwnProperty(word) ? terms[word] : undefined, score: Scorer.term }, + { files: titleTerms.hasOwnProperty(word) ? titleTerms[word] : undefined, score: Scorer.title }, + ]; + // add support for partial matches + if (word.length > 2) { + const escapedWord = _escapeRegExp(word); + if (!terms.hasOwnProperty(word)) { + Object.keys(terms).forEach((term) => { + if (term.match(escapedWord)) + arr.push({ files: terms[term], score: Scorer.partialTerm }); + }); + } + if (!titleTerms.hasOwnProperty(word)) { + Object.keys(titleTerms).forEach((term) => { + if (term.match(escapedWord)) + arr.push({ files: titleTerms[term], score: Scorer.partialTitle }); + }); + } + } + + // no match but word was a required one + if (arr.every((record) => record.files === undefined)) return; + + // found search word in contents + arr.forEach((record) => { + if (record.files === undefined) return; + + let recordFiles = record.files; + if (recordFiles.length === undefined) recordFiles = [recordFiles]; + files.push(...recordFiles); + + // set score for the word in each file + recordFiles.forEach((file) => { + if (!scoreMap.has(file)) scoreMap.set(file, new Map()); + const fileScores = scoreMap.get(file); + fileScores.set(word, record.score); + }); + }); + + // create the mapping + files.forEach((file) => { + if (!fileMap.has(file)) fileMap.set(file, [word]); + else if (fileMap.get(file).indexOf(word) === -1) fileMap.get(file).push(word); + }); + }); + + // now check if the files don't contain excluded terms + const results = []; + for (const [file, wordList] of fileMap) { + // check if all requirements are matched + + // as search terms with length < 3 are discarded + const filteredTermCount = [...searchTerms].filter( + (term) => term.length > 2 + ).length; + if ( + wordList.length !== searchTerms.size && + wordList.length !== filteredTermCount + ) + continue; + + // ensure that none of the excluded terms is in the search result + if ( + [...excludedTerms].some( + (term) => + terms[term] === file || + titleTerms[term] === file || + (terms[term] || []).includes(file) || + (titleTerms[term] || []).includes(file) + ) + ) + break; + + // select one (max) score for the file. + const score = Math.max(...wordList.map((w) => scoreMap.get(file).get(w))); + // add result to the result list + results.push([ + docNames[file], + titles[file], + "", + null, + score, + filenames[file], + SearchResultKind.text, + ]); + } + return results; + }, + + /** + * helper function to return a node containing the + * search summary for a given text. keywords is a list + * of stemmed words. + */ + makeSearchSummary: (htmlText, keywords, anchor) => { + const text = Search.htmlToText(htmlText, anchor); + if (text === "") return null; + + const textLower = text.toLowerCase(); + const actualStartPosition = [...keywords] + .map((k) => textLower.indexOf(k.toLowerCase())) + .filter((i) => i > -1) + .slice(-1)[0]; + const startWithContext = Math.max(actualStartPosition - 120, 0); + + const top = startWithContext === 0 ? "" : "..."; + const tail = startWithContext + 240 < text.length ? "..." : ""; + + let summary = document.createElement("p"); + summary.classList.add("context"); + summary.textContent = top + text.substr(startWithContext, 240).trim() + tail; + + return summary; + }, +}; + +_ready(Search.init); diff --git a/_static/skeleton.css b/_static/skeleton.css new file mode 100644 index 0000000..467c878 --- /dev/null +++ b/_static/skeleton.css @@ -0,0 +1,296 @@ +/* Some sane resets. */ +html { + height: 100%; +} + +body { + margin: 0; + min-height: 100%; +} + +/* All the flexbox magic! */ +body, +.sb-announcement, +.sb-content, +.sb-main, +.sb-container, +.sb-container__inner, +.sb-article-container, +.sb-footer-content, +.sb-header, +.sb-header-secondary, +.sb-footer { + display: flex; +} + +/* These order things vertically */ +body, +.sb-main, +.sb-article-container { + flex-direction: column; +} + +/* Put elements in the center */ +.sb-header, +.sb-header-secondary, +.sb-container, +.sb-content, +.sb-footer, +.sb-footer-content { + justify-content: center; +} +/* Put elements at the ends */ +.sb-article-container { + justify-content: space-between; +} + +/* These elements grow. */ +.sb-main, +.sb-content, +.sb-container, +article { + flex-grow: 1; +} + +/* Because padding making this wider is not fun */ +article { + box-sizing: border-box; +} + +/* The announcements element should never be wider than the page. */ +.sb-announcement { + max-width: 100%; +} + +.sb-sidebar-primary, +.sb-sidebar-secondary { + flex-shrink: 0; + width: 17rem; +} + +.sb-announcement__inner { + justify-content: center; + + box-sizing: border-box; + height: 3rem; + + overflow-x: auto; + white-space: nowrap; +} + +/* Sidebars, with checkbox-based toggle */ +.sb-sidebar-primary, +.sb-sidebar-secondary { + position: fixed; + height: 100%; + top: 0; +} + +.sb-sidebar-primary { + left: -17rem; + transition: left 250ms ease-in-out; +} +.sb-sidebar-secondary { + right: -17rem; + transition: right 250ms ease-in-out; +} + +.sb-sidebar-toggle { + display: none; +} +.sb-sidebar-overlay { + position: fixed; + top: 0; + width: 0; + height: 0; + + transition: width 0ms ease 250ms, height 0ms ease 250ms, opacity 250ms ease; + + opacity: 0; + background-color: rgba(0, 0, 0, 0.54); +} + +#sb-sidebar-toggle--primary:checked + ~ .sb-sidebar-overlay[for="sb-sidebar-toggle--primary"], +#sb-sidebar-toggle--secondary:checked + ~ .sb-sidebar-overlay[for="sb-sidebar-toggle--secondary"] { + width: 100%; + height: 100%; + opacity: 1; + transition: width 0ms ease, height 0ms ease, opacity 250ms ease; +} + +#sb-sidebar-toggle--primary:checked ~ .sb-container .sb-sidebar-primary { + left: 0; +} +#sb-sidebar-toggle--secondary:checked ~ .sb-container .sb-sidebar-secondary { + right: 0; +} + +/* Full-width mode */ +.drop-secondary-sidebar-for-full-width-content + .hide-when-secondary-sidebar-shown { + display: none !important; +} +.drop-secondary-sidebar-for-full-width-content .sb-sidebar-secondary { + display: none !important; +} + +/* Mobile views */ +.sb-page-width { + width: 100%; +} + +.sb-article-container, +.sb-footer-content__inner, +.drop-secondary-sidebar-for-full-width-content .sb-article, +.drop-secondary-sidebar-for-full-width-content .match-content-width { + width: 100vw; +} + +.sb-article, +.match-content-width { + padding: 0 1rem; + box-sizing: border-box; +} + +@media (min-width: 32rem) { + .sb-article, + .match-content-width { + padding: 0 2rem; + } +} + +/* Tablet views */ +@media (min-width: 42rem) { + .sb-article-container { + width: auto; + } + .sb-footer-content__inner, + .drop-secondary-sidebar-for-full-width-content .sb-article, + .drop-secondary-sidebar-for-full-width-content .match-content-width { + width: 42rem; + } + .sb-article, + .match-content-width { + width: 42rem; + } +} +@media (min-width: 46rem) { + .sb-footer-content__inner, + .drop-secondary-sidebar-for-full-width-content .sb-article, + .drop-secondary-sidebar-for-full-width-content .match-content-width { + width: 46rem; + } + .sb-article, + .match-content-width { + width: 46rem; + } +} +@media (min-width: 50rem) { + .sb-footer-content__inner, + .drop-secondary-sidebar-for-full-width-content .sb-article, + .drop-secondary-sidebar-for-full-width-content .match-content-width { + width: 50rem; + } + .sb-article, + .match-content-width { + width: 50rem; + } +} + +/* Tablet views */ +@media (min-width: 59rem) { + .sb-sidebar-secondary { + position: static; + } + .hide-when-secondary-sidebar-shown { + display: none !important; + } + .sb-footer-content__inner, + .drop-secondary-sidebar-for-full-width-content .sb-article, + .drop-secondary-sidebar-for-full-width-content .match-content-width { + width: 59rem; + } + .sb-article, + .match-content-width { + width: 42rem; + } +} +@media (min-width: 63rem) { + .sb-footer-content__inner, + .drop-secondary-sidebar-for-full-width-content .sb-article, + .drop-secondary-sidebar-for-full-width-content .match-content-width { + width: 63rem; + } + .sb-article, + .match-content-width { + width: 46rem; + } +} +@media (min-width: 67rem) { + .sb-footer-content__inner, + .drop-secondary-sidebar-for-full-width-content .sb-article, + .drop-secondary-sidebar-for-full-width-content .match-content-width { + width: 67rem; + } + .sb-article, + .match-content-width { + width: 50rem; + } +} + +/* Desktop views */ +@media (min-width: 76rem) { + .sb-sidebar-primary { + position: static; + } + .hide-when-primary-sidebar-shown { + display: none !important; + } + .sb-footer-content__inner, + .drop-secondary-sidebar-for-full-width-content .sb-article, + .drop-secondary-sidebar-for-full-width-content .match-content-width { + width: 59rem; + } + .sb-article, + .match-content-width { + width: 42rem; + } +} + +/* Full desktop views */ +@media (min-width: 80rem) { + .sb-article, + .match-content-width { + width: 46rem; + } + .sb-footer-content__inner, + .drop-secondary-sidebar-for-full-width-content .sb-article, + .drop-secondary-sidebar-for-full-width-content .match-content-width { + width: 63rem; + } +} + +@media (min-width: 84rem) { + .sb-article, + .match-content-width { + width: 50rem; + } + .sb-footer-content__inner, + .drop-secondary-sidebar-for-full-width-content .sb-article, + .drop-secondary-sidebar-for-full-width-content .match-content-width { + width: 67rem; + } +} + +@media (min-width: 88rem) { + .sb-footer-content__inner, + .drop-secondary-sidebar-for-full-width-content .sb-article, + .drop-secondary-sidebar-for-full-width-content .match-content-width { + width: 67rem; + } + .sb-page-width { + width: 88rem; + } +} diff --git a/_static/sphinx_highlight.js b/_static/sphinx_highlight.js new file mode 100644 index 0000000..8a96c69 --- /dev/null +++ b/_static/sphinx_highlight.js @@ -0,0 +1,154 @@ +/* Highlighting utilities for Sphinx HTML documentation. */ +"use strict"; + +const SPHINX_HIGHLIGHT_ENABLED = true + +/** + * highlight a given string on a node by wrapping it in + * span elements with the given class name. + */ +const _highlight = (node, addItems, text, className) => { + if (node.nodeType === Node.TEXT_NODE) { + const val = node.nodeValue; + const parent = node.parentNode; + const pos = val.toLowerCase().indexOf(text); + if ( + pos >= 0 && + !parent.classList.contains(className) && + !parent.classList.contains("nohighlight") + ) { + let span; + + const closestNode = parent.closest("body, svg, foreignObject"); + const isInSVG = closestNode && closestNode.matches("svg"); + if (isInSVG) { + span = document.createElementNS("http://www.w3.org/2000/svg", "tspan"); + } else { + span = document.createElement("span"); + span.classList.add(className); + } + + span.appendChild(document.createTextNode(val.substr(pos, text.length))); + const rest = document.createTextNode(val.substr(pos + text.length)); + parent.insertBefore( + span, + parent.insertBefore( + rest, + node.nextSibling + ) + ); + node.nodeValue = val.substr(0, pos); + /* There may be more occurrences of search term in this node. So call this + * function recursively on the remaining fragment. + */ + _highlight(rest, addItems, text, className); + + if (isInSVG) { + const rect = document.createElementNS( + "http://www.w3.org/2000/svg", + "rect" + ); + const bbox = parent.getBBox(); + rect.x.baseVal.value = bbox.x; + rect.y.baseVal.value = bbox.y; + rect.width.baseVal.value = bbox.width; + rect.height.baseVal.value = bbox.height; + rect.setAttribute("class", className); + addItems.push({ parent: parent, target: rect }); + } + } + } else if (node.matches && !node.matches("button, select, textarea")) { + node.childNodes.forEach((el) => _highlight(el, addItems, text, className)); + } +}; +const _highlightText = (thisNode, text, className) => { + let addItems = []; + _highlight(thisNode, addItems, text, className); + addItems.forEach((obj) => + obj.parent.insertAdjacentElement("beforebegin", obj.target) + ); +}; + +/** + * Small JavaScript module for the documentation. + */ +const SphinxHighlight = { + + /** + * highlight the search words provided in localstorage in the text + */ + highlightSearchWords: () => { + if (!SPHINX_HIGHLIGHT_ENABLED) return; // bail if no highlight + + // get and clear terms from localstorage + const url = new URL(window.location); + const highlight = + localStorage.getItem("sphinx_highlight_terms") + || url.searchParams.get("highlight") + || ""; + localStorage.removeItem("sphinx_highlight_terms") + url.searchParams.delete("highlight"); + window.history.replaceState({}, "", url); + + // get individual terms from highlight string + const terms = highlight.toLowerCase().split(/\s+/).filter(x => x); + if (terms.length === 0) return; // nothing to do + + // There should never be more than one element matching "div.body" + const divBody = document.querySelectorAll("div.body"); + const body = divBody.length ? divBody[0] : document.querySelector("body"); + window.setTimeout(() => { + terms.forEach((term) => _highlightText(body, term, "highlighted")); + }, 10); + + const searchBox = document.getElementById("searchbox"); + if (searchBox === null) return; + searchBox.appendChild( + document + .createRange() + .createContextualFragment( + '" + ) + ); + }, + + /** + * helper function to hide the search marks again + */ + hideSearchWords: () => { + document + .querySelectorAll("#searchbox .highlight-link") + .forEach((el) => el.remove()); + document + .querySelectorAll("span.highlighted") + .forEach((el) => el.classList.remove("highlighted")); + localStorage.removeItem("sphinx_highlight_terms") + }, + + initEscapeListener: () => { + // only install a listener if it is really needed + if (!DOCUMENTATION_OPTIONS.ENABLE_SEARCH_SHORTCUTS) return; + + document.addEventListener("keydown", (event) => { + // bail for input elements + if (BLACKLISTED_KEY_CONTROL_ELEMENTS.has(document.activeElement.tagName)) return; + // bail with special keys + if (event.shiftKey || event.altKey || event.ctrlKey || event.metaKey) return; + if (DOCUMENTATION_OPTIONS.ENABLE_SEARCH_SHORTCUTS && (event.key === "Escape")) { + SphinxHighlight.hideSearchWords(); + event.preventDefault(); + } + }); + }, +}; + +_ready(() => { + /* Do not call highlightSearchWords() when we are on the search page. + * It will highlight words from the *previous* search query. + */ + if (typeof Search === "undefined") SphinxHighlight.highlightSearchWords(); + SphinxHighlight.initEscapeListener(); +}); diff --git a/_static/styles/furo-extensions.css b/_static/styles/furo-extensions.css new file mode 100644 index 0000000..2d74267 --- /dev/null +++ b/_static/styles/furo-extensions.css @@ -0,0 +1,2 @@ +#furo-sidebar-ad-placement{padding:var(--sidebar-item-spacing-vertical) var(--sidebar-item-spacing-horizontal)}#furo-sidebar-ad-placement .ethical-sidebar{background:var(--color-background-secondary);border:none;box-shadow:none}#furo-sidebar-ad-placement .ethical-sidebar:hover{background:var(--color-background-hover)}#furo-sidebar-ad-placement .ethical-sidebar a{color:var(--color-foreground-primary)}#furo-sidebar-ad-placement .ethical-callout a{color:var(--color-foreground-secondary)!important}#furo-readthedocs-versions{background:transparent;display:block;position:static;width:100%}#furo-readthedocs-versions .rst-versions{background:#1a1c1e}#furo-readthedocs-versions .rst-current-version{background:var(--color-sidebar-item-background);cursor:unset}#furo-readthedocs-versions .rst-current-version:hover{background:var(--color-sidebar-item-background)}#furo-readthedocs-versions .rst-current-version .fa-book{color:var(--color-foreground-primary)}#furo-readthedocs-versions>.rst-other-versions{padding:0}#furo-readthedocs-versions>.rst-other-versions small{opacity:1}#furo-readthedocs-versions .injected .rst-versions{position:unset}#furo-readthedocs-versions:focus-within,#furo-readthedocs-versions:hover{box-shadow:0 0 0 1px var(--color-sidebar-background-border)}#furo-readthedocs-versions:focus-within .rst-current-version,#furo-readthedocs-versions:hover .rst-current-version{background:#1a1c1e;font-size:inherit;height:auto;line-height:inherit;padding:12px;text-align:right}#furo-readthedocs-versions:focus-within .rst-current-version .fa-book,#furo-readthedocs-versions:hover .rst-current-version .fa-book{color:#fff;float:left}#furo-readthedocs-versions:focus-within .fa-caret-down,#furo-readthedocs-versions:hover .fa-caret-down{display:none}#furo-readthedocs-versions:focus-within .injected,#furo-readthedocs-versions:focus-within .rst-current-version,#furo-readthedocs-versions:focus-within .rst-other-versions,#furo-readthedocs-versions:hover .injected,#furo-readthedocs-versions:hover .rst-current-version,#furo-readthedocs-versions:hover .rst-other-versions{display:block}#furo-readthedocs-versions:focus-within>.rst-current-version,#furo-readthedocs-versions:hover>.rst-current-version{display:none}.highlight:hover button.copybtn{color:var(--color-code-foreground)}.highlight button.copybtn{align-items:center;background-color:var(--color-code-background);border:none;color:var(--color-background-item);cursor:pointer;height:1.25em;right:.5rem;top:.625rem;transition:color .3s,opacity .3s;width:1.25em}.highlight button.copybtn:hover{background-color:var(--color-code-background);color:var(--color-brand-content)}.highlight button.copybtn:after{background-color:transparent;color:var(--color-code-foreground);display:none}.highlight button.copybtn.success{color:#22863a;transition:color 0s}.highlight button.copybtn.success:after{display:block}.highlight button.copybtn svg{padding:0}body{--sd-color-primary:var(--color-brand-primary);--sd-color-primary-highlight:var(--color-brand-content);--sd-color-primary-text:var(--color-background-primary);--sd-color-shadow:rgba(0,0,0,.05);--sd-color-card-border:var(--color-card-border);--sd-color-card-border-hover:var(--color-brand-content);--sd-color-card-background:var(--color-card-background);--sd-color-card-text:var(--color-foreground-primary);--sd-color-card-header:var(--color-card-marginals-background);--sd-color-card-footer:var(--color-card-marginals-background);--sd-color-tabs-label-active:var(--color-brand-content);--sd-color-tabs-label-hover:var(--color-foreground-muted);--sd-color-tabs-label-inactive:var(--color-foreground-muted);--sd-color-tabs-underline-active:var(--color-brand-content);--sd-color-tabs-underline-hover:var(--color-foreground-border);--sd-color-tabs-underline-inactive:var(--color-background-border);--sd-color-tabs-overline:var(--color-background-border);--sd-color-tabs-underline:var(--color-background-border)}.sd-tab-content{box-shadow:0 -2px var(--sd-color-tabs-overline),0 1px var(--sd-color-tabs-underline)}.sd-card{box-shadow:0 .1rem .25rem var(--sd-color-shadow),0 0 .0625rem rgba(0,0,0,.1)}.sd-shadow-sm{box-shadow:0 .1rem .25rem var(--sd-color-shadow),0 0 .0625rem rgba(0,0,0,.1)!important}.sd-shadow-md{box-shadow:0 .3rem .75rem var(--sd-color-shadow),0 0 .0625rem rgba(0,0,0,.1)!important}.sd-shadow-lg{box-shadow:0 .6rem 1.5rem var(--sd-color-shadow),0 0 .0625rem rgba(0,0,0,.1)!important}.sd-card-hover:hover{transform:none}.sd-cards-carousel{gap:.25rem;padding:.25rem}body{--tabs--label-text:var(--color-foreground-muted);--tabs--label-text--hover:var(--color-foreground-muted);--tabs--label-text--active:var(--color-brand-content);--tabs--label-text--active--hover:var(--color-brand-content);--tabs--label-background:transparent;--tabs--label-background--hover:transparent;--tabs--label-background--active:transparent;--tabs--label-background--active--hover:transparent;--tabs--padding-x:0.25em;--tabs--margin-x:1em;--tabs--border:var(--color-background-border);--tabs--label-border:transparent;--tabs--label-border--hover:var(--color-foreground-muted);--tabs--label-border--active:var(--color-brand-content);--tabs--label-border--active--hover:var(--color-brand-content)}[role=main] .container{max-width:none;padding-left:0;padding-right:0}.shadow.docutils{border:none;box-shadow:0 .2rem .5rem rgba(0,0,0,.05),0 0 .0625rem rgba(0,0,0,.1)!important}.sphinx-bs .card{background-color:var(--color-background-secondary);color:var(--color-foreground)} +/*# sourceMappingURL=furo-extensions.css.map*/ \ No newline at end of file diff --git a/_static/styles/furo-extensions.css.map b/_static/styles/furo-extensions.css.map new file mode 100644 index 0000000..68fb7fd --- /dev/null +++ b/_static/styles/furo-extensions.css.map @@ -0,0 +1 @@ +{"version":3,"file":"styles/furo-extensions.css","mappings":"AAGA,2BACE,oFACA,4CAKE,6CAHA,YACA,eAEA,CACA,kDACE,yCAEF,8CACE,sCAEJ,8CACE,kDAEJ,2BAGE,uBACA,cAHA,gBACA,UAEA,CAGA,yCACE,mBAEF,gDAEE,gDADA,YACA,CACA,sDACE,gDACF,yDACE,sCAEJ,+CACE,UACA,qDACE,UAGF,mDACE,eAEJ,yEAEE,4DAEA,mHASE,mBAPA,kBAEA,YADA,oBAGA,aADA,gBAIA,CAEA,qIAEE,WADA,UACA,CAEJ,uGACE,aAEF,iUAGE,cAEF,mHACE,aC1EJ,gCACE,mCAEF,0BAEE,mBAUA,8CACA,YAFA,mCAKA,eAZA,cAIA,YADA,YAYA,iCAdA,YAcA,CAEA,gCAEE,8CADA,gCACA,CAEF,gCAGE,6BADA,mCADA,YAEA,CAEF,kCAEE,cADA,mBACA,CACA,wCACE,cAEJ,8BACE,UCzCN,KAEE,6CAA8C,CAC9C,uDAAwD,CACxD,uDAAwD,CAGxD,iCAAsC,CAGtC,+CAAgD,CAChD,uDAAwD,CACxD,uDAAwD,CACxD,oDAAqD,CACrD,6DAA8D,CAC9D,6DAA8D,CAG9D,uDAAwD,CACxD,yDAA0D,CAC1D,4DAA6D,CAC7D,2DAA4D,CAC5D,8DAA+D,CAC/D,iEAAkE,CAClE,uDAAwD,CACxD,wDAAyD,CAG3D,gBACE,qFAGF,SACE,6EAEF,cACE,uFAEF,cACE,uFAEF,cACE,uFAGF,qBACE,eAEF,mBACE,WACA,eChDF,KACE,gDAAiD,CACjD,uDAAwD,CACxD,qDAAsD,CACtD,4DAA6D,CAC7D,oCAAqC,CACrC,2CAA4C,CAC5C,4CAA6C,CAC7C,mDAAoD,CACpD,wBAAyB,CACzB,oBAAqB,CACrB,6CAA8C,CAC9C,gCAAiC,CACjC,yDAA0D,CAC1D,uDAAwD,CACxD,8DAA+D,CCbjE,uBACE,eACA,eACA,gBAGF,iBACE,YACA,+EAGF,iBACE,mDACA","sources":["webpack:///./src/furo/assets/styles/extensions/_readthedocs.sass","webpack:///./src/furo/assets/styles/extensions/_copybutton.sass","webpack:///./src/furo/assets/styles/extensions/_sphinx-design.sass","webpack:///./src/furo/assets/styles/extensions/_sphinx-inline-tabs.sass","webpack:///./src/furo/assets/styles/extensions/_sphinx-panels.sass"],"sourcesContent":["// This file contains the styles used for tweaking how ReadTheDoc's embedded\n// contents would show up inside the theme.\n\n#furo-sidebar-ad-placement\n padding: var(--sidebar-item-spacing-vertical) var(--sidebar-item-spacing-horizontal)\n .ethical-sidebar\n // Remove the border and box-shadow.\n border: none\n box-shadow: none\n // Manage the background colors.\n background: var(--color-background-secondary)\n &:hover\n background: var(--color-background-hover)\n // Ensure the text is legible.\n a\n color: var(--color-foreground-primary)\n\n .ethical-callout a\n color: var(--color-foreground-secondary) !important\n\n#furo-readthedocs-versions\n position: static\n width: 100%\n background: transparent\n display: block\n\n // Make the background color fit with the theme's aesthetic.\n .rst-versions\n background: rgb(26, 28, 30)\n\n .rst-current-version\n cursor: unset\n background: var(--color-sidebar-item-background)\n &:hover\n background: var(--color-sidebar-item-background)\n .fa-book\n color: var(--color-foreground-primary)\n\n > .rst-other-versions\n padding: 0\n small\n opacity: 1\n\n .injected\n .rst-versions\n position: unset\n\n &:hover,\n &:focus-within\n box-shadow: 0 0 0 1px var(--color-sidebar-background-border)\n\n .rst-current-version\n // Undo the tweaks done in RTD's CSS\n font-size: inherit\n line-height: inherit\n height: auto\n text-align: right\n padding: 12px\n\n // Match the rest of the body\n background: #1a1c1e\n\n .fa-book\n float: left\n color: white\n\n .fa-caret-down\n display: none\n\n .rst-current-version,\n .rst-other-versions,\n .injected\n display: block\n\n > .rst-current-version\n display: none\n",".highlight\n &:hover button.copybtn\n color: var(--color-code-foreground)\n\n button.copybtn\n // Align things correctly\n align-items: center\n\n height: 1.25em\n width: 1.25em\n\n top: 0.625rem // $code-spacing-vertical\n right: 0.5rem\n\n // Make it look better\n color: var(--color-background-item)\n background-color: var(--color-code-background)\n border: none\n\n // Change to cursor to make it obvious that you can click on it\n cursor: pointer\n\n // Transition smoothly, for aesthetics\n transition: color 300ms, opacity 300ms\n\n &:hover\n color: var(--color-brand-content)\n background-color: var(--color-code-background)\n\n &::after\n display: none\n color: var(--color-code-foreground)\n background-color: transparent\n\n &.success\n transition: color 0ms\n color: #22863a\n &::after\n display: block\n\n svg\n padding: 0\n","body\n // Colors\n --sd-color-primary: var(--color-brand-primary)\n --sd-color-primary-highlight: var(--color-brand-content)\n --sd-color-primary-text: var(--color-background-primary)\n\n // Shadows\n --sd-color-shadow: rgba(0, 0, 0, 0.05)\n\n // Cards\n --sd-color-card-border: var(--color-card-border)\n --sd-color-card-border-hover: var(--color-brand-content)\n --sd-color-card-background: var(--color-card-background)\n --sd-color-card-text: var(--color-foreground-primary)\n --sd-color-card-header: var(--color-card-marginals-background)\n --sd-color-card-footer: var(--color-card-marginals-background)\n\n // Tabs\n --sd-color-tabs-label-active: var(--color-brand-content)\n --sd-color-tabs-label-hover: var(--color-foreground-muted)\n --sd-color-tabs-label-inactive: var(--color-foreground-muted)\n --sd-color-tabs-underline-active: var(--color-brand-content)\n --sd-color-tabs-underline-hover: var(--color-foreground-border)\n --sd-color-tabs-underline-inactive: var(--color-background-border)\n --sd-color-tabs-overline: var(--color-background-border)\n --sd-color-tabs-underline: var(--color-background-border)\n\n// Tabs\n.sd-tab-content\n box-shadow: 0 -2px var(--sd-color-tabs-overline), 0 1px var(--sd-color-tabs-underline)\n\n// Shadows\n.sd-card // Have a shadow by default\n box-shadow: 0 0.1rem 0.25rem var(--sd-color-shadow), 0 0 0.0625rem rgba(0, 0, 0, 0.1)\n\n.sd-shadow-sm\n box-shadow: 0 0.1rem 0.25rem var(--sd-color-shadow), 0 0 0.0625rem rgba(0, 0, 0, 0.1) !important\n\n.sd-shadow-md\n box-shadow: 0 0.3rem 0.75rem var(--sd-color-shadow), 0 0 0.0625rem rgba(0, 0, 0, 0.1) !important\n\n.sd-shadow-lg\n box-shadow: 0 0.6rem 1.5rem var(--sd-color-shadow), 0 0 0.0625rem rgba(0, 0, 0, 0.1) !important\n\n// Cards\n.sd-card-hover:hover // Don't change scale on hover\n transform: none\n\n.sd-cards-carousel // Have a bit of gap in the carousel by default\n gap: 0.25rem\n padding: 0.25rem\n","// This file contains styles to tweak sphinx-inline-tabs to work well with Furo.\n\nbody\n --tabs--label-text: var(--color-foreground-muted)\n --tabs--label-text--hover: var(--color-foreground-muted)\n --tabs--label-text--active: var(--color-brand-content)\n --tabs--label-text--active--hover: var(--color-brand-content)\n --tabs--label-background: transparent\n --tabs--label-background--hover: transparent\n --tabs--label-background--active: transparent\n --tabs--label-background--active--hover: transparent\n --tabs--padding-x: 0.25em\n --tabs--margin-x: 1em\n --tabs--border: var(--color-background-border)\n --tabs--label-border: transparent\n --tabs--label-border--hover: var(--color-foreground-muted)\n --tabs--label-border--active: var(--color-brand-content)\n --tabs--label-border--active--hover: var(--color-brand-content)\n","// This file contains styles to tweak sphinx-panels to work well with Furo.\n\n// sphinx-panels includes Bootstrap 4, which uses .container which can conflict\n// with docutils' `.. container::` directive.\n[role=\"main\"] .container\n max-width: initial\n padding-left: initial\n padding-right: initial\n\n// Make the panels look nicer!\n.shadow.docutils\n border: none\n box-shadow: 0 0.2rem 0.5rem rgba(0, 0, 0, 0.05), 0 0 0.0625rem rgba(0, 0, 0, 0.1) !important\n\n// Make panel colors respond to dark mode\n.sphinx-bs .card\n background-color: var(--color-background-secondary)\n color: var(--color-foreground)\n"],"names":[],"sourceRoot":""} \ No newline at end of file diff --git a/_static/styles/furo.css b/_static/styles/furo.css new file mode 100644 index 0000000..592d5bf --- /dev/null +++ b/_static/styles/furo.css @@ -0,0 +1,2 @@ +/*! normalize.css v8.0.1 | MIT License | github.com/necolas/normalize.css */html{line-height:1.15;-webkit-text-size-adjust:100%}body{margin:0}main{display:block}h1{font-size:2em;margin:.67em 0}hr{box-sizing:content-box;height:0;overflow:visible}pre{font-family:monospace,monospace;font-size:1em}a{background-color:transparent}abbr[title]{border-bottom:none;text-decoration:underline;text-decoration:underline dotted}b,strong{font-weight:bolder}code,kbd,samp{font-family:monospace,monospace;font-size:1em}sub,sup{font-size:75%;line-height:0;position:relative;vertical-align:baseline}sub{bottom:-.25em}sup{top:-.5em}img{border-style:none}button,input,optgroup,select,textarea{font-family:inherit;font-size:100%;line-height:1.15;margin:0}button,input{overflow:visible}button,select{text-transform:none}[type=button],[type=reset],[type=submit],button{-webkit-appearance:button}[type=button]::-moz-focus-inner,[type=reset]::-moz-focus-inner,[type=submit]::-moz-focus-inner,button::-moz-focus-inner{border-style:none;padding:0}[type=button]:-moz-focusring,[type=reset]:-moz-focusring,[type=submit]:-moz-focusring,button:-moz-focusring{outline:1px dotted ButtonText}fieldset{padding:.35em .75em .625em}legend{box-sizing:border-box;color:inherit;display:table;max-width:100%;padding:0;white-space:normal}progress{vertical-align:baseline}textarea{overflow:auto}[type=checkbox],[type=radio]{box-sizing:border-box;padding:0}[type=number]::-webkit-inner-spin-button,[type=number]::-webkit-outer-spin-button{height:auto}[type=search]{-webkit-appearance:textfield;outline-offset:-2px}[type=search]::-webkit-search-decoration{-webkit-appearance:none}::-webkit-file-upload-button{-webkit-appearance:button;font:inherit}details{display:block}summary{display:list-item}[hidden],template{display:none}@media print{.content-icon-container,.headerlink,.mobile-header,.related-pages{display:none!important}.highlight{border:.1pt solid var(--color-foreground-border)}a,blockquote,dl,ol,p,pre,table,ul{page-break-inside:avoid}caption,figure,h1,h2,h3,h4,h5,h6,img{page-break-after:avoid;page-break-inside:avoid}dl,ol,ul{page-break-before:avoid}}.visually-hidden{height:1px!important;margin:-1px!important;overflow:hidden!important;padding:0!important;position:absolute!important;width:1px!important;clip:rect(0,0,0,0)!important;background:var(--color-background-primary);border:0!important;color:var(--color-foreground-primary);white-space:nowrap!important}:-moz-focusring{outline:auto}body{--font-stack:-apple-system,BlinkMacSystemFont,Segoe UI,Helvetica,Arial,sans-serif,Apple Color Emoji,Segoe UI Emoji;--font-stack--monospace:"SFMono-Regular",Menlo,Consolas,Monaco,Liberation Mono,Lucida Console,monospace;--font-stack--headings:var(--font-stack);--font-size--normal:100%;--font-size--small:87.5%;--font-size--small--2:81.25%;--font-size--small--3:75%;--font-size--small--4:62.5%;--sidebar-caption-font-size:var(--font-size--small--2);--sidebar-item-font-size:var(--font-size--small);--sidebar-search-input-font-size:var(--font-size--small);--toc-font-size:var(--font-size--small--3);--toc-font-size--mobile:var(--font-size--normal);--toc-title-font-size:var(--font-size--small--4);--admonition-font-size:0.8125rem;--admonition-title-font-size:0.8125rem;--code-font-size:var(--font-size--small--2);--api-font-size:var(--font-size--small);--header-height:calc(var(--sidebar-item-line-height) + var(--sidebar-item-spacing-vertical)*4);--header-padding:0.5rem;--sidebar-tree-space-above:1.5rem;--sidebar-caption-space-above:1rem;--sidebar-item-line-height:1rem;--sidebar-item-spacing-vertical:0.5rem;--sidebar-item-spacing-horizontal:1rem;--sidebar-item-height:calc(var(--sidebar-item-line-height) + var(--sidebar-item-spacing-vertical)*2);--sidebar-expander-width:var(--sidebar-item-height);--sidebar-search-space-above:0.5rem;--sidebar-search-input-spacing-vertical:0.5rem;--sidebar-search-input-spacing-horizontal:0.5rem;--sidebar-search-input-height:1rem;--sidebar-search-icon-size:var(--sidebar-search-input-height);--toc-title-padding:0.25rem 0;--toc-spacing-vertical:1.5rem;--toc-spacing-horizontal:1.5rem;--toc-item-spacing-vertical:0.4rem;--toc-item-spacing-horizontal:1rem;--icon-search:url('data:image/svg+xml;charset=utf-8,');--icon-pencil:url('data:image/svg+xml;charset=utf-8,');--icon-abstract:url('data:image/svg+xml;charset=utf-8,');--icon-info:url('data:image/svg+xml;charset=utf-8,');--icon-flame:url('data:image/svg+xml;charset=utf-8,');--icon-question:url('data:image/svg+xml;charset=utf-8,');--icon-warning:url('data:image/svg+xml;charset=utf-8,');--icon-failure:url('data:image/svg+xml;charset=utf-8,');--icon-spark:url('data:image/svg+xml;charset=utf-8,');--color-admonition-title--caution:#ff9100;--color-admonition-title-background--caution:rgba(255,145,0,.2);--color-admonition-title--warning:#ff9100;--color-admonition-title-background--warning:rgba(255,145,0,.2);--color-admonition-title--danger:#ff5252;--color-admonition-title-background--danger:rgba(255,82,82,.2);--color-admonition-title--attention:#ff5252;--color-admonition-title-background--attention:rgba(255,82,82,.2);--color-admonition-title--error:#ff5252;--color-admonition-title-background--error:rgba(255,82,82,.2);--color-admonition-title--hint:#00c852;--color-admonition-title-background--hint:rgba(0,200,82,.2);--color-admonition-title--tip:#00c852;--color-admonition-title-background--tip:rgba(0,200,82,.2);--color-admonition-title--important:#00bfa5;--color-admonition-title-background--important:rgba(0,191,165,.2);--color-admonition-title--note:#00b0ff;--color-admonition-title-background--note:rgba(0,176,255,.2);--color-admonition-title--seealso:#448aff;--color-admonition-title-background--seealso:rgba(68,138,255,.2);--color-admonition-title--admonition-todo:grey;--color-admonition-title-background--admonition-todo:hsla(0,0%,50%,.2);--color-admonition-title:#651fff;--color-admonition-title-background:rgba(101,31,255,.2);--icon-admonition-default:var(--icon-abstract);--color-topic-title:#14b8a6;--color-topic-title-background:rgba(20,184,166,.2);--icon-topic-default:var(--icon-pencil);--color-problematic:#b30000;--color-foreground-primary:#000;--color-foreground-secondary:#5a5c63;--color-foreground-muted:#6b6f76;--color-foreground-border:#878787;--color-background-primary:#fff;--color-background-secondary:#f8f9fb;--color-background-hover:#efeff4;--color-background-hover--transparent:#efeff400;--color-background-border:#eeebee;--color-background-item:#ccc;--color-announcement-background:#000000dd;--color-announcement-text:#eeebee;--color-brand-primary:#0a4bff;--color-brand-content:#2757dd;--color-brand-visited:#872ee0;--color-api-background:var(--color-background-hover--transparent);--color-api-background-hover:var(--color-background-hover);--color-api-overall:var(--color-foreground-secondary);--color-api-name:var(--color-problematic);--color-api-pre-name:var(--color-problematic);--color-api-paren:var(--color-foreground-secondary);--color-api-keyword:var(--color-foreground-primary);--color-api-added:#21632c;--color-api-added-border:#38a84d;--color-api-changed:#046172;--color-api-changed-border:#06a1bc;--color-api-deprecated:#605706;--color-api-deprecated-border:#f0d90f;--color-api-removed:#b30000;--color-api-removed-border:#ff5c5c;--color-highlight-on-target:#ffc;--color-inline-code-background:var(--color-background-secondary);--color-highlighted-background:#def;--color-highlighted-text:var(--color-foreground-primary);--color-guilabel-background:#ddeeff80;--color-guilabel-border:#bedaf580;--color-guilabel-text:var(--color-foreground-primary);--color-admonition-background:transparent;--color-table-header-background:var(--color-background-secondary);--color-table-border:var(--color-background-border);--color-card-border:var(--color-background-secondary);--color-card-background:transparent;--color-card-marginals-background:var(--color-background-secondary);--color-header-background:var(--color-background-primary);--color-header-border:var(--color-background-border);--color-header-text:var(--color-foreground-primary);--color-sidebar-background:var(--color-background-secondary);--color-sidebar-background-border:var(--color-background-border);--color-sidebar-brand-text:var(--color-foreground-primary);--color-sidebar-caption-text:var(--color-foreground-muted);--color-sidebar-link-text:var(--color-foreground-secondary);--color-sidebar-link-text--top-level:var(--color-brand-primary);--color-sidebar-item-background:var(--color-sidebar-background);--color-sidebar-item-background--current:var( --color-sidebar-item-background );--color-sidebar-item-background--hover:linear-gradient(90deg,var(--color-background-hover--transparent) 0%,var(--color-background-hover) var(--sidebar-item-spacing-horizontal),var(--color-background-hover) 100%);--color-sidebar-item-expander-background:transparent;--color-sidebar-item-expander-background--hover:var( --color-background-hover );--color-sidebar-search-text:var(--color-foreground-primary);--color-sidebar-search-background:var(--color-background-secondary);--color-sidebar-search-background--focus:var(--color-background-primary);--color-sidebar-search-border:var(--color-background-border);--color-sidebar-search-icon:var(--color-foreground-muted);--color-toc-background:var(--color-background-primary);--color-toc-title-text:var(--color-foreground-muted);--color-toc-item-text:var(--color-foreground-secondary);--color-toc-item-text--hover:var(--color-foreground-primary);--color-toc-item-text--active:var(--color-brand-primary);--color-content-foreground:var(--color-foreground-primary);--color-content-background:transparent;--color-link:var(--color-brand-content);--color-link-underline:var(--color-background-border);--color-link--hover:var(--color-brand-content);--color-link-underline--hover:var(--color-foreground-border);--color-link--visited:var(--color-brand-visited);--color-link-underline--visited:var(--color-background-border);--color-link--visited--hover:var(--color-brand-visited);--color-link-underline--visited--hover:var(--color-foreground-border)}.only-light{display:block!important}html body .only-dark{display:none!important}@media not print{body[data-theme=dark]{--color-problematic:#ee5151;--color-foreground-primary:#cfd0d0;--color-foreground-secondary:#9ca0a5;--color-foreground-muted:#81868d;--color-foreground-border:#666;--color-background-primary:#131416;--color-background-secondary:#1a1c1e;--color-background-hover:#1e2124;--color-background-hover--transparent:#1e212400;--color-background-border:#303335;--color-background-item:#444;--color-announcement-background:#000000dd;--color-announcement-text:#eeebee;--color-brand-primary:#3d94ff;--color-brand-content:#5ca5ff;--color-brand-visited:#b27aeb;--color-highlighted-background:#083563;--color-guilabel-background:#08356380;--color-guilabel-border:#13395f80;--color-api-keyword:var(--color-foreground-secondary);--color-highlight-on-target:#330;--color-api-added:#3db854;--color-api-added-border:#267334;--color-api-changed:#09b0ce;--color-api-changed-border:#056d80;--color-api-deprecated:#b1a10b;--color-api-deprecated-border:#6e6407;--color-api-removed:#ff7575;--color-api-removed-border:#b03b3b;--color-admonition-background:#18181a;--color-card-border:var(--color-background-secondary);--color-card-background:#18181a;--color-card-marginals-background:var(--color-background-hover)}html body[data-theme=dark] .only-light{display:none!important}body[data-theme=dark] .only-dark{display:block!important}@media(prefers-color-scheme:dark){body:not([data-theme=light]){--color-problematic:#ee5151;--color-foreground-primary:#cfd0d0;--color-foreground-secondary:#9ca0a5;--color-foreground-muted:#81868d;--color-foreground-border:#666;--color-background-primary:#131416;--color-background-secondary:#1a1c1e;--color-background-hover:#1e2124;--color-background-hover--transparent:#1e212400;--color-background-border:#303335;--color-background-item:#444;--color-announcement-background:#000000dd;--color-announcement-text:#eeebee;--color-brand-primary:#3d94ff;--color-brand-content:#5ca5ff;--color-brand-visited:#b27aeb;--color-highlighted-background:#083563;--color-guilabel-background:#08356380;--color-guilabel-border:#13395f80;--color-api-keyword:var(--color-foreground-secondary);--color-highlight-on-target:#330;--color-api-added:#3db854;--color-api-added-border:#267334;--color-api-changed:#09b0ce;--color-api-changed-border:#056d80;--color-api-deprecated:#b1a10b;--color-api-deprecated-border:#6e6407;--color-api-removed:#ff7575;--color-api-removed-border:#b03b3b;--color-admonition-background:#18181a;--color-card-border:var(--color-background-secondary);--color-card-background:#18181a;--color-card-marginals-background:var(--color-background-hover)}html body:not([data-theme=light]) .only-light{display:none!important}body:not([data-theme=light]) .only-dark{display:block!important}}}body[data-theme=auto] .theme-toggle svg.theme-icon-when-auto-light{display:block}@media(prefers-color-scheme:dark){body[data-theme=auto] .theme-toggle svg.theme-icon-when-auto-dark{display:block}body[data-theme=auto] .theme-toggle svg.theme-icon-when-auto-light{display:none}}body[data-theme=dark] .theme-toggle svg.theme-icon-when-dark,body[data-theme=light] .theme-toggle svg.theme-icon-when-light{display:block}body{font-family:var(--font-stack)}code,kbd,pre,samp{font-family:var(--font-stack--monospace)}body{-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale}article{line-height:1.5}h1,h2,h3,h4,h5,h6{border-radius:.5rem;font-family:var(--font-stack--headings);font-weight:700;line-height:1.25;margin:.5rem -.5rem;padding-left:.5rem;padding-right:.5rem}h1+p,h2+p,h3+p,h4+p,h5+p,h6+p{margin-top:0}h1{font-size:2.5em;margin-bottom:1rem}h1,h2{margin-top:1.75rem}h2{font-size:2em}h3{font-size:1.5em}h4{font-size:1.25em}h5{font-size:1.125em}h6{font-size:1em}small{font-size:80%;opacity:75%}p{margin-bottom:.75rem;margin-top:.5rem}hr.docutils{background-color:var(--color-background-border);border:0;height:1px;margin:2rem 0;padding:0}.centered{text-align:center}a{color:var(--color-link);text-decoration:underline;text-decoration-color:var(--color-link-underline)}a:visited{color:var(--color-link--visited);text-decoration-color:var(--color-link-underline--visited)}a:visited:hover{color:var(--color-link--visited--hover);text-decoration-color:var(--color-link-underline--visited--hover)}a:hover{color:var(--color-link--hover);text-decoration-color:var(--color-link-underline--hover)}a.muted-link{color:inherit}a.muted-link:hover{color:var(--color-link--hover);text-decoration-color:var(--color-link-underline--hover)}a.muted-link:hover:visited{color:var(--color-link--visited--hover);text-decoration-color:var(--color-link-underline--visited--hover)}html{overflow-x:hidden;overflow-y:scroll;scroll-behavior:smooth}.sidebar-scroll,.toc-scroll,article[role=main] *{scrollbar-color:var(--color-foreground-border) transparent;scrollbar-width:thin}body,html{height:100%}.skip-to-content,body,html{background:var(--color-background-primary);color:var(--color-foreground-primary)}.skip-to-content{border-radius:1rem;left:.25rem;padding:1rem;position:fixed;top:.25rem;transform:translateY(-200%);transition:transform .3s ease-in-out;z-index:40}.skip-to-content:focus-within{transform:translateY(0)}article{background:var(--color-content-background);color:var(--color-content-foreground);overflow-wrap:break-word}.page{display:flex;min-height:100%}.mobile-header{background-color:var(--color-header-background);border-bottom:1px solid var(--color-header-border);color:var(--color-header-text);display:none;height:var(--header-height);width:100%;z-index:10}.mobile-header.scrolled{border-bottom:none;box-shadow:0 0 .2rem rgba(0,0,0,.1),0 .2rem .4rem rgba(0,0,0,.2)}.mobile-header .header-center a{color:var(--color-header-text);text-decoration:none}.main{display:flex;flex:1}.sidebar-drawer{background:var(--color-sidebar-background);border-right:1px solid var(--color-sidebar-background-border);box-sizing:border-box;display:flex;justify-content:flex-end;min-width:15em;width:calc(50% - 26em)}.sidebar-container,.toc-drawer{box-sizing:border-box;width:15em}.toc-drawer{background:var(--color-toc-background);padding-right:1rem}.sidebar-sticky,.toc-sticky{display:flex;flex-direction:column;height:min(100%,100vh);height:100vh;position:sticky;top:0}.sidebar-scroll,.toc-scroll{flex-grow:1;flex-shrink:1;overflow:auto;scroll-behavior:smooth}.content{display:flex;flex-direction:column;justify-content:space-between;padding:0 3em;width:46em}.icon{display:inline-block;height:1rem;width:1rem}.icon svg{height:100%;width:100%}.announcement{align-items:center;background-color:var(--color-announcement-background);color:var(--color-announcement-text);display:flex;height:var(--header-height);overflow-x:auto}.announcement+.page{min-height:calc(100% - var(--header-height))}.announcement-content{box-sizing:border-box;min-width:100%;padding:.5rem;text-align:center;white-space:nowrap}.announcement-content a{color:var(--color-announcement-text);text-decoration-color:var(--color-announcement-text)}.announcement-content a:hover{color:var(--color-announcement-text);text-decoration-color:var(--color-link--hover)}.no-js .theme-toggle-container{display:none}.theme-toggle-container{display:flex}.theme-toggle{background:transparent;border:none;cursor:pointer;display:flex;padding:0}.theme-toggle svg{color:var(--color-foreground-primary);display:none;height:1.25rem;width:1.25rem}.theme-toggle-header{align-items:center;display:flex;justify-content:center}.nav-overlay-icon,.toc-overlay-icon{cursor:pointer;display:none}.nav-overlay-icon .icon,.toc-overlay-icon .icon{color:var(--color-foreground-secondary);height:1.5rem;width:1.5rem}.nav-overlay-icon,.toc-header-icon{align-items:center;justify-content:center}.toc-content-icon{height:1.5rem;width:1.5rem}.content-icon-container{display:flex;float:right;gap:.5rem;margin-bottom:1rem;margin-left:1rem;margin-top:1.5rem}.content-icon-container .edit-this-page svg,.content-icon-container .view-this-page svg{color:inherit;height:1.25rem;width:1.25rem}.sidebar-toggle{display:none;position:absolute}.sidebar-toggle[name=__toc]{left:20px}.sidebar-toggle:checked{left:40px}.overlay{background-color:rgba(0,0,0,.54);height:0;opacity:0;position:fixed;top:0;transition:width 0s,height 0s,opacity .25s ease-out;width:0}.sidebar-overlay{z-index:20}.toc-overlay{z-index:40}.sidebar-drawer{transition:left .25s ease-in-out;z-index:30}.toc-drawer{transition:right .25s ease-in-out;z-index:50}#__navigation:checked~.sidebar-overlay{height:100%;opacity:1;width:100%}#__navigation:checked~.page .sidebar-drawer{left:0;top:0}#__toc:checked~.toc-overlay{height:100%;opacity:1;width:100%}#__toc:checked~.page .toc-drawer{right:0;top:0}.back-to-top{background:var(--color-background-primary);border-radius:1rem;box-shadow:0 .2rem .5rem rgba(0,0,0,.05),0 0 1px 0 hsla(220,9%,46%,.502);display:none;font-size:.8125rem;left:0;margin-left:50%;padding:.5rem .75rem .5rem .5rem;position:fixed;text-decoration:none;top:1rem;transform:translateX(-50%);z-index:10}.back-to-top svg{height:1rem;width:1rem;fill:currentColor;display:inline-block}.back-to-top span{margin-left:.25rem}.show-back-to-top .back-to-top{align-items:center;display:flex}@media(min-width:97em){html{font-size:110%}}@media(max-width:82em){.toc-content-icon{display:flex}.toc-drawer{border-left:1px solid var(--color-background-muted);height:100vh;position:fixed;right:-15em;top:0}.toc-tree{border-left:none;font-size:var(--toc-font-size--mobile)}.sidebar-drawer{width:calc(50% - 18.5em)}}@media(max-width:67em){.content{margin-left:auto;margin-right:auto;padding:0 1em}}@media(max-width:63em){.nav-overlay-icon{display:flex}.sidebar-drawer{height:100vh;left:-15em;position:fixed;top:0;width:15em}.theme-toggle-header,.toc-header-icon{display:flex}.theme-toggle-content,.toc-content-icon{display:none}.mobile-header{align-items:center;display:flex;justify-content:space-between;position:sticky;top:0}.mobile-header .header-left,.mobile-header .header-right{display:flex;height:var(--header-height);padding:0 var(--header-padding)}.mobile-header .header-left label,.mobile-header .header-right label{height:100%;-webkit-user-select:none;-moz-user-select:none;user-select:none;width:100%}.nav-overlay-icon .icon,.theme-toggle svg{height:1.5rem;width:1.5rem}:target{scroll-margin-top:calc(var(--header-height) + 2.5rem)}.back-to-top{top:calc(var(--header-height) + .5rem)}.page{flex-direction:column;justify-content:center}}@media(max-width:48em){.content{overflow-x:auto;width:100%}}@media(max-width:46em){article[role=main] aside.sidebar{float:none;margin:1rem 0;width:100%}}.admonition,.topic{background:var(--color-admonition-background);border-radius:.2rem;box-shadow:0 .2rem .5rem rgba(0,0,0,.05),0 0 .0625rem rgba(0,0,0,.1);font-size:var(--admonition-font-size);margin:1rem auto;overflow:hidden;padding:0 .5rem .5rem;page-break-inside:avoid}.admonition>:nth-child(2),.topic>:nth-child(2){margin-top:0}.admonition>:last-child,.topic>:last-child{margin-bottom:0}.admonition p.admonition-title,p.topic-title{font-size:var(--admonition-title-font-size);font-weight:500;line-height:1.3;margin:0 -.5rem .5rem;padding:.4rem .5rem .4rem 2rem;position:relative}.admonition p.admonition-title:before,p.topic-title:before{content:"";height:1rem;left:.5rem;position:absolute;width:1rem}p.admonition-title{background-color:var(--color-admonition-title-background)}p.admonition-title:before{background-color:var(--color-admonition-title);-webkit-mask-image:var(--icon-admonition-default);mask-image:var(--icon-admonition-default);-webkit-mask-repeat:no-repeat;mask-repeat:no-repeat}p.topic-title{background-color:var(--color-topic-title-background)}p.topic-title:before{background-color:var(--color-topic-title);-webkit-mask-image:var(--icon-topic-default);mask-image:var(--icon-topic-default);-webkit-mask-repeat:no-repeat;mask-repeat:no-repeat}.admonition{border-left:.2rem solid var(--color-admonition-title)}.admonition.caution{border-left-color:var(--color-admonition-title--caution)}.admonition.caution>.admonition-title{background-color:var(--color-admonition-title-background--caution)}.admonition.caution>.admonition-title:before{background-color:var(--color-admonition-title--caution);-webkit-mask-image:var(--icon-spark);mask-image:var(--icon-spark)}.admonition.warning{border-left-color:var(--color-admonition-title--warning)}.admonition.warning>.admonition-title{background-color:var(--color-admonition-title-background--warning)}.admonition.warning>.admonition-title:before{background-color:var(--color-admonition-title--warning);-webkit-mask-image:var(--icon-warning);mask-image:var(--icon-warning)}.admonition.danger{border-left-color:var(--color-admonition-title--danger)}.admonition.danger>.admonition-title{background-color:var(--color-admonition-title-background--danger)}.admonition.danger>.admonition-title:before{background-color:var(--color-admonition-title--danger);-webkit-mask-image:var(--icon-spark);mask-image:var(--icon-spark)}.admonition.attention{border-left-color:var(--color-admonition-title--attention)}.admonition.attention>.admonition-title{background-color:var(--color-admonition-title-background--attention)}.admonition.attention>.admonition-title:before{background-color:var(--color-admonition-title--attention);-webkit-mask-image:var(--icon-warning);mask-image:var(--icon-warning)}.admonition.error{border-left-color:var(--color-admonition-title--error)}.admonition.error>.admonition-title{background-color:var(--color-admonition-title-background--error)}.admonition.error>.admonition-title:before{background-color:var(--color-admonition-title--error);-webkit-mask-image:var(--icon-failure);mask-image:var(--icon-failure)}.admonition.hint{border-left-color:var(--color-admonition-title--hint)}.admonition.hint>.admonition-title{background-color:var(--color-admonition-title-background--hint)}.admonition.hint>.admonition-title:before{background-color:var(--color-admonition-title--hint);-webkit-mask-image:var(--icon-question);mask-image:var(--icon-question)}.admonition.tip{border-left-color:var(--color-admonition-title--tip)}.admonition.tip>.admonition-title{background-color:var(--color-admonition-title-background--tip)}.admonition.tip>.admonition-title:before{background-color:var(--color-admonition-title--tip);-webkit-mask-image:var(--icon-info);mask-image:var(--icon-info)}.admonition.important{border-left-color:var(--color-admonition-title--important)}.admonition.important>.admonition-title{background-color:var(--color-admonition-title-background--important)}.admonition.important>.admonition-title:before{background-color:var(--color-admonition-title--important);-webkit-mask-image:var(--icon-flame);mask-image:var(--icon-flame)}.admonition.note{border-left-color:var(--color-admonition-title--note)}.admonition.note>.admonition-title{background-color:var(--color-admonition-title-background--note)}.admonition.note>.admonition-title:before{background-color:var(--color-admonition-title--note);-webkit-mask-image:var(--icon-pencil);mask-image:var(--icon-pencil)}.admonition.seealso{border-left-color:var(--color-admonition-title--seealso)}.admonition.seealso>.admonition-title{background-color:var(--color-admonition-title-background--seealso)}.admonition.seealso>.admonition-title:before{background-color:var(--color-admonition-title--seealso);-webkit-mask-image:var(--icon-info);mask-image:var(--icon-info)}.admonition.admonition-todo{border-left-color:var(--color-admonition-title--admonition-todo)}.admonition.admonition-todo>.admonition-title{background-color:var(--color-admonition-title-background--admonition-todo)}.admonition.admonition-todo>.admonition-title:before{background-color:var(--color-admonition-title--admonition-todo);-webkit-mask-image:var(--icon-pencil);mask-image:var(--icon-pencil)}.admonition-todo>.admonition-title{text-transform:uppercase}dl[class]:not(.option-list):not(.field-list):not(.footnote):not(.glossary):not(.simple) dd{margin-left:2rem}dl[class]:not(.option-list):not(.field-list):not(.footnote):not(.glossary):not(.simple) dd>:first-child{margin-top:.125rem}dl[class]:not(.option-list):not(.field-list):not(.footnote):not(.glossary):not(.simple) .field-list,dl[class]:not(.option-list):not(.field-list):not(.footnote):not(.glossary):not(.simple) dd>:last-child{margin-bottom:.75rem}dl[class]:not(.option-list):not(.field-list):not(.footnote):not(.glossary):not(.simple) .field-list>dt{font-size:var(--font-size--small);text-transform:uppercase}dl[class]:not(.option-list):not(.field-list):not(.footnote):not(.glossary):not(.simple) .field-list dd:empty{margin-bottom:.5rem}dl[class]:not(.option-list):not(.field-list):not(.footnote):not(.glossary):not(.simple) .field-list dd>ul{margin-left:-1.2rem}dl[class]:not(.option-list):not(.field-list):not(.footnote):not(.glossary):not(.simple) .field-list dd>ul>li>p:nth-child(2){margin-top:0}dl[class]:not(.option-list):not(.field-list):not(.footnote):not(.glossary):not(.simple) .field-list dd>ul>li>p+p:last-child:empty{margin-bottom:0;margin-top:0}dl[class]:not(.option-list):not(.field-list):not(.footnote):not(.glossary):not(.simple)>dt{color:var(--color-api-overall)}.sig:not(.sig-inline){background:var(--color-api-background);border-radius:.25rem;font-family:var(--font-stack--monospace);font-size:var(--api-font-size);font-weight:700;margin-left:-.25rem;margin-right:-.25rem;padding:.25rem .5rem .25rem 3em;text-indent:-2.5em;transition:background .1s ease-out}.sig:not(.sig-inline):hover{background:var(--color-api-background-hover)}.sig:not(.sig-inline) a.reference .viewcode-link{font-weight:400;width:4.25rem}em.property{font-style:normal}em.property:first-child{color:var(--color-api-keyword)}.sig-name{color:var(--color-api-name)}.sig-prename{color:var(--color-api-pre-name);font-weight:400}.sig-paren{color:var(--color-api-paren)}.sig-param{font-style:normal}div.deprecated,div.versionadded,div.versionchanged,div.versionremoved{border-left:.1875rem solid;border-radius:.125rem;padding-left:.75rem}div.deprecated p,div.versionadded p,div.versionchanged p,div.versionremoved p{margin-bottom:.125rem;margin-top:.125rem}div.versionadded{border-color:var(--color-api-added-border)}div.versionadded .versionmodified{color:var(--color-api-added)}div.versionchanged{border-color:var(--color-api-changed-border)}div.versionchanged .versionmodified{color:var(--color-api-changed)}div.deprecated{border-color:var(--color-api-deprecated-border)}div.deprecated .versionmodified{color:var(--color-api-deprecated)}div.versionremoved{border-color:var(--color-api-removed-border)}div.versionremoved .versionmodified{color:var(--color-api-removed)}.viewcode-back,.viewcode-link{float:right;text-align:right}.line-block{margin-bottom:.75rem;margin-top:.5rem}.line-block .line-block{margin-bottom:0;margin-top:0;padding-left:1rem}.code-block-caption,article p.caption,table>caption{font-size:var(--font-size--small);text-align:center}.toctree-wrapper.compound .caption,.toctree-wrapper.compound :not(.caption)>.caption-text{font-size:var(--font-size--small);margin-bottom:0;text-align:initial;text-transform:uppercase}.toctree-wrapper.compound>ul{margin-bottom:0;margin-top:0}.sig-inline,code.literal{background:var(--color-inline-code-background);border-radius:.2em;font-size:var(--font-size--small--2);padding:.1em .2em}pre.literal-block .sig-inline,pre.literal-block code.literal{font-size:inherit;padding:0}p .sig-inline,p code.literal{border:1px solid var(--color-background-border)}.sig-inline{font-family:var(--font-stack--monospace)}div[class*=" highlight-"],div[class^=highlight-]{display:flex;margin:1em 0}div[class*=" highlight-"] .table-wrapper,div[class^=highlight-] .table-wrapper,pre{margin:0;padding:0}pre{overflow:auto}article[role=main] .highlight pre{line-height:1.5}.highlight pre,pre.literal-block{font-size:var(--code-font-size);padding:.625rem .875rem}pre.literal-block{background-color:var(--color-code-background);border-radius:.2rem;color:var(--color-code-foreground);margin-bottom:1rem;margin-top:1rem}.highlight{border-radius:.2rem;width:100%}.highlight .gp,.highlight span.linenos{pointer-events:none;-webkit-user-select:none;-moz-user-select:none;user-select:none}.highlight .hll{display:block;margin-left:-.875rem;margin-right:-.875rem;padding-left:.875rem;padding-right:.875rem}.code-block-caption{background-color:var(--color-code-background);border-bottom:1px solid;border-radius:.25rem;border-bottom-left-radius:0;border-bottom-right-radius:0;border-color:var(--color-background-border);color:var(--color-code-foreground);display:flex;font-weight:300;padding:.625rem .875rem}.code-block-caption+div[class]{margin-top:0}.code-block-caption+div[class]>.highlight{border-top-left-radius:0;border-top-right-radius:0}.highlighttable{display:block;width:100%}.highlighttable tbody{display:block}.highlighttable tr{display:flex}.highlighttable td.linenos{background-color:var(--color-code-background);border-bottom-left-radius:.2rem;border-top-left-radius:.2rem;color:var(--color-code-foreground);padding:.625rem 0 .625rem .875rem}.highlighttable .linenodiv{box-shadow:-.0625rem 0 var(--color-foreground-border) inset;font-size:var(--code-font-size);padding-right:.875rem}.highlighttable td.code{display:block;flex:1;overflow:hidden;padding:0}.highlighttable td.code .highlight{border-bottom-left-radius:0;border-top-left-radius:0}.highlight span.linenos{box-shadow:-.0625rem 0 var(--color-foreground-border) inset;display:inline-block;margin-right:.875rem;padding-left:0;padding-right:.875rem}.footnote-reference{font-size:var(--font-size--small--4);vertical-align:super}dl.footnote.brackets{color:var(--color-foreground-secondary);display:grid;font-size:var(--font-size--small);grid-template-columns:max-content auto}dl.footnote.brackets dt{margin:0}dl.footnote.brackets dt>.fn-backref{margin-left:.25rem}dl.footnote.brackets dt:after{content:":"}dl.footnote.brackets dt .brackets:before{content:"["}dl.footnote.brackets dt .brackets:after{content:"]"}dl.footnote.brackets dd{margin:0;padding:0 1rem}aside.footnote{color:var(--color-foreground-secondary);font-size:var(--font-size--small)}aside.footnote>span,div.citation>span{float:left;font-weight:500;padding-right:.25rem}aside.footnote>:not(span),div.citation>p{margin-left:2rem}img{box-sizing:border-box;height:auto;max-width:100%}article .figure,article figure{border-radius:.2rem;margin:0}article .figure :last-child,article figure :last-child{margin-bottom:0}article .align-left{clear:left;float:left;margin:0 1rem 1rem}article .align-right{clear:right;float:right;margin:0 1rem 1rem}article .align-center,article .align-default{display:block;margin-left:auto;margin-right:auto;text-align:center}article table.align-default{display:table;text-align:initial}.domainindex-jumpbox,.genindex-jumpbox{border-bottom:1px solid var(--color-background-border);border-top:1px solid var(--color-background-border);padding:.25rem}.domainindex-section h2,.genindex-section h2{margin-bottom:.5rem;margin-top:.75rem}.domainindex-section ul,.genindex-section ul{margin-bottom:0;margin-top:0}ol,ul{margin-bottom:1rem;margin-top:1rem;padding-left:1.2rem}ol li>p:first-child,ul li>p:first-child{margin-bottom:.25rem;margin-top:.25rem}ol li>p:last-child,ul li>p:last-child{margin-top:.25rem}ol li>ol,ol li>ul,ul li>ol,ul li>ul{margin-bottom:.5rem;margin-top:.5rem}ol.arabic{list-style:decimal}ol.loweralpha{list-style:lower-alpha}ol.upperalpha{list-style:upper-alpha}ol.lowerroman{list-style:lower-roman}ol.upperroman{list-style:upper-roman}.simple li>ol,.simple li>ul,.toctree-wrapper li>ol,.toctree-wrapper li>ul{margin-bottom:0;margin-top:0}.field-list dt,.option-list dt,dl.footnote dt,dl.glossary dt,dl.simple dt,dl:not([class]) dt{font-weight:500;margin-top:.25rem}.field-list dt+dt,.option-list dt+dt,dl.footnote dt+dt,dl.glossary dt+dt,dl.simple dt+dt,dl:not([class]) dt+dt{margin-top:0}.field-list dt .classifier:before,.option-list dt .classifier:before,dl.footnote dt .classifier:before,dl.glossary dt .classifier:before,dl.simple dt .classifier:before,dl:not([class]) dt .classifier:before{content:":";margin-left:.2rem;margin-right:.2rem}.field-list dd ul,.field-list dd>p:first-child,.option-list dd ul,.option-list dd>p:first-child,dl.footnote dd ul,dl.footnote dd>p:first-child,dl.glossary dd ul,dl.glossary dd>p:first-child,dl.simple dd ul,dl.simple dd>p:first-child,dl:not([class]) dd ul,dl:not([class]) dd>p:first-child{margin-top:.125rem}.field-list dd ul,.option-list dd ul,dl.footnote dd ul,dl.glossary dd ul,dl.simple dd ul,dl:not([class]) dd ul{margin-bottom:.125rem}.math-wrapper{overflow-x:auto;width:100%}div.math{position:relative;text-align:center}div.math .headerlink,div.math:focus .headerlink{display:none}div.math:hover .headerlink{display:inline-block}div.math span.eqno{position:absolute;right:.5rem;top:50%;transform:translateY(-50%);z-index:1}abbr[title]{cursor:help}.problematic{color:var(--color-problematic)}kbd:not(.compound){background-color:var(--color-background-secondary);border:1px solid var(--color-foreground-border);border-radius:.2rem;box-shadow:0 .0625rem 0 rgba(0,0,0,.2),inset 0 0 0 .125rem var(--color-background-primary);color:var(--color-foreground-primary);display:inline-block;font-size:var(--font-size--small--3);margin:0 .2rem;padding:0 .2rem;vertical-align:text-bottom}blockquote{background:var(--color-background-secondary);border-left:4px solid var(--color-background-border);margin-left:0;margin-right:0;padding:.5rem 1rem}blockquote .attribution{font-weight:600;text-align:right}blockquote.highlights,blockquote.pull-quote{font-size:1.25em}blockquote.epigraph,blockquote.pull-quote{border-left-width:0;border-radius:.5rem}blockquote.highlights{background:transparent;border-left-width:0}p .reference img{vertical-align:middle}p.rubric{font-size:1.125em;font-weight:700;line-height:1.25}dd p.rubric{font-size:var(--font-size--small);font-weight:inherit;line-height:inherit;text-transform:uppercase}article .sidebar{background-color:var(--color-background-secondary);border:1px solid var(--color-background-border);border-radius:.2rem;clear:right;float:right;margin-left:1rem;margin-right:0;width:30%}article .sidebar>*{padding-left:1rem;padding-right:1rem}article .sidebar>ol,article .sidebar>ul{padding-left:2.2rem}article .sidebar .sidebar-title{border-bottom:1px solid var(--color-background-border);font-weight:500;margin:0;padding:.5rem 1rem}[role=main] .table-wrapper.container{margin-bottom:.5rem;margin-top:1rem;overflow-x:auto;padding:.2rem .2rem .75rem;width:100%}table.docutils{border-collapse:collapse;border-radius:.2rem;border-spacing:0;box-shadow:0 .2rem .5rem rgba(0,0,0,.05),0 0 .0625rem rgba(0,0,0,.1)}table.docutils th{background:var(--color-table-header-background)}table.docutils td,table.docutils th{border-bottom:1px solid var(--color-table-border);border-left:1px solid var(--color-table-border);border-right:1px solid var(--color-table-border);padding:0 .25rem}table.docutils td p,table.docutils th p{margin:.25rem}table.docutils td:first-child,table.docutils th:first-child{border-left:none}table.docutils td:last-child,table.docutils th:last-child{border-right:none}table.docutils td.text-left,table.docutils th.text-left{text-align:left}table.docutils td.text-right,table.docutils th.text-right{text-align:right}table.docutils td.text-center,table.docutils th.text-center{text-align:center}:target{scroll-margin-top:2.5rem}@media(max-width:67em){:target{scroll-margin-top:calc(2.5rem + var(--header-height))}section>span:target{scroll-margin-top:calc(2.8rem + var(--header-height))}}.headerlink{font-weight:100;-webkit-user-select:none;-moz-user-select:none;user-select:none}.code-block-caption>.headerlink,dl dt>.headerlink,figcaption p>.headerlink,h1>.headerlink,h2>.headerlink,h3>.headerlink,h4>.headerlink,h5>.headerlink,h6>.headerlink,p.caption>.headerlink,table>caption>.headerlink{margin-left:.5rem;visibility:hidden}.code-block-caption:hover>.headerlink,dl dt:hover>.headerlink,figcaption p:hover>.headerlink,h1:hover>.headerlink,h2:hover>.headerlink,h3:hover>.headerlink,h4:hover>.headerlink,h5:hover>.headerlink,h6:hover>.headerlink,p.caption:hover>.headerlink,table>caption:hover>.headerlink{visibility:visible}.code-block-caption>.toc-backref,dl dt>.toc-backref,figcaption p>.toc-backref,h1>.toc-backref,h2>.toc-backref,h3>.toc-backref,h4>.toc-backref,h5>.toc-backref,h6>.toc-backref,p.caption>.toc-backref,table>caption>.toc-backref{color:inherit;text-decoration-line:none}figure:hover>figcaption>p>.headerlink,table:hover>caption>.headerlink{visibility:visible}:target>h1:first-of-type,:target>h2:first-of-type,:target>h3:first-of-type,:target>h4:first-of-type,:target>h5:first-of-type,:target>h6:first-of-type,span:target~h1:first-of-type,span:target~h2:first-of-type,span:target~h3:first-of-type,span:target~h4:first-of-type,span:target~h5:first-of-type,span:target~h6:first-of-type{background-color:var(--color-highlight-on-target)}:target>h1:first-of-type code.literal,:target>h2:first-of-type code.literal,:target>h3:first-of-type code.literal,:target>h4:first-of-type code.literal,:target>h5:first-of-type code.literal,:target>h6:first-of-type code.literal,span:target~h1:first-of-type code.literal,span:target~h2:first-of-type code.literal,span:target~h3:first-of-type code.literal,span:target~h4:first-of-type code.literal,span:target~h5:first-of-type code.literal,span:target~h6:first-of-type code.literal{background-color:transparent}.literal-block-wrapper:target .code-block-caption,.this-will-duplicate-information-and-it-is-still-useful-here li :target,figure:target,table:target>caption{background-color:var(--color-highlight-on-target)}dt:target{background-color:var(--color-highlight-on-target)!important}.footnote-reference:target,.footnote>dt:target+dd{background-color:var(--color-highlight-on-target)}.guilabel{background-color:var(--color-guilabel-background);border:1px solid var(--color-guilabel-border);border-radius:.5em;color:var(--color-guilabel-text);font-size:.9em;padding:0 .3em}footer{display:flex;flex-direction:column;font-size:var(--font-size--small);margin-top:2rem}.bottom-of-page{align-items:center;border-top:1px solid var(--color-background-border);color:var(--color-foreground-secondary);display:flex;justify-content:space-between;line-height:1.5;margin-top:1rem;padding-bottom:1rem;padding-top:1rem}@media(max-width:46em){.bottom-of-page{flex-direction:column-reverse;gap:.25rem;text-align:center}}.bottom-of-page .left-details{font-size:var(--font-size--small)}.bottom-of-page .right-details{display:flex;flex-direction:column;gap:.25rem;text-align:right}.bottom-of-page .icons{display:flex;font-size:1rem;gap:.25rem;justify-content:flex-end}.bottom-of-page .icons a{text-decoration:none}.bottom-of-page .icons img,.bottom-of-page .icons svg{font-size:1.125rem;height:1em;width:1em}.related-pages a{align-items:center;display:flex;text-decoration:none}.related-pages a:hover .page-info .title{color:var(--color-link);text-decoration:underline;text-decoration-color:var(--color-link-underline)}.related-pages a svg.furo-related-icon,.related-pages a svg.furo-related-icon>use{color:var(--color-foreground-border);flex-shrink:0;height:.75rem;margin:0 .5rem;width:.75rem}.related-pages a.next-page{clear:right;float:right;max-width:50%;text-align:right}.related-pages a.prev-page{clear:left;float:left;max-width:50%}.related-pages a.prev-page svg{transform:rotate(180deg)}.page-info{display:flex;flex-direction:column;overflow-wrap:anywhere}.next-page .page-info{align-items:flex-end}.page-info .context{align-items:center;color:var(--color-foreground-muted);display:flex;font-size:var(--font-size--small);padding-bottom:.1rem;text-decoration:none}ul.search{list-style:none;padding-left:0}ul.search li{border-bottom:1px solid var(--color-background-border);padding:1rem 0}[role=main] .highlighted{background-color:var(--color-highlighted-background);color:var(--color-highlighted-text)}.sidebar-brand{display:flex;flex-direction:column;flex-shrink:0;padding:var(--sidebar-item-spacing-vertical) var(--sidebar-item-spacing-horizontal);text-decoration:none}.sidebar-brand-text{color:var(--color-sidebar-brand-text);font-size:1.5rem;overflow-wrap:break-word}.sidebar-brand-text,.sidebar-logo-container{margin:var(--sidebar-item-spacing-vertical) 0}.sidebar-logo{display:block;margin:0 auto;max-width:100%}.sidebar-search-container{align-items:center;background:var(--color-sidebar-search-background);display:flex;margin-top:var(--sidebar-search-space-above);position:relative}.sidebar-search-container:focus-within,.sidebar-search-container:hover{background:var(--color-sidebar-search-background--focus)}.sidebar-search-container:before{background-color:var(--color-sidebar-search-icon);content:"";height:var(--sidebar-search-icon-size);left:var(--sidebar-item-spacing-horizontal);-webkit-mask-image:var(--icon-search);mask-image:var(--icon-search);position:absolute;width:var(--sidebar-search-icon-size)}.sidebar-search{background:transparent;border:none;border-bottom:1px solid var(--color-sidebar-search-border);border-top:1px solid var(--color-sidebar-search-border);box-sizing:border-box;color:var(--color-sidebar-search-foreground);padding:var(--sidebar-search-input-spacing-vertical) var(--sidebar-search-input-spacing-horizontal) var(--sidebar-search-input-spacing-vertical) calc(var(--sidebar-item-spacing-horizontal) + var(--sidebar-search-input-spacing-horizontal) + var(--sidebar-search-icon-size));width:100%;z-index:10}.sidebar-search:focus{outline:none}.sidebar-search::-moz-placeholder{font-size:var(--sidebar-search-input-font-size)}.sidebar-search::placeholder{font-size:var(--sidebar-search-input-font-size)}#searchbox .highlight-link{margin:0;padding:var(--sidebar-item-spacing-vertical) var(--sidebar-item-spacing-horizontal) 0;text-align:center}#searchbox .highlight-link a{color:var(--color-sidebar-search-icon);font-size:var(--font-size--small--2)}.sidebar-tree{font-size:var(--sidebar-item-font-size);margin-bottom:var(--sidebar-item-spacing-vertical);margin-top:var(--sidebar-tree-space-above)}.sidebar-tree ul{display:flex;flex-direction:column;list-style:none;margin-bottom:0;margin-top:0;padding:0}.sidebar-tree li{margin:0;position:relative}.sidebar-tree li>ul{margin-left:var(--sidebar-item-spacing-horizontal)}.sidebar-tree .icon,.sidebar-tree .reference{color:var(--color-sidebar-link-text)}.sidebar-tree .reference{box-sizing:border-box;display:inline-block;height:100%;line-height:var(--sidebar-item-line-height);overflow-wrap:anywhere;padding:var(--sidebar-item-spacing-vertical) var(--sidebar-item-spacing-horizontal);text-decoration:none;width:100%}.sidebar-tree .reference:hover{background:var(--color-sidebar-item-background--hover);color:var(--color-sidebar-link-text)}.sidebar-tree .reference.external:after{color:var(--color-sidebar-link-text);content:url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' fill='none' stroke='%23607d8b' stroke-linecap='round' stroke-linejoin='round' stroke-width='1.5' viewBox='0 0 24 24'%3E%3Cpath stroke='none' d='M0 0h24v24H0z'/%3E%3Cpath d='M11 7H6a2 2 0 0 0-2 2v9a2 2 0 0 0 2 2h9a2 2 0 0 0 2-2v-5M10 14 20 4M15 4h5v5'/%3E%3C/svg%3E");margin:0 .25rem;vertical-align:middle}.sidebar-tree .current-page>.reference{font-weight:700}.sidebar-tree label{align-items:center;cursor:pointer;display:flex;height:var(--sidebar-item-height);justify-content:center;position:absolute;right:0;top:0;-webkit-user-select:none;-moz-user-select:none;user-select:none;width:var(--sidebar-expander-width)}.sidebar-tree .caption,.sidebar-tree :not(.caption)>.caption-text{color:var(--color-sidebar-caption-text);font-size:var(--sidebar-caption-font-size);font-weight:700;margin:var(--sidebar-caption-space-above) 0 0 0;padding:var(--sidebar-item-spacing-vertical) var(--sidebar-item-spacing-horizontal);text-transform:uppercase}.sidebar-tree li.has-children>.reference{padding-right:var(--sidebar-expander-width)}.sidebar-tree .toctree-l1>.reference,.sidebar-tree .toctree-l1>label .icon{color:var(--color-sidebar-link-text--top-level)}.sidebar-tree label{background:var(--color-sidebar-item-expander-background)}.sidebar-tree label:hover{background:var(--color-sidebar-item-expander-background--hover)}.sidebar-tree .current>.reference{background:var(--color-sidebar-item-background--current)}.sidebar-tree .current>.reference:hover{background:var(--color-sidebar-item-background--hover)}.toctree-checkbox{display:none;position:absolute}.toctree-checkbox~ul{display:none}.toctree-checkbox~label .icon svg{transform:rotate(90deg)}.toctree-checkbox:checked~ul{display:block}.toctree-checkbox:checked~label .icon svg{transform:rotate(-90deg)}.toc-title-container{padding:var(--toc-title-padding);padding-top:var(--toc-spacing-vertical)}.toc-title{color:var(--color-toc-title-text);font-size:var(--toc-title-font-size);padding-left:var(--toc-spacing-horizontal);text-transform:uppercase}.no-toc{display:none}.toc-tree-container{padding-bottom:var(--toc-spacing-vertical)}.toc-tree{border-left:1px solid var(--color-background-border);font-size:var(--toc-font-size);line-height:1.3;padding-left:calc(var(--toc-spacing-horizontal) - var(--toc-item-spacing-horizontal))}.toc-tree>ul>li:first-child{padding-top:0}.toc-tree>ul>li:first-child>ul{padding-left:0}.toc-tree>ul>li:first-child>a{display:none}.toc-tree ul{list-style-type:none;margin-bottom:0;margin-top:0;padding-left:var(--toc-item-spacing-horizontal)}.toc-tree li{padding-top:var(--toc-item-spacing-vertical)}.toc-tree li.scroll-current>.reference{color:var(--color-toc-item-text--active);font-weight:700}.toc-tree a.reference{color:var(--color-toc-item-text);overflow-wrap:anywhere;text-decoration:none}.toc-scroll{max-height:100vh;overflow-y:scroll}.contents:not(.this-will-duplicate-information-and-it-is-still-useful-here){background:rgba(255,0,0,.25);color:var(--color-problematic)}.contents:not(.this-will-duplicate-information-and-it-is-still-useful-here):before{content:"ERROR: Adding a table of contents in Furo-based documentation is unnecessary, and does not work well with existing styling. Add a 'this-will-duplicate-information-and-it-is-still-useful-here' class, if you want an escape hatch."}.text-align\:left>p{text-align:left}.text-align\:center>p{text-align:center}.text-align\:right>p{text-align:right} +/*# sourceMappingURL=furo.css.map*/ \ No newline at end of file diff --git a/_static/styles/furo.css.map b/_static/styles/furo.css.map new file mode 100644 index 0000000..280b3fe --- /dev/null +++ b/_static/styles/furo.css.map @@ -0,0 +1 @@ +{"version":3,"file":"styles/furo.css","mappings":"AAAA,2EAA2E,CAU3E,KACE,gBAAiB,CACjB,6BACF,CASA,KACE,QACF,CAMA,KACE,aACF,CAOA,GACE,aAAc,CACd,cACF,CAUA,GACE,sBAAuB,CACvB,QAAS,CACT,gBACF,CAOA,IACE,+BAAiC,CACjC,aACF,CASA,EACE,4BACF,CAOA,YACE,kBAAmB,CACnB,yBAA0B,CAC1B,gCACF,CAMA,SAEE,kBACF,CAOA,cAGE,+BAAiC,CACjC,aACF,CAeA,QAEE,aAAc,CACd,aAAc,CACd,iBAAkB,CAClB,uBACF,CAEA,IACE,aACF,CAEA,IACE,SACF,CASA,IACE,iBACF,CAUA,sCAKE,mBAAoB,CACpB,cAAe,CACf,gBAAiB,CACjB,QACF,CAOA,aAEE,gBACF,CAOA,cAEE,mBACF,CAMA,gDAIE,yBACF,CAMA,wHAIE,iBAAkB,CAClB,SACF,CAMA,4GAIE,6BACF,CAMA,SACE,0BACF,CASA,OACE,qBAAsB,CACtB,aAAc,CACd,aAAc,CACd,cAAe,CACf,SAAU,CACV,kBACF,CAMA,SACE,uBACF,CAMA,SACE,aACF,CAOA,6BAEE,qBAAsB,CACtB,SACF,CAMA,kFAEE,WACF,CAOA,cACE,4BAA6B,CAC7B,mBACF,CAMA,yCACE,uBACF,CAOA,6BACE,yBAA0B,CAC1B,YACF,CASA,QACE,aACF,CAMA,QACE,iBACF,CAiBA,kBACE,YACF,CCvVA,aAcE,kEACE,uBAOF,WACE,iDAMF,kCACE,wBAEF,qCAEE,uBADA,uBACA,CAEF,SACE,wBAtBA,CCpBJ,iBAGE,qBAEA,sBACA,0BAFA,oBAHA,4BACA,oBAKA,6BAIA,2CAFA,mBACA,sCAFA,4BAGA,CAEF,gBACE,aCPF,KCCE,mHAGA,wGAGA,wCAAyC,CAEzC,wBAAyB,CACzB,wBAAyB,CACzB,4BAA6B,CAC7B,yBAA0B,CAC1B,2BAA4B,CAG5B,sDAAuD,CACvD,gDAAiD,CACjD,wDAAyD,CAGzD,0CAA2C,CAC3C,gDAAiD,CACjD,gDAAiD,CAKjD,gCAAiC,CACjC,sCAAuC,CAGvC,2CAA4C,CAG5C,uCAAwC,CCnCxC,+FAIA,uBAAwB,CAGxB,iCAAkC,CAClC,kCAAmC,CAEnC,+BAAgC,CAChC,sCAAuC,CACvC,sCAAuC,CACvC,qGAIA,mDAAoD,CAEpD,mCAAoC,CACpC,8CAA+C,CAC/C,gDAAiD,CACjD,kCAAmC,CACnC,6DAA8D,CAG9D,6BAA8B,CAC9B,6BAA8B,CAC9B,+BAAgC,CAChC,kCAAmC,CACnC,kCAAmC,CCRjC,+jBCaA,iqCAZF,iaCXA,8KAOA,4SAWA,4SAUA,0CACA,gEAGA,0CAGA,gEAGA,yCACA,+DAIA,4CACA,kEAGA,wCAUA,8DACA,uCAGA,4DACA,sCACA,2DAGA,4CACA,kEACA,uCAGA,6DACA,2GAGA,sHAEA,yFAEA,+CACA,+EAGA,4MAOA,gCACA,sHAIA,kCACA,uEACA,gEACA,4DACA,kEAGA,2DACA,sDACA,0CACA,8CACA,wGAGA,0BACA,iCAGA,+DACA,+BACA,sCACA,+DAEA,kGACA,oCACA,yDACA,sCL3HF,kCAEA,sDAIA,0CKyHE,kEAIA,oDACA,sDAGA,oCACA,oEAEA,0DACA,qDAIA,oDACA,6DAIA,iEAIA,2DAIA,2DAGA,4DACA,gEAIA,gEAEA,gFAEA,oNASA,qDLtKE,gFAGE,4DAIF,oEKgHF,yEAEA,6DAGA,0DAEA,uDACA,qDACA,wDAIA,6DAIA,yDACA,2DAIA,uCAGA,wCACA,sDAGA,+CAGA,6DAEA,iDACA,+DAEA,wDAEA,sEAMA,0DACA,sBACA,mEL5JI,wEAEA,iCACE,+BAMN,wEAGA,iCACE,kFAEA,uEAIF,gEACE,8BAGF,qEMzDA,sCAKA,wFAKA,iCAIA,0BAWA,iCACA,4BACA,mCAGA,+BAEA,sCACA,4BAEA,mCAEA,sCAKA,sDAIA,gCAEA,gEAQF,wCAME,sBACA,kCAKA,uBAEA,gEAIA,2BAIA,mCAEA,qCACA,iCAGE,+BACA,wEAEE,iCACA,kFAGF,6BACA,0CACF,kCAEE,8BACE,8BACA,qEAEE,sCACA,wFClFN,iCAGF,2DACE,4BACA,oCAKF,8BAGE,sCACA,+DAIA,sCAEA,sDAGA,gCACA,gEAGA,+CAEA,sBACE,yCAGF,uBACA,sEAIA,aAEA,mCAIA,kEACA,aACA,oEACA,YAIA,EAQE,4HAGA,gDACE,mBACA,wCAON,wCAGE,0DACA,mBAKA,mBACA,CANA,uCAKA,iBALA,iBAWA,mBAGF,mBACE,mDAIF,+BAEE,CAEA,yBAFA,kBAMA,CAJA,GACA,aAGA,mBAEF,wBAEE,iBACA,iBAEA,OACA,aAGF,CAHE,WAGF,GAEE,oBAEA,CAJF,gBAIE,aAEA,+CAKA,UANA,WACA,cADA,SAMA,WACA,iBAEE,GAMF,wBANE,yBAMF,kDACA,WAEA,gCACA,2DAGA,iBACE,uCAEJ,kEAIE,uCAGA,yDACE,cACA,+DAEA,yDAEE,mEAMJ,kEAMA,uBACA,kBAEA,uBACA,kDAKA,0DAIA,CALA,oBAKA,WACA,WAQA,4BAFF,0CAEE,CARA,qCAsBA,CAdA,iBAEA,kBACE,aADF,4BACE,WAMF,2BAGF,qCAEE,CAXE,UAWF,+BAGA,uBAEA,SAEA,0CAIE,CANF,qCAEA,CAIE,2DACE,gBAIN,+CAIA,CAEA,kDAKE,CAPF,8BAEA,CAOE,YACA,CAjBI,2BAGN,CAHM,WAcJ,UAGA,CAEA,2GAIF,iCAGE,8BAIA,qBACA,oBACF,uBAOI,0CAIA,CATF,6DAKE,CALF,sBASE,qCAKF,CACE,cACA,CAFF,sBAEE,CACA,+BAEA,qBAEE,WAKN,aACE,sCAGA,mBAEA,6BAMA,kCACA,CAJA,sBACA,aAEA,CAJA,eACA,MAIA,2FAEA,UAGA,YACA,sBACE,8BAEA,CALF,aACA,WAIE,OACA,oBAEF,uBACE,WAEF,YAFE,UAEF,eAgBA,kBACE,CAhBA,qDAQF,qCAGF,CAGI,YACF,CAJF,2BAGI,CAEA,eACA,qBAGA,mEAEA,qBACA,8BAIA,kBADF,kBACE,yBAEJ,oCAGI,qDAIJ,+BAGI,oCAEA,+CAQF,4CACE,yBACF,2BAOE,sBACA,CAHA,WACA,CAFF,cACE,CAJA,YAGF,CAEE,SAEA,mBAGA,kDAEE,CAJF,cAEA,cAEE,sBAEA,mBADA,YACA,uBACA,mDACE,CADF,YACE,iDAEA,uCAEN,+DAOE,mBADF,sBACE,mBAGF,aACE,sCAIA,aADF,WACE,CAKF,SACE,CAHJ,kBAEE,CAJE,gBAEJ,CAHI,iBAMA,yFAKA,aACA,eACA,cCxaJ,iBAEE,aADA,iBACA,6BAEA,kCAEA,SACA,UAIA,gCACA,CALA,SAEA,SAEA,CAJA,wEAEA,CAFA,OAKA,CAGA,mDACE,iBAGF,gCACE,CADF,UACE,aAEJ,iCAEE,CAFF,UAEE,wCAEA,WACA,WADA,UACA,CACA,4CAGA,MACA,CADA,KACA,wCACA,UAGA,CAJA,UAIA,6DAUA,0CACE,CAFF,mBAEE,wEACA,CAVA,YACA,CAMF,mBAJE,OAOA,gBAJJ,gCACE,CANE,cACA,CAHA,oBACA,CAGA,QAGJ,CAII,0BACA,CADA,UACA,wCAEJ,kBACE,0DACA,gCACE,kBACA,CADA,YACA,oEACA,2CAMF,mDAII,CALN,YACE,CANE,cAKJ,CACE,iBAII,kEACA,yCACE,kDACA,yDACE,+CACA,uBANN,CAMM,+BANN,uCACE,qDACA,4BAEE,mBADA,0CACA,CADA,qBACA,0DACE,wCACA,sGALJ,oCACA,sBACE,kBAFF,UAEE,2CACA,wFACE,cACA,kEANN,uBACE,iDACA,CADA,UACA,0DACE,wDAEE,iEACA,qEANN,sCACE,CAGE,iBAHF,gBAGE,qBACE,CAJJ,uBACA,gDACE,wDACA,6DAHF,2CACA,CADA,gBACA,eACE,CAGE,sBANN,8BACE,CAII,iBAFF,4DACA,WACE,YADF,uCACE,6EACA,2BANN,8CACE,kDACA,0CACE,8BACA,yFACE,sBACA,sFALJ,mEACA,sBACE,kEACA,6EACE,uCACA,kEALJ,qGAEE,kEACA,6EACE,uCACA,kEALJ,8CACA,uDACE,sEACA,2EACE,sCACA,iEALJ,mGACA,qCACE,oDACA,0DACE,6GACA,gDAGR,yDCvEA,sEACE,CACA,6GACE,gEACF,iGAIF,wFACE,qDAGA,mGAEE,2CAEF,4FACE,gCACF,wGACE,8DAEE,6FAIA,iJAKN,6GACE,gDAKF,yDACA,qCAGA,6BACA,kBACA,qDAKA,oCAEA,+DAGA,2CAGE,oDAIA,oEAEE,qBAGJ,wDAEE,uCAEF,kEAGA,8CAEA,uDAIF,gEAIE,6BACA,gEAIA,+CACE,0EAIF,sDAEE,+DAGF,sCACA,8BACE,oCAEJ,wBACE,4FAEE,gBAEJ,yGAGI,kBAGJ,CCnHE,2MCFF,oBAGE,wGAKA,iCACE,CADF,wBACE,8GAQA,mBCjBJ,2GAIE,mBACA,6HAMA,YACE,mIAYF,eACA,CAHF,YAGE,4FAGE,8BAKF,uBAkBE,sCACA,CADA,qBAbA,wCAIA,CALF,8BACE,CADF,gBAKE,wCACA,CAOA,kDACA,CACA,kCAKF,6BAGA,4CACE,kDACA,eAGF,cACE,aACA,iBACA,yBACA,8BACA,WAGJ,2BACE,cAGA,+BACA,CAHA,eAGA,wCACA,YACA,iBACA,uEAGA,0BACA,2CAEA,8EAGI,qBACA,CAFF,kBAEE,4DAMJ,mCACE,4BAGA,oBAGF,4CACE,qCACA,8BACA,gBACA,+CAEA,iCAEF,iCACE,oBACA,4CACA,qCAGF,8BAEE,+BAEA,WAEA,8BACE,oBACA,CADA,gBACA,yBAKF,gBADF,YACE,CACA,iBACA,qDAEA,mDCvIJ,2FAMA,iCACE,CACA,eAEA,CAFA,mBADA,wBAIA,8BACA,gBADA,YACA,0BAEE,8CAGA,wDAIE,gFAGE,iBAEN,wCAKF,+CACE,CACA,oDAEF,kDAIE,YAEF,CAHE,YAGF,CCpCE,mFAFA,QACA,UAIA,CAHA,IAGA,gDAGE,eACA,iEAGF,wBAEE,mBAMA,6CAEF,CAJE,mBACA,CAGF,kCAGE,CARF,kBACE,CAHA,eAUA,YACA,mBACA,CAFA,UAEA,wCC/BJ,mBACE,CDkCE,wBACA,sBCpCJ,iBACE,mDACA,2CACA,sBAGA,qBCDA,6CAIE,CATJ,uBAKE,CDGE,oBACF,yDAEE,CCDE,2CAGF,CAJA,kCACE,CDJJ,aAKE,eCXJ,CDME,uBCOE,gCACE,YAEF,2CAEE,wBACA,0BAIF,iBAEA,cADF,UACE,uBAEA,iCAEA,wCAEA,6CAMA,CAYF,gCATI,4BASJ,CAZE,mCAEE,iCAUJ,4BAGE,4DADA,+BACA,CAHF,qBAGE,sCACE,OAEF,iBAHA,SAGA,iHACE,2DAKF,CANA,8EAMA,uSAEE,kBAEF,+FACE,yCCjEJ,WACA,yBAGA,uBACA,gBAEA,uCAIA,CAJA,iCAIA,uCAGA,UACE,gBACA,qBAEA,0CClBJ,gBACE,KAGF,qBACE,YAGF,CAHE,cAGF,gCAEE,mBACA,iEAEA,oCACA,wCAEA,sBACA,WAEA,CAFA,YAEA,8EAEA,mCAFA,iBAEA,6BAIA,wEAKA,sDAIE,CARF,mDAIA,CAIE,cAEF,8CAIA,oBAFE,iBAEF,8CAGE,eAEF,CAFE,YAEF,OAEE,kBAGJ,CAJI,eACA,CAFF,mBAKF,yCCjDE,oBACA,CAFA,iBAEA,uCAKE,iBACA,qCAGA,mBCZJ,CDWI,gBCXJ,6BAEE,eACA,sBAGA,eAEA,sBACA,oDACA,iGAMA,gBAFE,YAEF,8FAME,iJCnBF,YACA,gNAWE,gDAEF,iSAaE,kBACE,gHAKF,oCACE,eACF,CADE,UACF,8CACE,gDACF,wCACE,oBCtCJ,oBAEF,6BACE,QACE,kDAGF,yBACE,kDAmBA,kDAEF,CAhBA,+CAaA,CAbA,oBAaA,0FACE,CADF,gGAfF,cACE,gBACA,CAaA,0BAGA,mQACE,gBAGF,oMACE,iBACA,CAFF,eACE,CADF,gBAEE,aAGJ,iCAEE,CAFF,wCAEE,wBAUE,+VAIE,uEAHA,2BAGA,wXAKJ,iDAGF,CARM,+CACE,iDAIN,CALI,gBAQN,mHACE,gBAGF,2DACE,0EAOA,0EAGF,gBAEE,6DCjFA,kDACA,gCACA,qDAGA,qBACA,qDCDA,cACA,eAEA,yBAGF,sBAEE,iBACA,sNAWA,iBACE,kBACA,wRAgBA,kBAEA,iOAgBA,uCACE,uEAEA,kBAEF,qUAuBE,iDAIJ,CACA,geCzFF,4BAEE,CAQA,6JACA,iDAIA,sEAGA,mDAOF,iDAGE,4DAIA,8CACA,qDAEE,eAFF,cAEE,oBAEF,uBAFE,kCAGA,eACA,iBACA,mBAIA,mDACA,CAHA,uCAEA,CAJA,0CACA,CAIA,gBAJA,gBACA,oBADA,gBAIA,wBAEJ,gBAGE,6BACA,YAHA,iBAGA,gCACA,iEAEA,6CACA,sDACA,0BADA,wBACA,0BACA,oIAIA,mBAFA,YAEA,qBACA,0CAIE,uBAEF,CAHA,yBACE,CAEF,iDACE,mFAKJ,oCACE,CANE,aAKJ,CACE,qEAIA,YAFA,WAEA,CAHA,aACA,CAEA,gBACE,4BACA,sBADA,aACA,gCAMF,oCACA,yDACA,2CAEA,qBAGE,kBAEA,CACA,mCAIF,CARE,YACA,CAOF,iCAEE,CAPA,oBACA,CAQA,oBACE,uDAEJ,sDAGA,CAHA,cAGA,0BACE,oDAIA,oCACA,4BACA,sBAGA,cAEA,oFAGA,sBAEA,yDACE,CAIF,iBAJE,wBAIF,6CAHE,6CAKA,eACA,aACA,CADA,cACA,yCAGJ,kBACE,CAKA,iDAEA,CARF,aACE,4CAGA,kBAIA,wEAGA,wDAGA,kCAOA,iDAGA,CAPF,WAEE,sCAEA,CAJF,2CACE,CAMA,qCACA,+BARF,kBACE,qCAOA,iBAsBA,sBACE,CAvBF,WAKA,CACE,0DAIF,CALA,uDACE,CANF,sBAqBA,4CACA,CALA,gRAIA,YAEE,6CAEN,mCAEE,+CASA,6EAIA,4BChNA,SDmNA,qFCnNA,gDACA,sCAGA,qCACA,sDACA,CAKA,kDAGA,CARA,0CAQA,kBAGA,YACA,sBACA,iBAFA,gBADF,YACE,CAHA,SAKA,kBAEA,SAFA,iBAEA,uEAGA,CAEE,6CAFF,oCAgBI,CAdF,yBACE,qBACF,CAGF,oBACE,CAIF,WACE,CALA,2CAGA,uBACF,CACE,mFAGE,CALF,qBAEA,UAGE,gCAIF,sDAEA,CALE,oCAKF,yCC7CJ,oCACE,CD+CA,yXAQE,sCCrDJ,wCAGA,oCACE","sources":["webpack:///./node_modules/normalize.css/normalize.css","webpack:///./src/furo/assets/styles/base/_print.sass","webpack:///./src/furo/assets/styles/base/_screen-readers.sass","webpack:///./src/furo/assets/styles/base/_theme.sass","webpack:///./src/furo/assets/styles/variables/_fonts.scss","webpack:///./src/furo/assets/styles/variables/_spacing.scss","webpack:///./src/furo/assets/styles/variables/_icons.scss","webpack:///./src/furo/assets/styles/variables/_admonitions.scss","webpack:///./src/furo/assets/styles/variables/_colors.scss","webpack:///./src/furo/assets/styles/base/_typography.sass","webpack:///./src/furo/assets/styles/_scaffold.sass","webpack:///./src/furo/assets/styles/content/_admonitions.sass","webpack:///./src/furo/assets/styles/content/_api.sass","webpack:///./src/furo/assets/styles/content/_blocks.sass","webpack:///./src/furo/assets/styles/content/_captions.sass","webpack:///./src/furo/assets/styles/content/_code.sass","webpack:///./src/furo/assets/styles/content/_footnotes.sass","webpack:///./src/furo/assets/styles/content/_images.sass","webpack:///./src/furo/assets/styles/content/_indexes.sass","webpack:///./src/furo/assets/styles/content/_lists.sass","webpack:///./src/furo/assets/styles/content/_math.sass","webpack:///./src/furo/assets/styles/content/_misc.sass","webpack:///./src/furo/assets/styles/content/_rubrics.sass","webpack:///./src/furo/assets/styles/content/_sidebar.sass","webpack:///./src/furo/assets/styles/content/_tables.sass","webpack:///./src/furo/assets/styles/content/_target.sass","webpack:///./src/furo/assets/styles/content/_gui-labels.sass","webpack:///./src/furo/assets/styles/components/_footer.sass","webpack:///./src/furo/assets/styles/components/_sidebar.sass","webpack:///./src/furo/assets/styles/components/_table_of_contents.sass","webpack:///./src/furo/assets/styles/_shame.sass"],"sourcesContent":["/*! normalize.css v8.0.1 | MIT License | github.com/necolas/normalize.css */\n\n/* Document\n ========================================================================== */\n\n/**\n * 1. Correct the line height in all browsers.\n * 2. Prevent adjustments of font size after orientation changes in iOS.\n */\n\nhtml {\n line-height: 1.15; /* 1 */\n -webkit-text-size-adjust: 100%; /* 2 */\n}\n\n/* Sections\n ========================================================================== */\n\n/**\n * Remove the margin in all browsers.\n */\n\nbody {\n margin: 0;\n}\n\n/**\n * Render the `main` element consistently in IE.\n */\n\nmain {\n display: block;\n}\n\n/**\n * Correct the font size and margin on `h1` elements within `section` and\n * `article` contexts in Chrome, Firefox, and Safari.\n */\n\nh1 {\n font-size: 2em;\n margin: 0.67em 0;\n}\n\n/* Grouping content\n ========================================================================== */\n\n/**\n * 1. Add the correct box sizing in Firefox.\n * 2. Show the overflow in Edge and IE.\n */\n\nhr {\n box-sizing: content-box; /* 1 */\n height: 0; /* 1 */\n overflow: visible; /* 2 */\n}\n\n/**\n * 1. Correct the inheritance and scaling of font size in all browsers.\n * 2. Correct the odd `em` font sizing in all browsers.\n */\n\npre {\n font-family: monospace, monospace; /* 1 */\n font-size: 1em; /* 2 */\n}\n\n/* Text-level semantics\n ========================================================================== */\n\n/**\n * Remove the gray background on active links in IE 10.\n */\n\na {\n background-color: transparent;\n}\n\n/**\n * 1. Remove the bottom border in Chrome 57-\n * 2. Add the correct text decoration in Chrome, Edge, IE, Opera, and Safari.\n */\n\nabbr[title] {\n border-bottom: none; /* 1 */\n text-decoration: underline; /* 2 */\n text-decoration: underline dotted; /* 2 */\n}\n\n/**\n * Add the correct font weight in Chrome, Edge, and Safari.\n */\n\nb,\nstrong {\n font-weight: bolder;\n}\n\n/**\n * 1. Correct the inheritance and scaling of font size in all browsers.\n * 2. Correct the odd `em` font sizing in all browsers.\n */\n\ncode,\nkbd,\nsamp {\n font-family: monospace, monospace; /* 1 */\n font-size: 1em; /* 2 */\n}\n\n/**\n * Add the correct font size in all browsers.\n */\n\nsmall {\n font-size: 80%;\n}\n\n/**\n * Prevent `sub` and `sup` elements from affecting the line height in\n * all browsers.\n */\n\nsub,\nsup {\n font-size: 75%;\n line-height: 0;\n position: relative;\n vertical-align: baseline;\n}\n\nsub {\n bottom: -0.25em;\n}\n\nsup {\n top: -0.5em;\n}\n\n/* Embedded content\n ========================================================================== */\n\n/**\n * Remove the border on images inside links in IE 10.\n */\n\nimg {\n border-style: none;\n}\n\n/* Forms\n ========================================================================== */\n\n/**\n * 1. Change the font styles in all browsers.\n * 2. Remove the margin in Firefox and Safari.\n */\n\nbutton,\ninput,\noptgroup,\nselect,\ntextarea {\n font-family: inherit; /* 1 */\n font-size: 100%; /* 1 */\n line-height: 1.15; /* 1 */\n margin: 0; /* 2 */\n}\n\n/**\n * Show the overflow in IE.\n * 1. Show the overflow in Edge.\n */\n\nbutton,\ninput { /* 1 */\n overflow: visible;\n}\n\n/**\n * Remove the inheritance of text transform in Edge, Firefox, and IE.\n * 1. Remove the inheritance of text transform in Firefox.\n */\n\nbutton,\nselect { /* 1 */\n text-transform: none;\n}\n\n/**\n * Correct the inability to style clickable types in iOS and Safari.\n */\n\nbutton,\n[type=\"button\"],\n[type=\"reset\"],\n[type=\"submit\"] {\n -webkit-appearance: button;\n}\n\n/**\n * Remove the inner border and padding in Firefox.\n */\n\nbutton::-moz-focus-inner,\n[type=\"button\"]::-moz-focus-inner,\n[type=\"reset\"]::-moz-focus-inner,\n[type=\"submit\"]::-moz-focus-inner {\n border-style: none;\n padding: 0;\n}\n\n/**\n * Restore the focus styles unset by the previous rule.\n */\n\nbutton:-moz-focusring,\n[type=\"button\"]:-moz-focusring,\n[type=\"reset\"]:-moz-focusring,\n[type=\"submit\"]:-moz-focusring {\n outline: 1px dotted ButtonText;\n}\n\n/**\n * Correct the padding in Firefox.\n */\n\nfieldset {\n padding: 0.35em 0.75em 0.625em;\n}\n\n/**\n * 1. Correct the text wrapping in Edge and IE.\n * 2. Correct the color inheritance from `fieldset` elements in IE.\n * 3. Remove the padding so developers are not caught out when they zero out\n * `fieldset` elements in all browsers.\n */\n\nlegend {\n box-sizing: border-box; /* 1 */\n color: inherit; /* 2 */\n display: table; /* 1 */\n max-width: 100%; /* 1 */\n padding: 0; /* 3 */\n white-space: normal; /* 1 */\n}\n\n/**\n * Add the correct vertical alignment in Chrome, Firefox, and Opera.\n */\n\nprogress {\n vertical-align: baseline;\n}\n\n/**\n * Remove the default vertical scrollbar in IE 10+.\n */\n\ntextarea {\n overflow: auto;\n}\n\n/**\n * 1. Add the correct box sizing in IE 10.\n * 2. Remove the padding in IE 10.\n */\n\n[type=\"checkbox\"],\n[type=\"radio\"] {\n box-sizing: border-box; /* 1 */\n padding: 0; /* 2 */\n}\n\n/**\n * Correct the cursor style of increment and decrement buttons in Chrome.\n */\n\n[type=\"number\"]::-webkit-inner-spin-button,\n[type=\"number\"]::-webkit-outer-spin-button {\n height: auto;\n}\n\n/**\n * 1. Correct the odd appearance in Chrome and Safari.\n * 2. Correct the outline style in Safari.\n */\n\n[type=\"search\"] {\n -webkit-appearance: textfield; /* 1 */\n outline-offset: -2px; /* 2 */\n}\n\n/**\n * Remove the inner padding in Chrome and Safari on macOS.\n */\n\n[type=\"search\"]::-webkit-search-decoration {\n -webkit-appearance: none;\n}\n\n/**\n * 1. Correct the inability to style clickable types in iOS and Safari.\n * 2. Change font properties to `inherit` in Safari.\n */\n\n::-webkit-file-upload-button {\n -webkit-appearance: button; /* 1 */\n font: inherit; /* 2 */\n}\n\n/* Interactive\n ========================================================================== */\n\n/*\n * Add the correct display in Edge, IE 10+, and Firefox.\n */\n\ndetails {\n display: block;\n}\n\n/*\n * Add the correct display in all browsers.\n */\n\nsummary {\n display: list-item;\n}\n\n/* Misc\n ========================================================================== */\n\n/**\n * Add the correct display in IE 10+.\n */\n\ntemplate {\n display: none;\n}\n\n/**\n * Add the correct display in IE 10.\n */\n\n[hidden] {\n display: none;\n}\n","// This file contains styles for managing print media.\n\n////////////////////////////////////////////////////////////////////////////////\n// Hide elements not relevant to print media.\n////////////////////////////////////////////////////////////////////////////////\n@media print\n // Hide icon container.\n .content-icon-container\n display: none !important\n\n // Hide showing header links if hovering over when printing.\n .headerlink\n display: none !important\n\n // Hide mobile header.\n .mobile-header\n display: none !important\n\n // Hide navigation links.\n .related-pages\n display: none !important\n\n////////////////////////////////////////////////////////////////////////////////\n// Tweaks related to decolorization.\n////////////////////////////////////////////////////////////////////////////////\n@media print\n // Apply a border around code which no longer have a color background.\n .highlight\n border: 0.1pt solid var(--color-foreground-border)\n\n////////////////////////////////////////////////////////////////////////////////\n// Avoid page break in some relevant cases.\n////////////////////////////////////////////////////////////////////////////////\n@media print\n ul, ol, dl, a, table, pre, blockquote, p\n page-break-inside: avoid\n\n h1, h2, h3, h4, h5, h6, img, figure, caption\n page-break-inside: avoid\n page-break-after: avoid\n\n ul, ol, dl\n page-break-before: avoid\n",".visually-hidden\n position: absolute !important\n width: 1px !important\n height: 1px !important\n padding: 0 !important\n margin: -1px !important\n overflow: hidden !important\n clip: rect(0,0,0,0) !important\n white-space: nowrap !important\n border: 0 !important\n color: var(--color-foreground-primary)\n background: var(--color-background-primary)\n\n:-moz-focusring\n outline: auto\n","// This file serves as the \"skeleton\" of the theming logic.\n//\n// This contains the bulk of the logic for handling dark mode, color scheme\n// toggling and the handling of color-scheme-specific hiding of elements.\n\n@use \"../variables\" as *\n\nbody\n @include fonts\n @include spacing\n @include icons\n @include admonitions\n @include default-admonition(#651fff, \"abstract\")\n @include default-topic(#14B8A6, \"pencil\")\n\n @include colors\n\n.only-light\n display: block !important\nhtml body .only-dark\n display: none !important\n\n// Ignore dark-mode hints if print media.\n@media not print\n // Enable dark-mode, if requested.\n body[data-theme=\"dark\"]\n @include colors-dark\n\n html & .only-light\n display: none !important\n .only-dark\n display: block !important\n\n // Enable dark mode, unless explicitly told to avoid.\n @media (prefers-color-scheme: dark)\n body:not([data-theme=\"light\"])\n @include colors-dark\n\n html & .only-light\n display: none !important\n .only-dark\n display: block !important\n\n//\n// Theme toggle presentation\n//\nbody[data-theme=\"auto\"]\n .theme-toggle svg.theme-icon-when-auto-light\n display: block\n\n @media (prefers-color-scheme: dark)\n .theme-toggle svg.theme-icon-when-auto-dark\n display: block\n .theme-toggle svg.theme-icon-when-auto-light\n display: none\n\nbody[data-theme=\"dark\"]\n .theme-toggle svg.theme-icon-when-dark\n display: block\n\nbody[data-theme=\"light\"]\n .theme-toggle svg.theme-icon-when-light\n display: block\n","// Fonts used by this theme.\n//\n// There are basically two things here -- using the system font stack and\n// defining sizes for various elements in %ages. We could have also used `em`\n// but %age is easier to reason about for me.\n\n@mixin fonts {\n // These are adapted from https://systemfontstack.com/\n --font-stack:\n -apple-system, BlinkMacSystemFont, Segoe UI, Helvetica, Arial, sans-serif,\n Apple Color Emoji, Segoe UI Emoji;\n --font-stack--monospace:\n \"SFMono-Regular\", Menlo, Consolas, Monaco, Liberation Mono, Lucida Console,\n monospace;\n --font-stack--headings: var(--font-stack);\n\n --font-size--normal: 100%;\n --font-size--small: 87.5%;\n --font-size--small--2: 81.25%;\n --font-size--small--3: 75%;\n --font-size--small--4: 62.5%;\n\n // Sidebar\n --sidebar-caption-font-size: var(--font-size--small--2);\n --sidebar-item-font-size: var(--font-size--small);\n --sidebar-search-input-font-size: var(--font-size--small);\n\n // Table of Contents\n --toc-font-size: var(--font-size--small--3);\n --toc-font-size--mobile: var(--font-size--normal);\n --toc-title-font-size: var(--font-size--small--4);\n\n // Admonitions\n //\n // These aren't defined in terms of %ages, since nesting these is permitted.\n --admonition-font-size: 0.8125rem;\n --admonition-title-font-size: 0.8125rem;\n\n // Code\n --code-font-size: var(--font-size--small--2);\n\n // API\n --api-font-size: var(--font-size--small);\n}\n","// Spacing for various elements on the page\n//\n// If the user wants to tweak things in a certain way, they are permitted to.\n// They also have to deal with the consequences though!\n\n@mixin spacing {\n // Header!\n --header-height: calc(\n var(--sidebar-item-line-height) + 4 *\n #{var(--sidebar-item-spacing-vertical)}\n );\n --header-padding: 0.5rem;\n\n // Sidebar\n --sidebar-tree-space-above: 1.5rem;\n --sidebar-caption-space-above: 1rem;\n\n --sidebar-item-line-height: 1rem;\n --sidebar-item-spacing-vertical: 0.5rem;\n --sidebar-item-spacing-horizontal: 1rem;\n --sidebar-item-height: calc(\n var(--sidebar-item-line-height) + 2 *#{var(--sidebar-item-spacing-vertical)}\n );\n\n --sidebar-expander-width: var(--sidebar-item-height); // be square\n\n --sidebar-search-space-above: 0.5rem;\n --sidebar-search-input-spacing-vertical: 0.5rem;\n --sidebar-search-input-spacing-horizontal: 0.5rem;\n --sidebar-search-input-height: 1rem;\n --sidebar-search-icon-size: var(--sidebar-search-input-height);\n\n // Table of Contents\n --toc-title-padding: 0.25rem 0;\n --toc-spacing-vertical: 1.5rem;\n --toc-spacing-horizontal: 1.5rem;\n --toc-item-spacing-vertical: 0.4rem;\n --toc-item-spacing-horizontal: 1rem;\n}\n","// Expose theme icons as CSS variables.\n\n$icons: (\n // Adapted from tabler-icons\n // url: https://tablericons.com/\n \"search\":\n url('data:image/svg+xml;charset=utf-8,'),\n // Factored out from mkdocs-material on 24-Aug-2020.\n // url: https://squidfunk.github.io/mkdocs-material/reference/admonitions/\n \"pencil\":\n url('data:image/svg+xml;charset=utf-8,'),\n \"abstract\":\n url('data:image/svg+xml;charset=utf-8,'),\n \"info\":\n url('data:image/svg+xml;charset=utf-8,'),\n \"flame\":\n url('data:image/svg+xml;charset=utf-8,'),\n \"question\":\n url('data:image/svg+xml;charset=utf-8,'),\n \"warning\":\n url('data:image/svg+xml;charset=utf-8,'),\n \"failure\":\n url('data:image/svg+xml;charset=utf-8,'),\n \"spark\":\n url('data:image/svg+xml;charset=utf-8,')\n);\n\n@mixin icons {\n @each $name, $glyph in $icons {\n --icon-#{$name}: #{$glyph};\n }\n}\n","@use \"sass:list\";\n// Admonitions\n\n// Structure of these is:\n// admonition-class: color \"icon-name\";\n//\n// The colors are translated into CSS variables below. The icons are\n// used directly in the main declarations to set the `mask-image` in\n// the title.\n\n// prettier-ignore\n$admonitions: (\n // Each of these has an reST directives for it.\n \"caution\": #ff9100 \"spark\",\n \"warning\": #ff9100 \"warning\",\n \"danger\": #ff5252 \"spark\",\n \"attention\": #ff5252 \"warning\",\n \"error\": #ff5252 \"failure\",\n \"hint\": #00c852 \"question\",\n \"tip\": #00c852 \"info\",\n \"important\": #00bfa5 \"flame\",\n \"note\": #00b0ff \"pencil\",\n \"seealso\": #448aff \"info\",\n \"admonition-todo\": #808080 \"pencil\"\n);\n\n@mixin default-admonition($color, $icon-name) {\n --color-admonition-title: #{$color};\n --color-admonition-title-background: #{rgba($color, 0.2)};\n\n --icon-admonition-default: var(--icon-#{$icon-name});\n}\n\n@mixin default-topic($color, $icon-name) {\n --color-topic-title: #{$color};\n --color-topic-title-background: #{rgba($color, 0.2)};\n\n --icon-topic-default: var(--icon-#{$icon-name});\n}\n\n@mixin admonitions {\n @each $name, $values in $admonitions {\n --color-admonition-title--#{$name}: #{list.nth($values, 1)};\n --color-admonition-title-background--#{$name}: #{rgba(\n list.nth($values, 1),\n 0.2\n )};\n }\n}\n","// Colors used throughout this theme.\n//\n// The aim is to give the user more control. Thus, instead of hard-coding colors\n// in various parts of the stylesheet, the approach taken is to define all\n// colors as CSS variables and reusing them in all the places.\n//\n// `colors-dark` depends on `colors` being included at a lower specificity.\n\n@mixin colors {\n --color-problematic: #b30000;\n\n // Base Colors\n --color-foreground-primary: black; // for main text and headings\n --color-foreground-secondary: #5a5c63; // for secondary text\n --color-foreground-muted: #6b6f76; // for muted text\n --color-foreground-border: #878787; // for content borders\n\n --color-background-primary: white; // for content\n --color-background-secondary: #f8f9fb; // for navigation + ToC\n --color-background-hover: #efeff4ff; // for navigation-item hover\n --color-background-hover--transparent: #efeff400;\n --color-background-border: #eeebee; // for UI borders\n --color-background-item: #ccc; // for \"background\" items (eg: copybutton)\n\n // Announcements\n --color-announcement-background: #000000dd;\n --color-announcement-text: #eeebee;\n\n // Brand colors\n --color-brand-primary: #0a4bff;\n --color-brand-content: #2757dd;\n --color-brand-visited: #872ee0;\n\n // API documentation\n --color-api-background: var(--color-background-hover--transparent);\n --color-api-background-hover: var(--color-background-hover);\n --color-api-overall: var(--color-foreground-secondary);\n --color-api-name: var(--color-problematic);\n --color-api-pre-name: var(--color-problematic);\n --color-api-paren: var(--color-foreground-secondary);\n --color-api-keyword: var(--color-foreground-primary);\n\n --color-api-added: #21632c;\n --color-api-added-border: #38a84d;\n --color-api-changed: #046172;\n --color-api-changed-border: #06a1bc;\n --color-api-deprecated: #605706;\n --color-api-deprecated-border: #f0d90f;\n --color-api-removed: #b30000;\n --color-api-removed-border: #ff5c5c;\n\n --color-highlight-on-target: #ffffcc;\n\n // Inline code background\n --color-inline-code-background: var(--color-background-secondary);\n\n // Highlighted text (search)\n --color-highlighted-background: #ddeeff;\n --color-highlighted-text: var(--color-foreground-primary);\n\n // GUI Labels\n --color-guilabel-background: #ddeeff80;\n --color-guilabel-border: #bedaf580;\n --color-guilabel-text: var(--color-foreground-primary);\n\n // Admonitions!\n --color-admonition-background: transparent;\n\n //////////////////////////////////////////////////////////////////////////////\n // Everything below this should be one of:\n // - var(...)\n // - *-gradient(...)\n // - special literal values (eg: transparent, none)\n //////////////////////////////////////////////////////////////////////////////\n\n // Tables\n --color-table-header-background: var(--color-background-secondary);\n --color-table-border: var(--color-background-border);\n\n // Cards\n --color-card-border: var(--color-background-secondary);\n --color-card-background: transparent;\n --color-card-marginals-background: var(--color-background-secondary);\n\n // Header\n --color-header-background: var(--color-background-primary);\n --color-header-border: var(--color-background-border);\n --color-header-text: var(--color-foreground-primary);\n\n // Sidebar (left)\n --color-sidebar-background: var(--color-background-secondary);\n --color-sidebar-background-border: var(--color-background-border);\n\n --color-sidebar-brand-text: var(--color-foreground-primary);\n --color-sidebar-caption-text: var(--color-foreground-muted);\n --color-sidebar-link-text: var(--color-foreground-secondary);\n --color-sidebar-link-text--top-level: var(--color-brand-primary);\n\n --color-sidebar-item-background: var(--color-sidebar-background);\n --color-sidebar-item-background--current: var(\n --color-sidebar-item-background\n );\n --color-sidebar-item-background--hover: linear-gradient(\n 90deg,\n var(--color-background-hover--transparent) 0%,\n var(--color-background-hover) var(--sidebar-item-spacing-horizontal),\n var(--color-background-hover) 100%\n );\n\n --color-sidebar-item-expander-background: transparent;\n --color-sidebar-item-expander-background--hover: var(\n --color-background-hover\n );\n\n --color-sidebar-search-text: var(--color-foreground-primary);\n --color-sidebar-search-background: var(--color-background-secondary);\n --color-sidebar-search-background--focus: var(--color-background-primary);\n --color-sidebar-search-border: var(--color-background-border);\n --color-sidebar-search-icon: var(--color-foreground-muted);\n\n // Table of Contents (right)\n --color-toc-background: var(--color-background-primary);\n --color-toc-title-text: var(--color-foreground-muted);\n --color-toc-item-text: var(--color-foreground-secondary);\n --color-toc-item-text--hover: var(--color-foreground-primary);\n --color-toc-item-text--active: var(--color-brand-primary);\n\n // Actual page contents\n --color-content-foreground: var(--color-foreground-primary);\n --color-content-background: transparent;\n\n // Links\n --color-link: var(--color-brand-content);\n --color-link-underline: var(--color-background-border);\n --color-link--hover: var(--color-brand-content);\n --color-link-underline--hover: var(--color-foreground-border);\n\n --color-link--visited: var(--color-brand-visited);\n --color-link-underline--visited: var(--color-background-border);\n --color-link--visited--hover: var(--color-brand-visited);\n --color-link-underline--visited--hover: var(--color-foreground-border);\n}\n\n@mixin colors-dark {\n --color-problematic: #ee5151;\n\n // Base Colors\n --color-foreground-primary: #cfd0d0; // for main text and headings\n --color-foreground-secondary: #9ca0a5; // for secondary text\n --color-foreground-muted: #81868d; // for muted text\n --color-foreground-border: #666666; // for content borders\n\n --color-background-primary: #131416; // for content\n --color-background-secondary: #1a1c1e; // for navigation + ToC\n --color-background-hover: #1e2124ff; // for navigation-item hover\n --color-background-hover--transparent: #1e212400;\n --color-background-border: #303335; // for UI borders\n --color-background-item: #444; // for \"background\" items (eg: copybutton)\n\n // Announcements\n --color-announcement-background: #000000dd;\n --color-announcement-text: #eeebee;\n\n // Brand colors\n --color-brand-primary: #3d94ff;\n --color-brand-content: #5ca5ff;\n --color-brand-visited: #b27aeb;\n\n // Highlighted text (search)\n --color-highlighted-background: #083563;\n\n // GUI Labels\n --color-guilabel-background: #08356380;\n --color-guilabel-border: #13395f80;\n\n // API documentation\n --color-api-keyword: var(--color-foreground-secondary);\n --color-highlight-on-target: #333300;\n\n --color-api-added: #3db854;\n --color-api-added-border: #267334;\n --color-api-changed: #09b0ce;\n --color-api-changed-border: #056d80;\n --color-api-deprecated: #b1a10b;\n --color-api-deprecated-border: #6e6407;\n --color-api-removed: #ff7575;\n --color-api-removed-border: #b03b3b;\n\n // Admonitions\n --color-admonition-background: #18181a;\n\n // Cards\n --color-card-border: var(--color-background-secondary);\n --color-card-background: #18181a;\n --color-card-marginals-background: var(--color-background-hover);\n}\n","// This file contains the styling for making the content throughout the page,\n// including fonts, paragraphs, headings and spacing among these elements.\n\nbody\n font-family: var(--font-stack)\npre,\ncode,\nkbd,\nsamp\n font-family: var(--font-stack--monospace)\n\n// Make fonts look slightly nicer.\nbody\n -webkit-font-smoothing: antialiased\n -moz-osx-font-smoothing: grayscale\n\n// Line height from Bootstrap 4.1\narticle\n line-height: 1.5\n\n//\n// Headings\n//\nh1,\nh2,\nh3,\nh4,\nh5,\nh6\n line-height: 1.25\n font-family: var(--font-stack--headings)\n font-weight: bold\n\n border-radius: 0.5rem\n margin-top: 0.5rem\n margin-bottom: 0.5rem\n margin-left: -0.5rem\n margin-right: -0.5rem\n padding-left: 0.5rem\n padding-right: 0.5rem\n\n + p\n margin-top: 0\n\nh1\n font-size: 2.5em\n margin-top: 1.75rem\n margin-bottom: 1rem\nh2\n font-size: 2em\n margin-top: 1.75rem\nh3\n font-size: 1.5em\nh4\n font-size: 1.25em\nh5\n font-size: 1.125em\nh6\n font-size: 1em\n\nsmall\n opacity: 75%\n font-size: 80%\n\n// Paragraph\np\n margin-top: 0.5rem\n margin-bottom: 0.75rem\n\n// Horizontal rules\nhr.docutils\n height: 1px\n padding: 0\n margin: 2rem 0\n background-color: var(--color-background-border)\n border: 0\n\n.centered\n text-align: center\n\n// Links\na\n text-decoration: underline\n\n color: var(--color-link)\n text-decoration-color: var(--color-link-underline)\n\n &:visited\n color: var(--color-link--visited)\n text-decoration-color: var(--color-link-underline--visited)\n &:hover\n color: var(--color-link--visited--hover)\n text-decoration-color: var(--color-link-underline--visited--hover)\n\n &:hover\n color: var(--color-link--hover)\n text-decoration-color: var(--color-link-underline--hover)\n &.muted-link\n color: inherit\n &:hover\n color: var(--color-link--hover)\n text-decoration-color: var(--color-link-underline--hover)\n &:visited\n color: var(--color-link--visited--hover)\n text-decoration-color: var(--color-link-underline--visited--hover)\n","// This file contains the styles for the overall layouting of the documentation\n// skeleton, including the responsive changes as well as sidebar toggles.\n//\n// This is implemented as a mobile-last design, which isn't ideal, but it is\n// reasonably good-enough and I got pretty tired by the time I'd finished this\n// to move the rules around to fix this. Shouldn't take more than 3-4 hours,\n// if you know what you're doing tho.\n\n// HACK: Not all browsers account for the scrollbar width in media queries.\n// This results in horizontal scrollbars in the breakpoint where we go\n// from displaying everything to hiding the ToC. We accomodate for this by\n// adding a bit of padding to the TOC drawer, disabling the horizontal\n// scrollbar and allowing the scrollbars to cover the padding.\n// https://www.456bereastreet.com/archive/201301/media_query_width_and_vertical_scrollbars/\n\n// HACK: Always having the scrollbar visible, prevents certain browsers from\n// causing the content to stutter horizontally between taller-than-viewport and\n// not-taller-than-viewport pages.\n@use \"variables\" as *\n\nhtml\n overflow-x: hidden\n overflow-y: scroll\n scroll-behavior: smooth\n\n.sidebar-scroll, .toc-scroll, article[role=main] *\n scrollbar-width: thin\n scrollbar-color: var(--color-foreground-border) transparent\n\n//\n// Overalls\n//\nhtml,\nbody\n height: 100%\n color: var(--color-foreground-primary)\n background: var(--color-background-primary)\n\n.skip-to-content\n position: fixed\n padding: 1rem\n border-radius: 1rem\n left: 0.25rem\n top: 0.25rem\n z-index: 40\n background: var(--color-background-primary)\n color: var(--color-foreground-primary)\n\n transform: translateY(-200%)\n transition: transform 300ms ease-in-out\n\n &:focus-within\n transform: translateY(0%)\n\narticle\n color: var(--color-content-foreground)\n background: var(--color-content-background)\n overflow-wrap: break-word\n\n.page\n display: flex\n // fill the viewport for pages with little content.\n min-height: 100%\n\n.mobile-header\n width: 100%\n height: var(--header-height)\n background-color: var(--color-header-background)\n color: var(--color-header-text)\n border-bottom: 1px solid var(--color-header-border)\n\n // Looks like sub-script/super-script have this, and we need this to\n // be \"on top\" of those.\n z-index: 10\n\n // We don't show the header on large screens.\n display: none\n\n // Add shadow when scrolled\n &.scrolled\n border-bottom: none\n box-shadow: 0 0 0.2rem rgba(0, 0, 0, 0.1), 0 0.2rem 0.4rem rgba(0, 0, 0, 0.2)\n\n .header-center\n a\n color: var(--color-header-text)\n text-decoration: none\n\n.main\n display: flex\n flex: 1\n\n// Sidebar (left) also covers the entire left portion of screen.\n.sidebar-drawer\n box-sizing: border-box\n\n border-right: 1px solid var(--color-sidebar-background-border)\n background: var(--color-sidebar-background)\n\n display: flex\n justify-content: flex-end\n // These next two lines took me two days to figure out.\n width: calc((100% - #{$full-width}) / 2 + #{$sidebar-width})\n min-width: $sidebar-width\n\n// Scroll-along sidebars\n.sidebar-container,\n.toc-drawer\n box-sizing: border-box\n width: $sidebar-width\n\n.toc-drawer\n background: var(--color-toc-background)\n // See HACK described on top of this document\n padding-right: 1rem\n\n.sidebar-sticky,\n.toc-sticky\n position: sticky\n top: 0\n height: min(100%, 100vh)\n height: 100vh\n\n display: flex\n flex-direction: column\n\n.sidebar-scroll,\n.toc-scroll\n flex-grow: 1\n flex-shrink: 1\n\n overflow: auto\n scroll-behavior: smooth\n\n// Central items.\n.content\n padding: 0 $content-padding\n width: $content-width\n\n display: flex\n flex-direction: column\n justify-content: space-between\n\n.icon\n display: inline-block\n height: 1rem\n width: 1rem\n svg\n width: 100%\n height: 100%\n\n//\n// Accommodate announcement banner\n//\n.announcement\n background-color: var(--color-announcement-background)\n color: var(--color-announcement-text)\n\n height: var(--header-height)\n display: flex\n align-items: center\n overflow-x: auto\n & + .page\n min-height: calc(100% - var(--header-height))\n\n.announcement-content\n box-sizing: border-box\n padding: 0.5rem\n min-width: 100%\n white-space: nowrap\n text-align: center\n\n a\n color: var(--color-announcement-text)\n text-decoration-color: var(--color-announcement-text)\n\n &:hover\n color: var(--color-announcement-text)\n text-decoration-color: var(--color-link--hover)\n\n////////////////////////////////////////////////////////////////////////////////\n// Toggles for theme\n////////////////////////////////////////////////////////////////////////////////\n.no-js .theme-toggle-container // don't show theme toggle if there's no JS\n display: none\n\n.theme-toggle-container\n display: flex\n\n.theme-toggle\n display: flex\n cursor: pointer\n border: none\n padding: 0\n background: transparent\n\n.theme-toggle svg\n height: 1.25rem\n width: 1.25rem\n color: var(--color-foreground-primary)\n display: none\n\n.theme-toggle-header\n display: flex\n align-items: center\n justify-content: center\n\n////////////////////////////////////////////////////////////////////////////////\n// Toggles for elements\n////////////////////////////////////////////////////////////////////////////////\n.toc-overlay-icon, .nav-overlay-icon\n display: none\n cursor: pointer\n\n .icon\n color: var(--color-foreground-secondary)\n height: 1.5rem\n width: 1.5rem\n\n.toc-header-icon, .nav-overlay-icon\n // for when we set display: flex\n justify-content: center\n align-items: center\n\n.toc-content-icon\n height: 1.5rem\n width: 1.5rem\n\n.content-icon-container\n float: right\n display: flex\n margin-top: 1.5rem\n margin-left: 1rem\n margin-bottom: 1rem\n gap: 0.5rem\n\n .edit-this-page, .view-this-page\n svg\n color: inherit\n height: 1.25rem\n width: 1.25rem\n\n.sidebar-toggle\n position: absolute\n display: none\n// \n.sidebar-toggle[name=\"__toc\"]\n left: 20px\n.sidebar-toggle:checked\n left: 40px\n// \n\n.overlay\n position: fixed\n top: 0\n width: 0\n height: 0\n\n transition: width 0ms, height 0ms, opacity 250ms ease-out\n\n opacity: 0\n background-color: rgba(0, 0, 0, 0.54)\n.sidebar-overlay\n z-index: 20\n.toc-overlay\n z-index: 40\n\n// Keep things on top and smooth.\n.sidebar-drawer\n z-index: 30\n transition: left 250ms ease-in-out\n.toc-drawer\n z-index: 50\n transition: right 250ms ease-in-out\n\n// Show the Sidebar\n#__navigation:checked\n & ~ .sidebar-overlay\n width: 100%\n height: 100%\n opacity: 1\n & ~ .page\n .sidebar-drawer\n top: 0\n left: 0\n // Show the toc sidebar\n#__toc:checked\n & ~ .toc-overlay\n width: 100%\n height: 100%\n opacity: 1\n & ~ .page\n .toc-drawer\n top: 0\n right: 0\n\n////////////////////////////////////////////////////////////////////////////////\n// Back to top\n////////////////////////////////////////////////////////////////////////////////\n.back-to-top\n text-decoration: none\n\n display: none\n position: fixed\n left: 0\n top: 1rem\n padding: 0.5rem\n padding-right: 0.75rem\n border-radius: 1rem\n font-size: 0.8125rem\n\n background: var(--color-background-primary)\n box-shadow: 0 0.2rem 0.5rem rgba(0, 0, 0, 0.05), #6b728080 0px 0px 1px 0px\n\n z-index: 10\n\n margin-left: 50%\n transform: translateX(-50%)\n svg\n height: 1rem\n width: 1rem\n fill: currentColor\n display: inline-block\n\n span\n margin-left: 0.25rem\n\n .show-back-to-top &\n display: flex\n align-items: center\n\n////////////////////////////////////////////////////////////////////////////////\n// Responsive layouting\n////////////////////////////////////////////////////////////////////////////////\n// Make things a bit bigger on bigger screens.\n@media (min-width: $full-width + $sidebar-width)\n html\n font-size: 110%\n\n@media (max-width: $full-width)\n // Collapse \"toc\" into the icon.\n .toc-content-icon\n display: flex\n .toc-drawer\n position: fixed\n height: 100vh\n top: 0\n right: -$sidebar-width\n border-left: 1px solid var(--color-background-muted)\n .toc-tree\n border-left: none\n font-size: var(--toc-font-size--mobile)\n\n // Accomodate for a changed content width.\n .sidebar-drawer\n width: calc((100% - #{$full-width - $sidebar-width}) / 2 + #{$sidebar-width})\n\n@media (max-width: $content-padded-width + $sidebar-width)\n // Center the page\n .content\n margin-left: auto\n margin-right: auto\n padding: 0 $content-padding--small\n\n@media (max-width: $content-padded-width--small + $sidebar-width)\n // Collapse \"navigation\".\n .nav-overlay-icon\n display: flex\n .sidebar-drawer\n position: fixed\n height: 100vh\n width: $sidebar-width\n\n top: 0\n left: -$sidebar-width\n\n // Swap which icon is visible.\n .toc-header-icon, .theme-toggle-header\n display: flex\n .toc-content-icon, .theme-toggle-content\n display: none\n\n // Show the header.\n .mobile-header\n position: sticky\n top: 0\n display: flex\n justify-content: space-between\n align-items: center\n\n .header-left,\n .header-right\n display: flex\n height: var(--header-height)\n padding: 0 var(--header-padding)\n label\n height: 100%\n width: 100%\n user-select: none\n\n .nav-overlay-icon .icon,\n .theme-toggle svg\n height: 1.5rem\n width: 1.5rem\n\n // Add a scroll margin for the content\n :target\n scroll-margin-top: calc(var(--header-height) + 2.5rem)\n\n // Show back-to-top below the header\n .back-to-top\n top: calc(var(--header-height) + 0.5rem)\n\n // Accommodate for the header.\n .page\n flex-direction: column\n justify-content: center\n\n@media (max-width: $content-width + 2* $content-padding--small)\n // Content should respect window limits.\n .content\n width: 100%\n overflow-x: auto\n\n@media (max-width: $content-width)\n article[role=main] aside.sidebar\n float: none\n width: 100%\n margin: 1rem 0\n","@use \"sass:list\"\n@use \"../variables\" as *\n\n// The design here is strongly inspired by mkdocs-material.\n.admonition, .topic\n margin: 1rem auto\n padding: 0 0.5rem 0.5rem 0.5rem\n\n background: var(--color-admonition-background)\n\n border-radius: 0.2rem\n box-shadow: 0 0.2rem 0.5rem rgba(0, 0, 0, 0.05), 0 0 0.0625rem rgba(0, 0, 0, 0.1)\n\n font-size: var(--admonition-font-size)\n\n overflow: hidden\n page-break-inside: avoid\n\n // First element should have no margin, since the title has it.\n > :nth-child(2)\n margin-top: 0\n\n // Last item should have no margin, since we'll control that w/ padding\n > :last-child\n margin-bottom: 0\n\n.admonition p.admonition-title,\np.topic-title\n position: relative\n margin: 0 -0.5rem 0.5rem\n padding-left: 2rem\n padding-right: .5rem\n padding-top: .4rem\n padding-bottom: .4rem\n\n font-weight: 500\n font-size: var(--admonition-title-font-size)\n line-height: 1.3\n\n // Our fancy icon\n &::before\n content: \"\"\n position: absolute\n left: 0.5rem\n width: 1rem\n height: 1rem\n\n// Default styles\np.admonition-title\n background-color: var(--color-admonition-title-background)\n &::before\n background-color: var(--color-admonition-title)\n mask-image: var(--icon-admonition-default)\n mask-repeat: no-repeat\n\np.topic-title\n background-color: var(--color-topic-title-background)\n &::before\n background-color: var(--color-topic-title)\n mask-image: var(--icon-topic-default)\n mask-repeat: no-repeat\n\n//\n// Variants\n//\n.admonition\n border-left: 0.2rem solid var(--color-admonition-title)\n\n @each $type, $value in $admonitions\n &.#{$type}\n border-left-color: var(--color-admonition-title--#{$type})\n > .admonition-title\n background-color: var(--color-admonition-title-background--#{$type})\n &::before\n background-color: var(--color-admonition-title--#{$type})\n mask-image: var(--icon-#{list.nth($value, 2)})\n\n.admonition-todo > .admonition-title\n text-transform: uppercase\n","// This file stylizes the API documentation (stuff generated by autodoc). It's\n// deeply nested due to how autodoc structures the HTML without enough classes\n// to select the relevant items.\n\n// API docs!\ndl[class]:not(.option-list):not(.field-list):not(.footnote):not(.glossary):not(.simple)\n // Tweak the spacing of all the things!\n dd\n margin-left: 2rem\n > :first-child\n margin-top: 0.125rem\n > :last-child\n margin-bottom: 0.75rem\n\n // This is used for the arguments\n .field-list\n margin-bottom: 0.75rem\n\n // \"Headings\" (like \"Parameters\" and \"Return\")\n > dt\n text-transform: uppercase\n font-size: var(--font-size--small)\n\n dd:empty\n margin-bottom: 0.5rem\n dd > ul\n margin-left: -1.2rem\n > li\n > p:nth-child(2)\n margin-top: 0\n // When the last-empty-paragraph follows a paragraph, it doesn't need\n // to augument the existing spacing.\n > p + p:last-child:empty\n margin-top: 0\n margin-bottom: 0\n\n // Colorize the elements\n > dt\n color: var(--color-api-overall)\n\n.sig:not(.sig-inline)\n font-weight: bold\n\n font-size: var(--api-font-size)\n font-family: var(--font-stack--monospace)\n\n margin-left: -0.25rem\n margin-right: -0.25rem\n padding-top: 0.25rem\n padding-bottom: 0.25rem\n padding-right: 0.5rem\n\n // These are intentionally em, to properly match the font size.\n padding-left: 3em\n text-indent: -2.5em\n\n border-radius: 0.25rem\n\n background: var(--color-api-background)\n transition: background 100ms ease-out\n\n &:hover\n background: var(--color-api-background-hover)\n\n // adjust the size of the [source] link on the right.\n a.reference\n .viewcode-link\n font-weight: normal\n width: 4.25rem\n\nem.property\n font-style: normal\n &:first-child\n color: var(--color-api-keyword)\n.sig-name\n color: var(--color-api-name)\n.sig-prename\n font-weight: normal\n color: var(--color-api-pre-name)\n.sig-paren\n color: var(--color-api-paren)\n.sig-param\n font-style: normal\n\ndiv.versionadded,\ndiv.versionchanged,\ndiv.deprecated,\ndiv.versionremoved\n border-left: 0.1875rem solid\n border-radius: 0.125rem\n\n padding-left: 0.75rem\n\n p\n margin-top: 0.125rem\n margin-bottom: 0.125rem\n\ndiv.versionadded\n border-color: var(--color-api-added-border)\n .versionmodified\n color: var(--color-api-added)\n\ndiv.versionchanged\n border-color: var(--color-api-changed-border)\n .versionmodified\n color: var(--color-api-changed)\n\ndiv.deprecated\n border-color: var(--color-api-deprecated-border)\n .versionmodified\n color: var(--color-api-deprecated)\n\ndiv.versionremoved\n border-color: var(--color-api-removed-border)\n .versionmodified\n color: var(--color-api-removed)\n\n// Align the [docs] and [source] to the right.\n.viewcode-link, .viewcode-back\n float: right\n text-align: right\n",".line-block\n margin-top: 0.5rem\n margin-bottom: 0.75rem\n .line-block\n margin-top: 0rem\n margin-bottom: 0rem\n padding-left: 1rem\n","// Captions\narticle p.caption,\ntable > caption,\n.code-block-caption\n font-size: var(--font-size--small)\n text-align: center\n\n// Caption above a TOCTree\n.toctree-wrapper.compound\n .caption, :not(.caption) > .caption-text\n font-size: var(--font-size--small)\n text-transform: uppercase\n\n text-align: initial\n margin-bottom: 0\n\n > ul\n margin-top: 0\n margin-bottom: 0\n","// Inline code\ncode.literal, .sig-inline\n background: var(--color-inline-code-background)\n border-radius: 0.2em\n // Make the font smaller, and use padding to recover.\n font-size: var(--font-size--small--2)\n padding: 0.1em 0.2em\n\n pre.literal-block &\n font-size: inherit\n padding: 0\n\n p &\n border: 1px solid var(--color-background-border)\n\n.sig-inline\n font-family: var(--font-stack--monospace)\n\n// Code and Literal Blocks\n$code-spacing-vertical: 0.625rem\n$code-spacing-horizontal: 0.875rem\n\n// Wraps every literal block + line numbers.\ndiv[class*=\" highlight-\"],\ndiv[class^=\"highlight-\"]\n margin: 1em 0\n display: flex\n\n .table-wrapper\n margin: 0\n padding: 0\n\npre\n margin: 0\n padding: 0\n overflow: auto\n\n // Needed to have more specificity than pygments' \"pre\" selector. :(\n article[role=\"main\"] .highlight &\n line-height: 1.5\n\n &.literal-block,\n .highlight &\n font-size: var(--code-font-size)\n padding: $code-spacing-vertical $code-spacing-horizontal\n\n // Make it look like all the other blocks.\n &.literal-block\n margin-top: 1rem\n margin-bottom: 1rem\n\n border-radius: 0.2rem\n background-color: var(--color-code-background)\n color: var(--color-code-foreground)\n\n// All code is always contained in this.\n.highlight\n width: 100%\n border-radius: 0.2rem\n\n // Make line numbers and prompts un-selectable.\n .gp, span.linenos\n user-select: none\n pointer-events: none\n\n // Expand the line-highlighting.\n .hll\n display: block\n margin-left: -$code-spacing-horizontal\n margin-right: -$code-spacing-horizontal\n padding-left: $code-spacing-horizontal\n padding-right: $code-spacing-horizontal\n\n/* Make code block captions be nicely integrated */\n.code-block-caption\n display: flex\n padding: $code-spacing-vertical $code-spacing-horizontal\n\n border-radius: 0.25rem\n border-bottom-left-radius: 0\n border-bottom-right-radius: 0\n font-weight: 300\n border-bottom: 1px solid\n\n background-color: var(--color-code-background)\n color: var(--color-code-foreground)\n border-color: var(--color-background-border)\n\n + div[class]\n margin-top: 0\n > .highlight\n border-top-left-radius: 0\n border-top-right-radius: 0\n\n// When `html_codeblock_linenos_style` is table.\n.highlighttable\n width: 100%\n display: block\n tbody\n display: block\n\n tr\n display: flex\n\n // Line numbers\n td.linenos\n background-color: var(--color-code-background)\n color: var(--color-code-foreground)\n padding: $code-spacing-vertical $code-spacing-horizontal\n padding-right: 0\n border-top-left-radius: 0.2rem\n border-bottom-left-radius: 0.2rem\n\n .linenodiv\n padding-right: $code-spacing-horizontal\n font-size: var(--code-font-size)\n box-shadow: -0.0625rem 0 var(--color-foreground-border) inset\n\n // Actual code\n td.code\n padding: 0\n display: block\n flex: 1\n overflow: hidden\n\n .highlight\n border-top-left-radius: 0\n border-bottom-left-radius: 0\n\n// When `html_codeblock_linenos_style` is inline.\n.highlight\n span.linenos\n display: inline-block\n padding-left: 0\n padding-right: $code-spacing-horizontal\n margin-right: $code-spacing-horizontal\n box-shadow: -0.0625rem 0 var(--color-foreground-border) inset\n","// Inline Footnote Reference\n.footnote-reference\n font-size: var(--font-size--small--4)\n vertical-align: super\n\n// Definition list, listing the content of each note.\n// docutils <= 0.17\ndl.footnote.brackets\n font-size: var(--font-size--small)\n color: var(--color-foreground-secondary)\n\n display: grid\n grid-template-columns: max-content auto\n dt\n margin: 0\n > .fn-backref\n margin-left: 0.25rem\n\n &:after\n content: \":\"\n\n .brackets\n &:before\n content: \"[\"\n &:after\n content: \"]\"\n\n dd\n margin: 0\n padding: 0 1rem\n\n// docutils >= 0.18\naside.footnote\n font-size: var(--font-size--small)\n color: var(--color-foreground-secondary)\n\naside.footnote > span,\ndiv.citation > span\n float: left\n font-weight: 500\n padding-right: 0.25rem\n\naside.footnote > *:not(span),\ndiv.citation > p\n margin-left: 2rem\n","//\n// Figures\n//\nimg\n box-sizing: border-box\n max-width: 100%\n height: auto\n\narticle\n figure, .figure\n border-radius: 0.2rem\n\n margin: 0\n :last-child\n margin-bottom: 0\n\n .align-left\n float: left\n clear: left\n margin: 0 1rem 1rem\n\n .align-right\n float: right\n clear: right\n margin: 0 1rem 1rem\n\n .align-default,\n .align-center\n display: block\n text-align: center\n margin-left: auto\n margin-right: auto\n\n // WELL, table needs to be stylised like a table.\n table.align-default\n display: table\n text-align: initial\n",".genindex-jumpbox, .domainindex-jumpbox\n border-top: 1px solid var(--color-background-border)\n border-bottom: 1px solid var(--color-background-border)\n padding: 0.25rem\n\n.genindex-section, .domainindex-section\n h2\n margin-top: 0.75rem\n margin-bottom: 0.5rem\n ul\n margin-top: 0\n margin-bottom: 0\n","ul,\nol\n padding-left: 1.2rem\n\n // Space lists out like paragraphs\n margin-top: 1rem\n margin-bottom: 1rem\n // reduce margins within li.\n li\n > p:first-child\n margin-top: 0.25rem\n margin-bottom: 0.25rem\n\n > p:last-child\n margin-top: 0.25rem\n\n > ul,\n > ol\n margin-top: 0.5rem\n margin-bottom: 0.5rem\n\nol\n &.arabic\n list-style: decimal\n &.loweralpha\n list-style: lower-alpha\n &.upperalpha\n list-style: upper-alpha\n &.lowerroman\n list-style: lower-roman\n &.upperroman\n list-style: upper-roman\n\n// Don't space lists out when they're \"simple\" or in a `.. toctree::`\n.simple,\n.toctree-wrapper\n li\n > ul,\n > ol\n margin-top: 0\n margin-bottom: 0\n\n// Definition Lists\n.field-list,\n.option-list,\ndl:not([class]),\ndl.simple,\ndl.footnote,\ndl.glossary\n dt\n font-weight: 500\n margin-top: 0.25rem\n + dt\n margin-top: 0\n\n .classifier::before\n content: \":\"\n margin-left: 0.2rem\n margin-right: 0.2rem\n\n dd\n > p:first-child,\n ul\n margin-top: 0.125rem\n\n ul\n margin-bottom: 0.125rem\n",".math-wrapper\n width: 100%\n overflow-x: auto\n\ndiv.math\n position: relative\n text-align: center\n\n .headerlink,\n &:focus .headerlink\n display: none\n\n &:hover .headerlink\n display: inline-block\n\n span.eqno\n position: absolute\n right: 0.5rem\n top: 50%\n transform: translate(0, -50%)\n z-index: 1\n","// Abbreviations\nabbr[title]\n cursor: help\n\n// \"Problematic\" content, as identified by Sphinx\n.problematic\n color: var(--color-problematic)\n\n// Keyboard / Mouse \"instructions\"\nkbd:not(.compound)\n margin: 0 0.2rem\n padding: 0 0.2rem\n border-radius: 0.2rem\n border: 1px solid var(--color-foreground-border)\n color: var(--color-foreground-primary)\n vertical-align: text-bottom\n\n font-size: var(--font-size--small--3)\n display: inline-block\n\n box-shadow: 0 0.0625rem 0 rgba(0, 0, 0, 0.2), inset 0 0 0 0.125rem var(--color-background-primary)\n\n background-color: var(--color-background-secondary)\n\n// Blockquote\nblockquote\n border-left: 4px solid var(--color-background-border)\n background: var(--color-background-secondary)\n\n margin-left: 0\n margin-right: 0\n padding: 0.5rem 1rem\n\n .attribution\n font-weight: 600\n text-align: right\n\n &.pull-quote,\n &.highlights\n font-size: 1.25em\n\n &.epigraph,\n &.pull-quote\n border-left-width: 0\n border-radius: 0.5rem\n\n &.highlights\n border-left-width: 0\n background: transparent\n\n// Center align embedded-in-text images\np .reference img\n vertical-align: middle\n","p.rubric\n line-height: 1.25\n font-weight: bold\n font-size: 1.125em\n\n // For Numpy-style documentation that's got rubrics within it.\n // https://github.com/pradyunsg/furo/discussions/505\n dd &\n line-height: inherit\n font-weight: inherit\n\n font-size: var(--font-size--small)\n text-transform: uppercase\n","article .sidebar\n float: right\n clear: right\n width: 30%\n\n margin-left: 1rem\n margin-right: 0\n\n border-radius: 0.2rem\n background-color: var(--color-background-secondary)\n border: var(--color-background-border) 1px solid\n\n > *\n padding-left: 1rem\n padding-right: 1rem\n\n > ul, > ol // lists need additional padding, because bullets.\n padding-left: 2.2rem\n\n .sidebar-title\n margin: 0\n padding: 0.5rem 1rem\n border-bottom: var(--color-background-border) 1px solid\n\n font-weight: 500\n\n// TODO: subtitle\n// TODO: dedicated variables?\n","[role=main] .table-wrapper.container\n width: 100%\n overflow-x: auto\n margin-top: 1rem\n margin-bottom: 0.5rem\n padding: 0.2rem 0.2rem 0.75rem\n\ntable.docutils\n border-radius: 0.2rem\n border-spacing: 0\n border-collapse: collapse\n\n box-shadow: 0 0.2rem 0.5rem rgba(0, 0, 0, 0.05), 0 0 0.0625rem rgba(0, 0, 0, 0.1)\n\n th\n background: var(--color-table-header-background)\n\n td,\n th\n // Space things out properly\n padding: 0 0.25rem\n\n // Get the borders looking just-right.\n border-left: 1px solid var(--color-table-border)\n border-right: 1px solid var(--color-table-border)\n border-bottom: 1px solid var(--color-table-border)\n\n p\n margin: 0.25rem\n\n &:first-child\n border-left: none\n &:last-child\n border-right: none\n\n // MyST-parser tables set these classes for control of column alignment\n &.text-left\n text-align: left\n &.text-right\n text-align: right\n &.text-center\n text-align: center\n","@use \"../variables\" as *\n\n:target\n scroll-margin-top: 2.5rem\n\n@media (max-width: $full-width - $sidebar-width)\n :target\n scroll-margin-top: calc(2.5rem + var(--header-height))\n\n // When a heading is selected\n section > span:target\n scroll-margin-top: calc(2.8rem + var(--header-height))\n\n// Permalinks\n.headerlink\n font-weight: 100\n user-select: none\n\nh1,\nh2,\nh3,\nh4,\nh5,\nh6,\ndl dt,\np.caption,\nfigcaption p,\ntable > caption,\n.code-block-caption\n > .headerlink\n margin-left: 0.5rem\n visibility: hidden\n &:hover > .headerlink\n visibility: visible\n\n // Don't change to link-like, if someone adds the contents directive.\n > .toc-backref\n color: inherit\n text-decoration-line: none\n\n// Figure and table captions are special.\nfigure:hover > figcaption > p > .headerlink,\ntable:hover > caption > .headerlink\n visibility: visible\n\n:target >, // Regular section[id] style anchors\nspan:target ~ // Non-regular span[id] style \"extra\" anchors\n h1,\n h2,\n h3,\n h4,\n h5,\n h6\n &:nth-of-type(1)\n background-color: var(--color-highlight-on-target)\n // .headerlink\n // visibility: visible\n code.literal\n background-color: transparent\n\ntable:target > caption,\nfigure:target\n background-color: var(--color-highlight-on-target)\n\n// Inline page contents\n.this-will-duplicate-information-and-it-is-still-useful-here li :target\n background-color: var(--color-highlight-on-target)\n\n// Code block permalinks\n.literal-block-wrapper:target .code-block-caption\n background-color: var(--color-highlight-on-target)\n\n// When a definition list item is selected\n//\n// There isn't really an alternative to !important here, due to the\n// high-specificity of API documentation's selector.\ndt:target\n background-color: var(--color-highlight-on-target) !important\n\n// When a footnote reference is selected\n.footnote > dt:target + dd,\n.footnote-reference:target\n background-color: var(--color-highlight-on-target)\n",".guilabel\n background-color: var(--color-guilabel-background)\n border: 1px solid var(--color-guilabel-border)\n color: var(--color-guilabel-text)\n\n padding: 0 0.3em\n border-radius: 0.5em\n font-size: 0.9em\n","// This file contains the styles used for stylizing the footer that's shown\n// below the content.\n@use \"../variables\" as *\n\nfooter\n font-size: var(--font-size--small)\n display: flex\n flex-direction: column\n\n margin-top: 2rem\n\n// Bottom of page information\n.bottom-of-page\n display: flex\n align-items: center\n justify-content: space-between\n\n margin-top: 1rem\n padding-top: 1rem\n padding-bottom: 1rem\n\n color: var(--color-foreground-secondary)\n border-top: 1px solid var(--color-background-border)\n\n line-height: 1.5\n\n @media (max-width: $content-width)\n text-align: center\n flex-direction: column-reverse\n gap: 0.25rem\n\n .left-details\n font-size: var(--font-size--small)\n\n .right-details\n display: flex\n flex-direction: column\n gap: 0.25rem\n text-align: right\n\n .icons\n display: flex\n justify-content: flex-end\n gap: 0.25rem\n font-size: 1rem\n\n a\n text-decoration: none\n\n svg,\n img\n font-size: 1.125rem\n height: 1em\n width: 1em\n\n// Next/Prev page information\n.related-pages\n a\n display: flex\n align-items: center\n\n text-decoration: none\n &:hover .page-info .title\n text-decoration: underline\n color: var(--color-link)\n text-decoration-color: var(--color-link-underline)\n\n svg.furo-related-icon,\n svg.furo-related-icon > use\n flex-shrink: 0\n\n color: var(--color-foreground-border)\n\n width: 0.75rem\n height: 0.75rem\n margin: 0 0.5rem\n\n &.next-page\n max-width: 50%\n\n float: right\n clear: right\n text-align: right\n\n &.prev-page\n max-width: 50%\n\n float: left\n clear: left\n\n svg\n transform: rotate(180deg)\n\n.page-info\n display: flex\n flex-direction: column\n overflow-wrap: anywhere\n\n .next-page &\n align-items: flex-end\n\n .context\n display: flex\n align-items: center\n\n padding-bottom: 0.1rem\n\n color: var(--color-foreground-muted)\n font-size: var(--font-size--small)\n text-decoration: none\n","// This file contains the styles for the contents of the left sidebar, which\n// contains the navigation tree, logo, search etc.\n\n////////////////////////////////////////////////////////////////////////////////\n// Brand on top of the scrollable tree.\n////////////////////////////////////////////////////////////////////////////////\n.sidebar-brand\n display: flex\n flex-direction: column\n flex-shrink: 0\n\n padding: var(--sidebar-item-spacing-vertical) var(--sidebar-item-spacing-horizontal)\n text-decoration: none\n\n.sidebar-brand-text\n color: var(--color-sidebar-brand-text)\n overflow-wrap: break-word\n margin: var(--sidebar-item-spacing-vertical) 0\n font-size: 1.5rem\n\n.sidebar-logo-container\n margin: var(--sidebar-item-spacing-vertical) 0\n\n.sidebar-logo\n margin: 0 auto\n display: block\n max-width: 100%\n\n////////////////////////////////////////////////////////////////////////////////\n// Search\n////////////////////////////////////////////////////////////////////////////////\n.sidebar-search-container\n display: flex\n align-items: center\n margin-top: var(--sidebar-search-space-above)\n\n position: relative\n\n background: var(--color-sidebar-search-background)\n &:hover,\n &:focus-within\n background: var(--color-sidebar-search-background--focus)\n\n &::before\n content: \"\"\n position: absolute\n left: var(--sidebar-item-spacing-horizontal)\n width: var(--sidebar-search-icon-size)\n height: var(--sidebar-search-icon-size)\n\n background-color: var(--color-sidebar-search-icon)\n mask-image: var(--icon-search)\n\n.sidebar-search\n box-sizing: border-box\n\n border: none\n border-top: 1px solid var(--color-sidebar-search-border)\n border-bottom: 1px solid var(--color-sidebar-search-border)\n\n padding-top: var(--sidebar-search-input-spacing-vertical)\n padding-bottom: var(--sidebar-search-input-spacing-vertical)\n padding-right: var(--sidebar-search-input-spacing-horizontal)\n padding-left: calc(var(--sidebar-item-spacing-horizontal) + var(--sidebar-search-input-spacing-horizontal) + var(--sidebar-search-icon-size))\n\n width: 100%\n\n color: var(--color-sidebar-search-foreground)\n background: transparent\n z-index: 10\n\n &:focus\n outline: none\n\n &::placeholder\n font-size: var(--sidebar-search-input-font-size)\n\n//\n// Hide Search Matches link\n//\n#searchbox .highlight-link\n padding: var(--sidebar-item-spacing-vertical) var(--sidebar-item-spacing-horizontal) 0\n margin: 0\n text-align: center\n\n a\n color: var(--color-sidebar-search-icon)\n font-size: var(--font-size--small--2)\n\n////////////////////////////////////////////////////////////////////////////////\n// Structure/Skeleton of the navigation tree (left)\n////////////////////////////////////////////////////////////////////////////////\n.sidebar-tree\n font-size: var(--sidebar-item-font-size)\n margin-top: var(--sidebar-tree-space-above)\n margin-bottom: var(--sidebar-item-spacing-vertical)\n\n ul\n padding: 0\n margin-top: 0\n margin-bottom: 0\n\n display: flex\n flex-direction: column\n\n list-style: none\n\n li\n position: relative\n margin: 0\n\n > ul\n margin-left: var(--sidebar-item-spacing-horizontal)\n\n .icon\n color: var(--color-sidebar-link-text)\n\n .reference\n box-sizing: border-box\n color: var(--color-sidebar-link-text)\n\n // Fill the parent.\n display: inline-block\n line-height: var(--sidebar-item-line-height)\n text-decoration: none\n\n // Don't allow long words to cause wrapping.\n overflow-wrap: anywhere\n\n height: 100%\n width: 100%\n\n padding: var(--sidebar-item-spacing-vertical) var(--sidebar-item-spacing-horizontal)\n\n &:hover\n color: var(--color-sidebar-link-text)\n background: var(--color-sidebar-item-background--hover)\n\n // Add a nice little \"external-link\" arrow here.\n &.external::after\n content: url('data:image/svg+xml,')\n margin: 0 0.25rem\n vertical-align: middle\n color: var(--color-sidebar-link-text)\n\n // Make the current page reference bold.\n .current-page > .reference\n font-weight: bold\n\n label\n position: absolute\n top: 0\n right: 0\n height: var(--sidebar-item-height)\n width: var(--sidebar-expander-width)\n\n cursor: pointer\n user-select: none\n\n display: flex\n justify-content: center\n align-items: center\n\n .caption, :not(.caption) > .caption-text\n font-size: var(--sidebar-caption-font-size)\n color: var(--color-sidebar-caption-text)\n\n font-weight: bold\n text-transform: uppercase\n\n margin: var(--sidebar-caption-space-above) 0 0 0\n padding: var(--sidebar-item-spacing-vertical) var(--sidebar-item-spacing-horizontal)\n\n // If it has children, add a bit more padding to wrap the content to avoid\n // overlapping with the