text stringlengths 11 6.3k | embedding listlengths 768 768 |
|---|---|
func (c *tasksPerCommitCache) Get(ctx context.Context, rs types.RepoState) (int, error) {
c.mtx.Lock()
defer c.mtx.Unlock()
if _, ok := c.cached[rs]; !ok {
// Find the number of TaskSpecs expected to run at this commit.
cfg, cachedErr, err := c.tcc.Get(ctx, rs)
if err == task_cfg_cache.ErrNoSuchEntry {
// ... | [
-0.41048702597618103,
0.7460840940475464,
0.7070650458335876,
-1.021802306175232,
0.0385117270052433,
-0.5738385915756226,
0.6362292170524597,
0.1771754026412964,
-0.5065463781356812,
0.2896384000778198,
-0.2953580915927887,
0.23749208450317383,
-0.13609175384044647,
0.20459777116775513,
... |
func (c *tasksPerCommitCache) update(ctx context.Context) error {
c.mtx.Lock()
defer c.mtx.Unlock()
start := time.Now().Add(-c.period)
for rs := range c.cached {
repo, ok := c.repos[rs.Repo]
if !ok {
return fmt.Errorf("No such repo: %s", rs.Repo)
}
commit := repo.Get(rs.Revision)
if commit == nil {
... | [
0.1877613216638565,
-0.07577116787433624,
0.4571840763092041,
0.06983083486557007,
-0.4437449872493744,
-0.24614574015140533,
0.3476758301258087,
-0.29782456159591675,
-0.38902589678764343,
0.7763165235519409,
0.7230759859085083,
-0.19799484312534332,
-0.44347047805786133,
0.57807999849319... |
func glob(pattern string) []string {
pattern, err := homedir.Expand(pattern)
if err != nil {
log.Fatal(err)
}
paths, err := filepath.Glob(pattern)
if err != nil {
log.Fatal(err)
}
if len(paths) == 0 {
log.Fatalf("%s: no such file or directory", pattern)
}
return paths
} | [
0.1121632382273674,
0.36649349331855774,
0.8199803233146667,
1.479905128479004,
0.4669226109981537,
0.6237719655036926,
0.6132605075836182,
0.12239191681146622,
0.851477861404419,
0.8215947151184082,
0.6744619607925415,
-0.2136065810918808,
-0.1718994677066803,
0.528959333896637,
0.83408... |
func (m *mcq) addFrom(s string) error {
for _, c := range s {
if c < 'a' || c > 'z' {
return fmt.Errorf("invalid character \"%c\" in yes-question string", c)
}
m.answer[c-'a']++
}
m.groupsize++
return nil
} | [
0.2973245680332184,
-0.728776752948761,
0.46031805872917175,
-0.08817143738269806,
-1.0120760202407837,
0.18736854195594788,
0.8540695905685425,
0.10617982596158981,
0.6537197828292847,
-0.8420067429542542,
0.5732840299606323,
0.22788561880588531,
-0.2549999952316284,
0.011681700125336647,... |
func (m *mcq) countOR() int {
count := 0
for _, v := range m.answer {
if v > 0 {
count++
}
}
return count
} | [
-0.22655919194221497,
-0.8302485346794128,
0.4658047556877136,
0.23548389971256256,
-1.20154869556427,
0.27306634187698364,
0.1749168336391449,
0.4036460220813751,
-0.10990549623966217,
0.054999981075525284,
0.15946052968502045,
-0.954884946346283,
0.39831262826919556,
0.9378589391708374,
... |
func (m *mcq) countAND() int {
count := 0
for _, v := range m.answer {
if v == m.groupsize {
count++
}
}
return count
} | [
-0.07178796082735062,
-0.7994814515113831,
0.6546472907066345,
-0.1559249460697174,
-1.1730222702026367,
0.6004330515861511,
1.2892744541168213,
-0.2773168385028839,
-0.4800153970718384,
0.050607044249773026,
0.0652226135134697,
-0.08787310868501663,
-0.29444214701652527,
1.185505151748657... |
func (p *Puzzle) Load(ctx context.Context, datastream <-chan *common.LineContent) error {
var m *mcq
for dataline := range datastream {
if dataline.Err != nil {
return dataline.Err
}
s := strings.TrimSpace(string(dataline.Content))
if len(s) == 0 {
if m == nil {
return errors.New("unexpected blank ... | [
0.18304574489593506,
-0.7095771431922913,
0.5345674157142639,
-0.7963021993637085,
-0.4866507649421692,
0.2889443635940552,
0.035485245287418365,
-0.20462389290332794,
0.29700183868408203,
-0.06335021555423737,
0.04497842863202095,
-0.3582553565502167,
-0.5701302289962769,
0.02322435937821... |
func (p *Puzzle) SolvePart1() (common.Answer, error) {
count := 0
for _, m := range p.answerList {
count += m.countOR()
}
return common.ToAnswer(count), nil
} | [
-0.5990482568740845,
0.31107306480407715,
0.7737671136856079,
0.34357714653015137,
-0.22693409025669098,
0.5276780724525452,
0.37961864471435547,
-0.05166913941502571,
-0.2754850387573242,
0.37044742703437805,
-0.18638211488723755,
-0.9275460839271545,
-1.5754809379577637,
0.27856865525245... |
func (p *Puzzle) SolvePart2() (common.Answer, error) {
count := 0
for _, m := range p.answerList {
count += m.countAND()
}
return common.ToAnswer(count), nil
} | [
-0.27944210171699524,
-0.24854423105716705,
0.7369042038917542,
-0.07226064801216125,
-0.4265807569026947,
0.1385018676519394,
0.1970711499452591,
-0.6086037158966064,
-0.4283432960510254,
-0.0890641063451767,
-0.4442943036556244,
-0.6322090029716492,
-1.5035258531570435,
0.643727779388427... |
func New(maxSize int64) *Cache {
return &Cache{
MaxSize: maxSize,
ll: list.New(),
cache: make(map[interface{}]*list.Element),
}
} | [
-0.18174012005329132,
-0.04102853685617447,
0.18147686123847961,
0.4281662106513977,
-1.5256357192993164,
0.006698795594274998,
-0.8275071978569031,
0.7376702427864075,
0.5278798937797546,
-0.11871300637722015,
-0.900897204875946,
-0.2450302392244339,
0.2882586121559143,
0.4582750797271728... |
func (c *Cache) Add(key Key, value interface{}, size int64) bool {
if c.cache == nil {
c.cache = make(map[interface{}]*list.Element)
c.ll = list.New()
}
if ee, ok := c.cache[key]; ok {
c.ll.MoveToFront(ee)
ee.Value.(*entry).value = value
return true
}
if size < 0 {
return false
}
// Entry by itsel... | [
-0.5228748321533203,
0.2997080385684967,
0.599258303642273,
-0.13762426376342773,
-1.0033607482910156,
0.4688151180744171,
-0.23936057090759277,
0.36171776056289673,
0.4741322994232178,
0.692237138748169,
-0.16412357985973358,
-0.43700748682022095,
-0.4465666711330414,
0.6084233522415161,
... |
func (c *Cache) Get(key Key) (value interface{}, ok bool) {
if c.cache == nil {
return
}
if ele, hit := c.cache[key]; hit {
c.ll.MoveToFront(ele)
return ele.Value.(*entry).value, true
}
return
} | [
-0.625744104385376,
0.8218671679496765,
0.5913035273551941,
0.01796361431479454,
-0.6077804565429688,
-0.05927341431379318,
-0.5743252038955688,
-0.055576495826244354,
-0.4204449951648712,
1.148532748222351,
-0.5269139409065247,
0.015837116166949272,
0.3608962893486023,
0.27520766854286194... |
func (c *Cache) Remove(key Key) {
if c.cache == nil {
return
}
if ele, hit := c.cache[key]; hit {
c.removeElement(ele)
}
} | [
-0.569960355758667,
0.7241082787513733,
0.023332029581069946,
0.35259494185447693,
-0.9071671962738037,
0.008782453835010529,
-0.003237815573811531,
1.063645601272583,
0.3346840739250183,
0.7565223574638367,
-0.564389705657959,
-0.41360214352607727,
-0.7185773253440857,
0.9873470664024353,... |
func (c *Cache) RemoveOldest() {
if c.cache == nil {
return
}
ele := c.ll.Back()
if ele != nil {
c.removeElement(ele)
}
} | [
0.45874130725860596,
0.4809119701385498,
0.5373285412788391,
-0.1345696896314621,
-0.02274009957909584,
-0.4390413165092468,
-0.09801686555147171,
0.0999792069196701,
0.09453072398900986,
0.5064498782157898,
-0.4167701303958893,
0.2204766571521759,
-1.1629517078399658,
0.8392871022224426,
... |
func (c *Cache) Len() int {
if c.cache == nil {
return 0
}
return c.ll.Len()
} | [
0.22114908695220947,
0.6581950783729553,
-0.00646633468568325,
0.08415918052196503,
0.07930741459131241,
-0.4353204667568207,
0.8621618747711182,
1.0956289768218994,
0.4728251099586487,
-0.41246986389160156,
-0.8592742681503296,
0.4178357720375061,
0.48241129517555237,
0.46953028440475464,... |
func NewReconciler(options ReconcilerOptions, client client.Client, scheme *runtime.Scheme, log logr.Logger, recorder record.EventRecorder) (*Reconciler, error) {
return &Reconciler{
options: options,
client: client,
scheme: scheme,
log: log,
recorder: recorder,
}, nil
} | [
0.37874042987823486,
-0.3771609365940094,
0.516947329044342,
0.04427549988031387,
-0.36252278089523315,
-0.46983784437179565,
0.42149674892425537,
0.14534525573253632,
0.21435630321502686,
0.2162439227104187,
0.43023672699928284,
0.21123969554901123,
-0.7012289762496948,
0.6649488806724548... |
func (r *Reconciler) Reconcile(ctx context.Context, request reconcile.Request) (reconcile.Result, error) {
reqLogger := r.log.WithValues("Req.NS", request.Namespace, "Req.Name", request.Name)
reqLogger.Info("Reconciling PodTemplate")
eds := &datadoghqv1alpha1.ExtendedDaemonSet{}
err := r.client.Get(context.TODO(),... | [
-1.2127219438552856,
0.1428718864917755,
0.91651850938797,
-0.2931927442550659,
0.015903254970908165,
-0.36047783493995667,
-1.376851201057434,
-0.5094935894012451,
-0.3504277169704437,
-0.38787516951560974,
-0.10572927445173264,
-0.2615145742893219,
-0.801977813243866,
0.5557146072387695,... |
func (r *Reconciler) createPodTemplate(logger logr.Logger, eds *datadoghqv1alpha1.ExtendedDaemonSet) (reconcile.Result, error) {
podTpl, err := r.newPodTemplate(eds)
if err != nil {
return reconcile.Result{}, err
}
logger.Info("Creating a new PodTemplate", "podTemplate.Namespace", podTpl.Namespace, "podTemplate.... | [
-0.9342008829116821,
0.37315279245376587,
0.6816588044166565,
-0.8003357648849487,
0.01786591298878193,
0.1656382977962494,
-1.050365924835205,
-0.45041075348854065,
-0.007600738201290369,
0.5050171613693237,
-0.8917903304100037,
-0.7886750102043152,
-0.9367305636405945,
0.3516972959041595... |
func (r *Reconciler) updatePodTemplateIfNeeded(logger logr.Logger, eds *datadoghqv1alpha1.ExtendedDaemonSet, podTpl *corev1.PodTemplate) (reconcile.Result, error) {
specHash, err := comparison.GenerateMD5PodTemplateSpec(&eds.Spec.Template)
if err != nil {
return reconcile.Result{}, fmt.Errorf("cannot generate pod t... | [
-1.409217119216919,
-0.14799658954143524,
0.6309449076652527,
-0.6855295896530151,
-0.8762959241867065,
-0.07520414143800735,
-0.7527711391448975,
-0.9606969952583313,
-0.2536715567111969,
0.9192957878112793,
-0.94157475233078,
-0.17903710901737213,
-0.5672473311424255,
0.5172938108444214,... |
func (r *Reconciler) newPodTemplate(eds *datadoghqv1alpha1.ExtendedDaemonSet) (*corev1.PodTemplate, error) {
podTpl := &corev1.PodTemplate{
ObjectMeta: metav1.ObjectMeta{
Name: eds.Name,
Namespace: eds.Namespace,
Labels: eds.Labels,
Annotations: eds.Annotations,
},
Template: *eds.Spec.T... | [
-0.593870997428894,
-0.11194826662540436,
0.652731716632843,
-1.4213606119155884,
-0.8810299038887024,
-0.12845563888549805,
-0.5967260003089905,
-0.06614812463521957,
0.36168789863586426,
0.6916504502296448,
-0.7490959167480469,
-0.5292897820472717,
-0.16064466536045074,
0.468657135963439... |
func NewClient(gwURL string) *Client {
client := new(Client)
client.GWURL = gwURL
client.NonceEnabled = false
client.NonceLength = 16
client.DefaultParams = make(map[string]string, 0)
client.OverrideParams = make(map[string]string, 0)
return client
} | [
0.4123896062374115,
0.2137288749217987,
0.2012835592031479,
-0.4502020478248596,
-0.28529104590415955,
0.24393264949321747,
0.8366064429283142,
-0.33492475748062134,
-0.2519468665122986,
-0.6273944973945618,
-0.531616747379303,
0.3041574954986572,
-0.9595926403999329,
-0.07740677893161774,... |
func (client *Client) Clone() *Client {
newClient := new(Client)
newClient.LocalAddr = client.LocalAddr
newClient.GWURL = client.GWURL
newClient.GWADDR = client.GWADDR
newClient.AppId = client.AppId
newClient.SignKey = client.SignKey
newClient.NonceEnabled = client.NonceEnabled
newClient.NonceLength = c... | [
0.15526477992534637,
-1.213028907775879,
0.4907267689704895,
-0.09997530281543732,
-0.8004056811332703,
0.731024444103241,
-0.24187326431274414,
-0.4176747798919678,
-0.26555946469306946,
0.37652701139450073,
-0.4409824311733246,
0.36736947298049927,
-0.9177908301353455,
-0.371045440435409... |
func (client *Client) SetDefaultParam(paramName, paramValue string) *Client {
client.DefaultParams[paramName] = paramValue
return client
} | [
-0.3645617365837097,
-0.022821856662631035,
0.11735685169696808,
0.02865319885313511,
0.7750410437583923,
0.7938930988311768,
0.5472536683082581,
-0.1236000806093216,
-0.09486140310764313,
-0.05994106084108353,
-0.5246201157569885,
0.9203992486000061,
-0.7890622019767761,
0.968988239765167... |
func (client *Client) SetOverrideParam(paramName, paramValue string) *Client {
client.OverrideParams[paramName] = paramValue
return client
} | [
-0.8116182088851929,
-0.25826239585876465,
0.4263586699962616,
-0.5504109263420105,
0.27322742342948914,
0.1316615641117096,
0.802170991897583,
-0.37942445278167725,
-0.2593185007572174,
-0.5026459097862244,
-0.6540864109992981,
1.4078086614608765,
-1.1087076663970947,
0.07769099622964859,... |
func (client *Client) Get(action string, params url.Values, header http.Header) (*Response, error) {
return client.Request("GET", action, params, header, nil)
} | [
-0.5191149711608887,
-0.4643494784832001,
0.3450247049331665,
-0.04140845686197281,
0.8993353843688965,
-0.677640974521637,
-0.4600622355937958,
-0.8657771348953247,
-0.7190230488777161,
0.18487127125263214,
-0.06898615509271622,
1.2495197057724,
-0.13344402611255646,
-0.33069369196891785,... |
func (client *Client) Post(action string, params url.Values, header http.Header) (*Response, error) {
return client.Request("POST", action, params, header, nil)
} | [
-0.2361437976360321,
-0.2581084072589874,
0.228277787566185,
0.7414892315864563,
0.32967403531074524,
-0.31073644757270813,
-0.3340233564376831,
-0.9198466539382935,
-0.6433832049369812,
-0.5713136792182922,
-0.25464802980422974,
0.02769785374403,
-0.5498613119125366,
0.07098507881164551,
... |
func (client *Client) Upload(action string, params url.Values, header http.Header, multipartBody io.Reader) (*Response, error) {
return client.Request("POST", action, params, header, multipartBody)
} | [
-0.6211794018745422,
0.15880990028381348,
0.6487416625022888,
0.11315800994634628,
0.23236460983753204,
-0.24386602640151978,
-0.39142489433288574,
-0.9507340788841248,
-0.5240143537521362,
0.19227580726146698,
-0.16543631255626678,
-0.2907790541648865,
-0.9281414747238159,
-0.063349068164... |
func (client *Client) Request(method, action string, params url.Values, header http.Header, multipartBody io.Reader) (*Response, error) {
if method != "GET" && method != "POST" {
return nil, errors.New("unsupport method: " + method)
}
req, err := client.newRequest(method, action, params, header, multipartBod... | [
-0.1434575617313385,
-0.18133293092250824,
0.8552443981170654,
0.04769464582204819,
-0.04901983588933945,
-0.1442413628101349,
-0.38637450337409973,
-0.2064654380083084,
0.31655535101890564,
0.11707957088947296,
0.412813276052475,
0.7084868550300598,
-0.667914092540741,
0.5916641354560852,... |
func NewGetchatRequest(payload *chatapi.GetchatPayload) *chatapipb.GetchatRequest {
message := &chatapipb.GetchatRequest{
Id: int32(payload.ID),
}
return message
} | [
-0.40785062313079834,
-0.27675512433052063,
0.4472508728504181,
0.3412562310695648,
-0.5867576003074646,
-0.533916711807251,
-0.8661789894104004,
-0.5925790071487427,
-0.7114995121955872,
-0.12259882688522339,
0.09347283095121384,
0.2860126197338104,
-0.5659646391868591,
-0.222659289836883... |
func NewGetchatResult(message *chatapipb.GoaChatCollection) chatapiviews.GoaChatCollectionView {
result := make([]*chatapiviews.GoaChatView, len(message.Field))
for i, val := range message.Field {
result[i] = &chatapiviews.GoaChatView{
UserID: &val.UserId,
RoomName: &val.RoomName,
Member: &val.Member,
... | [
-0.8282061219215393,
0.14215320348739624,
0.42111796140670776,
-0.4120514988899231,
-0.43044498562812805,
-0.5087608695030212,
-0.29828745126724243,
-1.3114079236984253,
-0.8931772708892822,
-0.05499063804745674,
-0.2966799736022949,
-0.174336239695549,
-0.5060787796974182,
0.4494863748550... |
func NewPostchatRequest(payload *chatapi.PostchatPayload) *chatapipb.PostchatRequest {
message := &chatapipb.PostchatRequest{
Id: payload.ID,
UserId: payload.UserID,
RoomName: payload.RoomName,
Member: payload.Member,
Chat: payload.Chat,
PostDt: payload.PostDt,
Cookie: payload.Cookie,
... | [
-0.7610617876052856,
-0.7880578637123108,
0.5281477570533752,
0.3128623962402344,
-1.7505651712417603,
-0.07772856205701828,
-1.3418684005737305,
-0.6517531275749207,
-1.0313873291015625,
-0.20586779713630676,
-0.10801076143980026,
-0.5847545862197876,
-1.0152040719985962,
0.46077778935432... |
func NewPostchatResult(message *chatapipb.PostchatResponse) bool {
result := message.Field
return result
} | [
-0.5434913039207458,
0.06445546448230743,
0.23357664048671722,
0.06407471746206284,
-1.1697713136672974,
-0.3566216230392456,
-0.5490451455116272,
-0.972970724105835,
-0.9439669847488403,
-0.2348419576883316,
-0.8383364677429199,
-1.645832896232605,
-1.8776249885559082,
0.0167282335460186,... |
func ValidateGoaChatCollection(message *chatapipb.GoaChatCollection) (err error) {
for _, e := range message.Field {
if e != nil {
if err2 := ValidateGoaChat(e); err2 != nil {
err = goa.MergeErrors(err, err2)
}
}
}
return
} | [
-0.6296738982200623,
-0.19381433725357056,
0.6678997278213501,
-0.4602721035480499,
0.26916858553886414,
1.3514907360076904,
0.8191490173339844,
-1.155521035194397,
-2.0687222480773926,
0.3391517102718353,
0.08813301473855972,
-0.4291157126426697,
-0.4371457099914551,
1.1777111291885376,
... |
func ValidateGoaChat(message *chatapipb.GoaChat) (err error) {
err = goa.MergeErrors(err, goa.ValidateFormat("message.PostDt", message.PostDt, goa.FormatDateTime))
return
} | [
-0.7632378935813904,
-0.4506784975528717,
0.6344983577728271,
-0.45679357647895813,
-0.2645474374294281,
1.341686725616455,
-0.3076893985271454,
-1.2250431776046753,
-1.8131643533706665,
0.23620617389678955,
0.41666096448898315,
-0.07574479281902313,
-0.09638532996177673,
1.300908923149108... |
func Reverse(src []byte) []byte {
dst := make([]byte, len(src))
for i := len(src); i > 0; i-- {
dst[len(src)-i] = src[i-1]
}
return dst
} | [
-0.7719258069992065,
0.8379286527633667,
0.7830204367637634,
-0.3362332880496979,
-0.4470125734806061,
-0.548671543598175,
-0.30181705951690674,
0.5850561261177063,
-0.4935361444950104,
0.044855620712041855,
-1.1538045406341553,
0.8566596508026123,
-0.6138485670089722,
-0.860983669757843,
... |
func reverseS(s string) (string, error) {
a := strings.Split(s, "")
sRev := ""
if len(a)%2 != 0 {
return "", fmt.Errorf("Incorrect input length")
}
for i := 0; i < len(a); i += 2 {
tmp := []string{a[i], a[i+1], sRev}
sRev = strings.Join(tmp, "")
}
return sRev, nil
} | [
-0.21356262266635895,
0.2510360777378082,
0.518548846244812,
-0.5607829689979553,
-0.21244879066944122,
-0.5358328819274902,
-0.23736223578453064,
0.31030943989753723,
0.16904248297214508,
-0.30608442425727844,
-0.25070586800575256,
0.7897905111312866,
-0.510053277015686,
-0.70340126752853... |
func ReverseToInt(s string) (int32, error) {
sRev, err := reverseS(s)
if err != nil {
return 0, err
}
i, err := strconv.ParseInt(sRev, 10, 32)
return int32(i), err
} | [
-0.06350063532590866,
-0.05333968251943588,
0.5229403972625732,
-1.6558197736740112,
-0.1998983919620514,
-0.17423845827579498,
0.12263239175081253,
-0.12356794625520706,
-1.0208667516708374,
0.06398491561412811,
-0.6744967103004456,
0.2271949201822281,
-0.7953277230262756,
-1.502361059188... |
func RevHash(hash string) string {
hashBytes, _ := hex.DecodeString(hash)
if len(hashBytes) < 32 {
return hash
}
newHash := make([]byte, 0)
for i := 28; i >= 0; i -= 4 {
newHash = append(newHash, hashBytes[i:i+4]...)
}
return hex.EncodeToString(newHash)
} | [
1.0788809061050415,
0.5113499164581299,
0.6314200758934021,
0.025318030267953873,
-0.38232284784317017,
0.42142778635025024,
-0.6684048175811768,
0.8593036532402039,
-0.26347362995147705,
-0.5055645704269409,
0.1949496567249298,
0.5509445667266846,
-0.6485806703567505,
-1.0068261623382568,... |
func DiffToTarget(diff float64, powLimit *big.Int) (*big.Int, error) {
if diff <= 0 {
return nil, fmt.Errorf("invalid pool difficulty %v (0 or less than "+
"zero passed)", diff)
}
// Round down in the case of a non-integer diff since we only support
// ints (unless diff < 1 since we don't allow 0)..
if diff ... | [
-1.7277570962905884,
-0.002309573581442237,
0.6086826324462891,
-0.4870930314064026,
-0.14381518959999084,
-0.1839226931333542,
0.8692612648010254,
-0.046088602393865585,
-0.05996173992753029,
-0.6357532739639282,
0.8598050475120544,
0.7139912247657776,
-0.3743566870689392,
-0.107695750892... |
func RolloverExtraNonce(v *uint32) {
if *v&0x00FFFFFF == 0x00FFFFFF {
*v = *v & 0xFF000000
} else {
*v++
}
} | [
-0.10874363780021667,
1.151148796081543,
0.6012178659439087,
-0.6667320132255554,
-0.31747469305992126,
-0.02228189818561077,
0.7128831148147583,
0.15603910386562347,
1.231154203414917,
0.6397817730903625,
-0.35791075229644775,
0.6294503211975098,
-0.8091683983802795,
0.1862635314464569,
... |
func Uint32EndiannessSwap(v uint32) uint32 {
return (v&0x000000FF)<<24 | (v&0x0000FF00)<<8 |
(v&0x00FF0000)>>8 | (v&0xFF000000)>>24
} | [
-1.1730375289916992,
0.6927688121795654,
0.7755692601203918,
-1.7761361598968506,
0.08252526819705963,
0.9817262887954712,
-0.8135194778442383,
0.3268461227416992,
0.5615658164024353,
-0.19503827393054962,
-0.037694428116083145,
0.36257457733154297,
-0.373430460691452,
-0.0713077113032341,... |
func FormatHashRate(h float64) string {
if h > 1000000000 {
return fmt.Sprintf("%.3fGH/s", h/1000000000)
} else if h > 1000000 {
return fmt.Sprintf("%.0fMH/s", h/1000000)
} else if h > 1000 {
return fmt.Sprintf("%.1fkH/s", h/1000)
} else if h == 0 {
return "0H/s"
}
return fmt.Sprintf("%.1f GH/s", h)
} | [
0.7999144196510315,
0.09533222764730453,
0.9552541375160217,
-0.3227940797805786,
-0.20083573460578918,
-0.5301798582077026,
-1.1342693567276,
-0.42688754200935364,
-0.3916756510734558,
0.49359431862831116,
1.6193585395812988,
-0.3846324384212494,
-0.402761846780777,
1.265378713607788,
1... |
func (c LightEmitter) Type() string { return ComponentTypeLightEmitter } | [
0.7243037223815918,
-0.7785441279411316,
-0.07279133051633835,
-0.2248908281326294,
0.7308105826377869,
0.6166264414787292,
0.27096468210220337,
-0.03868082910776138,
0.6012107729911804,
-0.6710476875305176,
-0.6595287919044495,
0.22628317773342133,
-0.5964613556861877,
1.4402326345443726,... |
func (c LightEmitter) GetTyped() interface{} {
return struct {
Type string
LightEmitter
}{
Type: c.Type(),
LightEmitter: c,
}
} | [
0.38627710938453674,
-0.5303246378898621,
0.39602580666542053,
-0.39868834614753723,
0.5857487916946411,
0.32598310708999634,
0.1311318725347519,
-0.6610076427459717,
0.43532219529151917,
-1.295318603515625,
-0.8296638131141663,
1.273445725440979,
-0.6355196833610535,
0.8124862313270569,
... |
func (i SetLightEmitterIntent) Type() string { return IntentTypeSetLightEmitter } | [
0.08452769368886948,
-0.8037826418876648,
-0.07613568753004074,
-0.05652032420039177,
0.18889234960079193,
0.6295115947723389,
0.15863794088363647,
-0.7100834250450134,
0.9313346147537231,
0.16354379057884216,
-0.022419001907110214,
0.8609828948974609,
-1.1278876066207886,
0.59253919124603... |
func (i SetLightEmitterIntent) GetTyped() interface{} {
return struct {
Type string
SetLightEmitterIntent
}{
Type: i.Type(),
SetLightEmitterIntent: i,
}
} | [
0.16334031522274017,
-0.5975977778434753,
0.3717944920063019,
-0.1956258863210678,
0.4350595474243164,
0.5150594711303711,
0.5519604682922363,
-0.9488816261291504,
1.0275962352752686,
-0.5900623202323914,
-0.4949544370174408,
1.6180449724197388,
-0.7658167481422424,
-0.17353451251983643,
... |
func NewHandler(mux *drpcmux.Mux, cb handlerFunc) *Handler {
if cb == nil {
cb = defaultHandlerFunc
}
return &Handler{
mux: mux,
cb: cb,
}
} | [
0.4301387369632721,
0.4971804916858673,
0.2469629943370819,
0.5377773642539978,
-0.8077791929244995,
-0.04209085553884506,
0.18739144504070282,
0.9418795704841614,
0.6391092538833618,
-0.8567960262298584,
0.6237888336181641,
0.2715449333190918,
-0.8516885042190552,
-0.8853715658187866,
0... |
func (handler *Handler) HandleRPC(stream drpc.Stream, rpc string) (err error) {
streamCtx := stream.Context()
metadata, ok := drpcmetadata.Get(streamCtx)
if ok {
trace, spanID := handler.cb(metadata)
defer mon.FuncNamed(rpc).RemoteTrace(&streamCtx, spanID, trace)(&err)
}
return handler.mux.HandleRPC(&streamWr... | [
1.0737104415893555,
-0.25229236483573914,
0.757354199886322,
-0.28181615471839905,
-0.6400516629219055,
0.8359625935554504,
0.03234221413731575,
-0.44223859906196594,
0.8976102471351624,
0.0995754525065422,
0.834733247756958,
0.24853640794754028,
-0.19666175544261932,
-0.5713924765586853,
... |
func TestSaveToDeckAndNewDeckFromFile(t *testing.T) {
os.Remove("_decktesting")
deck := newDeck()
deck.saveToFile("_decktesting")
loadedDeck := newDeckFromFile("_decktesting")
if len(loadedDeck) != 52 {
t.Errorf("Expected 52 decks in card, got %v", len(loadedDeck))
}
os.Remove("_decktesting")
} | [
0.09553855657577515,
0.6870564222335815,
0.49679699540138245,
-0.22914884984493256,
0.612414538860321,
0.4553406834602356,
0.5271454453468323,
0.192156583070755,
-0.1969631016254425,
-0.3923109769821167,
-0.6751207113265991,
-0.1076909601688385,
0.3268599510192871,
1.2673978805541992,
1.... |
func (c *AUTOSCALING) DisableScalingGroupCommonWithContext(ctx volcengine.Context, input *map[string]interface{}, opts ...request.Option) (*map[string]interface{}, error) {
req, out := c.DisableScalingGroupCommonRequest(input)
req.SetContext(ctx)
req.ApplyOptions(opts...)
return out, req.Send()
} | [
-1.0216048955917358,
0.31691232323646545,
0.24133513867855072,
0.4365352988243103,
-1.2640568017959595,
0.07936644554138184,
0.09611400216817856,
-0.8880639672279358,
-0.27967947721481323,
0.23174841701984406,
-0.10994216799736023,
-0.31051871180534363,
-1.88588547706604,
0.561176598072052... |
func (c *AUTOSCALING) DisableScalingGroupWithContext(ctx volcengine.Context, input *DisableScalingGroupInput, opts ...request.Option) (*DisableScalingGroupOutput, error) {
req, out := c.DisableScalingGroupRequest(input)
req.SetContext(ctx)
req.ApplyOptions(opts...)
return out, req.Send()
} | [
-1.0793901681900024,
0.17466802895069122,
0.026944594457745552,
0.45028018951416016,
-1.843491792678833,
-0.1133204996585846,
-0.2222660332918167,
-0.756834864616394,
0.007984654046595097,
-0.09798025339841843,
0.006662996951490641,
-0.043404463678598404,
-1.5058095455169678,
0.38664785027... |
func (s DisableScalingGroupInput) String() string {
return volcengineutil.Prettify(s)
} | [
0.47118133306503296,
0.03981941193342209,
-0.14635777473449707,
0.06298638880252838,
-0.9964227676391602,
0.7037438154220581,
0.4328618049621582,
-0.8181523680686951,
-0.8399231433868408,
0.37454190850257874,
0.3609941303730011,
0.030874889343976974,
-0.7974981069564819,
-0.191570580005645... |
func (s DisableScalingGroupInput) GoString() string {
return s.String()
} | [
-0.10291999578475952,
0.8328385949134827,
0.18338090181350708,
-0.021146029233932495,
-0.6222673654556274,
0.8769360184669495,
0.6371265053749084,
-0.36015424132347107,
-1.132959246635437,
0.3626669645309448,
0.015912991017103195,
-0.26525306701660156,
-1.1842228174209595,
-0.2163194268941... |
func (s *DisableScalingGroupInput) SetScalingGroupId(v string) *DisableScalingGroupInput {
s.ScalingGroupId = &v
return s
} | [
0.11882337927818298,
1.1372302770614624,
-0.6014981865882874,
0.7559599280357361,
-1.2768068313598633,
0.9799356460571289,
-0.5315694212913513,
0.6555318236351013,
-0.6011420488357544,
0.39083680510520935,
-0.19140030443668365,
-0.33027058839797974,
-0.9575943946838379,
1.0203214883804321,... |
func (s DisableScalingGroupOutput) String() string {
return volcengineutil.Prettify(s)
} | [
0.966288685798645,
-0.273043155670166,
-0.09542514383792877,
0.056840505450963974,
-1.204653024673462,
0.018618253991007805,
0.36917197704315186,
-0.8190551400184631,
-1.186543583869934,
0.3835303783416748,
0.5574753284454346,
-0.1855345070362091,
-0.33719566464424133,
-0.3264124393463135,... |
func (s DisableScalingGroupOutput) GoString() string {
return s.String()
} | [
0.24257348477840424,
0.4963354170322418,
0.22389449179172516,
-0.12890705466270447,
-0.7778007388114929,
0.35552340745925903,
0.5604023337364197,
-0.38629111647605896,
-1.4697664976119995,
0.3954293429851532,
0.07880878448486328,
-0.4373643696308136,
-0.7930102944374084,
-0.281734406948089... |
func (s *DisableScalingGroupOutput) SetScalingGroupId(v string) *DisableScalingGroupOutput {
s.ScalingGroupId = &v
return s
} | [
0.1283627450466156,
1.1287293434143066,
-0.5733000040054321,
0.6403768062591553,
-1.3481825590133667,
0.891892671585083,
-0.5846993923187256,
0.6118540167808533,
-0.6708587408065796,
0.4133762717247009,
-0.23543637990951538,
-0.38848310708999634,
-0.8853042125701904,
1.062955379486084,
0... |
func NewState() *State {
globals := newModule()
// Provide a self reference for use when declaring global script variables.
globals.modules.add("global", globals)
return &State{
global: globals,
Output: os.Stdout,
}
} | [
0.6038300395011902,
-0.06745357066392899,
0.609030544757843,
0.29875996708869934,
-0.47365227341651917,
-0.014932941645383835,
0.9570968747138977,
-0.24984291195869446,
-0.02997024916112423,
-0.13255061209201813,
0.3765658140182495,
1.0008052587509155,
-0.39145147800445557,
1.2105540037155... |
func (state *State) RegisterCommand(name string, handler NativeCommand) {
state.global.RegisterCommand(name, handler)
} | [
-0.7301028370857239,
0.005744969006627798,
0.3788171708583832,
0.09738346189260483,
0.7271118760108948,
0.9720118045806885,
-0.5988113880157471,
0.622674286365509,
-0.1917964071035385,
-0.8236375451087952,
-0.8052265644073486,
1.1194463968276978,
0.701985776424408,
0.8713029026985168,
-0... |
func (state *State) RegisterType(name string, typ ObjectFactory) {
state.global.RegisterType(name, typ)
} | [
-0.7501628398895264,
0.5242598056793213,
0.29783129692077637,
0.6346741914749146,
1.564144492149353,
0.23150542378425598,
-0.12521371245384216,
-0.424202024936676,
0.3691902160644531,
0.7975693941116333,
-1.287306308746338,
0.49341848492622375,
0.1717982292175293,
0.48909449577331543,
0.... |
func (state *State) RegisterModule(name string) *Module {
return state.global.RegisterModule(name)
} | [
-0.9901965856552124,
0.7966977953910828,
0.4534211754798889,
0.021670660004019737,
0.8052591681480408,
0.7722683548927307,
-0.19068586826324463,
-0.3376797139644623,
0.6758580207824707,
0.19604142010211945,
-0.7218404412269592,
1.020538091659546,
-0.03527712821960449,
0.1428641378879547,
... |
func (state *State) FetchModule(name string) *Module {
return state.global.FetchModule(name)
} | [
-0.11286498606204987,
0.12137661129236221,
0.33889466524124146,
0.07041418552398682,
-0.2147325873374939,
1.0538082122802734,
-0.2704527676105499,
-1.6486653089523315,
0.967244029045105,
0.7722018361091614,
0.08462563902139664,
1.2622498273849487,
0.7360227704048157,
-0.04116390272974968,
... |
func (state *State) FetchVariable(name string) (val *Value) {
defer func(){
if x := recover(); x != nil {
val = nil
}
}()
parts := strings.Split(name, ":")
if len(parts) < 2 {
return nil
}
mod := state.FetchModule(parts[0])
for i := range parts[1:len(parts) - 1] {
mod = mod.FetchModule(parts[i+1])
... | [
-0.5111569762229919,
-0.600575864315033,
0.6546878814697266,
-0.30414310097694397,
-1.0861010551452637,
-0.8411635756492615,
-0.4591303765773773,
-1.2760050296783447,
0.09210731089115143,
0.339973509311676,
-0.7669944763183594,
0.6328079700469971,
-0.3579145669937134,
-0.6276124715805054,
... |
func (state *State) Printf(format string, msg ...interface{}) {
fmt.Fprintf(state.Output, format, msg...)
} | [
0.003358326619490981,
-0.20407073199748993,
0.29581743478775024,
0.37314704060554504,
0.036318425089120865,
-0.7371287941932678,
0.2386011779308319,
-0.12744499742984772,
-0.7668300867080688,
-1.068135142326355,
0.5802148580551147,
0.014429958537220955,
0.501177966594696,
1.289202332496643... |
func (state *State) Println(msg ...interface{}) {
fmt.Fprintln(state.Output, msg...)
} | [
-0.1202595978975296,
-0.36669859290122986,
0.29178640246391296,
0.4538174569606781,
-0.26237714290618896,
-0.6309260129928589,
0.144241064786911,
-0.2144020050764084,
-0.5183686017990112,
-0.9702417254447937,
-0.18918247520923615,
-0.21929527819156647,
0.769191563129425,
1.097976803779602,... |
func (state *State) Print(msg ...interface{}) {
fmt.Fprint(state.Output, msg...)
} | [
-0.048111870884895325,
-0.21292324364185333,
0.2039320468902588,
0.253609299659729,
0.07212336361408234,
-0.3720296025276184,
-0.050144340842962265,
-0.6960615515708923,
-0.8490740656852722,
-1.1012505292892456,
0.37827906012535095,
-0.14889849722385406,
0.017588619142770767,
1.08272135257... |
func (state *State) CompileAndRun(code, filename string) (ret *Value, err error) {
script := NewScript()
val, err := state.CompileToValue(code, NewPosition(1, 1, filename))
if err != nil {
return
}
ret, err = state.Run(script, val)
return
} | [
-0.5704973340034485,
-0.9085847735404968,
0.5721584558486938,
0.6717333793640137,
-0.33791741728782654,
0.008360648527741432,
-0.017429908737540245,
0.45280003547668457,
-0.3864932656288147,
-0.17861631512641907,
-0.049166735261678696,
0.4470522701740265,
0.11563384532928467,
1.13227248191... |
func (state *State) Run(script *Script, code *Value) (ret *Value, err error) {
script.Host = state
err = nil
defer state.trapErrorRuntime(script, &err, script.ClearMost)
if code.Type != TypCode {
RaiseError("Attempt to run non-executable Value.")
}
block := code.Data.(*Code)
script.Locals.Add(state, block... | [
-0.7945501208305359,
0.2628526985645294,
0.5223000645637512,
0.17920055985450745,
-0.4084835946559906,
-0.1488766372203827,
0.2426859587430954,
-0.1850794404745102,
-0.14784812927246094,
0.346192866563797,
-0.9523454904556274,
0.587604284286499,
-0.4985509514808655,
0.3083451986312866,
0... |
func (state *State) RunShell(script *Script, code *Value) (ret *Value, err error) {
script.Host = state
err = nil
defer state.trapErrorRuntime(script, &err, script.ClearSome)
if code.Type != TypCode {
RaiseError("Attempt to run non-executable Value.")
}
block := code.Data.(*Code)
script.Locals.RemoveNoClea... | [
-0.6748644709587097,
0.29620665311813354,
0.628000795841217,
0.5555424094200134,
-0.7769262790679932,
0.20856629312038422,
-0.19702450931072235,
-0.3959006667137146,
-0.13132058084011078,
-0.062319207936525345,
-0.7044802308082581,
0.8714929223060608,
-0.14009983837604523,
0.61686652898788... |
func (state *State) RunPreped(script *Script, code *Code) (ret *Value, err error) {
script.Host = state
err = nil
defer state.trapErrorRuntime(script, &err, script.ClearMost)
script.Exec(code)
ret = script.RetVal
return
} | [
-1.1030850410461426,
0.26375681161880493,
0.7333989143371582,
0.11201583594083786,
-0.2030038982629776,
-0.3293631076812744,
0.1700236052274704,
-0.348467081785202,
0.2108447551727295,
-0.358652800321579,
-1.1173148155212402,
1.125693440437317,
0.19718590378761292,
0.4512998163700104,
1.... |
func (state *State) RunCommand(script *Script, code *Value, params []*Value) (ret *Value, err error) {
script.Host = state
err = nil
defer state.trapErrorRuntime(script, &err, script.ClearMost)
if code.Type != TypCode && code.Type != TypCommand {
RaiseError("Attempt to run non-executable Value.")
}
code.call... | [
-1.1414533853530884,
-0.18257781863212585,
0.6593788862228394,
0.4964885711669922,
0.318246454000473,
0.31760698556900024,
-0.13300229609012604,
-0.47620299458503723,
0.01848837360739708,
0.04938383027911186,
0.03672786429524422,
1.0923913717269897,
-0.32794007658958435,
0.5417093634605408... |
func (state *State) RunMinimal(script *Script, code *Code) (ret *Value, err error) {
script.Host = state
err = nil
defer state.trapErrorRuntime(script, &err, func(){})
script.Exec(code)
ret = script.RetVal
return
} | [
-1.4438976049423218,
-0.40690216422080994,
0.7400614619255066,
0.23525266349315643,
-0.5747025609016418,
-0.13481836020946503,
-0.9774223566055298,
-0.3807229697704315,
-0.5539485812187195,
-0.30527445673942566,
-0.5520397424697876,
0.6223361492156982,
-0.6341423392295837,
-0.1063053011894... |
func ParseVariadicArguments(
result map[string][]string, // provided result map
multKeys []string, // keys that may appear multiple times
uniqKeys []string, // keys that are allowed at most once
reqKeys []string, // keys that are required at least one
args []string, // arguments to parse
) error {
// used to hold... | [
-0.2966591715812683,
-0.2250427007675171,
0.8849169611930847,
-0.2735345661640167,
-0.44386276602745056,
-0.5134342908859253,
0.07539179921150208,
-0.389643132686615,
-0.6582248210906982,
0.9432911276817322,
-0.2360018789768219,
0.08182798326015472,
-0.3961264491081238,
0.6081130504608154,... |
func ParseVariadicCheckArguments(
result map[string][]string,
constraints []proto.CheckConfigConstraint,
thresholds []proto.CheckConfigThreshold,
args []string,
) error {
// used to hold found errors, so if three keywords are missing they can
// all be mentioned in one call
errors := []string{}
multiple := []s... | [
0.1479242891073227,
-0.43771466612815857,
0.7106373906135559,
0.21494334936141968,
-0.17776726186275482,
-0.29012709856033325,
-0.22713521122932434,
-0.5321729779243469,
-1.087761640548706,
0.9236171245574951,
-0.2798125743865967,
0.19185702502727509,
-0.4280236065387726,
-0.00222547398880... |
func VerifySingleArgument(c *cli.Context) error {
a := c.Args()
if !a.Present() {
return fmt.Errorf(`Syntax error, command requires argument`)
}
if len(a.Tail()) != 0 {
return fmt.Errorf(
"Syntax error, too many arguments (expected: 1, received %d)",
len(a.Tail())+1,
)
}
return nil
} | [
-0.027414102107286453,
1.049156904220581,
0.6162617802619934,
-0.05349718779325485,
1.2262766361236572,
0.5048266649246216,
0.28880712389945984,
-0.010836275294423103,
0.4201708734035492,
0.09969320893287659,
-0.7435924410820007,
1.2345606088638306,
-0.4035959541797638,
1.9660894870758057,... |
func VerifyNoArgument(c *cli.Context) error {
a := c.Args()
if a.Present() {
return fmt.Errorf(`Syntax error, command takes no arguments`)
}
return nil
} | [
0.006195904687047005,
0.33675137162208557,
0.1828601360321045,
-0.3868717551231384,
0.9258254766464233,
-0.040184251964092255,
-0.137257382273674,
-0.5403673648834229,
-0.1951635181903839,
-0.4006001353263855,
-0.6274514198303223,
1.2776669263839722,
-0.3229413628578186,
1.9879374504089355... |
func AllArguments(c *cli.Context) []string {
sl := []string{c.Args().First()}
sl = append(sl, c.Args().Tail()...)
return sl
} | [
0.6191650629043579,
-0.5955169200897217,
0.6901427507400513,
-0.5048012137413025,
0.6314995288848877,
0.6659664511680603,
-1.4714173078536987,
-0.2912500202655792,
-0.4027462899684906,
0.61775141954422,
0.7580980062484741,
1.2111799716949463,
-1.173775315284729,
0.9088965058326721,
-0.60... |
func sliceContainsString(s string, sl []string) bool {
for _, v := range sl {
if v == s {
return true
}
}
return false
} | [
0.3706551194190979,
-0.8643211126327515,
0.1331855058670044,
0.30000314116477966,
-0.44219091534614563,
-0.4170989990234375,
-0.4775380790233612,
-0.40759581327438354,
0.11548217386007309,
1.0749441385269165,
0.29539617896080017,
0.05769829452037811,
0.6248616576194763,
-0.2645426690578460... |
func checkStringNotAKeyword(s string, keys []string) error {
if sliceContainsString(s, keys) {
return fmt.Errorf("Syntax error, back-to-back keyword: %s", s)
}
return nil
} | [
0.12795385718345642,
-0.47133779525756836,
0.2886233329772949,
0.792415976524353,
-0.6389524936676025,
-0.2761005759239197,
-0.7968894839286804,
-0.18092481791973114,
-0.7300963401794434,
1.674971342086792,
0.6349878311157227,
0.8516718745231628,
-0.7858725190162659,
0.3794434070587158,
... |
func combineStrings(s ...string) string {
var out string
spacer := ``
for _, in := range s {
// ensure a single trailing .
out = fmt.Sprintf("%s%s", out+spacer, strings.TrimRight(in, `.`)+`.`)
spacer = "\n"
}
return out
} | [
0.2404821366071701,
-0.11733610928058624,
0.43931227922439575,
0.36404114961624146,
0.2070636749267578,
-0.3267124891281128,
-0.5085492730140686,
-0.23702125251293182,
-0.5128201246261597,
0.10964386910200119,
1.0114707946777344,
-0.26748791337013245,
0.12688599526882172,
-0.31436938047409... |
func parseThresholdChain(result proto.CheckConfigThreshold,
args []string) error {
tParse := make(map[string][]string)
if err := ParseVariadicArguments(
tParse,
[]string{},
[]string{`predicate`, `level`, `value`},
[]string{`predicate`, `level`, `value`},
args,
); err != nil {
return err
}
var err erro... | [
0.10386968404054642,
0.21144120395183563,
0.6224953532218933,
-0.4129859507083893,
0.4484321177005768,
-0.17468412220478058,
0.055141814053058624,
-0.7546020746231079,
-0.9507530331611633,
0.41072380542755127,
-0.8031988739967346,
0.25640347599983215,
-0.8913446664810181,
0.448160856962204... |
func parseConstraintChain(result proto.CheckConfigConstraint,
args []string) error {
result.ConstraintType = args[0]
switch result.ConstraintType {
case `service`:
result.Service = &proto.PropertyService{}
switch args[1] {
case `name`:
result.Service.Name = args[2]
default:
return fmt.Errorf("Syntax e... | [
-0.3101028800010681,
-0.651354968547821,
0.7819236516952515,
0.049324147403240204,
0.2143896073102951,
-0.2674150764942169,
-0.3691752851009369,
-0.8770999908447266,
-0.6581816673278809,
0.23382484912872314,
-0.12102106213569641,
0.28034719824790955,
-1.107013463973999,
-0.2504099607467651... |
func (sl *StaleList) AddAndCount(object interface{}) int {
sl.m.Lock()
defer sl.m.Unlock()
sl.items = append(sl.items, item{
added: time.Now(),
object: object,
})
return sl.count()
} | [
-0.9477532505989075,
-0.3627638518810272,
0.649703860282898,
-0.026567162945866585,
-0.6908495426177979,
0.48866304755210876,
-0.027392728254199028,
0.5085756778717041,
0.28230956196784973,
0.34134340286254883,
-1.0759469270706177,
-0.6889236569404602,
0.12095249444246292,
1.19320356845855... |
func (sl *StaleList) Count() int {
sl.m.Lock()
defer sl.m.Unlock()
return sl.count()
} | [
-0.340810626745224,
0.15357740223407745,
0.2476711869239807,
0.2686869502067566,
-0.6877962946891785,
0.480023056268692,
0.3684368133544922,
0.490697979927063,
-0.7184447646141052,
0.6405571103096008,
-1.3926063776016235,
-0.7653244733810425,
-0.61481112241745,
1.5883013010025024,
-0.422... |
func (task *InsertRecordsTask) Insert(records []wisply.Recorder) error {
err := task.insertRecords(records)
if err != nil {
task.hasProblems(err)
return err
}
number := strconv.Itoa(len(records))
task.Finish(number + " records inserted")
return nil
} | [
-0.9372562170028687,
0.9214252829551697,
0.549320638179779,
0.02316892147064209,
0.8897321224212646,
0.29050368070602417,
0.6356725096702576,
0.8920578360557556,
-0.31351372599601746,
0.8234521150588989,
-1.2706764936447144,
-0.7945327162742615,
-1.317243218421936,
0.8644812107086182,
0.... |
func (task *InsertRecordsTask) Clear() error {
ID := task.repository.ID
sql := "DELETE from `repository_resource` WHERE repository=?"
query, err := database.Connection.Prepare(sql)
if err != nil {
message := "Error while trying to clear the `repository_resource` table: <br />" + err.Error()
return errors.New(me... | [
-0.19697891175746918,
1.016366958618164,
0.6537463665008545,
-0.42872703075408936,
-0.039108894765377045,
0.13987712562084198,
0.10431545227766037,
0.6202611923217773,
-1.135049819946289,
1.173293113708496,
0.7254763841629028,
0.32010695338249207,
0.2842654585838318,
1.0804694890975952,
... |
func (task *InsertRecordsTask) insertTitles(record *wisply.Recorder) error {
var keys = (*record).GetKeys()
err := task.insertKeys(record, keys.GetTitles(), "title")
if err != nil {
return err
}
err = task.insertKeys(record, keys.GetCreators(), "creator")
if err != nil {
return err
}
err = task.insertKeys... | [
-0.45444974303245544,
0.6890842318534851,
1.083055853843689,
-0.5727781057357788,
-0.25369247794151306,
-0.07952523231506348,
0.030179524794220924,
0.2946605384349823,
-0.8264514803886414,
0.5526770949363708,
-1.0910634994506836,
-0.7590590715408325,
-0.7160576581954956,
0.8657180070877075... |
func (task *UpdateNumberOfRecordsTask) Perform() error {
err := task.update()
if err != nil {
task.hasProblems(err)
return err
}
task.Finish("The number of records has been updated")
return err
} | [
-0.3116317391395569,
0.3864293694496155,
0.7455437183380127,
-0.12674620747566223,
0.6006711721420288,
-0.43323445320129395,
0.5130365490913391,
0.9299816489219666,
-0.6364973783493042,
0.738987922668457,
0.07448261231184006,
-0.3478931784629822,
-0.22269579768180847,
-0.03079370968043804,... |
func (m *GitRepoMeta) GetTickRange(t int) (time.Time, time.Time) {
real := time.Duration(m.TickSize) * time.Hour
return m.First.Add(real * time.Duration(t)),
m.First.Add(real * (time.Duration(t) + 1))
} | [
-0.39726686477661133,
0.39219745993614197,
0.3683743178844452,
-0.10554506629705429,
0.419035941362381,
-0.25460997223854065,
0.15034891664981842,
-0.035507816821336746,
-1.5356084108352661,
0.5579249858856201,
-0.7783944010734558,
-0.26556500792503357,
-0.14797373116016388,
0.890045523643... |
func NewGitAnalyser(
l *zap.SugaredLogger,
repo *gogit.Repository,
opts GitRepoAnalyserOptions,
) (*GitRepoAnalyser, error) {
var pipe = hercules.NewPipeline(repo)
pipe.PrintActions = false
pipe.DumpPlan = false
if opts.TickCount == 0 {
opts.TickCount = 600
}
// get time of first commit, to calculate relati... | [
-0.051456376910209656,
0.34144651889801025,
0.8205150365829468,
-1.1435227394104004,
-0.1989472508430481,
-1.0201908349990845,
0.0239669568836689,
-0.25454986095428467,
-0.6353580355644226,
0.11713949590921402,
-0.199618861079216,
-0.051405780017375946,
0.003808126086369157,
0.703524589538... |
func (g *GitRepoAnalyser) Analyze() (*GitRepoReport, error) {
// set up pipe
var (
start = time.Now()
burnItem = g.burndown()
couplingItem = g.coupling()
)
// execute analysis
results, err := g.exec()
if err != nil {
return nil, err
}
// collect results
var (
people = g.facts[hercules... | [
-0.06864309310913086,
0.1366332620382309,
0.6237905621528625,
-0.25771960616111755,
1.053694725036621,
-0.833776593208313,
0.45757225155830383,
-0.21267274022102356,
-0.6608385443687439,
-0.22041049599647522,
0.3258206844329834,
-0.2178797721862793,
-0.8579450249671936,
0.33754393458366394... |
func (self *Apn) SignUp(rw web.ResponseWriter, req *web.Request) {
okPacket := &packet.OkPacket{}
if req.Method != "POST" {
log.Error("signUp must be post request")
Fail(rw)
return
}
body, err := ioutil.ReadAll(req.Body)
if err != nil {
log.Error("read request error", err)
Fail(rw)
return
}
signIn... | [
-0.9451910853385925,
0.342550665140152,
1.2999682426452637,
0.38070207834243774,
-0.5063681602478027,
0.07390433549880981,
-0.11218712478876114,
-0.2517103850841522,
1.1965632438659668,
0.20638135075569153,
-0.9218389391899109,
-0.004708802793174982,
-0.04532246291637421,
-0.05327875912189... |
func (self *Apn) GetVerificationCode(rw web.ResponseWriter, req *web.Request) {
if req.Method != "POST" {
log.Error("signUp must be post request")
Fail(rw)
return
}
remoteIP, _ := xstring.CheckIpAndPort(req.RemoteAddr)
if !security.CheckIpValid(remoteIP, 10) {
Success(rw)
rw.Write(xjson.Encode(packet.Ok... | [
-0.3622860312461853,
0.7191944122314453,
1.106489658355713,
0.7008413672447205,
0.6643600463867188,
-0.47911202907562256,
-0.1843901425600052,
-0.21230189502239227,
0.33077433705329895,
0.5340017080307007,
-0.37823325395584106,
0.850805938243866,
-0.35989782214164734,
1.1210218667984009,
... |
func (self *Apn) ResetPassword(rw web.ResponseWriter, req *web.Request) {
if req.Method != "POST" {
Fail(rw)
return
}
okPacket := &packet.OkPacket{}
body, err := ioutil.ReadAll(req.Body)
if err != nil {
log.Error("read request error", err)
Fail(rw)
return
}
modifyPacket := &SignInUp{}
err = json.Un... | [
-1.0222827196121216,
0.08727684617042542,
0.8983803391456604,
0.6488262414932251,
0.11898443102836609,
-0.30823543667793274,
0.26160839200019836,
0.3269703686237335,
0.6975052356719971,
0.7218070030212402,
-0.23005828261375427,
0.6141631007194519,
-0.8212909698486328,
0.26284468173980713,
... |
func (d DockerUtil) CreateExec(id string, cmd []string, in, out, err bool) (*dc.Exec, error) {
config := dc.CreateExecOptions{
Tty: true,
Cmd: cmd,
Container: id,
AttachStdin: in,
AttachStdout: out,
AttachStderr: err,
}
return Client.CreateExec(config)
} | [
0.14791752398014069,
0.04305912181735039,
0.4742833971977234,
0.6824977397918701,
0.41648605465888977,
0.23566147685050964,
-0.814788281917572,
-1.2267652750015259,
-0.32574573159217834,
-0.1821954995393753,
0.3126751780509949,
-0.028931403532624245,
0.1901302933692932,
0.5167087316513062,... |
func (d DockerUtil) RunExec(exec *dc.Exec, in io.Reader, out io.Writer, err io.Writer) (*dc.ExecInspect, error) {
e := Client.StartExec(exec.ID, dc.StartExecOptions{
Tty: true,
InputStream: in,
OutputStream: out,
ErrorStream: err,
RawTerminal: true,
})
if e != nil {
return nil, e
}
return C... | [
-0.5270830392837524,
-0.03916020318865776,
0.5713697671890259,
0.2691030502319336,
-0.39370378851890564,
-0.6029648780822754,
0.06361960619688034,
-0.35468539595603943,
-0.24711601436138153,
-0.009348602034151554,
0.11448579281568527,
0.722375214099884,
0.13188457489013672,
-0.489783257246... |
func (ti *TimeIndex) Notify(blobs ...*blob.Blob) {
ti.lock.Lock()
defer ti.lock.Unlock()
for _, b := range blobs {
tp := b.Type()
if tp == blob.NoType || tp == blob.Object {
continue
}
t, err := b.Timestamp()
if err != nil {
continue
}
ti.entries = append(ti.entries, &ti... | [
-0.07711994647979736,
-0.057551316916942596,
0.37716183066368103,
0.6592019200325012,
0.9807962775230408,
0.2564505636692047,
-0.08367989212274551,
-0.254597932100296,
-0.4262527823448181,
1.6841825246810913,
-0.732128918170929,
0.20911535620689392,
-0.33170774579048157,
0.9346701502799988... |
func (ti *TimeIndex) GetIter(req *http.Request) (it index.Iter, err error) {
data, err := ioutil.ReadAll(req.Body)
if err != nil {
return nil, errors.New("timeindex: badly formed query request")
}
var r Request
err = json.Unmarshal(data, &r)
if err != nil {
return nil, errors.New("timeindex: badly... | [
-1.4610782861709595,
0.5925815105438232,
0.6612856984138489,
-0.7205379009246826,
-0.278730571269989,
0.46420812606811523,
0.2987836003303528,
-1.2043437957763672,
-0.311761736869812,
1.1916842460632324,
1.1434710025787354,
-0.22852371633052826,
-0.21049785614013672,
0.2772939205169678,
... |
func (ti *TimeIndex) Len() int {
ti.lock.RLock()
defer ti.lock.RUnlock()
return len(ti.entries)
} | [
-0.3826999068260193,
0.12754814326763153,
-0.02042367123067379,
-0.7123514413833618,
0.37322017550468445,
-0.19766972959041595,
1.003719687461853,
0.23909735679626465,
-0.5897757411003113,
0.43073293566703796,
-0.6715773940086365,
0.17010878026485443,
-0.20682549476623535,
-0.2418692409992... |
func (ti *TimeIndex) RefAt(i int) (ref string) {
defer func() {
if r := recover(); r != nil {
ref = ""
}
}()
ti.lock.RLock()
defer ti.lock.RUnlock()
return ti.entries[i].ref
} | [
-0.3476482629776001,
0.04819950461387634,
0.5124903321266174,
-1.1824227571487427,
-0.21740108728408813,
0.3606488108634949,
0.3947050869464874,
-2.2815120220184326,
-0.08058905601501465,
0.8269615769386292,
0.5389635562896729,
-0.8011922836303711,
-0.5361958146095276,
-0.43641138076782227... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.