[Python-modules-commits] [python-intervaltree] 01/02: Imported Upstream version 2.1.0

Afif Elghraoui afif-guest at moszumanska.debian.org
Thu Dec 17 07:31:50 UTC 2015


This is an automated email from the git hooks/post-receive script.

afif-guest pushed a commit to branch master
in repository python-intervaltree.

commit d34107c3d0fbd785d21b4a9a08b25f5a96081ae9
Author: Afif Elghraoui <afif at ghraoui.name>
Date:   Sat Dec 12 16:01:43 2015 -0800

    Imported Upstream version 2.1.0
---
 .ackrc                                        |      2 +
 .gitignore                                    |     30 +
 .travis.yml                                   |     14 +
 CHANGELOG.md                                  |    159 +
 HACKING.md                                    |    156 +
 LICENSE.txt                                   |    202 +
 MANIFEST.in                                   |      1 +
 Makefile                                      |    141 +
 README.md                                     |    361 +
 README.rst                                    |    597 +
 intervaltree/__init__.py                      |     22 +
 intervaltree/interval.py                      |    302 +
 intervaltree/intervaltree.py                  |   1094 +
 intervaltree/node.py                          |    593 +
 scripts/testall.sh                            |     10 +
 setup.cfg                                     |      7 +
 setup.py                                      |    274 +
 test/__init__.py                              |     13 +
 test/data/__init__.py                         |      0
 test/data/issue25_orig.py                     |     86 +
 test/data/issue4.py                           | 147716 +++++++++++++++++++++++
 test/data/issue4_result.py                    |  33277 +++++
 test/data/ivs0.py                             |      4 +
 test/data/ivs1.py                             |     13 +
 test/data/ivs1_float_copy_structure.py        |     13 +
 test/data/ivs2.py                             |    104 +
 test/data/ivs3.py                             |    104 +
 test/data_loader.py                           |     43 +
 test/interval_test.py                         |    248 +
 test/intervals.py                             |    153 +
 test/intervaltree_methods/__init__.py         |     20 +
 test/intervaltree_methods/copy_test.py        |     69 +
 test/intervaltree_methods/debug_test.py       |     72 +
 test/intervaltree_methods/delete_test.py      |    135 +
 test/intervaltree_methods/init_test.py        |     85 +
 test/intervaltree_methods/insert_test.py      |    162 +
 test/intervaltree_methods/query_test.py       |    153 +
 test/intervaltree_methods/restructure_test.py |    420 +
 test/intervaltree_methods/setlike_test.py     |    137 +
 test/intervaltrees.py                         |     74 +
 test/issue25.txt                              |     97 +
 test/issue25_test.py                          |    128 +
 test/issue26_test.py                          |    109 +
 test/issue27_test.py                          |     59 +
 test/issue4.py                                |     94 +
 test/optimality_test.py                       |     82 +
 test/optimality_test_matrix.py                |    166 +
 test/pprint.py                                |    477 +
 test/progress_bar.py                          |    438 +
 49 files changed, 188716 insertions(+)

