text stringlengths 11 6.3k | embedding listlengths 768 768 |
|---|---|
func (mr *MockReaderMockRecorder) Values(arg0 interface{}) *gomock.Call {
mr.mock.ctrl.T.Helper()
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Values", reflect.TypeOf((*MockReader)(nil).Values), arg0)
} | [
-0.5638529062271118,
1.1187822818756104,
0.11006985604763031,
-0.42274895310401917,
0.4042094647884369,
0.34501564502716064,
-0.5664585828781128,
-0.9599770307540894,
0.6853569149971008,
-0.17857009172439575,
0.6717878580093384,
-0.08568280190229416,
-0.6123872399330139,
2.282700777053833,... |
func NewMockValues(ctrl *gomock.Controller) *MockValues {
mock := &MockValues{ctrl: ctrl}
mock.recorder = &MockValuesMockRecorder{mock}
return mock
} | [
0.009604067541658878,
0.7313624620437622,
0.32682085037231445,
0.8298935890197754,
0.3415885865688324,
-0.32405099272727966,
-0.18320557475090027,
-0.23590107262134552,
-0.08513464033603668,
-0.3106938302516937,
-0.5545186400413513,
-0.44860348105430603,
-0.002164749661460519,
1.5691957473... |
func (m *MockValues) EXPECT() *MockValuesMockRecorder {
return m.recorder
} | [
0.27270275354385376,
0.32706883549690247,
0.2878066599369049,
0.18999473750591278,
0.2781153917312622,
0.31555113196372986,
-0.3114984333515167,
0.21559712290763855,
0.06292537599802017,
-0.7677722573280334,
0.7499990463256836,
0.5058784484863281,
-0.2609497606754303,
1.1509325504302979,
... |
func (m *MockValues) Bytes() []byte {
m.ctrl.T.Helper()
ret := m.ctrl.Call(m, "Bytes")
ret0, _ := ret[0].([]byte)
return ret0
} | [
-0.5675915479660034,
0.6395341157913208,
0.09766947478055954,
-0.210527703166008,
1.082275152206421,
0.7404999732971191,
0.1802036464214325,
-0.5966596007347107,
-0.2022855281829834,
-1.108883261680603,
-0.14114229381084442,
-0.49669793248176575,
-0.7695977091789246,
1.3645604848861694,
... |
func (mr *MockValuesMockRecorder) Bytes() *gomock.Call {
mr.mock.ctrl.T.Helper()
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Bytes", reflect.TypeOf((*MockValues)(nil).Bytes))
} | [
-0.1479971706867218,
1.6701867580413818,
0.1417689174413681,
-0.5263866186141968,
0.10334581136703491,
0.6219491958618164,
-0.7799476385116577,
-1.1963372230529785,
1.0289626121520996,
-0.5141381621360779,
0.5221709609031677,
0.6108365058898926,
-0.9481518864631653,
1.5843666791915894,
-... |
func (m *MockValues) Get(path ...string) reader.Value {
m.ctrl.T.Helper()
varargs := []interface{}{}
for _, a := range path {
varargs = append(varargs, a)
}
ret := m.ctrl.Call(m, "Get", varargs...)
ret0, _ := ret[0].(reader.Value)
return ret0
} | [
-1.075188398361206,
-0.34033140540122986,
0.522006094455719,
0.17156493663787842,
1.3515180349349976,
0.24744804203510284,
0.3254289925098419,
-0.3854268789291382,
-1.5760784149169922,
-0.3350850045681,
0.11525891721248627,
-0.8313995003700256,
-0.6825775504112244,
0.714259147644043,
0.7... |
func (mr *MockValuesMockRecorder) Get(path ...interface{}) *gomock.Call {
mr.mock.ctrl.T.Helper()
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Get", reflect.TypeOf((*MockValues)(nil).Get), path...)
} | [
-0.5756001472473145,
0.5423233509063721,
0.40880003571510315,
0.0021282758098095655,
0.7311181426048279,
0.024288402870297432,
-0.7675058841705322,
-1.1829068660736084,
-0.0020021807868033648,
0.26508745551109314,
0.7765454053878784,
0.9152049422264099,
-0.6496686339378357,
1.1361771821975... |
func (m *MockValues) Map() map[string]interface{} {
m.ctrl.T.Helper()
ret := m.ctrl.Call(m, "Map")
ret0, _ := ret[0].(map[string]interface{})
return ret0
} | [
-0.8084790110588074,
0.010117212310433388,
0.44381338357925415,
0.8938202261924744,
0.2618291974067688,
1.0237908363342285,
0.9371808171272278,
-0.21045449376106262,
0.22315366566181183,
0.0380815751850605,
0.09919165819883347,
-0.6850117444992065,
-0.09339211136102676,
0.9399996399879456,... |
func (mr *MockValuesMockRecorder) Map() *gomock.Call {
mr.mock.ctrl.T.Helper()
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Map", reflect.TypeOf((*MockValues)(nil).Map))
} | [
-0.23821574449539185,
0.6405895352363586,
0.37593764066696167,
0.6260997653007507,
-0.3651883900165558,
0.8185601234436035,
-0.4588477313518524,
-0.6147282719612122,
1.334486722946167,
0.33957916498184204,
0.9378440380096436,
0.30372461676597595,
-0.40744325518608093,
1.4529448747634888,
... |
func (m *MockValues) Scan(v interface{}) error {
m.ctrl.T.Helper()
ret := m.ctrl.Call(m, "Scan", v)
ret0, _ := ret[0].(error)
return ret0
} | [
-0.8571827411651611,
0.26191315054893494,
-0.0020538517273962498,
0.5605873465538025,
0.49996817111968994,
0.05378498136997223,
1.2519246339797974,
-0.5896915793418884,
-0.7231645584106445,
-0.9399261474609375,
-0.04787847027182579,
-0.46868354082107544,
-0.702211856842041,
0.9958688616752... |
func (mr *MockValuesMockRecorder) Scan(v interface{}) *gomock.Call {
mr.mock.ctrl.T.Helper()
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Scan", reflect.TypeOf((*MockValues)(nil).Scan), v)
} | [
-0.5712995529174805,
0.9837703108787537,
0.08715290576219559,
0.6233683228492737,
-0.3963503837585449,
0.07653674483299255,
0.28186875581741333,
-0.8221898674964905,
0.4866947829723358,
-0.20311234891414642,
0.6290392875671387,
0.42669132351875305,
-0.7932421565055847,
1.5772470235824585,
... |
func NewMockValue(ctrl *gomock.Controller) *MockValue {
mock := &MockValue{ctrl: ctrl}
mock.recorder = &MockValueMockRecorder{mock}
return mock
} | [
0.2274399697780609,
0.43325769901275635,
0.29141244292259216,
0.5949967503547668,
0.3585297167301178,
-0.14499975740909576,
-0.03439908102154732,
-0.15883688628673553,
-0.18515749275684357,
-0.05351114273071289,
-0.5399547219276428,
0.2933827340602875,
0.36632007360458374,
1.18487083911895... |
func (m *MockValue) EXPECT() *MockValueMockRecorder {
return m.recorder
} | [
0.027507955208420753,
0.0688350573182106,
0.3200473189353943,
0.4747141897678375,
-0.09749604761600494,
0.21937443315982819,
0.058750443160533905,
0.022299470379948616,
0.20833565294742584,
-0.43691515922546387,
0.7331770658493042,
0.6446705460548401,
-0.44186869263648987,
0.85140079259872... |
func (m *MockValue) Bool(def bool) bool {
m.ctrl.T.Helper()
ret := m.ctrl.Call(m, "Bool", def)
ret0, _ := ret[0].(bool)
return ret0
} | [
0.0383964441716671,
0.27822086215019226,
0.2132488489151001,
0.8517584204673767,
1.0230708122253418,
0.8426182270050049,
1.4308950901031494,
0.48148080706596375,
-1.0100778341293335,
0.37497663497924805,
-0.613730251789093,
-0.05932735279202461,
-0.11810064315795898,
0.5992370247840881,
... |
func (mr *MockValueMockRecorder) Bool(def interface{}) *gomock.Call {
mr.mock.ctrl.T.Helper()
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Bool", reflect.TypeOf((*MockValue)(nil).Bool), def)
} | [
0.3037744462490082,
1.0798873901367188,
0.30470916628837585,
0.4583967626094818,
-0.02490011230111122,
0.4921944737434387,
0.1968608945608139,
-0.25721684098243713,
0.42535749077796936,
0.7639602422714233,
0.3646305799484253,
0.9222003221511841,
-0.17472544312477112,
0.9128866195678711,
... |
func (m *MockValue) Bytes() []byte {
m.ctrl.T.Helper()
ret := m.ctrl.Call(m, "Bytes")
ret0, _ := ret[0].([]byte)
return ret0
} | [
-0.6151903867721558,
0.5772505402565002,
0.11212462931871414,
-0.22277751564979553,
0.9677375555038452,
0.6945557594299316,
0.23389850556850433,
-0.6133962869644165,
-0.2101411670446396,
-1.0369036197662354,
-0.12675555050373077,
-0.5369358658790588,
-0.7387265563011169,
1.345537543296814,... |
func (mr *MockValueMockRecorder) Bytes() *gomock.Call {
mr.mock.ctrl.T.Helper()
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Bytes", reflect.TypeOf((*MockValue)(nil).Bytes))
} | [
-0.21598215401172638,
1.57035231590271,
0.1443471759557724,
-0.5799403786659241,
-0.05739693343639374,
0.5342028141021729,
-0.6534932255744934,
-1.2598402500152588,
1.0878418684005737,
-0.3872162699699402,
0.5460205078125,
0.670068085193634,
-0.9833938479423523,
1.5477434396743774,
-0.26... |
func (m *MockValue) Duration(def time.Duration) time.Duration {
m.ctrl.T.Helper()
ret := m.ctrl.Call(m, "Duration", def)
ret0, _ := ret[0].(time.Duration)
return ret0
} | [
-0.3336825370788574,
0.12906545400619507,
0.12649133801460266,
1.0725483894348145,
1.1564784049987793,
0.6493679881095886,
1.1023231744766235,
-0.47288116812705994,
-0.5089727640151978,
0.5396116971969604,
-0.6659045219421387,
-0.6032373905181885,
-0.19639867544174194,
1.5353052616119385,
... |
func (mr *MockValueMockRecorder) Duration(def interface{}) *gomock.Call {
mr.mock.ctrl.T.Helper()
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Duration", reflect.TypeOf((*MockValue)(nil).Duration), def)
} | [
-0.1383982002735138,
0.9991227984428406,
0.03635324910283089,
0.6359634399414062,
0.2697066068649292,
0.3780710995197296,
0.04639790579676628,
-0.8834998607635498,
0.7337045073509216,
1.023842692375183,
0.3089548945426941,
0.2726615071296692,
-0.37739884853363037,
1.9077112674713135,
-0.... |
func (m *MockValue) Float64(def float64) float64 {
m.ctrl.T.Helper()
ret := m.ctrl.Call(m, "Float64", def)
ret0, _ := ret[0].(float64)
return ret0
} | [
-0.4426461160182953,
0.4914303421974182,
0.221527099609375,
1.3905142545700073,
1.5860178470611572,
-0.2791222333908081,
1.1108289957046509,
-0.3884022831916809,
-0.9885668158531189,
-0.517075777053833,
-0.18489176034927368,
-0.6489331722259521,
-0.8967722058296204,
1.3957616090774536,
-... |
func (mr *MockValueMockRecorder) Float64(def interface{}) *gomock.Call {
mr.mock.ctrl.T.Helper()
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Float64", reflect.TypeOf((*MockValue)(nil).Float64), def)
} | [
-0.2947520315647125,
1.2743377685546875,
0.22403784096240997,
0.7738136053085327,
0.5516163110733032,
-0.2978447675704956,
-0.08748181164264679,
-0.9142962098121643,
0.3614865839481354,
0.14957769215106964,
0.8224515914916992,
0.3228556215763092,
-0.7620534300804138,
1.7517211437225342,
... |
func (m *MockValue) Int(def int) int {
m.ctrl.T.Helper()
ret := m.ctrl.Call(m, "Int", def)
ret0, _ := ret[0].(int)
return ret0
} | [
-0.10299389809370041,
0.30917420983314514,
0.16071844100952148,
-0.0715835765004158,
1.267420768737793,
0.5050676465034485,
0.6729719638824463,
-0.5012842416763306,
-1.36790931224823,
0.21554148197174072,
-0.5476651191711426,
-0.38098183274269104,
-0.5057519674301147,
1.349151849746704,
... |
func (mr *MockValueMockRecorder) Int(def interface{}) *gomock.Call {
mr.mock.ctrl.T.Helper()
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Int", reflect.TypeOf((*MockValue)(nil).Int), def)
} | [
-0.205276221036911,
1.1926345825195312,
0.21663379669189453,
-0.4658973217010498,
-0.04284524545073509,
0.3493642807006836,
-0.3000507950782776,
-1.2509965896606445,
-0.25884100794792175,
0.8926874995231628,
0.34072914719581604,
0.20929616689682007,
-0.3364492356777191,
1.4990569353103638,... |
func (m *MockValue) Scan(val interface{}) error {
m.ctrl.T.Helper()
ret := m.ctrl.Call(m, "Scan", val)
ret0, _ := ret[0].(error)
return ret0
} | [
-0.908702552318573,
0.30465957522392273,
0.061780571937561035,
0.6602442860603333,
-0.026575129479169846,
0.17534318566322327,
1.088407278060913,
-0.944817841053009,
-0.5503106713294983,
-0.9485599994659424,
0.056478701531887054,
-0.38010212779045105,
-0.5070449113845825,
1.236351966857910... |
func (mr *MockValueMockRecorder) Scan(val interface{}) *gomock.Call {
mr.mock.ctrl.T.Helper()
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Scan", reflect.TypeOf((*MockValue)(nil).Scan), val)
} | [
-0.7158039808273315,
0.9116191267967224,
0.22334063053131104,
0.7143062353134155,
-0.8183481097221375,
0.07318468391895294,
0.22311973571777344,
-1.022051215171814,
0.6746593117713928,
-0.08767269551753998,
0.6119351387023926,
0.510362446308136,
-0.769714891910553,
1.6898623704910278,
0.... |
func (m *MockValue) String(def string) string {
m.ctrl.T.Helper()
ret := m.ctrl.Call(m, "String", def)
ret0, _ := ret[0].(string)
return ret0
} | [
-0.20494697988033295,
-0.06931372731924057,
-0.10951798409223557,
0.560843288898468,
1.1134583950042725,
0.6082121133804321,
1.4247342348098755,
-0.8001952171325684,
-0.7966060042381287,
0.12032363563776016,
-0.588546633720398,
-0.06952117383480072,
-0.730654776096344,
0.7679427266120911,
... |
func (mr *MockValueMockRecorder) String(def interface{}) *gomock.Call {
mr.mock.ctrl.T.Helper()
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "String", reflect.TypeOf((*MockValue)(nil).String), def)
} | [
-0.07733453810214996,
0.7226238250732422,
-0.056604690849781036,
0.0733567476272583,
-0.1509770303964615,
0.37901991605758667,
0.36581477522850037,
-1.7389044761657715,
0.37891432642936707,
0.51678067445755,
0.34867990016937256,
0.7486103177070618,
-0.8291739225387573,
1.202291488647461,
... |
func (m *MockValue) StringMap(def map[string]string) map[string]string {
m.ctrl.T.Helper()
ret := m.ctrl.Call(m, "StringMap", def)
ret0, _ := ret[0].(map[string]string)
return ret0
} | [
-0.34687551856040955,
-0.13168060779571533,
0.16090594232082367,
0.5657649636268616,
0.9496652483940125,
0.09859024733304977,
0.7902501821517944,
-0.35487234592437744,
-0.6786435842514038,
-0.20846621692180634,
-0.20295105874538422,
-0.08486192673444748,
-1.0164566040039062,
0.652441740036... |
func (mr *MockValueMockRecorder) StringMap(def interface{}) *gomock.Call {
mr.mock.ctrl.T.Helper()
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "StringMap", reflect.TypeOf((*MockValue)(nil).StringMap), def)
} | [
0.04402275010943413,
0.8231098651885986,
0.15413255989551544,
0.22028224170207977,
0.1920928955078125,
0.020741326734423637,
-0.17592944204807281,
-0.9175348281860352,
0.8211895227432251,
0.3473735451698303,
0.8471320867538452,
0.6136130690574646,
-1.1731969118118286,
0.9140723943710327,
... |
func (m *MockValue) StringSlice(def []string) []string {
m.ctrl.T.Helper()
ret := m.ctrl.Call(m, "StringSlice", def)
ret0, _ := ret[0].([]string)
return ret0
} | [
-0.9637740254402161,
-0.11882517486810684,
-0.056203246116638184,
0.3863002061843872,
1.0892784595489502,
-0.35256874561309814,
0.06110452860593796,
-0.3415108919143677,
-1.326766014099121,
0.11955118924379349,
-0.41557902097702026,
0.2208169549703598,
-1.0586165189743042,
1.29136800765991... |
func (mr *MockValueMockRecorder) StringSlice(def interface{}) *gomock.Call {
mr.mock.ctrl.T.Helper()
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "StringSlice", reflect.TypeOf((*MockValue)(nil).StringSlice), def)
} | [
-0.46136870980262756,
0.7145845293998718,
0.029988886788487434,
0.010102956555783749,
0.08367114514112473,
-0.4707385301589966,
-0.6589776873588562,
-0.9968032836914062,
0.21067503094673157,
0.875952422618866,
0.5314650535583496,
0.7158619165420532,
-1.0938864946365356,
1.5041309595108032,... |
func random(services []*registry.ServiceURL) Next {
return func(ID uint64) (*registry.ServiceURL, error) {
if len(services) == 0 {
return nil, ErrNoneAvailable
}
i := ((uint64)(rand.Int()) + ID) % (uint64)(len(services))
return services[i], nil
}
} | [
-1.493283748626709,
0.42106643319129944,
0.2778671085834503,
-0.23925656080245972,
-0.726359486579895,
0.3584708571434021,
0.1937566101551056,
-0.6478000283241272,
1.1425060033798218,
-0.8443924188613892,
0.5582382678985596,
0.4743959307670593,
-0.815478503704071,
0.3326879143714905,
-0.... |
func roundRobin(services []*registry.ServiceURL) Next {
var i uint64
var mtx sync.Mutex
return func(ID uint64) (*registry.ServiceURL, error) {
if len(services) == 0 {
return nil, ErrNoneAvailable
}
mtx.Lock()
node := services[(ID+i)%(uint64)(len(services))]
i++
mtx.Unlock()
return node, nil
}
} | [
-0.899909496307373,
0.057681918144226074,
0.5486024022102356,
-0.7257879972457886,
-0.15701641142368317,
0.07493092864751816,
0.2468588501214981,
-1.192322015762329,
0.20268265902996063,
-0.43932420015335083,
0.9314144849777222,
0.7559864521026611,
-1.4926117658615112,
0.20821692049503326,... |
func Middleware(locale *Locale) func(http.Handler) http.Handler {
return func(next http.Handler) http.Handler {
return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
ctx := context.WithValue(r.Context(), ctxKey, locale)
next.ServeHTTP(w, r.WithContext(ctx))
})
}
} | [
-0.12142950296401978,
0.15912458300590515,
0.49466472864151,
-0.05652548000216484,
-1.01474928855896,
0.2691715359687805,
-0.6002992987632751,
0.08332931995391846,
-0.22487092018127441,
-0.2609650790691376,
0.18613174557685852,
-0.34724047780036926,
0.2014700472354889,
-0.5050554871559143,... |
func CtxLocale(ctx context.Context) *Locale {
return ctx.Value(ctxKey).(*Locale)
} | [
0.41975751519203186,
-1.2620664834976196,
-0.046601321548223495,
0.15013204514980316,
-1.053945541381836,
0.49729472398757935,
-0.5927311778068542,
-0.15621717274188995,
0.45432281494140625,
-0.3728868365287781,
0.27607253193855286,
0.13961772620677948,
0.39767423272132874,
-0.624867141246... |
func FromFiles(dir, lang string) (*Locale, error) {
locale := Locale{
Lang: lang,
Data: make(map[string]interface{}),
}
basePath := fmt.Sprintf("%s/%s/", dir, lang)
files, err := ioutil.ReadDir(basePath)
if err != nil {
return &locale, err
}
for _, file := range files {
var target interface{}
contents... | [
0.7903496026992798,
-0.5001369118690491,
0.4975208640098572,
-0.41264471411705017,
-0.5036940574645996,
-0.3980162441730499,
-0.40841785073280334,
0.4208703637123108,
-0.6343962550163269,
0.13927151262760162,
0.3702636659145355,
0.1805751621723175,
0.34243306517601013,
0.017050644382834435... |
func (l Locale) Get(key string) string {
arr := strings.Split(key, ".")
var obj interface{} = l.Data
var err error
for _, k := range arr {
obj, err = getProperty(obj, k)
if err != nil {
return key
}
if obj == nil {
return key
}
}
value := fmt.Sprintf("%s", obj)
if strings.HasPrefix(value, Referen... | [
-0.45306792855262756,
-0.5873571038246155,
0.844028115272522,
-0.7296392321586609,
-0.07616137713193893,
-0.4624377191066742,
-0.5712569355964661,
-0.4938028156757355,
-0.26038336753845215,
0.7460773587226868,
0.7430699467658997,
0.55172199010849,
0.320997416973114,
0.05296548828482628,
... |
func (l Locale) GetVar(key string, vars map[string]string) string {
out := l.Get(key)
// Replace named data variables.
for k, value := range vars {
out = strings.ReplaceAll(out, fmt.Sprintf("{%s}", k), value)
}
return out
} | [
-0.06130719184875488,
-0.3564833402633667,
0.1711198091506958,
-0.6869234442710876,
-0.7759708762168884,
-0.4034488797187805,
-1.0183851718902588,
0.33335962891578674,
-0.8834188580513,
-0.046051111072301865,
0.08263394981622696,
0.7280820608139038,
0.7355020046234131,
-0.5038767457008362,... |
func (l Locale) JSON() (string, error) {
b, err := json.Marshal(l.Data)
if err != nil {
return "", err
}
return string(b), nil
} | [
0.34239375591278076,
-0.6994426250457764,
0.4672888517379761,
-0.9758691787719727,
-0.8658439517021179,
0.034127797931432724,
-0.6642395257949829,
-0.2925753593444824,
0.24922552704811096,
0.23576131463050842,
-0.01808040589094162,
0.8087463974952698,
-0.15766994655132294,
0.01938147284090... |
func HandleFunc(dir string) http.HandlerFunc {
return func(w http.ResponseWriter, r *http.Request) {
locale, err := FromFiles(dir, router.Param(r, "locale"))
if err != nil {
render.Error(w, err)
return
}
j, err := locale.JSON()
if err != nil {
render.Error(w, err)
return
}
w.WriteHeader(200... | [
0.18036405742168427,
-0.40470874309539795,
0.5679811239242554,
-0.616017758846283,
-0.43602898716926575,
-0.45523011684417725,
0.6171115636825562,
0.7183171510696411,
-0.5414836406707764,
0.32250434160232544,
0.6835944056510925,
-0.0321979820728302,
1.3497880697250366,
0.055927153676748276... |
func getProperty(obj interface{}, prop string) (interface{}, error) {
if reflect.TypeOf(obj).Kind() == reflect.Map {
val := reflect.ValueOf(obj)
valueOf := val.MapIndex(reflect.ValueOf(prop))
if valueOf == reflect.Zero(reflect.ValueOf(prop).Type()) {
return nil, nil
}
idx := val.MapIndex(reflect.ValueOf(... | [
-0.372257798910141,
-0.7362431287765503,
0.9061403870582581,
0.7267762422561646,
-0.0661625787615776,
-0.3662048280239105,
0.3295742869377136,
-0.34963658452033997,
0.5817513465881348,
0.1758037805557251,
0.3765442669391632,
0.30576997995376587,
-0.6482235789299011,
-1.0155025720596313,
... |
func NewRegister(addr string) *Register {
return &Register{
address: addr,
Timeout: time.Duration(1) * time.Minute,
Interval: time.Duration(5) * time.Second,
}
} | [
0.05333516374230385,
0.29252463579177856,
0.2507576644420624,
0.24617111682891846,
-1.143359661102295,
-0.29205751419067383,
-0.5609503984451294,
-0.3632405400276184,
-0.17325907945632935,
0.2983044683933258,
-0.5766232013702393,
0.7695904970169067,
-0.6993727087974548,
0.8276932835578918,... |
func Exec(o, e io.Writer, cmd string, env, params []string) error {
var stdOut, stdErr io.ReadCloser
var wg sync.WaitGroup
x := exec.Command(cmd, params...)
stdErr, err := x.StderrPipe()
if err != nil {
return err
}
stdOut, err = x.StdoutPipe()
if err != nil {
return err
}
wg.Add(2)
go func() {
io.... | [
0.41007906198501587,
0.19771678745746613,
0.9029642343521118,
0.5682862997055054,
-0.36354243755340576,
0.1820351779460907,
0.10586216300725937,
-0.1921555995941162,
-1.0524522066116333,
0.5546143054962158,
0.36112603545188904,
0.5012379884719849,
0.6952278017997742,
0.41618412733078003,
... |
func NewConfigFromMap(configMap map[string]string) (*Config, error) {
nc := defaultConfig()
if err := cm.Parse(configMap,
cm.AsString(QueueSidecarImageKey, &nc.QueueSidecarImage),
cm.AsDuration(ProgressDeadlineKey, &nc.ProgressDeadline),
cm.AsStringSet(registriesSkippingTagResolvingKey, &nc.RegistriesSkippingT... | [
0.11892137676477432,
-0.4843645393848419,
0.13765576481819153,
0.609818696975708,
-0.625744104385376,
-0.25220543146133423,
-0.8010765314102173,
0.4522415101528168,
-1.1334105730056763,
0.4213174283504486,
-0.42886266112327576,
-1.0554733276367188,
-0.48008209466934204,
1.2726032733917236,... |
func NewConfigFromConfigMap(config *corev1.ConfigMap) (*Config, error) {
return NewConfigFromMap(config.Data)
} | [
-0.2880682349205017,
-0.08373942971229553,
-0.23541654646396637,
0.8964428305625916,
-1.3658115863800049,
-0.5843366980552673,
-0.23044389486312866,
0.4830845594406128,
0.21726331114768982,
0.9923074245452881,
-1.3046010732650757,
-0.75285804271698,
-0.8971079587936401,
0.4420526921749115,... |
func (c *sentryCore) GetSentryClient() *sentry.Client {
return c.client
} | [
0.19133436679840088,
-0.2370843142271042,
0.27566221356391907,
0.3858937621116638,
0.07270579785108566,
-0.08043542504310608,
0.6546143293380737,
0.026752671226859093,
0.10465268790721893,
-0.12949801981449127,
-0.3284895122051239,
1.4030381441116333,
-0.8378746509552002,
-0.69468480348587... |
func (c *sentryCore) With(fs []zapcore.Field) zapcore.Core {
return c.with(fs)
} | [
-0.22952665388584137,
-0.24999888241291046,
0.5053125619888306,
-0.20996764302253723,
-0.10624763369560242,
-0.18362145125865936,
-0.0926448330283165,
-0.6370647549629211,
0.310334712266922,
-0.007755734957754612,
-0.36198562383651733,
-0.41130688786506653,
-0.42726120352745056,
-0.0493112... |
func (c *sentryCore) Check(ent zapcore.Entry, ce *zapcore.CheckedEntry) *zapcore.CheckedEntry {
if c.cfg.Level.Enabled(ent.Level) {
return ce.AddCore(ent, c)
}
return ce
} | [
0.3648931682109833,
0.5713151693344116,
0.4501838684082031,
0.8333097696304321,
0.4745730757713318,
0.7936734557151794,
-0.060675110667943954,
0.2954023480415344,
-0.21591587364673615,
1.4849672317504883,
0.7866216897964478,
0.2956658601760864,
-0.9163467884063721,
0.7889718413352966,
0.... |
func (c *sentryCore) Write(ent zapcore.Entry, fs []zapcore.Field) error {
clone := c.with(fs)
event := sentry.NewEvent()
event.Message = ent.Message
event.Timestamp = ent.Time
event.Level = sentryLevel(ent.Level)
event.Platform = "go"
event.Extra = clone.fields
event.Tags = c.cfg.Tags
if !c.cfg.DisableStackt... | [
-0.43719682097435,
0.37061524391174316,
0.6324179172515869,
0.02267533354461193,
0.8794764280319214,
-0.003415436716750264,
0.1391119360923767,
0.12407779693603516,
0.022939207032322884,
0.5857570171356201,
-0.5497881770133972,
0.09383577108383179,
-0.6443421244621277,
0.5656874179840088,
... |
func (c *sentryCore) Sync() error {
c.client.Flush(c.flushTimeout)
return nil
} | [
0.27482032775878906,
0.42945122718811035,
0.2082655429840088,
0.13845744729042053,
-0.09738607704639435,
0.11034416407346725,
-0.409455269575119,
-1.049946904182434,
-0.7304046750068665,
1.099062442779541,
0.002385602565482259,
1.318232536315918,
-0.24682287871837616,
0.3203291594982147,
... |
func NewSentryCore(cfg SentryCoreConfig, sentryClient *sentry.Client) zapcore.Core {
core := sentryCore{
client: sentryClient,
cfg: &cfg,
LevelEnabler: cfg.Level,
flushTimeout: 3 * time.Second,
fields: make(map[string]interface{}),
}
if cfg.FlushTimeout > 0 {
core.flushTimeout = cfg... | [
0.33745673298835754,
-0.2641974687576294,
0.32160288095474243,
-0.3228576183319092,
-0.9352146983146667,
0.1763080358505249,
-0.20989283919334412,
0.024882234632968903,
-0.3200486898422241,
1.3797210454940796,
-0.1795240342617035,
-0.1764334887266159,
-1.4167473316192627,
0.506134629249572... |
func NewSentryClient(options sentry.ClientOptions) (*sentry.Client, error) {
client, err := sentry.NewClient(options)
if err != nil {
return nil, err
}
// init sentry hub
sentry.Init(options)
return client, nil
} | [
0.43782350420951843,
-0.31059637665748596,
0.32140135765075684,
0.47326579689979553,
-0.14246180653572083,
0.13689234852790833,
0.10588176548480988,
-0.2072587013244629,
0.005676858592778444,
0.4259518086910248,
-0.49769097566604614,
0.4952913820743561,
-0.85747891664505,
-0.20741397142410... |
func main() {
var seeds []string
var links []string
seeds = os.Args[1:]
fmt.Printf("Starting crawler with seeds: %s\n", strings.Join(seeds, ", "))
// for each seed:
for _, s := range seeds {
log.Printf("Visiting %s", s)
//get their content - net/http
response, err := http.Get(s)
if err != nil {
log.... | [
0.2233797162771225,
-0.17808008193969727,
0.9827982783317566,
0.00006584781658602878,
0.1618427187204361,
-0.07756359875202179,
0.8780330419540405,
0.30484750866889954,
-1.1595125198364258,
-0.7334274053573608,
0.6051178574562073,
-0.15567775070667267,
-0.06646987795829773,
0.9902425408363... |
func GetPodTemplateWithGeneration(template v1.PodTemplateSpec, generation int64) v1.PodTemplateSpec {
obj, _ := api.Scheme.DeepCopy(template)
newTemplate := obj.(v1.PodTemplateSpec)
// DaemonSet pods shouldn't be deleted by NodeController in case of node problems.
// Add infinite toleration for taint notReady:NoExe... | [
-1.0815967321395874,
-0.3719814121723175,
0.5522539019584656,
-0.6432273983955383,
-0.3201085329055786,
-0.13431397080421448,
-0.40076157450675964,
-0.9809964895248413,
-0.017889777198433876,
0.2419521063566208,
0.16584961116313934,
-0.33670663833618164,
0.34770360589027405,
-0.21906204521... |
func IsPodUpdated(dsTemplateGeneration int64, pod *v1.Pod) bool {
podTemplateGeneration, generationExists := pod.ObjectMeta.Labels[extensions.DaemonSetTemplateGenerationKey]
dsTemplateGenerationStr := fmt.Sprint(dsTemplateGeneration)
return generationExists && podTemplateGeneration == dsTemplateGenerationStr
} | [
-1.6384761333465576,
-0.47512078285217285,
0.5516232252120972,
-0.5898759365081787,
-0.5268696546554565,
0.1173829585313797,
-0.2238594889640808,
-0.1338777393102646,
0.17751595377922058,
0.2537444829940796,
-0.6709760427474976,
-0.00022883652127347887,
0.18422047793865204,
-0.228009998798... |
func SplitByAvailablePods(minReadySeconds int32, pods []*v1.Pod) ([]*v1.Pod, []*v1.Pod) {
unavailablePods := []*v1.Pod{}
availablePods := []*v1.Pod{}
for _, pod := range pods {
if v1.IsPodAvailable(pod, minReadySeconds, metav1.Now()) {
availablePods = append(availablePods, pod)
} else {
unavailablePods = a... | [
-1.5951367616653442,
-0.7458207011222839,
0.41709449887275696,
-0.21126332879066467,
-0.5217874050140381,
-0.23641905188560486,
-0.7081130146980286,
-0.12564092874526978,
-0.17369791865348816,
1.6990872621536255,
-0.6219635009765625,
0.14602093398571014,
-0.37798556685447693,
-0.1224842071... |
func (d *deviceRef) resolveFromGptTable(devPath string, t []gptPart) *deviceRef {
if d.format != refGptType && d.format != refGptUUID && d.format != refGptLabel && d.format != refGptUUIDPartoff {
return d
}
for _, p := range t {
switch d.format {
case refGptType:
if bytes.Equal(d.data.(UUID), p.typeGUID) {... | [
-0.06664420664310455,
-0.5274925231933594,
0.7524985671043396,
0.25011903047561646,
-0.5918563008308411,
0.27596142888069153,
-0.11941733956336975,
-0.8367130160331726,
-0.6478014588356018,
-0.06587507575750351,
0.7228050231933594,
-0.5905572175979614,
-0.3852582573890686,
0.16641430556774... |
func gptContainsEsp(t []gptPart) bool {
for _, p := range t {
if bytes.Equal(activeEfiEspGUID, p.uuid) {
return true
}
}
return false
} | [
0.22634357213974,
-0.8290371298789978,
0.36813628673553467,
-0.14771322906017303,
0.8437492251396179,
0.6158463358879089,
-1.0412883758544922,
-0.10777271538972855,
-0.8641438484191895,
1.4056103229522705,
0.06640273332595825,
-0.8267034888267517,
-1.089033842086792,
-0.22871433198451996,
... |
func splitWsQuote(s string) []string {
quote := rune(0)
return strings.FieldsFunc(s, func(r rune) bool {
switch {
case r == quote:
quote = rune(0)
return true
case quote != rune(0):
return false
case unicode.In(r, unicode.Quotation_Mark):
quote = r
return true
default:
return unicode.IsSp... | [
-0.3383639454841614,
-0.31692221760749817,
0.6052805185317993,
0.48987993597984314,
-0.13382984697818756,
-0.6254682540893555,
-0.3397737443447113,
-0.32853826880455017,
0.9501225352287292,
1.304781198501587,
-0.46296244859695435,
1.0752493143081665,
-1.0696324110031128,
1.0754603147506714... |
func (ck *Clerk) Get(key string) string {
DPrintf("CLIENT starting get of %s\n", key)
args := GetArgs{key, nrand()}
i := ck.leader
for {
var reply GetReply
DPrintf("CLIENT %d TRYING TO CALL GET on server %d for key %s\n", ck.id, i, key)
done := make(chan bool)
go func() {
ok := ck.servers[i].Call("RaftKV... | [
-0.9524151682853699,
0.08399973809719086,
0.9150667190551758,
-0.4872674345970154,
-0.21637418866157532,
-0.48588547110557556,
-0.2986673414707184,
-0.8942188024520874,
-0.31905877590179443,
0.7226422429084778,
0.26579922437667847,
1.2623692750930786,
-1.5657362937927246,
0.748798966407775... |
func (ck *Clerk) PutAppend(key string, value string, op Type) {
args := PutAppendArgs{key, value, op, nrand()}
i := ck.leader
for {
var reply PutAppendReply
DPrintf("CLIENT %d TRYING TO CALL PUT/APPEND on server %d for key %s and value %s\n", ck.id, i, key, value)
done := make(chan bool)
go func() {
ok :=... | [
-0.41136616468429565,
0.4697326123714447,
0.8706944584846497,
-0.25967249274253845,
-0.8047770857810974,
-0.08148559182882309,
0.0009727297583594918,
-0.6121959090232849,
0.0600837841629982,
1.2291157245635986,
0.4001479148864746,
0.7068836092948914,
-1.218766212463379,
1.012961745262146,
... |
func Parser() {
if err = conf.Parse(configLocation); err != nil {
errors.NewHccError(errors.ViolinNoVNCInternalParsingError, err.Error()).Fatal()
}
parseMysql()
parseGrpc()
parseHarp()
} | [
0.15079282224178314,
-0.19296227395534515,
0.1168428510427475,
0.1906699538230896,
0.1991937905550003,
0.2823004424571991,
0.7477168440818787,
0.32817497849464417,
-0.46590375900268555,
-0.24412406980991364,
-0.4859439730644226,
-0.4056234061717987,
-0.6471373438835144,
0.879645824432373,
... |
func RegisterModuleService(server *grpc.Server, gs store.GraphStoreClient) {
tracker.RegisterModuleServiceServer(server, &moduleService{gs: gs})
} | [
-0.9964826107025146,
-0.18077825009822845,
0.26190170645713806,
-0.47811487317085266,
0.7404147386550903,
0.5181655883789062,
-0.6616218686103821,
-0.8989353775978088,
-0.147476464509964,
0.21847325563430786,
-0.11669547110795975,
1.5736054182052612,
-0.8601270914077759,
0.5801295638084412... |
func (l *lexer) reset() {
l.attributes.value = nil
l.attributes.name = nil
l.tag.name = ""
l.tag.token = ""
} | [
0.39938148856163025,
-0.6451788544654846,
0.23522436618804932,
-0.8456944227218628,
-0.07259348779916763,
-0.3926693797111511,
-1.168882131576538,
-0.1652851402759552,
-1.5986063480377197,
0.19425831735134125,
-1.0091716051101685,
0.2694926857948303,
0.2150811105966568,
0.10776778310537338... |
func (l *lexer) readLines() error {
l.reset()
ln, _, err := l.bufReader.ReadLine()
if err != nil {
log.Printf("Error: bufio.ReadLine: %v\n", err)
}
l.currentLine = l.nextLine
l.nextLine = strings.TrimSpace(string(ln))
return err
} | [
0.5992202162742615,
-0.27446097135543823,
0.3438534140586853,
-0.9311342239379883,
0.21402327716350555,
-0.1293007880449295,
-0.9364705681800842,
0.15500310063362122,
-0.5317271947860718,
-0.44547051191329956,
0.281342089176178,
0.08433089405298233,
-0.2368823140859604,
0.23818930983543396... |
func Decode(r io.Reader, val interface{}) error {
return NewStream(r, 0).Decode(val)
} | [
0.2463884800672531,
-0.0762016773223877,
0.22197505831718445,
0.6789098978042603,
-0.7725343704223633,
-0.4160304069519043,
-0.5254960060119629,
-0.8428395986557007,
0.2974906861782074,
-0.4237976670265198,
0.6114368438720703,
0.07712502777576447,
-0.4818568229675293,
0.7996813058853149,
... |
func DecodeBytes(b []byte, val interface{}) error {
// initialize byte reader
r := bytes.NewReader(b)
if err := NewStream(r, uint64(len(b))).Decode(val); err != nil {
return err
}
if r.Len() > 0 {
return ErrMoreThanOneValue
}
return nil
} | [
-0.5178219079971313,
1.1439592838287354,
0.4724041223526001,
0.4659459590911865,
-0.006577327847480774,
-0.22169260680675507,
-0.5539394021034241,
0.13688792288303375,
0.428297758102417,
-0.08640408515930176,
0.18434274196624756,
-0.23064963519573212,
-1.1525874137878418,
0.653113365173339... |
func NewStream(r io.Reader, inputLimit uint64) *Stream {
s := new(Stream)
s.Reset(r, inputLimit)
return s
} | [
-0.08847565948963165,
0.11715026944875717,
0.22166548669338226,
1.1638212203979492,
-1.155983328819275,
-0.3052643835544586,
0.06512827426195145,
-0.2647430896759033,
0.499492883682251,
-0.4413888454437256,
0.31261560320854187,
1.044272780418396,
-0.18083207309246063,
-0.35319122672080994,... |
func (s *Stream) Reset(r io.Reader, inputLimit uint64) {
if inputLimit > 0 {
s.remaining = inputLimit
s.limited = true
} else {
// based on the type of the reader, set up the remaining and limited fields
// check if r is bytes reader or string reader
switch br := r.(type) {
case *bytes.Reader:
s.remain... | [
-0.0734478309750557,
-0.510974645614624,
0.5387369990348816,
-0.6042153239250183,
-0.6021991968154907,
-0.27578625082969666,
0.39601773023605347,
0.23089273273944855,
0.25067052245140076,
0.005289817228913307,
-0.07286375761032104,
0.9751207828521729,
-1.2749840021133423,
-0.06289193779230... |
func (s *Stream) Decode(val interface{}) error {
// if val does not pointed to any address, there is no place to store the decoded data
if val == nil {
return errDecodeIntoNil
}
// getting the value and the type of val
rval := reflect.ValueOf(val)
rtyp := rval.Type()
// the passed in val must be a pointer
i... | [
-0.4222489297389984,
0.207420215010643,
0.6528602838516235,
0.2633068859577179,
-0.7590973377227783,
-0.1034962385892868,
-0.03665977716445923,
-0.5896943211555481,
0.7325835227966309,
-0.5879313349723816,
0.564202606678009,
1.2140692472457886,
-0.38747328519821167,
1.0190342664718628,
0... |
func makeDecoder(typ reflect.Type, tags tags) (dec decoder, err error) {
kind := typ.Kind()
switch {
case typ == rawValueType:
return decodeRawValue, nil
// for data that implemented DecodeRLP method (pointer receiver)
case typ.Implements(decoderInterface):
return decodeDecoder, nil
// pointer type of the var... | [
-0.1092350035905838,
-0.8210485577583313,
0.805485725402832,
-0.3074550926685333,
-0.8235616087913513,
-0.16803918778896332,
-0.2490309774875641,
-0.6380079388618469,
0.13750247657299042,
-0.6143707036972046,
0.23696285486221313,
0.1762668490409851,
-0.8427538275718689,
0.5996403098106384,... |
func decodeRawValue(s *Stream, val reflect.Value) error {
// r will be byte slice with decoded values
r, err := s.Raw()
if err != nil {
return err
}
// sets val's underlying value (value that val pointed to) to r
val.SetBytes(r)
return nil
} | [
-0.4088025689125061,
-0.1287367194890976,
0.5236020088195801,
-0.8928852081298828,
-1.6618216037750244,
-0.021501675248146057,
-0.16220124065876007,
-0.024976462125778198,
0.41994601488113403,
-0.43134474754333496,
-0.4489951431751251,
0.8161596655845642,
0.9009411931037903,
0.901677370071... |
func decodeDecoder(s *Stream, val reflect.Value) error {
if val.Kind() == reflect.Ptr && val.IsNil() {
// set the value to the pointer pointed to the 0 represented by the data type
val.Set(reflect.New(val.Type().Elem()))
}
// transfer the reflect type back to Decoder interface type, and call DecodeRLP method
re... | [
-0.2636319696903229,
-0.2433645874261856,
0.5707705020904541,
-0.5105416178703308,
-1.0253928899765015,
0.03548974171280861,
-0.27194973826408386,
-0.46823614835739136,
0.7056902647018433,
-0.49313080310821533,
0.3344624638557434,
0.8728426098823547,
-0.30762922763824463,
1.18235445022583,... |
func decodeDecoderNoPtr(s *Stream, val reflect.Value) error {
return val.Addr().Interface().(Decoder).DecodeRLP(s)
} | [
-0.35255002975463867,
-0.40101540088653564,
0.44510409235954285,
-1.3997344970703125,
-2.2276246547698975,
0.14808273315429688,
-0.42237743735313416,
-0.6750945448875427,
0.9853610992431641,
-0.7465761303901672,
0.7726390361785889,
0.1807262897491455,
0.38451263308525085,
0.648734033107757... |
func decodeBigInt(s *Stream, val reflect.Value) error {
// get the content of the string
b, err := s.Bytes()
if err != nil {
return wrapStreamError(err, val.Type())
}
// assign i to *big.Int type (its' original type instead of the reflect.val type)
i := val.Interface().(*big.Int)
// this means the storage pr... | [
-0.14859908819198608,
-0.1821058988571167,
0.7020524144172668,
-0.399039089679718,
-0.2263641506433487,
-0.6009957790374756,
0.155803844332695,
-0.12911458313465118,
-0.13515448570251465,
-0.013386528007686138,
-0.4753094017505646,
0.7622236609458923,
-0.4565962851047516,
0.332450717687606... |
func decodeBigIntNoPtr(s *Stream, val reflect.Value) error {
return decodeBigInt(s, val.Addr())
} | [
-0.22388888895511627,
-0.2667272090911865,
0.20179973542690277,
-1.2359991073608398,
-1.1681766510009766,
-0.583236038684845,
0.2649897634983063,
-0.4035583734512329,
0.6885545253753662,
-0.08797166496515274,
0.3003658056259155,
0.912558913230896,
-0.22162054479122162,
0.6167702674865723,
... |
func decodeUint(s *Stream, val reflect.Value) error {
// for uint, the default size is 64 bits
typ := val.Type()
// typ.Bits: getting the size of uint kind data (ex: 6, 32, 64 bits)
// num is decoded data
num, err := s.uint(typ.Bits())
if err != nil {
return wrapStreamError(err, val.Type())
}
val.SetUint(num... | [
-0.49210435152053833,
0.23179234564304352,
0.6185823678970337,
-0.41700810194015503,
-0.4622318148612976,
0.08828093111515045,
0.01878972351551056,
-0.09840568900108337,
0.6391124725341797,
-1.0191214084625244,
-0.5145385265350342,
0.8981724977493286,
0.34257444739341736,
0.547160863876342... |
func decodeBool(s *Stream, val reflect.Value) error {
b, err := s.Bool()
if err != nil {
return wrapStreamError(err, val.Type())
}
val.SetBool(b)
return nil
} | [
0.12876057624816895,
0.07999075204133987,
0.47226762771606445,
0.637283980846405,
-0.05296603962779045,
-0.1924501210451126,
-0.05927680805325508,
0.18285489082336426,
-0.2408161461353302,
0.28314608335494995,
-0.5043960213661194,
1.0676422119140625,
0.30440646409988403,
0.140557199716568,... |
func decodeString(s *Stream, val reflect.Value) error {
// get the content of the string
b, err := s.Bytes()
if err != nil {
return wrapStreamError(err, val.Type())
}
// stringify the content, and passed in to val
val.SetString(string(b))
return nil
} | [
-0.13931091129779816,
-0.13424581289291382,
0.31009089946746826,
-0.3241708278656006,
-0.1269453465938568,
-0.24876055121421814,
-0.47489410638809204,
-0.3474297523498535,
-0.5598440170288086,
-0.03565236181020737,
0.2124401479959488,
0.6590246558189392,
-0.0554778054356575,
0.030372194945... |
func makeOptionalPtrDecoder(typ reflect.Type) (decoder, error) {
// get the underlying element type and the corresponded decoder
etype := typ.Elem()
etypeinfo, err := cachedTypeInfo1(etype, tags{})
if err != nil {
return nil, err
}
dec := func(s *Stream, val reflect.Value) (err error) {
kind, size, err := s.... | [
-0.18741747736930847,
-0.41050985455513,
0.9002915620803833,
-0.6103323698043823,
-0.5275778770446777,
-0.2584768235683441,
-0.18652121722698212,
0.00634655961766839,
0.8346182107925415,
0.08314219117164612,
0.648167073726654,
0.589796245098114,
-0.43007367849349976,
0.7390751838684082,
... |
func makePtrDecoder(typ reflect.Type) (decoder, error) {
// get the underlying element type and the corresponded decoder
etype := typ.Elem()
etypeinfo, err := cachedTypeInfo1(etype, tags{})
if err != nil {
return nil, err
}
dec := func(s *Stream, val reflect.Value) (err error) {
newval := val
if val.IsNil(... | [
-0.49876827001571655,
-0.5576940178871155,
0.7885529398918152,
-0.5739886164665222,
-0.8998256325721741,
-0.04139441251754761,
-0.3041048049926758,
-0.22822096943855286,
0.2647869884967804,
-0.22480341792106628,
0.38753610849380493,
0.17787784337997437,
-0.4556434750556946,
0.8466328382492... |
func decodeListSlice(s *Stream, val reflect.Value, elemdec decoder) error {
size, err := s.List()
if err != nil {
return wrapStreamError(err, val.Type())
}
// empty slice
if size == 0 {
val.Set(reflect.MakeSlice(val.Type(), 0, 0))
return s.ListEnd()
}
if err := decodeSliceElems(s, val, elemdec); err != ni... | [
-0.66208416223526,
-0.3350725471973419,
0.5170813202857971,
0.12445006519556046,
-0.8136695623397827,
-0.3884909749031067,
-0.5982863903045654,
-0.14621910452842712,
0.48414722084999084,
-0.326350599527359,
-0.4538232386112213,
0.4614408314228058,
0.29274600744247437,
1.3218724727630615,
... |
func decodeSliceElems(s *Stream, val reflect.Value, elemdec decoder) error {
i := 0
// forever loop that will break when finished reading everything from the reader
for ; ; i++ {
// manually increased the Cap of the slice
// avoid automatically increasing the Cap which can cause the creation of a new slice
if ... | [
-0.6499801278114319,
-0.2981071472167969,
0.383950412273407,
0.37416785955429077,
-0.3466823995113373,
-0.8127115964889526,
-0.08933741599321365,
-0.29448142647743225,
-0.3879828453063965,
-0.26677876710891724,
-0.19558167457580566,
0.2548500895500183,
-0.24693842232227325,
0.0044195391237... |
func decodeListArray(s *Stream, val reflect.Value, elemdec decoder) error {
// stores list information into stack, and do error checking
if _, err := s.List(); err != nil {
return wrapStreamError(err, val.Type())
}
// length of storage array
vlen := val.Len()
i := 0
// decode the content, and put it into arra... | [
-0.7163626551628113,
-0.427943617105484,
0.7946608662605286,
0.1089206412434578,
-0.019871162250638008,
-0.4175514280796051,
-0.4364491403102875,
-0.39715296030044556,
0.1162058636546135,
0.3281409442424774,
-0.9005969166755676,
0.60365229845047,
-0.2536608874797821,
0.9721735119819641,
... |
func (s *Stream) List() (size uint64, err error) {
kind, size, err := s.Kind()
if err != nil {
return 0, err
}
if kind != List {
return 0, ErrExpectedList
}
// information stored in the stack is used for error checking
s.stack = append(s.stack, listpos{0, size})
s.kind = -1
s.size = 0
return size, nil
} | [
0.11036893725395203,
0.3536279797554016,
0.5256009697914124,
-0.10581059008836746,
0.44884827733039856,
-1.2342334985733032,
0.3021608293056488,
0.6669195890426636,
0.8715840578079224,
-0.03712642565369606,
-0.7792686223983765,
0.37609779834747314,
-0.5715663433074951,
1.621671199798584,
... |
func (s *Stream) ListEnd() error {
if len(s.stack) == 0 {
return errNotInList
}
tos := s.stack[len(s.stack)-1]
if tos.pos != tos.size {
return errNotAtEOL
}
s.stack = s.stack[:len(s.stack)-1] // pop out information from the stack
if len(s.stack) > 0 {
s.stack[len(s.stack)-1].pos += tos.size
}
s.kind = -1... | [
0.5326894521713257,
-0.8068559169769287,
0.6910086274147034,
-0.8615669012069702,
0.127613365650177,
0.06977882236242294,
0.31804409623146057,
0.2376316338777542,
0.17902520298957825,
-0.03252877667546272,
0.19184428453445435,
0.72404545545578,
-0.2281738519668579,
1.0029329061508179,
0.... |
func decodeByteArray(s *Stream, val reflect.Value) error {
// getting detailed information on encoded data
kind, size, err := s.Kind()
if err != nil {
return err
}
// getting the length of declared ByteArray
vlen := val.Len()
switch kind {
// put a byte in a byte array
case Byte:
if vlen == 0 {
retur... | [
0.24341753125190735,
-0.27729058265686035,
0.8517022728919983,
0.17294976115226746,
-0.15072785317897797,
-0.15147757530212402,
0.10679036378860474,
0.194581538438797,
0.6033891439437866,
-0.12213347107172012,
0.33120664954185486,
1.2743198871612549,
-0.5786644816398621,
0.9420170783996582... |
func decodeByteSlice(s *Stream, val reflect.Value) error {
// b = byte slice contained string content
b, err := s.Bytes()
if err != nil {
return wrapStreamError(err, val.Type())
}
val.SetBytes(b)
return nil
} | [
-0.15964236855506897,
-0.3387814164161682,
0.2514490783214569,
-0.12532031536102295,
-0.13818968832492828,
-0.48445746302604675,
-0.39088138937950134,
-0.3968985080718994,
-0.6659696698188782,
-0.013922558166086674,
-0.23050515353679657,
0.38948220014572144,
-0.11069168150424957,
0.8339996... |
func addErrorContext(err error, ctx string) error {
if decErr, ok := err.(*decodeError); ok {
decErr.ctx = append(decErr.ctx, ctx)
}
return err
} | [
-0.7383336424827576,
-0.34307557344436646,
0.722509503364563,
-0.6636280417442322,
-0.8664668798446655,
0.3186572194099426,
-1.8119986057281494,
-0.33706140518188477,
1.3530426025390625,
-0.65645831823349,
-0.08064349740743637,
0.2780032455921173,
0.2683728337287903,
0.3071061074733734,
... |
func (s *Stream) Uint() (uint64, error) {
return s.uint(64)
} | [
-0.3969862759113312,
-0.38856154680252075,
0.32380160689353943,
-0.4305723309516907,
-0.3880354166030884,
-0.4637563228607178,
0.06420156359672546,
0.0032488449942320585,
0.4720138907432556,
-1.1762021780014038,
-0.01931401714682579,
1.1410759687423706,
0.5318752527236938,
0.44550409913063... |
func (s *Stream) uint(maxbits int) (uint64, error) {
// get the kind and size of encoded data
// NOTE: after this function, the headers are removed, the only thing left is pure data
kind, size, err := s.Kind()
if err != nil {
return 0, err
}
switch kind {
case Byte:
// a single byte cannot be 0, 0 should be ... | [
-0.489328533411026,
-0.1061694473028183,
0.6237965822219849,
-0.3009549081325531,
-1.0016859769821167,
-0.08404513448476791,
-0.1243925392627716,
0.17140252888202667,
0.3200426697731018,
-0.4953373968601227,
0.7971038818359375,
1.290662407875061,
-0.2164592146873474,
0.4460183084011078,
... |
func (s *Stream) Bytes() ([]byte, error) {
kind, size, err := s.Kind()
if err != nil {
return nil, err
}
switch kind {
case Byte:
s.kind = -1 // re-initialize Kind
return []byte{s.byteval}, nil
case String:
b := make([]byte, size)
// read the string content, store in the byte slice
if err = s.readFull... | [
-0.1910788118839264,
-0.23405471444129944,
0.2335735559463501,
0.16849491000175476,
-0.035098668187856674,
-0.4572538435459137,
-1.0483461618423462,
-0.5090157389640808,
0.45504212379455566,
-0.45002391934394836,
0.7155835032463074,
1.4952608346939087,
-0.5335466265678406,
0.63803207874298... |
func (s *Stream) Raw() ([]byte, error) {
// get the kind and size of encoded data s.r
kind, size, err := s.Kind()
if err != nil {
return nil, err
}
// if it is a single byte, the value is stored in s.byteval, therefore can be returned directly
if kind == Byte {
s.kind = -1 // re-initialize s.Kind
return []b... | [
-0.28043001890182495,
0.13698618113994598,
0.9163712859153748,
0.05429081991314888,
-0.9479378461837769,
-0.2271496206521988,
-0.7674188613891602,
-0.7223950028419495,
0.6222003102302551,
-0.6742803454399109,
0.1896834671497345,
1.2277792692184448,
-0.15714573860168457,
0.1907520890235901,... |
func headsize(size uint64) int {
// if the size is within 0 - 55, then the size of the string head will be 1 (0x80 + ... RULE #2)
if size < 56 {
return 1
}
// otherwise, size will be RULE #3
return 1 + intsize(size)
} | [
-0.40314236283302307,
0.11645759642124176,
0.7332032918930054,
-0.7756672501564026,
-0.9259013533592224,
0.0680273175239563,
0.24961727857589722,
-0.32272887229919434,
1.1417850255966187,
0.7171302437782288,
0.3403300642967224,
0.8046911358833313,
-1.036503791809082,
-0.3933253288269043,
... |
func (s *Stream) Kind() (kind Kind, size uint64, err error) {
// in this function, the soul purpose of using tos is for EOL error checking
var tos *listpos
// tos will pointed to the innermost list (the last one stored in stack)
if len(s.stack) > 0 {
tos = &s.stack[len(s.stack)-1]
}
if s.kind < 0 {
s.kinderr... | [
0.12396516650915146,
-0.3785472810268402,
0.7026209831237793,
-0.3126957416534424,
-0.6798669695854187,
-0.3459349572658539,
0.2519742548465729,
-0.38113388419151306,
-0.12873513996601105,
0.394481360912323,
0.0006493389955721796,
1.0145326852798462,
-0.15073029696941376,
0.936547338962554... |
func (s *Stream) readKind() (kind Kind, size uint64, err error) {
// get a byte that pops out from s.r
b, err := s.readByte()
// error handling, change all possible errors to io.EOF
if err != nil {
if len(s.stack) == 0 {
switch err {
// At toplevel, Adjust the error to actual EOF. io.EOF is used
// by ca... | [
0.01663093827664852,
-0.32665693759918213,
0.7432554364204407,
0.23467104136943817,
-0.5346835255622864,
-0.7511337995529175,
0.46321526169776917,
0.24502572417259216,
-0.2824011743068695,
0.3236571252346039,
-0.13725432753562927,
0.7502683401107788,
-0.1703028827905655,
1.1953067779541016... |
func (s *Stream) readUint(size byte) (uint64, error) {
switch size {
case 0:
s.kind = -1
return 0, nil
// if the difference is 1, it means the length of the encoded data can be represented with 1 byte
// the next byte will be the hex representation of the length
case 1:
// read the next byte, and return it a... | [
-0.25475260615348816,
-0.4819352924823761,
0.9200182557106018,
-0.29581332206726074,
-0.6129200458526611,
0.02114919200539589,
-0.14019085466861725,
0.40136754512786865,
0.4955796003341675,
-0.5658922791481018,
0.22774170339107513,
0.2829023003578186,
-0.7558964490890503,
0.697108626365661... |
func (s *Stream) readByte() (byte, error) {
// since this is readByte functions, therefore, only willRead a byte each time
if err := s.willRead(1); err != nil {
return 0, err
}
// pops out a byte from r and return it
b, err := s.r.ReadByte()
if err == io.EOF {
err = io.ErrUnexpectedEOF
}
return b, err
} | [
0.38753917813301086,
0.217421755194664,
0.5577716827392578,
0.7762775421142578,
0.21206271648406982,
-0.4035954475402832,
0.44423848390579224,
-0.06284619867801666,
0.1838303655385971,
-0.6543859839439392,
1.1872040033340454,
0.3195546567440033,
-1.5711029767990112,
0.39201733469963074,
... |
func (s *Stream) willRead(n uint64) error {
s.kind = -1 // rearm / re-initialize Kind
if len(s.stack) > 0 {
tos := s.stack[len(s.stack)-1]
// read size cannot greater than the size of the list
if n > tos.size-tos.pos {
return ErrElemTooLarge
}
// change the list position
s.stack[len(s.stack)-1].pos += ... | [
-0.20017345249652863,
0.23736777901649475,
0.7024823427200317,
0.040196292102336884,
-0.17980356514453888,
0.01908220164477825,
-0.04721749946475029,
-0.20952482521533966,
0.5684123039245605,
-0.4385886490345001,
0.02666112408041954,
0.8981207013130188,
-0.12471624463796616,
0.170877814292... |
func AddType(m *Types) (id int64, err error) {
o := orm.NewOrm()
id, err = o.Insert(m)
return
} | [
-0.553371012210846,
0.8385599851608276,
0.9788699150085449,
1.3977749347686768,
0.8115094900131226,
-0.07613195478916168,
0.6056162118911743,
-0.49260276556015015,
-0.03808664157986641,
0.016977757215499878,
-0.18029679358005524,
-1.2250787019729614,
-1.9163756370544434,
0.5211976170539856... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.