text
stringlengths
11
6.3k
embedding
listlengths
768
768
func (a *connectionMock) Closed() bool { return a.closed }
[ -0.9790522456169128, -0.6976087093353271, 0.4989510178565979, -0.11755766719579697, -0.036766987293958664, 1.0703190565109253, 0.032951951026916504, 0.6044982075691223, -0.06544729322195053, -0.6159955263137817, 0.09698080271482468, -0.568595826625824, -0.6494874358177185, 0.39378210902214...
func TestConnection_Smoke(t *testing.T) { var _ Connection = &connectionMock{} }
[ -0.14290711283683777, -0.49485546350479126, 0.23210254311561584, 0.7782984375953674, 1.0537207126617432, -0.4989316761493683, 0.7748584747314453, 0.7587425708770752, -0.16587038338184357, -0.21781094372272491, -0.040397897362709045, -0.34520667791366577, -0.5302360653877258, 0.807000219821...
func newJob(job Runnable, priority int) JobEntry { return &pt{ priority: priority, job: job, lock: &sync.Mutex{}, } }
[ 1.0542391538619995, -0.3065710961818695, 0.29594501852989197, 0.7508953213691711, -0.8306112885475159, 0.1410582959651947, -0.8975837230682373, -0.2032521367073059, 0.1303783655166626, -0.06881451606750488, 0.6362075805664062, 0.09821134060621262, -0.9162632822990417, -0.47217556834220886,...
func NewPriorityQueue() *PriorityQueue { q := &PriorityQueue{q: &pq{}} heap.Init(q.q) return q }
[ 0.5948861837387085, -1.6228052377700806, 0.28711971640586853, 0.47520801424980164, -0.31259679794311523, -0.3923031687736511, -1.0286000967025757, 0.0998784676194191, 0.42431432008743286, -0.7211418747901917, -0.3807932734489441, -0.16701190173625946, -0.23657085001468658, 1.12081909179687...
func TestAdminPageHandler_ServeHTTP_ValidRequest(t *testing.T) { req, err := http.NewRequest("GET", "/admin", nil) if err != nil { t.Fatal(err) } testLogger := testhelpers.GetTestLogger() mockedApiContext := new(mockedForTests.MockedApiConfiguration) mockedApiContext.On("GetIncomingMailApiKey").Return("1234"...
[ -0.29694196581840515, -0.1979074776172638, 0.6769229173660278, -0.13429488241672516, -0.14891201257705688, 0.6370265483856201, -0.20729869604110718, -0.01886984147131443, -0.17022210359573364, -0.1090683862566948, -0.3213687539100647, 0.1675814986228943, -0.6246486306190491, 0.355364561080...
func TestAdminPageHandler_ServeHTTP_RenderTemplateError_500Returned(t *testing.T) { req, err := http.NewRequest("GET", "/admin", nil) if err != nil { t.Fatal(err) } rr := httptest.NewRecorder() testLogger := testhelpers.GetTestLogger() mockedApiContext := new(mockedForTests.MockedApiConfiguration) mockedAp...
[ -0.7062787413597107, 0.07830328494310379, 0.6912633776664734, -0.11962798982858658, -0.6766404509544373, 0.6296133995056152, -0.1296958476305008, 0.3167268931865692, -0.008139494806528091, 0.2506004571914673, -0.49942439794540405, 0.3544272780418396, -1.3065123558044434, 0.573644757270813,...
func TestAdminPageHandler_ServeHTTP_WrongRequest(t *testing.T) { req, err := http.NewRequest("POST", "/admin", nil) if err != nil { t.Fatal(err) } rr := httptest.NewRecorder() testLogger := testhelpers.GetTestLogger() mockedApiContext := new(mockedForTests.MockedApiConfiguration) mockedApiContext.On("GetIn...
[ -0.11299386620521545, 0.5115157961845398, 0.7506300806999207, 0.21782125532627106, -0.632347822189331, 0.7873186469078064, 0.21797190606594086, -0.7023835182189941, -0.547166109085083, 0.25431087613105774, -0.10346709936857224, 0.09697236120700836, -1.0629640817642212, 0.7427443265914917, ...
func TestAdminPageHandler_ServeHTTP_FailedChange(t *testing.T) { req, err := http.NewRequest("GET", "/admin?IsChangeFailed=yes", nil) if err != nil { t.Fatal(err) } testLogger := testhelpers.GetTestLogger() lockedUsers := []userData.User{{"Test@Test.de", 1, "Test", "Test", userData.RegisteredUser, userData.W...
[ -0.4215468764305115, 0.2501576840877533, 0.6121797561645508, -0.10582742840051651, -0.17305077612400055, 0.5905197858810425, -0.14689871668815613, -0.3722500503063202, -0.23065632581710815, 0.2059611678123474, -0.772347629070282, 0.7133460640907288, -0.8067486882209778, 0.7801924347877502,...
func Test(t *testing.T) { TestingT(t) }
[ 0.5603705644607544, 0.47240784764289856, 0.14808350801467896, 0.21293595433235168, 0.38073426485061646, 0.712630569934845, 1.494964361190796, -0.18387949466705322, -0.4030367434024811, 0.012481830082833767, -0.6709293127059937, -0.1728723794221878, -0.05282559245824814, 0.4567270874977112,...
func search(node *Node, x int) *Node { if node == nil || node.value == x { return node } else if node.value > x { // Traverse in the left branch return search(node.left, x) } else { // Traverse in the right branch return search(node.right, x) } }
[ 0.21053965389728546, 0.9624745845794678, 0.6815562844276428, 0.22387251257896423, -0.5803716778755188, 0.36097005009651184, -0.8857224583625793, -1.0768649578094482, -0.1761401891708374, -0.27545636892318726, 0.017478423193097115, 0.8682284951210022, -0.4941345751285553, 0.5209643840789795...
func insert(n *Node, data int) { if n.value > data { if n.left != nil { insert(n.left, data) } else { n.left = &Node{ value: data, } } } else { if n.right != nil { insert(n.right, data) } else { n.right = &Node{ value: data, } } } }
[ -0.5477367043495178, 1.4279205799102783, 0.5556854605674744, -0.5282036662101746, 0.0848541259765625, 0.5022432208061218, -0.558178722858429, 0.34132516384124756, -0.7463964223861694, -0.22933019697666168, -1.1113717555999756, -0.035925693809986115, -0.7049376964569092, 1.0572658777236938,...
func HomeIndex(res http.ResponseWriter, req *http.Request) { var article model.Article app.DB.First(&article, 1) app.Render.HTML(res, http.StatusOK, "home", article) }
[ 0.345171183347702, -0.30091583728790283, 0.45827996730804443, 0.32855382561683655, -0.3609578013420105, 0.12357889115810394, 0.7515066862106323, 0.7583538293838501, 0.07575251162052155, 0.22872869670391083, 0.156877800822258, -0.2493760734796524, -0.3353148400783539, -0.4029282033443451, ...
func New(st Storage) *Server { srv := &Server{ st: st, } srv.setupRouter() return srv }
[ -1.124773383140564, -0.7018357515335083, 0.0435803085565567, -0.12867052853107452, -0.07317274063825607, -0.05134518817067146, -0.03452644124627113, -0.24149970710277557, 0.24514518678188324, -0.16001282632350922, -0.5879860520362854, 1.0804648399353027, 0.5958465933799744, 0.6699565649032...
func Nil(t Testing, v interface{}, formatAndArgs ...interface{}) bool { if isNil(v) { return true } return Fail(t, pretty.Sprintf("Expected to be nil, but got: %# v", v), formatAndArgs...) }
[ 0.32670268416404724, -0.4093916118144989, 0.4018803834915161, -0.3385290205478668, -0.4584093391895294, 0.3634698688983917, -0.2830196022987366, 0.592572808265686, 0.4397298991680145, 0.09614429622888565, 0.1769419014453888, 0.5423617362976074, -0.06337548792362213, 0.05672331899404526, ...
func NotNil(t Testing, v interface{}, formatAndArgs ...interface{}) bool { if !isNil(v) { return true } return Fail(t, "Expected NOT to be nil.", formatAndArgs...) }
[ 0.37579330801963806, -0.3683803379535675, 0.3748241364955902, -0.10735426098108292, -0.4419914782047272, 0.10459098219871521, -0.5056163668632507, 0.26149243116378784, 0.4312123656272888, 0.7265154123306274, -0.3568691313266754, -0.009337285533547401, -0.43622881174087524, 0.32899785041809...
func Zero(t Testing, v interface{}, formatAndArgs ...interface{}) bool { if v != nil && !reflect.DeepEqual(v, reflect.Zero(reflect.TypeOf(v)).Interface()) { return Fail(t, pretty.Sprintf("Should be zero, but got: %# v", v), formatAndArgs...) } return true }
[ -0.5034647583961487, -0.8260499835014343, 0.4494187831878662, 0.46007052063941956, 0.14534056186676025, 0.34053370356559753, 0.6172342300415039, 0.38158363103866577, 0.31205037236213684, -0.2248712033033371, -0.012982883490622044, 0.2030794769525528, -0.5292930006980896, 1.1324622631072998...
func NotZero(t Testing, v interface{}, formatAndArgs ...interface{}) bool { if v == nil || reflect.DeepEqual(v, reflect.Zero(reflect.TypeOf(v)).Interface()) { return Fail(t, pretty.Sprintf("Should NOT be zero, but got: %# v", v), formatAndArgs...) } return true }
[ -0.1659284085035324, -0.4732111394405365, 0.2756694257259369, 0.66310715675354, -0.273342490196228, -0.06274788081645966, 0.28439998626708984, 0.31131890416145325, 0.06794794648885727, 0.02305397391319275, 0.11530259251594543, 0.13556404411792755, -0.8480806946754456, 1.1338316202163696, ...
func True(t Testing, v interface{}, formatAndArgs ...interface{}) bool { var tv bool switch v.(type) { case bool: tv = v.(bool) } if tv != true { return Fail(t, pretty.Sprintf("Expected %# v to be true", v), formatAndArgs...) } return true }
[ -0.25092610716819763, 0.38981062173843384, 0.4082174599170685, 0.22749148309230804, -0.374910831451416, 0.6618658304214478, -0.2471679449081421, -0.2891072630882263, -0.42298275232315063, 0.4432417154312134, 0.04987227916717529, 0.23371148109436035, -0.5316082239151001, 0.02297507785260677...
func False(t Testing, v interface{}, formatAndArgs ...interface{}) bool { var fv bool switch v.(type) { case bool: fv = v.(bool) } if fv != false { return Fail(t, pretty.Sprintf("Expected %# v to be false", v), formatAndArgs...) } return true }
[ -0.6657265424728394, 0.15776357054710388, 0.349215030670166, 0.3231388330459595, -0.2531110346317291, 0.47967997193336487, -0.12665855884552002, -0.3143286108970642, -0.24240343272686005, -0.13696995377540588, 0.2539236843585968, 0.23756512999534607, -0.48748403787612915, 0.403201043605804...
func IsType(t Testing, expectedType, v interface{}, formatAndArgs ...interface{}) bool { if !AreEqualObjects(reflect.TypeOf(v), reflect.TypeOf(expectedType)) { return Fail(t, fmt.Sprintf( "Expect type of values are NOT the same.%s", diffValues(reflect.TypeOf(expectedType), reflect.TypeOf(v)), ), for...
[ -0.7228794097900391, -0.09193498641252518, 0.6423434615135193, 0.2608463764190674, 0.6801859736442566, 0.15432864427566528, 0.40882548689842224, -0.4576222598552704, 0.2880312204360962, 0.8819831013679504, 0.21318833529949188, 0.4341653287410736, -0.8516356348991394, -0.07959862053394318, ...
func Implements(t Testing, iface, v interface{}, formatAndArgs ...interface{}) bool { ifaceType := reflect.TypeOf(iface).Elem() if !reflect.TypeOf(v).Implements(ifaceType) { return Fail(t, fmt.Sprintf("Expect %T to implement %v", v, ifaceType), formatAndArgs...) } return true }
[ -1.6712802648544312, 0.7668498158454895, 0.5778869986534119, -0.9137781262397766, -0.6422868967056274, 0.4640566110610962, 0.32776716351509094, -0.2128031849861145, 0.24757052958011627, 0.7495561838150024, -0.11758878082036972, 0.004458150360733271, -0.4842132329940796, 0.877133309841156, ...
func Equal(t Testing, expected, actual interface{}, formatAndArgs ...interface{}) bool { if !AreEqualObjects(expected, actual) { return Fail(t, fmt.Sprintf( "Expected values are NOT equal.%s", diffValues(expected, actual), ), formatAndArgs...) } return true }
[ -0.5591225624084473, -0.7206527590751648, 0.6157146692276001, -0.05014348030090332, 0.6155433654785156, 0.9131423234939575, 0.602164626121521, 0.09453318268060684, -0.9000036120414734, 0.7159496545791626, -0.32039907574653625, -0.16474612057209015, 0.00427535455673933, 0.324028342962265, ...
func NotEqual(t Testing, expected, actual interface{}, formatAndArgs ...interface{}) bool { if AreEqualObjects(expected, actual) { expected, actual = prettifyValues(expected, actual) return Fail(t, fmt.Sprintf( "Expected values are NOT equal in value.%s", diffValues(expected, actual), ), formatAndArgs...)...
[ -0.4966236352920532, -0.641175389289856, 0.8106905221939087, 0.2674260437488556, -0.29235026240348816, 0.6710324287414551, 0.265796422958374, -0.27315035462379456, -0.9499415159225464, 0.6784408688545227, -0.18556056916713715, -0.5173375010490417, -0.1866687387228012, 0.6279477477073669, ...
func EqualValues(t Testing, expected, actual interface{}, formatAndArgs ...interface{}) bool { if !AreEqualValues(expected, actual) { return Fail(t, fmt.Sprintf( "Expected values are NOT equal in value.%s", diffValues(expected, actual), ), formatAndArgs...) } return true }
[ -0.08943779766559601, -0.005308899562805891, 0.638909637928009, -0.09450912475585938, 0.3527805209159851, 0.46092841029167175, 0.0432908870279789, 0.6764360666275024, -0.5807806849479675, 0.28147315979003906, 0.3525802493095398, -0.3294246792793274, 0.043536476790905, 0.6820870637893677, ...
func Exactly(t Testing, expected, actual interface{}, formatAndArgs ...interface{}) bool { expectedType := reflect.TypeOf(expected) actualType := reflect.TypeOf(actual) if expectedType != actualType { return Fail(t, fmt.Sprintf( "Expected values are NOT equal in type.%s", diffValues(expectedType, actua...
[ -0.9763280749320984, -0.7672998309135437, 0.6865834593772888, -0.11788342148065567, 0.6311822533607483, 1.262937307357788, 0.25376343727111816, -0.07574769854545593, -1.0058141946792603, 0.8219668865203857, 0.14942526817321777, 0.31269797682762146, -0.5528502464294434, 0.36246490478515625,...
func Empty(t Testing, v interface{}, formatAndArgs ...interface{}) bool { if !types.IsEmpty(v) { return Fail(t, pretty.Sprintf("Expected to be empty, but got: %# v", v), formatAndArgs...) } return true }
[ -0.5021763443946838, -0.12230086326599121, 0.43345171213150024, -0.5190470218658447, 0.150349959731102, 0.9774735569953918, -0.3320867717266083, -0.13102518022060394, -0.1270454227924347, 0.9167647957801819, -0.010450498200953007, 0.46463602781295776, -0.13507604598999023, 0.22942104935646...
func Match(t Testing, reg, str interface{}, formatAndArgs ...interface{}) bool { if !tryMatch(reg, str) { return Fail(t, fmt.Sprintf("Expect string(%s) to match regexp(%s)", fmt.Sprint(str), fmt.Sprint(reg)), formatAndArgs...) } return true }
[ 0.2709296643733978, -0.45040133595466614, 0.29477939009666443, -0.07395005971193314, -0.17182829976081848, 0.6707831621170044, 0.22750753164291382, 0.3908836245536804, -0.4122035801410675, 0.2761794626712799, 0.9189598560333252, -0.17705367505550385, -0.9084980487823486, -0.323950082063674...
func NotMatch(t Testing, reg, str interface{}, formatAndArgs ...interface{}) bool { if tryMatch(reg, str) { return Fail(t, fmt.Sprintf("Expect string(%s) to NOT match regexp(%s)", fmt.Sprint(str), fmt.Sprint(reg)), formatAndArgs...) } return true }
[ 0.09855732321739197, -0.2644537389278412, 0.3526586890220642, 0.18762783706188202, 0.02330571599304676, 0.5979567766189575, 0.37554416060447693, 0.12451626360416412, -0.3914567530155182, 0.3367812931537628, 0.9857202172279358, 0.07453572750091553, -1.2553539276123047, 0.09522190690040588, ...
func Len(t Testing, v interface{}, length int, formatAndArgs ...interface{}) bool { n, ok := getLen(v) if !ok { return Fail(t, pretty.Sprintf("Could not apply len() with %# v", v), formatAndArgs...) } if n != length { return Fail(t, pretty.Sprintf("Expected %# v should have %d item(s), but got: %d ite...
[ 0.2058253288269043, -0.2845068573951721, 0.3273482024669647, -0.6152051091194153, -0.21137456595897675, -0.23184803128242493, 0.38852667808532715, 1.119426965713501, 0.5885224938392639, 0.22599105536937714, -0.5572324395179749, 0.07423438131809235, 0.20317339897155762, -0.06469221413135529...
func WithinDuration(t Testing, expected, actual time.Time, delta time.Duration, formatAndArgs ...interface{}) bool { dt := expected.Sub(actual) if dt < -delta || dt > delta { return Fail(t, fmt.Sprintf("Expected max difference between %v and %v allowed is %v, but got: %v", expected, actual, delta, dt), format...
[ -0.2178449034690857, -0.040705882012844086, 0.674494743347168, 0.03471069782972336, -1.1538739204406738, 1.5550377368927002, 0.47057488560676575, 0.17565490305423737, -0.2877969443798065, 0.2187105119228363, 0.5901873111724854, 0.044100016355514526, -0.4260489046573639, -0.1127506345510482...
func InDelta(t Testing, expected, actual interface{}, delta float64, formatAndArgs ...interface{}) bool { af, aok := toFloat(expected) bf, bok := toFloat(actual) if !aok || !bok { return Fail(t, fmt.Sprintf("Parameters must be numerical"), formatAndArgs...) } if math.IsNaN(af) { return Fail(t, fmt.Sprintf...
[ -0.11119481176137924, 0.06506157666444778, 0.9502191543579102, 0.13616949319839478, -0.18671377003192902, 1.3708055019378662, 0.6117346882820129, 0.1380113661289215, -0.6747803688049316, -0.42753371596336365, 0.7543978691101074, -0.33466070890426636, -0.3346937894821167, 0.2572954297065735...
func InDeltaSlice(t Testing, expected, actual interface{}, delta float64, formatAndArgs ...interface{}) bool { if expected == nil || actual == nil || reflect.TypeOf(actual).Kind() != reflect.Slice || reflect.TypeOf(expected).Kind() != reflect.Slice { return Fail(t, fmt.Sprintf("Parameters must be slice"), ...
[ -1.0948402881622314, -0.18135319650173187, 0.726799488067627, -0.21609117090702057, -0.16156262159347534, 0.6042701005935669, 0.3658718466758728, -0.056621309369802475, -0.9638431668281555, 0.5001803040504456, 0.6282241940498352, 0.013684277422726154, -0.5287365913391113, 0.395966023206710...
func ReaderContains(t Testing, reader io.Reader, contains interface{}, formatAndArgs ...interface{}) bool { data, err := ioutil.ReadAll(reader) if err != nil { return Fail(t, fmt.Sprintf("Error read from \"%T\" of \"%s\"", reader, err.Error()), formatAndArgs...) } // try to close reader if it's io.Closer a...
[ -0.5246208310127258, -1.1382732391357422, 0.4436104893684387, -0.6507791876792908, -0.7763304114341736, 0.13291433453559875, -0.19599676132202148, -0.8619129061698914, -0.3422870337963104, 0.061085861176252365, 1.0082159042358398, -0.1974228024482727, -0.665327250957489, -0.023708276450634...
func ReaderNotContains(t Testing, reader io.Reader, contains interface{}, formatAndArgs ...interface{}) bool { data, err := ioutil.ReadAll(reader) if err != nil { return Fail(t, fmt.Sprintf("Error read from \"%T\" of \"%s\"", reader, err.Error()), formatAndArgs...) } // try to close reader if it's io.Close...
[ -1.04342782497406, -0.8647145628929138, 0.32000964879989624, -0.8102163076400757, -0.6373111605644226, 0.35266345739364624, -0.12373378127813339, -1.0246771574020386, -0.2839944362640381, -0.1824188530445099, 0.9545602798461914, -0.5996116399765015, -1.0217490196228027, 0.4275340735912323,...
func connectRedis(url string) (*service, error) { opt, err := redis.ParseURL(url) if err != nil { return nil, errors.New("Connect: Can't parse redis url") } connexion := redis.NewClient(opt) if err := connexion.Ping().Err(); err != nil { return nil, errors.New("Connect: Can't ping redis") } return &servic...
[ -0.7200101017951965, 0.0931757241487503, 0.5374351143836975, -0.09379845857620239, -0.38207370042800903, 0.4870501458644867, -0.9494847655296326, -0.6982706785202026, 0.6200931668281555, -0.1648736447095871, 0.6746118664741516, 0.32664066553115845, -0.4793561100959778, 0.22511887550354004,...
func (service *service) subAndManage(onMsg func(string, string) error, channels ...string) error { ch, err := service.subscribe(channels...) if err != nil { return err } defer service.unsubscribe(channels...) for err == nil { select { case msg := <-ch: err = onMsg(msg.Channel, msg.Payload) } } retur...
[ 0.9327403903007507, -0.4545770287513733, 0.8681964874267578, -0.2915842831134796, -1.1156251430511475, -0.08334778994321823, -0.808962345123291, -0.43904516100883484, -0.11601847410202026, -0.5049305558204651, 0.3718370199203491, 0.5112324357032776, -0.3883163332939148, 1.5568335056304932,...
func (service *service) publish(channel string, value string) error { return service.client.Publish(channel, value).Err() }
[ -0.2196473330259323, 0.23757492005825043, 0.2880794405937195, -0.0010414193384349346, -0.1689467877149582, 0.24165047705173492, -1.0448260307312012, -0.7174245119094849, -0.6827607750892639, -0.15223267674446106, 0.5899482369422913, 1.2480318546295166, -1.0667574405670166, 0.24796856939792...
func (service *service) setKeyValue(key string, value interface{}, howLong time.Duration) error { return service.client.Set(key, value, howLong).Err() }
[ -0.5360782146453857, 0.796238899230957, 0.33473801612854004, 0.10461264848709106, -0.7932745218276978, 0.4788539409637451, -1.2227394580841064, -0.32794880867004395, -0.8447064161300659, 0.366898775100708, -0.7134231328964233, 1.5025241374969482, -0.012899540364742279, 0.7447778582572937, ...
func (service *service) getKey(key string) (string, error) { val, err := service.client.Get(key).Result() if err == redis.Nil { return "", nil } else if err != nil { return "", err } return val, nil }
[ -0.6198483109474182, 1.4156370162963867, 0.5614818930625916, 0.5325160026550293, -0.23700758814811707, -0.6402881145477295, -1.1074556112289429, -0.654590904712677, 0.47561705112457275, 0.7359652519226074, 0.20935200154781342, -0.26632532477378845, -0.8239974975585938, 0.7310163974761963, ...
func (service *service) incrKey(key string) (int64, error) { return service.client.Incr(key).Result() }
[ -1.2511597871780396, 0.8379886746406555, 0.4847908616065979, 0.4626251757144928, -0.9738903045654297, -0.6187683343887329, 0.02338869869709015, -0.5463131070137024, -0.2262192815542221, 0.24636435508728027, 0.474237859249115, 0.37479066848754883, -0.9345946907997131, 0.8918535709381104, ...
func (service *service) decrKey(key string) (int64, error) { return service.client.Decr(key).Result() }
[ -0.693745493888855, 0.9047900438308716, 0.5796939134597778, 0.33104050159454346, -0.4132208824157715, -1.3228756189346313, -0.31036868691444397, -0.07326608896255493, -0.6441211700439453, 0.5308761596679688, 0.6820760369300842, -0.1977415829896927, -0.9356831312179565, 0.5844666361808777, ...
func (s *DFSServer) GetFile(req *transfer.GetFileReq, stream transfer.FileTransfer_GetFileServer) (err error) { serviceName := "GetFile" peerAddr := getPeerAddressString(stream.Context()) glog.V(3).Infof("%s start, client: %s, %v", serviceName, peerAddr, req) if len(req.Id) == 0 || req.Domain <= 0 { return fmt.E...
[ -0.4662141799926758, 0.6028599143028259, 0.6439000368118286, 0.37745293974876404, 0.5251646637916565, -0.47892335057258606, 0.7477312088012695, -0.11188997328281403, -0.547753632068634, -1.0872797966003418, 0.9800444841384888, 0.6123202443122864, -0.7067539691925049, 0.5991168022155762, ...
func Expect(t *testing.T, v, m interface{}) { vt, vok := v.(Equaler) mt, mok := m.(Equaler) var state bool if vok && mok { state = vt.Equal(mt) } else { state = reflect.DeepEqual(v, m) } if state { flux.FatalFailed(t, "Value %+v and %+v are not a match", v, m) return } flux.LogPassed(t, "Value %+v an...
[ -0.11954733729362488, -0.20389991998672485, 0.49376383423805237, -0.01619928516447544, -0.254563570022583, -0.1546781212091446, -0.3447292447090149, 0.281399130821228, -0.3264251947402954, 0.0544261634349823, 0.5639567971229553, 0.7437306642532349, 0.06263638287782669, 0.09375372529029846,...
func StrictExpect(t *testing.T, v, m interface{}) { vt, vok := v.(Equaler) mt, mok := m.(Equaler) var state bool if vok && mok { state = vt.Equal(mt) } else { state = (v == m) } if state { flux.FatalFailed(t, "Value %+v and %+v are not a match", v, m) return } flux.LogPassed(t, "Value %+v and %+v are...
[ 0.899061381816864, -0.5056953430175781, 0.4489459991455078, 0.2569805085659027, 0.29348793625831604, 0.051586396992206573, -0.4720977246761322, 0.08924105018377304, 0.2229965180158615, 0.3486161530017853, -0.006074786186218262, 0.1696111112833023, -0.12625005841255188, 0.21987909078598022,...
func Truthy(t *testing.T, name string, v bool) { if !v { flux.FatalFailed(t, "Expected truthy value for %s", name) } else { flux.LogPassed(t, "%s passed with truthy value", name) } }
[ 0.2637110650539398, -0.07862848043441772, 0.6109681725502014, 0.019616469740867615, 0.03998158872127533, -0.30032870173454285, -0.1616516411304474, -0.19928717613220215, -0.710336446762085, 0.8248214721679688, -0.8117629289627075, 0.4440007507801056, 0.16179050505161285, -0.175575256347656...
func Falsy(t *testing.T, name string, v bool) { if !v { flux.LogPassed(t, "%s passed with falsy value", name) } else { flux.FatalFailed(t, "Expected falsy value for %s", name) } }
[ 0.25463244318962097, 0.10502837598323822, 0.5036885142326355, 0.44536855816841125, 0.20994992554187775, -0.4388388991355896, -0.50904381275177, -0.21477003395557404, -0.6689285039901733, 0.08322622627019882, -0.5335188508033752, 0.43432942032814026, 0.32226938009262085, 0.34398090839385986...
func (v Verb) RandSynonym() string { return randString(v.Synonyms) }
[ -0.5078062415122986, -0.5212687849998474, 0.39800146222114563, 0.07102620601654053, -0.38800790905952454, -0.4002545177936554, 0.35436519980430603, 0.620678186416626, 0.995530366897583, 0.19679862260818481, -0.8419399857521057, 0.7542226314544678, -0.2232966423034668, -0.3888874351978302, ...
func NewHub(ctx context.Context) *Hub { h := &Hub{ conns: make(map[*websocket.Conn]struct{}), ch: make(chan channelMessage), } go h.sendLoop() go func() { <-ctx.Done() close(h.ch) }() return h }
[ 0.4912942349910736, -0.34040653705596924, 0.5218164324760437, 0.8382577300071716, -0.25235679745674133, 0.33526596426963806, -0.10093199461698532, -1.3329945802688599, 0.3483225703239441, -0.20405808091163635, 0.7331483960151672, 1.01414155960083, -0.18910692632198334, 0.04726432263851166,...
func (h *Hub) Add(conn *websocket.Conn) { h.mux.Lock() defer h.mux.Unlock() h.conns[conn] = struct{}{} }
[ -0.5406026244163513, -0.5216822624206543, 0.40651407837867737, 0.4400079846382141, 0.2776477336883545, 0.4058431386947632, -0.3183543086051941, 0.5490407943725586, 1.0024652481079102, -0.36736100912094116, -0.708865761756897, 0.6351076364517212, -0.7557862401008606, 0.6445729732513428, 0...
func (h *Hub) Remove(conn *websocket.Conn) { h.mux.Lock() defer h.mux.Unlock() conn.Close() delete(h.conns, conn) }
[ 0.0399627611041069, -0.599673867225647, 0.4897226095199585, 0.36309465765953064, -0.7044793963432312, -0.28626111149787903, -0.17265115678310394, 0.9985477328300476, 1.0789062976837158, 0.22569766640663147, -0.7315820455551147, 0.27460911870002747, -1.2561779022216797, 0.49541717767715454,...
func (h *Hub) Send(conn *websocket.Conn, data []byte, mt int) { h.ch <- channelMessage{ data: data, conn: conn, mt: mt, } }
[ 0.2193644642829895, -0.2052929699420929, 0.28670036792755127, 0.09781049937009811, 0.5236076712608337, 0.3569590449333191, -1.1189384460449219, -0.8574606776237488, -0.6100589632987976, 0.025257989764213562, -0.48406633734703064, 0.8908647894859314, -0.4016190767288208, 0.4205855429172516,...
func (h *Hub) SendToAll(data []byte) { h.mux.Lock() defer h.mux.Unlock() for conn := range h.conns { h.Send(conn, data, websocket.TextMessage) } }
[ -0.27813851833343506, -0.36200809478759766, 0.676040768623352, 0.6719905138015747, 0.6107544302940369, -0.25090429186820984, -0.4488179385662079, -0.2488507777452469, 0.37046492099761963, 0.6388752460479736, -0.432639479637146, 0.49738743901252747, -0.6109526753425598, 0.782784640789032, ...
func (h *Hub) HandleBroadcast(w http.ResponseWriter, r *http.Request) { h.SendToAll([]byte("Hi ALL!")) }
[ 0.036167554557323456, -0.03987833112478256, 0.5599806308746338, 0.856232225894928, 0.6037241220474243, 0.13421423733234406, 0.16345998644828796, 0.36651208996772766, 0.7994675636291504, 0.3578750789165497, -0.024152223020792007, 0.6312211751937866, -0.8155439496040344, 0.7965313196182251, ...
func (h *Hub) HandleWS(w http.ResponseWriter, r *http.Request) { conn, err := upgrader.Upgrade(w, r, nil) if err != nil { log.Printf("upgrade connection failed: %v", err) return } h.Add(conn) defer h.Remove(conn) for { mt, msg, err := conn.ReadMessage() if err != nil { log.Printf("failed to read from...
[ -0.4810947775840759, -0.11516478657722473, 1.008813500404358, 0.44087931513786316, -0.07995074987411499, -0.49830761551856995, 0.35747435688972473, -0.7011212110519409, 0.9361076951026917, -0.040152471512556076, 0.4316236674785614, -0.1783381700515747, 0.11491498351097107, 1.07857537269592...
func SetScrollContentTrackerSize(sa *qtwidgets.QScrollArea) { wgt := sa.Widget() sa.InheritResizeEvent(func(arg0 *qtgui.QResizeEvent) { osz := arg0.OldSize() nsz := arg0.Size() if false { log.Println(osz.Width(), osz.Height(), nsz.Width(), nsz.Height()) } if osz.Width() != nsz.Width() { wgt.SetMaximum...
[ 0.7299866080284119, -0.28742536902427673, 0.7913610935211182, 0.6953039169311523, -0.2838069200515747, 0.11737982928752899, 0.6695959568023682, -0.12132737785577774, -0.009096356108784676, -0.45298102498054504, -0.9041035771369934, -0.330314964056015, -0.1729426234960556, 1.372243881225586...
func NewQPainter(w qtwidgets.QWidget_ITF) *qtgui.QPainter { ptr := PointerStep(w.QWidget_PTR().GetCthis(), 2*unsafe.Sizeof(uintptr(0))) ptdev := qtgui.NewQPaintDeviceFromPointer(ptr) return qtgui.NewQPainter1(ptdev) }
[ -0.2054515779018402, -0.44995543360710144, 0.3102686405181885, -0.7277830243110657, -1.331138014793396, -0.198720782995224, -0.3169088363647461, -0.8937240242958069, 0.4070364534854889, -0.7417411804199219, -0.6128821969032288, -0.2066555768251419, -0.7498037815093994, 1.6009654998779297, ...
func GetIdentIcon(s string) *qtgui.QIcon { back := color.RGBA{240, 240, 240, 255} // from github fore1 := color.RGBA{228, 131, 172, 255} // pink, 255 no transpart fore2 := color.RGBA{144, 181, 233, 255} // blue fore := gopp.IfElse(rand.Int()%2 == 1, fore1, fore2).(color.RGBA) imgo, err := identicon.Make(64, bac...
[ -0.3520502746105194, -0.16715256869792938, 0.9188888669013977, -0.30552974343299866, -0.844409704208374, 0.19902847707271576, 0.378109335899353, 0.4369770884513855, -0.17451810836791992, -0.19558432698249817, -1.4859504699707031, 0.2685268223285675, 0.11904391646385193, 0.43184056878089905...
func computeAverage(array []float64) float64 { result := 0.0 for _, item := range array { result += item } return result / float64(len(array)) }
[ -0.5106753706932068, 0.4162416160106659, 0.18985381722450256, 0.6171380281448364, 0.8311371803283691, 0.08980021625757217, 0.35290029644966125, 0.6521021723747253, -0.30437636375427246, 1.2073042392730713, 0.9901911020278931, 0.11808113753795624, -0.6921526193618774, 1.1091971397399902, ...
func computeMax(array []float64) float64 { result := -math.MaxFloat64 for _, item := range array { if item > result { result = item } } return result }
[ -0.273829847574234, 0.3443818986415863, 0.5058522820472717, 1.642855167388916, 0.409284770488739, -0.16841310262680054, -0.4915459454059601, 0.50223308801651, -0.1235123947262764, 0.3514367938041687, 0.9161537885665894, 0.45390793681144714, -0.5310957431793213, 1.0154292583465576, -0.052...
func computePercentile(array []float64, targetPercentile int) float64 { if len(array) == 0 { panic("Cannot compute the percentile of an empty array") } sort.Float64s(array) if targetPercentile == 100 { return array[len(array)-1] } indexAsFloat, fractional := math.Modf((float64(len(array)) - 1.0) * (0.01 * flo...
[ -0.4036441147327423, 0.16685384511947632, 0.5532890558242798, 0.30345967411994934, 0.09128318727016449, 0.11541257798671722, 0.34888961911201477, -0.05125237628817558, 0.4885442852973938, 0.5454598665237427, 1.6710634231567383, 0.5184052586555481, -0.6786133050918579, -0.37137144804000854,...
func IndexHandler(c *gin.Context) { val, _ := c.Cookie("auth") if val != "" { c.Redirect(http.StatusTemporaryRedirect, "/dashboard") return } c.HTML(http.StatusOK, "login.html", nil) }
[ -0.3232153356075287, 0.5470067858695984, 0.4518895745277405, 0.781952440738678, -0.12280623614788055, 0.3196253776550293, 1.4675132036209106, 1.0356385707855225, 0.19656023383140564, -0.2213331013917923, 0.39043742418289185, 0.1298268586397171, -0.18579550087451935, -0.801864504814148, 0...
func LoginHandler(c *gin.Context) { val, _ := c.Cookie("auth") if val != "" { c.Redirect(http.StatusOK, "/dashboard") return } info := models.LoginInfo{ Email: c.Query("email"), Password: c.Query("password"), } if info.Email == "" || info.Password == "" { c.Redirect(http.StatusTemporaryRedirect, "/...
[ -0.22245848178863525, 0.33923208713531494, 1.0579501390457153, 0.36483249068260193, -0.08400456607341766, 0.6363805532455444, 0.9078025817871094, 0.7490139603614807, -0.47145578265190125, -0.3836381733417511, 0.2346971482038498, -0.4597092866897583, 0.004216306377202272, 0.3257565200328827...
func resolve(ctx context.Context, r resolver, name string, options opts.ResolveOpts) (path.Path, error) { ctx, cancel := context.WithCancel(ctx) defer cancel() var ( p path.Path cacheTag *string proof [][]byte err = ErrResolveFailed ) resCh := resolveAsync(ctx, r, name, options) for res ...
[ 0.07925019413232803, 0.14327003061771393, 0.7186752557754517, 0.5185528993606567, -0.15015950798988342, -0.8343554139137268, 0.0517892986536026, 0.07705909758806229, 0.031148334965109825, 0.26614877581596375, -0.1538875252008438, -0.8431442379951477, -0.31116825342178345, 0.357001870870590...
func NewApp(gitCommit, usage string) *cli.App { app := cli.NewApp() app.Name = filepath.Base(os.Args[0]) app.Author = "" app.Email = "" app.Version = Version app.Usage = usage return app }
[ 1.5919088125228882, -1.0265179872512817, 0.42825332283973694, 0.5227072834968567, -0.06209919974207878, 1.2856546640396118, -0.6224402785301208, -0.37417173385620117, -0.769620418548584, 0.7322384715080261, 0.3951912522315979, 0.5023897290229797, -0.04823228344321251, 0.09229425340890884, ...
func MakeDataDir(ctx *cli.Context) string { if path := ctx.GlobalString(DataDirFlag.Name); path != "" { // TODO: choose a different location outside of the regular datadir. if ctx.GlobalBool(TestNetFlag.Name) { return filepath.Join(path, "testnet") } return path } Fatalf("Cannot determine default data dir...
[ 0.33807486295700073, 0.5771181583404541, 0.43237367272377014, -0.2805975377559662, 0.306540846824646, 1.3872915506362915, 0.5202710628509521, -0.16672120988368988, -0.3199423551559448, -1.2760193347930908, 0.13444624841213226, 0.27064216136932373, -0.06602812558412552, 0.7245623469352722, ...
func MakeIPCPath(ctx *cli.Context) string { if ctx.GlobalBool(IPCDisabledFlag.Name) { return "" } return ctx.GlobalString(IPCPathFlag.Name) }
[ 0.03939954936504364, -0.11967553198337555, 0.4831472337245941, -0.19890162348747253, -0.6827199459075928, 1.4141480922698975, 1.064789056777954, -0.3020726144313812, -0.2178196907043457, 0.47422298789024353, 0.46267151832580566, -0.2831576466560364, -1.4214322566986084, -1.0586826801300049...
func MakeNodeKey(ctx *cli.Context) *ecdsa.PrivateKey { var ( hex = ctx.GlobalString(NodeKeyHexFlag.Name) file = ctx.GlobalString(NodeKeyFileFlag.Name) key *ecdsa.PrivateKey err error ) switch { case file != "" && hex != "": Fatalf("Options %q and %q are mutually exclusive", NodeKeyFileFlag.Name, NodeKey...
[ -0.31798821687698364, 0.4018386900424957, 0.5117043256759644, -0.9221394658088684, 0.6227450966835022, 0.5527832508087158, 0.275814950466156, -0.5395146012306213, -0.5433238744735718, -0.3784981966018677, 0.29132235050201416, 0.17718146741390228, -0.1227499470114708, 0.5758532881736755, ...
func makeNodeUserIdent(ctx *cli.Context) string { var comps []string if identity := ctx.GlobalString(IdentityFlag.Name); len(identity) > 0 { comps = append(comps, identity) } if ctx.GlobalBool(VMEnableJitFlag.Name) { comps = append(comps, "JIT") } return strings.Join(comps, "/") }
[ -0.14298103749752045, 0.06667206436395645, 0.4637390375137329, 0.19031760096549988, -0.10964953899383545, 0.8350974917411804, 0.8870638012886047, -0.39078599214553833, -0.3277166783809662, -0.02118697576224804, -0.3018417954444885, 0.2195715457201004, -0.0717603787779808, -0.50615113973617...
func MakeBootstrapNodes(ctx *cli.Context) []*discover.Node { // Return pre-configured nodes if none were manually requested if !ctx.GlobalIsSet(BootnodesFlag.Name) { if ctx.GlobalBool(TestNetFlag.Name) { return configure.TestnetBootnodes } return configure.MainnetBootnodes } // Otherwise parse and use the ...
[ -0.5650689601898193, 0.5803428292274475, 0.43843045830726624, 0.6353394389152527, 0.43100330233573914, 0.08555667847394943, -0.26578760147094727, 0.084937684237957, 0.0037269024178385735, 0.29926028847694397, 0.12727110087871552, 0.23687642812728882, -0.5453634858131409, 0.4200321435928345...
func MakeListenAddress(ctx *cli.Context) string { return fmt.Sprintf(":%d", ctx.GlobalInt(ListenPortFlag.Name)) }
[ 0.8973116278648376, -1.0980561971664429, 0.7332661151885986, -1.088032841682434, -0.1364002674818039, 1.231766939163208, 0.42389780282974243, 0.08993945270776749, 0.2808172404766083, -0.35638636350631714, 0.1869698464870453, 0.8041839599609375, -0.047237053513526917, -0.8359448313713074, ...
func MakeNAT(ctx *cli.Context) nat.Interface { natif, err := nat.Parse(ctx.GlobalString(NATFlag.Name)) if err != nil { Fatalf("Option %s: %v", NATFlag.Name, err) } return natif }
[ -0.1309715360403061, 0.18099024891853333, 0.3942500650882721, -0.5470311641693115, -0.2936727702617645, 0.672037661075592, -0.5854086875915527, -0.9657481908798218, -1.03485107421875, -0.3884679973125458, -0.2471601516008377, -0.09137798845767975, 0.18971633911132812, -0.6858994364738464, ...
func MakeRPCModules(input string) []string { result := strings.Split(input, ",") for i, r := range result { result[i] = strings.TrimSpace(r) } return result }
[ -0.9117959141731262, -0.2107517272233963, 0.32197844982147217, -0.5065639615058899, 0.36436349153518677, 0.9707031846046448, -0.534818708896637, -0.576101541519165, 0.6387473344802856, 0.578089714050293, -0.04323611408472061, 0.13861221075057983, -1.0338761806488037, -0.6028162240982056, ...
func MakeHTTPRpcHost(ctx *cli.Context) string { if !ctx.GlobalBool(RPCEnabledFlag.Name) { return "" } return ctx.GlobalString(RPCListenAddrFlag.Name) }
[ 0.6201251745223999, -0.22626149654388428, 0.4299178719520569, -0.8831616640090942, -0.0235805194824934, 1.5593003034591675, -0.1710948497056961, -0.46899306774139404, 0.28678786754608154, 0.4106864333152771, 0.7486421465873718, 0.4981807768344879, -1.3725658655166626, 0.01802312768995762, ...
func MakeWSRpcHost(ctx *cli.Context) string { if !ctx.GlobalBool(WSEnabledFlag.Name) { return "" } return ctx.GlobalString(WSListenAddrFlag.Name) }
[ 0.7998465895652771, -0.15412768721580505, 0.3198367655277252, -1.0620863437652588, -0.5433664917945862, 0.901123046875, -0.11675435304641724, -0.2998178005218506, 0.6254969239234924, 0.24809530377388, 0.5868447422981262, 0.718762993812561, -1.2620458602905273, 0.13593722879886627, -0.452...
func MakeDatabaseHandles() int { if err := raiseFdLimit(2048); err != nil { Fatalf("Failed to raise file descriptor allowance: %v", err) } limit, err := getFdLimit() if err != nil { Fatalf("Failed to retrieve file descriptor allowance: %v", err) } if limit > 2048 { // cap database file descriptors even if mor...
[ 0.047208189964294434, 1.1105034351348877, 0.6368110775947571, -0.5525615215301514, -0.4554536044597626, 0.1674906611442566, 0.689989447593689, 0.8520680069923401, -0.8174504041671753, -0.4469797909259796, -0.2730819582939148, 0.1686834841966629, -0.7988860011100769, -0.07845844328403473, ...
func MakeAddress(accman *wallet.Manager, account string) (wallet.Account, error) { // If the specified account is a valid address, return it if helper.IsHexAddress(account) { return wallet.Account{Address: helper.HexToAddress(account)}, nil } // Otherwise try to interpret the account as a keystore index index, e...
[ 0.11133954674005508, -0.2691231667995453, 0.41843318939208984, -0.047230593860149384, -1.1417698860168457, -0.07890663295984268, 0.344852089881897, 0.6033059358596802, 1.7588911056518555, -0.24673621356487274, 0.9191984534263611, 0.6965381503105164, -0.3049163520336151, -0.8270093202590942...
func MakeMiner(accman *wallet.Manager, ctx *cli.Context) helper.Address { accounts := accman.Accounts() if !ctx.GlobalIsSet(MinerFlag.Name) && len(accounts) == 0 { glog.V(logger.Debug).Infoln("WARNING: No miner set and no wallet found as default") return helper.Address{} } minerBase := ctx.GlobalString(MinerFla...
[ 0.2943997383117676, -0.5290434956550598, 0.4698876738548279, 0.34388524293899536, -0.19056236743927002, 0.21273048222064972, 0.36326923966407776, -0.5582184195518494, 0.28241902589797974, -0.49036499857902527, 1.2298682928085327, 0.1192435622215271, -0.9205179810523987, 0.43190544843673706...
func MakeMinerExtra(extra []byte, ctx *cli.Context) []byte { if ctx.GlobalIsSet(ExtraDataFlag.Name) { return []byte(ctx.GlobalString(ExtraDataFlag.Name)) } return extra }
[ 0.09638947993516922, 0.6278843283653259, 0.43954312801361084, -0.4248605966567993, -0.7434839010238647, 1.1730631589889526, -0.7114331722259521, 0.018762702122330666, 0.5455350875854492, -0.3644447326660156, -0.3184412717819214, 0.8846762776374817, -0.8267712593078613, 0.5586355328559875, ...
func MakePasswordList(ctx *cli.Context) []string { path := ctx.GlobalString(PasswordFileFlag.Name) if path == "" { return nil } text, err := ioutil.ReadFile(path) if err != nil { Fatalf("Failed to read password file: %v", err) } lines := strings.Split(string(text), "\n") // Sanitise DOS line endings. for i...
[ 0.048597659915685654, -0.4583064317703247, 0.435446172952652, -0.07275030761957169, 0.15604914724826813, 0.6389326453208923, -0.40189021825790405, 0.354182630777359, -0.5392979383468628, 0.9168235659599304, -0.38699042797088623, 0.026021046563982964, -0.0332442931830883, 0.3192767500877380...
func MakeNode(ctx *cli.Context, name, gitCommit string) *context.Node { vsn := Version config := &context.Config{ DataDir: MakeDataDir(ctx), KeyStoreDir: ctx.GlobalString(KeyStoreDirFlag.Name), PrivateKey: MakeNodeKey(ctx), Name: name, Version: vsn, UserIdent...
[ 0.0151645103469491, 0.4114716947078705, 0.8092470169067383, -0.1763613224029541, 0.2613288164138794, 0.2365962415933609, 0.12133105099201202, -0.6941028237342834, 0.19969597458839417, 0.24798579514026642, 0.0005232212715782225, 0.0076534077525138855, -0.20140314102172852, -0.33483380079269...
func RegisterSiotService(ctx *cli.Context, stack *context.Node, extra []byte) { // Avoid conflicting network flags networks, netFlags := 0, []cli.BoolFlag{DevModeFlag, TestNetFlag, OlympicFlag} for _, flag := range netFlags { if ctx.GlobalBool(flag.Name) { networks++ } } if networks > 1 { Fatalf("The %v f...
[ -0.03682180121541023, 0.5231891870498657, 0.5995948314666748, -0.17768603563308716, 0.598216712474823, 0.07936874777078629, -0.06692764163017273, -0.5140758752822876, -0.4907946288585663, 0.11098107695579529, -0.650834858417511, -0.1689603328704834, -0.3789076507091522, 0.3273194134235382,...
func SetupNetwork(ctx *cli.Context) { switch { case ctx.GlobalBool(OlympicFlag.Name): configure.DurationLimit = big.NewInt(8) configure.GenesisGasLimit = big.NewInt(3141592) configure.MinGasLimit = big.NewInt(125000) configure.MaximumExtraDataSize = big.NewInt(1024) NetworkIdFlag.Value = 0 blockchainCore....
[ -0.459558367729187, 0.7244847416877747, 0.52302086353302, 0.5484829545021057, 1.0538561344146729, -0.20298926532268524, -0.18220539391040802, 0.2083483636379242, -0.34658563137054443, 0.4761076867580414, -0.12338217347860336, -0.4424595534801483, -0.04256357252597809, 0.46408596634864807, ...
func MakeChainConfig(ctx *cli.Context, stack *context.Node) *configure.ChainConfig { db := MakeChainDatabase(ctx, stack) defer db.Close() return MakeChainConfigFromDb(ctx, db) }
[ 0.09470823407173157, 0.32567790150642395, 0.3203190565109253, -0.18793608248233795, -0.07005774974822998, 0.16481764614582062, -0.6488854289054871, 0.25497967004776, -1.322082757949829, 0.1632162481546402, -0.871565043926239, 0.252221941947937, 0.06159882992506027, 0.483765184879303, 0.8...
func MakeChainConfigFromDb(ctx *cli.Context, db database.Database) *configure.ChainConfig { // If the chain is already initialized, use any existing chain configs config := new(configure.ChainConfig) genesis := blockchainCore.GetBlock(db, blockchainCore.GetCanonicalHash(db, 0), 0) if genesis != nil { storedConfi...
[ 0.024907652288675308, -0.11461836099624634, 0.633420467376709, 0.43032971024513245, 0.20382718741893768, -0.14377589523792267, -0.35351139307022095, 0.4675675630569458, -0.5720543265342712, 0.08172884583473206, -0.3822252154350281, -0.7671351432800293, -0.5491489171981812, 1.30026507377624...
func MakeChainDatabase(ctx *cli.Context, stack *context.Node) database.Database { var ( cache = ctx.GlobalInt(CacheFlag.Name) handles = MakeDatabaseHandles() name = ChainDbName(ctx) ) chainDb, err := stack.OpenDatabase(name, cache, handles) if err != nil { Fatalf("Could not open database: %v", err) }...
[ -0.4391654431819916, 0.23483146727085114, 0.36839088797569275, 0.3144642114639282, 0.04778420925140381, 0.4464395344257355, 0.046004876494407654, -0.27644863724708557, -0.5904800891876221, -0.4956648051738739, -0.7236417531967163, 0.413781076669693, -1.1121429204940796, -0.2020226269960403...
func MakeChain(ctx *cli.Context, stack *context.Node) (chain *blockchainCore.BlockChain, chainDb database.Database) { var err error chainDb = MakeChainDatabase(ctx, stack) if ctx.GlobalBool(OlympicFlag.Name) { _, err := blockchainCore.WriteTestNetGenesisBlock(chainDb) if err != nil { glog.Fatalln(err) } }...
[ 0.15014778077602386, 0.39376160502433777, 0.6628502011299133, 0.7529925107955933, 0.3885478675365448, 0.411801815032959, -0.2904009222984314, 0.17063558101654053, -0.3858456611633301, -0.20470896363258362, -0.629159152507782, 0.4441092312335968, -0.5276190042495728, 0.9272750616073608, 1...
func RunCmd() *cobra.Command { cmd := &cobra.Command{ Use: "run [script path]", Short: "Clones multiple repositories, run a script in that directory, and creates a PR with those changes.", Long: runHelp, Args: cobra.ExactArgs(1), PreRunE: logFlagInit, RunE: run, } cmd.Flags().StringP("bra...
[ 0.07307828217744827, -0.3912840187549591, 0.9471330642700195, -0.6040080189704895, 0.42400699853897095, 0.4890276789665222, 0.03682462498545647, 0.07872088998556137, -0.437527060508728, -0.4186916947364807, 0.02398112043738365, 1.1051406860351562, -0.5063562989234924, 0.4289570152759552, ...
func NewFeeCollectionKeeper(cdc *codec.Codec, key sdk.StoreKey) FeeCollectionKeeper { return FeeCollectionKeeper{ key: key, cdc: cdc, } }
[ -0.23687130212783813, -0.3739396929740906, 0.12866580486297607, -0.051269855350255966, -0.8451316356658936, -0.5514576435089111, 0.2505946159362793, -0.37889736890792847, 0.3132510483264923, -0.5693633556365967, -0.32436516880989075, -0.2946273386478424, 0.32801589369773865, 1.169179439544...
func (fck FeeCollectionKeeper) GetCollectedFees(ctx sdk.Context) sdk.Coins { store := ctx.KVStore(fck.key) bz := store.Get(collectedFeesKey) if bz == nil { return sdk.NewCoins() } emptyFees := sdk.NewCoins() feePool := &emptyFees fck.cdc.MustUnmarshalBinaryLengthPrefixed(bz, feePool) return *feePool }
[ 0.36815524101257324, 0.013163696974515915, 0.2858847677707672, 0.12019627541303635, 0.7910751104354858, -0.6304092407226562, 0.48925039172172546, -0.7037227749824524, 0.41991570591926575, -0.5988953113555908, -0.42110389471054077, 0.7704124450683594, -0.6780749559402466, 0.943796694278717,...
func (fck FeeCollectionKeeper) AddCollectedFees(ctx sdk.Context, coins sdk.Coins) sdk.Coins { newCoins := fck.GetCollectedFees(ctx).Add(coins) fck.setCollectedFees(ctx, newCoins) return newCoins }
[ -0.08888272196054459, -0.44078975915908813, 0.30485591292381287, -0.04629321023821831, 0.6548532247543335, -0.2186852991580963, 0.26175612211227417, -0.41880398988723755, 0.03304991498589516, -0.7366092801094055, -0.3130204379558563, 0.30275821685791016, -0.3972102701663971, 0.670514345169...
func (fck FeeCollectionKeeper) ClearCollectedFees(ctx sdk.Context) { fck.setCollectedFees(ctx, sdk.NewCoins()) }
[ 0.3555576503276825, -0.3630257844924927, 0.11297303438186646, 0.2862061858177185, 0.4563787579536438, 0.05352972447872162, 0.7386391162872314, -0.4611191153526306, -0.20504161715507507, -0.46018895506858826, 0.08034549653530121, 0.2994909882545471, -0.21280531585216522, 0.7015976309776306,...
func Init(debug bool) { var syslogfmtstr, logfmtstr string if debug { syslogfmtstr = "[%{shortpkg}: %{shortfile}: %{shortfunc}] %{message}" logfmtstr = "%{color}%{time:15:04:05} [%{shortpkg}: %{shortfile}: %{shortfunc}()] ▶ %{level:.4s} ◀ %{color:reset} %{message}" } else { syslogfmtstr = "[%{shortpkg}: %{sho...
[ 0.3491359055042267, -1.3202598094940186, 0.9307070374488831, -0.11486279219388962, 0.22735443711280823, -0.17607204616069794, -0.7124539613723755, 0.41765493154525757, -0.10067609697580338, -0.3543981909751892, -0.27789583802223206, 1.470115065574646, -0.197642520070076, 0.9640829563140869...
func (p Password) Redacted() interface{} { return logging.Redact(string(p)) }
[ 0.07867325842380524, -0.9002227783203125, 0.5489170551300049, -0.0939134731888771, -0.09600906819105148, 0.58724445104599, 0.03616688773036003, -0.0845269113779068, 1.6074631214141846, -0.2567201554775238, -0.5101183652877808, 1.6780973672866821, 0.31725820899009705, -0.34028998017311096, ...
func GetOpenDataByData(data []byte) (openData *CwbOpenData, err error) { var d CwbOpenData openData = &d err = xml.Unmarshal(data, &openData) if err != nil { log.Println(string(data)) return openData, err } return openData, nil }
[ -0.2133094221353531, -0.48302796483039856, 0.509533166885376, -0.450968861579895, -1.8393757343292236, 0.8585684299468994, 0.5598990321159363, 0.2224711924791336, 0.6024425029754639, -0.47754308581352234, -0.32565152645111084, 0.3339141309261322, -0.8044112920761108, -0.05867636203765869, ...
func GetOpenData(apiKey string, dataID string) (openData *CwbOpenData, err error) { client.SetAPIKey(apiKey) return client.GetOpenData(dataID) }
[ -1.1385185718536377, 0.03389906883239746, 0.3293267488479614, -0.13991037011146545, -0.9312630295753479, 0.4719168543815613, -0.32897865772247314, 0.24983464181423187, 0.4364814758300781, -0.28984948992729187, -0.7901034355163574, 1.527883529663086, -1.1287717819213867, 0.23102471232414246...
func (Enum) EnumDescriptor() ([]byte, []int) { return file_examples_documents_example_proto_rawDescGZIP(), []int{0} }
[ -0.829085648059845, 0.33084747195243835, 0.5057733654975891, -0.47218412160873413, 0.2917409837245941, -0.37718185782432556, 0.3799411952495575, 0.2578575015068054, 0.5165515542030334, 0.23786669969558716, -0.38021597266197205, 0.19688452780246735, 0.03288467973470688, 1.1309181451797485, ...
func (*ExampleDocument) Descriptor() ([]byte, []int) { return file_examples_documents_example_proto_rawDescGZIP(), []int{0} }
[ 0.033601365983486176, 0.7709131240844727, 0.23910056054592133, -0.4817602038383484, -0.722762942314148, 0.47996649146080017, 0.4997217655181885, 0.5190577507019043, -0.2664436995983124, -0.027662280946969986, -1.1484509706497192, 0.8745543956756592, -0.4908445179462433, 0.7072779536247253,...
func (*AllFieldTypes) Descriptor() ([]byte, []int) { return file_examples_documents_example_proto_rawDescGZIP(), []int{1} }
[ -0.35001036524772644, 0.39495739340782166, 0.2125345915555954, -0.09175459295511246, -0.8393216729164124, -0.6999489068984985, 0.05531603470444679, 0.6411852836608887, -0.10935929417610168, -0.6745892763137817, -1.3011212348937988, 0.2982073128223419, -1.092555046081543, 1.3903623819351196...
func (*AllFieldTypesSalts) Descriptor() ([]byte, []int) { return file_examples_documents_example_proto_rawDescGZIP(), []int{2} }
[ -0.6397131085395813, 0.6096340417861938, 0.13738492131233215, -0.13798949122428894, -1.0863065719604492, -0.32017701864242554, 0.438576340675354, -0.5158122181892395, 0.18562552332878113, -0.9898020029067993, -0.9729940295219421, 0.29681697487831116, -0.07610989362001419, 1.395988225936889...
func (*SimpleItem) Descriptor() ([]byte, []int) { return file_examples_documents_example_proto_rawDescGZIP(), []int{3} }
[ -0.4918060302734375, 0.310606449842453, 0.14824452996253967, 0.6749679446220398, -0.06984484195709229, 0.43925681710243225, 0.38001272082328796, 0.819115936756134, 0.06101182475686073, -0.7394728660583496, -1.1124749183654785, -0.16060130298137665, 0.11357980221509933, -0.17379947006702423...