Permalink
Browse files

Update to work on python 2.6

  • Loading branch information...
1 parent 1dea0ca commit b4bf71c3dd5a7f9cc7244e97af77a628a6f00b30 @axiak committed Mar 18, 2012
Showing with 8 additions and 6 deletions.
  1. +2 −0 README.md
  2. +4 −4 python2/rangeset/__init__.py
  3. +1 −1 python2/rangeset/test/mergeinfo.py
  4. +1 −1 python2/rangeset/test/test.py
View
@@ -1,5 +1,7 @@
# rangeset - A utility belt for operations on sets of ranges #
+[![Build Status](https://secure.travis-ci.org/axiak/py-rangeset.png?branch=master)](http://travis-ci.org/axiak/py-rangeset)
+
## Overview ##
Rangeset is a package that allows for easy manipulation of sets of ranges. These ranges can contain any ordered elements, be they numbers, tuples, or even datetime objects.
@@ -120,7 +120,7 @@ def __or__(self, *other):
def __and__(self, *other, **kwargs):
min_overlap = kwargs.pop('minimum', 2)
if kwargs:
- raise ValueError("kwargs is not empty: {}".format(kwargs))
+ raise ValueError("kwargs is not empty: {0}".format(kwargs))
sorted_ends = self.__merged_ends(*other)
new_ends = []
for _, end, state in RangeSet.__iterate_state(sorted_ends):
@@ -247,9 +247,9 @@ def range(self):
return self.ends[-1][0] - self.ends[0][0]
def __str__(self):
- pieces = ["{} -- {}".format(self.ends[i][0], self.ends[i + 1][0])
+ pieces = ["{0} -- {1}".format(self.ends[i][0], self.ends[i + 1][0])
for i in range(0, len(self.ends), 2)]
- return "<RangeSet {}>".format(", ".join(pieces))
+ return "<RangeSet {0}>".format(", ".join(pieces))
__repr__ = __str__
@@ -273,7 +273,7 @@ def __hash__(self):
def mutual_overlaps(cls, *ranges, **kwargs):
minimum = kwargs.pop('minimum', 2)
if kwargs:
- raise ValueError("kwargs is not empty: {}".format(kwargs))
+ raise ValueError("kwargs is not empty: {0}".format(kwargs))
return cls.__coerce(ranges[0]).intersect(*ranges[1:], minimum=minimum)
@classmethod
@@ -62,4 +62,4 @@ def build_manually():
generate_test_data()
for test in ('chain_and_sort', 'chain_and_sort2', 'chain_and_sort3'):
t = timeit.Timer("%s()" % test, "from __main__ import %s" % test)
- print '{}: {}'.format(test, t.timeit(number=10000))
+ print '{0}: {1}'.format(test, t.timeit(number=10000))
@@ -6,7 +6,7 @@
def runtest():
for f in glob.glob(os.path.join(os.path.dirname(__file__),
'*.txt')):
- print "Testing {}".format(f)
+ print "Testing {0}".format(f)
doctest.testfile(os.path.basename(f))
def suite():

0 comments on commit b4bf71c

Please sign in to comment.