code
stringlengths
114
1.05M
path
stringlengths
3
312
quality_prob
float64
0.5
0.99
learning_prob
float64
0.2
1
filename
stringlengths
3
168
kind
stringclasses
1 value
package tensor import ( "math" "github.com/lordlarker/nune/internal/cpd" ) // PwiseOp performs a pointwise operation // over each element of the Tensor. func (t *Tensor[T]) PwiseOp(f func(T) T) *Tensor[T] { cpd.Pointwise(t.storage.Load(), f) return t } // Abs computes the absolute value of each // element of ...
tensor/pwise.go
0.905594
0.860017
pwise.go
starcoder
package main import ( "fmt" "go/ast" ) // A Visitor's Visit method is invoked for each node encountered by walkToReplace. // If the result visitor w is not nil, walkToReplace visits each of the children // of node with the visitor w, followed by a call of w.Visit(nil). type Visitor interface { Visit(node ast.Node,...
cmd/kitgen/replacewalk.go
0.532911
0.473292
replacewalk.go
starcoder
package gox import ( "math" "strconv" "strings" ) const ( defaultFormatBase = 76 maxDecimalNum = 9 maxFormatNum = defaultFormatBase ) var ( _ = FormatIntd _ = Atoid tenToAny = map[int]string{ 0: `0`, 1: `1`, 2: `2`, 3: `3`, 4: `4`, 5: `5`, 6: `6`, 7: `7`, 8: `8`, 9: `...
itoa.go
0.500488
0.537102
itoa.go
starcoder
package display import ( "image" "image/color" "strconv" "unicode/utf8" ) // Cursor models the known or unknown states of a cursor. type Cursor struct { // Position is the position of the cursor. // Negative values indicate that the X or Y position is not known, // so the next position change must be relative ...
display/cursor.go
0.627837
0.501648
cursor.go
starcoder
package parse type ( // Binder returns a Parser based on the provided Result Binder func(Result) Parser // Accept receives a Result from a Capture Parser Accept func(Result) // Mapper maps one Result value to another Mapper func(Result) Result // Predicate checks the beginning of its provided Input for a mat...
parse/basics.go
0.783368
0.538923
basics.go
starcoder
package types type Participant struct { Name string } type Testcase struct { // ID of the testcase. Must be unique within the test suite. ID string // Name is the short description of the testcase Name string // Groups helps organize testcases Group string // Description is a long description Description str...
pkg/types/types.go
0.504639
0.456652
types.go
starcoder
package value import ( "strconv" "strings" ) // BoolSlice holds a slice of boolean values type BoolSlice struct { valsPtr *[]bool } // NewBoolSlice makes a new BoolSlice with the given boolean values. func NewBoolSlice(vals ...bool) *BoolSlice { slice := make([]bool, len(vals)) copy(slice, vals) return &Bool...
value/boolslice.go
0.822011
0.62478
boolslice.go
starcoder
package layer import "errors" // ErrZeroRow is returned by New when the number of rows is zero. var ErrZeroRow = errors.New("layer: the number of rows cannot be zero") // ErrZeroColumn is returned by New when the number of columns is zero. var ErrZeroColumn = errors.New("layer: the number of columns cannot be zero")...
layer/errors.go
0.621081
0.626496
errors.go
starcoder
package protocol import "time" // MaxPacketSize is the maximum packet size that we use for sending packets. // It includes the QUIC packet header, but excludes the UDP and IP header. const MaxPacketSize ByteCount = 1200 // NonForwardSecurePacketSizeReduction is the number of bytes a non forward-secure packet has to ...
src/github.com/lucas-clemente/quic-go/internal/protocol/server_parameters.go
0.695752
0.428951
server_parameters.go
starcoder
package smoothing import ( "github.com/filecoin-project/go-state-types/abi" "github.com/filecoin-project/go-state-types/big" smoothing6 "github.com/filecoin-project/specs-actors/v6/actors/util/smoothing" "github.com/filecoin-project/specs-actors/v7/actors/util/math" ) var ( defaultInitialPosition big.Int defau...
actors/util/smoothing/alpha_beta_filter.go
0.78899
0.493653
alpha_beta_filter.go
starcoder
package hedwig /* Hedwig is an inter-service communication bus that works on AWS and GCP, while keeping things pretty simple and straight forward. It allows validation of the message payloads before they are sent, helping to catch cross-component incompatibilities early. Hedwig allows separation of concerns between...
doc.go
0.741674
0.546012
doc.go
starcoder
package datadog import ( "encoding/json" "fmt" ) // ServiceLevelObjective A service level objective object includes a service level indicator, thresholds for one or more timeframes, and metadata (`name`, `description`, `tags`, etc.). type ServiceLevelObjective struct { // Creation timestamp (UNIX time in seconds)...
api/v1/datadog/model_service_level_objective.go
0.827898
0.418816
model_service_level_objective.go
starcoder
package model import ( "regexp" "time" ) const ( // ANSIC regex to validate ANSIC date string ANSIC = `^(Mon|Tue|Wed|Thu|Fri|Sat|Sun) (Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec) [0-3]?[0-9] [0-9]{2}:[0-9]{2}:[0-9]{2} [0-9]{4}$` // UnixDate regex to validate UnixDate date string UnixDate = `^(Mon|Tue|Wed|...
model/TimeFormat.go
0.553505
0.510558
TimeFormat.go
starcoder
package kerl import ( "hash" "strings" "unsafe" . "github.com/loveandpeople/lp.go/consts" "github.com/loveandpeople/lp.go/kerl/sha3" . "github.com/loveandpeople/lp.go/signing/utils" "github.com/loveandpeople/lp.go/trinary" "github.com/pkg/errors" ) // ErrAbsorbAfterSqueeze is returned when absorb is called o...
kerl/kerl.go
0.666497
0.445771
kerl.go
starcoder
package exchangerates import ( "bytes" "encoding/xml" "math" "time" "github.com/mayswind/ezbookkeeping/pkg/core" "github.com/mayswind/ezbookkeeping/pkg/errs" "github.com/mayswind/ezbookkeeping/pkg/log" "github.com/mayswind/ezbookkeeping/pkg/models" "github.com/mayswind/ezbookkeeping/pkg/utils" "github.com/m...
pkg/exchangerates/national_bank_of_poland_datasource.go
0.680348
0.440349
national_bank_of_poland_datasource.go
starcoder
package xmath import ( "math" "math/big" ) // FloorBigFloat returns the greatest integer value less than or equal to x. // It returns nil if x is an infinity. func FloorBigFloat(x *big.Float) *big.Int { n, acc := x.Int(nil) if acc == big.Above { n.Add(n, big.NewInt(-1)) } return n } // CeilBigFloat returns t...
big.go
0.851999
0.61927
big.go
starcoder
package lnwire import ( "encoding/binary" "encoding/hex" "math" "github.com/Actinium-project/acmd/chaincfg/chainhash" "github.com/Actinium-project/acmd/wire" ) const ( // MaxFundingTxOutputs is the maximum number of allowed outputs on a // funding transaction within the protocol. This is due to the fact // t...
lnwire/channel_id.go
0.763043
0.47317
channel_id.go
starcoder
package workers // Pool represents a pool of goroutines acting as workers. type Pool struct { // count is the number of workers in the pool. count int // tasks is the channel onto which requests will be passed to // the underlying set of workers; each worker will wait on // the channel until it is closed (at po...
workers/pool.go
0.605566
0.424949
pool.go
starcoder
package chunk import ( "bytes" "sync" ) const ( // SubChunkVersion is the current version of the written sub chunks, specifying the format they are // written on disk and over network. SubChunkVersion = 9 // CurrentBlockVersion is the current version of blocks (states) of the game. This version is composed // ...
server/world/chunk/encode.go
0.674265
0.439507
encode.go
starcoder
package pdp // Match represents match expression. Specific kind of boolean expression which // can have two arguments. One of arguments should be immediate value and other // should be attribute designator. type Match struct { m Expression } // AllOf groups match expressions into boolean expression which result is t...
pdp/target.go
0.795301
0.606032
target.go
starcoder
package output import ( "encoding/json" "errors" "fmt" "sync/atomic" "time" "github.com/Jeffail/benthos/v3/internal/docs" "github.com/Jeffail/benthos/v3/lib/log" "github.com/Jeffail/benthos/v3/lib/metrics" "github.com/Jeffail/benthos/v3/lib/response" "github.com/Jeffail/benthos/v3/lib/types" ) //----------...
lib/output/drop_on_error.go
0.71403
0.586049
drop_on_error.go
starcoder
package iso20022 // Execution of a subscription order. type SubscriptionExecution3 struct { // Unique and unambiguous identifier for an order, as assigned by the instructing party. OrderReference *Max35Text `xml:"OrdrRef"` // Unique and unambiguous identifier for an order execution, as assigned by a confirming pa...
SubscriptionExecution3.go
0.837221
0.420362
SubscriptionExecution3.go
starcoder
package query import ( "encoding/json" "errors" "fmt" "github.com/google/go-cmp/cmp" ) //------------------------------------------------------------------------------ // ArithmeticOperator represents an arithmetic operation that combines the // results of two query functions. type ArithmeticOperator int // Al...
internal/bloblang/query/arithmetic.go
0.73782
0.458652
arithmetic.go
starcoder
package fullysec import ( "fmt" "math/big" "github.com/fentec-project/bn256" "github.com/fentec-project/gofe/data" "github.com/fentec-project/gofe/internal/dlog" "github.com/fentec-project/gofe/sample" "github.com/pkg/errors" "crypto/sha256" "crypto/sha512" ) // DMCFEClient is to be instantiated by the enc...
chaincode/cbfm/go/fentec-project/gofe/innerprod/fullysec/dmcfe.go
0.651687
0.442576
dmcfe.go
starcoder
package main import ( "image/color" "image/png" "strings" "runtime" "image" "bufio" "math" "flag" "time" "log" "fmt" "os" ) const FocusBias = 4.0 const FocusStep = 0.2 const PixelBias = 16 /* * struct ImageData */ type ImageData struct { Width, Height, Size int Pixels []uint8 } func (i *ImageData) A...
scripts/encoder/depth-map.go
0.631594
0.439747
depth-map.go
starcoder
package stats import ( "context" "errors" fmt "fmt" "sync" "time" "github.com/dustin/go-humanize" "github.com/go-kit/kit/log" ) type ctxKeyType string const ( trailersKey ctxKeyType = "trailers" chunksKey ctxKeyType = "chunks" ingesterKey ctxKeyType = "ingester" storeKey ctxKeyType = "store" result...
pkg/logql/stats/context.go
0.677581
0.412175
context.go
starcoder
package models import ( i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91 "github.com/microsoft/kiota-abstractions-go/serialization" ) // UserExperienceAnalyticsRegressionSummary type UserExperienceAnalyticsRegressionSummary struct { Entity // The metric values for the user experience ana...
models/user_experience_analytics_regression_summary.go
0.672117
0.432752
user_experience_analytics_regression_summary.go
starcoder
package clustering import ( "math" "github.com/paulmach/go.geo" ) // ClusterPointers will take a set of Pointers and cluster them using // the distancer and threshold. func ClusterPointers(pointers []geo.Pointer, distancer ClusterDistancer, threshold float64) []*Cluster { clusters := make([]*Cluster, 0, len(point...
lab138/vendor/github.com/paulmach/go.geo/clustering/clustering.go
0.596786
0.58747
clustering.go
starcoder
package scenario import ( "context" "math/rand" "sort" "strconv" "time" "github.com/morikuni/failure" "github.com/isucon10-qualify/isucon10-qualify/bench/asset" "github.com/isucon10-qualify/isucon10-qualify/bench/client" "github.com/isucon10-qualify/isucon10-qualify/bench/fails" "github.com/isucon10-qualif...
bench/scenario/estateNazotteSearchScenario.go
0.573201
0.501099
estateNazotteSearchScenario.go
starcoder
package mock import D "github.com/Netflix/chaosmonkey/deploy" // Deployment returns a mock implementation of deploy.Deployment // Deployment has 4 apps: foo, bar, baz, quux // Each app runs in 1 account: // foo, bar, baz run in prod // quux runs in test // Each app has one cluster: foo-prod, bar-prod, baz-prod...
mock/deployment.go
0.553747
0.415254
deployment.go
starcoder
package toolbox import ( "fmt" "reflect" "time" ) //Zeroable represents object that can call IsZero type Zeroable interface { //IsZero returns true, if value of object was zeroed. IsZero() bool } //IsInt returns true if input is an int func IsInt(input interface{}) bool { switch input.(type) { case int, int8,...
types.go
0.744935
0.490541
types.go
starcoder
package convex import ( "math" "github.com/hueypark/physics/core/math/rotator" "github.com/hueypark/physics/core/math/vector" "github.com/hueypark/physics/core/shape" ) type Convex struct { vertices []vector.Vector hull []vector.Vector edges []Edge } type Edge struct { Start vector.Vector End ve...
core/shape/convex/convex.go
0.804636
0.67173
convex.go
starcoder
package aspect import "fmt" // UpdateStmt is the internal representation of an SQL UPDATE statement. type UpdateStmt struct { ConditionalStmt table *TableElem values Values } // String outputs the parameter-less UPDATE statement in a neutral dialect. func (stmt UpdateStmt) String() string { compiled, _ := stmt....
Godeps/_workspace/src/github.com/aodin/aspect/update.go
0.592902
0.422445
update.go
starcoder
package condition import ( "fmt" "github.com/Jeffail/benthos/v3/lib/log" "github.com/Jeffail/benthos/v3/lib/metrics" "github.com/Jeffail/benthos/v3/lib/types" ) //------------------------------------------------------------------------------ func init() { Constructors[TypeOr] = TypeSpec{ constructor: NewOr, ...
lib/condition/or.go
0.734881
0.658706
or.go
starcoder
package types import ( "io" "github.com/lyraproj/puppet-evaluator/eval" ) type VariantType struct { types []eval.Type } var Variant_Type eval.ObjectType func init() { Variant_Type = newObjectType(`Pcore::VariantType`, `Pcore::AnyType { attributes => { types => Array[Type] } }`) } func DefaultVariantType...
types/varianttype.go
0.57678
0.447521
varianttype.go
starcoder
package nibble //Note: replace Arrays with Slices, the term Array is used incorrectly here these are Slices not Arrays //CreateNibble - Creates a nibble by using half a byte that can be merged with another nibble later func CreateNibble(N1 byte) byte { if N1 > 15 { N1 = 15 } return N1 } //CreateNibbleMerged - C...
nibble.go
0.715026
0.544014
nibble.go
starcoder
package idr import ( "fmt" ) // JSONType is the type of a JSON-specific Node. // Note multiple JSONType can be bit-wise OR'ed together. type JSONType uint const ( // JSONRoot is the type for the root Node in a JSON IDR tree. JSONRoot JSONType = 1 << iota // JSONObj is the type for a Node in a JSON IDR tree whose...
idr/jsonnode.go
0.671578
0.596962
jsonnode.go
starcoder
package mat import "math" type BoundingBox struct { Min Set Max Set } func NewEmptyBoundingBox() *BoundingBox { return &BoundingBox{ Min: NewPoint(math.Inf(1), math.Inf(1), math.Inf(1)), Max: NewPoint(math.Inf(-1), math.Inf(-1), math.Inf(-1)), } } func NewBoundingBox(pointA Set, pointB Set) *BoundingBox { r...
internal/pkg/mat/boundingbox.go
0.727007
0.626781
boundingbox.go
starcoder
package timerange import ( "fmt" "time" ) type TimeRange struct { b time.Time e time.Time } func (m TimeRange) Truncate(iv Whole) (head, tail, body TimeRange) { head, body = m.Head(iv) tail, body = body.Tail(iv) return } func (m TimeRange) Begin() time.Time { return m.b } func (m TimeRange) Split(iv Inte...
range.go
0.78609
0.578002
range.go
starcoder
package geometry import "math" // RaycastResult holds the results of the Raycast operation type RaycastResult struct { In bool // point on the left On bool // point is directly on top of } // Raycast performs the raycast operation func (seg Segment) Raycast(point Point) RaycastResult { p, a, b := point, seg.A, ...
raycast.go
0.661048
0.423637
raycast.go
starcoder
package main import ( "github.com/ByteArena/box2d" "github.com/wdevore/RangerGo/api" "github.com/wdevore/RangerGo/engine/nodes/custom" ) // FenceComponent represents both the visual and physic components type FenceComponent struct { bottom api.INode right api.INode top api.INode left api.INode b2Body ...
examples/physics/complex/hukimasu/fence_component.go
0.666822
0.413477
fence_component.go
starcoder
package types import ( "io" "github.com/lyraproj/issue/issue" "github.com/lyraproj/pcore/px" ) type InitType struct { typ px.Type initArgs *Array ctor px.Function } var InitMetaType px.ObjectType func init() { InitMetaType = newObjectType(`Pcore::Init`, `Pcore::AnyType { attributes => { type =...
types/inittype.go
0.675765
0.402568
inittype.go
starcoder
package blockchain import ( "encoding/json" "sync" "time" lru "github.com/hashicorp/golang-lru" "github.com/incognitochain/incognito-chain/dataaccessobject/rawdbv2" "github.com/incognitochain/incognito-chain/dataaccessobject/statedb" "github.com/incognitochain/incognito-chain/multiview" "github.com/incognito...
blockchain/beaconchain.go
0.605099
0.522689
beaconchain.go
starcoder
package main import ( "math" "syscall/js" "github.com/gmlewis/go-babylonjs/babylon" ) func main() { doc := js.Global().Get("document") canvas := doc.Call("getElementById", "renderCanvas") // Get the canvas element b := babylon.New() engine := b.NewEngine(canvas, &babylon.NewEngineOpts{Antialias: Bool(true)}...
examples/38-mesh-collisions/main.go
0.501953
0.408011
main.go
starcoder
package controller import ( "sync" "github.com/golang/glog" kutil "k8s.io/kubernetes/pkg/util" utilwait "k8s.io/kubernetes/pkg/util/wait" ) // Scheduler is a self-balancing, rate-limited, bucketed queue that can periodically invoke // an action on all items in a bucket before moving to the next bucket. A rateli...
vendor/github.com/openshift/origin/pkg/controller/scheduler.go
0.577734
0.40072
scheduler.go
starcoder
package hamradio import ( "fmt" "math" ) // Frequency represents a frequency in Hz. type Frequency float64 func (f Frequency) String() string { return fmt.Sprintf("%.2fHz", f) } // FrequencyRange represents a range of frequencies. type FrequencyRange struct { From, To Frequency } func (r FrequencyRange) String...
hamradio.go
0.910519
0.523968
hamradio.go
starcoder
package ipv4 import ( "fmt" "math/bits" "net" ) // Mask represents a prefix mask. It has any number of leading 1s and then the // remaining bits are 0s up to the number of bits in an address. It can be all // zeroes or all ones. // The zero value of a Mask is "/0" type Mask struct { ui uint32 } const maxUint32 ...
ipv4/mask.go
0.849628
0.496887
mask.go
starcoder
// Package example provides models and functions for parsing and building examples package example import ( "io" "io/ioutil" "os" "path/filepath" "regexp" "strings" "github.com/pkg/errors" ) var linkRegex = regexp.MustCompile(`\[.*\]\(.*\)`) // Example represents a markdown example. Contains all needed for ...
pkg/example/example.go
0.700075
0.589598
example.go
starcoder
package main import ( "flag" "fmt" "math" "math/bits" "math/rand" "strings" "time" ) var maxSampleCount = flag.Int64("max-sample-count", 10000, "Samples to keep when streaming.") type StreamingHistogram struct { Buckets [64]uint64 } func (sh *StreamingHistogram) Add(x uint64) { sh.Buckets[bits.Len64(x)] +=...
stats.go
0.617167
0.418994
stats.go
starcoder
package internal import ( "errors" "fmt" "reflect" "strings" ) // AddMetadata Adds metadata to a node. // nodes + element -> nodes func AddMetadata(structure interface{}, node *Node) error { if node == nil { return nil } if len(node.Children) == 0 { return fmt.Errorf("invalid node %s: no child", node.Name...
pkg/provider/label/internal/nodes_metadata.go
0.608478
0.429728
nodes_metadata.go
starcoder
package routerrpc import ( "time" "github.com/pkt-cash/pktd/btcutil" ) // RoutingConfig contains the configurable parameters that control routing. type RoutingConfig struct { // MinRouteProbability is the minimum required route success probability // to attempt the payment. MinRouteProbability float64 `long:"mi...
lnd/lnrpc/routerrpc/routing_config.go
0.690037
0.482246
routing_config.go
starcoder
package knn import ( "github.com/gonum/matrix/mat64" base "github.com/sjwhitworth/golearn/base" pairwiseMetrics "github.com/sjwhitworth/golearn/metrics/pairwise" util "github.com/sjwhitworth/golearn/utilities" ) // A KNNClassifier consists of a data matrix, associated labels in the same order as the matrix, and a...
knn/knn.go
0.864554
0.599925
knn.go
starcoder
package iso20022 // Parameters applied to the settlement of a security transfer. type DeliverInformation15 struct { // Date and time at which the securities are to be exchanged at the International Central Securities Depository (ICSD) or Central Securities Depository (CSD). RequestedSettlementDate *ISODate `xml:"Re...
DeliverInformation15.go
0.784732
0.503784
DeliverInformation15.go
starcoder
package decredmaterial import ( "image" "image/color" "math" "gioui.org/f32" "gioui.org/layout" "gioui.org/op" "gioui.org/op/clip" "gioui.org/op/paint" "gioui.org/unit" "github.com/planetdecred/godcr/ui/values" ) type Shadow struct { surface color.NRGBA ambientColor color.NRGBA penumbraColor color.NR...
ui/decredmaterial/shadow.go
0.76908
0.544135
shadow.go
starcoder
package processor import ( "fmt" "sync/atomic" "time" "github.com/Jeffail/benthos/v3/internal/bloblang/field" "github.com/Jeffail/benthos/v3/internal/docs" "github.com/Jeffail/benthos/v3/internal/interop" "github.com/Jeffail/benthos/v3/lib/log" "github.com/Jeffail/benthos/v3/lib/message/tracing" "github.com/...
lib/processor/sleep.go
0.708818
0.608129
sleep.go
starcoder
package gengo import ( "io" ipld "github.com/ipld/go-ipld-prime" ) type genKindedNbRejections struct { TypeIdent string // the identifier in code (sometimes is munged internals like "_Thing__Repr" corresponding to no publicly admitted schema.Type.Name). TypeProse string // as will be printed in messages (e.g. ca...
schema/gen/go/genCommonNb.go
0.564459
0.445349
genCommonNb.go
starcoder
package domain import ( "strings" "unicode" ) type hangman struct { Turns int Word string Current string Used string } // Hangman represents a single game of hangman. type Hangman struct { hangman hangman } // NewHangman creates a new instance of Hangman. func NewHangman(word string, turns int) (*Han...
pkg/domain/hangman.go
0.636805
0.446434
hangman.go
starcoder
package main //Application to scan for fundraising activities and write them to a CSV. import ( "fmt" "log" "os" "strings" "time" goengage "github.com/salsalabs/goengage/pkg" report "github.com/salsalabs/goengage/pkg/report" "gopkg.in/alecthomas/kingpin.v2" ) const ( //SeeAddressName is the supporter custom...
cmd/activity/fundraise/see/main.go
0.601359
0.405979
main.go
starcoder
package utils import "encoding/hex" // use to look up number of 1 bit in 4 bits var halfByteLookup = [16]int{0, 1, 1, 2, 1, 2, 2, 3, 1, 2, 2, 3, 2, 3, 3, 4} // FromHex returns the bytes represented by the hexadecimal string s. // s may be prefixed with "0x". func FromHex(s string) []byte { if len(s) > 1 { if s[0:...
internal/utils/bytes.go
0.753467
0.418519
bytes.go
starcoder
package gc // Transmogrify slow integer division into fast multiplication using magic. // argument passing to/from // smagic and umagic type Magic struct { W int // input for both - width S int // output for both - shift Bad int // output for both - unexpected failure // magic multiplier for signed literal ...
src/cmd/compile/internal/gc/magic.go
0.543348
0.526769
magic.go
starcoder
package source var BaseType = `{ "MetadataVersion": { "type": "enum", "value_list": [ "MetadataV0Decoder", "MetadataV1Decoder", "MetadataV2Decoder", "MetadataV3Decoder", "MetadataV4Decoder", "MetadataV5Decoder", "MetadataV6Decoder", "MetadataV7Decoder", "...
source/base.go
0.57344
0.448064
base.go
starcoder
package main import ( "bufio" "fmt" "os" "sort" ) type Point struct { X, Y int } func (p0 Point) IsEqual(p1 Point) bool { return p0.X == p1.X && p0.Y == p1.Y } func (p Point) Neighbours(gridX, gridY int) []Point { var neighbours []Point if p.Y-1 >= 0 { neighbours = append(neighbours, Point{p.X, p.Y - 1})...
2018/day15/part2/beverage.go
0.543106
0.494995
beverage.go
starcoder
package types type ChainType uint64 //ChainType enumeration order matters, do not change order or insert new enums. const ( ChainTypeUnknown = ChainType(iota) ChainTypeDC // Directory Chain ChainTypeBVC // Block Validator Chain ChainTypeAdi // Accum...
types/chain_types.go
0.534855
0.510008
chain_types.go
starcoder
package poner import ( "fmt" "sort" ) // Schell's discard tables var playerCribDiscards = [][]float32{ {5.38, 4.23, 4.52, 5.43, 5.45, 3.85, 3.85, 3.80, 3.40, 3.42, 3.65, 3.42, 3.41}, {4.23, 5.72, 7.00, 4.52, 5.45, 3.93, 3.81, 3.66, 3.71, 3.55, 3.84, 3.58, 3.52}, {4.52, 7.00, 5.94, 4.91, 5.97, 3.81, 3.58, 3.92, 3...
discard.go
0.510496
0.523542
discard.go
starcoder
Package utter implements a deep pretty printer for Go data structures to aid data snapshotting. A quick overview of the additional features utter provides over the built-in printing facilities for Go data types are as follows: * Pointers are dereferenced and followed * Circular data structures are detected and anno...
doc.go
0.796609
0.933491
doc.go
starcoder
package unityai import ( "github.com/tofuhua/unityai/format" ) type NavMeshData struct { m_NavMeshBuildSettings NavMeshBuildSettings m_NavMeshTiles []NavMeshTileData m_HeightMeshes []HeightMeshData m_OffMeshLinks []AutoOffMeshLinkData m_FilterAreaCosts []float32 m_SourceBounds ...
nav_mesh_data.go
0.647241
0.489076
nav_mesh_data.go
starcoder
package anomalia import ( "math" "math/rand" ) // Average returns the average of the input func Average(input []float64) float64 { return SumFloat64s(input) / float64(len(input)) } // SumFloat64s returns the sum of all float64 in the input func SumFloat64s(input []float64) float64 { var sum float64 for _, value...
math.go
0.890467
0.647046
math.go
starcoder
package nzproj import ( "math" ) /* The Transverse Mercator projection is a conformal cylindrical map projection in which the surface of a sphere or ellipsoid, such as the Earth, is projected onto a cylinder tangent along a meridian. */ // TransverseMercatorParams describes a Transverse Mercator projection. type ...
transverse_mercator.go
0.793786
0.635873
transverse_mercator.go
starcoder
package fields import ( "fmt" "github.com/hashicorp/go-multierror" "github.com/mitchellh/mapstructure" ) // FieldData contains the raw data and the schema that the data should adhere to type FieldData struct { Raw map[string]interface{} Schema map[string]*FieldSchema } // Validate cycles through the raw dat...
vendor/github.com/hashicorp/nomad/helper/fields/data.go
0.63443
0.449634
data.go
starcoder
package cobramodules import ( "context" "sync" "github.com/spf13/cobra" "github.com/spf13/pflag" "go.uber.org/multierr" ) // Module defines the interface used to segregate a command's subsystems. Each module is started in its own goroutine // and is expected to run until either an unrecoverable error occurs or ...
module.go
0.655887
0.439928
module.go
starcoder
package tables import ( "fmt" "go4ml.xyz/base/fu" "go4ml.xyz/base/fu/lazy" "math" "reflect" ) const epsilon = 1e-9 func equalf(vc reflect.Value) func(v reflect.Value) bool { switch vc.Kind() { case reflect.Slice: vv := []func(reflect.Value) bool{} for i := 0; i < vc.Len(); i++ { vv = append(vv, equalf(...
tables/ifxx.go
0.547464
0.427217
ifxx.go
starcoder
package game import ( "math/rand" "time" ) // Coords represents a pair of cartesian coordinates type Coords struct { X int Y int } func getRandomPiece() Tetromino { var piece Tetromino r := rand.New(rand.NewSource(time.Now().UnixNano())) switch r.Intn(6) { // random int between 0 and 6 case 0: piece = I(Co...
game/tetrominos.go
0.74872
0.518363
tetrominos.go
starcoder
package main import ( "fmt" "github.com/mbark/advent-of-code-2021/util" "strconv" "strings" ) var in = `forward 8 down 9 up 1 forward 2 down 6 forward 6 down 5 down 4 down 2 forward 3 forward 8 down 6 up 3 up 3 down 5 up 8 forward 8 up 6 forward 4 down 8 up 2 up 6 forward 7 up 6 down 6 down 1 forward 8 up 7 forwa...
day2/main.go
0.611614
0.506103
main.go
starcoder
package httpcompression import ( "fmt" "sort" ) // Prefer controls the behavior of the middleware in case both Gzip and Brotli // can be used to compress a response (i.e. in case the client supports both // encodings, and the MIME type of the response is allowed for both encodings). // See the comments on the Prefe...
prefer.go
0.607896
0.413714
prefer.go
starcoder
package assets import ( "fmt" "math/rand" "path/filepath" ) const ( smallDatasetPath = "hack/benchmark/assets/dataset" ) type smallDataset struct { *dataset train [][]float32 query [][]float32 distances [][]float32 neighbors [][]int } func loadSmallData(fileName, datasetName, distanceType, objectTy...
pkg/tools/cli/loadtest/assets/small_dataset.go
0.646349
0.421016
small_dataset.go
starcoder
package assert import ( "math" "reflect" "runtime" "testing" ) // Close asserts that the distance between two scalars or the uniform distance // between two vectors is less than the given value. func Close(actual, expected interface{}, ε interface{}, t *testing.T) { typo := reflect.TypeOf(actual) if typo != ref...
main.go
0.682045
0.659193
main.go
starcoder
package boids import ( "math" "math/rand" "time" ) type Boid struct { position vector2D velocity vector2D id int } func (b *Boid) createAcceleration() vector2D { rWLock.RLock() avgVelocity, avgPosition, seperation := vector2D{x: 0, y: 0}, vector2D{x: 0, y: 0}, vector2D{x: 0, y: 0} count := 0.0 lower,...
boids/boid.go
0.636127
0.524212
boid.go
starcoder
package twofourtree import ( "github.com/emirpasic/gods/trees" "github.com/emirpasic/gods/utils" ) func assertTreeImplementation() { var _ trees.Tree = new(Tree) } // Tree holds elements of the two-four tree. type Tree struct { root *Node Comparator utils.Comparator } // Node is a single element within t...
trees/twofourtree/twofourtree.go
0.53777
0.479686
twofourtree.go
starcoder
package nifi import ( "encoding/json" ) // BannerEntity struct for BannerEntity type BannerEntity struct { Banners *BannerDTO `json:"banners,omitempty"` } // NewBannerEntity instantiates a new BannerEntity object // This constructor will assign default values to properties that have it defined, // and makes sure ...
model_banner_entity.go
0.751101
0.40204
model_banner_entity.go
starcoder
package awsemfexporter import ( "time" "go.opentelemetry.io/collector/consumer/pdata" "go.opentelemetry.io/otel/label" "go.uber.org/zap" "github.com/open-telemetry/opentelemetry-collector-contrib/exporter/awsemfexporter/mapwithexpiry" ) const ( cleanInterval = 5 * time.Minute minTimeDiff = 50 * time.Milli...
exporter/awsemfexporter/datapoint.go
0.705886
0.647116
datapoint.go
starcoder
package goPigeon import ( "fmt" "strings" ) // returns true if rune is a letter of the English alphabet func isAlpha(r rune) bool { return (r >= 65 && r <= 90) || (r >= 97 && r <= 122) } // returns true if rune is a numeral func isNumeral(r rune) bool { return (r >= 48 && r <= 57) } // assumes the string ends w...
goPigeon/parser.go
0.580352
0.487551
parser.go
starcoder
package sorts import ( "math" "strconv" utils "./utils" ) func countingSort(array *[]int, exp int) { count := make([]int, utils.Max(*array)+1) for i := 0; i < len(*array); i++ { //iterate through given array, and add 1 to the index which is the value of array[i] count[digit((*array)[i], exp)]++ } for i :=...
golang/radixSort.go
0.512449
0.464659
radixSort.go
starcoder
package evaluator import ( "RenG/lang/ast" "RenG/lang/object" "fmt" "strconv" ) func Eval(node ast.Node, env *object.Environment) object.Object { switch node := node.(type) { case *ast.Program: return evalProgram(node, env) /*-------Statement-------*/ case *ast.ExpressionStatement: return Eval(node.Expres...
reng-core/lang/evaluator/eval.go
0.600423
0.415077
eval.go
starcoder
package main import ( "fmt" "log" "strconv" "strings" "time" ) /** --- Day 7: Handy Haversacks --- You land at the regional airport in time for your next flight. In fact, it looks like you'll even have time to grab some food: all flights are currently delayed due to issues in luggage processing. Due to recent ...
day07.go
0.621426
0.535341
day07.go
starcoder
package isa import "fmt" // Error messages const ( errEffectNotDeclared = "effect not declared for opcode: %s" ) // Effect captures how an instruction affects the stack and PC type Effect struct { Size int // Fixed size of the encoded Instruction Pop int // Fixed number of items to be popped from the stack...
runtime/isa/effect.go
0.577019
0.477311
effect.go
starcoder
package client // PodSpec is a description of a pod. type V1PodSpec struct { // Optional duration in seconds the pod may be active on the node relative to StartTime before the system will actively try to mark it failed and kill associated containers. Value must be a positive integer. ActiveDeadlineSeconds int64 `js...
vendor/github.com/kubernetes-client/go/kubernetes/client/v1_pod_spec.go
0.894838
0.422683
v1_pod_spec.go
starcoder
package main import ( "image/color" "github.com/go-gl/gl/v4.2-core/gl" "github.com/hexaflex/wireworld-gpu/math" ) // Zoom limits for the simulation display. const ( MinZoom = 1 MaxZoom = 100 DefaultZoom = 5 ) // SimulationDisplay is a textured quad that renders the current state of // a simulation usi...
simulationdisplay.go
0.719285
0.502747
simulationdisplay.go
starcoder
package buffer import ( "errors" "io" ) // ReadWriteBuffer is a simple type that implements io.WriterAt on an in-memory buffer. // The zero value of this type is an empty buffer ready to use. type ReadWriteBuffer struct { d []byte i int64 // current reading index m int } // NewReadWriteBuffer creates and return...
internal/buffer/buffer.go
0.665737
0.409339
buffer.go
starcoder
package math import ( "github.com/bitflow-stream/go-bitflow/bitflow" "github.com/bitflow-stream/go-bitflow/script/reg" "github.com/bitflow-stream/go-bitflow/steps" ) type MinMaxScaling struct { Min float64 Max float64 } func RegisterMinMaxScaling(b reg.ProcessorRegistry) { b.RegisterBatchStep("scale_min_max", ...
steps/math/scaling.go
0.807764
0.412708
scaling.go
starcoder
package main type Node struct { Value int Prev, Next *Node } type DoublyLinkedList struct { Head, Tail *Node } func NewDoublyLinkedList() *DoublyLinkedList { return &DoublyLinkedList{} } // O(1) time | O(1) space func (ll *DoublyLinkedList) SetHead(node *Node) { if ll.Head == nil { ll.Head = node ll.T...
src/linked-lists/medium/doubly-linked-list/go/doubly-linked-list.go
0.525369
0.412471
doubly-linked-list.go
starcoder
package board // Adds the round's orders to the board, and resolves them. // Returns a list of any potential battles from the round. func (board Board) Resolve(round Round) (battles []Battle, winner Player) { battles = make([]Battle, 0) switch round.Season { case SeasonWinter: board.resolveWinter(round.FirstOrde...
game/board/resolve_board.go
0.83193
0.524943
resolve_board.go
starcoder
package ease import "math" var ( pow = math.Pow sqrt = math.Sqrt sin = math.Sin cos = math.Cos ) const ( pi = math.Pi // http: //void.heteml.jp/blog/archives/2014/05/easing_magicnumber.html c1 = 1.70158 c2 = c1 * 1.525 c3 = c1 + 1 c4 = (2 * pi) / 3 c5 = (2 * pi) / 4.5 ) type Func func(x float64) float...
ease/ease.go
0.631481
0.588416
ease.go
starcoder
package mat import ( "fmt" "strings" ) // New returns a new zero-valued matrix of given dimensions. Use Apply() to // fill the matrix with values. func New(rows, cols int) Matrix { return Matrix{ rows: rows, cols: cols, vals: make([]float64, rows*cols, rows*cols), } } // From creates a matrix of given dime...
pkg/mat/matrix.go
0.875495
0.787646
matrix.go
starcoder
package metrics // Field represents a giving map of values associated with a giving field value. type Field map[string]interface{} // GetBool collects the string value of a key if it exists. func (p Field) GetBool(key string) (bool, bool) { val, found := p.Get(key) if !found { return false, false } value, ok :...
vendor/github.com/influx6/faux/metrics/field.go
0.784402
0.437824
field.go
starcoder
package main import ( "fmt" "os" "strconv" "strings" "github.com/TomasCruz/projecteuler" ) /* Problem 59; XOR decryption Each character on a computer is assigned a unique code and the preferred standard is ASCII (American Standard Code for Information Interchange). For example, uppercase A = 65, asterisk (*) =...
001-100/051-060/059/main.go
0.624408
0.423279
main.go
starcoder
package main import ( "image" "image/png" "io" "log" "math" "os" ) // Pixel represents single pixel ad (R, G, B) data set type Pixel struct { R int G int B int } // Point is just Pixel RGB data + coordinates type Point struct { px Pixel x int y int } // RadarImage is go representation of jpeg image pl...
image-processing.go
0.700895
0.438304
image-processing.go
starcoder
package week1 type MyCircularDeque struct { cap int data []int front int rear int } func Constructor(k int) MyCircularDeque { return MyCircularDeque{ cap: k, data: make([]int,k), front: -1, rear: 0, } } func (this *MyCircularDeque) InsertFront(value int) bool ...
week1/homework/3.design-circular-deque.go
0.590897
0.523116
3.design-circular-deque.go
starcoder
package translatedassert func OpSUB_uint(x uint, y uint) uint { return x - y } func OpSUB_uint8(x uint8, y uint8) uint8 { return x - y } func OpSUB_uint16(x uint16, y uint16) uint16 { return x - y } func OpSUB_uint32(x uint32, y uint32) uint32 { return x - y } func OpSUB_uint64(x uint64, y uint64) uint64 { re...
translatedassert/op.go
0.789761
0.701426
op.go
starcoder
package main import ( "fmt" "image" "image/color" "math" "math/rand" "os" "time" "github.com/llgcode/draw2d/draw2dimg" "github.com/llgcode/draw2d/draw2dkit" ) // set constants ('E' is a math const; remove '/rand' on import when using) const ( SQUAREROOTOFNODES = 10 NUMINPUTNODES = SQUAREROOTOFNODES * ...
drawnn.go
0.581184
0.496216
drawnn.go
starcoder
package graphics import ( "image/color" ) // Geometries const ( // Circ is 360 degrees Circ = float32(360.0) // FrameSize is the number of pixels in one frame. FrameSize = 24 // PixelWidth is the width in degrees of one pixel. PixelWidth = Circ / float32(FrameSize) ) // Colors var ( Black = color.RGBA{} W...
graphics/graphics.go
0.656218
0.571348
graphics.go
starcoder