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 elmo import ( "errors" "fmt" "strconv" "strings" "github.com/google/uuid" ) func ConvertStringToValue(in string) Value { stringValue := strings.Trim(in, " \t") if i, err := strconv.ParseInt(stringValue, 0, 64); err == nil { return NewIntegerLiteral(i) } if f, err := strconv.ParseFloat(stringValu...
core/convert.go
0.582729
0.4165
convert.go
starcoder
package allhic import ( "fmt" "math" "math/rand" "os" "github.com/MaxHalford/eaopt" ) // LIMIT determines the largest distance for two tigs to add to total score const LIMIT = 10000000 // LimitLog is the Log of LIMIT var LimitLog = math.Log(LIMIT) // We will implement the Slice interface here, key ideas borro...
evaluate.go
0.816772
0.405537
evaluate.go
starcoder
package elevator import "github.com/cyrusroshan/mesosphere-elevator/utils" // Note that for max 16 elevators, size and time complexity of array copying, and most other operations in this pagkage are negligible, and the time required for a hashing function is relatively high compared to iterating through an array to f...
elevator/elevator.go
0.719778
0.410697
elevator.go
starcoder
package genlsystem import ( "image" "image/color" "math" "github.com/llgcode/draw2d/draw2dimg" ) type Bounds struct { minX, minY float64 maxX, maxY float64 } func (a *Bounds) AddPoint(x, y float64) { if a.minX > x { a.minX = x } if a.maxX < x { a.maxX = x } if a.minY > y { a.minY = y } if a.maxY ...
genlsystem/turtlegraph.go
0.770465
0.477128
turtlegraph.go
starcoder
package maxrect import "image" type Rule byte const ( Automatic Rule = iota ShortSide LongSide BottomLeft Area ContactPoint ) func ParseRule(s string) Rule { switch s { case "short-side": return ShortSide case "long-side": return LongSide case "bottom-left": return BottomLeft case "area": return ...
maxrect/best.go
0.58059
0.438064
best.go
starcoder
package ptr import "time" // String returns a pointer to the string value passed in. func String(v string) *string { return &v } // StringValue returns the value of the string pointer passed in or // "" if the pointer is nil. func StringValue(v *string) string { if v != nil { return *v } return "" } // String...
vendor/github.com/turbinelabs/nonstdlib/ptr/ptr.go
0.880695
0.419529
ptr.go
starcoder
package imaging import ( "../common" "image" "image/color" "image/png" "os" ) /* How a single CHR is represented: - Each CHR is 128 bits (16 bytes) - Each CHR is 8x8 pixels - Each pixel within a CHR is one of 4 colors - Each pixel within a CHR is 2 bits (0b00 = color0, 0b10 = color1, 0...
pkg/imaging/convertImageData.go
0.654232
0.676123
convertImageData.go
starcoder
package models import ( i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91 "github.com/microsoft/kiota-abstractions-go/serialization" ) // ClassificationAttribute type ClassificationAttribute struct { // Stores additional data not described in the OpenAPI description found when deserializing. ...
models/classification_attribute.go
0.750644
0.411584
classification_attribute.go
starcoder
package array import ( "strconv" "strings" ) /* # Product of Array Except Self # https://leetcode.com/explore/interview/card/top-interview-questions-hard/116/array-and-strings/827/ Given an array nums of n integers where n > 1, return an array output such that output[i] is equal to the product of all the element...
interview/hard/array/array.go
0.7586
0.508971
array.go
starcoder
package qb import ( "fmt" "strings" ) const ( // SQLNow is the SQL NOW() function for use as a value in expressions. SQLNow = "NOW()" // SQLNull is the SQL representation of NULL SQLNull = "NULL" ) type expressionUnion struct { value interface{} field *TableField multi []expressionUnion } func newUnion(va...
database/qb/expression.go
0.691497
0.492066
expression.go
starcoder
package keys import ( "strings" "go-des/internal/pkg/binary" ) // Pc1 function is the implementation of the PC-1 permutation in the keys generating process func pc1(s []string) ([]string, []string) { return []string{ s[56], s[48], s[40], s[32], s[24], s[16], s[8], s[0], s[57], s[49], s[41], s[33], s[25], s...
internal/app/keys/generation.go
0.553505
0.444384
generation.go
starcoder
package model type XYAxis struct { // Name of axis. Name string `json:"name,omitempty"` // Type of axis. // Option: // * 'value': Numerical axis, suitable for continuous data. // * 'category': Category axis, suitable for discrete category data. // Category data can be auto retrieved from series.data or datas...
model/xy_axis.go
0.828176
0.521471
xy_axis.go
starcoder
package fisheye import ( "image" "image/draw" "math" ) func Formula(s float64) float64 { if s < 0 { return 0 } else if s > 1 { return s } return -0.75*s*s*s + 1.5*s*s + 0.25*s } func DistanceRange(dx int) (int, int) { return dx / 4, dx/3 + 1 } func FindDistance(src image.Image, testRowIndex int) (image...
fisheye/fisheye.go
0.721449
0.47926
fisheye.go
starcoder
package pt import ( "fmt" "image" "math" ) type Texture interface { Sample(u, v float64) Color NormalSample(u, v float64) Vector BumpSample(u, v float64) Vector Pow(a float64) Texture MulScalar(a float64) Texture } var textures map[string]Texture func init() { textures = make(map[string]Texture) } func Ge...
pt/texture.go
0.73848
0.514095
texture.go
starcoder
package main import ( "github.com/go-gl/gl/v4.1-core/gl" ) type Cell struct { drawable uint32 IsAlive bool AliveNext bool x int y int } func (c *Cell) Draw() { if !c.IsAlive { return } gl.BindVertexArray(c.drawable) gl.DrawArrays(gl.TRIANGLES, 0, int32(len(square)/3)) } func (c *Cell) CheckState(ce...
cell.go
0.60288
0.437042
cell.go
starcoder
package waffleiron /* Builder 5 is not implemented yet type Builder5[T5, T4, T3, T2, T1, U any] struct { b builtParser[T5, T4, T3, T2, T1, U] } */ type Builder3[T5, T4, T3, T2, T1, U any] struct { b builtParser[T5, T4, T3, T2, T1, U] } // Begin3 can be used to construct a Parser in method chain style. // Results o...
build.go
0.617859
0.464112
build.go
starcoder
package main import "fmt" func main() { // In Go there are two distinct categories of types: //------------------------ // 1. Value type variables point directly to their value contained in memory. // All types explored in previous sections except "pointer, slice, map, // channel, interface and function values...
4.types/2.zerovalues.go
0.566258
0.563558
2.zerovalues.go
starcoder
package api import ( "math" ) // VecI is a 2D vector with integer components. type VecI PointI // Neg flips a vector to point in the opposite direction. func (v VecI) Neg() VecI { return VecI{-v.X, -v.Y} } // Add two vectors and return the result. func (v VecI) Add(v2 VecI) VecI { return VecI{v.X + v2.X, v.Y + v...
api/vectors.go
0.943608
0.618089
vectors.go
starcoder
package container type MaxHeap struct { Nodes []int } func NewMaxHeap() *MaxHeap { return &MaxHeap{ Nodes: make([]int, 0), } } // Insert inserts an integer into the max heap maintaining the max heap invariant // that the root node is the maximum element. func (mh *MaxHeap) Insert(x int) { mh.Nodes = append(mh....
container/max_heap.go
0.76708
0.471345
max_heap.go
starcoder
package sm4 import ( "crypto/cipher" "encoding/binary" ) //go:generate go run generate_parameter.go type sm4Cipher struct { expandedKey [Round]uint32 } // BlockSize returns the cipher's block size. func (c *sm4Cipher) BlockSize() int { return BlockSize } // Decrypt decrypts the first block in src into dst. // ...
cipher.go
0.66454
0.417331
cipher.go
starcoder
package fcm import ( "log" "math" "math/rand" ) // Interface defines the data type that should be used with fcm. The data type is for a single data point and should implement the following: // Multiply: Scale a data point to a given weight. // Add: Add 2 data points together. // Norm: Calculate distance measure be...
fcm/fcm.go
0.789112
0.796886
fcm.go
starcoder
package binrpc import ( "bufio" "bytes" "errors" "fmt" "io" "math/rand" "strconv" ) // BinRPCMagic is a magic value at the start of every BINRPC packet. // BinRPCVersion is the version implemented (currently 1). const ( BinRPCMagic uint8 = 0xA BinRPCVersion uint8 = 0x1 TypeInt uint8 = 0x0 TypeString ...
binrpc.go
0.712432
0.519948
binrpc.go
starcoder
package facet import ( "fmt" "math" "time" "gonum.org/v1/plot" ) // ---------------------------------------------------------------------------- // Scale // Scale is a generalizes axis: While a plot has exactly two axes (the x-axis // and the y-axis) it can have more scales, e.g. a color scale, a linetype // sc...
scale.go
0.719088
0.554712
scale.go
starcoder
package errors import ( "fmt" "runtime" "strings" ) const ( // A cycle is detected in the Workflow, the error description should detail the nodes involved. CycleDetected ErrorCode = "CycleDetected" // BranchNode is missing a case with ThenNode populated. BranchNodeIDNotFound ErrorCode = "BranchNodeIdNotFound"...
pkg/compiler/errors/compiler_errors.go
0.734024
0.405979
compiler_errors.go
starcoder
package protocol // StorageRecords is the interface that show how an record storage work. // Records are anything (such as a document or a phonograph record or a photograph) providing permanent evidence of or information about past events // and equivalent to rows in RDBMS. // - Record owner is one app so it must han...
protocol/storage-record.go
0.590543
0.462898
storage-record.go
starcoder
package parameters import ( "fmt" "github.com/barchart/common-go/pkg/configuration/database" ) // Results is a structure for parsed parameters. type Results map[string]interface{} // GetString returns a string value from the results structure by key. func (r Results) GetString(key string) string { return r[key]....
pkg/parameters/results.go
0.831725
0.538194
results.go
starcoder
package mat import "math" // Matrix is typed as a 2d slice -- rows x columns type Matrix [][]float64 // Size returns the size of the matrix func (m Matrix) Size() []int { s := make([]int, 2) s[0] = len(m) s[1] = len(m[0]) return s } // IsSquare checks for square matrix func (m Matrix) IsSquare() bool { // Ge...
mat/matrix.go
0.772616
0.555797
matrix.go
starcoder
package main import ( "fmt" ) func IsValidMove(b *board, prev position, p position) (bool, string) { if p.x < 'a' || p.x > 'i' || p.y < 1 || p.y > 9 { return false, "coordinates out of bounds" } if b.GetAt(p.x, p.y) != Empty { return false, "position already occupied" } if prev.x != 0 { prev_corner, _...
moves.go
0.550366
0.441252
moves.go
starcoder
package predictor import ( "fmt" "log" "math" "strings" "time" "github.com/go-gota/gota/dataframe" "github.com/go-gota/gota/series" "github.com/pkg/errors" "gonum.org/v1/gonum/mat" "gorgonia.org/tensor" "example.com/predictor_go/utils" ) const ( day = 24.0 * 60.0 * 60.0 year = (365.2425) * day pred =...
predictor/helper.go
0.754825
0.614134
helper.go
starcoder
package stats import ( "time" "github.com/antonmedv/expr" "github.com/antonmedv/expr/vm" "github.com/tkuchiki/alp/parsers" "github.com/tkuchiki/parsetime" ) type ExpEval struct { program *vm.Program parseTime parsetime.ParseTime } type ExpEvalEnv struct { Uri string Method ...
stats/expeval.go
0.589835
0.482917
expeval.go
starcoder
package aiplatform import ( context "context" cmpopts "github.com/google/go-cmp/cmp/cmpopts" codes "google.golang.org/grpc/codes" status "google.golang.org/grpc/status" protocmp "google.golang.org/protobuf/testing/protocmp" assert "gotest.tools/v3/assert" strings "strings" testing "testing" time "time" ) ty...
proto/gen/googleapis/cloud/aiplatform/v1/vizier_service_aiptest.pb.go
0.552057
0.532547
vizier_service_aiptest.pb.go
starcoder
package sliceutil import "reflect" func verifyRmr(s interface{}, from, to int) error { si := reflect.ValueOf(s) if si.Kind() != reflect.Slice { return ErrTypeNotSupport } if si.IsNil() { return ErrSliceIsNil } if si.Len() == 0 { return ErrSliceLengthZero } if from < 0 || from > si.Len()-1 || to < 0 ...
removerange.go
0.781747
0.557183
removerange.go
starcoder
package internal import ( "fmt" "reflect" "sort" "github.com/tada/catch" "github.com/tada/dgo/dgo" "github.com/tada/dgo/util" ) type ( arraySlice interface { _slice() []dgo.Value _deepContainsAll(seen []dgo.Value, other dgo.Iterable) bool } array struct { slice []dgo.Value } arrayFrozen struct { ...
internal/array.go
0.703651
0.544862
array.go
starcoder
package typegraph import ( "fmt" ) // VoidTypeReference returns a reference to the special 'void' type. func (t *TypeGraph) VoidTypeReference() TypeReference { return TypeReference{ tdg: t, value: buildSpecialTypeReferenceValue(specialFlagVoid), } } // NullTypeReference returns a reference to the special '...
graphs/typegraph/basictypes.go
0.802439
0.530054
basictypes.go
starcoder
package nn import ( "fmt" "log" "math" "math/rand" mat "github.com/twiggg/math/mat64" ) var dftLogger = &log.Logger{} //Logger interface, injected in the type Logger interface { Printf(format string, v ...interface{}) } //Datapoint holds input data and expected output type Datapoint struct { Inp *mat.M64 //...
nn/net/learn.go
0.610686
0.423756
learn.go
starcoder
package api import ( "regexp" "strings" ) // The QueryType dictates how a query should be carried out. type QueryType int const ( _ QueryType = iota // Contain searches for equations where the equation or description // contains any of the words in <query>. // e.g. "sin cos" would match the equation "sin(A + ...
api/query.go
0.726037
0.467393
query.go
starcoder
package main import ( "fmt" "math" "time" ) const precision = 1e-4 type Fn func(float64) float64 func fnGleb(x float64) float64 { return math.Log(x) * math.Abs(math.Cos(128*x)) } func simpson(fn Fn, a, b float64) float64 { return ((b - a) / 6) * (fn(a) + 4*fn((a+b)/2) + fn(b)) } func leftRect(fn Fn, a, b flo...
integrate/main.go
0.681727
0.433262
main.go
starcoder
package verifier import "fmt" type IntVerifier struct { } func (vr IntVerifier) Less(v int, n int, msg string) error { return Verify(func() bool { return v < n }, msg) } func (vr IntVerifier) LessN(v int, n int, name string) error { return vr.Less(v, n, fmt.Sprintf(MessageLess, name, n)) } func (vr IntVerifier)...
number.go
0.762954
0.414069
number.go
starcoder
package fiboheap // Sortable is the interface that values stored in the heap must // support. type Sortable interface { Less(b Sortable) bool } // Heap provides an Fibonacci Heap. It can be used without special // initialization. type Heap struct { // forest head contains root nodes; first child node is minimum nod...
heap.go
0.700485
0.619615
heap.go
starcoder
package command import "fmt" type ( // BinaryExpression describes an expression which has a left and a right hand side argument. BinaryExpression interface { Expr LeftExpr() Expr RightExpr() Expr } // BinaryBase is the base of a binary expression, implementing the Expr interface and holding // the left a...
internal/compiler/command/binary_expr.go
0.825238
0.623549
binary_expr.go
starcoder
package platformsnotificationevents import ( "encoding/json" ) // BankAccountDetail struct for BankAccountDetail type BankAccountDetail struct { // The bank account number (without separators). >Refer to the [Onboarding and verification](https://docs.adyen.com/platforms/onboarding-and-verification) section for det...
src/platformsnotificationevents/model_bank_account_detail.go
0.646572
0.45181
model_bank_account_detail.go
starcoder
package mongodb import ( "time" "github.com/authena-ru/courses-organization/internal/domain/course" ) type courseDocument struct { ID string `bson:"_id,omitempty"` Title string `bson:"title"` Period periodDocument `bson:"period"` Started bool `bson:"sta...
internal/adapter/repository/mongodb/marshalling.go
0.545286
0.425307
marshalling.go
starcoder
package prjn import ( "github.com/emer/emergent/edge" "github.com/emer/emergent/evec" "github.com/emer/etable/etensor" "github.com/goki/ki/ints" "github.com/goki/mat32" ) // PoolRect implements a rectangular pattern of connectivity between // two 4D layers, in terms of their pool-level shapes, // where the lowe...
prjn/poolrect.go
0.632503
0.463809
poolrect.go
starcoder
package core // Head emits the first element of the inbound array func Head() Spec { return Spec{ Name: "head", Inputs: []Pin{Pin{"in", ARRAY}}, Outputs: []Pin{Pin{"head", ANY}}, Kernel: func(in, out, internal MessageMap, s Source, i chan Interrupt) Interrupt { arr, ok := in[0].([]interface{}) if !o...
core/array_blocks.go
0.573917
0.411052
array_blocks.go
starcoder
package runtime // RawEqual returns two values. The second one is true if raw equality makes // sense for x and y. The first one returns whether x and y are raw equal. func RawEqual(x, y Value) (bool, bool) { if x.Equals(y) { return true, true } switch x.NumberType() { case IntType: if fy, ok := y.TryFloat()...
runtime/comp.go
0.567937
0.609698
comp.go
starcoder
package trading import ( "context" "sync/atomic" "sync" "time" "strconv" "github.com/pkg/errors" "go.uber.org/zap" ) type expectation struct { reqId ClientOrderId report *OrderReport err error Unsubscribe bool GetSnapshot bool GetOrder bool } type MockTrader struct { logger ...
pkg/trading/mock-trader.go
0.545528
0.427875
mock-trader.go
starcoder
package press /* NOTES: Structure of the metadata we store is: gzipExtraify(gzip([4-byte header size][4-byte block size] ... [4-byte block size][4-byte raw size of last block])) This is appended to any compressed file, and is ignored as trailing garbage in our LZ4 and SNAPPY implementations, and seen as empty archives...
backend/press/compression.go
0.690037
0.730326
compression.go
starcoder
// Package graph provides functionality for directed graphs. package graph // nodeStatus denotes the visiting status of a node when running DFS in a graph. type nodeStatus int const ( unvisited nodeStatus = iota + 1 visiting visited ) // Graph represents a directed graph. type Graph struct { nodes map[string]ne...
internal/pkg/graph/graph.go
0.713631
0.545709
graph.go
starcoder
package collectors import ( "strconv" "strings" "bosun.org/metadata" "bosun.org/opentsdb" "bosun.org/util" ) func init() { collectors = append(collectors, &IntervalCollector{F: c_memcached_stats}) } var memcachedMeta = map[string]MetricMeta{ "accepting_conns": { RateType: metadata.Gauge, Unit: metad...
cmd/scollector/collectors/memcached_unix.go
0.602412
0.411229
memcached_unix.go
starcoder
package timeslice import ( "errors" "sort" "time" ) // TimeSlice is used for sorting. e.g. // sort.Sort(sort.Reverse(timeSlice)) // sort.Sort(timeSlice) type TimeSlice []time.Time func (ts TimeSlice) Len() int { return len(ts) } func (ts TimeSlice) Less(i, j int) bool { return ts[i].Before(ts[j]) } func...
time/timeslice/timeslice.go
0.762424
0.482185
timeslice.go
starcoder
package geometry import ( "github.com/juan-medina/goecs" "math" ) // Point represent a x/y coordinate type Point struct { X float32 // The x coordinate Y float32 // The y coordinate } // Type return this goecs.ComponentType func (pos Point) Type() goecs.ComponentType { return TYPE.Point } // Clamp a geometry.P...
components/geometry/geometry.go
0.883066
0.71597
geometry.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": "https:...
api/docs/docs.go
0.713631
0.446072
docs.go
starcoder
package engine import ( "image" _ "image/jpeg" _ "image/png" "math" "github.com/mumax/3cl/httpfs" "github.com/mumax/3cl/util" ) func init() { DeclFunc("Ellipsoid", Ellipsoid, "3D Ellipsoid with axes in meter") DeclFunc("Ellipse", Ellipse, "2D Ellipse with axes in meter") DeclFunc("Cone", Cone, "3D Cone with...
engine/shape.go
0.74008
0.611802
shape.go
starcoder
package iso20022 // Parameters applied to the settlement of a security transfer. type Transfer1 struct { // Unique and unambiguous identifier for a transfer instruction, as assigned by the instructing party. TransferReference *Max35Text `xml:"TrfRef"` // Date and time at which the securities are to be delivered o...
Transfer1.go
0.800809
0.425009
Transfer1.go
starcoder
package taxi import ( "log" "strings" "github.com/foryoung10/NYTaxiAnalytics/database" "cloud.google.com/go/bigquery" "google.golang.org/api/iterator" ) const tablePlaceholder string = "@tables" // Repository handles data transfer between application and database. // GetTotalTripsByStartEndDate: Gets trips da...
taxi/repository.go
0.627951
0.400925
repository.go
starcoder
package pgsql import ( "database/sql" "database/sql/driver" "strconv" ) // Int2VectorFromIntSlice returns a driver.Valuer that produces a PostgreSQL int2vector from the given Go []int. func Int2VectorFromIntSlice(val []int) driver.Valuer { return int2VectorFromIntSlice{val: val} } // Int2VectorToIntSlice returns...
pgsql/int2vector.go
0.768733
0.680549
int2vector.go
starcoder
package functions import ( "fmt" "github.com/echocat/kubor/template" ) var FuncRender = Function{ Description: "Renders the <template> using <data> as regular Golang template.", Parameters: Parameters{{ Name: "data", Description: "The data that could be accessed while the rendering the content of the p...
template/functions/templating.go
0.64969
0.449211
templating.go
starcoder
package wiringutil import ( "strings" smith_v1 "github.com/atlassian/smith/pkg/apis/smith/v1" "github.com/atlassian/voyager" ) /* This file provides helper functions to construct Smith Resource Names and metadata names for Kubernetes objects. Mainly for use in autowiring functions. IN THE MAJORITY OF CASES, YOU D...
pkg/orchestration/wiring/wiringutil/name.go
0.624752
0.460835
name.go
starcoder
package operand import "github.com/mmcloughlin/avo/reg" // Pure type assertion checks: // IsRegister returns whether op has type reg.Register. func IsRegister(op Op) bool { _, ok := op.(reg.Register); return ok } // IsMem returns whether op has type Mem. func IsMem(op Op) bool { _, ok := op.(Mem); return ok } // I...
tools/vendor/github.com/mmcloughlin/avo/operand/checks.go
0.772917
0.573469
checks.go
starcoder
package d3 import ( "math" "strconv" "strings" "github.com/adamcolton/geom/calc/cmpr" "github.com/adamcolton/geom/geomerr" ) // Pt represets a three dimensional point. type Pt D3 // Mag returns the magnitude of the point relative to the origin func (pt Pt) Mag() float64 { return D3(pt).Mag() } // Mag2 returns...
d3/pt.go
0.856887
0.639624
pt.go
starcoder
package common import ( "github.com/kaxap/gozxing" ) type GridSampler interface { SampleGrid(image *gozxing.BitMatrix, dimensionX, dimensionY int, p1ToX, p1ToY, p2ToX, p2ToY, p3ToX, p3ToY, p4ToX, p4ToY float64, p1FromX, p1FromY, p2FromX, p2FromY, p3FromX, p3FromY, p4FromX, p4FromY float64) (*gozxing.BitMatrix, ...
common/grid_sampler.go
0.68637
0.526891
grid_sampler.go
starcoder
package iso20022 // Elements characterising a financial instrument. type FinancialInstrumentAttributes35 struct { // Market(s) on which the security is listed. PlaceOfListing *MarketIdentification3Choice `xml:"PlcOfListg,omitempty"` // Specifies the computation method of (accrued) interest of the security. DayCo...
data/train/go/fbb528935ce12d4f4cffccb64850bc18ed0223b4FinancialInstrumentAttributes35.go
0.863966
0.575528
fbb528935ce12d4f4cffccb64850bc18ed0223b4FinancialInstrumentAttributes35.go
starcoder
package simulation import ( "bytes" "fmt" tmkv "github.com/tendermint/tendermint/libs/kv" "github.com/cosmos/cosmos-sdk/codec" sdk "github.com/cosmos/cosmos-sdk/types" "github.com/terra-project/core/x/treasury/internal/types" ) // DecodeStore unmarshals the KVPair's Value to the corresponding distribution ty...
x/treasury/simulation/decoder.go
0.600305
0.416737
decoder.go
starcoder
package geom import ( "fmt" "sort" ) func convexHull(g Geometry) Geometry { if g.IsEmpty() { // Any empty geometry could be returned here to to give correct // behaviour. However, to replicate PostGIS behaviour, we always return // the original geometry. return g.Force2D() } pts := convexHullPointSet(g)...
geom/alg_convex_hull.go
0.788013
0.457197
alg_convex_hull.go
starcoder
package gocognit import ( "fmt" "go/ast" "go/token" "golang.org/x/tools/go/analysis" "golang.org/x/tools/go/analysis/passes/inspect" "golang.org/x/tools/go/ast/inspector" ) // Stat is statistic of the complexity. type Stat struct { PkgName string FuncName string Complexity int Pos token.Positio...
gocognit.go
0.741487
0.405979
gocognit.go
starcoder
package api import ( "encoding/json" ) // AnomalyType is the type of a task. type AnomalyType string const ( // AnomalyInstanceConnection is the anomaly type for instance connections. AnomalyInstanceConnection AnomalyType = "bb.anomaly.instance.connection" // AnomalyInstanceMigrationSchema is the anomaly type fo...
api/anomaly.go
0.690768
0.431285
anomaly.go
starcoder
package asterisk import "go/ast" // NodeSelections contain nodes that were selected during matching. // They are stored as Pointers on the existing ast.Node Pointers so they can be used to // manipulate the tree in memory. type NodeSelections map[string][]**ast.Node // BasicLit returns a pointer to the ast.Basic tha...
selection.go
0.832611
0.527986
selection.go
starcoder
package jet import ( "fmt" "reflect" "strconv" "strings" "time" ) type mapper struct { conv ColumnConverter } func (m *mapper) unpack(keys []string, values []interface{}, out interface{}) error { val := reflect.ValueOf(out) if val.Kind() != reflect.Ptr { return fmt.Errorf("cannot unpack result to non-point...
mapper.go
0.58522
0.423696
mapper.go
starcoder
package types import ( "sort" "github.com/attic-labs/noms/go/d" "github.com/attic-labs/noms/go/hash" ) const ( objectWindowSize = 8 orderedSequenceWindowSize = 1 objectPattern = uint32(1<<6 - 1) // Average size of 64 elements ) var emptyKey = orderedKey{} func newMetaTuple(ref Ref, key ...
go/types/meta_sequence.go
0.580471
0.452173
meta_sequence.go
starcoder
package panel import ( "image/color" "log" "github.com/tarm/serial" ) // Panel represents a single flipdot panel type Panel struct { Address []byte // nil implies broadcast, okay if just one panel Width int Height int State [][]bool Port *serial.Port } // NewPanel returns a new Panel with the given size...
panel/panel.go
0.629547
0.408631
panel.go
starcoder
package models import ( i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91 "github.com/microsoft/kiota-abstractions-go/serialization" ) // SimulationEventsContent type SimulationEventsContent struct { // Stores additional data not described in the OpenAPI description found when deserializing. ...
models/simulation_events_content.go
0.666714
0.535098
simulation_events_content.go
starcoder
package cache import ( "sync" "k8s.io/klog/v2" corev1 "k8s.io/api/core/v1" sharev1alpha1 "github.com/openshift/api/sharedresource/v1alpha1" ) /* Some old fashioned comments that describe what we are doing in this golang file. First, some notes on cardinality: - 1 share at the moment only references 1 configma...
pkg/cache/shares.go
0.559651
0.4231
shares.go
starcoder
package partialsum import ( "github.com/hillbig/rsdic" "github.com/ugorji/go/codec" ) // PartialSum stores non-negative integers V[0...N) // and supports Sum, Find in O(1) time // using at most (S + N) bits where S is the sum of V[0...N) type PartialSum interface { // Increment add V[ind] += val // ind should hol...
partialsum.go
0.662906
0.40751
partialsum.go
starcoder
package techan import "github.com/sdcoffey/big" type volumeIndicator struct { *TimeSeries } // NewVolumeIndicator returns an indicator which returns the volume of a candle for a given index func NewVolumeIndicator(series *TimeSeries) Indicator { return volumeIndicator{series} } func (vi volumeIndicator) Calculate...
indicator_basic.go
0.869465
0.560132
indicator_basic.go
starcoder
package iso20022 // Specifies rate details. type CorporateActionRate49 struct { // Quantity of additional intermediate securities/new equities awarded for a given quantity of securities derived from subscription. AdditionalQuantityForSubscribedResultantSecurities *RatioFormat3Choice `xml:"AddtlQtyForSbcbdRsltntScti...
CorporateActionRate49.go
0.886678
0.415373
CorporateActionRate49.go
starcoder
package main import ( "fmt" "math/rand" "sort" "time" ) func QuickSortRecursion(arr []int, begin, end int) { if begin >= end-1 { return } pivot := arr[begin] left, right := begin, end-1 for left < right { for left < right && arr[right] > pivot { right-- } arr[left] = arr[right] for left < righ...
Quick_Sort.go
0.506836
0.459925
Quick_Sort.go
starcoder
package timeseries import ( "math" "sort" "time" "github.com/grafana/grafana-plugin-sdk-go/data" ) func NewTimeSeriesData() *TimeSeriesData { return &TimeSeriesData{ TS: NewTimeSeries(), Meta: TimeSeriesMeta{}, } } func (tsd TimeSeriesData) Len() int { return len(tsd.TS) } func (tsd *TimeSeriesData) A...
pkg/timeseries/timeseries.go
0.828419
0.563738
timeseries.go
starcoder
dbscan works with abstract Rows interface and doesn't depend on any specific database or a library. If a type implements Rows it can leverage the full functionality of this package. Mapping struct field to database column The main feature of dbscan is the ability to scan rows data into structs. type User struct { ...
dbscan/doc.go
0.771413
0.591635
doc.go
starcoder
package ipv4 // Set is a structure that efficiently stores sets of IPv4 addresses and // supports testing if an address or prefix is contained (entirely) in it. // It supports the standard set operations: union, intersection, and difference. // It supports conversion to/and from Ranges and Prefixes // Sets are immutab...
ipv4/set.go
0.835852
0.543772
set.go
starcoder
--------------------------------------------------------------------------- Copyright (c) 2013-2015 AT&T Intellectual Property Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at: h...
gizmos/time_slice.go
0.737914
0.479138
time_slice.go
starcoder
package mem import ( "encoding/json" "errors" "fmt" "regexp" "strconv" ) type Table []Column type TableSet struct { // ColCount is the number of columns in Names and in each Table. ColCount int // Names are the names of the columns. Names []string // Tables is a slice of tables (usually just one). Tables...
lib/mem/table.go
0.595375
0.516595
table.go
starcoder
package goutils import "reflect" // Transform map a slice with fn func Transform(slice, fn interface{}) interface{} { return transform(slice, fn, false) } // TransformInPlace map a slice with fn in-place func TransformInPlace(slice, fn interface{}) interface{} { return transform(slice, fn, true) } func transform(...
function.go
0.745861
0.532486
function.go
starcoder
package gorocksdb // #include "rocksdb/c.h" import "C" // A SliceTransform can be used as a prefix extractor. type SliceTransform interface { // Transform a src in domain to a dst in the range. Transform(src []byte) []byte // Determine whether this is a valid src upon the function applies. InDomain(src []byte) b...
vendor/github.com/tecbot/gorocksdb/slice_transform.go
0.773388
0.40028
slice_transform.go
starcoder
package pipe import ( "encoding/json" "fmt" "goto/pkg/util" "regexp" "strings" "text/template" ) type TransformType string const ( TransformJSONPath TransformType = "JSONPath" TransformJQ TransformType = "JQ" TransformTemplate TransformType = "Template" TransformRegex TransformType = "Re...
pkg/pipe/transform.go
0.608245
0.437463
transform.go
starcoder
package similarities import ( "github.com/jtejido/golucene/core/index" "github.com/jtejido/golucene/core/util" "math" "sync" ) var _ Similarity = (*DefaultSimilarity)(nil) var norm_table []float32 var once sync.Once /** * Expert: Default scoring implementation which {@link #encodeNormValue(float) * encodes} n...
core/search/similarities/default.go
0.840717
0.435841
default.go
starcoder
package scomplex import ( "image" "math" ) import ( . "github.com/Causticity/sipp/simage" ) // A ComplexInt32Image is an image where each pixel is a ComplexInt32. type ComplexInt32Image struct { // The "pixel" data. Pix []ComplexInt32 // The rectangle defining the bounds of the image. Rect image.Rectangle /...
scomplex/complex_int32_image.go
0.723602
0.451447
complex_int32_image.go
starcoder
package math import ( "time" ) // Compare compares 2 values and follows a few simple rules to compare integers and floats. // Supports types uint8, int32, int64, int, float64, and time.Time. // Returns an error if not comparable. // Return value of -1 indicates a is less than b. // Return value of 1 indicates a is ...
pkg/math/Compare.go
0.668988
0.542682
Compare.go
starcoder
package cronexpr /******************************************************************************/ import ( "sort" "time" ) /******************************************************************************/ func lastOf(slice []int) int { return slice[len(slice)-1]; } func lastDayOfMonth(year int, month time.Month...
cronexpr_prev.go
0.579638
0.547222
cronexpr_prev.go
starcoder
package update import "go.mongodb.org/mongo-driver/bson" // Update fields type Update *bson.M // CurrentDateType for the CurrentDate update operator type CurrentDateType string const ( // Date as type for update operator Date CurrentDateType = "date" // Timestamp as type for update operator Timestamp CurrentDat...
update/update.go
0.66769
0.400896
update.go
starcoder
package tree type node struct { key int value string left, right *node n int } func FirstCommonAncestor(root, p, q *node) *node { if !isChild(p, root) || isChild(q, root) { //p or q is child of root return nil } return firstCommonAncestor(root, p, q) } func isChild(n, root *node) boo...
tree/binary.go
0.647798
0.438004
binary.go
starcoder
package path import ( "fmt" "github.com/Tnze/go-mc/bot/world" "github.com/Tnze/go-mc/data/block" ) // Cardinal directions. type Direction uint8 func (d Direction) Offset() (x, y, z int) { switch d { case North: return 0, 0, -1 case South: return 0, 0, 1 case East: return 1, 0, 0 case West: return -1...
bot/path/movement.go
0.516839
0.52007
movement.go
starcoder
package table // DefaultCharset return array of character A-Z, a-z, 0-9, and symbol. func DefaultCharset() []string { return []string{ "A", "B", "C", "D", "E", "F", "G", "H", "I", "J", "K", "L", "M", "N", "O", "P", "Q", "R", "S", "T", "U", "V", "W", "X", "Y", "Z", "a", "b", "c", "d", "e", "f", "g", "h", "i", "j",...
table/charset.go
0.650023
0.465509
charset.go
starcoder
package transforms import ( "math" "github.com/go-audio/audio" ) // FullWaveRectifier to make all signal positive // See https://en.wikipedia.org/wiki/Rectifier#Full-wave_rectification func FullWaveRectifier(buf *audio.FloatBuffer) error { if buf == nil { return audio.ErrInvalidBuffer } for i := 0; i < len(bu...
transforms.go
0.682468
0.408926
transforms.go
starcoder
package tests import ( "testing" "github.com/polydawn/refmt/tok" . "github.com/warpfork/go-wish" ipld "github.com/ipld/go-ipld-prime" "github.com/ipld/go-ipld-prime/encoding" "github.com/ipld/go-ipld-prime/fluent" ) // TokenSourceBucket acts like a TokenSource by yielding tokens from a pre-made // slice; and ...
tests/unmarshalling.go
0.555918
0.461077
unmarshalling.go
starcoder
package sstable import ( "fmt" "encoding/binary" "io/ioutil" ) type IndexEntry struct { KeyLength uint16 Key []byte Position uint64 PromotedIndexLength uint32 PromotedIndex []byte } type PromotedIndex struct { PartitionHeaderLength uint64 DeletionTime DeletionTime Pr...
index.go
0.501465
0.431464
index.go
starcoder
package scanner // stateNeg is the state after reading `-` during a number. func stateNeg(s *scanner, c byte) int { if c == '0' { s.step = state0 return scanContinue } if '1' <= c && c <= '9' { s.step = state1 return scanContinue } return s.error(c, "in numeric literal") } // state1 is the state after re...
scanner/state_number.go
0.793026
0.540014
state_number.go
starcoder
package day16 import ( "fmt" "strconv" "strings" "github.com/OctaviPascual/AdventOfCode2019/util" ) // Day holds the data needed to solve part one and part two type Day struct { signal signal } type digit int type signal struct { digits []digit } type pattern struct { digits []digit current int } // New...
day16/day16.go
0.730194
0.517449
day16.go
starcoder
package main import ( "log" "github.com/unixpickle/model3d/model3d" "github.com/unixpickle/model3d/render3d" ) const ( Thickness = 0.2 Width = 5.0 Height = 1.0 MarkSize = 0.03 MarkSmallestHeight = 0.05 MarkGap = 1.0 / 16.0 // Epsilon to prevent zero-a...
examples/usable/ruler/main.go
0.619817
0.497131
main.go
starcoder
package permute // Ints returns 0..n slice as permutations of slices of int. // For example n=2 becomes [0, 1] [1, 0]. func Ints(n int, fn func([]int)) { a := make([]int, n) for i := range a { a[i] = i } permutations(a, 0, fn) } // Bools returns 0..n slice as permutations of slices of bool. // For example n=2 b...
permute.go
0.778186
0.531574
permute.go
starcoder
package header /** * The Retry-After header field identifies the time to retry the request after * recipt of the response. It can be used with a 500 (Server Internal Error) or 503 * (Service Unavailable) response to indicate how long the service is * expected to be unavailable to the requesting client and with a...
sip/header/RetryAfterHeader.go
0.924172
0.681001
RetryAfterHeader.go
starcoder