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 trxdbtest import ( "context" "testing" "time" ct "github.com/dfuse-io/dfuse-eosio/codec/testing" pbcodec "github.com/dfuse-io/dfuse-eosio/pb/dfuse/eosio/codec/v1" "github.com/streamingfast/kvdb" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" ) var noon = time.Date(2020, t...
trxdb/trxdbtest/timelineexplorertest.go
0.52902
0.561515
timelineexplorertest.go
starcoder
package semantics type TwoInts struct { x uint64 y uint64 } type S struct { a uint64 b TwoInts c bool } func NewS() *S { return &S{ a: 2, b: TwoInts{x: 1, y: 2}, c: true, } } func (s *S) readA() uint64 { return s.a } func (s *S) readB() TwoInts { return s.b } func (s S) readBVal() TwoInts { return...
internal/examples/semantics/structs.go
0.643665
0.570212
structs.go
starcoder
package clustering import ( "time" ) // ClusterResults represents the results of clustering a list of // test failures. type ClusterResults struct { // AlgorithmsVersion is the version of clustering algorithms used to // cluster test results in this chunk. (This is a version over the // set of algorithms, distin...
go/src/infra/appengine/weetbix/internal/clustering/clusterresults.go
0.749179
0.514278
clusterresults.go
starcoder
package inventory // nolint[lll] import "sigs.k8s.io/k8s-container-image-promoter/lib/container" // Various set manipulation operations. Some set operations are missing, // because, we don't use them. // Minus is a set operation. func (a RegInvImageDigest) Minus(b RegInvImageDigest) RegInvImageDigest { aSet := a.To...
lib/dockerregistry/set.go
0.759404
0.449211
set.go
starcoder
package wonderEffectMath import "math" // ApplyEasing Возможно данная фукнция выглядит ужасно // Но это максимальная и быстрая реализация применения функций плавности // И предполагаю, что здесь что-то очень редко будет меняться (кроме добавления еще нериализованных функций) func ApplyEasing(t float32, easingFunction...
wonderEffectMath/easing.go
0.500732
0.739387
easing.go
starcoder
package main import ( "log" "math" "strings" "github.com/hajimehoshi/ebiten/v2" ) // BallScale is the scale factor of the ball made by the Renderer#GeoM const BallScale = 0.05 // Properties for ball movement prior to any interactions const ( BallInitialVelocity = 1.75 BallInitialAngle = -135 ) // Ball rep...
src/ball.go
0.770206
0.445771
ball.go
starcoder
package tr import ( "strings" ) type trset string var EmptySet = trset("") // Replace translates, squeezes, or deletes characters from the src string. // If the first character of from is '^' then the from set is complemented. // Ranges are specified with '-' between to characters. // If the to set is empty, then ...
util/tr/tr.go
0.518546
0.411761
tr.go
starcoder
package primitive import ( "fmt" "math" "github.com/fogleman/gg" ) type Triangle struct { Worker *Worker X1, Y1 int X2, Y2 int X3, Y3 int } //Generates a new trianlge with at least one vertex in the image and the other vertices in 30 by 30 triangle around it. func NewRandomTriangle(worker *Worker) *Triangle {...
primitive/triangle.go
0.729134
0.562116
triangle.go
starcoder
// Package compliance provides the tools to validate the compliance of driver // implementations and BQL behavior testing. The compliance package is built // around stories. A story is a collection of graphs and a sequence of // assertions against the provided data. An assertion is defined by a tuple // containing a B...
tools/compliance/entry.go
0.737536
0.707569
entry.go
starcoder
package dataframe import ( "fmt" "sync" "strings" "github.com/isuruceanu/gota/series" ) // GroupedDataFrame a DataFrame which is grouped by columns type GroupedDataFrame struct { DataFrame groupedBy []string } // Group create a GroupedDataFrame with cols groups func (d DataFrame) Group(cols ...string) Groupe...
dataframe/dataframe.grouped.go
0.618089
0.432842
dataframe.grouped.go
starcoder
package continuous import ( "github.com/jtejido/stats" "github.com/jtejido/stats/err" "math" "math/rand" ) // Wigner semicircle distribution // https://en.wikipedia.org/wiki/Wigner_semicircle_distribution type WignerSemiCircle struct { radius, center float64 src rand.Source } func NewWignerSemiCircl...
dist/continuous/wigner_semi_circle.go
0.806358
0.462594
wigner_semi_circle.go
starcoder
package lamb import ( "math" "github.com/nlpodyssey/spago/gd" "github.com/nlpodyssey/spago/mat" "github.com/nlpodyssey/spago/mat/float" "github.com/nlpodyssey/spago/nn" ) var _ gd.MethodConfig = &Config{} // Config provides configuration settings for Lamb optimizer. type Config struct { gd.MethodConfig Step...
gd/lamb/lamb.go
0.82887
0.452838
lamb.go
starcoder
package opensimplex const ( stretchConstant2D = -0.211324865405187 // (1/Math.sqrt(2+1)-1)/2 squishConstant2D = 0.366025403784439 // (Math.sqrt(2+1)-1)/2 stretchConstant3D = -1.0 / 6 // (1/Math.sqrt(3+1)-1)/3 squishConstant3D = 1.0 / 3 // (Math.sqrt(3+1)-1)/3 stretchConstant4D = -0.1381966...
vendor/github.com/ojrac/opensimplex-go/opensimplex_internal.go
0.54359
0.541106
opensimplex_internal.go
starcoder
package zgeo import ( "fmt" "image" "math" "github.com/torlangballe/zutil/zmath" ) type Pos struct { X float64 `json:"x"` Y float64 `json:"y"` } func (p Pos) String() string { return fmt.Sprintf("%g,%g", p.X, p.Y) } func (p Pos) Vertice(vertical bool) float64 { if vertical { return p.Y } return p.X } ...
zgeo/pos.go
0.829561
0.529385
pos.go
starcoder
package operator import ( "github.com/matrixorigin/matrixone/pkg/container/nulls" "github.com/matrixorigin/matrixone/pkg/container/types" "github.com/matrixorigin/matrixone/pkg/container/vector" "github.com/matrixorigin/matrixone/pkg/vectorize/ne" "github.com/matrixorigin/matrixone/pkg/vm/process" ) func nequal[...
pkg/sql/plan2/function/operator/ne.go
0.591487
0.46557
ne.go
starcoder
package ast import ( "fmt" ) func walkLexNode(node LexNode, visitor LexNodeVisitor) LexNodeVisitor { switch n := node.(type) { case *LexAlt: return n.Walk(visitor) case *LexCharLit: return n.Walk(visitor) case *LexCharRange: return n.Walk(visitor) case *LexDot: return n.Walk(visitor) case *LexGroupPat...
internal/ast/lexnodewalker.go
0.609757
0.490053
lexnodewalker.go
starcoder
package factory import ( "github.com/Yiling-J/carrier/examples/ent_recipe/ent" "context" ) type EntIngredientMutator struct { Name string } type entIngredientMutation struct { nameType int nameFunc func(ctx context.Context, i *EntIngredientMutator, c int, creator *ent.IngredientCreate) error afterCreateFunc ...
examples/ent_recipe/carrier/factory/ent_ingredient.go
0.510741
0.484685
ent_ingredient.go
starcoder
package mapqueryparam import ( "encoding/json" "fmt" "math" "net/url" "reflect" "strconv" "time" ) var zeroValue reflect.Value // DecodeValues takes a set of query parameters and uses reflection to decode the content into an output structure. // Output must be a pointer to a struct. Same as Decode. func Decod...
decode.go
0.725162
0.504761
decode.go
starcoder
package timeseries import ( "errors" "time" tu "github.com/grokify/simplego/time/timeutil" ) type TimeSeriesSimple struct { Name string DisplayName string Times []time.Time } func NewTimeSeriesSimple(name, displayName string) TimeSeriesSimple { return TimeSeriesSimple{ Name: name, Dis...
data/timeseries/time_series_simple.go
0.636805
0.418994
time_series_simple.go
starcoder
package values import ( "fmt" "github.com/influxdata/flux/codes" "github.com/influxdata/flux/internal/errors" "github.com/influxdata/flux/semantic" ) type Scope interface { // Lookup a name in the scope. Lookup(name string) (Value, bool) // LocalLookup a name in current scope only. LocalLookup(name string) ...
vendor/github.com/influxdata/flux/values/scope.go
0.677581
0.422683
scope.go
starcoder
package euler1 import ( "math/big" "github.com/andrew-field/maths" ) // LargeSum returns an int whose digits are the first ten digits of the sum of the following one-hundred 50-digit numbers. func LargeSum() int { numbers := make([]big.Int, 100) numbers[0].SetString("3710728753390210279879799822083759024651013...
1-20/13_LargeSum.go
0.599016
0.429788
13_LargeSum.go
starcoder
package indexeddb import ( "errors" "reflect" ) // Compare compares two values. func Compare(left interface{}, right interface{}) (int, error) { leftRt := reflect.TypeOf(left) rightRt := reflect.TypeOf(right) leftKind := leftRt.Kind() rightKind := rightRt.Kind() if leftKind != rightKind { if leftKind == ref...
indexeddb/compare.go
0.692018
0.745908
compare.go
starcoder
package chart import ( "fmt" "math" "strings" ) // TicksProvider is a type that provides ticks. type TicksProvider interface { GetTicks(r Renderer, defaults Style, vf ValueFormatter) []Tick } // Tick represents a label on an axis. type Tick struct { Value float64 Label string } // Ticks is an array of ticks. ...
tick.go
0.782538
0.415551
tick.go
starcoder
package geom // Simplify returns a simplified version of the geometry using the // Ramer-Douglas-Peucker algorithm. Sometimes a simplified geometry can become // invalid, in which case an error is returned rather than attempting to fix // the geometry. Validation of the result can be skipped by making use of the // ge...
geom/alg_simplify.go
0.807612
0.58602
alg_simplify.go
starcoder
package main import ( "crypto/sha1" "errors" "flag" "fmt" "io/ioutil" "sort" "github.com/Binject/debug/pe" ) func main() { //again, not sure this should really be in bananaphone, will move/etc when sensible.. var loc string flag.StringVar(&loc, "i", "", "File to get PE hash of") flag.Parse() if loc == "...
example/participationcertificate/main.go
0.544559
0.448607
main.go
starcoder
package evaluation import ( "github.com/vodinhphuc/golearn/base" "math/rand" ) // GetCrossValidatedMetric returns the mean and variance of the confusion-matrix-derived // metric across all folds. func GetCrossValidatedMetric(in []ConfusionMatrix, metric func(ConfusionMatrix) float64) (mean, variance float64) { sco...
evaluation/cross_fold.go
0.811003
0.410343
cross_fold.go
starcoder
package task2 import ( "aoc-2021-day22/geometry" "aoc-2021-day22/input" ) func Solve(data input.Data) (uint64, error) { cuboids := make([]geometry.Cuboid, 0) for _, op := range data.Operations { cuboidsAfterOp := make([]geometry.Cuboid, 0) for _, existing := range cuboids { if notIntersect(op.Cuboid, exi...
2021/day22/task2/solver.go
0.604749
0.602032
solver.go
starcoder
package pcapng import ( "bytes" "encoding/hex" "fmt" "github.com/bearmini/pcapng-go/pcapng/blocktype" "github.com/pkg/errors" ) /* 4.4. Simple Packet Block The Simple Packet Block (SPB) is a lightweight container for storing the packets coming from the network. Its presence is optional. A Simple Pa...
pcapng/simple_packet_block.go
0.730097
0.531149
simple_packet_block.go
starcoder
package validator // ErrorTemplates returns a map of validation tags with error messages as html templates. func ErrorTemplates() map[string]string { return map[string]string{ "alpha": `{{.Namespace}} can only contain alphabetic characters`, "alphanum": `{{.Namespace}} can only co...
pkg/validator/templates.go
0.796886
0.579162
templates.go
starcoder
package broker import ( "time" "github.com/Jeffail/benthos/v3/lib/metrics" "github.com/Jeffail/benthos/v3/lib/types" ) //------------------------------------------------------------------------------ // FanIn is a broker that implements types.Producer, takes an array of inputs // and routes them through a singl...
lib/broker/fan_in.go
0.594551
0.455804
fan_in.go
starcoder
package truetype // The Truetype opcodes are summarized at // https://developer.apple.com/fonts/TTRefMan/RM07/appendixA.html const ( opSVTCA0 = 0x00 // Set freedom and projection Vectors To Coordinate Axis opSVTCA1 = 0x01 // . opSPVTCA0 = 0x02 // Set Projection Vector To Coordinate Axis opSPVTCA1 = 0x0...
vendor/github.com/golang/freetype/truetype/opcodes.go
0.624294
0.600393
opcodes.go
starcoder
package bmp var x = ` BI_RLE8 When the biCompression member is set to BI_RLE8, the bitmap is compressed using a run-length encoding format for an 8-bit bitmap. This format may be compressed in either of two modes: encoded and absolute. Both modes can occur anywhere throughout a single bitmap. Encoded mode consists...
docs.go
0.81134
0.78695
docs.go
starcoder
package function import ( "fmt" "strings" errors "gopkg.in/src-d/go-errors.v1" "github.com/dolthub/go-mysql-server/sql" "github.com/dolthub/go-mysql-server/sql/expression" ) // STX is a function that returns the x value from a given point. type STX struct { expression.NaryExpression } var _ sql.FunctionExpr...
sql/expression/function/x_y_latitude_longitude.go
0.782039
0.449876
x_y_latitude_longitude.go
starcoder
package times import ( "math" "time" ) // GetDateOfFirstMondayOfMonth : get date of first monday func GetDateOfFirstMondayOfMonth(t time.Time) int { dayFirstDateOfMonth := getDayOfFirstDateOfMonth(t) if dayFirstDateOfMonth < 2 { return 2 - dayFirstDateOfMonth } return 9 - dayFirstDateOfMonth } // GetDateOf...
times.go
0.721351
0.88258
times.go
starcoder
package main import ( "de.knallisworld/aoc/aoc2018/dayless" "errors" "fmt" "math" "strconv" "strings" "time" ) const AocDay = 6 const AocDayName = "day06" func main() { dayless.PrintDayHeader(AocDay) defer dayless.TimeTrack(time.Now(), AocDayName) dayless.PrintStepHeader(1) lines, _ := dayless.ReadFileTo...
day06/main.go
0.580947
0.442335
main.go
starcoder
package meta import ( "fmt" "strings" ) /* SatisfyingValueSchema represents a high-level schema of a given leaf's satisfying values. It is used to generate value schema predicates by validating its representative values against the provided schema using a JSON schema validator. SatisfyingValueSchema is an immutabl...
api/rql/internal/primary/meta/satisfyingValueSchema.go
0.725843
0.428771
satisfyingValueSchema.go
starcoder
package ecc import ( "fmt" "math/big" ) // s256Field allows finite field math for 256 bit integers. type s256Field struct { Num *big.Int Prime *big.Int } func newS256FieldFromInt64(num int64, prime int64) *s256Field { return newS256Field(big.NewInt(num), big.NewInt(prime)) } func newS256Field(num *big.Int, p...
ecc/s256field.go
0.734215
0.401306
s256field.go
starcoder
package june import "sort" /* # Two City Scheduling # https://leetcode.com/explore/challenge/card/june-leetcoding-challenge/539/week-1-june-1st-june-7th/3349/ There are 2N people a company is planning to interview. The cost of flying the i-th person to city A is costs[i][0], and the cost of flying the i-th person t...
june/matrix.go
0.601828
0.449151
matrix.go
starcoder
package plaid import ( "encoding/json" ) // PSLFStatus Information about the student's eligibility in the Public Service Loan Forgiveness program. This is only returned if the institution is Fedloan (`ins_116527`). type PSLFStatus struct { // The estimated date borrower will have completed 120 qualifying monthly ...
plaid/model_pslf_status.go
0.742048
0.428891
model_pslf_status.go
starcoder
package graph import ( i04eb5309aeaafadd28374d79c8471df9b267510b4dc2e3144c378c50f6fd7b55 "github.com/microsoft/kiota/abstractions/go/serialization" ) // RecurrencePattern type RecurrencePattern struct { // Stores additional data not described in the OpenAPI description found when deserializing. Can be used f...
models/microsoft/graph/recurrence_pattern.go
0.753467
0.657016
recurrence_pattern.go
starcoder
package knn import ( "github.com/gonum/matrix/mat64" "github.com/sjwhitworth/golearn/base" pairwiseMetrics "github.com/sjwhitworth/golearn/metrics/pairwise" util "github.com/sjwhitworth/golearn/utilities" ) // A KNNClassifier consists of a data matrix, associated labels in the same order as the matrix, and a dist...
knn/knn.go
0.817319
0.539954
knn.go
starcoder
package list // Map applies mapping to values and returns the results as a new slice. func Map[T, R any](mapping func(T) R, values []T) []R { output := make([]R, len(values)) iter := func(i int, t T) { output[i] = mapping(t) } Iteri(iter, values) return output } // Map2 applies mapping to pairs of values from the...
list/map.go
0.859133
0.851212
map.go
starcoder
package auth import "github.com/Jeffail/benthos/v3/internal/docs" // Description returns a markdown version of NATs authentication documentation. func Description() string { return `### Authentication There are several components within Benthos which utilise NATS services. You will find that each of these component...
internal/impl/nats/auth/docs.go
0.851398
0.475666
docs.go
starcoder
package graphhopper type MatrixRequest struct { // Specifiy multiple points for which the weight-, route-, time- or distance-matrix should be calculated. In this case the starts are identical to the destinations. If there are N points, then NxN entries will be calculated. The order of the point parameter is important...
go/model_matrix_request.go
0.825871
0.731754
model_matrix_request.go
starcoder
package tetromino // SRS: https://tetris.fandom.com/wiki/SRS func (s SRSSprite) Rotate(x, y, clockwise int) int { switch len(s.Piece) { case 9: return s.Rotate9(x, y, clockwise) case 12: return s.Rotate12(x, y, clockwise) case 16: return s.Rotate16(x, y, clockwise) default: panic("unreachable") } } func...
tetromino/srs.go
0.717111
0.492981
srs.go
starcoder
package ch11q03a import "errors" // Given an array and a guarrantee that any element is no more than k positions // away from where it would be if the array were sorted, sort the array. func SortAlmostSortedArray(arr []int, k int) { if k >= len(arr) { return } minHeap := MinHeap{} for i := 0; i < k; i++ { mi...
ch11/q03a/sort_almost_sorted_array.go
0.681303
0.451387
sort_almost_sorted_array.go
starcoder
package gt import ( "database/sql/driver" "io" ) /* Creates a random UUID using `gt.ReadNullUuid` and "crypto/rand". Panics if random bytes can't be read. */ func RandomNullUuid() NullUuid { return NullUuid(RandomUuid()) } // Creates a UUID (version 4 variant 1) from bytes from the provided reader. func ReadNullU...
gt_null_uuid.go
0.814016
0.609873
gt_null_uuid.go
starcoder
package hm import ( "fmt" ) // Type represents all the possible type constructors. type Type interface { Substitutable Name() string // Name is the name of the constructor Normalize(TypeVarSet, TypeVarSet) (Type, error) // Normalize normalizes all the type variable names in the t...
vendor/github.com/chewxy/hm/type.go
0.565779
0.46035
type.go
starcoder
package simplifier import "github.com/twtiger/gosecco/tree" func reduceTransformers(inp tree.Expression, ss ...tree.Transformer) tree.Expression { result := inp for _, s := range ss { result = s.Transform(result) } return result } // SimplifyPolicy will take a policy and simplify all expressions in it func S...
vendor/github.com/twtiger/gosecco/simplifier/simplifier.go
0.560734
0.633821
simplifier.go
starcoder
package rtc import "math" // SmoothTriangle returns a new smooth SmoothTriangleT. func SmoothTriangle(p1, p2, p3, n1, n2, n3 Tuple) *SmoothTriangleT { t := Triangle(p1, p2, p3) return &SmoothTriangleT{ TriangleT: *t, N1: n1, N2: n2, N3: n3, } } // SmoothTriangleT represents a smooth t...
rtc/smooth-triangle.go
0.923333
0.622746
smooth-triangle.go
starcoder
package engine import ( "math" "math/rand" ) func init() { DeclFunc("ext_make3dgrains", Voronoi3d, "3D Voronoi tesselation over shape (grain size, starting region number, num regions, shape, seed)") } func Voronoi3d(grainsize float64, startRegion int, numRegions int, inputShape Shape, seed int) { Refer("Lel2014...
engine/ext_make3dgrains.go
0.626924
0.601359
ext_make3dgrains.go
starcoder
package canvas import ( "image" "image/color" "math" ) // LinearGradient defines a Gradient travelling straight at a given angle. // The only supported values for the angle are `0.0` (vertical) and `90.0` (horizontal), currently. type LinearGradient struct { baseObject StartColor color.Color // The beginning RG...
canvas/gradient.go
0.922517
0.698856
gradient.go
starcoder
package adaptortest import ( "context" "github.com/dogmatiq/dogma" "github.com/dogmatiq/dogma/fixtures" "github.com/dogmatiq/projectionkit/resource" "github.com/onsi/ginkgo" "github.com/onsi/ginkgo/extensions/table" "github.com/onsi/gomega" ) // DescribeAdaptor declares generic behavioral tests for a specific...
internal/adaptortest/suite.go
0.587943
0.536495
suite.go
starcoder
package clang // #include "./clang-c/Index.h" // #include "go-clang.h" import "C" import "fmt" /* Describes a single piece of text within a code-completion string. Each "chunk" within a code-completion string (CXCompletionString) is either a piece of text with a specific "kind" that describes how that text shoul...
clang/completionchunkkind_gen.go
0.558688
0.591428
completionchunkkind_gen.go
starcoder
package mortems var templateContent = `<!-- ^ The bits with these tags are just helpful comments, and won't show up on your post-mortem Post Mortem Agenda: --- Initial statement - Read aloud: "We're trying to prepare for a future where we are as stupid as we are today" - During the meeting we will disallow coun...
mortems/template.go
0.591251
0.631182
template.go
starcoder
package Util import ( "encoding/json" "fmt" "reflect" "strconv" "strings" ) func ToBool(v interface{}) bool { switch val := v.(type) { case bool: return val case float32, float64: // direct type conversion may cause data loss, use reflection instead return refle...
Util/Conv.go
0.657868
0.444625
Conv.go
starcoder
package bitset const uintSize = 32 << (^uint(0) >> 32 & 1) // Set a set of unsigned interger which store unique values, without any particular order type Set struct { m []uint } // New creates a new Set, initially empty set structure func New() *Set { return NewWithSize(uintSize) } // NewWithSize creates a new Se...
bitset.go
0.565299
0.405684
bitset.go
starcoder
package variable import ( "github.com/pkg/errors" ) func NewUndoableDecisionVariables() UndoableDecisionVariables { return make(UndoableDecisionVariables, 0) } // UndoableDecisionVariables offers up a name-indexed collection of UndoableDecisionVariable instances, along with // convenience methods for the collecti...
internal/pkg/model/variable/UndoableDecisionVariables.go
0.718199
0.423279
UndoableDecisionVariables.go
starcoder
package main import ( "fmt" "math" "math/rand" "image" "image/color" "image/png" "os" "gfx/bitmap" ) const width = 512 const height = 512 type Bitmap struct { image *image.RGBA } func New(width int, height int) Bitmap { image := image.NewRGBA(image.Rect(0, 0, width, height)) return Bitmap{image: image...
npr_lines/npr_lines.go
0.629319
0.48749
npr_lines.go
starcoder
package main import ( vec "github.com/etic4/vecmath" "github.com/etic4/vecmath/maths" ) var ( defaulAngle float64 = maths.Rad(90) defaultMaxForce float64 = 3 ) type tentacle struct { base vec.Vec2 nbrSegs int segSize float64 speed vec.Vec2 maxSpeed float64 maxForce floa...
tentacle.go
0.665737
0.442034
tentacle.go
starcoder
package pano2cube import ( "image" "math" "github.com/gonum/floats" "image/color" ) // get x,y,z coords from out image pixels coords // i,j are pixel coords // faceIdx is face number // faceSize is edge length func outImgToXYZ(i int, j int, faceIdx int, faceSize int)(float64, float64, float64) { a := 2.0 * floa...
pano2cube.go
0.675658
0.44559
pano2cube.go
starcoder
package rendering import ( . "github.com/drbrain/go-unicornify/unicornify/core" "math" ) type FacetTracer struct { countRoot int countRootF float64 facets []*GroupTracer bounds Bounds isEmpty bool } func NewFacetTracer(bounds Bounds, countRoot int) *FacetTracer { return &FacetTracer{ countRoot:...
unicornify/rendering/facettracer.go
0.772531
0.406155
facettracer.go
starcoder
package cudnn // #include <cudnn.h> import "C" import ( "runtime" "unsafe" "github.com/pkg/errors" ) // Op is a tuple describing the operation that needs to be done type Op struct { internal C.cudnnOpTensorDescriptor_t op OpTensorOp // The Operation that needs to be done dataType DataTyp...
vendor/gorgonia.org/cu/dnn/optensor.go
0.713332
0.507751
optensor.go
starcoder
package funcs import ( "strings" ) //ToLower returns a toLower function with the input function as its parameter. func ToLower(s String) String { return TrimString(&toLower{ S: s, hash: Hash("toLower", s), hasVariable: s.HasVariable(), }) } type toLower struct { S String hash ...
relapse/funcs/string.go
0.792223
0.443118
string.go
starcoder
package slices import ( "constraints" "github.com/dairaga/gs" "github.com/dairaga/gs/funcs" ) type S[T any] []T // Empty returns an empty slice. func Empty[T any]() S[T] { return []T{} } // One returns an one element slice. func One[T any](v T) S[T] { return []T{v} } // From returns a slice from given eleme...
slices/slices.go
0.812979
0.608507
slices.go
starcoder
package rgif import ( "image/gif" "os" r "github.com/lachee/raylib-goplus/raylib" ) type FrameDisposal int const ( FrameDisposalNone FrameDisposal = iota FrameDisposalDontDispose FrameDisposalRestoreBackground FrameDisposalRestorePrevious ) //GifImage represents a gif texture type GifImage struct { //Text...
raylib-gif/gif.go
0.653238
0.407569
gif.go
starcoder
package phys import ( "phys/vect" "log" ) func k_scalar_body(body *Body, r, n vect.Vect) float32 { rcn := vect.Cross(r, n) return body.m_inv + (body.i_inv * rcn * rcn) } func k_scalar(a, b *Body, r1, r2, n vect.Vect) float32 { value := k_scalar_body(a, r1, n) + k_scalar_body(b, r2, n) if value == 0.0 { log.P...
vendor/phys/misc.go
0.552057
0.438966
misc.go
starcoder
package eoy import ( "fmt" "time" ) //Donor is used to provide a primary key for storing stats by month. type Donor struct { //ID is YYYY-MM SupporterID string `gorm:"supporter_id"` FirstName string LastName string CreatedDate *time.Time } //DonorResult holds a month and a stats record. type DonorResult ...
pkg/supporters.go
0.510008
0.437884
supporters.go
starcoder
package reducer // GroupBy groups the input using the given key function. // For each key, one instance of the valReducer is created to further process the values with that key. func GroupBy[A any, K comparable, V any](key func(A) K, valReduce Reducer[A, V]) Reducer[A, map[K]V] { return func() ReducerInstance[A, map[...
reducer/gouping.go
0.774413
0.408867
gouping.go
starcoder
package tuple import ( "fmt" "golang.org/x/exp/constraints" ) // T5 is a tuple type holding 5 generic values. type T5[Ty1, Ty2, Ty3, Ty4, Ty5 any] struct { V1 Ty1 V2 Ty2 V3 Ty3 V4 Ty4 V5 Ty5 } // Len returns the number of values held by the tuple. func (t T5[Ty1, Ty2, Ty3, Ty4, Ty5]) Len() int { return 5 } ...
tuple5.go
0.79053
0.460713
tuple5.go
starcoder
package geometry import ( _ "text/tabwriter" ) type Mat1x1 [1]float64 func (a Mat1x1) Add(b Mat1x1) Mat1x1 { return Mat1x1{a[0] + b[0]} } func (m Mat1x1) AddScalar(f float64) Mat1x1 { return Mat1x1{ m[0] + f, } } func (m Mat1x1) Concatenate(f float64) Mat1x2 { return Mat1x2{m[0], f} } func (m Mat1x1) Homog...
mat1.go
0.745028
0.712882
mat1.go
starcoder
package geometry import "math" type Direction3D struct { direction Vector3D } func NewDirection(x float32, y float32, z float32) Direction3D { return NewDirection_FromVector(NewVector(x, y, z)) } func NewDirection_BetweenPoints(from Point3D, to Point3D) Direction3D { return NewDirection_FromVector(NewVector_Betw...
geometry/Direction3D.go
0.872931
0.873647
Direction3D.go
starcoder
package signdigest import ( i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91 "github.com/microsoft/kiota-abstractions-go/serialization" ) // SignDigestRequestBody provides operations to call the signDigest method. type SignDigestRequestBody struct { // Stores additional data not described in ...
informationprotection/signdigest/sign_digest_request_body.go
0.774839
0.438244
sign_digest_request_body.go
starcoder
package protos import ( "fmt" "github.com/golang/protobuf/proto" "bytes" "errors" "sort" "reflect" ) // IsValidBlockExtension checks whether the other txSetStateValue is a valid extension of this txSetStateValue blockwise // meaning it only adds new blocks or nothing, and the txNumber is consistent with the to...
protos/txsetstatevalue.go
0.638046
0.420064
txsetstatevalue.go
starcoder
package texttable import ( "fmt" "math" ) // BoundingBox is a rectangular bounding box type BoundingBox struct { XMin float64 `json:"xMin" xml:"xMin,attr"` YMin float64 `json:"yMin" xml:"yMin,attr"` XMax float64 `json:"xMax" xml:"xMax,attr"` YMax float64 `json:"yMax" xml:"yMax,attr"` } // Size returns the widt...
texttable/boundingbox.go
0.911805
0.501587
boundingbox.go
starcoder
package unrolledlinkedlist import ( "errors" List "github.com/zimmski/container/list" ) // node holds a single node with values of a unrolled linked list type node struct { next *node // The node after this node in the list previous *node // The node before this node in the list values []i...
list/unrolledlinkedlist/unrolledlinkedlist.go
0.664431
0.543348
unrolledlinkedlist.go
starcoder
package kuddle import ( "bytes" "fmt" "io" "io/ioutil" "os" "github.com/ghodss/yaml" kyaml "k8s.io/apimachinery/pkg/util/yaml" ) /* Using the full k8s API to deserialize their typed, versioned objects is... somewhat of an interesting errand, and one this code doesn't pursue. One of the nearest examples I ...
pkg/kuddle/serial.go
0.573559
0.47591
serial.go
starcoder
package v1alpha2 // GetIsDefault returns the value of the boolean property. If unset, it's the default value specified in the devfile:default:value marker func (in *CommandGroup) GetIsDefault() bool { return getBoolOrDefault(in.IsDefault, false) } // GetHotReloadCapable returns the value of the boolean property. I...
vendor/github.com/devfile/api/v2/pkg/apis/workspaces/v1alpha2/zz_generated.getters.go
0.830457
0.44065
zz_generated.getters.go
starcoder
package bheap import ( "container/heap" "godev/basic" ) // Heap use heap interface from "container/heap" type Heap struct { values []interface{} comparator basic.Comparator } func (h Heap) Len() int { return len(h.values) } func (h Heap) Less(i, j int) bool { return h.comparator(h.values[i], h.values[j]) ...
basic/datastructure/heap/bheap/bheap.go
0.809012
0.431824
bheap.go
starcoder
package seq import ( "errors" "fmt" "runtime" "sync" "github.com/shenwei356/util/byteutil" ) /*Alphabet could be defined. Attention that, **the letters are case sensitive**. For example, DNA: DNA, _ = NewAlphabet( "DNA", []byte("acgtACGT"), []byte("tgcaTGCA"), []byte(" -"), []byte("nN")) */ type A...
seq/alphabet.go
0.578091
0.414662
alphabet.go
starcoder
package discovery import "fmt" type Humidifier struct { // A list of MQTT topics subscribed to receive availability (online/offline) updates. Must not be used together with `availability_topic` // Default: <no value> Availability []Availability `json:"availability,omitempty"` // When `availability` is configure...
humidifier.go
0.828662
0.457016
humidifier.go
starcoder
package dfs import ( "fmt" "github.com/wangyoucao577/algorithms_practice/graph" ) type implementMethod int const ( // Recurse implement DFS by recurse Recurse implementMethod = iota // StackBased implement DFS by stack and loop StackBased ) type dfsTree struct { root graph.NodeID // DFS start node, i.e. ro...
dfs/dfs.go
0.617974
0.480479
dfs.go
starcoder
package pcapng import ( "bytes" "fmt" "strings" "github.com/bearmini/pcapng-go/pcapng/blocktype" "github.com/bearmini/pcapng-go/pcapng/optioncode" "github.com/pkg/errors" ) /* 4.6. Interface Statistics Block The Interface Statistics Block (ISB) contains the capture statistics for a given interface and ...
pcapng/interface_statistics_block.go
0.692642
0.435181
interface_statistics_block.go
starcoder
package ros import ( "bytes" "encoding/binary" "math" "github.com/pkg/errors" ) // LEByteDecoder is a little-endian byte decoder, implements the ByteDecoder interface. type LEByteDecoder struct{} var _ ByteDecoder = LEByteDecoder{} // Helpers func CheckSize(buf *bytes.Reader, size int) error { if size < 0 { ...
ros/byte_decoder_le.go
0.761627
0.435781
byte_decoder_le.go
starcoder
// Package flow contains a number of constructors for Flow nodes // that are convenient for testing. package flow import ( "math/rand" "net/url" "regexp" "github.com/grailbio/reflow" "github.com/grailbio/reflow/flow" "github.com/grailbio/reflow/values" ) func randString() string { const ( minLen = 10 max...
test/flow/constructor.go
0.754463
0.499023
constructor.go
starcoder
package life import ( "log" "math/rand" "strconv" "time" ) // World is our representation of the board or grid of Cells type World struct { emptyCell Cell param Param step int64 grid map[string]*Cell } var neighboursAt = [8][2]int{ {-1, 1}, {0, 1}, {1, 1}, // above {-1, 0} /* self */, {1, 0},...
go/life/world.go
0.582254
0.508727
world.go
starcoder
package main /* * Quick validation * */ import ( "fmt" "log" "reflect" "time" "github.com/blewater/rsaints/lib" ) func assertBool(funcName string, res, expected bool) { if res != expected { log.Fatalf("%s resulted in %t, expected %t\n", funcName, res, expected) } } func assertEqInt64(funcName string...
main.go
0.570092
0.458349
main.go
starcoder
package indicator import ( "fmt" "time" "github.com/rodrigo-brito/ninjabot/model" "github.com/rodrigo-brito/ninjabot/plot" "github.com/markcheno/go-talib" ) func Spertrend(period int, factor float64, color string) plot.Indicator { return &supertrend{ Period: period, Factor: factor, Color: color, } } ...
plot/indicator/supertrend.go
0.513181
0.426142
supertrend.go
starcoder
package models import ( "github.com/shopspring/decimal" "time" ) // MarketOrder is just a simple struct to homologue the exchange responses type MarketOrder struct { Amount decimal.Decimal `json:"amount"` Price decimal.Decimal `json:"price"` } // FiatRates is the struct to handle internally the OpenRate respons...
models/rates.go
0.597138
0.437884
rates.go
starcoder
package main import ( "math" "math/rand" "time" ) type Boid struct { Position Vector2D Velocity Vector2D Id int } func (b Boid) start() { for { b.moveOne() time.Sleep(5 * time.Microsecond) } } func (b Boid) CalculateAcceleration() Vector2D { upper, lower := b.position.AddV(viewRadius), b.position...
boids/boid.go
0.675229
0.529872
boid.go
starcoder
package parse import ( "github.com/cdkini/Okra/src/okraerr" "github.com/cdkini/Okra/src/interpreter/ast" ) // A Parser evaluates a collection of tokens and constructs abstract syntax trees (ASTs) out of // the resulting expressions and statements. It is also responsible for consolidating parse errors // and provid...
src/interpreter/parse/parser.go
0.770637
0.456228
parser.go
starcoder
package main import ( "fmt" "math" "strconv" "strings" "time" "github.com/sanderploegsma/advent-of-code/2019/utils" ) func main() { paths, _ := utils.ReadLines("input.txt") start := time.Now() result := DistanceToClosestIntersection(paths[0], paths[1]) end := time.Since(start) fmt.Printf("[PART ONE] dist...
2019/go/03/main.go
0.815673
0.45417
main.go
starcoder
package streaming import "github.com/ipld/go-ipld-prime/schema" func GetHeaderType() schema.Type { ts := schema.TypeSystem{} ts.Init() ts.Accumulate(schema.SpawnList("Aunts", "Hash", false)) ts.Accumulate(schema.SpawnStruct("Proof", []schema.StructField{ schema.SpawnStructField("Total", "Int", false, false...
x/anconprotocol/store/streaming/dag_cosmos_schema.go
0.507324
0.510192
dag_cosmos_schema.go
starcoder
package mesh import ( "github.com/go-gl/mathgl/mgl32" ) // Mesh ... type Mesh struct { Indices []uint32 Positions []float32 Colors []float32 Coords []float32 Normals []float32 Target []int32 } // NewMesh ... func NewMesh() *Mesh { return &Mesh{} } // FromGob ... func FromGob(path string) (m *Me...
pkg/mesh/mesh.go
0.50415
0.4133
mesh.go
starcoder
package deep import ( "math" ) // GetLoss returns a loss function given a LossType func GetLoss(loss LossType) Loss { switch loss { case LossCrossEntropy: return CrossEntropy{} case LossMeanSquared: return MeanSquared{} case LossBinaryCrossEntropy: return BinaryCrossEntropy{} } return CrossEntropy{} } /...
plugins/data/learn/ml-libs-godeep/loss.go
0.883695
0.712732
loss.go
starcoder
package curves import ( "github.com/elainaaa/gosu-pp/math/vector" "sync" ) const BezierQuantization = 0.5 const BezierQuantizationSq = BezierQuantization * BezierQuantization type ItemStack struct { items [][]vector.Vector2f lock sync.RWMutex } func NewStack() *ItemStack { return &ItemStack{items: make([][]ve...
math/curves/bezierapproximator.go
0.759582
0.481881
bezierapproximator.go
starcoder
package processor import ( "fmt" "time" "github.com/Jeffail/benthos/v3/lib/log" "github.com/Jeffail/benthos/v3/lib/metrics" "github.com/Jeffail/benthos/v3/lib/types" "github.com/Jeffail/benthos/v3/lib/x/docs" jmespath "github.com/jmespath/go-jmespath" "github.com/opentracing/opentracing-go" ) //-------------...
lib/processor/jmespath.go
0.690872
0.801198
jmespath.go
starcoder
package funk import ( "bytes" "math/rand" "reflect" ) var numericZeros = []interface{}{ int(0), int8(0), int16(0), int32(0), int64(0), uint(0), uint8(0), uint16(0), uint32(0), uint64(0), float32(0), float64(0), } // ToFloat64 converts any numeric value to float64. func ToFloat64(x interface{}) (float6...
helpers.go
0.725162
0.469034
helpers.go
starcoder
package gotrader import ( "github.com/cornelk/hashmap" "go.uber.org/atomic" ) // Side represents the type of position, which can be short or long type Side int const ( //Short represents a selling position Short Side = iota // Long represents a buying position Long ) func (s Side) String() string { names :...
position.go
0.794584
0.416203
position.go
starcoder
package ents import ( "fmt" "strings" "entgo.io/ent/dialect/sql" "github.com/volatiletech/boilbench/ents/airport" ) // Airport is the model entity for the Airport schema. type Airport struct { config `json:"-"` // ID of the ent. ID int `json:"id,omitempty"` // Size holds the value of the "size" field. Size...
ents/airport.go
0.619701
0.400749
airport.go
starcoder