MCPcopy Index your code
hub / github.com/python-pendulum/pendulum / range

Method range

src/pendulum/interval.py:290–305  ·  view source on GitHub ↗
(self, unit: str, amount: int = 1)

Source from the content-addressed store, hash-verified

288 return separator.join(parts)
289
290 def range(self, unit: str, amount: int = 1) -> Iterator[_T]:
291 method = "add"
292 op = operator.le
293 if not self._absolute and self.invert:
294 method = "subtract"
295 op = operator.ge
296
297 start, end = self.start, self.end
298
299 i = amount
300 while op(start, end):
301 yield start
302
303 start = getattr(self.start, method)(**{unit: i})
304
305 i += amount
306
307 def as_duration(self) -> Duration:
308 """

Callers 7

__iter__Method · 0.95
test_rangeFunction · 0.95
test_range_no_overflowFunction · 0.95
test_range_invertedFunction · 0.95
test_range_with_dstFunction · 0.80
test_range_amountFunction · 0.80

Calls

no outgoing calls

Tested by 6

test_rangeFunction · 0.76
test_range_no_overflowFunction · 0.76
test_range_invertedFunction · 0.76
test_range_with_dstFunction · 0.64
test_range_amountFunction · 0.64