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 main var f64asm = []AsmFn{ { Name: "add8", Doc: ` // Element-wise addition of a and b, storing the result in dst. // n must be a multiple of 8.`, FnKind: Float64x2, Arch: X86, Body: ` VADDPD (CX)(R8*8), Y0, Y0 VADDPD 32(CX)(R8*8), Y1, Y1 `, }, { Name: "add8", Doc: ` // Element-wi...
genasm/f64.go
0.66072
0.418459
f64.go
starcoder
package gubernator import ( "github.com/mailgun/gubernator/cache" ) // Implements token bucket algorithm for rate limiting. https://en.wikipedia.org/wiki/Token_bucket func tokenBucket(c cache.Cache, r *RateLimitReq) (*RateLimitResp, error) { item, ok := c.Get(r.HashKey()) if ok { // The following semantic allows...
algorithms.go
0.667148
0.413951
algorithms.go
starcoder
package arithm import ( "fmt" "math" "math/cmplx" "github.com/npillmayer/schuko/gtrace" "github.com/npillmayer/schuko/tracing" ) // T traces to the equations-tracer. func T() tracing.Trace { return gtrace.EquationsTracer } // === Numeric Data Type ===================================================== // Deg2...
arithm.go
0.864654
0.573977
arithm.go
starcoder
package swarm import ( "errors" "math" "regexp" "strconv" "strings" "github.com/emman27/aoc2017/utils" ) // Geometry represents a 3-dimensional value type Geometry struct { X int Y int Z int } // Particle represents a particle type Particle struct { ID int Position Geometry Velocity Ge...
swarm/swarm.go
0.751557
0.430985
swarm.go
starcoder
package main import ( "math" "strings" ) func eliminateUnselectedMoves(selectedMove string, possibleMoves map[string]bool) { for direction, _ := range possibleMoves { if (direction == selectedMove) { continue } else { possibleMoves[direction] = false } } } // avoid move if target is r...
src/helpers.go
0.802942
0.427456
helpers.go
starcoder
package hash import ( "math" "math/rand" "github.com/sachaservan/vec" ) // Return a random rotation matrix chosen uniformly func RandomRotationMatrix(dim int) []*vec.Vec { return GetRandomRotation(dim) } // Return a random directional vector func RandomVector(dim int) *vec.Vec { return Normals(dim) } // Retur...
hash/randomness.go
0.862554
0.576721
randomness.go
starcoder
package aiplatform import ( context "context" cmpopts "github.com/google/go-cmp/cmp/cmpopts" codes "google.golang.org/grpc/codes" status "google.golang.org/grpc/status" proto "google.golang.org/protobuf/proto" protocmp "google.golang.org/protobuf/testing/protocmp" fieldmaskpb "google.golang.org/protobuf/types/...
proto/gen/googleapis/cloud/aiplatform/v1/job_service_aiptest.pb.go
0.58439
0.448909
job_service_aiptest.pb.go
starcoder
package day18 import ( "log" "strconv" "strings" ) type EquationState struct { acc int operator string } type ParsingState struct { newTokens []string accumulated []string } // Evaluates all equations and returns the sum of the results func EvaluateAllEquations(equationStrings []string, complexRules b...
day18/day18.go
0.68763
0.463384
day18.go
starcoder
package dawg import ( "bytes" "errors" "io" "math/bits" "sort" ) //Dawg is a directed acyclic word graph (also known as a deterministic acyclic finite state automaton) is a data structure for storing a set of []byte in efficiently while still being easy to query. type Dawg struct { id uint64 //This is u...
dawg/dawg.go
0.501465
0.413832
dawg.go
starcoder
package storetest import ( "context" "encoding/binary" "fmt" "strings" "testing" "github.com/dfuse-io/kvdb/store" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" ) type kvStoreOptions struct { enableEmptyValue bool withPurgeable bool purgeableStoreTablePrefi...
store/storetest/kvstoretest.go
0.546254
0.432842
kvstoretest.go
starcoder
package shp // shapes var lin2, lin3, lin4, lin5 Shape // register shapes func init() { // lin2 lin2.Type = "lin2" lin2.Func = Lin2 lin2.BasicType = "lin2" lin2.Gndim = 1 lin2.Nverts = 2 lin2.VtkCode = VTK_LINE lin2.NatCoords = [][]float64{ {-1, 1}, } lin2.init_scratchpad() factory["lin2"] = &lin2 ips...
shp/lins.go
0.602997
0.423279
lins.go
starcoder
package analysis import ( "bm/db" "bytes" "fmt" "io/ioutil" "os" "os/exec" "strconv" "strings" ) // QbetsPredictor analyzes time series data using QBETS, and makes quantile // predictions on them. type QbetsPredictor struct { // QbetsPath is the path to the QBETS executable on the local // file system. Qbe...
Eager/bm-data-service/src/bm/analysis/qbets.go
0.646125
0.471406
qbets.go
starcoder
package org import ( "regexp" validation "github.com/go-ozzo/ozzo-validation/v4" ) // Unit is used to represent standard unit types. type Unit string // Set of common units based on UN/ECE recommendation 20 and 21. Some local formats // may define additional non-standard codes which may be added. There are so // ...
org/unit.go
0.72027
0.541591
unit.go
starcoder
package cellwalker // CellWalker struct type CellWalker struct { position *Cell boundary *Range } func newCellWalker(cell *Cell, boundary *Range) *CellWalker { return &CellWalker{ position: cell.Clone(), boundary: boundary.Clone(), } } // At initializes CellWalker by specify initial cell to start func At(cel...
cellwalker.go
0.896422
0.438124
cellwalker.go
starcoder
package geo import ( "bytes" "fmt" "math" "github.com/paulmach/go.geojson" ) // A PointSet represents a set of points in the 2D Eucledian or Cartesian plane. type PointSet []Point // NewPointSet simply creates a new point set with points array of the given size. func NewPointSet() *PointSet { return &PointSet{...
vendor/github.com/paulmach/go.geo/point_set.go
0.879062
0.60399
point_set.go
starcoder
package data import ( "bytes" "fmt" "sort" "github.com/kode4food/ale/types" "github.com/kode4food/ale/types/basic" ) type ( // Pair represents the interface for a binary structure, such as a Cons Pair interface { Value Car() Value Cdr() Value } // Cons represents the most basic implementation of a Pa...
data/cons.go
0.783492
0.423458
cons.go
starcoder
package alt import ( "math" "strconv" "time" ) // Converter types are used to convert data element to alternate // values. Common uses are to match a pattern such as strings representing // dates to time.Time. type Converter struct { // Int are a slice of functions to match and convert Ints. Int []func(val int6...
alt/converter.go
0.612889
0.566858
converter.go
starcoder
package dagger import ( "fmt" "github.com/autom8ter/dagger/constants" "github.com/autom8ter/dagger/driver" "github.com/autom8ter/dagger/util" ) // Graph is a concurrency safe, mutable, in-memory directed graph type Graph struct { nodes driver.Index edges driver.Index edgesFrom driver.Index edgesTo d...
dag.go
0.738858
0.415729
dag.go
starcoder
package sms import ( "errors" "sort" ) // SimpleMergeSorter is the simple merge sorter. type SimpleMergeSorter struct { data [][]ValueType cursors []*int } // ValueType is the type of the sorted data. // If you change this, you will also need to make changes to the code. //type ValueType = int type ValueType ...
SimpleMergeSort.go
0.677901
0.431704
SimpleMergeSort.go
starcoder
package bls12377 import ( "errors" "math/big" ) type fp2Temp struct { t [4]*fe } type fp2 struct { fp2Temp } func newFp2Temp() fp2Temp { t := [4]*fe{} for i := 0; i < len(t); i++ { t[i] = &fe{} } return fp2Temp{t} } func newFp2() *fp2 { t := newFp2Temp() return &fp2{t} } func (e *fp2) fromBytes(in []b...
fp2.go
0.5144
0.417746
fp2.go
starcoder
package storetests import ( "testing" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" "github.com/mattermost/focalboard/server/model" "github.com/mattermost/focalboard/server/services/store" ) func StoreTestSubscriptionsStore(t *testing.T, setup func(t *testing.T) (store.Store, func...
server/services/store/storetests/subscriptions.go
0.547222
0.572603
subscriptions.go
starcoder
package limage import ( "image" "image/color" "vimagination.zapto.org/limage/lcolor" ) // RGB is an image of RGB colours type RGB struct { Pix []lcolor.RGB Stride int Rect image.Rectangle } // NewRGB create a new RGB image with the given bounds func NewRGB(r image.Rectangle) *RGB { w, h := r.Dx(), r.Dy(...
rgb.go
0.886248
0.493897
rgb.go
starcoder
package dga import ( "bytes" "fmt" "io" "time" ) const ( // Star is used to model any predicate or any object in an NQuad. Star = "*" // DateTimeFormat is the format used by Dgraph for facet values of type dateTime. DateTimeFormat = "2006-01-02T15:04:05" // DgraphType is a reserved predicate name to refer ...
nquad.go
0.721645
0.406214
nquad.go
starcoder
package partition import ( "bytes" "math/big" "sort" "github.com/google/uuid" "golang.org/x/xerrors" ) // Range represents a contiguous UUID region which is split into a number of // partitions. type Range struct { start uuid.UUID rangeSplits []uuid.UUID } // NewFullRange creates a new range that uses ...
Chapter12/dbspgraph/partition/range.go
0.769946
0.487063
range.go
starcoder
package py /* #include "Python.h" int IsPyTypeTrue(PyObject *o) { return o == Py_True; } int IsPyTypeFalse(PyObject *o) { return o == Py_False; } int IsPyTypeLong(PyObject *o) { return PyLong_CheckExact(o); } int IsPyTypeFloat(PyObject *o) { return PyFloat_CheckExact(o); } int IsPyTypeByteArray(PyObject ...
py2go_converter_py3.go
0.586523
0.464173
py2go_converter_py3.go
starcoder
package docs import ( "bytes" "encoding/json" "strings" "github.com/alecthomas/template" "github.com/swaggo/swag" ) var doc = `{ "schemes": {{ marshal .Schemes }}, "swagger": "2.0", "info": { "description": "{{.Description}}", "title": "{{.Title}}", "contact": { ...
backend/docs/docs.go
0.711531
0.441071
docs.go
starcoder
package chess import ( "math" "github.com/athom/goset" ) func left(p Pos) Pos { return p.Move(-1, 0) } func right(p Pos) Pos { return p.Move(1, 0) } func up(p Pos) Pos { return p.Move(0, 1) } func down(p Pos) Pos { return p.Move(0, -1) } func distance(p1 Pos, p2 Pos) int { return int(math.Abs(float64(p1.X-p2...
helper.go
0.681515
0.529932
helper.go
starcoder
package chess // Reverse returns a bitboard where the bit order is reversed. // Implementation from: http://stackoverflow.com/questions/746171/best-algorithm-for-bit-reversal-from-msb-lsb-to-lsb-msb-in-c func (b bitboard) Reverse() bitboard { return bitboard((bitReverseLookupTable[b&0xff] << 56) | (bitReverseLooku...
bitboard_prebits.go
0.690455
0.434821
bitboard_prebits.go
starcoder
package filter import ( "fmt" "github.com/bytom/errors" ) //Column describe a column type Column struct { Name string Type Type } //Table describe a table type Table struct { Name string Alias string Columns map[string]*Column ForeignKeys map[string]*ForeignKey } //ForeignKey describe a fo...
vendor/github.com/bytom/blockchain/query/filter/typecheck.go
0.694303
0.42668
typecheck.go
starcoder
package comply import ( "errors" "gonum.org/v1/gonum/mat" ) // We define out own LU decomposition here and not as // a reusable package in pkg, since there is already // very good LU decomposition functionality in gonum // (based on LAPACK and BLAS), which is preferable // to this home-cooked solution. type LU str...
assignment/comply/lu.go
0.714528
0.465448
lu.go
starcoder
package indicators import ( "github.com/thetruetrade/gotrade" "math" ) // A Linear Regression Angle Indicator (LinRegAng) type LinRegAng struct { *LinRegWithoutStorage selectData gotrade.DOHLCVDataSelectionFunc // public variables Data []float64 } // NewLinRegAng creates a Linear Regression Angle Indicator (L...
indicators/linregang.go
0.695338
0.465448
linregang.go
starcoder
// encapsulates standard host entities into a simple interface package wasmlib import ( "strconv" ) type PostRequestParams struct { ContractId *ScContractId Function ScHname Params *ScMutableMap Transfer balances Delay int64 } // \\ // \\ // \\ // \\ // \\ // \\ // \\ // \\ // \\ // \\ // \\ // ...
packages/vm/wasmlib/context.go
0.837487
0.415788
context.go
starcoder
package testutils import ( "strings" "testing" "github.com/axelarnetwork/utils/slices" ) const ( _given = "GIVEN" _when = "WHEN" _then = "THEN" _and = "AND" ) // GivenStatement is used to set up unit test preconditions type GivenStatement struct { label []string test func() } // WhenStatement is used...
test/gherkin.go
0.700997
0.52409
gherkin.go
starcoder
package goldengine import ( "bytes" "encoding/json" "fmt" "html/template" "sort" "time" sf "github.com/manyminds/gosfml" ) //SceneDefEntity : Defines an Entity within the scene type SceneDefEntity struct { Name string Parent string Prefab string TransformArguments map...
scene.go
0.540439
0.434161
scene.go
starcoder
package continuous import ( "github.com/jtejido/ggsl/specfunc" "github.com/jtejido/linear" "github.com/jtejido/stats" "github.com/jtejido/stats/err" smath "github.com/jtejido/stats/math" "math" "math/rand" ) // Chi-Squared distribution // https://en.wikipedia.org/wiki/Chi-squared_distribution type ChiSquared s...
dist/continuous/chi_squared.go
0.804252
0.436322
chi_squared.go
starcoder
package rounding import ( "math/big" ) // RoundingMode describes how to round a given number. // sign is the sign of the number (needed when n is zero) // n is the integer that should be rounded such that the last digit is zero. // l is the current last digit of n. // r indicates whether the rest of the original num...
vendor/github.com/wadey/go-rounding/round.go
0.743447
0.529385
round.go
starcoder
package ast import ( "github.com/magic003/liza/token" ) // Expr is the base type for all expression tree node. type Expr interface { Node exprNode() } // Ident is a node represents an identifier. type Ident struct { Token *token.Token // identifier token } // Pos implementation for Node. func (ident *Ident) Pos...
ast/expr.go
0.764628
0.480235
expr.go
starcoder
package aoc import ( "fmt" "log" ) type Compass string type Direction struct { Dx, Dy int } func (d Direction) String() string { return fmt.Sprintf("[%d,%d]", d.Dx, d.Dy) } func (d Direction) Char() byte { switch { case d.Dx == 0 && d.Dy == -1: return '^' case d.Dx == 1 && d.Dy == 0: return '>' case d....
lib-go/directions.go
0.522933
0.588771
directions.go
starcoder
package expression import ( "github.com/liquidata-inc/go-mysql-server/sql" ) // TransformExprWithNodeFunc is a function that given an expression and the node that contains it, will return that // expression as is or transformed along with an error, if any. type TransformExprWithNodeFunc func(sql.Node, sql.Expression...
sql/expression/transform.go
0.66769
0.543106
transform.go
starcoder
package internal import ( "container/heap" ) // Key represents a graph vertex. type Key uint64 // Path represents an ordered series of contiguously incident vertices. type Path struct { Cost int Vertices []Key // TODO(mway): list } // Extend extends p to contain vertex as the latest incident vertex and // i...
x/container/graph/internal/path.go
0.613352
0.519643
path.go
starcoder
package display import ( "fmt" mgl "github.com/go-gl/mathgl/mgl32" "github.com/inkyblackness/shocked-client/graphics" "github.com/inkyblackness/shocked-client/opengl" ) var placedIconsVertexShaderSource = ` #version 150 precision mediump float; in vec3 vertexPosition; in vec3 uvPosition; uniform mat4 modelMat...
src/github.com/inkyblackness/shocked-client/editor/display/PlacedIconsRenderable.go
0.715325
0.411879
PlacedIconsRenderable.go
starcoder
package simplecsv // GetNumberRows returns the number of rows, including the header row func (s SimpleCsv) GetNumberRows() int { return len(s) } // GetRow returns the row rowNumber // If rowNumber does not exist, it returns an empty slice and false func (s SimpleCsv) GetRow(rowNumber int) ([]string, bool) { if rowN...
rows.go
0.816333
0.50293
rows.go
starcoder
package types // Reference: https://www.ietf.org/rfc/rfc4120.txt // Section: 5.2.8 import ( "github.com/jcmturner/gofork/encoding/asn1" ) /* KerberosFlags For several message types, a specific constrained bit string type, KerberosFlags, is used. KerberosFlags ::= BIT STRING (SIZE (32..MAX)) -- m...
vendor/github.com/elastic/beats/vendor/gopkg.in/jcmturner/gokrb5.v7/types/KerberosFlags.go
0.772745
0.445107
KerberosFlags.go
starcoder
package scanner import ( "strings" "github.com/kasperisager/pak/pkg/asset/html/token" ) type SyntaxError struct { Offset int Message string } func (err SyntaxError) Error() string { return err.Message } func Scan(runes []rune) (tokens []token.Token, err error) { tokens = make([]token.Token, 0, len(runes)/4)...
pkg/asset/html/scanner/scan.go
0.692434
0.458591
scan.go
starcoder
package useful import . "github.com/SimonRichardson/wishful/wishful" type StateT struct { m Point Run func(x Any) Point } func NewStateT(m Point) StateT { return StateT{ m: m, Run: func(x Any) Point { return nil }, } } func (x StateT) Func(f func(Any) Point) StateT { return StateT{ m: x.m, Run...
useful/statet.go
0.673729
0.546859
statet.go
starcoder
package main import "fmt" import "time" import "math/rand" import "math" import "strconv" // Uses the make_change function to make num_changes to the current solution and then returns the // solution with the random changes made func make_changes(current_solution []int, make_change func([]int) []int, num_changes int)...
src/simulated_annealing/simulated_annealing.go
0.598664
0.443118
simulated_annealing.go
starcoder
package timecode import ( "fmt" "math" "time" ) type Components struct { Hours, Minutes, Seconds, Frames int64 } func (c Components) Equals(other Components) bool { return c.Hours == other.Hours && c.Minutes == other.Minutes && c.Seconds == other.Seconds && c.Frames == other.Frames } // Timecode represen...
timecode.go
0.849097
0.423756
timecode.go
starcoder
package BrickMosaic import ( "image/color" ) // BrickColor represents the color of a LEGO brick. It implements the color.Color interface via delegation. type BrickColor struct { id int name string c color.Color } func (c BrickColor) RGBA() (r, g, b, a uint32) { return c.c.RGBA() } var ( Red = color.RGBA{...
palette.go
0.637031
0.431045
palette.go
starcoder
package core import ( "reflect" "time" ) var ( TrueCondition = &BooleanCondition{&StaticValue{true}} FalseCondition = &BooleanCondition{&StaticValue{false}} ) type LogicalOperator int type ComparisonOperator int type Type int const ( OR LogicalOperator = iota AND UnknownLogicalOperator Equals ComparisonOp...
vendor/github.com/karlseguin/gerb/core/condition.go
0.698124
0.525247
condition.go
starcoder
package main import ( "image" "math/rand" ) // Board implements game of life logic. type Board struct { // Size is the count of cells in a particular dimension. Size image.Point // Cells contains the alive or dead cells. Cells []byte // buffer is used to avoid reallocating a new cells // slice for every upd...
life/board.go
0.712732
0.515376
board.go
starcoder
package tempCrit import ( "fmt" "math" ) import ( "github.com/tflovorn/scExplorer/integrate" "github.com/tflovorn/scExplorer/tempAll" ) // Integrate F * n_BE(omega_+) over relevant energy range. func OmegaIntegralY(env *tempAll.Environment, a, b float64, F func(float64) float64) (float64, error) { return omegaIn...
tempCrit/integrate.go
0.597256
0.470189
integrate.go
starcoder
package solver // A PBConstr is a Pseudo-Boolean constraint. type PBConstr struct { Lits []int // List of literals, designed with integer values. A positive value means the literal is true, a negative one it is false. Weights []int // Weight of each lit from Lits. If nil, all lits == 1 AtLeast int // Sum of al...
vendor/github.com/crillab/gophersat/solver/pb.go
0.854308
0.520435
pb.go
starcoder
package nodes import ( "fmt" "../types" ) type TypecastExpression struct { NodeBase Type types.Type Child Expression } func (self *TypecastExpression) NodeType() NodeType { return NodeExpression } // TypecastExpression can be treated at Typecast func (self *TypecastExpression) ExpressionType() ExpressionTy...
nodes/typecast_expression.go
0.567817
0.423041
typecast_expression.go
starcoder
package cryptoapis import ( "encoding/json" ) // TransactionMinedDataItem Defines an `item` as one result. type TransactionMinedDataItem struct { // Represents the specific blockchain protocol name, e.g. Ethereum, Bitcoin, etc. Blockchain string `json:"blockchain"` // Represents the name of the blockchain networ...
model_transaction_mined_data_item.go
0.813794
0.455622
model_transaction_mined_data_item.go
starcoder
package calculation import ( "github.com/ms-uzh/calc/models" ) func CalculatePrecursor1(head models.Head, tail models.Tail, polyamines ...models.Polyamine) float64 { precursor := CalculateMass(head, tail, polyamines...) quaternary := CalculateQuaternary(head, tail, polyamines...) correcture := precursor1Correctu...
calculation/precursor.go
0.738669
0.656562
precursor.go
starcoder
package ovnutil func matchIntegerIfNonZero(a, b int64) bool { var z int64 if b == z { return true } return matchInteger(a, b) } func matchInteger(a, b int64) bool { return a == b } func matchIntegerOptionalIfNonZero(a, b *int64) bool { if b == nil { return true } return matchIntegerOptional(a, b) } fun...
pkg/vpcagent/ovnutil/atomics_match.go
0.585338
0.457379
atomics_match.go
starcoder
package touch import ( "math" "github.com/hajimehoshi/ebiten/v2" "github.com/hajimehoshi/ebiten/v2/inpututil" ) // Input is a "manager" for touch input and provides logical encapsulations of // touch interactions like panning, pinching, and tapping. type Input struct { touches map[ebiten.TouchID]*touch Pinch *...
touch/touch.go
0.562898
0.495117
touch.go
starcoder
package learner import ( "github.com/hansen1101/go_heating/auxiliary/clustering" "fmt" "math" "errors" ) type fullCluster struct { clustering.Cluster *simpleCluster } func newFullCluster(cluster clustering.Cluster, distAlgo clustering.PointDistance)(obj *fullCluster){ obj = new(fullCluster) obj.Cluster = clus...
learner/fullCluster.go
0.526099
0.504761
fullCluster.go
starcoder
package geom import "image" // Box describes an axis-aligned rectangular prism. type Box struct { Min, Max Int3 } // String returns a string representation of b like "(3,4,5)-(6,5,8)". func (b Box) String() string { return b.Min.String() + "-" + b.Max.String() } // Empty reports whether the box contains no points...
geom/box.go
0.917145
0.455622
box.go
starcoder
package stats import ( "math" pd "github.com/orvend/stats/probdist" ) // TailDirection represents the direction of the tails that you consider from a distribution to perform statistical tests. type TailDirection uint8 const ( // TailRight represents the right tail of the distribution. TailRight TailDirection = ...
stathypothesis.go
0.846229
0.719495
stathypothesis.go
starcoder
package vasicek import ( "math" "math/rand" "time" "github.com/konimarti/fixedincome/pkg/term" "gonum.org/v1/gonum/optimize" ) // Vasicek implements the basic Vasicek interest rate model type Vasicek struct { // R0 R0 float64 // Rbar Rbar float64 // Gamma Gamma float64 // Sigma is the standard deviation ...
pkg/mc/model/vasicek/vasicek.go
0.738763
0.545044
vasicek.go
starcoder
package math_tools import ( "math/big" "strconv" ) // --------------------------- type arg_range_error struct { Msg string } func ( self arg_range_error ) Error () string { return self.Msg } /* Returns an error "Error : passed argument(s) out of range" */ func Arg_range_error () error { return arg_ran...
tools.go
0.548674
0.478224
tools.go
starcoder
package graph import "math" /* https://en.wikipedia.org/wiki/Dijkstra%27s_algorithm#Pseudocode simple 1 function Dijkstra(Graph, source): 2 3 create vertex set Q 4 5 for each vertex v in Graph: 6 dist[v] ← INFINITY 7 prev[v] ← UNDEFINED 8 add v to Q 10 dist[source] ...
internal/graph/dijkstra.go
0.682785
0.422862
dijkstra.go
starcoder
package gocluster import ( "errors" "math" "math/rand" "time" ) type Cluster struct { Distance func(p1, p2 []float64) (float64, error) } // Function to randomly initialize clusters from input dataset. // After initializing k clusters, runs Lloyd's Algorithm to find clusters func (c Cluster) Km(entities [][]floa...
kmeans.go
0.732209
0.457924
kmeans.go
starcoder
package rtc import "log" // CSGOperation represents a CSG operation. type CSGOperation int const ( CSGUnion CSGOperation = iota CSGIntersection CSGDifference ) // CSG represents a constructive solid geometry object. func CSG(operation CSGOperation, left, right Object) *CSGT { c := &CSGT{ Shape: Shape{Tran...
rtc/csg.go
0.874721
0.552721
csg.go
starcoder
package dyno import ( "context" ddb "github.com/aws/aws-sdk-go-v2/service/dynamodb" "sync" ) // ExportTableToPointInTime executes ExportTableToPointInTime operation and returns a ExportTableToPointInTime operation func (s *Session) ExportTableToPointInTime(input *ddb.ExportTableToPointInTimeInput, mw ...ExportTabl...
op_ExportTableToPointInTime.go
0.713931
0.676942
op_ExportTableToPointInTime.go
starcoder
package block import ( "crypto/aes" "crypto/cipher" "crypto/hmac" //nolint:gas "crypto/sha256" "fmt" "hash" "sort" "golang.org/x/crypto/blake2b" "golang.org/x/crypto/blake2s" "golang.org/x/crypto/salsa20" "golang.org/x/crypto/sha3" ) // HashFunc computes hash of block of data using a cryptographic hash fu...
block/block_formatter.go
0.695441
0.44342
block_formatter.go
starcoder
package regular_expression_matching import "strings" /* 10. 正则表达式匹配 https://leetcode-cn.com/problems/regular-expression-matching 给你一个字符串 s 和一个字符规律 p,请你来实现一个支持 '.' 和 '*' 的正则表达式匹配。 '.' 匹配任意单个字符 '*' 匹配零个或多个前面的那一个元素 所谓匹配,是要涵盖 整个 字符串 s的,而不是部分字符串。 说明: s 可能为空,且只包含从 a-z 的小写字母。 p 可能为空,且只包含从 a-z 的小写字母,以及字符 . 和 *。 示例 1: 输入:...
solutions/regular-expression-matching/d.go
0.596198
0.440951
d.go
starcoder
package bug import ( "image" "image/color" ) // Using one braille unicode rune, we fit 2 cols and 4 rows, i.e. // We fit 2 pixels by row and 4 pixels by columns. // Neatly arranged so we can use binary operator to "merge" pixels in a cell. var offsetMap = [4][2]uint8{ {0x01, 0x08}, {0x02, 0x10}, {0x04, 0x20}, {...
image.go
0.838151
0.636523
image.go
starcoder
package sqltypes import ( "errors" "fmt" "reflect" "strconv" "github.com/proproto/cloudsqldef/sqlparser/dependency/querypb" ) // NullBindVariable is a bindvar with NULL value. var NullBindVariable = &querypb.BindVariable{Type: querypb.Type_NULL_TYPE} // ValueToProto converts Value to a *querypb.Value. func Val...
sqlparser/dependency/sqltypes/bind_variables.go
0.621081
0.470858
bind_variables.go
starcoder
package insight import ( "fmt" "time" "github.com/pipe-cd/pipecd/pkg/model" ) // DeployFrequency represents a data point that shows the deployment frequency metrics. type DeployFrequency struct { Timestamp int64 `json:"timestamp"` DeployCount float32 `json:"deploy_count"` } func (d *DeployFrequency) GetTi...
pkg/insight/datapoint.go
0.825167
0.490968
datapoint.go
starcoder
package nbs import ( "fmt" "github.com/attic-labs/noms/go/metrics" ) type Stats struct { OpenLatency metrics.Histogram CommitLatency metrics.Histogram IndexReadLatency metrics.Histogram IndexBytesPerRead metrics.Histogram GetLatency metrics.Histogram ChunksPerGet metrics.Histogram FileReadLatency ...
go/nbs/stats.go
0.595375
0.698984
stats.go
starcoder
package ssdeep import ( "errors" "math" "strconv" "strings" ) var ( // ErrEmptyHash is returned when no hash string is provided for scoring. ErrEmptyHash = errors.New("empty string") // ErrInvalidFormat is returned when a hash string is malformed. ErrInvalidFormat = errors.New("invalid ssdeep format") ) // ...
score.go
0.751101
0.465691
score.go
starcoder
package cryptoapis import ( "encoding/json" ) // GetLastMinedBlockRIBSE Ethereum type GetLastMinedBlockRIBSE struct { // Represents a mathematical value of how hard it is to find a valid hash for this block. Difficulty string `json:"difficulty"` // Represents a random value that can be adjusted to satisfy the pr...
model_get_last_mined_block_ribse.go
0.811228
0.53777
model_get_last_mined_block_ribse.go
starcoder
package gorgonia import ( "fmt" "hash" "github.com/chewxy/hm" "gorgonia.org/tensor" ) /* This file contains code for Ops that aren't really functions in the sense that they aren't pure. Since they're not adherents to the Church of Lambda, they are INFIDELS! A fatwa will be issued on them shortly */ type stmtO...
vendor/gorgonia.org/gorgonia/op_infidel.go
0.637821
0.463626
op_infidel.go
starcoder
package e2e import ( "path/filepath" "strings" // gomega matchers // nolint: golint . "github.com/onsi/gomega" ) type app struct { dir string e2e *e2e } func (a *app) runKs(args ...string) *output { return a.e2e.ksInApp(a.dir, args...) } func (a *app) componentList(opts ...string) *output { o := a.runKs...
e2e/app.go
0.626353
0.446012
app.go
starcoder
package timeutil import ( "errors" "fmt" "strings" "time" ) /* TimeDeltaDow is designed to retrieve a time object x days of week in the past or the future. // Two Sundays in the future, including today, at 00:00:00 t, err := TimeDeltaDow(time.Now(), time.Sunday, 2, true, true) // Two Sundays in the future, inc...
time/timeutil/timeutil_delta.go
0.587115
0.443239
timeutil_delta.go
starcoder
package simulation import ( "bytes" "encoding/binary" "fmt" gogotypes "github.com/gogo/protobuf/types" "github.com/cosmos/cosmos-sdk/codec" sdk "github.com/cosmos/cosmos-sdk/types" "github.com/cosmos/cosmos-sdk/types/kv" "github.com/certikfoundation/shentu/v2/x/shield/types" ) // NewDecodeStore unmarshals ...
x/shield/simulation/decoder.go
0.551574
0.416915
decoder.go
starcoder
package gocarina import ( "image" _ "image/png" // register PNG format "log" "os" "strings" ) // describes the geometry of the letterpress board source images const ( LetterpressTilesAcross = 5 LetterpressTilesDown = 5 LetterpressTilePixels = 128 LetterpressHeightOffset = 496 LetterPressExpect...
letterpress.go
0.706292
0.464902
letterpress.go
starcoder
package input import ( "sync/atomic" "time" "github.com/Jeffail/benthos/v3/internal/docs" "github.com/Jeffail/benthos/v3/lib/log" "github.com/Jeffail/benthos/v3/lib/metrics" "github.com/Jeffail/benthos/v3/lib/types" ) //------------------------------------------------------------------------------ func init()...
lib/input/inproc.go
0.57081
0.447943
inproc.go
starcoder
package utils import ( "io" "unsafe" ) // StreamDataReader reads primitive Golang data types from an underlying reader. // It always advance the read iterator without rewinding it. type StreamDataReader struct { reader io.Reader bytesRead uint32 } // NewStreamDataReader returns a StreamDataReader given an un...
utils/stream_serialization.go
0.802246
0.446012
stream_serialization.go
starcoder
package geometry import ( "encoding/binary" "reflect" "unsafe" ) // IndexKind is the kind of index to use in the options. type IndexKind byte // IndexKind types const ( None IndexKind = iota RTree QuadTree ) func (kind IndexKind) String() string { switch kind { default: return "Unknown" case None: ret...
vendor/github.com/tidwall/geojson/geometry/series.go
0.761006
0.430028
series.go
starcoder
package basic // PMapIONumberPtr is template to generate itself for different combination of data type. func PMapIONumberPtr() string { return ` func TestPmap<FINPUT_TYPE><FOUTPUT_TYPE>Ptr(t *testing.T) { // Test : add 1 to the list var vo2 <OUTPUT_TYPE> = 2 var vo3 <OUTPUT_TYPE> = 3 var vo4 <OUTPUT_TYPE> = 4 v...
internal/template/basic/pmapioptrtest.go
0.532182
0.415314
pmapioptrtest.go
starcoder
package redis type OrderedSet struct { index map[string]bool elements []orderedSetElement } type orderedSetElement struct { score int value []byte } func NewOrderedSet() *OrderedSet { newSet := OrderedSet{ index: map[string]bool{}, elements: []orderedSetElement{}, } return &newSet } func (self *Ord...
ordered_set.go
0.652906
0.413951
ordered_set.go
starcoder
package gnmi import ( "context" "github.com/onosproject/onos-api/go/onos/config/admin" "github.com/onosproject/onos-config/pkg/device" "github.com/onosproject/onos-config/test/utils/gnmi" "github.com/onosproject/onos-config/test/utils/proto" gpb "github.com/openconfig/gnmi/proto/gnmi" "github.com/stretchr/test...
test/gnmi/compactChanges.go
0.511473
0.434281
compactChanges.go
starcoder
package toscalib import ( "fmt" "regexp" "strconv" "strings" ) // This implements the type defined in Appendix A 2 of the definition file // Version - The version have the following grammar: // MajorVersion.MinorVersion[.FixVersion[.Qualifier[-BuildVersion]]] // MajorVersion : is a required integer value greater...
tosca_namespace_alias.go
0.555918
0.491334
tosca_namespace_alias.go
starcoder
package validate import ( "context" "github.com/go-spatial/geom" "github.com/go-spatial/tegola" "github.com/go-spatial/tegola/basic" "github.com/go-spatial/tegola/maths" "github.com/go-spatial/tegola/maths/clip" "github.com/go-spatial/tegola/maths/hitmap" "github.com/go-spatial/tegola/maths/makevalid" ) func...
maths/validate/validate.go
0.517327
0.426859
validate.go
starcoder
package commonDiagnostics // Defines a small cube import ( "go-simulate-a-city/common/commonopengl" "github.com/go-gl/gl/v4.5-core/gl" "github.com/go-gl/mathgl/mgl32" ) // Directly from https://github.com/go-gl/example/blob/master/gl41core-cube/cube.go var cubeVertices = []mgl32.Vec3{ // Bottom mgl32.Vec3{-0.5,...
common/commonDiagnostics/cube.go
0.7696
0.428473
cube.go
starcoder
// Package day22 solves AoC 2021 day 22. package day22 import ( "math" "strconv" "github.com/fis/aoc/glue" ) const inputRegexp = `^(on|off) x=(-?\d+)\.\.(-?\d+),y=(-?\d+)\.\.(-?\d+),z=(-?\d+)\.\.(-?\d+)` func init() { glue.RegisterSolver(2021, 22, glue.RegexpSolver{ Solver: solve, Regexp: inputRegexp, }) ...
2021/day22/day22.go
0.642096
0.441492
day22.go
starcoder
package camt import ( "encoding/xml" "github.com/fairxio/finance-messaging/iso20022" ) type Document02900105 struct { XMLName xml.Name `xml:"urn:iso:std:iso:20022:tech:xsd:camt.029.001.05 Document"` Message *ResolutionOfInvestigationV05 `xml:"RsltnOfInvstgtn"` } func (d *Document02900105) A...
iso20022/camt/ResolutionOfInvestigationV05.go
0.714628
0.503479
ResolutionOfInvestigationV05.go
starcoder
package redblack import ( "fmt" ) type Map[K, V any] interface { Get(key K) (value V, ok bool) Set(key K, value V) Delete(key K) } func New[K, V any](less func(K, K) bool) Map[K, V] { leaf := &node[K, V]{ color: B, } leaf.a = leaf leaf.b = leaf bbleaf := &node[K, V]{ color: BB, } bbleaf.a = leaf bb...
redblack.go
0.589953
0.446676
redblack.go
starcoder
// Package day11 solves AoC 2021 day 11. package day11 import ( "fmt" "math/bits" "github.com/fis/aoc/glue" "github.com/fis/aoc/util" ) func init() { glue.RegisterSolver(2021, 11, glue.LineSolver(solve)) } func solve(lines []string) ([]string, error) { g, err := newGrid(lines) if err != nil { return nil, ...
2021/day11/day11.go
0.504883
0.434101
day11.go
starcoder
package grouper import ( "math/bits" "github.com/tobgu/qframe/internal/column" "github.com/tobgu/qframe/internal/index" "github.com/tobgu/qframe/internal/math/integer" ) /* This package implements a basic hash table used for GroupBy and Distinct operations. Hashing is done using Go runtime memhash, collisions a...
internal/grouper/grouper.go
0.704364
0.425963
grouper.go
starcoder
package github import ( "log" "github.com/jung-kurt/gofpdf" "github.com/tcd/md2pdf/internal/lib" "github.com/tcd/md2pdf/internal/model" ) // Table writes a table to a gofpdf.Fpdf. func Table(f *gofpdf.Fpdf, table model.TableContent) { tableData := mockTable(f, table) if len(tableData.Rows) == 0 { log.Println...
internal/renderers/github/table.go
0.611498
0.42322
table.go
starcoder
package graph import ( "errors" "fmt" "github.com/matematik7/codejam-go-v2/datastructures/intset" "github.com/matematik7/codejam-go-v2/datastructures/queue" "github.com/matematik7/codejam-go-v2/datastructures/slice" "github.com/matematik7/codejam-go-v2/integer" ) type Graph struct { N int OutEdges [][...
datastructures/graph/graph.go
0.574872
0.436502
graph.go
starcoder
package token import "fmt" type Kind int const ( KindLeftParen Kind = iota KindRightParen KindLeftBrace KindRightBrace KindComma KindDot KindMinus KindPlus KindSemicolon KindSlash KindStar KindEqual KindBang KindBangEqual KindEqualEqual KindGreater KindGreaterEqual KindLess KindLessEqual KindId...
glox/token/token.go
0.508056
0.46478
token.go
starcoder
package risk import "fmt" // Risk is the representation of the OWASP risk rating model // See https://www.owasp.org/index.php/OWASP_Risk_Rating_Methodology type Risk struct { SkillLevel, Motive, Opportunity, Size *Value EaseOfDiscovery, EaseOfExploit, Awareness, IntrusionD...
risk/risk.go
0.863852
0.472866
risk.go
starcoder
package light import ( "fmt" "github.com/genelet/sqlproto/xast" "github.com/genelet/sqlproto/xlight" ) func xposTo(x ...interface{}) *xast.Pos { end := 1 if x != nil { end += len(fmt.Sprintf("%v", x[0])) } return &xast.Pos{ Line: 1, Col: int32(end)} } func xposplusTo(x ...interface{}) *xast.Pos { y :=...
light/basic.go
0.572723
0.632262
basic.go
starcoder
package eval import ( "github.com/lyraproj/issue/issue" ) type Namespace string // Identifier TypedName namespaces. Used by a service to identify what the type of entity a loader // will look for. // NsType denotes a type in the Puppet type system const NsType = Namespace(`type`) // NsFunction denotes a c...
eval/typedname.go
0.644673
0.541954
typedname.go
starcoder
package main import ( "bytes" "fmt" "math/big" "os" "github.com/NebulousLabs/Sia/crypto" "github.com/NebulousLabs/Sia/types" ) // adjustTarget returns a target after it has been adjusted. func adjustTarget(initial types.Target, adjustment *big.Rat) types.Target { adjustedRatTarget := new(big.Rat).Mul(initial....
Difficulty Adjustment/main.go
0.646014
0.468851
main.go
starcoder