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 types import ( "io" ) type Matrix interface { // Serialize the receiver matrix by using the given writer. Serialize(wrtier io.Writer) error // Return the shape of matrix, which consists of the "rows" and the "columns". Shape() (rows, columns int) // Return the number of "rows". Rows() (rows int) //...
internal/types/matrix.go
0.812644
0.623377
matrix.go
starcoder
// Package descriptions provides the descriptions as used by the graphql endpoint for Weaviate package descriptions // Where filter elements const GetWhere = "Filter options for a local Get query, used to convert the result to the specified filters" const GetWhereInpObj = "An object containing filter options for a lo...
adapters/handlers/graphql/descriptions/filters.go
0.794465
0.800536
filters.go
starcoder
package assert import ( "reflect" "regexp" "testing" ) // Assert wraps a testing.T pointer for storing failures. type Assert struct { t *testing.T } // NewAssert returns an Assert type that wraps t. func NewAssert(t *testing.T) *Assert { return &Assert{t} } func isNil(i interface{}) bool { if i == nil { ret...
vendor/github.com/justsocialapps/assert/assert.go
0.781038
0.514156
assert.go
starcoder
package main func MaxOfType0(a, b int) int { if a > b { return a } return b } func MaxOfType1(a, b int) int { if a > b { return a } return b } func MaxOfType2(a, b int) int { if a > b { return a } return b } func MaxOfType3(a, b int) int { if a > b { return a } return b } func MaxOfTyp...
generated/static.go
0.770378
0.53522
static.go
starcoder
package matrix import ( "errors" "fmt" "math/rand" "strings" "gonum.org/v1/gonum/floats/scalar" "gonum.org/v1/gonum/mat" "gonum.org/v1/gonum/stat" ) // Format returns matrix formatter for printing matrices func Format(m mat.Matrix) fmt.Formatter { return mat.Formatted(m, mat.Prefix(""), mat.Squeeze()) } // ...
matrix.go
0.886082
0.655412
matrix.go
starcoder
package main import ( "github.com/go-gl/gl/v2.1/gl" ) type Texture struct { binding uint32 minU float32 maxU float32 minV float32 maxV float32 } type Vertex struct { coord Vec3 texcoord Vec2 color Vec3 } type Quad struct { v [4]Vertex normal Vec3 } type Model struct { faceQuads [6][]Quad qu...
model.go
0.567937
0.490236
model.go
starcoder
package bloomfilter import ( "errors" "math" "sync" ) const ( ln2s2 = 0.480453013918201 // ln(2)^2 ln2 = 0.693147180559945 // ln(2) seed = 0x9747b28c ) var ( errNegativeError = errors.New("error should be between 0 and 1") errEntriesTooSmall = errors.New("entries should be larger than 10000") ) // Bloo...
bloomfilter.go
0.583678
0.411288
bloomfilter.go
starcoder
package go_kd_segment_tree import ( "fmt" "strings" "time" ) type Measure interface { Bigger(b interface{}) bool Smaller(b interface{}) bool Equal(b interface{}) bool BiggerOrEqual(b interface{}) bool SmallerOrEqual(b interface{}) bool } type MeasureFloat float64 func (a MeasureFloat) Bigger(b interface{}) ...
measure.go
0.643441
0.440229
measure.go
starcoder
package types import ( "encoding/binary" "errors" ) // Decoder stores the information necessary for the decoding functions type Decoder struct { data []byte offset uint32 } // NewDecoder returns an empty Decoder struct func NewDecoder(data []byte) Decoder { return Decoder{ data: data, offset: 0, } } /...
chain/x/meicdp/types/decoder.go
0.825238
0.523177
decoder.go
starcoder
package bin import ( "encoding/binary" "math" ) /* * binary writers */ // WriteUInt64 writes a uint64 value to data at offset func WriteUInt64(data []byte, offset int, value uint64) { binary.LittleEndian.PutUint64(data[offset:], value) } // WriteInt64 writes an int64 value to data at offset func WriteInt64(dat...
pkg/bin/bin.go
0.718496
0.527499
bin.go
starcoder
package dates import ( "time" "github.com/pkg/errors" "github.com/rickar/cal" ) // CreateFutureMoveDates generates a list of dates in the future func CreateFutureMoveDates(startDate time.Time, numDays int, includeWeekendsAndHolidays bool, calendar *cal.Calendar) []time.Time { dates := make([]time.Time, 0, numDay...
pkg/dates/calculators.go
0.836988
0.475118
calculators.go
starcoder
package google_type import ( "sync" "time" ) var ( // SystemDater is a Dater that uses the system UTC time. SystemDater = &systemDater{} ) // NewDate is a convienence function to create a new Date. func NewDate(day int32, month int32, year int32) *Date { return &Date{ Day: day, Month: month, Year: year...
vendor/go.pedge.io/pb/gogo/google/type/type.gen.go
0.723798
0.543227
type.gen.go
starcoder
package chacha20 import ( "encoding/binary" ) var ( initalConstants = [4]uint32{0x61707865, 0x3320646e, 0x79622d32, 0x6b206574} ) type chachaMatrix struct { internalState [64]byte } func (cm chachaMatrix) AsUint32() [16]uint32 { array := [len(cm.internalState) / 4]uint32{} iStatePointer := cm.internalState[:] ...
base.go
0.631594
0.451992
base.go
starcoder
package gotypes import ( "fmt" "reflect" "strconv" ) const ( EMPTYSTR = "" ) var ( boolValue bool intValue int int8Value int8 int16Value int16 int32Value int32 int64Value int64 uintValue uint uint8Value uint8 uint16Value uint16 uint32Value uint32 uint64Val...
gotypes/gotypes.go
0.618435
0.520496
gotypes.go
starcoder
package scanner // These values are stored in the parseState stack. // They give the current state of a composite value // being scanned. If the parser is inside a nested value // the parseState describes the nested state, outermost at entry 0. const ( parseObjectKey = iota // parsing object key (before colon) par...
scanner/state.go
0.694199
0.608536
state.go
starcoder
package irc import ( "fmt" "strings" ) // Message represents the RFC1459 definition of an IRC message // See the full definition in section 2.3.1 in the RFC type Message struct { // Raw contains the unparsed message Raw string // Command contains a three digit number or a string Command string // Params is f...
message.go
0.570092
0.45042
message.go
starcoder
package vector import ( "fmt" "github.com/go-gl/mathgl/mgl32" "math" ) type Vector2d struct { X, Y float64 } func NewVec2d(x, y float64) Vector2d { return Vector2d{x, y} } func NewVec2dP(x, y float64) *Vector2d { return &Vector2d{x, y} } func NewVec2dRad(rad, length float64) Vector2d { return Vector2d{math....
framework/math/vector/vector2d.go
0.870982
0.795221
vector2d.go
starcoder
package units import ( "errors" "fmt" "regexp" "strconv" "strings" ) const ( _ = iota // KiB 1024 bytes KiB = 1 << (10 * iota) // MiB 1024 KiB MiB // GiB 1024 MiB GiB // TiB 1024 GiB TiB // PiB 1024 TiB PiB ) const ( // KB 1000 bytes KB = 1000 // MB 1000 KB MB = KB * 1000 // GB 1000 MB GB = MB ...
vendor/github.com/libopenstorage/openstorage/pkg/units/units.go
0.501465
0.446615
units.go
starcoder
package main import ( "fmt" "github.com/Dadido3/D3iot/light/emission" "gonum.org/v1/gonum/optimize" ) // primariesToTransformation returns a transformation from the given list of floats. // len(x) must be a multiple of 3! func primariesToTransformation(x []float64) emission.TransformationLinDCSToXYZ { transform...
light/tools/profiler/transformation.go
0.813387
0.455562
transformation.go
starcoder
package core /** * The Blackboard is the memory structure required by `BehaviorTree` and its * nodes. It only have 2 public methods: `set` and `get`. These methods works * in 3 different contexts: global, per tree, and per node per tree. * * Suppose you have two different trees controlling a single object with a ...
lab051/lab008/vendor/github.com/liguoqinjim/behavior3go/core/Blackboard.go
0.910448
0.492859
Blackboard.go
starcoder
package beaconscanner import ( "bufio" "fmt" "log" "math" "os" "sort" "strconv" "strings" ) type transformFunc func(x, y, z int) (int, int, int) type Beacon struct { x, y, z int name string } type Displacement struct { magnitude int a, b *Beacon } func sharedPoint(a, b *Displacement) *Beacon { ...
solutions/beaconscanner/beacon_scanner.go
0.524638
0.448728
beacon_scanner.go
starcoder
package genetics import ( "bytes" "context" "encoding/gob" "fmt" "github.com/yaricom/goNEAT/v2/neat" "sort" "sync" ) // PopulationEpochExecutor Executes epoch's turnover for a population of the organisms type PopulationEpochExecutor interface { // NextEpoch Turnover the population to a new generation NextEpo...
neat/genetics/population_epoch.go
0.635222
0.41834
population_epoch.go
starcoder
package chrono import ( "fmt" "math" "strconv" "strings" ) // Period represents an amount of time in years, months, weeks and days. // A period is not a measurable quantity since the lengths of these components is ambiguous. type Period struct { Years float32 Months float32 Weeks float32 Days float32 } /...
period.go
0.707304
0.557062
period.go
starcoder
package yqlib import ( "fmt" "strings" yaml "gopkg.in/yaml.v3" ) func containsOperator(d *dataTreeNavigator, context Context, expressionNode *ExpressionNode) (Context, error) { return crossFunction(d, context.ReadOnlyClone(), expressionNode, containsWithNodes, false) } func containsArrayElement(array *yaml.Node...
pkg/yqlib/operator_contains.go
0.705481
0.400192
operator_contains.go
starcoder
package main import ( "strings" "strconv" "sort" "fmt" ) type Entry struct { year, month, day, hour, minute, second int } func (b Entry) Gt(a Entry) bool { if a.year < b.year { return true } if a.year == b.year && a.month < b.month { return true } if a.year == b.year && a.month == b.month && a.day < ...
src/leetcode/set0000/set600/p635/solution.go
0.63443
0.463323
solution.go
starcoder
package mat64 import ( "fmt" "strconv" ) // Format prints a pretty representation of m to the fs io.Writer. The format character c // specifies the numerical representation of of elements; valid values are those for float64 // specified in the fmt package, with their associated flags. In addition to this, a '#' fo...
vendor/github.com/gonum/matrix/mat64/format.go
0.63861
0.510741
format.go
starcoder
package parse const mapping = ` { "mappings": { "sflow": { "properties": { "@timestamp": { "type": "date" }, "Datagram": { "properties": { "IPLength": { "ignore_above": 1024, "type": "keyword" ...
parse/static.go
0.619126
0.427935
static.go
starcoder
package stats import ( "bytes" "fmt" "sync" "time" ) // The States structure keeps historical data about a state machine // state, and exports them using expvar: // - our current state // - how long we have been in each state // - how many times we transitioned into a state (not counting initial state) type Stat...
vendor/github.com/ngaut/gostats/states.go
0.510252
0.565779
states.go
starcoder
package models import ( "github.com/shopspring/decimal" ) // DataNUM is a Number func ParseDataNUM(tokens []string) DataNUM { num := DataNUM{} num.Adsh = tokens[0] num.Tag = tokens[1] num.Version = tokens[2] num.Ddate = tokens[3] num.Qtrs = parseInt(tokens[4]) num.Uom = tokens[5] num.Dimh = tokens[6] num.Ip...
models/num.go
0.657758
0.507873
num.go
starcoder
package date import ( "errors" "fmt" "strings" "time" ) type Format string const ( RFC2822 Format = "rfc2822" ISO8601 Format = "iso8601" Relative Format = "relative" ) var now = time.Now func SetNow(f func() time.Time) { if f == nil { panic("nil function") } now = f } const iso8601Layout = "2006-01-...
date/date.go
0.647241
0.418459
date.go
starcoder
package blockdag import ( "fmt" "gonum.org/v1/gonum/floats" "gonum.org/v1/gonum/mat" "gonum.org/v1/gonum/stat/distuv" "math" ) const tol = 1e-10 // parameters // N: just pick a value much greater than 1. // alpha: the attacker’s relative computational power. // lambda: blocks per second. // delay: the upper bou...
core/blockdag/spectrerisk.go
0.582966
0.459379
spectrerisk.go
starcoder
Package functions maps a collection of functions to string keys and facilitates calling them with these keys. Registered functions must return 1 or 2 values. If 2, then the second must be an error (or nil). */ package functions import ( "fmt" "reflect" "strconv" "strings" "time" "github.com/golang/glog" "githu...
functions/functions.go
0.738858
0.534005
functions.go
starcoder
package bif import ( "math" "github.com/zzossig/rabbit/object" ) func numericAdd(ctx *object.Context, args ...object.Item) object.Item { arg1 := args[0] arg2 := args[1] switch { case arg1.Type() == object.IntegerType && arg2.Type() == object.IntegerType: leftVal := arg1.(*object.Integer).Value() rightVal ...
bif/bif_4.2.go
0.655446
0.487429
bif_4.2.go
starcoder
package log import ( "go.uber.org/zap" "time" "go.uber.org/zap/zapcore" ) func Array(key string, val zapcore.ArrayMarshaler) zap.Field { return zap.Array(key, val) } func Bools(key string, bs []bool) zap.Field { return zap.Bools(key, bs) } func ByteStrings(key string, bss [][]byte) zap.Field { return zap.Byt...
log/zlog_arry.go
0.658966
0.414721
zlog_arry.go
starcoder
package scl import ( "github.com/aiseeq/s2l/lib/point" "github.com/aiseeq/s2l/protocol/api" "math" ) // Taken from Chippydip's lib // Cluster breaks a list of units into clusters based on the given clustering distance. func MakeCluster(units Units, distance float64) []UnitCluster { maxDistance := distance * dista...
lib/scl/expansions.go
0.78287
0.583648
expansions.go
starcoder
package sc // MultiInput is the interface of an input that causes // cascading multi-channel expansion. // See http://doc.sccode.org/Guides/Multichannel-Expansion.html type MultiInput interface { Input InputArray() []Input } // Inputs is a slice of Input. type Inputs []Input // Add adds an input to all the inputs....
vendor/github.com/scgolang/sc/multiInput.go
0.804521
0.517815
multiInput.go
starcoder
package gwc import "fmt" func NewNodeEnvironment(nodes Nodes) *NodeEnvironment { nodes_map := NodesMap{} for _, node := range nodes { nodes_map[node.ID()] = node } var current NodeID if len(nodes) > 0 { current = nodes[0].ID() } return &NodeEnvironment{ Current: current, Nodes: nodes, N...
environment.go
0.571288
0.460713
environment.go
starcoder
package voxel import ( "encoding/binary" "fmt" "io" "io/ioutil" "math" "os" ) // BlenderVoxelFormat represents a datacube. // The order to write the full datacube after the header is // 1. Frame by frame, where each frame has nz layers. // 2. Layer by layer, where each layer has ny lines. // 3. Line by line, wh...
voxel/file-format.go
0.625781
0.476214
file-format.go
starcoder
package processor import ( "fmt" "time" "github.com/Jeffail/benthos/v3/lib/log" "github.com/Jeffail/benthos/v3/lib/metrics" "github.com/Jeffail/benthos/v3/lib/types" "github.com/Jeffail/benthos/v3/lib/x/docs" "github.com/influxdata/go-syslog/rfc5424" "github.com/opentracing/opentracing-go" ) func init() { C...
lib/processor/parse_log.go
0.589598
0.413892
parse_log.go
starcoder
package math32 // Box3 represents a 3D bounding box defined by two points: // the point with minimum coordinates and the point with maximum coordinates. type Box3 struct { Min Vector3 Max Vector3 } // NewBox3 creates and returns a pointer to a new Box3 defined // by its minimum and maximum coordinates. func NewBox...
math32/box3.go
0.961452
0.663369
box3.go
starcoder
package header /** * The Via header field indicates the transport used for the transaction and * identifies the location where the response is to be sent. A Via header * field value is added only after the transport that will be used to reach * the next hop has been selected. When the UAC creates a request, it MUS...
sip/header/ViaHeader.go
0.905443
0.578031
ViaHeader.go
starcoder
package geometry import "sort" // Delaunay performs a Delaunay triangulation // Reference: // - Algorithm: https://en.wikipedia.org/wiki/Delaunay_triangulation#Incremental func Delaunay(p []Pointer) []Triangle { sort.Sort(&PointSorter{p, SortByX}) return (&triangulation{Points: p}).triangulate() } type triangulati...
src/geometry/delaunay.go
0.810291
0.546799
delaunay.go
starcoder
package main // This file implements a couple of things shown in the documentation of the // "sort" package. We'll do a basic sort and a multikey sort (a sort based // on sorting on multiple fields at once). import ( "fmt" "sort" ) type Student struct { Name, Lastname string Age int Qualification i...
lang/go/interfaces/sort.go
0.642208
0.446676
sort.go
starcoder
package eval import ( "fmt" "math/big" ) // BigComplex behaves like a *big.Re, but has an imaginary component // and separate implementation for + - * / type BigComplex struct { Re big.Rat Im big.Rat } func (z *BigComplex) Add(x, y *BigComplex) *BigComplex { z.Re.Add(&x.Re, &y.Re) z.Im.Add(&x.Im, &y.Im) retur...
Godeps/_workspace/src/github.com/0xfaded/eval/bigcomplex.go
0.879961
0.436982
bigcomplex.go
starcoder
package slices import ( "sort" "github.com/dairaga/gs" "github.com/dairaga/gs/funcs" ) // IsEmpty returns true if this is an empty slice. func (s S[T]) IsEmpty() bool { return len(s) <= 0 } // Clone returns a new copy from this. func (s S[T]) Clone() S[T] { if len(s) <= 0 { return Empty[T]() } return app...
slices/slice_method.go
0.842928
0.496765
slice_method.go
starcoder
package main import ( "bufio" "fmt" "math/rand" "os" "unicode" ) type Point struct { x int y int } func (p *Point) distance(q *Point) int { xdiff := p.x - q.x if xdiff < 0 { xdiff *= -1 } ydiff := p.y - q.y if ydiff < 0 { ydiff *= -1 } return xdiff + ydiff } func min_key_distance(points []Point, p...
213/i213/i213.go
0.634543
0.42322
i213.go
starcoder
package test // Acceptance tests for objects. import ( "testing" "github.com/go-openapi/strfmt" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" "github.com/semi-technologies/weaviate/client/batch" "github.com/semi-technologies/weaviate/client/objects" "github.com/semi-technologie...
test/acceptance/objects/delete_objects_from_all_classes.go
0.556159
0.428293
delete_objects_from_all_classes.go
starcoder
package lz4block import ( "encoding/binary" "math/bits" "sync" "github.com/pierrec/lz4/v4/internal/lz4errors" ) const ( // The following constants are used to setup the compression algorithm. minMatch = 4 // the minimum size of the match sequence size (4 bytes) winSizeLog = 16 // LZ4 64Kb window size limit...
vendor/github.com/pierrec/lz4/v4/internal/lz4block/block.go
0.623492
0.4575
block.go
starcoder
package pgmodel import ( "fmt" "github.com/timescale/promscale/pkg/prompb" ) const ( MetricNameLabelName = "__name__" ) var ( ErrNoMetricName = fmt.Errorf("metric name missing") ) // SeriesID represents a globally unique id for the series. This should be equivalent // to the PostgreSQL type in the series tabl...
pkg/pgmodel/ingestor.go
0.671147
0.411879
ingestor.go
starcoder
package texttree const ( // TreeBody indicates the current operator sub-tree is not finished, still // has child operators to be attached on. TreeBody = '│' // TreeMidbseNode indicates this operator is not the last child of the // current sub-tree rooted by its parent. TreeMidbseNode = '├' // TreeLastNode indi...
soliton/texttree/texttree.go
0.718397
0.434641
texttree.go
starcoder
package scheduler import ( "crypto/md5" // #nosec "encoding/binary" "sort" log "github.com/sirupsen/logrus" "github.com/determined-ai/determined/master/pkg/actor" ) // HardConstraint returns true if the task can be assigned to the agent and false otherwise. type HardConstraint func(task *Task, agent *agentStat...
master/internal/scheduler/fitting.go
0.706798
0.459622
fitting.go
starcoder
package particle import "github.com/dowlandaiello/eve/activation" // InitializationOption is an initialization option used to modify a // particle's behavior. type InitializationOption = func(particle Particle) Particle // Particle is a basic particle. type Particle struct { Net activation.Net // the particle's net...
particle/particle.go
0.779867
0.527986
particle.go
starcoder
package gomfa import ( "math" ) func Pas(al float64, ap float64, bl float64, bp float64) float64 { /* ** - - - - ** P a s ** - - - - ** ** Position-angle from spherical coordinates. ** ** Given: ** al float64 longitude of point A (e.g. RA) in radians ** ap float64 lat...
pas.go
0.767951
0.599544
pas.go
starcoder
package concurrency import ( "sync" ) // FanIn - combines multiple results in the form of an slice of channels into one channel. // This implementation uses a waitgroup in order to multiplex all the results of the slice of channels. // The output is not produced in sequence. This pattern is good when order is not im...
concurrency/fan-in.go
0.620622
0.404478
fan-in.go
starcoder
package main /* 3.1 Signaling Possibly the simplest use for a semaphore is signaling, which means that one thread sends a signal to another thread to indicate that something has happened. Signaling makes it possible to guarantee that a section of code in one thread will run before a section of code in another thread...
LBS/go/3.1/signaling.go
0.538255
0.591782
signaling.go
starcoder
// Let's just add another interface. Let's use interface composition to do this. // PullStorer has both behaviors: Puller and Storer. Any concrete type that implement both pull and // store is a PullStorer. System is a PullStorer because it is embedded of these 2 types Xenia and // Pillar. Now we just need to go into ...
go/design/decoupling_3.go
0.605799
0.555013
decoupling_3.go
starcoder
package primitives import ( "math" ) // PV represents 3D coordinates and a w variable for distinction between point and vector type PV struct {X, Y, Z, W float64} // EPSILON Value used for approximation var EPSILON float64 = 0.00000001 // MakeVector Create a vector PV type func MakeVector(x, y, z float64) PV { re...
pkg/primitives/pv.go
0.838481
0.528473
pv.go
starcoder
package processor import ( "database/sql" "fmt" "sync" "time" "github.com/Jeffail/benthos/v3/lib/bloblang/x/field" "github.com/Jeffail/benthos/v3/lib/log" "github.com/Jeffail/benthos/v3/lib/message" "github.com/Jeffail/benthos/v3/lib/message/tracing" "github.com/Jeffail/benthos/v3/lib/metrics" "github.com/J...
lib/processor/sql.go
0.653127
0.610482
sql.go
starcoder
package linedesigns import ( "github.com/tidwall/pinhole" ) // Design ... type Design struct { LineWidth float64 DotSize float64 ImageWidth int ImageHeight int P *pinhole.Pinhole } // New sets up func New(lineWidth, dotSize float64, imageWidth, imageHeight int) *Design { return &Design{LineWi...
linedesigns.go
0.775732
0.709535
linedesigns.go
starcoder
package expectedTestData import ( "github.com/ONSdigital/dp-api-tests/testDataSetup/mongo" ) var ( EmptyDownloads = &mongo.Downloads{ CSV: &mongo.DownloadItem{ HRef: "", Private: "", Public: "", Size: "", }, XLS: &mongo.DownloadItem{ HRef: "", Private: "", Public: "", Size: ...
web/filterAPI/expectedTestData/filterJobWithDimensions.go
0.547706
0.416144
filterJobWithDimensions.go
starcoder
package flexibletable import ( "errors" "fmt" "io" "strings" ) // ColumnConstraint specifies how a column should behave while being rendered. // Use positive to specify a maximum width for the column, or one of const // values for expandable width. type ColumnConstraint int const ( // Expandable is a special ...
go/flexibletable/table.go
0.70416
0.444263
table.go
starcoder
package maximum_depth_of_binary_tree import "math" /* 104. 二叉树的最大深度 https://leetcode-cn.com/problems/maximum-depth-of-binary-tree 给定一个二叉树,找出其最大深度。 二叉树的深度为根节点到最远叶子节点的最长路径上的节点数。 说明: 叶子节点是指没有子节点的节点。 示例: 给定二叉树 [3,9,20,null,null,15,7], 3 / \ 9 20 / \ 15 7 返回它的最大深度 3 。 */ //Definition for a binary...
solutions/maximum-depth-of-binary-tree/d.go
0.814496
0.414366
d.go
starcoder
package outlay import ( "fmt" "math" "gioui.org/f32" "gioui.org/layout" "gioui.org/op" "gioui.org/unit" ) type Fan struct { itemsCache []cacheItem last fanParams animatedLastFrame bool Animation // The width, in radians, of the full arc that items should occupy. // If zero, math.Pi/2...
outlay/fan.go
0.656988
0.494812
fan.go
starcoder
package gltf import "encoding/json" var ( // DefaultMatrix defines an identity matrix. DefaultMatrix = [16]float64{1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1} // DefaultRotation defines a quaternion without rotation. DefaultRotation = [4]float64{0, 0, 0, 1} // DefaultScale defines a scaling that does not mod...
vendor/github.com/qmuntal/gltf/const.go
0.642657
0.549036
const.go
starcoder
package decode import ( "github.com/cairnapp/go-geobuf/pkg/geojson" "github.com/cairnapp/go-geobuf/pkg/geometry" "github.com/cairnapp/go-geobuf/pkg/math" "github.com/cairnapp/go-geobuf/proto" ) func DecodeGeometry(geo *proto.Data_Geometry, precision, dimensions uint32) *geojson.Geometry { switch geo.Type { case...
pkg/decode/geometry.go
0.686055
0.435962
geometry.go
starcoder
package gofakeit import ( "errors" "strconv" "time" ) // Date will generate a random time.Time struct func Date() time.Time { return time.Date(Year(), time.Month(Number(0, 12)), Day(), Hour(), Minute(), Second(), NanoSecond(), time.UTC) } // DateRange will generate a random time.Time struct between a start and e...
time.go
0.756537
0.446736
time.go
starcoder
package recommendation import ( "sort" "gonum.org/v1/gonum/mat" "github.com/recoilme/recommendation/matrix" "github.com/yourbasic/bit" ) // Similarities maps a item to a list of similar items type Similarities []*bit.Set func intSliceBuilder(set *bit.Set) []int { ret := []int{} if set == nil { return ret ...
recommendation/similarities.go
0.778986
0.498169
similarities.go
starcoder
package models import ( i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91 "github.com/microsoft/kiota-abstractions-go/serialization" ) // Financials type Financials struct { // Stores additional data not described in the OpenAPI description found when deserializing. Can be used for serializat...
models/financials.go
0.604983
0.496277
financials.go
starcoder
package list //ItemPosition return position information about the given Item in the List. It returns a bool, true if it is in the List, false if not. //And returns a uint64 of the index of the Item, or if it isn't in the list, it is the length of the List. func (l *List) ItemPosition(search *Item, startIndex uint64, s...
list/algorithms.go
0.57523
0.448245
algorithms.go
starcoder
package ustr import ( "strings" ) // Uses a `Matcher` to determine whether `value` matches any one of the specified simple-`patterns`. func MatchesAny(value string, patterns ...string) bool { var m Matcher m.AddPatterns(patterns...) return m.IsMatch(value) } type matcherPattern struct { pattern, p...
util/str/matcher.go
0.638497
0.403567
matcher.go
starcoder
package assert import ( "fmt" "go/build" "os" "path/filepath" "reflect" "runtime" "strings" "testing" ) // Equal asserts given two values are equal. // If it's not equal, it logs the error trace. // It supports all the values supported by `reflect.DeepEqual` func Equal(t *testing.T, expected, got interface{}...
assert/assert.go
0.689933
0.45308
assert.go
starcoder
package cam import ( "math" "github.com/go-gl/mathgl/mgl32" "github.com/go-gl/mathgl/mgl64" "github.com/cstegel/opengl-samples-golang/materials/win" ) type FpsCamera struct { // Camera options moveSpeed float64 cursorSensitivity float64 // Eular Angles pitch float64 yaw float64 // Camera attributes po...
materials/cam/camera.go
0.781872
0.575648
camera.go
starcoder
package market_communication import ( "github.com/hochfrequenz/go-bo4e/bo" "github.com/hochfrequenz/go-bo4e/enum/botyp" "regexp" ) // receiverKey is the key for BOneyComb.Transaktionsdaten under which the 13 digit ID of the receiving Marktteilnehmer can be found const receiverKey = "Empfaenger" // senderKey is th...
market_communication/boney_comb_marktteilnehmer.go
0.593256
0.500427
boney_comb_marktteilnehmer.go
starcoder
package tree import ( . "github.com/Jcowwell/go-algorithm-club/Utils" "golang.org/x/exp/constraints" ) /* Binary Tree's Node Struct */ type BinaryTreeNode[T constraints.Ordered] struct { value T left *BinaryTreeNode[T] right *BinaryTreeNode[T] parent *BinaryTreeNode[T] } /* Method to return number of subno...
BinaryTree/binary_tree.go
0.777849
0.446676
binary_tree.go
starcoder
package table import ( "math" "github.com/pkg/errors" ) // column as discovered in the input text. It contains text start at from (inclusive) and ending // at to (exclusive) type column struct { from, to int } func (c *column) intersects(from, to int) bool { return c.to > from && to > c.from } func (c *column)...
columns.go
0.591959
0.419113
columns.go
starcoder
package cslb /* The status server presents a read-only web page of insights into cslb. This includes the contents of the SRV and health caches as well as the results of any health checks and connection attempts. There are default html templates uses to render the pages but most of these can be over-ridden with user-s...
status.go
0.708112
0.407333
status.go
starcoder
package types import ( "fmt" "sort" "github.com/attic-labs/noms/go/d" ) type Map struct { orderedSequence } func newMap(seq orderedSequence) Map { return Map{seq} } func mapHashValueBytes(item sequenceItem, rv *rollingValueHasher) { entry := item.(mapEntry) hashValueBytes(entry.key, rv) hashValueBytes(ent...
go/types/map.go
0.838151
0.451931
map.go
starcoder
package pipelines import ( "encoding/json" ) // PipelineStageInput An input used to create or replace a pipeline stage's definition. type PipelineStageInput struct { // A label used to organize pipeline stages in HubSpot's UI. Each pipeline stage's label must be unique within that pipeline. Label string `json:"la...
generated/pipelines/model_pipeline_stage_input.go
0.842798
0.490968
model_pipeline_stage_input.go
starcoder
package cluster import ( "golina/matrix" "math/rand" "time" ) type ObservationWithClusterID struct { ClusterID int Observation matrix.Vector } type ClusteredObservationSet []ObservationWithClusterID type DistFunc func(v1, v2 *matrix.Vector) float64 func nearestMean(means *matrix.Matrix, observation Observat...
cluster/kMeans.go
0.682785
0.70576
kMeans.go
starcoder
package leetcode /* * @lc app=leetcode id=980 lang=golang * * [980] Unique Paths III * * https://leetcode.com/problems/unique-paths-iii/description/ * * algorithms * Hard (76.94%) * Likes: 1139 * Dislikes: 83 * Total Accepted: 59.1K * Total Submissions: 76.8K * Testcase Example: '[[1,0,0,0],[0,0,0,...
leetcode/980.unique-paths-iii.go
0.908858
0.487002
980.unique-paths-iii.go
starcoder
package pagerduty import ( "reflect" "github.com/pkg/errors" "github.com/pulumi/pulumi/sdk/v2/go/pulumi" ) // A [service](https://v2.developer.pagerduty.com/v2/page/api-reference#!/Services/get_services) represents something you monitor (like a web service, email service, or database service). It is a container ...
sdk/go/pagerduty/service.go
0.713531
0.410579
service.go
starcoder
package tools import ( "bufio" "errors" "fmt" "log" "math" "path/filepath" "regexp" "strconv" "strings" "github.com/USACE/filestore" "github.com/dewberry/gdal" ) // GeoData ... type GeoData struct { Features map[string]Features Georeference int } // Features ... type Features struct { Rivers ...
tools/geospatial.go
0.708213
0.549218
geospatial.go
starcoder
// Package algorithm contain some basic algorithm functions. eg. sort, search, list, linklist, stack, queue, tree, graph. TODO package algorithm import "github.com/duke-git/lancet/v2/lancetconstraints" // Search algorithms see https://github.com/TheAlgorithms/Go/tree/master/search // LinearSearch Simple linear sear...
algorithm/search.go
0.614972
0.533762
search.go
starcoder
package runtime import ( "fmt" "reflect" "strconv" ) func makeInt(val interface{}) (int64, bool) { rval := reflect.ValueOf(val) switch rval.Kind() { case reflect.Int, reflect.Int32, reflect.Int64, reflect.Int16, reflect.Int8: return rval.Int(), true case reflect.String: if ival, err := strconv.ParseInt(rva...
runtime/cast.go
0.586878
0.443179
cast.go
starcoder
package continuous import ( "github.com/jtejido/stats" "github.com/jtejido/stats/err" "math" "math/rand" ) // Cauchy distribution // https://en.wikipedia.org/wiki/Cauchy_distribution type Cauchy struct { baseContinuousWithSource location, scale float64 // x₀, γ } func NewCauchy(location, scale float64) (*Cauch...
dist/continuous/cauchy.go
0.821438
0.441854
cauchy.go
starcoder
package astits import ( "fmt" "github.com/asticode/go-astilog" astibyte "github.com/asticode/go-astitools/byte" "github.com/pkg/errors" ) // PSI table IDs const ( PSITableTypeBAT = "BAT" PSITableTypeDIT = "DIT" PSITableTypeEIT = "EIT" PSITableTypeNIT = "NIT" PSITableTypeNull = "Null" PSI...
data_psi.go
0.674801
0.434821
data_psi.go
starcoder
package optimisation import "github.com/gonum/matrix/mat64" // BatchGradientDescent finds the local minimum of a function. // See http://en.wikipedia.org/wiki/Gradient_descent for more details. func BatchGradientDescent(x, y, theta *mat64.Dense, alpha float64, epoch int) *mat64.Dense { m, _ := y.Dims() for i := 0; ...
optimisation/gradient_descent.go
0.793506
0.678295
gradient_descent.go
starcoder
package binary_tree type BTreeNode struct { Data int Left, Right *BTreeNode } func NewBTreeNode(data int) *BTreeNode { return &BTreeNode{ Data: data, Left: nil, Right: nil, } } func (node *BTreeNode) IsNilNode() bool { if node == nil { return true } retur...
tree/binary_tree/binary_tree.go
0.52975
0.674017
binary_tree.go
starcoder
package xcl import ( "io" ) // World is an opaque structure that allows communication with FPGAs. type World struct { } // Program ways to lookup kernels type Program struct { world *World } // Kernel is a a function that runs on an FGPA. type Kernel struct { program *Program } // Memory represents a segment o...
template/vendor/github.com/ReconfigureIO/sdaccel/xcl/fake.go
0.682045
0.477493
fake.go
starcoder
package fson import ( "bytes" "encoding/json" "fmt" "io/ioutil" ) // Fson struct is the core structure, no exported members type Fson struct { Data map[string]interface{} } // MarshalJSON implementation for JSON encoding func (f *Fson) MarshalJSON() ([]byte, error) { return json.Marshal(f.Data) } // Unmarshal...
fson.go
0.675978
0.407687
fson.go
starcoder
package main import ( gocolor "image/color" "math" "math/rand" "sync" ) type ColoredPoint2D struct { X int Y int C gocolor.RGBA64 } type Point2D struct { X int Y int } func render(ray Ray, objects World, depth int) Vec3 { hit, material := objects.Hit(ray, 0.001, math.MaxFloat64) if hit != nil { if d...
cmd/weekend/main.go
0.670285
0.498535
main.go
starcoder
package got import ( "errors" "fmt" "reflect" "regexp" "strings" "sync/atomic" "github.com/ysmood/got/lib/utils" ) // Assertions helpers type Assertions struct { Testable must bool desc string d func(v interface{}) string // Options.Dump k func(string) string // Options.Keyword df func...
assertions.go
0.680348
0.452113
assertions.go
starcoder
package onshape import ( "encoding/json" ) // BTCylinderDescription686 struct for BTCylinderDescription686 type BTCylinderDescription686 struct { BTSurfaceDescription1564 Axis *BTVector3d389 `json:"axis,omitempty"` BtType *string `json:"btType,omitempty"` Origin *BTVector3d389 `json:"origin,omitempty"` Radius *...
onshape/model_bt_cylinder_description_686.go
0.746139
0.430806
model_bt_cylinder_description_686.go
starcoder
package varuint // Maximum number of bytes required to encode uint64. const MaxBufSize = 9 // Encode encodes a value into buf and returns the number of bytes written. // Buffer must have enough space to encode the value func Encode(buf []byte, v uint64) (n int) { switch { case v <= 240: buf[0] = byte(v) n = 1 ...
varuint.go
0.605449
0.468791
varuint.go
starcoder
package solution import "container/heap" /* leetcode: https://leetcode.com/problems/path-with-maximum-probability/ */ /* We use dijkstra to solve this problem. We go from start and check all connected node. After that we update cost if that cost > current cost of this node. We pick next largest one and contin...
lesson-13/dijkstra/1514-path-with-maximum-probability/solution.go
0.777384
0.437463
solution.go
starcoder
package effects import ( "fmt" "image" "math" "runtime" ) type gaussian struct { kernelSize int sigma float64 } // NewGaussian is an effect that applies a gaussian blur to the image func NewGaussian(kernelSize int, sigma float64) Effect { return &gaussian{ kernelSize: kernelSize, sigma: sigma, ...
pkg/effects/gaussian.go
0.838151
0.405979
gaussian.go
starcoder
package gokalman import ( "errors" "fmt" "math" "github.com/gonum/floats" "github.com/gonum/matrix/mat64" ) // ScaledIdentity returns an identity matrix time a scaling factor of the provided size. func ScaledIdentity(n int, s float64) *mat64.SymDense { vals := make([]float64, n*n) for j := 0; j < n*n; j++ { ...
helper.go
0.737631
0.475544
helper.go
starcoder
package indicators import "math" import _ "fmt" import _ "strconv" type mfloat []float64 // Avg returns 'data' average. func Avg(data []float64) float64 { return Sum(data) / float64(len(data)) } // Sum returns the sum of all elements of 'data'. func Sum(data []float64) float64 { var sum float64 for _, x := ra...
stats.go
0.706697
0.496765
stats.go
starcoder
package gorm import ( "fmt" "github.com/infobloxopen/atlas-app-toolkit/query" ) // FilterStringToGorm is a shortcut to parse a filter string using default FilteringParser implementation // and call FilteringToGorm on the returned filtering expression. func FilterStringToGorm(filter string, obj interface{}) (string...
gorm/filtering.go
0.650689
0.436562
filtering.go
starcoder
package command // Type describes a command type type Type struct { Name string Write bool } var ( // Decrement decrements the integer value of a key by one. Decrement = Type{"DECR", true} // DecrementBy decrements the integer value of a key by the given number. DecrementBy = Type{"DECRBY", true} // Delete ...
nbd/ardb/command/type.go
0.656878
0.523055
type.go
starcoder