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 path import ( "math" "math/rand" "time" "github.com/Windowsfreak/go-mc/bot/world" "github.com/Windowsfreak/go-mc/data/block" "github.com/beefsack/go-astar" ) // Point represents a point in 3D space. type Point struct { X, Y, Z float64 } type V3 struct { X, Y, Z int } func (v V3) Cost(other V3) floa...
bot/path/path.go
0.668339
0.476336
path.go
starcoder
package stats import ( "fmt" "runtime" "strings" "sync/atomic" hist "github.com/samaritan-proxy/circonusllhist" ) // the default value is enough is most scenarios. var ( defaultSupportedQuantiles = []float64{ 0.0, 0.25, 0.5, 0.9, 0.95, 0.99, 1.0, } defaultSupportedBuckets = []float64{ 0.5, 1, 5, 10, 25, ...
histogram.go
0.708213
0.469459
histogram.go
starcoder
package simulation import ( . "github.com/openthread/ot-ns/types" "github.com/openthread/ot-ns/visualize" "github.com/pkg/errors" "github.com/simonlingoogle/go-simplelogger" ) type simulationController struct { sim *Simulation } func (sc *simulationController) CtrlSetSpeed(speed float64) error { sim := sc.sim...
simulation/simulationController.go
0.575707
0.413596
simulationController.go
starcoder
package tsm1 /* A TSM file is composed for four sections: header, blocks, index and the footer. ┌────────┬────────────────────────────────────┬─────────────┬──────────────┐ │ Header │ Blocks │ Index │ Footer │ │5 bytes │ N bytes │ N bytes │ 4 by...
Beam/go/vendor/github.com/influxdata/influxdb/tsdb/engine/tsm1/writer.go
0.679817
0.751853
writer.go
starcoder
package ride import ( "encoding/binary" "math/big" "strconv" "github.com/ericlagergren/decimal" "github.com/pkg/errors" "github.com/wavesplatform/gowaves/pkg/ride/math" ) func intArg(args []rideType) (rideInt, error) { if len(args) != 1 { return 0, errors.Errorf("%d is invalid number of arguments, expected ...
pkg/ride/functions_int.go
0.551574
0.445891
functions_int.go
starcoder
package onshape import ( "encoding/json" ) // BTPStatementBlock271AllOf struct for BTPStatementBlock271AllOf type BTPStatementBlock271AllOf struct { BtType *string `json:"btType,omitempty"` SpaceAfterOpen *BTPSpace10 `json:"spaceAfterOpen,omitempty"` } // NewBTPStatementBlock271AllOf instantiates a new BTPStateme...
onshape/model_btp_statement_block_271_all_of.go
0.675658
0.459561
model_btp_statement_block_271_all_of.go
starcoder
package assert import ( "bytes" "fmt" "strings" "text/tabwriter" "unicode" "github.com/google/gapid/core/data/compare" ) type ( // Level is used to control what output level is used when flushing assertion text. level int // Assertion is the type for the start of an assertion line. // You construct an as...
core/assert/assertion.go
0.640299
0.438665
assertion.go
starcoder
package matrixexp import ( "github.com/gonum/blas/blas64" ) // Add represents matrix addition. type Add struct { Left MatrixExp Right MatrixExp } // String implements the Stringer interface. func (m1 *Add) String() string { return m1.Left.String() + ".Add(" + m1.Right.String() + ")" } // Dims returns the matr...
add.go
0.902307
0.517144
add.go
starcoder
package secp256k1 import ( "crypto/elliptic" "math/big" "sync" ) var ( initonce sync.Once secp256k1 *secp256k1Curve three = new(big.Int).SetUint64(3) ) type secp256k1Curve struct { elliptic.CurveParams } func initSECP256K1() { // http://www.secg.org/sec2-v2.pdf secp256k1 = &secp256k1Curve{elliptic.Cu...
xcrypto/secp256k1/secp256k1.go
0.697609
0.417568
secp256k1.go
starcoder
package parser import ( "fmt" "github.com/authzed/spicedb/pkg/schemadsl/dslshape" "github.com/authzed/spicedb/pkg/schemadsl/input" "github.com/authzed/spicedb/pkg/schemadsl/lexer" ) // AstNode defines an interface for working with nodes created by this parser. type AstNode interface { // Connect connects this A...
pkg/schemadsl/parser/parser_impl.go
0.720467
0.572065
parser_impl.go
starcoder
package typesutil import ( "reflect" ) func FromRType(rtype reflect.Type) *RType { return &RType{ Type: rtype, } } type RType struct { reflect.Type } func (rtype *RType) Method(i int) Method { return &RMethod{Method: rtype.Type.Method(i)} } func (rtype *RType) MethodByName(name string) (Method, bool) { if ...
typesutil/rtype.go
0.667473
0.462594
rtype.go
starcoder
package main var openapi = `{ "openapi": "3.0.2", "info": { "description": "This is the SpaceApi Validator api", "version": "1.2.0", "title": "SpaceApi Validator" }, "servers": [ { "url": "https://validator.spaceapi.io", "description": "The SpaceApi Validator Service" } ], "...
openapi.go
0.722429
0.440529
openapi.go
starcoder
package lexer import ( "bytes" "fmt" "unicode" ) //LexemeType represents both a class and a lexer state type LexemeType = int const ( //unspecified is the default token type unspecified LexemeType = iota //identifier starts with an alphabetic character identifier LexemeType = iota //leftSeparator is a sequen...
lexer/lexer.go
0.535584
0.434581
lexer.go
starcoder
package storagehosttree import ( "github.com/DxChainNetwork/godx/storage" ) // node defines the storage host tree node type node struct { parent *node left *node right *node // count includes the amount of storage hosts including the sum of all its' children // and the node itself count int // indicates...
storage/storageclient/storagehosttree/node.go
0.7011
0.526586
node.go
starcoder
package dsp import "math" // Linear interpolates using linear interpolation. func Linear(samples []float64, x float64) float64 { var samp float64 low := math.Floor(x) lowInt := int(low) if lowInt < len(samples) { lowValue := samples[lowInt] highValue := lowValue if i := lowInt + 1; i >= len(samples) { hi...
dsp/interpolate.go
0.679923
0.546375
interpolate.go
starcoder
package gaia import ( "fmt" "github.com/globalsign/mgo/bson" "github.com/mitchellh/copystructure" "go.aporeto.io/elemental" ) // NamespaceTypeIdentity represents the Identity of the object. var NamespaceTypeIdentity = elemental.Identity{ Name: "namespacetype", Category: "namespacetypes", Package: "squall...
namespacetype.go
0.81626
0.482734
namespacetype.go
starcoder
package jwe import "github.com/urfave/cli" // Command returns the jwe subcommand. func Command() cli.Command { return cli.Command{ Name: "jwe", Usage: "encrypt and decrypt data and keys using JSON Web Encryption (JWE)", UsageText: "step crypto jwe <subcommand> [arguments] [global-flags] [subcommand-fl...
command/crypto/jwe/jwe.go
0.789923
0.424293
jwe.go
starcoder
package lua import ( "fmt" "math" ) // Implementation of tables (aka arrays, objects, or hash tables). Tables keep // its elements in two parts: an array part and a hash part. Non-negative integer // keys are all candidates to be kept in the array part. The actual size of the // array is the largest 'n' such that m...
lua/table.go
0.619356
0.567637
table.go
starcoder
package main import ( "bufio" "fmt" "sort" "strings" ) const n = 40 type countsMap map[byte]int func (m countsMap) merge(m2 countsMap) { for b, c := range m2 { m[b] += c } } func (m countsMap) toCounts() counts { cc := make(counts, 0, len(m)) for b, c := range m { cc = append(cc, count{ b: b, c: ...
2021/14/main.go
0.536313
0.441673
main.go
starcoder
package types import ( "log" "github.com/golang/geo/s2" "github.com/twpayne/go-geom" "github.com/dgraph-io/dgraph/x" ) func parentCoverTokens(parents s2.CellUnion, cover s2.CellUnion) []string { // We index parents and cover using different prefix, that makes it more // performant at query time to only look u...
types/s2index.go
0.777046
0.5794
s2index.go
starcoder
package endpoints import ( "strings" ) // Lookup returns the endpoint for the given service in the given region plus // any overrides for the service name and region. func Lookup(service, region string) (uri, newService, newRegion string) { switch service { case "cloudfront": if !strings.HasPrefix(region, "cn-...
service/endpoints/endpoints.go
0.690559
0.484197
endpoints.go
starcoder
package binarytree type TreeNode struct { Val int Left *TreeNode Right *TreeNode } func PreorderTraversal(root *TreeNode) []int { var res []int if root == nil { return res } res = append(res, root.Val) left := root.Left if left != nil { res = append(res, PreorderTraversal(left)...) } right := r...
gofun/letcode/binarytree/binarytree.go
0.79538
0.499451
binarytree.go
starcoder
package pendingtxs import ( "fmt" "github.com/spacemeshos/go-spacemesh/common/types" ) type meshProjector interface { GetProjection(addr types.Address, prevNonce, prevBalance uint64) (nonce, balance uint64, err error) } type poolProjector interface { GetProjection(addr types.Address, prevNonce, prevBalance uint...
pendingtxs/projector.go
0.744099
0.438424
projector.go
starcoder
package some_structures import ( "fmt" "sync" ) type TreeNode struct { key int value int leftNode *TreeNode rightNode *TreeNode } type BinarySearchTree struct { rootNode *TreeNode lock sync.RWMutex } func (tree *BinarySearchTree) InsertElement(key int, value int) { tree.lock.Lock() defer tree....
some-structures/binary_search_tree.go
0.53607
0.453867
binary_search_tree.go
starcoder
package memory import ( "sort" "time" info "github.com/google/cadvisor/info/v1" ) // A circular buffer for ContainerStats. type StatsBuffer struct { buffer []*info.ContainerStats size int index int } // Returns a new thread-compatible StatsBuffer. func NewStatsBuffer(size int) *StatsBuffer { return &Stat...
Godeps/_workspace/src/github.com/google/cadvisor/storage/memory/stats_buffer.go
0.689096
0.407746
stats_buffer.go
starcoder
package ds; type SparseList[T any] struct { items []T; free []uint32; } func NewSparseList[T any](capacity uint32, freeCapacity uint32) *SparseList[T] { list := new(SparseList[T]); list.items = make([]T, 0, capacity); list.free = make([]uint32, 0, freeCapacity); return list; } func (this *SparseList[T]) At...
pkg/ds/sparse.go
0.641422
0.402451
sparse.go
starcoder
package main import "log" type Dense struct { Weights Matrix Bias Matrix Cols int prev Layer next Layer Activation func(float32) float32 ActivationDerivative func(float32) float32 name string } func MakeDen...
dense.go
0.756537
0.501465
dense.go
starcoder
package cryptoapis import ( "encoding/json" ) // AddressCoinsTransactionUnconfirmedDataItem Defines an `item` as one result. type AddressCoinsTransactionUnconfirmedDataItem struct { // Represents the specific blockchain protocol name, e.g. Ethereum, Bitcoin, etc. Blockchain string `json:"blockchain"` // Represen...
model_address_coins_transaction_unconfirmed_data_item.go
0.843799
0.451871
model_address_coins_transaction_unconfirmed_data_item.go
starcoder
package losses import ( "github.com/nlpodyssey/spago/ag" "github.com/nlpodyssey/spago/mat" ) // MAE measures the mean absolute error (a.k.a. L1 Loss) between each element in the input x and target y. func MAE[T mat.DType](x ag.Node[T], y ag.Node[T], reduceMean bool) ag.Node[T] { loss := ag.Abs(ag.Sub(x, y)) if r...
losses/losses.go
0.906815
0.734739
losses.go
starcoder
package events import ( "bytes" "fmt" "strings" "text/template" ) // MarkdownRenderer renders responses as markdown. type MarkdownRenderer struct{} // CommonData is data that all responses have. type CommonData struct { Command string Verbose bool Log string } // ErrData is data about an error response. ...
server/events/markdown_renderer.go
0.614741
0.412826
markdown_renderer.go
starcoder
package tree import ( "fmt" "log" "math" "sort" "github.com/m1gwings/treedrawer/drawer" ) // stringify takes a pointer to a node and draws all the tree below in a drawer. // Returns the drawn drawer. // This function is called recursively func stringify(t *Tree) *drawer.Drawer { // Getting drawer and dimension...
tree/stringify.go
0.661595
0.410697
stringify.go
starcoder
package router import ( "errors" "reflect" "strconv" "strings" ) var ( ErrInvalidBool = errors.New("invalid bool [true/false]") ) // Parseable represents a parseable argument. type Parseable interface { Parse(arg string) error } // ManualParseable represents a manually parseable argument. type ManualParseabl...
argument.go
0.68595
0.438545
argument.go
starcoder
package models import "github.com/go-gl/mathgl/mgl32" type MinimalAABB struct { Min mgl32.Vec3 Max mgl32.Vec3 } // Axis-aligned bounding box type AABB struct { Position mgl32.Vec3 Width float32 Height float32 Length float32 Min mgl32.Vec3 Max mgl32.Vec3 // Contains Min and Max for indexing Bounds ...
src/backend/models/aabb.go
0.836888
0.492432
aabb.go
starcoder
package sde var MarketGroups = map[int]*MarketGroup{ 2: &MarketGroup{ ID: 2, ParentID: 0, Name: `Blueprints & Reactions`, Description: `Blueprints are data items used in industry for manufacturing, research and invention jobs`, }, 4: &MarketGroup{ ID: 4, ParentID: 0, Nam...
sde/marketGroups.go
0.568176
0.567817
marketGroups.go
starcoder
package sort /* InsertionSort performs insertion sort on a given array and given range. Performs an in place sort with no return Parameters: =========== start: Start of sorting, this position is also included in sorted array end: End of sorting, this position is not included in sorted array compare: Function to comp...
algorithms/sort/insertionSort.go
0.741206
0.63409
insertionSort.go
starcoder
package interpreter import ( "github.com/google/cel-go/common/overloads" "github.com/google/cel-go/common/types" "github.com/google/cel-go/common/types/ref" "github.com/google/cel-go/common/types/traits" ) // InterpretableDecorator is a functional interface for decorating or replacing // Interpretable expression...
vendor/github.com/google/cel-go/interpreter/decorators.go
0.644113
0.457016
decorators.go
starcoder
package runeset //RuneSet is a map[rune]bool with the methods you would expect from a set type. //Eg, Contains, Union, Intersection, and Difference. //I will make code generation for further set types in the future. type Signal struct{} var yes Signal type RuneSet map[rune]Signal //Contains shows whether r is in th...
runeset/runeset.go
0.775307
0.418519
runeset.go
starcoder
package gofilter import ( "bytes" "net" "regexp" "strings" ) type node interface { Apply(map[string]interface{}) bool } type node2 interface { Apply(map[string]interface{}) bool FieldName() string applyOne(v interface{}) bool } // AND type nodeAnd struct { left node right node } func (n *nodeAnd) Apply(...
nodes.go
0.557123
0.4165
nodes.go
starcoder
package evaluator import ( "fmt" "strings" "github.com/vita-dounai/Firework/ast" "github.com/vita-dounai/Firework/object" ) var ( NULL = &object.Null{} TRUE = &object.Boolean{Value: true} FALSE = &object.Boolean{Value: false} BREAK = &object.LoopControl{ControlType: object.BREAK} CONTINUE = &o...
evaluator/evaluator.go
0.637257
0.40439
evaluator.go
starcoder
package knn import ( "math" "sort" ) type Sample struct { Attributes []float64 Class string } // Distance calculates the euclidean distance from one sample to another. // SDD work func (s *Sample) Distance(other *Sample) float64 { //Use this formula: d = (x1 - x2)^2 + (y1 - y2)^2 + (z1 - z2)^2 eucdist :=...
sdd/knn/knn.go
0.829871
0.403479
knn.go
starcoder
package entities // Definition of the Nalej application descriptors JSON schema const APP_DESC_SCHEMA = ` { "definitions": { "labels": { "$id": "#/definitions/labels", "type": "object", "title": "The Labels Schema", "additionalProperties": { "type": "string", "minItems": ...
internal/pkg/entities/app_desc_schema.go
0.742982
0.532668
app_desc_schema.go
starcoder
package tree // Iterator defines a tree iterator type Iterator interface { // Next iterates to the next node in the tree and returns the iterator, or nil if there is no next node Next() Iterator // Previous iterates to the previous node in the tree and returns the iterator, or nil if there is no previous node Prev...
tree/tree.go
0.733643
0.625123
tree.go
starcoder
package pure import ( "context" "fmt" "time" "github.com/benthosdev/benthos/v4/internal/bundle" "github.com/benthosdev/benthos/v4/internal/component" "github.com/benthosdev/benthos/v4/internal/component/output" "github.com/benthosdev/benthos/v4/internal/component/output/processors" "github.com/benthosdev/bent...
internal/impl/pure/output_resource.go
0.502441
0.462959
output_resource.go
starcoder
package cutil //#include <stdbool.h> //#include <stdio.h> import "C" import ( "unsafe" "github.com/dereklstinson/half" ) //CScalar is used for scalar multiplications with cudnn. They have to be Ctypes. It could have easily been called voider type CScalar interface { CPtr() unsafe.Pointer SIB() uint } //CScalar...
ctype.go
0.544559
0.50891
ctype.go
starcoder
package operator import ( "github.com/matrixorigin/matrixone/pkg/container/nulls" "github.com/matrixorigin/matrixone/pkg/container/types" "github.com/matrixorigin/matrixone/pkg/container/vector" "github.com/matrixorigin/matrixone/pkg/vectorize/gt" "github.com/matrixorigin/matrixone/pkg/vectorize/lt" "github.com/...
pkg/sql/plan2/function/operator/lt.go
0.605566
0.434641
lt.go
starcoder
2D Rendering Code */ //----------------------------------------------------------------------------- package sdf import ( "image" "image/color" "image/png" "os" "github.com/llgcode/draw2d/draw2dimg" ) //----------------------------------------------------------------------------- // PNG is a png image objec...
sdf/png.go
0.653238
0.508727
png.go
starcoder
package solver import ( "github.com/mokiat/gomath/sprec" "github.com/mokiat/lacking/game/physics" ) var _ physics.DBConstraintSolver = (*HingedRod)(nil) // NewHingedRod creates a new HingedRod constraint solution. func NewHingedRod() *HingedRod { result := &HingedRod{ length: 1.0, } result.DBJacobianConstrain...
game/physics/solver/hinged_rod.go
0.854308
0.405802
hinged_rod.go
starcoder
package main import ( "math" "strings" ) type Diff struct { Blocks []Block } // Block is common interface fo EqualBlock and DiffBlock type Block interface { // Returns true on EqualBlock, false on DiffBlock IsEqual() bool } type EqualBlock struct { Equals []Equal } func (block EqualBlock) IsEqual() bool { r...
go-differ.go
0.668015
0.472014
go-differ.go
starcoder
package astar import ( "fmt" ) /*** Helper functions ***/ func abs(a int) int { if a < 0 { return -a } return a } func max(a, b int) int { if a > b { return a } return b } func min(a, b int) int { if a < b { return a } return b } /*** MapData type and related consts ***/ // Tile information c...
astar.go
0.572484
0.413004
astar.go
starcoder
// This file contains the definitions of the non-math elementary // (builtin) functions. package lisp1_5 func evalInit() { if elementary == nil { // Initialized here to avoid initialization loop. elementary = funcMap{ tokAdd: (*Context).addFunc, tokAnd: (*Context).andFunc, tokApply: (*Context).appl...
lisp1_5/elementary.go
0.582135
0.504089
elementary.go
starcoder
package model import ( "image" "image/draw" "math/rand" "sync" ) // Mutex to be used to synchronize model modifications var Mutex sync.Mutex // The model/data of the labyrinth var Lab [][]Block // MovingObj is a struct describing a moving object. type MovingObj struct { // The position in the labyrinth in pixe...
model/lab.go
0.636805
0.618521
lab.go
starcoder
package discount // This file contains all business rules for calculating discounts. import ( "math" "github.com/nglogic/go-application-guide/internal/app/bikerental" ) // newBikeWeightDiscount returns discount for individual customers based on reservation value and bike weight. // Discount rules: // - individual...
internal/app/bikerental/discount/rulesindividual.go
0.798187
0.468122
rulesindividual.go
starcoder
package coerce import ( "encoding/json" "fmt" "strings" "github.com/project-flogo/core/data" ) func init() { data.SetAttributeTypeConverter(ToType) } func NewTypedValue(dataType data.Type, value interface{}) (data.TypedValue, error) { newVal, err := ToType(value, dataType) if err != nil { return nil, err ...
data/coerce/coercion.go
0.613931
0.492981
coercion.go
starcoder
package json import ( "context" "encoding/json" "fmt" "io" "github.com/pbanos/botanic/feature" "github.com/pbanos/botanic/tree" ) /* WriteJSONTree takes a context.Context, a pointer to a tree.Tree and an io.Writer and serializes the given tree as JSON onto the io.Writer. A tree is serialized as a JSON object ...
tree/json/tree.go
0.542136
0.505615
tree.go
starcoder
package financial import ( "fmt" ) const ( SideSell = "SELL" SideBuy = "BUY" ) // Budget is the interface that manages the budget granted to a strategy. // A strategy is granted an initial amount of a base coin and alt coin, with that // the strategy starts working and in in the event of positive trades, these a...
business/strategies/financial/budget.go
0.617743
0.491517
budget.go
starcoder
package main import ( "fmt" "log" "math" "strconv" "strings" ) // Heading tracks the cardinal direction the avatar is heading. type Heading uint8 // NORTH, etc, (Compass Directions) const ( NORTH Heading = iota EAST WEST SOUTH ) // Rotation identifies the direction (left or right) of a navigational step ty...
day01/main.go
0.678007
0.572842
main.go
starcoder
package flag import ( "errors" "flag" "io" "os" "path/filepath" "time" ) type FlagSetEx struct { *flag.FlagSet envPrefix string } var DefaultConfigFlagName = "config" var ex = &FlagSetEx{ flag.NewFlagSet(os.Args[0], flag.ContinueOnError), "", } // Bool defines a bool flag with specified name, default val...
flag.go
0.641647
0.438485
flag.go
starcoder
package moves import ( "errors" ) //ValidCounter is the signature of objects in the moves/count package. It is //expected within groups in the move/groups package for items like //ParallelCount. currentCount is the value of the counter in question, and //length is the context-specific length of the important item, o...
moves/count.go
0.822153
0.515315
count.go
starcoder
package main import "fmt" type area [][]*tile func newArea(maxX, maxY int) area { area := make([][]*tile, maxY) for y := range area { area[y] = make([]*tile, maxX) for x := range area[y] { area[y][x] = newTile(x, y, area) } } return area } func (a area) isOut(x, y int) bool { return x < 0 || y < 0 || ...
day13b/area.go
0.555918
0.40486
area.go
starcoder
package insts // Reg is the representation of a register type Reg struct { RegType RegType Name string ByteSize int IsBool bool } // VReg returns a vector register object given a certain index func VReg(index int) *Reg { return Regs[V0+RegType(index)] } // SReg returns a scalar register object given a ce...
insts/reg.go
0.675444
0.421254
reg.go
starcoder
package data // Course represents a course resource type Course struct { ApplicationProvider string `bson:"application_provider,omitempty"` Country *Country `bson:"country"` DistanceLearning *DistanceLearning `bson:"distance_learning"` Foundation string `b...
mongo/get-random-courses/vendor/github.com/ofs/alpha-scripts/mongo/load-data/course-builder/data/data.go
0.702938
0.520192
data.go
starcoder
package main import ( "fmt" "math" "github.com/hajimehoshi/oto" ) // Beeper handles audio. Use NewBeeper to initialise. type Beeper struct { memory *byte player *oto.Player sampleRate int frequency float64 volume float64 amplitude float64 step float64 time float64 // whether au...
audio.go
0.750918
0.495667
audio.go
starcoder
package fileutils /* This utility will help find packed or encrypted files on a Linux system by calculating the entropy to see how random they are. Packed or encrypted malware often appears to be a very random executable file and this utility can help identify potential problems. You can calculate entropy on all file...
fileutils/fileutils.go
0.775987
0.421611
fileutils.go
starcoder
package sqlset import ( "context" "fmt" "math" "github.com/pbanos/botanic/feature" "github.com/pbanos/botanic/set" ) /* Set is a set.Set to which samples can be added Its AddSample takes a set.Sample and adds it to the set, returning an error if any errors occur or nil otherwise. */ type Set interface { set.S...
set/sqlset/set.go
0.59796
0.40072
set.go
starcoder
package gobang /** * | | | | | | | |B| |B| * | | | | | | |B| |B| | * | | | | | |B| |B| | | * | | | | |B| |B| | | | * | | | |B| |B| | | | | * | | | | |B| | | | | | * | | | |B| | | | | | | * | | |B| | | | | | | | * | |B| | | | | | | | | * |B| | | | | | | | | | */ func NewTopRightDiagonalCellMatcher(stone Ston...
gobang/top_right_diagonal_cell_matcher.go
0.832951
0.551815
top_right_diagonal_cell_matcher.go
starcoder
package compatibilityVars var RubyVersionAgentSupportability = map[string][]string{ //the keys are the ruby version and the values are the agent versions that support that specific version "2.7": []string{"6.9.0.363+"}, "2.6": []string{"5.7.0.350+"}, "2.5": []string{"4.8.0.341+"}, "2.4": []string{"3.18.0....
tasks/compatibilityVars/versions.go
0.533154
0.432243
versions.go
starcoder
package inject import ( "fmt" "reflect" ) type provider struct { constructor interface{} argPtrs []interface{} } // NewProvider specifies how to construct a value given its constructor function and argument pointers func NewProvider(constructor interface{}, argPtrs ...interface{}) Provider { fnValue := refl...
provider.go
0.612773
0.449393
provider.go
starcoder
package internal import ( "fmt" "math" ) const Epsilon = 1e-7 // To compensate for imprecision in floats, equality is tolerance based. If we // don't account for this, we'll end up shaving off absurdly thin triangles on nearly // horizontal segments. func Equal(a, b float64) bool { return math.Abs(a-b) < Epsilon ...
internal/util.go
0.870831
0.639427
util.go
starcoder
package techan import "github.com/sdcoffey/big" // Rule is an interface describing an algorithm by which a set of criteria may be satisfied type Rule interface { IsSatisfied(index int, record *TradingRecord) bool } // And returns a new rule whereby BOTH of the passed-in rules must be satisfied for the rule to be sa...
rule.go
0.810066
0.510069
rule.go
starcoder
package main import ( "fmt" "github.com/theatlasroom/advent-of-code/go/2019/utils" "math" "strconv" ) /** --- Day 1: The Tyranny of the Rocket Equation --- Santa has become stranded at the edge of the Solar System while delivering presents to other planets! To accurately calculate his position in space, safely a...
go/2019/2019_1.go
0.661704
0.749866
2019_1.go
starcoder
package composite import ( "github.com/jrife/flock/storage/kv" "github.com/jrife/flock/storage/kv/keys" composite_keys "github.com/jrife/flock/storage/kv/keys/composite" ) // NamespaceMapReader returns a namespaced map reader func NamespaceMapReader(mr MapReader, ns [][]byte) MapReader { return &namespacedMap{ns:...
storage/kv/composite/namespace.go
0.831006
0.506286
namespace.go
starcoder
package bitset import "strings" const bitsPerWord uint64 = 6 const numOfBits uint64 = 64 // Bitset represents a fixed size sequence of N bits. type Bitset struct { set []uint64 size uint64 trueCount uint64 } // New given the desired number of bits, returns a new instance of a bitset. func New(bits uin...
bitset.go
0.76769
0.590514
bitset.go
starcoder
package iso20022 // Security that is a sub-set of an investment fund, and is governed by the same investment fund policy, eg, dividend option or valuation currency. type SecurityIdentification1 struct { // Identification of a security by an ISIN. Identification *SecurityIdentification7 `xml:"Id"` // Name of the f...
SecurityIdentification1.go
0.810816
0.400984
SecurityIdentification1.go
starcoder
package ityped import ( "github.com/mg/i" "github.com/mg/i/itk" ) // Typed adapter for a Forward iterator. Contains methods to acccess the // value typed as any of the basic Go types. type ForwardItr struct { itk.WForward } // Wrap a Forward iterator in a structure that has typed methods to access // the value o...
ityped/adapt.go
0.642432
0.475971
adapt.go
starcoder
package unityai import ( "unsafe" ) type NavMeshNodeFlags uint8 const ( kNew NavMeshNodeFlags = 0x00 kOpen NavMeshNodeFlags = 0x01 kClosed NavMeshNodeFlags = 0x02 ) type NavMeshNode struct { pos Vector3f // Position of the node. cost float32 // Cost from previous node to current node....
nav_mesh_node.go
0.604749
0.427397
nav_mesh_node.go
starcoder
package data // A FrameType string, when present in a frame's metadata, asserts that the // frame's structure conforms to the FrameType's specification. // This property is currently optional, so FrameType may be FrameTypeUnknown even if the properties of // the Frame correspond to a defined FrameType. type FrameType ...
data/frame_type.go
0.780704
0.537223
frame_type.go
starcoder
package v1 import ( "context" "reflect" "github.com/pkg/errors" "github.com/pulumi/pulumi/sdk/v3/go/pulumi" ) // Creates and returns a new ReferenceImage resource. The `bounding_poly` field is optional. If `bounding_poly` is not specified, the system will try to detect regions of interest in the image that are ...
sdk/go/google/vision/v1/referenceImage.go
0.849113
0.41834
referenceImage.go
starcoder
package colors import "bytes" // Returns a string wrapped in ANSI start/stop codes for bold func Bold(in string) string { return stylize("\x1b[1m", in, "\x1b[22m") } // Returns a string wrapped in ANSI start/stop codes for italic func Italic(in string) string { return stylize("\x1b[3m", in, "\x1b[23m") } // Ret...
colors.go
0.835249
0.437403
colors.go
starcoder
package bigint import ( "math/big" ) var zero = big.NewInt(0) const ( cmpLt int = -1 cmpEq int = 0 cmpGt int = 1 cmpNil int = -42 ) // Add returns the result of adding the values of params x and y. // Notes: // - If x == nil && y == nil, returns nil. // - If x != nil && y == nil, returns x. // - If x == nil...
bigint/bigint.go
0.844249
0.702709
bigint.go
starcoder
package axes // label.go contains code that calculates the positions of labels on the axes. import ( "fmt" "image" "github.com/mum4k/termdash/align" "github.com/mum4k/termdash/private/alignfor" ) // Label is one text label on an axis. type Label struct { // Label content. Text string // Position of the lab...
lib/heatmap/axes/label.go
0.849815
0.719334
label.go
starcoder
package main import ( "math" "sort" "strconv" "strings" ) func Sum(p []int64) (a int64) { for _, x := range p { a += x } return a } func Mean(p []int64) (a float64) { if len(p) == 0 { return 0 } return float64(Sum(p)) / float64(len(p)) } func Roundf(f float64) string { return strconv.FormatFloat(Roun...
math.go
0.605916
0.499023
math.go
starcoder
// This example is a Go replica of https://github.com/google/or-tools/blob/master/ortools/linear_solver/samples/linear_programming_example.py //Linear optimization example package main import ( "fmt" "os" "github.com/baobabsoluciones/ortoolslp" ) func main() { //Entry point of the program //Instantiate a solve...
examples/LP/linear_programming.go
0.854703
0.434161
linear_programming.go
starcoder
package gohome import ( "github.com/PucklaMotzer09/mathgl/mgl32" ) // A transform storing everything needed for the transform matrix type TransformableObject3D struct { // The position in the world Position mgl32.Vec3 // The scale the multiplies all vertices Scale mgl32.Vec3 // The rotation represented as a ...
src/gohome/transformableobject3d.go
0.709019
0.554772
transformableobject3d.go
starcoder
package effuncert import ( "fmt" "math" "github.com/fako1024/numerics" "github.com/fako1024/numerics/root" ) const ( epsilon = 1e-9 maxQuadraticRootFindingN = 1000 ) const ( // OneSigma denotes a one sigma standard deviation equivalent OneSigma = 0.6826895475 // TwoSigma denotes a two si...
uncert.go
0.861669
0.729737
uncert.go
starcoder
package unit import ( "fmt" "math" ) // Value is a value with a unit. type Value struct { V float32 U Unit } // Unit represents a unit for a Value. type Unit uint8 // Metric converts Values to device-dependent pixels, px. The zero // value represents a 1-to-1 scale from dp, sp to pixels. type Metric struct { /...
unit/unit.go
0.847621
0.614018
unit.go
starcoder
package rt import ( "emacs/lisp" ) // Slice - Go slice. type Slice struct { data lisp.Object offset int len int cap int } func SliceLen(slice *Slice) int { return slice.len } func SliceCap(slice *Slice) int { return slice.cap } // MakeSlice creates a new slice with cap=len. // All values initialized to...
src/emacs/rt/slice.go
0.752104
0.452959
slice.go
starcoder
package matchers import ( "os" "regexp" "strings" "time" "github.com/kbrgl/fuzzy" ) // FileMatcher is an interface providing a Match method that checks whether a // file satisfies some constraint. type FileMatcher interface { Match(os.FileInfo) bool } // FuzzyMatcher fuzzy-matches the filename. type FuzzyMat...
matchers/matchers.go
0.810779
0.457864
matchers.go
starcoder
package openapi import ( "encoding/json" ) // RateDetails struct for RateDetails type RateDetails struct { AccrualPeriod string `json:"accrual_period"` // Rate in basis points. E.g. 5 represents 0.05% Rate int32 `json:"rate"` // Rate effective start date. Inclusive. ValidFrom string `json:"valid_from"` // Rat...
synctera/model_rate_details.go
0.828904
0.440951
model_rate_details.go
starcoder
package store // InMemoryStore represents a data store that is in memory and thus transient type InMemoryStore struct { data map[string][]byte } // NewInMemoryStore create a new instance of a memory store with seed data func NewInMemoryStore(initialData map[string][]byte) KVStore { return &InMemoryStore{data: initi...
store/in_memory_store.go
0.852813
0.569912
in_memory_store.go
starcoder
package valuation const yearsOfHighGrowth = 5 // OutputYear defines the cash flow calculation of one particular year in the future type OutputYear struct { RevenueGrowthRate float64 Revenue float64 EBITMargin float64 EBIT float64 TaxRate float64 A...
pkg/valuation/output.go
0.809878
0.698538
output.go
starcoder
package scale import ( "fmt" "sort" "github.com/gvallee/collective_profiler/tools/internal/pkg/unit" ) func mapFloat64sScaleDown(unitType int, unitScale int, values map[int]float64) (int, int, map[int]float64) { if unitScale == -1 { // Unit not recognized, nothing we can do return unitType, unitScale, value...
tools/internal/pkg/scale/scale_mapfloat64s.go
0.735357
0.53443
scale_mapfloat64s.go
starcoder
package entropy import ( "errors" "fmt" kanzi "github.com/flanglet/kanzi-go" ) // Code based on Order 0 range coder by <NAME> itself derived from the algorithm // described by <NAME> in his seminal article in 1979. // [<NAME> on the Data Recording Conference, Southampton, 1979] const ( _TOP_RANGE ...
entropy/RangeCodec.go
0.636127
0.405154
RangeCodec.go
starcoder
package netpbm import ( "bufio" "errors" "fmt" "image" "image/color" "io" "strings" "github.com/spakin/netpbm/npcolor" ) // An RGBM is an in-memory image whose At method returns npcolor.RGBM values. type RGBM struct { // Pix holds the image's pixels, in R, G, B (no M) order. The pixel at // (x, y) starts ...
ppm.go
0.840848
0.547283
ppm.go
starcoder
package cp // This is a user defined function that gets passed in to the Marching process // the user establishes a PolyLineSet, passes a pointer to their function, and they // populate it. In most cases you want to use PolyLineCollectSegment instead of defining your own type MarchSegmentFunc func(v0 Vector, v1 Vector...
march.go
0.626467
0.700264
march.go
starcoder
package graph import ( "errors" "fmt" ) var alreadyConnected = errors.New("graph: edge already fully connected") type Edge interface { ID() int Weight() float64 Nodes() (u, v Node) Head() Node Tail() Node index() int setIndex(int) setID(int) join(u, v Node) disconnect() reconnect(dst, src Node) } var...
edge.go
0.741393
0.417509
edge.go
starcoder
package apmcharts import ( "io" "sort" "time" "github.com/pkg/errors" "github.com/wcharczuk/go-chart/v2" ) // RenderResponseTime renders response time chart, aka. service sublayer func RenderResponseTime(series, timestamps [][]float64, w io.Writer, options Options) error { if len(series) != len(timestamps) { ...
response_time.go
0.589835
0.41117
response_time.go
starcoder
package gost import ( "errors" "math" ) // Basic Node struct, basis of any single-linked list structure. type Node struct { Data interface{} Next *Node } /* NodeList is a an implementation of a singly linked list. It takes any interface{} and allows: - Retrieving: obtaining the value contained at any given inde...
list/node_list.go
0.742141
0.516352
node_list.go
starcoder
package main import ( "time" "github.com/marcusolsson/grafana-ynab-datasource/pkg/ynab" ) type Range struct { Start time.Time End time.Time } func (r Range) Contains(t time.Time) bool { return r.Start.UnixNano() <= t.UnixNano() && t.UnixNano() < r.End.UnixNano() } type Bucket struct { Range Range M...
pkg/aligner.go
0.686895
0.584745
aligner.go
starcoder
package stack import ( "eslang/core" "fmt" "math" ) // ====================== // ARITHMETIC OPERATIONS // ====================== // AddValues function  adds two values together func AddValues(lhs StackValue, rhs StackValue) (StackValue, error) { if lhs.Type() != rhs.Type() { return nil, fmt.Errorf("can not ...
interpreter/stack/operations.go
0.739328
0.454775
operations.go
starcoder
package main import ( "flag" "fmt" "io" "os" // nginx _ "github.com/Konstantin8105/ss/nginx" // htop _ "github.com/Konstantin8105/ss/htop" // vim _ "github.com/Konstantin8105/ss/vim" // mc _ "github.com/Konstantin8105/ss/mc" // nano _ "github.com/Konstantin8105/ss/nano" // ssh _ "github.com/Konst...
main.go
0.765769
0.425844
main.go
starcoder