diff --git a/.ackrc b/.ackrc
new file mode 100644
index 0000000..7c2ca64
--- /dev/null
+++ b/.ackrc
@@ -0,0 +1,2 @@
+--ignore-dir=intervaltree.egg-info
+--norst
diff --git a/.gitignore b/.gitignore
new file mode 100644
index 0000000..84305cc
--- /dev/null
+++ b/.gitignore
@@ -0,0 +1,30 @@
+# IDE dirs
+.idea/
+*.komodoproject
+
+# Auto-generated
+*.pyc
+dist/
+build/
+
+# generated by coverage
+.coverage
+htmlcov/
+
+# Dev dependencies
+pyandoc/
+pandoc
+docutils/
+bin/
+
+# Developer eggs
+*.egg-info
+*.egg
+.eggs/
+
+# Mac noise
+.DS_Store
+
+# Other temps
+restats
+
diff --git a/.travis.yml b/.travis.yml
new file mode 100644
index 0000000..1dbec84
--- /dev/null
+++ b/.travis.yml
@@ -0,0 +1,14 @@
+language: python
+python:
+    - "2.6"
+    - "2.7"
+    - "3.2"
+    - "3.3"
+    - "3.4"
+install:
+    - make deps-dev
+    - pip install coverage
+script:
+    coverage run --source=intervaltree setup.py develop test
+after_success:
+    coverage report
diff --git a/CHANGELOG.md b/CHANGELOG.md
new file mode 100644
index 0000000..a13be14
--- /dev/null
+++ b/CHANGELOG.md
@@ -0,0 +1,159 @@
+Change log
+==========
+
+Version 2.1.0
+-------------
+- Added: 
+    - `merge_overlaps()` method and tests
+    - `merge_equals()` method and tests
+    - `range()` method
+    - `span()` method, for returning the difference between `end()` and `begin()`
+- Fixes:
+    - Development version numbering is changing to be compliant with PEP440. Version numbering now contains major, minor and micro release numbers, plus the number of builds following the stable release version, e.g. 2.0.4b34
+    - Speed improvement: `begin()` and `end()` methods used iterative `min()` and `max()` builtins instead of the more efficient `iloc` member available to `SortedDict`
+    - `overlaps()` method used to return `True` even if provided null test interval
+- Maintainers:
+    - Added coverage test (`make coverage`) with html report (`htmlcov/index.html`)
+    - Tests run slightly faster
+
+Version 2.0.4
+-------------
+- Fix: Issue #27: README incorrectly showed using a comma instead of a colon when querying the `IntervalTree`: it showed `tree[begin, end]` instead of `tree[begin:end]`
+
+Version 2.0.3
+-------------
+- Fix: README showed using + operator for setlike union instead of the correct | operator
+- Removed tests from release package to speed up installation; to get the tests, download from GitHub
+
+Version 2.0.2
+-------------
+- Fix: Issue #20: performance enhancement for large trees. `IntervalTree.search()` made a copy of the entire `boundary_table` resulting in linear search time. The `sortedcollections` package is now the sole install dependency
+
+Version 2.0.1
+-------------
+- Fix: Issue #26: failed to prune empty `Node` after a rotation promoted contents of `s_center`
+
+Version 2.0.0
+-------------
+- `IntervalTree` now supports the full `collections.MutableSet` API
+- Added:
+    - `__delitem__` to `IntervalTree`
+    - `Interval` comparison methods `lt()`, `gt()`, `le()` and `ge()` to `Interval`, as an alternative to the comparison operators, which are designed for sorting
+    - `IntervalTree.from_tuples(iterable)`
+    - `IntervalTree.clear()`
+    - `IntervalTree.difference(iterable)`
+    - `IntervalTree.difference_update(iterable)`
+    - `IntervalTree.union(iterable)`
+    - `IntervalTree.intersection(iterable)`
+    - `IntervalTree.intersection_update(iterable)`
+    - `IntervalTree.symmetric_difference(iterable)`
+    - `IntervalTree.symmetric_difference_update(iterable)`
+    - `IntervalTree.chop(a, b)`
+    - `IntervalTree.slice(point)`
+- Deprecated `IntervalTree.extend()` -- use `update()` instead
+- Internal improvements:
+    - More verbose tests with progress bars
+    - More tests for comparison and sorting behavior
+    - Code in the README is included in the unit tests
+- Fixes
+    - BACKWARD INCOMPATIBLE: On ranged queries where `begin >= end`, the query operated on the overlaps of `begin`. This behavior was documented as expected in 1.x; it is now changed to be more consistent with the definition of `Interval`s, which are half-open.
+    - Issue #25: pruning empty Nodes with staggered descendants could result in invalid trees
+    - Sorting `Interval`s and numbers in the same list gathered all the numbers at the beginning and the `Interval`s at the end
+    - `IntervalTree.overlaps()` and friends returned `None` instead of `False`
+    - Maintainers: `make install-testpypi` failed because the `pip` was missing a `--pre` flag
+
+Version 1.1.1
+-------------
+- Removed requirement for pyandoc in order to run functionality tests.
+
+Version 1.1.0
+-------------
+- Added ability to use `Interval.distance_to()` with points, not just `Intervals`
+- Added documentation on return types to `IntervalTree` and `Interval`
+- `Interval.__cmp__()` works with points too
+- Fix: `IntervalTree.score()` returned maximum score of 0.5 instead of 1.0. Now returns max of subscores instead of avg
+- Internal improvements:
+    - Development version numbering scheme, based on `git describe` the "building towards" release is appended after a hyphen, eg. 1.0.2-37-g2da2ef0-1.10. The previous tagged release is 1.0.2, and there have been 37 commits since then, current tag is g2da2ef0, and we are getting ready for a 1.1.0 release
+    - Optimality tests added
+    - `Interval` overlap tests for ranges, `Interval`s and points added
+
+Version 1.0.2
+-------------
+-Bug fixes:
+    - `Node.depth_score_helper()` raised `AttributeError`
+    - README formatting
+
+Version 1.0.1
+-------------
+- Fix: pip install failure because of failure to generate README.rst
+
+Version 1.0.0
+-------------
+- Renamed from PyIntervalTree to intervaltree
+- Speed improvements for adding and removing Intervals (~70% faster than 0.4)
+- Bug fixes:
+    - BACKWARD INCOMPATIBLE: `len()` of an `Interval` is always 3, reverting to default behavior for `namedtuples`. In Python 3, `len` returning a non-integer raises an exception. Instead, use `Interval.length()`, which returns 0 for null intervals and `end - begin` otherwise. Also, if the `len() === 0`, then `not iv` is `True`.
+    - When inserting an `Interval` via `__setitem__` and improper parameters given, all errors were transformed to `IndexError`
+    - `split_overlaps` did not update the `boundary_table` counts
+- Internal improvements:
+    - More robust local testing tools
+    - Long series of interdependent tests have been separated into sections
+
+Version 0.4
+-------------
+
+- Faster balancing (~80% faster)
+- Bug fixes:
+    - Double rotations were performed in place of a single rotation when presented an unbalanced Node with a balanced child.
+    - During single rotation, kept referencing an unrotated Node instead of the new, rotated one
+
+Version 0.3.3
+-------------
+
+- Made IntervalTree crash if inited with a null Interval (end <= begin)
+- IntervalTree raises ValueError instead of AssertionError when a null Interval is inserted
+
+Version 0.3.2
+-------------
+
+- Support for Python 3.2+ and 2.6+
+- Changed license from LGPL to more permissive Apache license
+- Merged changes from https://github.com/konstantint/PyIntervalTree to
+    https://github.com/chaimleib/PyIntervalTree
+    - Interval now inherits from a namedtuple. Benefits: should be faster.
+        Drawbacks: slight behavioural change (Intervals not mutable anymore).
+    - Added float tests
+    - Use setup.py for tests
+    - Automatic testing via travis-ci
+    - Removed dependency on six
+- Interval improvements:
+    - Intervals without data have a cleaner string representation
+    - Intervals without data are pickled more compactly
+    - Better hashing
+    - Intervals are ordered by begin, then end, then by data. If data is not
+        orderable, sorts by type(data)
+- Bug fixes:
+    - Fixed crash when querying empty tree
+    - Fixed missing close parenthesis in examples
+    - Made IntervalTree crash earlier if a null Interval is added
+- Internals:
+    - New test directory
+    - Nicer display of data structures for debugging, using custom
+        test/pprint.py (Python 2.6, 2.7)
+    - More sensitive exception handling
+    - Local script to test in all supported versions of Python
+    - Added IntervalTree.score() to measure how optimally a tree is structured
+
+Version 0.2.3
+-------------
+
+- Slight changes for inclusion in PyPI.
+- Some documentation changes
+- Added tests
+- Bug fix: interval addition via [] was broken in Python 2.7 (see http://bugs.python.org/issue21785)
+- Added intervaltree.bio subpackage, adding some utilities for use in bioinformatics
+
+Version 0.2.2b
+--------------
+
+- Forked from https://github.com/MusashiAharon/PyIntervalTree
diff --git a/HACKING.md b/HACKING.md
new file mode 100644
index 0000000..c163449
--- /dev/null
+++ b/HACKING.md
@@ -0,0 +1,156 @@
+Hacking intervaltree
+====================
+
+This is a developer's guide to modifying and maintaining `intervaltree`.
+
+## Dependencies
+
+* On a Mac, you will need [`brew`][brew].
+
+* On Linux, you will need `apt-get`.
+
+On all systems, Python 2.6, 2.7, 3.2, 3.3 and 3.4 are needed to run the complete test suite. 
+
+### Single version of Python
+
+If you don't have all the above versions of Python, these `make` features will be unavailable to you:
+
+* `make` and `make test`
+* `make pytest`
+* `make upload` and `make release upload`
+     
+
+## Project structure
+
+### `intervaltree`
+
+The `intervaltree` directory has three main files:
+
+* `intervaltree.py`
+* `interval.py`
+* `node.py`
+
+`intervaltree.py` and `interval.py` contain the public API to `IntervalTree` and `Interval`. `node.py` contains the internal logic of the tree. For the theory of how this type of tree works, read the following:
+
+* Wikipedia's [Interval tree][Wiki intervaltree] article
+* Eternally Confuzzled's tutorial on [AVL balancing][Confuzzled AVL tree]
+* Tyler Kahn's simpler, immutable [interval tree implementation][Kahn intervaltree] in Python
+ 
+### `test`
+
+All files ending with `_test.py` are detected and run whenever you run `make` or `make quicktest`. In those files, only functions beginning with `test_` are executed.
+
+#### `test/data`
+Some tests depend on having certain lists of `Interval`s. These are stored in the modules of `test/data`. Most of these modules only contain a `data` attribute, which is a list of tuples that is converted to a list of `Interval`s by `test/intervals.py`. You can access them by importing the dict of lists of `Interval`s `test.intervals.ivs`.
+
+Other tests (like `test/issue25_test.py`) depend on having pre-constructed `IntervalTree`s. These are constructed by `test/intervaltrees.py` and can be accessed by importing `test.intervaltrees.trees`. This is a dict of callables that return `IntervalTree`s. 
+
+### `scripts`
+
+Contains `testall.sh`, which runs all tests on all supported versions of Python.
+
+### Dependency folders
+
+* `pyandoc` and `pandoc` give the ability to convert README.md into rst format for PyPI.
+* `docutils` and `bin` are created if `pip` could not install them system-wide without permissions. These are used to check the syntax of the converted rst README.
+* `*.egg` are created by `PyTest` to fulfill testing dependencies
+* `intervaltree.egg-info` is package metadata generated by `setup.py`.
+
+### Other documentation files
+
+* `HACKING.md` is this file.
+* `README.md` contains public API documentation and credits.
+* `README.rst` is generated from `README.md`.
+* `CHANGELOG.md`
+* `LICENSE.txt`
+
+### Other code files
+
+* `Makefile` contains convenience routines for managing and testing the project. It installs certain dependencies that are too inconvenient to install on [travis-ci.org][], and gives an easy way to call `test/testall.sh`.
+* `setup.py` runs the tests in a single version of Python. Also, packages the project for PyPI.
+* `setup.cfg` configures `setup.py`. If you want to permanently skip a folder in testing, do it here.
+
+
+## Testing
+
+### Code
+
+To run the tests in the `test` directory, run
+
+    make test
+
+or simply
+
+    make
+
+The two commands above run all the available tests on all versions of Python supported. You should run `make` first, because it will also detect missing dependencies and install them.
+
+The first time you run `make`, you may be asked for your password. This is in order to install `pandoc`, a tool used for processing the README file.
+
+Running all tests requires that you have all the supported versions of Python installed. These are 2.6, 2.7, 3.2, 3.3, and 3.4. Try to use your packaga manager to install them if possible. Otherwise, go to [python.org/downloads][] and install them manually.
+
+#### Single version of Python
+
+Run
+
+    make quicktest
+
+### README
+
+To test changes to the README and make sure that they are compatible with PyPI's very restrictive rules, run
+
+    make rst
+
+`make rst` is also run by `make test`, but `make test` takes longer.
+
+
+## Cleaning
+
+To clean up the project directory, run 
+    
+    make distclean
+    
+That should remove all the locally-installed dependencies and clear out all the temporary files.
+
+To keep the dependencies, but clean everything else, run
+
+    make clean
+
+
+## Maintainers: Working with PyPI
+
+### README
+
+To update the README on PyPI, run
+
+    make register
+
+This will test the README's syntax stricly and push it up to the PyPI test server.
+ 
+If you are satisfied with the results, run
+
+    make release register
+
+to do it for real on the production PyPI server.
+
+### Publishing
+
+To publish a new version to PyPI, run
+
+    make upload
+
+This will run `make test`, zip up the source distribution and push it to the PyPI test server.
+
+If this looks like it went well, run
+
+    make release upload
+
+to push the distribution to the production PyPI server.
+
+
+[brew]: http://brew.sh/
+[python.org/downloads]: http://www.python.org/downloads
+[travis-ci.org]: https://travis-ci.org/
+[Confuzzled AVL tree]: http://www.eternallyconfuzzled.com/tuts/datastructures/jsw_tut_avl.aspx
+[Wiki intervaltree]: http://en.wikipedia.org/wiki/Interval_tree
+[Kahn intervaltree]: http://zurb.com/forrst/posts/Interval_Tree_implementation_in_python-e0K
diff --git a/LICENSE.txt b/LICENSE.txt
new file mode 100644
index 0000000..d645695
--- /dev/null
+++ b/LICENSE.txt
@@ -0,0 +1,202 @@
+
+                                 Apache License
+                           Version 2.0, January 2004
+                        http://www.apache.org/licenses/
+
+   TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
+
+   1. Definitions.
+
+      "License" shall mean the terms and conditions for use, reproduction,
+      and distribution as defined by Sections 1 through 9 of this document.
+
+      "Licensor" shall mean the copyright owner or entity authorized by
+      the copyright owner that is granting the License.
+
+      "Legal Entity" shall mean the union of the acting entity and all
+      other entities that control, are controlled by, or are under common
+      control with that entity. For the purposes of this definition,
+      "control" means (i) the power, direct or indirect, to cause the
+      direction or management of such entity, whether by contract or
+      otherwise, or (ii) ownership of fifty percent (50%) or more of the
+      outstanding shares, or (iii) beneficial ownership of such entity.
+
+      "You" (or "Your") shall mean an individual or Legal Entity
+      exercising permissions granted by this License.
+
+      "Source" form shall mean the preferred form for making modifications,
+      including but not limited to software source code, documentation
+      source, and configuration files.
+
+      "Object" form shall mean any form resulting from mechanical
+      transformation or translation of a Source form, including but
+      not limited to compiled object code, generated documentation,
+      and conversions to other media types.
+
+      "Work" shall mean the work of authorship, whether in Source or
+      Object form, made available under the License, as indicated by a
+      copyright notice that is included in or attached to the work
+      (an example is provided in the Appendix below).
+
+      "Derivative Works" shall mean any work, whether in Source or Object
+      form, that is based on (or derived from) the Work and for which the
+      editorial revisions, annotations, elaborations, or other modifications
+      represent, as a whole, an original work of authorship. For the purposes
+      of this License, Derivative Works shall not include works that remain
+      separable from, or merely link (or bind by name) to the interfaces of,
+      the Work and Derivative Works thereof.
+
+      "Contribution" shall mean any work of authorship, including
+      the original version of the Work and any modifications or additions
+      to that Work or Derivative Works thereof, that is intentionally
+      submitted to Licensor for inclusion in the Work by the copyright owner
+      or by an individual or Legal Entity authorized to submit on behalf of
+      the copyright owner. For the purposes of this definition, "submitted"
+      means any form of electronic, verbal, or written communication sent
+      to the Licensor or its representatives, including but not limited to
+      communication on electronic mailing lists, source code control systems,
+      and issue tracking systems that are managed by, or on behalf of, the
+      Licensor for the purpose of discussing and improving the Work, but
+      excluding communication that is conspicuously marked or otherwise
+      designated in writing by the copyright owner as "Not a Contribution."
+
+      "Contributor" shall mean Licensor and any individual or Legal Entity
+      on behalf of whom a Contribution has been received by Licensor and
+      subsequently incorporated within the Work.
+
+   2. Grant of Copyright License. Subject to the terms and conditions of
+      this License, each Contributor hereby grants to You a perpetual,
+      worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+      copyright license to reproduce, prepare Derivative Works of,
+      publicly display, publicly perform, sublicense, and distribute the
+      Work and such Derivative Works in Source or Object form.
+
+   3. Grant of Patent License. Subject to the terms and conditions of
+      this License, each Contributor hereby grants to You a perpetual,
+      worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+      (except as stated in this section) patent license to make, have made,
+      use, offer to sell, sell, import, and otherwise transfer the Work,
+      where such license applies only to those patent claims licensable
+      by such Contributor that are necessarily infringed by their
+      Contribution(s) alone or by combination of their Contribution(s)
+      with the Work to which such Contribution(s) was submitted. If You
+      institute patent litigation against any entity (including a
+      cross-claim or counterclaim in a lawsuit) alleging that the Work
+      or a Contribution incorporated within the Work constitutes direct
+      or contributory patent infringement, then any patent licenses
+      granted to You under this License for that Work shall terminate
+      as of the date such litigation is filed.
+
+   4. Redistribution. You may reproduce and distribute copies of the
+      Work or Derivative Works thereof in any medium, with or without
+      modifications, and in Source or Object form, provided that You
+      meet the following conditions:
+
+      (a) You must give any other recipients of the Work or
+          Derivative Works a copy of this License; and
+
+      (b) You must cause any modified files to carry prominent notices
+          stating that You changed the files; and
+
+      (c) You must retain, in the Source form of any Derivative Works
+          that You distribute, all copyright, patent, trademark, and
+          attribution notices from the Source form of the Work,
+          excluding those notices that do not pertain to any part of
+          the Derivative Works; and
+
+      (d) If the Work includes a "NOTICE" text file as part of its
+          distribution, then any Derivative Works that You distribute must
+          include a readable copy of the attribution notices contained
+          within such NOTICE file, excluding those notices that do not
+          pertain to any part of the Derivative Works, in at least one
+          of the following places: within a NOTICE text file distributed
+          as part of the Derivative Works; within the Source form or
+          documentation, if provided along with the Derivative Works; or,
+          within a display generated by the Derivative Works, if and
+          wherever such third-party notices normally appear. The contents
+          of the NOTICE file are for informational purposes only and
+          do not modify the License. You may add Your own attribution
+          notices within Derivative Works that You distribute, alongside
+          or as an addendum to the NOTICE text from the Work, provided
+          that such additional attribution notices cannot be construed
+          as modifying the License.
+
+      You may add Your own copyright statement to Your modifications and
+      may provide additional or different license terms and conditions
+      for use, reproduction, or distribution of Your modifications, or
+      for any such Derivative Works as a whole, provided Your use,
+      reproduction, and distribution of the Work otherwise complies with
+      the conditions stated in this License.
+
+   5. Submission of Contributions. Unless You explicitly state otherwise,
+      any Contribution intentionally submitted for inclusion in the Work
+      by You to the Licensor shall be under the terms and conditions of
+      this License, without any additional terms or conditions.
+      Notwithstanding the above, nothing herein shall supersede or modify
+      the terms of any separate license agreement you may have executed
+      with Licensor regarding such Contributions.
+
+   6. Trademarks. This License does not grant permission to use the trade
+      names, trademarks, service marks, or product names of the Licensor,
+      except as required for reasonable and customary use in describing the
+      origin of the Work and reproducing the content of the NOTICE file.
+
+   7. Disclaimer of Warranty. Unless required by applicable law or
+      agreed to in writing, Licensor provides the Work (and each
+      Contributor provides its Contributions) on an "AS IS" BASIS,
+      WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+      implied, including, without limitation, any warranties or conditions
+      of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
+      PARTICULAR PURPOSE. You are solely responsible for determining the
+      appropriateness of using or redistributing the Work and assume any
+      risks associated with Your exercise of permissions under this License.
+
+   8. Limitation of Liability. In no event and under no legal theory,
+      whether in tort (including negligence), contract, or otherwise,
+      unless required by applicable law (such as deliberate and grossly
+      negligent acts) or agreed to in writing, shall any Contributor be
+      liable to You for damages, including any direct, indirect, special,
+      incidental, or consequential damages of any character arising as a
+      result of this License or out of the use or inability to use the
+      Work (including but not limited to damages for loss of goodwill,
+      work stoppage, computer failure or malfunction, or any and all
+      other commercial damages or losses), even if such Contributor
+      has been advised of the possibility of such damages.
+
+   9. Accepting Warranty or Additional Liability. While redistributing
+      the Work or Derivative Works thereof, You may choose to offer,
+      and charge a fee for, acceptance of support, warranty, indemnity,
+      or other liability obligations and/or rights consistent with this
+      License. However, in accepting such obligations, You may act only
+      on Your own behalf and on Your sole responsibility, not on behalf
+      of any other Contributor, and only if You agree to indemnify,
+      defend, and hold each Contributor harmless for any liability
+      incurred by, or claims asserted against, such Contributor by reason
+      of your accepting any such warranty or additional liability.
+
+   END OF TERMS AND CONDITIONS
+
+   APPENDIX: How to apply the Apache License to your work.
+
+      To apply the Apache License to your work, attach the following
+      boilerplate notice, with the fields enclosed by brackets "[]"
+      replaced with your own identifying information. (Don't include
+      the brackets!)  The text should be enclosed in the appropriate
+      comment syntax for the file format. We also recommend that a
+      file or class name and description of purpose be included on the
+      same "printed page" as the copyright notice for easier
+      identification within third-party archives.
+
+   Copyright [yyyy] [name of copyright owner]
+
+   Licensed under the Apache License, Version 2.0 (the "License");
+   you may not use this file except in compliance with the License.
+   You may obtain a copy of the License at
+
+       http://www.apache.org/licenses/LICENSE-2.0
+
+   Unless required by applicable law or agreed to in writing, software
+   distributed under the License is distributed on an "AS IS" BASIS,
+   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+   See the License for the specific language governing permissions and
+   limitations under the License.
diff --git a/MANIFEST.in b/MANIFEST.in
new file mode 100644
index 0000000..2cdad61
--- /dev/null
+++ b/MANIFEST.in
@@ -0,0 +1 @@
+include README.md CHANGELOG.md LICENSE.txt
\ No newline at end of file
diff --git a/Makefile b/Makefile
new file mode 100644
index 0000000..0651024
--- /dev/null
+++ b/Makefile
@@ -0,0 +1,141 @@
+SHELL=bash
+
+SCRIPTS_DIR:=$(PWD)/scripts
+
+# any files ending in .py?, and any folders named __pycache__
+TEMPS=$(shell                                                   \
+	find intervaltree/ test/                                    \
+		\( -type f -name '*.py?' ! -path '*/__pycache__/*' \)   \
+		-o \( -type d -name '__pycache__' \)                    \
+)
+
+PYTHONS:=2.6 2.7 3.2 3.3 3.4
+PYTHON_MAJORS:=$(shell          \
+	echo "$(PYTHONS)" |         \
+	tr ' ' '\n' | cut -d. -f1 | \
+	uniq                        \
+)
+
+# PyPI server name, as specified in ~/.pypirc
+# See http://peterdowns.com/posts/first-time-with-pypi.html
+PYPI=pypitest
+
+# default target
+all: test
+
+test: pytest rst
+	
+quicktest: rst
+	PYPI=$(PYPI) python setup.py test
+
+coverage:
+	coverage run --source=intervaltree setup.py develop test
+	coverage report
+	coverage html
+
+pytest: deps-dev
+	"$(SCRIPTS_DIR)/testall.sh"
+
+clean: clean-build clean-eggs clean-temps
+
+distclean: clean clean-deps
+
+clean-build:
+	rm -rf dist build
+
+clean-eggs:
+	rm -rf *.egg* .eggs/
+
+clean-deps:
+	rm -rf pyandoc docutils bin
+	rm -f pandoc
+
+clean-temps:
+	rm -rf $(TEMPS)
+
+install-testpypi:
+	pip install --pre -i https://testpypi.python.org/pypi intervaltree
+
+install-pypi:
+	pip install intervaltree
+
+install-develop:
+	PYPI=$(PYPI) python setup.py develop
+	
+uninstall:
+	pip uninstall intervaltree
+
+# Convert README to rst and check the result
+rst: pydocutils pyandoc
+	PYPI=$(PYPI) python setup.py check --restructuredtext
+	@echo "README is ready for PyPI"
+
+# Register at PyPI
+register: rst
+	PYPI=$(PYPI) python setup.py register -r $(PYPI)
+
+# Setup for live upload
+release:
+	$(eval PYPI=pypi)
+
+# Build source distribution
+sdist-upload:
+	PYPI=$(PYPI) python setup.py sdist upload -r $(PYPI)
+
+deps-dev: pyandoc
+
+pyandoc: pandoc-bin
+	[[ -d pyandoc/pandoc ]] || git clone --depth=50 git://github.com/chaimleib/pyandoc.git
+	[[ "`readlink pandoc`" == "pyandoc/pandoc" ]] || ln -s pyandoc/pandoc pandoc
+
+pandoc-bin: pm-update
+	pandoc -h &>/dev/null || brew install pandoc &>/dev/null || sudo apt-get install pandoc
+	
+pydocutils:
+	$(eval PYPKG=docutils)
+	python -c 'import $(PYPKG)' &>/dev/null ||       \
+		pip install --upgrade $(PYPKG) ||            \
+		pip install --upgrade --install-options="--install-purelib='$(PWD)'" docutils
+	
+pm-update:
+	pandoc -h &>/dev/null || brew update &>/dev/null || sudo apt-get update
+	
+# Uploads to test server, unless the release target was run too
+upload: test clean sdist-upload
+
+
+# for debugging the Makefile
+env:
+	@echo
+	@echo TEMPS="\"$(TEMPS)\""
+	@echo PYTHONS="\"$(PYTHONS)\""
+	@echo PYTHON_MAJORS="\"$(PYTHON_MAJORS)\""
+	@echo PYPI="\"$(PYPI)\""
+
+
+.PHONY: all \
+	test \
+	quicktest \
+	pytest \
+	clean \
+	distclean \
+	clean-build \
+	clean-eggs \
+	clean-deps \
+	clean-temps \
+	install-testpypi \
+	install-pypi \
+	install-develop \
+	uninstall \
+	rst \
+	register \
+	release \
+	sdist-upload \
+	deps-dev \
+	pyandoc \
+	pandoc-bin \
+	pydocutils \
+	pm-update \
+	upload \
+	env
+
diff --git a/README.md b/README.md
new file mode 100644
index 0000000..63f3b2f
--- /dev/null
+++ b/README.md
@@ -0,0 +1,361 @@
+[![Build status badge][]][build status]
+
+intervaltree
+============
+
+A mutable, self-balancing interval tree for Python 2 and 3. Queries may be by point, by range overlap, or by range envelopment.
+
+This library was designed to allow tagging text and time intervals, where the intervals include the lower bound but not the upper bound.
+
+Installing
+----------
+
+```sh
+pip install intervaltree
+```
+
+Features
+--------
+
+* Supports Python 2.6+ and Python 3.2+
+* Initializing
+
+    * blank `tree = IntervalTree()`
+    * from an iterable of `Interval` objects (`tree = IntervalTree(intervals)`)
+    * from an iterable of tuples (`tree = IntervalTree.from_tuples(interval_tuples)`)
+
+* Insertions
+
+    * `tree[begin:end] = data`
+    * `tree.add(interval)`
+    * `tree.addi(begin, end, data)`
+
+* Deletions
+
+    * `tree.remove(interval)`             (raises `ValueError` if not present)
+    * `tree.discard(interval)`            (quiet if not present)
+    * `tree.removei(begin, end, data)`    (short for `tree.remove(Interval(begin, end, data))`)
+    * `tree.discardi(begin, end, data)`   (short for `tree.discard(Interval(begin, end, data))`)
+    * `tree.remove_overlap(point)`
+    * `tree.remove_overlap(begin, end)`   (removes all overlapping the range)
+    * `tree.remove_envelop(begin, end)`   (removes all enveloped in the range)
+
+* Overlap queries
+
+    * `tree[point]`
+    * `tree[begin:end]`
+    * `tree.search(point)`
+    * `tree.search(begin, end)`
+
+* Envelop queries
+
+    * `tree.search(begin, end, strict=True)`
+
+* Membership queries
+
+    * `interval_obj in tree`              (this is fastest, O(1))
+    * `tree.containsi(begin, end, data)`
+    * `tree.overlaps(point)`
+    * `tree.overlaps(begin, end)`
+
+* Iterable
+
+    * `for interval_obj in tree:`
+    * `tree.items()`
+
+* Sizing
+
+    * `len(tree)`
+    * `tree.is_empty()`
+    * `not tree`
+    * `tree.begin()`          (the `begin` coordinate of the leftmost interval)
+    * `tree.end()`            (the `end` coordinate of the rightmost interval)
+
+* Set-like operations
+    
+    * union
+    
+        * `result_tree = tree.union(iterable)`
+        * `result_tree = tree1 | tree2`        
+        * `tree.update(iterable)`
+        * `tree |= other_tree`
+    
+    * difference
+    
+        * `result_tree = tree.difference(iterable)`
+        * `result_tree = tree1 - tree2`
+        * `tree.difference_update(iterable)`
+        * `tree -= other_tree`
+    
+    * intersection
+    
+        * `result_tree = tree.intersection(iterable)`
+        * `result_tree = tree1 & tree2`    
+        * `tree.intersection_update(iterable)`
+        * `tree &= other_tree`
+    
+    * symmetric difference
+    
+        * `result_tree = tree.symmetric_difference(iterable)`
+        * `result_tree = tree1 ^ tree2`
+        * `tree.symmetric_difference_update(iterable)`
+        * `tree ^= other_tree`
+    
+    * comparison
+    
+        * `tree1.issubset(tree2)` or `tree1 <= tree2`
+        * `tree1 <= tree2`
+        * `tree1.issuperset(tree2)` or `tree1 > tree2`
+        * `tree1 >= tree2`
+        * `tree1 == tree2`
+        
+* Restructuring
+
+    * `chop(begin, end)`      (slice intervals and remove everything between `begin` and `end`)
+    * `slice(point)`          (slice intervals at `point`)
+    * `split_overlaps()`      (slice at all interval boundaries)
+
+* Copying and typecasting
+
+    * `IntervalTree(tree)`    (`Interval` objects are same as those in tree)
+    * `tree.copy()`           (`Interval` objects are shallow copies of those in tree)
+    * `set(tree)`             (can later be fed into `IntervalTree()`)
+    * `list(tree)`            (ditto)
+
+* Pickle-friendly
+* Automatic AVL balancing
+
+Examples
+--------
+
+* Getting started
+
+    ``` python
+    >>> from intervaltree import Interval, IntervalTree
+    >>> t = IntervalTree()
+    >>> t
+    IntervalTree()
+    
+    ```
+
+* Adding intervals - any object works!
+
+    ``` python
+    >>> t[1:2] = "1-2"
+    >>> t[4:7] = (4, 7)
+    >>> t[5:9] = {5: 9}
+    
+    ```
+
+* Query by point
+
+    The result of a query is a `set` object, so if ordering is important,
+    you must sort it first.
+    
+    ``` python
+    >>> sorted(t[6])
+    [Interval(4, 7, (4, 7)), Interval(5, 9, {5: 9})]
+    >>> sorted(t[6])[0]
+    Interval(4, 7, (4, 7))
+    
+    ```
+
+* Query by range
+
+    Note that ranges are inclusive of the lower limit, but non-inclusive of the upper limit. So:
+
+    ``` python
+    >>> sorted(t[2:4])
+    []
+    
+    ```
+
+    But:
+
+    ``` python
+    >>> sorted(t[1:5])
+    [Interval(1, 2, '1-2'), Interval(4, 7, (4, 7))]
+    
+    ```
+
+* Accessing an `Interval` object
+
+    ``` python
... 188065 lines suppressed ...

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/python-modules/packages/python-intervaltree.git



More information about the Python-modules-commits mailing list