id
stringlengths
2
7
text
stringlengths
17
51.2k
title
stringclasses
1 value
c10300
return nil, err } return &http.Transport{TLSClientConfig: cfg}, nil }
c10301
return nil, err } return &http.Client{Transport: transport}, nil }
c10302
runtime.CSVMime: runtime.CSVProducer(), runtime.DefaultMime: runtime.ByteStreamProducer(), } rt.Transport = http.DefaultTransport rt.Jar = nil rt.Host = host rt.BasePath = basePath rt.Context = context.Background() rt.clientOnce = new(sync.Once) if !strings.HasPrefix(rt.BasePath, "/") { rt.BasePath = ...
c10303
rt := New(host, basePath, schemes) if client != nil { rt.clientOnce.Do(func() { rt.client = client }) } return rt }
c10304
) return } r.client.Transport = KeepAliveTransport( transportOrDefault(r.client.Transport, transportOrDefault(r.Transport, http.DefaultTransport), ), ) }
c10305
debug middleware.Debug = debug }
c10306
logger middleware.Logger = logger }
c10307
data interface{}) error { dec := xml.NewDecoder(reader) return dec.Decode(data) }) }
c10308
data interface{}) error { enc := xml.NewEncoder(writer) return enc.Encode(data) }) }
c10309
Handler { return Handler{ Method: method, Path: path, Func: handler, } }
c10310
router := New() if err := router.Build(records); err != nil { return nil, err } mux.routers[m] = router } return mux, nil }
c10311
'/' || c == TerminationCharacter { break } start++ } return start }
c10312
return &untypedRequestBinder{ Parameters: parameters, paramBinders: binders, Spec: spec, Formats: formats, } }
c10313
if !target.IsValid() { result = append(result, errors.New(500, "parameter name %q is an unknown field", binder.Name)) continue } if err := binder.Bind(request, routeParams, consumer, target); err != nil { result = append(result, err) continue } if binder.validator != nil { rr := binder.vali...
c10314
&errorResp{http.StatusNotImplemented, message, make(http.Header)} }
c10315
strfmt.Registry) error { return fn(req, reg) }
c10316
} return &namedReadCloser{ name: name, cr: rc, } }
c10317
runtime.Producer) { fn(rw, pr) }
c10318
if spec != nil { an = analysis.New(spec.Spec()) } ctx := &Context{spec: spec, api: routableAPI, analyzer: an, router: routes} return ctx }
c10319
{ an = analysis.New(spec.Spec()) } ctx := &Context{spec: spec, analyzer: an} ctx.api = newRoutableUntypedAPI(spec, api, ctx) ctx.router = routes return ctx }
c10320
ServeWithBuilder(spec, api, PassthroughBuilder) }
c10321
context := NewContext(spec, api, nil) return context.APIHandler(builder) }
c10322
if mr == nil { return nil } if res, ok := mr.(*MatchedRoute); ok { return res } return nil }
c10323
:= rs.([]string); ok { return res } return nil }
c10324
res = append(res, errors.InvalidResponseFormat(request.Header.Get(runtime.HeaderAccept), route.Produces)) } } // now bind the request with the provided binder // it's assumed the binder will also validate the request and return an error if the // request is invalid if binder != nil && len(res) == 0 { if e...
c10325
if err != nil { return "", "", nil, err } rCtx = stdContext.WithValue(rCtx, ctxContentType, &contentTypeValue{mt, cs}) return mt, cs, request.WithContext(rCtx), nil }
c10326
request.URL.EscapedPath()); ok { return route, ok } return nil, false }
c10327
{ rCtx = stdContext.WithValue(rCtx, ctxMatchedRoute, route) return route, request.WithContext(rCtx), ok } return nil, nil, false }
c10328
return v, r } format := NegotiateContentType(r, offers, "") if format != "" { debugLog("[%s %s] set response format %q in context", r.Method, r.URL.Path, format) r = r.WithContext(stdContext.WithValue(rCtx, ctxResponseFormat, format)) } debugLog("[%s %s] negotiated response format %q", r.Method, r.URL.Path...
c10329
{ return c.router.OtherMethods(request.Method, request.URL.EscapedPath()) }
c10330
rctx = stdContext.WithValue(rctx, ctxSecurityScopes, nil) return request.WithContext(rctx) }
c10331
return v.bound, request, errors.CompositeValidationError(v.result...) } return v.bound, request, nil } result := validateRequest(c, request, matched) rCtx = stdContext.WithValue(rCtx, ctxBoundParams, result) request = request.WithContext(rCtx) if len(result.result) > 0 { return result.bound, request, erro...
c10332
[]string{c.api.DefaultProduces()}, nil, errors.NotFound("not found")) }
c10333
sp.Info.Title } redocOpts := RedocOpts{ BasePath: c.BasePath(), Title: title, } return Spec("", c.spec.Raw(), Redoc(redocOpts, c.RoutesHandler(b))) }
c10334
b = PassthroughBuilder } return NewRouter(c, b(NewOperationExecutor(c))) }
c10335
data != nil && t.Kind() == reflect.Ptr { v := reflect.Indirect(reflect.ValueOf(data)) if t.Elem().Kind() == reflect.String { v.SetString(string(b)) return nil } } return fmt.Errorf("%v (%T) is not supported by the TextConsumer, %s", data, data, "can be resolved by supporting TextUnmarshaler in...
c10336
err } if str, ok := data.(error); ok { _, err := writer.Write([]byte(str.Error())) return err } if str, ok := data.(fmt.Stringer); ok { _, err := writer.Write([]byte(str.String())) return err } v := reflect.Indirect(reflect.ValueOf(data)) if t := v.Type(); t.Kind() == reflect.Struct || t.K...
c10337
data.(io.Writer) if !ok { return errors.New("data type must be io.Writer") } csvWriter := csv.NewWriter(writer) records, err := csvReader.ReadAll() if err != nil { return err } for _, r := range records { if err := csvWriter.Write(r); err != nil { return err } } csvWriter.Flush() re...
c10338
be byte array") } csvReader := csv.NewReader(bytes.NewBuffer(dataBytes)) records, err := csvReader.ReadAll() if err != nil { return err } csvWriter := csv.NewWriter(writer) for _, r := range records { if err := csvWriter.Write(r); err != nil { return err } } csvWriter.Flush() return n...
c10339
err = errors.New("objx: JSON encode failed with: " + err.Error()) } return string(result), err }
c10340
panic(err.Error()) } return result }
c10341
&buf) _, _ = encoder.Write([]byte(jsonData)) _ = encoder.Close() return buf.String(), nil }
c10342
panic(err.Error()) } return result }
c10343
if err != nil { return "", err } sig := HashWithKey(base64, key) return base64 + SignatureSeparator + sig, nil }
c10344
err := m.SignedBase64(key) if err != nil { panic(err.Error()) } return result }
c10345
== "" { thisSel = mapMatches[2] nextSel = mapMatches[3] } if nextSel == "" { selSegs = []string{"", ""} } else if nextSel[0] == '.' { nextSel = nextSel[1:] } } } return thisSel, nextSel }
c10346
== "" && isSet { curMSI[thisSel] = value return nil } _, ok := curMSI[thisSel].(map[string]interface{}) if (curMSI[thisSel] == nil || !ok) && index == -1 && isSet { curMSI[thisSel] = map[string]interface{}{} } current = curMSI[thisSel] default: current = nil } // do we need to access the ite...
c10347
outIdx < len(inReal); outIdx, secondEMAIdx = outIdx+1, secondEMAIdx+1 { outReal[outIdx] = (2.0 * firstEMA[outIdx]) - secondEMA[secondEMAIdx] } return outReal }
c10348
= Trima(inReal, inTimePeriod) case KAMA: outReal = Kama(inReal, inTimePeriod) case MAMA: outReal, _ = Mama(inReal, 0.5, 0.05) case T3MA: outReal = T3(inReal, inTimePeriod, 0.7) } return outReal }
c10349
:= startIdx; i < outputSize; i++ { curPeriod := int(localPeriodArray[i]) if curPeriod != 0 { localOutputArray := Ma(inReal, curPeriod, inMAType) outReal[i] = localOutputArray[i] for j := i + 1; j < outputSize; j++ { if localPeriodArray[j] == float64(curPeriod) { localPeriodArray[j] = 0 outRe...
c10350
tmp := inReal[i] if tmp < lowest { lowest = tmp } else if tmp > highest { highest = tmp } } outReal[outIdx] = (highest + lowest) / 2.0 outIdx++ today++ } return outReal }
c10351
:= inLow[i] if tmp < lowest { lowest = tmp } tmp = inHigh[i] if tmp > highest { highest = tmp } } outReal[outIdx] = (highest + lowest) / 2.0 outIdx++ today++ } return outReal }
c10352
true; ok; { periodTotal += inReal[i] tempReal := periodTotal periodTotal -= inReal[trailingIdx] outReal[outIdx] = tempReal / float64(inTimePeriod) trailingIdx++ i++ outIdx++ ok = i < len(outReal) } return outReal }
c10353
outIdx := (inTimePeriod * 3) - 3 secondEMAIdx := (inTimePeriod * 2) - 2 thirdEMAIdx := inTimePeriod - 1 for outIdx < len(inReal) { outReal[outIdx] = thirdEMA[thirdEMAIdx] + ((3.0 * firstEMA[outIdx]) - (3.0 * secondEMA[secondEMAIdx])) outIdx++ secondEMAIdx++ thirdEMAIdx++ } return outReal }
c10354
inIdx++ i++ } trailingValue := 0.0 for inIdx < len(inReal) { tempReal := inReal[inIdx] periodSub += tempReal periodSub -= trailingValue periodSum += tempReal * float64(inTimePeriod) trailingValue = inReal[trailingIdx] outReal[outIdx] = periodSum / float64(divider) periodSum -= periodSub inIdx++ ...
c10355
for outIdx := startIdx + inTimePeriod - 1; outIdx < len(inClose); outIdx, i, j = outIdx+1, i+1, j+1 { outReal[outIdx] = ((tmpadx[i] + tmpadx[j]) / 2.0) } return outReal }
c10356
lowestIdx = today lowest = tmp } tmp = inHigh[today] if highestIdx < trailingIdx { highestIdx = trailingIdx highest = inHigh[highestIdx] i := highestIdx i++ for i <= today { tmp = inHigh[i] if tmp >= highest { highestIdx = i highest = tmp } i++ } } else if tmp ...
c10357
tempReal < (0.00000000000001) { outReal[i] = 0.0 } else { outReal[i] = (inClose[i] - inOpen[i]) / tempReal } } return outReal }
c10358
((prevGain - prevLoss) / tempValue1) } else { outReal[outIdx] = 0.0 } outIdx++ } else { for today < startIdx { tempValue1 := inReal[today] tempValue2 := tempValue1 - prevValue prevValue = tempValue1 prevLoss *= float64(inTimePeriod - 1) prevGain *= float64(inTimePeriod - 1) if tempValue2 ...
c10359
theAverage /= float64(inTimePeriod) tempReal2 := 0.0 for j := 0; j < inTimePeriod; j++ { tempReal2 += math.Abs(circBuffer[j] - theAverage) } tempReal := lastValue - theAverage if (tempReal != 0.0) && (tempReal2 != 0.0) { outReal[outIdx] = tempReal / (0.015 * (tempReal2 / float64(inTimePeriod))) } el...
c10360
len(slowMABuffer); i++ { tempBuffer1[i] = fastMABuffer[i] - slowMABuffer[i] } tempBuffer2 := Ma(tempBuffer1, inSignalPeriod, inSignalMAType) for i := lookbackTotal; i < len(outMACDHist); i++ { outMACD[i] = tempBuffer1[i] outMACDSignal[i] = tempBuffer2[i] outMACDHist[i] = outMACD[i] - outMACDSignal[i] } ...
c10361
(prevMinusDM / float64(inTimePeriod)) + diffM } else { prevMinusDM = prevMinusDM - (prevMinusDM / float64(inTimePeriod)) } } outReal[startIdx] = prevMinusDM outIdx = startIdx + 1 for today < len(inHigh)-1 { today++ tempReal := inHigh[today] diffP := tempReal - prevHigh prevHigh = tempReal tempReal...
c10362
outReal[outIdx] = inReal[inIdx] - inReal[trailingIdx] inIdx, outIdx, trailingIdx = inIdx+1, outIdx+1, trailingIdx+1 } return outReal }
c10363
i++ { tempReal := outReal[i] if !(((-(0.00000000000001)) < tempReal) && (tempReal < (0.00000000000001))) { outReal[i] = ((tempBuffer[i] - tempReal) / tempReal) * 100.0 } else { outReal[i] = 0.0 } } return outReal }
c10364
(prevGain / tempValue1) } else { outReal[outIdx] = 0.0 } outIdx++ } else { for today < 0 { tempValue1 = inReal[today] tempValue2 = tempValue1 - prevValue prevValue = tempValue1 prevLoss *= float64(inTimePeriod - 1) prevGain *= float64(inTimePeriod - 1) if tempValue2 < 0 { prevLoss -...
c10365
tmp := inHigh[i] if tmp > highest { highestIdx = i highest = tmp } i++ } diff = (highest - lowest) / 100.0 } else if tmp >= highest { highestIdx = today highest = tmp diff = (highest - lowest) / 100.0 } if diff != 0.0 { tempBuffer[outIdx] = (inClose[today] - lowest) / d...
c10366
i <= today { tmp = inHigh[i] if tmp > highest { highestIdx = i highest = tmp } i++ } diff = (highest - lowest) / 100.0 } else if tmp >= highest { highestIdx = today highest = tmp diff = (highest - lowest) / 100.0 } if diff != 0.0 { tempBuffer[outIdx] = (inClose[today] ...
c10367
Rsi(inReal, inTimePeriod) tempk, tempd := StochF(tempRSIBuffer, tempRSIBuffer, tempRSIBuffer, inFastKPeriod, inFastDPeriod, inFastDMAType) for i := startIdx; i < len(inReal); i++ { outFastK[i] = tempk[i] outFastD[i] = tempd[i] } return outFastK, outFastD }
c10368
tmp = inLow[i] if tmp < lowest { lowestIdx = i lowest = tmp } i++ } diff = (highest - lowest) / (-100.0) } else if tmp <= lowest { lowestIdx = today lowest = tmp diff = (highest - lowest) / (-100.0) } tmp = inHigh[today] if highestIdx < trailingIdx { highestIdx = trailin...
c10369
for i := startIdx; i < len(inReal); i++ { tempReal := inReal[i] if tempReal > prevReal { prevOBV += inVolume[i] } else if tempReal < prevReal { prevOBV -= inVolume[i] } outReal[outIdx] = prevOBV prevReal = tempReal outIdx++ } return outReal }
c10370
tempHT := inHigh[today] tempCY := inClose[today-1] greatest := tempHT - tempLT val2 := math.Abs(tempCY - tempHT) if val2 > greatest { greatest = val2 } val3 := math.Abs(tempCY - tempLT) if val3 > greatest { greatest = val3 } outReal[outIdx] = greatest outIdx++ today++ } return outReal }
c10371
sumXY over first (inTimePeriod) input values sumXY := 0.0 sumY := 0.0 i := inTimePeriod for i != 0 { i-- tempValue1 := inReal[today-i] sumY += tempValue1 sumXY += float64(i) * tempValue1 } for today < len(inReal) { //sumX and sumXY are already available for first output value if today > startIdx-1 { ...
c10372
for i := 0; i < len(inReal); i++ { tempReal := outReal[i] if !(tempReal < 0.00000000000001) { outReal[i] = math.Sqrt(tempReal) } else { outReal[i] = 0.0 } } } return outReal }
c10373
:= inReal[i] periodTotal1 += tempReal tempReal *= tempReal periodTotal2 += tempReal meanValue1 := periodTotal1 / float64(inTimePeriod) meanValue2 := periodTotal2 / float64(inTimePeriod) tempReal = inReal[trailingIdx] periodTotal1 -= tempReal tempReal *= tempReal periodTotal2 -= tempReal outReal[out...
c10374
{ outReal[i] = math.Asin(inReal[i]) } return outReal }
c10375
{ outReal[i] = math.Atan(inReal[i]) } return outReal }
c10376
{ outReal[i] = math.Ceil(inReal[i]) } return outReal }
c10377
{ outReal[i] = math.Cos(inReal[i]) } return outReal }
c10378
{ outReal[i] = math.Cosh(inReal[i]) } return outReal }
c10379
{ outReal[i] = math.Exp(inReal[i]) } return outReal }
c10380
{ outReal[i] = math.Floor(inReal[i]) } return outReal }
c10381
{ outReal[i] = math.Log(inReal[i]) } return outReal }
c10382
{ outReal[i] = math.Log10(inReal[i]) } return outReal }
c10383
{ outReal[i] = math.Sin(inReal[i]) } return outReal }
c10384
{ outReal[i] = math.Sinh(inReal[i]) } return outReal }
c10385
{ outReal[i] = math.Sqrt(inReal[i]) } return outReal }
c10386
{ outReal[i] = math.Tan(inReal[i]) } return outReal }
c10387
{ outReal[i] = math.Tanh(inReal[i]) } return outReal }
c10388
i++ { outReal[i] = inReal0[i] / inReal1[i] } return outReal }
c10389
:= 0.0 for today < len(outReal) { tmp := inReal[today] if highestIdx < trailingIdx { highestIdx = trailingIdx highest = inReal[highestIdx] i := highestIdx + 1 for i <= today { tmp = inReal[i] if tmp > highest { highestIdx = i highest = tmp } i++ } } else if tmp >= hig...
c10390
lowest = inReal[lowestIdx] i := lowestIdx + 1 for i <= today { tmp = inReal[i] if tmp < lowest { lowestIdx = i lowest = tmp } i++ } } else if tmp <= lowest { lowestIdx = today lowest = tmp } outReal[outIdx] = lowest outIdx++ trailingIdx++ today++ } return outRea...
c10391
} } else if tmpHigh >= highest { highestIdx = today highest = tmpHigh } if lowestIdx < trailingIdx { lowestIdx = trailingIdx lowest = inReal[lowestIdx] i := lowestIdx i++ for i <= today { tmpLow = inReal[i] if tmpLow < lowest { lowestIdx = i lowest = tmpLow } i++...
c10392
} } else if tmpHigh >= highest { highestIdx = today highest = tmpHigh } if lowestIdx < trailingIdx { lowestIdx = trailingIdx lowest = inReal[lowestIdx] i := lowestIdx i++ for i <= today { tmpLow = inReal[i] if tmpLow < lowest { lowestIdx = i lowest = tmpLow } i++ ...
c10393
i++ { outReal[i] = inReal0[i] * inReal1[i] } return outReal }
c10394
i++ { outReal[i] = inReal0[i] - inReal1[i] } return outReal }
c10395
for i < len(inReal) { periodTotal += inReal[i] tempReal := periodTotal periodTotal -= inReal[trailingIdx] outReal[outIdx] = tempReal i++ trailingIdx++ outIdx++ } return outReal }
c10396
&cid); err != nil { return 0, err } return cid, nil }
c10397
f.Close() // Retrieve the context ID of this machine from /dev/vsock. return fs.Ioctl(f.Fd(), unix.IOCTL_VM_SOCKETS_GET_LOCAL_CID, unsafe.Pointer(cid)) }
c10398
if timeout != 0 { timer := time.AfterFunc(timeout, func() { _ = l.Close() }) cancel = func() { timer.Stop() } } for { c, err := l.Accept() if err != nil { if nerr, ok := err.(net.Error); ok && nerr.Temporary() { time.Sleep(250 * time.Millisecond) continue } return nil, err } // Got a ...
c10399
this integration test must be run in a guest") } }