def _find_approx_build()

in mozregression/bisector.py [0:0]


    def _find_approx_build(self, mid_point, build_infos):
        approx_index, persist_files = None, ()
        if self.approx_chooser:
            # try to find an approx build
            persist_files = os.listdir(self.download_manager.destdir)
            # first test if we have the exact file - if we do,
            # just act as usual, the downloader will take care of it.
            if build_infos.persist_filename not in persist_files:
                approx_index = self.approx_chooser.index(
                    self.build_range, build_infos, persist_files
                )
        if approx_index is not None:
            # we found an approx build. First, stop possible background
            # downloads, then update the mid point and build info.
            if self.download_manager.background_dl_policy == "cancel":
                self.download_manager.cancel()

            old_url = build_infos.build_url
            mid_point = approx_index
            build_infos = self.build_range[approx_index]
            fname = self.download_manager.get_dest(build_infos.persist_filename)
            LOG.info(
                "Using `%s` as an acceptable approximated"
                " build file instead of downloading %s" % (fname, old_url)
            )
            build_infos.build_file = fname
        return (approx_index is not None, mid_point, build_infos, persist_files)