text stringlengths 11 6.3k | embedding listlengths 768 768 |
|---|---|
func (das *DrugAllergySelect) Int(ctx context.Context) (_ int, err error) {
var v []int
if v, err = das.Ints(ctx); err != nil {
return
}
switch len(v) {
case 1:
return v[0], nil
case 0:
err = &NotFoundError{drugallergy.Label}
default:
err = fmt.Errorf("ent: DrugAllergySelect.Ints returned %d results when... | [
-0.6842229962348938,
0.027831943705677986,
0.2517225444316864,
-1.2081457376480103,
0.5315014719963074,
-0.3508955240249634,
0.3053632974624634,
-0.6581248044967651,
-0.6571255326271057,
0.29057803750038147,
0.9160809516906738,
0.41027483344078064,
0.38005635142326355,
-0.5165799260139465,... |
func (das *DrugAllergySelect) IntX(ctx context.Context) int {
v, err := das.Int(ctx)
if err != nil {
panic(err)
}
return v
} | [
-0.22503431141376495,
0.4096497893333435,
0.17550641298294067,
-0.44479191303253174,
-0.11236865818500519,
0.4072335362434387,
-0.2023429423570633,
-0.3500601351261139,
0.2624587416648865,
0.040624555200338364,
0.7202871441841125,
0.9177839159965515,
0.11296507716178894,
-1.013408303260803... |
func (das *DrugAllergySelect) Float64s(ctx context.Context) ([]float64, error) {
if len(das.fields) > 1 {
return nil, errors.New("ent: DrugAllergySelect.Float64s is not achievable when selecting more than 1 field")
}
var v []float64
if err := das.Scan(ctx, &v); err != nil {
return nil, err
}
return v, nil
} | [
-0.8278518915176392,
0.42727914452552795,
0.3215778172016144,
-0.08127763867378235,
0.7687901854515076,
-0.8292250633239746,
-0.3609989285469055,
-0.9089727401733398,
0.14307914674282074,
0.09124274551868439,
0.4013896584510803,
0.91413414478302,
-0.10267799347639084,
0.22511303424835205,
... |
func (das *DrugAllergySelect) Float64sX(ctx context.Context) []float64 {
v, err := das.Float64s(ctx)
if err != nil {
panic(err)
}
return v
} | [
-0.2790272831916809,
0.3445015549659729,
0.07338236272335052,
0.5548672676086426,
0.24957628548145294,
-0.5870081186294556,
-1.1011031866073608,
-0.3671916723251343,
0.37663909792900085,
0.25861355662345886,
0.1503312885761261,
0.5404589176177979,
0.08484841883182526,
-0.058267462998628616... |
func (das *DrugAllergySelect) Float64(ctx context.Context) (_ float64, err error) {
var v []float64
if v, err = das.Float64s(ctx); err != nil {
return
}
switch len(v) {
case 1:
return v[0], nil
case 0:
err = &NotFoundError{drugallergy.Label}
default:
err = fmt.Errorf("ent: DrugAllergySelect.Float64s retu... | [
-0.8467939496040344,
0.11942819505929947,
0.29685452580451965,
0.16755491495132446,
1.4107916355133057,
-0.9842257499694824,
0.39008602499961853,
-0.5635327696800232,
0.016777822747826576,
-0.05535908043384552,
1.0330032110214233,
0.21691946685314178,
0.1412278711795807,
0.1247119084000587... |
func (das *DrugAllergySelect) Float64X(ctx context.Context) float64 {
v, err := das.Float64(ctx)
if err != nil {
panic(err)
}
return v
} | [
-0.35452261567115784,
0.42075464129447937,
0.10419274866580963,
0.274617463350296,
0.1677989661693573,
-0.10556545108556747,
-0.31683480739593506,
-0.6742377281188965,
0.2111465036869049,
-0.23655015230178833,
0.43510064482688904,
0.2638449966907501,
0.19203878939151764,
-0.130110040307044... |
func (das *DrugAllergySelect) Bools(ctx context.Context) ([]bool, error) {
if len(das.fields) > 1 {
return nil, errors.New("ent: DrugAllergySelect.Bools is not achievable when selecting more than 1 field")
}
var v []bool
if err := das.Scan(ctx, &v); err != nil {
return nil, err
}
return v, nil
} | [
-1.0059462785720825,
0.5928981304168701,
0.30405211448669434,
-0.5709286332130432,
0.9587286710739136,
0.1090615764260292,
-0.4065468907356262,
-0.5367237329483032,
-0.14679540693759918,
0.061505865305662155,
0.7575289011001587,
0.6461493372917175,
0.47283560037612915,
-0.5573143362998962,... |
func (das *DrugAllergySelect) BoolsX(ctx context.Context) []bool {
v, err := das.Bools(ctx)
if err != nil {
panic(err)
}
return v
} | [
-0.15259602665901184,
0.297213077545166,
0.30752015113830566,
0.12041685730218887,
-0.22104313969612122,
0.3960636854171753,
-1.0707452297210693,
-0.4857846200466156,
0.043968409299850464,
0.5798145532608032,
0.15186923742294312,
0.7931044101715088,
0.6971014142036438,
-0.6910898089408875,... |
func (das *DrugAllergySelect) Bool(ctx context.Context) (_ bool, err error) {
var v []bool
if v, err = das.Bools(ctx); err != nil {
return
}
switch len(v) {
case 1:
return v[0], nil
case 0:
err = &NotFoundError{drugallergy.Label}
default:
err = fmt.Errorf("ent: DrugAllergySelect.Bools returned %d results... | [
-0.522994339466095,
0.11166059970855713,
0.2600858807563782,
-0.28507480025291443,
1.187934160232544,
0.15560202300548553,
0.4513723850250244,
0.09477346390485764,
-0.06081477925181389,
0.37361395359039307,
0.7471299767494202,
0.40071460604667664,
0.7849489450454712,
-0.8080973029136658,
... |
func (das *DrugAllergySelect) BoolX(ctx context.Context) bool {
v, err := das.Bool(ctx)
if err != nil {
panic(err)
}
return v
} | [
0.10311881452798843,
0.28483790159225464,
0.32507431507110596,
-0.33674246072769165,
-0.00719332043081522,
1.1383085250854492,
-0.604155421257019,
-0.13250881433486938,
0.18132111430168152,
0.37742024660110474,
0.11437597125768661,
0.6576788425445557,
0.57594895362854,
-1.0617643594741821,... |
func (p *FactoidPlugin) registerWeb() {
r := chi.NewRouter()
r.HandleFunc("/api", p.serveAPI)
r.HandleFunc("/req", p.serveQuery)
r.HandleFunc("/", p.serveQuery)
p.b.RegisterWebName(r, "/factoid", "Factoid")
} | [
-0.09296951442956924,
0.3611423075199127,
0.4663027822971344,
1.7236322164535522,
1.6914421319961548,
-0.008519108407199383,
1.1306793689727783,
0.6486014127731323,
-0.2721646726131439,
-0.5906476378440857,
-0.6166703701019287,
0.17275215685367584,
-0.2251194417476654,
1.328667163848877,
... |
func Paste() string {
return paste()
} | [
-0.4957261085510254,
-0.14524272084236145,
0.11878149956464767,
0.0341549888253212,
-1.2740062475204468,
0.14830851554870605,
-0.6148450374603271,
-0.559844434261322,
-0.4890166223049164,
0.6240478754043579,
0.47068262100219727,
-0.7647861242294312,
-0.1497805416584015,
-0.2151879966259002... |
func About(w http.ResponseWriter, r *http.Request) *s.HandlerError {
// TODO: replace this with a document store instead of hardcoded data.
b, err := json.Marshal(map[string]interface{}{
"Name": "Zak",
"Job": "Developer",
})
if err != nil {
return s.NewError(err)
}
w.Write(b)
return nil
} | [
-0.32110145688056946,
-0.4274336099624634,
0.590711236000061,
-0.15425662696361542,
-0.10304366797208786,
-0.6559393405914307,
0.04618774726986885,
0.31630173325538635,
-0.6445982456207275,
0.18601931631565094,
0.23198311030864716,
-0.08604147285223007,
0.3890456259250641,
0.60861515998840... |
func NewLogger() Logger {
depth := 6
return new(&depth)
} | [
0.1469198614358902,
0.3703046441078186,
0.17107348144054413,
0.41655808687210083,
-0.7265442609786987,
-0.4395279288291931,
0.14557723701000214,
-0.44680556654930115,
0.2653454542160034,
-1.0624427795410156,
-0.5805650949478149,
-0.18704210221767426,
-0.29807716608047485,
1.184451699256897... |
func NewLoggerWithOptions(opts Options) Logger {
return &standard{
Level: TraceLevel,
logctx: make(map[context.Context]fields),
logkey: make(map[interface{}]fields),
formatter: opts.Formatter,
writer: opts.Writer,
}
} | [
-0.10076987743377686,
-0.5319497585296631,
0.47390109300613403,
-0.06843839585781097,
-0.8964137434959412,
-0.4182089567184448,
-1.3200139999389648,
-0.5936164259910583,
0.6621851325035095,
0.15199166536331177,
-0.6164327263832092,
-0.3486834466457367,
-0.44995102286338806,
0.1407472044229... |
func (s CreateByteMatchSetInput) String() string {
return awsutil.Prettify(s)
} | [
0.7158024311065674,
-0.27506187558174133,
0.055793434381484985,
-1.073289394378662,
-0.3136885464191437,
0.9643215537071228,
1.1084834337234497,
-1.7119392156600952,
-0.27387329936027527,
-0.0679052472114563,
0.15767601132392883,
1.0115712881088257,
0.08057955652475357,
-0.6899899244308472... |
func (s *CreateByteMatchSetInput) Validate() error {
invalidParams := aws.ErrInvalidParams{Context: "CreateByteMatchSetInput"}
if s.ChangeToken == nil {
invalidParams.Add(aws.NewErrParamRequired("ChangeToken"))
}
if s.ChangeToken != nil && len(*s.ChangeToken) < 1 {
invalidParams.Add(aws.NewErrParamMinLen("Chan... | [
0.04340473189949989,
-0.030253104865550995,
0.5140964388847351,
-0.9012300372123718,
-0.09476739913225174,
0.1622115671634674,
0.06417758762836456,
-1.0700390338897705,
-0.5794625282287598,
-0.006560749374330044,
0.04536888003349304,
0.8784313201904297,
-0.54664546251297,
0.581463038921356... |
func (s CreateByteMatchSetOutput) String() string {
return awsutil.Prettify(s)
} | [
1.0977320671081543,
-0.5936890840530396,
0.02441597357392311,
-0.8692771792411804,
-0.6225128769874573,
0.28245553374290466,
1.149358868598938,
-1.6565443277359009,
-0.5636792182922363,
-0.1931612342596054,
0.2817539870738983,
0.6403219103813171,
0.2764606475830078,
-0.8612526059150696,
... |
func (r CreateByteMatchSetRequest) Send(ctx context.Context) (*CreateByteMatchSetResponse, error) {
r.Request.SetContext(ctx)
err := r.Request.Send()
if err != nil {
return nil, err
}
resp := &CreateByteMatchSetResponse{
CreateByteMatchSetOutput: r.Request.Data.(*CreateByteMatchSetOutput),
response: ... | [
-0.45705392956733704,
0.12077348679304123,
0.2904336154460907,
-0.5506471991539001,
0.0900489017367363,
0.07771117240190506,
0.17270132899284363,
-1.5514620542526245,
-0.12182275950908661,
-0.41911834478378296,
-0.41959404945373535,
1.1694082021713257,
-0.8063223361968994,
-0.4609366655349... |
func (r *CreateByteMatchSetResponse) SDKResponseMetdata() *aws.Response {
return r.response
} | [
0.569869875907898,
-0.07038255780935287,
0.09392019361257553,
-1.0076227188110352,
0.11319658905267715,
0.4955923855304718,
-0.298414021730423,
-1.1161351203918457,
0.5246894359588623,
-0.33414050936698914,
-0.6021281480789185,
-0.11450138688087463,
-0.07752887904644012,
-1.180528044700622... |
func BoiMe(program []string) *Gameboi {
g := Gameboi{}
instructions := parseInstructions(program)
g.program = instructions
return &g
} | [
-0.558276355266571,
0.44476354122161865,
0.4823647737503052,
-0.04368928447365761,
-0.33076921105384827,
0.5754548907279968,
-1.1493351459503174,
-0.4159935414791107,
-0.9612398147583008,
0.7625296115875244,
-0.6755529046058655,
-0.868048906326294,
-1.1221603155136108,
-0.3194694519042969,... |
func (g *Gameboi) Step() bool {
i := g.program[g.instrPointer]
switch i.cmd {
case "acc":
g.doAcc(i.params[0])
case "jmp":
g.doJmp(i.params[0])
case "nop":
g.doNop()
}
if g.instrPointer == int64(len(g.program)) {
return true
}
return false
} | [
-0.3882896900177002,
0.8987187743186951,
0.5638717412948608,
0.031671591103076935,
0.3182055652141571,
0.3317123353481293,
0.7652348875999451,
-0.8019083738327026,
-0.9514281749725342,
-0.17222291231155396,
-0.17234773933887482,
-0.20610864460468292,
-0.623201310634613,
0.4831717908382416,... |
func (g *Gameboi) GetInstructionPointer() int64 {
return g.instrPointer
} | [
-0.5170875787734985,
-0.1411089301109314,
0.39265984296798706,
0.3112291693687439,
0.37674012780189514,
0.27572256326675415,
1.1760005950927734,
-0.8562353253364563,
-0.4664514660835266,
0.5524221658706665,
1.0993160009384155,
-0.12448447942733765,
-1.3043731451034546,
-0.3841719925403595,... |
func (g *Gameboi) GetAccumulator() int64 {
return g.acc
} | [
-0.15730321407318115,
1.0048573017120361,
0.5836768746376038,
0.017617225646972656,
-0.6463228464126587,
-0.4702272117137909,
0.3324268162250519,
-0.49279817938804626,
-0.32185304164886475,
-0.45967578887939453,
1.0152106285095215,
0.6843295693397522,
-0.1883402317762375,
0.303235918283462... |
func (g *Gameboi) GetProgram() []string {
out := make([]string, len(g.program))
for i, line := range g.program {
out[i] = fmt.Sprintf("%d: %#v", i, line)
}
return out
} | [
-0.48662734031677246,
-0.07472701370716095,
0.5404444336891174,
-0.016299201175570488,
1.1303280591964722,
0.5100972652435303,
-0.6413503885269165,
-0.2855536937713623,
-0.3298823833465576,
1.2901843786239624,
0.11344167590141296,
0.7356390953063965,
-0.529479444026947,
-0.1824460774660110... |
func (g *Gameboi) GetState() string {
return fmt.Sprintf("Acc: %d Ptr: %d Instr: %#v\n", g.acc, g.instrPointer, g.program[g.instrPointer])
} | [
0.4712839126586914,
-0.22695226967334747,
0.4985310137271881,
-0.25097015500068665,
0.18712997436523438,
0.3402986526489258,
0.6103836894035339,
-1.0288105010986328,
-0.7445619106292725,
0.3505583107471466,
0.9417663812637329,
0.7906576991081238,
-0.6333215832710266,
-0.0895702913403511,
... |
func (self *ControllerCommunicatorForApp) Connect(
to_who *common_types.Address,
as_service string,
to_service string,
) (
*net.Conn,
error,
) {
return nil, nil
} | [
-0.0066889747977256775,
-0.5186614394187927,
0.5480457544326782,
0.3877778649330139,
-0.14487186074256897,
0.11616996675729752,
-0.32331162691116333,
-0.6939623951911926,
-0.19000014662742615,
-0.09849680960178375,
1.0067847967147827,
-0.2809235155582428,
0.28209468722343445,
0.46416467428... |
func newCompressedPublicKey(spk types.SiaPublicKey) (cpk compressedPublicKey, _ error) {
if len(spk.Key) != len(cpk.Key) {
return cpk, errors.New("newCompressedPublicKey: unsupported key length")
}
if spk.Algorithm != types.SignatureEd25519 {
return cpk, errors.New("newCompressedPublicKey: unsupported signature ... | [
0.3910430073738098,
-0.1367087960243225,
0.23006786406040192,
1.5284751653671265,
-1.6948963403701782,
-0.09566149115562439,
0.9151458740234375,
-0.10765120387077332,
0.2988690435886383,
0.571953296661377,
-0.6954946517944336,
-0.2491188496351242,
-0.6899008750915527,
1.4426902532577515,
... |
func newSiaPublicKey(cpk compressedPublicKey) (spk types.SiaPublicKey, _ error) {
if cpk.Algorithm != signatureEd25519 {
return spk, errors.New("newSiaPublicKey: unknown signature algorithm")
}
spk.Algorithm = types.SignatureEd25519
spk.Key = append([]byte{}, cpk.Key[:]...)
return
} | [
0.3719351589679718,
-0.027851613238453865,
0.11324134469032288,
0.9673328995704651,
-0.7109217047691345,
-0.9093607664108276,
0.8683920502662659,
-0.047777142375707626,
0.3962148427963257,
0.3843354284763336,
-0.9456748366355896,
-0.44572970271110535,
-0.04028983414173126,
1.03091609477996... |
func initRegistry(path string, maxEntries uint64) (*os.File, error) {
f, err := os.OpenFile(path, os.O_RDWR|os.O_CREATE|os.O_EXCL, modules.DefaultFilePerm)
if err != nil {
return nil, errors.AddContext(err, "failed to create new file for key/value store")
}
// Truncate the file to its max size.
err = f.Truncate... | [
0.24107186496257782,
0.40887442231178284,
0.5497778058052063,
-0.2995072305202484,
0.6413742303848267,
-0.15919242799282074,
0.7716706991195679,
0.5660481452941895,
-0.5129570960998535,
0.4148825407028198,
0.1961994767189026,
0.6915217041969299,
0.4580593705177307,
0.17534834146499634,
0... |
func loadRegistryMetadata(r io.Reader, b bitfield) error {
// Check version. We only have one so far so we can compare to that
// directly.
var entry [PersistedEntrySize]byte
_, err := io.ReadFull(r, entry[:])
if err != nil {
return errors.AddContext(err, "failed to read metadata page")
}
version := entry[:typ... | [
-0.48305410146713257,
0.21342810988426208,
0.26862388849258423,
-0.505206823348999,
0.3997780382633209,
0.0836363285779953,
0.3528178632259369,
-0.058534275740385056,
0.2293240875005722,
1.4445642232894897,
-0.4689735174179077,
0.3493187129497528,
-0.4976577162742615,
0.6023398637771606,
... |
func loadRegistryEntries(r io.Reader, numEntries int64, b bitfield, upgradeV100 bool) (map[modules.RegistryEntryID]*value, error) {
// Load the remaining entries.
var entry [PersistedEntrySize]byte
entries := make(map[modules.RegistryEntryID]*value)
for index := int64(1); index < numEntries; index++ {
_, err := i... | [
-0.8875771164894104,
0.08841896802186966,
0.49282142519950867,
-0.4123634696006775,
0.24536843597888947,
-0.8068325519561768,
0.6356935501098633,
-0.05413174629211426,
0.11985601484775543,
1.0368022918701172,
-0.2362363636493683,
0.26570186018943787,
-0.7891366481781006,
0.6662760376930237... |
func newPersistedEntry(value *value) (persistedEntry, error) {
if len(value.data) > modules.RegistryDataSize {
build.Critical("newPersistedEntry: called with too much data")
return persistedEntry{}, errors.New("value's data is too large")
}
cpk, err := newCompressedPublicKey(value.key)
if err != nil {
return ... | [
0.6369938850402832,
-0.22213596105575562,
0.46216604113578796,
0.36297541856765747,
-1.0771740674972534,
0.13651373982429504,
0.21379168331623077,
0.00019466658704914153,
1.0746541023254395,
0.5533149838447571,
-0.21976281702518463,
0.3710211515426636,
-1.0335097312927246,
0.65599960088729... |
func writeMetadata(f *os.File) error {
// The first entry is reserved for metadata. Right now only the version
// number.
initData := make([]byte, PersistedEntrySize)
copy(initData[:], registryVersion[:])
// Write data to disk.
_, err := f.WriteAt(initData, 0)
if err != nil {
return errors.AddContext(err, "fa... | [
-0.4360760748386383,
0.11334138363599777,
0.3156795799732208,
0.019535455852746964,
1.8987362384796143,
0.8022797703742981,
0.5664653182029724,
0.6648920178413391,
-0.8009860515594482,
0.9188684821128845,
-0.8493180871009827,
0.5576117038726807,
0.11682578921318054,
0.5036224126815796,
0... |
func (entry persistedEntry) Value(index int64) (*value, error) {
if entry.DataLen > modules.RegistryDataSize {
err := errors.New("Value: entry has a too big data len")
build.Critical(err)
return nil, err
}
spk, err := newSiaPublicKey(entry.Key)
if err != nil {
return nil, errors.AddContext(err, "Value: fail... | [
0.39341458678245544,
0.29311349987983704,
0.2871999740600586,
0.20827312767505646,
0.223017156124115,
0.22143809497356415,
0.06882850080728531,
-0.10675669461488724,
0.9951729774475098,
0.5261222124099731,
0.5322775840759277,
0.7594577670097351,
-0.49832823872566223,
0.09672944247722626,
... |
func (entry persistedEntry) Marshal() ([]byte, error) {
if entry.DataLen > modules.RegistryDataSize {
build.Critical(errTooMuchData)
return nil, errTooMuchData
}
b := make([]byte, PersistedEntrySize)
b[0] = entry.Key.Algorithm
copy(b[1:], entry.Key.Key[:])
copy(b[33:], entry.Tweak[:])
binary.LittleEndian.Put... | [
0.9029826521873474,
0.47922658920288086,
0.5717726349830627,
-0.7624583840370178,
-0.17979082465171814,
0.8039932250976562,
-0.5233759880065918,
0.06979367882013321,
0.5520294308662415,
-0.024351390078663826,
-0.011354117654263973,
1.356687068939209,
-0.5377036333084106,
0.2000735104084015... |
func (entry *persistedEntry) Unmarshal(b []byte) error {
if len(b) != PersistedEntrySize {
build.Critical(errEntryWrongSize)
return errEntryWrongSize
}
entry.Key.Algorithm = b[0]
copy(entry.Key.Key[:], b[1:])
copy(entry.Tweak[:], b[33:])
entry.Expiry = compressedBlockHeight(binary.LittleEndian.Uint32(b[65:]))... | [
0.6951257586479187,
0.4098244905471802,
0.4952223002910614,
-0.6907082796096802,
0.05244634300470352,
0.0052373516373336315,
0.47355934977531433,
0.38213038444519043,
0.5129169225692749,
0.5521679520606995,
-0.16259942948818207,
0.7893741726875305,
-0.46796804666519165,
-0.2547951936721802... |
func (r *Registry) staticSaveEntry(v *value, used bool) error {
var entry persistedEntry
var err error
if used {
entry, err = newPersistedEntry(v)
}
if err != nil {
return errors.AddContext(err, "Save: failed to get persistedEntry from key-value pair")
}
b, err := entry.Marshal()
if err != nil {
return er... | [
-0.17323677241802216,
-0.20026814937591553,
0.5892307758331299,
-0.48028841614723206,
0.28062114119529724,
0.3848770558834076,
0.1443331241607666,
-0.013126729987561703,
0.16617773473262787,
0.7878448367118835,
-0.08701921254396439,
0.5016388893127441,
0.05805738642811775,
0.84473294019699... |
func NewRecorder(event typedcorev1.EventInterface) (record.EventRecorder, error) {
eventBroadcaster := record.NewBroadcaster()
eventBroadcaster.StartLogging(klog.Infof)
eventBroadcaster.StartRecordingToSink(&typedcorev1.EventSinkImpl{Interface: event})
recorder := eventBroadcaster.NewRecorder(s, v1.EventSource{Comp... | [
-0.09182364493608475,
0.22533553838729858,
0.5222393870353699,
-0.05406983941793442,
-0.37479090690612793,
-0.7120800614356995,
0.16988052427768707,
0.31778770685195923,
0.7469794750213623,
0.3272746801376343,
0.2992731034755707,
0.9065289497375488,
-0.2917407155036926,
1.3639081716537476,... |
func Printhello() (int, error) {
var buf bytes.Buffer
logger := log.New(&buf, "logger: ", log.LstdFlags)
logger.Print("hello world")
return fmt.Print(&buf)
} | [
0.8268948197364807,
-0.2345704287290573,
0.9740353226661682,
-0.07681739330291748,
-0.19614313542842865,
0.16584740579128265,
-0.3293043375015259,
0.06431682407855988,
-0.30825275182724,
0.0866600051522255,
-1.0650405883789062,
0.816258430480957,
-0.4397508502006531,
0.6922183632850647,
... |
func (client *Client) ApplyNumberDistrictInfoParsingResult(request *ApplyNumberDistrictInfoParsingResultRequest) (response *ApplyNumberDistrictInfoParsingResultResponse, err error) {
response = CreateApplyNumberDistrictInfoParsingResultResponse()
err = client.DoAction(request, response)
return
} | [
-0.4496656656265259,
0.13709110021591187,
0.48114022612571716,
-0.3680075407028198,
-0.7103164792060852,
0.11183851212263107,
0.5228292942047119,
0.9849135279655457,
0.47680458426475525,
-1.213042140007019,
-0.5723980069160461,
-0.35878023505210876,
-0.0819639340043068,
-0.5557039380073547... |
func (client *Client) ApplyNumberDistrictInfoParsingResultWithChan(request *ApplyNumberDistrictInfoParsingResultRequest) (<-chan *ApplyNumberDistrictInfoParsingResultResponse, <-chan error) {
responseChan := make(chan *ApplyNumberDistrictInfoParsingResultResponse, 1)
errChan := make(chan error, 1)
err := client.AddA... | [
-0.43006443977355957,
0.14373503625392914,
0.39326900243759155,
-0.8506887555122375,
-0.14042256772518158,
0.1286768913269043,
0.19623832404613495,
-0.07354017347097397,
0.45459914207458496,
-0.9831193685531616,
-0.04493541270494461,
-0.06831280887126923,
-0.25735583901405334,
-0.482995718... |
func (client *Client) ApplyNumberDistrictInfoParsingResultWithCallback(request *ApplyNumberDistrictInfoParsingResultRequest, callback func(response *ApplyNumberDistrictInfoParsingResultResponse, err error)) <-chan int {
result := make(chan int, 1)
err := client.AddAsyncTask(func() {
var response *ApplyNumberDistric... | [
-0.2903205454349518,
0.46043962240219116,
0.739223301410675,
-0.5264254212379456,
-0.49974456429481506,
-0.27172425389289856,
0.4579675793647766,
0.5364840030670166,
0.8995814323425293,
-0.9684104919433594,
0.037964917719364166,
-0.9337341785430908,
0.05282015725970268,
-0.1624928712844848... |
func CreateApplyNumberDistrictInfoParsingResultRequest() (request *ApplyNumberDistrictInfoParsingResultRequest) {
request = &ApplyNumberDistrictInfoParsingResultRequest{
RpcRequest: &requests.RpcRequest{},
}
request.InitWithApiInfo("OutboundBot", "2019-12-26", "ApplyNumberDistrictInfoParsingResult", "", "")
reque... | [
0.013985367491841316,
0.17687079310417175,
0.5665091276168823,
-0.6036179065704346,
-0.4195333421230316,
0.02630610764026642,
-0.3904469907283783,
0.37670594453811646,
-0.4585721492767334,
-1.297387719154358,
-0.055258672684431076,
0.2482333779335022,
-0.06849072128534317,
0.37453511357307... |
func CreateApplyNumberDistrictInfoParsingResultResponse() (response *ApplyNumberDistrictInfoParsingResultResponse) {
response = &ApplyNumberDistrictInfoParsingResultResponse{
BaseResponse: &responses.BaseResponse{},
}
return
} | [
0.09102507680654526,
-0.5255621075630188,
0.31876111030578613,
-0.8066472411155701,
-0.4345152676105499,
-0.25714367628097534,
-0.07325691729784012,
0.3065148890018463,
0.6897859573364258,
-1.1779183149337769,
-0.45156407356262207,
-1.0327610969543457,
-0.04355968162417412,
0.2340579926967... |
func (sa *SmartAtaAttribute) PopulateAttributeStatus() {
if strings.ToUpper(sa.WhenFailed) == SmartWhenFailedFailingNow {
//this attribute has previously failed
sa.Status = SmartAttributeStatusFailed
sa.StatusReason = "Attribute is failing manufacturer SMART threshold"
} else if strings.ToUpper(sa.WhenFailed) ... | [
-0.3763246536254883,
-0.14356660842895508,
0.44625622034072876,
-0.4312552511692047,
0.13490566611289978,
0.1632135957479477,
-0.16885988414287567,
0.21711479127407074,
0.9485231041908264,
0.4596549868583679,
-0.13906997442245483,
0.8234111070632935,
1.2090705633163452,
0.44529280066490173... |
func (sa *SmartAtaAttribute) MetadataObservedThresholdStatus(smartMetadata metadata.AtaAttributeMetadata) {
//TODO: multiple rules
// try to predict the failure rates for observed thresholds that have 0 failure rate and error bars.
// - if the attribute is critical
// - the failure rate is over 10 - set to failed
... | [
0.41291794180870056,
-0.4115442931652069,
0.540055513381958,
-0.9893785119056702,
-0.38022753596305847,
-0.08356371521949768,
0.16717688739299774,
-0.3486596643924713,
-0.01667775586247444,
0.3966847360134125,
0.26430946588516235,
0.673617422580719,
1.260286569595337,
0.2769888937473297,
... |
func (f *CropEventRepositoryInMemory) Save(uid uuid.UUID, latestVersion int, events []interface{}) <-chan error {
result := make(chan error)
go func() {
f.Storage.Lock.Lock()
defer f.Storage.Lock.Unlock()
for _, v := range events {
latestVersion++
f.Storage.CropEvents = append(f.Storage.CropEvents, stor... | [
-0.5683837532997131,
-0.4010363519191742,
0.7606082558631897,
-0.11181440949440002,
0.23142337799072266,
-0.34705954790115356,
0.2981748878955841,
-0.7552906274795532,
0.4490426480770111,
0.8495022058486938,
-0.8512981534004211,
0.07866812497377396,
-0.6571564674377441,
-0.3417235910892486... |
func Test(t *testing.T) { TestingT(t) } | [
0.5603705644607544,
0.47240784764289856,
0.14808350801467896,
0.21293595433235168,
0.38073426485061646,
0.712630569934845,
1.494964361190796,
-0.18387949466705322,
-0.4030367434024811,
0.012481830082833767,
-0.6709293127059937,
-0.1728723794221878,
-0.05282559245824814,
0.4567270874977112,... |
func (b *BoardTests) TestCreateLED(t *C) {
println("Sending analog mapping request")
l := new(RGBLED, 9, 10, 11)
l.SetupPins(b.board)
} | [
0.25019028782844543,
0.44316399097442627,
0.3746699392795563,
-0.564856231212616,
1.371931552886963,
1.6405181884765625,
0.6397385597229004,
-0.37367716431617737,
0.7028884887695312,
-0.5571758151054382,
-0.2989681363105774,
0.40430110692977905,
-0.5475265383720398,
0.4039924442768097,
0... |
func (b *BoardTest) TestQuickColors(t *C) {
l := new(RGBLED, 9, 10, 11)
var cs = map[string][3]byte{
"red": [3]byte{0xFF, 00, 00},
"green": [3]byte{00, 0xFF, 00},
"blue": [3]byte{00, 00, 0xFF},
"black": [3]byte{00, 00, 00},
"white": [3]byte{0xFF, 0xFF, 0xFF},
}
for c, v := range cs {
l.QuickColor(c)
... | [
0.37095922231674194,
-0.07651370018720627,
0.5409267544746399,
-0.8320230841636658,
0.7712705731391907,
0.12955927848815918,
-0.1404673308134079,
-1.0705602169036865,
0.3433893024921417,
-0.8970950245857239,
-1.1751453876495361,
0.0866977870464325,
-0.5375316739082336,
0.6387193202972412,
... |
func (b *BoardTest) TestHexColors(t *C) {
l := new(RGBLED, 9, 10, 11)
l.Red = 02 // Test padding
l.Green = 255 // largest
l.Blue = 0 // Zero
t.check(l.HexString(), Equals, "02FF00")
} | [
0.6034894585609436,
-0.17483912408351898,
0.4115930199623108,
-0.5806049704551697,
0.9369368553161621,
0.8833035230636597,
-0.44368454813957214,
0.36764684319496155,
0.11231137067079544,
-1.1301567554473877,
-1.0453952550888062,
-0.4353727698326111,
0.0673573836684227,
0.9189183115959167,
... |
func ShootToInfrastructureConfig(shoot *gardenv1beta1.Shoot) (runtime.Object, error) {
cloudProvider, err := helper.GetShootCloudProvider(shoot)
if err != nil {
return nil, err
}
switch cloudProvider {
case gardenv1beta1.CloudProviderAWS:
return GardenV1beta1ShootToAWSV1alpha1InfrastructureConfig(shoot)
case... | [
-1.1606998443603516,
-0.005616270005702972,
0.7008348107337952,
0.2737424671649933,
0.534040629863739,
0.0768919587135315,
0.1931357979774475,
-0.5888192057609558,
-0.3007296025753021,
0.8322497010231018,
-0.8415659070014954,
0.8250382542610168,
-0.047813910990953445,
0.5388159155845642,
... |
func (fb FlamebearerProfileV1) Validate() error {
format := tree.Format(fb.Metadata.Format)
if format != tree.FormatSingle && format != tree.FormatDouble {
return fmt.Errorf("unsupported format %s", format)
}
if len(fb.Flamebearer.Names) == 0 {
return fmt.Errorf("a profile must have at least one symbol name")
... | [
-0.08326194435358047,
0.11825256794691086,
0.8211184144020081,
0.4545283913612366,
0.06266126781702042,
0.07154580950737,
-0.26269423961639404,
-0.6698355674743652,
-0.4971539080142975,
-0.29750755429267883,
-0.22943539917469025,
-0.10574477165937424,
-0.9038099646568298,
1.148005962371826... |
func Diff(name string, base, diff *FlamebearerProfile, maxNodes int) (FlamebearerProfile, error) {
var fb FlamebearerProfile
bt, err := profileToTree(*base)
if err != nil {
return fb, fmt.Errorf("unable to convert base profile to tree: %w", err)
}
dt, err := profileToTree(*diff)
if err != nil {
return fb, fmt... | [
0.16291296482086182,
0.37247273325920105,
0.81916743516922,
0.47080862522125244,
0.18804948031902313,
0.11977854371070862,
-0.3161613941192627,
-0.04914400354027748,
-0.013357838615775108,
0.22571060061454773,
-0.6805911660194397,
0.2555893659591675,
-0.44244691729545593,
0.534748971462249... |
func NewCarbonlinkRequest() *CarbonlinkRequest {
return &CarbonlinkRequest{}
} | [
-0.36799877882003784,
-1.1626741886138916,
0.08574917167425156,
0.2874782085418701,
-0.5862720012664795,
-0.9920668005943298,
-0.10748352110385895,
0.4984824061393738,
-0.06451699137687683,
-0.948556661605835,
-0.5498670935630798,
0.7747153043746948,
-1.065214991569519,
0.8448585867881775,... |
func encrypt(key []byte, text string) string {
// key needs tp be 16, 24 or 32 bytes.
plaintext := []byte(text)
block, err := aes.NewCipher(key)
if err != nil {
panic(err)
}
ciphertext := make([]byte, aes.BlockSize+len(plaintext))
iv := ciphertext[:aes.BlockSize]
if _, err := io.ReadFull(rand.Reader, iv); err... | [
0.3096526265144348,
0.7053297758102417,
0.5838587284088135,
0.08220010250806808,
-0.04239828139543533,
0.3683124780654907,
-0.47226792573928833,
-0.08482034504413605,
0.3988075852394104,
1.368042230606079,
0.11549502611160278,
-0.6089769005775452,
-1.1011770963668823,
-0.2680898904800415,
... |
func toAdmissionResponse(allowed bool, err error) *v1beta1.AdmissionResponse {
response := &v1beta1.AdmissionResponse{
Allowed: allowed,
}
if err != nil {
response.Result = &metav1.Status{
Message: err.Error(),
}
}
return response
} | [
-0.7621608972549438,
-0.9069565534591675,
0.4249880909919739,
-0.6572732925415039,
-0.8081559538841248,
-0.19153305888175964,
0.5159856677055359,
0.1847045123577118,
0.6747254133224487,
1.6201838254928589,
0.7493587136268616,
0.23826944828033447,
-0.4676094055175781,
-0.4606160521507263,
... |
func admitDeployments(ar v1beta1.AdmissionReview) *v1beta1.AdmissionResponse {
log.Println("admitting deployments")
if expect, actual := "deployments", ar.Request.Resource.Resource; expect != actual {
err := fmt.Errorf("unexpected resource: expect %s, actual %s", expect, actual)
log.Println(err)
return toAdmiss... | [
-0.2683296203613281,
-0.22660543024539948,
0.8138303160667419,
-0.5024564266204834,
-0.6043535470962524,
0.11140302568674088,
0.44675445556640625,
-1.1523420810699463,
0.7244951725006104,
1.2517205476760864,
0.9929207563400269,
0.029099779203534126,
-0.5503262281417847,
0.8598276376724243,... |
func (*CatastropheNamespace) Name() string {
return "Catastrophe"
} | [
0.11440763622522354,
-1.3267786502838135,
0.41170746088027954,
0.2664152681827545,
-0.852006733417511,
0.7443824410438538,
-0.47001853585243225,
-0.972468376159668,
0.2311800867319107,
-0.3348294496536255,
-0.7427571415901184,
-0.6378918886184692,
0.8335109353065491,
0.6449980735778809,
... |
func (*CatastropheNamespace) Version() string {
return "9505c0bbaa492df4d508af97a43145523484bdaf07c13499b4e0f10c3560ba27"
} | [
0.5267059206962585,
-1.8188987970352173,
0.5933738946914673,
-0.4667668342590332,
0.30748265981674194,
1.2154818773269653,
0.14565670490264893,
-0.6041697859764099,
-0.11570913344621658,
0.1327035278081894,
-0.7565978169441223,
-0.4875737130641937,
-0.11608660966157913,
0.2857165038585663,... |
func (*CatastropheNamespace) PlayerName() string {
return catastrophe.PlayerName()
} | [
-0.19039596617221832,
-1.0705318450927734,
0.31277361512184143,
0.5087072253227234,
-0.4343741238117218,
0.23941029608249664,
-0.00895797647535801,
-0.6517056226730347,
0.06902278959751129,
0.07957278937101364,
0.08857327699661255,
0.11414055526256561,
0.00218963623046875,
0.58649617433547... |
func (*CatastropheNamespace) CreateGameObject(gameObjectName string) (base.DeltaMergeableGameObject, error) {
switch gameObjectName {
case "GameObject":
newGameObject := GameObjectImpl{}
newGameObject.InitImplDefaults()
return &newGameObject, nil
case "Job":
newJob := JobImpl{}
newJob.InitImplDefaults()
... | [
0.23081134259700775,
-0.766542911529541,
1.007596731185913,
0.12008355557918549,
0.003498361213132739,
0.21001173555850983,
-0.5757723450660706,
-1.1812411546707153,
-0.1889413744211197,
-0.47685179114341736,
-0.8271186351776123,
-0.7251875400543213,
-0.5928006768226624,
0.1618148088455200... |
func (*CatastropheNamespace) CreateGame() base.DeltaMergeableGame {
game := GameImpl{}
game.InitImplDefaults()
return &game
} | [
0.5607049465179443,
0.2110338807106018,
0.6255643963813782,
-0.022519147023558617,
1.3015908002853394,
0.6234747171401978,
-1.3367156982421875,
-0.7588064670562744,
-0.012343619018793106,
-0.39022764563560486,
0.12890417873859406,
-2.039954900741577,
-1.1162117719650269,
0.7567498683929443... |
func (*CatastropheNamespace) CreateAI() (base.AI, *base.AIImpl) {
ai := catastrophe.AI{}
return &ai, &ai.AIImpl
} | [
-0.29315388202667236,
-1.0626143217086792,
0.563183605670929,
-0.3217533528804779,
0.02548692189157009,
-0.16636650264263153,
-0.31089887022972107,
-1.327384352684021,
0.1258946657180786,
-0.1744728982448578,
-0.035587526857852936,
-0.2702523171901703,
0.09208311140537262,
0.92854666709899... |
func (*CatastropheNamespace) OrderAI(baseAI base.AI, functionName string, args []interface{}) (interface{}, error) {
ai, validAI := baseAI.(*catastrophe.AI)
if !validAI {
return nil, errors.New("AI is not a valid catastrophe.AI to order!")
}
switch functionName {
case "runTurn":
return (*ai).RunTurn(), nil
}
... | [
-0.7365136742591858,
-0.4317637085914612,
0.7435048222541809,
0.5890665650367737,
0.5462356209754944,
-0.18464399874210358,
-0.11157241463661194,
-1.1259305477142334,
-0.2410074919462204,
-0.08032158017158508,
0.6708481907844543,
0.3336942195892334,
-0.2137991487979889,
0.2992573380470276,... |
func (locator *ServiceLocatorImpl) InstallBeginCallBack(f func(Worker)) {
locator.beginCallBack = append(locator.beginCallBack, f)
} | [
-0.1911746710538864,
-0.6405735015869141,
0.6645323038101196,
-0.11165353655815125,
-0.5726376175880432,
0.6819928884506226,
1.2335090637207031,
0.6850852370262146,
0.8997589945793152,
0.3330157697200775,
-0.5412827134132385,
-0.6015769839286804,
0.10819952934980392,
0.6573023200035095,
... |
func (locator *ServiceLocatorImpl) InstallEndCallBack(f func(Worker)) {
locator.endCallBack = append(locator.endCallBack, f)
} | [
-0.5445901155471802,
-0.2784413695335388,
0.5539447069168091,
-0.07965383678674698,
0.16315709054470062,
0.12212302535772324,
0.8256450295448303,
0.8935863971710205,
0.05870084464550018,
0.6022210121154785,
-0.7149630784988403,
-1.024470329284668,
0.04284794256091118,
0.779143214225769,
... |
func (locator *ServiceLocatorImpl) Call(fun interface{}) error {
ctx := context.NewContext(globalApp.IrisApp)
request := new(http.Request)
request.URL = &url.URL{}
ctx.ResetRequest(request)
worker := newWorker(ctx)
ctx.Values().Set(WorkerKey, worker)
worker.bus = newBus(make(http.Header))
serviceObj, err := p... | [
-0.9896480441093445,
0.48742198944091797,
1.1370348930358887,
0.5177932381629944,
-0.7393760085105896,
0.3140799105167389,
0.37285661697387695,
-1.2014819383621216,
0.011309915222227573,
-0.2382993996143341,
0.41501471400260925,
0.6445268988609314,
-0.6792542934417725,
0.3817391097545624,
... |
func fun() {
x := 42
fmt.Println(x)
// assigning a new value
x = 99
fmt.Println(x)
// this is a statement. statements are made up of expressions. 100 + 24 is the expression
// statements usually occupy two lines
y := 100 + 24
fmt.Println(y)
} | [
-0.23658400774002075,
-0.6449386477470398,
0.5868258476257324,
0.028770150616765022,
-0.7829821109771729,
-0.4788198173046112,
0.9047065377235413,
-0.08558785915374756,
0.07792145013809204,
-0.05565103515982628,
-0.4562688171863556,
0.3845194876194,
0.5738229155540466,
0.42936447262763977,... |
func NewTypePredicatedResolver(delegate Resolver, predicate interface{}) (*TypePredicatedResolver, error) {
// The predicate must satisfy one known predicate function signature, or else we will generate a runtime error instead of silently fail.
switch predicate.(type) {
case func(context.Context, vocab.ActivityStrea... | [
-0.23454222083091736,
-1.021851658821106,
0.865189790725708,
0.1320795863866806,
0.03501247614622116,
0.054955024272203445,
0.19752709567546844,
-0.1181880384683609,
0.48374325037002563,
0.00310262618586421,
0.02481081336736679,
0.05819361284375191,
-0.572219967842102,
0.9426611065864563,
... |
func (this TypePredicatedResolver) Apply(ctx context.Context, o ActivityStreamsInterface) (bool, error) {
var predicatePasses bool
var err error
if o.VocabularyURI() == "https://www.w3.org/ns/activitystreams" && o.GetTypeName() == "Accept" {
if fn, ok := this.predicate.(func(context.Context, vocab.ActivityStreamsA... | [
-0.15843549370765686,
-0.24546366930007935,
0.9906209707260132,
0.23534201085567474,
-0.2520018219947815,
0.4050453007221222,
0.5180943012237549,
-0.5738019347190857,
0.4057396948337555,
0.15248970687389374,
0.4394889771938324,
0.20393157005310059,
-1.3438901901245117,
1.0987690687179565,
... |
func (HttpRetryOn) EnumDescriptor() ([]byte, []int) {
return file_api_mesh_v1alpha1_retry_proto_rawDescGZIP(), []int{0}
} | [
-0.09677734225988388,
-0.4409872889518738,
0.4755718410015106,
-0.41400301456451416,
0.018383050337433815,
0.24109090864658356,
0.1414818912744522,
0.7535996437072754,
-0.018378131091594696,
0.45529046654701233,
-1.7445400953292847,
1.5651336908340454,
-0.5418006181716919,
0.58815729618072... |
func (Retry_Conf_Grpc_RetryOn) EnumDescriptor() ([]byte, []int) {
return file_api_mesh_v1alpha1_retry_proto_rawDescGZIP(), []int{0, 0, 3, 0}
} | [
0.21029213070869446,
-0.6625794768333435,
0.5358744263648987,
-0.016688266769051552,
0.6342778205871582,
0.3227587640285492,
0.3556893467903137,
1.1624095439910889,
-0.7512854933738708,
1.1272213459014893,
-1.8680856227874756,
0.5510128736495972,
-0.7424657344818115,
0.0800836905837059,
... |
func (*Retry) Descriptor() ([]byte, []int) {
return file_api_mesh_v1alpha1_retry_proto_rawDescGZIP(), []int{0}
} | [
0.1178600862622261,
0.5213459730148315,
0.5520536303520203,
0.5486950874328613,
-0.028050407767295837,
-0.1139538511633873,
-0.06561023741960526,
-0.36620381474494934,
-0.2568763196468353,
-0.6757919788360596,
-0.5168781280517578,
0.2579851746559143,
-0.6338524222373962,
0.3641737699508667... |
func (*Retry_Conf) Descriptor() ([]byte, []int) {
return file_api_mesh_v1alpha1_retry_proto_rawDescGZIP(), []int{0, 0}
} | [
0.7968754768371582,
-0.2981375753879547,
0.335916131734848,
0.023027438670396805,
0.31275781989097595,
-0.10732608288526535,
0.7527776956558228,
0.507525622844696,
-1.045234203338623,
0.2758857309818268,
-1.3715909719467163,
0.906335711479187,
0.03035788983106613,
0.5367001295089722,
0.5... |
func (*Retry_Conf_BackOff) Descriptor() ([]byte, []int) {
return file_api_mesh_v1alpha1_retry_proto_rawDescGZIP(), []int{0, 0, 0}
} | [
0.6578107476234436,
-0.35216474533081055,
0.3154458999633789,
0.3329816460609436,
0.5574848651885986,
0.12605708837509155,
0.5209019184112549,
0.7395763993263245,
-1.2225397825241089,
0.7936399579048157,
-0.8909904360771179,
-0.24725203216075897,
-0.7637630105018616,
-0.270971417427063,
... |
func (*Retry_Conf_Http) Descriptor() ([]byte, []int) {
return file_api_mesh_v1alpha1_retry_proto_rawDescGZIP(), []int{0, 0, 1}
} | [
0.3287598788738251,
-0.1854795664548874,
0.2615993320941925,
0.6000912189483643,
0.4014125168323517,
0.007311678025871515,
0.06204517185688019,
0.5368303656578064,
-0.8968766331672668,
0.47261643409729004,
-0.810979962348938,
0.34909263253211975,
-0.3582586348056793,
0.5173801183700562,
... |
func (*Retry_Conf_Tcp) Descriptor() ([]byte, []int) {
return file_api_mesh_v1alpha1_retry_proto_rawDescGZIP(), []int{0, 0, 2}
} | [
1.2754188776016235,
-0.08148897439241409,
0.22598125040531158,
-0.0009180813212879002,
0.8954119086265564,
-0.1294264793395996,
0.7741488814353943,
0.26567015051841736,
-1.0255237817764282,
0.9018491506576538,
-0.4612315893173218,
0.26873576641082764,
-0.1692289113998413,
0.049222439527511... |
func (*Retry_Conf_Grpc) Descriptor() ([]byte, []int) {
return file_api_mesh_v1alpha1_retry_proto_rawDescGZIP(), []int{0, 0, 3}
} | [
0.46022605895996094,
-0.17143097519874573,
0.28576743602752686,
0.09552953392267227,
0.8683837056159973,
0.24831674993038177,
0.8481702208518982,
0.5510959029197693,
-0.9328277111053467,
0.7415930032730103,
-1.0393140316009521,
0.2672370970249176,
-0.6118522882461548,
0.006437843665480614,... |
func NewCircularFifoQueue(initCap int) Queue {
fn := func(L int) int { return 2*L + 1 }
return NewBaseCircularFifoQueue(initCap, fn)
} | [
-0.549596905708313,
-1.400204062461853,
0.1619671881198883,
0.7071012854576111,
-0.14792725443840027,
-1.3073488473892212,
0.7379416227340698,
0.1124894991517067,
-0.3327583968639374,
-0.379582941532135,
-0.8519231677055359,
0.5463555455207825,
-0.3137989044189453,
0.8257550001144409,
1.... |
func NewLinearExtendCircularFifoQueue(size int) Queue {
fn := func(L int) int { return L + size }
return NewBaseCircularFifoQueue(size, fn)
} | [
0.8021986484527588,
-1.0975183248519897,
0.34755566716194153,
-0.8054077625274658,
-0.7506216764450073,
-0.921412467956543,
-0.8171213269233704,
0.2665492296218872,
-0.06351304799318314,
0.13549911975860596,
-0.5722360014915466,
0.0205019973218441,
-0.5323088765144348,
1.2890281677246094,
... |
func NewBaseCircularFifoQueue(initCap int, fnExtendCap ExtendCapFunc) Queue {
if initCap <= 0 {
panic("initCap must be > 0")
}
return &baseCircularFifoQueue{
nodes: make([]interface{}, initCap),
fnExtendCap: fnExtendCap,
}
} | [
-0.38044124841690063,
-1.259629726409912,
0.3000412881374359,
0.6385855674743652,
-0.04037441685795784,
-0.9319489598274231,
0.06954965740442276,
-0.03227977454662323,
-0.7631209492683411,
0.18626217544078827,
-0.43020927906036377,
0.6616925597190857,
-0.9226421117782593,
0.187871053814888... |
func (q *baseCircularFifoQueue) Push(n interface{}) {
if q.head == q.tail && q.count > 0 {
Lold := len(q.nodes) // old capacity
Lnew := q.fnExtendCap(Lold) // new capacity
/*
if Lnew < Lold {
panic(fmt.Sprintf("fnExtendCap(%d) -> %d : new cap must be greater the old cap!", Lold, Lnew))
}
*/
... | [
-0.2893718183040619,
0.3945082724094391,
0.4706909656524658,
-0.36689063906669617,
0.16426882147789001,
-0.4254394471645355,
0.648944616317749,
-0.6768235564231873,
-0.23270449042320251,
0.5174704194068909,
-0.6483384370803833,
1.0234277248382568,
-0.27838748693466187,
0.977931797504425,
... |
func (q *baseCircularFifoQueue) Pop() interface{} {
if q.count == 0 {
return nil
}
node := q.nodes[q.head]
q.head = (q.head + 1) % len(q.nodes)
q.count--
return node
} | [
0.18361647427082062,
0.0888565182685852,
0.3120080828666687,
-0.43346959352493286,
-0.06029975041747093,
-0.494642436504364,
0.6933293342590332,
-0.3914465308189392,
-0.44342339038848877,
0.9265621900558472,
0.08704099804162979,
0.12942595779895782,
-1.1211128234863281,
0.10266166180372238... |
func RetryIP(com Communicator) {
fmt.Print("Enter new target TCP/IP address: ")
reader := bufio.NewReader(os.Stdin)
ln, _ := reader.ReadString('\n')
*com.IPStr() = ln[:len(ln)-1]
} | [
-0.40970665216445923,
-0.8424960970878601,
0.4718360900878906,
-0.14409379661083221,
0.0396563895046711,
0.29847127199172974,
-0.011501365341246128,
-0.07163983583450317,
-0.3108713924884796,
-0.09759560972452164,
0.8909795880317688,
0.23502619564533234,
-0.6367297768592834,
-1.36028051376... |
func Acquire(com Communicator) bool {
var err error
*com.TargetIP(), err = net.ResolveTCPAddr(Net, *com.IPStr())
return util.Hand(com.ILog(), err, "Error acquiring target TCP/IP address: "+*com.IPStr(), "Target TCP/IP address acquired: "+*com.IPStr())
} | [
-0.7924772500991821,
-0.24775968492031097,
0.6809163093566895,
-0.7013554573059082,
0.8055972456932068,
-0.1312815248966217,
-0.45652255415916443,
-0.3354528248310089,
0.1322021633386612,
-0.6466614603996277,
1.128517746925354,
0.2409900575876236,
-0.023193184286355972,
0.05283154919743538... |
func Reacquire(com Communicator) {
for !Acquire(com) {
RetryIP(com)
}
} | [
0.10690873116254807,
-0.26553085446357727,
0.38297775387763977,
0.17066681385040283,
0.30988508462905884,
-0.7135049700737,
-0.28530028462409973,
-0.5580801963806152,
-0.17518633604049683,
-0.5268788933753967,
0.7921199202537537,
-0.3318217396736145,
-0.49119308590888977,
0.152232691645622... |
func Listen(ser Server) bool {
var err error
*ser.Lis(), err = net.ListenTCP(Net, *ser.TargetIP())
return util.Hand(ser.ILog(), err, "Error creating TCPListener on port", "Listening to port")
} | [
-0.14099620282649994,
-0.31973275542259216,
0.4813637435436249,
-0.8870335221290588,
-0.22807292640209198,
1.0224730968475342,
-0.06848093867301941,
0.4548925757408142,
-0.09092430025339127,
0.16330265998840332,
-0.3770797848701477,
-1.027260422706604,
0.14637884497642517,
0.09979213774204... |
func Connect(cli Client) *net.TCPConn {
sock, err := net.DialTCP(Net, nil, *cli.TargetIP())
util.Hand(cli.ILog(), err, "Error opening connection to target", "Opened connection to target")
return sock
} | [
-0.7504326701164246,
-0.07778943330049515,
0.5160342454910278,
-0.2350504845380783,
-0.3392747640609741,
0.23269186913967133,
-0.2890031337738037,
-0.6085726022720337,
-0.5372686982154846,
0.2474130392074585,
1.1519168615341187,
0.13101808726787567,
0.6037585735321045,
-0.3816817104816437,... |
func Accept(ser Server) *net.TCPConn {
con, err := (*ser.Lis()).AcceptTCP()
util.Hand(ser.ILog(), err, "Error attempting connection", "Connected to "+con.RemoteAddr().String())
return con
} | [
-0.8706672191619873,
-0.8724274039268494,
0.5426896214485168,
-0.5438823103904724,
-1.325722575187683,
0.565800666809082,
0.33479243516921997,
0.4204370975494385,
-0.051928263157606125,
0.12742769718170166,
-0.03117557056248188,
0.10219038277864456,
-0.05784382298588753,
0.4375065267086029... |
func ReadBytes(com Communicator, con *net.TCPConn, n int) string {
go util.Write(com.ILog(), "Reading "+strconv.Itoa(n)+" bytes\n")
r := make([]byte, n)
_, err := con.Read(r)
util.Hand(com.ILog(), err, "Error reading from connected port at "+con.RemoteAddr().String(), "Message ("+string(r)+") received from port at ... | [
-0.08595219254493713,
0.4827103018760681,
0.48248496651649475,
-1.33236825466156,
-0.3456314504146576,
0.2310243844985962,
-0.47646430134773254,
-0.92519611120224,
-0.4508213996887207,
0.2556508779525757,
0.6163174510002136,
-0.024980152025818825,
-0.5900585651397705,
-0.23036636412143707,... |
func Read(com Communicator, con *net.TCPConn) (string, error) {
key := ReadBytes(com, con, len(com.Key()))
if key != com.Key() {
return "", errors.New(KeyFail)
}
ns := []byte(ReadBytes(com, con, MessageLengthBytes))
n := 0
for _, ch := range ns {
n = n<<Byte + int(ch)
}
return ReadBytes(com, con, n), nil
} | [
0.23345915973186493,
0.06587936729192734,
0.5756239295005798,
-0.458796888589859,
-0.7476999759674072,
0.17085759341716766,
-0.5868487358093262,
-0.7778791785240173,
-0.37777599692344666,
0.5253909826278687,
0.4267367720603943,
0.2168772965669632,
-1.0954235792160034,
0.4865523874759674,
... |
func WriteBytes(com Communicator, con *net.TCPConn, m string) bool {
_, err := con.Write([]byte(m))
return util.Hand(com.ILog(), err, "Error transmitting message ("+m+") to port at "+con.RemoteAddr().String(), "Transmitted message ("+m+") to port at "+con.RemoteAddr().String())
} | [
-0.17406262457370758,
0.6868334412574768,
0.6304956078529358,
-1.0055679082870483,
0.2652643918991089,
0.26395079493522644,
0.06880760937929153,
0.1434030830860138,
-0.5098913311958313,
0.19373689591884613,
-0.2922619879245758,
-0.20654059946537018,
-1.2442257404327393,
-0.1939023137092590... |
func Write(com Communicator, con *net.TCPConn, m string) bool {
n := len(m)
s := ""
for i := 0; i < MessageLengthBytes; i++ {
//fmt.Println(n % MaxByte, byte(n % MaxByte))
s = string(byte(n%MaxByte)) + s
n /= MaxByte
}
return WriteBytes(com, con, com.Key()+s+m)
} | [
-0.3579182028770447,
0.7478459477424622,
0.5080781579017639,
-0.1981051117181778,
-0.1886053830385208,
-0.0062632146291434765,
-0.19504180550575256,
0.3029191493988037,
-0.5435250997543335,
0.39558523893356323,
-0.22691750526428223,
-0.5621053576469421,
-1.9246801137924194,
0.3919098079204... |
func SetUpNetwork(com Communicator) {
if com.NetCode() == OfflineCode {
return
}
Reacquire(com)
if com.NetCode() == ServerCode {
ser, _ := com.(Server)
if !Listen(ser) {
RetryIP(com)
SetUpNetwork(com)
} else {
go RunService(ser)
}
}
} | [
-0.37911784648895264,
-0.09316794574260712,
0.6183424592018127,
0.5441842675209045,
0.2598649263381958,
-0.09176881611347198,
0.1506887525320053,
-0.10944205522537231,
0.7942022681236267,
-0.6570717692375183,
0.2642705738544464,
-0.3863499164581299,
-0.5078763961791992,
1.0440224409103394,... |
func RunService(ser Server) {
for {
con := Accept(ser)
go ser.HandleRequest(con)
}
} | [
-1.766478419303894,
0.022538449615240097,
0.4862971007823944,
0.735489010810852,
0.32050469517707825,
0.9014371633529663,
-0.05665678158402443,
-0.17259374260902405,
-1.0522643327713013,
-0.9706164598464966,
-0.1591091752052307,
0.5795547366142273,
-0.6553798317909241,
0.5151666402816772,
... |
func TodoDelete(w http.ResponseWriter, r *http.Request) {
vars := mux.Vars(r)
todoId := vars["todoId"]
id, err := strconv.Atoi(todoId)
if err != nil {
http.Error(w, err.Error(), 500)
return
}
err = DestroyTodo(id)
if err != nil {
http.Error(w, err.Error(), 500)
return
}
w.Header().... | [
-0.22562138736248016,
-0.47151118516921997,
1.0958951711654663,
-0.15791618824005127,
-0.3358553349971771,
-0.3515627086162567,
-0.22750762104988098,
-0.6414778828620911,
0.1861095279455185,
0.5875571370124817,
-0.36156991124153137,
0.30428987741470337,
0.305292546749115,
-0.00600972305983... |
func Execute() {
if err := rootCmd.Execute(); err != nil {
fmt.Println(err)
os.Exit(1)
}
} | [
0.8741579055786133,
-0.631639301776886,
0.8534528017044067,
1.2026909589767456,
0.42606523633003235,
0.8930875062942505,
-0.11484168469905853,
0.11600733548402786,
-0.7203778028488159,
-0.3646620810031891,
0.6552295088768005,
0.16867855191230774,
-0.38348233699798584,
0.8589836955070496,
... |
func initDatabase() {
if dbPath == "" {
// No path provided, use the default path
dbPath = getDefaultDBPath()
}
// Start the database
db, err := poddata.New(dbPath)
if err != nil {
logrus.Fatal(err.Error())
}
data = db
} | [
-0.20426268875598907,
0.5790554881095886,
0.5281956791877747,
0.519551157951355,
1.1328760385513306,
0.36730894446372986,
0.10115064680576324,
0.7176143527030945,
-0.2461341917514801,
-0.5602490305900574,
-0.08016853779554367,
0.35873037576675415,
-1.1387892961502075,
0.3933306038379669,
... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.