text stringlengths 11 6.3k | embedding listlengths 768 768 |
|---|---|
func (pool *SubPool) Stop() {
pool.StopChan <- struct{}{}
} | [
-0.7925756573677063,
-0.15340213477611542,
0.14701037108898163,
-0.3008660674095154,
0.48115092515945435,
1.3588354587554932,
0.832671046257019,
-0.29459288716316223,
-1.1313631534576416,
-0.47195082902908325,
-1.7825162410736084,
1.4137661457061768,
-0.6420839428901672,
-0.138757050037384... |
func execute_xpath_expression(filename string, xpathExpr string, nsList string) error {
doc,err := XmlParseFile(filename)
if err != nil {
fmt.Fprintf(os.Stderr,"Failed to parse %s\n", filename)
return fmt.Errorf("error")
}
defer XmlFreeDoc(doc)
/* Create xpath evaluation context */
... | [
-0.10124684870243073,
-0.31489285826683044,
0.8781347274780273,
0.43266212940216064,
-0.16237874329090118,
0.13067099452018738,
0.12220390886068344,
0.06505017727613449,
0.06476424634456635,
1.1515394449234009,
-0.0138862868770957,
0.8290659189224243,
0.2497466653585434,
0.1519953906536102... |
func (h *Handlers) SendResponse(ctx smodels.RouterCtx, res *smodels.Result) error {
if res.Exception != nil {
return ctx.Status(int(res.Exception.StatusCode)).JSON(res.Exception)
}
return ctx.Status(fiber.StatusOK).JSON(res.Result)
} | [
-0.5341807007789612,
-0.21427077054977417,
0.5917947292327881,
1.1739412546157837,
-0.27028703689575195,
-0.5176507830619812,
-0.1239287257194519,
0.344938725233078,
1.1119877099990845,
0.7649765014648438,
-0.5298682451248169,
-0.4565044939517975,
-0.5073654651641846,
-0.021711580455303192... |
func NewHandlers() *Handlers {
handlers := new(Handlers)
handlers.services = services.GetServices()
return handlers
} | [
-0.20453159511089325,
-0.34080561995506287,
-0.0024565618950873613,
-0.2879592478275299,
-0.15586675703525543,
-0.06600699573755264,
-0.6168316006660461,
-0.5028916597366333,
0.048487868160009384,
-1.3955413103103638,
0.04372527822852135,
0.4972783923149109,
-0.5214996337890625,
0.30026307... |
func (o *Orderer) OrderUniverse(u types.Universe) []*types.Type {
list := tList{
namer: o.Namer,
}
for _, p := range u {
for _, t := range p.Types {
list.types = append(list.types, t)
}
for _, f := range p.Functions {
list.types = append(list.types, f)
}
for _, v := range p.Variables {
list.type... | [
-1.3808777332305908,
-0.5088905692100525,
0.9199121594429016,
-0.22883431613445282,
0.07681119441986084,
0.4982566833496094,
-0.27064239978790283,
0.0736374482512474,
-0.31410157680511475,
0.3857530355453491,
-0.9780798554420471,
0.3425476849079132,
-0.9165731072425842,
0.37637120485305786... |
func (o *Orderer) OrderTypes(typeList []*types.Type) []*types.Type {
list := tList{
namer: o.Namer,
types: typeList,
}
sort.Sort(list)
return list.types
} | [
-0.8965561985969543,
-0.2676245868206024,
0.3625294268131256,
0.6131439208984375,
-0.21963295340538025,
0.14324910938739777,
-0.1446758210659027,
-1.103295922279358,
-0.0034186416305601597,
0.8347489833831787,
-0.5856743454933167,
-0.03601149469614029,
-1.267776370048523,
1.258860826492309... |
func NewCreateGUIDParams() *CreateGUIDParams {
var ()
return &CreateGUIDParams{
timeout: cr.DefaultTimeout,
}
} | [
-0.06479721516370773,
-0.15913613140583038,
0.04276055097579956,
0.4919491708278656,
0.16786649823188782,
0.667690098285675,
-0.2707015573978424,
-0.2793695032596588,
-0.9404916763305664,
0.3316677510738373,
-0.4971998333930969,
0.2089807540178299,
-1.4771822690963745,
1.2285505533218384,
... |
func NewCreateGUIDParamsWithTimeout(timeout time.Duration) *CreateGUIDParams {
var ()
return &CreateGUIDParams{
timeout: timeout,
}
} | [
0.7996305823326111,
-0.37335312366485596,
0.06929530203342438,
0.3845236897468567,
0.03251069039106369,
1.2413071393966675,
-1.2392553091049194,
-0.4543595016002655,
-1.1626580953598022,
1.1709643602371216,
-0.21276898682117462,
0.7700451612472534,
-1.217482328414917,
1.367487907409668,
... |
func NewCreateGUIDParamsWithContext(ctx context.Context) *CreateGUIDParams {
var ()
return &CreateGUIDParams{
Context: ctx,
}
} | [
0.2631928026676178,
-0.26633334159851074,
0.09451671689748764,
-0.20278799533843994,
0.2716448903083801,
1.1676503419876099,
-1.1186023950576782,
-1.3230801820755005,
-0.658807098865509,
0.7552564144134521,
-0.37433719635009766,
0.09139508008956909,
-1.1246998310089111,
0.8860633373260498,... |
func NewCreateGUIDParamsWithHTTPClient(client *http.Client) *CreateGUIDParams {
var ()
return &CreateGUIDParams{
HTTPClient: client,
}
} | [
0.3370358645915985,
-0.47082948684692383,
0.14764049649238586,
-0.051644690334796906,
0.42521578073501587,
1.3662968873977661,
-0.0894489586353302,
-0.646695613861084,
-1.2487614154815674,
0.1578873246908188,
-0.5354650020599365,
-0.012470478191971779,
-0.9237306714057922,
0.81369435787200... |
func (o *CreateGUIDParams) WithTimeout(timeout time.Duration) *CreateGUIDParams {
o.SetTimeout(timeout)
return o
} | [
0.4771922528743744,
0.2009720802307129,
-0.004595723934471607,
-0.49256888031959534,
0.4219546318054199,
1.0035299062728882,
-0.6410707831382751,
-0.5592557191848755,
-0.6083934903144836,
1.1723679304122925,
0.03455245867371559,
0.6504833698272705,
-0.41397514939308167,
1.1060527563095093,... |
func (o *CreateGUIDParams) SetTimeout(timeout time.Duration) {
o.timeout = timeout
} | [
0.02554350346326828,
0.15837575495243073,
-0.07277107983827591,
-0.4092736840248108,
0.8042321801185608,
1.2595139741897583,
-0.36625024676322937,
-0.3542340099811554,
-0.9810776114463806,
1.2250367403030396,
-0.18096520006656647,
0.9522031545639038,
-1.1059012413024902,
1.4093941450119019... |
func (o *CreateGUIDParams) WithContext(ctx context.Context) *CreateGUIDParams {
o.SetContext(ctx)
return o
} | [
-0.5076741576194763,
0.34439006447792053,
0.08187162131071091,
-0.5642282366752625,
0.27413496375083923,
0.8883779644966125,
-0.6028995513916016,
-1.2808287143707275,
-0.10352704674005508,
0.6075409650802612,
-0.12814553081989288,
0.4326891601085663,
-1.0241425037384033,
0.4562862515449524... |
func (o *CreateGUIDParams) SetContext(ctx context.Context) {
o.Context = ctx
} | [
-0.7265844941139221,
0.18716904520988464,
-0.04962465167045593,
-0.30709049105644226,
0.7744449973106384,
0.9061155319213867,
-0.3882313072681427,
-0.9064099788665771,
-0.12485026568174362,
0.7254024147987366,
-0.5139312744140625,
0.8011099696159363,
-1.543803095817566,
0.9885253310203552,... |
func (o *CreateGUIDParams) WithHTTPClient(client *http.Client) *CreateGUIDParams {
o.SetHTTPClient(client)
return o
} | [
-0.14981034398078918,
-0.6162241101264954,
0.07199455052614212,
-0.8006504774093628,
0.4860282838344574,
0.8078144788742065,
0.08384933322668076,
-1.0536110401153564,
-0.8416780233383179,
0.08407305181026459,
-0.08641189336776733,
0.22852081060409546,
-0.25999268889427185,
0.24714714288711... |
func (o *CreateGUIDParams) SetHTTPClient(client *http.Client) {
o.HTTPClient = client
} | [
0.07797395437955856,
-0.47679054737091064,
0.04302592575550079,
-1.0895662307739258,
0.32424792647361755,
0.631273090839386,
0.33941709995269775,
-0.9456236362457275,
-1.3298640251159668,
0.35782721638679504,
-0.5225628018379211,
0.7967612147331238,
-1.0345696210861206,
0.3214709460735321,... |
func (o *CreateGUIDParams) WithCreateGUIDInfo(createGUIDInfo *api_models.CreateGUIDRequest) *CreateGUIDParams {
o.SetCreateGUIDInfo(createGUIDInfo)
return o
} | [
0.20637394487857819,
-0.49070367217063904,
-0.1861146092414856,
-0.5384639501571655,
0.1946149319410324,
0.551342785358429,
-0.710574209690094,
-1.0803465843200684,
-0.9097084999084473,
-0.005256198812276125,
-0.4011537730693817,
-0.10205569863319397,
-0.4715675413608551,
1.207884192466735... |
func (o *CreateGUIDParams) SetCreateGUIDInfo(createGUIDInfo *api_models.CreateGUIDRequest) {
o.CreateGUIDInfo = createGUIDInfo
} | [
-0.1972547322511673,
-0.6427128314971924,
-0.031383905559778214,
-0.7949097156524658,
0.21210861206054688,
1.0078996419906616,
-0.5865212678909302,
-1.1340810060501099,
-1.1710597276687622,
0.192205011844635,
-0.8621145486831665,
0.4775048792362213,
-0.9425299763679504,
1.5610893964767456,... |
func (o *CreateGUIDParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error {
if err := r.SetTimeout(o.timeout); err != nil {
return err
}
var res []error
if o.CreateGUIDInfo != nil {
if err := r.SetBodyParam(o.CreateGUIDInfo); err != nil {
return err
}
}
if len(res) > 0 {
return e... | [
-0.8957757949829102,
-0.06726392358541489,
0.5526872873306274,
-0.6083077192306519,
0.9953604340553284,
0.28669291734695435,
0.6237212419509888,
-0.5060498118400574,
-0.8387024998664856,
0.6230617761611938,
0.14637090265750885,
0.40429940819740295,
-0.8798415660858154,
0.7049120664596558,
... |
func Web(w http.ResponseWriter, r *http.Request) {
var err error
// get filename
_, fileName := path.Split(r.URL.Path)
if fileName == "" || fileName == "/" {
fileName = "index.html"
}
// open file
var file *os.File
file, err = os.Open(fmt.Sprintf("%s/%s", config.Get("https", "directory"), fileName))
// ch... | [
-0.31014442443847656,
-0.7184145450592041,
1.3510595560073853,
0.7153465747833252,
0.10449923574924469,
0.6951806545257568,
1.795526146888733,
0.12968820333480835,
-0.7572201490402222,
0.36023205518722534,
0.6721501350402832,
0.30809691548347473,
0.5087122321128845,
-0.5407733917236328,
... |
func TestDeriveSharedSecret(t *testing.T) {
if testing.Short() {
t.SkipNow()
}
t.Parallel()
// Create 2 key pairs.
privKey1, pubKey1 := generateX25519KeyPair()
privKey2, pubKey2 := generateX25519KeyPair()
// Derive the shared key twice.
sharedKey1 := deriveSharedSecret(privKey1, pubKey2)
sharedKey2 := deriv... | [
0.2841225564479828,
0.5378413200378418,
0.8032341003417969,
0.616348385810852,
0.2962949872016907,
0.4033624827861786,
0.23795591294765472,
-0.29840782284736633,
-0.13465821743011475,
-0.42678359150886536,
-1.4492231607437134,
0.22657698392868042,
-0.6946374773979187,
0.3950025737285614,
... |
func TestEncryptDecryptFrameHeader(t *testing.T) {
t.Parallel()
// Create a random key.
key := fastrand.Bytes(X25519KeyLen)
// Initialize the cipher.
aead, err := chacha20poly1305.New(key[:])
if err != nil {
t.Fatal(err)
}
// Create a frame that is maller than the encryptedFrameSize, one that is
// the same... | [
0.024188945069909096,
0.9412791132926941,
0.8463666439056396,
-0.3297227621078491,
-0.019483797252178192,
-0.08449004590511322,
0.05456019192934036,
-0.805767834186554,
0.5604972839355469,
-0.15053127706050873,
-0.5385780930519104,
0.12676742672920227,
-0.5402646660804749,
-0.0313308984041... |
func TestEncryptDecryptFramePayload(t *testing.T) {
t.Parallel()
// Create a random key.
key := fastrand.Bytes(X25519KeyLen)
// Initialize the cipher.
aead, err := chacha20poly1305.New(key[:])
if err != nil {
t.Fatal(err)
}
// Create a frame that is maller than the encryptedFrameSize, one that is
// the sam... | [
-0.05518699064850807,
1.3011540174484253,
0.9925050735473633,
-0.4885276257991791,
0.06751920282840729,
-0.375875324010849,
0.14364275336265564,
-0.7778365015983582,
0.6757360696792603,
-0.07784673571586609,
-0.6648564338684082,
-0.3567754924297333,
-0.3597205579280853,
0.40381285548210144... |
func TestSignVerifyHash(t *testing.T) {
t.Parallel()
// Create some random data.
data := fastrand.Bytes(100)
// Generate a keypair.
sk, pk := GenerateED25519KeyPair()
// Hash the data.
hash := blake2b.Sum256(data)
// Sign the data.
sig := signHash(hash, sk)
// Verify signature
if !verifyHash(hash, pk, sig) {... | [
0.6558323502540588,
0.5255153775215149,
0.33973321318626404,
1.3282991647720337,
0.40109357237815857,
0.35203447937965393,
-0.6408619284629822,
0.06752165406942368,
0.12467988580465317,
-0.7918491363525391,
-1.6653085947036743,
-0.22151008248329163,
-0.20928965508937836,
0.7565594911575317... |
func TestIPSetRanges(t *testing.T) {
t.Parallel()
upper := 0x0fff
if *long {
upper = 0xffff
}
for pat := 0; pat <= upper; pat++ {
var build IPSetBuilder
var from, to IP
ranges := make([]IPRange, 0)
flush := func() {
r := IPRangeFrom(from, to)
build.AddRange(r)
ranges = append(ranges, r)
from,... | [
-0.7110263109207153,
0.4608575701713562,
0.35660290718078613,
-0.03633665665984154,
0.7538008093833923,
0.29466965794563293,
0.551733672618866,
-0.5760151147842407,
0.029927393421530724,
-0.9251673221588135,
-0.12991787493228912,
-0.3579513430595398,
-0.44580334424972534,
0.032904200255870... |
func (t *orderbooktracker) Get(sym string) (*exchange.MarketRecord, error) {
return t.db.Get(sym)
} | [
-0.6385055780410767,
0.657358705997467,
0.11798933148384094,
-0.4044444262981415,
0.9080401659011841,
-0.44967690110206604,
0.14117491245269775,
-0.5329657196998596,
-0.3884718418121338,
0.2918802797794342,
-0.02967805415391922,
0.4296771287918091,
-0.5291606783866882,
0.41613271832466125,... |
func NewOrderbookTracker() (exchange.Orderbooks, error) {
db, err := NewDatabase()
if err != nil {
return nil, err
}
return &orderbooktracker{
db: db,
}, nil
} | [
-0.5618170499801636,
-0.38554584980010986,
0.26641032099723816,
0.9501804113388062,
-0.7562649846076965,
0.2769002914428711,
0.29233914613723755,
-0.39161446690559387,
-0.8253390192985535,
0.28678616881370544,
-0.5787445306777954,
-0.6925864219665527,
-1.2616207599639893,
1.332665205001831... |
func FilterMap() string {
return `
func FilterMap<CONDITIONAL_TYPE>(fFilter func(<TYPE>) bool, fMap func(<TYPE>) <TYPE>, list []<TYPE>) []<TYPE> {
if fFilter == nil || fMap == nil {
return []<TYPE>{}
}
var newList []<TYPE>
for _, v := range list {
if fFilter(v) {
newList = append(newList, fMap(v))
}
}
r... | [
-0.3556949496269226,
-0.1530495434999466,
0.5354793071746826,
0.625689685344696,
-0.10893262177705765,
-0.475427508354187,
0.6047340631484985,
0.33154070377349854,
0.37874579429626465,
0.6266414523124695,
0.6240724325180054,
0.5469726324081421,
0.17305853962898254,
0.720463752746582,
-0.... |
func FilterMapPtr() string {
return `
func FilterMap<CONDITIONAL_TYPE>Ptr(fFilter func(*<TYPE>) bool, fMap func(*<TYPE>) *<TYPE>, list []*<TYPE>) []*<TYPE> {
if fFilter == nil || fMap == nil {
return []*<TYPE>{}
}
var newList []*<TYPE>
for _, v := range list {
if fFilter(v) {
newList = append(newList, fMap(... | [
-0.5170925855636597,
-0.492399662733078,
0.40166032314300537,
0.10693535208702087,
-0.9441353678703308,
-0.47825658321380615,
0.38947853446006775,
-0.18796098232269287,
0.26619747281074524,
1.0366623401641846,
1.2413311004638672,
0.2123965322971344,
0.11392468214035034,
0.6449671983718872,... |
func (*PassportRequiredElement) TypeID() uint32 {
return PassportRequiredElementTypeID
} | [
-0.4743127226829529,
-0.40012866258621216,
0.6057965755462646,
0.8762415051460266,
-0.013283871114253998,
2.1300618648529053,
0.4168563783168793,
-0.19001954793930054,
1.4229121208190918,
0.456296443939209,
-0.8876898288726807,
0.5446377396583557,
-2.0777089595794678,
0.9518078565597534,
... |
func (*PassportRequiredElement) TypeName() string {
return "passportRequiredElement"
} | [
-0.9727768301963806,
-0.31564196944236755,
0.607409656047821,
0.5059927105903625,
-0.4679526686668396,
1.5279827117919922,
0.0416368693113327,
0.03296772390604019,
0.8955006003379822,
0.49375519156455994,
-0.8456446528434753,
-0.118057020008564,
-1.1974090337753296,
0.16807830333709717,
... |
func (p *PassportRequiredElement) TypeInfo() tdp.Type {
typ := tdp.Type{
Name: "passportRequiredElement",
ID: PassportRequiredElementTypeID,
}
if p == nil {
typ.Null = true
return typ
}
typ.Fields = []tdp.Field{
{
Name: "SuitableElements",
SchemaName: "suitable_elements",
},
}
return ty... | [
-0.26147326827049255,
0.11141674965620041,
0.35213804244995117,
-0.648780882358551,
-0.06746263802051544,
1.2332948446273804,
0.11618811637163162,
-0.01337436493486166,
0.34421586990356445,
0.5429778695106506,
-0.8125388026237488,
-0.30801865458488464,
-1.0082486867904663,
-0.1083943396806... |
func (p *PassportRequiredElement) GetSuitableElements() (value []PassportSuitableElement) {
if p == nil {
return
}
return p.SuitableElements
} | [
-0.5095681548118591,
0.3228238523006439,
0.5032716393470764,
1.8379952907562256,
-0.2880301773548126,
0.8367207646369934,
-0.2491176873445511,
0.3317257761955261,
1.0719330310821533,
0.27995362877845764,
-1.3724818229675293,
0.31276577711105347,
-1.3406360149383545,
0.2918969392776489,
0... |
func keyboard() {
reader := bufio.NewReader(os.Stdin)
fmt.Print("Age: ")
ioage, _ := reader.ReadString('\n')
fmt.Print("DOB: ")
iodob, _ := reader.ReadString('\n')
// fmt.Print(ioage, iodb)
fmt.Print(AgeYear(iodob, ioage))
return AgeYear(iodob, ioage)
} | [
-0.8541833162307739,
-0.6877130270004272,
1.072902798652649,
0.28601473569869995,
-0.9678488969802856,
1.1344988346099854,
0.27299076318740845,
-0.12880872189998627,
-0.7024949789047241,
-0.034693941473960876,
-0.3707220256328583,
0.4357267916202545,
-0.23660922050476074,
0.328312128782272... |
func AgeYear(dob time.Time, age time.Time) int{
// Add the year of birth to current age to get the current year
currentYear := dob.Year() + age.Year()
return currentYear
} | [
-0.16826651990413666,
-1.188664436340332,
0.8362514972686768,
-0.22950707376003265,
-0.5880321860313416,
0.7003652453422546,
-0.0700545683503151,
0.07007445394992828,
0.10451290011405945,
0.9999960064888,
0.04101564362645149,
0.9389861822128296,
0.00036417762748897076,
1.1085203886032104,
... |
func Open(db *db.DB, chunkStore chunks.Store, volumeID *db.VolumeID, pubKey *peer.PublicKey) (*Volume, error) {
fs := &Volume{}
fs.db = db
fs.volID = *volumeID
fs.pubKey = *pubKey
fs.chunkStore = chunkStore
fs.root = newDir(fs, tokens.InodeRoot, nil, "")
// assume we crashed, to be safe
fs.epoch.dirty = true
i... | [
0.17662382125854492,
-0.6934827566146851,
0.296466201543808,
-0.3555115759372711,
-0.8202120065689087,
-0.3754517138004303,
-0.43935057520866394,
0.7835345268249512,
-0.16570636630058289,
-0.9357724785804749,
0.6293690800666809,
0.4017503261566162,
-0.5849573016166687,
-0.2642858028411865,... |
func (v *Volume) Snapshot(ctx context.Context, tx *db.Tx) (*wiresnap.Snapshot, error) {
snapshot := &wiresnap.Snapshot{}
sde, err := v.root.snapshot(ctx, tx)
if err != nil {
return nil, err
}
snapshot.Contents = sde
return snapshot, nil
} | [
0.3781057298183441,
0.06470008939504623,
0.3036120533943176,
-0.17633073031902313,
-0.2008543461561203,
-0.3883577883243561,
-0.38823413848876953,
-0.18413420021533966,
0.6936274766921997,
-0.8803846836090088,
0.5706772208213806,
-0.39023247361183167,
-0.15858407318592072,
-0.6087570190429... |
func (v *Volume) nextEpoch(vb *db.Volume) error {
if !v.epoch.dirty {
return nil
}
n, err := vb.NextEpoch()
if err != nil {
return err
}
v.epoch.ticks = n
v.epoch.dirty = false
return nil
} | [
-0.19056963920593262,
0.5069506168365479,
0.5332098007202148,
-0.4258968234062195,
-0.34815946221351624,
0.7029896378517151,
0.34622877836227417,
-0.18278329074382782,
-0.455304890871048,
0.47496160864830017,
-0.38153210282325745,
0.3337653875350952,
0.22433333098888397,
0.6589748859405518... |
func (v *Volume) cleanEpoch() (clock.Epoch, error) {
if !v.epoch.dirty {
return v.epoch.ticks, nil
}
inc := func(tx *db.Tx) error {
vb := v.bucket(tx)
if err := v.nextEpoch(vb); err != nil {
return err
}
return nil
}
if err := v.db.Update(inc); err != nil {
return 0, err
}
return v.epoch.ticks, ni... | [
-0.7179959416389465,
0.20141609013080597,
0.6815468668937683,
-0.5786618590354919,
-0.450926274061203,
-0.13585476577281952,
0.6205170154571533,
-0.08526196330785751,
-0.8181441426277161,
1.2879446744918823,
-0.6575303673744202,
-0.13494625687599182,
-0.45924216508865356,
0.089554280042648... |
func snapshotVolumes(ctx context.Context, cli *client.Client, params Params) error {
projectFilter := filters.NewArgs()
projectFilter.Add("label", fmt.Sprintf("%s=%s", LabelProject, params.Config.Project))
list, err := cli.VolumeList(ctx, projectFilter)
if err != nil {
return err
}
for _, volume := range list... | [
-0.5749744176864624,
0.0433209091424942,
0.814592719078064,
-0.40048283338546753,
-0.00918384175747633,
0.38294896483421326,
0.6027393341064453,
-0.2479523867368698,
-0.417343407869339,
0.378191202878952,
0.2554177939891815,
0.2771080732345581,
0.3052464723587036,
0.02799892984330654,
0.... |
func referencedInServices(services map[string]*composeconfig.Service, allowed []string, volume string) bool {
for name, service := range services {
if !stringutils.Contains(allowed, name) {
continue
}
if service.MountsVolume(volume) {
return true
}
}
return false
} | [
-0.34701043367385864,
-0.0837111696600914,
0.6203545928001404,
-0.0700264647603035,
-0.630378246307373,
0.26082339882850647,
-0.5334489345550537,
-0.7708490490913391,
-0.49769189953804016,
0.08058107644319534,
1.216658115386963,
0.15245595574378967,
-1.1571440696716309,
0.6465846300125122,... |
func (cfg BaseConfig) decodeOperatorConfigs() ([]operator.Config, error) {
if len(cfg.Operators) == 0 {
return []operator.Config{}, nil
}
yamlBytes, _ := yaml.Marshal(cfg.Operators)
operatorCfgs := []operator.Config{}
if err := yaml.Unmarshal(yamlBytes, &operatorCfgs); err != nil {
return nil, err
}
return ... | [
-1.2431515455245972,
-0.07848706096410751,
0.67657071352005,
0.5631725788116455,
-0.8757374286651611,
-0.6573490500450134,
-0.057912301272153854,
0.7663034796714783,
0.19223791360855103,
0.44140273332595825,
-0.8447543382644653,
-0.8129844069480896,
-0.9887307286262512,
0.5885648727416992,... |
func New() *Service {
s := new(Service)
s.GoRoutines = sdk.NewGoRoutines(context.Background())
s.Router = &api.Router{
Mux: mux.NewRouter(),
}
return s
} | [
-0.13899581134319305,
0.05816734582185745,
0.132259801030159,
-0.12557359039783478,
-0.11961162835359573,
-0.2992270886898041,
0.01915421336889267,
-0.5729260444641113,
-0.42067909240722656,
0.10357042402029037,
0.17064815759658813,
1.168274164199829,
-0.34885451197624207,
0.49820610880851... |
func (s *Service) ApplyConfiguration(config interface{}) error {
if err := s.CheckConfiguration(config); err != nil {
return err
}
var ok bool
s.Cfg, ok = config.(Configuration)
if !ok {
return fmt.Errorf("Invalid configuration")
}
s.ServiceName = s.Cfg.Name
s.ServiceType = sdk.TypeUI
s.HTTPURL = s.Cfg.UR... | [
-0.6955822110176086,
0.18122002482414246,
0.6254239678382874,
0.2199162244796753,
-0.7190291881561279,
-0.4478679597377777,
0.6296506524085999,
0.3900409936904907,
0.868524968624115,
-0.38225606083869934,
-0.2299775779247284,
-0.8700246810913086,
0.05309342220425606,
1.5194209814071655,
... |
func (s *Service) CheckConfiguration(config interface{}) error {
sConfig, ok := config.(Configuration)
if !ok {
return fmt.Errorf("Invalid configuration")
}
if sConfig.URL == "" {
return fmt.Errorf("your CDS configuration seems to be empty. Please use environment variables, file or Consul to set your configura... | [
-0.6175305247306824,
0.0025954837910830975,
0.5674601197242737,
0.33685871958732605,
-0.38976895809173584,
-0.006483147852122784,
0.5870283246040344,
0.4230043292045593,
-0.06487742066383362,
0.8801570534706116,
-0.30996933579444885,
-0.3523726165294647,
-0.4852600693702698,
1.112287282943... |
func (s *Service) BeforeStart(ctx context.Context) error {
log.Info(ctx, "ui> Starting service %s %s...", s.Cfg.Name, sdk.VERSION)
s.StartupTime = time.Now()
fromTmpl, err := s.prepareIndexHTML()
if err != nil {
return err
}
if err := s.checkStaticFiles(ctx); err != nil {
return err
}
if fromTmpl {
// ... | [
-0.14442244172096252,
-0.04605179652571678,
0.9066964983940125,
-0.12425463646650314,
-0.06998986750841141,
0.042971689254045486,
0.12182112038135529,
0.11658036708831787,
0.2039666473865509,
-0.13915257155895233,
0.2937949001789093,
0.6414518356323242,
-0.1670764535665512,
0.8051434755325... |
func (s *Service) checkChecksumFiles() error {
log.Debug(context.Background(), "ui> checking checksum files...")
filesUI := filepath.Join(s.HTMLDir, "FILES_UI")
content, err := os.ReadFile(filesUI)
if err != nil {
return sdk.WrapError(err, "error while reading file %s", filesUI)
}
lines := strings.Split(string... | [
0.19752171635627747,
-0.5197033286094666,
0.7593765258789062,
0.3816400170326233,
-0.14066950976848602,
0.4365689754486084,
0.4589858055114746,
0.41443440318107605,
-0.07949049025774002,
0.13935205340385437,
0.3594502806663513,
0.0859353318810463,
-0.6482968330383301,
0.963164210319519,
... |
func (s *Service) prepareIndexHTML() (bool, error) {
indexTMPL := filepath.Join(s.HTMLDir, "index.tmpl")
indexTMPLFile, err := os.Open(indexTMPL)
if os.IsNotExist(err) {
return false, nil
}
defer indexTMPLFile.Close()
indexHTML := filepath.Join(s.HTMLDir, "index.html")
indexHTMLFile, err := os.Create(indexHTM... | [
-0.6397377252578735,
0.12284156680107117,
0.7557526230812073,
0.4093879461288452,
-0.6039060950279236,
0.3337547779083252,
1.1054078340530396,
0.031664468348026276,
0.12102410197257996,
1.2093368768692017,
-0.22631552815437317,
-0.4079582691192627,
-0.07654719799757004,
-0.3165768086910248... |
func (m *TunnelConfig) Validate(formats strfmt.Registry) error {
var res []error
if err := m.validateIPAddress(formats); err != nil {
// prop
res = append(res, err)
}
if err := m.validateSharedSecret(formats); err != nil {
// prop
res = append(res, err)
}
if len(res) > 0 {
return errors.CompositeVali... | [
-0.3391658067703247,
0.6098562479019165,
0.2046722173690796,
-0.6299707889556885,
0.20639769732952118,
0.20397469401359558,
0.33833783864974976,
-0.10693128407001495,
-0.8805376887321472,
0.11952279508113861,
-0.059549491852521896,
-0.10084492713212967,
-0.22026781737804413,
0.379118710756... |
func FromEnvironment(ctx context.Context, client *http.Client) func(func(string) (string, bool)) (Session, error) {
return func(lookup func(string) (string, bool)) (Session, error) {
if lookup == nil {
lookup = os.LookupEnv
}
if token, ok := lookup(EnvSpaceliftAPIToken); ok {
return FromAPIToken(ctx, clie... | [
-0.39785268902778625,
-0.5750653743743896,
0.6101495623588562,
-0.12355798482894897,
0.13417214155197144,
-0.278571754693985,
0.07363453507423401,
-0.9708410501480103,
0.134948268532753,
0.7048162221908569,
-0.2335566282272339,
-0.05364394560456276,
0.32314416766166687,
-0.0383525155484676... |
func (m *Mbox) Message() (io.ReadCloser, error) {
if m.eof {
return nil, nil
}
pr, pw := io.Pipe()
go func() {
for {
eof := !m.scanner.Scan()
if eof {
m.eof = true
break
}
line := m.scanner.Text()
if isFromLine(line) {
break
}
if isEscapedFromLine(line) {
line = line[1:] /... | [
-0.25020891427993774,
-0.2501852214336395,
0.5701358318328857,
0.0024864389561116695,
-0.8942912220954895,
0.12478554993867874,
-0.4509017765522003,
-0.8578752279281616,
-0.6142658591270447,
-0.5771171450614929,
0.7743790745735168,
-0.3957878351211548,
-0.2627517879009247,
1.1717449426651,... |
func main() {
var piggyBank float64
coins := [3]float64{0.05, 0.10, 0.25}
var coinType string
for {
amount := coins[rand.Intn(3)]
piggyBank += amount
switch amount {
case 0.05:
coinType = "nickel"
case 0.10:
coinType = "dime"
case 0.25:
coinType = "quarter"
}
if piggyBank >= 20.00 {
f... | [
0.1941382735967636,
-0.13990910351276398,
0.7876978516578674,
-0.6782307624816895,
0.835117518901825,
0.615136981010437,
0.3448602557182312,
-0.6134411096572876,
-0.183272585272789,
0.5067216157913208,
-0.571246862411499,
0.35015442967414856,
-0.6853776574134827,
-0.32899701595306396,
-0... |
func digits(n int) []int {
d := make([]int, 0, 18)
for n > 9 {
d = append(d, n%10)
n /= 10
}
return d
} | [
-0.8878878355026245,
1.22630774974823,
0.4082339406013489,
-1.2095673084259033,
1.5488910675048828,
0.04383838176727295,
-0.4879671037197113,
0.13532529771327972,
0.2198072075843811,
-0.45580992102622986,
-1.0580552816390991,
-0.04461764544248581,
0.21620313823223114,
1.0566452741622925,
... |
func f(n int) int {
sum := 0
for _, d := range digits(n) {
sum += factorial[d]
}
return sum
} | [
-0.514768660068512,
1.1633520126342773,
0.2253103107213974,
-0.22443637251853943,
0.054580386728048325,
-0.2525347173213959,
0.21745289862155914,
0.16476978361606598,
-0.3521161377429962,
-1.005676031112671,
-0.22495296597480774,
0.33379027247428894,
1.4093469381332397,
0.6106852293014526,... |
func sf(n int) int {
sum := 0
for _, d := range digits(f(n)) {
sum += d
}
return sum
} | [
0.06442905217409134,
1.8850160837173462,
0.29992666840553284,
-0.7376684546470642,
-0.4490427076816559,
-0.7795296311378479,
0.03444567695260048,
-0.23311536014080048,
-0.1159134954214096,
-1.0632116794586182,
-1.2077207565307617,
0.033797893673181534,
1.1558045148849487,
1.000190854072570... |
func g(i int) (n int) {
for n = 1; sf(n) != i; n++ {
}
return
} | [
-1.342705249786377,
1.803217887878418,
0.351786732673645,
0.4009946584701538,
-0.4255426228046417,
0.16048167645931244,
1.5939208269119263,
-0.6062114834785461,
-0.7329455614089966,
-0.47510790824890137,
-1.5579590797424316,
-0.26427018642425537,
-0.08748835325241089,
0.9114903211593628,
... |
func sg(i int) int {
sum := 0
for _, d := range digits(g(i)) {
sum += d
}
return sum
} | [
-0.5266348123550415,
1.6492562294006348,
0.5329897999763489,
-0.7731874585151672,
-0.40451353788375854,
0.26845982670783997,
0.7353807091712952,
-0.11180371791124344,
-0.2540740370750427,
0.38397037982940674,
-0.9221218824386597,
-0.007775190751999617,
0.3800719082355499,
0.260680437088012... |
func solve(n, m int) int {
sum := 0
for i := 0; i <= n; i++ {
sum += sg(i)
sum = sum % m
}
return sum
} | [
0.30686983466148376,
1.3908275365829468,
0.5065951943397522,
0.6716489195823669,
-0.26694944500923157,
-0.4556127190589905,
-0.568875253200531,
-0.89847731590271,
-0.7855367660522461,
-0.03309137001633644,
-0.6521736979484558,
-0.3744674026966095,
-1.0443779230117798,
0.5325685143470764,
... |
func NewClient(ctx *pulumi.Context,
name string, args *ClientArgs, opts ...pulumi.ResourceOption) (*Client, error) {
if args == nil {
return nil, errors.New("missing one or more required arguments")
}
if args.Brand == nil {
return nil, errors.New("invalid value for required argument 'Brand'")
}
if args.Displ... | [
-0.23100894689559937,
1.0863757133483887,
0.47914919257164,
-0.08015463501214981,
0.12285303324460983,
0.927463948726654,
0.29750433564186096,
-0.28845885396003723,
0.11923292279243469,
0.548115611076355,
-0.30919787287712097,
0.3720358610153198,
-0.3742940127849579,
-1.2405987977981567,
... |
func GetClient(ctx *pulumi.Context,
name string, id pulumi.IDInput, state *ClientState, opts ...pulumi.ResourceOption) (*Client, error) {
var resource Client
err := ctx.ReadResource("gcp:iap/client:Client", name, id, state, &resource, opts...)
if err != nil {
return nil, err
}
return &resource, nil
} | [
0.12779952585697174,
0.23349271714687347,
0.09492775797843933,
-0.25281310081481934,
0.22287335991859436,
0.6432754397392273,
0.12236659228801727,
-0.6680877208709717,
0.6894769072532654,
-0.14133603870868683,
0.21661284565925598,
1.0468487739562988,
-0.0232334416359663,
-2.118557214736938... |
func (o ClientOutput) ClientId() pulumi.StringOutput {
return o.ApplyT(func(v *Client) pulumi.StringOutput { return v.ClientId }).(pulumi.StringOutput)
} | [
1.2940139770507812,
-0.6786697506904602,
0.23004156351089478,
-0.36726051568984985,
-0.15036380290985107,
0.78767329454422,
0.8440271019935608,
-0.01830960251390934,
0.5143287181854248,
-0.25543996691703796,
0.22504082322120667,
0.9114137887954712,
0.4437393546104431,
-1.298653244972229,
... |
func (o ClientOutput) DisplayName() pulumi.StringOutput {
return o.ApplyT(func(v *Client) pulumi.StringOutput { return v.DisplayName }).(pulumi.StringOutput)
} | [
0.6333907842636108,
-0.4296853542327881,
0.39567506313323975,
-0.3728989362716675,
-0.9052688479423523,
0.9210377335548401,
0.39176252484321594,
-0.5605787038803101,
-0.1499813050031662,
0.18262702226638794,
0.17882172763347626,
0.9088878035545349,
0.33589962124824524,
-1.0383309125900269,... |
func (o ClientOutput) Secret() pulumi.StringOutput {
return o.ApplyT(func(v *Client) pulumi.StringOutput { return v.Secret }).(pulumi.StringOutput)
} | [
1.2155228853225708,
-0.3422238528728485,
0.2822708487510681,
-0.12121477723121643,
0.14400018751621246,
0.23002967238426208,
-0.00018211624410469085,
-0.08455318957567215,
-0.19901081919670105,
-0.3228490650653839,
-0.5865342617034912,
0.6472986936569214,
0.4559721052646637,
-1.45641624927... |
func TestSystem_ReportingInjection(t *testing.T) {
// Prepare a mutate-able object
pod := &corev1.Pod{
ObjectMeta: metav1.ObjectMeta{
Name: "testpod",
Namespace: "foo",
},
}
converted, err := runtime.DefaultUnstructuredConverter.ToUnstructured(pod)
if err != nil {
t.Fatal("Convert pod to unstruct... | [
-0.46744853258132935,
0.9981844425201416,
0.9337283968925476,
-0.5795485377311707,
1.2056140899658203,
-0.12588077783584595,
0.3408547341823578,
-0.4477178454399109,
-0.04958115518093109,
0.07109659910202026,
-0.7543074488639832,
-0.30260980129241943,
-0.35371503233909607,
0.17107662558555... |
func GetKaneoheTestWeather(params weather.UrlParameters) (weather.Weather, error) {
return weather.Weather{
Main: "Cloudy",
Description: "Partly cloudy",
Temp: 74.6,
City: "Kaneohe",
Units: "imperial",
}, nil
} | [
0.4467937648296356,
-0.2925880551338196,
0.3103061616420746,
-0.047702305018901825,
0.028476599603891373,
0.41532644629478455,
-0.4697425663471222,
0.1392020285129547,
-0.15804973244667053,
0.023911047726869583,
-0.055580802261829376,
0.44902849197387695,
-0.7043889164924622,
1.06997251510... |
func GetSeattleTestWeather(params weather.UrlParameters) (weather.Weather, error) {
return weather.Weather{
Main: "Rain",
Description: "Passing showers",
Temp: 64.6,
City: "Seattle",
Units: "imperial",
}, nil
} | [
0.4084725081920624,
0.02148830145597458,
0.38272711634635925,
-1.0258638858795166,
0.07776825875043869,
0.4000874161720276,
-0.17961466312408447,
-0.7891770005226135,
0.679550290107727,
-0.46515190601348877,
-0.11788129806518555,
0.9705992341041565,
-0.5853102207183838,
0.6068529486656189,... |
func GetNonexistentCityTestWeather(params weather.UrlParameters) (weather.Weather, error) {
return weather.Weather{}, errors.New("no weather for you")
} | [
0.30928340554237366,
-1.0160034894943237,
0.012630644254386425,
-0.03479573130607605,
-0.2765125036239624,
0.7754802107810974,
0.4110940098762512,
0.23456430435180664,
-0.5271421670913696,
-0.5109521746635437,
-0.06106390804052353,
-0.04615126550197601,
-1.4327213764190674,
0.9816679358482... |
func TestServerKaneohe(t *testing.T) {
t.Parallel()
s := weather.NewServer(
weather.WithPort(9000),
weather.WithLogLevel("quiet"),
)
// override the GetWeatherFromOpenWeatherMap setting that prod would use
s.GetWeather = GetKaneoheTestWeather
//goroutine to start up HTTP server
go func() {
err := s.Liste... | [
-0.008929257281124592,
0.011408304795622826,
0.8472026586532593,
0.01533510908484459,
0.5671969652175903,
0.6099597215652466,
-0.44672220945358276,
-0.017892109230160713,
-0.140555739402771,
-0.4675038158893585,
-0.2578253448009491,
0.9820114970207214,
-0.2602715790271759,
0.78915530443191... |
func (s *ProjectService) Add(project *Project) (*Project, error) {
if IsNil(project) {
return nil, internal.CreateInvalidParameterError(constants.OperationAdd, constants.ParameterProject)
}
path, err := services.GetAddPath(s, project)
if err != nil {
return nil, err
}
// Remove persistence settings if speci... | [
-1.1774941682815552,
0.36247518658638,
0.22882622480392456,
0.42247968912124634,
0.1438165307044983,
0.02463453821837902,
-0.026099352166056633,
-0.26870131492614746,
0.6255900263786316,
0.03612104803323746,
0.7396069169044495,
0.34443873167037964,
-1.0466817617416382,
-0.04371014609932899... |
func (s *ProjectService) ConvertToVcs(project *Project, commitMessage string, initialCommitBranch string, gitPersistenceSettings GitPersistenceSettings) (*Project, error) {
if project == nil {
return nil, internal.CreateInvalidParameterError("ConvertToVcs", "project")
}
if gitPersistenceSettings == nil {
return... | [
-0.4050193130970001,
0.02274238131940365,
0.4184630513191223,
-0.41287314891815186,
0.8432592749595642,
-0.21621555089950562,
-0.25986355543136597,
-0.698699951171875,
0.4308621287345886,
0.7925195097923279,
0.27741771936416626,
0.20806027948856354,
-0.8989378213882446,
0.07628173381090164... |
func (s *ProjectService) Get(projectsQuery ProjectsQuery) (*resources.Resources[*Project], error) {
v, _ := query.Values(projectsQuery)
path := s.BasePath
encodedQueryString := v.Encode()
if len(encodedQueryString) > 0 {
path += "?" + encodedQueryString
}
resp, err := api.ApiGet(s.GetClient(), new(resources.Re... | [
-0.8635866045951843,
0.14947327971458435,
0.12090078741312027,
-0.7530956864356995,
0.3345209062099457,
-0.027652960270643234,
-0.6458938121795654,
-0.3390795588493347,
0.1238587349653244,
-0.04734416678547859,
0.9986071586608887,
0.689536452293396,
-0.30786776542663574,
-0.288151204586029... |
func (s *ProjectService) GetAll() ([]*Project, error) {
items := []*Project{}
path, err := services.GetAllPath(s)
if err != nil {
return items, err
}
_, err = api.ApiGet(s.GetClient(), &items, path)
return items, err
} | [
-0.5007887482643127,
0.3850824534893036,
0.2676863968372345,
1.340704083442688,
0.6224155426025391,
0.3664665222167969,
-0.8602920770645142,
0.2486242651939392,
0.20837587118148804,
-0.09090334922075272,
0.38171377778053284,
1.4873487949371338,
-0.6107372641563416,
0.15220056474208832,
-... |
func (s *ProjectService) GetByID(id string) (*Project, error) {
if internal.IsEmpty(id) {
return nil, internal.CreateInvalidParameterError(constants.OperationGetByID, constants.ParameterID)
}
path, err := services.GetByIDPath(s, id)
if err != nil {
return nil, err
}
resp, err := api.ApiGet(s.GetClient(), ne... | [
-0.22744256258010864,
0.6055418252944946,
-0.05773263797163963,
-0.07938320934772491,
0.3266538679599762,
0.12614266574382782,
0.2194492518901825,
-0.6426059007644653,
0.49001550674438477,
0.30076321959495544,
0.1267504096031189,
1.5003083944320679,
-1.0317575931549072,
-0.4420954287052154... |
func (s *ProjectService) Update(project *Project) (*Project, error) {
if project == nil {
return nil, internal.CreateInvalidParameterError(constants.OperationUpdate, constants.ParameterProject)
}
path, err := services.GetUpdatePath(s, project)
if err != nil {
return nil, err
}
project.Links = nil
resp, err... | [
-0.9964703917503357,
0.13145843148231506,
0.19552725553512573,
-0.11940061300992966,
-0.043322812765836716,
-0.032598454505205154,
0.36542293429374695,
-0.11257240176200867,
0.41554737091064453,
0.19907939434051514,
0.5929354429244995,
0.3406389355659485,
-1.2210129499435425,
-0.3984263837... |
func (s *ProjectService) UpdateWithGitRef(project *Project, gitRef string) (*Project, error) {
if project == nil {
return nil, internal.CreateInvalidParameterError("UpdateWithGitRef", "project")
}
if project.PersistenceSettings == nil || project.PersistenceSettings.Type() != PersistenceSettingsTypeVersionControll... | [
-0.43029478192329407,
-0.16991101205348969,
0.05749093368649483,
-0.8995802402496338,
-0.23773479461669922,
-0.41308921575546265,
-0.14941318333148956,
-0.37682995200157166,
0.015488537028431892,
1.1640691757202148,
0.08017586171627045,
0.3994096517562866,
-1.4792872667312622,
-0.322873651... |
func NewCqlStore(config Cassandra) (*CqlStore, error) {
cluster := gocql.NewCluster(config.Endpoints...)
cluster.ProtoVersion = 4
if config.Port > 0 {
cluster.Port = config.Port
}
/*cluster.Keyspace = "system"
controlSession, err := cluster.CreateSession()
if err != nil {
return nil, NewStoreCreationError(er... | [
0.48639774322509766,
-0.2818358838558197,
0.31104663014411926,
0.1503296047449112,
-0.7863438725471497,
0.6175159811973572,
-0.17975378036499023,
-0.2805190086364746,
0.0757446438074112,
0.34442466497421265,
-0.3684217929840088,
-0.3043464124202728,
-0.38436365127563477,
-0.126358985900878... |
func (s *CqlStore) Write(item Item) error {
if item.IsEmpty() {
return NewEmptyItemError()
}
if s.session == nil {
return NewStoreClosedError()
}
b, err := json.Marshal(item.Contents)
if err != nil {
return NewItemMarshallError(err)
}
err = s.session.Query("insert into items (id, updated, status, type, na... | [
-1.3017340898513794,
-0.29665297269821167,
0.7476555705070496,
-0.041477885097265244,
0.49404463171958923,
0.5052815079689026,
0.1799767017364502,
-0.09384053945541382,
0.21788251399993896,
0.46608471870422363,
-1.1407415866851807,
-0.981814980506897,
-0.6001343727111816,
-0.53158056735992... |
func (s *CqlStore) Read(id ID) (Item, error) {
var item Item
sts, err := s.History(id, 1)
if err != nil {
return item, err
}
if len(sts) == 1 && sts[0].Status == "ALIVE" {
item = sts[0].Item
}
return item, nil
} | [
0.2735323905944824,
-0.3306596875190735,
0.5971633195877075,
0.4327610433101654,
-0.7915028929710388,
0.6047489047050476,
-0.26966485381126404,
-0.4973246455192566,
0.42212429642677307,
0.01112675853073597,
0.48010510206222534,
0.1264958381652832,
-0.35291826725006104,
-0.4823209047317505,... |
func (s *CqlStore) History(id ID, limit int) ([]Status, error) {
if s.session == nil {
return []Status{}, NewStoreClosedError()
}
var items []Status
var errors []string
iter := s.session.Query("select status, type, name, contents from items where id=? order by updated desc limit ?", IDToString(id), limit).Iter()... | [
-0.3788100481033325,
-0.0030252840369939804,
0.6318629384040833,
-0.08307307213544846,
-0.7303608059883118,
-0.4350610077381134,
-0.3060828149318695,
-0.05687921121716499,
0.44135981798171997,
0.2139183133840561,
-0.8054636120796204,
0.315462589263916,
0.5613351464271545,
-0.07005062699317... |
func (s *CqlStore) Delete(id ID) error {
if s.session == nil {
return NewStoreClosedError()
}
err := s.session.Query("insert into items (id, updated, status) values(?,now(),?)",
IDToString(id), "DELETED").Exec()
if err != nil {
return errors.Wrap(err, 0)
}
return nil
} | [
0.19622117280960083,
0.2124030590057373,
0.4099060893058777,
0.1865459680557251,
-0.16771815717220306,
0.31113266944885254,
-0.28298419713974,
0.22426681220531464,
0.7764915823936462,
0.3305026590824127,
-0.7707107067108154,
-0.7250414490699768,
-0.7511916160583496,
-0.2427244633436203,
... |
func TestKeygenWithTooLargeNetID(t *testing.T) {
storage := memstore.NewMemoryKeySequenceStorage(0, 0)
// 25 bytes are used for the ID
// MA-S is 36 bits, 64-36-25=3 bits for NetID
maSmall, err := protocol.NewMA([]byte{1, 2, 3, 4, 5})
if err != nil {
t.Fatal("Could not create MA-S EUI: ", err)
}
_, err = New... | [
-0.07454204559326172,
0.46712926030158997,
0.7096714973449707,
-0.1992419809103012,
0.3222806751728058,
0.8494641184806824,
-0.05616520717740059,
-0.06428205966949463,
0.3629150390625,
-0.5736664533615112,
-0.406826913356781,
-0.4623846113681793,
-0.06157663092017174,
0.7098578810691833,
... |
func TestKeygenWithDifferentNetID(t *testing.T) {
storage := memstore.NewMemoryKeySequenceStorage(0, 0)
// Use the same MA for both
ma, _ := protocol.NewMA([]byte{0, 1, 2, 3, 4})
keygen1, _ := NewEUIKeyGenerator(ma, 0, storage)
keygen2, _ := NewEUIKeyGenerator(ma, 1, storage)
eui1 := make([]protocol.EUI, 0)
eui... | [
-0.6427285075187683,
0.6187148094177246,
0.7812107801437378,
0.4752761423587799,
0.7441652417182922,
0.39016401767730713,
0.7728049159049988,
-0.4634906053543091,
-0.16147580742835999,
-0.09601648151874542,
-0.43543681502342224,
-0.5211547017097473,
0.15586940944194794,
0.6775044202804565,... |
func TestAppEUIWithTooLargeID(t *testing.T) {
storage := &BigNumberSeq{mutex: &sync.Mutex{}}
// Use the same MA for both
ma, _ := protocol.NewMA([]byte{0, 1, 2, 3, 4})
keygen, _ := NewEUIKeyGenerator(ma, 0, storage)
// This will fail with a panic
_, err := keygen.NewAppEUI()
if err == nil {
t.Fatal("Did not ... | [
-0.4051313102245331,
0.8002756834030151,
0.4552285671234131,
-0.2679522633552551,
0.21682801842689514,
0.7148280739784241,
-0.029850445687770844,
-0.1959756463766098,
0.16470374166965485,
0.002661184873431921,
-0.4402247965335846,
-0.779852569103241,
0.31039464473724365,
0.221230149269104,... |
func TestFailingSequence(t *testing.T) {
storage := &FailingSeq{fails: 0, maxfails: 2, mutex: &sync.Mutex{}}
ma, _ := protocol.NewMA([]byte{0, 1, 2})
keygen, _ := NewEUIKeyGenerator(ma, 0, storage)
for i := 0; i < 30; i++ {
keygen.NewDeviceEUI()
}
} | [
-1.5460388660430908,
1.153806209564209,
0.44056281447410583,
0.4608854651451111,
0.14311723411083221,
0.17250774800777435,
0.44562476873397827,
-0.18793776631355286,
-0.3121210038661957,
-0.4692190885543823,
-0.607947587966919,
-0.7005007266998291,
-0.17407935857772827,
0.8034307360649109,... |
func TestLazyInvocation(t *testing.T) {
ksStorage := memstore.NewMemoryKeySequenceStorage(0, 0)
ma, _ := protocol.NewMA([]byte{0, 1, 2, 3, 4})
netID := uint32(0)
identifier := "neteui"
// Start by allocating keys directly
name := fmt.Sprintf("%s/%04x/%s", ma.String(), netID, identifier)
ch, err := ksStorage.All... | [
-0.39912158250808716,
1.0192599296569824,
0.8993919491767883,
0.03636074438691139,
0.49553996324539185,
-0.4441356956958771,
0.45977839827537537,
-0.7371292114257812,
-0.01360289566218853,
-0.5488399267196655,
-0.29133862257003784,
-0.42651817202568054,
-0.10205806791782379,
0.432523101568... |
func BenchmarkKeygen(b *testing.B) {
seqStorage := memstore.NewMemoryKeySequenceStorage(0, 0)
ma, _ := protocol.NewMA([]byte{5, 4, 3, 2, 1})
netID := uint32(1)
memkeyGenerator, _ := NewEUIKeyGenerator(ma, netID, seqStorage)
for i := 0; i < b.N; i++ {
_, err := memkeyGenerator.NewAppEUI()
if err != nil {
b.... | [
0.04139053449034691,
1.0655694007873535,
0.5149890184402466,
-0.060974106192588806,
0.9158788919448853,
-0.4399961531162262,
0.7227259278297424,
-0.25933563709259033,
-0.754161536693573,
-0.06331397593021393,
0.18517184257507324,
-0.6528564095497131,
-0.5503348112106323,
0.7741550803184509... |
func (l Label) Normalize() (*Label, error) {
return &l, validate.Many(
validate.OneOf("TargetType", l.Target.TargetType(), assignment.TargetTypeService),
validate.UUID("TargetID", l.Target.TargetID()),
validate.LabelKey("Key", l.Key),
validate.LabelValue("Value", l.Value),
)
} | [
-1.3321884870529175,
0.04953662306070328,
0.4040777087211609,
-0.06022200360894203,
0.303257018327713,
0.3423515558242798,
-0.5467146039009094,
-0.16769470274448395,
-0.013872773386538029,
0.7186300754547119,
0.9472955465316772,
0.010172232985496521,
-0.5084675550460815,
-0.318695336580276... |
func NewNode(port int) (host.Host, error) {
opts := []libp2p.Option{
libp2p.ListenAddrStrings(fmt.Sprintf("/ip4/127.0.0.1/tcp/%d", port)),
}
h, err := libp2p.New(context.Background(), opts...)
if err != nil {
return nil, err
}
addr := h.Addrs()[0]
maAddr, _ := ma.NewMultiaddr(fmt.Sprintf("/%s/%s", protoco... | [
-0.23658449947834015,
-0.18219032883644104,
0.6401278972625732,
-0.5354868769645691,
-0.363777220249176,
-0.37170642614364624,
-0.2840495705604553,
0.10287196189165115,
-0.09725646674633026,
0.345167338848114,
0.238547682762146,
0.3693564534187317,
-0.10064814984798431,
-0.3784184157848358... |
func (dev *Device) keepAlive(keepalive int64) {
defer dev.Close()
ticker := time.NewTicker(time.Second * time.Duration(keepalive))
defer ticker.Stop()
last := time.Now().Unix()
keepalive = keepalive * 3
/* Get the current ping handler */
pingHandler := dev.ws.PingHandler()
dev.ws.SetPingHandler(func(appData... | [
-0.37246763706207275,
-0.4016420245170593,
0.956152617931366,
0.6407454609870911,
-0.20817981660366058,
1.212339997291565,
0.4528508186340332,
-1.0564720630645752,
-0.2700267732143402,
0.2599990963935852,
-0.065822072327137,
-0.3909263014793396,
-0.73468017578125,
0.03736541047692299,
0.... |
func New(Read func(buf []byte) (n int, err error), seed []byte, netPrefix byte, db *database.DB, password, seedFile string, secretKey *keys.SecretKey) (*Wallet, error) {
// create new seed if seed comes empty
if len(seed) == 0 {
var err error
seed, err = GenerateNewSeed(Read)
if err != nil {
return nil, err... | [
0.21376918256282806,
-0.8336721658706665,
0.5995514392852783,
-0.19616539776325226,
-0.9457285404205322,
-0.45990216732025146,
-0.3565482795238495,
-0.1792694479227066,
-0.0820818692445755,
0.23163245618343353,
-0.10281973332166672,
-0.04716246575117111,
0.33272114396095276,
0.409847050905... |
func LoadFromSeed(netPrefix byte, db *database.DB, password, seedFile string, keysJSON KeysJSON) (*Wallet, error) {
if len(keysJSON.Seed) < 64 {
return nil, errors.New("seed must be at least 64 bytes in size")
}
secretKey := keys.NewSecretKey()
err := keys.UnmarshalSecretKey(bytes.NewBuffer(keysJSON.SecretKey),... | [
0.39869049191474915,
-0.2850261330604553,
0.5747490525245667,
-0.5169274210929871,
-0.6986461877822876,
-0.18046356737613678,
-0.9361158013343811,
-0.3502194881439209,
0.440358430147171,
0.5199904441833496,
-0.36811771988868713,
-0.2962079644203186,
-0.4928940534591675,
0.533348798751831,
... |
func LoadFromFile(netPrefix byte, db *database.DB, password string, seedFile string) (*Wallet, error) {
keysJSONArr, err := fetchEncrypted(password, seedFile)
if err != nil {
return nil, err
}
// transform []byte to keysJSON
keysJSON := new(KeysJSON)
err = json.Unmarshal(keysJSONArr, keysJSON)
if err != nil ... | [
0.2535322308540344,
-0.16787023842334747,
0.6128237247467041,
-0.5719418525695801,
-0.7988888025283813,
0.18872785568237305,
-0.7582279443740845,
-0.25462889671325684,
-0.13834862411022186,
0.654992938041687,
-0.4212331473827362,
-0.6181964874267578,
-0.5220203995704651,
0.4447586834430694... |
func (w *Wallet) FetchTxHistory() ([]txrecords.TxRecord, error) {
return w.db.FetchTxRecords()
} | [
0.9654132127761841,
0.824306845664978,
0.21686288714408875,
-0.4438974857330322,
-0.9375231862068176,
-0.32074934244155884,
-0.9421631693840027,
-0.5624555349349976,
0.4699806869029999,
1.1298391819000244,
-0.2780580222606659,
-0.4949554204940796,
-0.09594044089317322,
0.8400376439094543,
... |
func (w *Wallet) Keys() consensuskey.Keys {
return *w.consensusKeys
} | [
-1.042941927909851,
0.032070059329271317,
0.11820250004529953,
-0.64214688539505,
0.5796580910682678,
0.008383439853787422,
-1.1285920143127441,
-0.457223117351532,
-0.1397634893655777,
0.7537270784378052,
0.5186354517936707,
0.3653078079223633,
-0.9121955633163452,
0.20108450949192047,
... |
func (w *Wallet) ClearDatabase() error {
return w.db.Clear()
} | [
-0.018614374101161957,
0.8828411102294922,
0.12241139262914658,
0.16857311129570007,
-0.06689926236867905,
0.25394687056541443,
-0.9686826467514038,
-0.5970052480697632,
0.7141233682632446,
1.083167552947998,
0.2572990655899048,
-0.07568016648292542,
-1.0796897411346436,
0.6503790616989136... |
func (w *Wallet) ToKey(address string) (keys.PublicKey, error) {
return keys.PublicKey{}, nil
} | [
0.18256103992462158,
0.37503987550735474,
0.3915783166885376,
0.19882610440254211,
0.05380605533719063,
-0.5392609238624573,
0.11458005011081696,
0.10552342981100082,
0.9785323143005371,
1.4146784543991089,
-0.7078295946121216,
0.24871677160263062,
-0.33845967054367065,
-0.2935126423835754... |
func GenerateNewSeed(Read func(buf []byte) (n int, err error)) ([]byte, error) {
var seed []byte
if Read == nil {
Read = rand.Read
}
for {
// random seed
seed = make([]byte, 64)
_, err := Read(seed)
if err != nil {
return nil, err
}
// Ensure the seed can be used for generating a BLS keypair.
... | [
0.051690373569726944,
-0.07109867036342621,
0.6917448043823242,
-0.043543994426727295,
-0.7477096915245056,
-0.3968076705932617,
-0.0582917220890522,
-0.695044219493866,
0.014080826193094254,
0.04955284669995308,
0.22529271245002747,
0.12288492918014526,
-0.43610286712646484,
0.57757312059... |
func TouchDir(dir string) error {
if _, err := os.Stat(dir); os.IsNotExist(err) {
return os.MkdirAll(dir, 0775)
}
return nil
} | [
0.0787808895111084,
0.7700428366661072,
0.8389272689819336,
0.01385941356420517,
-0.5111027359962463,
1.1146687269210815,
0.8235911726951599,
0.09515590220689774,
0.7946736216545105,
-0.47432807087898254,
-0.03143630176782608,
-1.056275486946106,
0.49925366044044495,
0.8850567936897278,
... |
func TransportWithProbe() {
probes=0
if maxprobes == true {
celestial = GetCachedCelestial(from)
ships, _ = GetShips(celestial.GetID())
Print("Found " + ships.EspionageProbe + " Spy probes ")
probes = ships.EspionageProbe
} else {
probes = fixedprobes
}
for... | [
-0.884876012802124,
0.21769428253173828,
0.8474036455154419,
0.33954036235809326,
0.4049512445926666,
-0.4087344706058502,
0.5837746858596802,
-0.582076907157898,
0.1276434361934662,
0.5469498634338379,
-0.6388872265815735,
-0.24257372319698334,
-0.394368439912796,
0.18247924745082855,
0... |
func NewProducts(logger *log.Logger) *Products {
return &Products{logger}
} | [
-0.15554121136665344,
-0.6370387673377991,
0.11179452389478683,
0.05691694840788841,
-0.41271743178367615,
-0.3461644649505615,
0.35587960481643677,
-1.2984869480133057,
0.6836545467376709,
-0.5873810648918152,
-0.16314393281936646,
0.23021090030670166,
-0.12793424725532532,
0.721763491630... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.