text stringlengths 11 6.3k | embedding listlengths 768 768 |
|---|---|
func TestCenteredAvg(t *testing.T) {
type test struct {
data []int
result float64
}
tests := []test{
test{
[]int{1, 3, 5, 7, 9},
5,
},
test{
[]int{2, 4, 6, 8, 10},
6,
},
test{
[]int{11, 13, 15, 17, 19},
15,
},
test{
[]int{20, 22, 24, 26, 28, 30},
25,
},
}
for _, v :=... | [
0.48581480979919434,
0.4159095287322998,
0.7017786502838135,
-0.36056700348854065,
0.1587395966053009,
0.48340243101119995,
0.9043722152709961,
-0.0027708772104233503,
0.15050587058067322,
0.7108676433563232,
0.004879599437117577,
-0.09724936634302139,
-1.193352460861206,
0.753954589366912... |
func BenchmarkCenteredAvg(b *testing.B) {
xi := []int{2, 3, 4, 5, 6, 7}
for i := 0; i < b.N; i++ {
CenteredAvg(xi)
}
} | [
0.5996888279914856,
0.6144439578056335,
0.4785231947898865,
0.001672478043474257,
0.9426360130310059,
0.10020967572927475,
0.6383496522903442,
0.45119142532348633,
-0.0104904156178236,
1.1197360754013062,
0.1390930861234665,
-0.07629816234111786,
-0.7077862620353699,
0.8545494675636292,
... |
func ExampleCenteredAvg() {
xi := []int{2, 3, 4, 5, 6, 7}
fmt.Println(CenteredAvg(xi))
//Output:
//4.5
} | [
0.4731403589248657,
0.13658125698566437,
0.49504318833351135,
0.11220084130764008,
-0.49657589197158813,
0.606037437915802,
0.49192050099372864,
0.5664995908737183,
0.5913853049278259,
1.034109115600586,
-0.6563688516616821,
0.5017266869544983,
-0.4996728301048279,
0.7728318572044373,
0.... |
func New() *ServeSeq {
return &ServeSeq{
handlers: make([]http.Handler, 0),
}
} | [
-1.1807870864868164,
-1.0089613199234009,
0.20896698534488678,
0.5075282454490662,
-0.5768601298332214,
0.5972442626953125,
0.2699439525604248,
0.6114543080329895,
-1.17617666721344,
-0.1999366581439972,
-1.1187222003936768,
0.6883591413497925,
0.3488551378250122,
0.9596618413925171,
0.0... |
func (s *ServeSeq) Next(h http.Handler) {
s.Lock()
defer s.Unlock()
s.handlers = append(s.handlers, h)
} | [
-0.8553466796875,
0.2697455585002899,
0.2045569121837616,
0.4592514634132385,
-0.9253464937210083,
1.0326082706451416,
-0.1641165018081665,
0.17780688405036926,
0.13926038146018982,
-0.6675601005554199,
-1.0167230367660522,
1.0412359237670898,
-0.06633155047893524,
0.8561891317367554,
0.... |
func (s *ServeSeq) NextFunc(h http.HandlerFunc) {
s.Next(h)
} | [
0.5330554842948914,
0.20968762040138245,
0.12057498842477798,
0.4898647665977478,
-0.4058786928653717,
0.15919038653373718,
1.1556228399276733,
0.624726414680481,
-0.6280039548873901,
-0.5774440765380859,
-0.3118758797645569,
0.7329983115196228,
1.8924014568328857,
0.898165762424469,
-0.... |
func (s *ServeSeq) ServeHTTP(w http.ResponseWriter, r *http.Request) {
i := &intrespwriter{parent: w, written: false}
for idx, h := range s.handlers {
i.canskip = (idx != len(s.handlers)-1)
i.skip = false
h.ServeHTTP(i, r)
if i.written {
return
}
}
} | [
-0.5906667113304138,
0.06605957448482513,
0.4444131851196289,
0.24942848086357117,
-0.11911269277334213,
0.809158205986023,
1.446883201599121,
-0.15406295657157898,
-1.013613224029541,
0.4315303564071655,
-0.1839328557252884,
-0.8297674655914307,
-0.6636844873428345,
0.2546927332878113,
... |
func (c *Client) getinfo(line string) error {
args := strings.Split(line, " ")
args = args[1:] // chop off the first word which should be "getinfo"
/*
req := frontend.KeyRequest{Key: args[0]}
reqs := &frontend.MultiKeyRequest{
Requests: []frontend.KeyRequest{req},
}
responses := &frontend.MultiGetInfoRes... | [
0.23079994320869446,
0.19088755548000336,
0.9949154853820801,
-0.127944678068161,
1.1257538795471191,
-0.2546466588973999,
0.13272176682949066,
-0.6825072169303894,
-1.1146280765533447,
-0.13026201725006104,
-0.4743945002555847,
0.7521195411682129,
0.07651723921298981,
0.46576929092407227,... |
func (c *Client) create(line string) error {
args := strings.Split(line, " ")
args = args[1:] // chop off the first word which should be "create"
// args[0]:tbk, args[1]:dataTypeStr, args[2]:"fixed" or "variable"
const argLen = 3
if len(args) < argLen {
// nolint:forbidigo // CLI output needs fmt.Println
fmt.P... | [
-0.007957502268254757,
0.31354740262031555,
0.799256443977356,
0.6278367042541504,
0.6504554152488708,
-0.060149602591991425,
0.24756070971488953,
-0.932077944278717,
-1.4755476713180542,
0.4473211467266083,
0.4762333333492279,
0.3224029839038849,
-0.29672926664352417,
0.6307957172393799,
... |
func (c *Client) destroy(line string) error {
args := strings.Split(line, " ")
args = args[1:] // chop off the first word which should be "destroy"
const argLen = 1 // arg[0] should be a bucket name
if len(args) == 0 {
log.Error("Please specify a bucket to destroy. (e.g. \\destroy TEST/1D/TICK)\n")
return nil
... | [
-0.4447847902774811,
-0.14669038355350494,
0.9071753025054932,
0.11954347789287567,
0.395037978887558,
0.01720191165804863,
-0.045961882919073105,
-0.2568780481815338,
-0.5881236791610718,
0.15207712352275848,
0.23605985939502716,
-0.11207584291696548,
-1.0213652849197388,
0.71121835708618... |
func (o *pullOrdered) consume(sc *saramaConsumer, routine chan cluster.PartitionConsumer) {
for {
pc := <-routine
log := Logger() // nolint - false positive
log.Debug(o.cfg.TransactionID, "Starting Consumer Routine for Topic :: %s and Partition :: %v", pc.Topic(), pc.Partition())
select {
case msg, ok := <-p... | [
0.48607969284057617,
-0.3684532940387726,
0.5418853163719177,
-0.16421274840831757,
0.20456993579864502,
-0.4657093286514282,
0.24164821207523346,
-0.2642248868942261,
-0.7529592514038086,
1.088976502418518,
0.8054518699645996,
0.05482208728790283,
-0.34075289964675903,
0.2609228193759918,... |
func NewHelloCommandExecutor(logger *logrus.Entry, reader *SMTPReader, writer *SMTPWriter) *HelloCommandExecutor {
return &HelloCommandExecutor{
logger: logger,
reader: reader,
writer: writer,
}
} | [
0.5980380773544312,
-0.9650251269340515,
0.23932982981204987,
-0.41536131501197815,
-0.3982310891151428,
-0.3006992042064667,
-0.533281683921814,
1.09689462184906,
-0.342737078666687,
-0.6420071125030518,
-0.47309020161628723,
1.0505379438400269,
-0.03231535479426384,
0.15823248028755188,
... |
func (e *HelloCommandExecutor) Process(streamInput string, mailItem *MailItem) error {
lowercaseStreamInput := strings.ToLower(streamInput)
commandCheck := (strings.Index(lowercaseStreamInput, "helo") + 1) + (strings.Index(lowercaseStreamInput, "ehlo") + 1)
if commandCheck <= 0 {
return fmt.Errorf("Invalid HELO c... | [
0.46445196866989136,
-0.30506330728530884,
0.7964522838592529,
0.2964978516101837,
0.3113050162792206,
0.14844301342964172,
0.3037588596343994,
-0.17774631083011627,
0.06713230162858963,
-0.15450093150138855,
0.16587957739830017,
0.031183985993266106,
-0.7383585572242737,
0.921324431896209... |
func (n *Notification) Send() error {
vals := make(url.Values)
vals.Set("token", n.APIToken)
vals.Set("user", n.UserKey)
vals.Set("message", n.Message)
vals.Set("title", n.Title)
resp, err := n.Client.PostForm(API, vals)
if err != nil {
return err
}
defer resp.Body.Close()
var r apiResponse
if err := jso... | [
-0.6452358961105347,
0.2844166159629822,
0.5707181692123413,
0.39141178131103516,
0.2508431077003479,
-0.36358433961868286,
-0.41555625200271606,
-0.14114177227020264,
-1.1702089309692383,
0.44114235043525696,
-0.6960679292678833,
-0.2212456315755844,
-0.29436689615249634,
0.36574247479438... |
func (g Group) String() string {
jg, _ := json.Marshal(g)
return string(jg)
} | [
-0.6377961039543152,
-0.17881762981414795,
-0.00181780313141644,
-1.1673821210861206,
-1.053321361541748,
-0.03609239682555199,
0.15526676177978516,
-1.8549994230270386,
-0.7815920114517212,
0.43572187423706055,
0.1444534957408905,
1.2869828939437866,
-0.4482438862323761,
-0.20765389502048... |
func (g Groups) String() string {
jg, _ := json.Marshal(g)
return string(jg)
} | [
-0.7475612759590149,
-0.17886081337928772,
-0.03130887821316719,
-1.294592261314392,
-0.9416177272796631,
-0.14656314253807068,
0.2014131098985672,
-2.0337023735046387,
-0.5887686014175415,
0.39832767844200134,
0.38078945875167847,
1.2102407217025757,
-0.47974103689193726,
-0.3488165140151... |
func (g *Group) Validate(tx *pop.Connection) (*validate.Errors, error) {
return validate.Validate(
&validators.StringIsPresent{Field: g.Name, Name: "Name"},
), nil
} | [
-0.3598870635032654,
0.7121784090995789,
0.24074552953243256,
-0.6768322587013245,
0.012418986298143864,
-0.11100949347019196,
-0.5483512878417969,
-1.046641230583191,
-1.5318812131881714,
1.1114075183868408,
-0.34586697816848755,
-0.5702065825462341,
-1.1985275745391846,
0.646502077579498... |
func (g *Group) ValidateCreate(tx *pop.Connection) (*validate.Errors, error) {
return validate.NewErrors(), nil
} | [
-0.558931827545166,
0.3636973202228546,
0.37838852405548096,
0.4634914696216583,
0.2722896933555603,
0.17330797016620636,
-0.08304666727781296,
-1.2912757396697998,
-1.8009464740753174,
0.28713127970695496,
0.28202906250953674,
-1.0034860372543335,
-0.8948559165000916,
1.079456090927124,
... |
func (g *Group) ValidateUpdate(tx *pop.Connection) (*validate.Errors, error) {
return validate.NewErrors(), nil
} | [
-0.9247344732284546,
-0.7553206086158752,
0.4056607484817505,
0.4194389879703522,
-0.4005889594554901,
-0.02353391796350479,
-0.27909210324287415,
-0.7722727060317993,
-0.770864725112915,
0.5634136199951172,
0.5067643523216248,
-0.7589641213417053,
-1.1314088106155396,
0.5598979592323303,
... |
func (g *Group) AssociateContacts(tx *pop.Connection, contactIDs []uuid.UUID) (*validate.Errors, error) {
for _, cID := range contactIDs {
tmp := &ContactGroup{
GroupID: g.ID,
ContactID: cID,
}
if verrs, err2 := tx.ValidateAndCreate(tmp); verrs.HasAny() || err2 != nil {
return verrs, err2
}
}
ret... | [
-1.2560803890228271,
-0.41203105449676514,
0.25508177280426025,
0.4493790864944458,
0.7356412410736084,
-0.485607385635376,
0.8095912337303162,
-1.2281193733215332,
-0.5159012079238892,
0.26981642842292786,
0.509924590587616,
-1.789406657218933,
-0.7789124250411987,
0.9381008148193359,
-... |
func (g *Group) DissociateContacts(tx *pop.Connection, contactIDs []uuid.UUID) error {
for _, cID := range contactIDs {
contact := &Contact{}
if err := tx.Find(contact, cID); err != nil {
return err
}
if err := contact.DissociateWithGroup(tx, g.ID); err != nil {
return err
}
}
return nil
} | [
-0.8915584087371826,
-0.2541024684906006,
0.10813385248184204,
0.00967669952660799,
0.19695504009723663,
0.0876283124089241,
1.4509996175765991,
-0.7786973118782043,
-0.2636643052101135,
0.7088008522987366,
0.2860599756240845,
-1.236501693725586,
-0.6404089331626892,
0.5124072432518005,
... |
func DefaultConfig(scale cachescale.Func) IndexConfig {
return IndexConfig{
Caches: IndexCacheConfig{
ForklessCausePairs: scale.I(20000),
HighestBeforeSeqSize: scale.U(160 * 1024),
LowestAfterSeqSize: scale.U(160 * 1024),
},
}
} | [
-0.1419895589351654,
0.9132617115974426,
0.3216792941093445,
0.5631921887397766,
-0.5447126030921936,
-0.4829871356487274,
0.36215612292289734,
0.5822136402130127,
-0.2206651121377945,
0.13230504095554352,
-0.5775339603424072,
-0.2536889910697937,
-0.00008973708463599905,
0.448423236608505... |
func LiteConfig() IndexConfig {
return IndexConfig{
Caches: IndexCacheConfig{
ForklessCausePairs: 500,
HighestBeforeSeqSize: 4 * 1024,
LowestAfterSeqSize: 4 * 1024,
},
}
} | [
0.1576891839504242,
0.36213287711143494,
0.2592218518257141,
-0.48810842633247375,
-0.3703550398349762,
-0.804306149482727,
-0.23554323613643646,
0.6861556768417358,
-0.027903614565730095,
0.29124486446380615,
-0.957664966583252,
-0.23180867731571198,
-0.5490511059761047,
0.042396653443574... |
func NewIndex(crit func(error), config IndexConfig) *Index {
vi := &Index{
cfg: config,
crit: crit,
}
vi.Engine = vecengine.NewIndex(crit, vi.GetEngineCallbacks())
vi.initCaches()
return vi
} | [
0.5701500177383423,
-0.11065022647380829,
0.020978033542633057,
0.853912889957428,
-0.324937105178833,
0.12658387422561646,
0.3624408543109894,
0.7834945321083069,
0.15678957104682922,
-0.18740178644657135,
-0.3224952518939972,
0.4916987717151642,
-0.0005383520037867129,
-0.142480447888374... |
func (vi *Index) GetMergedHighestBefore(id hash.Event) *HighestBeforeSeq {
return vi.Engine.GetMergedHighestBefore(id).(*HighestBeforeSeq)
} | [
-0.036588869988918304,
0.09559308737516403,
0.6043861508369446,
0.9710838794708252,
0.4822438657283783,
-0.6220435500144958,
-0.18468326330184937,
-0.09262095391750336,
0.22942626476287842,
-0.29151421785354614,
-1.2014784812927246,
0.32281264662742615,
-0.7723532319068909,
0.2162309437990... |
func main() {
a := Gps4dLoc{}
a.Lati = 23.333
a.Long = 123.3333
ugi := UserGpsInfo{}
ugi.CurrentLoc.Lati = 12.3
ugi.CurrentLoc.Long = 123.333
testloc := Gps2dLoc{12.3, 22.3}
if ugi.CameraLoc.Loc == nil {
fmt.Println("cameraloc is nil")
fmt.Println(ugi.CameraLoc)
ugi.CameraLoc.Loc = append(ugi.CameraLoc.... | [
-0.09701515734195709,
-0.8981562256813049,
0.8208975195884705,
0.22295697033405304,
0.16425836086273193,
0.4611193537712097,
0.8424068689346313,
0.27414897084236145,
0.16476167738437653,
-0.5244130492210388,
0.03992248326539993,
-0.1391829550266266,
0.43246209621429443,
0.02174318023025989... |
func (i *VarlinkAPI) GetInfo(call iopodman.VarlinkCall) error {
versionInfo, err := define.GetVersion()
if err != nil {
return err
}
podmanInfo := iopodman.PodmanInfo{}
info, err := i.Runtime.Info()
if err != nil {
return call.ReplyErrorOccurred(err.Error())
}
distribution := iopodman.InfoDistribution{
D... | [
-0.48240455985069275,
-0.31943279504776,
0.6889219284057617,
-0.2365439236164093,
0.46550434827804565,
-0.3133505880832672,
-0.24841073155403137,
-0.5881413221359253,
-0.37272149324417114,
-0.5406859517097473,
-0.3584556579589844,
0.7915483117103577,
-0.8211864233016968,
0.2615939974784851... |
func (Account) TableName() string {
tableName := "accounts"
if namespace.GetNamespace() != "" {
return namespace.GetNamespace() + "_" + tableName
}
return tableName
} | [
0.8036327362060547,
0.2137615978717804,
0.4324209988117218,
0.6270997524261475,
-0.42508864402770996,
0.04619457572698593,
0.1350158154964447,
-0.3600243330001831,
0.4651169180870056,
-0.07445104420185089,
0.8493304252624512,
0.4295324683189392,
0.7452453970909119,
0.6085114479064941,
0.... |
func (a *Account) BeforeSave(tx *pop.Connection) error {
now := time.Now()
a.UpdatedAt = now
return nil
} | [
0.01316482201218605,
0.05191556736826897,
0.5725706219673157,
-0.48787885904312134,
0.12122883647680283,
-0.43319305777549744,
-0.8043184876441956,
-0.631615400314331,
-0.44537994265556335,
0.8944243788719177,
-0.24367932975292206,
-0.5057119727134705,
-0.12784412503242493,
0.1841459423303... |
func (a *Account) IsOwner(userID uuid.UUID) bool {
for _, value := range a.OwnerIDs {
if value == userID.String() {
return true
}
}
return false
} | [
-0.7674065828323364,
-0.4439787268638611,
0.08351100981235504,
1.1433913707733154,
-0.3471997082233429,
-0.28570181131362915,
0.3642334043979645,
-0.31565535068511963,
0.24369703233242035,
0.37133511900901794,
0.5363600254058838,
0.4846954047679901,
-0.599763035774231,
0.1970469057559967,
... |
func (a *Account) IsMember(userID uuid.UUID) bool {
for _, value := range a.AccountUser {
if value.ID == userID {
return true
}
}
return false
} | [
-0.5614332556724548,
-0.28209537267684937,
-0.09034010022878647,
0.8798104524612427,
-0.2707297205924988,
0.0262960996478796,
-0.14602544903755188,
0.3304097652435303,
0.5146874785423279,
0.27568015456199646,
0.0729905515909195,
0.8781509399414062,
-0.8942127823829651,
0.3674471974372864,
... |
func (a *Account) HasPermissionTo(tx *storage.Connection, permission string, userID uuid.UUID) bool {
// get related roles with permissions
roles, err := FindRolesByAccount(tx, a.ID)
if err != nil {
return false
}
for _, user := range a.AccountUser {
if user.UserID == userID {
for _, role := range roles {
... | [
0.8538848161697388,
-0.17709283530712128,
0.776801347732544,
0.22856615483760834,
-0.3319644629955292,
-1.1530073881149292,
0.09937434643507004,
0.2732737064361572,
-0.1032855361700058,
0.6384249925613403,
0.46386978030204773,
-0.058985330164432526,
-0.2860822379589081,
0.05892394110560417... |
func (a *Account) UpdateName(tx *storage.Connection, newName string) error {
if newName == "" {
return errors.New("Error: invalid name")
}
a.Name = newName
return tx.UpdateOnly(a, "name", "updated_at")
} | [
-0.42120540142059326,
-0.40971654653549194,
0.5425497889518738,
0.35146409273147583,
-0.9741458892822266,
-0.6946594715118408,
-0.5729258060455322,
0.2640823721885681,
-0.20438364148139954,
1.6068828105926514,
-0.578790009021759,
-0.24100561439990997,
-0.051990605890750885,
-0.229586750268... |
func (a *Account) UpdateBillingName(tx *storage.Connection, newName string) error {
if newName == "" {
return errors.New("Error: invalid name")
}
a.BillingName = newName
return tx.UpdateOnly(a, "billing_name", "updated_at")
} | [
-0.8106159567832947,
-0.0426783561706543,
0.3020731508731842,
0.7065733075141907,
-1.3497951030731201,
0.12801088392734528,
-0.3745817244052887,
0.8504111766815186,
-0.27005940675735474,
1.328744888305664,
-0.465711772441864,
-0.7757323980331421,
-0.7496197819709778,
0.6658445000648499,
... |
func (a *Account) UpdateBillingDetails(tx *storage.Connection, newName string) error {
if newName == "" {
return errors.New("Error: invalid details")
}
a.BillingName = newName
return tx.UpdateOnly(a, "billing_details", "updated_at")
} | [
-0.23570841550827026,
0.14813944697380066,
0.14750303328037262,
0.6427742838859558,
-1.0911107063293457,
0.27807125449180603,
-0.2809382677078247,
0.5238818526268005,
-0.1957782804965973,
0.8419490456581116,
-0.28287777304649353,
-0.4389258921146393,
-0.7391124367713928,
0.4823846518993377... |
func (a *Account) UpdateBillingEmail(tx *storage.Connection, newName string) error {
if newName == "" {
return errors.New("Error: invalid E-Mail")
}
a.BillingEmail = newName
return tx.UpdateOnly(a, "billing_email", "updated_at")
} | [
-0.6906194090843201,
0.14523011445999146,
0.20962123572826385,
0.7446259260177612,
-0.9102339148521423,
0.3766908645629883,
-0.04832731559872627,
1.1514158248901367,
-1.1038480997085571,
1.2007355690002441,
-0.6605558395385742,
0.4346427917480469,
-0.8562049269676208,
0.172894686460495,
... |
func (a *Account) UpdateAccountMetaData(tx *storage.Connection, updates map[string]interface{}) error {
if a.AccountMetaData == nil {
a.AccountMetaData = updates
} else if updates != nil {
for key, value := range updates {
if value != nil {
a.AccountMetaData[key] = value
} else {
delete(a.AccountMet... | [
-0.9831823110580444,
-0.7447255253791809,
0.542398989200592,
0.035971738398075104,
-0.38420382142066956,
-0.009149822406470776,
-0.8307715058326721,
0.4749149978160858,
0.6172714829444885,
1.2773857116699219,
-0.03726518899202347,
0.1845441609621048,
-0.25043952465057373,
-0.77333199977874... |
func NewAccount(instanceID uuid.UUID, name, aud string) (*Account, error) {
id, err := uuid.NewV4()
if err != nil {
return nil, errors.Wrap(err, "Error generating unique id")
}
account := &Account{
InstanceID: instanceID,
ID: id,
Aud: aud,
Name: name,
}
return account, nil
} | [
-0.35158151388168335,
-0.6475152373313904,
0.15912848711013794,
0.09475655853748322,
-0.2082916796207428,
0.49552416801452637,
0.30772659182548523,
0.3413241505622864,
0.781733512878418,
1.0000321865081787,
-0.13490834832191467,
1.2157913446426392,
0.016728335991501808,
-0.6989993453025818... |
func DeleteAccount(tx *storage.Connection, accountID uuid.UUID) (bool, error) {
if err := tx.Destroy(&Account{ID: accountID}); err != nil {
return false, err
}
return true, nil
} | [
-0.38957083225250244,
0.5839078426361084,
0.6891842484474182,
0.2571471929550171,
0.5340232849121094,
0.021539509296417236,
0.13307097554206848,
0.7030828595161438,
0.7099186778068542,
0.7702973484992981,
-0.18290957808494568,
-0.5354845523834229,
-0.515277087688446,
-0.18097929656505585,
... |
func FindAccountByID(tx *storage.Connection, id uuid.UUID) (*Account, error) {
return findAccount(tx, "id = ?", id)
} | [
0.38282009959220886,
-0.769652247428894,
0.007897707633674145,
0.9121894836425781,
-0.07742007821798325,
-0.6051158905029297,
0.33182284235954285,
-0.7934558987617493,
0.1972157061100006,
0.6191975474357605,
0.32691097259521484,
-0.46556830406188965,
-0.46517443656921387,
0.407508105039596... |
func FindAccounts(tx *storage.Connection, userID uuid.UUID, pageParams *Pagination, sortParams *SortParams) ([]*Account, error) {
accounts := []*Account{}
var err error
pop.Debug = true
q := tx.Q()
if userID.String() != "00000000-0000-0000-0000-000000000000" {
// UserID is not nil, so we have to query for the r... | [
0.27447956800460815,
0.2391940951347351,
0.7717407941818237,
0.2137569934129715,
0.42773574590682983,
-0.43278244137763977,
0.9075018763542175,
-0.6090202331542969,
0.5282552242279053,
0.11176200211048126,
1.2849467992782593,
-0.21641162037849426,
0.16270679235458374,
1.2233651876449585,
... |
func UUID(random bool) string {
if !random {
key, err := uuid.NewUUID() //按时间戳生成uuid
if err != nil {
return ""
}
return key.String()
}
return uuid.New().String() //随机生成uuid
} | [
-0.7753879427909851,
0.07518023997545242,
0.6947633028030396,
-0.47895348072052,
-0.7281150221824646,
1.045582890510559,
0.24093863368034363,
1.1684094667434692,
-0.047563016414642334,
0.5772991180419922,
0.6849633455276489,
0.31077733635902405,
-0.41899049282073975,
-0.4564574956893921,
... |
func UUIDFile(fpath string) (string, error) {
_, err := os.Stat(fpath)
if err != nil && !os.IsExist(err) {
key := uuid.New().String()
if err := ioutil.WriteFile(fpath, []byte(key), 0777); err != nil {
return "", err
}
return key, nil
}
fp, err := os.Open(fpath)
if err != nil {
return "", err
}
de... | [
-0.09285349398851395,
-0.5390320420265198,
0.9380200505256653,
-0.8900516629219055,
-0.6795546412467957,
0.6199498176574707,
0.5893272757530212,
0.4952586591243744,
-0.8972040414810181,
1.0825223922729492,
0.21508954465389252,
-0.8456087112426758,
-0.09572620689868927,
-0.7011200189590454,... |
func (cfg *awsFetcherConfig) CheckAndSetDefaults(component string) error {
if cfg.AWSClients == nil {
return trace.BadParameter("missing parameter AWSClients")
}
if cfg.Type == "" {
return trace.BadParameter("missing parameter Type")
}
if len(cfg.Labels) == 0 {
return trace.BadParameter("missing parameter La... | [
0.23863153159618378,
0.14525116980075836,
0.5018235445022583,
-0.1813579648733139,
0.9972785115242004,
-0.1704675257205963,
0.019964003935456276,
-0.35795146226882935,
-0.7512651085853577,
0.590179979801178,
-0.15198615193367004,
0.5217355489730835,
0.06201930716633797,
1.822862982749939,
... |
func newAWSFetcher(cfg awsFetcherConfig, plugin awsFetcherPlugin) (*awsFetcher, error) {
if err := cfg.CheckAndSetDefaults(plugin.ComponentShortName()); err != nil {
return nil, trace.Wrap(err)
}
return &awsFetcher{cfg: cfg, plugin: plugin}, nil
} | [
0.5945542454719543,
-0.7592267990112305,
-0.15721257030963898,
-0.023670045658946037,
-0.7496375441551208,
-0.46322357654571533,
-0.5446500182151794,
-0.06419651210308075,
-0.3062787652015686,
0.10183229297399521,
-0.8824989795684814,
0.1457955241203308,
0.2015921026468277,
1.2479739189147... |
func (f *awsFetcher) Get(ctx context.Context) (types.ResourcesWithLabels, error) {
databases, err := f.getDatabases(ctx)
if err != nil {
return nil, trace.Wrap(err)
}
f.rewriteDatabases(databases)
return databases.AsResources(), nil
} | [
-0.6277016401290894,
0.3711494207382202,
0.41093987226486206,
-0.8245236277580261,
0.8413880467414856,
0.12304232269525528,
-0.08734485507011414,
-0.1434108465909958,
-0.1986425817012787,
0.2883144021034241,
0.36242154240608215,
0.23041106760501862,
0.19251294434070587,
0.4305172562599182,... |
func (f *awsFetcher) rewriteDatabases(databases types.Databases) {
for _, db := range databases {
f.applyAssumeRole(db)
common.ApplyAWSDatabaseNameSuffix(db, f.cfg.Type)
}
} | [
-1.0783354043960571,
0.9522739052772522,
0.3537915349006653,
0.16725721955299377,
0.8351861238479614,
0.8663051724433899,
0.9216008186340332,
0.4503204822540283,
0.2762802541255951,
0.6178370714187622,
0.08649545907974243,
0.5284720659255981,
0.05792611837387085,
0.9299212694168091,
0.53... |
func (f *awsFetcher) applyAssumeRole(db types.Database) {
db.SetAWSAssumeRole(f.cfg.AssumeRole.RoleARN)
db.SetAWSExternalID(f.cfg.AssumeRole.ExternalID)
} | [
0.23715747892856598,
0.09251755475997925,
0.389597088098526,
-0.64544278383255,
0.11837959289550781,
0.42462873458862305,
-0.13382339477539062,
1.1051522493362427,
-0.11076348274946213,
0.7676169276237488,
0.37695810198783875,
0.3914450705051422,
0.5683817863464355,
1.4423749446868896,
1... |
func (f *awsFetcher) Cloud() string {
return types.CloudAWS
} | [
0.1139744445681572,
0.9706439971923828,
0.04015963897109032,
-0.21043646335601807,
-0.47610899806022644,
1.558471918106079,
0.2561876177787781,
-0.7209205627441406,
0.29046088457107544,
-0.7982900738716125,
0.07996072620153427,
0.3281235694885254,
1.4327120780944824,
0.6148830652236938,
... |
func (f *awsFetcher) ResourceType() string {
return types.KindDatabase
} | [
0.7095483541488647,
0.8297138214111328,
-0.053800132125616074,
-0.8267714381217957,
0.5579056143760681,
0.6311403512954712,
0.28064149618148804,
-0.2581433653831482,
0.3402292728424072,
0.5018717646598816,
0.476557195186615,
0.0329451784491539,
-0.04169362038373947,
1.0193012952804565,
-... |
func (f *awsFetcher) String() string {
return fmt.Sprintf("awsFetcher(Type: %v, Region=%v, Labels=%v)",
f.cfg.Type, f.cfg.Region, f.cfg.Labels)
} | [
0.34550344944000244,
-0.2650562524795532,
-0.005900940857827663,
-0.7518630027770996,
-0.24843141436576843,
0.7579770684242249,
-0.10727275907993317,
-1.1099766492843628,
-1.4463026523590088,
0.3319084942340851,
0.2649245262145996,
0.6995479464530945,
0.49533194303512573,
0.434256076812744... |
func (*GrpcAPIService) Descriptor() ([]byte, []int) {
return file_internal_descriptor_apiconfig_apiconfig_proto_rawDescGZIP(), []int{0}
} | [
-1.215482473373413,
-0.1464574635028839,
0.3536487817764282,
-0.5386725664138794,
-0.37426719069480896,
-0.1510392278432846,
0.1484987884759903,
0.03517679497599602,
-0.19502128660678864,
-0.4508413076400757,
-0.7844159007072449,
-0.10326790064573288,
-0.3782852292060852,
0.568827927112579... |
func main (a int ) {
} | [
-0.09158043563365936,
-0.05166896805167198,
0.17408347129821777,
0.2780137062072754,
-0.16669000685214996,
0.009340978227555752,
2.190791606903076,
0.4494163691997528,
0.5316498875617981,
-0.38238823413848877,
-0.3585679829120636,
0.09482581913471222,
0.21748483180999756,
0.556915163993835... |
func Lock() {
lock.Lock()
} | [
0.372556209564209,
1.1383639574050903,
0.20425063371658325,
0.4312044084072113,
0.8231360912322998,
0.7999560236930847,
1.025242567062378,
-0.26278555393218994,
0.040101852267980576,
-2.034430503845215,
0.3348742723464966,
0.40446990728378296,
-0.44612616300582886,
-0.2900233268737793,
0... |
func Unlock() {
lock.Unlock()
} | [
-0.08511009067296982,
0.7376714944839478,
0.17791852355003357,
0.6570663452148438,
0.4322997033596039,
0.4258683919906616,
0.004693463444709778,
1.2910239696502686,
-0.08970104902982712,
-0.8338748216629028,
0.14953801035881042,
0.9859978556632996,
-0.3352050185203552,
-0.6266021728515625,... |
func Redraw() {
select {
case drawChan <- true:
default:
// channel is full
}
} | [
-0.0020345449447631836,
0.7171791195869446,
0.6395935416221619,
-0.3523310720920563,
0.34077024459838867,
0.30231937766075134,
-0.8212141394615173,
-0.7339766621589661,
0.022424327209591866,
-1.0253828763961792,
0.230812206864357,
0.8613289594650269,
-0.4439135491847992,
0.0303579308092594... |
func DrawChan() chan bool {
return drawChan
} | [
-1.1002824306488037,
0.5831443071365356,
0.4108085036277771,
-0.7002760767936707,
-0.4657104015350342,
1.5433381795883179,
-0.6759751439094543,
0.014983522705733776,
0.46831101179122925,
-0.9118399620056152,
-0.36266908049583435,
1.044756293296814,
-0.4912116825580597,
-0.2681947946548462,... |
func ShowFakeCursor(x, y int) {
r, combc, style, _ := Screen.GetContent(x, y)
Screen.SetContent(lastCursor.x, lastCursor.y, lastCursor.r, lastCursor.combc, lastCursor.style)
Screen.SetContent(x, y, r, combc, config.DefStyle.Reverse(true))
lastCursor.x, lastCursor.y = x, y
lastCursor.r = r
lastCursor.combc = comb... | [
-0.025572555139660835,
-0.25539103150367737,
0.6023380756378174,
-1.2080045938491821,
0.21642491221427917,
-0.42774686217308044,
0.4820871949195862,
-0.21536892652511597,
0.09484998881816864,
1.4074137210845947,
-0.40541157126426697,
1.7713558673858643,
-0.38120391964912415,
0.822265207767... |
func ShowFakeCursorMulti(x, y int) {
r, _, _, _ := Screen.GetContent(x, y)
Screen.SetContent(x, y, r, nil, config.DefStyle.Reverse(true))
} | [
-0.07701835036277771,
0.44370603561401367,
0.3676740527153015,
-0.3651120066642761,
0.01851803995668888,
-0.4817819595336914,
0.1984344720840454,
-0.24520708620548248,
-0.2794773578643799,
1.3732545375823975,
-1.0602500438690186,
1.3033630847930908,
-0.1555318385362625,
0.8428257703781128,... |
func ShowCursor(x, y int) {
if UseFake() {
ShowFakeCursor(x, y)
} else {
Screen.ShowCursor(x, y)
}
} | [
0.44344034790992737,
0.3547632098197937,
0.5297953486442566,
0.02822769060730934,
-0.9027022123336792,
-0.24222871661186218,
0.062089767307043076,
0.23388443887233734,
0.5655803084373474,
1.0763964653015137,
-0.022200867533683777,
1.7898685932159424,
0.33917027711868286,
1.381564974784851,... |
func SetContent(x, y int, mainc rune, combc []rune, style tcell.Style) {
if !Screen.CanDisplay(mainc, true) {
mainc = '�'
}
Screen.SetContent(x, y, mainc, combc, style)
if UseFake() && lastCursor.x == x && lastCursor.y == y {
lastCursor.r = mainc
lastCursor.style = style
lastCursor.combc = combc
}
} | [
0.19902651011943817,
-0.1070571169257164,
0.4841192066669464,
-0.0017237134743481874,
-0.28136783838272095,
0.051087647676467896,
1.017703890800476,
-0.32598498463630676,
0.004862354137003422,
0.9608483910560608,
0.3612132668495178,
0.1799294352531433,
-0.42824676632881165,
0.3151023685932... |
func TempFini() bool {
screenWasNil := Screen == nil
if !screenWasNil {
Screen.Fini()
Lock()
Screen = nil
}
return screenWasNil
} | [
-0.31665024161338806,
-0.15294411778450012,
0.40741562843322754,
0.48578110337257385,
-0.01742642931640148,
-0.33294880390167236,
0.11666028201580048,
-0.43490907549858093,
-0.16730467975139618,
0.5938114523887634,
-1.075368881225586,
-1.2146738767623901,
-0.8842453956604004,
1.68500685691... |
func TempStart(screenWasNil bool) {
if !screenWasNil {
Init()
Unlock()
}
} | [
0.46190962195396423,
-0.17267490923404694,
0.3875960409641266,
0.2066851109266281,
0.10268855839967728,
-0.2555699944496155,
0.30276307463645935,
0.552573561668396,
1.2156054973602295,
0.592798113822937,
-0.11330051720142365,
-0.10793467611074448,
-0.343075692653656,
0.6165587306022644,
... |
func Init() error {
drawChan = make(chan bool, 8)
// Should we enable true color?
truecolor := os.Getenv("MICRO_TRUECOLOR") == "1"
if !truecolor {
os.Setenv("TCELL_TRUECOLOR", "disable")
}
var oldTerm string
modifiedTerm := false
setXterm := func() {
oldTerm = os.Getenv("TERM")
os.Setenv("TERM", "xterm... | [
0.09882838279008865,
0.017124636098742485,
0.9063658118247986,
-0.6338518261909485,
-0.10024387389421463,
0.3723042905330658,
0.11824151128530502,
-0.09839921444654465,
0.08516562730073929,
0.9180532097816467,
-0.0222894549369812,
0.5959423184394836,
0.24195638298988342,
1.3356328010559082... |
func InitSimScreen() (tcell.SimulationScreen, error) {
drawChan = make(chan bool, 8)
// Initilize tcell
var err error
s := tcell.NewSimulationScreen("")
if s == nil {
return nil, errors.New("Failed to get a simulation screen")
}
if err = s.Init(); err != nil {
return nil, err
}
s.SetSize(80, 24)
Screen ... | [
0.027815913781523705,
0.9398785829544067,
0.7016859650611877,
0.2918410003185272,
-0.4667992889881134,
-0.18757770955562592,
0.15085065364837646,
-0.5909051895141602,
0.7884505391120911,
0.34606441855430603,
-0.9046871066093445,
-0.017772389575839043,
-0.4997856914997101,
0.708973586559295... |
func GetJSONContent(v interface{}, r *http.Request) error {
defer r.Body.Close()
return json.NewDecoder(r.Body).Decode(v)
} | [
-0.5805622935295105,
-0.20229168236255646,
0.6189140677452087,
-0.09765666723251343,
-1.1515916585922241,
-0.18511559069156647,
-0.6300713419914246,
-1.4804936647415161,
0.04189002513885498,
0.79254549741745,
-0.5781968235969543,
0.7517754435539246,
-0.0061778416857123375,
-0.5491492748260... |
func JSONWithHTTPCode(w http.ResponseWriter, d interface{}, code int) {
w.Header().Set(ResponseHeaderContentTypeKey, ResponseHeaderContentTypeJSONUTF8)
w.WriteHeader(code)
if d != nil {
err := json.NewEncoder(w).Encode(d)
if err != nil {
// panic will cause the http.StatusInternalServerError to be send to use... | [
-0.5707399249076843,
-0.7373688817024231,
0.7047486305236816,
-0.4351368546485901,
-0.9186306595802307,
-0.3102007210254669,
-0.33229145407676697,
-0.837094783782959,
0.23422236740589142,
1.088042140007019,
-0.44052866101264954,
-0.32044872641563416,
0.4852321743965149,
0.7977815866470337,... |
func JSON(w http.ResponseWriter, d interface{}) {
JSONWithHTTPCode(w, d, http.StatusOK)
} | [
-0.21809987723827362,
-0.7300348281860352,
0.5703966021537781,
0.173302561044693,
-0.9262647032737732,
0.3562183380126953,
0.7005300521850586,
0.005796467419713736,
0.29860323667526245,
-0.12034894526004791,
-0.5122858285903931,
0.5141728520393372,
0.9567041993141174,
1.1871650218963623,
... |
func GetClaimsFromContext(r *http.Request) *Claims {
return r.Context().Value("claims").(*Claims)
} | [
0.7981976866722107,
0.026458190754055977,
0.13262726366519928,
-0.09002086520195007,
0.5848965048789978,
0.5348932147026062,
-1.5360512733459473,
-1.5137639045715332,
0.8065968155860901,
-0.48136061429977417,
0.43695661425590515,
0.21638935804367065,
0.4896729588508606,
0.2002241313457489,... |
func GetDelegates(node client.ABCIClient) (map[address.Address][]address.Address, *rpctypes.ResultABCIQuery, error) {
// perform the query
res, err := node.ABCIQuery(query.DelegatesEndpoint, nil)
if err != nil {
return nil, res, err
}
if code.ReturnCode(res.Response.Code) != code.OK {
if res.Response.Log != ""... | [
0.3186202347278595,
0.2896707355976105,
0.7910143733024597,
-1.2281910181045532,
0.6169349551200867,
-0.5842833518981934,
-0.4420848786830902,
-0.06519494950771332,
-0.1447426676750183,
0.06640013307332993,
0.08498499542474747,
0.613964319229126,
-0.6889878511428833,
0.2937754988670349,
... |
func NewNonce(nonce string) *uos.Action {
a := &uos.Action{
Account: AN("uosio"),
Name: ActN("nonce"),
Authorization: []uos.PermissionLevel{
//{Actor: AN("uosio"), Permission: PN("active")},
},
ActionData: uos.NewActionData(Nonce{
Value: nonce,
}),
}
return a
} | [
-0.06879162043333054,
-0.4980717897415161,
0.6145164966583252,
1.3636209964752197,
-0.31565240025520325,
-0.5393978357315063,
0.7689539194107056,
-0.029211213812232018,
0.8856223225593567,
0.14518322050571442,
0.3730253577232361,
0.21731685101985931,
0.04399043321609497,
-0.661803901195526... |
func Seman(ast *parser.Node) *parser.Node {
fmt.Printf("\n[AST]\n\n")
parser.Display(ast, 0, true)
return ast
} | [
0.020770691335201263,
-0.7593573927879333,
0.4568442702293396,
-1.1676418781280518,
-1.2767727375030518,
0.0029929478187114,
-0.6222360730171204,
0.28784629702568054,
0.5989593267440796,
-0.23200547695159912,
0.4623790681362152,
0.824919581413269,
0.4780829846858978,
0.674100399017334,
0... |
func NewIdentifier(login string, password string) *Identifier {
return &Identifier{
login: login,
password: password,
authEndpoint: authEndpoint,
HTTPClient: &http.Client{Timeout: 10 * time.Second},
}
} | [
-0.1030060201883316,
-1.2497998476028442,
0.3312371075153351,
-0.21915797889232635,
-0.6154314875602722,
0.6262238025665283,
-0.6619934439659119,
0.5046301484107971,
0.6200969815254211,
0.14532606303691864,
-0.6570595502853394,
0.7705791592597961,
-0.5580254793167114,
-0.13077792525291443,... |
func (c *Identifier) Authentication(ctx context.Context, sessionLifetime int, sessionUpdateLifetime bool) (string, error) {
sul := "N"
if sessionUpdateLifetime {
sul = "Y"
}
ar := AuthRequest{
Login: c.login,
AuthData: c.password,
AuthType: "plain",
SessionLifeti... | [
-1.052309513092041,
-0.3837566375732422,
0.8335813283920288,
0.29242587089538574,
-1.4659513235092163,
0.05482998490333557,
-0.4075930118560791,
-0.633550763130188,
0.6523237824440002,
1.2905343770980835,
-0.0234842486679554,
-0.0944724828004837,
-0.28188756108283997,
-0.3077581226825714,
... |
func (lvar Variable) GetContentConstraint() (content string, isFixed bool, err bool) {
if lvar.Value != "" {
return lvar.Value, true, false
}
if lvar.String_constraints.Content != "" {
return lvar.String_constraints.Content, false, false
}
return "", false, true
} | [
0.12033139914274216,
-0.7516970634460449,
0.6281076073646545,
-0.49638476967811584,
-0.5537320971488953,
-0.1641092598438263,
0.38829997181892395,
-0.8206727504730225,
-1.0751112699508667,
0.5542356371879578,
-0.48948946595191956,
0.004855873994529247,
-1.0453766584396362,
-0.2352008223533... |
func watchDir(watcher *fsnotify.Watcher, path string, fi os.FileInfo, err error) error {
// since fsnotify can watch all the files in a directory, watchers only need
// to be added to each nested directory
if fi.Mode().IsDir() {
log.Printf("Added %v", path)
return watcher.Add(path)
}
return nil
} | [
0.7094886898994446,
-0.053082868456840515,
0.44000694155693054,
0.7590224742889404,
-0.39794838428497314,
0.5704021453857422,
0.18459008634090424,
0.5012686848640442,
-0.6469646096229553,
-1.0086843967437744,
-0.017021581530570984,
0.20576240122318268,
0.20207488536834717,
0.97461616992950... |
func hashPassword(password string) string {
//TODO: hash password with salt?
sum := sha256.Sum256([]byte(password))
return hex.EncodeToString(sum[:])
} | [
0.9955441355705261,
-0.20917139947414398,
0.4727117419242859,
0.49141567945480347,
0.01129100751131773,
0.24972866475582123,
-0.3141731917858124,
0.6599746346473694,
1.132094144821167,
0.3690970540046692,
-0.4250126779079437,
0.12343621999025345,
-0.13033190369606018,
0.10379071533679962,
... |
func CreateUser(user *User) error {
//Validate fields
//Username must be between 3 and 20 alphanumeric characters
invalidCharsRegex := regexp.MustCompile("[^A-Za-z0-9]+")
if len(user.Username) < 3 || len(user.Username) > 20 || invalidCharsRegex.MatchString(user.Username) {
return errors.New("u... | [
-0.5348739624023438,
0.1830103099346161,
0.998285710811615,
0.09739606827497482,
0.1804102659225464,
0.48796358704566956,
0.5513686537742615,
0.02411589026451111,
-0.07612095028162003,
0.6916766166687012,
-1.6249079704284668,
-0.7423135638237,
-0.3336677551269531,
-0.16609597206115723,
0... |
func Login(user *User) (accessToken string, err error) {
fmt.Printf("Login...")
db, err := bolt.Open(DB_NAME, 0600, nil)
if err != nil {
panic(err)
}
defer db.Close()
err = db.Update(func(tx *bolt.Tx) error {
userBucket := tx.Bucket([]byte(USER_BUCKET))
//retr... | [
-0.1927739530801773,
-0.16320165991783142,
1.0324084758758545,
-0.35771724581718445,
-0.7656663656234741,
-0.001782150357030332,
-0.012229178100824356,
0.3088148534297943,
-0.0032525560818612576,
0.1188487634062767,
-0.9918893575668335,
0.2989543676376343,
0.416415274143219,
-0.68724924325... |
func ValidateToken(accessToken string) (userID string, err error) {
if accessToken == "" {
return "", errors.New("invalid accessToken")
}
db, err := bolt.Open(DB_NAME, 0600, nil)
if err != nil {
panic(err)
}
defer db.Close()
err = db.View(func(tx *bolt.Tx) error {
... | [
0.1045389473438263,
-0.06697970628738403,
0.7603021860122681,
-0.646489143371582,
-0.6307156085968018,
0.2996920049190521,
0.17821858823299408,
0.44630300998687744,
0.14925803244113922,
-0.21325823664665222,
0.07266923040151596,
0.7700056433677673,
0.2624431252479553,
-0.20622111856937408,... |
func (r Route53) Perform(acmeClient *acme.Client, authorization *acme.Authorization, hostname string) error {
// get a route53 client that can perform crud actions against route53
r53, err := newRoute53Client(r)
if err != nil {
return err
}
// extract the dns challenge from the authorization
challenge, err := ... | [
0.010591871105134487,
0.9388090968132019,
0.7202298641204834,
-0.1839861422777176,
-0.034660860896110535,
-0.5148051977157593,
0.14387565851211548,
0.861274778842926,
-0.1103854700922966,
0.8868760466575623,
0.12367191910743713,
0.6165747046470642,
-0.3270779550075531,
-0.8219125866889954,... |
func getChallenge(authorization *acme.Authorization) (*acme.Challenge, error) {
var c *acme.Challenge
for _, v := range authorization.Challenges {
if v.Type == DNSChallenge {
c = v
break
}
}
if c == nil {
return c, fmt.Errorf("%v challenge type not in list of supported challenges: %v", DNSChallenge, au... | [
0.07033903896808624,
1.3055903911590576,
0.35073360800743103,
0.8723639845848083,
0.0038258912973105907,
-0.5450419187545776,
-0.1616782397031784,
-0.18191653490066528,
0.7358787059783936,
0.3729282319545746,
0.4803367257118225,
0.38586029410362244,
-0.3370043635368347,
0.3163914084434509,... |
func NewPromise() Promise {
return &promise{sync.Mutex{}, make(chan error), nil, nil, false}
} | [
0.6248743534088135,
-0.3336644470691681,
0.1918804794549942,
0.4992488920688629,
-0.5482887029647827,
-1.6144578456878662,
-1.5879079103469849,
-1.1639680862426758,
-0.15737175941467285,
-0.25435441732406616,
-0.137007936835289,
0.13398513197898865,
-1.0858722925186157,
0.22539179027080536... |
func (p *promise) Resolve(value interface{}) {
p.fulfill(true, value, nil)
} | [
0.3322560489177704,
0.9635257124900818,
0.46423885226249695,
0.04359972104430199,
-0.24924670159816742,
0.06692551076412201,
-1.418936014175415,
-0.06471593677997589,
-0.4783576726913452,
-0.24262948334217072,
-0.9042692184448242,
-0.759599506855011,
-0.6428278088569641,
0.6008148789405823... |
func (p *promise) Reject(err error) {
p.fulfill(false, nil, err)
} | [
-0.06445077061653137,
0.8368280529975891,
0.23673810064792633,
0.06089572608470917,
-1.0556756258010864,
0.8151192665100098,
-1.344994068145752,
0.4812321066856384,
0.019887687638401985,
-0.18997566401958466,
-0.0894516110420227,
-0.5230647325515747,
-0.9895380139350891,
0.854833722114563,... |
func New() LogWriter {
initBuf := &bytes.Buffer{}
return &logWriter{
initBuf: initBuf,
w: bufio.NewWriter(initBuf),
firstSet: true,
writeLock: new(sync.Mutex),
loggers: make([]Logger, MaxLoggers),
curLoggersIdx: new(uint32),
}
} | [
0.1520441770553589,
-1.023619532585144,
0.19467923045158386,
0.02617071196436882,
-0.533012866973877,
-1.2923686504364014,
-0.1523730456829071,
-0.03538360819220543,
-0.4458932876586914,
-0.4512934684753418,
-0.5138342976570129,
0.3586495816707611,
-0.41489553451538086,
0.38927388191223145... |
func SetWriter(new io.Writer) error {
return defaultLogWriter.SetWriter(new)
} | [
-0.7528883814811707,
0.7660075426101685,
0.08727163076400757,
0.9820391535758972,
0.12801088392734528,
-0.190643310546875,
0.05526849254965782,
0.1995641142129898,
-0.49276188015937805,
-0.3603452146053314,
-0.711784303188324,
-0.31801414489746094,
0.10878708213567734,
0.6399631500244141,
... |
func Flush() error {
return defaultLogWriter.Flush()
} | [
0.5159566402435303,
0.2921173572540283,
0.05537803843617439,
0.24082478880882263,
0.21063290536403656,
0.36726444959640503,
0.5025511980056763,
-0.055275239050388336,
-0.8824129700660706,
-0.4879148602485657,
0.6517892479896545,
0.8626497387886047,
-0.4094673991203308,
0.6570613384246826,
... |
func AddLogger(fmt string) Handle {
return defaultLogWriter.AddLogger(fmt)
} | [
-0.6594407558441162,
-0.08053026348352432,
0.30725452303886414,
0.5447081923484802,
-0.07748939096927643,
-0.12280227243900299,
-0.8161970376968384,
0.3999696373939514,
-0.12520231306552887,
-1.7867459058761597,
0.36617496609687805,
-1.141977310180664,
-0.9002032279968262,
1.22816848754882... |
func logpanic(msg, gold string) {
panic(fmt.Sprintf("Malformed log format string. %s.\n%s", msg, gold))
} | [
1.5586391687393188,
-0.6510537266731262,
0.5657178163528442,
-0.5195292234420776,
-0.446429967880249,
0.43594223260879517,
-0.6046499013900757,
-0.19459597766399384,
-0.37031885981559753,
0.08914750814437866,
0.39505136013031006,
1.348428726196289,
0.5140754580497742,
-0.479560911655426,
... |
func Log(handle Handle, args ...interface{}) error {
return defaultLogWriter.Log(handle, args...)
} | [
0.28461283445358276,
1.1865007877349854,
0.2201717048883438,
0.9095199704170227,
0.6100112795829773,
0.162411168217659,
0.4922627806663513,
0.6642732620239258,
-1.036381721496582,
-1.3512685298919678,
-0.4263785481452942,
-0.5431428551673889,
-0.22106923162937164,
0.5277382135391235,
-0.... |
func DebugDump(handle Handle) string {
return defaultLogWriter.DebugDump(handle)
} | [
0.21225720643997192,
0.4189704358577728,
0.11399606615304947,
-0.5778029561042786,
0.3461879789829254,
-0.1310710906982422,
0.38491928577423096,
-0.6875261664390564,
0.054646652191877365,
-1.1890968084335327,
-0.3391798436641693,
-0.2468639612197876,
-0.2778785824775696,
-0.060558274388313... |
func (pr *PushedRequest) ReadResponse(ctx context.Context) (*http.Response, error) {
select {
case <-ctx.Done():
pr.Cancel()
pr.pushedStream.bufPipe.CloseWithError(ctx.Err())
return nil, ctx.Err()
case <-pr.pushedStream.peerReset:
return nil, pr.pushedStream.resetErr
case resErr := <-pr.pushedStream.resc:
... | [
0.030821267515420914,
-0.964962899684906,
0.6848791837692261,
0.10136106610298157,
0.06994232535362244,
-0.3167434632778168,
-0.3489706218242645,
-0.30433475971221924,
0.7494376301765442,
0.13463342189788818,
1.0892138481140137,
-0.28247901797294617,
-1.0409560203552246,
-0.351970314979553... |
func (pr *PushedRequest) Cancel() {
pr.pushedStream.cancelStream()
} | [
1.115447998046875,
-0.5909765362739563,
0.3114931285381317,
-0.08789660036563873,
-0.30244219303131104,
0.5137617588043213,
-0.05230458080768585,
-0.011585414409637451,
-0.652323842048645,
-0.31567519903182983,
1.1008507013320923,
0.8621065616607666,
-0.7484170794487,
1.313714861869812,
... |
func handlePushEarlyReturnCancel(pushHandler PushHandler, pushedRequest *PushedRequest) {
handleReturned := make(chan struct{})
go func() {
defer close(handleReturned)
pushHandler.HandlePush(pushedRequest)
}()
select {
case <-handleReturned:
pushedRequest.Cancel()
case <-pushedRequest.pushedStream.done:
}
... | [
0.43694987893104553,
-0.3521891236305237,
0.5731515288352966,
0.3657609224319458,
-0.365439772605896,
-0.07536213845014572,
-0.400488018989563,
-0.010408859699964523,
0.08534766733646393,
0.3042871952056885,
1.034623146057129,
-0.49645403027534485,
-0.6824021339416504,
0.1995134800672531,
... |
func NewWorker(downloader Downloader, oembed OEmbed, store StoreWorker) *Worker {
return &Worker{downloader: downloader, oembed: oembed, store: store}
} | [
0.19741427898406982,
-0.6133162975311279,
0.2901538014411926,
0.6844340562820435,
-0.2664015293121338,
0.41251617670059204,
-0.6553108096122742,
0.051383163779973984,
0.526614248752594,
-0.09682579338550568,
-0.04355684667825699,
0.23149871826171875,
-0.2874002456665039,
-0.300548464059829... |
func (o *ObjectIndex) ToHex() string {
var str string
str += fmt.Sprintf("%08x", o.machine)
str += fmt.Sprintf("%04x", o.pid)
str += fmt.Sprintf("%08x", o.id)
str += fmt.Sprintf("%08x", o.Rand)
return str
} | [
-0.7487747669219971,
-0.935214102268219,
0.8906702995300293,
-1.0217901468276978,
0.5396233797073364,
1.1286571025848389,
-0.8226629495620728,
0.17620524764060974,
0.3292228579521179,
0.810309886932373,
-0.09839801490306854,
0.37380632758140564,
0.1317274272441864,
-1.1086000204086304,
0... |
func (o *ObjectIndex) Hash() uint32 {
var h uint32 = 17
var str string
str += fmt.Sprintf("%08x", o.machine)
str += fmt.Sprintf("%04x", o.pid)
str += fmt.Sprintf("%08x", o.id)
str += fmt.Sprintf("%08x", o.Rand)
for _, v := range str {
h += h*23 + uint32(v)
}
return h
} | [
0.24927918612957,
0.3012934923171997,
0.6849810481071472,
-0.8420194983482361,
0.09068891406059265,
1.2447943687438965,
-0.3607361316680908,
0.03362017869949341,
-0.3269951641559601,
-0.16053785383701324,
-0.19004493951797485,
0.837199866771698,
-0.5407987236976624,
-0.7554631233215332,
... |
func (hp *hdfsProvider) CreateBucket(bck *meta.Bck) (errCode int, err error) {
return hp.checkDirectoryExists(bck)
} | [
-0.15450958907604218,
0.8706284761428833,
0.44808897376060486,
0.4727678894996643,
1.6745524406433105,
-0.011539950035512447,
0.6257473826408386,
0.10436361283063889,
-0.14502297341823578,
-0.3034338355064392,
0.5808813571929932,
-0.1362432986497879,
-0.56625896692276,
0.6388711333274841,
... |
func (hp *hdfsProvider) HeadBucket(_ ctx, bck *meta.Bck) (bckProps cos.StrKVs,
errCode int, err error) {
if errCode, err = hp.checkDirectoryExists(bck); err != nil {
return
}
bckProps = make(cos.StrKVs)
bckProps[apc.HdrBackendProvider] = apc.HDFS
bckProps[apc.HdrBucketVerEnabled] = "false"
return
} | [
-0.03132397308945656,
-0.16485147178173065,
0.5205460786819458,
0.049650631844997406,
0.8809217214584351,
-0.12251647561788559,
0.3422817587852478,
-0.4047579765319824,
0.6824396848678589,
0.1998140513896942,
0.14941585063934326,
0.535267174243927,
-0.6268296837806702,
-0.00252581341192126... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.