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 proto import ( "math" "reflect" ) func MarshalBool(b *Buffer, fieldIndex uint64, value bool) error { if !value { return nil } b.EncodeVarint(makeWireTag(fieldIndex, WireVarint)) if value { b.buf = append(b.buf, 1) } else { b.buf = append(b.buf, 0) } return nil } func MarshalInt32(b *Buffer...
vendor/github.com/davyxu/protoplus/proto/field_marshal.go
0.551815
0.455622
field_marshal.go
starcoder
package render import ( "image" "image/color" "math" ) type Image16Bit struct { imageData *image.RGBA } func NewImage16Bit(x int, y int, width int, height int) *Image16Bit { return &Image16Bit{ imageData: image.NewRGBA(image.Rect(x, y, x+width, y+height)), } } func ConvertPixelsToImage16Bit(sourcePixels [][...
render/image16bit.go
0.792946
0.457258
image16bit.go
starcoder
package draw import ( "github.com/faiface/pixel" "github.com/faiface/pixel/imdraw" "image/color" ) type vector = pixel.Vec func v(x, y float64) vector { return pixel.V(x, y) } // Board draws a tic-tac-toe board of squares where // length is length of sides of squares, // thickness is thickness of lines on board...
draw/draw.go
0.697506
0.488039
draw.go
starcoder
package vector import ( "fmt" "github.com/liyue201/gostl/utils/iterator" ) // Options holds the Vector's options type Options struct { capacity int } // Option is a function type used to set Options type Option func(option *Options) // WithCapacity is used to set the capacity of a Vector func WithCapacity(capaci...
ds/vector/vector.go
0.835316
0.538194
vector.go
starcoder
package codec import ( "time" "github.com/juju/errors" "github.com/pingcap/tidb/mysql" "github.com/pingcap/tidb/util/types" ) const ( nilFlag byte = 0 bytesFlag byte = 1 compactBytesFlag byte = 2 intFlag byte = 3 uintFlag byte = 4 floatFlag byte = 5 decimalFlag ...
util/codec/codec.go
0.555676
0.426799
codec.go
starcoder
package graphql import ( "reflect" "strconv" "time" ) type Result reflect.Value func (q Result) Q(a interface{}) Result { v := reflect.Value(q) for v.Kind() == reflect.Interface { v = v.Elem() } if v.Kind() == reflect.Map { return Result(v.MapIndex(reflect.ValueOf(a))) } else if v.Kind() == reflect.Slice...
result.go
0.522202
0.407746
result.go
starcoder
package sketchy import "math" // Generates a Chaikin curve given a set of control points, // a cutoff ratio, and the number of steps to use in the // calculation. func Chaikin(c Curve, q float64, n int) Curve { points := []Point{} // Start with control points points = append(points, c.Points...) left := q / 2 ri...
curves.go
0.846101
0.562837
curves.go
starcoder
package reflecthelper import ( "net" "net/url" "reflect" "time" ) // List of reflect.Type used in this package var ( TypeRuneSlice = reflect.TypeOf([]rune{}) TypeByteSlice = reflect.TypeOf([]byte{}) TypeTimePtr = reflect.TypeOf(new(time.Time)) TypeTime = reflect.TypeOf(time.Time{}) TypeDuratio...
vendor/github.com/fairyhunter13/reflecthelper/v4/type.go
0.613584
0.467028
type.go
starcoder
package smd // EPThruster defines a EPThruster interface. type EPThruster interface { // Returns the minimum power and voltage requirements for this EPThruster. Min() (voltage, power uint) // Returns the max power and voltage requirements for this EPThruster. Max() (voltage, power uint) // Returns the thrust in N...
thrusters.go
0.885737
0.45048
thrusters.go
starcoder
package blockchain import ( "crypto/sha256" "errors" "math" "math/big" "personal/GoBlockchain/utils" ) //ErrFailedBlock is returned in case block fails to enter the blockchain var ErrFailedBlock = errors.New("Failed to incorporate block into blockchain") /*ProofOfWork defines the work that has to be done in ord...
blockchain/proof.go
0.532182
0.431884
proof.go
starcoder
package activation import ( "math/rand" "sync" "github.com/dowlandaiello/eve/common" ) // ParameterInitializationOption is an initialization option used to modify a // parameter's behavior. type ParameterInitializationOption = func(param Parameter) Parameter // LockedParameter is a data type used to synchronize ...
activation/parameter.go
0.844281
0.58166
parameter.go
starcoder
package game import ( "fmt" "math/rand" ) // BoardElement represents single object on the game board type BoardElement int // BoardElement can be one of the following colors const ( None BoardElement = 0 Red BoardElement = 1 Green BoardElement = 2 Yellow BoardElement = 3 Blue BoardElement = 4 Ma...
game/game.go
0.65368
0.449695
game.go
starcoder
package ast import ( "math" ) // Kind constants. const ( KindNull byte = 0 KindInt64 byte = 1 KindUint64 byte = 2 KindFloat32 byte = 3 KindFloat64 byte = 4 KindString byte = 5 KindBytes byte = 6 KindMysqlBit byte = 7 KindMysqlDecimal byte = 8 KindMys...
ast/datum.go
0.697506
0.424651
datum.go
starcoder
package scheduler import ( "math" "time" "github.com/hashicorp/nomad/nomad/structs" ) const ( // skipScoreThreshold is a threshold used in the limit iterator to skip nodes // that have a score lower than this. -1 is the lowest possible score for a // node with penalties (based on job anti affinity and node res...
vendor/github.com/hashicorp/nomad/scheduler/stack.go
0.75037
0.420243
stack.go
starcoder
package chaakoo // Pane represents a TMUX pane in a 2D grid type Pane struct { Name string // Name of the pane XStart int // First index in the horizontal direction XEnd int // Last index in the horizontal direction YStart int // First index in the vertical ...
pane.go
0.762954
0.568595
pane.go
starcoder
package schemas import ( "fmt" "html" "math" "sort" "strconv" "strings" ) type psqlFormatter struct{} func NewPSQLFormatter() SchemaFormatter { return psqlFormatter{} } func (f psqlFormatter) Format(schemaDescription SchemaDescription) string { docs := []string{} sortTables(schemaDescription.Tables) for _...
internal/database/migration/schemas/formatter_psql.go
0.506591
0.54958
formatter_psql.go
starcoder
package google import ( "errors" "fmt" "strings" ) /** Used to store a row of data */ type SheetData struct { //Store the values in the row Values [][]interface{} //[row][col] //Store the Headers Headers []string //Store a map from the Headers to location headersLoc map[string]int //Store a list of ori...
google/SheetData.go
0.546254
0.522385
SheetData.go
starcoder
package types const ( BipolarSigmoid = "bipolar-sigmoid" MultilayerPerceptron = "mlp" ) var activationFuncs = []string{BipolarSigmoid} var nets = []string{MultilayerPerceptron} // ActivationFuncs returns the list of supported neuron activation functions func ActivationFuncs() []string { return activationFuncs } ...
api/types/types.go
0.865366
0.53959
types.go
starcoder
Cams */ //----------------------------------------------------------------------------- package sdf import ( "fmt" "math" ) //----------------------------------------------------------------------------- // Flat Flank Cams type FlatFlankCamSDF2 struct { distance float64 // center to center circle distance ...
sdf/cams.go
0.775265
0.505249
cams.go
starcoder
package vtree import ( "strings" "testing" ) // AssertElementCount asserts the number of elements func AssertElementCount(t *testing.T, elements []*Element, count int) { if l := len(elements); l != count { t.Errorf("Expected %d elements but got %d", count, l) } } // AssertElement asserts that el is of the spec...
vtree/vtree_helpers.go
0.600188
0.435241
vtree_helpers.go
starcoder
package matrix import ( "github.com/pkg/errors" "strconv" "strings" ) // Matrix represents a two dimensional matrix type Matrix struct { table [][]int } // New creates a new Matrix from a given string, // such as that "1 4 9\n16 25 36" will create a matrix representing: // 0 1 2 // |----------- // 0 |...
matrix/matrix.go
0.754553
0.437283
matrix.go
starcoder
package day02 import ( "fmt" "io" "os" "sort" "strconv" "strings" "unicode/utf8" ) /* Solve1 solves the following AOC problem: The elves are running low on wrapping paper, and so they need to submit an order for more. They have a list of the dimensions (length l, width w, and height h) of each present, and o...
day02/day02.go
0.604866
0.563858
day02.go
starcoder
package nmea import ( "fmt" "github.com/martinlindhe/unit" ) const ( // TypeVWR type for VWR sentences TypeVWR = "VWR" LeftOfBow = "L" RightOfBow = "R" ) // Sentence info: // 1 Measured angle relative to the vessel, left/right of vessel heading, to the nearest 0.1 degree // 2 L: Left, or R: Right // 3...
vwr.go
0.677367
0.418875
vwr.go
starcoder
package convert import "strconv" // ToInt convert to int func ToInt(str interface{}) int { switch str.(type) { case uint: return int(str.(uint)) case uint64: return int(str.(uint64)) case int: return str.(int) case int64: return int(str.(int64)) case string: atoi, _ := strconv.Atoi(str.(string)) ret...
convert/number.go
0.503174
0.481515
number.go
starcoder
package primitives import ( "github.com/alexandreLamarre/Golang-Ray-Tracing-Renderer/pkg/algebra" "github.com/alexandreLamarre/Golang-Ray-Tracing-Renderer/pkg/canvas" "math" ) //Cube defines a 3d cube Shape type Cube struct { parent Shape transform *algebra.Matrix material *canvas.Material } //NewCube retu...
pkg/geometry/primitives/cube.go
0.735357
0.469095
cube.go
starcoder
package ent import ( "fmt" "strings" "time" "entgo.io/ent/dialect/sql" "github.com/DanielTitkov/anomaly-detection-service/internal/repository/entgo/ent/detectionjob" ) // DetectionJob is the model entity for the DetectionJob schema. type DetectionJob struct { config `json:"-"` // ID of the ent. ID int `json...
internal/repository/entgo/ent/detectionjob.go
0.72526
0.422624
detectionjob.go
starcoder
package stream import ( "os" "testing" "vincent.click/pkg/preflight/expect" ) // Writable is a set of expectations about a writable stream type Writable struct { *testing.T r reader b []byte } // ExpectWritten returns expectations based on a function that writes to a stream func ExpectWritten(t *testing.T, c...
stream/writable.go
0.768386
0.470493
writable.go
starcoder
package binomial import ( "golang.org/x/exp/constraints" ) const ( isNil = 0 notNil = 1 ) // Binomial is a binomial queue type Binomial[O constraints.Ordered] struct { size int trees []*node[O] } // New return a binomial queue with default capacity func New[O constraints.Ordered]() *Binomial[O] { return &Bi...
pq/binomial/binomial.go
0.575349
0.47171
binomial.go
starcoder
package interfaces //UserPermission Permissions are based on a 64bit uint64, the following is comparisons for that type UserPermission uint64 //So quick overview of how this will work //We choose powers of 2 //1, 2, 4, 8... because in binary these map to specific bits //0001, 0010, 0100, 1000 //When you bit-and two n...
interfaces/permissions.go
0.649245
0.428114
permissions.go
starcoder
package honu import ( "math" "math/rand" ) // BanditStrategy specifies the methods required by an algorithm to compute // multi-armed bandit probabilities for reinforcement learning. The basic // mechanism allows you to initialize a strategy with n arms (or n choices). // The Select() method will return a selected ...
bandit.go
0.868952
0.670494
bandit.go
starcoder
package utils import ( "fmt" "strconv" "strings" ) // GetIndexFromKey return an int index out of query part if possible func GetIndexFromKey(key string) (bool, bool, int, error) { before := false after := false key = strings.Replace(key, "[", "", -1) key = strings.Replace(key, "]", "", -1) if len(key) == 0 ...
utils/utils.go
0.597843
0.435541
utils.go
starcoder
package mod import ( "errors" "fmt" "io" "github.com/nsf/sexp" ) // Point2D represents a point in 2-dimensional space. type Point2D struct { X float64 `json:"x"` Y float64 `json:"y"` } // FpLine represents a graphical line. type FpLine struct { Start Point2D `json:"start"` End Point2D `json:"end"` Layer ...
src/kcdb/mod/modDecoder.go
0.757166
0.400691
modDecoder.go
starcoder
package af import ( "reflect" ) // Definition is a struct containing a function definition type Definition struct { Inputs []interface{} // an array of types or kinds Output interface{} // the type or kind returned by the defined function } // IsBoolean returns true if the definition returns a boolean value. f...
pkg/af/Definition.go
0.690872
0.428652
Definition.go
starcoder
package stats import ( "fmt" "sort" "sync" ) type rootScope struct { c Collector sync.Mutex counters map[string]*atomicInt64Vector gauges map[string]*atomicInt64Vector histograms map[string]*histogramVector } func RootScope(c Collector) Scope { return scopeWrapper{ &rootScope{ c: c, ...
vendor/github.com/upfluence/stats/root_scope.go
0.534127
0.577674
root_scope.go
starcoder
package main import( "fmt" "strconv" ) // Thought about big-O for here and figured it's all ∈ O(1) since they all take only a single input // value and the value of that input has no real effect on the number of operations - except // PopCountSmartShift, but even there the max n of 64 is negligible. // pc[i] is p...
ch02/popcount/popcount.go
0.538255
0.476092
popcount.go
starcoder
package corner import "math" // Rose generates a set of n evenly-spaced Directions func Rose(n int, offset float64) []Direction { dirs := make([]Direction, n) if offset == 0 { // special cases north := rectDirection{0, -1} south := rectDirection{0, 1} east := rectDirection{1, 0} west := rectDirection{-1, ...
corner/direction.go
0.821796
0.509825
direction.go
starcoder
package big_polynomial import ( "math/big" "github.com/PaddlePaddle/PaddleDTX/crypto/common/math/rand" ) type PolynomialClient struct { // A big prime which is used for Galois Field computing prime *big.Int } // New new PolynomialClient with a prime func New(prime *big.Int) *PolynomialClient { pc := new(Polyn...
crypto/common/math/big_polynomial/polynomial.go
0.622574
0.542136
polynomial.go
starcoder
package main import ( "github.com/go-gl/gl/v4.1-core/gl" ) // ShaderData Maps shader data type ShaderData struct { VertexAttributes uint32 NormalAttributes uint32 VertexTextureCoords uint32 } // InstanceShader Stores shader data var InstanceShader ShaderData // ShaderVertex Defines code for vertex ...
shader.go
0.760384
0.416441
shader.go
starcoder
package schemax import "sync" /* MatchingRuleUseCollection describes all MatchingRuleUses-based types. */ type MatchingRuleUseCollection interface { // Get returns the *MatchingRuleUse instance retrieved as a result // of a term search, based on Name or OID. If no match is found, // nil is returned. Get(interface...
mru.go
0.77552
0.485539
mru.go
starcoder
package types import ( "fmt" sdk "github.com/Dipper-Labs/Dipper-Protocol/types" ) // Minter represents the minting state. type Minter struct { Inflation sdk.Dec `json:"inflation" yaml:"inflation"` // current annual inflation rate AnnualProvisions sdk.Dec `json:"annual_provisions" yaml:"a...
app/v0/mint/internal/types/minter.go
0.832985
0.443118
minter.go
starcoder
package voprf import ( "github.com/bytemare/cryptotools/encoding" "github.com/bytemare/cryptotools/hashtogroup/group" ) type ppbEncoded struct { BlindedGenerator []byte `json:"g"` BlindedPubKey []byte `json:"p"` } // PreprocessedBlind groups pre-computed values to be used as blinding by the Client/Verifier. t...
.old/client.go
0.603114
0.40204
client.go
starcoder
package main import "sort" // Topic represents a CLI topic. // For example, in the command `heroku apps:create` the topic would be `apps`. type Topic struct { Name string `json:"name"` Description string `json:"description"` Hidden bool `json:"hidden"` Namespace *Namespace `json:"names...
topic.go
0.721841
0.400251
topic.go
starcoder
package aes import "encoding/binary" // rotword perform a left rotation on the s of a word func rotword(word uint32) uint32 { return word<<8 | word>>24 } // subword applies the AES S-box to a 4-byte word func subword(word uint32) (output uint32) { s := make([]byte, 4) wb := make([]byte, 4) binary.BigEndian.PutUi...
aes/block.go
0.661376
0.547525
block.go
starcoder
package rasterize import "github.com/RH12503/Triangula/geom" // DDATriangleLines calls function line for each horizontal line a geom.Triangle covers // using a digital differential analyzing algorithm. func DDATriangleLines(triangle geom.Triangle, line func(x0, x1, y int)) { p0 := triangle.Points[0] p1 := triangle....
rasterize/lines.go
0.628407
0.815012
lines.go
starcoder
package metrics import ( "context" "fmt" "sync" "time" "github.com/Jeffail/benthos/v3/internal/docs" "github.com/Jeffail/benthos/v3/lib/log" "github.com/Jeffail/benthos/v3/lib/types" "github.com/Jeffail/benthos/v3/lib/util/aws/session" "github.com/aws/aws-sdk-go/aws" "github.com/aws/aws-sdk-go/aws/request" ...
lib/metrics/cloudwatch.go
0.709724
0.510558
cloudwatch.go
starcoder
package client import ( "encoding/json" ) // MemorySummary struct for MemorySummary type MemorySummary struct { TotalSystemMemoryGiB NullableFloat32 `json:"TotalSystemMemoryGiB,omitempty"` TotalSystemPersistentMemoryGiB NullableFloat32 `json:"TotalSystemPersistentMemoryGiB,omitempty"` Status *Status `json:"Statu...
client/model_memory_summary.go
0.812682
0.42185
model_memory_summary.go
starcoder
package monkit import ( "sort" ) // FloatDist keeps statistics about values such as // low/high/recent/average/quantiles. Not threadsafe. Construct with // NewFloatDist(). Fields are expected to be read from but not written to. type FloatDist struct { // Low and High are the lowest and highest values observed sinc...
vendor/github.com/spacemonkeygo/monkit/v3/floatdist.go
0.716417
0.604807
floatdist.go
starcoder
package datadog import ( "encoding/json" ) // GetCreator returns the Creator field if non-nil, zero value otherwise. func (a *Alert) GetCreator() int { if a == nil || a.Creator == nil { return 0 } return *a.Creator } // GetOkCreator returns a tuple with the Creator field if it's non-nil, zero value otherwise /...
vendor/github.com/zorkian/go-datadog-api/datadog-accessors.go
0.789031
0.434761
datadog-accessors.go
starcoder
package converter import ( "context" "go.opentelemetry.io/collector/consumer" "go.opentelemetry.io/collector/consumer/consumerdata" "go.opentelemetry.io/collector/consumer/pdata" "go.opentelemetry.io/collector/consumer/pdatautil" "go.opentelemetry.io/collector/translator/internaldata" ) // NewInternalToOCTrace...
consumer/converter/converter.go
0.607663
0.438966
converter.go
starcoder
package licensediff import ( "github.com/swinslow/spdx-go/v0/spdx" ) // LicensePair is a result set where we are talking about two license strings, // potentially differing, for a single filename between two SPDX Packages. type LicensePair struct { First string Second string } // MakePairs essentially just conso...
v0/licensediff/licensediff.go
0.668664
0.400867
licensediff.go
starcoder
package gologic import "container/list" type color int const ( red color = iota black ) type Element interface { Key() int Merge(Element) Element } type Rbnode struct { color color element Element left *Rbnode right *Rbnode } func Node(e Element) *Rbnode { return &Rbnode{red,e,nil,nil} } func case1 (colo...
redblack.go
0.68616
0.4184
redblack.go
starcoder
package engine import ( "github.com/MathieuMoalic/mms/cuda" "github.com/MathieuMoalic/mms/data" ) var ( TotalShift, TotalYShift float64 // accumulated window shift (X and Y) in meter ShiftMagL, ShiftMagR, ShiftMagU, ShiftMagD data.Vector // when shiftin...
engine/shift.go
0.552298
0.434221
shift.go
starcoder
package graphutil import ( "container/heap" "fmt" ) // Edge represents a line from one node to another type Edge struct { Cost int Node Node } // Node is a structure to hold graphs type Node struct { Value int Children []Edge marked bool } // CostType is a structure to hold shortest distance from a node...
graphutil/graphutil.go
0.737631
0.42471
graphutil.go
starcoder
package tables import ( "fmt" "github.com/aaronland/go-sqlite" ) // TBD: move these in to aaronland/go-sqlite ? // WrapError returns a new error wrapping 'err' and prepending with the value of 't's Name() method. func WrapError(t sqlite.Table, err error) error { return fmt.Errorf("[%s] %w", t.Name(), err) } // I...
vendor/github.com/whosonfirst/go-whosonfirst-sqlite-features/tables/error.go
0.80525
0.400984
error.go
starcoder
// nolint: lll package projects import ( "reflect" "github.com/pkg/errors" "github.com/pulumi/pulumi/sdk/go/pulumi" ) // Four different resources help you manage your IAM policy for a project. Each of these resources serves a different use case: // // * `projects.IAMPolicy`: Authoritative. Sets the IAM policy f...
sdk/go/gcp/projects/iamauditConfig.go
0.633864
0.446495
iamauditConfig.go
starcoder
package pretty_poly import "math" type geohash struct { values [ ] bool } type geohash2d struct { xs [ ] bool ys [ ] bool } type interval struct { lower float64 upper float64 } type interval2d struct { x interval y interval } type point2d struct { x float64 y float64 } func Interval (lower fl...
src/github.com/rgrannell/pretty_poly/geocode.go
0.610918
0.626124
geocode.go
starcoder
package ffmpeg_go import ( "bytes" "fmt" ) type ViewType string const ( // FlowChart the diagram type for output in flowchart style (https://mermaid-js.github.io/mermaid/#/flowchart) (including current state ViewTypeFlowChart ViewType = "flowChart" // StateDiagram the diagram type for output in stateDiagram sty...
view.go
0.541894
0.469824
view.go
starcoder
package binary_tree_postorder_traversal /* 145. 二叉树的后序遍历 https://leetcode-cn.com/problems/binary-tree-postorder-traversal 给定一个二叉树,返回它的 后序 遍历。 示例: 输入: [1,null,2,3] 1 \ 2 / 3 输出: [3,2,1] */ type TreeNode struct { Val int Left *TreeNode Right *TreeNode } // 递归解决 func postorderTraversal(root ...
solutions/binary-tree-postorder-traversal/d.go
0.631935
0.493775
d.go
starcoder
package block import ( "github.com/df-mc/dragonfly/dragonfly/item" "github.com/df-mc/dragonfly/dragonfly/world" "github.com/go-gl/mathgl/mgl64" "math/rand" ) // MelonSeeds grow melon blocks. type MelonSeeds struct { crop // Direction is the direction from the stem to the melon. Direction world.Face } // Neig...
dragonfly/block/melon_seeds.go
0.585812
0.459319
melon_seeds.go
starcoder
package base32 import ( "errors" "fmt" ) // EncodedLen returns the length of the base32 encoding of an input buffer of length n. func EncodedLen(n int) int { return (n*8 + 4) / 5 } // Encode encodes src into EncodedLen(len(src)) digits of dst. // As a convenience, it returns the number of digits written to dst, /...
bech32/internal/base32/base32.go
0.693784
0.457197
base32.go
starcoder
package unit import ( "fmt" "math" "reflect" ) type LessConstraint struct { expected interface{} } func NewLessConstraint(expected interface{}) Constraint { switch reflect.ValueOf(expected).Kind() { case reflect.Int, reflect.Int8, reflect.Int16, reflect.Int32, reflect.Int64, reflect.Uint, reflect...
unit/less_constraint.go
0.71103
0.634062
less_constraint.go
starcoder
package models import ( i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91 "github.com/microsoft/kiota-abstractions-go/serialization" ) // CloudPcDomainJoinConfiguration type CloudPcDomainJoinConfiguration struct { // Stores additional data not described in the OpenAPI description found when d...
models/cloud_pc_domain_join_configuration.go
0.689515
0.420838
cloud_pc_domain_join_configuration.go
starcoder
package main import ( "log" "math" ) /** 题目:https://leetcode-cn.com/problems/divide-two-integers/ 两数相除 给定两个整数,被除数dividend和除数divisor。将两数相除,要求不使用乘法、除法和 mod 运算符。 返回被除数dividend除以除数divisor得到的商。 整数除法的结果应当截去(truncate)其小数部分,例如:truncate(8.345) = 8 以及 truncate(-2.7335) = -2 示例1: 输入: dividend = 10, divisor = 3 输出: 3 解释...
algorithm/leetcodeQuestion/divide/divide.go
0.608012
0.442155
divide.go
starcoder
package plaid import ( "encoding/json" ) // ProcessorNumber An object containing identifying numbers used for making electronic transfers to and from the `account`. The identifying number type (ACH, EFT, IBAN, or BACS) used will depend on the country of the account. An account may have more than one number type. If...
plaid/model_processor_number.go
0.829699
0.547464
model_processor_number.go
starcoder
package gl import ( "fmt" "github.com/glycerine/gxui" "github.com/glycerine/gxui/math" "github.com/goxjs/gl" ) type shaderUniform struct { name string size int ty shaderDataType location gl.Uniform textureUnit int } func (u *shaderUniform) bind(context *context, v interface{}) { ...
drivers/gl/shader_uniform.go
0.50293
0.406361
shader_uniform.go
starcoder
package parse // Code for assignment, a little intricate as there are many cases and many // validity checks. import ( "robpike.io/ivy/value" ) // Assignment is an implementation of Value that is created as the result of an assignment. // It can be type-asserted to discover whether the returned value was created b...
parse/assign.go
0.662687
0.675042
assign.go
starcoder
package vec import ( "fmt" "math" ) // Vec2 is a 2D Vec2 type type Vec2 struct { X,Y float64 } // TypeError is a type alias for errors returned from the "type agnostic" operator methods exported by this package. type TypeError error // Add is a more type agnostic Add shorthand, that casts some compatible types t...
vec2.go
0.897812
0.555194
vec2.go
starcoder
package network import ( "fmt" "math" "errors" "github.com/elmware/goNEAT/neat/utils" ) // The connection descriptor for fast network type FastNetworkLink struct { // The index of source neuron SourceIndx int // The index of target neuron TargetIndx int // The weight of this link Weight float64 // The ...
neat/network/fast_network.go
0.682256
0.560674
fast_network.go
starcoder
package crosslink import ( "math" "unsafe" ) // CLPosImp is a position x-z interface type CLPosImp interface { x() CLPosValType z() CLPosValType } // CLNodeImp is a general node interface type CLNodeImp interface { CLPosImp isTriggerNode() bool isEntity() bool order() uint8 // here otherNode CLNodeImp sho...
aoi/aoi_cross_link/cross_list_node.go
0.58676
0.476945
cross_list_node.go
starcoder
package nbs import ( "bytes" "context" "crypto/sha512" "encoding/base32" "encoding/binary" "hash/crc32" "io" "sync" "github.com/dolthub/dolt/go/store/atomicerr" "github.com/dolthub/dolt/go/store/chunks" "github.com/dolthub/dolt/go/store/hash" ) /* An NBS Table stores N byte slices ("chunks") which are...
go/store/nbs/table.go
0.674694
0.403479
table.go
starcoder
package types import ( "encoding/json" "math/big" "<KEY>" "<KEY>" cbor "<KEY>" "gx/ipfs/QmdBzoMxsBpojBfN1cv5GnKtB7sfYBMoLH7p9qSyEVYXcu/refmt/obj/atlas" ) // NOTE -- All *BytesAmount methods must call ensureBytesAmounts with refs to every user-supplied value before use. func init() { cbor.RegisterCborType(byt...
types/bytes_amount.go
0.776962
0.443841
bytes_amount.go
starcoder
package gript import ( "errors" "fmt" "reflect" "regexp" "strings" ) type intExpression int func (e intExpression) Eval(c Context) (interface{}, error) { return int(e), nil } type floatExpression float64 func (e floatExpression) Eval(c Context) (interface{}, error) { return float64(e), nil } type stringExp...
expression.go
0.598782
0.433262
expression.go
starcoder
package iso20022 // Net position of a segregated holding, in a single security, within the overall position held in a securities account at a specified place of safekeeping. type AggregateBalancePerSafekeepingPlace30 struct { // Place where the securities are safe-kept, physically or notionally. This place can be, ...
AggregateBalancePerSafekeepingPlace30.go
0.876872
0.424949
AggregateBalancePerSafekeepingPlace30.go
starcoder
package color import ( "image/color" "math" "math/rand" "github.com/jphsd/graphics2d/util" ) // HSL describes a color in HSL space. All values are in range [0,1]. type HSL struct { H, S, L, A float64 } // HSL conversions (see https://www.w3.org/TR/css-color-3/#hsl-color) // RGBA implements the RGBA function f...
color/hsl.go
0.807271
0.455622
hsl.go
starcoder
package world import ( "github.com/hajimehoshi/ebiten" "github.com/hajimehoshi/ebiten/ebitenutil" "github.com/stephenhoran/reborn/utilities" "image/color" "log" "strconv" ) type Chunks map[string]*Chunk type Chunk struct { tiles [][]*Tile x int y int } func (c Chunks) NewChunk(x, y int) { chunk := Chunk{...
world/chunk.go
0.657209
0.400046
chunk.go
starcoder
package p0 import "fmt" /* 给定一个按照升序排列的整数数组 nums,和一个目标值 target。 找出给定目标值在数组中的开始位置和结束位置。 你的算法时间复杂度必须是 O(log n) 级别。 如果数组中不存在目标值,返回 [-1, -1]。 示例 1: 输入: nums = [5,7,7,8,8,10], target = 8 输出: [3,4] 示例 2: 输入: nums = [5,7,7,8,8,10], target = 6 输出: [-1,-1] 来源:力扣(LeetCode) 链接:https://leetcode-cn.com/problems/find-first-a...
leetcode/p0/0034.go
0.514644
0.476153
0034.go
starcoder
package sync import ( "bytes" "github.com/pkg/errors" ) // EnsureValid ensures that Entry's invariants are respected. func (e *Entry) EnsureValid() error { // A nil entry is technically valid, at least in certain contexts. It // represents the absence of content. if e == nil { return nil } // Otherwise val...
pkg/sync/entry.go
0.693058
0.420897
entry.go
starcoder
package plaid import ( "encoding/json" ) // SenderBACSNullable struct for SenderBACSNullable type SenderBACSNullable struct { // The account number of the account. Maximum of 10 characters. Account *string `json:"account,omitempty"` // The 6-character sort code of the account. SortCode *string `json:"sort_code,...
plaid/model_sender_bacs_nullable.go
0.779574
0.41253
model_sender_bacs_nullable.go
starcoder
package vbptc import ( "errors" "fmt" ) var ( // See page 136 of the DMR AI. spec. for the generator matrix. hamming_16_11_generator_matrix = []byte{ 1, 0, 0, 1, 1, 1, 1, 0, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 1, 1, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 1, 1, 0, 1, 1, 0, 1, 1, 0, 0, 1, 0, 1, 1, ...
vbptc/vbptc.go
0.566738
0.454291
vbptc.go
starcoder
package schema import ( "fmt" "strings" log "github.com/sirupsen/logrus" ) // TypeRef is a GraphQL reference to a Type. type TypeRef struct { Name string `json:"name,omitempty"` Description string `json:"description,omitempty"` Kind Kind `json:"kind,omitempty"` OfType *TypeRef `json:"ofType,o...
internal/schema/typeref.go
0.727975
0.417093
typeref.go
starcoder
package definitions import ( "strings" ) // TypeCategory is the category to which a type belongs. // The different categories are defined as constants. type TypeCategory int const ( // Builtin types (int, int8, string, bool, etc) Builtin = TypeCategory(iota + 1) // Simple types. eg: `type myInt int` Simple /...
definitions/type.go
0.704364
0.449936
type.go
starcoder
package bigo import ( "fmt" "image/color" "math" "gonum.org/v1/plot/vg/draw" "github.com/montanaflynn/stats" "gonum.org/v1/plot" "gonum.org/v1/plot/plotter" "gonum.org/v1/plot/vg" ) // PlotSeriesList a list PlotSeries. type PlotSeriesList []PlotSeries // PlotSeries a list of result values assigned to a nam...
plot.go
0.808937
0.529872
plot.go
starcoder
package main /* Day 2: Part A: Given a space-separated list of space-separated numbers in a multi-line file compute the line-wise sum of checksums (highest-lowest number). ex: 5 1 9 5 = 8 7 5 3 = 4 2 4 6 8 = 6 checksum = 8 + 4 + 6 = 18 Part B: For each row, find the two numbers that cleanly divide into each o...
2017/day02.go
0.519278
0.446917
day02.go
starcoder
package models import ( i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91 "github.com/microsoft/kiota-abstractions-go/serialization" ) // BookingBusiness type BookingBusiness struct { Entity // The street address of the business. The address property, together with phone and webSiteUrl, a...
models/booking_business.go
0.541894
0.460532
booking_business.go
starcoder
package g2d import ( "math" ) var geometry_origin *Geometry // Geometry with only one vertex at (0,0) func NewGeometry_Origin() *Geometry { if geometry_origin == nil { // A singlton is shared for all the uses geometry_origin = NewGeometry().SetVertices([][2]float32{{0, 0}}) geometry_origin.BuildDataBuffers(tru...
g2d/geometry_examples.go
0.807005
0.701662
geometry_examples.go
starcoder
package regressions import ( "io/ioutil" "log" "os" "path" "path/filepath" "testing" "github.com/sylabs/singularity/e2e/internal/e2e" "github.com/sylabs/singularity/e2e/internal/testhelper" ) type regressionsTests struct { env e2e.TestEnv } // This test will build an image from a multi-stage definition //...
e2e/regressions/build.go
0.571408
0.499023
build.go
starcoder
package merkletree import ( "bytes" "crypto" ) // Verify returns true if the path given is valid. func (p Path) Verify1(leafContent []byte, hash crypto.Hash) (ok bool) { // Test plausibility of path. if !p.isPlausible() { return false } // Check if top element is ok. if !p[0].verifyMyLeafConstruction(leafCon...
merkletree/verify1.go
0.606265
0.423756
verify1.go
starcoder
package path import ( "math/rand" "sync" "time" ) func init() { rand.Seed(time.Now().UnixNano()) } // TransitEdge is a direct transportation between two locations. type TransitEdge struct { VoyageNumber string `json:"voyage"` Origin string `json:"origin"` Destination string `json:"destination"...
path/path.go
0.698227
0.50061
path.go
starcoder
package assert import ( "strings" "testing" "github.com/ppapapetrou76/go-testing/internal/pkg/values" ) // StringOpt is a configuration option to initialize an AssertableString. type StringOpt func(*AssertableString) // AssertableString is the implementation of CommonAssertable for string types. type AssertableS...
assert/string.go
0.797202
0.664778
string.go
starcoder
package money import ( "fmt" "math" "math/big" "github.com/wadey/go-rounding" ) // some operations var bigOne = big.NewInt(1) // temporary, before https://github.com/wadey/go-rounding/pull/6 is merged func roundToInt(rat *big.Rat, method rounding.RoundingMode) *big.Int { c := new(big.Rat).Set(rat) rounding....
operations.go
0.885582
0.569853
operations.go
starcoder
package main import ( "fmt" "math" "math/rand" "github.com/MattSwanson/raylib-go/raylib" "github.com/jakecoffman/cp" ) var grabbableMaskBit uint = 1 << 31 var grabFilter = cp.ShapeFilter{ cp.NO_GROUP, grabbableMaskBit, grabbableMaskBit, } func randUnitCircle() cp.Vector { v := cp.Vector{X: rand.Float64()*2.0...
examples/physics/chipmunk/main.go
0.62395
0.526586
main.go
starcoder
package message import ( "github.com/woojiahao/torrent.go/internal/message" . "github.com/woojiahao/torrent.go/internal/utility" "testing" ) type testType func(*testing.T, int, message.MessageID, ...byte) var block = []byte{25, 69, 112, 187, 115, 1, 0, 255, 199, 100, 1, 0} // Test with payload of <index><begi...
test/message/utility.go
0.639061
0.4081
utility.go
starcoder
package Challenge3_Cycle_in_a_Circular_Array /* We are given an array containing positive and negative numbers. Suppose the array contains a number ‘M’ at a particular index. Now, if ‘M’ is positive we will move forward ‘M’ indices and if ‘M’ is negative move backwards ‘M’ indices. You should assume that the array is ...
Pattern03 - Fast and Slow pointers/Challenge3-Cycle_in_a_Circular_Array/solution.go
0.750827
0.873323
solution.go
starcoder
package boolean import ( "sync" ) // MutexMatrix a matrix wrapper that has a mutex lock support type MutexMatrix struct { sync.RWMutex matrix Matrix } // NewMutexMatrix returns a MutexMatrix func NewMutexMatrix(matrix Matrix) *MutexMatrix { return &MutexMatrix{ matrix: matrix, } } // Columns the number of c...
boolean/mutexMatrix.go
0.860618
0.52141
mutexMatrix.go
starcoder
package diff import ( "github.com/dolthub/dolt/go/libraries/doltcore/row" "github.com/dolthub/dolt/go/libraries/doltcore/rowconv" "github.com/dolthub/dolt/go/libraries/doltcore/schema" "github.com/dolthub/dolt/go/libraries/doltcore/table/pipeline" "github.com/dolthub/dolt/go/libraries/utils/valutil" ) const ( ...
go/libraries/doltcore/diff/diff_splitter.go
0.619701
0.442155
diff_splitter.go
starcoder
package opr // These import ( "encoding/hex" "encoding/json" "errors" "fmt" "github.com/FactomProject/btcutil/base58" "github.com/FactomProject/factom" "github.com/pegnet/LXR256" "github.com/pegnet/pegnet/polling" "github.com/pegnet/pegnet/support" "github.com/zpatrick/go-config" "strings" "time" ) type ...
opr/opr.go
0.661376
0.406391
opr.go
starcoder
package main import ( "math" "math/rand" "syscall/js" "github.com/gmlewis/go-babylonjs/babylon" ) func main() { doc := js.Global().Get("document") canvas := doc.Call("getElementById", "renderCanvas") // Get the canvas element b := babylon.New() engine := b.NewEngine(canvas, &babylon.NewEngineOpts{Antialias...
examples/23-follow-camera/main.go
0.559049
0.450118
main.go
starcoder
package diff type ItemType int const ( Insertion ItemType = iota Unchanged Deletion ) func (t ItemType) String() string { switch t { case Insertion: return "+" case Unchanged: return " " case Deletion: return "-" } return "<error>" } // Item represents a single node in a diff result - it contains the...
patience.go
0.588653
0.401688
patience.go
starcoder
package operations // OPPushInt struct  represents a operation that pushes an integer onto the stack type OPPushInt struct { position Position value int64 } // NewOPPushInt function  creates a new OperationPushInt func NewOPPushInt(value int64, position Position) Operation { return OPPushInt{ value: ...
core/operations/push.go
0.822795
0.485844
push.go
starcoder
package rbf // Query the forest for a single point. Returns indices into the training feature-array // (since the caller/wrapper might have different things they want to do with this). // Since multiple trees might return the same result points, this method dedups the results. func (forest RandomBinaryForest) FindPoin...
rbf_search.go
0.774285
0.774924
rbf_search.go
starcoder