def filter(self, sources):
        """
        :param sources: a sequence of sources
        :yields: sources with .indices
        """
        for src in sources:
            if hasattr(src, 'indices'):   # already filtered
                yield src
                continue
            box = self.integration_distance.get_affected_box(src)
            indices = self.sitecol.within_bbox(box)
            if len(indices):
                src.indices = indices
                yield src
def filter ( self , sources ) : for src in sources : if hasattr ( src , 'indices' ) : yield src continue box = self . integration_distance . get_affected_box ( src ) indices = self . sitecol . within_bbox ( box ) if len ( indices ) : src . indices = indices yield src
:param sources: a sequence of sources
        :yields: sources with .indices