text stringlengths 11 6.3k | embedding listlengths 768 768 |
|---|---|
func registerKogitoAppSteps(s *godog.Suite, data *Data) {
// Deploy steps
s.Step(`^"([^"]*)" deploy quarkus example service "([^"]*)" with native "([^"]*)"$`, data.deployQuarkusExampleServiceWithNative)
s.Step(`^"([^"]*)" deploy quarkus example service "([^"]*)" with native "([^"]*)" and labels$`, data.deployQuarkus... | [
0.3658198416233063,
-0.43769779801368713,
0.8780015707015991,
-0.32617640495300293,
-0.23120999336242676,
0.08373196423053741,
-0.5575796961784363,
-0.44688233733177185,
-0.44404494762420654,
0.7316558957099915,
-1.0101011991500854,
0.1260925978422165,
0.312524676322937,
0.5086559057235718... |
func NewListCmd(f *cmdutil.Factory) *ListCmd {
ccmd := &ListCmd{
factory: f,
}
cmd := &cobra.Command{
Use: "list",
Short: "List smart group collection",
Long: `Get a collection of smart groups based on filter parameters`,
Example: heredoc.Doc(`
$ c8y smartgroups list
Get a list of smart groups
... | [
-0.056400593370199203,
-0.6665391325950623,
0.777277946472168,
-0.31409087777137756,
-0.8080798983573914,
-0.3614965081214905,
0.47425219416618347,
-0.03087450936436653,
0.5631913542747498,
-0.5128691792488098,
-0.35092872381210327,
0.6009225249290466,
0.1940910369157791,
0.826676189899444... |
func (n *ListCmd) RunE(cmd *cobra.Command, args []string) error {
cfg, err := n.factory.Config()
if err != nil {
return err
}
client, err := n.factory.Client()
if err != nil {
return err
}
inputIterators, err := cmdutil.NewRequestInputIterators(cmd, cfg)
if err != nil {
return err
}
// query parameter... | [
-0.9992989301681519,
-0.11446782946586609,
0.8623248934745789,
-0.09492488950490952,
-0.06283567100763321,
-0.1855112612247467,
0.581817090511322,
-0.1799575835466385,
-0.4728343188762665,
0.3706853687763214,
0.16002269089221954,
0.5933562517166138,
-0.5147204399108887,
0.941940426826477,
... |
func SendHTMLMail(sender string, server string, port string, a smtp.Auth, msg *Message, cfg tls.Config) error {
addr := server + ":" + port
msgBytes, err := msg.Bytes()
var to []string
for _, address := range msg.To {
to = append(to, address.Address)
}
activityLog.Info("... sendHTMLEmail - dial with: " + addr)
... | [
-0.5641309022903442,
0.6931413412094116,
0.6322113871574402,
0.4853212535381317,
-0.5378358960151672,
0.14160899817943573,
0.4403342008590698,
-0.19663074612617493,
-0.3308768570423126,
0.038679491728544235,
-0.6253437399864197,
0.8137246370315552,
-0.33054879307746887,
0.48641473054885864... |
func getAddressListString(addresses []mail.Address) string {
var addressStrings []string
for _, address := range addresses {
addressStrings = append(addressStrings, address.String())
}
return strings.Join(addressStrings, ","+crlf+" ")
} | [
-0.2773452401161194,
-0.4332021176815033,
0.6510738730430603,
-0.665029764175415,
0.15967121720314026,
-0.05920872092247009,
-1.1088111400604248,
0.33635810017585754,
1.396519660949707,
0.4162617027759552,
0.6230420470237732,
0.5610143542289734,
0.38986676931381226,
0.47479405999183655,
... |
func New(server string, tlsInsecureSkipVerify bool, compat bool) (Client, error) {
// Select TLS protocols for DoQ
var tlsProtos []string
if compat {
tlsProtos = doq.TlsProtosCompat
} else {
tlsProtos = doq.TlsProtos
}
// Connect to DoQ server
log.Debugln("dialing quic server")
session, err := quic.DialAdd... | [
-0.5162060856819153,
-1.0201711654663086,
0.4909595847129822,
-0.4205315411090851,
-0.5372421145439148,
0.31188347935676575,
-0.06337600946426392,
-0.830572247505188,
-0.03116934560239315,
-0.07034652680158615,
0.1337292343378067,
0.09661915898323059,
0.15662476420402527,
-0.27940213680267... |
func (c Client) Close() error {
log.Debugln("closing quic session")
return c.Session.CloseWithError(0, "")
} | [
0.6013907194137573,
-0.6619336009025574,
0.277016282081604,
-0.5223453640937805,
-0.16616912186145782,
-0.048185937106609344,
0.30177074670791626,
-1.7997112274169922,
-0.14961905777454376,
-0.8594440221786499,
0.5367048382759094,
-0.3437359929084778,
-0.714059591293335,
-0.412674129009246... |
func (c Client) SendQuery(message dns.Msg) (dns.Msg, error) {
// Open a new QUIC stream
log.Debugln("opening new quic stream")
stream, err := c.Session.OpenStream()
if err != nil {
return dns.Msg{}, errors.New("quic stream open: " + err.Error())
}
// Pack the DNS message for transmission
log.Debugln("packing ... | [
0.3264811336994171,
-0.030244456604123116,
0.9068524241447449,
-0.45494332909584045,
-0.2675979435443878,
-0.40051376819610596,
-0.04029564559459686,
-1.4354476928710938,
0.641452431678772,
-0.686867356300354,
0.311949759721756,
0.2433122992515564,
-0.7883251905441284,
-0.06714294850826263... |
func ErrHeaderRequired(name string) error {
return fmt.Errorf("Header %s required", name)
} | [
-1.2215851545333862,
-0.7945617437362671,
0.47340574860572815,
-0.5586450695991516,
-0.9877127408981323,
0.42702531814575195,
-0.9307032227516174,
-0.16714344918727875,
-0.5843108892440796,
0.7757581472396851,
-1.0874085426330566,
0.5607565641403198,
-0.04938431456685066,
0.783952236175537... |
func ErrInvalidFormat(name string) error {
return fmt.Errorf("Header %s has invalid format", name)
} | [
-0.4988686740398407,
-1.081490159034729,
0.5221213102340698,
-0.27724215388298035,
-1.142401933670044,
0.3506039083003998,
-1.4268089532852173,
-0.24325031042099,
-0.41248583793640137,
-0.8298819661140442,
-0.18277330696582794,
-0.13308866322040558,
-0.21004346013069153,
0.4012051224708557... |
func SaveHeaders(ctx *gin.Context) {
rctx := context.WithValue(ctx.Request.Context(), headersKey, ctx.Request.Header)
ctx.Request = ctx.Request.WithContext(rctx)
} | [
-0.9235966801643372,
-0.648288369178772,
0.6149711608886719,
0.34885290265083313,
0.9150829315185547,
-0.11250675469636917,
-0.640687882900238,
-0.7047055959701538,
-0.06189548969268799,
0.23323707282543182,
-0.33049845695495605,
-0.5416648983955383,
-0.8901397585868835,
0.4311454892158508... |
func RequestHeadersMap(ctx context.Context) map[string]string {
ret := make(map[string]string)
for k, v := range ctx.Value(headersKey).(http.Header) {
if len(v) > 0 {
ret[textproto.CanonicalMIMEHeaderKey(k)] = v[0] // this is how MIMEHeader.Get() works actually
}
}
return ret
} | [
-1.5562806129455566,
-1.3702746629714966,
0.6233356595039368,
0.22083114087581635,
0.0473385825753212,
0.05355327948927879,
-0.6935653686523438,
-0.9897766709327698,
0.01171710342168808,
-0.31472498178482056,
0.17457477748394012,
-0.08780958503484726,
-1.049848198890686,
0.1522085517644882... |
func RequestXHeadersMap(ctx context.Context) map[string]string {
ret := make(map[string]string)
for k, v := range ctx.Value(headersKey).(http.Header) {
k = textproto.CanonicalMIMEHeaderKey(k)
if len(v) > 0 && strings.HasPrefix(k, "X-") {
ret[k] = v[0]
}
}
return ret
} | [
-1.2559614181518555,
-0.7810160517692566,
0.6641356348991394,
0.39992472529411316,
-0.19704173505306244,
-0.26695623993873596,
-0.9665060043334961,
-1.127493977546692,
0.013118714094161987,
0.10510718822479248,
-0.00035941493115387857,
0.14264214038848877,
-0.6451720595359802,
0.4213370978... |
func RequestHeaders(ctx context.Context) http.Header {
return ctx.Value(headersKey).(http.Header)
} | [
-1.2969298362731934,
-0.343864768743515,
0.30172276496887207,
0.9699235558509827,
0.039269354194402695,
-0.351197749376297,
-1.326572060585022,
-1.1412873268127441,
0.7185048460960388,
-0.2875705063343048,
0.5856931209564209,
-0.057315580546855927,
-1.1581166982650757,
-0.4987468719482422,... |
func RequireHeaders(errToReturn cherry.ErrConstruct, headers ...string) gin.HandlerFunc {
return func(ctx *gin.Context) {
var notFoundHeaders []string
for _, v := range headers {
if ctx.GetHeader(textproto.CanonicalMIMEHeaderKey(v)) == "" {
notFoundHeaders = append(notFoundHeaders, v)
}
}
if len(notF... | [
-0.7870617508888245,
-0.5472413897514343,
0.5520088076591492,
0.004639043007045984,
0.035021305084228516,
-0.05811337009072304,
-0.3132898211479187,
-0.20066876709461212,
-0.4505637288093567,
0.5146815180778503,
0.08083954453468323,
-0.6057599186897278,
-1.1862788200378418,
0.3207305371761... |
func PrepareContext(ctx *gin.Context) {
for hn, ck := range hdrToKey {
if hv := ctx.GetHeader(hn); hv != "" {
rctx := context.WithValue(ctx.Request.Context(), ck, hv)
ctx.Request = ctx.Request.WithContext(rctx)
}
}
acceptLanguages := ctx.GetHeader("Accept-Language")
acceptLanguagesToContext := make([]str... | [
-0.6689876914024353,
-0.057692546397447586,
0.7968263626098633,
-0.11699692904949188,
-0.21327586472034454,
-0.12028737366199493,
-1.1586151123046875,
-0.01005091518163681,
0.2263757586479187,
0.3864467740058899,
0.10495105385780334,
-0.33835428953170776,
0.14152023196220398,
0.37664574384... |
func RequireAdminRole(errToReturn cherry.ErrConstruct) gin.HandlerFunc {
return func(ctx *gin.Context) {
if ctx.GetHeader(textproto.CanonicalMIMEHeaderKey(UserRoleXHeader)) != "admin" {
err := errToReturn().AddDetails("only admin can do this")
gonic.Gonic(err, ctx)
}
}
} | [
0.2907096743583679,
0.5088072419166565,
0.208637997508049,
-0.3801405727863312,
-0.7504734396934509,
0.7217469215393066,
-0.7259562611579895,
-0.8210455775260925,
0.13465848565101624,
0.8362196683883667,
0.3375939726829529,
0.31821250915527344,
-0.8663890361785889,
0.9156802296638489,
0.... |
func SubstituteUserMiddleware(validate *validator.Validate, translator *ut.UniversalTranslator, validationErr cherry.ErrConstruct) gin.HandlerFunc {
return func(ctx *gin.Context) {
role := ctx.GetHeader(textproto.CanonicalMIMEHeaderKey(UserRoleXHeader))
if userID, set := ctx.GetQuery("user-id"); set && role == "ad... | [
-0.2448941469192505,
-0.08268459141254425,
0.4985577464103699,
-0.10913673043251038,
-1.2301993370056152,
0.0737152174115181,
-0.28584128618240356,
0.5981252789497375,
0.6245535612106323,
0.5881505012512207,
-0.025235649198293686,
0.4953491687774658,
-0.31595978140830994,
0.334785997867584... |
func ParseRecord(value string) (r Record, err error) {
if value == "" {
return r, ErrEmptyValue
}
value = strings.Trim(value, " ")
value = strings.Replace(value, ",", ".", -1)
x, err := strconv.ParseFloat(value, 32)
if err != nil {
return r, strconv.ErrSyntax
}
r.Created = time.Now()
r.Value = float32(x)
... | [
1.3696459531784058,
0.2419731616973877,
0.6912158727645874,
-0.803450882434845,
-1.037158489227295,
0.29085758328437805,
-0.18069231510162354,
-0.12548105418682098,
-0.38521069288253784,
-0.38887012004852295,
-0.47642531991004944,
0.16069646179676056,
-0.2876169681549072,
0.645120263099670... |
func (r *GetResponse) UnmarshalJSON(data []byte) error {
type response GetResponse
return unmarshalKernelResponse(data, (*response)(r))
} | [
-0.03299188241362572,
-0.8472355008125305,
0.33835580945014954,
-0.7173750996589661,
-0.12397278100252151,
-1.0020736455917358,
0.5038482546806335,
-0.34325820207595825,
1.6048048734664917,
-0.2578936517238617,
-0.5855916738510132,
-0.021854573860764503,
-1.0097777843475342,
-0.18199819326... |
func SetLogger(l LeveledLogger) {
defaultLogger = l
// if the sensor has already been initialized, we need to update its logger too
if sensor != nil {
sensor.setLogger(l)
}
} | [
0.10943594574928284,
0.0039579058066010475,
0.484427273273468,
0.5344831347465515,
0.5165122151374817,
0.058613844215869904,
-0.546469509601593,
0.4734077453613281,
0.2805817723274231,
-0.5028629899024963,
-0.7714096903800964,
-0.592782735824585,
-0.853771984577179,
2.5801842212677,
0.36... |
func setLogLevel(l *logger.Logger, level int) {
switch level {
case Error:
l.SetLevel(logger.ErrorLevel)
case Warn:
l.SetLevel(logger.WarnLevel)
case Info:
l.SetLevel(logger.InfoLevel)
default:
l.SetLevel(logger.DebugLevel)
}
} | [
-0.3350335955619812,
0.3865959048271179,
0.45690321922302246,
-0.3274596333503723,
-0.048454951494932175,
0.5695297718048096,
-0.8586124181747437,
0.05983190983533859,
-0.024138925597071648,
-0.20715944468975067,
-1.3893991708755493,
0.0508309081196785,
-0.2098502814769745,
0.8648610711097... |
func stepWatchdog(ctxRecipe context.Context, log *logrus.Entry, wgWatchdog *sync.WaitGroup, end chan bool, step common.Steper) {
defer close(end)
defer wgWatchdog.Done()
select {
case <-ctxRecipe.Done(): // the context has been cancelled
log.Debug("Watchdog cancel")
//Step aborted, revert the action of the ste... | [
1.1342872381210327,
-0.36838653683662415,
0.6665405035018921,
0.2625896632671356,
0.17350958287715912,
0.2323637157678604,
-0.7980211973190308,
0.8007834553718567,
-1.0454658269882202,
0.4142548739910126,
-0.01597137562930584,
0.1270792931318283,
-0.19369366765022278,
0.9871534109115601,
... |
func stepExecutor(ctxRecipe context.Context, log *logrus.Entry, step common.Steper, wgStep *sync.WaitGroup, wgWatchdog *sync.WaitGroup, cancelRecipe func(), end chan bool, hadError chan bool) {
defer wgStep.Done()
wgWatchdog.Add(1)
go stepWatchdog(ctxRecipe, log, wgWatchdog, end, step)
err := step.Do(ctxRecipe, ... | [
0.9153604507446289,
0.40669700503349304,
0.4171689450740814,
0.7821825742721558,
-0.18490412831306458,
-0.03523210436105728,
-0.09154170006513596,
1.0622237920761108,
-0.7413145303726196,
0.3209737241268158,
-0.44482770562171936,
-0.0657915472984314,
0.41882380843162537,
1.0341951847076416... |
func NewKeySet(namespace string, kind string, keys []string) *KeySet {
return &KeySet{namespace: namespace, kind: kind, keys: keys}
} | [
-0.04381502419710159,
-0.580830454826355,
0.018761515617370605,
-0.8345943689346313,
-1.2981197834014893,
-0.9265134930610657,
-1.7223304510116577,
-1.3300840854644775,
-0.3769884407520294,
0.19890367984771729,
0.943839967250824,
1.5020312070846558,
-0.5397828221321106,
-0.3245013952255249... |
func (k *KeySet) ToKeySetPB() *vstorepb.KeySet {
return &vstorepb.KeySet{
Namespace: k.namespace,
Kind: k.kind,
Keys: k.keys,
}
} | [
0.4121885597705841,
-0.30173391103744507,
0.40728503465652466,
-0.21635594964027405,
-0.5232440233230591,
0.18010324239730835,
-1.0836423635482788,
-1.0632009506225586,
0.7744730710983276,
0.6471096277236938,
0.3391374945640564,
1.0527149438858032,
-0.6316502690315247,
-0.23309938609600067... |
func findElementsWithSum(arr [5]int, combinations [10]int, size int, k int, addValue int, l int, m int) int {
var num int = 0
if addValue > k {
return -1
}
if addValue == k {
num = num + 1
var p int = 0
for p = 0; p < m; p++ {
fmt.Printf("%d,", arr[combinations[p]])
}
fmt.Println(" ")
}
... | [
-0.20442774891853333,
-0.13471797108650208,
0.8770955801010132,
1.0547106266021729,
-0.8978821635246277,
-0.4577731490135193,
1.4214794635772705,
-0.04251928627490997,
0.6097821593284607,
-0.3384304344654083,
-0.5188322067260742,
-0.4441204071044922,
-0.5708397030830383,
1.2518740892410278... |
func FindCost(w, h, c int) int {
fmt.Printf("%d X %d @ %d/sq ft = ", w, h, c)
cost := w * h * c
fmt.Printf("%d\n", cost)
return cost
} | [
0.7910079956054688,
-0.004475228022783995,
0.542877733707428,
-0.8676558136940002,
-0.2948046624660492,
-0.45421528816223145,
0.810227632522583,
-0.8536295890808105,
-1.4387489557266235,
0.5324545502662659,
0.10493200272321701,
-0.32086601853370667,
-0.4039178192615509,
1.1236754655838013,... |
func Usuage() {
fmt.Println("USUAGE: go run floor.go <WIDTH> <HEIGHT> <COST / sq foot>")
os.Exit(1)
} | [
-0.4797804355621338,
0.8534454703330994,
0.6707449555397034,
1.0333468914031982,
-0.31326550245285034,
0.5472917556762695,
0.7219862937927246,
0.5626952648162842,
-0.7268015742301941,
0.6247960329055786,
-0.092913918197155,
0.004121717065572739,
-0.1138882264494896,
0.7903864979743958,
0... |
func ArgsToInt(index int) int {
x, err := strconv.Atoi(os.Args[index])
if err != nil {
Usuage()
}
return x
} | [
-0.12666292488574982,
0.32356756925582886,
0.46378716826438904,
-1.5592496395111084,
0.6626615524291992,
-0.08295377343893051,
0.2816813290119171,
-0.6978490948677063,
-1.165160894393921,
1.2444759607315063,
-0.07679004222154617,
-0.18781939148902893,
-0.645908772945404,
-0.655382215976715... |
func (w *Watcher) Watch(
ctx context.Context,
eventCh chan<- Event,
) error {
ctx, cancel := context.WithCancel(ctx)
defer cancel()
defer close(eventCh)
errCh := make(chan error, 3)
taggedEventCh := make(chan Event)
go func() {
if err := w.watchTagged(ctx, taggedEventCh); err != nil {
errCh <- err
}
}... | [
0.7352822422981262,
-0.4016231596469879,
0.6539185047149658,
-0.09682273864746094,
0.22460387647151947,
0.29905036091804504,
0.2557041049003601,
-0.5636369585990906,
-0.7294661402702332,
-0.2984137535095215,
-0.7399037480354309,
0.662980854511261,
0.529330849647522,
0.8131519556045532,
-... |
func NewWatcher(ot *oniontree.OnionTree) *Watcher {
return &Watcher{
ot: ot,
}
} | [
-0.160576730966568,
-0.7488288879394531,
0.10367649793624878,
0.022302808240056038,
-0.260441392660141,
0.3376110792160034,
-0.5192877650260925,
-0.8724308013916016,
-0.2835887670516968,
-0.041009433567523956,
0.1450866460800171,
0.6691614389419556,
0.5574012398719788,
0.7877782583236694,
... |
func Download(url, dst string) error {
f, err := os.Create(dst)
if err != nil {
return errors.Wrap(err, "Could not download file")
}
defer f.Close()
response, err := http.Get(url)
if err != nil {
return errors.Wrap(err, "Could not request file")
}
defer response.Body.Close()
if _, err = io.Copy(f, respon... | [
-0.2053113430738449,
0.7846329808235168,
0.847660481929779,
0.3950570225715637,
-0.39296552538871765,
0.48124706745147705,
-0.0861392468214035,
0.17389650642871857,
-0.8735834360122681,
0.031509045511484146,
0.00045532421790994704,
0.3793570101261139,
0.42841699719429016,
-0.41815584897994... |
func MkdirAllWithFilename(path string) {
MkdirAll(filepath.Dir(path))
} | [
0.8529477119445801,
-0.34856683015823364,
0.28370416164398193,
0.4836179316043854,
-1.4899752140045166,
0.9809463620185852,
0.5391484498977661,
0.457457572221756,
0.15163210034370422,
0.015160136856138706,
-0.3438389301300049,
-0.3653310537338257,
1.5067294836044312,
0.20467399060726166,
... |
func MkdirAll(path string) {
if !Exists(path) {
os.MkdirAll(path, 0755)
}
} | [
0.8521897792816162,
0.6522074341773987,
0.28469526767730713,
0.0666833221912384,
-0.9284128546714783,
1.7549123764038086,
0.40868741273880005,
-0.3010999858379364,
0.6341501474380493,
0.025304175913333893,
-0.4792649745941162,
0.0825071930885315,
1.0607165098190308,
0.5329785346984863,
-... |
func Exists(path string) bool {
_, err := os.Stat(path)
if err == nil {
return true
}
if os.IsNotExist(err) {
return false
}
return true // ignoring error
} | [
-0.6992532014846802,
-0.2622745633125305,
0.6708792448043823,
-0.6245502829551697,
0.31975057721138,
1.6114660501480103,
-0.4859806299209595,
0.1139659509062767,
0.1028100922703743,
-0.6151659488677979,
-0.10099869221448898,
-0.5677716732025146,
-0.06280189007520676,
0.2511260509490967,
... |
func CopyFile(src, dst string) (err error) {
sfi, err := os.Stat(src)
if err != nil {
return
}
if !sfi.Mode().IsRegular() {
// cannot copy non-regular files (e.g., directories,
// symlinks, devices, etc.)
return fmt.Errorf("CopyFile: non-regular source file %s (%q)", sfi.Name(), sfi.Mode().String())
}
dfi... | [
-0.11628803610801697,
0.663809597492218,
0.7331481575965881,
-0.024761121720075607,
0.1614798605442047,
0.34586644172668457,
1.2251743078231812,
0.11684008687734604,
-0.49190762639045715,
-0.6345512270927429,
0.5822992920875549,
-0.011917776428163052,
0.6600404381752014,
0.3510144948959350... |
func copyFileContents(src, dst string) (err error) {
in, err := os.Open(src)
if err != nil {
return
}
defer in.Close()
out, err := os.Create(dst)
if err != nil {
return
}
defer func() {
cerr := out.Close()
if err == nil {
err = cerr
}
}()
if _, err = io.Copy(out, in); err != nil {
return
}
er... | [
0.10767262428998947,
0.09910313785076141,
0.6558147668838501,
0.07296543568372726,
-0.9255898594856262,
0.14707350730895996,
0.2863916754722595,
-0.3815368413925171,
-0.9046506881713867,
0.5822823643684387,
0.12044234573841095,
-0.313302218914032,
0.20736972987651825,
-0.4218948781490326,
... |
func (r *NamespaceMapReconciler) getKubeConfig(reference *corev1.ObjectReference) (*rest.Config, error) {
if reference == nil {
return nil, fmt.Errorf("must specify reference")
}
secret := &corev1.Secret{}
if err := r.Get(context.TODO(), types.NamespacedName{
Namespace: reference.Namespace,
Name: referen... | [
-0.28678786754608154,
0.21176186203956604,
0.8979893326759338,
0.03208545967936516,
-0.0788448229432106,
-0.36189115047454834,
-0.5502921342849731,
-0.530590832233429,
0.2576464116573334,
0.6880776286125183,
-0.1836501657962799,
1.0723893642425537,
-0.5905972719192505,
1.3218872547149658,
... |
func (r *NamespaceMapReconciler) checkRemoteClientPresence(clusterID string) error {
if r.RemoteClients == nil {
r.RemoteClients = map[string]client.Client{}
}
if _, ok := r.RemoteClients[clusterID]; !ok {
fcl := &discoveryV1alpha1.ForeignClusterList{}
if err := r.List(context.TODO(), fcl,
client.MatchingL... | [
-0.17585813999176025,
-0.8007758855819702,
0.5650582909584045,
-0.8409969210624695,
0.7906193733215332,
0.4563240110874176,
-0.003458186285570264,
-0.42388445138931274,
0.016627393662929535,
0.990980327129364,
-0.13677853345870972,
0.3446008563041687,
-0.9495710730552673,
1.015620231628418... |
func getEventData(runObject objectWithCondition) (CDECloudEventData, error) {
cdeCloudEventData := map[string]string{}
switch v := runObject.(type) {
case *v1beta1.TaskRun:
data, err := json.Marshal(v)
if err != nil {
return nil, err
}
cdeCloudEventData["taskrun"] = string(data)
case *v1alpha1.Run: /* Co... | [
-0.1823977530002594,
-0.326805979013443,
0.6842144727706909,
-0.13298572599887848,
-0.5270911455154419,
0.3433901071548462,
0.16634830832481384,
-0.04159596562385559,
-0.44043514132499695,
0.5965733528137207,
-0.3509238660335541,
0.774557888507843,
0.24218305945396423,
0.8709554076194763,
... |
func getEventType(runObject objectWithCondition) (*EventType, error) {
statusCondition := runObject.GetStatusCondition()
eventType := EventType{}
if statusCondition == nil {
return nil, fmt.Errorf("no ConditionAccessor for runObject in %T", runObject)
}
c := statusCondition.GetCondition(apis.ConditionSucceeded)
... | [
-0.09021048992872238,
-0.37921249866485596,
0.6479700207710266,
-0.26776552200317383,
0.41545310616493225,
-0.6190502047538757,
0.566174328327179,
0.12578968703746796,
-0.3701612949371338,
0.6583232283592224,
0.13232111930847168,
0.4894387423992157,
0.45385873317718506,
0.8899130821228027,... |
func coreEventForObjectWithCondition(runObject objectWithCondition) (*cloudevents.Event, error) {
var (
event cloudevents.Event
err error
)
etype, err := getEventType(runObject)
if err != nil {
return nil, err
}
data, err := getEventData(runObject)
if err != nil {
return nil, err
}
meta := runObject.... | [
0.22688451409339905,
-0.29466623067855835,
0.8064365386962891,
-0.6448152661323547,
-0.5486821532249451,
0.5364751219749451,
0.1423358917236328,
-0.37448859214782715,
-0.3777270019054413,
1.1832727193832397,
0.07651862502098083,
0.9656553268432617,
-0.22057294845581055,
0.3624158799648285,... |
func Asset(name string) ([]byte, error) {
canonicalName := strings.Replace(name, "\\", "/", -1)
if f, ok := _bindata[canonicalName]; ok {
a, err := f()
if err != nil {
return nil, fmt.Errorf("Asset %s can't read by error: %v", name, err)
}
return a.bytes, nil
}
return nil, fmt.Errorf("Asset %s not found"... | [
-1.0117802619934082,
-1.1598913669586182,
0.6830528974533081,
-0.6832774877548218,
-1.3779864311218262,
-0.04716435447335243,
0.3233034014701843,
-1.387198567390442,
-1.1437952518463135,
0.4887535572052002,
0.508706271648407,
0.4118397831916809,
-0.556188702583313,
-0.2793940007686615,
0... |
func AssetString(name string) (string, error) {
data, err := Asset(name)
return string(data), err
} | [
-1.247711420059204,
-0.7423804402351379,
0.39674192667007446,
-1.4730795621871948,
-1.8356839418411255,
0.45875734090805054,
-0.22362041473388672,
-1.3954719305038452,
-0.5910036563873291,
0.673730194568634,
0.5670546293258667,
0.45071396231651306,
0.12421981245279312,
-0.6748082637786865,... |
func MustAsset(name string) []byte {
a, err := Asset(name)
if err != nil {
panic("asset: Asset(" + name + "): " + err.Error())
}
return a
} | [
-0.012778956443071365,
0.11985661834478378,
0.4091298282146454,
-0.5268413424491882,
-0.8276715278625488,
0.4719155430793762,
-0.8186293840408325,
-1.5736604928970337,
0.16388541460037231,
0.6357062458992004,
-0.5354578495025635,
0.35693347454071045,
0.0057142809964716434,
-0.0248885955661... |
func MustAssetString(name string) string {
return string(MustAsset(name))
} | [
-0.7957004308700562,
-0.4993444085121155,
0.4154260754585266,
-0.059688813984394073,
-1.7780245542526245,
0.7658588886260986,
-0.5333529710769653,
-1.525808334350586,
-0.11369087547063828,
0.8382498025894165,
0.9579691290855408,
-0.4543590545654297,
0.2904685139656067,
0.30602753162384033,... |
func AssetInfo(name string) (os.FileInfo, error) {
canonicalName := strings.Replace(name, "\\", "/", -1)
if f, ok := _bindata[canonicalName]; ok {
a, err := f()
if err != nil {
return nil, fmt.Errorf("AssetInfo %s can't read by error: %v", name, err)
}
return a.info, nil
}
return nil, fmt.Errorf("AssetIn... | [
0.1966029703617096,
-0.9794570207595825,
0.5885098576545715,
-0.9617621302604675,
-1.2945103645324707,
0.0021701965015381575,
0.8489783406257629,
-0.8787258267402649,
-1.2970008850097656,
0.33993929624557495,
0.4047488272190094,
0.37507039308547974,
0.06526204943656921,
-0.2895668148994446... |
func AssetDigest(name string) ([sha256.Size]byte, error) {
canonicalName := strings.Replace(name, "\\", "/", -1)
if f, ok := _bindata[canonicalName]; ok {
a, err := f()
if err != nil {
return [sha256.Size]byte{}, fmt.Errorf("AssetDigest %s can't read by error: %v", name, err)
}
return a.digest, nil
}
ret... | [
-0.3591914772987366,
-0.6181963086128235,
0.7434927821159363,
-1.1689051389694214,
-1.152544617652893,
-0.5196005702018738,
-0.2411303073167801,
-1.0479568243026733,
-0.5882827043533325,
0.310821533203125,
0.08598455786705017,
-0.05696683004498482,
-0.296350359916687,
0.04578978568315506,
... |
func Digests() (map[string][sha256.Size]byte, error) {
mp := make(map[string][sha256.Size]byte, len(_bindata))
for name := range _bindata {
a, err := _bindata[name]()
if err != nil {
return nil, err
}
mp[name] = a.digest
}
return mp, nil
} | [
-0.8371758460998535,
-0.8630334734916687,
0.8149356245994568,
-0.20492912828922272,
-0.4950232207775116,
-0.7048240303993225,
-0.32209330797195435,
-0.4336596429347992,
-0.07046830654144287,
-0.36870822310447693,
-0.4737861156463623,
0.22748501598834991,
0.2845746874809265,
0.8567589521408... |
func AssetNames() []string {
names := make([]string, 0, len(_bindata))
for name := range _bindata {
names = append(names, name)
}
return names
} | [
-0.7293784618377686,
-0.8460342288017273,
0.7321816682815552,
-0.39323121309280396,
-0.48951536417007446,
0.7661203145980835,
-0.5028699636459351,
-0.8655748963356018,
-0.4145073890686035,
0.8099913597106934,
0.16903363168239594,
1.163049578666687,
-0.028152840211987495,
0.0342608317732811... |
func RestoreAsset(dir, name string) error {
data, err := Asset(name)
if err != nil {
return err
}
info, err := AssetInfo(name)
if err != nil {
return err
}
err = os.MkdirAll(_filePath(dir, filepath.Dir(name)), os.FileMode(0755))
if err != nil {
return err
}
err = ioutil.WriteFile(_filePath(dir, name), d... | [
-0.04950583726167679,
-0.19623512029647827,
0.6907734274864197,
-1.3569048643112183,
-0.2967042326927185,
-0.3611973226070404,
0.07744784653186798,
-0.471956729888916,
-0.31164032220840454,
-0.08379734307527542,
-0.002142141805961728,
0.06316494196653366,
-0.342814564704895,
-0.61630117893... |
func RestoreAssets(dir, name string) error {
children, err := AssetDir(name)
// File
if err != nil {
return RestoreAsset(dir, name)
}
// Dir
for _, child := range children {
err = RestoreAssets(dir, filepath.Join(name, child))
if err != nil {
return err
}
}
return nil
} | [
0.42261892557144165,
0.30020031332969666,
0.5813396573066711,
-0.20641657710075378,
-0.23828908801078796,
-0.24414615333080292,
0.5739709138870239,
-0.029911456629633904,
0.06188219040632248,
-0.43923482298851013,
0.5113736987113953,
0.3275970220565796,
-0.6125145554542542,
0.0351656526327... |
func (e *engine) GetAll(c *httpEngine.ServerContext) {
ee, err := e.ProductLogic.GetAllProducts()
if err != nil {
c.ErrorHandler(400, err)
return
}
c.JSON(200, ee)
} | [
-0.01636545918881893,
-0.48430198431015015,
0.6907122135162354,
1.0278414487838745,
0.5269308686256409,
0.4409968852996826,
-0.6157066822052002,
-0.17436964809894562,
-0.11217225342988968,
0.43753716349601746,
0.4012584686279297,
1.3858668804168701,
0.21492189168930054,
0.756069540977478,
... |
func (e *engine) GetOne(c *httpEngine.ServerContext) {
// check iid exists or not
id, err := c.GetURLParam("iid")
if err != nil {
c.ErrorHandler(400, err)
return
}
ee, err := e.ProductLogic.GetProductByID(id)
if err != nil {
c.ErrorHandler(400, errors.New(constants.NoData))
return
}
c.JSON(200, ee)
} | [
-1.0765379667282104,
-0.21748101711273193,
0.8572351932525635,
0.7116200923919678,
0.9723088145256042,
0.3467499613761902,
0.2138163149356842,
-0.9080300331115723,
-0.411192923784256,
0.948927640914917,
0.23963908851146698,
0.9255016446113586,
-0.8373445868492126,
0.1129683405160904,
0.4... |
func (e *engine) CreateProduct(c *httpEngine.ServerContext) {
// check iid exists or not
id, err := c.GetURLParam("iid")
if err != nil {
c.ErrorHandler(400, err)
return
}
var product = &domain.Product{}
// check is valid json for product
err = c.BindToJson(product)
if err != nil {
c.ErrorHandler(400, err)... | [
-0.9689742922782898,
-0.445285439491272,
0.615293562412262,
0.29243192076683044,
0.5812992453575134,
1.1325228214263916,
-0.08434335887432098,
-0.9066169261932373,
0.1023954376578331,
0.5856635570526123,
0.33503004908561707,
0.16299866139888763,
-0.7033716440200806,
0.23918703198432922,
... |
func (e *engine) UpdateOne(c *httpEngine.ServerContext) {
// check iid exists or not
id, err := c.GetURLParam("iid")
if err != nil {
c.ErrorHandler(400, err)
return
}
var product = &domain.Product{}
// check is valid json for product
err = c.BindToJson(product)
if err != nil {
c.ErrorHandler(400, err)
... | [
-1.7409842014312744,
-0.8577896356582642,
0.9136908650398254,
0.6237533092498779,
-0.009708254598081112,
0.7206085324287415,
0.28148218989372253,
-0.4345897138118744,
-0.07823379337787628,
1.4335194826126099,
-0.28667759895324707,
0.4690634608268738,
-0.8281536102294922,
-0.097780741751194... |
func (e *engine) DeleteOne(c *httpEngine.ServerContext) {
// check iid exists or not
id, err := c.GetURLParam("iid")
if err != nil {
c.ErrorHandler(400, err)
return
}
var product = &domain.Product{}
product.Iid = id
err = e.ProductLogic.DeleteProduct(product)
if err != nil {
c.JSON(400,
map[string]stri... | [
-1.1414872407913208,
-0.44696956872940063,
0.721771776676178,
0.8561135530471802,
0.7268279194831848,
0.7559820413589478,
0.5198360085487366,
-0.43851369619369507,
0.02880018576979637,
0.7905848622322083,
0.05486616492271423,
0.5011551976203918,
-0.7070935368537903,
0.33111265301704407,
... |
func New(transport runtime.ClientTransport, formats strfmt.Registry) ClientService {
return &Client{transport: transport, formats: formats}
} | [
0.25708064436912537,
-1.2911276817321777,
-0.15975941717624664,
-1.1987494230270386,
-0.7055332064628601,
0.14473751187324524,
0.16492673754692078,
-0.7642391324043274,
-0.964878261089325,
-0.4666050374507904,
-0.13648737967014313,
0.7510700225830078,
0.052431024610996246,
0.66191029548645... |
func (a *Client) GetProductModelDraftCode(params *GetProductModelDraftCodeParams) (*GetProductModelDraftCodeOK, error) {
// TODO: Validate the params before sending
if params == nil {
params = NewGetProductModelDraftCodeParams()
}
result, err := a.transport.Submit(&runtime.ClientOperation{
ID: ... | [
-1.3762177228927612,
0.16392378509044647,
0.7419601678848267,
0.18062695860862732,
0.19134606420993805,
0.13158603012561798,
0.664311945438385,
-1.226824402809143,
-0.34819677472114563,
-0.12087415158748627,
-0.3868199288845062,
1.221632957458496,
-0.4764607846736908,
0.023254891857504845,... |
func (a *Client) GetProductModels(params *GetProductModelsParams) (*GetProductModelsOK, error) {
// TODO: Validate the params before sending
if params == nil {
params = NewGetProductModelsParams()
}
result, err := a.transport.Submit(&runtime.ClientOperation{
ID: "get_product_models",
Method: ... | [
-2.049043655395508,
0.27450066804885864,
0.693157970905304,
1.1925482749938965,
0.39597487449645996,
-0.17154473066329956,
0.5117958784103394,
-1.292465090751648,
-0.32257816195487976,
0.3883104920387268,
-1.188673734664917,
1.0781296491622925,
-0.5124569535255432,
-0.24396522343158722,
... |
func (a *Client) GetProductModelsCode(params *GetProductModelsCodeParams) (*GetProductModelsCodeOK, error) {
// TODO: Validate the params before sending
if params == nil {
params = NewGetProductModelsCodeParams()
}
result, err := a.transport.Submit(&runtime.ClientOperation{
ID: "get_product_mod... | [
-1.8723857402801514,
-0.014667380601167679,
0.8586284518241882,
0.6982377767562866,
0.14301712810993195,
-0.3343670666217804,
0.5043509006500244,
-1.2919856309890747,
-0.7357810139656067,
0.5537519454956055,
-0.7243874669075012,
0.5890458226203918,
-0.11697889864444733,
0.26168206334114075... |
func (a *Client) PatchProductModels(params *PatchProductModelsParams) (*PatchProductModelsOK, error) {
// TODO: Validate the params before sending
if params == nil {
params = NewPatchProductModelsParams()
}
result, err := a.transport.Submit(&runtime.ClientOperation{
ID: "patch_product_models",
... | [
-2.0099215507507324,
-0.44985881447792053,
0.4764183759689331,
0.5842751860618591,
-0.4053462743759155,
0.3508153259754181,
1.0380185842514038,
-0.7535714507102966,
-0.1520952433347702,
0.6567436456680298,
-1.0992997884750366,
0.7594985365867615,
-0.5867919921875,
-0.13657960295677185,
-... |
func (a *Client) PatchProductModelsCode(params *PatchProductModelsCodeParams) (*PatchProductModelsCodeCreated, *PatchProductModelsCodeNoContent, error) {
// TODO: Validate the params before sending
if params == nil {
params = NewPatchProductModelsCodeParams()
}
result, err := a.transport.Submit(&runtime.ClientOp... | [
-1.443613052368164,
-0.4666745066642761,
0.735870361328125,
0.460112988948822,
-0.1063065454363823,
0.26131221652030945,
0.6524072289466858,
-0.9273157119750977,
-0.2437617927789688,
0.701836347579956,
-0.6185430884361267,
0.35600459575653076,
-0.08095212280750275,
0.18705199658870697,
0... |
func (a *Client) PostProductModelProposal(params *PostProductModelProposalParams) (*PostProductModelProposalCreated, error) {
// TODO: Validate the params before sending
if params == nil {
params = NewPostProductModelProposalParams()
}
result, err := a.transport.Submit(&runtime.ClientOperation{
ID: ... | [
-1.5099704265594482,
-0.07187176495790482,
0.4770507216453552,
0.32266440987586975,
-0.6345206499099731,
0.5069143176078796,
0.5474552512168884,
-0.7261824607849121,
-0.45602819323539734,
0.723885178565979,
-1.2249611616134644,
-0.17492124438285828,
-0.6676235795021057,
-0.4413110315799713... |
func (a *Client) PostProductModels(params *PostProductModelsParams) (*PostProductModelsCreated, error) {
// TODO: Validate the params before sending
if params == nil {
params = NewPostProductModelsParams()
}
result, err := a.transport.Submit(&runtime.ClientOperation{
ID: "post_product_models",
... | [
-2.1855180263519287,
-0.17717638611793518,
0.5043699145317078,
0.7866544723510742,
-0.027458861470222473,
0.5304199457168579,
0.7338164448738098,
-1.0830731391906738,
-0.4334414005279541,
0.3199167251586914,
-1.6099522113800049,
0.1292698234319687,
-0.8070740699768066,
-0.24088917672634125... |
func (a *Client) SetTransport(transport runtime.ClientTransport) {
a.transport = transport
} | [
0.43289124965667725,
-0.16396044194698334,
0.06502870470285416,
0.17467869818210602,
-0.022012455388903618,
0.3327627182006836,
1.1535402536392212,
-0.7375835180282593,
0.32833772897720337,
-1.0833802223205566,
-1.4707483053207397,
0.4919946491718292,
-0.44076064229011536,
0.62663459777832... |
func (m *rubyMockStorer) PipelinePut(p *gaia.Pipeline) error {
return m.Error
} | [
-0.6669381856918335,
-0.14424331486225128,
0.034343816339969635,
-0.9773578643798828,
0.1838078796863556,
0.523877739906311,
1.017257809638977,
0.5646976828575134,
0.28753936290740967,
0.6449288129806519,
-0.427112877368927,
0.09256962686777115,
-1.400840163230896,
-0.4492719769477844,
-... |
func (o *Basic) Version() string {
if "" == o.Options.Version {
return defaultVersion
}
return o.Options.Version
} | [
0.2014564871788025,
-0.19248142838478088,
0.40846091508865356,
1.1647913455963135,
1.1295746564865112,
0.6522262692451477,
0.35772913694381714,
-0.8721645474433899,
0.02263699844479561,
0.2486828714609146,
-0.31258055567741394,
-1.0134704113006592,
-1.1530439853668213,
-0.01692964136600494... |
func (o *Basic) VerifySsl() bool {
if false == o.Options.verifySslInitialized {
return true
}
return o.Options.VerifySsl
} | [
0.3991176187992096,
0.06440205872058868,
0.5541664361953735,
1.3844549655914307,
0.27596315741539,
0.35523393750190735,
-0.33672672510147095,
-1.145448088645935,
0.960896909236908,
-0.42591744661331177,
-1.3483966588974,
-0.2670361399650574,
0.1914697140455246,
0.8527042865753174,
-1.024... |
func (o *Basic) DisableSslVerification() {
o.Options.verifySslInitialized = true
o.Options.VerifySsl = false
} | [
0.5641244053840637,
0.5301632285118103,
0.05560126528143883,
0.6367124319076538,
0.1561077982187271,
0.6983602643013,
0.8277414441108704,
0.5915258526802063,
-0.1729547381401062,
-0.7862457633018494,
-1.7809134721755981,
-0.7053338289260864,
0.018581006675958633,
1.1968549489974976,
0.09... |
func (o *Basic) Timeout() int {
if 0 == o.Options.Timeout {
return timeout
}
return o.Options.Timeout
} | [
0.35390418767929077,
1.1613669395446777,
0.5482714176177979,
0.6693986058235168,
0.38893380761146545,
0.43835926055908203,
0.6226038336753845,
-0.2838155925273895,
0.4474116563796997,
0.35556283593177795,
0.2903002202510834,
-0.01359864603728056,
-0.5212206244468689,
-0.14787469804286957,
... |
func (o *Basic) QueryStringAuth() bool {
return o.Options.QueryStringAuth
} | [
-0.3125590682029724,
-0.9515961408615112,
0.1465143859386444,
0.3856014311313629,
-0.6466057896614075,
0.5454040765762329,
0.1455398052930832,
-0.571614682674408,
-0.08671238273382187,
-0.2020757645368576,
-0.06398385018110275,
0.018688952550292015,
-0.3659283220767975,
-1.2777886390686035... |
func (o *Basic) WPAPI() bool {
return o.Options.WPAPI
} | [
-0.8552331924438477,
-0.5243465900421143,
0.1452050507068634,
-0.1395304948091507,
-0.22155535221099854,
0.6350604891777039,
-0.15535658597946167,
-1.1406248807907104,
0.24238400161266327,
0.9652484655380249,
-0.07646310329437256,
-0.23989641666412354,
-0.703665018081665,
-0.20415890216827... |
func (o *Basic) WPAPIPrefix() string {
if "" == o.Options.WPAPIPrefix {
return defaultPrefix
}
return o.Options.WPAPIPrefix
} | [
-0.43162864446640015,
-0.4643377661705017,
0.22591008245944977,
-0.37901797890663147,
0.23318031430244446,
0.3767912983894348,
-0.9403337836265564,
-0.3477870225906372,
0.7356836795806885,
0.575005054473877,
0.22462014853954315,
-0.02840437740087509,
-0.5384266972541809,
0.0124166160821914... |
func (o *Basic) OAuthTimestamp() string {
if "" == o.Options.OAuthTimestamp {
return strconv.FormatInt(time.Now().Unix(), 10)
}
return o.Options.OAuthTimestamp
} | [
0.13395605981349945,
-0.23417620360851288,
0.7008482813835144,
-0.2824256718158722,
0.5605624914169312,
-0.012328839860856533,
-0.11333170533180237,
-0.7331204414367676,
1.3489753007888794,
0.28906527161598206,
0.3226567804813385,
0.7561436295509338,
-0.04012241214513779,
-0.58491027355194... |
func (o *Basic) UserAgent() string {
if "" == o.Options.UserAgent {
return DefaultUserAgent
}
return o.Options.UserAgent
} | [
0.6112989783287048,
0.21045397222042084,
0.5943734049797058,
0.2457757294178009,
0.7123885750770569,
-0.09959510713815689,
0.45869532227516174,
-0.6956425905227661,
1.162678837776184,
-0.2250843048095703,
0.36312371492385864,
-0.15432380139827728,
-1.1375367641448975,
-0.8342383503913879,
... |
func reverseInt(num int) int {
var r int
//if num negative -> convert to positve first
if num < 0 {
num = num * -1
for num > 0 {
//pop: %10 and x /=10
r = r*10 + num%10
num = num / 10
}
//if r is out of range
if r > 2147483647 || r < -2147483647 {
return 0
}
return r * -1
}
for num > 0 {... | [
-0.37604838609695435,
0.4019358456134796,
0.8411871790885925,
-1.1638578176498413,
-0.20121188461780548,
0.1118827611207962,
-0.189643993973732,
0.004712508991360664,
-0.5455546975135803,
0.5291324257850647,
0.02219666913151741,
-0.7371077537536621,
-1.199196219444275,
-0.34421026706695557... |
func isPalindrome(num int) bool {
if num < 0 {
return false
}
return num == reverseInt(num)
} | [
-0.11424599587917328,
0.40537068247795105,
0.6628416180610657,
0.4633684754371643,
-0.3998340964317322,
0.5487149357795715,
-0.5816264748573303,
0.00889839231967926,
0.666131317615509,
-0.6041534543037415,
0.211111918091774,
-0.5267904996871948,
-2.120508909225464,
-0.2338547259569168,
0... |
func kidsWithGreatesNrOfCandies(candies []int, extraCandies int) []bool {
greatest := 0
for _, v := range candies {
if v > greatest {
greatest = v
}
}
result := []bool{}
for _, v := range candies {
switch {
case v < greatest && v+extraCandies < greatest:
result = append(result, false)
default:
... | [
-1.2659854888916016,
0.006756145972758532,
0.5584951043128967,
0.18021255731582642,
-0.8251932859420776,
-0.04485388100147247,
-0.19947244226932526,
0.9039705395698547,
-0.5500806570053101,
0.13495773077011108,
-0.9114663004875183,
-0.03968992084264755,
-0.17684157192707062,
0.584297418594... |
func kidsWithGreatesNrOfCandies2(candies []int, extraCandies int) []bool {
greatest := 0
result := make([]bool, len(candies))
for _, v := range candies {
if v > greatest {
greatest = v
}
}
for i, v := range candies {
if v+extraCandies >= greatest {
result[i] = true
}
}
return result
} | [
-1.2020342350006104,
-0.24279877543449402,
0.5266754627227783,
0.4713364541530609,
-0.9349743723869324,
-0.3044121563434601,
-0.16410523653030396,
0.8017082810401917,
-0.7661930918693542,
0.19157306849956512,
-1.34358549118042,
0.14684928953647614,
0.02902350015938282,
0.5534841418266296,
... |
func shuffleArr(nums []int, n int) []int {
shuffled := make([]int, len(nums))
j := 0
for i := 0; i < n; i++ {
shuffled[j] = nums[i]
j++
shuffled[j] = nums[i+n]
j++
}
return shuffled
} | [
-0.7442135810852051,
-0.14343197643756866,
0.45647186040878296,
-0.287821501493454,
-0.6043830513954163,
0.44795891642570496,
0.6406726241111755,
-0.2576245665550232,
0.7412126064300537,
-0.19732579588890076,
0.30166906118392944,
0.5701321363449097,
0.20208248496055603,
0.8884112238883972,... |
func numIdenticalPairs(nums []int) int {
var pairs int
hm := make(map[int]int)
//find count of number occurences of number then store in map
for _, n := range nums {
pairs += hm[n]
hm[n]++
fmt.Println("pairs: ", pairs, "hm:", hm) //final hm in ex.: 1:3, 2:1, 3:2
}
return pairs
} | [
-0.259669691324234,
-0.6897742748260498,
0.796420693397522,
-0.30996930599212646,
0.02151275984942913,
0.5509480834007263,
1.219947338104248,
0.9245314598083496,
0.46936705708503723,
0.44774559140205383,
-0.5058438777923584,
-0.9328726530075073,
-0.385091632604599,
0.44226962327957153,
0... |
func removeDuplicates(a []int) []int {
result := []int{}
seen := map[int]int{}
for _, val := range a {
if _, ok := seen[val]; !ok {
result = append(result, val)
seen[val] = val
}
}
return result
} | [
-0.6352097392082214,
-0.34611737728118896,
0.6808847188949585,
-0.6977196931838989,
-0.5499672293663025,
-0.563818633556366,
0.7866693139076233,
0.22987964749336243,
0.9593028426170349,
0.4997515082359314,
-0.9407646059989929,
0.3060356378555298,
-0.3294154703617096,
0.7544739246368408,
... |
func numIdenticalPairsLoop(nums []int) int {
var pairs int
for i := 0; i < len(nums); i++ {
for j := i + 1; j < len(nums); j++ {
if nums[i] == nums[j] {
pairs++
}
}
}
return pairs
} | [
-0.17281301319599152,
-0.4260387420654297,
0.7719557285308838,
0.089530810713768,
-0.4043627083301544,
0.39381057024002075,
1.2507524490356445,
0.15628565847873688,
0.641064465045929,
0.6856189966201782,
0.021053146570920944,
-0.16694070398807526,
-0.7866654396057129,
0.3464854955673218,
... |
func writeToDisk(dirname string, fileName string, specFile []byte, perms os.FileMode) error {
var err error
home, err := homedir.Dir()
if err != nil {
return err
}
newpath := filepath.Join(home, appName, dirname)
os.MkdirAll(newpath, os.ModePerm)
err = ioutil.WriteFile(filepath.Join(newpath, fileName), specFi... | [
0.07489682734012604,
0.13115325570106506,
0.6963856220245361,
0.9921032190322876,
0.7079364657402039,
0.5034924745559692,
1.0892446041107178,
0.29962849617004395,
-0.5235966444015503,
-0.163603276014328,
0.3631553649902344,
0.11466319859027863,
0.004502275958657265,
0.5310935974121094,
0... |
func translate(err error) error {
switch errors.Cause(err) {
case user.ErrNotFound:
return web.ErrNotFound
case user.ErrInvalidID:
return web.ErrInvalidID
case user.ErrAuthenticationFailure:
return web.ErrUnauthorized
case user.ErrForbidden:
return web.ErrForbidden
}
return err
} | [
-0.6692007780075073,
-0.25877970457077026,
0.32582199573516846,
1.3007957935333252,
-0.6343265771865845,
0.1524105668067932,
0.22230179607868195,
-0.15301662683486938,
1.090073823928833,
-0.4570941627025604,
-0.541954517364502,
-0.2781355381011963,
-0.0882074162364006,
-0.3240611255168915,... |
func UnmarshalService(in []byte) (interface{}, error) {
am := Service{}
if err := yaml.Unmarshal(in, &am); err != nil {
return nil, fmt.Errorf("unmarshal to service manifest: %w", err)
}
switch am.Type {
case LoadBalancedWebServiceType:
m := newDefaultLoadBalancedWebService()
if err := yaml.Unmarshal(in, m)... | [
0.01921665482223034,
-0.26161912083625793,
0.5037463307380676,
0.1392824798822403,
-0.41087090969085693,
-0.6346811056137085,
-0.18504740297794342,
-0.10600483417510986,
0.857463002204895,
-0.5440823435783386,
0.1851668357849121,
0.23975695669651031,
-0.7741730213165283,
0.9859294891357422... |
func Template() (c *TemplateController) {
return &TemplateController{
List: templateList,
New: templateNew,
Create: templateCreate,
Edit: templateEdit,
Update: templateUpdate,
Delete: templateDelete,
}
} | [
-0.6037232875823975,
0.5996227860450745,
0.15954303741455078,
-0.18515397608280182,
0.2953634560108185,
-1.2671771049499512,
0.8161722421646118,
0.32604920864105225,
0.35193154215812683,
-1.0634721517562866,
-0.8709325194358826,
-0.8791527152061462,
0.21860626339912415,
0.7509785294532776,... |
func MidStoreEndpoint(endpoint *server.Endpoint) server.Middleware {
return func(next http.Handler) http.Handler {
return http.HandlerFunc(func(rw http.ResponseWriter, req *http.Request) {
ctx := context.WithValue(req.Context(), endpointCtxKey, endpoint)
req = req.WithContext(ctx)
next.ServeHTTP(rw, req)
... | [
-0.8082834482192993,
-0.21882495284080505,
0.6098883748054504,
0.4482003450393677,
-1.065591812133789,
-0.48354610800743103,
-0.6856278777122498,
0.4215400516986847,
0.6127317547798157,
0.22097058594226837,
0.2717972993850708,
-0.09784062951803207,
-0.8635908365249634,
-0.20968881249427795... |
func CtxGetEndpoint(ctx context.Context) (*server.Endpoint, bool) {
endpoint, ok := ctx.Value(endpointCtxKey).(*server.Endpoint)
return endpoint, ok
} | [
-0.8444675207138062,
-0.2953127920627594,
0.48684239387512207,
0.6870262026786804,
-0.280050665140152,
0.3617543876171112,
-1.0700100660324097,
0.1616104394197464,
0.8603380918502808,
0.7563892006874084,
-0.47028496861457825,
0.5353929996490479,
-0.7415711283683777,
-0.6368277668952942,
... |
func MinimalTree(arr []int) *Node {
return CreateMinimalBST(arr, 0, len(arr)-1)
} | [
0.7053861618041992,
-0.249225452542305,
0.4333878755569458,
0.4437386691570282,
-1.163904070854187,
0.4970712959766388,
-0.32674330472946167,
-0.18754039704799652,
1.1160506010055542,
0.00008526359306415543,
0.443698912858963,
0.46777456998825073,
-1.26498281955719,
0.8031067848205566,
-... |
func ListOfDepths(n *Node) []*Node {
al := make([]*Node, 0)
q := Queue{}
q.Enqueue(n)
// repeat until queue for a given level is not empty (reach bottom of the tree)
for !q.IsEmpty() {
// All nodes of the current level of the tree.
levelNodes := len(q.Nodes)
// head for a linked list that will hold all n... | [
0.06161172688007355,
-0.3435339331626892,
0.8104830384254456,
-0.5228952169418335,
0.3707055449485779,
0.11985982209444046,
0.07334569841623306,
-1.0946866273880005,
0.8576568365097046,
0.15418878197669983,
-0.2714453339576721,
0.30484411120414734,
0.21682380139827728,
1.4820358753204346,
... |
func CheckBST(n *Node) bool {
return isBST(n, math.MinInt32, math.MaxInt32)
} | [
0.7462324500083923,
0.7405757308006287,
0.5025084614753723,
0.48206695914268494,
-0.14043378829956055,
0.9684795141220093,
-0.8574238419532776,
-1.343985676765442,
0.08472103625535965,
-0.020778005942702293,
-0.782646894454956,
0.8680453300476074,
-0.6262550354003906,
1.1492873430252075,
... |
func covers(root, p *Node) bool {
if root == nil {
return false
}
// If p is the same as root, we consider this a correct case, i.e. "covers".
if root == p {
return true
}
// Return true if any of the sides of the root node covers p.
return covers(root.Left, p) || covers(root.Right, p)
} | [
0.5378310680389404,
0.31691423058509827,
0.675269603729248,
0.765617847442627,
-0.7005836963653564,
0.377017617225647,
-1.1408133506774902,
-0.016491694375872612,
0.3889692425727844,
-0.30679574608802795,
0.49645617604255676,
0.1949586719274521,
-0.28490373492240906,
0.5549593567848206,
... |
func ContainsTree(t1, t2 *Node) bool {
if t2 == nil {
return true // The empty tree is always a subtree
}
return subTree(t1, t2)
} | [
0.08467461168766022,
0.6292269229888916,
0.7009367346763611,
0.19447104632854462,
-0.675808846950531,
0.6994614005088806,
-1.2680513858795166,
0.116947703063488,
-0.5314756631851196,
-0.16745257377624512,
-0.027790222316980362,
0.7251907587051392,
-0.5295652151107788,
0.45299527049064636,
... |
func subTree(r1, r2 *Node) bool {
if r1 == nil {
// Reached the end and could not find the root node of the smaller tree.
return false
} else if r1.Val == r2.Val && matchTree(r1, r2) {
// Matching node found.
return true
}
// Matching node not found. Continue traversing both sides and return true if the s... | [
0.2963809370994568,
0.4424048662185669,
0.9667577147483826,
0.12401479482650757,
-0.8401024341583252,
0.19128498435020447,
-1.0805174112319946,
-0.3507077693939209,
-0.45080068707466125,
0.16942539811134338,
0.007329052314162254,
-0.05228503793478012,
-0.40022948384284973,
0.07038306444883... |
func matchTree(r1, r2 *Node) bool {
if r1 == nil && r2 == nil {
return true // Nothing more left in subtrees to check.
}
if r1 == nil || r2 == nil {
return false // One of the trees is empty, therefore trees don't match.
}
if r1.Val != r2.Val {
return false // Data does not match
}
// Up until this mom... | [
-0.22785860300064087,
-0.2000129073858261,
1.011481523513794,
0.04015453904867172,
-0.5970103740692139,
0.44406628608703613,
-1.3828301429748535,
-0.1482577621936798,
-0.8230738639831543,
-0.031059324741363525,
-0.23277361690998077,
0.33333051204681396,
-0.337436318397522,
0.62279284000396... |
func NewTreeNode(d int) *TreeNode {
return &TreeNode{
data: d,
size: 1,
}
} | [
0.2854765057563782,
0.8506131768226624,
0.3821670711040497,
-1.1192377805709839,
-0.9321232438087463,
-0.4622078239917755,
-0.6621904373168945,
-0.5412582755088806,
0.3849620521068573,
-0.519779622554779,
-0.717545747756958,
0.9362128376960754,
-0.7152121663093567,
0.4671779274940491,
0.... |
func (t *TreeNode) getRandomNode() *TreeNode {
leftSize := 0
if t.left != nil {
leftSize = t.left.size
}
// get number of children for a current node
index := rand.Intn(t.size)
// Determine a side for a next random generation.
if index == leftSize {
return t
}
if index < leftSize {
// Select random... | [
-0.22402210533618927,
0.24804270267486572,
0.5948113799095154,
-0.41349005699157715,
0.11768781393766403,
0.2956191897392273,
-0.08284502476453781,
-0.10489217936992645,
0.5835352540016174,
-0.4181818664073944,
-0.25854378938674927,
0.2665008306503296,
-0.6885089874267578,
0.47564718127250... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.