text stringlengths 11 6.3k | embedding listlengths 768 768 |
|---|---|
func (tc *TaskContext) ResourceGeneration(id object.ObjMetadata) int64 {
ai, found := tc.appliedResources[id]
if !found {
return 0
}
return ai.generation
} | [
-0.9274261593818665,
0.32323330640792847,
0.4295693635940552,
-0.839846670627594,
-0.28572770953178406,
-0.03498592972755432,
0.9857387542724609,
-0.1718798279762268,
0.16540175676345825,
0.4565088748931885,
0.2811237871646881,
-0.8990635871887207,
0.5641363859176636,
1.3893687725067139,
... |
func ProcessGate(g *model.Gate, actors string, groups string) (bool, error) {
for _, gt := range g.Types() {
f := gateProcessorMap[gt]
if f == nil {
return false, fmt.Errorf("could not load gate func for type: %s", gt)
}
var enabled bool
switch gt {
case model.ActorsGateType:
enabled = f(g, actors)
... | [
-0.6531574130058289,
0.4091443419456482,
0.6284335851669312,
0.1734539121389389,
-0.1058519035577774,
0.1911824345588684,
0.22296932339668274,
-0.1816047579050064,
-0.8162907958030701,
1.1823898553848267,
0.1300361305475235,
0.11326570063829422,
-1.5748590230941772,
1.4822944402694702,
0... |
func (kce *KafkaConfigExecutor) Validate(config *gateways.ConfigContext) error {
kafkaConfig, err := parseConfig(config.Data.Config)
if err != nil {
return gateways.ErrConfigParseFailed
}
if kafkaConfig == nil {
return fmt.Errorf("%+v, configuration must be non empty", gateways.ErrInvalidConfig)
}
if kafkaCon... | [
0.23693862557411194,
0.19702260196208954,
0.6575388312339783,
0.30022677779197693,
-0.42638954520225525,
-0.3870774209499359,
-0.31291744112968445,
0.29069995880126953,
-0.5087845921516418,
0.47915536165237427,
0.004404560662806034,
-0.24155130982398987,
-0.49261394143104553,
0.98719769716... |
func readByte(r io.Reader) (ret byte, err error) {
var be [1]byte
valBytes := be[0:1]
if _, err = io.ReadFull(r, valBytes); err != nil {
return 0, err
}
return valBytes[0], nil
} | [
-0.1609838306903839,
0.7179363965988159,
0.5439730286598206,
1.1327157020568848,
0.12712544202804565,
-0.16070015728473663,
0.3538256883621216,
-0.39612239599227905,
0.024668952450156212,
-0.18491725623607635,
0.6706483960151672,
0.015132983215153217,
-1.4377046823501587,
0.612026929855346... |
func readCString(r io.Reader) (s string, err error) {
var be [1]byte
charBuf := be[0:1]
var accum bytes.Buffer
for {
n, err := r.Read(charBuf)
if err != nil {
return "", err
}
// Handle the case of no error, yet no bytes were
// retrieved.
if n < 1 {
continue
}
switch charBuf[0] {
case ... | [
0.404308021068573,
0.014908360317349434,
0.5426382422447205,
0.1991090327501297,
-0.6091340780258179,
-0.007667894940823317,
0.3364575505256653,
-0.6817981004714966,
0.1531224101781845,
-0.0009959490271285176,
0.2655138373374939,
-0.3115927577018738,
0.5402624607086182,
-0.3711307644844055... |
func (s *FileService) AfterUploadFile(fileID string, meta UploadFileMeta) error {
err := s.meta.InsertFile(model.FileMeta{
FileID: bson.ObjectIdHex(fileID),
RoomID: meta.RoomID,
BucketName: "file",
FileName: meta.Name,
Size: meta.Size,
CreatedAt: meta.CreatedAt,
UserID: meta.UserID,
... | [
-0.15963304042816162,
0.06930593401193619,
0.6954283118247986,
-0.30275794863700867,
-0.05136217921972275,
0.7465308904647827,
0.30031177401542664,
0.18064402043819427,
-0.9947879314422607,
0.6588437557220459,
-0.3962234854698181,
-0.063838429749012,
-0.08659905940294266,
0.687174201011657... |
func (s *FileService) GetFileURL(fileID bson.ObjectId) (string, error) {
if ok, err := s.fileExists(fileID); !ok || err != nil {
return "", err
}
url, err := s.file.GetPresignedURL("file", fileID.Hex())
return url, err
} | [
-0.5737887024879456,
0.8645384311676025,
0.6727921962738037,
0.5666840076446533,
0.6148368716239929,
-0.12531259655952454,
-0.18311738967895508,
0.4725314974784851,
0.07920587062835693,
0.6536268591880798,
-0.02811884507536888,
-0.6668785214424133,
0.23234260082244873,
0.9437392354011536,
... |
func (s *FileService) GetRoomFileMetas(roomID bson.ObjectId) ([]model.FileMeta, error) {
metas, err := s.meta.FindFile(model.FileMetaFilter{
RoomID: roomID,
BucketName: "file",
})
return metas, err
} | [
-0.57105553150177,
-0.45385944843292236,
0.41141054034233093,
0.4775415062904358,
0.39380496740341187,
0.0024233837611973286,
-0.9777548909187317,
-0.30444812774658203,
-0.7357795238494873,
0.4049783945083618,
-0.46079856157302856,
0.9110056161880493,
0.2606019973754883,
1.0509737730026245... |
func (s *FileService) AfterUploadImage(imageFileID string, meta UploadImageMeta) error {
now := time.Now()
err := s.meta.InsertFile(model.FileMeta{
FileID: bson.ObjectIdHex(imageFileID),
RoomID: meta.RoomID,
BucketName: "image",
FileName: meta.Name,
Size: meta.Size,
CreatedAt: now,... | [
-0.5820826292037964,
-0.02268524467945099,
0.6356548070907593,
-0.38920196890830994,
-0.10835010558366776,
0.26578274369239807,
-0.003044264391064644,
0.47623103857040405,
-0.9187195897102356,
0.7667258977890015,
-0.20805230736732483,
0.006357291713356972,
0.12591251730918884,
0.7819319367... |
func (s *FileService) GetImageURLs(fileID bson.ObjectId) (img, thumb string, err error) {
metas, err := s.meta.FindFile(model.FileMetaFilter{FileID: fileID})
if err != nil {
return "", "", fmt.Errorf("error checking image file exists: %w", err)
}
if len(metas) == 0 {
return "", "", fmt.Errorf("image file doesn'... | [
-1.6086727380752563,
0.10771007835865021,
0.6160848736763,
0.27183040976524353,
0.5135054588317871,
-0.3870044946670532,
-0.013828982599079609,
0.7437248229980469,
-0.3887850344181061,
0.8396508693695068,
0.13057151436805725,
-0.19741609692573547,
0.542244553565979,
1.4352511167526245,
-... |
func (s *FileService) GetRoomImageMetas(roomID bson.ObjectId) ([]model.FileMeta, error) {
metas, err := s.meta.FindFile(model.FileMetaFilter{
RoomID: roomID,
BucketName: "image",
})
return metas, err
} | [
-1.148072361946106,
-0.3822703957557678,
0.23996956646442413,
0.4691721200942993,
0.1416075974702835,
-0.4899607300758362,
-1.0315052270889282,
-0.12515480816364288,
-0.41723397374153137,
0.6860985159873962,
-0.8028850555419922,
0.8154531121253967,
0.4612855613231659,
1.5027456283569336,
... |
func (a *Answer) DeleteUserAnswers(db *gorm.DB, uid int) (int, error) {
answers := []Answer{}
db = db.Debug().Model(&Answer{}).Where("author_id = ?", uid).Find(&answers).Delete(&answers)
if db.Error != nil {
return 0, db.Error
}
return int(db.RowsAffected), nil
} | [
-0.3000154197216034,
-0.26836755871772766,
0.39607492089271545,
0.46420586109161377,
-0.5475858449935913,
-0.17912518978118896,
1.4253296852111816,
0.014342039823532104,
0.1925187110900879,
0.08451800793409348,
0.11658484488725662,
0.01867522858083248,
-0.880275309085846,
0.339116871356964... |
func (a *Answer) DeleteQuestionAnswers(db *gorm.DB, qid int) (int, error) {
answers := []Answer{}
db = db.Debug().Model(&Answer{}).Where("question_id = ?", qid).Find(&answers).Delete(&answers)
if db.Error != nil {
return 0, db.Error
}
return int(db.RowsAffected), nil
} | [
-0.08945255726575851,
-0.426044762134552,
0.42808687686920166,
-0.13263554871082306,
-0.15529409050941467,
-0.5488700270652771,
0.205402672290802,
-0.6176196932792664,
0.2057543694972992,
0.27213403582572937,
0.13010971248149872,
-0.26011428236961365,
-1.1669259071350098,
0.439409255981445... |
func NewKerberos(db DB, log Logger, tgsSecretKey, appSecretKey string) *Kerberos {
return &Kerberos{
db,
log,
tgsSecretKey,
appSecretKey,
}
} | [
0.5984408855438232,
-0.6043028235435486,
0.30396705865859985,
0.7980871796607971,
-0.4731318950653076,
-0.5606077313423157,
-1.4127095937728882,
-0.5019257664680481,
-0.5434080958366394,
0.030312880873680115,
-0.11739327758550644,
0.5100873112678528,
-0.0679408460855484,
0.1879618316888809... |
func (k *Kerberos) Auth(username string) (*KerberosAuthResult, error) {
// find password from db
var password string
err := k.db.QueryRowContext(
dbCtx(),
"SELECT `password` FROM `user` WHERE `username`=? LIMIT 1",
username,
).Scan(&password)
switch {
case err == sql.ErrNoRows:
return nil, errUserNotExist... | [
-0.6082983016967773,
0.2123783975839615,
0.5362017750740051,
0.9236739277839661,
-1.008636713027954,
-0.20213651657104492,
0.37248289585113525,
-0.45005297660827637,
0.2500596046447754,
0.2917264699935913,
-0.3724481165409088,
-0.0007807585643604398,
-0.10937879979610443,
0.389380633831024... |
func (k *Kerberos) Grant(encTGT, appID, encAuthenticator string) (*KerberosGrantResult, error) {
tgt := &kerberosTGT{}
if err := k.decrypt(encTGT, k.tgsSecretKey, tgt); err != nil {
return nil, errTGTInvalid
}
if tgt.Expired < time.Now().Unix() {
return nil, errTGTInvalid
}
authenticator := &kerberosAuthentic... | [
-0.19506172835826874,
0.3559873104095459,
0.9594273567199707,
1.0103837251663208,
-0.8243491053581238,
0.29131966829299927,
-0.8451089859008789,
-0.025979086756706238,
0.289660781621933,
0.46125271916389465,
0.5034127831459045,
0.3290528357028961,
-0.15506139397621155,
0.6971679925918579,
... |
func (k *Kerberos) Login(encST, encAuthenticator string) (string, error) {
st := &kerberosServiceTicket{}
if err := k.decrypt(encST, k.appSecretKey, st); err != nil {
return "", errSTInvalid
}
if st.Expired < time.Now().Unix() {
return "", errSTInvalid
}
authenticator := &kerberosAuthenticator{}
if err := k... | [
-0.24984759092330933,
-0.3252485990524292,
0.6824843287467957,
0.7760269641876221,
-1.5338456630706787,
0.4320136308670044,
-0.6641134023666382,
-0.16805772483348846,
0.4051140546798706,
0.12892618775367737,
0.05019226670265198,
0.5369243025779724,
0.08064364641904831,
-0.20515967905521393... |
func (s *State) StartSimulate(actions <-chan Action) <-chan MarshalledState {
ch := make(chan MarshalledState)
go func() {
// We want to run the thing every 500 milliseconds
tick := time.NewTicker(time.Millisecond * 200)
defer tick.Stop()
for {
s.simulateTick()
if !s.diff.isEmpty() {
md, err := j... | [
-0.24989688396453857,
0.293312132358551,
0.6063194274902344,
0.7790166139602661,
-0.03259723633527756,
-0.6341388821601868,
0.14224596321582794,
-0.30525118112564087,
0.558587908744812,
-0.27727094292640686,
0.07641738653182983,
0.4641655385494232,
0.33775097131729126,
0.08585762977600098,... |
func (s *State) simulateTick() {
responses := []newStateInfo{}
deadNodes := []*growthRoot{}
// Tell each root to run until the next move operation
for root := range s.state.roots {
if root.cache != nil {
continue
}
ch, ok := root.node.Update(s.mkWorldState(root))
if !ok {
// We have to remove the nod... | [
0.2474624514579773,
0.06350341439247131,
0.8061057329177856,
0.49463996291160583,
-0.22945313155651093,
0.3276214897632599,
1.5403659343719482,
-0.11599301546812057,
0.18597257137298584,
0.39656534790992737,
-0.2793600261211395,
-0.7095440030097961,
-0.0982084721326828,
0.3461446464061737,... |
func newContextWithAuth(perms []weave.Condition) (weave.Context, x.Authenticator) {
ctx := context.Background()
// Set current block height to 100
ctx = weave.WithHeight(ctx, 100)
auth := &weavetest.CtxAuth{Key: "authKey"}
// Create a new context and add addr to the list of signers
return auth.SetConditions(ctx, ... | [
0.29102104902267456,
-0.7423738837242126,
0.28510695695877075,
0.7105168700218201,
-1.0128962993621826,
-0.18462920188903809,
0.1249164417386055,
0.3733142614364624,
1.183491826057434,
0.5961859226226807,
0.09316081553697586,
0.25900888442993164,
-0.5664653182029724,
0.46259576082229614,
... |
func getDeliveredObject(handler weave.Handler, db weave.KVStore, key []byte) (orm.Object, error) {
switch t := handler.(type) {
case CreateBlogMsgHandler:
return t.bucket.Get(db, key)
case CreatePostMsgHandler:
obj, err := t.posts.Get(db, key) // try posts first
if obj == nil {
return t.blogs.Get(db, key) /... | [
1.0957181453704834,
-0.2070707529783249,
0.9068153500556946,
0.00964966882020235,
-0.7200568914413452,
0.7299172282218933,
0.0558239109814167,
-1.038703441619873,
-0.2135893851518631,
-0.14516586065292358,
-0.6619128584861755,
0.24896188080310822,
0.13229018449783325,
0.6680470108985901,
... |
func testHandlerCheck(t *testing.T, testcases []testcase) {
for _, test := range testcases {
db := store.MemStore()
ctx, auth := newContextWithAuth(test.Perms)
// add dependencies
for _, dep := range test.Deps {
depHandler := dep.Handler(auth)
_, err := depHandler.Deliver(ctx, db, &weavetest.Tx{Msg: dep... | [
-0.02759108878672123,
-0.19798745214939117,
0.645388126373291,
-0.07505446672439575,
0.4576612114906311,
1.3737941980361938,
1.0591039657592773,
-0.021385841071605682,
0.2117757648229599,
-0.34792089462280273,
-0.08975457400083542,
-0.7440322041511536,
-0.6640341877937317,
0.66162949800491... |
func testHandlerDeliver(t *testing.T, testcases []testcase) {
for _, test := range testcases {
db := store.MemStore()
ctx, auth := newContextWithAuth(test.Perms)
// add dependencies
for _, dep := range test.Deps {
depHandler := dep.Handler(auth)
_, err := depHandler.Deliver(ctx, db, &weavetest.Tx{Msg: d... | [
0.15062078833580017,
-0.44261452555656433,
0.9075454473495483,
-0.1825154423713684,
0.04750512167811394,
1.2328405380249023,
0.642473578453064,
-0.3050939440727234,
0.26499518752098083,
-0.16446147859096527,
-0.9128788709640503,
-0.7389811277389526,
-0.27017849683761597,
0.4813283383846283... |
func NewCachingDialer(d Dialer) Dialer {
return &cachingDialer{
conns: make(map[connKey][]Conn),
straightDialer: d}
} | [
-0.7003868818283081,
-0.22435511648654938,
0.11857850849628448,
0.4941595494747162,
-1.5222917795181274,
0.5703049898147583,
-1.6350207328796387,
0.2341414839029312,
0.3210136592388153,
-0.05319308117032051,
-1.0639371871948242,
-0.18929937481880188,
0.5373590588569641,
0.9317295551300049,... |
func (u *UserProfile) GetInt(key string) (val int64) {
var ok bool
if val, ok = u.ints[key]; !ok {
val = 0
}
return val
} | [
-0.6008780002593994,
1.139729380607605,
0.45639127492904663,
0.20906341075897217,
-0.46129778027534485,
-0.19839103519916534,
-0.0589127317070961,
-0.6748352646827698,
-0.7656545042991638,
0.5859786868095398,
-0.07425910234451294,
-0.9010263085365295,
-1.1876695156097412,
-0.02206206694245... |
func (u *UserProfile) SetString(key, value string) string {
// u.Logger.Debug(fmt.Sprintf("About to set %s ==> %s, %v \n", key, value, u))
u.strings[key] = value
return value
} | [
-0.44319990277290344,
-0.03287488594651222,
0.3361388146877289,
-0.4362981617450714,
-0.7356503009796143,
0.6337921023368835,
0.30385667085647583,
-0.19425854086875916,
-0.1506613940000534,
0.3748243749141693,
-0.33617740869522095,
0.23372021317481995,
-0.6428462266921997,
-0.1719182580709... |
func (u *UserProfile) SetAuthKey(value string) string {
u.strings[AuthKey] = value
return value
} | [
0.025326820090413094,
0.3070998787879944,
0.12484348565340042,
0.1659029871225357,
0.039498765021562576,
0.24156950414180756,
1.2318227291107178,
-0.9468288421630859,
0.26521289348602295,
0.5580430030822754,
-0.5670819878578186,
0.2530718445777893,
-0.04505808278918266,
0.5432354807853699,... |
func (u *UserProfile) GetString(key string) string {
if _, ok := u.strings[key]; !ok {
return ""
}
return u.strings[key]
} | [
0.11174660176038742,
0.7034872174263,
0.21859359741210938,
0.33159321546554565,
-0.2932398021221161,
0.013461071997880936,
0.05630014091730118,
-1.249221920967102,
0.24469439685344696,
0.8415193557739258,
0.3653354048728943,
-0.11263859272003174,
-0.7883281111717224,
-0.46227797865867615,
... |
func (u *UserProfile) SetInt(name string, val int64) int64 {
u.ints[name] = val
return val
} | [
-0.5917259454727173,
0.41456782817840576,
0.1800055354833603,
-0.36009925603866577,
-1.396759271621704,
0.6873368620872498,
-0.29829657077789307,
-0.9600203633308411,
-0.41517162322998047,
0.463576078414917,
-1.307232141494751,
-0.5132849812507629,
-0.5917584300041199,
-0.11071170121431351... |
func (u *UserProfile) GetObject(key string) (val interface{}) {
var ok bool
if val, ok = u.objects[key]; !ok {
return nil
// a.logger.Error(fmt.Sprintf("Invalid object name `%s` in profile `%s`", key, a.activeProfile))
}
return
} | [
-0.2126212865114212,
0.0014273750130087137,
0.8320906758308411,
0.402151495218277,
-0.6261005997657776,
0.30078020691871643,
0.6589419841766357,
-1.4801537990570068,
-0.20932136476039886,
0.5464163422584534,
-0.8361055254936218,
-0.6514716744422913,
-0.4166945219039917,
-0.9985677599906921... |
func (u *UserProfile) SetObject(key string, obj interface{}) {
u.objects[key] = obj
} | [
-0.5371240973472595,
0.05795026198029518,
0.2633485198020935,
0.5786811709403992,
-0.30462774634361267,
1.4226324558258057,
0.3014312982559204,
0.0014862698735669255,
-0.3723022937774658,
0.24225632846355438,
-1.5386816263198853,
-0.22016309201717377,
0.13479967415332794,
-0.16382677853107... |
func (u *UserProfile) Decrement(key string) int64 {
val, ok := u.ints[key]
if !ok {
val = 0
}
val--
u.ints[key] = val
return val
} | [
-0.48119232058525085,
0.9152498841285706,
0.3712758719921112,
-0.028407258912920952,
-0.624530017375946,
-0.11850855499505997,
0.6371261477470398,
0.08273932337760925,
0.122609443962574,
-0.27965256571769714,
-0.4121696949005127,
-0.7519921064376831,
-1.3707890510559082,
0.1149715185165405... |
func (u *UserProfile) Increment(key string) int64 {
val, ok := u.ints[key]
if !ok {
val = 0
}
val++
u.ints[key] = val
return val
} | [
-1.0248225927352905,
0.9483782649040222,
0.2954831123352051,
-0.06644187122583389,
-0.743127167224884,
0.09999871253967285,
0.4130299389362335,
-0.11686300486326218,
0.18688222765922546,
-0.14837874472141266,
-0.5000573396682739,
-0.6200778484344482,
-1.0166425704956055,
0.0190401934087276... |
func NewUserProfile(id int, name string, logger *Logger, t *testing.T) *UserProfile {
userProfile := &UserProfile{
ID: id,
Name: name,
strings: map[string]string{},
ints: map[string]int64{},
objects: map[string]interface{}{},
Logger: logger,
}
userProfile.Requests = NewRequests(userProfile, ... | [
0.680340588092804,
-0.5815389752388,
0.43459567427635193,
0.0067334724590182304,
-0.9908466935157776,
-0.20935998857021332,
-0.40441185235977173,
-0.9272186756134033,
0.2511301338672638,
-0.2082514464855194,
-1.5941983461380005,
-0.3213280737400055,
-1.018676996231079,
-0.0165281780064106,... |
func (a *APITest) NewProfile(name string) (userProfile *UserProfile, e error) {
if _, ok := a.userProfiles[name]; ok {
e = fmt.Errorf("Duplicate profile name `%s`", name)
return
}
a.userProfiles[name] = NewUserProfile(len(a.userProfiles), name, a.logger, a.t)
a.userProfiles[name].baseURL = a.baseURL
return ... | [
0.2595607042312622,
0.061277277767658234,
0.5142951011657715,
0.2673768401145935,
-0.3850175142288208,
-0.4082513749599457,
-0.04537259042263031,
-0.9902374744415283,
1.0334712266921997,
0.2592184543609619,
-0.8125033378601074,
-0.47979485988616943,
-1.02397620677948,
-0.41206827759742737,... |
func (a *APITest) DestroyProfile(profileName string) (e error) {
if _, ok := a.userProfiles[profileName]; !ok {
e = fmt.Errorf("DestroyProfile: profile `%s` does not exist", profileName)
return
}
if profileName == DefaultProfileName {
e = errors.New("DestroyProfile: cannot delete default profile")
return
}... | [
0.19187380373477936,
-0.04525240883231163,
0.6099653840065002,
0.5238879919052124,
0.9655458331108093,
0.11366249620914459,
0.3638686537742615,
-0.21754887700080872,
0.3593790829181671,
0.8704660534858704,
-0.1679779589176178,
-0.6084172129631042,
-1.6748663187026978,
-0.06047692894935608,... |
func (a *APITest) GetProfileNames() []string {
profileNames := []string{}
for profileName := range a.userProfiles {
profileNames = append(profileNames, profileName)
}
return profileNames
} | [
-0.22156968712806702,
0.1677091270685196,
0.5751620531082153,
1.0643516778945923,
0.6918969750404358,
0.5044509172439575,
-0.29112520813941956,
-0.7452859878540039,
0.5055555105209351,
0.8538536429405212,
-0.6367396712303162,
0.21845820546150208,
-0.7022506594657898,
0.24490155279636383,
... |
func (a *APITest) GetProfile(profileName string) (profile *UserProfile, e error) {
var ok bool
if profile, ok = a.userProfiles[profileName]; !ok {
e = fmt.Errorf("Undefined profile name `%s`", profileName)
return
}
return
} | [
0.2856541872024536,
0.6570289731025696,
0.6436163783073425,
0.9397373795509338,
0.6725594997406006,
-0.2503463923931122,
0.16447262465953827,
-1.1041682958602905,
0.4223298728466034,
0.2211557775735855,
-0.03335271403193474,
-0.18968573212623596,
-1.5318679809570312,
-0.4889957904815674,
... |
func (a *APITest) CheckProfile(profileName string) {
if _, ok := a.userProfiles[profileName]; !ok {
panic(fmt.Sprintf("Undefined profile name `%s`", profileName))
}
} | [
0.8659524321556091,
0.4048224091529846,
0.5949124097824097,
0.6482793688774109,
0.7724233269691467,
0.7206296324729919,
-0.3217359483242035,
-0.3231891393661499,
0.08726885169744492,
0.8261222839355469,
-0.10385552048683167,
0.2201528400182724,
-0.8517011404037476,
0.19650959968566895,
-... |
func (a *APITest) SetActiveProfile(profileName string) {
profile, e := a.GetProfile(profileName)
if e != nil {
panic(fmt.Sprintf("SetActiveProfile: Unknown profile `%s`", profileName))
}
a.activeProfile = profile.Name
} | [
0.7165412902832031,
-0.8532475829124451,
0.4761238694190979,
0.0786147192120552,
0.05811309814453125,
0.11494932323694229,
0.41276174783706665,
-0.5967079401016235,
0.4195823669433594,
0.24461627006530762,
-0.6742407083511353,
0.039183612912893295,
-1.1179933547973633,
-0.6927661895751953,... |
func (a *APITest) ResetProfileToDefault() {
a.activeProfile = DefaultProfileName
} | [
0.5941166877746582,
-0.11950795352458954,
0.24445539712905884,
0.5031096339225769,
1.5849626064300537,
0.061809100210666656,
0.3514994978904724,
0.2571212351322174,
-0.20635350048542023,
0.41448745131492615,
-0.7592953443527222,
0.07950641214847565,
-1.1276562213897705,
-0.7176058888435364... |
func MergePrefixes32(left uint32, leftLength uint, right uint32, rightLength uint) (uint32, uint) {
return (left & _leftMasks32[leftLength]) | ((right & _leftMasks32[rightLength]) >> leftLength), (leftLength + rightLength)
} | [
0.16501305997371674,
0.12899361550807953,
0.784404456615448,
-0.8098649382591248,
-0.19222122430801392,
1.1441798210144043,
-0.926949679851532,
-1.44895601272583,
0.5192948579788208,
-0.28848299384117126,
-1.3338642120361328,
0.2687581181526184,
-0.7344287633895874,
0.37564361095428467,
... |
func MergePrefixes64(leftLeft uint64, leftRight uint64, leftLength uint, rightLeft uint64, rightRight uint64, rightLength uint) (uint64, uint64, uint) {
// mask the left 128 bits
if leftLength <= 64 {
leftLeft &= _leftMasks64[leftLength]
leftRight = 0
} else {
leftRight &= _leftMasks64[leftLength-64]
}
// m... | [
-0.5329402089118958,
0.23328648507595062,
0.838257908821106,
0.04403850808739662,
0.015528489835560322,
-0.06473195552825928,
-1.1637336015701294,
-0.6779244542121887,
0.6091939806938171,
-0.07087978720664978,
-1.0395619869232178,
-0.11452286690473557,
-0.9456523060798645,
0.45898687839508... |
func (p *ParamClient) Valid() string {
p.Init = utl.ReturnIf(p.Init <= 0, 0, p.Init).(int)
p.Limit = utl.ReturnIf(p.Limit <= 10, 10, p.Limit).(int)
p.Sort = utl.ReturnIf(!utl.IsNilStr(p.Sort), ASC, p.Sort).(string)
p.SortField = utl.ReturnIf(!utl.IsNilStr(p.SortField), "name", p.SortField).(string)
if !utl.InStr(s... | [
-0.2034839391708374,
-0.8420959711074829,
0.7038382291793823,
-0.9689494371414185,
-0.27788907289505005,
1.090242624282837,
-0.47508689761161804,
-0.47509098052978516,
-1.1543511152267456,
-0.024793513119220734,
0.7589070796966553,
0.5084933042526245,
-0.6457671523094177,
-0.42589217424392... |
func (p *ParamClient) GetClients() ([]byte, string) {
sqltmp := fmt.Sprintf(SendSQL("sql02"), p.SortField, p.Sort)
cnx := SendDB()
resp, err := cnx.QueryJSON(
db.StQuery{
Querie: sqltmp,
Args: map[string]interface{}{
"CANT": p.Limit,
"INI": p.Init,
},
}, 0, false, false)
if err != nil {
serv... | [
-0.6434639096260071,
-0.10829377919435501,
0.7265137434005737,
-0.8912431001663208,
0.35484421253204346,
-0.11802550405263901,
-0.3424711525440216,
-0.6534973382949829,
-1.1032943725585938,
0.24439311027526855,
0.07494109123945236,
1.4015682935714722,
-1.1898095607757568,
0.159039944410324... |
func (p *Client) ConvertMap() db.StData {
return db.StData{
"name": p.Name,
"segment1": p.Segment1,
"segment2": p.Segment2,
"segment3": p.Segment3,
"segment4": p.Segment4,
"platformId": p.PlatformID,
"clientId": p.ClientID,
}
} | [
-0.7801762819290161,
-0.7636627554893494,
0.6057162284851074,
-0.5284767150878906,
-0.13703447580337524,
0.7509010434150696,
-0.6486404538154602,
0.10562494397163391,
-0.06936690211296082,
0.2449175864458084,
-0.36283573508262634,
-0.6564884781837463,
-0.14436854422092438,
0.20208545029163... |
func replaceElements(arr []int) []int {
greatest := -1
for i := len(arr) - 1; i >= 0; i-- {
origin := arr[i]
arr[i] = greatest
if origin > greatest {
greatest = origin
}
}
return arr
} | [
-0.9781457185745239,
-0.5338548421859741,
0.628648042678833,
0.22772468626499176,
0.12980866432189941,
0.39651522040367126,
0.3371098041534424,
1.33819580078125,
0.24448639154434204,
-0.13470710813999176,
-0.3817780911922455,
0.6991115212440491,
-0.43334633111953735,
1.1668905019760132,
... |
func ValidColumn(column string) bool {
for i := range Columns {
if column == Columns[i] {
return true
}
}
for i := range ForeignKeys {
if column == ForeignKeys[i] {
return true
}
}
return false
} | [
-0.3611219525337219,
-0.7894299030303955,
0.504612386226654,
0.12218859046697617,
0.32628175616264343,
0.7947320938110352,
0.5220178961753845,
0.4621107280254364,
0.043949972838163376,
-0.4016576409339905,
-0.337096631526947,
0.0472886823117733,
-0.37466228008270264,
0.058876849710941315,
... |
func (m *MutipleValues) String() string {
if m == nil {
return ""
}
return strings.Join([]string(*m), ";")
} | [
0.547945499420166,
-0.26039281487464905,
0.4186897873878479,
0.8611577749252319,
-0.19808600842952728,
0.571707010269165,
-0.16065700352191925,
-0.18669560551643372,
-0.08939599245786667,
0.3095620572566986,
0.45772480964660645,
-0.5047225952148438,
-0.12098466604948044,
0.2945999205112457... |
func (m *MutipleValues) Set(val string) error {
*m = append(*m, val)
return nil
} | [
-0.5936638116836548,
0.43801459670066833,
0.17928873002529144,
0.21618525683879852,
-0.6698709726333618,
0.3519705533981323,
-0.8366795182228088,
-0.41581422090530396,
-0.28402063250541687,
0.18160782754421234,
-0.13356496393680573,
-0.1311970353126526,
0.021092833951115608,
0.645762920379... |
func (m *MutipleValues) MarshalJSON() ([]byte, error) {
return json.Marshal([]string(*m))
} | [
-0.5129939913749695,
-0.08526462316513062,
0.3922473192214966,
0.4613287150859833,
-0.362571120262146,
-0.08861042559146881,
-0.5579966306686401,
0.4653453826904297,
0.02884197235107422,
0.3904411494731903,
-0.5769197344779968,
0.23266127705574036,
0.33929452300071716,
0.7903034687042236,
... |
func (m *MutipleValues) UnmarshalJSON(data []byte) error {
res := []string{}
if err := json.Unmarshal(data, &res); err != nil {
return err
}
*m = res
return nil
} | [
-1.2948079109191895,
0.4279780387878418,
0.48716235160827637,
-0.5239683389663696,
-0.7016450762748718,
-0.17638587951660156,
-0.12799879908561707,
0.36050984263420105,
0.184072807431221,
0.6506378054618835,
-0.398872047662735,
-0.14510081708431244,
-0.17057548463344574,
0.3764796257019043... |
func (s *Envelope) AddKey(alias string, masterKey string, context map[string]string) (string, error) {
key, err := keysvc.GenerateDatakey(alias, masterKey, context)
if err != nil {
return "", err
}
err = s.Keyring.AddKey(key)
if err != nil {
return "", err
}
return key.ID.String(), nil
} | [
-0.5712140202522278,
0.3251285254955292,
0.933152437210083,
0.40253928303718567,
-0.4273402690887451,
0.3879081606864929,
-0.8683788776397705,
0.5323159098625183,
0.5430884957313538,
0.7320806980133057,
-0.07217615842819214,
-0.1177564188838005,
-0.7649518847465515,
0.2767890393733978,
-... |
func NewReminderRepository(h dao.PersistenceHandler) ReminderRepository {
return &reminderRepository{h}
} | [
-0.27949029207229614,
-0.14627350866794586,
0.14481155574321747,
-0.021595610305666924,
-0.7253149747848511,
-0.7845503687858582,
-0.17377325892448425,
0.03091370314359665,
0.7130632996559143,
-0.4852522611618042,
-0.5877625346183777,
-0.6770013570785522,
-0.38485029339790344,
0.9622642397... |
func (repo *reminderRepository) FindAll(ctx context.Context) ([]*Reminder, error) {
kind := repo.Kind(ctx, &Reminder{})
q := repo.NewQuery(kind).Filter("Enabled =", true)
var dst []*Reminder
return dst, repo.GetAll(ctx, q, &dst)
} | [
0.43467360734939575,
-0.07063520699739456,
0.3664402365684509,
0.3530367612838745,
0.47423145174980164,
0.5270771384239197,
-0.8100932240486145,
0.28723564743995667,
0.2892019748687744,
0.8175491690635681,
-0.5694770812988281,
1.3617348670959473,
-1.139460563659668,
1.7425905466079712,
-... |
func (repo *reminderRepository) Save(ctx context.Context, item *Reminder) error {
return repo.Put(ctx, item)
} | [
-0.9621658325195312,
-0.32216399908065796,
0.1072475016117096,
-0.9077939391136169,
1.0175710916519165,
0.3645346164703369,
-0.12634390592575073,
-0.5747806429862976,
0.7826420664787292,
1.03484046459198,
-2.0598626136779785,
0.1511254608631134,
-1.089299201965332,
-0.36674028635025024,
... |
func JWTValidator(certificates map[string]CertificateList) jwt.Keyfunc {
return func(token *jwt.Token) (interface{}, error) {
var certificateList CertificateList
var kid string
var ok bool
if _, ok := token.Method.(*jwt.SigningMethodRSA); !ok {
return nil, fmt.Errorf("unexpected signing method: %v", token... | [
-0.5809548497200012,
-0.4261535406112671,
0.6187599301338196,
-0.461588591337204,
-1.6866587400436401,
-0.276243656873703,
0.26654037833213806,
-0.5290009379386902,
-0.370151549577713,
0.5291051268577576,
-0.33429035544395447,
-0.33596307039260864,
-0.3349657356739044,
0.3927823305130005,
... |
func (c *ServiceConfig) Validate() error {
if c.Name == "" {
return errors.New("Name must be set")
}
if c.ID == "" {
return errors.New("ID must be set")
}
if c.Network == "" {
return errors.New("nginx.network must be set")
}
//calculate max parameter length
max := len(c.Ports)
if l := len(c.ListenIPs... | [
0.010355769656598568,
-0.016417890787124634,
0.7180588841438293,
-0.2856484055519104,
0.008755818009376526,
0.40866637229919434,
0.28974029421806335,
-0.33597490191459656,
-0.699050784111023,
0.07796412706375122,
-0.13276341557502747,
0.16383147239685059,
-1.069068193435669,
0.656817913055... |
func (c *ServiceConfig) NGINXConfig() (*NGINXConfig, error) {
addrs, err := GetServiceAddresses(c.ID, c.Network)
if err != nil {
return nil, fmt.Errorf("Error getting service (%s) addresses: %v", c.Name, err)
}
ng := new(NGINXConfig)
for i := 0; i < len(c.Ports); i++ {
p := &Proxy{
Name: c.Name,
... | [
0.2508796453475952,
-0.07282914966344833,
0.42246362566947937,
-0.607795238494873,
-0.9107364416122437,
0.06810928136110306,
-0.3532649576663971,
-0.11447333544492722,
0.13119269907474518,
0.35839352011680603,
-0.34880492091178894,
0.2685804069042206,
-0.6807975172996521,
-0.22085392475128... |
func (s *Server) SortKey() string {
return fmt.Sprintf("%s:%d", s.Address, s.Port)
} | [
-0.3825203776359558,
-0.6453959941864014,
0.4756549298763275,
-1.175554633140564,
0.2595498561859131,
0.6780837774276733,
-0.3556329905986786,
-0.4766613841056824,
-0.7086795568466187,
0.45584118366241455,
0.623721182346344,
1.6968275308609009,
-0.9012793898582458,
0.09166145324707031,
-... |
func (p *Proxy) SortServers() {
sort.Slice(p.Servers, func(i, j int) bool {
return p.Servers[i].SortKey() < p.Servers[j].SortKey()
})
} | [
-1.075767993927002,
-0.0318429172039032,
0.45999664068222046,
-1.2390923500061035,
0.3119286894798279,
0.3488391935825348,
0.04328223317861557,
-0.6722630858421326,
0.29477497935295105,
0.031497661024332047,
-0.2647920250892639,
0.6409550309181213,
-1.4215208292007446,
0.06348374485969543,... |
func (p *Proxy) SortKey() string {
return fmt.Sprintf("%s %s:%d/%s", p.Name, p.ListenIP, p.ListenPort, p.ListenProto)
} | [
-0.24560332298278809,
-0.7128283381462097,
0.5425950884819031,
-1.4059410095214844,
0.5528332591056824,
0.7614467144012451,
-0.45940151810646057,
-0.4756079912185669,
-1.0473512411117554,
0.6505691409111023,
0.8796572089195251,
0.9312232732772827,
-1.2052346467971802,
-0.2427116334438324,
... |
func (p *Proxy) IsUDP() bool {
return p.ListenProto == ProtocolUDP
} | [
-0.03815993294119835,
0.14665423333644867,
0.7081283330917358,
-0.3523225486278534,
0.6159221529960632,
0.5520483255386353,
-0.32392629981040955,
-0.055495765060186386,
0.9665866494178772,
0.0881936326622963,
0.1707567721605301,
0.23397967219352722,
-1.3690369129180908,
-1.0483345985412598... |
func (c *NGINXConfig) SortProxies() {
sort.Slice(c.Proxies, func(i, j int) bool {
return c.Proxies[i].SortKey() < c.Proxies[j].SortKey()
})
} | [
-0.8171591758728027,
-0.15101322531700134,
0.3449060618877411,
-0.5824015140533447,
-0.0972222089767456,
0.26744601130485535,
-0.02971166931092739,
-0.5120960474014282,
-0.6335063576698303,
0.4141853451728821,
-0.18504120409488678,
0.158118337392807,
-1.5807709693908691,
-0.053869683295488... |
func (c *NGINXConfig) Marshal() ([]byte, error) {
buf := new(bytes.Buffer)
err := nginxTmpl.Execute(buf, c)
if err != nil {
return nil, err
}
return buf.Bytes(), nil
} | [
0.1141153872013092,
0.7245193123817444,
0.35355573892593384,
-0.3584195077419281,
-0.26750755310058594,
0.2510615289211273,
-1.1370182037353516,
0.1252037137746811,
-0.47532522678375244,
0.0773182064294815,
-0.33149346709251404,
1.101954460144043,
-1.1258753538131714,
0.04590671509504318,
... |
func (np *Policy) IsTrafficAllowed(traffic *Traffic) *AllowedResult {
return &AllowedResult{
Ingress: np.IsIngressOrEgressAllowed(traffic, true),
Egress: np.IsIngressOrEgressAllowed(traffic, false),
}
} | [
0.16353346407413483,
0.8812614679336548,
0.5193995833396912,
-0.49219441413879395,
-0.4638804793357849,
0.04085131362080574,
0.7119454741477966,
-0.0013077276526018977,
0.2750715911388397,
0.3140107989311218,
0.4214846193790436,
0.18419410288333893,
-0.3199326694011688,
-0.2294007688760757... |
func New(ctx contextAPI.Client, channelID string, discovery fab.DiscoveryService, opts ...coptions.Opt) (*Service, error) {
options := params{retryOpts: getDefaultRetryOpts(ctx, channelID)}
coptions.Apply(&options, opts)
if options.refreshInterval == 0 {
options.refreshInterval = ctx.EndpointConfig().Timeout(fab... | [
-0.0036662197671830654,
-0.0806613564491272,
0.5727899074554443,
-0.32206445932388306,
0.07926063984632492,
-1.0042567253112793,
-0.22169914841651917,
-0.9866803884506226,
0.10668126493692398,
0.260661780834198,
0.2822030186653137,
1.294765830039978,
-0.6606951951980591,
0.3868831694126129... |
func (s *Service) GetEndorsersForChaincode(chaincodes []*fab.ChaincodeCall, opts ...coptions.Opt) ([]fab.Peer, error) {
if s.chResponseCache.IsClosed() {
return nil, errors.Errorf("Selection service has been closed")
}
logger.Debugf("Getting endorsers for chaincodes [%#v]...", chaincodes)
if len(chaincodes) == 0... | [
-1.0744292736053467,
0.1359618604183197,
0.37954452633857727,
-0.5653281211853027,
0.7594422698020935,
-1.1742438077926636,
-0.7579860687255859,
-0.26196804642677307,
-0.18029028177261353,
0.24668022990226746,
0.5512707829475403,
0.6723186373710632,
-1.2607898712158203,
0.394612193107605,
... |
func (s *Service) Close() {
logger.Debug("Closing channel response cache")
s.chResponseCache.Close()
} | [
0.4993642568588257,
-0.7923583984375,
0.34817323088645935,
-0.6742435097694397,
-0.09340060502290726,
0.490898072719574,
-0.10440116375684738,
-0.8311614990234375,
0.2805250883102417,
-1.0820502042770386,
0.23395457863807678,
0.6042411923408508,
-0.7315277457237244,
0.7221258878707886,
0... |
func (e DiscoveryError) IsTransient() bool {
return strings.Contains(e.Error(), "failed constructing descriptor for chaincodes") ||
strings.Contains(e.Error(), "no endorsement combination can be satisfied")
} | [
-0.8209095597267151,
0.12146814167499542,
0.4433774948120117,
-0.7341611981391907,
0.3046640455722809,
-0.4918458163738251,
-0.5482946634292603,
0.4824827313423157,
-0.14980605244636536,
0.24447372555732727,
0.12923592329025269,
0.4758944511413574,
-0.8466565012931824,
0.1961842030286789,
... |
func (e DiscoveryError) IsAccessDenied() bool {
return strings.Contains(e.Error(), AccessDenied)
} | [
0.31496503949165344,
-0.20982320606708527,
0.4203942120075226,
-0.3371283710002899,
0.051614731550216675,
-0.3190307021141052,
0.2504045367240906,
0.33427056670188904,
1.0275962352752686,
-0.39282017946243286,
0.9920188784599304,
0.9971491694450378,
0.6011778116226196,
0.6397717595100403,
... |
func NewService(db *gorm.DB) *Service {
return &Service{
Db: db,
}
} | [
0.8610290288925171,
0.10200300067663193,
-0.1126752495765686,
0.8225474953651428,
-0.2647034823894501,
0.30136290192604065,
-0.44518789649009705,
-0.8630636930465698,
-0.4941990375518799,
0.012843750417232513,
-0.2680834233760834,
0.8259416818618774,
-0.7079147100448608,
1.366146206855774,... |
func (service *Service) CreateRequest(parameters map[string]string) (*Request, error) {
var int1, int2, limit int64
var err error
// Convert string parameters to int64
if int1, err = strconv.ParseInt(parameters["int1"], 10, 64); err != nil {
return nil, err
}
if int2, err = strconv.ParseInt(parameters["int2"],... | [
-0.7325090169906616,
-0.7645289897918701,
0.9095492959022522,
-0.24358215928077698,
0.45706409215927124,
0.03450201079249382,
-0.8248909711837769,
-0.5367754697799683,
-0.5124891400337219,
0.5226657390594482,
1.1913845539093018,
0.49867406487464905,
-0.7692137360572815,
-0.0786703452467918... |
func (service *Service) GetFizzBuzz(request *Request) (*Result, error) {
res := make(Result, 0, request.Limit)
for i := int64(1); i < request.Limit+1; i += 1 {
if i%request.Int1 == 0 && i%request.Int2 == 0 {
res = append(res, request.Str1+request.Str2)
} else if i%request.Int1 == 0 {
res = append(res, requ... | [
-1.0489927530288696,
0.4136146306991577,
0.9958707094192505,
0.38565826416015625,
0.6693021655082703,
-0.6751583814620972,
0.4669758677482605,
-0.41463702917099,
0.1386806219816208,
-0.6035468578338623,
-0.6029715538024902,
0.15638615190982819,
-1.2759662866592407,
0.2838364541530609,
0.... |
func (r *Rmq) LoadURIOrDefault(defaultURI string) {
uri, ok := os.LookupEnv(rmqURIEnvKey)
if ok {
r.uri = uri
} else {
r.uri = defaultURI
}
} | [
-0.28935638070106506,
-0.02880571037530899,
0.5807659029960632,
0.09225710481405258,
0.2596273422241211,
-0.15458644926548004,
-0.919318675994873,
0.6011054515838623,
0.288531631231308,
0.6196401119232178,
-0.13246572017669678,
-0.5766644477844238,
-1.877511978149414,
0.5950444936752319,
... |
func (r *Rmq) Connect() {
conn, err := amqp.Dial(r.uri)
if err != nil {
panic(err)
}
r.conn = conn
ch, err := conn.Channel()
if err != nil {
panic(err)
}
r.ch = ch
} | [
0.19836723804473877,
-0.7299461960792542,
0.577470064163208,
-0.0169316828250885,
-0.26101601123809814,
0.1538454294204712,
-1.2132434844970703,
-0.5987079739570618,
-0.4348699450492859,
0.7925920486450195,
0.25371113419532776,
0.16447389125823975,
-0.32280680537223816,
0.25847700238227844... |
func (r *Rmq) Setup() {
err := r.ch.ExchangeDeclare(
rmqGreetingsExchange, "fanout", false, false, false, false, nil)
if err != nil {
panic(err)
}
_, err = r.ch.QueueDeclare(rmqGreetingsQueue, false, false, false, false, nil)
if err != nil {
panic(err)
}
err = r.ch.QueueBind(rmqGreetingsQueue, rmqHelloRo... | [
0.30194443464279175,
0.40163347125053406,
0.7607306241989136,
-0.05828896164894104,
0.39591744542121887,
-0.08309994637966156,
0.12965688109397888,
0.0017362585058435798,
0.14346249401569366,
0.3401840031147003,
-0.45454642176628113,
0.12568993866443634,
-0.6539374589920044,
1.401344656944... |
func (r *Rmq) Publish(body []byte) error {
return r.ch.Publish(
rmqGreetingsExchange, rmqHelloRoutingKey, false, false,
amqp.Publishing{
DeliveryMode: amqp.Transient,
ContentType: "application/json",
Body: body,
Timestamp: time.Now(),
},
)
} | [
-0.7441832423210144,
0.2848360240459442,
0.5135964751243591,
0.0871339812874794,
0.12860698997974396,
0.31508690118789673,
-0.8125703930854797,
-0.4465460181236267,
-0.07710832357406616,
0.7928035259246826,
-0.8551087975502014,
0.206343874335289,
-1.1895314455032349,
0.8315305113792419,
... |
func parseHostPort(str string) (string, string) {
var (
host string
port string
i = strings.Index(str, ":")
)
if i == -1 {
return str, ""
}
host = str[:i]
port = str[i+1:]
return host, port
} | [
0.09619582444429398,
-1.059937596321106,
0.7379235029220581,
-0.21809303760528564,
-0.4120207726955414,
0.0372098907828331,
0.4444471299648285,
0.5649839639663696,
-0.8461254835128784,
0.5066329836845398,
-0.7865260243415833,
-0.32540765404701233,
-0.6721423268318176,
-0.9660850167274475,
... |
func ProcessTitleInfo( info TitleInfoInterface ) string {
return info.GetTitleBlurb() + info.GetDvdEncodingRegionInfo()
} | [
-0.158405140042305,
-1.0277760028839111,
0.5471130013465881,
-0.6750243306159973,
-0.8701667189598083,
0.21514520049095154,
-1.273533582687378,
-0.9220544695854187,
-0.11837906390428543,
0.7520807385444641,
-0.30026155710220337,
-0.2967139780521393,
0.1306673139333725,
0.1914617419242859,
... |
func (this *TitleInfoImpl) SetTitleName(titleNameIn string) {
this.titleName = titleNameIn;
} | [
-0.8963646292686462,
-0.8964262008666992,
0.1648402214050293,
-0.11995654553174973,
-1.2404279708862305,
0.4399198293685913,
-0.6484283804893494,
-0.06321839988231659,
-0.3776824176311493,
0.009321969002485275,
-1.1827560663223267,
-0.7841942310333252,
-0.2930071949958801,
-0.0375548005104... |
func main() {
cli.CommandLineInterface()
} | [
0.5209731459617615,
-0.35349610447883606,
0.1544344425201416,
0.8593730926513672,
1.023144006729126,
0.7930317521095276,
1.0216221809387207,
-0.12146458774805069,
-0.8360880613327026,
-0.7621972560882568,
-0.1835118979215622,
0.004144445993006229,
-0.04370201379060745,
0.01756785251200199,... |
func TestDeleteDevice(t *testing.T) {
connectToDb(t)
setUpDeleteDevice(t)
log.Print("Test:Delete Device")
t.Run("of valid device", testDeleteValidDevice)
t.Run("of invalid device", testDeleteInvalidDevice)
tearDownDeleteDevice(t)
} | [
-0.14077623188495636,
0.5504772067070007,
0.26465916633605957,
1.0699126720428467,
0.7006422877311707,
0.640049934387207,
0.9211825132369995,
0.44345489144325256,
1.0642558336257935,
-0.6967657208442688,
0.521364688873291,
0.05152861401438713,
-0.8950695991516113,
0.15148361027240753,
0.... |
func testDeleteValidDevice(t *testing.T) {
log.Print(" Case 1:Delete Device")
_, res := helpers.Login(t, "user1", "user1")
if res.StatusCode() != 200 {
t.Errorf("Error Login User Account:Expected Response code:200 but got:" + strconv.Itoa(res.StatusCode()))
t.Error(res)
}
device, res := helpers.CreateDevice(t,... | [
-0.2352372109889984,
0.4803430438041687,
0.6738617420196533,
0.9072829484939575,
0.5432491898536682,
0.45692166686058044,
0.9830156564712524,
0.011960211209952831,
0.5294374823570251,
-0.6468246579170227,
-0.150330051779747,
-0.09965235739946365,
-0.3956967890262604,
-0.05815118923783302,
... |
func testDeleteInvalidDevice(t *testing.T) {
log.Print(" Case 2:Delete Invalid Device")
_, res := helpers.Login(t, "user1", "user1")
if res.StatusCode() != 200 {
t.Errorf("Error Login User Account:Expected Response code:200 but got:" + strconv.Itoa(res.StatusCode()))
t.Error(res)
}
result, res := helpers.Remov... | [
-0.102479949593544,
0.4728029668331146,
0.7435903549194336,
0.9931197762489319,
0.18306298553943634,
0.43922922015190125,
1.0879756212234497,
0.20066991448402405,
0.5538337230682373,
-0.3816263973712921,
0.0805039331316948,
0.293023020029068,
-0.7655778527259827,
0.13990603387355804,
1.7... |
func (r *Renderer) RenderWithPrompt(bot *Bot) {
for {
r.renderCommon(bot)
r.renderCmdPrompt(bot)
}
} | [
-0.543111264705658,
-0.22681236267089844,
0.23083506524562836,
0.4846799969673157,
-0.34227296710014343,
0.3878825604915619,
-0.4157331883907318,
-0.8391863703727722,
0.35283371806144714,
-0.029875487089157104,
0.07978040724992752,
-0.39278748631477356,
-0.6729465126991272,
1.1535987854003... |
func (r *Renderer) RenderWithCmd(bot *Bot, cmd string) {
RunCommand(bot, cmd)
r.renderCommon(bot)
} | [
0.06011343374848366,
-0.4707556664943695,
0.3875036835670471,
-0.10015956312417984,
-0.45278826355934143,
0.7407047152519226,
-0.6666277050971985,
-0.35034698247909546,
-0.22847533226013184,
-0.6942628622055054,
0.17082525789737701,
-0.132355198264122,
-0.7282929420471191,
1.12144541740417... |
func (r Renderer) renderBotLine(dir string, line int) {
fmt.Print(getBotLine(dir, line))
} | [
-0.5815828442573547,
0.08306970447301865,
0.3560571074485779,
-0.4935276210308075,
0.4613771140575409,
-0.0248677060008049,
-0.9856968522071838,
0.24986189603805542,
-1.1479394435882568,
-0.5914322137832642,
-0.6375159025192261,
0.7301592826843262,
-0.323650985956192,
0.19471874833106995,
... |
func getBotLine(dir string, line int) string {
switch dir {
case East:
return horiBot[line]
case North:
return vertBot[line]
case South:
return vertBot[len(vertBot)-(1+line)]
case West:
reversed := ""
for _, prune := range horiBot[line] {
reversed = string(prune) + reversed
}
return reversed
defa... | [
-0.08782348036766052,
-0.048012327402830124,
0.6881526708602905,
0.3710592985153198,
0.9126832485198975,
0.6215054988861084,
-0.8485795855522156,
-0.5216843485832214,
-1.3405267000198364,
-0.20547789335250854,
-0.08422055840492249,
0.6158338785171509,
0.012165168300271034,
-0.4138731658458... |
func (r *Renderer) renderRows(bot *Bot) {
for y := 0; y < TableUnitsY*ConsoleUnitsPerTableUnitsY; y++ {
if y%TableUnitsY == 0 && y > 0 {
r.renderRowSep()
}
r.renderColumns(bot, y)
r.renderRowSep()
}
} | [
-0.9141939878463745,
0.7483659386634827,
0.2409617155790329,
0.17202845215797424,
0.0559273324906826,
0.10690166056156158,
-0.005726045463234186,
-0.2616988718509674,
0.27543070912361145,
-0.5146236419677734,
0.3782535493373871,
-0.4992367625236511,
0.15662382543087006,
1.4847021102905273,... |
func (r *Renderer) renderCmdPrompt(bot *Bot) {
reader := bufio.NewReader(os.Stdin)
fmt.Print("Action: ")
r.lines++
action, err := reader.ReadString('\n')
if err != nil {
bot.lastError = errors.New("Oops, Something went wrong when reading your command")
return
}
RunCommand(bot, action)
} | [
0.19641128182411194,
-0.7826593518257141,
0.7417263984680176,
0.12215234339237213,
-0.1693563610315323,
0.9498088359832764,
-0.4049340486526489,
0.4720805883407593,
0.3233661949634552,
0.09622909128665924,
0.886150598526001,
0.21788524091243744,
-1.3704150915145874,
0.08409532159566879,
... |
func (r *Renderer) renderColumns(bot *Bot, y int) {
for x := 0; x < TableUnitsX; x++ {
if x > 0 {
r.renderColSep()
}
if bot.point != nil && bot.point.X == x && (ConsoleUnitsPerTableUnitsY-1)-bot.point.Y == y/ConsoleUnitsPerTableUnitsY {
deco.Color(deco.TextRed)
r.renderBotLine(bot.direction, y%TableUni... | [
-0.7106876373291016,
0.1367495208978653,
0.42876997590065,
-0.0009611484128981829,
0.5277482271194458,
0.6687783002853394,
-0.18589965999126434,
-0.909346342086792,
-0.3556726276874542,
-0.12672902643680573,
-0.5224334001541138,
-0.3729040324687958,
0.05353916808962822,
0.3135482966899872,... |
func (r *Renderer) renderStatus(bot *Bot) {
report := bot.String()
fmt.Printf(deco.BgBlack+"%-30s%29s\n"+deco.DefaultColor, bot.lastCmd, report)
r.lines++
} | [
0.10848501324653625,
-0.19405852258205414,
0.4104839563369751,
-0.3364638686180115,
0.8526767492294312,
0.1369699388742447,
-0.1991346925497055,
0.7772497534751892,
-0.5731080770492554,
-0.30930379033088684,
-0.4752357602119446,
0.42378997802734375,
-0.7098801136016846,
1.121500015258789,
... |
func (r *Renderer) renderReport(bot *Bot) {
fmt.Printf("%-"+paddingX+"s\n", bot.lastReport)
r.lines++
} | [
0.377165287733078,
0.6909776329994202,
0.4443519115447998,
-0.8737812638282776,
0.5894460082054138,
-0.08101716637611389,
-0.27310264110565186,
0.35804447531700134,
-0.24538081884384155,
-0.8806054592132568,
0.14070336520671844,
-0.08434709161520004,
-0.8879261016845703,
0.6429473757743835... |
func (r Renderer) renderColSep() {
fmt.Print(" ")
} | [
-0.4125130772590637,
-0.19775892794132233,
0.5796718001365662,
-0.0239860862493515,
0.44206246733665466,
-0.05592507869005203,
-0.28122246265411377,
-0.3009466826915741,
-0.10551730543375015,
0.03164853900671005,
-0.43401747941970825,
-1.3395535945892334,
-0.9576165676116943,
0.00182703533... |
func (r *Renderer) renderRowSep() {
fmt.Println()
r.lines++
} | [
-0.6720783710479736,
0.032639674842357635,
0.5959923267364502,
-0.5044641494750977,
0.16820098459720612,
-0.3883412480354309,
-0.5402368307113647,
0.36577460169792175,
0.7402154803276062,
-0.011903380043804646,
0.02066156640648842,
-0.9681356549263,
-0.16149401664733887,
0.9098021984100342... |
func (r Renderer) renderUnitLine() {
fmt.Print(unitLine)
} | [
-0.10765809565782547,
-0.7446719408035278,
0.3936682343482971,
-0.507892370223999,
0.5844886302947998,
0.5385863184928894,
-0.48684075474739075,
0.10594154894351959,
0.20608343183994293,
-0.43083715438842773,
-0.557135283946991,
-0.04861591383814812,
-0.3793206810951233,
0.4343999922275543... |
func addtoFuncmap(propfnmap map[string]template.FuncMap, propList []string, name string,
fn interface{}) {
for _, prop := range propList {
if _, ok := propfnmap[prop]; !ok {
propfnmap[prop] = make(template.FuncMap)
}
propfnmap[prop][name] = fn
}
} | [
-0.993772029876709,
-0.6971613168716431,
0.4958644509315491,
-0.037220362573862076,
0.9956962466239929,
-0.7599342465400696,
0.3381144404411316,
0.7737023234367371,
-0.09775574505329132,
-0.86109858751297,
-0.36994582414627075,
-0.2710719406604767,
0.29863807559013367,
0.3334733545780182,
... |
func applyLateTemplateRecursive(propsVal reflect.Value, stringvalues map[string]string,
propfnmap map[string]template.FuncMap) {
for i := 0; i < propsVal.NumField(); i++ {
field := propsVal.Field(i)
propName := propsVal.Type().Field(i).Name
switch field.Kind() {
case reflect.String:
if funcmap, ok := pro... | [
0.2668702006340027,
0.04904227703809738,
0.6647119522094727,
-0.8388633131980896,
-0.5615785121917725,
-0.6588874459266663,
0.26724162697792053,
0.5704655647277832,
-0.09748464077711105,
-0.8627194762229919,
0.2802218496799469,
0.05875806882977486,
-0.33547472953796387,
0.3662460446357727,... |
func (s *SourceProps) initializeNonCompiledSourceMap(mctx blueprint.BaseModuleContext) map[string]bool {
// Unused non-compiled sources are not allowed, so create
// a map to mark whether a non-compiled source is matched.
nonCompiledSources := make(map[string]bool)
if _, ok := getLibrary(mctx.Module()); ok {
for ... | [
-1.068785548210144,
-0.4183512032032013,
0.21038854122161865,
-0.919314444065094,
-0.23130351305007935,
0.3603571653366089,
0.16817665100097656,
0.015605848282575607,
-0.030004115775227547,
-0.33652207255363464,
-1.0243618488311768,
-0.20910689234733582,
-0.7201451659202576,
1.360287189483... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.