query
stringlengths
7
3.85k
document
stringlengths
11
430k
metadata
dict
negatives
listlengths
0
101
negative_scores
listlengths
0
101
document_score
stringlengths
3
10
document_rank
stringclasses
102 values
TestExecute feeds input to the CLI and validates results. scan() is implicitly tested here.
func TestExecute(t *testing.T) { fmt.Println("TestExecute start") var inputSource *bytes.Buffer ipTest := []IPTest{ {"127.0.0.1", "9999", 1, 1}, {"8.8.8.8", "443", 1, 0}, {"::1", "9999", 1, 1}, {"127.0.0.1 ::1", "9999", 2, 2}} for _, v := range ipTest { inputSource = bytes.NewBuffer([]byte(fmt.Sprintf("setport %s\n", v.port))) runCLI(inputSource) inputSource = bytes.NewBuffer([]byte("setips " + v.ips + "\n")) runCLI(inputSource) inputSource = bytes.NewBuffer([]byte("execute\n")) runCLI(inputSource) inputSource = bytes.NewBuffer([]byte("results\n")) runCLI(inputSource) errors := 0 for j := 0; j < len(results); j++ { if results[j].Error != nil && *results[j].Error != scan.NoError { errors++ } } if len(results) != v.expectedResults || errors != v.expectedErrors { t.Errorf("Unexpected scan results for IPs: %s, results: %+v", v.ips, results) } } fmt.Println("TestExecute done") }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func (c *testComamnd) Execute() {\n\n\t// Parse subcommand args first.\n\tif len(os.Args) < 4 {\n\t\tfmt.Println(\"test command require <apiName:apiVersion> <testEndpoint> <runner> args\")\n\t\tos.Exit(1)\n\t}\n\n\tserviceRef := os.Args[2]\n\ttestEndpoint := os.Args[3]\n\trunnerType := os.Args[4]\n\n\t// Validate ...
[ "0.66738474", "0.61816204", "0.61401296", "0.6130477", "0.61267704", "0.6054782", "0.60366654", "0.5880252", "0.58619845", "0.5850724", "0.581697", "0.5810173", "0.5746905", "0.57246107", "0.57229185", "0.57181555", "0.5695352", "0.56370866", "0.56357914", "0.5620503", "0.560...
0.7561027
0
CreateTilesetSource creates a new tileset source. This function simply calls PutTilesetSource. The provided JSON path should point to a file containing one GeoJSON feature object per line.
func (c *Client) CreateTilesetSource(ctx context.Context, tilesetID string, jsonReader io.Reader) (NewTilesetSourceResponse, error) { return c.PutTilesetSource(ctx, tilesetID, jsonReader) }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func (c *Client) PutTilesetSource(ctx context.Context, tilesetID string, jsonReader io.Reader) (NewTilesetSourceResponse, error) {\n\turl := baseURL +\n\t\t\"/tilesets/v1/sources/\" + c.username + \"/\" + tilesetID +\n\t\t\"?access_token=\" + c.accessToken\n\n\tvar jsonResp NewTilesetSourceResponse\n\tresp, err :=...
[ "0.6848556", "0.55987674", "0.5551357", "0.5504878", "0.52943933", "0.48837715", "0.48816705", "0.48532996", "0.4792988", "0.47518417", "0.4721573", "0.4709976", "0.45843259", "0.45751652", "0.45683601", "0.45579433", "0.4538929", "0.447754", "0.44282672", "0.44276345", "0.44...
0.7586447
0
PutTilesetSource replaces a tileset source with new data, or creates a new tileset source if it does not already exist. The provided path should point to a file containing one GeoJSON feature object per line.
func (c *Client) PutTilesetSource(ctx context.Context, tilesetID string, jsonReader io.Reader) (NewTilesetSourceResponse, error) { url := baseURL + "/tilesets/v1/sources/" + c.username + "/" + tilesetID + "?access_token=" + c.accessToken var jsonResp NewTilesetSourceResponse resp, err := putMultipart(ctx, c.httpClient, url, "filenamedoesntmatter", jsonReader) if err != nil { return jsonResp, fmt.Errorf("upload %w failed, %v", ErrOperation, err) } if resp.StatusCode != http.StatusOK { return jsonResp, fmt.Errorf("upload %w failed, non-200 response: %v", ErrOperation, resp.StatusCode) } if err = json.NewDecoder(resp.Body).Decode(&jsonResp); err != nil { return jsonResp, fmt.Errorf("%w failed, err: %v", ErrParse, err) } return jsonResp, nil }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func (c *Client) CreateTilesetSource(ctx context.Context, tilesetID string, jsonReader io.Reader) (NewTilesetSourceResponse, error) {\n\treturn c.PutTilesetSource(ctx, tilesetID, jsonReader)\n}", "func (f *File) SetSource(source []string) {\n\tf.mutex.Lock()\n\tf.source = source\n\tf.mutex.Unlock()\n}", "func ...
[ "0.6059684", "0.5351458", "0.5199152", "0.5056169", "0.5014092", "0.5001283", "0.5000093", "0.49824324", "0.49708128", "0.4796271", "0.47573808", "0.47215167", "0.46444505", "0.46420372", "0.46308562", "0.46213987", "0.4595381", "0.45926014", "0.45886418", "0.45883557", "0.45...
0.7761068
0
ParseHclInterface is used to convert an interface value representing a hcl2 body and return the interpolated value. Vars may be nil if there are no variables to interpolate.
func ParseHclInterface(val interface{}, spec hcldec.Spec, vars map[string]cty.Value) (cty.Value, hcl.Diagnostics, []error) { evalCtx := &hcl.EvalContext{ Variables: vars, Functions: GetStdlibFuncs(), } // Encode to json var buf bytes.Buffer enc := codec.NewEncoder(&buf, structs.JsonHandle) err := enc.Encode(val) if err != nil { // Convert to a hcl diagnostics message errorMessage := fmt.Sprintf("Label encoding failed: %v", err) return cty.NilVal, hcl.Diagnostics([]*hcl.Diagnostic{{ Severity: hcl.DiagError, Summary: "Failed to encode label value", Detail: errorMessage, }}), []error{errors.New(errorMessage)} } // Parse the json as hcl2 hclFile, diag := hjson.Parse(buf.Bytes(), "") if diag.HasErrors() { return cty.NilVal, diag, formattedDiagnosticErrors(diag) } value, decDiag := hcldec.Decode(hclFile.Body, spec, evalCtx) diag = diag.Extend(decDiag) if diag.HasErrors() { return cty.NilVal, diag, formattedDiagnosticErrors(diag) } return value, diag, nil }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func (cv *ConVar) Interface() (interface{}, error) {\n\treturn cv.value.Load(), nil\n}", "func (c *opticsCollector) ParseInterfaces(output string) ([]string, error) {\n\titems := []string{}\n\tifNameRegexp := regexp.MustCompile(`name=(.*) default-name`)\n\n\tmatches := ifNameRegexp.FindAllStringSubmatch(output, ...
[ "0.55795044", "0.51478267", "0.49027494", "0.47865677", "0.47764078", "0.47680923", "0.47650835", "0.47002855", "0.46863744", "0.4685422", "0.4671812", "0.45863968", "0.45840946", "0.45613533", "0.45384187", "0.45297757", "0.45211256", "0.45093277", "0.4499774", "0.4471015", ...
0.7099388
0
GetStdlibFuncs returns the set of stdlib functions.
func GetStdlibFuncs() map[string]function.Function { return map[string]function.Function{ "abs": stdlib.AbsoluteFunc, "coalesce": stdlib.CoalesceFunc, "concat": stdlib.ConcatFunc, "hasindex": stdlib.HasIndexFunc, "int": stdlib.IntFunc, "jsondecode": stdlib.JSONDecodeFunc, "jsonencode": stdlib.JSONEncodeFunc, "length": stdlib.LengthFunc, "lower": stdlib.LowerFunc, "max": stdlib.MaxFunc, "min": stdlib.MinFunc, "reverse": stdlib.ReverseFunc, "strlen": stdlib.StrlenFunc, "substr": stdlib.SubstrFunc, "upper": stdlib.UpperFunc, } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func GetAllBuiltinFunctions() []*BuiltinFunction {\n\treturn append([]*BuiltinFunction{}, builtinFuncs...)\n}", "func GetFunctions() []string {\n\tout := make([]string, len(flist))\n\tcopy(out, flist)\n\treturn out\n}", "func (l *AuthFuncListSafe) GetFuncs() []AuthFuncInstance {\n\tret := make([]AuthFuncInstan...
[ "0.63339674", "0.6039668", "0.53328764", "0.5229742", "0.5211273", "0.52095956", "0.5207862", "0.5121755", "0.50890034", "0.50581", "0.50204414", "0.49949664", "0.4971435", "0.48926392", "0.48742077", "0.48575658", "0.48225898", "0.48183826", "0.48023942", "0.47667244", "0.47...
0.8931685
0
TODO: update hcl2 library with better diagnostics formatting for streamed configs should be arbitrary labels not JSON should not print diagnostic subject
func formattedDiagnosticErrors(diag hcl.Diagnostics) []error { var errs []error for _, d := range diag { if d.Summary == "Extraneous JSON object property" { d.Summary = "Invalid label" } err := fmt.Errorf("%s: %s", d.Summary, d.Detail) errs = append(errs, err) } return errs }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func livenessprintcfg(lv *Liveness) {\n\tfor _, bb := range lv.cfg {\n\t\tlivenessprintblock(lv, bb)\n\t}\n}", "func sessionConfigurationPayloadDisplay(data *messages.SignalConfigs) {\n\tvar result string = \"\\n\"\n\tresult += fmt.Sprintf(\" \\\"%s\\\": %d\\n\", \"session-id\", data.MitigatingConfig.SessionId...
[ "0.5392613", "0.52665323", "0.5203146", "0.517607", "0.5156359", "0.5143609", "0.5123836", "0.5108068", "0.51062155", "0.505844", "0.5052689", "0.50522065", "0.49690512", "0.49609175", "0.49579698", "0.4954872", "0.49535882", "0.4927243", "0.49067572", "0.49041545", "0.487644...
0.49092495
18
KindFromSides determine which can of triangule is the three dots it recieves as an argument.
func KindFromSides(a, b, c float64) Kind { t := []float64{a, b, c} sort.Float64s(t) for _, value := range t { if value <= 0 || math.IsNaN(value) || math.IsInf(value, 0) { return NaT } } if t[2] > t[1]+t[0] { return NaT } if t[0] == t[1] && t[1] == t[2] { return Equ } if t[0] == t[1] || t[1] == t[2] { return Iso } if t[0] != t[1] && t[1] != t[2] && t[2] != t[0] { return Sca } return NaT }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func KindFromSides(a, b, c float64) Kind {\n\thasValidSides := isValidLength(a) && isValidLength(b) && isValidLength(c)\n\tviolatesTriangleInequality := a > b+c || b > a+c || c > a+b\n\tif !hasValidSides || violatesTriangleInequality {\n\t\treturn NaT\n\t}\n\tif a == b && b == c {\n\t\treturn Equ\n\t}\n\tif a == b...
[ "0.7428459", "0.7388428", "0.7368537", "0.73600346", "0.73186207", "0.72892696", "0.7226378", "0.72238153", "0.7183931", "0.7165797", "0.7119315", "0.706905", "0.7056189", "0.70155865", "0.7012035", "0.69348544", "0.6934534", "0.6876252", "0.6867299", "0.6852648", "0.68488026...
0.66230834
25
NewSimpleController create an instance of Controller
func NewSimpleController(cfg *Config, crd CRD, handler Handler) Controller { if cfg == nil { cfg = &Config{} } cfg.setDefaults() // queue queue := workqueue.NewRateLimitingQueue(workqueue.DefaultControllerRateLimiter()) resourceEventHandlerFuncs := cache.ResourceEventHandlerFuncs{ AddFunc: func(obj interface{}) { key, err := cache.MetaNamespaceKeyFunc(obj) if err == nil { queue.Add(key) } }, UpdateFunc: func(old interface{}, new interface{}) { key, err := cache.MetaNamespaceKeyFunc(new) if err == nil { queue.Add(key) } }, DeleteFunc: func(obj interface{}) { // IndexerInformer uses a delta queue, therefore for deletes we have to use this // key function. key, err := cache.DeletionHandlingMetaNamespaceKeyFunc(obj) if err == nil { queue.Add(key) } }, } // indexer and informer indexer, informer := cache.NewIndexerInformer( crd.GetListerWatcher(), crd.GetObject(), 0, resourceEventHandlerFuncs, cache.Indexers{}) // Create the SimpleController Instance return &SimpleController{ cfg: cfg, informer: informer, indexer: indexer, queue: queue, handler: handler, } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func NewController() *Controller {\n controller := Controller{}\n\n return &controller\n}", "func NewController() *Controller {\n\treturn &Controller{wrapper: NewWrapper()}\n}", "func NewController() Controller {\n\treturn &controller{}\n}", "func New() *Controller {\n\treturn &Controller{}\n}", "func Ne...
[ "0.8268421", "0.76750875", "0.76736444", "0.75587475", "0.7557911", "0.75288594", "0.7517306", "0.75066286", "0.74756855", "0.74221504", "0.7381676", "0.7372851", "0.7335539", "0.7329626", "0.7297026", "0.72962", "0.72910386", "0.728513", "0.72847664", "0.72808325", "0.727743...
0.67023987
76
Run will list and watch the resources and then process them.
func (c *SimpleController) Run(stopper <-chan struct{}) error { defer runtime.HandleCrash() defer c.queue.ShutDown() fmt.Println(c.cfg.Name, " Starts...") go c.informer.Run(stopper) if !cache.WaitForCacheSync(stopper, c.informer.HasSynced) { runtime.HandleError(fmt.Errorf("Timed out waiting for caches to sync")) return nil } for i := 0; i < c.cfg.ConcurrentWorkers; i++ { go wait.Until(c.runWorker, time.Second, stopper) } <-stopper fmt.Printf("Stopping controller") return nil }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func (c *client) Run() {\n\tstream, err := c.client.ListAndWatch(context.Background(), &api.Empty{})\n\tif err != nil {\n\t\tklog.ErrorS(err, \"ListAndWatch ended unexpectedly for device plugin\", \"resource\", c.resource)\n\t\treturn\n\t}\n\n\tfor {\n\t\tresponse, err := stream.Recv()\n\t\tif err != nil {\n\t\t\t...
[ "0.6950651", "0.67211396", "0.66870356", "0.66390353", "0.651078", "0.6471139", "0.64108497", "0.62734497", "0.62452585", "0.6224909", "0.6221336", "0.6209296", "0.6180416", "0.6116038", "0.6105096", "0.60590774", "0.60429734", "0.6036074", "0.6018043", "0.59669805", "0.59618...
0.0
-1
GetUserList returns a list of Users
func GetUserList(w http.ResponseWriter, r *http.Request) { users, err := user.GetUserList(r) if err != nil { httpext.AbortAPI(w, err.Error(), http.StatusInternalServerError) return } httpext.SuccessDataAPI(w, "Ok", users) }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func (c *UsersClient) List(ctx context.Context, filter string) (*[]models.User, int, error) {\n\tparams := url.Values{}\n\tif filter != \"\" {\n\t\tparams.Add(\"$filter\", filter)\n\t}\n\tresp, status, _, err := c.BaseClient.Get(ctx, base.GetHttpRequestInput{\n\t\tValidStatusCodes: []int{http.StatusOK},\n\t\tUri: ...
[ "0.8061143", "0.80199534", "0.7991874", "0.79858255", "0.7920047", "0.79061973", "0.77202743", "0.7713175", "0.7689258", "0.76788044", "0.7641432", "0.7624448", "0.7622708", "0.7591941", "0.7590967", "0.7556658", "0.7533012", "0.7503844", "0.7492885", "0.748036", "0.74627477"...
0.7878952
6
CreateUser creates a user
func CreateUser(w http.ResponseWriter, r *http.Request) { decoder := json.NewDecoder(r.Body) var update models.User err := decoder.Decode(&update) u, err := user.CreateUser(update, r) if err != nil { httpext.AbortAPI(w, err.Error(), http.StatusInternalServerError) return } httpext.SuccessDataAPI(w, "Ok", u) }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func CreateUser(w http.ResponseWriter, r *http.Request) {\n\trequestBody, err := ioutil.ReadAll(r.Body)\n\tif err != nil {\n\t\tlog.Fatal(\"Error\")\n\t}\n\n\tvar user models.User\n\tif err = json.Unmarshal(requestBody, &user); err != nil {\n\t\tlog.Fatal(\"Error\")\n\t}\n\n\tdb, err := database.OpenDbConnection()...
[ "0.8186667", "0.8070818", "0.80625784", "0.8019643", "0.79885554", "0.7908014", "0.7880015", "0.7873839", "0.7863846", "0.7861369", "0.7836062", "0.7825336", "0.78246564", "0.782047", "0.7802029", "0.7778561", "0.7754207", "0.7750743", "0.77495056", "0.7747591", "0.77408284",...
0.7953747
5
GetUser returns a user
func GetUser(w http.ResponseWriter, r *http.Request) { httpext.SuccessAPI(w, "ok") }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func GetUser(c *gin.Context) *models.User {\n\tuser, _, _ := cookies.CurrentUser(c)\n\tif user == nil {\n\t\treturn &models.User{}\n\t}\n\treturn user\n}", "func GetUser(id int) (components.User, error) {\n\treturn getUser(id)\n}", "func GetUser(r *http.Request, db *gorm.DB) (User, error) {\n\t// Retrieve the ...
[ "0.8062321", "0.8035611", "0.7954273", "0.79248595", "0.78996885", "0.7898914", "0.7882361", "0.78709865", "0.7867528", "0.78379095", "0.78259015", "0.7816404", "0.7814401", "0.7807357", "0.77910733", "0.7782622", "0.777936", "0.7777736", "0.77773476", "0.7764939", "0.7760323...
0.0
-1
UpdateUser updates a user
func UpdateUser(w http.ResponseWriter, r *http.Request) { decoder := json.NewDecoder(r.Body) var update models.User err := decoder.Decode(&update) u, err := user.UpdateUser(update, r) if err != nil { httpext.AbortAPI(w, err.Error(), http.StatusInternalServerError) return } httpext.SuccessDataAPI(w, "Ok", u) }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func updateUser(c *gin.Context) {\n\tvar user user\n\tuserID := c.Param(\"id\")\n\n\tdb.First(&user, userID)\n\n\tif user.Id == 0 {\n\t\tc.JSON(http.StatusNotFound, gin.H{\"status\": http.StatusNotFound, \"message\": \"No user found!\"})\n\t\treturn\n\t}\n\n\tdb.Model(&user).Update(\"login\", c.PostForm(\"login\")...
[ "0.81026113", "0.80925", "0.8079478", "0.8026077", "0.80224335", "0.79828835", "0.7959214", "0.79233134", "0.7879859", "0.78727734", "0.7851507", "0.7851014", "0.7847162", "0.7837235", "0.7834976", "0.78338504", "0.7829921", "0.7805386", "0.7763033", "0.7750823", "0.7749645",...
0.78768617
9
DeleteUser deletes a user
func DeleteUser(w http.ResponseWriter, r *http.Request) { httpext.SuccessAPI(w, "ok") }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func DeleteUser(db *gorm.DB, w http.ResponseWriter, r *http.Request) {\n\tvars := mux.Vars(r)\n\n\tid := vars[\"id\"]\n\tuser := getUserByID(db, id, w, r)\n\tif user == nil {\n\t\treturn\n\t}\n\tif err := db.Delete(&user).Error; err != nil {\n\t\tRespondError(w, http.StatusInternalServerError, \"\")\n\t\treturn\n\...
[ "0.82981205", "0.82952017", "0.82247216", "0.82235473", "0.8219142", "0.8207494", "0.8198762", "0.8190993", "0.8171767", "0.8157415", "0.81248444", "0.81179225", "0.8099745", "0.8091513", "0.8079702", "0.8063075", "0.80567044", "0.8046376", "0.8039773", "0.8031342", "0.803044...
0.8223412
4
New creates a new kubernetes executor.
func New(config Config) *KubernetesExecutor { k := &KubernetesExecutor{ kl: config.Kubelet, updateChan: config.Updates, state: disconnectedState, tasks: make(map[string]*kuberTask), pods: make(map[string]*api.Pod), sourcename: config.SourceName, client: config.APIClient, done: make(chan struct{}), outgoing: make(chan func() (mesos.Status, error), 1024), dockerClient: config.Docker, suicideTimeout: config.SuicideTimeout, kubeletFinished: config.KubeletFinished, suicideWatch: &suicideTimer{}, shutdownAlert: config.ShutdownAlert, exitFunc: config.ExitFunc, podStatusFunc: config.PodStatusFunc, initialRegComplete: make(chan struct{}), staticPodsConfigPath: config.StaticPodsConfigPath, } // watch pods from the given pod ListWatch _, k.podController = framework.NewInformer(config.PodLW, &api.Pod{}, podRelistPeriod, &framework.ResourceEventHandlerFuncs{ AddFunc: func(obj interface{}) { pod := obj.(*api.Pod) log.V(4).Infof("pod %s/%s created on apiserver", pod.Namespace, pod.Name) k.handleChangedApiserverPod(pod) }, UpdateFunc: func(oldObj, newObj interface{}) { pod := newObj.(*api.Pod) log.V(4).Infof("pod %s/%s updated on apiserver", pod.Namespace, pod.Name) k.handleChangedApiserverPod(pod) }, DeleteFunc: func(obj interface{}) { pod := obj.(*api.Pod) log.V(4).Infof("pod %s/%s deleted on apiserver", pod.Namespace, pod.Name) }, }) return k }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func New(kl *kubelet.Kubelet, ch chan<- interface{}, ns string, cl *client.Client, w watch.Interface, dc dockertools.DockerInterface) *KubernetesExecutor {\n\t//TODO(jdef) do something real with these events..\n\tevents := w.ResultChan()\n\tif events != nil {\n\t\tgo func() {\n\t\t\tfor e := range events {\n\t\t\t...
[ "0.7574625", "0.67831236", "0.66792846", "0.66372824", "0.64599377", "0.630048", "0.621054", "0.61618245", "0.6161271", "0.6128888", "0.6096378", "0.6083967", "0.5987379", "0.5985418", "0.5979721", "0.59648883", "0.5938002", "0.59062034", "0.5869973", "0.5864622", "0.5853556"...
0.729702
1
Registered is called when the executor is successfully registered with the slave.
func (k *KubernetesExecutor) Registered(driver bindings.ExecutorDriver, executorInfo *mesos.ExecutorInfo, frameworkInfo *mesos.FrameworkInfo, slaveInfo *mesos.SlaveInfo) { if k.isDone() { return } log.Infof("Executor %v of framework %v registered with slave %v\n", executorInfo, frameworkInfo, slaveInfo) if !(&k.state).transition(disconnectedState, connectedState) { log.Errorf("failed to register/transition to a connected state") } if executorInfo != nil && executorInfo.Data != nil { k.staticPodsConfig = executorInfo.Data } if slaveInfo != nil { _, err := node.CreateOrUpdate(k.client, slaveInfo.GetHostname(), node.SlaveAttributesToLabels(slaveInfo.Attributes)) if err != nil { log.Errorf("cannot update node labels: %v", err) } } k.initialRegistration.Do(k.onInitialRegistration) }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func (k *KubernetesExecutor) Registered(driver bindings.ExecutorDriver,\n\texecutorInfo *mesos.ExecutorInfo, frameworkInfo *mesos.FrameworkInfo, slaveInfo *mesos.SlaveInfo) {\n\tif k.isDone() {\n\t\treturn\n\t}\n\tlog.Infof(\"Executor %v of framework %v registered with slave %v\\n\",\n\t\texecutorInfo, frameworkIn...
[ "0.7745206", "0.66256315", "0.65590346", "0.64209473", "0.6302684", "0.60886437", "0.60206133", "0.58198136", "0.577303", "0.5616237", "0.56074566", "0.55823475", "0.54899216", "0.5482696", "0.54519665", "0.54454345", "0.5441375", "0.5412779", "0.5340733", "0.5335579", "0.528...
0.7792358
0
Reregistered is called when the executor is successfully reregistered with the slave. This can happen when the slave fails over.
func (k *KubernetesExecutor) Reregistered(driver bindings.ExecutorDriver, slaveInfo *mesos.SlaveInfo) { if k.isDone() { return } log.Infof("Reregistered with slave %v\n", slaveInfo) if !(&k.state).transition(disconnectedState, connectedState) { log.Errorf("failed to reregister/transition to a connected state") } if slaveInfo != nil { _, err := node.CreateOrUpdate(k.client, slaveInfo.GetHostname(), node.SlaveAttributesToLabels(slaveInfo.Attributes)) if err != nil { log.Errorf("cannot update node labels: %v", err) } } k.initialRegistration.Do(k.onInitialRegistration) }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func (k *KubernetesExecutor) Reregistered(driver bindings.ExecutorDriver, slaveInfo *mesos.SlaveInfo) {\n\tif k.isDone() {\n\t\treturn\n\t}\n\tlog.Infof(\"Reregistered with slave %v\\n\", slaveInfo)\n\tif !k.swapState(disconnectedState, connectedState) {\n\t\t//programming error?\n\t\tpanic(\"already connected?!\"...
[ "0.8607573", "0.7910841", "0.7796483", "0.599285", "0.56674284", "0.5653813", "0.5586281", "0.5373038", "0.5323152", "0.5305527", "0.52888405", "0.52545166", "0.5191827", "0.51574075", "0.5083771", "0.50417197", "0.49857327", "0.49296308", "0.49199247", "0.49157673", "0.49027...
0.8559772
1
InitializeStaticPodsSource blocks until initial regstration is complete and then creates a static pod source using the given factory func.
func (k *KubernetesExecutor) InitializeStaticPodsSource(sourceFactory func()) { <-k.initialRegComplete if k.staticPodsConfig == nil { return } log.V(2).Infof("extracting static pods config to %s", k.staticPodsConfigPath) err := archive.UnzipDir(k.staticPodsConfig, k.staticPodsConfigPath) if err != nil { log.Errorf("Failed to extract static pod config: %v", err) return } log.V(2).Infof("initializing static pods source factory, configured at path %q", k.staticPodsConfigPath) sourceFactory() }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func NewStaticSource(users ...string) *StaticSource {\n\tfor i, u := range users {\n\t\tusers[i] = strings.ToLower(u)\n\t}\n\tsort.Strings(users)\n\n\tss := &StaticSource{\n\t\tnextUser: ring.New(len(users)),\n\t\tusernames: make(map[string]bool, len(users)),\n\t}\n\tfor _, u := range users {\n\t\tss.usernames[u]...
[ "0.53108597", "0.5267172", "0.51631904", "0.5085178", "0.5085178", "0.50606376", "0.50326127", "0.49595925", "0.49181592", "0.48047745", "0.4782862", "0.4779853", "0.4723916", "0.4684475", "0.46661323", "0.46650508", "0.4595088", "0.4586911", "0.45775932", "0.45775932", "0.45...
0.85254854
0
Disconnected is called when the executor is disconnected from the slave.
func (k *KubernetesExecutor) Disconnected(driver bindings.ExecutorDriver) { if k.isDone() { return } log.Infof("Slave is disconnected\n") if !(&k.state).transition(connectedState, disconnectedState) { log.Errorf("failed to disconnect/transition to a disconnected state") } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func (k *KubernetesExecutor) Disconnected(driver bindings.ExecutorDriver) {\n\tif k.isDone() {\n\t\treturn\n\t}\n\tlog.Infof(\"Slave is disconnected\\n\")\n\tif !k.swapState(connectedState, disconnectedState) {\n\t\t//programming error?\n\t\tpanic(\"already disconnected?!\")\n\t}\n}", "func (c *Client) OnDisconn...
[ "0.7777259", "0.6798982", "0.66713166", "0.65439236", "0.64857304", "0.63112164", "0.6266085", "0.62428963", "0.6222822", "0.62183905", "0.6036305", "0.60191613", "0.5995147", "0.5954083", "0.594486", "0.5891317", "0.58731556", "0.5858181", "0.58066237", "0.5801534", "0.57850...
0.78715014
0
LaunchTask is called when the executor receives a request to launch a task. The happens when the k8sm scheduler has decided to schedule the pod (which corresponds to a Mesos Task) onto the node where this executor is running, but the binding is not recorded in the Kubernetes store yet. This function is invoked to tell the executor to record the binding in the Kubernetes store and start the pod via the Kubelet.
func (k *KubernetesExecutor) LaunchTask(driver bindings.ExecutorDriver, taskInfo *mesos.TaskInfo) { if k.isDone() { return } log.Infof("Launch task %v\n", taskInfo) if !k.isConnected() { log.Errorf("Ignore launch task because the executor is disconnected\n") k.sendStatus(driver, newStatus(taskInfo.GetTaskId(), mesos.TaskState_TASK_FAILED, messages.ExecutorUnregistered)) return } obj, err := api.Codec.Decode(taskInfo.GetData()) if err != nil { log.Errorf("failed to extract yaml data from the taskInfo.data %v", err) k.sendStatus(driver, newStatus(taskInfo.GetTaskId(), mesos.TaskState_TASK_FAILED, messages.UnmarshalTaskDataFailure)) return } pod, ok := obj.(*api.Pod) if !ok { log.Errorf("expected *api.Pod instead of %T: %+v", pod, pod) k.sendStatus(driver, newStatus(taskInfo.GetTaskId(), mesos.TaskState_TASK_FAILED, messages.UnmarshalTaskDataFailure)) return } k.lock.Lock() defer k.lock.Unlock() taskId := taskInfo.GetTaskId().GetValue() if _, found := k.tasks[taskId]; found { log.Errorf("task already launched\n") // Not to send back TASK_RUNNING here, because // may be duplicated messages or duplicated task id. return } // remember this task so that: // (a) we ignore future launches for it // (b) we have a record of it so that we can kill it if needed // (c) we're leaving podName == "" for now, indicates we don't need to delete containers k.tasks[taskId] = &kuberTask{ mesosTaskInfo: taskInfo, } k.resetSuicideWatch(driver) go k.launchTask(driver, taskId, pod) }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func (k *KubernetesExecutor) launchTask(driver bindings.ExecutorDriver, taskId string, pod *api.BoundPod) {\n\n\t//HACK(jdef): cloned binding construction from k8s plugin/pkg/scheduler/scheduler.go\n\tbinding := &api.Binding{\n\t\tObjectMeta: api.ObjectMeta{\n\t\t\tNamespace: pod.Namespace,\n\t\t\tAnnotations: m...
[ "0.7151628", "0.6997699", "0.6953215", "0.64792854", "0.61711955", "0.61174685", "0.5406098", "0.5249409", "0.52027667", "0.5174867", "0.507748", "0.50657153", "0.505682", "0.5042173", "0.5036232", "0.5027475", "0.50242066", "0.49648792", "0.49447122", "0.4936511", "0.4902158...
0.7106327
1
determine whether we need to start a suicide countdown. if so, then start a timer that, upon expiration, causes this executor to commit suicide. this implementation runs asynchronously. callers that wish to wait for the reset to complete may wait for the returned signal chan to close.
func (k *KubernetesExecutor) resetSuicideWatch(driver bindings.ExecutorDriver) <-chan struct{} { ch := make(chan struct{}) go func() { defer close(ch) k.lock.Lock() defer k.lock.Unlock() if k.suicideTimeout < 1 { return } if k.suicideWatch != nil { if len(k.tasks) > 0 { k.suicideWatch.Stop() return } if k.suicideWatch.Reset(k.suicideTimeout) { // valid timer, reset was successful return } } //TODO(jdef) reduce verbosity here once we're convinced that suicide watch is working properly log.Infof("resetting suicide watch timer for %v", k.suicideTimeout) k.suicideWatch = k.suicideWatch.Next(k.suicideTimeout, driver, jumper(k.attemptSuicide)) }() return ch }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func TestRetryTimerSimple(t *testing.T) {\n\tdoneCh := make(chan struct{})\n\tattemptCh := newRetryTimerSimple(doneCh)\n\ti := <-attemptCh\n\tif i != 0 {\n\t\tclose(doneCh)\n\t\tt.Fatalf(\"Invalid attempt counter returned should be 0, found %d instead\", i)\n\t}\n\ti = <-attemptCh\n\tif i <= 0 {\n\t\tclose(doneCh)...
[ "0.48804328", "0.48184106", "0.46771833", "0.463024", "0.45945308", "0.45879915", "0.4565603", "0.45534387", "0.45432544", "0.45378762", "0.45378506", "0.45321634", "0.44820613", "0.4481226", "0.44739786", "0.44665173", "0.4464409", "0.44545475", "0.44348782", "0.4426257", "0...
0.6303878
0
async continuation of LaunchTask
func (k *KubernetesExecutor) launchTask(driver bindings.ExecutorDriver, taskId string, pod *api.Pod) { deleteTask := func() { k.lock.Lock() defer k.lock.Unlock() delete(k.tasks, taskId) k.resetSuicideWatch(driver) } // TODO(k8s): use Pods interface for binding once clusters are upgraded // return b.Pods(binding.Namespace).Bind(binding) if pod.Spec.NodeName == "" { //HACK(jdef): cloned binding construction from k8s plugin/pkg/scheduler/scheduler.go binding := &api.Binding{ ObjectMeta: api.ObjectMeta{ Namespace: pod.Namespace, Name: pod.Name, Annotations: make(map[string]string), }, Target: api.ObjectReference{ Kind: "Node", Name: pod.Annotations[meta.BindingHostKey], }, } // forward the annotations that the scheduler wants to apply for k, v := range pod.Annotations { binding.Annotations[k] = v } // create binding on apiserver log.Infof("Binding '%v/%v' to '%v' with annotations %+v...", pod.Namespace, pod.Name, binding.Target.Name, binding.Annotations) ctx := api.WithNamespace(api.NewContext(), binding.Namespace) err := k.client.Post().Namespace(api.NamespaceValue(ctx)).Resource("bindings").Body(binding).Do().Error() if err != nil { deleteTask() k.sendStatus(driver, newStatus(mutil.NewTaskID(taskId), mesos.TaskState_TASK_FAILED, messages.CreateBindingFailure)) return } } else { // post annotations update to apiserver patch := struct { Metadata struct { Annotations map[string]string `json:"annotations"` } `json:"metadata"` }{} patch.Metadata.Annotations = pod.Annotations patchJson, _ := json.Marshal(patch) log.V(4).Infof("Patching annotations %v of pod %v/%v: %v", pod.Annotations, pod.Namespace, pod.Name, string(patchJson)) err := k.client.Patch(api.MergePatchType).RequestURI(pod.SelfLink).Body(patchJson).Do().Error() if err != nil { log.Errorf("Error updating annotations of ready-to-launch pod %v/%v: %v", pod.Namespace, pod.Name, err) deleteTask() k.sendStatus(driver, newStatus(mutil.NewTaskID(taskId), mesos.TaskState_TASK_FAILED, messages.AnnotationUpdateFailure)) return } } podFullName := container.GetPodFullName(pod) // allow a recently failed-over scheduler the chance to recover the task/pod binding: // it may have failed and recovered before the apiserver is able to report the updated // binding information. replays of this status event will signal to the scheduler that // the apiserver should be up-to-date. data, err := json.Marshal(api.PodStatusResult{ ObjectMeta: api.ObjectMeta{ Name: podFullName, SelfLink: "/podstatusresult", }, }) if err != nil { deleteTask() log.Errorf("failed to marshal pod status result: %v", err) k.sendStatus(driver, newStatus(mutil.NewTaskID(taskId), mesos.TaskState_TASK_FAILED, err.Error())) return } k.lock.Lock() defer k.lock.Unlock() // Add the task. task, found := k.tasks[taskId] if !found { log.V(1).Infof("task %v not found, probably killed: aborting launch, reporting lost", taskId) k.reportLostTask(driver, taskId, messages.LaunchTaskFailed) return } //TODO(jdef) check for duplicate pod name, if found send TASK_ERROR // from here on, we need to delete containers associated with the task // upon it going into a terminal state task.podName = podFullName k.pods[podFullName] = pod // send the new pod to the kubelet which will spin it up update := kubelet.PodUpdate{ Op: kubelet.ADD, Pods: []*api.Pod{pod}, } k.updateChan <- update statusUpdate := &mesos.TaskStatus{ TaskId: mutil.NewTaskID(taskId), State: mesos.TaskState_TASK_STARTING.Enum(), Message: proto.String(messages.CreateBindingSuccess), Data: data, } k.sendStatus(driver, statusUpdate) // Delay reporting 'task running' until container is up. psf := podStatusFunc(func() (*api.PodStatus, error) { status, err := k.podStatusFunc(k.kl, pod) if err != nil { return nil, err } status.Phase = kubelet.GetPhase(&pod.Spec, status.ContainerStatuses) hostIP, err := k.kl.GetHostIP() if err != nil { log.Errorf("Cannot get host IP: %v", err) } else { status.HostIP = hostIP.String() } return status, nil }) go k._launchTask(driver, taskId, podFullName, psf) }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func (item *CatalogItem) LaunchSync() (*Task, error) {\n\tutil.Logger.Printf(\"[TRACE] LaunchSync '%s' \\n\", item.CatalogItem.Name)\n\terr := WaitResource(func() (*types.TasksInProgress, error) {\n\t\tif item.CatalogItem.Tasks == nil {\n\t\t\treturn nil, nil\n\t\t}\n\t\terr := item.Refresh()\n\t\tif err != nil {\...
[ "0.57467073", "0.5378316", "0.535708", "0.53224504", "0.52373546", "0.51839423", "0.51828736", "0.51617604", "0.51331645", "0.5115803", "0.5079198", "0.49825564", "0.49654242", "0.49452552", "0.49412638", "0.49362126", "0.49316382", "0.4887391", "0.48681155", "0.48676887", "0...
0.0
-1
Intended to be executed as part of the pod monitoring loop, this fn (ultimately) checks with Docker whether the pod is running. It will only return false if the task is still registered and the pod is registered in Docker. Otherwise it returns true. If there's still a task record on file, but no pod in Docker, then we'll also send a TASK_LOST event.
func (k *KubernetesExecutor) checkForLostPodTask(driver bindings.ExecutorDriver, taskId string, isKnownPod func() bool) bool { // TODO (jdefelice) don't send false alarms for deleted pods (KILLED tasks) k.lock.Lock() defer k.lock.Unlock() // TODO(jdef) we should really consider k.pods here, along with what docker is reporting, since the // kubelet may constantly attempt to instantiate a pod as long as it's in the pod state that we're // handing to it. otherwise, we're probably reporting a TASK_LOST prematurely. Should probably // consult RestartPolicy to determine appropriate behavior. Should probably also gracefully handle // docker daemon restarts. if _, ok := k.tasks[taskId]; ok { if isKnownPod() { return false } else { log.Warningf("Detected lost pod, reporting lost task %v", taskId) k.reportLostTask(driver, taskId, messages.ContainersDisappeared) } } else { log.V(2).Infof("Task %v no longer registered, stop monitoring for lost pods", taskId) } return true }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func (k *KubernetesExecutor) checkForLostPodTask(driver bindings.ExecutorDriver, taskId string, isKnownPod func() bool) bool {\n\t// TODO (jdefelice) don't send false alarms for deleted pods (KILLED tasks)\n\tk.lock.Lock()\n\tdefer k.lock.Unlock()\n\n\t// TODO(jdef) we should really consider k.pods here, along wit...
[ "0.65130603", "0.60245293", "0.59841156", "0.5829231", "0.5784136", "0.57519615", "0.57033616", "0.569658", "0.56850153", "0.56686944", "0.56435555", "0.5642727", "0.5637483", "0.56374794", "0.5601638", "0.55919397", "0.55881757", "0.555765", "0.5501637", "0.5492997", "0.5483...
0.64986366
1
KillTask is called when the executor receives a request to kill a task.
func (k *KubernetesExecutor) KillTask(driver bindings.ExecutorDriver, taskId *mesos.TaskID) { if k.isDone() { return } log.Infof("Kill task %v\n", taskId) if !k.isConnected() { //TODO(jdefelice) sent TASK_LOST here? log.Warningf("Ignore kill task because the executor is disconnected\n") return } k.lock.Lock() defer k.lock.Unlock() k.removePodTask(driver, taskId.GetValue(), messages.TaskKilled, mesos.TaskState_TASK_KILLED) }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func (k *KubernetesExecutor) KillTask(driver bindings.ExecutorDriver, taskId *mesos.TaskID) {\n\tif k.isDone() {\n\t\treturn\n\t}\n\tlog.Infof(\"Kill task %v\\n\", taskId)\n\n\tif !k.isConnected() {\n\t\t//TODO(jdefelice) sent TASK_LOST here?\n\t\tlog.Warningf(\"Ignore kill task because the executor is disconnecte...
[ "0.7103705", "0.66131", "0.635042", "0.6349494", "0.6305433", "0.62947786", "0.6287619", "0.6046641", "0.5978734", "0.5950175", "0.5887274", "0.58670336", "0.58401954", "0.5828122", "0.5799748", "0.57968193", "0.5729903", "0.5729903", "0.57245743", "0.55422145", "0.54591155",...
0.70807004
1
Reports a lost task to the slave and updates internal task and pod tracking state. Assumes that the caller is locking around pod and task state.
func (k *KubernetesExecutor) reportLostTask(driver bindings.ExecutorDriver, tid, reason string) { k.removePodTask(driver, tid, reason, mesos.TaskState_TASK_LOST) }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func (k *KubernetesExecutor) checkForLostPodTask(driver bindings.ExecutorDriver, taskId string, isKnownPod func() bool) bool {\n\t// TODO (jdefelice) don't send false alarms for deleted pods (KILLED tasks)\n\tk.lock.Lock()\n\tdefer k.lock.Unlock()\n\n\t// TODO(jdef) we should really consider k.pods here, along wit...
[ "0.65679485", "0.65535086", "0.62841725", "0.6088731", "0.59463507", "0.58184403", "0.5762325", "0.5706654", "0.56167144", "0.55078316", "0.5208127", "0.51102793", "0.51076466", "0.50827014", "0.5040597", "0.5035461", "0.50189453", "0.5009758", "0.4995262", "0.49910837", "0.4...
0.7423561
1
deletes the pod and task associated with the task identified by tid and sends a task status update to mesos. also attempts to reset the suicide watch. Assumes that the caller is locking around pod and task state.
func (k *KubernetesExecutor) removePodTask(driver bindings.ExecutorDriver, tid, reason string, state mesos.TaskState) { task, ok := k.tasks[tid] if !ok { log.V(1).Infof("Failed to remove task, unknown task %v\n", tid) return } delete(k.tasks, tid) k.resetSuicideWatch(driver) pid := task.podName pod, found := k.pods[pid] if !found { log.Warningf("Cannot remove unknown pod %v for task %v", pid, tid) } else { log.V(2).Infof("deleting pod %v for task %v", pid, tid) delete(k.pods, pid) // tell the kubelet to remove the pod update := kubelet.PodUpdate{ Op: kubelet.REMOVE, Pods: []*api.Pod{pod}, } k.updateChan <- update } // TODO(jdef): ensure that the update propagates, perhaps return a signal chan? k.sendStatus(driver, newStatus(mutil.NewTaskID(tid), state, reason)) }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func (k *KubernetesExecutor) removePodTask(driver bindings.ExecutorDriver, tid, reason string, state mesos.TaskState) {\n\ttask, ok := k.tasks[tid]\n\tif !ok {\n\t\tlog.V(1).Infof(\"Failed to remove task, unknown task %v\\n\", tid)\n\t\treturn\n\t}\n\tdelete(k.tasks, tid)\n\n\tpid := task.podName\n\tif _, found :=...
[ "0.59660363", "0.5913115", "0.58440596", "0.584174", "0.5816163", "0.57812667", "0.57751364", "0.5666499", "0.5642281", "0.5642281", "0.54600894", "0.54341114", "0.5352631", "0.5351886", "0.53392446", "0.5282333", "0.5256723", "0.5238282", "0.52283925", "0.5227994", "0.519162...
0.5875251
2
FrameworkMessage is called when the framework sends some message to the executor
func (k *KubernetesExecutor) FrameworkMessage(driver bindings.ExecutorDriver, message string) { if k.isDone() { return } if !k.isConnected() { log.Warningf("Ignore framework message because the executor is disconnected\n") return } log.Infof("Receives message from framework %v\n", message) //TODO(jdef) master reported a lost task, reconcile this! @see scheduler.go:handleTaskLost if strings.HasPrefix(message, messages.TaskLost+":") { taskId := message[len(messages.TaskLost)+1:] if taskId != "" { // clean up pod state k.lock.Lock() defer k.lock.Unlock() k.reportLostTask(driver, taskId, messages.TaskLostAck) } } switch message { case messages.Kamikaze: k.attemptSuicide(driver, nil) } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func (k *KubernetesScheduler) FrameworkMessage(driver mesos.SchedulerDriver,\n\texecutorId *mesos.ExecutorID, slaveId *mesos.SlaveID, message string) {\n\tlog.Infof(\"Received messages from executor %v of slave %v, %v\\n\", executorId, slaveId, message)\n}", "func (k *KubernetesExecutor) FrameworkMessage(driver ...
[ "0.76166224", "0.7523464", "0.7301339", "0.65361845", "0.581059", "0.5690735", "0.5615401", "0.55689687", "0.5547834", "0.5494455", "0.54745054", "0.5425644", "0.5393343", "0.53881025", "0.5377702", "0.5375619", "0.53561026", "0.5316209", "0.5300948", "0.5299889", "0.5255014"...
0.7578516
1
Shutdown is called when the executor receives a shutdown request.
func (k *KubernetesExecutor) Shutdown(driver bindings.ExecutorDriver) { k.lock.Lock() defer k.lock.Unlock() k.doShutdown(driver) }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func (e *bcsExecutor) Shutdown() {\n\te.isAskedShutdown = true\n\n\t//shutdown\n\te.innerShutdown()\n}", "func (k *KubernetesExecutor) Shutdown(driver bindings.ExecutorDriver) {\n\tif k.isDone() {\n\t\treturn\n\t}\n\tclose(k.done)\n\n\tlog.Infoln(\"Shutdown the executor\")\n\tdefer func() {\n\t\tfor !k.swapState...
[ "0.77749574", "0.74859995", "0.7293281", "0.7045941", "0.70429516", "0.69103533", "0.68971735", "0.6863724", "0.6858713", "0.6847161", "0.68009514", "0.67958325", "0.67107534", "0.66885036", "0.66786605", "0.6673801", "0.66667897", "0.66601294", "0.6658383", "0.66421247", "0....
0.7389451
2
assumes that caller has obtained state lock
func (k *KubernetesExecutor) doShutdown(driver bindings.ExecutorDriver) { defer func() { log.Errorf("exiting with unclean shutdown: %v", recover()) if k.exitFunc != nil { k.exitFunc(1) } }() (&k.state).transitionTo(terminalState) // signal to all listeners that this KubeletExecutor is done! close(k.done) if k.shutdownAlert != nil { func() { util.HandleCrash() k.shutdownAlert() }() } log.Infoln("Stopping executor driver") _, err := driver.Stop() if err != nil { log.Warningf("failed to stop executor driver: %v", err) } log.Infoln("Shutdown the executor") // according to docs, mesos will generate TASK_LOST updates for us // if needed, so don't take extra time to do that here. k.tasks = map[string]*kuberTask{} select { // the main Run() func may still be running... wait for it to finish: it will // clear the pod configuration cleanly, telling k8s "there are no pods" and // clean up resources (pods, volumes, etc). case <-k.kubeletFinished: //TODO(jdef) attempt to wait for events to propagate to API server? // TODO(jdef) extract constant, should be smaller than whatever the // slave graceful shutdown timeout period is. case <-time.After(15 * time.Second): log.Errorf("timed out waiting for kubelet Run() to die") } log.Infoln("exiting") if k.exitFunc != nil { k.exitFunc(0) } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func (r GopassRepo) lockState(payload []byte) error { return nil }", "func (s *SharedState) unlock() {\n s.mutex.Unlock()\n}", "func (*S) Lock() {}", "func (*Item) Lock() {}", "func (s *SharedState) lock() *SharedState {\n s.mutex.Lock()\n return s\n}", "func (*NoCopy) Lock() {}", "func (d delega...
[ "0.69092983", "0.6534878", "0.6440702", "0.6406376", "0.639457", "0.6273028", "0.6153657", "0.60759884", "0.60344356", "0.59434104", "0.5915108", "0.57914233", "0.5769212", "0.57299584", "0.5726385", "0.5710375", "0.5692428", "0.56667316", "0.56556684", "0.5642097", "0.563754...
0.0
-1
Destroy existing k8s containers
func (k *KubernetesExecutor) killKubeletContainers() { if containers, err := dockertools.GetKubeletDockerContainers(k.dockerClient, true); err == nil { opts := docker.RemoveContainerOptions{ RemoveVolumes: true, Force: true, } for _, container := range containers { opts.ID = container.ID log.V(2).Infof("Removing container: %v", opts.ID) if err := k.dockerClient.RemoveContainer(opts); err != nil { log.Warning(err) } } } else { log.Warningf("Failed to list kubelet docker containers: %v", err) } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func (d *Docker) Destroy(ctx context.Context, name string) error {\n\treturn d.localClient.ContainerStop(ctx, name, nil)\n}", "func CleanUp(ctx context.Context, cfg *config.Config, pipeline *pipelines.Pipeline, name names.Name) error {\n\tkubectlPath, err := cfg.Tools[config.Kubectl].Resolve()\n\tif err != nil {...
[ "0.63340247", "0.6316679", "0.63003445", "0.61168224", "0.60297364", "0.602845", "0.6010872", "0.5956652", "0.59419936", "0.59391356", "0.59131247", "0.5894728", "0.58919394", "0.58671063", "0.5793185", "0.57930833", "0.57607406", "0.57445747", "0.5731923", "0.5720401", "0.56...
0.6113355
4
Start will start the provided command and return a Session that can be used to await completion or signal the process. The provided logger is used log stderr from the running process.
func Start(logger *flogging.FabricLogger, cmd *exec.Cmd, exitFuncs ...ExitFunc) (*Session, error) { logger = logger.With("command", filepath.Base(cmd.Path)) stderr, err := cmd.StderrPipe() if err != nil { return nil, err } err = cmd.Start() if err != nil { return nil, err } sess := &Session{ command: cmd, exitFuncs: exitFuncs, exited: make(chan struct{}), } go sess.waitForExit(logger, stderr) return sess, nil }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func Start(t *testing.T, cmd *exec.Cmd) (*StartSession, error) {\n\tt.Helper()\n\tt.Logf(\"(dbg) daemon: %v\", cmd.Args)\n\n\tstdoutPipe, err := cmd.StdoutPipe()\n\tif err != nil {\n\t\tt.Fatalf(\"stdout pipe failed: %v %v\", cmd.Args, err)\n\t}\n\tstderrPipe, err := cmd.StderrPipe()\n\tif err != nil {\n\t\tt.Fata...
[ "0.66363233", "0.5773775", "0.5744883", "0.5383558", "0.5373031", "0.5363997", "0.53256774", "0.5283025", "0.5241867", "0.5202267", "0.5201847", "0.5199594", "0.5198676", "0.51582026", "0.5126679", "0.50996524", "0.50755686", "0.507384", "0.5072129", "0.50489205", "0.5045449"...
0.69417846
0
Wait waits for the running command to terminate and returns the exit error from the command. If the command has already exited, the exit err will be returned immediately.
func (s *Session) Wait() error { <-s.exited return s.exitErr }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func (c *qemuCmd) Wait() (int, error) {\n\terr := c.cmd.Wait()\n\n\texitStatus := -1\n\topAPI := c.cmd.Get()\n\tif opAPI.Metadata != nil {\n\t\texitStatusRaw, ok := opAPI.Metadata[\"return\"].(float64)\n\t\tif ok {\n\t\t\texitStatus = int(exitStatusRaw)\n\n\t\t\t// Convert special exit statuses into errors.\n\t\t\...
[ "0.71921074", "0.6797356", "0.675889", "0.6755778", "0.67316556", "0.6584684", "0.6526827", "0.6401224", "0.63894427", "0.63415635", "0.6319634", "0.6313171", "0.62899655", "0.6217153", "0.6215627", "0.62074", "0.6202083", "0.6173427", "0.6171321", "0.61360484", "0.6130087", ...
0.5931322
29
Signal will send a signal to the running process.
func (s *Session) Signal(sig os.Signal) { s.command.Process.Signal(sig) }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func (p *Process) Signal(sig os.Signal) error {\n return p.Process.Signal(sig)\n}", "func (p *process) Signal(s os.Signal) error {\n\treturn syscall.Kill(p.pid, s.(syscall.Signal))\n}", "func (c *D) Signal(signal os.Signal) error {\n\tif !c.IsRunning() {\n\t\treturn ErrNotRunning\n\t}\n\treturn c.cmd.Proces...
[ "0.83315116", "0.7944749", "0.76571196", "0.763797", "0.75873667", "0.7493231", "0.74723375", "0.74002385", "0.72498876", "0.72400916", "0.71118015", "0.70792997", "0.6922517", "0.68888897", "0.6854779", "0.6834527", "0.68048215", "0.66322833", "0.6622571", "0.6621923", "0.64...
0.75317323
5
canonical service name, e.g. "comment" => "comment.hy.byted.org." can be further used as DNS domain name
func (sd *ServiceDiscovery) CanonicalName(service string) string { if strings.HasSuffix(service, sd.Domain) { return service } return strings.Join([]string{service, serviceSuffix, sd.Dc, sd.Domain}, ".") }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func hostnameForService(svc string) string {\n\n\tparts := strings.Split(svc, \"/\")\n\tif len(parts) < 2 {\n\t\treturn parts[0]\n\t}\n\tif len(parts) > 2 {\n\t\tlog.Printf(\"Malformated service identifier [%s] - Hostname will be truncated\", svc)\n\t}\n\treturn fmt.Sprintf(\"%s.%s\", parts[1], parts[0])\n\n}", ...
[ "0.73525965", "0.71070457", "0.661327", "0.6535657", "0.64382684", "0.6371256", "0.6304489", "0.6274248", "0.62092716", "0.61814994", "0.61593896", "0.61587137", "0.6156627", "0.6149207", "0.61265564", "0.6115233", "0.60776806", "0.60719866", "0.60674506", "0.60491043", "0.60...
0.7669328
0
convert canonical service name to (service, dc)
func (sd *ServiceDiscovery) ResolveName(name string) (string, string) { name = stripDomain(name) if strings.HasSuffix(name, sd.Domain) { name = name[0 : len(name)-len(sd.Domain)-1] } separator := fmt.Sprintf(".%s", serviceSuffix) var service string var dc string if strings.Contains(name, separator) { cols := strings.Split(name, separator) service, dc = cols[0], stripDomain(cols[1]) if len(dc) < 1 { dc = sd.Dc } } else { service, dc = name, sd.Dc } return service, dc }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func NormalizeForServiceName(svcName string) string {\n\tre := regexp.MustCompile(\"[._]\")\n\tnewName := strings.ToLower(re.ReplaceAllString(svcName, \"-\"))\n\tif newName != svcName {\n\t\tlog.Infof(\"Changing service name to %s from %s\", svcName, newName)\n\t}\n\treturn newName\n}", "func cleanServiceName(in...
[ "0.6761654", "0.67161447", "0.66240215", "0.6538214", "0.64352095", "0.64233994", "0.6297522", "0.62180257", "0.6172227", "0.6166578", "0.6105407", "0.60922176", "0.6058803", "0.60244125", "0.6020425", "0.60160077", "0.59808594", "0.5971854", "0.5956637", "0.5895601", "0.5892...
0.5368005
59
/ WARN: use weak consistency causes stale read unless explicitly specific otherwise (values: 'default', 'consistent' or 'stale') 'default': R/W goes to leader without quorum verification of leadership 'consistency': R/W goes to leader with quorum verification of leadership (extra RTT) 'stale': R goes to any server, W goes to leader
func (sd *ServiceDiscovery) lookupInternal(name, consistency string) ([]*Endpoint, error) { service, dc := sd.ResolveName(name) opts := &QueryOptions{ dc, consistency == weakConsistency, consistency == strongConsistency, 0, 0, "", } entries, _, err := sd.Client.Health().Service(service, "", true, opts) if err != nil { return nil, err } result := make([]*Endpoint, len(entries)) i := 0 for _, entry := range entries { result[i] = loadServiceNode(entry) i++ } return result, nil }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func TestReadOnlyForNewLeader(t *testing.T) {\n\tnodeConfigs := []struct {\n\t\tid uint64\n\t\tcommitted uint64\n\t\tapplied uint64\n\t\tcompact_index uint64\n\t}{\n\t\t{1, 1, 1, 0},\n\t\t{2, 2, 2, 2},\n\t\t{3, 2, 2, 2},\n\t}\n\tpeers := make([]stateMachine, 0)\n\tfor _, c := range nodeConfigs...
[ "0.66211784", "0.6423465", "0.5926223", "0.5894299", "0.5792348", "0.57678336", "0.55496424", "0.5541377", "0.55259955", "0.5486153", "0.5483181", "0.54630363", "0.5452382", "0.538989", "0.5353664", "0.53503656", "0.5334872", "0.53203416", "0.53153723", "0.53076434", "0.53016...
0.0
-1
Single path ClearPath of a participant.
func (g *game) ClearPath(participant int) { g.paths[participant] = *NewPathEmpty() }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func (p *Path) Clear() {\n\tp.Components = p.Components[0:0]\n\tp.Points = p.Points[0:0]\n\treturn\n}", "func (g *game) ResetPath(participant int) {\r\n\t// GeneratePath contains a path-finding algorithm. This function is used as a path finder.\r\n\tGeneratePath := func(g *game, participant int) Path {\r\n\t\tco...
[ "0.62280947", "0.57256985", "0.54862976", "0.5433992", "0.5411144", "0.5378296", "0.53192234", "0.5312423", "0.5310817", "0.5300578", "0.5296787", "0.5288634", "0.5287906", "0.5284339", "0.5282591", "0.52736807", "0.52375746", "0.5223153", "0.5210946", "0.5193968", "0.5191793...
0.7931326
0
ResetPath of a participant.
func (g *game) ResetPath(participant int) { // GeneratePath contains a path-finding algorithm. This function is used as a path finder. GeneratePath := func(g *game, participant int) Path { const icol int = 0 // level irow := participant // participant grid := g.ladder.grid route := []pixel.Vec{} prize := -1 for level := icol; level < g.ladder.nLevel; level++ { route = append(route, grid[irow][level]) prize = irow if irow+1 < g.ladder.nParticipants { if g.ladder.bridges[irow][level] { irow++ // cross the bridge ... to the left (south) route = append(route, grid[irow][level]) prize = irow continue } } if irow-1 >= 0 { if g.ladder.bridges[irow-1][level] { irow-- // cross the bridge ... to the right (north) route = append(route, grid[irow][level]) prize = irow continue } } } // log.Println(participant, prize, irow) // // A path found here is called a route or roads. return *NewPath(route, &prize) // val, not ptr } g.paths[participant] = GeneratePath(g, participant) // path-find g.paths[participant].OnPassedEachPoint = func(pt pixel.Vec, dir pixel.Vec) { g.explosions.ExplodeAt(pt, dir.Scaled(2)) } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func (g *game) ClearPath(participant int) {\r\n\tg.paths[participant] = *NewPathEmpty()\r\n}", "func (r *reaper) resetPath(path string) {\n\tr.pathsMtx.Lock()\n\tr.paths[path] = 0\n\tr.pathsMtx.Unlock()\n}", "func (m *FileMutation) ResetPath() {\n\tm._path = nil\n}", "func SetPath(p string) {\n\tcurrentPath ...
[ "0.7108436", "0.6571989", "0.63909775", "0.59130096", "0.53988624", "0.51365834", "0.51137793", "0.5081069", "0.49706945", "0.4948637", "0.49371397", "0.48576868", "0.48551345", "0.48401654", "0.4819019", "0.47944432", "0.47733396", "0.4750125", "0.47464317", "0.47329056", "0...
0.7322597
0
Shuffle in an approximate time.
func (g *game) Shuffle(times, inMillisecond int) { speed := g.galaxy.Speed() g.galaxy.SetSpeed(speed * 10) { i := 0 for range time.Tick( (time.Millisecond * time.Duration(inMillisecond)) / time.Duration(times), ) { g.bg = gg.RandomNiceColor() g.Reset() i++ if i >= times { break } } } g.galaxy.SetSpeed(speed) }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func (d *deck) shuffle() {\n\trand.Seed(time.Now().UnixNano())\n\tfor i := len(d) - 1; i > 0; i-- {\n\t\tj := rand.Intn(i + 1)\n\t\td[i], d[j] = d[j], d[i]\n\t}\n}", "func (d deck) shuffle() {\n\tsource := rand.NewSource(time.Now().UnixNano())\n\tr := rand.New(source)\n\t// now generate rnd num and swap position...
[ "0.6643019", "0.6610405", "0.656916", "0.656916", "0.6559215", "0.6543622", "0.65322894", "0.6528126", "0.65013474", "0.64964604", "0.6465577", "0.64433384", "0.6441934", "0.63497853", "0.63177043", "0.63148683", "0.62923735", "0.62625074", "0.6247741", "0.6245899", "0.623394...
0.70752513
0
Read only methods WindowDeep is a hacky way to access a window in deep. It returns (window glfw.Window) which is an unexported member inside a (pixelgl.Window). Read only argument game ignores the pass lock by value warning.
func (g game) WindowDeep() (baseWindow *glfw.Window) { return *(**glfw.Window)(unsafe.Pointer(reflect.Indirect(reflect.ValueOf(g.window)).FieldByName("window").UnsafeAddr())) }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func (ref *UIElement) Window() *UIElement {\n\tret, _ := ref.UIElementAttr(WindowAttribute)\n\treturn ret\n}", "func (s *Scroll) Window() sparta.Window {\n\treturn s.win\n}", "func (l *List) Window() sparta.Window {\n\treturn l.win\n}", "func (s *Session) Window(name string) (*Window, error) {\n\tws, err := ...
[ "0.6121591", "0.57735056", "0.56956416", "0.55192953", "0.5446127", "0.53620154", "0.5274085", "0.52285427", "0.51846564", "0.5162946", "0.511235", "0.50249225", "0.5017211", "0.5011972", "0.499117", "0.49634722", "0.49331006", "0.4904986", "0.48966926", "0.48881537", "0.4842...
0.8779711
0
Read only argument game ignores the pass lock by value warning.
func (g game) BridgesCount() (sum int) { for _, row := range g.ladder.bridges { for _, col := range row { if col { sum++ } } } return sum }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func (*NoCopy) Lock() {}", "func (*noCopy) Lock() {}", "func Readonly(opts *Options) {\n\topts.Readonly = true\n}", "func mainLock(ctx *cli.Context) error {\n\tconsole.SetColor(\"Mode\", color.New(color.FgCyan, color.Bold))\n\tconsole.SetColor(\"Validity\", color.New(color.FgYellow))\n\n\t// Parse encrypti...
[ "0.5734881", "0.5633942", "0.5482277", "0.54154927", "0.5370941", "0.5030581", "0.50263333", "0.50120914", "0.5009855", "0.49270573", "0.49246377", "0.4844874", "0.48276043", "0.4819514", "0.4801058", "0.47585997", "0.47585997", "0.47585997", "0.47585997", "0.47585997", "0.47...
0.0
-1
Run on main thread Run the game window and its event loop on main thread.
func (g *game) Run() { pixelgl.Run(func() { g.RunLazyInit() g.RunEventLoop() }) }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func run() {\n\tglobal.gVariables.Load(wConfigFile)\n\n\t// Initialize window\n\tcfg := pixelgl.WindowConfig{\n\t\tTitle: wWindowTitle,\n\t\tBounds: pixel.R(0, 0, global.gVariables.WindowWidth, global.gVariables.WindowHeight),\n\t\tVSync: true,\n\t}\n\tgWin, err := pixelgl.NewWindow(cfg)\n\tif err != nil {\n\t\t...
[ "0.68362325", "0.6632658", "0.65929407", "0.65919864", "0.6479984", "0.64564955", "0.63060695", "0.6271096", "0.62061435", "0.61521715", "0.6062181", "0.6053579", "0.6020126", "0.5969148", "0.5958348", "0.59452575", "0.59320587", "0.5922841", "0.58962166", "0.58803695", "0.58...
0.66125727
2
NewWin32LobAppRegistryDetection instantiates a new win32LobAppRegistryDetection and sets the default values.
func NewWin32LobAppRegistryDetection()(*Win32LobAppRegistryDetection) { m := &Win32LobAppRegistryDetection{ Win32LobAppDetection: *NewWin32LobAppDetection(), } odataTypeValue := "#microsoft.graph.win32LobAppRegistryDetection" m.SetOdataType(&odataTypeValue) return m }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func NewWin32LobAppRegistryRule()(*Win32LobAppRegistryRule) {\n m := &Win32LobAppRegistryRule{\n Win32LobAppRule: *NewWin32LobAppRule(),\n }\n odataTypeValue := \"#microsoft.graph.win32LobAppRegistryRule\";\n m.SetOdataType(&odataTypeValue);\n return m\n}", "func NewWin32LobAppFileSystemDet...
[ "0.69928527", "0.63613343", "0.6318046", "0.61856246", "0.5193109", "0.5166172", "0.51250374", "0.50861037", "0.5074907", "0.4938517", "0.49354273", "0.49308693", "0.4923182", "0.48366225", "0.48020795", "0.4768719", "0.4762157", "0.47500703", "0.47480088", "0.47457948", "0.4...
0.8352202
0
CreateWin32LobAppRegistryDetectionFromDiscriminatorValue creates a new instance of the appropriate class based on discriminator value
func CreateWin32LobAppRegistryDetectionFromDiscriminatorValue(parseNode i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.ParseNode)(i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.Parsable, error) { return NewWin32LobAppRegistryDetection(), nil }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func CreateWin32LobAppRegistryRuleFromDiscriminatorValue(parseNode i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.ParseNode)(i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.Parsable, error) {\n return NewWin32LobAppRegistryRule(), nil\n}", "func CreateWin32LobAppProductCod...
[ "0.79248315", "0.77870834", "0.7597286", "0.688303", "0.67968935", "0.6721281", "0.65258247", "0.64671457", "0.63796526", "0.6349763", "0.63148403", "0.63032705", "0.62638336", "0.6011352", "0.60016245", "0.59657604", "0.596529", "0.5954428", "0.59539", "0.59302485", "0.59269...
0.8787148
0
GetCheck32BitOn64System gets the check32BitOn64System property value. A value indicating whether this registry path is for checking 32bit app on 64bit system
func (m *Win32LobAppRegistryDetection) GetCheck32BitOn64System()(*bool) { val, err := m.GetBackingStore().Get("check32BitOn64System") if err != nil { panic(err) } if val != nil { return val.(*bool) } return nil }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func (m *Win32LobAppRegistryRule) GetCheck32BitOn64System()(*bool) {\n return m.check32BitOn64System\n}", "func (m *Win32LobAppFileSystemDetection) GetCheck32BitOn64System()(*bool) {\n val, err := m.GetBackingStore().Get(\"check32BitOn64System\")\n if err != nil {\n panic(err)\n }\n if val ...
[ "0.8441771", "0.818702", "0.74417126", "0.7327586", "0.7049355", "0.5609109", "0.50374573", "0.49397087", "0.48814422", "0.48766637", "0.4864678", "0.48252845", "0.4820567", "0.47325158", "0.46962094", "0.46929163", "0.46125704", "0.45937026", "0.4560345", "0.45471245", "0.45...
0.83624035
1
GetDetectionType gets the detectionType property value. Contains all supported registry data detection type.
func (m *Win32LobAppRegistryDetection) GetDetectionType()(*Win32LobAppRegistryDetectionType) { val, err := m.GetBackingStore().Get("detectionType") if err != nil { panic(err) } if val != nil { return val.(*Win32LobAppRegistryDetectionType) } return nil }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func (m *Win32LobAppFileSystemDetection) GetDetectionType()(*Win32LobAppFileSystemDetectionType) {\n val, err := m.GetBackingStore().Get(\"detectionType\")\n if err != nil {\n panic(err)\n }\n if val != nil {\n return val.(*Win32LobAppFileSystemDetectionType)\n }\n return nil\n}", ...
[ "0.67219144", "0.6149949", "0.57620186", "0.5496027", "0.54775685", "0.528229", "0.52672976", "0.5143704", "0.5137406", "0.50295734", "0.50217456", "0.4986631", "0.49292427", "0.49167252", "0.49129754", "0.4896166", "0.4861257", "0.4857358", "0.48417208", "0.4831465", "0.4806...
0.7379886
0
GetDetectionValue gets the detectionValue property value. The registry detection value
func (m *Win32LobAppRegistryDetection) GetDetectionValue()(*string) { val, err := m.GetBackingStore().Get("detectionValue") if err != nil { panic(err) } if val != nil { return val.(*string) } return nil }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func (m *Win32LobAppFileSystemDetection) GetDetectionValue()(*string) {\n val, err := m.GetBackingStore().Get(\"detectionValue\")\n if err != nil {\n panic(err)\n }\n if val != nil {\n return val.(*string)\n }\n return nil\n}", "func (m *Win32LobAppRegistryDetection) SetDetectionV...
[ "0.7641047", "0.67213154", "0.60203254", "0.5969953", "0.5907721", "0.5894237", "0.5693755", "0.5686337", "0.55916923", "0.5588278", "0.5571196", "0.5500819", "0.549452", "0.54863846", "0.5450651", "0.54302305", "0.53898174", "0.5385101", "0.5342542", "0.5263009", "0.525747",...
0.825966
0
GetFieldDeserializers the deserialization information for the current model
func (m *Win32LobAppRegistryDetection) GetFieldDeserializers()(map[string]func(i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.ParseNode)(error)) { res := m.Win32LobAppDetection.GetFieldDeserializers() res["check32BitOn64System"] = func (n i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.ParseNode) error { val, err := n.GetBoolValue() if err != nil { return err } if val != nil { m.SetCheck32BitOn64System(val) } return nil } res["detectionType"] = func (n i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.ParseNode) error { val, err := n.GetEnumValue(ParseWin32LobAppRegistryDetectionType) if err != nil { return err } if val != nil { m.SetDetectionType(val.(*Win32LobAppRegistryDetectionType)) } return nil } res["detectionValue"] = func (n i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.ParseNode) error { val, err := n.GetStringValue() if err != nil { return err } if val != nil { m.SetDetectionValue(val) } return nil } res["keyPath"] = func (n i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.ParseNode) error { val, err := n.GetStringValue() if err != nil { return err } if val != nil { m.SetKeyPath(val) } return nil } res["operator"] = func (n i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.ParseNode) error { val, err := n.GetEnumValue(ParseWin32LobAppDetectionOperator) if err != nil { return err } if val != nil { m.SetOperator(val.(*Win32LobAppDetectionOperator)) } return nil } res["valueName"] = func (n i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.ParseNode) error { val, err := n.GetStringValue() if err != nil { return err } if val != nil { m.SetValueName(val) } return nil } return res }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func (m *AuthenticationMethod) GetFieldDeserializers()(map[string]func(i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.ParseNode)(error)) {\n res := m.Entity.GetFieldDeserializers()\n return res\n}", "func (m *IdentityProviderBase) GetFieldDeserializers()(map[string]func(i878a80d2330e89d2...
[ "0.71389484", "0.7128844", "0.70900005", "0.70069104", "0.7001896", "0.6972073", "0.6967879", "0.69341457", "0.6871311", "0.6712054", "0.6700039", "0.66957355", "0.66894317", "0.6688032", "0.6666724", "0.6651305", "0.66157794", "0.66102874", "0.6606821", "0.66024405", "0.6599...
0.0
-1
GetKeyPath gets the keyPath property value. The registry key path to detect Win32 Line of Business (LoB) app
func (m *Win32LobAppRegistryDetection) GetKeyPath()(*string) { val, err := m.GetBackingStore().Get("keyPath") if err != nil { panic(err) } if val != nil { return val.(*string) } return nil }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func (m *Win32LobAppRegistryRule) GetKeyPath()(*string) {\n return m.keyPath\n}", "func (m *Win32LobAppRegistryRule) SetKeyPath(value *string)() {\n m.keyPath = value\n}", "func (m *Win32LobAppRegistryDetection) SetKeyPath(value *string)() {\n err := m.GetBackingStore().Set(\"keyPath\", value)\n if...
[ "0.78984046", "0.67674714", "0.6547843", "0.6513192", "0.6465143", "0.62664264", "0.60375607", "0.603131", "0.59816104", "0.59493417", "0.5889502", "0.5860767", "0.58368987", "0.5812933", "0.5775046", "0.57547045", "0.57531434", "0.57431287", "0.5739169", "0.57093596", "0.562...
0.78582966
1
GetOperator gets the operator property value. Contains properties for detection operator.
func (m *Win32LobAppRegistryDetection) GetOperator()(*Win32LobAppDetectionOperator) { val, err := m.GetBackingStore().Get("operator") if err != nil { panic(err) } if val != nil { return val.(*Win32LobAppDetectionOperator) } return nil }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func (f Filter) GetOperator() string {\n\treturn f.operator\n}", "func (m *Win32LobAppRegistryRule) GetOperator()(*Win32LobAppRuleOperator) {\n return m.operator\n}", "func GetOperator(ctx *pulumi.Context,\n\tname string, id pulumi.IDInput, state *OperatorState, opts ...pulumi.ResourceOption) (*Operator, er...
[ "0.80829227", "0.7646545", "0.7586884", "0.7536287", "0.74493635", "0.72114533", "0.71136105", "0.711027", "0.71038866", "0.7087019", "0.7086355", "0.7079433", "0.7075816", "0.7069984", "0.70697856", "0.7065881", "0.70624244", "0.7060574", "0.7048873", "0.70485675", "0.704392...
0.7549911
3
GetValueName gets the valueName property value. The registry value name
func (m *Win32LobAppRegistryDetection) GetValueName()(*string) { val, err := m.GetBackingStore().Get("valueName") if err != nil { panic(err) } if val != nil { return val.(*string) } return nil }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func (m *Win32LobAppRegistryRule) GetValueName()(*string) {\n return m.valueName\n}", "func (m *RegistryKeyState) GetValueName()(*string) {\n return m.valueName\n}", "func (p ByName) ValueName() string { return p.valueName }", "func (m *Win32LobAppRegistryRule) SetValueName(value *string)() {\n m.va...
[ "0.7900741", "0.7671747", "0.66240984", "0.65626806", "0.6345081", "0.6202632", "0.6187288", "0.61499274", "0.61246884", "0.60892904", "0.60507566", "0.6003135", "0.5918145", "0.59086007", "0.5907154", "0.58331186", "0.5813495", "0.5791507", "0.5772751", "0.57622325", "0.5722...
0.7951308
0
Serialize serializes information the current object
func (m *Win32LobAppRegistryDetection) Serialize(writer i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.SerializationWriter)(error) { err := m.Win32LobAppDetection.Serialize(writer) if err != nil { return err } { err = writer.WriteBoolValue("check32BitOn64System", m.GetCheck32BitOn64System()) if err != nil { return err } } if m.GetDetectionType() != nil { cast := (*m.GetDetectionType()).String() err = writer.WriteStringValue("detectionType", &cast) if err != nil { return err } } { err = writer.WriteStringValue("detectionValue", m.GetDetectionValue()) if err != nil { return err } } { err = writer.WriteStringValue("keyPath", m.GetKeyPath()) if err != nil { return err } } if m.GetOperator() != nil { cast := (*m.GetOperator()).String() err = writer.WriteStringValue("operator", &cast) if err != nil { return err } } { err = writer.WriteStringValue("valueName", m.GetValueName()) if err != nil { return err } } return nil }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func (p Registered) Serialize() common.JSON {\n\treturn common.JSON{\n\t\t\"ID\": p.ID,\n\t\t\"Date\": p.Date,\n\t\t\"Riders\": p.Riders,\n\t\t\"RidersID\": p.RidersID,\n\t\t\"Events\": p.Events,\n\t\t\"EventsID\": p.EventsID,\n\t\t\"StartNumber\": p.StartNumber,\n\t}\n}", "func (...
[ "0.6572986", "0.6466613", "0.6435532", "0.63836247", "0.6377068", "0.63716114", "0.6346305", "0.62336147", "0.6171269", "0.6162533", "0.61441034", "0.6142544", "0.6116166", "0.610626", "0.6100351", "0.6082516", "0.6060808", "0.6053123", "0.6039119", "0.60381764", "0.60261023"...
0.0
-1
SetCheck32BitOn64System sets the check32BitOn64System property value. A value indicating whether this registry path is for checking 32bit app on 64bit system
func (m *Win32LobAppRegistryDetection) SetCheck32BitOn64System(value *bool)() { err := m.GetBackingStore().Set("check32BitOn64System", value) if err != nil { panic(err) } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func (m *Win32LobAppRegistryRule) SetCheck32BitOn64System(value *bool)() {\n m.check32BitOn64System = value\n}", "func (m *Win32LobAppFileSystemDetection) SetCheck32BitOn64System(value *bool)() {\n err := m.GetBackingStore().Set(\"check32BitOn64System\", value)\n if err != nil {\n panic(err)\n ...
[ "0.80912334", "0.7938606", "0.74322027", "0.7383997", "0.7221693", "0.5194884", "0.48725256", "0.46642232", "0.46489272", "0.44782275", "0.4423561", "0.43780947", "0.43608654", "0.4353791", "0.4339238", "0.432639", "0.426746", "0.4247548", "0.42021963", "0.41816446", "0.41808...
0.81353074
0
SetDetectionType sets the detectionType property value. Contains all supported registry data detection type.
func (m *Win32LobAppRegistryDetection) SetDetectionType(value *Win32LobAppRegistryDetectionType)() { err := m.GetBackingStore().Set("detectionType", value) if err != nil { panic(err) } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func (m *Win32LobAppFileSystemDetection) SetDetectionType(value *Win32LobAppFileSystemDetectionType)() {\n err := m.GetBackingStore().Set(\"detectionType\", value)\n if err != nil {\n panic(err)\n }\n}", "func (m *ServicePrincipalRiskDetection) SetDetectionTimingType(value *RiskDetectionTimingTyp...
[ "0.7363352", "0.5975671", "0.5331663", "0.53013253", "0.52569485", "0.51956946", "0.51857483", "0.5160634", "0.5101551", "0.5071986", "0.49641094", "0.49582717", "0.4951682", "0.48980385", "0.48872924", "0.48744246", "0.48734355", "0.48619604", "0.48555112", "0.48502493", "0....
0.78450286
0
SetDetectionValue sets the detectionValue property value. The registry detection value
func (m *Win32LobAppRegistryDetection) SetDetectionValue(value *string)() { err := m.GetBackingStore().Set("detectionValue", value) if err != nil { panic(err) } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func (m *Win32LobAppFileSystemDetection) SetDetectionValue(value *string)() {\n err := m.GetBackingStore().Set(\"detectionValue\", value)\n if err != nil {\n panic(err)\n }\n}", "func (m *DeviceComplianceScriptDeviceState) SetDetectionState(value *RunState)() {\n err := m.GetBackingStore().Set...
[ "0.8194171", "0.6741127", "0.6581731", "0.64988846", "0.6003841", "0.59368724", "0.5703004", "0.5693805", "0.5605851", "0.5493374", "0.5358903", "0.53084475", "0.53084046", "0.5259993", "0.5254106", "0.51735765", "0.51641166", "0.509452", "0.5087088", "0.50843537", "0.5074717...
0.8674166
0
SetKeyPath sets the keyPath property value. The registry key path to detect Win32 Line of Business (LoB) app
func (m *Win32LobAppRegistryDetection) SetKeyPath(value *string)() { err := m.GetBackingStore().Set("keyPath", value) if err != nil { panic(err) } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func (m *Win32LobAppRegistryRule) SetKeyPath(value *string)() {\n m.keyPath = value\n}", "func (m *Win32LobAppFileSystemDetection) SetPath(value *string)() {\n err := m.GetBackingStore().Set(\"path\", value)\n if err != nil {\n panic(err)\n }\n}", "func (o *Gojwt) SetPubKeyPath(path string)(...
[ "0.8021742", "0.67656904", "0.62937456", "0.62167495", "0.6206706", "0.6083632", "0.597346", "0.5902287", "0.58721584", "0.58346844", "0.5812029", "0.57700974", "0.5760498", "0.57318586", "0.5713192", "0.5710716", "0.57095003", "0.56565154", "0.5585007", "0.55487555", "0.5525...
0.8031149
0
SetOperator sets the operator property value. Contains properties for detection operator.
func (m *Win32LobAppRegistryDetection) SetOperator(value *Win32LobAppDetectionOperator)() { err := m.GetBackingStore().Set("operator", value) if err != nil { panic(err) } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func (scsuo *SurveyCellScanUpdateOne) SetOperator(s string) *SurveyCellScanUpdateOne {\n\tscsuo.operator = &s\n\treturn scsuo\n}", "func (lc *LoggerCreate) SetOperator(s string) *LoggerCreate {\n\tlc.mutation.SetOperator(s)\n\treturn lc\n}", "func (m *Win32LobAppRegistryRule) SetOperator(value *Win32LobAppRule...
[ "0.80421716", "0.79923975", "0.791156", "0.78952646", "0.78148216", "0.7810365", "0.7804072", "0.7628318", "0.75511897", "0.7523939", "0.7450194", "0.74377996", "0.740163", "0.7357658", "0.73568285", "0.7344076", "0.7294106", "0.7279736", "0.72420436", "0.7235667", "0.7217714...
0.7785249
7
SetValueName sets the valueName property value. The registry value name
func (m *Win32LobAppRegistryDetection) SetValueName(value *string)() { err := m.GetBackingStore().Set("valueName", value) if err != nil { panic(err) } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func (m *Win32LobAppRegistryRule) SetValueName(value *string)() {\n m.valueName = value\n}", "func (m *DeviceManagementConfigurationSettingDefinition) SetName(value *string)() {\n err := m.GetBackingStore().Set(\"name\", value)\n if err != nil {\n panic(err)\n }\n}", "func (m *RegistryKeySta...
[ "0.78868264", "0.7496409", "0.73644394", "0.7253709", "0.7116289", "0.7098057", "0.7074809", "0.68688095", "0.68526214", "0.6824271", "0.6811829", "0.67920977", "0.6751485", "0.6687682", "0.6659015", "0.6655721", "0.6622989", "0.6557222", "0.6513872", "0.65062916", "0.6446837...
0.8065578
0
/ SignRequest uses a preshared secret to generate a signature that RTM will verify. You should set the api_sig parameter with the return value.
func SignRequest(params map[string]string) string { keys := make([]string, len(params)) for key := range params { keys = append(keys, key) } pairs := make([]string, len(keys)) sort.Strings(keys) for idx, key := range keys { pairs[idx] = key + params[key] } slug := []byte(SharedSecret + strings.Join(pairs, "")) return fmt.Sprintf("%x", md5.Sum(slug)) }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func (r *RPCRequest) GenerateSig(key, secret string) error {\n\tif len(key) == 0 || len(secret) == 0 {\n\t\treturn errors.New(\"You must supply an access key and an access secret\")\n\t}\n\tnonce := time.Now().UnixNano() / int64(time.Millisecond)\n\tsigString := fmt.Sprintf(\"_=%d&_ackey=%s&_acsec=%s&_action=%s\",...
[ "0.6788081", "0.67776895", "0.6675929", "0.6542208", "0.63614374", "0.6207327", "0.61996496", "0.61905056", "0.6190193", "0.6114812", "0.6018926", "0.59692407", "0.59104216", "0.58937895", "0.58937895", "0.58688444", "0.5864342", "0.5819719", "0.58161354", "0.57641745", "0.57...
0.6311796
5
/ FormURL creates a URL that you can use for making API requests or authenticating your users.
func FormURL(baseURL string, method string, params map[string]string) *url.URL { u, err := url.Parse(baseURL) if err != nil { log.Fatalf("Failed to set root URL: %s\n", err) } params["method"] = method params["format"] = "json" log.WithField("params", params).Debug("got arguments for request") query := u.Query() for key, value := range params { query.Set(key, value) } query.Set("api_sig", SignRequest(params)) u.RawQuery = query.Encode() log.Debugf("creating URL: %s", u) return u }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func URLform(url, body string) (result string) {\n\tresult = fmt.Sprintf(`[%s](%s)`, body, url)\n\treturn\n}", "func (c *Client) URLFormCall(ctx context.Context, endpoint string, qv url.Values, resp interface{}) error {\n\tif len(qv) == 0 {\n\t\treturn fmt.Errorf(\"URLFormCall() requires qv to have non-zero leng...
[ "0.66246676", "0.6007513", "0.59628695", "0.5916297", "0.5916297", "0.58256966", "0.5766045", "0.5760121", "0.571929", "0.56557834", "0.5648642", "0.5600497", "0.55815196", "0.5578678", "0.55533004", "0.5527532", "0.54867375", "0.5465737", "0.5420745", "0.5400873", "0.5374359...
0.771264
0
/ Get will issue a HTTP request using the GET verb.
func GetMethod(method string, args map[string]string, unmarshal func([]byte) error) error { requestURL := FormURL(rootURL, method, args) resp, err := myClient.Get(requestURL.String()) if err != nil { return err } defer resp.Body.Close() body, err := ioutil.ReadAll(resp.Body) if err != nil { return err } var prettyJSON bytes.Buffer err = json.Indent(&prettyJSON, body, "", "\t") if err != nil { return err } log.Debugf("RTM API response: %s", string(prettyJSON.Bytes())) var errorMessage RTMAPIError if err := json.Unmarshal(body, &errorMessage); err != nil { log.WithFields(log.Fields{ "error": err, }).Fatal("Failed to unmarshal api response.") return err } if errorMessage.Rsp.Stat == "fail" { return &errorMessage } if err := unmarshal(body); err != nil { log.WithFields(log.Fields{ "error": err, }).Fatal("Failed to unmarshal api response.") return err } log.Debug("Completed API request.") return nil }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func (c *Client) Get(url string, headers, queryParams map[string][]string) (response *http.Response, err error) {\n\treturn c.makeRequest(url, http.MethodGet, headers, queryParams, nil)\n}", "func (e *Expect) GET(path string, pathargs ...interface{}) *Request {\n\treturn e.Request(http.MethodGet, path, pathargs....
[ "0.78753054", "0.78579533", "0.7827149", "0.7813404", "0.77999794", "0.7761369", "0.7639451", "0.7599825", "0.7589636", "0.7552103", "0.75378567", "0.74897224", "0.7464658", "0.74478674", "0.7400398", "0.73652476", "0.7360117", "0.7359701", "0.73462594", "0.7337866", "0.73214...
0.0
-1
Document the API: GET /new > gets new Madlib instance key; this tracks state for a madlib in progress GET /next > retrieves the prompt. Returns same prompt until they POST the answer. When there are no more prompts, this returns the filled out madlib. Also has bool flag if it is done or not. POST /answer > answers the prompt with a string
func NewMadlibServer(addr string, madlibs []MadlibTemplate) *MadlibServer { return &MadlibServer{ addr: addr, madlibs: madlibs, ongoing: make(map[string]*Madlib), } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func NewQuestion() {\n\tNumAnswers = make(map[string]int)\n\n\tsetRandomQuestion()\n\tvar NewQuestionMessage = fmt.Sprintf(\"A new question, you have %d seconds to answer it!\", TimeToAnswer)\n\tsendMessageToActiveChannels(NewQuestionMessage)\n\tQuestionTimer = time.NewTimer(time.Second * TimeToAnswer)\n\tgo func(...
[ "0.46312624", "0.45138684", "0.4507138", "0.43851736", "0.4359447", "0.42989373", "0.42974252", "0.42900527", "0.428464", "0.42529526", "0.4235715", "0.42216453", "0.4219072", "0.4216278", "0.42030713", "0.4199196", "0.41739607", "0.41704628", "0.41687834", "0.41605356", "0.4...
0.0
-1
Given an array of positive integers target and an array initial of same size with all zeros. Return the minimum number of operations to form a target array from initial if you are allowed to do the following operation: Choose any subarray from initial and increment each value by one. The answer is guaranteed to fit within the range of a 32bit signed integer. Example 1: Input: target = [1,2,3,2,1] Output: 3 Explanation: We need at least 3 operations to form the target array from the initial array. [0,0,0,0,0] increment 1 from index 0 to 4 (inclusive). [1,1,1,1,1] increment 1 from index 1 to 3 (inclusive). [1,2,2,2,1] increment 1 at index 2. [1,2,3,2,1] target array is formed. Example 2: Input: target = [3,1,1,2] Output: 4 Explanation: (initial)[0,0,0,0] > [1,1,1,1] > [1,1,1,2] > [2,1,1,2] > [3,1,1,2] (target). Example 3: Input: target = [3,1,5,4,2] Output: 7 Explanation: (initial)[0,0,0,0,0] > [1,1,1,1,1] > [2,1,1,1,1] > [3,1,1,1,1] > [3,1,2,2,2] > [3,1,3,3,2] > [3,1,4,4,2] > [3,1,5,4,2] (target). Example 4: Input: target = [1,1,1,1] Output: 1 Constraints: 1 <= target.length <= 10^5 1 <= target[i] <= 10^5 simple O(n) solution:
func minNumberOperationsOn(target []int) int { sum := target[0] for i:=1; i<len(target); i++ { // it's easy to understand: // every larger number than prev need to increase by its own // every smaller number than prev can be covered by prev larger number if target[i]>target[i-1] { sum += target[i]-target[i-1] } } return sum }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func closestToTarget(arr []int, target int) int {\n\tmin := math.MaxInt32\n\tsize := len(arr)\n\n\tandProducts := make([]int, 0)\n\n\tfor r := 0; r < size; r++ {\n\t\tfor i := 0; i < len(andProducts); i++ {\n\t\t\tandProducts[i] &= arr[r]\n\t\t}\n\t\tandProducts = append(andProducts, arr[r])\n\t\tsort.Ints(andProd...
[ "0.6181356", "0.5764789", "0.5685976", "0.56609714", "0.5647986", "0.5613157", "0.54398996", "0.5425992", "0.5423529", "0.54122925", "0.5385608", "0.53834355", "0.53657883", "0.5365726", "0.5328744", "0.5317138", "0.5295888", "0.5199396", "0.51928216", "0.5167618", "0.5157009...
0.6858109
0
tree[ind]=x where data[x] = min(data[left...right])
func build(tree, data []int, ind, left, right int) { if left == right { tree[ind] = left return } leftSub, rightSub, mid := ind*2+1, ind*2+2, left+(right-left)/2 build(tree, data, leftSub, left, mid) build(tree, data, rightSub, mid+1, right) // merge two sub trees if data[tree[leftSub]] <= data[tree[rightSub]] { // prefer left index if tie tree[ind] = tree[leftSub] } else { tree[ind] = tree[rightSub] } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func query(tree, data []int, ind, left, right, queryLeft, queryRight int) (minInd int) {\n\t// query range is equal to tree range\n\tif left==queryLeft && right==queryRight {\n\t\treturn tree[ind]\n\t}\n\tleftSub, rightSub, mid := ind*2+1, ind*2+2, left+(right-left)/2\n\n\tif queryRight<=mid { // query rang...
[ "0.65579015", "0.63982654", "0.6077484", "0.6045773", "0.6023213", "0.59858984", "0.59344995", "0.5929177", "0.58831096", "0.5850334", "0.5849182", "0.5813741", "0.58136743", "0.5782743", "0.577138", "0.5654119", "0.56292677", "0.5617895", "0.5615513", "0.56151456", "0.556425...
0.6383897
2
query min value index
func query(tree, data []int, ind, left, right, queryLeft, queryRight int) (minInd int) { // query range is equal to tree range if left==queryLeft && right==queryRight { return tree[ind] } leftSub, rightSub, mid := ind*2+1, ind*2+2, left+(right-left)/2 if queryRight<=mid { // query range in left sub tree return query(tree, data, leftSub, left, mid, queryLeft, queryRight) } else if queryLeft>mid { // query range in right sub tree return query(tree, data, rightSub, mid+1, right, queryLeft, queryRight) } // else, query in both sub trees l := query(tree, data, leftSub, left, mid, queryLeft, mid) r := query(tree, data, rightSub, mid+1, right, mid+1, queryRight) // merge result for sub trees if data[l] <= data[r] { // prefer left index if tie return l } return r }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func (t *Indexed) Min(i, j int) int {\n\treturn -1\n}", "func (s *GoSort) FindMinElementAndIndex() (interface{}, int) {\n var index = 0\n \n for i := 1; i < s.Len(); i++ {\n if s.LessThan(i, index) {\n index = i\n }\n }\n return s.values[index], index\n}", "func minIndex(slice []float64) int {\...
[ "0.6968053", "0.68700284", "0.67979103", "0.67292726", "0.65732807", "0.6550194", "0.6415493", "0.6412388", "0.6291479", "0.62318045", "0.62206954", "0.61924726", "0.6145002", "0.610618", "0.6099185", "0.60543025", "0.60209656", "0.60148805", "0.5997986", "0.5984362", "0.5963...
0.0
-1
NewSTSManager implements AWS GO SDK
func NewSTSManager(client STSClientDescriptor) *STSManager { return &STSManager{ client: client, } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func newClient() *sts.STS {\n\tsess := session.Must(session.NewSessionWithOptions(session.Options{\n\t\tSharedConfigState: session.SharedConfigEnable,\n\t}))\n\tconfig := aws.NewConfig()\n\tif debug {\n\t\tconfig.WithLogLevel(aws.LogDebugWithHTTPBody)\n\t}\n\treturn sts.New(sess, config)\n}", "func RunCreateAWSS...
[ "0.61317915", "0.58017105", "0.55611104", "0.5475019", "0.5471191", "0.54304373", "0.5389638", "0.52249086", "0.5190177", "0.51850677", "0.5169422", "0.51638", "0.50995004", "0.5093693", "0.5084769", "0.50710386", "0.50554657", "0.5037815", "0.5034028", "0.5019643", "0.501951...
0.55637866
2
MiddleRow takes a slice of 3 string slices (each representing a row in a 2d matrix, with each element position respresenting a column), and interpolates "nan" values as the average of nondiagonal adjacent values, which must be string representations of numbers, or "nan". There must be 3 rows. All rows must be equal length. It returns a copy of the middle row with any "nan" values interpolated and rounded to decimalPlaces decimal places.
func MiddleRow(rows [][]string, decimalPlaces int) []string { middleRow := rows[1] result := make([]string, len(middleRow)) for i, val := range middleRow { if isNaN(val) { result[i] = averageOf( decimalPlaces, valueAt(rows[0], i), valueAt(rows[2], i), valueLeftOf(middleRow, i), valueRightOf(middleRow, i), ) } else { result[i] = val } } return result }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func GetMiddleValue(array []float64) float64 {\n\t//Create a variable of float64 (it will be middle value)\n\tvar number float64\n\t//This a loop like foreach(...) in C#\n\t//renge return index and value of each element from time row\n\t//here number will had a sum of all element\n\tfor _, v := range array {\n\t\t...
[ "0.51766354", "0.46247548", "0.44273514", "0.440374", "0.42990997", "0.40641436", "0.40119344", "0.39859194", "0.39596558", "0.39416143", "0.39316308", "0.39045584", "0.38995808", "0.38463324", "0.38020673", "0.37773892", "0.3768565", "0.3753118", "0.37261394", "0.37159556", ...
0.72314984
0
isNaN returns true if the given string can't be interpreted as a number.
func isNaN(val string) bool { if val == nan { return true } _, err := strconv.ParseFloat(val, 64) return err != nil }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func isNum(str string) bool {\n\t_, err := strconv.Atoi(str)\n\treturn err == nil\n}", "func IsNumber(s string) bool {\n\tif len(s) == 0 {\n\t\treturn false\n\t}\n\tfor _, r := range s {\n\t\tif !unicode.IsDigit(r) {\n\t\t\treturn false\n\t\t}\n\t}\n\treturn true\n}", "func IsNumeric(str string) bool {\n\tif I...
[ "0.7339016", "0.7253218", "0.7231997", "0.7182083", "0.71742797", "0.71524066", "0.71469444", "0.7066914", "0.7063223", "0.70044315", "0.69450045", "0.69221175", "0.69198877", "0.6898566", "0.68668354", "0.67863667", "0.6740267", "0.6620472", "0.6603828", "0.65644425", "0.650...
0.7575007
0
averageOf returns the average of the given floats as a string, rounded to decimalPlaces decimal places. You can supply nil floats and they will be ignored. If you only supply nils, nan will be returned.
func averageOf(decimalPlaces int, floats ...*float64) string { var total, num float64 for _, f := range floats { if f == nil { continue } num++ total += *f } if num == 0 { return nan } return strconv.FormatFloat(total/num, 'f', decimalPlaces, 64) }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func average(sf ...float64) float64 {\n\ttotal := 0.0\n\tfor _, v := range sf {\n\t\ttotal = total + v\n\n\t}\n\treturn total / float64(len(sf))\n}", "func Average(values ...float64) float64 {\n\tsum := Sum(values...)\n\treturn sum / float64(len(values))\n}", "func main() {\n xs := []float64{98,93,77,82,83}\n...
[ "0.5841493", "0.5782948", "0.5645542", "0.5613625", "0.5547251", "0.5530482", "0.55288845", "0.5513027", "0.54758036", "0.54725236", "0.5438258", "0.5416996", "0.53414214", "0.5296177", "0.52899706", "0.5284825", "0.52583843", "0.5235746", "0.5230519", "0.5230519", "0.5128516...
0.7826473
0
valueAt returns the stringToFloat() of the value in the row at the given index position. If row is nil, returns nil.
func valueAt(row []string, position int) *float64 { if row == nil { return nil } return stringToFloat(row[position]) }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func getValueAt(index int, colName string, header *[]string, content *[][]string) (string, error) {\n\n\tif index == -1 {\n\t\treturn \"0.0\", nil\n\t}\n\tindexCol := findIndex(colName, header)\n\tif indexCol < 0 {\n\t\treturn \"\", fmt.Errorf(\"column %s not found\", colName)\n\t}\n\tval := (*content)[index][inde...
[ "0.75364584", "0.6123415", "0.6121763", "0.6119237", "0.61098325", "0.6106026", "0.6010408", "0.59776723", "0.59278715", "0.58837295", "0.5854869", "0.58399117", "0.57418776", "0.56525666", "0.5634338", "0.56315815", "0.5627601", "0.56131566", "0.5574433", "0.55499494", "0.55...
0.8536682
0
stringToFloat converts the given string to a float. If the string is "nan", or otherwise not interpretable as a float, returns nil.
func stringToFloat(num string) *float64 { if num == nan { return nil } f, err := strconv.ParseFloat(num, 64) if err != nil { return nil } return &f }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func StringToFloat(str String) Float {\n\tv := &stringToFloat{from: str}\n\tstr.AddListener(v)\n\treturn v\n}", "func StringToFloat(param string) float64 {\n\tval, _ := strconv.ParseFloat(param, 10)\n\treturn val\n}", "func (u *Util) StringToFloat(value interface{}) (number float32, err error) {\n number = ...
[ "0.8082372", "0.7937381", "0.7389342", "0.7340307", "0.73294926", "0.73089814", "0.7286272", "0.7238494", "0.7159106", "0.7103468", "0.70908254", "0.69628805", "0.6879595", "0.6753214", "0.6728125", "0.65932554", "0.6590158", "0.65481657", "0.65481657", "0.65408546", "0.65239...
0.83623695
0
valueLeftOf returns the stringToFloat() of the value to the left of the given index in the row. If i is 0, returns nil.
func valueLeftOf(row []string, position int) *float64 { if position <= 0 { return nil } return stringToFloat(row[position-1]) }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func valueRightOf(row []string, position int) *float64 {\n\tif position >= len(row)-1 {\n\t\treturn nil\n\t}\n\n\treturn stringToFloat(row[position+1])\n}", "func (o *WorkbookChart) GetLeft() AnyOfnumberstringstring {\n\tif o == nil || o.Left == nil {\n\t\tvar ret AnyOfnumberstringstring\n\t\treturn ret\n\t}\n\t...
[ "0.63793755", "0.60753334", "0.5925222", "0.5773447", "0.57536495", "0.57357925", "0.56298304", "0.5471403", "0.5449241", "0.5393281", "0.5390063", "0.5386777", "0.5379932", "0.53666055", "0.53522307", "0.5348878", "0.53427994", "0.5301268", "0.5254871", "0.5244777", "0.52074...
0.8459729
0
valueRightOf returns the stringToFloat() of the value to the right of the given index in the row. If i is the last element, returns nil.
func valueRightOf(row []string, position int) *float64 { if position >= len(row)-1 { return nil } return stringToFloat(row[position+1]) }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func valueLeftOf(row []string, position int) *float64 {\n\tif position <= 0 {\n\t\treturn nil\n\t}\n\n\treturn stringToFloat(row[position-1])\n}", "func (b *Bound) Right() float64 {\n\treturn b.ne[0]\n}", "func Right(i int) int {\n\treturn 2*i + 1\n}", "func (self SimpleInterval) Right() float64 {\n\treturn ...
[ "0.6006863", "0.59945416", "0.5970664", "0.5819593", "0.5782678", "0.5774075", "0.5750997", "0.56056243", "0.56044173", "0.5571784", "0.55708253", "0.5532962", "0.5486794", "0.54614246", "0.5410383", "0.53747565", "0.53538173", "0.5330816", "0.53068346", "0.52522296", "0.5182...
0.84193784
0
NextRow returns the next row of CSV data as a slice of strings, with any nan values in the input data replaced with interpreted values.
func (c *CSVInterpolator) NextRow() ([]string, error) { c.row++ rowsToGet := c.numRows() rows, err := c.rp.GetRows(c.rowToStartWith(), rowsToGet) if err != nil { return nil, err } if rowsToGet != rowsNeededToInterpolate { rows = [][]string{nil, rows[0], rows[1]} } if rows[1] == nil { return nil, io.EOF } return MiddleRow(rows, c.decimalPlaces), nil }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func (sv *sorterValues) NextRow() sqlbase.EncDatumRow {\n\tif len(sv.rows) == 0 {\n\t\treturn nil\n\t}\n\n\tx := heap.Pop(sv)\n\treturn *x.(*sqlbase.EncDatumRow)\n}", "func (ds *Dataset) Next() ([]float64, error) {\n\tds.lock.Lock()\n\tdefer ds.lock.Unlock()\n\tif ds.Mtx == nil {\n\t\treturn nil, ErrNoData\n\t}\...
[ "0.5889878", "0.57259405", "0.57251215", "0.56501406", "0.56458294", "0.56086314", "0.5569356", "0.5569176", "0.54771554", "0.54464453", "0.542114", "0.5378522", "0.5372761", "0.53529674", "0.53516585", "0.53472406", "0.5343415", "0.5331963", "0.53126574", "0.52973896", "0.52...
0.73612094
0
numRows returns 3, except at start.
func (c *CSVInterpolator) numRows() int64 { if c.row == 1 { return rowsNeededToInterpolate - 1 } return rowsNeededToInterpolate }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func (self *T) Rows() int {\n\treturn 2\n}", "func (self *T) Rows() int {\n\treturn 2\n}", "func (c ColDecimal32) Rows() int {\n\treturn len(c)\n}", "func (c ColDecimal256) Rows() int {\n\treturn len(c)\n}", "func (c ColBool) Rows() int {\n\treturn len(c)\n}", "func row(k int) int { return k % 4 }", "f...
[ "0.6365174", "0.6365174", "0.62216914", "0.618833", "0.59803337", "0.59444803", "0.5942407", "0.5911823", "0.58158314", "0.57634497", "0.57372934", "0.56988037", "0.5666907", "0.56184083", "0.55306053", "0.5523928", "0.54944867", "0.5483164", "0.5455977", "0.54121286", "0.541...
0.64513195
0
rowToStartWith returns c.row1, except at start.
func (c *CSVInterpolator) rowToStartWith() int64 { if c.row == 1 { return 1 } return c.row - 1 }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func lineStart(f *token.File, line int) token.Pos {\n\t// Use binary search to find the start offset of this line.\n\t//\n\t// TODO(rstambler): eventually replace this function with the\n\t// simpler and more efficient (*go/token.File).LineStart, added\n\t// in go1.12.\n\n\tmin := 0 // inclusive\n\tmax := f...
[ "0.6097574", "0.6046121", "0.564214", "0.5352695", "0.53002346", "0.5286634", "0.52708083", "0.52110296", "0.51418424", "0.5137238", "0.5119742", "0.5109105", "0.5045511", "0.50126594", "0.49783966", "0.49702695", "0.49633923", "0.49345207", "0.49129394", "0.4888165", "0.4882...
0.8255374
0
XXX_OneofWrappers is for the internal use of the proto package.
func (*CampaignExtensionSettingOperation) XXX_OneofWrappers() []interface{} { return []interface{}{ (*CampaignExtensionSettingOperation_Create)(nil), (*CampaignExtensionSettingOperation_Update)(nil), (*CampaignExtensionSettingOperation_Remove)(nil), } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func (*DRB) XXX_OneofWrappers() []interface{} {\n\treturn []interface{}{\n\t\t(*DRB_NotUsed)(nil),\n\t\t(*DRB_Rohc)(nil),\n\t\t(*DRB_UplinkOnlyROHC)(nil),\n\t}\n}", "func (*Interface) XXX_OneofWrappers() []interface{} {\n\treturn []interface{}{\n\t\t(*Interface_Sub)(nil),\n\t\t(*Interface_Memif)(nil),\n\t\t(*Int...
[ "0.8822406", "0.8802782", "0.8744387", "0.8744387", "0.8744387", "0.8744387", "0.8718898", "0.8718898", "0.8715439", "0.871463", "0.8701507", "0.8701507", "0.8700693", "0.8688847", "0.8680149", "0.8676449", "0.86735517", "0.86709", "0.8667012", "0.8652376", "0.8647903", "0....
0.0
-1
sendRequest sends a HTTP request to the macaddress API.
func (c *Client) sendRequest(method, term string, body io.Reader) (*http.Response, error) { // Compose URL rel := &url.URL{} targetURL := c.BaseURL.ResolveReference(rel) // Write body var buf io.ReadWriter if body != nil { buf = new(bytes.Buffer) err := json.NewEncoder(buf).Encode(body) if err != nil { return nil, err } } // New HTTP GET request req, err := http.NewRequest(method, targetURL.String(), body) if err != nil { return nil, err } if body != nil { req.Header.Set("Content-Type", "application/json") } req.Header.Set("Accept", "application/json") // Add api key to query if c.APIKey != "" { q := url.Values{} q.Add("apiKey", c.APIKey) q.Add("output", c.Output) q.Add("search", term) req.URL.RawQuery = q.Encode() } // log.Printf("Doing request: %s", targetURL.String()) return (c.httpClient).Do(req) }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func (b *BitcoinClient) sendRequest(req *http.Request) (*http.Response, error) {\n\tres, err := b.Client.Do(req)\n\tif err != nil {\n\t\tlog.Println(ErrUnresponsive)\n\t\treturn nil, ErrUnresponsive\n\t}\n\n\treturn res, nil\n}", "func sendRequest(c net.Conn, mti string) {\n\tconnectionId := c.RemoteAddr().Strin...
[ "0.6527724", "0.6464387", "0.59520745", "0.5895073", "0.58694565", "0.5826567", "0.57553387", "0.5727773", "0.56963766", "0.5684396", "0.55931616", "0.55735636", "0.5555725", "0.54407734", "0.54397285", "0.5354053", "0.533775", "0.5321918", "0.5321016", "0.53103495", "0.53047...
0.56158775
10
Search term: MAC address or OUI
func (c *Client) Search(term string) (*Response, error) { httpResp, err := c.sendRequest("GET", term, nil) if err != nil { return nil, err } result := &Response{} if httpResp.StatusCode == http.StatusOK { defer httpResp.Body.Close() body, err := ioutil.ReadAll(httpResp.Body) if err != nil { return nil, err } err = json.Unmarshal(body, &result) if err != nil { return nil, err } return result, nil } var ErrNotFound = errors.New("Error with status code " + strconv.Itoa(httpResp.StatusCode)) return nil, ErrNotFound }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func findMacFromIPInArpTable(ip string) string {\n\tfile, err := os.Open(\"/proc/net/arp\")\n\tdefer file.Close()\n\n\tif err != nil {\n\t\tlog.Fatalf(\"Failed to open /proc/net/route\")\n\t}\n\tscanner := bufio.NewScanner(file)\n\tscanner.Split(bufio.ScanLines)\n\n\tscanner.Scan() // skip first line as it's a hea...
[ "0.66006845", "0.6512171", "0.6030407", "0.572997", "0.5663973", "0.5466286", "0.54406816", "0.5429834", "0.5425368", "0.5382587", "0.53788114", "0.5336779", "0.5320087", "0.53059417", "0.5297832", "0.52759004", "0.5225848", "0.5139628", "0.51170194", "0.50876766", "0.5087676...
0.0
-1
GetVendor vendor company name only, in text format. return "" for any errors
func (c *Client) GetVendor(term string) string { c.Output = "vendor" result := "" httpResp, err := c.sendRequest("GET", term, nil) if err != nil { return result } if httpResp.StatusCode == http.StatusOK { defer httpResp.Body.Close() body, err := ioutil.ReadAll(httpResp.Body) if err != nil { return result } result = string(body) } return result }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func (d UserData) CommercialCompanyName() string {\n\tval := d.ModelData.Get(models.NewFieldName(\"CommercialCompanyName\", \"commercial_company_name\"))\n\tif !d.Has(models.NewFieldName(\"CommercialCompanyName\", \"commercial_company_name\")) {\n\t\treturn *new(string)\n\t}\n\treturn val.(string)\n}", "func (o ...
[ "0.6398742", "0.6362965", "0.63377017", "0.6300475", "0.62950224", "0.6259747", "0.6256496", "0.61700916", "0.61029965", "0.60014296", "0.59904176", "0.598609", "0.59651405", "0.5959669", "0.5917091", "0.5840147", "0.5808993", "0.5797002", "0.5779641", "0.5743736", "0.5726435...
0.7025577
0
TransformAccount converts an account from the history archive ingestion system into a form suitable for BigQuery
func TransformAccount(ledgerChange ingestio.Change) (AccountOutput, error) { ledgerEntry, outputDeleted, err := utils.ExtractEntryFromChange(ledgerChange) if err != nil { return AccountOutput{}, err } accountEntry, accountFound := ledgerEntry.Data.GetAccount() if !accountFound { return AccountOutput{}, fmt.Errorf("Could not extract account data from ledger entry; actual type is %s", ledgerEntry.Data.Type) } outputID, err := accountEntry.AccountId.GetAddress() if err != nil { return AccountOutput{}, err } outputBalance := int64(accountEntry.Balance) if outputBalance < 0 { return AccountOutput{}, fmt.Errorf("Balance is negative (%d) for account: %s", outputBalance, outputID) } //The V1 struct is the first version of the extender from accountEntry. It contains information on liabilities, and in the future //more extensions may contain extra information accountExtensionInfo, V1Found := accountEntry.Ext.GetV1() var outputBuyingLiabilities, outputSellingLiabilities int64 if V1Found { liabilities := accountExtensionInfo.Liabilities outputBuyingLiabilities, outputSellingLiabilities = int64(liabilities.Buying), int64(liabilities.Selling) if outputBuyingLiabilities < 0 { return AccountOutput{}, fmt.Errorf("The buying liabilities count is negative (%d) for account: %s", outputBuyingLiabilities, outputID) } if outputSellingLiabilities < 0 { return AccountOutput{}, fmt.Errorf("The selling liabilities count is negative (%d) for account: %s", outputSellingLiabilities, outputID) } } outputSequenceNumber := int64(accountEntry.SeqNum) if outputSequenceNumber < 0 { return AccountOutput{}, fmt.Errorf("Account sequence number is negative (%d) for account: %s", outputSequenceNumber, outputID) } outputNumSubentries := uint32(accountEntry.NumSubEntries) inflationDestAccountID := accountEntry.InflationDest var outputInflationDest string if inflationDestAccountID != nil { outputInflationDest, err = inflationDestAccountID.GetAddress() if err != nil { return AccountOutput{}, err } } outputFlags := uint32(accountEntry.Flags) outputHomeDomain := string(accountEntry.HomeDomain) outputMasterWeight := int32(accountEntry.MasterKeyWeight()) outputThreshLow := int32(accountEntry.ThresholdLow()) outputThreshMed := int32(accountEntry.ThresholdMedium()) outputThreshHigh := int32(accountEntry.ThresholdHigh()) outputLastModifiedLedger := uint32(ledgerEntry.LastModifiedLedgerSeq) transformedAccount := AccountOutput{ AccountID: outputID, Balance: outputBalance, BuyingLiabilities: outputBuyingLiabilities, SellingLiabilities: outputSellingLiabilities, SequenceNumber: outputSequenceNumber, NumSubentries: outputNumSubentries, InflationDestination: outputInflationDest, Flags: outputFlags, HomeDomain: outputHomeDomain, MasterWeight: outputMasterWeight, ThresholdLow: outputThreshLow, ThresholdMedium: outputThreshMed, ThresholdHigh: outputThreshHigh, LastModifiedLedger: outputLastModifiedLedger, Deleted: outputDeleted, } return transformedAccount, nil }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func (acc *BaseAccount) ConvertAccount(cdc codec.Marshaler) interface{} {\n\taccount := sdk.BaseAccount{\n\t\tAddress: acc.Address,\n\t\tAccountNumber: acc.AccountNumber,\n\t\tSequence: acc.Sequence,\n\t}\n\n\tvar pkStr string\n\tif acc.PubKey == nil {\n\t\treturn account\n\t}\n\n\tvar pk crypto.PubKey\...
[ "0.6316797", "0.55070037", "0.5405292", "0.53862804", "0.5345793", "0.5311514", "0.53047794", "0.522594", "0.52171564", "0.51677674", "0.5159792", "0.50788945", "0.5050137", "0.5047248", "0.5041177", "0.49972457", "0.49734724", "0.49655464", "0.49417832", "0.4909045", "0.4907...
0.704444
0
equal compares two string slices and determines if they are the same.
func equal(left, right []string) bool { if len(left) != len(right) { return false } for i, value := range left { if value != right[i] { return false } } return true }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func equalStringSlice(a, b []string) bool {\n\tif len(a) != len(b) {\n\t\treturn false\n\t}\n\n\tfor i := 0; i < len(a); i++ {\n\t\tif a[i] != b[i] {\n\t\t\treturn false\n\t\t}\n\t}\n\n\treturn true\n}", "func equalSlice(a, b []string) bool {\n\tif len(a) != len(b) {\n\t\treturn false\n\t}\n\tfor i, v := range a...
[ "0.82696867", "0.8176309", "0.8130287", "0.80586714", "0.80283535", "0.8026674", "0.802485", "0.7932646", "0.78799474", "0.7861998", "0.7798794", "0.77114105", "0.7710674", "0.765556", "0.7647003", "0.7531228", "0.75034845", "0.747733", "0.74554133", "0.7453913", "0.74116373"...
0.7105393
30
DefaultRegions returns the default regions supported by AWS NOTE: in the future this list is subject to change
func DefaultRegions() []string { return []string{ "us-east-2", "us-east-1", "us-west-1", "us-west-2", "ap-south-1", "ap-northeast-2", "ap-southeast-1", "ap-northeast-1", "ca-central-1", "eu-central-1", "eu-west-1", "eu-west-2", "sa-east-1", } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func GetRegions() ([]Region, error) {\n\tvar regions []Region\n\tarvanConfig := config.GetConfigInfo()\n\tarvanServer := arvanConfig.GetServer()\n\thttpReq, err := http.NewRequest(\"GET\", arvanServer+apiPrefix+defaultRegion+regionsEndpoint, nil)\n\tif err != nil {\n\t\treturn regions, err\n\t}\n\thttpReq.Header.A...
[ "0.67417514", "0.6694488", "0.6682156", "0.6320248", "0.6286656", "0.62777525", "0.624572", "0.6207566", "0.615566", "0.61505497", "0.60743976", "0.6033399", "0.6031638", "0.5974638", "0.59483427", "0.59098995", "0.59002", "0.58779293", "0.5810828", "0.57788986", "0.57502174"...
0.886901
0
trackConfigFileChanges monitors the host file using fsnotfiy
func trackConfigFileChanges(ctx context.Context, configFilePath string) { watcher, err := fsnotify.NewWatcher() if err != nil { logs.LogWithFields(ctx).Error(err.Error()) } err = watcher.Add(configFilePath) if err != nil { logs.LogWithFields(ctx).Error(err.Error()) } go func() { for { select { case fileEvent, ok := <-watcher.Events: if !ok { continue } if fileEvent.Op&fsnotify.Write == fsnotify.Write || fileEvent.Op&fsnotify.Remove == fsnotify.Remove { logs.LogWithFields(ctx).Info("modified file:" + fileEvent.Name) // update the host file addHost(ctx, configFilePath) } //Reading file to continue the watch watcher.Add(configFilePath) case err, _ := <-watcher.Errors: if err != nil { logs.LogWithFields(ctx).Error(err.Error()) defer watcher.Close() } } } }() }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func watcher(configModel model.Config) {\n\t// Set the client variable\n\tconfig.Client = configModel.Client.Name\n\n\twatcher, err := fsnotify.NewWatcher()\n\tif err != nil {\n\t\tlog.Fatal(err)\n\t}\n\tdefer watcher.Close()\n\n\tdone := make(chan struct{})\n\tgo func() {\n\t\tfor {\n\t\t\tselect {\n\t\t\tcase ev...
[ "0.64610916", "0.60868067", "0.59415656", "0.58568406", "0.57661414", "0.5655298", "0.5644092", "0.56246734", "0.55102056", "0.54824513", "0.53973293", "0.5292508", "0.51622623", "0.5124967", "0.5093944", "0.50582874", "0.50582874", "0.5034627", "0.5031129", "0.50048363", "0....
0.8317628
0
createContext creates a new context based on transactionId, actionId, actionName, threadId, threadName, ProcessName
func createContext(transactionID, actionID, actionName, threadID, threadName, ProcessName string) context.Context { ctx := context.Background() ctx = context.WithValue(ctx, common.TransactionID, transactionID) ctx = context.WithValue(ctx, common.ActionID, actionID) ctx = context.WithValue(ctx, common.ActionName, actionName) ctx = context.WithValue(ctx, common.ThreadID, threadID) ctx = context.WithValue(ctx, common.ThreadName, threadName) ctx = context.WithValue(ctx, common.ProcessName, ProcessName) return ctx }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func createContext(fhandler *flowHandler) *faasflow.Context {\n\tcontext := faasflow.CreateContext(fhandler.id, \"\",\n\t\tflowName, fhandler.dataStore)\n\tcontext.Query, _ = url.ParseQuery(fhandler.query)\n\n\treturn context\n}", "func (c *Constructor) createScenarioContext(\n\tsender string,\n\tsenderValue *bi...
[ "0.6263343", "0.61419773", "0.5849903", "0.58492774", "0.5811859", "0.5775802", "0.5727892", "0.5718235", "0.5710522", "0.568639", "0.56555706", "0.56526494", "0.56184673", "0.5586914", "0.5569361", "0.5552532", "0.5536888", "0.55319023", "0.5531659", "0.5525962", "0.552445",...
0.81415343
0
main function that will create the client.
func main() { //predef of 4 languages languages[0] = "english" languages[1] = "日本語" languages[2] = "deutsch" languages[3] = "svenska" //starting client client() }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func main() {\n\terr := clientMain()\n\tif err != nil {\n\t\tpanic(err)\n\t}\n}", "func main() {\n\terr := runClient()\n\tif err != nil {\n\t\tlog.Fatalln(err.Error())\n\t}\n\n\treturn\n}", "func mainClient() {\n\tfmt.Println(\"Starting Tramservice client\")\n\tclient := new(tramservice.Client)\n\terr := clien...
[ "0.7755232", "0.7747002", "0.77198035", "0.7177006", "0.7107686", "0.6922277", "0.68362284", "0.6815787", "0.6778457", "0.6763634", "0.67444175", "0.6730545", "0.66647184", "0.6656747", "0.6648715", "0.6639354", "0.66306657", "0.662526", "0.66167915", "0.6612979", "0.65890753...
0.6335857
48
Easyer way to check error, exit program if error
func check(err error) { if (err != nil) { fmt.Println(err) os.Exit(1) } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func checkError(e error) {\n\tif e != nil {\n\t\tfmt.Println(e)\n\t\tos.Exit(1)\n\t}\n}", "func checkError(msg string, err error, exit bool) {\n\tif err != nil {\n\t\tlog.Println(msg, err)\n\t\tif exit {\n\t\t\tos.Exit(-1)\n\t\t}\n\t}\n}", "func checkError(msg string, err error, exit bool) {\n\tif err != nil {...
[ "0.76099515", "0.7536181", "0.7536181", "0.75227296", "0.751925", "0.7471282", "0.7390577", "0.7370284", "0.73677313", "0.73093563", "0.7224056", "0.71785843", "0.715242", "0.71427566", "0.7041517", "0.69908535", "0.69642687", "0.69378734", "0.6865895", "0.6865895", "0.686589...
0.78341246
0
read input from Stdin,
func validateLang() { //print all lang options fmt.Println(intro) for _, lang := range languages { fmt.Println(lang) } //local lines that will hold all lines in the choosen lang file lines = make([]string,0) //l will be our predefined languages l := languages //infinit loop for reading user input language, loop ends if correct lang was choosen for { picked := strings.TrimSpace(userInput()) //read the input from Stdin, trim spaces //looping through our predefined languages for _,lang := range(l) { fmt.Println(lang) if (picked == lang) { //fmt.Println("Found language!", lang, picked) custlang = lang //variable to hold current lang for client lang = lang + ".txt" //append .txt because we are reading from files file, err := os.Open(lang) //open the given languge file check(err) //check if correct scanner := bufio.NewScanner(file) //scanning through the file for scanner.Scan() { lines = append(lines, scanner.Text()) //appending each line in the given langue file to lines } file.Close() //close the file check(scanner.Err()) //check for errors so nothing is left in the file to read break } } //check so we actually got something in len, if we have, we have successfully changed language if (len(lines) != 0) { break } else { fmt.Println(end) //print error msg } } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func StdinReader(input *ringbuffer.RingBuffer) {\n\tin := bufio.NewReader(os.Stdin)\n\tfor {\n\t\tby, err := in.ReadByte()\n\t\tif err == io.EOF {\n\t\t\tbreak\n\t\t}\n\n\t\tinput.Write([]byte{by})\n\t}\n}", "func (c *Cmd) Stdin(in io.Reader) *Cmd {\n\tc.stdin = in\n\treturn c\n}", "func readInput(in io.Reader...
[ "0.74022907", "0.6980113", "0.69574684", "0.6914523", "0.6872895", "0.6857479", "0.67382133", "0.6729678", "0.67284584", "0.667263", "0.6658712", "0.6641374", "0.6628669", "0.6623709", "0.65930325", "0.65362674", "0.65176934", "0.6508544", "0.6500082", "0.64806294", "0.641173...
0.0
-1
userInput reads from Stdin untill newline, if input was empty append space to msg
func userInput() string { msg, err := reader.ReadBytes('\n') check(err) if len(msg) == 0 { msg = append(msg, 32) } return string(msg) }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func UserInput() string {\n\treader := bufio.NewReader(os.Stdin)\n\tfmt.Println(\"What's up?\")\n\tfmt.Print(\"-> \")\n\tinput, _ := reader.ReadString('\\n')\n\tsanitizedInput := strings.Replace(input, \"\\n\", \"\", -1)\n\treturn sanitizedInput\n}", "func input(cmd_chan chan string) {\n\tin := bufio.NewReader(o...
[ "0.6536337", "0.65160227", "0.6378787", "0.6338915", "0.61996585", "0.6172181", "0.6155437", "0.6152924", "0.61121726", "0.6099486", "0.60795236", "0.60671675", "0.60584617", "0.60556275", "0.6027462", "0.59518105", "0.59339887", "0.59317434", "0.5923238", "0.58978343", "0.58...
0.71271926
0
fills our return value from makeMsg up to 10 byte.
func fillup(array []byte, endIndex, startIndex int) []byte { for tmp := startIndex; tmp < endIndex; tmp++ { array[tmp] = byte(0) } return array }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func makeMsg(opt int, msg string) []byte {\n\t\n\tmsg = strings.TrimSpace(msg) //remove space from input\n\tvar res = make([]byte, 10) //return array variable for what to send back to srv\n\tres[0] = byte(opt) //opt code will always be on index zero\n\t\n\tswitch opt {\n\tcase 2 : //Withdrawl\n\t\tif len(msg) >...
[ "0.62804025", "0.5524537", "0.5503694", "0.536583", "0.5355071", "0.528174", "0.527688", "0.52213", "0.5175756", "0.5156568", "0.514852", "0.51458406", "0.5132084", "0.5126586", "0.51242393", "0.51024973", "0.51014316", "0.5098779", "0.50937325", "0.5093115", "0.50910634", ...
0.0
-1
makeMsg takes opt code for what we want to send and a msg return value will always be 10 bytes
func makeMsg(opt int, msg string) []byte { msg = strings.TrimSpace(msg) //remove space from input var res = make([]byte, 10) //return array variable for what to send back to srv res[0] = byte(opt) //opt code will always be on index zero switch opt { case 2 : //Withdrawl if len(msg) > 9 { //cant whithdrawl amounts more than length 9, break } //convert input msg to bytes, each byte gets its own index in res for index := range msg { res[index+1] = byte(msg[index]) } //if msg was less then 9 we fill upp the rest so we always send 10 bytes res = fillup(res, len(msg)+1, 10) case 3 : //deposit does same as case 2 if len(msg) > 9 { break } for index := range msg { res[index+1] = byte(msg[index]) } res = fillup(res, len(msg) +1, 10) case 100 : //cardnumber if len(msg) != 16 { //cardnumber must be 16 digits break } //each two digit gets it's own index in res to avoid when we are converintg numbers bigger then 255 res[1] = byte(stringToInt(msg[0:2])) res[2] = byte(stringToInt(msg[2:4])) res[3] = byte(stringToInt(msg[4:6])) res[4] = byte(stringToInt(msg[6:8])) res[5] = byte(stringToInt(msg[8:10])) res[6] = byte(stringToInt(msg[10:12])) res[7] = byte(stringToInt(msg[12:14])) res[8] = byte(stringToInt(msg[14:16])) res = fillup(res, 9,10) case 101 : //password if len(msg) != 4 { //password must be length 4 break } //each digit in the password converts to bytes into res res[1] = byte(stringToInt(msg[0:1])) res[2] = byte(stringToInt(msg[1:2])) res[3] = byte(stringToInt(msg[2:3])) res[4] = byte(stringToInt(msg[3:4])) res = fillup(res, 5, 10) case 103 : //engångs koderna must be length 2 if len(msg) != 2 { break } res[1] = byte(msg[0]) res[2] = byte(msg[1]) res= fillup(res, 3, 10) } return res }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func allocMsg(t string, length int) (messager, error) {\n\tswitch t {\n\tcase \"msgheader\":\n\t\tvar msg msgHdr\n\t\treturn &msg, nil\n\tcase \"version\":\n\t\tvar msg version\n\t\treturn &msg, nil\n\tcase \"verack\":\n\t\tvar msg verACK\n\t\treturn &msg, nil\n\tcase \"getheaders\":\n\t\tvar msg headersReq\n\t\tr...
[ "0.6578145", "0.6516903", "0.61964613", "0.6109903", "0.6107194", "0.5852312", "0.584946", "0.5825267", "0.5729646", "0.5661675", "0.5618166", "0.561787", "0.5617706", "0.5576793", "0.555339", "0.55356306", "0.5535241", "0.54872227", "0.5469596", "0.54573846", "0.5453642", ...
0.71171874
0
validate login setup from the user, needs cardnumber on 16 digits and sifferkod on 4 digits everything thats Write from loginSetup uses makeMsg to convert the msg to 10 byte array Each msg will start with an opt code and followed by different msg in byte 110
func loginSetUp(connection net.Conn) { fmt.Println(lines[0]) //first line in the given lang file //infinit loop to read in correct cardnumber for { fmt.Print(lines[1]) card := strings.Replace(string(userInput()), " ", "", -1) //remooves space in cardnumber connection.Write(makeMsg(100, card)) //send msg to srv, first is opt code 100 for cardnumber to be validated ans := make([]byte, 10) //return value from srv connection.Read(ans) //read if it was validated from srv, 253 = true if ans[0] == 253 { break } else { fmt.Println(lines[6]) //received opt code 252 = fail } } //infinit loop to read password for { fmt.Print(lines[2]) password := userInput() //read input password from user connection.Write(makeMsg(101, password)) //makeMsg, opt code 101 for password, ans := make([]byte, 10) connection.Read(ans) //validate password from srv if ans[0] == 253 { break } else { fmt.Println(lines[6]) } } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func makeMsg(opt int, msg string) []byte {\n\t\n\tmsg = strings.TrimSpace(msg) //remove space from input\n\tvar res = make([]byte, 10) //return array variable for what to send back to srv\n\tres[0] = byte(opt) //opt code will always be on index zero\n\t\n\tswitch opt {\n\tcase 2 : //Withdrawl\n\t\tif len(msg) >...
[ "0.6723285", "0.54596674", "0.5294594", "0.52536565", "0.51366204", "0.5085916", "0.5051011", "0.5046358", "0.5041267", "0.5021834", "0.4987268", "0.49794912", "0.49775088", "0.49362358", "0.49338272", "0.48983753", "0.4854109", "0.48525935", "0.48380697", "0.48374146", "0.48...
0.676011
0
decode converts byte array to string and returns it.
func decode(array []byte) string { var tmp string for _, elem := range array { tmp += strconv.Itoa(int(elem)) } return tmp }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func Decode(s []byte) string {\n\ts, _ = decode(s)\n\treturn string(s)\n}", "func (enc *simpleEncoding) Decode(raw []byte) string {\n\tdata, _ := enc.NewDecoder().Bytes(raw)\n\treturn string(data)\n}", "func StringBytes(b []byte) string { return *(*string)(Pointer(&b)) }", "func (b *baseSemanticUTF8Base64) D...
[ "0.679415", "0.6686412", "0.6151728", "0.60770327", "0.59824395", "0.5945909", "0.59298795", "0.5899968", "0.58952236", "0.58858275", "0.587236", "0.5862185", "0.5832764", "0.5819838", "0.5808772", "0.5801181", "0.5795612", "0.57819957", "0.5781549", "0.57575077", "0.57296044...
0.68240315
0
overrideFile is for when the srv is udpatning lang files
func overrideFile(filename, newcontent string) { file, fileErr := os.Create(filename) //open given file if fileErr != nil { fmt.Println(fileErr) } file.WriteString(newcontent) //write the new content to the file file.Close() return }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func updateFile(connection net.Conn) {\n\tfmt.Println(\"Updating file...\")\n\tlang := make([]byte, 10)\n\tvar content string //content for the new file\n\t\n\tconnection.Read(lang) //read what lang file to change\n\n\t\n\t\n\ttmp := make([]byte, 255) //tmp for holdning the content from the srv\n\tfor {\n\t\tread,...
[ "0.6689114", "0.5757277", "0.54427046", "0.54074204", "0.5232694", "0.5191908", "0.50697404", "0.50676125", "0.5054689", "0.49671054", "0.49453542", "0.4933882", "0.49225172", "0.49017486", "0.48665082", "0.4861324", "0.48573327", "0.48359537", "0.47937393", "0.47914287", "0....
0.609435
1
update the clients language file
func updateFile(connection net.Conn) { fmt.Println("Updating file...") lang := make([]byte, 10) var content string //content for the new file connection.Read(lang) //read what lang file to change tmp := make([]byte, 255) //tmp for holdning the content from the srv for { read,_ := connection.Read(tmp) //reads what the srv wants to update the file with if tmp[read-1] == 4 { //the update from the srv will end will 4 ascii = end of transmission break } content += string(tmp) //store the content of the file } //search for the input lang and if we can change it. exist := false for _,currentlang := range languages { if currentlang == strings.TrimSpace(string(lang)) { exist = true } } //the lang did exists! so we append the lang to the global languages list. if exist == false { languages = append(languages, strings.TrimSpace(string(lang))) } //We will override already existing languages and create a new file if its a totally new language filename := strings.TrimSpace(string(lang)) + ".txt" newcontent := string(content) //the content from the srv overrideFile(filename, newcontent) //overridefile will take all the content and replace all content with the new content // check if the clients current lang is the new lang if custlang == strings.TrimSpace(string(lang)) { tmplines := make([]string,0) //we must replace all old lines from the lang file file, err := os.Open(filename) //open the file check(err) scanner := bufio.NewScanner(file) for scanner.Scan() { tmplines = append(tmplines, scanner.Text()) } file.Close() *(&lines) = tmplines //replace all old lines with the new content check(scanner.Err()) } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func updateLocalizableStrings(project Project, str string) Project {\n\tfor _, lang := range project.Languages { //do it to all project's Localizable.strings file\n\t\tvar path = lang.Path + \"/Localizable.strings\"\n\t\tvar fileContents = readFile(path)\n\t\tif !strings.Contains(fileContents, str) { //if str does...
[ "0.60816187", "0.58577764", "0.5845021", "0.5756729", "0.56602055", "0.56186885", "0.5585146", "0.54932135", "0.5451898", "0.54252183", "0.5391257", "0.5374925", "0.5353714", "0.52746046", "0.5268636", "0.5268636", "0.52674454", "0.5230201", "0.5176819", "0.5175852", "0.51708...
0.7256982
0
two different Dials, updateListener dial is constantly listing from srv updates
func client(){ // Connect to the server through tcp/IP. connection, err := net.Dial("tcp", ("127.0.0.1" + ":" + "9090")) updateListener , listErr := net.Dial("tcp", ("127.0.0.1" + ":" + "9091")) // If connection failed crash. check(err) check(listErr) //Create separate thread for updating client. go update(updateListener) //Configure the language. validateLang() //Time to log in to the account. loginSetUp(connection) //handling requests from usr handlingRequests(connection) }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func (w *Watcher) dial() (watcher *mpd.Watcher, err error) {\n for {\n if watcher, err = mpd.NewWatcher(\"tcp\", w.addr, w.passwd); err == nil {\n return\n }\n\n select {\n case <-w.done:\n return\n case <-time.After(time.Second):\n // retry\n }\n }\n}", "func startListenerAdve...
[ "0.56095344", "0.55318636", "0.55113477", "0.54187083", "0.53517175", "0.5322763", "0.5301367", "0.5290845", "0.52050334", "0.52011144", "0.51694024", "0.5144419", "0.51231486", "0.5108113", "0.50921655", "0.5088653", "0.5079346", "0.5072482", "0.5057227", "0.5051531", "0.504...
0.50818026
16
constantly listeing if srv sends opt ode 255, then we wants to update the lang file.
func update(connection net.Conn) { tmp := make([]byte, 1) for { connection.Read(tmp) if tmp[0] == 255 { updateFile(connection) } } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func updateFile(connection net.Conn) {\n\tfmt.Println(\"Updating file...\")\n\tlang := make([]byte, 10)\n\tvar content string //content for the new file\n\t\n\tconnection.Read(lang) //read what lang file to change\n\n\t\n\t\n\ttmp := make([]byte, 255) //tmp for holdning the content from the srv\n\tfor {\n\t\tread,...
[ "0.6413558", "0.60371095", "0.58385915", "0.5519052", "0.54779845", "0.5467058", "0.5310601", "0.52510947", "0.52062994", "0.5172734", "0.51532084", "0.50073725", "0.490693", "0.48996642", "0.48996642", "0.48512223", "0.48281896", "0.48088485", "0.47934917", "0.47850004", "0....
0.0
-1
NewArtifactListerOK creates ArtifactListerOK with default headers values
func NewArtifactListerOK() *ArtifactListerOK { return &ArtifactListerOK{} }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func (a *APIDefaults) ArtifactLister(params artifacts.ArtifactListerParams) middleware.Responder {\n\tpaginator := weles.ArtifactPagination{}\n\tif a.PageLimit != 0 {\n\t\tif (params.After != nil) && (params.Before != nil) {\n\t\t\treturn artifacts.NewArtifactListerBadRequest().WithPayload(&weles.ErrResponse{\n\t\...
[ "0.5894261", "0.5560803", "0.53907716", "0.49320006", "0.48386315", "0.47734094", "0.47326544", "0.4720476", "0.46708527", "0.46335799", "0.45692658", "0.45435777", "0.45155922", "0.45027113", "0.44864592", "0.44673875", "0.44423497", "0.44338384", "0.4429001", "0.4428382", "...
0.69606286
0
WithNext adds the next to the artifact lister o k response
func (o *ArtifactListerOK) WithNext(next string) *ArtifactListerOK { o.Next = next return o }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func (o *ArtifactListerPartialContent) WithNext(next string) *ArtifactListerPartialContent {\n\to.Next = next\n\treturn o\n}", "func (o *ArtifactListerOK) SetNext(next string) {\n\to.Next = next\n}", "func (rl *ResourceList) next() error {\n\tif rl.Page == rl.NumPages-1 {\n\t\treturn errors.New(\"no more new p...
[ "0.6979718", "0.68528485", "0.64260054", "0.6225338", "0.59516895", "0.59293854", "0.5898971", "0.5891204", "0.58812654", "0.58260477", "0.58181405", "0.5816745", "0.5740617", "0.57280815", "0.5722505", "0.5693756", "0.5689263", "0.5613842", "0.5594273", "0.5591945", "0.55668...
0.76724315
0
SetNext sets the next to the artifact lister o k response
func (o *ArtifactListerOK) SetNext(next string) { o.Next = next }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func (o *ArtifactListerPartialContent) SetNext(next string) {\n\to.Next = next\n}", "func (o *ArtifactListerOK) WithNext(next string) *ArtifactListerOK {\n\to.Next = next\n\treturn o\n}", "func (h *Sagify) SetNext(next job.Handler) {\n\th.next = next\n}", "func (o *StdOutOutput) SetNext(next Output) {\n\to.n...
[ "0.7701029", "0.72452474", "0.7027993", "0.6908621", "0.6683921", "0.65661", "0.65639925", "0.6407066", "0.6395918", "0.63333994", "0.6148755", "0.6133274", "0.61207384", "0.61169827", "0.6032635", "0.60308045", "0.60295266", "0.601939", "0.60086924", "0.5988711", "0.5885545"...
0.8355537
0