An interval package for Python.
Pyinter is a small and simple library written in Python for performing interval and discontinous range arithmetic.
>>> pyinter.openclosed(1.1, 12) (1.1, 12] >>> discontinous_range = pyinter.IntervalSet([pyinter.closedopen(5, 10), pyinter.closed(22, 23)]) >>> discontinous_range IntervalSet([5, 10), [22, 23]) >>> 7 in discontinous_range True >>> 10 in discontinous_range False # This isn't in the range as it is an open interval which doesn't include its end points
- interval objects which can be
- easily constructed using helper functions: open, closed, openclosed and closedopen
- interval sets which can be
To install Pyinter, simply:
$ pip install pyinter
Or, if you absolutely must:
$ easy_install pyinter
But I’m told you really shouldn’t do that.
Documentation is available at http://pyinter.readthedocs.org.
Contributions or suggestions for improvements are welcome.
- Fix empty interval types so that empty intervals could be compared with other intervals
- Add method
copy()to create new
Intervalinstances with the same bounds and values as the
- Fix method
Intervaland add tests for it!
- Fix formatting in README.rst as pypi isn’t rendering it properly.
&in the documentation.
- Implement subtraction of
- Add method
empty()to detect empty
- Fix, each infinity should always equal itself.
- Add a complement function
- Fix bug with using & and | for
- Increase test coverage!
- Fix the
__all__list so that you can
from pyinter import *.
- Change classes to new style classes (inheriting from object)
- Added an
add()function to the
IntervalSetclass. This will add (union) an Interval inplace. (similarly to
- The optional iterable of Interval objects passed when initialising an
IntervalSetis now added Interval by Interval so that initialising with overlapping intervals works as expected.
- Fix formatting in HISTORY.rst which was stopping the pypi page rendering it.
- Removed *.md from the MANIFEST file as it warns when installing that no files matching *.md are found.
- Fix allowing an IntervalSet to be initialised with a generator.
- Fixed the rendering of the README on pypi (hopefully!) by converting it from a .md file to a .rst file.
- Adding Manifest file to fix the pypi release. This was broken because the README.md was not being included in the source distribution but setup.py had a reference to this file and therefore failed to run.
- Initial release