Lines Matching refs:self
33 def __init__(self, data=None): argument
34 self.monotonic = False
35 self._extra = {}
37 self._parse_internal(data)
40 self.data = tuple(self._remove_pairs(data))
41 self.monotonic = all(x < y for x, y in zip(self.data, self.data[1:]))
43 self.data = ()
45 def __iter__(self): argument
46 for i in range(0, len(self.data), 2):
47 yield self.data[i:i+2]
49 def __eq__(self, other): argument
50 return self.data == other.data
52 def __ne__(self, other): argument
53 return self.data != other.data
55 def __bool__(self): argument
56 return bool(self.data)
61 def __str__(self): argument
62 if not self.data:
65 return self.to_string()
67 def __repr__(self): argument
68 return '<RangeSet("' + self.to_string() + '")>'
71 def extra(self): argument
72 return self._extra
104 def _parse_internal(self, text): argument
126 self.data = tuple(self._remove_pairs(data))
127 self.monotonic = monotonic
145 def to_string(self): argument
147 for i in range(0, len(self.data), 2):
148 s, e = self.data[i:i+2]
155 def to_string_raw(self): argument
156 assert self.data
157 return str(len(self.data)) + "," + ",".join(str(i) for i in self.data)
159 def union(self, other): argument
170 for p, d in heapq.merge(zip(self.data, itertools.cycle((+1, -1))),
177 def intersect(self, other): argument
188 for p, d in heapq.merge(zip(self.data, itertools.cycle((+1, -1))),
195 def subtract(self, other): argument
207 for p, d in heapq.merge(zip(self.data, itertools.cycle((+1, -1))),
214 def overlaps(self, other): argument
227 for _, d in heapq.merge(zip(self.data, itertools.cycle((+1, -1))),
234 def size(self): argument
243 for i, p in enumerate(self.data):
250 def map_within(self, other): argument
268 for p, d in heapq.merge(zip(self.data, itertools.cycle((-5, +5))),
279 def extend(self, n): argument
293 out = self
294 for i in range(0, len(self.data), 2):
295 s, e = self.data[i:i+2]
301 def first(self, n): argument
320 if self.size() <= n:
321 return self
324 for s, e in self:
333 def next_item(self): argument
343 for s, e in self: