// Samples returns an object that can list and get Samples.
161217
func (s *sampleLister) Samples(namespace string) SampleNamespaceLister {
	return sampleNamespaceLister{indexer: s.indexer, namespace: namespace}
}
1197679
func newSamples(c *MyprojectV1alpha1Client, namespace string) *samples {
	return &samples{
		client: c.RESTClient(),
		ns:     namespace,
	}
}
806530
func (s *ExpDecaySample) Snapshot() Sample {
	s.mutex.Lock()
	defer s.mutex.Unlock()
	vals := s.values.Values()
	values := make([]int64, len(vals))
	for i, v := range vals {
		values[i] = v.v
	}
	return &SampleSnapshot{
		count:  s.count,
		values: values,
	}
}
1096605
func (t *Trace) Add(samples ...*ssf.SSFSample) {
	t.Samples = append(t.Samples, samples...)
}
869627
func (c *FakeSamples) List(opts v1.ListOptions) (result *v1alpha1.SampleList, err error) {
	obj, err := c.Fake.
		Invokes(testing.NewListAction(samplesResource, samplesKind, c.ns, opts), &v1alpha1.SampleList{})

	if obj == nil {
		return nil, err
	}

	label, _, _ := testing.ExtractFromListOptions(opts)
	if label == nil {
		label = labels.Everything()
	}
	list := &v1alpha1.SampleList{ListMeta: obj.(*v1alpha1.SampleList).ListMeta}
	for _, item := range obj.(*v1alpha1.SampleList).Items {
		if label.Matches(labels.Set(item.Labels)) {
			list.Items = append(list.Items, item)
		}
	}
	return list, err
}
767767
func (p *SampleQueryProperty) Filter(op string, value interface{}) *SampleQueryBuilder {
	switch op {
	case "<=":
		p.LessThanOrEqual(value)
	case ">=":
		p.GreaterThanOrEqual(value)
	case "<":
		p.LessThan(value)
	case ">":
		p.GreaterThan(value)
	case "=":
		p.Equal(value)
	default:
		p.bldr.q = p.bldr.q.Filter(p.name+" "+op, value) // error raised by native query
	}
	if p.bldr.plugin != nil {
		p.bldr.plugin.Filter(p.name, op, value)
	}
	return p.bldr
}
1319855
func (l Logger) Sample(s Sampler) Logger {
	l.sampler = s
	return l
}
1280457
func (orig *SampleJSON) Convert() (*Sample, error) {
	ret := &Sample{}

	b := NewSampleJSONBuilder().AddAll()
	for _, info := range b._properties {
		if err := info.Decoder(orig, ret); err != nil {
			return nil, err
		}
	}

	return ret, nil
}
121719
func (s *BasicSampler) Sample(lvl Level) bool {
	c := atomic.AddUint32(&s.counter, 1)
	return c%s.N == s.N-1
}
741633
func (c *samples) Update(sample *v1alpha1.Sample) (result *v1alpha1.Sample, err error) {
	result = &v1alpha1.Sample{}
	err = c.client.Put().
		Namespace(c.ns).
		Resource("samples").
		Name(sample.Name).
		Body(sample).
		Do().
		Into(result)
	return
}
1340523
func (s Samples) Equal(o Samples) bool {
	if len(s) != len(o) {
		return false
	}

	for i, sample := range s {
		if !sample.Equal(o[i]) {
			return false
		}
	}
	return true
}
741490
func ExtractSamples(o *DecodeOptions, fams ...*dto.MetricFamily) (model.Vector, error) {
	var (
		all     model.Vector
		lastErr error
	)
	for _, f := range fams {
		some, err := extractSamples(f, o)
		if err != nil {
			lastErr = err
			continue
		}
		all = append(all, some...)
	}
	return all, lastErr
}
498173
func ParseSampleFormat(s string) SampleFormat {
	cstr := C.CString(s)
	defer C.free(unsafe.Pointer(cstr))
	return SampleFormat(C.pa_parse_sample_format(cstr))
}
742493
func SampleWithReplacement(from FixedDataGrid, size int) FixedDataGrid {
	rowMap := make(map[int]int)
	_, rows := from.Size()
	for i := 0; i < size; i++ {
		srcRow := rand.Intn(rows)
		rowMap[i] = srcRow
	}
	return NewInstancesViewFromRows(from, rowMap)
}
553566
func (jsonList SampleJSONList) Convert() ([]*Sample, error) {
	orig := ([]*SampleJSON)(jsonList)

	list := make([]*Sample, len(orig))
	for idx, or := range orig {
		obj, err := or.Convert()
		if err != nil {
			return nil, err
		}
		list[idx] = obj
	}

	return list, nil
}
1105664
func (s Sample) Mean() float64 {
	if len(s.Xs) == 0 || s.Weights == nil {
		return Mean(s.Xs)
	}

	m, wsum := 0.0, 0.0
	for i, x := range s.Xs {
		// Use weighted incremental mean:
		//   m_i = (1 - w_i/wsum_i) * m_(i-1) + (w_i/wsum_i) * x_i
		//       = m_(i-1) + (x_i - m_(i-1)) * (w_i/wsum_i)
		w := s.Weights[i]
		wsum += w
		m += (x - m) * w / wsum
	}
	return m
}
692005
func (in *SampleSpec) DeepCopy() *SampleSpec {
	if in == nil {
		return nil
	}
	out := new(SampleSpec)
	in.DeepCopyInto(out)
	return out
}