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 dot import ( "fmt" "io" ) // Graph is the graphviz dot-file graph representation. type Graph struct { Name string Body []Element } // Element captures the information of a dot-file element, // typically corresoponding to one line of the file type Element interface { Write(io.Writer) error } // Vertex...
graph.go
0.59843
0.435361
graph.go
starcoder
package shp import ( "encoding/binary" "fmt" "io" ) // PartType ... type PartType int32 const ( // TriangleStrip indicates the part is a linked strip of triangles, // where every vertex (after the first two) completes a new triangle. // A new triangle is always formed byconnecting the new vertex with // its t...
shp/multipatch.go
0.732879
0.499084
multipatch.go
starcoder
package formulate import ( "errors" "net/url" "reflect" ) // Validator is an interface that allows individual form fields to be validated as part of the Decode phase of a formulate // form. Validators may be reused for multiple form fields. type Validator interface { // Validate a given value. If the value passes...
validator.go
0.791459
0.400661
validator.go
starcoder
package chatcorr import ( "math" "math/rand" "sort" "time" ) // chatcorr provides functions that implement the Chatterjee Correlation // (see https://arxiv.org/pdf/1909.10140.pdf) for a variety of types. // This is also an exercise in programming with Go generics. type Lessable interface { ~int | ~uint | ~i...
chacor.go
0.707708
0.473414
chacor.go
starcoder
package strategies import ( "fmt" "reflect" ) // TypeNumber is for numerical values: const TypeNumber = "NUMBER" // Number asserts the given parameters then passes on for evaluation: func Number(conditional string, options []interface{}, value interface{}) (bool, error) { var assertedValue float64 var ok bool ...
pkg/strategies/type_number.go
0.704668
0.621828
type_number.go
starcoder
package types import ( "errors" "fmt" "reflect" ) type Type struct { reflect.Value } var TypeError = errors.New("type error") func Help(v interface{}) *Type { return &Type{ Value: reflect.ValueOf(v), } } func (t *Type) IsZero() bool { switch t.Value.Kind() { case reflect.String: return t.Value.Len() ==...
types/types.go
0.604049
0.549097
types.go
starcoder
package nanojson import ( "sync" ) /* Pools are sync.Pools used to efficiently reuse data structures that would otherwise escape to heap (and require to be allocated every time, thus leading to overall slowness of the package.) Normally, users of the package don't need to fine-tune this, however if you have particul...
vendor/howl.moe/nanojson/pools.go
0.513181
0.562837
pools.go
starcoder
package ag import ( "github.com/nlpodyssey/spago/ag/fn" "github.com/nlpodyssey/spago/mat" ) // Abs returns a new operator node as a result of the `Abs` function. func Abs[T mat.DType](x Node[T]) Node[T] { return NewOperator[T](fn.NewAbs[T](x)) } // Add returns a new operator node as a result of the fn.Add functi...
ag/operators.go
0.871393
0.817756
operators.go
starcoder
package cuda import ( "fmt" "log" "github.com/pkg/errors" "gorgonia.org/tensor" ) func getDenseTensor(t tensor.Tensor) (tensor.DenseTensor, error) { switch tt := t.(type) { case tensor.DenseTensor: return tt, nil case tensor.Densor: return tt.Dense(), nil default: return nil, errors.Errorf("Tensor %T i...
cuda/utils.go
0.60288
0.517205
utils.go
starcoder
package docs import "github.com/swaggo/swag" const docTemplate = `{ "schemes": {{ marshal .Schemes }}, "swagger": "2.0", "info": { "description": "{{escape .Description}}", "title": "{{.Title}}", "termsOfService": "http://swagger.io/terms/", "contact": {}, "license"...
docs/docs.go
0.702122
0.400046
docs.go
starcoder
package la import ( "math" "gosl/chk" "gosl/la/oblas" "gosl/utl" ) // MatInvSmall computes the inverse of small matrices of size 1x1, 2x2, or 3x3. // It also returns the determinant. // Input: // a -- the matrix // tol -- tolerance to assume zero determinant // Output: // ai -- the inverse ma...
la/matrix_ops.go
0.660939
0.663056
matrix_ops.go
starcoder
package terminal // Input just manages a very encapsulated version of a terminal line so it can // be synchronized for read and write without the sprawling access this data // had in the original terminal structure type Input struct { Line []rune Pos int } // Set overwrites Line and Pos with l and p, respectively ...
vendor/github.com/Nerdmaster/terminal/input.go
0.592549
0.551996
input.go
starcoder
package margaid import ( "fmt" "math" "strings" "github.com/erkkah/margaid/svg" ) // AxisSelection specified which axes to use type AxisSelection struct { x Axis y Axis } type plotOptions struct { xAxis Axis yAxis Axis marker string strokeWidth float32 } // Using is the base type for plo...
plots.go
0.778018
0.516169
plots.go
starcoder
package main type cyclicalFigurate struct { wantedSetSize int s figurateMap successors [][]figurateNumber } func makeCyclicalFigurate(setSize int) cyclicalFigurate { cf := cyclicalFigurate{ wantedSetSize: setSize, s: make(figurateMap), successors: make([][]figurateNumber, 100),...
001-100/061-070/061/cyclicalFigurate.go
0.660172
0.468243
cyclicalFigurate.go
starcoder
package pgsql import ( "database/sql" "database/sql/driver" "strconv" ) // NumRangeArrayFromIntArray2Slice returns a driver.Valuer that produces a PostgreSQL numrange[] from the given Go [][2]int. func NumRangeArrayFromIntArray2Slice(val [][2]int) driver.Valuer { return numRangeArrayFromIntArray2Slice{val: val} }...
pgsql/numrangearr.go
0.811265
0.747409
numrangearr.go
starcoder
package chron import ( "time" "fmt" "reflect" "database/sql/driver" "github.com/dustinevan/chron/dura" "strings" ) type Day struct { time.Time } // Constructors func NewDay(year int, month time.Month, day int) Day { return Day{time.Date(year, month, day, 0, 0, 0, 0, time.UTC)} } func Today() Day { retur...
day.go
0.731059
0.525064
day.go
starcoder
package main import ( "fmt" "go_NN/gates" "go_NN/nodes" "math/rand" "time" ) func linear_regression_example() { // create data arrays and populate them with noisy data; in this case we // have the line y = 5.0 * x + 22.4 + e, with e ~ N(0, 1) random errors N := 100 var x_vals [100]...
src/go_NN/go_NN/go_NN.go
0.744749
0.607634
go_NN.go
starcoder
package tdigest import "math" type scaler interface { /** * Computes q as a function of k. This is often faster than finding k as a function of q for some scales. * * @param k The index value to convert into q scale. * @param normalizer The normalizer value which depends on compression and (possibly...
vendor/github.com/signalfx/tdigest/scaler.go
0.923329
0.799051
scaler.go
starcoder
package patches import ( "github.com/meowpub/meow/ld" "github.com/meowpub/meow/ld/ns/owl" "github.com/meowpub/meow/ld/ns/rdf" "github.com/meowpub/meow/ld/ns/sec" ) var SecPatches = []*ld.Object{ // This doesn't have any proper data on which properties are on what. // It's in the HTML, but not encoded properly a...
tools/nsgen/patches/sec.go
0.613468
0.492493
sec.go
starcoder
package flamenco import ( "encoding/json" "fmt" "time" "gopkg.in/mgo.v2/bson" ) const timeOfDayStringFormat = "%02d:%02d" // TimeOfDay is marshalled as 'HH:MM'. // Its date and timezone components are ignored, and the time is supposed // to be interpreted as local time on any date (f.e. a scheduled sleep time /...
flamenco/time_of_day.go
0.760117
0.444444
time_of_day.go
starcoder
package world import ( "github.com/olsdavis/goelan/util" "math" ) // Orientation struct represents rotations (yaw & pitch). type Orientation struct { Yaw float32 Pitch float32 } // Location3f struct represents coordinates with three floats. type Location3f struct { X float32 Y float32 Z float32 ...
world/location.go
0.86411
0.512205
location.go
starcoder
package main import ( "fmt" "reflect" "strconv" "strings" "github.com/fatih/color" "github.com/mattermost/mattermost-load-test-ng/logger" ) // create a struct from a type, this function is called recursively so that // we can walk on every field of it. func createStruct(defaultValue interface{}, docPath string...
cmd/ltassist/reflect.go
0.544801
0.414543
reflect.go
starcoder
package aoc2020 const DAY_22_TEST_DATA = `Player 1: 9 2 6 3 1 Player 2: 5 8 4 7 10` const DAY_22_DATA = `Player 1: 14 23 6 16 46 24 13 25 17 4 31 7 1 47 15 9 50 3 30 37 43 10 28 33 32 Player 2: 29 49 11 42 35 18 39 40 36 19 48 22 2 20 26 8 12 44 45 21 38 41 34 5 27` const DAY_22_PART_2_INFINITE_LOOP_GAME_DATA = `P...
app/aoc2020/aoc2020_22_data.go
0.704465
0.67104
aoc2020_22_data.go
starcoder
package plane import ( // "fmt" "math" ) type Plane struct { // Size X float64 // X posiiton of player Y float64 // Y position of player Direction float64 // Direction of player r float64 // Distance between center and lefttop of img thetaP float64 // Angle of vector between center ...
plane/plane.go
0.601125
0.520374
plane.go
starcoder
package geom import ( "github.com/badu/term" "github.com/badu/term/color" "github.com/badu/term/style" ) // Id is used by Page to identify owners and operate them func (r *Rectangle) Id() int { return r.id } // PixelAskChan - used by Page to deliver pixels func (r *Rectangle) PixelAskChan() chan term.Position { ...
geom/rectangle_props.go
0.89885
0.417153
rectangle_props.go
starcoder
package ff import ( "github.com/drakos74/go-ex-machina/xmachina/ml" "github.com/drakos74/go-ex-machina/xmachina/net" "github.com/drakos74/go-ex-machina/xmath" ) type memory struct { input xmath.Vector output float64 //nolint } type learn struct { weights xmath.Vector bias float64 //nolint } type Neuron s...
xmachina/net/ff/neuron.go
0.61057
0.429728
neuron.go
starcoder
package chunky // Next pops the chunks sequentially func (itr *IntIterator) Next() bool { if len(itr.Chunk) > 0 { itr.CurrentBlock, itr.Chunk = itr.Chunk[0], itr.Chunk[1:] return true } return false } // Next pops the chunks sequentially func (itr *Int8Iterator) Next() bool { if len(itr.Chunk) > 0 { itr.Cur...
next.go
0.541166
0.488161
next.go
starcoder
package reflecth import ( "github.com/apaxa-go/helper/strconvh" "go/token" ) func binaryOpInt(x int, op token.Token, y int) (r int, err error) { switch op { case token.ADD: return x + y, nil case token.SUB: return x - y, nil case token.MUL: return x * y, nil case token.QUO: return x / y, nil case tok...
back/vendor/github.com/apaxa-go/helper/reflecth/op-binary-gen.go
0.569015
0.577674
op-binary-gen.go
starcoder
package ls import ( "fmt" ) // A Validator is used to validate document nodes based on their // schema. The Validate function is called with the document node that // needs to be validated, and the associated schema node. type Validator interface { Validate(docNode, layerNode Node) error } type nopValidator struc...
pkg/ls/semvalidation.go
0.715821
0.4474
semvalidation.go
starcoder
package lamb import ( "github.com/nlpodyssey/spago/gd" "github.com/nlpodyssey/spago/mat" "github.com/nlpodyssey/spago/nn" ) var _ gd.MethodConfig = &Config[float32]{} // Config provides configuration settings for Lamb optimizer. type Config[T mat.DType] struct { gd.MethodConfig StepSize T Beta1 T Beta2 ...
gd/lamb/lamb.go
0.797833
0.491822
lamb.go
starcoder
// version 0.0.1 package matsa type List_f64 []float64 type List_str []string // general list methods //length - return the number of values in the collection func (list List_str) Length() int { return len(list) } func (list List_f64) Length() int { return len(list) } //isempty - provides an clear way to...
matsa.go
0.6137
0.405625
matsa.go
starcoder
package main import ( "fmt" "flag" "os" "bufio" "strings" "errors" "time" "strconv" "math" ) type UnitInfo struct { label string div float64 showLength int } type Args struct { interfaceName string procNetDevPath string interval float64 autoUnit bool ...
bin/net-flow.go
0.669421
0.520618
net-flow.go
starcoder
package field // This file implements computations in the field of integers // modulo p = 2^255 - 18651. // ======================================================================= // Field GF255e: integers modulo p = 2^255 - 18651 type GF255e [4]uint64 const mq255e uint64 = 18651 // Field element of value 0. var GF...
internal/field/gf255e.go
0.812793
0.469216
gf255e.go
starcoder
package db import ( "strconv" "strings" "time" "github.com/pkg/errors" ) // List of value's kind. const ( // Unknown values Unknown Kind = iota // Numeric values Int Float // Non-numeric values Bool String ) // Kind specifies the kind of value. type Kind int // Kinds returns the list of available ki...
db/var.go
0.779406
0.45641
var.go
starcoder
package macrocosm import ( "math" "sync" ) // Axis is an integer type alias representing a 3d axis. type Axis int const ( // X is the x-axis. X Axis = iota // Y is the y-axis. Y // Z is the z-axis. Z ) // Vector is a macrocosmically primitive data type representing a point in 3d // space. type Vector stru...
macrocosm/vector.go
0.882453
0.843702
vector.go
starcoder
package treap import ( "time" "unsafe" ) // Comparator establishes ordering between two elements. // It returns -1 if a < b, 0 if a == b, and 1 if a > b. // Nil values are treated as -Inf. type Comparator func(a, b interface{}) int // MaxTreap wraps a comparator, resulting in a treap with max-heap ordering. func M...
comparator.go
0.825871
0.613989
comparator.go
starcoder
package white // F11 illuminant conversion functions // F11_A functions func F11_A_Bradford(xs, ys, zs float64) (xd, yd, zd float64) { m := [3][3]float64{ {1.0928123, 0.0559961, -0.0945162}, {0.0754916, 0.9451460, -0.0331995}, {-0.0159459, 0.0249839, 0.5391848}} xd = m[0][0]*xs + m[0][1]*ys + m[0][2]*zs yd ...
f64/white/f11.go
0.547706
0.574275
f11.go
starcoder
package main import ( // "flag" "flag" "image" // "image/jpeg" "image/jpeg" "image/png" "os" "sort" ) // check handles a potential error. // It stops execution of the program ("panics") if an error has happened. func check(err error) { if err != nil { panic(err) } } // makeMatrix makes and returns a 2D s...
lab2/lab2_code/filter/medianFilter.go
0.55917
0.44897
medianFilter.go
starcoder
package types import "sync" type TSafeInts interface { // Reset the slice. Reset() // Contains say if "s" contains "values". Contains(...int) bool // ContainsOneOf says if "s" contains one of the "values". ContainsOneOf(...int) bool // Copy create a new copy of the slice. Copy() TSafeInts // Diff returns...
syncints.go
0.711431
0.515254
syncints.go
starcoder
package spriter import ( "fmt" "math" ) type CurveType int const ( TypeLinear CurveType = 0 TypeInstant CurveType = 1 TypeQuadratic CurveType = 2 TypeCubic CurveType = 3 TypeQuartic CurveType = 4 TypeQuintic CurveType = 5 TypeBezier CurveType = 6 ) type Curve struct { curveType Cur...
curve.go
0.710427
0.586404
curve.go
starcoder
package main import ( "fmt" "image" "image/gif" "image/jpeg" "image/png" "math" "os" "strconv" "strings" ) // input: lon, lat in degrees // alpha and beta rotation angles in degrees // alpha rotation is clockwise by using Y axis which goes through (90, 0) and (-90, 0) // beta rotation is clockwise by using Z...
cmd/poleshift/poleshift.go
0.65202
0.432543
poleshift.go
starcoder
package examples import ( "fmt" "log" "os" "strings" ) // Examples - consists of the name of the example and the demonstration code type Examples struct { Example []Example } // Example - Contains the basic structure for an example type Example struct { Name string SourceFiles []Source PackageFiles ...
examples/examples.go
0.598312
0.431944
examples.go
starcoder
package launchData import "fmt" // Reusable messages for common launch events const maxQDesc = "The period of maximum aerodynamic pressure is reached." // Returns message for fairing jettison func getFairingJetDesc(name string) string { return fmt.Sprintf("The fairings protecting %s's payload are jettisoned to redu...
launchData/data.go
0.765593
0.595728
data.go
starcoder
package sdf import ( "image" "image/color" "math" ) const ( minDist = 0 maxDist = 10 << 10 ) var ( empty = Point{maxDist, maxDist} inside = Point{minDist, minDist} ) type Point struct{ Dx, Dy float64 } func (p Point) Offset(v float64) Point { return Point{p.Dx + v, p.Dy + v} } func (...
sdf/sdf.go
0.567218
0.413063
sdf.go
starcoder
package goop2 import ( "fmt" "os" ) /* quadratic_expr.go Description: Defines some of the functions necessary to define polynomial expressions in terms of the variables of an optimization problem. */ // Type Definitions // ================ /* QuadraticExpr Description: A quadratic expression of optimization va...
quadratic_expr.go
0.647018
0.787564
quadratic_expr.go
starcoder
package gen_mmo import ( "math" "github.com/itfantasy/gonode/utils/stl" ) type World struct { name string worldRegions [][]*Region area *BoundingBox tileDimensions *Vector tileX int tileY int itemCatch *ItemManager radar *Radar } func NewWorld(name str...
toolkit/gen_mmo/world.go
0.659186
0.46952
world.go
starcoder
package index import ( "flag" "github.com/brimdata/zed/cli/lakeflags" zedlake "github.com/brimdata/zed/cmd/zed/lake" "github.com/brimdata/zed/pkg/charm" ) var Index = &charm.Spec{ Name: "index", Usage: "index [subcommand]", Short: "create and drop indexes, index data", Long: ` The index subcommands control ...
cmd/zed/lake/index/command.go
0.609175
0.460713
command.go
starcoder
package shadow import ( "github.com/go-gl/mathgl/mgl32" "github.com/lakal3/vge/vge/vk" "github.com/lakal3/vge/vge/vmodel" "github.com/lakal3/vge/vge/vscene" "math" "unsafe" ) const ShadowFormat = vk.FORMATD32Sfloat type PointLight struct { // Maximum distance we can see lights shadows from. If light is longe...
vge/materials/shadow/light.go
0.524395
0.409339
light.go
starcoder
// go port of https://github.com/KZen-networks/multi-party-ecdsa/blob/fd3607b07a3327e0cb8ad053255ae1013e0ca18b/src/utilities/zk_pdl_with_slack/mod.rs package zkp import ( "fmt" "math/big" "github.com/binance-chain/tss-lib/common" "github.com/binance-chain/tss-lib/crypto" cmts "github.com/binance-chain/tss-lib/...
crypto/zkp/pdl_w_slack_proof.go
0.698638
0.407864
pdl_w_slack_proof.go
starcoder
package types import ( "fmt" "math/big" "math/rand" "reflect" "github.com/spacemeshos/sha256-simd" "github.com/spacemeshos/go-spacemesh/codec" "github.com/spacemeshos/go-spacemesh/common/util" "github.com/spacemeshos/go-spacemesh/log" ) const ( // Hash32Length is 32, the expected length of the hash. Hash3...
common/types/hashes.go
0.811601
0.530054
hashes.go
starcoder
package day16 import ( "fmt" "github.com/dr-horv/advent-of-code-2018/internal/pkg" "strings" ) type sample struct { Registers []int Expected []int ID int A int B int C int } func (sample sample) copyRegisters() []int { r := make([]int, 4) r[0] = sample.Registers[0] r[1] = ...
internal/day16/day16.go
0.57081
0.470615
day16.go
starcoder
Package bbclib is a library for defining BBcTransaction. This also provides serializer/deserializer and utilities for BBcTransaction object manipulation. Serialization and deserialization A BBcTransaction object contains various object, such as BBcEvent, BBcSignature. In order to store a BBcTransaction object in DB ...
bbclib.go
0.778397
0.510008
bbclib.go
starcoder
package main import ( "fmt" "github.com/faiface/pixel" "github.com/faiface/pixel/imdraw" "github.com/faiface/pixel/pixelgl" "github.com/faiface/pixel/text" "golang.org/x/image/colornames" "golang.org/x/image/font/basicfont" "image" _ "image/png" "os" "strconv" "time" ) const ( WindowHeight = 800 WindowW...
main.go
0.527803
0.418103
main.go
starcoder
package main import ( "fmt" "github.com/echocat/caretakerd/panics" "reflect" "strings" ) // Type is a type definition in the source code. type Type interface { String() string } // IDType is a type definition in the source code which directly references a type by name/id. type IDType struct { Package string ...
manual/type.go
0.587233
0.461441
type.go
starcoder
package marketfeed /* Draw a square on the ground, then inscribe a circle within it. Uniformly scatter some objects of uniform size (grains of rice or sand) over the square. Count the number of objects inside the circle and the total number of objects. The ratio of the two counts is an estimate of the ratio of the two...
marketfeed/predict.go
0.80038
0.781372
predict.go
starcoder
Package godouble is a TestDouble framework for Go. This framework creates a TestDouble implementation of an interface which can be substituted for the real thing during tests. Interface methods can then individually be Stubbed, Mocked, Spied upon or Faked as required. Stubs, Mocks, Spies, Fakes See the canonical sou...
godouble/doc.go
0.777046
0.820649
doc.go
starcoder
package date import ( "errors" "time" ) const DefaultLayout = "2006-01-02" func Parse(layout, value string) (Date, error) { t, err := time.Parse(layout, value) if err != nil { return Date{}, err } return FromTime(t), nil } type Date struct { time time.Time loc *time.Location } func Now() Date { return ...
date.go
0.746324
0.474388
date.go
starcoder
package note import "github.com/google/note-maps/otgen/runes" // Operation is implemented by types that can describe changes that might be // made to a note map. type Operation interface { AffectsID(id ID) bool } type OperationSlice []Operation // Op is a minimal implementation of Operation meant to be used as a ...
note/op.go
0.709019
0.475179
op.go
starcoder
package tilemap // Point is a 2d coordinate. type Point struct { X, Y int } // Edge marks the border of a tile or tiles that exist. type Edge struct { Start Point End Point } type tile struct { edgeID [4]int edgeExist [4]bool exist bool } // Direction indexes to use in the tile edgeID and edgeExist a...
tilemap/tilemap.go
0.705481
0.754056
tilemap.go
starcoder
package units import ( "math" "strconv" "time" ) // Standard library testing package units. const ( Runtime = "ns/op" DataRate = "MB/s" BytesAllocated = "B/op" Allocs = "allocs/op" ) var priority = map[string]int{ Runtime: 4, DataRate: 3, BytesAllocated: 2, Allocs: ...
pkg/units/units.go
0.787359
0.463566
units.go
starcoder
package gamegrid import ( "go-simulate-a-city/common/commonmath" "go-simulate-a-city/common/commonopengl" "go-simulate-a-city/sim/config" "github.com/go-gl/mathgl/mgl32" ) // Contains computations for visiblity of the graming grid func getMinMaxVisibleRange(offset mgl32.Vec2, scale float32) (minTile mgl32.Vec2,...
sim/core/gamegrid/gamegrid.go
0.832407
0.509459
gamegrid.go
starcoder
package monitor import ( "github.com/turnage/graw/reddit" "github.com/turnage/graw/streams/internal/rsort" ) const ( // The blank threshold is the amount of updates returning 0 new // elements in the monitored listing the monitor will tolerate before // suspecting the tip of the listing has been deleted or caug...
vendor/github.com/turnage/graw/streams/internal/monitor/monitor.go
0.576304
0.4184
monitor.go
starcoder
package internal import ( "time" ) //RotateLeft can be used to perform an in-place rotation // left of a slice of empty interface func RotateLeft(dataIn []interface{}) []interface{} { if len(dataIn) > 1 { copy(dataIn, append(dataIn[1:], dataIn[:1]...)) return dataIn } return dataIn } //RotateRight can be use...
internal/execution.go
0.633297
0.506652
execution.go
starcoder
package keybind /* This file contains the logic to implement X's Keyboard Encoding described here: http://goo.gl/qum9q Essentially, LookupString is analogous to Xlib's XLookupString. It's useful in determining the english string representation of modifiers + keycode. It is not for the faint of heart. */ import ( "...
keybind/encoding.go
0.614163
0.407982
encoding.go
starcoder
package gigl import "fmt" // ---------------------------------------------------------------------------- // VAO for Rendering 2D/3D SceneObject // ---------------------------------------------------------------------------- type VAO struct { VertBuffer interface{} // WebGL/OpenGL buffer for geometry's vertex p...
gl_vao.go
0.560493
0.416381
gl_vao.go
starcoder
package toolz // All returns true if all elements in seq are true or if seq is empty func All(seq ...bool) bool { for _, x := range seq { if !x { return false } } return true } // AllPredicates returns true if all predicates in preds true or if preds is empty func AllPredicates[T any](val T, preds ...UnaryP...
slice.go
0.645902
0.478529
slice.go
starcoder
package baduk import "errors" //A Board represents information about the state //of a Go game. Size represents the size of the board, //Grid is the storage of Pieces. type Board struct { Size int Grid [][]Piece } //A Piece represents information about a piece on the //Board. Contains pointers to adjacent pieces. I...
baduk.go
0.577138
0.436802
baduk.go
starcoder
package client import ( "errors" ) // Returns the current authorization state; this is an offline request. For informational purposes only. Use updateAuthorizationState instead to maintain the current authorization state. Can be called before initialization func (client *Client) GetAuthorizationState() (Authorizati...
client/function.go
0.827131
0.411525
function.go
starcoder
Flanges */ //----------------------------------------------------------------------------- package sdf import "math" //----------------------------------------------------------------------------- // Flange1 is a flange shape made from a center circle with two side circles. type Flange1 struct { distance flo...
sdf/flange.go
0.857813
0.495117
flange.go
starcoder
package options import "time" // CreateIndexesOptions represents all possible options for the create() function. type CreateIndexesOptions struct { MaxTime *time.Duration // The maximum amount of time to allow the query to run. } // CreateIndexes creates a new CreateIndexesOptions instance. func CreateIndexes() *C...
vendor/github.com/evergreen-ci/poplar/vendor/github.com/mongodb/mongo-go-driver/mongo/options/indexoptions.go
0.831759
0.522811
indexoptions.go
starcoder
package historicaldata import ( "bytes" "encoding/json" "fmt" "strconv" "time" "github.com/openshift/origin/pkg/synthetictests/platformidentification" ) type BestMatcher interface { // BestMatch returns the best possible match for this historical data. It attempts a full match first, then // it attempts to ...
pkg/synthetictests/historicaldata/types.go
0.704872
0.48499
types.go
starcoder
package u32 type T = uint32 type ST = int32 const ( Size = 4 BitSize = Size << 3 Minimal = T(0) Maximal = ^Minimal ) func DivMod(dividend, divisor T) (T, T) { return dividend / divisor, dividend % divisor } func GCD(value_0, value_1 T) T { for value_1 != 0 { value_0, value_1 = value_1, value_0 % value_1 } ...
u32/u32.go
0.717408
0.438966
u32.go
starcoder
package tf import ( "fmt" tensorflow "github.com/TIBCOSoftware/flogo-contrib/activity/inference/tensorflow/tensorflow/core/example" ) func Example(features map[string]interface{}) (*tensorflow.Example, error) { result := make(map[string]*tensorflow.Feature) for k, v := range features { switch t := v.(type) { ...
activity/inference/framework/tf/example.go
0.698227
0.527925
example.go
starcoder
package aho import ( "unicode/utf8" ) func check(fall *TrieNode, trieNode *TrieNode, char rune) bool { checkNode := fall.getChild(char) if checkNode != nil && fall != trieNode { return false } return true } func build(trieNode *TrieNode) *TrieNode { var queue []*TrieNode trieNode.fall = trieNode queue = ap...
aho/aho.go
0.527073
0.410993
aho.go
starcoder
package sweetiebot import ( "fmt" "strconv" "strings" "time" "github.com/bwmarrin/discordgo" ) type NewUsersCommand struct { } func (c *NewUsersCommand) Name() string { return "newusers" } func (c *NewUsersCommand) Process(args []string, msg *discordgo.Message, info *GuildInfo) (string, bool) { maxresults :=...
sweetiebot/users_command.go
0.538012
0.604924
users_command.go
starcoder
package field // ID is an identifier of a well-known prime modulus. type ID int const ( // P25519 is 2^255-19 P25519 ID = iota + 1 // P256 is 2^256-2^224+2^192+2^96-1 P256 // P256K1 is 2^256-2^32-977 P256K1 // P384 is 2^384-2^128-2^96+2^32-1 P384 // P448 is 2^448-2^224-1 P448 // P521 is 2^521-1 P521 // B...
go-h2c/field/wkfields.go
0.602763
0.46557
wkfields.go
starcoder
package abi import ( "fmt" "math/big" "reflect" "regexp" "strconv" "strings" "github.com/umbracle/ethgo" ) // batch of predefined reflect types var ( boolT = reflect.TypeOf(bool(false)) uint8T = reflect.TypeOf(uint8(0)) uint16T = reflect.TypeOf(uint16(0)) uint32T = reflect.TypeO...
vendor/github.com/umbracle/ethgo/abi/type.go
0.625896
0.423458
type.go
starcoder
package stringutil import ( "fmt" "math" "reflect" "strconv" "strings" "time" ) type SiPrefix int const ( None SiPrefix = 0 Kilo = 1 Mega = 2 Giga = 3 Tera = 4 Peta = 5 Exa = 6 Zetta = 7 Yotta ...
stringutil/stringutil.go
0.728845
0.505615
stringutil.go
starcoder
package expr import ( "errors" "fmt" "regexp/syntax" "strings" "unicode/utf8" ) type exprPart struct { neg bool code string value string } func runeLen(b byte) int { return int([16]byte{ // ASCII Range: 1, 1, 1, 1, 1, 1, 1, 1, // continuation, then multi byte. 1, 1, 1, 1, 2, 2, 3, 4, }[b>>4]) } ...
expr/expr.go
0.547706
0.49585
expr.go
starcoder
package cryptypes import "database/sql/driver" // EncryptedUint supports encrypting Uint data type EncryptedUint struct { Field Raw uint } // Scan converts the value from the DB into a usable EncryptedUint value func (s *EncryptedUint) Scan(value interface{}) error { return decrypt(value.([]byte), &s.Raw) } // V...
cryptypes/type_uint.go
0.816004
0.541469
type_uint.go
starcoder
package abstractTree import ( "github.com/grandquista/data-structures-and-algorithms/queue" ) // Empty optional value unpacked. type emptyOptional struct{} func (emptyOptional) Error() string { return "empty optional" } type poison struct{} // Optional value container. type optional struct { value interface{} }...
abstract_tree/abstract_tree.go
0.834912
0.406862
abstract_tree.go
starcoder
package leader import ( "math" ) /* A non-empty zero-indexed array A consisting of N integers is given. The leader of this array is the value that occurs in more than half of the elements of A. An equi leader is an index S such that 0 ≤ S < N − 1 and two sequences A[0], A[1], ..., A[S] and A[S + 1], A[S + 2], ...,...
leader/EquiLeader.go
0.767951
0.781997
EquiLeader.go
starcoder
package hackerrank import ( "strconv" "strings" ) // ReverseArray in a very optim way func ReverseArray(a []int) []int { length := len(a) i := 0 j := length - 1 mid := length / 2 for i < mid && j >= mid { temp := a[i] a[i] = a[j] a[j] = temp j-- i++ } return a } //DynamicArray perform queries on d...
hackerrank/hackerrank.go
0.572723
0.430686
hackerrank.go
starcoder
package matrixexp import ( "github.com/gonum/blas/blas64" "strconv" ) // Scale represents scalar multiplication. type Scale struct { C float64 M MatrixExp } // String implements the Stringer interface. func (m1 *Scale) String() string { return m1.M.String() + ".Scale(" + strconv.FormatFloat(m1.C, 'g', -1, 64) ...
scale.go
0.93567
0.490907
scale.go
starcoder
package mapAOI import ( "sort" "reflect" ) // A space map is a custom data struture, similar to a sparse 2D array. Entities are stored according to their coordinates; // that is, two keys are needed to fetch entities, the x position and the y position. This allows fast look-up based on position. type SpaceMap str...
src/world/mapAOI/spaceMap.go
0.58818
0.459804
spaceMap.go
starcoder
package godate import "time" // ZeroDays represents 1, January, 1 const ZeroDays ElapsedDays = 0 // ElapsedDays represents elapsed date based on 1, January, 1 type ElapsedDays int64 // Date represents date under the proleptic Gregorian calendar used by ISO 8601. // Zero value is 1, January, 1. // In v1.0.0, formatt...
date.go
0.84572
0.440529
date.go
starcoder
package meteocat import ( "encoding/json" "fmt" "net/http" "strings" ) // MetadadesVariable is an aggregation of fields to hold the metadata asociated with // the variables of the Network of Automatic Meteorological Stations (XEMA), integrated into the Network of Meteorological // Equipment of the Generalitat de ...
mesurades.go
0.557123
0.459197
mesurades.go
starcoder
package slices // Map maps a slice of T to a slice of S func Map[T, S any](source []T, f func(T) S) []S { out := make([]S, len(source)) // avoid allocating a copy of the slice element for i := range source { out[i] = f(source[i]) } return out } // Reduce performs a reduction to a single value of the source s...
slices/slices.go
0.885922
0.459137
slices.go
starcoder
package metricsutil import "github.com/rcrowley/go-metrics" // The code below is adapted from // https://github.com/rcrowley/go-metrics/blob/master/json.go // . // registryToMap returns a map representation of all the metrics in // the Registry. func registryToMap(r metrics.Registry) map[string]map[string]interface...
go/kbfs/metricsutil/registry_to_map.go
0.866796
0.454291
registry_to_map.go
starcoder
package ploc // Collection is used to send the name of a bookmark collection in JSON format to the ploc client app. type Collection struct { Id int64 `json:"id"` Title string `json:"name"` } // Collections is used to send a list of bookmark collection names in JSON format to the ploc client app. // Such a list ...
model/ploc/basetypes.go
0.711732
0.577049
basetypes.go
starcoder
package filters import ( "image" "image/color" "github.com/drew138/go-graphics/filters/kernels" ) func roundRGBValue(val float32) float32 { if val < 0 { return 0 } else if val > 255 { return 255 } return val } func weighedSum(img image.Image, k kernels.Kernel, x int, y int) (uint8, uint8, uint8, uint8) {...
filters/filters.go
0.803328
0.448306
filters.go
starcoder
package core // Collection is a helper for easier to manipulate data query type Collection struct { rows []string data []map[string]string } /** * Setup data for collection */ func (this *Collection) AppendData(initdata map[string]string) { this.data = append(this.data, initdata) } /** * Filtering data based o...
vendor/core/collection.go
0.74512
0.472379
collection.go
starcoder
package list import ( "strconv" "strings" ) // Node of list type Node struct { value int next *Node } // Merge merges two separate lists in a new one // [3, 4] + [1, 2] -> [3, 4, 1, 2] func Merge(a, b List) (newList List) { if a.root != nil { curNode := a.root for curNode != nil { newList.Add(curNode.va...
internal/list/list.go
0.665845
0.437824
list.go
starcoder
package stats import ( "fmt" "math" ) // Gaussian represents a gaussian distribution type Gaussian struct { tau float64 pi float64 } // NewGaussian creates a gaussian distribution from a mean value (mu) and a // standard deviation (sigma) func NewGaussian(mu, sigma float64) Gaussian { g := Gaussian{ pi: 1.0...
stats/gauss.go
0.932752
0.606935
gauss.go
starcoder
package rlp import ( "errors" "fmt" "github.com/holiman/uint256" ) var ( ErrBase = fmt.Errorf("rlp") ErrParse = fmt.Errorf("%w parse", ErrBase) ErrDecode = fmt.Errorf("%w decode", ErrBase) ) func IsRLPError(err error) bool { return errors.Is(err, ErrBase) } // BeInt parses Big Endian representation of an ...
rlp/parse.go
0.620622
0.592726
parse.go
starcoder
package main import ( "fmt" "math" ) type XY interface { X() int Y() int } type Coord struct { x, y int } func CoordXY(xy XY) *Coord { c, _ := xy.(*Coord) return c } type Value struct { *Coord value byte } func (c *Coord) X() int { return c.x } func (c *Coord) Y() int { return c.y } type Board [][]byte...
board.go
0.700792
0.427935
board.go
starcoder
package geom // A Polygon represents a polygon as a collection of LinearRings. The first // LinearRing is the outer boundary. Subsequent LinearRings are inner // boundaries (holes). type Polygon struct { geom2 } // NewPolygon returns a new, empty, Polygon. func NewPolygon(layout Layout) *Polygon { return NewPolygon...
polygon.go
0.915408
0.674218
polygon.go
starcoder
package compare import ( "github.com/benpate/derp" ) // WithOperator uses an operator to compare two values, and returns TRUE or FALSE func WithOperator(value1 interface{}, operator string, value2 interface{}) (bool, error) { // These operations are performed outside of the "Interface" comparison switch operator ...
compare.go
0.791982
0.475849
compare.go
starcoder
package parseutil import ( "github.com/lighttiger2505/sqls/ast" "github.com/lighttiger2505/sqls/ast/astutil" "github.com/lighttiger2505/sqls/token" "golang.org/x/xerrors" ) type TableInfo struct { DatabaseSchema string Name string Alias string } type SubQueryInfo struct { Name string Vie...
parser/parseutil/parseutil.go
0.540681
0.509825
parseutil.go
starcoder
package gaussian import ( "math" "github.com/mafredri/go-mathextra" ) // Gaussian represents a gaussian based on a precision and a precision adjusted mean. type Gaussian struct { PrecisionMean float64 // PrecisionMean (pi, π = μ/σ^2) is the precision adjusted mean. Precision float64 // Precision (tau, τ = 1/...
gaussian.go
0.949035
0.670342
gaussian.go
starcoder