text stringlengths 11 6.3k | embedding listlengths 768 768 |
|---|---|
func (t *timer) Close() {
t.once.Do(
func() {
for _, task := range t.tasks {
task.cancel()
}
},
)
} | [
0.25219660997390747,
0.36223262548446655,
0.46772775053977966,
-0.2823302149772644,
-0.5256120562553406,
1.039530873298645,
0.4593842029571533,
-0.012147437781095505,
-1.4393389225006104,
0.30568739771842957,
-0.28368520736694336,
-0.5067955851554871,
-0.36372002959251404,
1.85472846031188... |
func (task taskStub) run(fetchInterval, fetchDelay time.Duration) {
for {
select {
case <-task.ctx.Done():
return
default:
hasMore, err := task.f()
if err != nil {
task.l.Error("task.f task run failed", log.Error(err))
time.Sleep(fetchInterval)
continue
} else if !hasMore {
time.Sleep... | [
-0.512715756893158,
0.6855165958404541,
0.7351127862930298,
-0.013959293253719807,
0.17844165861606598,
0.4084640443325043,
0.6831336617469788,
-0.12328702956438065,
-1.1765815019607544,
-1.2342768907546997,
-0.22416821122169495,
-0.7899057865142822,
0.5494628548622131,
0.06431961059570312... |
func (s *store) CommitPvtDataOfOldBlocks(blocksPvtData map[uint64][]*ledger.TxPvtData, unreconciledMissingData ledger.MissingPvtDataInfo) error {
s.purgerLock.Lock()
defer s.purgerLock.Unlock()
if s.isLastUpdatedOldBlocksSet {
return pvtdatastorage.NewErrIllegalCall(`The lastUpdatedOldBlocksList is set. It means ... | [
-0.853426992893219,
-0.6901890635490417,
0.8545330762863159,
0.10637765377759933,
-0.18112747371196747,
0.4358883202075958,
0.5920024514198303,
0.13456466794013977,
-0.2540752589702606,
1.0993521213531494,
-0.01983519457280636,
-0.5925800204277039,
-0.20610764622688293,
0.3499179184436798,... |
func NewProcessingJobReconciler(client client.Client, log logr.Logger, pollInterval time.Duration) *Reconciler {
return &Reconciler{
Client: client,
Log: log,
PollInterval: pollInterval,
createSageMakerClient: func(cfg aws.Config) clientwrapper.SageMakerClientWrapper {
sess := controllers.Cre... | [
0.3175829350948334,
-0.7128463387489319,
0.5064727067947388,
-0.35180962085723877,
-1.1102581024169922,
0.22602573037147522,
-0.22862501442432404,
0.19868208467960358,
-0.1317477822303772,
-0.2028186321258545,
0.47311916947364807,
-0.41644176840782166,
-0.017051441594958305,
0.573666751384... |
func (r *Reconciler) Reconcile(req ctrl.Request) (ctrl.Result, error) {
ctx := reconcileRequestContext{
Context: context.Background(),
Log: r.Log.WithValues("processingjob", req.NamespacedName),
ProcessingJob: new(processingjobv1.ProcessingJob),
}
ctx.Log.Info("Getting resource")
if err := r.... | [
-0.09730347990989685,
0.07684321701526642,
0.8767403960227966,
0.1274741142988205,
0.18202750384807587,
-0.097739577293396,
-1.018604040145874,
0.1155538484454155,
-0.3416137099266052,
0.126129612326622,
1.049189805984497,
-0.47378668189048767,
-0.8226546049118042,
0.837685227394104,
0.4... |
func (r *Reconciler) initializeContext(ctx *reconcileRequestContext) error {
ctx.ProcessingJobName = controllers.GetGeneratedJobName(ctx.ProcessingJob.ObjectMeta.GetUID(), ctx.ProcessingJob.ObjectMeta.GetName(), MaxProcessingJobNameLength)
ctx.Log.Info("ProcessingJob", "Using job name: ", ctx.ProcessingJobName)
a... | [
-0.04261396452784538,
0.4061989486217499,
0.9237891435623169,
-0.8756973147392273,
0.030066732317209244,
-0.1266995221376419,
-0.4971143305301666,
0.05955253541469574,
0.6513953804969788,
0.1328164041042328,
-0.27188146114349365,
0.16721950471401215,
-0.13769814372062683,
0.514492213726043... |
func (r *Reconciler) createProcessingJob(ctx reconcileRequestContext) error {
var createProcessingJobInput sagemaker.CreateProcessingJobInput
createProcessingJobInput = sdkutil.CreateCreateProcessingJobInputFromSpec(ctx.ProcessingJob.Spec, &ctx.ProcessingJobName)
ctx.Log.Info("Creating ProcessingJob in SageMaker",... | [
-0.04026620462536812,
0.4507114589214325,
0.6166940331459045,
0.3006173074245453,
0.43883129954338074,
0.7275791168212891,
-0.45299971103668213,
0.6459461450576782,
-0.0019569052383303642,
0.44738659262657166,
0.4568284749984741,
-0.6838605999946594,
-1.0085653066635132,
0.2521862089633941... |
func (r *Reconciler) removeFinalizer(ctx reconcileRequestContext) error {
var err error
ctx.ProcessingJob.ObjectMeta.Finalizers = controllers.RemoveString(ctx.ProcessingJob.ObjectMeta.Finalizers, controllers.SageMakerResourceFinalizerName)
if err = r.Update(ctx, ctx.ProcessingJob); err != nil {
return errors.Wrap... | [
-0.6163092851638794,
-0.6135401725769043,
0.23673485219478607,
-0.4728175699710846,
-1.080299735069275,
-0.5113775134086609,
0.309263676404953,
1.073004961013794,
0.14119601249694824,
-0.17665702104568481,
-0.38396453857421875,
-0.8343822360038757,
-0.9359052777290344,
0.48697060346603394,... |
func (r *Reconciler) updateStatus(ctx reconcileRequestContext, processingJobStatus string) error {
return r.updateStatusWithAdditional(ctx, processingJobStatus, "")
} | [
-0.6520774960517883,
-0.3391083776950836,
0.4985029399394989,
0.0720679759979248,
-0.2616936266422272,
-0.09406755119562149,
-0.6559355854988098,
0.9844750165939331,
0.35381072759628296,
0.23698188364505768,
-0.2576625943183899,
0.17325158417224884,
-0.26372772455215454,
0.3309609591960907... |
func (r *Reconciler) SetupWithManager(mgr ctrl.Manager) error {
return ctrl.NewControllerManagedBy(mgr).
For(&processingjobv1.ProcessingJob{}).
// Ignore status-only and metadata-only updates
WithEventFilter(predicate.GenerationChangedPredicate{}).
Complete(r)
} | [
0.2151951789855957,
-0.07143974304199219,
0.48087286949157715,
-0.2893664836883545,
-0.47676435112953186,
-0.4647141098976135,
0.5130190253257751,
0.04319577291607857,
-0.300123393535614,
0.07665017992258072,
0.3067902624607086,
-0.5297148823738098,
0.24191901087760925,
1.8528132438659668,... |
func (s *DefaultScheduler) Add(req *request.Request) {
s.lock.Lock()
defer s.lock.Unlock()
// out of sched handle depth
if req.Depth > s.maxDepth {
return
}
if _, ok := s.Reqs[req.Req.URL.String()]; ok {
return
}
if _, ok := s.Handled[req.Req.URL.String()]; ok {
return
}
s.Reqs[req.Req.URL.String()]... | [
-1.2372881174087524,
-0.36374354362487793,
0.7049323916435242,
0.23860609531402588,
0.25732681155204773,
0.795266330242157,
-0.5382449626922607,
-0.032285526394844055,
0.4666579067707062,
-1.0713483095169067,
0.5658458471298218,
0.38279950618743896,
-0.4407205879688263,
0.7925877571105957,... |
func NewHacker(style styling.Style) *Hacker {
access := realFileAccess
hacker := &Hacker{
style: style,
fileAccess: access,
fileDataNodeProvider: newFileDataNodeProvider(access)}
return hacker
} | [
-0.6818051934242249,
-0.6456865668296814,
0.4891529977321625,
0.6802716255187988,
-0.7955880165100098,
0.6404935121536255,
-0.22560854256153107,
0.3714306652545929,
0.10194277763366699,
-0.48501056432724,
0.00894107948988676,
0.34250080585479736,
0.49612388014793396,
0.4967690706253052,
... |
func (hacker *Hacker) Load(path1, path2 string) string {
files1, err1 := hacker.fileAccess.readDir(path1)
var release *ReleaseDesc
var root *rootDataNode
result := ""
if err1 != nil {
result = hacker.style.Error()("Can't access directories")
} else if len(path2) == 0 {
fileNames1 := fileNames(files1)
relea... | [
-0.417627215385437,
-0.1630973517894745,
0.9847726821899414,
-0.06168659031391144,
0.048548754304647446,
-0.196771040558815,
-0.01654933951795101,
0.2742498517036438,
-0.09876004606485367,
0.4801555871963501,
0.030657866969704628,
0.2064729630947113,
-0.24005670845508575,
-0.00889733899384... |
func (hacker *Hacker) Save() (result string) {
if hacker.root != nil {
result = hacker.root.save()
} else {
result = hacker.style.Error()(`No data loaded. Use the [load "path1" "path2"] command.`)
}
return
} | [
-0.19162212312221527,
0.15514768660068512,
0.44168949127197266,
0.703769326210022,
0.48812323808670044,
-0.5193548202514648,
0.003241010010242462,
-0.802119791507721,
-0.7422016859054565,
-0.17895260453224182,
-0.8592457175254822,
-0.2651863694190979,
-0.8491794466972351,
0.814599871635437... |
func (hacker *Hacker) Info() string {
var result string
if hacker.curNode != nil {
result = hacker.curNode.Info()
} else {
result = hacker.style.Error()(`No data loaded. Use the [load "path1" "path2"] command.`)
}
return result
} | [
-0.1727212816476822,
-0.08252114802598953,
0.5887214541435242,
0.14828337728977203,
0.11612020432949066,
-0.5797297358512878,
-0.08843468129634857,
-0.5694445371627808,
-1.2472225427627563,
0.1284811645746231,
0.25349828600883484,
-0.24006006121635437,
0.1831967532634735,
0.395434230566024... |
func (hacker *Hacker) CurrentDirectory() string {
tempNode := hacker.curNode
path := ""
for tempNode != nil && tempNode != hacker.root {
path = "/" + tempNode.ID() + path
tempNode = tempNode.Parent()
}
return path
} | [
-0.6917974948883057,
-1.4335108995437622,
0.492521196603775,
0.28980597853660583,
0.25283533334732056,
-0.28987136483192444,
0.8967281579971313,
-0.03214865177869797,
-0.10616632550954819,
-0.3138982653617859,
0.6234551072120667,
0.71150803565979,
-0.6795108914375305,
1.027506947517395,
... |
func (hacker *Hacker) ChangeDirectory(path string) (result string) {
resolved := hacker.resolve(path)
if resolved != nil {
hacker.curNode = resolved
result = ""
} else {
result = hacker.style.Error()(`Directory not found: "`, path, `"`)
}
return
} | [
-1.2576814889907837,
0.05872853845357895,
0.5747368335723877,
0.08668624609708786,
0.38571563363075256,
-1.2278656959533691,
0.17028063535690308,
-0.1109924465417862,
-0.1443106234073639,
-0.17668433487415314,
-0.38555797934532166,
0.3990570604801178,
-0.31118297576904297,
0.76823288202285... |
func main() {
username := os.Getenv("DB_USERNAME")
password := os.Getenv("DB_PASSWORD")
databaseName := os.Getenv("DB_NAME")
collectionName := os.Getenv("COL_NAME")
connectionString := fmt.Sprintf("mongodb://%s:%s@ds121565.mlab.com:21565/%s", username, password, databaseName)
fmt.Printf("DB_USERNAME:%s\n", user... | [
0.3221445381641388,
0.2012351155281067,
1.3186572790145874,
0.41071560978889465,
0.21943289041519165,
0.2729845941066742,
-0.24640929698944092,
0.036220088601112366,
-0.8234963417053223,
0.5387006998062134,
-0.3107598125934601,
-0.6570636630058289,
-0.521645188331604,
-0.4565403163433075,
... |
func (s Settings) EnabledResources(tf *v1alpha1.Tiltfile, manifests []model.Manifest) ([]model.ManifestName, error) {
if s.disableAll {
return nil, nil
}
// by default, nil = match all resources
var requestedManifests []model.ManifestName
// if the user called set_enabled_resources, that trumps everything
if ... | [
0.3403593599796295,
-0.9426947832107544,
0.4211454391479492,
0.1474532037973404,
-0.18126419186592102,
-0.44199138879776,
-0.04235340654850006,
0.9749353528022766,
0.3392256796360016,
-0.03771510347723961,
0.7084797620773315,
-0.8851029276847839,
-0.6786414384841919,
0.8205836415290833,
... |
func addManifestAndDeps(result map[model.ManifestName]bool, allManifestsByName map[model.ManifestName]model.Manifest, manifestToAdd model.ManifestName) {
if result[manifestToAdd] {
return
}
result[manifestToAdd] = true
for _, dep := range allManifestsByName[manifestToAdd].ResourceDependencies {
addManifestAndDe... | [
-0.8655334711074829,
-0.9434334635734558,
0.45390766859054565,
-0.5832485556602478,
-1.225736379623413,
0.03715004771947861,
-0.45337289571762085,
0.4922558069229126,
0.9031193852424622,
-0.6461408138275146,
-0.17829075455665588,
-0.8881270885467529,
0.367011696100235,
1.2921106815338135,
... |
func match(manifests []model.Manifest, requestedManifests []model.ManifestName) ([]model.ManifestName, error) {
if len(requestedManifests) == 0 {
var result []model.ManifestName
for _, m := range manifests {
result = append(result, m.Name)
}
return result, nil
}
manifestsByName := make(map[model.Manifest... | [
-0.12840957939624786,
-1.0411678552627563,
0.6637245416641235,
0.2271733433008194,
-0.32152265310287476,
-0.059158362448215485,
-0.13850484788417816,
-0.006455837748944759,
-0.42934805154800415,
0.19521749019622803,
0.5320399403572083,
-0.6690851449966431,
0.1166967898607254,
0.11762948334... |
func CreatePriorityQueue() PriorityQueue {
queue := PriorityQueue{
priority: Queue{size: 0},
normal: Queue{size: 0},
}
return queue
} | [
0.36476582288742065,
-1.1498178243637085,
0.56775963306427,
0.3305117189884186,
0.26401275396347046,
0.08635340631008148,
-0.813109278678894,
0.6111668944358826,
0.28229597210884094,
-0.394773930311203,
-0.010512354783713818,
-0.009206839837133884,
-0.31685203313827515,
1.1190190315246582,... |
func (q *PriorityQueue) Enqueue(item int, priority bool) int {
if priority {
q.priority.Enqueue(item)
} else {
q.normal.Enqueue(item)
}
return q.priority.size + q.normal.size
} | [
-0.027256086468696594,
0.4745447337627411,
0.5924025177955627,
0.07518298923969269,
-0.1404379904270172,
0.23723512887954712,
-0.9983335137367249,
0.4194977581501007,
0.37697213888168335,
0.12962855398654938,
0.018057845532894135,
0.057913027703762054,
-0.8571807742118835,
0.58200699090957... |
func (q *PriorityQueue) Dequeue() int {
if q.priority.size > 0 {
return q.priority.Dequeue()
}
return q.normal.Dequeue()
} | [
-0.03741670399904251,
0.4195782542228699,
0.7659118175506592,
-0.5065995454788208,
-0.048626624047756195,
-0.8230935335159302,
-0.7677480578422546,
0.9807475209236145,
-0.1782453954219818,
-0.8602641820907593,
0.30912578105926514,
0.10678062587976456,
-1.138107419013977,
1.34316086769104,
... |
func (q *PriorityQueue) IsEmpty() bool {
return q.priority.IsEmpty() && q.normal.IsEmpty()
} | [
-0.9544894099235535,
-0.7762496471405029,
0.5942698121070862,
-0.0043725259602069855,
0.33545270562171936,
1.0863909721374512,
-1.4441180229187012,
0.09069051593542099,
-0.438921719789505,
0.3622460961341858,
-0.1183861717581749,
0.9130933284759521,
-0.4214008152484894,
0.6451686024665833,... |
func (q *PriorityQueue) Length() int {
return q.priority.Length() + q.normal.Length()
} | [
0.33262771368026733,
-0.6863920092582703,
0.20049290359020233,
-0.5861128568649292,
-0.26539257168769836,
1.8566118478775024,
-0.22126734256744385,
0.8408560752868652,
0.7142707109451294,
0.4055337607860565,
-0.4566238224506378,
0.4498121738433838,
-0.309567928314209,
0.8510813117027283,
... |
func (q *PriorityQueue) PrettyPrint() {
fmt.Println("Priority Queue")
q.priority.PrettyPrint()
fmt.Println("Normal Queue")
q.normal.PrettyPrint()
} | [
0.20018894970417023,
-0.5309296250343323,
0.5204344391822815,
-0.449079304933548,
0.0221570935100317,
0.9691871404647827,
-1.0981721878051758,
-0.2405959516763687,
-0.2763831317424774,
0.03815313056111336,
0.39224088191986084,
0.8620703220367432,
-0.14831861853599548,
1.1829745769500732,
... |
func Wordmap(word string) {
listOfLines := reuse.ReadLineByLineFromFile("iq/text.dat")
// map of word
mapW := make(map[string][]structLoc)
for i, line := range listOfLines {
pattern := "[\\/\\:\\,\\.\\s]+"
listOfwords := reuse.Tokenize(line,pattern)
for _, word := range listOfwords {
indices := reuse.... | [
0.013087157160043716,
-0.8436411619186401,
0.8310849070549011,
-0.6515318155288696,
-0.028577212244272232,
0.10307036340236664,
1.2316162586212158,
0.12839601933956146,
0.006836973130702972,
0.12529027462005615,
0.3026141822338104,
0.01825728639960289,
0.10925572365522385,
-0.0921679437160... |
func TestResourceListSorting(t *testing.T) {
sortedResourceList := make([]string, len(resourceList))
copy(sortedResourceList, resourceList)
sort.Strings(sortedResourceList)
for i := 0; i < len(resourceList); i++ {
if resourceList[i] != sortedResourceList[i] {
t.Errorf("Expected resourceList[%d] = \"%s\", resou... | [
0.02639871835708618,
0.043965741991996765,
0.012025716714560986,
0.04547969996929169,
0.06433551758527756,
0.3183883726596832,
0.4590820372104645,
-0.49621087312698364,
0.3193630874156952,
0.260659784078598,
-0.2833417057991028,
-0.4682590365409851,
-0.5281128287315369,
0.4216773211956024,... |
func TestQueryEncode(t *testing.T) {
testCases := []struct {
// Input.
input url.Values
// Expected result.
result string
}{
// % should be encoded as %25
{url.Values{
"key": []string{"thisisthe%url"},
}, "key=thisisthe%25url"},
// UTF-8 encoding.
{url.Values{
"key": []string{"本語"},
}, "key=... | [
-0.012196497060358524,
0.1444469839334488,
0.4036976099014282,
0.018079863861203194,
-0.3567206561565399,
0.17594459652900696,
-0.09035257995128632,
-0.5834289789199829,
0.2568930387496948,
-0.5160969495773315,
-1.1890655755996704,
-0.559153139591217,
-0.21585988998413086,
0.44695162773132... |
func Dilate(src [][]int, k int) [][]int {
src = Manhattan(src, 255)
for i := 0; i < len(src); i++ {
for j := 0; j < len(src[i]); j++ {
if src[i][j] < k {
src[i][j] = 255
} else {
src[i][j] = 0
}
}
}
return src
} | [
0.1135481670498848,
0.887138843536377,
0.8982661366462708,
-0.06388868391513824,
-0.4476875364780426,
-0.8708527088165283,
-0.6705142855644226,
0.12295380234718323,
0.6371913552284241,
0.6659746170043945,
1.0934842824935913,
-0.2016230821609497,
-0.06452592462301254,
1.0056723356246948,
... |
func Erode(src [][]int, k int) [][]int {
src = Manhattan(src, 0)
for i := 0; i < len(src); i++ {
for j := 0; j < len(src[i]); j++ {
if src[i][j] < k {
src[i][j] = 0
} else {
src[i][j] = 255
}
}
}
return src
} | [
-0.43117624521255493,
0.8136963844299316,
0.7452350854873657,
-0.5868282914161682,
-0.282935231924057,
-0.5931359529495239,
-0.7371118664741516,
0.4635472893714905,
-0.055155571550130844,
1.6610873937606812,
0.6993116736412048,
0.16111576557159424,
-0.1576842963695526,
0.5525074601173401,
... |
func Router(app *services.ChainlinkApplication) *gin.Engine {
engine := gin.New()
config := app.Store.Config
cors := uiCorsHandler(config)
engine.Use(
loggerFunc(),
gin.Recovery(),
cors,
)
v1Routes(app, engine)
v2Routes(app, engine)
box := packr.NewBox("../gui/dist/")
engine.NoRoute(func(c *gin.Context... | [
-0.15594547986984253,
-0.4190400540828705,
0.6690798997879028,
0.7407622337341309,
-0.3035346269607544,
0.5780556201934814,
1.0076853036880493,
0.3878583312034607,
-0.5668755173683167,
-0.5196539759635925,
1.4353190660476685,
0.8050957918167114,
0.3172065019607544,
0.6728572845458984,
0.... |
func uiCorsHandler(config store.Config) gin.HandlerFunc {
c := cors.Config{
AllowMethods: []string{"GET"},
AllowHeaders: []string{"Origin"},
ExposeHeaders: []string{"Content-Length"},
AllowCredentials: true,
MaxAge: 12 * time.Hour,
}
if config.AllowOrigins == "*" {
c.AllowAllOrigins ... | [
-0.13116534054279327,
0.3642444610595703,
0.5959005355834961,
-0.223532035946846,
-1.4252305030822754,
0.34958356618881226,
-0.26284316182136536,
0.4002475440502167,
-0.32753366231918335,
0.12642069160938263,
0.6390976309776306,
-0.3699280321598053,
-0.7167472839355469,
-0.5518558025360107... |
func (fn DownloadBootFilesHandlerFunc) Handle(params DownloadBootFilesParams) middleware.Responder {
return fn(params)
} | [
0.32465681433677673,
-0.01588417962193489,
0.4287776052951813,
1.112357497215271,
-0.0014422169188037515,
-0.387556791305542,
1.0026956796646118,
-0.3377663493156433,
-0.45381787419319153,
-1.0938222408294678,
0.15521873533725739,
-0.8320443630218506,
-0.7188286185264587,
0.704260945320129... |
func NewDownloadBootFiles(ctx *middleware.Context, handler DownloadBootFilesHandler) *DownloadBootFiles {
return &DownloadBootFiles{Context: ctx, Handler: handler}
} | [
-0.03307337686419487,
-0.025905681774020195,
0.31758540868759155,
1.4544391632080078,
-1.1639986038208008,
-0.5157980918884277,
-0.0939573347568512,
-0.615839958190918,
-0.20715104043483734,
-0.7157829999923706,
-0.6738433837890625,
-0.34852665662765503,
-0.46596235036849976,
0.93344324827... |
func NewImageRegistry(osClient osclient.Interface) quota.Registry {
imageStream := NewImageStreamEvaluator(osClient)
imageStreamMapping := NewImageStreamMappingEvaluator(osClient)
return &generic.GenericRegistry{
InternalEvaluators: map[unversioned.GroupKind]quota.Evaluator{
imageStream.GroupKind(): imag... | [
-1.1151105165481567,
-0.2032795399427414,
0.19482234120368958,
-1.187510371208191,
-0.18747809529304504,
-0.8040779232978821,
-0.3255622386932373,
-0.2168690711259842,
-0.44688013195991516,
0.40473848581314087,
-0.13194166123867035,
1.4390957355499268,
0.38391995429992676,
1.02203750610351... |
func NewServerWrapper(prev io.Reader) gengokit.Renderable {
return &ServerWrapperRender{
prev: prev,
}
} | [
-0.42191600799560547,
-0.2766282260417938,
0.15185895562171936,
-0.27733170986175537,
-1.1928070783615112,
0.03825457766652107,
-0.2412288635969162,
-0.21140319108963013,
-0.320085346698761,
-0.18698754906654358,
-0.2218642681837082,
0.7512858510017395,
-0.7489022612571716,
1.5995805263519... |
func (r *ServerWrapperRender) Render(path string, data *gengokit.Data) (io.Reader, error) {
if path != ServerWrapperPath {
return nil, errors.Errorf("cannot render unknown file: %q", path)
}
if r.prev != nil {
return r.prev, nil
}
return data.ApplyTemplateFromPath(path)
} | [
0.031040817499160767,
-0.16705012321472168,
0.3813486695289612,
-0.7687748670578003,
-0.5326623320579529,
0.04657065123319626,
-0.25843727588653564,
0.13502877950668335,
-0.28597456216812134,
-0.11668857932090759,
0.40384361147880554,
0.4441321790218353,
-0.9769686460494995,
0.231494590640... |
func New(l, b, r, t f.Float) AABB {
return AABB{l, b, r, t}
} | [
0.8258943557739258,
-1.1970863342285156,
0.2848198115825653,
0.7707585096359253,
0.3577386140823364,
0.5836599469184875,
-0.21846957504749298,
-0.4482227861881256,
-0.8263201117515564,
0.591706395149231,
-0.11370871216058731,
-0.13972890377044678,
1.0029672384262085,
0.015025780536234379,
... |
func ForExtents(c v.Vect, hw, hh f.Float) AABB {
return AABB{c.X - hw, c.Y - hh, c.X + hw, c.Y + hh}
} | [
1.4464613199234009,
-0.4567853808403015,
0.45408228039741516,
-0.17154687643051147,
-0.09629734605550766,
0.17060892283916473,
0.1285524219274521,
-1.0481129884719849,
0.23861585557460785,
-0.055187225341796875,
0.4177992045879364,
0.017452940344810486,
-0.03886512294411659,
0.345685422420... |
func ForCircle(c v.Vect, r f.Float) AABB {
return AABB{c.X - r, c.Y - r, c.X + r, c.Y + r}
} | [
1.062565565109253,
-0.8319239020347595,
0.40979695320129395,
-0.6264595985412598,
0.1238551214337349,
0.03944186866283417,
0.8914103507995605,
-1.3883781433105469,
0.15299206972122192,
0.24939921498298645,
0.699751615524292,
0.032475970685482025,
0.482855886220932,
-0.3549829423427582,
0... |
func Merge(a, b AABB) AABB {
return AABB{
f.Min(a.L, b.L), f.Min(a.B, b.B),
f.Max(a.R, b.R), f.Max(a.T, b.T),
}
} | [
-0.06780935823917389,
-0.30926308035850525,
0.6520240306854248,
0.41771984100341797,
0.05757753551006317,
0.1229388490319252,
-1.0737439393997192,
-0.40384015440940857,
0.09572786092758179,
-0.45242685079574585,
-0.25755444169044495,
0.1334410160779953,
-0.23323564231395721,
-0.57425099611... |
func (bb AABB) Center() v.Vect {
return v.Lerp(v.Vect{bb.L, bb.B}, v.Vect{bb.R, bb.T}, 0.5)
} | [
0.6972883343696594,
-0.32248857617378235,
0.5020062327384949,
0.09961798787117004,
0.749265193939209,
0.20466740429401398,
-0.1758449375629425,
0.35730835795402527,
0.8228902816772461,
0.9607901573181152,
0.5185192823410034,
0.42617282271385193,
0.14148655533790588,
-0.45210933685302734,
... |
func (bb AABB) Area() f.Float {
return (bb.R - bb.L) * (bb.T - bb.B)
} | [
0.6054647564888,
-0.6889637112617493,
0.28064635396003723,
0.08021309971809387,
0.5140069723129272,
0.37538769841194153,
0.6473248600959778,
0.13320130109786987,
0.3003719449043274,
0.7284933924674988,
0.3969922363758087,
-0.13739915192127228,
0.10434357821941376,
0.5118117928504944,
-0.... |
func (bb *AABB) SegmentQuery(a, b v.Vect) f.Float {
delta := v.Sub(b, a)
tmin, tmax := -f.Inf, f.Inf
if delta.X != 0.0 {
t1 := (bb.L - a.X) / delta.X
t2 := (bb.R - a.X) / delta.X
tmin = f.Max(tmin, f.Min(t1, t2))
tmax = f.Min(tmax, f.Max(t1, t2))
}
if delta.Y != 0.0 {
t1 := (bb.B - a.Y) / delta.Y
t2 ... | [
0.49886325001716614,
-0.7621090412139893,
0.7423295974731445,
-0.19253508746623993,
0.16701583564281464,
0.06511715054512024,
0.2837963104248047,
-0.46732956171035767,
-0.4093520939350128,
0.626034677028656,
0.4853564202785492,
-0.2374291867017746,
-0.10327811539173126,
-0.6666437983512878... |
func (bb *AABB) ClampVect(p v.Vect) v.Vect {
return v.Vect{f.Clamp(p.X, bb.L, bb.R), f.Clamp(p.Y, bb.B, bb.T)}
} | [
0.7704566121101379,
-0.6419847011566162,
0.48432421684265137,
-0.26877278089523315,
0.18188515305519104,
0.716375470161438,
-0.36162886023521423,
-0.3028184473514557,
0.4980541467666626,
0.10996457934379578,
0.559901773929596,
0.3360835909843445,
-0.2249637097120285,
-0.9910947680473328,
... |
func (bb *AABB) WrapVect(p v.Vect) v.Vect {
dx := f.Abs(bb.R - bb.L)
x := f.Mod(p.X-bb.L, dx)
if x <= 0.0 {
x += dx
}
dy := f.Abs(bb.T - bb.B)
y := f.Mod(p.Y-bb.B, dy)
if y <= 0.0 {
y += dy
}
return v.Vect{x + bb.L, y + bb.B}
} | [
-0.09285192936658859,
-0.2250286340713501,
0.6361560821533203,
-0.365788996219635,
0.004219758324325085,
1.1686112880706787,
-0.007384217344224453,
-0.26420313119888306,
0.47035515308380127,
-0.1398301124572754,
0.8684811592102051,
0.4770500659942627,
0.41068336367607117,
-0.55026906728744... |
func New(opt Option) *Client {
return &Client{
token: opt.Token,
addr: opt.Addr,
}
} | [
0.29505646228790283,
-0.7715296745300293,
0.12651915848255157,
-0.5074162483215332,
-0.58284991979599,
-0.17922544479370117,
-0.4005797207355499,
-0.36378297209739685,
-0.08802633732557297,
-0.1231410950422287,
-0.2089495062828064,
0.6767042279243469,
0.0046023051254451275,
-1.591025829315... |
func (c *Client) Addr() string {
return c.addr
} | [
0.2826499044895172,
-0.7088295221328735,
-0.09367658942937851,
0.2692984938621521,
-1.1455438137054443,
1.1070045232772827,
0.18301425874233246,
-0.2193095088005066,
0.16343611478805542,
-0.5749125480651855,
1.0888880491256714,
0.8338143825531006,
-0.10276392102241516,
0.0792437493801117,
... |
func (c *Client) SetAuth(token string) error {
if c == nil {
return fmt.Errorf("client not init")
}
c.token = token
return nil
} | [
0.32883188128471375,
-0.02278321608901024,
0.07299967110157013,
0.5550247430801392,
0.08284613490104675,
0.3621557354927063,
0.5457032322883606,
0.19021828472614288,
-0.45097965002059937,
-0.5127115249633789,
-1.1418181657791138,
1.216408371925354,
-0.3904936611652374,
0.3377021253108978,
... |
func (c *Client) Namespace(ns string, onlyLeaf bool) ([]string, error) {
var res []string
fullURL := fmt.Sprintf("%s/router/ns?ns=%s&format=list", c.Addr, ns)
resp, err := http.Get(fullURL)
if err != nil {
return nil, err
}
defer resp.Body.Close()
if resp.StatusCode/100 != 2 {
return nil, fmt.Errorf("HTTP ... | [
-0.8227918148040771,
0.07791651785373688,
0.9892030358314514,
0.38952234387397766,
-0.25759977102279663,
-0.6764054894447327,
-1.2705035209655762,
0.14323833584785461,
0.5509774684906006,
1.1269336938858032,
-0.06558238714933395,
1.224804162979126,
-0.024011220782995224,
0.8278555274009705... |
func isSpecialForm(formName string) bool {
return formName == "define" || formName == "if" || formName == "function"
} | [
-0.0045346892438828945,
0.57822185754776,
0.6111233234405518,
0.9206493496894836,
-0.34195461869239807,
-0.8393949866294861,
-0.9392189979553223,
0.9520568251609802,
0.8767051100730896,
-0.6196557879447937,
-1.0310084819793701,
0.4387189745903015,
0.11902641505002975,
0.850064218044281,
... |
func EvaluateDefine(sexp SExpression, env Environment) (error, Value, Environment) {
// Each value is (or should be) an S-Expression with a name to assign to and a value to evalute
var lastValue Value
for _, definition := range sexp.Values {
switch definition.(type) {
case SExpression:
def := definition.(SExp... | [
-0.6719083189964294,
-0.3750573396682739,
0.7374433875083923,
-0.08244091272354126,
0.5360196828842163,
-0.7726461291313171,
-0.3533560037612915,
0.6417109966278076,
-0.6612858176231384,
0.3036234974861145,
-1.0186632871627808,
0.3420988619327545,
-0.10591316223144531,
0.988024115562439,
... |
func EvaluateIf(sexp SExpression, env Environment) (error, Value, Environment) {
if len(sexp.Values) != 3 {
return errors.New("If expects one condition and two branches."), Value{}, env
}
conditionErr, conditionResult, newEnv := Evaluate(sexp.Values[0], env)
if conditionErr != nil {
return conditionErr, conditi... | [
0.2470681369304657,
0.20387455821037292,
0.5981574654579163,
0.10902200639247894,
0.11100583523511887,
-0.07451071590185165,
-0.33439338207244873,
0.37191081047058105,
-0.8034641742706299,
0.3720822036266327,
-0.4389326572418213,
0.1861765831708908,
-0.3207657039165497,
0.38775140047073364... |
func EvaluateFunction(sexp SExpression, env Environment) (error, Value, Environment) {
if len(sexp.Values) != 2 {
errMsg := "Function declarations expect one S-Expression with a set of argument names and one with a body."
return errors.New(errMsg), Value{}, env
}
switch sexp.Values[0].(type) {
case SExpression:... | [
-0.6449695229530334,
-0.4935520589351654,
0.8797244429588318,
-0.641975462436676,
0.42810845375061035,
-1.0047911405563354,
-0.287507563829422,
0.5611743330955505,
-0.4290996491909027,
0.743131160736084,
-1.5270626544952393,
0.8697614073753357,
0.04623502865433693,
0.22075378894805908,
0... |
func EvaluateSpecialForm(sexp SExpression, env Environment) (error, Value, Environment) {
switch sexp.FormName.Contained {
case "define":
return EvaluateDefine(sexp, env)
case "if":
return EvaluateIf(sexp, env)
case "function":
return EvaluateFunction(sexp, env)
}
return errors.New("Unrecognized special for... | [
0.08274360001087189,
-0.31941932439804077,
0.6448685526847839,
-0.21770066022872925,
-0.3543618619441986,
-0.41675207018852234,
-0.901201605796814,
1.4792884588241577,
-0.1818132847547531,
-0.5074475407600403,
-1.0803414583206177,
1.0223904848098755,
0.3088056147098541,
-0.0693768113851547... |
func EvaluateValue(value Value, env Environment) (error, Value, Environment) {
if value.Type == NameT {
varName := value.Name.Contained
actual, found := env[varName]
if !found {
return errors.New("Variable " + varName + " not assigned."), Value{}, env
} else {
return nil, actual, env
}
} else {
// A... | [
-0.5479241013526917,
-0.6737629175186157,
0.5600126385688782,
-0.16105930507183075,
0.43007180094718933,
-0.5815959572792053,
-0.41802844405174255,
-0.6713355779647827,
0.005443919450044632,
0.7415660619735718,
0.17164772748947144,
0.2189183235168457,
0.368872731924057,
1.3897569179534912,... |
func EvaluateSexp(sexp SExpression, env Environment) (error, Value, Environment) {
fnName := sexp.FormName.Contained
function, found := env[fnName]
if !found {
return errors.New("No such function " + fnName), Value{}, env
}
arguments := make([]Value, 0)
for _, arg := range sexp.Values {
evalErr, value, newEnv... | [
-0.10664699226617813,
-0.8260613679885864,
0.7460253238677979,
-0.1933690458536148,
0.06106896325945854,
-0.2935432493686676,
-0.7136674523353577,
0.9003251194953918,
-0.6243571043014526,
0.7716704607009888,
-1.0435675382614136,
0.6245623230934143,
0.12872569262981415,
0.7236644625663757,
... |
func Evaluate(thing interface{}, env Environment) (error, Value, Environment) {
switch thing.(type) {
case Value:
return EvaluateValue(thing.(Value), env)
case SExpression:
sexp := thing.(SExpression)
if isSpecialForm(sexp.FormName.Contained) {
return EvaluateSpecialForm(sexp, env)
} else {
return Eval... | [
-0.8120319247245789,
-0.4713114798069,
0.7424856424331665,
-0.2822418808937073,
-0.1096673458814621,
-0.030636180192232132,
-1.0254522562026978,
0.14698730409145355,
-0.7893499135971069,
0.10605993866920471,
-0.21621063351631165,
0.6611096262931824,
0.1615290492773056,
0.3798600137233734,
... |
func Apply(fn Function, arguments ...Value) (Value, error) {
for i := 0; i < len(fn.ArgumentNames); i++ {
if i >= len(arguments) {
return Value{}, errors.New("Not enough arguments passed to " + fn.FunctionName.Contained)
}
fn.Scope[fn.ArgumentNames[i].Contained] = arguments[i]
}
var err error
var computedV... | [
-0.1674284189939499,
0.7686002254486084,
0.8215105533599854,
0.25221312046051025,
-0.11018368601799011,
-0.06859666854143143,
-0.9722061157226562,
0.5236954092979431,
-0.4358099699020386,
-0.08276142179965973,
0.27459368109703064,
0.13634754717350006,
0.12682026624679565,
1.083415985107421... |
func Handler(ctx context.Context, input Input) (Response, error) {
var buf bytes.Buffer
Token := os.Getenv("BOT_KEY")
dg, err := discordgo.New("Bot " + Token)
if err != nil {
fmt.Println("Error creating bot reason: ", err)
}
fmt.Println(input.ChannelID)
client := dg.Open()
if client != nil {
fmt.Println("... | [
-0.12941671907901764,
0.05569973960518837,
0.846418023109436,
-0.7187725305557251,
-0.10059726983308792,
0.45521268248558044,
0.40160682797431946,
0.0070605953224003315,
-0.7088294625282288,
-0.09708510339260101,
-0.6320325136184692,
0.6151027083396912,
-0.35270848870277405,
0.783753633499... |
func Any(value interface{}) string {
return formatAtom(reflect.ValueOf(value))
} | [
-0.25416475534439087,
-0.4445251226425171,
0.45275893807411194,
-0.7226647734642029,
-0.7731438279151917,
0.38322702050209045,
-0.3832572102546692,
-0.7442428469657898,
-0.10452762991189957,
-0.379794716835022,
1.4031175374984741,
0.18296317756175995,
0.58925861120224,
0.2163413166999817,
... |
func formatAtom(v reflect.Value) string {
switch v.Kind() {
case reflect.Invalid:
return "invalid"
case reflect.Int, reflect.Int8, reflect.Int16,
reflect.Int32, reflect.Int64:
return strconv.FormatInt(v.Int(), 10)
case reflect.Uint, reflect.Uint8, reflect.Uint16,
reflect.Uint32, reflect.Uint64, reflect.Uint... | [
0.1978299766778946,
-0.8998210430145264,
0.7804215550422668,
-0.7066779136657715,
-0.2860082983970642,
-0.37359824776649475,
0.015175413340330124,
-0.8114455342292786,
0.2195759266614914,
0.06816986203193665,
1.2449085712432861,
0.7518423795700073,
0.49398359656333923,
0.6506781578063965,
... |
func (n NodeCollector) Describe(ch chan<- *prometheus.Desc) {
scrapeDurations.Describe(ch)
} | [
-0.15635569393634796,
1.1243679523468018,
0.3557462990283966,
-1.051438331604004,
0.7713759541511536,
0.4550513029098511,
-0.306253045797348,
-0.6731206774711609,
-0.7574074864387512,
0.2592688798904419,
0.8231860399246216,
0.9231980443000793,
0.9664928913116455,
1.2970420122146606,
-0.1... |
func (n NodeCollector) Collect(ch chan<- prometheus.Metric) {
wg := sync.WaitGroup{}
wg.Add(len(n.collectors))
for name, c := range n.collectors {
go func(name string, c collector.Collector) {
execute(name, c, ch)
wg.Done()
}(name, c)
}
wg.Wait()
scrapeDurations.Collect(ch)
} | [
-0.5241944193840027,
-0.13233014941215515,
0.70564866065979,
-0.44469234347343445,
0.1890544295310974,
0.5934147238731384,
-0.03717717528343201,
-1.320857048034668,
-1.1479507684707642,
0.09735764563083649,
0.41829344630241394,
0.2205115556716919,
0.9585570096969604,
1.4926966428756714,
... |
func (gc *GormClient) StoreAccount(ctx context.Context, accountData model.AccountData) (model.AccountData, error) {
if gc.crDB == nil {
return model.AccountData{}, fmt.Errorf("Connection to DB not established!")
}
accountData.ID = uuid.NewV4().String()
tx := gc.crDB.Begin()
tx = tx.Create(&accountData)
if tx.... | [
0.20474004745483398,
-0.15586033463478088,
0.4949384033679962,
-0.2372707575559616,
0.08051514625549316,
1.3473864793777466,
0.748003363609314,
-0.04941563680768013,
0.14036835730075836,
-0.03947813808917999,
-0.06961685419082642,
0.16848275065422058,
-1.1356706619262695,
0.039558526128530... |
func (gc *GormClient) UpdateAccount(ctx context.Context, accountData model.AccountData) (model.AccountData, error) {
if gc.crDB == nil {
return model.AccountData{}, fmt.Errorf("Connection to DB not established!")
}
tx := gc.crDB.Begin()
tx = tx.Save(&accountData)
if tx.Error != nil {
log.Fatalf("Error updatin... | [
-0.44466903805732727,
-0.8112878203392029,
0.6626530289649963,
0.027333280071616173,
-0.1329125165939331,
1.2182072401046753,
0.7280659079551697,
0.06622689962387085,
0.1971946358680725,
0.825781524181366,
0.2690269351005554,
0.1391143947839737,
-0.8416556119918823,
-0.11732353270053864,
... |
func (t *TxAPI) Send(data map[string]interface{}) (*api.ResultHash, error) {
out, statusCode, err := t.c.call("tx_sendPayload", data)
if err != nil {
return nil, makeReqErrFromCallErr(statusCode, err)
}
var result api.ResultHash
if err = util.DecodeMap(out, &result); err != nil {
return nil, errors.ReqErr(500... | [
-0.47185325622558594,
0.7335519790649414,
0.5724503993988037,
0.2053481489419937,
-0.920052170753479,
-0.630305290222168,
-0.2197815477848053,
-0.949975311756134,
-0.5350475311279297,
0.8666880130767822,
-0.850963830947876,
-0.280756413936615,
-1.2262930870056152,
-0.4705562889575958,
-0... |
func (t *TxAPI) Get(hash string) (*api.ResultTx, error) {
resp, statusCode, err := t.c.call("tx_get", hash)
if err != nil {
return nil, makeReqErrFromCallErr(statusCode, err)
}
var r api.ResultTx
if err = util.DecodeMap(resp, &r); err != nil {
return nil, errors.ReqErr(500, ErrCodeDecodeFailed, "", err.Error(... | [
-0.4584328234195709,
0.5705035924911499,
0.6205537915229797,
-0.14361682534217834,
-0.10448863357305527,
-1.0837864875793457,
-0.37796837091445923,
-0.5146340131759644,
-0.28159618377685547,
0.13647153973579407,
-0.9235491156578064,
0.1566143035888672,
-0.8420945405960083,
-0.2572659552097... |
func (c *Context) GetArg(name string) *Arg {
if value, ok := c.args[name]; ok {
return &Arg{
value: value,
}
}
return &Arg{}
} | [
0.11699800193309784,
0.32989147305488586,
0.21423889696598053,
-0.14935342967510223,
-0.09371720999479294,
0.017888721078634262,
-0.45802345871925354,
-0.5327970385551453,
0.46306702494621277,
0.9062876105308533,
0.4031350910663605,
0.9891155362129211,
0.04446084424853325,
-0.1155417412519... |
func (a *Arg) Int(def int) int {
if a.value == "" {
return def
}
i, err := strconv.Atoi(a.value)
if err != nil {
panic(err)
}
return i
} | [
-0.025615110993385315,
1.0949283838272095,
0.424898624420166,
-0.787314236164093,
0.2790727913379669,
-0.16733109951019287,
0.12165721505880356,
0.4075181782245636,
-1.028800129890442,
0.7393110990524292,
0.3416285812854767,
0.5227543115615845,
0.40686288475990295,
0.45078805088996887,
0... |
func (a *Arg) String(def string) string {
if a.value == "" {
return def
}
return a.value
} | [
-0.0669528990983963,
0.8720587491989136,
0.1923222839832306,
-0.3740696907043457,
0.4854370355606079,
0.1060774028301239,
0.7127096652984619,
-0.17770805954933167,
-0.14853942394256592,
0.4599824547767639,
0.2300814837217331,
0.8805997371673584,
-0.2566114664077759,
0.9239952564239502,
0... |
func (m *Monster) Damage(damage int) {
m.Health -= damage
} | [
-0.2639976739883423,
-0.3647707402706146,
0.3933912217617035,
-0.17788301408290863,
0.10420393943786621,
1.0761812925338745,
-0.20802795886993408,
0.8735772967338562,
-0.19738756120204926,
0.1453976184129715,
0.8815554976463318,
-0.25110048055648804,
-1.2306815385818481,
1.0961188077926636... |
func NewRetryMiddleware(cfg Config) func(http.Handler) http.Handler {
return func(handler http.Handler) http.Handler {
return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
log.WithFields(log.Fields{
"attempts": cfg.Attempts,
"backoff": cfg.Backoff,
}).Debug("Starting retry middleware... | [
0.30303874611854553,
0.32813209295272827,
0.6602760553359985,
-0.16646966338157654,
-0.6363837718963623,
0.3182242810726166,
0.15030422806739807,
-0.09768994152545929,
-0.4672876000404358,
0.3755199909210205,
0.15155577659606934,
0.4811292886734009,
-0.5670567154884338,
0.7524785995483398,... |
func (pm *PoolManager) Add(ScrapeHost, ScrapePath, cacheScriptPath string) Pool {
p := Pool{
ScrapeHost: ScrapeHost,
ScrapePath: ScrapePath,
CacheScriptPath: cacheScriptPath,
}
pm.Pools = append(pm.Pools, p)
return p
} | [
-1.069329857826233,
-0.654732882976532,
0.472154438495636,
-0.32663461565971375,
0.3111840486526489,
1.3065170049667358,
-0.12034756690263748,
0.11987556517124176,
0.5792235732078552,
-0.639756441116333,
0.23632022738456726,
0.9441102743148804,
-0.4653301537036896,
0.31926804780960083,
-... |
func (pm *PoolManager) Update() (err error) {
wg := &sync.WaitGroup{}
started := time.Now()
for idx := range pm.Pools {
wg.Add(1)
go func(p *Pool) {
defer wg.Done()
if err := p.Update(); err != nil {
log.Error(err)
}
}(&pm.Pools[idx])
}
wg.Wait()
ended := time.Now()
log.Debugf("Updated %v... | [
-0.8638176321983337,
-0.7018923759460449,
0.41888710856437683,
-0.0016100018983706832,
-0.3996063768863678,
0.6364445090293884,
0.11944916099309921,
-0.671780526638031,
-0.6111530661582947,
0.4817812442779541,
0.04728846624493599,
0.3206276595592499,
-0.8497166037559509,
0.8015140891075134... |
func (p *Pool) Update() (err error) {
p.ScrapeError = nil
scheme, address, path, err := parseURL(p.ScrapeHost + p.ScrapePath)
if err != nil {
return p.error(err)
}
fcgi, err := fcgiclient.DialTimeout(scheme, address, time.Duration(3)*time.Second)
if err != nil {
return p.error(err)
}
defer fcgi.Close()
... | [
-1.1734873056411743,
-0.5223315358161926,
0.8345786333084106,
-0.25188833475112915,
-0.24198020994663239,
-0.28970351815223694,
-0.3557451665401459,
-0.8400779962539673,
-0.4648262560367584,
0.7775818109512329,
-0.2557758688926697,
0.5605531334877014,
-0.6190992593765259,
0.186657249927520... |
func JSONResponseFixer(content []byte) []byte {
c := string(content)
re := regexp.MustCompile(`(,"request uri":)"(.*?)"(,"content length":)`)
matches := re.FindAllStringSubmatch(c, -1)
for _, match := range matches {
requestURI, _ := json.Marshal(match[2])
sold := match[0]
snew := match[1] + string(requestU... | [
-1.0350525379180908,
-0.9731882214546204,
0.5378937125205994,
-0.5118523836135864,
-0.5557480454444885,
-1.2986925840377808,
0.17934447526931763,
-0.4564288556575775,
0.5758068561553955,
-0.25514182448387146,
-0.2377246469259262,
0.14985087513923645,
-0.36098748445510864,
-0.36169257760047... |
func CountProcessState(processes []PoolProcess) (active int64, idle int64, total int64) {
for idx := range processes {
switch processes[idx].State {
case PoolProcessRequestRunning:
active++
case PoolProcessRequestIdle:
idle++
case PoolProcessRequestEnding:
case PoolProcessRequestFinishing:
case PoolP... | [
-0.6938539743423462,
-1.6719111204147339,
0.6626372337341309,
-0.9781534075737,
0.26594725251197815,
-0.1363489031791687,
-0.18062962591648102,
-0.6666659712791443,
0.6056302189826965,
-0.1763952374458313,
-0.6319923400878906,
-0.4597832262516022,
-0.0158415324985981,
-0.6955190300941467,
... |
func parseURL(rawurl string) (scheme string, address string, path string, err error) {
uri, err := url.Parse(rawurl)
if err != nil {
return uri.Scheme, uri.Host, uri.Path, err
}
scheme = uri.Scheme
switch uri.Scheme {
case "unix":
result := strings.Split(uri.Path, ";")
address = result[0]
if len(result)... | [
-0.4291231632232666,
0.43393072485923767,
0.7066501975059509,
0.2829751670360565,
0.037873439490795135,
-0.24760732054710388,
0.17257599532604218,
1.0439096689224243,
0.19567792117595673,
-0.3756118416786194,
-0.3857968747615814,
-0.5080015063285828,
0.20704714953899384,
-0.798991143703460... |
func (t *timestamp) MarshalJSON() ([]byte, error) {
ts := time.Time(*t).Unix()
stamp := fmt.Sprint(ts)
return []byte(stamp), nil
} | [
-0.23895005881786346,
0.049249377101659775,
0.551893413066864,
-0.0572647750377655,
0.06820254027843475,
0.02249095030128956,
-0.8079572916030884,
0.3620041012763977,
1.1109496355056763,
0.2821338176727295,
-1.132240653038025,
0.7131545543670654,
0.5945047736167908,
-0.027379652485251427,
... |
func (t *timestamp) UnmarshalJSON(b []byte) error {
ts, err := strconv.Atoi(string(b))
if err != nil {
return err
}
*t = timestamp(time.Unix(int64(ts), 0))
return nil
} | [
-0.49292775988578796,
0.4983927607536316,
0.6103443503379822,
-1.0627048015594482,
-0.01798834837973118,
-0.25165459513664246,
-0.07893490046262741,
0.20462405681610107,
0.21030575037002563,
1.0414224863052368,
-0.8510963320732117,
-0.3818529546260834,
0.3609238564968109,
-0.14433886110782... |
func (rd *requestDuration) MarshalJSON() ([]byte, error) {
stamp := fmt.Sprint(rd)
return []byte(stamp), nil
} | [
-0.8636398315429688,
0.3735768496990204,
0.32651546597480774,
0.47201865911483765,
-0.9293527007102966,
0.4707816243171692,
-0.39919528365135193,
-0.4109629988670349,
1.0360257625579834,
0.0478191152215004,
-0.20853379368782043,
0.9871522784233093,
-0.6112185120582581,
0.35311734676361084,... |
func SetLogger(logger logger) {
log = logger
} | [
-0.15870432555675507,
0.2240460067987442,
0.13338546454906464,
0.08614928275346756,
-0.23540525138378143,
0.23651044070720673,
-0.31027093529701233,
1.1491618156433105,
0.5141143798828125,
-0.7992467284202576,
-0.7293736934661865,
0.07099892199039459,
0.02593717910349369,
2.142819166183471... |
func ParseBackendKeyData(r io.Reader) (*BackendKeyData, error) {
buf := newReadBuffer(r)
// 'K' [int32 - length] [int32 - pid] [in32 - key]
err := buf.ReadTag('K')
if err != nil {
return nil, err
}
buf, err = buf.ReadLength()
if err != nil {
return nil, err
}
pid, err := buf.ReadInt()
if err != nil {
... | [
0.0937485620379448,
-0.8697012066841125,
0.4601394832134247,
-1.016437292098999,
-0.1946098655462265,
0.04286859557032585,
-0.28581929206848145,
-0.12658728659152985,
-1.2450790405273438,
0.5623723268508911,
-0.19104762375354767,
0.3783884644508362,
-1.2194699048995972,
0.06172500178217888... |
func (b *BackendKeyData) Encode() []byte {
buf := newWriteBuffer()
buf.WriteInt(b.PID)
buf.WriteInt(b.Key)
buf.Wrap('K')
return buf.Bytes()
} | [
-0.3401848375797272,
0.018242137506604195,
0.6113734245300293,
0.10091619938611984,
1.1827372312545776,
0.4995308518409729,
-1.6778967380523682,
0.2501557469367981,
-1.1720054149627686,
0.6605343818664551,
0.07991389185190201,
0.7721132040023804,
-1.6159451007843018,
-0.4619221091270447,
... |
func Event_Log_Factory(httpClientFactory *config.HTTPClientFactory, rpcClient *RPC_Client, contractAddress string) *Event_Log {
var err error
if block_read_delay, err = strconv.Atoi(os.Getenv("mtn_soliditycontract_block_read_delay")); err != nil {
block_read_delay = 0
}
if block_update_delay, err = strconv.Ato... | [
1.0329475402832031,
-0.3288465440273285,
0.625410258769989,
-0.41552066802978516,
-0.27013975381851196,
0.02021762914955616,
-0.03690861165523529,
0.39824485778808594,
-0.05252417176961899,
0.2805844843387604,
0.5972402691841125,
0.3572063148021698,
-0.05176933854818344,
0.1803935319185257... |
func (d *DeviceBase) DeviceInfo() DeviceInfo {
return d.Info
} | [
-0.10378919541835785,
-0.319433331489563,
0.10153528302907944,
0.232321098446846,
0.35307884216308594,
0.4013526439666748,
0.947291374206543,
-0.4756508469581604,
-0.5889488458633423,
-0.5554594993591309,
-0.33637678623199463,
0.30898556113243103,
0.3377903401851654,
0.4866267144680023,
... |
func (d *DeviceBase) Reply(msgID MsgID, reply proto.Message, err error) error {
return SendReply(d.busPort, msgID, reply, err)
} | [
-0.28444164991378784,
0.4266037344932556,
0.2302427589893341,
0.7246296405792236,
-0.06550876796245575,
0.3037109971046448,
0.15496933460235596,
-0.19810259342193604,
0.7470157146453857,
-0.21151942014694214,
-0.22730593383312225,
0.9572447538375854,
-1.3940743207931519,
0.8228024244308472... |
func SendReply(dispatcher MsgDispatcher, msgID MsgID, reply proto.Message, err error) error {
if dispatcher == nil {
return ErrInvalidDispatcher
}
flag := uint8(0)
if err != nil {
flag |= BodyError
reply = &Error{Message: err.Error()}
}
return BuildMsg().
MsgID(msgID).
EncodeBody(flag, reply).
Build(... | [
-0.24830742180347443,
0.16214483976364136,
0.6515262722969055,
0.8181403279304504,
-0.7409291863441467,
0.09063372761011124,
-0.9929340481758118,
-0.15621572732925415,
1.191113829612732,
0.0485011525452137,
-0.14362457394599915,
0.6801089644432068,
-0.6234207153320312,
1.0420411825180054,
... |
func (l *LogicBase) EmitEvent(channelID uint8, event proto.Message) error {
return BuildMsg().
EncodeEvent(
uint8(l.Device.DeviceInfo().Address),
channelID,
event).
Build().
Dispatch(l.Device.BusPort())
} | [
-0.03870081901550293,
0.4191378951072693,
0.2778613865375519,
-0.29936766624450684,
1.040993094444275,
0.7132276892662048,
-0.08346586674451828,
-0.20588688552379608,
0.599342942237854,
0.030028250068426132,
-0.3848838806152344,
0.7788562774658203,
-1.0434658527374268,
0.6283479928970337,
... |
func DeviceAddress(devs ...Device) RouteAddr {
addrs := make([]uint8, len(devs))
for n, dev := range devs {
addrs[n] = uint8(dev.DeviceInfo().Address)
}
return RouteAddr(addrs)
} | [
-1.1855758428573608,
-0.4230845272541046,
0.6222485899925232,
0.5060139298439026,
0.35793736577033997,
-0.19887886941432953,
0.9386466145515442,
-0.2127399444580078,
0.9600438475608826,
0.03101334162056446,
0.3587529957294464,
0.3657967746257782,
0.2796933650970459,
0.21531978249549866,
... |
func (d *DeviceInfo) DeviceAddress() RouteAddr {
return RouteWith(uint8(d.Address))
} | [
-0.44395148754119873,
-0.6520037055015564,
0.42504993081092834,
-0.11001349240541458,
0.40832141041755676,
-0.2592447102069855,
0.994454026222229,
0.019968725740909576,
1.3548376560211182,
-0.4681244194507599,
0.4754771292209625,
0.8033424615859985,
0.4690757095813751,
0.5222665667533875,
... |
func (d *DeviceInfo) AddLabel(name, value string) *DeviceInfo {
m := d.Labels
if m == nil {
m = make(map[string]string)
d.Labels = m
}
m[name] = value
return d
} | [
-0.6071895360946655,
0.2596670985221863,
0.47078609466552734,
-0.6638314723968506,
-0.5812340974807739,
1.0206952095031738,
-0.8668447136878967,
-0.15733139216899872,
0.29207366704940796,
-0.9602030515670776,
0.8015671968460083,
-0.7638416886329651,
-0.07072371989488602,
0.2855933308601379... |
func (d *DeviceInfo) AddLabels(labels map[string]string) *DeviceInfo {
if d.Labels == nil {
d.Labels = labels
} else {
for k, v := range labels {
d.Labels[k] = v
}
}
return d
} | [
-1.2295341491699219,
0.6435747146606445,
0.2676030695438385,
-0.88478684425354,
0.20802882313728333,
0.825217604637146,
-1.1315033435821533,
-0.08248204737901688,
0.3118084669113159,
-1.0824065208435059,
1.2065176963806152,
-1.1114106178283691,
-0.5009473562240601,
0.8383674621582031,
-0... |
func getMorphResult(msg string, c net.Conn) (status string, err error) {
fmt.Fprintf(c, "%s%c", msg, '\x00')
status, err = bufio.NewReader(c).ReadString('\x00')
return
} | [
0.5329465270042419,
0.17224381864070892,
0.4752591848373413,
-1.188002109527588,
-0.4368644058704376,
-0.31841880083084106,
-0.5969512462615967,
-0.2579290270805359,
-0.18659619987010956,
-0.5443861484527588,
0.03333401679992676,
0.5276959538459778,
-1.5537959337234497,
-0.3260402977466583... |
func (grid *Grid) Write(r io.Reader) error {
scanner := bufio.NewScanner(r)
i := 0
for i < 9 && scanner.Scan() {
line := scanner.Text()
cells := strings.Fields(line)
if len(cells) != 9 {
return fmt.Errorf("sudoku input: row %v incorrect length", i+1)
}
for j, cell := range cells {
val, err := strCell... | [
-0.593559980392456,
0.5300536155700684,
0.606722891330719,
-0.19250249862670898,
0.38402611017227173,
-0.39684465527534485,
0.5516263842582703,
0.5118197798728943,
-0.36422982811927795,
-0.039495788514614105,
0.12650273740291595,
-0.6333786845207214,
-0.2046974003314972,
0.3178159594535827... |
func (g *Grid) String() string {
var buff bytes.Buffer
for r := 0; r < gridLen; r++ {
for c := 0; c < gridLen; c++ {
buff.WriteString(strconv.Itoa(g[r][c]))
if c != gridLen-1 {
buff.WriteString(" ")
}
}
buff.WriteString("\n")
}
return buff.String()
} | [
0.4399504065513611,
-0.23022232949733734,
0.2999211549758911,
-0.8622502684593201,
0.01951301470398903,
-0.06924543529748917,
0.32421818375587463,
-1.7701470851898193,
-0.8089257478713989,
0.4019811749458313,
0.41457995772361755,
0.4210689961910248,
-0.7529554963111877,
0.3146419823169708,... |
func Encode(enc types.Encoder, kv map[string]interface{}) (err error) {
for k, v := range kv {
if err = enc.AddKey(k); err != nil {
return err
}
if err = EncodeValue(enc, v); err != nil {
return err
}
}
return nil
} | [
-0.5656819939613342,
0.36052143573760986,
0.4739537537097931,
1.1755090951919556,
0.011955002322793007,
0.16388027369976044,
-0.5007683634757996,
-0.07996044307947159,
-0.5122758150100708,
0.5402447581291199,
0.09678561985492706,
-0.26262637972831726,
0.22632789611816406,
1.269038558006286... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.