text stringlengths 11 6.3k | embedding listlengths 768 768 |
|---|---|
func (list Int64Set) Min() int64 {
return list.MinBy(func(a int64, b int64) bool {
return a < b
})
} | [
-0.9381197094917297,
-0.002924448112025857,
0.28446540236473083,
0.5743739008903503,
-1.3653160333633423,
-0.34687909483909607,
-0.7295506596565247,
-0.5999211072921753,
0.38772594928741455,
-0.2685892879962921,
0.31064489483833313,
0.18077553808689117,
-0.5475047826766968,
0.5262622237205... |
func (list Int64Set) Max() (result int64) {
return list.MaxBy(func(a int64, b int64) bool {
return a < b
})
} | [
-1.1105138063430786,
0.6939622759819031,
0.35674795508384705,
0.6764112114906311,
-0.7200382351875305,
-0.839705228805542,
-0.7819888591766357,
-0.3471999764442444,
0.21217669546604156,
0.04516291618347168,
0.15496981143951416,
0.21469205617904663,
-0.4924902319908142,
0.44958463311195374,... |
func (set Int64Set) Sum() int64 {
sum := int64(0)
for v, _ := range set {
sum = sum + v
}
return sum
} | [
-1.2276943922042847,
0.12716853618621826,
0.214042529463768,
0.1635533571243286,
-0.7396218180656433,
-0.5311989188194275,
0.36981165409088135,
-0.7162622213363647,
0.15963028371334076,
-0.07522334903478622,
0.03284170478582382,
0.2584841847419739,
-0.6112834811210632,
-0.06944862008094788... |
func (set Int64Set) Equals(other Int64Set) bool {
if set.Size() != other.Size() {
return false
}
for v := range set {
if !other.Contains(v) {
return false
}
}
return true
} | [
-1.1989275217056274,
-0.2700909376144409,
0.3453316390514374,
-0.21816323697566986,
-0.7127920985221863,
-0.42903393507003784,
-1.0678678750991821,
-1.0010253190994263,
0.06592315435409546,
0.06589201092720032,
-0.4284698963165283,
0.5207933783531189,
-0.6857747435569763,
0.301079720258712... |
func UpdateDocsIndex(r *release.Release, docsIndexPath string) error {
data, err := os.ReadFile(docsIndexPath)
if err != nil {
return fmt.Errorf("reading doc index file: %w", err)
}
splitData := bytes.Split(data, linebreak)
currLineNumber := 0
// Update 'RELEASE=<number>' if branch is default branch
isDefaul... | [
-0.5569828152656555,
-1.19247567653656,
0.7112915515899658,
-0.5378462672233582,
-0.3382748067378998,
-0.11067628860473633,
0.23753151297569275,
-0.23346951603889465,
-0.38352444767951965,
0.5654513239860535,
-0.06460709124803543,
0.05487409606575966,
0.026185791939496994,
0.21629804372787... |
func NewConsulClient(addr, token string) (structs.ConsulClient, error) {
// TODO (e.westfall): Add a quick health check call to an API endpoint to
// validate connectivity or return an error back to the caller.
config := consul.DefaultConfig()
addrArr := strings.Split(addr, "://")
// Checking scheme of consul end... | [
-0.04408442974090576,
-1.1286436319351196,
0.4109622836112976,
0.6536334156990051,
-0.6261486411094666,
-0.7430856227874756,
-0.28605917096138,
-0.20349866151809692,
0.00627136928960681,
0.4080334007740021,
0.0970124900341034,
0.6500373482704163,
-0.4656323790550232,
-0.5021588802337646,
... |
func (c *consulClient) GetLeaderInfo(info *structs.LeaderResponse, key *string, session string) error {
if session == "" {
k, _, err := c.consul.KV().Get(*key, nil)
if err != nil {
return err
}
session = k.Session
}
s, _, err := c.consul.Session().Info(session, nil)
if err != nil {
return err
}
in... | [
0.16554488241672516,
-0.6615729928016663,
0.5770491361618042,
-0.04511207714676857,
0.016953444108366966,
0.18727900087833405,
-0.7128012776374817,
-0.38949984312057495,
0.6494438052177429,
0.3610107898712158,
-0.6789535284042358,
0.66818767786026,
-0.5271596908569336,
-0.21715712547302246... |
func (c *consulClient) CreateSession(ttl int, stopCh chan struct{}) (id string, err error) {
entry := &consul.SessionEntry{
TTL: fmt.Sprintf("%vs", ttl),
Name: "replicator_leader_lock",
}
// Create the key session.
logging.Debug("client/consul: obtaining Consul session with %vs TTL", ttl)
resp, _, err := c.... | [
-0.0021176880691200495,
-0.321450799703598,
0.5008663535118103,
-0.38729897141456604,
0.12406198680400848,
-0.03294740617275238,
-0.5824868679046631,
-0.8561301827430725,
0.7609527707099915,
0.726805567741394,
-0.7650363445281982,
-0.42010733485221863,
-0.6126534342765808,
-0.6275833249092... |
func (c *consulClient) LoadPoolConfig(key string) (map[string]string, error) {
// Attempt to read the pool configuration key, if present.
config, _, err := c.consul.KV().Get(key, nil)
if err != nil || config == nil {
return nil, fmt.Errorf("unable to find or read pool configuration data "+
"at path %v: %v", key... | [
-0.9921965003013611,
0.0209373626857996,
0.6748692989349365,
-1.0247766971588135,
-1.0044975280761719,
-0.4593125283718109,
-0.5494073629379272,
-0.38217446208000183,
-0.3207588493824005,
1.4602346420288086,
-1.0482910871505737,
0.20691454410552979,
-0.26923897862434387,
0.4103424549102783... |
func (c *consulClient) AcquireLeadership(key string, session *string) (acquired bool) {
// Attempt to inspect the leadership key if it is available and present.
k, _, err := c.consul.KV().Get(key, nil)
if err != nil {
logging.Error("client/consul: unable to read the leader key at %s", key)
return false
}
//... | [
-0.054383665323257446,
-0.16563822329044342,
0.7092849612236023,
0.018755581229925156,
0.06532323360443115,
-0.17407864332199097,
-0.4262424409389496,
-0.3068908154964447,
1.0068857669830322,
0.3646128475666046,
-0.15473656356334686,
0.18540915846824646,
-0.4424915909767151,
-0.20064269006... |
func (c *consulClient) ResignLeadership(key, session string) {
kp := &consul.KVPair{
Key: key,
Session: session,
}
resp, _, err := c.consul.KV().Release(kp, nil)
if err != nil {
logging.Error("client/consul: unable to successfully release leadership lock: %v", err)
return
}
// If we get a successfu... | [
-0.25640711188316345,
-0.29461801052093506,
0.34197619557380676,
-0.4362749457359314,
0.4989430010318756,
0.03997054696083069,
-0.5120563507080078,
0.3534882068634033,
0.6360902190208435,
0.4306412935256958,
-0.20273436605930328,
0.3563900589942932,
-1.0606476068496704,
0.16265276074409485... |
func (c *consulClient) renewSession(ttl string, session string, renewChan chan struct{}) {
sessionDestroyAttempts := 0
maxSessionDestroyAttempts := 5
parsedTTL, err := time.ParseDuration(ttl)
if err != nil {
return
}
go func() {
for {
select {
case <-time.After(parsedTTL / 2):
entry, _, err := c.... | [
-0.12588302791118622,
-0.4829675853252411,
0.45574668049812317,
-0.16743499040603638,
0.13545995950698853,
-1.1906734704971313,
-0.6377208828926086,
-0.5317999124526978,
0.4261080324649811,
-0.014458145014941692,
-0.25766944885253906,
0.317313015460968,
0.4170975387096405,
0.08325048536062... |
func NewClientFactory(clientConfig clientcmd.ClientConfig, cacheDir string) util.Factory {
out := &clientFactory{
clientConfig: clientConfig,
cacheDir: cacheDir,
}
out.factory = util.NewFactory(out)
return out
} | [
0.09843827039003372,
-0.6250624656677246,
0.01965375244617462,
0.12058014422655106,
-1.1545212268829346,
-0.0324116013944149,
1.0189284086227417,
-0.10384009033441544,
-0.0345672182738781,
-0.09264606982469559,
-0.5637649893760681,
0.6590556502342224,
0.4580272436141968,
0.6527867913246155... |
func computeDiscoverCacheDir(parentDir, host string) string {
// strip the optional scheme from host if its there:
schemelessHost := strings.Replace(strings.Replace(host, "https://", "", 1), "http://", "", 1)
// now do a simple collapse of non-AZ09 characters. Collisions are possible but unlikely. Even if we do co... | [
0.11575863510370255,
0.33614087104797363,
0.5611171722412109,
0.15604719519615173,
-0.5894070863723755,
-0.32517874240875244,
0.6898598074913025,
0.6077306270599365,
-0.3735424280166626,
-0.0069296169094741344,
0.19072028994560242,
0.04402487352490425,
0.28821054100990295,
0.36242240667343... |
func (l *LoadConfig) Load() (*config.AgentConfig, error) {
c, err := compcorecfg.NewServerlessConfig(l.Path)
if err != nil {
return nil, err
} else if c == nil {
return nil, fmt.Errorf("No error, but no configuration component was produced - bailing out")
}
return comptracecfg.LoadConfigFile(l.Path, c)
} | [
0.5207754969596863,
-0.2673124670982361,
0.3240053057670593,
-1.0476747751235962,
-0.27791938185691833,
0.3204415738582611,
0.11906372010707855,
-0.3365301191806793,
-0.6134033203125,
0.3048206865787506,
-0.3176219165325165,
-0.2302045077085495,
-0.6520274877548218,
-0.30021992325782776,
... |
func (s *ServerlessTraceAgent) Start(enabled bool, loadConfig Load, lambdaSpanChan chan<- *pb.Span, coldStartSpanId uint64) {
if enabled {
// Set the serverless config option which will be used to determine if
// hostname should be resolved. Skipping hostname resolution saves >1s
// in load time between gRPC cal... | [
0.8195844888687134,
-0.24704328179359436,
0.460933119058609,
-0.7969589233398438,
0.06806855648756027,
0.40261420607566833,
0.432959645986557,
0.312016099691391,
0.3742061257362366,
0.0527726486325264,
-0.8409401178359985,
1.165129542350769,
-0.12537865340709686,
0.23483799397945404,
0.3... |
func (s *ServerlessTraceAgent) Flush() {
if s.Get() != nil {
s.ta.FlushSync()
}
} | [
0.9478479623794556,
0.11727818101644516,
0.09046678245067596,
-1.0267565250396729,
0.7217514514923096,
0.20988529920578003,
0.8172208666801453,
-1.05122709274292,
0.41041889786720276,
-0.3458869457244873,
0.45860612392425537,
1.127241849899292,
0.6836363673210144,
1.052525281906128,
-0.1... |
func (s *ServerlessTraceAgent) Get() *agent.Agent {
return s.ta
} | [
0.7530584335327148,
-1.054227590560913,
0.18832805752754211,
-0.995337188243866,
0.41491174697875977,
-0.1050713062286377,
0.17082302272319794,
-0.8853127360343933,
0.6654645800590515,
-0.369964599609375,
-0.1279202401638031,
1.2136931419372559,
0.5507291555404663,
-0.68675696849823,
-0.... |
func (s *ServerlessTraceAgent) SetTags(tagMap map[string]string) {
if s.Get() != nil {
s.ta.SetGlobalTagsUnsafe(tagMap)
s.spanModifier.tags = tagMap
} else {
log.Debug("could not set tags as the trace agent has not been initialized")
}
} | [
0.11677210032939911,
0.18025410175323486,
0.3327749967575073,
-0.6011488437652588,
0.7209919095039368,
0.41668185591697693,
-0.1933293342590332,
-0.3102043867111206,
0.4459789991378784,
0.3781657814979553,
-0.9707695841789246,
0.39103132486343384,
-0.40156394243240356,
1.214673399925232,
... |
func (s *ServerlessTraceAgent) Stop() {
if s.cancel != nil {
s.cancel()
}
} | [
1.2740298509597778,
-0.5925202965736389,
0.1995171457529068,
-0.22430385649204254,
0.2665257453918457,
0.3059678077697754,
0.2847656011581421,
0.1685536503791809,
0.17910198867321014,
0.7504904866218567,
-0.4285137355327606,
0.26386693120002747,
-0.29464584589004517,
-0.40051698684692383,
... |
func filterSpanFromLambdaLibraryOrRuntime(span *pb.Span) bool {
// Filters out HTTP calls
if httpURL, ok := span.Meta[httpURLMetaKey]; ok {
if strings.HasPrefix(httpURL, lambdaExtensionURLPrefix) {
log.Debugf("Detected span with http url %s, removing it", httpURL)
return true
}
if strings.HasPrefix(http... | [
0.3389594256877899,
-0.19761261343955994,
0.6100850701332092,
-1.3037832975387573,
-0.35051292181015015,
0.5716227293014526,
0.06610685586929321,
-0.3569139838218689,
0.9698209762573242,
-0.6223827004432678,
-0.1270912140607834,
0.6778074502944946,
-0.24367137253284454,
1.4532496929168701,... |
func (o *RTRDeleteFileReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) {
switch response.Code() {
case 204:
result := NewRTRDeleteFileNoContent()
if err := result.readResponse(response, consumer, o.formats); err != nil {
return nil, err
}
return result, ... | [
0.2568246126174927,
-1.1992931365966797,
0.9108353853225708,
0.13138644397258759,
0.2999545633792877,
-1.2007609605789185,
-0.23607462644577026,
-0.01312359981238842,
0.19002953171730042,
0.20769789814949036,
0.7302600145339966,
-0.8733749389648438,
-0.9157393574714661,
0.05996319279074669... |
func NewRTRDeleteFileNoContent() *RTRDeleteFileNoContent {
return &RTRDeleteFileNoContent{}
} | [
1.2613824605941772,
-1.1642966270446777,
0.07705286890268326,
-0.24603939056396484,
-0.043794896453619,
-0.2975718080997467,
-0.9292126893997192,
0.11247740685939789,
-0.8265318870544434,
-0.30604973435401917,
-0.3083280622959137,
-1.1337562799453735,
0.18488377332687378,
-0.16703253984451... |
func NewRTRDeleteFileBadRequest() *RTRDeleteFileBadRequest {
return &RTRDeleteFileBadRequest{}
} | [
0.6740812063217163,
-1.0475202798843384,
0.5766252875328064,
0.5288963913917542,
0.3838731050491333,
0.073267363011837,
-1.2952905893325806,
0.8207390904426575,
-1.1808639764785767,
-0.2789858877658844,
0.6665124297142029,
-1.0074156522750854,
-0.44304004311561584,
0.6723617911338806,
0.... |
func NewRTRDeleteFileForbidden() *RTRDeleteFileForbidden {
return &RTRDeleteFileForbidden{}
} | [
1.3526387214660645,
-0.16419650614261627,
0.5834720730781555,
0.5877605676651001,
0.10416058450937271,
0.33453771471977234,
-0.47631603479385376,
0.7628445029258728,
-0.952704668045044,
-0.544928252696991,
0.317685067653656,
-0.6627142429351807,
0.09801848977804184,
0.005773852113634348,
... |
func NewRTRDeleteFileNotFound() *RTRDeleteFileNotFound {
return &RTRDeleteFileNotFound{}
} | [
0.5459204912185669,
-1.7690725326538086,
0.2731465995311737,
-0.23948971927165985,
0.4301443099975586,
0.48332077264785767,
-0.44294047355651855,
0.7457523345947266,
-0.5921980142593384,
-0.3223085105419159,
0.24312660098075867,
-0.9500976204872131,
-0.07540275156497955,
0.3326226472854614... |
func NewRTRDeleteFileTooManyRequests() *RTRDeleteFileTooManyRequests {
return &RTRDeleteFileTooManyRequests{}
} | [
0.2660152018070221,
-0.3937212824821472,
0.46719983220100403,
0.6595059633255005,
0.3537656366825104,
-0.4273606836795807,
-1.057991623878479,
0.4204946458339691,
-0.5427409410476685,
-0.5454158186912537,
0.23301401734352112,
-1.2774345874786377,
-0.7636629939079285,
0.5164692997932434,
... |
func (m *ClusterNetworkSettingUpdationParams) Validate(formats strfmt.Registry) error {
var res []error
if err := m.validateData(formats); err != nil {
res = append(res, err)
}
if err := m.validateWhere(formats); err != nil {
res = append(res, err)
}
if len(res) > 0 {
return errors.CompositeValidationErr... | [
-0.20472845435142517,
0.640024721622467,
0.24824510514736176,
-0.2882532477378845,
-0.043933358043432236,
-0.5526829361915588,
-0.1633325070142746,
-0.42410963773727417,
-0.8570073843002319,
1.4222793579101562,
-0.3670807182788849,
-0.7651798129081726,
-0.7375959157943726,
0.68573206663131... |
func (m *ClusterNetworkSettingUpdationParams) ContextValidate(ctx context.Context, formats strfmt.Registry) error {
var res []error
if err := m.contextValidateData(ctx, formats); err != nil {
res = append(res, err)
}
if err := m.contextValidateWhere(ctx, formats); err != nil {
res = append(res, err)
}
if l... | [
-0.215992271900177,
0.6843416690826416,
0.24684055149555206,
-0.2945937216281891,
-0.09070241451263428,
-0.22238905727863312,
-0.2644852101802826,
-0.3011382520198822,
0.05469260737299919,
1.314443588256836,
-0.23274408280849457,
-0.07642950862646103,
-0.903488039970398,
0.4491688311100006... |
func (m *ClusterNetworkSettingUpdationParamsData) Validate(formats strfmt.Registry) error {
var res []error
if err := m.validateMgtIPMapper(formats); err != nil {
res = append(res, err)
}
if err := m.validateNtpMode(formats); err != nil {
res = append(res, err)
}
if len(res) > 0 {
return errors.Composite... | [
-0.00607798108831048,
0.5796067714691162,
0.19610321521759033,
-0.2111736387014389,
0.0378410741686821,
0.1454198956489563,
-0.15888406336307526,
-0.4785784184932709,
-1.0220900774002075,
1.4365348815917969,
-0.10258056223392487,
-0.6680583357810974,
-0.46368348598480225,
0.645989000797271... |
func (m *ClusterNetworkSettingUpdationParamsData) ContextValidate(ctx context.Context, formats strfmt.Registry) error {
var res []error
if err := m.contextValidateMgtIPMapper(ctx, formats); err != nil {
res = append(res, err)
}
if err := m.contextValidateNtpMode(ctx, formats); err != nil {
res = append(res, e... | [
-0.17820414900779724,
0.49557507038116455,
0.3238779902458191,
-0.10109389573335648,
-0.20010030269622803,
0.40190842747688293,
-0.3212059438228607,
-0.2758116126060486,
-0.06466448307037354,
1.1259773969650269,
-0.06419374793767929,
-0.2081848531961441,
-0.5208698511123657,
0.375633716583... |
func Band(s string) (core.Band, error) {
for _, band := range core.Bands {
if string(band) == s {
return band, nil
}
}
return core.NoBand, fmt.Errorf("%q is not a supported HF band", s)
} | [
0.16298481822013855,
-0.19219501316547394,
0.2702096700668335,
1.295398235321045,
-0.37860944867134094,
0.19989433884620667,
0.20412762463092804,
-0.3391961455345154,
0.009159558452665806,
-0.728115975856781,
0.6034795045852661,
0.6842384338378906,
-0.6097733974456787,
0.6521331667900085,
... |
func Mode(s string) (core.Mode, error) {
for _, mode := range core.Modes {
if string(mode) == s {
return mode, nil
}
}
return core.NoMode, fmt.Errorf("%q is not a supported mode", s)
} | [
-0.5049424767494202,
-0.1757894903421402,
0.3379193842411041,
0.03285863250494003,
-0.902751624584198,
0.2392563819885254,
-0.13844087719917297,
0.12203202396631241,
0.3941054046154022,
0.3896320164203644,
0.40610963106155396,
-0.20915456116199493,
-0.6629359722137451,
-0.07234709709882736... |
func RST(s string) (core.RST, error) {
normalized := strings.TrimSpace(s)
length := len(normalized)
if length == 0 {
return core.RST(""), fmt.Errorf("The report in RST notation must not be empty")
}
if length > 3 {
return core.RST(""), fmt.Errorf("%q is not a valid report in RST notation", s)
}
if !parseRSTE... | [
1.1459428071975708,
0.4639946222305298,
0.4375241696834564,
-0.4696972668170929,
-0.6004366874694824,
-0.5957158803939819,
0.024166112765669823,
0.17832456529140472,
0.3839453458786011,
-0.27003344893455505,
0.7479760050773621,
0.05205978453159332,
-1.053605079650879,
-0.9293553233146667,
... |
func distance(ex1, ex2 Example) float64 {
return math.Sqrt(math.Pow(float64(ex1.d1-ex2.d1), 2) + math.Pow(float64(ex1.d2-ex2.d2), 2) + math.Pow(float64(ex1.d3-ex2.d3), 2))
} | [
0.5472676157951355,
0.04045472666621208,
0.38190340995788574,
0.38324034214019775,
-0.6975782513618469,
0.3530770540237427,
-0.3049581050872803,
0.8799536824226379,
0.2966756224632263,
0.5620093941688538,
0.35475966334342957,
0.5951192378997803,
0.287700355052948,
-1.049074649810791,
-0.... |
func assertCrush(t *testing.T, c *Candy, crush bool, _type CandyType) {
_ = debug.Stack()
if c.crush != crush {
debug.PrintStack()
t.Fatalf("Wrong matching for %v, expected %t but was %t", c, crush, c.crush)
}
if _type != EmptyCandy && c._type != _type {
debug.PrintStack()
t.Fatalf("Wrong _type for %v, exp... | [
0.1787135899066925,
0.4087671637535095,
0.4889127314090729,
0.4115101397037506,
1.4024908542633057,
0.1599210500717163,
0.9499757885932922,
-0.49992185831069946,
-0.01008556131273508,
-0.29728153347969055,
-0.11611616611480713,
0.9896751046180725,
-0.4497085213661194,
0.6249395608901978,
... |
func (cfg *Config) Read(fpath string) error {
byteDat, err := ioutil.ReadFile(fpath)
if err != nil {
return err
}
err = json.Unmarshal(byteDat, &cfg)
if err != nil {
return err
}
// sanity check
if cfg.Port <= 0 || cfg.Port > 65535 {
return errors.New("invalid port number " + strconv.Itoa(cfg.Port))
}
... | [
-0.9889469146728516,
0.27897635102272034,
0.9140049815177917,
0.37943658232688904,
-0.11041422933340073,
0.17749498784542084,
1.0182926654815674,
0.1363406926393509,
-0.43577075004577637,
0.7217755913734436,
-0.916958749294281,
-0.8201686143875122,
0.017574768513441086,
0.7441809773445129,... |
func (cfg *Config) Save(fpath string) error {
// create a copy
config2 := cfg
// clear, setup setting
config2.Password = ""
config2.Iterations = ConfigHashIterations
// save to file
byteDat2, err := json.MarshalIndent(config2, "", " ")
if err != nil {
return err
}
err = ioutil.WriteFile(fpath, byteDat2, 0... | [
-0.9850639700889587,
0.19426307082176208,
0.3441770374774933,
-0.20685721933841705,
-0.29924485087394714,
-0.20451577007770538,
0.12329130619764328,
-0.19097952544689178,
-1.1003236770629883,
1.3232159614562988,
-1.9239253997802734,
-0.13164480030536652,
0.12635913491249084,
0.276684254407... |
func (cs CidrSlice) ToAdvertisements() []*metallbbgp.Advertisement {
var (
l = log.WithFields(logrus.Fields{
"component": "CidrSlice.ToAdvertisements",
})
)
adverts := make([]*metallbbgp.Advertisement, 0, len(cs))
for _, c := range cs {
parsed, err := cidr.ParseCIDR(c)
if err != nil {
continue
}
... | [
-1.1529749631881714,
0.18462705612182617,
0.43929150700569153,
-0.45331111550331116,
0.558695912361145,
-0.33362504839897156,
0.06057865917682648,
-0.1815045326948166,
0.7686001658439636,
1.756540298461914,
0.11889507621526718,
0.0723826140165329,
-0.6564843058586121,
0.6264084577560425,
... |
func (s *MetalLBSpeaker) announcePodCIDRs(cidrs CidrSlice) error {
var (
l = log.WithFields(logrus.Fields{
"component": "MetalLBSpeaker.announcePodCidrs",
})
)
ctl := s.speaker.GetBGPController()
// create advertisements
adverts := cidrs.ToAdvertisements()
if len(adverts) == 0 {
// we logged the error ... | [
-0.7861688733100891,
-0.22843822836875916,
0.4253748059272766,
-0.7087702751159668,
0.5874788761138916,
-0.9780237078666687,
-0.26787352561950684,
-0.12478028237819672,
0.34720566868782043,
1.000388503074646,
-0.07936658710241318,
0.47662341594696045,
-1.0781980752944946,
-0.01567353308200... |
func NewCompiler(path string, pkg *lang.Package, apis *openapi.OpenAPIs) *Compiler {
return &Compiler{
Path: path,
Package: pkg,
OpenAPIs: apis,
Documents: make(Documents),
}
} | [
-0.4495316743850708,
-1.2918739318847656,
0.1762378066778183,
-0.20575982332229614,
-1.1148686408996582,
-0.09560047835111618,
-0.5236734747886658,
0.14594486355781555,
0.09313111007213593,
-0.9558146595954895,
0.2470899224281311,
0.08011454343795776,
-0.33195504546165466,
0.20865173637866... |
func CreateSaltAndHashedPassword(password []byte) ([]byte, []byte, error) {
// Create password salt from the current time and a random integer
// Salts just need to be unique in case of a database breach.
// Current nanosecond + random 31bit int have a very small chance
// of ever having a collision
nano := time.N... | [
0.4847005009651184,
-0.3578832149505615,
0.702785313129425,
-0.3695293068885803,
-0.030080271884799004,
0.7419314980506897,
-0.2797709107398987,
-0.15204015374183655,
0.8632943034172058,
0.1275591105222702,
-0.5205328464508057,
0.4637003242969513,
0.12395299971103668,
1.1564388275146484,
... |
func CompareSaltAndPasswordToHash(salt, hashedPassword, password []byte) bool {
// Combine sumbited password and salt
saltedPassword := []byte(string(password) + string(salt))
// Use bcrypt to compare hashedPassword and saltedPassword
err := bcrypt.CompareHashAndPassword(hashedPassword, saltedPassword)
return err... | [
1.1726844310760498,
-1.014272928237915,
0.8682603240013123,
0.3349744379520416,
0.32766374945640564,
0.9754413366317749,
-0.8813918828964233,
0.27705511450767517,
0.3411586284637451,
-0.3310902714729309,
-0.6546791195869446,
0.40104031562805176,
-0.36025264859199524,
0.5837261080741882,
... |
func GenerateRandomBytes(n int) ([]byte, error) {
b := make([]byte, n)
_, err := crand.Read(b)
// Note that err == nil only if we read len(b) bytes.
if err != nil {
return nil, err
}
return b, nil
} | [
-0.34719645977020264,
1.0405040979385376,
0.30423229932785034,
0.3350691497325897,
0.2464330643415451,
0.12289467453956604,
-0.40837201476097107,
-0.5995108485221863,
0.45224300026893616,
0.03838105499744415,
-1.303454875946045,
-0.8311368823051453,
-0.9379958510398865,
1.083903193473816,
... |
func GenerateRandomString(s int) (string, error) {
b, err := GenerateRandomBytes(s)
return base64.URLEncoding.EncodeToString(b), err
} | [
-0.8263711333274841,
0.49756747484207153,
0.18653550744056702,
-0.041338834911584854,
-0.7112833261489868,
0.5436825752258301,
-0.555587887763977,
0.09018831700086594,
1.1885629892349243,
-0.1447850614786148,
0.035660237073898315,
-0.3200150430202484,
0.14006303250789642,
0.030454907566308... |
func buildRetool() (string, error) {
dir, err := ioutil.TempDir("", "")
if err != nil {
return "", errors.Wrap(err, "unable to create temporary build directory")
}
output := filepath.Join(dir, "retool")
cmd := exec.Command("go", "build", "-o", output, ".")
_, err = cmd.Output()
if err != nil {
return "", err... | [
-0.29410284757614136,
-0.7408546805381775,
0.7628576755523682,
0.4453336000442505,
0.5951998829841614,
0.01612415537238121,
0.6433380842208862,
-0.16674527525901794,
-0.36376169323921204,
-0.2108163982629776,
-0.43745580315589905,
0.7595151662826538,
-0.20521393418312073,
-0.89131474494934... |
func ReadConfig(configFilePath string) (*Config, error) {
cfg := &csConfig{}
if err := gcfg.ReadFileInto(cfg, configFilePath); err != nil {
return nil, fmt.Errorf("could not parse CloudStack config: %w", err)
}
return &Config{
APIURL: cfg.Global.APIURL,
APIKey: cfg.Global.APIKey,
SecretKey: cfg.Globa... | [
0.35528385639190674,
0.14006394147872925,
0.467457115650177,
0.6122670769691467,
-0.08628341555595398,
1.049520492553711,
0.20131301879882812,
0.3019784986972809,
-1.2586253881454468,
0.37956950068473816,
-0.5154156684875488,
-0.24136695265769958,
0.030054548755288124,
0.13540278375148773,... |
func (r *RunReconciler) Reconcile(req ctrl.Request) (ctrl.Result, error) {
ctx := context.Background()
// Initialize Logger
runLogger = r.Log.WithValues("runnerImage", req.NamespacedName)
// Fetch the RunnerImage instance
runInstance := &v1alpha1.Run{}
err := r.Client.Get(ctx, req.NamespacedName, runInstance)
i... | [
-0.5675826072692871,
-0.352219820022583,
0.8723126649856567,
0.12518437206745148,
0.46590179204940796,
-0.5808127522468567,
0.24244263768196106,
0.23905907571315765,
-1.0804095268249512,
0.266249418258667,
-0.08566999435424805,
0.07042361795902252,
-0.13061682879924774,
0.9771969318389893,... |
func kelvinToCelsius(k kelvin) celsius {
// type must be converted before return
return celsius(k - 273.15)
} | [
-0.05552992224693298,
-0.4982747435569763,
0.2267356514930725,
-0.6764123439788818,
-0.932449460029602,
-0.07621828466653824,
-0.5378583073616028,
-1.0423442125320435,
0.6653894782066345,
-0.017992282286286354,
-0.8782396912574768,
-0.021609369665384293,
-0.007940657436847687,
0.3819680511... |
func Handshake(addr string, tor []byte) (p *Peer, err error) {
id, err := newPeerID(addr, tor)
if err != nil {
return
}
conn, _, err := hello(addr, id, tor)
if err != nil {
return
}
p = newPeer(tor, conn)
if err = p.handshake(); err != nil {
conn.Close()
}
return
} | [
0.49809131026268005,
0.30034339427948,
0.5999864339828491,
0.24606089293956757,
0.40478968620300293,
0.15027408301830292,
-0.48070260882377625,
0.2206624448299408,
-0.5062841176986694,
0.10320228338241577,
0.5248115062713623,
-0.423678457736969,
-0.4881927967071533,
-0.040306780487298965,
... |
func Download(addr string, tor []byte, cb func(down, total int)) (b []byte, err error) {
p, err := Handshake(addr, tor)
if err != nil {
return
}
defer p.Close()
if size := p.Size(); size > 0 {
b = make([]byte, size)
if cb != nil {
cb(0, size)
}
for i, n := 0, 0; i < p.NumBlocks(); i++ {
data, err :... | [
0.8962416648864746,
0.4791194796562195,
1.1566495895385742,
0.22531139850616455,
-0.8357182741165161,
-0.2410934865474701,
0.31729912757873535,
-0.12935598194599152,
0.7822709679603577,
0.17954126000404358,
0.31209978461265564,
-0.08196746557950974,
-0.661422610282898,
-0.15411776304244995... |
func newTempDir(dir string) {
err := os.MkdirAll(dir, os.ModePerm)
if err != nil {
log.Fatalf("unable to create temp dir fo test. Error: %v", err)
}
} | [
0.04296132177114487,
-0.1892574280500412,
0.3519667387008667,
-0.381411612033844,
-0.1273963451385498,
0.9150109887123108,
0.6030346155166626,
-0.013185574673116207,
0.2972986102104187,
-0.2171468436717987,
-0.17630040645599365,
-0.2502882182598114,
-0.6886551380157471,
0.8006920218467712,... |
func (a *Account) Deposit(amount int) {
a.balance += amount
fmt.Println(amount, "원 입금완료 !")
} | [
0.3729667663574219,
0.28655144572257996,
0.6757683157920837,
-0.3416961133480072,
-0.32407569885253906,
1.2175322771072388,
1.4605720043182373,
-0.3559519648551941,
0.6974313855171204,
-0.06209861859679222,
0.04207148775458336,
0.5796602368354797,
0.1953229159116745,
0.8830835223197937,
... |
func sumOfDistancesInTree(N int, edges [][]int) []int {
} | [
-0.2791224718093872,
0.10966693609952927,
0.4556261897087097,
-0.2983354926109314,
-0.13530734181404114,
-0.9404770731925964,
-0.050578780472278595,
-0.12019004672765732,
0.18757152557373047,
1.2993295192718506,
-0.42425966262817383,
-0.0869780033826828,
0.18773198127746582,
1.064391016960... |
func registerModelModel33Flags(depth int, cmdPrefix string, cmd *cobra.Command) error {
if err := registerModel33Connected(depth, cmdPrefix, cmd); err != nil {
return err
}
if err := registerModel33DeviceID(depth, cmdPrefix, cmd); err != nil {
return err
}
if err := registerModel33DuplicateOf(depth, cmdPref... | [
-0.5102271437644958,
0.534019947052002,
0.7287999987602234,
-0.1119885966181755,
1.0609537363052368,
1.246362328529358,
-0.2398468554019928,
-0.8206216096878052,
0.10754406452178955,
-0.23721714317798615,
-0.848741352558136,
0.46869632601737976,
-0.8781381845474243,
1.4130563735961914,
-... |
func retrieveModelModel33Flags(depth int, m *models.Model33, cmdPrefix string, cmd *cobra.Command) (error, bool) {
retAdded := false
err, connectedAdded := retrieveModel33ConnectedFlags(depth, m, cmdPrefix, cmd)
if err != nil {
return err, false
}
retAdded = retAdded || connectedAdded
err, deviceIdAdded := re... | [
-0.1814916878938675,
0.027709120884537697,
0.7076935768127441,
-0.3380986154079437,
0.5648230314254761,
0.9624307751655579,
0.10510843992233276,
-1.1678012609481812,
0.455044150352478,
-0.6178898811340332,
-0.31309840083122253,
0.40632015466690063,
-1.3052445650100708,
1.34141206741333,
... |
func (RescoreExecutionPlanStatus) Values() []RescoreExecutionPlanStatus {
return []RescoreExecutionPlanStatus{
"CREATING",
"UPDATING",
"ACTIVE",
"DELETING",
"FAILED",
}
} | [
0.1239846870303154,
0.24308280646800995,
0.1871427297592163,
-0.3219773471355438,
0.5529927015304565,
1.0949252843856812,
-0.10635356605052948,
-0.5088737607002258,
0.6959945559501648,
0.605280339717865,
-0.8482803702354431,
-0.06197482347488403,
0.5402364134788513,
0.17269988358020782,
... |
func NewTestClientNew() *Client {
if testClient == nil {
testClient = NewClientNew(TestAccessKeyId, TestAccessKeySecret)
}
return testClient
} | [
0.343252032995224,
-1.026258945465088,
0.2981901168823242,
0.019469087943434715,
-0.6271804571151733,
-0.34994837641716003,
0.607685387134552,
-1.2954996824264526,
0.0063272626139223576,
-0.5953030586242676,
0.7180317044258118,
0.5163310170173645,
-0.4949664771556854,
-0.12735125422477722,... |
func (entry *OrderBookEntry) UnmarshalJSON(b []byte) (err error) {
var poloEntry []interface{}
err = json.Unmarshal(b, &poloEntry)
if err != nil {
return
}
entry.Price, err = strconv.ParseFloat(poloEntry[0].(string), 64)
entry.Amount = poloEntry[1].(float64)
return
} | [
-0.708398163318634,
-0.5683914422988892,
0.6859820485115051,
-0.5634843707084656,
-0.3473181426525116,
0.23246827721595764,
0.08498625457286835,
-0.44126519560813904,
-0.3415808379650116,
0.8417356014251709,
-0.18041938543319702,
0.036745041608810425,
-0.16586549580097198,
-0.1165007203817... |
func (poloniexClient *PoloniexClient) ReturnOrderBook(currencypair string, depth int) (orderbook *OrderBook, err error) {
log.Debug("ReturnOrderBook")
orderbook = new(OrderBook)
orderbook.CurrencyPair = currencypair
commandParameters := map[string]string{
"currencyPair": currencypair,
"depth": strconv.... | [
-1.3304325342178345,
-0.07094018906354904,
0.44599199295043945,
-0.24678097665309906,
-0.9311689734458923,
0.757595419883728,
0.15236921608448029,
-0.6144791841506958,
-0.8971108198165894,
-0.2011679857969284,
-0.01707744225859642,
0.42040279507637024,
-2.5519192218780518,
-0.6827385425567... |
func (*MessageWithID) scanValues(columns []string) ([]interface{}, error) {
values := make([]interface{}, len(columns))
for i := range columns {
switch columns[i] {
case messagewithid.FieldID:
values[i] = new(sql.NullInt64)
default:
return nil, fmt.Errorf("unexpected column %q for type MessageWithID", col... | [
-0.520715594291687,
0.7485591769218445,
0.44616416096687317,
0.8738627433776855,
-0.12322869896888733,
-0.9125255942344666,
-1.0023502111434937,
-0.8756669759750366,
-0.5747769474983215,
-0.060596633702516556,
0.08527680486440659,
-0.013606265187263489,
-0.5152501463890076,
1.4565464258193... |
func (mwi *MessageWithID) assignValues(columns []string, values []interface{}) error {
if m, n := len(values), len(columns); m < n {
return fmt.Errorf("mismatch number of scan values: %d != %d", m, n)
}
for i := range columns {
switch columns[i] {
case messagewithid.FieldID:
value, ok := values[i].(*sql.Nul... | [
-0.2522789239883423,
0.29928866028785706,
0.4043438732624054,
0.16542330384254456,
0.2103041112422943,
0.013777075335383415,
-0.23816470801830292,
-0.5581690073013306,
-0.7850845456123352,
-0.03807353228330612,
0.3310072124004364,
-0.2804611921310425,
-0.8758423924446106,
1.672818660736084... |
func (mwi *MessageWithID) Update() *MessageWithIDUpdateOne {
return (&MessageWithIDClient{config: mwi.config}).UpdateOne(mwi)
} | [
-0.007269231136888266,
-0.5491230487823486,
0.2983492910861969,
-0.1398211568593979,
-0.24172408878803253,
-0.02236158400774002,
-0.04948705434799194,
-1.1391390562057495,
0.3452965021133423,
-0.17235669493675232,
-0.31129106879234314,
0.06786374747753143,
-2.3333165645599365,
0.8283741474... |
func (mwi *MessageWithID) Unwrap() *MessageWithID {
tx, ok := mwi.config.driver.(*txDriver)
if !ok {
panic("ent: MessageWithID is not a transactional entity")
}
mwi.config.driver = tx.drv
return mwi
} | [
-0.284889280796051,
0.3871948719024658,
0.28447315096855164,
-0.7905681729316711,
-0.1656918078660965,
-0.6936054229736328,
0.3024967610836029,
-0.13858245313167572,
-0.13729873299598694,
0.41115429997444153,
1.017452597618103,
0.4527944326400757,
-0.3615056276321411,
0.13106435537338257,
... |
func (mwi *MessageWithID) String() string {
var builder strings.Builder
builder.WriteString("MessageWithID(")
builder.WriteString(fmt.Sprintf("id=%v", mwi.ID))
builder.WriteByte(')')
return builder.String()
} | [
0.6023629903793335,
-0.6650837063789368,
0.18085984885692596,
-0.9856374263763428,
-0.5036928653717041,
0.39352232217788696,
0.33778703212738037,
-1.8581055402755737,
-0.2246505320072174,
-0.400244802236557,
-0.0411774106323719,
0.8806588053703308,
-1.524243950843811,
0.7270740866661072,
... |
func findMovies(c *gin.Context) {
var movies []Movie
DB.Find(&movies)
c.JSON(http.StatusOK, gin.H{"data": movies})
} | [
-0.9750356078147888,
-0.08367765694856644,
0.6296988725662231,
0.7725305557250977,
1.1297063827514648,
0.09987493604421616,
-0.13065989315509796,
-0.5656851530075073,
-1.1022075414657593,
0.8040294647216797,
-0.5172845125198364,
-0.2207125723361969,
-1.0025620460510254,
2.0238118171691895,... |
func findMovie(c *gin.Context) {
// Get model if exist
var movie Movie
if err := DB.Where("id = ?", c.Param("id")).First(&movie).Error; err != nil {
c.JSON(http.StatusBadRequest, gin.H{"error": "Record not found!"})
return
}
c.JSON(http.StatusOK, gin.H{"data": movie})
} | [
-1.1939594745635986,
-0.284436970949173,
0.9397817254066467,
1.4245530366897583,
0.7518094182014465,
0.40377965569496155,
-0.42348983883857727,
-0.4843250513076782,
-0.8911367654800415,
1.1006087064743042,
-0.09221211820840836,
0.4799399673938751,
-0.8918488621711731,
1.5844676494598389,
... |
func createMovie(c *gin.Context) {
data, err := c.GetRawData()
if err != nil {
fmt.Printf("something went wrong with getting raw data error: %v\n", err)
os.Exit(1)
}
var smhover Movie
var movie Movie
var trimmed string
slice := strings.SplitAfter(string(data), "}")
// will loop over all of the slices
for c... | [
-0.5791657567024231,
0.18287836015224457,
0.9604287147521973,
0.5631300806999207,
0.6267748475074768,
0.3202091455459595,
-0.6626489162445068,
0.7774179577827454,
-0.3159840404987335,
0.8168673515319824,
0.009079614654183388,
0.10866868495941162,
-1.2150384187698364,
0.8100175857543945,
... |
func updateMovie(c *gin.Context) {
// Get model if exist
var movie Movie
if err := DB.Where("id = ?", c.Param("id")).First(&movie).Error; err != nil {
c.JSON(http.StatusBadRequest, gin.H{"error": "Record not found!"})
return
}
// Validate input
var input updateMovieInput
if err := c.ShouldBindJSON(&input); ... | [
-2.0734145641326904,
-1.112046718597412,
0.9127006530761719,
1.23076331615448,
-0.07298921048641205,
1.0911695957183838,
-0.04669790342450142,
-0.2336142361164093,
-0.5606048703193665,
1.0241689682006836,
-0.4127316474914551,
0.6398923993110657,
-0.903557300567627,
0.7633315920829773,
0.... |
func deleteMovie(c *gin.Context) {
// Get model if exist
var movie Movie
if err := DB.Where("id = ?", c.Param("id")).First(&movie).Error; err != nil {
c.JSON(http.StatusBadRequest, gin.H{"error": "Record not found!"})
return
}
DB.Delete(&movie)
c.JSON(http.StatusOK, gin.H{"data": true})
} | [
-1.1636953353881836,
-0.37182900309562683,
0.9609841108322144,
1.531370759010315,
0.9314796328544617,
0.5189365148544312,
-0.26298147439956665,
0.197868213057518,
-0.28850093483924866,
0.5658278465270996,
0.07704619318246841,
0.654050886631012,
-0.5339300632476807,
1.2006869316101074,
-0... |
func NewRelease(cache string) *Release {
return &Release{CacheDir: cache}
} | [
-0.4836924374103546,
-0.5107495188713074,
0.007389187812805176,
1.1531227827072144,
-1.3623610734939575,
-0.16699720919132233,
-0.617735743522644,
-0.2776247262954712,
0.40644752979278564,
-0.07110770046710968,
-0.31046733260154724,
0.27271968126296997,
-0.43115636706352234,
0.601140558719... |
func (r *Release) Read(releaseLocation string) (io.ReadCloser, error) {
local, err := r.Pull(releaseLocation)
if err != nil {
return nil, err
}
rr, err := os.Open(local)
if err != nil {
return nil, err
}
return rr, nil
} | [
-0.4817083477973938,
-1.1315935850143433,
0.6500173807144165,
-0.5787500739097595,
-0.4954974353313446,
0.3518504500389099,
-0.02851497195661068,
0.25132283568382263,
-0.13986772298812866,
0.45395922660827637,
0.518994927406311,
0.13270585238933563,
-0.3745224177837372,
-0.0051448591984808... |
func (r *Release) Pull(releaseLocation string) (filename string, err error) {
u, uerr := url.Parse(releaseLocation)
if uerr != nil || !(u.Scheme == "http" || u.Scheme == "https") {
// assume a local file, ensure it exists
if _, ferr := os.Stat(releaseLocation); os.IsNotExist(ferr) {
err = fmt.Errorf("Could not... | [
-0.6320018172264099,
-0.6829139590263367,
0.8582799434661865,
-0.14976361393928528,
-0.14729247987270355,
0.36834263801574707,
0.2573005259037018,
0.6314963102340698,
0.10504745692014694,
0.016159649938344955,
0.3430946469306946,
-0.21543236076831818,
-0.013231797143816948,
-0.029382891952... |
func NewConcurrencyLimitingBlobReplicator(base BlobReplicator, sink blobstore.BlobAccess, semaphore *semaphore.Weighted) BlobReplicator {
return &concurrencyLimitingBlobReplicator{
base: base,
sink: sink,
semaphore: semaphore,
}
} | [
0.9343888759613037,
0.07160963863134384,
0.1716163009405136,
0.004773824941366911,
-1.385561466217041,
-0.3493820130825043,
-0.0840226337313652,
1.5229376554489136,
0.8419806957244873,
0.8460128307342529,
-0.34847378730773926,
-0.8905373811721802,
-1.7394866943359375,
0.3340705335140228,
... |
func (r *Request) parseParams() (err os.Error) {
if r.Params != nil {
return
}
r.Params = make(map[string][]string)
var query string
switch r.Method {
case "GET", "HEAD":
query = r.URL.RawQuery
case "POST":
if r.Body == nil {
return os.ErrorString("missin... | [
0.28533950448036194,
-0.203343465924263,
0.9754958748817444,
-0.5402668118476868,
-0.2890186905860901,
-0.2484295815229416,
-0.5639780163764954,
-0.3640381097793579,
-0.47074460983276367,
-0.39638248085975647,
0.886064887046814,
0.2279163897037506,
-0.41050782799720764,
0.530407726764679,
... |
func (r *Request) GetParam(name string) string {
if r.Params == nil || len(r.Params) == 0 {
return ""
}
params, ok := r.Params[name]
if !ok || len(params) == 0 {
return ""
}
return params[0]
} | [
0.13590358197689056,
0.2964285910129547,
0.68948894739151,
0.6946151852607727,
0.15331296622753143,
-0.199166402220726,
-0.3763471245765686,
-0.6836708188056946,
0.8382493257522583,
0.5281816720962524,
1.41049325466156,
0.3454548418521881,
-0.384399950504303,
0.5769532322883606,
0.459049... |
func New(opts ConsulOpts, queryOptions consul_api.QueryOptions, kvPrefix, kvFilter string, healthSummary bool, logger log.Logger) (*Exporter, error) {
uri := opts.URI
if !strings.Contains(uri, "://") {
uri = "http://" + uri
}
u, err := url.Parse(uri)
if err != nil {
return nil, fmt.Errorf("invalid consul URL: ... | [
0.3014122247695923,
-0.4395729601383209,
0.9975904822349548,
0.3372008204460144,
-1.1645530462265015,
-0.3504372835159302,
-0.310177206993103,
0.14291059970855713,
0.23133741319179535,
0.07132259011268616,
0.4825207591056824,
0.33151665329933167,
-0.37454932928085327,
0.2609545588493347,
... |
func (e *Exporter) Describe(ch chan<- *prometheus.Desc) {
ch <- up
ch <- clusterServers
ch <- clusterLeader
ch <- nodeCount
ch <- memberStatus
ch <- memberWanStatus
ch <- serviceCount
ch <- serviceNodesHealthy
ch <- nodeChecks
ch <- serviceChecks
ch <- keyValues
ch <- serviceTag
ch <- serviceCheckNames
} | [
-0.08414386957883835,
0.06509240716695786,
0.4791882634162903,
-0.5563835501670837,
0.3792496621608734,
0.3054175078868866,
-0.6948959231376648,
-0.4739821255207062,
0.009215066209435463,
0.3301299512386322,
0.18187980353832245,
1.4788402318954468,
-0.34587883949279785,
0.9288113117218018,... |
func (e *Exporter) Collect(ch chan<- prometheus.Metric) {
ok := e.collectPeersMetric(ch)
ok = e.collectLeaderMetric(ch) && ok
ok = e.collectNodesMetric(ch) && ok
ok = e.collectMembersMetric(ch) && ok
ok = e.collectMembersWanMetric(ch) && ok
ok = e.collectServicesMetric(ch) && ok
ok = e.collectHealthStateMetric(c... | [
0.09917490929365158,
-0.21044644713401794,
0.6407727003097534,
0.2625380754470825,
-0.15234708786010742,
0.9534659385681152,
0.15919648110866547,
-1.279050350189209,
-0.5635678768157959,
0.3867455720901489,
0.5609084367752075,
0.3304550349712372,
0.30489975214004517,
1.5131396055221558,
... |
func (e *Exporter) collectHealthSummary(ch chan<- prometheus.Metric, serviceNames map[string][]string) bool {
ok := make(chan bool)
for s := range serviceNames {
go func(s string) {
if e.requestLimitChan != nil {
e.requestLimitChan <- struct{}{}
defer func() {
<-e.requestLimitChan
}()
}
o... | [
-0.517388105392456,
0.5935931205749512,
0.878913164138794,
0.13698561489582062,
-0.5331109762191772,
0.5575076341629028,
-0.48243460059165955,
-0.8812630772590637,
-0.30696162581443787,
0.23471073806285858,
0.6541100740432739,
0.09485996514558792,
0.015242505818605423,
0.8555668592453003,
... |
func TestUnsafeBatchIdWriting(t *testing.T) {
s := new(service)
s.metaLock = new(sync.RWMutex)
s.withdrawBatch = make(map[string]int)
batchID := "test"
for i := 0; i < 100; i++ {
fmt.Println(s.ApplyWithdrawal(batchID, i))
}
sig := make(chan os.Signal, 1)
signal.Notify(sig, syscall.SIGTERM, syscall.SIGHUP, s... | [
0.32219234108924866,
0.0817316472530365,
0.5516812205314636,
0.05622240900993347,
0.35487017035484314,
0.46981775760650635,
-0.0343942865729332,
-0.3018665313720703,
0.7574583888053894,
-0.3357747495174408,
-0.4658573865890503,
-0.03366095945239067,
0.01877184957265854,
0.6384413838386536,... |
func (r *NotifyRequest) Validate() error {
if r.Credentials == nil && r.OAuthToken.Token == "" {
return errors.New("secret was empty")
}
if len(r.Channels) == 0 {
return errors.New("channels was empty")
}
if r.Title == "" {
return errors.New("title was empty")
}
return nil
} | [
-0.03728597238659859,
-0.11971015483140945,
0.5633789896965027,
-0.47274473309516907,
0.7094808220863342,
0.13230983912944794,
-1.2213321924209595,
-1.1432783603668213,
-0.8977147340774536,
-0.1753665655851364,
0.4326397478580475,
0.5796889662742615,
-0.7259246706962585,
1.2367113828659058... |
func NewUser() User {
user := User{
TableName: "user",
PrimaryKeyName: "id",
}
return user
} | [
-0.0898553654551506,
0.22656700015068054,
0.11686047911643982,
1.5383632183074951,
-0.2584835886955261,
0.2437254935503006,
0.23219245672225952,
-0.21722018718719482,
0.09517110884189606,
-0.7999985814094543,
-1.0402737855911255,
-0.6754463315010071,
0.4751583933830261,
-0.1857132911682129... |
func (x *User) Table() string {
return x.TableName
} | [
0.4374536871910095,
-0.06393565982580185,
0.22990958392620087,
1.380426049232483,
-0.5374806523323059,
0.7659189701080322,
0.2947067320346832,
-0.6252851486206055,
0.13271832466125488,
-0.13467948138713837,
-0.0960133746266365,
0.2156781703233719,
0.43905603885650635,
-0.6478441953659058,
... |
func (x *User) PrimaryKey() string {
return x.PrimaryKeyName
} | [
0.9367508292198181,
0.0895850658416748,
-0.05356770381331444,
1.0731295347213745,
-0.22779665887355804,
1.1388018131256104,
0.237406924366951,
-0.5827256441116333,
1.1722018718719482,
0.07578334957361221,
0.35923975706100464,
-0.32710275053977966,
0.00905682798475027,
-0.5234116315841675,
... |
func NewGroup() UserGroup {
group := make(UserGroup, 0)
return group
} | [
-0.10448287427425385,
1.207087755203247,
0.015293319709599018,
1.029828667640686,
-0.38252148032188416,
-0.2392551749944687,
0.315275639295578,
-0.04926037788391113,
0.04925024136900902,
-1.5825915336608887,
-0.087599977850914,
0.426599383354187,
-0.5818689465522766,
0.33895033597946167,
... |
func (x UserGroup) Table() string {
return "user"
} | [
0.1920984536409378,
0.37028008699417114,
0.22676430642604828,
0.8478987812995911,
-0.7928726077079773,
0.7506123781204224,
0.5897553563117981,
-0.4996195435523987,
-0.6597244143486023,
-0.08421188592910767,
-0.2941669523715973,
-0.25233542919158936,
-0.20286421477794647,
-0.379288852214813... |
func (x UserGroup) PrimaryKey() string {
return "id"
} | [
0.5621359348297119,
0.2857564091682434,
0.07477687299251556,
0.4859860837459564,
0.18868941068649292,
0.9268410801887512,
0.48926204442977905,
0.2160346806049347,
1.1412750482559204,
0.1638241857290268,
-0.28155797719955444,
-1.2944408655166626,
-1.0066444873809814,
-0.28659993410110474,
... |
func NewUserStore(m *mock.Mocker, db api.IDatabase, q *query.Q) UserStore {
return UserStore{
mock: m,
db: db,
Q: q,
}
} | [
0.21285927295684814,
-0.4785643219947815,
-0.008997607976198196,
0.18619219958782196,
-1.7742798328399658,
0.3859691619873047,
-0.42593297362327576,
-0.2702811360359192,
0.4594035744667053,
-0.3163565397262573,
-0.6491276621818542,
-0.2961602509021759,
-0.8631746172904968,
0.63121783733367... |
func (x *UserStore) Create(uuid, firstName, lastName, email, password string) (string, error) {
if x.mock != nil && x.mock.Enabled() {
return x.mock.String(), x.mock.Error()
}
_, err := x.db.Exec(`
INSERT INTO user
(id, first_name, last_name, email, password, status_id)
VALUES
(?,?,?,?,?,?)
`,
uuid, f... | [
-0.45259174704551697,
0.3903472125530243,
0.4010809063911438,
0.6657243371009827,
-0.4433387517929077,
0.7567970752716064,
-0.1100335642695427,
0.8205608129501343,
-0.6869865655899048,
0.14318707585334778,
-0.4878380000591278,
-1.3987077474594116,
-0.9015475511550903,
-0.20080338418483734,... |
func NewBankTransferPaymentMethodSpecificOutput() *BankTransferPaymentMethodSpecificOutput {
return &BankTransferPaymentMethodSpecificOutput{}
} | [
0.9484450221061707,
0.3334437608718872,
0.28732624650001526,
-0.6431242823600769,
-0.6930777430534363,
-0.3872012794017792,
0.7888758778572083,
-0.313062846660614,
-0.5099309086799622,
0.29648709297180176,
0.5718605518341064,
0.49027469754219055,
0.0039010923355817795,
-0.3050861060619354,... |
func start(tasks []string) {
// Iterate over all available tasks.
for i := range tasks {
n, as := parseTask(tasks[i])
cmd := exec.Command(n, as...)
cmd.Stderr = os.Stderr
cmd.Stdout = os.Stdout
t := replaceVars(tasks[i])
log.Trace.Printf("Starting `%s`...", t)
err := cmd.Start()
if err != nil {
log... | [
0.25858989357948303,
-0.22987496852874756,
0.5457406640052795,
0.384375661611557,
0.20168201625347137,
-0.004217068664729595,
0.6770628690719604,
0.5635640025138855,
-0.37425872683525085,
-0.24517811834812164,
-0.0365312434732914,
1.2068504095077515,
0.4644082188606262,
0.752793550491333,
... |
func run(tasks []string) {
// Iterate over all available tasks.
for i := range tasks {
// Run and wait till we get an output.
n, as := parseTask(tasks[i])
cmd := exec.Command(n, as...)
cmd.Stderr = os.Stderr
cmd.Stdout = os.Stdout
t := replaceVars(tasks[i])
log.Trace.Printf("Running `%s`...", t)
err :... | [
0.1358128935098648,
-0.1276826709508896,
0.5754156708717346,
0.1246195137500763,
-0.2091829627752304,
-0.00010055851453216746,
0.8403751850128174,
0.1876024752855301,
-0.5490530729293823,
-0.6079540848731995,
-0.17081177234649658,
0.20271195471286774,
0.01642925664782524,
0.744624793529510... |
func startSingleInstance(tasks []string, name string) {
for i := 0; i < len(tasks); i++ {
channel <- message{
action: "start",
name: fmt.Sprintf("%s-%d", name, i),
task: tasks[i],
}
}
} | [
-0.12154582887887955,
-0.1262875646352768,
0.40608862042427063,
-0.47049784660339355,
0.3295515477657318,
0.7405842542648315,
0.5580071210861206,
0.45411863923072815,
-0.0004554861516226083,
0.16616681218147278,
-0.8055704236030579,
0.8845310211181641,
-0.5694469809532166,
1.00198614597320... |
func instanceController() {
// terminate is used for killing an instance of a task.
commands := map[string]*exec.Cmd{}
var terminate = func(name string, cmd *exec.Cmd) {
if cmd.Process == nil {
return
}
pid := cmd.Process.Pid
err := cmd.Process.Kill()
if err == nil {
cmd.Process.Wait()
}
delete(... | [
0.12011794000864029,
-0.311586856842041,
0.7101518511772156,
-0.1910937875509262,
0.37777236104011536,
-0.7216203212738037,
0.9596326351165771,
-0.3856591582298279,
-0.02054116316139698,
-0.5987083315849304,
-0.3340538740158081,
0.24874481558799744,
0.437139630317688,
0.5109804272651672,
... |
func WithPrevKV() OpOption {
return OpOption(etcd.WithPrevKV())
} | [
0.10379290580749512,
0.11539208889007568,
0.6421716213226318,
1.1063644886016846,
-0.5409127473831177,
-1.056419849395752,
0.2998234033584595,
-0.2840098738670349,
0.12106301635503769,
0.9046071171760559,
0.09066686779260635,
-0.4503421485424042,
0.429491251707077,
-0.4028381109237671,
-... |
func WithFilterPut() OpOption {
return OpOption(etcd.WithFilterPut())
} | [
0.6359060406684875,
0.4961228668689728,
0.2886171340942383,
-0.044024962931871414,
-1.3802615404129028,
-0.6070539355278015,
0.46609485149383545,
-1.0975273847579956,
-0.27815210819244385,
1.0385404825210571,
0.3156358301639557,
-0.5727159380912781,
0.4067184627056122,
-0.8727677464485168,... |
func NewPaginationStore(delegate ResourceStore) ResourceStore {
return &paginationStore{
delegate: delegate,
}
} | [
0.466178297996521,
-0.7517731189727783,
-0.07457069307565689,
-0.4414730966091156,
-1.6042925119400024,
-0.5432397127151489,
-0.15640084445476532,
-0.1494416743516922,
1.2243566513061523,
-0.9372963905334473,
-0.09980645030736923,
-0.7762700915336609,
-0.1317034661769867,
-0.03916418179869... |
func createNodeDiscovery(c *SwarmContext) discovery.Backend {
// we're to go through BeaconManger directly
err := c.discoveryBack.Initialize("pc-beacon", c.heartbeat, 0, getDiscoveryOpt(c))
if err != nil {
log.Fatal(err)
}
return c.discoveryBack
} | [
1.093821406364441,
0.13427715003490448,
0.5760449767112732,
0.27686381340026855,
0.6686826348304749,
0.14373202621936798,
0.2329987734556198,
-0.7975293397903442,
0.6401252150535583,
-0.6402570009231567,
0.3828812539577484,
-0.3893826901912689,
-0.576765239238739,
0.7657724022865295,
0.5... |
func (xml XML) Validate() error {
return mustURL("xml.namespace", xml.Namespace)
} | [
0.6349598169326782,
0.2536047101020813,
0.23792950809001923,
0.18539918959140778,
0.23537544906139374,
0.8727503418922424,
-1.0292537212371826,
-0.47847580909729004,
0.8994179964065552,
-1.4141833782196045,
0.9349178671836853,
0.420894980430603,
0.2087327092885971,
0.9538614153862,
-0.67... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.