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 tntengine - define TntEngine type and it's methods package tntengine import ( "bytes" "fmt" "math/big" ) // Rotor - the type of the TNT2 rotor type Rotor struct { Size int Start int Step int Current int Rotor []byte } // New - creates a new Rotor with the given size, start, step and rot...
rotor.go
0.662032
0.409988
rotor.go
starcoder
package main import ( "k8s.io/klog" "math/rand" "math" "github.com/randysimpson/go-matrix/matrix" ) func main() { klog.Infoln("Initializing ml tutorial application"); sampleSize := 100 var X []float64 var T []float64 //build the X and T array of sample data for i := 0; i < sampleSize; i++ { //get random...
01_linear_regression_sgd/main.go
0.555194
0.440409
main.go
starcoder
package audio import ( "time" "github.com/kasworld/h4o/_examples/app" "github.com/kasworld/h4o/audio" "github.com/kasworld/h4o/eventtype" "github.com/kasworld/h4o/math32" "github.com/kasworld/h4o/util/helper" ) func init() { app.DemoMap["audio.doppler"] = &AudioDoppler{} } type AudioDoppler struct { ps1 *P...
_examples/demos/audio/doppler.go
0.621196
0.405096
doppler.go
starcoder
package vmath import ( "fmt" "github.com/go-gl/mathgl/mgl32" ) type AABB struct { Min mgl32.Vec3 Max mgl32.Vec3 } func NewAABB(x1, y1, z1, x2, y2, z2 float32) AABB { return AABB{ Min: mgl32.Vec3{x1, y1, z1}, Max: mgl32.Vec3{x2, y2, z2}, } } func (a AABB) RotateX(an, ox, oy, oz float32) AABB { mat := mg...
type/vmath/aabb.go
0.619011
0.534248
aabb.go
starcoder
package svg import "image/color" var cssColors = map[string]*color.RGBA{ "aliceblue": &color.RGBA{R: 240, G: 248, B: 255, A: 255}, "antiquewhite": &color.RGBA{R: 250, G: 235, B: 215, A: 255}, "aqua": &color.RGBA{R: 0, G: 255, B: 255, A: 255}, "aquamarine": &color.RGBA{...
colors.go
0.603815
0.509764
colors.go
starcoder
package revocation import ( "crypto/rand" "github.com/go-errors/errors" "github.com/privacybydesign/gabi/big" "github.com/privacybydesign/gabi/keyproof" "github.com/privacybydesign/gabi/pkg/common" ) /* This implements the zero knowledge proof of the RSA-B accumulator for revocation, introduced in "Dynamic Accu...
revocation/proof.go
0.71889
0.673125
proof.go
starcoder
package plantest import ( "fmt" "time" "github.com/wolffcm/flux" "github.com/wolffcm/flux/plan" ) // Spec is a set of nodes and edges of a logical query plan type PlanSpec struct { Nodes []plan.Node // Edges is a list of predecessor-to-successor edges. // [1, 3] => Nodes[1] is a predecessor of Nodes[3]. // ...
plan/plantest/plan.go
0.688783
0.487917
plan.go
starcoder
package propcheck import ( "fmt" "github.com/hashicorp/go-multierror" "testing" ) type TestCases = int //The number of test cases to run. type PropName = string type Run = func(RunParms) Result type RunParms struct { TestCases TestCases Rng SimpleRNG } type Result interface { IsFalsified() bool } type P...
propcheck/prop.go
0.678647
0.486697
prop.go
starcoder
package day03 import ( "fmt" "io" "os" ) type point struct { x int y int } /* Solve1 solves the following AOC 2015 problem: Santa is delivering presents to an infinite two-dimensional grid of houses. He begins by delivering a present to the house at his starting location, and then an elf at the North Pole ca...
day03/day03.go
0.507568
0.597667
day03.go
starcoder
package sampler import ( "errors" "fmt" "jensmcatanho/raytracer-go/math/geometry" "math/rand" "time" ) type Sampler struct { Samples int Sets int method func(int, int, *[]geometry.Vector) samples []geometry.Vector shuffledIndices []int count int jump int } func NewSampler(args ...i...
math/sampler/sampler.go
0.535098
0.456894
sampler.go
starcoder
package aferosteps import ( "context" "fmt" "os" "path/filepath" "sync" "github.com/cucumber/godog" "github.com/godogx/expandvars" "github.com/nhatthm/aferoassert" "github.com/spf13/afero" ) const defaultFs = "_default" // TempDirer creates a temp dir evey time it is called. type TempDirer interface { Tem...
manager.go
0.520009
0.477006
manager.go
starcoder
package evaluator import ( "clint/ast" "clint/object" ) var ( NULL = &object.Null{} TRUE = &object.Boolean{Value: true} FALSE = &object.Boolean{Value: false} ) func Eval(node ast.Node) object.Object { switch node := node.(type) { case *ast.Program: return evalProgram(node) case *ast.ExpressionStatement:...
evaluator/evaluator.go
0.60871
0.427038
evaluator.go
starcoder
package types import "github.com/attic-labs/noms/go/hash" type SkipValueCallback func(v Value) bool // WalkValues loads prolly trees progressively by walking down the tree. We don't wants to invoke // the value callback on internal sub-trees (which are valid values) because they are not logical // values in the gra...
go/types/walk.go
0.577257
0.410934
walk.go
starcoder
package nlp import ( "io" "math" "github.com/james-bowman/sparse" "gonum.org/v1/gonum/mat" ) // TfidfTransformer takes a raw term document matrix and weights each raw term frequency // value depending upon how commonly it occurs across all documents within the corpus. // For example a very commonly occurring wor...
weightings.go
0.880258
0.671152
weightings.go
starcoder
package packed // Efficient sequential read/write of packed integers. type BulkOperationPacked1 struct { *BulkOperationPacked } func newBulkOperationPacked1() BulkOperation { return &BulkOperationPacked1{newBulkOperationPacked(1)} } func (op *BulkOperationPacked1) decodeLongToInt(blocks []int64, values []int32, i...
core/util/packed/bulkOperation1.go
0.629888
0.614625
bulkOperation1.go
starcoder
package dlx type problem struct { // input rows uint32 columns uint32 matrix [][]uint32 partialSolution []uint32 // internal nodes [][]*node sentinel *node candidate *candidate } // DLX : dancing link solver interface to solve the defined problem type DLX interface { Solve(...
pkg/dlx/dlx.go
0.646795
0.400808
dlx.go
starcoder
package stateful import ( "fmt" "regexp" "time" "github.com/influxdata/kapacitor/tick/ast" ) type EvalLambdaNode struct { nodeEvaluator NodeEvaluator constReturnType ast.ValueType state ExecutionState } func NewEvalLambdaNode(lambda *ast.LambdaNode) (*EvalLambdaNode, error) { nodeEvaluator, err ...
tick/stateful/eval_lambda_node.go
0.630344
0.417034
eval_lambda_node.go
starcoder
package neotest import ( "time" "github.com/signalfx/golib/datapoint" "github.com/signalfx/golib/event" "github.com/signalfx/golib/trace" "github.com/signalfx/signalfx-agent/internal/core/dpfilters" "github.com/signalfx/signalfx-agent/internal/monitors/types" ) // TestOutput can be used in place of the normal ...
internal/neotest/output.go
0.656218
0.424531
output.go
starcoder
package portalprocess import ( "errors" "github.com/incognitochain/incognito-chain/common" "github.com/incognitochain/incognito-chain/dataaccessobject/statedb" "github.com/incognitochain/incognito-chain/portal/portalv3" "math" "math/big" "sort" ) type RateInfo struct { Rate uint64 Decimal uint8 } type Por...
portal/portalv3/portalprocess/portalexchangeratetool.go
0.685423
0.408306
portalexchangeratetool.go
starcoder
package main import ( "errors" "gopkg.in/gographics/imagick.v3/imagick" "gopkg.in/yaml.v2" "time" ) type Identify struct { Image struct { Filename string `yaml:"Filename"` Format string `yaml:"Format"` MimeType string `yaml:"Mime type"` Class string `yaml:"Class"` Geometry stri...
parseidentify.go
0.604516
0.498718
parseidentify.go
starcoder
package chared /* we want to make using color palettes easier, especially creating palettes from scratch for existing images. for that to work we cannot solely rely on indexes or we need to used fixed indexes for each color. either way we need a way to transform pictures from the old palettes to the new. it would be ...
chared/pal.go
0.712932
0.566558
pal.go
starcoder
package p2102 type Item struct { key int val string } func (this Item) Less(that Item) bool { return this.key > that.key || this.key == that.key && this.val < that.val } /** * this is a AVL tree */ type Node struct { item Item height int cnt int size int left, right *Node } func ...
src/leetcode/set1000/set2000/set2100/set2100/p2102/solution.go
0.781831
0.529993
solution.go
starcoder
package configifytest import ( "time" "github.com/robsignorelli/configify" "github.com/stretchr/testify/mock" ) // NewMockSource creates a mock source that lets you instruct it exactly how to // respond for specific inputs. func NewMockSource(setup func(*MockSource)) configify.Source { // We call setup() before ...
configifytest/mocks.go
0.755997
0.48688
mocks.go
starcoder
package perseus // InFloat32 returns whether i is in slice. func InFloat32(i float32, slice []float32) bool { for _, b := range slice { if b == i { return true } } return false } // IndexFloat32 returns the position of s in slice. If s is not found, return -1. func IndexFloat32(s float32, slice []float32) i...
float32.go
0.885074
0.401219
float32.go
starcoder
package vector import ( "fmt" "math" ) const min_to_breakup int = 7 const vector_print_format string = "%.3f" type Vector struct { items []float64 } func MakeVector(n int) (v Vector, e error){ if n < 0 { return Vector{make([]float64, 0)}, fmt.Errorf("n cannot be negative: %d", n) } r...
vector.go
0.74055
0.620018
vector.go
starcoder
package gt import ( "crypto/rand" "database/sql/driver" "encoding/hex" "fmt" "io" ) /* Creates a random UUID using `gt.ReadUuid` and "crypto/rand". Panics if random bytes can't be read. */ func RandomUuid() Uuid { val, err := ReadUuid(rand.Reader) try(err) return val } // Creates a UUID (version 4 variant 1)...
gt_uuid.go
0.763484
0.42668
gt_uuid.go
starcoder
package main import ( "container/heap" "log" "math" ) // min returns the minumum value of an array of floats func min(fs []float64) float64 { minVal := math.MaxFloat64 for _, f := range fs { if f < minVal { minVal = f } } return minVal } // max returns the maximum value of an array of floats func max(...
statistics.go
0.780453
0.48054
statistics.go
starcoder
package v1b3 import ( "context" "reflect" "github.com/pulumi/pulumi/sdk/v3/go/pulumi" ) // Gets the state of the specified Cloud Dataflow job. To get the state of a job, we recommend using `projects.locations.jobs.get` with a [regional endpoint] (https://cloud.google.com/dataflow/docs/concepts/regional-endpoints...
sdk/go/google/dataflow/v1b3/getJob.go
0.770033
0.423875
getJob.go
starcoder
package cios import ( "encoding/json" ) // SeriesImage struct for SeriesImage type SeriesImage struct { Timestamp string `json:"timestamp"` // base64エンコードされた画像データ Image string `json:"image"` // 画像データのフォーマット ImageType string `json:"image_type"` } // NewSeriesImage instantiates a new SeriesImage object // This ...
cios/model_series_image.go
0.734501
0.442396
model_series_image.go
starcoder
package entity import ( //"fmt" "strconv" ) type Date struct { Year, Month, Day, Hour, Minute int } func IsValid(d Date) bool { if d.Year < 1000 || d.Year > 9999 || d.Month < 1 || d.Month > 12 || d.Day < 1 || d.Hour < 0 || d.Hour >= 24 || d.Minute < 0 || d.Minute >= 60 { return false ...
entity/Date.go
0.537284
0.437944
Date.go
starcoder
package slices import ( "sort" "github.com/go-board/std/optional" "golang.org/x/exp/constraints" ) type sortBy[T any] struct { less func(a, b T) bool inner []T } func (s sortBy[T]) Len() int { return len(s.inner) } func (s sortBy[T]) Less(i, j int) bool { return s.less(s.inner[i], s.inner[j]) } func...
slices/slice.go
0.893088
0.531331
slice.go
starcoder
package utils import ( "reflect" "sort" "strconv" "strings" "time" ) // Element Array elements as object type Element interface{} // WrapArray Array elements to object func WrapArray(arrayData interface{}) map[string]Element { return WrapArrayWithElemName(arrayData, "data") } // WrapArrayWithElemName Array el...
utils/arrays.go
0.58522
0.400544
arrays.go
starcoder
package naiveIPAM import ( "math" "fmt" ) // 32-bit word input to count zero bits on right func getEndingZerocount(v uint32) uint { Mod37BitPosition := // map a bit value mod 37 to its position []uint{ 32, 0, 1, 26, 2, 23, 27, 0, 3, 16, 24, 30, 28, 11, 0, 13, 4, 7, 17, 0, 25, 22, 31, 15, 29, 10, 12, 6, 0, ...
rangeCalc.go
0.524395
0.406509
rangeCalc.go
starcoder
package swagger import "math" type InterestPrincipalCalculator struct { ICalculator } // Calculate how much needs to be paid back for each month/fortnightly/weekly func (InterestPrincipalCalculator) CalculateRepayment(InterestRate float64, LoanTerm int32, LoanAmount float64, totalNumberOfPayments int32) (repayment ...
go/interest_principal_calculator.go
0.746971
0.567577
interest_principal_calculator.go
starcoder
package try import ( "github.com/dairaga/gs" "github.com/dairaga/gs/funcs" ) // From is a Try builder returns Success with given v if err is nil, otherwise returns Failure with given err. func From[T any](v T, err error) gs.Try[T] { return funcs.BuildWithErr(v, err, gs.Failure[T], gs.Success[T]) } // FromWithBoo...
try/try.go
0.630912
0.564519
try.go
starcoder
package crun import ( "fmt" "log" "math/rand" "regexp/syntax" "time" ) // MoreTimes Maximum omitted default value const MoreTimes = 18 // Regexp syntax tree translated from regexp/syntax type Regexp struct { Op Op Sub []Regexps Rune []rune Min, Max int } // Regexps syntax tree translated fro...
regexps.go
0.697918
0.430028
regexps.go
starcoder
package geo import ( "github.com/draeron/gopkgs/color" "github.com/fogleman/gg" "github.com/twpayne/go-geom" "math" ) type Triangle struct { coord geom.Coord poly *geom.Polygon side float64 Orientation int32 } func NewTriangle(pts Point, side int, orientation int32) *Triangle { t := Tria...
geo/triangle.go
0.745861
0.633297
triangle.go
starcoder
package images import ( "math" ) type ResampleFilter struct { Support float64 Kernel func(float64) float64 } var NearestNeighbor ResampleFilter var Box ResampleFilter var Linear ResampleFilter var Hermite ResampleFilter var MitchellNetravali ResampleFilter var CatmullRom ResampleFilter var BSpline Resam...
filters.go
0.811041
0.468
filters.go
starcoder
package esbuilder import ( "fmt" "strconv" ) // literalNode defines a literal value. type literalNode struct { // value is the literal value. value string } // arrayNode defines an array literal value. type arrayNode struct { // values are the values in the array. values []ExpressionBuilder } // objectNode d...
generator/escommon/esbuilder/expressions_literal.go
0.732496
0.440409
expressions_literal.go
starcoder
package xlpp var Registry = map[Type]func() Value{ // LPP Types TypeDigitalInput: func() Value { return new(DigitalInput) }, TypeDigitalOutput: func() Value { return new(DigitalOutput) }, TypeAnalogInput: func() Value { return new(AnalogInput) }, TypeAnalogOutput: func() Value { return new...
registry.go
0.579162
0.538862
registry.go
starcoder
package metrics // A Sample represents an OpenMetrics sample containing labels and the value. type Sample struct { Labels map[string]string Value uint64 } // MetricSet represents a set of metrics. type MetricSet struct { set map[MetricType][]Sample labels map[string]string } // MetricType is a numeric code i...
lxd/metrics/types.go
0.688887
0.463687
types.go
starcoder
package util import ( "crypto/rand" "encoding/hex" "github.com/canpacis/birlang/src/ast" ) func GenerateIntPrimitive(value int64) ast.IntPrimitiveExpression { return ast.IntPrimitiveExpression{ Operation: "primitive", Value: value, Type: "int", Position: ast.Position{ Line: 0, Col: 0, }...
src/util/util.go
0.775095
0.41324
util.go
starcoder
package main import ( "github.com/ByteArena/box2d" "github.com/wdevore/RangerGo/api" "github.com/wdevore/RangerGo/engine/nodes/custom" ) // GroundComponent represents both the visual and physic components type GroundComponent struct { visual api.INode b2Body *box2d.B2Body b2Shape box2d.B2EdgeShape b2Fixt...
examples/physics/basics/seesaw/ground_component.go
0.755637
0.515925
ground_component.go
starcoder
package main import ( "flag" "fmt" "image" "image/draw" "image/png" "log" "math" "os" "github.com/nfnt/resize" ) var mode = flag.String("mode", "std4", "The `mode` to use, std3 or std4.") var screenPath = flag.String("s", "", "The `path` to the screen image.") var boxPath = flag.String("b", "", "The `path` ...
mix_experiment/mix.go
0.62681
0.424054
mix.go
starcoder
package neural import ( "github.com/gonum/matrix/mat64" "github.com/milosgajdos83/go-neural/pkg/matrix" ) // Cost is neural network training cost type Cost interface { // CostFunc defines neural network cost function for given input, output and labels. // It returns a single number: cost for given input and outpu...
neural/cost.go
0.792183
0.675666
cost.go
starcoder
package factory import ( "encoding/json" "github.com/AlexanderFadeev/ood/lab4/color" "github.com/AlexanderFadeev/ood/lab4/point" "github.com/AlexanderFadeev/ood/lab4/shape" "github.com/pkg/errors" ) type shapeDescription struct { Type *shapeType `json:"type"` Color *color.Color `json:"color"` Center *p...
lab4/factory/description.go
0.826782
0.414306
description.go
starcoder
package metal /* #cgo CFLAGS: -x objective-c #cgo LDFLAGS: -framework Cocoa -framework Metal -framework MetalKit #include "api.h" #include <simd/matrix.h> */ import "C" import ( "math" ) func Matrix_multiply(a Matrix_float4x4, b Matrix_float4x4) Matrix_float4x4 { return Matrix_float4x4(C.simd_matrix_multiply(C.mat...
metal/utils.go
0.677154
0.640622
utils.go
starcoder
package temperature import ( "errors" "fmt" "math" ) // ErrNilArgument is an error when the argument is nil. var ErrNilArgument = errors.New("argument can't be nil") type temperatureChangeHandler func(Temperature) //Stringer provides String method. type Stringer interface { String() string } // Temperature pro...
temperature.go
0.907458
0.469946
temperature.go
starcoder
package diag import ( "math" "time" ) // Value represents a reportable value to be stored in a Field. // The Value struct provides a slot for primitive values that require only // 64bits, a string, or an arbitrary interface. The interpretation of the slots is up to the Reporter. type Value struct { Primitive uint...
vendor/github.com/urso/diag/value.go
0.748812
0.433862
value.go
starcoder
package sstable import ( "encoding/binary" "errors" "io" "github.com/jmgilman/kv" ) // Segment implements kv.Segment using an SSTable. It uses a contingous body // of read-only, ordered, and encoded KVPair's in order to store the contents // of a MemoryStore into a more durable long-term format. Internally, it ...
sstable/segment.go
0.808294
0.482551
segment.go
starcoder
package aoc import "C" import ( "math" "strconv" "strings" "utils" ) func createWireLines(wire string) []utils.WirePart { var output []utils.WirePart wirePaths := strings.Split(wire, ",") currentX := 0 currentY := 0 for _, wirePath := range wirePaths { targetX := currentX targetY := currentY direction ...
src/aoc/day3.go
0.63375
0.40342
day3.go
starcoder
package ch // incidentEdge incident edge for certain vertex type incidentEdge struct { vertexID int64 weight float64 } // addInIncidentEdge Adds incident edge's to pool of "incoming" edges of given vertex. // Just an alias to append() function // incomingVertexID - Library defined ID of vertex // weight - Travel ...
incident_edge.go
0.787972
0.571049
incident_edge.go
starcoder
package gween // Sequence represents a sequence of Tweens, executed one after the other. type Sequence struct { Tweens []*Tween index int // yoyo makes the sequence "yoyo" back to the beginning after it reaches the end yoyo bool // reverse runs the sequence backwards when true reverse bool // loop is the initi...
sequence.go
0.640861
0.436082
sequence.go
starcoder
package porous // State holds state variables for porous media with liquid and gas // References: // [1] <NAME> (2015) A consistent u-p formulation for porous media with hysteresis. // Int Journal for Numerical Methods in Engineering, 101(8) 606-634 // http://dx.doi.org/10.1002/nme.4808 // [2] <NAME>...
mdl/porous/states.go
0.727007
0.505859
states.go
starcoder
package raster import ( "image" "image/color" "unsafe" ) const ( SUBPIXEL_SHIFT = 3 SUBPIXEL_COUNT = 1 << SUBPIXEL_SHIFT SUBPIXEL_FULL_COVERAGE = 0xff ) var SUBPIXEL_OFFSETS = SUBPIXEL_OFFSETS_SAMPLE_8_FIXED type SUBPIXEL_DATA uint8 type NON_ZERO_MASK_DATA_UNIT uint8 type Rasterizer8BitsSampl...
raster/fillerAA.go
0.606498
0.405272
fillerAA.go
starcoder
// Package cache provides a simple caching mechanism // that limits the age of cache entries and tries to avoid large // repopulation events by staggering refresh times. package cache import ( "math/rand" "sync" "time" "gopkg.in/errgo.v1" ) // entry holds a cache entry. The expire field // holds the time after ...
vendor/src/github.com/juju/utils/cache/cache.go
0.668231
0.454956
cache.go
starcoder
package main import ( "code.google.com/p/freetype-go/freetype" "code.google.com/p/freetype-go/freetype/raster" "code.google.com/p/freetype-go/freetype/truetype" "fmt" "github.com/disintegration/gift" "image" "image/color" "math" ) // boundingBoxer is a drawable image that reports a massive canvas. Ideally th...
text/tool/glyph.go
0.687945
0.490968
glyph.go
starcoder
package transfer import ( "encoding/gob" "github.com/MetaLife-Protocol/SuperNode/encoding" "github.com/ethereum/go-ethereum/common" ) /* Quick overview -------------- Goals: - Reliable failure recovery. Approach: - Use a write-ahead-log for state changes. Under a node restart the latest state snapshot ca...
transfer/architecture.go
0.762778
0.431524
architecture.go
starcoder
package kuznyechik func s(dst, src []byte) { for index, value := range src { dst[index] = nonlinear(value) } } func invertedS(dst, src []byte) { for index, value := range src { dst[index] = inverseNonlinear(value) } } func inverseS(high, low uint64) (highNew, lowNew uint64) { highNew = (uint64(inverseNonlin...
cipher/kuznyechik/s.go
0.542984
0.649704
s.go
starcoder
package bst import ( "github.com/cinar/indicator/container" ) // BST node. type Node struct { value interface{} left *Node right *Node } // BST type. type Tree struct { root *Node } // New binary search tree. func New() *Tree { return &Tree{} } // Inserts the given value. func (t *Tree) Insert(value interfa...
container/bst/bst.go
0.770033
0.412353
bst.go
starcoder
package main import "fmt" // A square matrix, ie a 2D grid of numbers. Matrices are addressed in row-major // order, eg matrix[1, 2] is the value at the 1st row in the 2nd column (with // 0-based indexing). type Matrix struct { Size int store []float64 } // Create a 2x2 matrix. func MakeMatrix2(v1, v2, v3, v4 flo...
matrix.go
0.793346
0.628436
matrix.go
starcoder
package crypto import ( "crypto/elliptic" "crypto/rand" "fmt" "io" "math/big" "github.com/zeebo/blake3" ) /* High level api for operating on P256 elliptic curve Points. */ var ( curve = elliptic.P256() encodeLen = encodeLenWithCurve(curve) ) // encodeLenWithCurve returns the number of bytes needed to e...
internal/crypto/point.go
0.917279
0.473718
point.go
starcoder
package sql // Result represents a query result. // Depending on the statement type it represents a stream of rows or an update count. // It is not concurrency-safe except the Close and Iterator method. type Result interface { // RowMetadata returns metadata information about rows. // An error is returned if result ...
sql/result.go
0.68595
0.448426
result.go
starcoder
package galoisfield import ( "bytes" "errors" "fmt" "strconv" ) var ( ErrIncompatibleFields = errors.New("cannot combine polynomials from different finite fields") ) // Polynomial implements polynomials with coefficients drawn from a Galois field. type Polynomial struct { field *GF coefficients []byte ...
polynomial.go
0.794185
0.657325
polynomial.go
starcoder
package bungieapigo // Returns data about a character's status with a given Objective. Combine with // DestinyObjectiveDefinition static data for display purposes. type DestinyObjectiveProgress struct { // The unique identifier of the Objective being referred to. Use to look up the // DestinyObjectiveDefinition in ...
pkg/models/DestinyObjectiveProgress.go
0.713931
0.461745
DestinyObjectiveProgress.go
starcoder
package poly import ( "fmt" "strings" ) // Int64T is a single term containing an int64 coefficient. type Int64T struct { Ind C int64 } // Ind represents the indeterminates of a single term. type Ind []int64 // Mul returns the product of 't' and 'x'. func (t Int64T) Mul(x Int64T) Int64T { t.Ind = t.Ind.Mul(x.I...
go/poly/int64_t.go
0.770983
0.471406
int64_t.go
starcoder
package Utilities import ( "fmt" "math" "marvin/SnakeProGo/Utilities/Physics" ) type Point struct { X, Y int } func (p *Point) ToVector() *Physics.Vector { return &Physics.Vector{float64(p.X),float64(p.Y),0} } func (p *Point) Print() string { return fmt.Sprintf("(%v, %v)", p.X, p.Y) } func (p *Point) Equals(p2...
GoFiles/Utilities/snakeTiles.go
0.535584
0.493836
snakeTiles.go
starcoder
package gorocksdb // #include "rocksdb/c.h" import "C" // A SliceTransform can be used as a prefix extractor. type SliceTransform interface { // Transform a src in domain to a dst in the range. Transform(src []byte) []byte // Determine whether this is a valid src upon the function applies. InDomain(src []byte) b...
slice_transform.go
0.751466
0.413714
slice_transform.go
starcoder
package primitives import ( "bytes" "fmt" ) type MemberId []byte func (x MemberId) String() string { return fmt.Sprintf("%x", []byte(x)) } func (x MemberId) Equal(y MemberId) bool { return bytes.Equal(x, y) } func (x MemberId) KeyForMap() string { return string(x) } type MemberWeight uint64 func (x MemberWe...
spec/types/go/primitives/lean_helix_primitives.mb.go
0.72662
0.486149
lean_helix_primitives.mb.go
starcoder
package base import ( "container/heap" "gonum.org/v1/gonum/stat" "sort" ) // SparseIdSet manages the map between dense IDs and sparse IDs. type SparseIdSet struct { DenseIds map[int]int SparseIds []int } // NotId represents an ID not existed in the data set. const NotId = -1 // MakeSparseIdSet makes a SparseI...
base/sparse.go
0.734024
0.402862
sparse.go
starcoder
package provider import ( "github.com/lavaorg/lrtx/management" "github.com/lavaorg/northstar/portal/model" ) // PortalProvider defines the basic interface that implementers of the portal api functionality must fulfill. type PortalProvider interface { // CreateNotebook creates a new notebook CreateNotebook(token ...
portal/provider/provider.go
0.679817
0.438184
provider.go
starcoder
package check import "fmt" // float64CheckerProvider provides checks on type float64. type float64CheckerProvider struct{ baseCheckerProvider } // Is checks the gotten float64 is equal to the target. func (p float64CheckerProvider) Is(tar float64) Float64Checker { pass := func(got float64) bool { return got == tar ...
check/providers_float64.go
0.805173
0.428473
providers_float64.go
starcoder
package v1alpha1 import ( v1alpha1 "github.com/enj/example-operator/pkg/apis/example/v1alpha1" "k8s.io/apimachinery/pkg/api/errors" "k8s.io/apimachinery/pkg/labels" "k8s.io/client-go/tools/cache" ) // ExampleOperatorLister helps list ExampleOperators. type ExampleOperatorLister interface { // List lists all Exa...
pkg/generated/listers/example/v1alpha1/exampleoperator.go
0.719384
0.406803
exampleoperator.go
starcoder
package pool import ( "sync" ) var TwoDimBS *TwoDimByteSlicePool type TwoDimByteSlicePool struct { pool *sync.Pool } // TwoDimByteSlice 二维递增数组 type TwoDimByteSlice struct { released bool data []byte flat []sliceHeader dim []sliceHeader } func (p *TwoDimByteSlicePool)Get() *TwoDimByteSlice...
pool/two_dim_byteslice.go
0.521715
0.600598
two_dim_byteslice.go
starcoder
package core type PrimaryExpressionType int const ( VarPrimaryExpressionType PrimaryExpressionType = 1 << iota ConstPrimaryExpressionType DynamicStrPrimaryExpressionType ArrayPrimaryExpressionType ObjectPrimaryExpressionType ChainCallPrimaryExpressionType ElemFunctionCallPrimaryExpressionType FunctionPrimaryE...
core/100expression_primary.go
0.563618
0.466724
100expression_primary.go
starcoder
package entity import "github.com/cjduffett/synthea/utils" // Demographics is a lookup hash for demographics used to seed Synthea. var Demographics = map[string]interface{}{ "Race": []utils.Choice{ // https://en.wikipedia.org/wiki/Demographics_of_Massachusetts#Race.2C_ethnicity.2C_and_ancestry utils.Choice{ ...
entity/demographics.go
0.602179
0.439206
demographics.go
starcoder
package mapping import () /* When mapping to a struct, we map each field from a path into another object. When mapping to a collection, we map each item from another collection. When mapping to a pointer, we map from a set of pointers. If all are nil, then map to nil. */ // Choice focus on Part of a Whole type....
mapping/mapping.go
0.622345
0.45302
mapping.go
starcoder
package image import ( "encoding/binary" "image" "image/color" "image/draw" _ "image/jpeg" "image/png" "io" ) // setBit will set the LSB of n to the requested value func setBit(n uint32, is1 bool) uint8 { n = n >> 8 n = n & 0xFE if is1 { n = n | 0x1 } return uint8(n) } // convertByteToBits is a helper ...
kit/image/lsb.go
0.660282
0.410225
lsb.go
starcoder
package onshape import ( "encoding/json" ) // BTPStatementBlock271 struct for BTPStatementBlock271 type BTPStatementBlock271 struct { BTPStatement269 BtType *string `json:"btType,omitempty"` SpaceAfterOpen *BTPSpace10 `json:"spaceAfterOpen,omitempty"` } // NewBTPStatementBlock271 instantiates a new BTPStatementB...
onshape/model_btp_statement_block_271.go
0.658527
0.521288
model_btp_statement_block_271.go
starcoder
package utils import "time" type Comparator func(a, b interface{}) int // StringComparator provides a fast comparison on strings func StringComparator(a, b interface{}) int { s1 := a.(string) s2 := b.(string) min := len(s2) if len(s1) < len(s2) { min = len(s1) } diff := 0 for i := 0; i < min && diff == 0;...
utils/comparator.go
0.78968
0.561275
comparator.go
starcoder
package main import ( "encoding/hex" "fmt" "strconv" "strings" "time" "unicode/utf8" "github.com/bwmarrin/discordgo" mgo "gopkg.in/mgo.v2" "gopkg.in/mgo.v2/bson" ) // BotHelp is used to display a list of available commands or instructions on using a specified command func BotHelp(g *discordgo.Guild, s *disc...
commands.go
0.515376
0.432183
commands.go
starcoder
package graphic import ( "github.com/g3n/engine/core" "github.com/g3n/engine/geometry" "github.com/g3n/engine/gls" "github.com/g3n/engine/material" "github.com/g3n/engine/math32" ) // Mesh is a Graphic with uniforms for the model, view, projection, and normal matrices. type Mesh struct { Graphic //...
graphic/mesh.go
0.774242
0.484563
mesh.go
starcoder
package caire import ( "image" "math" ) type kernel [][]int32 var ( kernelX kernel = kernel{ {-1, 0, 1}, {-2, 0, 2}, {-1, 0, 1}, } kernelY kernel = kernel{ {-1, -2, -1}, {0, 0, 0}, {1, 2, 1}, } ) // Detect image edges. // See https://en.wikipedia.org/wiki/Sobel_operator func SobelFilter(img *imag...
sobel.go
0.761804
0.536495
sobel.go
starcoder
package main // event struct used to read data from the perf ring buffer type event struct { // PID of the process making the syscall Pid uint32 // syscall number ID uint32 // Command which makes the syscall Command [16]byte // Stops tracing syscalls if true StopTracing bool } // the source is a bpf program c...
ebpf.go
0.532182
0.4184
ebpf.go
starcoder
package goqu import ( "time" "github.com/doug-martin/goqu/v9/internal/util" "github.com/doug-martin/goqu/v9/sqlgen" ) type DialectWrapper struct { dialect string } // Creates a new DialectWrapper to create goqu.Datasets or goqu.Databases with the specified dialect. func Dialect(dialect string) DialectWrapper { ...
goqu.go
0.688992
0.462655
goqu.go
starcoder
package chapter17 import "sort" // HeightWidth is a struct having height and width type HeightWidth struct { height int weight int } // returns true if main should be lined up before that. // note that it's possible that this.isBefore(that) and that.isBefore(this) are both false func (main HeightWidth) isBefore(th...
chapter17/8_circus_tower.go
0.773131
0.471406
8_circus_tower.go
starcoder
package csv import ( "encoding/csv" "fmt" "io" "sort" "github.com/attic-labs/noms/go/d" "github.com/attic-labs/noms/go/types" ) // StringToKind maps names of valid NomsKinds (e.g. Bool, Float32, etc) to their associated types.NomsKind var StringToKind = func(kindMap map[types.NomsKind]string) map[string]types...
samples/go/csv/read.go
0.601008
0.406715
read.go
starcoder
package chow import ( "github.com/OpenWhiteBox/primitives/encoding" "github.com/OpenWhiteBox/primitives/matrix" "github.com/OpenWhiteBox/primitives/number" ) // findMatrix finds an invertible matrix in a basis. func findMatrix(basis []matrix.Row) matrix.Matrix { im := matrix.NewIncrementalMatrix(64) for _, row :...
cryptanalysis/chow/affine.go
0.83498
0.510192
affine.go
starcoder
package courier import ( "context" "fmt" "testing" "time" "github.com/bxcodec/faker/v3" "github.com/pkg/errors" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" "github.com/gofrs/uuid" ) var ErrQueueEmpty = errors.New("queue is empty") type ( Persister interface { AddMessage(c...
courier/persistence.go
0.599368
0.538983
persistence.go
starcoder
package criteria import ( "fmt" "github.com/viant/toolbox" "strings" ) const ( undefined int = iota eof illegal whitespaces operand operator logicalOperator assertlyExprMatcher quoted jsonObject jsonArray grouping ) var matchers = map[int]toolbox.Matcher{ eof: toolbox.EOFMatcher{}, whitespac...
criteria/parser.go
0.693473
0.449816
parser.go
starcoder
package vox import ( "fmt" "math" ) // A DenseWorld is an arbitrarily sized voxel model. type DenseWorld struct { Min, Max [3]int // The range of coordinates that are valid. // A slice large enough to contain every voxel. // Voxels[0] is the voxel Min, and the last // element in the slice is the voxel Max. //...
world.go
0.804329
0.47171
world.go
starcoder
package input import ( "github.com/Jeffail/benthos/v3/internal/docs" "github.com/Jeffail/benthos/v3/lib/input/reader" "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/util/aws/session" ) //-----------...
lib/input/sqs.go
0.739893
0.591458
sqs.go
starcoder
package fzf import ( "bytes" "fmt" "regexp" "strconv" "strings" "github.com/karnh/fzf/src/util" ) const rangeEllipsis = 0 // Range represents nth-expression type Range struct { begin int end int } // Token contains the tokenized part of the strings and its prefix length type Token struct { text ...
src/tokenizer.go
0.624752
0.435902
tokenizer.go
starcoder
package iso20022 // Parameters for contracts which obligate the buyer to receive and the seller to deliver in the future the assets specified at an agreed price or contracts which grant to the holder either the privilege to purchase or the privilege to sell the assets specified at a predetermined price or formula at o...
FutureOrOptionDetails1.go
0.781122
0.482063
FutureOrOptionDetails1.go
starcoder
package geojson import ( "math" "strconv" "github.com/mmadfox/geojson/geo" "github.com/mmadfox/geojson/geometry" ) // Circle ... type Circle struct { object Object center geometry.Point meters float64 haversine float64 steps int km bool extra *extra } // NewCircle returns an circl...
circle.go
0.826187
0.475849
circle.go
starcoder
package gofp // The names and the package structure of gofp resemble the OWL Quick Reference Guide, found here: // https://www.w3.org/2007/OWL/refcard // For example, the gofp package "axioms" resembles the Guides section "2.5 Axioms". // Some things in gofp are, surely, made wrong. // At least, the following stateme...
gofp.go
0.604983
0.535159
gofp.go
starcoder
package standard import ( "github.com/simp7/nonogram/unit" ) type nonomap struct { width int height int bitmap [][]bool } /* nonomap is divided into 3 parts and has arguments equal or more than 3, which is separated by '/'. First two elements indicates width and height respectively. Rest elements indicates...
unit/standard/nonomap.go
0.560253
0.544922
nonomap.go
starcoder
package jit import ( "fmt" "strings" "github.com/tetratelabs/wazero/internal/asm" ) var ( // unreservedGeneralPurposeIntRegisters contains unreserved general purpose registers of integer type. unreservedGeneralPurposeIntRegisters []asm.Register // unreservedGeneralPurposeFloatRegisters contains unreserved gen...
vendor/github.com/tetratelabs/wazero/internal/wasm/jit/jit_value_location.go
0.694924
0.448366
jit_value_location.go
starcoder
package encoding import ( "encoding" stdjson "encoding/json" "fmt" "reflect" "strconv" "strings" "time" ) func decodeToType(typ reflect.Kind, value string) interface{} { switch typ { case reflect.String: return value case reflect.Bool: v, _ := strconv.ParseBool(value) return v case reflect.Int: v,...
encoding/decode.go
0.562898
0.437343
decode.go
starcoder
package validator import ( "bytes" "fmt" "net/http" "reflect" "sort" "strconv" "strings" "unicode/utf8" ) const tagName string = "valid" // Validator contruct type Validator struct { Attributes map[string]string CustomMessage map[string]string Translator *Translator } // Default returns a instance ...
validator.go
0.743447
0.527803
validator.go
starcoder