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 state import "github.com/google/uuid" func getDefaultWorldChangeRoutines() map[string]ChangeRoutine { return map[string]ChangeRoutine{} } func getDefaultWorldStates(states map[string]interface{}) (result map[string]interface{}) { result = map[string]interface{}{ "temperature": float64(20), "humidity": ...
lib/state/default.go
0.513668
0.404478
default.go
starcoder
Copyright 2015 The Kubernetes Authors. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, sof...
kubernetes-model/vendor/k8s.io/kubernetes/staging/src/k8s.io/client-go/util/jsonpath/node.go
0.885687
0.542379
node.go
starcoder
package limits import ( "github.com/gophercloud/gophercloud" ) // Limits is a struct that contains the response of a limit query. type Limits struct { // Absolute contains the limits and usage information. // An absolute limit value of -1 indicates that the absolute limit for the item is infinite. Absolute Absolu...
openstack/blockstorage/extensions/limits/results.go
0.733547
0.446434
results.go
starcoder
package router //go:generate go run generate_rest_tape_player.go import ( "image" "github.com/Postcord/objects" "github.com/Postcord/rest" ) type restTapePlayer struct { t TestingT tape tape index int } func (r *restTapePlayer) AddGuildCommand(a objects.Snowflake, b objects.Snowflake, c *objects.Applicati...
rest_tape_player_gen.go
0.550366
0.449091
rest_tape_player_gen.go
starcoder
package decisiontrees import ( "code.google.com/p/goprotobuf/proto" pb "github.com/ajtulloch/decisiontrees/protobufs" "github.com/golang/glog" "sync" ) type lossState struct { averageLabel float64 sumSquaredDivergence float64 numExamples int } func constructLoss(e Examples) *lossState { l :=...
regression_splitter.go
0.804098
0.455744
regression_splitter.go
starcoder
package biquad import ( "math" ) // Chebyshev filter. May represent Lowpass and other // Chebyshev filter implementations. type Chebyshev struct { blt } // From wikipedia: // Chebyshev type I Transfer function: // H(s) = (1/(2*e)) / ( s^2 - s*(sp_1+sp_2) + sp_1*sp_2) // where sp_m = j*cosh(asinh(1/e)/n)*cos(thet...
chebyshev.go
0.669961
0.526891
chebyshev.go
starcoder
package seeds import "math/rand" //RandDummyURL return a dummy url func RandDummyURL() string { URL := [1000]string{ "http://www.example.com/behavior", "https://www.example.com/?berry=approval#boy", "http://www.example.net/", "https://www.example.org/back.html#bird", "http://blow.example.org/", "https://...
util/seeds/dummyseeds.go
0.514644
0.656493
dummyseeds.go
starcoder
package geom import ( "github.com/water-vapor/euclidea-solver/configs" "github.com/water-vapor/euclidea-solver/pkg/hashset" "math" "math/rand" ) // HalfLine is determined uniquely by its starting point and normalized direction vector type HalfLine struct { hashset.Serializable point *Point direction *Vecto...
pkg/geom/halfline.go
0.860721
0.502258
halfline.go
starcoder
package datemath_parser // built-in format var builtInFormat = map[string][]string{ // A formatter for the number of milliseconds since the epoch. // Note, that this timestamp is subject to the limits of a Java Long.MIN_VALUE and Long.MAX_VALUE. "epoch_millis": {"epoch_millis"}, // A formatter for the numbe...
format.go
0.643105
0.534795
format.go
starcoder
package types import ( "encoding/json" "errors" "fmt" "math/big" "strconv" "strings" "<KEY>" cbor "gx/ipfs/QmcZLyosDwMKdB6NLRsiss9HXzDPhVhhRtPy67JFKTDQDX/go-ipld-cbor" "gx/ipfs/QmdBzoMxsBpojBfN1cv5GnKtB7sfYBMoLH7p9qSyEVYXcu/refmt/obj/atlas" ) // NOTE -- ALL *AttoFIL methods must call ensureZeroAmounts with ...
types/atto_fil.go
0.681939
0.577674
atto_fil.go
starcoder
package vector import ( "encoding/binary" "math" "github.com/frenchie-foundation/go-lachesis/inter" "github.com/frenchie-foundation/go-lachesis/inter/idx" ) /* * Use binary form for optimization, to avoid serialization. As a result, DB cache works as elements cache. */ type ( // LowestAfterSeq is a vector of...
vector/vector.go
0.706292
0.540621
vector.go
starcoder
package pl import "github.com/ContextLogic/cldr" var calendar = cldr.Calendar{ Formats: cldr.CalendarFormats{ Date: cldr.CalendarDateFormat{Full: "EEEE, d MMMM y", Long: "d MMMM y", Medium: "dd.MM.y", Short: "dd.MM.y"}, Time: cldr.CalendarDateFormat{Full: "HH:mm:ss zzzz", Long: "HH:mm:ss z", Medium: "HH:...
resources/locales/pl/calendar.go
0.501221
0.437703
calendar.go
starcoder
package tiledb /* #cgo LDFLAGS: -ltiledb #include <tiledb/tiledb.h> #include <stdlib.h> */ import "C" import ( "fmt" "runtime" "unsafe" ) /* Array struct representing a TileDB array object. An Array object represents array data in TileDB at some persisted location, e.g. on disk, in an S3 bucket, etc. Once an arr...
array.go
0.630002
0.520984
array.go
starcoder
package influxql import ( "encoding/json" "errors" "github.com/influxdata/influxdb/models" ) // TagSet is a fundamental concept within the query system. It represents a composite series, // composed of multiple individual series that share a set of tag attributes. type TagSet struct { Tags map[string]strin...
vendor/github.com/influxdata/influxdb/influxql/result.go
0.727104
0.477676
result.go
starcoder
package measurement import ( "fmt" "sort" "strings" "sync" "sync/atomic" "time" ) type measurement struct { sync.RWMutex outputCounter int64 opCurMeasurement map[string]*histogram opSumMeasurement map[string]*histogram } func (m *measurement) getHist(op string, err error, current bool) *histogram { op...
pkg/measurement/measure.go
0.602529
0.517083
measure.go
starcoder
package window import ( "time" ) // New creates a Window instance which represents a recurring window // between two times of day. If `start` is after `end` then the time // window is assumed to cross over midnight. If `start` and `end` are // the same then the window is always active. func New(start, end time.Time...
window.go
0.875588
0.421552
window.go
starcoder
package simplify import "math" func squareDistance(left *MappablePoint, right *MappablePoint) float64 { leftX, leftY, leftZ := (*left).MapPoint() rightX, rightY, rightZ := (*right).MapPoint() return math.Pow(leftX-rightX, 2) + math.Pow(leftY-rightY, 2) + math.Pow(leftZ-rightZ, 2) } func segmentSquareDistance(poi...
go/pkg/simplify/simplify.go
0.844281
0.643833
simplify.go
starcoder
package model // Path holds information about a possible path, including edges, current length and current rewards. type Path struct { edges []*Edge length int rewards map[*Reward]int } // Edges returns a list of path edges. func (path *Path) Edges() []*Edge { return path.edges } // AddEdge adds an edge with ...
model/path.go
0.855233
0.562717
path.go
starcoder
package mutesting import ( "fmt" "go/ast" "go/types" "strings" "github.com/AlexanderAsmakov/go-mutesting/mutator" ) // CountWalk returns the number of corresponding mutations for a given mutator. // It traverses the AST of the given node and calls the method Check of the given mutator for every node and sums up...
walk.go
0.777384
0.44746
walk.go
starcoder
package junit import ( "strconv" "time" ) // findSuites performs a depth-first search through the XML document, and // attempts to ingest any "testsuite" tags that are encountered. func findSuites(nodes []xmlNode, suites chan Suite) { for _, node := range nodes { switch node.XMLName.Local { case "testsuite": ...
vendor/github.com/joshdk/go-junit/ingest.go
0.681197
0.409752
ingest.go
starcoder
package helpers import ( "math" "math/cmplx" "math/rand" "strconv" "time" ) // Abs abs() func Abs(number float64) float64 { return math.Abs(number) } // Acos - Arc cosine func Acos(x complex128) complex128 { return cmplx.Acos(x) } // Acosh - Inverse hyperbolic cosine func Acosh(x complex128) complex128 { re...
math.go
0.862656
0.481149
math.go
starcoder
package query /* type FieldType int const ( Blob FieldType = iota Integer VarChar Char DateTime Date Time Float Bit )*/ // NodeType indicates the type of node, which saves us from having to use reflection to determine this type NodeType int const ( UnknownNodeType NodeType = iota TableNodeType ColumnNod...
pkg/orm/query/node.go
0.741019
0.406803
node.go
starcoder
package main import ( "fmt" "image/color" "log" "math" "os" "github.com/campoy/goml/iplot/xyer" "github.com/campoy/goml/util" "github.com/campoy/mat" "github.com/campoy/tools/imgcat" "gonum.org/v1/plot" "gonum.org/v1/plot/plotter" "gonum.org/v1/plot/vg/draw" ) func main() { enc, err := imgcat.NewEncoder...
logreg/main.go
0.586286
0.450541
main.go
starcoder
package nprand import "fmt" const ( stateLen int = 624 maxUint32 uint32 = 0xffffffff // Magic Mersenne Twister constants mtN int = 624 mtM int = 397 matrixA uint32 = 0x9908b0df upperMask uint32 = 0x80000000 lowerMask uint32 = 0x7fffffff ) // State is the state of the random number ge...
master/pkg/nprand/nprand.go
0.663015
0.490175
nprand.go
starcoder
package profile import ( "net/url" "sort" "strings" ) type Label struct { Key string `json:"key"` Value string `json:"value"` } type Labels []Label func LabelsFromMap(m map[string]interface{}) Labels { if len(m) == 0 { return nil } labels := make(Labels, 0, len(m)) for k, rawVal := range m { if k =...
pkg/profile/labels.go
0.569972
0.445288
labels.go
starcoder
package leetcode // Coorditaion of grid type coord struct { X int Y int } // Context for the calculation type context struct { Width int Height int Grids [][]byte IsMerged [][]byte NumberOfIslands int } func newContext(grid [][]byte) *context { c := context{ Width: ...
0200-number-of-islands/0200_number_of_islands.go
0.776708
0.45181
0200_number_of_islands.go
starcoder
package datastructure import ( "math" "github.com/duke-git/lancet/v2/datastructure" "github.com/duke-git/lancet/v2/lancetconstraints" ) // BSTree is a binary search tree data structure in which each node has at most two children, // which are referred to as the left child and the right child. // In BSTree: leftNo...
datastructure/tree/bstree.go
0.776538
0.636353
bstree.go
starcoder
package model import ( "github.com/aunum/log" g "gorgonia.org/gorgonia" ) // Loss is the loss of a model. type Loss interface { // Comput the loss. Compute(yHat, y *g.Node) (loss *g.Node, err error) // Clone the loss to another graph. CloneTo(graph *g.ExprGraph, opts ...CloneOpt) Loss // Inputs return any in...
vendor/github.com/aunum/gold/pkg/v1/model/loss.go
0.8339
0.426322
loss.go
starcoder
package observer // Интерфейс работы с измерениями. type measurementsHandler interface { MeasurementsChanged() string SetMeasurements(float64, float64, float64) string } // WeatherDater Интерфейс источника метеоданных, способного быть субъектом. type WeatherDater interface { measurementsHandler subject } // Исто...
pkg/behavioral/observer/weatherData.go
0.572723
0.527134
weatherData.go
starcoder
package main import ( "fmt" "math/big" ) //C47_2a implements step 2a of Bleichenbacher's attack func C47_2a(c0, B, e, d, n *big.Int) *big.Int { lowerBdDenom := big.NewInt(0).Mul(B, big.NewInt(3)) lowerBd := big.NewRat(0, 1).SetFrac(n, lowerBdDenom) s1 := RatCeil(lowerBd) for { fmt.Printf("Testing s1 = %X\n",...
bleichenbacher.go
0.522689
0.482185
bleichenbacher.go
starcoder
package render import ( "unsafe" "github.com/inkyblackness/hacked/ui/opengl" ) // TextureRenderer is a renderer within which something can be rendered onto a texture. // This texture can then be used to be displayed. type TextureRenderer struct { gl opengl.OpenGL framebuffer uint32 texture uint32 width ...
editor/render/TextureRenderer.go
0.760828
0.415788
TextureRenderer.go
starcoder
package parser import ( "go/ast" "reflect" ) //Function holds the signature of a function with name, Parameters and Return values type Function struct { Name string Parameters []*Field ReturnValues []string PackageName string FullNameReturnValues []string } //Signtur...
parser/function.go
0.535098
0.418935
function.go
starcoder
package conv // SliceFloat is alias of Floats. func SliceFloat(i interface{}) []float64 { return Floats(i) } // SliceFloat32 is alias of Float32s. func SliceFloat32(i interface{}) []float32 { return Float32s(i) } // SliceFloat64 is alias of Float64s. func SliceFloat64(i interface{}) []float64 { return Floats(i) }...
conv_slice_float.go
0.513668
0.441553
conv_slice_float.go
starcoder
package hexgrid import ( "fmt" ) type Coord struct { X int `json:"x"` Y int `json:"y"` } func (c Coord) String() string { return fmt.Sprintf("C(%d, %d)", c.X, c.Y) } type ByXY []Coord func (a ByXY) Len() int { return len(a) } func (a ByXY) Swap(i, j int) { a[i], a[j] = a[j], a[i] } func (a ByXY) Less(i, j...
hexgrid.go
0.771241
0.46041
hexgrid.go
starcoder
package i6502 import ( "fmt" ) /* The AddressBus contains a list of all attached memory components, like Ram, Rom and IO. It takes care of mapping the global 16-bit address space of the Cpu to the relative memory addressing of each component. */ type AddressBus struct { addressables []*addressable // Different comp...
address_bus.go
0.805058
0.44354
address_bus.go
starcoder
package goja import ( "math" "github.com/powerpuffpenguin/goja/ftoa" ) func (r *Runtime) numberproto_valueOf(call FunctionCall) Value { this := call.This if !isNumber(this) { r.typeErrorResult(true, "Value is not a number") } switch t := this.(type) { case valueInt, valueFloat: return this case *Object: ...
builtin_number.go
0.670177
0.421135
builtin_number.go
starcoder
package filtermodule import ( "fmt" "regexp" "strconv" "strings" "time" "../spammodule" bot "../sweetiebot" "github.com/erikmcclure/discordgo" ) // FilterModule implements word filters that allow you to look for spoilers or profanity uses regex matching. type FilterModule struct { spam *spammodule.SpamMo...
filtermodule/FilterModule.go
0.63409
0.498962
FilterModule.go
starcoder
package termui import ( "image" ) // Cell is a rune with assigned Fg and Bg. type Cell struct { Ch rune Fg Color Bg Color } // Buffer is a renderable rectangle cell data container. type Buffer struct { Area image.Rectangle // selected drawing area CellMap map[image.Point]Cell } // NewCell returne a new Cel...
vendor/github.com/cjbassi/termui/buffer.go
0.847999
0.55652
buffer.go
starcoder
package goeval import ( "fmt" "go/token" "reflect" ) // ComputeBinaryOp executes the corresponding binary operation (+, -, etc) on two interfaces. func ComputeBinaryOp(xI, yI interface{}, op token.Token) (interface{}, error) { typeX := reflect.TypeOf(xI) typeY := reflect.TypeOf(yI) if typeX == typeY { switch ...
ops.go
0.537284
0.574186
ops.go
starcoder
package main import ( "fmt" "../utils" "strconv" "math" ) type Boat struct { x int y int aim [2]int } func handle_rotation(cur_aim [2]int, rotation float64 ) [2]int { rotation_radians := rotation * (math.Pi/180) new_aim := [2]int{0,0} new_aim[0] = cur_aim[0] * int(math.Cos(r...
2020/day12/puzzle.go
0.707203
0.527377
puzzle.go
starcoder
package render import ( "strings" "github.com/weaveworks/scope/probe/kubernetes" "github.com/weaveworks/scope/report" ) // KubernetesVolumesRenderer is a Renderer which combines all Kubernetes // volumes components such as stateful Pods, Persistent Volume, Persistent Volume Claim, Storage Class. var KubernetesVol...
render/persistentvolume.go
0.747155
0.475301
persistentvolume.go
starcoder
package block import ( "github.com/df-mc/dragonfly/dragonfly/entity/effect" "github.com/df-mc/dragonfly/dragonfly/entity/physics" "github.com/df-mc/dragonfly/dragonfly/internal/block_internal" "github.com/df-mc/dragonfly/dragonfly/internal/world_internal" "github.com/df-mc/dragonfly/dragonfly/item" "github.com/d...
dragonfly/block/beacon.go
0.699254
0.423041
beacon.go
starcoder
package v1alpha1 import ( internalinterfaces "kubeform.dev/provider-azurerm-api/client/informers/externalversions/internalinterfaces" ) // Interface provides access to all the informers in this group version. type Interface interface { // Namespaces returns a NamespaceInformer. Namespaces() NamespaceInformer // ...
client/informers/externalversions/servicebus/v1alpha1/interface.go
0.803019
0.408365
interface.go
starcoder
package gotvta var ( buy = "BUY" strongBuy = "STRONG_BUY" sell = "SELL" strongSell = "STRONG_SELL" neutral = "NEUTRAL" ) // ComputeMA returns technical analysis for moving averages. func ComputeMA(MA float64, close float64) string { if MA < close { return buy } else if MA > close { return sell } els...
technicals.go
0.675229
0.415314
technicals.go
starcoder
package gassert func Go(condition bool) { if condition { panic("gAssertError") } } func Zeros(xs ...interface{}) { New().Zeros(xs...).Panic() } func Equals(x, y interface{}) { New().Equals(x, y).Panic() } func NotEquals(x, y interface{}) { New().NotEquals(x, y).Panic() } func NumLess(x, y interface{}) { Ne...
gassert.go
0.660063
0.555676
gassert.go
starcoder
package yasup import ( crypto "crypto/rand" "math/big" "math/rand" ) var zeroValueInt64 int64 //Int64Insert will append elem at the position i. Might return ErrIndexOutOfBounds. func Int64Insert(sl *[]int64, elem int64, i int) error { if i < 0 || i > len(*sl) { return ErrIndexOutOfBounds } *sl = append(*sl,...
int64Slices.go
0.628863
0.422803
int64Slices.go
starcoder
package main import ( "log" "sort" ) type HeightMap struct { points [][]int } type Point32 struct { x int y int } func parseHeightMap(data []string) HeightMap { heightMap := HeightMap{[][]int{}} for _, line := range data { heights := []int{} for _, height := range line { heights = append(heights, int...
2021/9.go
0.623721
0.407864
9.go
starcoder
package rpg import ( "log" "time" astar "github.com/beefsack/go-astar" "github.com/faiface/pixel" ) func (e *Entity) pathcalc(target pixel.Vec) { var ( maxcost = 1000.00 ) if !e.calculated.IsZero() && time.Since(e.calculated) < time.Millisecond { return } e.calculated = time.Now() // get tiles, give ...
path.go
0.52683
0.403684
path.go
starcoder
package qr import ( "bytes" "fmt" "rsc.io/qr/gf256" ) type BitBlock struct { DataBytes int CheckBytes int B []byte M [][]byte Tmp []byte RS *gf256.RSEncoder bdata []byte cdata []byte } func newBlock(nd, nc int, rs *gf256.RSEncoder, dat, cdata []byte) *BitBlock {...
models/qr/bitblock.go
0.52829
0.419232
bitblock.go
starcoder
package framework import ( "sigs.k8s.io/kustomize/kyaml/errors" "sigs.k8s.io/kustomize/kyaml/yaml" ) // Selector matches resources. A resource matches if and only if ALL of the Selector fields // match the resource. An empty Selector matches all resources. type Selector struct { // Names is a list of metadata.n...
kyaml/fn/framework/selector.go
0.736116
0.461745
selector.go
starcoder
package ccsitef // ExtratoEletronico serviço/produto const ExtratoEletronico = ` servico: "extrato" versao: "1.6b–Agosto-2007" layout: "ccsitef" remessa: header_arquivo: codigo_registro: pos: [1, 2] picture: "X(2)" default: "A0" versao_layout: pos: [3, 8] picture: "X(6)" ...
layout/ccsitef/extrato.go
0.540681
0.425009
extrato.go
starcoder
package main import ( "sort" "strconv" "strings" ) type Basin struct { points []Point } type Stack []Point func (s *Stack) IsEmpty() bool { return len(*s) == 0 } func (s *Stack) Push(point Point) { *s = append(*s, point) } func (s *Stack) Pop() Point { index := len(*s) - 1 element := (*s)[index] *s = (*s)...
lib/adventofcode/2021/9.go
0.594669
0.424293
9.go
starcoder
package d2 import "fmt" // Rectangler is the interface implemented by objects that can return a // rectangular representation of themselves. type Rectangler interface { Rectangle() Rectangle } // A Rectangle contains the points with Min.X <= X < Max.X, Min.Y <= Y < Max.Y. // It is well-formed if Min.X <= Max.X and...
f64/d2/rect.go
0.912966
0.533154
rect.go
starcoder
package matrix import ( "errors" ) //type Matrix interface { //CountRows() int //CountCols() int //GetElm(i int, j int) float64 //trace() float64 //SetElm(i int, j int, v float64) //add(*Matrix) error //substract(*Matrix) error //scale(float64) //copy() []float64 //diagonalCopy() []float64 //} type Matrix struct ...
data-structures/matrix/matrix.go
0.65202
0.415195
matrix.go
starcoder
package gol import ( "image" "math/rand" "time" ) var ( randSource = rand.NewSource(time.Now().UnixNano()) rnd = rand.New(randSource) ) // World represents the game state type World struct { area [][]bool width int height int } // NewWorld creates a new world func NewWorld(width, height int) *Worl...
gol.go
0.583203
0.478041
gol.go
starcoder
package ihex32 import ( "encoding/binary" "errors" "sync" ) //record stores the data of one line/record of an ihex32 file. type record struct { //rwm is used to coordinate multithreaded reading/writing when applying offsets or calculating checksums. rwm sync.Mutex //byteCount contains the hex string value that ...
ihex32/record.go
0.536313
0.514522
record.go
starcoder
package shimesaba import ( "errors" "log" "sort" "time" "github.com/mashiike/shimesaba/internal/timeutils" ) // Reliability represents a group of values related to reliability per tumbling window. type Reliability struct { cursorAt time.Time timeFrame time.Duration isNoViolation IsNoViolationCollect...
reliability.go
0.626581
0.482429
reliability.go
starcoder
package block import "fmt" // FlowerType represents a type of flower. type FlowerType struct { flower } type flower uint8 // Dandelion is a dandelion flower. func Dandelion() FlowerType { return FlowerType{0} } // Poppy is a poppy flower. func Poppy() FlowerType { return FlowerType{1} } // BlueOrchid is a blue...
server/block/flower_type.go
0.76882
0.522263
flower_type.go
starcoder
package assert import ( "testing" "time" "github.com/ppapapetrou76/go-testing/internal/pkg/values" ) // AssertableDuration is the assertable structure for time.Duration values. type AssertableDuration struct { t *testing.T actual values.DurationValue } // ThatDuration returns an AssertableDuration structu...
assert/duration.go
0.824991
0.735618
duration.go
starcoder
package perseus // InFloat64 returns whether i is in list func InFloat64(i float64, list []float64) bool { for _, b := range list { if b == i { return true } } return false } // IndexFloat64 returns the position of s in list. If s is not found, return -1. func IndexFloat64(s float64, list []float64) int { ...
float64.go
0.852506
0.405302
float64.go
starcoder
package rtree // Delete removes a single record with a matching recordID from the RTree. The // box specifies where to search in the RTree for the record (the search box // must intersect with the box of the record for it to be found and deleted). // The returned bool indicates whether or not the record could be found...
rtree/delete.go
0.666388
0.572185
delete.go
starcoder
package bitvector import ( "fmt" "go/build" ) // MAX_UINT const MAX_UINT = ^uint(0) // MAX_INT const MAX_INT = int(MAX_UINT >> 1) // MAX_SIZE is calculated at compile time var MAX_SIZE = maxSize() // PC64 is used to determine population count, e.g. PC64[i] is the population count of i var PC64 = pc64() // BitVe...
src/bitvector/bitvector.go
0.564579
0.521593
bitvector.go
starcoder
package matrix // Matrix represents a mathematical Matrix. type Matrix struct { Values []float64 // Values of the matrix Rows int // Number of rows Columns int // Number of columns } // ApplyFn represents a function that is applied to the matrix when Apply is called type ApplyFn func(value float64,...
matrix/matrix.go
0.870019
0.784608
matrix.go
starcoder
package modelselection import ( "runtime" "time" "github.com/pa-m/sklearn/base" "gonum.org/v1/gonum/mat" ) // CrossValidateResult is the struct result of CrossValidate. it includes TestScore,FitTime,ScoreTime,Estimator type CrossValidateResult struct { TestScore []float64 FitTime, ScoreTime []time.Dur...
model_selection/validation.go
0.563618
0.407864
validation.go
starcoder
package containerkit import "math" // Interface Hashable is implemented by values providing a HashCode method. // The default generic hash function uses this interface for values that // don't have a specific predefined hash function (e.g. structs) type Hashable interface { HashCode() int } // Interface Comparab...
comparisons.go
0.826607
0.492005
comparisons.go
starcoder
package parse import ( "bytes" "fmt" ) // Tree is the representation of a single parsed SQL statement. type Tree struct { Root BoolExpr lex *lexer depth int } // Parse parses the SQL statement and returns a Tree. func Parse(buf []byte) (*Tree, error) { t := new(Tree) t.lex = new(lexer) return t.Parse(buf)...
vendor/github.com/woodpecker-ci/expr/parse/parse.go
0.677581
0.488222
parse.go
starcoder
package literally //StringPtr takes a string literal and provides a pointer to it func StringPtr(literal string) *string { return &literal } //BoolPtr takes a bool literal and provides a pointer to it func BoolPtr(literal bool) *bool { return &literal } //BytePtr takes byte literal and provides a pointer to it fun...
literally.go
0.654011
0.589805
literally.go
starcoder
package internal import ( "fmt" ) //TicTacToe contains the games state. type TicTacToe struct { currentState turns currentWorld world inputAndOutput bool } //NewTicTacToe creates a new instance of the tictactoe game. func NewTicTacToe() *TicTacToe { newTicTacToe := TicTacToe{} newTicTacToe.currentState = &...
internal/ttt.go
0.52975
0.426381
ttt.go
starcoder
// B illuminant conversion functions // Standard Illuminant B is generally similar to D50 and a 5000 K blackbody radiator (actually closer to 4871 K). package white // B illuminant conversion functions // Standard Illuminant B is generally similar to D50 and a 5000 K blackbody radiator (actually closer to 4871 K). ...
f64/white/b.go
0.625667
0.651189
b.go
starcoder
package gorules import ( "errors" "fmt" "strconv" ) // Value refers to anytype that can be evaluated to a concrete string value type Value interface { Evaluate(interface{}) (string, error) String() string } // Constant is used to hold the string value type Constant struct { value string } // EmptyConstant is ...
value.go
0.750644
0.57344
value.go
starcoder
package baseclient import ( "math" "github.com/SOMAS2020/SOMAS2020/internal/common/shared" ) // DisasterInfo defines the disaster location and magnitude. // These disasters will be stored in PastDisastersDict (maps round number to disaster that occurred) // TODO: Agree with environment team on disaster struct repr...
internal/common/baseclient/iifo.go
0.641647
0.427636
iifo.go
starcoder
package core import ( "github.com/pingcap/errors" "github.com/pingcap/tidb/planner/property" ) // GetPlanCost calculates the cost of the plan if it has not been calculated yet and returns the cost. func (p *basePhysicalPlan) GetPlanCost(taskType property.TaskType) (float64, error) { if p.planCostInit { // just ...
planner/core/plan_cost.go
0.765067
0.474875
plan_cost.go
starcoder
package linkedlist // demonstration of singly linked list in golang import ( "errors" "fmt" ) // Singly structure with length of the list and its head type Singly struct { length int // Note that Node here holds both Next and Prev Node // however only the Next node is used in Singly methods. Head *Node } // N...
structure/linkedlist/singlylinkedlist.go
0.649467
0.450541
singlylinkedlist.go
starcoder
package common import ( "math" "math/rand" ) const ( perlinYwrapb = 4 perlinYwrap = 1 << perlinYwrapb perlinZwrapb = 8 perlinZwrap = 1 << perlinZwrapb perlinSize = 4095 perlinOctaves = 4 perlinAmpFalloff = 0.5 ) // PerlinNoise is a perline noise struct to generate perlin noise. ty...
common/perlinnoise.go
0.776708
0.407039
perlinnoise.go
starcoder
package game import ( "log" "math/rand" "time" ) //Level represents one level of the dungeon type Level struct { cells Cells rooms []*Room monsters []*Monster prevFloorX int prevFloorY int nextFloorX int nextFloorY int } //Cells is a type for a double array of cells type Cells [][]Cell func (c...
game/level.go
0.590189
0.433802
level.go
starcoder
package match import ( "fmt" "net/http" pandascore "github.com/vahill-corp/pandascore-go" ) // Match resources is the interface on the library to interact with the match section of the pandascore API. // More info here : https://developers.pandascore.co/doc/#tag/Matches type Match struct { Backend *pandascore.Ba...
match/client.go
0.647464
0.417331
client.go
starcoder
package flows import ( "analysis/flows" "time" ) type MetricFlowRate struct { // Sampling rate in milliseconds. If equal to zero the // average over the entirety of the flow will be calculated. samplingRate int64 } func newMetricFlowRate() *MetricFlowRate { return &MetricFlowRate{} } func (mfr *MetricFlowRate...
src/analysis/metrics/flows/FlowRate.go
0.750918
0.514705
FlowRate.go
starcoder
package graph import ( "container/list" "fmt" "github.com/DmitryBogomolov/algorithms/graph/internal/utils" ) // Paths is a collection of paths from the source vertex to other vertices. // A path is a sequence of vertices connected by edges. type Paths struct { sourceVertex int vertexCount int edgeTo []i...
graph/graph/paths.go
0.812496
0.50952
paths.go
starcoder
package psbt // The Creator has only one function: // takes a list of inputs and outputs and converts them to // the simplest Psbt, i.e. one with no data appended to inputs or outputs, // but only the raw unsigned transaction in the global section. import ( "github.com/btcsuite/btcd/wire" ) // Creator holds a refe...
psbt/creator.go
0.570212
0.445047
creator.go
starcoder
package main import ( "bufio" "errors" "fmt" "os" "strconv" "time" ) type Puzzle [][]Tile // NewPuzzle returns a blank puzzle with the specified length and width func NewPuzzle(length, width int) Puzzle { p := make(Puzzle, width) for y := 0; y < width; y++ { p[y] = make([]Tile, length) for x := range p[y...
sudoku.go
0.633864
0.40389
sudoku.go
starcoder
package wfc import ( // "fmt" "image" "image/color" ) /** * SimpleTiledModel Type */ type SimpleTiledModel struct { *BaseModel // Underlying model of generic Wave Function Collapse algorithm TileSize int // The size in pixels of the length and height of each tile Tiles []TilePat...
simple-tiled-model.go
0.63273
0.489931
simple-tiled-model.go
starcoder
package physics import ( "fmt" "math" ) type Vector2D struct { X float64 Y float64 } // NewVector2D creates a new Vector2D with supplied x and y components func NewVector2D(x float64, y float64) *Vector2D { return &Vector2D{X: x, Y: y} } // Add returns a new Vector2D of the addition of two vectors. func (v1 *V...
physics/vectors.go
0.927577
0.878575
vectors.go
starcoder
package bexpr import ( "fmt" ) func validateRecurse(ast Expression, fields FieldConfigurations, maxRawValueLength int) (int, error) { switch node := ast.(type) { case *UnaryExpression: switch node.Operator { case UnaryOpNot: // this is fine default: return 0, fmt.Errorf("Invalid unary expression operat...
vendor/github.com/hashicorp/go-bexpr/validate.go
0.651022
0.416381
validate.go
starcoder
package metrics import ( //"fmt" ) // Point represents a single data point for a given timestamp. type Sample struct { T int64 V float64 } // Series is a stream of data points belonging to a metric. type PointSeries struct { Metric Labels Points []float64 evalInterval int64 } func (ps *PointSeries) EvalInterv...
pkg/metrics/functions.go
0.794982
0.563558
functions.go
starcoder
package imports import ( . "reflect" "image" "image/color" ) // reflection: allow interpreted code to import "image" func init() { Packages["image"] = Package{ Binds: map[string]Value{ "Black": ValueOf(&image.Black).Elem(), "Decode": ValueOf(image.Decode), "DecodeConfig": ValueOf(image.DecodeConfig), "E...
vendor/github.com/cosmos72/gomacro/imports/image.go
0.612194
0.443962
image.go
starcoder
package physics import ( "math" "github.com/dayaftereh/discover/server/mathf" ) type RigidBody struct { Mass float64 // World space position of the body. Position *mathf.Vec3 // World space rotational force on the body, around center of mass. Rotation *mathf.Quaternion // World space velocity of the body. ...
server/game/engine/physics/rigidbody.go
0.892744
0.635972
rigidbody.go
starcoder
package qson type ComparisonQuery interface { Query comparisonQueryProof() } type comparisonQuery func(M) M func (q comparisonQuery) Ensure(m M) M { return q(initializer().Ensure(m)) } func (q comparisonQuery) operatorProof() {} func (q comparisonQuery) queryProof() {} func (q comparisonQ...
query_operators_comparison.go
0.853791
0.645246
query_operators_comparison.go
starcoder
package integrationtest /* Goal of this test: Verify that the user specified client name parameter when we create an Election gets set as expected inside the ephemeral node that is created for the client Steps in this test: 1. Create a election resource 2. Create a election client and provide the hostname as...
integrationtest/zk_clientname.go
0.595493
0.515437
zk_clientname.go
starcoder
package rfc2866 import ( "strconv" "fbc/lib/go/radius" ) const ( AcctStatusType_Type radius.Type = 40 AcctDelayTime_Type radius.Type = 41 AcctInputOctets_Type radius.Type = 42 AcctOutputOctets_Type radius.Type = 43 AcctSessionID_Type radius.Type = 44 AcctAuthentic_Type radius.Type = ...
feg/radius/lib/go/radius/rfc2866/generated.go
0.523664
0.434821
generated.go
starcoder
package graph import ( "fmt" "sync" ) var Lock = sync.RWMutex{} //GQueue is a queue which holds GNode type GQueue []*GNode //GStack stores pointers to GNode type GStack []*GNode //GNode represent a node in a graph type GNode struct { id int neighbors []*GNode edges []*Edge } //Edge stores edge inf...
graph/graph.go
0.619701
0.400192
graph.go
starcoder
package file // List provides a listing of files that can be reasoned about with memorybox // semantics. It also satisfies the sort.Sortable interface. type List []*File // Len returns the length of the underlying array. func (l List) Len() int { return len(l) } // Less returns which of two indexes in the array is "...
pkg/file/list.go
0.772402
0.547222
list.go
starcoder
// statemachine package contains the helper code for generating a state machine representing the statement // and expression level of the ES5 generator. package statemachine import ( "fmt" "github.com/serulian/compiler/graphs/typegraph" "github.com/serulian/compiler/compilergraph" "github.com/serulian/compiler/...
generator/es5/statemachine/statemachine.go
0.621885
0.468547
statemachine.go
starcoder
package ast import ( "fmt" "github.com/tabby-lang/tc/token" ) // interface methods func (p Program) TokenLiteral() string { return "Program" } // Statements func (ls AssignStatement) statementNode() {} func (ls AssignStatement) TokenLiteral() string { return "AssignStatement" } func (rs ReturnStatement) s...
ast/ast.go
0.588889
0.470128
ast.go
starcoder
package types import ( "sync" ) type TSafeUint64s interface { // Reset the slice. Reset() // Contains say if "s" contains "values". Contains(...uint64) bool // ContainsOneOf says if "s" contains one of the "values". ContainsOneOf(...uint64) bool // Copy create a new copy of the slice. Copy() TSafeUint64s ...
syncuint64s.go
0.68763
0.427994
syncuint64s.go
starcoder
package tokenizer import ( "fmt" "strings" "github.com/ikawaha/kagome-dict/dict" "github.com/ikawaha/kagome/v2/tokenizer/lattice" ) // TokenClass represents the token class. type TokenClass lattice.NodeClass const ( // DUMMY represents the dummy token. DUMMY = TokenClass(lattice.DUMMY) // KNOWN represents th...
tokenizer/token.go
0.660282
0.486149
token.go
starcoder
package toy import ( "github.com/OpenWhiteBox/primitives/encoding" "github.com/OpenWhiteBox/primitives/gfmatrix" ) // permutation is a byte-wise permutation of a block. type permutation encoding.Shuffle // newPermutation returns an identity permutation. func newPermutation() *permutation { p := &permutation{} f...
cryptanalysis/toy/small_matrix.go
0.809276
0.484868
small_matrix.go
starcoder
package fake var EasypostFakeCreateOrder string var EasypostFakeBuyOrder string func init() { EasypostFakeCreateOrder = ` { "id": "order_b39d44e7059a46c8a787174e8320bf1c", "mode": "test", "reference": null, "is_return": false, "options": {"currency": "USD","label_date": null}, "messages": [], "...
fake/orderFake.go
0.562777
0.4231
orderFake.go
starcoder
// Package elliptic implements several standard elliptic curves over prime // fields. package elliptic // This package operates, internally, on Jacobian coordinates. For a given // (x, y) position on the curve, the Jacobian coordinates are (x1, y1, z1) // where x = x1/z1² and y = y1/z1³. The greatest speedups come wh...
src/crypto/elliptic/elliptic.go
0.865523
0.721375
elliptic.go
starcoder
package mlpack /* #cgo CFLAGS: -I./capi -Wall #cgo LDFLAGS: -L. -lmlpack_go_nca #include <capi/nca.h> #include <stdlib.h> */ import "C" import "gonum.org/v1/gonum/mat" type NcaOptionalParam struct { ArmijoConstant float64 BatchSize int Labels *mat.Dense LinearScan bool MaxIterations int Max...
nca.go
0.669421
0.530358
nca.go
starcoder
package wltree import ( "fmt" "github.com/mozu0/bitvector" "github.com/mozu0/huffman" ) // Interface is a interface for arraylike elements that can be indexed by Wavelet Tree. // Equal elements must have the same key, and different elements must have different keys. type Interface interface { // Len returns the ...
pkg/internal/wltree/wltree.go
0.670824
0.514583
wltree.go
starcoder