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 roleutil import ( "sort" "github.com/bwmarrin/discordgo" ) // SortRoles sorts a given array of discordgo.Role // object references by position in ascending order. // If reversed, the order is descending. func SortRoles(r []*discordgo.Role, reversed bool) { var f func(i, j int) bool if reversed { f = f...
pkg/roleutil/roleutil.go
0.725065
0.409929
roleutil.go
starcoder
package one4 // num can represent the mantissa as well as the sign bit. Note that there need // only be as many didits as `prec` (the precision) however. Due to prec, to // get a full range of reperesentaiton of digits, we need pow, so that // `base`^`pow` gives the appropriate number. type Float struct { num Int ...
Float.go
0.792344
0.685288
Float.go
starcoder
package masapi /*************** Business Display and Logic Layer for Interest Rate Module ****************/ //Initialised a Financial for controller var customisedFinancialPeriod = InitiatizeFinancialPeriod("","") //This attribute is stop situation where financial period yields 0 result var customisedFinancialPerio...
internal/masapi/finance_controller.go
0.598312
0.447823
finance_controller.go
starcoder
package main var schemas = ` { "API": { "createAsset": { "description": "Create an asset. One argument, a JSON encoded event. The 'assetID' property is required with zero or more writable properties. Establishes an initial asset state.", "properties": { "args": { ...
contracts/advanced/iot_sample_contract/schemas.go
0.868199
0.522568
schemas.go
starcoder
package interpreter import ( "github.com/influxdata/flux/values" ) type Scope interface { // Lookup a name in the current scope Lookup(name string) (values.Value, bool) // Bind a variable in the current scope Set(name string, v values.Value) // Create a new scope by nesting the current scope // If the passed...
interpreter/scope.go
0.669313
0.504455
scope.go
starcoder
package main import ( "math" "github.com/ewancook/reactor/thermo" ) func dFCH4dW(T, denominator float64, partials map[string]float64) float64 { return -reaction1(T, denominator, partials) - reaction3(T, denominator, partials) } func dFH2OdW(T, denominator float64, partials map[string]float64) float64 { return -...
ode.go
0.798305
0.403009
ode.go
starcoder
package utils import ( "errors" "regexp" "strings" ) const variableNamingRegexPattern = `([a-zA-Z0-9\-\_]+)` const descriptionNamingRegexPattern = `([a-zA-Z]+[a-zA-Z0-9\-\_ ]*)` const variableDeclarationRegexPattern = `^< *` + variableNamingRegexPattern + ` *\| *` + descriptionNamingRegexPattern + ` *>$` const var...
internal/utils/parsers.go
0.806014
0.430447
parsers.go
starcoder
package schedule import ( "fmt" "github.com/marcsantiago/gocron" "strings" "time" ) // Definition holds the data defining a schedule definition type Definition struct { // Internal value (every 1 minute would be expressed with an interval of 1). Must be set explicitly or implicitly (a weekday value implicitly se...
schedule/schedule.go
0.788176
0.477676
schedule.go
starcoder
package document import ( "bytes" "encoding/json" "errors" "io" "reflect" ) // ErrValueNotFound must be returned by Array implementations, when calling the GetByIndex method and // the index wasn't found in the array. var ErrValueNotFound = errors.New("value not found") // An Array contains a set of values. typ...
document/array.go
0.694924
0.422624
array.go
starcoder
package object import ( "fmt" "hash/fnv" ) // A structure that represents a Null object type Null struct{} // A method of Null that returns the Null value type func (n *Null) Type() ObjectType { return NULL_OBJ } // A method of Null that returns the string value of the Null func (n *Null) Inspect() string { retur...
object/datatypes.go
0.81648
0.436442
datatypes.go
starcoder
package trieutil import ( "bytes" "encoding/binary" "errors" "fmt" protodb "github.com/prysmaticlabs/prysm/proto/beacon/db" "github.com/prysmaticlabs/prysm/shared/bytesutil" "github.com/prysmaticlabs/prysm/shared/hashutil" "github.com/prysmaticlabs/prysm/shared/mathutil" ) // SparseMerkleTrie implements a sp...
.docker/Prysm/prysm-spike/shared/trieutil/sparse_merkle.go
0.695235
0.413418
sparse_merkle.go
starcoder
package nock import ( "strconv" "strings" ) // A Noun is an atom or a cell. An atom is any natural number. A cell is any // ordered pair of nouns. type Noun struct { atom *int cell *[2]Noun } // IsAtom returns true if n is an atom. func (n Noun) IsAtom() bool { return n.atom != nil } // IsCell returns true if n...
nock.go
0.710929
0.620794
nock.go
starcoder
package display import ( "fmt" mgl "github.com/go-gl/mathgl/mgl32" "github.com/inkyblackness/shocked-model" "github.com/inkyblackness/shocked-client/graphics" "github.com/inkyblackness/shocked-client/opengl" ) var mapTileSlopeVertexShaderSource = ` #version 150 precision mediump float; in vec3 vertexPosition...
src/github.com/inkyblackness/shocked-client/editor/display/TileSlopeMapRenderable.go
0.786049
0.510558
TileSlopeMapRenderable.go
starcoder
package tensor import ( "github.com/pkg/errors" "gorgonia.org/tensor/internal/storage" ) var ( _ MinBetweener = StdEng{} _ MaxBetweener = StdEng{} ) func (e StdEng) MinBetween(a Tensor, b Tensor, opts ...FuncOpt) (retVal Tensor, err error) { if err = binaryCheck(a, b, ordTypes); err != nil { return nil, erro...
defaultengine_minmax.go
0.525369
0.532243
defaultengine_minmax.go
starcoder
package basic // PMapIONumber is template to generate itself for different combination of data type. func PMapIONumber() string { return ` func TestPmap<FINPUT_TYPE><FOUTPUT_TYPE>(t *testing.T) { // Test : add 1 to the list expectedList := []<OUTPUT_TYPE>{2, 3, 4} newList := PMap<FINPUT_TYPE><FOUTPUT_TYPE>(plusOne...
internal/template/basic/pmapiotest.go
0.602997
0.495606
pmapiotest.go
starcoder
package iso20022 // Tax related to an investment fund order. type InformativeTax1 struct { // Amount included in the dividend that corresponds to gains directly or indirectly derived from interest payment in the scope of the European Directive on taxation of savings income in the form of interest payments. TaxableI...
InformativeTax1.go
0.791821
0.64607
InformativeTax1.go
starcoder
package otkafka import ( "time" "github.com/go-kit/kit/metrics" "github.com/segmentio/kafka-go" ) type readerCollector struct { factory ReaderFactory stats *ReaderStats interval time.Duration } // ThreeStats is a gauge group struct. type ThreeStats struct { Min metrics.Gauge Max metrics.Gauge Avg metri...
otkafka/reader_metrics.go
0.568775
0.539226
reader_metrics.go
starcoder
package nbs import ( "fmt" "github.com/dolthub/dolt/go/store/metrics" ) type Stats struct { OpenLatency metrics.Histogram CommitLatency metrics.Histogram IndexReadLatency metrics.Histogram IndexBytesPerRead metrics.Histogram GetLatency metrics.Histogram ChunksPerGet metrics.Histogram FileReadLatenc...
go/store/nbs/stats.go
0.504639
0.627609
stats.go
starcoder
package synthetics import ( "encoding/json" "time" ) // V202101beta1Health struct for V202101beta1Health type V202101beta1Health struct { Health *string `json:"health,omitempty"` Time *time.Time `json:"time,omitempty"` } // NewV202101beta1Health instantiates a new V202101beta1Health object // This construc...
kentikapi/synthetics/model_v202101beta1_health.go
0.73431
0.400486
model_v202101beta1_health.go
starcoder
package main import ( "strconv" "github.com/prometheus/client_golang/prometheus" "github.com/sirupsen/logrus" ) type ipvsCollector struct { metrics map[string]*ipvsMetric } type ipvsMetric struct { Desc *prometheus.Desc ValType prometheus.ValueType } //NewIpvsCollector a new ipvsCollector instance func Ne...
exporter.go
0.683208
0.42483
exporter.go
starcoder
package polygo /* This file contains polynomial solvers and related algorithms. */ import ( "errors" ) // CountRootsWithin returns the number of roots of the current instance on the closed interval [a, b]. // If there are an infinite amount of roots, -1 is returned. func (rp *RealPolynomial) CountRootsW...
solve.go
0.836655
0.538983
solve.go
starcoder
package util import ( "io" "math" "github.com/attestantio/go-execution-client/types" ) // Encodings are based upon the rules at https://eth.wiki/en/fundamentals/rlp // singleBytes contains byte slices of single byte values, to reduce memory allocations. var singleBytes = [][]byte{ {0x00}, {0x01}, {0x02}, {0x03...
util/rlphelpers.go
0.571049
0.640833
rlphelpers.go
starcoder
package factor import ( "github.com/jesand/stats" "github.com/jesand/stats/dist" "github.com/jesand/stats/variable" ) // A connecting node in a factor graph. A factor is a node with edges to // random variable nodes, and which has a corresponding function to score the // values of those random variables. type Fact...
factor/factor.go
0.7478
0.53783
factor.go
starcoder
package core import "unsafe" // TextureTarget specifies a texture target type (1D, 2D, 2DArray, Cubemap, etc) type TextureTarget int // TextureTargetXXX are the different texture types const ( TextureTarget1D TextureTarget = iota TextureTarget1DArray TextureTarget2D TextureTarget2DArray TextureTargetCubemapXPos...
core/texture.go
0.526586
0.483222
texture.go
starcoder
package metricsext import ( "time" "github.com/cep21/gometrics/metrics" ) // DurationObserver wraps an observer to allow reporting durations, rather than flat float64 objects type DurationObserver struct { observer metrics.Observer } // Observe reports to the wrapped observer the duration as a Second time value ...
metrics/metricsext/basehelpers.go
0.89924
0.460168
basehelpers.go
starcoder
package view import ( "fmt" "github.com/protolambda/ztyp/codec" . "github.com/protolambda/ztyp/tree" ) type BasicVectorTypeDef struct { ElemType BasicTypeDef VectorLength uint64 ComplexTypeBase } func BasicVectorType(elemType BasicTypeDef, length uint64) *BasicVectorTypeDef { size := length * elemType.Typ...
view/basic_vector.go
0.54698
0.497986
basic_vector.go
starcoder
package rules import "github.com/butuzov/mirror/internal/checker" func NewBytesChecker() *checker.Checker { return checker.New("bytes"). WithFunctions(BytesFunctions). WithStructMethods("bytes.Buffer", BytesBufferMethods) } var ( BytesFunctions = map[string]checker.Violation{ "NewBuffer": { Type: ...
internal/rules/bytes.go
0.646237
0.411702
bytes.go
starcoder
package bayes import ( "github.com/WinPooh32/math" "github.com/WinPooh32/ml" ) type ( DType = ml.DType Class = ml.Class Column = ml.Column Row = ml.Row ) type NaiveBayes struct { classes []string dim int prob []DType mean []Row variance []Row } func New(classes []string, prob []DType, ...
bayes/bayes.go
0.568176
0.400427
bayes.go
starcoder
package main import ( "github.com/DarkFighterLuke/covidgraphs" "log" "strconv" "time" ) // Returns the caption for the national trend plot image func setCaptionAndamentoNazionale() string { lastIndex := len(nationData) - 1 _, nuoviTotale := covidgraphs.CalculateDelta(nationData[lastIndex-1].Totale_positivi, nat...
captions.go
0.527073
0.503601
captions.go
starcoder
package mandelbrot import ( "image" "image/color" "sync" ) type pointLocation complex128 // If |current|^2 > max then we know that the point is _not_ in // the Mandelbrot set. const max float64 = 4.0 const maxIterations = 5000 func newPointLocation(r float64, i float64) pointLocation { return pointLocation(comp...
mandelbrot.go
0.777553
0.468791
mandelbrot.go
starcoder
package telemetry import ( "github.com/prometheus/client_golang/prometheus" ) // Counter tracks how many times something is happening. type Counter interface { // Initialize creates the counter with the given tags and initializes it to 0. // This method is intended to be used when the counter value is important t...
pkg/telemetry/counter.go
0.687105
0.409427
counter.go
starcoder
package netconf import ( "time" ) // NetworkEpoch globally defines a verification epoch (signing plus validation // epoch) on the network. type NetworkEpoch struct { QuorumM uint64 // the quorum NumberOfMintsN uint64 // total number of mints SignStart time.Time // start o...
netconf/network_epoch.go
0.734881
0.441673
network_epoch.go
starcoder
package multiregexp import ( "regexp" ) // Regexps is a set of regular expression. type Regexps []*regexp.Regexp // Match reports whether the byte slice b contains any match in the set of the regular expression res. // When matchType is AND, the result of each match will be logically joined with AND. // Otherwise t...
multiregexp.go
0.721253
0.484197
multiregexp.go
starcoder
package yologo import ( "fmt" "github.com/chewxy/hm" "github.com/pkg/errors" "gorgonia.org/gorgonia" "gorgonia.org/tensor" ) // Wrap yoloOp type yoloDiffOp struct { yoloOp } /* Methods to match gorgonia.Op interface */ func (op *yoloDiffOp) Arity() int { return 2 } func (op *yoloDiffOp) Type() hm.Type { a :=...
yolo_diff_op.go
0.549882
0.443239
yolo_diff_op.go
starcoder
package position import ( "fmt" "strings" "unicode/utf8" ) //Position represents the position of a character in a file. type Position struct { Offset int Line int Column int } //Increment is an incrementer of positions type Increment = Position //IsValid returns true if the position is valid. //To be valid,...
position/position.go
0.723212
0.471041
position.go
starcoder
package rawp import ( "fmt" "image" "image/color" "image/draw" "reflect" imageExt "github.com/chai2010/image" colorExt "github.com/chai2010/image/color" ) type pixDecoder struct { Channels int // 1/2/3/4 DataType reflect.Kind // Uint8/Uint16/Int32/Int64/Float32/Float64 Width int // ne...
rawp/pix_decode.go
0.52975
0.513181
pix_decode.go
starcoder
package array // arrTypes is a list of all the types that can be used in arrays. type arrTypes interface { ~bool | ~uint | ~uint16 | ~uint32 | ~uint64 | ~int8 | ~int | ~int16 | ~int64 | ~float32 | ~float64 | ~complex64 | ~complex128 | ~uintptr | ~string | ~rune | ~byte } // In returns the index of the first element ...
array/array.go
0.651909
0.511534
array.go
starcoder
package rs485 import ( "github.com/volkszaehler/mbmd/encoding" ) // RTUTransform functions convert RTU bytes to meaningful data types. type RTUTransform func([]byte) float64 // RTUIeee754ToFloat64 converts 32 bit IEEE 754 float readings func RTUIeee754ToFloat64(b []byte) float64 { return float64(encoding.Float32(b...
meters/rs485/transform.go
0.767603
0.489931
transform.go
starcoder
package pl // BuiltInPkg is the package name of the builtin package. const BuiltInPkg = "/std/asm/builtin" // BuiltInSrc is the file that needs to be presented // as /std/asm/builtin/builtin.s const BuiltInSrc = ` // a char is sent in via r1 func PrintChar { // use r2 and r3 addi sp sp -8 sw r2 sp sw r3 sp 4 or...
pl/builtin_s.go
0.602646
0.431584
builtin_s.go
starcoder
package storage import "github.com/prometheus/prometheus/pkg/labels" // Boilerplate on purpose. Generics some day... type genericQuerierAdapter struct { baseQuerier // One-of. If both are set, Querier will be used. q Querier cq ChunkQuerier } type genericSeriesSetAdapter struct { SeriesSet } func (a *generic...
storage/generic.go
0.765155
0.482795
generic.go
starcoder
package intelhex import ( "fmt" "io" "strconv" ) func isContiguous(b1, b2 ByteBlock) bool { return (b1.Address+uint16(len(b1.Data)) == b2.Address) || (b2.Address+uint16(len(b2.Data)) == b1.Address) } // assumes blocks are contiguous - order of supplied blocks not important func joinByteBlocks(b1, b2 ByteBlock)...
impl.go
0.548915
0.400105
impl.go
starcoder
package main import ( "github.com/thoas/go-funk" ) // Map x to map of y to 'isBlack' bool type tileMap map[int]map[int]bool func (t *tileMap) getBlackTiles() int { blackTiles := 0 for _, x := range *t { for _, isBlack := range x { if isBlack { blackTiles++ } } } return blackTiles } func (t *tileM...
calendar/day24/tile.go
0.625667
0.433862
tile.go
starcoder
package slog // region --- INFO Level Sugars --- // Note logs out a message in INFO level and with Operation NOTE. Returns an instance of operation NOTE func (i *slogInstance) Note(str interface{}, v ...interface{}) Instance { return i.clone().incStackOffset().Operation(NOTE).Info(str, v...) } // Await logs out a me...
instancesugars.go
0.625438
0.492066
instancesugars.go
starcoder
package core import ( "math/rand" ) const ShapePieces = 4 type Piece = int const ( IShape Piece = iota + 1 JShape LShape OShape SShape TShape ZShape ShapesCount ) // movement directions const ( Left int = iota - 1 Center Right // also used for down ) type Point struct { X, Y int } // Shape is a typ...
core/shape.go
0.649134
0.471041
shape.go
starcoder
package nodes import ( "github.com/wdevore/RangerGo/api" "github.com/wdevore/RangerGo/engine/geometry" "github.com/wdevore/RangerGo/engine/maths" ) // Transform holds the transform properties and methods. type Transform struct { position api.IPoint rotation float64 scale api.IPoint aft api.IAffineTrans...
engine/nodes/transform.go
0.890788
0.512876
transform.go
starcoder
package containers import ( "time" "github.com/influxdata/telegraf" ) // Accumulator is an implementation of telegraf.Accumulator. It passes all // calls through to its inner accumulator, but adds a container_id tag to any // metric on the way through. type Accumulator struct { Accumulator *telegraf.Accumulator ...
plugins/inputs/dcos_statsd/containers/accumulator.go
0.727395
0.506286
accumulator.go
starcoder
package query import ( "fmt" "github.com/gallactic/gallactic/core/consensus/tendermint" "github.com/gallactic/gallactic/crypto" "github.com/gallactic/gallactic/txs" "github.com/tendermint/tendermint/consensus" consensusTypes "github.com/tendermint/tendermint/consensus/types" tmEd25519 "github.com/tendermint/te...
core/consensus/tendermint/query/node_view.go
0.54577
0.457561
node_view.go
starcoder
package types // Contains any policy cache related functionality // This functionality is used in handlers to implement the policy management component import ( "sync" fTypes "github.com/openfaas/faas-provider/types" log "github.com/sirupsen/logrus" ) // The Policy structure expresses constraints and features th...
types/policy.go
0.614972
0.400573
policy.go
starcoder
package sqlparser import ( "fmt" "regexp" "strings" "github.com/author/sqlparser/query" ) // Parse takes a string representing a SQL query and parses it into a query.Query struct. It may fail. func Parse(sqls string) (query.Query, error) { qs, err := ParseMany([]string{sqls}) if len(qs) == 0 { return query.Q...
sql.go
0.55929
0.437763
sql.go
starcoder
package apitest import ( "context" "sync" "testing" "time" "go.opentelemetry.io/otel/api/trace" "go.opentelemetry.io/otel/codes" "go.opentelemetry.io/otel/internal/matchers" "go.opentelemetry.io/otel/label" ) type Harness struct { t *testing.T } func NewHarness(t *testing.T) *Harness { return &Harness{ ...
api/apitest/harness.go
0.622
0.534795
harness.go
starcoder
package models import ( i336074805fc853987abe6f7fe3ad97a6a6f3077a16391fec744f671a015fbd7e "time" i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91 "github.com/microsoft/kiota-abstractions-go/serialization" ) // RiskDetection type RiskDetection struct { Entity // Indicates the activity...
models/risk_detection.go
0.734976
0.48438
risk_detection.go
starcoder
package slang import ( "fmt" "reflect" "strings" ) // LangType base type to interface with the language types of slang. type LangType interface{} // Algebraic is an interface for algebraic operations. Types that implement this interface can // overload the behavior of an "algebraic" operator (+, -, *, /). Only Al...
primitives.go
0.831964
0.487673
primitives.go
starcoder
package weatherhist import ( "time" "strconv" "github.com/PuerkitoBio/goquery" "github.com/pkg/errors" ) const DailyPath = "daily_%s1.php" type Daily struct { Days []Day `json:"days"` } type StringWithQuality struct { Value *string IsBadQuality bool } type FloatWithQuality struct { Value *f...
daily.go
0.601945
0.427636
daily.go
starcoder
package geography import ( "math" ) var emptyBound = Bound{Min: Point{1, 1}, Max: Point{-1, -1}} type Bound struct { Min Point Max Point } func (b Bound) ToGeom() Geom { return b } func (b Bound) Clip(bound Bound) Geom { return Bound{ Min: Point{ math.Max(b.Min[0], bound.Min[0]), math.Max(b.Min[1], bo...
geom_bound.go
0.751192
0.673651
geom_bound.go
starcoder
package extend import ( "fmt" "github.com/matrixorigin/matrixone/pkg/container/types" "github.com/matrixorigin/matrixone/pkg/sql/colexec/extend/overload" ) var FunctionRegistry = map[string]int{} var UnaryReturnTypes = map[int]func(Extend) types.T{ overload.UnaryMinus: func(e Extend) types.T { return e.Return...
pkg/sql/colexec/extend/extend.go
0.516352
0.454654
extend.go
starcoder
package benchmark import ( "reflect" "testing" ) func isBoolToInt8FuncCalibrated(supplier func() bool) bool { return isCalibrated(reflect.Bool, reflect.Int8, reflect.ValueOf(supplier).Pointer()) } func isIntToInt8FuncCalibrated(supplier func() int) bool { return isCalibrated(reflect.Int, reflect.Int8, reflect.Va...
common/benchmark/03_to_int8_func.go
0.694821
0.737501
03_to_int8_func.go
starcoder
package tpch import ( "database/sql" "fmt" "math" "strconv" ) type precision int const ( str precision = iota sum avg cnt num rat ) var queryColPrecisions = map[string][]precision{ // Comment 4: In cases where validation output data is from the aggregate SUM(l_quantity) (e.g. queries 1 and 18), // the p...
tpch/check.go
0.579162
0.443841
check.go
starcoder
package bitcoin import ( "encoding/binary" "encoding/hex" "bitbucket.org/simon_ordish/cryptolib" ) type input struct { hash [32]byte // The previous utxo being spent. index uint32 // The previous utxo index being spent. unlockingScript []byte // A script-language script which satisfies...
scratch.go
0.696165
0.460774
scratch.go
starcoder
package pure import ( "context" "encoding/json" "fmt" jmespath "github.com/jmespath/go-jmespath" "github.com/benthosdev/benthos/v4/internal/bundle" "github.com/benthosdev/benthos/v4/internal/component/processor" "github.com/benthosdev/benthos/v4/internal/docs" "github.com/benthosdev/benthos/v4/internal/log" ...
internal/impl/pure/processor_jmespath.go
0.600657
0.615319
processor_jmespath.go
starcoder
package nbtconv import ( "github.com/df-mc/dragonfly/server/block/cube" "github.com/df-mc/dragonfly/server/item" "github.com/df-mc/dragonfly/server/world" "github.com/go-gl/mathgl/mgl64" ) // MapSlice reads an interface slice from a map at the key passed. func MapSlice(m map[string]any, key string) []any { b, _ ...
server/internal/nbtconv/mapread.go
0.721351
0.440108
mapread.go
starcoder
package metrics import ( "sync" "time" "github.com/palantir/go-metrics" ) // getOrRegisterMicroSecondsTimer returns an existing Timer or constructs and registers a new microSecondsTimer. // Be sure to unregister the meter from the registry once it is of no use to allow for garbage collection. // Based on metrics...
vendor/github.com/palantir/pkg/metrics/microsecondstimer.go
0.902475
0.410815
microsecondstimer.go
starcoder
package spriteutils import ( "github.com/hajimehoshi/ebiten" "image" "math" ) // SimpleSprite is a sprite interface with methods to draw and update type SimpleSprite interface { // Update the sprite Update() // Draw the sprite to screen Draw(screen *ebiten.Image) error } // Sprite represents an image with pos...
sprite.go
0.823009
0.601974
sprite.go
starcoder
//go:build gofuzz // +build gofuzz package uint256 import ( "fmt" "math/big" "reflect" "runtime" "strings" ) const ( opUdivrem = iota opMul opLsh opAdd opSub opMulmod ) type opDualArgFunc func(*Int, *Int, *Int) *Int type bigDualArgFunc func(*big.Int, *big.Int, *big.Int) *big.Int type opThreeArgFunc fun...
vendor/github.com/holiman/uint256/fuzz.go
0.520009
0.434341
fuzz.go
starcoder
package rtfdoc import ( "fmt" "strings" ) // SetMarginLeft function sets Table left margin func (t *Table) SetMarginLeft(value int) *Table { t.marginLeft = value return t } // SetMarginRight function sets Table right margin func (t *Table) SetMarginRight(value int) *Table { t.marginRight = value return t } //...
table.go
0.721841
0.405154
table.go
starcoder
package main import ( "github.com/gen2brain/raylib-go/raylib" ) const ( maxColumns = 20 ) func main() { rl.InitWindow(800, 450, "raylib [core] example - 3d camera first person") camera := rl.Camera3D{} camera.Position = rl.NewVector3(4.0, 2.0, 4.0) camera.Target = rl.NewVector3(0.0, 1.8, 0.0) camera.Up = rl....
examples/core/3d_camera_first_person/main.go
0.593138
0.417212
main.go
starcoder
package columns import ( "fmt" ) // CategoryIDColumn is the wrapper of `tf.feature_column.categorical_column_with_identity` type CategoryIDColumn struct { Key string BucketSize int Delimiter string Dtype string } // SequenceCategoryIDColumn is the wrapper of `tf.feature_column.sequence_categorical...
pkg/sql/columns/category_id_column.go
0.698227
0.433802
category_id_column.go
starcoder
package dsp import ( "math" ) // Spectrum is an audio spectrum in a buffer type Spectrum struct { Bins []Bin // bins for processing SampleSize int // number of samples per slice binCount int // number of bins we look at fftSize int // number of fft bins OldValues...
dsp/spectrum.go
0.72662
0.431285
spectrum.go
starcoder
package colorthief import ( "github.com/wattb/imt" ) const sigbits = 5 const rshift = 8 - sigbits const max_iteration = 1000 const fract_by_populations = 0.75 func getColorIndex(r, g, b int) int { return (r << 2 * sigbits) + (g << sigbits) + b } // getHistogram outputs a map with the number of pixels in each quan...
mccq.go
0.571408
0.410756
mccq.go
starcoder
package framework import ( "fmt" "io/ioutil" "os" "strings" "time" "github.com/loft-sh/devspace/e2e/new/kube" "github.com/onsi/gomega" "github.com/pkg/errors" "k8s.io/apimachinery/pkg/util/wait" ) // ExpectEqual expects the specified two are the same, otherwise an exception raises func ExpectEqual(actual in...
e2e/new/framework/helper.go
0.688678
0.509337
helper.go
starcoder
package memory import ( "io" "sort" "github.com/jccatrinck/cartesian/services/points" "github.com/jccatrinck/cartesian/services/points/model" ) type memoryPoints struct { points []model.Point xAxis []int yAxis []int } // LoadPoints implements points.Storage interface func (m *memoryPoints) LoadPoints(reade...
storage/memory/points.go
0.759939
0.405213
points.go
starcoder
package pack3d import "github.com/fogleman/fauxgl" type Tree []fauxgl.Box func NewTreeForMesh(mesh *fauxgl.Mesh, depth int) Tree { mesh = mesh.Copy() mesh.Center() boxes := make([]fauxgl.Box, len(mesh.Triangles)) for i, t := range mesh.Triangles { boxes[i] = t.BoundingBox() } root := NewNode(boxes, depth) t...
pack3d/bvh.go
0.599954
0.466967
bvh.go
starcoder
package mapping import ( "bytes" "errors" "fmt" "math" enc "github.com/KoddiDev/sketches-go/ddsketch/encoding" "github.com/KoddiDev/sketches-go/ddsketch/pb/sketchpb" ) const ( A = 6.0 / 35.0 B = -3.0 / 5.0 C = 10.0 / 7.0 ) // A fast IndexMapping that approximates the memory-optimal LogarithmicMapping by e...
ddsketch/mapping/cubically_interpolated_mapping.go
0.873849
0.441191
cubically_interpolated_mapping.go
starcoder
// Package co provides holiday definitions for Colombia. package co import ( "time" "github.com/Tamh/cal/v2" "github.com/Tamh/cal/v2/aa" ) var ( // AñoNuevo represents New Year's Day on 1-Jan AñoNuevo = aa.NewYear.Clone(&cal.Holiday{Name: "Año Nuevo", Type: cal.ObservancePublic}) // Reyes represents Epiphany...
v2/co/co_holidays.go
0.522446
0.644141
co_holidays.go
starcoder
package lo // Keys creates an array of the map keys. func Keys[K comparable, V any](in map[K]V) []K { result := make([]K, 0, len(in)) for k := range in { result = append(result, k) } return result } // Values creates an array of the map values. func Values[K comparable, V any](in map[K]V) []V { result := mak...
vendor/github.com/samber/lo/map.go
0.892375
0.464659
map.go
starcoder
package bayesfactor import ( "math" . "pkg/distributions" ) func CreateLikelihood(likelihood LikelihoodDefinition) Likelihood { var data Likelihood switch likelihood.Name { case "noncentral_d": d := likelihood.Params[0] n := likelihood.Params[1] fun := NoncentralDLikelihood(d, n) data.Function = fun ...
pkg/bayesfactor/bayesfactor.go
0.784402
0.683169
bayesfactor.go
starcoder
package band import "time" func newUS902Band() (Band, error) { band := Band{ DefaultTXPower: 20, ImplementsCFlist: false, RX2Frequency: 923300000, RX2DataRate: 8, MaxFCntGap: 16384, ADRACKLimit: 64, ADRACKDelay: 32, ReceiveDelay1: time.Second, ReceiveDelay2: time.S...
vendor/github.com/brocaar/lorawan/band/band_us902_928.go
0.525856
0.42919
band_us902_928.go
starcoder
package svgshapes import ( "encoding/xml" "strconv" ) type Path struct { XMLName xml.Name `xml:"path"` Shapebase PathCommands string `xml:"d,attr"` } func (p *Path) addCommand(command string, parameters ...float64) { cmdString := command for _, param := range parameters { cmdString += " " + strconv.FormatFl...
path.go
0.731634
0.416381
path.go
starcoder
package symdiff import ( "errors" "reflect" "unsafe" ) var ( ErrDifferentArgumentsTypes = errors.New("src and dst must be of same type") ErrNilArguments = errors.New("src and dst must not be nil") ) // During deepSymmetricDifference, we need to keep track of // checks that are in progress. The compar...
diff.go
0.581065
0.427217
diff.go
starcoder
package GoSmartSearch import ( "fmt" "sort" "strings" ) type stringResult struct { value string accuracy float32 } // SearchInMaps returns a map slice formed by the input elements ordered (based on the key) from most to least similar to the input term func SearchInMaps(elements []map[string]string, term, key...
GoSmartSearch.go
0.737253
0.47171
GoSmartSearch.go
starcoder
package layers import ( "math" "gitlab.com/akita/dnn/tensor" "gitlab.com/akita/mgpusim/driver" ) // Vector represents a 1D array stored in the GPU memory. type Vector struct { size int ptr driver.GPUPtr GPUDriver *driver.Driver GPUCtx *driver.Context } // Init intialized the data and the size o...
benchmarks/dnn/layers/vector.go
0.699357
0.567577
vector.go
starcoder
package formula import ( "fmt" "math" ) // BinOpType is the binary operation operator type //go:generate stringer -type=BinOpType type BinOpType byte // Operator type constants const ( BinOpTypeUnknown BinOpType = iota BinOpTypePlus BinOpTypeMinus BinOpTypeMult BinOpTypeDiv BinOpTypeExp BinOpTypeLT BinOpT...
spreadsheet/formula/binaryexpr.go
0.505127
0.417746
binaryexpr.go
starcoder
package gos7 import ( "bytes" "encoding/binary" "fmt" "math" "strconv" "time" ) const ( bias int64 = 621355968000000000 // "decimicros" between 0001-01-01 00:00:00 and 1970-01-01 00:00:00 ) //Helper the helper to get/set value from/to byte array with difference types type Helper struct{} //SetValueAt set a v...
helper.go
0.594316
0.472014
helper.go
starcoder
package longtitude import ( "fmt" "math" ) // Longtitude stores a numeric coordinate referencing a celestial bodies X axis. type Longtitude float32 // Absolute returns the numeric value held by the Longtitude pointer to an absolute number. func (longtitude *Longtitude) Absolute() float32 { return float32(math.Abs...
longtitude/longtitude.go
0.929616
0.805364
longtitude.go
starcoder
package types import ( "io" "regexp" "strings" "github.com/lyraproj/issue/issue" "github.com/lyraproj/pcore/px" ) type typedName struct { namespace px.Namespace authority px.URI name string canonical string parts []string } var TypedNameMetaType px.Type func init() { TypedNameMetaType = newObje...
types/typedname.go
0.516595
0.424472
typedname.go
starcoder
package sort import "math/rand" // Bubble sort algorithm func Bubble(slice []int) { swapped := true for swapped { swapped = false for idx := 0; idx < len(slice)-1; idx++ { if slice[idx] > slice[idx+1] { slice[idx], slice[idx+1] = slice[idx+1], slice[idx] swapped = true } } } } // Selection so...
sort.go
0.605216
0.434881
sort.go
starcoder
package tree import ( "context" "fmt" "strings" "github.com/pbanos/botanic/feature" "github.com/pbanos/botanic/set" ) // Tree represents a a regression tree. It is composed of a // NodeStore where all its nodes are stored, the id for the // root node of the tree and the classFeature it is able to // predict. ty...
tree/tree.go
0.664758
0.462534
tree.go
starcoder
package openapi import ( "encoding/json" ) // KinesisIntegration struct for KinesisIntegration type KinesisIntegration struct { AwsAccessKey *AwsAccessKey `json:"aws_access_key,omitempty"` AwsRole *AwsRole `json:"aws_role,omitempty"` } // NewKinesisIntegration instantiates a new KinesisIntegration object // This...
openapi/model_kinesis_integration.go
0.747708
0.415907
model_kinesis_integration.go
starcoder
package svg import ( "fmt" "github.com/go-gl/mathgl/mgl32" "reflect" ) type PathData interface { fmt.Stringer empty_PathData() } // https://www.w3.org/TR/SVG2/paths.html#PathDataMovetoCommands type ( AbsoluteMoveTo struct { Arg []mgl32.Vec2 } RelativeMoveTo struct { Arg []mgl32.Vec2 } ) func (AbsoluteM...
tools/svg/Path.go
0.523908
0.417034
Path.go
starcoder
package document import ( "fmt" "sort" "strings" ) // Map of valid expression operators var validOperators = map[string]bool{ "==": true, ">": true, "<": true, ">=": true, "<=": true, "startsWith": true, } // ValidateKey - validates a document key, used for operati...
pkg/plugins/document/document.go
0.64646
0.401805
document.go
starcoder
package op3 import ( "sort" "github.com/mmcloughlin/ec3/efd/op3/ast" "github.com/mmcloughlin/ec3/internal/errutil" ) // VariableSet builds a set from a list of variables. func VariableSet(vs []ast.Variable) map[ast.Variable]bool { set := map[ast.Variable]bool{} for _, v := range vs { set[v] = true } return ...
efd/op3/analysis.go
0.700588
0.496765
analysis.go
starcoder
package personnummer import ( "errors" ) // County represents the counties within Sweden. This could be told from the // serial number before 1990. See // https://en.wikipedia.org/wiki/Personal_identity_number_(Sweden)#Format // The naming and values of the counties is an ISO 3166-2 standard. See // https://en.wikip...
counties.go
0.742888
0.53868
counties.go
starcoder
package cmd import ( "sort" "strconv" "strings" "testing" "github.com/gomodule/redigo/redis" "github.com/stretchr/testify/assert" ) //ExampleList the key command //memberScores record the key and value of the operation type ExampleZSet struct { memberScores map[string]map[string]float64 conn redis.Co...
tools/autotest/cmd/zset.go
0.590897
0.567457
zset.go
starcoder
package genomisc import ( "compress/bzip2" "compress/gzip" "compress/zlib" "io" "github.com/krolaw/zipstream" "github.com/xi2/xz" ) type DataType byte const ( DataTypeInvalid DataType = iota DataTypeNoCompression DataTypeGzip DataTypeZip DataTypeXZ DataTypeZ DataTypeBZip2 ) var byteCodeSigs = map[Data...
detecreaddatatype.go
0.624752
0.425546
detecreaddatatype.go
starcoder
package parse import ( "fmt" ) // TypeDef represents a user-defined named type. type TypeDef struct { NamePos // name assigned by the user, pos and doc Type Type // the underlying type of the type definition. } // Type is an interface representing symbolic occurrences of types in VDL files. type Type int...
x/ref/lib/vdl/parse/type.go
0.671901
0.451447
type.go
starcoder
// Package avl implements an AVL tree. package avl // Item represents a value in the tree. type Item interface { // Less compares whether the current item is less than the given Item. Less(than Item) bool } // Int implements the Item interface for int. type Int int // Less returns true if int(a) < int(b). func (a...
avl.go
0.893988
0.527073
avl.go
starcoder
package dataset import ( "fmt" "io/ioutil" "path" "regexp" "strings" "github.com/araddon/dateparse" "github.com/pkg/errors" "github.com/uncharted-distil/distil-compute/model" "github.com/uncharted-distil/distil-compute/primitive/compute" "github.com/uncharted-distil/gdal" log "github.com/unchartedsoftware...
api/dataset/satellite.go
0.655777
0.463141
satellite.go
starcoder
package jsonlogic import ( "fmt" "math" ) // AddOpLessThan adds "<" operation to the JSONLogic instance. Param restriction: // - At least two params. // - Must be evaluated to json primitives. // - If comparing numerics, then params must be able to convert to numeric. (See ToNumeric) func AddOpLessThan(jl *JS...
numeric.go
0.7696
0.439326
numeric.go
starcoder
package float128ppc import ( "math" "math/big" ) const ( // precision specifies the number of bits in the mantissa (including the // implicit lead bit). precision = 106 ) var ( // -NaN NegNaN = Float{high: -math.NaN(), low: 0} // +NaN NaN = Float{high: math.NaN(), low: 0} ) // Float is a floating-point num...
float128ppc/float128ppc.go
0.89093
0.536738
float128ppc.go
starcoder
package gibbs import ( "gonum.org/v1/gonum/floats" "gonum.org/v1/gonum/stat/distuv" "math/rand" ) func Gibbs(dataset []float64, timeSteps int) ([]float64,[]float64,[]float64){ // Initialize parameters sigmaZero := 1.5 // Lets start we fixed variance parameters and focus on finding the mean sigmaOne := sigmaZe...
gibbs/gibbs.go
0.534612
0.497131
gibbs.go
starcoder
* ************************************** Useage: ************************************** * A general use port scanner, yo. The scanner outputs the number of open ports, total number of ports scanned, and CSV files, * one for the open ports and one for the closed ports * * The input for the PortScanner function are ...
materials/lab/2/bhg-scanner/scanner/scanner.go
0.679498
0.447883
scanner.go
starcoder