2 Collection of assertion functions used for the steps.
6 """ Compares a float value with a certain jitter.
8 def __init__(self, value, offset=0.00001):
12 def __eq__(self, other):
13 return abs(other - self.value) < self.offset
16 """ Comparator for bounding boxes.
18 def __init__(self, bbox_string):
19 self.coord = [float(x) for x in bbox_string.split(',')]
21 def __contains__(self, item):
22 if isinstance(item, str):
23 item = item.split(',')
24 item = list(map(float, item))
27 return self.coord[0] <= item[0] <= self.coord[2] \
28 and self.coord[1] <= item[1] <= self.coord[3]
31 return item[0] >= self.coord[0] and item[1] <= self.coord[1] \
32 and item[2] >= self.coord[2] and item[3] <= self.coord[3]
34 raise ValueError("Not a coordinate or bbox.")
37 return str(self.coord)