|
from lsst.pex.exceptions import NotFoundError
from .spatialCell import SpatialCellCandidateIterator, SpatialCell
__all__ = [] # import this module only for its side effects
def spatialCellCandidateIter(self):
while True:
try:
yield self.__deref__()
except NotFoundError:
return
self.__incr__()
SpatialCellCandidateIterator.__iter__ = spatialCellCandidateIter
def spatialCellIter(self):
return self.begin().__iter__()
SpatialCell.__iter__ = spatialCellIter
def spatialCellGetitem(self, idx):
idx = int(idx)
num_cells = len(self)
if idx < -num_cells or idx >= num_cells:
raise IndexError("idx={} < -{} or >= {})".format(idx,
num_cells, num_cells))
32 ↛ 33line 32 didn't jump to line 33, because the condition on line 32 was never true if idx < 0:
idx += num_cells
34 ↛ exitline 34 didn't return from function 'spatialCellGetitem', because the loop on line 34 didn't complete for i, cell in enumerate(self):
if i >= idx:
return cell
SpatialCell.__getitem__ = spatialCellGetitem
|