id
stringlengths
2
7
text
stringlengths
17
51.2k
title
stringclasses
1 value
c172800
f.fileCount = count return f.fileCount }
c172801
f.fileSize = size * int64(unit) return f.fileSize }
c172802
return 0 } return f.Size() }
c172803
{ return nil, err } defer resp.Body.Close() read, err := ioutil.ReadAll(resp.Body) if resp.StatusCode != http.StatusOK { er := new(rawError) json.Unmarshal(read, er) return nil, errors.New("Error occured: " + er.Error.Message) } profile := new(Profile) return profile, json.Unmarshal(read, profile) }
c172804
rw.WriteHeader(http.StatusUnauthorized) return } rw.WriteHeader(http.StatusOK) rw.Write([]byte(query.Get("hub.challenge"))) } else if req.Method == "POST" { m.handlePOST(rw, req) } else { rw.WriteHeader(http.StatusMethodNotAllowed) } }
c172805
!= "Successfully deleted all new_thread's CTAs" { return fmt.Errorf("Error occured while deleting get started button, invalid result: %s", result.Result) } return nil }
c172806
{ return Button{ Type: ButtonTypeWebURL, Title: title, URL: url, } }
c172807
ButtonTypePostback, Title: title, Payload: payload, } }
c172808
ButtonTypePhoneNumber, Title: title, Payload: phone, } }
c172809
if isPredeclaredType(t1) { v := reflect.ValueOf(result) makeValueProxy(L, v.Convert(t2), cStringMeta) } else { L.PushString(result) } return 1 }
c172810
reflect.Uint64 || k1 == reflect.Int64) { return k1 } if k1 == reflect.Complex128 || k2 == reflect.Complex128 { return reflect.Complex128 } return reflect.Float64 }
c172811
makeValueProxy(L, v.Convert(t2), mt) } else if isComplex { complexType := reflect.TypeOf(0i) makeValueProxy(L, v.Convert(complexType), cComplexMeta) } else { L.PushNumber(valueToNumber(L, v)) } }
c172812
case reflect.Float64, reflect.Float32: return reflect.Float64 case reflect.Complex128, reflect.Complex64: return reflect.Complex128 } return v.Kind() }
c172813
return "true" } return "false" case lua.LUA_TNIL: return "nil" } return fmt.Sprintf("%s: %p", L.LTypename(idx), L.ToPointer(idx)) }
c172814
// Copy value on top. v.L.PushValue(-2) // Set value to table. // TODO: Handle overflow. v.L.RawSeti(-2, int(ptr)) v.L.Pop(1) }
c172815
// Not visited. v.L.Pop(2) return false } v.L.Replace(-2) return true }
c172816
reflect.Slice { visited.mark(v) } else if vp.Kind() == reflect.Ptr { visited.mark(vp) } for i := 0; i < n; i++ { L.PushInteger(int64(i + 1)) val := v.Index(i) if isNil(val) { val = nullv } goToLua(L, val, false, visited) L.SetTable(-3) } }
c172817
a, false, visited) visited.close() }
c172818
ref := L.Ref(lua.LUA_REGISTRYINDEX) return &LuaObject{l: L, ref: ref} }
c172819
if err != nil { return nil } val := NewLuaObject(L, -1) L.Pop(1) return val }
c172820
*LuaObject { GoToLua(L, val) return NewLuaObject(L, -1) }
c172821
lo.l.Unref(lua.LUA_REGISTRYINDEX, lo.ref) }
c172822
!= nil { return err } defer lo.l.Pop(1) return LuaToGo(lo.l, -1, a) }
c172823
err := get(lo.l, subfields...) if err != nil { return nil, err } val := NewLuaObject(lo.l, -1) lo.l.Pop(1) return val, nil }
c172824
lo.l.RawGeti(lua.LUA_REGISTRYINDEX, lo.ref) }
c172825
L.GetMetaField(loIdx, "__newindex") L.PushValue(loIdx) L.PushString(key) L.PushValue(resultIdx) L.Remove(resultIdx) L.Call(3, 0) } } else { return ErrLuaObjectIndexable } src.Push() defer src.l.Pop(1) srcIdx := L.GetTop() var get func(int, string) if L.IsTable(srcIdx) { get = L.GetField } else if L.GetMetaField(srcIdx, "__index") { L.Pop(1) get = func(idx int, key string) { L.GetMetaField(srcIdx, "__index") L.PushValue(srcIdx) L.PushString(key) L.Call(2, 1) } } else { return ErrLuaObjectIndexable } for _, key := range keys { get(srcIdx, key) set(loIdx, key) } return nil }
c172826
L.Pop(1) return nil, err } ref := L.Ref(lua.LUA_REGISTRYINDEX) return &LuaTableIter{lo: lo, keyRef: lua.LUA_NOREF, iterRef: ref}, nil } else { return nil, ErrLuaObjectIndexable } }
c172827
resource, authType, defaultHost, defaultDomain, defaultConf) }
c172828
make(map[string]string), receivedUsers: make(chan []*User), receivedRooms: make(chan []*Room), receivedMessage: make(chan *Message), host: host, domain: domain, conf: conf, } if err != nil { return c, err } err = c.authenticate() if err != nil { return c, err } go c.listen() return c, nil }
c172829
c.connection.Presence(c.Id, s) }
c172830
c.connection.MUCPresence(roomId+"/"+resource, c.Id) }
c172831
c.connection.MUCPart(roomId + "/" + name) }
c172832
c.connection.MUCSend("groupchat", roomId, c.Id+"/"+name, body) }
c172833
c.connection.MUCSend("chat", user, c.Id+"/"+name, body) }
c172834
time.Tick(60 * time.Second) { c.connection.KeepAlive() } }
c172835
c.connection.Discover(c.Id, c.conf) }
c172836
c.connection.Roster(c.Id, c.domain) }
c172837
to marshal src: %s", err) } err = json.Unmarshal(bytes, dst) if err != nil { return fmt.Errorf("Unable to unmarshal into dst: %s", err) } return nil }
c172838
i, c := range row { row[i] = strings.TrimSpace(c) } tabData = append(tabData, row) } return tabData }
c172839
return len(t[reflect.ValueOf(t).MapKeys()[0].String()]) }
c172840
" + step.Text); l > s.longestLine { s.longestLine = l } } } return s.longestLine }
c172841
> f.longestLine { f.longestLine = l } } } return f.longestLine }
c172842
return buildAndRunDir(dir, filters, goBuildTags) }
c172843
symlink)) && len(p) > greedy { prefixPath := filepath.ToSlash(filepath.Join(p, "src")) fullPkg, _ = filepath.Rel(prefixPath, absPath) greedy = len(p) } } return filepath.ToSlash(fullPkg) }
c172844
append(in, byte(s>>32)) in = append(in, byte(s>>40)) in = append(in, byte(s>>48)) in = append(in, byte(s>>56)) return in }
c172845
bufio.NewReader(r)} return decoder.decode() }
c172846
lo.bp.give <- part.b return } lo.logger.Error(swiftLargeObjectLogTag, fmt.Sprintf("Error on attempt %d: Retrying part: %v, Error: %s", i, part, err)) } lo.err = err }
c172847
")") if _, err := part.r.Seek(0, 0); err != nil { // move back to beginning, if retrying return err } headers, err := lo.c.ObjectPut(container, objectName, part.r, true, "", "", nil) if err != nil { return err } s := headers["Etag"] if part.ETag != s { return fmt.Errorf("Response etag does not match. Remote:%s Calculated: %s", s, part.ETag) } return nil }
c172848
{ err = lo.c.ObjectDelete(lo.container, object) if err != nil { lo.logger.Error(swiftLargeObjectLogTag, fmt.Sprintf("Delete the multipart objects: %v\n", err)) } } } return }
c172849
fmt.Println("lastReload: ", (*lastReload.ModifyDate).Format(time.RFC3339)) // } // if activeTxn != nil && activeTxn.TransactionStatus != nil && activeTxn.TransactionStatus.Name != nil { // fmt.Println("activeTxn: ", *activeTxn.TransactionStatus.Name) // } // if provisionDate != nil { // fmt.Println("provisionDate: ", (*provisionDate).Format(time.RFC3339)) // } reloading := activeTxn != nil && lastReload != nil && *activeTxn.Id == *lastReload.Id if provisionDate != nil && !reloading { // fmt.Println("power state:", *virtualGuest.PowerState.KeyName) if *virtualGuest.PowerState.KeyName == "RUNNING" { return nil } } now := time.Now() if now.After(until) { return bosherr.Errorf("Power on virtual guest with id %d Time Out!", *virtualGuest.Id) } min := math.Min(float64(10.0), float64(until.Sub(now))) time.Sleep(time.Duration(min) * time.Second) } }
c172850
// Only collect prices from valid location groups. if price.LocationGroupId != nil { continue } if !hasCategory(price.Categories, priceCategory) { continue } return price, nil } } return datatypes.Product_Item_Price{}, bosherr.Error("Unable to find price for performance storage") }
c172851
// Only collect prices from valid location groups. if price.LocationGroupId != nil { continue } if !hasCategory(price.Categories, "performance_storage_space") { continue } return price, nil } } return datatypes.Product_Item_Price{}, bosherr.Errorf("Unable to find disk space price with size of %d for the given volume", size) }
c172852
continue } min, err := strconv.Atoi(*price.CapacityRestrictionMinimum) if err != nil { return datatypes.Product_Item_Price{}, bosherr.Errorf("Unable to find price for %d iops for the given volume", iops) } if size < int(min) { continue } max, err := strconv.Atoi(*price.CapacityRestrictionMaximum) if err != nil { return datatypes.Product_Item_Price{}, bosherr.Errorf("Unable to find price for %d iops for the given volume", iops) } if size > int(max) { continue } return price, nil } } return datatypes.Product_Item_Price{}, bosherr.Errorf("Unable to find price for %d iops for the given volume", iops) }
c172853
time.Duration) *FindVmsByStatesParams { o.SetTimeout(timeout) return o }
c172854
*FindVmsByStatesParams { o.SetContext(ctx) return o }
c172855
[]string) *FindVmsByStatesParams { o.SetStates(states) return o }
c172856
{ o.Payload = payload return o }
c172857
time.Duration) *OrderVMByFilterParams { o.SetTimeout(timeout) return o }
c172858
*OrderVMByFilterParams { o.SetContext(ctx) return o }
c172859
*OrderVMByFilterParams { o.SetBody(body) return o }
c172860
error { c.DeleteCalled = true return c.DeleteErr }
c172861
= true return c.FetchSettings, c.FetchErr }
c172862
error { c.UpdateCalled = true c.UpdateSettings = agentSettings return c.UpdateErr }
c172863
= strfmt.Default } transport := httptransport.New("vps.swagger.io", "/v2", []string{"http"}) return New(transport, formats) }
c172864
{ cli := new(SoftLayerVMPool) cli.Transport = transport cli.VM = vm.New(transport, formats) return cli }
c172865
transport c.VM.SetTransport(transport) }
c172866
if len(res) > 0 { return errors.CompositeValidationError(res...) } return nil }
c172867
time.Duration) *FindVmsByDeploymentParams { o.SetTimeout(timeout) return o }
c172868
context.Context) *FindVmsByDeploymentParams { o.SetContext(ctx) return o }
c172869
{ o.SetDeployment(deployment) return o }
c172870
o.SetTimeout(timeout) return o }
c172871
*UpdateVMParams { o.SetContext(ctx) return o }
c172872
{ o.SetBody(body) return o }
c172873
Options: agentOptions.Blobstore.Options, }, Env: EnvSettings(env), Mbus: agentOptions.Mbus, Networks: networksSettings, Ntp: agentOptions.Ntp, VM: VMSettings{ Name: vmCID, }, } return agentSettings }
c172874
as.Networks = networksSettings return as }
c172875
diskID) as.Disks.Persistent = persistenDiskSettings return as }
c172876
a non-empty CertFile") } if o.KeyFile == "" { return bosherr.Error("Must provide a non-empty KeyFile") } return nil }
c172877
time.Duration) *FindVmsByFiltersParams { o.SetTimeout(timeout) return o }
c172878
context.Context) *FindVmsByFiltersParams { o.SetContext(ctx) return o }
c172879
*FindVmsByFiltersParams { o.SetBody(body) return o }
c172880
o.SetTimeout(timeout) return o }
c172881
*DeleteVMParams { o.SetContext(ctx) return o }
c172882
int32) *DeleteVMParams { o.SetCid(cid) return o }
c172883
o.Payload = payload return o }
c172884
"body", m); err != nil { return err } if len(res) > 0 { return errors.CompositeValidationError(res...) } return nil }
c172885
time.Duration) *UpdateVMWithStateParams { o.SetTimeout(timeout) return o }
c172886
context.Context) *UpdateVMWithStateParams { o.SetContext(ctx) return o }
c172887
*UpdateVMWithStateParams { o.SetBody(body) return o }
c172888
int32) *UpdateVMWithStateParams { o.SetCid(cid) return o }
c172889
*AddVMParams { o.SetTimeout(timeout) return o }
c172890
*AddVMParams { o.SetContext(ctx) return o }
c172891
*AddVMParams { o.SetBody(body) return o }
c172892
} err := o.Blobstore.Validate() if err != nil { return bosherr.WrapError(err, "Validating Blobstore configuration") } return nil }
c172893
*ListVMParams { o.SetTimeout(timeout) return o }
c172894
o.SetContext(ctx) return o }
c172895
if len(res) > 0 { return errors.CompositeValidationError(res...) } return nil }
c172896
*OrderVMByFilterOK { o.Payload = payload return o }
c172897
"body", m); err != nil { return err } if len(res) > 0 { return errors.CompositeValidationError(res...) } return nil }
c172898
time.Duration) *GetVMByCidParams { o.SetTimeout(timeout) return o }
c172899
*GetVMByCidParams { o.SetContext(ctx) return o }