query
stringlengths
8
6.75k
document
stringlengths
9
1.89M
negatives
listlengths
19
19
metadata
dict
HostUUIDExistsLocally checks if dataDir/host_uuid file exists in local storage.
func HostUUIDExistsLocally(dataDir string) bool { _, err := ReadHostUUID(dataDir) return err == nil }
[ "func (r *Release) localExist() error {\n\tvar (\n\t\tversion string = fmt.Sprintf(\"terraform-%s.zip\", r.Version)\n\t\terr error\n\t)\n\n\tif _, err = os.Stat(filepath.Join(r.Home, PathTmp.toString(), version)); !os.IsNotExist(err) {\n\t\tfmt.Println(\"Already in cache ...\")\n\t\treturn err\n\t}\n\n\treturn ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
ReadHostUUID reads host UUID from the file in the data dir
func ReadHostUUID(dataDir string) (string, error) { out, err := ReadPath(filepath.Join(dataDir, HostUUIDFile)) if err != nil { if errors.Is(err, fs.ErrPermission) { //do not convert to system error as this loses the ability to compare that it is a permission error return "", err } return "", trace.Convert...
[ "func ReadOrMakeHostUUID(dataDir string) (string, error) {\n\tid, err := ReadHostUUID(dataDir)\n\tif err == nil {\n\t\treturn id, nil\n\t}\n\tif !trace.IsNotFound(err) {\n\t\treturn \"\", trace.Wrap(err)\n\t}\n\t// Checking error instead of the usual uuid.New() in case uuid generation\n\t// fails due to not enough ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
WriteHostUUID writes host UUID into a file
func WriteHostUUID(dataDir string, id string) error { err := os.WriteFile(filepath.Join(dataDir, HostUUIDFile), []byte(id), os.ModeExclusive|0400) if err != nil { if errors.Is(err, fs.ErrPermission) { //do not convert to system error as this loses the ability to compare that it is a permission error return er...
[ "func WriteUUID(buffer []byte, offset int, value UUID) {\n bytes, _ := value.MarshalBinary()\n WriteBytes(buffer, offset, bytes)\n}", "func (packet *Packet) WriteUUIDString(data string) {\n\tpacket.WriteString(data)\n}", "func ReadOrMakeHostUUID(dataDir string) (string, error) {\n\tid, err := ReadHostUUID...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
ReadOrMakeHostUUID looks for a hostid file in the data dir. If present, returns the UUID from it, otherwise generates one
func ReadOrMakeHostUUID(dataDir string) (string, error) { id, err := ReadHostUUID(dataDir) if err == nil { return id, nil } if !trace.IsNotFound(err) { return "", trace.Wrap(err) } // Checking error instead of the usual uuid.New() in case uuid generation // fails due to not enough randomness. It's been known...
[ "func ReadHostUUID(dataDir string) (string, error) {\n\tout, err := ReadPath(filepath.Join(dataDir, HostUUIDFile))\n\tif err != nil {\n\t\tif errors.Is(err, fs.ErrPermission) {\n\t\t\t//do not convert to system error as this loses the ability to compare that it is a permission error\n\t\t\treturn \"\", err\n\t\t}\n...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
StringSliceSubset returns true if b is a subset of a.
func StringSliceSubset(a []string, b []string) error { aset := make(map[string]bool) for _, v := range a { aset[v] = true } for _, v := range b { _, ok := aset[v] if !ok { return trace.BadParameter("%v not in set", v) } } return nil }
[ "func SliceStringIsSubset(larger, smaller []string) (bool, []string) {\n\tlargerSet := make(map[string]struct{}, len(larger))\n\tfor _, l := range larger {\n\t\tlargerSet[l] = struct{}{}\n\t}\n\n\tsubset := true\n\tvar offending []string\n\tfor _, s := range smaller {\n\t\tif _, ok := largerSet[s]; !ok {\n\t\t\tsub...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
UintSliceSubset returns true if b is a subset of a.
func UintSliceSubset(a []uint16, b []uint16) error { aset := make(map[uint16]bool) for _, v := range a { aset[v] = true } for _, v := range b { _, ok := aset[v] if !ok { return trace.BadParameter("%v not in set", v) } } return nil }
[ "func StringSliceSubset(a []string, b []string) error {\n\taset := make(map[string]bool)\n\tfor _, v := range a {\n\t\taset[v] = true\n\t}\n\n\tfor _, v := range b {\n\t\t_, ok := aset[v]\n\t\tif !ok {\n\t\t\treturn trace.BadParameter(\"%v not in set\", v)\n\t\t}\n\n\t}\n\treturn nil\n}", "func SliceSubset(slice1...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
RemoveFromSlice makes a copy of the slice and removes the passed in values from the copy.
func RemoveFromSlice(slice []string, values ...string) []string { output := make([]string, 0, len(slice)) remove := make(map[string]bool) for _, value := range values { remove[value] = true } for _, s := range slice { _, ok := remove[s] if ok { continue } output = append(output, s) } return outpu...
[ "func RemoveFromSlice(slice []string, item string) []string {\n\tfor i, value := range slice {\n\t\tif value == item {\n\t\t\treturn append(slice[:i], slice[i+1:]...)\n\t\t}\n\t}\n\treturn slice\n}", "func (v *Data) RemoveSlice(start, end int) {\n\tdv := *v\n\n\t*v = append(dv[:start], dv[end:]...)\n\n\tv.Truncat...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
ChooseRandomString returns a random string from the given slice.
func ChooseRandomString(slice []string) string { switch len(slice) { case 0: return "" case 1: return slice[0] default: return slice[rand.Intn(len(slice))] } }
[ "func GetRandomStringFromSlice(slice []string) string {\n\trand.Seed(time.Now().UnixNano())\n\n\treturn slice[rand.Intn(len(slice))]\n}", "func ChooseRandomString(sl []string) string {\n\tif sl == nil {\n\t\treturn \"\"\n\t}\n\treturn sl[rand.Intn(len(sl))]\n}", "func ChooseString(l []string) string {\n\tif len...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
CheckCertificateFormatFlag checks if the certificate format is valid.
func CheckCertificateFormatFlag(s string) (string, error) { switch s { case constants.CertificateFormatStandard, teleport.CertificateFormatOldSSH, teleport.CertificateFormatUnspecified: return s, nil default: return "", trace.BadParameter("invalid certificate format parameter: %q", s) } }
[ "func (cd *ChainDoc) IsValidFormat() bool {\n\tif cd.Created == 0 || cd.GetType() != int(ChainDIDType) {\n\t\treturn false\n\t}\n\treturn true\n}", "func (da *DefaultAuth) CheckFormat() error {\n\treturn nil\n}", "func (dd *AccountDoc) IsValidFormat() bool {\n\tif dd.Created == 0 || dd.GetType() != int(AccountD...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
ReadAtMost reads up to limit bytes from r, and reports an error when limit bytes are read.
func ReadAtMost(r io.Reader, limit int64) ([]byte, error) { limitedReader := &io.LimitedReader{R: r, N: limit} data, err := io.ReadAll(limitedReader) if err != nil { return data, err } if limitedReader.N <= 0 { return data, ErrLimitReached } return data, nil }
[ "func readAtMost(r io.Reader, limit int64) ([]byte, error) {\n\tlimitedReader := &io.LimitedReader{R: r, N: limit}\n\tdata, err := ioutil.ReadAll(limitedReader)\n\tif err != nil {\n\t\treturn data, err\n\t}\n\tif limitedReader.N <= 0 {\n\t\treturn data, ErrLimitReached\n\t}\n\treturn data, nil\n}", "func (c Conn)...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
HasPrefixAny determines if any of the string values have the given prefix.
func HasPrefixAny(prefix string, values []string) bool { for _, val := range values { if strings.HasPrefix(val, prefix) { return true } } return false }
[ "func StartsWithAny(str string, prefixes ...string) bool {\n\tfor _, prefix := range prefixes {\n\t\tif internalStartsWith(str, (string)(prefix), false) {\n\t\t\treturn true\n\t\t}\n\t}\n\treturn false\n}", "func HasAnyPrefix(s string, prefixList []string) bool {\n\tfor _, prefix := range prefixList {\n\t\tif str...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Equals checks two matches for equality
func (m *Match) Equals(other *Match) bool { if m == nil && other == nil { return true } else if m == nil { return false } else if other == nil { return false } return m.PC == other.PC && m.StartLine == other.StartLine && m.StartColumn == other.StartColumn && m.EndLine == other.EndLine && m.EndColumn ...
[ "func (m *MatchData) IsEqual(m2 *MatchData) bool {\n\tif len(m.result) != len(m2.result) {\n\t\treturn false\n\t}\n\n\tfor i, v := range m.result {\n\t\tif v != m2.result[i] {\n\t\t\treturn false\n\t\t}\n\t}\n\n\treturn (m.r.String() == m2.r.String()) && (m.s == m2.s)\n}", "func Eq(obj1 any, obj2 any) bool", "f...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
LexerEngine does the actual tokenization of the byte slice text using the NFA bytecode in program. If the lexing process fails the Scanner will return an UnconsumedInput error.
func LexerEngine(program inst.Slice, text []byte) Scanner { done := false matchPC := -1 matchTC := -1 prevTC := 0 line := 1 col := 1 var scan Scanner var cqueue, nqueue *queue.Queue = queue.New(len(program)), queue.New(len(program)) scan = func(tc int) (int, *Match, error, Scanner) { if done && tc == len(t...
[ "func (l *promlexer) Lex() token {\n\tif l.i >= len(l.b) {\n\t\treturn tEOF\n\t}\n\tc := l.b[l.i]\n\tl.start = l.i\n\nyystate0:\n\n\tswitch yyt := l.state; yyt {\n\tdefault:\n\t\tpanic(fmt.Errorf(`invalid start condition %d`, yyt))\n\tcase 0: // start condition: INITIAL\n\t\tgoto yystart1\n\tcase 1: // start condit...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Test_Add_Read adds random entries to a testdb then tries to read those entries
func Test_Add_Read(t *testing.T) { var test_shorthand = make([]byte, 20) var test_fullpath = make([]byte, 20) prio := -1 rand.Read(test_shorthand) rand.Read(test_fullpath) short := make_printable(test_shorthand) full := make_printable(test_fullpath) e := Entry{ shorthand: short, full_path: full, pri...
[ "func readTestData(t *testing.T, r FileSetReader, shard uint32, timestamp time.Time, entries []testEntry) {\n\tfor _, underTest := range readTestTypes {\n\t\terr := r.Open(testNs1ID, 0, timestamp)\n\t\trequire.NoError(t, err)\n\n\t\trequire.Equal(t, len(entries), r.Entries())\n\t\trequire.Equal(t, 0, r.EntriesRead(...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
GetUsersHandler lista todos los usuarios
func GetUsersHandler(w http.ResponseWriter, r *http.Request) { var users []User for _, v := range Listusers { users = append(users, v) } w.Header().Set("Content-Type", "application/json") j, err := json.Marshal(users) if err != nil { panic(err) } w.WriteHeader(http.StatusOK) w.Write(j) }
[ "func getUsersHandler(c *gin.Context) {\n\tuser, _ := c.Get(JwtIdentityKey)\n\n\t// Role check.\n\tif !isAdmin(user) {\n\t\tc.JSON(http.StatusUnauthorized, gin.H{\"message\": \"unauthorized\"})\n\t\treturn\n\t}\n\n\tpage := c.DefaultQuery(\"page\", \"1\")\n\tcount := c.DefaultQuery(\"count\", \"10\")\n\tpageInt, _ ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
PostUserHandler crea un usuario en la base de datos
func PostUserHandler(w http.ResponseWriter, r *http.Request) { var user User err := json.NewDecoder(r.Body).Decode(&user) if err != nil { panic(err) } user.CreateAt = time.Now() id++ k := strconv.Itoa(id) Listusers[k] = user w.Header().Set("Content-Type", "application/json") j, err := json.Marshal(user) if...
[ "func PostUserHandler(w http.ResponseWriter, r *http.Request) {\n\tvar user models.User\n\terr := json.NewDecoder(r.Body).Decode(&user)\n\tif err != nil {\n\t\tlog.Println(\"Error al parsear usuario\")\n\t\tw.WriteHeader(http.StatusBadRequest)\n\t\treturn\n\t}\n\tw.Header().Set(\"Content-Type\", \"application/json\...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
PutUserHandler Actualiza un usuario en base al id
func PutUserHandler(w http.ResponseWriter, r *http.Request) { params := mux.Vars(r) k := params["id"] var userupdate User err := json.NewDecoder(r.Body).Decode(&userupdate) if err != nil { panic(err) } if user, ok := Listusers[k]; ok { userupdate.CreateAt = user.CreateAt delete(Listusers, k) Listusers[k]...
[ "func PutUserHandler(w http.ResponseWriter, r *http.Request) {\n\tid := mux.Vars(r)[\"id\"]\n\tvar userUpdate models.User\n\tw.Header().Set(\"Content-Type\", \"application/json\")\n\n\terr := json.NewDecoder(r.Body).Decode(&userUpdate)\n\tif err != nil {\n\t\tlog.Printf(\"Error al parsear usuario con el id %s\", id...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
DeleteUserHandler elimina un usuario en base al id
func DeleteUserHandler(w http.ResponseWriter, r *http.Request) { params := mux.Vars(r) k := params["id"] if _, ok := Listusers[k]; ok { delete(Listusers, k) } else { log.Printf("No encontramos el id %s", k) } w.WriteHeader(http.StatusNoContent) }
[ "func DeleteUserHandler(connection *sql.DB, cnf config.Config) negroni.HandlerFunc {\n\treturn negroni.HandlerFunc(func(w http.ResponseWriter, r *http.Request, next http.HandlerFunc) {\n\t\tvar queryToken = r.URL.Query().Get(\"token\")\n\n\t\tif len(queryToken) < 1 {\n\t\t\tqueryToken = r.Header.Get(\"token\")\n\t\...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
UnmarshalEasyJSON supports easyjson.Unmarshaler interface
func (v *BlitzedItemResponse) UnmarshalEasyJSON(l *jlexer.Lexer) { easyjson6a975c40DecodeJsonBenchmark4(l, v) }
[ "func (v *Fruit) UnmarshalEasyJSON(l *jlexer.Lexer) {\n\teasyjsonD2b7633eDecodeBackendInternalModels11(l, v)\n}", "func (v *Entities) UnmarshalEasyJSON(l *jlexer.Lexer) {\n\teasyjson794297d0DecodeGithubComMailruEasyjsonBenchmark10(l, v)\n}", "func (c *Context) UnmarshalEasyJSON(in *jlexer.Lexer) {\n\tContextSer...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
People ... Create a router group to rs/crud/persons and relative routes
func People(engine *gin.Engine, midlewares ...gin.HandlerFunc) { personGroup := engine.Group("rs/crud/person") personGroup.GET("/:id", controllers.GetPerson) personGroup.GET("/", controllers.GetPagePerson) personGroup.PUT("/:id", controllers.PutPerson) personGroup.DELETE("/:id", controllers.DeletePerson) }
[ "func MakePersonHandlers(r *mux.Router, n negroni.Negroni, service person.UseCase) {\n\tr.Handle(\"/person\", n.With(\n\t\tnegroni.Wrap(findAllPersons(service)),\n\t)).Methods(\"GET\", \"OPTIONS\").Name(\"findAllPersons\")\n\n\tr.Handle(\"/person/{key}\", n.With(\n\t\tnegroni.Wrap(findPersonByKey(service)),\n\t)).M...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Validate validates this io k8s api core v1 scoped resource selector requirement
func (m *IoK8sAPICoreV1ScopedResourceSelectorRequirement) Validate(formats strfmt.Registry) error { var res []error if err := m.validateOperator(formats); err != nil { res = append(res, err) } if err := m.validateScopeName(formats); err != nil { res = append(res, err) } if len(res) > 0 { return errors.Co...
[ "func isValidKubernetesResource(id yaml.ResourceIdentifier) bool {\n\treturn id.GetKind() != \"\" && id.GetAPIVersion() != \"\" && id.GetName() != \"\"\n}", "func (r Resource) Valid() (err error) {\n\tswitch r {\n\tcase AuthorizationsResource: // 0\n\tcase BucketsResource: // 1\n\tcase DashboardsResource: // 2\n\...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
NewDir creates a new Interface that converts the return value of a Directory's Readdir method into 9P Stat structures.
func NewDir(dir Directory, abspath string, pool *qidpool.Pool) Interface { return &dirReader{ Directory: dir, pool: pool, path: abspath, } }
[ "func newDir(name string, attr plugin.EntryAttributes, impl Interface, path string) *dir {\n\tvd := &dir{\n\t\tEntryBase: plugin.NewEntry(name),\n\t\timpl: impl,\n\t\tpath: path,\n\t}\n\tvd.SetAttributes(attr)\n\tvd.SetTTLOf(plugin.OpenOp, 60*time.Second)\n\t// Caching handled in List based on 'impl'.\n\t...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
TestConcurrentBuildControllers tests the transition of a build from new to pending. Ensures that only a single New > Pending transition happens and that only a single pod is created during a set period of time.
func TestConcurrentBuildControllers(t *testing.T) { defer testutil.DumpEtcdOnFailure(t) // Start a master with multiple BuildControllers osClient, kClient := setupBuildControllerTest(controllerCount{BuildControllers: 5}, t) build.RunBuildControllerTest(t, osClient, kClient) }
[ "func TestConcurrentBuildPodControllers(t *testing.T) {\n\tdefer testutil.DumpEtcdOnFailure(t)\n\t// Start a master with multiple BuildPodControllers\n\tosClient, kClient := setupBuildControllerTest(controllerCount{BuildPodControllers: 5}, t)\n\tbuild.RunBuildPodControllerTest(t, osClient, kClient)\n}", "func Tes...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
TestConcurrentBuildPodControllers tests the lifecycle of a build pod when running multiple controllers.
func TestConcurrentBuildPodControllers(t *testing.T) { defer testutil.DumpEtcdOnFailure(t) // Start a master with multiple BuildPodControllers osClient, kClient := setupBuildControllerTest(controllerCount{BuildPodControllers: 5}, t) build.RunBuildPodControllerTest(t, osClient, kClient) }
[ "func TestConcurrentBuildControllersPodSync(t *testing.T) {\n\t// Start a master with multiple BuildControllers\n\tbuildClient, _, kClient, fn := setupBuildControllerTest(controllerCount{BuildControllers: 5}, t)\n\tdefer fn()\n\tbuild.RunBuildControllerPodSyncTest(t, buildClient, kClient)\n}", "func TestConcurren...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
RegisterTx is just like Register but marks the migration to be executed inside a transaction.
func RegisterTx(fns ...func(DB) error) error { return DefaultCollection.RegisterTx(fns...) }
[ "func (_Contract *ContractTransactor) Register(opts *bind.TransactOpts, id *big.Int, owner common.Address, duration *big.Int) (*types.Transaction, error) {\n\treturn _Contract.contract.Transact(opts, \"register\", id, owner, duration)\n}", "func (_Contract *ContractTransactorSession) Register(id *big.Int, owner c...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
RegisteredMigrations returns currently registered Migrations.
func RegisteredMigrations() []*Migration { return DefaultCollection.Migrations() }
[ "func GetMigrations() []*Migration {\n\treturn _migrations\n}", "func GetMigrations() Migrations {\n\tm := Migrations{}\n\n\t// Version 0\n\tm = append(m, steps{ExecuteSQLFile(\"000-bootstrap.sql\")})\n\n\t// Version 1\n\tm = append(m, steps{ExecuteSQLFile(\"001-common.sql\")})\n\n\t// Version 2\n\tm = append(m, ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Read MeasurementsGET sends measurements json response
func MeasurementsGET(w http.ResponseWriter, r *http.Request) { // Get condition GET parameter condition := r.URL.Query().Get("condition") // Validate condition reg, errReg := regexp.Compile("^(\\w+[<>=]+\\w+(\\s(and|or)\\s?)?)*$") if errReg != nil { log.Println(errReg) response.SendError(w, http.StatusInterna...
[ "func (a *UnsupportedApiService) MeasurementsGET(ctx context.Context, measurementConfigId string) (MeasurementConfig, *http.Response, error) {\n\tvar (\n\t\tlocalVarHttpMethod = strings.ToUpper(\"Get\")\n\t\tlocalVarPostBody interface{}\n\t\tlocalVarFileName string\n\t\tlocalVarFileBytes []byte\n\t\tlocalV...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
QueryStringParser converts URL querystring into a slice of `FilteredResult.` Given the querystring `?first_name=john:eq:and&last_name=doe:eq`
func QueryStringParser(queryStr string, filters map[string]string) []FilteredResult { //define custom map type to allowduplicate keys type Map struct { Key string Value string } params := []Map{} searchFilters := []FilteredResult{} parts := strings.Split(queryStr, "&") //build a key/value map of the que...
[ "func QueryStringParser(query string) (*Query, error) {\n\tvar (\n\t\tkeyStart, keyEnd int\n\t\tvalStart, valEnd int\n\t\tfirstInfoHash string\n\n\t\tonKey = true\n\t\thasInfoHash = false\n\n\t\tq = &Query{\n\t\t\tInfoHashes: nil,\n\t\t\tParams: make(map[string]string),\n\t\t}\n\t)\n\n\tfor i, length :...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
RHSParser separates the fragment part of the query string into three parts value, comparison operator (=, >, , =, LIKE) and logical operator (AND/OR).
func RHSParser(queryStrValue string, valueType string) (value interface{}, comparisonOperator string, logicOperator string) { var val interface{} var cOperator string = " = " var lOperator string = " AND " parts := strings.Split(queryStrValue, ":") len := len(parts) if valueType == "int" { var number int64 ...
[ "func QueryStringParser(queryStr string, filters map[string]string) []FilteredResult {\n\t//define custom map type to allowduplicate keys\n\ttype Map struct {\n\t\tKey string\n\t\tValue string\n\t}\n\n\tparams := []Map{}\n\tsearchFilters := []FilteredResult{}\n\n\tparts := strings.Split(queryStr, \"&\")\n\n\t//bu...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new DailyRule.
func (in *DailyRule) DeepCopy() *DailyRule { if in == nil { return nil } out := new(DailyRule) in.DeepCopyInto(out) return out }
[ "func (in *Rule) DeepCopy() *Rule {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(Rule)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "func (in *Day) DeepCopy() *Day {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(Day)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "func (in *TriggerRule) DeepCopy() *Tri...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ScaleRule.
func (in *ScaleRule) DeepCopy() *ScaleRule { if in == nil { return nil } out := new(ScaleRule) in.DeepCopyInto(out) return out }
[ "func (in *Scale) DeepCopy() *Scale {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(Scale)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "func (in *ScaleTarget) DeepCopy() *ScaleTarget {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(ScaleTarget)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "func (in *M...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ScaleSpec.
func (in *ScaleSpec) DeepCopy() *ScaleSpec { if in == nil { return nil } out := new(ScaleSpec) in.DeepCopyInto(out) return out }
[ "func (in *ScalewaySpec) DeepCopy() *ScalewaySpec {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(ScalewaySpec)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "func (in *Scale) DeepCopy() *Scale {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(Scale)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "func (in...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ScaleTarget.
func (in *ScaleTarget) DeepCopy() *ScaleTarget { if in == nil { return nil } out := new(ScaleTarget) in.DeepCopyInto(out) return out }
[ "func (in *Scale) DeepCopy() *Scale {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(Scale)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "func (in *ScalableTarget) DeepCopy() *ScalableTarget {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(ScalableTarget)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "fu...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ScheduledPodScaler.
func (in *ScheduledPodScaler) DeepCopy() *ScheduledPodScaler { if in == nil { return nil } out := new(ScheduledPodScaler) in.DeepCopyInto(out) return out }
[ "func (in *ScheduledPodScalerSpec) DeepCopy() *ScheduledPodScalerSpec {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(ScheduledPodScalerSpec)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "func (in *SchedulingScaler) DeepCopy() *SchedulingScaler {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(Schedulin...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ScheduledPodScalerList.
func (in *ScheduledPodScalerList) DeepCopy() *ScheduledPodScalerList { if in == nil { return nil } out := new(ScheduledPodScalerList) in.DeepCopyInto(out) return out }
[ "func (in *ScheduledPodScaler) DeepCopy() *ScheduledPodScaler {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(ScheduledPodScaler)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "func (in *SchedulingScalerList) DeepCopy() *SchedulingScalerList {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(SchedulingSca...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ScheduledPodScalerSpec.
func (in *ScheduledPodScalerSpec) DeepCopy() *ScheduledPodScalerSpec { if in == nil { return nil } out := new(ScheduledPodScalerSpec) in.DeepCopyInto(out) return out }
[ "func (in *ScheduledPodScaler) DeepCopy() *ScheduledPodScaler {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(ScheduledPodScaler)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "func (in *SchedulingScalerSpec) DeepCopy() *SchedulingScalerSpec {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(SchedulingSca...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ScheduledPodScalerStatus.
func (in *ScheduledPodScalerStatus) DeepCopy() *ScheduledPodScalerStatus { if in == nil { return nil } out := new(ScheduledPodScalerStatus) in.DeepCopyInto(out) return out }
[ "func (in *SchedulingScalerStatus) DeepCopy() *SchedulingScalerStatus {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(SchedulingScalerStatus)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "func (in *ScheduledPodScaler) DeepCopy() *ScheduledPodScaler {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(Sched...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
PodmanImage provides access to an image reference from podman. same as github.com/google/gocontainerregistry/pkg/v1/daemon
func PodmanImage(ref name.Reference, options ...interface{}) (v1.Image, error) { var img v1.Image pr, pw := io.Pipe() go func() { opener := func() (io.ReadCloser, error) { return pr, nil } var err error tag := ref.(name.Digest).Tag() img, err = tarball.Image(opener, &tag) _ = pr.CloseWithError(err) }...
[ "func (f *FakeRunner) podman(args []string, _ bool) (string, error) {\n\tswitch cmd := args[0]; cmd {\n\tcase \"--version\":\n\t\treturn \"podman version 1.6.4\", nil\n\n\tcase \"image\":\n\n\t\tif args[1] == \"inspect\" && args[2] == \"--format\" && args[3] == \"{{.Id}}\" {\n\t\t\tif args[3] == \"missing\" {\n\t\t...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
PodmanWrite saves the image into podman as the given tag. same as github.com/google/gocontainerregistry/pkg/v1/daemon
func PodmanWrite(ref name.Reference, img v1.Image, opts ...tarball.WriteOption) (string, error) { pr, pw := io.Pipe() go func() { _ = pw.CloseWithError(tarball.Write(ref, img, pw, opts...)) }() // write the image in docker save format first, then load it cmd := exec.Command("sudo", "podman", "image", "load") c...
[ "func PodmanImage(ref name.Reference, options ...interface{}) (v1.Image, error) {\n\tvar img v1.Image\n\tpr, pw := io.Pipe()\n\tgo func() {\n\t\topener := func() (io.ReadCloser, error) {\n\t\t\treturn pr, nil\n\t\t}\n\t\tvar err error\n\t\ttag := ref.(name.Digest).Tag()\n\t\timg, err = tarball.Image(opener, &tag)\n...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
GenerateTestFile creates a file with the template values inserted into the template
func GenerateTestFile(testFileName string, templateValues *TemplateValues) error { outFile, err := os.Create(testFileName) if err != nil { fmt.Printf("Error creating test file named: %s\n", testFileName) } tmpl := template.Must(template.New("out").Parse(outputTemplate)) if err := tmpl.Execute(outFile, templateVa...
[ "func CreateTestFile(fileName string) {\n\tif !strings.HasSuffix(fileName, \"_test.go\") {\n\t\treturn\n\t}\n\tcreateDir(fileName)\n\tif err := ioutil.WriteFile(fileName, []byte(mainttpl), 0644); err != nil {\n\t\tfmt.Printf(\"write file [%s] failed:%v\\n\", fileName, err)\n\t}\n}", "func GenerateWithTestFile(fil...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
ParseFunctions parses a file and returns information about its HTTP handlers
func ParseFunctions(filePath string) *TemplateValues { fset := token.NewFileSet() f, err := parser.ParseFile(fset, filePath, nil, parser.ParseComments) if err != nil { log.Fatal(err) } var funcInfos []FunctionInfo packageName := fmt.Sprint(f.Name) containsMux := false for _, decl := range f.Decls { switc...
[ "func Parse(urlStr string, key ...interface{}) (func(http.Handler) http.Handler,\n\terror) {\n\n\tu, err := mgourl.Parse(urlStr)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\ts, err := mgo.Dial(u.ShortString())\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tk := getkey(key...)\n\tif k == nil {\n\t\tk = u.Dat...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Deprecated: Use ShareType.Descriptor instead.
func (ShareType) EnumDescriptor() ([]byte, []int) { return file_share_distro_proto_rawDescGZIP(), []int{0} }
[ "func (*FileShare) Descriptor() ([]byte, []int) {\n\treturn file_share_share_proto_rawDescGZIP(), []int{0}\n}", "func (*ShareRequest) Descriptor() ([]byte, []int) {\n\treturn file_drand_control_proto_rawDescGZIP(), []int{6}\n}", "func (*ShareDistribution) Descriptor() ([]byte, []int) {\n\treturn file_share_dist...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Deprecated: Use ShareDistribution.ProtoReflect.Descriptor instead.
func (*ShareDistribution) Descriptor() ([]byte, []int) { return file_share_distro_proto_rawDescGZIP(), []int{0} }
[ "func (*BodyOldPeer) Descriptor() ([]byte, []int) {\n\treturn file_github_com_getamis_alice_crypto_tss_addshare_message_proto_rawDescGZIP(), []int{1}\n}", "func (*ResourceManifest) Descriptor() ([]byte, []int) {\n\treturn file_google_cloud_gkehub_v1_membership_proto_rawDescGZIP(), []int{4}\n}", "func (*Public2P...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
NewCredentialRepository instance of CredentialRepository
func NewCredentialRepository(db *pgxpool.Pool) CredentialRepository { return &repo{ DB: db, } }
[ "func NewRepo(c backend.Credentials) (*Repo, error) {\n var err error\n r := &Repo{}\n r.Session, err = NewSession(c[\"dbhost\"])\n if err != nil {\n return nil, err\n }\n\n r.Db = r.Session.DB(c[\"dbname\"])\n return r, nil\n}", "func newCredential(mc *metric, cs *clientset.ClientSet)...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
GetCPUInfo reads the cpu info from the system
func (info *RpiInfo) GetCPUInfo() error { file, err := os.Open("/proc/cpuinfo") if err != nil { return err } defer file.Close() info.readCPUInfo(file) return nil }
[ "func (s *Simple) CPUInfo(req *acomm.Request) (interface{}, *url.URL, error) {\n\tvar args CPUInfoArgs\n\tif err := req.UnmarshalArgs(&args); err != nil {\n\t\treturn nil, nil, err\n\t}\n\tif args.GuestID == \"\" {\n\t\treturn nil, nil, errors.New(\"missing guest_id\")\n\t}\n\n\tresult := &CPUInfoResult{\n\t\t&CPUI...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Deprecated: Use PbStatsSampleFeed.ProtoReflect.Descriptor instead.
func (*PbStatsSampleFeed) Descriptor() ([]byte, []int) { return file_stats_proto_rawDescGZIP(), []int{0} }
[ "func (*RateLimitingSampler) Descriptor() ([]byte, []int) {\n\treturn file_github_com_solo_io_gloo_projects_gloo_api_external_envoy_config_trace_v3_opencensus_proto_rawDescGZIP(), []int{4}\n}", "func (*PbStatsSampleEntry) Descriptor() ([]byte, []int) {\n\treturn file_stats_proto_rawDescGZIP(), []int{1}\n}", "fu...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Deprecated: Use PbStatsSampleEntry.ProtoReflect.Descriptor instead.
func (*PbStatsSampleEntry) Descriptor() ([]byte, []int) { return file_stats_proto_rawDescGZIP(), []int{1} }
[ "func (*PbStatsSampleValue) Descriptor() ([]byte, []int) {\n\treturn file_stats_proto_rawDescGZIP(), []int{2}\n}", "func (*PbStatsSampleFeed) Descriptor() ([]byte, []int) {\n\treturn file_stats_proto_rawDescGZIP(), []int{0}\n}", "func (*RateLimitingSampler) Descriptor() ([]byte, []int) {\n\treturn file_github_c...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Deprecated: Use PbStatsSampleValue.ProtoReflect.Descriptor instead.
func (*PbStatsSampleValue) Descriptor() ([]byte, []int) { return file_stats_proto_rawDescGZIP(), []int{2} }
[ "func (*PbStatsSampleEntry) Descriptor() ([]byte, []int) {\n\treturn file_stats_proto_rawDescGZIP(), []int{1}\n}", "func (*RateLimitingSampler) Descriptor() ([]byte, []int) {\n\treturn file_github_com_solo_io_gloo_projects_gloo_api_external_envoy_config_trace_v3_opencensus_proto_rawDescGZIP(), []int{4}\n}", "fu...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Deprecated: Use PbStatsIndexList.ProtoReflect.Descriptor instead.
func (*PbStatsIndexList) Descriptor() ([]byte, []int) { return file_stats_proto_rawDescGZIP(), []int{3} }
[ "func (*PbStatsIndexFeed) Descriptor() ([]byte, []int) {\n\treturn file_stats_proto_rawDescGZIP(), []int{4}\n}", "func (*BulkIndexRequest) Descriptor() ([]byte, []int) {\n\treturn file_protobuf_index_proto_rawDescGZIP(), []int{14}\n}", "func (*BulkIndexResponse) Descriptor() ([]byte, []int) {\n\treturn file_pro...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Deprecated: Use PbStatsIndexFeed.ProtoReflect.Descriptor instead.
func (*PbStatsIndexFeed) Descriptor() ([]byte, []int) { return file_stats_proto_rawDescGZIP(), []int{4} }
[ "func (*PbStatsIndexList) Descriptor() ([]byte, []int) {\n\treturn file_stats_proto_rawDescGZIP(), []int{3}\n}", "func (*PbStatsSampleFeed) Descriptor() ([]byte, []int) {\n\treturn file_stats_proto_rawDescGZIP(), []int{0}\n}", "func (*Filter_DeprecatedV1) Descriptor() ([]byte, []int) {\n\treturn file_xds_envoy_...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
NewTree yields a tree corresponding to the given list of symbol frequencies
func NewTree(fs []SymbolFreq) Tree { // Sort frequencies sort.Sort(byFreq(fs)) wrkList := []node{} for _, f := range fs { wrkList = append(wrkList, f) } for { if len(wrkList) < 2 { break } newNode := makeNewNode(wrkList[0], wrkList[1]) wrkList = insertItem(wrkList[2:], newNode) } return Tree{w...
[ "func NewEncodingTree(freq map[uint8]uint) *Node {\n\tvar head Node // Fictitious head\n\n\tfor i, v := range freq {\n\t\tnode := &Node{\n\t\t\tvalue: i,\n\t\t\tweight: v,\n\t\t}\n\t\thead.insert(node)\n\t}\n\n\tfor head.next != nil && head.next.next != nil {\n\t\tl := head.popFirst()\n\t\tr := head.popFirst()\n\n...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
NewTreeFromBS yields a tree from a bitstream encoding of a tree
func NewTreeFromBS(bs *bitstream.BitStream) Tree { root := newTreeFromBS(bs) return Tree{root: root} }
[ "func NewTree() *BPTree {\n\treturn &BPTree{LastAddress: 0, keyPosMap: make(map[string]int64), enabledKeyPosMap: false}\n}", "func NewBTree(\n\tctx context.Context,\n\tobjStore *objstore.ObjectStore,\n\tencConf pbobject.EncryptionConfig,\n) (*BTree, error) {\n\trootNode := &Node{}\n\trootNode.Leaf = true\n\trootR...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Dictionary returns the dictionary defined by this Huffman tree
func (t Tree) Dictionary() DictionaryType { result := DictionaryType{} t.buildDictionary(result, bitstream.BitStream{}, t.root) return result }
[ "func CreateBinaryTree() {\n\tfmt.Fprintln(os.Stderr, \"CreateBinaryTree\")\n\tvar min1i, min2i, pos1, pos2 int\n\tvar point []int = make([]int, MAX_CODE_LENGTH)\n\tvar code []byte = make([]byte, MAX_CODE_LENGTH)\n\tvar count []int64 = make([]int64, vocab_size*2+1)\n\tvar binaryt []int = make([]int, vocab_size*2+1)...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Interpret yilds a byte by interpreting the given bitstream on this Huffman tree
func (t Tree) Interpret(bs *bitstream.BitStream) byte { return t.walk(t.root, bs) }
[ "func decodeHuffmanCode(codes *vector.Vector, index int, root *huffmanTreeNode, to *vector.Vector) (int, error) {\n\tif root == nil {\n\t\treturn 0, errors.New(\"No prefix tree supplied\")\n\t}\n\n\tif isLeafNode(root) {\n\t\tto.Append(root.value)\n\t\treturn index, nil\n\t}\n\n\tnext := codes.MustGet(index)\n\tswi...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
AsBitstreams encodes this Huffman tree in a bitstream
func (t Tree) AsBitstream() bitstream.BitStream { result := bitstream.BitStream{} t.asBitstream(&result, t.root) return result }
[ "func NewEncodingTree(freq map[uint8]uint) *Node {\n\tvar head Node // Fictitious head\n\n\tfor i, v := range freq {\n\t\tnode := &Node{\n\t\t\tvalue: i,\n\t\t\tweight: v,\n\t\t}\n\t\thead.insert(node)\n\t}\n\n\tfor head.next != nil && head.next.next != nil {\n\t\tl := head.popFirst()\n\t\tr := head.popFirst()\n\n...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
AllTypes returns all of the value types.
func AllTypes() []Type { return []Type{TypeInt, TypeUInt, TypeFloat, TypeBool, TypeString} }
[ "func TypeValues() []Type {\n\treturn _TypeValues\n}", "func (pkg *Package) ValuesOfType(typeName string) ([]string, map[string]bool, error) {\n\tvar values, inspectErrs []string\n\ttmplsToExclude := map[string]bool{}\n\n\tfor _, file := range pkg.files {\n\t\tast.Inspect(file, func(node ast.Node) bool {\n\t\t\ts...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Valid returns if the current type is one of AllTypes
func (t Type) Valid() bool { for _, typ := range AllTypes() { if t == typ { return true } } return false }
[ "func (ut UploadType) Valid() bool {\n\tfor _, value := range []string{\n\t\tstring(UploadTypeUSER),\n\t\tstring(UploadTypePRIME),\n\t} {\n\t\tif string(ut) == value {\n\t\t\treturn true\n\t\t}\n\t}\n\treturn false\n}", "func (i ImageType) Valid() bool {\n\tswitch string(i) {\n\tcase \"\", \"local\", \"all\":\n\t...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
ConcatSlice Returns a Concatenanted byte array into string
func ConcatSlice(sliceToConcat []byte) string { var dummy string for index := 0; index < len(sliceToConcat)-1; index++ { dummy = dummy + string(sliceToConcat[index]) + "-" } dummy = dummy + string(sliceToConcat[len(sliceToConcat)-1]) return dummy }
[ "func ConcatSlice(sliceToConcat []byte) string {\n\tstringRep := \"\"\n\n\tfor index := 0; index < len(sliceToConcat); index++ {\n\t\tstringRep = stringRep + string(sliceToConcat[index])\n\n\t\tif index+1 != len(sliceToConcat) {\n\t\t\tstringRep = stringRep + \"-\"\n\t\t}\n\t}\n\n\treturn stringRep\n}", "func Con...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
UseHTTPClient allows the default http client to be overriden for calls to the flow service. This function must be called prior to flows.WithFlow to take effect (e.g. from an init method)
func UseHTTPClient(client *http.Client) { httpClient = client }
[ "func (o *GetDataflowsParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "func (o *OptionsUsageParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "func (o *GetTaskStatesDeprecatedParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "func (c...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
RegisterAction registers a go function so it can be used as an action in a flow stage
func RegisterAction(actionFunc interface{}) { if reflect.TypeOf(actionFunc).Kind() != reflect.Func { panic("Action must be a function!") } actions[getActionKey(actionFunc)] = actionFunc }
[ "func Register(name string, initFunc InitFunc) error {\n\tif _, exists := actions[name]; exists {\n\t\treturn fmt.Errorf(\"action name already registered %s\", name)\n\t}\n\tactions[name] = initFunc\n\n\treturn nil\n}", "func RegisterAction() {\n\tengine.RegisterAction(\"cron\", NewCron)\n}", "func NewRegisterA...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
unionRegexp separates values with a | operator to create a string representing a union of regexp patterns.
func unionRegexp(values []string) string { if len(values) == 0 { // As a regular expression, "()" and "" are equivalent so this // condition wouldn't ordinarily be needed to distinguish these // values. But, our internal search engine assumes that "" // implies "no regexp" (no values), while "()" implies "matc...
[ "func NewUnion(l, r Regex) Regex {\n\tswitch l.(type) {\n\tcase *empty:\n\t\treturn r\n\tdefault:\n\t\treturn &union{\n\t\t\tl: l,\n\t\t\tr: r,\n\t\t}\n\t}\n}", "func MakeRegexOr(ss []string) string {\n\tvar s string\n\tfor _, v := range ss {\n\t\ts = s + v + `|`\n\t}\n\n\t//no need for an | a the end\n\ts = s[0 ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
langToFileRegexp converts a lang: parameter to its corresponding file patterns for file filters. The lang value must be valid, cf. validate.go
func langToFileRegexp(lang string) string { lang, _ = enry.GetLanguageByAlias(lang) // Invariant: lang is valid. extensions := enry.GetLanguageExtensions(lang) patterns := make([]string, len(extensions)) for i, e := range extensions { // Add `\.ext$` pattern to match files with the given extension. patterns[i] ...
[ "func FileExtToLanguage(ext string) (Language, error) {\n\tswitch {\n\tcase ext == \"c\":\n\t\treturn LangC, nil\n\tcase ext == \"cpp\" || ext == \"cxx\" || ext == \"C\":\n\t\treturn LangCPP, nil\n\t\t//\tcase ext == \"java\":\n\t\t//\t\treturn LangJava, nil\n\t\t//\tcase ext == \"py\":\n\t\t//\t\treturn LangPython...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
ToTextPatternInfo converts a an atomic query to internal values that drive text search. An atomic query is a Basic query where the Pattern is either nil, or comprises only one Pattern node (hence, an atom, and not an expression). See TextPatternInfo for the values it computes and populates.
func ToTextPatternInfo(q query.Basic, p Protocol, transform query.BasicPass) *TextPatternInfo { q = transform(q) // Handle file: and -file: filters. filesInclude, filesExclude := IncludeExcludeValues(q, query.FieldFile) // Handle lang: and -lang: filters. langInclude, langExclude := IncludeExcludeValues(q, query.F...
[ "func make_pattern_text(T int, // size of text\n\tP int, // size of pattern.\n\tN int, // number of pattern repetitions\n) ([]byte, []byte) {\n\n\tM := int(T / P) // Max # patterns that fit in text\n\tif M < N {\n\t\tpanic(fmt.Sprintf(\"make_pattern_text M < N. T=%d,P=%d,N=%d,M=%d\", T, P, N, M))\n\t}\n\tD := int(M...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
NewAddRemoteRDSNodeOK creates a AddRemoteRDSNodeOK with default headers values
func NewAddRemoteRDSNodeOK() *AddRemoteRDSNodeOK { return &AddRemoteRDSNodeOK{} }
[ "func NewAddRemoteRDSNodeDefault(code int) *AddRemoteRDSNodeDefault {\n\treturn &AddRemoteRDSNodeDefault{\n\t\t_statusCode: code,\n\t}\n}", "func (a *Client) AddRDSNode(params *AddRDSNodeParams) (*AddRDSNodeOK, error) {\n\t// TODO: Validate the params before sending\n\tif params == nil {\n\t\tparams = NewAddRDSNo...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
NewAddRemoteRDSNodeDefault creates a AddRemoteRDSNodeDefault with default headers values
func NewAddRemoteRDSNodeDefault(code int) *AddRemoteRDSNodeDefault { return &AddRemoteRDSNodeDefault{ _statusCode: code, } }
[ "func (client IdentityClient) createTagDefault(ctx context.Context, request common.OCIRequest, binaryReqBody *common.OCIReadSeekCloser, extraHeaders map[string]string) (common.OCIResponse, error) {\n\n\thttpRequest, err := request.HTTPRequest(http.MethodPost, \"/tagDefaults\", binaryReqBody, extraHeaders)\n\tif err...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Code gets the status code for the add remote RDS node default response
func (o *AddRemoteRDSNodeDefault) Code() int { return o._statusCode }
[ "func (o *AddContainerNodeDefault) Code() int {\n\treturn o._statusCode\n}", "func (o *AddClusterV5Default) Code() int {\n\treturn o._statusCode\n}", "func (o *AddServiceInstanceDefault) Code() int {\n\treturn o._statusCode\n}", "func (o *AddDeviceDatasourceInstanceDefault) Code() int {\n\treturn o._statusCod...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Validate validates this add remote RDS node body
func (o *AddRemoteRDSNodeBody) Validate(formats strfmt.Registry) error { return nil }
[ "func (o *AddRemoteRDSNodeOKBody) Validate(formats strfmt.Registry) error {\n\tvar res []error\n\n\tif err := o.validateRemoteRDS(formats); err != nil {\n\t\tres = append(res, err)\n\t}\n\n\tif len(res) > 0 {\n\t\treturn errors.CompositeValidationError(res...)\n\t}\n\treturn nil\n}", "func (o *AddRemoteRDSNodeOKB...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Validate validates this add remote RDS node default body
func (o *AddRemoteRDSNodeDefaultBody) Validate(formats strfmt.Registry) error { var res []error if err := o.validateDetails(formats); err != nil { res = append(res, err) } if len(res) > 0 { return errors.CompositeValidationError(res...) } return nil }
[ "func (o *AddRemoteRDSNodeBody) Validate(formats strfmt.Registry) error {\n\treturn nil\n}", "func (o *AddRemoteRDSNodeOKBodyRemoteRDS) Validate(formats strfmt.Registry) error {\n\treturn nil\n}", "func (o *AddRemoteRDSNodeOKBody) Validate(formats strfmt.Registry) error {\n\tvar res []error\n\n\tif err := o.val...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Validate validates this add remote RDS node OK body
func (o *AddRemoteRDSNodeOKBody) Validate(formats strfmt.Registry) error { var res []error if err := o.validateRemoteRDS(formats); err != nil { res = append(res, err) } if len(res) > 0 { return errors.CompositeValidationError(res...) } return nil }
[ "func (o *AddRemoteRDSNodeBody) Validate(formats strfmt.Registry) error {\n\treturn nil\n}", "func (o *AddRemoteRDSNodeOKBodyRemoteRDS) Validate(formats strfmt.Registry) error {\n\treturn nil\n}", "func (o *AddRemoteRDSNodeDefaultBody) Validate(formats strfmt.Registry) error {\n\tvar res []error\n\n\tif err := ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Validate validates this add remote RDS node OK body remote RDS
func (o *AddRemoteRDSNodeOKBodyRemoteRDS) Validate(formats strfmt.Registry) error { return nil }
[ "func (o *AddRemoteRDSNodeBody) Validate(formats strfmt.Registry) error {\n\treturn nil\n}", "func (o *AddRemoteRDSNodeOKBody) Validate(formats strfmt.Registry) error {\n\tvar res []error\n\n\tif err := o.validateRemoteRDS(formats); err != nil {\n\t\tres = append(res, err)\n\t}\n\n\tif len(res) > 0 {\n\t\treturn ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Set of ARNs of the matched Image Builder Infrastructure Configurations.
func (o GetInfrastructureConfigurationsResultOutput) Arns() pulumi.StringArrayOutput { return o.ApplyT(func(v GetInfrastructureConfigurationsResult) []string { return v.Arns }).(pulumi.StringArrayOutput) }
[ "func DefaultARMImages() ImageSelector {\n\treturn defaultARMImages\n}", "func (d *aciDriver) Config() map[string]string {\n\treturn map[string]string{\n\t\t\"CNAB_AZURE_VERBOSE\": \"Increase verbosity. true, false are supported values\",\n\t\t\"CNAB_AZURE_CLIENT_ID\": ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Set of names of the matched Image Builder Infrastructure Configurations.
func (o GetInfrastructureConfigurationsResultOutput) Names() pulumi.StringArrayOutput { return o.ApplyT(func(v GetInfrastructureConfigurationsResult) []string { return v.Names }).(pulumi.StringArrayOutput) }
[ "func initImageNames() map[int]string {\n\tswitch getTestArch() {\n\tcase \"s390x\":\n\t\treturn map[int]string{\n\t\t\tbusyboxImage: \"busybox@sha256:4f47c01fa91355af2865ac10fef5bf6ec9c7f42ad2321377c21e844427972977\",\n\t\t\tregistryImage: \"ibmcom/registry:2.6.2.5\",\n\t\t\tkanikoImage: \"gcr.io/kaniko-proj...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
wsMessage handles browser requests to /msg/
func wsMessage(w http.ResponseWriter, r *http.Request) { // Get session, continue only if authenticated sok, vok := checkLogin(r, cfgMap["session name"], "user") if !sok || !vok { http.Error(w, http.StatusText(http.StatusInternalServerError), http.StatusInternalServerError) return } cc := make(chan bool) ...
[ "func (w *BaseWebsocketClient) OnWsMessage(payload []byte, isBinary bool) {}", "func (t *T) Message(uri string, data types.Dict) { t.Write(websocket.Transport(uri, data)) }", "func sendMessage(webSocket *websocket.Conn, msg Message) (err error) {\n\terr = websocket.JSON.Send(webSocket, &msg)\n\treturn\n\n}", ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
wsChanSend build and send messages to connected browsers, the channel is shared between connections
func wsChanSend() { log.Println("wschan running...") i := 1 for { // send stuff to clients // TODO: solve multiple clients connecting wsChan <- "test: " + strconv.Itoa(i) i++ } }
[ "func ws_SendMsg(ws *websocket.Conn, send_channel SendChannel) {\n\tfor {\n\t\tselect {\n\t\tcase send_msg := <-send_channel.containers:\n\t\t\tlog.Printf(\"[%s] containers sendMessage= \", __FILE__, send_msg)\n\t\t\twebsocket.JSON.Send(ws, send_msg)\n\t\tcase send_msg := <-send_channel.updateinfo:\n\t\t\tlog.Print...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
NewQuotaRateLimit registers a new resource with the given unique name, arguments, and options.
func NewQuotaRateLimit(ctx *pulumi.Context, name string, args *QuotaRateLimitArgs, opts ...pulumi.ResourceOption) (*QuotaRateLimit, error) { if args == nil { return nil, errors.New("missing one or more required arguments") } if args.Rate == nil { return nil, errors.New("invalid value for required argument 'Rat...
[ "func New(arguments framework.Arguments) framework.Plugin {\n\treturn &resourceQuotaPlugin{\n\t\tpluginArguments: arguments,\n\t}\n}", "func NewRateLimit(limit int, deltat time.Duration) *RateLimit {\n\treturn &RateLimit{Rate{NewCounter(0), deltat}, limit, time.Now()}\n}", "func NewQuota(m int) *Quota {\n\tretu...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
GetQuotaRateLimit gets an existing QuotaRateLimit resource's state with the given name, ID, and optional state properties that are used to uniquely qualify the lookup (nil if not required).
func GetQuotaRateLimit(ctx *pulumi.Context, name string, id pulumi.IDInput, state *QuotaRateLimitState, opts ...pulumi.ResourceOption) (*QuotaRateLimit, error) { var resource QuotaRateLimit err := ctx.ReadResource("vault:index/quotaRateLimit:QuotaRateLimit", name, id, state, &resource, opts...) if err != nil { re...
[ "func (t *Type) GetRateLimit(name string) (types.RateLimit, error) {\n\tif rl, exists := t.rateLimits[name]; exists {\n\t\treturn rl, nil\n\t}\n\treturn nil, types.ErrRateLimitNotFound\n}", "func (c *Client) GetRateLimit() (*RateLimitResponse, error) {\n\treq, err := http.NewRequest(\"POST\", rateLimitURL, string...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Path of the mount or namespace to apply the quota. A blank path configures a global rate limit quota. For example `namespace1/` adds a quota to a full namespace, `namespace1/auth/userpass` adds a `quota` to `userpass` in `namespace1`. Updating this field on an existing quota can have "moving" effects. For example, upda...
func (o QuotaRateLimitOutput) Path() pulumi.StringPtrOutput { return o.ApplyT(func(v *QuotaRateLimit) pulumi.StringPtrOutput { return v.Path }).(pulumi.StringPtrOutput) }
[ "func (m *Drive) SetQuota(value Quotaable)() {\n m.quota = value\n}", "func Quota(path string, size ...string) string {\n\tif len(size) > 0 && len(size[0]) > 0 {\n\t\tout, err := exec.Command(\"btrfs\", \"qgroup\", \"limit\", size[0]+\"G\", config.Agent.LxcPrefix+path).CombinedOutput()\n\t\tlog.Check(log.Error...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
NewEC2RemoteClient creates and initialise a new EC2RemoteClient object, given an AWS Instance ID
func NewEC2RemoteClient(InstanceID *string, credentials *sshCmdClient.SSHCredentials) (*EC2RemoteClient, error) { ins := new(EC2RemoteClient) ins.InstanceID = *InstanceID session, err := session.NewSession() if err != nil { return nil, err } ec2Client := ec2.New(session) ins.session = session ins.ec2Client...
[ "func NewEC2Instance(InstId string) *AWSEC2Instance {\n return &AWSEC2Instance{InstanceId: InstId}\n}", "func NewEc2Client(t testing.TestingT, region string) *ec2.EC2 {\n\tclient, err := NewEc2ClientE(t, region)\n\trequire.NoError(t, err)\n\treturn client\n}", "func CreateEC2Client(credentials *credentials.Cre...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
startInstance starts an EC2 instance, and waits for it to become ready
func (ins *EC2RemoteClient) startInstance() error { log.Printf("Starting EC2 Instance %s", ins.InstanceID) _, err := ins.ec2Client.StartInstances(&ec2.StartInstancesInput{InstanceIds: aws.StringSlice([]string{ins.InstanceID})}) if err != nil { return fmt.Errorf("Error starting instance : %s", err) } log.Printf("...
[ "func startInstance(ec2Service *ec2.EC2, instance *ec2.Instance) error {\n\tinstanceState, err := getInstanceState(*instance)\n\tif err != nil {\n\t\treturn err\n\t}\n\tif instanceState == \"shutting-down\" || instanceState == \"terminated\" || instanceState == \"stopping\" || instanceState == \"stopped\" {\n\t\tfm...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
getIPAddress retrieves the public IP address from AWS. Returns error if no address found
func (ins *EC2RemoteClient) getIPAddress() error { result, err := ins.ec2Client.DescribeInstances(&ec2.DescribeInstancesInput{InstanceIds: aws.StringSlice([]string{ins.InstanceID})}) if err != nil { return fmt.Errorf("Error getting instance details : %s", err) } ins.instanceIP = net.ParseIP(*result.Reservations[0...
[ "func (c *Client) GetIPAddress(id, compartmentID string) (string, error) {\n\tvnics, err := c.computeClient.ListVnicAttachments(context.Background(), core.ListVnicAttachmentsRequest{\n\t\tInstanceId: &id,\n\t\tCompartmentId: &compartmentID,\n\t})\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\n\tif len(vnics.It...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
makeReady prepares an EC2 instance for running remote SSH commands
func (ins *EC2RemoteClient) makeReady() error { // Check Instance is running - will error if instance doesn't exist result, err := ins.ec2Client.DescribeInstanceStatus(&ec2.DescribeInstanceStatusInput{InstanceIds: aws.StringSlice([]string{ins.InstanceID})}) if err != nil { return fmt.Errorf("Error getting instanc...
[ "func setupServer(c *cli.Context) {\n started := time.Now()\n\n config := deployConfig()\n logger := &logger{Prefix: config.Host}\n ssh := newSSHClient(config.Host, config.User)\n\n ssh.execute(fmt.Sprintf(\"mkdir -p %s\", config.DeployTo))\n\n for _, t := range config.Setup {\n ssh.execute(t)\n }\n\n ss...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
RunCommand is a wrapper around the SSH client to run a command abstracts the SSH connection details from the EC2 client interface RunCommandWithOutput discards the stdout and stderr from the command
func (ins *EC2RemoteClient) RunCommand(cmd string) (exitStatus int, err error) { exitStatus, err = ins.cmdClient.RunCommand(cmd) return exitStatus, err }
[ "func (ins *EC2RemoteClient) RunCommandWithOutput(cmd string) (exitStatus int, stdoutBuf bytes.Buffer, stderrBuf bytes.Buffer, err error) {\n\texitStatus, stdoutBuf, stderrBuf, err = ins.cmdClient.RunCommandWithOutput(cmd)\n\treturn exitStatus, stdoutBuf, stderrBuf, err\n}", "func (client *Client) Run(command str...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
RunCommandWithOutput is a wrapper around the SSH client to run a command abstracts the SSH connection details from the EC2 client interface RunCommandWithOutput provides the stdout and stderr from the command
func (ins *EC2RemoteClient) RunCommandWithOutput(cmd string) (exitStatus int, stdoutBuf bytes.Buffer, stderrBuf bytes.Buffer, err error) { exitStatus, stdoutBuf, stderrBuf, err = ins.cmdClient.RunCommandWithOutput(cmd) return exitStatus, stdoutBuf, stderrBuf, err }
[ "func RunCommandWithOutput(session *ssh.Session, log logrus.FieldLogger, command string, w io.Writer) (err error) {\n\tdefer func() {\n\t\tif err != nil && session != nil {\n\t\t\terrClose := session.Close()\n\t\t\tif errClose != nil {\n\t\t\t\tlog.WithError(err).Error(\"failed to close SSH session\")\n\t\t\t}\n\t\...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
BackgroundCommand is a wrapper around the SSH client to run a command abstracts the SSH connection details from the EC2 client interface
func (ins *EC2RemoteClient) BackgroundCommand(cmd string, discardOutput bool) (int, error) { exitStatus, err := ins.cmdClient.BackgroundCommand(cmd, discardOutput) return exitStatus, err }
[ "func (client *SSHClient) RunCommandInBackground(ctx context.Context, cmd *SSHCommand) error {\n\tif ctx == nil {\n\t\tpanic(\"nil context provided to RunCommandInBackground()\")\n\t}\n\n\tsession, err := client.newSession()\n\tif err != nil {\n\t\treturn err\n\t}\n\tdefer session.Close()\n\n\tmodes := ssh.Terminal...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
CopyFile copies a file from the local filesystem to that on the EC2 instance
func (ins *EC2RemoteClient) CopyFile(source string, destination string) error { err := ins.cmdClient.CopyFile(source, destination) return err }
[ "func copyFile(srcFile string, destFile string) error {\n\tsrcReader, err := assets.FS.Open(srcFile)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"error opening %s file: %w\", srcFile, err)\n\t}\n\tdefer srcReader.Close()\n\n\tdestReader, err := os.Create(destFile)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"error cr...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
WriteBytesToFile writes a []byte to a specified file on the EC2 instance
func (ins *EC2RemoteClient) WriteBytesToFile(source []byte, destination string) error { err := ins.cmdClient.WriteBytesToFile(source, destination) return err }
[ "func WriteBytesToFile(fn string, b []byte) {\n\tfil, err := os.Create(os.ExpandEnv(fn))\n\tif err != nil {\n\t\tchk.Panic(_fileio_err03, fn)\n\t}\n\tdefer fil.Close()\n\tif _, err = fil.Write(b); err != nil {\n\t\tchk.Panic(_fileio_err04, err.Error())\n\t}\n}", "func writeFileBytes(filename string, bytesToWrite ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Deprecated: Use SecretVersion_State.Descriptor instead.
func (SecretVersion_State) EnumDescriptor() ([]byte, []int) { return file_google_cloud_secrets_v1beta1_resources_proto_rawDescGZIP(), []int{1, 0} }
[ "func (*SecretChange) Descriptor() ([]byte, []int) {\n\treturn edgelq_secrets_proto_v1alpha_secret_change_proto_rawDescGZIP(), []int{0}\n}", "func (*SecretChange_Current) Descriptor() ([]byte, []int) {\n\treturn edgelq_secrets_proto_v1alpha_secret_change_proto_rawDescGZIP(), []int{0, 2}\n}", "func (*SecretChang...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Deprecated: Use SecretVersion.ProtoReflect.Descriptor instead.
func (*SecretVersion) Descriptor() ([]byte, []int) { return file_google_cloud_secrets_v1beta1_resources_proto_rawDescGZIP(), []int{1} }
[ "func (*Secret) Descriptor() ([]byte, []int) {\n\treturn file_k8s_io_api_core_v1_generated_proto_rawDescGZIP(), []int{170}\n}", "func (*SecretReference) Descriptor() ([]byte, []int) {\n\treturn file_k8s_io_api_core_v1_generated_proto_rawDescGZIP(), []int{175}\n}", "func (*SecretChange) Descriptor() ([]byte, []i...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Deprecated: Use SecretPayload.ProtoReflect.Descriptor instead.
func (*SecretPayload) Descriptor() ([]byte, []int) { return file_google_cloud_secrets_v1beta1_resources_proto_rawDescGZIP(), []int{3} }
[ "func (*PrivatePayload) Descriptor() ([]byte, []int) {\n\treturn file_gossip_message_proto_rawDescGZIP(), []int{17}\n}", "func (*Secret) Descriptor() ([]byte, []int) {\n\treturn file_k8s_io_api_core_v1_generated_proto_rawDescGZIP(), []int{170}\n}", "func (*LabelledPayload) Descriptor() ([]byte, []int) {\n\tretu...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Deprecated: Use Replication_UserManaged_Replica.ProtoReflect.Descriptor instead.
func (*Replication_UserManaged_Replica) Descriptor() ([]byte, []int) { return file_google_cloud_secrets_v1beta1_resources_proto_rawDescGZIP(), []int{2, 1, 0} }
[ "func (*ReplicaInfo) Descriptor() ([]byte, []int) {\n\treturn file_google_spanner_admin_instance_v1_spanner_instance_admin_proto_rawDescGZIP(), []int{0}\n}", "func (*Replica) Descriptor() ([]byte, []int) {\n\treturn file_replica_replica_proto_rawDescGZIP(), []int{0}\n}", "func (*SqlInstancesPromoteReplicaReques...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
buildLogMsg generates an empty CI test plan that prints msg to the build log.
func buildLogMsg(title, msg string) droneyaml.BuildItem { return droneyaml.BuildItem{ Key: "Warning: " + title, Build: droneyaml.Build{ Container: droneyaml.Container{ Image: "library/alpine:3.2", Environment: droneyaml.MapEqualSlice([]string{"MSG=" + msg}), }, Commands: []string{`echo "$MSG...
[ "func (t *tracer) buildMessage() string {\n\tif t.IsNull() {\n\t\treturn \"\"\n\t}\n\n\t// Note: this value is very important, it makes sure the internal calls of this package would not interfere with the real caller we want to catch\n\t// badly set and you will get a line number that does not match with the ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
NewDeployment converts BOSH deployment information into a deployment view for the dashboard
func NewDeployment(configTier config.Tier, configSlot config.Slot, boshDeployment *data.Deployment) (deployment *Deployment) { tierName := configTier.Name slotName := configSlot.Name name := fmt.Sprintf("%s / %s - %s", tierName, slotName, boshDeployment.Name) releases := make([]DisplayNameVersion, len(boshDeploym...
[ "func newDeployment(apployment *appscodev1alpha1.Apployment) *appsv1.Deployment {\n\tlabels := map[string]string{\n\t\t\"app\": \"Appscode\",\n\t\t\"controller\": apployment.Name,\n\t}\n\treturn &appsv1.Deployment{\n\t\tObjectMeta: metav1.ObjectMeta{\n\t\t\tName: apployment.Spec.ApploymentName,\n\t\t\tN...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
ContainsFilterTag determines if a Deployment has a release matching filterTag
func (deployment *Deployment) ContainsFilterTag(filterTag string) bool { if filterTag == "" { return true } for _, release := range deployment.Releases { if release.Name == filterTag { return true } } return false }
[ "func isReleaseTag(eventType string, payload api.WebhookGithub) bool {\n\tif api.GithubWebhookPush == eventType {\n\t\tif nil != payload[api.GithubWebhookFlagRef] &&\n\t\t\tstrings.Contains(payload[api.GithubWebhookFlagRef].(string),\n\t\t\t\tapi.GithubWebhookFlagTags) {\n\t\t\treturn true\n\t\t}\n\t}\n\n\treturn f...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
NewUncertaintyGroup furnishes an UncertaintyGroup for a given set of actions where their quantity is known a priori.
func NewUncertaintyGroup(count uint) UncertaintyGroup { return &uncertaintyGroup{ remaining: count, results: make(chan error), } }
[ "func newGroupAtLeastOnce() *Instruction {\n\treturn &Instruction{\n\t\tType: GroupAtLeastOnceInst,\n\t\tName: \"AtLeastOnce\",\n\t}\n}", "func newAggrGroup(ctx context.Context, labels model.LabelSet, r *Route, to func(time.Duration) time.Duration, logger log.Logger) *aggrGroup {\n\tif to == nil {\n\t\tto = func(...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
ByteOrder returns the byte order for the CPU's native endianness.
func ByteOrder() binary.ByteOrder { return byteOrder }
[ "func GetByteOrder() binary.ByteOrder {\n\tbuf := [2]byte{}\n\t*(*uint16)(unsafe.Pointer(&buf[0])) = uint16(0xABCD)\n\n\tswitch buf {\n\tcase [2]byte{0xCD, 0xAB}:\n\t\treturn binary.LittleEndian\n\tcase [2]byte{0xAB, 0xCD}:\n\t\treturn binary.BigEndian\n\tdefault:\n\t\tpanic(\"Could not determine native endianness....
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Init creates a new light string
func (ls *LightString) Init() { log.Infof("Creating %v pixel light string", ls.Count) ls.Last = ls.Count // default last pixel to count n := 0 for n < ls.Count { ls.Pixels = append(ls.Pixels, &Pixel{ Color: defaultPixelColor, Brightness: defaultPixelBrightness, }) n++ } }
[ "func (td *TextDisplay)Init(){\r\n\tfontBytes, err := ioutil.ReadFile(\"Blockstepped.ttf\")\r\n\tif err != nil {\r\n\t\tlog.Println(err)\r\n\t\treturn\r\n\t}\r\n\tvar err2 error\r\n\ttd.font, err2 = truetype.Parse(fontBytes)\r\n\tif err2 != nil {\r\n\t\tlog.Fatal(err)\r\n\t}\r\n\ttd.mplusNormalFont = truetype.NewFa...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
FillString writes a color to all pixels
func (ls *LightString) FillString(color uint8) { log.Debugf("Filling pixels with color %v", color) n := 0 for n < ls.Last { ls.Pixels[n].Color = color log.Debugf("Coloring pixel %v %v", n, color) n++ } }
[ "func (rgc *RasterGraphicContext) FillStringAt(text string, x, y float64) (cursor float64, err error) {\n\tcursor, err = rgc.CreateStringPath(text, x, y)\n\trgc.Fill()\n\treturn\n}", "func (t *Textile) Fill(str string) {\n\tarea := t.Rect\n\tfor y := area.Min.Y; y < area.Max.Y; y++ {\n\t\tfor x := area.Min.X; x <...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Render writes the string to hardware
func (ls *LightString) Render() { log.Debug("Rendering string") }
[ "func (g *Game) Render() string {\n\tascii := \"\"\n\n\tm := g.generateScreen()\n\tfor _, row := range m.cells {\n\t\tascii += strings.Join(row, \"\") + \"\\n\"\n\t}\n\n\treturn ascii\n}", "func (d *Device) Render() error {\n\tbuf := new(bytes.Buffer)\n\n\tfor _, chain := range d.LEDs {\n\t\tfor _, col := range c...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
NewDirectRequestSpec initializes a new DirectRequestSpec from a job.DirectRequestSpec
func NewDirectRequestSpec(spec *job.DirectRequestSpec) *DirectRequestSpec { return &DirectRequestSpec{ ContractAddress: spec.ContractAddress, MinIncomingConfirmations: spec.MinIncomingConfirmations, MinIncomingConfirmationsEnv: spec.MinIncomingConfirmationsEnv, MinContractPayment: spec....
[ "func NewDirectRequestSpec(spec *job.DirectRequestSpec) *DirectRequestSpec {\n\treturn &DirectRequestSpec{\n\t\tContractAddress: spec.ContractAddress,\n\t\tOnChainJobSpecID: spec.OnChainJobSpecID.String(),\n\t\t// This is hardcoded to runlog. When we support other intiators, we need\n\t\t// to change this\n\t\tIni...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
NewFluxMonitorSpec initializes a new DirectFluxMonitorSpec from a job.FluxMonitorSpec
func NewFluxMonitorSpec(spec *job.FluxMonitorSpec) *FluxMonitorSpec { var drumbeatSchedulePtr *string if spec.DrumbeatEnabled { drumbeatSchedulePtr = &spec.DrumbeatSchedule } var drumbeatRandomDelayPtr *string if spec.DrumbeatRandomDelay > 0 { drumbeatRandomDelay := spec.DrumbeatRandomDelay.String() drumbeat...
[ "func NewFluxMonitorSpec(spec *job.FluxMonitorSpec) *FluxMonitorSpec {\n\treturn &FluxMonitorSpec{\n\t\tContractAddress: spec.ContractAddress,\n\t\tPrecision: spec.Precision,\n\t\tThreshold: spec.Threshold,\n\t\tAbsoluteThreshold: spec.AbsoluteThreshold,\n\t\tPollTimerPeriod: spec.PollTimerPerio...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }