text stringlengths 11 6.3k | embedding listlengths 768 768 |
|---|---|
func FromResult(value interface{}) Task {
return FromCompleted(value, nil)
} | [
0.5933302044868469,
0.13511179387569427,
0.28562015295028687,
0.9731127619743347,
-1.5824475288391113,
-0.4116571843624115,
0.8365455269813538,
-0.22025316953659058,
0.6481553316116333,
-0.21940943598747253,
-1.304849624633789,
-0.8076331615447998,
0.2602563500404358,
0.12703880667686462,
... |
func FromCompleted(value interface{}, err error) Task {
return &task{
err: err,
value: value,
done: true,
}
} | [
0.8465225100517273,
-0.51727694272995,
0.2695876955986023,
0.6107198596000671,
-1.655106782913208,
0.15476390719413757,
0.4494791030883789,
-0.003057458670809865,
0.29491743445396423,
-0.025066332891583443,
-0.855022132396698,
-0.8408351540565491,
0.9330424070358276,
-0.22279410064220428,
... |
func Run(delegate Delegate) Task {
t := create()
go func() {
defer close(t.errChannel)
defer close(t.valueChannel)
value, err := delegate()
if err != nil {
t.errChannel <- err
} else {
t.valueChannel <- value
}
}()
return t
} | [
0.33597326278686523,
0.5156847238540649,
0.647661030292511,
-0.598181962966919,
0.37224245071411133,
0.327353298664093,
-0.2275737076997757,
-0.3294088542461395,
-0.278304785490036,
-0.5991584658622742,
-0.7709478139877319,
0.4970797896385193,
0.13624656200408936,
0.4229047894477844,
0.1... |
func NewCustomerInformationRequest(requestId int, report bool, clear bool) *CustomerInformationRequest {
return &CustomerInformationRequest{RequestID: requestId, Report: report, Clear: clear}
} | [
-0.5291277766227722,
-0.2329128086566925,
0.030243560671806335,
0.41182026267051697,
-0.9358989596366882,
-0.17537261545658112,
-0.3363116979598999,
0.3142043352127075,
-0.29936522245407104,
-0.3757473826408386,
-0.012211468070745468,
-0.0509546659886837,
-0.4244130849838257,
0.54428994655... |
func NewCustomerInformationResponse(status CustomerInformationStatus) *CustomerInformationResponse {
return &CustomerInformationResponse{Status: status}
} | [
-0.20304788649082184,
-1.568773627281189,
-0.31590041518211365,
0.03941398859024048,
-0.9567216038703918,
-0.4116452932357788,
-0.16680161654949188,
0.8360705375671387,
0.06272061169147491,
0.06503434479236603,
-1.1198384761810303,
-0.9054315090179443,
-0.5018777251243591,
0.19700257480144... |
func (p *DefaultTokenGrouper) Group(tokens []*Token) [][2]*Token {
if len(tokens) == 0 {
return nil
}
pairTokens := make([][2]*Token, 0, len(tokens))
prevToken := tokens[0]
for _, tok := range tokens {
if prevToken == tok {
continue
}
pairTokens = append(pairTokens, [2]*Token{prevToken, tok})
prevTo... | [
-1.026015043258667,
0.3370826840400696,
0.5191802382469177,
-0.2506275475025177,
-0.5215859413146973,
-0.7737417221069336,
0.48377954959869385,
0.47220855951309204,
-0.22678036987781525,
0.1739746779203415,
-0.2508489787578583,
0.5395798087120056,
-0.5421397089958191,
0.5084149241447449,
... |
func NewToken(token string) *Token {
tok := Token{
Tok: token,
reEllipsis: reEllipsis,
reNumeric: reNumeric,
reInitial: reInitial,
reListNumber: reListNumber,
reAlpha: reAlpha,
reCoordinateSecondPart: reCoordinateSecondPart... | [
0.08220624178647995,
-1.1578699350357056,
0.22878968715667725,
-0.035420410335063934,
-0.3538634479045868,
-0.46561044454574585,
0.9387933015823364,
0.01076475065201521,
0.33122313022613525,
-1.650595784187317,
-1.1150351762771606,
0.837256669998169,
0.6743355393409729,
-0.4809351861476898... |
func (p *Token) String() string {
return fmt.Sprintf("<Token Tok: %q, SentBreak: %t, Abbr: %t, Position: %d>", p.Tok, p.SentBreak, p.Abbr, p.Position)
} | [
-0.33750614523887634,
-1.4320284128189087,
0.2521934509277344,
-0.8191555142402649,
-0.10708141326904297,
0.4414031505584717,
0.035891931504011154,
-0.6959733366966248,
-0.8007147312164307,
-0.38571831583976746,
-0.3994204103946686,
0.44577428698539734,
0.30196478962898254,
-0.790060639381... |
func getUpdates(r, tg, sn, ts *data.Signed) (
root, targets, snapshot, timestamp storage.MetaUpdate, err error) {
rs, tgs, sns, tss, err := testutils.Serialize(r, tg, sn, ts)
if err != nil {
return
}
root = storage.MetaUpdate{
Role: data.CanonicalRootRole,
Version: 1,
Data: rs,
}
targets = storag... | [
-0.8462724089622498,
-0.20912301540374756,
0.4880863428115845,
-0.08894087374210358,
0.41354137659072876,
-0.7776501178741455,
-0.422753244638443,
-0.024422315880656242,
0.47056254744529724,
0.20449420809745789,
-0.5913658142089844,
0.18825121223926544,
0.12646333873271942,
-0.594530045986... |
func TestValidateRootNoTimestampKey(t *testing.T) {
_, oldRepo, cs := testutils.EmptyRepo()
r, tg, sn, ts, err := testutils.Sign(oldRepo)
assert.NoError(t, err)
root, targets, snapshot, _, err := getUpdates(r, tg, sn, ts)
assert.NoError(t, err)
store := storage.NewMemStorage()
updates := []storage.MetaUpdate{r... | [
-0.23036359250545502,
-0.013004082255065441,
0.729986846446991,
0.24667607247829437,
0.15414588153362274,
0.32823503017425537,
-0.11076472699642181,
-0.09970012307167053,
0.18963027000427246,
-0.17104420065879822,
-0.18484093248844147,
-0.011928816325962543,
-0.1504744291305542,
0.19436341... |
func TestValidateRootInvalidTimestampKey(t *testing.T) {
_, oldRepo, cs := testutils.EmptyRepo()
r, tg, sn, ts, err := testutils.Sign(oldRepo)
assert.NoError(t, err)
root, targets, snapshot, _, err := getUpdates(r, tg, sn, ts)
assert.NoError(t, err)
store := storage.NewMemStorage()
updates := []storage.MetaUpd... | [
-0.1220560222864151,
-0.1498563587665558,
0.7272332906723022,
0.3733128309249878,
-0.14015871286392212,
0.4830399453639984,
-0.1643170863389969,
-0.24835124611854553,
-0.22835688292980194,
-0.04106678441166878,
-0.29328417778015137,
0.27324193716049194,
-0.3002224266529083,
0.5521510243415... |
func TestValidateRootInvalidTimestampThreshold(t *testing.T) {
kdb, oldRepo, cs := testutils.EmptyRepo()
tsRole, ok := oldRepo.Root.Signed.Roles[data.CanonicalTimestampRole]
assert.True(t, ok)
tsRole.Threshold = 2
r, tg, sn, ts, err := testutils.Sign(oldRepo)
assert.NoError(t, err)
root, targets, snapshot, _, e... | [
0.45259740948677063,
-0.2666741609573364,
0.7134276628494263,
0.19401755928993225,
-0.18154789507389069,
0.4983263611793518,
-0.4538801908493042,
-0.09437915682792664,
-0.11882034689188004,
-0.22350412607192993,
-0.3312300145626068,
-0.03402867913246155,
0.4299715459346771,
0.0360152944922... |
func TestValidateRootInvalidZeroThreshold(t *testing.T) {
for role := range data.ValidRoles {
kdb, oldRepo, cs := testutils.EmptyRepo()
tsRole, ok := oldRepo.Root.Signed.Roles[role]
assert.True(t, ok)
tsRole.Threshold = 0
r, tg, sn, ts, err := testutils.Sign(oldRepo)
assert.NoError(t, err)
root, targets... | [
0.5846980810165405,
-0.52322918176651,
0.6298866271972656,
0.11966947466135025,
-0.06109621375799179,
0.06363070756196976,
-0.34381791949272156,
0.18421570956707,
-0.15599198639392853,
-0.5408374667167664,
-0.06847823411226273,
0.16300678253173828,
-0.022110022604465485,
0.6991152763366699... |
func TestValidateRootRoleMissing(t *testing.T) {
kdb, repo, cs := testutils.EmptyRepo()
store := storage.NewMemStorage()
delete(repo.Root.Signed.Roles, "root")
r, tg, sn, ts, err := testutils.Sign(repo)
assert.NoError(t, err)
root, targets, snapshot, timestamp, err := getUpdates(r, tg, sn, ts)
assert.NoError(t... | [
0.5071057677268982,
-0.2800504267215729,
0.6936865448951721,
0.24088416993618011,
0.34205031394958496,
0.5686531066894531,
-0.505683183670044,
-0.23021377623081207,
0.2271825224161148,
-0.015262924134731293,
-0.32802703976631165,
0.24814850091934204,
-0.48671755194664,
0.6753870844841003,
... |
func TestValidateRootSigMissing(t *testing.T) {
kdb, repo, cs := testutils.EmptyRepo()
store := storage.NewMemStorage()
delete(repo.Root.Signed.Roles, "snapshot")
r, tg, sn, ts, err := testutils.Sign(repo)
assert.NoError(t, err)
r.Signatures = nil
root, targets, snapshot, timestamp, err := getUpdates(r, tg, ... | [
0.3140253722667694,
-0.31393179297447205,
0.6633762717247009,
0.5097447037696838,
0.36030030250549316,
0.4585147798061371,
-0.11650693416595459,
-0.0547267384827137,
0.5265465378761292,
-0.11682859808206558,
-0.6507361531257629,
-0.2474583387374878,
-0.39627140760421753,
0.7944023609161377... |
func TestValidateRootCorrupt(t *testing.T) {
kdb, repo, cs := testutils.EmptyRepo()
store := storage.NewMemStorage()
r, tg, sn, ts, err := testutils.Sign(repo)
assert.NoError(t, err)
root, targets, snapshot, timestamp, err := getUpdates(r, tg, sn, ts)
assert.NoError(t, err)
// flip all the bits in the first by... | [
0.37259745597839355,
-0.14277788996696472,
0.8076534271240234,
0.7006434798240662,
0.1300637573003769,
0.2710786461830139,
-0.18862946331501007,
-0.01495499350130558,
0.39765992760658264,
-0.07688663899898529,
0.020462263375520706,
0.6171964406967163,
-0.5436832904815674,
0.149613395333290... |
func TestValidateRootModifiedSize(t *testing.T) {
kdb, repo, cs := testutils.EmptyRepo()
store := storage.NewMemStorage()
r, tg, sn, ts, err := testutils.Sign(repo)
assert.NoError(t, err)
// add another copy of the signature so the hash is different
r.Signatures = append(r.Signatures, r.Signatures[0])
root, t... | [
0.48400330543518066,
-0.024893466383218765,
0.8174774646759033,
0.4178161919116974,
-0.06858987361192703,
0.24986127018928528,
-0.12659132480621338,
-0.03714990243315697,
0.537500262260437,
-0.26964321732521057,
-0.5421205163002014,
0.6394098997116089,
-0.4718456268310547,
0.80541163682937... |
func TestValidateRootModifiedHash(t *testing.T) {
kdb, repo, cs := testutils.EmptyRepo()
store := storage.NewMemStorage()
r, tg, sn, ts, err := testutils.Sign(repo)
assert.NoError(t, err)
snap, err := data.SnapshotFromSigned(sn)
assert.NoError(t, err)
snap.Signed.Meta["root"].Hashes["sha256"][0] = snap.Signed.... | [
0.5478561520576477,
-0.4930792450904846,
0.8423357009887695,
0.8060553669929504,
-0.0022186741698533297,
0.17524227499961853,
-0.37609878182411194,
-0.18806646764278412,
0.47954845428466797,
-0.5606793761253357,
-0.34727466106414795,
0.5309166312217712,
-0.059360772371292114,
0.41930779814... |
func TestRenderNetworkMetricsDaemon(t *testing.T) {
g := NewGomegaWithT(t)
crd := NetworkMetricsDaemonConfig.DeepCopy()
config := &crd.Spec
disabled := true
config.DisableMultiNetwork = &disabled
fillDefaults(config, nil)
// disable MultusAdmissionController
objs, err := renderMultus(config, fakeBootstrapResu... | [
0.48109790682792664,
0.5533803105354309,
0.7989189624786377,
-0.5312026143074036,
0.18180716037750244,
0.965742826461792,
0.3360779285430908,
0.2984551787376404,
0.44721049070358276,
-0.9171144962310791,
-0.222045436501503,
-0.17293529212474823,
-0.3444584012031555,
0.7484591603279114,
0... |
func New(logger logger.Logger, imageProvider *imageprovider.ImageProvider) *Postprocessor {
return &Postprocessor{
logger: logger,
imageProvider: imageProvider,
}
} | [
-0.7630287408828735,
-0.8438891768455505,
0.28815972805023193,
-1.1392134428024292,
-1.673521876335144,
-1.0642539262771606,
-0.4446977376937866,
0.26356223225593567,
0.0373503603041172,
0.33019691705703735,
-0.5713886618614197,
0.3924980163574219,
0.11563614755868912,
0.767094075679779,
... |
func (postprocessor *Postprocessor) Convert(
pathProvider paths.Pather,
itemRoute route.Route,
files []*model.File,
html string) (convertedContent string, converterError error) {
// Thumbnails
imagePostProcessor := newImagePostprocessor(pathProvider, itemRoute, files, postprocessor.imageProvider)
html, imageCon... | [
-1.126251459121704,
0.0745122954249382,
0.5699712634086609,
0.11628055572509766,
-0.2232336550951004,
-0.5794821977615356,
0.20727604627609253,
0.2581172287464142,
-0.18347875773906708,
0.8113203644752502,
0.005057468079030514,
-0.5937668681144714,
-0.09791137278079987,
0.6182571053504944,... |
func NewClient(clientID, clientSecret string, debug bool) (*Client, error) {
// Create Authorization header from client ID & secret
authorization := "BASIC " + base64.StdEncoding.EncodeToString([]byte(clientID+":"+clientSecret))
client := Client{authorization: authorization, endpoint: "https://rest.mymobileapi.com/... | [
0.2645675539970398,
-0.9206417798995972,
0.4684213101863861,
0.4402516186237335,
-0.8008186221122742,
-0.2434053272008896,
-1.0131667852401733,
-0.7689632177352905,
0.13815224170684814,
-0.2012489140033722,
0.0715557262301445,
0.4237711429595947,
-0.707712709903717,
-0.7092161178588867,
... |
func (c *Client) Authenticate() error {
authResponse := struct {
Token string `json:"token"`
Schema string `json:"schema"`
ExpiresInMinutes int `json:"expiresInMinutes"`
}{}
_, err := c.get("Authentication", nil, &authResponse)
if err != nil {
return err
}
duration, err := time.P... | [
-0.5006319880485535,
0.07229523360729218,
0.5098629593849182,
-0.1643265187740326,
0.23683582246303558,
-0.6598132848739624,
-1.1213358640670776,
-0.1261088103055954,
0.027316473424434662,
0.1648535430431366,
-0.9591080546379089,
0.3147865831851959,
-0.2793998122215271,
-0.2430892735719680... |
func ParsPromTime(timestamp interface{}) time.Time {
ts := timestamp.(float64)
secs := int64(ts)
nsecs := int64((ts - float64(secs)) * 1e9)
t := time.Unix(secs, nsecs)
return t
} | [
0.9763191342353821,
-0.05181976407766342,
0.5638726949691772,
0.28521761298179626,
-0.3188497722148895,
-0.5684535503387451,
-0.6108890771865845,
-0.17205429077148438,
1.2078282833099365,
-0.28778374195098877,
-0.3509301543235779,
-0.5803276300430298,
-0.30469468235969543,
0.01335604395717... |
func (rs *RemoteChunkStore) AddTableFiles(ctx context.Context, req *remotesapi.AddTableFilesRequest) (*remotesapi.AddTableFilesResponse, error) {
logger := getReqLogger(rs.lgr, "AddTableFiles")
if err := ValidateAddTableFilesRequest(req); err != nil {
return nil, status.Error(codes.InvalidArgument, err.Error())
}
... | [
-1.0659682750701904,
0.007046866230666637,
0.7249112725257874,
-0.29793256521224976,
-0.2719660997390747,
0.21075446903705597,
-0.02712923288345337,
-0.2891901731491089,
-0.42269548773765564,
0.0060504889115691185,
-0.4661634564399719,
-0.3854234218597412,
-0.8041325211524963,
0.1068281307... |
func ConvertVideo(sourcePath, destinationPath string, width, height int) (string, string, error) {
log.Printf("converting video %v to %vx%v at %v", sourcePath, width, height, destinationPath)
arguments := make([]string, 0)
//if runtime.GOOS != "darwin" {
// arguments = append(arguments, "-f")
//}
//arguments =... | [
0.03076094575226307,
0.22494862973690033,
0.9367272853851318,
0.6367838978767395,
-0.6063486337661743,
-1.185671091079712,
-0.31986138224601746,
-0.08869258314371109,
0.010014067403972149,
0.19336256384849548,
0.018826980143785477,
0.42401614785194397,
0.29509860277175903,
0.71137946844100... |
func ConvertImage(sourcePath, destinationPath string, width, height int) (string, string, error) {
log.Printf("converting image %v to %vx%v at %v", sourcePath, width, height, destinationPath)
return common.RunCommand(
"convert",
"-resize",
fmt.Sprintf("%vX%v", width, height),
sourcePath,
destinationPath,
... | [
-0.8427689671516418,
0.6080416440963745,
0.7445003390312195,
-0.31172460317611694,
0.4006673991680145,
-0.44021910429000854,
-0.8708943724632263,
-0.11755073815584183,
-0.6043840646743774,
0.5853758454322815,
0.6354929208755493,
-0.8231334686279297,
0.35303789377212524,
0.2119821012020111,... |
func (m Message) Text() string {
return m.Message
} | [
0.22432011365890503,
-0.3160560727119446,
-0.02444370836019516,
0.559288740158081,
-0.2767198979854584,
0.5721310973167419,
0.1943693906068802,
-0.8773349523544312,
-0.08267538249492645,
0.20944973826408386,
0.48826152086257935,
0.42711037397384644,
-1.31681489944458,
0.056893229484558105,... |
func (m Message) Channel() string {
return m.ChannelID
} | [
0.16920366883277893,
-0.48477065563201904,
-0.053767863661050797,
-0.2017773985862732,
-0.05372193828225136,
1.447559118270874,
0.7135491967201233,
0.2278035581111908,
0.45209768414497375,
-0.2128688544034958,
1.0505229234695435,
1.8661223649978638,
-0.6926223635673523,
0.8009064197540283,... |
func (m Message) User() string {
return m.UserID
} | [
0.04456181451678276,
-1.0552101135253906,
0.13520698249340057,
0.4159661531448364,
-0.3666473925113678,
0.8412850499153137,
1.2169218063354492,
-0.5213509202003479,
0.17651842534542084,
-0.9295727014541626,
0.04838455468416214,
0.6021376252174377,
-0.1894298940896988,
0.8411726355552673,
... |
func (m Message) IsMessage() bool {
return true
} | [
-0.6979625821113586,
0.05685512349009514,
0.6277503967285156,
1.0664619207382202,
0.47175875306129456,
0.00942079909145832,
-0.251094788312912,
0.24696986377239227,
0.9417042136192322,
-0.12006138265132904,
0.149976447224617,
-0.1817575842142105,
-2.168198585510254,
1.2977240085601807,
-... |
func (m Message) IsFrom(user string) bool {
return m.UserID == user
} | [
0.6509301662445068,
-0.7106547951698303,
0.07564728707075119,
0.9056347608566284,
-0.5099972486495972,
0.6326367259025574,
0.019495410844683647,
-0.6703909039497375,
0.6740553379058838,
-0.08654551953077316,
0.05362625792622566,
1.1627839803695679,
-0.6446640491485596,
0.8527749180793762,
... |
func (m *Message) SetText(text string) {
m.Message = text
} | [
0.5183356404304504,
0.720952570438385,
0.02265496365725994,
0.959878146648407,
-0.08555664867162704,
0.49536219239234924,
-0.2510718107223511,
-0.045611560344696045,
0.16999448835849762,
0.11525607109069824,
0.005201584193855524,
0.7215598821640015,
-1.447373390197754,
0.6535614132881165,
... |
func (m *Message) StripMention(user string) string {
prefix := "<@" + user + "> "
text := m.Text()
if strings.HasPrefix(text, prefix) {
return text[len(prefix):len(text)]
}
return text
} | [
0.23939339816570282,
-0.15630340576171875,
0.34479662775993347,
-0.14418111741542816,
-1.5564078092575073,
0.3530113995075226,
0.6665911078453064,
0.7657846212387085,
0.024498023092746735,
0.37752220034599304,
0.4709150791168213,
0.9212523698806763,
-1.3961808681488037,
0.43591469526290894... |
func (m *Message) StripLinkMarkup() string {
re := regexp.MustCompile("<(.*?)>")
result := re.FindAllStringSubmatch(m.Text(), -1)
text := m.Text()
var link string
for _, c := range result {
link = c[len(c)-1]
// Done change Channel, User or Specials tags
if link[:2] == "#C" || link[:2] == "@U" ||... | [
-0.4437885582447052,
-0.6490035653114319,
0.6956610083580017,
-0.2603192925453186,
-0.5033931136131287,
-0.5960605144500732,
0.30031394958496094,
1.6225799322128296,
0.05139094591140747,
-0.5253363847732544,
0.4636686146259308,
0.2200043499469757,
-0.919206440448761,
0.04114057496190071,
... |
func (m Message) IsHelpRequest() bool {
return strings.HasSuffix(m.Message, "help") || strings.HasPrefix(m.Message, "help")
} | [
-0.3213472366333008,
0.12247035652399063,
0.5684351921081543,
0.7651767730712891,
-0.08215220272541046,
-0.21851259469985962,
-0.5894204378128052,
-1.083182454109192,
0.41880953311920166,
0.5408090353012085,
1.2549222707748413,
0.43248942494392395,
-0.13133428990840912,
1.3542333841323853,... |
func (m Message) IsDirectMessage() bool {
return strings.HasPrefix(m.ChannelID, "D")
} | [
-0.108768992125988,
-0.15609629452228546,
0.7196993827819824,
-0.8159803748130798,
0.7315557599067688,
0.6628735661506653,
0.18776965141296387,
-0.9110357761383057,
0.16417206823825836,
0.06763852387666702,
0.30972233414649963,
0.7660490274429321,
-0.8877097964286804,
1.4046802520751953,
... |
func (m Message) IsMentionFor(user string) bool {
return strings.HasPrefix(m.OriginalMessage, "<@"+user+">")
} | [
0.3855762481689453,
0.02758830040693283,
0.39258506894111633,
0.21039259433746338,
-0.8830670714378357,
-0.045781396329402924,
0.016345100477337837,
0.09645716845989227,
-0.5441529750823975,
0.02219180390238762,
0.48526620864868164,
1.0747863054275513,
-0.4241449236869812,
1.69163656234741... |
func (m Message) IsRelevantFor(user string) bool {
return m.IsMessage() && !m.IsFrom(user) && (m.IsDirectMessage() || m.IsMentionFor(user))
} | [
-0.08024254441261292,
0.35070496797561646,
0.4434089660644531,
-0.0989362895488739,
-0.30249881744384766,
0.3037514090538025,
0.2343733310699463,
-0.05717320740222931,
-0.21930086612701416,
-0.587157130241394,
0.43612390756607056,
0.226261705160141,
-0.5898872017860413,
1.8458380699157715,... |
func SetDatum(ctx context.Context, tx *Tx, p *Participant, key string, val string, isAppend bool) (*Datum, error) {
existing, err := p.QueryData().
Where(datum.And(datum.Current(true), datum.KeyEQ(key))).
Order(Asc(datum.FieldIndex)).
All(ctx)
if err != nil && !IsNotFound(err) {
return nil, errors.Wrap(err, "... | [
-0.6529794931411743,
-0.11636898666620255,
1.1529850959777832,
-0.42503219842910767,
0.15130387246608734,
0.28354373574256897,
0.19625328481197357,
0.2338339388370514,
0.32368311285972595,
0.11581733077764511,
-0.021797867491841316,
0.21656540036201477,
-0.5654683113098145,
-0.331964820623... |
func NewPutOperation(key string, value interface{}) *PutOperation {
return &PutOperation{
baseOperation: newBaseOperation(
model.TypeOfOperation_MAP_PUT,
nil,
&putBody{
Key: key,
Value: value,
},
),
}
} | [
-1.1950441598892212,
0.10719583928585052,
0.554799497127533,
0.1761740893125534,
-1.7653611898422241,
-0.6573989391326904,
0.5629725456237793,
-0.22892291843891144,
0.19728673994541168,
1.401317834854126,
-0.25067806243896484,
-0.9395369291305542,
-0.626696765422821,
-0.8498417735099792,
... |
func NewRemoveOperation(key string) *RemoveOperation {
return &RemoveOperation{
baseOperation: newBaseOperation(
model.TypeOfOperation_MAP_REMOVE,
nil,
&removeBody{
Key: key,
},
),
}
} | [
-1.4533888101577759,
-0.21329078078269958,
0.5955626368522644,
0.6607010960578918,
-1.728743314743042,
-1.0977730751037598,
0.41303855180740356,
0.12891890108585358,
0.7621262669563293,
1.1069802045822144,
-0.8548951745033264,
-1.8746097087860107,
-0.32025137543678284,
-0.485873281955719,
... |
func New(mode string, bus embd.I2CBus) *BH1750FVI {
switch mode {
case High:
return &BH1750FVI{Bus: bus, i2cAddr: sensorI2cAddr, operationCode: highResOpCode, Poll: pollDelay}
case High2:
return &BH1750FVI{Bus: bus, i2cAddr: sensorI2cAddr, operationCode: highResMode2OpCode, Poll: pollDelay}
default:
return &B... | [
-0.5509462952613831,
-0.8773589134216309,
0.3287280201911926,
0.5298020243644714,
-0.2537778317928314,
-0.361776202917099,
0.28624269366264343,
-0.06526382267475128,
-0.8069912195205688,
-0.1601218283176422,
-0.21649692952632904,
0.08173779398202896,
-0.1082153469324112,
0.1378516852855682... |
func NewHighMode(bus embd.I2CBus) *BH1750FVI {
return New(High, bus)
} | [
0.019370989874005318,
-0.479281485080719,
0.2270064651966095,
1.4996591806411743,
-0.39297810196876526,
-0.06320720911026001,
-0.2600076496601105,
0.20647336542606354,
-0.5589932799339294,
-0.4262431263923645,
-1.1450634002685547,
0.5048509240150452,
-0.5237332582473755,
1.0024757385253906... |
func NewHigh2Mode(bus embd.I2CBus) *BH1750FVI {
return New(High2, bus)
} | [
-0.05101500079035759,
-1.257262945175171,
0.24170763790607452,
1.686586856842041,
-0.6682212352752686,
-0.17599014937877655,
-0.43797314167022705,
0.0565437413752079,
-1.1784089803695679,
-0.6427711844444275,
-1.1244100332260132,
0.40556344389915466,
-0.07681718468666077,
1.193323612213134... |
func (d *BH1750FVI) Lighting() (float64, error) {
select {
case lighting := <-d.lightingReadings:
return lighting, nil
default:
return d.measureLighting()
}
} | [
0.28814440965652466,
0.6143946051597595,
0.31916800141334534,
0.2741531431674957,
0.05885857343673706,
-0.46619826555252075,
0.36450350284576416,
0.09599727392196655,
0.4486066401004791,
-0.3798847198486328,
0.7511340975761414,
-0.8699332475662231,
-0.8553404808044434,
0.894804060459137,
... |
func (d *BH1750FVI) Run() {
go func() {
d.quit = make(chan bool)
timer := time.Tick(time.Duration(d.Poll) * time.Millisecond)
var lighting float64
for {
select {
case d.lightingReadings <- lighting:
case <-timer:
l, err := d.measureLighting()
if err == nil {
lighting = l
}
if e... | [
-0.5576563477516174,
0.5182684063911438,
0.6741324663162231,
-0.04146428778767586,
0.16036872565746307,
0.13798828423023224,
0.7599120140075684,
-0.08270429074764252,
-0.10817871987819672,
0.0945281907916069,
0.20690231025218964,
-0.3242681324481964,
-0.6599055528640747,
1.2449955940246582... |
func NewClient(key, secret string) (cl *Client, err error) {
cl = &Client{
conn: &http.Client{},
env: newEnvironment(),
}
if key != "" {
cl.env.apiKey = key
cl.env.apiSecret = secret
}
return cl, nil
} | [
-0.16556774079799652,
-0.6695594787597656,
0.4612964391708374,
-0.040413498878479004,
-0.0835767313838005,
0.23185496032238007,
-0.6341337561607361,
0.4078391194343567,
-0.8272490501403809,
0.4044225513935089,
-0.30324795842170715,
0.5552666783332825,
-0.24773980677127838,
-0.3839023113250... |
func (cl *Client) TestAuthentication() (err error) {
// Test secet key by requesting User information
_, err = cl.GetInfo()
if err != nil {
err = fmt.Errorf("Authenticate: " + err.Error())
return err
}
return nil
} | [
-0.3914457857608795,
0.1573830246925354,
0.1938396543264389,
0.913345992565155,
0.42733532190322876,
0.1384582370519638,
1.140411615371704,
-0.9265772700309753,
-0.21390223503112793,
0.07494218647480011,
-0.36241888999938965,
-0.0629570260643959,
-0.792300820350647,
-0.7141289710998535,
... |
func NewAPI(port int, authKey string, zone string, storage Storage) *API {
return &API{port: port, authKey: authKey, zone: zone, storage: storage}
} | [
0.15460845828056335,
-1.0033619403839111,
0.22284993529319763,
1.1470565795898438,
-0.3909607529640198,
0.4222958981990814,
-0.19272813200950623,
-0.0726824700832367,
-0.20613287389278412,
0.37774813175201416,
-0.13852326571941376,
0.37672266364097595,
-0.3343178927898407,
-0.9005918502807... |
func (a *API) Start() {
a.router = mux.NewRouter()
a.router.HandleFunc("/ddns/{host}", a.UpdateDDNSRecordEndpoint).Methods("PUT")
log.Printf("Starting API at %d\n", a.port)
err := http.ListenAndServe(fmt.Sprintf(":%d", a.port), a.router)
if err != nil {
log.Fatalf("Failed to start API listener: %s\n ", err)
}
... | [
-0.290077269077301,
-0.4771004319190979,
0.3879309892654419,
-0.911885678768158,
0.7245978713035583,
0.005631294567137957,
-0.08610650151968002,
0.9599900841712952,
-0.5702277421951294,
-0.0598110631108284,
-0.44499409198760986,
1.398206353187561,
0.02929988130927086,
0.27750149369239807,
... |
func (graph *Graph) IDToName(id int64) (string, bool) {
for name, info := range graph.nameToInfo {
if info.ID == id {
return name, true
}
}
return "", false
} | [
-1.0993255376815796,
-0.3506465256214142,
0.8159056305885315,
-0.6825401782989502,
-0.9740551710128784,
-0.10086723417043686,
-0.257734477519989,
-1.2769620418548584,
0.18585807085037231,
1.1388578414916992,
-1.2620906829833984,
-0.5664125084877014,
0.2805464267730713,
-0.21118326485157013... |
func (graph *Graph) NameToID(name string) (int64, bool) {
info, ok := graph.nameToInfo[name]
return info.ID, ok
} | [
-0.3873665928840637,
-0.3362864553928375,
0.6951377987861633,
-0.6763352155685425,
-0.7195765972137451,
0.18248607218265533,
0.007436563726514578,
-0.9222828149795532,
0.37303704023361206,
1.3610703945159912,
-1.6770179271697998,
-0.400650292634964,
-0.8279865980148315,
0.00169548881240189... |
func (r *ProtocolIncus) GetNetworkACLNames() ([]string, error) {
if !r.HasExtension("network_acl") {
return nil, fmt.Errorf(`The server is missing the required "network_acl" API extension`)
}
// Fetch the raw URL values.
urls := []string{}
baseURL := "/network-acls"
_, err := r.queryStruct("GET", baseURL, nil,... | [
-0.6322935223579407,
0.735347330570221,
0.07488511502742767,
0.30450937151908875,
-0.3248482644557953,
0.09101619571447372,
-0.9522976279258728,
-1.026215672492981,
0.023289205506443977,
0.36261335015296936,
-0.8704177737236023,
-0.16250112652778625,
-0.6866166591644287,
0.3269667029380798... |
func (r *ProtocolIncus) GetNetworkACLs() ([]api.NetworkACL, error) {
if !r.HasExtension("network_acl") {
return nil, fmt.Errorf(`The server is missing the required "network_acl" API extension`)
}
acls := []api.NetworkACL{}
// Fetch the raw value.
_, err := r.queryStruct("GET", "/network-acls?recursion=1", nil,... | [
-0.9329213500022888,
0.7223845720291138,
0.2600180208683014,
1.2061913013458252,
-0.2701881229877472,
-0.2296118140220642,
-0.13218918442726135,
-1.1045843362808228,
0.1385221630334854,
-0.10045614093542099,
-0.5100700855255127,
0.040598735213279724,
-1.122990369796753,
0.3523930013179779,... |
func (r *ProtocolIncus) GetNetworkACL(name string) (*api.NetworkACL, string, error) {
if !r.HasExtension("network_acl") {
return nil, "", fmt.Errorf(`The server is missing the required "network_acl" API extension`)
}
acl := api.NetworkACL{}
// Fetch the raw value.
etag, err := r.queryStruct("GET", fmt.Sprintf(... | [
-1.0254260301589966,
0.0961189866065979,
0.727347195148468,
0.30964726209640503,
-0.8847727179527283,
-0.8455142378807068,
-0.11501733958721161,
-1.1083157062530518,
0.2679465115070343,
0.6786201596260071,
-0.5688099265098572,
-0.05768043175339699,
-0.2526361346244812,
0.283907949924469,
... |
func (r *ProtocolIncus) GetNetworkACLLogfile(name string) (io.ReadCloser, error) {
if !r.HasExtension("network_acl_log") {
return nil, fmt.Errorf(`The server is missing the required "network_acl_log" API extension`)
}
// Prepare the HTTP request
url := fmt.Sprintf("%s/1.0/network-acls/%s/log", r.httpBaseURL.Stri... | [
-0.2822589874267578,
0.48148974776268005,
0.8065155148506165,
-0.8152613639831543,
-0.9806938171386719,
0.18693041801452637,
-0.46410882472991943,
-1.0994713306427002,
-0.9574790000915527,
0.7283872961997986,
-0.014710729941725731,
0.6213722229003906,
-1.0561786890029907,
0.262862503528594... |
func (r *ProtocolIncus) CreateNetworkACL(acl api.NetworkACLsPost) error {
if !r.HasExtension("network_acl") {
return fmt.Errorf(`The server is missing the required "network_acl" API extension`)
}
// Send the request.
_, _, err := r.query("POST", "/network-acls", acl, "")
if err != nil {
return err
}
return... | [
-0.9447036981582642,
0.40609800815582275,
0.32365354895591736,
0.4725259244441986,
-0.12176553905010223,
0.4499585032463074,
-0.021612627431750298,
-1.0254855155944824,
0.325216144323349,
0.11031770706176758,
-0.8304852843284607,
-0.4691658616065979,
-1.0066711902618408,
0.0359510071575641... |
func (r *ProtocolIncus) UpdateNetworkACL(name string, acl api.NetworkACLPut, ETag string) error {
if !r.HasExtension("network_acl") {
return fmt.Errorf(`The server is missing the required "network_acl" API extension`)
}
// Send the request.
_, _, err := r.query("PUT", fmt.Sprintf("/network-acls/%s", url.PathEsca... | [
-1.1390743255615234,
-0.31878742575645447,
0.2885728180408478,
-0.13578566908836365,
-1.054203748703003,
0.09008955955505371,
-0.002431836910545826,
-0.9666141867637634,
0.04228045046329498,
1.220568060874939,
-0.863347053527832,
-0.2510715126991272,
-0.7838538885116577,
-0.360354751348495... |
func (r *ProtocolIncus) RenameNetworkACL(name string, acl api.NetworkACLPost) error {
if !r.HasExtension("network_acl") {
return fmt.Errorf(`The server is missing the required "network_acl" API extension`)
}
// Send the request.
_, _, err := r.query("POST", fmt.Sprintf("/network-acls/%s", url.PathEscape(name)), ... | [
-0.3753587305545807,
0.09626968950033188,
0.40074262022972107,
-0.08489957451820374,
-0.6314894556999207,
0.007110167294740677,
-0.06103077530860901,
-0.8772888779640198,
-0.025155842304229736,
1.1725493669509888,
-0.8285833597183228,
0.1103031262755394,
-0.6739397048950195,
-0.21586354076... |
func (r *ProtocolIncus) DeleteNetworkACL(name string) error {
if !r.HasExtension("network_acl") {
return fmt.Errorf(`The server is missing the required "network_acl" API extension`)
}
// Send the request.
_, _, err := r.query("DELETE", fmt.Sprintf("/network-acls/%s", url.PathEscape(name)), nil, "")
if err != ni... | [
-0.5596187710762024,
0.39611825346946716,
0.3444882929325104,
0.31479915976524353,
-0.549164354801178,
-0.07501211762428284,
0.265129029750824,
-1.0990980863571167,
0.36267349123954773,
0.45127514004707336,
-0.7941175699234009,
-0.16385358572006226,
-0.8638192415237427,
0.22286458313465118... |
func (tpl *Template) ExecuteWriter(context Context, writer io.Writer) error {
buffer, err := tpl.execute(context)
if err != nil {
return err
}
l := buffer.Len()
n, err := buffer.WriteTo(writer)
if int(n) != l {
panic(fmt.Sprintf("error on writing template: n(%d) != buffer.Len(%d)", n, l))
}
if err != nil {... | [
-0.6856042146682739,
0.5139473080635071,
0.4035409092903137,
-0.37727874517440796,
0.9174302816390991,
-0.2768988013267517,
0.49810898303985596,
-0.16274908185005188,
-0.4269827604293823,
0.5954152345657349,
-0.6168676614761353,
-0.9273122549057007,
-0.20209844410419464,
0.0154561549425125... |
func (tpl *Template) ExecuteBytes(context Context) ([]byte, error) {
// Execute template
buffer, err := tpl.execute(context)
if err != nil {
return nil, err
}
return buffer.Bytes(), nil
} | [
-0.988909900188446,
0.5248181223869324,
0.6157753467559814,
-0.7380003333091736,
0.14364829659461975,
0.2585171163082123,
-0.6234066486358643,
-0.1663043200969696,
-0.2332727313041687,
0.822174072265625,
-0.6909529566764832,
-0.08762339502573013,
-1.0565228462219238,
0.04583002254366875,
... |
func (tpl *Template) Execute(context Context) (string, error) {
// Execute template
buffer, err := tpl.execute(context)
if err != nil {
return "", err
}
return buffer.String(), nil
} | [
-0.24570703506469727,
-0.46976137161254883,
0.6550725102424622,
-0.32753852009773254,
-0.35756081342697144,
0.3726535141468048,
-0.9218769669532776,
-0.8823519349098206,
-0.17806075513362885,
1.1598752737045288,
-0.4665159583091736,
-1.0359610319137573,
-0.695902943611145,
-0.7861994504928... |
func NewClient(prefix string, apiVersion string, version string,
token TokenHolder, t http.RoundTripper) *Client {
rt := ®istryRoundTripper{
DefaultRequestDoer: DefaultRequestDoer{
Client: &http.Client{
Transport: t,
Timeout: time.Minute,
},
Host: prefix,
},
apiVersion: apiVersion,
ver... | [
-0.40884312987327576,
-0.3561705946922302,
0.32655835151672363,
-0.4751364290714264,
-0.5531923174858093,
0.24874381721019745,
0.3183024525642395,
0.37378188967704773,
-0.303950697183609,
-0.0319211371243,
-0.21106231212615967,
0.76161789894104,
0.27217668294906616,
-0.5055635571479797,
... |
func NewClientWithRoundTripper(rt RoundTripper) *Client {
c := &Client{}
c.KeyPairs = &KeyPairsClient{client: rt}
c.Tokens = &TokensClient{client: rt}
c.Users = &UsersClient{client: rt}
c.Teams = &TeamsClient{client: rt}
c.Memberships = &MembershipsClient{client: rt}
c.Credentials = &Credentials{client: rt}
c.... | [
0.15938687324523926,
-1.3382104635238647,
0.6882957816123962,
-0.7337988018989563,
-1.2008161544799805,
0.05498509854078293,
0.1043950542807579,
-0.8496466279029846,
0.24895408749580383,
-0.04243924096226692,
0.043560490012168884,
0.38381245732307434,
-0.006431119050830603,
0.0197167713195... |
func (rt *registryRoundTripper) NewRequest(method, path string,
query *url.Values, body interface{}) (*http.Request, error) {
req, err := rt.DefaultRequestDoer.NewRequest(method, path, query, body)
if err != nil {
return nil, err
}
if tok := rt.holder.Token(); tok != "" {
req.Header.Set("Authorization", "Be... | [
-0.9350226521492004,
0.0818905308842659,
0.4234296381473541,
0.022871291264891624,
0.23515640199184418,
-0.06431379169225693,
-0.5422992706298828,
0.289905309677124,
0.4046861529350281,
0.2870008945465088,
1.2518998384475708,
0.6170412302017212,
0.5317060351371765,
0.22788116335868835,
0... |
func (rt *registryRoundTripper) Do(ctx context.Context, r *http.Request,
v interface{}) (*http.Response, error) {
ctx, cancelFunc := context.WithTimeout(ctx, 6*time.Second)
r = r.WithContext(ctx)
defer cancelFunc()
resp, err := rt.DefaultRequestDoer.Do(ctx, r, v)
if err != nil {
if ctx.Err() == context.Deadli... | [
-0.3574598431587219,
0.33539047837257385,
0.953779399394989,
-0.1647729128599167,
0.3911072015762329,
0.43883633613586426,
-0.1806042343378067,
-0.40564003586769104,
0.08906256407499313,
0.7556576728820801,
0.04539420083165169,
0.10778301954269409,
-0.29267922043800354,
0.3977093994617462,... |
func (client *Client) EnableAsync(routinePoolSize, maxTaskQueueSize int) {
client.asyncTaskQueue = make(chan func(), maxTaskQueueSize)
for i := 0; i < routinePoolSize; i++ {
go func() {
for client.isRunning {
select {
case task, notClosed := <-client.asyncTaskQueue:
if notClosed {
task()
... | [
0.3336884081363678,
-0.13018032908439636,
0.738993763923645,
-0.335403710603714,
0.09926910698413849,
0.37033766508102417,
0.8872401714324951,
0.3039621412754059,
0.366937518119812,
0.0993574932217598,
-0.22653691470623016,
0.7813524007797241,
-0.32538270950317383,
0.2068854719400406,
-0... |
func NewSwitch(stream *util.MessageStream, dpid net.HardwareAddr, app AppInterface, connCh chan int, ctrlID uint16) *OFSwitch {
var s *OFSwitch
if getSwitch(dpid) == nil {
log.Infoln("Openflow Connection for new switch:", dpid)
s = new(OFSwitch)
s.app = app
s.stream = stream
s.dpid = dpid
s.connCh = conn... | [
0.3313855230808258,
-0.4316941201686859,
0.5575846433639526,
0.5062690377235413,
-0.5110333561897278,
-0.6906302571296692,
-0.18054576218128204,
-0.328326553106308,
0.4155966341495514,
-0.19587960839271545,
0.20536638796329498,
-0.16085074841976166,
-0.5495409369468689,
0.5473491549491882,... |
func getSwitch(dpid net.HardwareAddr) *OFSwitch {
sw, _ := switchDb.Get(dpid.String())
if sw == nil {
return nil
}
return sw.(*OFSwitch)
} | [
-0.3587261736392975,
0.6085879802703857,
0.36659228801727295,
0.661152184009552,
-0.10999266058206558,
-1.2275419235229492,
-0.1751745492219925,
-0.48653489351272583,
0.4541037976741791,
-0.8012202978134155,
-0.28971922397613525,
-0.08897887170314789,
-0.23223094642162323,
-0.0114508299157... |
func (self *OFSwitch) DPID() net.HardwareAddr {
return self.dpid
} | [
-0.2008187472820282,
-0.2165471911430359,
0.5445621609687805,
-0.23249663412570953,
0.11302642524242401,
0.8850629329681396,
0.29747650027275085,
-0.265174001455307,
1.0066051483154297,
-0.26218581199645996,
1.0171489715576172,
-0.2876874506473541,
-0.6962183713912964,
-0.5664836764335632,... |
func (self *OFSwitch) Send(req util.Message) error {
select {
case <-time.After(messageTimeout):
return fmt.Errorf("message send timeout")
case self.stream.Outbound <- req:
return nil
case <-self.ctx.Done():
return fmt.Errorf("message is canceled because of disconnection from the Switch")
}
} | [
-0.7760246992111206,
0.22412727773189545,
0.5894890427589417,
0.808687150478363,
0.06415838748216629,
-0.23278267681598663,
-0.8996037840843201,
-1.1120315790176392,
-0.20472948253154755,
-0.16545602679252625,
0.8998719453811646,
0.016334429383277893,
-0.5811482667922974,
0.513946354389190... |
func (self *OFSwitch) switchConnected() {
self.changeStatus(true)
// Send new feature request
self.Send(openflow13.NewFeaturesRequest())
self.Send(openflow13.NewEchoRequest())
self.heartbeatCh = make(chan struct{})
go func() {
timer := time.NewTicker(heartbeatInterval)
defer timer.Stop()
for {
select ... | [
-0.6019688844680786,
-0.5635538101196289,
0.5599575638771057,
0.8707079887390137,
0.34149661660194397,
0.09373297542333603,
-0.6693540811538696,
-0.8691300749778748,
-0.3279534876346588,
-0.00859126914292574,
0.0385272353887558,
-0.3602372407913208,
0.6892620325088501,
0.19262507557868958,... |
func (self *OFSwitch) switchDisconnected() {
self.changeStatus(false)
self.cancel()
self.heartbeatCh <- struct{}{}
switchDb.Remove(self.DPID().String())
self.app.SwitchDisconnected(self)
if self.connCh != nil {
self.connCh <- ReConnection
}
} | [
-0.0018397665116935968,
-0.7089425325393677,
0.4361007511615753,
0.6086956858634949,
0.2161191701889038,
0.4594237208366394,
-0.5240669250488281,
0.2558008134365082,
0.5010048747062683,
-0.05060378089547157,
-0.7613276839256287,
-0.13891275227069855,
0.5283302664756775,
0.04976045712828636... |
func (self *OFSwitch) receive() {
for {
select {
case msg := <-self.stream.Inbound:
// New message has been received from message
// stream.
self.handleMessages(self.dpid, msg)
case err := <-self.stream.Error:
log.Warnf("Received ERROR message from switch %v. Err: %v", self.dpid, err)
// send Swi... | [
-0.41539812088012695,
-0.5832004547119141,
0.5483691096305847,
-0.25312167406082153,
0.4410071074962616,
-0.4053785800933838,
0.09455642849206924,
-1.0094382762908936,
0.1380147486925125,
-0.5601290464401245,
0.21341270208358765,
0.08004758507013321,
-0.34646376967430115,
0.709696292877197... |
func (self *OFSwitch) handleMessages(dpid net.HardwareAddr, msg util.Message) {
log.Debugf("Received message: %+v, on switch: %s", msg, dpid.String())
switch t := msg.(type) {
case *common.Header:
switch t.Header().Type {
case openflow13.Type_Hello:
// Send Hello response
h, err := common.NewHello(4)
i... | [
-0.18379300832748413,
-0.07507064193487167,
0.7034366726875305,
-0.22918997704982758,
0.4086771607398987,
-0.33295583724975586,
0.34115585684776306,
-0.5578423142433167,
0.3045353293418884,
0.055493250489234924,
0.5790156722068787,
-0.6083340644836426,
-0.9060168266296387,
0.58857017755508... |
func main() {
upperLimit := big.NewInt(20)
series := generateSequence(upperLimit)
primes := generatePrimes(upperLimit)
primeExps := calculateMaxExponentsForPrimeSeries(primes, upperLimit)
fmt.Println("----------------------------------------------")
fmt.Println("Number series 1 -", upperLimit)
/*
fmt.Printl... | [
0.06487751752138138,
-0.3435865044593811,
1.4229971170425415,
0.38817304372787476,
0.0177210234105587,
0.5669346451759338,
1.2007397413253784,
0.6581656336784363,
0.5392640233039856,
-0.5542720556259155,
-0.6725687980651855,
0.48552510142326355,
-0.6514731049537659,
0.07964450120925903,
... |
func parseTokenizeForm(r *http.Request) (models.PropertyDetails, error) {
err := r.ParseMultipartForm(10 << 20)
properyDetails := models.PropertyDetails{}
if err != nil {
return properyDetails, err
}
propName := r.FormValue("tokenName")
address := r.FormValue("address")
owner := strings.Split(r.FormValue("... | [
-0.12685474753379822,
-0.23713000118732452,
0.9204490184783936,
-0.6645222902297974,
0.05472840368747711,
-0.5780678987503052,
-0.4238341748714447,
-0.3033837676048279,
-0.40919798612594604,
-0.46127283573150635,
-0.37908053398132324,
-0.5400249361991882,
-0.2203751802444458,
0.00131268380... |
func (a DirectAssigner) Assign(labels []string) []string {
return append([]string(nil), labels...)
} | [
-1.4504882097244263,
-0.9185963869094849,
0.37249401211738586,
-0.26407477259635925,
0.32219478487968445,
1.0547730922698975,
-0.951482892036438,
-0.10409565269947052,
-0.25227969884872437,
0.13784915208816528,
0.0621439553797245,
0.06112172082066536,
-0.3417505621910095,
1.313435792922973... |
func (a MapAssigner) Assign(labels []string) []string {
var names []string
for _, word := range labels {
names = append(names, a[word]...)
}
return names
} | [
-1.8962206840515137,
-1.5750923156738281,
0.5162346959114075,
-0.768339991569519,
-0.6060953140258789,
0.8536706566810608,
-1.2737247943878174,
-0.014818808063864708,
-0.3337987959384918,
1.0477125644683838,
0.75947505235672,
-0.1454593390226364,
-0.19539973139762878,
1.6630148887634277,
... |
func CobraBindEnvironmentVariables(prefix string) func(cmd *cobra.Command, _ []string) {
// Search for environment values with the given prefix
viper.SetEnvPrefix(prefix)
// Automatically extract values from Cobra pflags as prefixed above
viper.AutomaticEnv()
return func(cmd *cobra.Command, _ []string) {
// Pro... | [
-0.7052848935127258,
-0.8659759163856506,
0.768966555595398,
-0.8675594925880432,
-0.7602527141571045,
0.3055877685546875,
0.11873035132884979,
-0.09035054594278336,
-0.5268604755401611,
0.20693640410900116,
-0.610611081123352,
0.4890892803668976,
0.2092575579881668,
1.0862520933151245,
... |
func (c CustomScraper) Scrape(_ *http.Request, closer io.ReadCloser) ([]*url.URL, error) {
defer closer.Close()
var links []*url.URL
z := html.NewTokenizer(closer)
for {
tt := z.Next()
if tt == html.ErrorToken {
return links, nil
}
if tt == html.TextToken {
token := z.Token()
fmt.Println(stri... | [
-1.360796332359314,
-0.3560669720172882,
0.6639564037322998,
0.46867436170578003,
-0.36891618371009827,
-0.6019921898841858,
-0.8933404684066772,
-0.07710761576890945,
-0.38680028915405273,
-0.3292234241962433,
0.34102001786231995,
0.6128616333007812,
-0.18601852655410767,
0.65072017908096... |
func (s *Store) CreateSystemIntakeNote(ctx context.Context, note *models.SystemIntakeNote) (*models.SystemIntakeNote, error) {
note.ID = uuid.New()
if note.CreatedAt == nil {
ts := s.clock.Now()
note.CreatedAt = &ts
}
const createSystemIntakeNoteSQL = `
INSERT INTO notes (
id,
system_intake,
created... | [
-0.30192801356315613,
-0.32836830615997314,
0.34916558861732483,
0.10697340220212936,
0.3018406629562378,
0.006738899275660515,
-0.3031083941459656,
-0.8905780911445618,
-0.488870769739151,
0.36173221468925476,
-0.6228107213973999,
-0.4269850254058838,
-0.3736681640148163,
0.47944518923759... |
func (s *Store) UpdateSystemIntakeNote(ctx context.Context, note *models.SystemIntakeNote) (*models.SystemIntakeNote, error) {
stmt, err := s.db.PrepareNamed(`
UPDATE notes
SET
content = :content,
is_archived = :is_archived,
modified_by = :modified_by,
modified_at = CURRENT_TIMESTAMP
WHERE id = :id
RETURNI... | [
-0.9928755164146423,
-0.686229407787323,
0.26699528098106384,
-0.49019622802734375,
-0.10428468137979507,
-0.2183128148317337,
-0.40833449363708496,
-0.6849986910820007,
-0.7329083681106567,
1.0924535989761353,
-0.12040700018405914,
0.6042461395263672,
-0.830669105052948,
0.323372572660446... |
func (s *Store) FetchSystemIntakeNoteByID(ctx context.Context, id uuid.UUID) (*models.SystemIntakeNote, error) {
note := models.SystemIntakeNote{}
err := s.db.Get(¬e, "SELECT * FROM public.notes WHERE id=$1", id)
if err != nil {
appcontext.ZLogger(ctx).Error(
fmt.Sprintf("Failed to fetch note %s", err),
z... | [
0.6527572274208069,
-0.5587060451507568,
0.30048254132270813,
-0.38002926111221313,
-0.4045813977718353,
-0.31938636302948,
-0.8512424826622009,
-0.9508994817733765,
0.18009454011917114,
0.9571093916893005,
-0.4900895357131958,
0.21571765840053558,
-0.6477348208427429,
0.4409785866737366,
... |
func (s *Store) FetchNotesBySystemIntakeID(ctx context.Context, id uuid.UUID) ([]*models.SystemIntakeNote, error) {
notes := []*models.SystemIntakeNote{}
err := s.db.Select(¬es, "SELECT * FROM notes WHERE system_intake=$1 AND is_archived=false ORDER BY created_at DESC", id)
if err != nil {
appcontext.ZLogger(ct... | [
0.6836895942687988,
-0.47512489557266235,
0.43500611186027527,
0.0016960918437689543,
-0.13900771737098694,
-0.53201824426651,
-0.6744423508644104,
-1.1913727521896362,
0.4976668953895569,
1.362131118774414,
-0.2881247401237488,
0.17728792130947113,
-0.7504433989524841,
1.098502278327942,
... |
func (s *Streamer) Float32(f float32) *Streamer {
if s.Error != nil {
return s
}
f64 := float64(f)
if math.IsInf(f64, 0) {
s.Error = ErrFloatIsInfinity
return s
}
if math.IsNaN(f64) {
s.Error = ErrFloatIsNan
return s
}
s.onVal()
fmt := byte('f')
abs := math.Abs(f64)
if abs != 0 {
if f > 0 {
if... | [
0.3202190697193146,
0.5179747343063354,
0.9336614608764648,
-0.27773240208625793,
-0.3794950842857361,
-0.19177891314029694,
-0.15058988332748413,
-0.5547159314155579,
-0.43157872557640076,
-0.22081302106380463,
0.3252049386501312,
0.5402979850769043,
0.49916723370552063,
1.335541009902954... |
func (s *Streamer) Float64(f float64) *Streamer {
if s.Error != nil {
return s
}
if math.IsInf(f, 0) {
s.Error = ErrFloatIsInfinity
return s
}
if math.IsNaN(f) {
s.Error = ErrFloatIsNan
return s
}
s.onVal()
fmt := byte('f')
abs := math.Abs(f)
if abs != 0 {
if f > 0 {
if f < 1e-6 || f >= 1e21 {
... | [
-0.18045692145824432,
0.29730212688446045,
0.8789095282554626,
0.34761160612106323,
0.03785422444343567,
-0.4399335980415344,
0.17723169922828674,
-0.09825394302606583,
-0.11927340924739838,
-0.2941533625125885,
0.37147167325019836,
0.27586448192596436,
0.4683222770690918,
1.21901500225067... |
func NewBot(token string, prefix string) *Bot {
if prefix == "" {
prefix = "n!"
}
session, err := dgo.New("Bot " + token)
if err != nil {
log.Fatalln(err)
return nil
}
cmdHandler := NewCommandHandler(prefix)
b := &Bot{
Session: session,
Prefix: prefix,
CmdHandler: cmdHandler,
clo... | [
0.35968783497810364,
0.2771497368812561,
0.5787096619606018,
-0.2380117028951645,
-0.39007267355918884,
-0.4021550416946411,
-0.5584846138954163,
-0.5385636687278748,
0.09176836907863617,
-0.7968454957008362,
-0.252652645111084,
0.5945528745651245,
-0.20472846925258636,
0.501352071762085,
... |
func (b *Bot) Connect() {
b.closed = false
if err := b.Session.Open(); err != nil {
b.closed = true
log.Fatalln("Error opening connection to Discord", err)
return
}
} | [
-1.0332887172698975,
-0.35805362462997437,
0.48069247603416443,
-0.5194550156593323,
-0.29573267698287964,
0.502178966999054,
-0.4912884831428528,
0.17413194477558136,
-0.6348782777786255,
0.26182451844215393,
0.6462296843528748,
0.049384716898202896,
-0.7267303466796875,
0.462191730737686... |
func (b *Bot) ready(s *dgo.Session, r *dgo.Ready) {
} | [
-0.3698688745498657,
0.0732932910323143,
0.45578649640083313,
-0.017014116048812866,
-0.46636444330215454,
0.25202032923698425,
-0.0391596183180809,
0.5132473111152649,
0.5470545887947083,
0.44041678309440613,
-1.0924937725067139,
1.1671589612960815,
0.6903477311134338,
0.1513350009918213,... |
func (b *HybridBotanist) generateCloudConfigChart() (*chartrenderer.RenderedChart, error) {
var (
cloudProvider = map[string]interface{}{
"name": b.ShootCloudBotanist.GetCloudProviderName(),
}
serviceNetwork = b.Shoot.GetServiceNetwork()
userDataConfig = b.ShootCloudBotanist.GenerateCloudConfigUserDataConfi... | [
-0.11534424871206284,
0.8616459965705872,
0.6333905458450317,
0.43547534942626953,
-0.055414777249097824,
0.18653404712677002,
-0.23707224428653717,
0.2293621152639389,
-0.5009685754776001,
0.8562572598457336,
-0.5539621710777283,
0.6451210379600525,
-0.2652535140514374,
0.9750199317932129... |
func TestDecompressY(t *testing.T) {
tests := []struct {
name string // test description
x string // hex encoded x coordinate
valid bool // expected decompress result
wantOddY string // hex encoded expected odd y coordinate
wantEvenY string // hex encoded expected even y coordinate
}{{
... | [
0.09492361545562744,
-0.1982867419719696,
0.8351277709007263,
-0.46399444341659546,
0.12607790529727936,
-0.27447637915611267,
-0.018755733966827393,
-0.6273959875106812,
-0.4136069715023041,
-0.9586239457130432,
-1.0651620626449585,
-0.18727128207683563,
-0.47395649552345276,
0.1673163175... |
func TestDecompressYRandom(t *testing.T) {
// Use a unique random seed each test instance and log it if the tests fail.
seed := time.Now().Unix()
rng := rand.New(rand.NewSource(seed))
defer func(t *testing.T, seed int64) {
if t.Failed() {
t.Logf("random seed: %d", seed)
}
}(t, seed)
for i := 0; i < 100; i... | [
-0.7277474403381348,
0.006674844305962324,
0.7419565320014954,
-0.04243073984980583,
0.45842117071151733,
0.30686962604522705,
0.5218748450279236,
-0.6679099202156067,
0.10038235783576965,
-0.9259263277053833,
-0.2822672128677368,
0.3018394708633423,
-0.12980054318904877,
0.233688011765480... |
func ListenAndServe(addr string, handler http.Handler) error {
if addr == "" {
addr = ":80"
}
var err error
server, err = New(&http.Server{
Addr: addr,
Handler: handler,
})
if err != nil {
return err
}
return server.ListenAndServe()
} | [
0.29792454838752747,
-0.41271641850471497,
0.617363452911377,
-0.4119148254394531,
-0.7738801836967468,
0.5040279626846313,
-0.823855459690094,
0.8775273561477661,
-0.17509683966636658,
-0.4575483798980713,
0.03137878328561783,
0.4701126217842102,
0.37400686740875244,
1.163862943649292,
... |
func FdListenAndServe(fd int, addr string, handler http.Handler) error {
var err error
server, err = FromFd(fd, &http.Server{
Addr: addr,
Handler: handler,
})
if err != nil {
return err
}
return server.ListenAndServe()
} | [
0.44116947054862976,
-1.514694094657898,
0.6407713294029236,
-0.8318237662315369,
-0.9392402768135071,
0.07443278282880783,
-1.0130614042282104,
0.4034562110900879,
0.06812196224927902,
-0.8516022562980652,
0.0893242359161377,
-0.026202483102679253,
0.7277956008911133,
1.2290705442428589,
... |
func ListenAndServeTLS(addr, certFile, keyFile string, handler http.Handler) error {
var err error
server, err = New(&http.Server{
Addr: addr,
Handler: handler,
})
if err != nil {
return err
}
return server.ListenAndServeTLS(certFile, keyFile)
} | [
0.9256830215454102,
-0.3974665105342865,
0.402378112077713,
0.017691535875201225,
-0.7460918426513672,
0.7889530658721924,
-0.7980471849441528,
0.4320929944515228,
-0.4993015229701996,
0.11848101019859314,
-0.3777172863483429,
0.39809390902519226,
0.9152233004570007,
1.6003813743591309,
... |
func FdListenAndServeTLS(fd int, addr, certFile, keyFile string, handler http.Handler) error {
var err error
server, err = FromFd(fd, &http.Server{
Addr: addr,
Handler: handler,
})
if err != nil {
return err
}
return server.ListenAndServeTLS(certFile, keyFile)
} | [
0.4934065043926239,
-1.1472116708755493,
0.45704957842826843,
-0.4105354845523834,
-1.2308398485183716,
0.6204266548156738,
-0.773651123046875,
0.19409073889255524,
-0.25432053208351135,
-0.24215085804462433,
0.179917573928833,
0.42719221115112305,
1.0664087533950806,
1.6653578281402588,
... |
func DupFd() (int, error) {
return server.DupFd()
} | [
-0.11345400661230087,
0.18733738362789154,
0.6127933263778687,
0.28376340866088867,
-0.28801608085632324,
0.16477318108081818,
0.5901476144790649,
-0.2742253839969635,
0.24834272265434265,
-0.44479918479919434,
-0.37372884154319763,
0.5260496139526367,
-0.22844046354293823,
1.5570044517517... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.