text stringlengths 11 6.3k | embedding listlengths 768 768 |
|---|---|
func newPluginWithErr(errorMsg string) (p *slackscot.Plugin, err error) {
if errorMsg != "" {
return nil, fmt.Errorf(errorMsg)
}
return newPlugin(), nil
} | [
0.1519155204296112,
-1.0957529544830322,
0.08572348952293396,
0.6711240410804749,
-0.8145420551300049,
-0.46306663751602173,
-0.29955002665519714,
-0.45946916937828064,
0.8774724006652832,
-0.33871960639953613,
-0.040870703756809235,
0.2407989203929901,
-0.5882364511489868,
1.1007833480834... |
func newPluginWithErrAndCloser(errorMsg string, closer io.Closer) (c io.Closer, p *slackscot.Plugin, err error) {
p, err = newPluginWithErr(errorMsg)
return closer, p, err
} | [
-0.5799066424369812,
-1.4507302045822144,
0.5843520760536194,
-0.00391562283039093,
-0.9870509505271912,
0.4256990849971771,
0.4247976839542389,
-0.7697518467903137,
0.8127633333206177,
-0.7439166307449341,
0.008628220297396183,
0.07318034023046494,
-0.7159144878387451,
1.4575637578964233,... |
func (c CloseTester) Close() (err error) {
if c.errorMsg != "" {
return fmt.Errorf(c.errorMsg)
}
return nil
} | [
-0.05355855077505112,
0.12620851397514343,
0.45347529649734497,
0.3850627541542053,
-0.7180420160293579,
0.30772778391838074,
0.12948618829250336,
-0.5819502472877502,
-1.0792258977890015,
-0.409556120634079,
1.11962890625,
-0.17981210350990295,
-1.4979788064956665,
1.9828152656555176,
1... |
func (kvStore *KVStore) Lookup(hash KademliaID) (output []byte, err error) {
kvStore.mutex.Lock()
if val, ok := kvStore.mapping[hash]; ok {
output = val.data
} else {
err = NotFoundError
}
kvStore.mutex.Unlock()
return
} | [
-0.14378106594085693,
0.2600845396518707,
0.3289548456668854,
0.08148417621850967,
-0.989801824092865,
-0.7608530521392822,
-0.22351734340190887,
-0.43399545550346375,
0.30936187505722046,
0.4074929654598236,
0.3910176455974579,
-0.2150503396987915,
-0.5160521268844604,
-0.0535885170102119... |
func (kvStore *KVStore) DumpStore() []KVPair {
els := make([]KVPair, len(kvStore.mapping))
i := 0
for k, v := range kvStore.mapping {
els[i] = KVPair{k, *v}
i++
}
return els
} | [
-1.7324382066726685,
0.2798023521900177,
0.4687691330909729,
0.15719357132911682,
-0.8915097713470459,
0.05492665618658066,
-0.5813401937484741,
0.6109731793403625,
0.661655843257904,
-0.1209864541888237,
-0.32306328415870667,
-0.4730047881603241,
-0.3005234897136688,
0.6457051634788513,
... |
func newLogAttributesProcessor(logger *zap.Logger, attrProc *attraction.AttrProc, skipExpr expr.BoolExpr[ottllog.TransformContext]) *logAttributesProcessor {
return &logAttributesProcessor{
logger: logger,
attrProc: attrProc,
skipExpr: skipExpr,
}
} | [
-0.10327532887458801,
-0.9845478534698486,
0.29097679257392883,
-1.4727191925048828,
-1.5032415390014648,
-0.08621682226657867,
0.02627635933458805,
0.3677752614021301,
0.05123697221279144,
0.206044003367424,
0.06604963541030884,
0.5324940085411072,
-0.3664054870605469,
-0.3868798017501831... |
func (a *Vector3) Plus(b Vector3) {
*a = Vector3{a.X + b.X, a.Y + b.Y, a.Z + b.Z}
} | [
0.36347049474716187,
-0.7334263324737549,
0.7161214351654053,
-0.21709340810775757,
0.11631601303815842,
0.9760074019432068,
-0.8910285234451294,
-0.5864360928535461,
1.4203896522521973,
-0.2528795897960663,
-0.39538171887397766,
0.6217604279518127,
0.2971063256263733,
-0.6599747538566589,... |
func Difference(a, b Vector3) Vector3 {
return Vector3{a.X + b.X, a.Y + b.Y, a.Z + b.Z}
} | [
0.546494722366333,
-0.5990226864814758,
0.6296406984329224,
0.006568539887666702,
0.4010929465293884,
1.3233801126480103,
-0.4681081771850586,
-0.5049668550491333,
1.138389229774475,
-0.39668700098991394,
-0.23140156269073486,
0.4294296205043793,
-0.04681441932916641,
-0.7825294137001038,
... |
func (a Vector3) Mult(b float32) Vector3 {
return Vector3{a.X * b, a.Y * b, a.Z * b}
} | [
0.1649121344089508,
0.524853527545929,
0.621247410774231,
-0.40931543707847595,
0.2132582664489746,
0.6810330748558044,
-0.8272706866264343,
-1.5786665678024292,
0.8991314172744751,
-0.45510759949684143,
0.06624262034893036,
-0.08215788751840591,
-0.3086489140987396,
-0.5646578669548035,
... |
func (a Vector3) Length() float32 {
return float32(math.Sqrt(float64(a.X*a.X + a.Y*a.Y + a.Z*a.Z)))
} | [
1.1183462142944336,
-0.7106292843818665,
0.15597525238990784,
-0.5592628717422485,
-0.15222685039043427,
1.471110224723816,
0.8455193042755127,
0.46528369188308716,
1.374375343322754,
0.3913591504096985,
-0.19811752438545227,
-0.14428995549678802,
0.3176429569721222,
-0.03464635834097862,
... |
func (a Vector3) SqrMag() float32 {
return float32(a.X*a.X + a.Y*a.Y + a.Z*a.Z)
} | [
0.17394030094146729,
-0.35882964730262756,
0.5545287728309631,
-1.4264544248580933,
0.22861360013484955,
0.1388322114944458,
-0.4976792335510254,
-0.31827494502067566,
1.207195520401001,
-0.47333401441574097,
-0.27191710472106934,
-0.15752573311328888,
-0.08023300021886826,
0.2038156390190... |
func Distance(a, b Vector3) float32 {
return (Difference(a, b).Length())
} | [
0.556716799736023,
0.18704858422279358,
0.30042406916618347,
0.054741013795137405,
-0.6500393748283386,
1.7063560485839844,
-0.36923691630363464,
0.034272368997335434,
0.9212351441383362,
0.6558910608291626,
-0.05620795860886574,
-0.15297327935695648,
-0.4528551399707794,
-0.03763725981116... |
func SqrDist(a, b Vector3) float32 {
return (Difference(a, b).SqrMag())
} | [
0.3530925214290619,
-0.021304195746779442,
0.3355776071548462,
-0.9922365546226501,
0.05522783100605011,
0.3861028552055359,
-1.3008078336715698,
-0.5226463675498962,
1.0213104486465454,
-0.35347428917884827,
0.34851643443107605,
0.5803938508033752,
-0.12069837749004364,
-0.387322753667831... |
func (a *Vector3) Normalise() {
l := a.Length()
*a = Vector3{a.X / l, a.Y / l, a.Z / l}
} | [
0.7073774337768555,
-0.3030797243118286,
0.20627665519714355,
-0.9928474426269531,
0.2681999206542969,
0.2855396866798401,
0.6973059177398682,
0.7733230590820312,
1.3352164030075073,
0.16320709884166718,
-0.506893515586853,
-0.21165528893470764,
-0.3260023891925812,
0.17931382358074188,
... |
func (pbc *PaidByCoins) PayBPAY(cb *CryptoBill, bpay *PayBPAY) (*PayResult, error) {
exchResp, err := pbc.exchangeRate(cb, bpay.Crypto)
if err != nil {
return nil, errors.Wrap(err, "exchangeRate")
}
currencies, err := pbc.getCurrencies(cb)
if err != nil {
return nil, errors.Wrap(err, "getCurrencies")
}
var... | [
0.25654932856559753,
0.4293670654296875,
0.9860105514526367,
-0.5651525855064392,
0.4651183485984802,
-0.3090744614601135,
0.00379309244453907,
-0.5929111838340759,
0.11495232582092285,
0.12996415793895721,
0.19727811217308044,
-0.24403522908687592,
-1.378173589706421,
0.779156506061554,
... |
func (pbc *PaidByCoins) PayEFT(cb *CryptoBill, eft *PayEFT) (*PayResult, error) {
exchResp, err := pbc.exchangeRate(cb, eft.Crypto)
if err != nil {
return nil, errors.Wrap(err, "exchangeRate")
}
currencies, err := pbc.getCurrencies(cb)
if err != nil {
return nil, errors.Wrap(err, "getCurrencies")
}
var cur... | [
0.862829864025116,
0.2625315487384796,
0.9217020869255066,
-0.7124860882759094,
0.6067168712615967,
-0.2732737064361572,
0.15471269190311432,
-0.49846023321151733,
0.44490355253219604,
0.17596596479415894,
-0.0888008400797844,
-0.23458831012248993,
-0.7378535270690918,
0.6146037578582764,
... |
func NewMempoolAPIService(client tc.TomoChainClient) server.MempoolAPIServicer {
return &mempoolAPIService{
client: client,
}
} | [
-0.7180677056312561,
-0.6132926344871521,
0.11710947751998901,
-0.8401200175285339,
-1.409084677696228,
0.02016734518110752,
-1.1283818483352661,
-0.7970097661018372,
0.5044043064117432,
0.9702823758125305,
-1.542502522468567,
1.005211591720581,
-1.8985081911087036,
0.1591680943965912,
-... |
func (m *mempoolAPIService) Mempool(
ctx context.Context,
request *types.NetworkRequest,
) (*types.MempoolResponse, *types.Error) {
terr := common.ValidateNetworkIdentifier(ctx, m.client, request.NetworkIdentifier)
if terr != nil {
return nil, terr
}
pending, err := m.client.GetMempool(ctx)
if err != nil {
... | [
-1.1633195877075195,
-0.25342491269111633,
0.5226356983184814,
-0.6318252086639404,
0.30619025230407715,
-0.3200320899486542,
0.2531775236129761,
-0.686873197555542,
0.78033447265625,
0.0786382257938385,
-0.6506490707397461,
-0.11384361237287521,
-0.5666060447692871,
-0.058748748153448105,... |
func (m *mempoolAPIService) MempoolTransaction(
ctx context.Context,
request *types.MempoolTransactionRequest,
) (*types.MempoolTransactionResponse, *types.Error) {
terr := common.ValidateNetworkIdentifier(ctx, m.client, request.NetworkIdentifier)
if terr != nil {
return nil, terr
}
tx, err := m.client.GetMemp... | [
-0.5168251991271973,
-0.10354457050561905,
0.5089450478553772,
-0.6349765062332153,
0.2770046591758728,
-0.28099769353866577,
-0.32043659687042236,
-0.9894322156906128,
0.9097633361816406,
0.23286809027194977,
-1.1251463890075684,
0.07841683179140091,
-0.80626380443573,
-0.378471702337265,... |
func CreateQueue(t QueueType) Queue {
switch t {
case QueueLinkedList:
return NewListQueue()
case QueueHeap:
return NewHeapQueue()
}
return nil
} | [
0.08536074310541153,
-1.1259655952453613,
0.44205281138420105,
0.22250573337078094,
0.7198867797851562,
-0.20798088610172272,
-0.9445961713790894,
-0.925226092338562,
0.8711574673652649,
-0.3021851181983948,
0.38831251859664917,
-0.2844426929950714,
-0.7841286063194275,
1.2301523685455322,... |
func WaitForTermination() os.Signal {
return WaitForSignal(syscall.SIGINT, syscall.SIGKILL, syscall.SIGTERM)
} | [
0.07791060209274292,
-0.17670592665672302,
0.37842294573783875,
0.3677297830581665,
0.3413417339324951,
-0.246323361992836,
-0.8873167037963867,
0.37403222918510437,
-0.9136233925819397,
-0.21623073518276215,
-0.33773258328437805,
-0.8708252310752869,
0.3771924078464508,
0.9400678873062134... |
func WaitForSignal(signals ...os.Signal) os.Signal {
ch := make(chan os.Signal, 1)
signal.Notify(ch, signals...)
sig := <-ch
return sig
} | [
0.412576287984848,
0.5077235102653503,
0.42663976550102234,
0.38730743527412415,
-0.11200007051229477,
0.04996335133910179,
-0.779088020324707,
-0.4287858307361603,
-1.0289400815963745,
-1.5627131462097168,
-1.1417665481567383,
-0.47617754340171814,
0.4170764684677124,
0.2532604932785034,
... |
func WithBackoff(backoff wait.Backoff) EtcdBackoffAdapterOption {
return func(a *EtcdBackoffAdapter) {
a.BackoffParams = backoff
}
} | [
0.44186195731163025,
-0.18489810824394226,
0.3184243440628052,
-0.11280500888824463,
-0.9234859347343445,
0.33335909247398376,
-0.25934022665023804,
0.5839391946792603,
0.2540317475795746,
0.5970577001571655,
0.6659521460533142,
-1.042284369468689,
0.33572983741760254,
-0.3320614695549011,... |
func WithTimeout(timeout time.Duration) EtcdBackoffAdapterOption {
return func(a *EtcdBackoffAdapter) {
a.Timeout = timeout
}
} | [
0.9955339431762695,
0.3214243948459625,
0.26572445034980774,
0.06887068599462509,
-0.8163381218910217,
0.1840524524450302,
-0.5799225568771362,
0.5487071871757507,
0.5878837704658508,
0.8312079906463623,
0.43701842427253723,
-0.4062091112136841,
0.7162812352180481,
-0.029668575152754784,
... |
func NewEtcdBackoffAdapter(c *clientv3.Client, options ...EtcdBackoffAdapterOption) *EtcdBackoffAdapter {
adapter := &EtcdBackoffAdapter{
EtcdClient: c,
BackoffParams: etcdBackoff,
Timeout: etcdTimeout,
}
for _, option := range options {
option(adapter)
}
return adapter
} | [
-0.2682039141654968,
-0.5174856185913086,
0.2290506809949875,
-0.612147331237793,
-1.0704412460327148,
0.15510375797748566,
-0.574057400226593,
0.31309136748313904,
-0.34633809328079224,
0.8490482568740845,
0.5355105996131897,
-0.04249437898397446,
-0.43751949071884155,
-0.1797059625387191... |
func (e *EtcdBackoffAdapter) Close() error {
return e.EtcdClient.Close()
} | [
0.025651786476373672,
0.26495808362960815,
0.2699695825576782,
-0.4699252247810364,
-1.0187164545059204,
0.7524005174636841,
-0.43487849831581116,
-0.11396671831607819,
-0.8537058234214783,
0.16339312493801117,
0.7867441177368164,
-0.577093780040741,
-0.6097966432571411,
0.4496121108531952... |
func (e *EtcdBackoffAdapter) AlarmList(ctx context.Context) (*clientv3.AlarmResponse, error) {
ctx, cancel := context.WithTimeout(ctx, e.Timeout)
defer cancel()
var alarmResponse *clientv3.AlarmResponse
err := wait.ExponentialBackoff(e.BackoffParams, func() (bool, error) {
resp, err := e.EtcdClient.AlarmList(ctx)... | [
0.0755511000752449,
-0.34123629331588745,
0.6523167490959167,
-0.2879018783569336,
-0.11266888678073883,
0.3390275239944458,
-0.5900178551673889,
-0.04954640939831734,
-0.3696257472038269,
0.9604635238647461,
-0.1323709338903427,
-0.040251195430755615,
-0.6714027523994446,
-0.0579498857259... |
func (e *EtcdBackoffAdapter) MemberList(ctx context.Context) (*clientv3.MemberListResponse, error) {
ctx, cancel := context.WithTimeout(ctx, e.Timeout)
defer cancel()
var response *clientv3.MemberListResponse
err := wait.ExponentialBackoff(e.BackoffParams, func() (bool, error) {
resp, err := e.EtcdClient.MemberLi... | [
-0.13314172625541687,
-0.6027350425720215,
0.7603307366371155,
-0.4475424587726593,
0.1850457489490509,
0.19821564853191376,
-0.7860669493675232,
0.39669567346572876,
-0.5667083859443665,
1.1234327554702759,
-0.05299250781536102,
-0.043375175446271896,
-0.88388592004776,
-0.103337116539478... |
func (e *EtcdBackoffAdapter) MemberUpdate(ctx context.Context, id uint64, peerURLs []string) (*clientv3.MemberUpdateResponse, error) {
ctx, cancel := context.WithTimeout(ctx, e.Timeout)
defer cancel()
var response *clientv3.MemberUpdateResponse
err := wait.ExponentialBackoff(e.BackoffParams, func() (bool, error) {
... | [
-0.8155785202980042,
-0.6152785420417786,
0.615513026714325,
-0.3927777111530304,
-0.49655142426490784,
0.18738409876823425,
-1.2893010377883911,
0.36862489581108093,
-0.3870413303375244,
0.8835870027542114,
-0.21672527492046356,
-0.3386806845664978,
-1.525955080986023,
-0.6075849533081055... |
func (e *EtcdBackoffAdapter) MemberRemove(ctx context.Context, id uint64) (*clientv3.MemberRemoveResponse, error) {
ctx, cancel := context.WithTimeout(ctx, e.Timeout)
defer cancel()
var response *clientv3.MemberRemoveResponse
err := wait.ExponentialBackoff(e.BackoffParams, func() (bool, error) {
resp, err := e.Et... | [
-0.4597589373588562,
0.17486824095249176,
0.5826902985572815,
-0.5401451587677002,
-0.467267245054245,
-0.15698309242725372,
-0.9791831374168396,
0.3131275475025177,
0.1301952302455902,
0.6940099000930786,
-0.662962019443512,
-0.03867335990071297,
-1.481724739074707,
-0.6724156141281128,
... |
func (e *EtcdBackoffAdapter) MoveLeader(ctx context.Context, id uint64) (*clientv3.MoveLeaderResponse, error) {
ctx, cancel := context.WithTimeout(ctx, e.Timeout)
defer cancel()
var response *clientv3.MoveLeaderResponse
err := wait.ExponentialBackoff(e.BackoffParams, func() (bool, error) {
resp, err := e.EtcdClie... | [
-0.5824413895606995,
-0.3115674555301666,
0.8183586597442627,
-0.04027333855628967,
-0.7575404644012451,
0.3911275267601013,
-1.1386125087738037,
-0.23705360293388367,
0.23625822365283966,
1.093296766281128,
-0.5860827565193176,
0.07885206490755081,
-1.2442594766616821,
-0.515466570854187,... |
func (t Session) Next() *remotecommand.TerminalSize {
select {
case size := <-t.SizeChan:
return &size
case <-t.DoneChan:
return nil
}
} | [
-0.23001734912395477,
-0.1851358562707901,
0.5392622947692871,
-0.1655001938343048,
-0.9091397523880005,
-0.05598911643028259,
-0.1507282853126526,
-1.29984712600708,
0.825497567653656,
-0.96650230884552,
-0.3549618422985077,
0.293487548828125,
-0.6563302278518677,
-0.321432501077652,
0.... |
func (t Session) Read(p []byte) (int, error) {
_, m, err := t.WebSocket.ReadMessage()
if err != nil {
// Send terminated signal to process to avoid resource leak.
return copy(p, END_OF_TRANSMISSION), err
}
var msg Message
if err := json.Unmarshal([]byte(m), &msg); err != nil {
return copy(p, END_OF_TRANSMIS... | [
-0.7301462888717651,
0.10073763132095337,
0.9077391028404236,
-0.758358895778656,
-0.7721544504165649,
-0.07354577630758286,
0.5571284890174866,
-1.1453068256378174,
0.5413751006126404,
0.5421683192253113,
-0.091310515999794,
0.5472587943077087,
-0.7272762060165405,
0.24272941052913666,
... |
func (t Session) Write(p []byte) (int, error) {
msg, err := json.Marshal(Message{
Op: "stdout",
Data: string(p),
})
if err != nil {
return 0, err
}
if err = t.WebSocket.WriteMessage(websocket.TextMessage, msg); err != nil {
return 0, err
}
return len(p), nil
} | [
-1.07012140750885,
0.606201708316803,
0.8898447155952454,
-0.6489266753196716,
-0.005081037990748882,
-0.4640604853630066,
0.30395960807800293,
-0.4561237692832947,
0.6105474829673767,
0.908415675163269,
-0.7982528805732727,
0.22105950117111206,
-1.2989412546157837,
0.3535769283771515,
0... |
func StartProcess(config *rest.Config, reqURL *url.URL, cmd []string, ptyHandler PtyHandler) error {
exec, err := remotecommand.NewSPDYExecutor(config, "POST", reqURL)
if err != nil {
return err
}
err = exec.Stream(remotecommand.StreamOptions{
Stdin: ptyHandler,
Stdout: ptyHandler,
S... | [
0.4947088956832886,
-0.20200975239276886,
0.5171597599983215,
0.24121585488319397,
0.35407987236976624,
0.3490729331970215,
-0.35423606634140015,
-0.15500105917453766,
-0.032689161598682404,
-0.5997546911239624,
-0.11784937232732773,
0.8634081482887268,
-0.5559984445571899,
0.9020842909812... |
func IsValidShell(shell string) bool {
for _, validShell := range []string{"bash", "sh", "pwsh", "cmd"} {
if validShell == shell {
return true
}
}
return false
} | [
-0.047729119658470154,
0.3504149317741394,
0.3527616858482361,
1.0277303457260132,
-0.7365466952323914,
0.5152011513710022,
-1.0952074527740479,
-0.38488417863845825,
0.9419358968734741,
-0.9627704620361328,
-0.6841414570808411,
0.08911793678998947,
-0.1255413144826889,
1.7062147855758667,... |
func Clock(ctx context.Context) {
for {
select {
case <- ctx.Done():
fmt.Printf("\r[ # ]")
return
default:
for _, c := range `-\|/` {
fmt.Printf("\r[ %c ]", c)
time.Sleep(200 * time.Millisecond)
}
}
}
} | [
0.39426347613334656,
-0.02745017036795616,
0.6140720248222351,
0.2354748249053955,
-0.27438390254974365,
1.003521203994751,
0.14743958413600922,
-0.22369791567325592,
-0.412553071975708,
0.17289768159389496,
0.34488362073898315,
0.5042771100997925,
0.16978153586387634,
0.7006551027297974,
... |
func ResponseSetStatus(status int) ResponseModifier {
return func(resp *http.Response, err error) (*http.Response, error) {
if resp != nil {
resp.StatusCode = status
resp.Status = http.StatusText(status)
}
return resp, err
}
} | [
-0.5853713154792786,
-1.5837172269821167,
0.30614331364631653,
-0.7978731393814087,
-0.5670051574707031,
-0.09256543964147568,
0.047485075891017914,
0.15790513157844543,
1.69243586063385,
-0.3343822658061981,
-1.1764123439788818,
-0.22402919828891754,
0.8629037141799927,
-0.035027038305997... |
func ResponseSetHeader(key, value string) ResponseModifier {
return func(resp *http.Response, err error) (*http.Response, error) {
if resp != nil {
if resp.Header == nil {
resp.Header = make(http.Header)
}
resp.Header.Set(key, value)
}
return resp, err
}
} | [
-0.8314178586006165,
-1.2426631450653076,
0.5368005633354187,
-0.6844159364700317,
-0.49139538407325745,
-0.31675100326538086,
-0.694244921207428,
-0.7386522889137268,
1.416762351989746,
-0.5719214677810669,
-0.6483075022697449,
-0.6323429942131042,
0.5799598097801208,
-0.5127912759780884,... |
func ResponseAddHeader(key, value string) ResponseModifier {
return func(resp *http.Response, err error) (*http.Response, error) {
if resp != nil {
if resp.Header == nil {
resp.Header = make(http.Header)
}
resp.Header.Add(key, value)
}
return resp, err
}
} | [
-0.3816039264202118,
-1.0318281650543213,
0.6244564056396484,
0.02305985800921917,
-0.616490364074707,
0.22693301737308502,
-0.5835034847259521,
-0.8308857083320618,
1.6653814315795898,
-0.6504261493682861,
-0.7641826272010803,
-0.715482234954834,
0.624811589717865,
-0.01038630772382021,
... |
func UseResponseModifier(modifiers ...ResponseModifier) Middleware {
modifierChain := make([]Middleware, len(modifiers))
for i, j := 0, len(modifiers)-1; i <= j; i++ {
modifierChain[j-i] = modifiers[i] // reverse order of modifier
}
return Chain(modifierChain...)
} | [
-1.2335584163665771,
-0.8180583119392395,
0.5170221328735352,
-0.19677484035491943,
0.25523844361305237,
-0.19339095056056976,
0.15826578438282013,
-0.23497553169727325,
0.9390209913253784,
-0.37287434935569763,
-0.7084224820137024,
0.03284134343266487,
-0.5000033378601074,
-0.406550645828... |
func Chain(middlewares ...Middleware) Middleware {
return MiddlewareFunc(func(roundTripper http.RoundTripper) http.RoundTripper {
for i := len(middlewares) - 1; i >= 0; i-- {
roundTripper = middlewares[i].Wrap(roundTripper)
}
return roundTripper
})
} | [
-0.35705479979515076,
-0.5901351571083069,
0.43298226594924927,
0.7879603505134583,
-0.5813537240028381,
1.0035477876663208,
-0.05273529142141342,
0.08727800101041794,
-0.19721795618534088,
0.0657220333814621,
-0.2778336703777313,
0.07929740846157074,
-0.4635564088821411,
0.596008896827697... |
func New(creds aws.CredentialsProvider, region string, client *http.Client) *CloudFront {
if client == nil {
client = http.DefaultClient
}
endpoint, service, region := endpoints.Lookup("cloudfront", region)
return &CloudFront{
client: &aws.RestClient{
Context: aws.Context{
Credentials: creds,
Servi... | [
0.5193678736686707,
-0.642768919467926,
0.19291909039020538,
-1.4603033065795898,
-0.7261691689491272,
-0.0307808518409729,
-0.47697195410728455,
-0.12172229588031769,
-0.3550228178501129,
-0.5348220467567444,
-0.14597603678703308,
1.4569848775863647,
0.45545268058776855,
0.163600176572799... |
func (c *CloudFront) GetCloudFrontOriginAccessIdentity(req *GetCloudFrontOriginAccessIdentityRequest) (resp *GetCloudFrontOriginAccessIdentityResult, err error) {
resp = &GetCloudFrontOriginAccessIdentityResult{}
var body io.Reader
var contentType string
uri := c.client.Endpoint + "/2014-10-21/origin-access-ident... | [
-0.726544976234436,
-0.6626327037811279,
1.022300362586975,
-0.5921172499656677,
-0.020797815173864365,
0.016115481033921242,
0.19363148510456085,
-0.38718461990356445,
0.12332521378993988,
0.06532695889472961,
0.10319739580154419,
1.2715272903442383,
-0.03249092400074005,
0.21696567535400... |
func (c *CloudFront) GetCloudFrontOriginAccessIdentityConfig(req *GetCloudFrontOriginAccessIdentityConfigRequest) (resp *GetCloudFrontOriginAccessIdentityConfigResult, err error) {
resp = &GetCloudFrontOriginAccessIdentityConfigResult{}
var body io.Reader
var contentType string
uri := c.client.Endpoint + "/2014-1... | [
-0.909834623336792,
-0.39785653352737427,
0.9405621886253357,
-0.9726296663284302,
-0.1633865088224411,
-0.1938907951116562,
-0.2011667937040329,
-0.009640255942940712,
-0.265655517578125,
0.27362701296806335,
-0.14800304174423218,
1.5247732400894165,
0.05779729411005974,
0.599672794342041... |
func (c *CloudFront) GetDistributionConfig(req *GetDistributionConfigRequest) (resp *GetDistributionConfigResult, err error) {
resp = &GetDistributionConfigResult{}
var body io.Reader
var contentType string
uri := c.client.Endpoint + "/2014-10-21/distribution/{Id}/config"
if req.ID != nil {
uri = strings.Repl... | [
-1.0194095373153687,
0.289301335811615,
1.095842957496643,
-0.413815438747406,
0.06588085740804672,
-0.15581326186656952,
-0.3058844208717346,
-0.23487402498722076,
-0.027545541524887085,
0.5485451221466064,
0.05540861189365387,
0.8036244511604309,
0.12973348796367645,
1.4506604671478271,
... |
func (c *CloudFront) GetStreamingDistribution(req *GetStreamingDistributionRequest) (resp *GetStreamingDistributionResult, err error) {
resp = &GetStreamingDistributionResult{}
var body io.Reader
var contentType string
uri := c.client.Endpoint + "/2014-10-21/streaming-distribution/{Id}"
if req.ID != nil {
uri... | [
-0.6064268946647644,
0.24473482370376587,
0.9301751255989075,
-0.41770127415657043,
0.256024032831192,
-0.30047738552093506,
-0.14340171217918396,
-0.7231836915016174,
0.08007575571537018,
0.13228081166744232,
0.32577869296073914,
1.1932742595672607,
-0.3455743193626404,
0.875991702079773,... |
func (c *CloudFront) GetStreamingDistributionConfig(req *GetStreamingDistributionConfigRequest) (resp *GetStreamingDistributionConfigResult, err error) {
resp = &GetStreamingDistributionConfigResult{}
var body io.Reader
var contentType string
uri := c.client.Endpoint + "/2014-10-21/streaming-distribution/{Id}/con... | [
-0.8298367857933044,
0.34515008330345154,
0.9713066816329956,
-0.6259341835975647,
0.03985431417822838,
-0.0428558774292469,
-0.3938353955745697,
-0.5130523443222046,
-0.375478595495224,
0.5146690607070923,
-0.0054331617429852486,
1.3207517862319946,
-0.12369094043970108,
1.270697355270385... |
func Asset(name string) ([]byte, error) {
cannonicalName := strings.Replace(name, "\\", "/", -1)
if f, ok := _bindata[cannonicalName]; ok {
a, err := f()
if err != nil {
return nil, fmt.Errorf("Asset %s can't read by error: %v", name, err)
}
return a.bytes, nil
}
return nil, fmt.Errorf("Asset %s not foun... | [
-0.7961482405662537,
-1.2313158512115479,
0.6331650614738464,
-0.6093901991844177,
-1.546920895576477,
-0.11101029813289642,
0.129714235663414,
-1.3390333652496338,
-1.135871410369873,
0.4855230152606964,
0.30901390314102173,
0.3249545693397522,
-0.6009676456451416,
-0.44264793395996094,
... |
func MustAsset(name string) []byte {
a, err := Asset(name)
if err != nil {
panic("asset: Asset(" + name + "): " + err.Error())
}
return a
} | [
-0.012778956443071365,
0.11985661834478378,
0.4091298282146454,
-0.5268413424491882,
-0.8276715278625488,
0.4719155430793762,
-0.8186293840408325,
-1.5736604928970337,
0.16388541460037231,
0.6357062458992004,
-0.5354578495025635,
0.35693347454071045,
0.0057142809964716434,
-0.0248885955661... |
func AssetInfo(name string) (os.FileInfo, error) {
cannonicalName := strings.Replace(name, "\\", "/", -1)
if f, ok := _bindata[cannonicalName]; ok {
a, err := f()
if err != nil {
return nil, fmt.Errorf("AssetInfo %s can't read by error: %v", name, err)
}
return a.info, nil
}
return nil, fmt.Errorf("Asset... | [
0.3719695508480072,
-1.1052989959716797,
0.5630441904067993,
-0.9225736260414124,
-1.356386423110962,
0.003355572931468487,
0.6777525544166565,
-0.8006678819656372,
-1.274828553199768,
0.311536967754364,
0.26360753178596497,
0.26388123631477356,
0.06357761472463608,
-0.39880770444869995,
... |
func AssetNames() []string {
names := make([]string, 0, len(_bindata))
for name := range _bindata {
names = append(names, name)
}
return names
} | [
-0.7293784618377686,
-0.8460342288017273,
0.7321816682815552,
-0.39323121309280396,
-0.48951536417007446,
0.7661203145980835,
-0.5028699636459351,
-0.8655748963356018,
-0.4145073890686035,
0.8099913597106934,
0.16903363168239594,
1.163049578666687,
-0.028152840211987495,
0.0342608317732811... |
func RestoreAsset(dir, name string) error {
data, err := Asset(name)
if err != nil {
return err
}
info, err := AssetInfo(name)
if err != nil {
return err
}
err = os.MkdirAll(_filePath(dir, filepath.Dir(name)), os.FileMode(0755))
if err != nil {
return err
}
err = ioutil.WriteFile(_filePath(dir, name), d... | [
0.34371325373649597,
-0.3622533082962036,
0.6770349144935608,
-1.2592034339904785,
-0.00613967701792717,
-0.044532135128974915,
-0.00726317847147584,
-0.43950432538986206,
-0.2061910331249237,
-0.2510174810886383,
0.17843623459339142,
0.1356850564479828,
-0.2362709492444992,
-0.56985044479... |
func RestoreAssets(dir, name string) error {
children, err := AssetDir(name)
// File
if err != nil {
return RestoreAsset(dir, name)
}
// Dir
for _, child := range children {
err = RestoreAssets(dir, filepath.Join(name, child))
if err != nil {
return err
}
}
return nil
} | [
0.4226192533969879,
0.3001989424228668,
0.5813396573066711,
-0.20641714334487915,
-0.23828980326652527,
-0.24414613842964172,
0.5739712119102478,
-0.029911452904343605,
0.061882976442575455,
-0.43923527002334595,
0.5113739371299744,
0.3275964856147766,
-0.612514853477478,
0.035165321081876... |
func (ch *compositeChangeDetector) IsSpinnakerUpToDate(ctx context.Context, svc interfaces.SpinnakerService) (bool, error) {
rLogger := ch.log.WithValues("Service", svc.GetName())
isUpToDate := true
for _, changeDetector := range ch.changeDetectors {
// Don't run the change detector if we already know Spinnaker is... | [
-0.8371486067771912,
-0.40404993295669556,
0.815287172794342,
0.05451013892889023,
0.3858754336833954,
-0.3519635796546936,
-0.3084850013256073,
0.1499323844909668,
0.5015010237693787,
0.29789793491363525,
-0.10364492982625961,
0.2867123484611511,
-0.5922142863273621,
0.7836405634880066,
... |
func ValidFormat(f string) bool {
for _, v := range supportedFormats() {
if v[0] == f || v[1] == f {
return true
}
}
return false
} | [
-0.10583091527223587,
-0.2757314145565033,
0.5756254196166992,
-0.034161608666181564,
-0.8808001279830933,
0.09046534448862076,
-0.6364549398422241,
0.2546931803226471,
0.39220553636550903,
-1.347906470298767,
0.5407956838607788,
-0.2104513943195343,
-0.09555776417255402,
0.699294567108154... |
func NewParser(f string) (*LogHandler, error) {
if !ValidFormat(f) {
return nil, fmt.Errorf("%s is not a valid parser format", f)
}
var p = &LogHandler{}
if f == RFC5424Name || f == RFC5424Standard {
p.Parser = &parser.RFC5424{}
p.Fmt = RFC5424Standard
} else if f == WatchguardName || f == WatchguardFirebo... | [
0.1505761295557022,
-1.1198168992996216,
0.522785484790802,
0.0638996809720993,
-1.0714932680130005,
0.1977805197238922,
-0.27046799659729004,
-0.35351744294166565,
0.11218994110822678,
-0.8684685826301575,
0.09354370832443237,
-0.015955816954374313,
-0.6111048460006714,
0.1232643947005271... |
func (p *LogHandler) Parse(b []byte) bool {
p.Result = map[string]interface{}{}
p.Raw = b
p.Parser.Parse(p.Raw, &p.Result)
if len(p.Result) == 0 {
return false
}
return true
} | [
-0.2089618742465973,
0.4949275255203247,
0.6902763247489929,
0.18197236955165863,
-0.4529256820678711,
0.5097925066947937,
-0.5676224827766418,
-0.02900257147848606,
-0.4713592529296875,
-0.7808505296707153,
-0.8389741778373718,
-0.9455559849739075,
-1.620100498199463,
0.2446562796831131,
... |
func Formatter() *formatter {
return &formatter{}
} | [
-0.1956665962934494,
-1.0519083738327026,
-0.12714383006095886,
-0.31490033864974976,
-0.6648507714271545,
-0.21602433919906616,
0.2155197560787201,
-0.30659985542297363,
0.8783494234085083,
-2.2357943058013916,
0.12985694408416748,
0.23884305357933044,
-0.00046747922897338867,
0.726119220... |
func (formatter) fBool(v *types.RecordValue) *types.RecordValue {
if v.Value != strBoolTrue {
v.Value = ""
}
return v
} | [
0.3945041298866272,
-0.12590228021144867,
0.3309769928455353,
-0.05601638928055763,
0.0951261967420578,
0.48233139514923096,
0.08935761451721191,
-0.567608118057251,
-0.3814821243286133,
0.6638109683990479,
-0.24247772991657257,
0.7940589785575867,
0.10502544790506363,
0.21979834139347076,... |
func ParseCommandInput(input string) (command string, args []string) {
fields := strings.Fields(input)
if len(fields) == 0 {
return "", nil
}
command = strings.ToUpper(fields[0])
if len(fields) > 1 {
args = fields[1:]
} else {
args = []string{}
}
return
} | [
-0.7164658308029175,
-0.22562137246131897,
0.6263939142227173,
0.05280807986855507,
0.2797137200832367,
0.1590079814195633,
0.6173388361930847,
0.0647478774189949,
-0.0175556018948555,
0.1671968251466751,
0.03582940995693207,
0.25127142667770386,
-0.5434260368347168,
0.46216273307800293,
... |
func (interpreter *Interpreter) Interpret(server *Server, input string) (string, error) {
commandName, args := ParseCommandInput(input)
command, _ := interpreter.commands[commandName]
if command == nil {
if commandName == "" {
// If you give nothing you get nothing
return "", nil
}
return "", fmt.Erro... | [
-0.1269664466381073,
-0.13933002948760986,
0.8539802432060242,
-0.26932090520858765,
-0.23837237060070038,
-0.569094717502594,
-0.26188957691192627,
0.9934350252151489,
-0.2594239115715027,
-0.9639999270439148,
-0.06822381913661957,
0.0853835716843605,
-0.7330077886581421,
0.67313909530639... |
func VerifyAuthRulesAtState(ctx context.Context, sp StateProvider, eventToVerify *HeaderedEvent, allowValidation bool) error {
stateIDs, err := sp.StateIDsBeforeEvent(ctx, eventToVerify)
if err != nil {
return fmt.Errorf("gomatrixserverlib.VerifyAuthRulesAtState: cannot fetch state IDs before event %s: %w", eventTo... | [
0.043996453285217285,
0.0031258275266736746,
0.8749643564224243,
0.12212765961885452,
-0.3544588088989258,
-0.09803753346204758,
-0.02716066874563694,
-0.6106327176094055,
0.41409051418304443,
0.944858193397522,
-0.04308915138244629,
1.235298991203308,
-0.022078489884734154,
0.142135143280... |
func NewAppConfig(configurationFilePath string) (*AppConfig, error) {
fileConfig, err := loadFileConfig(configurationFilePath)
if err != nil {
return nil, err
}
c := &AppConfig{}
c.Port = fileConfig.Port
if err := makeLogs(c, fileConfig); err != nil {
return nil, err
}
if err := makeCommandsConfig(c, fil... | [
1.0883623361587524,
-0.5157673358917236,
0.42512282729148865,
0.7624508738517761,
-1.5725047588348389,
0.2103823572397232,
0.20815008878707886,
0.10234721004962921,
-0.560236394405365,
0.4263233542442322,
-0.6871462464332581,
-0.7576063275337219,
0.28532424569129944,
1.278192400932312,
0... |
func loadFileConfig(configurationFilePath string) (*fileConfig, error) {
c := &fileConfig{}
data, err := ioutil.ReadFile(configurationFilePath)
if err != nil {
return nil, err
}
if err := yaml.Unmarshal(data, &c); err != nil {
return nil, err
}
return c, nil
} | [
0.32064223289489746,
-0.026601769030094147,
0.4838298261165619,
-0.20034684240818024,
-1.1463518142700195,
-0.4962264597415924,
0.3733508586883545,
0.6869019865989685,
-0.8164376020431519,
0.4276924133300781,
-0.8871669173240662,
-0.7296310663223267,
-0.5504856705665588,
0.8270588517189026... |
func makeLogs(appConfig *AppConfig, fileConfig *fileConfig) error {
lvl, err := getLoggingLevelFromFileConfig(fileConfig)
if err != nil {
return err
}
formatter, err := getLoggingFormatterFromFileConfig(fileConfig)
if err != nil {
return err
}
appConfig.Logs.Level = lvl
appConfig.Logs.Formatter = formatte... | [
0.17348483204841614,
-0.4770328998565674,
0.48508837819099426,
-0.24642376601696014,
-0.5768398642539978,
0.5309632420539856,
-1.024810552597046,
0.5628945231437683,
-0.9584999680519104,
-0.04696844518184662,
-0.34935128688812256,
0.765866219997406,
0.5913549661636353,
0.8786552548408508,
... |
func getLoggingLevelFromFileConfig(c *fileConfig) (logrus.Level, error) {
l, ok := levels[c.Logs.Level]
if !ok {
return 999, &wrongLoggingLevelError{}
}
return l, nil
} | [
-0.06320411711931229,
0.21958760917186737,
0.3582318127155304,
0.45637214183807373,
-0.5680940747261047,
0.37064144015312195,
0.2677628695964813,
0.601236879825592,
-0.6105131506919861,
0.5110101699829102,
-0.8844863772392273,
-0.4617604613304138,
-0.6813324093818665,
0.5281394720077515,
... |
func getLoggingFormatterFromFileConfig(c *fileConfig) (logrus.Formatter, error) {
f, ok := formatters[c.Logs.Format]
if !ok {
return nil, &wrongLoggingFormatError{}
}
return f, nil
} | [
0.1942642778158188,
-0.7587483525276184,
0.22336696088314056,
0.02803570218384266,
-0.9242371916770935,
-0.22609812021255493,
-0.4506697952747345,
-0.014319109730422497,
0.022607380524277687,
-0.4256564974784851,
-0.07882476598024368,
0.06682853400707245,
-0.38862234354019165,
1.1745616197... |
func makeCommandsConfig(appConfig *AppConfig, fileConfig *fileConfig) error {
appConfig.CommandsConfig = &CommandsConfig{}
appConfig.CommandsConfig.Markdown = &CommandConfig{}
appConfig.CommandsConfig.HTML = &CommandConfig{}
appConfig.CommandsConfig.Office = &CommandConfig{}
appConfig.CommandsConfig.Merge = &Comma... | [
0.2887011170387268,
-0.4364050328731537,
0.7218355536460876,
-0.13812172412872314,
-0.19853228330612183,
-0.05359335616230965,
-0.2411108762025833,
0.25417768955230713,
-0.5364710688591003,
-0.24542972445487976,
-0.2644504904747009,
-0.95970618724823,
0.28875732421875,
1.4056694507598877,
... |
func getCommandTemplate(command string, commandName string) (*template.Template, error) {
t, err := template.New(commandName).Parse(command)
if err != nil {
return nil, err
}
return t, nil
} | [
0.06015389412641525,
0.09954585880041122,
0.2832537591457367,
-0.3466311991214752,
0.2127784639596939,
-0.38821038603782654,
-1.070013403892517,
-0.09015710651874542,
-0.5064648389816284,
0.15285880863666534,
-0.28177931904792786,
0.4884508550167084,
-0.8137035369873047,
-0.023125341162085... |
func NewQuotes(market *Market, profile *Profile) *Quotes {
re, err := regexp.Compile("_\\w+")
if err != nil {
//TODO
fmt.Print("error when create regex")
}
return &Quotes{
market: market,
profile: profile,
re: re,
errors: ``,
}
} | [
-0.4272449016571045,
-0.6660754084587097,
0.3300705850124359,
0.0383102186024189,
-0.41178596019744873,
-0.3733622133731842,
-0.4521484971046448,
-0.9225689768791199,
-0.9469442367553711,
0.23017172515392303,
0.4304046630859375,
0.3408083915710449,
-0.928065299987793,
-0.45042356848716736,... |
func (quotes *Quotes) Fetch() (self *Quotes) {
self = quotes // <-- This ensures we return correct quotes after recover() from panic().
if quotes.isReady() {
defer func() {
if err := recover(); err != nil {
quotes.errors = fmt.Sprintf("\n\n\n\nError fetching stock quotes...\n%s", err)
}
}()
url := fm... | [
0.24658186733722687,
-0.44205477833747864,
0.24765440821647644,
0.29445192217826843,
0.4926943778991699,
-0.3298669457435608,
-1.2244479656219482,
-1.2013120651245117,
-0.314473956823349,
0.12735092639923096,
-0.7107285261154175,
0.6927803158760071,
-0.06839906424283981,
0.5722905993461609... |
func (quotes *Quotes) Ok() (bool, string) {
return quotes.errors == ``, quotes.errors
} | [
-0.20041419565677643,
-0.40468549728393555,
0.4735490381717682,
-0.20431256294250488,
0.12873303890228271,
0.6798998117446899,
0.044682446867227554,
-0.38401731848716736,
-0.42467212677001953,
1.4245448112487793,
-0.624814510345459,
1.159984827041626,
0.3794420063495636,
0.0630188360810279... |
func (quotes *Quotes) AddTickers(tickers []string) (added int, err error) {
if added, err = quotes.profile.AddTickers(tickers); err == nil && added > 0 {
quotes.stocks = nil // Force fetch.
}
return
} | [
-0.8141400814056396,
0.8264879584312439,
0.47191566228866577,
0.15945538878440857,
0.8614039421081543,
-0.12297434359788895,
-0.08076082915067673,
-1.1928571462631226,
0.04514003545045853,
-0.22136463224887848,
-0.07952170819044113,
-0.6714184880256653,
-1.4673194885253906,
1.2733714580535... |
func (quotes *Quotes) RemoveTickers(tickers []string) (removed int, err error) {
if removed, err = quotes.profile.RemoveTickers(tickers); err == nil && removed > 0 {
quotes.stocks = nil // Force fetch.
}
return
} | [
-0.8434199094772339,
0.6411409974098206,
0.2259654402732849,
0.11618482321500778,
-0.01930101215839386,
-0.6975756287574768,
0.35468336939811707,
-0.4991167485713959,
-0.1378791779279709,
0.1441301852464676,
-0.6917840242385864,
-0.7308241724967957,
-1.9045765399932861,
0.929612934589386,
... |
func (quotes *Quotes) isReady() bool {
return (quotes.stocks == nil || !quotes.market.IsClosed) && len(quotes.profile.Tickers) > 0
} | [
-0.47306784987449646,
0.2634706497192383,
0.5313205718994141,
0.22653734683990479,
1.0769673585891724,
-0.49774613976478577,
-0.190809965133667,
-0.701863169670105,
0.5824776291847229,
0.4415556490421295,
-0.08255431801080704,
0.5589917302131653,
-0.1926063448190689,
0.8912084102630615,
... |
func (quotes *Quotes) parse(body []byte) *Quotes {
lines := bytes.Split(body, []byte{';'})
quotes.stocks = make([]Stock, len(lines))
for i, line := range lines {
if len(line) == 0 {
break
}
stockCode := quotes.re.Find(line)
if len(stockCode) > 0 {
stockCode = stockCode[1:]
}
columns := bytes.Split... | [
0.15286462008953094,
-0.2146262526512146,
0.7972094416618347,
-0.3836597204208374,
0.537476658821106,
-0.5762341618537903,
-0.3255438804626465,
-0.4584941565990448,
-0.448576420545578,
0.3022676706314087,
-0.277336061000824,
0.12042628228664398,
-0.43650397658348083,
0.8834579586982727,
... |
func (note *NoteRequest) Validate() error {
// TODO: add validation using ozzo
return nil
} | [
-0.568500280380249,
0.1037248969078064,
0.49053508043289185,
0.6951304078102112,
1.1124149560928345,
0.36682945489883423,
0.1913183182477951,
-0.9956266283988953,
-0.09050837904214859,
-0.6686486005783081,
1.1248571872711182,
0.19655217230319977,
-0.8258914351463318,
0.4759069085121155,
... |
func (note *NoteRequest) Bind(r *http.Request) error {
if err := note.Validate(); err != nil {
return err
}
return nil
} | [
-0.8099673986434937,
-0.49701988697052,
0.6556146740913391,
0.16277873516082764,
0.7281187176704407,
0.9342178702354431,
0.04512214660644531,
-0.743327260017395,
0.03224940598011017,
-0.38591909408569336,
0.8658434152603149,
0.6362090706825256,
-0.44740355014801025,
0.44364601373672485,
... |
func (*NoteResponse) TableName() string {
return "notes"
} | [
0.8624992370605469,
-0.6825857162475586,
0.43136873841285706,
0.05784689262509346,
0.17021356523036957,
0.3454756736755371,
0.9591223001480103,
-0.556140661239624,
0.3608708083629608,
0.03125010430812836,
-0.2876923680305481,
0.09456642717123032,
-0.4493958652019501,
-0.35276174545288086,
... |
func CountUpdates(perCells bool) do.Option {
return func(any interface{}) do.Opt {
a := aD(any)
undoDrum := countUpdates(perCells)(a)
undoDone := (&a.On.Done).Add(a.Drum.Print)(a) // TODO: this panics iff we have no a.Drum!
return func() do.Opt {
return do.OptJoin(undoDrum, undoDone)
}
}
} | [
1.2162504196166992,
-0.21361689269542694,
0.7466945052146912,
0.42999953031539917,
-0.5654739141464233,
0.247184619307518,
0.7359474897384644,
-0.04437866434454918,
0.7432664036750793,
0.25757941603660583,
0.0703297033905983,
-0.8729826211929321,
-0.22114746272563934,
0.11412568390369415,
... |
func quitHttpHandler(writer http.ResponseWriter, response *http.Request) {
defer shutdown()
sendHttpStatusOk(writer)
sendByeMessageToClient(writer)
printByeMessageToConsole()
} | [
-0.25657153129577637,
-0.47636696696281433,
0.2523195743560791,
0.15400409698486328,
0.2631487250328064,
1.063239574432373,
1.1176481246948242,
-0.7572644948959351,
-0.7984876036643982,
0.4358125925064087,
-0.18849952518939972,
-0.3280584514141083,
-0.3855093717575073,
0.38928788900375366,... |
func StocksHandleFunc(w http.ResponseWriter, r *http.Request) {
switch method := r.Method; method {
case http.MethodGet:
WriteJSON(w, stocks{Stocks: getStocks()})
case http.MethodPost:
body, err := ioutil.ReadAll(r.Body)
if err != nil {
w.WriteHeader(http.StatusInternalServerError)
}
stock := fromJSONSt... | [
-0.1854061633348465,
-0.17031732201576233,
0.6532004475593567,
-0.12996871769428253,
0.9194137454032898,
0.30583953857421875,
0.8070924282073975,
-1.0500882863998413,
-0.08704099804162979,
-0.485885351896286,
0.2605677843093872,
-0.36272093653678894,
0.7874796986579895,
0.3855080306529999,... |
func StockHandleFunc(w http.ResponseWriter, r *http.Request) {
path := r.URL.Path[len("/api/stocks/"):]
stockID, err := strconv.Atoi(path)
if err != nil {
w.WriteHeader(http.StatusInternalServerError)
}
switch method := r.Method; method {
case http.MethodGet:
stock, found := getStock(stockID)
if found {
... | [
-0.5810586810112,
-0.5650178790092468,
0.8245856165885925,
0.039342787116765976,
0.6793186068534851,
-0.10611975938081741,
0.8384371995925903,
-0.6785818338394165,
0.29047396779060364,
-0.027861695736646652,
0.39641448855400085,
-0.22405420243740082,
0.4681656062602997,
0.23426616191864014... |
func getStocks() []stock {
st := []stock{}
rows, _ := DB.Query(`
SELECT s.id, sku, w.id, amount
FROM stock s
INNER JOIN items i
ON s.item_sku = i.sku
INNER JOIN warehouses w
ON s.warehouse_id = w.id;
`)
for rows.Next() {
row := stock{}
rows.Scan(&row.ID, &row.SKU, &row.Warehouse, &row.Amount)
st ... | [
-0.25796905159950256,
-0.31817924976348877,
0.5158803462982178,
1.273415207862854,
0.5557450652122498,
-0.7513998746871948,
-0.40863969922065735,
-0.6655688881874084,
0.5230806469917297,
-0.01018317136913538,
-0.18144382536411285,
0.070335254073143,
0.006213108543306589,
0.8902282118797302... |
func fromJSONStock(data []byte) stock {
stock := stock{}
err := json.Unmarshal(data, &stock)
if err != nil {
panic(err)
}
return stock
} | [
-0.40561753511428833,
-0.7119331359863281,
0.29989489912986755,
-0.20690250396728516,
-0.909027099609375,
-0.11262045055627823,
-0.8178702592849731,
-1.2358269691467285,
0.46321699023246765,
0.20926439762115479,
-0.5099301934242249,
0.7423728704452515,
0.2334536463022232,
-0.04704499617218... |
func createStock(it stock) bool {
_, err := DB.Exec(
"INSERT INTO stock (item_sku, warehouse_id, amount) VALUES (?, ?, ?)",
it.SKU, it.Warehouse, it.Amount,
)
if err != nil {
return false
}
return true
} | [
-0.5086175203323364,
0.5467305183410645,
0.6935156583786011,
0.8417133688926697,
0.97308748960495,
0.5994822978973389,
-0.42682552337646484,
-0.5364245176315308,
0.057656921446323395,
0.12670835852622986,
-0.6401973366737366,
-1.5446442365646362,
-0.6557679772377014,
0.38904914259910583,
... |
func getStock(stockID int) (stock, bool) {
var warehouse int
var sku string
var amount int
err := DB.QueryRow(`
SELECT item_sku, warehouse_id, amount
FROM stock WHERE id = ?`, stockID).Scan(&sku, &warehouse, &amount)
if err != nil {
return stock{}, false
}
return stock{ID: stockID, SKU: sku, Warehouse: wa... | [
-0.6178236603736877,
0.40049004554748535,
0.486399382352829,
1.3315061330795288,
-0.19981887936592102,
-1.0078853368759155,
-0.3931272327899933,
-0.5413089394569397,
1.0435028076171875,
-0.020226415246725082,
-0.5701504349708557,
-0.46955668926239014,
0.1593463122844696,
0.553286075592041,... |
func deleteStock(stockID int) bool {
_, err := DB.Exec("DELETE FROM stock WHERE id = '" + strconv.Itoa(stockID) + "'")
if err != nil {
return false
}
return true
} | [
-0.7874864339828491,
0.4130907356739044,
0.6455447673797607,
0.44502347707748413,
0.36239388585090637,
0.2979182302951813,
-0.2928655743598938,
-0.4006745517253876,
0.5760771632194519,
-0.14551784098148346,
-0.2746866047382355,
-0.5966135263442993,
-0.3504681885242462,
1.0251575708389282,
... |
func updateStock(stockID int, it stock) bool {
_, err := DB.Exec(
"UPDATE stock SET item_sku = '" + it.SKU + "', warehouse_id = '" +
strconv.Itoa(it.Warehouse) + "', amount = '" + strconv.Itoa(it.Amount) +
"' WHERE id = '" + strconv.Itoa(stockID) + "'",
)
if err != nil {
return false
}
return true
} | [
-1.3006224632263184,
-0.4694017469882965,
0.6494889259338379,
0.7083564400672913,
-0.2893120050430298,
-0.029952822253108025,
-0.6313235759735107,
-0.22653871774673462,
0.10737109929323196,
0.5389542579650879,
-0.5807539224624634,
-0.581745445728302,
-0.12514208257198334,
0.409090965986251... |
func NewCoherenceInternalSpec(cluster *CoherenceCluster, role *CoherenceRole) *CoherenceInternalSpec {
out := CoherenceInternalSpec{}
out.FullnameOverride = role.Name
out.Cluster = cluster.Name
out.ServiceAccountName = cluster.Spec.ServiceAccountName
out.AutomountServiceAccountToken = cluster.Spec.AutomountServic... | [
-0.09740450978279114,
-0.8368231058120728,
0.5172290802001953,
-0.726346492767334,
-0.8961347341537476,
0.23788248002529144,
-0.26131579279899597,
-0.11994920670986176,
-0.392952561378479,
0.25594067573547363,
0.6651063561439514,
0.7509511113166809,
-0.5414815545082092,
0.09635410457849503... |
func CoherenceInternalSpecAsMapFromSpec(spec *CoherenceInternalSpec) (map[string]interface{}, error) {
b, _ := json.Marshal(spec)
jsonMap := make(map[string]interface{})
err := json.Unmarshal(b, &jsonMap)
return jsonMap, err
} | [
-0.7769678831100464,
-0.8857488036155701,
0.5228734016418457,
-1.0237064361572266,
-0.9569570422172546,
-0.18504345417022705,
-0.34054479002952576,
0.6000640392303467,
-0.14303027093410492,
0.43354034423828125,
-0.2095368355512619,
0.2547628581523895,
0.5843557119369507,
0.3865504264831543... |
func GetCoherenceInternalGroupVersionKind(scheme *runtime.Scheme) schema.GroupVersionKind {
kinds, _, _ := scheme.ObjectKinds(&CoherenceCluster{})
return schema.GroupVersionKind{
Group: kinds[0].Group,
Version: kinds[0].Version,
Kind: reflect.TypeOf(CoherenceInternal{}).Name(),
}
} | [
-0.21286654472351074,
-1.0361461639404297,
0.30042052268981934,
-0.3285289704799652,
-0.1808285117149353,
-0.1888304501771927,
0.5443147420883179,
-0.4517645835876465,
-0.6915209293365479,
0.9714413285255432,
-0.07634834200143814,
1.1741150617599487,
-0.9285310506820679,
0.1320771276950836... |
func (c *HetznerFloatingIPConfigurer) curlQueryFloatingIP(post bool) (string, error) {
/**
* The credentials for the API are loaded from a file stored in /etc/hetzner .
*/
//TODO: make credentialsFile dynamically changeable?
credentialsFile := "/etc/hetzner"
f, err := os.Open(credentialsFile)
if err != nil {
... | [
-0.2430659383535385,
-0.6874381899833679,
0.667571485042572,
0.11771655082702637,
-0.32506805658340454,
-0.2484244555234909,
-0.24152585864067078,
-0.024835951626300812,
-0.6926948428153992,
-0.2767346501350403,
0.6557047963142395,
-0.5279305577278137,
-0.3267684280872345,
0.48687919974327... |
func (c *HetznerFloatingIPConfigurer) getActiveServerIDFromJson(str string) (int64, error) {
var f map[string]interface{}
if c.verbose {
log.Printf("JSON response: %s\n", str)
}
err := json.Unmarshal([]byte(str), &f)
if err != nil {
log.Println(err)
return 0, err
}
if f["error"] != nil {
/* just print... | [
-0.45586296916007996,
-1.716727375984192,
0.8606575131416321,
-0.4142317771911621,
-0.45120176672935486,
-0.6712575554847717,
0.513730525970459,
-0.22362317144870758,
0.2742106020450592,
0.27305981516838074,
0.10533884912729263,
0.03622839227318764,
-0.834452748298645,
0.1749749332666397,
... |
func (c *HetznerFloatingIPConfigurer) QueryAddress() bool {
if (time.Since(c.lastAPICheck) / time.Hour) > 1 {
/**We need to recheck the status!
* Don't check too often because of stupid API rate limits
*/
log.Println("Cached state was too old.")
c.cachedState = UNKNOWN
} else {
/** no need to check, we ... | [
-0.9954499006271362,
-0.4700911045074463,
0.7199010252952576,
0.21032293140888214,
-0.7002285122871399,
-0.25322622060775757,
-0.27858972549438477,
-0.11318314075469971,
0.8207704424858093,
-0.2972390055656433,
0.22709842026233673,
0.12816110253334045,
-0.5220502018928528,
0.26594319939613... |
func (g *Group) GET(path string, h Handler, gases ...Gas) {
g.Air.GET(g.Prefix+path, h, append(g.Gases, gases...)...)
} | [
-0.6246326565742493,
-0.20943279564380646,
0.4875688850879669,
0.11741413176059723,
0.3476064205169678,
0.352177232503891,
-0.7494460344314575,
0.04774555191397667,
-1.6439603567123413,
-1.0573610067367554,
0.12723052501678467,
0.7604382038116455,
-0.3431966304779053,
0.20201259851455688,
... |
func (g *Group) HEAD(path string, h Handler, gases ...Gas) {
g.Air.HEAD(g.Prefix+path, h, append(g.Gases, gases...)...)
} | [
-0.7255883812904358,
-0.43610572814941406,
0.44338470697402954,
0.8314729332923889,
0.12705278396606445,
1.2942599058151245,
-0.32765159010887146,
0.16788172721862793,
-0.8706250786781311,
-0.3951275646686554,
-0.056044623255729675,
0.5992624759674072,
-0.12631919980049133,
-0.027825362980... |
func (g *Group) POST(path string, h Handler, gases ...Gas) {
g.Air.POST(g.Prefix+path, h, append(g.Gases, gases...)...)
} | [
-0.32438772916793823,
-0.11647747457027435,
0.3635092079639435,
0.9217983484268188,
-0.049860019236803055,
0.6460440158843994,
-0.46047160029411316,
0.0047749304212629795,
-1.4127271175384521,
-1.5774223804473877,
-0.5141035318374634,
-0.22693704068660736,
-0.680353581905365,
0.93638527393... |
func (g *Group) PUT(path string, h Handler, gases ...Gas) {
g.Air.PUT(g.Prefix+path, h, append(g.Gases, gases...)...)
} | [
-0.695303738117218,
0.11266924440860748,
0.4046209752559662,
-0.10663025826215744,
-0.03985333442687988,
0.9633909463882446,
0.20012319087982178,
0.34895992279052734,
-1.6446372270584106,
-0.6525216698646545,
-0.486056923866272,
0.3192759156227112,
-1.039889931678772,
0.34081193804740906,
... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.