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 scheduler import ( "fmt" "strconv" "strings" "time" "github.com/kennydo/automatic-light-controller/lib" ) // LocationConfig describes the coordinates of a geographical location and the timezone in that location type LocationConfig struct { Timezone Timezone `toml:"timezone"` Latitude float64 `toml:...
lib/scheduler/models.go
0.851691
0.429669
models.go
starcoder
package horizon import ( "container/heap" "github.com/golang/geo/s1" "github.com/golang/geo/s2" "github.com/google/btree" ) // S2Storage Spatial datastore /* storageLevel - level for S2 edges - map of edges BTree - b-tree (wraps) */ type S2Storage struct { storageLevel int edges map[uint64]*Edge *bt...
s2_datastore.go
0.6705
0.404566
s2_datastore.go
starcoder
package pointer import ( "time" ) /* Order as in spec: bool byte complex64 complex128 error float32 float64 int int8 int16 int32 int64 rune string uint uint8 uint16 uint32 uint64 uintptr time.Duration time.Time */ // GetBool returns the value of the bool pointer passed in or false if the pointer is nil. func Ge...
vendor/github.com/AlekSi/pointer/value.go
0.687945
0.414129
value.go
starcoder
package versioning import ( "context" "github.com/ipfs/go-datastore" ) // MigrationFunc is a function to transform an single element of one type of data into // a single element of another type of data. It has the following form: // func<T extends cbg.CBORUnmarshaller, U extends cbg.CBORMarshaller>(old T) (new U, ...
pkg/types.go
0.593138
0.554953
types.go
starcoder
package gcode type ExtrusionTracker struct { RelativeExtrusion bool // true == relative, false == absolute TotalExtrusion float32 // total filament consumption -- never decreases CurrentExtrusionValue float32 // current position of the E axis PreviousExtrusionValue float32 // last position of the E axi...
gcode/extrusion-tracker.go
0.680879
0.406214
extrusion-tracker.go
starcoder
package num import ( "fmt" ) // Matrix is a slice of slices of Int type Matrix []Set // NewMatrix creates an empty matrix of 0s with dimensions rowsXcolumns func NewMatrix(rows Int, cols Int) Matrix { m := Matrix{} for r := Int(0); r < rows; r++ { m = append(m, make(Set, cols)) } return m } // Implement th...
matrix.go
0.793826
0.537891
matrix.go
starcoder
package metrics import ( "errors" "fmt" "math/rand" "net" "runtime" "strings" "sync" "time" ) type Client interface { // Close closes the connection and cleans up. Close() error // Increments a statsd count type. // stat is a string name for the metric. // value is the integer value // rate is the samp...
Godeps/_workspace/src/github.com/mailgun/metrics/client.go
0.730866
0.479382
client.go
starcoder
package hash import ( "crypto/hmac" "crypto/md5" "crypto/sha1" "crypto/sha256" "crypto/sha512" "encoding/base64" "encoding/hex" ) // HmacMd5 computes a Hash-based Message Authentication Code (HMAC) by using // the MD5 hash function. The HMAC process mixes a secret key with the message // data, hashes the resul...
hash/hmac.go
0.848957
0.593786
hmac.go
starcoder
package main import ( "fmt" "io/ioutil" "strconv" "strings" ) /* You have three stacks of cylinders where each cylinder has the same diameter, but they may vary in height. You can change the height of a stack by removing and discarding its topmost cylinder any number of times. Find the maximum possible height of...
github.com/lemenendez/gotuto/tuto/algo-25-equal-stacks.go
0.654232
0.60964
algo-25-equal-stacks.go
starcoder
package models import ( i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91 "github.com/microsoft/kiota-abstractions-go/serialization" ) // FilterClause type FilterClause struct { // Stores additional data not described in the OpenAPI description found when deserializing. Can be used for serial...
models/filter_clause.go
0.628521
0.414247
filter_clause.go
starcoder
package vmath import ( "fmt" "github.com/maja42/vmath/math32" "github.com/maja42/vmath/mathi" ) // Recti represents a 2D, axis-aligned rectangle. type Recti struct { Min Vec2i Max Vec2i } // RectiFromCorners creates a new rectangle given two opposite corners. func RectiFromCorners(c1, c2 Vec2i) Recti { if c1[...
recti.go
0.910721
0.677741
recti.go
starcoder
package av import ( "encoding/csv" "io" "sort" "time" "github.com/pkg/errors" ) // TimeSeries specifies a given time series to query for. // For valid options, see the TimeSeries* package constants. type TimeSeries uint8 const ( TimeSeriesDaily TimeSeries = iota TimeSeriesDailyAdjusted TimeSeriesWeekly Tim...
vendor/github.com/cmckee-dev/go-alpha-vantage/time_series.go
0.754644
0.550728
time_series.go
starcoder
package iso20022 // Cash movements from or to a fund as a result of investment funds transactions, eg, subscriptions or redemptions. type EstimatedFundCashForecast5 struct { // Unique technical identifier for an instance of a fund cash forecast within a fund cash forecast report as assigned by the issuer of the repo...
EstimatedFundCashForecast5.go
0.880341
0.586049
EstimatedFundCashForecast5.go
starcoder
package spaniel import ( "encoding/json" "time" ) // TimeSpan represents a simple span of time, with no additional properties. It should be constructed with NewEmpty. type TimeSpan struct { start time.Time end time.Time startType EndPointType endType EndPointType } // Start returns the start time o...
timespan.go
0.824991
0.520557
timespan.go
starcoder
package jsonmuncher import ( "io" "strconv" "unicode/utf8" "unsafe" ) // JsonType represents the data type of a JsonValue. type JsonType byte const ( // Null values are always 'null'. Null JsonType = iota // Bool values are 'true' or 'false'. Bool // Number values are double-precision floating point numbers...
parser.go
0.50952
0.424173
parser.go
starcoder
package fourq import ( "math/big" "github.com/cloudflare/circl/internal/conv" ) // Size of scalars used for point multiplication. const Size = 32 // Point represents an affine point of the curve. The identity is (0,1). type Point struct{ X, Y Fq } // CurveParams contains the parameters of the elliptic curve. ty...
ecc/fourq/curve.go
0.879535
0.473049
curve.go
starcoder
package goiaf import ( "net/url" "strconv" ) // HouseRequest contains method which can be used to filter the response. type HouseRequest interface { ParamConverter // Limit sets the maximum houses to return. Limit(int) HouseRequest // Name can be used to filter the returned houses by their name. Name(string...
house_request.go
0.631594
0.405154
house_request.go
starcoder
package input import ( "github.com/Jragonmiris/mathgl" "github.com/go-gl/glfw" "math" ) type Camera struct { pos mathgl.Vec3f hAngle, vAngle float64 time float64 } const ( speed float64 = 3.0 mouseSpeed = .005 width = 1024.0 height = 768.0 initial...
examples/opengl-tutorial/input/input.go
0.767167
0.470007
input.go
starcoder
package main import ( "github.com/jeffail/gabs" "io/ioutil" "log" "math" ) //These represent the tile order in Tiled sprite const ( TypeGround = 1 TypeGoal = 2 TypeStart = 3 TypeBlock = 4 ) var TypeNames = map[int]string{ TypeStart: "Start", TypeGoal: "Goal", TypeGround: "Ground", TypeBlock: ...
map.go
0.586641
0.425546
map.go
starcoder
// api.go // Implements the methods interacting between the model and the server package hipmodel import ( "errors" "fmt" "github.com/emer/etable/etable" "github.com/emer/etable/etensor" "time" ) /* Update the data used for training/testing the model and re-init the network */ func (ss *Sim) RestUpdateTraining...
pkg/hipmodel/api.go
0.530723
0.415788
api.go
starcoder
package model import ( "errors" "gopkg.in/yaml.v2" "strings" ) /* The Api structure is the fundamental type exposed by the skilldrill model package, and provides CRUD interfaces to do things like adding skills or people into the model and registering a person as having a particular skill. All model editing operat...
model-hidden/api.go
0.569015
0.41941
api.go
starcoder
package check import ( "reflect" ) func elem(a interface{}) (interface{}, bool) { value := reflect.ValueOf(a) if value.Kind() == reflect.Ptr { if value.IsNil() { return nil, true } return value.Elem().Interface(), false } return a, false } func compareInt(a, b int) int { switch { case a > b: return...
master/pkg/check/check_numbers.go
0.655336
0.525247
check_numbers.go
starcoder
package drago import ( "fmt" "github.com/gonum/matrix/mat64" ) // Network struct represents the neural network // Values are exported but should not be messed with during training, // are exported simply for ease of examining the network state type Network struct { Activators []Activator Activations []*mat64....
Network.go
0.68595
0.507019
Network.go
starcoder
package ann import ( "math/rand" "sort" mat "github.com/gonum/matrix/mat64" ) type mrpt struct { xs [][]float64 trees []*tree } type tree struct { root *node r mat.Matrix } type node struct { split float64 left *node right *node indices []int } // NewMRPTANNer creates a NN index using random pr...
mrpt.go
0.6508
0.497498
mrpt.go
starcoder
package explainer import ( "fmt" "log" "strings" "github.com/mgutz/ansi" "github.com/luhring/reach/reach" "github.com/luhring/reach/reach/aws" "github.com/luhring/reach/reach/helper" ) // An Explainer provides mechanisms to explain the business logic behind analyses to users via natural language. type Explai...
reach/explainer/explainer.go
0.72331
0.462594
explainer.go
starcoder
package fontman var consolasRegular65 font = font{ Height: 135, Description: fontDescription{ Family: "Consolas", Style: "Regular", Size: 65, }, Metricts: fontMetrics{ Ascender: 86, Descender: -30, Height: 135, }, Texture: fontTexture{ Name: "t_consolas_regular_65", Width: 1024, Heigh...
fontman/consolas_regular_65.go
0.603231
0.629162
consolas_regular_65.go
starcoder
package sudogo type Stack[T any] struct { items []T size int } func NewStack[T any](initialCapacity int) Stack[T] { return Stack[T]{ items: make([]T, initialCapacity), size: 0, } } func (stack *Stack[T]) Peek() *T { if stack.size == 0 { return nil } return &stack.items[stack.size-1] } func (stack *St...
pkg/lists.go
0.615319
0.479138
lists.go
starcoder
package metadata import ( "time" "go.opentelemetry.io/collector/model/pdata" ) // MetricSettings provides common settings for a particular metric. type MetricSettings struct { Enabled bool `mapstructure:"enabled"` } // MetricsSettings provides settings for polygonreceiver metrics. type MetricsSettings struct { ...
receiver/polygonreceiver/internal/metadata/generated_metrics_v2.go
0.832577
0.434341
generated_metrics_v2.go
starcoder
package progresscli import ( "os" "io" "fmt" "unicode/utf8" "math" "regexp" "github.com/nathan-fiscaletti/consolesize-go" ) // Style represents the style that can be applied to a progress bar. type Style struct { // The open and close characters are the characters on either end //...
progress.go
0.646572
0.446615
progress.go
starcoder
package main import ( "fmt" "math" "math/rand" "sync" ) /* 3D Vectors */ type Vec3 struct { e [3]float32 } func (v Vec3) x() float32 { return v.e[0] } func (v Vec3) y() float32 { return v.e[1] } func (v Vec3) z() float32 { return v.e[2] } func (v Vec3) r() float32 { return v.e[0] } func (v Vec3) g() fl...
go_trace.go
0.859251
0.587411
go_trace.go
starcoder
package main const usage = `Usage: %[1]s parser-cmd [ parser-cmd-flags ] toml-test is a tool to verify the correctness of TOML parsers and writers. https://github.com/BurntSushi/toml-test The parser-cmd positional argument should be a program that accepts TOML data on stdin until EOF, and is expected to write the co...
cmd/toml-test/usage.go
0.79649
0.700242
usage.go
starcoder
package components import ( "encoding/json" "errors" "fmt" "io/ioutil" "strings" "sync" ) const ( // TypeMesh represents a mesh component's type. TypeMesh = "mesh" // MeshSrcDir is the expected location of meshes MeshSrcDir = "assets/models/" ) // Mesh represents a component that holds the data representin...
components/mesh.go
0.671147
0.426919
mesh.go
starcoder
package circlinebuffer import ( "errors" "fmt" "unicode/utf8" ) // Optimised for Writing and frequent small reads // Reading the entire buffer is a bugger for perf type circLineBuffer struct { size int bufHalfSize int cursorOff int // Read Cursor for Partial Reads or only newest readOff int // Re...
CircLineBuffer/circ_line_buffer.go
0.524638
0.41478
circ_line_buffer.go
starcoder
package entity import ( "fmt" "math" "sync" ) // ExperienceManager manages experience and levels for entities, and provides functions to add, remove, and calculate // experience needed for upcoming levels. type ExperienceManager struct { mu sync.RWMutex experience int } // NewExperienceManager returns a...
server/entity/experience.go
0.614625
0.42931
experience.go
starcoder
package dist import ( "github.com/jesand/stats" "math" "math/rand" ) // Represents a probability distribution type Dist interface { // Return a "score" (density or probability) for the given values Score(vars, params []float64) float64 // The number of random variables the distribution is over NumVars() int ...
dist/dist.go
0.850375
0.697854
dist.go
starcoder
package crom import ( "fmt" "reflect" "strings" ) type CockroachDialect struct { suffix string } func (d CockroachDialect) Name() string { return "CockroachDialect" } func (d CockroachDialect) QuerySuffix() string { return ";" } func (d CockroachDialect) ToSqlType(val reflect.Type, maxsize int, isAutoIncr bool...
apiv2-crom/dialect_cockroach.go
0.575111
0.446857
dialect_cockroach.go
starcoder
package voronoi import ( "fmt" "math" "sort" "github.com/quasoft/dcel" ) // CloseTwins adds a vertex to the specified edges. func (v *Voronoi) CloseTwins(list []*dcel.HalfEdge, vertex *dcel.Vertex) { for i := 0; i < len(list); i++ { he := list[i] if he.Twin != nil && he.Twin.Target == nil { he.Twin.Targe...
dcel.go
0.735737
0.41484
dcel.go
starcoder
package glicko2 import ( "math" ) type Result struct { Opponent *Rating Score float64 } type Rating struct { Mu float64 Phi float64 Sigma float64 Results []Result } type System struct { Tau float64 Epsilon float64 Mu float64 Phi float64 Players []*Rating } func (p *Rating) Ad...
glicko2.go
0.726717
0.478224
glicko2.go
starcoder
package graph import ( "gonum.org/v1/gonum/graph" "gonum.org/v1/gonum/graph/simple" "gonum.org/v1/gonum/graph/topo" ) // simpleNode is used internally to present the graph.Node interface // to the graph library used here type simpleNode struct { id int64 node Node } func (n *simpleNode) ID() int64 { return n...
graph/graph.go
0.814828
0.406685
graph.go
starcoder
package toolkit import ( "bytes" "encoding/binary" "reflect" ) /** * Collected methods which allow easy implementation of <code>hashCode</code>. * * Example use case: * <pre> * public int hashCode(){ * int result = HashCodeUtil.SEED; * //collect the contributions of various fields * result = HashCodeUtil...
hashCodeUtils.go
0.78316
0.423935
hashCodeUtils.go
starcoder
package chesseract import "fmt" func init() { RegisterRuleSet("Boring2D", func() RuleSet { return Boring2D{} }) } // A position2D represents a position on the old-fashioned 2D chess board type position2D [2]int func (p position2D) String() string { return fmt.Sprintf("%c%d", 'a'+rune(p[0]), p[1]+1) } func (p ...
chesseract/boring2D.go
0.710025
0.577049
boring2D.go
starcoder
package stdlib import ( "fmt" "math" "math/big" "github.com/pieterclaerhout/go-log" "gonum.org/v1/gonum/floats" "github.com/vulogov/derBund/internal/vm" ) func AddOperator(v *vm.VM, e1 *vm.Elem, e2 *vm.Elem) (*vm.Elem, error) { if e1.Type != e2.Type { return nil, fmt.Errorf("Datatypes for operation '+' mus...
internal/stdlib/opmath.go
0.507324
0.429728
opmath.go
starcoder
package cios import ( "encoding/json" ) // SeriesDataBulkRequest struct for SeriesDataBulkRequest type SeriesDataBulkRequest struct { // 時系列データの配列、配列の長さ上限 36000 Data []SeriesDataLocationUnix `json:"data"` } // NewSeriesDataBulkRequest instantiates a new SeriesDataBulkRequest object // This constructor will assig...
cios/model_series_data_bulk_request.go
0.551091
0.450057
model_series_data_bulk_request.go
starcoder
package common import ( "encoding/json" "math/big" "time" "github.com/KyberNetwork/reserve-stats/lib/timeutil" ) // ReserveRateEntry hold 4 float number represent necessary data for a rate entry type ReserveRateEntry struct { BuyReserveRate float64 `json:"buy_reserve_rate"` BuySanityRate float64 `json:"buy_...
reserverates/common/types.go
0.744842
0.487307
types.go
starcoder
package gomfa import ( "math" ) func Rm2v(r *[3][3]float64, w *[3]float64) { /* ** - - - - - ** R m 2 v ** - - - - - ** ** Express an r-matrix as an r-vector. ** ** Given: ** r *[3][3] float64 rotation matrix ** ** Returned: ** w *[3] float64 rotation vect...
rm2v.go
0.7641
0.668664
rm2v.go
starcoder
package day14 import ( "fmt" "github.com/chigley/advent2021" ) type Pair [2]rune type Polymer struct { // pairFreq tracks the frequency of each pair of elements in the polymer. pairFreq map[Pair]int // lastChar stores the last element from the input string used to // initialsise the polymer, used to compute ...
day14/polymer.go
0.674694
0.434761
polymer.go
starcoder
package main // Layer is the storyboard layer type to use for osu!. type Layer int const ( Back Layer = iota Front ) // BMSFileData shows most things you'd want to know about a bms file. type BMSFileData struct { // Metadata contains the BMS file's metadata. Metadata BMSMetadata `json:"metadata"` // StartingBP...
structs.go
0.665084
0.421314
structs.go
starcoder
package format import ( "math" "time" ) const fractionDivisor = 0x10000 // Timestamp represents a point in time using fixed resolution. type Timestamp struct { Second uint8 Fraction uint16 } // TimestampLimit returns the highest possible timestamp value. func TimestampLimit() Timestamp { return Timestamp{ ...
ss1/content/movie/internal/format/Timestamp.go
0.910049
0.445168
Timestamp.go
starcoder
package bulletproofs import ( "bytes" "crypto/hmac" "crypto/sha256" "encoding/hex" "github.com/btcsuite/btcd/btcec" "math/big" ) var ( // prefix1 is the ascii string "1st generation: " prefix1, _ = hex.DecodeString("3173742067656e65726174696f6e3a20") // prefix2 is the ascii string "2nd generation: " prefix...
generators.go
0.776284
0.425187
generators.go
starcoder
package bitfield // https://cs.opensource.google/go/x/text/+/master:internal/gen/bitfield/bitfield.go // https://github.com/HewlettPackard/structex var maskMap = map[int]uint64{ 0: 0b0000000000000000000000000000000000000000000000000000000000000000, 1: 0b000000000000000000000000000000000000000000000000000000000000...
vendor/github.com/Pencroff/go-toolkit/bitfield/bitfield.go
0.689933
0.587115
bitfield.go
starcoder
package cast import ( "fmt" "strconv" ) // ToFloat64 casts an interface to a float64 type, discarding any errors. func ToFloat64(i interface{}) float64 { ret, _ := ToFloat64E(i) return ret } // ToFloat64E casts an interface to a float64 type. func ToFloat64E(i interface{}) (float64, error) { i = indirect(i) s...
float.go
0.788461
0.42054
float.go
starcoder
package models // Dataset: Earnings by place of work // Dimensions: Sex | Employment status // Variables: gross weekly pay, weekly pay excluding overtime // Table // Observation | Variable (Earnings)| Sex | Employment status // 123 | Gross weekly pay | Male | Full Time // 70 | Gross weekly pay...
models/dataset.go
0.678859
0.54056
dataset.go
starcoder
package pt import ( "math" "math/rand" ) type Camera struct { p, u, v, w Vector m float64 focalDistance float64 apertureRadius float64 } func LookAt(eye, center, up Vector, fovy float64) Camera { c := Camera{} c.p = eye c.w = center.Sub(eye).Normalize() c.u = up.Cross(c.w).Normalize() c....
pt/camera.go
0.857619
0.657353
camera.go
starcoder
package expect import ( "fmt" "path/filepath" "regexp" "runtime" "strings" "testing" ) // Expectation is an expectation to be tested type Expectation struct { value interface{} test *testing.T } // NegativeExpectation is a negative expectation to be tested type NegativeExpectation struct { value interface...
expect.go
0.653901
0.602734
expect.go
starcoder
package arg import ( "encoding" "fmt" "reflect" "unicode" "unicode/utf8" scalar "github.com/alexflint/go-scalar" ) var textUnmarshalerType = reflect.TypeOf([]encoding.TextUnmarshaler{}).Elem() // cardinality tracks how many tokens are expected for a given spec // - zero is a boolean, which does to expect any...
reflect.go
0.707708
0.422624
reflect.go
starcoder
package neuralnet import ( "encoding/json" "fmt" "github.com/gookit/color" "gopkg.in/cheggaaa/pb.v1" "math/rand" "os" "time" ) type NeuralNetwork struct { HiddenLayer []float64 InputLayer []float64 OutputLayer []float64 WeightHidden [][]float64 WeightOutput [][]float64 ErrOutput ...
neuralnet/neuralnet.go
0.644337
0.430746
neuralnet.go
starcoder
package main import ( "bufio" "fmt" "io" "log" "os" "strconv" "strings" ) const ( // Up is the north direction in the grid. Up = iota // Right is the east direction in the grid. Right // Down is the south direction in the grid. Down // Left is the west direction in the grid. Left ) // Step represent a...
day03/main.go
0.698946
0.529385
main.go
starcoder
package onshape import ( "encoding/json" ) // BTGeometryFilter130AllOf struct for BTGeometryFilter130AllOf type BTGeometryFilter130AllOf struct { BtType *string `json:"btType,omitempty"` GeometryType *string `json:"geometryType,omitempty"` } // NewBTGeometryFilter130AllOf instantiates a new BTGeometryFilter130All...
onshape/model_bt_geometry_filter_130_all_of.go
0.769254
0.469034
model_bt_geometry_filter_130_all_of.go
starcoder
package spry import ( "github.com/tanema/amore/gfx" ) // Atlas is the structure to serialize a spritesheet. You can retrieve and draw // single frames from the atlas type Atlas struct { sheet *gfx.Image Frames []*gfx.Quad } // NewAtlas will build and return a new Atlas. frameWidth and frameHeight are to define /...
atlas.go
0.761716
0.507873
atlas.go
starcoder
package canvas import ( "fmt" "image" "image/draw" "log" "golang.org/x/image/colornames" "gonum.org/v1/gonum/mat" ) // Axes represents a Primitive with Figure as its parent. type Axes struct { primitive Parent *Figure } // newAxes creates a new Axes linked to a parent Figure. func newAxes(parent *Figure, di...
canvas/axes.go
0.713132
0.447038
axes.go
starcoder
package lc3 import ( "fmt" "sync" "time" ) const ( // R_R0 represents the index of the general purpose register 0. R_R0 uint16 = iota // R_R1 represents the index of the general purpose register 1. R_R1 // R_R2 represents the index of the general purpose register 2. R_R2 // R_R3 represents the index of the ...
pkg/lc3/lc3.go
0.614047
0.472805
lc3.go
starcoder
package util import ( "fmt" "regexp" "strings" ) const ( Gb = 1024 * 1024 * 1024 Tb = 1024 * Gb ) // Round up to the nearest Gb func RoundBytesToGb(bytes int64) int64 { return (bytes + Gb - 1) / Gb } func BytesToGb(bytes int64) int64 { return bytes / Gb } func GbToBytes(gbs int64) int64 { return gbs * Gb }...
pkg/util/util.go
0.763219
0.421254
util.go
starcoder
package parser import ( "regexp" "github.com/tsaikd/KDGoLib/errutil" ) // CheckValueOption for changing CheckValueAPIType behavior type CheckValueOption interface{} // CheckValueOptionAllowIntegerToBeNumber allow type integer to be type number, // e.g. APIType need a integer, but value is a number // default: fal...
parser/check.go
0.599954
0.439807
check.go
starcoder
package fputil import ( "fmt" "strconv" "strings" "time" "github.com/cbrand/go-filterparams/definition" ) type DataType interface { IsFilterAllowed(filter *definition.Filter) bool Parse(value interface{}) (interface{}, bool) } var ( trueStrings = map[string]bool{ "true": true, "yes": true, "y": tr...
datatype.go
0.614394
0.420302
datatype.go
starcoder
package core import ( "bytes" "errors" "log" "math" "math/rand" "strconv" "strings" ) // DataPartitioner is responsible to partition a dataset and, upon estimating, // the basic partitioning scheme, dynamically partition new datasets. type DataPartitioner interface { // Construct estimates the partitioning o...
core/partitioner.go
0.617743
0.534552
partitioner.go
starcoder
package main import ( "fmt" "time" "github.com/go-kit/kit/metrics" "github.com/mre/edgecast" ) /* * instrumentingMiddleware wraps a given EdgecastInterface an creates metrics for its invoked functions * The following metrics are created per function: * - requestCount: incremented on every invocation of th...
instrumenting.go
0.672224
0.402011
instrumenting.go
starcoder
package darkfeed var pow10 = []float64{0.000001, 0.00001, 0.0001, 0.001, 0.01, 0.1, 1, 10, 100, 1000, 10000, 100000, 1000000, 10000000, 100000000, 1000000000} var pow10f = []float32{0.000001, 0.00001, 0.0001, 0.001, 0.01, 0.1, 1, 10, 100, 1000, 10000, 100000, 1000000, 10000000, 100000000, 1000000000} var pow10u32 = []...
go/price.go
0.80456
0.46563
price.go
starcoder
package processors import ( "fmt" ) const ( // DataFormatRAW is a DataFormat of type RAW // raw generic data DataFormatRAW DataFormat = iota + 1 // DataFormatFILESYSTEMREF is a DataFormat of type FILESYSTEM_REF // a reference to a file or folder accessible to the processor DataFormatFILESYSTEMREF ) const _Da...
api/processors/data_type_enum.go
0.548432
0.46132
data_type_enum.go
starcoder
package stepMapper import ( "fmt" "github.com/Anthony-Jhoiro/WorkyGO/configParser" "github.com/Anthony-Jhoiro/WorkyGO/workflow" "strings" ) func ParseWorkflowSteps(parsedWorkflow configParser.ParsedWorkflow) (*workflow.Workflow, error) { steps, err := mapMultipleSteps(parsedWorkflow.Steps) if err != nil { re...
stepMapper/stepMapper.go
0.52074
0.452234
stepMapper.go
starcoder
package alpha import ( "fmt" "io" "math" "math/rand" "reflect" "time" errors "golang.org/x/xerrors" yaml "gopkg.in/yaml.v2" ) // Constant field keys. Each field has a specific expected type. const ( fieldDistribution = "distribution" // Type: Distribution (TODO: Rename this to Distribution?) fieldChoices ...
cmd/beaker/alpha/parameter_space.go
0.705075
0.444083
parameter_space.go
starcoder
package graph import ( "sort" ) type DirectedEdge struct { X string Y string Weight int } type DirectedEdges []DirectedEdge func (d DirectedEdges) Len() int { return len(d) } func (d DirectedEdges) Swap(x, y int) { d[x], d[y] = d[y], d[x] } func (d DirectedEdges) Less(x, y int) bool { return d[x].W...
internal/graph/graph.go
0.708818
0.446736
graph.go
starcoder
package chunk import ( "errors" "github.com/grafana/metrictank/mdata/chunk/tsz" ) var ( errUnknownChunkFormat = errors.New("unrecognized chunk format") errUnknownSpanCode = errors.New("corrupt data, chunk span code is not known") errShort = errors.New("chunk is too short") ) //go:generate msgp ...
vendor/github.com/grafana/metrictank/mdata/chunk/itergen.go
0.572006
0.455017
itergen.go
starcoder
package set1 import "encoding/hex" /** * Cryptopal Set 1 * Challenge 1 - Convert hex to base64 * https://cryptopals.com/sets/1/challenges/1 */ // BytesToBase64 Convert a byte array to a base64 string func BytesToBase64(bytes []byte) []byte { // Base64 table table := map[byte]byte{ 0: 'A', 1: 'B', 2: 'C', 3: ...
set1/hex-to-base64.go
0.732974
0.514522
hex-to-base64.go
starcoder
package ndarray import ( "math/rand" "github.com/shopspring/decimal" ) func NewNdArray(values []float64, rcd ...int) *Array { rows, cols := dimsToShape(rcd...) if len(values) != rows*cols { return nil // Invalid dimensions provided } a := Zeros(rcd...) a.Data = values a.Length = len(a.Data) return a } f...
ndarray_creation.go
0.670285
0.519034
ndarray_creation.go
starcoder
package interpreter import ( "math" "github.com/Nv7-Github/bsharp/ir" "github.com/Nv7-Github/bsharp/tokens" "github.com/Nv7-Github/bsharp/types" ) func (i *Interpreter) evalMathNode(pos *tokens.Pos, node *ir.MathNode) (*Value, error) { left, err := i.evalNode(node.Lhs) if err != nil { return nil, err } ri...
backends/interpreter/ops.go
0.5144
0.426083
ops.go
starcoder
package keras import ( "math" "math/rand" "time" ) //Layer interface given these 5 functions which every layer must have. type Layer interface { Call() []float64 GetWeights() Matrix GetBiases() Vector Name() string TrainableParameters() int } //DenseLayer defines a fully connected layer. type DenseLayer stru...
keras/layers.go
0.887119
0.597138
layers.go
starcoder
package validation import ( "fmt" "net" "net/url" "reflect" "time" "github.com/System-Glitch/goyave/v3/helper" "github.com/google/uuid" ) // createArray create a slice of the same type as the given type. func createArray(dataType string, length int) reflect.Value { var arr reflect.Value switch dataType { c...
validation/arrays.go
0.554229
0.403508
arrays.go
starcoder
package model3d import ( "math" "github.com/heustis/tsp-solver-go/model" ) // BuildPerimiter attempts to produce the smallest convex perimeter that can encompass all the vertices in the supplied array. // The current 3D algorithm is not guaranteed to produce the smallest convex perimeter, unlike the 2D algorithm. ...
model3d/perimeterbuilder3d.go
0.840161
0.839997
perimeterbuilder3d.go
starcoder
http://arxiv.org/pdf/1505.00062.pdf */ package mpchash import ( "math" "sort" ) // Multi selects buckets with a multi-probe consistent hash type Multi struct { buckets []string seeds [2]uint64 hashf func(b []byte, s uint64) uint64 k int bmap map[uint64]string // We store sorted slices of hashes by...
mpchash.go
0.794664
0.482124
mpchash.go
starcoder
package astmodel import "github.com/pkg/errors" // PropertyInjector is a utility for injecting property definitions into resources and objects type PropertyInjector struct { // visitor is used to do the actual injection visitor TypeVisitor } // NewPropertyInjector creates a new property injector for modifying reso...
v2/tools/generator/internal/astmodel/property_injector.go
0.621081
0.411288
property_injector.go
starcoder
package luar import ( "reflect" "github.com/yuin/gopher-lua" ) // LState is an wrapper for gopher-lua's LState. It should be used when you // wish to have a function/method with the standard "func(*lua.LState) int" // signature. type LState struct { *lua.LState } var refTypeLStatePtr reflect.Type var refTypeLuaL...
Godeps/_workspace/src/github.com/layeh/gopher-luar/func.go
0.543106
0.406597
func.go
starcoder
package trie import ( "bytes" "fmt" ) // New return a new trie tree func New() *Trie { root := &Node{sons: map[byte]*Node{}} return &Trie{root} } // Node is a node in trie tree type Node struct { data byte isEnd bool sons map[byte]*Node } // Trie is a trie tree stuct type Trie struct { root *Node } // In...
dataStructuresAndAlgorithms/string/trie/trie.go
0.634317
0.401658
trie.go
starcoder
package layout import ( "image" "gioui.org/op" ) // Stack lays out child elements on top of each other, // according to an alignment direction. type Stack struct { // Alignment is the direction to align children // smaller than the available space. Alignment Direction } // StackChild represents a child for a ...
layout/stack.go
0.643665
0.422981
stack.go
starcoder
package main import ( "github.com/ethereum/go-ethereum/p2p/enode" ) type TreeNode interface { Depth() uint ID() enode.ID Score() float64 SubtreeSize() uint // Add a node to the tree, return updated tree root, and ok == true if the node didn't already exist Add(n *enode.Node) (updated TreeNode, ok bool) // Sea...
tree.go
0.680242
0.482002
tree.go
starcoder
package sets import "sort" type Set map[string]struct{} // New returns a new empty Set. func New() Set { return make(Set) } // NewWithLength returns an empty Set with the given length. func NewWithLength(l int) Set { return make(Set, l) } // NewWith creates a new Set with the given items. func NewWith(items ......
pkg/util/sets/string.go
0.856797
0.474936
string.go
starcoder
package backoff import ( "math" "time" ) // Algorithm defines a function that calculates a time.Duration based on // the given retry attempt number. type Algorithm func(attempt uint) time.Duration // Constant creates an Algorithm that returns the initial duration // by the all time. func Constant(duration time.Dur...
vendor/github.com/kamilsk/retry/v4/backoff/backoff.go
0.860662
0.63672
backoff.go
starcoder
package match // match m a func MatchArr(pattern string, data []string, limit ...int) []string { weight := make([]float64, 0, 5) res := make([]string, 0, 5) // start init res = append(res, "") weight = append(weight, 0) length := 0 for _, content := range data { w := matchWeight(pattern, content) if w > 0...
vendor/match/match.go
0.537527
0.401336
match.go
starcoder
package types import ( "fmt" "math" "time" "github.com/pingcap/errors" ) // AddUint64 adds uint64 a and b if no overflow, else returns error. func AddUint64(a uint64, b uint64) (uint64, error) { if math.MaxUint64-a < b { return 0, ErrOverflow.GenWithStackByArgs("BIGINT UNSIGNED", fmt.Sprintf("(%d, %d)", a, b...
tidb-types/overflow.go
0.772316
0.437523
overflow.go
starcoder
package trees import ( "errors" ) // BinarySearchTree defines a binary search tree type BinarySearchTree struct { BinaryTree size int } func (b *BinarySearchTree) insert(node *BinaryTreeNode, key, value interface{}) bool { if b.Comparator(node.Key, key) > 0 { if node.Left == nil { node.Left = &BinaryTreeNod...
datastructure/trees/binary_search_tree.go
0.777596
0.434161
binary_search_tree.go
starcoder
package contextionary import ( "fmt" annoy "github.com/creativesoftwarefdn/weaviate/contextionary/annoyindex" "sort" ) type MemoryIndex struct { dimensions int words []string knn annoy.AnnoyIndex } // Return the number of items that is stored in the index. func (mi *MemoryIndex) GetNumberOfItems() ...
contextionary/memory_index.go
0.777933
0.520253
memory_index.go
starcoder
package models import ( i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91 "github.com/microsoft/kiota-abstractions-go/serialization" ) // PropertyToEvaluate type PropertyToEvaluate struct { // Stores additional data not described in the OpenAPI description found when deserializing. Can be use...
models/property_to_evaluate.go
0.68721
0.403126
property_to_evaluate.go
starcoder
package gockle import ( "github.com/gocql/gocql" "github.com/maraino/go-mock" ) // ColumnApplied is the name of a special column that has a bool that indicates // whether a conditional statement was applied. const ColumnApplied = "[applied]" // Batch is an ordered collection of CQL queries. type Batch interface { ...
batch.go
0.775945
0.461684
batch.go
starcoder
package aura import ( "fmt" "time" "github.com/rcrowley/go-metrics" ) // Histogram measures the statistical distribution of values in a stream of data. // In addition to minimum, maximum, mean, etc. // it also measures median, 75th, 90th, 95th, 98th, 99th, and 99.9th percentiles. type Histogram interface { Colle...
histogram.go
0.782413
0.543409
histogram.go
starcoder
package bloom import ( "math" "github.com/andy2046/bitmap" ) type ( scalableBloomFilter struct { filterz []*bloomFilterBit // bloom filters list count uint64 // number of elements in the bloom filter n uint64 // estimated number of elements p float64 /...
pkg/bloom/bloomscale.go
0.733643
0.594051
bloomscale.go
starcoder
package main import ( "time" ) // Period - Hold from and to timestamps for a given period type Period struct { from int to int } func (p *Period) String() (string, string) { return time.Unix(int64(p.from), 0).UTC().String(), time.Unix(int64(p.to), 0).UTC().String() } // GetLastMonthPeriod - Get Period for "La...
period.go
0.604983
0.601155
period.go
starcoder
package blockhash import ( "fmt" "image" "image/color" "math" "math/big" "sort" "strconv" "github.com/dsoprea/go-logging" ) type Blockhash struct { image image.Image hashbits int toColor *color.Model hasAlpha bool hexdigest string isOpaqueable bool } // opaqueableModel automatic...
blockhash.go
0.563018
0.412944
blockhash.go
starcoder
package mapqueryparam import ( "encoding/json" "errors" "fmt" "net/url" "reflect" "strconv" "strings" "time" ) // EncodeValues takes a input struct and encodes the content into the form of a set of query parameters. // Input must be a pointer to a struct. Same as Encode. func EncodeValues(v interface{}) (url....
encode.go
0.713731
0.430686
encode.go
starcoder
package ast import ( "fmt" "github.com/golang/glog" ) // Visitor VisitBefore method is invoked for each node encountered by Walk. // If the result Visitor v is not nil, Walk visits each of the children of that // node with v. VisitAfter is called on n at the end. type Visitor interface { VisitBefore(n Node) (Vi...
internal/vm/ast/walk.go
0.698638
0.445952
walk.go
starcoder
package gopie import ( "math" ) func createLabels(chart PieChart, pieRect rectangle) []label { if len(chart.Values) == 0 { return createEmptyLabels() } if len(chart.Values) == 1 { return createSingleLabel(chart, pieRect) } return createMultipleLabels(chart, pieRect) } func createEmptyLabels() []label { re...
labels.go
0.809953
0.402275
labels.go
starcoder
package vec2 import ( "fmt" "math" ) // Rect is a coordinate system aligned rectangle defined by a Min and Max vector. type Rect struct { Min T Max T } // NewRect creates a Rect from two points. func NewRect(a, b *T) (rect Rect) { rect.Min = Min(a, b) rect.Max = Max(a, b) return rect } // ParseRect parses a ...
float64/vec2/rect.go
0.929103
0.600305
rect.go
starcoder