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 docs import "github.com/swaggo/swag" const docTemplate = `{ "schemes": {{ marshal .Schemes }}, "swagger": "2.0", "info": { "description": "{{escape .Description}}", "title": "{{.Title}}", "termsOfService": "http://swagger.io/terms/", "contact": {}, "license"...
docs/docs.go
0.57344
0.404449
docs.go
starcoder
package verdeps import ( "fmt" "sort" ) type bytesDiff struct { bytes []byte exclusiveTo int inclusiveFrom int } type bytesDiffs []bytesDiff func (bd bytesDiffs) Len() int { return len(bd) } func (bd bytesDiffs) Less(i, j int) bool { return bd[i].inclusiveFrom >= bd[j].exclusiveTo } func (bd byte...
lib/verdeps/bytes_diffs.go
0.765067
0.413063
bytes_diffs.go
starcoder
package imageoutput // CoordinateThreshold looks at a CoordinateCollection and determines which coordinates will be kept. type CoordinateThreshold interface { FilterAndMarkMappedCoordinateCollection(collection *CoordinateCollection) } // RectangularCoordinateThreshold defines a rectangular range in which coordinates...
entities/imageoutput/coordinatethreshold.go
0.936959
0.565299
coordinatethreshold.go
starcoder
// Package buffer contains helper functions for writing and reading basic // types into and out of byte slices. package buffer // Stdlib imports. import ( "errors" ) // Data type sizes. const ( BYTE_SIZE = 1 UINT8_SIZE = 1 UINT16_SIZE = 2 UINT32_SIZE = 4 UINT64_SIZE = 8 ) // Common errors...
lib/buffer/buffer.go
0.745584
0.553867
buffer.go
starcoder
package vector import ( "math" ) var EPSILON = math.Nextafter(1, 2) - 1 func min(a, b int) int { if a < b { return a } return b } func New(size int) Vector { return make(Vector, size) } func NewWithValues(values []float64) Vector { v := make(Vector, len(values)) copy(v, values) return v } // Sums of two...
package.go
0.828904
0.526586
package.go
starcoder
package heuristic import ( "fmt" "github.com/gnames/gnfinder/ent/token" "github.com/gnames/gnfinder/io/dict" ) // TagTokens is important for both heuristic and Bayes approaches. It analyses // tokens and sets up token's indices. Indices determine if a token is a // potential unimonial, binomial or trinomial. Then...
ent/heuristic/heuristic.go
0.651355
0.453625
heuristic.go
starcoder
package source import ( "go/ast" "github.com/go-services/annotation" "github.com/allar/code" ) type Node interface { Exported() bool Code() code.Code String() string Name() string Begin() int End() int } type NodeWithInner interface { Node InnerBegin() int InnerEnd() int } // Import represents an impo...
file.go
0.710226
0.431285
file.go
starcoder
package typ import ( "xelf.org/xelf/knd" ) var ( Void = Type{Kind: knd.Void} None = Type{Kind: knd.None} Bool = Type{Kind: knd.Bool} Num = Type{Kind: knd.Num} Int = Type{Kind: knd.Int} Real = Type{Kind: knd.Real} Char = Type{Kind: knd.Char} Str = Type{Kind: knd.Str} Raw = Type{Kind: knd.Raw} UUID = Typ...
typ/decl.go
0.513912
0.546678
decl.go
starcoder
package profanity import ( "log" "regexp" "strings" ) /** RemoveWords: Function removes input words from the dictionary of bad words. Input : wordsToBeRemoved ([]string) the words to be removed Output : wordsToBeRemoved ([]string) words that re removed err (error) golang error object **/ func Remov...
profanity.go
0.569853
0.402656
profanity.go
starcoder
package raycaster import ( "francoisgergaud/3dGame/common/environment/world" innerMath "francoisgergaud/3dGame/common/math" "math" ) //RayCaster provides the function to cast a ray. type RayCaster interface { CastRay(origin *innerMath.Point2D, world world.WorldMap, angle float64, maxDistance float64) *innerMath.P...
common/math/raycaster/raycaster.go
0.675229
0.65933
raycaster.go
starcoder
package parametric2d import ( "github.com/gmlewis/go-poly2tri" "github.com/gmlewis/go3d/float64/vec2" "github.com/gmlewis/go3d/float64/vec3" ) // T represents a parametric 2D segment. type T interface { // BBox returns the bounds of the segment. BBox() vec2.Rect // At interpolates along the segment and returns ...
parametric2d.go
0.780955
0.641984
parametric2d.go
starcoder
package tinymt32 const ( mat1 = 0x8f7011ee mat2 = 0xfc78ff1f tmat = 0x3793fdff ) // A Source represents a source of uniformly-distributed pseudo-random uint32 values in the range [0, 1<<32). type Source struct { status [4]uint32 mat1 uint32 mat2 uint32 tmat uint32 } // NewSource returns a new pseudo-ran...
tinymt32.go
0.625209
0.518729
tinymt32.go
starcoder
package gbq import "cloud.google.com/go/bigquery" // GetViolationsSchema defines violations table schema func GetViolationsSchema() bigquery.Schema { return bigquery.Schema{ { Name: "nonCompliance", Type: bigquery.RecordFieldType, Description: "The violation information, aka why it is not c...
utilities/gbq/func_getviolationsschema.go
0.509276
0.509642
func_getviolationsschema.go
starcoder
package money import ( "database/sql/driver" "errors" "fmt" "regexp" "strings" "github.com/FoxComm/money/currency" "github.com/shopspring/decimal" ) var parseRegex = regexp.MustCompile(`[+-]?[0-9]*[.]?[0-9]*`) // Money represents an amount of a specific currency as an immutable value type Money struct { amo...
money.go
0.80038
0.428233
money.go
starcoder
package comp // Search a type that combines the capabilities of a mock and an interface // that is almost fully compatible with gorm. type Search struct { // Mock fields definition Foundation // Gorm fields definition Unscoped bool } // Where implementation of gorm interface. func (r *Search) Where(query interf...
comp/search.go
0.813201
0.434941
search.go
starcoder
// Package tensorflow provides implementation of Go API for extract data to vector package tensorflow import ( tf "github.com/tensorflow/tensorflow/tensorflow/go" "github.com/vdaas/vald/internal/errors" "github.com/vdaas/vald/internal/io" ) // SessionOptions is a type alias for tensorflow.SessionOptions. type Ses...
internal/core/converter/tensorflow/tensorflow.go
0.774498
0.478773
tensorflow.go
starcoder
package ubigraph type VertexID int type VertexStyleID int // NewVertex creates a vertex on the graph. // It returns an Ubigraph server selected vertex ID on success. func (g *Graph) NewVertex() (VertexID, error) { method := "ubigraph.new_vertex" status, err := g.serverCall(method, nil) if err != nil { return 0,...
ubigraph/vertices.go
0.818592
0.422505
vertices.go
starcoder
package hopfield import ( "fmt" "image" "image/draw" "math/rand" "gonum.org/v1/gonum/mat" ) // Pattern is a data pattern type Pattern struct { // v is a vector which stores binary data v *mat.VecDense } // String implements Stringer interface func (p *Pattern) String() string { fa := mat.Formatted(p.v, mat....
hopfield/pattern.go
0.855066
0.503235
pattern.go
starcoder
package challenge import ( "math" "sort" ) // KeyLength is the assumed length of a key. const KeyLength = 16 // EqualKeys returns true if the given []byte are equal. func EqualKeys(firstKey, secondKey []byte) bool { if len(firstKey) != len(secondKey) { return false } for i, byt := range firstKey { if byt !...
set/1/challenge/8.go
0.853989
0.432063
8.go
starcoder
package ipaddr const ( upperAdjustment = 8 // These are for the flags. // A standard string is a string showing only the lower value of a segment, in lowercase. // A standard range string shows both values, low to high, with the standard separator. keyWildcard uint32 = 0x10000 keySingleWildcard ...
ipaddr/parsedata.go
0.652241
0.442094
parsedata.go
starcoder
package main import ( "math" "math/rand" "sync" "fmt" "time" ) // Pixels represents the array of pixels (in packed RGB value) to Render and/or save type Pixels []uint32 // Scene represents the scene to Render. // raysPerPixel is an array because the Render algorithm is split in multiple passes so that a resul...
scene.go
0.767254
0.547404
scene.go
starcoder
package operators import ( bs "github.com/sharnoff/badstudent" "math" ) // **************************************** // Logistic // **************************************** type logistic int8 // Logistic returns an elementwise application of the logistic (or sigmoid) function that // implements badstudent.Operator...
operators/logistics.go
0.803444
0.407216
logistics.go
starcoder
package reducers import ( "github.com/paulmach/go.geo" ) type distanceFunc func(*geo.Point, *geo.Point) float64 // A RadialReducer wraps the Radial function // to fulfill the geo.Reducer and geo.GeoReducer interfaces. type RadialReducer struct { Threshold float64 // euclidean distance } // NewRadialReducer create...
lab138/vendor/github.com/paulmach/go.geo/reducers/radial.go
0.885272
0.580441
radial.go
starcoder
package main import ( "fmt" "net" "strconv" ) /** Usage Go's interfaces let you use duck typing like you would in a purely dynamic language like Python but still have the compiler catch obvious mistakes like passing an int where an object with a Read method was expected, or like calling the Read method with the w...
01 | Go by Example/internal/20_Interfaces/ref/Go Data Structures: Interfaces /x.go
0.78842
0.51946
x.go
starcoder
package schema // Decl describes an interface for a declaration. type Decl interface { Pos() Pos validate(r errorReporter) } // Package holds the data of an mprot package declaration. type Package struct { pos Pos Name string } // Pos implements the Decl interface. func (p *Package) Pos() Pos { return p.pos } ...
schema/decl.go
0.730194
0.425963
decl.go
starcoder
package geo import ( "fmt" "math" ) // Boundary represents a predefined geo-location polygon identified by two points. // As a rule, the boundary lower bound always has to be on bottom left, while the upper bound has to be on // the top right. // All the points with latlng values between these two points' latlng //...
boundary.go
0.865892
0.50293
boundary.go
starcoder
package sqlparser // A Visitor's Visit method is invoked for each node encountered by Walk. // If the result visitor w is not nil, Walk visits each of the children // of node with the visitor w, followed by a call of w.Visit(nil). type Visitor interface { Visit(node Node) (w Visitor, err error) VisitEnd(node Node) e...
walk.go
0.699562
0.436142
walk.go
starcoder
package examples import ( "context" mock "github.com/stretchr/testify/mock" "testing" ) var _ ComplexTypes = (*MockComplexTypes)(nil) type MockComplexTypes struct { mock.Mock } func (x *MockComplexTypes) Normal(b_ bool) (int, error) { args := x.Called(b_) if len(args) > 0 { if t, ok := args.Get(0).(mockComp...
examples/example_mock_complextypes.gen.go
0.785103
0.421611
example_mock_complextypes.gen.go
starcoder
package difficulty import "math" type Difficulty struct { hp, cs, od, ar float64 Preempt float64 CircleRadius float64 Mods Modifier Hit50 float64 Hit100 float64 Hit300 float64 HPMod float64 SpinnerRatio float64 Speed float64 ARReal float64 ODReal float64 Cus...
beatmap/difficulty/difficulty.go
0.744842
0.444203
difficulty.go
starcoder
package utils import ( "reflect" ) // IsNil checks whether `value` is nil. func IsNil(value interface{}) bool { return value == nil } // IsEmpty checks whether `value` is empty. func IsEmpty(value interface{}) bool { if value == nil { return true } switch value := value.(type) { case int, int8, int16, int32,...
utils/is.go
0.631253
0.493164
is.go
starcoder
package reverset import "github.com/melvinodsa/goOdsa/utils" /*RTransform will do the reverse transformation of the data that was passed to it as the argument data. It returns a string as reversed transformed data */ func RTransform(data utils.Data) []byte { return data.GetData() } /*rTransformWrapper is a wrapper ...
modules/reverset/reverset.go
0.658637
0.525186
reverset.go
starcoder
package haversine import ( "fmt" "math" ) const ( // degrees that constitute π radians DegreesInPiRadian = 180 MetersPerKm = 1000 // radius of the earth in miles EarthRadiusMiles = 3958 // radius of the earth in kilometers EarthRadiusKm = 6371 // radius of the earth in meters EarthRadiusMeters = EarthR...
pkg/haversine/haversine.go
0.866444
0.642026
haversine.go
starcoder
package schema import ( pschema "github.com/pulumi/pulumi/pkg/v3/codegen/schema" ) func configToProvider(config pschema.ComplexTypeSpec) pschema.ComplexTypeSpec { // The Provider schema is the Config schema with an additional Language block for each Property. for k, v := range config.Properties { v.Language = m...
provider/pkg/schema/config.go
0.596551
0.504516
config.go
starcoder
package geoindex type ClusteringIndex struct { streetLevel *PointsIndex cityLevel *CountIndex worldLevel *CountIndex } var ( streetLevel = Km(45) cityLevel = Km(1000) ) // NewClusteringIndex creates index that clusters the points at three levels with cell size 0.5, 5 and 500km. // Useful for creating maps....
hotelReservation/vendor/github.com/hailocab/go-geoindex/clustering-index.go
0.847274
0.510192
clustering-index.go
starcoder
// W niektórych językach idiomatyczne jest korzystanie z // [programowania generycznego](https://pl.wikipedia.org/wiki/Programowanie_uog%C3%B3lnione) i algorytmów. // Go, obecnie, nie wspiera tego paradygmatu. Go zazwyczaj udostępnia funkcje // gromadzenia danych, jeśli są one potrzebne specjalnie dla Twojego programu...
examples/collection-functions/collection-functions.go
0.51879
0.420124
collection-functions.go
starcoder
package network // NATDeviceType indicates the type of the NAT device. type NATDeviceType int const ( // NATDeviceTypeUnknown indicates that the type of the NAT device is unknown. NATDeviceTypeUnknown NATDeviceType = iota // NATDeviceTypeCone indicates that the NAT device is a Cone NAT. // A Cone NAT is a NAT wh...
vendor/github.com/libp2p/go-libp2p-core/network/nattype.go
0.710025
0.41253
nattype.go
starcoder
package binary_search_tree type Bst struct { root *node } type Data struct { Key int Value interface{} } type node struct { data Data left *node right *node } func NewBst() *Bst { return &Bst{nil} } func (t *Bst) Get(key int) (value interface{}, ok bool) { if n := find(t.root, key); n != nil { return...
binary_search_tree/go/binary_search_tree.go
0.590661
0.403332
binary_search_tree.go
starcoder
package parser import ( "fmt" "strconv" "strings" ) type Atom interface { Parent() Atom Value() interface{} Kind() AtomKind } type Alpha struct { value string parent Atom } func (a Alpha) Parent() Atom { return a.parent } func (a Alpha) Value() interface{} { return a.value } func (a Alpha) Kind() Ato...
parser/types.go
0.584627
0.437944
types.go
starcoder
package util // Linear interpolation. // Lerp returns the value (1-t)*start + t*end. func Lerp(t, start, end float64) float64 { return (1-t)*start + t*end } // LerpClamp is a clamped [0,1] version of Lerp. func LerpClamp(t, start, end float64) float64 { if t < 0 { t = 0 } if t > 1 { t = 1 } return (1-t)*st...
util/lerp.go
0.843605
0.453141
lerp.go
starcoder
package filter import ( "fmt" "github.com/pkg/errors" "regexp" ) type Operator func(v string) bool const ( OperatorKey = "" OperatorEqual = "==" OperatorNotEqual = "!=" OperatorRegex = "?=" ) type OperatorFactory func(key, value string) (Operator, error) var Operators = map[string]OperatorFactory...
pkg/filter/simple_filter.go
0.737442
0.414366
simple_filter.go
starcoder
package cppn import ( "errors" "fmt" "github.com/yaricom/goNEAT/neat/network" ) // Defines layout of neurons in the substrate type SubstrateLayout interface { // Returns coordinates of the neuron with specified index [0; count) and type NodePosition(index int, nType network.NodeNeuronType) (*PointF, error) // ...
cppn/substrate_layout.go
0.803058
0.546799
substrate_layout.go
starcoder
package number import ( "crypto/rand" "errors" "fmt" "math/big" ) // Number of tries to generate coprime pair in generateCoprimes const tries = 5 // Generates a super increasing sequence of length n. // This function reports an error if n < 2. func GenerateSuperIncreasingSequence(n int) (r []*big.Int, err error)...
internal/number/number.go
0.744471
0.425486
number.go
starcoder
package asm func (o Opcodes) Aad(ops ...Operand) { o.a.op("AAD", ops...) } func (o Opcodes) AAD(ops ...Operand) { o.a.op("AAD", ops...) } func (o Opcodes) Aam(ops ...Operand) { o.a.op("AAM", ops...) } func (o Opcodes) AAM(ops ...Operand) { o.a.op("AAM", ops...) } func (...
vendor/github.com/tmthrgd/asm/opcode.go
0.544801
0.540863
opcode.go
starcoder
package glong import ( "github.com/goki/mat32" ) // GABABParams control the GABAB dynamics in PFC Maint neurons, based on Brunel & Wang (2001) // parameters. We have to do some things to make it work for rate code neurons.. type GABABParams struct { RiseTau float32 `def:"45" desc:"rise time for bi-exponential ti...
glong/gabab.go
0.811825
0.510863
gabab.go
starcoder
package engine import ( "fmt" "github.com/proullon/ramsql/engine/log" "github.com/proullon/ramsql/engine/parser" "strconv" "time" ) // Operator compares 2 values and return a boolean type Operator func(leftValue Value, rightValue Value) bool // NewOperator initializes the operator matching the Token number func...
engine/operator.go
0.815416
0.533337
operator.go
starcoder
package main import ( "github.com/gen2brain/raylib-go/raylib" ) func main() { screenWidth := int32(800) screenHeight := int32(450) raylib.InitWindow(screenWidth, screenHeight, "raylib [shapes] example - raylib logo animation") logoPositionX := screenWidth/2 - 128 logoPositionY := screenHeight/2 - 128 frames...
examples/shapes/logo_raylib_anim/main.go
0.569972
0.480783
main.go
starcoder
package goja import ( "math" "time" ) const ( maxTime = 8.64e15 ) func timeFromMsec(msec int64) time.Time { sec := msec / 1000 nsec := (msec % 1000) * 1e6 return time.Unix(sec, nsec) } func makeDate(args []Value, loc *time.Location) (t time.Time, valid bool) { pick := func(index int, default_ int64) (int64, ...
vendor/github.com/dop251/goja/builtin_date.go
0.616705
0.44746
builtin_date.go
starcoder
package qparams import ( "bytes" "errors" "fmt" "net/url" "reflect" "strconv" "strings" ) // Encode encodes a query using the given struct. // It can only encode bool, int, float32, float64 and string values or // slices of one of these types. // All other typed fields in the struct are ignored. func Encode(in...
query.go
0.663996
0.468487
query.go
starcoder
package mysqlproto // https://dev.mysql.com/doc/internals/en/com-query-response.html#column-type type Type byte const ( TypeDecimal Type = 0x00 TypeTiny Type = 0x01 TypeShort Type = 0x02 TypeLong Type = 0x03 TypeFloat Type = 0x04 TypeDouble Type = 0x05 TypeNULL Type = 0x06 T...
types.go
0.52975
0.435541
types.go
starcoder
package metrics import ( "context" "github.com/prometheus/procfs" "go.opencensus.io/stats" "go.opencensus.io/stats/view" ) // A ProcessCollector collects stats about a process. type ProcessCollector struct { cpuTotal *stats.Float64Measure openFDs *stats.Int64Measure maxFDs *stats.Int64Measure vsize ...
internal/telemetry/metrics/processes.go
0.526099
0.444143
processes.go
starcoder
package gfx import ( "errors" "github.com/rainu/launchpad-super-trigger/pad" ) // Fill fills the given rectangle with the given color func (e Renderer) Fill(x0, y0, x1, y1 int, color pad.Color) error { frame := buildFill(x0, y0, x1, y1, color) for _, pixel := range frame { if err := pixel.Light(e); err != nil {...
gfx/filler.go
0.773559
0.570092
filler.go
starcoder
package ast // nodeType is used to declare the different possible types of AST nodes type nodeType string const ( TypeResource nodeType = "Resource" TypeIdentifier nodeType = "Identifier" TypeComment nodeType = "Comment" TypeGroupComment nodeType = "GroupComment" TypeResourceCommen...
fluent/parser/ast/types.go
0.613352
0.455501
types.go
starcoder
package golist import ( "fmt" "math/rand" "time" ) // SliceBool is a slice of type bool. type SliceBool struct { data []bool } // NewSliceBool returns a pointer to a new SliceBool initialized with the specified elements. func NewSliceBool(elems ...bool) *SliceBool { s := new(SliceBool) s.data = make([]bool, l...
slice_bool.go
0.747984
0.532364
slice_bool.go
starcoder
package cnns import ( "fmt" "math" "strings" "github.com/LdDl/cnns/tensor" "github.com/pkg/errors" "gonum.org/v1/gonum/mat" ) type poolingType int const ( poolMAX = iota + 1 poolMIN poolAVG ) func (pt poolingType) String() string { switch pt { case poolMAX: return "max" case poolMIN: return "min" ...
pooling_layer.go
0.765506
0.405625
pooling_layer.go
starcoder
package dstask import ( "fmt" "os" ) func Help(cmd string) { var helpStr string showKey := false switch cmd { case CMD_NEXT: helpStr = `Usage: dstask next [filter] [--] Usage: dstask [filter] [--] Example: dstask +work +bug -- Display list of non-resolved tasks in the current context, most recent last, opti...
help.go
0.556641
0.407039
help.go
starcoder
package benchmarked // Equal checks if two slices of bytes are equal var Equal = equal14 func equal1(a, b []byte) bool { return string(a) == string(b) } func equal2(a, b []byte) bool { la := len(a) lb := len(b) if la == 0 && lb == 0 { return true } else if la != lb { return false } // len(a) == len(b) fro...
vendor/github.com/xyproto/benchmarked/equal.go
0.587825
0.471162
equal.go
starcoder
package unifier import ( "fmt" "github.com/twtiger/gosecco/constants" "github.com/twtiger/gosecco/tree" ) type replacer struct { expression tree.Expression macros map[string]tree.Macro err error } func (r *replacer) AcceptAnd(b tree.And) { var left tree.Boolean var right tree.Boolean left, r.err...
vendor/github.com/twtiger/gosecco/unifier/unifier_visitor.go
0.523664
0.48499
unifier_visitor.go
starcoder
package protocol import ( "github.com/google/uuid" ) // PlayerListEntry is an entry found in the PlayerList packet. It represents a single player using the UUID // found in the entry, and contains several properties such as the skin. type PlayerListEntry struct { // UUID is the UUID of the player as sent in the Log...
minecraft/protocol/player.go
0.566019
0.413359
player.go
starcoder
package function import ( "fmt" "math" "reflect" "github.com/src-d/go-mysql-server/sql" "github.com/src-d/go-mysql-server/sql/expression" ) // Ceil returns the smallest integer value not less than X. type Ceil struct { expression.UnaryExpression } // NewCeil creates a new Ceil expression. func NewCeil(num sql...
sql/expression/function/ceil_round_floor.go
0.738669
0.475423
ceil_round_floor.go
starcoder
package colonist import ( "fmt" "math" "math/rand" "github.com/rs/xid" "github.com/thebrubaker/colony/storage" ) type DesireType string const ( Fulfillment DesireType = "Fulfillment" Belonging DesireType = "Belonging" Esteem DesireType = "Esteem" ) type Desires map[DesireType]float64 func (d Desire...
colonist/colonist.go
0.524151
0.454896
colonist.go
starcoder
package schema const RUMV3Schema = `{ "$id": "docs/spec/transactions/rum_v3_transaction.json", "type": "object", "description": "An event corresponding to an incoming request or similar task occurring in a monitored service", "allOf": [ { "properties": { "id": { ...
model/transaction/generated/schema/rum_v3_transaction.go
0.782455
0.540681
rum_v3_transaction.go
starcoder
package isa497 import ( "fmt" ) // Tree represents a Tree data structure. type Tree struct { key int root *Tree parent *Tree left *Tree right *Tree } // Key returns the key-value of a tree func (t *Tree) Key() int { return t.key } // NewTree returns a new Tree struct. func NewTree(k int) (t *Tree) {...
trees.go
0.803482
0.467149
trees.go
starcoder
package ontap // FcPort A Fibre Channel (FC) port is the physical port of an FC adapter on an ONTAP cluster node that can be connected to an FC network to provide FC network connectivity. An FC port defines the location of an FC interface within the ONTAP cluster. type FcPort struct { Links InlineResponse201Links `js...
ontap/model_fc_port.go
0.696681
0.406155
model_fc_port.go
starcoder
package schoolsout import ( "errors" "sync" "time" ) // Calendar is used to determine and calculate applicable holidays. type Calendar struct { sync.RWMutex DisableShiftSaturday bool DisableShiftSunday bool holidays []HolidayDefinition } // HolidayDefinition is the definition of a single Holida...
schoolsout.go
0.675444
0.533397
schoolsout.go
starcoder
package kdtree import ( "container/heap" "math" "github.com/go-spatial/geom" ) /* heapEntry is an entry in the heap for storing nodes so we can get back the nearest neighbors in order. */ type heapEntry struct { node *KdNode d float64 } /* kdNodeHeap is an array of heap entries. We are not using a pointer ...
planar/index/kdtree/nearest_neighbor_iterator.go
0.798619
0.465691
nearest_neighbor_iterator.go
starcoder
The mapping system is based on a set of rules described inside a JSON mapping file, here's an example: { "raws": { "ui": "user_id" }, "mapped": { "oi": { "name": "is_opted_in", "values": { "0": "false", "1": "true" } } }, "reversed": [ { "name": "order_status", "values"...
mapping/mapping.go
0.777722
0.663349
mapping.go
starcoder
package geometry import ( "math" "sort" ) type collisionCheckForCardinalDirection struct { border *Line firstVector *Line secondVector *Line } type collisionCheckForDiagonalDirection struct { firstBorder *Line secondBorder *Line firstVector *Line secondVector *Line thirdVector *Line } type diago...
src/engine/geometry/collision-detection.go
0.836154
0.710515
collision-detection.go
starcoder
package unencrypted_communication import ( "github.com/damianmcgrath/threagile/model" ) func Category() model.RiskCategory { return model.RiskCategory{ Id: "unencrypted-communication", Title: "Unencrypted Communication", Description: "Due to the confidentiality and/or integrity rating of the data assets tr...
risks/built-in/unencrypted-communication/unencrypted-communication-rule.go
0.5
0.443781
unencrypted-communication-rule.go
starcoder
package dfl import ( "reflect" "strings" "github.com/pkg/errors" "github.com/spatialcurrent/go-adaptive-functions/pkg/af" ) // AssignAdd is a BinaryOperator which sets the added value of the left side and right side to the attribute or variable defined by the left side. type AssignAdd struct { *BinaryOperator...
pkg/dfl/AssignAdd.go
0.705075
0.445107
AssignAdd.go
starcoder
package slice import "reflect" // IntersectGeneric returns intersection of left and right, in the left order. // The duplicate members in left are kept. func IntersectGeneric(left, right interface{}) interface{} { if left == nil || right == nil { return nil } return IntersectValue(reflect.ValueOf(left), reflect....
intersect.go
0.846387
0.611411
intersect.go
starcoder
package scolumn import ( "bytes" "fmt" "math/rand" "reflect" "github.com/tobgu/qframe/config/rolling" "github.com/tobgu/qframe/internal/column" "github.com/tobgu/qframe/internal/hash" "github.com/tobgu/qframe/internal/index" qfstrings "github.com/tobgu/qframe/internal/strings" "github.com/tobgu/qframe/qerro...
internal/scolumn/column.go
0.658637
0.449091
column.go
starcoder
package rdf import ( "encoding/json" "fmt" ) // LiteralType is the TermType literals const LiteralType = "Literal" var literalTermType = termType{LiteralType} // A Literal is literal term type Literal struct { value string language string datatype *NamedNode } // NewLiteral creates a new literal func NewLi...
literal.go
0.658088
0.404949
literal.go
starcoder
package rbtree // This file contains all RB tree iteration methods implementations type enumerable struct{ it Iterator } type iterator struct { enumerable tree RbTree curr *Node } type walk struct { iterator stack []*Node } type walkPreorder struct{ walk } type walkInorder struct { walk p *Node } type wal...
rbtree/iterate.go
0.80479
0.526343
iterate.go
starcoder
package schema // GitLabSchemaJSON is the content of the file "gitlab.schema.json". const GitLabSchemaJSON = `{ "$schema": "http://json-schema.org/draft-07/schema#", "$id": "gitlab.schema.json#", "title": "GitLabConnection", "description": "Configuration for a connection to GitLab (GitLab.com or GitLab self-m...
schema/gitlab_stringdata.go
0.816406
0.443841
gitlab_stringdata.go
starcoder
package main import ( "math/rand" "sort" ) // MAXSECS is the maximum number of seconds in a year. const MAXSECS = 365 * 24 * 3600 // Interval represents an availability interval. type Interval struct { beg, end uint32 cnt uint32 ratio float32 } // Overlap checks the overlap between two intervals. func ...
simufail/interval.go
0.730482
0.5144
interval.go
starcoder
package semantic import "github.com/google/gapid/gapil/ast" // Function represents function like objects in the semantic graph. type Function struct { owned AST *ast.Function // the underlying syntax node this was built from Annotations // the annotations applied to the function Named...
gapil/semantic/function.go
0.681621
0.639145
function.go
starcoder
package keys import ( "golang.org/x/exp/event" ) // Value represents a key for untyped values. type Value string // From can be used to get a value from a Label. func (k Value) From(l event.Label) interface{} { return l.Value.Interface() } // Of creates a new Label with this key and the supplied value. func (k Va...
event/keys/keys.go
0.876357
0.730554
keys.go
starcoder
package information import ( "cloud.google.com/go/spanner" "cloud.google.com/go/spanner/spansql" ) type ( // Columns is a collection of Collumns Columns []*Column // Column is a row from information_schema.columns (see: https://cloud.google.com/spanner/docs/information-schema#information_schemacolumns) Column ...
pkg/schema/information/column.go
0.613468
0.430387
column.go
starcoder
package easing import ( "math" ) var easings = []func(float64) float64{ Linear, OutQuad, InQuad, InQuad, OutQuad, InOutQuad, InCubic, OutCubic, InOutCubic, InQuart, OutQuart, InOutQuart, InQuint, OutQuint, InOutQuint, InSine, OutSine, InOutSine, InExpo, OutExpo, InOutExpo, InCirc, OutCirc, In...
animation/easing/equations.go
0.721154
0.570511
equations.go
starcoder
// Package mlearning provides a few abstracted machine learning algorithms. package mlearning import ( "math/rand" "sort" ) type Feature string type Class string type Weight float64 type Iterator interface { Next() bool Features() []Feature Class() Class Predicted(c Class) } type FeatureCollection interface ...
pkg/mlearning/perceptron.go
0.725746
0.437884
perceptron.go
starcoder
package promql import ( "fmt" "time" "github.com/wolffcm/flux" "github.com/wolffcm/flux/execute" "github.com/wolffcm/flux/plan" "github.com/wolffcm/flux/semantic" "github.com/wolffcm/flux/values" ) const LinearRegressionKind = "linearRegression" type LinearRegressionOpSpec struct { Predict bool `json:"predi...
stdlib/internal/promql/linear_regression.go
0.740737
0.501526
linear_regression.go
starcoder
path.go Description: Objects which are finite path fragments. */ package sequences import ( "fmt" mc "github.com/kwesiRutledge/ModelChecking" ) /* Type Declarations */ type FinitePathFragment struct { s []mc.TransitionSystemState } type InfinitePathFragment struct { UniquePrefix FinitePathFragment Repeati...
sequences/path.go
0.743075
0.415136
path.go
starcoder
This provides support for local-data persistent volumes, by two means: * Removes volumes using "local-data" from the internal pods copy, for the duration of the current autoscaler RunOnce loop. local-data volumes (as any volume using a no-provisioner storage class) breaks the VolumeBinding predicate use...
cluster-autoscaler/processors/datadog/pods/transform_local_data.go
0.677154
0.478773
transform_local_data.go
starcoder
// A Paillier implementation in Go with some optimizations. // This includes choosing g = n + 1. More documentation required. package paillier import ( "crypto/rand" "math/big" ) var bigZero = big.NewInt(0) var bigOne = big.NewInt(1) // Encrypter is an interface for additively homomorphic encryption schemes. typ...
paillier.go
0.763748
0.484624
paillier.go
starcoder
package consumer // Bool represents a function that accepts a bool. type Bool func(bool) // Int represents a function that accepts a int. type Int func(int) // Int8 represents a function that accepts a int8. type Int8 func(int8) // Int16 represents a function that accepts a int16. type Int16 func(int16) // Int32 r...
functional/consumer/consumer.go
0.631822
0.612397
consumer.go
starcoder
package axes // label.go contains code that calculates the positions of labels on the axes. import ( "fmt" "image" "github.com/mum4k/termdash/align" "github.com/mum4k/termdash/internal/alignfor" ) // LabelOrientation represents the orientation of text labels. type LabelOrientation int // String implements fmt...
widgets/linechart/internal/axes/label.go
0.934001
0.697892
label.go
starcoder
package iso20022 // Details of the securities trade. type SecuritiesTradeDetails55 struct { // Market in which a trade transaction has been executed. PlaceOfTrade *PlaceOfTradeIdentification1 `xml:"PlcOfTrad,omitempty"` // Infrastructure which may be a component of a clearing house and wich facilitates clearing a...
SecuritiesTradeDetails55.go
0.830044
0.431405
SecuritiesTradeDetails55.go
starcoder
package fields import ( "time" "go.uber.org/zap" "go.uber.org/zap/zapcore" ) // Object is a wrappers of zap.Object. func Object(key string, val zapcore.ObjectMarshaler) zap.Field { return zap.Object(key, val) } // Bool is a wrappers of zap.Bool. func Bool(key string, val bool) zap.Field { return zap.Bool(key, ...
fields/wrappers.go
0.813609
0.461017
wrappers.go
starcoder
package extractor import ( "errors" "fmt" "sync" ) // Collector acts as an N fanout pipe from an extractor to receivers. It also simplifies collection by abstracting channel complexity type Collector struct { // Extractor is expected to pass candlesticks and errors over their respective channels Extractor Collec...
extractor/collector.go
0.795181
0.4165
collector.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...
transform/tomap.go
0.592549
0.46132
tomap.go
starcoder
package statistics import ( "encoding/binary" types "github.com/zhukovaskychina/xmysql-server/server/innodb/basic" "github.com/zhukovaskychina/xmysql-server/server/mysql" "math" ) // calcFraction is used to calculate the fraction of the interval [lower, upper] that lies within the [lower, value] // using the con...
server/innodb/statistics/scalar.go
0.802594
0.499329
scalar.go
starcoder
package hash import ( "fmt" "math/big" "math/rand" "reflect" "github.com/ethereum/go-ethereum/common" "github.com/ethereum/go-ethereum/common/hexutil" ) const ( // HashLength is the expected length of the hash HashLength = 32 ) var ( // Zero is an empty hash. Zero = Hash{} hashT = reflect.TypeOf(Hash{})...
hash/hash.go
0.778649
0.459379
hash.go
starcoder
package modulation import ( "fmt" "math" "math/rand" "github.com/Hunter-Dolan/midrange/options" ) type Modulator struct { Options *options.Options carrierCount int carrierSpacing float64 data *[]bool dataLength int frameCount int frameIndex int CachedWave *[]float64 } func (m *Modulator) SetData(...
modulation/modulator.go
0.677901
0.421909
modulator.go
starcoder
package rgba4444 import ( "image" "image/color" ) // Image is an in-memory image whose At method returns rgba4444.Color values. type Image struct { // (x, y) starts at Pix[(y-Rect.Min.Y)*Stride + (x-Rect.Min.X)*2]. Pix []uint8 // Stride is the Pix stride (in bytes) between vertically adjacent pixels. Stride int...
image.go
0.811078
0.517937
image.go
starcoder
// Package pktline reads and writes the pkt-line format described in // https://git-scm.com/docs/protocol-common#_pkt_line_format. package pktline import ( "encoding/hex" "fmt" "io" ) // MaxSize is the maximum number of bytes permitted in a single pkt-line. const MaxSize = 65516 // Type indicates the type of a p...
internal/pktline/pktline.go
0.696681
0.467332
pktline.go
starcoder
package oak import ( "image" "image/draw" ) // A Background can be used as a background draw layer. Backgrounds will be drawn as the first // element in each frame, and are expected to cover up data drawn on the previous frame. type Background interface { GetRGBA() *image.RGBA } // DrawLoop // Unless told to stop...
drawLoop.go
0.631367
0.482185
drawLoop.go
starcoder
package chapter3 import ( "fmt" ) /* Three in One: Describe how you could use a single array to implement three stacks. Hint #2: A stack is simply a data structure in which the most recently added elements are removed first. Can you simulate a single stack using an array? Remember that there are many poss...
chapter3/q3.1.go
0.788339
0.804291
q3.1.go
starcoder
package merkle import ( "bytes" "crypto/sha256" "github.com/33cn/chain33/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 following merkle tree algorithm has a serious flaw related to duplicate txi...
vendor/github.com/33cn/chain33/common/merkle/merkle.go
0.510496
0.507202
merkle.go
starcoder
package gglm import ( "fmt" ) var _ Mat = &Mat2{} var _ fmt.Stringer = &Mat2{} type Mat2 struct { Data [2][2]float32 } func (m *Mat2) Get(row, col int) float32 { return m.Data[col][row] } func (m *Mat2) Set(row, col int, val float32) { m.Data[col][row] = val } func (m *Mat2) Size() MatSize { return MatSize2x...
gglm/mat2.go
0.629547
0.486941
mat2.go
starcoder
package errorx // Trait is a static characteristic of an error type. // All errors of a specific type possess exactly the same traits. // Traits are both defined along with an error and inherited from a supertype and a namespace. type Trait struct { id uint64 label string } // RegisterTrait declares a new distin...
vendor/github.com/joomcode/errorx/trait.go
0.856347
0.586286
trait.go
starcoder