text stringlengths 11 6.3k | embedding listlengths 768 768 |
|---|---|
func (lvl ColLevel) Copy() ColLevel {
if reflect.DeepEqual(lvl, ColLevel{}) {
return ColLevel{}
}
lvlCopy := ColLevel{}
lvlCopy = lvl
lvlCopy.Labels = make([]string, lvl.Len())
for i := 0; i < lvl.Len(); i++ {
lvlCopy.Labels[i] = lvl.Labels[i]
}
lvlCopy.LabelMap = make(LabelMap)
for k, v := range lvl.Label... | [
-1.0694429874420166,
-1.0918301343917847,
0.7842969298362732,
-0.07662814110517502,
-1.2976536750793457,
1.0962640047073364,
0.021453801542520523,
-0.9178911447525024,
-0.12234325706958771,
0.7148170471191406,
-0.5985733270645142,
0.3841601312160492,
-0.5042330622673035,
-0.140290021896362... |
func (col Columns) Copy() Columns {
if reflect.DeepEqual(col, Columns{Levels: make([]ColLevel, 0), NameMap: make(LabelMap)}) {
return Columns{Levels: make([]ColLevel, 0), NameMap: make(LabelMap)}
}
colCopy := Columns{NameMap: LabelMap{}}
for k, v := range col.NameMap {
colCopy.NameMap[k] = v
}
for i := 0; i <... | [
-1.0782067775726318,
-0.663757860660553,
0.8187583684921265,
0.22091802954673767,
-1.1126787662506104,
1.3266103267669678,
0.5408420562744141,
-1.050851583480835,
-0.42318201065063477,
1.0118894577026367,
-0.5314599275588989,
0.2505849003791809,
-0.170542910695076,
-0.45259979367256165,
... |
func (col *Columns) Subset(colPositions []int) {
for j := 0; j < col.NumLevels(); j++ {
col.Levels[j].Subset(colPositions)
}
col.updateNameMap()
return
} | [
-0.7211171388626099,
-0.44348838925361633,
0.28869566321372986,
0.17013943195343018,
-0.9414923191070557,
0.20248942077159882,
0.7414580583572388,
-0.843125581741333,
-0.744880735874176,
0.3448650538921356,
-1.275058627128601,
-0.2479555457830429,
0.024812282994389534,
-0.13585883378982544... |
func (lvl *ColLevel) Subset(positions []int) {
var labels []string
for _, pos := range positions {
labels = append(labels, lvl.Labels[pos])
}
lvl.Labels = labels
lvl.Refresh()
return
} | [
-1.0138026475906372,
-1.1245890855789185,
0.279508113861084,
-0.8196089267730713,
-0.5899263620376587,
0.4287726879119873,
-0.3482494354248047,
-0.3168031573295593,
-0.6302589774131775,
0.747183620929718,
-0.5444643497467041,
0.621608555316925,
0.0706094279885292,
-0.23412206768989563,
-... |
func updateHost(k string, v string) {
hostMap := etcdWatcher.Map()
_, containsHost := hostMap[k]
go etcdWatcher.UpdateMap(k, v)
// regenerate these files ONLY if it is a new host
if !containsHost {
go fixHostKey(k)
regenHosts()
}
} | [
-0.12414807081222534,
-0.7278521060943604,
0.35282981395721436,
0.5004466772079468,
0.03568362817168236,
0.19778041541576385,
-0.8710976839065552,
0.8511316776275635,
-1.0711274147033691,
0.6474243402481079,
0.1964440941810608,
0.31877401471138,
-0.14275971055030823,
0.4347575902938843,
... |
func writeHostMap(hostMap map[string]string) {
if host_list_file == "" {
return
}
f, err := os.Create(host_list_file)
if err != nil {
logr.LogLine(logr.Lerror, ltagsrc, err.Error())
}
defer f.Close()
for host := range hostMap {
f.WriteString(fmt.Sprintf("%s\n", host))
}
} | [
-0.5677363872528076,
-0.7383843064308167,
0.5711438655853271,
-0.00015647872351109982,
1.3449431657791138,
0.9333531260490417,
0.2579100728034973,
0.9862762689590454,
-0.7119782567024231,
-0.00733572244644165,
-0.9789504408836365,
-0.12397228181362152,
-0.19984273612499237,
0.5337709784507... |
func regenHosts() {
if limiterOn { // we're already waiting on a file rewrite
logr.LogLine(logr.Linfo, ltagsrc, "limiter already on")
return
}
// do some date math here -- have we waited long enough to write our file?
// now < lastfilewrite + fileRewriteInterval
if time.Now().Before(lastFileWrite.Add(time.Dur... | [
0.06447045505046844,
0.1643892526626587,
0.4433870315551758,
0.09871412813663483,
0.6356567740440369,
0.00004981028178008273,
0.02518884651362896,
1.1703139543533325,
-1.1278302669525146,
-0.5552470684051514,
0.21775628626346588,
-0.5288510322570801,
-0.5408033132553101,
-0.067818321287631... |
func LCOF14I() {
fmt.Println(cuttingRope(2))
fmt.Println(cuttingRope(10))
} | [
0.4800102412700653,
0.25718238949775696,
0.22138316929340363,
0.1341067999601364,
0.29991161823272705,
-0.5961660742759705,
0.23057086765766144,
-0.5933396816253662,
-0.9398630857467651,
-0.05367507413029671,
0.0027354476042091846,
-0.19329304993152618,
-0.23029537498950958,
-0.29566243290... |
func TestMakeHeader(t *testing.T) {
in := map[string]int{"b": 1, "z": 2, "a": 3, "r": 4, "o": 5}
for _, tt := range header_tests {
header, err := makeHeader(in, tt.columns)
if err != nil {
t.Fatal(err)
}
if !reflect.DeepEqual(tt.expect, header) {
t.Errorf("Expecting %#v, got %#v", tt.expect, header)
}... | [
-0.437117338180542,
-0.20974895358085632,
0.676845908164978,
0.09152102470397949,
0.5788835287094116,
0.12692472338676453,
0.6620725989341736,
-0.3222765028476715,
-0.3314431309700012,
-0.7316439151763916,
-0.679663896560669,
-0.5856854319572449,
-0.46592503786087036,
-0.3976803421974182,
... |
func TestMakeCell(t *testing.T) {
for _, tt := range cell_tests {
cell := makeCell(tt.cell)
if cell != tt.expect {
t.Errorf("Expecting %q, got %q", tt.expect, cell)
}
}
} | [
0.21881212294101715,
0.8899455666542053,
0.21339672803878784,
0.28019410371780396,
1.0818674564361572,
0.7860395908355713,
0.6459981799125671,
-0.27010756731033325,
-0.35030263662338257,
-0.5026311278343201,
0.19551528990268707,
-0.755796492099762,
0.43482011556625366,
0.35928642749786377,... |
func TestMax(t *testing.T) {
for _, tt := range max_tests {
m := max(tt.a, tt.b, tt.c)
if m != tt.expect {
t.Errorf("Expecting %d, got %d", tt.expect, m)
}
}
} | [
-0.023271644487977028,
0.630214512348175,
0.4331067204475403,
0.42830315232276917,
1.0332202911376953,
0.6195171475410461,
-0.4417249262332916,
0.20103856921195984,
0.06198890879750252,
-0.03704605624079704,
0.32572227716445923,
-0.8438716530799866,
-0.33981531858444214,
0.6476620435714722... |
func Racer(a, b string) (winner string, error error) {
return ConfigurableRacer(a, b, tenSecondTimeout)
} | [
-0.012729035690426826,
0.6772907376289368,
0.26509401202201843,
1.1024184226989746,
-1.0478174686431885,
-0.4220259189605713,
-0.34871989488601685,
0.27285972237586975,
-0.47750070691108704,
0.7632536292076111,
0.08693388104438782,
0.5031550526618958,
0.2662912607192993,
-0.367098689079284... |
func ConfigurableRacer(a, b string, timeout time.Duration) (winner string, error error) {
select {
case <-ping(a):
return a, nil
case <-ping(b):
return b, nil
case <-time.After(timeout):
return "", fmt.Errorf("timed out waiting for %s and %s", a, b)
}
} | [
-0.18497969210147858,
0.30313560366630554,
0.5096480846405029,
0.7531716227531433,
-0.8205583691596985,
-0.12359360605478287,
-0.8537233471870422,
-0.11763690412044525,
-0.36033323407173157,
0.8669626712799072,
0.6729248762130737,
-0.16228722035884857,
0.3113877773284912,
-0.09861776232719... |
func ping(url string) chan struct{} {
ch := make(chan struct{})
go func() {
http.Get(url)
close(ch)
}()
return ch
} | [
-0.9425262808799744,
-0.3805921971797943,
0.5984630584716797,
-0.32729610800743103,
0.19422538578510284,
0.615627110004425,
-0.12926295399665833,
-0.811531126499176,
-0.12511640787124634,
0.21196916699409485,
0.28969237208366394,
0.27982771396636963,
-0.5554933547973633,
-0.134547054767608... |
func (c *MirrorController) Run() error {
c.wg = sync.WaitGroup{}
repos := set.New()
// Get list of manual entered repositories
// and add them to the set
repoList, err := c.Config.GetNamesOfRepositories()
if err != nil {
if config.IsNoRepositories(err) {
c.Log.WithError(err).Info("Configuration")
} else {... | [
-0.6471186876296997,
0.3178516626358032,
0.8489961624145508,
-0.21955814957618713,
0.8399884104728699,
-0.4784656763076782,
0.6523218154907227,
0.4923146963119507,
-0.1945895254611969,
0.05332615599036217,
-1.0607081651687622,
-0.36896440386772156,
-0.834115207195282,
0.9500470757484436,
... |
func NewRoundRobin(server ...string) *Client {
ss := new(RoundRobinServerList)
err := ss.SetServers(server...)
if err != nil {
return nil
}
return NewFromRoundRobinSelector(ss)
} | [
-0.6642130017280579,
-0.9472228288650513,
0.629744827747345,
0.3484019637107849,
0.0046580517664551735,
0.33420613408088684,
0.6129691004753113,
-0.8762432336807251,
-0.30339887738227844,
-0.28271740674972534,
-0.4058677852153778,
0.9159767031669617,
-1.3896608352661133,
0.7114917039871216... |
func NewFromRoundRobinSelector(ss *RoundRobinServerList) *Client {
return &Client{
selector: ss,
DisableCAS: false,
}
} | [
-0.13217511773109436,
-1.421373963356018,
0.0729263573884964,
0.21554985642433167,
-0.43020275235176086,
0.03554413095116615,
1.0450342893600464,
-0.9118553400039673,
0.2891155183315277,
-0.2029416710138321,
-0.4091342091560364,
0.3219575881958008,
-1.148692011833191,
0.005553198978304863,... |
func (ss *RoundRobinServerList) SetServers(servers ...string) error {
naddr := make([]net.Addr, len(servers))
for i, server := range servers {
if strings.Contains(server, "/") {
addr, err := net.ResolveUnixAddr("unix", server)
if err != nil {
return err
}
naddr[i] = newStaticAddr(addr)
} else {
... | [
-1.260003685951233,
0.1605493426322937,
0.5331317782402039,
0.10077161341905594,
1.0199521780014038,
0.3197419047355652,
0.2851272523403168,
-0.11650898307561874,
0.40004003047943115,
0.006086109671741724,
-0.33391574025154114,
0.35457295179367065,
-1.1088120937347412,
1.0604320764541626,
... |
func (ss *RoundRobinServerList) Each(f func(net.Addr) error) error {
ss.mu.Lock()
defer ss.mu.Unlock()
for _, a := range ss.addrs {
if err := f(a); nil != err {
return err
}
}
return nil
} | [
-0.9428281784057617,
-0.24381759762763977,
0.42956146597862244,
0.1734365075826645,
1.0049598217010498,
0.3804507851600647,
0.856075644493103,
-0.6401429176330566,
-0.41656923294067383,
0.36073002219200134,
0.3003811538219452,
0.37819281220436096,
-0.14621374011039734,
0.6676323413848877,
... |
func gobKey(uid string) string {
return "gob:" + uid
} | [
-0.13303251564502716,
0.028528865426778793,
0.22255825996398926,
-0.06956733018159866,
0.9281264543533325,
1.1399739980697632,
-0.535674512386322,
-0.04976893588900566,
-0.7292593121528625,
1.9012659788131714,
-0.2282908707857132,
0.662395715713501,
-0.7931067943572998,
0.3441409468650818,... |
func gobInfoKey(uid string) string {
return "gobInfo:" + uid
} | [
-0.24485640227794647,
-0.39457613229751587,
0.25992268323898315,
0.26135680079460144,
0.8712633848190308,
1.0161781311035156,
-0.18994693458080292,
-0.10172179341316223,
-0.6559677124023438,
1.0739681720733643,
-0.11789251863956451,
0.9672058820724487,
-0.300414502620697,
0.373326629400253... |
func hordeListKey(hordeName string) string {
return "hordeList:" + hordeName
} | [
-0.9022828936576843,
-0.47083935141563416,
0.3344980776309967,
-0.25647926330566406,
0.6385868787765503,
0.00537223182618618,
-0.6120273470878601,
1.066379189491272,
-0.01086343452334404,
1.6342589855194092,
-1.7129946947097778,
0.6597533822059631,
0.1558489203453064,
1.3328742980957031,
... |
func hordeHashKey(hordeName string) string {
return "hordeHash:" + hordeName
} | [
0.039093904197216034,
-0.375297486782074,
0.5047167539596558,
-0.32148632407188416,
1.0136022567749023,
0.3322479724884033,
-0.059334442019462585,
0.573820948600769,
-0.2955490052700043,
1.0746818780899048,
-0.5979137420654297,
0.23847734928131104,
0.5741920471191406,
0.7606533765792847,
... |
func tokenKey(delUID string) string {
return "token:" + delUID
} | [
-0.12376513332128525,
-0.2471594363451004,
0.26908454298973083,
-1.1132822036743164,
-0.11870371550321579,
-0.08356964588165283,
-0.8906709551811218,
0.732315719127655,
-0.32987815141677856,
0.906559407711029,
-0.6232572197914124,
1.2041199207305908,
0.48729440569877625,
0.0554597154259681... |
func deletedKey(key string) string {
return key + ":deleted"
} | [
0.4513530731201172,
0.017818046733736992,
0.2517615556716919,
-0.7216798663139343,
-0.13965259492397308,
0.9144077301025391,
-1.2393755912780762,
0.7426188588142395,
0.5341097116470337,
0.5810344815254211,
0.10673926770687103,
0.47890281677246094,
0.16550885140895844,
0.2509223520755768,
... |
func gobInfoEncode(gob *storage.GobInfo) ([]byte, error) {
buf := new(bytes.Buffer)
gobEnc := realgob.NewEncoder(buf)
err := gobEnc.Encode(gob)
return buf.Bytes(), err
} | [
0.1970605105161667,
-0.33552902936935425,
0.20403483510017395,
0.5569897890090942,
0.8990908265113831,
0.2880263328552246,
-0.7293897271156311,
-0.2693222761154175,
-0.9910567402839661,
0.6070035696029663,
-0.8134546875953674,
0.5975112318992615,
-1.0792732238769531,
0.4036506116390228,
... |
func gobInfoDecode(gobBytes []byte) (*storage.GobInfo, error) {
gobInfo := &storage.GobInfo{}
buf := bytes.NewReader(gobBytes)
gobDec := realgob.NewDecoder(buf)
err := gobDec.Decode(gobInfo)
return gobInfo, err
} | [
0.2482583373785019,
-0.3356779217720032,
0.3234601616859436,
0.33016669750213623,
0.7614110112190247,
0.3413904309272766,
-0.5924620032310486,
-0.12455376237630844,
-0.9075871706008911,
0.1392243355512619,
-1.2831379175186157,
0.1324901431798935,
-0.8371245861053467,
0.04060151055455208,
... |
func getStrLen(client *pool.Client, key string) (int, error) {
reply := client.Cmd("STRLEN", key)
if reply.Err != nil {
return -1, reply.Err
}
return reply.Int()
} | [
-0.4897819757461548,
0.6366666555404663,
0.34386181831359863,
-0.1572675108909607,
-0.08307160437107086,
-0.6136683225631714,
0.33601999282836914,
-0.08818478882312775,
-0.5960920453071594,
0.24702586233615875,
-0.7263597249984741,
0.6780281662940979,
-1.3664054870605469,
0.022244514897465... |
func New(confStr string) *RedisStore {
return &RedisStore{pool.New("tcp", confStr, 100)}
} | [
-0.13536721467971802,
-0.05059702321887016,
-0.12137421220541,
-0.6796215176582336,
-0.7850141525268555,
-0.002402782440185547,
-0.4571453034877777,
-0.11830286681652069,
0.14576105773448944,
-0.05429306626319885,
-0.4103105068206787,
-0.1289243996143341,
-0.01403795089572668,
-0.066270366... |
func (redisStore *RedisStore) setTTLRoutine(client *pool.Client, gobInfo *storage.GobInfo, data []byte) {
defer redisStore.Put(client)
ttl := calculateTTL(data)
if i, _ := client.Cmd("EXPIRE", gobKey(gobInfo.UID), ttl).Int(); i == 0 {
gslog.Error("REDIS: could not set expire time for key '%s' to %d seconds", gobKe... | [
-0.10439478605985641,
0.260022908449173,
0.6490578055381775,
-1.311570405960083,
0.7084043622016907,
-0.31014344096183777,
-0.6991462707519531,
-0.20204290747642517,
-0.6834547519683838,
0.8291769623756409,
-0.8702080249786377,
-0.19440744817256927,
-0.46198326349258423,
0.4532982409000397... |
func deleteExpire(client *pool.Client, key string) error {
// Make gob inaccessble using normal key
reply := client.Cmd("RENAME", key, deletedKey(key))
if reply.Err != nil {
return reply.Err
}
reply = client.Cmd("EXPIRE", deletedKey(key), DEL_TTL)
if reply.Err != nil {
return reply.Err
}
if i, _ := reply.In... | [
-0.00562814436852932,
0.16745132207870483,
0.6172670125961304,
0.09714241325855255,
0.020536933094263077,
-0.5454822778701782,
-1.662128210067749,
-0.3816724419593811,
0.059905044734478,
1.2714128494262695,
-0.1531006246805191,
0.18959535658359528,
-0.3870091140270233,
1.3935472965240479,
... |
func (redisStore *RedisStore) AppendGob(uid string, data []byte) error {
client, err := redisStore.Get()
if err != nil {
return err
}
// Get gobInfo
reply := client.Cmd("GET", gobInfoKey(uid))
if reply.Err != nil {
return reply.Err
}
gobInfoBytes, _ := reply.Bytes()
gobInfo, err := gobInfoDecode(gobInfoByt... | [
0.012819704599678516,
0.9094220399856567,
0.9041920304298401,
-0.2434062510728836,
0.1438407003879547,
0.6682129502296448,
-1.3174599409103394,
-0.18692298233509064,
0.16908811032772064,
0.5275924205780029,
-0.22356298565864563,
0.4995211064815521,
-0.4549439549446106,
0.9084762334823608,
... |
func (redisStore *RedisStore) GetHorde(hordeName string) (storage.Horde, error) {
client, err := redisStore.Get()
if err != nil {
return nil, err
}
reply := client.Cmd("LRANGE", hordeListKey(hordeName), 0, -1)
if reply.Err != nil {
return nil, reply.Err
}
hordeList, _ := reply.List()
reply = client.Cmd("HGE... | [
-0.6791669130325317,
0.47940897941589355,
0.7466066479682922,
0.7157525420188904,
0.5973135828971863,
0.37599536776542664,
-0.6244322061538696,
0.29877737164497375,
0.48728129267692566,
-0.09770061075687408,
-0.9673628807067871,
0.3575533628463745,
-1.2156925201416016,
0.5596414804458618,
... |
func (redisStore *RedisStore) DelUIDHorde(uid string) error {
client, err := redisStore.Get()
if err != nil {
return err
}
hordeName, err := redisStore.uidToHorde(client, uid)
if err != nil {
return err
}
if hordeName == "" {
redisStore.Put(client)
return nil
}
if reply := client.Cmd("LREM", hordeListK... | [
-0.10375750064849854,
0.3581753075122833,
0.552352249622345,
-0.5773765444755554,
-0.5776657462120056,
0.4755449891090393,
-0.4211353361606598,
0.8454592823982239,
1.1364554166793823,
0.390516072511673,
-0.6170271039009094,
0.1658497303724289,
-1.1958441734313965,
0.9509357213973999,
0.5... |
func (currService *CurrencyService) AddCurrency(curr *Currency) (*Currency, error) {
validCurr := curr.Validate()
if validCurr != nil {
return nil, validCurr
}
currency, err := currService.Repo.Save(curr)
if err != nil {
return nil, err
}
return currency, nil
} | [
-1.007967233657837,
-0.09030809998512268,
0.49643442034721375,
0.14702676236629486,
-0.10827451199293137,
-0.04258474335074425,
0.3580854833126068,
0.1258513331413269,
0.9509284496307373,
-0.029849573969841003,
0.06369667500257492,
-0.9014093279838562,
-1.1906287670135498,
0.58460229635238... |
func (currService *CurrencyService) GetCurrencies() []*Currency {
currencies, err := currService.Repo.FindAll()
if err != nil {
return nil, err
}
return currencies, nil
} | [
-0.3206217586994171,
0.8310860991477966,
0.12784650921821594,
-0.11459602415561676,
1.0131703615188599,
-0.4416656494140625,
-0.38656264543533325,
-0.417525053024292,
0.18777646124362946,
0.24106310307979584,
0.08759065717458725,
0.12881022691726685,
-1.07850182056427,
1.2794946432113647,
... |
func (currService *CurrencyService) RemoveCurrency(id string) error {
if err := currService.Repo.DeleteCurrency(id); err != nil {
return err
}
return nil
} | [
-0.8421195149421692,
-0.025388725101947784,
0.08903294801712036,
-0.35271137952804565,
0.3156892955303192,
-0.6611846089363098,
0.1705923080444336,
0.9955676198005676,
0.592621386051178,
0.6683111786842346,
-0.7202152013778687,
-0.4476879835128784,
-1.0500377416610718,
0.6471965909004211,
... |
func (currService *CurrencyService) UpdateCurrency(id string, curr *Currency) (*Currency, error) {
validCurr := curr.Validate()
if validCurr != nil {
return nil, validCurr
}
currency, err := currService.Repo.UpdateCurrency(id, curr)
if err != nil {
return nil, err
}
return currency, nil
} | [
-1.260948657989502,
-0.7368857264518738,
0.1927066445350647,
0.07993756234645844,
-0.4118868410587311,
-0.45467913150787354,
0.11708725988864899,
0.020719455555081367,
0.47932448983192444,
0.7903766632080078,
-0.12318938970565796,
0.13757586479187012,
-1.2855823040008545,
0.062940135598182... |
func Workflow(ctx workflow.Context, name string) (string, error) {
ao := workflow.ActivityOptions{
StartToCloseTimeout: 10 * time.Second,
}
ctx = workflow.WithActivityOptions(ctx, ao)
logger := workflow.GetLogger(ctx)
logger.Info("HelloWorld workflow started", "name", name)
var result string
err := workflow.... | [
-0.2728537321090698,
0.18193885684013367,
0.727633535861969,
0.2508775591850281,
0.20077688992023468,
-0.4748096466064453,
0.6269287467002869,
-1.123050332069397,
0.5828502774238586,
0.6637003421783447,
-0.13623419404029846,
-0.03913469612598419,
-0.506828784942627,
-0.08374939858913422,
... |
func ParseClientOptionFlags(args []string) (client.Options, error) {
// Parse args
set := flag.NewFlagSet("hello-world-mtls", flag.ExitOnError)
targetHost := set.String("target-host", "localhost:7233", "Host:port for the server")
namespace := set.String("namespace", "default", "Namespace for the server")
serverRoo... | [
0.715854823589325,
-0.19740156829357147,
0.910982072353363,
0.07055699825286865,
-0.8535950183868408,
0.4247817397117615,
0.5888423323631287,
-0.851593554019928,
-0.5818372964859009,
0.6965966820716858,
-0.18711182475090027,
-0.08922065049409866,
-0.8201060891151428,
0.8651003241539001,
... |
func ValidateFacility(p Priority) error {
if p < 0 || p > LogLocal7 {
return fmt.Errorf("log/syslog: invalid facility")
}
return nil
} | [
0.056378401815891266,
-0.08159152418375015,
0.3219132125377655,
0.3752496540546417,
0.5421344637870789,
-0.07306306809186935,
0.2525164783000946,
0.6196569800376892,
0.38859692215919495,
-0.8051062226295471,
0.39840400218963623,
-0.32012200355529785,
0.5213015675544739,
0.8875887989997864,... |
func makeGetEventsHandler(endpoints endpoint.Endpoints, options []grpc.ServerOption) grpc.Handler {
return grpc.NewServer(endpoints.GetEventsEndpoint, decodeGetEventsRequest, encodeGetEventsResponse, options...)
} | [
0.21801529824733734,
-0.07130004465579987,
0.6091058850288391,
-0.3022855222225189,
0.7000939249992371,
-0.013568184338510036,
0.22448942065238953,
-0.2606234550476074,
0.9063433408737183,
-0.34435710310935974,
0.3164615333080292,
0.509713888168335,
-0.5882979035377502,
-0.7302576899528503... |
func decodeGetEventsRequest(_ context.Context, r interface{}) (interface{}, error) {
return nil, errors.New("'Events' Decoder is not impelemented")
} | [
-0.7479465007781982,
-0.009867695160210133,
0.7432757019996643,
-0.3002949655056,
-0.25306135416030884,
-1.2950770854949951,
0.31634506583213806,
-0.5575429201126099,
1.1270475387573242,
-0.5985796451568604,
0.015236541628837585,
0.648807168006897,
-0.5494527220726013,
0.23455843329429626,... |
func encodeGetEventsResponse(_ context.Context, r interface{}) (interface{}, error) {
return nil, errors.New("'Events' Encoder is not impelemented")
} | [
0.1706905961036682,
-0.20296430587768555,
0.5100277662277222,
-0.040010448545217514,
0.30158063769340515,
-0.8143858313560486,
0.9868121147155762,
-0.967654287815094,
1.8592216968536377,
0.0998440533876419,
-0.5180123448371887,
-0.030387353152036667,
-1.068634033203125,
-0.1867673695087433... |
func vmIDtoMacAddr(vmID uint) string {
var addrParts []string
// mac addresses have 6 hex components separate by ":", i.e. "11:22:33:44:55:66"
numMacAddrComponents := uint(6)
for n := uint(0); n < numMacAddrComponents; n++ {
// To isolate the value of the nth component, right bit shift the vmID by 8*n (there ar... | [
-0.0755590945482254,
-1.0839983224868774,
0.5577771663665771,
-0.8995904922485352,
-0.3805093467235565,
-0.04685254767537117,
-0.6409153938293457,
-0.2587597370147705,
1.1297498941421509,
0.8733185529708862,
0.5225700736045837,
0.1874592900276184,
0.2355118691921234,
-0.2013876736164093,
... |
func ListNumaSockets() []NumaSocket {
numaSocketListInit.Do(func() {
topology, e := ghw.Topology()
if e != nil {
return
}
for _, node := range topology.Nodes {
numaSocketList = append(numaSocketList, NumaSocketFromID(node.ID))
}
})
return numaSocketList
} | [
0.06898604333400726,
-0.04598555341362953,
0.4938136041164398,
-0.172439306974411,
0.6116989254951477,
-0.5347793698310852,
0.5085868239402771,
-0.7137839198112488,
1.1308077573776245,
-0.21834684908390045,
-0.5293492674827576,
0.6135286092758179,
0.4326620399951935,
1.3236809968948364,
... |
func NumaSocketFromID(id int) (socket NumaSocket) {
if id < 0 || id > C.RTE_MAX_NUMA_NODES {
return socket
}
socket.v = id + 1
return socket
} | [
0.05624237284064293,
0.5969734191894531,
0.42287907004356384,
-0.3364681005477905,
-0.13130995631217957,
-0.3077598810195923,
0.3386894762516022,
-0.26564139127731323,
1.4092833995819092,
-0.4261777400970459,
0.3434981405735016,
1.0550084114074707,
0.2718716859817505,
0.44553226232528687,
... |
func (socket NumaSocket) ID() int {
return socket.v - 1
} | [
0.15583959221839905,
0.059559646993875504,
0.5230985283851624,
0.4095141291618347,
0.03905818983912468,
0.6778644919395447,
0.5774121284484863,
-0.013872578740119934,
1.7119466066360474,
-0.19650301337242126,
-0.090826615691185,
0.7661751508712769,
-1.2009589672088623,
0.12258994579315186,... |
func (socket NumaSocket) IsAny() bool {
return socket.v == 0
} | [
-0.3843739926815033,
-0.49566757678985596,
0.5524944067001343,
0.21764254570007324,
0.6055159568786621,
-0.580129086971283,
-0.7047495245933533,
-0.6167991161346436,
0.7609966993331909,
-0.3765203356742859,
0.33830732107162476,
1.7680530548095703,
-0.7833589315414429,
0.476589560508728,
... |
func Login(w http.ResponseWriter, r *http.Request) {
login := strings.Trim(r.FormValue("login"), " ")
pass := strings.Trim(r.FormValue("pass"), " ")
log.Println("login: ", login, " pass: ", pass)
// Check params
if login == "" || pass == "" {
writeResponse(w, "Login and password required\n", http.StatusB... | [
-0.5852524638175964,
-0.6265351176261902,
1.0237373113632202,
0.5495239496231079,
-0.26879531145095825,
0.5376088619232178,
0.6837024688720703,
-0.34877511858940125,
0.4018718898296356,
0.039049237966537476,
-0.3633037209510803,
0.010234874673187733,
0.11447226256132126,
0.1403247267007827... |
func ChangePass(w http.ResponseWriter, r *http.Request) {
login := strings.Trim(r.FormValue("login"), " ")
pass := strings.Trim(r.FormValue("pass"), " ")
// Check params
if login == "" || pass == "" {
writeResponse(w, "Login and password required\n", http.StatusBadRequest)
return
}
newPass := stri... | [
-1.0480284690856934,
-0.8987918496131897,
1.0520669221878052,
0.27727973461151123,
0.3695179522037506,
0.5959340929985046,
-0.18468570709228516,
-0.031044865027070045,
0.08717449754476547,
0.44758397340774536,
-0.46431806683540344,
0.41726672649383545,
0.02449859119951725,
0.71450549364089... |
func DoWork(w http.ResponseWriter, r *http.Request) {
type resp struct {
BigNumber int64 `json:"number"`
// SmallNumber int32 `json:"smallNumber"`
Text string `json:"text"`
}
var value resp
login := r.FormValue("login")
if Work[login] <= 0 { // idk what is it
writeResponse(w, "Work not found\n"... | [
-1.7322994470596313,
-0.1106358990073204,
1.1414660215377808,
-0.05202283710241318,
-0.04269928112626076,
0.07702525705099106,
1.007843017578125,
-0.7619213461875916,
-0.32735300064086914,
0.08206596970558167,
-0.5339284539222717,
-0.25744104385375977,
0.20818138122558594,
0.27662184834480... |
func NewDedicatedGameServerController(client kubernetes.Interface, dgsclient dgsclientset.Interface,
dgsInformer informerdgs.DedicatedGameServerInformer,
podInformer informercorev1.PodInformer, nodeInformer informercorev1.NodeInformer, portRegistry *controllers.PortRegistry) *Controller {
c := &Controller{
dgsCli... | [
0.025181572884321213,
0.7220336198806763,
0.7314776182174683,
-0.5139425992965698,
0.46872201561927795,
-0.2265213280916214,
0.7789285778999329,
-0.46284520626068115,
0.1192958801984787,
0.09774564206600189,
-0.23411716520786285,
0.621834397315979,
-0.21273590624332428,
0.7619052529335022,... |
func (c *Controller) syncHandler(key string) error {
// Convert the namespace/name string into a distinct namespace and name
namespace, dgsName, err := cache.SplitMetaNamespaceKey(key)
if err != nil {
runtime.HandleError(fmt.Errorf("invalid resource key: %s", key))
return nil
}
// try to get the DedicatedGame... | [
-0.524941623210907,
-0.0493604801595211,
0.9241214990615845,
-0.20449554920196533,
0.6082435846328735,
-0.17751753330230713,
0.30578136444091797,
-0.8210409283638,
0.347624272108078,
0.5591034293174744,
0.24976994097232819,
-0.07263496518135071,
-0.2770196497440338,
0.5525643825531006,
1... |
func (c *Controller) enqueueDedicatedGameServer(obj interface{}) {
var key string
var err error
if key, err = cache.MetaNamespaceKeyFunc(obj); err != nil {
runtime.HandleError(err)
return
}
c.controllerHelper.Workqueue.AddRateLimited(key)
} | [
-0.5250144004821777,
0.6796661019325256,
0.7121879458427429,
-0.6342138051986694,
0.44586771726608276,
0.6105483770370483,
0.06313394010066986,
-1.3338885307312012,
0.608309268951416,
0.3849051296710968,
-0.9359980821609497,
1.1246156692504883,
-0.8030533194541931,
0.32779404520988464,
-... |
func (c *Controller) Run(controllerThreadiness int, stopCh <-chan struct{}) error {
return c.controllerHelper.Run(controllerThreadiness, stopCh)
} | [
0.0005100990529172122,
-0.3670559823513031,
0.24576064944267273,
-0.5705638527870178,
1.002197265625,
0.23246590793132782,
0.1440935730934143,
-0.265392541885376,
-0.24439272284507751,
-0.9064585566520691,
-0.7184098958969116,
-0.18949896097183228,
-0.32274553179740906,
0.2604925036430359,... |
func (tc TagCounts) Len() int {
return len(tc)
} | [
1.2601877450942993,
0.23843275010585785,
0.01723686046898365,
-0.9778186082839966,
0.777367889881134,
-0.2616367042064667,
0.6079186797142029,
0.23096171021461487,
-0.8792587518692017,
-0.6034365892410278,
-1.0560798645019531,
-0.20287103950977325,
1.0850738286972046,
0.4536815583705902,
... |
func (tc TagCounts) Swap(i int, j int) {
tc[i], tc[j] = tc[j], tc[i]
} | [
-0.4190938174724579,
-0.10946497321128845,
0.13882434368133545,
-1.1549495458602905,
0.22398166358470917,
0.27734988927841187,
0.06115773692727089,
-0.3287760615348816,
-1.648599624633789,
-0.19998107850551605,
-0.32101961970329285,
0.09180556982755661,
0.8396936058998108,
-0.5809813141822... |
func NewCSV(fpath string, pid int64, diskDevice string, networkInterface string, extraPath string, tcfg *top.Config) (c *CSV, err error) {
c = &CSV{
FilePath: fpath,
PID: pid,
DiskDevice: diskDevice,
NetworkInterface: networkInterface,
Header: ProcHeader,
HeaderIndex: ProcH... | [
0.027906598523259163,
0.010791228152811527,
0.2757716774940491,
0.7287519574165344,
-0.7015886902809143,
-0.27743595838546753,
0.4829398989677429,
-0.017095735296607018,
-0.4838268458843231,
-0.6331696510314941,
0.9858555197715759,
0.7342976331710815,
-0.15696370601654053,
0.46394756436347... |
func (c *CSV) Add() error {
cur, err := GetProc(
WithPID(c.PID),
WithDiskDevice(c.DiskDevice),
WithNetworkInterface(c.NetworkInterface),
WithExtraPath(c.ExtraPath),
WithTopStream(c.TopStream),
)
if err != nil {
return err
}
// first call; just append and return
if len(c.Rows) == 0 {
c.MinUnixNanose... | [
0.1250428557395935,
0.011040866374969482,
0.7829456329345703,
-0.08380302786827087,
-0.12637697160243988,
-0.5069493055343628,
0.6258628368377686,
-0.16193728148937225,
0.32149896025657654,
-0.7993488907814026,
0.3826921284198761,
0.48762646317481995,
-0.20566293597221375,
1.11021304130554... |
func (c *CSV) Save() error {
if c.TopStream != nil {
if err := c.TopStream.Stop(); err != nil {
log.Println(err)
}
select {
case err := <-c.TopStream.ErrChan():
log.Println(err)
default:
log.Println("TopStream has stopped")
}
}
f, err := fileutil.OpenToAppend(c.FilePath)
if err != nil {
retu... | [
-0.1677486151456833,
-0.6542584300041199,
0.535363495349884,
-0.08915921300649643,
0.38179346919059753,
-0.18143728375434875,
0.4814673066139221,
-0.20259937644004822,
-0.31230825185775757,
0.14361540973186493,
-0.3072139620780945,
0.31644192337989807,
-0.4355953335762024,
0.47599273920059... |
func ReadCSV(fpath string) (*CSV, error) {
f, err := fileutil.OpenToRead(fpath)
if err != nil {
return nil, err
}
defer f.Close()
rd := csv.NewReader(f)
// in case that rows have Deltaerent number of fields
rd.FieldsPerRecord = -1
rows, err := rd.ReadAll()
if err != nil {
return nil, err
}
if len(rows... | [
0.11053565889596939,
0.37055131793022156,
0.8288129568099976,
0.32531824707984924,
-0.2133958786725998,
-0.48732295632362366,
0.09520820528268814,
-0.2396596074104309,
-0.5068845748901367,
-0.19312073290348053,
0.6696603298187256,
0.7309384346008301,
0.2843130826950073,
-0.2314576506614685... |
func (command *CharCommandGenerator) CreateCommand(c commands.DiscordConnector, m *discordgo.MessageCreate,
name string, class commands.Class, userID string) (*CharacterCreateCommand, error) {
char, err := command.Repo.GetCharacterByDiscordUserID(userID)
if err != nil {
return nil, fmt.Errorf("couldn't get charac... | [
-0.6275780200958252,
-0.5585635900497437,
0.7070068120956421,
-0.1809152215719223,
0.868049681186676,
-0.03818982094526291,
0.08132467418909073,
-0.6217482686042786,
0.5944875478744507,
-0.44482725858688354,
0.18362639844417572,
0.17701080441474915,
-0.011553996242582798,
0.686715483665466... |
func (c *CharacterCreateCommand) Execute() {
c.Receiver.Answer(c.Payload())
} | [
0.03951311483979225,
-0.542736291885376,
0.40285050868988037,
-0.716329038143158,
1.0126959085464478,
0.8858603835105896,
-0.9320266246795654,
-1.1052416563034058,
-0.5345140695571899,
-0.5200081467628479,
-0.7042622566223145,
-0.7884811758995056,
-0.5465322136878967,
-0.7901477217674255,
... |
func (c *CharacterCreateCommand) Payload() *CharacterCreateCommandPayload {
return c.payload
} | [
0.2067650854587555,
0.01816702075302601,
0.1880250722169876,
-0.5227757096290588,
0.44257593154907227,
0.8972607851028442,
-0.14005324244499207,
-0.8915061950683594,
-0.08801672607660294,
-1.0748975276947021,
-0.5159449577331543,
-0.35718634724617004,
-0.3862808346748352,
-0.04196350648999... |
func (p *CharacterCreateCommandPayload) Session() commands.DiscordConnector {
return p.session
} | [
-0.7409206628799438,
-0.5651624798774719,
0.17613932490348816,
-0.9053495526313782,
0.3001061677932739,
0.40616655349731445,
0.14384347200393677,
-1.3121025562286377,
0.49465659260749817,
-1.3795528411865234,
0.28195828199386597,
0.2998311519622803,
-0.6982846260070801,
-0.1252223551273346... |
func Execute(log *zap.SugaredLogger, c conf.Config) error {
if log == nil {
return ErrLogger
}
if c == (conf.Config{}) {
return ErrConfig
}
rootCmd.CompletionOptions.DisableDefaultCmd = true
confg = c
if err := rootCmd.Execute(); err != nil {
logr.Warnln(err)
if e := err.Error(); strings.Contains(e, "req... | [
0.5024330019950867,
-0.2570044696331024,
0.7394711375236511,
0.6743156313896179,
0.04010162502527237,
0.15398378670215607,
0.022092120721936226,
0.5329264998435974,
-0.739281415939331,
0.42276105284690857,
-0.1453697830438614,
-0.157697856426239,
0.20520806312561035,
0.849096953868866,
0... |
func (c *Config) processAllCollection(m interface{}, url string, user string, password string, tile string) {
var groupSlice []interface{}
groupSlice, correct := m.([]interface{})
if correct {
for _, collection := range groupSlice {
col, correct := collection.(map[string]interface{})
//fmt.Printf("key: %v",... | [
-0.8590594530105591,
-0.7528349161148071,
0.9910356402397156,
0.4984115660190582,
-0.48834192752838135,
0.16155657172203064,
0.6959434151649475,
-0.6999637484550476,
-0.7329304814338684,
0.34889841079711914,
0.35319194197654724,
-0.1110398918390274,
0.12266679108142853,
1.5310436487197876,... |
func TruncateLength(event sample.Event, maxLength int) (sample.Event, bool) {
if event == nil {
return nil, false
}
limited, changed := truncRecursive(reflect.ValueOf(event), maxLength)
return limited.Interface().(sample.Event), changed
} | [
0.6330349445343018,
0.7328999638557434,
0.44251537322998047,
-0.3697916269302368,
-0.9135220646858215,
0.1844104677438736,
0.39731162786483765,
0.49207431077957153,
1.0192582607269287,
0.8422863483428955,
-0.6558501124382019,
0.017911486327648163,
-0.4204789102077484,
-0.15263713896274567,... |
func truncRecursive(val reflect.Value, maxLength int) (reflect.Value, bool) {
if !val.IsValid() {
return val, false
}
switch val.Kind() {
case reflect.String:
return truncString(val, maxLength)
case reflect.Ptr:
if val.IsNil() {
return val, false
}
return truncPointer(val, maxLength)
case reflect.Int... | [
0.5747072696685791,
0.8516000509262085,
0.7226150035858154,
-0.6688438057899475,
-1.0935994386672974,
0.051112595945596695,
0.20062486827373505,
-0.391663134098053,
-0.2911975681781769,
0.07624563574790955,
0.09941750019788742,
0.4657650887966156,
-0.8435741066932678,
0.10433488339185715,
... |
func GetPoints(l *Line, quantity int, stepRate float64, out []*point.Point) []*point.Point {
if quantity <= 0 && stepRate > 0 {
quantity = int(Length(l) / stepRate)
}
if out == nil {
out = make([]*point.Point, 0)
}
for idx := 0; idx < quantity; idx++ {
position := float64(idx) / float64(quantity)
x := l... | [
0.04896754398941994,
-0.10207998752593994,
0.46297624707221985,
0.8134440779685974,
0.5567396879196167,
-0.15424397587776184,
-0.09083300083875656,
-0.20388440787792206,
-0.05364073067903519,
-0.14879636466503143,
-0.15320220589637756,
-0.09951786696910858,
0.49723291397094727,
-0.14884018... |
func NewArrayIterator(array Array) Iterator {
return &arrayIterator{
basicArrayIterator: basicArrayIterator{array: array, pos: -1},
array: array,
pos: -1,
}
} | [
-0.4284592568874359,
-1.4210039377212524,
0.25391674041748047,
0.3860521614551544,
-1.6799732446670532,
-0.6265754699707031,
-1.352130651473999,
0.23324769735336304,
0.3345580995082855,
0.5019476413726807,
0.2265535295009613,
0.2622934579849243,
-0.08659526705741882,
0.5618885159492493,
... |
func NewArrayIndexer(array ArrayIndexer) IteratorIndexer {
return &arrayIteratorIndexer{
basicArrayIterator: basicArrayIterator{array: array, pos: -1},
array: array,
}
} | [
-0.6885125041007996,
-1.4714256525039673,
0.44203320145606995,
0.27326035499572754,
-1.38935387134552,
-0.3881031572818756,
-0.8527187705039978,
0.17364579439163208,
0.0896882712841034,
0.0302369836717844,
0.10059239715337753,
-0.1518811583518982,
-0.02430509403347969,
0.6167530417442322,
... |
func (l dirItemList) filesToRead(toRead, offset sizeBytes) []*fileItem {
var (
ret []*fileItem
startDir, startFile int
)
// find a file where offset goes between start and end (aligned to sector)
offsetSectors := offset.sectors()
firstFileLoop:
for i := range l {
for j := range l[i].files {
... | [
-0.7553720474243164,
-0.5933166742324829,
0.7771998643875122,
-0.21476244926452637,
-0.18325136601924896,
0.08776269853115082,
0.3519522249698639,
-0.0245378240942955,
0.18805453181266785,
-0.27914077043533325,
0.6346951127052307,
-0.2167821079492569,
-0.8414269685745239,
0.445421010255813... |
func (_m *Client) Query(query *hydrantclient.Query, dataset string) (*hydrantclient.ResultSet, error) {
ret := _m.Called(query, dataset)
var r0 *hydrantclient.ResultSet
if rf, ok := ret.Get(0).(func(*hydrantclient.Query, string) *hydrantclient.ResultSet); ok {
r0 = rf(query, dataset)
} else {
if ret.Get(0) != ... | [
-0.2657482922077179,
-0.012066427618265152,
0.29512253403663635,
-0.37397658824920654,
-0.7858393788337708,
-0.6126904487609863,
-0.11717481166124344,
0.2982947528362274,
0.302947461605072,
-0.8178051114082336,
0.6639214754104614,
0.5160019993782043,
0.3811839520931244,
0.08295787870883942... |
func CheckPassword(hash string, password string) bool {
err := bcrypt.CompareHashAndPassword([]byte(hash), []byte(password))
return err == nil
} | [
1.3197954893112183,
-0.2639635503292084,
0.8369449973106384,
1.3052613735198975,
0.8249492645263672,
0.37526261806488037,
-0.8250830173492432,
0.9921996593475342,
-0.229099303483963,
0.22765393555164337,
-0.22540874779224396,
0.41722720861434937,
-0.9420549273490906,
0.16955320537090302,
... |
func GenerateHash(password string) (string, error) {
hash, error := bcrypt.GenerateFromPassword([]byte(password), 12)
return string(hash), error
} | [
0.8615898489952087,
0.9924847483634949,
0.7973333597183228,
0.08534269034862518,
-0.7306214570999146,
0.9963581562042236,
-0.3510879576206207,
-0.11060300469398499,
0.5608628392219543,
0.09690502285957336,
-1.0022432804107666,
0.11559277027845383,
-0.6549482941627502,
-0.4582875967025757,
... |
func (m Claim) String() string {
return common.PointerString(m)
} | [
1.1539087295532227,
-0.7062081694602966,
0.19936782121658325,
-0.6768937110900879,
-0.0921715572476387,
1.0721923112869263,
-0.058642707765102386,
-0.7822965383529663,
-0.026890499517321587,
-0.0006327395094558597,
1.3053438663482666,
1.1732444763183594,
-0.6744434237480164,
-0.29413023591... |
func (m Principal) String() string {
return common.PointerString(m)
} | [
0.6050461530685425,
-1.0111311674118042,
0.1247299313545227,
-0.6655547618865967,
-0.6497085094451904,
1.7513686418533325,
0.7179999947547913,
-1.444084882736206,
-0.3544212281703949,
0.15260551869869232,
1.0332555770874023,
0.9742023348808289,
-1.7697001695632935,
-0.7529644966125488,
0... |
func GoAndConnect(module string, data interface{}, position string) {
if module == position {
fmt.Println("CONNECT", data)
} else {
fmt.Println("GOTO", module)
}
} | [
-0.3638070225715637,
-0.6702590584754944,
0.4230434000492096,
-0.4025264084339142,
-0.3987230658531189,
0.48925891518592834,
-0.7956970930099487,
-0.5704344511032104,
-0.8255584239959717,
0.7899499535560608,
-0.555454671382904,
0.7958968877792358,
-0.5180595517158508,
0.8168656826019287,
... |
func Scan(target string, options model.Options, sid string) (model.Result, error) {
var scanResult model.Result
options.ScanResult = scanResult
scanResult.StartTime = time.Now()
if !(options.Silence || options.NoSpinner) {
time.Sleep(1 * time.Second) // Waiting log
s.Prefix = " "
s.Suffix = ""
if !options.N... | [
-0.4658392667770386,
0.06084108725190163,
0.835924506187439,
0.6419370770454407,
-1.0563973188400269,
0.0840655192732811,
0.20466271042823792,
-0.2932395339012146,
0.29602643847465515,
-0.008794254623353481,
-0.2617589831352234,
0.5856736302375793,
0.2423543483018875,
0.9579991102218628,
... |
func CodeView(resbody, pattern string) string {
var code string
if resbody == "" {
return ""
}
bodyarr := strings.Split(resbody, "\n")
for bk, bv := range bodyarr {
if strings.Contains(bv, pattern) {
max := len(bv)
if max > 80 {
index := strings.Index(bv, pattern)
if index < 20 {
code = code... | [
0.2189370095729828,
-0.1409686654806137,
0.935980498790741,
-1.3647898435592651,
-0.6404410600662231,
-0.508131206035614,
0.33475974202156067,
-0.4291459321975708,
0.17702710628509521,
-0.3622989356517792,
0.4781617820262909,
0.2325619012117386,
-0.21605588495731354,
-0.1739223152399063,
... |
func (b *HttpRequest) Response() (*http.Response, error) {
return b.getResponse()
} | [
0.17033901810646057,
-0.8385970592498779,
0.01244559045881033,
1.313950777053833,
0.3617144525051117,
-0.5388588905334473,
0.5539334416389465,
-0.6510520577430725,
0.9313194155693054,
-0.7230204939842224,
-0.09861184656620026,
0.17528481781482697,
-0.6247901916503906,
-0.10918248444795609,... |
func (a *App) deleteCategory(w http.ResponseWriter, req *http.Request) {
enableCors(&w)
vars := mux.Vars(req)
// id, err := strconv.Atoi(vars["category_id"])
// if err != nil {
// respondWithError(w, http.StatusBadRequest, "Invalid category ID")
// return
// }
id := vars["category_id"]
c := category{Catego... | [
-0.014766098000109196,
0.3264511227607727,
0.979087233543396,
1.1291931867599487,
0.45900025963783264,
0.17145830392837524,
0.7843542098999023,
-0.07662035524845123,
-0.022997146472334862,
0.04787445068359375,
0.6528270244598389,
-0.23314142227172852,
0.19233712553977966,
1.830340385437011... |
func NewScanner(src []byte) *Scanner {
b := bytes.NewBuffer(src)
s := &Scanner{
buf: b,
src: src,
}
// line number starts at 1
s.srcPos.Line = 1
s.ch = ' '
return s
} | [
-0.09956740587949753,
-1.0476802587509155,
0.327164888381958,
-0.008606359362602234,
-1.4715312719345093,
-0.14607298374176025,
-0.4316287934780121,
0.2400982528924942,
0.8212783932685852,
-1.1675012111663818,
-0.6485703587532043,
0.21564894914627075,
-0.1962953507900238,
0.776595294475555... |
func (s *Scanner) next() (rune, error) {
r, size, err := s.buf.ReadRune()
if err != nil {
s.srcPos.Column++
s.srcPos.Offset += s.lastCharLen
s.lastCharLen = size
s.ch = eof
return eof, nil
}
s.prevPos = s.srcPos
s.srcPos.Column++
s.srcPos.Offset += s.lastCharLen
s.lastCharLen = size
s.ch = r
swi... | [
0.22512729465961456,
-0.30827462673187256,
0.6905021667480469,
-0.36037588119506836,
-1.1954405307769775,
-1.0147805213928223,
-0.23239286243915558,
0.2839576303958893,
-0.014968150295317173,
-0.5350409150123596,
0.050133053213357925,
0.3484666645526886,
0.004421234130859375,
-0.3067897558... |
func (s *Scanner) unread() {
if err := s.buf.UnreadRune(); err != nil {
panic(err) // this is user fault, we should catch it
}
s.srcPos = s.prevPos // put back last position
} | [
1.0255625247955322,
-0.6925801038742065,
0.413472056388855,
-1.1087268590927124,
-0.23462702333927155,
0.3898473083972931,
0.9953606724739075,
0.39086663722991943,
0.623238742351532,
-1.2052383422851562,
0.6529418230056763,
0.24873001873493195,
-0.1362982541322708,
-0.44857004284858704,
... |
func (s *Scanner) peek() rune {
peek, _, err := s.buf.ReadRune()
if err != nil {
return eof
}
s.buf.UnreadRune()
return peek
} | [
0.5446406006813049,
-0.09962094575166702,
0.6544910669326782,
-0.5188344120979309,
-0.40243226289749146,
-0.6333239674568176,
0.36684516072273254,
-0.5444170236587524,
-0.6446428298950195,
-0.48714080452919006,
0.6036226749420166,
0.6858493685722351,
0.40086492896080017,
-0.052950486540794... |
func (s *Scanner) Scan() (RichToken, error) {
s.skipWhitespace()
var lit string
var tok Token
if s.ch == eof {
return RichToken{
pos: s.srcPos,
tok: EOF,
lit: "EOF",
}, nil
}
switch ch := s.ch; {
// if letter, determine if it is a literal name token (true, false, null)
case isLetter(ch):
richT... | [
-0.10574589669704437,
-0.18714118003845215,
1.0310848951339722,
-0.01766001433134079,
-1.0852669477462769,
-0.6650356650352478,
-0.21864646673202515,
-0.09766331315040588,
-0.2826906144618988,
-0.504600465297699,
-0.3692505657672882,
0.7158405780792236,
0.46978408098220825,
-0.415473878383... |
func (s *Scanner) scanIdentifier() (RichToken, error) {
offs := s.srcPos.Offset
startCol := s.srcPos.Column
ch := s.ch
var err error
for isLetter(ch) {
ch, err = s.next()
if err != nil {
return RichToken{}, err
}
}
lit := string(s.src[offs:s.srcPos.Offset])
var tok Token
switch lit {
case "true":... | [
-0.8197261095046997,
-0.851418137550354,
0.31220492720603943,
-0.43528977036476135,
-1.3364931344985962,
-0.11569327116012573,
-0.3013652563095093,
0.323424756526947,
0.42906418442726135,
0.2869965732097626,
-1.155620813369751,
0.2626151740550995,
-0.20932093262672424,
0.020116664469242096... |
func (s *Scanner) scanString() (RichToken, error) {
// opening demarcation " already consumed
ch, err := s.next()
if err != nil {
return RichToken{}, nil
}
startPos := s.srcPos
for {
if ch == eof {
return RichToken{}, fmt.Errorf("Column %d, Line %d: String not terminated",
s.srcPos.Column, s.srcPos.... | [
-0.1955469846725464,
-0.7646949887275696,
0.5769883394241333,
-0.412433922290802,
-0.9100589156150818,
-0.3838973343372345,
-0.21423451602458954,
0.26631879806518555,
-0.04925839230418205,
-0.22005370259284973,
0.08360353857278824,
0.42751041054725647,
-0.008082273416221142,
-0.20110540091... |
func (s *Scanner) scanNumber() (RichToken, error) {
offs := s.srcPos.Offset
startCol := s.srcPos.Column
tok := NUMBER
ch := s.ch
var err error
// if ch is -, move on to next digit
if ch == '-' {
ch, err = s.next()
}
if ch == '0' {
if isDecimal(s.peek()) {
return RichToken{}, fmt.Errorf("Column %d, Lin... | [
-0.6028376817703247,
-0.3716162145137787,
0.9740627408027649,
0.34688887000083923,
-1.2014402151107788,
-0.6639418005943298,
0.2783799171447754,
0.29454323649406433,
0.6213266849517822,
-0.9986780881881714,
-0.05466623976826668,
0.24966293573379517,
0.3215857744216919,
0.7069804072380066,
... |
func isLetter(ch rune) bool {
return 'a' <= ch && ch <= 'z' || 'A' <= ch && ch <= 'Z' || ch == '_' || ch >= 0x80 && unicode.IsLetter(ch)
} | [
-1.3212080001831055,
-0.2978057265281677,
0.6221070289611816,
-0.8751394152641296,
-1.4108296632766724,
0.8150131702423096,
-0.4424208700656891,
-0.7155116200447083,
0.5621944069862366,
0.05952652916312218,
-0.8136268258094788,
0.6774047613143921,
-0.08499252796173096,
1.0996912717819214,
... |
func isDecimal(ch rune) bool {
return '0' <= ch && ch <= '9'
} | [
-0.04295717179775238,
-1.0139381885528564,
0.4716457426548004,
0.4486554265022278,
-0.05681544169783592,
-0.04159810021519661,
-0.6889463067054749,
-0.38163867592811584,
-0.19550283253192902,
-0.2663780152797699,
-0.31061357259750366,
0.49145403504371643,
-0.2397085577249527,
0.19751019775... |
func (s *Scanner) skipWhitespace() {
for s.ch == '\u0009' || s.ch == '\u000A' || s.ch == '\u000D' || s.ch == '\u0020' {
s.next()
}
} | [
-0.7505210041999817,
-0.2507008910179138,
0.5588459372520447,
-1.0777322053909302,
-0.6333543658256531,
-0.02017069049179554,
0.6501744985580444,
-1.034075379371643,
0.6471396088600159,
-0.30123013257980347,
-0.16170360147953033,
0.11344056576490402,
-0.5375156402587891,
0.9659214019775391... |
func newWrappedSet(encapsulated Set, immutable bool) DependentSet {
res := new(setWrapper)
res.SetDerived = EmbeddedDependentSet(res)
res.encapsulated = encapsulated
res.immutable = immutable
return res
} | [
-0.6679207682609558,
-0.4385550618171692,
0.2571481466293335,
-0.31853634119033813,
-1.4070168733596802,
0.5021479725837708,
0.34734198451042175,
-0.36018821597099304,
-0.11236986517906189,
0.20510326325893402,
0.516243577003479,
0.9565532803535461,
-0.18320421874523163,
0.4245756268501282... |
func BenchmarkNativeFilterInt(b *testing.B) {
b.StopTimer()
var r []int
intSlice := GenerateIntSlice(1000)
target := intSlice[0]
b.StartTimer()
for n := 0; n < b.N; n++ {
r = make([]int, 0)
for _, val := range intSlice {
if val == target {
r = append(r, target)
}
}
}
intSliceResult = r
} | [
-0.5319054126739502,
0.19350844621658325,
0.47469136118888855,
-0.35662177205085754,
0.08319434523582458,
-1.0153138637542725,
-0.4138162136077881,
-0.9548973441123962,
-0.7514292597770691,
0.6683305501937866,
-0.1684538722038269,
0.9761504530906677,
-0.6654291152954102,
0.7807624340057373... |
func BenchmarkNativeFindInt(b *testing.B) {
b.StopTimer()
var r int
intSlice := GenerateIntSlice(1000)
middle := ((len(intSlice) - 1) / 2)
target := intSlice[middle]
b.StartTimer()
for n := 0; n < b.N; n++ {
for _, val := range intSlice {
if val == target {
r = target
break
}
}
}
intResult... | [
-0.5725639462471008,
-0.025293728336691856,
0.49072909355163574,
-0.4651610255241394,
0.12581579387187958,
-0.6749827861785889,
0.17343468964099884,
-1.110077977180481,
-0.7419946193695068,
0.4344794452190399,
0.3118404448032379,
0.5706753730773926,
-1.1116544008255005,
0.6981353163719177,... |
func BenchmarkNativeIncludesInt(b *testing.B) {
b.StopTimer()
var r bool
intSlice := GenerateIntSlice(1000)
middle := ((len(intSlice) - 1) / 2)
target := intSlice[middle]
b.StartTimer()
for n := 0; n < b.N; n++ {
for _, val := range intSlice {
if val == target {
r = true
break
}
}
}
boolRe... | [
0.39330005645751953,
0.5045550465583801,
0.48951083421707153,
-0.16836658120155334,
-0.2399052232503891,
-0.23771224915981293,
-0.2790365219116211,
-0.3796783983707428,
-0.15045222640037537,
0.22065916657447815,
-0.36351680755615234,
0.3280162215232849,
-1.0407135486602783,
0.7004989981651... |
func Execute() {
if err := RootCmd.Execute(); err != nil {
fmt.Println(err)
os.Exit(-1)
}
} | [
0.8391480445861816,
-0.6172013878822327,
0.864802896976471,
1.1661274433135986,
0.4894045293331146,
0.8786700963973999,
-0.15603986382484436,
0.1271195411682129,
-0.7696849703788757,
-0.3532147705554962,
0.6680493950843811,
0.1502797156572342,
-0.3891732692718506,
0.8089608550071716,
0.1... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.