text stringlengths 11 6.3k | embedding listlengths 768 768 |
|---|---|
func (play *Play) GoOn() {
iPhase := len(play.phases) - 1
curr := play.phases[iPhase]
curr.active = false
set := curr.start
for _, order := range curr.actions {
for _, act := range order {
set = act.Do(set)
}
}
play.phases = append(play.phases, newPhase(set))
} | [
-0.9268537759780884,
-0.9126504063606262,
0.41379547119140625,
-0.09748640656471252,
0.7278637290000916,
-0.3899591267108917,
0.5639685988426208,
0.648038923740387,
0.40189865231513977,
0.5911338329315186,
-1.0392316579818726,
0.7174707055091858,
-0.21898482739925385,
-0.11702119559049606,... |
func (play *Play) Rollback(phaseNum int) {
count := play.PhaseCount()
//TODO: validate index
if phaseNum < count {
play.phases = play.phases[:phaseNum]
}
count = play.PhaseCount()
play.phases[count-1].active = true
} | [
-0.6992737054824829,
-0.3292864263057709,
0.9878683686256409,
-0.7106963992118835,
0.27306899428367615,
0.7249608635902405,
1.3480865955352783,
0.8776358962059021,
0.9074645638465881,
1.1150397062301636,
-0.24480237066745758,
0.5342676639556885,
-1.7105090618133545,
-1.2287571430206299,
... |
func ExampleAPI() {
type User struct {
ID string `database:"userid"`
FullName string
Email string
Age int
}
// Instantiate a custom API with overridden settings.
api := pgxscan.NewAPI(dbscan.NewAPI(
dbscan.WithFieldNameMapper(strings.ToLower),
dbscan.WithStructTagKey("database"),
))
db... | [
-0.32549771666526794,
0.04956117272377014,
0.30972814559936523,
0.1192493587732315,
-0.2644556164741516,
-0.12116411328315735,
-0.3429137170314789,
-0.3413344621658325,
-0.19018419086933136,
0.05565343797206879,
-0.7254388332366943,
0.5032526850700378,
-0.13246303796768188,
-0.491197228431... |
func Upload(client *gophercloud.ServiceClient, containerName, objectName string, opts *UploadOpts) (*UploadResult, error) {
var sourceFileInfo os.FileInfo
origObject := new(originalObject)
if opts.Path != "" && opts.Content != nil {
return nil, fmt.Errorf("only one of Path and Content can be used")
}
container... | [
-0.613850474357605,
0.17680402100086212,
0.9465070366859436,
-0.14834560453891754,
0.42556142807006836,
-0.5118729472160339,
0.2676631212234497,
-1.0548244714736938,
-0.4030997157096863,
0.2526159882545471,
0.5130791664123535,
0.2690051794052124,
-0.5165393352508545,
-1.1199504137039185,
... |
func createDirMarker(
client *gophercloud.ServiceClient,
containerName string,
objectName string,
opts *UploadOpts,
origObject *originalObject,
sourceFileInfo os.FileInfo) (*UploadResult, error) {
uploadResult := &UploadResult{
Action: "create_dir_marker",
Container: containerName,
Object: objectNam... | [
-0.8186708092689514,
-0.5244501233100891,
0.829304575920105,
-0.10621213167905807,
0.023490356281399727,
-0.04450708255171776,
0.7096691131591797,
-0.13334427773952484,
-0.43257394433021545,
0.16623061895370483,
-0.3802744150161743,
0.32027357816696167,
0.07822541147470474,
0.7249066233634... |
func uploadObject(
client *gophercloud.ServiceClient,
containerName string,
objectName string,
opts *UploadOpts,
origObject *originalObject,
sourceFileInfo os.FileInfo) (*UploadResult, error) {
uploadResult := &UploadResult{
Action: "upload_action",
Container: containerName,
Object: objectName,
}
... | [
-0.19489827752113342,
-0.4519616365432739,
1.0009305477142334,
-0.2609098553657532,
-0.05199684202671051,
-0.18460401892662048,
0.24702316522598267,
-0.737716019153595,
0.09565811604261398,
0.6361294388771057,
-0.2721230983734131,
0.3026810586452484,
-0.10020793229341507,
-0.39060243964195... |
func uploadStreamingSegment(client *gophercloud.ServiceClient, opts *uploadSegmentOpts) (*uploadSegmentResult, error) {
var result uploadSegmentResult
// Checksum is always done when streaming.
hash := md5.New()
buf := bytes.NewBuffer([]byte{})
n, err := io.CopyN(io.MultiWriter(hash, buf), opts.Content, opts.Segm... | [
-0.5868840217590332,
0.621976375579834,
1.0082166194915771,
-0.45151618123054504,
0.5236583948135376,
-0.11244036257266998,
0.581544041633606,
-1.117353081703186,
-0.06857667118310928,
0.4596315026283264,
-0.3812730312347412,
-0.039857152849435806,
-0.7027184963226318,
-0.17092303931713104... |
func ResultWithoutAST(proto *descriptorpb.FileDescriptorProto) Result {
return &result{proto: proto}
} | [
-0.12483919411897659,
-0.046969182789325714,
0.09326615929603577,
-0.4399854838848114,
-0.3537723422050476,
0.9405763149261475,
0.10407699644565582,
-0.827892005443573,
-0.9229968786239624,
-0.8702734112739563,
-0.5087240934371948,
-0.6456960439682007,
-0.4481601417064667,
0.70544391870498... |
func ResultFromAST(file *ast.FileNode, validate bool, handler *reporter.Handler) (Result, error) {
filename := file.Name()
r := &result{file: file, nodes: map[proto.Message]ast.Node{}}
r.createFileDescriptor(filename, file, handler)
if validate {
validateBasic(r, handler)
}
// Now that we're done validating, we... | [
0.28850623965263367,
-0.3718448579311371,
0.3201932907104492,
-0.269778311252594,
-0.39347854256629944,
-0.033063698559999466,
-0.274032860994339,
-0.1452997624874115,
-0.6036844849586487,
-0.6277486085891724,
0.24362601339817047,
-0.6591719388961792,
0.904042661190033,
0.48512396216392517... |
func (r *result) processProto3OptionalFields(msgd *descriptorpb.DescriptorProto) {
// add synthetic oneofs to the given message descriptor for each proto3
// optional field, and update each field to have correct oneof index
var allNames map[string]struct{}
for _, fd := range msgd.Field {
if fd.GetProto3Optional()... | [
-0.07319927960634232,
0.05846057087182999,
0.6255100965499878,
-0.9121144413948059,
-0.43379220366477966,
-0.37113094329833984,
0.2449740618467331,
-0.32687702775001526,
0.02202942967414856,
0.5843232274055481,
-0.5407138466835022,
0.013254118151962757,
0.037380386143922806,
0.357925176620... |
func oscListen(responseChannel chan OscResponse, sock *net.UDPConn) {
doLog( "entering OSC packet listen loop" )
var buf []byte
for {
sock.ReadFromUDP(buf)
doLog("TODO: decode packet")
}
} | [
0.37665271759033203,
-0.8429713845252991,
0.4413815140724182,
-1.1955760717391968,
0.4896368980407715,
0.2339099794626236,
-0.25016242265701294,
-0.08921083062887192,
0.3249651789665222,
-0.782172679901123,
-0.1287820190191269,
0.6866627931594849,
-0.24156801402568817,
-0.6309354305267334,... |
func generateNoise(responseChannel chan OscResponse) {
doLog( "generating audio" )
var t float64 = 0
file := os.Stdout
data := new(bytes.Buffer)
sample := 0
for {
//TODO: check for UDP packets and send data in response
l := (int16) ( 16000 * math.Sin(t) )
r := (int16) ( 1... | [
0.3188093900680542,
-0.18118278682231903,
0.9088537096977234,
-0.6551221013069153,
0.4945105314254761,
-0.41280844807624817,
-0.09482523798942566,
-0.8865797519683838,
0.9671553373336792,
0.049755197018384933,
-0.3184966742992401,
-0.17545045912265778,
-0.3498314321041107,
0.18272840976715... |
func NewSource(source *local.Source, bk banktypes.QueryServer) *Source {
return &Source{
Source: source,
q: bk,
}
} | [
0.19154952466487885,
0.294389009475708,
0.024101531133055687,
0.5954424142837524,
-1.0306622982025146,
-0.38427412509918213,
-0.5130338072776794,
-0.6663420796394348,
0.6254671216011047,
-0.1085771769285202,
-0.48418769240379333,
0.568705141544342,
-0.8141652941703796,
0.7255639433860779,
... |
func NewBankServiceServer() bank_v1.BankServiceServer {
db := newFirestoreDatabase(nil) // todo: init firestore client
service := newService(db)
grpcApi := newGrpcApi(service)
return grpcApi
} | [
-0.6011287569999695,
-0.5441710948944092,
0.30113932490348816,
0.13281871378421783,
0.6047961711883545,
0.30226388573646545,
0.14658737182617188,
-0.33531931042671204,
-0.30204764008522034,
-0.08843309432268143,
-0.09214530885219574,
0.390840083360672,
-1.5195121765136719,
0.47808244824409... |
func Read(t *testing.T, paths ...string) []byte {
t.Helper()
path := filepath.Join(paths...)
file, err := ioutil.ReadFile(path)
if err != nil {
t.Fatalf("cannot read %v: %v", path, err)
}
return file
} | [
0.8553807735443115,
0.050995323807001114,
0.49701690673828125,
0.4293306767940521,
0.12595459818840027,
0.9696266055107117,
0.1584305763244629,
-0.2517477571964264,
-0.8418033719062805,
-0.44334936141967773,
1.0754201412200928,
-0.09993478655815125,
-0.12378944456577301,
-0.728115200996398... |
func TempFile(t *testing.T, data string) (string, func()) {
t.Helper()
fp, err := ioutil.TempFile(os.TempDir(), "gotest")
if err != nil {
t.Fatalf("test.TempFile: could not create file in %v: %v", os.TempDir(), err)
}
defer func() {
err := fp.Close()
if err != nil {
t.Fatalf("test.TempFile: close: %v", ... | [
0.9409520626068115,
-0.6036167740821838,
0.7162351608276367,
-1.173835277557373,
0.6205778121948242,
-0.43899476528167725,
0.6623281836509705,
0.2302088588476181,
0.24078963696956635,
0.6357084512710571,
-0.6084122061729431,
-0.4700641930103302,
-0.03134814649820328,
-0.2939540147781372,
... |
func SP(s string) *string { return &s } | [
1.204850435256958,
-0.4401770234107971,
0.24391266703605652,
-0.5137844085693359,
-1.707891821861267,
0.06547930091619492,
-0.14103130996227264,
-1.110561490058899,
1.1125526428222656,
-0.8846264481544495,
0.6491555571556091,
0.7088796496391296,
-0.2556852400302887,
-1.8174049854278564,
... |
func I64P(i int64) *int64 { return &i } | [
-0.3578345477581024,
-0.7032343149185181,
0.35790395736694336,
-0.1372964233160019,
-0.9104644060134888,
0.06588476151227951,
0.2964302599430084,
-0.9674922227859497,
0.6343716382980347,
0.8667068481445312,
0.3953767418861389,
-0.8486407995223999,
-1.0460803508758545,
-0.9826987385749817,
... |
func AddRecorderTimer(program *Program) {
m.Lock()
defer m.Unlock()
if programExists(&recorderTimers.Programs, program) {
util.Error("Already Recoder Timer Exist " +
program.Title + " " + program.Channel + " " + program.Start + " " + program.Stop)
return
}
recorderTimers.Programs = append(recorderTimers.Pro... | [
-0.9689639806747437,
-0.2882905900478363,
0.8162128925323486,
-0.5525436997413635,
0.42751744389533997,
0.7737540602684021,
-0.3548148274421692,
-0.14242170751094818,
0.44497841596603394,
0.5610830187797546,
-0.8743491172790527,
0.5120462775230408,
-1.1020777225494385,
1.1006361246109009,
... |
func SaveRecorderTimers() {
SaveJSON("recorder-timers.json", recorderTimers)
} | [
-1.0013126134872437,
-0.4305529296398163,
0.29253950715065,
-0.07072099298238754,
0.38589414954185486,
-0.31112444400787354,
-0.11653508245944977,
-0.41075560450553894,
-0.09369564056396484,
1.3035757541656494,
-2.463076591491699,
0.27504661679267883,
-0.46224287152290344,
0.70365154743194... |
func debugBindSocket() bool { return false } | [
-0.1496082842350006,
0.4310086667537689,
0.5750250816345215,
-0.25502610206604004,
0.12381035834550858,
0.35019823908805847,
0.03601253032684326,
-0.6359472870826721,
0.6075015068054199,
-0.7764214277267456,
-0.3634178340435028,
0.7319395542144775,
-1.889078974723816,
0.6875527501106262,
... |
func (e *Elevator) sortFloorList(requestList []int) {
if e.direction == "up" {
sort.Ints(requestList)
} else {
sort.Ints(requestList)
sort.Sort(sort.Reverse(sort.IntSlice(requestList)))
}
} | [
-1.3912571668624878,
0.3396732211112976,
0.6600019335746765,
1.222500205039978,
-0.3361685276031494,
0.48983874917030334,
0.5895652174949646,
-0.003991498611867428,
-0.34126630425453186,
-0.37179630994796753,
-0.6654142737388611,
-0.4139893651008606,
-0.6934985518455505,
1.7717581987380981... |
func (e *Elevator) addNewRequest(requestedFloor int) {
// If the request is not already in the list, add it in
if !(isElementExist(e.floorRequestsList, requestedFloor)) {
e.floorRequestsList = append(e.floorRequestsList, requestedFloor)
}
if e.currentFloor < requestedFloor {
e.direction = "up"
} else if e.cur... | [
-1.82908034324646,
-0.017615308985114098,
0.7557786107063293,
0.7845094203948975,
0.10315960645675659,
0.7506834864616394,
-0.5967768430709839,
-0.02935408242046833,
0.24081727862358093,
-0.5779865980148315,
0.38609954714775085,
-0.4730176627635956,
-0.7911068797111511,
1.5937080383300781,... |
func MyToM(obj interface{}) (toolkit.M, error) {
buffer := []byte{}
buff := bytes.NewBuffer(buffer)
encoder := json.NewEncoder(buff)
err := encoder.Encode(obj)
if err != nil {
return nil, err
}
decoder := json.NewDecoder(buff)
decoder.UseNumber()
res := toolkit.M{}
err = decoder.Decode(&res)
if err != nil ... | [
-0.36867761611938477,
-0.4582323133945465,
0.778008759021759,
-0.530804455280304,
-1.4599467515945435,
-0.8451366424560547,
-0.21999680995941162,
-0.46046286821365356,
0.390463262796402,
0.2250414937734604,
-0.9773716926574707,
-0.312200129032135,
0.17640182375907898,
-0.6128482818603516,
... |
func HandleFind(
repos core.RepositoryStore,
secrets core.SecretStore,
) http.HandlerFunc {
return func(w http.ResponseWriter, r *http.Request) {
var (
namespace = chi.URLParam(r, "owner")
name = chi.URLParam(r, "name")
secret = chi.URLParam(r, "secret")
)
repo, err := repos.FindName(r.Context... | [
0.0549861416220665,
-0.1344231814146042,
0.5409733653068542,
-0.11892753094434738,
-0.16485944390296936,
0.06121666356921196,
0.07012304663658142,
-0.7382838129997253,
0.11258543282747269,
0.7999524474143982,
0.615986704826355,
-0.561415433883667,
0.05420719459652901,
0.18832844495773315,
... |
func ValidateResponseWithRequest(res LocationService, req LocationService) bool {
return res.Zip == req.Zip || (res.Coordinate.Lat != "" && res.Coordinate.Lng != "")
} | [
-0.20646905899047852,
-1.4853426218032837,
0.3981485962867737,
-0.06989334523677826,
0.22425979375839233,
0.2256964147090912,
-0.6822481155395508,
-0.6423309445381165,
0.9956585168838501,
-0.9850602746009827,
0.23149466514587402,
-0.9108138680458069,
-0.16127139329910278,
-0.12343274801969... |
func setup() {
println("setup")
} | [
0.7375634908676147,
-0.30518096685409546,
0.18862660229206085,
0.933043360710144,
0.384021133184433,
0.5245764255523682,
1.3607264757156372,
0.03638971969485283,
-0.037010978907346725,
0.11741094291210175,
-0.30441054701805115,
1.1882880926132202,
-0.4027988612651825,
0.24060706794261932,
... |
func NewExpect(name string, arg ...string) (ep *ExpectProcess, err error) {
// if env[] is nil, use current system env and the default command as name
return NewExpectWithEnv(name, arg, nil, name)
} | [
0.3880588114261627,
-0.6576147675514221,
0.44423893094062805,
0.5525887608528137,
-0.9413095116615295,
0.47936785221099854,
-0.626170814037323,
-0.01715223677456379,
-0.12291887402534485,
0.5249369740486145,
-0.025269795209169388,
0.9811013340950012,
-0.23498037457466125,
0.929909706115722... |
func NewExpectWithEnv(name string, args []string, env []string, serverProcessConfigName string) (ep *ExpectProcess, err error) {
ep = &ExpectProcess{
cfg: expectConfig{
name: serverProcessConfigName,
cmd: name,
args: args,
env: env,
},
readCloseCh: make(chan struct{}),
}
ep.cmd = commandFromConfi... | [
0.4290566146373749,
-1.0153635740280151,
0.5826977491378784,
0.0421501100063324,
-0.7059503197669983,
0.3700163662433624,
-0.24115605652332306,
-0.8886896967887878,
-0.25670015811920166,
0.7624748945236206,
-0.2502097189426422,
0.8914296627044678,
-0.28413617610931396,
0.7073192596435547,
... |
func (ep *ExpectProcess) ExpectFunc(ctx context.Context, f func(string) bool) (string, error) {
i := 0
for {
line, errsFound := func() (string, bool) {
ep.mu.Lock()
defer ep.mu.Unlock()
// check if this expect has been already closed
if ep.cmd == nil {
return "", true
}
for i < len(ep.lines)... | [
0.5286623239517212,
-0.22360970079898834,
0.9830933213233948,
-0.9013780951499939,
-0.4089040756225586,
-0.6217646598815918,
-0.13892383873462677,
-0.2904230058193207,
-0.5777342319488525,
0.03830321505665779,
1.2576067447662354,
0.4077748656272888,
0.2827942371368408,
-0.24332399666309357... |
func (ep *ExpectProcess) ExpectWithContext(ctx context.Context, s ExpectedResponse) (string, error) {
var (
expr *regexp.Regexp
err error
)
if s.IsRegularExpr {
expr, err = regexp.Compile(s.Value)
if err != nil {
return "", err
}
}
return ep.ExpectFunc(ctx, func(txt string) bool {
if expr != nil {
... | [
0.2679200768470764,
-0.7463875412940979,
0.76032954454422,
-0.6999332308769226,
-1.411887526512146,
-0.47194427251815796,
-0.288055419921875,
-0.7959972023963928,
1.2189195156097412,
0.10654926300048828,
0.0327068455517292,
0.4339630603790283,
-0.33125975728034973,
-0.5924226641654968,
-... |
func (ep *ExpectProcess) Expect(s string) (string, error) {
return ep.ExpectWithContext(context.Background(), ExpectedResponse{Value: s})
} | [
0.30894985795021057,
-0.2559870183467865,
0.38087576627731323,
-0.5608957409858704,
-0.9093499779701233,
0.2014404982328415,
0.42120295763015747,
-0.8381515145301819,
1.0810712575912476,
-0.1859784722328186,
0.5097222328186035,
0.47032833099365234,
-0.5091210603713989,
-0.3031296730041504,... |
func (ep *ExpectProcess) LineCount() int {
ep.mu.Lock()
defer ep.mu.Unlock()
return ep.count
} | [
1.0327755212783813,
-0.7437165379524231,
0.39121416211128235,
-0.4678684175014496,
0.5972517132759094,
0.7678738832473755,
0.19820283353328705,
0.9568305015563965,
-0.4766121804714203,
-0.4911012649536133,
0.4755052328109741,
0.8376341462135315,
-0.4866062104701996,
0.6355961561203003,
0... |
func (ep *ExpectProcess) ExitCode() (int, error) {
ep.mu.Lock()
defer ep.mu.Unlock()
if ep.cmd == nil {
return ep.exitCode, nil
}
if ep.exitErr != nil {
// If the child process panics or is killed, for instance, the
// goFailpoint triggers the exit event, the ep.cmd isn't nil and
// the exitCode will des... | [
0.17673678696155548,
-0.4852030873298645,
0.7147765159606934,
-0.2867067754268646,
0.017355870455503464,
-0.3183762729167938,
0.21133089065551758,
0.9006494879722595,
0.050469689071178436,
0.1828204095363617,
0.5817804932594299,
-0.18566063046455383,
-0.12488438189029694,
0.247867032885551... |
func (ep *ExpectProcess) Stop() error {
err := ep.Signal(syscall.SIGTERM)
if err != nil && errors.Is(err, os.ErrProcessDone) {
return nil
}
return err
} | [
0.060805972665548325,
-0.14494362473487854,
0.5217978358268738,
-0.5833113789558411,
0.4506538510322571,
0.41968974471092224,
0.15113358199596405,
0.711530864238739,
-0.2093256711959839,
-0.05211630091071129,
-0.5050809979438782,
0.2161003202199936,
-0.7221639752388,
-0.08559504896402359,
... |
func (ep *ExpectProcess) Signal(sig os.Signal) error {
ep.mu.Lock()
defer ep.mu.Unlock()
if ep.cmd == nil {
return errors.New("expect process already closed")
}
return ep.cmd.Process.Signal(sig)
} | [
-0.5533865094184875,
-0.44709813594818115,
0.23738829791545868,
0.14351391792297363,
-0.6679846048355103,
0.6415433883666992,
0.3394261300563812,
-0.2366691529750824,
0.27058663964271545,
-0.6759548187255859,
-0.155064195394516,
0.5896707773208618,
-0.26562875509262085,
1.1437565088272095,... |
func exitCode(state *os.ProcessState) int {
status := state.Sys().(syscall.WaitStatus)
if status.Signaled() {
return 128 + int(status.Signal())
}
return status.ExitStatus()
} | [
-0.10905691236257553,
0.4677148461341858,
0.4884687662124634,
-0.018866661936044693,
-0.5349104404449463,
-0.1498403549194336,
-0.47990792989730835,
0.7861065864562988,
0.24641890823841095,
0.46985048055648804,
0.10013807564973831,
-1.0468333959579468,
0.5525709390640259,
0.696685671806335... |
func (ep *ExpectProcess) Wait() {
ep.wg.Wait()
} | [
0.449086993932724,
-0.5363271832466125,
0.19745662808418274,
-0.9962450861930847,
0.8036568760871887,
1.2859523296356201,
0.7865892648696899,
0.2542168200016022,
-0.6061408519744873,
-0.46711939573287964,
0.29635512828826904,
1.1646413803100586,
0.05642266944050789,
0.8652481436729431,
-... |
func (ep *ExpectProcess) Close() error {
ep.wg.Wait()
ep.mu.Lock()
defer ep.mu.Unlock()
// this signals to other funcs that the process has finished
ep.cmd = nil
return ep.exitErr
} | [
-0.10919085144996643,
-0.5104590654373169,
0.6280953288078308,
-0.3478347957134247,
-0.6741982698440552,
0.8089163303375244,
0.3498878479003906,
0.12478591501712799,
-0.24490703642368317,
-0.6576836109161377,
0.7120416760444641,
0.1251847892999649,
-1.0133945941925049,
0.7370729446411133,
... |
func (ep *ExpectProcess) ReadLine() string {
ep.mu.Lock()
defer ep.mu.Unlock()
if ep.count > ep.cur {
line := ep.lines[ep.cur]
ep.cur++
return line
}
return ""
} | [
-0.03988277167081833,
-0.4977130591869354,
0.5472022891044617,
0.14575092494487762,
0.15872247517108917,
0.16382086277008057,
-0.04257776215672493,
-0.39147713780403137,
-0.292988657951355,
-0.7662699222564697,
1.4816725254058838,
0.3671064078807831,
-0.6380107402801514,
-0.271203786134719... |
func NewSpaceshipService(cfg config.IConfig, rep repository.ISpaceshipRepository) *SpaceshipService {
return &SpaceshipService{config: cfg, repository: rep}
} | [
-1.1319712400436401,
-0.10793782770633698,
0.028505882248282433,
0.1817866563796997,
-0.7870899438858032,
0.08454912900924683,
-1.030981183052063,
0.02379252202808857,
0.59505695104599,
0.012136612087488174,
-0.43490883708000183,
1.0402286052703857,
-0.4597696363925934,
0.8842744827270508,... |
func (service *SpaceshipService) GetAllSpaceships() ([]*model.Spaceship, error) {
if service.config.ServiceEnabled() {
return service.repository.GetAllSpaceships()
}
return []*model.Spaceship{}, nil
} | [
-0.5661405920982361,
-0.09023096412420273,
0.4875633418560028,
1.4568766355514526,
-0.7988317608833313,
0.902070939540863,
-1.2287729978561401,
0.024022335186600685,
1.1558634042739868,
-1.337124228477478,
0.059711385518312454,
1.5558429956436157,
-0.5592793226242065,
1.8820456266403198,
... |
func (service *SpaceshipService) GetSpaceshipByID(id int) (*model.Spaceship, error) {
if service.config.ServiceEnabled() {
return service.repository.GetSpaceshipByID(id)
}
return &model.Spaceship{}, nil
} | [
-0.4276707172393799,
-0.044693659991025925,
0.3826049864292145,
0.6279241442680359,
-0.5018594861030579,
-0.11975184828042984,
-0.47274351119995117,
-0.6547909379005432,
0.7555410265922546,
-0.08144166320562363,
-0.3581122159957886,
0.7570962905883789,
-0.28105297684669495,
1.1333541870117... |
func (s GetAuthorizersInput) String() string {
return awsutil.Prettify(s)
} | [
0.6693799495697021,
0.017771752551198006,
0.08579311519861221,
-0.4970640540122986,
-0.5402846932411194,
0.45778295397758484,
0.6602587103843689,
-0.7232527732849121,
0.29512107372283936,
-0.12915311753749847,
0.8958977460861206,
1.468889594078064,
0.25643590092658997,
-0.41449302434921265... |
func (s *GetAuthorizersInput) Validate() error {
invalidParams := aws.ErrInvalidParams{Context: "GetAuthorizersInput"}
if s.RestApiId == nil {
invalidParams.Add(aws.NewErrParamRequired("RestApiId"))
}
if invalidParams.Len() > 0 {
return invalidParams
}
return nil
} | [
0.2203785479068756,
0.338908851146698,
0.3460226356983185,
0.14852549135684967,
0.061978913843631744,
-0.07650773972272873,
0.02119949273765087,
-0.45244866609573364,
-0.010018672794103622,
-0.18848884105682373,
1.2996835708618164,
0.44201791286468506,
-0.840589165687561,
0.462255835533142... |
func (s GetAuthorizersInput) MarshalFields(e protocol.FieldEncoder) error {
e.SetValue(protocol.HeaderTarget, "Content-Type", protocol.StringValue("application/json"), protocol.Metadata{})
if s.RestApiId != nil {
v := *s.RestApiId
metadata := protocol.Metadata{}
e.SetValue(protocol.PathTarget, "restapi_id", p... | [
0.16824103891849518,
0.3941984176635742,
0.3828029930591583,
-1.118332862854004,
0.33676499128341675,
0.32790085673332214,
0.08291070908308029,
-0.11084210127592087,
0.011730373837053776,
-0.04365954548120499,
0.16281403601169586,
0.5440109968185425,
-0.5490126013755798,
-0.339829146862030... |
func (s GetAuthorizersOutput) String() string {
return awsutil.Prettify(s)
} | [
0.9943420886993408,
-0.41598284244537354,
0.14854906499385834,
-0.3582620918750763,
-0.92217618227005,
-0.2027902752161026,
0.8360709547996521,
-0.5805144906044006,
-0.04471036046743393,
-0.1055808886885643,
0.9950578808784485,
1.0580344200134277,
0.6395711302757263,
-0.5943938493728638,
... |
func (s GetAuthorizersOutput) MarshalFields(e protocol.FieldEncoder) error {
if s.Items != nil {
v := s.Items
metadata := protocol.Metadata{}
ls0 := e.List(protocol.BodyTarget, "item", metadata)
ls0.Start()
for _, v1 := range v {
ls0.ListAddFields(v1)
}
ls0.End()
}
if s.Position != nil {
v := *s... | [
0.23092858493328094,
0.5197919011116028,
0.2118409425020218,
-0.9914809465408325,
0.3015249967575073,
-0.07227905094623566,
0.1790647953748703,
0.2476014792919159,
0.11858563125133514,
0.13612772524356842,
0.01627163775265217,
0.18269097805023193,
-0.30098170042037964,
-0.32095950841903687... |
func (r GetAuthorizersRequest) Send(ctx context.Context) (*GetAuthorizersResponse, error) {
r.Request.SetContext(ctx)
err := r.Request.Send()
if err != nil {
return nil, err
}
resp := &GetAuthorizersResponse{
GetAuthorizersOutput: r.Request.Data.(*GetAuthorizersOutput),
response: &aws.Response{R... | [
-0.7511439919471741,
-0.09224144369363785,
0.17249992489814758,
0.050410449504852295,
0.07936571538448334,
-0.5392948389053345,
-0.19004864990711212,
-1.0743151903152466,
0.15640141069889069,
0.17734768986701965,
0.1254757046699524,
1.3120115995407104,
-0.3104475140571594,
-0.1055066436529... |
func (r *GetAuthorizersResponse) SDKResponseMetdata() *aws.Response {
return r.response
} | [
0.3943590521812439,
-0.27248743176460266,
0.30896949768066406,
-0.17159010469913483,
-0.38974952697753906,
-0.2676119804382324,
-0.508430004119873,
-0.4440879821777344,
1.013750672340393,
0.04448150470852852,
0.0778728798031807,
0.5428787469863892,
0.18440668284893036,
-0.8908990025520325,... |
func (r *response) Err(err error) bool {
if r.err != nil {
return true
}
if err == nil {
return false
}
//TODO: Add logging here? (klauspost)
e := err.Error()
r.Error = &e
r.err = err
return true
} | [
-0.11698182672262192,
0.12061178684234619,
0.5565218329429626,
0.6580085754394531,
-0.7439367771148682,
0.05335944518446922,
-0.38032451272010803,
-0.15643440186977386,
1.182694673538208,
-0.8938077092170715,
-0.3254967927932739,
-0.6726853847503662,
0.2061496078968048,
0.9322214722633362,... |
func Exists(path string) bool {
_, err := os.Stat(path)
return !os.IsNotExist(err)
} | [
-0.7163117527961731,
-0.231003075838089,
0.3985491096973419,
-0.5927662253379822,
0.4887106716632843,
1.4945485591888428,
-0.6751129031181335,
-0.15037988126277924,
-0.2358996570110321,
-0.7311785221099854,
-0.21574056148529053,
-0.31483152508735657,
0.2863917350769043,
0.23136280477046967... |
func ListFilesIn(dir string) ([]string, error) {
files := []string{}
list, err := ioutil.ReadDir(dir)
if err != nil {
return files, err
}
for _, fi := range list {
if fi.IsDir() {
continue
}
files = append(files, filepath.Join(dir, fi.Name()))
}
return files, nil
} | [
-0.10246971249580383,
-0.40832316875457764,
0.6940221190452576,
-0.03495905175805092,
-0.5418063998222351,
0.06148441135883331,
-0.21247388422489166,
0.3776622712612152,
0.17719756066799164,
0.13666795194149017,
0.1686786562204361,
1.0518165826797485,
-0.5310006141662598,
0.912060022354126... |
func MoveFiles(paths []string, dest string) error {
if len(paths) == 0 {
return nil
}
if err := os.MkdirAll(dest, 0755); err != nil {
return err
}
for _, oldfn := range paths {
newfn := filepath.Join(dest, filepath.Base(oldfn))
err := os.Rename(oldfn, newfn)
if err != nil {
return fmt.Errorf("could... | [
-0.501677393913269,
0.2925295829772949,
0.7795422077178955,
0.2980916500091553,
0.15793941915035248,
-0.20686540007591248,
0.5015808343887329,
0.17315758764743805,
-0.2814828157424927,
0.46491554379463196,
0.4363693594932556,
-0.9137631058692932,
-0.2627771496772766,
0.21814782917499542,
... |
func DirSize(dir string, excludes []string) (int, error) {
args := []string{"-bs", dir}
for _, s := range excludes {
args = append(args, fmt.Sprintf("--exclude=\"%s\"", s))
}
cmd := exec.Command("/usr/bin/du", args...)
data, err := cmd.Output()
if err != nil {
return 0, err
}
return strconv.Atoi(strings.S... | [
-1.3642663955688477,
1.529476523399353,
1.0559945106506348,
-0.18933849036693573,
-1.0627881288528442,
-0.27615848183631897,
0.6287092566490173,
0.8114437460899353,
-0.29365354776382446,
-0.15316133201122284,
0.29198238253593445,
0.5654939413070679,
-0.9951473474502563,
0.10499189049005508... |
func Create(path string, data []byte) error {
if err := os.MkdirAll(filepath.Dir(path), 0755); err != nil {
return err
}
return ioutil.WriteFile(path, data, 0755)
} | [
0.7610484957695007,
0.5928049683570862,
0.3929813504219055,
0.6669104695320129,
0.07931181788444519,
0.9907615184783936,
0.12083811312913895,
-0.6575626730918884,
-0.6152615547180176,
-0.5916104912757874,
0.1804589182138443,
-0.5568134784698486,
-0.05175618454813957,
0.374244749546051,
-... |
func EmptyBashScript(fn string) error {
return Create(fn, []byte(`#!/bin/bash
# your code goes here
exit 0;
`))
} | [
0.3903449475765228,
0.557325005531311,
0.4286712408065796,
1.00547194480896,
0.2372518926858902,
0.5723049640655518,
0.07912375032901764,
-0.3575206696987152,
-0.847496509552002,
-0.8765075206756592,
-0.7725105285644531,
0.7048320770263672,
0.9168902039527893,
0.38184812664985657,
0.4610... |
func EmptyDotFile(path string) error {
_, err := os.OpenFile(path, os.O_RDONLY|os.O_CREATE, 0666)
return err
} | [
-0.15766242146492004,
-0.0968727096915245,
0.8585953116416931,
-1.2610729932785034,
0.1778607815504074,
1.8229494094848633,
0.9307347536087036,
-0.08670920133590698,
-0.15853841602802277,
-0.26663392782211304,
-0.5425195097923279,
0.23331418633460999,
-0.041073691099882126,
-0.218704074621... |
func Glob(path ...string) []string {
f, _ := filepathx.Glob(filepath.Join(path...))
return f
} | [
0.9569491147994995,
0.14791810512542725,
0.6277493238449097,
1.4826278686523438,
0.23110590875148773,
1.1577929258346558,
-0.14773355424404144,
-0.49828776717185974,
-0.8663727641105652,
0.5649418234825134,
0.9092513918876648,
-0.32024526596069336,
0.22453153133392334,
-0.43366143107414246... |
func (s *MasterService) Get(id int) (*Master, *Response, error) {
u := fmt.Sprintf("masters/%d", id)
req, err := s.client.NewRequest("GET", u, nil)
if err != nil {
return nil, nil, err
}
master := new(Master)
resp, err := s.client.Do(req, master)
if err != nil {
return nil, resp, err
}
return master, resp... | [
-0.7530393600463867,
0.2305757701396942,
0.4051697254180908,
-0.6634060144424438,
0.3589400053024292,
-0.43967270851135254,
-1.2446603775024414,
-0.1910601109266281,
0.5793470144271851,
-0.46421578526496887,
-0.6825330257415771,
1.3649848699569702,
-0.8687527179718018,
-0.01491062622517347... |
func (o *CreateConnectionReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) {
switch response.Code() {
case 200:
result := NewCreateConnectionOK()
if err := result.readResponse(response, consumer, o.formats); err != nil {
return nil, err
}
return result, ... | [
-0.6255420446395874,
-1.1159229278564453,
0.6199582815170288,
0.3918750584125519,
0.3019807040691376,
-0.9544751048088074,
0.05758672207593918,
-0.4654695987701416,
0.12960205972194672,
0.3226289749145508,
0.5748380422592163,
-0.9260212182998657,
-1.1786220073699951,
0.13826218247413635,
... |
func NewCreateConnectionOK() *CreateConnectionOK {
return &CreateConnectionOK{}
} | [
-0.5257188081741333,
-0.6843656301498413,
-0.15927141904830933,
0.9492694139480591,
-0.5208606719970703,
0.34692201018333435,
1.2282036542892456,
0.28221046924591064,
-0.577612578868866,
1.0094068050384521,
-0.4192684590816498,
-2.2411041259765625,
0.14922437071800232,
0.9123207926750183,
... |
func NewCreateConnectionBadRequest() *CreateConnectionBadRequest {
return &CreateConnectionBadRequest{}
} | [
-0.8775803446769714,
-0.6395542621612549,
0.24060103297233582,
0.543323814868927,
0.2361004799604416,
-0.13555441796779633,
-0.5099661350250244,
0.44498053193092346,
-0.7620118260383606,
-0.38238346576690674,
0.6809495687484741,
-0.895386278629303,
-0.9064897894859314,
0.8648604154586792,
... |
func NewCreateConnectionNotFound() *CreateConnectionNotFound {
return &CreateConnectionNotFound{}
} | [
-0.3401636779308319,
-1.456152081489563,
0.035515885800123215,
0.2941823899745941,
0.16056665778160095,
0.4559607207775116,
0.5747764706611633,
-0.17845100164413452,
-0.45988729596138,
0.3928503692150116,
-0.3118613064289093,
-0.45122429728507996,
-0.5918890237808228,
0.4855892062187195,
... |
func New(opts ...Option) cacher.Cacher {
var options = newOptions(opts...)
return &service{
redis: redis.NewClient(&redis.Options{
Addr: options.Address,
Password: options.Password,
DB: options.DB,
}),
}
} | [
-0.3955273926258087,
0.032843030989170074,
0.4798959493637085,
0.04725286737084389,
-0.7982820272445679,
-0.2000686079263687,
-1.3136597871780396,
-0.13911688327789307,
0.05655871331691742,
-0.027060892432928085,
0.17800752818584442,
0.7652772665023804,
0.10059379786252975,
1.0379008054733... |
func FromConnection(client *redis.Client) cacher.Cacher {
return &service{redis: client}
} | [
0.7872403860092163,
0.19412505626678467,
0.07597727328538895,
-0.5665647983551025,
-1.1727570295333862,
-0.029997974634170532,
-1.119081735610962,
-0.41085752844810486,
0.009824934415519238,
0.39059358835220337,
0.35739925503730774,
0.28575533628463745,
0.7407596111297607,
0.38296431303024... |
func (s *service) Get(key string, val interface{}) error {
if err := s.redis.Get(key).Scan(val); err != nil && err != redis.Nil {
return err
}
return nil
} | [
-0.6040347814559937,
1.0135974884033203,
0.43877550959587097,
0.10521154850721359,
-0.27512794733047485,
-0.641336977481842,
-1.6725507974624634,
-0.629547119140625,
-0.05560484528541565,
0.015071883797645569,
0.48859408497810364,
1.0849831104278564,
0.030489720404148102,
0.429985404014587... |
func (s *service) Set(key string, val interface{}, expiration time.Duration) error {
return s.redis.Set(key, val, expiration).Err()
} | [
-0.7471539378166199,
0.8873722553253174,
0.04152907431125641,
0.16995269060134888,
-0.3552492558956146,
0.29278305172920227,
-1.694417953491211,
-0.30518490076065063,
-0.07039222866296768,
0.9399574398994446,
0.13798323273658752,
0.5614086985588074,
0.30448898673057556,
0.5149565935134888,... |
func (s *service) Del(key string) error {
return s.redis.Del(key).Err()
} | [
-0.03356030583381653,
0.8480238914489746,
0.18019534647464752,
-0.027212409302592278,
-0.9402860403060913,
0.5579771995544434,
-1.1071548461914062,
0.03873911872506142,
0.41867679357528687,
0.22899822890758514,
0.14653576910495758,
0.8432430624961853,
-0.475021630525589,
0.4835303127765655... |
func (s *service) Exists(keys ...string) (int64, error) {
return s.redis.Exists(keys...).Result()
} | [
-1.787405014038086,
0.522132933139801,
0.518409788608551,
-0.05369475111365318,
0.591120719909668,
-0.4620896279811859,
-1.514803171157837,
-0.10191261768341064,
-0.6054832339286804,
0.08221831172704697,
-0.3432055115699768,
0.38092175126075745,
-0.4756169319152832,
0.40180301666259766,
... |
func (s *service) Keys(pattern string) ([]string, error) {
return s.redis.Keys(pattern).Result()
} | [
-1.791235089302063,
1.1777228116989136,
0.07654530555009842,
-0.5536267757415771,
0.3441675007343292,
-0.5527019500732422,
-1.1540803909301758,
0.02987896464765072,
0.7225887775421143,
0.5734627842903137,
-0.6098518371582031,
0.5989194512367249,
-0.5546844601631165,
-0.041785161942243576,
... |
func (s *service) TTL(key string) (time.Duration, error) {
return s.redis.TTL(key).Result()
} | [
-0.23540353775024414,
0.9955700039863586,
0.26519811153411865,
-0.5399153828620911,
-0.5832088589668274,
-0.6903622150421143,
-0.6162714958190918,
-0.11147249490022659,
0.6657375693321228,
1.579572319984436,
-0.6410744190216064,
-0.20663946866989136,
-0.08088171482086182,
-0.02502685040235... |
func (s *service) Expire(key string, duration time.Duration) error {
return s.redis.Expire(key, duration).Err()
} | [
-0.4542090594768524,
0.635360062122345,
0.24696125090122223,
0.5870005488395691,
-0.47375813126564026,
-0.1641538143157959,
-2.2773096561431885,
-0.27364659309387207,
-0.7319296002388,
0.809156596660614,
0.013991963118314743,
0.5358104109764099,
-0.13359367847442627,
0.8485760688781738,
... |
func CreateAclManager(db *gorm.DB, pool *redis.Pool) *AclManager {
return &AclManager{
db: db,
rp: pool,
}
} | [
0.09585145115852356,
-0.8187967538833618,
0.22699405252933502,
-0.8357949256896973,
-0.5096526741981506,
0.17377781867980957,
-1.3825935125350952,
-0.6539333462715149,
0.3387634754180908,
0.014043007045984268,
0.22737345099449158,
0.7001017332077026,
-0.45346903800964355,
1.268824815750122... |
func PublishSNSMessage(messageStruct interface{}, topicARN string) {
messageBytes, err := json.Marshal(messageStruct)
if err != nil {
fmt.Println("Error marshalling SNS message", err.Error())
fmt.Println("Message struct:", messageStruct)
os.Exit(1)
}
_, err = snsClient.Publish(&sns.PublishInput{
Message: ... | [
0.226678729057312,
-0.249395489692688,
0.4174017608165741,
0.23650476336479187,
0.04127679392695427,
0.48863765597343445,
0.07891277223825455,
-0.05574709549546242,
0.057932257652282715,
-0.5428188443183899,
0.10861245542764664,
1.3192713260650635,
-0.28753286600112915,
0.6397651433944702,... |
func HandleUserToVideoRel(w http.ResponseWriter, r *http.Request) {
log.Println("\n\n===>productHandlers.InsertUserToVideoRel()")
w.Header().Add("Content-Type", "application/json")
har, err := ioutil.ReadAll(r.Body)
log.Printf(" har=%s\n", har)
log.Printf(" err=%v\n", err)
var aUserToVideo UserToVideo... | [
-0.010105909779667854,
0.018862225115299225,
0.6826544404029846,
0.2086857706308365,
-0.4104137420654297,
-0.06751259416341782,
0.42245712876319885,
-0.5994725227355957,
0.4718513488769531,
0.7012860774993896,
-0.8812390565872192,
0.4542672038078308,
-0.21518182754516602,
0.205817073583602... |
func InsertUserToVideoRel(dbRef *pg.DB, userID int, videoID int) error {
log.Printf("===>productRelation.InsertUserToVideoRel(userID=%d,videoID=%d)\n", userID, videoID)
myDB := db.Connect()
usr2vid := &UserToVideo{UserID: userID, VideoID: videoID}
insertErr := myDB.Insert(usr2vid)
if insertErr != nil {
l... | [
-0.2907274067401886,
0.1396951824426651,
0.5461180806159973,
0.023822585120797157,
-0.26851651072502136,
0.5962806940078735,
0.6329976320266724,
-0.41864681243896484,
0.35146018862724304,
0.5253925323486328,
-0.7349264621734619,
0.9725381731987,
-0.6001883745193481,
-0.2226218283176422,
... |
func CreateUserToVideoTable() error {
log.Printf("===>userTester.CreateUserToVideoTable()")
myDB := db.Connect()
delopts := &orm.DropTableOptions{
IfExists: false,
}
orm.DropTable(myDB, &UserToVideo{}, delopts)
opts := &orm.CreateTableOptions{
IfNotExists: true,
}
createErr := myDB.CreateTable(&... | [
0.402822881937027,
-0.0020357572939246893,
0.5507073402404785,
0.5932204723358154,
0.22652044892311096,
-0.049569450318813324,
0.8355112671852112,
-0.527107298374176,
0.29501309990882874,
0.4482533633708954,
-0.2292930781841278,
0.5176624059677124,
-0.1677175760269165,
0.07096963375806808,... |
func InsertVideoToUserRel(dbRef *pg.DB, videoID int, userID int) error {
log.Printf("===>productRelation.InsertVideoToUserRel(videoID=%d,userID=%d)\n", videoID, userID)
myDB := db.Connect()
vid2usr := &VideoToUser{VideoID: videoID, UserID: userID}
insertErr := myDB.Insert(vid2usr)
if insertErr != nil {
... | [
-0.6964620351791382,
0.09110856056213379,
0.5679725408554077,
0.06726048141717911,
0.21374981105327606,
0.5372776985168457,
1.1182451248168945,
-0.16612407565116882,
0.118988536298275,
0.22967767715454102,
-0.21317321062088013,
0.8878433108329773,
-1.2857576608657837,
-0.01349890511482954,... |
func CreateVideoToUserTable() error {
log.Printf("===>userTester.CreateVideoToUserTable()")
myDB := db.Connect()
delopts := &orm.DropTableOptions{
IfExists: false,
}
orm.DropTable(myDB, &VideoToUser{}, delopts)
opts := &orm.CreateTableOptions{
IfNotExists: true,
}
createErr := myDB.CreateTable(&... | [
-0.2720486521720886,
-0.052803222090005875,
0.6186529397964478,
0.5985416173934937,
0.4276740849018097,
-0.2612113654613495,
1.2226126194000244,
-0.13457545638084412,
0.4333122968673706,
0.3378627598285675,
-0.24187855422496796,
0.40537574887275696,
-0.7184916734695435,
0.29449906945228577... |
func NewLoader(r *proxy.Register) *Loader {
return &Loader{Register: r}
} | [
0.5540443658828735,
-0.245187908411026,
0.08355472981929779,
0.1513781100511551,
-0.8884434700012207,
-0.06554163247346878,
-0.49838078022003174,
-0.2707764506340027,
0.11005701124668121,
-0.5066738724708557,
-0.5178756713867188,
0.38298511505126953,
-0.7913172841072083,
0.6991457343101501... |
func (l *Loader) LoadServiceDefinitions(filePath string) []*Definition {
config, err := ioutil.ReadFile(filePath)
if err != nil {
log.Println("srv: error reading service definition file", filePath)
return []*Definition{}
}
// Parse and load the service definitions
definitions := ParseAndLoad(config)
for _, d... | [
-0.25803038477897644,
-0.07135339826345444,
0.3551333546638489,
-0.27913129329681396,
-0.2293703556060791,
-0.163236603140831,
-0.2244129776954651,
-0.27898308634757996,
-0.4415052831172943,
-0.007949338294565678,
-1.0994406938552856,
0.19614996016025543,
-0.9595382809638977,
1.43302381038... |
func (l *Loader) RegisterServices(definitions []*Definition) {
for _, def := range definitions {
l.registerService(def)
}
} | [
-1.2143315076828003,
1.022220492362976,
0.32333651185035706,
0.8238248825073242,
0.7805091738700867,
0.12472783774137497,
-0.4522763788700104,
-0.7687673568725586,
-0.4846653938293457,
-0.5156043171882629,
-0.10440175980329514,
-0.2808613181114197,
-0.29668864607810974,
2.1568753719329834,... |
func NewSyslog(priority Priority, tag string) (*Logger, error) {
return Dial("", "", priority, tag)
} | [
0.5166418552398682,
-0.23256318271160126,
0.37357157468795776,
0.2865131199359894,
-1.278617024421692,
-1.4294711351394653,
-1.5651450157165527,
0.14113281667232513,
-0.16750265657901764,
-0.5575131773948669,
-1.2658816576004028,
0.4364338517189026,
0.247959166765213,
0.8759258985519409,
... |
func Dial(network, raddr string, priority Priority, tag string) (*Logger, error) {
if priority < 0 || priority > LOG_LOCAL7|LOG_DEBUG {
return nil, errors.New("slog: invalid priority")
}
if tag == "" {
tag = os.Args[0]
}
hostname, _ := os.Hostname()
l := &Logger{
network: network,
raddr: ... | [
0.49238693714141846,
-0.18060919642448425,
0.8660469651222229,
-0.5889317393302917,
-0.237803116440773,
0.08117297291755676,
-1.216316819190979,
0.49155592918395996,
0.3029477596282959,
0.4892251193523407,
0.1530822515487671,
0.10568304359912872,
-0.1339109241962433,
0.7920992374420166,
... |
func (l *Logger) connect() (err error) {
if l.conn != nil {
// ignore err from close, it makes sense to continue anyway
l.conn.close()
l.conn = nil
}
if l.network == "" {
l.conn, err = unixSyslog()
if l.hostname == "" {
l.hostname = "localhost"
}
} else {
var c net.Conn
c, err = net.Dial(l.netwo... | [
0.0645056813955307,
-0.4516949951648712,
0.7956913113594055,
0.3773934543132782,
-0.44356027245521545,
-0.027936827391386032,
-0.8085445165634155,
0.5388363003730774,
-0.7400791049003601,
-0.5963824391365051,
0.3061964511871338,
-0.6817070245742798,
0.08448167890310287,
1.141873836517334,
... |
func (l *Logger) syslogWrite(p Priority, msg string) (int, error) {
// ensure it ends in a \n
nl := ""
if !strings.HasSuffix(msg, "\n") {
nl = "\n"
}
err := l.conn.writeString(p, l.hostname, l.tag, msg, nl)
if err != nil {
return 0, err
}
// Note: return the length of the input, not the number of
// bytes... | [
0.5266470909118652,
0.2031833380460739,
0.5683259963989258,
-0.30632656812667847,
0.07632136344909668,
-1.3910712003707886,
-0.4535035490989685,
1.439188003540039,
-0.39754611253738403,
0.008707046508789062,
-1.00578773021698,
-0.716606080532074,
-0.7529726624488831,
0.22949597239494324,
... |
func (c *AppController) ValidateProducts() {
userDetail := c.CurrentUserDetail
// does not get the user info, clear session of current user
if userDetail.Info == nil {
c.Data["json"] = &utils.JSONStruct{Code: utils.ErrorUnLogin, Msg: "require login"}
c.ServeJSON()
return
}
products, err := models.GetAllValid... | [
-1.1368364095687866,
-0.17184872925281525,
0.7949333786964417,
0.5763617157936096,
0.22601814568042755,
0.7620706558227539,
0.18104207515716553,
-0.4865158200263977,
0.41209402680397034,
1.1089922189712524,
-0.3748566806316376,
0.14444883167743683,
-0.15995003283023834,
0.5852342844009399,... |
func NewClient(conn net.Conn, tdb *tidis.Tidis, auth string) *Client {
client := new(Client)
client.conn = conn
client.auth = auth
client.br = bufio.NewReaderSize(conn, 4096)
client.bw = bufio.NewWriterSize(conn, 4096)
client.r = goredis.NewRespReader(client.br)
client.w = goredis.NewRespWriter(client.bw)
clien... | [
0.5151439309120178,
-0.6176367402076721,
0.31290578842163086,
-0.5070300698280334,
0.025092896074056625,
0.26407256722450256,
0.13249000906944275,
-0.7184431552886963,
-0.49979904294013977,
-0.05726819112896919,
0.35342052578926086,
0.4559474289417267,
-0.1932792067527771,
-0.9423285126686... |
func (c *Client) ProcessRequest(req [][]byte) (err error) {
var (
command Command
)
log.Debugf("req:%v,%s", strings.ToUpper(string(req[0])), req[1:])
if len(req) == 0 {
c.cmd = ""
c.args = nil
} else {
c.cmd = strings.ToUpper(string(req[0]))
c.args = req[1:]
}
if c.cmd != "AUTH" {
if !c.isAuth {
c... | [
-0.5403010845184326,
0.15502457320690155,
0.9199919700622559,
0.07990368455648422,
0.2609430253505707,
-0.44852709770202637,
0.4835090935230255,
-0.22510676085948944,
0.4156956374645233,
-0.22199629247188568,
0.5567459464073181,
-0.20892582833766937,
-0.27281609177589417,
0.427153199911117... |
func resultTotal(s stat.Stat) string {
if s.Fail > 0 {
return oneOrMoreTestsFail
}
return allTestPass
} | [
-0.6619331240653992,
-0.42161428928375244,
0.48643991351127625,
0.2964368462562561,
-0.049155093729496,
-0.38450127840042114,
0.33577945828437805,
-0.997160017490387,
0.4885387122631073,
0.10950478911399841,
-0.3283148407936096,
-0.5274739265441895,
-0.08784028887748718,
-0.636083722114563... |
func Print(s stat.Stat) {
w := tabwriter.NewWriter(os.Stdout, 0, 0, 1, ' ', tabwriter.AlignRight|tabwriter.Debug)
fmt.Fprintln(w, "Total\tTests\tPass\tFail\tSkip\t")
fmt.Fprintf(w, "%v\t%v\t%v\t%v\t%v\t\n", resultTotal(s), s.Tests, s.Pass, s.Fail, s.Skip)
w.Flush()
fmt.Printf("Elapsed: %v\n", s.Elapsed)
fmt.Prin... | [
0.4759361445903778,
0.16146214306354523,
0.7247910499572754,
-0.5043975114822388,
0.172191321849823,
0.740161657333374,
-0.03029332123696804,
-0.7266368865966797,
-0.45956751704216003,
-0.7664068937301636,
0.1037382185459137,
0.18732738494873047,
0.3048096001148224,
0.24140597879886627,
... |
func (c *DatasetComponent) theseGenerateDownloadsEventsAreProduced(events *godog.Table) error {
expected, err := assistdog.NewDefault().CreateSlice(new(download.GenerateDownloads), events)
if err != nil {
return fmt.Errorf("failed to create slice from godog table: %w", err)
}
var got []*download.GenerateDownload... | [
-0.5244196057319641,
0.012159807607531548,
0.640498697757721,
-0.45266538858413696,
0.2971627116203308,
-0.3873637318611145,
0.5668977499008179,
-0.5770671367645264,
-0.282726913690567,
-0.23015901446342468,
-0.14356479048728943,
0.38024717569351196,
0.23016110062599182,
0.3806574046611786... |
func arrayParser(raw string) (interface{}, error) {
// remove the starting and trailing brackets
str := strings.Trim(raw, "[]")
if str == "" {
return []string{}, nil
}
strArray := strings.Split(str, ",")
return strArray, nil
} | [
-0.240858793258667,
-1.1761059761047363,
0.6329746246337891,
-0.3870362937450409,
-1.0885742902755737,
-0.44864875078201294,
-0.9719443321228027,
0.35111671686172485,
0.8316413760185242,
0.6658971309661865,
-0.4938971996307373,
0.5037660598754883,
-0.7308042049407959,
0.14458785951137543,
... |
func (c *DatasetComponent) theseCantabularGeneratorDownloadsEventsAreProduced(events *godog.Table) error {
assist := assistdog.NewDefault()
assist.RegisterParser([]string{}, arrayParser)
expected, err := assist.CreateSlice(new(download.CantabularGeneratorDownloads), events)
if err != nil {
return fmt.Errorf("fail... | [
-0.39227622747421265,
0.03400802239775658,
0.5671704411506653,
-0.40611448884010315,
0.08056555688381195,
-0.46826815605163574,
0.6087407469749451,
-0.27612724900245667,
-0.623375654220581,
-0.053754862397909164,
-0.03646305203437805,
0.2255515307188034,
0.28959059715270996,
0.448325097560... |
func (c *DatasetComponent) iHaveTheseConditionalDatasets(status string, datasetsJSON *godog.DocString) error {
datasets := []models.Dataset{}
err := json.Unmarshal([]byte(datasetsJSON.Content), &datasets)
if err != nil {
return fmt.Errorf("failed to unmarshal: %w", err)
}
for timeOffset := range datasets {
d... | [
-0.9742216467857361,
0.4168711006641388,
0.5416948795318604,
-1.287305235862732,
0.3582020103931427,
0.30631202459335327,
-0.42964401841163635,
0.3987872302532196,
0.06567883491516113,
0.5216736197471619,
-0.46682673692703247,
0.134063720703125,
0.1768522411584854,
0.23104800283908844,
0... |
func (t CredentialsType) String() string {
return [...]string{"Invalid", "API Key", "GitHub"}[t]
} | [
-0.20933131873607635,
-0.727451503276825,
-0.058675963431596756,
0.3213643729686737,
0.569064736366272,
0.3875582814216614,
-0.686517059803009,
-0.5279261469841003,
-0.627903401851654,
0.45392248034477234,
-0.19637265801429749,
0.27435094118118286,
-0.17667289078235626,
0.7902399897575378,... |
func (s *StoredCredentials) Session(ctx context.Context, client *http.Client) (Session, error) {
switch s.Type {
case CredentialsTypeAPIKey:
return FromAPIKey(ctx, client)(s.Endpoint, s.KeyID, s.KeySecret)
case CredentialsTypeGitHubToken:
return FromGitHubToken(ctx, client)(s.Endpoint, s.AccessToken)
default:
... | [
-0.6884446740150452,
-0.8502647280693054,
0.276154100894928,
0.17021213471889496,
-0.025186505168676376,
-0.10222264379262924,
-0.12148556113243103,
-1.0114035606384277,
0.5953363180160522,
-0.1245766431093216,
0.3006775975227356,
1.024821162223816,
-0.2866790294647217,
-0.1288678050041198... |
func buildPhrases(words []string, ppWords int) {
dictLength := big.NewInt(int64(len(words)))
password := ""
for i := 0; i < ppWords; i++ {
index, err := rand.Int(rand.Reader, dictLength)
if err != nil {
fmt.Println("Something strange happened")
return
}
word := []byte(words[index.Uint6... | [
-0.9522729516029358,
0.11818411946296692,
0.7350378036499023,
-0.5980270504951477,
0.7001864910125732,
0.13633941113948822,
-0.46083593368530273,
0.3594914376735687,
0.12828274071216583,
0.8313316702842712,
0.03480095416307449,
0.08999882638454437,
-1.003499150276184,
-0.33735644817352295,... |
func toUtf8(iso8859_1_buf []byte) string {
buf := make([]rune, len(iso8859_1_buf))
for i, b := range iso8859_1_buf {
buf[i] = rune(b)
}
return string(buf)
} | [
-0.31726646423339844,
0.18272870779037476,
0.3958788812160492,
0.4297359585762024,
-0.043463364243507385,
0.17647682130336761,
0.6543997526168823,
-0.27320596575737,
0.5196235179901123,
1.4911730289459229,
-0.046790968626737595,
0.008110279217362404,
-0.5847671031951904,
-0.712759673595428... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.