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 cmddeployment const ( // nolint createLong = `Creates a deployment which can be defined through flags or from a file definition. Sane default values are provided, making the command work out of the box even when no parameters are set. When version is not specified, the latest available stack version will a...
cmd/deployment/create_help.go
0.785391
0.427815
create_help.go
starcoder
package models import ( "fmt" "strings" "time" "github.com/mingrammer/go-codelab/faker" ) // Sensor is common interface for any sensors type Sensor interface { SendingOutputString() string ReceivingOutputString() string GenerateSensorData(epsilon float64) Sensor } // SensorInfo has common fields for any sens...
models/sensor.go
0.799521
0.444625
sensor.go
starcoder
package docs import ( "bytes" "encoding/json" "strings" "github.com/alecthomas/template" "github.com/swaggo/swag" ) var doc = `{ "schemes": {{ marshal .Schemes }}, "swagger": "2.0", "info": { "description": "{{.Description}}", "title": "{{.Title}}", "termsOfService": "http:/...
pkg/graph/api/http/docs/docs.go
0.555435
0.400573
docs.go
starcoder
package cached import ( "lmd-ghost/eth2/dag" ) type CacheKey [32 + 4]uint8 // Trick to get a quick conversion array, gets the log of a number const logzLen = 10000 var logz = [logzLen]uint8{0, 0} func init() { for i := 2; i < logzLen; i++ { logz[i] = logz[i / 2] + 1 } } /// Just only the cache part of the impl...
eth2/fork_choice/choices/cached/cached.go
0.65368
0.452173
cached.go
starcoder
package value import ( "strconv" "strings" ) func ToInt(v string) int64 { i, _ := strconv.ParseInt(v, 10, 64) return i } func ToFloat(v string) float64 { f, _ := strconv.ParseFloat(v, 64) return f } func ToFloatSep(v, decimalSep, thousandsSep string) float64 { v = strings.TrimSpace(v) v = strings.ReplaceAll...
convert.go
0.716219
0.447158
convert.go
starcoder
package test_persistence import ( cdata "github.com/pip-services3-go/pip-services3-commons-go/data" "github.com/stretchr/testify/assert" "testing" ) type DummyMapPersistenceFixture struct { dummy1 map[string]interface{} dummy2 map[string]interface{} persistence IDummyMapPersistence } func NewDummyMap...
test/persistence/DummyMapPersistenceFixture.go
0.580233
0.466603
DummyMapPersistenceFixture.go
starcoder
package evaluate import ( "github.com/p2pquake/userquake-aggregator/pkg/aggregate" "github.com/p2pquake/userquake-aggregator/pkg/epsp" ) type position struct { x int y int } const allowXRange = 35 const allowYRange = 45 var areaPositions map[epsp.AreaCode]position = map[epsp.AreaCode]position{ 10: {x: 459, y:...
pkg/evaluate/compatible.go
0.563018
0.642468
compatible.go
starcoder
package payouts // AdditionalDataRisk struct for AdditionalDataRisk type AdditionalDataRisk struct { // The data for your custom risk field. For more information, refer to [Create custom risk fields](https://docs.adyen.com/risk-management/configure-custom-risk-rules#step-1-create-custom-risk-fields). RiskdataCustomF...
src/payouts/model_additional_data_risk.go
0.742982
0.588594
model_additional_data_risk.go
starcoder
package bridge import ( "context" "sync" "time" tally "github.com/uber-go/tally/v4" "go.opentelemetry.io/otel/attribute" "go.opentelemetry.io/otel/metric/number" "go.opentelemetry.io/otel/metric/sdkapi" "go.opentelemetry.io/otel/metric/unit" ) type ( histRecorder func(tally.Histogram, number.Number, number....
internal/bridge/histogram.go
0.708313
0.404302
histogram.go
starcoder
package sprites import ( rl "github.com/gen2brain/raylib-go/raylib" "github.com/go-rogue/engine/geom" "math" ) type Sprite struct { R rl.Rectangle t *SpriteSheet } func (s Sprite) Draw(pos geom.Point, fg, bg rl.Color) { if bg != ColourNC { tileWidth := int(s.t.TileWidth) tileHeight := int(s.t.TileHeight) ...
sprites/spritesheet.go
0.607314
0.481637
spritesheet.go
starcoder
package immutable // List is an expandable, immutable data collection. type List func(index int, callback ...func(index int, element interface{}) interface{}) interface{} // pair is a logical pair of interfaces. type pair func() (interface{}, interface{}) /* BEGIN EXPORTED METHODS */ // NewList initializes a new li...
list.go
0.793146
0.525064
list.go
starcoder
package decimal // add128 adds two decParts with full precision in 128 bits of significand func (dp *decParts) add128(ep *decParts) decParts { dp.matchScales128(ep) var ans decParts ans.exp = dp.exp if dp.sign == ep.sign { ans.sign = dp.sign ans.significand = dp.significand.add(ep.significand) } else { if e...
decimal64decParts.go
0.629775
0.616301
decimal64decParts.go
starcoder
package utility import ( "time" "github.com/aodin/date" ) func CopyInt(src *int) *int { if src == nil { return nil } dst := *src return &dst } func CopyIntSlice(src *[]int) *[]int { if src == nil { return nil } dst := make([]int, len(*src)) copy(dst, *src) return &dst } func CopyIntMap(src *map[...
internal/utility/copy.go
0.608361
0.40928
copy.go
starcoder
package xsens import "strconv" func _() { // An "invalid array index" compiler error signifies that the constant values have changed. // Re-run the stringer command to generate them again. var x [1]struct{} _ = x[DataTypeTemperature-2064] _ = x[DataTypeUTCTime-4112] _ = x[DataTypePacketCounter-4128] _ = x[Dat...
datatype_string.go
0.544559
0.474449
datatype_string.go
starcoder
package storelimit import ( "sync" "time" "golang.org/x/time/rate" ) const ( // SmallRegionThreshold is used to represent a region which can be regarded as a small region once the size is small than it. SmallRegionThreshold int64 = 20 // Unlimited is used to control the store limit. Here uses a big enough num...
server/schedule/storelimit/store_limit.go
0.742422
0.411288
store_limit.go
starcoder
package v1alpha1 import ( "k8s.io/apimachinery/pkg/api/errors" "k8s.io/apimachinery/pkg/labels" "k8s.io/client-go/tools/cache" v1alpha1 "github.com/huone1/numatopo/pkg/apis/nodeinfo/v1alpha1" ) // NumatopoLister helps list Numatopos. // All objects returned here must be treated as read-only. type NumatopoLister ...
pkg/client/listers/nodeinfo/v1alpha1/numatopo.go
0.5564
0.41401
numatopo.go
starcoder
package native import "github.com/racerxdl/segdsp/dsp/native/amd64" // region Float-Float Vector Operations func MultiplyFloatFloatVectors(A, B []float32) { if nativeMultiplyFloatFloatVectors == nil { nativeMultiplyFloatFloatVectors = GetNativeMultiplyFloatFloatVectors() } if nativeMultiplyFloatFloatVectors == ...
dsp/native/vectorops_amd64.go
0.691081
0.455017
vectorops_amd64.go
starcoder
package cryptypes import "database/sql/driver" // EncryptedRuneSlice supports encrypting RuneSlice data type EncryptedRuneSlice struct { Field Raw []rune } // Scan converts the value from the DB into a usable EncryptedRuneSlice value func (s *EncryptedRuneSlice) Scan(value interface{}) error { return decrypt(valu...
cryptypes/type_rune_slice.go
0.78964
0.604253
type_rune_slice.go
starcoder
package orderbook import ( "math" ) type PriceCompStats struct { SellPrice float64 CumulativeOfferedForSale float64 CumulativeOfferedForSaleTimesPrice float64 Txid uint64 } type Orderbook struct { MPrecomputedTatonnementData []PriceCompStats } f...
pkg/orderbook/orderbook.go
0.538498
0.442034
orderbook.go
starcoder
package dns import ( "encoding/json" ) // DataValue An individual metric data point type DataValue struct { // The time that a data point was recorded UnixTime *string `json:"unixTime,omitempty"` // A data point's value Value *string `json:"value,omitempty"` } // NewDataValue instantiates a new DataValue object...
pkg/dns/model_data_value.go
0.812904
0.437463
model_data_value.go
starcoder
package bcns // Yawning: Only the constant time variation of the code is implemented. // If people want the non-constant time version, they can do it themselves. func getbit(a []uint64, x int) uint64 { return (a[(x)/64] >> uint64((x)%64)) & 1 } // We assume that e contains two random bits in the two // least signi...
rlwe.go
0.680772
0.453383
rlwe.go
starcoder
package Projector import ( "image" "image/color" "math" "runtime" "sync" ) type Projector struct { gc ProjectionConverter } func MakeProjector(gc ProjectionConverter) *Projector { return &Projector{ gc: gc, } } func (p *Projector) DrawLatLonLines(src *image.RGBA, thickness int, c color.Color) { t0 := -th...
ImageProcessor/Projector/Projector.go
0.644001
0.417034
Projector.go
starcoder
package parser import ( "fmt" "reflect" "strings" "github.com/cockroachdb/cockroach/util" ) // NormalizeAndTypeCheckExpr is a combination of NormalizeExpr and // TypeCheckExpr. It returns returns an error if either of // NormalizeExpr or TypeCheckExpr return one, and otherwise returns // the Expr returned by No...
sql/parser/type_check.go
0.621885
0.462352
type_check.go
starcoder
package p407 /** Given an m x n matrix of positive integers representing the height of each unit cell in a 2D elevation map, compute the volume of water it is able to trap after raining. Note: Both m and n are less than 110. The height of each unit cell is greater than 0 and is less than 20,000. Example: Given the ...
algorithms/p407/407.go
0.803444
0.675494
407.go
starcoder
package limage import ( "image" "image/color" "vimagination.zapto.org/limage/lcolor" ) // PalettedAlpha represents a paletted image with an alpha channel type PalettedAlpha struct { Pix []lcolor.IndexedAlpha Stride int Rect image.Rectangle Palette lcolor.AlphaPalette } // NewPalettedAlpha creates a n...
indexedalpha.go
0.794982
0.560734
indexedalpha.go
starcoder
package deck import ( "context" "testing" "time" "github.com/stretchr/testify/assert" "gorm.io/driver/sqlite" "gorm.io/gorm" "gorm.io/gorm/logger" ) // Columns is a condition struct for query type Columns map[string]interface{} // SetupGormDB gets gorm.DB instance. Passed in models will be auto migrated. fun...
deck/gdb.go
0.752286
0.46132
gdb.go
starcoder
package sudokugen import ( "math" "math/rand" "time" ) //Coord represents a cell in the Board by (x,y) type Coord struct { x, y int } //Board represents the full puzzle board type Board struct { //Horizontal dimension of one Box xDimension int //Vertial dimension of one Box yDimension int //The full grid g...
pkg/sudokugen/sudokugen.go
0.73659
0.495117
sudokugen.go
starcoder
package v1 import ( "context" "reflect" "github.com/pkg/errors" "github.com/pulumi/pulumi/sdk/v3/go/pulumi" ) // Create a rate plan that is associated with an API product in an organization. Using rate plans, API product owners can monetize their API products by configuring one or more of the following: - Billi...
sdk/go/google/apigee/v1/ratePlan.go
0.776581
0.778607
ratePlan.go
starcoder
package settings import ( "time" ) // Get a value from the settings object. Return `dflt` if an error occurs. func (s *Settings) RawDflt(key string, dflt interface{}) interface{} { if value, err := s.Raw(key); err == nil { return value } else { return dflt } } // Get a settings object. Return `dflt` if an er...
dflt.go
0.809803
0.598254
dflt.go
starcoder
package main import ( "fmt" "math" ) type ifctn func(float64) float64 func simpson38(f ifctn, a, b float64, n int) float64 { h := (b - a) / float64(n) h1 := h / 3 sum := f(a) + f(b) for j := 3*n - 1; j > 0; j-- { if j%3 == 0 { sum += 2 * f(a+h1*float64(j)) } else {...
lang/Go/verify-distribution-uniformity-chi-squared-test.go
0.77081
0.468487
verify-distribution-uniformity-chi-squared-test.go
starcoder
package lzma import ( "errors" "fmt" "unicode" ) // operation represents an operation on the dictionary during encoding or // decoding. type operation interface { Len() int } // rep represents a repetition at the given distance and the given length type match struct { // supports all possible distance values, ...
vendor/github.com/ulikunitz/xz/lzma/operation.go
0.737158
0.522446
operation.go
starcoder
package path import ( "bytes" "fmt" "strings" "unicode/utf8" ) // Expression defines a type of AST node for outlining an expression. type Expression interface { Pos() Position End() Position String() string } // QueryExpression represents a query full of expressions type QueryExpression struct { Expressions...
ast.go
0.821188
0.422981
ast.go
starcoder
package forGraphBLASGo func VectorSelect[D, Ds any](w *Vector[D], mask *Vector[bool], accum BinaryOp[D, D, D], op IndexUnaryOp[bool, D, Ds], u *Vector[D], value Ds, desc Descriptor) error { size, err := w.Size() if err != nil { return err } if err = u.expectSize(size); err != nil { return err } maskAsStructu...
api_Select.go
0.650245
0.652387
api_Select.go
starcoder
package copypasta /* 替罪羊树 https://en.wikipedia.org/wiki/Scapegoat_tree https://people.ksp.sk/~kuko/gnarley-trees/Scapegoat.html lazy insert: let the tree grow and from time to time, when a subtree gets too imbalanced, rebuild the whole subtree from scratch into a perfectly balanced tree lazy delete: just...
copypasta/scapegoat_tree.go
0.525369
0.6305
scapegoat_tree.go
starcoder
package tile import ( "sync" ) // Update represents a tile update notification. type Update struct { Point // The tile location Tile // The tile data } // View represents a view which can monitor a collection of tiles. type View struct { Grid *Grid // The associated map Inbox chan Update // The update ...
view.go
0.75985
0.482246
view.go
starcoder
package example import ( "log" ) // doc: https://sonarsource.com/docs/CognitiveComplexity.pdf // The tail numbers of function names is the cognitive complexity of the functions func funcIf_1(a int) int { if a != 0 { // +1 return a + 1 } return a } func funcIf_2(a int) int { if a != 0 && (a != 10) { // +2 ...
example/example.go
0.593138
0.45048
example.go
starcoder
package mc import ( "fmt" "math" ) const ( IncompleteSetup = iota Initialized Running ResultsAvailable ) // Model specifies the interface for using the Monte Carlo engine type Model interface { Measurement() float64 } // Engine implements the Monte Carlo simulation type Engine struct { Model Model Nsim...
pkg/mc/engine.go
0.811003
0.446374
engine.go
starcoder
package scene import ( objects "de/vorlesung/projekt/raytracer/SceneObjects" ) //a ball implementation type Ball struct { sphere *objects.Sphere color *objects.Vector diffuse float64 specularIntensity float64 specularPower float64 reflectivity float64 } //intersection...
Raytracing/ball.go
0.800692
0.736424
ball.go
starcoder
package evidence import ( "bytes" "fmt" "github.com/tendermint/tendermint/types" ) // verify verifies the evidence fully by checking: // - It has not already been committed // - it is sufficiently recent (MaxAge) // - it is from a key who was a validator at the given height // - it is internally consistent with s...
evidence/verify.go
0.639511
0.453201
verify.go
starcoder
package neural import ( "errors" "math/rand" "github.com/gitchander/neural/neutil/random" ) type neuron struct { weights []float64 // input weights bias float64 // input bias out float64 // output value } type layer struct { actFunc ActivationFunc neurons []*neuron } // Multilayer perceptron (MLP) //...
perceptron.go
0.620392
0.428891
perceptron.go
starcoder
package trinary import ( "math" "regexp" "strings" . "github.com/iotaledger/iota.go/consts" "github.com/pkg/errors" ) var ( // TryteToTritsLUT is a Look-up-table for Trytes to Trits conversion. TryteToTritsLUT = [][]int8{ {0, 0, 0}, {1, 0, 0}, {-1, 1, 0}, {0, 1, 0}, {1, 1, 0}, {-1, -1, 1}, {0, -1, 1}, {1,...
trinary/trinary.go
0.630685
0.45641
trinary.go
starcoder
package main import ( "encoding/json" "fmt" "io/ioutil" "sync" "github.com/sachaservan/adveil/anns" "github.com/alexflint/go-arg" "github.com/gonum/stat" "github.com/sachaservan/vec" ) type Result struct { AvgDistanceContextual float64 `json:"avg_dist_contextual"` AvgDistanceTargeted float64 `json:"avg_...
accuracy/main.go
0.712232
0.472318
main.go
starcoder
package arithmetic import ( "errors" ) // BitSlice represents a slice of bits (represented as bools) type BitSlice []bool // GetNextBit returns the next bit and a new bit slice with the first bit popped off. // If there are no more bits, then the function returns 0. func GetNextBit(bits BitSlice) (uint32, BitSlice)...
compressor/arithmetic/bits.go
0.788746
0.45175
bits.go
starcoder
package main import ( "bytes" ) func main() { code := ` Ref: https://en.wikipedia.org/wiki/Brainfuck [ This program prints "Hello World!" and a newline to the screen, its length is 106 active command characters. [It is not the shortest.] This loop is an "initial comment loop", a simple way of adding a comment ...
main.go
0.502686
0.47384
main.go
starcoder
package modeling import ( "fmt" "github.com/pointlesssoft/godevs/pkg/util" "math" ) type Atomic interface { Component // Atomic interface complies with the Component interface. TA() float64 // Returns time to be elapsed until next internal transition is triggered....
pkg/modeling/atomic.go
0.846546
0.587529
atomic.go
starcoder
package synthesizer // package to generate oscillators of various shapes import ( "fmt" "math" ) const tau = (2 * math.Pi) // Shape for defining the different possible waveform shapes for use with the Oscillator type Shape int // Shapes for which we can generate waveforms const ( SINE Shape = iota SQUARE DOWN...
synthesizer/oscil.go
0.828002
0.465084
oscil.go
starcoder
package calendar import "fmt" // See the LICENSE file. // PersianDate represents a Persian date, using year, month and day. type PersianDate struct{ Year, Month, Day int } // ToGregorian converts this Persian date to equivalent Gregorian date. func (pd PersianDate) ToGregorian() (gd GregorianDate) { gd.Year, gd.Mo...
calendar.go
0.743447
0.430686
calendar.go
starcoder
package mathh // PowUint returns a**b (a raised to power b). // Warning: where is no any check for overflow. func PowUint(a, b uint) uint { p := uint(1) for b > 0 { if b&1 != 0 { p *= a } b >>= 1 a *= a } return p } // PowModUint computes a**b mod m (modular integer power) using binary powering algori...
back/vendor/github.com/apaxa-go/helper/mathh/pow-gen.go
0.627038
0.501648
pow-gen.go
starcoder
package async import ( "reflect" ) /* Filter allows you to filter out information from a slice in Waterfall mode. You must call the Done function with false as its first argument if you do not want the data to be present in the results. No other arguments will affect the performance of this function. When calling ...
filter.go
0.641647
0.47926
filter.go
starcoder
package scanner import ( "math/big" "regexp" ct "github.com/google/certificate-transparency-go" "github.com/google/certificate-transparency-go/x509" ) // Matcher describes how to match certificates and precertificates; clients should implement this interface // to perform their own match criteria. type Matcher ...
scanner/matcher.go
0.705886
0.42919
matcher.go
starcoder
package z3 // #include "go-z3.h" import "C" type SortKind struct { rawSortKind C.Z3_sort_kind } func (s *SortKind) Eq(other *SortKind) bool { return s.rawSortKind == other.rawSortKind } var ( UninterpretedSort *SortKind = &SortKind{rawSortKind: C.Z3_UNINTERPRETED_SORT} BoolSort *SortKind = &SortKind{ra...
util/z3/sort.go
0.688573
0.442817
sort.go
starcoder
package parens import ( "fmt" "strings" ) // MacroFunc represents the signature of the Go macro functions. Functions // bound in the scope as MacroFunc will receive un-evaluated list of s-exps // and the current scope. type MacroFunc func(scope Scope, exprs []Expr) (interface{}, error) // Float64 represents double...
exprs.go
0.804214
0.532668
exprs.go
starcoder
package dataprocessor import ( "errors" "fmt" "log" "github.com/kamilwoloszyn/cryptojacking-defender/models/tstraining" "github.com/sjwhitworth/golearn/base" "github.com/sjwhitworth/golearn/evaluation" "github.com/sjwhitworth/golearn/knn" ) type DataProcessor struct { trainingFileName string classifier ...
models/dataprocessor/model.go
0.607547
0.40489
model.go
starcoder
package main import ( "flag" "fmt" "os" "sort" "text/tabwriter" ) func usage() { fmt.Fprintf(os.Stderr, ` Usage: godate [flags] [[time [+-]duration...]...] or: godate tz [name...] Flags: `[1:]) flag.PrintDefaults() fmt.Fprintf(os.Stderr, ` This command parses and prints times in arbitrary formats and time...
doc.go
0.63114
0.474509
doc.go
starcoder
package basic import ( "math" "github.com/starainrt/astro/planet" . "github.com/starainrt/astro/tools" ) func MercuryL(JD float64) float64 { return planet.WherePlanet(1, 0, JD) } func MercuryB(JD float64) float64 { return planet.WherePlanet(1, 1, JD) } func MercuryR(JD float64) float64 { return planet.WherePl...
basic/mercury.go
0.678966
0.467575
mercury.go
starcoder
package isa import ( "fmt" "regexp/syntax" "strconv" "github.com/zyedidia/gpeg/charset" ) // Insn represents the interface for an instruction in the ISA type Insn interface { insn() } // A Program is a sequence of instructions type Program []Insn // Size returns the number of instructions in a program ignorin...
isa/isa.go
0.754282
0.549822
isa.go
starcoder
// Package hash provides an interface to hashing functions. package hash import ( "crypto" "crypto/hmac" "crypto/sha256" "crypto/sha512" "errors" "hash" "io" "golang.org/x/crypto/hkdf" "golang.org/x/crypto/sha3" ) // Hashing defines registered fixed length hashing engines. type Hashing uint const ( // S...
hash/fixed.go
0.827131
0.419351
fixed.go
starcoder
package streamstats // CovarStats is a data structure for computing stats on two related variables x,y from a stream type CovarStats struct { xStats MomentStats yStats MomentStats sXY float64 } // NewCovarStats returns an empty CovarStats structure with no values func NewCovarStats() *CovarStats { return &Cova...
covarstats.go
0.927017
0.793426
covarstats.go
starcoder
package ilcd // DataSetType is an enumeration type of the different ILCD data set types. type DataSetType int // The ILCD data set types const ( ModelDataSet DataSetType = iota + 1 ProcessDataSet MethodDataSet FlowDataSet FlowPropertyDataSet UnitGroupDataSet SourceDataSet ContactDataSet // External document...
ilcd.go
0.575111
0.547222
ilcd.go
starcoder
package main import ( "fmt" "log" "math" ) func distance(x1, y1, x2, y2 float64) float64 { a := x2 - x1 b := y2 - y1 return math.Sqrt(a*a + b*b) } func rectangleArea(x1, y1, x2, y2 float64) float64 { l := distance(x1, y1, x1, y2) w := distance(x1, y1, x2, y1) return l * w } func circleArea(x, y, r float64)...
chapter-09/main.go
0.707506
0.537891
main.go
starcoder
package hstools import ( "encoding/json" "log" "math/big" "github.com/boltdb/bolt" ) type MetricData struct { Mean *big.Int AbsDev *big.Int } type AnalyzedConsensus struct { T Hour Distance *MetricData Distance4 *MetricData } type PartitionData struct { x0 *big.Int x1 *big.Int l *big.Int } ...
src/hstools/stats.go
0.6508
0.450541
stats.go
starcoder
package vesper var defaultSymtab = initSymbolTable() // Intern - internalize the name into the global symbol table func (vm *VM) Intern(name string) *Object { sym, ok := vm.Symbols[name] if !ok { sym = &Object{text: name} if IsValidKeywordName(name) { sym.Type = KeywordType } else if IsValidTypeName(name) ...
symbol.go
0.657538
0.407157
symbol.go
starcoder
package gvolume import ( "fmt" "github.com/cryptowilliam/goutil/basic/gerrors" "github.com/cryptowilliam/goutil/container/gspeed" "github.com/cryptowilliam/goutil/container/gstring" "strings" ) // Map between speed unit of byte and bits size const ( KB = Volume(gspeed.KB) MB = Volume(gspeed.MB) GB = Volume(gs...
container/gvolume/volume.go
0.733261
0.420243
volume.go
starcoder
package dmr import ( "context" "database/sql/driver" "reflect" ) type filterChain struct { filters []filter fpos int } func newFilterChain(filters []filter) *filterChain { fc := new(filterChain) fc.filters = filters fc.fpos = 0 return fc } func (filterChain *filterChain) reset() *filterChain { filterCh...
dmr/zd.go
0.617513
0.417687
zd.go
starcoder
package libc import "math" func X__builtin_isnan(t *TLS, x float64) int32 { return Bool32(math.IsNaN(x)) } func Xacos(t *TLS, x float64) float64 { return math.Acos(x) } func Xacosh(t *TLS, x float64) float64 { return math.Acosh(x) } func Xasin(t *TLS, x float64) float64 { return...
libc/math.go
0.768646
0.730001
math.go
starcoder
package util import ( "context" "fmt" "path/filepath" "strings" "time" "chromiumos/tast/ctxutil" "chromiumos/tast/errors" "chromiumos/tast/local/bundles/cros/inputs/data" "chromiumos/tast/local/chrome" "chromiumos/tast/local/chrome/ime" "chromiumos/tast/local/chrome/uiauto" "chromiumos/tast/local/chrome/...
src/chromiumos/tast/local/bundles/cros/inputs/util/util.go
0.655446
0.417806
util.go
starcoder
// XXX: Unsure whether it actually *should* happen on dcs-web or on the index // backends. a pro argument for ranking on dcs-web is that we could batch // queries to the database together and maybe have an advantage that way? // Pre-ranking happens on dcs-web after the index backends provided their // results. Withou...
ranking/pre-ranking.go
0.555918
0.422207
pre-ranking.go
starcoder
package httpassert import ( "encoding/json" "math" "reflect" ) func compareValues(v1, v2 reflect.Value) bool { if v1.Kind() == reflect.Ptr || v1.Kind() == reflect.Interface { return compareValues(v1.Elem(), v2) } if v2.Kind() == reflect.Ptr || v2.Kind() == reflect.Interface { return compareValues(v1, v2.El...
compare_values.go
0.585338
0.516656
compare_values.go
starcoder
package valgo func setDefaultEnglishMessages() { getLocales()["en"] = &locale{ Messages: map[string]string{ "valid": "\"{{value}}\" is not a valid value for {{title}}", "not_valid": "\"{{value}}\" is not a valid value for {{title}}", "blank": "{{title}} mus...
locale_en.go
0.511229
0.552359
locale_en.go
starcoder
package input import ( "errors" "fmt" "time" "github.com/Jeffail/benthos/v3/lib/log" "github.com/Jeffail/benthos/v3/lib/metrics" "github.com/Jeffail/benthos/v3/lib/types" ) //------------------------------------------------------------------------------ func init() { Constructors[TypeResource] = TypeSpec{ ...
lib/input/resource.go
0.560132
0.671498
resource.go
starcoder
package graph import ( "errors" "sync" ) // GraphType values. const ( Undirected int = iota Directed ) // Node is a Node(node) in Graph. type Node struct { Value interface{} } // Graph . type Graph struct { sync.RWMutex // type of graph. kind int // Bool is used for graph traversal. nodes map[*Node]bool ...
data-structure/graph/graph.go
0.707809
0.507324
graph.go
starcoder
package diff import ( "fmt" "strings" "golang.org/x/tools/internal/span" ) // Unified represents a set of edits as a unified diff. type Unified struct { // From is the name of the original file. From string // To is the name of the modified file. To string // Hunks is the set of edit hunks needed to transfo...
vendor/golang.org/x/tools/internal/lsp/diff/unified.go
0.606964
0.400486
unified.go
starcoder
package types type Set interface { // Exist determine the data whether have already existed in the Set or not, if they have, return true, otherwise return false. Exist(interface{}) bool // Put data to the Set. Put(interface{}) // Add data to the Set, if the data have already exist in the Set, this method return...
internal/types/hash_set.go
0.655336
0.509154
hash_set.go
starcoder
package tuple import "fmt" // T2 is a tuple of two elements. type T2[A, B any] struct { V0 A V1 B } // T3 is a tuple of three elements. type T3[A, B, C any] struct { V0 A V1 B V2 C } // T4 is a tuple of four elements. type T4[A, B, C, D any] struct { V0 A V1 B V2 C V3 D } // T5 is a tuple of five elements...
tuple/tuple.go
0.71889
0.618867
tuple.go
starcoder
package common type PerspectiveTransform struct { a11, a21, a31 float64 a12, a22, a32 float64 a13, a23, a33 float64 } func PerspectiveTransform_QuadrilateralToQuadrilateral(x0, y0, x1, y1, x2, y2, x3, y3, x0p, y0p, x1p, y1p, x2p, y2p, x3p, y3p float64) *PerspectiveTransform { qToS := PerspectiveTransform_Quadri...
common/perspective_transform.go
0.77552
0.828419
perspective_transform.go
starcoder
package gokalman import ( "errors" "fmt" "math" "github.com/gonum/matrix/mat64" ) // NewSRIF returns a new Square Root Information Filter. // It uses the algorithms from "Statistical Orbit determination" by Tapley, Schutz & Born. // Set nonTriR to `true` to NOT use the Householder transformation on \bar{R_k}. fu...
srif.go
0.85203
0.529324
srif.go
starcoder
package xtime import ( "time" ) // Time time type Time struct { time.Time } // Now returns current time func Now() *Time { return &Time{ Time: time.Now(), } } // Unix returns time converted from timestamp func Unix(sec, nsec int64) *Time { return &Time{ Time: time.Unix(sec, nsec), } } // Today returns b...
pkg/util/xtime/time.go
0.790409
0.538498
time.go
starcoder
package lib import ( "fmt" ) type AttackType string func (at AttackType) ToString() string { switch at { case BludgeoningAttack: return "bludgeoning" case ColdAttack: return "cold" case FireAttack: return "fire" case RadiationAttack: return "radiation" case SlashingAttack: return "slashing" default...
day24/lib/group.go
0.510985
0.455804
group.go
starcoder
package query import ( "core" "fmt" "sort" ) // Roots returns build labels with no dependents from the given list. // i.e. if `labels` contains `A` and `B` such that `A` depends-on `B` (possibly through some indirect path) // only `B` will be output. // This does not perform an ordering of the labels, but theoreti...
src/query/roots.go
0.772101
0.46393
roots.go
starcoder
package schema import ( "errors" "sort" "strings" ) // ErrColTagCollision is an error that is returned when two columns within a ColCollection have the same tag // but a different name or type var ErrColTagCollision = errors.New("two different columns with the same tag") // ErrColNotFound is an error that is ret...
go/libraries/doltcore/schema/col_coll.go
0.671794
0.407127
col_coll.go
starcoder
package datadog import ( "encoding/json" ) // DowntimeRecurrence An object defining the recurrence of the downtime. type DowntimeRecurrence struct { // How often to repeat as an integer. For example, to repeat every 3 days, select a type of `days` and a period of `3`. Period *int32 `json:"period,omitempty"` // T...
api/v1/datadog/model_downtime_recurrence.go
0.879858
0.626838
model_downtime_recurrence.go
starcoder
package jsonx // GetStringOrDefault retrieves the value for the given key in the dictionary, or a default value if it does not exist. func GetStringOrDefault(dict map[string]interface{}, key string) string { val, _ := dict[key].(string) return val } // GetFloat64OrDefault retrieves the value for the given key in th...
jsonx/get_values.go
0.770637
0.412589
get_values.go
starcoder
package assert import ( "fmt" "reflect" "runtime" "testing" ) type Assert struct { *testing.T name string } func NewAssert(t *testing.T) *Assert { return &Assert{T: t} } func NewAssertWithName(t *testing.T, name string) *Assert { return &Assert{t, name} } func (ast *Assert) Log(args ...interface{}) { if a...
Godeps/_workspace/src/github.com/simonz05/util/assert/assert.go
0.524395
0.470676
assert.go
starcoder
package client import ( "fmt" "strconv" ) // HistogramMetric is a metric of type HistogramType type HistogramMetric struct { Metric Buckets []*HistogramBucket Sum float64 Count float64 } // HistogramBucket define the upper bound and value type HistogramBucket struct { LE float64 Value float64 } // ...
upgrades.go
0.772316
0.52756
upgrades.go
starcoder
package main // Internal mapping of the ERAs for indices type ERAIdx uint const ( kKiva ERAIdx = 0 kProsper ERAIdx = 1 kNaive ERAIdx = 2 kRandom ERAIdx = 3 ) // Loan status enumeration type LoanStatus uint const ( kDefaulted LoanStatus = 0 kPaid LoanStatus = 1 ) // ERABalanceState represents the s...
server/era_driver.go
0.50415
0.406391
era_driver.go
starcoder
package core import "fmt" // the units of below is pixels. type Config struct { startX, startY float64 // PDF page start position endX, endY float64 // PDF page end postion width, height float64 // PDF page width and height contentWidth, contentHeight float64 // PDF page content width and height } // Param...
core/config.go
0.695752
0.401512
config.go
starcoder
package f5api // This describes a message sent to or received from some operations type LtmProfileTcp struct { // Specifies, when enabled, that the system defers allocation of the connection chain context until the client response is received. This option is useful for dealing with 3-way handshake DOS attacks. The d...
ltm_profile_tcp.go
0.877713
0.464416
ltm_profile_tcp.go
starcoder
Package arbiter provides a wrapper over a stream connections that provide a standard command and control interface. Arbiter Interface The basic Arbiter interface requires only 3 functions: Stop - Stop the Arbiter and close underlaying stream connection(s) Dial - Opens initial connect over stream and verifies the c...
doc.go
0.557725
0.783782
doc.go
starcoder
Package electron lets you write concurrent AMQP 1.0 messaging clients and servers. Start by creating a Container with NewContainer. An AMQP Container represents a single AMQP "application" and can contain client and server connections. You can enable AMQP over any connection that implements the standard net.Conn inte...
Godeps/_workspace/src/qpid.apache.org/electron/doc.go
0.798894
0.68875
doc.go
starcoder
package util import ( "bufio" "bytes" "fmt" "os" "reflect" "regexp" "strconv" "strings" "time" "github.com/project-flogo/core/data/property" ) const ( GRAPH_ID = "$GRAPH_ID" ) func SplitFilename(filename string) (string, string) { if "" != filename { indexSlash := strings.LastIndex(filename, "/") in...
tools/vendor/github.com/TIBCOSoftware/labs-graphbuilder-lib/util/helper.go
0.500244
0.404566
helper.go
starcoder
package models import ( "fmt" "time" ) // Bounds are the time bounds, start time is inclusive but end is exclusive. type Bounds struct { Start time.Time Duration time.Duration StepSize time.Duration } // TimeForIndex returns the start time for a given index assuming // a uniform step size. func (b Bounds) T...
src/query/models/bounds.go
0.88251
0.488466
bounds.go
starcoder
package cdn import ( "encoding/json" ) // CustconfCustomMimeType The custom mime type policy allows you to map file extensions to specific mime types for the CDN caching servers to use when delivering assets. The mime types you map using this policy may also be limited to specific response codes to address scenarios...
pkg/cdn/model_custconf_custom_mime_type.go
0.767341
0.416441
model_custconf_custom_mime_type.go
starcoder
package mpseek // A header is a 32-bit word with getters for various bit fields. It also has a // few utility methods, some of which may panic or return an invalid result when // called on an invalid header. type header uint32 // syncword returns the value of the syncword field. func (h header) syncword() int { ret...
vendor/github.com/korandiz/mpseek/frame.go
0.859811
0.498718
frame.go
starcoder
package mat import "fmt" //mat "gonum.org/v1/gonum/mat" /* func useless() *mat.Dense { return mat.NewDense() } */ //M64 represents a float64 matrix with r rows and c colomns type M64 struct { r int c int data []float64 transposed bool } //Dims returns the number of rows and colomns fun...
mat.go
0.761893
0.537041
mat.go
starcoder
package casso import ( "errors" "math" ) type Tag struct { priority Priority marker Symbol other Symbol } type Edit struct { tag Tag val float64 } type Solver struct { tabs map[Symbol]Constraint // symbol id -> constraint edits map[Symbol]Edit // variable id -> value tags map[Symbol]Tag ...
solver.go
0.621656
0.420659
solver.go
starcoder
CAD Challenge #18 https://www.reddit.com/r/cad/comments/5vwdnc/cad_challenge_18/ */ //----------------------------------------------------------------------------- package main import . "github.com/deadsy/sdfx/sdf" //----------------------------------------------------------------------------- // Part A func cc18a(...
examples/challenge/cc18.go
0.61451
0.536859
cc18.go
starcoder
package rasterizer import ( m "go-3d-rasterizer/math3d" "math" ) // Scene contains all the matrices needed to transform a vertex into screen coordinates type Scene struct { ModelViewMatrix m.Matrix ProjectionMatrix m.Matrix ViewportMatrix m.Matrix Buffers buffers width int height int wh int...
rasterizer/rasterizer.go
0.733643
0.523542
rasterizer.go
starcoder
package iso20022 // Specifies corporate action dates. type CorporateActionDate1 struct { // Date/time at which the issuer announced that a corporate action event will occur. AnnouncementDate *DateFormat6Choice `xml:"AnncmntDt,omitempty"` // Deadline by which the beneficial ownership of securities must be declared...
CorporateActionDate1.go
0.808786
0.462534
CorporateActionDate1.go
starcoder
package scte35 import ( "github.com/bcasinclair/gots" ) // SetUPIDType will set the type of the UPID func (u *upidSt) SetUPIDType(value SegUPIDType) { u.upidType = value } // SetUPID set the actual UPID func (u *upidSt) SetUPID(value []byte) { u.upid = value } // SetComponentTag sets the component tag, which is ...
scte35/descriptormodify.go
0.613237
0.469216
descriptormodify.go
starcoder
package countrycodes import ( "sort" "strings" "github.com/tchap/go-patricia/patricia" ) type Assignment int const ( /** * <a href="http://en.wikipedia.org/wiki/ISO_3166-1_alpha-2#Officially_assigned_code_elements" * >Officially assigned</a>. * * Assigned to a country, territory, or area of geographical...
country-codes.go
0.532182
0.42925
country-codes.go
starcoder