def get_required_overload(self, weighted=None, wanted=None):
        weighted = weighted or self._build_weighted_replicas_by_tier()
        wanted = wanted or self._build_wanted_replicas_by_tier()
        max_overload = 0.0
        for dev in self._iter_devs():
            tier = (dev['region'], dev['zone'], dev['ip'], dev['id'])
            if not dev['weight']:
                if tier not in wanted or not wanted[tier]:
                    continue
                raise exceptions.RingValidationError(
                    'Device %s has zero weight and '
                    'should not want any replicas' % (tier,))
            required = (wanted[tier] - weighted[tier]) / weighted[tier]
            self.logger.debug('%s wants %s and is weighted for %s so '
                              'therefore requires %s overload' % (
                                  tier, wanted[tier], weighted[tier],
                                  required))
            if required > max_overload:
                max_overload = required
        return max_overload
Add a new type to this file.
dataset/ETHPy150Open openstack/swift/swift/common/ring/builder.py/RingBuilder.get_required_overload--crossover with--dataset/ETHPy150Open pdef/pdef/compiler/pdefc/lang.py/File.add_type