(self)
| 436 | |
| 437 | @property |
| 438 | def length(self): |
| 439 | if self._length is None: |
| 440 | # if was not possible to get the length of the iterator when |
| 441 | # the loop context was created (ie: iterating over a generator) |
| 442 | # we have to convert the iterable into a sequence and use the |
| 443 | # length of that + the number of iterations so far. |
| 444 | iterable = tuple(self._iterator) |
| 445 | self._iterator = iter(iterable) |
| 446 | iterations_done = self.index0 + 2 |
| 447 | self._length = len(iterable) + iterations_done |
| 448 | return self._length |
| 449 | |
| 450 | def __iter__(self): |
| 451 | return LoopContextIterator(self) |
no outgoing calls
no test coverage detected