text stringlengths 11 6.3k | embedding listlengths 768 768 |
|---|---|
func Inject(key string, client *mongo.Client) {
clientManager.Inject(key, &ClosableClient{client})
} | [
-0.02045256830751896,
0.1683375984430313,
0.48713546991348267,
-0.3574278652667999,
-0.7150247693061829,
1.1528528928756714,
-0.4997636079788208,
-0.5796766877174377,
-0.9850798845291138,
0.548462986946106,
-0.2710237503051758,
0.47303178906440735,
-0.7393919825553894,
0.5603604912757874,
... |
func (c *UDBClient) NewDeleteUDBParamGroupRequest() *DeleteUDBParamGroupRequest {
req := &DeleteUDBParamGroupRequest{}
// setup request with client config
c.Client.SetupRequest(req)
// setup retryable with default retry policy (retry for non-create action and common error)
req.SetRetryable(true)
return req
} | [
-0.8589262962341309,
0.5806079506874084,
0.36359575390815735,
0.421670526266098,
-0.3764159083366394,
0.12679633498191833,
0.12817315757274628,
0.3194742500782013,
-0.6218330264091492,
-0.12357789278030396,
0.35877105593681335,
0.7624108791351318,
-1.031060814857483,
0.756086528301239,
0... |
func (this *Controller2) Get() {
var result Controller2Result
aSlice := []string{"House", "Apartment", "Hostel"}
bSlice := []string{"Car", "Moto", "Airplane"}
result.Accommodation = aSlice
result.Vehicle = bSlice
this.Data["json"] = result
this.ServeJSON()
} | [
-1.7547035217285156,
-0.5273856520652771,
0.5853331685066223,
-0.4598301351070404,
0.051978036761283875,
-0.7316886782646179,
-0.8680272698402405,
0.6833714246749878,
-0.8755289316177368,
0.4018716812133789,
-0.47582200169563293,
0.8225215077400208,
-0.13884173333644867,
-0.163035541772842... |
func NewSystem(config Config, affirmationFilename, imagePath string) (system *System, err error) {
if err = config.Validate(); err != nil {
return nil, err
}
return &System{
mux: &sync.Mutex{},
config: config,
affirmationFilename: affirmationFilename,
imagePath: image... | [
-0.056454531848430634,
0.10154398530721664,
0.21430914103984833,
0.930209219455719,
-0.4354512095451355,
-0.09456462413072586,
0.06997199356555939,
-0.978036105632782,
0.5609781742095947,
-0.005757475737482309,
0.19316136837005615,
0.743246853351593,
-0.0033880460541695356,
1.3685988187789... |
func (s *System) RandomOnOff() {
s.mux.Lock()
defer s.mux.Unlock()
s.slideShowRandom = !s.slideShowRandom
} | [
-0.3383026123046875,
0.08193763345479965,
0.1863909810781479,
-0.9431722164154053,
-0.8147121071815491,
0.608127772808075,
0.6248473525047302,
0.6953607797622681,
0.6888598799705505,
-0.25435692071914673,
-0.8639189004898071,
0.5895362496376038,
-0.1286313682794571,
1.565988302230835,
-0... |
func (s *System) getDisplayBoth() (displayBoth bool) {
// If slide show is running, always display the text.
if s.slideShowTicker != nil {
return true // Always display text in a slide show.
}
return s.displayBoth // Manual navigation may or may not display text.
} | [
0.37359359860420227,
-0.45206597447395325,
0.5911045074462891,
0.3774772584438324,
-1.027359962463379,
0.790065348148346,
0.2200680822134018,
-0.4369544982910156,
0.3602779507637024,
-0.35713881254196167,
0.38651251792907715,
0.5067270398139954,
-0.31972435116767883,
1.5336841344833374,
... |
func (s *System) Load() (title string, err error) {
s.mux.Lock()
defer s.mux.Unlock()
// Load from the text file.
affirmations, title, err := LoadAffirmations(s.affirmationFilename)
if err != nil {
return "", Error(err)
}
// Create a context of the proper dimensions for sizing everything.
surface := cairo.C... | [
-0.397816926240921,
0.3397485911846161,
0.5383947491645813,
-0.441690593957901,
-0.7630796432495117,
-0.5156815052032471,
0.09791682660579681,
-0.4107609987258911,
0.09992014616727829,
0.13846218585968018,
-0.01337392721325159,
0.25981393456459045,
-0.08298604935407639,
0.7764539122581482,... |
func (s *System) StartStopSlideShow(win *gtk.Window) (err error) {
s.mux.Lock()
defer s.mux.Unlock()
// If there is no allocated slide show ticker, we need to start the slide show.
if s.slideShowTicker == nil {
s.slideShowTicker = time.NewTicker(time.Duration(s.config.SleepMilli) * time.Millisecond)
s.slideSh... | [
-0.1390964537858963,
-0.42139625549316406,
0.3849935829639435,
-0.30859315395355225,
-0.05579684302210808,
-0.5623812675476074,
0.7725802063941956,
-0.13554593920707703,
-0.2759265601634979,
-0.6296572089195251,
-0.3068790137767792,
0.10910650342702866,
0.09469840675592422,
0.6834023594856... |
func (s *System) Random() (err error) {
s.mux.Lock()
defer s.mux.Unlock()
// Can only do random if there are a few things that we could pick.
if s.maxAffirmationIndex() > 0 {
// Have we gone through the slide show?
if s.slideShowI >= len(s.slideShowIndexes)-1 {
// Restart the slide show.
s.slideShowI =... | [
-0.49934545159339905,
0.2416662722826004,
0.35494089126586914,
0.15647335350513458,
-0.29360726475715637,
0.004062256775796413,
1.1870777606964111,
0.12784357368946075,
0.7892467975616455,
-0.4338456392288208,
0.038406435400247574,
0.9200393557548523,
-0.1623012125492096,
1.025379180908203... |
func (s *System) calculateSlideShowIndixes() (slideShowIndexes []int) {
// Are we random?
if s.slideShowRandom {
// Get random slide show.
slideShowIndexes = rand.Perm(len(s.affirmations))
// If we are currently looking at the new first affirmation, move that affirmation to the end.
if s.activeAffirmationIn... | [
-0.6198851466178894,
0.2158254235982895,
0.4692733585834503,
0.18569980561733246,
-0.5741351246833801,
-0.35445401072502136,
0.706950843334198,
0.1278408318758011,
0.6752700209617615,
-0.2899239957332611,
-0.5603587627410889,
0.8232154846191406,
0.12748868763446808,
0.7422550320625305,
0... |
func (s *System) Left() (err error) {
s.mux.Lock()
defer s.mux.Unlock()
// If we are currently displaying text and their is an image, then we should
// no longer display the text, navigating the slide in two steps.
if s.displayBoth && s.affirmations[s.activeAffirmationIndex].displayImage != nil {
s.displayBoth ... | [
0.6021392345428467,
-0.45111551880836487,
0.3502471148967743,
0.004385096952319145,
-0.046589117497205734,
0.18820317089557648,
0.2862253189086914,
-0.32134848833084106,
0.408884197473526,
-0.22428691387176514,
0.8948929905891418,
0.642838180065155,
-0.13241522014141083,
2.0507113933563232... |
func (s *System) Right() (err error) {
s.mux.Lock()
defer s.mux.Unlock()
// If we are currently not displaying text, just display it.
if !s.displayBoth {
s.displayBoth = true // Turn off on text so just the image exists.
return // We're done.
}
if s.activeAffirmationIndex == s.maxAffirmationIn... | [
0.0073816655203700066,
0.008704936131834984,
0.49815475940704346,
0.3933526873588562,
-0.5914830565452576,
0.16853372752666473,
-0.18961139023303986,
-0.4971799850463867,
-0.18475694954395294,
-0.14886170625686646,
0.8438788056373596,
0.9777827262878418,
0.1015363410115242,
1.9736617803573... |
func (s *System) maxAffirmationIndex() (index int) {
return len(s.affirmations) - 1
} | [
-0.09641268849372864,
0.045520633459091187,
0.22930331528186798,
0.5050771832466125,
-0.6832041144371033,
0.6768994927406311,
-0.03410244360566139,
-0.10786261409521103,
0.21793672442436218,
0.2311604917049408,
0.4900692105293274,
1.1327447891235352,
0.3130430579185486,
1.8345597982406616,... |
func (s *System) DisplayTextImage() (affirmationIndex int, displayText DisplayText, displayImage *DisplayImage, displayBoth, found bool) {
s.mux.Lock()
defer s.mux.Unlock()
if len(s.affirmations) == 0 {
return 0, DisplayText{}, nil, false, false
}
return s.activeAffirmationIndex, s.affirmations[s.activeAffirma... | [
-0.32146957516670227,
-0.39563319087028503,
0.5308903455734253,
0.08998467028141022,
-1.3504142761230469,
-0.10485900193452835,
0.09642820805311203,
-0.22708608210086823,
-0.5263987183570862,
1.2653026580810547,
0.5970472097396851,
0.23435038328170776,
-0.4532719552516937,
1.43393242359161... |
func (s *System) CacheSlide(affirmationIndex, winWidth, winHeight int, pixbuf *gdk.Pixbuf) {
s.mux.Lock()
defer s.mux.Unlock()
// Clear the cache if our window size has changed.
s.clearSlideCacheIfNecessary(winWidth, winHeight)
// Cache the slide.
s.cachedSlides[affirmationIndex] = pixbuf
} | [
-0.0912274643778801,
0.33209124207496643,
0.20168788731098175,
0.18503038585186005,
-0.3849075436592102,
-0.10574118047952652,
-0.6125473976135254,
-0.9238852858543396,
0.009461604058742523,
-0.4910809099674225,
-0.40655139088630676,
0.4246225655078888,
-0.8695400953292847,
0.8821350932121... |
func (s *System) GetCachedSlide(affirmationIndex, winWidth, winHeight int) (pixbuf *gdk.Pixbuf, found bool) {
s.mux.Lock()
defer s.mux.Unlock()
// Clear the cache if our window size has changed.
s.clearSlideCacheIfNecessary(winWidth, winHeight)
// Get the cached value.
pixbuf, found = s.cachedSlides[affirmation... | [
-0.3036062717437744,
0.7296949028968811,
0.41446593403816223,
0.203122079372406,
-0.5347725749015808,
-0.30135220289230347,
-0.4233941435813904,
-1.4608681201934814,
0.06954297423362732,
-0.2862823009490967,
-0.01038843672722578,
0.5929333567619324,
-0.9641225934028625,
0.8382484912872314,... |
func (s *System) clearSlideCacheIfNecessary(winWidth, winHeight int) {
// Is this still the proper cache.
if winWidth == s.cachedWidth && winHeight == s.cachedHeight {
// The cache is still good.
return
}
s.cachedWidth = winWidth
s.cachedHeight = winHeight
s.cachedSlides = map[int]*gdk.Pixbuf{}
} | [
-0.21124395728111267,
0.25318974256515503,
0.49959760904312134,
-0.07026059180498123,
-0.8439846634864807,
-0.019785359501838684,
-0.1267291158437729,
-1.2457783222198486,
0.7447341084480286,
0.01557189505547285,
-0.010002542287111282,
0.7622503638267517,
0.04021245986223221,
1.23576498031... |
func NewReader(src flate.Reader, base io.ReadSeeker) Reader {
d := Reader{src: src, base: base}
// Read the source length. We don't care about the value,
// but need to advance the stream by an approprite amount
d.readVariable()
// Read the target length so we know when we've finished processing
// the delta str... | [
-0.11393104493618011,
-0.7238139510154724,
0.29669812321662903,
-0.3992115259170532,
-0.5330334305763245,
0.07844607532024384,
0.1048915684223175,
-0.019883159548044205,
0.18714624643325806,
-1.0456550121307373,
0.30453330278396606,
0.7809524536132812,
-0.03045445866882801,
0.5538522601127... |
func (d *Reader) Read(buf []byte) (int, error) {
// Read the cached data before we read more from
// the stream
if len(d.cached) > 0 {
return d.readCached(buf)
}
instruction, err := d.src.ReadByte()
if err != nil {
return 0, err
}
if instruction == 0 {
panic("Reserved/undocumented instruction found.")
}
... | [
-0.43921589851379395,
0.40674519538879395,
0.802699863910675,
-0.8017014265060425,
-0.6026361584663391,
-0.529121458530426,
0.6598404049873352,
0.3680587112903595,
0.6330955624580383,
-0.21279525756835938,
-0.33066821098327637,
0.690967321395874,
-0.2296099066734314,
1.2741328477859497,
... |
func (d *Reader) readVariable() uint64 {
var val uint64
var i uint = 0
for {
b, err := d.src.ReadByte()
if err != nil {
panic(err)
}
val |= uint64(b&127) << (i * 7)
if b < 128 {
break
}
i += 1
}
return val
} | [
-0.9369718432426453,
0.5398067831993103,
0.6248061060905457,
-0.43536627292633057,
-0.4312157928943634,
-0.3462653160095215,
0.1375017762184143,
-0.18520940840244293,
-0.5753516554832458,
0.02896958962082863,
0.6525275707244873,
0.09016364812850952,
-0.776551365852356,
-0.10450580716133118... |
func (d *Domain) CreateMeetup(ctx context.Context, input models.NewMeetup) (*models.Meetup, error) {
currentUser, err := middleware.GetCurrentUserFromCTX(ctx)
if err != nil {
return nil, ErrUnauthenticated
}
if len(input.Name) < 3 {
return nil, errors.New("name not long enough")
}
if len(input.Description) <... | [
-0.7881490588188171,
-0.0007848247769288719,
0.5421669483184814,
0.8514479398727417,
0.23173373937606812,
1.234420657157898,
-0.514683187007904,
0.08475648611783981,
0.014108606614172459,
0.6244423985481262,
-0.08884859085083008,
-0.4078228771686554,
-0.8614820837974548,
0.1045370772480964... |
func (d *Domain) DeleteMeetup(ctx context.Context, id string) (bool, error) {
currentUser, err := middleware.GetCurrentUserFromCTX(ctx)
if err != nil {
return false, ErrUnauthenticated
}
meetup, err := d.MeetupsRepo.GetByID(id)
if err != nil || meetup == nil {
return false, errors.New("meetup not exist")
}
... | [
-1.3099098205566406,
0.5970657467842102,
1.163744330406189,
1.0177526473999023,
0.033059120178222656,
0.6149267554283142,
0.31529533863067627,
0.36008986830711365,
0.597285270690918,
0.274466872215271,
0.20249423384666443,
-0.0893726795911789,
-0.4166872203350067,
0.56903475522995,
0.099... |
func (d *Domain) UpdateMeetup(ctx context.Context, id string, input models.UpdateMeetup) (*models.Meetup, error) {
currentUser, err := middleware.GetCurrentUserFromCTX(ctx)
if err != nil {
return nil, ErrUnauthenticated
}
meetup, err := d.MeetupsRepo.GetByID(id)
if err != nil || meetup == nil {
return nil, er... | [
-1.591460108757019,
-0.6386206746101379,
0.9655730128288269,
0.6640502214431763,
-0.7884233593940735,
0.5307648181915283,
-0.14583754539489746,
0.018921148031949997,
0.14901918172836304,
0.8693527579307556,
0.09061997383832932,
0.24610282480716705,
-1.0834639072418213,
-0.15165746212005615... |
func groupAnagrams(strs []string) [][]string {
var set = make(map[[math.MaxUint8]int][]string)
for _, str := range strs {
var charSet = [math.MaxUint8]int{}
for _, letter := range []byte(str) {
charSet[letter]++
}
if _, ok := set[charSet]; !ok {
set[charSet] = []string{str}
} else {
set[charSet] = ... | [
-0.5345243215560913,
0.2436142861843109,
0.6027970314025879,
-0.7186384797096252,
-0.6099610924720764,
-0.13653671741485596,
0.8386273980140686,
-0.793445885181427,
0.3540302813053131,
1.228171467781067,
0.6700245141983032,
0.6200299263000488,
-0.5825300812721252,
-0.34807366132736206,
0... |
func (s *SyndClient) SetConfig(config []byte, restart bool) (err error) {
ctx, _ := context.WithTimeout(context.Background(), 10*time.Second)
confMsg := &pb.Conf{
Conf: config,
RestartRequired: restart,
}
status, err := s.client.SetConf(ctx, confMsg)
if err != nil {
return err
}
report := [][]st... | [
0.5533931255340576,
0.18997636437416077,
0.7513139247894287,
0.37341374158859253,
-0.027090873569250107,
0.2823735177516937,
0.1820317953824997,
1.2297340631484985,
-0.7780957818031311,
0.24186387658119202,
-0.6974725127220154,
0.7642753720283508,
-0.6883071064949036,
0.8133707642555237,
... |
func (s *SyndClient) SearchNodes(args []string) (err error) {
filter := &pb.Node{}
for _, arg := range args {
sarg := strings.SplitN(arg, "=", 2)
if len(sarg) != 2 {
return fmt.Errorf(`invalid expression %#v; needs "="`, arg)
}
if sarg[0] == "" {
return fmt.Errorf(`invalid expression %#v; nothing was le... | [
-0.9655397534370422,
0.0248558446764946,
0.9387639760971069,
-0.490730881690979,
-0.016090217977762222,
-0.738182544708252,
-0.008744238875806332,
0.34638601541519165,
-0.4724072217941284,
0.38955235481262207,
0.39834660291671753,
1.46968674659729,
-0.5915869474411011,
-0.05384883284568786... |
func (f *AllocFSCommand) followFile(client *api.Client, alloc *api.Allocation,
path, origin string, offset, numLines int64) (io.ReadCloser, error) {
cancel := make(chan struct{})
frames, errCh := client.AllocFS().Stream(alloc, path, origin, offset, cancel, nil)
select {
case err := <-errCh:
return nil, err
def... | [
0.9751232862472534,
-0.3259238004684448,
0.7324249148368835,
-0.11723767220973969,
-0.87993985414505,
0.11553062498569489,
0.027404585853219032,
0.22561991214752197,
-0.5172366499900818,
-0.42197132110595703,
0.949761152267456,
-0.29373160004615784,
-0.48097485303878784,
0.2830973267555237... |
func getRandomJobAlloc(client *api.Client, jobID string) (string, error) {
var runningAllocs []*api.AllocationListStub
allocs, _, err := client.Jobs().Allocations(jobID, false, nil)
// Check that the job actually has allocations
if len(allocs) == 0 {
return "", fmt.Errorf("job %q doesn't exist or it has no alloc... | [
-0.17373724281787872,
-0.3172553479671478,
0.7386811375617981,
-0.7770900130271912,
-1.3538497686386108,
0.6298115253448486,
0.2754081189632416,
-0.14884266257286072,
0.9716521501541138,
0.49172648787498474,
0.9988762140274048,
0.1087765097618103,
-0.3448200821876526,
0.33424991369247437,
... |
func NewDatabase(dir string) (sql.Database, error) {
fis, err := ioutil.ReadDir(dir)
if err != nil {
return nil, fmt.Errorf("could not read directory %s: %v", dir, err)
}
tables := make(map[string]sql.Table)
for _, fi := range fis {
name := fi.Name()
if filepath.Ext(name) != ".csv" {
continue
}
t, e... | [
-0.5586495399475098,
-0.04816544055938721,
0.755582332611084,
0.4480709731578827,
-0.8692591786384583,
0.2000904530286789,
0.2108045220375061,
-0.09481924772262573,
0.12429635971784592,
0.023369699716567993,
-0.4019637405872345,
0.21371790766716003,
0.12611910700798035,
0.6400423645973206,... |
func NewTable(path string) (sql.Table, error) {
name := strings.TrimSuffix(filepath.Base(path), ".csv")
t := &table{name: name, path: path}
f, err := os.Open(path)
if err != nil {
return nil, fmt.Errorf("could not open %s: %v", path, err)
}
defer f.Close()
cr := csv.NewReader(f)
cols, err := cr.Read()
if e... | [
0.7665835618972778,
-0.2996003031730652,
0.5732083320617676,
-0.3708893954753876,
-1.243495225906372,
0.3741322159767151,
0.13889509439468384,
-0.2538363039493561,
-0.7839425206184387,
0.08627311885356903,
-0.0523843839764595,
0.16070911288261414,
0.4424527883529663,
-0.7617322206497192,
... |
func NewClient(
le *types.ListenEndpoint, pushCh chan *types.Action) (Client, error) {
trans, err := translate.StringToTranslator(le.Format)
if err != nil {
return nil, err
}
switch le.Type {
case "tcp":
return net.NewTcpClient(trans, le.Addr, pushCh)
default:
return nil, errors.New("unknown connection t... | [
0.5800557732582092,
-0.7141130566596985,
0.5271053910255432,
-0.15057146549224854,
0.10777929425239563,
0.1563767045736313,
-0.6540714502334595,
-0.8740779161453247,
-0.19685839116573334,
0.45813941955566406,
0.5749918818473816,
0.46358636021614075,
-0.11242301017045975,
0.0178619865328073... |
func CreateAction(
cmd, keyB, id, secretKey string,
args ...interface{}) *types.Action {
mac := hmac.New(sha1.New, []byte(secretKey))
mac.Write([]byte(cmd))
mac.Write([]byte(keyB))
mac.Write([]byte(id))
sum := mac.Sum(nil)
sumhex := hex.EncodeToString(sum)
return &types.Action{
Command: cmd,
StorageKe... | [
0.80419921875,
-0.7673555016517639,
0.6463032364845276,
0.4078387916088104,
1.2487519979476929,
0.3557909429073334,
-0.1183568686246872,
-0.24859097599983215,
-0.19714409112930298,
0.9283806681632996,
-0.5233858227729797,
-0.19431784749031067,
-0.8174428343772888,
0.267922043800354,
-0.0... |
func Load(config *api.Config) error {
err := yamlToProto(viper.ConfigFileUsed(), config)
if err != nil {
return errors.Trace(fmt.Errorf("error unmarshalling config file: %w", err))
}
if config.Target.RepoName == "" {
klog.Warning("'target.repoName' property is empty. Using 'myrepo' default value")
config.Targ... | [
-0.7519032955169678,
0.008037282153964043,
0.623458743095398,
-0.635572075843811,
0.47285303473472595,
-0.06216791272163391,
-0.3737202286720276,
0.9194648265838623,
-0.4386734068393707,
0.7905340194702148,
-0.7291896343231201,
-0.08899811655282974,
-0.04096527770161629,
0.0125925699248909... |
func yamlToProto(path string, v proto.Message) error {
yamlBytes, err := ioutil.ReadFile(path)
if err != nil {
return errors.Trace(err)
}
jsonBytes, err := yaml.YAMLToJSONStrict(yamlBytes)
if err != nil {
return errors.Trace(err)
}
r := bytes.NewReader(jsonBytes)
err = pbjson.NewDecoder(r).Decode(v)
return... | [
0.81168532371521,
0.18957911431789398,
0.9715026617050171,
-0.36500588059425354,
0.15332086384296417,
-0.6722916960716248,
-0.08258910477161407,
-0.20842726528644562,
-0.36151206493377686,
0.6750699877738953,
-0.7688223719596863,
0.37869858741760254,
0.2391052544116974,
0.02207193709909916... |
func (s *Struct) Eq(rhs interface{}) bool {
return s == rhs || eqMapLike(s, rhs)
} | [
-0.8922927379608154,
-0.5971463322639465,
0.2423904538154602,
0.8402366042137146,
-0.2911474406719208,
0.722596287727356,
0.6376697421073914,
0.0067850202322006226,
0.7159464955329895,
0.050132472068071365,
-0.6634101867675781,
0.2552076578140259,
-0.24925747513771057,
0.6413387060165405,
... |
func insertMetadata(data []byte, metadata []byte, n int) []byte {
numMetadata := int(math.Ceil(float64(len(data) / n)))
bufSize := len(metadata)*numMetadata + len(data)
buf := make([]byte, bufSize)
for i, j := 0, 0; i < len(data); i = i + n {
dataStart := i
dataEnd := i + n
if dataEnd >= len(data) {
data... | [
0.19880859553813934,
0.8250656723976135,
0.6552829146385193,
-0.6995741128921509,
-0.25793734192848206,
0.2248704731464386,
-0.6745685338973999,
-0.2809811532497406,
-0.44076040387153625,
0.7680796980857849,
-0.6201167702674866,
0.8781540393829346,
-0.8443613052368164,
-0.0154499476775527,... |
func NewIncorrectUsage(helpText string) error {
return &incorrectUsageImpl{helpText}
} | [
-0.34802210330963135,
-0.6142379641532898,
-0.01737615093588829,
0.5464213490486145,
-0.8731436729431152,
-0.18794070184230804,
0.4728439450263977,
0.34360426664352417,
-0.9699928760528564,
0.5033621191978455,
0.5105834603309631,
0.13589933514595032,
-0.23860065639019012,
1.343710064888000... |
func BuildBinary(name string, mode os.FileMode, body io.Reader) (*Binary, error) {
sum, err := checksum(body)
if err != nil {
return nil, err
}
return &Binary{
Name: name,
Checksum: sum,
Mode: mode,
Body: body,
}, nil
} | [
0.25715333223342896,
-1.0219004154205322,
0.7337098717689514,
0.28979673981666565,
0.017924552783370018,
0.19204393029212952,
-1.039432168006897,
-0.15646140277385712,
-0.1015998050570488,
0.06950576603412628,
-0.8379402160644531,
0.04011695086956024,
-0.5617128610610962,
-0.09240072965621... |
func (b *Binary) CopyAndValidateChecksum(dst io.Writer, src io.Reader) (int64, error) {
h := sha256.New()
w := io.MultiWriter(h, dst)
written, err := io.Copy(w, src)
if err != nil {
return written, err
}
sum := fmt.Sprintf("%x", h.Sum(nil))
if b.Checksum != sum {
return written, errors.WithStack(&InvalidChe... | [
-0.09652341157197952,
-0.4408870041370392,
0.9634273052215576,
0.5936381220817566,
-0.4719344973564148,
0.025459563359618187,
0.6026785969734192,
-0.18168778717517853,
0.21574656665325165,
0.2650620639324188,
0.08856487274169922,
-0.29801854491233826,
-0.008208795450627804,
-0.325236231088... |
func (b *Binary) Inspect(w io.Writer) {
fmt.Fprintf(w, "%s/%s/%s\t", b.Name, b.Mode, b.shortChecksum())
} | [
0.6123861074447632,
-0.9029709100723267,
0.576386570930481,
-0.7594130635261536,
-0.14438898861408234,
0.3083803355693817,
1.0041131973266602,
-0.23602427542209625,
-0.9981927275657654,
0.05214981362223625,
-0.34921520948410034,
0.24397991597652435,
0.6437969207763672,
0.11327513307332993,... |
func (pe *ProposalEntry) IsDataValid() (bool, error) {
return true, nil
// Cannot have both `text` and `externalRef` field
if pe.Proposal.Text != "" && pe.Proposal.ExternalRef.Href != "" {
return false, fmt.Errorf("cannot have both 'text' and 'externalRef' fields")
}
// TODO: What else makes it invalid?
retur... | [
-0.3494235575199127,
0.21204733848571777,
0.45780497789382935,
-0.7149004340171814,
-0.01904975436627865,
1.4898709058761597,
-0.6111461520195007,
0.9876812696456909,
0.5197322964668274,
0.1982819139957428,
0.37497544288635254,
0.7156704068183899,
-0.822266697883606,
0.2623854875564575,
... |
func NewDockerPluginPayload(entityID string, data DockerData) PluginPayload {
const pluginName = "com.instana.plugin.docker"
return PluginPayload{
Name: pluginName,
EntityID: entityID,
Data: data,
}
} | [
-0.5630612373352051,
-0.6680770516395569,
0.4544796347618103,
-0.07037001848220825,
-1.341575264930725,
-0.7678937911987305,
-0.12237276136875153,
-0.28155001997947693,
0.4924319088459015,
0.1880987286567688,
-0.6059010624885559,
0.436217337846756,
0.21280412375926971,
0.07636255025863647,... |
func (d DockerNetworkStatsDelta) IsZero() bool {
return d.Bytes == 0 && d.Packets == 0 && d.Dropped == 0 && d.Errors == 0
} | [
-0.08327824622392654,
0.679942786693573,
0.44386550784111023,
0.19448302686214447,
0.2615182101726532,
0.6243337392807007,
0.24062153697013855,
-0.8430608510971069,
0.7150647044181824,
-1.2938673496246338,
0.0774320513010025,
0.1427299976348877,
-0.09981599450111389,
0.9964855909347534,
... |
func NewDockerNetworkAggregatedStatsDelta(prev, next map[string]docker.ContainerNetworkStats) *DockerNetworkAggregatedStatsDelta {
var rxDelta, txDelta DockerNetworkStatsDelta
for _, stats := range next {
rxDelta.Bytes += stats.RxBytes
rxDelta.Packets += stats.RxPackets
rxDelta.Dropped += stats.RxDropped
rxD... | [
0.6007647514343262,
0.159703329205513,
0.7600473165512085,
-1.1197466850280762,
-0.13298922777175903,
0.41145431995391846,
0.33839333057403564,
-1.394104242324829,
0.8145763278007507,
-1.2164372205734253,
0.4711247384548187,
-0.3945613503456116,
0.30569061636924744,
0.6411420702934265,
-... |
func NewDockerCPUStatsDelta(prev, next docker.ContainerCPUStats) *DockerCPUStatsDelta {
if prev == next {
return nil
}
delta := DockerCPUStatsDelta{
ThrottlingCount: next.Throttling.Periods - prev.Throttling.Periods,
ThrottlingTime: next.Throttling.Time - prev.Throttling.Time,
}
if systemDelta := next.Sys... | [
0.8215727210044861,
-0.1965595781803131,
0.727370023727417,
0.21661566197872162,
-0.7860545516014099,
0.6187724471092224,
0.6719252467155457,
-0.7353485822677612,
-0.6421268582344055,
-0.15211345255374908,
0.1642501950263977,
0.5885190963745117,
0.35751181840896606,
0.6763541102409363,
0... |
func NewDockerMemoryStatsUpdate(prev, next docker.ContainerMemoryStats) *DockerMemoryStatsUpdate {
if prev == next {
return nil
}
var delta DockerMemoryStatsUpdate
if prev.Usage != next.Usage {
delta.Usage = &next.Usage
}
if prev.MaxUsage != next.MaxUsage {
delta.MaxUsage = &next.MaxUsage
}
if prev.Limit... | [
0.8119117021560669,
-0.5603001117706299,
0.78477942943573,
-0.35622096061706543,
-1.0582572221755981,
-0.47216540575027466,
0.46313920617103577,
-0.8359842896461487,
0.3830796778202057,
-0.10657718777656555,
-0.10497573018074036,
0.49577826261520386,
-0.5047836303710938,
-0.268025159835815... |
func (d DockerBlockIOStatsDelta) IsZero() bool {
return d.Read == 0 && d.Write == 0
} | [
0.1374967247247696,
0.1709050089120865,
0.4755842983722687,
0.8508393168449402,
0.38875317573547363,
-0.03888927400112152,
0.85081547498703,
-0.4368705749511719,
0.3381233215332031,
-0.9008628726005554,
0.4362929165363312,
0.7891960144042969,
-0.06555556505918503,
0.43784961104393005,
-0... |
func NewDockerBlockIOStatsDelta(prev, next docker.ContainerBlockIOStats) *DockerBlockIOStatsDelta {
var delta DockerBlockIOStatsDelta
for _, stat := range next.ServiceBytes {
switch stat.Operation {
case docker.BlockIOReadOp:
delta.Read += stat.Value
case docker.BlockIOWriteOp:
delta.Write += stat.Value
... | [
0.7157873511314392,
-0.1860521137714386,
0.8027657866477966,
0.3982941806316376,
-0.46510520577430725,
-0.15927734971046448,
1.291681170463562,
-1.363344430923462,
-0.025156695395708084,
-0.8850911259651184,
0.44061338901519775,
0.09215688705444336,
0.00026289065135642886,
0.05105757713317... |
func filterAndSplitFiles(fileNames []string) (archiveSrcs, error) {
var res archiveSrcs
packageContainsCgo := false
for _, s := range fileNames {
src, err := readFileInfo(build.Default, s)
if err != nil {
return archiveSrcs{}, err
}
if src.isCgo {
packageContainsCgo = true
}
if !src.matched {
co... | [
-0.15508592128753662,
-0.10845093429088593,
0.5458861589431763,
-0.07909034192562103,
-0.2263369858264923,
-0.14627107977867126,
0.4954496920108795,
0.8932908177375793,
0.5043989419937134,
0.40735816955566406,
0.018971368670463562,
-0.6201079487800598,
-0.6114766001701355,
0.51276427507400... |
func readFileInfo(bctx build.Context, input string) (fileInfo, error) {
fi := fileInfo{filename: input}
if ext := filepath.Ext(input); ext == ".C" {
fi.ext = cxxExt
} else {
switch strings.ToLower(ext) {
case ".go":
fi.ext = goExt
case ".c":
fi.ext = cExt
case ".cc", ".cxx", ".cpp":
fi.ext = cxxEx... | [
0.37909039855003357,
-0.38286900520324707,
0.7512306571006775,
-0.04860163852572441,
-0.5357500910758972,
0.6629982590675354,
0.7335343360900879,
0.05317530781030655,
-0.5747448801994324,
0.003323314944282174,
-0.45314526557922363,
0.27337515354156494,
-0.3136194944381714,
-0.0818263217806... |
func CreateRaidArray(driveNames []string, volName string, raidLevel int) (string, error) {
var raidDriveName string
var err error
if raidDriveName, err = randRaidDriveNamePicker(); err != nil {
return "", fmt.Errorf("Couldn't select unused RAID drive name: %v", err)
}
cmd := "mdadm"
nameString := "--name='GO... | [
-0.9296790361404419,
-0.5191974639892578,
0.7989662885665894,
-0.8021214604377747,
0.5842137932777405,
-0.09335262328386307,
-0.562387228012085,
-0.6854938268661499,
-0.6073081493377686,
0.7498160004615784,
0.5913365483283997,
0.5458288788795471,
-1.771840214729309,
0.8852007985115051,
1... |
func PersistMdadm() error {
cmd := "mdadm"
args := []string{
"--verbose",
"--detail",
"--scan",
}
var out CommandOut
var err error
if out, err = Command(cmd, args, ""); err != nil {
return fmt.Errorf("Error when executing mdadm command: %v", err)
}
f, err := os.OpenFile("/etc/mdadm.conf", os.O_WRONLY... | [
-0.1406419724225998,
0.19692642986774445,
0.8575349450111389,
-0.44262298941612244,
0.3181706964969635,
0.8374994397163391,
0.22430092096328735,
-0.3747054636478424,
-0.2474636435508728,
0.05794154107570648,
0.042244669049978256,
0.9338053464889526,
-0.3362921476364136,
0.8067206740379333,... |
func (gr *GroupResource) Create(owner string, name string) (g *GroupDetails, err error) {
ownerOrCurrentUser(gr, &owner)
path := fmt.Sprintf("/groups/%s/", owner)
values := url.Values{}
values.Set("name", name)
err = gr.client.do("POST", path, nil, values, &g)
return
} | [
-0.24920251965522766,
1.0996785163879395,
0.24463513493537903,
0.5329007506370544,
0.034084856510162354,
0.3728269934654236,
-0.4707590639591217,
-1.027223825454712,
-0.9598104953765869,
-0.22596515715122223,
-0.08951395750045776,
0.0574435293674469,
-0.7825469374656677,
0.5252631902694702... |
func (gr *GroupResource) Delete(owner string, slug string) error {
ownerOrCurrentUser(gr, &owner)
path := fmt.Sprintf("/groups/%s/%s", owner, slug)
return gr.client.do("DELETE", path, nil, nil, nil)
} | [
-0.22108779847621918,
0.41276103258132935,
0.273901104927063,
0.5991429686546326,
0.27531754970550537,
-0.6277874708175659,
0.3380903899669647,
-0.2892528474330902,
-0.5457372665405273,
-0.17381200194358826,
0.30794742703437805,
0.43625155091285706,
-1.1616015434265137,
-0.3407909274101257... |
func (gr *GroupResource) List(owner string) (g []*GroupDetails, err error) {
ownerOrCurrentUser(gr, &owner)
path := fmt.Sprintf("/groups/%s/", owner)
err = gr.client.do("GET", path, nil, nil, &g)
return g, nil
} | [
-0.5406157970428467,
0.2948363125324249,
0.28189119696617126,
0.33914512395858765,
0.6739257574081421,
-0.7533339858055115,
-0.13827545940876007,
-0.270267128944397,
0.2945293188095093,
-0.3384517729282379,
-0.056894805282354355,
0.317157119512558,
-0.25735634565353394,
0.5389714241027832,... |
func (gr *GroupResource) Get(owner string, slug string) (*Group, error) {
ownerOrCurrentUser(gr, &owner)
filter := fmt.Sprintf("%s/%s", owner, slug)
params := url.Values{
"group": {filter},
}
var groups []Group
err := gr.client.do("GET", "/groups", params, nil, &groups)
if err != nil {
return nil, err
}
... | [
-1.0701717138290405,
0.5033025741577148,
0.17177164554595947,
0.10524448752403259,
0.5071070790290833,
-1.1749775409698486,
-0.27696338295936584,
-0.6444509625434875,
-0.40377578139305115,
-0.7573971152305603,
0.7205731272697449,
0.9397665858268738,
-0.378121942281723,
-0.0932619646191597,... |
func (gr *GroupResource) AddMember(owner string, group string, member string) (user *User, err error) {
ownerOrCurrentUser(gr, &owner)
path := fmt.Sprintf("/groups/%s/%s/members/%s", owner, group, member)
err = gr.client.do("PUT", path, nil, nil, &user)
return
} | [
-1.0040532350540161,
0.13615216314792633,
0.40586817264556885,
1.0222536325454712,
-0.34847891330718994,
0.22853897511959076,
0.09203854948282242,
-0.6672653555870056,
-0.3834344148635864,
-0.5474953055381775,
0.36786264181137085,
0.49585697054862976,
-1.0752732753753662,
-0.73037809133529... |
func (gr *GroupResource) GetMembers(owner string, group string) (members *[]User, err error) {
ownerOrCurrentUser(gr, &owner)
path := fmt.Sprintf("/groups/%s/%s/members/", owner, group)
err = gr.client.do("GET", path, nil, nil, &members)
return
} | [
-0.8406209945678711,
0.5371530652046204,
0.16833794116973877,
1.0472744703292847,
1.1159089803695679,
-0.7208101749420166,
-0.42924538254737854,
-0.9537280797958374,
-0.15290361642837524,
-0.4084816575050354,
0.4452604353427887,
1.234155297279358,
-1.0344107151031494,
-0.08444330841302872,... |
func (gr *GroupResource) RemoveMember(owner string, group string, member string) (err error) {
ownerOrCurrentUser(gr, &owner)
path := fmt.Sprintf("/groups/%s/%s/members/%s", owner, group, member)
err = gr.client.do("DELETE", path, nil, nil, nil)
return
} | [
-0.9780212044715881,
0.07428582012653351,
0.07381117343902588,
0.6852270364761353,
-0.22779256105422974,
-0.23516876995563507,
0.2146669626235962,
-0.07221608608961105,
-0.7021282315254211,
0.1462041139602661,
0.490888774394989,
0.45813778042793274,
-0.8573164343833923,
-0.737070620059967,... |
func ownerOrCurrentUser(gr *GroupResource, owner *string) error {
if owner == nil || (*owner) == "" {
current, err := gr.client.Users.Current()
if err == nil {
return err
}
*owner = current.User.Username
}
return nil
} | [
-0.7160448431968689,
-0.35261452198028564,
0.32231462001800537,
0.48314687609672546,
0.06922582536935806,
-0.5317331552505493,
0.7404864430427551,
-0.24826160073280334,
-0.38609108328819275,
0.3394682705402374,
0.7708067297935486,
-0.10714757442474365,
0.06918349117040634,
0.16258402168750... |
func (dst *Proxy) Merge(src Proxy) {
if dst == nil || dst.Name != src.Name {
return
}
if src.Enabled != nil {
dst.Enabled = src.Enabled
}
dst.Hosts.Merge(src.Hosts)
} | [
-1.2576770782470703,
1.4367693662643433,
0.4245710074901581,
-0.5908396244049072,
-0.30334335565567017,
0.5243402123451233,
-0.8020527362823486,
0.6082981824874878,
-0.2577999234199524,
-0.2117135226726532,
-1.1889230012893677,
0.0799088403582573,
-1.134338140487671,
0.3452829122543335,
... |
func (dst Proxies) Len() int { return len(dst) } | [
-0.4339825510978699,
0.8872140645980835,
0.22475211322307587,
-1.3716111183166504,
0.16548797488212585,
-0.09647861123085022,
0.9183375239372253,
1.2475788593292236,
0.03208211064338684,
0.12452120333909988,
-0.8663714528083801,
0.5478591918945312,
0.5867260694503784,
-0.36811915040016174,... |
func (dst *Proxies) Merge(src Proxies) {
if dst == nil || len(src) == 0 {
return
}
copied := *dst
copied = append(copied, src...)
registry := map[string]int{}
for i := len(copied); i > 0; i-- {
registry[copied[i-1].Name] = i - 1
}
unique := copied[:0]
for i, proxy := range copied {
origin := registry[p... | [
-1.7119792699813843,
0.8707734942436218,
0.753436267375946,
-0.3698391318321228,
0.08567043393850327,
0.3591215908527374,
0.4349781572818756,
0.09202992171049118,
0.20762291550636292,
-0.07819371670484543,
-1.003700852394104,
-0.002170763909816742,
-0.8252429962158203,
0.2446899265050888,
... |
func (i LabelSelectorInput) Validate() error {
return validation.ValidateStruct(&i,
validation.Field(&i.Key, validation.In("global_subaccount_id")),
)
} | [
-0.5995879173278809,
0.3964342176914215,
0.1391390860080719,
0.07094486057758331,
0.124003566801548,
1.061353087425232,
0.3270524740219116,
-0.3691348731517792,
-0.4615855813026428,
0.20331551134586334,
-0.09656951576471329,
0.2258189171552658,
-0.961123526096344,
0.008738976903259754,
0... |
func ToDogYears(n int) int {
return n * 7
} | [
-0.3106166124343872,
1.193267822265625,
0.527397871017456,
-0.9962621927261353,
-0.5874978303909302,
-0.3766164779663086,
-0.35975736379623413,
-0.501081109046936,
0.6621540784835815,
0.23353271186351776,
-1.0620331764221191,
-0.39019834995269775,
0.5943470001220703,
0.8794159889221191,
... |
func ToDogYears2(n int) int {
count := 0
for i := 0; i < n; i++ {
count += 7
}
return count
} | [
0.1270337849855423,
0.4504864513874054,
0.6286138892173767,
-0.45732027292251587,
-0.3212891221046448,
-0.4907089173793793,
-0.32508623600006104,
-0.59348064661026,
-0.3431722819805145,
-0.14630526304244995,
-1.0107003450393677,
0.048145219683647156,
0.7011922597885132,
1.1229921579360962,... |
func (uc *unicodeCICollator) Compare(a, b string) int {
a = truncateTailingSpace(a)
b = truncateTailingSpace(b)
// weight of a, b. weight in unicode_ci may has 8 uint16s. xn indicate first 4 u16s, xs indicate last 4 u16s
an, bn := uint64(0), uint64(0)
as, bs := uint64(0), uint64(0)
// rune of a, b
ar, br := rune... | [
0.33369794487953186,
-0.25477805733680725,
0.7583881616592407,
-0.6380618214607239,
-0.26573219895362854,
-0.8547464609146118,
-0.10180623084306717,
-0.3342404067516327,
-0.5158132910728455,
0.2552330493927002,
-0.026508469134569168,
-0.0112800607457757,
-0.7216710448265076,
0.243362665176... |
func (uc *unicodeCICollator) Key(str string) []byte {
str = truncateTailingSpace(str)
buf := make([]byte, 0, len(str)*2)
r := rune(0)
si := 0 // decode index of s
sn, ss := uint64(0), uint64(0) // weight of str. weight in unicode_ci may has 8 uint16s. sn indicate first 4 u16s, ss indicate la... | [
0.03820458799600601,
-0.13033714890480042,
0.5306055545806885,
0.1564052850008011,
-0.4125595688819885,
0.05556878075003624,
-0.238925501704216,
-0.09009893238544464,
-0.23410899937152863,
0.34084323048591614,
-0.8257112503051758,
-0.19491621851921082,
-1.0392053127288818,
-0.3851657509803... |
func convertRuneUnicodeCI(r rune) (first, second uint64) {
if r > 0xFFFF {
return 0xFFFD, 0
}
if mapTable[r] == longRune {
return longRuneMap[r][0], longRuneMap[r][1]
}
return mapTable[r], 0
} | [
-0.7546930909156799,
-0.8538183569908142,
0.600457489490509,
-0.2689289450645447,
-0.23321913182735443,
-0.6339507699012756,
0.016231723129749298,
0.24854375422000885,
-0.15508389472961426,
0.11243157833814621,
-0.9838747978210449,
0.6673030257225037,
0.49904778599739075,
0.454914301633834... |
func (uc *unicodeCICollator) Pattern() WildcardPattern {
return &unicodePattern{}
} | [
0.011364464648067951,
0.55721515417099,
0.08555169403553009,
0.0458415262401104,
-0.2062734216451645,
0.7409413456916809,
-0.12269841134548187,
0.9744628071784973,
0.8558583855628967,
-1.1464647054672241,
-0.4474562406539917,
0.3866429626941681,
-0.4949035942554474,
0.18701118230819702,
... |
func (p *unicodePattern) Compile(patternStr string, escape byte) {
p.patChars, p.patTypes = stringutil.CompilePatternInner(patternStr, escape)
} | [
-0.24384808540344238,
-0.5575881004333496,
0.17828762531280518,
-0.2682434320449829,
-0.18823866546154022,
0.6894785165786743,
-0.1179991066455841,
0.7205590009689331,
0.3142980933189392,
-1.085335612297058,
-1.1065456867218018,
0.6692143678665161,
0.04158131033182144,
-0.40835142135620117... |
func (p *unicodePattern) DoMatch(str string) bool {
return stringutil.DoMatchInner(str, p.patChars, p.patTypes, func(a, b rune) bool {
if a > 0xFFFF || b > 0xFFFF {
return a == b
}
ar, br := mapTable[a], mapTable[b]
if ar != br {
return false
}
if ar == longRune {
return a == b
}
return tru... | [
-0.2456538826227188,
-0.3234468400478363,
0.6222178339958191,
0.016054730862379074,
-0.9391682147979736,
0.7237774133682251,
-0.4206421673297882,
-0.32785922288894653,
0.2515292763710022,
-0.3926244378089905,
-0.18062886595726013,
-0.16140522062778473,
-0.388418585062027,
-0.20871779322624... |
func (s ResetImageAttributeInput) String() string {
return awsutil.Prettify(s)
} | [
-0.02384674921631813,
-0.45343920588493347,
0.002085399115458131,
-0.576653003692627,
-0.5720999836921692,
-0.09962418675422668,
1.6549659967422485,
-0.6448581218719482,
0.168152317404747,
0.6647603511810303,
0.340874582529068,
0.4110491871833801,
0.1976061314344406,
-0.20627325773239136,
... |
func (s *ResetImageAttributeInput) Validate() error {
invalidParams := aws.ErrInvalidParams{Context: "ResetImageAttributeInput"}
if len(s.Attribute) == 0 {
invalidParams.Add(aws.NewErrParamRequired("Attribute"))
}
if s.ImageId == nil {
invalidParams.Add(aws.NewErrParamRequired("ImageId"))
}
if invalidParams... | [
-0.578535258769989,
0.04741174355149269,
0.3644695580005646,
-0.12319452315568924,
0.010453982278704643,
-0.7270857691764832,
1.0439444780349731,
-0.1414773017168045,
-0.20106004178524017,
0.6783148050308228,
0.7118357419967651,
-0.06395077705383301,
-0.46575304865837097,
0.583804666996002... |
func (s ResetImageAttributeOutput) String() string {
return awsutil.Prettify(s)
} | [
0.5038659572601318,
-0.5444681644439697,
-0.03367357328534126,
-0.5643624067306519,
-0.8635590076446533,
-0.9771092534065247,
1.5714020729064941,
-0.7255131006240845,
-0.41408979892730713,
0.5262789726257324,
0.7881327867507935,
0.1647436022758484,
0.59218430519104,
-0.44736355543136597,
... |
func (r ResetImageAttributeRequest) Send(ctx context.Context) (*ResetImageAttributeResponse, error) {
r.Request.SetContext(ctx)
err := r.Request.Send()
if err != nil {
return nil, err
}
resp := &ResetImageAttributeResponse{
ResetImageAttributeOutput: r.Request.Data.(*ResetImageAttributeOutput),
response: ... | [
-1.4788018465042114,
-0.1300431340932846,
0.19460400938987732,
-0.17911653220653534,
0.01836073212325573,
-1.292141079902649,
0.7334847450256348,
-0.6116144061088562,
0.20144341886043549,
0.8610307574272156,
-0.07095444202423096,
0.585294783115387,
-0.20673255622386932,
-0.3306629657745361... |
func (r *ResetImageAttributeResponse) SDKResponseMetdata() *aws.Response {
return r.response
} | [
-0.391098290681839,
-0.18104523420333862,
0.14087221026420593,
-0.5395160913467407,
-0.011473610997200012,
-0.8494933247566223,
0.4441837668418884,
-0.28585678339004517,
0.6339913606643677,
0.7297728061676025,
-0.06351300328969955,
-0.07073453068733215,
-0.2508406341075897,
-0.823379039764... |
func main() {
//var value string
//fmt.Scanln(&value)
//fmt.Println("your string is", value)
// the problem code above is only return first input,
// if we enter space and another second text it will not show
reader := bufio.NewReader(os.Stdin)
fmt.Print("Enter a string text:")
str, _ := reader.ReadString('\... | [
0.8748236894607544,
-0.5975193977355957,
1.0338869094848633,
0.4686833918094635,
-0.5246577858924866,
0.4223870038986206,
0.2759721875190735,
0.07096430659294128,
0.1319858729839325,
-0.41963282227516174,
0.795276403427124,
0.7195996046066284,
0.02923668548464775,
0.0590360127389431,
0.1... |
func serverID(td spiffeid.TrustDomain) *spiretypes.SPIFFEID {
return &spiretypes.SPIFFEID{
TrustDomain: td.String(),
Path: idutil.ServerIDPath,
}
} | [
0.20333421230316162,
0.012663004919886589,
0.09117705374956131,
-0.08189040422439575,
0.2503935694694519,
0.7049843072891235,
0.7605765461921692,
0.6166205406188965,
0.9492676854133606,
0.7362204790115356,
-0.35724660754203796,
1.6936752796173096,
-0.6858181357383728,
0.6822616457939148,
... |
func countSubstrings(s string) int {
l := len(s)
if l <= 0 {
return 0
}
count := 0
extend := func(left int, right int) {
for left >= 0 && right < l && s[left] == s[right] {
left--
right++
count++
}
}
for mid := 0; mid < l; mid++ {
extend(mid, mid)
extend(mid, mid+1)
}
return count
} | [
0.8141401410102844,
-0.26744088530540466,
0.7401281595230103,
-0.0573468841612339,
-1.0282957553863525,
0.3314712643623352,
0.9416723847389221,
-0.005058337934315205,
0.3976750671863556,
0.06130722537636757,
-1.2726693153381348,
0.4259451627731323,
-0.49385514855384827,
0.1025308221578598,... |
func GetNeighbor(w http.ResponseWriter, r *http.Request) {
neighbor := getNeighbor()
// Check if neighbor is empty
if neighbor == "" {
log.Error("neighbor not present")
w.WriteHeader(http.StatusNotFound)
return
}
log.WithFields(log.Fields{"Neighbor": neighbor}).Debug("successfull GetNeighbor")
json.NewEnc... | [
-0.43299558758735657,
-0.46647337079048157,
0.7576042413711548,
1.1207765340805054,
-0.5123964548110962,
0.3012177050113678,
0.2521167993545532,
-0.4856676757335663,
-0.746013879776001,
0.4741426408290863,
-0.6368805170059204,
1.0457757711410522,
-0.5306761860847473,
0.41935428977012634,
... |
func (p DirectHandler) Name() string { return p.ProviderName } | [
-0.6986318230628967,
-0.7089923620223999,
0.3778792917728424,
-0.2245163470506668,
-1.0668798685073853,
1.9592090845108032,
0.4765390157699585,
-0.13677993416786194,
-0.1803000271320343,
0.8116663098335266,
-0.7183222770690918,
-0.06723703444004059,
0.1209917813539505,
-0.18229788541793823... |
func (p DirectHandler) getCredentials(w http.ResponseWriter, r *http.Request) (credentials, error) {
// GET /something?user=name&passwd=xyz&aud=bar
if r.Method == "GET" {
return credentials{
User: r.URL.Query().Get("user"),
Password: r.URL.Query().Get("passwd"),
Audience: r.URL.Query().Get("aud"),
}... | [
-0.3964956998825073,
-0.34022167325019836,
0.9522210955619812,
0.22624321281909943,
-0.21330885589122772,
0.46845170855522156,
-0.47478580474853516,
-0.8423177003860474,
-0.29655951261520386,
-0.27687928080558777,
0.48080527782440186,
0.16370850801467896,
0.09349732100963593,
0.89032018184... |
func (p DirectHandler) AuthHandler(http.ResponseWriter, *http.Request) {} | [
-0.6476026773452759,
-1.181143879890442,
0.27122920751571655,
1.082013726234436,
-0.6095266342163086,
0.9999585747718811,
1.867419958114624,
0.45804139971733093,
0.1340685486793518,
-0.9026342034339905,
-0.2086084634065628,
-0.10326825827360153,
-0.1597164124250412,
-0.3420393168926239,
... |
func NewDeviceManagementComplexSettingDefinition()(*DeviceManagementComplexSettingDefinition) {
m := &DeviceManagementComplexSettingDefinition{
DeviceManagementSettingDefinition: *NewDeviceManagementSettingDefinition(),
}
return m
} | [
-0.3263174593448639,
0.5603349208831787,
0.10041051357984543,
0.07412789016962051,
-1.0883454084396362,
-0.5048311948776245,
0.48672109842300415,
0.3179553151130676,
0.3561232388019562,
-0.29578590393066406,
-1.0053579807281494,
-0.5457300543785095,
-0.21114285290241241,
0.0298594180494546... |
func CreateDeviceManagementComplexSettingDefinitionFromDiscriminatorValue(parseNode i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.ParseNode)(i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.Parsable, error) {
return NewDeviceManagementComplexSettingDefinition(), nil
} | [
0.25111326575279236,
0.08633384108543396,
0.2678077816963196,
-0.11851995438337326,
-0.8531640768051147,
0.21209625899791718,
0.8560523986816406,
0.3749397397041321,
0.6252725124359131,
-0.4149300158023834,
-0.21938644349575043,
-0.13958922028541565,
0.37327489256858826,
0.4659576416015625... |
func (m *DeviceManagementComplexSettingDefinition) GetFieldDeserializers()(map[string]func(i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.ParseNode)(error)) {
res := m.DeviceManagementSettingDefinition.GetFieldDeserializers()
res["propertyDefinitionIds"] = func (n i878a80d2330e89d26896388a3f4... | [
-0.5971935391426086,
0.549780011177063,
0.1624182164669037,
-0.6708123087882996,
0.10112397372722626,
-0.9331865906715393,
0.03306819498538971,
0.19206662476062775,
-0.7872233986854553,
-0.588925302028656,
-0.6006373167037964,
-0.04128017649054527,
-1.0539497137069702,
-0.10338513553142548... |
func (m *DeviceManagementComplexSettingDefinition) GetPropertyDefinitionIds()([]string) {
val, err := m.GetBackingStore().Get("propertyDefinitionIds")
if err != nil {
panic(err)
}
if val != nil {
return val.([]string)
}
return nil
} | [
0.012350562028586864,
-0.0901239737868309,
-0.06354089826345444,
1.0729928016662598,
0.48505091667175293,
-0.06923689693212509,
-0.3253634572029114,
0.14849549531936646,
0.0336921289563179,
-0.46197250485420227,
-0.5258781909942627,
-0.15223929286003113,
-0.2539539337158203,
-0.50248873233... |
func (m *DeviceManagementComplexSettingDefinition) Serialize(writer i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.SerializationWriter)(error) {
err := m.DeviceManagementSettingDefinition.Serialize(writer)
if err != nil {
return err
}
if m.GetPropertyDefinitionIds() != nil {
... | [
-0.8198474645614624,
0.8312493562698364,
0.1580590009689331,
-0.293883740901947,
0.26569294929504395,
-0.786932647228241,
0.9297527074813843,
0.15114833414554596,
-0.3623996675014496,
-0.1005987599492073,
-0.2598254978656769,
-0.483970046043396,
-0.31214383244514465,
0.2061038613319397,
... |
func (m *DeviceManagementComplexSettingDefinition) SetPropertyDefinitionIds(value []string)() {
err := m.GetBackingStore().Set("propertyDefinitionIds", value)
if err != nil {
panic(err)
}
} | [
-0.5623145699501038,
-0.3972964882850647,
-0.10860016196966171,
0.7362017631530762,
0.2449703961610794,
0.3261260390281677,
-0.044801510870456696,
0.12009421736001968,
-0.5586462020874023,
-0.395438551902771,
-0.35082802176475525,
-0.744797945022583,
-0.0027119582518935204,
-0.477932751178... |
func newDictEntry() *dictionaryEntry {
var de = new(dictionaryEntry)
de.Idioms = make([]string, 0, 10)
de.Translations = make([]string, 0, 10)
return de
} | [
0.15210147202014923,
-0.0003680835070554167,
0.07789444178342819,
-0.38873931765556335,
-0.050925541669130325,
-0.4672905504703522,
-0.0627540573477745,
-0.18030788004398346,
0.2103152573108673,
-0.33653655648231506,
-0.3747929036617279,
0.2059343308210373,
0.13217149674892426,
1.366201281... |
func (b *BaseResponse) Request() *http.Request {
return b.req
} | [
-0.8898922801017761,
-0.9962023496627808,
0.38974615931510925,
0.889868438243866,
0.8679873943328857,
0.36581239104270935,
0.40401625633239746,
-0.04670547693967819,
0.8390636444091797,
-1.4704841375350952,
0.6786098480224609,
0.7975233793258667,
-0.1334150731563568,
-0.21643158793449402,
... |
func (b *BaseResponse) Context() context.Context {
return b.ctx
} | [
0.3852593004703522,
-1.2519428730010986,
0.3331851363182068,
-0.10875465720891953,
0.2526386082172394,
0.7535726428031921,
0.6858243346214294,
-0.6580007076263428,
1.6258479356765747,
-1.0954360961914062,
-0.37139883637428284,
0.3700301945209503,
-0.4941454827785492,
-0.7032766342163086,
... |
func (b *BaseResponse) Lang() string {
return b.lang
} | [
0.5083816647529602,
-0.9946581721305847,
0.05011159926652908,
0.8253799676895142,
0.08218343555927277,
0.8928436636924744,
0.9903432130813599,
-0.3883224129676819,
0.7787281274795532,
-1.1943813562393188,
-0.12858323752880096,
-0.5925177335739136,
0.32364630699157715,
-0.2554578483104706,
... |
func (driver *Driver) Open(name string) (driver.Conn, error) {
servers := strings.Split(name, ",")
normalizedServers := []string{}
for _, server := range servers {
normalizedServers = append(normalizedServers, strings.TrimRight(strings.Trim(server, " "), "/"))
}
return &Conn{normalizedServers, 0}, nil
} | [
-1.3876123428344727,
-0.5454733371734619,
0.47412604093551636,
0.23843523859977722,
-1.2319164276123047,
0.04940826818346977,
0.21467679738998413,
1.1253238916397095,
0.33353182673454285,
0.059169474989175797,
-0.22662021219730377,
-0.3308970630168915,
-0.6841642260551453,
-0.8166301846504... |
func (wormHole *WormHole) SessionInfo() (wormHoleResponse WormholeResponse) {
config := util.Configuration{}
config = config.Config()
wh := fmt.Sprintf("https://wormhole.api.bbci.co.uk/account/%s/credentials", config.AwsAccountID)
body, err := wormHole.UgcHttp.FetchItemWormHole(wh, make(map[string]string))
if err... | [
-0.41641899943351746,
-1.0098507404327393,
0.7465574741363525,
-0.42511528730392456,
-0.38855957984924316,
-0.7224595546722412,
0.569847583770752,
-0.8578953742980957,
0.53572678565979,
1.2517327070236206,
-0.5729701519012451,
0.4519669711589813,
-0.8219624757766724,
-0.2569383978843689,
... |
func NewController(
nodeInformer coreinformers.NodeInformer,
machineInformer mapiinformers.MachineInformer,
kubeClient kubeclientset.Interface,
capiClient mapiclient.Interface,
) *Controller {
eventBroadcaster := record.NewBroadcaster()
eventBroadcaster.StartLogging(glog.Infof)
// TODO: remove the wrapper when ... | [
0.09397753328084946,
-0.04426959529519081,
0.39458221197128296,
-0.5830010175704956,
-0.32659074664115906,
-0.23237821459770203,
0.16484618186950684,
-0.5529965162277222,
-0.4192635416984558,
-0.6954724192619324,
0.8885467648506165,
0.17354682087898254,
0.17083947360515594,
0.7178109288215... |
func WaitForCacheSync(controllerName string, stopCh <-chan struct{}, cacheSyncs ...cache.InformerSynced) bool {
glog.Infof("Waiting for caches to sync for %s controller", controllerName)
if !cache.WaitForCacheSync(stopCh, cacheSyncs...) {
utilruntime.HandleError(fmt.Errorf("unable to sync caches for %s controller"... | [
-0.2532953917980194,
1.0941864252090454,
0.3892856538295746,
-0.006560795940458775,
-0.24479886889457703,
-0.1416701227426529,
-0.11464810371398926,
-0.35628563165664673,
-0.8184809684753418,
-0.6112454533576965,
-0.891119658946991,
-0.7027459144592285,
1.1709445714950562,
0.47027546167373... |
func (c *Controller) Run(workers int, stopCh <-chan struct{}) {
defer utilruntime.HandleCrash()
defer c.queue.ShutDown()
glog.Infof("Starting nodelink controller")
defer glog.Infof("Shutting down nodelink controller")
if !WaitForCacheSync("machine", stopCh, c.machinesSynced) {
return
}
if !WaitForCacheSync(... | [
-0.9029785990715027,
0.2844659686088562,
0.24805979430675507,
-0.38531559705734253,
0.7634660005569458,
0.2081138640642166,
0.6300919651985168,
-0.2967773973941803,
-0.8848750591278076,
-0.4859146177768707,
-0.6432700157165527,
-0.3140130043029785,
-0.27572497725486755,
0.6522249579429626,... |
func (c *Controller) worker() {
for c.processNextWorkItem() {
}
} | [
-0.9753136038780212,
0.16870787739753723,
0.2219727635383606,
0.6848817467689514,
0.6454097032546997,
0.41756561398506165,
0.5113236308097839,
-0.06414509564638138,
-0.6429640054702759,
-0.6696827411651611,
-1.5898109674453735,
-1.2458269596099854,
-0.20461991429328918,
0.5884662866592407,... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.