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 main import ( "image" "image/color" "github.com/disintegration/imaging" ) type lut [256]uint8 type rgbLut struct { r lut g lut b lut } type histogram [256]uint32 type rgbHistogram struct { r histogram g histogram b histogram } func generateRgbHistogramFromImage(input image.Image) rgbHistogram { va...
histogram.go
0.594198
0.598342
histogram.go
starcoder
package runtime import ( "fmt" "strconv" "strings" ) type BinaryTree struct { } func NewBinaryTree() BinaryTree { return BinaryTree{} } func (bt *BinaryTree) unserialize1(data string) *TreeNode { values := strings.Split(data, ",") var build func() *TreeNode build = func() *TreeNode { ...
runtime/BinaryTree.go
0.650578
0.421433
BinaryTree.go
starcoder
package influxql import ( "github.com/gogo/protobuf/proto" "github.com/influxdata/influxdb/influxql/internal" ) // FloatPoint represents a point with a float64 value. type FloatPoint struct { Name string Tags Tags Time int64 Nil bool Value float64 Aux []interface{} } func (v *FloatPoint) name() string...
vendor/github.com/influxdata/influxdb/influxql/point.gen.go
0.849129
0.512693
point.gen.go
starcoder
package pathfinding import ( "github.com/ThudPoland/Man-Pac/basic" ) //BreadthFirstSearch is a struct for making pathfinding type BreadthFirstSearch struct { lastNode *Node firstNode *Node direction basic.Direction reachable bool } //GetSearchResult creates result for Breadth First Search func (searchData *Bre...
pathfinding/breadthfirstsearch.go
0.544559
0.468851
breadthfirstsearch.go
starcoder
package main import ( "fmt" ) func main() { // Declaring two integer variables num1 := 20 num2 := 10 // Checking whether both the numbers are equal or not // We use EqualTo (==) operator // Declaring the integer varable to store the result // If both the numbers are equal, then the result will be 'true', ot...
RelationalOperators.go
0.500488
0.419886
RelationalOperators.go
starcoder
package expr import ( "strings" "bosun.org/cmd/bosun/expr/parse" "bosun.org/models" ) func elasticTagQuery(args []parse.Node) (parse.Tags, error) { n := args[1].(*parse.StringNode) t := make(parse.Tags) for _, s := range strings.Split(n.Text, ",") { t[s] = struct{}{} } return t, nil } // ElasticFuncs are ...
cmd/bosun/expr/elastic.go
0.533884
0.402157
elastic.go
starcoder
package design import ( "io" "reflect" "github.com/gregoryv/go-design/shape" ) // NewSequenceDiagram returns a sequence diagram with default column // width. func NewSequenceDiagram() *SequenceDiagram { return &SequenceDiagram{ Diagram: NewDiagram(), ColWidth: 190, VMargin: 10, } } // SequenceDiagram d...
seqdia.go
0.727975
0.455078
seqdia.go
starcoder
package core import ( "sync" uuid "github.com/satori/go.uuid" ) var instance *PortfolioStateManager var once sync.Once func SharedPortfolioManager() *PortfolioStateManager { once.Do(func() { instance = &PortfolioStateManager{} instance.States = make(map[string]PortfolioState) }) return instance } type Por...
core/portfolio.go
0.58059
0.410402
portfolio.go
starcoder
package parser // IsConstant tells if the category is constant. func (p Category) IsConstant() bool { return p == Category_Constant } // IsBool tells if the category is bool. func (p Category) IsBool() bool { return p == Category_Bool } // IsByte tells if the category is byte. func (p Category) IsByte() bool { r...
parser/AST-extend-category.go
0.849956
0.580174
AST-extend-category.go
starcoder
package value import ( "errors" ) type TypeInfo int64 // These constants describe the container type of a Value. const ( TypeInfoScalar TypeInfo = iota + 1 TypeInfoSlice TypeInfoMap ) // Value is a "generic" type to store different types into flags // Inspired by https://golang.org/src/flag/flag.go . // There a...
value/value.go
0.596668
0.418697
value.go
starcoder
package gorrect import "github.com/racerxdl/gorrect/correctwrap" type ConvolutionCoder struct { r int k int poly []uint16 cc correctwrap.Correct_convolutional } // MakeConvolutionCoder creates a new Convolution Decoder / Encoder for r => rate, k => order and specified polys func MakeConvolutionCoder(r, k ...
Convolution.go
0.806205
0.445047
Convolution.go
starcoder
package datadog import ( "encoding/json" "fmt" ) // NotebookDistributionCellAttributes The attributes of a notebook `distribution` cell. type NotebookDistributionCellAttributes struct { Definition DistributionWidgetDefinition `json:"definition"` GraphSize *NotebookGraphSize `json:"graph_size,omitempty...
api/v1/datadog/model_notebook_distribution_cell_attributes.go
0.828349
0.406391
model_notebook_distribution_cell_attributes.go
starcoder
package onshape import ( "encoding/json" ) // BTMSketch151 struct for BTMSketch151 type BTMSketch151 struct { BTMFeature134 BtType *string `json:"btType,omitempty"` Constraints *[]BTMSketchConstraint2 `json:"constraints,omitempty"` Entities *[]BTMSketchGeomEntity5 `json:"entities,omitempty"` } // NewBTMSketch15...
onshape/model_btm_sketch_151.go
0.740831
0.405655
model_btm_sketch_151.go
starcoder
package trie import ( "errors" "fmt" ) type tree struct { root node } func NewTree() *tree { return &tree{root: node{}} } /// Finds associated value for key /// returns error if key was not found in trie func (t *tree) Find(key string) (interface{}, error) { return t.root.find(key) } /// Insert key-value-pair...
src/trees/trie/trie.go
0.712332
0.435181
trie.go
starcoder
package cluster import ( "fmt" "math/rand" ) // Kmeans configuration/option struct type Kmeans struct { k int // deltaThreshold (in percent between 0.0 and 0.1) aborts processing if // less than n% of data points shifted clusters in the last iteration deltaThreshold float64 // iterationThreshold aborts process...
cluster/kmeans.go
0.663451
0.495789
kmeans.go
starcoder
package api import ( . "github.com/gocircuit/circuit/gocircuit.org/render" ) func RenderSubscriptionPage() string { return RenderHtml("Using subscriptions", Render(subscriptionBody, nil)) } const subscriptionBody = ` <h2>Using subscriptions</h2> <p>Subscriptions are a way of receiving notifications about events ...
gocircuit.org/api/subscription.go
0.617628
0.593167
subscription.go
starcoder
package condition import ( "encoding/json" "fmt" "reflect" "github.com/Jeffail/benthos/v3/lib/log" "github.com/Jeffail/benthos/v3/lib/metrics" "github.com/Jeffail/benthos/v3/lib/types" "github.com/Jeffail/benthos/v3/lib/x/docs" "github.com/Jeffail/gabs/v2" ) //------------------------------------------------...
lib/condition/json.go
0.748444
0.404331
json.go
starcoder
package eaopt import ( "math/rand" "sort" ) // Type specific mutations for slices // CrossUniformFloat64 crossover combines two individuals (the parents) into one // (the offspring). Each parent's contribution to the Genome is determined by // the value of a probability p. Each offspring receives a proportion of b...
crossover.go
0.59796
0.618809
crossover.go
starcoder
package workitem import ( "fmt" "reflect" "strconv" "time" "github.com/almighty/almighty-core/convert" "github.com/almighty/almighty-core/rendering" "github.com/asaskevich/govalidator" "github.com/pkg/errors" ) // SimpleType is an unstructured FieldType type SimpleType struct { Kind Kind } // Ensure Simple...
workitem/simple_type.go
0.66072
0.442396
simple_type.go
starcoder
package list import ( "github.com/genkami/dogs/classes/algebra" "github.com/genkami/dogs/classes/cmp" "github.com/genkami/dogs/types/iterator" "github.com/genkami/dogs/types/pair" ) // Some packages are unused depending on -include CLI option. // This prevents compile error when corresponding functions are not d...
types/list/zz_generated.collection.go
0.803405
0.492554
zz_generated.collection.go
starcoder
package matcha import ( "fmt" "reflect" "regexp" "strings" snakecase "github.com/segmentio/go-snakecase" . "github.com/smartystreets/goconvey/convey" ) // CapturedValues is a map of a slice of values type CapturedValues map[string][]interface{} type Matcher struct { format string // Should be 'json' ...
matcha/matcher.go
0.709221
0.549278
matcher.go
starcoder
package favicon import ( "bytes" "encoding/binary" ) // https://en.wikipedia.org/wiki/BMP_file_format type BitmapFileHeader struct { Signature [2]byte // The header field used to identify the BMP and DIB file is 0x42 0x4D in hexadecimal, same as BM in ASCII. FileSize uint32 // The size of the BMP file in bytes...
favicon/bitmap.go
0.710528
0.467149
bitmap.go
starcoder
package tomgjson import ( "encoding/json" "fmt" "log" "math" "strconv" "strings" "time" ) // Like math.Max but with ints func maxInt(a, b int) int { if a > b { return a } return b } // Returns both sides of a float number as strings func sides(n float64) (string, string) { sides := strings.Split(strconv...
tomgjson.go
0.748536
0.400808
tomgjson.go
starcoder
package goraph import ( "fmt" "math" ) // ID uniquely identify a vertex. type ID interface{} // Vertex interface represents a vertex with edges connected to it. type Vertex interface { // ID get the unique id of the vertex. ID() ID // Edges get all the edges connected to the vertex Edges() []Edge } // Edge i...
graph.go
0.857887
0.713962
graph.go
starcoder
package analysis import ( "fmt" "sort" "time" "github.com/fogleman/gg" "gsa.gov/18f/internal/state" "gsa.gov/18f/internal/structs" ) func isInDurationRange(diff int) bool { cfg := state.GetConfig() return (diff >= cfg.GetMinimumMinutes()) && (diff < cfg.GetMaximumMinutes()) } func DrawPatronSessions(duratio...
imls-raspberry-pi/internal/analysis/drawing.go
0.596433
0.550064
drawing.go
starcoder
package golcas import ( "regexp" "strings" ) var uuidRegex *regexp.Regexp // FindUUID returns the UUID from the given path or an empty string if it cannot // find it. func FindUUID(path string) string { if uuidRegex == nil { pattern := "[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}...
paths.go
0.742795
0.474144
paths.go
starcoder
package qdb /* #include <qdb/ts.h> #include <stdlib.h> */ import "C" import ( "math" "time" "unsafe" ) // TsSymbolPoint : timestamped symbol type TsSymbolPoint struct { timestamp time.Time content string } // Timestamp : return data point timestamp func (t TsSymbolPoint) Timestamp() time.Time { return t.ti...
entry_timeseries_symbol.go
0.708011
0.404625
entry_timeseries_symbol.go
starcoder
package parser import ( "github.com/jxwr/php-parser/ast" "github.com/jxwr/php-parser/lexer" "github.com/jxwr/php-parser/token" ) func (p *Parser) parseFunctionStmt() *ast.FunctionStmt { stmt := &ast.FunctionStmt{} stmt.FunctionDefinition = p.parseFunctionDefinition() stmt.Body = p.parseBlock() return stmt } f...
parser/function.go
0.512937
0.422147
function.go
starcoder
package list // LinkedNode is a record of a linked list. type LinkedNode struct { Data interface{} next *LinkedNode } // LinkedList a linear collection of data nodes. type LinkedList struct { head *LinkedNode length uint64 } // NewLinkedList an empty linked list. func NewLinkedList() *LinkedList { return &Lin...
pkg/list/linked.go
0.806167
0.413892
linked.go
starcoder
package ast import ( "bytes" "github.com/TurnsCoffeeIntoScripts/git-log-issue-finder/pkg/interpreter/gitoken" "strings" ) // Node is an interface that needs to be implemented by every element that the AST will contain type Node interface { TokenLiteral() string String() string } // Statement is an interface enc...
pkg/interpreter/ast/ast.go
0.714728
0.412087
ast.go
starcoder
package onshape import ( "encoding/json" ) // BTVector3d389 struct for BTVector3d389 type BTVector3d389 struct { BtType *string `json:"btType,omitempty"` X *float64 `json:"x,omitempty"` Y *float64 `json:"y,omitempty"` Z *float64 `json:"z,omitempty"` } // NewBTVector3d389 instantiates a new BTVector3d389 object ...
onshape/model_bt_vector3d_389.go
0.748995
0.542379
model_bt_vector3d_389.go
starcoder
package animation // Code to support mapping from logical 'universes' to physical pixel layout. import ( "fmt" "image/color" "math" ) // {board, strand, pixel} tuple identifying a physical pixel type location struct { board, strand, pixel uint } // Mapping captures mapping from logical to physical layer type Ma...
vendor/github.com/TeamNorCal/animation/universe.go
0.809088
0.58053
universe.go
starcoder
package plaid import ( "encoding/json" ) // SignalAddressData Data about the components comprising an address. type SignalAddressData struct { // The full city name City *string `json:"city,omitempty"` // The region or state Example: `\"NC\"` Region NullableString `json:"region,omitempty"` // The full street a...
plaid/model_signal_address_data.go
0.828384
0.421016
model_signal_address_data.go
starcoder
package plan import ( "github.com/ngaut/log" "github.com/pingcap/tidb/ast" "github.com/pingcap/tidb/expression" "github.com/pingcap/tidb/kv" "github.com/pingcap/tidb/mysql" "github.com/pingcap/tidb/sessionctx/variable" "github.com/pingcap/tidb/util/codec" "github.com/pingcap/tidb/util/types" "github.com/ping...
plan/expr_to_pb.go
0.506836
0.420957
expr_to_pb.go
starcoder
package bls12381 import ( "errors" "math/big" ) type fp2Temp struct { t [4]*fe } type fp2 struct { fp2Temp } func newFp2Temp() fp2Temp { t := [4]*fe{} for i := 0; i < len(t); i++ { t[i] = &fe{} } return fp2Temp{t} } func newFp2() *fp2 { t := newFp2Temp() return &fp2{t} } func (e *fp2) fromBytes(in []b...
fp2.go
0.510008
0.455683
fp2.go
starcoder
package swamppack import ( "bytes" "encoding/binary" "fmt" "io" raff "github.com/piot/raff-go/src" ) // ConstantType represents the type of constant stored. type ConstantType uint8 const ( ConstantTypeString ConstantType = iota ConstantTypeResourceName ConstantTypeInteger ConstantTypeBoolean ConstantTypeE...
lib/pack.go
0.760384
0.403508
pack.go
starcoder
package entry import ( "github.com/iancoleman/orderedmap" ) // OrderedMap is an ordered map of entries. type OrderedMap struct { orderedMap *orderedmap.OrderedMap } // NewOrderedMap creates a new OrderedMap of entries. func NewOrderedMap() *OrderedMap { return &OrderedMap{ orderedMap: orderedmap.New(), } } //...
entry/entry_map.go
0.844505
0.474509
entry_map.go
starcoder
package xidenticon import ( "crypto/md5" "encoding/hex" "fmt" "image" "image/color" "image/draw" ) const ( tilesPerDimension = 5 ) var ( defaultBackgroundColor = RGB(240, 240, 240) defaultImageSize = 100 ) // Options control some inner mechanics type Options struct { BackgroundColor color.NRGBA Deb...
xidenticon/identicon.go
0.788868
0.456289
identicon.go
starcoder
package encoding import ( "bytes" "encoding/binary" "io" "github.com/lindb/lindb/pkg/stream" ) // FixedOffsetEncoder represents the offset encoder with fixed length type FixedOffsetEncoder struct { values []uint32 buf *bytes.Buffer max uint32 bw *stream.BufferWriter } // NewFixedOffsetEncoder crea...
pkg/encoding/fixed_offset.go
0.790085
0.425367
fixed_offset.go
starcoder
package engine import ( "github.com/yuin/gopher-lua" "github.com/Member1221/raylib-go/raylib" "fmt" ) type Vector2 = raylib.Vector2 type Camera struct { iCam raylib.Camera2D Position Vector2 Origin Vector2 Rotation float32 Zoom float32 } func RegisterCameraType(state *lua.LState) { fmt.Println("[Polyplex:r...
engine/camera.go
0.619126
0.479443
camera.go
starcoder
Package xdr implements the data representation portion of the External Data Representation (XDR) standard protocol as specified in RFC 4506 (obsoletes RFC 1832 and RFC 1014). The XDR RFC defines both a data specification language and a data representation standard. This package implements methods to encode and decode...
xdr/doc.go
0.893646
0.928311
doc.go
starcoder
package femto // FromCharPos converts from a character position to an x, y position func FromCharPos(loc int, buf *Buffer) Loc { charNum := 0 x, y := 0, 0 lineLen := Count(buf.Line(y)) + 1 for charNum+lineLen <= loc { charNum += lineLen y++ lineLen = Count(buf.Line(y)) + 1 } x = loc - charNum return Loc...
femto/loc.go
0.739234
0.543651
loc.go
starcoder
package goquery import ( "github.com/lynx-seu/goquery/cascadia" "github.com/lynx-seu/goquery/exp/html" "regexp" "strings" ) //var rxNeedsContext = `^[\x20\t\r\n\f]*[>+~]|:(nth|eq|gt|lt|first|last|even|odd)(-child)?(?:\((\d*)\)|)(?:[^-]|$)` // Is() checks the current matched set of elements against a selector and...
query.go
0.517815
0.410756
query.go
starcoder
package data // Message stores the rendering information about message type Message struct { // Nested shows whether this message is a nested message and needs to be exported Nested bool // Name is the name of the Message Name string //FQType is the fully qualified type name for the message itself FQType string ...
data/message.go
0.629547
0.457016
message.go
starcoder
package geom import ( "math" ) type Polygon struct { Path } func wrapIndex(index, length int) (i int) { i = index % length if i < 0 { i = length + i } return } func (p *Polygon) Clone() (op *Polygon) { op = &Polygon{*p.Path.Clone()} return } func (p *Polygon) Equals(oi interface{}) bool { o, ok := oi.(...
vendor/github.com/skelterjohn/geom/poly.go
0.601477
0.444806
poly.go
starcoder
package labradar import ( "strconv" "time" ) // Series is a structure that holds the data from a Labradar series, and some details of the load // and firearm that was used. type Series struct { // TODO [TO20220404] Maybe this should be an interface? Number SeriesNumber deviceId DeviceId Date ...
code/cli/pkg/labradar/series.go
0.538012
0.592519
series.go
starcoder
package swessn import ( "errors" "fmt" "regexp" "strconv" "strings" ) // Divider represents the divider between birth date and control digits. type Divider string const ( DividerPlus Divider = "+" DividerMinus Divider = "-" DividerNone Divider = "" ) // Parsed represents a parsed string. The fields are na...
luhn.go
0.681833
0.402099
luhn.go
starcoder
// Package string provides the implementation of the python's 'string' module. package string import ( "strings" "github.com/go-python/gpython/py" ) func init() { py.RegisterModule(&py.ModuleImpl{ Info: py.ModuleInfo{ Name: "string", Doc: module_doc, }, Methods: []*py.Method{ py.MustNewMethod("ca...
stdlib/string/string.go
0.66628
0.422922
string.go
starcoder
package challenges import ( "errors" "github.com/offchainlabs/arbitrum/packages/arb-util/inbox" "github.com/offchainlabs/arbitrum/packages/arb-util/protocol" "github.com/offchainlabs/arbitrum/packages/arb-validator-core/arbbridge" "github.com/offchainlabs/arbitrum/packages/arb-validator/structures" "log" "gith...
packages/arb-validator/challenges/defender.go
0.513668
0.475605
defender.go
starcoder
package list const orderedFunctions = ` {{if .Type.Ordered}} //------------------------------------------------------------------------------------------------- // These methods are provided because {{.TName}} is ordered. // Min returns the element with the minimum value. In the case of multiple items being equally m...
internal/list/ordered.go
0.815269
0.615117
ordered.go
starcoder
package types import ( "reflect" "github.com/open2b/scriggo/internal/runtime" ) // definedType represents a type defined in the Scriggo compiled code with a // type definition, where the underlying type can be both a type compiled in // the Scriggo code or in gc. type definedType struct { // The embedded reflect...
internal/compiler/types/defined.go
0.656218
0.61996
defined.go
starcoder
package monitoring import "strings" // FlatSnapshot represents a flatten snapshot of all metrics. // Names in the tree will be joined with `.` . type FlatSnapshot struct { Bools map[string]bool Ints map[string]int64 Floats map[string]float64 Strings map[string]string } type flatSnapshotVisitor struct { sn...
libbeat/monitoring/snapshot.go
0.753829
0.407333
snapshot.go
starcoder
package rf import ( "fmt" "log" "math" ) // Frequency type (Hz) to assist with unit coherence type Frequency float64 // Wavelength type (m) to assist with unit coherence type Wavelength float64 // Distance type (m) to assist with unit coherence type Distance float64 // Attenuation type (dB) to assist with unit ...
rf.go
0.860398
0.608027
rf.go
starcoder
package render import ( "github.com/go-gl/gl/v4.1-core/gl" "github.com/go-gl/mathgl/mgl32" "github.com/samuelyuan/openbiohazard2/fileio" "github.com/samuelyuan/openbiohazard2/geometry" "github.com/samuelyuan/openbiohazard2/world" ) const ( RENDER_TYPE_DEBUG = -1 ) type DebugEntity struct { Color ...
render/debugentity.go
0.635109
0.411525
debugentity.go
starcoder
package graphics2d import ( "fmt" "image" "math" ) // Shape is a fillable collection of paths. For a path to be fillable, // it must be closed, so paths added to the shape are forced closed on rendering. type Shape struct { paths []*Path bounds image.Rectangle mask *image.Alpha parent *Shape } // Bounds ca...
shape.go
0.844505
0.547283
shape.go
starcoder
package geo import ( "github.com/golang/geo/s2" "github.com/paulmach/go.geojson" ) const ( //EarthRadius the radius of earth in kilometers EarthRadius = 6371.01 maxCells = 100 ) // Point struct contains the lat/lng of a point type Point struct { Lat float64 Lng float64 } // DecodeGeoJSON decodes a feature...
pkg/geo/geo.go
0.784567
0.49939
geo.go
starcoder
package mcc import ( "math" "sync" ) const ( maxUpdateQueueLength = math.MaxUint32 / 4 ) type blockUpdate struct { index, ticks int } type blockUpdateQueue struct { lock sync.Mutex updates []blockUpdate } func (queue *blockUpdateQueue) add(index int, delay int) { queue.lock.Lock() defer queue.lock.Unloc...
mcc/physics.go
0.529263
0.414069
physics.go
starcoder
package proto import ( "github.com/ysmood/gson" ) /* LayerTree */ // LayerTreeLayerID Unique Layer identifier. type LayerTreeLayerID string // LayerTreeSnapshotID Unique snapshot identifier. type LayerTreeSnapshotID string // LayerTreeScrollRectType enum type LayerTreeScrollRectType string const ( // LayerTr...
lib/proto/layer_tree.go
0.857112
0.420659
layer_tree.go
starcoder
package taskmaster import ( "github.com/thompsonlabs/taskmaster/pool" ) var poolBuilderInstance *PoolBuilder //PoolBuilder - Builds a new TaskMaster TaskPool type PoolBuilder struct { maxWorkerCount int maxQueueCount int poolType PoolType customErrorFunction func(interface{}) ...
TaskMaster.go
0.574753
0.429489
TaskMaster.go
starcoder
package timeutil import ( "errors" "fmt" "math" "time" ) type TimeUnit int const ( zero = 0 one = 1 Second = iota Minute Hour Day Month Year ) func TruncateThirtyMinutes(currentTime time.Time) time.Time { minutes := currentTime.Minute() if minutes >= 30 { minutes = 30 } else { minutes = 0 } r...
pkg/util/timeutil/truncate.go
0.659844
0.633934
truncate.go
starcoder
package mapbox import ( "bytes" "context" "fmt" "github.com/soider/elevations/internal/geo" "image" "image/color" "image/png" ) // ElevationDecoder decodes elevation data from pngraw format type ElevationDecoder struct{} // Decode decodes elevation data from pngraw format // Every rawpng file is png 256x256 s...
internal/mapbox/decoder.go
0.738952
0.485539
decoder.go
starcoder
package ring import ( "github.com/tuneinsight/lattigo/v3/utils" ) // UnfoldConjugateInvariantToStandard maps the compressed representation (N/2 coefficients) // of Z_Q[X+X^-1]/(X^2N + 1) to full representation in Z_Q[X]/(X^2N+1). // Requires degree(polyConjugateInvariant) = 2*degree(polyStd). // Requires that polySt...
ring/conjugate_invariant.go
0.560132
0.475971
conjugate_invariant.go
starcoder
package object import "github.com/butlermatt/glpc/lexer" // Expr is an AST expression which returns a value of type Object or an error. type Expr interface { Accept(ExprVisitor) (Object, error) } // Stmt is an AST statement which returns no value but may produce an error. type Stmt interface { Accept(StmtVisitor) ...
object/ast.go
0.743727
0.561816
ast.go
starcoder
package prnm import ( "math/big" "github.com/pkg/errors" ) // BigInt wraps a golang math/big.Int. // All functions on BigInt have their equivalent in the documentation below. // See https://golang.org/pkg/math/big/#Int // If we do this as embedding, the functions are skipped because of the wrong return type. type...
big.go
0.799599
0.664323
big.go
starcoder
package main import ( "log" "math" "github.com/unixpickle/model3d/render3d" "github.com/unixpickle/model3d/toolbox3d" "github.com/unixpickle/model3d/model3d" ) const ( BrickZSpace = 0.4 BrickThetaSpace = 0.4 BrickDivot = 0.03 TopBlockCount = 10 TopBlockThickness = 0.2 WallHeight = 3....
examples/_deprecated/castle_tower/main.go
0.626696
0.457258
main.go
starcoder
package darksky // DataPoint contains weather data for a specific location and time. type DataPoint struct { Time *float64 `json:"time"` Summary *string `json:"summary"` Icon Icon `json:"icon"` SunriseTime *float6...
datapoint.go
0.716913
0.42316
datapoint.go
starcoder
package engine // Copy returns a copy of a Phrase func (p *Phrase) Copy() *Phrase { p.RLock() defer p.RUnlock() r := NewPhrase() for n := p.firstnote; n != nil; n = n.next { nn := n.Copy() r.InsertNote(nn) } r.Length = p.Length return r } // CopyAndAppend makes a copy of a Note and appends it to the Phra...
engine/phraseop.go
0.750004
0.416856
phraseop.go
starcoder
package util import ( "fmt" "reflect" "testing" "time" "unsafe" "github.com/stretchr/testify/assert" ) // AssertDeepCopyEqual checks to see if two variables have the same values but DO NOT share any memory // There is currently a special case for `time.loc` (as this code traverses into unexported fields) func ...
util/assert.go
0.69035
0.5564
assert.go
starcoder
package sc //https://github.com/neo-project/neo-vm/blob/master/src/neo-vm/OpCode.cs type OpCode byte const ( // Constants PUSHINT8 OpCode = 0x00 // Operand Size = 1. Pushes a 1-byte signed integer onto the stack. PUSHINT16 OpCode = 0x01 // Operand Size = 2. Pushes a 2-bytes signed integer onto the stack. PUSH...
sc/opCode.go
0.801354
0.700588
opCode.go
starcoder
package ledger import "time" // TransactionsInDateRange returns a new array of transactions that are in the date range // specified by start and end. The returned list contains transactions on the same day as start // but does not include any transactions on the day of end. func TransactionsInDateRange(trans []*Trans...
date.go
0.754463
0.610076
date.go
starcoder
package impl import ( . "github.com/gabz57/goledmatrix/canvas" . "github.com/gabz57/goledmatrix/components" "github.com/gabz57/goledmatrix/components/shapes" "image" "time" ) type BouncingDot struct { move *Movement dot *shapes.Dot //dotAcceleration *ConstantAcceleration bounds image....
components/impl/bouncingDot.go
0.689724
0.462048
bouncingDot.go
starcoder
package models import ( i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91 "github.com/microsoft/kiota-abstractions-go/serialization" ) // PlannerUser type PlannerUser struct { PlannerDelta // The all property all []PlannerDeltaable // A collection containing the references to the ...
models/planner_user.go
0.740737
0.444324
planner_user.go
starcoder
package nock import ( "strconv" "strings" ) // A Noun is an atom or a cell. An atom is any natural number. A cell is any // ordered pair of nouns. type Noun struct { atom *int cell *[2]Noun } // IsAtom returns true if n is an atom. func (n Noun) IsAtom() bool { return n.atom != nil } // IsCell returns true if n...
nock.go
0.773302
0.642461
nock.go
starcoder
package dstructs import "fmt" //LNode : Creates a *Node* Object for a ***Singly*** Linked List type LNode struct { Data interface{} Next *LNode } //DNode : Creates a *Node* Object for a ***Doubly*** Linked List type DNode struct { Data interface{} Next *DNode Prev *DNode } //LinkedList : Creates a ***Singly***...
Go/dstruct/LinkedList.go
0.507568
0.433981
LinkedList.go
starcoder
package bencode import ( "errors" "fmt" "strconv" ) // Decode decodes a bencoded string to string, int, list or map. func Decode(data []byte) (r interface{}, err error) { r, _, err = decodeItem(data, 0) return r, err } // DecodeString decodes a string from a given offset. // It returns the string, the number of...
decode.go
0.736874
0.429908
decode.go
starcoder
package pgsql import ( "database/sql" "database/sql/driver" "strconv" ) // VarBitFromInt64 returns a driver.Valuer that produces a PostgreSQL varbit from the given Go int64. func VarBitFromInt64(val int64) driver.Valuer { return varBitFromInt64{val: val} } // VarBitToInt64 returns an sql.Scanner that converts a ...
pgsql/varbit.go
0.702326
0.431524
varbit.go
starcoder
package model import ( "github.com/peterhoward42/skilldrill/util/sets" "strings" ) /* The skillTreeOps type is a place for algorithmic functions to live that depend on traversing parent child relationships in the skills taxonomy tree. The aim is to prevent any other parts of the model software from having to engage...
model-hidden/skilltreeops.go
0.657758
0.466663
skilltreeops.go
starcoder
package display import ( "fmt" "unsafe" "github.com/go-gl/gl/v4.2-core/gl" "github.com/go-gl/mathgl/mgl32" ) // Constant Cube Vertices. Same for all cubes. func getVertices() []mgl32.Vec3 { return []mgl32.Vec3{ {0.5, 0.5, 0.5}, {0.5, 0.5, -0.5}, {0.5, -0.5, 0.5}, {0.5, -0.5, -0.5}, {-0.5, 0.5, 0.5}, ...
display/cube.go
0.696165
0.430626
cube.go
starcoder
package structsync import ( "fmt" "reflect" "time" "github.com/deelawn/convert" ) const timeType = "time.Time" // assignAndConvertValue -- Assign values from one field to another and handle casts func assignAndConvertValue(srcValue, dstValue reflect.Value) error { srcKind := srcValue.Kind() dstKind := dstVal...
assignment.go
0.576065
0.564519
assignment.go
starcoder
package graph import ( "container/heap" ) //IsProperColouring checks if the vertex colouring is a proper colouring of the graph g. It assumes that all colours are \geq 0 and that a colour <0 is a mistake. //This is because the colour -1 is often used to indicate no colour. func IsProperColouring(g Graph, colouring [...
graph/colouring.go
0.741112
0.506958
colouring.go
starcoder
package consensus import ( "math/big" "time" "go.sia.tech/sunyata" ) // BlockInterval is the expected wall clock time between consecutive blocks. const BlockInterval = 10 * time.Minute // DifficultyAdjustmentInterval is the number of blocks between adjustments to // the block mining target. const DifficultyAdjus...
consensus/update.go
0.756537
0.444263
update.go
starcoder
package expressions import ( "base/docs" "datavalues" ) func LT(left interface{}, right interface{}) IExpression { exprs := expressionsFor(left, right) return &BinaryExpression{ name: "<", argumentNames: [][]string{ {"left", "right"}, }, description: docs.Text("Less than."), validate: All(), le...
src/expressions/expression_condition.go
0.594551
0.474205
expression_condition.go
starcoder
package gorm import ( "fmt" "strings" "github.com/infobloxopen/atlas-app-toolkit/query" ) // FilterStringToGorm is a shortcut to parse a filter string using default FilteringParser implementation // and call FilteringToGorm on the returned filtering expression. func FilterStringToGorm(filter string) (string, []in...
gorm/filtering.go
0.684686
0.512449
filtering.go
starcoder
package memory import ( "fmt" "reflect" "github.com/google/gapid/core/math/u64" "github.com/google/gapid/core/os/device" ) // AlignOf returns the byte alignment of the type t. func AlignOf(t reflect.Type, m *device.MemoryLayout) uint64 { handlePointer := func() (uint64, bool) { if t.Implements(tyPointer) { ...
gapis/memory/alignof_sizeof.go
0.645455
0.432183
alignof_sizeof.go
starcoder
package main import ( "fmt" ) //Heap is a struct for deciding the priority of the decision type Heap struct { data []Var // The content of data indices []int // The heap index of Var activity []float64 // The priority of each variable. } //NewHeap returns a pointer of Heap func NewHeap() *Heap { re...
heap.go
0.699973
0.452475
heap.go
starcoder
package graph import "GoCausal/utils" type NodePoint struct { node *Node edge *Edge } func MapKeyInNodeSlice(haystack []*Node, needle *Node) bool { set := make(map[*Node]struct{}) for _, e := range haystack { set[e] = struct{}{} } _, ok := set[needle] return ok } func (n *NodePoint) GetDistalNode() *Node {...
graph/GraphUtils.go
0.505859
0.434221
GraphUtils.go
starcoder
package indicators import "fmt" // Sma calculates simple moving average of a slice for a certain // number of time periods. func (slice mfloat) SMA(period int) []float64 { var smaSlice []float64 for i := period; i <= len(slice); i++ { smaSlice = append(smaSlice, Sum(slice[i-period:i])/float64(period)) } retur...
indicators.go
0.59843
0.582966
indicators.go
starcoder
package vision import ( "sort" "github.com/joaowiciuk/matrix" ) type Region struct { D []float64 Xi, Xf []int Yi, Yf []int } func (R *Region) Len() int { return len((*R).D) } func (R *Region) Less(i, j int) bool { return (*R).D[i] < (*R).D[j] } func (R *Region) Swap(i, j int) { aux := Region{ D: m...
find.go
0.573678
0.542318
find.go
starcoder
package aoc2020 /* Day 07 - Handy Haversacks https://adventofcode.com/2020/day/7 Sample input dim red bags contain 2 bright gold bags, 5 striped fuchsia bags. dotted purple bags contain 5 bright olive bags, 3 faded maroon bags. plaid chartreuse bags contain 1 vibrant olive bag, 5 bright black bags, 1 clear tomato ba...
app/aoc2020/aoc2020_07.go
0.72027
0.526343
aoc2020_07.go
starcoder
package types import ( "io" "reflect" "github.com/lyraproj/pcore/px" ) type OptionalType struct { typ px.Type } var OptionalMetaType px.ObjectType func init() { OptionalMetaType = newObjectType(`Pcore::OptionalType`, `Pcore::AnyType { attributes => { type => { type => Optional[Type], value => Any ...
types/optionaltype.go
0.733929
0.503967
optionaltype.go
starcoder
package main /* 题目: 给定一个非负整数 num。对于 0 ≤ i ≤ num 范围中的每个数字 i ,计算其二进制数中的 1 的数目并将它们作为数组返回。 进阶: 给出时间复杂度为O(n*sizeof(integer))的解答非常容易。但你可以在线性时间O(n)内用一趟扫描做到吗? 要求算法的空间复杂度为O(n)。 你能进一步完善解法吗?要求在C++或任何其他语言中不使用任何内置函数(如 C++ 中的 __builtin_popcount)来执行此操作。 来源:力扣(LeetCode) 链接:https://leetcode-cn.com/problems/counting-bits */ /** * ...
internal/leetcode/341.flatten-nested-list-iterator/main.go
0.608012
0.534248
main.go
starcoder
package store import ( "fmt" "math/rand" "time" ) // Chooser is structure that knows how to choose the next trigram/word to use in a given moment. type Chooser interface { // ChooseInitialTrigram chooses the initial trigram to start a text with, given a TrigramMap of available trigrams. ChooseInitialTrigram(avai...
store/chooser.go
0.693577
0.444565
chooser.go
starcoder
package quadedge import ( "context" "fmt" "log" "github.com/go-spatial/geom" "github.com/go-spatial/geom/planar/intersect" "github.com/go-spatial/geom/winding" ) const ( precision = 6 ) var glbIdx uint64 // Edge describes a directional edge in a quadedge type Edge struct { glbIdx uint64 num int next ...
planar/triangulate/delaunay/quadedge/edge.go
0.731251
0.587292
edge.go
starcoder
package dfa import ( "github.com/flapflapio/simulator/core/errors" "github.com/flapflapio/simulator/core/simulation" "github.com/flapflapio/simulator/core/simulation/machine" ) type DFASimulation struct { machine *DFA currentState *machine.State input string path []string rejected bool...
core/simulation/automata/dfa/dfa_simulation.go
0.601477
0.403391
dfa_simulation.go
starcoder
package gointegration import ( "fmt" "net/http" "regexp" "strings" "testing" "github.com/btm6084/gojson" "github.com/stretchr/testify/assert" ) // ClientResponse holds the pertinent information returned from a third party request. type ClientResponse struct { Body string `json:"body"` Cook...
response.go
0.769773
0.436022
response.go
starcoder
package dax // AttributeBuffer holds per-vertex attribute. There is one AttributeBuffer per // kind of data we want to keep with each vertex. type AttributeBuffer struct { Name string NumComponents int Data []float32 } func NewAttributeBuffer(name string, size int, NumComponents int) *AttributeBu...
mesh.go
0.803945
0.510252
mesh.go
starcoder
package wm import ( "fmt" "github.com/aaronjanse/3mux/ecma48" ) // A Split splits a region of the screen into a areas reserved for multiple child nodes type split struct { verticallyStacked bool elements []SizedNode selectionIdx int renderer ecma48.Renderer renderRect Rect selec...
wm/split.go
0.514156
0.412234
split.go
starcoder
package main import ( "math" "math/rand" "time" ) type Boid struct { position Vector2d velocity Vector2d id int } func (b *Boid) calcAcceleration() Vector2d { upper, lower := b.position.AddV(viewRadius), b.position.AddV(-viewRadius) sumVelocity := Vector2d{0,0} sumPosition := Vector2d{0,0} separation := Ve...
boid.go
0.524395
0.462473
boid.go
starcoder
package simulation import ( "fmt" "log" "math/rand" "strings" _ "embed" ) //go:embed alien-names.txt var alienNames string // Simulation stores the state of the simulation. type Simulation struct { iterationCounter int iterationLimit int // citiesMap represents a graph as an adjacency list. worldMap Wor...
internal/simulation/simulation.go
0.63624
0.510192
simulation.go
starcoder
package histogram import ( "fmt" "sort" "strconv" "strings" "time" "github.com/360EntSecGroup-Skylar/excelize" "github.com/grokify/gocharts/data/table" "github.com/grokify/gocharts/data/table/format" "github.com/grokify/gocharts/data/table/sheet" "github.com/grokify/gocharts/data/timeseries" "github.com/gr...
data/histogram/histogram_set.go
0.801237
0.505737
histogram_set.go
starcoder