def select_best_source(self, fid):
        excluded = set()

        while True:
            # We get all the services each time in case there are new
            # up-to-date services
            services = set(
                key.split(':')[-1] for key in
                self.escalator.range(
                    'file:{}:uptodate:'.format(fid), include_value=False
                )
            )

            sources = excluded - services

            max_velocity = 0.
            source = None

            for candidate in sources:
                options = self.escalator.get(
                    u'service:{}:options'.format(candidate), default={}
                )
                velocity = options.get('velocity', 0.5)
                if velocity > max_velocity:
                    max_velocity = velocity
                    source = candidate

            if not source:
                break

            self.logger.debug("Selecting source {}", source)
            yield source

            # Apparently there was an issue with this source, so we exclude it.
            excluded.add(source)
dataset/ETHPy150Open onitu/onitu/onitu/brocker/brocker.py/Brocker.select_best_source/swapped operands of `-`