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 ros2 import ( "time" gotime "time" ) const maxUint32 = int64(^uint32(0)) // ROS TIME IMPLEMENTATION //Time struct contains a temporal value {sec,nsec} type Time struct { temporal } //NewTime creates a Time object of given integers {sec,nsec} func NewTime(sec uint32, nsec uint32) Time { sec, nsec = norm...
ros2/time.go
0.823719
0.572842
time.go
starcoder
package griblib import ( "encoding/binary" "errors" "fmt" "io" ) func fixNegLatLon(num int32) int32 { if num < 0 { return -int32(uint32(num) &^ uint32(0x80000000)) } return num } //ScaledValue specifies the scale of a value type ScaledValue struct { Scale uint8 `json:"scale"` Value uint32 `json:"value"` ...
griblib/grids.go
0.650356
0.420362
grids.go
starcoder
package video // FrameDecoder is for decoding compressed frames with the help of data streams. // A new instance of a decoder is created with a FrameDecoderBuilder. type FrameDecoder struct { horizontalTiles int verticalTiles int colorer TileColorFunction paletteLookupList []byte controlWords []ControlWo...
compress/video/FrameDecoder.go
0.834677
0.462655
FrameDecoder.go
starcoder
package models import ( i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91 "github.com/microsoft/kiota-abstractions-go/serialization" ) // ApprovalWorkflowProvider type ApprovalWorkflowProvider struct { Entity // The businessFlows property businessFlows []BusinessFlowable // The bu...
models/approval_workflow_provider.go
0.589716
0.431764
approval_workflow_provider.go
starcoder
package shardingconfig import ( "math/big" "time" "github.com/harmony-one/harmony/internal/genesis" ) // Schedule returns the sharding configuration instance for the given // epoch. type Schedule interface { InstanceForEpoch(epoch *big.Int) Instance // BlocksPerEpoch returns the number of blocks per each Epoch...
internal/configs/sharding/shardingconfig.go
0.562657
0.408513
shardingconfig.go
starcoder
package wfc import ( // "fmt" "image" "image/color" "math" ) /** * OverlappingModel Type */ type OverlappingModel struct { *BaseModel // Underlying model of generic Wave Function Collapse algorithm N int // Size of patterns (ie pixel distance of influencing pixels) Colors...
overlap-model.go
0.762954
0.508788
overlap-model.go
starcoder
package jit import ( "fmt" "strings" "github.com/tetratelabs/wazero/internal/wasm/buildoptions" ) // nilRegister is used to indicate a register argument a variable is invalid and not an actual register. const nilRegister int16 = -1 func isNilRegister(r int16) bool { return r == nilRegister } func isIntRegiste...
internal/wasm/jit/jit_value_location.go
0.73029
0.47457
jit_value_location.go
starcoder
package levy import ( "math" "math/rand" "sort" "fmt" ) // Gamma Function via Lanczos approximation formula. Depracated in favor of math.Gamma (Stirling approximation) func gamma(x float64) float64 { return math.Exp(logGamma(x)) } func logGamma(x float64) float64 { tmp := (x - 0.5) * math.Log(x + 4...
levy/utils.go
0.626238
0.465448
utils.go
starcoder
package hijri import ( "math" "time" ) // ToHijri converts Gregorian date to standard Hijri date. func ToHijri(date time.Time) (int, int, int) { // We only need the date, so we just set the time to noon date = time.Date(date.Year(), date.Month(), date.Day(), 12, 0, 0, 0, time.UTC) // Calculate Julian Day jd :=...
hijri.go
0.670285
0.421016
hijri.go
starcoder
package main import ( "math" "math/rand" "sort" "github.com/qeedquan/go-media/math/f64" ) const ( SCALLOPED_REGION_MIN_AREA = 0.00000001 ) type ArcData struct { P f64.Vec2 R float64 Sign float64 D float64 Theta float64 IntegralAtStart float64...
gfx/pdsample/scalloped_sector.go
0.710126
0.473292
scalloped_sector.go
starcoder
package noborders import ( "image" "image/color" "math" "github.com/gonum/stat" ) // sliceOperation performs a transform operation on every row and column slice on the // specified image and crop. func sliceOperation(img image.Image, crop image.Rectangle, oper func(img image.Image, r image.Rectangle) float64) (r...
vendor/github.com/neocortical/noborders/math.go
0.805861
0.619989
math.go
starcoder
package Vector2D import ( "testing" ) func TestNew(t *testing.T) { var x = float64(1.1) var y = float64(2.2) v := New(x, y) if v.X != x || v.Y != y { t.Fail() } } func TestFromScalar(t *testing.T) { var s = float64(1.1) v := FromScalar(s) if v.X != s || v.Y != s { t.Fail() } } func TestZero(t *testi...
Core/Vector2D/TestVector2D.go
0.623492
0.582343
TestVector2D.go
starcoder
package main import ( "fmt" "math" "os" "strconv" "strings" ) func main() { if len(os.Args) != 3 { fmt.Println("You must pass value and numbers") os.Exit(1) } stringNumbers := strings.Split(os.Args[2], ",") numbers := make([]int, len(stringNumbers)) for i, n := range stringNumbers { nInt, _ := strcon...
chop/main.go
0.672439
0.448185
main.go
starcoder
package sampler import ( "math" "time" "github.com/DataDog/datadog-agent/pkg/trace/atomic" "github.com/DataDog/datadog-agent/pkg/trace/metrics" "github.com/DataDog/datadog-agent/pkg/trace/pb" "github.com/DataDog/datadog-agent/pkg/trace/watchdog" ) const ( decayPeriod time.Duration = 5 * time.Second // With ...
pkg/trace/sampler/coresampler.go
0.741019
0.436502
coresampler.go
starcoder
package curve import ( "errors" "fmt" "math/big" GF "github.com/armfazh/tozan-ecc/field" ) // wcCurve is a Weierstrass curve type wcCurve struct { *params RationalMap } type WC = *wcCurve func (e *wcCurve) String() string { return "y^2=x^3+Ax^2+Bx\n" + e.params.String() } func (e *wcCurve) New() EllCurve { ...
curve/wc.go
0.827375
0.454109
wc.go
starcoder
package big import ( "database/sql/driver" "encoding/json" "errors" "fmt" "math/big" ) var ( flZero = *big.NewFloat(0) ZERO = NewDecimal(0) ONE = NewDecimal(1) TEN = NewDecimal(10) ) // Decimal is the main exported type. It is a simple, immutable wrapper around a *big.Float type Decimal struct { fl *big...
big/decimal.go
0.834272
0.437884
decimal.go
starcoder
package gen import ( _ "embed" // Needed to support go:embed directive pschema "github.com/pulumi/pulumi/pkg/v3/codegen/schema" v1 "k8s.io/api/core/v1" ) var serviceSpec = pschema.ComplexTypeSpec{ ObjectTypeSpec: pschema.ObjectTypeSpec{ Properties: map[string]pschema.PropertySpec{ "type": { TypeSpec: p...
provider/pkg/gen/overlays.go
0.60054
0.404566
overlays.go
starcoder
package divide_and_conquer import ( "fmt" "reflect" "runtime" "time" "github.com/davecgh/go-spew/spew" ) // https://medium.com/capital-one-developers/buffered-channels-in-go-what-are-they-good-for-43703871828 // One common pattern for goroutines is fan-out. When you want to apply the same data to multiple algo...
concurrency/subtasks/divide_and_conquer/divide_and_conquer.go
0.63861
0.411111
divide_and_conquer.go
starcoder
package onshape import ( "encoding/json" ) // BTPExpressionCall240 struct for BTPExpressionCall240 type BTPExpressionCall240 struct { BTPExpression9 BtType *string `json:"btType,omitempty"` FunctionExpression *BTPExpression9 `json:"functionExpression,omitempty"` FunctionName *BTPName261 `json:"functionName,omite...
onshape/model_btp_expression_call_240.go
0.702938
0.478468
model_btp_expression_call_240.go
starcoder
package rs485 import ( "encoding/binary" "math" ) // BigEndianUint32Swapped converts bytes to uint32 wrapped as uint64 with swapped word order. // To use the result as int32 value make sure to convert to uint32 first before converting to int32. func BigEndianUint32Swapped(b []byte) uint64 { _ = b[3] // bounds chec...
meters/rs485/transform.go
0.760917
0.46393
transform.go
starcoder
package ast // ChildVisitor is a callback function used by VisitChildren to visit nodes. type ChildVisitor func(interface{}) // ChildTransformer is a callback function used by TransformChildren to visit nodes. type ChildTransformer func(child, parent interface{}) interface{} // TransformChildren is a helper functio...
gapis/api/gles/glsl/ast/visitor.go
0.5083
0.477067
visitor.go
starcoder
package godiffpriv import ( "encoding/json" "math" "reflect" "strconv" "time" "github.com/montanaflynn/stats" "golang.org/x/exp/rand" "gonum.org/v1/gonum/stat/distuv" ) // Internal representation for numeric datasets type quantitative struct { data []float64 } // Internal representation for symbolic datase...
diffpriv-core.go
0.714528
0.506652
diffpriv-core.go
starcoder
package fp func (l BoolList) IsEmpty() bool { return l == NilBoolList } func (l StringList) IsEmpty() bool { return l == NilStringList } func (l IntList) IsEmpty() bool { return l == NilIntList } func (l Int64List) IsEmpty() bool { return l == NilInt64List } func (l ByteList) IsEmpty...
fp/bootstrap_list_isempty.go
0.601008
0.625552
bootstrap_list_isempty.go
starcoder
package waddrmgr import ( "time" chainhash "github.com/l0k18/pod/pkg/chain/hash" "github.com/l0k18/pod/pkg/db/walletdb" ) // BlockStamp defines a block (by height and a unique hash) and is used to mark a point in the blockchain that an // address manager element is synced to. type BlockStamp struct { Height i...
pkg/wallet/addrmgr/sync.go
0.692018
0.434701
sync.go
starcoder
package main import ( "bufio" "fmt" "os" "strconv" "strings" ) // Must have either x1==x2 or y1==y2 to be a valid line. type line struct { x1, y1, x2, y2 int } func (l line) parallel(o line) bool { return (l.x1 == l.x2) == (o.x1 == o.x2) } func (l line) length() int { if l.x1 == l.x2 { return abs(l.y1 - l...
2019/day03/crossedWires.go
0.590897
0.420778
crossedWires.go
starcoder
package transactions import ( "bytes" "github.com/dusk-network/dusk-blockchain/pkg/p2p/wire/encoding" ) // Note represents a Phoenix note. type Note struct { Randomness []byte `json:"randomness"` PkR []byte `json:"pk_r"` Commitment []byte `json:"commitment"` Nonce []byte `json:"nonce"`...
pkg/core/data/ipc/transactions/note.go
0.82559
0.422445
note.go
starcoder
package stl // This file contains the 3D vector data type that is used for the triangles import ( "math" ) // Vec3 represents a 3D vector, used in Triangle for normal vector and vertices. type Vec3 [3]float32 // vec3Zero is the zero vector var vec3Zero = Vec3{0, 0, 0} // len returns the Euclidean length of a vect...
vec3.go
0.909648
0.768993
vec3.go
starcoder
package listing // Service provides risk matrix and risk listing operations type Service interface { GetRiskMatrix(int) (RiskMatrix, error) GetRiskMatrixByPath(string) (RiskMatrix, error) GetAllRisks(int) []Risk GetRisk(string) (Risk, error) GetAllRiskMatrix() []RiskMatrix GetMediaPath() (string, error) } type ...
pkg/listing/service.go
0.807005
0.588032
service.go
starcoder
// Package gbst provides an implementation of the GBST (gradient-based subword tokenization) // module from the Charformer paper (https://arxiv.org/abs/2106.12672). // It automatically learns latent sub-words representations from characters in a data-driven fashion. package gbst import ( "encoding/gob" "math" mat...
pkg/nlp/gbst/model.go
0.908133
0.508605
model.go
starcoder
package byteslice // LUnset apply AND operation on a byte slice with an "unset" byte slice using big endian order. func LUnset(data, unsetData []byte) []byte { var dataLength = len(data) if dataLength < 1 { return data } unsetDataLength := len(unsetData) operationLength := dataLength operationCut := dataLengt...
byteslice_bigendian.go
0.796292
0.571288
byteslice_bigendian.go
starcoder
package utils import ( "math/big" "github.com/daoleno/uniswapv3-sdk/constants" ) /** * Returns an imprecise maximum amount of liquidity received for a given amount of token 0. * This function is available to accommodate LiquidityAmounts#getLiquidityForAmount0 in the v3 periphery, * which could be more precise b...
utils/max_liquidity_for_amounts.go
0.81119
0.694296
max_liquidity_for_amounts.go
starcoder
package skin import ( "bytes" _ "embed" "image" "image/draw" "image/png" "log" "strings" drw "golang.org/x/image/draw" "golang.org/x/image/math/f64" ) var ( skewA float64 = 26.0 / 45.0 skewB float64 = skewA * 2.0 transformForward matrix3 = matrix3{ XX: 1, YX: -skewA, XY: 0, YY: ...
util.go
0.591015
0.430327
util.go
starcoder
package vec2 import ( "math" "github.com/jppribeiro/go-vectorial/matrix2" ) // Vec2 defines a 3-dimension vector type Vec2 struct { I float64 J float64 } // New returns a nre vec2 pointer func New(i float64, j float64) *Vec2 { return &Vec2{i, j} } // Add takes a Vec2 transforming v1 by adding their dimensions...
vec2/vec2.go
0.935273
0.629888
vec2.go
starcoder
package goldilocks import ( "errors" "fmt" fp "github.com/Windscribe/go-vhost/circl/math/fp448" ) // Point is a point on the Goldilocks Curve. type Point struct{ x, y, z, ta, tb fp.Elt } func (P Point) String() string { return fmt.Sprintf("x: %v\ny: %v\nz: %v\nta: %v\ntb: %v", P.x, P.y, P.z, P.ta, P.tb) } // F...
circl/ecc/goldilocks/point.go
0.792865
0.400163
point.go
starcoder
package heap import "github.com/ericmittelhammer/ginomialheap/tree" type BinomialHeap struct { // head of the heap. will be the tree with the lowest degree in the heap Head *tree.BinomialTree // shortcut pointer to the tree with the smallest head element. // ensures O(1) lookup Min *tree.BinomialTree } // util...
heap/heap.go
0.665302
0.607285
heap.go
starcoder
package tracertest import ( "fmt" "net/http" "reflect" "testing" "github.com/DataDog/dd-trace-go/tracer" "github.com/DataDog/dd-trace-go/tracer/ext" "github.com/stretchr/testify/assert" ) // CopySpan returns a new span with the same fields of the copied one. // This function is necessary because the usual ass...
tracer/tracertest/tracertest.go
0.782413
0.506408
tracertest.go
starcoder
package xutil import ( "errors" "time" ) // UNow returns universal current timestamp (location set to UTC). func UNow() time.Time { return time.Now().UTC() } // UNowPtr returns universal current timestamp (location set to UTC) // as pointer value. func UNowPtr() *time.Time { ts := time.Now().UTC() return &ts }...
xutil/temporal.go
0.786705
0.424412
temporal.go
starcoder
package af // Function is a struct used for giving an underlying function a name and definitions. type Function struct { Name string // the name of the function Description string // a description of the function Aliases []s...
pkg/af/Function.go
0.750736
0.54819
Function.go
starcoder
package numato import ( "bytes" "fmt" "strconv" "strings" ) // Simulator controls a dummy Numato device. // It only deals with the input/output of the numato.Numato object and does not // handle all valid inputs to a real Numato. type Simulator struct { relays, GPIOs, ADCs uint8 state map[portType...
simulator.go
0.583441
0.451085
simulator.go
starcoder
package intcode import ( "fmt" ) type Operation interface { ex(*Intcode) int } func operation(memory []int, ip int) (Operation, error) { var op Operation value := memory[ip] opcode := value % 100 modes := ParseModes(value) switch opcode { case 99: op = Halt{} case 1: op = Add{memory[ip+1], memory[ip+2],...
v19/internal/intcode/operation.go
0.639286
0.465205
operation.go
starcoder
package deregexp import ( "fmt" "regexp/syntax" "sort" "strings" ) // part describes a part of the regexp after converting it to this simple form. type part interface { describePart() string } // word is a literal. type word string // separator is one (or more) unknown characters, which we can't substring filt...
parts.go
0.52902
0.432303
parts.go
starcoder
package finnhub import ( "encoding/json" ) // BasicFinancials struct for BasicFinancials type BasicFinancials struct { // Symbol of the company. Symbol *string `json:"symbol,omitempty"` // Metric type. MetricType *string `json:"metricType,omitempty"` Series *map[string]interface{} `json:"series,omitempty"` Me...
model_basic_financials.go
0.734596
0.489442
model_basic_financials.go
starcoder
package z import ( "encoding/binary" ) // Buffer is equivalent of bytes.Buffer without the ability to read. It uses z.Calloc to allocate // memory, which depending upon how the code is compiled could use jemalloc for allocations. type Buffer struct { buf []byte offset int } // NewBuffer would allocate a buffer...
z/buffer.go
0.681091
0.431944
buffer.go
starcoder
package aggregation import ( "sync" "time" ) // TimedFloat64Buckets keeps buckets that have been collected at a certain time. type TimedFloat64Buckets struct { bucketsMutex sync.RWMutex // Metrics received in a certain timeframe are all summed up. // This assumes that we don't take multiple readings of // the s...
pkg/autoscaler/aggregation/bucketing.go
0.772101
0.456046
bucketing.go
starcoder
package seating import ( "bytes" "io/ioutil" ) // DataFile defines where to read input data from var DataFile = "data/game.txt" // Answer provides the day's answers func Answer() (int, int, error) { data, err := ioutil.ReadFile(DataFile) if err != nil { return 0, 0, err } data = bytes.TrimRight(data, "\n") ...
2020/pkg/seating/seating.go
0.675444
0.410461
seating.go
starcoder
package base type Tuple interface { GetData(index int) Feature SetData(index int, newValue interface{}) GetClass() Feature SetClass(newClass interface{}) DataSize() int IsNumeric() bool } type NumericTuple interface { Tuple GetNumericData(index int) float64 ToFloatSlice() []float64 } type ...
base/tuple.go
0.798815
0.425486
tuple.go
starcoder
package go2048 import ( "bytes" "image" ) type cellContenter interface { Size() image.Point CellValue(cell image.Point) (val int, ok bool) } type dummyCellContenter image.Point func (c dummyCellContenter) Size() image.Point { return image.Point(c) } func (c dummyCellContenter) CellValue(cell image.Point) (val...
printable.go
0.570092
0.42185
printable.go
starcoder
package particles // Config contains data for particles configuration type Config struct { Speed float64 Area float64 Size float64 Color string Bounds bool Bounce bool Move bool } // DefaultConfig is a default value for config var DefaultConfig = Config{2.0, 80.0, 1.8, "#ccccFF", true, true, true} // ...
particles/particle.go
0.751192
0.517083
particle.go
starcoder
package cmd import ( "github.com/gdurandvadas/tfc/module" "github.com/spf13/cobra" "github.com/spf13/viper" ) var moduleCmd = &cobra.Command{ Use: "module", Short: "Execute module actions", Long: `The module sub-command is in charge of the interaction with the modules in the Terraform Cloud Modules Registry. ...
cmd/module.go
0.586404
0.543227
module.go
starcoder
package pcfmetrics import ( "fmt" "strconv" "strings" "time" ) type counter interface { Count() int64 } type gauge interface { Value() int64 } type gaugeFloat64 interface { Value() float64 } type meter interface { Count() int64 Rate1() float64 Rate5() float64 Rate15() float64 RateMean() float64 } typ...
converters.go
0.733452
0.474205
converters.go
starcoder
package main import ( "github.com/ByteArena/box2d" "github.com/wdevore/Ranger-Go-IGE/api" "github.com/wdevore/Ranger-Go-IGE/engine/rendering/color" "github.com/wdevore/Ranger-Go-IGE/extras/shapes" ) type slopePhysicsComponent struct { physicsComponent slope api.INode } func newFencePhysicsComponent() *slopePh...
examples/complex/physics/basic/p6_slopes/slope_physics_component.go
0.712232
0.40489
slope_physics_component.go
starcoder
package docs import "github.com/swaggo/swag" const docTemplate = `{ "schemes": {{ marshal .Schemes }}, "swagger": "2.0", "info": { "description": "{{escape .Description}}", "title": "{{.Title}}", "contact": {}, "version": "{{.Version}}" }, "host": "{{.Host}}", "...
src/api/docs/docs.go
0.630685
0.405566
docs.go
starcoder
package dataframe import ( "crypto/sha1" "encoding/json" "fmt" "log" "sort" "strings" "github.com/ptiger10/pd/internal/index" "github.com/ptiger10/pd/internal/values" "github.com/ptiger10/pd/series" "github.com/ptiger10/pd/options" ) // Rename the DataFrame. func (df *DataFrame) Rename(name string) { df....
dataframe/modify.go
0.510741
0.410225
modify.go
starcoder
package sqlset import "context" /* Adapter is an interface providing the methods needed to implement a Set with a database backend. ColumnName takes a string feature name and returns a column name for the feature in a string or an error CreateDiscreteValuesTable should create a table containing the different values...
set/sqlset/adapter.go
0.760828
0.873053
adapter.go
starcoder
package calculator import ( "fmt" "math" "strconv" "strings" ) // Add takes some numbers and returns the result of adding them together. func Add(inputs ...float64) (float64, error) { res := inputs[0] if len(inputs) < 2 { return 0, fmt.Errorf("bad input: %f (only one operand)", res) } for _, n := range in...
calculator.go
0.800185
0.513181
calculator.go
starcoder
package std // A StrMap is a map[string]interface{} and holds arbitrary unboxed values. type StrMap struct { // Map contains all string keys and values Map map[string]interface{} } func (m *StrMap) init() { if m.Map == nil { m.Map = make(map[string]interface{}) } } // Put replaces any unboxed key in the map wi...
strmap.go
0.797754
0.488954
strmap.go
starcoder
package aoc2015 /* --- Day 6: Probably a Fire Hazard --- Because your neighbors keep defeating you in the holiday house decorating contest year after year, you've decided to deploy one million lights in a 1000x1000 grid. Furthermore, because you've been especially nice this year, Santa has mailed you instructions on ...
app/aoc2015/aoc2015_06.go
0.795975
0.664894
aoc2015_06.go
starcoder
package imageoutput import "math" // CoordinateCollection holds an array of coordinates as they turn into symmetry patterns. type CoordinateCollection struct { coordinates *[]*MappedCoordinate } // Coordinates returns the collection of coordinates. func (c *CoordinateCollection) Coordinates() *[]*MappedCoordinate {...
entities/imageoutput/coordinatecollection.go
0.917488
0.410284
coordinatecollection.go
starcoder
package cldr var localeslice = []LocaleInfo{ {Lang: "af", SepDecimal: ',', SepGroup: ' ', DigitZero: '0', DigitNine: '9'}, {Lang: "af_NA", SepDecimal: ',', SepGroup: ' ', DigitZero: '0', DigitNine: '9'}, {Lang: "af_ZA", SepDecimal: ',', SepGroup: ' ', DigitZero: '0', DigitNine: '9'}, {Lang: "agq", SepDecimal: ',',...
internal/cldr/tables.go
0.557845
0.406214
tables.go
starcoder
package pgtype import ( "database/sql/driver" "encoding/binary" "math" "strconv" "github.com/jackc/pgio" errors "golang.org/x/xerrors" ) type Float8 struct { Float float64 Status Status } func (dst *Float8) Set(src interface{}) error { if src == nil { *dst = Float8{Status: Null} return nil } if val...
float8.go
0.674587
0.448004
float8.go
starcoder
package html // Attributes defines a list of attribute pairs type Attributes []AttrPair // AttrPair defines a n attribute key and value pair type AttrPair struct { Key string Value interface{} } // Attr returns an attribute pair with the given key and value func Attr(key string, value interface{}) Attributes { ...
attributes.go
0.87251
0.450843
attributes.go
starcoder
package render import ( "text/template" "github.com/VirtusLab/crypt/aws" "github.com/VirtusLab/crypt/azure" "github.com/VirtusLab/crypt/gcp" ) /* TemplateFunctions provides template functions for render or the standard (text/template) template engine - encryptAWS - encrypts the data from inside of the templat...
crypto/render/functions.go
0.692122
0.441011
functions.go
starcoder
package openapi import ( "encoding/json" "fmt" "net/url" "strings" "time" "github.com/twilio/twilio-go/client" ) // Optional parameters for the method 'CreateCompositionHook' type CreateCompositionHookParams struct { // An array of track names from the same group room to merge into the compositions created b...
rest/video/v1/composition_hooks.go
0.82029
0.522324
composition_hooks.go
starcoder
package transform import ( "image/png" "io" "math" "github.com/disintegration/imaging" "github.com/tidepool-org/platform/errors" "github.com/tidepool-org/platform/image" "github.com/tidepool-org/platform/pointer" "github.com/tidepool-org/platform/structure" structureValidator "github.com/tidepool-org/platfo...
image/transform/transform.go
0.751739
0.465934
transform.go
starcoder
package generator import ( "fmt" ) type loopKind = int const ( niceLoop loopKind = iota strongLoop weakLoop ) func (g *Grid) xCycles(verbose uint) (res bool) { // Find all strong links. A pair of points form a strong link if they contain the only two instances of a digit within a unit (box, column, or row). v...
generator/xCycles.go
0.594787
0.557604
xCycles.go
starcoder
package graph import ( i04eb5309aeaafadd28374d79c8471df9b267510b4dc2e3144c378c50f6fd7b55 "github.com/microsoft/kiota/abstractions/go/serialization" ) // WorkbookChart type WorkbookChart struct { Entity // Represents chart axes. Read-only. axes *WorkbookChartAxes; // Represents the datalabels on t...
models/microsoft/graph/workbook_chart.go
0.716913
0.497315
workbook_chart.go
starcoder
package geometry import ( "math" "github.com/thommil/tge-g3n/gls" "github.com/thommil/tge-g3n/math32" ) // Cylinder represents a cylinder geometry type Cylinder struct { Geometry RadiusTop float64 RadiusBottom float64 Height float64 RadialSegments int HeightSegments int ThetaStart float...
geometry/cylinder.go
0.76908
0.658637
cylinder.go
starcoder
package tools import ( "fmt" "gopkg.in/bblfsh/sdk.v2/uast/nodes" "gopkg.in/bblfsh/sdk.v2/uast/query" "gopkg.in/bblfsh/sdk.v2/uast/query/xpath" ) // NewContext creates a new query context. func NewContext(root nodes.Node) *Context { return &Context{ root: root, xpath: xpath.New(), } } type Context struct ...
tools/context.go
0.788909
0.479077
context.go
starcoder
package metrics import ( "sync" "time" ) // Timers capture the duration and rate of events. type Timer interface { Metric Count() int64 Max() int64 Mean() float64 Min() int64 Percentile(float64) float64 Percentiles([]float64) []float64 Rate1() float64 Rate5() float64 Rate15() float64 RateMean() float64...
pkg/metrics/timer.go
0.878549
0.483466
timer.go
starcoder
package filters import ( "regexp" "github.com/containerd/containerd/log" ) // Filter matches specific resources based the provided filter type Filter interface { Match(adaptor Adaptor) bool } // FilterFunc is a function that handles matching with an adaptor type FilterFunc func(Adaptor) bool // Match matches th...
vendor/github.com/containerd/containerd/filters/filter.go
0.775095
0.441071
filter.go
starcoder
// Package merkle 实现默克尔树相关的hash计算 package merkle import ( "bytes" "runtime" "github.com/bnchain/bnchain/common" "github.com/bnchain/bnchain/types" ) /* WARNING! If you're reading this because you're learning about crypto and/or designing a new system that will use merkle trees, keep in mind that the followi...
vendor/github.com/33cn/chain33/common/merkle/merkle.go
0.5083
0.505127
merkle.go
starcoder
package chunk import ( "bytes" "encoding/binary" "fmt" "github.com/df-mc/dragonfly/server/block/cube" "github.com/sandertv/gophertunnel/minecraft/nbt" "github.com/sandertv/gophertunnel/minecraft/protocol" "sync" ) const ( // CurrentBlockVersion is the current version of blocks (states) of the game. This versi...
server/world/chunk/data.go
0.642096
0.438905
data.go
starcoder
package geo import ( "fmt" "math" "github.com/adzr/mathex" ) const ( // DecimalPlaces is the number of decimal places considered in the geo-location point latlng values, to indicate the // precision of the coordinates. DecimalPlaces = 8 // RoundOn is the decimal value considered when rounding the geo-location...
point.go
0.828766
0.696958
point.go
starcoder
package golf import ( "encoding/binary" "fmt" "os" ) // Set of constants which specify the type of segment in a program/segment // header. const ( SegTypeNull = uint32(0) SegTypeLoad = uint32(1) SegTypeDynamic = uint32(2) SegTypeInterp = uint32(3) SegTypeNote ...
golf/segments.go
0.644561
0.460168
segments.go
starcoder
package webgl const ( TEXTURE0 = 0x84C0 // A texture unit. TEXTURE1 = 0x84C1 // A texture unit. TEXTURE2 = 0x84C2 // A texture unit. TEXTURE3 = 0x84C3 // A texture unit. TEXTURE4 = 0x84C4 // A texture unit. TEXTURE5 = 0x84C5 // A texture unit. TEXTURE6 = 0x84C6 // A texture unit. TEXTURE7 = 0x84C7 // A texture...
webgl/constants.go
0.609873
0.625695
constants.go
starcoder
package seam import ( "image" "image/draw" "math" "sync" ) func energy(img *image.RGBA, x, y int) float32 { neighbours := [8]float32{ luminance(img, x-1, y-1), luminance(img, x, y-1), luminance(img, x+1, y-1), luminance(img, x-1, y), luminance(img, x+1, y), luminance(img, x-1, y+1), luminance(img, ...
seams.go
0.637257
0.54825
seams.go
starcoder
package main import ( "bufio" "fmt" "os" "strconv" ) func main() { scanner := bufio.NewScanner(os.Stdin) scanner.Split(bufio.ScanWords) _ = scanner.Scan() n, _ := strconv.Atoi(scanner.Text()) fruit := make([]weight, 0, n) for i := 0; i < n && scanner.Scan(); i++ { w, _ := strconv.Atoi(scanner.Text()) fr...
stepik/course-156/lesson-12560/step-7/main.go
0.500977
0.419588
main.go
starcoder
package testza import ( "math/rand" "testing" "github.com/MarvinJWendt/testza/internal" ) // MockInputsStringsHelper contains strings test sets. type MockInputsStringsHelper struct{} // Empty returns a test set with a single empty string. func (s MockInputsStringsHelper) Empty() []string { return []string{""} }...
mock-strings.go
0.721351
0.453927
mock-strings.go
starcoder
package queuedprocessor import ( "go.opencensus.io/stats" "go.opencensus.io/stats/view" "go.opencensus.io/tag" "go.opentelemetry.io/collector/obsreport" "go.opentelemetry.io/collector/processor" ) // Variables related to metrics specific to queued processor. var ( statInQueueLatencyMs = stats.Int64("queue_lat...
processor/queuedprocessor/metrics.go
0.63307
0.425068
metrics.go
starcoder
package affine import ( "math" ) // calcuate the cos and sin degree value func cosSinDeg(deg float64) (float64, float64) { deg = math.Mod(deg, 360.0) switch deg { case 90.0: return 0.0, 1.0 case 180.0: return -1.0, 0.0 case 270.0: return 0.0, -1.0 } rad := deg * math.Pi / 180.0 return math.Cos(rad), ma...
affine.go
0.903986
0.729002
affine.go
starcoder
package evaluator import ( "github.com/manishmeganathan/tunalang/object" "github.com/manishmeganathan/tunalang/syntaxtree" ) var ( NULL = &object.Null{} TRUE = &object.Boolean{Value: true} FALSE = &object.Boolean{Value: false} ) // A function that evaluates a Syntax Tree given a node // on it and returns an e...
evaluator/core.go
0.690455
0.522324
core.go
starcoder
package accounting import ( "fmt" "time" "github.com/lightningnetwork/lnd/lnwire" "github.com/shopspring/decimal" "github.com/lightninglabs/faraday/fiat" ) // Report contains a set of entries. type Report []*HarmonyEntry // HarmonyEntry represents a single action on our balance. type HarmonyEntry struct { //...
accounting/report.go
0.73782
0.427636
report.go
starcoder
package triangle // Point defines a struct having as components the point X and Y coordinate position. type Point struct { x, y int } // Node struct having as components the node X and Y coordinate position. type Node struct { X, Y int } // Struct which defines a circle geometry element. type circle struct { x, y...
server/vendor/github.com/esimov/triangle/delaunay.go
0.862699
0.736092
delaunay.go
starcoder
package plan import ( "github.com/insionng/yougam/libraries/pingcap/tidb/ast" "github.com/insionng/yougam/libraries/pingcap/tidb/parser/opcode" ) const ( rateFull float64 = 1 rateEqual float64 = 0.01 rateNotEqual float64 = 0.99 rateBetween float64 = 0.1 rateGreaterOrLess float64 = ...
libraries/pingcap/tidb/optimizer/plan/filterrate.go
0.644561
0.547887
filterrate.go
starcoder
package packed import () // util/packed/BulkOperationPacked.java // Non-specialized BulkOperation for Packed format type BulkOperationPacked struct { *BulkOperationImpl bitsPerValue int longBlockCount int longValueCount int byteBlockCount int byteValueCount int mask int64 intMask int } fu...
core/util/packed/bulkop.go
0.58522
0.447279
bulkop.go
starcoder
package hoverfly import ( "encoding/json" "github.com/SpectoLabs/hoverfly/core/handlers/v2" "github.com/SpectoLabs/hoverfly/functional-tests" "github.com/SpectoLabs/hoverfly/functional-tests/testdata" . "github.com/onsi/ginkgo" . "github.com/onsi/gomega" ) var _ = Describe("Running Hoverfly with older simulati...
functional-tests/core/ft_simulation_upgrading.go
0.526099
0.618694
ft_simulation_upgrading.go
starcoder
package common import ( "github.com/ajstarks/svgo" "fmt" "math" "math/rand" "os" ) type WeightedBoundable struct { Boundable Boundable Weight float64 } func (wb WeightedBoundable) Bounds() Rectangle { return wb.Boundable.Bounds() } type WidthBoundable struct { Boundable Boundable Width float64 } func (b...
fbastani-solution/common/svg.go
0.66454
0.410343
svg.go
starcoder
package main import ( "sort" ) /***************************************************************************************************** * * Given a non-empty list of words, return the k most frequent elements. * Your answer should be sorted by frequency from highest to lowest. If two words have the same * frequenc...
leetcode/692.top_k_frequent_words/692.TopKFrequentWords_zmillionaire.go
0.500732
0.439146
692.TopKFrequentWords_zmillionaire.go
starcoder
package moving_average import ( "github.com/influxdata/flux" "github.com/influxdata/flux/array" "github.com/influxdata/flux/execute" "github.com/influxdata/flux/values" ) type ExponentialMovingAverage struct { inTimePeriod int i []int count []float64 value []float64 periodReached...
internal/moving_average/exponential_moving_average.go
0.606265
0.53692
exponential_moving_average.go
starcoder
package tpe import ( "sort" ) func ones1d(size int) []float64 { ones := make([]float64, size) for i := 0; i < size; i++ { ones[i] = 1 } return ones } func linspace(start, stop float64, num int, endPoint bool) []float64 { step := 0. if endPoint { if num == 1 { return []float64{start} } step = (stop ...
tpe/array.go
0.621081
0.406214
array.go
starcoder
package dsf import ( "encoding/binary" "fmt" "github.com/snmoore/go/audio" "reflect" ) // FmtChunk is the file structure of the fmt chunk within a DSD stream file. // See "DSF File Format Specification", v1.01, Sony Corporation. All data is // little-endian. This is exported to allow reading with binary.Read. ty...
audio/dsf/fmt.go
0.668664
0.472197
fmt.go
starcoder
package std //* import ( "github.com/mb0/xelf/cor" "github.com/mb0/xelf/exp" "github.com/mb0/xelf/lit" "github.com/mb0/xelf/typ" ) var ErrExpectNumer = cor.StrError("expected numer argument") func opAdd(r, n float64) (float64, error) { return r + n, nil } func opMul(r, n float64) (float64, error) { return r * n,...
std/arit.go
0.556641
0.409811
arit.go
starcoder
package spogoto // CursorCommands are functions that operate on the Cursor manipulating // its position. type CursorCommands map[string]func(RunSet) // RunSet is a container for a Spogoto code's execution environment. // The RunSet contains the DataStacks that the code will operate on as // well as other information ...
runset.go
0.62395
0.449211
runset.go
starcoder
package business import ( validation "github.com/go-ozzo/ozzo-validation" "github.com/go-ozzo/ozzo-validation/is" ) // Validate validates the CreateEdgeClusterRequest model and return error if the validation failes // Returns error if validation failes func (val CreateEdgeClusterRequest) Validate() error { return ...
services/business/validation.go
0.729038
0.407274
validation.go
starcoder
package yaspeech // The Voice for the synthesized speech. // You can choose one of the following voices: // Female voice: alyss, jane, oksana and omazh. // Male voice: zahar and ermil. // Default value of the parameter: oksana. type Voice string // Voices of the synthesized speech. const ( VoiceAlyss Voice = "alyss...
options.go
0.542621
0.400896
options.go
starcoder
package trietree import ( "github.com/howz97/algorithm/alphabet" "github.com/howz97/algorithm/queue" "github.com/howz97/algorithm/util" ) // Three direction trie tree that is compressible type TSTC struct { TSTCNode compressed bool } func (t *TSTC) Compress() error { t.compress() t.compressed = true return n...
trie_tree/tstc_node.go
0.508788
0.441252
tstc_node.go
starcoder
package note import "strconv" func (xs IDSlice) Append(add ...ID) IDSliceDelta { return xs.Insert(len(xs), add...) } func (xs IDSlice) Retain(r int) IDSliceDelta { return IDSliceDelta{}.Retain(r) } func (xs IDSlice) Insert(i int, add ...ID) IDSliceDelta { return xs.Retain(i).Insert(add...) } func (xs IDSlice) ...
note/id_ot.go
0.64579
0.438424
id_ot.go
starcoder
package hector import ( "math" ) /** * It's based the paper "Scalable Training of L1-Regularized Log-Linear Models" * by <NAME> and <NAME> * user: weixuan * To change this template use File | Settings | File Templates. */ type QuasiNewtonHelper struct { // config numHist int64 minimizer Minimizer...
quasinewton_helper.go
0.692954
0.426202
quasinewton_helper.go
starcoder
package tableprinter import ( "reflect" ) type stringable interface { String() string } func (p *Printer) makeTable(value interface{}) (*table, error) { // Check that we've not been given a nil value: if value == nil { return nil, ErrNoData } // See if we have an easily stringable interface: if stringable...
table_types.go
0.740174
0.499817
table_types.go
starcoder
package main import ( "fmt" "io/ioutil" "log" "math" "os" "sort" "strings" ) type Point struct{ x, y int } // Method for distance between 2 points func (p Point) dist(p0 Point) float64 { return math.Sqrt(math.Pow(float64(p.x-p0.x), 2) + math.Pow(float64(p.y-p0.y), 2)) } func main() { if len(os.Args) < 2 {...
2019/Day-10/Monitoring_Station/main.go
0.623606
0.411702
main.go
starcoder