text stringlengths 11 6.3k | embedding listlengths 768 768 |
|---|---|
func (m *MockClaimStore) Delete(id string) error {
m.ctrl.T.Helper()
ret := m.ctrl.Call(m, "Delete", id)
ret0, _ := ret[0].(error)
return ret0
} | [
0.17462128400802612,
-0.08711279928684235,
0.48456433415412903,
0.5775659680366516,
1.1629687547683716,
0.29666000604629517,
0.14522209763526917,
-0.09515443444252014,
0.2143249809741974,
-0.2933323383331299,
-0.1748427301645279,
-0.22734174132347107,
-0.9279851913452148,
0.813867509365081... |
func (mr *MockClaimStoreMockRecorder) Delete(id interface{}) *gomock.Call {
mr.mock.ctrl.T.Helper()
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Delete", reflect.TypeOf((*MockClaimStore)(nil).Delete), id)
} | [
0.08705029636621475,
0.7978366613388062,
0.3156987428665161,
0.4238904118537903,
-0.06709524244070053,
0.2909117639064789,
-0.481599897146225,
-1.140216588973999,
1.5260707139968872,
0.38126420974731445,
0.7026931047439575,
0.4184134900569916,
-0.81572026014328,
1.2196625471115112,
-0.07... |
func (m *MockClaimStore) DeleteAll(userID string) error {
m.ctrl.T.Helper()
ret := m.ctrl.Call(m, "DeleteAll", userID)
ret0, _ := ret[0].(error)
return ret0
} | [
0.3154238164424896,
-0.6615817546844482,
0.3327844440937042,
0.20093967020511627,
-0.08887486904859543,
0.6489412784576416,
0.538352370262146,
0.0777730643749237,
0.07718930393457413,
-0.6889030933380127,
-0.02465667761862278,
0.3605857193470001,
-0.5543830394744873,
1.6425832509994507,
... |
func (mr *MockClaimStoreMockRecorder) DeleteAll(userID interface{}) *gomock.Call {
mr.mock.ctrl.T.Helper()
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "DeleteAll", reflect.TypeOf((*MockClaimStore)(nil).DeleteAll), userID)
} | [
0.2147352397441864,
0.11336192488670349,
0.34857407212257385,
0.1694062501192093,
-0.8442234396934509,
0.4205068051815033,
-0.4392133355140686,
-0.3763202726840973,
1.0418765544891357,
-0.09033329784870148,
0.8854526877403259,
0.9149540662765503,
-0.33689746260643005,
1.9117414951324463,
... |
func NewMockRateLimiter(ctrl *gomock.Controller) *MockRateLimiter {
mock := &MockRateLimiter{ctrl: ctrl}
mock.recorder = &MockRateLimiterMockRecorder{mock}
return mock
} | [
0.12138109654188156,
0.4109039306640625,
0.43272536993026733,
0.6496668457984924,
-0.8244590759277344,
-0.04565984755754471,
-0.2862797677516937,
-0.45599740743637085,
0.9267892241477966,
0.805134654045105,
-0.7162948846817017,
0.13882125914096832,
-0.8737365007400513,
1.0798300504684448,
... |
func (m *MockRateLimiter) EXPECT() *MockRateLimiterMockRecorder {
return m.recorder
} | [
0.6492838263511658,
0.09826463460922241,
0.23705288767814636,
0.07349078357219696,
-0.4260755479335785,
0.47716182470321655,
-0.501810610294342,
0.28450319170951843,
0.5306344032287598,
0.2034117877483368,
0.5261950492858887,
0.9991445541381836,
-1.1330822706222534,
0.08446965366601944,
... |
func (m *MockRateLimiter) TakeToken(bucket ratelimit.Bucket) error {
m.ctrl.T.Helper()
ret := m.ctrl.Call(m, "TakeToken", bucket)
ret0, _ := ret[0].(error)
return ret0
} | [
0.6315297484397888,
-0.21681876480579376,
0.4355091452598572,
-0.2756224572658539,
1.0623319149017334,
0.11959011107683182,
0.6960422396659851,
0.047344986349344254,
-0.391452819108963,
-0.2995191812515259,
-1.2901538610458374,
0.1810273677110672,
-0.8634631633758545,
0.8351658582687378,
... |
func (mr *MockRateLimiterMockRecorder) TakeToken(bucket interface{}) *gomock.Call {
mr.mock.ctrl.T.Helper()
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "TakeToken", reflect.TypeOf((*MockRateLimiter)(nil).TakeToken), bucket)
} | [
0.8717312812805176,
0.4927460551261902,
0.4481998383998871,
-0.33321163058280945,
0.19790510833263397,
0.2485475242137909,
-0.34769782423973083,
-0.18924987316131592,
0.8623780012130737,
0.47154635190963745,
-0.5383837223052979,
1.1112271547317505,
-0.7944215536117554,
0.7734000086784363,
... |
func GetVMs(project string, zone string) (ComputeVMs, error) {
ctx := context.Background()
computeService, _ := googleCompute.NewService(ctx)
listClient := computeService.Instances.List(project, zone)
vms, err := listClient.Do()
result := ComputeVMs{
VMs: vms,
}
return result, err
} | [
-0.1739187091588974,
0.739715576171875,
0.30650630593299866,
0.17198029160499573,
0.6684528589248657,
0.06670985370874405,
-0.8282379508018494,
-0.24356558918952942,
-0.39602115750312805,
0.9474574327468872,
0.019397592172026634,
1.6537631750106812,
-0.9299445152282715,
0.5178785920143127,... |
func main() {
// Create a value of type Admin from the entities package.
a := entities.Admin{
Rights: 10,
}
// Set the exported fields from the unexported
// inner type.
a.Name = "Bill"
a.Email = "bill@email.com"
fmt.Printf("User: %v\n", a)
} | [
0.5799705386161804,
0.8309894800186157,
0.4909147322177887,
0.08763625472784042,
0.2683819532394409,
0.43545275926589966,
-0.3682398200035095,
-0.22994866967201233,
-0.18354719877243042,
-0.3969781994819641,
-0.04249625653028488,
1.2161176204681396,
0.31425637006759644,
-0.2429817765951156... |
func Answer1() string {
painted := make(map[spatial.Coordinate]int)
program := computer.New(1, computer.Config{
MinMemoryAlloc: 5000,
Print: false,
})
robot := newRobot(program, spatial.Coordinate{X:50, Y:50})
robot.run(painted)
return strconv.Itoa(len(painted))
} | [
0.12041573226451874,
-0.31408679485321045,
0.6544568538665771,
-0.09151514619588852,
-1.1697618961334229,
0.6638211607933044,
1.377428412437439,
-0.09892537444829941,
-0.05453465133905411,
0.7089510560035706,
-0.7565651535987854,
0.8069483637809753,
-0.4836167097091675,
0.4832264482975006,... |
func Answer2() string {
painted := make(map[spatial.Coordinate]int)
program := computer.New(2, computer.Config{
MinMemoryAlloc: 5000,
Print: false,
})
robot := newRobot(program, spatial.Coordinate{X:0, Y:0})
painted[robot.position] = 1
robot.run(painted)
grid := spatial.NewGrid(41, 6)
cells := make([]spat... | [
0.2720883786678314,
-0.45182326436042786,
0.6707854866981506,
0.16458608210086823,
-1.0700913667678833,
0.33538541197776794,
1.0869483947753906,
-0.9194454550743103,
-0.1357925832271576,
0.5754254460334778,
0.29757899045944214,
0.738226056098938,
0.23175957798957825,
1.5353615283966064,
... |
func (g *Prober) MakeProbe(registry prometheus.Registerer, namespace string) Handler {
return &metricsHandler{
handler: NewHandler(),
registry: registry,
namespace: namespace,
}
} | [
0.7621344327926636,
0.26495108008384705,
0.3111858069896698,
0.07220473885536194,
-0.5965237021446228,
0.8906570076942444,
-0.4451148211956024,
-0.38308078050613403,
0.21867741644382477,
-0.18782377243041992,
0.340745210647583,
-0.18375980854034424,
-1.19253671169281,
0.0831521674990654,
... |
func TCPDialCheck(addr string, timeout time.Duration) Check {
return func() error {
conn, err := net.DialTimeout("tcp", addr, timeout)
if err != nil {
return err
}
return conn.Close()
}
} | [
0.4546719789505005,
-0.23886823654174805,
0.49346575140953064,
-0.5183126926422119,
-1.0174260139465332,
0.8740506768226624,
-0.22740234434604645,
0.2001546174287796,
0.28005436062812805,
0.3670106828212738,
1.4647586345672607,
-0.1802818328142166,
0.5893884897232056,
-0.3537220060825348,
... |
func HTTPGetCheck(url string, timeout time.Duration) Check {
client := http.Client{
Timeout: timeout,
// never follow redirects
CheckRedirect: func(*http.Request, []*http.Request) error {
return http.ErrUseLastResponse
},
}
return func() error {
resp, err := client.Get(url)
if err != nil {
return e... | [
-0.05410894751548767,
0.3508918285369873,
0.7703344821929932,
0.02346932515501976,
0.11339829117059708,
0.8201237916946411,
-0.6040283441543579,
-0.37053459882736206,
0.1259484440088272,
-0.029275517910718918,
0.3685755431652069,
0.5489177703857422,
-0.0069030639715492725,
-0.2840392589569... |
func DatabasePingCheck(database *sql.DB, timeout time.Duration) Check {
return func() error {
ctx, cancel := context.WithTimeout(context.Background(), timeout)
defer cancel()
if database == nil {
return fmt.Errorf("database is nil")
}
return database.PingContext(ctx)
}
} | [
0.04479100555181503,
0.6631312370300293,
0.4433528780937195,
0.7484434247016907,
-0.19699938595294952,
0.8046388030052185,
-0.2310391366481781,
0.5162945985794067,
1.0116302967071533,
1.5906553268432617,
0.46294134855270386,
0.13285525143146515,
-0.27160096168518066,
0.4890630543231964,
... |
func DNSResolveCheck(host string, timeout time.Duration) Check {
resolver := net.Resolver{}
return func() error {
ctx, cancel := context.WithTimeout(context.Background(), timeout)
defer cancel()
addrs, err := resolver.LookupHost(ctx, host)
if err != nil {
return err
}
if len(addrs) < 1 {
return fmt.... | [
-0.44164949655532837,
1.045213222503662,
0.6028430461883545,
0.45587778091430664,
-0.5194974541664124,
-0.013232233934104443,
-0.42159584164619446,
-0.2606174349784851,
0.09818650782108307,
-0.22941181063652039,
0.03186725080013275,
-0.41917577385902405,
0.09077070653438568,
0.123741261661... |
func GoroutineCountCheck(threshold int) Check {
return func() error {
count := runtime.NumGoroutine()
if count > threshold {
return fmt.Errorf("too many goroutines (%d > %d)", count, threshold)
}
return nil
}
} | [
0.8903294205665588,
0.5098257064819336,
0.5692588090896606,
-0.24011674523353577,
-0.23028381168842316,
0.7443903088569641,
0.40976110100746155,
-0.23321303725242615,
-0.9872743487358093,
0.5281004309654236,
0.3826233744621277,
0.1099725067615509,
-0.0913432165980339,
0.07574110478162766,
... |
func NewHandler() Handler {
h := &basicHandler{
livenessChecks: make(map[string]Check),
readinessChecks: make(map[string]Check),
}
h.Handle("/live", http.HandlerFunc(h.LiveEndpoint))
h.Handle("/ready", http.HandlerFunc(h.ReadyEndpoint))
return h
} | [
0.18867668509483337,
-0.8522734045982361,
0.23749065399169922,
0.9583974480628967,
0.052521318197250366,
1.197027325630188,
-0.30675211548805237,
0.6280500888824463,
-0.5365210771560669,
-0.7150956988334656,
0.48075321316719055,
-1.1009521484375,
0.4449974596500397,
0.0037335120141506195,
... |
func Timeout(check Check, timeout time.Duration) Check {
return func() error {
c := make(chan error, 1)
go func() { c <- check() }()
select {
case err := <-c:
return err
case <-time.After(timeout):
return timeoutError(timeout)
}
}
} | [
0.46957820653915405,
0.8467301726341248,
0.33526891469955444,
0.49998000264167786,
-0.75171959400177,
0.0739278718829155,
-0.2851234972476959,
0.16510026156902313,
-0.06157703697681427,
0.4749249219894409,
0.9690941572189331,
0.20470218360424042,
0.08681776374578476,
-0.40946152806282043,
... |
func (config RFM69) Open(log gopi.Logger) (gopi.Driver, error) {
log.Debug("<sensors.RFM69.Open>{ spi=%v speed=%v }", config.SPI, config.Speed)
this := new(rfm69)
this.spi = config.SPI
this.log = log
if this.spi == nil {
return nil, gopi.ErrBadParameter
}
// Set SPI mode
if err := this.spi.SetMode(RFM_SPI_... | [
-0.4998750388622284,
0.0031743566505610943,
0.6502596735954285,
0.73428875207901,
-0.4295744299888611,
-0.34979012608528137,
0.6454280018806458,
0.7387241125106812,
0.306776762008667,
-0.2857831120491028,
-0.0746813714504242,
-0.32079657912254333,
-0.82120281457901,
0.386836439371109,
0.... |
func NewLogGroup(parent context.Context, log *zap.Logger) *LogGroup {
return &LogGroup{
group: *NewCancellableGroup(parent),
log: log,
clock: clock.System,
}
} | [
0.9927241802215576,
0.34106016159057617,
0.14664976298809052,
0.05151434615254402,
-2.2169830799102783,
-0.5436156988143921,
-0.9810084104537964,
-0.6996199488639832,
-0.20181328058242798,
-0.2305537313222885,
-0.5623236894607544,
0.39614465832710266,
-0.6672587990760803,
0.308007657527923... |
func (g *LogGroup) SetClock(c clock.Clock) {
g.clock = c
} | [
0.6435603499412537,
0.7353899478912354,
0.1165577620267868,
-0.33341288566589355,
0.09098412841558456,
0.8653134703636169,
0.6185814142227173,
0.05539296194911003,
0.15371477603912354,
-0.30836549401283264,
-0.0587293803691864,
1.169387698173523,
-0.5846272706985474,
0.9547080397605896,
... |
func (g *LogGroup) Go(taskName string, f func(groupCtx context.Context) error) {
g.group.Go(func(ctx context.Context) error {
start := g.clock.Now()
l := g.log.With(zap.String("task", taskName)).WithOptions(zap.AddCallerSkip(1))
l.Debug("Task started")
if err := f(ctx); err != nil {
elapsed := g.clock.Now(... | [
0.27783119678497314,
0.921673595905304,
0.9719058275222778,
-0.455648273229599,
-0.25488510727882385,
-0.26915228366851807,
0.2241283655166626,
-0.08403491973876953,
-1.4853034019470215,
1.0605438947677612,
-0.2770705223083496,
0.7375458478927612,
0.8884897232055664,
-0.0332651250064373,
... |
func (g *LogGroup) Cancel() {
g.group.Cancel()
} | [
1.1769167184829712,
-0.40197306871414185,
0.18312183022499084,
-0.1734364628791809,
-0.8630327582359314,
0.34610241651535034,
0.10023131221532822,
-0.2381592094898224,
-1.3203768730163574,
0.2075430452823639,
0.7733909487724304,
1.0206339359283447,
-0.4636363089084625,
0.7959885597229004,
... |
func (g *LogGroup) Wait() error {
return g.group.Wait()
} | [
-0.07195097208023071,
-0.06268668919801712,
0.09979297965765,
-0.6161839962005615,
0.4266449511051178,
0.19994796812534332,
-0.02948109805583954,
-0.9007543325424194,
-1.439456820487976,
-0.5211917161941528,
-0.04050877317786217,
1.0045133829116821,
-0.5996440649032593,
0.14294569194316864... |
func (fn GetUniverseStructuresStructureIDHandlerFunc) Handle(params GetUniverseStructuresStructureIDParams, principal interface{}) middleware.Responder {
return fn(params, principal)
} | [
-0.2106221318244934,
0.4351937770843506,
0.4907586872577667,
0.4149414002895355,
-0.08596689254045486,
0.987384021282196,
0.9889509081840515,
0.0664593055844307,
0.8884190320968628,
-1.1122429370880127,
0.13118918240070343,
-0.011880052275955677,
-0.5085618495941162,
-0.4974534809589386,
... |
func NewGetUniverseStructuresStructureID(ctx *middleware.Context, handler GetUniverseStructuresStructureIDHandler) *GetUniverseStructuresStructureID {
return &GetUniverseStructuresStructureID{Context: ctx, Handler: handler}
} | [
-0.03239373862743378,
0.12681692838668823,
0.43672624230384827,
0.48430976271629333,
-0.5052089691162109,
1.0548224449157715,
0.672203004360199,
0.27963122725486755,
1.1086331605911255,
-0.5889132618904114,
-0.4307750165462494,
0.446258008480072,
-0.13502760231494904,
0.26960042119026184,
... |
func (o *GetGroupInviteRequestPublicV2Reader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) {
switch response.Code() {
case 200:
result := NewGetGroupInviteRequestPublicV2OK()
if err := result.readResponse(response, consumer, o.formats); err != nil {
return nil, ... | [
-0.857234001159668,
-0.6606859564781189,
0.9637810587882996,
0.5534048080444336,
-0.3925873041152954,
-0.7431414127349854,
-0.017718026414513588,
-0.5211260318756104,
-0.15738262236118317,
0.9628118276596069,
0.34942835569381714,
0.7674524784088135,
-1.4049268960952759,
0.03152019903063774... |
func NewGetGroupInviteRequestPublicV2OK() *GetGroupInviteRequestPublicV2OK {
return &GetGroupInviteRequestPublicV2OK{}
} | [
-0.38846418261528015,
-0.4402121305465698,
0.791939914226532,
1.3641579151153564,
-0.8045656085014343,
0.48017358779907227,
0.19071516394615173,
0.4569597840309143,
-2.1477251052856445,
0.05088064819574356,
-0.30761051177978516,
0.22940997779369354,
-0.15871906280517578,
-0.359673500061035... |
func NewGetGroupInviteRequestPublicV2BadRequest() *GetGroupInviteRequestPublicV2BadRequest {
return &GetGroupInviteRequestPublicV2BadRequest{}
} | [
-0.2746219038963318,
-0.6597540378570557,
0.7576956748962402,
1.1129941940307617,
-0.971616804599762,
-0.18528319895267487,
-0.9649035930633545,
0.705901563167572,
-2.2812225818634033,
-0.3390386998653412,
-0.05907059460878372,
0.9921138882637024,
-1.312418818473816,
0.11666817218065262,
... |
func NewGetGroupInviteRequestPublicV2Unauthorized() *GetGroupInviteRequestPublicV2Unauthorized {
return &GetGroupInviteRequestPublicV2Unauthorized{}
} | [
-0.7642449140548706,
-0.44804468750953674,
0.783078134059906,
1.2295390367507935,
-1.0066354274749756,
0.07526890188455582,
-0.3184010684490204,
0.8118539452552795,
-1.5847480297088623,
-0.44525274634361267,
-0.099714495241642,
1.228048324584961,
-0.9244425892829895,
-0.7313168048858643,
... |
func NewGetGroupInviteRequestPublicV2Forbidden() *GetGroupInviteRequestPublicV2Forbidden {
return &GetGroupInviteRequestPublicV2Forbidden{}
} | [
-0.017662806436419487,
-0.417528361082077,
0.730976402759552,
1.4529160261154175,
-0.9558108448982239,
0.5698447227478027,
-0.07163044065237045,
-0.21446405351161957,
-1.8248199224472046,
-0.17518585920333862,
0.10849276185035706,
0.9144274592399597,
-1.199166178703308,
-0.7691938877105713... |
func NewManageProfileRepository(db *gorm.DB) Admin.ManageProfileRepository {
return &ManageProfileRepository{conn: db}
} | [
0.2246147245168686,
0.03996487334370613,
0.10947450250387192,
-0.5273557305335999,
0.002011599950492382,
0.04476062208414078,
-0.453867107629776,
0.1334065943956375,
0.033228062093257904,
0.5119805932044983,
-0.7257651686668396,
-0.49252694845199585,
-0.3085649609565735,
0.4399655461311340... |
func (mpRepo *ManageProfileRepository) Profiles() ([]entity.Profile, []error) {
prfs := []entity.Profile{}
errs := mpRepo.conn.Find(&prfs).GetErrors()
if len(errs) > 0 {
return nil, errs
}
return prfs, errs
} | [
0.005070024635642767,
0.36322855949401855,
0.297689825296402,
0.28326597809791565,
1.2760716676712036,
0.05457862466573715,
-0.7393767833709717,
-0.08597924560308456,
0.2627401649951935,
0.13854512572288513,
-0.04603693261742592,
-0.4370565414428711,
-1.2688881158828735,
0.9085208177566528... |
func (mpRepo *ManageProfileRepository) Profile(id uint) (*entity.Profile, []error) {
prfs := entity.Profile{}
errs := mpRepo.conn.First(&prfs, id).GetErrors()
if len(errs) > 0 {
return nil, errs
}
return &prfs, errs
} | [
-0.3058909475803375,
0.5508655309677124,
0.36220091581344604,
0.2079906463623047,
1.1665972471237183,
-1.155186414718628,
-0.3987778127193451,
-0.7188330292701721,
0.5588026642799377,
-0.07009956985712051,
-0.05025705695152283,
-0.5872873067855835,
-1.1893047094345093,
0.4616982638835907,
... |
func (mpRepo *ManageProfileRepository) UpdateProfile(user *entity.Profile) (*entity.Profile, []error) {
prf := user
errs := mpRepo.conn.Save(prf).GetErrors()
if len(errs) > 0 {
return nil, errs
}
return prf, errs
} | [
-0.8454686999320984,
-0.17296592891216278,
0.42179760336875916,
0.6194434762001038,
0.3536362648010254,
-0.12150697410106659,
-0.18411827087402344,
-0.17185907065868378,
0.12106607854366302,
0.6929659843444824,
-0.4309034049510956,
-0.39191222190856934,
-1.4810675382614136,
0.1685290187597... |
func (mpRepo *ManageProfileRepository) DeleteProfile(id uint) (*entity.Profile, []error) {
prf, errs := mpRepo.Profile(id)
if len(errs) > 0 {
return nil, errs
}
errs = mpRepo.conn.Delete(prf, id).GetErrors()
if len(errs) > 0 {
return nil, errs
}
return prf, errs
} | [
-0.4054855704307556,
0.29801297187805176,
0.388154000043869,
0.14781127870082855,
0.8443385362625122,
-0.604116678237915,
-0.4680054187774658,
-0.3700719177722931,
0.5865045785903931,
0.028126075863838196,
-0.20273366570472717,
-0.39587822556495667,
-1.531355857849121,
0.8414972424507141,
... |
func (mpRepo *ManageProfileRepository) StoreProfile(user *entity.Profile) (*entity.Profile, []error) {
prf := user
errs := mpRepo.conn.Create(prf).GetErrors()
if len(errs) > 0 {
return nil, errs
}
return prf, errs
} | [
-0.19724495708942413,
0.47565287351608276,
0.27272623777389526,
0.3400585353374481,
0.16453921794891357,
0.40574178099632263,
-0.06893622875213623,
-0.5101605653762817,
0.5114703178405762,
-0.28234365582466125,
-0.5834733247756958,
-0.5825195908546448,
-1.5565112829208374,
0.33533239364624... |
func (adr *UserAddress) MarshalCSV() (string, error) {
return fmt.Sprintf("%s, %s, %s", adr.Status, adr.City, adr.Country), nil
} | [
0.9964966773986816,
-0.15474244952201843,
0.23039411008358002,
-0.3297463655471802,
-0.9515578746795654,
0.17092539370059967,
-0.40486079454421997,
0.8033814430236816,
1.1681115627288818,
-0.4038222134113312,
0.5226654410362244,
1.7160580158233643,
0.37588125467300415,
-0.3686771094799042,... |
func (adr *UserAddress) UnmarshalCSV(csv string) (err error) {
s := strings.Split(csv, ", ")
if len(s) != 3 {
return errors.New("The format of the address is not correct")
}
adr.Status, adr.City, adr.Country = s[0], s[1], s[2]
return nil
} | [
0.6454859972000122,
-0.15271998941898346,
0.4288748800754547,
-0.8249326348304749,
-0.6125243902206421,
0.013474032282829285,
-0.011634182184934616,
1.0130524635314941,
1.2234272956848145,
0.013499271124601364,
0.19751018285751343,
1.1143872737884521,
0.21171794831752777,
-0.85076427459716... |
func main() {
calculix := serverCalculix.NewCalculix()
err := rpc.Register(calculix)
if err != nil {
fmt.Println("Cannot register the calculix")
return
}
rpc.HandleHTTP()
l, e := net.Listen("tcp", ":1234")
if e != nil {
log.Fatal("listen error:", e)
}
err = http.Serve(l, nil)
if err != nil {
fmt.Print... | [
1.4999667406082153,
0.4207897484302521,
0.8769883513450623,
0.2777138352394104,
0.7052329778671265,
0.7044692635536194,
-0.08504166454076767,
0.8480578064918518,
-1.0081076622009277,
-0.6209796667098999,
-0.7257643342018127,
0.4830741882324219,
-0.6165009140968323,
-0.07628899067640305,
... |
func (s *Slacker) ListenForIncomingMessages() error {
for {
// sleep a bit so we dont waste resources.
time.Sleep(500 * time.Millisecond)
}
return nil
} | [
0.770869255065918,
0.07761329412460327,
0.23738816380500793,
-1.0058907270431519,
0.2719418406486511,
0.10820283740758896,
0.24176864326000214,
-1.0878489017486572,
-0.449476420879364,
-0.16748644411563873,
0.2506944239139557,
0.5250489711761475,
-0.47656625509262085,
0.9153972268104553,
... |
func (s *Slacker) SetupUI() error {
// black toolbars are cool.
tb := widgets.NewToolBar("toolbar", &color.RGBA{0, 0, 0, 0xff})
quitButton := widgets.NewToolbarItem("quitTBI", s.QuitSlacker)
tb.AddToolBarItem(quitButton)
tb.SetSize(800, 30)
// Main VPanel of the app. Will have 2 entries in it. The first is the ... | [
0.10495553910732269,
0.12946882843971252,
0.9515451192855835,
-0.08597628027200699,
0.14109720289707184,
0.13442406058311462,
0.2668016254901886,
-0.32937324047088623,
-0.011808125302195549,
-0.10805106908082962,
-0.11862476170063019,
-0.138624906539917,
-0.6761221885681152,
1.063936948776... |
func (s *Slacker) populateMessagesUI() error {
s.messagesVPanel.ClearWidgets()
// messages should be...... labels?
for i, msg := range s.messages {
l := widgets.NewLabel(fmt.Sprintf("label-%d", i), msg.Text, 400, 40, &color.RGBA{0, 0, 0, 0xff}, nil)
s.messagesVPanel.AddWidget(l)
}
return nil
} | [
-0.540094256401062,
0.5634127259254456,
0.618294358253479,
-0.7383214831352234,
1.3775677680969238,
0.26280850172042847,
-0.02057039737701416,
-0.96927410364151,
-0.135016530752182,
-0.052006155252456665,
0.27318185567855835,
0.13110563158988953,
-0.23929497599601746,
1.1904984712600708,
... |
func (s *Slacker) populateContactChannelUI() error {
for _, contact := range s.contacts {
tb := widgets.NewTextButton(fmt.Sprintf("CT: %s button", contact.Name), "CT: "+contact.Name, true, 0, 0, nil, nil, nil, s.contactSelected)
s.contactsChannelsVPanel.AddWidget(tb)
}
for _, ch := range s.channels {
tb := w... | [
-0.4929714500904083,
-0.11825893074274063,
0.7067582607269287,
-1.101515531539917,
0.7847490310668945,
0.1138937845826149,
-0.06553766131401062,
-0.6852861046791077,
-0.07899769395589828,
-0.13920609652996063,
0.19664859771728516,
-0.07295962423086166,
0.16736926138401031,
0.42446294426918... |
func NewProject(id string, name string) *Project {
this := Project{}
this.Id = id
this.Name = name
return &this
} | [
0.24857306480407715,
-0.6820567846298218,
0.3004522919654846,
0.5575703382492065,
-0.724483847618103,
-0.28533804416656494,
-1.0370033979415894,
-0.4188220500946045,
0.010867091827094555,
-0.05456553399562836,
-0.5872282981872559,
0.29861167073249817,
-0.6475836634635925,
-0.85062605142593... |
func NewProjectWithDefaults() *Project {
this := Project{}
return &this
} | [
-0.1392095386981964,
0.1505999118089676,
-0.3248503506183624,
1.0954418182373047,
0.2021016627550125,
-0.5224827527999878,
-0.6927493810653687,
-0.7719109654426575,
0.03752812370657921,
-0.9517510533332825,
-0.7371472120285034,
-1.1848541498184204,
-0.9813052415847778,
0.13358989357948303,... |
func (o *Project) GetId() string {
if o == nil {
var ret string
return ret
}
return o.Id
} | [
0.8631871342658997,
0.02551037259399891,
-0.07758572697639465,
0.8494747281074524,
0.266398549079895,
1.4602737426757812,
0.7304891347885132,
0.012426745146512985,
1.015181303024292,
-0.33103978633880615,
0.13652141392230988,
-0.6935266256332397,
-0.4408055543899536,
-0.20273548364639282,
... |
func (o *Project) GetIdOk() (*string, bool) {
if o == nil {
return nil, false
}
return &o.Id, true
} | [
-0.8176351189613342,
0.9828528761863708,
0.5778594613075256,
1.1516996622085571,
0.43103086948394775,
0.4960002303123474,
0.6858724355697632,
0.6417370438575745,
0.5914980173110962,
-0.18687479197978973,
-1.1686222553253174,
-0.5852975249290466,
-0.08938854932785034,
-0.2322228103876114,
... |
func (o *Project) SetId(v string) {
o.Id = v
} | [
0.177474245429039,
0.004654422402381897,
-0.29552316665649414,
0.24347256124019623,
-0.3477845788002014,
1.6231876611709595,
-0.2667604684829712,
0.47117310762405396,
0.6820117831230164,
0.5031329989433289,
-0.6160433888435364,
0.1307586431503296,
-0.5045338869094849,
-0.2189503163099289,
... |
func (o *Project) GetName() string {
if o == nil {
var ret string
return ret
}
return o.Name
} | [
-0.03265296295285225,
0.29831475019454956,
-0.07122812420129776,
0.6651655435562134,
-0.4706830382347107,
0.23889833688735962,
0.5694161653518677,
-0.06790406256914139,
-0.09576606750488281,
0.3774290680885315,
0.15127277374267578,
-1.069480061531067,
-0.14840993285179138,
0.04199605435132... |
func (o *Project) GetNameOk() (*string, bool) {
if o == nil {
return nil, false
}
return &o.Name, true
} | [
-0.3909517526626587,
0.2502223551273346,
0.7409166097640991,
0.2997097373008728,
-0.4672713279724121,
0.9288687109947205,
0.12346967309713364,
-0.2321022003889084,
-0.41412436962127686,
1.216447114944458,
-1.2992159128189087,
-0.9025988578796387,
0.24089954793453217,
0.2536880671977997,
... |
func (o *Project) SetName(v string) {
o.Name = v
} | [
-0.4425515830516815,
0.29265812039375305,
-0.17395591735839844,
0.14019468426704407,
-1.2017412185668945,
0.4473847448825836,
-0.23912011086940765,
0.11635034531354904,
-0.34348616003990173,
1.1768232583999634,
-0.7117624282836914,
-0.24771451950073242,
-0.17309550940990448,
-0.07383878529... |
func (o *Project) GetLink() ProjectLink {
if o == nil || o.Link == nil {
var ret ProjectLink
return ret
}
return *o.Link
} | [
0.07069199532270432,
1.2417889833450317,
0.04320573806762695,
1.6231836080551147,
0.4877561032772064,
0.07252749800682068,
1.2121903896331787,
-0.16500797867774963,
0.8271907567977905,
-1.135282278060913,
0.29710787534713745,
-0.9594682455062866,
-0.9891234040260315,
0.6739482879638672,
... |
func (o *Project) GetLinkOk() (*ProjectLink, bool) {
if o == nil || o.Link == nil {
return nil, false
}
return o.Link, true
} | [
-0.09877432882785797,
0.3995910584926605,
0.43502920866012573,
1.2296044826507568,
0.8312681317329407,
0.5369083285331726,
0.5214857459068298,
0.5830438733100891,
0.43050795793533325,
-0.32663100957870483,
-0.7892639636993408,
0.1345672458410263,
-0.18460412323474884,
0.41654354333877563,
... |
func (o *Project) HasLink() bool {
if o != nil && o.Link != nil {
return true
}
return false
} | [
0.3431370258331299,
0.9200642704963684,
0.21291381120681763,
1.104931116104126,
1.073001503944397,
0.04281220957636833,
0.5016614198684692,
1.0003045797348022,
0.22940990328788757,
-1.6401764154434204,
-0.1432916671037674,
-0.608572244644165,
-0.5700278282165527,
0.2459646314382553,
-0.4... |
func (o *Project) SetLink(v ProjectLink) {
o.Link = &v
} | [
-0.17514395713806152,
0.8104270696640015,
-0.6315812468528748,
0.9715185165405273,
-0.03218241408467293,
0.4207058846950531,
-0.3728023171424866,
-0.703830897808075,
-0.26990416646003723,
-0.36945444345474243,
0.27749133110046387,
0.7072877287864685,
-0.3656032383441925,
-0.235099107027053... |
func (o *Project) GetAlias() []ProjectAlias {
if o == nil || o.Alias == nil {
var ret []ProjectAlias
return ret
}
return *o.Alias
} | [
0.31652188301086426,
0.135352224111557,
0.32212939858436584,
1.2263163328170776,
0.08818063139915466,
0.5973421335220337,
0.43325936794281006,
0.4272236227989197,
0.6924605965614319,
-0.5810882449150085,
-0.15673828125,
-0.20180681347846985,
-0.2579208016395569,
1.2623960971832275,
0.576... |
func (o *Project) GetAliasOk() (*[]ProjectAlias, bool) {
if o == nil || o.Alias == nil {
return nil, false
}
return o.Alias, true
} | [
-0.15204556286334991,
0.7253527045249939,
0.45424264669418335,
0.7745474576950073,
0.29977190494537354,
0.5100821256637573,
0.2557499408721924,
1.1464605331420898,
-0.17523179948329926,
0.19228945672512054,
-0.7163838744163513,
-0.11806889623403549,
0.9356131553649902,
0.3557526767253876,
... |
func (o *Project) HasAlias() bool {
if o != nil && o.Alias != nil {
return true
}
return false
} | [
0.7118790745735168,
-0.04778062179684639,
0.3878525197505951,
0.5981413722038269,
0.30827972292900085,
0.6163532733917236,
-0.3779539465904236,
1.1166175603866577,
0.02351301535964012,
-0.81229168176651,
-0.3760012090206146,
-0.43386000394821167,
-0.23927423357963562,
0.2776845693588257,
... |
func (o *Project) SetAlias(v []ProjectAlias) {
o.Alias = &v
} | [
-0.22160311043262482,
0.022732136771082878,
0.07352691888809204,
0.9481884241104126,
-0.2281644493341446,
0.9669967889785767,
-1.1919044256210327,
-0.0755135640501976,
0.06740641593933105,
0.23516616225242615,
-0.061660122126340866,
0.2822485864162445,
-0.06552208960056305,
0.5238962173461... |
func (o *Project) GetRootDirectory() string {
if o == nil || o.RootDirectory == nil {
var ret string
return ret
}
return *o.RootDirectory
} | [
0.049407415091991425,
-0.39328721165657043,
0.5770576596260071,
1.023361325263977,
-0.3331819474697113,
-0.8607211709022522,
0.7143867015838623,
-0.7139162421226501,
1.1753170490264893,
-0.9025166034698486,
0.13565224409103394,
0.04107199236750603,
-0.4892229437828064,
1.3097944259643555,
... |
func (o *Project) GetRootDirectoryOk() (*string, bool) {
if o == nil || o.RootDirectory == nil {
return nil, false
}
return o.RootDirectory, true
} | [
-0.4357929229736328,
0.1358214169740677,
0.621065080165863,
0.8819472789764404,
0.3290987014770508,
-1.033305048942566,
1.1657530069351196,
0.20389391481876373,
0.47804293036460876,
-0.5160409212112427,
-0.8028531074523926,
-0.25401586294174194,
0.6210271716117859,
1.4156874418258667,
-0... |
func (o *Project) HasRootDirectory() bool {
if o != nil && o.RootDirectory != nil {
return true
}
return false
} | [
0.39938032627105713,
-0.5309593081474304,
0.5968809723854065,
0.4234601557254791,
0.26204192638397217,
-1.046459674835205,
0.18847700953483582,
-0.11416766047477722,
0.8318828344345093,
-0.8980773091316223,
-0.25495707988739014,
0.27967435121536255,
0.48292016983032227,
1.5464277267456055,... |
func (o *Project) SetRootDirectory(v string) {
o.RootDirectory = &v
} | [
0.7106027603149414,
-0.737577497959137,
-0.020063122734427452,
0.039777204394340515,
-0.8162732720375061,
-0.7469427585601807,
0.04831920936703682,
-1.1787545680999756,
0.4385591447353363,
-0.39912620186805725,
0.09939362108707428,
1.68046236038208,
0.14036273956298828,
0.259944885969162,
... |
func (s *Shell) Launch(workspace *Workspace, simulate bool) error {
var shell *exec.Cmd = exec.Command(s.Path, s.Args...)
if err := os.Setenv(PATH_ENV, workspace.GeneratePATH()); nil != err {
return err
}
shell.Dir = workspace.Root
shell.Stdin = os.Stdin
shell.Stdout = os.Stdout
shell.Stderr = os.Stderr
she... | [
0.5466494560241699,
-0.1633928120136261,
0.6263917684555054,
-0.008415967226028442,
-0.5601403117179871,
0.350140243768692,
-0.04424506053328514,
-0.14756374061107635,
0.007786610163748264,
-0.20204022526741028,
0.07784152776002884,
0.5808957815170288,
-0.31313997507095337,
0.4392241835594... |
func ResolveShell(path string, args []string) (*Shell, error) {
builder := builder{""}
osshell := os.Getenv(SHELL_ENV)
builder.
use(path).
use(osshell).
use(SHELL_DEFAULT)
if binary, err := builder.build(); nil == err {
D("using shell", binary)
return &Shell{binary, args}, nil
} else {
return nil, e... | [
0.34342917799949646,
0.45146140456199646,
0.6103065609931946,
0.8626180291175842,
0.6221225261688232,
-0.3464767634868622,
-0.7624465227127075,
0.15992489457130432,
-0.9738420248031616,
-0.6586706638336182,
-0.01007782481610775,
0.16625449061393738,
0.020742518827319145,
0.8315614461898804... |
func (cal *Calculate) add(value float64) (result float64) {
if len(cal.Arg) == 2 {
return (cal.Arg[0] + cal.Arg[1])
} else if len(cal.Arg) == 1 {
return (value + cal.Arg[0])
}
log.Fatalln("Please check the data format of the calculation unit")
return
} | [
-0.974659264087677,
0.6521941423416138,
0.6839630603790283,
0.24373486638069153,
0.031504400074481964,
0.7848509550094604,
0.38041865825653076,
-0.525489330291748,
0.19563505053520203,
-0.7388124465942383,
1.0172302722930908,
0.03202715888619423,
-0.8359664678573608,
0.8948880434036255,
... |
func (cal *Calculate) sub(value float64) (result float64) {
if len(cal.Arg) == 2 {
return (cal.Arg[0] - cal.Arg[1])
} else if len(cal.Arg) == 1 {
return (value - cal.Arg[0])
}
log.Fatalln("Please check the data format of the calculation unit")
return
} | [
-0.7228624224662781,
0.8296636939048767,
0.7378346920013428,
0.42433682084083557,
-0.9552997946739197,
0.5467172265052795,
0.7034226059913635,
0.01550576277077198,
-0.5032252073287964,
-0.8887702226638794,
0.12421909719705582,
-0.17750592529773712,
-0.782047688961029,
0.44876670837402344,
... |
func (cal *Calculate) mul(value float64) (result float64) {
if len(cal.Arg) == 2 {
return (cal.Arg[0] * cal.Arg[1])
} else if len(cal.Arg) == 1 {
return (value * cal.Arg[0])
}
log.Fatalln("Please check the data format of the calculation unit")
return
} | [
-0.613055408000946,
0.9756161570549011,
0.739072322845459,
0.6975165605545044,
-0.29491299390792847,
0.446122944355011,
0.5097203254699707,
-0.04662171006202698,
0.34622764587402344,
-0.5879392027854919,
0.49195003509521484,
-0.38120222091674805,
-0.21628272533416748,
0.5409916639328003,
... |
func (cal *Calculate) div(value float64) (result float64) {
if len(cal.Arg) == 2 {
return (cal.Arg[0] / cal.Arg[1])
} else if len(cal.Arg) == 1 {
return (value / cal.Arg[0])
}
log.Fatalln("Please check the data format of the calculation unit")
return
} | [
-1.0703133344650269,
0.6992875933647156,
0.695229709148407,
0.5648478269577026,
0.18835750222206116,
0.30801838636398315,
0.9104718565940857,
-0.2475833296775818,
-0.5429385900497437,
-0.8055335879325867,
0.5950344800949097,
0.22808384895324707,
-0.3437291085720062,
1.0791149139404297,
0... |
func (cal *Calculate) sin(value float64) (result float64) {
if len(cal.Arg) == 1 {
return math.Sin(cal.Arg[0])
} else if len(cal.Arg) == 0 {
return math.Sin(value)
}
log.Fatalln("Please check the data format of the calculation unit")
return
} | [
-1.0604394674301147,
0.40215396881103516,
0.6006597280502319,
0.8329132199287415,
-0.3389468193054199,
0.23753196001052856,
0.6581531167030334,
-0.12945307791233063,
0.092718705534935,
-1.0188093185424805,
0.3930565416812897,
0.24151578545570374,
-1.058305263519287,
0.577262818813324,
0.... |
func (cal *Calculate) pow(value float64) (result float64) {
if len(cal.Arg) == 2 {
return math.Pow(cal.Arg[0], cal.Arg[1])
} else if len(cal.Arg) == 1 {
return math.Pow(value, cal.Arg[0])
}
log.Fatalln("Please check the data format of the calculation unit")
return
} | [
-1.0010608434677124,
0.8261865377426147,
0.8135882019996643,
0.9225159883499146,
0.0428793728351593,
0.6380541324615479,
0.4836253821849823,
0.18148832023143768,
-0.7826663255691528,
-0.31116223335266113,
0.7032545208930969,
-0.5552786588668823,
-0.6168858408927917,
0.6892601847648621,
0... |
func (cal *Calculate) Run(value float64) (result float64) {
switch cal.Operator {
case "add":
result = cal.add(value)
case "sub":
result = cal.sub(value)
case "mul":
result = cal.mul(value)
case "div":
result = cal.div(value)
case "sin":
result = cal.sin(value)
case "pow":
return cal.pow(value)
... | [
-1.0192517042160034,
0.31040775775909424,
0.8795018792152405,
0.14079549908638,
-1.4189550876617432,
0.15712310373783112,
0.794385552406311,
-0.9097229242324829,
0.33443593978881836,
-0.5172975063323975,
-0.39688053727149963,
-0.47714197635650635,
-0.469342976808548,
0.3038357198238373,
... |
func TestValidation(t *testing.T) {
assert := audit.NewTestingAssertion(t, true)
ec := 1
messages := errors.Messages{ec: "valid"}
err := errors.New(ec, messages)
packageName, fileName, line, lerr := errors.Location(err)
assert.True(errors.Valid(err))
assert.Nil(lerr)
assert.Equal(packageName, "github.com/tide... | [
0.20790711045265198,
-0.4113372266292572,
0.3380887806415558,
-0.3903544545173645,
1.050501823425293,
1.0867345333099365,
0.8498431444168091,
0.7455489039421082,
0.36092114448547363,
-0.01955479197204113,
0.24234504997730255,
-0.058620061725378036,
0.23266421258449554,
-0.15948386490345,
... |
func TestAnnotation(t *testing.T) {
assert := audit.NewTestingAssertion(t, true)
ec := 123
messages := errors.Messages{ec: "annotated"}
aerr := testError("wrapped")
err := errors.Annotate(aerr, ec, messages)
assert.ErrorMatch(err, `\[ERRORS_TEST:123\] annotated: wrapped`)
assert.Equal(errors.Annotated(err), ae... | [
0.056466467678546906,
-0.2980375289916992,
0.44232091307640076,
-0.08336823433637619,
0.9622296690940857,
0.4552440345287323,
0.44278621673583984,
0.357899934053421,
0.9583946466445923,
0.18800871074199677,
-0.1831984966993332,
0.8461841940879822,
0.2596178948879242,
0.14556299149990082,
... |
func TestCollection(t *testing.T) {
assert := audit.NewTestingAssertion(t, true)
errA := testError("foo")
errB := testError("bar")
errC := testError("baz")
errD := testError("yadda")
cerr := errors.Collect(errA, errB, errC, errD)
assert.ErrorMatch(cerr, "foo\nbar\nbaz\nyadda")
} | [
0.21149812638759613,
-0.8636919260025024,
0.597004771232605,
-0.3786098062992096,
0.553823709487915,
0.7199679017066956,
0.4032043218612671,
-0.03275427594780922,
0.03329264000058174,
-0.2545454800128937,
0.6609203815460205,
0.7675361633300781,
0.053548116236925125,
0.6513712406158447,
0... |
func TestDoAll(t *testing.T) {
assert := audit.NewTestingAssertion(t, true)
msgs := []string{}
f := func(err error) {
msgs = append(msgs, err.Error())
}
// Test it on annotated errors.
messages := errors.Messages{
1: "foo",
2: "bar",
3: "baz",
4: "yadda",
}
errX := testError("xxx")
errA := errors.An... | [
0.24342848360538483,
0.06047254428267479,
0.7177719473838806,
-0.3891230523586273,
1.0521363019943237,
0.4753988981246948,
0.19171182811260223,
0.06272532790899277,
0.3493900001049042,
-0.14158500730991364,
0.0454561673104763,
0.5669639110565186,
0.5563732385635376,
0.804325520992279,
0.... |
func New(opt ...Option) Client {
opts := &Options{}
for _, o := range opt {
o(opts)
}
return &defaultClient {
opts: opts,
Transport: transport.DefaultClientTransport,
}
} | [
-0.22787320613861084,
-0.48937228322029114,
0.40882474184036255,
0.18228057026863098,
0.08616842329502106,
0.110723577439785,
0.007440473884344101,
-0.7545816898345947,
-0.24055224657058716,
0.10407116264104843,
-0.44197601079940796,
-0.13686023652553558,
-0.5813732743263245,
-0.3728235960... |
func (cm *ComponentManager) Add(c Component) {
n := c.Name()
if cm.hasName(n) {
panic(fmt.Sprintf("duplicate component [%s]", n))
}
cm.names = append(cm.names, n)
cm.cc = append(cm.cc, c)
} | [
-0.5043425559997559,
-0.3143068850040436,
0.37975531816482544,
-1.4826740026474,
0.4829372465610504,
1.1749789714813232,
-0.31972041726112366,
-0.37212058901786804,
0.9381875991821289,
-0.40936899185180664,
-0.5458540916442871,
0.16559447348117828,
-0.15647780895233154,
1.2516435384750366,... |
func (cm *ComponentManager) Requires(names ...string) bool {
hit := 0
for _, n := range names {
if cm.hasName(n) {
hit++
continue
}
}
return hit == len(names)
} | [
-1.2752131223678589,
0.20216134190559387,
0.539679765701294,
-0.6797465085983276,
-0.13568918406963348,
0.2538008391857147,
-0.6670526266098022,
-0.003430291311815381,
-0.423979252576828,
-0.6269698143005371,
-0.5859670639038086,
-0.4529912769794464,
-0.6600853204727173,
1.3463022708892822... |
func (cm *ComponentManager) Get(name string) Component {
for _, c := range cm.cc {
if c.Name() == name {
return c
}
}
return nil
} | [
-0.2610541880130768,
-1.4649795293807983,
0.3416985869407654,
-0.9369760751724243,
0.1797606348991394,
-0.44392114877700806,
-0.42210566997528076,
-0.7383772134780884,
-0.19010844826698303,
-0.19738714396953583,
-0.13790038228034973,
0.44493985176086426,
-0.31904762983322144,
0.03557545319... |
func (cm *ComponentManager) Remove(name string) {
cc := cm.cc
for i, c := range cc {
if c.Name() == name {
// Remove element from the slice.
cc = append(cc[:i], cc[i+1:]...)
return
}
}
} | [
-0.8824201226234436,
-0.8409280776977539,
0.45439237356185913,
-0.3580210506916046,
-0.7938343286514282,
-0.4078538715839386,
-0.06906856596469879,
0.2902988791465759,
0.32325512170791626,
0.49333593249320984,
-1.3631447553634644,
-0.25776407122612,
-0.9711866974830627,
0.5723763704299927,... |
func (node *Node) GetDescendants() SubordinatesResponse {
directCount := len(node.Children)
totalCount := 0
for _, descendant := range node.Children {
totalCount += descendant.countAllDescendants() + 1
}
response := SubordinatesResponse{
Subordinates: SubordinatesInfo{
Count: SubordinatesCount{
Direct... | [
0.03545478731393814,
0.07772333920001984,
0.5562314987182617,
-0.5979893207550049,
0.1807805448770523,
-0.5902715921401978,
0.15238772332668304,
-0.4461732804775238,
-0.401902973651886,
-1.0537840127944946,
-0.8976887464523315,
0.346546471118927,
-0.01297770906239748,
0.541322648525238,
... |
func New(lhs, rhs string, binds pattern.Binds) (*T, error) {
lp, err := pattern.Parse(lhs, binds)
if err != nil {
return nil, fmt.Errorf("parsing %q: %v", lhs, err)
}
rp, err := lp.Derive(rhs)
if err != nil {
return nil, err
}
return &T{lhs: lp, rhs: rp}, nil
} | [
0.5889399647712708,
-1.4952006340026855,
0.517680823802948,
-0.6218892931938171,
-0.13494600355625153,
0.4686664938926697,
-0.4789513349533081,
-0.2528294622898102,
-0.9061822891235352,
0.5779362916946411,
-0.2821345627307892,
0.3770754933357239,
0.23786188662052155,
0.0031939244363456964,... |
func Must(lhs, rhs string, binds pattern.Binds) *T {
t, err := New(lhs, rhs, binds)
if err != nil {
panic("transform: " + err.Error())
}
return t
} | [
0.09818945825099945,
-0.6875324845314026,
0.20104990899562836,
-0.43223950266838074,
0.28034499287605286,
1.061565637588501,
-0.5449824333190918,
-0.4464547038078308,
-0.48513635993003845,
-0.35830873250961304,
-0.054293908178806305,
1.2398231029510498,
-0.8251934051513672,
0.1458283662796... |
func (t *T) Apply(needle string) (string, error) {
ms, err := t.lhs.Match(needle)
if err != nil {
return "", err
}
return t.rhs.Apply(ms)
} | [
0.15211910009384155,
-0.05600455403327942,
0.46608152985572815,
-0.32859066128730774,
-0.8270935416221619,
0.4213520586490631,
0.01766977459192276,
0.07642805576324463,
-0.2098464071750641,
0.5087832808494568,
-0.05722954496741295,
-0.3658459484577179,
-0.2926975190639496,
0.54261910915374... |
func (t *T) Search(needle string, f func(start, end int, match string) error) error {
return t.lhs.Search(needle, func(start, end int, binds pattern.Binds) error {
out, err := t.rhs.Apply(binds)
if err != nil {
return err
}
return f(start, end, out)
})
} | [
0.11733899265527725,
-0.11780539900064468,
0.4371197521686554,
0.15271946787834167,
-0.3819512128829956,
0.42581579089164734,
0.43530240654945374,
-0.1306360810995102,
-1.2718164920806885,
-0.25389769673347473,
0.3582504093647003,
0.6112366914749146,
0.21079617738723755,
-0.124490156769752... |
func (t *T) Replace(needle string) (string, error) {
var out strings.Builder
cur := 0
if err := t.Search(needle, func(start, end int, match string) error {
out.WriteString(needle[cur:start])
out.WriteString(match)
cur = end
return nil
}); err != nil {
return "", err
}
return out.String(), nil
} | [
-0.3652906119823456,
-0.3867298364639282,
0.30870574712753296,
-0.7428461909294128,
-0.5387603044509888,
-0.5395855903625488,
0.4481184184551239,
0.2078881859779358,
-0.19284085929393768,
0.5100027322769165,
-0.2962033450603485,
-0.28319209814071655,
-0.654446005821228,
-0.3389959037303924... |
func (t *T) Reverse() *T { return &T{lhs: t.rhs, rhs: t.lhs} } | [
-0.7101641893386841,
-0.5404083132743835,
0.4735984206199646,
-0.4754394590854645,
-0.05520126596093178,
1.0673259496688843,
-0.339163601398468,
0.10916974395513535,
-1.3065861463546753,
-0.301419198513031,
-0.09929747134447098,
0.7444478869438171,
-0.6141152381896973,
-0.6800199747085571,... |
func (t *T) Reversible() bool { return reversible(t.lhs.Binds(), t.rhs.Binds()) } | [
-0.10169863700866699,
-0.7081150412559509,
0.6584861874580383,
0.0460551381111145,
-0.11873088032007217,
1.1962485313415527,
0.13568654656410217,
0.5368109345436096,
-1.8737868070602417,
1.1836895942687988,
-0.9860444664955139,
0.008153140544891357,
-0.41286545991897583,
-0.427397221326828... |
func (r Config) PrintStep(format string, args ...interface{}) {
if r.DryRun {
format = "[dry-run] " + format
}
_, _ = r.Emitter.PrintStep(format, args...)
} | [
0.18678244948387146,
0.15921786427497864,
0.42990797758102417,
0.07114717364311218,
0.9293861985206604,
0.21245093643665314,
-0.2402203232049942,
-0.21043671667575836,
-0.34819453954696655,
-0.00017961997946258634,
-0.15674829483032227,
0.6898271441459656,
-0.03583909571170807,
1.660882830... |
func compute(cloudConfigOutputJSON string, boshVMsOutput string, boshIP string) (string, error) {
var cloudConfig CloudConfig
err := json.Unmarshal([]byte(cloudConfigOutputJSON), &cloudConfig)
if err != nil {
return "", err
}
var boshVMS BoshVMs
err = json.Unmarshal([]byte(boshVMsOutput), &boshVMS)
if err !=... | [
-0.3036932051181793,
-0.06210761517286301,
0.935242772102356,
-0.21024090051651,
0.2514808177947998,
-0.3502607047557831,
-0.07671602070331573,
0.4356870949268341,
-0.359738826751709,
1.0751780271530151,
-0.47472071647644043,
-0.5000913143157959,
0.16962264478206635,
0.1959330290555954,
... |
func getTotalReservedIPs(subnet Subnet, ips []string, boshIP string) ([]string, bool) {
var reservedIPs []string
totalReservedIps := 0
isboshIPReserved := false
for _, reserved := range subnet.Reserved {
reservedIps := strings.Split(reserved, "-")
if len(reservedIps) == 2 {
startIP := reservedIps[0]
endIP... | [
-0.8600590825080872,
-0.0854814201593399,
1.2325448989868164,
-0.16250652074813843,
0.3523450791835785,
-0.9666563272476196,
0.13446064293384552,
0.617866039276123,
0.5454774498939514,
0.919977068901062,
-0.26009225845336914,
0.1291593462228775,
0.017708685249090195,
-0.749221920967102,
... |
func computeAvailableIPS(boshVMS BoshVMs, ipv4Net *net.IPNet, totalIps int, reservedIPs []string, boshIP string, isBoshIPReserved bool) (int, int) {
usedIPsCount := 0
availableIPs := totalIps - len(reservedIPs)
for _, table := range boshVMS.Tables {
for _, row := range table.Rows {
if ipv4Net.Contains(net.Parse... | [
-0.9094032049179077,
-0.03652934357523918,
0.7448269724845886,
-0.01657792367041111,
-0.10455325990915298,
-0.7401105165481567,
0.08719323575496674,
1.5033150911331177,
0.27656862139701843,
1.100453495979309,
0.11104308813810349,
-0.691379964351654,
0.030545763671398163,
-0.346566975116729... |
func NewCartServer(
logger *logrus.Logger,
cc creating.CartCreator,
pa adding.ProductAdder,
pl listing.ProductLister,
) *CartServer {
cs := new(CartServer)
cs.cartCreator = cc
cs.productAdder = pa
cs.productLister = pl
router := mux.NewRouter()
router.HandleFunc("/carts", cs.createCart).Methods(http.Method... | [
-0.7916186451911926,
-0.8937088251113892,
0.4948098361492157,
0.22861047089099884,
-0.13940493762493134,
-0.3686562776565552,
-0.2609895169734955,
-0.8099251389503479,
0.29436588287353516,
-0.37859073281288147,
-1.0069884061813354,
0.5815843939781189,
0.14557981491088867,
0.961401224136352... |
func Solution(in map[string]map[string]int) []Edge {
return solveWithPrim(in)
} | [
-0.6974464058876038,
-0.1307276487350464,
0.4320368766784668,
0.7011559009552002,
-0.42005711793899536,
-0.6573464870452881,
-0.4574183523654938,
0.29389405250549316,
0.29186761379241943,
0.07860086858272552,
-1.0165033340454102,
-0.11524859070777893,
-0.7325637340545654,
0.104145921766757... |
func New(c *conf.Config) (d *Dao) {
d = &Dao{
c: c,
DB: orm.NewMySQL(c.DB),
httpClient: xhttp.NewClient(c.HTTPClient),
}
d.initORM()
return
} | [
0.3933908939361572,
0.020644988864660263,
0.38003644347190857,
-0.09918402135372162,
-0.7120203971862793,
-0.08167030662298203,
0.4114883542060852,
0.5389516353607178,
-0.35656091570854187,
-0.353196382522583,
-0.47993555665016174,
0.09365304559469223,
0.8804741501808167,
0.697426140308380... |
func NewMockUsecase(ctrl *gomock.Controller) *MockUsecase {
mock := &MockUsecase{ctrl: ctrl}
mock.recorder = &MockUsecaseMockRecorder{mock}
return mock
} | [
-0.5456904172897339,
0.5972700715065002,
0.39676806330680847,
0.9636462926864624,
0.7870284914970398,
-0.5114194750785828,
0.5105206370353699,
-0.10014700889587402,
1.0200645923614502,
1.1576968431472778,
-0.26504576206207275,
-0.7447748780250549,
-0.5075457096099854,
1.2977280616760254,
... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.