def _iter()

in mozregression/approx_persist.py [0:0]


    def _iter(self, build_range, build_info):
        """
        iterate over the possible file name regexes that can match
        an approx build, without the exact filename
        """
        around = len(build_range) // self.one_every
        index = build_range.index(build_info)

        def date_or_chset(next_index):
            # Return the date (for nightlies) or the changeset (for
            # taskcluster) associated with the FutureBuildInfo at the
            # given index.
            return build_info.persist_filename_for(
                # get_future can raise IndexError if we are out of bounds
                build_range.get_future(next_index).date_or_changeset()
            )

        first, last = 0, len(build_range) - 1
        for i in range(1, around + 1):
            try:
                next_index = index - i
                if next_index > first:
                    yield next_index, date_or_chset(next_index)
            except IndexError:
                pass
            try:
                next_index = index + i
                if next_index < last:
                    yield next_index, date_or_chset(next_index)
            except IndexError:
                pass