// GetWeights returns weights data for the requested relays/bridges
551221
func GetWeights(query map[string]string, lastModifiedSince string) (*Weights, string, error) {
	weights := new(Weights)

	if lastModified, err := executeRequest("weights", query, lastModifiedSince, &weights); err != nil {
		return nil, "", err
	} else {
		return weights, lastModified, nil
	}
}
10181
func (e *Edge) WeightValue() int64 {
	if e.WeightDiv == 0 {
		return e.Weight
	}
	return e.Weight / e.WeightDiv
}
833833
func (r Network_LBaaS_LoadBalancer) GetSslCiphers() (resp []datatypes.Network_LBaaS_SSLCipher, err error) {
	err = r.Session.DoRequest("SoftLayer_Network_LBaaS_LoadBalancer", "getSslCiphers", nil, &r.Options, &resp)
	return
}
489556
func (bridge *Bridge) GetAllSensors() ([]Sensor, error) {
	uri := fmt.Sprintf("/api/%s/sensors", bridge.Username)
	body, _, err := bridge.Get(uri)
	if err != nil {
		return []Sensor{}, err
	}

	// An index is at the top of every sensor in the array
	sensorList := map[string]Sensor{}
	err = json.Unmarshal(body, &sensorList)
	if err != nil {
		fmt.Print(err)
		return []Sensor{}, errors.New("Unable to marshal GetAllSensors response. ")
	}

	// Parse the index, add the sensor to the list, and return the array
	sensors := make([]Sensor, 0, len(sensorList))
	for index, sensor := range sensorList {
		sensor.Index, err = strconv.Atoi(index)
		if err != nil {
			return []Sensor{}, errors.New("Unable to convert sensor index to integer. ")
		}
		sensor.Bridge = bridge
		sensors = append(sensors, sensor)
	}
	return sensors, nil
}
967626
func (a *AlgorithmChain) WeightingHits(
	wordID int,
	rank *Rank,
) float32 {
	word := rank.Words[wordID]
	qty := 0

	for leftWordID, leftWordQty := range word.ConnectionLeft {
		qty += rank.Words[leftWordID].Qty * leftWordQty
	}

	for rightWordID, rightWordQty := range word.ConnectionRight {
		qty += rank.Words[rightWordID].Qty * rightWordQty
	}

	weight := float32(word.Qty) + (float32(qty))

	return float32(weight)
}
819409
func (ls *LinearSeries) GetValues(index int) (x, y float64) {
	if ls.InnerSeries == nil || len(ls.XValues) == 0 {
		return
	}
	if ls.IsZero() {
		ls.computeCoefficients()
	}
	x = ls.XValues[index]
	y = (ls.m * ls.normalize(x)) + ls.b
	return
}
1332842
func (b *Bittrex) GetBalances() (balances []Balance, err error) {
	r, err := b.client.do("GET", "account/getbalances", "", true)
	if err != nil {
		return
	}
	var response jsonResponse
	if err = json.Unmarshal(r, &response); err != nil {
		return
	}
	if err = handleErr(response); err != nil {
		return
	}
	err = json.Unmarshal(response.Result, &balances)
	return
}
1204557
func (r Network_LBaaS_LoadBalancer) GetMembers() (resp []datatypes.Network_LBaaS_Member, err error) {
	err = r.Session.DoRequest("SoftLayer_Network_LBaaS_LoadBalancer", "getMembers", nil, &r.Options, &resp)
	return
}
884256
func (bridge *Bridge) GetAllLights() ([]Light, error) {
	uri := fmt.Sprintf("/api/%s/lights", bridge.Username)
	body, _, err := bridge.Get(uri)
	if err != nil {
		return []Light{}, err
	}

	// An index is at the top of every Light in the array
	lightMap := map[string]Light{}
	err = json.Unmarshal(body, &lightMap)
	if err != nil {
		return []Light{}, errors.New("Unable to marshal GetAllLights response. ")
	}

	// Parse the index, add the light to the list, and return the array
	lights := []Light{}
	for index, light := range lightMap {
		light.Index, err = strconv.Atoi(index)
		if err != nil {
			return []Light{}, errors.New("Unable to convert light index to integer. ")
		}
		light.Bridge = bridge
		lights = append(lights, light)
	}
	return lights, nil
}
61713
func getWeightEstimate(inputs []input.Input) ([]input.Input, int64, int, int) {
	// We initialize a weight estimator so we can accurately asses the
	// amount of fees we need to pay for this sweep transaction.
	//
	// TODO(roasbeef): can be more intelligent about buffering outputs to
	// be more efficient on-chain.
	var weightEstimate input.TxWeightEstimator

	// Our sweep transaction will pay to a single segwit p2wkh address,
	// ensure it contributes to our weight estimate.
	weightEstimate.AddP2WKHOutput()

	// For each output, use its witness type to determine the estimate
	// weight of its witness, and add it to the proper set of spendable
	// outputs.
	var (
		sweepInputs         []input.Input
		csvCount, cltvCount int
	)
	for i := range inputs {
		inp := inputs[i]

		// For fee estimation purposes, we'll now attempt to obtain an
		// upper bound on the weight this input will add when fully
		// populated.
		size, isNestedP2SH, err := getInputWitnessSizeUpperBound(inp)
		if err != nil {
			log.Warn(err)

			// Skip inputs for which no weight estimate can be
			// given.
			continue
		}

		// If this is a nested P2SH input, then we'll need to factor in
		// the additional data push within the sigScript.
		if isNestedP2SH {
			weightEstimate.AddNestedP2WSHInput(size)
		} else {
			weightEstimate.AddWitnessInput(size)
		}

		switch inp.WitnessType() {
		case input.CommitmentTimeLock,
			input.HtlcOfferedTimeoutSecondLevel,
			input.HtlcAcceptedSuccessSecondLevel:
			csvCount++
		case input.HtlcOfferedRemoteTimeout:
			cltvCount++
		}
		sweepInputs = append(sweepInputs, inp)
	}

	txWeight := int64(weightEstimate.Weight())

	return sweepInputs, txWeight, csvCount, cltvCount
}
1108049
func (o *SAMLConnectorV2) GetAttributes() []string {
	var out []string
	for _, mapping := range o.Spec.AttributesToRoles {
		out = append(out, mapping.Name)
	}
	return utils.Deduplicate(out)
}
785094
func getAttrs(obj runtime.Object) (labels.Set, fields.Set, bool, error) {
	projectObj, ok := obj.(*projectapi.Project)
	if !ok {
		return nil, nil, false, fmt.Errorf("not a project")
	}
	return labels.Set(projectObj.Labels), projectToSelectableFields(projectObj), projectObj.Initializers != nil, nil
}
1308836
func (r *InMemorySpanRecorder) GetSpans() []RawSpan {
	r.RLock()
	defer r.RUnlock()
	spans := make([]RawSpan, len(r.spans))
	copy(spans, r.spans)
	return spans
}
49769
func (ts TimeSeries) GetValues(index int) (x, y float64) {
	x = util.Time.ToFloat64(ts.XValues[index])
	y = ts.YValues[index]
	return
}
858878
func (lbc *loadBalancerController) getEndpoints(
	s *api.Service, servicePort *api.ServicePort) (endpoints []string) {
	ep, err := lbc.epLister.GetServiceEndpoints(s)
	if err != nil {
		return
	}

	// The intent here is to create a union of all subsets that match a targetPort.
	// We know the endpoint already matches the service, so all pod ips that have
	// the target port are capable of service traffic for it.
	for _, ss := range ep.Subsets {
		for _, epPort := range ss.Ports {
			var targetPort int
			switch servicePort.TargetPort.Type {
			case intstr.Int:
				if epPort.Port == getTargetPort(servicePort) {
					targetPort = epPort.Port
				}
			case intstr.String:
				if epPort.Name == servicePort.TargetPort.StrVal {
					targetPort = epPort.Port
				}
			}
			if targetPort == 0 {
				continue
			}
			for _, epAddress := range ss.Addresses {
				endpoints = append(endpoints, fmt.Sprintf("%v:%v", epAddress.IP, targetPort))
			}
		}
	}
	return
}
880752
func (r *StatsServer) GetStats(req rpcwrapper.Request, resp *rpcwrapper.Response) error {

	if !r.rpchdl.ProcessMessage(&req, r.secret) {
		return errors.New("message sender cannot be verified")
	}

	payload := req.Payload.(rpcwrapper.StatsPayload)

	for _, record := range payload.Flows {
		r.collector.CollectFlowEvent(record)
	}

	for _, record := range payload.Users {
		r.collector.CollectUserEvent(record)
	}

	return nil
}
296489
func (a Anomalyzer) getWeight(name string, prob float64) float64 {
	weight := 0.5

	dynamicWeights := []string{"magnitude", "fence"}
	// If either the magnitude and fence methods don't have any
	// probability to contribute, we don't want to hear about it.
	// If they do, we upweight them substantially.
	if exists(name, dynamicWeights) {
		if prob > 0.8 {
			weight = 5.0
		} else {
			weight = 0.5
		}
	}

	return weight
}