Sets maximal share of overall network extension
    as extra functionality in LOPF

    Parameters
    ----------
    share: float
        Maximal share of network extension in p.u.
344278
def max_line_ext(network, snapshots, share=1.01):

    

    lines_snom = network.lines.s_nom.sum()
    links_pnom = network.links.p_nom.sum()

    def _rule(m):

        lines_opt = sum(m.passive_branch_s_nom[index]
                        for index
                        in m.passive_branch_s_nom_index)

        links_opt = sum(m.link_p_nom[index]
                        for index
                        in m.link_p_nom_index)

        return (lines_opt + links_opt) <= (lines_snom + links_pnom) * share
    network.model.max_line_ext = Constraint(rule=_rule)
363531
private void invokeSharingClient(final ResolveInfo selectedResolveInfo) {
        isShareInProgress_ = true;
        final String channelName = selectedResolveInfo.loadLabel(context_.getPackageManager()).toString();
        BranchShortLinkBuilder shortLinkBuilder = builder_.getShortLinkBuilder();
        
        shortLinkBuilder.generateShortUrlInternal(new Branch.BranchLinkCreateListener() {
            @Override
            public void onLinkCreate(String url, BranchError error) {
                if (error == null) {
                    shareWithClient(selectedResolveInfo, url, channelName);
                } else {
                    //If there is a default URL specified share it.
                    String defaultUrl = builder_.getDefaultURL();
                    if (defaultUrl != null && defaultUrl.trim().length() > 0) {
                        shareWithClient(selectedResolveInfo, defaultUrl, channelName);
                    } else {
                        if (callback_ != null) {
                            callback_.onLinkShareResponse(url, channelName, error);
                        } else {
                            PrefHelper.Debug("Unable to share link " + error.getMessage());
                        }
                        if (error.getErrorCode() == BranchError.ERR_BRANCH_NO_CONNECTIVITY
                                || error.getErrorCode() == BranchError.ERR_BRANCH_TRACKING_DISABLED) {
                            shareWithClient(selectedResolveInfo, url, channelName);
                        } else {
                            cancelShareLinkDialog(false);
                            isShareInProgress_ = false;
                        }
                    }
                }
            }
        }, true);
    }
315595
def add(self, extension):
        
        index = len(self.extensions)
        self.extensions[index] = extension
        for protocol in extension.protocols:
            self.registry[protocol] = index
957622
def allocateFile(self, sharename, peer):
        
        peerDir = self.basepath.child(str(peer))
        if not peerDir.isdir():
            peerDir.makedirs()
        return (peerDir.child(sharename+'.incomplete'),
                peerDir.child(sharename))
820110
def share_extension(self, publisher_name, extension_name, account_name):
        
        route_values = {}
        if publisher_name is not None:
            route_values['publisherName'] = self._serialize.url('publisher_name', publisher_name, 'str')
        if extension_name is not None:
            route_values['extensionName'] = self._serialize.url('extension_name', extension_name, 'str')
        if account_name is not None:
            route_values['accountName'] = self._serialize.url('account_name', account_name, 'str')
        self._send(http_method='POST',
                   location_id='a1e66d8f-f5de-4d16-8309-91a4e015ee46',
                   version='5.1-preview.1',
                   route_values=route_values)
839135
private void allocateNormal(PooledByteBuf<T> buf, int reqCapacity, int normCapacity) {
        if (q050.allocate(buf, reqCapacity, normCapacity) || q025.allocate(buf, reqCapacity, normCapacity) ||
            q000.allocate(buf, reqCapacity, normCapacity) || qInit.allocate(buf, reqCapacity, normCapacity) ||
            q075.allocate(buf, reqCapacity, normCapacity)) {
            return;
        }

        // Add a new chunk.
        PoolChunk<T> c = newChunk(pageSize, maxOrder, pageShifts, chunkSize);
        boolean success = c.allocate(buf, reqCapacity, normCapacity);
        assert success;
        qInit.add(c);
    }
1125819
private double computeShare(JobInfo info, double w2sRatio,
      TaskType type, boolean considerMinMax) {
    if (!isRunnable(info)) {
      return 0;
    }
    double share = type == TaskType.MAP ? info.mapWeight : info.reduceWeight;
    share *= w2sRatio;
    if (considerMinMax) {
      int minSlots = type == TaskType.MAP ? info.minMaps : info.minReduces;
      share = Math.max(share, minSlots);
      int maxSlots = type == TaskType.MAP ? info.maxMaps : info.maxReduces;
      share = Math.min(share, maxSlots);
    }
    share = Math.min(share, runnableTasks(info, type));
    return share;
  }
552095
def set_ipv4_next_hop_load_share
      arr = config_get('route_map', 'set_ipv4_next_hop', @get_args)
      val = default_set_ipv4_next_hop_load_share
      arr.each do |str|
        next if str.empty?
        return true if str.include?('load-share')
      end
      val
    end
1252570
def share(self, auth, resource, options={}, defer=False):
        
        return self._call('share', auth, [resource, options], defer)
844550
def share(self, with_user, roles=None):
        '''
        
        '''
        return self.proxy.share(table=self.name, with_user=with_user,
                                roles=roles)
272638
@Override
    final public void setSharingPolicy(int sharingPolicy) {
        ValidateUtility.sharingPolicy(sharingPolicy);
        this.sharingPolicy = sharingPolicy;
        if (tc.isDebugEnabled()) {
            Tr.debug(tc, "setSharingPolicy() set global sharingPolicy to " + this.sharingPolicy + " for cacheName=" + cache.getCacheName());
        }
    }
1112103
public function setShared($shared)
    {
        $this->changes['shared'] = true;

        $this->shared = (bool) $shared;

        return $this;
    }
864339
def _ensure_extra_rows(self, term, N):
        
        attrs = self.graph.node[term]
        attrs['extra_rows'] = max(N, attrs.get('extra_rows', 0))
170850
def allocate(self, pool, tenant_id=None, **params):
        
        if not tenant_id:
            tenant_id = self.request.user.project_id
        create_dict = {'floating_network_id': pool,
                       'tenant_id': tenant_id}
        if 'subnet_id' in params:
            create_dict['subnet_id'] = params['subnet_id']
        if 'floating_ip_address' in params:
            create_dict['floating_ip_address'] = params['floating_ip_address']
        if 'description' in params:
            create_dict['description'] = params['description']
        if 'dns_domain' in params:
            create_dict['dns_domain'] = params['dns_domain']
        if 'dns_name' in params:
            create_dict['dns_name'] = params['dns_name']
        fip = self.client.create_floatingip(
            {'floatingip': create_dict}).get('floatingip')
        self._set_instance_info(fip)
        return FloatingIp(fip)
1246486
def set_prefix(self, prefix=None):
        
        if prefix is None:
            self._pfx = None
        else:
            self._pfx = prefix + self.SEP
1104958
function setShared (shared) {
  let polygons = this.polygons.map(function (p) {
    return new Polygon3(p.vertices, shared, p.plane)
  })
  let result = fromPolygons(polygons)
  result.properties = this.properties // keep original properties
  result.isRetesselated = this.isRetesselated
  result.isCanonicalized = this.isCanonicalized
  return result
}
617426
def _set_extensions(self, params):
        
        extensions = []
        if self._local_partial_reliability:
            params.append((SCTP_PRSCTP_SUPPORTED, b''))
            extensions.append(ForwardTsnChunk.type)

        extensions.append(ReconfigChunk.type)
        params.append((SCTP_SUPPORTED_CHUNK_EXT, bytes(extensions)))