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
PersistentVolumeName returns the name of the PV for this bucket.
func (bc BucketConfig) PersistentVolumeName(prefix string) string { return prefix + "-" + bc.hash() }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func getPodNameFromPersistentVolume(pv *v1.PersistentVolume) *spec.NamespacedName {\n\tnamespace := pv.Spec.ClaimRef.Namespace\n\tname := pv.Spec.ClaimRef.Name[len(constants.DataVolumeName)+1:]\n\treturn &spec.NamespacedName{Namespace: namespace, Name: name}\n}", "func (o FioSpecVolumePersistentVolumeClaimSpecOu...
[ "0.6715421", "0.6433566", "0.6399416", "0.63078755", "0.6300491", "0.62943375", "0.62015206", "0.620125", "0.6192337", "0.61908", "0.61793375", "0.61018664", "0.60738367", "0.60727775", "0.6062434", "0.5955387", "0.59438527", "0.594144", "0.59110594", "0.58653605", "0.5862731...
0.6451138
1
Matches returns true if this bucket config equals the given endpoint & name.
func (bc BucketConfig) Matches(endpoint, bucketName string) bool { return strings.ToLower(endpoint) == strings.ToLower(bc.Endpoint) && strings.ToLower(bucketName) == strings.ToLower(bc.Name) }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func (info *BaseEndpointInfo) Equal(other Endpoint) bool {\n\treturn info.String() == other.String() && info.GetIsLocal() == other.GetIsLocal()\n}", "func (info *endpointsInfo) Equal(other proxy.Endpoint) bool {\n\treturn info.String() == other.String() && info.GetIsLocal() == other.GetIsLocal()\n}", "func (ec...
[ "0.597858", "0.5928627", "0.5899422", "0.531344", "0.5306883", "0.52983534", "0.5129041", "0.51234996", "0.51026905", "0.50878805", "0.5021614", "0.5013788", "0.49760675", "0.49469203", "0.4920381", "0.49037552", "0.48949546", "0.48752022", "0.48695588", "0.48658732", "0.4865...
0.7934681
0
EndpointAsURL returns the endpoint of the bucket including scheme.
func (bc BucketConfig) EndpointAsURL() string { prefix := "http://" if bc.Secure { prefix = "https://" } return prefix + bc.Endpoint }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func (b *Bucket) GetEndpoint() string {\n\treturn b.Endpoint\n}", "func (b *Bucket) GetURL(path string) string {\n\tif b.client == nil || b.client.Service == nil {\n\t\treturn \"\"\n\t}\n\treturn b.client.Service.Endpoint + \"/\" + b.name + \"/\" + path\n}", "func (m *_EndpointDescription) GetEndpointUrl() Pas...
[ "0.70004314", "0.69181967", "0.68010235", "0.67675567", "0.6722981", "0.67146015", "0.66484934", "0.6637463", "0.6579585", "0.6564449", "0.65565455", "0.65559167", "0.63913435", "0.6352629", "0.6349848", "0.6302285", "0.618815", "0.6147162", "0.6122564", "0.6111489", "0.61059...
0.8297435
0
Reads a URL into a byte slice
func ReadUrl(url string) ([]byte, error) { resp, err := http.Get(url) if err != nil { return nil, err } defer resp.Body.Close() if resp.StatusCode != 200 { return nil, errors.New(url + ": " + resp.Status) } body, err := ioutil.ReadAll(resp.Body) // log.Println(url + ":", string(body)) return body, err }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func ReadURL(url string, client *http.Client, header *http.Header) (body []byte, err error) {\n\treq, err := http.NewRequest(\"GET\", url, nil)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tif header != nil {\n\t\treq.Header = *header\n\t}\n\tresp, err := client.Do(req)\n\tif err != nil {\n\t\treturn nil, err\n\...
[ "0.740808", "0.7355354", "0.6955804", "0.66765195", "0.6663741", "0.65641993", "0.6527202", "0.65114444", "0.6447429", "0.63824195", "0.62775344", "0.6200917", "0.62001663", "0.6143989", "0.6133847", "0.6108124", "0.61014867", "0.60481185", "0.59918225", "0.5949454", "0.59270...
0.74276346
0
Parses JSON into interface
func ParseJSON(body []byte, v interface{}) error { return json.Unmarshal(body, v) }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func parseJson(r io.Reader, v interface{}) (err error) {\n\tbody, err := ioutil.ReadAll(r)\n\tif err != nil {\n\t\treturn err\n\t}\n\terr = json.Unmarshal(body, v)\n\tif err != nil {\n\t\treturn err\n\t}\n\treturn nil\n}", "func infoFromJSON(s string) (i Info, err error) {\n\terr = json.Unmarshal([]byte(s), &i)\...
[ "0.64064944", "0.6405011", "0.6356266", "0.62482035", "0.62306", "0.62236863", "0.6217344", "0.6217314", "0.62139374", "0.6171303", "0.61380273", "0.61018044", "0.6049581", "0.60457", "0.60261834", "0.60151225", "0.60117835", "0.5997406", "0.5944856", "0.59396416", "0.5879698...
0.5995478
18
Parses CSV into a slice of maps using the header row to determine the keys
func ParseCSV(body []byte) ([]map[string]string, error) { slice := make([]map[string]string, 0) records, err := csv.NewReader(bytes.NewReader(body)).ReadAll() if err != nil { return slice, err } rows := len(records) for i := 1; i < rows; i++ { m := make(map[string]string) cols := len(records[i]) for j := 0; j < cols; j++ { m[records[0][j]] = records[i][j] } slice = append(slice, m) } return slice, nil }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func csvFileToMap(fs io.Reader) (returnMap []map[string]string, err error) {\n\t// read csv file\n\n\treader := csv.NewReader(fs)\n\n\trawCSVdata, err := reader.ReadAll()\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(err.Error())\n\t}\n\n\theader := []string{} // holds first row (header) better to declare this w...
[ "0.68890405", "0.6685908", "0.65211517", "0.6323418", "0.63146794", "0.63065344", "0.6174222", "0.6147124", "0.6009719", "0.6006986", "0.5970537", "0.5944572", "0.5903829", "0.58752096", "0.5776775", "0.57162684", "0.57082254", "0.57051295", "0.56925297", "0.5662414", "0.5652...
0.67590743
1
Parses a simple DAY/MONTH/YEAR date format into a Time
func ParseSimpleDate(date string) (t time.Time, err error) { return time.Parse(SimpleDateFormat, date) }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func ParseDate(date string) (time.Time, error)", "func Time(s string) (result time.Time) {\n\tdefer func() {\n\t\tif err := recover(); err != nil {\n\t\t\tresult = time.Time{}\n\t\t}\n\t}()\n\n\tif len(s) < 6 {\n\t\treturn time.Time{}\n\t}\n\n\tif !strings.HasPrefix(s, \"/\") {\n\t\ts = \"/\" + s\n\t}\n\n\tb := ...
[ "0.7036604", "0.651316", "0.6448794", "0.6373066", "0.63458323", "0.61925656", "0.6190765", "0.6140698", "0.6134023", "0.60921896", "0.60708255", "0.6053343", "0.60519713", "0.60331255", "0.60287833", "0.6019247", "0.6008316", "0.59616876", "0.59443885", "0.59325457", "0.5931...
0.560642
59
Prints a map to log file
func PrintMap(m map[string]string) { for k := range m { log.Println("\t",k,"=",m[k]) } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func PrintMetaMap(metaMap map[string]FileMetaData) {\n\n\tfmt.Println(\"--------BEGIN PRINT MAP--------\")\n\n\tfor _, filemeta := range metaMap {\n\t\tfmt.Println(\"\\t\", filemeta.Filename, filemeta.Version, filemeta.BlockHashList)\n//\t\tfmt.Println(\"\\t\", filemeta.Filename, filemeta.Version)\n\t}\n\n\tfmt.Pr...
[ "0.67710865", "0.66852766", "0.63662946", "0.6362477", "0.63460183", "0.6289744", "0.6271945", "0.6254925", "0.621653", "0.6151758", "0.61285734", "0.60187525", "0.59970164", "0.59936285", "0.5975958", "0.59478647", "0.5933662", "0.59229624", "0.5835121", "0.57788086", "0.577...
0.75574833
0
FindCurrentMeta will return information about commonly used weapons via the Charlemagne API
func FindCurrentMeta(platform, requestedActivity string) (*skillserver.EchoResponse, error) { response := skillserver.NewEchoResponse() // TODO: activity hash is currently unused. may be useful to be able to request meta // for a current activity //activityHash := "" gameModes := []string{} translatedGameMode, ok := metaActivityTranslation[requestedActivity] if ok { // At some ponit this could be a list of activities but for now let's leave it as one gameModes = append(gameModes, translatedGameMode) glg.Infof("Found translated game mode of: %s", translatedGameMode) } translatedPlatform := platformNameToMapKey[platform] glg.Warnf("Translated game mode for lookup in cache: %s", translatedGameMode) meta := cachedMetaResponses[translatedPlatform][translatedGameMode] if meta == nil { err := fmt.Errorf("Trying to return meta for mode=%s and platform=%s but not in cache", translatedGameMode, translatedPlatform) raven.CaptureError(err, nil, nil) return nil, err } speechBuffer := bytes.NewBuffer([]byte{}) speechBuffer.Write([]byte("The most commonly used weapons according to Charlemagne ")) if requestedActivity != "" { speechBuffer.WriteString(fmt.Sprintf("for %s ", requestedActivity)) } if platform != "" { speechBuffer.WriteString(fmt.Sprintf("on %s ", platform)) } speechBuffer.WriteString(fmt.Sprintf("include %s and %s for kinetic weapons,", meta.TopKineticWeapons[0].WeaponName, meta.TopKineticWeapons[1].WeaponName)) speechBuffer.WriteString(fmt.Sprintf("%s and %s for energy weapons,", meta.TopEnergyWeapons[0].WeaponName, meta.TopEnergyWeapons[1].WeaponName)) speechBuffer.WriteString(fmt.Sprintf("and %s and %s for power weapons.", meta.TopPowerWeapons[0].WeaponName, meta.TopPowerWeapons[1].WeaponName)) response.OutputSpeech(speechBuffer.String()) return response, nil }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func GetWeaponInfo(weaponName string) (w *Weapon, err error) {\n\tfields := []string{\"name\", \"weapon_type\", \"proficiency\", \"damage\", \"secondary_damage\", \"damage_type\", \"save\", \"range\", \"rarity\", \"modifiers\", \"weight\", \"description\", \"properties\"}\n\tw = &Weapon{}\n\tquery := fmt.Sprintf(\...
[ "0.54226714", "0.5285081", "0.51907164", "0.5007826", "0.49341115", "0.47776833", "0.47510353", "0.47389603", "0.4724035", "0.46884516", "0.46460924", "0.45455116", "0.45438084", "0.45210272", "0.45004123", "0.44821173", "0.44700414", "0.44634646", "0.44237113", "0.43863812", ...
0.75457877
0
LastModified returns the latest modified time for all the files and directories. The files in each directory are checked for their last modified time. TODO: use go routines to speed this up nolint: gocyclo
func LastModified(fileOrDir ...string) (time.Time, error) { var latest time.Time // TODO: does this error contain enough context? walker := func(path string, info os.FileInfo, err error) error { if err != nil { return err } if info.IsDir() && info.Name() == ".dobi" { return filepath.SkipDir } if info.ModTime().After(latest) { latest = info.ModTime() } return nil } for _, file := range fileOrDir { info, err := os.Stat(file) if err != nil { return latest, err } switch info.IsDir() { case false: if info.ModTime().After(latest) { latest = info.ModTime() continue } default: if err := filepath.Walk(file, walker); err != nil { return latest, err } } } return latest, nil }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func (f *File) LastModified() (*time.Time, error) {\n\tattr, err := f.getObjectAttrs()\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn &attr.Updated, nil\n}", "func (dlr DirectoryListResponse) LastModified() string {\n\treturn PathList(dlr).LastModified()\n}", "func (fdf ExfatFileDirectoryEntry) LastMod...
[ "0.6308349", "0.6235137", "0.61921304", "0.60726833", "0.60483104", "0.58098406", "0.5772359", "0.57584804", "0.5713177", "0.56888556", "0.5680812", "0.5633928", "0.559856", "0.54990345", "0.5487972", "0.5473835", "0.54545426", "0.5437479", "0.5435753", "0.5435252", "0.540458...
0.7738381
0
onMessage is called when a new event arrives in the roomserver input stream.
func (r *Inputer) Start() error { _, err := r.JetStream.Subscribe( r.InputRoomEventTopic, // We specifically don't use jetstream.WithJetStreamMessage here because we // queue the task off to a room-specific queue and the ACK needs to be sent // later, possibly with an error response to the inputter if synchronous. func(msg *nats.Msg) { roomID := msg.Header.Get("room_id") var inputRoomEvent api.InputRoomEvent if err := json.Unmarshal(msg.Data, &inputRoomEvent); err != nil { _ = msg.Term() return } _ = msg.InProgress() index := roomID + "\000" + inputRoomEvent.Event.EventID() if _, ok := eventsInProgress.LoadOrStore(index, struct{}{}); ok { // We're already waiting to deal with this event, so there's no // point in queuing it up again. We've notified NATS that we're // working on the message still, so that will have deferred the // redelivery by a bit. return } roomserverInputBackpressure.With(prometheus.Labels{"room_id": roomID}).Inc() r.workerForRoom(roomID).Act(nil, func() { _ = msg.InProgress() // resets the acknowledgement wait timer defer eventsInProgress.Delete(index) defer roomserverInputBackpressure.With(prometheus.Labels{"room_id": roomID}).Dec() if err := r.processRoomEvent(r.ProcessContext.Context(), &inputRoomEvent); err != nil { if !errors.Is(err, context.DeadlineExceeded) && !errors.Is(err, context.Canceled) { sentry.CaptureException(err) } logrus.WithError(err).WithFields(logrus.Fields{ "room_id": roomID, "event_id": inputRoomEvent.Event.EventID(), "type": inputRoomEvent.Event.Type(), }).Warn("Roomserver failed to process async event") _ = msg.Term() } else { _ = msg.Ack() } }) }, // NATS wants to acknowledge automatically by default when the message is // read from the stream, but we want to override that behaviour by making // sure that we only acknowledge when we're happy we've done everything we // can. This ensures we retry things when it makes sense to do so. nats.ManualAck(), // Use a durable named consumer. r.Durable, // If we've missed things in the stream, e.g. we restarted, then replay // all of the queued messages that were waiting for us. nats.DeliverAll(), // Ensure that NATS doesn't try to resend us something that wasn't done // within the period of time that we might still be processing it. nats.AckWait(MaximumMissingProcessingTime+(time.Second*10)), ) return err }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func onMessage(c *gnet.Connection, channel uint16,\n\tmsg []byte) error {\n\tfmt.Printf(\"Event Callback: message event: addr= %s, channel %v, msg= %s \\n\", c.Addr(), channel, msg)\n\treturn nil\n}", "func (s *Realm) OnMessage(c *connection.Connection, ctx interface{}, data []byte) (out []byte) {\r\n\tpacket :=...
[ "0.7234711", "0.7101964", "0.7077346", "0.70616764", "0.6944995", "0.6751046", "0.66729075", "0.66678685", "0.6633395", "0.66270655", "0.65172863", "0.6511483", "0.65082186", "0.65010315", "0.65000105", "0.64327663", "0.64258385", "0.6350663", "0.6326081", "0.62677497", "0.62...
0.55480933
54
String returns the string representation of a command.
func (c *Command) String() string { // TODO: criteria if c.Next != nil { return c.Executer.String() + ", " + c.Next.String() } return c.Executer.String() }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func (s Command) String() string {\n\treturn awsutil.Prettify(s)\n}", "func (cmd *command) String() string {\n\tif len(cmd.params) == 0 {\n\t\treturn fmt.Sprintf(\"(%s)\", cmd.name)\n\t}\n\n\tparams := make([]string, len(cmd.params))\n\tfor i, param := range cmd.params {\n\t\tswitch concrete := param.(type) {\n\...
[ "0.82588065", "0.80942166", "0.80462706", "0.79341733", "0.79099274", "0.78881663", "0.77696174", "0.77659005", "0.77516574", "0.76951456", "0.7572861", "0.75336504", "0.7422595", "0.7410901", "0.7392648", "0.7357018", "0.71632457", "0.71632457", "0.716274", "0.70549613", "0....
0.70939344
19
Run runs a command and any subsequent commands if it's chained.
func (c *Command) Run(ctx context.Context) error { // TODO: criteria err := c.Exec(ctx) if err != nil { return err } if c.Next != nil { return c.Next.Run(ctx) } return nil }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func (c *Cmd) Run() error {\n\treturn c.runInnerCommand()\n}", "func (c *Command) run(cmd, path string, clearStack bool) error {\n\tif c.specialCmd(cmd, path) {\n\t\treturn nil\n\t}\n\tcmds := strings.Split(cmd, \" \")\n\tcommand := strings.ToLower(cmds[0])\n\tgvr, v, err := c.viewMetaFor(command)\n\tif err != n...
[ "0.6471542", "0.6431098", "0.6414838", "0.6394", "0.6344191", "0.63309324", "0.6237898", "0.62331253", "0.61902803", "0.6167945", "0.6162895", "0.6149439", "0.6135483", "0.6120912", "0.6120514", "0.61096513", "0.6101045", "0.6068022", "0.6066729", "0.6057943", "0.602746", "...
0.72497594
0
cmdParse parses a command string into a command structure.
func cmdParse(commandStr string, config *Config) (*Command, error) { // TODO: criteria lexer := lex(commandStr) defer lexer.drain() cmdToken := lexer.nextItem() if cmdToken.typ != itemString { return nil, fmt.Errorf("expected string, got token '%s'", cmdToken.val) } // TODO: chained commands command := &Command{} fn, ok := cmdParseTable[cmdToken.val] if !ok { return nil, fmt.Errorf("command '%s' not implemented", cmdToken.val) } cmd, err := fn(lexer, config) if err != nil { return nil, err } command.Executer = cmd return command, nil }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func (p *Parser) Parse(str string) (Command, []string, error) {\n\tvar cmd Command\n\targs := p.extractArgs(str)\n\n\tswitch strings.ToUpper(args[0]) {\n\tcase \"HELP\":\n\t\tcmd = &Help{parser: p}\n\tcase \"DEL\":\n\t\tcmd = &Del{strg: p.strg}\n\tcase \"EXPIRE\":\n\t\tcmd = &Expire{clck: p.clck, strg: p.strg}\n\t...
[ "0.76060694", "0.7605101", "0.75365144", "0.73861027", "0.71764857", "0.71486765", "0.71374834", "0.7126098", "0.70438343", "0.7025327", "0.702413", "0.7009736", "0.69934446", "0.6967141", "0.69124764", "0.6912338", "0.6868991", "0.686784", "0.6845462", "0.6681955", "0.667077...
0.8199973
0
applyResourcesToAllContainers applies consistent resource requests for all containers and all init containers in the pod
func (c *Cluster) applyResourcesToAllContainers(spec *v1.PodSpec, resources v1.ResourceRequirements) { for i := range spec.InitContainers { spec.InitContainers[i].Resources = resources } for i := range spec.Containers { spec.Containers[i].Resources = resources } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func newContainerResources(m *influxdatav1alpha1.Influxdb) corev1.ResourceRequirements {\n\tresources := corev1.ResourceRequirements{}\n\tif m.Spec.Pod != nil {\n\t\tresources = m.Spec.Pod.Resources\n\t}\n\treturn resources\n}", "func initContainers(pod corev1.Pod, secretKey, secretFormat string, parameters WhSv...
[ "0.6328543", "0.6126641", "0.6088365", "0.6029017", "0.60047114", "0.5906855", "0.5852475", "0.57923305", "0.56798255", "0.5666807", "0.5631742", "0.5615351", "0.55859125", "0.55045414", "0.54977345", "0.54548454", "0.5432338", "0.5423368", "0.5408374", "0.5392601", "0.538622...
0.83383745
0
Drones LEDs should stop blinking for 10s
func TestBind(t *testing.T) { driver := NewDriver("192.168.0.1:50000") driver.onError = func(err error) { t.Error("fail", err) } driver.Start() time.Sleep(time.Second * 10) driver.Halt() }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func (sh *stmHelper) blinkMaintenanceLED(ctx context.Context) {\n\tdefer sh.ClearDisplay()\n\tfor {\n\t\tsh.setLED(stm.LED1, yellow)\n\t\ttime.Sleep(time.Second)\n\t\tsh.setLED(stm.LED1, off)\n\n\t\tsh.setLED(stm.LED2, yellow)\n\t\ttime.Sleep(time.Second)\n\t\tsh.setLED(stm.LED2, off)\n\n\t\tselect {\n\t\tcase <-c...
[ "0.7167407", "0.706318", "0.6571996", "0.65486085", "0.6354301", "0.62981844", "0.61297184", "0.5831457", "0.5776189", "0.57494134", "0.56868124", "0.54084325", "0.5395688", "0.5395688", "0.5353163", "0.53415465", "0.5334647", "0.5312089", "0.5297992", "0.52786934", "0.526442...
0.0
-1
Replacer: copies file whilst replacing a given string Example (not compiled): go run replacer.go /path/to/big/input.txt replaced.txt password '' Reads input.txt, copies it to the PWD, replasing all occurences of "password" with There is an optional unsafe flag to use bytetostring conversion via unsafe pointers, too: ./replace unsafe in.log out.log search replace convert read buffer to string
func bufferToString(buffer *bytes.Buffer, unsafePtr *bool) string { defer buffer.Reset()//ensure buffer is reset if !*unsafePtr { return buffer.String() } bb := buffer.Bytes() s := *(*string)(unsafe.Pointer(&bb)) return s }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func main() {\n\tswitch len(os.Args) {\n\tcase 2:\n\t\treplacer.Produce(os.Args[1])\n\tcase 3:\n\t\treplacer.Produce(os.Args[2])\n\tdefault:\n\t\tpanic(\"Bad usage. Pass 1 or 2 arguments. The last one should be path to file, estimated arguments will be ignored.\")\n\t}\n}", "func Replace_strings(inFile string, k...
[ "0.593332", "0.58920455", "0.58307135", "0.5759988", "0.5640343", "0.56176907", "0.54462165", "0.5417814", "0.5408237", "0.53750044", "0.5279094", "0.5179909", "0.51240623", "0.51058346", "0.50940335", "0.50249094", "0.50169015", "0.5014492", "0.49995518", "0.4928472", "0.492...
0.0
-1
help, or invalid flag
func usage() { fmt.Printf("Usage of %s:\n", os.Args[0]) fmt.Println(" [-unsafe] inputfile outfile search-string replace-string") fmt.Println("\nAvailable options:") flag.PrintDefaults() fmt.Printf("\nThe -unsafe flag can increase performance. The performance gain is, however, marginal\n") fmt.Println("and is generally not worth the added risks, hence the name: unsafe") }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func Help(name string, writer io.Writer) string {\n\t_, err := parseFlags(name, []string{\"-h\"}, writer)\n\t// Error is always present because -h is passed\n\treturn err.Error()\n}", "func (flags *Flags) Help() string {\n\treturn \"\"\n}", "func (e *BadSpotError) IsShowAllHelp() {}", "func failWithHelp(mess...
[ "0.6840775", "0.66086334", "0.65521866", "0.6406479", "0.6251193", "0.6246326", "0.62193525", "0.6139682", "0.61359525", "0.6126167", "0.609346", "0.60887957", "0.60883915", "0.6087776", "0.60725486", "0.60713327", "0.60685796", "0.6034294", "0.60335374", "0.6030243", "0.6016...
0.5896184
28
open files taken from argv
func openFiles(argv []string) (*os.File, *os.File) { inFile, err := os.Open(argv[0]) if err != nil { panic(err) } outFile, err := os.Create(argv[1]) if err != nil { inFile.Close()//close here panic(err) } return inFile, outFile }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func readfile(fileCount int) {\n\n for i := 0; i < fileCount; i++ {\n\n f := flag.Arg(i)\n\n if !fileexists(f) {\n fmt.Println(f, \"Could not be found... skipping\")\n continue\n }\n\n r, e := os.Open(f)\n\n if e != nil {\n fmt.Println(\"Could ...
[ "0.6357535", "0.6275072", "0.6177542", "0.6041794", "0.6003741", "0.59987533", "0.5993259", "0.59458804", "0.58511996", "0.582843", "0.5648734", "0.5641688", "0.5616907", "0.56032234", "0.55901015", "0.5580287", "0.5575955", "0.55691886", "0.5509945", "0.5492141", "0.5474016"...
0.6459291
0
open reader and writer
func openReadWrite(inFile *os.File, outFile *os.File) (*bufio.Reader, *bufio.Writer) { return bufio.NewReader(inFile), bufio.NewWriter(outFile) }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func (cmd *baseCommand) writerOpen() error {\n\tif cmd.out == \"\" || cmd.out == \"-\" {\n\t\tif cmd.w == nil {\n\t\t\tcmd.w = os.Stdout\n\t\t}\n\t\treturn nil\n\t}\n\n\tdir, base := filepath.Split(cmd.out)\n\tbase = \".\" + base + \".\"\n\n\tvar err error\n\tif cmd.tmp, err = ioutil.TempFile(dir, base); err == ni...
[ "0.621754", "0.60433674", "0.5988976", "0.5887348", "0.5861999", "0.58603525", "0.5860061", "0.5679637", "0.55914617", "0.5582982", "0.55580986", "0.55473787", "0.5471372", "0.5468143", "0.54669327", "0.5463507", "0.5439068", "0.54318225", "0.5390883", "0.53740877", "0.536997...
0.67128825
0
GetData => makes a http call to a dummy service and return data or error
func GetData() (m MyIP, err error) { resp, err := http.Get(url) if err == nil { if resp.StatusCode != 400 { body, err := ioutil.ReadAll(resp.Body) bytBodyErr := []byte(body) if err == nil { _ = json.Unmarshal(bytBodyErr, &m) } } else { return m, errors.New("400 Bad Request") } } return m, err }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func (c *DefaultApiController) DataGet(w http.ResponseWriter, r *http.Request) {\n\tresult, err := c.service.DataGet(r.Context())\n\t//If an error occured, encode the error with the status code\n\tif err != nil {\n\t\tEncodeJSONResponse(err.Error(), &result.Code, w)\n\t\treturn\n\t}\n\t//If no error, encode the bo...
[ "0.7083786", "0.6736604", "0.66107166", "0.65034205", "0.6397895", "0.6253341", "0.61337847", "0.61120474", "0.6110037", "0.6082655", "0.60795283", "0.59683114", "0.5909923", "0.59045714", "0.58983636", "0.5895347", "0.588893", "0.58722013", "0.5820885", "0.5819464", "0.58122...
0.64093554
4
Base58Encode encodes a slice of byte into its base 58 representation
func Base58Encode(input []byte) []byte { encode := base58.Encode(input) return []byte(encode) }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func encodeBase58(i int64, b []byte) {\n\tp := len(b) - 1\n\tfor i >= 58 {\n\t\tb[p] = encodeBase58Map[i%58]\n\t\tp--\n\t\ti /= 58\n\t}\n\tb[p] = encodeBase58Map[i]\n}", "func Base58Encode(input []byte) []byte {\n\tvar result []byte\n\n\tx := big.NewInt(0).SetBytes(input)\n\n\tbase := big.NewInt(int64(len(b58Alp...
[ "0.81840426", "0.7762757", "0.7762757", "0.76827353", "0.76582295", "0.7521171", "0.72944915", "0.7157638", "0.7039257", "0.69844925", "0.69814324", "0.6871738", "0.68469775", "0.6762033", "0.6709189", "0.66834635", "0.66349524", "0.66349524", "0.6607509", "0.6540181", "0.651...
0.80068636
1
Base58Decode decodes a base 58 representation into a byte slice
func Base58Decode(input []byte) []byte { decode, err := base58.Decode(string(input[:])) if err != nil { log.Panic(err) } return decode }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func Base58Decode(input []byte) []byte {\n\tresult := big.NewInt(0)\n\n\tfor _, b := range input {\n\t\tcharIndex := bytes.IndexByte(b58Alphabet, b)\n\t\tresult.Mul(result, big.NewInt(58))\n\t\tresult.Add(result, big.NewInt(int64(charIndex)))\n\t}\n\n\tdecoded := result.Bytes()\n\n\tif input[0] == b58Alphabet[0] {...
[ "0.82640064", "0.8263569", "0.77547556", "0.772591", "0.7617213", "0.74173695", "0.7274444", "0.70765555", "0.70323175", "0.6839322", "0.6795667", "0.6781376", "0.673101", "0.65043974", "0.6490628", "0.64824307", "0.64178103", "0.60556257", "0.59470063", "0.59457445", "0.5910...
0.8383557
1
AsInt converts an action to an integer to be used for indexing. This integer only uses 4 bits and is only valid for 2 players. TargetPlayer is instead encoded as a bool: targetSelf. That never conflicts with SelectedCard.
func (act Action) AsInt() int { retVal := 0 if act.PlayRecent { retVal = 1 } if act.SelectedCard != None && act.SelectedCard != Guard { retVal += 2 * (int(act.SelectedCard) - 1) } else if act.TargetPlayerOffset > 0 { retVal += 2 * act.TargetPlayerOffset } return retVal }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func ActionFromInt(st int) Action {\n\tact := Action{}\n\tif st%2 == 1 {\n\t\tact.PlayRecent = true\n\t}\n\n\tst = (st & 0xF) >> 1\n\t// Now st is the TargetPlayerOffset or SelectedCard. We don't know which, but if *any* card was selected,\n\t// then the other player must be targeted (since the played card is a gu...
[ "0.6858114", "0.5630274", "0.5474764", "0.5404166", "0.5386555", "0.522365", "0.51261777", "0.50806195", "0.50114006", "0.49455163", "0.49418768", "0.49413294", "0.4935143", "0.49315566", "0.48762146", "0.4867004", "0.48524567", "0.4833814", "0.48174962", "0.48106116", "0.480...
0.7367914
0
ActionFromInt reverses action.AsInt, but only for the 4 bits that compose the action. Other bits are ignored. This only works for a 2player game.
func ActionFromInt(st int) Action { act := Action{} if st%2 == 1 { act.PlayRecent = true } st = (st & 0xF) >> 1 // Now st is the TargetPlayerOffset or SelectedCard. We don't know which, but if *any* card was selected, // then the other player must be targeted (since the played card is a guard), so for 2 players the offset is 1. if st > 0 { act.TargetPlayerOffset = 1 } act.SelectedCard = Card(st + 1) return act }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func (act Action) AsInt() int {\n\tretVal := 0\n\tif act.PlayRecent {\n\t\tretVal = 1\n\t}\n\tif act.SelectedCard != None && act.SelectedCard != Guard {\n\t\tretVal += 2 * (int(act.SelectedCard) - 1)\n\t} else if act.TargetPlayerOffset > 0 {\n\t\tretVal += 2 * act.TargetPlayerOffset\n\t}\n\treturn retVal\n}", "f...
[ "0.5708145", "0.5499565", "0.54050773", "0.5264883", "0.51558256", "0.50154674", "0.4927779", "0.4892348", "0.48327678", "0.47832754", "0.47781372", "0.47771055", "0.47565344", "0.47364783", "0.47332695", "0.47315076", "0.4730219", "0.47273493", "0.4720255", "0.47181374", "0....
0.7415443
0
NewSyscallCounter creates a new SyscallCounter
func NewSyscallCounter() SyscallCounter { return SyscallCounter(make(map[string]int)) }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func NewCounter() *StandardCounter {\n\treturn &StandardCounter{0}\n}", "func NewCounter(options *CounterOptions) (c *Counter) {\n\tif options == nil {\n\t\toptions = new(CounterOptions)\n\t}\n\tif options.Subsystem == \"\" {\n\t\toptions.Subsystem = \"logging\"\n\t}\n\tif options.Name == \"\" {\n\t\toptions.Nam...
[ "0.65613407", "0.62249815", "0.622236", "0.620934", "0.6184915", "0.61593485", "0.61469537", "0.6113768", "0.6087508", "0.6055666", "0.60481656", "0.6030751", "0.60302186", "0.6028467", "0.6028467", "0.5996901", "0.5976532", "0.5976532", "0.5974575", "0.59735125", "0.5947771"...
0.8822192
0
Add adds single counter to SyscallCounter
func (s SyscallCounter) Add(name string, count int) { s[name] = count }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func (c *Counter) Add(mp string) int {\n\tc.mutex.Lock()\n\tdefer c.mutex.Unlock()\n\n\tc.count[mp]++\n\tlogrus.Debugf(\"Mount count increased to %d for %q\", c.count[mp], mp)\n\treturn c.count[mp]\n}", "func (c *Counter) AddCount(mp string, n int) int {\n\tc.mutex.Lock()\n\tdefer c.mutex.Unlock()\n\n\tc.count[m...
[ "0.693444", "0.6744105", "0.67251784", "0.6690354", "0.65803283", "0.6555088", "0.6521243", "0.6459427", "0.64519507", "0.6396349", "0.6385772", "0.63718647", "0.6366864", "0.6361009", "0.62777066", "0.6268622", "0.61870646", "0.61822426", "0.6144839", "0.61348534", "0.612906...
0.78227204
0
AddRange add multiple counter to SyscallCounter
func (s SyscallCounter) AddRange(m map[string]int) { for k, v := range m { s[k] = v } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func SystemcounterReadList(buf []byte, dest []Systemcounter) int {\n\tb := 0\n\tfor i := 0; i < len(dest); i++ {\n\t\tdest[i] = Systemcounter{}\n\t\tb += SystemcounterRead(buf[b:], &dest[i])\n\t}\n\treturn xgb.Pad(b)\n}", "func (s SyscallCounter) Add(name string, count int) {\n\ts[name] = count\n}", "func (c *...
[ "0.58888173", "0.57848877", "0.56218725", "0.53386444", "0.5303115", "0.52801883", "0.5248637", "0.5165493", "0.5153725", "0.5127275", "0.51228803", "0.50775003", "0.5071776", "0.5071021", "0.5059025", "0.50525403", "0.50412554", "0.5031862", "0.4982327", "0.4956368", "0.4941...
0.6513837
0
Check return inside, allow
func (s SyscallCounter) Check(name string) (bool, bool) { n, o := s[name] if o { s[name] = n - 1 if n <= 1 { return true, false } return true, true } return false, true }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func FuncChangeRet() bool { return false }", "func checkUsernameToReturn(c *gin.Context, username string) bool {\n\tif !isValidUsername(username) {\n\t\tc.Status(http.StatusBadRequest)\n\t\treturn true\n\t}\n\treturn false\n}", "func hasReturnValue(fnValue reflect.Value) bool {\n\treturn f...
[ "0.5657477", "0.55718315", "0.5475712", "0.545561", "0.53494847", "0.5347773", "0.52995455", "0.5298312", "0.52896863", "0.52896863", "0.5246763", "0.52449787", "0.5231858", "0.52129644", "0.51947147", "0.51889956", "0.51766586", "0.5143849", "0.51412374", "0.5135862", "0.512...
0.0
-1
MagSq returns the squared magnitude of the Vec2 Useful if you only want to compare two of them but don't care about their actual lengths.
func (v Vec2) MagSq() float64 { return v.X*v.X + v.Y*v.Y }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func (v Vec2) Mag() float64 {\n\treturn math.Sqrt(v.MagSq())\n}", "func (a Vec2) LengthSq() float64 {\n\treturn a.X*a.X + a.Y*a.Y\n}", "func (v Vector2) LengthSq() (m float32) {\n\treturn v.Dot(v)\n}", "func _v2dMag(v *Vec2d) float64 { return math.Sqrt(v.x*v.x + v.y*v.y) }", "func (v0 Vector2) DistanceSq(v...
[ "0.76467", "0.7355751", "0.735416", "0.72109294", "0.6946739", "0.6719755", "0.66131836", "0.64010394", "0.62709486", "0.6249757", "0.62447196", "0.616803", "0.6158362", "0.614744", "0.59848154", "0.59739727", "0.59730613", "0.59290344", "0.58734214", "0.58546335", "0.5729729...
0.8301837
0
Mag returns the magnitude (length) of the Vec2
func (v Vec2) Mag() float64 { return math.Sqrt(v.MagSq()) }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func (myVec Vec2f) Magnitude() float {\n\treturn math.Sqrt(myVec.x * myVec.x + myVec.y * myVec.y)\n}", "func _v2dMag(v *Vec2d) float64 { return math.Sqrt(v.x*v.x + v.y*v.y) }", "func (v Vector) Mag() float64 {\n\treturn math.Sqrt(v.Dot(v))\n}", "func (v Vec) Mag() float64 {\n\treturn math.Sqrt(v.Dot(v))\n}",...
[ "0.76289505", "0.76026416", "0.746187", "0.7426065", "0.6838833", "0.68316275", "0.6733582", "0.6617069", "0.65825546", "0.64890444", "0.642629", "0.6374563", "0.63549167", "0.61985433", "0.61635196", "0.6017369", "0.60036904", "0.5997282", "0.5973113", "0.5966783", "0.586881...
0.85427374
0
Add one Vec2 to this one, returning the resulting Vec2
func (v Vec2) Add(other Vec2) Vec2 { return Vec2{v.X + other.X, v.Y + other.Y} }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func (v Vec2) Add(x Vec2) Vec2 {\n\treturn Vec2{v[0] + x[0], v[1] + x[1]}\n}", "func (v Vector2D) Add(v1 Vector) Vector {\n\tv2 := v1.(Vector2D)\n\treturn Vector2D{v.X + v2.X, v.Y + v2.Y}\n}", "func (a Vec2) Add(b Vec2) Vec2 {\n\treturn Vec2{a.X + b.X, a.Y + b.Y}\n}", "func (v Vector2) Add(other Vector) Vect...
[ "0.74521434", "0.73208445", "0.72367424", "0.71565145", "0.7120489", "0.71018904", "0.7047271", "0.6895478", "0.664067", "0.6560502", "0.65546304", "0.6542794", "0.644412", "0.6421642", "0.64206374", "0.64024866", "0.63917994", "0.6380805", "0.6356837", "0.63473177", "0.62898...
0.76290447
0
Subtract one Vec2 from this one, returning the resulting Vec2
func (v Vec2) Sub(other Vec2) Vec2 { return Vec2{v.X - other.X, v.Y - other.Y} }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func (v Vector2D) Subtract(v1 Vector) Vector {\n\tv2 := v1.(Vector2D)\n\treturn Vector2D{v.X - v2.X, v.Y - v2.Y}\n}", "func (v Vector2) Subtract(other Vector) Vector {\r\n\totherv := checkVector2(other)\r\n\treturn Vector2{\r\n\t\tv[0] - otherv[0],\r\n\t\tv[1] - otherv[1],\r\n\t}\r\n}", "func (v *Vector2) Subt...
[ "0.7689187", "0.7526785", "0.7491658", "0.7456818", "0.7352217", "0.71778595", "0.71758455", "0.71502984", "0.6977851", "0.6902914", "0.68851614", "0.68810874", "0.68723845", "0.6834537", "0.68303734", "0.67983705", "0.6745432", "0.6611283", "0.6539055", "0.6434441", "0.64340...
0.75407815
1
Fetch fetches XML data
func (request *preparedRequest) Bytes() ([]byte, error) { resp, err := request.Execute() if err != nil { return nil, err } if resp.StatusCode != http.StatusOK { msg := fmt.Sprintf("Status error: %d", resp.StatusCode) return nil, fmt.Errorf(msg) } defer resp.Body.Close() data, err := ioutil.ReadAll(resp.Body) if err != nil { return nil, fmt.Errorf("read body: %v", err) } return data, nil }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func fetchXML() Fetcher {\n\treturn func(r Resource, hr *HttpRequest) ([]byte, error) {\n\t\terr := r.verifyParams(hr.params)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\tfullPath, err := hr.url(r)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\n\t\treadCh := make(chan cacheResults)\n\t\tcaResults...
[ "0.71618414", "0.58755547", "0.57526934", "0.5746789", "0.5668734", "0.56234515", "0.5609424", "0.5606312", "0.5600024", "0.5576584", "0.5536955", "0.552927", "0.55244035", "0.55164766", "0.55108875", "0.5485493", "0.5482583", "0.5451337", "0.5439825", "0.5424137", "0.5398661...
0.0
-1
Build arrow chunk based on RowSet of base64
func buildFirstArrowChunk(rowsetBase64 string, loc *time.Location, alloc memory.Allocator) arrowResultChunk { rowSetBytes, err := base64.StdEncoding.DecodeString(rowsetBase64) if err != nil { return arrowResultChunk{} } rr, err := ipc.NewReader(bytes.NewReader(rowSetBytes), ipc.WithAllocator(alloc)) if err != nil { return arrowResultChunk{} } return arrowResultChunk{rr, 0, loc, alloc} }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func (r *ViewResult) NextBytes() []byte {\n\n\tif len(r.Errors) > 0 || r.iterErr != nil {\n\t\treturn nil\n\t}\n\n\tif r.iterIndex >= len(r.Rows) {\n\t\treturn nil\n\t}\n\tr.iterIndex++\n\n\tvar rowBytes []byte\n\trowBytes, r.iterErr = json.Marshal(r.Rows[r.iterIndex-1])\n\tif r.iterErr != nil {\n\t\treturn nil\n\...
[ "0.49601516", "0.48495087", "0.47244224", "0.46970236", "0.4649988", "0.44896185", "0.44832572", "0.44635195", "0.44426832", "0.44039324", "0.4394501", "0.43936595", "0.43771163", "0.43657848", "0.4308649", "0.42926666", "0.42898908", "0.42886", "0.42765093", "0.42641222", "0...
0.7066708
0
Ortho generates an Ortho Matrix.
func Ortho(left, right, bottom, top, near, far float64) Mat4 { rml, tmb, fmn := (right - left), (top - bottom), (far - near) return Mat4{float64(2. / rml), 0, 0, 0, 0, float64(2. / tmb), 0, 0, 0, 0, float64(-2. / fmn), 0, float64(-(right + left) / rml), float64(-(top + bottom) / tmb), float64(-(far + near) / fmn), 1} }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func MatrixOrtho(left, right, bottom, top, near, far float32) Matrix {\n\tvar result Matrix\n\n\trl := right - left\n\ttb := top - bottom\n\tfn := far - near\n\n\tresult.M0 = 2.0 / rl\n\tresult.M1 = 0.0\n\tresult.M2 = 0.0\n\tresult.M3 = 0.0\n\tresult.M4 = 0.0\n\tresult.M5 = 2.0 / tb\n\tresult.M6 = 0.0\n\tresult.M7...
[ "0.80101526", "0.786557", "0.7378602", "0.72870845", "0.6966766", "0.69345576", "0.6813901", "0.67008436", "0.6640046", "0.65874267", "0.6338183", "0.628314", "0.62605625", "0.6048192", "0.5790114", "0.5180142", "0.49350113", "0.4705382", "0.44425777", "0.4424666", "0.4374524...
0.6993952
4
Ortho2D is equivalent to Ortho with the near and far planes being 1 and 1, respectively.
func Ortho2D(left, right, bottom, top float64) Mat4 { return Ortho(left, right, bottom, top, -1, 1) }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func Ortho(left float64, right float64, bottom float64, top float64, zNear float64, zFar float64) {\n\tsyscall.Syscall6(gpOrtho, 6, uintptr(math.Float64bits(left)), uintptr(math.Float64bits(right)), uintptr(math.Float64bits(bottom)), uintptr(math.Float64bits(top)), uintptr(math.Float64bits(zNear)), uintptr(math.Fl...
[ "0.7265957", "0.72310865", "0.7083383", "0.6947122", "0.680068", "0.6585098", "0.64460534", "0.6387449", "0.63567126", "0.6282929", "0.6277347", "0.6056117", "0.5784974", "0.5626712", "0.5495447", "0.5270123", "0.50828767", "0.49142155", "0.49066404", "0.45804802", "0.4481543...
0.72120196
2
Perspective generates a Perspective Matrix.
func Perspective(fovy, aspect, near, far float64) Mat4 { // fovy = (fovy * math.Pi) / 180.0 // convert from degrees to radians nmf, f := near-far, float64(1./math.Tan(float64(fovy)/2.0)) return Mat4{float64(f / aspect), 0, 0, 0, 0, float64(f), 0, 0, 0, 0, float64((near + far) / nmf), -1, 0, 0, float64((2. * far * near) / nmf), 0} }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func Perspective(fovy, aspect, zNear, zFar gl.Float) *Mat4 {\n\tf := 1 / (TanGL(fovy / 2.0))\n\tm := IdentMat4()\n\tm[0].X = f / aspect\n\tm[1].Y = f\n\tm[2].Z = (zFar + zNear) / (zNear - zFar)\n\tm[3].W = 0\n\tm[2].W = -1\n\tm[3].Z = (2 * zFar * zNear) / (zNear - zFar)\n\treturn m\n}", "func MatrixPerspective(f...
[ "0.77690375", "0.7601805", "0.7248959", "0.6781702", "0.6759459", "0.6070791", "0.5912761", "0.57179683", "0.55036145", "0.5496717", "0.5453301", "0.54473794", "0.5251755", "0.5088271", "0.50508565", "0.49665186", "0.48535895", "0.48271555", "0.46785966", "0.466484", "0.46123...
0.74354875
2
Frustum generates a Frustum Matrix.
func Frustum(left, right, bottom, top, near, far float64) Mat4 { rml, tmb, fmn := (right - left), (top - bottom), (far - near) A, B, C, D := (right+left)/rml, (top+bottom)/tmb, -(far+near)/fmn, -(2*far*near)/fmn return Mat4{float64((2. * near) / rml), 0, 0, 0, 0, float64((2. * near) / tmb), 0, 0, float64(A), float64(B), float64(C), -1, 0, 0, float64(D), 0} }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func MatrixFrustum(left, right, bottom, top, near, far float32) Matrix {\n\tvar result Matrix\n\n\trl := right - left\n\ttb := top - bottom\n\tfn := far - near\n\n\tresult.M0 = (near * 2.0) / rl\n\tresult.M1 = 0.0\n\tresult.M2 = 0.0\n\tresult.M3 = 0.0\n\n\tresult.M4 = 0.0\n\tresult.M5 = (near * 2.0) / tb\n\tresult...
[ "0.76970947", "0.7330446", "0.7255292", "0.72207195", "0.69924295", "0.58773893", "0.5802752", "0.54933745", "0.5351413", "0.5217522", "0.51141834", "0.4948555", "0.48751333", "0.48751333", "0.48583722", "0.48525465", "0.48237985", "0.48176077", "0.47767034", "0.47767034", "0...
0.7870303
0
LookAt generates a transform matrix from world space to the given eye space.
func LookAt(eyeX, eyeY, eyeZ, centerX, centerY, centerZ, upX, upY, upZ float64) Mat4 { return LookAtV(Vec3{eyeX, eyeY, eyeZ}, Vec3{centerX, centerY, centerZ}, Vec3{upX, upY, upZ}) }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func LookAt(cameraX, cameraY, cameraZ, eyeX, eyeY, eyeZ, orientX, orientY, orientZ gl.Float) *Mat4 {\n\tcamera := &Vec3{ cameraX, cameraY, cameraZ }\n\teye := &Vec3{ eyeX, eyeY, eyeZ }\n\torient := &Vec3{ orientX, orientY, orientZ }\n\treturn LookAtV(camera, eye, orient)\n}", "func MatrixLookAt(eye, target, up V...
[ "0.7221874", "0.7156577", "0.7148838", "0.7097981", "0.68202144", "0.6567185", "0.6151463", "0.61138666", "0.59963095", "0.59800833", "0.56573945", "0.55753505", "0.5262416", "0.49019694", "0.48895672", "0.4848101", "0.47955284", "0.46801323", "0.45855114", "0.44959348", "0.4...
0.76853
0
LookAtV generates a transform matrix from world space into the specific eye space.
func LookAtV(eye, center, up Vec3) Mat4 { f := center.Sub(eye).Normalize() s := f.Cross(up.Normalize()).Normalize() u := s.Cross(f) M := Mat4{ s[0], u[0], -f[0], 0, s[1], u[1], -f[1], 0, s[2], u[2], -f[2], 0, 0, 0, 0, 1, } return M.Mul4(Translate3D(float64(-eye[0]), float64(-eye[1]), float64(-eye[2]))) }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func LookAtV(cameraLoc, lookTo, orientation *Vec3) *Mat4 {\n\n\tF := lookTo.Sub(cameraLoc)\n\tf := F.Normalize()\n\to := orientation.Normalize()\n\ts := f.Cross(o).Normalize()\n\tu := s.Cross(f)\n\tM := Mat4{\n\t\tVec4{ s.X, u.X, -f.X, 0.0 },\n\t\tVec4{ s.Y, u.Y, -f.Y, 0.0 },\n\t\tVec4{ s.Z, u.Z, -f.Z, 0.0 },\n\t\...
[ "0.79384255", "0.7008268", "0.6827936", "0.674036", "0.66893333", "0.65252846", "0.64359015", "0.6208828", "0.6147548", "0.60695577", "0.57845163", "0.56114215", "0.55764824", "0.50536716", "0.49189788", "0.4896015", "0.48141652", "0.48135036", "0.48012808", "0.47918695", "0....
0.8124075
0
Project transforms a set of coordinates from object space (in obj) to window coordinates (with depth). Window coordinates are continuous, not discrete (well, as continuous as an IEEE Floating Point can be), so you won't get exact pixel locations without rounding or similar
func Project(obj Vec3, modelview, projection Mat4, initialX, initialY, width, height int) (win Vec3) { obj4 := obj.Vec4(1) vpp := projection.Mul4(modelview).Mul4x1(obj4) vpp = vpp.Mul(1 / vpp.W()) win[0] = float64(initialX) + (float64(width)*(vpp[0]+1))/2 win[1] = float64(initialY) + (float64(height)*(vpp[1]+1))/2 win[2] = (vpp[2] + 1) / 2 return win }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func (p *Projection) project(wx float64, wy float64) (float64, float64) {\n return ((wx / p.worldWidth) * p.canvasWidth) + (p.canvasWidth * 0.5),\n ((wy / p.worldHeight) * -p.canvasHeight) + (p.canvasHeight * 0.5)\n}", "func UnProject(win Vec3, modelview, projection Mat4, initialX, initialY, width, heig...
[ "0.63158274", "0.5481058", "0.54486936", "0.54296905", "0.52340007", "0.5148154", "0.50325346", "0.4956897", "0.49509454", "0.49372965", "0.4893283", "0.4836452", "0.47983438", "0.4735956", "0.46727222", "0.46138215", "0.4606523", "0.45490903", "0.45301574", "0.4525165", "0.4...
0.66940176
0
UnProject transforms a set of window coordinates to object space. If your MVP (projection.Mul(modelview) matrix is not invertible, this will return an error. Note that the projection may not be perfect if you use strict pixel locations rather than the exact values given by Projectf. (It's still unlikely to be perfect due to precision errors, but it will be closer)
func UnProject(win Vec3, modelview, projection Mat4, initialX, initialY, width, height int) (obj Vec3, err error) { inv := projection.Mul4(modelview).Inv() var blank Mat4 if inv == blank { return Vec3{}, errors.New("Could not find matrix inverse (projection times modelview is probably non-singular)") } obj4 := inv.Mul4x1(Vec4{ (2 * (win[0] - float64(initialX)) / float64(width)) - 1, (2 * (win[1] - float64(initialY)) / float64(height)) - 1, 2*win[2] - 1, 1.0, }) obj = obj4.Vec3() //if obj4[3] > MinValue {} obj[0] /= obj4[3] obj[1] /= obj4[3] obj[2] /= obj4[3] return obj, nil }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func (m Matrix) Unproject(u Vec) Vec {\n\tdet := m[0]*m[3] - m[2]*m[1]\n\treturn Vec{\n\t\t(m[3]*(u.X-m[4]) - m[2]*(u.Y-m[5])) / det,\n\t\t(-m[1]*(u.X-m[4]) + m[0]*(u.Y-m[5])) / det,\n\t}\n}", "func Project(obj Vec3, modelview, projection Mat4, initialX, initialY, width, height int) (win Vec3) {\n\tobj4 := obj.V...
[ "0.76688826", "0.6347564", "0.57971174", "0.57515115", "0.54273236", "0.52502817", "0.51743394", "0.48640013", "0.48253465", "0.48199877", "0.47961015", "0.47573304", "0.47210604", "0.47186816", "0.4718039", "0.46531895", "0.4639835", "0.46380505", "0.46234328", "0.4603798", ...
0.83639854
0
ComputeDomain computes a domain.
func ComputeDomain(domainType DomainType, forkVersion []byte, genesisValidatorsRoot []byte) ([]byte, error) { if len(forkVersion) != 4 { return nil, errors.New("fork version must be 4 bytes in length") } if len(genesisValidatorsRoot) != 32 { return nil, errors.New("genesis validators root must be 32 bytes in length") } // Generate fork data root from fork version and genesis validators root. forkData := &ForkData{ CurrentVersion: forkVersion, GenesisValidatorsRoot: genesisValidatorsRoot, } forkDataRoot, err := forkData.HashTreeRoot() if err != nil { return nil, errors.Wrap(err, "failed to generate fork data hash tree root") } res := make([]byte, 32) copy(res[0:4], domainType[:]) copy(res[4:32], forkDataRoot[:]) return res, nil }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func GetDomain(fork Fork, epoch Epoch, dom BLSDomain) BLSDomain {\n\t// combine fork version with domain.\n\tv := fork.GetVersion(epoch)\n\treturn BLSDomain(v[0] << 24 | v[1] << 16 | v[2] << 8 | v[3]) + dom\n}", "func (o GetDomainsResultOutput) Domain() pulumi.StringPtrOutput {\n\treturn o.ApplyT(func(v GetDomai...
[ "0.59415394", "0.5931642", "0.5741345", "0.56521034", "0.56398815", "0.5539767", "0.5539069", "0.5498731", "0.5496328", "0.5477649", "0.5436799", "0.5431728", "0.5416263", "0.53798914", "0.5355684", "0.5344459", "0.53300226", "0.53053075", "0.5295649", "0.5276572", "0.5271895...
0.72771716
0
Domain returns a complete domain. Deprecated: due to panicking on error. Use ComputeDomain() instead.
func Domain(domainType DomainType, forkVersion []byte, genesisValidatorsRoot []byte) []byte { // Generate fork data root from fork version and genesis validators root. forkData := &ForkData{ CurrentVersion: forkVersion, GenesisValidatorsRoot: genesisValidatorsRoot, } forkDataRoot, err := forkData.HashTreeRoot() if err != nil { panic(err) } res := make([]byte, 32) copy(res[0:4], domainType[:]) copy(res[4:32], forkDataRoot[:]) return res }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func GetDomain(err error) Domain { return domains.GetDomain(err) }", "func GetDomain(err error) Domain { return domains.GetDomain(err) }", "func (o GetDomainsResultOutput) Domain() pulumi.StringPtrOutput {\n\treturn o.ApplyT(func(v GetDomainsResult) *string { return v.Domain }).(pulumi.StringPtrOutput)\n}", ...
[ "0.7280717", "0.7280717", "0.71779233", "0.710203", "0.69977224", "0.68014425", "0.68014425", "0.6780974", "0.6719316", "0.6703464", "0.6622421", "0.66126794", "0.66029614", "0.65618205", "0.656128", "0.6482219", "0.6482219", "0.6480019", "0.6478523", "0.6469457", "0.64446455...
0.6336992
31
True should only be used for testing purposes, it says that everyone is authenticated!
func True(baseURL string) Strategy { return authTrue{ baseURL: baseURL, } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func (a Anonymous) Authenticated() bool { return false }", "func isAuthenticated(w http.ResponseWriter, r *http.Request) {\n\tisLoggedIn := isLoggedIn(r)\n\n\tresp := map[string]interface{}{\n\t\t\"success\": isLoggedIn,\n\t}\n\tapiResponse(resp, w)\n}", "func (recv *receiver) isAuthenticated() bool {\n\tif re...
[ "0.77358335", "0.7350411", "0.71787417", "0.7091597", "0.7025409", "0.7012067", "0.6959855", "0.6881702", "0.68452483", "0.6821381", "0.6777624", "0.6702661", "0.66996557", "0.6635247", "0.661886", "0.66089845", "0.6597713", "0.65401727", "0.6521271", "0.65150636", "0.6510117...
0.58030546
79
Fetch retrieves a phone number resource See for more details Context is defaulted to Background. See for more information
func (c Client) Fetch() (*FetchIncomingPhoneNumberResponse, error) { return c.FetchWithContext(context.Background()) }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func (c Client) FetchWithContext(context context.Context) (*FetchIncomingPhoneNumberResponse, error) {\n\top := client.Operation{\n\t\tMethod: http.MethodGet,\n\t\tURI: \"/Accounts/{accountSid}/IncomingPhoneNumbers/{sid}.json\",\n\t\tPathParams: map[string]string{\n\t\t\t\"accountSid\": c.accountSid,\n\t\t\t\"s...
[ "0.60177976", "0.5824734", "0.5673012", "0.5629686", "0.5505302", "0.5459282", "0.54561484", "0.5361664", "0.53290045", "0.5169997", "0.5153889", "0.5087201", "0.5074009", "0.5051332", "0.5050677", "0.5016039", "0.50082606", "0.49904212", "0.49762186", "0.49649933", "0.496382...
0.7438931
0
FetchWithContext retrieves a phone number resource See for more details
func (c Client) FetchWithContext(context context.Context) (*FetchIncomingPhoneNumberResponse, error) { op := client.Operation{ Method: http.MethodGet, URI: "/Accounts/{accountSid}/IncomingPhoneNumbers/{sid}.json", PathParams: map[string]string{ "accountSid": c.accountSid, "sid": c.sid, }, } response := &FetchIncomingPhoneNumberResponse{} if err := c.client.Send(context, op, nil, response); err != nil { return nil, err } return response, nil }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func (c Client) Fetch() (*FetchIncomingPhoneNumberResponse, error) {\n\treturn c.FetchWithContext(context.Background())\n}", "func (_obj *DataService) HasPhoneWithContext(tarsCtx context.Context, phone string, phoneExist *bool, _opt ...map[string]string) (ret int32, err error) {\n\n\tvar length int32\n\tvar have...
[ "0.6585963", "0.5658682", "0.5600527", "0.53562325", "0.5331787", "0.52035147", "0.5187026", "0.51413673", "0.51345986", "0.5115097", "0.5114629", "0.5031288", "0.50233984", "0.5000459", "0.49247894", "0.48535225", "0.4846251", "0.4827607", "0.48153108", "0.48106825", "0.4782...
0.7211016
0
Execute executes root command
func Execute() { if err := rootCmd.Execute(); err != nil { fmt.Println(err) } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func Execute() error {\n\treturn rootCmd.Execute()\n}", "func Execute() error {\n\treturn rootCmd.Execute()\n}", "func Execute() error {\n\treturn rootCmd.Execute()\n}", "func Execute() error {\n\treturn rootCmd.Execute()\n}", "func Execute() error {\n\treturn rootCmd.Execute()\n}", "func Execute() error...
[ "0.8431804", "0.8431804", "0.8431804", "0.8431804", "0.8431804", "0.8431804", "0.8431804", "0.8431804", "0.8431804", "0.8431804", "0.8431804", "0.8431804", "0.8431804", "0.8431804", "0.8431804", "0.8431804", "0.8431804", "0.8431804", "0.8431804", "0.8431804", "0.8431804", "...
0.83705604
31
NewValidateCreateAnomalyDetectionDiskEventParams creates a new ValidateCreateAnomalyDetectionDiskEventParams object with the default values initialized.
func NewValidateCreateAnomalyDetectionDiskEventParams() *ValidateCreateAnomalyDetectionDiskEventParams { var () return &ValidateCreateAnomalyDetectionDiskEventParams{ timeout: cr.DefaultTimeout, } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func NewValidateCreateAnomalyDetectionDiskEventParamsWithHTTPClient(client *http.Client) *ValidateCreateAnomalyDetectionDiskEventParams {\n\tvar ()\n\treturn &ValidateCreateAnomalyDetectionDiskEventParams{\n\t\tHTTPClient: client,\n\t}\n}", "func NewValidateCreateAnomalyDetectionDiskEventParamsWithTimeout(timeou...
[ "0.7977251", "0.7609439", "0.7068783", "0.6903687", "0.66981363", "0.66625434", "0.64095527", "0.5028895", "0.49809852", "0.4936524", "0.4910335", "0.4879529", "0.48306087", "0.47612834", "0.46680626", "0.46357358", "0.46251673", "0.45927116", "0.45336115", "0.45284343", "0.4...
0.8647856
0
NewValidateCreateAnomalyDetectionDiskEventParamsWithTimeout creates a new ValidateCreateAnomalyDetectionDiskEventParams object with the default values initialized, and the ability to set a timeout on a request
func NewValidateCreateAnomalyDetectionDiskEventParamsWithTimeout(timeout time.Duration) *ValidateCreateAnomalyDetectionDiskEventParams { var () return &ValidateCreateAnomalyDetectionDiskEventParams{ timeout: timeout, } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func (o *ValidateCreateAnomalyDetectionDiskEventParams) WithTimeout(timeout time.Duration) *ValidateCreateAnomalyDetectionDiskEventParams {\n\to.SetTimeout(timeout)\n\treturn o\n}", "func NewValidateCreateAnomalyDetectionDiskEventParams() *ValidateCreateAnomalyDetectionDiskEventParams {\n\tvar ()\n\treturn &Vali...
[ "0.8055414", "0.7582346", "0.7013783", "0.6802064", "0.6197475", "0.602131", "0.57749593", "0.5656192", "0.5575306", "0.55126685", "0.5423514", "0.5379903", "0.53752625", "0.5371916", "0.5364046", "0.5356103", "0.53343153", "0.52897924", "0.52777815", "0.5271008", "0.5241991"...
0.8468644
0
NewValidateCreateAnomalyDetectionDiskEventParamsWithContext creates a new ValidateCreateAnomalyDetectionDiskEventParams object with the default values initialized, and the ability to set a context for a request
func NewValidateCreateAnomalyDetectionDiskEventParamsWithContext(ctx context.Context) *ValidateCreateAnomalyDetectionDiskEventParams { var () return &ValidateCreateAnomalyDetectionDiskEventParams{ Context: ctx, } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func NewValidateCreateAnomalyDetectionDiskEventParams() *ValidateCreateAnomalyDetectionDiskEventParams {\n\tvar ()\n\treturn &ValidateCreateAnomalyDetectionDiskEventParams{\n\n\t\ttimeout: cr.DefaultTimeout,\n\t}\n}", "func NewValidateCreateAnomalyDetectionDiskEventParamsWithHTTPClient(client *http.Client) *Vali...
[ "0.78989136", "0.76160055", "0.70350945", "0.69921076", "0.68241984", "0.615827", "0.599709", "0.47806025", "0.47231936", "0.4633743", "0.45910293", "0.44896173", "0.43707833", "0.4338113", "0.43370208", "0.42844075", "0.42407042", "0.42394692", "0.42143732", "0.42122546", "0...
0.84938425
0
NewValidateCreateAnomalyDetectionDiskEventParamsWithHTTPClient creates a new ValidateCreateAnomalyDetectionDiskEventParams object with the default values initialized, and the ability to set a custom HTTPClient for a request
func NewValidateCreateAnomalyDetectionDiskEventParamsWithHTTPClient(client *http.Client) *ValidateCreateAnomalyDetectionDiskEventParams { var () return &ValidateCreateAnomalyDetectionDiskEventParams{ HTTPClient: client, } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func (o *ValidateCreateAnomalyDetectionDiskEventParams) WithHTTPClient(client *http.Client) *ValidateCreateAnomalyDetectionDiskEventParams {\n\to.SetHTTPClient(client)\n\treturn o\n}", "func NewValidateCreateAnomalyDetectionDiskEventParams() *ValidateCreateAnomalyDetectionDiskEventParams {\n\tvar ()\n\treturn &V...
[ "0.8327069", "0.70185035", "0.67619973", "0.6500562", "0.60969204", "0.59961534", "0.59404904", "0.59183556", "0.5709208", "0.5660249", "0.56007624", "0.55978113", "0.55552834", "0.54664594", "0.537748", "0.53703725", "0.53691846", "0.5349769", "0.5288904", "0.52809405", "0.5...
0.8368145
0
WithTimeout adds the timeout to the validate create anomaly detection disk event params
func (o *ValidateCreateAnomalyDetectionDiskEventParams) WithTimeout(timeout time.Duration) *ValidateCreateAnomalyDetectionDiskEventParams { o.SetTimeout(timeout) return o }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func (o *ValidateCreateAnomalyDetectionDiskEventParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "func NewValidateCreateAnomalyDetectionDiskEventParamsWithTimeout(timeout time.Duration) *ValidateCreateAnomalyDetectionDiskEventParams {\n\tvar ()\n\treturn &ValidateCreateAnomalyDetectionDisk...
[ "0.7189499", "0.69476575", "0.6387285", "0.6127074", "0.592812", "0.59120953", "0.5909155", "0.58984953", "0.583984", "0.5824878", "0.581385", "0.5808678", "0.58043957", "0.5803733", "0.5779184", "0.57258874", "0.57109934", "0.5698315", "0.56639814", "0.5615885", "0.56069446"...
0.7611753
0
SetTimeout adds the timeout to the validate create anomaly detection disk event params
func (o *ValidateCreateAnomalyDetectionDiskEventParams) SetTimeout(timeout time.Duration) { o.timeout = timeout }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func (o *ValidateCreateAnomalyDetectionDiskEventParams) WithTimeout(timeout time.Duration) *ValidateCreateAnomalyDetectionDiskEventParams {\n\to.SetTimeout(timeout)\n\treturn o\n}", "func (o *FileInfoCreateParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "func (o *CreateLifecycleParams) ...
[ "0.7360465", "0.7286983", "0.70200294", "0.6936747", "0.6879686", "0.6790714", "0.6787776", "0.6773603", "0.67690927", "0.67641747", "0.6741514", "0.6710848", "0.66715544", "0.66256624", "0.66121364", "0.66099334", "0.6607404", "0.6592908", "0.65900815", "0.6586507", "0.65860...
0.82259035
0
WithContext adds the context to the validate create anomaly detection disk event params
func (o *ValidateCreateAnomalyDetectionDiskEventParams) WithContext(ctx context.Context) *ValidateCreateAnomalyDetectionDiskEventParams { o.SetContext(ctx) return o }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func (m *VMVolumeCreationParams) ContextValidate(ctx context.Context, formats strfmt.Registry) error {\n\tvar res []error\n\n\tif err := m.contextValidateElfStoragePolicy(ctx, formats); err != nil {\n\t\tres = append(res, err)\n\t}\n\n\tif err := m.contextValidateSizeUnit(ctx, formats); err != nil {\n\t\tres = app...
[ "0.5943772", "0.58909607", "0.58349013", "0.57999563", "0.57827944", "0.5740681", "0.5737816", "0.571996", "0.56811744", "0.5654252", "0.5654151", "0.56178325", "0.56175965", "0.56051695", "0.5603444", "0.5560031", "0.55424637", "0.55214834", "0.5504825", "0.5498485", "0.5489...
0.66061366
0
SetContext adds the context to the validate create anomaly detection disk event params
func (o *ValidateCreateAnomalyDetectionDiskEventParams) SetContext(ctx context.Context) { o.Context = ctx }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func (o *ValidateCreateAnomalyDetectionDiskEventParams) WithContext(ctx context.Context) *ValidateCreateAnomalyDetectionDiskEventParams {\n\to.SetContext(ctx)\n\treturn o\n}", "func (m *NfsExportCreationParams) ContextValidate(ctx context.Context, formats strfmt.Registry) error {\n\treturn nil\n}", "func (rec ...
[ "0.70760375", "0.5917966", "0.5904085", "0.58512914", "0.5800697", "0.57943416", "0.5761121", "0.57570463", "0.5737906", "0.5687909", "0.5654442", "0.5629598", "0.5559078", "0.55423695", "0.553606", "0.5504134", "0.55035645", "0.5488992", "0.54832834", "0.5477848", "0.5464404...
0.677753
1
WithHTTPClient adds the HTTPClient to the validate create anomaly detection disk event params
func (o *ValidateCreateAnomalyDetectionDiskEventParams) WithHTTPClient(client *http.Client) *ValidateCreateAnomalyDetectionDiskEventParams { o.SetHTTPClient(client) return o }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func (o *ValidateCreateAnomalyDetectionDiskEventParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "func NewValidateCreateAnomalyDetectionDiskEventParamsWithHTTPClient(client *http.Client) *ValidateCreateAnomalyDetectionDiskEventParams {\n\tvar ()\n\treturn &ValidateCreateAnomalyDetection...
[ "0.73106545", "0.6677077", "0.6381298", "0.6102895", "0.6074314", "0.60508007", "0.6032167", "0.6009698", "0.59386265", "0.59197384", "0.58717716", "0.58530694", "0.5832113", "0.578593", "0.5780251", "0.57785845", "0.57711965", "0.57654274", "0.5756823", "0.57354456", "0.5712...
0.75251514
0
SetHTTPClient adds the HTTPClient to the validate create anomaly detection disk event params
func (o *ValidateCreateAnomalyDetectionDiskEventParams) SetHTTPClient(client *http.Client) { o.HTTPClient = client }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func (o *CreateEventAlertConditionParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "func (o *ValidateCreateAnomalyDetectionDiskEventParams) WithHTTPClient(client *http.Client) *ValidateCreateAnomalyDetectionDiskEventParams {\n\to.SetHTTPClient(client)\n\treturn o\n}", "func (o *FileIn...
[ "0.7470085", "0.7298815", "0.7279338", "0.7270448", "0.72573", "0.7251727", "0.72381556", "0.7171434", "0.7168642", "0.71093386", "0.7044503", "0.70371735", "0.7037165", "0.70271677", "0.69839877", "0.6973847", "0.697179", "0.6959221", "0.69567066", "0.6947108", "0.6944572", ...
0.84539205
0
WithBody adds the body to the validate create anomaly detection disk event params
func (o *ValidateCreateAnomalyDetectionDiskEventParams) WithBody(body *dynatrace.DiskEventAnomalyDetectionConfig) *ValidateCreateAnomalyDetectionDiskEventParams { o.SetBody(body) return o }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func NewValidateCreateAnomalyDetectionDiskEventParams() *ValidateCreateAnomalyDetectionDiskEventParams {\n\tvar ()\n\treturn &ValidateCreateAnomalyDetectionDiskEventParams{\n\n\t\ttimeout: cr.DefaultTimeout,\n\t}\n}", "func (o *ValidateCreateAnomalyDetectionDiskEventParams) SetBody(body *dynatrace.DiskEventAnoma...
[ "0.6171052", "0.6097584", "0.60782963", "0.57583094", "0.569712", "0.5620338", "0.5547921", "0.54595846", "0.53731334", "0.5274153", "0.52110165", "0.514304", "0.5132416", "0.49500784", "0.49387568", "0.4919972", "0.48995632", "0.48722732", "0.4861128", "0.4841427", "0.482758...
0.698079
0
SetBody adds the body to the validate create anomaly detection disk event params
func (o *ValidateCreateAnomalyDetectionDiskEventParams) SetBody(body *dynatrace.DiskEventAnomalyDetectionConfig) { o.Body = body }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func (o *ValidateCreateServiceRequestNamingParams) SetBody(body *dynatrace.RequestNaming) {\n\to.Body = body\n}", "func (o *UpdateEventParams) SetBody(body *models.Event) {\n\to.Body = body\n}", "func (o *CreateDashboardRenderTaskParams) SetBody(body *models.CreateDashboardRenderTask) {\n\to.Body = body\n}", ...
[ "0.6159029", "0.6080955", "0.60065275", "0.5994568", "0.59874004", "0.59266406", "0.5898191", "0.5773824", "0.5687035", "0.56381845", "0.5631992", "0.56269395", "0.561802", "0.5585539", "0.5528684", "0.5472717", "0.5429385", "0.53950125", "0.53935003", "0.5375957", "0.5372451...
0.7403387
0
WriteToRequest writes these params to a swagger request
func (o *ValidateCreateAnomalyDetectionDiskEventParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { if err := r.SetTimeout(o.timeout); err != nil { return err } var res []error if o.Body != nil { if err := r.SetBodyParam(o.Body); err != nil { return err } } if len(res) > 0 { return errors.CompositeValidationError(res...) } return nil }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func (o *FileInfoCreateParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error {\n\n\tif err := r.SetTimeout(o.timeout); err != nil {\n\t\treturn err\n\t}\n\tvar res []error\n\n\tif o.ByteOffset != nil {\n\n\t\t// query param byte_offset\n\t\tvar qrByteOffset int64\n\n\t\tif o.ByteOffset != nil ...
[ "0.7197684", "0.7143436", "0.70474225", "0.70220006", "0.69955575", "0.69946444", "0.697959", "0.6978197", "0.69692016", "0.69657797", "0.6923328", "0.6907898", "0.6903574", "0.68703294", "0.6857265", "0.68562853", "0.685186", "0.68445694", "0.6843865", "0.68413115", "0.68303...
0.0
-1
NewParkingLotUsecase will create new an NewParkingLotUsecase object representation of domain.NewParkingLotUsecase interface
func NewParkingLotUsecase(a domain.ParkingLotRepository, timeout time.Duration) domain.ParkingLotUsecase { return &parkingLotUsecase{ parkingLotRepo: a, contextTimeout: timeout, } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func NewBusinessScenarioPlanner()(*BusinessScenarioPlanner) {\n m := &BusinessScenarioPlanner{\n Entity: *NewEntity(),\n }\n return m\n}", "func NewTrainCar() TrainCar {\n c := TrainCar{name: \"TrainCar\", vehicle: \"TrainCar\", speed: 30, capacity: 30, railway: \"CNR\"}\n return c\n}", "func...
[ "0.5842782", "0.57481986", "0.56187475", "0.5570555", "0.543314", "0.53436655", "0.52992886", "0.52857757", "0.52671325", "0.5232486", "0.51309997", "0.5117802", "0.51166123", "0.5093931", "0.50716466", "0.5067203", "0.5049016", "0.5048438", "0.5003215", "0.5000063", "0.49896...
0.7265965
0
Err returns the last error encountered while paging.
func (p *DeploymentScriptsListByResourceGroupPager) Err() error { return p.err }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func (p *PaginatedResult) Err() error {\n\treturn p.err\n}", "func (p *SmartGroupsClientGetAllPager) Err() error {\n\treturn p.err\n}", "func (p *AlertsClientGetAllPager) Err() error {\n\treturn p.err\n}", "func (p *AzureFirewallsClientListPager) Err() error {\n\treturn p.err\n}", "func (p *PrivateLinkReso...
[ "0.71781874", "0.7132234", "0.71245384", "0.7120786", "0.7088907", "0.7079575", "0.70702946", "0.70490265", "0.7018319", "0.6989553", "0.695567", "0.69453233", "0.6935331", "0.6925309", "0.6916923", "0.68996024", "0.6896403", "0.68959993", "0.6891861", "0.6891023", "0.6887537...
0.0
-1
NextPage returns true if the pager advanced to the next page. Returns false if there are no more pages or an error occurred.
func (p *DeploymentScriptsListByResourceGroupPager) NextPage(ctx context.Context) bool { var req *policy.Request var err error if !reflect.ValueOf(p.current).IsZero() { if p.current.DeploymentScriptListResult.NextLink == nil || len(*p.current.DeploymentScriptListResult.NextLink) == 0 { return false } req, err = p.advancer(ctx, p.current) } else { req, err = p.requester(ctx) } if err != nil { p.err = err return false } resp, err := p.client.pl.Do(req) if err != nil { p.err = err return false } if !runtime.HasStatusCode(resp, http.StatusOK) { p.err = p.client.listByResourceGroupHandleError(resp) return false } result, err := p.client.listByResourceGroupHandleResponse(resp) if err != nil { p.err = err return false } p.current = result return true }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func (p *Pagination) HasNext() bool {\n\treturn p.Page+1 <= p.NumPages()\n}", "func (p *SmartGroupsClientGetAllPager) NextPage(ctx context.Context) bool {\n\tvar req *policy.Request\n\tvar err error\n\tif !reflect.ValueOf(p.current).IsZero() {\n\t\tif p.current.SmartGroupsList.NextLink == nil || len(*p.current.S...
[ "0.6933959", "0.69104683", "0.6902021", "0.6887859", "0.6865384", "0.6842242", "0.68127084", "0.6801136", "0.6781187", "0.67578614", "0.67578614", "0.6748404", "0.67408264", "0.66957474", "0.66940117", "0.66798955", "0.6679727", "0.6656323", "0.66435057", "0.6641304", "0.6637...
0.6522806
51
PageResponse returns the current DeploymentScriptsListByResourceGroupResponse page.
func (p *DeploymentScriptsListByResourceGroupPager) PageResponse() DeploymentScriptsListByResourceGroupResponse { return p.current }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func (p *VirtualHubsClientListByResourceGroupPager) PageResponse() VirtualHubsClientListByResourceGroupResponse {\n\treturn p.current\n}", "func (p *DdosProtectionPlansClientListByResourceGroupPager) PageResponse() DdosProtectionPlansClientListByResourceGroupResponse {\n\treturn p.current\n}", "func (p *Accoun...
[ "0.61588115", "0.6053747", "0.60201657", "0.6003196", "0.59671813", "0.5928203", "0.5914979", "0.587309", "0.5829479", "0.58222055", "0.5811157", "0.57919514", "0.5764543", "0.5756858", "0.5732701", "0.57273406", "0.56606054", "0.56596446", "0.56431043", "0.5635589", "0.56145...
0.7542869
0
Err returns the last error encountered while paging.
func (p *DeploymentScriptsListBySubscriptionPager) Err() error { return p.err }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func (p *PaginatedResult) Err() error {\n\treturn p.err\n}", "func (p *SmartGroupsClientGetAllPager) Err() error {\n\treturn p.err\n}", "func (p *AlertsClientGetAllPager) Err() error {\n\treturn p.err\n}", "func (p *AzureFirewallsClientListPager) Err() error {\n\treturn p.err\n}", "func (p *PrivateLinkReso...
[ "0.71781874", "0.7132234", "0.71245384", "0.7120786", "0.7088907", "0.7079575", "0.70702946", "0.70490265", "0.7018319", "0.6989553", "0.695567", "0.69453233", "0.6935331", "0.6925309", "0.6916923", "0.68996024", "0.6896403", "0.68959993", "0.6891861", "0.6891023", "0.6887537...
0.0
-1
NextPage returns true if the pager advanced to the next page. Returns false if there are no more pages or an error occurred.
func (p *DeploymentScriptsListBySubscriptionPager) NextPage(ctx context.Context) bool { var req *policy.Request var err error if !reflect.ValueOf(p.current).IsZero() { if p.current.DeploymentScriptListResult.NextLink == nil || len(*p.current.DeploymentScriptListResult.NextLink) == 0 { return false } req, err = p.advancer(ctx, p.current) } else { req, err = p.requester(ctx) } if err != nil { p.err = err return false } resp, err := p.client.pl.Do(req) if err != nil { p.err = err return false } if !runtime.HasStatusCode(resp, http.StatusOK) { p.err = p.client.listBySubscriptionHandleError(resp) return false } result, err := p.client.listBySubscriptionHandleResponse(resp) if err != nil { p.err = err return false } p.current = result return true }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func (p *Pagination) HasNext() bool {\n\treturn p.Page+1 <= p.NumPages()\n}", "func (p *SmartGroupsClientGetAllPager) NextPage(ctx context.Context) bool {\n\tvar req *policy.Request\n\tvar err error\n\tif !reflect.ValueOf(p.current).IsZero() {\n\t\tif p.current.SmartGroupsList.NextLink == nil || len(*p.current.S...
[ "0.69336736", "0.6910068", "0.6901863", "0.688831", "0.686525", "0.68420583", "0.68124425", "0.680148", "0.67817", "0.6758141", "0.6758141", "0.67477936", "0.6741167", "0.6695066", "0.66943264", "0.6681217", "0.66799814", "0.6657003", "0.6643805", "0.6641323", "0.6636811", ...
0.0
-1
PageResponse returns the current DeploymentScriptsListBySubscriptionResponse page.
func (p *DeploymentScriptsListBySubscriptionPager) PageResponse() DeploymentScriptsListBySubscriptionResponse { return p.current }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func (p *DeploymentScriptsListByResourceGroupPager) PageResponse() DeploymentScriptsListByResourceGroupResponse {\n\treturn p.current\n}", "func (p *AccountsClientListBySubscriptionPager) PageResponse() AccountsClientListBySubscriptionResponse {\n\treturn p.current\n}", "func (p *DomainsListBySubscriptionPager...
[ "0.6547863", "0.6249684", "0.6231479", "0.6074528", "0.5956464", "0.58353925", "0.5799472", "0.57506186", "0.57301974", "0.5714881", "0.56876177", "0.56841713", "0.56513435", "0.5639212", "0.56340235", "0.55549806", "0.5545648", "0.5505137", "0.5401996", "0.5378753", "0.53398...
0.761867
0
AllocSector finds the best path for this sector to use
func (f *FS) AllocSector(typ DataType, miner address.Address, ssize abi.SectorSize, cache bool, num abi.SectorNumber) (SectorPath, error) { { spath, err := f.FindSector(typ, miner, num) if err == nil { return spath, xerrors.Errorf("allocating sector %s: %m", spath, ErrExists) } if err != ErrNotFound { return "", err } } need := overheadMul[typ] * uint64(ssize) p, err := f.findBestPath(need, cache, false) if err != nil { return "", err } sp := p.Sector(typ, miner, num) return sp, f.reserve(typ, sp.storage(), need) }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func (r *ComDoc) allocSectorTables() {\n\t// work out how many sectors are needed for both\n\tsatPerSector := r.SectorSize / 4\n\tmsatPerSector := satPerSector - 1\n\tfor {\n\t\tif len(r.SAT)%satPerSector != 0 {\n\t\t\tpanic(\"irregularly sized sector table\")\n\t\t}\n\t\tsatSectors := len(r.SAT) / satPerSector\n\...
[ "0.6531526", "0.55464417", "0.5311277", "0.51301605", "0.50938255", "0.50267166", "0.50223935", "0.50222445", "0.49632046", "0.49364078", "0.49089208", "0.486091", "0.48423472", "0.48232087", "0.47796917", "0.4778974", "0.47616217", "0.47598645", "0.47460467", "0.47296306", "...
0.798377
0
get the list of files in the JobInfoDir
func (c *Configuration) JobInfoFiles() ([]string, error) { fileInfos, err := ioutil.ReadDir(c.JobInfoDir) if err != nil { return nil, err } res := []string{} for i := 0; i<len(fileInfos); i++ { fileInfo := fileInfos[i] name := fileInfo.Name() if strings.HasSuffix(name, ".json") { res = append(res, name) } } return res, nil }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func getFileList(dir string) ([]string, error) {\n\tvar fileNames []string\n\tfiles, err := ioutil.ReadDir(dir)\n\tif err != nil {\n\t\treturn fileNames, err\n\t}\n\n\tfor _, file := range files {\n\t\tif !file.IsDir() && filepath.Ext(file.Name()) == \".out\" {\n\t\t\tfileNames = append(fileNames, file.Name())\n\t...
[ "0.6738004", "0.6650834", "0.65649015", "0.63972044", "0.6386861", "0.63821405", "0.63751984", "0.6369589", "0.6284099", "0.6223426", "0.6190669", "0.6143492", "0.6128013", "0.60666806", "0.60534495", "0.60130465", "0.60001355", "0.5971921", "0.595284", "0.5880319", "0.585779...
0.7517042
0
get a list of JobInfo instances by reading files
func (c *Configuration) JobInfoList( files []string) ([]*job_info.JobInfo, error) { res := make([]*job_info.JobInfo, len(files)) for i := 0; i < len(files); i++ { res[i] = job_info.NewJobInfo() err := res[i].ReadFromFile(c.JobInfoDir + "/" + files[i]) if err != nil { return nil, err } } return res, nil }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func (c *Configuration) JobInfoFiles() ([]string, error) {\n\tfileInfos, err := ioutil.ReadDir(c.JobInfoDir)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tres := []string{}\n\tfor i := 0; i<len(fileInfos); i++ {\n\t\tfileInfo := fileInfos[i]\n\t\tname := fileInfo.Name()\n\t\tif strings.HasSuffix(name, \".json\...
[ "0.6094294", "0.6013153", "0.5963445", "0.57480615", "0.57223684", "0.568927", "0.5666574", "0.55211794", "0.54390544", "0.5378759", "0.53388613", "0.5317355", "0.53161746", "0.53106767", "0.5286924", "0.5278277", "0.5275526", "0.5274127", "0.5247469", "0.5245982", "0.5228312...
0.6586617
0
ProcFS creates a proc.FileSystem representing the default procfs mountpoint /proc. When running inside a container, this will contain information from the container's pid namespace.
func ProcFS() proc.FileSystem { fs, err := procfs.NewFileSystem("") if err != nil { glog.Fatal(err) } return fs }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func ProcFS() *proc.FileSystem {\n\treturn proc.FS()\n}", "func HostProcFS() proc.FileSystem {\n\thostProcFSOnce.Do(func() {\n\t\thostProcFS = findHostProcFS()\n\t})\n\n\treturn hostProcFS\n}", "func HostProcFS() *proc.FileSystem {\n\thostProcFSOnce.Do(func() {\n\t\thostProcFS = findHostProcFS()\n\t})\n\n\tret...
[ "0.760197", "0.6918058", "0.6888519", "0.6845408", "0.5938905", "0.5629438", "0.5607776", "0.5424195", "0.53839487", "0.53667194", "0.5349028", "0.5292019", "0.5251152", "0.5177979", "0.5174695", "0.51732606", "0.51594526", "0.514626", "0.5138058", "0.51178694", "0.5115364", ...
0.77894247
0
HostProcFS creates a proc.FileSystem representing the underlying host's procfs. If we are running in the host pid namespace, it uses /proc. Otherwise, it identifies a mountedin host procfs by it being mounted on a directory that isn't /proc and /proc/self linking to a differing PID than that returned by os.Getpid(). If we are running in a container and no mountedin host procfs was identified, then it returns nil.
func HostProcFS() proc.FileSystem { hostProcFSOnce.Do(func() { hostProcFS = findHostProcFS() }) return hostProcFS }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func HostProcFS() *proc.FileSystem {\n\thostProcFSOnce.Do(func() {\n\t\thostProcFS = findHostProcFS()\n\t})\n\n\treturn hostProcFS\n}", "func ProcFS() proc.FileSystem {\n\tfs, err := procfs.NewFileSystem(\"\")\n\tif err != nil {\n\t\tglog.Fatal(err)\n\t}\n\treturn fs\n}", "func ProcFS() *proc.FileSystem {\n\tr...
[ "0.8426301", "0.679312", "0.66974336", "0.60143", "0.5733004", "0.57286805", "0.57118076", "0.53681195", "0.5331099", "0.527021", "0.51754916", "0.51229256", "0.5111104", "0.5068996", "0.50395757", "0.50207096", "0.49939087", "0.490678", "0.489303", "0.484484", "0.4815", "0...
0.8387475
1
TracingDir returns the directory on either the debugfs or tracefs used to control the Linux kernel trace event subsystem.
func TracingDir() string { mounts := HostProcFS().Mounts() // Look for an existing tracefs for _, m := range mounts { if m.FilesystemType == "tracefs" { glog.V(1).Infof("Found tracefs at %s", m.MountPoint) return m.MountPoint } } // If no mounted tracefs has been found, look for it as a // subdirectory of the older debugfs for _, m := range mounts { if m.FilesystemType == "debugfs" { d := filepath.Join(m.MountPoint, "tracing") s, err := os.Stat(filepath.Join(d, "events")) if err == nil && s.IsDir() { glog.V(1).Infof("Found debugfs w/ tracing at %s", d) return d } return m.MountPoint } } return "" }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func TracingDir() string {\n\tmounts := Mounts()\n\n\t// Look for an existing tracefs\n\tfor _, m := range mounts {\n\t\tif m.FilesystemType == \"tracefs\" {\n\t\t\tglog.V(1).Infof(\"Found tracefs at %s\", m.MountPoint)\n\t\t\treturn m.MountPoint\n\t\t}\n\t}\n\n\t// If no mounted tracefs has been found, look for i...
[ "0.8564206", "0.64106494", "0.59586483", "0.5947505", "0.5719515", "0.5587467", "0.54746264", "0.542685", "0.5421473", "0.5372698", "0.5356713", "0.53307366", "0.53164977", "0.53043145", "0.5259979", "0.52455527", "0.5234985", "0.5233929", "0.51598644", "0.51591307", "0.51205...
0.8467846
1
PerfEventDir returns the mountpoint of the perf_event cgroup pseudofilesystem or an empty string if it wasn't found.
func PerfEventDir() string { for _, mi := range HostProcFS().Mounts() { if mi.FilesystemType == "cgroup" { for option := range mi.SuperOptions { if option == "perf_event" { return mi.MountPoint } } } } return "" }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func PerfEventDir() string {\n\tfor _, mi := range Mounts() {\n\t\tif mi.FilesystemType == \"cgroup\" {\n\t\t\tfor option := range mi.SuperOptions {\n\t\t\t\tif option == \"perf_event\" {\n\t\t\t\t\treturn mi.MountPoint\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\n\treturn \"\"\n}", "func TracingDir() string {\n\tmounts :...
[ "0.8565974", "0.6476519", "0.61357117", "0.50944376", "0.5090655", "0.5085397", "0.5061623", "0.50163496", "0.4961857", "0.49506846", "0.4856047", "0.48389697", "0.47908404", "0.47382855", "0.47168255", "0.47013557", "0.469574", "0.46919125", "0.4681249", "0.46691275", "0.466...
0.8672294
0
MountTempFS mounts a filesystem. It is primarily a wrapper around unix.Mount, but it also ensures that the mountpoint exists before attempting to mount to it.
func MountTempFS(source string, target string, fstype string, flags uintptr, data string) error { // Make sure that `target` exists. err := os.MkdirAll(target, 0500) if err != nil { glog.V(2).Infof("Couldn't create temp %s mountpoint: %s", fstype, err) return err } err = unix.Mount(source, target, fstype, flags, data) if err != nil { glog.V(2).Infof("Couldn't mount %s on %s: %s", fstype, target, err) return err } return nil }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func MountFilesystem(mountpoint string, proxy string) {\n\n\t// The proxy URL should end with a slash, add it if the user forgot about this\n\tif proxy[len(proxy)-1] != '/' {\n\t\tproxy += \"/\"\n\t}\n\n\tc, err := fuse.Mount(\n\t\tmountpoint,\n\t\tfuse.FSName(fmt.Sprintf(\"hgmsfs(%s)\", proxy)),\n\t\tfuse.Subtype...
[ "0.6258177", "0.61509657", "0.61509657", "0.60223854", "0.5980758", "0.5885019", "0.5884537", "0.5825131", "0.5823397", "0.5804555", "0.56531787", "0.5624289", "0.56143105", "0.5539166", "0.54718363", "0.54713595", "0.5460068", "0.5445862", "0.54432094", "0.54395497", "0.5422...
0.8210658
1
UnmountTempFS unmounts a filesystem. It is primarily a wrapper around unix.Unmount, but it also removes the mountpoint after the filesystem is unmounted.
func UnmountTempFS(dir string, fstype string) error { err := unix.Unmount(dir, 0) if err != nil { glog.V(2).Infof("Couldn't unmount %s at %s: %s", fstype, dir, err) return err } err = os.Remove(dir) if err != nil { glog.V(2).Infof("Couldn't remove %s: %s", dir, err) return err } return nil }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func Unmount(mountpoint string) (err error) {\n\tlog.Println(\"Unmounting filesystem\")\n\terr = fuse.Unmount(mountpoint)\n\treturn\n}", "func MountTempFS(source string, target string, fstype string, flags uintptr, data string) error {\n\t// Make sure that `target` exists.\n\terr := os.MkdirAll(target, 0500)\n\t...
[ "0.64639926", "0.6294327", "0.6294327", "0.6149197", "0.60893816", "0.5964245", "0.59148586", "0.5852159", "0.58511484", "0.580987", "0.576928", "0.5747482", "0.5734651", "0.57193625", "0.57184225", "0.5698055", "0.56522834", "0.562887", "0.5627233", "0.56222004", "0.5548657"...
0.817883
1
fungsi variadic jumlah parameter yang disisipkan tidak terbatas yang ditmpung sama variabelnya
func main(){ var rata_rata = hitung(10,2,5,8,7,8,2,5,6,12) var pesan = fmt.Sprintf("Rata-rata : %.2f",rata_rata) fmt.Println(pesan) }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func FuncChangeToVariadic(_ ...int) {}", "func example2(a string, val ...int) {\n\tfmt.Println(a)\n\tfmt.Println(val)\n}", "func FuncAddVariadic(_ ...int) {}", "func variadic(x ...int) {\n\tfmt.Println(x)\n\tfmt.Printf(\"%T\\n\", x)\n\t// Receives the variables in a slice of the type of the parameters. ([]in...
[ "0.6316769", "0.6277749", "0.60786474", "0.5912926", "0.57932216", "0.568458", "0.5678213", "0.56359667", "0.5634861", "0.56316566", "0.5580856", "0.5573374", "0.55704665", "0.5554061", "0.55481213", "0.5543412", "0.55362815", "0.5525843", "0.5489114", "0.548236", "0.54810214...
0.0
-1
Equals asserts equality of two values.
func Equals(t *testing.T, actual, expected interface{}, format string, a ...interface{}) { if !reflect.DeepEqual(actual, expected) { msg := fmt.Sprintf(format, a...) t.Errorf("not equal: %s\nactual=%+v\nexpected=%+v", msg, actual, expected) } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func Equal(t Testing, expected, actual interface{}, formatAndArgs ...interface{}) bool {\n\tif !AreEqualObjects(expected, actual) {\n\t\treturn Fail(t,\n\t\t\tfmt.Sprintf(\n\t\t\t\t\"Expected values are NOT equal.%s\",\n\t\t\t\tdiffValues(expected, actual),\n\t\t\t),\n\t\t\tformatAndArgs...)\n\t}\n\n\treturn true\...
[ "0.7212346", "0.7140438", "0.7125134", "0.7118771", "0.7050982", "0.70416135", "0.7012862", "0.6971075", "0.6900521", "0.68735236", "0.6835189", "0.68320405", "0.682615", "0.68192345", "0.68192345", "0.68109655", "0.6790581", "0.6789338", "0.6768855", "0.675772", "0.67543143"...
0.67351145
23
write a json error with header to the output
func JsonError(writer http.ResponseWriter, error_message string) { writer.WriteHeader(http.StatusInternalServerError) writer.Header().Set("Content-Type", "application/json") writer.Write([]byte("{\"error\": \"" + error_message + "\"}")) }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func (a *API) jsonError(res http.ResponseWriter, err common.DetailedError, startedAt time.Time) {\n\ta.logError(&err, startedAt)\n\tjsonErr, _ := json.Marshal(err)\n\n\tres.Header().Add(\"content-type\", \"application/json\")\n\tres.WriteHeader(err.Status)\n\tres.Write(jsonErr)\n}", "func WriteErrJSON(l *zap.Sug...
[ "0.7448407", "0.721666", "0.7147713", "0.709014", "0.69657683", "0.695088", "0.6933193", "0.6830498", "0.6773857", "0.6768427", "0.66996765", "0.6683061", "0.6680793", "0.65883744", "0.65724826", "0.6554943", "0.6554021", "0.6543048", "0.6539291", "0.65299034", "0.6495163", ...
0.7304042
1
write a success message with header to the output
func JsonMessage(writer http.ResponseWriter, info_code int, info_message string) { writer.WriteHeader(info_code) writer.Header().Set("Content-Type", "application/json") writer.Write([]byte("{\"message\": \"" + info_message + "\"}")) }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func Success(w io.Writer, format string, args ...any) {\n\tformat = strings.TrimRight(format, \"\\r\\n\") + \"\\n\"\n\tfmt.Fprintf(w, \"\\n\"+Wrap(BoldGreen(\"SUCCESS: \")+format, DefaultTextWidth)+\"\\n\", args...)\n}", "func writeSuccess(w http.ResponseWriter, targetLanguage language.Tag, targetPhrase string) ...
[ "0.7720925", "0.75208837", "0.6925237", "0.67952013", "0.67613465", "0.66899836", "0.6652819", "0.6578009", "0.6520311", "0.64321697", "0.64295083", "0.63760626", "0.63639045", "0.63398534", "0.62433517", "0.624165", "0.6211086", "0.62089276", "0.6171703", "0.6163954", "0.615...
0.0
-1
write a teach/ask json error with header to the output
func ATJsonError(writer http.ResponseWriter, error_message string) { writer.WriteHeader(http.StatusInternalServerError) writer.Header().Set("Content-Type", "application/json") obj := model.ATResultList{Error: error_message} json_bytes, _ := json.Marshal(obj) writer.Write(json_bytes) }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func writeError(w http.ResponseWriter, err error, code int) error {\n\ttags := []string{\n\t\t\"error_\" + strings.ToLower(\n\t\t\tstrings.ReplaceAll(http.StatusText(code), \" \", \"_\"),\n\t\t),\n\t}\n\n\tdata, err := jsoniter.ConfigFastest.Marshal(map[string]interface{}{\n\t\t\"success\": false,\n\t\t\"code\": ...
[ "0.6981968", "0.6872307", "0.67248374", "0.6696121", "0.669428", "0.66882426", "0.66854435", "0.667467", "0.6583421", "0.65646803", "0.6551456", "0.64788187", "0.644141", "0.6431342", "0.6420616", "0.6388388", "0.63693845", "0.6315508", "0.6286771", "0.62613755", "0.6195387",...
0.64621174
12
write a teach/ask success message with header to the output
func ATJsonMessage(writer http.ResponseWriter, info_code int, info_message string) { writer.WriteHeader(info_code) writer.Header().Set("Content-Type", "application/json") obj := model.ATResultList{ ResultList: make([]model.ATResult,0) } obj.ResultList = append(obj.ResultList, model.ATResult{Text: info_message, Timestamp: util.GetTimeNowSting(), Topic: "K/AI"}) json_bytes, _ := json.Marshal(obj) writer.Write(json_bytes) }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func Success(w io.Writer, format string, args ...any) {\n\tformat = strings.TrimRight(format, \"\\r\\n\") + \"\\n\"\n\tfmt.Fprintf(w, \"\\n\"+Wrap(BoldGreen(\"SUCCESS: \")+format, DefaultTextWidth)+\"\\n\", args...)\n}", "func writeSuccess(w http.ResponseWriter, targetLanguage language.Tag, targetPhrase string) ...
[ "0.69103014", "0.68044895", "0.5927801", "0.5798956", "0.57739043", "0.57026905", "0.5700581", "0.56719536", "0.56467646", "0.5633215", "0.5616624", "0.559593", "0.55451703", "0.5498684", "0.5488845", "0.5468093", "0.5461246", "0.5452703", "0.54313964", "0.53798497", "0.53773...
0.0
-1
RoleExists returns whether profile exists
func GetRole(iamc aws.IAMAPI, roleName *string) (*Role, error) { out, err := iamc.GetRole(&iam.GetRoleInput{ RoleName: roleName, }) if err != nil { return nil, err } outRole := Role{ Arn: out.Role.Arn, Tags: map[string]*string{}, } if out.Role.Tags != nil { for _, tag := range out.Role.Tags { if tag.Key == nil { continue } outRole.Tags[*tag.Key] = tag.Value } } return &outRole, nil }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func (_RBAC *RBACCaller) HasRole(opts *bind.CallOpts, _operator common.Address, _role string) (bool, error) {\n\tvar (\n\t\tret0 = new(bool)\n\t)\n\tout := ret0\n\terr := _RBAC.contract.Call(opts, out, \"hasRole\", _operator, _role)\n\treturn *ret0, err\n}", "func (_Superuserable *SuperuserableCaller) HasRole(op...
[ "0.6787896", "0.6785139", "0.67097485", "0.6696827", "0.6692673", "0.66723514", "0.66641665", "0.6617847", "0.65938026", "0.6579737", "0.6568183", "0.6541493", "0.6508191", "0.65061635", "0.6498168", "0.6493239", "0.64108336", "0.640935", "0.63917893", "0.6374794", "0.6353769...
0.0
-1
New returns a new server with state equal to the return value of the given factory.
func New(factory func() interface{}) *Server { t := topic.New() t.AddSubscriber(1, &subscriber{state: factory()}) return &Server{topic: t} }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func New(addr string) *Server {\n if addr == \"\" {\n addr = DefaultAddr\n }\n return &Server{\n addr: DefaultAddr,\n ds: newDataStore(),\n done: make(chan struct{}),\n }\n}", "func NewServerFactory(ctx context.Context, rcmd *channels.Remote, s string, l *logrus.Logger, wg *sync.WaitGroup) *Ser...
[ "0.6668877", "0.66384757", "0.6611179", "0.654152", "0.654152", "0.64563155", "0.6447488", "0.6444242", "0.6434464", "0.63831216", "0.6364889", "0.63534516", "0.6332981", "0.63056153", "0.6242616", "0.6237104", "0.6193025", "0.6185973", "0.613092", "0.6101046", "0.610016", ...
0.675499
0
Async evaluates the given function using the state of the server as its only argument, it may return before the function has been evaluated.
func (s *Server) Async(fn func(interface{})) { s.topic.Publish(fn) }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func ExpensiveFunction(n interface{}) interface{} {\n\tfmt.Printf(\"Executing expensive calculation for %v\\n\", n)\n\ttime.Sleep(5 * time.Second)\n\treturn n\n}", "func (t TaskFunc) Execute() { t() }", "func CallVal(f func() interface{}) interface{} {\n\tcheckRun()\n\trespChan := make(chan interface{})\n\tcal...
[ "0.54884326", "0.53872144", "0.5377912", "0.5072936", "0.5055439", "0.5038554", "0.5010995", "0.50099576", "0.49985412", "0.4961088", "0.49546096", "0.4948906", "0.49107867", "0.4908908", "0.4825101", "0.47524828", "0.474948", "0.4739776", "0.4734573", "0.46940377", "0.468019...
0.4816828
15
Sync evaluates the given function using the state of the server as its only argument, it return after the function has been evaluated.
func (s *Server) Sync(fn func(interface{}) interface{}) interface{} { ch := make(chan interface{}, 1) s.Async(func(message interface{}) { defer close(ch) ch <- fn(message) }) return <-ch }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func Sync(f func()) {\n\tsyncChan <- f\n}", "func TestSyncFunction(t *testing.T) {\n\tmapper, err := NewChannelMapper(`function(doc) {sync(\"foo\", \"bar\"); sync(\"baz\")}`)\n\tassertNoError(t, err, \"Couldn't create mapper\")\n\tchannels, err := mapper.callMapper(`{\"channels\": []}`)\n\tassertNoError(t, err, ...
[ "0.5580895", "0.54706144", "0.5422586", "0.5316484", "0.5282471", "0.51429075", "0.5124593", "0.5043788", "0.50177395", "0.49903253", "0.49519637", "0.4918952", "0.49022597", "0.48930693", "0.48373848", "0.48258403", "0.4825075", "0.48124862", "0.48095956", "0.48040572", "0.4...
0.61029977
0
Init registers testing flags. These flags are automatically registered by the "go test" command before running test functions, so Init is only needed when calling functions such as Benchmark without using "go test". Init has no effect if it was already called.
func Init() {}
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func init() {\n\ttestEnv.Init()\n}", "func InitFlags() {\n\tinitEnvFlag()\n}", "func Init(cmd *cobra.Command) {\n\tapi.RegisterBenchmark(&benchEthBlockNumber{})\n\tapi.RegisterBenchmark(&benchNetVersion{})\n\tapi.RegisterBenchmark(&benchEthGetBlockByNumber{})\n}", "func InitFlags() *FactoryOptions {\n\ttesti...
[ "0.70790935", "0.6898078", "0.68355215", "0.67986417", "0.6779053", "0.6766589", "0.66843873", "0.66655123", "0.66454095", "0.66173506", "0.66151476", "0.6604759", "0.6604005", "0.659418", "0.65715605", "0.6545239", "0.6523597", "0.6521723", "0.65161896", "0.6418926", "0.6413...
0.0
-1
Short reports whether the test.short flag is set.
func Short() bool { // possible: panic("testing: Short called before Init") // possible: panic("testing: Short called before Parse") }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func Short() bool", "func TestHelloShort(t *testing.T) {\n\tif testing.Short() {\n\t\tt.Skip(\"skipped\")\n\t}\n\n\t// 後続の時間のかかるテスト\n}", "func (field *Field) SetShort() {\n\tfield.Short = field.Get(\"short\")\n}", "func isShortFlag(value string) bool {\n\treturn isFlag(value) && len(value) == 2 && !strings.H...
[ "0.7731075", "0.68418634", "0.65344787", "0.6520868", "0.64654624", "0.6450551", "0.64211386", "0.6411943", "0.6330205", "0.6225934", "0.6187232", "0.6177478", "0.6140601", "0.61338013", "0.61015755", "0.6095324", "0.6078198", "0.6049536", "0.60252917", "0.60129523", "0.59848...
0.8105215
0
CoverMode reports what the test coverage mode is set to. The values are "set", "count", or "atomic". The return value will be empty if test coverage is not enabled.
func CoverMode() string {}
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func CoverMode(mode string) Option {\n\treturn func(o *options) error {\n\t\to.covermode = mode\n\t\treturn nil\n\t}\n}", "func Coverage() error {\n\tmg.Deps(Test)\n\treturn sh.Run(\"go\", \"tool\", \"cover\", \"-html=coverage.out\")\n}", "func Coverage() error {\n\tif _, err := os.Stat(\"./coverage.out\"); er...
[ "0.6478001", "0.5366792", "0.5278076", "0.52265596", "0.52214974", "0.5090226", "0.49276546", "0.49117792", "0.48825347", "0.48458752", "0.4835405", "0.46647367", "0.46344316", "0.46044812", "0.4565363", "0.45509803", "0.45235664", "0.44996905", "0.44412193", "0.44362083", "0...
0.65399575
0
Verbose reports whether the test.v flag is set.
func Verbose() bool { // possible: panic("testing: Verbose called before Init") // possible: panic("testing: Verbose called before Parse") }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func VerboseTest() bool {\n\tflag := flag.Lookup(\"test.v\")\n\treturn flag != nil && flag.Value.String() == \"true\"\n}", "func VerboseTest() bool {\n\tvar buf [2048]byte\n\tn := runtime.Stack(buf[:], false)\n\tif bytes.Index(buf[:n], []byte(\"TestNonVerbose\")) != -1 {\n\t\treturn false\n\t}\n\n\tflag := flag....
[ "0.8219944", "0.77900326", "0.73779184", "0.72216606", "0.7048828", "0.6968071", "0.6917209", "0.65574235", "0.6455272", "0.6455272", "0.6342419", "0.633263", "0.63211787", "0.62211806", "0.6217348", "0.62132", "0.62004864", "0.6159226", "0.6104627", "0.6104502", "0.607373", ...
0.65761465
7
Main is an internal function, part of the implementation of the "go test" command. It was exported because it is crosspackage and predates "internal" packages. It is no longer used by "go test" but preserved, as much as possible, for other systems that simulate "go test" using Main, but Main sometimes cannot be updated as new functionality is added to the testing package. Systems simulating "go test" should be updated to use MainStart.
func Main(matchString func(pat, str string) (bool, error), tests []InternalTest, benchmarks []InternalBenchmark, examples []InternalExample) {}
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func TestMain(m *testing.M) {\n\tos.Exit(testscript.RunMain(m, map[string]func() int{\n\t\t\"main\": main1,\n\t}))\n}", "func TestMain(m *testing.M) {\n\tos.Exit(testMain(m))\n}", "func TestMain(m *testing.M) {\n\tos.Exit(testMain(m))\n}", "func TestMain(m *testing.M) {\n\tos.Exit(testMain(m))\n}", "func T...
[ "0.7855635", "0.77311206", "0.77311206", "0.77311206", "0.7662056", "0.7522855", "0.7515142", "0.7501964", "0.74927384", "0.74730176", "0.7459258", "0.7459258", "0.7459258", "0.7456344", "0.7455583", "0.744522", "0.74388605", "0.7376313", "0.7376313", "0.7376313", "0.73496336...
0.0
-1
MainStart is meant for use by tests generated by 'go test'. It is not meant to be called directly and is not subject to the Go 1 compatibility document. It may change signature from release to release.
func MainStart(deps testDeps, tests []InternalTest, benchmarks []InternalBenchmark, examples []InternalExample) *M {}
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func TestStart(t *testing.T) {\n\tTestingT(t)\n}", "func Start(entryPoint interface{}) {\n\tapp := &App{\n\t\tEntryPoint: entryPoint,\n\t\tCtors: GetCtors(),\n\t\tDtors: GetDtors(),\n\t}\n\tif err := app.Run(); err != nil {\n\t\tlog.Fatal(err.Error())\n\t}\n}", "func TestMain(m *testing.M) {\n\tos.Ex...
[ "0.6651523", "0.6557407", "0.6542749", "0.6516005", "0.64983016", "0.64894754", "0.6442193", "0.64012825", "0.6369519", "0.63639724", "0.6340145", "0.6325003", "0.6300346", "0.6300346", "0.6300346", "0.62951183", "0.6283727", "0.62814456", "0.6273109", "0.6273109", "0.6269826...
0.73757213
0
Run runs the tests. It returns an exit code to pass to os.Exit.
func (m *M) Run() int {}
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func (t testCommand) Run() error {\n\tif t.shouldFail {\n\t\treturn errors.New(\"I AM ERROR\")\n\t}\n\treturn nil\n}", "func Run(m *testing.M, opts ...RunOption) {\n\t// Run tests in a separate function such that we can use deferred statements and still\n\t// (indirectly) call `os.Exit()` in case the test setup ...
[ "0.7075935", "0.6968736", "0.6907351", "0.6861133", "0.68104595", "0.6731979", "0.6706079", "0.6689381", "0.6647677", "0.66201144", "0.66130835", "0.6571867", "0.6571867", "0.65591496", "0.6545805", "0.65347755", "0.65086806", "0.6502607", "0.64886713", "0.64882946", "0.64779...
0.0
-1
RunTests is an internal function but exported because it is crosspackage; it is part of the implementation of the "go test" command.
func RunTests(matchString func(pat, str string) (bool, error), tests []InternalTest) (ok bool) {}
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func RunTests(opts Options) {\n\tif opts.Cleanup {\n\t\terr := CleanupTests(opts.Driver, opts.DSN, opts.Verbose)\n\t\tif err != nil {\n\t\t\tfmt.Printf(\"Cleanup failed: %s\\n\", err)\n\t\t\tos.Exit(1)\n\t\t}\n\t\tos.Exit(0)\n\t}\n\t_ = flag.Set(\"test.run\", opts.Match)\n\tif opts.Verbose {\n\t\t_ = flag.Set(\"te...
[ "0.75176436", "0.71770805", "0.71047145", "0.70926744", "0.70433205", "0.69975567", "0.69620216", "0.6948858", "0.6947141", "0.68886244", "0.6835153", "0.6806744", "0.6799127", "0.67480135", "0.67230546", "0.6647444", "0.65697587", "0.6532074", "0.65249354", "0.6519513", "0.6...
0.6647721
15
AllocsPerRun returns the average number of allocations during calls to f. Although the return value has type float64, it will always be an integral value. To compute the number of allocations, the function will first be run once as a warmup. The average number of allocations over the specified number of runs will then be measured and returned. AllocsPerRun sets GOMAXPROCS to 1 during its measurement and will restore it before returning.
func AllocsPerRun(runs int, f func()) (avg float64) {}
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func AllocsPerRun(runs int, f func()) (avg float64)", "func (r BenchmarkResult) AllocsPerOp() int64 {}", "func processRun(nRequests int, concurrency int, ch chan time.Duration, fun func()) []float64 {\n\tresults := make([]float64, 0, nRequests)\n\n\tn := nRequests\n\tfor n > 0 {\n\t\tfor i := 0; i < concurrenc...
[ "0.8254955", "0.5656407", "0.49444196", "0.48704565", "0.481819", "0.48059502", "0.4730157", "0.47268108", "0.46950564", "0.46740502", "0.4658304", "0.4651064", "0.46304864", "0.45891875", "0.45341447", "0.45259058", "0.4485292", "0.44815636", "0.4479504", "0.4464512", "0.443...
0.8242568
1
StartTimer starts timing a test. This function is called automatically before a benchmark starts, but it can also be used to resume timing after a call to StopTimer.
func (b *B) StartTimer() {}
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func (c *Mock) StartTimer(d time.Duration) {\n\tc.FakeStartTimer(d)\n}", "func (t *Timer) StartTimer() {\n\tt.start = time.Now()\n}", "func (b *B) StartTimer()", "func startTimer(name string) func() {\n\tt := time.Now()\n\tlog.Println(name, \"started\")\n\treturn func() {\n\t\td := time.Now().Sub(t)\n\t\tlog...
[ "0.7461336", "0.7087315", "0.6641407", "0.65067357", "0.6499249", "0.6474908", "0.64326847", "0.6320044", "0.6317354", "0.6302466", "0.6290639", "0.6218009", "0.61945933", "0.61817944", "0.6150907", "0.6118142", "0.6114189", "0.611406", "0.61011887", "0.6058078", "0.5994329",...
0.6173007
14
StopTimer stops timing a test. This can be used to pause the timer while performing complex initialization that you don't want to measure.
func (b *B) StopTimer() {}
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func (c *Mock) StopTimer() {\n\tc.FakeStopTimer()\n}", "func (b *B) StopTimer()", "func (t *Timer) StopTimer() {\n\tt.end = time.Now()\n}", "func (NilTimer) Stop() {}", "func (t *StandardTimer) Stop() {\n\tt.meter.Stop()\n}", "func (t *TimerSnapshot) Stop() {}", "func (t *Timer) Stop() {\n\tif t.w == n...
[ "0.7580399", "0.7422544", "0.74062115", "0.7118259", "0.68404835", "0.6725982", "0.65600497", "0.6555783", "0.6548834", "0.65385425", "0.64515626", "0.6443249", "0.6393915", "0.63685316", "0.6154625", "0.6152977", "0.61397845", "0.61309195", "0.61257225", "0.60119367", "0.600...
0.6915054
4
ResetTimer zeroes the elapsed benchmark time and memory allocation counters and deletes userreported metrics. It does not affect whether the timer is running.
func (b *B) ResetTimer() {}
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func (timer *RealRTimer) Reset(d time.Duration) {\n\tif timer.innerTimer == nil {\n\t\ttimer.innerTimer = time.NewTimer(d)\n\t} else {\n\t\ttimer.innerTimer.Reset(d)\n\t}\n}", "func (b *B) ResetTimer()", "func (t *Timer) Reset() {\n\tt.goalTime = math.MaxFloat64\n\tt.startTime = time.Now()\n}", "func (t *Tim...
[ "0.6965523", "0.66154885", "0.65605336", "0.64812165", "0.64749223", "0.6459077", "0.6390338", "0.6357963", "0.6337308", "0.63212603", "0.62888485", "0.6248405", "0.6209185", "0.6205625", "0.61693007", "0.60795414", "0.6076847", "0.6069499", "0.58611387", "0.58267415", "0.580...
0.6101085
15