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 pars type seqParser struct { parsers []Parser } //Seq returns a parser that matches all of its given parsers in order or none of them. func Seq(parsers ...Parser) Parser { return &seqParser{parsers: parsers} } func (s *seqParser) Parse(src *Reader) (interface{}, error) { values := make([]interface{}, len(...
combinators.go
0.882915
0.449091
combinators.go
starcoder
package govote import ( "math/rand" "sort" "time" ) // returns lesser value of a and b func min(a, b int) (r int) { if a < b { r = a } else { r = b } return } // returns greater value of a and b func max(a, b int) (r int) { if a > b { r = a } else { r = b } return } // CPair represents two candid...
util.go
0.732113
0.403244
util.go
starcoder
package z85 import ( "encoding/binary" "errors" "fmt" ) // ErrLength results from encoding or decoding wrongly aligned input data. var ErrLength = errors.New("z85: wrongly aligned input data") // InvalidByteError values describe errors resulting from an invalid byte in a z85 encoded data. type InvalidByteError by...
vendor/github.com/tilinna/z85/z85.go
0.72662
0.432842
z85.go
starcoder
package mystrings import ( "strings" ) // Write a function that reverses a string. The input string is given as an array of characters s. // You must do this by modifying the input array in-place with O(1) extra memory. // Time complexity : O(N) to swap N/2 element. // Space complexity : O(1), it's a constant space ...
algorithmsI/mystrings/mystrings.go
0.779238
0.504211
mystrings.go
starcoder
package graph import ( "container/list" "errors" "sort" ) // Vertex is a vertex for DAG. type Vertex struct { Value interface{} } // DAG is a Directed Acyclic Graph implemented with an adjacency list. type DAG struct { Root *Vertex Adjacency map[*Vertex]*list.List } // NewDAG constructs a new graph with ...
graph/dag.go
0.791378
0.439447
dag.go
starcoder
package Challenge2_Structurally_Unique_Binary_Search_Trees /* Given a number ‘n’, write a function to return all structurally unique Binary Search Trees (BST) that can store values 1 to ‘n’? Input: 2 Output: List containing root nodes of all structurally unique BSTs. Explanation: Here are the 2 structurally unique BS...
Pattern10 - Subsets/Challenge2-Structurally_Unique_Binary_Search_Trees/solution.go
0.880013
0.525125
solution.go
starcoder
package fp import () // FilterString return the values which are matched func FilterString(f func(string, int) bool, input []string) (output []string) { output = make([]string, 0) for idx, data := range input { if f(data, idx) { output = append(output, data) } } return } // FilterInt return the values wh...
functional/filter.go
0.579757
0.449936
filter.go
starcoder
package models import ( i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91 "github.com/microsoft/kiota-abstractions-go/serialization" ) // ApprovalSettings type ApprovalSettings struct { // Stores additional data not described in the OpenAPI description found when deserializing. Can be used fo...
models/approval_settings.go
0.582135
0.413951
approval_settings.go
starcoder
package palette import "image/color" // blendRGBA returns the interpolation between two sRGB colors with // pre-multiplied alpha. func blendRGBA(a, b color.RGBA, x float64) color.RGBA { const linThresh = 5 diff8 := func(a, b uint8) uint8 { if a < b { return b - a } return a - b } if a.A == 255 && b.A ==...
benchplot/vendor/github.com/aclements/go-gg/palette/blend.go
0.715126
0.480296
blend.go
starcoder
package utility import ( "math/rand" "time" ) // ZeroTime represents 0 in epoch time var ZeroTime time.Time = time.Unix(0, 0) // MaxTime represents the latest useful golang date (219248499-12-06 15:30:07.999999999 +0000 UTC) var MaxTime time.Time = time.Unix(1<<63-62135596801, 999999999) // IsZeroTime checks that...
vendor/github.com/evergreen-ci/timber/vendor/github.com/evergreen-ci/utility/time.go
0.831451
0.546557
time.go
starcoder
package eval import ( "errors" "math" // "fmt" "expression-parsing/ast" "expression-parsing/token" ) var variables = make(map[string]float64) func IsIntegral(value float64) bool { return value == float64(int64(value)) } func Evaluate(expr ast.Expression) (float64, error) { if expr == nil { return 0, errors...
eval/eval.go
0.553988
0.485234
eval.go
starcoder
package schema import ( "go/ast" "go/token" "go/types" "github.com/bflad/tfproviderlint/helper/astutils" ) const ( TypeNameCustomizeDiffFunc = `CustomizeDiffFunc` ) // IsFuncTypeCustomizeDiffFunc returns true if the FuncType matches expected parameters and results types func IsFuncTypeCustomizeDiffFunc(node as...
vendor/github.com/bflad/tfproviderlint/helper/terraformtype/helper/schema/type_customizedifffunc.go
0.709221
0.601857
type_customizedifffunc.go
starcoder
package dfl import ( "fmt" "reflect" "strings" "github.com/pkg/errors" ) // Assign is a BinaryOperator which sets the value of the right side to the attribute or variable defined by the left side. type Assign struct { *BinaryOperator } func (a Assign) Dfl(quotes []string, pretty bool, tabs int) string { b :=...
pkg/dfl/Assign.go
0.686685
0.437343
Assign.go
starcoder
package main // Note 1: This product namely Production equipment M0-M9 a total of 10 groups of // storage data groups, each group has a total of 10-10-17 data, of which M0 The // data group is the data group called by default for the products to be powered on. // The data groups M1 and M2 are quickly called out for t...
registers.go
0.599368
0.587914
registers.go
starcoder
package pt import "math" type SphericalHarmonic struct { PositiveMaterial Material NegativeMaterial Material harmonicFunction func(Vector) float64 mesh *Mesh } func NewSphericalHarmonic(l, m int, pm, nm Material) Shape { sh := &SphericalHarmonic{} sh.PositiveMaterial = pm sh.NegativeMaterial = nm ...
pt/sh.go
0.653127
0.614365
sh.go
starcoder
package ent import ( "context" "errors" "fmt" "time" "github.com/empiricaly/recruitment/internal/ent/participant" "github.com/empiricaly/recruitment/internal/ent/participation" "github.com/empiricaly/recruitment/internal/ent/run" "github.com/empiricaly/recruitment/internal/ent/step" "github.com/empiricaly/r...
internal/ent/steprun_create.go
0.562417
0.448849
steprun_create.go
starcoder
package gengo import ( "io" "github.com/ipld/go-ipld-prime/schema" ) func NewGeneratorForKindStruct(t schema.Type) typedNodeGenerator { return generateKindStruct{ t.(schema.TypeStruct), generateKindedRejections_Map{ mungeTypeNodeIdent(t), string(t.Name()), }, } } type generateKindStruct struct { Ty...
schema/gen/go/genKindStruct.go
0.531453
0.423995
genKindStruct.go
starcoder
package hck import ( "io" "golang.org/x/net/html" ) // index retrieves the index of the first matching node. // It returns -1 if no match is found. func index(ns []*Node, m Matcher) int { for i, n := range ns { if m.Match(n) { return i } } return -1 } // splice copies ns, modifies it and retrieves the c...
nodes.go
0.770119
0.404566
nodes.go
starcoder
package delta // LineSource indicates the origin of the solution line. type LineSource string // These are valid values for LineSource. const ( Unknown LineSource = "" LineFromA LineSource = "<" LineFromB LineSource = ">" LineFromBoth LineSource = "=" LineFromBothEdit LineSource = "~" ...
lib/solution.go
0.570451
0.480662
solution.go
starcoder
package processor import ( "context" "fmt" "time" "github.com/benthosdev/benthos/v4/internal/component/metrics" "github.com/benthosdev/benthos/v4/internal/component/processor" "github.com/benthosdev/benthos/v4/internal/docs" "github.com/benthosdev/benthos/v4/internal/interop" "github.com/benthosdev/benthos/v4...
internal/old/processor/resource.go
0.768038
0.419886
resource.go
starcoder
package box2d import ( "fmt" "math" ) /// Distance joint definition. This requires defining an /// anchor point on both bodies and the non-zero length of the /// distance joint. The definition uses local anchor points /// so that the initial configuration can violate the constraint /// slightly. This helps when sav...
DynamicsB2JointDistance.go
0.847527
0.842734
DynamicsB2JointDistance.go
starcoder
package main import ( "fmt" "sync" "time" ) // merge(): a simple function which merge the two slices into one slice func merge(left []int, right []int) []int { result := make([]int, len(left)+len(right)) leftArrayIndex, rightArrayIndex := 0, 0 for resultArrayIndex := 0; resultArrayIndex < len(result); resul...
Go/sort/merge_sort_parallel.go
0.524395
0.544983
merge_sort_parallel.go
starcoder
package geom import ( "fmt" "math" ) type Rect struct { Min, Max Coord } // this rect contains nothing func NilRect() (r Rect) { r.Min.X = math.Inf(1) r.Min.Y = math.Inf(1) r.Max.X = math.Inf(-1) r.Max.Y = math.Inf(-1) return } func (r Rect) Width() float64 { return r.Max.X - r.Min.X } func (r Rect) Heig...
vendor/github.com/skelterjohn/geom/rect.go
0.751739
0.503845
rect.go
starcoder
package grid import ( "github.com/adamcolton/geom/calc/cmpr" "github.com/adamcolton/geom/d2" "github.com/adamcolton/geom/geomerr" ) // Pt is a cell in a grid type Pt struct { X, Y int } // Area always returns a positive value. func (pt Pt) Area() int { a := pt.X * pt.Y if a < 0 { return -a } return a } //...
d2/grid/pt.go
0.877201
0.604019
pt.go
starcoder
package leetcode /* Approach: Using the max area rectangle in skyline approach with a mono stack */ func maximalRectangle(matrix [][]byte) int { R := len(matrix) if R == 0 { return 0 } C := len(matrix[0]) dp := make([][]int, R) for r := 0; r < R; r++ { dp[r] = make([]int, C+1) } for c := 0; c < C; c++ { ...
go/maximal_rectangle.go
0.609989
0.495911
maximal_rectangle.go
starcoder
package som import ( "container/heap" "fmt" "math" "gonum.org/v1/gonum/mat" ) // Metric is distance metric type Metric int const ( // Euclidean metric Euclidean Metric = iota ) // Distance calculates given metric distance between vectors a and b and returns it. // If unsupported metric is requested it return...
som/distance.go
0.834811
0.565359
distance.go
starcoder
package tilecover import ( "fmt" "log" "github.com/paulmach/orb" "github.com/paulmach/orb/maptile" ) // Geometry returns the covering set of tiles for the given geometry. func Geometry(g orb.Geometry, z maptile.Zoom) maptile.Set { if g == nil { return nil } switch g := g.(type) { case orb.Point: return ...
maptile/tilecover/helpers.go
0.720172
0.545528
helpers.go
starcoder
package elastic import ( "math" "github.com/unchartedsoftware/veldt" "github.com/unchartedsoftware/veldt/binning" "github.com/unchartedsoftware/veldt/util/json" ) // BinnedTopHits represents an elasticsearch implementation of the binned top // hits tile. type BinnedTopHits struct { Elastic Bivariate TopHits }...
generation/elastic/binned_top_hits.go
0.78469
0.402157
binned_top_hits.go
starcoder
package neural import ( "fmt" "math" "math/rand" ) // Hidden or output layer of a neural network type Layer struct { Nodes []*Node Inputs []float64 } type Learner interface { Learn(outputs, targets []float64) } // Defines the feed forward neural network // Layers includes all hidden layers + the output layer...
network.go
0.837055
0.712895
network.go
starcoder
package ondatra import ( opb "github.com/openconfig/ondatra/proto" ) const ( maxFlowLabel uint32 = (1 << 20) - 1 maxPort uint32 = (1 << 16) - 1 ) // UIntRange is a range of unsigned integers. type UIntRange struct { pb *opb.UIntRange } // WithMin sets the minimum value of the range. func (r *UIntRange) Wi...
range.go
0.826502
0.594257
range.go
starcoder
package sketchy import ( "github.com/tdewolff/canvas" ) const defaultCapacity = 4 type QuadTree struct { capacity int points []IndexPoint boundary Rect nw *QuadTree ne *QuadTree se *QuadTree sw *QuadTree } func NewQuadTree(r Rect) *QuadTree { return &QuadTree{ capacity: defaultCapacity, boundary: r,...
quadtree.go
0.743354
0.409693
quadtree.go
starcoder
package exec import ( "reflect" ) //Tracker abstraction to track mutation type Tracker struct { init []uint64 Mutation []uint64 Nested []*Tracker } //Set sets mutation for filed pos func (t *Tracker) Set(pos []uint16) { Uint64s(t.Mutation).SetBit(int(pos[0])) if len(pos) > 1 { t.Nested[pos[0]].Set(po...
exec/tracker.go
0.599133
0.42054
tracker.go
starcoder
package marker import ( "fmt" "regexp" "sort" "strings" ) // MatcherFunc returns a Match which contains information about found patterns type MatcherFunc func(string) Match // Match contains information about found patterns by MatcherFunc type Match struct { Template string Patterns []string } // MatchAll cre...
matcher.go
0.730578
0.416263
matcher.go
starcoder
package main import ( "fmt" "math" ) // cFunc for continuous function. A type definition for convenience. type cFunc func(float64) float64 func main() { fmt.Println("integral:", glq(math.Exp, -3, 3, 5)) } // glq integrates f from a to b by Guass-Legendre quadrature using n nodes. // For the task, it al...
lang/Go/numerical-integration-gauss-legendre-quadrature.go
0.808105
0.592519
numerical-integration-gauss-legendre-quadrature.go
starcoder
package d3 import ( "math" "strconv" "strings" "github.com/adamcolton/geom/angle" "github.com/adamcolton/geom/calc/cmpr" ) // Q is a quaternion used for rotations. B, C and D correspond to the X, Y and Z // axis. type Q struct { A, B, C, D float64 } // QX returns Q rotated around the X axis. func QX(ang angle...
d3/q.go
0.785473
0.677773
q.go
starcoder
package main import ( "flag" "fmt" "os" ) // Parameters is a collection of all program parameters. type Parameters struct { TTName string // Name of the input truth-table file MinQ float64 // Minimum quadratic coefficient MaxQ float64 // Maximum quadratic coeff...
params.go
0.633977
0.446495
params.go
starcoder
package fp // MergeInt takes two inputs: map[int]int and map[int]int and merge two maps and returns a new map[int]int. func MergeInt(map1, map2 map[int]int) map[int]int { if map1 == nil && map2 == nil { return map[int]int{} } newMap := make(map[int]int) if map1 == nil { for k, v := range map2 { newMap[k] ...
fp/merge.go
0.715623
0.555556
merge.go
starcoder
// Package sqlserver handles schema and data migrations from sqlserver. package sqlserver import ( "github.com/cloudspannerecosystem/harbourbridge/common/constants" "github.com/cloudspannerecosystem/harbourbridge/internal" "github.com/cloudspannerecosystem/harbourbridge/schema" "github.com/cloudspannerecosystem/h...
sources/sqlserver/toddl.go
0.631708
0.419291
toddl.go
starcoder
package pe import ( "github.com/gonum/matrix/mat64" "github.com/volkerp/goquadtree/quadtree" ) /* entity.go by <NAME> Structure and functionality of an entity. */ //Entity Constants const ( ShapeCircle int = 0 ShapeRectangle int = 1 ) //Entity -: Data structure containing Physics data. type Entity struc...
entity.go
0.737253
0.699383
entity.go
starcoder
package p384 import ( "crypto/elliptic" "crypto/subtle" "math/big" "github.com/cloudflare/circl/math" ) // Curve is used to provide the extended functionality and performance of // elliptic.Curve interface. type Curve interface { elliptic.Curve // IsAtInfinity returns True is the point is the identity point. ...
ecc/p384/p384.go
0.817465
0.541651
p384.go
starcoder
package share import ( "math/big" "github.com/henrycg/prio/utils" ) // Compressed representation of secret-shared data. type PRGHints struct { Key utils.PRGKey Delta []*big.Int } // A server uses a ReplayPRG to recover the shared values // that the client sent it (in the form of a PRGHints struct). type Repla...
share/prg.go
0.717705
0.453564
prg.go
starcoder
package f32 import ( "context" "log" "reflect" ) func init() { RegisterMatrix(reflect.TypeOf((*SparseVector)(nil)).Elem()) } // SparseVector compressed storage by indices type SparseVector struct { l int // length of the sparse vector values []float32 indices []int } // NewSparseVector returns a Spar...
f32/sparseVector.go
0.800068
0.640917
sparseVector.go
starcoder
package template import ( "fmt" "strings" ) // Data is the template data used to render the Moq template. type Data struct { PkgName string Mocks []MockData StubImpl bool SyncPkg string } // MockData is the data used to generate a mock for some interface. type MockData struct { InterfaceName string Mock...
internal/forked/github.com/matryer/moq/template/template_data.go
0.655336
0.420719
template_data.go
starcoder
package tune // Channels represents the available channels keyed by station // and channel identifier. var Channels = map[string]map[int]*Channel{ "classicalradio.com": map[int]*Channel{ 373: {"Classical Relaxation", "http://listen.classicalradio.com/premium_high/classicalrelaxation.pls"}, 372: {"Classical Piano...
channels.go
0.541651
0.498352
channels.go
starcoder
package agg import ( "fmt" "math" "github.com/emer/etable/etable" ) // QuantilesIdx returns the given quantile(s) of non-Null, non-NaN elements in given // IdxView indexed view of an etable.Table, for given column index. // Column must be a 1d Column -- returns nil for n-dimensional columns. // qs are 0-1 values...
agg/quantiles.go
0.723895
0.423339
quantiles.go
starcoder
package proc import ( "fmt" "math" "github.com/akualab/dsp" narray "github.com/akualab/narray/na64" ) const defaultBufSize = 1000 // Value is an multidimensional array that satisfies the framer interface. type Value *narray.NArray // Scale returns a scaled vector. func Scale(alpha float64) dsp.Processer { re...
proc/proc.go
0.729809
0.461563
proc.go
starcoder
package main import "fmt" const ( RED = 0 BLACK = 1 ) type interval struct { low int high int } type i_node struct { i interval m int color int parent *i_node left_child *i_node right_child *i_node } type i_tree struct { root_node *i_node size int } var nil_node = __nil_node() ...
interval_tree.go
0.58059
0.486332
interval_tree.go
starcoder
package msgpack import ( "bytes" "fmt" "io" "math" "sync" "time" "github.com/segmentio/objconv/objutil" ) // Emitter implements a MessagePack emitter that satisfies the objconv.Emitter // interface. type Emitter struct { w io.Writer b [240]byte // This stack is used to cache arrays that are emitted in str...
msgpack/emit.go
0.678007
0.45744
emit.go
starcoder
package main import ( "errors" "math" "sort" onlinestats "github.com/dgryski/go-onlinestats" "github.com/montanaflynn/stats" ) type rank struct { X float64 Y float64 Xrank float64 Yrank float64 } type Float64Data []float64 func (f Float64Data) Len() int { return len(f) } func (f Float64Data) Get(...
correlation.go
0.569613
0.414662
correlation.go
starcoder
package math func SumInt(x, y int) int { return x + y } func SumInt8(x, y int8) int16 { return int16(x) + int16(y) } func SumInt16(x, y int16) int32 { return int32(x) + int32(y) } func SumInt32(x, y int32) int64 { return int64(x) + int64(y) } func SumInt64(x, y int64) int64 { return x + y } func SumUint(x, ...
math/sum.go
0.683314
0.540924
sum.go
starcoder
package style import ( "RenG/src/config" "RenG/src/core" "RenG/src/lang/ast" "RenG/src/lang/evaluator" "RenG/src/lang/object" "fmt" "strconv" ) func StyleEval(node ast.Node, texture *core.SDL_Texture, env *object.Environment) object.Object { switch node := node.(type) { case *ast.BlockStatement: return eva...
src/reng/style/eval.go
0.525369
0.472257
eval.go
starcoder
package main import "fmt" // A representation of the state of the game type position struct { boatOnWestBank bool // true is west bank, false is east bank westMissionaries int // west bank missionaries westCannibals int // west bank cannibals eastMissionaries int // east bank missionaries eastCannibals ...
missionaries.go
0.602529
0.437343
missionaries.go
starcoder
package main import ( "math" "github.com/skandragon/dysonsphere/internal/cs" "github.com/skandragon/dysonsphere/internal/cs/mathf" "github.com/skandragon/dysonsphere/types" ) // StarData holds all the statistics for a single star. type StarData struct { Index int32 `json:"index"` Leve...
cmd/parsefile/stargen.go
0.604983
0.447521
stargen.go
starcoder
package twistededwards import ( "math/big" "github.com/consensys/gnark/backend" "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*x^...
std/algebra/twistededwards/point.go
0.82478
0.462534
point.go
starcoder
package point import ( "adventofcode2021/pkg/strutil" "fmt" "strings" ) //go:generate go run ../gen/main.go -pkgName=point -typeName=Point -output=rotate.go type Point struct { X, Y, Z int } func Parse(input string) Point { s := strings.Split(input, ",") if len(s) != 3 { panic(fmt.Sprintf("Should 3 integers...
day19/point/point.go
0.547222
0.436262
point.go
starcoder
package main import ( "fmt" "math" "strings" ) /** --- Day 5: Binary Boarding --- You board your plane only to discover a new problem: you dropped your boarding pass! You aren't sure which seat is yours, and all of the flight attendants are busy with the flood of people that suddenly made it through passport cont...
day05.go
0.697094
0.69643
day05.go
starcoder
package bta import ( "go/types" "log" ) // Point represents a subject of control flow. type Point interface { Next() []Point Defs() types.Object Uses() []types.Object CouldBeTrue(d Division) bool } // Division describes the known-ness of a set of variables. type Division map[types.Object]bool // Graph stores ...
bta/bta.go
0.662469
0.501404
bta.go
starcoder
// Task // In your choice of programming language, write a function that finds all customers who share all of their accounts. // Example // The following example indicates which customers own which accounts. For instance, the customer with id 1 owns the account with id 10 and the account with id 11. // Cust Account ...
AccountCust.go
0.537041
0.477006
AccountCust.go
starcoder
package godash import ( "errors" "reflect" ) // FindBy returns the first element of the slice that the provided validator function returns true for. // The supplied function must accept an interface{} parameter and return bool. // If the validator function does not return true for any values in the slice, nil is re...
find.go
0.805096
0.413655
find.go
starcoder
package pow import ( "encoding/binary" "math" "github.com/DanielKrawisz/bmutil/hash" ) // CalculateTarget calculates the target POW value. payloadLength includes the // full length of the payload (inluding the width of the initial nonce field). // ttl is the time difference (in seconds) between ExpiresTime and t...
pow/pow.go
0.719482
0.496948
pow.go
starcoder
package objects import ( "github.com/ArcCS/Nevermore/permissions" "strings" "sync" ) type CharInventory struct { ParentId int Contents []*Character sync.Mutex Flags map[string]bool } // New CharInventory returns a new basic CharInventory structure func NewCharInventory(roomID int, o ...*Character) *CharInvent...
objects/char_inventory.go
0.559771
0.421492
char_inventory.go
starcoder
package util // Histogram represents an approximate distribution of some variable. type Histogram interface { // Returns an approximation of the given percentile of the distribution. // Note: the argument passed to Percentile() is a number between // 0 and 1. For example 0.5 corresponds to the median and 0.9 to the...
vertical-pod-autoscaler/recommender/util/histogram.go
0.920397
0.811751
histogram.go
starcoder
package starkex import ( "bytes" "crypto/hmac" "hash" "math/big" ) // rfc6979 implemented in Golang. // copy from https://raw.githubusercontent.com/codahale/rfc6979/master/rfc6979.go /* Package rfc6979 is an implementation of RFC 6979's deterministic DSA. Such signatures are compatible with standard Digital Si...
math_rfc6979.go
0.672869
0.507629
math_rfc6979.go
starcoder
Package dataplane implements packet send/receive functions */ package dataplane import ( "github.com/opennetworkinglab/testvectors-runner/pkg/logger" pm "github.com/stratum/testvectors/proto/portmap" ) var log = logger.NewLogger() // Match is used by verify type Match uint8 // Match values for verify const ( Exa...
pkg/framework/dataplane/dataplane_oper.go
0.694303
0.490968
dataplane_oper.go
starcoder
package openapi import ( "encoding/json" "fmt" "net/url" "strings" "time" ) // Optional parameters for the method 'FetchWorkflowStatistics' type FetchWorkflowStatisticsParams struct { // Only calculate statistics since this many minutes in the past. The default 15 minutes. This is helpful for displaying stati...
rest/taskrouter/v1/workspaces_workflows_statistics.go
0.79653
0.411939
workspaces_workflows_statistics.go
starcoder
package iso20022 // Chain of parties involved in the settlement of a transaction, including receipts and deliveries, book transfers, treasury deals, or other activities, resulting in the movement of a security or amount of money from one account to another. type ReceivingPartiesAndAccount14 struct { // Party that ac...
ReceivingPartiesAndAccount14.go
0.687
0.427337
ReceivingPartiesAndAccount14.go
starcoder
package yasup import ( crypto "crypto/rand" "math/big" "math/rand" ) var zeroValueUint64 uint64 //Uint64Insert will append elem at the position i. Might return ErrIndexOutOfBounds. func Uint64Insert(sl *[]uint64, elem uint64, i int) error { if i < 0 || i > len(*sl) { return ErrIndexOutOfBounds } *sl = appen...
uint64Slices.go
0.650245
0.416025
uint64Slices.go
starcoder
package storetest import ( "testing" "github.com/stretchr/testify/assert" "github.com/uni-x/mattermost-server/model" "github.com/uni-x/mattermost-server/store" ) func TestRoleStore(t *testing.T, ss store.Store) { t.Run("Save", func(t *testing.T) { testRoleStoreSave(t, ss) }) t.Run("Get", func(t *testing.T) {...
store/storetest/role_store.go
0.594316
0.643609
role_store.go
starcoder
package msgoraph // Bool is a helper routine that allocates a new bool value // to store v and returns a pointer to it. func Bool(v bool) *bool { return &v } // BoolValue returns the value of the bool pointer passed in or // false if the pointer is nil. func BoolValue(v *bool) bool { if v != nil { return *v } re...
msgraph.go
0.828176
0.431285
msgraph.go
starcoder
package sql import ( "reflect" "strings" "gopkg.in/src-d/go-errors.v1" ) var ( // ErrUnexpectedType is thrown when a received type is not the expected ErrUnexpectedType = errors.NewKind("value at %d has unexpected type: %s") ) // Schema is the definition of a table. type Schema []*Column // CheckRow checks t...
sql/schema.go
0.711932
0.46557
schema.go
starcoder
package gokmeans import ( "math/rand" "time" ) // Node represents an observation of floating point values type Node []float64 // Train takes an array of Nodes (observations), and produces as many centroids as specified by // clusterCount. It will stop adjusting centroids after maxRounds is reached. If there are le...
gokmeans.go
0.801081
0.600013
gokmeans.go
starcoder
package routertestsuite import ( "bytes" "encoding/json" "errors" "io/ioutil" "net/http" "net/http/httptest" "net/url" "strings" "testing" "github.com/ambientkit/ambient" "github.com/stretchr/testify/assert" ) // TestSuite performs standard tests. type TestSuite struct{} // New returns a router test suit...
pkg/routertestsuite/routertestsuite.go
0.586878
0.431225
routertestsuite.go
starcoder
package renderer import ( "reflect" "github.com/go-gl/gl/v4.6-core/gl" ) type shaderDataType int const ( ShaderDataTypeFloat32 shaderDataType = iota ShaderDataTypeInt32 ShaderDataTypeUint32 ShaderDataTypeBool ) func (dataType shaderDataType) size() uint32 { switch dataType { case ShaderDataTypeFloat32: r...
renderer/vertexBuffer.go
0.635109
0.462412
vertexBuffer.go
starcoder
package example import ( "image" "time" "github.com/DrJosh9000/ichigo/engine" "github.com/DrJosh9000/ichigo/geom" ) // Level1 creates the level_1 scene. func Level1() *engine.Scene { return &engine.Scene{ ID: "level_1", Bounds: engine.Bounds(image.Rect(-32, -32, 320+32, 240+32)), Child: engine.MakeCon...
example/level1.go
0.514156
0.521167
level1.go
starcoder
package assertion import ( "fmt" "reflect" "github.com/cloudfoundry/bosh-init/internal/github.com/onsi/gomega/types" ) type Assertion struct { actualInput interface{} fail types.GomegaFailHandler offset int extra []interface{} } func New(actualInput interface{}, fail types.GomegaFailHandler...
internal/github.com/onsi/gomega/internal/assertion/assertion.go
0.663996
0.461381
assertion.go
starcoder
package vile import ( "bytes" ) /* * The good example of "rest" is JavaScript * JavaScript e.g * const sum = (...num) => { console.log(num.reduce((previous, current) => { return previous + current })) } sum(1, 2, 3, 4, 5) * */ // Cons - create a new list consisting of the fir...
src/list.go
0.536313
0.471527
list.go
starcoder
package rng import ( "fmt" "math" ) // GammaGenerator is a random number generator for gamma distribution. // The zero value is invalid, use NewGammaGenerator to create a generator type GammaGenerator struct { uniform *UniformGenerator } // NewGammaGenerator returns a gamma distribution generator // it is recomme...
vendor/github.com/leesper/go_rng/gamma.go
0.774114
0.456834
gamma.go
starcoder
package tokenattributes import ( "fmt" "github.com/jtejido/golucene/core/util" ) /* Determines the position of this token relative to the previous Token in a TokenStream, used in phrase searching. The default value is one. Some common uses for this are: - Set it to zero to put multiple terms in the same positio...
core/analysis/tokenattributes/position.go
0.762778
0.40928
position.go
starcoder
package sqinn // value types, same as in sqinn/src/handler.h // Value types for binding query parameters and retrieving column values. const ( // ValNull represents the NULL value (Go nil) ValNull byte = 0 // ValInt represents a Go int ValInt byte = 1 // ValInt64 represents a Go int64 ValInt64 byte = 2 // ...
sqinn/values.go
0.833155
0.46794
values.go
starcoder
package shape import "github.com/gregoryv/draw/xy" // Aligner type aligns multiple shapes type Aligner struct{} // HAlignCenter aligns shape[1:] to shape[0] center coordinates horizontally func (Aligner) HAlignCenter(shapes ...Shape) { hAlign(Center, shapes...) } // HAlignTop aligns shape[1:] to shape[0] top coordi...
shape/align.go
0.645343
0.589628
align.go
starcoder
package core import ( "bytes" "errors" "log" "math" "os/exec" "strconv" "strings" ) // ScriptSimilarityEstimator utilizes a script to analyze the data based on some external // algorithm and utilizes various norms to measure the differences between the // analysis outputs. type ScriptSimilarityEstimator struct...
core/similarityscript.go
0.634656
0.472927
similarityscript.go
starcoder
package models import ( "fmt" "strings" "time" "entgo.io/ent/dialect/sql" "github.com/adnaan/authn/models/session" ) // Session is the model entity for the Session schema. type Session struct { config `json:"-"` // ID of the ent. ID string `json:"id,omitempty"` // Data holds the value of the "data" field. ...
models/session.go
0.631367
0.404978
session.go
starcoder
package maze import "math/rand" const numNeighbors = 4 // Cell is a cell in a maze. type Cell struct { Row, Col int North, South, East, West *Cell links map[*Cell]bool } // NewCell returns a new Cell put in (row, col). func NewCell(row, col int) *Cell { return &Cell{ Row: ...
go/maze/cell.go
0.80213
0.450843
cell.go
starcoder
package vips // #cgo pkg-config: vips // #include "bridge.h" import "C" import ( "bytes" "errors" "io" "io/ioutil" "math" "os" ) // InputParams are options when importing an image from file or buffer type InputParams struct { Reader io.Reader Image *ImageRef } // TransformParams are parameters for the tran...
pkg/vips/transform.go
0.747063
0.413536
transform.go
starcoder
package dates import ( "math" "time" ) // DateFormat represents the parsing format for a date string // TimeFormat represents the parsing format for a time string // DateTimeFormat represents the parsing format for a date time string const ( DateFormat = "2006-01-02" TimeFormat = "15:04:05" DateTimeForma...
dates.go
0.890889
0.555978
dates.go
starcoder
package dst // Geometric distribution (type 0). // The probability distribution of the number Y = X − 1 of failures before the first success, supported on the set { 0, 1, 2, 3, ... } // Parameters: // ρ ∈ (0, 1] probability of success in each trial // Support: // k ∈ {0, ... , n} // GeometricPMF returns the PMF o...
dst/geom0.go
0.894083
0.816553
geom0.go
starcoder
package txtproc import ( "context" "github.com/opentracing/opentracing-go" ) // BadWordsData is a struct to map what data to be compared, replaced to what // and other information you want to carry for example the primary key, etc. type ReplacerData struct { StringToCompare string StringReplacement string } /...
replacer_data.go
0.808105
0.410815
replacer_data.go
starcoder
package ekliptic import ( "crypto/elliptic" "math/big" ) // Curve satisfies crypto/elliptic.Curve using the secp256k1 curve paramters. type Curve struct { params *elliptic.CurveParams } // Params returns the parameters for the curve. Satisfies elliptic.Curve. func (c *Curve) Params() *elliptic.CurveParams { if c...
curve.go
0.81309
0.541894
curve.go
starcoder
package main import ( "math" "github.com/seqsense/pcgol/mat" "github.com/seqsense/pcgol/pc" ) const ( selectBitmaskCropped = 0x00000001 selectBitmaskSelected = 0x00000002 selectBitmaskNearCursor = 0x00000004 selectBitmaskOnScreen = 0x00000008 selectBitmaskExclude = 0x800000...
select.go
0.575469
0.424293
select.go
starcoder
package aoc2015 /* The elves are running low on wrapping paper, and so they need to submit an order for more. They have a list of the dimensions (length l, width w, and height h) of each present, and only want to order exactly as much as they need. Fortunately, every present is a box (a perfect right rectangular pris...
app/aoc2015/aoc2015_02.go
0.712632
0.690063
aoc2015_02.go
starcoder
package bloomfilter import ( "hash/fnv" "math" "github.com/russmack/bitarray-go" ) // Hash32Fn is a function type for 32 bit hashing functions. type Hash32Fn func(string) uint32 // BloomFilter is the public struct. type BloomFilter struct { filter *bitarraygo.BitArray size uint32 hashFuncs []...
bloomfilter.go
0.563858
0.45847
bloomfilter.go
starcoder
package bitesized import ( "math" "time" "github.com/jinzhu/now" ) // Interval define which time intervals to track events. Ex: `Month` interval // turns on bit for that user in the specified month's bit array. Multiple // intervals can be selected. type Interval int const ( All Interval = iota TenMinutes Thi...
interval.go
0.798423
0.444685
interval.go
starcoder
package tuple2 import "fmt" // T2 is a tuple of two elements. type T2[A, B any] struct { T A V B } // T3 is a tuple of three elements. type T3[A, B, C any] struct { T T2[A, B] V C } // T4 is a tuple of four elements. type T4[A, B, C, D any] struct { T T3[A, B, C] V D } // New2 returns a new T2. func New2[A, ...
tuple2/tuple.go
0.755727
0.746231
tuple.go
starcoder
package sort import "github.com/nickelchen/gorithms/tree" func QuickSort(numbers []int) { // worst: O(N^2); best: O(NlogN) if len(numbers) <= 1 { return } pivot := numbers[0] head, tail := 0, len(numbers)-1 i := 1 for i <= tail { if numbers[i] > pivot { numbers[i], numbers[tail] = numbers[tail], numbers...
sort/sort.go
0.563618
0.41324
sort.go
starcoder
package interp import ( "math" "encoding/gob" "github.com/ungerik/go3d/float64/bezier2" "github.com/ungerik/go3d/float64/vec2" ) func init() { gob.Register(Lerp{}) gob.Register(Bezier{}) gob.Register(Equation{}) gob.Register(SinFunc{}) } var Linear *Lerp = &Lerp{} var EaseOut *Bezier = &Bezier{ bezier2.T{...
interp/interp.go
0.790773
0.438424
interp.go
starcoder
package promql import ( "fmt" "math" "strings" "github.com/VictoriaMetrics/VictoriaMetrics/lib/logger" "github.com/VictoriaMetrics/VictoriaMetrics/lib/storage" "github.com/VictoriaMetrics/metricsql" "github.com/VictoriaMetrics/metricsql/binaryop" ) var binaryOpFuncs = map[string]binaryOpFunc{ "+": newBinaryO...
app/vmselect/promql/binary_op.go
0.542621
0.414543
binary_op.go
starcoder
package terrain import ( "sync" "time" perlin "github.com/aquilax/go-perlin" "github.com/brandonnelson3/GoRender/gfx" "github.com/brandonnelson3/GoRender/gfx/shaders" "github.com/go-gl/gl/v4.5-core/gl" "github.com/go-gl/mathgl/mgl32" ) const ( cellsize = int32(128) cellsizep1 = cellsize + 1 cellsizep...
terrain/terrain.go
0.60743
0.400163
terrain.go
starcoder
package neuro import ( "math" "math/rand" ) type Node struct { Weights []float64 Bias float64 } type Layer struct { Nodes []Node } type Network struct { Layers []Layer } func Sigmoid(t float64) float64 { return (1 / (1 + math.Exp(-t))) } func (n *Node) Calculate(inputs ...float64) float64 { newVal := n...
neuro.go
0.553505
0.409634
neuro.go
starcoder
package operators import ( "context" "github.com/MontFerret/ferret/pkg/runtime/core" "github.com/MontFerret/ferret/pkg/runtime/values" ) type ( OperatorFunc func(left, right core.Value) core.Value baseOperator struct { src core.SourceMap left core.Expression right core.Expression } ) func (operator *b...
pkg/runtime/expressions/operators/operator.go
0.734501
0.619299
operator.go
starcoder
package etensor // Prjn2DShape returns the size of a 2D projection of the given tensor Shape, // collapsing higher dimensions down to 2D (and 1D up to 2D). // For any odd number of dimensions, the remaining outer-most dimension // can either be multipliexed across the row or column, given the oddRow arg. // Even mult...
etensor/prjn2d.go
0.663778
0.844216
prjn2d.go
starcoder