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 shared import ( "github.com/pkg/errors" ) // Each packet includes fields including zero byte values // so it is easier to understand what is going on as // certain fields are chained together to create a packet type RRQWRQPacket struct { Opcode [] byte // 01/02 Filename string zero byte Mode s...
shared/Packets.go
0.710729
0.415195
Packets.go
starcoder
package parquet import ( "bytes" "fmt" "github.com/segmentio/parquet-go/deprecated" "github.com/segmentio/parquet-go/encoding" "github.com/segmentio/parquet-go/format" ) var ( BooleanType Type = booleanType{} Int32Type Type = int32Type{} Int64Type Type = int64Type{} Int96Type Type = int96Type...
type_default.go
0.737914
0.464294
type_default.go
starcoder
package topologicalsort import ( "fmt" "godev/basic/datastructure/graph" "godev/basic/datastructure/queue/deque" ) // Kahn algorithm // https://en.wikipedia.org/wiki/Topological_sorting func Kahn(g graph.Graph) (sortedIDs []graph.ID, err error) { // 1. compute in-edges for every vertex and initialize visited vert...
basic/datastructure/graph/algorithm/topologicalsort/topological_sorting.go
0.528047
0.439567
topological_sorting.go
starcoder
package goqrsvg import ( "errors" "fmt" "image/color" "github.com/ajstarks/svgo" "github.com/boombuler/barcode" ) // QrSVG holds the data related to the size, location, // and block size of the QR Code. Holds unexported fields. type QrSVG struct { qr barcode.Barcode qrWidth int blockSize int starti...
goqrsvg.go
0.711932
0.48749
goqrsvg.go
starcoder
package hue import ( "math" ) const ( colorPointRed = 0 colorPointGreen = 1 colorPointBlue = 2 ) // RGB is a colour represented using the red/green/blue colour model. type RGB struct { Red uint8 Green uint8 Blue uint8 } // XY is a colour represented using the CIE colour space. type XY struct { X float...
color.go
0.903571
0.563078
color.go
starcoder
package go_tsuro // Action types const ( ActionPlaceTile = "PlaceTile" ActionRotateTileRight = "RotateTileRight" ActionRotateTileLeft = "RotateRileLeft" ) // Tsuro Variants const ( VariantClassic = "Classic" // normal Tsuro VariantLongestPath = "LongestPath" // player with the longest path...
models.go
0.566139
0.448909
models.go
starcoder
package ast import ( "errors" "fmt" "github.com/eliquious/lexer" "math/big" "strconv" "time" ) // ExpressionType identifies various expressions type ExpressionType int const ( VariableDeclarationType ExpressionType = iota ScopedVariableDeclarationType ConstantDeclarationType FunctionDeclarationType Struct...
calculator/ast/ast.go
0.746786
0.604691
ast.go
starcoder
package state import ( "math/rand" "sync" ) type GameSession struct { Mutex *sync.Mutex renderNotificationChannel chan bool score uint GameOver bool GameBoard [4][4]uint } // NewGameSession produces a ready-to-use session state. func NewGameSession(renderNotificationChannel chan bool...
state/state.go
0.537284
0.415758
state.go
starcoder
package main import ( "fmt" "math" ) // Circle description type Circle struct { radius float64 } // Rectangle description type Rectangle struct { width float64 height float64 } // Triangle description type Triangle struct { a float64 b float64 c float64 } // Cylinder description type Cylinder struct { ra...
software/development/languages/go-cheat-sheet/src/function-method-interface-package-example/function/function.go
0.805364
0.541106
function.go
starcoder
package main /* This project uses a BME280 temperature/humidity sensor and an SSD1306 OLED display (128x64 pixels). Both use the I2C bus, so the only required pins for using both components are the SDA and SCL pins. A button is used to switch the displayed temerature units between Celcius and Faren...
projects/temperature-with-display/tinygo/main.go
0.632957
0.559471
main.go
starcoder
package astar import ( "container/heap" "errors" ) // ErrNotFound means that the final state cannot be reached from the given start state. var ErrNotFound = errors.New("final state is not reachable") // Interface describes a type suitable for A* search. Any type can do as long as // it can change its current state...
astar.go
0.613584
0.505249
astar.go
starcoder
package encryption import ( "crypto/hmac" "crypto/sha512" "storj.io/common/storj" ) const ( // AESGCMNonceSize is the size of an AES-GCM nonce AESGCMNonceSize = 12 // unit32Size is the number of bytes in the uint32 type uint32Size = 4 ) // AESGCMNonce represents the nonce used by the AES-GCM protocol type A...
vendor/storj.io/common/encryption/encryption.go
0.776708
0.403861
encryption.go
starcoder
package extraction import ( "github.com/alevinval/fingerprints/internal/matrix" "github.com/alevinval/fingerprints/internal/types" ) // Minutia retrieves fingerprint features from a skeletonized image. Each // feature angle is obtained from the filtered directional image. Features // outside the fingerprint itself ...
internal/extraction/minutia.go
0.735926
0.490175
minutia.go
starcoder
package pars import ( "fmt" "github.com/go-ascii/ascii" ) // Parser is the function signature of a parser. type Parser func(state *State, result *Result) error // Map is the function signature for a result mapper. type Map func(result *Result) error // Map applies the callback if the parser matches. func (p Pars...
parser.go
0.698432
0.430985
parser.go
starcoder
package block import ( "github.com/df-mc/dragonfly/dragonfly/block/model" "github.com/df-mc/dragonfly/dragonfly/block/wood" "github.com/df-mc/dragonfly/dragonfly/item" "github.com/df-mc/dragonfly/dragonfly/world" "github.com/df-mc/dragonfly/dragonfly/world/sound" "github.com/go-gl/mathgl/mgl64" ) // Door is a b...
dragonfly/block/door.go
0.629888
0.47792
door.go
starcoder
package yql import ( "math" "sort" "strconv" ) const ( opEqual = "=" opNotEqual = "!=" opLarger = ">" opLargerEqual = ">=" opLess = "<" opLessEqual = "<=" opInter = "∩" opNotInter = "!∩" opIn = "in" opNotIn = "!in" ) const ( epsilon = float64(1e-10) ) fun...
plugins/data/parser/ql/yql/cmp.go
0.582966
0.696436
cmp.go
starcoder
package props import ( "github.com/johnfercher/maroto/pkg/color" "github.com/johnfercher/maroto/pkg/consts" ) // Proportion represents a proportion from a rectangle, example: 16x9, 4x3... type Proportion struct { // Width from the rectangle: Barcode, image and etc Width float64 // Height from the rectangle: Barc...
pkg/props/prop.go
0.741674
0.633269
prop.go
starcoder
package schema const ModelSchema = `{ "$id": "docs/spec/errors/error.json", "type": "object", "description": "An error or a logged error message captured by an agent occurring in a monitored service", "allOf": [ { "$id": "doc/spec/timestamp_epoch.json", "title": "Timestamp Epoch", ...
model/error/generated/schema/error.go
0.866175
0.464841
error.go
starcoder
package main import ( "github.com/gen2brain/raylib-go/raylib" ) func main() { screenWidth := int32(800) screenHeight := int32(450) rl.InitWindow(screenWidth, screenHeight, "raylib [models] example - box collisions") camera := rl.Camera{} camera.Position = rl.NewVector3(0.0, 10.0, 10.0) camera.Target = rl.New...
examples/models/box_collisions/main.go
0.586404
0.441553
main.go
starcoder
package draw // A Point is an X, Y coordinate pair. type Point struct { X, Y int; } // ZP is the zero Point. var ZP Point // A Rectangle contains the Points with Min.X <= X < Max.X, Min.Y <= Y < Max.Y. type Rectangle struct { Min, Max Point; } // ZR is the zero Rectangle. var ZR Rectangle // Pt is shorthand for...
src/pkg/exp/draw/arith.go
0.928132
0.675725
arith.go
starcoder
package cell import ( "github.com/PetrusJPrinsloo/gameoflife/config" "github.com/PetrusJPrinsloo/gameoflife/graphics" "github.com/PetrusJPrinsloo/gameoflife/shape" "github.com/go-gl/gl/v4.1-core/gl" ) type Cell struct { Drawable uint32 Alive bool AliveNext bool X int Y int } func NewCell(x, y int, cnf...
cell/cell.go
0.602997
0.446615
cell.go
starcoder
package sio import "math/rand" // anchor represents relative position like beloW: // 7 8 9 // 4 5 6 // 1 2 3 // Rect is a simple rect type Rect struct { X, Y, W, H float64 anchor int } // NewRect returns a neW rect. // Position is Hidden, use Pos metHod. func NewRect(anchor int, X, Y, W, H float64) *Rect { v...
rect.go
0.854384
0.526282
rect.go
starcoder
package mocks import ( "errors" "time" "github.com/wardana/currency-exchange/models" ) //MockRateRepository is a mock type for the Interface type type MockRateRepository struct{} //Create provides a mock function with given fields func (r MockRateRepository) Create(params models.Rate) (models.Rate, error) { if ...
repositories/mocks/rate.go
0.756268
0.410284
rate.go
starcoder
package packages import ( "github.com/montanaflynn/stats" ) func init() { Packages["stats"] = map[string]interface{}{ "ChebyshevDistance": stats.ChebyshevDistance, "Correlation": stats.Correlation, "Covariance": stats.Covariance, "CovariancePopula...
packages/stats.go
0.742888
0.596962
stats.go
starcoder
package ginkgo import ( "fmt" "reflect" "strings" "github.com/onsi/ginkgo/v2/internal" "github.com/onsi/ginkgo/v2/types" ) /* The EntryDescription decorator allows you to pass a format string to DescribeTable() and Entry(). This format string is used to generate entry names via: fmt.Sprintf(formatString, ...
vendor/github.com/onsi/ginkgo/v2/table_dsl.go
0.721449
0.430327
table_dsl.go
starcoder
// +build appengine js // This file contains an implementation of proto field accesses using package reflect. // It is slower than the code in pointer_unsafe.go but it avoids package unsafe and can // be used on App Engine. package proto import ( "math" "reflect" ) // A structPointer is a pointer to a struct. ty...
vendor/github.com/gogo/protobuf/proto/pointer_reflect.go
0.743075
0.524882
pointer_reflect.go
starcoder
package phomath import "math" const numMatrix4Values = 4 * 4 // NewMatrix4 creates a new four-dimensional matrix. Argument is optional Matrix4 to copy from. func NewMatrix4(from *Matrix4) *Matrix4 { m := &Matrix4{Values: [numMatrix4Values]float64{}} if from != nil { return m.Copy(from) } return m.Identity() ...
phomath/matrix4.go
0.869687
0.742888
matrix4.go
starcoder
package metrics import ( "time" "go.temporal.io/server/common/log" ) // Mostly cribbed from // https://github.com/temporalio/sdk-go/blob/master/internal/common/metrics/handler.go // and adapted to depend on golang.org/x/exp/event type ( // MetricsHandler represents the main dependency for instrumentation Metric...
common/metrics/metrics.go
0.810929
0.430806
metrics.go
starcoder
package client import ( "bytes" "encoding/binary" "errors" "fmt" "reflect" "sort" ) type MeasurementSchema struct { Measurement string DataType TSDataType Encoding TSEncoding Compressor TSCompressionType Properties map[string]string } type Tablet struct { deviceId string measurementSch...
client/tablet.go
0.542136
0.594875
tablet.go
starcoder
package physics import ( "github.com/kasworld/h4o/experimental/collision" "github.com/kasworld/h4o/geometry" "github.com/kasworld/h4o/gls" "github.com/kasworld/h4o/graphic" "github.com/kasworld/h4o/material" "github.com/kasworld/h4o/math32" "github.com/kasworld/h4o/node" ) // This file contains helpful infras...
experimental/physics/debug.go
0.594787
0.589894
debug.go
starcoder
package matchers import ( "fmt" "github.com/cloudfoundry/bosh-utils/internal/github.com/onsi/gomega/format" "math" ) type BeNumericallyMatcher struct { Comparator string CompareTo []interface{} } func (matcher *BeNumericallyMatcher) FailureMessage(actual interface{}) (message string) { return format.Message(a...
internal/github.com/onsi/gomega/matchers/be_numerically_matcher.go
0.591251
0.580947
be_numerically_matcher.go
starcoder
package number import ( "fmt" "math" "strconv" "strings" ) // Number is a fixed-point 3-digit number type type Number int64 // Zero as constant const Zero = Number(0) // One as constant const One = Number(1000) // MinusOne as constant const MinusOne = Number(-1000) // MaxValue is the largest possible value co...
pkg/number/number.go
0.868771
0.487856
number.go
starcoder
package sarif // Address A physical or virtual address, or a range of addresses, in an 'addressable region' (memory or a binary file). type Address struct { // The address expressed as a byte offset from the start of the addressable region. AbsoluteAddress int `json:"absoluteAddress,omitempty"` // A human-readab...
vendor/github.com/securego/gosec/v2/report/sarif/types.go
0.875415
0.532182
types.go
starcoder
package tetra3d import ( "github.com/hajimehoshi/ebiten/v2" "github.com/kvartborg/vector" ) const ( TriangleSortModeBackToFront = iota // TriangleSortBackToFront sorts the triangles from back to front (naturally). This is the default. TriangleSortModeFrontToBack // TriangleSortFrontToBack sorts the triangl...
material.go
0.757705
0.501648
material.go
starcoder
package tools import ( "bytes" "fmt" "sort" "strings" "github.com/miekg/dns" ) // RRArray represents an array of rrs // It implements Swapper interface, and is sortable. type RRArray []dns.RR // RRSetList is an array of RRArrays. type RRSetList []RRArray type NSEC3List struct { hashed map[string]string rrs ...
tools/rr_set.go
0.692954
0.456228
rr_set.go
starcoder
This is the Fission Router package. Its job is to: 1. Keep track of HTTP triggers and their mappings to functions Use the controller API to get and watch this state. 2. Given a function, get a reference to a routable function run service Use the ContainerPoolManager API to get a service backed by on...
router/router.go
0.731442
0.405684
router.go
starcoder
package model import ( "encoding/binary" "encoding/hex" "fmt" "io" "sort" "strconv" ) // These constants are kept mostly for backwards compatibility. const ( // StringType indicates the value is a unicode string StringType = ValueType_STRING // BoolType indicates the value is a Boolean encoded as int64 numb...
model/keyvalue.go
0.728459
0.444083
keyvalue.go
starcoder
package erts import ( "fmt" filter "github.com/soypat/go-estimate" "github.com/soypat/go-estimate/estimate" "github.com/soypat/go-estimate/noise" "gonum.org/v1/gonum/diff/fd" "gonum.org/v1/gonum/mat" ) // JacFunc defines jacobian function to calculate Jacobian matrix type JacFunc func(u mat.Vector) func(y, x [...
smooth/erts/erts.go
0.693473
0.419588
erts.go
starcoder
package sqlset import ( "fmt" "math" "github.com/pbanos/botanic/feature" ) /* FeatureCriterion are used to represent feature.Criterion on SQL DB-backed sets, they should be easily translatable to a condition on an SQL SELECT statement's WHERE clause on a samples table. */ type FeatureCriterion struct { /* Feat...
set/sqlset/feature_criterion.go
0.601008
0.416381
feature_criterion.go
starcoder
package controllers import ( "fmt" "math" "math/rand" "strconv" "github.com/astaxie/beego" ) type MainController struct { beego.Controller } func F_rasp(x float64) float64 { if x <= 0 { return 0 } if x >= 1 { return 1 } return 2.0 / math.Pi * math.Asin(x) } func F_plot(x float64) float64 { if x <= ...
controllers/lab2.go
0.518546
0.405566
lab2.go
starcoder
package gl import ( "image/color" "math" "fyne.io/fyne/v2" "fyne.io/fyne/v2/canvas" "fyne.io/fyne/v2/internal/painter" ) func (p *glPainter) drawTextureWithDetails(o fyne.CanvasObject, creator func(canvasObject fyne.CanvasObject) Texture, pos fyne.Position, size, frame fyne.Size, fill canvas.ImageFill, alpha f...
internal/painter/gl/draw.go
0.682574
0.446555
draw.go
starcoder
package gorgonia import ( "fmt" "hash" "math" "sort" "github.com/chewxy/hm" "github.com/pkg/errors" "gorgonia.org/tensor" ) type sparsemaxOp struct { axis int } func newSparsemaxOp(axes ...int) *sparsemaxOp { axis := -1 if len(axes) > 0 { axis = axes[0] } sparsemaxop := &sparsemaxOp{ axis: axis, }...
op_sparsemax.go
0.715523
0.535463
op_sparsemax.go
starcoder
package eaopt import ( "errors" "fmt" "math/rand" "sort" ) // Selector chooses a subset of size n from a group of individuals. The group of // individuals a Selector is applied to is expected to be sorted. type Selector interface { Apply(n uint, indis Individuals, rng *rand.Rand) (selected Individuals, indexes [...
selection.go
0.644896
0.646139
selection.go
starcoder
package msgraph // RatingAustraliaMoviesType undocumented type RatingAustraliaMoviesType string const ( // RatingAustraliaMoviesTypeVAllAllowed undocumented RatingAustraliaMoviesTypeVAllAllowed RatingAustraliaMoviesType = "AllAllowed" // RatingAustraliaMoviesTypeVAllBlocked undocumented RatingAustraliaMoviesType...
v1.0/RatingAustraliaMoviesTypeEnum.go
0.59843
0.420124
RatingAustraliaMoviesTypeEnum.go
starcoder
package collections const blockSize = 8 // FloatArray represents a float array type FloatArray interface { // Iterator returns an iterator over the array Iterator() FloatArrayIterator // GetValue returns value with pos, if has not value return 0 GetValue(pos int) float64 // HasValue returns if has value with pos...
pkg/collections/array_list.go
0.838812
0.557665
array_list.go
starcoder
package twistededwards import ( "math/big" "github.com/consensys/gnark-crypto/ecc" "github.com/consensys/gnark/frontend" ) // Point point on a twisted Edwards curve in a Snark cs type Point struct { X, Y frontend.Variable } // MustBeOnCurve checks if a point is on the twisted Edwards curve // ax^2 + y^2 = 1 + d...
std/algebra/twistededwards/point.go
0.775945
0.468061
point.go
starcoder
package parseutil import ( "github.com/lighttiger2505/sqls/ast" "github.com/lighttiger2505/sqls/ast/astutil" ) func ExtractSelectExpr(parsed ast.TokenList) []ast.Node { prefixMatcher := astutil.NodeMatcher{ ExpectKeyword: []string{ "SELECT", "ALL", "DISTINCT", }, } peekMatcher := astutil.NodeMatcher...
parser/parseutil/extract.go
0.560253
0.63535
extract.go
starcoder
package main func main() { } // https://www.allaboutcircuits.com/technical-articles/understanding-transfer-functions-for-low-pass-filters/ // 1st order low pass filter has the transfer function of the form // H(s) = K / (1 + s/w0) // If we want to know the magnitude/phase information at a certain // frequency, replac...
electronics/filters/lpf1.go
0.816882
0.526465
lpf1.go
starcoder
package cmaes import ( "errors" "math" "math/rand" "sort" "gonum.org/v1/gonum/floats" "gonum.org/v1/gonum/mat" ) type Solution struct { // Params is a parameter transformed to N(m, σ^2 C) from Z. Params []float64 // Value represents an evaluation value. Value float64 } // Optimizer is CMA-ES stochastic op...
vendor/github.com/c-bata/goptuna/cmaes/optimizer.go
0.722429
0.48871
optimizer.go
starcoder
package main import "bytes" /* Roman numerals are represented by seven different symbols: I, V, X, L, C, D and M. Symbol Value I 1 V 5 X 10 L 50 C 100 D 500 M 1000 For example, two is written as II in Roman numeral, just two on...
Programs/013Roman to Integer/013Roman to Integer.go
0.605099
0.552781
013Roman to Integer.go
starcoder
package colorpicker import ( "image/color" "math" "fyne.io/fyne/v2" "fyne.io/fyne/v2/canvas" ) var ( markerFillColor = color.NRGBA{50, 50, 50, 120} markerStrokeColor = color.NRGBA{50, 50, 50, 200} ) type marker interface { fyne.CanvasObject position() fyne.Position setPosition(fyne.Position) object() f...
marker.go
0.724968
0.433382
marker.go
starcoder
package statistics import ( "fmt" "io" "log" "github.com/gonum/floats" "github.com/gonum/stat" "github.com/kniren/gota/dataframe" "github.com/montanaflynn/stats" ) func Basics(b io.Reader) { // Create a dataframe from the CSV source. irisDF := dataframe.ReadCSV(b) // Get the float values from the "sepal_l...
golang/machine-learning/statistics/basic.go
0.733643
0.41052
basic.go
starcoder
package model import ( "fmt" golog "log" "github.com/aunum/gold/pkg/v1/track" cgraph "github.com/aunum/goro/pkg/v1/common/graph" "github.com/aunum/goro/pkg/v1/layer" "github.com/aunum/log" g "gorgonia.org/gorgonia" ) // Model is a prediction model. type Model interface { // Compile the model. Compile(x Inp...
pkg/v1/model/model.go
0.754734
0.436562
model.go
starcoder
// Package blake256 implements BLAKE-256 and BLAKE-224 hash functions (SHA-3 // candidate). package blake256 import "hash" // The block size of the hash algorithm in bytes. const BlockSize = 64 // The size of BLAKE-256 hash in bytes. const Size = 32 // The size of BLAKE-224 hash in bytes. const Size224 = 28 type ...
crypto/blake256/blake256.go
0.643777
0.439206
blake256.go
starcoder
package models import ( i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91 "github.com/microsoft/kiota-abstractions-go/serialization" ) // PrivilegedRoleSummary type PrivilegedRoleSummary struct { Entity // The number of users that have the role assigned and the role is activated. elev...
models/privileged_role_summary.go
0.599485
0.416263
privileged_role_summary.go
starcoder
package gotetris type Piece struct { Id rune Coordinates [][][2]int LowestPoints [4][10]int MoveSet [][2]int } func NewPiece(id rune, coordSets [][][2]int) *Piece { moveSet := make([][2]int, 0, 40) lowestPoints := new([4][10]int) setPoints := new([4][10]bool) for i, rotation := range coordSet...
piece.go
0.533397
0.54952
piece.go
starcoder
package testutil import ( "context" "reflect" "github.com/stretchr/testify/require" ) // AssertReceive verifies that a channel returns a value before the given context closes, and writes into // into out, which should be a pointer to the value type func AssertReceive(ctx context.Context, t TestingT, channel inter...
testutil/channelassertions.go
0.734215
0.422743
channelassertions.go
starcoder
package engine // Direction represents a query sort direction type Direction byte const ( // Ascending means going up, A-Z Ascending Direction = 1 << iota // Descending means reverse order, Z-A Descending ) // Condition represents a filter comparison operation // between a field and a value type Condition byte...
services/backend/wallet/pkg/engine/query.go
0.841728
0.469216
query.go
starcoder
package dataselect import ( "errors" "log" "sort" metricapi "github.com/kubernetes/dashboard/src/app/backend/integration/metric/api" ) // GenericDataCell describes the interface of the data cell that contains all the necessary methods needed to perform // complex data selection // GenericDataSelect takes a list...
src/app/backend/resource/dataselect/dataselect.go
0.755907
0.424949
dataselect.go
starcoder
package vec2 import "math" // T represents a two dimensonal vector based on float64. // Imported by other packages as vec2.T, therefore we don't repeat type name. type T struct { X, Y float64 } // I represents a two dimensonal vector based on integers. type I struct { X, Y int } // New creates a new *T from two c...
vec2/vec2.go
0.936663
0.654384
vec2.go
starcoder
package ring // NTT performes the NTT transformation on the CRT coefficients a Polynomial, based on the target context. func (context *Context) NTT(p1, p2 *Poly) { for x := range context.Modulus { NTT(p1.Coeffs[x], p2.Coeffs[x], context.N, context.nttPsi[x], context.Modulus[x], context.mredParams[x], context.bredPa...
ring/ntt.go
0.801781
0.54958
ntt.go
starcoder
package binp import "encoding/binary" // Printer type. Don't touch the internals. type Printer struct { w []byte } // Create a new printer with empty output. func Out() *Printer { return &Printer{[]byte{}} } // Create a new printer with output prefixed with the given byte slice. func OutWith(b []byte) *Printer {...
binprinter_native_le.go
0.731059
0.444927
binprinter_native_le.go
starcoder
package neat import ( "bytes" "encoding/json" "fmt" "sort" . "github.com/rqme/errors" ) type ExperimentSettings interface { Iterations() int Traits() Traits FitnessType() FitnessType ExperimentName() string } // Experiment provides the definition of how to solve the problem using NEAT type Experiment struc...
experiment.go
0.676192
0.445952
experiment.go
starcoder
package timeutil import "time" func BeginningOfMinute(t time.Time) time.Time { return t.Truncate(time.Minute) } func BeginningOfHour(t time.Time) time.Time { return t.Truncate(time.Hour) } func BeginningOfDay(t time.Time) time.Time { d := time.Duration(-t.Hour()) * time.Hour return BeginningOfHour(t).Add(d) } ...
timeutil/util.go
0.79999
0.657923
util.go
starcoder
package vm // OP represents an opcode for the VM. Operations take 0 or 1 operands. type Op int const ( // Read a value of the operand type from the wire and put itin the frame Read Op = iota // Set the current target to the value of the operand type from the frame Set // Allocate a new frame and make the targe...
v7/vm/op.go
0.599954
0.749706
op.go
starcoder
package linalg import "math" // a sparse vector of uint64->float64s type IFVector map[uint64]float64 type IFVectorEach func(key uint64, value float64) type IFVectorReduce func(key uint64, value, lastValue float64) float64 type IFVectorMap func(key uint64, value float64) float64 type IFVectorFilter func(key uint64, va...
paraphrase/linalg/vector.go
0.844697
0.699934
vector.go
starcoder
package histogram import ( "image" "github.com/anthonynsimon/bild/clone" ) // RGBAHistogram holds a sub-histogram per RGBA channel. // Each channel histogram contains 256 bins (8-bit color depth per channel). type RGBAHistogram struct { R Histogram G Histogram B Histogram A Histogram } // Histogram holds a va...
histogram/histogram.go
0.829906
0.718026
histogram.go
starcoder
package mlpack /* #cgo CFLAGS: -I./capi -Wall #cgo LDFLAGS: -L. -lmlpack_go_hmm_train #include <capi/hmm_train.h> #include <stdlib.h> */ import "C" type HmmTrainOptionalParam struct { Batch bool Gaussians int InputModel *hmmModel LabelsFile string Seed int States int Tolerance float64 ...
hmm_train.go
0.644225
0.455986
hmm_train.go
starcoder
package main import ( "fmt" "github.com/go-gl/gl/v4.1-core/gl" "github.com/go-gl/glfw/v3.3/glfw" "github.com/go-gl/mathgl/mgl32" "golang.org/x/image/font" "golang.org/x/image/font/sfnt" "golang.org/x/image/math/fixed" "io/ioutil" "math" ) var ( ProjMat = mgl32.Ident4() VeiwMat = mgl32.Ident4() ProjM...
structs.go
0.685739
0.48438
structs.go
starcoder
package iso20022 // Provides further details on the settlement of the instruction. type SettlementInstruction3 struct { // Agent through which the instructing agent will reimburse the instructed agent. // Usage: If InstructingAgent and InstructedAgent have the same reimbursement agent, then only InstructingReimburs...
SettlementInstruction3.go
0.688992
0.515742
SettlementInstruction3.go
starcoder
package vector import "C" import ( "math" "os" "unsafe" ) func F32Compare(f1, f2 float32, precision float64) int { res := f1 - f2 switch { case math.Abs(float64(res)) < precision: return 0 case res < 0: return -1 } // >0 return 1 } type F32Vector []float32 func MakeF32(ln int) F32Vector { return mak...
vector/f32.go
0.697712
0.470372
f32.go
starcoder
package main import ( "bytes" "fmt" "net/url" "time" "github.com/gorilla/websocket" ) // TestPacket represents a single packet that will be sent to the server and is expected to be looped back. type TestPacket struct { Type int // The packet/message types are defined in RFC 6455 Payload []byte } // TestOp...
StressTest/connection.go
0.649912
0.420481
connection.go
starcoder
package dtls /* DTLS messages are grouped into a series of message flights, according to the diagrams below. Although each flight of messages may consist of a number of messages, they should be viewed as monolithic for the purpose of timeout and retransmission. https://tools.ietf.org/html/rfc4347#section-4....
flight.go
0.748812
0.467393
flight.go
starcoder
package basic_programming import ( "fmt" ) /* {a,e,i,o,u,A,E,I,O,U} Natural Language Understanding is the subdomain of Natural Language Processing where people used to design AI based applications have ability to understand the human languages. HashInclude Speech Processing team has a project named Virtual Assistan...
basic-programming/VowelRecognition.go
0.61231
0.555254
VowelRecognition.go
starcoder
package element const Conv = ` // ToMont converts z to Montgomery form // sets and returns z = z * r^2 func (z *{{.ElementName}}) ToMont() *{{.ElementName}} { return z.Mul(z, &rSquare) } // ToRegular returns z in regular form (doesn't mutate z) func (z {{.ElementName}}) ToRegular() {{.ElementName}} { return *z.Fro...
field/internal/templates/element/conv.go
0.838878
0.563618
conv.go
starcoder
package MatrixHelper import ( "fmt" "gonum.org/v1/gonum/mat" "gonum.org/v1/gonum/stat/distuv" "math" ) // PrintMatrix prints the given matrix onto the console with a nice format. func PrintMatrix(matrix mat.Matrix) { A := mat.Formatted(matrix, mat.Squeeze()) fmt.Printf("%4.6f", A) print("\n") } // AddScalar a...
RestaurantChatbot/MatrixHelper/Helper.go
0.851429
0.576125
Helper.go
starcoder
package godouble import ( "fmt" "reflect" ) //T is compatible with builtin testing.T type T interface { Errorf(format string, args ...interface{}) Fatalf(format string, args ...interface{}) Logf(format string, args ...interface{}) Helper() } //MatcherForMethod can be used to integrate a different matching fram...
godouble/double.go
0.699562
0.511656
double.go
starcoder
package rgbmatrix import ( "image" "image/draw" "image/gif" "io" "time" ) // ToolKit is a convinient set of function to operate with a led of Matrix type ToolKit struct { // Canvas is the Canvas wrapping the Matrix, if you want to instanciate // a ToolKit with a custom Canvas you can use directly the struct, ...
toolkit.go
0.707809
0.424472
toolkit.go
starcoder
package main import "fmt" func main() { t_parity() t_kronecker() t_identities() } func assert(x bool) { if !x { panic("assertion failed") } } /* e_ijk*e_ipq = k_jp*k_kq - k_kp*k_jq e_ijk*e_ijp = k_pk ijkpq are any combination of indices with value [1, 2, 3] ijk have to be independent of each other */ fun...
math/permutation-symbol.go
0.54577
0.454654
permutation-symbol.go
starcoder
package bit import ( "bytes" "fmt" ) // A Set256 represents a set of integers in the range [0, 256). // It does so more efficiently than a Set of capacity 256. // For efficiency, the methods of Set256 perform no bounds checking on their // arguments. type Set256 struct { sets [4]Set64 } func (s *Set256) Add(n uin...
set256.go
0.683736
0.519278
set256.go
starcoder
package mat import ( "github.com/angelsolaorbaiceta/inkmath/nums" "github.com/angelsolaorbaiceta/inkmath/vec" ) /* A DenseMat is an implementation of a dense Matrix. Dense matrices allocate all the memory required to store every value. Every value which hasn't been explecitly set is zero. */ type DenseMat struct {...
mat/dense_matrix.go
0.851197
0.752217
dense_matrix.go
starcoder
package cityhash // Some primes between 2^63 and 2^64 for various uses. const ( k0 = uint64(0xc3a5c85c97cb3127) k1 = uint64(0xb492b66fbe98f273) k2 = uint64(0x9ae16a3b2f90404f) ) // Magic numbers for 32-bit hashing. Copied from Murmur3. const ( c1 = uint32(0xcc9e2d51) c2 = uint32(0x1b873593) ) // Hash64 returns...
vendor/github.com/creachadair/cityhash/cityhash.go
0.722233
0.487551
cityhash.go
starcoder
package stats import ( "math" "reflect" "sort" "github.com/kelindar/binary" "github.com/kelindar/binary/sorted" ) // Sample represents a sample window type sample sorted.Int32s func (s sample) Len() int { return len(s) } func (s sample) Less(i, j int) bool { return s[i] < s[j] } func (s sample) Swap...
sample.go
0.863794
0.488588
sample.go
starcoder
package graphql_models type BooleanFilter struct { IsTrue *bool `json:"isTrue"` IsFalse *bool `json:"isFalse"` IsNull *bool `json:"isNull"` } type ChangePasswordResponse struct { Ok bool `json:"ok"` } type FloatFilter struct { EqualTo *float64 `json:"equalTo"` NotEqualTo *float64 `json:"n...
graphql_models/generated_models.go
0.531209
0.401219
generated_models.go
starcoder
package tinygraph import ( "errors" "fmt" ) // MatrixType is log 2 of the cell size type MatrixType uint64 const ( // Bit is a single-bit cell Bit MatrixType = iota // TwoBit is a two-bit cell TwoBit // FourBit is a four-bit cell FourBit // Byte is an eight-bit cell Byte // SixteenBit is a sixteen-bit cel...
matrix.go
0.686055
0.571826
matrix.go
starcoder
package stats import ( "fmt" "github.com/onsi/gomega/types" ) type StatItem struct { Name string `json:"name"` Value interface{} `json:"value"` } type Stats struct { Stats []StatItem `json:"stats"` } func BeEqual(expected interface{}) types.GomegaMatcher { return &statMatcher{ expected: expected, ...
test/framework/envoy_admin/stats/stats.go
0.783368
0.446314
stats.go
starcoder
package embedding import ( "bufio" "io" "strconv" "strings" "github.com/pkg/errors" "github.com/wujunfeng1/wego/pkg/embedding/embutil" ) type Embedding struct { Word string Dim int Vector []float64 Norm float64 } func (e Embedding) Validate() error { if e.Word == "" { return errors.New("Word i...
pkg/embedding/embedding.go
0.66072
0.410047
embedding.go
starcoder
package parse import ( "go/ast" "strings" "github.com/ardnew/gosh/cmd/goshfun/util" ) // Argument represents an individual argument variable in the list of argument // variables of an individual function definition. type Argument struct { Name string Ref []Reference Type string } // NewArgument creates a new...
cmd/goshfun/parse/argument.go
0.70619
0.468487
argument.go
starcoder
package fractal import ( "image" "image/color" "math/rand" "time" ) // Fractal is a general fractal representation. Have information about: // iterations, zoom value and centering point. type Fractal struct { Src *image.RGBA // Image to write fractal on. Iter float64 // Number of iterations to perform....
fractal/fractal.go
0.739234
0.483892
fractal.go
starcoder
package leetcode /* Given a collection of intervals, merge all overlapping intervals. Example 1: Input: intervals = [[1,3],[2,6],[8,10],[15,18]] Output: [[1,6],[8,10],[15,18]] Explanation: Since intervals [1,3] and [2,6] overlaps, merge them into [1,6]. Example 2: Input: intervals = [[1,4],[4,5]] Output: [[...
go-impl/056-MergeIntervals.go
0.599485
0.473779
056-MergeIntervals.go
starcoder
package particles // IDOrder is an interface for mapping paritcles IDs to their 3D index into the // simulation grid. This interface also supports mutli-reoslution simulations // which are split up into "levels" of fixed resolution. type IDOrder interface { // IDToIndex converts an ID to its 3-index equivalent in the...
lib/particles/id_order.go
0.780119
0.667771
id_order.go
starcoder
package main import ( "github.com/faiface/pixel" "github.com/faiface/pixel/pixelgl" "github.com/zergon321/cirno" ) type player struct { speed float64 jumpAcceleration float64 verticalSpeed float64 terminalSpeed float64 aim cirno.Vector bulletSpeed float64 bulletSprite ...
examples/platformer/player.go
0.652131
0.461502
player.go
starcoder
package math import ( "github.com/jtejido/ggsl/specfunc" gomath "math" ) // Lower Incomplete Gamma func Ligamma(a, z float64) float64 { return gomath.Pow(z, a) * specfunc.Hyperg_1F1(a, a+1, -z) / a } // Inverse of the upper incomplete Gamma function func InverseRegularizedUpperIncompleteGamma(a, p float64) float6...
math/gamma.go
0.677901
0.592608
gamma.go
starcoder
package assertjson import ( "testing" "github.com/stretchr/testify/assert" ) // IsString asserts that the JSON node has a string value. func (node *AssertNode) IsString(msgAndArgs ...interface{}) { node.t.Helper() if node.exists() { assert.IsType(node.t, "", node.value, msgAndArgs...) } } // EqualToTheString...
assertjson/string.go
0.647241
0.737938
string.go
starcoder
package advent import ( . "github.com/davidparks11/advent2021/internal/advent/day8" ) var _ Problem = &sevenSegmentSearch{} type sevenSegmentSearch struct { dailyProblem } func NewSevenSegmentSearch() Problem { return &sevenSegmentSearch{ dailyProblem{ day: 8, }, } } func (s *sevenSegmentSearch) Solve()...
internal/advent/day8.go
0.68342
0.519399
day8.go
starcoder
package world import ( "ForestModel/entity" "ForestModel/util" "errors" ) //World represents the reified datastructure of the world itself type World struct { Entities []*entity.Entity Cells map[util.Point]*Cell size util.Rect } //Cell represents a containing subsection of forest type Cell struct { uti...
world/world.go
0.730674
0.536981
world.go
starcoder
package testdata // GetRefundResponse example const GetRefundResponse = `{ "resource": "refund", "id": "re_4qqhO89gsT", "amount": { "currency": "EUR", "value": "5.95" }, "status": "pending", "createdAt": "2018-03-14T17:09:02.0Z", "description": "Order #33", "metadata": {...
testdata/refunds.go
0.667906
0.409752
refunds.go
starcoder
package gopriceoptions import ( "math" ) var sqtwopi float64 = math.Sqrt(2 * math.Pi) var IVPrecision = 0.00001 func PriceBlackScholes(callType bool, underlying float64, strike float64, timeToExpiration float64, volatility float64, riskFreeInterest float64, dividend float64) float64 { var sign float64 if callTyp...
blacklike.go
0.72027
0.458349
blacklike.go
starcoder
package modern import ( "github.com/dotstart/identicons/library/identicons/icon/tiled" "github.com/dotstart/identicons/library/identicons/shape" ) var halfRectangleTile = tiled.Rect(0, 0, 0.5, 0.5) var tileTable = []tiled.Tile{ halfRectangleTile, // half rectangle tiled.Combined(halfRectangleTile, tiled.Flipped(...
library/identicons/icon/modern/tiles.go
0.535098
0.600393
tiles.go
starcoder
package main type struct1 struct { A int // To ignore a field in a struct, just annotate it with testdiff:"ignore" like this: B int `testdiff:"ignore"` } type struct2 struct { A int b int C []int } type struct3 struct { s2 struct2 } type struct4 struct { s3 struct3 } type struct5 struct { s4 []struct4 } ...
dev/RnD/messagediff/simple.go
0.547222
0.447702
simple.go
starcoder