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 meta import ( "errors" "github.com/tomchavakis/turf-go/geojson" "github.com/tomchavakis/turf-go/geojson/feature" "github.com/tomchavakis/turf-go/geojson/geometry" ) // CoordEach iterate over coordinates in any Geojson object and apply the callbackFn // geojson can be a FeatureCollection | Feature | Geome...
meta/coordEach/coordEach.go
0.770378
0.509093
coordEach.go
starcoder
// Package horn provides an implementation of Higher Order Recurrent Neural Networks (HORN). package horn import ( "encoding/gob" mat "github.com/nlpodyssey/spago/pkg/mat32" "github.com/nlpodyssey/spago/pkg/ml/ag" "github.com/nlpodyssey/spago/pkg/ml/nn" "github.com/nlpodyssey/spago/pkg/utils" "log" ) var ( _ ...
pkg/ml/nn/recurrent/horn/horn.go
0.804828
0.406391
horn.go
starcoder
package neural import ( "fmt" "math" "math/rand" ) // Function32 defines a function that takes a float32 and returns a float32 type Function32 func(x float32) float32 // FunctionPair32 represents a function, a derivative of the function, and a // transform used for inference during training type FunctionPair32 s...
neural32.go
0.865679
0.672507
neural32.go
starcoder
// Convert different RGB colorspaces with their native illuminator to CIE XYZ and back. // RGB values must be linear and in the nominal range [0.0, 1.0]. // Ref.: [24][30][31]. package rgb // AdobeToXYZ converts from Adobe RGB (1998) with D65 illuminator to CIE XYZ. RGB values must be linear and in the nominal ra...
f64/rgb/rgb.go
0.885675
0.6402
rgb.go
starcoder
package planar import ( "fmt" "math" "github.com/paulmach/orb" ) // Area returns the area of the geometry in the 2d plane. func Area(g orb.Geometry) float64 { // TODO: make faster non-centroid version. _, a := CentroidArea(g) return a } // CentroidArea returns both the centroid and the area in the 2d plane. /...
planar/area.go
0.628635
0.69166
area.go
starcoder
package gobacktest // PortfolioHandler is the combined interface building block for a portfolio. type PortfolioHandler interface { OnSignaler OnFiller Investor Updater Casher Valuer Reseter } // OnSignaler is an interface for the OnSignal method type OnSignaler interface { OnSignal(SignalEvent, DataHandler) (...
portfolio.go
0.733738
0.550245
portfolio.go
starcoder
package binarysearchtree import ( "fmt" ) type Node struct { Value int Left *Node Right *Node } func NewBinarySearchTree(value int) *Node { return &Node{Value: value} } func (n *Node) Insert(value int) error { if value == n.Value { return fmt.Errorf("You can't insert duplicate value %d", value) } if val...
data-structure/binary-search-tree/binary_search_tree.go
0.59749
0.485295
binary_search_tree.go
starcoder
package iter // IterableForInt describes a struct that can be iterated over. type IterableForInt interface { Next() OptionForInt } // IteratorForInt embeds an Iterable and provides util functions for it. type IteratorForInt struct { iter IterableForInt } // Iterator implements Iterable. var _ IterableForInt = Ite...
examples/iterator.go
0.856797
0.448426
iterator.go
starcoder
package schema import ( "github.com/graphql-go/graphql" "github.com/ob-vss-ss18/ppl-stock/models" ) var stickType = graphql.NewObject(graphql.ObjectConfig{ Name: "Stick", Description: "A stick.", Fields: graphql.Fields{ "id": &graphql.Field{ Type: graphql.NewNonNull(graphql.Int), Description...
schema/stick.go
0.538498
0.412708
stick.go
starcoder
package plaid import ( "encoding/json" ) // NumbersACHNullable struct for NumbersACHNullable type NumbersACHNullable struct { // The Plaid account ID associated with the account numbers AccountId string `json:"account_id"` // The ACH account number for the account. Note that when using OAuth with Chase Bank (`i...
plaid/model_numbers_ach_nullable.go
0.766992
0.440048
model_numbers_ach_nullable.go
starcoder
package floatutils import ( "github.com/nlpodyssey/spago/pkg/mat64/internal/asm/f64" "math" "strconv" "strings" ) // Copy creates and return a copy of the given slice. func Copy(in []float64) []float64 { out := make([]float64, len(in)) copy(out, in) return out } // FillFloatSlice fills the given slice's elem...
pkg/mat64/floatutils/utils.go
0.828592
0.489198
utils.go
starcoder
package quality import ( "github.com/biogo/biogo/alphabet" "github.com/biogo/biogo/seq" ) // A slice of quality scores that satisfies the alphabet.Slice interface. type Qphreds []alphabet.Qphred func (q Qphreds) Make(len, cap int) alphabet.Slice { return make(Qphreds, len, cap) } func (q Qphreds) Len() int ...
seq/quality/phred.go
0.792705
0.50238
phred.go
starcoder
package geom // A MultiPoint is a collection of Points. type MultiPoint struct { // To represent an MultiPoint that allows EMPTY elements, e.g. // MULTIPOINT ( EMPTY, POINT(1.0 1.0), EMPTY), we have to allow // record ends. If there is an empty point, ends[i] == ends[i-1]. geom2 } // NewMultiPoint returns a new, ...
multipoint.go
0.847432
0.551151
multipoint.go
starcoder
package mixins import ( "io" "github.com/ipld/go-ipld-prime/datamodel" ) type FloatTraits struct { PkgName string TypeName string // see doc in kindTraitsGenerator TypeSymbol string // see doc in kindTraitsGenerator } func (FloatTraits) Kind() datamodel.Kind { return datamodel.Kind_Float } func (g FloatT...
schema/gen/go/mixins/floatGenMixin.go
0.540681
0.427038
floatGenMixin.go
starcoder
package flags import ( "fmt" "strings" "github.com/aquasecurity/tracee/tracee-ebpf/tracee" ) func FilterHelp() string { return `Select which events to trace by defining trace expressions that operate on events or process metadata. Only events that match all trace expressions will be traced (trace flags are ANDed...
cmd/tracee-ebpf/internal/flags/flags-filter.go
0.610686
0.444444
flags-filter.go
starcoder
package indicators import ( "container/list" "errors" "github.com/thetruetrade/gotrade" ) // A Linear Regression Indicator (LinReg), no storage, for use in other indicators type LinRegWithoutStorage struct { *baseIndicator *baseFloatBounds // private variables periodCounter int periodHistory *l...
indicators/linreg.go
0.702122
0.523238
linreg.go
starcoder
package amcl import ( r "crypto/rand" "crypto/sha256" "io" "math/big" "regexp" "strings" "github.com/IBM/mathlib/driver" "github.com/IBM/mathlib/driver/common" "github.com/hyperledger/fabric-amcl/amcl" "github.com/hyperledger/fabric-amcl/amcl/FP256BN" "github.com/pkg/errors" ) /***************************...
vendor/github.com/IBM/mathlib/driver/amcl/fp256bn.go
0.570212
0.410993
fp256bn.go
starcoder
package randvar import ( "math" "sync" "github.com/cockroachdb/errors" "golang.org/x/exp/rand" ) const ( // See https://github.com/brianfrankcooper/YCSB/blob/f886c1e7988f8f4965cb88a1fe2f6bad2c61b56d/core/src/main/java/com/yahoo/ycsb/generator/ScrambledZipfianGenerator.java#L33-L35 defaultMax = 10000000000 ...
internal/randvar/zipf.go
0.805785
0.412234
zipf.go
starcoder
package curve import ( "errors" "fmt" "math/big" GF "github.com/armfazh/hash-to-curve-ref/go-h2c/field" ) // MTCurve is a Montgomery curve type MTCurve struct{ *params } type M = *MTCurve func (e *MTCurve) String() string { return "By^2=x^3+Ax^2+x\n" + e.params.String() } // NewMontgomery returns a Montgomery...
go-h2c/curve/montgomery.go
0.790813
0.463141
montgomery.go
starcoder
package utils import ( "fmt" "reflect" "strconv" ) // NewValue new struct value with reflect type func NewValue(t reflect.Type) (v reflect.Value) { v = reflect.New(t) ov := v for t.Kind() == reflect.Ptr { v = v.Elem() t = t.Elem() e := reflect.New(t) v.Set(e) } if e := v.Elem(); e.Kind() == reflect.M...
utils/meta.go
0.561696
0.401365
meta.go
starcoder
package main import r "github.com/lachee/raylib-goplus/raylib" import "math" var orbitSpeed = float64(r.Deg2Rad) var zoomSpeed = 1.0 var camera r.Camera func main() { screenWidth := 800 screenHeight := 450 r.InitWindow(screenWidth, screenHeight, "Raylib Go Plus - 3D Primatives") camera = r.NewCamera(r.NewVecto...
raylib-example/3dprimitives/3dprimitives.go
0.701202
0.57093
3dprimitives.go
starcoder
package dual import ( "bytes" "log" "math/rand" "time" "github.com/pkg/errors" G "gorgonia.org/gorgonia" "gorgonia.org/tensor" "gorgonia.org/tensor/native" ) // Train is a basic trainer. func Train(d *Dual, Xs, policies, values *tensor.Dense, batches, iterations int) error { m := G.NewTapeMachine(d.g, G.Bin...
dualnet/meta.go
0.614278
0.456349
meta.go
starcoder
package polygo /* This file contains a small graphing library built on top of the polygo core. */ import ( "errors" "fmt" "image/color" "math" "math/rand" "time" "github.com/fogleman/gg" // For graphics. ) // A RealPolynomialGraph represents the graph of a set of polynomials. type RealPolyn...
graph.go
0.637482
0.401629
graph.go
starcoder
// +build gofuzz package roaring import ( "encoding/binary" "fmt" "io/ioutil" "reflect" ) // FuzzBitmapUnmarshalBinary fuzz tests the unmarshaling of binary // to both Pilosa and official roaring formats. func FuzzBitmapUnmarshalBinary(data []byte) int { b := NewBitmap() err := b.UnmarshalBinary(data) if err...
roaring/fuzzer.go
0.568895
0.496643
fuzzer.go
starcoder
package pixelate import ( "image" "image/color" "math" "github.com/fogleman/gg" ) type context struct { *gg.Context } // Brightness factor var bf = 1.0005 // Draw creates uniform cells with the quantified cell color of the source image. func (quant *Quant) Draw(img image.Image, numOfColors int, csize int, use...
pixelate/drawer.go
0.813572
0.494812
drawer.go
starcoder
package pgsql import ( "database/sql" "database/sql/driver" "strconv" ) // Int8RangeFromIntArray2 returns a driver.Valuer that produces a PostgreSQL int8range from the given Go [2]int. func Int8RangeFromIntArray2(val [2]int) driver.Valuer { return int8RangeFromIntArray2{val: val} } // Int8RangeToIntArray2 return...
pgsql/int8range.go
0.798698
0.497009
int8range.go
starcoder
package m64 import ( "math/big" "math/bits" "github.com/mmcloughlin/ec3/arith/eval" "github.com/mmcloughlin/ec3/arith/ir" "github.com/mmcloughlin/ec3/internal/bigint" "github.com/mmcloughlin/ec3/internal/errutil" ) // Word is a 64-bit machine word. type Word uint64 // Bits returns the number of bits required ...
arith/eval/m64/m64.go
0.723114
0.416144
m64.go
starcoder
package sunspec // SunSpec register addresses: // https://www.solaredge.com/sites/default/files/sunspec-implementation-technical-note.pdf const ( Dt_uint16 = iota Dt_uint32 Dt_int16 Dt_string Dt_acc32 ) type ModbusAddress struct { // E.g. 40000 Address uint16 // Only needed for 'Type: string' Size uint16 ...
datamodels/sunspec/sunspec.go
0.755276
0.447641
sunspec.go
starcoder
package encoder import ( errors "golang.org/x/xerrors" ) const ( // Penalty weights from section 6.8.2.1 maskUtilN1 = 3 maskUtilN2 = 3 maskUtilN3 = 40 maskUtilN4 = 10 ) // MaskUtil_applyMaskPenaltyRule1 Apply mask penalty rule 1 and return the penalty. // Find repetitive cells with the same color and give pena...
qrcode/encoder/mask_util.go
0.677794
0.578418
mask_util.go
starcoder
package main import ( "fmt" "image/color" "math/rand" "os" "time" "github.com/hajimehoshi/ebiten" "github.com/hajimehoshi/ebiten/ebitenutil" ) type World struct { cells []Cell width int height int } func NewWorld(width, height int) *World { return &World{ cells: make([]Cell, width*height), width: ...
world.go
0.588416
0.435661
world.go
starcoder
package main import ( "github.com/xidongc/go-leetcode/utils" "math" ) /* 55 jump game Given an array of non-negative integers nums, you are initially positioned at the first index of the array. Each element in the array represents your maximum jump length at that position. Determine if you are able to reach the...
dp/55-jump-game.go
0.753376
0.521045
55-jump-game.go
starcoder
package pktline // Utility functions for working with the Git pkt-line format. See // https://github.com/git/git/blob/master/Documentation/technical/protocol-common.txt import ( "bufio" "bytes" "fmt" "io" "strconv" ) const ( maxPktSize = 0xffff pktDelim = "0001" ) var ( flush = []byte("0000") ) // NewSca...
internal/git/pktline/pktline.go
0.817866
0.407186
pktline.go
starcoder
package pg_query func MakeStrNode(str string) *Node { return &Node{Node: &Node_String_{String_: &String{Str: str}}} } func MakeAConstStrNode(str string, location int32) *Node { return &Node{ Node: &Node_AConst{ AConst: &A_Const{ Val: MakeStrNode(str), Location: location, }, }, } } func Make...
vendor/github.com/pganalyze/pg_query_go/v2/makefuncs.go
0.679604
0.428532
makefuncs.go
starcoder
package iso20022 // Creation/cancellation of investment units on the books of the fund or its designated agent, as a result of executing an investment fund order. type InvestmentFundTransaction2 struct { // Type of investment fund transaction. TransactionType *TransactionType1CodeChoice `xml:"TxTp"` // Type of co...
InvestmentFundTransaction2.go
0.809238
0.457985
InvestmentFundTransaction2.go
starcoder
package canvas import ( "math" ) type Path2D struct { cv *Canvas p []pathPoint move vec cwSum float64 } type pathPoint struct { pos vec next vec flags pathPointFlag } type pathPointFlag uint8 const ( pathMove pathPointFlag = 1 << iota pathAttach pathIsRect pathIsConvex pathIsClockwise path...
path2d.go
0.566258
0.541227
path2d.go
starcoder
package modular import ( "errors" ) type Matrix struct { nRow int nCol int values []*Int } // NewMatrix creates a new (unexported) matrix struct. func NewMatrix(r, c int, vals []*Int) *Matrix { space := r*c - len(vals) for space > 0 { vals = append(vals, NewInt(0)) space-- } return &Matrix{ ...
modular/matrix.go
0.833934
0.446555
matrix.go
starcoder
package gamerules import ( "encoding/json" "fmt" "io" "os" . "chunkymonkey/types" ) // FurnaceData contains data on furnace reactions. type FurnaceData struct { // FuelDuration contains a map of fuel types to number of ticks that the fuel // lasts for. Fuels map[ItemTypeId]Ticks ...
src/chunkymonkey/gamerules/furnace_data.go
0.642432
0.422683
furnace_data.go
starcoder
package option import ( "math" "github.com/konimarti/fixedincome/pkg/term" ) const ( Call int = iota Put ) // European is the implementation of plain vanilla European option type European struct { // Type is the type of the option (call=0, put=1) Type int // S is the price of the underlying asset S float64 ...
pkg/instrument/option/european.go
0.75401
0.499451
european.go
starcoder
package operator import ( "github.com/matrixorigin/matrixcube/components/prophet/core" "github.com/matrixorigin/matrixcube/components/prophet/limit" "github.com/matrixorigin/matrixcube/pb/metapb" ) // OpInfluence records the influence of the cluster. type OpInfluence struct { StoresInfluence map[uint64]*StoreInf...
components/prophet/schedule/operator/influence.go
0.644001
0.422743
influence.go
starcoder
package reactnative const deployWorkflowDescription = `## Configure Android part of the deploy workflow To generate a signed APK: 1. Open the **Workflow** tab of your project on Bitrise.io 1. Add **Sign APK step right after Android Build step** 1. Click on **Code Signing** tab 1. Find the **ANDROID KEYSTORE FILE** s...
scanners/reactnative/const.go
0.76769
0.432962
const.go
starcoder
Package bitutil contains common function for bit-level operations. Pack and Unpack functions are used to pack and unpack a list of non-zero numbers very efficiently. */ package bitutil import ( "bytes" "fmt" "math" ) /* CompareByteArray compares the contents of two byte array slices. Returns true if both slices a...
bitutil/bitutil.go
0.662796
0.53965
bitutil.go
starcoder
package quickhull import ( "github.com/golang/geo/r3" ) // HalfEdgeMesh is a mesh consisting of half edges. // See: https://www.openmesh.org/media/Documentations/OpenMesh-6.3-Documentation/a00010.html type HalfEdgeMesh struct { Vertices []r3.Vector Faces []Face HalfEdges []HalfEdge } // HalfEdge is a half e...
half_edge_mesh.go
0.790288
0.547162
half_edge_mesh.go
starcoder
package board //CanPlace determines if the spot on the board can have a piece func (b *Board) CanPlace(x int, y int, block TetrisBlock) (canPlace bool) { pattern := block.Pattern //Given this block's pattern can we place it on the board? for w := 0; w < len(pattern); w++ { for h := 0; h < len(pattern[w]); h++ { ...
01-tetrisgo/pkg/board/gameplay.go
0.674694
0.635477
gameplay.go
starcoder
package stmt import ( "fmt" "strings" "github.com/lindb/lindb/aggregation/function" ) // Expr represents a interface for all expression types type Expr interface { // Rewrite rewrites the expr after parse Rewrite() string } // TagFilter represents tag filter for searching time series type TagFilter interface {...
sql/stmt/expr.go
0.726911
0.440108
expr.go
starcoder
package brotli import "encoding/binary" /* Copyright 2015 Google Inc. All Rights Reserved. Distributed under MIT license. See file LICENSE for detail or copy at https://opensource.org/licenses/MIT */ /* Function for fast encoding of an input fragment, independently from the input history. This function use...
vendor/github.com/andybalholm/brotli/compress_fragment.go
0.736874
0.603698
compress_fragment.go
starcoder
package validator import ( "bytes" "crypto/sha256" "fmt" "net" "net/url" "os" "reflect" "strconv" "strings" "time" "unicode/utf8" ) var timeType = reflect.TypeOf(time.Time{}) func (t *KValidator) IsURLEncoded() bool { return uRLEncodedRegex.MatchString(t.data.String()) } func (t *KValidator) IsHTMLEncod...
internal/validator/baked_in.go
0.74055
0.411879
baked_in.go
starcoder
package restruct import ( "encoding/binary" "fmt" "math" "reflect" ) // Unpacker is a type capable of unpacking a binary representation of itself // into a native representation. The Unpack function is expected to consume // a number of bytes from the buffer, then return a slice of the remaining // bytes in the b...
decoder.go
0.5144
0.449574
decoder.go
starcoder
package utils import ( "fmt" "github.com/axelarnetwork/utils/math" ) // NewCircularBuffer is the constructor of CircularBuffer func NewCircularBuffer(maxSize int) *CircularBuffer { return &CircularBuffer{ CumulativeValue: make([]uint64, 32), Index: 0, MaxSize: int32(maxSize), } } // Add ...
utils/circular_buffer.go
0.718989
0.448245
circular_buffer.go
starcoder
package main import ( "fmt" "math" "strings" ) func try(err error) { if err != nil { panic(err) } } func main() { // f, err := os.Open("inputs/day12_part1.txt") // try(err) // b, err := ioutil.ReadAll(f) // try(err) // trimmed := bytes.TrimSpace(b) Part1() Part2() } type System []Body func (s System)...
cmd/day12/day12.go
0.622804
0.42179
day12.go
starcoder
package gfx import ( "fmt" "math" "github.com/go-gl/mathgl/mgl32" "github.com/goxjs/gl" ) // SpriteBatch is a collection of images/quads/textures all drawn with a single draw call type SpriteBatch struct { size int count int color []float32 // Current color. This color, if present, will be...
gfx/sprite_batch.go
0.786869
0.450903
sprite_batch.go
starcoder
package fragments const Bits = ` {{- define "BitsForwardDeclaration" }} class {{ .Name }} final { public: constexpr {{ .Name }}() : value_(0u) {} explicit constexpr {{ .Name }}({{ .Type }} value) : value_(value) {} {{- range .Members }} const static {{ $.Name }} {{ .Name }}; {{- end }} const static {{ .N...
garnet/go/src/fidl/compiler/llcpp_backend/templates/fragments/bits.tmpl.go
0.68458
0.435001
bits.tmpl.go
starcoder
package qrprng import ( "fmt" "math" "math/big" "math/bits" ) const ( INT63_MASK = (1 << 63) - 1 // Largest prime (3 mod 4) less than 2^64, permutes [0, 2^64-189) DEFAULT_PRIME = uint64(math.MaxUint64 - 188) DEFAULT_INTERMEDIATE_OFFSET = 5_577_006_791_947_779_410 ) // QuadraticResiduePRNG is a ...
qrprng.go
0.722821
0.542621
qrprng.go
starcoder
package main import ( "fmt" "log" ) type SnailfishNumber struct { left *SnailfishNumber right *SnailfishNumber value int } type SnailfishParse struct { data string pos int } func (parse *SnailfishParse) next() byte { parse.pos += 1 return parse.data[parse.pos-1] } func (parse *SnailfishParse) expect(c b...
2021/18.go
0.642096
0.443721
18.go
starcoder
package fee var ( feePairs = []feePair{ { minVolume: 0.0, maxVolume: 500.00, feePercentage: 0.0085, }, { minVolume: 500.00, maxVolume: 1000.00, feePercentage: 0.0083, }, { minVolume: 1000.00, maxVolume: 3000.00, feePercentage: 0.0080, }, { minVolume:...
pkg/fee/fee.go
0.628293
0.403214
fee.go
starcoder
package math import ( "fmt" "sort" "github.com/bitflow-stream/go-bitflow/bitflow" "github.com/bitflow-stream/go-bitflow/script/reg" log "github.com/sirupsen/logrus" ) // Graham Scan for computing the convex hull of a point set // https://en.wikipedia.org/wiki/Graham_scan type Point struct { X, Y float64 } fu...
steps/math/convex_hull.go
0.586286
0.515742
convex_hull.go
starcoder
package main import ( "math" "fmt" ) type node struct { pos Position prev *node distance int } func newNode(pos Position) node { return node{pos:pos, distance:math.MaxInt32} } type grid struct { nodes []*node } func (g *grid) addNode(n *node) *grid { g.nodes = append(g.nodes, n) return g } func (g *grid) ge...
day15/go/anoff/src/dijkstra.go
0.517571
0.487124
dijkstra.go
starcoder
package starwars //Based on https://github.com/facebook/relay/blob/master/examples/star-wars/data/database.js /** * This defines a basic set of data for our Star Wars Schema. * * This data is hard coded for the sake of the demo, but you could imagine * fetching this data from a backend service rather than from har...
examples/starwars/database.go
0.654895
0.450118
database.go
starcoder
// Package horn provides an implementation of Higher Order Recurrent Neural Networks (HORN). package horn import ( "encoding/gob" "math" "github.com/nlpodyssey/spago/ag" "github.com/nlpodyssey/spago/mat" "github.com/nlpodyssey/spago/mat/float" "github.com/nlpodyssey/spago/nn" ) var _ nn.Model = &Model{} // M...
nn/recurrent/horn/horn.go
0.881066
0.470189
horn.go
starcoder
package sources import ( "math" "github.com/crnbaker/gostringsynth/numeric" ) // stringSource provides attributes that define a finite-difference simulation of a vibrating string type stringSource struct { fdtdSource sampleRate float64 stringLengthM float64 physics stringSettings pluck pluckS...
sources/string.go
0.799481
0.518485
string.go
starcoder
// Package maputil includes some functions to manipulate map. package maputil import "reflect" // Keys returns a slice of the map's keys func Keys[K comparable, V any](m map[K]V) []K { keys := make([]K, 0, len(m)) for k := range m { keys = append(keys, k) } return keys } // Values returns a slice of the map...
maputil/map.go
0.826957
0.514034
map.go
starcoder
package utils import ( "image" "image/color" ) // ForEachPixel loops through the image and calls f functions for each [x, y] position. func ForEachPixel(size image.Point, f func(x int, y int)) { for y := 0; y < size.Y; y++ { for x := 0; x < size.X; x++ { f(x, y) } } } // ForEachGrayPixel loops through the...
utils/helpers.go
0.820469
0.710666
helpers.go
starcoder
package velocypack import "fmt" // Type returns the vpack type of the slice func (s Slice) Type() ValueType { return typeMap[s.head()] } // IsType returns true when the vpack type of the slice is equal to the given type. // Returns false otherwise. func (s Slice) IsType(t ValueType) bool { return typeMap[s.head()...
deps/github.com/arangodb/go-velocypack/slice_type.go
0.890628
0.492188
slice_type.go
starcoder
package bit import ( "fmt" "math" "os" ) // Array is an array in in which elements are packed with a width of // b < 64 bits. It allows for space-efficient storage when integers have // well-knownvalue ranges that don't correspond to exactly 64, 32, 16, or 8 // bits. type Array struct { Length int Bits byte Dat...
go/bit/bit.go
0.650134
0.42668
bit.go
starcoder
package compiler import ( "github.com/llir/llvm/ir/constant" "github.com/llir/llvm/ir/enum" "github.com/llir/llvm/ir/types" "github.com/llir/llvm/ir/value" ) // AddEval generates IR for add func AddEval(scope *Scope, value1 value.Value, value2 value.Value) value.Value { if value1.Type() == types.I32 { return s...
internal/compiler/operation.go
0.541651
0.406862
operation.go
starcoder
package val import "github.com/dolthub/dolt/go/store/pool" type TupleBuilder struct { Desc TupleDesc buf [MaxTupleDataSize]byte pos ByteSize fields [MaxTupleFields][]byte } func NewTupleBuilder(desc TupleDesc) *TupleBuilder { return &TupleBuilder{Desc: desc} } // Tuple materializes a Tuple from the fields w...
go/store/val/tuple_builder.go
0.633637
0.426501
tuple_builder.go
starcoder
package pulse import ( "fmt" "strings" "time" "github.com/insolar/insolar/longbits" "github.com/insolar/insolar/network/consensus/common/cryptkit" ) const InvalidPulseEpoch uint32 = 0 const EphemeralPulseEpoch = InvalidPulseEpoch + 1 var _ DataReader = &Data{} type Data struct { PulseNumber Number DataExt ...
pulse/pulse_data.go
0.67662
0.499939
pulse_data.go
starcoder
package core import ( "math" ) // PointToLineCartesianDistance - Get the min distance from a point to a line (Cartesian Coordinates) // https://en.m.wikipedia.org/wiki/Distance_from_a_point_to_a_line func PointToLineCartesianDistance(p Point, l Line) float64 { var top = math.Abs(((l[1].Y - l[0].Y) * p.X) - ((l[1].X...
core/GetPointToLineDistance.go
0.882713
0.695926
GetPointToLineDistance.go
starcoder
package function import ( "errors" "kanzi" ) // Zero Length Encoding is a simple encoding algorithm by Wheeler // closely related to Run Length Encoding. The main difference is // that only runs of 0 values are processed. Also, the length is // encoded in a different way (each digit in a different byte) // This alg...
go/src/kanzi/function/ZRLT.go
0.665737
0.424233
ZRLT.go
starcoder
package stat import "math" // Stat maintains an online collection of summary statistics. By "online" we // mean each value is added once as in a stream, and there is only an O(1) cost. type Stat struct { n int min float64 max float64 sum float64 sum2 float64 } // NewStat returns a new Stat struct. func Ne...
stat.go
0.890919
0.545588
stat.go
starcoder
package MSFStore import ( "bytes" "encoding/gob" "fmt" "sort" "strconv" ) // Histogram is, for now, a map store implementing something akin to the // HDRHistogram idea, meaning it's high-accuracy and has few restrictions. // It can be an issue for space, as it will get bigger as more keys are added. type Histogr...
msfstore.go
0.705176
0.49707
msfstore.go
starcoder
// Package image implements a basic 2-D image library. package image // A Config consists of an image's color model and dimensions. type Config struct { ColorModel ColorModel Width, Height int } // An Image is a finite rectangular grid of Colors drawn from a ColorModel. type Image interface { // ColorModel ret...
src/pkg/image/image.go
0.890011
0.759448
image.go
starcoder
package main import ( "fmt" "math" "time" ) const maxDelay = 28 // max collect-to-report delay to track in days type stats struct { pos, neg, other int // number of molecular tests by result ab, ag, unk int // number of serological, antigen, and unknown tests agePos, ageNeg map[ageRange]int // molecular ...
bioportal/stats.go
0.697712
0.619471
stats.go
starcoder
package main import ( "encoding/binary" "fmt" "io" ) type SoundFontHydra struct { // Headers is a listing of all presets within the SoundFont compatible file. // It always contains a minimum of two records, one record for each preset and one for a terminal record. Headers []PresetHeader // PBag is a listing o...
hydra.go
0.61451
0.503113
hydra.go
starcoder
package dots import ( "image" "image/color" "unsafe" ) type DotImage struct { CpRect image.Rectangle Stride int Cps []CodePoint } //NewImage creates empty image with //given size in CodePoints. func NewImage(r image.Rectangle) *DotImage { return &DotImage{ Cps: make([]CodePoint, 1*r.Dx()*r.Dy()), Cp...
image.go
0.774796
0.471406
image.go
starcoder
package stream import "sync" // filterErrors records errors accumulated during the execution of a filter. type filterErrors struct { mu sync.Mutex err error } func (e *filterErrors) record(err error) { if err != nil { e.mu.Lock() if e.err == nil { e.err = err } e.mu.Unlock() } } func (e *filterError...
vendor/github.com/ghemawat/stream/stream.go
0.720958
0.410402
stream.go
starcoder
package helpers import ( "fmt" "math" "math/bits" "k8s.io/apimachinery/pkg/api/resource" ) /* The Cloud Provider's volume plugins provision disks for corresponding PersistentVolumeClaims. Cloud Providers use different allocation unit for their disk sizes. AWS allows you to specify the size as an integer amount o...
vendor/k8s.io/cloud-provider/volume/helpers/rounding.go
0.834339
0.529446
rounding.go
starcoder
package search import ( "github.com/gzg1984/golucene/core/index" ) // search/similarities/Similarity.java /* Similarity defines the components of Lucene scoring. Expert: Scoring API. This is a low-level API, you should only extend this API if you want to implement an information retrieval model. If you are instea...
core/search/similarities.go
0.826852
0.607896
similarities.go
starcoder
package opentsdb import ( "errors" "fmt" "strconv" "time" ) // GetRelativeStart - returns a start time based on an end time and a duration string func GetRelativeStart(end time.Time, s string) (time.Time, error) { if string(s[len(s)-2:]) == "ms" { d, err := time.ParseDuration(s) return end.Add(-d), err } ...
opentsdb/parse.go
0.583322
0.400779
parse.go
starcoder
package kmeans import ( "bytes" "encoding/binary" "fmt" "image/color" "math" "math/cmplx" "math/rand" //"code.google.com/p/lzma" "github.com/gonum/plot" "github.com/gonum/plot/plotter" "github.com/gonum/plot/vg" "github.com/gonum/plot/vg/draw" "github.com/mjibson/go-dsp/fft" "github.com/pointlander/comp...
kmeans.go
0.594787
0.529263
kmeans.go
starcoder
package util import ( "math" "time" ) type DateDiffResult struct { Year, Month, Day, Hour, Min, Sec int } // AgeAt gets the age of an entity at a certain time. func AgeAt(birthDate time.Time, now time.Time) int { years := now.Year() - birthDate.Year() birthDay := getAdjustedBirthDay(birthDate, now) if no...
util/date.go
0.645567
0.521715
date.go
starcoder
// Package shist provides functions for computing a histogram of values of an // image, and for computing and rendering a 2-dimensional histogram of values of // a complex or ComplexInt32 gradient image. package shist import ( "fmt" "image" "math" "math/bits" ) import ( . "github.com/Causticity/sipp/scomplex" ...
shist/shist.go
0.794624
0.788685
shist.go
starcoder
package main import ( "bytes" . "specify" t "./_test/specify" ) func init() { Describe("Be", func() { It("should match reference equality", func(e Example) { var a, b int e.Value(&a).Should(t.Be(&a)) e.Value(&a).ShouldNot(t.Be(&b)) }) It("should not care about the value", func(e Example) { a :=...
src/matcher_spec.go
0.712032
0.776199
matcher_spec.go
starcoder
package main import ( "fmt" "io" ) type SoundFontInfo struct { // SfVersion identifyies the SoundFont specification version level to which the file complies. // e.g. 2.1 SfVersion struct { Major, Minor uint16 } // made from the ifil subchunk // Engine is a mandatory field identifying the wavetable sound eng...
info.go
0.531939
0.482856
info.go
starcoder
package aoc2019 import ( "context" "fmt" "io/ioutil" "math" "strings" "github.com/pkg/errors" ) type day15TileType int64 const ( day15TileTypeWall day15TileType = iota day15TileTypeFloor day15TileTypeOxygen day15TileTypeUnknown ) type day15Tile struct { X, Y int64 Type day15TileType distFromStart int...
day15.go
0.594904
0.437463
day15.go
starcoder
package ringbuffer import ( "github.com/pkg/errors" ) const ( defaultRingBufferCapacity = 8192 ) // A RingBuffer implements a cyclical buffer, that maintains the last cap bytes written to it, where cap is the capacity // of the ring buffer. // This type is not safe to be used concurrently. When using it from multi...
pkg/ringbuffer/ring_buffer.go
0.81257
0.451689
ring_buffer.go
starcoder
package twobucket import ( "errors" ) type bucket int const ( bOne bucket = iota bTwo ) type step int const ( emptyOne step = iota emptyTwo fillOne fillTwo pourOneToTwo pourTwoToOne ) type problem struct { capacity [2]int goal int start bucket } type state struct { level [2]int previo...
exercises/two-bucket/example.go
0.621081
0.438545
example.go
starcoder
package overlay import ( "fmt" "strconv" "strings" "go.starlark.net/starlark" ) type MatchAnnotationExpectsKwarg struct { expects *starlark.Value missingOK *starlark.Value thread *starlark.Thread } func (a *MatchAnnotationExpectsKwarg) FillInDefaults(defaults MatchChildDefaultsAnnotation) { if a.expect...
pkg/yttlibrary/overlay/match_annotation_expects_kwarg.go
0.586878
0.477737
match_annotation_expects_kwarg.go
starcoder
package quasigo //go:generate stringer -type=opcode -trimprefix=op type opcode byte const ( opInvalid opcode = 0 // Encoding: 0x01 (width=1) // Stack effect: (value) -> () opPop opcode = 1 // Encoding: 0x02 (width=1) // Stack effect: (x) -> (x x) opDup opcode = 2 // Encoding: 0x03 index:u8 (width=2) // S...
vendor/github.com/quasilyte/go-ruleguard/ruleguard/quasigo/opcodes.gen.go
0.52975
0.465691
opcodes.gen.go
starcoder
package erf import ( "github.com/dreading/gospecfunc/erf/internal/toms" "math" "math/cmplx" ) // Erf computes approximate values for the error function func Erf(z complex128) complex128 { return 1 - toms.Faddeyeva(1i*z)*cmplx.Exp(-z*z) } // Erfc computes approximate values for the complementary error function e...
erf/erf.go
0.824356
0.527377
erf.go
starcoder
package tree type Color int const ( RED Color = 0 BLACK Color = 1 ) type TreeNode struct { color Color value int left *TreeNode right *TreeNode parent *TreeNode } func NewTreeNode(value int, color Color, parent *TreeNode) *TreeNode { return &TreeNode{ color: color, value: value, left: nil, ...
tree/RedBlackTree.go
0.681409
0.488222
RedBlackTree.go
starcoder
package main import ( "bytes" "fmt" "os" "strconv" "strings" fa "github.com/kentwait/gofasta" ) // ConsistentAlignmentPositions returns the list of positions in the alignment that are considered consistent given by the alignment pattern per site across all given alignments. func ConsistentAlignmentPositions(ga...
pipeline.go
0.659734
0.60013
pipeline.go
starcoder
package gopy // Number is a generic interface of all numeric types in Go. type Number interface { int | int64 | int32 | int16 | int8 | uint | uint64 | uint32 | uint16 | uint8 | float64 | float32 } // NumLike is a generic interface of all numeric types and custom numeric types in Go. type NumLike interface { ~int | ...
sliceops.go
0.875095
0.648911
sliceops.go
starcoder
package query // ExampleSpec provides a mapping example and some input/output results to // display. type ExampleSpec struct { Mapping string Summary string Results [][2]string } // NewExampleSpec creates a new example spec. func NewExampleSpec(summary, mapping string, results ...string) ExampleSpec { structuredR...
internal/bloblang/query/docs.go
0.812904
0.645274
docs.go
starcoder
package poly import ( poly1d "github.com/adamcolton/geom/calc/poly" "github.com/adamcolton/geom/d2" "github.com/adamcolton/geom/d2/curve/line" ) // Poly is a 2D polynomial curve. type Poly struct { Coefficients } // New polynomial curve func New(pts ...d2.V) Poly { return Poly{Slice(pts)} } // Copy the coeffic...
d2/curve/poly/poly.go
0.815416
0.739658
poly.go
starcoder
package cryptypes import "database/sql/driver" // EncryptedInt8 supports encrypting Int8 data type EncryptedInt8 struct { Field Raw int8 } // Scan converts the value from the DB into a usable EncryptedInt8 value func (s *EncryptedInt8) Scan(value interface{}) error { return decrypt(value.([]byte), &s.Raw) } // V...
cryptypes/type_int8.go
0.795936
0.443721
type_int8.go
starcoder
package edge import ( "errors" "image" "image/draw" "math" "github.com/robfig/graphics-go/graphics/convolve" ) var ( sobelX = &convolve.SeparableKernel{ X: []float64{-1, 0, +1}, Y: []float64{1, 2, 1}, } sobelY = &convolve.SeparableKernel{ X: []float64{1, 2, 1}, Y: []float64{-1, 0, +1}, } scharrX =...
graphics/edge/sobel.go
0.709321
0.492798
sobel.go
starcoder
package stringo import ( "strings" "unicode/utf8" ) type TransformFlag uint const ( // TransformNone No transformations are ordered. Only constraints maximum length // TransformNone turns all other flags OFF. TransformNone TransformFlag = 1 // TransformTrim Trim spaces before and after process the input // Tr...
transform.go
0.539226
0.558869
transform.go
starcoder
package codegen import ( "regexp" "strings" "github.com/pulumi/pulumi/pkg/v2/codegen/schema" ) var ( // IMPORTANT! The following regexp's contain named capturing groups. // It's the `?P<group_name>` where group_name can be any name. // When changing the group names, be sure to change the reference to // the ...
pkg/codegen/docs.go
0.674587
0.522263
docs.go
starcoder
package core import ( "fmt" "math" "github.com/go-gl/mathgl/mgl32" "github.com/go-gl/mathgl/mgl64" ) // Shadower is an interface which wraps logic to implement shadowing of a light type Shadower interface { // Textures returns the shadow textures used by this shadower Textures() []Texture // Render calls the...
core/shadow.go
0.816918
0.404449
shadow.go
starcoder
package common // The following `enum` definitions are in line with the corresponding // ones in InChI 1.04 software. A notable difference is that we DO // NOT provide for specifying bond stereo with respect to the second // atom in the pair. // Radical represents possible radical configurations of an atom. type Rad...
common/enums.go
0.720663
0.581511
enums.go
starcoder