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 stripe import "encoding/json" // SKUInventoryType describe's the possible value for inventory type type SKUInventoryType string // List of values that SKUInventoryType can take. const ( SKUInventoryTypeBucket SKUInventoryType = "bucket" SKUInventoryTypeFinite SKUInventoryType = "finite" SKUInventoryTy...
sku.go
0.72952
0.435902
sku.go
starcoder
// Package cs50 implements helper functions for reading from standard input. It allows for // reading Chars, Strings, Ints, Floats and Longs. Each of the input functions allows // users to supply a prompt string which will be presented to the user via standard output before // reading their input. If input is invalid ...
go50.go
0.669745
0.521959
go50.go
starcoder
package random_point import ( "math" "math/rand" "time" ) /* * @lc app=leetcode id=478 lang=golang * * [478] Generate Random Point in a Circle * * https://leetcode.com/problems/generate-random-point-in-a-circle/description/ * * algorithms * Medium (37.89%) * Total Accepted: 7.7K * Total Submissions: 2...
478-generate-random-point-in-a-circle/478.generate-random-point-in-a-circle.go
0.883626
0.470311
478.generate-random-point-in-a-circle.go
starcoder
package model type typeTransform int var ( makeIdentity = typeTransform(0) makePromise = typeTransform(1) makeOutput = typeTransform(2) ) func (f typeTransform) do(t Type) Type { switch f { case makePromise: return NewPromiseType(t) case makeOutput: return NewOutputType(t) default: return t } } fu...
pkg/codegen/hcl2/model/type_eventuals.go
0.535341
0.520131
type_eventuals.go
starcoder
package logstash const logstash5ProcessJSON = ` { "host" : "node-5", "version" : "5.3.0", "http_address" : "0.0.0.0:9600", "id" : "a360d8cf-6289-429d-8419-6145e324b574", "name" : "node-5-test", "process" : { "open_file_descriptors" : 89, "peak_open_file_descriptors" : 100, "max_file_descriptors...
plugins/inputs/logstash/samples_logstash5.go
0.510008
0.415788
samples_logstash5.go
starcoder
package datasize import . "github.com/deinspanjer/units/unit" // Datasize represents a unit of data size (in bits, bit) type Datasize Unit // ... const ( // base 10 (SI prefixes) Bit Datasize = 1e0 Kilobit = Bit * 1e3 Megabit = Bit * 1e6 Gigabit = Bit * 1e9 Terabit ...
datasize/datasize.go
0.73782
0.447702
datasize.go
starcoder
package agg import ( "fmt" "github.com/kentik/libkflow/flow" ) /** Stolen and hacked up from https://github.com/eapache/queue/blob/master/queue.go */ const minQueueLen = 1028 // Queue represents a single instance of the queue data structure. type Queue struct { buf []flow.Flow head,...
src/github.com/kentik/libkflow/agg/queue.go
0.82566
0.405979
queue.go
starcoder
package indicators import ( "github.com/jaybutera/gotrade" ) // A Linear Regression Intercept Indicator (LinRegInt) type LinRegSlp struct { *LinRegWithoutStorage selectData gotrade.DOHLCVDataSelectionFunc // public variables Data []float64 } // NewLinRegSlp creates a Linear Regression Slope Indicator (LinRegSl...
indicators/linregslp.go
0.680454
0.637623
linregslp.go
starcoder
package expr import "fmt" // Dup creates a copy the given data type. func Dup(d DataType) DataType { return newDupper().DupType(d) } // DupAtt creates a copy of the given attribute. func DupAtt(att *AttributeExpr) *AttributeExpr { return newDupper().DupAttribute(att) } // dupper implements recursive and cycle saf...
expr/dup.go
0.743447
0.53279
dup.go
starcoder
package eval import ( "fmt" "math" "strings" ) // An Env represents an environment for an Expr type Env map[Var]float64 // A Var indentifies a variable, e.g. x. type Var string // A literal is a numeric constant, e.g. 3.1415. type literal float64 // A unary represents an unary operator expression, e.g. -x. type...
ch7/eval/eval.go
0.752922
0.420005
eval.go
starcoder
package tensorf32 import ( "fmt" "github.com/chewxy/math32" ) // This file is for the safe versions of any arithmetic functions listed in arith.go and (arith_asm.go or arith_go.go) // A safe version is a version with return values, and does not mutate the underlying data func safeVecAdd(a, b []float32, optional ....
tensor/f32/arith_safe.go
0.644896
0.500793
arith_safe.go
starcoder
package palgen import ( "image" "image/color" ) // Render a given palette as an image, with blocks of 16x16 pixels and 32 colors per row of blocks. func Render(pal color.Palette) image.Image { return RenderWithConfig(pal, 16, 32) } // RenderWithConfig can render a given palette as an image that shows each color a...
render.go
0.640411
0.457076
render.go
starcoder
package settings import ( "context" "encoding/json" "testing" "github.com/bxcodec/faker/v3" "github.com/gofrs/uuid" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" "github.com/ory/viper" "github.com/zzpu/ums/driver/configuration" "github.com/zzpu/ums/identity" "github.com/zzpu/...
selfservice/flow/settings/persistence.go
0.534612
0.555556
persistence.go
starcoder
package jsonpath import ( "context" "github.com/PaesslerAG/gval" ) type PathValue struct { Path []string Value interface{} } // values allows us to represent a single value or multiple values under a // common interface. type values interface { // get retrieves the value(s) as an interface. get() interface{}...
jsonutil/pkg/jsonpath/path.go
0.6705
0.465813
path.go
starcoder
package money import ( "errors" pb "github.com/petscheit/microservices-demo/src/checkoutservice/genproto" ) const ( nanosMin = -999999999 nanosMax = +999999999 nanosMod = 1000000000 ) var ( ErrInvalidValue = errors.New("one of the specified money values is invalid") ErrMismatchingCurrency = errors.New...
src/checkoutservice/money/money.go
0.781456
0.514522
money.go
starcoder
package structs // Consul represents optional per-group consul configuration. type Consul struct { // Namespace in which to operate in Consul. Namespace string } // Copy the Consul block. func (c *Consul) Copy() *Consul { if c == nil { return nil } return &Consul{ Namespace: c.Namespace, } } // Equals retu...
vendor/github.com/hashicorp/nomad/nomad/structs/consul.go
0.770206
0.465873
consul.go
starcoder
package unum import ( "math" ) // Represents a 4x4 column-major matrix. type Mat4 [16]float64 var ( // The 4x4 identity matrix. Mat4Identity Mat4 m4z Mat4 ) func init() { Mat4Identity[0], Mat4Identity[4], Mat4Identity[8], Mat4Identity[12] = 1, 0, 0, 0 Mat4Identity[1], Mat4Identity[5], Mat4I...
util/num/mat4.go
0.600774
0.489992
mat4.go
starcoder
package goch import "time" // ToBool casts an interface to a bool type. func ToBool(i any) bool { v, _ := ToBoolE(i) return v } // ToTime casts an interface to a time.Time type. func ToTime(i any) time.Time { v, _ := ToTimeE(i) return v } func ToTimeInDefaultLocation(i any, location *time.Location) ...
pkg/lakego-pkg/go-goch/goch/goch.go
0.83193
0.412708
goch.go
starcoder
package iso20022 // Set of data specified for the fixing of a non deliverable trade. type ClosingData2 struct { // Date at which the trading parties have agreed on a valuation rate for a non deliverable trade. TradeDate *ISODate `xml:"TradDt"` // Refers to the identification of a trade assigned by the trading sid...
ClosingData2.go
0.826292
0.561996
ClosingData2.go
starcoder
package transform import ( "errors" "fmt" kanzi "github.com/flanglet/kanzi-go" ) // ZRLT Zero Run Length Transform // Zero Length Encoding is a simple encoding algorithm by Wheeler // closely related to Run Length Encoding. The main difference is // that only runs of 0 values are processed. Also, the length is //...
transform/ZRLT.go
0.721547
0.54353
ZRLT.go
starcoder
package graph import "math" type Graph []Layer func (g Graph) Apply(c Config) { for i := range g { if layer, ok := g[i].(*Minimizer); ok { layer.learningRate = c.LearningRate layer.optimizer = c.Optimizer layer.regularizer = c.Regularizer layer.batch = make([][][]float64, c.BatchSize) for j := rang...
pkg/graph/graph.go
0.685213
0.424591
graph.go
starcoder
package modeldecodertest import ( "fmt" "net" "net/http" "reflect" "strings" "testing" "time" "github.com/stretchr/testify/assert" "github.com/elastic/beats/v7/libbeat/common" "github.com/elastic/apm-server/model" "github.com/elastic/apm-server/model/modeldecoder/nullable" ) // Values used for populati...
model/modeldecoder/modeldecodertest/populator.go
0.643329
0.452052
populator.go
starcoder
package api import ( "context" "fmt" "time" "github.com/massyu/iota.go/bundle" . "github.com/massyu/iota.go/consts" . "github.com/massyu/iota.go/trinary" ) // FindTransactionsQuery represents the payload to the FindTransactions API call. // Using multiple fields will return the intersection of the found result...
api/types.go
0.812198
0.412471
types.go
starcoder
package mining import ( blockchain "github.com/p9c/pod/pkg/chain" "github.com/p9c/pod/pkg/chain/wire" "github.com/p9c/pod/pkg/util" ) const ( // UnminedHeight is the height used for the "block" height field of the contextual transaction information provided in a transaction store when it has not yet been mined in...
pkg/chain/mining/policy.go
0.690455
0.589716
policy.go
starcoder
package plot import ( "image" "image/color" "image/draw" "github.com/goki/freetype/truetype" "golang.org/x/image/font/gofont/goregular" "golang.org/x/image/font" "golang.org/x/image/font/inconsolata" "golang.org/x/image/math/fixed" ) func minmax(x, y int) (int, int) { if x < y { return x, y } return y...
plot/drawimg.go
0.697197
0.41561
drawimg.go
starcoder
package monitoringcommon //GetMonitoringGrafanaDBCriticalSLORHMIAlertsJSON configured with given namespace prefix func GetMonitoringGrafanaDBCriticalSLORHMIAlertsJSON(nsPrefix string, product string) string { return `{ "annotations": { "list": [{ "builtIn": 1, "datasource": "-- Grafana --", "enable": true...
pkg/products/monitoringcommon/dashboards/criticalSLOAlerts.go
0.547222
0.463687
criticalSLOAlerts.go
starcoder
package messages import ( util "github.com/IBM/ibmcloud-storage-volume-lib/lib/utils" ) var messages_en = map[string]util.Message{ "E0001": { Code: "E0001", Description: "Unable to locate datacenter with name '%s'", Type: "DataCenterNotFound", RC: 404, Action: "Contact the acc...
volume-providers/softlayer/messages/messages_en.go
0.558086
0.456168
messages_en.go
starcoder
package errorx import ( "encoding" ) // Type is a distinct error type. // Belongs to a namespace, may be a descendant of another type in the same namespace. // May contain or inherit modifiers that alter the default properties for any error of this type. // May contain or inherit traits that all errors of this type ...
vendor/github.com/joomcode/errorx/type.go
0.737725
0.442516
type.go
starcoder
package trees import ( "errors" "fmt" "math" "sort" "strconv" "strings" "github.com/SummerCedrus/golearn/base" ) const ( GINI string = "gini" ENTROPY string = "entropy" ) // CNode is Node struct for Decision Tree Classifier. // It holds the information for each split (which feature to use, what threshol...
trees/cart_classifier.go
0.786582
0.500366
cart_classifier.go
starcoder
package texture // Combiner2 takes two source fields and combines them with the specified combiner function. The result is // passed through an optional filter function. type Combiner2 struct { Src1, Src2 Field CFunc func(float64, float64) float64 FFunc func(float64) float64 } // Eval2 implements the Fie...
combine.go
0.91843
0.708175
combine.go
starcoder
package biscuit import ( "errors" "fmt" "reflect" "github.com/biscuit-auth/biscuit-go/datalog" "github.com/biscuit-auth/biscuit-go/pb" ) func tokenFactToProtoFactV2(input datalog.Fact) (*pb.FactV2, error) { pred, err := tokenPredicateToProtoPredicateV2(input.Predicate) if err != nil { return nil, err } r...
converters_v2.go
0.604165
0.442877
converters_v2.go
starcoder
package tiff import ( "bytes" "encoding/binary" "fmt" "math" "math/big" "reflect" ) /* FieldTypeRepr */ // These functions provide string representations of values based on field types. func reprByte(in []byte, bo binary.ByteOrder) string { return fmt.Sprintf("%d", in[0]) } func reprSByte(in []byte, bo binar...
fieldtype_default.go
0.707203
0.45532
fieldtype_default.go
starcoder
package github /* API endpoints curl https://api.github.com { "current_user_url": "https://api.github.com/user", "current_user_authorizations_html_url": "https://github.com/settings/connections/applications{/client_id}", "authorizations_url": "https://api.github.com/authorizations", "code_search_url": "https...
ex_04.11-github_client/github/conf_doc.go
0.522446
0.465084
conf_doc.go
starcoder
package image import ( "fmt" "image" "image/color" "github.com/google/tiff" ) /* Baseline Palette-Color Differences from Grayscale Images Tag 262 (PhotometricInterpretation) PhotometricInterpretation = 3 (Palette Color) Tag 320 (ColorMap) Note: 3 * (2**BitsPerSample) Note: This field defines a Red-Gre...
image/baseline_palettecolor.go
0.702734
0.431944
baseline_palettecolor.go
starcoder
package pipescript import ( "encoding/json" "strconv" ) // Int takes an interface that was unmarshalled with the json package, // and returns it as an int, or returns false func Int(v interface{}) (int64, bool) { switch n := v.(type) { case float64: res := int64(n) return res, float64(res) == n case int64: ...
conversions.go
0.714628
0.418162
conversions.go
starcoder
package optional import "errors" // Optional manages an optional contained value, i.e. a value that may or may not be present. type Optional[T any] struct { value T present bool } // Of create an Optional func Of[T any](value T, present bool) Optional[T] { return Optional[T]{ value: value, present: presen...
container/optional/optional.go
0.881322
0.480174
optional.go
starcoder
package main import ( "context" "google.golang.org/protobuf/proto" "io" "log" "math" "net" "time" "google.golang.org/grpc" pb "minggrpctest/route" ) // 这里实现的routeGuideServer是pb.RouteGuideServer接口的一种实现 type routeGuideServer struct { features []*pb.Feature // 之所以内嵌一个UnimplementedXXX是因为protoc在解析.proto文件,创建grp...
aLearnFromBli/9grpc/route-server/server.go
0.558086
0.414899
server.go
starcoder
package deque import ( "errors" ) // Operation is the generic input accepted by the left-right data structure. Defined as an alias for readability. type Operation interface{} // Deque is a generic double ended queue implemented with a ring buffer. type Deque struct { // data is the underlying data storage. Starts ...
pkg/deque/deque.go
0.694821
0.618089
deque.go
starcoder
package views import ( "fmt" "goom/glutils" "goom/level" "goom/lumps" "goom/wad" "math" "log" "github.com/go-gl/gl/v4.1-core/gl" "github.com/go-gl/glfw/v3.0/glfw" ) // SectorView holds the information necessary to render all sectors. // It is possible to change the current highlighted sector using the up ...
views/sector_view.go
0.541409
0.44897
sector_view.go
starcoder
package basex import ( "fmt" "strings" ) // Alphabet holds an arbitrary base alphabet. type Alphabet struct { raw string dec map[string]byte enc []string } func (a *Alphabet) String() string { return a.raw } // Base returns the base size of this alphabet. func (a *Alphabet) Base() uint { return uint(len(a.en...
basex.go
0.793026
0.40028
basex.go
starcoder
package trie import ( "fmt" "github.com/pkg/errors" ) // Node type Node interface { SetParent(parent Node) Parent() Node AddChildWithIndexOf(index int, child Node) error ChildWithIndexOf(index int) (Node, error) RemoveChildWithIndexOf(index int) bool HasChildren() bool SetValue(el...
trie/node.go
0.739046
0.460774
node.go
starcoder
package internal import ( "github.com/go-board/std/delegate" "github.com/go-board/std/iterator" "github.com/go-board/std/optional" ) type filterIter[T any] struct { iter iterator.Iterator[T] filter delegate.Predicate[T] } func (self *filterIter[T]) Next() optional.Optional[T] { for s := self.iter.Next(); s.I...
iterator/internal/filter.go
0.756358
0.437042
filter.go
starcoder
package game import ( "fmt" "github.com/DrJosh9000/awakengine" ) var ( bookEmpty = &book{ title: ``, author: ``, contents: []*awakengine.DialogueLine{ {Avatar: avatarBook, Text: ``}, {Avatar: avatarAwakeman, Text: ``}, }, } // --------- REAL BOOKS --------- book1984 = &book{ title: `Ninetee...
e40/game/books.go
0.597138
0.502319
books.go
starcoder
package session import ( "context" "testing" "github.com/bxcodec/faker" "github.com/gofrs/uuid" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" "github.com/ory/viper" "github.com/ory/kratos/driver/configuration" "github.com/ory/kratos/identity" "github.com/ory/kratos/x" ) type ...
session/persistence.go
0.623835
0.54958
persistence.go
starcoder
package core import ( "bytes" "github.com/manishmeganathan/weave/utils" "github.com/manishmeganathan/weave/wallet" ) // A structure that represents the inputs in a transaction // which are really just references to previous outputs type TXI struct { // Represents the transaction ID of which the reference output ...
core/txio.go
0.79534
0.44903
txio.go
starcoder
package year2019day15 import ( "fmt" "strings" "github.com/alokmenghrajani/adventofcode2021/utils" "github.com/alokmenghrajani/adventofcode2021/utils/grids" ) type intCode struct { mem map[int]int ip int input chan int output chan int relativeBase int } type cell struct { v...
2019/year2019day15/day15.go
0.50415
0.438064
day15.go
starcoder
// Sample program to show how to use a read/write mutex to define critical // sections of code that needs synchronous access. package main import ( "fmt" "math/rand" "sync" "sync/atomic" "time" ) // data is a slice that will be shared. var data []string // rwMutex is used to define a critical section of code. ...
content/docs/concurrency/data_race/example4/example4.go
0.580352
0.643917
example4.go
starcoder
package vectormath import ( "fmt" "github.com/dgryski/go-onlinestats" "math" ) type Distance int const ( Euclidean Distance = 0 Cosine Distance = 1 Manhattan Distance = 2 Pearson Distance = 3 ) // TODO(Juan): Change the x and y variables to a and b func EuclideanDistance(x []float64, y []float64) (floa...
vectormath/distances.go
0.572723
0.498352
distances.go
starcoder
package matchers import ( "fmt" "reflect" "github.com/bsm/gomega/format" "github.com/bsm/gomega/matchers/support/goraph/bipartitegraph" ) type ConsistOfMatcher struct { Elements []interface{} missingElements []interface{} extraElements []interface{} } func (matcher *ConsistOfMatcher) Match(actual i...
matchers/consist_of.go
0.619011
0.441131
consist_of.go
starcoder
package salem import ( "fmt" "reflect" ) type processorType func(generator GenType, fieldType reflect.Type, itemIndex int, qualifiedName string) reflect.Value func (p *Plan) initKindProcessors() { p.kindProcessors = make(map[reflect.Kind]processorType) p.kindProcessors[reflect.Map] = onMap(p) p.kindProcessors...
kind_processors.go
0.597138
0.46132
kind_processors.go
starcoder
from ..node.node import Node func mergeLists(aList, bList) { """ Merge two lists into one with alternating nodes from each. """ node = a = aList.head if not a { return bList.head b = bList.head while a and b { a.Next, b = b, a.Next a = a.Next return node class L...
linked_list/linked_list.go
0.857127
0.469216
linked_list.go
starcoder
package loader import ( "context" "regexp" "github.com/xo/xo/models" xo "github.com/xo/xo/types" ) func init() { Register(&Loader{ Driver: "sqlserver", Mask: "@p%d", GoType: SqlserverGoType, Schema: models.SqlserverSchema, Procs: models.SqlserverPro...
loader/sqlserver.go
0.532182
0.482063
sqlserver.go
starcoder
package texture import ( "github.com/faiface/mainthread" "runtime" "github.com/go-gl/gl/v3.3-core/gl" "log" ) type rectangle struct { x, y, width, height int } func (rect rectangle) area() int { return rect.width * rect.height } type TextureAtlas struct { store *textureStore defRegion TextureRegion ...
render/texture/atlas.go
0.769427
0.42668
atlas.go
starcoder
package bwt import ( "bytes" "sort" ) // rotateSort is a sort.Interface that sorts the rotations of // the given data lexicographically. type rotateSort struct { data []byte rotates []int scrap []byte } // newRotateSort creates a rotateSort generating the rotations. func newRotateSort(data []byte) *rotateS...
internal/bwt/transform.go
0.737725
0.444143
transform.go
starcoder
package block import ( "fmt" "time" "github.com/m3db/m3/src/query/models" ) // Scalar is a block containing a single value over a certain bound // This represents constant values; it greatly simplifies downstream operations by // allowing them to treat this as a regular block, while at the same time // having an...
src/query/block/scalar.go
0.876502
0.412826
scalar.go
starcoder
package sobol import ( "math" "sort" "github.com/c-bata/goptuna" ) var _ goptuna.RelativeSampler = &Sampler{} // Sampler for quasi-Monte Carlo Sampling based on Sobol sequence. // It is recommended to use "SamplerOptionSkipInitialPoints(n)" for better performance. // Furthermore, if you use this sampler from mul...
sobol/sampler.go
0.68679
0.429609
sampler.go
starcoder
package _d /** * Rect 矩形 */ type Rectangle struct { P [4]*Point } func (r *Rectangle) Top() *Point { p := r.P[0] for _, v := range r.P { if v.Y >= p.Y { p = v } } return p } func (r *Rectangle) Bottom() *Point { p := r.P[0] for _, v := range r.P { if v.Y <= p.Y { p = v } } return p } func (r ...
2d/rect.go
0.57093
0.455683
rect.go
starcoder
package aifiver // Factor represents one of the five factors in the five factor model. type Factor int // The five factors. const ( FactorOpenness Factor = iota FactorConscientiousness FactorExtraversion FactorAgreeableness FactorNeuroticism ) // Facet represents specific facets within the five fa...
aifiver/aifiver.go
0.543348
0.447038
aifiver.go
starcoder
package jenutils import ( "go/types" "strings" "github.com/dave/jennifer/jen" ) // nolint: gochecknoglobals var basicKindMap = map[types.BasicKind]func(statement *jen.Statement) *jen.Statement{ types.Bool: (*jen.Statement).Bool, types.Int: (*jen.Statement).Int, types.Int8: (*jen.Statement).I...
pkg/jenutils/type.go
0.516595
0.435061
type.go
starcoder
package geo import ( "math" "os" "encoding/json" ) // Contour represents a sequence of vertices connected by line segments, forming a closed shape. type Contour struct { Points []*Point } // Can't unpack JSON into normal Point{} as the fields are unexported. Need to unpack here first type TestPoint struct { La...
contour.go
0.826011
0.434101
contour.go
starcoder
package component import ( "github.com/gotracker/gomixing/sampling" "github.com/gotracker/gomixing/volume" "github.com/gotracker/voice/loop" "github.com/gotracker/voice/pcm" ) // Sampler is a sampler component type Sampler struct { sample pcm.Sample pos sampling.Pos keyOn bool loopsEnab...
component/sampler.go
0.60871
0.458894
sampler.go
starcoder
package bioutils import ( "fmt" ) /* The canonical representation of a sequence is the lexicographically smaller of its positive-strand and its reverse complement. */ func CanonicalRepr32(seq uint32) uint32 { revComp := RevComp32(seq) if revComp < seq { return revComp } else { return seq } } /* The...
bioutils/subseq.go
0.690559
0.442335
subseq.go
starcoder
// Define custom patterns (implementing the siegfried.Pattern interface) for the different patterns allowed by the PRONOM spec. package pronom import ( "bytes" "fmt" "github.com/richardlehane/siegfried/pkg/core/bytematcher/patterns" "github.com/richardlehane/siegfried/pkg/core/signature" ) func init() { patter...
pkg/pronom/patterns.go
0.638948
0.478894
patterns.go
starcoder
package internal import ( "reflect" ) // IsArray checks the given parameter is an array func IsArray(a interface{}) bool { if a == nil { return false } val := reflect.ValueOf(a) return checkKind(val.Kind(), reflect.Array) } // IsSlice checks the given parameter is a slice func IsSlice(a interface{}) bool { i...
internal/is.go
0.739328
0.602763
is.go
starcoder
package dst // Exponential distribution (a.k.a. negative exponential distribution). // Parameters: // λ > 0: rate, or inverse scale // Support: x ∈ [0; ∞). import ( "math/rand" ) // ExponentialPDF returns the PDF of the Exponential distribution. func ExponentialPDF(λ float64) func(x float64) float64 { return f...
dst/exp.go
0.913491
0.649217
exp.go
starcoder
package treeutil import ( "strconv" "sync" "github.com/jeyabalajis/goalgos/stringutil" "github.com/jeyabalajis/goalgos/tree" ) var wg sync.WaitGroup // Walk walks the tree t sending all values from the tree to the channel ch. func walk(t *tree.Tree, ch *chan uint32, depth int, nodeQualifier string) { if t == n...
treeutil/treeutil.go
0.678114
0.485478
treeutil.go
starcoder
package neo4go import ( "time" "github.com/neo4j/neo4j-go-driver/neo4j" ) // InputStruct represents a struct as an acceptable input for the manager queries. // It is also the most basic level of query input type InputStruct interface { // ConvertToMap converts this input as a map of query inputs ConvertToMap() m...
pkg/v1/neo4go/query-inputs.go
0.839931
0.62266
query-inputs.go
starcoder
package main import ( "fmt" "math" "math/rand" "gonum.org/v1/gonum/mat" ) var alpha = 0.5 var hidden_size = 4 // hidden layer with 4 nodes var input_size = 3 // number of input values at layer 0 var num_inputs = 4 var streetlights = mat.NewDense(num_inputs, input_size, []float64{1, 0, 1, 0, 1, 1, 0, 0, 1, 1, 1...
7-BackPropagation/main.go
0.600188
0.476884
main.go
starcoder
package godrone import ( "fmt" "math" ) type Calibration struct { AccZeros PRY AccScale PRY GyroZeros PRY GyroScale PRY SonarScale float64 SonarZero float64 } func (c Calibration) Convert(data Navdata) Sensors { return Sensors{ Acc: PRY{ Pitch: (float64(data.AccPitch) - c.AccZeros.Pitch) / c.Acc...
calibrate.go
0.629433
0.568895
calibrate.go
starcoder
package day8 import ( "ryepup/advent2021/utils" ) /* You barely reach the safety of the cave when the whale smashes into the cave mouth, collapsing it. Sensors indicate another exit to this cave at a much greater depth, so you have no choice but to press on. As your submarine slowly makes its way through the cave s...
day8/part1.go
0.613931
0.472318
part1.go
starcoder
package pulumi import ( "reflect" "github.com/spf13/cast" "github.com/pulumi/pulumi/sdk/go/pulumi/asset" ) // Output helps encode the relationship between resources in a Pulumi application. Specifically an output property // holds onto a value and the resource it came from. An output value can then be provide...
sdk/go/pulumi/properties.go
0.727589
0.496277
properties.go
starcoder
package static import ( sdem "ForumPublica/sde/models" "math" "sort" ) // TypeIDQuantityName holds TypeID and Qty and Name type TypeIDQuantityName struct { TypeID int32 Quantity int64 Name string } //TypeIDQuantityNameList array of TypeIDQuantityName type TypeIDQuantityNameList []TypeIDQuantityName func...
sde/static/utils.go
0.559771
0.423696
utils.go
starcoder
package haystack import ( "encoding/json" "errors" "fmt" "math" "strconv" "strings" ) // Coord models a geographic coordinate as latitude and longitude type Coord struct { lat float64 lng float64 } // NewCoord creates a new Coord object. lat/lng are clipped to reasonable values. func NewCoord(lat float64, ln...
Coord.go
0.810104
0.412767
Coord.go
starcoder
package game import ( "image/color" "time" "github.com/oakmound/oak/render" ) func DemoBody() *Body { b := new(Body) b.level = -1 b.startTime = time.Now() b.overlay = render.NewColorBox(64, 64, color.RGBA{0, 255, 100, 255}) b.veinColor = color.RGBA{255, 0, 0, 255} b.veinColor2 = color.RGBA{0, 0, 255, 255} ...
game/bodies.go
0.53777
0.498596
bodies.go
starcoder
package primitives import ( "fmt" "github.com/phoreproject/synapse/chainhash" "github.com/phoreproject/synapse/pb" ) // CombineHashes combines two branches of the tree. func CombineHashes(left *chainhash.Hash, right *chainhash.Hash) chainhash.Hash { return chainhash.HashH(append(left[:], right[:]...)) } // Empt...
primitives/transactions.go
0.753285
0.401746
transactions.go
starcoder
package aggregator import ( "fmt" "sync" ) type Type byte const ( TypeAvg Type = iota TypeMin Type = iota TypeMax Type = iota ) func (at Type) String() string { switch at { case TypeAvg: return "AVG" case TypeMin: return "MIN" case TypeMax: return "MAX" default: return "UNKNOWN" } } type Aggrega...
pkg/client/aggregator/aggregator.go
0.630116
0.416381
aggregator.go
starcoder
package main import ( "flag" "fmt" "github.com/vertgenlab/gonomics/common" "github.com/vertgenlab/gonomics/exception" "github.com/vertgenlab/gonomics/popgen" "log" ) func selectionMCMC(filename string, outFile string, s popgen.McmcSettings) { common.RngSeed(s.RandSeed, s.SetSeed) data, err := popgen.VcfToAfs...
cmd/selectionMCMC/selectionMCMC.go
0.567577
0.473353
selectionMCMC.go
starcoder
// Package h231 contains the data structures for HL7 v2.3.1. package h231 // Registry implements the required interface for unmarshalling data. var Registry = registry{} type registry struct{} func (registry) Version() string { return Version } func (registry) ControlSegment() map[string]any { return ControlSegme...
h231/registry.go
0.585338
0.402627
registry.go
starcoder
package f5api // This describes a message sent to or received from some operations type LtmMonitorSip struct { // The application service to which the object belongs. AppService string `json:"appService,omitempty"` // Specifies the IP address and service port of the resource that is the destination of this monito...
ltm_monitor_sip.go
0.844441
0.470372
ltm_monitor_sip.go
starcoder
package constants const ( // BitcoinSeedIV is the initialization vector used for creating bitcoin wallet seeds. BitcoinSeedIV = "Bitcoin seed" // Base58Alphabet is the Bitcoin Base 58 alphabet. Base58Alphabet = "123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz" // Bech32Alphabet is the base-32 encodin...
constants/constants.go
0.842151
0.442877
constants.go
starcoder
package bitarray import ( "fmt" "strconv" ) const uintSize = 32 << (^uint(0) >> 63) // 32 or 64 // UintSize is the size of a uint in bits (32 or 64 depending on the platform). const UintSize = uintSize // BitArray is the actual data structure. Users are supposed to use `New` method to instantiate a new bit-array ...
bit_array.go
0.783906
0.595551
bit_array.go
starcoder
package msgraph // RatingJapanMoviesType undocumented type RatingJapanMoviesType string const ( // RatingJapanMoviesTypeVAllAllowed undocumented RatingJapanMoviesTypeVAllAllowed RatingJapanMoviesType = "AllAllowed" // RatingJapanMoviesTypeVAllBlocked undocumented RatingJapanMoviesTypeVAllBlocked RatingJapanMovie...
v1.0/RatingJapanMoviesTypeEnum.go
0.589953
0.442697
RatingJapanMoviesTypeEnum.go
starcoder
package samples func init() { sampleDataProposalCreateOperation[14] = `{ "expiration_time": "2016-02-10T19:00:00", "extensions": [], "fee": { "amount": 4056640, "asset_id": "1.3.0" }, "fee_paying_account": "1.2.298", "proposed_ops": [ { "op": [ 11, { "asset_to...
gen/samples/proposalcreateoperation_14.go
0.649801
0.436382
proposalcreateoperation_14.go
starcoder
package changelog // Base changelog template const changelogTemplate = ` # Changelog All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0....
pkg/changelog/template.go
0.739516
0.665431
template.go
starcoder
package mingo import ( "reflect" ) var ( objectOperators = []string{ "$ne", "$gt", "$gte", "$lt", "$lte", } ) // QueryOperator model type QueryOperator struct{} // eq checks if the field of the given data matches the defined expression. func (qo *QueryOperator) eq(field string, expr interface{}) func(O...
operator.go
0.69451
0.522324
operator.go
starcoder
package pgsql import ( "database/sql" "database/sql/driver" "strconv" ) // LineArrayFromFloat64Array3Slice returns a driver.Valuer that produces a PostgreSQL line[] from the given Go [][3]float64. func LineArrayFromFloat64Array3Slice(val [][3]float64) driver.Valuer { return lineArrayFromFloat64Array3Slice{val: va...
pgsql/linearr.go
0.678966
0.451387
linearr.go
starcoder
package internal import ( "fmt" "math" "reflect" "strconv" "github.com/lyraproj/dgo/dgo" ) type ( // intVal is an int64 that implements the dgo.Value interface intVal int64 defaultIntegerType int exactIntegerType struct { exactType value intVal } integerType struct { min int64 max i...
internal/integer.go
0.738386
0.450903
integer.go
starcoder
package cbor // MajorType represents the CBOR major type (first 3 bits) type MajorType int const ( // MajorTypePositiveInt is the type for unsigned positive integer MajorTypePositiveInt MajorType = 0 // MajorTypeNegativeInt is the type for negative integer MajorTypeNegativeInt MajorType = 1 // MajorTypeByteStr...
cbor/types.go
0.695235
0.442516
types.go
starcoder
package batchnorm import ( "encoding/gob" mat "github.com/nlpodyssey/spago/pkg/mat32" "github.com/nlpodyssey/spago/pkg/ml/ag" "github.com/nlpodyssey/spago/pkg/ml/nn" ) var ( _ nn.Model = &Model{} ) // Model contains the serializable parameters. type Model struct { nn.BaseModel W nn.Param `spago:"type:...
pkg/ml/nn/normalization/batchnorm/batchnorm.go
0.837885
0.444746
batchnorm.go
starcoder
package main import ( "bufio" "os" "regexp" ) var costPerType = []int{0, 1, 10, 100, 1000} type WorldCost struct { World World Cost int } type World struct { Height byte State1 int64 State2 int64 } var EmptyWorldCost = WorldCost{} func MakeWorld(data string) World { result := World{Height: byte(len(data...
2021/23/program.go
0.538498
0.476641
program.go
starcoder
package intern import ( "fmt" "sort" ) // A tree represents a binary tree of strings. type tree struct { str string // Contents of this node sym symbol // Symbol to assign to this string (LTE or LTEC) left *tree // Left child or nil right *tree // Right child or nil } // insert inserts a string into a ...
tree.go
0.733833
0.401923
tree.go
starcoder
package pfmt import ( "encoding" "encoding/json" "time" ) // Any returns stringer/JSON/text marshaler for any type. func Any(v interface{}) AnyV { return New().Any(v) } // Any returns stringer/JSON/text marshaler for any type. func (pretty Pretty) Any(v interface{}) AnyV { return AnyV{ v: v, prettier...
any.go
0.525125
0.446917
any.go
starcoder
package midi import ( "fmt" "math/big" "sort" ) const ( kDefaultTempo MicroSecondPerBeat = 500000 // 120 bps kMega int64 = 1000000 ) type TempoTable struct { table sliceOfTempo tpqn int64 // tick per quater note } type sliceOfTempo []*Tempo func (v sliceOfTempo) Len() int { return len...
tempo_table.go
0.607663
0.462352
tempo_table.go
starcoder
package avl // AVL tree adapted from <NAME>'s presentation at // http://eternallyconfuzzled.com/tuts/datastructures/jsw_tut_avl.aspx. // This port uses similar indentifier names. // The Key interface must be supported by data stored in the AVL tree. type Key interface { Less(Key) bool Eq(Key) bool } // N...
old/packages/avl.go
0.589126
0.437884
avl.go
starcoder
package regexputil import ( "regexp/syntax" ) // Regexp represents a parsed regexp. Use Parse to make one. type Regexp struct { pt *syntax.Regexp } // Parse takes a regexp in Perl syntax (as implemented by regexp/syntax) and // returns a Regexp, for introspecting the regexp. func Parse(regexp string) (Regexp, erro...
pkg/regexputil/opt.go
0.603581
0.407923
opt.go
starcoder
package iavl import ( "bytes" "fmt" "sort" "github.com/pkg/errors" amino "github.com/tendermint/go-amino" ) type TreeDeltaMap map[string]*TreeDelta func (tdm TreeDeltaMap) MarshalAmino() ([]*TreeDeltaMapImp, error) { keys := make([]string, len(tdm)) index := 0 for k := range tdm { keys[index] = k index+...
libs/iavl/tree_delta.go
0.556641
0.415106
tree_delta.go
starcoder
package mat import ( "fmt" "math" "github.com/nlpodyssey/spago/mat/float" ) // TODO: review this code once stable go 1.18 is released // SmallestNonzero returns the smallest positive, non-zero value representable by the type. func SmallestNonzero[T float.DType]() T { switch any(T(0)).(type) { case float32: ...
mat/mathfunctions.go
0.738952
0.790732
mathfunctions.go
starcoder
package meta import ( "flag" "github.com/puppetlabs/wash/api/rql" "github.com/puppetlabs/wash/plugin" ) type SchemaPredicate = func(ValueSchema) bool /* ValuePredicate is a wrapper to rql.ValuePredicate that includes an additional SchemaPredicate method. All rql.ValuePredicate implementations should embed the Va...
api/rql/internal/primary/meta/valuePredicate.go
0.727492
0.491822
valuePredicate.go
starcoder
package sound // Code based on mame implementation, I wouldn't know how to do it otherwise: // https://github.com/mamedev/mame/blob/master/src/devices/sound/ay8910.cpp // https://github.com/jsanchezv/JSpeccy/blob/master/src/machine/AY8912.java // https://github.com/gasman/jsspeccy2/blob/master/core/sound.js // http://...
spectrum/sound/ay8910.go
0.696578
0.428592
ay8910.go
starcoder
package configuration // Feeds contains definition of feeds.yaml configuration file type Feeds struct { // Sources contain instructions on how to obtain data from a source Sources map[string]Source `yaml:"sources"` // Feeds contain instructions on how to aggregate data from multiple sources Feeds map[string]Feed `...
configuration/feeds.go
0.656328
0.467453
feeds.go
starcoder