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 xtrace provides the ability to generate a trace of wrapped errors from xerrors. This is facilitated through the Tracer type, the output of which can be customized with a TraceFormatter. For more information on how to wrap errors, see https://godoc.org/golang.org/x/xerrors. Basic Usage The following example wi...
doc.go
0.613815
0.459804
doc.go
starcoder
package diff import ( "image" "math" "go.skia.org/infra/go/metrics2" ) const ( CombinedMetric = "combined" PercentMetric = "percent" PixelMetric = "pixel" ) // MetricFn is the signature a custom diff metric has to implement. type MetricFn func(*DiffMetrics, *image.NRGBA, *image.NRGBA) float32 // metrics ...
golden/go/diff/metrics.go
0.780495
0.419351
metrics.go
starcoder
package trial import ( "fmt" "reflect" "strconv" ) // Input the input value given to the trial test function type Input struct { value reflect.Value } func newInput(i interface{}) Input { return Input{value: reflect.ValueOf(i)} } // String value of input, panics on on non string value func (in Input) String() ...
input.go
0.587588
0.509398
input.go
starcoder
package matrix import "math/rand" /* A sparse matrix based on go's map datastructure. */ type SparseMatrix struct { matrix elements map[int]float64 // offset to start of matrix s.t. idx = i*cols + j + offset // offset = starting row * step + starting col offset int // analogous to dense step step int } func ...
sparse.go
0.690559
0.551453
sparse.go
starcoder
package cronzilla import ( "context" "sync" "time" ) // Wrangler is a goro-safe aggregator for Tasks type Wrangler struct { tasks sync.Map } type wrangledTask struct { task *Task errorChan chan error cancelfunc context.CancelFunc } // List will return a string array of Task names func (w *Wrangler) Li...
wrangler.go
0.526343
0.414306
wrangler.go
starcoder
package query import "github.com/google/gapid/test/robot/search" // Builder is the type used to allow fluent construction of search queries. type Builder struct { e *search.Expression } // Expression creates a builder from a search expression. func Expression(e *search.Expression) Builder { return Builder{e: e} }...
test/robot/search/query/builder.go
0.911906
0.714342
builder.go
starcoder
package queue import "time" // References is a dictionary of additinal SQL columns to set. // Normally this dictionary contains referencies to other entities // e.g. datasource_id, table_id, schedule_id, etc. // So, the SQL table can have the `DELETE CASCADE` setting. type References map[string]interface{} // GetNam...
pkg/queue/task.go
0.697712
0.42937
task.go
starcoder
package ols import ( "github.com/gonum/floats" "github.com/gonum/matrix/mat64" ) // Model handles the regression type Model struct { x *mat64.Dense y *mat64.Vector // one dimentional hasIntercept bool cols int rows int } // NewModel creates a new model with an intercept b...
ols.go
0.786254
0.541348
ols.go
starcoder
package graph import ( hash "github.com/wednesday-solutions/golang-algorithm-club/pkg/datastructures/hashtable" queue "github.com/wednesday-solutions/golang-algorithm-club/pkg/datastructures/queue" ) /* Using Adjacency list (Object oriented model) - https://en.wikipedia.org/wiki/Adjacency_list */ type ( // Gra...
pkg/datastructures/graph/main.go
0.789964
0.529142
main.go
starcoder
package csv import ( beerproto "github.com/beerproto/beerproto_go" ) func toTemperature(value *float64) *beerproto.TemperatureType { if value == nil { return &beerproto.TemperatureType{ Unit: beerproto.TemperatureUnitType_C, } } return &beerproto.TemperatureType{ Unit: beerproto.TemperatureUnitType_C,...
.github/actions/csvbeer/src/csv/units.go
0.806548
0.567757
units.go
starcoder
package lazyledger import ( "bytes" "crypto/sha256" "crypto/rand" "math" "math/big" "gitlab.com/NebulousLabs/merkletree" "github.com/musalbas/rsmt2d" ) // ProbabilisticBlock represents a block designed for the Probabilistic Validity Rule. type ProbabilisticBlock struct { prevHash []by...
probabilisticblock.go
0.768473
0.406243
probabilisticblock.go
starcoder
package wave import ( "encoding/binary" "fmt" "io" ) // Writer creates a writer for wave files encapsulating an io.Writer. // It supports 8, 16 and 32 bit integer and 32 bit float formats. type Writer struct { W io.Writer H Header ctr int numSamples int } // NewWriter creates a wave w...
writer.go
0.783077
0.405302
writer.go
starcoder
package slice // MapString func // Returns a new slice containing the results from applying the func to each element in the slice. func MapString(input []string, f func(string) string) []string { inputMap := make([]string, len(input)) for i, value := range input { inputMap[i] = f(value) } retu...
slice/map.go
0.920638
0.587499
map.go
starcoder
package edge import ( "fmt" "strconv" "strings" "github.com/emicklei/dot" ) // Attribute is a function that apply a property to an edge. type Attribute func(*dot.Edge) // Label is the edge caption. If 'htm' is true the // caption is treated as HTML code. func Label(num int, text string) Attribute { return func...
pkg/edge/edge.go
0.774071
0.460168
edge.go
starcoder
package bitmap var ( tA = [8]byte{1, 2, 4, 8, 16, 32, 64, 128} tB = [8]byte{254, 253, 251, 247, 239, 223, 191, 127} ) func dataOrCopy(d []byte, c bool) []byte { if !c { return d } ndata := make([]byte, len(d)) copy(ndata, d) return ndata } // NewSlice creates a new byteslice with length l (in bits). // The...
internal/bitmap/bitmap.go
0.774498
0.42662
bitmap.go
starcoder
package e2e import ( "math" io_prometheus_client "github.com/prometheus/client_model/go" ) func getValue(m *io_prometheus_client.Metric) float64 { if m.GetGauge() != nil { return m.GetGauge().GetValue() } else if m.GetCounter() != nil { return m.GetCounter().GetValue() } else if m.GetHistogram() != nil { ...
integration/e2e/metrics.go
0.770551
0.567487
metrics.go
starcoder
package hdrcolor // XyzToLms converts from CIE XYZ-space to LMS-space (using D65-LMS matrix). func XyzToLms(x, y, z float64) (l, m, s float64) { l = 0.4002*x + 0.7075*y - 0.0807*z m = -0.228*x + 1.1500*y + 0.0612*z s = 0.0000*x + 0.0000*y + 0.9184*z return } // LmsToXyz converts from LMS-space (using D65-LMS matr...
hdrcolor/converter.go
0.740268
0.643287
converter.go
starcoder
package gotorch // #cgo CFLAGS: -I ${SRCDIR}/cgotorch // #cgo LDFLAGS: -L ${SRCDIR}/cgotorch -Wl,-rpath ${SRCDIR}/cgotorch -lcgotorch // #cgo LDFLAGS: -L ${SRCDIR}/cgotorch/libtorch/lib -Wl,-rpath ${SRCDIR}/cgotorch/libtorch/lib -lc10 -ltorch -ltorch_cpu // #include "cgotorch.h" import "C" import ( "unsafe" ) // Ad...
tensor_ops.go
0.796134
0.440349
tensor_ops.go
starcoder
package binary import "encoding/binary" // Byte is the byte implementation of Component. var Byte byteComponent // Ubyte is the usnigned byte implementation of Component. var Ubyte ubyteComponent // Short is the byte short of Component. var Short shortComponent // Ushort is the usnigned short implementation of Com...
binary/binary.go
0.691289
0.431225
binary.go
starcoder
package accessors import ( "encoding/json" "fmt" "log" "math" "math/rand" "strconv" "time" "github.com/kellydunn/golang-geo" ) const nearbyEnemyCap = 300 // Returns an array of all loot locations and values to plot on the map in iOS func (ag *AccessorGroup) DumpDatabase(userLatitude float64, userLongitude f...
accessors/database.go
0.583559
0.441673
database.go
starcoder
package testh import ( "reflect" "testing" ) func AssertEqual(msg string, expected, got interface{}, t *testing.T) { if expected != got { t.Errorf("%s. Expected value: %v, Got: %v", msg, expected, got) t.FailNow() } } func AssertNotNil(msg string, v interface{}, t *testing.T) { if v == nil { t.Errorf("%s....
testh/assert.go
0.592431
0.479808
assert.go
starcoder
package genworldvoronoi import ( "math" "math/rand" "github.com/Flokey82/go_gens/vectors" opensimplex "github.com/ojrac/opensimplex-go" ) // ugh globals, sorry type Map struct { BaseObject t_flow []float64 // Triangle flow intensity (rainfall) t_downflow_s []int // Triangle mapping to ...
genworldvoronoi/genworldvoronoi.go
0.521959
0.481149
genworldvoronoi.go
starcoder
package fps import ( "math" "github.com/go-gl/glfw/v3.2/glfw" "github.com/go-gl/mathgl/mgl32" ) // FPS moves in the view direction while the viewing direction can be changed. type FPS struct { width int height int theta float32 phi float32 dir mgl32.Vec3 speed float32 Pos mgl32.Vec3 Target mg...
pkg/scene/camera/fps/fps.go
0.927773
0.690729
fps.go
starcoder
package man var apispecPage = ` # === apispec === # Description Upload traces to the Akita Cloud or use traces already stored on Akita Cloud to generate your OpenAPI3 specification. # Examples ## akita apispec --service my-service --traces ./mytrace.har Generates a spec from a local trace file and outputs it to s...
cmd/internal/man/apispec_page.go
0.849254
0.428114
apispec_page.go
starcoder
package planner import ( "sort" "github.com/open-policy-agent/opa/ast" ) // funcstack implements a simple map structure used to keep track of virtual // document => planned function names. The structure supports Push and Pop // operations so that the planner can shadow planned functions when 'with' // statements a...
vendor/github.com/open-policy-agent/opa/internal/planner/rules.go
0.564819
0.619299
rules.go
starcoder
package xprocess_schema import ( "reflect" "strconv" ) type Converter func(string) reflect.Value var ( invalidValue = reflect.Value{} boolType = reflect.Bool float32Type = reflect.Float32 float64Type = reflect.Float64 intType = reflect.Int int8Type = reflect.Int8 int16Type = reflect.Int16...
xprocess_schema/converter.go
0.613931
0.427875
converter.go
starcoder
package ast // ParseNode represents a function to parse ast nodes. type ParseNode func(p *Parser) (*Node, error) // Node is a simple node in a tree with double linked lists instead of slices to // keep track of its siblings and children. A node is either a value or a // parent node. type Node struct { // Type of the...
ast/node.go
0.780746
0.590573
node.go
starcoder
package should import "github.com/smartystreets/assertions" var ( Equal = assertions.ShouldEqual NotEqual = assertions.ShouldNotEqual AlmostEqual = assertions.ShouldAlmostEqual NotAlmostEqual = assertions.ShouldNotAlmostEqual Resemble = assertions.ShouldResemble NotResemble = assertio...
vendor/github.com/smartystreets/assertions/should/should.go
0.649579
0.605187
should.go
starcoder
package main import ( "math" "github.com/unixpickle/model3d/model2d" "github.com/unixpickle/model3d/model3d" ) func BoardSolid(a *Args, digits []Digit, size int) model3d.Solid { segments := map[Segment]bool{} for x := 0; x <= size; x++ { for y := 0; y <= size; y++ { l := Location{y, x} if x < size { ...
examples/toys/number_puzzle/solid.go
0.649801
0.464112
solid.go
starcoder
package schema const ModelSchema = `{ "$id": "docs/spec/spans/span.json", "type": "object", "description": "An event captured by an agent occurring in a monitored service", "allOf": [ { "$id": "doc/spec/timestamp_epoch.json", "title": "Timestamp Epoch", "description": "Object with ...
model/span/generated/schema/span.go
0.85289
0.595316
span.go
starcoder
package when import ( "time" ) func abs(v time.Duration) time.Duration { if v < 0 { v *= -1 } return v } // Timedelta represents a duration between two dates. // All fields are optional and default to 0. You can initialize any type of timedelta by specifying field values which you want to use. type Timedelta s...
vendor/github.com/zoumo/logdog/pkg/when/timedelta.go
0.823719
0.490785
timedelta.go
starcoder
package proofs import ( "fmt" "sort" ics23 "github.com/confio/ics23/go" sdkmaps "github.com/KiraCore/cosmos-sdk/store/rootmulti/internal/maps" ) // TendermintSpec constrains the format from ics23-tendermint (crypto/merkle SimpleProof) var TendermintSpec = &ics23.ProofSpec{ LeafSpec: &ics23.LeafOp{ Prefix: ...
store/rootmulti/internal/proofs/create.go
0.582016
0.407982
create.go
starcoder
package bls381 import ( "math/bits" ) // GT target group of the pairing type GT = e12 type lineEvaluation struct { r0 e2 r1 e2 r2 e2 } // FinalExponentiation computes the final expo x**(p**6-1)(p**2+1)(p**4 - p**2 +1)/r func FinalExponentiation(z *GT, _z ...*GT) GT { var result GT result.Set(z) for _, e :...
bls381/pairing.go
0.718397
0.446796
pairing.go
starcoder
package main import ( "fmt" "os" "path/filepath" "io/ioutil" "strings" "math" "regexp" ) // Iterates through every seat in dataString to apply the appropriate rules based on the number of occupied seats returned by countFirstOccupied. Returns the new seat data as a single string, and boolean indicating whether...
day11/part2/part2.go
0.616128
0.404155
part2.go
starcoder
package trees import ( "errors" "fmt" "math" "sort" "strconv" "strings" "github.com/sjwhitworth/golearn/base" ) const ( MAE string = "mae" MSE string = "mse" ) // RNode - Node struct for Decision Tree Regressor // It holds the information for each split // Which feature to use, threshold, left prediction a...
trees/cart_regressor.go
0.768429
0.586049
cart_regressor.go
starcoder
package e2e import ( "math" io_prometheus_client "github.com/prometheus/client_model/go" ) func getMetricValue(m *io_prometheus_client.Metric) float64 { if m.GetGauge() != nil { return m.GetGauge().GetValue() } else if m.GetCounter() != nil { return m.GetCounter().GetValue() } else if m.GetHistogram() != ni...
integration/e2e/metrics.go
0.710025
0.511534
metrics.go
starcoder
package main import ( "container/heap" "math" ) /* You are given an array points representing integer coordinates of some points on a 2D-plane, where points[i] = [xi, yi]. The cost of connecting two points [xi, yi] and [xj, yj] is the manhattan distance between them: |xi - xj| + |yi - yj|, where |val| denotes the ...
golang/algorithms/others/min_cost_to_connect_all_points/main.go
0.812272
0.555375
main.go
starcoder
package weather_data import ( "github.com/AlexanderFadeev/ood/lab2/signal" ) type Setter interface { SetTemperature(float64) SetPressure(float64) SetHumidity(float64) SetValues(temperature, pressure, humidity float64) } type SetterPro interface { Setter SetWind(speed, direction float64) SetValuesPro(temperat...
lab2/weather_data/weather_data.go
0.814274
0.459379
weather_data.go
starcoder
package condition import ( "bytes" "errors" "fmt" "regexp" "github.com/Jeffail/benthos/lib/log" "github.com/Jeffail/benthos/lib/metrics" "github.com/Jeffail/benthos/lib/types" ) //------------------------------------------------------------------------------ func init() { Constructors[TypeText] = TypeSpec{...
lib/processor/condition/text.go
0.757705
0.482246
text.go
starcoder
package paunch import ( "math" ) // Collider is an object that represents a shape that can be tested for // collision against another Collider. type Collider interface { onPoint(*point) bool onBounding(*bounding) bool onLine(*line) bool onPolygon(*polygon) bool // Move moves the Collider object the specified d...
collider.go
0.817101
0.704478
collider.go
starcoder
package p1865 type FindSumPairs struct { nums1 []int nums2 []int root *Node } func Constructor(nums1 []int, nums2 []int) FindSumPairs { var root *Node for _, num := range nums2 { root = Insert(root, num) } return FindSumPairs{nums1, nums2, root} } func (this *FindSumPairs) Add(index int, val int) { this...
src/leetcode/set1000/set1000/set1800/set1860/p1865/solution.go
0.543106
0.559049
solution.go
starcoder
package accounting import ( "encoding/json" ) // ExchangeRateResponse A response to the request for an exchange rate value. It represents the exchange rate from the source currency to the target currency. type ExchangeRateResponse struct { // Designates if the response is a success ('OK') or failure ('ERR'). Resu...
generated/accounting/model_exchange_rate_response.go
0.855444
0.484502
model_exchange_rate_response.go
starcoder
package vesper import ( "strings" ) // IsArray returns true if the object is an array func IsArray(obj *Object) bool { return obj.Type == ArrayType } // ArrayEqual - return true of the two arrays are equal, // i.e. the same length and all the elements are also equal func ArrayEqual(v1 *Object, v2 *Object) bool { ...
array.go
0.712632
0.46563
array.go
starcoder
package stl import ( "fmt" "math" gl "github.com/fogleman/fauxgl" pb "github.com/gmlewis/stldice/v4/stl2svx/proto" ) // STL represents a converted STL file to a mesh. type STL struct { // MBB is the minimum bounding box for the entire STL file. MBB gl.Box // Mesh is the mesh of triangles. Mesh *gl.Mesh // T...
stl2svx/stl/stl.go
0.744842
0.422266
stl.go
starcoder
package query import ( "context" "errors" "fmt" "sort" "strconv" "strings" "time" "github.com/Peripli/service-manager/pkg/query/parser" "github.com/antlr/antlr4/runtime/Go/antlr" "github.com/Peripli/service-manager/pkg/util" ) const ( // Separator is the separator between queries of different type Separ...
pkg/query/selection.go
0.767254
0.404037
selection.go
starcoder
Package g711 implements encoding and decoding of G711 PCM sound data. G.711 is an ITU-T standard for audio companding. For usage details please see the code snippets in the cmd folder. */ package g711 import ( "errors" "io" ) const ( // Input and output formats Alaw = iota // Alaw G711 encoded PCM data Ulaw ...
g711.go
0.683631
0.645288
g711.go
starcoder
package dsp import "math" // NCO is a Numeric Controlled Oscillator // Based on GNURadio Implementation type NCO struct { phase float32 phaseIncrement float32 } func MakeNCO() *NCO { return &NCO{ phase: 0, phaseIncrement: 0, } } // SetPhase in Radians func (nco *NCO) SetPhase(angle float32...
dsp/nco.go
0.874654
0.441312
nco.go
starcoder
package assert import ( "fmt" "path/filepath" "reflect" "regexp" "runtime" "testing" "time" ) // True asserts that the given value is a boolean true func True(t *testing.T, actual interface{}) { if actual != true { Failf(t, "Expected: true\nReceived: %v", actual) } } // Eq asserts the values are equal. Us...
test/assert/assert.go
0.655667
0.504089
assert.go
starcoder
package codegen import "github.com/pulumi/pulumi/pkg/v3/codegen/schema" func visitTypeClosure(t schema.Type, visitor func(t schema.Type), seen Set) { if seen.Has(t) { return } seen.Add(t) visitor(t) switch st := t.(type) { case *schema.ArrayType: visitTypeClosure(st.ElementType, visitor, seen) case *sche...
pkg/codegen/utilities_types.go
0.638835
0.447279
utilities_types.go
starcoder
package tf import ( "bytes" "encoding/binary" "io" "reflect" "sort" "github.com/pkg/errors" tensorflow "github.com/tensorflow/tensorflow/tensorflow/go" ) func nDTensorType(t reflect.Type, n int) reflect.Type { for i := 0; i < n; i++ { t = reflect.SliceOf(t) } return t } func nDimensionalTensor(t reflect...
tf/tensor.go
0.714628
0.416856
tensor.go
starcoder
package en import "github.com/rannoch/cldr" var currencies = []cldr.Currency{ {Currency: "ADP", DisplayName: "Andorran Peseta", Symbol: ""}, {Currency: "AED", DisplayName: "United Arab Emirates Dirham", Symbol: ""}, {Currency: "AFA", DisplayName: "Afghan Afghani (1927–2002)", Symbol: ""}, {Currency: "AFN", Displa...
resources/locales/en/currency.go
0.522202
0.458167
currency.go
starcoder
package missing_waf import ( "github.com/threagile/threagile/model" ) func Category() model.RiskCategory { return model.RiskCategory{ Id: "missing-waf", Title: "Missing Web Application Firewall (WAF)", Description: "Para ter uma primeira linha de defesa de filtragem, as arquiteturas de segurança com serviç...
risks/built-in/missing-waf/missing-waf-rule.go
0.522689
0.438064
missing-waf-rule.go
starcoder
package latlong import ( "bytes" "errors" "fmt" "math" "unicode" geohash "github.com/TomiHiltunen/geohash-golang" "github.com/golang/geo/s2" ) // Rect is rectangle of latlng. type Rect struct { s2.Rect } // MarshalJSON is a marshaler for JSON. func (rect *Rect) MarshalJSON() (bb []byte, e error) { type Lat...
Rect.go
0.745213
0.629461
Rect.go
starcoder
package aiplatform import ( context "context" cmpopts "github.com/google/go-cmp/cmp/cmpopts" codes "google.golang.org/grpc/codes" status "google.golang.org/grpc/status" protocmp "google.golang.org/protobuf/testing/protocmp" assert "gotest.tools/v3/assert" strings "strings" testing "testing" time "time" ) ty...
proto/gen/googleapis/cloud/aiplatform/v1/pipeline_service_aiptest.pb.go
0.606149
0.47591
pipeline_service_aiptest.pb.go
starcoder
package fakebackend import "github.com/go-latex/latex/font" func init() { kernsDb = dbKerns{ kernKey{font: font.Font{Name: "default", Size: 10, Type: "regular"}, s1: "A", s2: "V"}: 0, kernKey{font: font.Font{Name: "default", Size: 10, Type: "regular"}, s1: "V", s2: "A"}: 0, kernKey{font: f...
internal/fakebackend/fakebackend_kerns_gen.go
0.51879
0.592313
fakebackend_kerns_gen.go
starcoder
package rel import ( "math" "reflect" ) func indirect(rv reflect.Value) interface{} { if rv.Kind() == reflect.Ptr { if rv.IsNil() { return nil } rv = rv.Elem() } return rv.Interface() } func must(err error) { if err != nil { panic(err) } } type isZeroer interface { IsZero() bool } // isZero sh...
util.go
0.519765
0.450299
util.go
starcoder
package nn import ( mat "github.com/nlpodyssey/spago/pkg/mat32" "github.com/nlpodyssey/spago/pkg/ml/ag" ) // Affine performs an affine transformation over an arbitrary (odd) number of nodes held in the input. // The first node is the “bias”, which is added to the output as-is. // The remaining nodes of the form "W...
pkg/ml/nn/transforms.go
0.717408
0.575707
transforms.go
starcoder
package storetestcases import ( "context" "fmt" "testing" "github.com/stratumn/go-chainscript" "github.com/stratumn/go-chainscript/chainscripttest" "github.com/stratumn/go-core/postgresstore" "github.com/stratumn/go-core/store" "github.com/stratumn/go-core/types" "github.com/stretchr/testify/assert" "githu...
store/storetestcases/batch.go
0.546254
0.534734
batch.go
starcoder
package main import ( "fmt" "io" "os" "strconv" "strings" "time" // Local package "github.com/caltechlibrary/cli" "github.com/caltechlibrary/datatools" "github.com/caltechlibrary/datatools/reldate" ) var ( description = ` %s is a small command line utility which returns the relative date in YYYY-MM-DD for...
plugins/data/transform/datatools/cmd/reldate/reldate.go
0.521227
0.445469
reldate.go
starcoder
package display import ( "fmt" "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 re...
internal/cops/display/cursor.go
0.71889
0.521045
cursor.go
starcoder
package imageutil import ( "image" "image/color" ) func RowAverageGray16(radius int, img Channel) *image.Gray16 { bounds := img.Bounds() resultBounds := image.Rect(bounds.Min.X-radius+1, bounds.Min.Y, bounds.Max.X, bounds.Max.Y) resultImg := image.NewGray16(resultBounds) QuickRowsRP( RowsRP(1, func(rect imag...
average.go
0.800458
0.526586
average.go
starcoder
package doboz const ( HASH_TABLE_SIZE = 1 << 20 CHILD_COUNT = DICTIONARY_SIZE * 2 INVALID_POSITION = -1 REBASE_THRESHOLD = (MaxInt - DICTIONARY_SIZE + 1) / DICTIONARY_SIZE * DICTIONARY_SIZE // must be a multiple of DICTIONARY_SIZE! ) type Dictionary struct { // Buffer buffer []byte // point...
dictionary.go
0.807461
0.531878
dictionary.go
starcoder
package math3d // Matrix represents a 4x4 matrix type Matrix struct { a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p float64 } // MultiplyPoint returns point multiplied by the matrix func (mat *Matrix) MultiplyPoint(point *Vector3) *Vector3 { x := mat.a*point.X + mat.b*point.Y + mat.c*point.Z + mat.d y := mat.e...
math3d/matrix.go
0.839208
0.78403
matrix.go
starcoder
package interpreter import ( "strconv" "errors" "fmt" ) type Node struct { Keyword string ID int Parameter []IParameter NextNode, PreviousNode INode Trace string Scope *Scope } type INode interface { Execute(state *XiiState) error Previous() INode Next() INode Init...
interpreter/nodes.go
0.623835
0.445409
nodes.go
starcoder
package main import ( "math" "math/rand" ) type vec3 struct { x float64 y float64 z float64 } func (a *vec3) Neg() *vec3 { return &vec3{-a.x, -a.y, -a.z} } func (a *vec3) AddAssign(b *vec3) { a.x += b.x a.y += b.y a.z += b.z } func (a *vec3) SubAssign(b *vec3) { a.x -= b.x a.y -= b.y a.z -= b.z } func...
vec3.go
0.868367
0.493775
vec3.go
starcoder
package chainutils import ( "fmt" "github.com/Rjected/lit/coinparam" ) // GetParamFromName gets coin params from a name func GetParamFromName(name string) (coinType *coinparam.Params, err error) { // create map for that O(1) access coinMap := map[string]*coinparam.Params{ coinparam.BitcoinParams.Name: &coinpa...
chainutils/coins.go
0.572484
0.437523
coins.go
starcoder
package matpi import ( "fmt" "image" "image/color" "image/png" "math" "os" "github.com/Konstantin8105/errors" "gonum.org/v1/gonum/mat" ) func isEqual(c1, c2 color.RGBA) bool { return c1.R == c2.R && c1.G == c2.G && c1.B == c2.B && c1.A == c2.A } // Config is configuration of matrix picture type Config str...
matpi.go
0.685529
0.406185
matpi.go
starcoder
package publish import ( "math" "time" "bk-bscp/cmd/bscp-connserver/modules/session" ) const ( // step count. stepCount = 100 // wait time between steps. stepWait = 600 * time.Millisecond // min unit size of step. minStepUnitSize = 50 ) // RateController is publishing rate controller define. type RateCon...
bmsf-configuration/cmd/bscp-connserver/modules/publish/ratecontroller.go
0.685423
0.430866
ratecontroller.go
starcoder
package rock_garden import ( "github.com/golang/geo/r2" "github.com/golang/geo/r3" "image" "image/color" "math" ) type Light struct { Pos r3.Vector Color float64 } type Scene struct { Interval float64 Lights []Light } func New(interval float64) *Scene { return &Scene{ Interval: interval, Lights: [...
scenes/rock_garden/scene.go
0.653901
0.671666
scene.go
starcoder
package yelp import ( "fmt" "github.com/guregu/null" ) // GeneralOptions includes a set of standard query options for using the search API. // They are used along with a location based option to complete a search. type GeneralOptions struct { Term string // Search term (e.g. "food", "rest...
vendor/github.com/JustinBeckwith/go-yelp/yelp/general_options.go
0.681939
0.460107
general_options.go
starcoder
package gopacket // LayerClass is a set of LayerTypes, used for grabbing one of a number of // different types from a packet. type LayerClass interface { // Contains returns true if the given layer type should be considered part // of this layer class. Contains(LayerType) bool // LayerTypes returns the set of all...
vendor/github.com/google/gopacket/layerclass.go
0.840619
0.456168
layerclass.go
starcoder
package yeelight import ( "context" "time" ) // SetName method isRaw used to name the device. The name will be stored on the device and reported in discovering response. func (c Client) SetName(ctx context.Context, name string) error { return c.rawWithOk(ctx, MethodSetName, name) } // SetColorTemperature method i...
set.go
0.830216
0.438605
set.go
starcoder
package slices import ( "golang.org/x/exp/constraints" "golang.org/x/exp/slices" ) // This file contains the new functions that do not live in the official slices package. func Some[T any](slice []T, test func(T) bool) bool { for _, value := range slice { if test(value) { return true } } return false } ...
vendor/github.com/jesseduffield/generics/slices/slices.go
0.791741
0.554712
slices.go
starcoder
package lsh import ( "bytes" "encoding/gob" "errors" "gonum.org/v1/gonum/blas/blas64" "math" "math/rand" "sync" "time" ) var ( dimensionsNumberErr = errors.New("dimensions number must be a positive integer") hasherEmptyInstancesErr = errors.New("hasher must contain at least one instance") ) // plane st...
lsh/hasher.go
0.68742
0.438364
hasher.go
starcoder
package main import ( "log" "time" ) type Visibility int const ( Unseen Visibility = iota Visible Seen ) type VisionMap struct { Columns int Rows int Current int64 Map []int64 } func (vision VisionMap) VisibilityAt(x int, y int) Visibility { switch vision.lastSeenAt(x, y) { case vision.Current: ...
example/muncher/fov.go
0.648911
0.495789
fov.go
starcoder
package fsm import ( mtx "github.com/skelterjohn/go.matrix" "strconv" "strings" ) // StateMachine models a finite state machine with // a set of states and transitions. type StateMachine struct { States []State Transitions []Transition } // State can be labeled with a proposition // and optionally be an in...
fsm/fsm.go
0.60743
0.512754
fsm.go
starcoder
package lunar import ( "time" c "github.com/rtovey/astro-lib/common" o "github.com/rtovey/astro-lib/orbit" s "github.com/rtovey/astro-lib/solar" t "github.com/rtovey/astro-lib/time" ) const ( lunarMeanLongitudeAtEpoch = 318.351648 // degrees lunarMeanLongitudeOfPerigeeAtEpoch = 36.340410 // degrees ...
lunar/lunarPosition.go
0.763484
0.490358
lunarPosition.go
starcoder
package rb import ( "fmt" "github.com/pkg/errors" "github.com/alexander-yu/stream/quantile/order" ) // Color represents the color of the node. type Color bool // The only allowed colors are red and black. const ( Red Color = true Black Color = false ) func (c Color) String() string { switch c { case Blac...
quantile/ost/rb/node.go
0.875162
0.505615
node.go
starcoder
package plaid import ( "encoding/json" ) // AccountIdentity struct for AccountIdentity type AccountIdentity struct { // Plaid’s unique identifier for the account. This value will not change unless Plaid can't reconcile the account with the data returned by the financial institution. This may occur, for example, wh...
plaid/model_account_identity.go
0.810479
0.456107
model_account_identity.go
starcoder
package daycount import ( "fmt" "time" ) // Default day count convention var Default string = "30E360" type dateDiffFunc func(date1, date2 time.Time) float64 // conventions is a map strcuture that contains the information // to calculate the days between two dates and converts it into // a day count fraction. // ...
daycount.go
0.667256
0.491151
daycount.go
starcoder
package sqlbatch import ( "fmt" "database/sql" ) // Command format for sending a batch of sql commands. // Query is the sql query to execute (required). // ArgsFunc is called before execution for query arguments (optional). // It will be passed current results. // Args are query parameters (optional). Ignored if A...
sqlbatch.go
0.565899
0.416559
sqlbatch.go
starcoder
package comb import "fmt" // Token accepts the shortest given token. At least one token must // be provided. If more than one token is given, then a trie is used // to check for membership. func Token(tokens ...string) Parser { rTokens := make([][]rune, len(tokens)) for i, s := range tokens { rTokens[i] = []rune(...
token.go
0.699152
0.443841
token.go
starcoder
Render an SDF SDF3 -> STL file SDF2 -> DXF file SDF2 -> SVG file */ //----------------------------------------------------------------------------- package sdf import ( "fmt" "sync" ) //----------------------------------------------------------------------------- // RenderSTL renders an SDF3 as an STL file (us...
sdf/render.go
0.635901
0.429848
render.go
starcoder
package client import ( "encoding/json" "time" ) type ( Time struct { time.Time } ) // Date returns the Time corresponding to the supplied parameters // by wrapping time.Date. func Date(year int, month time.Month, day, hour, min, sec, nsec int, loc *time.Location) Time { return Time{time.Date(year, month, day...
deps/github.com/YakLabs/k8s-client/time.go
0.827445
0.45042
time.go
starcoder
// Define custom patterns (implementing the siegfried.Pattern interface) for the different patterns allowed by the PRONOM spec. package pronom import ( "bytes" "github.com/richardlehane/siegfried/internal/bytematcher/patterns" "github.com/richardlehane/siegfried/internal/persist" ) func init() { patterns.Regist...
pkg/pronom/patterns.go
0.659624
0.479321
patterns.go
starcoder
package render import ( "math" mgl "github.com/go-gl/mathgl/mgl32" "github.com/inkyblackness/hacked/ui/opengl" ) var orientationViewVertexShaderSource = ` #version 150 precision mediump float; in vec3 vertexPosition; uniform mat4 modelMatrix; uniform mat4 viewMatrix; uniform mat4 projectionMatrix; out vec3 pos...
editor/render/OrientationView.go
0.809765
0.629945
OrientationView.go
starcoder
package graph import ( i336074805fc853987abe6f7fe3ad97a6a6f3077a16391fec744f671a015fbd7e "time" i04eb5309aeaafadd28374d79c8471df9b267510b4dc2e3144c378c50f6fd7b55 "github.com/microsoft/kiota/abstractions/go/serialization" ) // AccessReviewInstance type AccessReviewInstance struct { Entity // Returns t...
models/microsoft/graph/access_review_instance.go
0.727104
0.424949
access_review_instance.go
starcoder
package travel import ( "time" ) func (t Travel) YearDay() int { return t.t.YearDay() } func (t Travel) EnglishMonth() string { return t.t.Month().String() } func (t Travel) EnglishWeekDay() string { return t.t.Weekday().String() } func (t Travel) WeekDayISO() int { return int(t.t.Weekday()) } func (t Travel...
format.go
0.504883
0.677657
format.go
starcoder
package num import ( "database/sql/driver" "encoding/json" "fmt" "regexp" "strconv" ) // Number type of numberic type Number struct { value interface{} } // Make create a empty instance func Make() *Number { return &Number{value: nil} } // Of make a new number func Of(value interface{}) *Number { return &Nu...
num/number.go
0.734881
0.410756
number.go
starcoder
package neuralnet import ( "fmt" "math" ) type SingleLayerNN struct { structure *NNStructure wts WeightVector } func (nn *SingleLayerNN) PackedWts() []float64 { return nn.wts } func (nn *SingleLayerNN) ExpectedPackedWeightsCount() int { return nn.structure.ExpectedPackedWeightsCount() } func (nn *Singl...
src/neuralnet/singlelayer_nn.go
0.755817
0.448607
singlelayer_nn.go
starcoder
package util import ( "fmt" "math/rand" "strconv" "strings" "time" v1 "k8s.io/api/core/v1" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" "k8s.io/apimachinery/pkg/types" ) const ( // a short time format; like time.Kitchen but with 24-hour notation. Kitchen24 = "15:04" // a time format that just cares about...
util/util.go
0.743634
0.511351
util.go
starcoder
package main // represent a data structure with 3 components type Vector3 struct { x, y, z uint } func (v Vector3) Set (x, y, z uint) { v.x = x v.y = y v.z = z } func (v Vector3) Set8 (x, y, z uint8) { v.x = uint(x) v.y = uint(y) v.z = uint(z) } // convert a single byte into three compo...
vector3.go
0.899519
0.719396
vector3.go
starcoder
package types import ( "fmt" "net" "reflect" "sort" "strings" "github.com/Sirupsen/logrus" v1 "k8s.io/api/core/v1" ) const ( v6AddrLabelKey = "rdei.io/node-addr-v6" ) // NodesEqual returns a boolean value indicating whether the contents of the // two passed NodesLists are equivalent. func NodesEqual(a, b No...
pkg/types/node.go
0.663669
0.429788
node.go
starcoder
package geojsongeos import ( "fmt" "github.com/paulsmith/gogeos/geos" "github.com/venicegeo/geojson-go/geojson" ) func parseCoord(input []float64) geos.Coord { return geos.NewCoord(input[0], input[1]) } func parseCoordArray(input [][]float64) []geos.Coord { var result []geos.Coord for inx := 0; inx < len(input...
vendor/github.com/venicegeo/geojson-geos-go/geojsongeos/geojsongeos.go
0.677474
0.435481
geojsongeos.go
starcoder
package thwbbst // Wbbst - Top Heavy Weight Balanced Binary Search Tree // Tree is encoded by an array with uint32 indices. Data type is unspecified and defined by the implementation. // This interface can be implemented with any alternative type of BST implementation but this compact storage format is very well suite...
pkg/thwbbst/thwbbst.go
0.726717
0.716194
thwbbst.go
starcoder
package slicy // SliceOfByte is a struct containing needed data for storing slice items data type SliceOfByte struct { items []byte } // NewFromByteSlice creates an instance of SliceOfByte and returns a reference to it func NewFromByteSlice(items []byte) *SliceOfByte { slicy := &SliceOfByte{items} return slicy } ...
generated.go
0.907261
0.665519
generated.go
starcoder
package main import ( "math" "github.com/gazed/vu" "github.com/gazed/vu/math/lin" ) // cam controls the main game level camera. type cam struct { pitch float64 // used to smooth camera. yaw float64 // used to smooth camera. } // implement the rest of the lens interface. func (c *cam) back(bod *vu.Ent, dt, r...
cam.go
0.725357
0.452717
cam.go
starcoder
package thermo func shomateCarbonMonoxide(T float64) (float64, float64, float64, float64, float64, float64, float64, float64) { switch { case T <= 1300: return 25.56759, 6.09613, 4.054656, -2.671301, 0.131021, -118.0089, 227.3665, -110.5271 default: return 35.15070, 1.300095, -0.205921, 0.013550, -3.282780, -12...
thermo/shomate_constants.go
0.772616
0.54692
shomate_constants.go
starcoder
package parser import "strconv" func isValidSetCommand(command string, arguments []string) bool { return len(arguments) >= 2 } func isValidGetCommand(command string, arguments []string) bool { return len(arguments) == 1 } func isValidSetexCommand(command string, arguments []string) bool { if len(arguments) < 3 {...
internal/parser/commands.go
0.553023
0.422088
commands.go
starcoder
type MyCircularDeque struct { Size int Capacity int Head *Node Tail *Node } type Node struct { Val int Pre *Node Next *Node } /** Initialize your data structure here. Set the size of the deque to be k. */ func Constructor(k int) MyCircularDeque { head := &Node{0, nil, nil} tail := &Node{0,...
Design/641.go
0.791055
0.455744
641.go
starcoder