text stringlengths 11 6.3k | embedding listlengths 768 768 |
|---|---|
func FindDiscoveryByRef(cert insolar.Certificate, ref insolar.Reference) insolar.DiscoveryNode {
bNodes := cert.GetDiscoveryNodes()
for _, discoveryNode := range bNodes {
if ref.Equal(*discoveryNode.GetNodeRef()) {
return discoveryNode
}
}
return nil
} | [
1.1444886922836304,
0.10677342116832733,
0.6981117725372314,
0.5478300452232361,
-0.3373566269874573,
-0.494721919298172,
0.2522660791873932,
-0.7737331986427307,
0.22184722125530243,
0.9556263089179993,
0.6549496650695801,
0.9521139860153198,
-0.22780151665210724,
1.0370395183563232,
1.... |
func IsConnectionClosed(err error) bool {
if err == nil {
return false
}
err = errors.Cause(err)
return strings.Contains(err.Error(), "use of closed network connection")
} | [
-0.21797679364681244,
0.04606855288147926,
0.45216745138168335,
1.269045352935791,
-0.92401123046875,
-0.3833126127719879,
-0.2131451517343521,
0.054434552788734436,
0.7035893797874451,
0.10267594456672668,
0.6782187223434448,
-0.951583743095398,
-0.14590594172477722,
0.9392739534378052,
... |
func FindDiscoveriesInNodeList(nodes []insolar.NetworkNode, cert insolar.Certificate) []insolar.NetworkNode {
discovery := cert.GetDiscoveryNodes()
result := make([]insolar.NetworkNode, 0)
for _, d := range discovery {
for _, n := range nodes {
if d.GetNodeRef().Equal(n.ID()) {
result = append(result, n)
... | [
0.1315896213054657,
0.12857410311698914,
0.5106128454208374,
0.4957166314125061,
0.28177493810653687,
-0.16932889819145203,
0.010210243053734303,
0.29961588978767395,
-0.3322840631008148,
0.2944985628128052,
-0.09220754355192184,
0.2503414750099182,
-0.11455845087766647,
1.3765978813171387... |
func NewObs(config Config) (*Obs, error) {
log, err := NewLogrus(config)
if err != nil {
return nil, err
}
obs := &Obs{
Logger: log,
loggedHeaders: config.LoggedHeaders,
}
if config.MetricsURL == "" {
return obs, nil
}
metrics := NewPrometheusMetrics(config.MetricsURL, config.AppName, config.M... | [
0.1364762783050537,
0.28319117426872253,
0.6106756329536438,
0.19127915799617767,
-0.8892553448677063,
0.5026612281799316,
-0.19861336052417755,
-0.6583949327468872,
0.45824548602104187,
0.017457127571105957,
0.5272313952445984,
0.25168952345848083,
0.02578391321003437,
-0.0851183310151100... |
func (o *Obs) CopyWithRequest(r *http.Request) *Obs {
obCopy := *o
obs := &obCopy
obs.Logger = obs.Logger.WithFields(Fields{
"url": r.RequestURI,
"method": r.Method,
})
for headerName, fieldName := range o.loggedHeaders {
headerValue := r.Header.Get(headerName)
if headerValue != "" {
obs.Logger = o... | [
-0.9474316835403442,
-0.9059048295021057,
1.0222996473312378,
-0.10949106514453888,
-1.1741529703140259,
0.4189523160457611,
-0.6528897881507874,
-1.425466775894165,
0.39875927567481995,
0.20296727120876312,
0.7898316979408264,
-0.16154229640960693,
0.927465558052063,
-0.4623715877532959,
... |
func (o *Obs) PanicRecover() {
if r := recover(); r != nil {
// According to Russ Cox (leader of the Go team) capturing the stack trace here works:
// https://groups.google.com/d/msg/golang-nuts/MB8GyW5j2UY/m_YYy7mGYbIJ .
o.Logger.WithField("stack", string(debug.Stack())).Error(fmt.Sprintf("%v", r))
}
} | [
0.5949949622154236,
0.22838085889816284,
0.5892450213432312,
0.012734470888972282,
-0.01627652905881405,
-0.05558060109615326,
0.08826292306184769,
0.17913006246089935,
-0.13092577457427979,
-0.021163979545235634,
0.031722839921712875,
0.02073446661233902,
-0.44565075635910034,
-0.02566350... |
func fromCVSS3(ctx context.Context, s string) (sev claircore.Severity, err error) {
ms := strings.Split(strings.TrimRight(s, "/"), "/") // "m" as in "metric"
if !strings.HasPrefix(ms[0], "CVSS:3") {
return 0, fmt.Errorf("unknown label: %q", ms[0])
}
ver, err := strconv.ParseInt(ms[0][7:], 10, 32)
if err != nil {... | [
0.17293502390384674,
-0.38570672273635864,
0.8030790090560913,
-0.2858507037162781,
-0.12566326558589935,
0.1329578012228012,
-0.18117010593414307,
-0.11187323182821274,
0.7736968398094177,
0.452517569065094,
-0.1774139255285263,
-0.08831286430358887,
0.39262139797210693,
-0.72306370735168... |
func fromCVSS2(s string) (sev claircore.Severity, err error) {
ms := strings.Split(s, "/") // "m" as in "metric"
if len(ms) < 6 {
return 0, fmt.Errorf("bad vector: %q", s)
}
// Giant switch ahoy
var ns [6]float64
for _, m := range ms {
n, v, ok := strings.Cut(m, ":")
if !ok {
return 0, fmt.Errorf("bad me... | [
0.2720945179462433,
-0.616487443447113,
0.7922811508178711,
-0.4699910879135132,
-0.6836073994636536,
-0.4054363965988159,
0.12339673936367035,
-0.38486310839653015,
-0.006245683412998915,
0.2929181456565857,
-0.2581340968608856,
0.45539388060569763,
0.6571376919746399,
-0.1296917498111724... |
func NewGetSeriesIDEpisodesQueryParams() *GetSeriesIDEpisodesQueryParams {
var ()
return &GetSeriesIDEpisodesQueryParams{
timeout: cr.DefaultTimeout,
}
} | [
0.3379734456539154,
0.14631058275699615,
0.45284998416900635,
0.21419550478458405,
0.2741679251194,
-0.43986976146698,
0.4331640303134918,
0.2617952823638916,
-0.23016148805618286,
0.023682279512286186,
-0.3420694172382355,
-0.3043655455112457,
-0.5656914710998535,
-1.7238972187042236,
-... |
func NewGetSeriesIDEpisodesQueryParamsWithTimeout(timeout time.Duration) *GetSeriesIDEpisodesQueryParams {
var ()
return &GetSeriesIDEpisodesQueryParams{
timeout: timeout,
}
} | [
0.7228041291236877,
0.03754207491874695,
0.5485970973968506,
0.10043934732675552,
0.12491034716367722,
0.25046828389167786,
-0.42801666259765625,
0.2948046326637268,
-0.29816126823425293,
1.0633492469787598,
-0.16413529217243195,
0.16483169794082642,
-0.5037944316864014,
-1.468961596488952... |
func NewGetSeriesIDEpisodesQueryParamsWithContext(ctx context.Context) *GetSeriesIDEpisodesQueryParams {
var ()
return &GetSeriesIDEpisodesQueryParams{
Context: ctx,
}
} | [
0.24178583920001984,
0.24283987283706665,
0.7095046639442444,
-0.33149421215057373,
0.5915516018867493,
0.08736512809991837,
-0.17596569657325745,
-0.45800939202308655,
-0.10716010630130768,
0.5727376341819763,
-0.21755291521549225,
-0.2899883985519409,
-0.6291720271110535,
-1.994299650192... |
func NewGetSeriesIDEpisodesQueryParamsWithHTTPClient(client *http.Client) *GetSeriesIDEpisodesQueryParams {
var ()
return &GetSeriesIDEpisodesQueryParams{
HTTPClient: client,
}
} | [
0.46489816904067993,
-0.010380266234278679,
0.5626255869865417,
-0.11234153062105179,
0.7184965014457703,
0.2998403310775757,
0.32173803448677063,
-0.011018267832696438,
-0.7571897506713867,
-0.04047268629074097,
-0.619533360004425,
-0.06714734435081482,
-0.3306947350502014,
-2.10111951828... |
func (o *GetSeriesIDEpisodesQueryParams) WithTimeout(timeout time.Duration) *GetSeriesIDEpisodesQueryParams {
o.SetTimeout(timeout)
return o
} | [
0.41422101855278015,
0.6026319265365601,
0.3423369824886322,
-0.22196388244628906,
-0.0355820432305336,
-0.47579631209373474,
0.24525997042655945,
0.0991235002875328,
0.23310589790344238,
1.1746517419815063,
0.05125967413187027,
0.018248043954372406,
0.05137128382921219,
-1.236283063888549... |
func (o *GetSeriesIDEpisodesQueryParams) SetTimeout(timeout time.Duration) {
o.timeout = timeout
} | [
0.09992358088493347,
0.6984251737594604,
0.23700344562530518,
-0.17604310810565948,
0.43778690695762634,
-0.03928770869970322,
0.2322935163974762,
0.4812959134578705,
0.017454758286476135,
1.0642015933990479,
0.05059652402997017,
0.3118876516819,
-0.5952843427658081,
-1.0264623165130615,
... |
func (o *GetSeriesIDEpisodesQueryParams) WithContext(ctx context.Context) *GetSeriesIDEpisodesQueryParams {
o.SetContext(ctx)
return o
} | [
-0.25009438395500183,
0.48736077547073364,
0.4384884238243103,
-0.3628823161125183,
-0.10108109563589096,
-0.5245378017425537,
0.14398986101150513,
-0.5051773190498352,
0.5385035276412964,
0.662810742855072,
0.06144307181239128,
-0.2400343418121338,
-0.4699583053588867,
-1.64413583278656,
... |
func (o *GetSeriesIDEpisodesQueryParams) SetContext(ctx context.Context) {
o.Context = ctx
} | [
-0.3867238163948059,
0.6550309062004089,
0.2758254408836365,
-0.037886057049036026,
0.5482246279716492,
-0.1017947793006897,
0.21516276895999908,
-0.21185092628002167,
0.7719302773475647,
0.5833359956741333,
-0.1316641867160797,
0.23435582220554352,
-0.9903632998466492,
-1.3913588523864746... |
func (o *GetSeriesIDEpisodesQueryParams) WithHTTPClient(client *http.Client) *GetSeriesIDEpisodesQueryParams {
o.SetHTTPClient(client)
return o
} | [
0.08338233828544617,
-0.07550607621669769,
0.37237879633903503,
-0.6277511119842529,
0.08249916136264801,
-0.4689592123031616,
0.4690234065055847,
-0.2432485669851303,
-0.3106696605682373,
0.15319383144378662,
-0.1228334903717041,
-0.15936213731765747,
0.057020153850317,
-1.982419848442077... |
func (o *GetSeriesIDEpisodesQueryParams) SetHTTPClient(client *http.Client) {
o.HTTPClient = client
} | [
0.26367437839508057,
0.05269717052578926,
0.257271945476532,
-0.7957136631011963,
-0.05988002568483353,
-0.5166791677474976,
0.48875898122787476,
-0.18252770602703094,
-0.4932326376438141,
0.2644036114215851,
-0.3983649015426636,
0.47920143604278564,
-0.5958228707313538,
-1.828315734863281... |
func (o *GetSeriesIDEpisodesQueryParams) WithAcceptLanguage(acceptLanguage *string) *GetSeriesIDEpisodesQueryParams {
o.SetAcceptLanguage(acceptLanguage)
return o
} | [
0.08600929379463196,
0.29871827363967896,
0.5388454794883728,
-0.4177559018135071,
-0.8160749673843384,
-0.5158395171165466,
0.4452890455722809,
0.15636494755744934,
-0.13504648208618164,
0.9016646146774292,
-0.04519876465201378,
-0.3554839491844177,
-0.025404032319784164,
-0.8944297432899... |
func (o *GetSeriesIDEpisodesQueryParams) SetAcceptLanguage(acceptLanguage *string) {
o.AcceptLanguage = acceptLanguage
} | [
-0.4971730411052704,
0.02632194384932518,
0.4569554030895233,
-0.6710826754570007,
-0.8267713189125061,
-0.33708474040031433,
0.5483587980270386,
0.3626915514469147,
-0.3997369706630707,
0.6491982340812683,
-0.306351900100708,
0.20857231318950653,
-0.7533091902732849,
-0.5488715767860413,
... |
func (o *GetSeriesIDEpisodesQueryParams) WithAbsoluteNumber(absoluteNumber *string) *GetSeriesIDEpisodesQueryParams {
o.SetAbsoluteNumber(absoluteNumber)
return o
} | [
-0.05609619617462158,
-0.22127769887447357,
0.48150500655174255,
-0.1644531786441803,
-0.33239662647247314,
-0.06608758121728897,
0.3938595652580261,
0.23846815526485443,
0.11771290749311447,
0.5200234055519104,
-0.3281153738498688,
-0.4054667055606842,
0.6766302585601807,
-1.0071763992309... |
func (o *GetSeriesIDEpisodesQueryParams) SetAbsoluteNumber(absoluteNumber *string) {
o.AbsoluteNumber = absoluteNumber
} | [
-0.5469523668289185,
-0.32978859543800354,
0.3636096119880676,
-0.10558930784463882,
-0.20310749113559723,
-0.03638426586985588,
0.42202308773994446,
0.445343017578125,
-0.04132532700896263,
0.21898601949214935,
-0.22064708173274994,
0.24873797595500946,
0.02220696024596691,
-0.49169722199... |
func (o *GetSeriesIDEpisodesQueryParams) WithAiredEpisode(airedEpisode *string) *GetSeriesIDEpisodesQueryParams {
o.SetAiredEpisode(airedEpisode)
return o
} | [
0.39430496096611023,
-0.036331284791231155,
0.4290975332260132,
-0.42587798833847046,
0.2074078619480133,
-0.560894250869751,
0.12804701924324036,
0.7474539875984192,
0.31386712193489075,
0.14769674837589264,
0.19657956063747406,
-0.2015160620212555,
0.35388436913490295,
-0.942110896110534... |
func (o *GetSeriesIDEpisodesQueryParams) SetAiredEpisode(airedEpisode *string) {
o.AiredEpisode = airedEpisode
} | [
0.02715029940009117,
-0.03548547253012657,
0.35720425844192505,
-0.3480227291584015,
0.29603034257888794,
-0.2586844265460968,
0.12129741162061691,
0.598124623298645,
-0.05759922415018082,
0.21359001100063324,
-0.28624746203422546,
0.312372624874115,
-0.19149698317050934,
-0.59204870462417... |
func (o *GetSeriesIDEpisodesQueryParams) WithAiredSeason(airedSeason *string) *GetSeriesIDEpisodesQueryParams {
o.SetAiredSeason(airedSeason)
return o
} | [
0.4643309414386749,
-0.5762926936149597,
0.35489290952682495,
-0.5632326602935791,
-0.6647278070449829,
-0.42728057503700256,
-0.04384106397628784,
-0.21379974484443665,
0.9341911673545837,
0.29292330145835876,
-0.0685414969921112,
0.3739701807498932,
0.20249789953231812,
-0.83691978454589... |
func (o *GetSeriesIDEpisodesQueryParams) SetAiredSeason(airedSeason *string) {
o.AiredSeason = airedSeason
} | [
-0.19173283874988556,
-0.6697609424591064,
0.25166386365890503,
-0.6693339347839355,
-0.3306567668914795,
0.17074690759181976,
0.34877437353134155,
-0.11585962027311325,
0.711778998374939,
0.44184228777885437,
-0.5383139252662659,
1.0493874549865723,
-0.46706119179725647,
-0.39650583267211... |
func (o *GetSeriesIDEpisodesQueryParams) WithDvdEpisode(dvdEpisode *string) *GetSeriesIDEpisodesQueryParams {
o.SetDvdEpisode(dvdEpisode)
return o
} | [
-0.5818958878517151,
0.4368039071559906,
0.47557470202445984,
0.2125120609998703,
0.07177674025297165,
-0.1229165568947792,
0.08895742148160934,
0.5765699744224548,
0.3206315040588379,
0.3500935733318329,
0.0844278335571289,
-0.5943408012390137,
-0.19330060482025146,
-1.2015687227249146,
... |
func (o *GetSeriesIDEpisodesQueryParams) SetDvdEpisode(dvdEpisode *string) {
o.DvdEpisode = dvdEpisode
} | [
-1.3289463520050049,
0.19681499898433685,
0.37374114990234375,
0.16743507981300354,
0.142571821808815,
0.09797364473342896,
0.15014180541038513,
0.5455625057220459,
-0.10405860841274261,
0.11688680946826935,
-0.34072890877723694,
0.05477385222911835,
-0.4261472821235657,
-0.856457054615020... |
func (o *GetSeriesIDEpisodesQueryParams) WithDvdSeason(dvdSeason *string) *GetSeriesIDEpisodesQueryParams {
o.SetDvdSeason(dvdSeason)
return o
} | [
-0.7756341099739075,
-0.2751094698905945,
0.4595505893230438,
-0.2503766119480133,
-0.5415040850639343,
-0.5962351560592651,
-0.030663689598441124,
0.02254868671298027,
1.0011413097381592,
0.561854898929596,
-0.6317970156669617,
0.047343865036964417,
-0.13859879970550537,
-1.17327308654785... |
func (o *GetSeriesIDEpisodesQueryParams) SetDvdSeason(dvdSeason *string) {
o.DvdSeason = dvdSeason
} | [
-1.4320220947265625,
-0.3267223834991455,
0.36600181460380554,
-0.2196580022573471,
-0.19087310135364532,
-0.14952592551708221,
0.21469995379447937,
0.022967468947172165,
0.9084991812705994,
0.40821942687034607,
-0.9871607422828674,
0.8596209287643433,
-0.5144755840301514,
-0.6469616293907... |
func (o *GetSeriesIDEpisodesQueryParams) WithID(id int64) *GetSeriesIDEpisodesQueryParams {
o.SetID(id)
return o
} | [
-0.14068683981895447,
-0.0433117151260376,
0.2587008774280548,
0.11972295492887497,
-0.15479926764965057,
-0.1993907392024994,
0.551818311214447,
0.08150279521942139,
1.0543681383132935,
0.7659354209899902,
-0.0005828003631904721,
-0.4344652593135834,
-0.6398553252220154,
-0.87652641534805... |
func (o *GetSeriesIDEpisodesQueryParams) SetID(id int64) {
o.ID = id
} | [
-0.44191011786460876,
-0.12922480702400208,
0.15317557752132416,
0.19180376827716827,
0.3764428198337555,
0.15272794663906097,
0.48762691020965576,
0.28809672594070435,
0.7968636751174927,
0.49096041917800903,
-0.20596425235271454,
-0.04801081866025925,
-0.924333393573761,
-0.4758126139640... |
func (o *GetSeriesIDEpisodesQueryParams) WithImdbID(imdbID *string) *GetSeriesIDEpisodesQueryParams {
o.SetImdbID(imdbID)
return o
} | [
0.36366015672683716,
-0.5388479232788086,
0.33813193440437317,
0.24891304969787598,
-0.0927964374423027,
-0.027395857498049736,
0.6098393201828003,
0.31500890851020813,
0.9471534490585327,
1.259610652923584,
0.0154946343973279,
-0.4147717356681824,
-1.0388046503067017,
-0.5137187838554382,... |
func (o *GetSeriesIDEpisodesQueryParams) SetImdbID(imdbID *string) {
o.ImdbID = imdbID
} | [
-0.41424646973609924,
-0.595199704170227,
0.23603568971157074,
0.08675315231084824,
0.12671658396720886,
0.3405277132987976,
0.6916623711585999,
0.27429115772247314,
0.7198193669319153,
1.1047133207321167,
-0.18216179311275482,
0.44894731044769287,
-1.6841269731521606,
0.15686893463134766,... |
func (o *GetSeriesIDEpisodesQueryParams) WithPage(page *string) *GetSeriesIDEpisodesQueryParams {
o.SetPage(page)
return o
} | [
-0.4656509459018707,
0.6593720316886902,
0.17219260334968567,
-0.6456595063209534,
0.5259981155395508,
-0.5911073684692383,
0.8175939321517944,
0.07536989450454712,
0.19694532454013824,
0.8005500435829163,
0.7121500968933105,
-1.2665976285934448,
-0.5648547410964966,
-1.2029060125350952,
... |
func (o *GetSeriesIDEpisodesQueryParams) SetPage(page *string) {
o.Page = page
} | [
-0.771761417388916,
0.5374065637588501,
0.08466143161058426,
-0.332461953163147,
0.7159373164176941,
-0.4124634861946106,
0.5600733160972595,
0.5229330658912659,
0.16958743333816528,
0.758655309677124,
0.28805607557296753,
-0.6283378601074219,
-1.1587934494018555,
-0.7570589184761047,
-0... |
func (o *GetSeriesIDEpisodesQueryParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error {
if err := r.SetTimeout(o.timeout); err != nil {
return err
}
var res []error
if o.AcceptLanguage != nil {
// header param Accept-Language
if err := r.SetHeaderParam("Accept-Language", *o.AcceptLang... | [
-0.964138925075531,
-0.06818801909685135,
0.9264776706695557,
-0.6954391002655029,
0.23337171971797943,
-0.3497842848300934,
0.5786852240562439,
-0.21151013672351837,
-0.18106400966644287,
0.2575847804546356,
0.059500593692064285,
0.5041085481643677,
-0.44730496406555176,
-0.08290173113346... |
func TestEncoding(t *testing.T) {
if DecUint16(EncUint16(u16)) != u16 {
t.Fatal("uint32 encode/decode mismatch")
}
if DecInt32(EncInt32(i32)) != i32 {
t.Fatal("int32 encode/decode mismatch")
}
if DecUint32(EncUint32(u32)) != u32 {
t.Fatal("uint32 encode/decode mismatch")
}
if DecFloat32(EncFloat32(f32)) !=... | [
0.3812658190727234,
0.4004621207714081,
0.4118514955043793,
0.7550308704376221,
0.7824137210845947,
0.6960332989692688,
0.752099871635437,
-0.7920597791671753,
0.31614309549331665,
-0.7520012259483337,
-0.5681442022323608,
-0.6799482107162476,
-0.40352994203567505,
0.2741967737674713,
0.... |
func TestMarshal(t *testing.T) {
type mTest struct {
B bool
F float64
S string
}
objs := mTest{false, 1.0, "foo"}
recv := mTest{}
b, err := Marshal(objs)
if err != nil {
t.Fatal(err)
}
err = Unmarshal(b, &recv)
if err != nil {
t.Fatal(err)
}
if objs != recv {
t.Error("input", objs, "does not mat... | [
0.9624112844467163,
0.2129221260547638,
0.7644471526145935,
0.12930580973625183,
0.23466086387634277,
0.18486954271793365,
0.33011969923973083,
0.254656583070755,
0.3964579403400421,
-0.9371547698974609,
0.36660894751548767,
0.03597966209053993,
-0.732641339302063,
-0.47284603118896484,
... |
func (c *Client) GetAccountOrders(address string, opts *GetAccountOrdersOptions) ([]Order, *Response, error) {
path := "/accounts/" + address + "/orders"
if opts != nil {
v := url.Values{}
if !opts.Date.IsZero() {
v.Set("start", FormatTime(opts.Date))
}
if opts.Limit != 0 {
v.Set("limit", strconv.Ito... | [
-1.2054331302642822,
0.49490535259246826,
0.9733854532241821,
0.40591317415237427,
0.6901564002037048,
-0.9114108085632324,
0.29647696018218994,
-0.03081613965332508,
0.8910709619522095,
0.014879313297569752,
0.2463086098432541,
1.36404287815094,
-0.5157470703125,
0.04586757346987724,
0.... |
func (c *CList) HandleKey(key string) error {
switch key {
case "k": c.list.Width += 1
case "j": c.list.Width -= 1
case "<up>":
if c.selected != 0 {
c.selected--;
} else {
c.selected = len(c.list.Items)-1
}
case "<down>":
if c.selected != len(c.list.Items)-1 {
c.selected++;
... | [
-1.0295097827911377,
0.4453098177909851,
0.5993987917900085,
0.3685552477836609,
0.5520864129066467,
-0.22116702795028687,
0.8192564845085144,
0.4725358784198761,
0.9450063705444336,
0.47329452633857727,
-0.154371976852417,
-1.2579513788223267,
-0.4648771584033966,
0.8480820655822754,
0.... |
func FullDefaultConfig() *config.Config {
cfg := DefaultConfig()
EnsureDefaults(cfg)
Sanitize(cfg)
return cfg
} | [
1.0572600364685059,
-0.039259523153305054,
0.18527129292488098,
0.4232773184776306,
-0.35190877318382263,
-0.5614883899688721,
-0.39703384041786194,
0.6322925686836243,
0.12710516154766083,
0.2953694462776184,
-0.9195809364318848,
-0.3160850405693054,
0.23369067907333374,
0.886328697204589... |
func DefaultConfig() *config.Config {
return &config.Config{
Debug: config.Debug{
Addr: "127.0.0.1:9134",
},
HTTP: config.HTTP{
Addr: "127.0.0.1:9130",
Root: "/",
Namespace: "com.owncloud.web",
TLSCert: filepath.Join(defaults.BaseDataPath(), "idp", "server.crt"),
TLSKey: filepath... | [
-0.4671294391155243,
0.021854238584637642,
0.9537544250488281,
0.04788978397846222,
0.1424226611852646,
0.5996108651161194,
0.18955308198928833,
0.2791895270347595,
0.6115244030952454,
0.1668592393398285,
-1.043145775794983,
0.2699826955795288,
-0.7728331685066223,
0.20647872984409332,
0... |
func EnsureDefaults(cfg *config.Config) {
// provide with defaults for shared logging, since we need a valid destination address for "envdecode".
if cfg.Log == nil && cfg.Commons != nil && cfg.Commons.Log != nil {
cfg.Log = &config.Log{
Level: cfg.Commons.Log.Level,
Pretty: cfg.Commons.Log.Pretty,
Color: ... | [
0.04251040518283844,
-0.1284606009721756,
0.555280864238739,
0.0210634246468544,
0.8048509359359741,
0.10551302134990692,
-0.24653996527194977,
-0.1925799548625946,
0.05420219153165817,
0.33701297640800476,
-0.5645821690559387,
-0.21781718730926514,
-0.23497092723846436,
1.1097747087478638... |
func Sanitize(cfg *config.Config) {
// sanitize config
if cfg.HTTP.Root != "/" {
cfg.HTTP.Root = strings.TrimSuffix(cfg.HTTP.Root, "/")
}
} | [
0.14400817453861237,
0.23166397213935852,
0.5427960753440857,
0.4566308259963989,
0.10568782687187195,
-0.04285336658358574,
0.23578687012195587,
0.324802041053772,
0.06778906285762787,
0.16607074439525604,
-0.5409353971481323,
0.12522900104522705,
-0.9369649291038513,
0.9247244596481323,
... |
func (s *Standard) sendRequest(context service.Context, requestMethod string, requestURL string, responseObject interface{}) error {
serverToken := s.serverToken()
if serverToken == "" {
return errors.Newf("client", "unable to obtain server token for %s %s", requestMethod, requestURL)
}
request, err := http.New... | [
-0.9509072303771973,
-0.2126353532075882,
0.8393099308013916,
0.4193509817123413,
-0.16125839948654175,
-0.28893882036209106,
0.3053339123725891,
-0.42562541365623474,
0.555169939994812,
0.4949949383735657,
0.018904896453022957,
0.8633326292037964,
0.1507953554391861,
-0.7283090353012085,
... |
func NewPathCompression(n int) *pathCompression {
result := &pathCompression{}
result.IDs = make([]int, n)
result.Weights = make([]int, n)
for x := range result.IDs {
result.IDs[x] = x
result.Weights[x] = 1
}
return result
} | [
-0.8761501908302307,
-0.2956956624984741,
0.3325909376144409,
0.3103293776512146,
-0.8788832426071167,
-1.1310135126113892,
0.8455148339271545,
-0.8066688776016235,
-0.3692159950733185,
0.2192356288433075,
-1.1103122234344482,
-1.163543701171875,
-1.186995506286621,
0.6995714902877808,
-... |
func (q *pathCompression) Root(r int) int {
for {
if r == q.IDs[r] {
break
}
q.IDs[r] = q.IDs[q.IDs[r]]
r = q.IDs[r]
}
return r
} | [
0.16451388597488403,
-0.3849102258682251,
0.34438884258270264,
-0.581656277179718,
-0.8256203532218933,
0.02497795782983303,
-0.006689518224447966,
-1.1623622179031372,
0.6212582588195801,
0.4168091416358948,
-0.061691850423812866,
1.04933500289917,
-0.9239826202392578,
0.474902480840683,
... |
func (q *pathCompression) Connected(p, r int) bool {
return q.Root(p) == q.Root(r)
} | [
0.2044576108455658,
-1.3801082372665405,
0.3819900155067444,
1.1225173473358154,
-0.09994920343160629,
0.884064257144928,
-0.6317309737205505,
-0.7213529944419861,
-0.5402255058288574,
0.40558263659477234,
-0.3270174562931061,
-0.29691243171691895,
-0.8465797305107117,
-0.09736873209476471... |
func (q *pathCompression) Union(p, r int) {
qr := q.Root(r)
qp := q.Root(p)
if qr == qp {
return
}
if q.Weights[qr] > q.Weights[qp] {
q.IDs[qp] = qr
q.Weights[qr] += q.Weights[qp]
} else {
q.IDs[qr] = qp
q.Weights[qp] += q.Weights[qr]
}
} | [
-0.0018050458747893572,
-0.7751011848449707,
0.4399564564228058,
-0.27963951230049133,
0.22412161529064178,
0.5548829436302185,
-0.22780020534992218,
-0.4003714621067047,
0.3916671872138977,
0.07547751069068909,
-0.4103504717350006,
0.024207087233662605,
-1.1468358039855957,
-0.13538737595... |
func NewCredentialService(repo repo.CredentialRepo) service.CredentialService {
return &credentialService{repo}
} | [
-0.09178584814071655,
-0.46831580996513367,
-0.20018772780895233,
0.011320937424898148,
-0.12810514867305756,
0.24229365587234497,
-1.26262629032135,
-0.24125784635543823,
0.0673227310180664,
-0.024457793682813644,
-0.6548346877098083,
0.6555583477020264,
-0.7113474607467651,
0.54373461008... |
func (svc *credentialService) Register(ctx context.Context, email, password, confirmPass string, claims map[string]interface{}) error {
//Construct credentail object from request
cred := model.Credential{}
cred.Create(email, password, provider, claims)
cred.Claims = claims
//Validate the credential data
err := c... | [
-0.4593344032764435,
0.42337045073509216,
0.649212121963501,
0.5827245712280273,
1.1482199430465698,
0.7285733222961426,
-0.5374953746795654,
0.24794641137123108,
-0.42816609144210815,
-0.11250380426645279,
-0.34335559606552124,
0.5477020144462585,
-0.1563037782907486,
0.13827864825725555,... |
func (svc *credentialService) Login(ctx context.Context, email, password string) (model.AccessToken, model.RefreshToken, error) {
cred, err := svc.repo.Get(ctx, email)
if err == repo.ErrNotFound {
//user not found, cannot login
return model.AccessToken{}, model.RefreshToken{}, service.ErrNotFound
} else if err !... | [
0.01000018697232008,
0.07772906124591827,
0.6532424688339233,
0.23292748630046844,
-0.8991671204566956,
0.67820805311203,
-0.7808905839920044,
0.262850284576416,
0.19236230850219727,
0.02689649909734726,
-0.08400003612041473,
1.0303587913513184,
0.25017082691192627,
-0.023383276537060738,
... |
func (svc *credentialService) Get(ctx context.Context, email string) (model.Credential, error) {
cred, err := svc.repo.Get(ctx, email)
if err == repo.ErrNotFound {
//user not found, cannot login
return cred, service.ErrNotFound
}
return cred, err
} | [
-0.5954656600952148,
0.2712804675102234,
0.3906388580799103,
0.2919105887413025,
0.32976698875427246,
0.3255292773246765,
-0.3305927515029907,
0.2190706878900528,
-0.15631619095802307,
0.23507928848266602,
0.2711714506149292,
0.9016912579536438,
-0.19422279298305511,
-0.5759027004241943,
... |
func Underlined(s string) DecoratedString {
return DecoratedString(utils.Underline(s))
} | [
0.9638373255729675,
-0.4309149980545044,
0.06767130643129349,
-0.5297451615333557,
-1.053895354270935,
-0.015975559130311012,
-0.3386356830596924,
-0.4162660539150238,
0.8030740022659302,
-1.6466618776321411,
-0.22087039053440094,
0.9421113133430481,
0.9402265548706055,
-1.3989886045455933... |
func InBold(s string) DecoratedString {
return DecoratedString(utils.Embolden(s))
} | [
0.005467004142701626,
-0.6537182927131653,
0.41693443059921265,
0.2612276077270508,
-1.2064087390899658,
-0.00589569378644228,
-0.8650286793708801,
-0.3519290089607239,
0.6945286393165588,
-0.5255034565925598,
0.22991137206554413,
1.9100360870361328,
0.7502639889717102,
-0.0052584544755518... |
func Inverted(s string) DecoratedString {
return DecoratedString(utils.Invert(s))
} | [
-0.9083267450332642,
-0.07765070348978043,
0.12186841666698456,
0.027621252462267876,
-0.7426286935806274,
0.7226467132568359,
-0.4388824701309204,
0.07467663288116455,
-0.14788423478603363,
-0.568416953086853,
-0.5353879928588867,
0.8819724321365356,
-0.12544241547584534,
-1.3950136899948... |
func (Demo5Request_Gender) EnumDescriptor() ([]byte, []int) {
return file_example_demo5_proto_rawDescGZIP(), []int{0, 0}
} | [
-1.4431359767913818,
0.6244859099388123,
0.6068871021270752,
0.9205782413482666,
0.020227912813425064,
0.1005084440112114,
0.44319573044776917,
-0.1705457866191864,
-0.8166552782058716,
-1.207093358039856,
-0.3169505000114441,
0.8162213563919067,
-0.5225998163223267,
1.7367186546325684,
... |
func (*Demo5Request) Descriptor() ([]byte, []int) {
return file_example_demo5_proto_rawDescGZIP(), []int{0}
} | [
-0.9227902293205261,
0.21340195834636688,
0.1448584645986557,
0.5535835027694702,
-0.08488643169403076,
-0.7835111618041992,
0.7416302561759949,
-0.2609979212284088,
-0.31941789388656616,
-0.8763461112976074,
-0.5357833504676819,
0.2519129812717438,
0.1101246252655983,
1.20392906665802,
... |
func (*Demo5Response) Descriptor() ([]byte, []int) {
return file_example_demo5_proto_rawDescGZIP(), []int{1}
} | [
-0.2108713835477829,
-0.07529370486736298,
-0.04300915077328682,
0.4722626805305481,
0.23480889201164246,
-1.1030113697052002,
1.7089401483535767,
-0.2320590615272522,
0.02482982538640499,
-0.7822878956794739,
-1.0946810245513916,
-0.5659499168395996,
-0.2377905398607254,
0.153118908405303... |
func (*Demo5Request_Other) Descriptor() ([]byte, []int) {
return file_example_demo5_proto_rawDescGZIP(), []int{0, 0}
} | [
-0.6505191922187805,
-0.22124986350536346,
0.3558509051799774,
0.90956050157547,
0.1438264399766922,
-0.29136696457862854,
0.037245411425828934,
-0.9929696321487427,
-0.6476036310195923,
-1.0613501071929932,
-0.6709309816360474,
-0.4275948703289032,
-0.4142274260520935,
1.4837502241134644,... |
func Confirm(cmd *cobra.Command, message string) (confirmed bool) {
confirmed = cmd.Flag("confirm").Value.String() == "true"
if !confirmed && survey.AskOne(&survey.Confirm{Message: message}, &confirmed, nil) != nil {
os.Exit(0)
}
return
} | [
0.6250733137130737,
0.5009680986404419,
0.6949225068092346,
1.1867705583572388,
0.2136143445968628,
0.6978780627250671,
0.08896111696958542,
-0.2324254959821701,
-0.8511168956756592,
0.24877561628818512,
-0.1830156296491623,
0.3629318177700043,
-0.8823534250259399,
1.2162734270095825,
-0... |
func Confirmable(cmd *cobra.Command) {
cmd.Flags().BoolP("confirm", "c", false, "Confirm")
} | [
0.8403990864753723,
-0.3470425009727478,
0.5313786864280701,
1.1995795965194702,
0.6939994692802429,
1.2753325700759888,
0.8259885311126709,
0.8313090801239014,
-1.4846456050872803,
0.45957401394844055,
-0.5604560971260071,
0.1933671534061432,
-0.12910564243793488,
1.1557179689407349,
0.... |
func (m *X509Certificate) IssuerDN() Principal {
return m.issuerDNField
} | [
0.11388994008302689,
0.18906551599502563,
0.3382814824581146,
0.09554778039455414,
-0.3412226438522339,
-0.19848228991031647,
0.21358200907707214,
0.243061825633049,
0.6074091196060181,
-1.4460417032241821,
-0.09174623340368271,
0.2281765341758728,
-0.5863041281700134,
-0.8164225220680237,... |
func (m *X509Certificate) SetIssuerDN(val Principal) {
m.issuerDNField = val
} | [
-0.45867931842803955,
0.23766666650772095,
0.34603196382522583,
0.34889087080955505,
-0.486855149269104,
0.01048736646771431,
-0.004279561340808868,
0.8248379230499268,
0.1765354573726654,
-1.0904375314712524,
-0.9263089299201965,
-0.22934599220752716,
-0.3583327829837799,
-0.3666287362575... |
func (m *X509Certificate) SubjectDN() Principal {
return m.subjectDNField
} | [
0.5473398566246033,
0.608518123626709,
0.017550593242049217,
0.1544460654258728,
-0.7334732413291931,
0.5169968008995056,
0.1866203397512436,
-0.9785354733467102,
-0.024737482890486717,
-0.9019466042518616,
-1.0086934566497803,
0.8668033480644226,
0.20716030895709991,
-0.8992984294891357,
... |
func (m *X509Certificate) SetSubjectDN(val Principal) {
m.subjectDNField = val
} | [
0.31242579221725464,
0.8921754956245422,
-0.1273631602525711,
0.025431174784898758,
-0.5515732765197754,
0.6515564322471619,
-0.12826652824878693,
-0.4833390414714813,
-0.2868465781211853,
-0.6237215995788574,
-1.455932378768921,
0.23631350696086884,
0.09167297929525375,
-0.421883642673492... |
func (m *X509Certificate) UnmarshalJSON(raw []byte) error {
var data struct {
Encoded strfmt.Base64 `json:"encoded,omitempty"`
IssuerDN json.RawMessage `json:"issuerDN,omitempty"`
NotAfter strfmt.DateTime `json:"notAfter,omitempty"`
NotBefore strfmt.DateTime `json:"notBefore,omitempty"`
PublicKey *Public... | [
0.38929283618927,
0.24482980370521545,
0.8598508238792419,
-1.064687728881836,
-0.7990330457687378,
-1.0564442873001099,
-0.04532793164253235,
0.584230363368988,
-0.24372315406799316,
0.23745591938495636,
-0.49358105659484863,
0.20289233326911926,
-0.17791315913200378,
-0.24473050236701965... |
func (m X509Certificate) MarshalJSON() ([]byte, error) {
var b1, b2, b3 []byte
var err error
b1, err = json.Marshal(struct {
Encoded strfmt.Base64 `json:"encoded,omitempty"`
NotAfter strfmt.DateTime `json:"notAfter,omitempty"`
NotBefore strfmt.DateTime `json:"notBefore,omitempty"`
PublicKey *PublicKey `js... | [
1.1602751016616821,
0.03221890330314636,
0.6705182790756226,
-0.3529392182826996,
-0.684522807598114,
-0.5288670659065247,
-0.12480664253234863,
0.32787370681762695,
-0.037891313433647156,
0.3845272958278656,
-0.6808063983917236,
0.2996313273906708,
-0.700400173664093,
0.22473865747451782,... |
func (m *X509Certificate) Validate(formats strfmt.Registry) error {
var res []error
if err := m.validateIssuerDN(formats); err != nil {
res = append(res, err)
}
if err := m.validateNotAfter(formats); err != nil {
res = append(res, err)
}
if err := m.validateNotBefore(formats); err != nil {
res = append(r... | [
1.0867156982421875,
0.765314519405365,
0.19425199925899506,
-0.39582955837249756,
-0.15879374742507935,
-0.6587071418762207,
-0.11994665861129761,
-0.414922833442688,
-0.4550660252571106,
0.08382951468229294,
-0.2770351469516754,
-0.4095286428928375,
-1.0214588642120361,
0.464554101228714,... |
func (m *X509Certificate) ContextValidate(ctx context.Context, formats strfmt.Registry) error {
var res []error
if err := m.contextValidateIssuerDN(ctx, formats); err != nil {
res = append(res, err)
}
if err := m.contextValidatePublicKey(ctx, formats); err != nil {
res = append(res, err)
}
if err := m.cont... | [
0.8342568874359131,
0.4281984269618988,
0.5007465481758118,
-0.4773652255535126,
-0.2936178743839264,
-0.2962208092212677,
-0.36889639496803284,
-0.30842268466949463,
0.5118599534034729,
0.2513396441936493,
-0.06977555900812149,
0.22813305258750916,
-1.1132497787475586,
-0.0471227616071701... |
func (log *Log) Length() int {
return log.LastIncludedLength + len(log.Entries)
} | [
1.2955646514892578,
-0.41585975885391235,
0.4243283271789551,
-0.7617648243904114,
-0.1784408688545227,
1.0271624326705933,
0.6692165732383728,
1.1379939317703247,
1.0193573236465454,
0.18195611238479614,
-0.14048154652118683,
0.7631640434265137,
0.09567966312170029,
0.06616060435771942,
... |
func (rf *Raft) TruncateLog(lastAppliedIndex int) {
rf.mu.Lock()
if lastAppliedIndex <= rf.lastApplied && lastAppliedIndex >= rf.Log.LastIncludedLength {
rf.Log.LastIncludedTerm = rf.Log.Entries[lastAppliedIndex-rf.Log.LastIncludedLength].Term
rf.Log.Entries = rf.Log.Entries[(lastAppliedIndex - rf.Log.LastInclude... | [
1.1534922122955322,
0.2852228879928589,
0.6610531210899353,
-1.475463628768921,
-0.3211577236652374,
0.2834111154079437,
0.9040017127990723,
-0.10335329920053482,
0.8021523952484131,
0.3765593469142914,
0.207527294754982,
1.194684624671936,
-0.7573761940002441,
-0.36595839262008667,
1.20... |
func (rf *Raft) GetState() (int, bool) {
var term int
var isleader bool
rf.mu.Lock()
term = rf.CurrentTerm
isleader = rf.isLeader
rf.mu.Unlock()
return term, isleader
} | [
-0.3806806802749634,
-0.11434189975261688,
0.681555449962616,
0.06444437801837921,
-0.2609829008579254,
-0.9750678539276123,
0.3404518961906433,
-0.17174237966537476,
-0.20235203206539154,
0.3050178289413452,
-0.47240304946899414,
0.9259493350982666,
-1.5103970766067505,
0.5048319101333618... |
func (rf *Raft) persist() {
w := new(bytes.Buffer)
e := gob.NewEncoder(w)
rf.mu.Lock()
e.Encode(rf.CurrentTerm)
e.Encode(rf.VotedFor)
e.Encode(rf.Log)
rf.mu.Unlock()
data := w.Bytes()
rf.persister.SaveRaftState(data)
} | [
0.2132977992296219,
0.49368351697921753,
0.5231233835220337,
-0.8161051273345947,
0.9693350195884705,
0.7310240268707275,
-0.05140969902276993,
-0.18445663154125214,
-0.4927370250225067,
0.10272185504436493,
-0.7293950319290161,
-0.09037166833877563,
-1.4878946542739868,
0.5097187757492065... |
func (rf *Raft) readPersist(data []byte) {
rf.mu.Lock()
r := bytes.NewBuffer(data)
d := gob.NewDecoder(r)
d.Decode(&rf.CurrentTerm)
d.Decode(&rf.VotedFor)
d.Decode(&rf.Log)
if data == nil || len(data) < 1 { // bootstrap without any state?
rf.CurrentTerm = 0
rf.VotedFor = -1
rf.mu.Unlock()
return
}
rf.m... | [
-0.4305608570575714,
0.13000595569610596,
0.6161549687385559,
0.16152600944042206,
0.317293256521225,
-0.00017422962991986424,
-0.4220229983329773,
0.45920637249946594,
-0.13551023602485657,
-0.06356063485145569,
0.34276512265205383,
-0.11240312457084656,
-1.3437141180038452,
0.14564247429... |
func (rf *Raft) sendRequestVote(server int, args *RequestVoteArgs,
reply *RequestVoteReply) bool {
ok := rf.peers[server].Call("Raft.RequestVote", args, reply)
return ok
} | [
-1.7217257022857666,
0.6659510135650635,
0.8312348127365112,
0.7307031750679016,
0.17303933203220367,
0.21706810593605042,
-0.9719288349151611,
-0.5586418509483337,
-0.4343738853931427,
0.06299328804016113,
-0.05966845154762268,
0.571821928024292,
-1.641867995262146,
0.05286068469285965,
... |
func (rf *Raft) Start(command interface{}) (int, int, bool) {
rf.mu.Lock()
index := rf.Log.Length() + 1
term := rf.CurrentTerm
isLeader := rf.isLeader
rf.mu.Unlock()
if isLeader {
// Start the agreement now for this entry.
rf.mu.Lock()
index = rf.Log.Length() + 1
rf.Log.Entries = append(rf.Log.Entries, Lo... | [
-0.2016816884279251,
0.15465973317623138,
0.5491387844085693,
-0.21336780488491058,
0.2245454341173172,
-0.32612359523773193,
0.19794246554374695,
0.3167131543159485,
-0.977462112903595,
1.039682388305664,
-0.49170613288879395,
1.1219033002853394,
-0.663343608379364,
0.10706932842731476,
... |
func (rf *Raft) Kill() {
rf.mu.Lock()
rf.killAllGoRoutines = true
rf.mu.Unlock()
} | [
0.4039299786090851,
0.028983687981963158,
0.3360350430011749,
0.7222616076469421,
0.9351361989974976,
0.23564204573631287,
0.5445604920387268,
0.37931138277053833,
-0.4852266013622284,
0.5735085606575012,
-0.022422662004828453,
0.3946831524372101,
-0.725100576877594,
0.4137623608112335,
... |
func (rf *Raft) applyMsg() {
ticker := time.NewTicker(time.Millisecond * 100)
for _ = range ticker.C {
rf.mu.Lock()
if rf.killAllGoRoutines {
rf.mu.Unlock()
return
}
// Logic to increment commitIndex at the Leader.
if rf.isLeader {
for i := rf.Log.Length() - 1; i > rf.commitIndex && i >= rf.Log.Las... | [
0.2744298279285431,
0.3222047686576843,
0.8961039781570435,
-0.41557595133781433,
0.12440549582242966,
-0.4446934461593628,
0.730661153793335,
0.07808401435613632,
-0.4061996340751648,
-0.43953824043273926,
0.6429035663604736,
0.18908877670764923,
-0.6602667570114136,
1.3935792446136475,
... |
func Make(peers []*labrpc.ClientEnd, me int,
persister *Persister, applyCh chan ApplyMsg) *Raft {
rf := &Raft{}
rf.peers = peers
rf.persister = persister
rf.me = me
rf.applyCh = applyCh
// Initialize from state persisted before a crash.
rf.readPersist(persister.ReadRaftState())
// Initialize the other state ... | [
-0.04162362217903137,
0.270062655210495,
0.7755623459815979,
-0.37499547004699707,
-0.31012341380119324,
0.04112066701054573,
-0.0445706732571125,
-0.40373528003692627,
0.15992799401283264,
-0.5171910524368286,
0.09066659212112427,
-0.014507611282169819,
-0.7170299887657166,
0.221364215016... |
func (c *FakeProjects) Watch(opts v1.ListOptions) (watch.Interface, error) {
return c.Fake.
InvokesWatch(core.NewWatchAction(projectsResource, c.ns, opts))
} | [
-0.2334313690662384,
0.32733869552612305,
0.11750195175409317,
0.08405623584985733,
0.462062269449234,
0.6560196280479431,
0.7747325301170349,
-0.1606961190700531,
0.5153172016143799,
-0.4882962107658386,
-1.0205923318862915,
0.8845427632331848,
-0.2866959273815155,
0.22529974579811096,
... |
func (c *FakeProjects) Patch(name string, pt pkg_api.PatchType, data []byte, subresources ...string) (result *api.Project, err error) {
obj, err := c.Fake.
Invokes(core.NewPatchSubresourceAction(projectsResource, c.ns, name, data, subresources...), &api.Project{})
if obj == nil {
return nil, err
}
return obj.(... | [
-0.4670432209968567,
0.4437890946865082,
0.15404412150382996,
-0.5447636842727661,
-1.1963608264923096,
1.1585848331451416,
-0.29498183727264404,
0.009085663594305515,
0.671491265296936,
-0.5146955847740173,
-0.46905195713043213,
0.641388475894928,
-0.8198660612106323,
-0.23049093782901764... |
func NewCmdCreateEventHandler(f cmdutil.Factory, out io.Writer) *cobra.Command {
cmd := &cobra.Command{
Use: "handler",
Short: "Create event handler",
Run: func(cmd *cobra.Command, args []string) {
RunCreateEventHandler(f, out, cmd)
},
}
cmd.Flags().StringP("source", "s", "", "File containing event hand... | [
0.48218807578086853,
-1.0229097604751587,
0.6451074481010437,
-0.143232524394989,
-0.16537602245807648,
0.550135612487793,
0.7226673364639282,
0.3270382285118103,
-0.9053280353546143,
-0.7010477185249329,
-0.36183059215545654,
-0.02563052996993065,
0.3944956362247467,
1.0456371307373047,
... |
func RunCreateEventHandler(f cmdutil.Factory, out io.Writer, cmd *cobra.Command) error {
address, err := cmdutil.GetServerAddress(cmd)
if err != nil {
log.Fatalf("Unable to connect to server: %v", err)
return nil
}
eventHandlerName := cmdutil.GetFlagString(cmd, "eventhandler")
eventHandlerNamespace := cmduti... | [
0.2983083128929138,
-0.6953169703483582,
0.7298964858055115,
-0.19303278625011444,
-0.0958137959241867,
0.31894680857658386,
0.859013020992279,
0.1701701581478119,
-0.9887599349021912,
0.060375623404979706,
-0.8491002917289734,
0.36358022689819336,
-0.4008852243423462,
0.8783371448516846,
... |
func TestGetPriceFor_CachesResults(t *testing.T) {
mockStorage := &mockStorage{
mockResults: map[string]mockResult{
"p1": {price: 5, err: nil},
},
}
mockCache := &mockCache{
maxAge: time.Millisecond * 200,
}
service := NewService(mockStorage, mockCache)
assertFloat(t, 5, getPriceWithNoErr(t, service, "p... | [
-0.7342926859855652,
0.6808182001113892,
0.5895843505859375,
0.5851507782936096,
0.1471371203660965,
-0.11669820547103882,
-0.6136226058006287,
-0.5064162611961365,
0.04435308650135994,
-0.354423850774765,
-0.3086388409137726,
-0.6971510052680969,
-0.07109335064888,
0.5188779234886169,
0... |
func TestGetPriceFor_ReturnsErrorOnServiceError(t *testing.T) {
mockStorage := &mockStorage{
mockResults: map[string]mockResult{
"p1": {price: 0, err: fmt.Errorf("some error")},
},
}
mockCache := &mockCache{}
service := NewService(mockStorage, mockCache)
_, err := service.GetPricesFor("p1")
if err == nil {... | [
-0.6742815971374512,
0.2755306363105774,
0.3685471713542938,
0.04876038432121277,
0.1610720157623291,
-0.3192470669746399,
-1.0990270376205444,
0.13730239868164062,
0.14717084169387817,
-0.35657772421836853,
-0.21192440390586853,
-0.41962409019470215,
0.07030847668647766,
0.551437020301818... |
func TestGetPricesFor_GetsSeveralPricesAtOnceAndCachesThem(t *testing.T) {
mockStorage := &mockStorage{
mockResults: map[string]mockResult{
"p1": {price: 5, err: nil},
"p2": {price: 7, err: nil},
},
}
mockCache := &mockCache{
maxAge: time.Millisecond * 200,
}
service := NewService(mockStorage, mockCach... | [
-0.3141113519668579,
0.8710625767707825,
0.6336590647697449,
0.6552243232727051,
0.5519486665725708,
0.026902655139565468,
-0.435192734003067,
-0.11581887304782867,
0.17457561194896698,
0.005013053771108389,
-0.29865896701812744,
-0.38511335849761963,
0.0943465456366539,
0.4374171495437622... |
func TestGetPriceFor_DoesNotReturnOldResults(t *testing.T) {
mockStorage := &mockStorage{
mockResults: map[string]mockResult{
"p1": {price: 5, err: nil},
"p2": {price: 7, err: nil},
},
}
mockCache := &mockCache{
maxAge: time.Millisecond * 200,
}
maxAge70Pct := time.Millisecond * 140
service := NewServ... | [
-0.3876987397670746,
0.9877153038978577,
0.7617074251174927,
0.4805794358253479,
0.20120225846767426,
0.2801782786846161,
-0.6078836917877197,
-0.2687671184539795,
0.22120214998722076,
-0.13766668736934662,
0.21004138886928558,
-0.2622487545013428,
-0.005781191401183605,
0.5233998894691467... |
func TestGetPricesFor_ParallelizeCalls(t *testing.T) {
mockStorage := &mockStorage{
callDelay: time.Second, // each call to external service takes one full second
mockResults: map[string]mockResult{
"p1": {price: 5, err: nil},
"p2": {price: 7, err: nil},
},
}
mockCache := &mockCache{}
cache := NewServic... | [
0.19650739431381226,
1.512600302696228,
0.6793838739395142,
0.014904282987117767,
0.5296503305435181,
0.07992135733366013,
-0.7977311611175537,
0.22401297092437744,
-0.1544768065214157,
-0.1389123648405075,
0.16694848239421844,
-0.5249015688896179,
-0.42975229024887085,
0.7160817980766296,... |
func TestGetPricesFor_ParallelizeCallsWithError(t *testing.T) {
mockService := &mockStorage{
callDelay: time.Second,
mockResults: map[string]mockResult{
"p1": {price: 5, err: errors.New("Test error")},
"p2": {price: 7, err: nil},
},
}
mockCache := &mockCache{}
cache := NewService(mockService, mockCache)... | [
0.1141645535826683,
1.450518012046814,
0.6093630194664001,
0.13519921898841858,
0.4419829249382019,
0.026345275342464447,
-0.8135986924171448,
0.18403509259223938,
0.0012054453836753964,
-0.24603505432605743,
0.000379479635739699,
-0.4442945420742035,
-0.0636557936668396,
0.707252085208892... |
func MustGetContextHTTPClient(ctx context.Context) *http.Client {
client, ok := ctx.Value(&httpClientCtxKey).(*http.Client)
if !ok {
panic("no HTTP client in context")
}
return client
} | [
-0.2531265914440155,
-0.27833274006843567,
0.47575145959854126,
0.7910888195037842,
-0.3480778634548187,
1.0461164712905884,
-0.9045453071594238,
-0.8729156255722046,
0.08504930883646011,
0.17533159255981445,
-0.0974215418100357,
0.7616370916366577,
-0.7137519121170044,
-0.6937125325202942... |
func WithSelfTransport(ctx context.Context) (context.Context, error) {
// If a client is already present in the context, do not replace it, it may be a test.
if _, ok := ctx.Value(&httpClientCtxKey).(*http.Client); ok {
return ctx, nil
}
tr, err := auth.GetRPCTransport(ctx, auth.AsSelf)
if err != nil {
return... | [
-0.10391464829444885,
-1.0862001180648804,
0.5719236731529236,
-0.16889730095863342,
-0.6601746678352356,
-0.4553124010562897,
0.30531367659568787,
-1.3656156063079834,
0.7387598752975464,
-0.5280202031135559,
-0.6602131128311157,
0.3143053352832794,
0.217861607670784,
-0.05221067741513252... |
func WithTestHTTPClient(ctx context.Context, client *http.Client) context.Context {
return context.WithValue(ctx, &httpClientCtxKey, client)
} | [
0.31846046447753906,
-1.0534189939498901,
0.5048338174819946,
-0.5884021520614624,
-0.7129407525062561,
0.3855581283569336,
0.21719126403331757,
-1.3280699253082275,
0.4718638062477112,
-0.6076783537864685,
-0.141422837972641,
0.022760530933737755,
-0.13031098246574402,
-0.6877914667129517... |
func Sum64(b []byte) uint64 | [
-1.0579768419265747,
-0.1831607222557068,
0.3521350622177124,
2.3837437629699707,
0.24795258045196533,
-0.1703830510377884,
0.5231143236160278,
1.2516895532608032,
0.9193844199180603,
0.31172192096710205,
-0.4613856375217438,
-0.9747042059898376,
-0.8040664792060852,
0.5828049182891846,
... |
func initialiseServer() {
port := ":8090"
log.Printf("Starting HTTP server at http://localhost:%s", port)
// Attach request handlers
http.HandleFunc("/api/v1/vehicles", liveDataRequestHandler)
http.HandleFunc("/health", healthEndpoint)
http.HandleFunc("/", healthEndpoint)
// Start HTTP server
log.Fatal(http.L... | [
-0.7546352744102478,
-1.1778197288513184,
0.43814632296562195,
-0.058421749621629715,
1.6696908473968506,
0.7177343964576721,
0.025832664221525192,
0.7275660037994385,
-0.4155447781085968,
-0.6208144426345825,
-0.3572571575641632,
0.3616720736026764,
-0.20029722154140472,
0.378480851650238... |
func Connect(cfg *config.Config) {
if err := initClient(); err != nil {
tick := time.Tick(2 * time.Second)
done := make(closer)
select {
case <-done:
case <-tick:
err = initClient()
if err == nil {
close(done)
}
}
}
if err := client.SetDiscoveryInterval(30 * time.Second); err != nil {
log... | [
0.3719698488712311,
0.09276912361383438,
0.6053444147109985,
-0.2769406735897064,
-0.6052572727203369,
0.8594085574150085,
0.07043366134166718,
-0.11923792958259583,
-0.9577803611755371,
0.06262417882680893,
-0.295122891664505,
0.1508905589580536,
-0.28649622201919556,
0.29170066118240356,... |
func Close() {
_ = client.Close()
} | [
-0.01001479011029005,
-0.18102619051933289,
0.11385753005743027,
-0.756529688835144,
-0.6106112599372864,
0.8168230652809143,
1.1421679258346558,
-0.839101254940033,
-1.6012799739837646,
-0.8130778074264526,
0.04506535083055496,
0.5322895050048828,
-0.9494839310646057,
0.3685052692890167,
... |
func Execute(callback map[string]interface{}) {
var (
cb lifxCallback
decoder *mapstructure.Decoder
err error
)
log.WithField(`request`, callback).Debug(`Sending to LIFX`)
decoder, err = mapstructure.NewDecoder(&mapstructure.DecoderConfig{
DecodeHook: mapstructure.StringToTimeDurationHookFunc(),
... | [
-0.31341174244880676,
-0.24698518216609955,
0.8835614919662476,
-0.06680760532617569,
-0.46874815225601196,
-0.24612459540367126,
-0.9187521934509277,
0.04996856674551964,
-0.5194355845451355,
0.8482719659805298,
-0.18110592663288116,
-0.5585575103759766,
-0.39665836095809937,
0.3739536404... |
func NextPacket(stream *[]byte, hdrlay *PacketHeaderLayout, output *NextPacketOutput) bool {
read := *stream
*output = NextPacketOutput{}
if len(read) < hdrlay.Size {
return false
}
wholePacketSize := hdrlay.Size + ReadPacketSize(read, hdrlay)
output.wholePacketSize = wholePacketSize
if len(read) < who... | [
-0.11183903366327286,
0.09791667759418488,
0.8527097105979919,
-0.27146443724632263,
-2.13152813911438,
-0.17136165499687195,
-0.14999115467071533,
-0.7352678775787354,
0.012880804017186165,
-1.2028180360794067,
0.38476961851119995,
-0.16700957715511322,
-0.4054418206214905,
0.632787346839... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.