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 main import ( "fmt" "github.com/vodinhphuc/golearn/base" "github.com/vodinhphuc/golearn/trees" ) func main() { /* Performance of CART Algorithm: Training Time for Titanic Dataset ≈ 611 µs Prediction Time for Titanic Datset ≈ 101 µs Complexity Analysis: 1x Dataset -- x ms 2x Dataset -- ...
examples/trees/cart/cart.go
0.662469
0.507934
cart.go
starcoder
package base import ( "math" "github.com/eriq-augustine/goml/util" ) // Discretize each feature (column (data point index)) on it's own scale. // This allows features of diffferent ranges (say a percentage (0 - 1) and // absolute value (any value (perhaps -1 - 300)) to reside next to each other // without bein...
base/discretize.go
0.754644
0.430566
discretize.go
starcoder
package dagger import ( "github.com/autom8ter/dagger/util" ) // Edge is a relationship between two nodes type Edge struct { // An edge implements Node because it has an Identifier and attributes Node `json:"node"` // From returns the root node of the edge From Path `json:"from"` // To returns the target node of...
model.go
0.777046
0.481332
model.go
starcoder
package events import ( "fmt" "sort" "strings" "time" "github.com/go-kit/log" "github.com/go-kit/log/level" ) // Scheduler holds timeSlice objects and provides an methods to update them.. type Scheduler struct { logger log.Logger timeSlice *TimeSlice } // TimeSlice is an association between a specific ti...
pkg/events/schedule.go
0.712232
0.402304
schedule.go
starcoder
package trie import "container/list" // Tree implemnets ternary trie-tree. type Tree struct { // Root is root of the tree. Only Child is valid. Root Node // nc means node counts nc int } // New creates a Tree. func New() *Tree { return new(Tree) } // Get retrieves a value for key. func (tr *Tree) Get(key stri...
tree.go
0.65379
0.495056
tree.go
starcoder
package iso20022 // Specifies rates. type CorporateActionRate4 struct { // Rate used to calculate the amount of the charges/fees that cannot be categorised. ChargesFees *RateAndAmountFormat5Choice `xml:"ChrgsFees,omitempty"` // Dividend is final. FinalDividendRate *ActiveCurrencyAnd13DecimalAmount `xml:"FnlDvddR...
CorporateActionRate4.go
0.873647
0.698687
CorporateActionRate4.go
starcoder
package zapcore import ( "bytes" "fmt" "math" "reflect" "time" ) // A FieldType indicates which member of the Field union struct should be used // and how it should be serialized. type FieldType uint8 //定义字段的类型 const ( // UnknownType is the default field type. Attempting to add it to an encoder will panic. ...
zapcore/field.go
0.520984
0.414603
field.go
starcoder
package generators import ( "fmt" "image" "image/color" "math" "os" "../tools" ) func tunnelCreateColor(i int) color.RGBA64 { nbColors := cycles nbAvailableColors := len(colors) nbColorsByIndex := nbColors / nbAvailableColors currentIndex := i * nbAvailableColors / nbColors nextIndex := currentIndex + 1 ...
generators/g_automoveCenterLines.go
0.569972
0.430207
g_automoveCenterLines.go
starcoder
package ask import ( "math" "reflect" "regexp" "strconv" "strings" ) var tokenMatcher = regexp.MustCompile("([^[]+)?(?:\\[(\\d+)])?") // Answer holds result of call to For, use one of its methods to extract a value. type Answer struct { value interface{} } // For is used to select a path from source to return...
ask.go
0.716417
0.425307
ask.go
starcoder
package newznab import ( "net/url" "time" ) // TV is a Content implementation that describes an episode of a TV // series type TV struct { // air date for the episode according to the entry AirDate time.Time // ID for the entry for the episode in TheTVDB TVDBID int64 // ID for the entry for the episode in TVRa...
newznab/content.go
0.643665
0.408218
content.go
starcoder
package geoip2 import ( "errors" "strconv" ) type Metadata struct { NodeCount uint32 // node_count This is an unsigned 32-bit integer indicating the number of nodes in the search tree. RecordSize uint16 // record_size This is an unsigned 16-bit integer. It indica...
vendor/github.com/IncSW/geoip2/metadata.go
0.628749
0.551815
metadata.go
starcoder
package backend import ( "math" "sort" "github.com/iliyanmotovski/raytracer/backend/vector" ) // Particle represents a point from where rays of "light" emit type Particle struct { Pos *vector.Vector Rays Rays } // Creates new Particle with given position and sets directory of 8 base rays // to the 4 corners o...
backend/particle.go
0.857306
0.713132
particle.go
starcoder
package pg_query import "encoding/json" /* * SubPlan - executable expression node for a subplan (sub-SELECT) * * The planner replaces SubLink nodes in expression trees with SubPlan * nodes after it has finished planning the subquery. SubPlan references * a sub-plantree stored in the subplans list of the toplev...
vendor/github.com/lfittl/pg_query_go/nodes/sub_plan.go
0.643441
0.513546
sub_plan.go
starcoder
package lfsr import ( "time" ) // Lfsr8 represents an 8 bit linear feedback shift register type Lfsr8 struct { state uint8 seed uint8 } // NewLfsr8 returns a linear feedback shift register initialized with the specified seed. If the seed is zero the seed is initialized using the current time. func NewLfsr8(seed...
lfsr.go
0.888002
0.53048
lfsr.go
starcoder
package iex import ( "fmt" "time" ) // HistoricalTimeFrame enum for selecting time frame of historical data type HistoricalTimeFrame string const ( // FiveDayHistorical Five days historically adjusted market-wide data FiveDayHistorical HistoricalTimeFrame = "5d" // FiveDay10MinuteHistorical Five days historica...
historical.go
0.729038
0.535524
historical.go
starcoder
package algorithms import ( "bytes" "log" "math" "strconv" ) type Direction int const ( Diag Direction = 0 Up Direction = 1 Left Direction = 2 Stop Direction = 3 // Only used for S-W algorithm ) func minimum4(element1 int, element2 int, element3 int, element4 int) int { return int(math.Min(float64(elemen...
algorithms/utils.go
0.645679
0.506469
utils.go
starcoder
package imgui // #cgo CXXFLAGS: -std=c++11 // #include "wrapper/implotWrapper.h" import "C" import "unsafe" // The following functions MUST be called BEFORE BeginPlot! // Set the axes range limits of the next plot. Call right before BeginPlot(). If ImGuiCond_Always is used, the axes limits will be locked. func ImPlot...
implot.go
0.699152
0.449393
implot.go
starcoder
package propertydb import ( "testing" "github.com/stretchr/testify/assert" ) func defaultCity() City { return City("Town") } func defaultAddress() StreetAddress { return StreetAddress("Address 1") } func defaultInfo() Info { return Info{ PriceAsking: 12, PriceFinal: 14, Type: ...
pkg/propertydb/validate.go
0.629888
0.487795
validate.go
starcoder
package list import "github.com/rickb777/golist/internal/collection" const List = collection.Collection + ` //------------------------------------------------------------------------------------------------- // {{.TName}}List is a slice of type {{.PName}}. Use it where you would use []{{.PName}}. // List values foll...
internal/list/list.go
0.649023
0.415195
list.go
starcoder
package builtin import ( "errors" "fmt" "github.com/fission/fission-workflows/pkg/types" "github.com/fission/fission-workflows/pkg/types/typedvalues" "github.com/fission/fission-workflows/pkg/types/typedvalues/controlflow" ) const ( Foreach = "foreach" ForeachInputForeach = "foreach" Foreac...
pkg/fnenv/native/builtin/foreach.go
0.532425
0.553083
foreach.go
starcoder
package query import ( "github.com/awslabs/smithy-go/httpbinding" "math/big" "net/url" ) // Value represents a Query Value type. type Value struct { // The query values to add the value to. values url.Values // The value's key, which will form the prefix for complex types. key string // Whether the value shou...
vendor/github.com/aws/aws-sdk-go-v2/aws/protocol/query/value.go
0.895263
0.40751
value.go
starcoder
package arithmetic import ( "reflect" ) // An Operander is a value that can be represented as an arithmetic operand. type Operander interface { Val() float64 } // Add gets any number of elements and returns their addition. func Add(operanders ...interface{}) float64 { if len(operanders) < 1 { return 0 } res...
reflect/arithmetic/arithmetic.go
0.847936
0.549822
arithmetic.go
starcoder
package tmplfunc import ( "fmt" "reflect" ) func indirect(v reflect.Value) reflect.Value { for ; v.Kind() == reflect.Ptr || v.Kind() == reflect.Interface; v = v.Elem() { } return v } func numOrStr(k reflect.Kind) bool { return isNum(k) || isStr(k) } func isNum(k reflect.Kind) bool { return isInt(k) || isUin...
code/pkg/tmplfunc/operand.go
0.503174
0.407039
operand.go
starcoder
package fp func (l BoolArray) DropRight(n int) BoolArray { size := len(l) Require(n >= 0, "index should be >= 0") if n >= size { n = size } to := size - n acc := make([]bool, to) copy(acc, l[0: to]) return acc } func (l StringArray) DropRight(n int) StringArray { size := len(l) Require(n >= 0, "ind...
fp/bootstrap_array_dropright.go
0.647798
0.598606
bootstrap_array_dropright.go
starcoder
package lucicfg import ( "fmt" "time" "go.starlark.net/starlark" "go.starlark.net/syntax" ) var zero = starlark.MakeInt64(0) // duration wraps an integer, making it a distinct integer-like type. type duration struct { starlark.Int // milliseconds } // Type returns 'duration', to make the type different from ...
lucicfg/duration.go
0.804021
0.428831
duration.go
starcoder
package assets import ( "errors" "fmt" "strings" "sync" ) var ( ErrNotFound = errors.New("could not find an element matching the request") ) // FilterNodes s used to provide custom filters to when listing nodes type FilterNodes func(node Node) bool // FilterNodesByLabel filters all nodes with a given label fun...
graph.go
0.713032
0.411347
graph.go
starcoder
package eoy import ( "fmt" "time" ) //Year is used to provide a primary key for storing stats by year. type Year struct { ID int CreatedDate *time.Time } //YearResult holds a year and a stats record. type YearResult struct { ID int Stat } //YOYear is used to provide a primary key for storing stats by...
pkg/year.go
0.598899
0.443661
year.go
starcoder
package p564 import ( "strconv" ) /** Given an integer n, find the closest integer (not including itself), which is a palindrome. The 'closest' is defined as absolute difference minimized between two integers. Example 1: Input: "123" Output: "121" Note: The input n is a positive integer represented by string, who...
algorithms/p564/564.go
0.807499
0.438545
564.go
starcoder
package utils import ( "fmt" "math" "sync" "gonum.org/v1/gonum/lapack/lapack64" "gonum.org/v1/gonum/blas/blas64" "gonum.org/v1/gonum/mat" ) type Matrix struct { M *mat.Dense readOnly bool name string DataP []float64 } var ( I, Zero Matrix ) func init() { I = NewMatrix(1, 1, []float64{1....
utils/matrix_extended.go
0.621311
0.40645
matrix_extended.go
starcoder
package clpwrapper import ( "github.com/james-bowman/sparse" "github.com/lanl/clp" "gonum.org/v1/gonum/floats/scalar" "gonum.org/v1/gonum/mat" ) // GoNumMatrixToCLPPackedMatrix converts a likely-sparse mat.Matrix into a CoinPackedMatrix func GoNumMatrixToCLPPackedMatrix(matrix mat.Matrix) *clp.PackedMatrix { ret...
wrappers.go
0.832169
0.616878
wrappers.go
starcoder
package areas /* BuildCache - queries all Residential Property listings, grabs their (locations) community, municipality and area columns and puts all unique values in a slice called Slice. OneLetterMap - every unique letter (made lower case) from all locations are added to this map as keys, the value of each key is...
app/areas/cache.go
0.63409
0.502197
cache.go
starcoder
package bulletproofs import ( "errors" "math/big" "github.com/ing-bank/zkrp/crypto/p256" "github.com/ing-bank/zkrp/util/bn" ) /* VectorCopy returns a vector composed by copies of a. */ func VectorCopy(a *big.Int, n int64) ([]*big.Int, error) { var ( i int64 result []*big.Int ...
crypto/vendor/ing-bank/zkrp/bulletproofs/vector.go
0.687945
0.536252
vector.go
starcoder
package ptime import( "fmt" "time" "math" "sort" ) type Location struct{ Lat float64 Long float64 Tz int } type Method struct{ name string number float64 } type PrayerTime struct{ Label string Time float64 method Method } type PrayerTimes []PrayerTime func (p PrayerTimes) Len() int{ return len(p) } fu...
ptime.go
0.553143
0.512266
ptime.go
starcoder
package main import ( "fmt" "io/ioutil" "time" "github.com/loov/hrtime" "github.com/loov/plot" ) func main() { DensityPlot() PercentilesPlot() TimingPlot() StackedPlot() } // N is the number of experiments const N = 5000 // TimingPlot demonstrates how to plot timing values based on the order. func TimingP...
_example/plotting/main.go
0.756717
0.492798
main.go
starcoder
package linalg import ( "fmt" "math" ) const ( NEARLY_EQUAL_TOLERANCE = 0.00001 ) type VectorStructure []float64 func NewVector(values []float64) VectorStructure { vector := make(VectorStructure, 0) return append(vector, values...) } func (v VectorStructure) Size() int { return len(v) } func (v VectorStruct...
main.go
0.690976
0.646906
main.go
starcoder
package names import ( "strings" ) // Name represents a name formed of multiple words. It is inteded to simplify the use of different // strategies for representing names as strings, like using different separators or using camel // case. The workds that form the name are stored separated, so there is no need to par...
pkg/names/name.go
0.841696
0.41253
name.go
starcoder
package debiaser import ( "fmt" "log" "math" "sort" "gonum.org/v1/gonum/floats" "gonum.org/v1/gonum/mat" "github.com/JaderDias/movingmedian" ) // Debiaser implements inplace removal of bias from a mat64 of (scaled) values. type Debiaser interface { Debias(*mat.Dense) } // Sorter provides method to sort and...
dcnv/debiaser/debiaser.go
0.615088
0.437884
debiaser.go
starcoder
package compiler import "golang.org/x/sys/unix" type shift int func (c *compilerContext) isLongJump(jumpSize int) bool { return jumpSize > c.maxJumpSize } func hasLongJump(index int, jts, jfs map[int]int) bool { // Using the unshifted index to look up positions in jts and jfs is // only safe if we're iterating b...
vendor/github.com/twtiger/gosecco/compiler/jumps.go
0.522202
0.438905
jumps.go
starcoder
package cli import ( "fmt" "github.com/iskendria-pub/iskendria/util" "reflect" "strings" ) /* This package implements a generic interactive command-line interface. To use it, fill a cli.Cli struct with help text and instances of Handler. Then call the Run method. See trycli/interactive.go to see how the cli packa...
cli/cli.go
0.687945
0.449997
cli.go
starcoder
package linkedlist import ( "errors" ) type LinkedList struct { firstNode *LinkedListNode lastNode *LinkedListNode } type LinkedListNode struct { NextNode *LinkedListNode Value interface{} } // Appends a node to the singly linked list func (ll *LinkedList) Append(data interface{}) *LinkedList { if ll.firs...
data_structures/linked_list/linked_list.go
0.714528
0.426979
linked_list.go
starcoder
package instrumentation import "time" // NopInstrumentation satisfies the Instrumentation interface. type NopInstrumentation struct{} // Satisfaction guaranteed. var _ Instrumentation = NopInstrumentation{} // InsertCall satisfies the Instrumentation interface. func (i NopInstrumentation) InsertCall() {} // Insert...
instrumentation/nop_instrumentation.go
0.725065
0.592932
nop_instrumentation.go
starcoder
package physics import ( "fmt" "image/color" "math" "os" // anonymous import for png decoder _ "image/png" "github.com/hajimehoshi/ebiten/v2" "github.com/hajimehoshi/ebiten/v2/ebitenutil" "github.com/jtbonhomme/asteboids/internal/vector" ) // ID displays physic body unique ID. func (pb *Body) ID() string {...
internal/physics/utils.go
0.7696
0.508849
utils.go
starcoder
package scimark2 import ( "math" "math/rand" "time" "github.com/EntityFX/EntityFX-Bench/src/go/entityfx/utils" ) func measureFFT(N int, mintime float64) float64 { x := randomVector(2 * N) //oldx := newVectorCopy(x) var cycles int64 = 1 elapsed := 0.0 for true { start := (float64(utils.MakeTimestamp()) / 10...
src/go/entityfx/scimark2/kernel.go
0.528533
0.417865
kernel.go
starcoder
package smudge func decodeByte(bytes []byte, startIndex int) (byte, int) { return bytes[startIndex], startIndex + 1 } func decodeUint8(bytes []byte, startIndex int) (uint8, int) { n, i := decodeByte(bytes, startIndex) return byte(n), i } func decodeUint16(bytes []byte, startIndex int) (uint16, int) { var numbe...
vendor/github.com/clockworksoul/smudge/bytes.go
0.657098
0.413655
bytes.go
starcoder
package kriging import ( "sort" vec2d "github.com/flywave/go3d/float64/vec2" vec3d "github.com/flywave/go3d/float64/vec3" "github.com/flywave/go-geo" ) type Coordinates []vec3d.T func (s Coordinates) Len() int { return len(s) } func (s Coordinates) Less(i, j int) bool { if s[i][1] == s[j][1] { return s[i]...
grid.go
0.817829
0.471588
grid.go
starcoder
package exp // using tree data structure to parse and evaluate mathematical expressions // precedence by power, division, multiplication, addition, and subtraction import ( "fmt" "math" "strconv" "github.com/dockerian/go-coding/ds/str" u "github.com/dockerian/go-coding/utils" ) var ( /* see https://golang.org...
ds/exp/exp.go
0.608012
0.47859
exp.go
starcoder
package main import ( "bytes" "fmt" "go/ast" ) /* We want to find any types used in interface methods that are defined in the interface package, and so aren't qualified by a package name. We may want to add a package name to these types. We're looking for Fields within Fieldlists (either for parameters or return...
genmock/localtypes.go
0.5769
0.471467
localtypes.go
starcoder
package blueprint import ( "encoding/json" "io/ioutil" "math" "strings" rand7i "github.com/7i/rand" "github.com/karlek/wasabi/coloring" "github.com/karlek/wasabi/fractal" "github.com/karlek/wasabi/iro" "github.com/karlek/wasabi/mandel" "github.com/karlek/wasabi/plot" "github.com/karlek/wasabi/render" "g...
blueprint/blueprint.go
0.620047
0.523968
blueprint.go
starcoder
package main import ( "encoding/json" "fmt" "math" "net/http" "strconv" ) // CalculationResult represents the data structure for the API response containing the calculated credits. type CalculationResult struct { Credits float64 } // CalculationError represents the error case if something goes wrong while calc...
converter/main.go
0.716119
0.418519
main.go
starcoder
package inference // Disease is the representation of the diseases data in this Expert System. type Disease struct { ID string `json:"id"` // Disease ID Name string `json:"name"` // Name of the disease Description string `json:"description"` // Description ...
pkg/inference/inference.go
0.839537
0.577912
inference.go
starcoder
package matrix import "errors" // ZeroMatrix make all value 0 func (m *Matrix) ZeroMatrix() (matrix *Matrix) { matrix = Copy(m) matrix.matrix = make([]float64, m.row*m.column) return } // AddRowMatrix will add matrix behinde this matrix func (m *Matrix) addRowMatrix(mat Matrix) error { if m.column != mat.column ...
operation.go
0.661704
0.728953
operation.go
starcoder
package anansi import ( "image" "github.com/jcorbin/anansi/ansi" ) // Grid is a grid of screen cells. type Grid struct { Rect ansi.Rectangle Stride int Attr []ansi.SGRAttr Rune []rune // TODO []string for multi-rune glyphs } // Resize the grid to have room for n cells. // Returns true only if the resiz...
grid.go
0.543833
0.458046
grid.go
starcoder
package platformsnotificationevents import ( "encoding/json" ) // ViasAddress struct for ViasAddress type ViasAddress struct { // The name of the city. >Required if either `houseNumberOrName`, `street`, `postalCode`, or `stateOrProvince` are provided. City *string `json:"city,omitempty"` // The two-character cou...
src/platformsnotificationevents/model_vias_address.go
0.8321
0.421969
model_vias_address.go
starcoder
package projecteuler // DigitalNumber is immutable structure containing number and it's digits type DigitalNumber struct { x int digits []byte } // NewDigitalNumber constructs new DigitalNumber func NewDigitalNumber(x int) (newDn DigitalNumber) { newDn = DigitalNumber{x: x} for x > 0 { currDigit := byte(x...
digitalNumber.go
0.830113
0.586582
digitalNumber.go
starcoder
package timemath import ( "time" ) // Unit the time unit type Unit rune var ( // Year the unit. Year Unit = 'y' // Month the unit. Month Unit = 'M' // Week the unit. Week Unit = 'w' // Day the unit. Day Unit = 'd' // Hour the unit. Hour Unit = 'h' // Minute the unit. Minute Unit = 'm' // Second the uni...
math.go
0.658747
0.549097
math.go
starcoder
package protoutil import ( "fmt" "strconv" "time" pb "code.sajari.com/protogen-go/sajari/engine/v2" structpb "github.com/golang/protobuf/ptypes/struct" ) func FromProto(v *pb.Value) (interface{}, error) { switch v := v.Value.(type) { case *pb.Value_Single: return v.Single, nil case *pb.Value_Repeated_: ...
internal/protoutil/protoutil.go
0.596668
0.417806
protoutil.go
starcoder
package desync // Converters are modifiers for chunk data, such as compression or encryption. // They are used to prepare chunk data for storage, or to read it from storage. // The order of the conversion layers matters. When plain data is prepared for // storage, the toStorage method is used in the order the layers a...
coverter.go
0.75392
0.515071
coverter.go
starcoder
package lm import ( "fmt" "github.com/barnex/fmath" ) type Mat4x4 [16]float32 func (m *Mat4x4) Pointer() *[16]float32 { return (*[16]float32)(m) } func (m *Mat4x4) Slice() []float32 { return m[:] } func (m *Mat4x4) String() string { return fmt.Sprintf("[%f,%f,%f,%f,\n %f,%f,%f,%f,\n %f,%f,%f,%f,\n %f,%f,%f...
mat4x4.go
0.609175
0.523359
mat4x4.go
starcoder
package cubebit import ( "image/color" "github.com/9600org/go-rpi-ws281x" ) // Cubebit represents an instance of the Cube:Bit hardware. type Cubebit struct { canvas *ws281x.Canvas sizeX int sizeY int sizeZ int } // New creates a new Cubebit instance. // config passes the details of the hardware to the unde...
cubebit.go
0.787686
0.445288
cubebit.go
starcoder
package render import ( "context" "strings" "github.com/weaveworks/scope/report" ) // KubernetesVolumesRenderer is a Renderer which combines all Kubernetes // volumes components such as stateful Pods, Persistent Volume, Persistent Volume Claim, Storage Class. var KubernetesVolumesRenderer = MakeReduce( VolumesRe...
deepfence_agent/tools/apache/scope/render/persistentvolume.go
0.708112
0.433442
persistentvolume.go
starcoder
package testes import ( "fmt" "reflect" "testing" "github.com/skeptycal/types" ) var NewAnyValue = types.NewAnyValue const ( assertEqual = "AssertEqual(%v): got %v, want %v" assertNotEqual = "AssertNotEqual(%v): got %v, want %v" assertDeepEqual = "AssertDeepEqual(%v): got %v, want %v" assertSameType =...
assert.go
0.670069
0.466542
assert.go
starcoder
package hr2d // Use dynamic programming to determine maximum value func SolveDP(R, C int, table [][]int) (int) { alignments := generate_alignments(C) pairs := generate_alignment_pairs(alignments) N := len(alignments) // predecessors array each index p[i][j] is the index of the // alignment from the previous row...
hr2d/hr2d.go
0.788094
0.454533
hr2d.go
starcoder
package vtree import ( "bytes" "sort" ) // Node represents an immutable node in the radix tree which // can be either an edge node or a leaf node. type Node struct { leaf *leaf edges []*Node prefix []byte } type leaf struct { key []byte val *Item } // Min returns the key and value of the minimum item in ...
node.go
0.745861
0.451992
node.go
starcoder
package xrand import ( "encoding/binary" "fmt" "math" "math/bits" "time" ) // https://prng.di.unimi.it/xoshiro256starstar.c type Xoshiro256ss struct { s [4]uint64 } func NewXoshiro256ss(seed int64) *Xoshiro256ss { x := Xoshiro256ss{} x.Seed(seed) return &x } func (x Xoshiro256ss) State() []byte { s := ma...
xoshiro256ss.go
0.524151
0.454109
xoshiro256ss.go
starcoder
package datablocks import ( "columns" "datatypes" "base/errors" ) type DataBlock struct { info *DataBlockInfo seqs []*datatypes.Value values []*ColumnValue immutable bool valuesmap map[string]*ColumnValue } func NewDataBlock(cols []columns.Column) *DataBlock { var values []*ColumnValue value...
src/datablocks/datablock.go
0.557845
0.486697
datablock.go
starcoder
package ecvrf import ( "bytes" "crypto/elliptic" "crypto/hmac" "errors" "hash" "math/big" ) type point struct { X, Y *big.Int } type core struct { *Config curve elliptic.Curve cachedHasher hash.Hash } // Q returns prime order of large prime order subgroup. func (c *core) Q() *big.Int { return c.c...
core.go
0.815894
0.40592
core.go
starcoder
package colorful import ( "math" ) // Converts the given color to LuvLCh space using D65 as reference white. // h values are in [0..360], C and L values are in [0..1] although C can overshoot 1.0 func (col Color) LuvLCh() (l, c, h float64) { return col.LuvLChWhiteRef(D65) } func LuvToLuvLCh(L, u, v float64) (l, c,...
colorful/cs_luvlch.go
0.858867
0.558327
cs_luvlch.go
starcoder
func uniquePathsMemo(m int, n int) int { memo := make([][]int, m) for row := range memo { memo[row] = make([]int, n) } var dfs func(int, int) int dfs = func(r, c int) int { if numPaths := memo[r][c]; numPaths !=0 { return numPaths } switch { case...
unique-paths/unique-paths.go
0.619586
0.404802
unique-paths.go
starcoder
package date import ( "database/sql/driver" "fmt" "time" ) // Date specifies a date without time (only year, month and day). // Internally it represents a time.Time instant with zero UTC time parts. // The zero value of the struct is represented as "0001-01-01". type Date struct { t time.Time } // NewDate create...
date.go
0.842604
0.637736
date.go
starcoder
package stripe import ( "net/url" "reflect" "strconv" ) // addParamsToValues takes an interface (usually *SomeTypeParams) and a pointer // to a url.Values. It iterates over each field in the interface (using // the attributes method), and adds the value of each field to the url.Values. func addParamsToValues(param...
stripe/utils.go
0.617628
0.449936
utils.go
starcoder
package slippy import ( "math" "github.com/go-spatial/geom" ) func NewTile(z, x, y uint, buffer float64, srid uint64) *Tile { return &Tile{ z: z, x: x, y: y, Buffer: buffer, SRID: srid, } } // Tile describes a slippy tile. type Tile struct { // zoom z uint // column x uint // row...
vendor/github.com/go-spatial/geom/slippy/tile.go
0.743913
0.577346
tile.go
starcoder
package htmldiff import ( "github.com/mb0/diff" "golang.org/x/net/html" ) // treeRune holds an individual rune in the HTML along with the node it is in and, for convienience, its position (if in a container). type treeRune struct { leaf *html.Node letter rune pos posT } // diffData is a type that exists i...
treerunes.go
0.529507
0.534673
treerunes.go
starcoder
package test_persistence import ( "testing" data1 "github.com/pip-services-samples/service-beacons-go/data/version1" persist "github.com/pip-services-samples/service-beacons-go/persistence" cdata "github.com/pip-services3-go/pip-services3-commons-go/data" "github.com/stretchr/testify/assert" ) type BeaconsPersi...
test/persistence/BeaconsPersistenceFixture.go
0.658527
0.558628
BeaconsPersistenceFixture.go
starcoder
package golsp import ( "strings" "strconv" "unicode" "fmt" ) type OperatorType int const ( OperatorTypeSpread OperatorType = 0 OperatorTypeZip OperatorType = 1 OperatorTypeDot OperatorType = 2 ) var Operators = []string{"...", ":", "."} var OperatorTypes = map[string]OperatorType{ "...": OperatorTypeSpread,...
core/parser.go
0.609524
0.461199
parser.go
starcoder
package wad // Currency is a currency type. type Currency struct { // Code is the currency code (e.g. usd) Code string `json:"code"` // Countries is csv list of countries Countries string `json:"countries"` // Decimals is the number of decimals in currency Decimals int `json:"decimals"` // IsoNum is the iso co...
moneysocket/wad/fiat.go
0.516352
0.483344
fiat.go
starcoder
package raft import ( "errors" "log" "sync" pb "github.com/ridwanmsharif/raft/pb" ) // Storage is an interface that may be implemented by the users // of the distributed application to retrieve log entries from storage. // If any Storage method returns an error, the raft instance will // become inoperable and re...
raft/storage.go
0.571169
0.427875
storage.go
starcoder
package tracer import ( "image" "math" "math/rand" "sync" "github.com/go-gl/mathgl/mgl64" ) func LinearInterpolation(t float64, color1, color2 mgl64.Vec3) mgl64.Vec3 { return color1.Mul(1.0 - t).Add(color2.Mul(t)) } func BackgroundColor(ray Ray) mgl64.Vec3 { unitDirection := ray.Direction.Normalize() t := 0...
render.go
0.805135
0.52208
render.go
starcoder
package _98_Validate_Binary_Search_Tree import "math" /*https://leetcode.com/problems/validate-binary-search-tree/ Given a binary tree, determine if it is a valid binary search tree (BST). Assume a BST is defined as follows: The left subtree of a node contains only nodes with keys less than the node's key. The rig...
98_Validate_Binary_Search_Tree/solution.go
0.912565
0.522994
solution.go
starcoder
package stepflowae import ( "context" "encoding/json" "errors" "fmt" stepflow "github.com/jcalvarado1965/go-stepflow" "google.golang.org/appengine/datastore" "google.golang.org/appengine/memcache" ) type appengineStorage struct { Logger stepflow.Logger } const dataflowRunKind = "DataflowRun" const flowKind ...
storage.go
0.580709
0.442697
storage.go
starcoder
package main /***************************************************************************************************** * * There are a total of numCourses courses you have to take, labeled from 0 to numCourses-1. * * Some courses may have prerequisites, for example to take course 0 you have to first take course 1, *...
basic/Algorithm/graph/207.course_schedule/207.CourseSchedule_zhangsl.go
0.564098
0.584271
207.CourseSchedule_zhangsl.go
starcoder
package render3d import ( "github.com/galaco/lambda-core/mesh" ) // Compositor is a struct that provides a mechanism to compose 1 or more models into a single renderable set of data, // indexed by material. // This is super handy for reducing draw calls down a bunch. // A resultant Composition should result in a sin...
internal/renderer/render3d/compositor.go
0.611498
0.552178
compositor.go
starcoder
package govaluate // boolFilter is used gather the information about evaluationStage`s which resulted boolean value type boolFilter struct { boundTrue *boundBoolFilter boundFalse *boundBoolFilter } func newBoolFilter(cap int) *boolFilter { return &boolFilter{ boundTrue: newBoundBoolFilter(cap, true), boundFa...
boolFilter.go
0.739046
0.402157
boolFilter.go
starcoder
package agent import ( "container/heap" "github.com/joyrex2001/nightshift/internal/scanner" ) // objectspq is the priority queue that contains objects found by the scanners. // Each scanner has a priority and Objects found with these scanners take the // same priority. The highest priority takes precedence over ea...
internal/agent/objects.go
0.705481
0.496826
objects.go
starcoder
package object import "errors" type Comparable interface { // Compare methods // Eq returns true if the left Object is equal to the right Object. Eq(Object) (Boolean, error) // Neq returns true if the left Object is not equal to the right Object. Neq(Object) (Boolean, error) // Less returns true if the left Obj...
pkg/object/comparable.go
0.862699
0.498535
comparable.go
starcoder
package gofa // Angle // Operations on Angles /* Anp Normalize angle into the range 0 <= a < 2pi. Given: a float64 angle (radians) Returned (function value): float64 angle in range 0-2pi */ func Anp(a float64) float64 { var w float64 w = fmod(a, D2PI) if w < 0 { w += D2PI } return w...
angle.go
0.756537
0.647659
angle.go
starcoder
package chart import ( "fmt" util "github.com/wcharczuk/go-chart/util" ) const ( // DefaultSimpleMovingAveragePeriod is the default number of values to average. DefaultSimpleMovingAveragePeriod = 16 ) // SMASeries is a computed series. type SMASeries struct { Name string Style Style YAxis YAxisType Period...
vendor/github.com/wcharczuk/go-chart/sma_series.go
0.868493
0.504272
sma_series.go
starcoder
// Package mhf provides an interface to memory hard functions, a.k.a password key derivation functions. package mhf import "errors" var errParams = errors.New("invalid amount of parameters") // Identifier is used to specify the memory hard function to be used. type Identifier byte const ( // Argon2id password kdf...
mhf/mhf.go
0.788949
0.420243
mhf.go
starcoder
package goble // A dictionary of known characteristic names and type (keyed by characteristic uuid) var knownCharacteristics = map[string]struct{ Name, Type string }{ "2a00": {Name: "Device Name", Type: "org.bluetooth.characteristic.gap.device_name"}, "2a01": {Name: "Appearance", Type: "org.bluetooth.characteristic....
vendor/github.com/raff/goble/characteristics.go
0.53437
0.401013
characteristics.go
starcoder
// Copyright 2015 The Go Authors. All rights reserved. // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. // terribly slow on wasm // +build !wasm package main import ( "fmt" "math/big" "unsafe" ) var one = big.NewInt(1) type _type struct { name string b...
test/fixedbugs/issue9604b.go
0.667798
0.469642
issue9604b.go
starcoder
package schema import ( "fmt" "github.com/vmware-tanzu/carvel-ytt/pkg/filepos" "github.com/vmware-tanzu/carvel-ytt/pkg/yamlmeta" ) // Type encapsulates a schema that describes a yamlmeta.Node. type Type interface { AssignTypeTo(node yamlmeta.Node) TypeCheck CheckType(node yamlmeta.Node) TypeCheck GetValueTyp...
vendor/github.com/vmware-tanzu/carvel-ytt/pkg/schema/type.go
0.636805
0.406126
type.go
starcoder
package ridl // NodeType represents the type of a parser tree node. type NodeType uint const ( RootNodeType NodeType = iota TokenNodeType DefinitionNodeType ImportNodeType EnumNodeType MessageNodeType ArgumentNodeType MethodNodeType ServiceNodeType ) // Node represents a parser tree node type Node interface...
schema/ridl/parser_node.go
0.689724
0.474996
parser_node.go
starcoder
package main import "fmt" /* Given an array of integers nums sorted in ascending order, find the starting and ending position of a given target value. Your algorithm's runtime complexity must be in the order of O(log n). If the target is not found in the array, return [-1, -1]. Example 1: Input: nums = [5,7,7,8,...
Programs/034Find First and Last Position of Element in Sorted Array/034Find First and Last Position of Element in Sorted Array.go
0.593256
0.673988
034Find First and Last Position of Element in Sorted Array.go
starcoder
// +build !wasm package audio import ( "github.com/adamlenda/engine/audio/al" "github.com/adamlenda/engine/core" "github.com/adamlenda/engine/gls" "github.com/adamlenda/engine/math32" ) // Listener is an audio listener positioned in space. type Listener struct { core.Node } // NewListener creates a Listener o...
audio/listener-desktop.go
0.814533
0.410431
listener-desktop.go
starcoder
package main import ( "errors" "fmt" "math" "strconv" blt "bearlibterminal" ) const ( // Values that are important for creating and backtracking graph. nodeInitialWeight = -1 // Nodes not traversed. ) type Node struct { /* Node is struct that mimics some properties of Tile struct (implemented in map.go)...
pathfinding.go
0.52902
0.530845
pathfinding.go
starcoder
package gcp import ( "context" "cloud.google.com/go/bigquery" "github.com/gruntwork-io/terratest/modules/logger" "github.com/gruntwork-io/terratest/modules/testing" ) // CreateDataset creates a BigQuery Dataset with the given DatasetMetadata. func CreateDataset(t testing.TestingT, projectID, datasetID string, d...
modules/gcp/bigquery.go
0.657538
0.440048
bigquery.go
starcoder
package cases import ( "sort" "testing" "github.com/prometheus/prometheus/pkg/labels" "github.com/stretchr/testify/require" ) // SortedLabelsTest exports a single, constant metric with labels in the wrong order // and checks that we receive the metrics with sorted labels. func SortedLabelsTest() Test { return T...
remote_write_sender/cases/labels.go
0.750918
0.564038
labels.go
starcoder
package graphutils import "strconv" type Graph struct { VertexArray []*Vertex } type Vertex struct { Id string Visited bool AdjEdge []*Edge } type Edge struct { Source *Vertex Destination *Vertex Weight int } func NewGraph() *Graph { return &Graph{ make([]*Vertex, 0), } } func NewVertex(...
graphutils/graph.go
0.644113
0.422386
graph.go
starcoder
package pretty import ( "encoding/hex" "fmt" "io" "strconv" . "github.com/polydawn/refmt/tok" ) func NewEncoder(wr io.Writer) *Encoder { return &Encoder{ wr: wr, stack: make([]phase, 0, 10), } } func (d *Encoder) Reset() { d.stack = d.stack[0:0] d.current = phase_anyExpectValue } /* A pretty.Encod...
pretty/prettyEncoder.go
0.54698
0.512876
prettyEncoder.go
starcoder
package model import ( "time" ) // Leg describes the transportation between two locations on a voyage type Leg struct { VoyageNumber VoyageNumber `json:"voyage_number"` LoadLocation UNLocode `json:"from"` UnloadLocation UNLocode `json:"to"` LoadTime time.Time `json:"load_time"` UnloadTime ...
section19/cargo/model/itinerary.go
0.709019
0.425605
itinerary.go
starcoder
package pulse import ( "strconv" "strings" "sort" "fmt" "math" "github.com/bradfitz/slice" "github.com/pkg/errors" ) // Signal implements a received 433 MHz signal of compressed raw time series // that consists of pulse lengths and a sequence of pulses. type Signal struct { Lengths []int Seq string }...
pulse/pulse.go
0.811751
0.519582
pulse.go
starcoder