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
DELETE is a shorthand for e.Request("DELETE", path, pathargs...).
func (e *Expect) DELETE(path string, pathargs ...interface{}) *Request { return e.Request(http.MethodDelete, path, pathargs...) }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func (r *Request) Delete(path string) *Request {\n\treturn r.method(\"DELETE\", path)\n}", "func (r Requester) Delete(path string) Requester {\n\treq, err := http.NewRequest(http.MethodDelete, r.url, nil)\n\tif err != nil {\n\t\tlog.Fatal(err)\n\t}\n\n\tr.httpRequest = req\n\treturn r\n}", "func (r *Request) D...
[ "0.80825806", "0.7741624", "0.7716973", "0.7485182", "0.7433246", "0.7414137", "0.73540527", "0.7320704", "0.7304203", "0.73019534", "0.72963434", "0.72934276", "0.7224465", "0.7186547", "0.714229", "0.71418566", "0.71270925", "0.71143883", "0.70936733", "0.7086868", "0.70710...
0.86834985
0
Deprecated: use NewValue or NewValueC instead.
func (e *Expect) Value(value interface{}) *Value { opChain := e.chain.enter("Value()") defer opChain.leave() return newValue(opChain, value) }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func NewValue() *Value { return &Value{} }", "func ValueNew(typ Type) *Value {\n\tvar gvalue C.GValue\n\tvalue := ValueNewFromC(unsafe.Pointer(&gvalue))\n\tvalue.Init(typ)\n\n\treturn value\n}", "func New(v interface{}) Value {\n\treturn Value{v}\n}", "func NewValue(val interface{}) (*Value, error) {\n\tvar ...
[ "0.6897488", "0.65999216", "0.63767564", "0.6348954", "0.62898755", "0.6215839", "0.60781306", "0.60525715", "0.5974779", "0.59242326", "0.58971953", "0.58674175", "0.5855389", "0.5766392", "0.5738731", "0.56474495", "0.56353194", "0.56350607", "0.5597118", "0.5562949", "0.55...
0.48057202
98
Deprecated: use NewObject or NewObjectC instead.
func (e *Expect) Object(value map[string]interface{}) *Object { opChain := e.chain.enter("Object()") defer opChain.leave() return newObject(opChain, value) }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func New() Object {\n\treturn Object{}\n}", "func New() Go { return Go{} }", "func newObject(path string) (copyObject, error) {\n\tfi, err := os.Lstat(path)\n\tif err != nil {\n\t\treturn nil, errors.Wrapf(err, \"Lstat(%s)\", path)\n\t}\n\n\tswitch {\n\tcase fi.Mode()&os.ModeSymlink != 0:\n\t\treturn newLink(p...
[ "0.6691688", "0.63193864", "0.622217", "0.6095062", "0.5881758", "0.58552635", "0.58150035", "0.5720011", "0.57134354", "0.56759024", "0.5672335", "0.55430204", "0.5528313", "0.5490371", "0.5488015", "0.5481182", "0.5449544", "0.5438932", "0.5411726", "0.540964", "0.5406844",...
0.0
-1
Deprecated: use NewArray or NewArrayC instead.
func (e *Expect) Array(value []interface{}) *Array { opChain := e.chain.enter("Array()") defer opChain.leave() return newArray(opChain, value) }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func NewArray(elem Type, len int64) *Array { return &Array{len: len, elem: elem} }", "func execNewArray(_ int, p *gop.Context) {\n\targs := p.GetArgs(2)\n\tret := types.NewArray(args[0].(types.Type), args[1].(int64))\n\tp.Ret(2, ret)\n}", "func rcNewArray(p *TCompiler, code *TCode) (*value.Value, error) {\n\ta...
[ "0.6461711", "0.63894624", "0.6308189", "0.61543226", "0.6146755", "0.60251695", "0.6004384", "0.59527683", "0.5845764", "0.5710822", "0.5624612", "0.55818206", "0.55148697", "0.54749113", "0.5463299", "0.54536057", "0.5441732", "0.53852904", "0.5355419", "0.534318", "0.53274...
0.4785012
67
Deprecated: use NewString or NewStringC instead.
func (e *Expect) String(value string) *String { opChain := e.chain.enter("String()") defer opChain.leave() return newString(opChain, value) }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func newString(value string) *TypedString {\n\ttypedString := TypedString{\n\t\tBytes: []byte(value),\n\t\tType: ValueType_STRING,\n\t}\n\treturn &typedString\n}", "func newString(val string) stringValue {\n\tif isNullString(val) {\n\t\treturn stringValue{options.GetDisplayStringNullFiller(), true}\n\t}\n\tretu...
[ "0.7182881", "0.68253267", "0.6810733", "0.6704855", "0.6686403", "0.66077876", "0.653487", "0.6529393", "0.64911515", "0.63751674", "0.6374679", "0.6371658", "0.6340675", "0.6335684", "0.6320425", "0.6298274", "0.62912184", "0.62584543", "0.6175023", "0.61361843", "0.6103262...
0.0
-1
Deprecated: use NewNumber or NewNumberC instead.
func (e *Expect) Number(value float64) *Number { opChain := e.chain.enter("Number()") defer opChain.leave() return newNumber(opChain, value) }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func New(n int, size int) Number {\n\tz2n := zero2nine.FromInt(n)\n\tnum := &number{size: size}\n\tswitch z2n {\n\tcase zero2nine.Zero:\n\t\treturn &zero{num}\n\tcase zero2nine.One:\n\t\treturn &one{num}\n\tcase zero2nine.Two:\n\t\treturn &two{num}\n\tcase zero2nine.Three:\n\t\treturn &three{num}\n\tcase zero2nine...
[ "0.6429968", "0.6316306", "0.62283", "0.6041876", "0.602277", "0.59579384", "0.58480793", "0.58397126", "0.5838419", "0.57813007", "0.5700551", "0.56568307", "0.555192", "0.5497972", "0.54948294", "0.5447874", "0.536075", "0.53470784", "0.5339671", "0.53339195", "0.5329353", ...
0.5771981
10
Deprecated: use NewBoolean or NewBooleanC instead.
func (e *Expect) Boolean(value bool) *Boolean { opChain := e.chain.enter("Boolean()") defer opChain.leave() return newBoolean(opChain, value) }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func newBool(value bool) *bool {\n\ttmp := value\n\treturn &tmp\n}", "func newBool(value bool) *TypedBool {\n\tbuf := make([]byte, 1)\n\tif value {\n\t\tbuf[0] = 1\n\t}\n\ttypedBool := TypedBool{\n\t\tBytes: buf,\n\t\tType: ValueType_BOOL,\n\t}\n\treturn &typedBool\n}", "func NewBoolean(v bool) Boolean {\n\tr...
[ "0.7252394", "0.7228488", "0.7124405", "0.70578104", "0.6976366", "0.6662587", "0.66352135", "0.66042703", "0.66042703", "0.66042703", "0.66042703", "0.66042703", "0.66042703", "0.65174186", "0.6499269", "0.64945954", "0.64942575", "0.64870346", "0.6418433", "0.6418433", "0.6...
0.5550271
94
GetVersion gets the MAVLink version of the Message contents
func (m *Heartbeat) GetVersion() int { if m.HasExtensionFieldValues { return 2 } return 1 }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func GetMessageVersion(msg []byte) (uint8, error) {\n\tif len(msg) < 4 {\n\t\treturn 0, fmt.Errorf(\"The message length %d is smaller than minimum length\", len(msg))\n\t}\n\theader := &OfpHeader{}\n\tif err := header.UnmarshalBinary(msg); err != nil {\n\t\treturn 0, fmt.Errorf(\"Version retrival failed due to %s\...
[ "0.74870914", "0.7234292", "0.70655257", "0.7057839", "0.69974446", "0.68850696", "0.68054265", "0.67681366", "0.67681366", "0.67496896", "0.6735234", "0.66415054", "0.6622044", "0.6622044", "0.6592677", "0.65429974", "0.6519645", "0.6487686", "0.6485133", "0.6484549", "0.646...
0.6477295
20
GetDialect gets the name of the dialect that defines the Message
func (m *Heartbeat) GetDialect() string { return "common" }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func GetDialect() SQLDialect { return def.GetDialect() }", "func (m *ComponentInformation) GetDialect() string {\n\treturn \"common\"\n}", "func (m *DigicamControl) GetDialect() string {\n\treturn \"ardupilotmega\"\n}", "func DbDialect() string {\n\treturn Db().Dialect().GetName()\n}", "func (m *AdapTuning...
[ "0.7608149", "0.74324024", "0.740498", "0.7249795", "0.7157729", "0.68678474", "0.68317574", "0.66529614", "0.6647241", "0.6647241", "0.64546055", "0.64295083", "0.6380442", "0.6310046", "0.60854125", "0.6021765", "0.5968178", "0.59251004", "0.5889809", "0.5752133", "0.573197...
0.7491343
1
GetMessageName gets the name of the Message
func (m *Heartbeat) GetMessageName() string { return "Heartbeat" }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func (m *DigicamControl) GetMessageName() string {\n\treturn \"DigicamControl\"\n}", "func (m *ComponentInformation) GetMessageName() string {\n\treturn \"ComponentInformation\"\n}", "func MessageName(msg *typemap.MessageDefinition) string {\n\tclassName := \"\"\n\n\tif lineage := msg.Lineage(); len(lineage) >...
[ "0.8020193", "0.7787682", "0.77183414", "0.74776936", "0.7410856", "0.73980534", "0.7380328", "0.7107878", "0.70817214", "0.70608985", "0.70233935", "0.7010338", "0.69850606", "0.6958533", "0.69493294", "0.68452144", "0.6840645", "0.67977536", "0.67783314", "0.6624587", "0.66...
0.7772068
2
GetID gets the ID of the Message
func (m *Heartbeat) GetID() uint32 { return 0 }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func (msg *Message) GetID() uint16 {\n\treturn msg.msgID\n}", "func (m *realMessage) ID() string {\n\treturn m.message.ID\n}", "func (m *Message) ID() int64 {\n\treturn m.id\n}", "func (m *Message) GetID() uuid.UUID {\n\treturn m.ID\n}", "func (m *SQSMessage) ID() string {\n\treturn m.Message.MessageId\n}"...
[ "0.7556283", "0.74129814", "0.7378599", "0.72958165", "0.72777325", "0.7191445", "0.7186988", "0.7186988", "0.71721065", "0.7129689", "0.71200055", "0.7110336", "0.7071176", "0.7041885", "0.70253277", "0.69809914", "0.686221", "0.68560237", "0.68390805", "0.68262815", "0.6815...
0.0
-1
HasExtensionFields returns true if the message definition contained extensions; false otherwise
func (m *Heartbeat) HasExtensionFields() bool { return false }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func (m *ComponentInformation) HasExtensionFields() bool {\n\treturn false\n}", "func (m *DigicamControl) HasExtensionFields() bool {\n\treturn false\n}", "func (m *AdapTuning) HasExtensionFields() bool {\n\treturn false\n}", "func HasAdaptationFieldExtension(pkt *packet.Packet) bool {\n\treturn pkt[5]&0x01 ...
[ "0.79747695", "0.7872464", "0.7571828", "0.70303", "0.6822041", "0.68168104", "0.6751157", "0.64307547", "0.6375237", "0.6172389", "0.612653", "0.5998885", "0.59975886", "0.59836483", "0.5968552", "0.5941892", "0.5920344", "0.5860863", "0.58554816", "0.58536065", "0.58418304"...
0.8061141
0
Read sets the field values of the message from the raw message payload
func (m *Heartbeat) Read(frame mavlink2.Frame) (err error) { version := frame.GetVersion() // Ensure only Version 1 or Version 2 were specified if version != 1 && version != 2 { err = mavlink2.ErrUnsupportedVersion return } // Don't attempt to Read V2 messages from V1 frames if m.GetID() > 255 && version < 2 { err = mavlink2.ErrDecodeV2MessageV1Frame return } // binary.Read can panic; swallow the panic and return a sane error defer func() { if r := recover(); r != nil { err = mavlink2.ErrPrivateField } }() // Get a slice of bytes long enough for the all the Heartbeat fields // binary.Read requires enough bytes in the reader to read all fields, even if // the fields are just zero values. This also simplifies handling MAVLink2 // extensions and trailing zero truncation. ioSlice := m.getIOSlice() copy(ioSlice, frame.GetMessageBytes()) // Indicate if if version == 2 && m.HasExtensionFields() { ioSlice[len(ioSlice)-1] = 1 } reader := bytes.NewReader(ioSlice) err = binary.Read(reader, binary.LittleEndian, m) return }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func (this *reader) Read() (value, key []byte, offset int64, err error) {\n\t// read header\n\tbuffer := make([]byte, common.MSGSET_HEADER_SIZE)\n\tn, err := this.ioRead(buffer)\n\tif err != nil {\n\t\treturn this.rollback(n, err)\n\t}\n\t// parse header\n\t_, msglen, err := common.ParseMessageSetHeader(buffer)\n\...
[ "0.6321134", "0.5969817", "0.593248", "0.58840793", "0.5873555", "0.5843138", "0.58348805", "0.56708646", "0.5670422", "0.5646887", "0.5637402", "0.56267595", "0.5620093", "0.5600804", "0.5599401", "0.5555723", "0.55465513", "0.548909", "0.5470988", "0.5463674", "0.5459053", ...
0.515224
57
Write encodes the field values of the message to a byte array
func (m *Heartbeat) Write(version int) (output []byte, err error) { var buffer bytes.Buffer // Ensure only Version 1 or Version 2 were specified if version != 1 && version != 2 { err = mavlink2.ErrUnsupportedVersion return } // Don't attempt to Write V2 messages to V1 bodies if m.GetID() > 255 && version < 2 { err = mavlink2.ErrEncodeV2MessageV1Frame return } err = binary.Write(&buffer, binary.LittleEndian, *m) if err != nil { return } output = buffer.Bytes() // V1 uses fixed message lengths and does not include any extension fields // Truncate the byte slice to the correct length // This also removes the trailing extra byte written for HasExtensionFieldValues if version == 1 { output = output[:m.getV1Length()] } // V2 uses variable message lengths and includes extension fields // The variable length is caused by truncating any trailing zeroes from // the end of the message before it is added to a frame if version == 2 { // Set HasExtensionFieldValues to zero so that it doesn't interfere with V2 truncation output[len(output)-1] = 0 output = util.TruncateV2(buffer.Bytes()) } return }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func encode(message interface{}) *bytes.Buffer {\n\tbuffer := &bytes.Buffer{}\n\t// Write struct's data as bytes\n\terr := binary.Write(buffer, binary.BigEndian, message)\n\tif err != nil {\n\t\tlog.Fatal(err)\n\t}\n\n\treturn buffer\n}", "func write(w io.Writer, en *msgEncoder, fs map[string]interface{}, val re...
[ "0.645381", "0.6253379", "0.6057715", "0.60549295", "0.6023306", "0.6000144", "0.59811443", "0.5949536", "0.5926285", "0.59011686", "0.5868457", "0.5825595", "0.58135957", "0.57659537", "0.5746178", "0.57396525", "0.5729571", "0.57141805", "0.57085377", "0.5708323", "0.569976...
0.0
-1
Version return the version string of Go runtime. This works well even though the runtime is devel version.
func Version() string { b, err := exec.Command("go", "version").CombinedOutput() if err != nil { panic(err.Error()) } token := strings.Split(string(b), " ") if strings.HasPrefix(token[2], "go") { return token[2] } if !strings.HasPrefix(token[2], "devel") { panic("Can not detect go version") } d := strings.Join(token[4:len(token)-1], " ") t0, err := time.Parse(`Mon Jan _2 15:04:05 2006 -0700`, d) if err != nil { panic("Can not detect go version") } for i, v := range vers { t1, err := time.Parse(`2006-01-2 15:04:05 -0700`, v[0]) if err != nil { continue } if t1.After(t0) { return vers[i-1][1] } } return vers[len(vers)-1][1] }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func Version() string {\n\treturn runtime.Version()\n}", "func Version() (os string, rt string) {\n\tos = runtime.GOOS\n\tvar flavor string\n\tif ver, err := syscall.GetVersion(); err == nil {\n\t\tvar major, minor, build = byte(ver), uint8(ver >> 8), uint16(ver >> 16)\n\t\tswitch {\n\t\tcase major == 4:\n\t\t\t...
[ "0.7978932", "0.72473425", "0.7034545", "0.7000306", "0.69702375", "0.6904021", "0.6897579", "0.6790574", "0.6746335", "0.67396516", "0.67396516", "0.67396516", "0.67396516", "0.67396516", "0.67396516", "0.67396516", "0.67396516", "0.6696343", "0.66733056", "0.66323537", "0.6...
0.75853413
1
WithMultiStatsHandler returns a DialOption that chains given stats.Handler(s). The first handler will be executed first, and then next afterwards. nil Handlers are ignored.
func WithMultiStatsHandler(handlers ...stats.Handler) grpc.DialOption { mh := &multiStatsHandler{} for _, h := range handlers { if h == nil { continue } mh.delegates = append(mh.delegates, h) } switch len(mh.delegates) { case 0: // Effectively, this unsets the dial option for the stats handler. return grpc.WithStatsHandler(nil) case 1: // Avoid unnecessary delegation layer. return grpc.WithStatsHandler(mh.delegates[0]) } return grpc.WithStatsHandler(mh) }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func NewMultiStatReporter(reporters ...StatsReporter) StatsReporter {\n\treturn multiStatReporter(reporters)\n}", "func (group *Group) Use(handler ...Handler) {\n\tfor _, h := range handler{\n\t\tgroup.handlers = append(group.handlers, h)\n\t}\n}", "func Use(handler http.HandlerFunc, mid ...func(http.Handler) ...
[ "0.5196978", "0.49642527", "0.48838636", "0.4856744", "0.48155951", "0.46619335", "0.46383664", "0.46271682", "0.45905352", "0.45672196", "0.45584178", "0.454697", "0.4531779", "0.45313132", "0.45251963", "0.45178384", "0.449293", "0.4485742", "0.44678187", "0.446136", "0.445...
0.833905
0
Separated messages The first is message Other is key => value
func separatedMessages(values ...interface{}) (string, []interface{}) { if len(values)%2 == 0 { return ``, values } return values[0].(string), values[1:] }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func splitMessage(msg string, splitLen int) (msgs []string) {\n\t// This is quite short ;-)\n\tif splitLen < 10 {\n\t\tsplitLen = 10\n\t}\n\tfor len(msg) > splitLen {\n\t\tidx := indexFragment(msg[:splitLen])\n\t\tif idx < 0 {\n\t\t\tidx = splitLen\n\t\t}\n\t\tmsgs = append(msgs, msg[:idx] + \"...\")\n\t\tmsg = ms...
[ "0.60143024", "0.59999645", "0.5932631", "0.5673276", "0.5591553", "0.5550244", "0.5549246", "0.54947376", "0.5455329", "0.54386246", "0.54386246", "0.5306209", "0.52722335", "0.52561706", "0.5222443", "0.5213995", "0.51282877", "0.51198953", "0.5119838", "0.5110843", "0.5098...
0.729302
0
func Default internal logger
func zapLogger(config *Configuration) (*zap.SugaredLogger, writers) { encoder := zapEncoders[config.Formatter] current := config.Default writers := make(writers, len(current)) cores := make([]zapcore.Core, len(current)) for i := range current { writers[current[i]] = channelMap[current[i]](config) cores[i] = zapcore.NewCore( encoder, zapcore.AddSync(writers[current[i]]), zap.LevelEnablerFunc(func(lvl zapcore.Level) bool { return lvl >= levelMap[level(config.Channels[current[i]].(map[string]interface{})[`level`].(string))] })) } return zap.New( zapcore.NewTee(cores...), zap.AddCallerSkip(3), zap.AddStacktrace(levelMap[level(config.StackLevel)]), ).Sugar(), writers }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func defaultLogger(req *http.Request, err error) {\n\tmessage := err.Error()\n\tperr, ok := err.(Panic)\n\tif ok {\n\t\tmessage += \"\\n\" + perr.String()\n\t}\n\tlog.Println(message)\n}", "func Default() Logger {\n\treturn logger\n}", "func DefaultLogger() gin.HandlerFunc {\n\treturn gin.LoggerWithFormatter(f...
[ "0.74423826", "0.73741555", "0.72805923", "0.7110502", "0.70920885", "0.7054502", "0.7036345", "0.69664824", "0.6912639", "0.6888308", "0.687909", "0.687909", "0.687909", "0.68032384", "0.67703074", "0.67672384", "0.67649764", "0.67625886", "0.67587125", "0.6727573", "0.67054...
0.0
-1
Getkey get key for upload file
func (g *Genkey) Getkey() (key int64, err error) { select { case key = <-g.keys: return case <-time.After(genKeyTimeout): err = errors.New("getKey timeout") return } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func getKey(config *viper.Viper, keyType string) ([]byte, error) {\n\tkey := config.GetString(keyType + \"Key\")\n\tif key != \"\" {\n\t\treturn []byte(key), nil\n\t}\n\tif config.GetString(keyType+\"KeyFile\") == \"\" {\n\t\treturn nil, fmt.Errorf(\"missing %s key in the token config (%sKey or %sKeyFile)\", keyTy...
[ "0.70552146", "0.7039365", "0.6797661", "0.6753791", "0.65889215", "0.6555206", "0.65533847", "0.6481812", "0.64227945", "0.6421557", "0.6370605", "0.63243836", "0.63234264", "0.6266533", "0.6256651", "0.6236671", "0.62041694", "0.6186641", "0.6159462", "0.61543775", "0.61280...
0.0
-1
preGenerate pre generate key until 1000
func (g *Genkey) preGenerate() { var ( i int ) time.Sleep(errorSleep) for i = 0; i < 10; i++ { go func() { var ( key int64 keys []int64 err error ) for { if keys, err = g.client.Ids(100); err != nil { log.Errorf("preGenerate() error(%v) retry", err) time.Sleep(errorSleep) continue } for _, key = range keys { g.keys <- key } } }() } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func genKey(code string, t time.Time) string {\n\treturn fmt.Sprintf(\"%s#%s\", code, t.Format(time.RFC3339))\n}", "func Auto() (pkey []byte, err error) {\n\treturn Generate(defaultBits)\n}", "func generateKey(length int) (key []byte, err error) {\n\tdefer func(start time.Time) {\n\t\tvalue.RecordDataKeyGenera...
[ "0.6533145", "0.6520306", "0.6415669", "0.6267787", "0.6250052", "0.62185055", "0.6217248", "0.61889654", "0.6179897", "0.61647594", "0.6148303", "0.6131615", "0.61281455", "0.6078433", "0.6077706", "0.6039833", "0.60331726", "0.6031663", "0.6017027", "0.6016135", "0.6014589"...
0.7289817
0
Each list of collation elements corresponding to an expansion starts with a header indicating the length of the sequence.
func makeExpansionHeader(n int) (uint32, error) { return uint32(n), nil }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func (h *literalsHeader) setSizes(compLen, inLen int, single bool) {\n\tcompBits, inBits := bits.Len32(uint32(compLen)), bits.Len32(uint32(inLen))\n\t// Only retain 2 bits\n\tconst mask = 3\n\tlh := uint64(*h & mask)\n\tswitch {\n\tcase compBits <= 10 && inBits <= 10:\n\t\tif !single {\n\t\t\tlh |= 1 << 2\n\t\t}\n...
[ "0.49813172", "0.48360458", "0.47812974", "0.4780133", "0.47646663", "0.4690478", "0.46328482", "0.4630249", "0.46217388", "0.4525466", "0.45226246", "0.45017442", "0.4492866", "0.44202247", "0.4419724", "0.43393785", "0.43271053", "0.43072742", "0.4262055", "0.42552918", "0....
0.5510114
0
implicitPrimary returns the primary weight for the a rune for which there is no entry for the rune in the collation table. We take a different approach from the one specified in but preserve the resulting relative ordering of the runes.
func implicitPrimary(r rune) int { if unicode.Is(unicode.Ideographic, r) { if r >= minUnified && r <= maxUnified { // The most common case for CJK. return int(r) + commonUnifiedOffset } if r >= minCompatibility && r <= maxCompatibility { // This will typically not hit. The DUCET explicitly specifies mappings // for all characters that do not decompose. return int(r) + commonUnifiedOffset } return int(r) + rareUnifiedOffset } return int(r) + otherOffset }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func Latin1_bin_RuneWeight(r rune) int32 {\n\tweight, ok := latin1_bin_Weights[r]\n\tif ok {\n\t\treturn weight\n\t} else if r >= 0 && r <= 127 {\n\t\treturn r + 0\n\t} else {\n\t\treturn 2147483647\n\t}\n}", "func Dec8_bin_RuneWeight(r rune) int32 {\n\tweight, ok := dec8_bin_Weights[r]\n\tif ok {\n\t\treturn we...
[ "0.57969654", "0.56402534", "0.5626691", "0.5286568", "0.50942874", "0.50046116", "0.48226017", "0.47957408", "0.47443202", "0.4729108", "0.4695173", "0.46331108", "0.46320114", "0.462492", "0.45968914", "0.45929956", "0.45853716", "0.45693466", "0.455841", "0.455519", "0.454...
0.6996434
0
convertLargeWeights converts collation elements with large primaries (either double primaries or for illegal runes) to our own representation. A CJK character C is represented in the DUCET as [.FBxx.0020.0002.C][.BBBB.0000.0000.C] We will rewrite these characters to a single CE. We assume the CJK values start at 0x8000. See
func convertLargeWeights(elems []rawCE) (res []rawCE, err error) { const ( cjkPrimaryStart = 0xFB40 rarePrimaryStart = 0xFB80 otherPrimaryStart = 0xFBC0 illegalPrimary = 0xFFFE highBitsMask = 0x3F lowBitsMask = 0x7FFF lowBitsFlag = 0x8000 shiftBits = 15 ) for i := 0; i < len(elems); i++ { ce := elems[i].w p := ce[0] if p < cjkPrimaryStart { continue } if p > 0xFFFF { return elems, fmt.Errorf("found primary weight %X; should be <= 0xFFFF", p) } if p >= illegalPrimary { ce[0] = illegalOffset + p - illegalPrimary } else { if i+1 >= len(elems) { return elems, fmt.Errorf("second part of double primary weight missing: %v", elems) } if elems[i+1].w[0]&lowBitsFlag == 0 { return elems, fmt.Errorf("malformed second part of double primary weight: %v", elems) } np := ((p & highBitsMask) << shiftBits) + elems[i+1].w[0]&lowBitsMask switch { case p < rarePrimaryStart: np += commonUnifiedOffset case p < otherPrimaryStart: np += rareUnifiedOffset default: p += otherOffset } ce[0] = np for j := i + 1; j+1 < len(elems); j++ { elems[j] = elems[j+1] } elems = elems[:len(elems)-1] } } return elems, nil }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func Utf8mb3_slovak_ci_RuneWeight(r rune) int32 {\n\tweight, ok := common_utf_slovak_ci_Weights()[r]\n\tif ok {\n\t\treturn weight\n\t} else if r >= 9003 && r <= 9168 {\n\t\treturn r - 8070\n\t} else if r >= 9475 && r <= 9632 {\n\t\treturn r - 8323\n\t} else if r >= 10496 && r <= 10626 {\n\t\treturn r - 8775\n\t} ...
[ "0.60411733", "0.58522487", "0.52693385", "0.507753", "0.5066497", "0.5002067", "0.49114704", "0.4893731", "0.4882453", "0.48535874", "0.48505023", "0.4840101", "0.48007232", "0.47968397", "0.4740697", "0.47375637", "0.468026", "0.46521255", "0.46509424", "0.46390942", "0.463...
0.6883669
0
nextWeight computes the first possible collation weights following elems for the given level.
func nextWeight(level colltab.Level, elems []rawCE) []rawCE { if level == colltab.Identity { next := make([]rawCE, len(elems)) copy(next, elems) return next } next := []rawCE{makeRawCE(elems[0].w, elems[0].ccc)} next[0].w[level]++ if level < colltab.Secondary { next[0].w[colltab.Secondary] = defaultSecondary } if level < colltab.Tertiary { next[0].w[colltab.Tertiary] = defaultTertiary } // Filter entries that cannot influence ordering. for _, ce := range elems[1:] { skip := true for i := colltab.Primary; i < level; i++ { skip = skip && ce.w[i] == 0 } if !skip { next = append(next, ce) } } return next }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func (e WeightedEdgePair) Weight() float64 { return e.W }", "func (sw *SW) Next() interface{} {\n\tsw.mtx.RLock()\n\tdefer sw.mtx.RUnlock()\n\n\tif sw.elems == nil || len(sw.elems) == 0 {\n\t\treturn nil\n\t}\n\n\tvar total int\n\tnext := &smoothElem{}\n\tfor _, elem := range sw.elems {\n\t\ttotal += elem.effect...
[ "0.5805395", "0.5767882", "0.562097", "0.5619211", "0.55570513", "0.5546121", "0.5489472", "0.53985757", "0.5363531", "0.53404033", "0.5303844", "0.5233217", "0.52004", "0.5160009", "0.51417226", "0.5127784", "0.51159465", "0.509564", "0.5075816", "0.5062415", "0.50532717", ...
0.787631
0
compareWeights returns 1 if a b, or 0 otherwise. It also returns the collation level at which the difference is found.
func compareWeights(a, b []rawCE) (result int, level colltab.Level) { for level := colltab.Primary; level < colltab.Identity; level++ { var va, vb int for ia, ib := 0, 0; ia < len(a) || ib < len(b); ia, ib = ia+1, ib+1 { ia, va = nextVal(a, ia, level) ib, vb = nextVal(b, ib, level) if va != vb { if va < vb { return -1, level } else { return 1, level } } } } return 0, colltab.Identity }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func CMPW(amr, imr operand.Op) { ctx.CMPW(amr, imr) }", "func compare(a, b *TrieKey, prematchedBits uint) (a_match, b_match, reversed bool, common, child uint) {\n\t// Figure out which is the longer prefix and reverse them if b is shorter\n\treversed = b.Length < a.Length\n\tif reversed {\n\t\tb_match, a_match, ...
[ "0.5189569", "0.51442885", "0.5119967", "0.50551087", "0.5029887", "0.49232233", "0.49166036", "0.49087584", "0.48527613", "0.48441088", "0.4839668", "0.482278", "0.48217055", "0.4813844", "0.48036337", "0.47875902", "0.4784142", "0.47828326", "0.47776183", "0.47706735", "0.4...
0.8061941
0
check device exists and activated
func CheckSIMActivate(mobno string) utils.Response { _sn := getDBSession().Copy() defer _sn.Close() resp := utils.Response{} //Check imei in inventory ColSimEnv := col(_sn, db.ColSimEnv) var sIMMaster datamodel.SIMMaster ColSimEnv.Find(bson.M{"mobno": mobno}).One(&sIMMaster) // if imei not found if sIMMaster.MobNo == "" { resp.Error = "Invalid Sim Number!!! Please contact administrator." resp.Status = false resp.StausCode = 0 return resp } //Check imei in vehicles // ColVhcls := col(_sn, db.ColVhcls) // var vehicles datamodel.Vehicles // ColVhcls.Find(bson.M{"imei": imei}).One(&vehicles) // if vehicles.Vhid != "" && vehicles.UID != "" { // resp.Error = "This device is already registered!!! Please contact administrator." // resp.Status = false // resp.StausCode = 0 // return resp // } resp.Error = "This device is already registered!!! Please contact administrator." resp.Status = false resp.StausCode = 0 return resp }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func doesDeviceExist(deviceID int, meta interface{}) bool {\n\tlog.Printf(\"[Dotcom-Monitor] [DEBUG] Checking if device exists with ID: %v\", deviceID)\n\tdevice := &client.Device{\n\t\tID: deviceID,\n\t}\n\n\t// Since an empty HTTP response is a valid 200 from the API, we will determine if\n\t// the device exist...
[ "0.6312477", "0.6228137", "0.62089825", "0.58341724", "0.57657474", "0.5584125", "0.5508774", "0.55026543", "0.546385", "0.5462384", "0.5418742", "0.54090357", "0.53741467", "0.5364885", "0.535505", "0.5345196", "0.5343105", "0.5337849", "0.53324705", "0.53292495", "0.5323887...
0.0
-1
check device exists and activated
func CreateSIMEntry(data datamodel.SIMMaster) utils.Response { _sn := getDBSession().Copy() defer _sn.Close() data.CreateOn = time.Now() validerr := GetValidator().Struct(data) resp := utils.Response{} if validerr != nil { resp.Error = validerr.Error() resp.Status = false resp.StausCode = 0 return resp } //Check imei in inventory ColSimEnv := col(_sn, db.ColSimEnv) err := ColSimEnv.Insert(data) // if imei not found if err != nil { resp.Error = err.Error() resp.Status = false resp.StausCode = 0 return resp } //Check imei in vehicles // ColVhcls := col(_sn, db.ColVhcls) // var vehicles datamodel.Vehicles // ColVhcls.Find(bson.M{"imei": imei}).One(&vehicles) // if vehicles.Vhid != "" && vehicles.UID != "" { // resp.Error = "This device is already registered!!! Please contact administrator." // resp.Status = false // resp.StausCode = 0 // return resp // } resp.Message = "SIM addedd successfully" resp.Status = true resp.StausCode = 0 return resp }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func doesDeviceExist(deviceID int, meta interface{}) bool {\n\tlog.Printf(\"[Dotcom-Monitor] [DEBUG] Checking if device exists with ID: %v\", deviceID)\n\tdevice := &client.Device{\n\t\tID: deviceID,\n\t}\n\n\t// Since an empty HTTP response is a valid 200 from the API, we will determine if\n\t// the device exist...
[ "0.6312477", "0.6228137", "0.62089825", "0.58341724", "0.57657474", "0.5584125", "0.5508774", "0.55026543", "0.546385", "0.5462384", "0.5418742", "0.54090357", "0.53741467", "0.5364885", "0.535505", "0.5345196", "0.5343105", "0.5337849", "0.53324705", "0.53292495", "0.5323887...
0.0
-1
Anagrams returns all anagrams of the input string using words from the lineseparated word list found at dpath
func Anagrams(s string, dpath string) ([]string, error) { d, err := readDict(dpath) if err != nil { panic(err) } l := strings.ReplaceAll(s, " ", "") l = util.SortString(l) res := []string{} return *findAnagrams(l, &res, d, s), nil }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func groupAnagrams(strs []string) [][]string {\n var result [][]string\n if len(strs)==0{\n return result\n }\n resultMap := make(map[string][]string)\n count := make([]string,26)\n for _, str := range strs{\n fillArrayWithZero(count)\n for _, c := range str{\n val...
[ "0.68058455", "0.6737168", "0.6650204", "0.6594094", "0.6563233", "0.65479094", "0.64732206", "0.63604116", "0.6302019", "0.62427104", "0.6218595", "0.62174195", "0.61713296", "0.6131854", "0.610174", "0.60827327", "0.59945303", "0.5972863", "0.59696966", "0.5967249", "0.5940...
0.8158142
0
NewInt returns a new Int initialized to x.
func NewFloat(x float64) *Float { return new(Float).SetFloat64(x) }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func NewInt(x int64) *Int {}", "func NewInt(x int64) *big.Int", "func NewInt(x int) *Numeric {\n\tvar r Numeric\n\treturn r.SetInt(x)\n}", "func NewInt(input int) *int {\n\treturn &input\n}", "func NewInt(x int64) *big.Int {\n\treturn big.NewInt(x)\n}", "func NewInt(i int) Int { return &i }", "func New...
[ "0.8246096", "0.8132891", "0.77978134", "0.7463509", "0.74588287", "0.74039143", "0.7392883", "0.7336342", "0.7291672", "0.6908981", "0.6841585", "0.6737534", "0.6446869", "0.6358521", "0.6345338", "0.62837094", "0.6262954", "0.61534965", "0.6113239", "0.6025698", "0.6025076"...
0.0
-1
NewInt returns a new Int initialized to x, with precision prec.
func NewFloat2(x float64, prec uint) *Float { f := new(Float) f.prec = prec f.SetFloat64(x) return f }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func NewInt(x int64) *big.Int", "func NewInt(x int64) *Int {}", "func NewInt(x int64) *big.Int {\n\treturn big.NewInt(x)\n}", "func NewInt(x int) *Numeric {\n\tvar r Numeric\n\treturn r.SetInt(x)\n}", "func NewInt(value int) *Int {\n\treturn &Int{\n\t\tvalue: value,\n\t}\n}", "func NewInt(input int) *int...
[ "0.78905994", "0.76491046", "0.7458619", "0.73548555", "0.6882211", "0.67282903", "0.67063975", "0.66988444", "0.65315205", "0.64342564", "0.6404768", "0.6363422", "0.6145609", "0.60960853", "0.60771865", "0.6070885", "0.5997443", "0.59749806", "0.5954635", "0.57052433", "0.5...
0.0
-1
Int promises that the zero value is a 0, but in gmp the zero value is a crash. To bridge the gap, the init bool says whether this is a valid gmp value. doinit initializes f.i if it needs it. This is not inherent to FFI, just a mismatch between Go's convention of making zero values useful and gmp's decision not to.
func (f *Float) doinit() { if f.init { return } if f.prec != 0 { C.mpf_init2(&f.i[0], C.mp_bitcnt_t(f.prec)) } else { C.mpf_init(&f.i[0]) } f.init = true }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func gmpInit(ctx phpv.Context, args []*phpv.ZVal) (*phpv.ZVal, error) {\n\tvar num *phpv.ZVal\n\tvar base *phpv.ZInt\n\n\t_, err := core.Expand(ctx, args, &num, &base)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tvar i *big.Int\n\n\tswitch num.GetType() {\n\tcase phpv.ZtNull, phpv.ZtBool, phpv.ZtInt, phpv.ZtF...
[ "0.6102218", "0.5942012", "0.5883882", "0.5667407", "0.5602605", "0.5529715", "0.55246204", "0.5441465", "0.54351246", "0.54031265", "0.54008603", "0.5350783", "0.5315941", "0.5255503", "0.52292323", "0.52292323", "0.52292323", "0.52292323", "0.5211608", "0.51354223", "0.5112...
0.71814644
0
Set sets f = x and returns f.
func (f *Float) Set(x *Float) *Float { f.doinit() C.mpf_set(&f.i[0], &x.i[0]) return f }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func (m *mShifterMockShift) Set(f func(p context.Context, p1 insolar.PulseNumber) (r error)) *ShifterMock {\n\tm.mainExpectation = nil\n\tm.expectationSeries = nil\n\n\tm.mock.ShiftFunc = f\n\treturn m.mock\n}", "func (hf *handleFunc) Set(f func(w http.ResponseWriter, r *http.Request)) {\n\thf.mu.Lock()\n\tdefer...
[ "0.6997543", "0.6944354", "0.68723893", "0.6836697", "0.6810442", "0.6802553", "0.67897075", "0.6762525", "0.6760551", "0.67147166", "0.6617839", "0.6598485", "0.65970314", "0.6589452", "0.65852654", "0.6581722", "0.65531677", "0.65484816", "0.6532592", "0.6514801", "0.651143...
0.7359609
0
SetInt sets f = x and returns f.
func (f *Float) SetInt64(x int64) *Float { f.doinit() C.mpf_set_si(&f.i[0], C.long(x)) return f }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func (z *Float) SetInt(x *Int) *Float {}", "func (i *MyInt) set(x int) {\n\t*i = MyInt(x)\n}", "func FloatSetInt(z *big.Float, x *big.Int,) *big.Float", "func setInt(data [2]string, f func(int)) error {\n\tval, err := strconv.ParseInt(strings.TrimSpace(data[1]), 10, 64)\n\tif err != nil {\n\t\treturn fmt.Err...
[ "0.6933246", "0.68064797", "0.6780815", "0.63636106", "0.62420726", "0.6134061", "0.61088806", "0.5947502", "0.5893964", "0.5794301", "0.5775132", "0.57688373", "0.57640165", "0.5718129", "0.56970423", "0.5685742", "0.5681129", "0.56231415", "0.5500865", "0.54648066", "0.5421...
0.5430527
20
SetFloat64 sets f = x and returns f.
func (f *Float) SetFloat64(x float64) *Float { f.doinit() C.mpf_set_d(&f.i[0], C.double(x)) return f }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func (z *Float) SetFloat64(x float64) *Float {}", "func (z *Rat) SetFloat64(f float64) *Rat {}", "func (feature Feature) SetFieldFloat64(index int, value float64) {\n\tC.OGR_F_SetFieldDouble(feature.cval, C.int(index), C.double(value))\n}", "func (z *Big) SetFloat64(x float64) *Big {\n\tif x == 0 {\n\t\tvar ...
[ "0.8342938", "0.7686479", "0.74044406", "0.7318797", "0.72632647", "0.7162008", "0.70200455", "0.6996254", "0.6969324", "0.68820095", "0.6860794", "0.6838876", "0.6828565", "0.68112725", "0.67913413", "0.67847276", "0.6707692", "0.6673483", "0.6649437", "0.6638445", "0.663528...
0.85616565
0
SetString interprets s as a number in the given base and sets f to that value. The base must be in the range [2,36]. SetString returns an error if s cannot be parsed or the base is invalid.
func (f *Float) SetString(s string, base int) error { f.doinit() if base < 2 || base > 36 { return os.ErrInvalid } p := C.CString(s) defer C.free(unsafe.Pointer(p)) if C.mpf_set_str(&f.i[0], p, C.int(base)) < 0 { return os.ErrInvalid } return nil }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func (z *Int) SetString(s string, base int) (*Int, bool) {}", "func IntSetString(z *big.Int, s string, base int) (*big.Int, bool)", "func SetString(z *big.Int, s string, base int) (*big.Int, bool) {\n\treturn z.SetString(s, base)\n}", "func (e *Eth) SetString(s string, base int) (*Eth, bool) {\n\tw, ok := e....
[ "0.6672757", "0.6561317", "0.6524928", "0.64725137", "0.6220122", "0.58207285", "0.58039266", "0.5787626", "0.57356185", "0.57275665", "0.5620785", "0.5603762", "0.55734444", "0.55207187", "0.55129176", "0.5493494", "0.5485165", "0.547474", "0.54543877", "0.5406057", "0.53943...
0.7630867
0
String returns the decimal representation of z.
func (f *Float) String() string { s, _ := f.StringBase(10, 0) return s }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func (z *Zr) String() string {\n\treturn (*FP256BN.BIG)(z).ToString()\n}", "func (x nat) decimalString() string {\n\treturn x.string(lowercaseDigits[0:10])\n}", "func (c CubicFeet) String() string {\n\treturn fmt.Sprintf(\"%.2f\", c)\n}", "func (z *polyGF2) String() string {\n\tif z.coeff.Sign() == 0 {\n\t\t...
[ "0.7193909", "0.667636", "0.66519934", "0.65169305", "0.65137917", "0.6396818", "0.63942516", "0.63750184", "0.63258773", "0.6306505", "0.6298925", "0.6290195", "0.62601036", "0.62505144", "0.62415934", "0.6237553", "0.62095034", "0.6189272", "0.61703116", "0.61559594", "0.61...
0.58583164
38
FIXME: Float2Exp is inconsistent, Float642Exp is silly. Convert f to a float64, truncating if necessary (ie. rounding towards zero), and with an exponent returned separately.
func (f *Float) Float2Exp() (d float64, exp int) { var exp_ C.long d = float64(C.mpf_get_d_2exp(&exp_, &f.i[0])) exp = int(exp_) return }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func Float64(f float64, buf []byte) ([]byte, error) {\n\tif math.IsInf(f, 0) || math.IsNaN(f) {\n\t\treturn buf, fmt.Errorf(\"unsupported value: %s\", strconv.FormatFloat(f, 'g', -1, 64))\n\t}\n\t// Convert as if by ES6 number to string conversion.\n\t// This matches most other JSON generators.\n\t// See golang.or...
[ "0.65956736", "0.6579867", "0.6558691", "0.65093964", "0.65093964", "0.65063524", "0.650568", "0.64860725", "0.6472506", "0.6472506", "0.64466476", "0.6419214", "0.64064884", "0.6404155", "0.635647", "0.634441", "0.634441", "0.634441", "0.6337444", "0.63315827", "0.6314135", ...
0.6945493
0
/ arithmetic Add sets f = x + y and returns f.
func (f *Float) Add(x, y *Float) *Float { x.doinit() y.doinit() f.doinit() C.mpf_add(&f.i[0], &x.i[0], &y.i[0]) return f }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func add(x float64,y float64) float64 {\n\treturn x+y\n}", "func Add(a, b float64) float64 {\n\treturn a + b\n}", "func Add(a, b float64) float64 {\n\treturn a + b\n}", "func add(a, b float64) float64 {\n\treturn a + b\n}", "func Add(a, operand int) int { return operand + a }", "func add(x, y int) int", ...
[ "0.7967935", "0.76371825", "0.76371825", "0.7627444", "0.75677687", "0.75675243", "0.7549034", "0.74975514", "0.74299216", "0.7355206", "0.73051083", "0.7287217", "0.72291017", "0.7136642", "0.7128363", "0.70719063", "0.7069406", "0.70386505", "0.70386505", "0.70386505", "0.7...
0.74483913
8
Sub sets f = x y and returns f.
func (f *Float) Sub(x, y *Float) *Float { x.doinit() y.doinit() f.doinit() C.mpf_sub(&f.i[0], &x.i[0], &y.i[0]) return f }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func Sub(z, x, y *Elt)", "func NewFSub(x, y value.Value) *InstFSub {\n\tinst := &InstFSub{X: x, Y: y}\n\t// Compute type.\n\tinst.Type()\n\treturn inst\n}", "func (z *Float64) Sub(x, y *Float64) *Float64 {\n\tz.l = x.l - y.l\n\tz.r = x.r - y.r\n\treturn z\n}", "func (f Fixed) Sub(f0 Fixed) Fixed {\n\t// chec...
[ "0.6267633", "0.6262958", "0.60346556", "0.60049045", "0.58804756", "0.5805987", "0.5785991", "0.57449687", "0.57377446", "0.5732393", "0.56620836", "0.56524175", "0.5648059", "0.5624236", "0.56200045", "0.5591251", "0.5587664", "0.55750287", "0.5564602", "0.55540264", "0.554...
0.698774
0
Mul sets f = x y and returns f.
func (f *Float) Mul(x, y *Float) *Float { x.doinit() y.doinit() f.doinit() C.mpf_mul(&f.i[0], &x.i[0], &y.i[0]) return f }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func (z *Float64) Mul(x, y *Float64) *Float64 {\n\ta := (x.l * y.l) + (y.r * x.r)\n\tb := (x.r * y.l) + (y.r * x.l)\n\tz.SetPair(a, b)\n\treturn z\n}", "func feMul(out *fieldElement, a *fieldElement, b *fieldElement)", "func (z *Float) Mul(x, y *Float) *Float {\n\t// possible: panic(ErrNaN{\"multiplication of ...
[ "0.7242088", "0.7237525", "0.70135707", "0.68834496", "0.6832727", "0.68206954", "0.6773969", "0.6773326", "0.67665404", "0.67589134", "0.6689138", "0.666826", "0.66305107", "0.6610131", "0.65832794", "0.6563603", "0.65572894", "0.6524023", "0.64834917", "0.6467111", "0.64605...
0.7852031
0
Div sets f = x / y and returns f.
func (f *Float) Div(x, y *Float) *Float { x.doinit() y.doinit() f.doinit() C.mpf_div(&f.i[0], &x.i[0], &y.i[0]) return f }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func Div(x, y int) int {\n\treturn x / y\n}", "func Divide(x, y int) float64 {\n\treturn float64(x) / float64(y)\n}", "func Command_Div(script *rex.Script, params []*rex.Value) {\n\tif len(params) != 2 {\n\t\trex.ErrorParamCount(\"float:div\", \"2\")\n\t}\n\n\tscript.RetVal = rex.NewValueFloat64(params[0].Floa...
[ "0.79124904", "0.78728545", "0.7719235", "0.75640553", "0.75489855", "0.74454725", "0.74383354", "0.73700964", "0.7330844", "0.73209095", "0.7217562", "0.7189715", "0.7181681", "0.7181149", "0.7108846", "0.7078168", "0.7078131", "0.7065987", "0.70544964", "0.7045082", "0.7041...
0.8076266
0
Sqrt sets f = Sqrt(x) and returns f.
func (f *Float) Sqrt(x *Float) *Float { x.doinit() f.doinit() C.mpf_sqrt(&f.i[0], &x.i[0]) return f }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func Sqrt (x float64) float64 {\n \n // Find the whole number sqrt.\n wholeSqrt := newtonSqrtFunc ( x, 0.0, x / 2.0, 1.0 )\n\n // Find one decimal point sqrt.\n return newtonSqrtFunc ( x, wholeSqrt, wholeSqrt + 1, 0.01 )\n}", "func Sqrt(f float64) (float64, error) {\n\tif f < 0 {\n\t\terr := fmt.Errorf...
[ "0.8192842", "0.8122174", "0.8062811", "0.7846377", "0.780029", "0.7689977", "0.76817685", "0.7642759", "0.75944746", "0.75353956", "0.7508509", "0.75048697", "0.74791354", "0.7394101", "0.7389043", "0.73785484", "0.73684794", "0.73366386", "0.72748697", "0.716924", "0.711529...
0.82109225
0
Sqrt sets f = Sqrt(x) and returns f.
func (f *Float) SqrtUint(x uint) *Float { f.doinit() C.mpf_sqrt_ui(&f.i[0], C.ulong(x)) return f }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func (f *Float) Sqrt(x *Float) *Float {\n\tx.doinit()\n\tf.doinit()\n\tC.mpf_sqrt(&f.i[0], &x.i[0])\n\treturn f\n}", "func Sqrt (x float64) float64 {\n \n // Find the whole number sqrt.\n wholeSqrt := newtonSqrtFunc ( x, 0.0, x / 2.0, 1.0 )\n\n // Find one decimal point sqrt.\n return newtonSqrtFunc ( ...
[ "0.82116866", "0.81932026", "0.81228065", "0.80636847", "0.7846808", "0.78012145", "0.76899713", "0.7682792", "0.76436603", "0.7594672", "0.7536022", "0.75082505", "0.7503974", "0.7479533", "0.73938805", "0.7388377", "0.7379374", "0.73684496", "0.73365545", "0.72757626", "0.7...
0.5946472
59
PowUint sets f = x^y and returns f
func (f *Float) PowUint(x *Float, y uint) *Float { x.doinit() f.doinit() C.mpf_pow_ui(&f.i[0], &x.i[0], C.ulong(y)) return f }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func op_f64_pow(expr *CXExpression, fp int) {\n\tinp1, inp2, out1 := expr.Inputs[0], expr.Inputs[1], expr.Outputs[0]\n\toutB1 := FromF64(math.Pow(ReadF64(fp, inp1), ReadF64(fp, inp2)))\n\tWriteMemory(GetFinalOffset(fp, out1), outB1)\n}", "func myPow(x float64, n int) float64 {\n\t// 位运算\n\tif n < 0 {\n\t\treturn...
[ "0.6557375", "0.6482305", "0.63670856", "0.63278854", "0.6317327", "0.6217253", "0.62000436", "0.6197121", "0.61934346", "0.6190206", "0.6171746", "0.6134147", "0.60823005", "0.6079171", "0.607424", "0.6004703", "0.5967984", "0.59644586", "0.59597284", "0.5933642", "0.5871316...
0.77589846
0
Neg sets z = x and returns z.
func (f *Float) Neg(x *Float) *Float { x.doinit() f.doinit() C.mpf_neg(&f.i[0], &x.i[0]) return f }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func (z *Float) Neg(x *Float) *Float {}", "func (z *Int) Neg(x *Int) *Int {}", "func FloatNeg(z *big.Float, x *big.Float,) *big.Float", "func Neg(z, x *big.Int) *big.Int {\n\treturn z.Neg(x)\n}", "func RatNeg(z *big.Rat, x *big.Rat,) *big.Rat", "func IntNeg(z *big.Int, x *big.Int,) *big.Int", "func (z ...
[ "0.70397466", "0.68391883", "0.68231684", "0.68089503", "0.67907923", "0.66292834", "0.6527284", "0.6376841", "0.637109", "0.6245375", "0.6165066", "0.614053", "0.61075044", "0.60329115", "0.60075355", "0.59974027", "0.5924085", "0.5875914", "0.5742674", "0.57280576", "0.5708...
0.5860258
18
Abs sets z to the absolute value of x and returns z.
func (f *Float) Abs(x *Float) *Float { x.doinit() f.doinit() C.mpf_abs(&f.i[0], &x.i[0]) return f }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func (z *Float) Abs(x *Float) *Float {}", "func Abs(z, x *big.Int) *big.Int {\n\treturn z.Abs(x)\n}", "func (z *Int) Abs(x *Int) *Int {}", "func mathAbs(ctx phpv.Context, args []*phpv.ZVal) (*phpv.ZVal, error) {\n\tvar z *phpv.ZVal\n\t_, err := core.Expand(ctx, args, &z)\n\tif err != nil {\n\t\treturn nil, e...
[ "0.7644353", "0.7523543", "0.73883647", "0.72751004", "0.71887064", "0.71763027", "0.71428514", "0.71421164", "0.707127", "0.7015231", "0.6962811", "0.685001", "0.6846319", "0.6827062", "0.67869586", "0.67869586", "0.67869586", "0.67869586", "0.67869586", "0.67869586", "0.678...
0.669533
26
Mul2Exp sets z = x 2^s and returns z.
func (f *Float) Mul2Exp(x *Float, s uint) *Float { x.doinit() f.doinit() C.mpf_mul_2exp(&f.i[0], &x.i[0], C.mp_bitcnt_t(s)) return f }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func (z *Int) Exp(x, y, m *Int) *Int {}", "func mathExp(ctx phpv.Context, args []*phpv.ZVal) (*phpv.ZVal, error) {\n\tvar x phpv.ZFloat\n\t_, err := core.Expand(ctx, args, &x)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn phpv.ZFloat(math.Exp(float64(x))).ZVal(), nil\n}", "func Exp(z, n *inf.Dec, s ...
[ "0.69238585", "0.65481603", "0.65338546", "0.6463379", "0.64598817", "0.6399806", "0.63596535", "0.628247", "0.6246554", "0.619069", "0.61777186", "0.6069037", "0.59977776", "0.5917513", "0.5910885", "0.59044635", "0.58424276", "0.5786833", "0.57340926", "0.57008433", "0.5681...
0.7422884
0
Div2Exp sets z = x / 2^s and returns z.
func (f *Float) Div2Exp(x *Float, s uint) *Float { x.doinit() f.doinit() C.mpf_div_2exp(&f.i[0], &x.i[0], C.mp_bitcnt_t(s)) return f }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func Exp(z, n *inf.Dec, s inf.Scale) *inf.Dec {\n\ts += 2\n\tnn := new(inf.Dec).Set(n)\n\tif z == nil {\n\t\tz = new(inf.Dec)\n\t\tz.SetUnscaled(1).SetScale(0)\n\t} else {\n\t\tz.SetUnscaled(1).SetScale(0)\n\t}\n\n\t// We are computing (e^n) by splitting n into an integer and a float\n\t// (e.g 3.1 ==> x = 3, y = ...
[ "0.6256803", "0.6164883", "0.60691875", "0.5726555", "0.56809974", "0.565142", "0.56230205", "0.5584276", "0.5552816", "0.5491405", "0.5465571", "0.54105353", "0.54019284", "0.53735286", "0.5363632", "0.53507364", "0.5349359", "0.5349359", "0.532853", "0.53251326", "0.5295690...
0.7626231
0
/ Comparison Compute the relative difference between x and y and store the result in f. This is abs(xy)/x.
func (f *Float) RelDiff(x, y *Float) *Float { x.doinit() y.doinit() f.doinit() C.mpf_reldiff(&f.i[0], &x.i[0], &y.i[0]) return f }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func absDiff(n1, n2 uint64) uint64 {\n\tif n1 > n2 {\n\t\treturn n1 - n2\n\t}\n\treturn n2 - n1\n}", "func (p *Point) Abs() float64 {\n return math.Sqrt(p.x*p.x + p.y*p.y)\n}", "func (z *Float) Abs(x *Float) *Float {}", "func Abs(x complex64) float32 { return math.Hypot(real(x), imag(x)) }", "func AbsFu...
[ "0.6083901", "0.59977025", "0.59358484", "0.5763372", "0.5717833", "0.5673883", "0.5666816", "0.56356215", "0.5601598", "0.55985016", "0.5585404", "0.55707586", "0.55367625", "0.55085105", "0.5495551", "0.54949224", "0.5470612", "0.545898", "0.545098", "0.54323566", "0.537846...
0.55767435
11
Return +1 if f > 0, 0 if f = 0, and 1 if f < 0.
func (f *Float) Sgn() int { f.doinit() //TODO(ug): mpf_sgn seems to be implemented as a macro. // We need to watch out for changes in the data structure :( //return int(C.mpf_sgn(&f.i[0])) switch size := int(f.i[0]._mp_size); { case size < 0: return -1 case size == 0: return 0 } return 1 }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func t1f0(b bool) int {\n\tif b {\n\t\treturn 1\n\t}\n\treturn 0\n}", "func AboveF(x, y float64, f F) int {\n\tif y > f(x) { // f(x) = x\n\t\treturn 1\n\t}\n\treturn -1\n}", "func (t *Temp) F() int {\n\ttemp := math.Floor(float64(*t)*9/5) + 32\n\tif temp < 0 {\n\t\treturn int(temp - 1.0)\n\t}\n\treturn int(tem...
[ "0.6618394", "0.62952524", "0.6096461", "0.60724866", "0.5979072", "0.59191996", "0.5756444", "0.5693603", "0.5639355", "0.55662197", "0.5492212", "0.5492212", "0.54896545", "0.54896545", "0.54799294", "0.5469861", "0.54470783", "0.5429988", "0.5426492", "0.5424216", "0.54157...
0.0
-1
/ functions without a clear receiver CmpInt compares x and y. The result is neg if x y
func CmpFloat(x, y *Float) int { x.doinit() y.doinit() return int(C.mpf_cmp(&x.i[0], &y.i[0])) }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func (x *Int) CmpAbs(y *Int) int {}", "func IntCmpAbs(x *big.Int, y *big.Int,) int", "func (x *Big) CmpAbs(y *Big) int { return cmp(x, y, true) }", "func (x *Big) Cmp(y *Big) int { return cmp(x, y, false) }", "func Cmp(x, y *big.Int) (r int) {\n\treturn x.Cmp(y)\n}", "func (z *Int) Cmp(x *Int) (r int) {\...
[ "0.770354", "0.7621232", "0.7522347", "0.7501192", "0.7309876", "0.72745657", "0.7223764", "0.70979446", "0.6983283", "0.6981077", "0.6704626", "0.6575595", "0.65167606", "0.65059507", "0.64709187", "0.6445613", "0.6368948", "0.6341175", "0.6333125", "0.63149065", "0.6293435"...
0.58192104
55
Return nonzero if the first n bits of x and y are equal, zero otherwise. I.e., test if x and y are approximately equal.
func EqFloat(x, y *Float, n uint) int { x.doinit() y.doinit() return int(C.mpf_eq(&x.i[0], &y.i[0], C.mp_bitcnt_t(n))) }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func memequal(x, y unsafe.Pointer, n uintptr) bool {\n\tfor i := uintptr(0); i < n; i++ {\n\t\tcx := *(*uint8)(unsafe.Add(x, i))\n\t\tcy := *(*uint8)(unsafe.Add(y, i))\n\t\tif cx != cy {\n\t\t\treturn false\n\t\t}\n\t}\n\treturn true\n}", "func equal(x, y float32, tol float64) bool {\n\tavg := (math.Abs(float64(...
[ "0.62950265", "0.59465885", "0.573208", "0.57100964", "0.5673684", "0.56506", "0.55964243", "0.55394477", "0.5519098", "0.55159", "0.54428744", "0.5416352", "0.5402936", "0.53944963", "0.53224736", "0.5307622", "0.5297659", "0.52871966", "0.5282103", "0.5270515", "0.5265801",...
0.5231511
23
Sets f = Ceil(x) and returns f.
func (f *Float) Ceil(x *Float) *Float { x.doinit() f.doinit() C.mpf_ceil(&f.i[0], &x.i[0]) return f }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func Ceil(x float64) float64 {\n\n\treturn math.Ceil(x)\n}", "func Ceil(arg float64) float64 {\n\treturn math.Ceil(arg)\n}", "func Ceil(scope *Scope, x tf.Output) (y tf.Output) {\n\tif scope.Err() != nil {\n\t\treturn\n\t}\n\topspec := tf.OpSpec{\n\t\tType: \"Ceil\",\n\t\tInput: []tf.Input{\n\t\t\tx,\n\t\t},\n...
[ "0.8501541", "0.8011263", "0.769773", "0.74975675", "0.71446115", "0.70501745", "0.69955975", "0.6909984", "0.6885982", "0.6835996", "0.6835996", "0.68304205", "0.673312", "0.6672578", "0.64298874", "0.6390639", "0.63456494", "0.61852944", "0.61362666", "0.61188453", "0.60660...
0.84958863
1
Sets f = Floor(x) and returns f.
func (f *Float) Floor(x *Float) *Float { x.doinit() f.doinit() C.mpf_floor(&f.i[0], &x.i[0]) return f }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func Floor(x float64) float64 {\n\n\treturn math.Floor(x)\n}", "func Floor(arg float64) float64 {\n\treturn math.Floor(arg)\n}", "func Floor(x float64, unit float64) float64 {\n\tif IsZero(unit) {\n\t\treturn x\n\t}\n\n\tunits := int64((x + unit*e) / unit)\n\treturn float64(units) * unit\n}", "func Floor(sco...
[ "0.8016191", "0.77603114", "0.73603815", "0.7285953", "0.70936745", "0.6759427", "0.66098326", "0.6581992", "0.65784335", "0.65784335", "0.6554434", "0.65519273", "0.65097517", "0.62348694", "0.62232935", "0.61974365", "0.6182518", "0.6132632", "0.60743606", "0.6069187", "0.6...
0.80533195
0
Sets f = Trunc(x) (=round towards zero) and returns f.
func (f *Float) Trunc(x *Float) *Float { x.doinit() f.doinit() C.mpf_trunc(&f.i[0], &x.i[0]) return f }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func Trunc(val value.Value) (value.Value, error) {\n\te := &eval{}\n\tif isTrue(e.binary(val, \">=\", zero)) {\n\t\tval = e.unary(\"floor\", val)\n\t} else {\n\t\tval = e.unary(\"ceil\", val)\n\t}\n\treturn val, e.err\n}", "func (c *Clac) Trunc() error {\n\treturn c.applyFloat(1, func(vals []value.Value) (value....
[ "0.6883881", "0.6752622", "0.6596779", "0.64890045", "0.6346826", "0.61972183", "0.60241574", "0.59341407", "0.5816053", "0.5804506", "0.5782765", "0.57764965", "0.57527107", "0.5731127", "0.56980056", "0.5691231", "0.56818634", "0.5680122", "0.5662104", "0.5647177", "0.56287...
0.761743
0
The Listener should retry temporary errors with an increasing delay.
func TestAcceptRetryTemporary(t *testing.T) { listener := &testutils.MockListener{ AcceptFunc: func(i int) (net.Conn, error) { if i < 10 { return nil, testutils.ErrTemporaryTrue } return nil, io.EOF }, } server := &RetryServer{ Listener: listener, } ctx, cancel := context.WithTimeout(context.Background(), 5*time.Second) defer cancel() start := time.Now() if err := server.Serve(ctx); errors.Cause(err) != io.EOF { t.Errorf("want io.EOF, got %v", err) } // retried 10 times for temporary errors, so the delays should be: want := (5 + 10 + 20 + 40 + 80 + 160 + 320 + 640 + 1000 + 1000) * time.Millisecond got := time.Since(start) if got < want || got > (want+(100*time.Millisecond)) { t.Errorf("want duration of %v, got %v", want, got) } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func Retry(ctx context.Context, times int, delay time.Duration, callback func() error) error {\n\t// Retries n-1 times and ignores failures. Only return early on success.\n\tfor i := 1; (i < times || times < 0) && ctx.Err() == nil; i++ {\n\t\tif err := callback(); err == nil {\n\t\t\treturn nil\n\t\t}\n\n\t\ttime....
[ "0.68277216", "0.6768451", "0.6706438", "0.66753125", "0.6575402", "0.6514941", "0.6486158", "0.6458446", "0.6405864", "0.6381166", "0.6366619", "0.63600683", "0.63133097", "0.63061404", "0.6272777", "0.62650234", "0.62281406", "0.6171663", "0.6145626", "0.6100342", "0.607155...
0.60170877
22
The Listener should reset the temporary error retry delay after a successful Accept.
func TestAcceptRetryTemporaryReset(t *testing.T) { // the accepted connection conn := &testutils.MockConn{} // the listener that fails with temporary errors, accepts one, // and fails again with temporary errors to check the reset // of the temporary errors delay listener := &testutils.MockListener{ AcceptFunc: func(i int) (net.Conn, error) { if i < 5 { return nil, testutils.ErrTemporaryTrue } if i == 5 { return conn, nil } if i < 10 { return nil, testutils.ErrTemporaryTrue } return nil, io.EOF }, } server := &RetryServer{ Listener: listener, Dispatch: nopDispatch, } ctx, cancel := context.WithTimeout(context.Background(), 5*time.Second) defer cancel() start := time.Now() if err := server.Serve(ctx); errors.Cause(err) != io.EOF { t.Errorf("want io.EOF, got %v", err) } // retried 5 times for temporary errors: firstDelay := (5 + 10 + 20 + 40 + 80) * time.Millisecond // then 4 more times after a delay reset: secondDelay := (5 + 10 + 20 + 40) * time.Millisecond want := firstDelay + secondDelay got := time.Since(start) if got < want || got > (want+(100*time.Millisecond)) { t.Errorf("want duration of %v, got %v", want, got) } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func TestAcceptRetryTemporary(t *testing.T) {\n\tlistener := &testutils.MockListener{\n\t\tAcceptFunc: func(i int) (net.Conn, error) {\n\t\t\tif i < 10 {\n\t\t\t\treturn nil, testutils.ErrTemporaryTrue\n\t\t\t}\n\t\t\treturn nil, io.EOF\n\t\t},\n\t}\n\tserver := &RetryServer{\n\t\tListener: listener,\n\t}\n\n\tctx...
[ "0.6866933", "0.63390505", "0.56829476", "0.5668464", "0.5609332", "0.5565546", "0.5492204", "0.54844296", "0.5472082", "0.54632837", "0.5270904", "0.52657753", "0.5260115", "0.52480096", "0.5239857", "0.52050614", "0.5151372", "0.512247", "0.511887", "0.5107964", "0.50983125...
0.73579
0
The Listener should not retry when an error that implements Temporary returns false.
func TestNoRetryTemporaryFalse(t *testing.T) { listener := &testutils.MockListener{ AcceptFunc: func(i int) (net.Conn, error) { return nil, testutils.ErrTemporaryFalse }, } server := &RetryServer{ Listener: listener, } ctx, cancel := context.WithTimeout(context.Background(), 5*time.Second) defer cancel() start := time.Now() if err := server.Serve(ctx); errors.Cause(err) != testutils.ErrTemporaryFalse { t.Errorf("want %v, got %v", testutils.ErrTemporaryFalse, err) } // error was a Temporary, but it returned false, so there should // be no delay got := time.Since(start) want := time.Duration(0) if got < want || got > (want+(10*time.Millisecond)) { t.Errorf("want duration of %v, got %v", want, got) } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func (l *LimitListenerError) Temporary() bool { return true }", "func (e ConnectionError) Temporary() bool {\n\treturn e.temp\n}", "func (e *PermissionDeniedError) Temporary() bool { return false }", "func (e ServerError) Temporary() bool {\n\treturn e.Temp\n}", "func RetryTemporaryErr() RetryFn {\n\tretur...
[ "0.8034603", "0.70338243", "0.69231135", "0.6838257", "0.665663", "0.62476057", "0.62250614", "0.6198555", "0.6165185", "0.6073955", "0.5963366", "0.5962527", "0.5839882", "0.5811964", "0.573165", "0.57295585", "0.5715857", "0.571197", "0.5633609", "0.5528219", "0.5498165", ...
0.6746394
4
Test if direct connections are working Should catch issue 11 if it occurs again (shared memory issue related to the d cmd line option)
func TestDirectConnectionFlags(t *testing.T) { // Test with the equivalent of a single IP address in the -d arg: -d 1.2.3.4 gDirects = "1.2.3.4" dirFuncs := buildDirectors(gDirects) director = getDirector(dirFuncs) ipv4 := "1.2.3.4" wentDirect,_ := director(ipv4) if wentDirect == false { t.Errorf("The IP address %s should have been sent direct, but instead was proxied", ipv4) } // now make sure an address that should be proxied still works ipv4 = "4.5.6.7" wentDirect,_ = director(ipv4) if wentDirect == true { t.Errorf("The IP address %s should have been sent to an upstream proxy, but instead was sent directly", ipv4) } // Test with the equivalent of a multiple IP addresses in the -d arg: -d 1.2.3.4,2.3.4.5 gDirects = "1.2.3.4,2.3.4.5" dirFuncs = buildDirectors(gDirects) director = getDirector(dirFuncs) addrsToTest := []string{"1.2.3.4", "2.3.4.5"} for _,ipv4 = range addrsToTest { wentDirect,_ := director(ipv4) if wentDirect == false { t.Errorf("The IP address %s should have been sent direct, but instead was proxied", ipv4) } } // now make sure an address that should be proxied still works ipv4 = "4.5.6.7" wentDirect,_ = director(ipv4) if wentDirect == true { t.Errorf("The IP address %s should have been sent to an upstream proxy, but instead was sent directly", ipv4) } // Test with the equivalent of multiple IP address specs in the -d arg: -d 1.2.3.0/24,2.3.4.0/25,4.4.4.4" gDirects = "1.2.3.0/24,2.3.4.0/25,4.4.4.4" dirFuncs = buildDirectors(gDirects) director = getDirector(dirFuncs) addrsToTest = []string{"1.2.3.4", "1.2.3.254", "2.3.4.5", "4.4.4.4"} for _,ipv4 = range addrsToTest { wentDirect,_ := director(ipv4) if wentDirect == false { t.Errorf("The IP address %s should have been sent direct, but instead was proxied", ipv4) } } // now make sure an address that should be proxied still works addrsToTest = []string{"4.5.6.7", "2.3.4.254"} for _,ipv4 = range addrsToTest { wentDirect,_ = director(ipv4) if wentDirect == true { t.Errorf("The IP address %s should have been sent to an upstream proxy, but instead was sent directly", ipv4) } } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func checkRemoteConnection(serverAddr string) error {\n\n\tlog.Println(\"Connecting to sync server at\", serverAddr)\n\n\tconn := getRemoteConnection(serverAddr, false)\n\tif conn == nil {\n\t\treturn errors.New(\"Cannot connect to sync server: \" + serverAddr)\n\t}\n\n\terr := tcpSend(conn, \"Test\\n\")\n\tif err...
[ "0.5719911", "0.5579039", "0.5447892", "0.54441476", "0.54162276", "0.5408427", "0.53732985", "0.5372884", "0.53711975", "0.5371107", "0.53546524", "0.53487414", "0.5346884", "0.5346569", "0.53373927", "0.5304313", "0.5296097", "0.5289066", "0.5278121", "0.52619994", "0.52480...
0.5379685
6
RemoveDuplicateTags removes duplicate tags from a given TagInformation slice. This should be used whenever joining two slices of TagInformation. Duplicate tags do not work well in queries Example, without this, if a user searched "test" and their account had a global filter of "test", the SQL query would look for two instances of "test" This does not work as an image should only have 1 instance of the tag. This situation returns empty results.
func RemoveDuplicateTags(ToFilter []TagInformation) []TagInformation { //Rules: //We do not care about meta-tags //Exlusionary tags win for Index := 0; Index < len(ToFilter); Index++ { if ToFilter[Index].IsMeta { continue //Skip Metatags } //Standard tag confirmed, scan for duplicates for ScanIndex := 0; ScanIndex < len(ToFilter); ScanIndex++ { if Index == ScanIndex || ToFilter[ScanIndex].IsMeta { continue //Skip comparing same entry, or meta tags } if ToFilter[ScanIndex].ID == ToFilter[Index].ID { var ToRemove int if ToFilter[ScanIndex].Exclude { //Duplicate found is an exclusionary, so remove Index ToRemove = Index } else { //Duplicate found is not exclusion, so remove ScanIndex ToRemove = ScanIndex } //Remove and resize ToFilter = append(ToFilter[:ToRemove], ToFilter[ToRemove+1:]...) if ToRemove < Index { //If we removed something before the index, then continue scan but decrement the current scan state Index-- ScanIndex-- } else if ToRemove == Index { //If we removed the current index, the decrement index, and start a new duplicate scan from whatever is there now Index-- break } else { //Finally, the third potential, is we removed an element ahead of Index, in which case, we just need to continue current scan from the same ScanIndex ScanIndex-- } } } } return ToFilter }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func MergeTagSlices(Original []TagInformation, ToAdd []TagInformation) []TagInformation {\n\t//Rules:\n\t//We do not care about meta-tags\n\t//Tags in ToAdd win\n\t//Exlusionary tags win after tags in ToAdd\n\n\t//First, remove duplicates from original that exist in ToAdd\n\tfor Index := 0; Index < len(ToAdd); Ind...
[ "0.59109527", "0.56092", "0.5491012", "0.54465884", "0.5343873", "0.5339732", "0.533238", "0.5323964", "0.52986306", "0.5292384", "0.52786636", "0.52354336", "0.52228713", "0.5214944", "0.5178673", "0.5165382", "0.515019", "0.51287717", "0.5090348", "0.50570637", "0.50495213"...
0.6923226
0
MergeTagSlices merges two tag slices, the second slice will always win for duplicates.
func MergeTagSlices(Original []TagInformation, ToAdd []TagInformation) []TagInformation { //Rules: //We do not care about meta-tags //Tags in ToAdd win //Exlusionary tags win after tags in ToAdd //First, remove duplicates from original that exist in ToAdd for Index := 0; Index < len(ToAdd); Index++ { if ToAdd[Index].IsMeta { continue //Skip Metatags } //Standard tag confirmed, scan for duplicates for ScanIndex := 0; ScanIndex < len(Original); ScanIndex++ { if Original[ScanIndex].IsMeta { continue //Skip comparing metas } if Original[ScanIndex].ID == ToAdd[Index].ID { //Remove and resize Original = append(Original[:ScanIndex], Original[ScanIndex+1:]...) //we just need to continue current scan from the same ScanIndex ScanIndex-- } } } //Now we can fall back to RemoveDuplicateTags to cleanup any other issues return RemoveDuplicateTags(append(Original, ToAdd...)) }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func mergeTags(t1, t2 []Tag) []Tag {\n\tn := len(t1) + len(t2)\n\tif n == 0 {\n\t\treturn nil\n\t}\n\n\tout := make([]Tag, 0, n)\n\tout = append(out, t1...)\n\tout = append(out, t2...)\n\n\treturn SortTags(out)\n}", "func MergeIndexedSlices(first *IndexedSlices, second *IndexedSlices) (*IndexedSlices, error) {\n...
[ "0.6697766", "0.63986164", "0.6325036", "0.61794055", "0.58035576", "0.57719207", "0.5753241", "0.5650223", "0.5627464", "0.55612606", "0.55480397", "0.55223817", "0.54399157", "0.5435634", "0.54297525", "0.54236025", "0.5373789", "0.5337852", "0.5319766", "0.52526253", "0.52...
0.7504278
0
EntryPoint prints the JSON encoded "message" field in the body of the request or "Hello, World!" if there isn't one.
func EntryPoint(w http.ResponseWriter, r *http.Request) { wrapper = gcfwrapper.NewHandlerWrapper(handler) wrapper.Invoke(w, r) }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func HelloWorld(w http.ResponseWriter, r *http.Request) {\n\t//var request Request\n\tw.Header().Set(\"Content-type\", \"application/json\")\n\tb, e := ioutil.ReadAll(r.Body)\n\tif e != nil {\n\t\tlog.Printf(\"failed to read message body: %s\\n\", string(b))\n\t} else {\n\t\tlog.Printf(\"Request: %v\\n\", r)\n\t\t...
[ "0.65936047", "0.6513117", "0.60155326", "0.59812725", "0.59812725", "0.59500444", "0.59330726", "0.588853", "0.5832086", "0.5804987", "0.5777812", "0.57744193", "0.5772562", "0.5761742", "0.5758667", "0.5758592", "0.5755917", "0.5744784", "0.57439697", "0.5724101", "0.570171...
0.0
-1
Keyword search for query
func KeywordSearch(t *testing.T, url string) (statusCode int, respBody []byte, err error) { respStatusCode, respBody, _ := GetResponseByGet(t, url) return respStatusCode, respBody, nil }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func (s *searcher) Keyword(resp http.ResponseWriter, req *http.Request) {\n\tsearchTerms := mux.Vars(req)\n\n\tkey := searchTerms[\"keyword\"]\n\tif len(key) == 0 {\n\t\tresp.WriteHeader(http.StatusBadRequest)\n\t\tresp.Write([]byte(\"keyword is empty\"))\n\t\treturn\n\t}\n\n\tsearchPaths, err := s.searchIndex.Get...
[ "0.68664324", "0.65711457", "0.6463986", "0.63684005", "0.62309265", "0.62161654", "0.6216017", "0.6215795", "0.6185327", "0.6165908", "0.6134163", "0.6068138", "0.60465544", "0.60407466", "0.6025517", "0.59997404", "0.5947016", "0.5932199", "0.5921371", "0.5891525", "0.58710...
0.6602142
1
Qsl search for query
func QslSearch(t *testing.T, url string) (statusCode int, respBody []byte, err error) { respStatusCode, respBody, _ := GetResponseByGet(t, url) return respStatusCode, respBody, nil }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func (e Es) Query(index string, doc string, query string) (*SearchResult, error) {\n\tif doc != \"\" {\n\t\tdoc = \"/\" + doc\n\t}\n\tbody, err := e.getJSONWithBody(fmt.Sprintf(\"%s%s/_search\", index, doc), query)\n\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\terr = checkError(body)\n\tif err != nil {\n\t\tr...
[ "0.6138766", "0.604938", "0.601861", "0.600036", "0.5928968", "0.59144706", "0.591273", "0.58491576", "0.5792729", "0.57911587", "0.5764687", "0.57633936", "0.5754494", "0.57411283", "0.57293004", "0.5727549", "0.5724083", "0.57128096", "0.5706809", "0.5685744", "0.5671263", ...
0.6407892
0
Test keyword search query
func TestKeywordSearch(t *testing.T) { testURL1 := TestBaseURL + "/v1/query?keyword=node01" testURL2 := TestBaseURL + "/v1/query?keyword=node02" tests := []TestStruct{ {"TestKeywordSearchNode01", testURL1, "", 200, "", 0}, {"TestKeywordSearchNode02", testURL2, "", 200, "", 0}, } for i, testCase := range tests { t.Run(testCase.testCaseName, func(t *testing.T) { resCode, resBody, _ := KeywordSearch(t, testCase.testURL) tests[i].observedStatusCode = resCode tests[i].responseBody = string(resBody) }) } DisplayTestCaseResults("TestKeywordSearch", tests, t, "uid") }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func KeywordSearch(t *testing.T, url string) (statusCode int, respBody []byte, err error) {\n\n\trespStatusCode, respBody, _ := GetResponseByGet(t, url)\n\treturn respStatusCode, respBody, nil\n}", "func main() {\n // perform the search for the specified term\n search.Run(\"president\")\n}", "func verify...
[ "0.66071653", "0.6170704", "0.6104493", "0.6101992", "0.6071285", "0.6054238", "0.5773076", "0.5768604", "0.576822", "0.5691482", "0.566482", "0.56577206", "0.5652532", "0.5647406", "0.56422365", "0.56411195", "0.56259054", "0.56133455", "0.55830723", "0.5568", "0.5545437", ...
0.70359737
0
Test Qsl search query
func TestQslSearch(t *testing.T) { if testing.Short() { t.Skip("skipping TestQSLSearch in short mode") } testURL1 := TestBaseURL + "/v1/qsl/node[@name=\"node01\"]{*}" testURL2 := TestBaseURL + "/v1/qsl/node[@name=\"node01\"]{@labels}" tests := []TestStruct{ {"TestSearchNode01All", testURL1, "", 200, "", 0}, {"TestSearchNode01@labels", testURL2, "", 200, "", 0}, } for i, testCase := range tests { t.Run(testCase.testCaseName, func(t *testing.T) { resCode, resBody, _ := QslSearch(t, testCase.testURL) tests[i].observedStatusCode = resCode tests[i].responseBody = string(resBody) }) } DisplayTestCaseResults("TestQslSearch", tests, t, "uid") }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func TestSingleQuerySearch(t *testing.T) {\n\tfor _, tItem := range testData {\n\t\tsq := NewSingleQuery(tItem.query, tItem.links)\n\t\trealFind, err := sq.QuerySearch()\n\t\tif err != nil {\n\t\t\tt.Errorf(\"Can't make test, too much errors, %v\", err)\n\t\t}\n\t\tif len(realFind) != len(tItem.results) {\n\t\t\tt...
[ "0.69777787", "0.6884206", "0.6431281", "0.6417766", "0.63961565", "0.63852024", "0.63790214", "0.6338699", "0.6240596", "0.6002227", "0.5930339", "0.5895522", "0.5894307", "0.5869451", "0.5833881", "0.5830371", "0.58204687", "0.58136594", "0.5799873", "0.5759508", "0.5738569...
0.71631724
0
FormatDate allows to format a date
func FormatDate(timestamp int64, format string) (ret string) { return time.Unix(timestamp, 0).Format(format) }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func formatDate(dt string) string {\n\tcreated := util.ParseDate(dt)\n\treturn util.ShortDate(created)\n}", "func (l *Locale) FormatDate(date dates.Date) string {\n\treturn date.Format(l.DateFormatGo)\n}", "func FormatDate(date time.Time, format string) string {\n\treturn date.Format(GoDateFormat.ConvertFormat...
[ "0.77035767", "0.7593242", "0.737696", "0.70825374", "0.7080672", "0.6974435", "0.6932567", "0.6813397", "0.6752936", "0.66994", "0.6661946", "0.6613706", "0.66062963", "0.65696746", "0.65205055", "0.64974093", "0.64957494", "0.6490634", "0.6482056", "0.64758694", "0.6347279"...
0.70353514
5
GenerateTimestampArray allows to generate a Timestamp array
func GenerateTimestampArray(startTS, endTS int64) (tsArray []int64) { daysNbr := (endTS - startTS) / (24 * 3600) var i int64 for i = 0; i <= daysNbr; i++ { tsArray = append(tsArray, startTS+(i*24*3600)) } return tsArray }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func funcTimestamp(vals []parser.Value, args parser.Expressions, enh *EvalNodeHelper) Vector {\n\tvec := vals[0].(Vector)\n\tfor _, el := range vec {\n\t\tenh.Out = append(enh.Out, Sample{\n\t\t\tMetric: enh.DropMetricName(el.Metric),\n\t\t\tF: float64(el.T) / 1000,\n\t\t})\n\t}\n\treturn enh.Out\n}", "func...
[ "0.57288086", "0.56269246", "0.54959416", "0.54605746", "0.53964067", "0.5373701", "0.51312923", "0.51274085", "0.5120402", "0.5048022", "0.5006886", "0.4996967", "0.4996967", "0.49909705", "0.4914925", "0.48994032", "0.4887998", "0.48787725", "0.4842352", "0.48110104", "0.48...
0.80039763
0
New returns a new API instance
func New(db *gorm.DB, sk []byte) *API { return &API{ db: db, signingKey: sk, } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func New(config Config) API {\n\treturn API{\n\t\tClient: &http.Client{},\n\t\tConfig: config,\n\t}\n}", "func New() *Client {\n return &Client{&API{}}\n}", "func New(token string) *API {\n\treturn &API{\n\t\tToken: token,\n\t\thasHandlers: false,\n\t}\n}", "func New(store *store.Store) *API {\n\tretu...
[ "0.80026454", "0.7932077", "0.7789743", "0.7778875", "0.75076175", "0.7499507", "0.7496682", "0.74856347", "0.7431801", "0.74166846", "0.7409888", "0.73943573", "0.737375", "0.73692584", "0.7359781", "0.73595965", "0.7352775", "0.72696215", "0.7268841", "0.72380674", "0.72303...
0.7073902
29
initialising ledger only for the purpose for testing
func (s *SmartContract) initLedger(stub shim.ChaincodeStubInterface) sc.Response { fmt.Println("Initalising ledger") chainkeys := []ChainKey{ ChainKey{DocumentID: "doc1", Glue: "glue1", TypeofDocument: "type1"}, ChainKey{DocumentID: "doc2", Glue: "glue2", TypeofDocument: "type2"}, } m := 0 for m < len(chainkeys) { var chainkeysoutput = chainkeys[m] chainkeyAsBytes, _ := json.Marshal(&chainkeysoutput) stub.PutState(strconv.Itoa(m+1), chainkeyAsBytes) fmt.Println("Added", chainkeys[m]) m = m + 1 } return shim.Success(nil) }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func (s *SmartContract) initLedger(APIstub shim.ChaincodeStubInterface) sc.Response {\n\tsows := Seed()\n\n\ti := 0\n\tfor i < len(sows) {\n\t\tfmt.Println(\"i is \", i)\n\t\tsowAsBytes, _ := json.Marshal(sows[i])\n\t\tAPIstub.PutState(strconv.Itoa(i+1), sowAsBytes)\n\t\tfmt.Println(\"Added\", sows[i])\n\t\ti = i ...
[ "0.64609367", "0.6379083", "0.61684555", "0.6036796", "0.60276127", "0.592862", "0.59110194", "0.58765537", "0.578348", "0.57605267", "0.57214904", "0.57147855", "0.57132983", "0.5698132", "0.5693315", "0.56478274", "0.563379", "0.5599969", "0.5591508", "0.55846596", "0.55382...
0.6434343
1
Invoke function every time it is called, will check for the function name and arguments
func (s *SmartContract) Invoke(stub shim.ChaincodeStubInterface) sc.Response { functionname, args := stub.GetFunctionAndParameters() if functionname == "queryChainKey" { return s.queryChainKey(stub, args) } else if functionname == "listChainKeys" { return s.listChainKeys(stub) } else if functionname == "recordChainKeys" { fmt.Println("Recording hash...") return s.recordChainKey(stub, args) } else { fmt.Println("Invalid function name") } return shim.Success(nil) }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func (s serviceInjector) invoke(f interface{}) {\n\tif reflect.TypeOf(f).Kind() != reflect.Func {\n\t\t// log and return to prevent panic.\n\t\tlog.println(\"Cannot invoke non function type\")\n\t\treturn\n\t}\n\n\targs := make([]reflect.Value, reflect.TypeOf(f).NumIn())\n\tfor i := range args {\n\t\targType := re...
[ "0.6102791", "0.60882974", "0.6087396", "0.60806614", "0.5991795", "0.5937325", "0.59235984", "0.583569", "0.57939386", "0.57595676", "0.568628", "0.5680504", "0.5663626", "0.5642256", "0.5628663", "0.5583273", "0.55821997", "0.5576378", "0.5569307", "0.5553335", "0.55462575"...
0.0
-1
ListAssets list all the asset info
func (s *SmartContract) listChainKeys(stub shim.ChaincodeStubInterface) sc.Response { startKey := "0" endKey := "999999" resultsIterator, err := stub.GetStateByRange(startKey, endKey) if err != nil { return shim.Error(err.Error()) } defer resultsIterator.Close() var buffer bytes.Buffer buffer.WriteString("[") bArrayMemberAlreadyWritten := false for resultsIterator.HasNext() { queryResponse, err := resultsIterator.Next() fmt.Printf("We are trying to print raw data") fmt.Printf(string(queryResponse.Value)) if err != nil { return shim.Error(err.Error()) } // Add comma before array members, supress it for first array memeber if bArrayMemberAlreadyWritten == true { buffer.WriteString(",") } buffer.WriteString("{\"Key\":") buffer.WriteString("\"") buffer.WriteString(queryResponse.Key) buffer.WriteString("\"") buffer.WriteString(",\"Record\":") // Record is a JSON object so we can re-write it as buffer.WriteString(string(queryResponse.Value)) buffer.WriteString("}") bArrayMemberAlreadyWritten = true } buffer.WriteString("]") fmt.Printf("List of Contracts: \n%s \n", buffer.String()) return shim.Success(buffer.Bytes()) }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func (c *Client) ListAssets(ctx context.Context, params *ListAssetsInput, optFns ...func(*Options)) (*ListAssetsOutput, error) {\n\tif params == nil {\n\t\tparams = &ListAssetsInput{}\n\t}\n\n\tresult, metadata, err := c.invokeOperation(ctx, \"ListAssets\", params, optFns, addOperationListAssetsMiddlewares)\n\tif ...
[ "0.77385956", "0.71977293", "0.7003934", "0.69405365", "0.6897018", "0.6713528", "0.6625661", "0.6573197", "0.65269643", "0.64813304", "0.6282726", "0.6277639", "0.6145498", "0.61368686", "0.61199135", "0.60988086", "0.60627794", "0.60368675", "0.6010009", "0.59603494", "0.59...
0.0
-1
Query Contract Info query for specifc constract based on "contract ID"
func (s *SmartContract) queryChainKey(stub shim.ChaincodeStubInterface, args []string) sc.Response { if len(args) != 1 { shim.Error("Incorrect number of arguments, Expecting 1") } chainkeyAsBytes, _ := stub.GetState(args[0]) data := string(chainkeyAsBytes) fmt.Println("Returning list of Asset %s args[0]", data) if chainkeyAsBytes == nil { return shim.Error("could not locate Asset") } return shim.Success(chainkeyAsBytes) }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func (m *GraphBaseServiceClient) ContractsById(id string)(*i86bb3d05e1a6bbdb496bd3c65829f1a6eb272be42e9ac6060f873dfbd921e4ea.ContractItemRequestBuilder) {\n urlTplParams := make(map[string]string)\n for idx, item := range m.pathParameters {\n urlTplParams[idx] = item\n }\n if id != \"\" {\n ...
[ "0.6856409", "0.6856409", "0.6512866", "0.6367733", "0.63621235", "0.62733585", "0.61768806", "0.60842663", "0.6040407", "0.59892803", "0.59584016", "0.58886546", "0.585087", "0.585087", "0.58067006", "0.5770851", "0.5765875", "0.57581973", "0.57526016", "0.5746037", "0.57426...
0.0
-1
whenAll wrapps multiple dependencies in a single dependency the result is completed once any dependency completes with an error or once all dependencies ran to completion without error
func whenAll(dependencies []dependency) dependency { completionSource := &completionSource{ done: make(chan struct{}), } go func() { defer close(completionSource.done) cases := make([]reflect.SelectCase, len(dependencies)) for ix, dependency := range dependencies { cases[ix] = reflect.SelectCase{ Chan: reflect.ValueOf(dependency.Done()), Dir: reflect.SelectRecv, } } for len(dependencies) > 0 { ix, _, _ := reflect.Select(cases) if err := dependencies[ix].Err(); err != nil { completionSource.err = err return } cases = append(cases[:ix], cases[ix+1:]...) dependencies = append(dependencies[:ix], dependencies[ix+1:]...) } }() return completionSource }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func (m *manager) BuildAll(options BuildOptions) error {\n\tif m.config == nil || m.config.Dependencies == nil || len(m.config.Dependencies) == 0 {\n\t\treturn nil\n\t}\n\n\t// Resolve all dependencies\n\tdependencies, err := m.resolver.Resolve(options.UpdateDependencies)\n\tif err != nil {\n\t\tif _, ok := err.(*...
[ "0.66200477", "0.6336258", "0.63357496", "0.6108432", "0.6054186", "0.59423923", "0.5868885", "0.5806676", "0.58031505", "0.5698449", "0.5670537", "0.56573665", "0.5622649", "0.5605129", "0.56030434", "0.5568432", "0.55593777", "0.55325687", "0.55232847", "0.5516108", "0.5502...
0.7441156
0
then schedules a continuation task once the current promise is completed. It propagates errors and returns a promise wrapping the continuation
func (p promise) then(next func(ctx context.Context) error) promise { completionSource := &completionSource{ done: make(chan struct{}), } go func() { defer close(completionSource.done) select { case <-p.Done(): if err := p.Err(); err != nil { completionSource.err = err return } completionSource.err = p.scheduler.schedule(next).wait() } }() return newPromise(p.scheduler, completionSource) }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func (t *task) ContinueWith(ctx context.Context, nextAction func(interface{}, error) (interface{}, error)) Task {\n\treturn Invoke(ctx, func(context.Context) (interface{}, error) {\n\t\tresult, err := t.Outcome()\n\t\treturn nextAction(result, err)\n\t})\n}", "func scheduleAndUnwrap(scheduler scheduler, do func(...
[ "0.5967946", "0.5652337", "0.51454914", "0.49167585", "0.46889892", "0.4573429", "0.45607483", "0.45377755", "0.4515407", "0.451423", "0.45088065", "0.44017607", "0.43697917", "0.43436313", "0.43295616", "0.43257138", "0.43245524", "0.43183896", "0.4303881", "0.42900497", "0....
0.6183229
0
newPromise creates a promise out of a dependency
func newPromise(scheduler scheduler, dependency dependency) promise { return promise{scheduler: scheduler, dependency: dependency} }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func NewPromise() Promise {\n\treturn &promise{sync.Mutex{}, make(chan error), nil, nil, false}\n}", "func NewPromise() Controller {\n\treturn &promise{}\n}", "func New(executor func(resolve func(interface{}), reject func(error))) *Promise {\n\tvar wg = &sync.WaitGroup{}\n\twg.Add(1)\n\n\tvar promise = &Promis...
[ "0.6707661", "0.6399388", "0.62243986", "0.5719654", "0.57112944", "0.569883", "0.5536393", "0.54549676", "0.5106503", "0.50471157", "0.4955386", "0.49389923", "0.49148178", "0.4825148", "0.47839233", "0.47563744", "0.47542834", "0.4734377", "0.47324514", "0.47285217", "0.472...
0.7905479
0
this schedule a task that itself produces a promise, and returns a promise wrapping the produced promise
func scheduleAndUnwrap(scheduler scheduler, do func(ctx context.Context) (dependency, error)) promise { completionSource := &completionSource{ done: make(chan struct{}), } scheduler.schedule(func(ctx context.Context) error { p, err := do(ctx) if err != nil { completionSource.err = err close(completionSource.done) return err } go func() { <-p.Done() completionSource.err = p.Err() close(completionSource.done) }() return nil }) return newPromise(scheduler, completionSource) }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func (c *Client) Schedule(task func()) error {\n\treturn c.schedule(task, time.After(time.Millisecond*time.Duration(c.config.ScheduleTimeout)))\n}", "func (p *Pool) Schedule(ctx context.Context, task Task) error {\n\tif err := p.isShutdown(); err != nil {\n\t\treturn err\n\t}\n\n\tp.wg.Add(1)\n\tt := &taskWrappe...
[ "0.568033", "0.5663514", "0.5390931", "0.5377433", "0.5376653", "0.5373549", "0.530876", "0.5240457", "0.5236986", "0.5222145", "0.5202381", "0.51956177", "0.51495916", "0.51294845", "0.51087207", "0.4980702", "0.49798384", "0.49532995", "0.49486306", "0.4946619", "0.49363613...
0.57963973
0
Validate validates this alertable event type
func (m *AlertableEventType) Validate(formats strfmt.Registry) error { var res []error if err := m.validateCategory(formats); err != nil { res = append(res, err) } if err := m.validateScope(formats); err != nil { res = append(res, err) } if len(res) > 0 { return errors.CompositeValidationError(res...) } return nil }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func (e EEventType) Validate() error {\n switch e {\n case EV_UNKNOWN,EV_BASE,EV_SCRIPT,EV_PERL,EV_BIN,EV_URL,EV_RESULT,EV_WORKER_DONE,EV_COMMAND,EV_REPLY,EV_ERROR:\n return nil\n default:\n return e // error condition - Error() can be invoked on it\n } // switch\n}", "func ValidateEvent(e...
[ "0.6919185", "0.6831296", "0.6831296", "0.65781534", "0.65171707", "0.6481075", "0.64781845", "0.64412445", "0.6433073", "0.6406382", "0.639938", "0.6387393", "0.6375404", "0.63410616", "0.63037986", "0.6226541", "0.6155873", "0.61534274", "0.61494", "0.6147093", "0.6144208",...
0.7226454
0
IsNotEmpty is opposite of IsEmpty
func (t TaskConfig) IsNotEmpty() bool { return !t.IsEmpty() }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func (v *verifier) IsntEmpty() *verifier {\n\treturn v.addVerification(\"IsntEmpty\", len(v.Query) > 0)\n}", "func NotEmpty(t TestingT, v interface{}, extras ...interface{}) bool {\n\tif IsEmpty(v) {\n\t\tvar acts = \"<nil>\"\n\t\tif v != nil {\n\t\t\t_, acts = toString(reflect.Zero(reflect.TypeOf(v)).Interface(...
[ "0.7095644", "0.6989157", "0.6904628", "0.6900285", "0.68758434", "0.6797596", "0.6718309", "0.67140394", "0.670319", "0.6691976", "0.6631811", "0.65983003", "0.65076244", "0.6428794", "0.6414994", "0.6411841", "0.6410642", "0.63930225", "0.63840735", "0.63830507", "0.6381610...
0.62008446
33
IsEmpty checks whether taskConfig has all it's fields declared properly or not.
func (t TaskConfig) IsEmpty() bool { return t == TaskConfig{} || t.DbURL == "" || t.DbType == "" }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func (t TaskConfig) IsNotEmpty() bool {\n\treturn !t.IsEmpty()\n}", "func (mgc Config) Empty() bool {\n\treturn mgc.AuthDB == \"\" &&\n\t\tmgc.DB == \"\" &&\n\t\tmgc.User == \"\" &&\n\t\tmgc.Password == \"\" &&\n\t\tmgc.Host == \"\"\n}", "func (c *ProjectConfig) NotEmpty() bool {\n\tif err := c.ValidateConfigV...
[ "0.73253053", "0.6467472", "0.6240094", "0.6214254", "0.61029774", "0.6024805", "0.5966716", "0.5957692", "0.5953141", "0.5941145", "0.59353834", "0.58855903", "0.5875147", "0.5855564", "0.5855564", "0.58349985", "0.5823399", "0.58164424", "0.5781391", "0.5777357", "0.577365"...
0.74826217
0
TaskConfiguration returns configuration properties related to task server, which includes db details.
func TaskConfiguration() TaskConfig { return conf.TaskConfig }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func (j *AuroraJob) TaskConfig() *aurora.TaskConfig {\n\treturn j.jobConfig.TaskConfig\n}", "func (task *QueueTask) GetConfig() *TaskConfig {\n\treturn &TaskConfig{\n\t\tTaskID: task.taskID,\n\t\tTaskType: task.TaskType,\n\t\tIsRun: task.IsRun,\n\t\tHandler: task.handler,\n\t\tDueTime: task.DueTime,\n\t\t...
[ "0.69888526", "0.6583979", "0.63950527", "0.62126625", "0.5957827", "0.5939605", "0.5886146", "0.5611155", "0.55858016", "0.55705434", "0.55193114", "0.55012417", "0.54126394", "0.5408065", "0.535299", "0.53333354", "0.5309216", "0.5296257", "0.52802205", "0.52377206", "0.522...
0.7348872
0
initialize is there so I can test it. I don't know how to call init function in a test module
func initialize(configFile string) config { initconfigDefaults() file, err := os.Open(configFile) if err != nil { log.Fatal("Could not open file. Error: ", err) } defer file.Close() decoder := json.NewDecoder(file) var conf config err = decoder.Decode(&conf) if err != nil { log.Fatal("Error parsing json file: ", err) } log.Printf("%+v", conf) return conf }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func init() {\n\tSetup()\n}", "func init() {\n\t//todo...\n}", "func init() {\n\ttestEnv.Init()\n}", "func init() {\n\t// init func\n}", "func (tr *TestRecorder) init() {}", "func init() {\n\t// Initialization goes here\n}", "func (_m *ITestCase) Initialize() {\n\t_m.Called()\n}", "func init() {\n\te...
[ "0.74532074", "0.736351", "0.73337364", "0.728336", "0.72765374", "0.72619545", "0.7138286", "0.7018304", "0.7000266", "0.69807744", "0.69807744", "0.69807744", "0.69807744", "0.69329756", "0.69187003", "0.68334943", "0.6805433", "0.6791608", "0.67723465", "0.67653495", "0.67...
0.0
-1
token access token from your setting owner kprc repo libgithub filePath github.go
func NewGithubClient(token, owner, repo, filePath, name, email string) *GithubClient { gc := &GithubClient{} gc.repo.Path = filePath gc.repo.Owner = owner gc.repo.Token = token gc.repo.Repository = repo gc.repo.Name = name gc.repo.Email = email return gc }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func Github(config *Config) negroni.Handler {\n\tauthUrl := \"https://github.com/login/oauth/authorize\"\n\ttokenUrl := \"https://github.com/login/oauth/access_token\"\n\treturn NewOAuth2Provider(config, authUrl, tokenUrl)\n}", "func getGitHubAccessToken(w http.ResponseWriter, r *http.Request) {\n\t// Use the bu...
[ "0.6926365", "0.6888876", "0.68840504", "0.68218505", "0.67986596", "0.67840654", "0.6685321", "0.65503144", "0.6367943", "0.6264993", "0.6239146", "0.6184883", "0.6083913", "0.60298496", "0.5991672", "0.5988337", "0.59841824", "0.59677136", "0.5953569", "0.594627", "0.591512...
0.0
-1
NewSSHClientConfig returns client configuration for SSH client
func NewSSHClientConfig(user, keyFile, passworkPhrase string) (*SSHClient, error) { publicKeyMenthod, err := publicKey(keyFile, passworkPhrase) if err != nil { return nil, err } sshConfig := &ssh.ClientConfig{ User: user, Auth: []ssh.AuthMethod{ publicKeyMenthod, }, HostKeyCallback: ssh.InsecureIgnoreHostKey(), } return &SSHClient{ config: sshConfig, }, nil }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func newSSHClientConfig(host string, section *SSHConfigFileSection, userName, identity string, agentForwarding bool) (*sshClientConfig, error) {\n\tvar (\n\t\tconfig *sshClientConfig\n\t\terr error\n\t)\n\n\tif section != nil {\n\t\tupdateFromSSHConfigFile(section, &host, &userName, &agentForwarding)\n\t}\n\n\t...
[ "0.7974541", "0.76709026", "0.74759793", "0.74258846", "0.740708", "0.70316577", "0.70175177", "0.6997534", "0.6675493", "0.6624891", "0.65838957", "0.64609164", "0.64464515", "0.6420268", "0.6418195", "0.6396556", "0.6309854", "0.6309701", "0.6296322", "0.6200176", "0.619442...
0.78421795
1
Connect connects to a node
func (c *SSHClient) Connect(host, port string) error { client, err := ssh.Dial("tcp", fmt.Sprintf("%s:%s", host, port), c.config) if err != nil { return err } c.client = client return nil }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func (n *Node) connect(prev *NodeConn, next *NodeConn) {\n\tif prev != nil {\n\t\tn.prev = prev.GetAsPrev()\n\t}\n\tif next != nil {\n\t\tn.next = next.GetAsNext()\n\t}\n}", "func (n *Node) connect(entryPoint *peer.Peer) *NodeErr {\n\t// Create the request using a connection message.\n\tmsg := new(message.Messag...
[ "0.7134823", "0.71036583", "0.70709467", "0.701372", "0.694743", "0.6918052", "0.6916342", "0.6830966", "0.6783872", "0.6662454", "0.664807", "0.65543544", "0.6520157", "0.6450232", "0.6439325", "0.64195156", "0.64188206", "0.64151967", "0.6402267", "0.6389926", "0.63792276",...
0.0
-1
Close close the client connection
func (c *SSHClient) Close() error { if c.client != nil { return c.client.Close() } return nil }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func (c *client) Close() error { return c.c.Close() }", "func (c *Client) Close() {}", "func (c *Client) Close() {}", "func (self *Client) close() {\n\t// TODO: Cleanly close connection to remote\n}", "func Close() {\n\t_ = client.Close()\n}", "func (t *Client) Close() error { return nil }", "func (c...
[ "0.80864036", "0.8026612", "0.8026612", "0.7616278", "0.76097316", "0.760942", "0.76005685", "0.76005685", "0.7594441", "0.7532879", "0.75005835", "0.7498882", "0.7497349", "0.7496725", "0.74757004", "0.73832446", "0.7379111", "0.7366358", "0.73495543", "0.7339546", "0.733954...
0.0
-1
ExecuteBatch execute bach commands
func (c *SSHClient) ExecuteBatch(commands []string, prependSudo bool) error { fmt.Printf("**** Host: %s ****\n", c.client.RemoteAddr().String()) for _, cmd := range commands { fmt.Printf("** Execute command: %s **\n", cmd) stdout, stderr, err := c.ExecuteOne(cmd, prependSudo) if err != nil { return err } if len(stdout) > 0 { fmt.Println(stdout) } if len(stderr) > 0 { fmt.Printf("Error: %s\n", stderr) } fmt.Println() } return nil }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func (_BaseContentSpace *BaseContentSpaceTransactor) ExecuteBatch(opts *bind.TransactOpts, _v []uint8, _r [][32]byte, _s [][32]byte, _from []common.Address, _dest []common.Address, _value []*big.Int, _ts []*big.Int) (*types.Transaction, error) {\n\treturn _BaseContentSpace.contract.Transact(opts, \"executeBatch\",...
[ "0.7461896", "0.6927233", "0.6790663", "0.66519415", "0.66327494", "0.6507953", "0.6506933", "0.61729884", "0.60851747", "0.60139984", "0.5971583", "0.59487164", "0.59240067", "0.58766514", "0.5826821", "0.58085674", "0.57520205", "0.5663675", "0.5636446", "0.55858546", "0.55...
0.70663935
1
ExecuteOne executes one command
func (c *SSHClient) ExecuteOne(cmd string, prependSudo bool) (stdout, stderr string, err error) { sess, err := c.client.NewSession() if err != nil { return "", "", err } defer sess.Close() var stdoutBuf, stderrBuf bytes.Buffer sess.Stdout = &stdoutBuf sess.Stderr = &stderrBuf if prependSudo { cmd = "sudo " + cmd } _ = sess.Run(cmd) return strings.TrimSuffix(stdoutBuf.String(), "\n"), strings.TrimSuffix(stderrBuf.String(), "\n"), nil }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func (db *DB) ExecOne(query interface{}, params ...interface{}) (orm.Result, error) {\n\tvar res orm.Result\n\tvar err error\n\ttracing.Trace(db.inner.Context(), query, func() error {\n\t\tif db.tx != nil {\n\t\t\tres, err = db.tx.ExecOne(query, params...)\n\t\t} else {\n\t\t\tres, err = db.inner.ExecOne(query, pa...
[ "0.6417966", "0.62714285", "0.62215585", "0.6218935", "0.5858726", "0.58008915", "0.57972324", "0.5787274", "0.57263637", "0.57106155", "0.570076", "0.56657094", "0.56507236", "0.5638959", "0.56331456", "0.56312007", "0.5628031", "0.5628031", "0.56041235", "0.5584877", "0.557...
0.6677467
0
IndexHandler will display the dashboard index page.
func IndexHandler(w http.ResponseWriter, r *http.Request) { t, _ := template.ParseFiles("templates/index.html") t.Execute(w, nil) }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func (s *Server) handleDashboardIndex() http.HandlerFunc {\n\tvar o sync.Once\n\tvar tpl *template.Template\n\treturn func(w http.ResponseWriter, r *http.Request) {\n\t\tctx, _ := GetLogger(s.getCtx(r))\n\t\to.Do(func() {\n\t\t\ttpl = s.loadWebTemplateDashboard(ctx, \"index.html\")\n\t\t})\n\t\tctx, _, data, _, ok...
[ "0.7760034", "0.76683986", "0.75975424", "0.75413775", "0.74673474", "0.7349284", "0.7347763", "0.7347707", "0.7242819", "0.72414005", "0.7207527", "0.7190968", "0.7164695", "0.71461844", "0.71338624", "0.7117082", "0.71014875", "0.7094759", "0.70911527", "0.7070288", "0.7063...
0.6962567
24
NewServicesHandler creates a new handler to return all specs.
func NewServicesHandler(storage storage.Storage) func(w http.ResponseWriter, r *http.Request) { return func(w http.ResponseWriter, r *http.Request) { specs, err := storage.GetSpecs() if err != nil { http.Error(w, fmt.Sprintf("Error getting the specs from the storage %s", err), http.StatusInternalServerError) return } json, err := json.Marshal(specs) if err != nil { http.Error(w, fmt.Sprintf("Error converting the specs to json %s", err), http.StatusInternalServerError) return } w.Header().Set("Content-Type", "application/json") w.Write(json) } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func NewHandlers() *Handlers {\n\thandlers := new(Handlers)\n\thandlers.services = services.GetServices()\n\n\treturn handlers\n}", "func NewHandler(ctx context.Context, endpoint string) (Handler, error) {\n\tif len(endpoint) == 0 {\n\t\treturn nil, errors.New(\"endpoint is empty\")\n\t}\n\n\t// Get the client\n...
[ "0.6721812", "0.6599959", "0.6413891", "0.6336606", "0.6182184", "0.6086837", "0.6082766", "0.6016732", "0.6008815", "0.5951964", "0.59366834", "0.5931475", "0.5915596", "0.5904584", "0.58656454", "0.58620006", "0.5828751", "0.5819641", "0.5806342", "0.58059764", "0.5799651",...
0.8023489
0
NewRPCHandler creates a new handler to return all specs.
func (h *Handler) NewRPCHandler() func(w http.ResponseWriter, r *http.Request) { return func(w http.ResponseWriter, r *http.Request) { serviceName := r.PostFormValue("service") procedure := r.PostFormValue("procedure") contentType := r.PostFormValue("contentType") timeout, _ := strconv.Atoi(r.PostFormValue("timeout")) body := r.PostFormValue("body") client, err := h.getClient(serviceName) if err != nil { http.Error(w, fmt.Sprintf("Error creating porthos client %s", err), http.StatusInternalServerError) return } fmt.Printf("RPC Call to Service %s, Procedure: %s, ContentType: %s", serviceName, procedure, contentType) // call the remote method. response, err := client.Call(procedure). WithTimeout(time.Duration(timeout)*time.Second). WithBodyContentType([]byte(body), contentType). Sync() if err != nil { http.Error(w, fmt.Sprintf("Error performing rpc request %s", err), http.StatusInternalServerError) return } var responseBody interface{} if response.ContentType == "application/json" { response.UnmarshalJSONTo(&responseBody) } else { responseBody = string(response.Content) } json, err := json.Marshal(responseToClient{ StatusCode: response.StatusCode, ContentType: response.ContentType, Body: responseBody, }) if err != nil { http.Error(w, fmt.Sprintf("Error converting the response to json %s", err), http.StatusInternalServerError) return } w.Header().Set("Content-Type", "application/json") w.Write(json) } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func NewRPCHandler(svc types.TokenAuthService) *RPCHandler {\n\treturn &RPCHandler{\n\t\tTokenAuthService: svc,\n\t}\n}", "func NewJSONRPCHandler(srvcs ...interface{}) (http.Handler, error) {\n\ts := rpc.NewServer()\n\tfor _, srvc := range srvcs {\n\t\tif err := s.Register(srvc); err != nil {\n\t\t\treturn nil, ...
[ "0.6624874", "0.6024355", "0.60056865", "0.5885711", "0.5836768", "0.5812805", "0.565157", "0.56228626", "0.5593738", "0.5576329", "0.5565163", "0.55630046", "0.55559325", "0.55379814", "0.5532266", "0.54911023", "0.5426775", "0.5399525", "0.53904694", "0.5378297", "0.5348006...
0.680906
0
Initialize TodoServer and create a gin router
func NewTodoServer(store store.TodoStore) *TodoServer { t := new(TodoServer) t.Store = store t.Router = gin.Default() // Project routes t.Router.GET("/projects/:projectName", t.GetProject) t.Router.POST("/projects/", t.PostProject) t.Router.GET("/projects/", t.GetAllProjects) t.Router.PUT("/projects/:projectName", t.PutProject) t.Router.DELETE("/projects/:projectName", t.DeleteProject) t.Router.DELETE("/projects/:projectName/archive", t.ArchiveProject) t.Router.PUT("/projects/:projectName/archive", t.ArchiveProject) // Task routes t.Router.POST("projects/:projectName/tasks", t.PostTask) t.Router.GET("projects/:projectName/tasks/:taskName", t.GetTask) t.Router.GET("projects/:projectName/tasks", t.GetAllTasks) t.Router.PUT("projects/:projectName/tasks/:taskName", t.PutTask) t.Router.DELETE("projects/:projectName/tasks/:taskName", t.DeleteTask) t.Router.PUT("/projects/:projectName/tasks/:taskName/complete", t.CompleteTask) t.Router.DELETE("/projects/:projectName/tasks/:taskName/complete", t.CompleteTask) return t }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func SetupRouter() *gin.Engine {\n\tr := gin.Default()\n\tgrp1 := r.Group(\"/todolist\")\n\t{\n\t\tgrp1.GET(\"task\", controllers.GetAllTasks)\n\t\tgrp1.POST(\"task\", controllers.CreateTask)\n\t\tgrp1.GET(\"task/:id\", controllers.GetTaskByID)\n\t\t//grp1.GET(\"task/:taskstatus\", controllers.GetTaskByTaskstatus)...
[ "0.6595298", "0.63818014", "0.6340252", "0.62490946", "0.62086403", "0.61790615", "0.61502844", "0.6100632", "0.60779506", "0.6065625", "0.6063386", "0.60569364", "0.6050148", "0.59734654", "0.59687996", "0.5968583", "0.5963439", "0.5859406", "0.5857695", "0.58399206", "0.583...
0.6418594
1
NewDataCollectionEndpointsClient creates a new instance of DataCollectionEndpointsClient with the specified values.
func NewDataCollectionEndpointsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) *DataCollectionEndpointsClient { cp := arm.ClientOptions{} if options != nil { cp = *options } if len(cp.Host) == 0 { cp.Host = arm.AzurePublicCloud } return &DataCollectionEndpointsClient{subscriptionID: subscriptionID, ep: string(cp.Host), pl: armruntime.NewPipeline(module, version, credential, &cp)} }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func NewDataCollectionEndpointsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) *DataCollectionEndpointsClient {\n\tcp := arm.ClientOptions{}\n\tif options != nil {\n\t\tcp = *options\n\t}\n\tif len(cp.Endpoint) == 0 {\n\t\tcp.Endpoint = arm.AzurePublicCloud\n\t}\n\tclie...
[ "0.78429055", "0.65928674", "0.6467306", "0.6371158", "0.6291373", "0.62236565", "0.6148884", "0.6108226", "0.6043531", "0.60381436", "0.5991876", "0.59719115", "0.59348714", "0.59159476", "0.5858524", "0.5855671", "0.5831717", "0.5796945", "0.57908535", "0.5731177", "0.57162...
0.7870675
0
createCreateRequest creates the Create request.
func (client *DataCollectionEndpointsClient) createCreateRequest(ctx context.Context, resourceGroupName string, dataCollectionEndpointName string, options *DataCollectionEndpointsCreateOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/dataCollectionEndpoints/{dataCollectionEndpointName}" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") } urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) if resourceGroupName == "" { return nil, errors.New("parameter resourceGroupName cannot be empty") } urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) if dataCollectionEndpointName == "" { return nil, errors.New("parameter dataCollectionEndpointName cannot be empty") } urlPath = strings.ReplaceAll(urlPath, "{dataCollectionEndpointName}", url.PathEscape(dataCollectionEndpointName)) req, err := runtime.NewRequest(ctx, http.MethodPut, runtime.JoinPaths(client.ep, urlPath)) if err != nil { return nil, err } reqQP := req.Raw().URL.Query() reqQP.Set("api-version", "2021-04-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") if options != nil && options.Body != nil { return req, runtime.MarshalAsJSON(req, *options.Body) } return req, nil }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func CreateCreateMeetingRequest() (request *CreateMeetingRequest) {\n\trequest = &CreateMeetingRequest{\n\t\tRpcRequest: &requests.RpcRequest{},\n\t}\n\trequest.InitWithApiInfo(\"aliyuncvc\", \"2019-10-30\", \"CreateMeeting\", \"aliyuncvc\", \"openAPI\")\n\trequest.Method = requests.POST\n\treturn\n}", "func (st...
[ "0.7329779", "0.730704", "0.72980714", "0.7263738", "0.7198085", "0.70716137", "0.7015523", "0.6991702", "0.6976075", "0.6943447", "0.69323164", "0.69315296", "0.6915802", "0.68712103", "0.68649644", "0.6860991", "0.68590456", "0.6847388", "0.6846189", "0.684217", "0.6842087"...
0.0
-1
createHandleResponse handles the Create response.
func (client *DataCollectionEndpointsClient) createHandleResponse(resp *http.Response) (DataCollectionEndpointsCreateResponse, error) { result := DataCollectionEndpointsCreateResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.DataCollectionEndpointResource); err != nil { return DataCollectionEndpointsCreateResponse{}, runtime.NewResponseError(err, resp) } return result, nil }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func (client *CustomAssessmentAutomationsClient) createHandleResponse(resp *http.Response) (CustomAssessmentAutomationsCreateResponse, error) {\n\tresult := CustomAssessmentAutomationsCreateResponse{RawResponse: resp}\n\tif err := runtime.UnmarshalAsJSON(resp, &result.CustomAssessmentAutomation); err != nil {\n\t\...
[ "0.7475178", "0.74203277", "0.7417456", "0.7413159", "0.733554", "0.7333074", "0.73066825", "0.7273078", "0.7259064", "0.724303", "0.7237097", "0.7163568", "0.71246636", "0.7106025", "0.7076806", "0.7073281", "0.7029697", "0.7013574", "0.70115906", "0.69892377", "0.6987544", ...
0.7425054
1
deleteCreateRequest creates the Delete request.
func (client *DataCollectionEndpointsClient) deleteCreateRequest(ctx context.Context, resourceGroupName string, dataCollectionEndpointName string, options *DataCollectionEndpointsDeleteOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/dataCollectionEndpoints/{dataCollectionEndpointName}" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") } urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) if resourceGroupName == "" { return nil, errors.New("parameter resourceGroupName cannot be empty") } urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) if dataCollectionEndpointName == "" { return nil, errors.New("parameter dataCollectionEndpointName cannot be empty") } urlPath = strings.ReplaceAll(urlPath, "{dataCollectionEndpointName}", url.PathEscape(dataCollectionEndpointName)) req, err := runtime.NewRequest(ctx, http.MethodDelete, runtime.JoinPaths(client.ep, urlPath)) if err != nil { return nil, err } reqQP := req.Raw().URL.Query() reqQP.Set("api-version", "2021-04-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, nil }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func (client *PolicyDefinitionsClient) deleteCreateRequest(ctx context.Context, policyDefinitionName string, options *PolicyDefinitionsDeleteOptions) (*policy.Request, error) {\n\turlPath := \"/subscriptions/{subscriptionId}/providers/Microsoft.Authorization/policyDefinitions/{policyDefinitionName}\"\n\tif policyD...
[ "0.7662101", "0.7631943", "0.75835305", "0.75709915", "0.7565961", "0.7531257", "0.7528021", "0.75057954", "0.75045884", "0.74921846", "0.7492142", "0.74905294", "0.74324316", "0.74264383", "0.7417908", "0.7404551", "0.73584425", "0.7352574", "0.73422647", "0.7288418", "0.728...
0.6835256
84
getCreateRequest creates the Get request.
func (client *DataCollectionEndpointsClient) getCreateRequest(ctx context.Context, resourceGroupName string, dataCollectionEndpointName string, options *DataCollectionEndpointsGetOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/dataCollectionEndpoints/{dataCollectionEndpointName}" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") } urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) if resourceGroupName == "" { return nil, errors.New("parameter resourceGroupName cannot be empty") } urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) if dataCollectionEndpointName == "" { return nil, errors.New("parameter dataCollectionEndpointName cannot be empty") } urlPath = strings.ReplaceAll(urlPath, "{dataCollectionEndpointName}", url.PathEscape(dataCollectionEndpointName)) req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.ep, urlPath)) if err != nil { return nil, err } reqQP := req.Raw().URL.Query() reqQP.Set("api-version", "2021-04-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, nil }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func (client *UserMetricsKeysClient) getCreateRequest(ctx context.Context, options *UserMetricsKeysClientGetOptions) (*policy.Request, error) {\n\turlPath := \"/subscriptions/{subscriptionId}/providers/Microsoft.Network/trafficManagerUserMetricsKeys/default\"\n\tif client.subscriptionID == \"\" {\n\t\treturn nil, ...
[ "0.7216396", "0.7151208", "0.71419024", "0.7099855", "0.7065104", "0.70532906", "0.70396507", "0.70303977", "0.7029218", "0.7008257", "0.69958997", "0.6993072", "0.69831", "0.6982644", "0.69472474", "0.69467354", "0.69425017", "0.69257015", "0.6924219", "0.6909365", "0.690737...
0.67291504
50
getHandleResponse handles the Get response.
func (client *DataCollectionEndpointsClient) getHandleResponse(resp *http.Response) (DataCollectionEndpointsGetResponse, error) { result := DataCollectionEndpointsGetResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.DataCollectionEndpointResource); err != nil { return DataCollectionEndpointsGetResponse{}, runtime.NewResponseError(err, resp) } return result, nil }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func (client *LiveOutputsClient) getHandleResponse(resp *http.Response) (LiveOutputsClientGetResponse, error) {\n\tresult := LiveOutputsClientGetResponse{}\n\tif err := runtime.UnmarshalAsJSON(resp, &result.LiveOutput); err != nil {\n\t\treturn LiveOutputsClientGetResponse{}, err\n\t}\n\treturn result, nil\n}", ...
[ "0.7495375", "0.74194175", "0.7407496", "0.73024285", "0.7190589", "0.71616685", "0.7149459", "0.7110431", "0.7099549", "0.7077434", "0.7042537", "0.7032869", "0.7018246", "0.6996379", "0.69687", "0.6964784", "0.69636226", "0.6963067", "0.6956996", "0.69501376", "0.69401246",...
0.69436526
20
listByResourceGroupCreateRequest creates the ListByResourceGroup request.
func (client *DataCollectionEndpointsClient) listByResourceGroupCreateRequest(ctx context.Context, resourceGroupName string, options *DataCollectionEndpointsListByResourceGroupOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/dataCollectionEndpoints" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") } urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) if resourceGroupName == "" { return nil, errors.New("parameter resourceGroupName cannot be empty") } urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.ep, urlPath)) if err != nil { return nil, err } reqQP := req.Raw().URL.Query() reqQP.Set("api-version", "2021-04-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, nil }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func (client *ContainerGroupsClient) listByResourceGroupCreateRequest(ctx context.Context, resourceGroupName string, options *ContainerGroupsClientListByResourceGroupOptions) (*policy.Request, error) {\n\turlPath := \"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerI...
[ "0.80350584", "0.79768175", "0.7961", "0.7922269", "0.78695434", "0.78637654", "0.7835829", "0.7814611", "0.7784783", "0.7775852", "0.77508813", "0.7750653", "0.77481276", "0.77277696", "0.7675334", "0.7670647", "0.76439244", "0.7639712", "0.7619525", "0.7595667", "0.7573407"...
0.7746705
13
listByResourceGroupHandleResponse handles the ListByResourceGroup response.
func (client *DataCollectionEndpointsClient) listByResourceGroupHandleResponse(resp *http.Response) (DataCollectionEndpointsListByResourceGroupResponse, error) { result := DataCollectionEndpointsListByResourceGroupResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.DataCollectionEndpointResourceListResult); err != nil { return DataCollectionEndpointsListByResourceGroupResponse{}, runtime.NewResponseError(err, resp) } return result, nil }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func (client *ContainerGroupsClient) listByResourceGroupHandleResponse(resp *http.Response) (ContainerGroupsClientListByResourceGroupResponse, error) {\n\tresult := ContainerGroupsClientListByResourceGroupResponse{}\n\tif err := runtime.UnmarshalAsJSON(resp, &result.ContainerGroupListResult); err != nil {\n\t\tret...
[ "0.8217611", "0.81841654", "0.8153289", "0.8150156", "0.81417966", "0.81144166", "0.8103734", "0.8102468", "0.8097866", "0.8093908", "0.8089965", "0.8065254", "0.8055657", "0.80550915", "0.80285233", "0.80245453", "0.79413867", "0.7928573", "0.79111975", "0.78745884", "0.7870...
0.79559946
16