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 ipdpsugar import ( "fmt" "math" "strconv" "time" ) type valueType uint8 const ( valueTypeUnset = iota valueTypeTime valueTypeI64 valueTypeF64 valueTypeU64 valueTypeString valueTypeBool valueTypeBytes valueTypeTag valueTypeFieldInt valueTypeFieldFloat valueTypeFieldUint valueTypeFieldString...
golang/ipdpsugar/value.gen.go
0.68721
0.419826
value.gen.go
starcoder
package graphics import ( "image" "image/color" "os" "github.com/fogleman/gg" ) // Pattern is a fill pattern type Pattern struct { Type string Color color.RGBA PatternFileName string } // Center returns the center point of a given rectangle func Center(rect image.Rectangle) image.Point {...
pkg/graphics/graphics.go
0.880052
0.536677
graphics.go
starcoder
// Example - Demonstrates debug camera. Use "t" to toggle camera modes. package main import ( "image" "log" "math" "azul3d.org/engine/gfx" "azul3d.org/engine/gfx/camera" "azul3d.org/engine/gfx/gfxutil" "azul3d.org/engine/gfx/window" "azul3d.org/engine/keyboard" "azul3d.org/engine/lmath" "azul3d.org/exampl...
examples/azul3d_debug_camera/azul3d_debug_camera.go
0.795618
0.553324
azul3d_debug_camera.go
starcoder
package recipe import ( "github.com/df-mc/dragonfly/server/item" "github.com/df-mc/dragonfly/server/world" ) // Recipe is implemented by all recipe types. type Recipe interface { // Input returns the items required to craft the recipe. Input() []item.Stack // Output returns the items that are produced when the r...
server/item/recipe/recipe.go
0.781914
0.429788
recipe.go
starcoder
package approximation import ( "fmt" "math" "strconv" "strings" ) func CreateMatrixS(x []float64, m int) [][]float64 { s := 2 * m var sk []float64 for k := 0; k <= s; k++ { var rec float64 for i := 0; i < len(x); i++ { rec += math.Pow(x[i], float64(k)) } sk = append(sk, rec) } sMatrix := make([]...
approximation/approximation.go
0.577257
0.452657
approximation.go
starcoder
package lowrider // http://infinispan.org/docs/8.0.x/user_guide/user_guide.html#_hot_rod_protocol_2_4 /*********************************************************** * Data Types * * All key and values are sent and stored as byte arrays. * Hot Rod makes no assumptions about their types. * * vInt: Variable-length i...
spec.go
0.667906
0.451508
spec.go
starcoder
package main import ( "aoc2021/utils" "fmt" "strconv" ) type Point struct { x, y int } type Grid struct { grid map[Point]int maxX, maxY int } func (p Point) translate(dx, dy int) Point { return Point{p.x + dx, p.y + dy} } func (g *Grid) tick(flashed utils.Set[Point], p Point) int64 { // first, increm...
daphillips/11/day11.go
0.564579
0.467089
day11.go
starcoder
package main import ( "github.com/shasderias/ilysa" "github.com/shasderias/ilysa/chroma" "github.com/shasderias/ilysa/colorful" "github.com/shasderias/ilysa/colorful/gradient" "github.com/shasderias/ilysa/context" "github.com/shasderias/ilysa/ease" "github.com/shasderias/ilysa/evt" "github.com/shasderias/ilysa...
examples/magnet/verse_c.go
0.602646
0.40539
verse_c.go
starcoder
package colours import "math" // LAB Colour type LAB struct { L, A, B float64 } // Converts a LAB colour to XYZ func (lab *LAB) XYZ() *XYZ { x := Xn * finv(((lab.L+16)/116)+(lab.A/500)) y := Yn * finv((lab.L+16)/116) z := Zn * finv(((lab.L+16)/116)-(lab.B/200)) return &XYZ{x, y, z} } // Converts a LAB colour ...
pkg/colours/lab.go
0.735831
0.401482
lab.go
starcoder
package impl var magicBytes = []byte{0x27, 0x24, 0x50} const ( hasPrefixedLengthBit byte = 0x1 isEmptyBit = 0x2 ) // ProtocolType represents a known type that may be transferred using Ludwieg type ProtocolType byte const ( // TypeUnknown represents an unknown type, often used as the zero-value of ...
impl/types.go
0.641647
0.575499
types.go
starcoder
package dispatch import ( "errors" "fmt" "net/url" "strings" "time" "github.com/go-humble/detect" "github.com/gopherjs/gopherjs/js" "github.com/influx6/faux/pattern" ) //============================================================================== // PathDirective represent the current path and hash values...
dispatch/path.go
0.760028
0.45641
path.go
starcoder
package geom import "math" // Area returns the area of p. The function works correctly for polygons with // holes, regardless of the winding order of the holes, but will give the wrong // result for self-intersecting polygons. func (p Polygon) Area() float64 { a := 0. // Calculate the bounds of all the rings. bou...
area.go
0.800848
0.565359
area.go
starcoder
package datalist import ( "bytes" "encoding" "fmt" "time" _ "time/tzdata" "github.com/go-courier/sqlx/v2/builder" sqlxDatatypes "github.com/go-courier/sqlx/v2/datatypes" ) // openapi:strfmt date-time-or-range type DateTimeOrRange struct { From sqlxDatatypes.Timestamp To sqlxDatatypes.Timestamp ValueOrRan...
testdata/datalist/datatime_range.go
0.605099
0.407216
datatime_range.go
starcoder
package adsbtype import ( "fmt" ) // TYPE is the extended squitter type. type TYPE uint64 // Extended squitter type values. const ( TYPE0 TYPE = 0 // No position information TYPE1 TYPE = 1 // Identification (Category Set D) TYPE2 TYPE = 2 // Identification (Category Set C) TYPE3 TYPE = 3 // Identificat...
adsbtype/es.go
0.562417
0.410106
es.go
starcoder
package main import ( "bufio" "fmt" "os" "strconv" "strings" ) type Atom interface { Cell Float() float64 Int() int64 Status() int64 Greater(c Cell) bool Less(c Cell) bool Add(c Cell) Atom Multiply(c Cell) Atom } type Cell interface { Bool() bool String...
cell.go
0.733261
0.413773
cell.go
starcoder
package vector // Dedup removes the duplicate contiguous elements, e.g. // [1, 2, 2, 2, 3, 3, 4] // dedup to: // [1, 2, 3, 4] // but for [1, 2, 3, 2, 3, 2] // dedup has no effect func Dedup[T comparable](vec Vector[T]) Vector[T] { if vec.Size() < 2 { return vec } newVec := WithCapacity[T](vec.Capacity() - 1) new...
pkg/vector/dedup.go
0.778018
0.595257
dedup.go
starcoder
package main import ( "github.com/gen2brain/raylib-go/physics" "github.com/gen2brain/raylib-go/raylib" ) func main() { screenWidth := int32(800) screenHeight := int32(450) raylib.SetConfigFlags(raylib.FlagMsaa4xHint) raylib.InitWindow(screenWidth, screenHeight, "Physac [raylib] - physics demo") // Physac log...
examples/physics/physac/demo/main.go
0.656988
0.460471
main.go
starcoder
package onshape import ( "encoding/json" ) // BTBodyTypeFilter112 struct for BTBodyTypeFilter112 type BTBodyTypeFilter112 struct { BTQueryFilter183 BodyType *string `json:"bodyType,omitempty"` BtType *string `json:"btType,omitempty"` } // NewBTBodyTypeFilter112 instantiates a new BTBodyTypeFilter112 object // Th...
onshape/model_bt_body_type_filter_112.go
0.66454
0.575916
model_bt_body_type_filter_112.go
starcoder
package mab import ( "context" ) // A Bandit gets reward values from a RewardSource, computes selection probabilities using a Strategy, and selects // an arm using a Sampler. type Bandit struct { RewardSource Strategy Sampler } // SelectArm gets the current reward estimates, computes the arm selection probabilit...
bandit.go
0.910406
0.756447
bandit.go
starcoder
package graphics import ( "image/color" "janrobas/spacefetcher/constants" "math" "github.com/hajimehoshi/ebiten" "github.com/hajimehoshi/ebiten/ebitenutil" "github.com/hajimehoshi/ebiten/text" ) func makeShipVertex(x float32, y float32, w float32, h float32, ox float32, oy float32, rotation float32) ebiten.Ver...
graphics/game.go
0.789234
0.566678
game.go
starcoder
package fraud import ( "bytes" "errors" "fmt" "github.com/tendermint/tendermint/pkg/consts" "github.com/tendermint/tendermint/pkg/wrapper" "github.com/celestiaorg/celestia-node/ipld/plugin" "github.com/celestiaorg/rsmt2d" pb "github.com/celestiaorg/celestia-node/fraud/pb" "github.com/celestiaorg/celestia-...
fraud/bad_encoding.go
0.61173
0.437463
bad_encoding.go
starcoder
package matchers import ( "bytes" ) // Class matches an java class file. func Class(in []byte) bool { return len(in) > 4 && bytes.Equal(in[:4], []byte{0xCA, 0xFE, 0xBA, 0xBE}) } // Swf matches an Adobe Flash swf file. func Swf(in []byte) bool { return len(in) > 3 && bytes.Equal(in[:3], []byte("CWS")) || bytes...
internal/matchers/binary.go
0.617513
0.529446
binary.go
starcoder
package rbtree import ( "golang.org/x/exp/constraints" ) type color byte const ( black color = iota red ) // Node interface represents an entry in the tree. type Node[K constraints.Ordered, V any] interface { // Key returns the key for the node in the tree. Key() K // Value returns the values associated with ...
pkg/container/rbtree/rbtree.go
0.784938
0.438545
rbtree.go
starcoder
package prodos import ( "os" ) func ReadVolumeBitmap(file *os.File) []byte { headerBlock := ReadBlock(file, 2) volumeHeader := parseVolumeHeader(headerBlock) totalBitmapBytes := volumeHeader.TotalBlocks / 8 if volumeHeader.TotalBlocks%8 > 0 { totalBitmapBytes++ } bitmap := make([]byte, totalBitmapBytes) ...
prodos/bitmap.go
0.583441
0.48987
bitmap.go
starcoder
package collections import ( "fmt" "reflect" ) // FnMapperList define how you should implement a correct mapper for Listype type FnMapperList func(interface{}, int) (interface{}, interface{}) // FnMapperMap define how you should implement a correct mapper for MapType type FnMapperMap func(interface{}, interface{}...
collections/collection.go
0.511229
0.46035
collection.go
starcoder
package crypto import ( "crypto/sha256" "encoding/base64" ) var iv = []byte{0xe8, 0x30, 0x09, 0x4b, 0x97, 0x20, 0x5d, 0x2a} var sigmaWords = []uint32{ 0x61707865, 0x3320646e, 0x79622d32, 0x6b206574, } // SalsaStream is a Salsa20 cipher that implements CryptoStream interface type SalsaStream struct { State ...
crypto/salsa.go
0.559531
0.443661
salsa.go
starcoder
package plaid import ( "encoding/json" ) // CustomerInitiatedReturnRisk The object contains a risk score and a risk tier that evaluate the transaction return risk of an unauthorized debit. Common return codes in this category include: “R05”, \"R07\", \"R10\", \"R11\", \"R29\". These returns typically have a return ...
plaid/model_customer_initiated_return_risk.go
0.803829
0.615983
model_customer_initiated_return_risk.go
starcoder
package binarytree import ( queue "github.com/karbica/go-field-notes/queues/arrayqueue" ) // Tree holds the state of a tree. type Tree struct { root *Node size int } // Node holds the state of a node. type Node struct { Key int Value interface{} Left *Node Right *Node } // NewTree returns a new instance o...
trees/binarytree/binarytree.go
0.818483
0.474692
binarytree.go
starcoder
package blocks import ( "fmt" "github.com/mrcook/retroio/spectrum/tap" "github.com/mrcook/retroio/spectrum/tzx/blocks/types" "github.com/mrcook/retroio/storage" ) // LoopStart // ID: 24h (36d) // If you have a sequence of identical blocks, or of identical groups of blocks, you can use // this block to tell how m...
spectrum/tzx/blocks/loop.go
0.691914
0.429669
loop.go
starcoder
package rosetta import ( "regexp" "strconv" "strings" "time" ) var ( // ArgumentsRegex defines regex arguments should match. ArgumentsRegex = regexp.MustCompile("(\"[^\"]+\"|[^\\s]+)") // UserMentionRegex defines regex user mention should match. UserMentionRegex = regexp.MustCompile(`<@!?(\d+)>`) // RoleM...
pkg/rosetta/arguments.go
0.723212
0.435001
arguments.go
starcoder
package td import ( "context" "log" "net/url" "strconv" "time" ) type PeriodType string const ( DayPeriod = PeriodType("day") MonthPeriod = PeriodType("month") YearPeriod = PeriodType("year") YearToDatePeriod = PeriodType("ytd") ) type FrequencyType string const ( MinuteFrequency = Fre...
pricehistory.go
0.7181
0.539287
pricehistory.go
starcoder
package curve25519 // FieldElement32 represents an element of the field GF(2^255 - 19). An element // t, entries t[0]...t[9], represents the integer t[0]+2^26 t[1]+2^51 t[2]+2^77 // t[3]+2^102 t[4]+...+2^230 t[9]. Bounds on each t[i] vary depending on // context. type FieldElement32 [10]int32 // FieldElement64 repre...
privacy/operation/curve25519/common_fe.go
0.511229
0.630116
common_fe.go
starcoder
package gofair import "time" // EventType describes the type of event e.g. Football. type EventType struct { ID string `json:"id"` Name string `json:"name"` } // EventTypeResult is returned by a call to listEventTypes. (https://docs.developer.betfair.com/display/1smk3cen4v3lu3yomq5qye0ni/listEventTypes) type Eve...
typedefs.go
0.70304
0.42185
typedefs.go
starcoder
package spt // GLSL-like functions to make translation easier. Wait... I know what // would help here! Generics! We should ask the Go team for those. /s import ( "math" ) var ( Zero2 = Vec2{} Zero3 = Vec3{} X2 = Vec2{X: 1} Y2 = Vec2{Y: 1} X3 = Vec3{X: 1} Y3 = Vec3{Y: 1} Z3 = Vec3{Z: 1} ) func...
glsl-ish.go
0.827793
0.649912
glsl-ish.go
starcoder
package cerebro import ( "fmt" "github.com/vrecan/cerebro/graph" ) // DirectedGraph implements a generalized directed graph. type DirectedGraph struct { nodes map[string]graph.Node from map[string]map[string]graph.Edge to map[string]map[string]graph.Edge weight, absent float64 } //NewDirectedGraph creates...
directed.go
0.753739
0.474996
directed.go
starcoder
package chrono import ( "database/sql/driver" "errors" "fmt" "time" ) // Time is used to save and output ISO8601 date time with time zone set to UTC. type Time struct { time.Time } // StringEN produces the string representation in English with locale set to UTC. func (t Time) StringEN() string { return t.In(ti...
chrono/time.go
0.833019
0.482063
time.go
starcoder
package model import "math" // Node stores all information about nodes like neighboring edges, rewards and if it's revisitable. type Node struct { fromEdges []*Edge toEdges []*Edge id string rewards map[*Reward]int minPathLeft int revisitable bool } // FromEdges returns all edges which has t...
model/node.go
0.841435
0.516717
node.go
starcoder
package main import ( "math" "math/rand" "time" "github.com/veandco/go-sdl2/sdl" ) /* It is not easy, to create this file to follow only one function set. Let's say: tank.moveForward(angle float64) -> this seems to be taking the tank pointer, and change it's angle. But in my case, it will take a value receiver,...
tank.go
0.594198
0.456107
tank.go
starcoder
package gridlocator import ( "math" "strconv" "strings" "github.com/pkg/errors" ) // Coordinates contains latitude and longitude. type Coordinates struct { Latitude float64 `json:"latitude"` Longitude float64 `json:"longitude"` } // Convert converts the specified latitude and longitude into the six // digit ...
grid.go
0.771715
0.438845
grid.go
starcoder
package v1 // Equal returns true when both objects have the same values. func (s *PowerState) Equal(o *PowerState) bool { return s.GetEnabled() == o.GetEnabled() } // Equal returns true when both objects have the same values. func (s *Power) Equal(o *Power) bool { return s.GetRequest().Equal(o.GetRequest()) && s...
apis/v1/types_equal.go
0.857679
0.466724
types_equal.go
starcoder
package util import ( "fmt" "os" "time" "strings" "github.com/sirupsen/logrus" ) // FlawLevel states the importance of a validation error. // The levels also states in which step the validation should be fixed. type FlawLevel int const ( // UndefinedFlaw was not defined by the programmer. UndefinedFlaw Flaw...
pkg/util/validation.go
0.589716
0.42179
validation.go
starcoder
package main func main() { tree := &Tree{} keys := []int{10, 5, 15, 3, 7, 18} for _, k := range keys { tree.Insert(k) } println(tree.RangeSum(tree.root, 7, 15)) // println(tree.FindMin()) // println(tree.FindMax()) // println(tree.Find(-1)) // println(tree.Find(0)) // tree.Inorder(tree.root) } //Node is a...
bst/bst.go
0.541651
0.440409
bst.go
starcoder
package ast // Node is the interface for all nodes in an abstract syntax tree. type Node interface { // Nullable(n) is true for a node n if and only if the subexpression represented by n has ε in its language. Nullable() bool // FirstPos(n) is the set of positions in the subtree rooted at n that // correspond to ...
internal/regex/ast/ast.go
0.736306
0.621168
ast.go
starcoder
package gfx import ( "image" "image/color" "image/draw" "golang.org/x/image/font" "golang.org/x/image/font/basicfont" "golang.org/x/image/math/fixed" ) // clearFunc is an optional, OS optimized clear function var clearFunc func(ctx *Context) bool // Context provides primitive drawing operations on a draw.Imag...
gfx/context.go
0.725454
0.435181
context.go
starcoder
package xy import ( "github.com/twpayne/go-geom" "github.com/twpayne/go-geom/xy/internal" ) // LinesCentroid computes the centroid of all the LineStrings provided as arguments. // // Algorithm: Compute the average of the midpoints of all line segments weighted by the segment length. func LinesCentroid(lin...
xy/line_centroid.go
0.77907
0.432423
line_centroid.go
starcoder
package schemax /* methlab.go deals with labels that are assigned to methods and stored in lookup maps. For example, `USAGE` for Usage. What, exactly, were you expecting? */ /* parseMeth is the first class function bearing a signature shared by all fundamental parser methods. */ type parseMeth func(string) ([]string...
methlab.go
0.891734
0.541954
methlab.go
starcoder
package nifi import ( "encoding/json" ) // PositionDTO struct for PositionDTO type PositionDTO struct { // The x coordinate. X *float64 `json:"x,omitempty"` // The y coordinate. Y *float64 `json:"y,omitempty"` } // NewPositionDTO instantiates a new PositionDTO object // This constructor will assign default val...
model_position_dto.go
0.846895
0.458712
model_position_dto.go
starcoder
package typed import ( "fmt" yaml "gopkg.in/yaml.v2" "sigs.k8s.io/structured-merge-diff/v4/schema" "sigs.k8s.io/structured-merge-diff/v4/value" ) // YAMLObject is an object encoded in YAML. type YAMLObject string // Parser implements YAMLParser and allows introspecting the schema. type Parser struct { Schema s...
vendor/sigs.k8s.io/structured-merge-diff/v4/typed/parser.go
0.764012
0.446253
parser.go
starcoder
package gaia import ( "fmt" "github.com/globalsign/mgo/bson" "github.com/mitchellh/copystructure" "go.aporeto.io/elemental" ) // NamespaceInfoPUIncomingTrafficActionValue represents the possible values for attribute "PUIncomingTrafficAction". type NamespaceInfoPUIncomingTrafficActionValue string const ( // Na...
namespaceinfo.go
0.756088
0.467089
namespaceinfo.go
starcoder
package golis import ( "fmt" "gonum.org/v1/gonum/mat" ) // guarantee SparseMatrix have interface of gonum.mat.Matrix var _ mat.MutableSymmetric = (*SparseMatrixSymmetric)(nil) // SparseMatrixSymmetric is struct of sparse matrix type SparseMatrixSymmetric struct { s *SparseMatrix } // NewSparseMatrixSymmetric re...
sparse_symmetric.go
0.862294
0.532121
sparse_symmetric.go
starcoder
package iso20022 // Order to invest the investor's principal in an investment fund. type SubscriptionOrder5 struct { // Unique and unambiguous identifier for an order, as assigned by the instructing party. OrderReference *Max35Text `xml:"OrdrRef"` // Unique and unambiguous investor's identification of an order. T...
SubscriptionOrder5.go
0.805058
0.451206
SubscriptionOrder5.go
starcoder
package numrange import ( "github.com/steinarvk/heisenlisp/numcmp" "github.com/steinarvk/heisenlisp/types" ) type Range struct { lowerBound types.Numeric upperBound types.Numeric lowerBoundInclusive bool upperBoundInclusive bool } func (r *Range) LowerBound() types.Numeric { return r.lowerBou...
numrange/numrange.go
0.646795
0.523055
numrange.go
starcoder
package main import ( "fmt" "image" "image/color" "image/font" "math" "math/rand" "os" "time" "github.com/llgcode/draw2d/draw2dimg" "github.com/llgcode/draw2d/draw2dkit" ) // set constants ('E' is a math const; remove '/rand' on import when using) const ( NUMINPUTNODES = 2 NUMHIDDENNODES = 2 NUMOUTPUTN...
shaffer.go
0.592784
0.578627
shaffer.go
starcoder
package oss import ( "hash" "hash/crc64" ) // digest represents the partial evaluation of a checksum. type digest struct { crc uint64 tab *crc64.Table } // NewCRC creates a new hash.Hash64 computing the CRC-64 checksum // using the polynomial represented by the Table. func NewCRC(tab *crc64.Table, init uint64) h...
vendor/github.com/aliyun/aliyun-oss-go-sdk/oss/crc.go
0.827689
0.42662
crc.go
starcoder
package iso20022 // Details of the closing of the securities financing transaction. type SecuritiesFinancingTransactionDetails29 struct { // Unambiguous identification of the underlying securities financing trade as assigned by the instructing party. The identification is common to all collateral pieces (one or many...
SecuritiesFinancingTransactionDetails29.go
0.826887
0.419707
SecuritiesFinancingTransactionDetails29.go
starcoder
package view import ( "context" "fmt" "log" "os" "github.com/gdamore/tcell/v2" "github.com/rclone/rclone/fs" "github.com/rclone/rclone/fs/filter" "github.com/rclone/rclone/fs/operations" "github.com/rclone/rclone/fs/sync" "github.com/rclone/rclone/fs/walk" "github.com/rivo/tview" ) const ( Local = "local...
pkg/view/view.go
0.560854
0.425844
view.go
starcoder
package utils import ( "github.com/valyala/fasthttp" "time" ) func GetFirstDateOfWeek(now time.Time) time.Time { offset := int(time.Monday - now.Weekday()) if offset > 0 { offset = -6 } return time.Date(now.Year(), now.Month(), now.Day(), 0, 0, 0, 0, time.Local).AddDate(0, 0, offset) } func GetLastWeekFirs...
extend/utils/time.go
0.641647
0.445107
time.go
starcoder
package common import ( "context" "errors" "fmt" "github.com/sirupsen/logrus" ) // ExecutorData is an empty interface representing free-form data // executor will use. Meant to be casted, e.g. virtual machine details. type ExecutorData interface{} // ExecutorCommand stores the script executor will run on a give...
common/executor.go
0.614857
0.421969
executor.go
starcoder
package lzma // Constants used by the distance codec. const ( // minimum supported distance minDistance = 1 // maximum supported distance, value is used for the eos marker. maxDistance = 1 << 32 // number of the supported len states lenStates = 4 // start for the position models startPosModel = 4 // first in...
vendor/github.com/ulikunitz/xz/lzma/distcodec.go
0.648466
0.53607
distcodec.go
starcoder
package geo import ( "math" ) const ( earthRadius = 6371e3 radians = math.Pi / 180 degrees = 180 / math.Pi piR = math.Pi * earthRadius twoPiR = 2 * piR ) // Haversine ... func Haversine(latA, lonA, latB, lonB float64) float64 { φ1 := latA * radians λ1 := lonA * radians φ2 := latB * rad...
geo/geo.go
0.865736
0.602793
geo.go
starcoder
package mongodb import ( "math" "time" "github.com/eroatta/src-reader/entity" ) // insightMapper maps an entity.Insight between its model and database representations. type insightMapper struct{} // toDTO maps the entity for entity.Insight into a Data Transfer Object. func (im *insightMapper) toDTO(ent entity.In...
port/outgoing/adapter/repository/mongodb/insight_mapper.go
0.662469
0.407216
insight_mapper.go
starcoder
package leabra import ( "fmt" "reflect" ) // leabra.Synapse holds state for the synaptic connection between neurons type Synapse struct { Wt float32 `desc:"synaptic weight value -- sigmoid contrast-enhanced"` LWt float32 `desc:"linear (underlying) weight value -- learns according to the lrate specified in...
leabra/synapse.go
0.578924
0.469703
synapse.go
starcoder
package binarytrees import "github.com/soheltarir/gollections/lists" // TreeIterations lists methods to iterate through a binary tree. type TreeIterations interface { // BreadthFirstTraverse returns an iterator pointing to the root of the binary tree. The iterator is // initialised in such a way that subsequent ite...
trees/binarytrees/iterators.go
0.833934
0.59305
iterators.go
starcoder
package triangle import ( "github.com/adamcolton/geom/d2" ) /* Given triangles A and B, the matrix transformation is: | k l m | | Ax | | Bx | | k*Ax + l*Ay + m | | n p q | * | Ay | = | By | = | n*Ax + p*Ay + q | | 1 | ---- Finding k,l,m ---- Bx = k*Ax + l*Ay + m Bx - k*Ax - l*Ay = m B0x - k*A0x ...
d2/shape/triangle/transform.go
0.594787
0.525308
transform.go
starcoder
package influxql import ( "bytes" "encoding/binary" "io" "sort" "github.com/gogo/protobuf/proto" internal "github.com/influxdata/influxdb/influxql/internal" ) // ZeroTime is the Unix nanosecond timestamp for time.Time{}. const ZeroTime = int64(-6795364578871345152) // Point represents a value in a series that...
go/src/github.com/influxdata/influxdb/influxql/point.go
0.713731
0.503662
point.go
starcoder
package gm32 import ( "fmt" "strings" "text/tabwriter" ) type Mat2 [4]float32 func (m1 Mat2) Add(m2 Mat2) Mat2 { return Mat2{ m1[0] + m2[0], m1[1] + m2[1], m1[2] + m2[2], m1[3] + m2[3], } } func (m1 Mat2) Sub(m2 Mat2) Mat2 { return Mat2{ m1[0] - m2[0], m1[1] - m2[1], m1[2] - m2[2], m1[3] - m2[3], } }...
gm32/common_mats.go
0.548432
0.691888
common_mats.go
starcoder
package clustering import ( "fmt" "strings" "go.chromium.org/luci/common/errors" ) // MaxClusterIDBytes is the maximum number of bytes the algorithm-determined // cluster ID may occupy. This is the raw number of bytes; if the ID is hex- // encoded (e.g. for use in a BigQuery table), its length in characters may ...
go/src/infra/appengine/weetbix/internal/clustering/clusterid.go
0.704058
0.429609
clusterid.go
starcoder
package Packets import ( "errors" "github.com/brokenbydefault/Nanollet/Block" "io" ) // NetworkType is a one-byte which defines the network which is connected to, such as Live or Test. type NetworkType byte const ( Test NetworkType = iota + 65 Beta Live ) // MessageType is one-byte which says what type of mes...
Node/Packets/header.go
0.521715
0.455501
header.go
starcoder
package orderbook import ( decimal "github.com/geseq/udecimal" ) //go:generate gotemplate "github.com/geseq/redblacktree" tree(udecimal.Decimal,*orderQueue) // priceLevel implements facade to operations with order queue type priceLevel struct { priceTree *tree priceType PriceType volume decimal.Decimal numO...
pricelevel.go
0.705176
0.430387
pricelevel.go
starcoder
package ginkgo import ( "github.com/onsi/ginkgo/v2/internal" ) /* Offset(uint) is a decorator that allows you to change the stack-frame offset used when computing the line number of the node in question. You can learn more here: https://onsi.github.io/ginkgo/#the-offset-decorator You can learn more about decorators...
vendor/github.com/onsi/ginkgo/v2/decorator_dsl.go
0.797911
0.446917
decorator_dsl.go
starcoder
package twelve const testVersion = 1 // Song returns complete song. func Song() string { var s string for i := 1; i <= 12; i++ { s += Verse(i) + "\n" } return s } // Verse return specific song's verse. func Verse(i int) string { switch i { case 1: return "On the first day of Christmas my true love gave to ...
twelve-days/twelve_days.go
0.540196
0.499512
twelve_days.go
starcoder
// Package checks contains checks for differentially private functions. package checks import ( "fmt" "math" log "github.com/golang/glog" ) // CheckEpsilonVeryStrict returns an error if ε is +∞ or less than 2⁻⁵⁰. func CheckEpsilonVeryStrict(label string, epsilon float64) error { if epsilon < math.Exp2(-50.0) ||...
go/checks/checks.go
0.864454
0.571767
checks.go
starcoder
package assert import ( "fmt" "reflect" "strings" utils2 "github.com/ppapapetrou76/go-testing/internal/pkg/utils" "github.com/ppapapetrou76/go-testing/types" "github.com/r3labs/diff/v2" ) func shouldBeEqual(actual types.Assertable, expected interface{}) string { diffMessage := strings.Builder{} skipDetailedD...
assert/error_messages.go
0.710829
0.626496
error_messages.go
starcoder
package comm import ( "encoding/json" "reflect" ) //MatchComparator takes a left and right element and compare them. //In case of matching true is returned, false otherwise type MatchComparator func(l interface{}, r interface{}) bool //ListCompare compare two lists and returns the first non matching item of the su...
comm/utils.go
0.717111
0.435841
utils.go
starcoder
package magick // #include <magick/api.h> // #include "bridge.h" // #include "resize.h" import "C" import ( "fmt" ) type Filter C.FilterTypes const ( FPoint Filter = C.PointFilter FBox Filter = C.BoxFilter FTriangle Filter = C.TriangleFilter FHermite Filter = C.HermiteFilter FHanning Filter = C...
resize.go
0.847242
0.411406
resize.go
starcoder
package backup import ( "io" "github.com/pierrec/lz4" "github.com/ulikunitz/xz" "github.com/zero-os/0-Disk/errors" ) const ( // LZ4Compression represents the LZ4 Compression Type, // and is also the Default (nil) value of the Compression Type. // See https://github.com/pierrec/lz4 for more information. LZ4Co...
nbd/ardb/backup/compress.go
0.792223
0.548613
compress.go
starcoder
// Implements FM-Index (https://en.wikipedia.org/wiki/FM-index), // full-text substring index based on the Burrows-Wheeler transform. // One should use "index/suffixarray" pkg package bwt import ( "container/heap" "unicode/utf8" ) func New(data interface{}, maxDepth int) *Index { var LastCol, SuffixArr = BWT(data...
bwt.go
0.560493
0.403097
bwt.go
starcoder
package binary import ( "container/list" ) // Element is an element of a binary tree. type Element struct { // Left and right pointers in binary tree. left, right *Element // The value stored with this element. Value interface{} } func NewElement(v interface{}) *Element { e := new(Element) e.Value = v retur...
Ch4Tree/binary/binary.go
0.829043
0.405154
binary.go
starcoder
package bulletproofs import ( "fmt" "github.com/dat-incognito-org/newbp/operation" "github.com/incognitochain/incognito-chain/privacy/privacy_util" ) // ConvertIntToBinary represents a integer number in binary func ConvertUint64ToBinary(number uint64, n int) []*operation.Scalar { if number == 0 { res := make([...
bulletproofs/bulletproofs_helper.go
0.578329
0.507934
bulletproofs_helper.go
starcoder
package zboxutil import "math/bits" type Uint128 struct { high uint64 low uint64 } func NewUint128(x uint64) Uint128 { return Uint128{low: x} } // Add returns x+y. func (x Uint128) Add(y Uint128) Uint128 { low, carry := bits.Add64(x.low, y.low, 0) high, carry := bits.Add64(x.high, y.high, carry) if carry != ...
zboxcore/zboxutil/uint128.go
0.787646
0.431524
uint128.go
starcoder
package circonusgometrics import ( "sync" "time" "github.com/circonus-labs/circonusllhist" "github.com/pkg/errors" ) // Histogram measures the distribution of a stream of values. type Histogram struct { name string hist *circonusllhist.Histogram rw sync.RWMutex } // TimingWithTags adds a value to a histog...
vendor/github.com/circonus-labs/circonus-gometrics/v3/histogram.go
0.779196
0.595434
histogram.go
starcoder
package main const SampleStr = `Before: [0, 1, 2, 1] 14 1 3 3 After: [0, 1, 2, 1] Before: [3, 2, 2, 3] 13 2 1 3 After: [3, 2, 2, 1] Before: [2, 2, 2, 2] 13 2 1 0 After: [1, 2, 2, 2] Before: [0, 1, 0, 3] 12 1 0 2 After: [0, 1, 1, 3] Before: [0, 1, 0, 3] 11 3 1 3 After: [0, 1, 0, 0] Before: [0, 1, 2, 1] 15 1 2...
2018/day16/data.go
0.512449
0.974435
data.go
starcoder
package sql import ( "fmt" ) // RangeCut represents a position on the line of all possible values. type RangeCut interface { // Compare returns an integer stating the relative position of the calling RangeCut to the given RangeCut. Compare(RangeCut, Type) (int, error) // String returns the RangeCut as a string f...
sql/range_cut.go
0.843702
0.519887
range_cut.go
starcoder
package main import ( "bufio" "fmt" "log" "math/rand" "os" "regexp" "strconv" "strings" "time" ) // Replacer is a struct with two elements: a compiled regular expression, // as per the regexp package, and an array of strings containing possible // replacements for a string matching the regular expression. ty...
eliza.go
0.525369
0.533397
eliza.go
starcoder
package kirkpatrick import ( compgeo "github.com/200sc/go-compgeo" "github.com/200sc/go-compgeo/dcel" "github.com/200sc/go-compgeo/dcel/pointLoc" "github.com/200sc/go-compgeo/dcel/pointLoc/monotone" "github.com/200sc/go-compgeo/dcel/pointLoc/trapezoid" "github.com/200sc/go-compgeo/geom" ) //Triangulation metho...
dcel/pointLoc/kirkpatrick/kirkpatrick.go
0.605449
0.42054
kirkpatrick.go
starcoder
package xcollection import "sync" // rune 42 stands for * const defaultMask = 42 type ( TrieOption func(root *trie) trieNode struct { children map[rune]*trieNode end bool } trie struct { root *trieNode mu sync.RWMutex mask rune } ) // newTrieNode returns a pointer of trieNode func newTrieNod...
pkg/utils/xcollection/trie.go
0.529263
0.432483
trie.go
starcoder
package main import ( "aoc2021/util" "fmt" "math" "strings" ) type Vector struct { x, y, z int } type Scanner struct { location Vector beacons []Vector } // Advent of Code (AOC) 2021 Day 19 func main() { scanners := []Scanner{} util.ReadFile("../input/19a.txt", func(line string) { if strings.HasPrefix(l...
2021/go/d19/main.go
0.539226
0.465023
main.go
starcoder
package stateful import ( "errors" "fmt" "regexp" "time" "github.com/thingnario/kapacitor/tick/ast" ) // ErrTypeGuardFailed is returned when a speicifc value type is requested thorugh NodeEvaluator (for example: "Float64Value") // when the node doesn't support the given type, for example "Float64Value" is calle...
tick/stateful/node_evaluator.go
0.773815
0.431884
node_evaluator.go
starcoder
package al import ( . "github.com/lens-vm/gogl" "gopkg.in/fatih/set.v0" ) type mutableUndirected struct { al_basic_mut } // Returns the degree of the provided vertex. If the vertex is not present in the // graph, the second return value will be false. func (g *mutableUndirected) DegreeOf(vertex Vertex) (degree in...
graph/al/undirected.go
0.823044
0.470007
undirected.go
starcoder
package safety import "sync" // Bool is a thread-safe bool implementation. type Bool struct { sync.RWMutex value bool } // NewBool will return a pointer to a new Bool instance. func NewBool() *Bool { return &Bool{} } // Get will return the current value. func (p *Bool) Get() bool { p.RLock() defer p.RUnlock() ...
vendor/gitlab.com/mjwhitta/safety/generated.go
0.739046
0.569583
generated.go
starcoder
package maths import ( "math" "github.com/mdiluz/rove/proto/roveapi" ) // Vector desribes a 3D vector type Vector struct { X int Y int } // Add adds one vector to another func (v *Vector) Add(v2 Vector) { v.X += v2.X v.Y += v2.Y } // Added calculates a new vector func (v Vector) Added(v2 Vector) Vector { v....
pkg/maths/vector.go
0.909997
0.640931
vector.go
starcoder
package af import ( "reflect" ) func boundingBox(args ...interface{}) (interface{}, error) { if len(args) != 1 { return nil, &ErrInvalidArguments{Function: "BoundingBox", Arguments: args} } t := reflect.TypeOf(args[0]) if !(t.Kind() == reflect.Array || t.Kind() == reflect.Slice) { if reflect.ValueOf(args[...
pkg/af/BoundingBox.go
0.586523
0.444625
BoundingBox.go
starcoder
package epoch import ( "database/sql/driver" "encoding/json" "fmt" "reflect" "time" ) // NullTime is a nullable time.Time. It supports SQL and JSON serialization. // It will marshal to null if null. type NullTime struct { Time Time Valid bool } // Scan implements the Scanner interface. func (t *NullTime) Sca...
null_time.go
0.715126
0.403126
null_time.go
starcoder
package types import ( "math" "github.com/attic-labs/noms/go/d" ) type leafSequence struct { sequenceImpl } func newLeafSequence(vrw ValueReadWriter, buff []byte, offsets []uint32, len uint64) leafSequence { return leafSequence{newSequenceImpl(vrw, buff, offsets, len)} } func newLeafSequenceFromValues(kind No...
go/types/leaf_sequence.go
0.736211
0.462109
leaf_sequence.go
starcoder
package consensus // applytransaction.go handles applying a transaction to the consensus set. // There is an assumption that the transaction has already been verified. import ( "github.com/threefoldtech/rivine/build" "github.com/threefoldtech/rivine/modules" "github.com/threefoldtech/rivine/types" "github.com/ri...
vendor/github.com/threefoldtech/rivine/modules/consensus/applytransaction.go
0.696062
0.509886
applytransaction.go
starcoder
package geodbtools import ( "fmt" "sync" "go.uber.org/multierr" ) var equivalentCountryCodeMapMu sync.RWMutex var equivalentCountryCodeMap = map[string]string{} // RegisterEquivalentCountryCode registers a pair of country codes which are deemed as equivalent during verification func RegisterEquivalentCountryCode...
verify.go
0.713731
0.485295
verify.go
starcoder
package structex import ( "bytes" "fmt" "io" "math" "math/bits" "reflect" ) type decoder struct { reader io.ByteReader currentByte uint8 byteOffset uint64 bitOffset uint64 transcoder *transcoder } func (d *decoder) read(nbits uint64) (uint64, error) { if nbits == 0 { return 0, fmt.Errorf("uns...
decoder.go
0.699254
0.410697
decoder.go
starcoder
package main import ( "container/heap" "log" "math" ) // medData holds the data structures needed to compute a running median. // Currently, the running median is implemented via a min and max heap data // structure and thus requires storage on the order of the data set size type medData struct { smaller, larger...
median.go
0.604983
0.568296
median.go
starcoder
package retry import ( "context" "time" ) type Strategy func(ctx context.Context, attempt uint) bool // Limit creates a Strategy that limits the number of attempts that Retry will // make. func Limit(attemptLimit uint) Strategy { return func(ctx context.Context, attempt uint) bool { return (attempt < attemptLim...
retry/strategy.go
0.737725
0.404449
strategy.go
starcoder
package fp type BoolPredicate func(t bool) bool type StringPredicate func(t string) bool type IntPredicate func(t int) bool type Int64Predicate func(t int64) bool type BytePredicate func(t byte) bool type RunePredicate func(t rune) bool type Float32Predicate func(t float32) bool type Float64Predicate func(t float64)...
fp/bootstrap_predicate.go
0.551091
0.461623
bootstrap_predicate.go
starcoder