text
stringlengths
11
6.3k
embedding
listlengths
768
768
func New(provider Provider) *Module { m := &Module{ provider: provider, scheduler: timing.NewScheduler(), } m.notifyFn, m.notifyCh = notifier.New() m.outputFunc.Set(func(info Info) bar.Output { if info.Updates == 1 { return outputs.Text("1 update") } return outputs.Textf("%d updates", info.Updates) ...
[ -0.7306380867958069, -0.4868663251399994, 0.3306230306625366, -0.34196367859840393, -0.12732607126235962, 0.7680282592773438, 0.031247088685631752, -0.7607511281967163, -0.4946359097957611, 0.21649473905563354, -0.0519990473985672, 0.317912220954895, 0.7255039811134338, 1.2355191707611084,...
func (m *Module) Output(format func(Info) bar.Output) *Module { m.outputFunc.Set(format) return m }
[ -0.4286319613456726, -0.4465591013431549, 0.14376166462898254, 0.14005209505558014, -0.15017831325531006, 0.5578928589820862, 0.6628816723823547, -0.42059293389320374, -0.07424454391002655, -0.46545395255088806, 0.03705231100320816, 0.46523144841194153, 0.306069940328598, 1.019119381904602...
func (m *Module) Every(interval time.Duration) *Module { if interval == 0 { m.scheduler.Stop() } else { m.scheduler.Every(interval) } return m }
[ -0.7211145758628845, -0.5380122661590576, 0.5196307301521301, 0.4992964267730713, 0.5692861080169678, 1.51641047000885, -0.667281985282898, -0.1146019846200943, -0.7062064409255981, -0.11635231226682663, 0.7232030034065247, 0.09340224415063858, -0.2614957094192505, 1.0958583354949951, -0...
func (m *Module) Refresh() { m.notifyFn() }
[ 0.9755772352218628, -0.29865914583206177, 0.04179658740758896, 0.5802544355392456, 0.9385007619857788, 0.25519445538520813, -0.5319018959999084, -0.6095956563949585, -0.31997326016426086, -0.3867768943309784, 0.030278580263257027, 1.212260127067566, 0.18108175694942474, 1.2236298322677612,...
func (m *Migrate) SetMigrationsCollection(name string) { m.migrationsCollection = name }
[ -0.8512953519821167, 0.10152702033519745, 0.543479323387146, 0.28518036007881165, -0.5489702820777893, -0.011566952802240849, 0.3578178584575653, -0.9673987627029419, -0.7924585938453674, 0.62025386095047, -1.2959113121032715, -0.3066405951976776, 0.5557593107223511, 1.4045215845108032, ...
func (m *Migrate) Version() (uint64, string, error) { if err := m.createCollectionIfNotExist(m.migrationsCollection); err != nil { return 0, "", err } filter := bson.D{{}} sort := bson.D{bson.E{Key: "_id", Value: -1}} options := options.FindOne().SetSort(sort) // find record with greatest id (assuming it`s la...
[ -0.4176102578639984, -0.3728753328323364, 0.8399361371994019, -0.22160100936889648, 0.5812039375305176, 0.40226736664772034, 0.35999220609664917, 0.1022474467754364, -0.5610117316246033, 1.2620211839675903, -0.5307725667953491, -0.3615463376045227, -0.4124629497528076, 1.13387131690979, ...
func (m *Migrate) SetVersion(version uint64, description string) error { rec := versionRecord{ Version: version, Timestamp: time.Now().UTC(), Description: description, } _, err := m.db.Collection(m.migrationsCollection).InsertOne(context.TODO(), rec) if err != nil { return err } return nil }
[ -0.36428284645080566, 0.5800153017044067, 0.7299154996871948, 0.8016402125358582, 0.6753984093666077, 0.7572458982467651, -0.22915886342525482, 0.9995191097259521, -0.21282079815864563, 1.134877324104309, -1.5723642110824585, -0.0056005846709012985, -0.7193147540092468, 0.6891282200813293,...
func (m *Migrate) Up(n int) error { currentVersion, _, err := m.Version() if err != nil { return err } if n <= 0 || n > len(m.migrations) { n = len(m.migrations) } migrationSort(m.migrations) for i, p := 0, 0; i < len(m.migrations) && p < n; i++ { migration := m.migrations[i] if migration.Version <= cur...
[ -1.2725107669830322, 0.825064480304718, 0.8431044816970825, 0.12438850849866867, 0.1228313222527504, 0.268418550491333, 0.16808170080184937, -0.1987418383359909, -0.10953247547149658, 0.784031867980957, -0.6390068531036377, 0.22898754477500916, -0.24481011927127838, 0.8947133421897888, -...
func (m *Migrate) Down(n int) error { currentVersion, _, err := m.Version() if err != nil { return err } if n <= 0 || n > len(m.migrations) { n = len(m.migrations) } migrationSort(m.migrations) for i, p := len(m.migrations)-1, 0; i >= 0 && p < n; i-- { migration := m.migrations[i] if migration.Version >...
[ -0.48111891746520996, 0.713077962398529, 1.014971375465393, 0.1684011071920395, 0.10984916985034943, 0.6460237503051758, 0.6387292146682739, -0.10169828683137894, -0.12598726153373718, -0.033863671123981476, -0.1773548573255539, 0.06160953268408775, -1.0195176601409912, 1.3004919290542603,...
func ObterResultado(nota float64) string { if nota >= 6 { return "Aprovado" } return "Reprovado" }
[ 0.3485257625579834, 0.46849706768989563, 0.3322959840297699, 0.10103444755077362, -0.6678889393806458, -0.011748171411454678, -0.654065728187561, -0.016863035038113594, -0.16911521553993225, -0.040013667196035385, 0.38349926471710205, 0.1890985369682312, 0.002903540851548314, -0.5242844820...
func SearchExifHeader(reader io.Reader) (eh ExifHeader, err error) { defer func() { if state := recover(); state != nil { err = state.(error) //err = log.Wrap(state.(error)) } }() // Search for the beginning of the EXIF information. The EXIF is near the // beginning of most JPEGs, so this likely doesn't ...
[ -0.022907642647624016, 0.1428571492433548, 0.5320596098899841, -0.2224840670824051, -0.29875028133392334, -0.8299434185028076, -0.06840991228818893, -0.25193363428115845, -0.13243871927261353, 0.07369150221347809, -0.013651058077812195, -0.4079599678516388, -0.46178221702575684, 0.25107777...
func IsTiffLittleEndian(buf []byte) bool { return buf[0] == 0x49 && buf[1] == 0x49 && buf[2] == 0x2a && buf[3] == 0x00 }
[ 0.7283276915550232, -0.7749614119529724, 0.5577678084373474, -0.8614580035209656, 0.43052369356155396, 0.7583857178688049, 0.07833366841077805, -0.4225168824195862, 1.1417003870010376, -0.7144715785980225, -1.8600616455078125, 0.22000150382518768, -1.4315826892852783, 1.2462711334228516, ...
func IsTiffBigEndian(buf []byte) bool { return buf[0] == 0x4d && buf[1] == 0x4d && buf[2] == 0x00 && buf[3] == 0x2a }
[ -0.26596394181251526, -0.7431612610816956, 0.6593809127807617, 0.24754728376865387, 0.892248809337616, 0.38725075125694275, 0.5946587920188904, -0.4882468581199646, 0.29778772592544556, -0.46967679262161255, -1.479844093322754, 0.7776796221733093, -1.174957275390625, 1.0679436922073364, ...
func (c *YoutubeController) GetYoutubeVideoDetails(videoURL *string) (*types.UserVideoItem, error) { // https://www.googleapis.com/youtube/v3/videos?id=D95qIe5pLuA&key=AIzaSyBhFXscTPZr892Uj5h2wRghkFAqTPYtcEg&part=snippet,statistics,topicDetails if videoURL == nil { return nil, errors.New("Need url") } // attempt...
[ -0.03121502511203289, -0.2963457405567169, 0.8564703464508057, 0.8351554870605469, -0.04427690431475639, 0.26756468415260315, -0.3180493414402008, -0.23397080600261688, 0.7154403924942017, -0.3637586534023285, -1.059732437133789, 1.2381669282913208, -0.39744770526885986, 1.0431760549545288...
func getTagsFromVideo(video *types.UserVideoItem) []string { userTags := []string{} for _, tag := range video.Items[0].Snippet.Tags { words := strings.Split(tag, " ") for _, w := range words { userTags = append(userTags, w) } } titleWords := strings.Split(video.Items[0].Snippet.Title, " ") for _, w := ran...
[ 0.7601705193519592, -0.30832675099372864, 0.5734699368476868, 0.4125676453113556, -0.14183135330677032, -0.8805038332939148, -0.8141778111457825, -0.37773042917251587, 0.3487643599510193, 0.7562215328216553, -1.0351223945617676, 0.8124393820762634, -0.8421294093132019, 1.1931923627853394, ...
func calculateCategoryScore(userCategoryID int, candidateCategoryID int) float64 { if VideoCategoryMap[userCategoryID] == nil || VideoCategoryMap[candidateCategoryID] == nil { return 0 } containsCandidateCategory := false containsUserCategory := false for _, category := range VideoCategoryMap[userCategoryID] {...
[ -0.43668052554130554, -0.9444003105163574, 0.6426445841789246, 0.8353453874588013, -0.43139582872390747, -0.6359691023826599, -0.27400636672973633, 0.5464280247688293, -0.0945122241973877, 0.4934425950050354, 0.19746838510036469, 0.5849889516830444, 0.43422913551330566, 1.5675545930862427,...
func calculateDistanceScoreBetweenTags(userTags, videoTags []string) int { count := 0 for _, userTag := range userTags { for _, videoTag := range videoTags { distance := float64(levenshtein.ComputeDistance(userTag, videoTag)) // if its not the SAME exact word... // but requires less then a few tarnsition...
[ 1.1560312509536743, -0.6804094314575195, 0.5306373238563538, 0.2870008051395416, -0.10955982655286789, -0.1296727955341339, -0.1989072561264038, -0.052132900804281235, -0.16228392720222473, 0.9884232878684998, -1.1465953588485718, 0.00159193086437881, -0.9450317621231079, 0.897466063499450...
func (p *pgTester) setupMain() error { var err error p.DbName = viper.GetString("postgres.dbname") p.host = viper.GetString("postgres.host") p.user = viper.GetString("postgres.user") p.pass = viper.GetString("postgres.pass") p.port = viper.GetInt("postgres.port") p.sslmode = viper.GetString("postgres.sslmode") ...
[ -0.08527247607707977, -0.2010740488767624, 1.0432173013687134, 0.5002806186676025, 0.6125596165657043, 0.027497414499521255, 0.2839616537094116, 0.42833051085472107, -0.5612833499908447, 0.34756937623023987, 0.40940845012664795, -0.29758569598197937, -0.7263650894165039, 0.9880543947219849...
func (p *pgTester) teardown() error { var err error if err = p.testDbConn.Close(); err != nil { return err } p.testDbConn = nil if err = p.dropDB(p.TestDBName); err != nil { return err } if p.liveDbConn != nil { if err = p.liveDbConn.Close(); err != nil { return err } p.liveDbConn = nil } if p.liv...
[ 0.3741229474544525, -0.39779555797576904, 1.1396381855010986, 0.2245604395866394, 0.5452446937561035, 1.0820986032485962, 0.840400755405426, 0.6111227869987488, -0.044677603989839554, 0.3331693708896637, 0.6356110572814941, -0.578108012676239, -2.0298068523406982, 0.37981337308883667, 0....
func BenchmarkCryptoRead(b *testing.B) { buffer := make([]byte, 8) for n := 0; n < b.N; n++ { result, _ = crand.Read(buffer) } }
[ 0.4554791748523712, 1.1638705730438232, 0.3797547519207001, -0.574935257434845, 1.0050716400146484, -0.5441901683807373, 0.3303850293159485, -0.41474083065986633, -0.6873095631599426, 0.33895885944366455, 0.12174703180789948, 1.2039461135864258, -1.1598608493804932, -0.2578081786632538, ...
func Validate(TeamDomain, ApplicationAUD string, UnauthorizedHandler fiber.Handler) fiber.Handler { // Handle if the domain ends with a slash or doesn't start with https://. if strings.HasSuffix(TeamDomain, "/") { TeamDomain = TeamDomain[:1] } if !strings.HasPrefix(TeamDomain, "https://") { TeamDomain = "https:...
[ 0.7208128571510315, 0.08813633024692535, 0.6079521179199219, -0.03171548992395401, -0.3997226059436798, -0.04869331046938896, 0.5901057720184326, -1.0644992589950562, 0.05488470941781998, -0.4933810830116272, 1.3963229656219482, 0.7144988179206848, 0.17863479256629944, 0.09700798988342285,...
func GetLeaderboard(c *http.Client, ps net.PlayerSession) error { gt := getDesiredLeaderboardType() var err error switch gt { case match.DeathMatch: err = handleDMLeaderboard(c, ps) case match.CaptureTheFlag: err = handleCTFLeaderboard(c, ps) case match.LastManStanding: err = handleLMSLeaderboard(c, ps) c...
[ 0.20279337465763092, 0.28020811080932617, 0.8579120635986328, 0.6172670722007751, 0.904899537563324, -0.030745981261134148, -0.18005961179733276, -0.6097590327262878, 0.37824052572250366, -0.34782806038856506, 0.5048114061355591, 0.039437659084796906, -0.8410325646400452, 0.365039348602294...
func handleDMLeaderboard(c *http.Client, ps net.PlayerSession) error { lboard := make(leaderboard.DMLeaderboard, 0, 10) if err := net.Get(c, "/leaderboards/"+match.DeathMatch, ps, &lboard); err != nil { return err } fmt.Println("-----------------------\nDeathMatch game type leaderboards") fmt.Println("Player\tK...
[ 0.3033667802810669, -0.453620582818985, 1.147874355316162, -0.6893496513366699, 0.22593103349208832, 0.15662890672683716, -0.04815870523452759, -0.6013827323913574, -0.32555148005485535, 0.0439324751496315, 0.1447700560092926, -0.0809800922870636, -0.02135690301656723, 0.7752344608306885, ...
func handleCTFLeaderboard(c *http.Client, ps net.PlayerSession) error { lboard := make(leaderboard.CTFLeaderboard, 0, 10) if err := net.Get(c, "/leaderboards/"+match.CaptureTheFlag, ps, &lboard); err != nil { return err } fmt.Println("-----------------------\nCapture the Flag game type leaderboards") fmt.Printl...
[ 0.6595669388771057, -0.3462991714477539, 0.7298324704170227, -0.6659844517707825, 0.8141121864318848, 0.33088812232017517, -0.043256133794784546, -0.523409366607666, -0.39895257353782654, 0.5742223262786865, -0.36433205008506775, -0.012105092406272888, -0.3288138806819916, 0.58115851879119...
func handleLMSLeaderboard(c *http.Client, ps net.PlayerSession) error { lboard := make(leaderboard.LMSLeaderboard, 0, 10) if err := net.Get(c, "/leaderboards/"+match.LastManStanding, ps, &lboard); err != nil { return err } fmt.Println("-----------------------\nLast Man Standing game type leaderboards") fmt.Prin...
[ 0.7209680676460266, -0.9394572973251343, 1.0033020973205566, -1.3214248418807983, 0.33977773785591125, 0.13212421536445618, -0.5278140902519226, -0.5974352955818176, -0.09965943545103073, 0.3983841836452484, -0.3217647075653076, 0.30210602283477783, -0.1908787190914154, 0.741844117641449, ...
func handleDuelLeaderboard(c *http.Client, ps net.PlayerSession) error { lboard := make(leaderboard.DuelLeaderboard, 0, 10) if err := net.Get(c, "/leaderboards/"+match.Duel, ps, &lboard); err != nil { return err } fmt.Println("-----------------------\nDuel game type leaderboards") fmt.Println("Player\tKills\tDe...
[ 0.5265362858772278, -0.17517846822738647, 1.0096300840377808, -0.8885698914527893, 0.5766189694404602, 0.26801544427871704, 0.3169839382171631, -0.42676404118537903, -0.08949136734008789, 0.36814022064208984, -0.45223990082740784, 0.1811114102602005, 0.1858765035867691, 0.6844702959060669,...
func skip(pod *corev1.Pod) bool { for key := range pod.GetAnnotations() { if strings.Contains(key, TelegrafAnnotationCommon) { return false } } return true }
[ -1.3645575046539307, 0.6754428148269653, 0.33225104212760925, 0.38826534152030945, -0.4517841637134552, 0.8293684124946594, 0.7606536149978638, -1.0036437511444092, -1.1842448711395264, 1.0139473676681519, -0.08658667653799057, -1.1153873205184937, -0.5830848217010498, -0.07403890043497086...
func ports(pod *corev1.Pod) []string { uniquePorts := map[string]struct{}{} if p, ok := pod.Annotations[TelegrafMetricsPort]; ok { uniquePorts[p] = struct{}{} } if ports, ok := pod.Annotations[TelegrafMetricsPorts]; ok { for _, p := range strings.Split(ports, ",") { uniquePorts[p] = struct{}{} } } if len...
[ 0.10435463488101959, 0.09283516556024551, 0.3241666257381439, -0.5112351775169373, 0.6789481043815613, 0.4137454628944397, 0.3069411814212799, -1.015127182006836, 0.1797139048576355, 0.8041200637817383, 0.55897057056427, 0.17742633819580078, -0.3977051377296448, -0.2840304970741272, -0.5...
func printLevenshteinDistance(dp [][]int, word1, word2 string) { for i := 0; i < len(dp); i++ { if i > 0 { fmt.Print(string(word2[i-1]), " ") } if i == 0 { fmt.Print(" ") for j := 0; j < len(word1); j++ { fmt.Print(string(word1[j]), " ") } fmt.Println("") fmt.Print(" ") } for j := 0...
[ 0.8250696063041687, -0.2824568450450897, 1.1598678827285767, -0.732533872127533, 0.01157823670655489, 0.8849046230316162, -0.6653765439987183, 0.06784243136644363, -0.33827412128448486, 1.4976022243499756, -0.043921563774347305, 1.8314640522003174, -1.391469955444336, 0.16478231549263, -...
func (c *Client) Create(in *CreateInput) (*CreateOutput, error) { b, err := json.Marshal(in) if err != nil { return nil, errors.Wrap(err, "marshaling input") } res, err := http.Post(c.Endpoint+"/poll", "application/json", bytes.NewReader(b)) if err != nil { return nil, errors.Wrap(err, "creating request") } ...
[ -0.4448102116584778, 0.20222602784633636, 0.8074178099632263, 0.7316246032714844, -0.2284848988056183, 0.3246675729751587, -0.5602515935897827, -1.2231636047363281, -0.24631842970848083, 0.22791005671024323, -0.02298256754875183, -0.44689711928367615, -1.1064567565917969, -0.01472626999020...
func NewMockSession(ctrl *gomock.Controller) *MockSession { mock := &MockSession{ctrl: ctrl} mock.recorder = &MockSessionMockRecorder{mock} return mock }
[ -0.3151123523712158, -0.07651207596063614, 0.2940923571586609, 0.4124021828174591, 0.4851359724998474, 0.09113538265228271, 0.4993702471256256, -1.3258861303329468, 0.9310390949249268, 0.136416494846344, -0.9165335893630981, 0.03795432671904564, -0.35924825072288513, 0.9296691417694092, ...
func (m *MockSession) EXPECT() *MockSessionMockRecorder { return m.recorder }
[ -0.13032115995883942, -0.24472756683826447, 0.3443323075771332, 0.40053659677505493, -0.03537876158952713, 0.014399180188775063, 0.17441809177398682, -0.21717888116836548, 1.2914254665374756, -0.0655088946223259, 0.611242413520813, 0.6089757084846497, -0.4588329493999481, 0.324506819248199...
func (m *MockSession) Close() { m.ctrl.T.Helper() m.ctrl.Call(m, "Close") }
[ -0.7393052577972412, 0.22455677390098572, 0.4526553452014923, 0.9941191673278809, 0.9370023012161255, 0.8226270079612732, 0.9259217977523804, -0.7015447020530701, -0.12440874427556992, 0.32437318563461304, 0.46020784974098206, -1.1241778135299683, -0.7462289929389954, 1.601289987564087, ...
func (mr *MockSessionMockRecorder) Close() *gomock.Call { mr.mock.ctrl.T.Helper() return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Close", reflect.TypeOf((*MockSession)(nil).Close)) }
[ -0.294880211353302, 0.49964120984077454, 0.27353742718696594, 0.5153918862342834, -0.1781095713376999, 0.5851207971572876, -0.025333385914564133, -1.4268367290496826, 0.6838410496711731, 0.5029482841491699, 1.1058917045593262, 0.2482861876487732, -1.500221610069275, 1.7542277574539185, 0...
func (m *MockSession) Execute(arg0 context.Context, arg1 string) ([]sqlexec.RecordSet, error) { m.ctrl.T.Helper() ret := m.ctrl.Call(m, "Execute", arg0, arg1) ret0, _ := ret[0].([]sqlexec.RecordSet) ret1, _ := ret[1].(error) return ret0, ret1 }
[ -0.7505831718444824, -0.4148179590702057, 0.627649188041687, 1.0655268430709839, 0.8515798449516296, 0.32093366980552673, 0.338189035654068, -0.3285311460494995, -0.8438172936439514, 0.4029177129268646, -0.6194614768028259, -0.9967761039733887, -0.3915250897407532, 0.21007166802883148, 0...
func (mr *MockSessionMockRecorder) Execute(arg0, arg1 interface{}) *gomock.Call { mr.mock.ctrl.T.Helper() return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Execute", reflect.TypeOf((*MockSession)(nil).Execute), arg0, arg1) }
[ -0.15182068943977356, 0.056186776608228683, 0.4475170075893402, 0.7278794646263123, 0.16190722584724426, 0.2543962001800537, -0.9935110211372375, -0.9983367919921875, 0.5433628559112549, 1.086928129196167, 0.40585944056510925, 0.2257443219423294, -0.684330940246582, 0.9402567744255066, -...
func (m *MockSession) CommitTxn(arg0 context.Context) error { m.ctrl.T.Helper() ret := m.ctrl.Call(m, "CommitTxn", arg0) ret0, _ := ret[0].(error) return ret0 }
[ -0.519287645816803, -1.0339194536209106, 0.05156268924474716, -0.13434231281280518, 1.4445987939834595, 0.32919973134994507, 0.8968769907951355, -0.1784985065460205, -0.8971113562583923, 0.3457600474357605, -0.25721475481987, -1.2517675161361694, -0.8427041172981262, 0.6986414194107056, ...
func (mr *MockSessionMockRecorder) CommitTxn(arg0 interface{}) *gomock.Call { mr.mock.ctrl.T.Helper() return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "CommitTxn", reflect.TypeOf((*MockSession)(nil).CommitTxn), arg0) }
[ -0.23637427389621735, -0.30033886432647705, 0.09884309023618698, -0.11243313550949097, 0.42049264907836914, 0.3991129696369171, -0.15375983715057373, -0.5682591199874878, 0.3067922592163086, 1.092394232749939, 0.2694951295852661, -0.4167882204055786, -0.7254498600959778, 0.8062806129455566...
func (m *MockSession) RollbackTxn(arg0 context.Context) { m.ctrl.T.Helper() m.ctrl.Call(m, "RollbackTxn", arg0) }
[ -0.19179527461528778, -0.5137508511543274, 0.19263118505477905, -0.047574032098054886, 1.5493673086166382, -0.14189891517162323, 0.4218143820762634, 0.682043731212616, -0.6045864820480347, -0.3179985284805298, -0.4076324999332428, -0.5617407560348511, -1.054360270500183, -0.138246521353721...
func (mr *MockSessionMockRecorder) RollbackTxn(arg0 interface{}) *gomock.Call { mr.mock.ctrl.T.Helper() return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "RollbackTxn", reflect.TypeOf((*MockSession)(nil).RollbackTxn), arg0) }
[ 0.2327648103237152, 0.041428547352552414, 0.23617930710315704, -0.29965585470199585, 0.8532021641731262, -0.10668716579675674, -0.45497366786003113, -0.01895705796778202, 0.08732223510742188, 0.788229763507843, 0.09170809388160706, 0.4377797842025757, -1.0929933786392212, 0.031809020787477...
func (m *MockSession) PrepareStmt(sql string) (uint32, int, []*ast.ResultField, error) { m.ctrl.T.Helper() ret := m.ctrl.Call(m, "PrepareStmt", sql) ret0, _ := ret[0].(uint32) ret1, _ := ret[1].(int) ret2, _ := ret[2].([]*ast.ResultField) ret3, _ := ret[3].(error) return ret0, ret1, ret2, ret3 }
[ -0.8336074948310852, 0.2231627106666565, 0.24564002454280853, 0.4668711721897125, 0.4236365556716919, -0.31435176730155945, 0.7986099720001221, -0.9107916951179504, -0.4544261693954468, 0.07665218412876129, -0.950261116027832, -1.2499593496322632, -0.15717007219791412, 1.1258710622787476, ...
func (mr *MockSessionMockRecorder) PrepareStmt(sql interface{}) *gomock.Call { mr.mock.ctrl.T.Helper() return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "PrepareStmt", reflect.TypeOf((*MockSession)(nil).PrepareStmt), sql) }
[ -0.12649336457252502, 0.7225306034088135, 0.2549085319042206, 0.2674838900566101, -0.35681965947151184, 0.10085956007242203, -0.34989991784095764, -1.0820918083190918, 1.190755009651184, 0.8193972110748291, 0.2314072847366333, 0.21819348633289337, -0.3455602526664734, 1.467239499092102, ...
func (m *MockSession) ExecutePreparedStmt(ctx context.Context, stmtID uint32, param []types.Datum) (sqlexec.RecordSet, error) { m.ctrl.T.Helper() ret := m.ctrl.Call(m, "ExecutePreparedStmt", ctx, stmtID, param) ret0, _ := ret[0].(sqlexec.RecordSet) ret1, _ := ret[1].(error) return ret0, ret1 }
[ -0.591550886631012, -0.09325402975082397, 0.24168699979782104, 0.5645977854728699, 0.8043173551559448, 0.34812235832214355, 0.6540742516517639, -0.6556738615036011, -0.6259024739265442, 0.039978399872779846, -0.9671476483345032, -0.4516059160232544, 0.028857626020908356, 0.4204088449478149...
func (mr *MockSessionMockRecorder) ExecutePreparedStmt(ctx, stmtID, param interface{}) *gomock.Call { mr.mock.ctrl.T.Helper() return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ExecutePreparedStmt", reflect.TypeOf((*MockSession)(nil).ExecutePreparedStmt), ctx, stmtID, param) }
[ -0.28961753845214844, 0.49672701954841614, 0.3020082712173462, 0.551509439945221, -0.21416017413139343, 0.6236905455589294, -0.5840457677841187, -1.1853281259536743, 0.7978801727294922, 0.8646499514579773, -0.45923641324043274, 0.1932118982076645, -0.027184056118130684, 0.6881312131881714,...
func (m *MockSession) DropPreparedStmt(stmtID uint32) error { m.ctrl.T.Helper() ret := m.ctrl.Call(m, "DropPreparedStmt", stmtID) ret0, _ := ret[0].(error) return ret0 }
[ -0.7018703818321228, -0.255344420671463, -0.21501639485359192, 0.20729927718639374, 0.5056484341621399, 0.413224458694458, 0.3092677593231201, -0.699918270111084, -1.1513512134552002, 0.1279096156358719, -0.9408236145973206, -0.49688103795051575, -0.6083586812019348, 0.928525984287262, 0...
func (mr *MockSessionMockRecorder) DropPreparedStmt(stmtID interface{}) *gomock.Call { mr.mock.ctrl.T.Helper() return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "DropPreparedStmt", reflect.TypeOf((*MockSession)(nil).DropPreparedStmt), stmtID) }
[ -0.6048227548599243, 0.506645143032074, 0.24735216796398163, 0.16294869780540466, -0.2530730664730072, 0.6581289768218994, -0.8045154809951782, -0.7837464213371277, 0.3203432261943817, 0.4931180477142334, -0.4089113771915436, 0.1982414275407791, -0.5514122247695923, 0.82198166847229, -0....
func UserCabV1Routes(router *gin.Engine) { loginRouter := router.Group("/v1/new") { //for new user login loginRouter.POST("login", newUserLogin) } userRouter := router.Group("/v1/user") { userRouter.Use(ValidateUserRequestAndFetchUser()) //user can book a cab userRouter.POST("/book", book...
[ -0.4096451997756958, 0.12628325819969177, 0.5940053462982178, 1.9447137117385864, -0.16167110204696655, 0.8121200799942017, 0.44109687209129333, -0.5774253010749817, 0.15597791969776154, 0.20484982430934906, -0.4631026089191437, 0.3316042721271515, 0.8186351656913757, 0.5053452849388123, ...
func newUserLogin(c *gin.Context){ var userInfo models.UserInfo c.BindJSON(&userInfo) fmt.Printf("\n user existring %+v %+v", userInfo.Name, userInfo.MobileNumber) existingUser, existingUserErr := db.GetUserInfo(userInfo.Name, userInfo.MobileNumber) if existingUserErr == nil { fmt.Printf("\n user existrin...
[ -0.31274059414863586, -0.8850077390670776, 0.8049298524856567, 0.23393404483795166, -0.5842832326889038, 0.45471876859664917, -0.4239627718925476, -0.6143522262573242, -0.09930281341075897, 0.22792203724384308, -1.1862181425094604, -0.23040498793125153, 0.08471301943063736, 0.0019193550106...
func bookCab(c *gin.Context){ var pickup models.UserPickup bindErr := c.BindJSON(&pickup) if bindErr != nil { fmt.Printf("\n findCab 1 %+v\n", bindErr) utils.SendError(c, 200, utils.APP_ERROR_INVALID_PAYLOAD) return } user, ok := getUserFromSession(c) if ok { //fmt.Printf("\n data binded succe...
[ -0.5678706765174866, -1.1895238161087036, 1.0728809833526611, 0.9658751487731934, -0.08153514564037323, 1.1346726417541504, 1.0209132432937622, -0.5657574534416199, 0.0966750904917717, 0.6192466020584106, -0.20963115990161896, -0.15141631662845612, 0.2881323993206024, 0.44950973987579346, ...
func quicksort(result []models.CabInfo, leftIndex int, rightIndex int) { if leftIndex >= rightIndex { return } pivot := result[rightIndex].Distance cnt := leftIndex for i := leftIndex; i <= rightIndex; i++ { if result[i].Distance <= pivot { swap(&result[cnt], &result[i]) cnt++ } } quicksort(resul...
[ -0.15549318492412567, -0.050478365272283554, 0.6510809659957886, -0.16399240493774414, 0.2405482977628708, 0.20816877484321594, -0.20926186442375183, -1.2105743885040283, -0.1272457391023636, -0.47862154245376587, -1.047882318496704, -0.461553156375885, -0.6314675807952881, -0.166032299399...
func swap(a *models.CabInfo, b *models.CabInfo) { temp := *a *a = *b *b = temp }
[ -1.564223289489746, -1.110036015510559, 0.5404874682426453, 0.09690266847610474, 0.22599509358406067, 0.39513641595840454, -0.22886817157268524, 0.11401382833719254, -1.037378191947937, -0.55665123462677, -0.19922888278961182, 0.3498619794845581, 0.6509107947349548, -0.36255571246147156, ...
func CalculateDistance(wg *sync.WaitGroup, currentlyAvailableCabs *[]models.CabInfo, index int, userLat float64, userLong float64) { // convert to radians // must cast radius as float to multiply later var la1, lo1, la2, lo2, r float64 la1 = userLat * math.Pi / 180 lo1 = userLong * math.Pi / 180 la2 = (*currentl...
[ -0.38856062293052673, -1.0096538066864014, 0.6627740263938904, 0.45462313294410706, -0.4909170866012573, 0.8170836567878723, 0.8196049332618713, -0.07335469871759415, 0.21085292100906372, 0.3600352704524994, -0.5630351305007935, -0.009809029288589954, -0.01948125660419464, 0.10394268482923...
func getUserRides(c *gin.Context){ userId := c.GetString("user_id") rideDetailsForUser, rideDetailsForUserErr := db.GetRideDetailsForUser(userId) if rideDetailsForUserErr != nil { utils.PrintStackTrace("\n getUserRides 1 %+v", rideDetailsForUserErr) utils.SendError(c, 200, utils.APP_ERROR_SERVER) ret...
[ 0.290078341960907, 0.42160919308662415, 0.6170230507850647, 0.7232396602630615, 0.2451508492231369, 0.5782212018966675, 0.3385714292526245, -1.265629529953003, -0.46264350414276123, -0.5691079497337341, -0.15048231184482574, 0.8548134565353394, -0.3996139466762543, 0.7659249901771545, 0....
func API(shutdowns chan os.Signal, logger *log.Logger, authenticator *auth.Authenticator) http.Handler { app := web.NewApp(shutdowns, logger, mid.Logger(logger), mid.Errors(logger), mid.Metrics(logger), mid.Panics(logger)) { h := Heartbeat{} app.Handle(http.MethodGet, "/heart", h.Health) } { // Register user...
[ -0.433072954416275, -0.491205096244812, 0.7858129739761353, 1.0031245946884155, 0.030613163486123085, 0.30264103412628174, 0.7718571424484253, -0.9330952763557434, 0.9673639535903931, -0.1760624498128891, -0.2607283592224121, 0.2618894577026367, 0.6732757091522217, 0.03444990515708923, 0...
func startHandler(r *http.Request) (interface{}, HTTPError) { // Spin up a container info, err := startContainer(image) if err != nil { return nil, err } return StartResponse{ Endpoint: info.IP + ":" + servicePort, ContainerID: info.ID, }, nil }
[ -0.38479891419410706, -0.6430354714393616, 0.48122814297676086, 0.2339911311864853, 0.08900988101959229, -0.6358380913734436, 0.5244662165641785, 0.2843770384788513, 0.31378182768821716, -0.23743990063667297, 0.34013625979423523, -0.35709500312805176, -0.6673782467842102, 0.588099956512451...
func ObterValorPedido(pedidoMagento string) (valorPedido string, valorPago string, erro error) { pedido := models.ObterPedido(pedidoMagento) if pedido.ID == 0 { return "", "", errors.New("Pedido não encontrado") } var valorPedidoFloat float64 = (float64(pedido.Valor) * multiplicador) var valorPagoFloat float64...
[ 0.7657342553138733, -0.5245019197463989, 0.7269427180290222, -0.2353387475013733, -0.6642423868179321, 0.6587818264961243, -0.030598526820540428, -0.32454347610473633, -0.06098746880888939, 0.39924222230911255, 0.4310765862464905, -0.02838924154639244, 0.03617972135543823, 0.89237153530120...
func NewDoubleLinkedList() DoubleLinkedList { head := &DoubleLinkedNode{} return &doubleLinkedList{ head: head, last: head, } }
[ -0.04331641271710396, -0.5672831535339355, 0.45108702778816223, -0.46210724115371704, -0.46349260210990906, -0.3346029818058014, -0.16482329368591309, -0.4851221442222595, 0.15367943048477173, 0.09237043559551239, -1.5045013427734375, 0.742974042892456, 0.22461117804050446, -0.015424206852...
func NewAttributeChangeSet(mappings ast.AttributeMap) *AttributeChangeSet { attr := &AttributeChangeSet{ updates: make(map[string]string, len(mappings)), rollback: make(map[string]string, len(mappings)), } for k, v := range mappings { attr.updates[k] = v attr.rollback[v] = k } return attr }
[ -0.5504399538040161, -0.8115774393081665, 0.21960526704788208, -0.6479348540306091, -1.7156767845153809, -0.6442822813987732, -0.014913960359990597, 0.5489334464073181, 0.008299910463392735, 0.4854670763015747, 0.41029006242752075, 0.2784801125526428, 0.31267794966697693, 0.040586609393358...
func NewAttributeChangeSetSlice(changes ...*AttributeChangeSet) *AttributeChangeSetSlice { values := new(AttributeChangeSetSlice) for _, c := range changes { (*values) = append((*values), c) } return values }
[ -0.7754808068275452, -0.5503363013267517, 0.03374190255999565, 0.10218510776758194, -0.5067675113677979, 0.06675443798303604, -0.6521751284599304, -0.9598425626754761, -0.6471887230873108, 0.31192123889923096, 0.21883328258991241, 0.4844244122505188, 0.9447133541107178, 0.5014643669128418,...
func NewDAO(dataSource string) (*DAO, error) { conn, err := sql.Open("postgres", dataSource) if err != nil { return nil, errors.Wrapf(err, "failed to open connection with CockroachDB") } ctx, cancel := context.WithTimeout(ctx, 3*time.Second) defer cancel() if err = conn.PingContext(ctx); err != nil { conn.Cl...
[ 0.950003981590271, 0.412675142288208, 0.6599381566047668, 0.09285915642976761, -0.7266032099723816, -0.5071282386779785, 0.22265899181365967, 0.4372612535953522, -0.16889235377311707, 0.1736343652009964, -0.3296984136104584, 0.5971630811691284, 0.10385040938854218, -0.4870554506778717, 0...
func (c Config) IsZero() bool { return c.Token == "" || c.Email == "" }
[ -0.5743750929832458, -0.09650472551584244, 0.11789964139461517, 0.5101636648178101, 0.6197115182876587, 0.04729064553976059, -1.0155342817306519, 0.7774400115013123, -0.25744667649269104, 0.25550511479377747, -0.4340014159679413, 0.6424515247344971, -1.0848965644836426, 0.4991302490234375,...
func (c *Config) Resolve(ctx context.Context) error { return configutil.Resolve(ctx, configutil.SetString(&c.Addr, configutil.String(c.Addr), configutil.String(DefaultAddr)), ) }
[ 0.07826131582260132, 0.485969215631485, 0.3980446755886078, -0.30324631929397583, 0.9732086658477783, -0.4618736207485199, -0.7087940573692322, 0.31010696291923523, -0.5442976355552673, 0.11267802864313126, -0.6585385203361511, 0.07247378677129745, -0.5731655359268188, 0.04650415480136871,...
func (_m *MessageMain) AddMessage(senderId string, msg types.Message) error { ret := _m.Called(senderId, msg) var r0 error if rf, ok := ret.Get(0).(func(string, types.Message) error); ok { r0 = rf(senderId, msg) } else { r0 = ret.Error(0) } return r0 }
[ -1.1394193172454834, 0.21138781309127808, 0.600237250328064, 0.9495265483856201, -0.3300444185733795, -0.6013990640640259, 0.18239636719226837, 0.16893501579761505, 0.11424541473388672, -0.31736820936203003, 0.7209484577178955, -0.7927690744400024, -0.3935520350933075, 1.6839953660964966, ...
func (_m *MessageMain) GetHandler() types.Handler { ret := _m.Called() var r0 types.Handler if rf, ok := ret.Get(0).(func() types.Handler); ok { r0 = rf() } else { if ret.Get(0) != nil { r0 = ret.Get(0).(types.Handler) } } return r0 }
[ -0.3733726143836975, 0.2516573369503021, 0.544421374797821, 0.876037061214447, 0.3434731662273407, -0.31797003746032715, 1.243979811668396, 0.5229935646057129, -0.13028211891651154, -0.7017159461975098, 0.1100199818611145, 0.3252740800380707, -0.41212090849876404, 0.5928285717964172, 0.7...
func (_m *MessageMain) GetState() types.MainState { ret := _m.Called() var r0 types.MainState if rf, ok := ret.Get(0).(func() types.MainState); ok { r0 = rf() } else { r0 = ret.Get(0).(types.MainState) } return r0 }
[ 0.2217947244644165, 0.5730765461921692, 0.663831889629364, 0.7213661670684814, 0.20024468004703522, -0.18996647000312805, 1.1405870914459229, 0.42658522725105286, 0.6543057560920715, -0.5580225586891174, 0.07222520560026169, 0.4595493972301483, -0.6348363757133484, 0.5430436134338379, 0....
func (_m *MessageMain) Start() { _m.Called() }
[ -0.09837751090526581, -0.0077849626541137695, 0.2907211184501648, 0.6212124228477478, 0.18240509927272797, 0.19108323752880096, 1.1798149347305298, 0.4556499123573303, -0.6100459098815918, 0.5385910868644714, -0.7989766001701355, 1.4501014947891235, 0.13257856667041779, 0.26570284366607666...
func (_m *MessageMain) Stop() { _m.Called() }
[ -1.0590301752090454, 0.07874410599470139, 0.37345364689826965, 0.08211477100849152, 0.1998930275440216, 0.6479406356811523, 1.429763913154602, 0.2466990053653717, -0.8432227373123169, 0.9940482378005981, -0.4609961211681366, 0.9016737341880798, -0.37776049971580505, -0.15936265885829926, ...
func NewMessageMain(t testing.TB) *MessageMain { mock := &MessageMain{} mock.Mock.Test(t) t.Cleanup(func() { mock.AssertExpectations(t) }) return mock }
[ -0.6079913973808289, -0.78889399766922, 0.3129204213619232, -0.3454037010669708, -0.5226346254348755, 0.6095246076583862, -0.2967384159564972, -0.16553212702274323, 0.15051382780075073, 0.3836005628108978, -0.5911011099815369, -0.2268323451280594, -0.8776573538780212, 1.2088356018066406, ...
func (w *WorkerContext) Log(job *work.Job, next work.NextMiddlewareFunc) error { golog.Infof("Starting job from queue %s with ID %s", job.Name, job.ID) return next() }
[ 0.12829020619392395, 0.23668578267097473, 0.2521497309207916, -0.1949443519115448, -0.8975135087966919, -0.025948526337742805, 0.008492535911500454, -0.03279772400856018, 0.18646343052387238, -0.3087511360645294, -1.2348507642745972, 0.36491623520851135, 0.037206053733825684, 0.09870587289...
func GetEquationOfCenter(anomaly float64) float64 { // The numbers being multiplied below are coefficients for the Equation of Center for Earth var anomalyInRad float64 anomalyInRad = anomaly * (math.Pi/180) return 1.9148 * (math.Sin(anomalyInRad)) + 0.0200 * math.Sin(2 * anomalyInRad) + 0.0003 * math.Sin(3 * anoma...
[ 0.47063544392585754, -0.5765455365180969, 0.5080298185348511, -0.7260333895683289, 0.016336483880877495, 0.11808262765407562, 0.7447881102561951, -0.13992726802825928, 1.3680760860443115, 0.5833243727684021, 0.536029040813446, -0.002774337772279978, 0.5731726884841919, 0.08119060099124908,...
func NewRelPath(components ...string) RelPath { return RelPath(filepath.Join(components...)) }
[ 1.0278853178024292, -0.9552769660949707, 0.18816286325454712, 0.289186030626297, -0.7209727168083191, 0.9882035851478577, -0.1637805700302124, 0.16914014518260956, 0.07265405356884003, 0.2777056396007538, 0.24139279127120972, -0.2327641099691391, -0.7246549725532532, -0.5873349905014038, ...
func (rp RelPath) Abs(x *X) string { return filepath.Join(x.Root, string(rp)) }
[ 0.24521726369857788, -0.9971434473991394, 0.5566797852516174, -0.21254561841487885, -0.2256586104631424, 1.6002349853515625, -0.9589813351631165, -0.35358935594558716, -0.09834446758031845, 0.4678938686847687, 0.7090969085693359, 0.6088804602622986, 0.37130871415138245, -0.1411545872688293...
func (rp RelPath) Join(components ...string) RelPath { path := append([]string{string(rp)}, components...) return RelPath(filepath.Join(path...)) }
[ 1.187147855758667, -0.738548994064331, 0.4568668603897095, -0.10657785832881927, 0.31941598653793335, 1.6374715566635132, -0.2268625944852829, 0.3697299659252167, 0.028081625699996948, 0.12748543918132782, 0.08718889206647873, -0.6869235038757324, -1.0598493814468384, -0.8665984869003296, ...
func (rp RelPath) Symbolic() string { root := "${" + RootEnv + "}" if string(rp) == "" { return root } return root + string(filepath.Separator) + string(rp) }
[ 0.3244243860244751, 0.4986984431743622, 0.38362589478492737, -0.12132348865270615, 0.6322842240333557, -0.12280026078224182, 0.16217723488807678, -0.29598402976989746, -0.07035376131534576, 0.5954174995422363, 0.23500432074069977, 0.48116251826286316, 0.5188703536987305, -0.399359345436096...
func ExpandEnv(x *X, env *envvar.Vars) { e := env.ToMap() rootEnv := "${" + RootEnv + "}" for k, v := range e { n := strings.Replace(v, rootEnv, x.Root, -1) if n != v { env.Set(k, n) } } }
[ -0.05130186304450035, -0.2544110119342804, 0.7347482442855835, 0.46011796593666077, -0.16532959043979645, 0.255942702293396, -0.3753650188446045, 0.6428210735321045, -0.028956785798072815, 0.40800926089286804, -0.03284718468785286, 1.1190441846847534, -0.11848413944244385, 1.07647109031677...
func (t *Tree) print(prefix string, root *leaf) { if root == nil { for m := range t.nodes { fmt.Println(m) t.print("", t.nodes[m]) } return } prefix = fmt.Sprintf("%s -> %s", prefix, root.pattern) fmt.Println(prefix) root.children = append(root.children, root.paramChild) root.children = append(root.ch...
[ 0.8045677542686462, -0.046924274414777756, 0.8235698938369751, -0.3298197388648987, -0.3484090268611908, -0.24879132211208344, -0.8119805455207825, 0.2893088459968567, -0.0883437916636467, -0.10990589112043381, 0.4040496051311493, 1.0806940793991089, 0.030718419700860977, 0.834510266780853...
func NewTRANSMITSMS(username string, password string) TRANSMITSMS { transmitSMSClient := new(TRANSMITSMS_IMPL) transmitSMSClient.config = configuration_pkg.NewCONFIGURATION() transmitSMSClient.config.SetUsername(username) transmitSMSClient.config.SetPassword(password) return transmitSMSClient }
[ 0.4154454469680786, 0.008740101009607315, 0.3661283552646637, -0.6356565356254578, -0.6140091419219971, -0.7037763595581055, 0.23806872963905334, -0.12972113490104675, 0.36355406045913696, 0.48087823390960693, -0.6114513874053955, 0.309827595949173, -0.907997727394104, -0.35177725553512573...
func NewDeviceService(cache infrastructure.CacheService, repository bbq.DeviceRepository) bbq.DeviceService { return &deviceService{repository: repository, cache: cache} }
[ -0.9265521764755249, 0.5228438377380371, -0.018247073516249657, -0.12433309853076935, 0.012753214687108994, -0.3596227169036865, -0.6084262132644653, -0.7273543477058411, 0.3136354684829712, -0.13722524046897888, -0.1575251668691635, 0.6698544025421143, -0.2660121023654938, 0.7546508312225...
func (o *GetNvmfNamespaceSnapshotsReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { switch response.Code() { case 200: result := NewGetNvmfNamespaceSnapshotsOK() if err := result.readResponse(response, consumer, o.formats); err != nil { return nil, err } ...
[ -0.048525430262088776, -0.6840057969093323, 0.554600715637207, 0.35781344771385193, -0.3412337005138397, -1.0114667415618896, -0.134053573012352, -0.6233153343200684, 0.7627922296524048, 0.13562415540218353, 0.24911324679851532, -0.679452657699585, -0.6959630250930786, 0.10919509828090668,...
func NewGetNvmfNamespaceSnapshotsOK() *GetNvmfNamespaceSnapshotsOK { return &GetNvmfNamespaceSnapshotsOK{} }
[ -0.2188035398721695, 0.7488322257995605, 0.029954904690384865, 1.4880632162094116, -0.8728885054588318, -0.5746003985404968, -0.2376544177532196, -0.6282477378845215, 0.45808449387550354, -0.19199898838996887, -0.5821831822395325, -0.26343291997909546, 0.4108463525772095, 0.147863283753395...
func NewGetNvmfNamespaceSnapshotsBadRequest() *GetNvmfNamespaceSnapshotsBadRequest { return &GetNvmfNamespaceSnapshotsBadRequest{} }
[ -0.3406541645526886, 0.19682160019874573, 0.6124971508979797, 1.3298214673995972, -0.39477506279945374, -0.2380407303571701, -0.22010810673236847, -0.6291700601577759, 0.21742238104343414, -0.3698924779891968, 0.0649218037724495, 0.7234148979187012, -0.11033639311790466, 0.4917232394218445...
func NewGetNvmfNamespaceSnapshotsNotFound() *GetNvmfNamespaceSnapshotsNotFound { return &GetNvmfNamespaceSnapshotsNotFound{} }
[ -0.3075641095638275, 0.05683688819408417, -0.16430000960826874, 0.6109127402305603, 0.022624580189585686, 0.5680204033851624, -0.04367653653025627, -0.6685922145843506, 0.44363683462142944, -0.8633469939231873, -0.7018638849258423, -0.14731471240520477, -0.4958277940750122, 0.5203491449356...
func NewDispatcher() *Dispatcher { return &Dispatcher{ identities: make(map[string]*Identity), } }
[ 0.23321448266506195, -1.199038028717041, 0.13168296217918396, 0.4031211733818054, -0.1521659940481186, 0.4394974112510681, -0.821076512336731, 0.23346319794654846, 0.5376245379447937, -1.089026927947998, -1.0427474975585938, -0.7503198385238647, 0.4533727765083313, 1.0022852420806885, 0....
func New(d *Dispatcher) *Identity { d.Lock() defer d.Unlock() state := randToken() i := &Identity{ state: state, } d.identities[state] = i return i }
[ -1.0665993690490723, -0.7966038584709167, 0.33817192912101746, -0.36681175231933594, -0.5255854725837708, 0.3188757598400116, 0.005851661786437035, -0.18968607485294342, 0.5041861534118652, -0.5963773131370544, -1.6534415483474731, -0.35576102137565613, 0.9106723070144653, -0.3191999495029...
func (d *Dispatcher) Handle(state string, code string) (*models.User, *oauth2.Token, error) { d.RLock() identity, ok := d.identities[state] d.RUnlock() if !ok { return nil, nil, fmt.Errorf("invalid SCRF token: %s", state) } err := identity.Handle(state, code) d.Lock() delete(d.identities, state) d.Unlock() ...
[ -0.5122649669647217, 0.35403603315353394, 0.5401429533958435, 0.512074887752533, 0.35627421736717224, -0.12538810074329376, -0.47683122754096985, -0.2771693766117096, 0.8632979393005371, -0.8044715523719788, -0.35595202445983887, -0.05997825041413307, -0.19246043264865875, -0.8180822730064...
func RegisterNewDriver(driver string, defaultscopes []string, callback func(client *http.Client, u *models.User), endpoint oauth2.Endpoint, apimap, usermap map[string]string) { apiMap[driver] = apimap userMap[driver] = usermap endpointMap[driver] = endpoint callbackMap[driver] = callback defaultScopesMap[driver] =...
[ -1.5796704292297363, -0.40164709091186523, 0.3303607404232025, 0.545279860496521, 0.33934178948402405, -0.4429835081100464, -0.5571979880332947, 0.33940955996513367, 0.5122028589248657, -0.16186757385730743, -0.5360172390937805, 0.2284540981054306, -0.6490997076034546, 0.6914247274398804, ...
func (i *Identity) Driver(driver string) *Identity { i.driver = driver i.scopes = defaultScopesMap[driver] if i.state == "" { i.state = randToken() } return i }
[ -1.6863341331481934, -0.12726566195487976, 0.23189933598041534, 0.11831077933311462, 0.5096692442893982, 0.4629829525947571, 0.13338229060173035, 0.08634945005178452, 1.8714169263839722, -0.25081542134284973, -0.7028171420097351, -0.25056248903274536, -0.41738051176071167, -0.3245164752006...
func (i *Identity) Scopes(scopes []string) *Identity { i.scopes = append(i.scopes, scopes...) return i }
[ -1.18059241771698, 0.1247231513261795, 0.436055064201355, 0.34445270895957947, 0.4169353246688843, 0.7355756759643555, -0.9143670201301575, -0.2922699749469757, 1.8157057762145996, 0.26892510056495667, -0.6849709749221802, 0.3189416527748108, -0.6263224482536316, -0.4635741710662842, -0....
func (i *Identity) Redirect(clientID, clientSecret, redirectURL string) (string, error) { // check if driver is valid if !isDriverValid(i.driver) { return "", fmt.Errorf("Driver not valid: %s", i.driver) } // check if redirectURL is valid _, err := url.ParseRequestURI(redirectURL) if err != nil { return "", f...
[ -0.7924912571907043, -0.54927659034729, 0.6719677448272705, 0.12924808263778687, -0.6704990267753601, 0.22569699585437775, 0.018872899934649467, -0.28298836946487427, 0.7511282563209534, 0.03342330455780029, 0.8485284447669983, 0.7675840854644775, -0.30869999527931213, -0.49040544033050537...
func (i *Identity) Handle(state, code string) error { // Handle the exchange code to initiate a transport if i.state != state { return fmt.Errorf("Invalid state : %s", state) } //check if driver is valid if !isDriverValid(i.driver) { return fmt.Errorf("Driver not valid: %s", i.driver) } token, err := i.cfg....
[ -0.9284484386444092, 0.2747437357902527, 0.9034916162490845, -0.22083745896816254, 0.15829752385616302, -0.3083150088787079, 0.18986566364765167, 0.07642051577568054, 0.7630003690719604, -0.20906610786914825, -0.19549092650413513, -0.0822388082742691, -0.3089829981327057, -0.61331844329833...
func jsonDecode(js []byte) (map[string]interface{}, error) { var decoded map[string]interface{} if err := json.Unmarshal(js, &decoded); err != nil { return nil, err } return decoded, nil }
[ -0.46154338121414185, -1.1488252878189087, 0.8745513558387756, -0.7351072430610657, -1.2832626104354858, -1.0164434909820557, -0.5518019795417786, -0.012871903367340565, 1.1099811792373657, -0.1239595040678978, -0.8460816144943237, 0.10922979563474655, 0.15072797238826752, 0.47719889879226...
func keys(m map[string]string) []string { var keys []string for k := range m { keys = append(keys, k) } return keys }
[ -0.8118677139282227, -0.2987425923347473, -0.03017631731927395, -0.22563211619853973, -0.39960429072380066, 0.42470166087150574, -1.6323012113571167, 0.23507630825042725, -0.3257615566253662, 0.7701353430747986, 0.5371901392936707, 0.12764734029769897, -0.39793941378593445, 0.2037694007158...
func complexKeys(m map[string]map[string]string) []string { var keys []string for k := range m { keys = append(keys, k) } return keys }
[ -0.7297746539115906, -1.3404885530471802, 0.2875622808933258, 0.7061071395874023, -0.04027115926146507, -0.21184121072292328, -0.6250609159469604, 0.7432136535644531, -0.573203444480896, 1.0455965995788574, -0.0809393897652626, 0.10940109193325043, -0.6748438477516174, -0.5093777775764465,...
func inSlice(v string, s []string) bool { for _, scope := range s { if scope == v { return true } } return false }
[ 0.016003457829356194, -1.1451760530471802, 0.5109106302261353, -0.3271481394767761, -0.7103748321533203, -0.8776391744613647, -0.9566062092781067, 0.4921405613422394, 0.020326394587755203, 1.0735235214233398, -0.20955519378185272, 0.5832555294036865, -0.841334879398346, -0.287798672914505,...
func randToken() string { ba := make([]byte, 32) rand.Read(ba) return base64.StdEncoding.EncodeToString(ba) }
[ 0.36717915534973145, -0.10013771057128906, 0.28179556131362915, -0.07713271677494049, -0.13185107707977295, 0.6864959001541138, -0.7665263414382935, 0.7897864580154419, 0.6004484295845032, -0.3164423704147339, -0.35772693157196045, 0.646159827709198, -0.26296067237854004, -0.17694707214832...
func (c Cents) Float64() float64 { return float64(c) }
[ 0.2715584635734558, 0.7006204724311829, 0.150648295879364, -0.297014445066452, 0.9349376559257507, 0.16934366524219513, -0.14881198108196259, -0.5443681478500366, -0.38271620869636536, -0.7751185297966003, 0.16078196465969086, -0.9418075680732727, -0.8161328434944153, 0.7454657554626465, ...
func (c Cents) Multiply(i int) Cents { return Cents(i * c.Int()) }
[ -1.1244665384292603, 0.6145662665367126, 0.19401763379573822, -0.8863564133644104, 0.2664262056350708, 0.34795069694519043, -0.6788375377655029, -1.3946548700332642, 0.3361523747444153, -0.41040605306625366, -0.6642754077911377, -1.5990471839904785, -1.1998786926269531, -0.5203602910041809...
func (c Cents) MultiplyMiles(d Miles) Cents { return c.Multiply(d.Int()) }
[ -1.2131820917129517, 1.1795886754989624, -0.03956282511353493, -1.2716450691223145, -0.23923416435718536, -0.22737841308116913, -1.251787781715393, -0.7153840065002441, 0.7260873913764954, -0.18644458055496216, -0.05698240175843239, -1.0383130311965942, -0.7606722116470337, -0.195486590266...
func (c Cents) AddCents(a Cents) Cents { return Cents(c.Int() + a.Int()) }
[ -0.10010482370853424, 0.1270616352558136, 0.19775937497615814, -1.2201006412506104, -0.4157375395298004, 0.07253435999155045, -0.7901097536087036, -1.4811487197875977, 0.8432860374450684, -0.5098544359207153, 0.8173258900642395, -0.33870694041252136, -0.7938227653503418, 0.1567407846450805...
func (c Cents) MultiplyFloat64(f float64) Cents { return Cents(math.Round(float64(c.Int()) * f)) }
[ -0.6237223148345947, 0.5357497334480286, 0.35321974754333496, 0.3863995373249054, 0.3280872106552124, -0.8603380918502808, -0.4760522246360779, -0.8214341998100281, -0.42953628301620483, -0.2931440472602844, 0.20943857729434967, -1.3949049711227417, -0.6094950437545776, 0.7563689947128296,...