text stringlengths 11 6.3k | embedding listlengths 768 768 |
|---|---|
func (p *ResourcePool) New(ctx context.Context, meta AllocMeta) (Alloc, error) {
if meta.Want.Equal(nil) {
return nil, errors.E("ResourcePool.New", errors.Precondition, fmt.Errorf("illegal request for an empty resources: %s", meta.Want))
}
p.mu.Lock()
defer p.mu.Unlock()
if p.stopped {
return nil, errors.Error... | [
-0.2831680178642273,
-0.5276268124580383,
0.8494871854782104,
-0.27606233954429626,
-0.6838067173957825,
-0.06932723522186279,
-0.11173511296510696,
-1.2883083820343018,
0.20633479952812195,
0.878037691116333,
0.8031558990478516,
0.39241525530815125,
0.19752508401870728,
0.0862053483724594... |
func (p *ResourcePool) Free(a Alloc) error {
p.mu.Lock()
defer p.mu.Unlock()
return p.doFree(a)
} | [
-0.3128693997859955,
0.4231255054473877,
0.22839656472206116,
-0.4450715482234955,
-0.6888630986213684,
0.1736942082643509,
0.7456516027450562,
-0.9745169281959534,
0.5489035844802856,
0.07848045229911804,
0.3982415497303009,
0.20450638234615326,
-0.6466418504714966,
-0.03768477216362953,
... |
func (p *ResourcePool) doFree(a Alloc) error {
id := a.ID()
if p.allocs[id] != a {
return nil
}
delete(p.allocs, id)
return p.manager.Kill(a)
} | [
0.22350449860095978,
-0.4743277132511139,
0.5324117541313171,
0.12534309923648834,
0.33173322677612305,
-0.14196301996707916,
0.15767958760261536,
-1.3326021432876587,
1.0563114881515503,
1.1580336093902588,
0.4505186080932617,
0.49342820048332214,
0.05612483248114586,
0.2880103886127472,
... |
func (p *ResourcePool) Alive(a Alloc) bool {
p.mu.Lock()
defer p.mu.Unlock()
return p.allocs[a.ID()] == a
} | [
0.03983713686466217,
-1.2274887561798096,
0.5311700105667114,
-0.5307864546775818,
-0.3575576841831207,
0.6364248991012573,
-0.24684585630893707,
-0.763018012046814,
0.6270291805267334,
1.1846463680267334,
0.3202754855155945,
-0.6722906231880188,
-0.5353979468345642,
-0.8942060470581055,
... |
func (p *ResourcePool) ID() string {
return fmt.Sprintf("resourcepool(%s)", p.manager.Name())
} | [
0.34856024384498596,
-1.0837724208831787,
0.21953512728214264,
-0.45108023285865784,
-0.0271226167678833,
1.8335908651351929,
-0.1373201310634613,
-0.46499502658843994,
1.1102412939071655,
-0.2068454921245575,
0.12496928125619888,
0.24978230893611908,
-0.2647956609725952,
0.509613335132598... |
func (p *ResourcePool) Offer(ctx context.Context, id string) (Offer, error) {
offers, err := p.Offers(ctx)
if err != nil {
return nil, err
}
if len(offers) == 0 {
return nil, errors.E("offer", id, errors.NotExist, errOfferExpired)
}
if id != offerID {
return nil, errors.E("offer", id, errors.NotExist, errOf... | [
-0.7256482243537903,
-0.4800155460834503,
0.3982597589492798,
-0.14862069487571716,
-0.6033762693405151,
0.39461278915405273,
-0.4111335277557373,
-0.393964022397995,
0.7576991319656372,
0.5567376017570496,
1.0878288745880127,
0.6767550110816956,
-0.6985255479812622,
0.13729460537433624,
... |
func (p *ResourcePool) Offers(ctx context.Context) ([]Offer, error) {
p.mu.Lock()
defer p.mu.Unlock()
if p.stopped {
return nil, nil
}
var reserved reflow.Resources
for _, alloc := range p.allocs {
if !AllocExpired(alloc) {
reserved.Add(reserved, alloc.Resources())
}
}
var available reflow.Resources
a... | [
-0.6444711685180664,
-0.2961937487125397,
0.4136069118976593,
0.03432958200573921,
-0.5218560099601746,
0.5541024208068848,
-0.6948813199996948,
-0.26845893263816833,
0.496864914894104,
0.4625042676925659,
1.182246446609497,
0.3278394341468811,
-0.7492355704307556,
0.33183950185775757,
-... |
func (p *ResourcePool) Alloc(ctx context.Context, id string) (Alloc, error) {
p.mu.Lock()
defer p.mu.Unlock()
if alloc, ok := p.allocs[id]; ok {
return alloc, nil
}
return nil, errors.E("alloc", id, errors.NotExist)
} | [
-0.18631723523139954,
0.13714613020420074,
0.4463751018047333,
-0.6841781735420227,
-0.44981649518013,
0.15077655017375946,
0.21782706677913666,
-1.0640407800674438,
1.2267076969146729,
0.631062924861908,
1.162007451057434,
0.4699833393096924,
-0.03796475753188133,
-0.8612299561500549,
0... |
func (p *ResourcePool) Allocs(ctx context.Context) ([]Alloc, error) {
p.mu.Lock()
defer p.mu.Unlock()
allocs := make([]Alloc, len(p.allocs))
i := 0
for _, a := range p.allocs {
allocs[i] = a
i++
}
return allocs, nil
} | [
-0.6852377653121948,
-0.09137294441461563,
0.6334204077720642,
0.12194463610649109,
-0.11157862097024918,
0.404267281293869,
0.16938868165016174,
-0.9913280606269836,
1.258360743522644,
0.3204962909221649,
0.8866382241249084,
0.3736269176006317,
-0.4175609052181244,
-0.38763293623924255,
... |
func (p *ResourcePool) StopIfIdleFor(d time.Duration) (bool, time.Duration) {
p.mu.Lock()
defer p.mu.Unlock()
var (
idle = true
maxTimeToExpiry time.Duration
)
for _, alloc := range p.allocs {
expiredBy := AllocExpiredBy(alloc)
if expiredBy < d {
idle = false
}
// if alloc isn't expired, ... | [
-1.0177085399627686,
0.10699120163917542,
0.6503535509109497,
-1.1625761985778809,
0.09531459212303162,
0.25752049684524536,
-0.2971620261669159,
-0.337251216173172,
-0.32980412244796753,
0.6125096082687378,
-0.10714884102344513,
-0.6991801857948303,
0.15476472675800323,
0.1118587553501129... |
func newID() string {
var b [8]byte
_, err := rand.Read(b[:])
if err != nil {
panic(err)
}
return fmt.Sprintf("%x", b[:])
} | [
0.8197567462921143,
-0.5996890664100647,
0.47922781109809875,
-0.22097770869731903,
-0.4170175790786743,
1.2993428707122803,
-0.9161434769630432,
-0.4655977785587311,
1.0332961082458496,
0.7228821516036987,
0.37355977296829224,
0.19231414794921875,
-0.8388960957527161,
-0.9590211510658264,... |
func (o *Oauthclientrequest) SetField(field string, fieldValue interface{}) {
// Get Value object for field
target := reflect.ValueOf(o)
targetField := reflect.Indirect(target).FieldByName(field)
// Set value
if fieldValue != nil {
targetField.Set(reflect.ValueOf(fieldValue))
} else {
// Must create a new Va... | [
-1.3034641742706299,
0.11624634265899658,
0.6167418956756592,
-1.1458451747894287,
-0.0001746054331306368,
0.3487236797809601,
0.10458409041166306,
-0.46618035435676575,
0.1545042097568512,
0.23348042368888855,
-0.5986398458480835,
1.2387337684631348,
0.36285871267318726,
0.296750485897064... |
func (o *Oauthclientrequest) String() string {
j, _ := json.Marshal(o)
str, _ := strconv.Unquote(strings.Replace(strconv.Quote(string(j)), `\\u`, `\u`, -1))
return str
} | [
-0.6614856719970703,
-1.0327666997909546,
0.15653330087661743,
-1.357635498046875,
-0.8314614295959473,
-0.104334257543087,
0.03631039708852768,
-1.3439799547195435,
-0.11382459849119186,
0.2520485520362854,
0.3334324061870575,
1.141005516052246,
0.21386907994747162,
-0.7550386190414429,
... |
func getContext(c *gin.Context) context.Context {
return appengine.NewContext(c.Request)
} | [
0.5142660140991211,
0.18532074987888336,
0.35319721698760986,
0.6013997793197632,
0.45801424980163574,
0.33452481031417847,
-0.8119893074035645,
-0.5908072590827942,
0.6093318462371826,
-0.8745722770690918,
0.4077836871147156,
0.25310540199279785,
0.009862256236374378,
0.2592431902885437,
... |
func NewSMSService(provider SMSProvider) *SMSService {
service := &SMSService{SMSProvider: provider}
return service
} | [
-0.23416469991207123,
0.45982617139816284,
-0.2289697676897049,
0.18856607377529144,
-0.3944592773914337,
-0.208367720246315,
-1.302388310432434,
-0.4555988013744354,
0.7693783044815063,
0.25372612476348877,
-0.9416665434837341,
1.0471556186676025,
-0.5943772792816162,
0.9896778464317322,
... |
func (n *NodeSorter) Sort() []*apiv1.Node {
if len(n.processors) == 0 {
return n.nodes
}
sort.Sort(n)
return n.nodes
} | [
-1.3821958303451538,
0.8756672739982605,
0.430335134267807,
-0.25647711753845215,
0.43448638916015625,
0.04240284487605095,
-0.2542547583580017,
-0.6954018473625183,
-0.35352835059165955,
-0.4389877915382385,
0.7691200971603394,
1.3409430980682373,
-1.136222243309021,
0.906987190246582,
... |
func (n *NodeSorter) Less(i, j int) bool {
node1, node2 := n.nodes[i], n.nodes[j]
for _, processor := range n.processors {
if val := processor.ScaleDownEarlierThan(node1, node2); val || processor.ScaleDownEarlierThan(node2, node1) {
return val
}
}
return false
} | [
-0.33240121603012085,
0.6550654768943787,
0.4012179672718048,
-1.1470593214035034,
-0.9404439330101013,
-0.010675361379981041,
0.00848586205393076,
-1.7960532903671265,
-1.2526942491531372,
-0.5110523104667664,
-0.17205022275447845,
0.2046109437942505,
-1.0840225219726562,
0.35534098744392... |
func (n *NodeSorter) Swap(i, j int) {
n.nodes[i], n.nodes[j] = n.nodes[j], n.nodes[i]
} | [
-1.8311160802841187,
0.30179107189178467,
0.11949075013399124,
-0.7224148511886597,
0.08597634732723236,
0.39860543608665466,
0.13299719989299774,
-0.4499564468860626,
-1.179482340812683,
-0.09325012564659119,
-0.3483079671859741,
1.1179450750350952,
-0.25784292817115784,
-0.26676857471466... |
func (n *NodeSorter) Len() int {
return len(n.nodes)
} | [
-0.46896761655807495,
0.7644719481468201,
-0.15633518993854523,
-1.1285812854766846,
0.3814907968044281,
-0.24992632865905762,
0.826047420501709,
-0.036447055637836456,
-0.7565118670463562,
-0.5597780346870422,
-0.7245731353759766,
0.8500444293022156,
0.09210843592882156,
0.239264190196990... |
func DecodeVarint(input []byte) ([]uint32, error) {
decoded := []uint32{}
var nextVal uint32 = 0
cont := true
for _, b := range input {
nextVal = nextVal<<7 + uint32(b&0x7F)
if b>>7 == 1 {
cont = true
} else {
decoded = append(decoded, nextVal)
nextVal = 0
cont = false
}
}
if cont {
retur... | [
-0.42745232582092285,
-0.6677992343902588,
0.6466764211654663,
-0.11687740683555603,
-0.5585732460021973,
0.7057321667671204,
0.09582886099815369,
-0.39102041721343994,
0.6740144491195679,
-0.1841769814491272,
-0.285185843706131,
-0.389302521944046,
-0.6625353097915649,
1.3748358488082886,... |
func EncodeVarint(input []uint32) []byte {
encoded := []byte{}
for _, val := range input {
chunk := val & 0x7F
encodedVal := []byte{byte(0x00 | chunk)}
for val = val >> 7; val > 0; val = val >> 7 {
chunk := val & 0x7F
encodedVal = append([]byte{byte(0x80 | chunk)}, encodedVal...)
}
encoded = append... | [
0.36345186829566956,
0.14177052676677704,
0.36611852049827576,
-0.04647205397486687,
-0.35934117436408997,
0.5233008861541748,
-0.48516157269477844,
-1.2599400281906128,
0.519548237323761,
0.35011279582977295,
-0.22793063521385193,
0.2653229832649231,
-0.6118823885917664,
1.279165983200073... |
func ReadConfigFromFile(configFileName string) error {
return readConfigFromFile(configFileName, &config)
} | [
-0.012724572792649269,
-0.19886557757854462,
0.25605592131614685,
0.8034475445747375,
-0.7643244862556458,
0.6777105927467346,
0.14023499190807343,
0.5714820027351379,
-2.0337607860565186,
0.6386201977729797,
-0.44104766845703125,
-0.6045469045639038,
-0.4232662320137024,
0.821357727050781... |
func Decrypt(key, ciphertext []byte) ([]byte, error) {
block, err := aes.NewCipher(key)
if err != nil {
return nil, err
}
if len(ciphertext)%aes.BlockSize != 0 {
return nil, errors.New("not multiple of AES blocksize")
}
iv := ciphertext[:aes.BlockSize]
mode := cipher.NewCBCDecrypter(block, iv)
mode.CryptB... | [
0.4051074683666229,
1.239922046661377,
0.7120738625526428,
0.1187404915690422,
-0.7844732999801636,
-0.009508422575891018,
-0.04858054965734482,
-0.5999422073364258,
0.626429557800293,
0.5536194443702698,
-0.29363974928855896,
-0.014190545305609703,
-0.702713668346405,
-0.04337119311094284... |
func Encrypt(key, iv, plaintext []byte) ([]byte, error) {
block, err := aes.NewCipher(key)
if err != nil {
return nil, err
}
pad := aes.BlockSize - len(plaintext)%aes.BlockSize
plaintext = append(plaintext, bytes.Repeat([]byte{byte(pad)}, pad)...)
ciphertext := make([]byte, len(plaintext))
mode := cipher.NewCB... | [
0.11012489348649979,
1.29887855052948,
0.6387616395950317,
0.2870384454727173,
0.052232883870601654,
-0.04028820991516113,
-0.4311344623565674,
-0.5625450611114502,
0.4195193350315094,
0.7425594925880432,
-0.8333732485771179,
-0.04892628267407417,
-1.0206334590911865,
0.09046198427677155,
... |
func ValidTruncMAC(msg, expectedMAC, key []byte) bool {
actualMAC := ComputeTruncatedMAC(msg, key, len(expectedMAC))
return hmac.Equal(actualMAC, expectedMAC)
} | [
0.41014304757118225,
-0.1021418496966362,
0.4255220592021942,
-0.7944494485855103,
0.10917315632104874,
-0.20407326519489288,
0.9048627018928528,
0.4180668592453003,
-0.49041470885276794,
0.5675632953643799,
-0.46832358837127686,
0.5933140516281128,
-1.166039228439331,
-0.08607117086648941... |
func ComputeTruncatedMAC(msg, key []byte, size int) []byte {
m := hmac.New(sha256.New, key)
m.Write(msg)
return m.Sum(nil)[:size]
} | [
0.4838564097881317,
0.3079545497894287,
0.4972171485424042,
-0.6114335060119629,
0.2803489863872528,
-0.7880759239196777,
0.7574245929718018,
0.27881506085395813,
-0.13412651419639587,
0.7982790470123291,
-0.6237520575523376,
0.3150081932544708,
-1.1827881336212158,
0.4069143831729889,
-... |
func NewRepository(ctx *pulumi.Context,
name string, args *RepositoryArgs, opts ...pulumi.ResourceOption) (*Repository, error) {
if args == nil {
args = &RepositoryArgs{}
}
var resource Repository
err := ctx.RegisterResource("google-native:artifactregistry/v1beta2:Repository", name, args, &resource, opts...)
i... | [
-0.43584728240966797,
0.05012659728527069,
0.18091338872909546,
-0.09176260232925415,
0.665311872959137,
-0.3443763256072998,
0.49366119503974915,
0.14307847619056702,
0.12131761759519577,
0.24994391202926636,
-0.5057224035263062,
0.2597046196460724,
0.5113382935523987,
-0.0147034069523215... |
func GetRepository(ctx *pulumi.Context,
name string, id pulumi.IDInput, state *RepositoryState, opts ...pulumi.ResourceOption) (*Repository, error) {
var resource Repository
err := ctx.ReadResource("google-native:artifactregistry/v1beta2:Repository", name, id, state, &resource, opts...)
if err != nil {
return nil... | [
0.07745224237442017,
-0.2709941267967224,
0.1188102662563324,
-0.17768225073814392,
0.7293870449066162,
-0.6543548107147217,
0.29843056201934814,
-0.025960491970181465,
0.957447350025177,
-0.29760226607322693,
0.09504929929971695,
0.9419544339179993,
0.545311450958252,
-1.0967692136764526,... |
func (c *Config) Set(text string) error {
var tmp Config
if _, err := toml.Decode(text, &tmp); err != nil {
return err
}
*c = tmp
return nil
} | [
0.0077814580872654915,
0.12238786369562149,
0.15460838377475739,
-0.728371798992157,
-0.8220610022544861,
-0.11527565866708755,
-0.6342028975486755,
0.442452073097229,
-0.7072607278823853,
0.6584669947624207,
-1.3585104942321777,
0.1801208257675171,
-0.7144338488578796,
0.18553262948989868... |
func Teardown() {
fmt.Println("====== Clean kubernetes testing pod ======")
res, err := kubeclient.ExecKubectl("kubectl delete pod -l app=nsenter")
fmt.Println(res)
if err != nil {
fmt.Println("Error: " + err.Error())
}
} | [
1.0125770568847656,
-0.27748793363571167,
0.463468998670578,
0.08357584476470947,
0.25790491700172424,
1.320162057876587,
0.9224320650100708,
-0.1772385835647583,
0.7994039058685303,
0.834584653377533,
0.7468096017837524,
0.38591113686561584,
-0.9651795029640198,
-0.2804886996746063,
0.5... |
func FlatDisplay(w io.Writer) metrics.Processors {
return FlatDisplayWith(w, "Message:", nil)
} | [
1.0834295749664307,
-0.10270995646715164,
0.21343740820884705,
-0.7088794708251953,
-0.24587242305278778,
0.46881142258644104,
0.9328374862670898,
-1.7337461709976196,
0.2664887607097626,
-0.4749278724193573,
1.3998563289642334,
0.812167763710022,
-0.4776405096054077,
0.9928702712059021,
... |
func FlatDisplayWith(w io.Writer, header string, filterFn func(metrics.Entry) bool) metrics.Processors {
return NewEmitter(w, func(en metrics.Entry) []byte {
if filterFn != nil && !filterFn(en) {
return nil
}
var bu bytes.Buffer
bu.WriteString("\n")
if header != "" {
fmt.Fprintf(&bu, "%s %+s", green.... | [
0.6086438298225403,
-0.6363283395767212,
1.0816466808319092,
-0.9957271218299866,
-0.6293842792510986,
-0.05513722822070122,
-0.5263884663581848,
-0.8200094103813171,
-0.5673273801803589,
-0.12842099368572235,
0.4971970021724701,
0.8465990424156189,
0.36602169275283813,
0.34468933939933777... |
func BlockDisplay(w io.Writer) metrics.Processors {
return BlockDisplayWith(w, "Message:", nil)
} | [
1.7512022256851196,
0.37836340069770813,
0.4158168137073517,
-0.24638338387012482,
-0.5977737307548523,
0.2633775770664215,
0.878197431564331,
-1.9972201585769653,
-0.47449564933776855,
0.24023550748825073,
1.1543313264846802,
0.6875481009483337,
-0.1959751397371292,
0.6382080316543579,
... |
func BlockDisplayWith(w io.Writer, header string, filterFn func(metrics.Entry) bool) metrics.Processors {
return NewEmitter(w, func(en metrics.Entry) []byte {
if filterFn != nil && !filterFn(en) {
return nil
}
var bu bytes.Buffer
if header != "" {
fmt.Fprintf(&bu, "%s %+s\n", green.Sprint(header), print... | [
0.6199039816856384,
-0.408661812543869,
1.1931252479553223,
-0.5795220732688904,
-0.8498708009719849,
-0.35377874970436096,
-0.4318903684616089,
-1.013852596282959,
-0.8317872881889343,
0.23091627657413483,
0.15202482044696808,
0.8206101059913635,
0.30224624276161194,
0.280252069234848,
... |
func StackDisplay(w io.Writer) metrics.Processors {
return StackDisplayWith(w, "Message:", "-", nil)
} | [
2.274198055267334,
0.4992848038673401,
0.40665096044540405,
-0.8083884716033936,
-0.3540351390838623,
-0.33890560269355774,
0.8898948431015015,
-1.5879815816879272,
-0.6181739568710327,
0.32020363211631775,
0.989003598690033,
1.0057936906814575,
0.15083730220794678,
0.9612351655960083,
-... |
func StackDisplayWith(w io.Writer, header string, tag string, filterFn func(metrics.Entry) bool) metrics.Processors {
return NewEmitter(w, func(en metrics.Entry) []byte {
if filterFn != nil && !filterFn(en) {
return nil
}
var bu bytes.Buffer
if header != "" {
fmt.Fprintf(&bu, "%s %+s\n", green.Sprint(he... | [
0.9946168661117554,
-0.259329229593277,
0.9894049763679504,
-0.753253698348999,
-0.7173250317573547,
-0.6452974081039429,
-0.36983901262283325,
-0.8777299523353577,
-1.0057538747787476,
0.236503466963768,
0.24877378344535828,
0.718029260635376,
0.38634300231933594,
0.4437997341156006,
0.... |
func NewEmitter(w io.Writer, transform func(metrics.Entry) []byte) *Emitter {
return &Emitter{
Sink: w,
Transform: transform,
}
} | [
-0.12627121806144714,
-0.42189133167266846,
0.07629679143428802,
0.2396700382232666,
-0.558411717414856,
0.3959437608718872,
-0.0921456590294838,
0.2529424726963043,
-0.32003119587898254,
-0.6591687798500061,
0.07669323682785034,
0.5450507998466492,
-0.013090377673506737,
0.424298703670501... |
func (ce *Emitter) Handle(e metrics.Entry) error {
_, err := ce.Sink.Write(ce.Transform(e))
return err
} | [
-0.2535184323787689,
0.8736201524734497,
0.39335983991622925,
-0.15665419399738312,
1.2270420789718628,
0.18605221807956696,
1.2182358503341675,
0.1754869818687439,
-0.11817989498376846,
-0.2877338230609894,
0.24224889278411865,
0.05393383279442787,
-0.016649330034852028,
0.829923272132873... |
func makePingRequest(id, seq, pktlen int, filler []byte) []byte {
p := make([]byte, pktlen)
copy(p[8:], bytes.Repeat(filler, (pktlen-8)/len(filler)+1))
p[0] = ICMP_ECHO_REQUEST // type
p[1] = 0 // code
p[2] = 0 // cksum
p[3] = 0 // cksum
p[4] = uint8(id >> 8) /... | [
-0.47576001286506653,
0.05169028416275978,
0.915867030620575,
-0.5408776998519897,
-0.7816148400306702,
0.3413877487182617,
-0.6773208975791931,
-0.3745333254337311,
0.9020135998725891,
0.4342305064201355,
-0.40979301929473877,
-0.3538074493408203,
-0.6797910332679749,
-0.16714149713516235... |
func TestICMP(t *testing.T) {
if os.Getuid() != 0 {
t.Logf("test disabled; must be root")
return
}
var (
laddr *IPAddr
err os.Error
)
if *srchost != "" {
laddr, err = ResolveIPAddr("ip4", *srchost)
if err != nil {
t.Fatalf(`net.ResolveIPAddr("ip4", %v") = %v, %v`, *srchost, laddr, err)
}
}
r... | [
-0.19397003948688507,
0.22151882946491241,
0.8437362909317017,
-0.26599541306495667,
0.7915585041046143,
0.09750838577747345,
0.6078891158103943,
-0.2795754373073578,
0.5191118121147156,
-0.4237624406814575,
-0.3622622489929199,
-0.21613852679729462,
-0.5870813727378845,
-0.811456561088562... |
func (cp *ConfirmPrompt) Run() (string, error) {
switch cp.Default {
case "Y", "N", "n", "y":
case "":
cp.Default = "N"
default:
return "", ErrorIncorrect
}
err := cp.Init()
if err != nil {
return "", err
}
cp.confirmDefault = strings.ToUpper(cp.Default)
cp.c.Stdin = ioutil.NopCloser(io.MultiReader(by... | [
0.00856777559965849,
-0.7907222509384155,
0.9634206891059875,
0.8423721194267273,
-0.32856154441833496,
0.30447807908058167,
0.9153592586517334,
-0.15915925800800323,
-0.40629225969314575,
0.3780703842639923,
-0.20821857452392578,
0.05602027103304863,
-0.49219903349876404,
0.02672322466969... |
func Confirm(label, answer string, noIcons bool) (string, error) {
cp := ConfirmPrompt{
BasicPrompt: BasicPrompt{
Label: label,
Default: answer,
NoIcons: noIcons,
},
}
return cp.Run()
} | [
0.30056390166282654,
0.13523626327514648,
0.4231177866458893,
0.8317567110061646,
-0.8239402174949646,
0.29274672269821167,
-0.11294814944267273,
-0.885491132736206,
0.06759867072105408,
0.19365555047988892,
-0.9849393963813782,
0.5457050800323486,
-0.1473129540681839,
-0.4400317668914795,... |
func RunServer() {
go func() {
counter := 5
for CurrentServer == nil {
utils.Sugar.Warn("Server was not created waiting for a one second")
time.Sleep(1 * time.Second)
counter = counter - 1
if counter <= 0 {
utils.Sugar.Error("Server was not created in time")
stopChan <- syscall.SIGINT
}
}
... | [
-0.940122127532959,
-0.9399020075798035,
0.5887735486030579,
0.20703092217445374,
0.8342092633247375,
0.4171241521835327,
0.21739594638347626,
0.27043434977531433,
-0.7266740202903748,
-0.8757866621017456,
-0.3073274791240692,
0.6724530458450317,
-0.6523646712303162,
1.4553114175796509,
... |
func ShutdownCurrentServer() {
if CurrentServer != nil {
shutdown(1*time.Second, CurrentServer)
CurrentServer = nil
ClearHostList()
}
} | [
-1.1873924732208252,
-0.6853432655334473,
0.23684364557266235,
0.6398357152938843,
-0.054313719272613525,
0.45682454109191895,
0.07053808867931366,
0.5085362195968628,
0.10998660326004028,
0.7447534799575806,
0.0989808663725853,
1.0580720901489258,
-0.9333475828170776,
1.6289924383163452,
... |
func CreateServer(config *Yaml) *http.Server {
utils.Sugar.Warn("Creating Proxy on: localhost", ":", config.LocalPort)
proxy := CASCADE.Run(config.Verbose, config.ProxyURL, config.Username, config.Password)
HandleCustomProxies(config.proxyRedirectList)
CurrentServer = create(proxy, "localhost", config)
return Curr... | [
-0.2741791307926178,
-0.878637969493866,
0.2181759923696518,
-0.13622692227363586,
0.5160340070724487,
0.34050142765045166,
0.07292516529560089,
0.7777795195579529,
0.5745297074317932,
-0.20882859826087952,
-0.14144979417324066,
-0.11801262199878693,
-1.1611814498901367,
0.6261277198791504... |
func (o *orientConnection) beginRequest(opcode int8) {
o.writeByte(opcode)
o.writeInt(o.sessionId)
log_debug(fmt.Sprintf("sent opcode %d with session id %d", opcode, o.sessionId))
} | [
-0.684563398361206,
-0.4067102074623108,
0.4984757900238037,
-0.2645289897918701,
-0.17884281277656555,
-0.5305495262145996,
0.38408297300338745,
-0.806379497051239,
1.1833182573318481,
0.8009902238845825,
0.5376265645027161,
1.180560827255249,
-0.43059346079826355,
-0.21591518819332123,
... |
func Extracts_block(req *http.Request) (Extracted_block, error) {
extracted_block := Extracted_block{}
decoder := json.NewDecoder(req.Body)
if err := decoder.Decode(&extracted_block); err != nil {
return extracted_block, errors.New("invalid request body")
}
if len(extracted_block.Pseudo) < 1 {
return extrac... | [
-0.9033156633377075,
-0.0826798751950264,
0.9000707864761353,
0.4921099543571472,
-0.29063209891319275,
-0.021289801225066185,
-0.44219785928726196,
0.12593495845794678,
-0.3389629125595093,
0.45174574851989746,
-0.16620734333992004,
0.014549560844898224,
-0.04791666567325592,
0.4720464646... |
func RunIoSoakFio(podName string, duration time.Duration, thinkTime int, thinkTimeBlocks int, rawBlock bool, doneC chan<- string, errC chan<- error) {
secs := int(duration.Seconds())
argThinkTime := fmt.Sprintf("--thinktime=%d", thinkTime)
argThinkTimeBlocks := fmt.Sprintf("--thinktime_blocks=%d", thinkTimeBlocks)
... | [
-0.2589610517024994,
-0.27109700441360474,
0.8988146185874939,
0.5512802004814148,
0.23603704571723938,
-0.5332644581794739,
0.8912879228591919,
-0.13027916848659515,
-0.6459555625915527,
0.4769107699394226,
-0.42543503642082214,
0.33806759119033813,
0.2333032786846161,
0.5038855671882629,... |
func ValidateStruct(in any) (ValidateResult, error) {
validate := validator.New()
trans := ut.New(en.New()).GetFallback() // Currently we don't support other that en translations.
if err := en_translations.RegisterDefaultTranslations(validate, trans); err != nil {
return ValidateResult{}, err
}
if err := regis... | [
-0.7189120054244995,
0.48213499784469604,
0.715298056602478,
0.28324034810066223,
-0.3888181447982788,
-0.9001709222793579,
0.12197765707969666,
-1.2516494989395142,
0.2706376016139984,
-0.739911675453186,
-1.042513370513916,
-0.15378762781620026,
0.4433342516422272,
1.0938245058059692,
... |
func (e BillEdges) PharmacistsOrErr() (*Pharmacist, error) {
if e.loadedTypes[0] {
if e.Pharmacists == nil {
// The edge pharmacists was loaded in eager-loading,
// but was not found.
return nil, &NotFoundError{label: pharmacist.Label}
}
return e.Pharmacists, nil
}
return nil, &NotLoadedError{edge: "p... | [
-0.6956230401992798,
-0.5484999418258667,
0.38268765807151794,
-1.1341512203216553,
0.4459260404109955,
0.03526126593351364,
-0.4983662962913513,
-0.438123494386673,
0.2827250361442566,
0.13263428211212158,
1.0132737159729004,
0.41269412636756897,
-1.2060506343841553,
-0.6127694845199585,
... |
func (e BillEdges) PaymentsOrErr() (*Payment, error) {
if e.loadedTypes[1] {
if e.Payments == nil {
// The edge payments was loaded in eager-loading,
// but was not found.
return nil, &NotFoundError{label: payment.Label}
}
return e.Payments, nil
}
return nil, &NotLoadedError{edge: "payments"}
} | [
-0.37329602241516113,
0.04919673129916191,
0.6453192830085754,
-1.1863917112350464,
0.2509790360927582,
-0.4916897416114807,
-0.5813537240028381,
-0.7243043780326843,
0.6023139357566833,
0.28459152579307556,
1.5795414447784424,
0.23686686158180237,
-0.2926664352416992,
0.051402267068624496... |
func (e BillEdges) DispenseMedicinesOrErr() (*DispenseMedicine, error) {
if e.loadedTypes[2] {
if e.DispenseMedicines == nil {
// The edge dispenseMedicines was loaded in eager-loading,
// but was not found.
return nil, &NotFoundError{label: dispensemedicine.Label}
}
return e.DispenseMedicines, nil
}
... | [
-0.1290920525789261,
-0.7623483538627625,
0.6216892600059509,
-1.5474811792373657,
0.45685598254203796,
-0.5736111998558044,
-0.599317729473114,
-0.3851369023323059,
0.237193763256073,
0.24551977217197418,
1.551313042640686,
0.0008711281116120517,
0.03915993869304657,
0.04392554238438606,
... |
func (*Bill) scanValues() []interface{} {
return []interface{}{
&sql.NullInt64{}, // id
&sql.NullInt64{}, // amount
&sql.NullString{}, // annotation
&sql.NullString{}, // payer
}
} | [
-0.25215843319892883,
0.4217614531517029,
0.5079246759414673,
0.5977054238319397,
-0.4733736217021942,
0.08074156194925308,
-1.4888814687728882,
-0.6471542716026306,
0.14474806189537048,
-1.1941295862197876,
-0.5373908877372742,
0.015810910612344742,
-0.08634167164564133,
1.956568121910095... |
func (*Bill) fkValues() []interface{} {
return []interface{}{
&sql.NullInt64{}, // dispensemedicine_id
&sql.NullInt64{}, // payment_id
&sql.NullInt64{}, // pharmacist_id
}
} | [
0.6577072143554688,
0.6512157320976257,
0.5685182809829712,
0.32214221358299255,
0.6617621183395386,
-0.4392339885234833,
-0.49743711948394775,
0.021742448210716248,
-0.31832197308540344,
-0.8637502789497375,
0.07981791347265244,
-0.42097580432891846,
-0.6455878019332886,
1.771397233009338... |
func (b *Bill) assignValues(values ...interface{}) error {
if m, n := len(values), len(bill.Columns); m < n {
return fmt.Errorf("mismatch number of scan values: %d != %d", m, n)
}
value, ok := values[0].(*sql.NullInt64)
if !ok {
return fmt.Errorf("unexpected type %T for field id", value)
}
b.ID = int(value.In... | [
-0.12990376353263855,
0.03536779806017876,
0.7673481106758118,
0.24546822905540466,
0.2735796868801117,
0.18911385536193848,
0.15316498279571533,
-0.4135711193084717,
-0.13333381712436676,
-0.48326101899147034,
0.43567296862602234,
-0.603046178817749,
-0.08516888320446014,
1.39489650726318... |
func (b *Bill) QueryPharmacists() *PharmacistQuery {
return (&BillClient{config: b.config}).QueryPharmacists(b)
} | [
0.750616192817688,
-0.1154962107539177,
0.152393639087677,
-0.31014347076416016,
-0.6839942932128906,
-0.009276134893298149,
-0.31226035952568054,
0.4089711010456085,
0.5693902969360352,
-0.9208596348762512,
0.6042298078536987,
1.2908971309661865,
-1.279766321182251,
-0.22639666497707367,
... |
func (b *Bill) QueryPayments() *PaymentQuery {
return (&BillClient{config: b.config}).QueryPayments(b)
} | [
1.23917818069458,
1.0134466886520386,
0.2747480273246765,
0.4665440022945404,
-0.0939406231045723,
-0.7721725702285767,
-0.08646594732999802,
-0.07158635556697845,
0.46054646372795105,
-1.1066797971725464,
0.7353342771530151,
0.18084298074245453,
-1.2360566854476929,
0.1745605617761612,
... |
func (b *Bill) QueryDispenseMedicines() *DispenseMedicineQuery {
return (&BillClient{config: b.config}).QueryDispenseMedicines(b)
} | [
0.46792012453079224,
0.006007390562444925,
0.4405750632286072,
-0.7631090879440308,
-0.09977396577596664,
-0.18190322816371918,
0.10339431464672089,
-0.11357629299163818,
0.3717995584011078,
-0.9390584230422974,
0.2921830415725708,
-0.07460979372262955,
-0.5205852389335632,
0.6941885352134... |
func (b *Bill) Update() *BillUpdateOne {
return (&BillClient{config: b.config}).UpdateOne(b)
} | [
0.4383138120174408,
0.2296847254037857,
0.1922561526298523,
1.101067066192627,
0.0012830292107537389,
0.6328645348548889,
-0.23018808662891388,
0.172292560338974,
0.19179250299930573,
-0.5739964246749878,
-0.5768504738807678,
0.25658556818962097,
-1.9626433849334717,
0.8296489119529724,
... |
func (b *Bill) Unwrap() *Bill {
tx, ok := b.config.driver.(*txDriver)
if !ok {
panic("ent: Bill is not a transactional entity")
}
b.config.driver = tx.drv
return b
} | [
-0.15303045511245728,
0.8150252103805542,
0.3572177290916443,
0.13662876188755035,
-0.0527777373790741,
0.2456471025943756,
0.1909501850605011,
0.7566519379615784,
0.011725148186087608,
0.022295847535133362,
0.36233681440353394,
0.33350688219070435,
0.05597005784511566,
0.14362694323062897... |
func (b *Bill) String() string {
var builder strings.Builder
builder.WriteString("Bill(")
builder.WriteString(fmt.Sprintf("id=%v", b.ID))
builder.WriteString(", amount=")
builder.WriteString(fmt.Sprintf("%v", b.Amount))
builder.WriteString(", annotation=")
builder.WriteString(b.Annotation)
builder.WriteString("... | [
0.3701159954071045,
-0.4777410626411438,
0.27609506249427795,
-0.35420864820480347,
-0.4268706142902374,
0.8748486042022705,
0.2217547595500946,
-1.0211399793624878,
-0.36833155155181885,
-0.47493770718574524,
-0.3541557490825653,
1.1104072332382202,
-0.6111500263214111,
0.4799289107322693... |
func (r Provenance) MarshalJSON() ([]byte, error) {
return json.Marshal(struct {
OtherProvenance
ResourceType string `json:"resourceType"`
}{
OtherProvenance: OtherProvenance(r),
ResourceType: "Provenance",
})
} | [
0.03014751896262169,
-0.399745374917984,
0.3574206531047821,
0.19847486913204193,
-0.31042441725730896,
-0.18755142390727997,
0.12526662647724152,
0.35863596200942993,
1.1373870372772217,
0.9121227264404297,
-0.5481465458869934,
0.32847699522972107,
-0.370132714509964,
1.009456992149353,
... |
func UnmarshalProvenance(b []byte) (Provenance, error) {
var provenance Provenance
if err := json.Unmarshal(b, &provenance); err != nil {
return provenance, err
}
return provenance, nil
} | [
-0.05979869142174721,
-0.18344895541667938,
0.947052001953125,
-0.16264264285564423,
-1.162241816520691,
-0.4290595054626465,
-0.7370607256889343,
0.41282224655151367,
0.6293268799781799,
1.2712500095367432,
0.24153585731983185,
-0.5257726311683655,
-1.2793132066726685,
-0.1701448708772659... |
func solve1(input string) string {
n := 0
aoc.MapLines(input, func(line string) error {
a, b := Assignment{}, Assignment{}
_, _ = fmt.Sscanf(line, "%d-%d,%d-%d", &(a.Start), &(a.Finish), &(b.Start), &(b.Finish))
if a.FullyContains(b) || b.FullyContains(a) {
n++
}
return nil
})
return fmt.Sprint(n)
} | [
-0.7688530683517456,
-0.4074532389640808,
0.7139764428138733,
0.6822767853736877,
-0.37154334783554077,
-0.4616624116897583,
1.1372406482696533,
-0.4856771230697632,
-0.4736010730266571,
0.4967566728591919,
0.19707170128822327,
-0.21297359466552734,
0.36232277750968933,
0.29490354657173157... |
func solve2(input string) string {
n := 0
aoc.MapLines(input, func(line string) error {
a, b := Assignment{}, Assignment{}
_, _ = fmt.Sscanf(line, "%d-%d,%d-%d", &(a.Start), &(a.Finish), &(b.Start), &(b.Finish))
if a.Overlaps(b) || b.Overlaps(a) {
n++
}
return nil
})
return fmt.Sprint(n)
} | [
-0.7630357146263123,
-0.8182071447372437,
0.7077198028564453,
0.3729966878890991,
-0.8211865425109863,
-0.6017125844955444,
1.0295350551605225,
-1.1369102001190186,
-0.5815458297729492,
-0.049693044275045395,
0.25018802285194397,
0.08829972892999649,
0.4663166403770447,
0.5047613382339478,... |
func startServer(dataSlice []string) {
e := echo.New()
e.GET("/", func(f echo.Context) error {
return f.JSON(http.StatusOK, dataSlice)
})
fmt.Println("Server running: http://localhost:8000")
e.Logger.Fatal(e.Start(":8000"))
} | [
-1.2399033308029175,
-0.7438651919364929,
0.5130714178085327,
0.7030981779098511,
0.9595353603363037,
0.20094162225723267,
-0.5750268697738647,
0.8725050091743469,
0.3136675953865051,
-0.1566268354654312,
-0.6175529360771179,
1.4461499452590942,
0.017253827303647995,
0.7776573896408081,
... |
func GracefulContext(ctx context.Context, start StartFunc, shutdown ShutdownFunc) error {
var (
stopChan = make(chan os.Signal, 1)
errChan = make(chan error, 1)
)
// Setup the graceful shutdown handler (traps SIGINT and SIGTERM)
go func() {
signal.Notify(stopChan, os.Interrupt, syscall.SIGINT, syscall.SIGTE... | [
0.4960143268108368,
0.11109385639429092,
0.781567394733429,
0.6324899792671204,
-0.07268999516963959,
-0.5500933527946472,
0.07936576008796692,
0.053451113402843475,
0.11760547757148743,
0.15523280203342438,
-0.2171730101108551,
0.27326032519340515,
-0.2627621293067932,
-0.2718897461891174... |
func (xzFormat) Match(filename string) bool {
return strings.HasSuffix(strings.ToLower(filename), ".tar.xz") ||
strings.HasSuffix(strings.ToLower(filename), ".txz") ||
isTarXz(filename)
} | [
0.6911633014678955,
-0.22928757965564728,
0.627953052520752,
0.11743683367967606,
-1.0098224878311157,
0.4806550145149231,
-0.25637343525886536,
0.6060974597930908,
-0.4955205023288727,
-0.17492075264453888,
0.07780224084854126,
-0.03346366435289383,
-0.8013857007026672,
0.5118551254272461... |
func isTarXz(tarxzPath string) bool {
f, err := os.Open(tarxzPath)
if err != nil {
return false
}
defer f.Close()
xzr, err := xz.NewReader(f)
if err != nil {
return false
}
buf := make([]byte, tarBlockSize)
n, err := xzr.Read(buf)
if err != nil || n < tarBlockSize {
return false
}
return hasTarHead... | [
0.32537657022476196,
-0.52280592918396,
0.6459195613861084,
-0.12228412181138992,
-0.8774101138114929,
-0.06560219079256058,
-0.4210708439350128,
0.14110971987247467,
0.21660761535167694,
0.02811523713171482,
-0.2886686325073242,
0.09799084067344666,
-0.4690324664115906,
-0.105181217193603... |
func (xzFormat) Write(output io.Writer, filePaths []string) error {
return writeTarXZ(filePaths, output, "")
} | [
-0.0762864276766777,
-0.7943605780601501,
-0.2609812915325165,
1.1543132066726685,
-0.2084161341190338,
-0.1943766176700592,
0.6152400970458984,
0.7522532343864441,
-0.22753988206386566,
-0.4193149507045746,
0.1576070636510849,
-0.7781489491462708,
0.15909476578235626,
0.23975956439971924,... |
func (xzFormat) Make(xzPath string, filePaths []string) error {
out, err := os.Create(xzPath)
if err != nil {
return fmt.Errorf("error creating %s: %v", xzPath, err)
}
defer out.Close()
return writeTarXZ(filePaths, out, xzPath)
} | [
0.5376449227333069,
-0.5623232126235962,
0.18270789086818695,
0.21857859194278717,
-0.379917174577713,
0.3568563163280487,
0.49035340547561646,
0.1880328357219696,
-0.43733149766921997,
-0.7397324442863464,
0.4480603337287903,
-0.2808954417705536,
-0.003027501981705427,
-0.7459072470664978... |
func (xzFormat) Read(input io.Reader, destination string) error {
xzr, err := xz.NewReader(input)
if err != nil {
return fmt.Errorf("error decompressing xz: %v", err)
}
return Tar.Read(xzr, destination)
} | [
0.26569244265556335,
-0.4253500998020172,
0.3529820740222931,
-0.6761602163314819,
-0.8434068560600281,
0.061993569135665894,
-0.959037721157074,
0.05847062170505524,
-0.6157057285308838,
-0.3002565801143646,
0.6293929815292358,
0.21512655913829803,
-0.21317651867866516,
-0.461467832326889... |
func (xzFormat) Open(source, destination string) error {
f, err := os.Open(source)
if err != nil {
return fmt.Errorf("%s: failed to open archive: %v", source, err)
}
defer f.Close()
return TarXZ.Read(f, destination)
} | [
-0.16182242333889008,
0.1658337265253067,
0.2824232876300812,
-0.6954359412193298,
-1.4498647451400757,
0.38944414258003235,
-0.4600648581981659,
0.7224794626235962,
-0.2951911389827728,
0.0928170382976532,
0.3489466607570648,
0.8424301743507385,
0.4603261947631836,
-1.2178634405136108,
... |
func Server(handler http.Handler) http.HandlerFunc {
return func(w http.ResponseWriter, req *http.Request) {
w.Header().Set("Server", "opencars")
w.Header().Set("Connection", "keep-alive")
w.Header().Set("Content-Type", "application/json; charset=utf-8")
handler.ServeHTTP(w, req)
}
} | [
-0.719869077205658,
-0.9892838597297668,
0.7145556211471558,
0.1289086788892746,
-0.155752494931221,
0.6046897172927856,
-0.46070507168769836,
0.07738688588142395,
-1.5183876752853394,
-0.0704866573214531,
-0.45571550726890564,
-0.5287413597106934,
0.08538677543401718,
0.2200845181941986,
... |
func health(w http.ResponseWriter, _ *http.Request) {
if !Storage.Healthy() {
msg := "database is not healthy"
http.Error(w, msg, http.StatusServiceUnavailable)
}
} | [
-0.07104611396789551,
-0.4555148482322693,
0.49180468916893005,
0.7787909507751465,
-0.10203740000724792,
1.3392002582550049,
-0.2647666931152344,
-0.23623286187648773,
0.4426576793193817,
-0.12493535131216049,
0.5570696592330933,
-0.017138643190264702,
-0.3006629943847656,
0.7640191912651... |
func Run(addr, uri string) {
log.Printf("Server is listening %s\n", addr)
router := mux.NewRouter()
vehicle := router.PathPrefix("/vehicle/").Methods("GET", "OPTIONS").Subrouter()
// GET /vehicle/registrations.
vehicle.Handle("/registrations", newRegsHandler(uri))
// GET /vehicle/operations.
vehicle.HandleFunc(... | [
-0.5359522700309753,
-0.34795138239860535,
0.978032112121582,
-0.19134345650672913,
0.023983357474207878,
0.12592744827270508,
0.13759973645210266,
0.6170377731323242,
-0.2543323338031769,
0.2836875021457672,
-0.0039111552760005,
0.5980250239372253,
-0.39146435260772705,
-0.057962458580732... |
func NewRuleCache(client *redis.Client) kuiper.RuleCache {
return &ruleCache{
client: client,
}
} | [
0.7014778256416321,
0.1724536120891571,
0.042133886367082596,
0.30836910009384155,
-0.10579323023557663,
0.026976313441991806,
-1.0571008920669556,
0.7407206892967224,
-0.09613250195980072,
0.9018840789794922,
0.2561686336994171,
0.34071940183639526,
-0.3268234133720398,
0.1017557084560394... |
func (em *eventManager) BatchPinComplete(bi blockchain.Plugin, batchPin *blockchain.BatchPin, signingIdentity string, protocolTxID string, additionalInfo fftypes.JSONObject) error {
log.L(em.ctx).Infof("-> BatchPinComplete txn=%s signingIdentity=%s", protocolTxID, signingIdentity)
defer func() {
log.L(em.ctx).Info... | [
0.02787044271826744,
-0.878662109375,
0.48620280623435974,
0.13148869574069977,
0.3420948088169098,
0.36020413041114807,
0.05437084287405014,
0.050970274955034256,
0.009813624434173107,
1.0111802816390991,
-1.006325602531433,
0.1264580488204956,
-0.3470202088356018,
-0.020591525360941887,
... |
func Load(box packr.Box, config interface{}) error {
configType := "json"
viper.SetConfigType(configType)
configName := "config"
if isTesting() {
configName = "config_test"
}
viper.SetConfigName(configName)
configFile := configName + "." + configType
contents, err := box.Find(configFile)
if err != nil {
... | [
-0.3419204354286194,
-0.3267466425895691,
0.7603845000267029,
-0.7674041390419006,
-0.8122432827949524,
-0.24842900037765503,
-0.6377264261245728,
0.0987301841378212,
-0.34871527552604675,
0.7758157253265381,
-0.16734708845615387,
-0.1150999590754509,
-0.6011263132095337,
-0.13226385414600... |
func NewBitWriter(w io.Writer) *BitWriter {
ww := makeWriter(w)
return &BitWriter{0, egWordBits, ww, make([]byte, 8)}
} | [
-0.27441808581352234,
0.31164857745170593,
-0.027073444798588753,
0.25820061564445496,
-0.6707178950309753,
-0.26657119393348694,
0.054150890558958054,
-0.6500921249389648,
0.15715022385120392,
0.44128596782684326,
-0.4491063356399536,
0.024262862280011177,
-0.41967344284057617,
0.76543456... |
func NewCommentService(repo comment.CommentRepository) *CommentService {
return &CommentService{cmtRepo: repo}
} | [
-0.33047452569007874,
-0.6729425191879272,
-0.015277080237865448,
-0.45968374609947205,
0.19096751511096954,
-0.2626645565032959,
-0.37473878264427185,
-1.3951938152313232,
-0.016507906839251518,
0.4815083146095276,
-0.8484638333320618,
0.19560398161411285,
-0.8644462823867798,
0.850915372... |
func (cs *CommentService) Comments(id uint) ([]entity.Comment, []error) {
comments, errs := cs.cmtRepo.Comments(id)
if len(errs) > 0 {
return nil, errs
}
return comments, nil
} | [
-1.3639954328536987,
-0.6483606696128845,
0.20344416797161102,
-0.2807390093803406,
1.0834782123565674,
-0.6059964895248413,
-0.12920120358467102,
-0.808351993560791,
0.42468753457069397,
0.002774742664769292,
-0.6445140242576599,
0.05334199592471123,
-0.33597391843795776,
0.70982462167739... |
func (cs *CommentService) Comment(id uint) (*entity.Comment, []error) {
comment, errs := cs.cmtRepo.Comment(id)
if len(errs) > 0 {
return nil, errs
}
return comment, nil
} | [
-0.9429248571395874,
-0.523215651512146,
0.31110915541648865,
0.05552961304783821,
0.8610521554946899,
-0.7141077518463135,
0.9024108648300171,
-0.633867084980011,
0.4950721859931946,
0.18691480159759521,
-0.5294979214668274,
-0.2064463198184967,
-0.4918842911720276,
0.17406140267848969,
... |
func (cs *CommentService) DeleteComment(id uint) (*entity.Comment, []error) {
comment, errs := cs.cmtRepo.DeleteComment(id)
if len(errs) > 0 {
return nil, errs
}
return comment, nil
} | [
-0.6554321050643921,
-0.7432408332824707,
0.34332075715065,
-0.24002179503440857,
1.0844500064849854,
-0.7009496688842773,
0.7616949677467346,
-0.2965780198574066,
0.9107891321182251,
-0.037177156656980515,
-0.36463218927383423,
-0.2538142800331116,
-0.5973834991455078,
0.6011415719985962,... |
func (cs *CommentService) CheckUser(cmt *entity.Comment) []error {
errs := cs.cmtRepo.CheckUser(cmt)
if len(errs) > 0 {
return errs
}
return nil
} | [
-0.9693012237548828,
-0.4852900505065918,
0.36342689394950867,
0.5925740003585815,
1.181828260421753,
0.11733001470565796,
0.7450039386749268,
-0.1690979301929474,
-0.5785228610038757,
0.5085008144378662,
-0.41707339882850647,
0.21294696629047394,
-0.17834064364433289,
1.023618459701538,
... |
func TestMinimumSwaps1(t *testing.T) {
arr := []int32{4, 3, 1, 2}
swaps := minimumSwaps(arr)
fmt.Println("SWAPS:", swaps)
} | [
-1.170614242553711,
-0.05600655823945999,
0.5381054878234863,
0.18689243495464325,
-1.3727500438690186,
1.3221513032913208,
0.27251774072647095,
-0.3025442361831665,
1.4126834869384766,
-1.185101866722107,
-0.8426929116249084,
-0.14261485636234283,
-1.1308622360229492,
0.6244850158691406,
... |
func PCMarkWorkAndroidApp(ctx context.Context, s *testing.State) {
cr := s.FixtValue().(*arc.PreData).Chrome
a := s.FixtValue().(*arc.PreData).ARC
tconn, err := cr.TestAPIConn(ctx)
if err != nil {
s.Fatal("Failed to create test API connection: ", err)
}
uiDevice, err := a.NewUIDevice(ctx)
if err != nil {
s... | [
0.11282949149608612,
-0.7183969020843506,
0.7622503042221069,
0.08674830198287964,
0.20610418915748596,
0.14402738213539124,
1.4674527645111084,
-0.6628637313842773,
0.8404932618141174,
0.41585201025009155,
0.48332610726356506,
-0.0251358300447464,
0.15517498552799225,
-0.04616372659802437... |
func installPCMarkComponents(ctx context.Context, uiDevice *ui.Device) (*ui.Object, error) {
// PCMark needs in-app installation before it can show the RUN button.
// Check if RUN or "INSTALL" button is available.
var btnRun, btnInstall *ui.Object
if err := testing.Poll(ctx, func(ctx context.Context) error {
if b... | [
0.3899473547935486,
-0.23486538231372833,
0.6661482453346252,
-0.08170035481452942,
0.12338154017925262,
0.2555848956108093,
0.8525179028511047,
-0.2309761941432953,
0.27359992265701294,
0.07076679915189743,
-0.2658592462539673,
-0.5313107967376709,
-0.5853586196899414,
0.43448135256767273... |
func buttonWithText(ctx context.Context, d *ui.Device, text string) (obj *ui.Object) {
obj = d.Object(ui.Text(text))
if findUIObj(ctx, obj) {
return obj
}
obj = d.Object(ui.DescriptionContains(text))
if findUIObj(ctx, obj) {
return obj
}
return nil
} | [
0.8275688290596008,
-0.8077642917633057,
0.6594915390014648,
0.12989836931228638,
-1.1395384073257446,
0.25856590270996094,
-0.31639009714126587,
-0.8784782290458679,
0.7809610366821289,
-0.17223015427589417,
-0.1636611819267273,
-0.17113588750362396,
-0.6300086379051208,
-0.38061127066612... |
func buttonWithRegex(ctx context.Context, d *ui.Device, reg string) (obj *ui.Object) {
obj = d.Object(ui.TextMatches(reg))
if findUIObj(ctx, obj) {
return obj
}
obj = d.Object(ui.DescriptionMatches(reg))
if findUIObj(ctx, obj) {
return obj
}
return nil
} | [
0.18117161095142365,
-0.8073093295097351,
0.7349981069564819,
0.100286565721035,
-0.06514870375394821,
0.3388518691062927,
0.2932746410369873,
-0.2208479791879654,
0.35799258947372437,
-0.7862808108329773,
-0.15256521105766296,
0.17933447659015656,
-0.3890819251537323,
-0.46157389879226685... |
func max(a, b int) int {
if a > b {
return a
}
return b
} | [
-0.06727436929941177,
0.670540988445282,
0.3449091613292694,
0.3648669123649597,
-0.34648004174232483,
0.20483596622943878,
-1.1642109155654907,
-0.6604490280151367,
-0.6736398339271545,
0.24308907985687256,
0.4477981925010681,
1.3510093688964844,
-0.0016065402887761593,
-0.077071644365787... |
func Height() int {
ws, err := getWinsize()
if err != nil {
return -1
}
return int(ws.Row)
} | [
-0.05520280823111534,
0.7986155152320862,
0.5432525277137756,
0.9883056879043579,
-0.6081831455230713,
-0.31857481598854065,
1.5396648645401,
0.5556692481040955,
-0.15274156630039215,
-0.08035016059875488,
0.2560245990753174,
0.31587493419647217,
-0.6852917671203613,
0.855471670627594,
0... |
func SignRequest(xml string, privateKeyPath string) (string, error) {
return sign(xml, privateKeyPath, xmlRequestID)
} | [
-1.5649712085723877,
-0.8869534134864807,
0.2930647134780884,
0.08156700432300568,
-0.7041134834289551,
-0.09556511789560318,
-0.7274390459060669,
-0.3249354362487793,
0.14128082990646362,
0.35741761326789856,
0.36706751585006714,
-0.1937170922756195,
-0.5018479228019714,
-0.20110081136226... |
func SignResponse(xml string, privateKeyPath string) (string, error) {
return sign(xml, privateKeyPath, xmlResponseID)
} | [
-0.5138980746269226,
-1.5178343057632446,
0.20802409946918488,
0.0393882691860199,
-0.28488919138908386,
-0.5994662642478943,
-0.4322203993797302,
-0.2705203592777252,
1.1351637840270996,
0.5030428171157837,
-0.844055712223053,
-1.2884832620620728,
-1.191186547279358,
-1.0750261545181274,
... |
func DecryptResponse(xml string, privateKeyPath string) (string, error) {
return decrypt(xml, privateKeyPath)
} | [
-0.27084705233573914,
-0.5342303514480591,
0.0970359668135643,
0.04120000824332237,
0.11563629657030106,
-1.3526480197906494,
0.06405428797006607,
-0.8795520067214966,
1.1207654476165771,
1.323929786682129,
-0.4600733518600464,
-0.7849178910255432,
-1.5084484815597534,
-1.455997109413147,
... |
func VerifyResponseSignature(xml string, publicCertPath string) error {
return verify(xml, publicCertPath)
} | [
0.7848137021064758,
-1.2963058948516846,
0.1734558790922165,
0.4120595455169678,
-0.007241906598210335,
0.05373186245560646,
0.1609407365322113,
-1.16831636428833,
0.8543882369995117,
-0.8870205283164978,
-1.5758589506149292,
-0.3268979787826538,
-0.546082615852356,
-0.7505508661270142,
... |
func VerifyAssertionSignature(xml string, publicCertPath string) error {
return verify(xml, publicCertPath)
} | [
0.15957579016685486,
-1.0162854194641113,
0.10448390245437622,
0.9327164888381958,
-0.6224373579025269,
0.8202574253082275,
0.1651563048362732,
-0.2287033200263977,
-0.11762559413909912,
-0.19525378942489624,
-0.5844666361808777,
0.2795484662055969,
-0.9558776617050171,
0.24024292826652527... |
func VerifyRequestSignature(xml string, publicCertPath string) error {
return verify(xml, publicCertPath)
} | [
-0.3576068580150604,
-0.622119128704071,
0.19527362287044525,
1.3073700666427612,
-0.511985719203949,
0.6047152876853943,
-0.7075757384300232,
-0.524764895439148,
-0.15178897976875305,
-0.6654666662216187,
-1.0669419765472412,
0.3462352156639099,
-0.7526978254318237,
-0.13867922127246857,
... |
func deleteTempFile(filename string) {
_ = os.Remove(filename)
} | [
1.4135669469833374,
-0.4175068438053131,
0.2892224192619324,
-0.20268461108207703,
0.5433191061019897,
0.738796055316925,
1.1171190738677979,
1.1434338092803955,
-1.3431357145309448,
-0.10380890220403671,
-0.8986737132072449,
-0.9150765538215637,
-0.09128537774085999,
0.6631505489349365,
... |
func NewBuffer(o *Options) (*Buffer, error) {
if o == nil {
o = &Options{}
}
ret := &Buffer{opts: *o} // copy o before normalizing it
if err := ret.opts.normalize(); err != nil {
return nil, errors.Annotate(err, "normalizing buffer.Options").Err()
}
ret.unleased.onlyID = o.FIFO
ret.batchItemsGuess = newMov... | [
0.19855250418186188,
-0.2652401030063629,
0.4135485589504242,
0.7749780416488647,
-0.6300998330116272,
0.09751024097204208,
0.49387985467910767,
-0.22066891193389893,
1.164317011833191,
0.005743521731346846,
0.08149803429841995,
0.24970829486846924,
-0.31303489208221436,
0.4333477020263672... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.