text stringlengths 11 6.3k | embedding listlengths 768 768 |
|---|---|
func (c *Cache) fetchBatch(ctx context.Context, job, instance string) (map[string]*cacheEntry, error) {
job, instance = escapeLval(job), escapeLval(instance)
apiResp, err := c.fetch(ctx, "batch", url.Values{
"match_target": []string{fmt.Sprintf("{job=\"%s\",instance=\"%s\"}", job, instance)},
})
if err != nil {
... | [
-0.28907510638237,
-0.006347624119371176,
0.6112833619117737,
-0.38273611664772034,
-0.019183600321412086,
0.08747314661741257,
-0.24657252430915833,
-0.7448727488517761,
-0.7671729326248169,
0.08366349339485168,
-0.13486607372760773,
0.970482587814331,
0.30564484000205994,
0.6304033398628... |
func escapeLval(s string) string {
return lvalReplacer.Replace(s)
} | [
0.7769858241081238,
-0.16081808507442474,
0.1452988237142563,
-0.7078732252120972,
-1.7157423496246338,
0.018016528338193893,
-0.6983892321586609,
0.663791298866272,
0.8231170177459717,
0.6624937653541565,
-0.9095233678817749,
0.7575435638427734,
0.5847452282905579,
-0.4708961844444275,
... |
func (rh *RegionHandler) AddFoods(ctx context.Context, request *FoodRequest) (*EmptyResponse, error) {
regionId := request.GetId()
//log.Println(regionId, "(",rh.Router.Successor(rh.RegionHash[regionId]),",",rh.Router.Successor(rh.Router.Successor(rh.RegionHash[regionId])+1),") addFoodsRPC, this is", rh.Router.Hash... | [
-0.46164456009864807,
-0.11949759721755981,
0.8924381136894226,
0.042531874030828476,
0.7966930270195007,
-0.48392125964164734,
0.009017608128488064,
-0.6772274374961853,
0.9218652844429016,
-0.6624597907066345,
-0.08792106062173843,
-0.01997254602611065,
-0.8738881945610046,
0.86992835998... |
func (rh *RegionHandler) NodeChangeHandler() {
// log.Println("NodeChangeHandler started")
for {
ncInfo := <-rh.RegionChange
if ncInfo.PrevConn == nil && ncInfo.CurrConn == nil {
// one node edge case: dump everything into primary
// log.Println("one node edge case")
rh.mux.Lock()
for rid, r := rang... | [
-0.15118460357189178,
-0.2514623701572418,
0.7514334321022034,
0.2165393978357315,
0.4299548864364624,
0.009376111440360546,
0.27100899815559387,
0.08474753797054291,
-0.024348720908164978,
-0.023613080382347107,
0.02312394045293331,
0.14709676802158356,
-0.4270543158054352,
0.579900324344... |
func main() {
nums := []int{1,1,1}
fmt.Println(subarraySum(nums, 2))
nums2 := []int{1,2,3}
fmt.Println(subarraySum(nums2, 3))
} | [
0.3649856746196747,
-0.12335451692342758,
0.9257113933563232,
1.5143890380859375,
-0.4765934944152832,
0.5408506989479065,
0.7528116703033447,
-0.35793212056159973,
0.24491608142852783,
0.15834841132164001,
-1.0547714233398438,
1.0648493766784668,
-0.2005314826965332,
-0.43519338965415955,... |
func (q *Queue) Enqueue(e string) {
q.Queue.Push(e)
return
} | [
0.5180118680000305,
0.060786984860897064,
0.3596254885196686,
-0.37987738847732544,
0.19692052900791168,
0.39843475818634033,
-1.0442255735397339,
0.6317609548568726,
0.010367593728005886,
0.07994247227907181,
0.010100254788994789,
0.7895873785018921,
-0.23829776048660278,
0.75535666942596... |
func (q *Queue) Dequeue() string {
front := q.Front()
if front == "" {
return ""
}
q.Queue.Unshift()
return front
} | [
0.5790683627128601,
0.08593988418579102,
0.7190830111503601,
-0.9561077952384949,
0.010170446708798409,
-0.7948313355445862,
-1.104042887687683,
0.16085544228553772,
0.09945559501647949,
-0.30744457244873047,
0.8751195669174194,
0.6363307237625122,
-1.1271543502807617,
0.9427371621131897,
... |
func (q *Queue) Size() int {
return q.Queue.Length
} | [
-0.32867684960365295,
0.020570209249854088,
0.08308441191911697,
-1.0860493183135986,
-0.24791625142097473,
0.2899984121322632,
-0.12051145732402802,
-0.3973471522331238,
0.26887959241867065,
-0.5613266229629517,
-0.6854380369186401,
0.5572142601013184,
-0.5138072967529297,
0.9058008790016... |
func (q *Queue) isEmpty() bool {
return q.Size() == 0
} | [
-0.8419352769851685,
-0.8869680762290955,
0.2661091685295105,
-0.16045911610126495,
1.1534961462020874,
0.11623425781726837,
-1.0489671230316162,
-0.3555673360824585,
-0.02015974186360836,
0.1575031727552414,
-0.523963451385498,
0.8504776954650879,
-0.45677411556243896,
0.462772011756897,
... |
func (q *Queue) Front() string {
if !q.isEmpty() {
return q.Queue.Start.Value
}
return ""
} | [
0.3363216817378998,
-0.12813128530979156,
0.26671335101127625,
-0.7436226010322571,
-0.2206767052412033,
0.7173345685005188,
-1.0214585065841675,
-0.22030821442604065,
0.19804950058460236,
-0.45481523871421814,
0.4307765066623688,
1.6852681636810303,
0.13342693448066711,
0.7763103246688843... |
func Schema() (*ytypes.Schema, error) {
uzp, err := UnzipSchema()
if err != nil {
return nil, fmt.Errorf("cannot unzip schema, %v", err)
}
return &ytypes.Schema{
Root: &Device{},
SchemaTree: uzp,
Unmarshal: Unmarshal,
}, nil
} | [
0.00010668668983271345,
0.013895558193325996,
0.4863152503967285,
0.9801209568977356,
-0.18603046238422394,
-0.9389681816101074,
0.2992871403694153,
0.7266802787780762,
0.7996742725372314,
-1.0973484516143799,
0.2505858838558197,
-0.017367282882332802,
-0.6394070982933044,
-0.6142526268959... |
func UnzipSchema() (map[string]*yang.Entry, error) {
var schemaTree map[string]*yang.Entry
var err error
if schemaTree, err = ygot.GzipToSchema(ySchema); err != nil {
return nil, fmt.Errorf("could not unzip the schema; %v", err)
}
return schemaTree, nil
} | [
-0.43859973549842834,
0.42659592628479004,
0.4228019118309021,
0.05399995297193527,
-0.2330630123615265,
-0.9854331016540527,
-0.11018531769514084,
0.36657947301864624,
0.904457688331604,
0.3825675845146179,
-0.27518776059150696,
0.15980127453804016,
-0.25566262006759644,
0.318386346101760... |
func Unmarshal(data []byte, destStruct ygot.GoStruct, opts ...ytypes.UnmarshalOpt) error {
tn := reflect.TypeOf(destStruct).Elem().Name()
schema, ok := SchemaTree[tn]
if !ok {
return fmt.Errorf("could not find schema for type %s", tn )
}
var jsonTree interface{}
if err := json.Unmarshal([]byte(data), &jsonTree)... | [
-0.44560787081718445,
0.40614983439445496,
0.811762809753418,
-0.7206581234931946,
-0.6051723957061768,
-0.30758124589920044,
-0.28520768880844116,
0.6971665024757385,
0.37170612812042236,
-0.06939741969108582,
0.08032826334238052,
0.7231065630912781,
0.27952367067337036,
-0.19445624947547... |
func (*Device) IsYANGGoStruct() {} | [
-1.3343513011932373,
-0.19742818176746368,
0.19413909316062927,
0.955091655254364,
-0.20506444573402405,
-0.38217177987098694,
1.4248658418655396,
-0.8262998461723328,
1.417620062828064,
-1.9207148551940918,
-0.40228620171546936,
0.4139234125614166,
-0.1314668506383896,
0.9505725502967834,... |
func (t *Device) Validate(opts ...ygot.ValidationOption) error {
if err := ytypes.Validate(SchemaTree["Device"], t, opts...); err != nil {
return err
}
return nil
} | [
-0.3563147485256195,
0.9693311452865601,
0.3581872284412384,
1.0470694303512573,
0.5586931705474854,
0.39536958932876587,
0.8274424076080322,
-0.20858608186244965,
-0.24016200006008148,
-0.7629660964012146,
0.4379579424858093,
0.5038671493530273,
-0.38240846991539,
0.8998029232025146,
0.... |
func (*Test1_Cont1A) IsYANGGoStruct() {} | [
-0.6094481348991394,
-1.469252109527588,
0.30388322472572327,
0.5752958655357361,
-0.4590943455696106,
-0.29895758628845215,
2.10685396194458,
0.12673082947731018,
0.9551498293876648,
0.2737664580345154,
0.34696969389915466,
-0.03612271323800087,
-1.2881170511245728,
1.4139162302017212,
... |
func (t *Test1_Cont1A) NewList2A(Name string) (*Test1_Cont1A_List2A, error){
// Initialise the list within the receiver struct if it has not already been
// created.
if t.List2A == nil {
t.List2A = make(map[string]*Test1_Cont1A_List2A)
}
key := Name
// Ensure that this key has not already been used in the
/... | [
-1.4232053756713867,
-1.9960793256759644,
0.6255408525466919,
-0.0706401988863945,
-0.4302871823310852,
-0.7088291049003601,
0.7690339088439941,
0.0621337816119194,
0.5558146238327026,
0.24864529073238373,
-0.34672701358795166,
-0.25316959619522095,
-0.13562199473381042,
1.175800085067749,... |
func (t *Test1_Cont1A) Validate(opts ...ygot.ValidationOption) error {
if err := ytypes.Validate(SchemaTree["Test1_Cont1A"], t, opts...); err != nil {
return err
}
return nil
} | [
0.38225892186164856,
-0.4595820903778076,
0.475072979927063,
0.3108966052532196,
0.37499743700027466,
0.1589221954345703,
1.5491292476654053,
0.25923481583595276,
0.2764110565185547,
0.4407086670398712,
0.9982678890228271,
0.2395675778388977,
-1.365055799484253,
1.2505806684494019,
-0.15... |
func (*Test1_Cont1A_Cont2A) IsYANGGoStruct() {} | [
-0.6508890986442566,
-1.9585707187652588,
0.4247916340827942,
0.3512774109840393,
-0.5286703109741211,
-0.5223973393440247,
1.7485506534576416,
-0.3652508556842804,
0.39943015575408936,
0.14678308367729187,
0.3863794505596161,
0.05468877777457237,
-0.5130422115325928,
1.37787926197052,
0... |
func (t *Test1_Cont1A_Cont2A) Validate(opts ...ygot.ValidationOption) error {
if err := ytypes.Validate(SchemaTree["Test1_Cont1A_Cont2A"], t, opts...); err != nil {
return err
}
return nil
} | [
0.2726079523563385,
-1.118101954460144,
0.6026567220687866,
0.03734101355075836,
0.19768942892551422,
-0.04691053181886673,
1.2781927585601807,
-0.15704244375228882,
-0.1663222461938858,
0.28878432512283325,
0.9738935828208923,
0.34682244062423706,
-0.9893389940261841,
1.1626708507537842,
... |
func (*Test1_Cont1A_Cont2D) IsYANGGoStruct() {} | [
-0.3526889681816101,
-1.6932027339935303,
0.23603112995624542,
-0.06198939308524132,
-0.7929721474647522,
0.0053363703191280365,
1.7353925704956055,
-0.37723109126091003,
-0.04182897135615349,
-0.006200022529810667,
0.8978193998336792,
0.23331588506698608,
-0.6569259762763977,
1.5460952520... |
func (t *Test1_Cont1A_Cont2D) Validate(opts ...ygot.ValidationOption) error {
if err := ytypes.Validate(SchemaTree["Test1_Cont1A_Cont2D"], t, opts...); err != nil {
return err
}
return nil
} | [
0.4757794141769409,
-0.8681542277336121,
0.4107822775840759,
-0.42835602164268494,
-0.23734323680400848,
0.4463103711605072,
1.3640403747558594,
-0.16536249220371246,
-0.51975417137146,
0.2537377178668976,
1.3487660884857178,
0.4919862449169159,
-0.9762259125709534,
1.3655956983566284,
0... |
func (*Test1_Cont1A_List2A) IsYANGGoStruct() {} | [
-0.901890218257904,
-1.677145004272461,
0.36319905519485474,
0.8036313056945801,
-0.3486909866333008,
-0.0027973055839538574,
1.3543758392333984,
0.3769315183162689,
0.42276471853256226,
0.16914498805999756,
0.31808409094810486,
0.03900420293211937,
-0.21002197265625,
1.7434446811676025,
... |
func (t *Test1_Cont1A_List2A) Validate(opts ...ygot.ValidationOption) error {
if err := ytypes.Validate(SchemaTree["Test1_Cont1A_List2A"], t, opts...); err != nil {
return err
}
return nil
} | [
-0.10870091617107391,
-0.9347481727600098,
0.555095911026001,
0.38133174180984497,
0.17048773169517517,
0.04616647586226463,
0.8063085675239563,
0.47676998376846313,
0.10819181054830551,
0.2938549220561981,
0.6917673349380493,
0.3028342127799988,
-0.5992380380630493,
1.7466686964035034,
... |
func (*Test1_Cont1BState) IsYANGGoStruct() {} | [
0.18773768842220306,
-0.8691762685775757,
0.26710745692253113,
1.013942837715149,
-0.4582081735134125,
0.15272822976112366,
1.0740065574645996,
0.0012416584650054574,
0.6497916579246521,
0.49070605635643005,
0.10902738571166992,
-0.16609910130500793,
-1.512457013130188,
0.764370858669281,
... |
func (t *Test1_Cont1BState) NewList2B(Index1 uint8, Index2 uint8) (*Test1_Cont1BState_List2B, error){
// Initialise the list within the receiver struct if it has not already been
// created.
if t.List2B == nil {
t.List2B = make(map[Test1_Cont1BState_List2B_Key]*Test1_Cont1BState_List2B)
}
key := Test1_Cont1BSt... | [
-0.9457570910453796,
-0.8082281947135925,
0.6726025938987732,
0.8772668242454529,
0.34911495447158813,
-0.5897237062454224,
0.2953852415084839,
-0.023762963712215424,
0.8121086359024048,
0.4719828963279724,
-0.1524815708398819,
-0.3869188725948334,
-0.31670093536376953,
0.42301493883132935... |
func (t *Test1_Cont1BState) Validate(opts ...ygot.ValidationOption) error {
if err := ytypes.Validate(SchemaTree["Test1_Cont1BState"], t, opts...); err != nil {
return err
}
return nil
} | [
0.8093228936195374,
-0.000045705408410867676,
0.4181462228298187,
0.9668729901313782,
0.39369648694992065,
0.619953453540802,
0.9012371301651001,
-0.06477826833724976,
0.004953430034220219,
0.5185060501098633,
0.6302899718284607,
0.3685624897480011,
-1.6479755640029907,
0.7627964019775391,... |
func (*Test1_Cont1BState_Cont2C) IsYANGGoStruct() {} | [
0.06983505934476852,
-1.227447748184204,
0.2886771857738495,
0.7811064124107361,
-0.022862324491143227,
0.010209677740931511,
1.260209083557129,
-0.3932251036167145,
-0.18546615540981293,
-0.12676236033439636,
0.1767231971025467,
0.22309567034244537,
-0.39543139934539795,
0.800818860530853... |
func (t *Test1_Cont1BState_Cont2C) Validate(opts ...ygot.ValidationOption) error {
if err := ytypes.Validate(SchemaTree["Test1_Cont1BState_Cont2C"], t, opts...); err != nil {
return err
}
return nil
} | [
0.7236126661300659,
-0.5583613514900208,
0.3920733630657196,
0.35201936960220337,
0.4124445617198944,
0.2700192332267761,
0.8589792251586914,
-0.2951136529445648,
-0.6292496919631958,
0.016905106604099274,
0.69607013463974,
0.5063135623931885,
-0.9515370726585388,
0.7458314895629883,
-0.... |
func (*Test1_Cont1BState_List2B) IsYANGGoStruct() {} | [
-0.5808459520339966,
-0.7802636623382568,
0.2999815046787262,
1.9003968238830566,
-0.08214318752288818,
0.1802188903093338,
0.6335476040840149,
0.26549333333969116,
0.06801465898752213,
0.26790350675582886,
-0.2186170220375061,
-0.5256326198577881,
-0.442963182926178,
1.3773767948150635,
... |
func (t *Test1_Cont1BState_List2B) Validate(opts ...ygot.ValidationOption) error {
if err := ytypes.Validate(SchemaTree["Test1_Cont1BState_List2B"], t, opts...); err != nil {
return err
}
return nil
} | [
0.13235123455524445,
-0.37948912382125854,
0.4116266071796417,
1.2453410625457764,
0.31726720929145813,
0.30819952487945557,
0.37269145250320435,
0.351254940032959,
-0.17930616438388824,
0.1764191836118698,
0.23198814690113068,
-0.06366971135139465,
-0.9260756373405457,
1.4590892791748047,... |
func (E_Test1Identities_MYBASE) IsYANGGoEnum() {} | [
-1.2398184537887573,
-0.6876509189605713,
0.21703289449214935,
-0.3369145393371582,
0.6296353936195374,
-0.15137887001037598,
0.6824957728385925,
0.466846764087677,
0.5563606023788452,
0.660658061504364,
-0.9998875856399536,
0.7864209413528442,
-1.238837718963623,
0.4126589596271515,
0.1... |
func (e E_Test1Identities_MYBASE) String() string {
return ygot.EnumLogString(e, int64(e), "E_Test1Identities_MYBASE")
} | [
-0.41070255637168884,
-0.953660249710083,
0.19067218899726868,
-0.5556937456130981,
-0.010095182806253433,
0.7725128531455994,
0.47972559928894043,
-0.393022358417511,
0.40606147050857544,
0.813033938407898,
-0.4120909869670868,
0.9623141288757324,
-0.7571448087692261,
0.09813803434371948,... |
func (E_Test1_Cont1A_Cont2D_Chocolate) IsYANGGoEnum() {} | [
-0.7296685576438904,
-1.0916813611984253,
0.34363359212875366,
-0.2599409520626068,
0.4394191801548004,
-0.3184089958667755,
1.791081428527832,
-0.353913813829422,
-0.005785983055830002,
0.6245176792144775,
-0.13126352429389954,
0.5837514400482178,
-0.5887060761451721,
1.2639962434768677,
... |
func (e E_Test1_Cont1A_Cont2D_Chocolate) String() string {
return ygot.EnumLogString(e, int64(e), "E_Test1_Cont1A_Cont2D_Chocolate")
} | [
0.20920683443546295,
-1.198149561882019,
0.28443747758865356,
-0.5842183828353882,
-0.34833449125289917,
0.6121793389320374,
1.5366894006729126,
-0.7645126581192017,
-0.5292323231697083,
1.0519908666610718,
0.4353483021259308,
0.7025489807128906,
0.11382517963647842,
0.6046032309532166,
... |
func TestNoWriteAfterServeHTTPReturns(t *testing.T) {
cfdHTTP2Conn, edgeTCPConn := newTestHTTP2Connection()
ctx, cancel := context.WithCancel(context.Background())
var wg sync.WaitGroup
serverDone := make(chan struct{})
go func() {
defer close(serverDone)
cfdHTTP2Conn.Serve(ctx)
}()
edgeTransport := http2... | [
-0.4379025995731354,
-0.6173968315124512,
0.9023157358169556,
-0.15460586547851562,
0.3309061527252197,
-0.02036796323955059,
0.5701422691345215,
-0.43146970868110657,
-1.1189454793930054,
-0.31280991435050964,
-0.39162105321884155,
-0.01078801229596138,
0.06908050924539566,
0.129978179931... |
func (d *DmSpecial) Find(sha1Sum string) string {
locations := d.Split()
reg := regexp.MustCompile(fmt.Sprintf(_regFmt, sha1Sum))
for _, location := range locations {
if reg.MatchString(location) {
return location
}
}
return ""
} | [
0.015826312825083733,
0.3178676962852478,
0.6031867265701294,
-0.23564885556697845,
-0.542830228805542,
-0.11290576308965683,
0.5948430895805359,
-0.028904113918542862,
-0.14845408499240875,
0.3425157964229584,
1.2851805686950684,
-0.31189286708831787,
-0.5432981848716736,
-0.0433529913425... |
func grpcHandlerFunc(grpcServer *grpc.Server, otherHandler http.Handler) http.Handler {
return h2c.NewHandler(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
if r.ProtoMajor == 2 && strings.Contains(r.Header.Get("Content-Type"), "application/grpc") {
grpcServer.ServeHTTP(w, r)
} else {
otherH... | [
0.31578800082206726,
-0.3341529667377472,
0.7530617713928223,
0.47586411237716675,
-0.09906086325645447,
0.7797917723655701,
0.2436276525259018,
-0.14724238216876984,
-0.762420654296875,
0.5826082229614258,
0.48112890124320984,
0.9937161207199097,
-0.20013253390789032,
-0.11907857656478882... |
func (i identifyServer) Identify(ctx context.Context, in *api.IdentifyRequest) (*api.IdentifyResponse, error) {
r := &api.IdentifyResponse{}
if in.Id == "" {
return r, fmt.Errorf("no id in request specified")
}
t, ok := config.Cfg.Tracks[in.Id]
if !ok {
return r, fmt.Errorf("could not find track for id: %s",... | [
-1.5170559883117676,
0.012998787686228752,
0.6551710367202759,
0.6018346548080444,
0.5561209321022034,
0.000406161678256467,
-0.11507786810398102,
-0.4207059442996979,
0.45381173491477966,
0.3012746572494507,
-0.6281287670135498,
-0.005176491569727659,
-1.2689932584762573,
0.12057515978813... |
func (t TimerServer) Get(ctx context.Context, req *api.TimerEmpty) (*api.Timer, error) {
// Nothing there yet, so return a fresh struct.
if timer.T.Req == nil {
return &api.Timer{}, nil
}
return timer.T.Req, nil
} | [
-1.3865690231323242,
-0.11463995277881622,
0.4100790321826935,
-0.22919932007789612,
0.7422358989715576,
-0.3653559386730194,
-0.6313190460205078,
-0.6006532311439514,
0.037779487669467926,
-0.36268770694732666,
0.06617465615272522,
1.2111399173736572,
-0.6828378438949585,
0.56308716535568... |
func (c Client) Create(input *CreateAssistantInput) (*CreateAssistantResponse, error) {
return c.CreateWithContext(context.Background(), input)
} | [
-0.7959680557250977,
-0.08426554501056671,
0.35689571499824524,
0.6104373931884766,
-0.5668845176696777,
1.0641906261444092,
0.3135303258895874,
-1.2055106163024902,
0.22199173271656036,
-0.1729525774717331,
-0.1107240617275238,
-0.013434330001473427,
-0.9111871719360352,
0.663062810897827... |
func (c Client) CreateWithContext(context context.Context, input *CreateAssistantInput) (*CreateAssistantResponse, error) {
op := client.Operation{
Method: http.MethodPost,
URI: "/Assistants",
ContentType: client.URLEncoded,
}
if input == nil {
input = &CreateAssistantInput{}
}
response := &... | [
-1.3313016891479492,
-0.10839064419269562,
0.6099408864974976,
-0.10123627632856369,
-0.5528365969657898,
0.46267032623291016,
-0.5171796083450317,
-1.8459038734436035,
0.6442012786865234,
0.28689002990722656,
-0.7664203643798828,
0.3512219190597534,
-0.5955730676651001,
0.3811054825782776... |
func Sync(options ...Option) error {
p, err := parseOptions(options...)
if err != nil {
return fmt.Errorf("error parsing options: %w", err)
}
tools, err := readTools(p)
if err != nil {
return err
}
for _, t := range tools {
args := []string{"install", "-v"}
if t.BuildFlags != "" {
split, err := shell... | [
0.4498074948787689,
-0.2043243944644928,
1.092899203300476,
0.2873217463493347,
0.5645352005958557,
0.04274272173643112,
0.1859588325023651,
-1.1597484350204468,
-0.8033992648124695,
0.6644426584243774,
-0.22605514526367188,
0.5917178392410278,
0.2517714202404022,
0.8935520052909851,
-0.... |
func (m *Contact) BeforeToORM(ctx context.Context, c *ContactORM) error {
if m.PrimaryEmail != "" {
for _, mail := range m.Emails {
if mail.Address == m.PrimaryEmail {
return nil
}
}
c.Emails = append(c.Emails, &EmailORM{Address: m.PrimaryEmail, IsPrimary: true})
}
return nil
} | [
0.6008585691452026,
0.2036355435848236,
0.6057338714599609,
-0.8138667941093445,
0.6433365345001221,
-0.3232021927833557,
-0.23988376557826996,
0.4556998610496521,
0.17431914806365967,
-0.2753036320209503,
-0.3989647328853607,
0.4863741397857666,
0.07749337702989578,
-0.14525511860847473,
... |
func (m *ContactORM) AfterToPB(ctx context.Context, c *Contact) error {
if len(m.Emails) == 0 {
return nil
}
// find the primary e-mail in list of e-mails from DB
for _, addr := range m.Emails {
if addr != nil && addr.IsPrimary {
c.PrimaryEmail = addr.Address
break
}
}
return nil
} | [
0.3050004541873932,
-0.5869483351707458,
0.5070250630378723,
-0.32824721932411194,
-0.4724879562854767,
0.390991747379303,
0.32703059911727905,
0.6332022547721863,
0.5706470608711243,
-0.41951367259025574,
0.020549051463603973,
-0.20021089911460876,
-0.3038732707500458,
0.21558883786201477... |
func (m *ContactORM) BeforeUpdate(scope *gorm.Scope) (err error) {
// Create a new db access point
dbc := scope.NewDB()
// To execute commands directly :
// dbc.Exec("SOME SQL COMMAND")
// Executes the raw sql cmd and gets query response in rows
rows, err := dbc.Raw("SELECT * FROM contacts WHERE id=" + fmt.Spri... | [
-0.1802968531847,
-0.3727019727230072,
0.6411837339401245,
0.0421677865087986,
0.39859768748283386,
-0.49998703598976135,
-0.47639304399490356,
-0.479810506105423,
0.28186652064323425,
0.008812104351818562,
0.8056228160858154,
-0.8806424140930176,
-0.5123201012611389,
0.4174017012119293,
... |
func (m *ContactsDefaultServer) CustomRead(ctx context.Context, req *ReadContactRequest) (*ReadContactResponse, error) {
res, err := DefaultReadContact(ctx, &Contact{Id: req.GetId()}, m.DB)
if err != nil {
st := status.Newf(codes.Internal, "Unable to read contact. Error %v", err)
st, _ = st.WithDetails(errdetails... | [
-0.13470248878002167,
-0.803966760635376,
0.6053027510643005,
-0.2553265690803528,
-0.594025731086731,
-0.060869887471199036,
0.20948351919651031,
-0.38052329421043396,
0.6503273844718933,
-0.2367444485425949,
1.3507171869277954,
0.6065754890441895,
-0.5236328840255737,
-0.4262089431285858... |
func (c *Controller) Run(stopCh <-chan struct{}) {
defer runtime.HandleCrash()
klog.V(2).Info("Starting Metrics controller")
defer klog.V(2).Info("Shutting down Metrics controller")
if !cache.WaitForCacheSync(stopCh, c.appsSynced, c.releasesSynced) {
runtime.HandleError(fmt.Errorf("failed to wait for caches to ... | [
-0.2689599394798279,
0.0884716808795929,
0.43184947967529297,
-0.0313655249774456,
0.4207155108451843,
1.0261114835739136,
0.754639744758606,
-0.27521196007728577,
-0.8753105401992798,
-0.13398796319961548,
-0.6946412324905396,
-0.35604938864707947,
0.23661047220230103,
0.31256985664367676... |
func (sdr *DirReader) Close() error {
sdr.sd.mu.Unlock()
return sdr.f.Close()
} | [
-0.5810433030128479,
0.018074478954076767,
0.4626651108264923,
-0.09119809418916702,
-1.009986400604248,
0.12153559923171997,
0.3871590793132782,
-0.29515793919563293,
0.2691291868686676,
-1.1000405550003052,
1.4803467988967896,
-0.5017800331115723,
-0.866202712059021,
0.15277859568595886,... |
func (sdr *DirReader) Read(b []byte) (int, error) {
return sdr.f.Read(b)
} | [
-1.059376835823059,
0.4808461368083954,
0.4083741009235382,
0.4270356595516205,
0.06102663651108742,
-0.04504869878292084,
1.0667033195495605,
0.1647881269454956,
0.3695875108242035,
-1.088917851448059,
0.48610374331474304,
-0.3046776354312897,
-0.5769814848899841,
0.4446120262145996,
0.... |
func (sdr *DirReader) Stat() (os.FileInfo, error) {
return sdr.f.Stat()
} | [
-0.07648433744907379,
-0.5909779667854309,
0.4154987335205078,
-0.635255753993988,
0.07870761305093765,
-0.28395116329193115,
0.5996370911598206,
-0.22935476899147034,
-0.3080025613307953,
-1.3297953605651855,
0.39365115761756897,
-0.4014538526535034,
0.3754357695579529,
0.5747147798538208... |
func New(siaPath modules.SiaPath, rootDir string, wal *writeaheadlog.WAL) (*SiaDir, error) {
// Create path to directory and ensure path contains all metadata
updates, err := createDirMetadataAll(siaPath, rootDir)
if err != nil {
return nil, err
}
// Create metadata for directory
md, update, err := createDirMe... | [
-0.059702999889850616,
-0.9881989359855652,
0.42149317264556885,
-0.14306381344795227,
-0.4557429552078247,
0.15721437335014343,
0.2453467696905136,
-0.12095481902360916,
-0.17439836263656616,
0.45122817158699036,
0.5491994619369507,
0.47916632890701294,
0.2574813961982727,
0.9038574695587... |
func createDirMetadata(siaPath modules.SiaPath, rootDir string) (Metadata, writeaheadlog.Update, error) {
// Check if metadata file exists
_, err := os.Stat(siaPath.SiaDirMetadataSysPath(rootDir))
if err == nil || !os.IsNotExist(err) {
return Metadata{}, writeaheadlog.Update{}, err
}
// Initialize metadata, set... | [
-0.16776922345161438,
-0.8509309887886047,
0.5431146025657654,
0.23608055710792542,
0.15354116261005402,
0.335492342710495,
-0.141153946518898,
-0.2670458257198334,
0.29507696628570557,
0.35068053007125854,
0.2656768560409546,
0.21407578885555267,
0.004133709240704775,
0.6393250226974487,
... |
func loadSiaDirMetadata(path string, deps modules.Dependencies) (md Metadata, err error) {
// Open the file.
file, err := deps.Open(path)
if err != nil {
return Metadata{}, err
}
defer file.Close()
// Read the file
bytes, err := ioutil.ReadAll(file)
if err != nil {
return Metadata{}, err
}
// Parse the ... | [
-1.1767138242721558,
0.16252104938030243,
0.7934421300888062,
-1.4256608486175537,
-0.6127336621284485,
0.238992840051651,
-0.7716556787490845,
0.11192212998867035,
-0.1526111215353012,
0.6504033803939819,
-0.5200555920600891,
0.44519129395484924,
0.35926494002342224,
-0.4204671382904053,
... |
func LoadSiaDir(rootDir string, siaPath modules.SiaPath, deps modules.Dependencies, wal *writeaheadlog.WAL) (sd *SiaDir, err error) {
sd = &SiaDir{
deps: deps,
siaPath: siaPath,
rootDir: rootDir,
wal: wal,
}
sd.metadata, err = loadSiaDirMetadata(siaPath.SiaDirMetadataSysPath(rootDir), modules.ProdDepe... | [
-0.4263226091861725,
-0.5969449281692505,
0.517402172088623,
-0.40206632018089294,
-0.936028778553009,
0.4384191036224365,
-0.3463807702064514,
-0.24528995156288147,
0.7909721732139587,
-0.1410415768623352,
0.3780420422554016,
0.8592227697372437,
-0.45121416449546814,
0.4983038604259491,
... |
func (sd *SiaDir) delete() error {
update := sd.createDeleteUpdate()
err := sd.createAndApplyTransaction(update)
sd.deleted = true
return err
} | [
1.1175094842910767,
0.10170541703701019,
0.4336964190006256,
0.6626836657524109,
0.16726882755756378,
-0.47914549708366394,
0.24331210553646088,
0.8766103386878967,
0.5986018180847168,
0.12962627410888672,
0.19344155490398407,
-0.7181975245475769,
-0.5824463367462158,
-0.4117017984390259,
... |
func (sd *SiaDir) Delete() error {
sd.mu.Lock()
defer sd.mu.Unlock()
return sd.delete()
} | [
0.5930071473121643,
0.3271872401237488,
0.3121368885040283,
0.8195840120315552,
-0.10917244106531143,
-0.8833786249160767,
0.4258419871330261,
-0.29137465357780457,
0.6360819935798645,
0.10692660510540009,
0.6281565427780151,
-0.08397196978330612,
-1.3900597095489502,
0.12100902199745178,
... |
func (sd *SiaDir) Deleted() bool {
sd.mu.Lock()
defer sd.mu.Unlock()
return sd.deleted
} | [
0.556477427482605,
-0.47418245673179626,
0.5587160587310791,
0.2318669706583023,
-0.11022797226905823,
0.08588286489248276,
0.14606788754463196,
-0.12119685113430023,
0.9151795506477356,
-0.5122673511505127,
-0.3679060935974121,
0.015601721592247486,
-0.4033995568752289,
-0.270581066608428... |
func (sd *SiaDir) DirReader() (*DirReader, error) {
sd.mu.Lock()
if sd.deleted {
sd.mu.Unlock()
return nil, errors.New("can't copy deleted SiaDir")
}
// Open file.
path := sd.siaPath.SiaDirMetadataSysPath(sd.rootDir)
f, err := os.Open(path)
if err != nil {
sd.mu.Unlock()
return nil, err
}
return &DirRe... | [
-0.43599048256874084,
-0.8634670376777649,
0.3043351173400879,
0.31814950704574585,
-1.1714292764663696,
0.026172520592808723,
0.7101582884788513,
0.058044832199811935,
0.5723939538002014,
-0.44670477509498596,
1.3396692276000977,
0.6675655841827393,
-0.16067500412464142,
-0.07533770054578... |
func (sd *SiaDir) Metadata() Metadata {
sd.mu.Lock()
defer sd.mu.Unlock()
return sd.metadata
} | [
0.1947607547044754,
-0.1275675743818283,
0.2616756856441498,
0.6305921077728271,
-0.019439874216914177,
-0.29361531138420105,
-0.11454375088214874,
-0.8923077583312988,
0.31017428636550903,
-0.047399941831827164,
0.8750843405723572,
0.04328789561986923,
-0.3069556653499603,
-0.066066995263... |
func (sd *SiaDir) SiaPath() modules.SiaPath {
sd.mu.Lock()
defer sd.mu.Unlock()
return sd.siaPath
} | [
0.17407341301441193,
-1.2019213438034058,
0.19131478667259216,
1.1468021869659424,
-0.949836254119873,
0.5161928534507751,
1.6914275884628296,
-0.9311389327049255,
1.0904583930969238,
0.1553509533405304,
0.9574061632156372,
-0.817931592464447,
-0.8578267693519592,
-0.2086694836616516,
0.... |
func (sd *SiaDir) UpdateMetadata(metadata Metadata) error {
sd.mu.Lock()
defer sd.mu.Unlock()
sd.metadata.AggregateHealth = metadata.AggregateHealth
sd.metadata.AggregateLastHealthCheckTime = metadata.AggregateLastHealthCheckTime
sd.metadata.AggregateMinRedundancy = metadata.AggregateMinRedundancy
sd.metadata.Agg... | [
-0.502357542514801,
-0.508784830570221,
0.6620625853538513,
-0.18473264575004578,
0.05407595634460449,
-0.23767967522144318,
0.4791141450405121,
0.043752677738666534,
-0.08471659570932388,
0.5776618123054504,
0.08684781193733215,
-0.050862886011600494,
-0.5498524904251099,
0.28068658709526... |
func NewLightning(cfg *config.SubTaskConfig, cli *clientv3.Client, workerName string) *LightningLoader {
lightningCfg := makeGlobalConfig(cfg)
core := lightning.New(lightningCfg)
loader := &LightningLoader{
cfg: cfg,
cli: cli,
core: core,
lightningConfig: lightningCfg,
lo... | [
0.5703805685043335,
-0.2526451349258423,
0.5538467764854431,
-0.057510051876306534,
-0.8760475516319275,
0.6209876537322998,
-0.5388632416725159,
0.28319990634918213,
-0.30742383003234863,
-0.1798199564218521,
-1.3256381750106812,
0.6003906726837158,
-0.22174468636512756,
0.497080951929092... |
func (l *LightningLoader) Init(ctx context.Context) (err error) {
tctx := tcontext.NewContext(ctx, l.logger)
checkpoint, err := newRemoteCheckPoint(tctx, l.cfg, l.checkpointID())
failpoint.Inject("ignoreLoadCheckpointErr", func(_ failpoint.Value) {
l.logger.Info("", zap.String("failpoint", "ignoreLoadCheckpointErr... | [
-0.12670545279979706,
-0.15267008543014526,
0.6760277152061462,
-0.6606647968292236,
0.4283464550971985,
1.4876779317855835,
-1.0257556438446045,
0.4160734713077545,
-0.6599035263061523,
-0.2109159529209137,
-0.5138364434242249,
0.055267397314310074,
-0.005430660676211119,
0.35903668403625... |
func (l *LightningLoader) Close() {
l.Pause()
l.closed.Store(true)
} | [
-0.1969282329082489,
-0.30610060691833496,
0.42062655091285706,
-0.5705761313438416,
-0.2114243358373642,
1.1640890836715698,
-0.14290781319141388,
-0.03630153462290764,
-0.3964746594429016,
-1.1015989780426025,
-0.5394960641860962,
-0.14757393300533295,
-1.235392451286316,
1.2452847957611... |
func (l *LightningLoader) Pause() {
l.Lock()
defer l.Unlock()
if l.isClosed() {
l.logger.Warn("try to pause, but already closed")
return
}
if l.cancel != nil {
l.cancel()
}
l.core.Stop()
} | [
0.15380072593688965,
-0.42419785261154175,
0.5825740098953247,
0.38703420758247375,
0.5026836395263672,
-0.21447083353996277,
-0.14398857951164246,
0.165986567735672,
0.25843289494514465,
-0.2724360227584839,
0.2535021901130676,
-0.5779703855514526,
-1.0755797624588013,
0.6805547475814819,... |
func (l *LightningLoader) Resume(ctx context.Context, pr chan pb.ProcessResult) {
if l.isClosed() {
l.logger.Warn("try to resume, but already closed")
return
}
l.core = lightning.New(l.lightningConfig)
// continue the processing
l.Process(ctx, pr)
} | [
0.5852557420730591,
-0.23296098411083221,
0.5015955567359924,
-0.8676750659942627,
0.14846105873584747,
0.5275112986564636,
-0.5616510510444641,
-0.6185731291770935,
0.3849000036716461,
-1.0080592632293701,
-0.5681560635566711,
0.5382611751556396,
-1.3849490880966187,
-0.41367214918136597,... |
func (l *LightningLoader) Update(cfg *config.SubTaskConfig) error {
// update l.cfg
l.cfg.BAList = cfg.BAList
l.cfg.RouteRules = cfg.RouteRules
l.cfg.ColumnMappingRules = cfg.ColumnMappingRules
return nil
} | [
0.12569798529148102,
-0.2010624259710312,
0.2847774028778076,
-0.1504567414522171,
-0.7408997416496277,
0.8483971953392029,
-0.31328022480010986,
1.238913655281067,
-0.37903743982315063,
0.13772399723529816,
-1.348548412322998,
0.2633785605430603,
0.05386846140027046,
0.9460147619247437,
... |
func (l *LightningLoader) Status(_ *binlog.SourceStatus) interface{} {
finished, total := l.core.Status()
progress := percent(finished, total, l.finish.Load())
s := &pb.LoadStatus{
FinishedBytes: finished,
TotalBytes: total,
Progress: progress,
MetaBinlog: l.metaBinlog.Load(),
MetaBinlogGTID... | [
-0.35370293259620667,
-0.6939027309417725,
0.2353464812040329,
-1.0971828699111938,
-0.6998001337051392,
0.26637551188468933,
-0.2696775197982788,
-0.2648923695087433,
0.3433879315853119,
-0.49357298016548157,
-1.1764031648635864,
0.30104511976242065,
-0.14330552518367767,
1.32849407196044... |
func (l *LightningLoader) checkpointID() string {
if len(l.cfg.SourceID) > 0 {
return l.cfg.SourceID
}
dir, err := filepath.Abs(l.cfg.Dir)
if err != nil {
l.logger.Warn("get abs dir", zap.String("directory", l.cfg.Dir), log.ShortError(err))
return l.cfg.Dir
}
return shortSha1(dir)
} | [
0.17237253487110138,
0.0845654308795929,
0.6570563316345215,
0.6486390829086304,
0.2359621822834015,
0.9257900714874268,
0.8547964096069336,
0.3141697645187378,
0.8455994129180908,
0.6910701990127563,
0.32033464312553406,
0.12540993094444275,
-0.1482401192188263,
0.885468602180481,
0.157... |
func (r *redisDB) IncKey() (int64, error) {
return r.incKey(KEY_NUMS)
} | [
-1.1552718877792358,
1.0894304513931274,
0.3470574617385864,
0.5281763076782227,
0.012018010020256042,
-0.2563038468360901,
0.7898848056793213,
0.5794549584388733,
-0.0767701044678688,
0.6081486940383911,
0.11873143911361694,
0.20719748735427856,
-0.7900018692016602,
0.5539803504943848,
... |
func type2name(i int) string {
if i == 0 {
return "Str"
}
return "Num"
} | [
-1.3207626342773438,
-0.9147619009017944,
0.7092052102088928,
0.025693954899907112,
-0.3451789319515228,
-0.03377150371670723,
0.5046688318252563,
-1.142914891242981,
-0.43710461258888245,
0.7468898296356201,
-0.27515894174575806,
0.047659676522016525,
0.530428409576416,
0.0259458199143409... |
func viperSetup() error {
viper.SetDefault("providers", []string{})
viper.SetDefault("webserver.debug", false)
viper.SetDefault("webserver.cors.origin", "https://127.0.0.1:3000")
viper.SetDefault("webserver.address", "0.0.0.0:8080")
viper.AddConfigPath("./")
viper.AddConfigPath("./config")
viper.AddConfigPath("... | [
-0.21011587977409363,
-0.6989036798477173,
0.7861526012420654,
0.18153049051761627,
0.46240612864494324,
0.43861982226371765,
0.48233678936958313,
0.16904738545417786,
-0.07611239701509476,
0.8383275866508484,
-0.9016635417938232,
0.08030615001916885,
0.20185650885105133,
0.024832358583807... |
func InitCommand(cfg *config.Config) *cli.Command {
return &cli.Command{
Name: "init",
Usage: "initialise an ocis config",
Flags: []cli.Flag{
&cli.StringFlag{
Name: "insecure",
EnvVars: []string{"OCIS_INSECURE"},
Value: "ask",
Usage: "Allow insecure oCIS config",
},
&cli.BoolFlag... | [
-0.3527851998806,
-0.4265168607234955,
0.7252362966537476,
0.16922591626644135,
0.13382892310619354,
0.4566664397716522,
-0.05004008859395981,
-0.39912793040275574,
-0.22839227318763733,
0.3872930407524109,
-0.014594975858926773,
0.83438640832901,
-0.8791404962539673,
0.3393014073371887,
... |
func InitializeCronEngine() *cron.Cron {
c := cron.New()
c.Start()
return c
} | [
1.1619997024536133,
-0.4947053790092468,
0.38736972212791443,
0.6042773127555847,
0.8990781903266907,
-0.6905920505523682,
-0.06710344552993774,
0.045159339904785156,
-1.0019762516021729,
-1.1233495473861694,
-1.0965518951416016,
0.6410164833068848,
-0.2358388900756836,
0.2520008087158203,... |
func RefreshRSSCron(c *cron.Cron, db *storm.DB, tclient *torrent.Client, torrentLocalStorage Storage.TorrentLocal, dataDir string) {
c.AddFunc("@hourly", func() {
torrentHashHistory := Storage.FetchHashHistory(db)
RSSFeedStore := Storage.FetchRSSFeeds(db)
singleRSSTorrent := Storage.SingleRSSTorrent{}
newFeedS... | [
0.9588192701339722,
-0.923559844493866,
0.7021700143814087,
-0.5177046656608582,
1.0867700576782227,
-0.28795886039733887,
-0.8917511105537415,
-0.43937817215919495,
0.10389888286590576,
0.25990229845046997,
-0.13871482014656067,
0.720896303653717,
-0.04912305623292923,
-0.0137572931125760... |
func LogCronStatus(c *cron.Cron) { //TODO add a cron to inspect cron jobs and log the outputs
} | [
0.7248849272727966,
-0.8659191131591797,
0.29294928908348083,
0.13987326622009277,
-0.0447792112827301,
-0.3227234482765198,
0.19000914692878723,
0.4389614462852478,
0.11961796879768372,
-0.5674289464950562,
-1.261083960533142,
0.21851108968257904,
0.46461302042007446,
0.5425038933753967,
... |
func (Dentist) Fields() []ent.Field {
return []ent.Field{
field.String("Dentist_name").NotEmpty(),
}
} | [
-0.3096691370010376,
-0.21855232119560242,
0.17713840305805206,
-0.8418745398521423,
1.011101484298706,
0.7550478577613831,
-1.25636625289917,
-0.3156070411205292,
0.9509508013725281,
-0.5163359045982361,
-0.8210263848304749,
-0.015469439327716827,
-0.43813565373420715,
-0.0436817407608032... |
func (Dentist) Edges() []ent.Edge {
return []ent.Edge{
edge.To("pillorders", Pillorder.Type).StorageKey(edge.Column("dentist_id")),
}
} | [
-1.1560243368148804,
-0.19683440029621124,
0.3967136740684509,
-0.04292944818735123,
1.2333515882492065,
-0.27536630630493164,
-1.8343327045440674,
-0.2526724934577942,
0.8601688742637634,
0.6657934188842773,
-0.010212335735559464,
0.3991428315639496,
0.05363178998231888,
0.067068092525005... |
func NewHittableList() HittableList {
return HittableList{}
} | [
0.0752549022436142,
-0.20481109619140625,
0.08492112904787064,
1.4769092798233032,
-0.8721012473106384,
-0.05848011374473572,
0.49098074436187744,
0.062256745994091034,
-0.9920895099639893,
0.17185020446777344,
-1.2190765142440796,
0.42030519247055054,
0.5429175496101379,
0.669113695621490... |
func (h *HittableList) Add(object Hittable) {
h.Objects = append(h.Objects, object)
} | [
-0.8234003782272339,
-0.268837571144104,
0.3294650614261627,
0.6314206719398499,
0.3219822347164154,
1.404624342918396,
0.31036219000816345,
0.2642991244792938,
-0.2710385322570801,
0.463964581489563,
-1.2216757535934448,
0.2920904755592346,
0.23543797433376312,
0.38121047616004944,
-0.5... |
func (h HittableList) Hit(ray Ray, tMin float64, tMax float64, rec *HitRecord) bool {
tempRec := HitRecord{}
hitAnything := false
closestSoFar := tMax
for _, object := range h.Objects {
if object.Hit(ray, tMin, closestSoFar, &tempRec) {
hitAnything = true
closestSoFar = tempRec.T
*rec = tempRec
}
}
... | [
-0.845934271812439,
0.039427388459444046,
0.5879069566726685,
0.19635692238807678,
-0.5907158255577087,
0.5368326306343079,
0.14265063405036926,
-0.07620961964130402,
-1.859594702720642,
0.5852896571159363,
-0.4632107615470886,
-0.5234255790710449,
-0.8021050095558167,
-0.3319757580757141,... |
func RandomScene() HittableList {
world := NewHittableList()
groundMaterial := NewLambertian(NewVec3(0.5, 0.5, 0.5))
world.Add(NewSphere(NewVec3(0, -1000, 0), 1000, groundMaterial))
for a := -11; a < 11; a++ {
for b := -11; b < 11; b++ {
chooseMat := rand.Float64()
center := NewVec3(float64(a)+0.9*rand.Fl... | [
0.04471607133746147,
-0.23054669797420502,
1.0271412134170532,
-0.17074038088321686,
-0.15828043222427368,
0.6812286972999573,
0.5742440223693848,
-0.5391504168510437,
0.22818559408187866,
0.8204088807106018,
-0.3068242073059082,
-0.09213508665561676,
-0.6252415180206299,
0.048010561615228... |
func (m Number0) Validate(formats strfmt.Registry) error {
return nil
} | [
0.4840153157711029,
-0.11813615262508392,
0.0333157517015934,
-0.08785491436719894,
0.6837491989135742,
0.16608451306819916,
0.6793465614318848,
0.863256573677063,
0.0010502649238333106,
-1.204307198524475,
-0.40817975997924805,
-0.10354851931333542,
-0.46245062351226807,
1.95926034450531,... |
func (m Number0) ContextValidate(ctx context.Context, formats strfmt.Registry) error {
return nil
} | [
0.7265869379043579,
-0.2439926117658615,
0.056185878813266754,
-0.2940927743911743,
-0.03671934828162193,
0.6048529744148254,
0.11193584650754929,
0.7135921120643616,
1.0165659189224243,
-0.5538691878318787,
-0.22269950807094574,
0.4738466143608093,
-0.5948084592819214,
1.029879093170166,
... |
func CheckPlaces(date string, route uint, interval uint, cityFrom uint, cityTo uint, timeFrom uint, timeTo uint) error {
client := http.Client{
Timeout: time.Second * 5,
}
url := fmt.Sprintf(urlFormat, route, date, cityFrom, cityTo)
req, err := http.NewRequest(http.MethodGet, url, nil)
if err != nil {
return ... | [
0.023435059934854507,
-0.14117111265659332,
1.2399253845214844,
-0.33774760365486145,
0.23118142783641815,
0.5999314785003662,
0.28417345881462097,
-0.22502470016479492,
-0.12415074557065964,
0.23223546147346497,
0.17597240209579468,
0.5500873923301697,
-0.4434717893600464,
0.7943614721298... |
func multiply(num1 string, num2 string) string {
if num1 == "0" || num2 == "0" {
return "0"
}
res := make([]int, len(num1)+len(num2))
for i := len(num2) - 1; i >= 0; i-- {
n2 := int(num2[i] - '0')
for j := len(num1) - 1; j >= 0; j-- {
n1 := int(num1[j] - '0')
sum := n1*n2 + res[i+j+1]
res[i+j+1] = su... | [
-0.7018715143203735,
-0.10950857400894165,
1.0038424730300903,
0.18326707184314728,
-0.11788810789585114,
-0.11688874661922455,
-0.2544418275356293,
-0.16757014393806458,
-0.02324102818965912,
0.40449342131614685,
0.5552150011062622,
-0.11049061268568039,
-0.6486808061599731,
0.10612712800... |
func multiply3(num1 string, num2 string) string {
if num1 == "0" || num2 == "0" {
return "0"
}
m, n := len(num1), len(num2)
ansArr := make([]int, m + n)
for i := m - 1; i >= 0; i-- {
x := int(num1[i]) - '0'
for j := n - 1; j >= 0; j-- {
y := int(num2[j] - '0')
ansArr[i + j + 1] += x * y
}
}
for i :... | [
-0.50105881690979,
-0.004583075642585754,
0.6886597871780396,
0.08261576294898987,
-0.6543771624565125,
-0.022180894389748573,
-0.44798406958580017,
-0.2524821162223816,
0.15871630609035492,
0.7003378868103027,
0.2950693666934967,
0.2921871244907379,
-0.6087357997894287,
-0.095066890120506... |
func testKeyPublic() string {
return `-----BEGIN PGP PUBLIC KEY BLOCK-----
mQENBFowLigBCAC++pVrVRRM86Wo8V7XJsOmU2xtBBY5a8ktB1tdpEhzlPWQHObx
LINj79HE3lRlIFQmxnKcX3I15bzT3yo3XWLyVUsCDA1Mg9JoU2zJ+u3XftdNBg8J
eRlTiEwZYflxEYZFSyh3TZI2VZxxlINp/jOGG0dpAdKF3sfKxdTRb30lgDr+wIzv
oncrjX023UQDHoRZ3f+zPpnkubjhwH8jUHLiGsyKvu0XDB0c... | [
0.45013201236724854,
-0.05031312257051468,
0.9614830613136292,
-0.3951673209667206,
-0.6918678879737854,
0.37281978130340576,
-0.17119517922401428,
-1.4368813037872314,
-0.8114916682243347,
-0.1070784255862236,
-0.3907605707645416,
-0.06320679187774658,
-0.36768245697021484,
0.003944164142... |
func tt(t *testing.T, f func()) {
defer func() {
if x := recover(); x != nil {
_, file, line, _ := runtime.Caller(4)
t.Errorf("Error at %s:%d: %v", filepath.Base(file), line, x)
}
}()
f()
} | [
0.5330966711044312,
-0.1887654811143875,
0.6098622679710388,
-0.726866602897644,
0.7280349135398865,
0.3939547836780548,
-0.2554696500301361,
-0.13037928938865662,
-0.03635565564036369,
-0.2643088102340698,
-0.1364106833934784,
-0.537682294845581,
0.6675037145614624,
-0.4716559052467346,
... |
func romanToInt(s string) int {
m := make(map[string]int)
m["I"] = 1
m["V"] = 5
m["IV"] = 4
m["X"] = 10
m["IX"] = 9
m["L"] = 50
m["XL"] = 40
m["C"] = 100
m["XC"] = 90
m["D"] = 500
m["CD"] = 400
m["M"] = 1000
m["CM"] = 900
sum := 0
// I 可以放在 V (5) 和 X (10) 的左边,来表示 4 和 9。
//X 可以放在 L (50) 和 C (100) 的左边... | [
-0.11953959614038467,
-0.7557656764984131,
0.7325943112373352,
-1.3051148653030396,
-0.6251081228256226,
-0.3466331362724304,
0.751704752445221,
-0.816766083240509,
-0.18642327189445496,
0.41895943880081177,
-1.4939897060394287,
0.3217789828777313,
-1.1026471853256226,
-0.9360649585723877,... |
func (a *App) Initialize(databaseURL string) {
// commenting out for Heroku Postgres service
// connectionString :=
// fmt.Sprintf("user=%s password=%s dbname=%s sslmode=disable", user, password, dbname)
var err error
a.DB, err = sql.Open("postgres", databaseURL)
if err != nil {
log.Fatalf("Could not connect ... | [
-0.6299017667770386,
0.5946311950683594,
0.6440770626068115,
1.059244155883789,
0.7802978157997131,
-0.225335031747818,
-0.16152390837669373,
0.9860842823982239,
-0.2987814247608185,
0.4006994664669037,
-0.2470739483833313,
0.3539784848690033,
-0.3548318147659302,
0.9483826160430908,
0.2... |
func (a *App) Run(addr string) {
log.Fatal(http.ListenAndServe(addr, a.Router))
} | [
0.22816619277000427,
-1.0115411281585693,
0.47360408306121826,
-0.18918678164482117,
-0.31494054198265076,
0.6985362768173218,
0.05938166379928589,
0.2819250822067261,
0.6418617367744446,
0.16555330157279968,
-0.05514165386557579,
0.5845003724098206,
0.5010939240455627,
0.6382535696029663,... |
func Exists(filename string,isDirectory bool) bool {
info, err := os.Stat(filename)
if os.IsNotExist(err) {
return false
}
if isDirectory{
return info.IsDir()
}
return !info.IsDir()
} | [
-1.4641813039779663,
-0.46107932925224304,
0.19715909659862518,
0.19792211055755615,
0.9190646409988403,
0.6517499089241028,
-0.29958295822143555,
0.9007093906402588,
0.008859686553478241,
-0.5303788781166077,
0.7985626459121704,
0.07831848412752151,
0.11461234092712402,
0.8686262369155884... |
func CreateDir(path string) error {
err := os.MkdirAll(path, os.ModePerm)
if err != nil {
logrus.Warn(fmt.Sprintf("error in create new directory: %s",err))
}
return err
} | [
0.35812070965766907,
-0.06443316489458084,
0.8186578750610352,
0.27056488394737244,
-0.4152688980102539,
1.4445092678070068,
0.6574681997299194,
-0.5758022665977478,
-0.33910125494003296,
-0.30074623227119446,
0.3250579535961151,
0.3839022219181061,
0.24524860084056854,
0.2395581156015396,... |
func OpenDatabase(path string) (*Database, error) {
// use goose to auto-create the DB
dbDriver := goose.DBDriver{"sqlite3",
path,
"github.com/mattn/go-sqlite3",
&goose.Sqlite3Dialect{},
}
dbConf := goose.DBConf{MigrationsDir: migrationsDir,
Env: "prod",
Driver: dbDriver,
}
target, err := goose.Get... | [
-0.9639046788215637,
0.6398386359214783,
0.791601300239563,
0.017429331317543983,
-0.2577567994594574,
0.51113361120224,
0.4166416525840759,
0.3483906388282776,
1.0675686597824097,
0.004508324898779392,
-0.25390300154685974,
0.2700035870075226,
-0.5207421779632568,
0.18575981259346008,
0... |
func (database *Database) Backup(reason string) error {
err := os.MkdirAll(backupsDir, 0755)
if err != nil {
return err
}
name := "testing"
filename := fmt.Sprintf("%s/%s_%s_%s.db",
backupsDir, strings.Replace(name, " ", "_", -1),
time.Now().Format("20060102150405"), reason)
src, err := os.Open(database.... | [
0.187137633562088,
0.33638620376586914,
0.929606020450592,
-0.377807080745697,
0.1498330533504486,
0.6252667307853699,
1.054101586341858,
-0.2941263020038605,
0.39912256598472595,
0.29759684205055237,
0.18511924147605896,
-0.05990714952349663,
-0.2623901665210724,
-0.5654217600822449,
0.... |
func (database *Database) mapTables() {
dialect := new(modl.SqliteDialect)
database.objectMap = modl.NewDbMap(database.db, dialect)
database.objectMap.AddTableWithName(Object{},
"object").SetKeys(true, "ID")
database.userMap = modl.NewDbMap(database.db, dialect)
database.userMap.AddTableWithName(User{},
"use... | [
-0.5019210577011108,
0.03209114819765091,
0.7474855184555054,
0.05831361934542656,
-0.40531352162361145,
1.2538013458251953,
0.19668683409690857,
-0.12432807683944702,
0.9046643376350403,
-0.3912534713745117,
-0.8480202555656433,
-0.8865688443183899,
0.28645798563957214,
0.1588519215583801... |
func (Role) EnumDescriptor() ([]byte, []int) {
return file_go_chromium_org_luci_cipd_api_cipd_v1_repo_proto_rawDescGZIP(), []int{0}
} | [
-0.7071115970611572,
0.0534149594604969,
0.38353124260902405,
-0.9870179295539856,
0.7641575932502747,
-0.3903283178806305,
0.20860294997692108,
0.7723544239997864,
0.4092331826686859,
0.32470035552978516,
0.2748781740665436,
-0.0521121509373188,
-0.9277368187904358,
1.0912525653839111,
... |
func (RegistrationStatus) EnumDescriptor() ([]byte, []int) {
return file_go_chromium_org_luci_cipd_api_cipd_v1_repo_proto_rawDescGZIP(), []int{1}
} | [
-0.7311777472496033,
0.3654225468635559,
0.03546135127544403,
-0.36759239435195923,
0.39843836426734924,
-0.16748294234275818,
0.049786828458309174,
0.9988045692443848,
0.2600038945674896,
0.5586188435554504,
-0.7097986340522766,
-0.14525316655635834,
0.023880260065197945,
1.35823667049407... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.