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 sliceutil import "reflect" // Compare will check if two slices are equal // even if they aren't in the same order // Inspired by github.com/stephanbaker white board sudo code func Compare(s1, s2 interface{}) bool { if s1 == nil || s2 == nil { return false } // Convert slices to correct type slice1 := c...
sliceutil.go
0.649801
0.406744
sliceutil.go
starcoder
Command aeremote is a simple Remote API client to download and upload data on Google App Engine Datastore. Dumping entities from development server One use case is to export your local datastore as a JSON file to be reused as a fixture in automated tests, or to bootstrap your app for local development. This can be do...
aeremote/doc.go
0.604983
0.563858
doc.go
starcoder
package kalman const EPS = 0.1 // Correction factor since KF is nonlinear type Filter struct { n int // Number of dimensions x Matrix // Kalman Filter hidden state p Matrix // Kalman Filter hidden state covariance q Matrix // Kalman Filter state noise process r Matrix // Measurem...
pkg/kalman/kalman.go
0.801587
0.655501
kalman.go
starcoder
package ckks import ( "math" "math/bits" ) func (evaluator *Evaluator) EvaluateCheby(ct *Ciphertext, cheby *ChebyshevInterpolation, evakey *EvaluationKey) (res *Ciphertext) { C := make(map[uint64]*Ciphertext) C[1] = ct.CopyNew().Ciphertext() evaluator.MultConst(C[1], 2/(cheby.b-cheby.a), C[1]) evaluator.AddC...
HE/ckks/chebyshev_evaluation.go
0.628521
0.415788
chebyshev_evaluation.go
starcoder
package tester import ( "fmt" "runtime" "testing" "github.com/stretchr/testify/assert" ) // callerSkip=3 will print the path of assert's path // which the one who call this package. const callerSkip int = 3 func getPath() string { _, file, line, _ := runtime.Caller(callerSkip) return fmt.Sprintf("AssertPath: ...
tester/assert.go
0.624523
0.415195
assert.go
starcoder
package chipmunk import ( "github.com/vova616/chipmunk/transform" "github.com/vova616/chipmunk/vect" "math" ) type PivotJoint struct { BasicConstraint Anchor1, Anchor2 vect.Vect r1, r2 vect.Vect k1, k2 vect.Vect jAcc vect.Vect jMaxLen vect.Float bias vect.Vect } func NewPivotJointAnchor(a, b *Body,...
pivotJoint.go
0.732305
0.542257
pivotJoint.go
starcoder
package bvh import ( "golang.org/x/exp/constraints" "math" ) type Vec2[I constraints.Signed | constraints.Float] [2]I func (v Vec2[I]) Add(other Vec2[I]) Vec2[I] { return Vec2[I]{v[0] + other[0], v[1] + other[1]} } func (v Vec2[I]) Sub(other Vec2[I]) Vec2[I] { return Vec2[I]{v[0] - other[0], v[1] - other[1]} } fun...
server/internal/bvh/vector.go
0.732209
0.46308
vector.go
starcoder
package insert_into_max_tree /* * @lc app=leetcode id=998 lang=golang * * [998] Maximum Binary Tree II * * https://leetcode.com/problems/maximum-binary-tree-ii/description/ * * algorithms * Medium (61.62%) * Total Accepted: 11.3K * Total Submissions: 18.3K * Testcase Example: '[4,1,3,null,null,2]\n5' *...
998-maximum-binary-tree-ii/998.maximum-binary-tree-ii.go
0.893891
0.453927
998.maximum-binary-tree-ii.go
starcoder
package contentstream import ( "math" . "github.com/unidoc/unidoc/pdf/core" ) type ContentCreator struct { operands ContentStreamOperations } func NewContentCreator() *ContentCreator { creator := &ContentCreator{} creator.operands = ContentStreamOperations{} return creator } // Get the list of operations. fu...
vendor/github.com/unidoc/unidoc/pdf/contentstream/creator.go
0.790773
0.47859
creator.go
starcoder
package bsconv import ( "fmt" "math/big" "strconv" ) // List of all digits from base2 to base62. const allDigits = "0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ" // Flag of the negative number. var flagNeg uint // Conversion converts number from an arbitrary base to another arbitrary base. func...
bsconv.go
0.626467
0.469216
bsconv.go
starcoder
package nifi import ( "encoding/json" ) // LineageResultsDTO struct for LineageResultsDTO type LineageResultsDTO struct { // Any errors that occurred while generating the lineage. Errors *[]string `json:"errors,omitempty"` // The nodes in the lineage. Nodes *[]ProvenanceNodeDTO `json:"nodes,omitempty"` // The ...
model_lineage_results_dto.go
0.749821
0.404302
model_lineage_results_dto.go
starcoder
package plaid import ( "encoding/json" ) // AccountBase A single account at a financial institution. type AccountBase struct { // Plaid’s unique identifier for the account. This value will not change unless Plaid can't reconcile the account with the data returned by the financial institution. This may occur, for e...
plaid/model_account_base.go
0.807992
0.459986
model_account_base.go
starcoder
package labels import ( "fmt" "sync" "github.com/janelia-flyem/dvid/dvid" ) var ( mc mergeCache labelsMerging dirtyCache labelsSplitting dirtyCache ) const ( // MaxAllowedLabel is the largest label that should be allowed by DVID if we want // to take into account the maximum integer size with...
datatype/common/labels/labels.go
0.744006
0.49408
labels.go
starcoder
package indexdb import ( "go.uber.org/atomic" "github.com/lindb/lindb/constants" ) // MetricIDMapping represents the metric id mapping, // tag hash code => series id type MetricIDMapping interface { // GetMetricID return the metric id GetMetricID() uint32 // GetSeriesID gets series id by tags hash, if exist re...
tsdb/indexdb/metric_id_mapping.go
0.75401
0.48987
metric_id_mapping.go
starcoder
package lea import "fmt" // These constants represent Encryption mode and Decryption mode. const ( EncryptMode = iota DecryptMode ) // Word represents 'unsigned 32-bit integer'. // LEA uses a 128-bit block. type Word uint32 func (w Word) String() string { return fmt.Sprintf("%08x", uint32(w)) } // converts a by...
lea.go
0.641535
0.603114
lea.go
starcoder
package plan import ( "io" "reflect" opentracing "github.com/opentracing/opentracing-go" "gopkg.in/src-d/go-mysql-server.v0/sql" ) // CrossJoin is a cross join between two tables. type CrossJoin struct { BinaryNode } // NewCrossJoin creates a new cross join node from two tables. func NewCrossJoin(left sql.Node...
vendor/gopkg.in/src-d/go-mysql-server.v0/sql/plan/cross_join.go
0.736685
0.444324
cross_join.go
starcoder
package k8szoo import ( "errors" "fmt" "math/rand" "strings" "time" ) type AnimalData struct { AnimalName string AnimalSound string PictureURL string } var Animals = []AnimalData{ {"Alligator", "bellowed", "https://upload.wikimedia.org/wikipedia/commons/6/65/AmericanAlligator.JPG"}, {"Antelope", "snorted...
src/animals.go
0.510252
0.444565
animals.go
starcoder
package blockcreator import ( "github.com/threefoldtech/rivine/modules" "github.com/threefoldtech/rivine/pkg/encoding/siabin" "github.com/threefoldtech/rivine/types" ) // ProcessConsensusChange will update the blockcreator's most recent block. func (bc *BlockCreator) ProcessConsensusChange(cc modules.ConsensusChan...
vendor/github.com/threefoldtech/rivine/modules/blockcreator/update.go
0.508056
0.514217
update.go
starcoder
package gonet import ( "log" "strconv" ) type Matrix [][]float64 func (m Matrix) Init(row, col int) Matrix { m = make(Matrix, row) for i := 0; i < row; i++ { m[i] = new(Vector).Init(col, 0.0) } return m } func (m Matrix) RandomFill() Matrix { for i := 0; i < m.NumRows(); i++ { for j := 0; j < m.NumCols()...
matrix.go
0.583915
0.467757
matrix.go
starcoder
package sort const ( insertionSortThreshold = 16 ) // A type, typically a collection, that satisfies sort.Interface can be // sorted by the routines in this package. The methods require that the // elements of the collection be enumerated by an integer index. type Interface interface { // Len is the number of eleme...
sort.go
0.739422
0.580233
sort.go
starcoder
package numbers import ( "encoding/json" "log" ) // tmplfn supports calculations with four types of numbers, // int64, int, float64 and float32. In Add, Substract, Mutliply, Divide, // and Modulo the input values are normalized to the highest bit width of the two. // If the input value is a string or json.Number it...
numbers/numbers.go
0.672869
0.652435
numbers.go
starcoder
// Package derefed contains helper routines for simplifying the getting of // optional fields of basic type. This allows you to get the value from the // pointer even if it is nil, and if the pointer is nil it returns a value of // second parameter. package derefed // Bool dereference a pointer bool from the structur...
derefed/derefed.go
0.750736
0.681608
derefed.go
starcoder
package transformer import ( "github.com/elseano/rundown/pkg/util" goldast "github.com/yuin/goldmark/ast" goldtext "github.com/yuin/goldmark/text" ) // Treatment is used to indicate a node should be modified, but batches // these modifications for after we've walked the AST, otherwise the // walker gets confused. ...
pkg/rundown/transformer/treatment.go
0.642096
0.424591
treatment.go
starcoder
package geo import ( "github.com/golang/geo/r3" "github.com/golang/geo/s2" ) // EdgeIntersection returns the intersection point between the edges (a-b) // and (c-d). func EdgeIntersection(a, b s2.Edge) s2.Point { va := s2.Point{Vector: a.V0.PointCross(a.V1).Normalize()} vb := s2.Point{Vector: b.V0.PointCross(b.V1...
geo/geo.go
0.790732
0.720012
geo.go
starcoder
package nanovgo import ( "math" ) // Paint structure represent paint information including gradient and image painting. // Context.SetFillPaint() and Context.SetStrokePaint() accept this instance. type Paint struct { xform TransformMatrix extent [2]float32 radius float32 feather float32 innerCol...
paint.go
0.884177
0.513546
paint.go
starcoder
package main import ( "github.com/go-gl/gl/v3.3-compatibility/gl" "github.com/adinfinit/zombies-on-ice/g" ) // Player player struct type Player struct { ID int Color g.Color Dead bool Health float32 Points float32 Controller Controller Survivor Entity Hammer Hammer } // Entities entities for ...
player.go
0.634656
0.405449
player.go
starcoder
package iso20022 // Net position of a segregated holding, in a single security, within the overall position held in a securities account. A securities balance is calculated from the sum of securities' receipts minus the sum of securities' deliveries. type AggregateBalanceInformation3 struct { // Total quantity of fi...
AggregateBalanceInformation3.go
0.885848
0.546436
AggregateBalanceInformation3.go
starcoder
package tracer import ( "encoding/json" "io" "math" "sync" "gopkg.in/DataDog/dd-trace-go.v1/ddtrace" "gopkg.in/DataDog/dd-trace-go.v1/ddtrace/ext" ) // Sampler is the generic interface of any sampler. It must be safe for concurrent use. type Sampler interface { // Sample returns true if the given span should ...
vendor/gopkg.in/DataDog/dd-trace-go.v1/ddtrace/tracer/sampler.go
0.81257
0.566798
sampler.go
starcoder
package bufalloc import ( "io" ) // A Buffer is a variable-sized buffer of bytes with Read and Write methods. type Buffer interface { // Alloc allocs n bytes of slice from the buffer, growing the buffer as needed. // If n is negative, Alloc will panic. If the buffer can't grow it will panic with bytes.ErrTooLarge....
util/bufalloc/buffer.go
0.563378
0.434461
buffer.go
starcoder
package processor import ( "fmt" "time" "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/util/text" "github.com/Jeffail/benthos/v3/lib/x/docs" ) //---------------------------------------------------...
lib/processor/log.go
0.778144
0.758153
log.go
starcoder
package gconv import "reflect" // SliceFloat is alias of Floats. func SliceFloat(any interface{}) []float64 { return Floats(any) } // SliceFloat32 is alias of Float32s. func SliceFloat32(any interface{}) []float32 { return Float32s(any) } // SliceFloat64 is alias of Float64s. func SliceFloat64(any interface{}) [...
util/gconv/gconv_slice_float.go
0.565059
0.401189
gconv_slice_float.go
starcoder
package fieldpath import ( "fmt" "sort" "strings" "sigs.k8s.io/structured-merge-diff/v3/value" ) // PathElement describes how to select a child field given a containing object. type PathElement struct { // Exactly one of the following fields should be non-nil. // FieldName selects a single field from a map (r...
vendor/sigs.k8s.io/structured-merge-diff/v3/fieldpath/element.go
0.732592
0.448487
element.go
starcoder
package opcode import ( "context" "fmt" "github.com/google/gapid/core/data/binary" "github.com/google/gapid/gapis/replay/protocol" "github.com/google/gapid/gapis/replay/value" ) // Opcode represents a single opcode used by GAPIR. type Opcode interface { isOpcode() } func bit(bits, idx uint32) bool { if bits...
gapis/replay/opcode/opcodes.go
0.592667
0.764979
opcodes.go
starcoder
package backend import ( "math/rand" ) // MakeMatrix intializes an empty matrix. func MakeMatrix(size int) (m [][]int) { m = make([][]int, size) for i := range m { m[i] = make([]int, size) } return m } // CopyMatrix returns a duplicate of `matrix`. func CopyMatrix(matrix [][]int) [][]int { duplicate := make(...
backend/backend.go
0.764012
0.473596
backend.go
starcoder
package lzma // states defines the overall state count const states = 12 // State maintains the full state of the operation encoding or decoding // process. type state struct { rep [4]uint32 isMatch [states << maxPosBits]prob isRepG0Long [states << maxPosBits]prob isRep [states]prob isRepG0 ...
vendor/github.com/ulikunitz/xz/lzma/state.go
0.700485
0.599925
state.go
starcoder
package Euler2D import ( "math" "github.com/notargets/gocfd/utils" "github.com/notargets/gocfd/model_problems/Euler2D/isentropic_vortex" ) func (c *Euler) WallBC(k, Kmax int, Q_Face [4]utils.Matrix, ishift int, normal [2]float64, normalFlux [][4]float64) { var ( Nedge = c.dfr.FluxElement.Nedge ) for i := 0;...
model_problems/Euler2D/bcs.go
0.711631
0.473901
bcs.go
starcoder
package node // Visitor is the interface that defines the functions a concrete visitor should implement. type Visitor interface { VisitProgramNode(node *ProgramNode) VisitContractNode(node *ContractNode) VisitFieldNode(node *FieldNode) VisitStructNode(node *StructNode) VisitStructFieldNode(node *StructFieldNode) ...
parser/node/visitor.go
0.522202
0.737867
visitor.go
starcoder
package plaid import ( "encoding/json" ) // TransactionStream A grouping of related transactions type TransactionStream struct { // The ID of the account to which the stream belongs AccountId string `json:"account_id"` // A unique id for the stream StreamId string `json:"stream_id"` // The ID of the category t...
plaid/model_transaction_stream.go
0.848094
0.409693
model_transaction_stream.go
starcoder
package opcodes import ( "encoding/binary" "github.com/pkg/errors" ) type ParsedOpCode struct { OpValue byte Length int Data []byte } // isDisabled returns whether or not the opCode is disabled and thus is always // bad to see in the instruction stream (even if turned off by a conditional). func (parsedOpCo...
model/opcodes/parsedopcode.go
0.589953
0.4231
parsedopcode.go
starcoder
package gomfa func Ld(bm float64, p *[3]float64, q *[3]float64, e *[3]float64, em float64, dlim float64, p1 *[3]float64) { /* ** - - - ** L d ** - - - ** ** Apply light deflection by a solar-system body, as part of ** transforming coordinate direction into natural direction. ** ** Given: ** ...
ld.go
0.832475
0.725293
ld.go
starcoder
// Package crc64 implements the 64-bit cyclic redundancy check, or CRC-64, // checksum. See http://en.wikipedia.org/wiki/Cyclic_redundancy_check for // information. package crc64 import "hash" // The size of a CRC-64 checksum in bytes. const Size = 8 // Predefined polynomials. const ( // The ISO polynomial, define...
go1.5/src/hash/crc64/crc64.go
0.887887
0.466238
crc64.go
starcoder
package gomel import "gitlab.com/alephledger/core-go/pkg/crypto" // Dag is the main data structure of the Aleph consensus protocol. It is built of units partially ordered by "is-parent-of" relation. type Dag interface { // EpochID is a unique identifier of the epoch for this dag instance. EpochID() EpochID // Deco...
pkg/gomel/dag.go
0.736495
0.519156
dag.go
starcoder
package v1alpha1 // JobListerExpansion allows custom methods to be added to // JobLister. type JobListerExpansion interface{} // JobNamespaceListerExpansion allows custom methods to be added to // JobNamespaceLister. type JobNamespaceListerExpansion interface{} // JobRunListerExpansion allows custom methods to be a...
client/listers/datascience/v1alpha1/expansion_generated.go
0.585101
0.431464
expansion_generated.go
starcoder
package bitfield import ( "github.com/kiambogo/go-hypercore/mempager" ) type Bitfield struct { pager *mempager.Pager byteLength uint64 } func NewBitfield(pageSize int) *Bitfield { pgr := mempager.NewPager(pageSize) return &Bitfield{pager: &pgr} } // PageSize returns the size of the pages used by the inter...
bitfield/bitfield.go
0.826572
0.401101
bitfield.go
starcoder
package field import ( "fmt" "time" ) func Any(key string, value interface{}) Field { return Key(key).Any(value) } func String(key, value string) Field { return Key(key).String(value) } func Stringp(key string, value *string) Field { return Key(key).Stringp(value) } func Strings(key string, value ...string) F...
field/field.go
0.744563
0.480357
field.go
starcoder
package model import ( "time" ) type EnhancedWatermarkFilter struct { // Name of the resource. Can be freely chosen by the user. Name string `json:"name,omitempty"` // Description of the resource. Can be freely chosen by the user. Description string `json:"description,omitempty"` // Creation timestamp formatted ...
vendor/github.com/bitmovin/bitmovin-api-sdk-go/model/enhanced_watermark_filter.go
0.74826
0.403626
enhanced_watermark_filter.go
starcoder
package tensor import "github.com/pkg/errors" func MinBetween(a, b interface{}, opts ...FuncOpt) (retVal Tensor, err error) { var minbetweener MinBetweener var oe standardEngine var ok bool switch at := a.(type) { case Tensor: oe = at.standardEngine() switch bt := b.(type) { case Tensor: if !bt.Shape()....
api_minmax.go
0.573201
0.450541
api_minmax.go
starcoder
package astp import "go/ast" // IsExpr reports whether a given ast.Node is an expression(ast.Expr). func IsExpr(node ast.Node) bool { _, ok := node.(ast.Expr) return ok } // IsBadExpr reports whether a given ast.Node is a bad expression (*ast.IsBadExpr). func IsBadExpr(node ast.Node) bool { _, ok := node.(*ast.Ba...
vendor/github.com/go-toolsmith/astp/expr.go
0.786705
0.726426
expr.go
starcoder
package test_float func assert(want int, act int, code string) func println(format string) func main() { assert(35, float32(int8(35)), "float32(int8(35))") assert(35, float32(int16(35)), "float32(int16(35))") assert(35, float32(int(35)), "float32(int(35))") assert(35, float32(int64(35)), "float32(int64(35))") as...
testdata/esc/float.go
0.625438
0.597813
float.go
starcoder
package tree // Node represents a node in a rooted ordered tree. type Node struct { Data interface{} Parent *Node Children []*Node } // New creates a new bare node holding any desired sort of data. func New(data interface{}) *Node { return &Node{ Data: data, } } // IsRoot returns true if and only if the spe...
tree/tree.go
0.901867
0.644323
tree.go
starcoder
package main import ( "bufio" "fmt" "os" "sort" "strconv" "strings" ) // Interval struct representing the beginning and end of and interval. type Interval struct { From int To int } // Utiliy function to remove an Interval from a slice of Intervals func remove(intervals *[]Interval, elem Interval) { for i...
Exam/code/independent_set.go
0.578805
0.40539
independent_set.go
starcoder
package ent import ( "context" "errors" "fmt" "github.com/facebook/ent/dialect/sql/sqlgraph" "github.com/facebook/ent/schema/field" "github.com/gobench-io/gobench/ent/histogram" "github.com/gobench-io/gobench/ent/metric" ) // HistogramCreate is the builder for creating a Histogram entity. type HistogramCreat...
ent/histogram_create.go
0.730194
0.47792
histogram_create.go
starcoder
// Package parser deserializes blocks from zcashd. package parser import ( "fmt" "github.com/meshbits/lightwalletd/parser/internal/bytestring" "github.com/meshbits/lightwalletd/walletrpc" "github.com/pkg/errors" ) // Block represents a full block (not a compact block). type Block struct { hdr *BlockHeader ...
parser/block.go
0.635788
0.402803
block.go
starcoder
package slice import ( "fmt" "math" "math/rand" ) // IndexOfInt gets the index of an int element in an int slice func IndexOfInt(x []int, y int) int { for i, v := range x { if v == y { return i } } return -1 } // ContainsInt checks whether an int element is in an int slice func ContainsInt(x []int, y in...
slice/int.go
0.748168
0.468061
int.go
starcoder
package opt import ( "github.com/tikv/pd/server/core" ) // BalanceEmptyRegionThreshold is a threshold which allow balance the empty region if the region number is less than this threshold. var balanceEmptyRegionThreshold = 50 // IsRegionHealthy checks if a region is healthy for scheduling. It requires the // regio...
server/schedule/opt/healthy.go
0.793106
0.482246
healthy.go
starcoder
package movers import ( "github.com/tsunyoku/danser/app/beatmap/difficulty" "github.com/tsunyoku/danser/app/beatmap/objects" "github.com/tsunyoku/danser/app/bmath" "github.com/tsunyoku/danser/app/settings" "github.com/tsunyoku/danser/framework/math/curves" "github.com/tsunyoku/danser/framework/math/math32" "git...
app/dance/movers/angleoffset.go
0.718496
0.418875
angleoffset.go
starcoder
package comptop // SimplicialSet is a set containing simplices. // Note: SimplicialSet is not a category theoretical simplicial set. type SimplicialSet struct { set map[*Simplex]struct{} slice []*Simplex eulerChar *int } // NewSimplicialSet returns the SimplicialSet containing the provided simplices. func New...
simplicialSet.go
0.810366
0.638807
simplicialSet.go
starcoder
package opc // Spatial Stripes // Creates spatial sine wave stripes: x in the red channel, y--green, z--blue // Also makes a white dot which moves down the strip non-spatially in the order // that the LEDs are indexed. import ( "github.com/longears/pixelslinger/colorutils" "github.com/longears/pixelslinger/mi...
opc/pattern-aquab.go
0.523664
0.587854
pattern-aquab.go
starcoder
package components import ( "sync" "github.com/go-gl/mathgl/mgl32" ) const ( // TypeAcceleration represents an acceleration component's type. TypeAcceleration = "acceleration" ) // Acceleration represents the acceleration of an entity. type Acceleration interface { Component // Rotational retrieves the rotati...
components/acceleration.go
0.867948
0.659083
acceleration.go
starcoder
package ml import ( "github.com/plandem/ooxml/index" "strconv" "strings" ) //Hash builds hash code for all required values of CellAlignment to use as unique index func (a *CellAlignment) Hash() index.Code { alignment := a if alignment == nil { alignment = &CellAlignment{} } return index.Hash(strings.Join([...
internal/ml/hash.go
0.689724
0.471527
hash.go
starcoder
package model // Game Struct represent the whole data structure in mongodb type Game struct { Slug string `bson:"slug"` Name string `bson:"name"` Id int `bson:"id"` Released string `bson:"released"` Tba bool ...
pkg/model/dbmodel.go
0.538983
0.441793
dbmodel.go
starcoder
Geneva Drive See: https://en.wikipedia.org/wiki/Geneva_drive */ //----------------------------------------------------------------------------- package obj import ( "math" "github.com/deadsy/sdfx/sdf" ) //----------------------------------------------------------------------------- // GenevaParms specfies the...
obj/geneva.go
0.717309
0.449755
geneva.go
starcoder
package comparator import ( "reflect" "regexp" "strings" "github.com/Vr00mm/litmus-chaos-toolkit/pkg/log" "github.com/pkg/errors" ) // CompareString compares strings for specific operation // it check for the equal, not equal and contains(sub-string) operations func (model Model) CompareString() error { obj :...
pkg/probe/comparator/string.go
0.67854
0.444022
string.go
starcoder
package ui import ( "github.com/serhatscode/sudoku/board" ) // BoardHeight is height of BoardOutline var BoardHeight = len(boardOutline) // BoardWidth is width of BoardOutline var BoardWidth = len(boardOutline[0]) // boardOutline for board widget var boardOutline = [][]rune{ []rune("┏━━━┯━━━┯━━━┳━━━┯━━━┯━━━┳━━━┯━...
ui/board_widget.go
0.583915
0.651137
board_widget.go
starcoder
package bitstream import ( "encoding/binary" "io" ) // Read reads an arbitrary number of bytes from a bitstream.Reader. It // implements io.Reader, so it returns the total number of bytes read. If r // did not contain a round number of bytes, the final byte is padded with // zeroes in its low-order bits. func (r ...
io.go
0.670716
0.499084
io.go
starcoder
package main import ( "fmt" "math" "os" ) var fractals = map[string]interface{}{ "mandelbrot": map[string]interface{}{ "description": "Classic mandelbrot function.", "constants": 0, "func": mandelbrot, "colourfuncs": map[string]interface{}{ "default": simpleGreyscale, "simplegreysca...
Fractals.go
0.679817
0.575081
Fractals.go
starcoder
package minimum_knight_moves import ( "fmt" "math" ) func MinKnightMovesDFS(x int, y int) int { memo := make(map[string]int) return dfs(Abs(x), Abs(y), memo) } func dfs(x, y int, memo map[string]int) int { key := generateKey(x, y) if _, ok := memo[key]; ok { return memo[key] } if x + y == 0 { return 0 ...
golang/minimum_knight_moves/min_knight_moves_dfs.go
0.600891
0.402304
min_knight_moves_dfs.go
starcoder
package main import ( "github.com/gen2brain/raylib-go/raylib" ) const ( maxColumns = 20 ) func main() { raylib.InitWindow(800, 450, "raylib [core] example - 3d camera first person") camera := raylib.Camera3D{} camera.Position = raylib.NewVector3(4.0, 2.0, 4.0) camera.Target = raylib.NewVector3(0.0, 1.8, 0.0) ...
examples/core/3d_camera_first_person/main.go
0.680985
0.447883
main.go
starcoder
package imgcolors import ( "image" "image/color" "image/draw" "math" ) func Horizontal(colors []color.Color, width, height uint) image.Image { img := image.NewRGBA(image.Rect(0, 0, int(width), int(height))) fw := float64(width) n := len(colors) fn := float64(n) px := 0 for x := 0; x < n; x++ { nx := int...
imgcolors.go
0.631253
0.438966
imgcolors.go
starcoder
package libcnb // Application is the user contributed application to build. type Application struct { // Path is the path to the application. Path string } // Label represents an image label. type Label struct { // Key is the key of the label. Key string `toml:"key"` // Value is the value of the label. Value...
application.go
0.801781
0.430866
application.go
starcoder
package trie import ( "bytes" "sort" "unicode/utf8" ) const end = -1 // The Node type makes up the Trie data structure. type Node map[rune]Node // New allocates a new node. func New() Node { return make(Node) } // Index builds a Trie with the supplied dictionary d. func (node Node) Index(d []string) { for _, s...
trie.go
0.690455
0.496582
trie.go
starcoder
package v1alpha1 // DelegationSetListerExpansion allows custom methods to be added to // DelegationSetLister. type DelegationSetListerExpansion interface{} // DelegationSetNamespaceListerExpansion allows custom methods to be added to // DelegationSetNamespaceLister. type DelegationSetNamespaceListerExpansion interfa...
client/listers/route53/v1alpha1/expansion_generated.go
0.556159
0.406214
expansion_generated.go
starcoder
package partitionequalsubsetsum import "fmt" // Take an input slice and swap end element and element at "i" // Then return slice without the element at end func remove(slice []int, i int) []int { slice[len(slice)-1], slice[i] = slice[i], slice[len(slice)-1] return slice[:len(slice)-1] } func printParition(nums []i...
partitionequalsubsetsum/partitionequalsubsetsum.go
0.667364
0.492981
partitionequalsubsetsum.go
starcoder
package scalars import ( "strconv" "github.com/graphql-go/graphql" "github.com/graphql-go/graphql/language/ast" "github.com/graphql-go/graphql/language/kinds" ) var GraphQLInt64Scalar = graphql.NewScalar(graphql.ScalarConfig{ Name: "Int64", Description: "The `Int64` scalar type represents non-fractional signed...
api/scalars/scalars.go
0.659515
0.49585
scalars.go
starcoder
package rehapt import ( "errors" "fmt" "math" "reflect" "regexp" "strings" "time" ) func (r *Rehapt) timeDeltaCompare(ctx compareCtx) error { timeDelta, ok := ctx.Expected.(TimeDelta) if ok == false { // This should never happened because we normally // arrive here only when ExpectedType is TimeDelta p...
compare.go
0.734596
0.478041
compare.go
starcoder
package minio import ( "crypto/aes" "crypto/rand" "crypto/rsa" "crypto/x509" ) // EncryptionKey - generic interface to encrypt/decrypt a key. // We use it to encrypt/decrypt content key which is the key // that encrypt/decrypt object data. type EncryptionKey interface { // Encrypt data using to the set encryptio...
vendor/github.com/minio/minio-go/encryption-keys.go
0.701406
0.402627
encryption-keys.go
starcoder
package conversions import ( "github.com/dave/dst" "github.com/Azure/azure-service-operator/hack/generator/pkg/astmodel" ) // Direction specifies the direction of conversion we're implementing with this function type Direction interface { // SelectString returns one of the provided strings, depending on the direc...
hack/generator/pkg/conversions/direction.go
0.842831
0.521288
direction.go
starcoder
package vm import ( "encoding/binary" "fmt" "math/big" "sync" "github.com/ethereum/go-ethereum/common/hexutil" ethtypes "github.com/ethereum/go-ethereum/core/types" "github.com/ethereum/go-ethereum/crypto" "golang.org/x/crypto/sha3" ) // hasherPool holds LegacyKeccak256 hashers for rlpHash. var hasherPool = ...
vm/bloom9.go
0.723212
0.415017
bloom9.go
starcoder
package exec import ( "fmt" "github.com/ebay/akutan/query/parser" "github.com/ebay/akutan/query/planner/plandef" "github.com/ebay/akutan/rpc" ) // exprEvaluator is used to calculate the result of an expression used in a // Projection. The Projection operator uses these to generate its results. type exprEvaluato...
src/github.com/ebay/akutan/query/exec/expressions.go
0.554712
0.407864
expressions.go
starcoder
package scope import ( "github.com/canpacis/birlang/src/ast" ) type Scopestack struct { Scopes []Scope `json:"scopes"` Namespaces []Namespace `json:"namespaces"` } func (scopestack *Scopestack) Reverse() []Scope { a := make([]Scope, len(scopestack.Scopes)) copy(a, scopestack.Scopes) for i := len(a)/2 ...
src/scope/scope.go
0.640299
0.520496
scope.go
starcoder
package cpu // region Load/Store Instructions // gbLDrrAA Sets Register A to the value in A func gbLDrrAA(cpu *Core) { cpu.Registers.A = cpu.Registers.A cpu.Registers.LastClockM = 1 cpu.Registers.LastClockT = 4 } // gbLDrrAB Sets Register B to the value in A func gbLDrrAB(cpu *Core) { cpu.Registers.A = cpu.Regis...
cpu/instructions.go
0.59408
0.447823
instructions.go
starcoder
package finance import ( "fmt" "math" "strconv" "time" "github.com/rsingla/learngo/pkg/model" ) func MinPayoff(d model.Debt) []model.Payment { budget := d.MonthlyBudget trades := d.Tradelines var month int = 0 balMap := make(map[string]float64) for _, trade := range trades { balMap[trade.ID] = trade.Ba...
pkg/finance/mindebtpayoff.go
0.629205
0.429609
mindebtpayoff.go
starcoder
package values import ( "fmt" "github.com/ptiger10/pd/options" ) // The Values interface is the primary means of handling a collection of values. // The same interface and value types are used for both Series values and Index labels type Values interface { Len() int // number of Value/Null structs ...
internal/values/values.go
0.618089
0.517388
values.go
starcoder
package schedule import ( "sort" "time" ) // ListExpression is the struct used to create cron list expressions. type ListExpression struct { values []int } // List is an expression used to iterate the provided list of int parameters (*inclusive*). func List(values []int) *ListExpression { if len(values) < 1 { ...
list_expression.go
0.778018
0.681935
list_expression.go
starcoder
package vector import ( "fmt" "math" "strconv" ) type Vector []float64 // NewVector initialize new Vector func NewVector(x ...interface{}) (v Vector) { v = make(Vector, 0, len(x)) for _, x := range x { v = append(v, ToFloat64(x)) } return } func ToFloat64(v interface{}) float64 { switch v := v.(type) { c...
vector/vector.go
0.795658
0.647548
vector.go
starcoder
package unit import ( "reflect" "runtime/debug" "testing" ) type Subtest struct { test TestingT name string callable interface{} arguments []interface{} comparator EqualComparer } func NewSubtest(test TestingT, testName string) *Subtest { if test == nil { panic(NewNotNilError("test")) } ...
unit/subtest.go
0.607547
0.517632
subtest.go
starcoder
package types import ( "github.com/antihax/optional" "time" ) type CreatePartitionDefinition struct { // The name of the partition. Name string `json:"name"` // The query that defines the data to be included in the partition. RoutingExpression string `json:"routingExpression"` // The Data Tier where the data i...
service/cip/types/partition_types.go
0.764716
0.533094
partition_types.go
starcoder
package waveform import ( "image" "image/color" "log" "math" ) // WaveReader interface ... type WaveReader interface { Len() uint64 Rate() uint32 Chans() uint16 At(ch uint, offset uint64) (float32, error) } // Options represents ... type Options struct { Width int Height int Half bool Zoom float...
pkg/waveform/waveform.go
0.58818
0.427695
waveform.go
starcoder
package main import ( "fmt" "../src/bitcoin" ) /* This program demonstrates the use of Merkle Trees by Bitcoin * Single-Payment-Verification (SPV) nodes as part of their strategy to detect * dishonest or corrupted replies from their peer-to-peer connections. * * For a comprehensive written description, primer a...
src/main.go
0.675658
0.472866
main.go
starcoder
package plaid import ( "encoding/json" ) // PaystubDeduction struct for PaystubDeduction type PaystubDeduction struct { // The description of the deduction, as provided on the paystub. For example: `\"401(k)\"`, `\"FICA MED TAX\"`. Type NullableString `json:"type"` // `true` if the deduction is pre-tax; `false` ...
plaid/model_paystub_deduction.go
0.717903
0.65276
model_paystub_deduction.go
starcoder
package area import ( "github.com/karlek/reason/name" "github.com/karlek/reason/terrain" "github.com/karlek/worc/coord" "github.com/karlek/worc/draw" "github.com/karlek/worc/model" "github.com/mewkiz/pkg/errutil" ) // Area is a collection of terrain and objects placed on top of it. type Area struct { // TODO...
area/area.go
0.502686
0.428712
area.go
starcoder
package openapi // Example object type Example struct { // Short description for the example. Summary string `json:"summary,omitempty"` // Long description for the example. CommonMark syntax MAY be used for rich // text representation. Description string `json:"description,omitempty"` // Embedded literal exampl...
example.go
0.758332
0.400749
example.go
starcoder
package run import ( "fmt" "os" "sync" spb "github.com/tensorflow/tensorflow/tensorflow/go/core/framework/summary_go_proto" "github.com/wchargin/tensorboard-data-server/mem" ) // NewAccumulator creates an Accumulator from a Reader's output channel and // starts a goroutine to ingest data. The caller is still in...
io/run/accumulator.go
0.605799
0.451689
accumulator.go
starcoder
package crypt import ( "crypto/cipher" "encoding/binary" "github.com/esturcke/cryptopals-golang/bytes" ) // DecryptCbc decrypt using CBC func DecryptCbc(block cipher.Block, ct, iv []byte) []byte { blockSize := block.BlockSize() if blockSize != len(iv) { panic("IV expected to match block size") } if len(ct)%...
crypt/crypt.go
0.639624
0.448185
crypt.go
starcoder
package gohome import ( "github.com/PucklaMotzer09/mathgl/mgl32" "image/png" "os" ) // A struct holding all data of the mouse type Mouse struct { // The current position of the mouse in screen coordinates Pos [2]int16 // The relative mouse movement to the last frame DPos [2]int16 // The wheel movement valu...
src/gohome/inputmanager.go
0.632049
0.545649
inputmanager.go
starcoder
package fit import ( "errors" "math" ) // Circle computes a least square fit circle for a list of 2D-points. It takes // the x and y coordinates as arguments. The xs and ys slices must have the same // length. The function returns the center and radius of the circle that best // fits the given points. func Circle(x...
fit_circle.go
0.777891
0.552057
fit_circle.go
starcoder
package slice // RemoveString func // Removes each element that the function returns truthy for and returns a slice with the the items removed. func RemoveString(input []string, f func(string) bool) []string { output := []string{} for _, value := range input { if !f(value) { output = append...
slice/remove.go
0.904051
0.462473
remove.go
starcoder
package openapi import ( "encoding/json" ) // PatchOperation struct for PatchOperation type PatchOperation struct { // [JSON Patch operation](https://datatracker.ietf.org/doc/html/rfc6902#page-4) to be performed in this patch. Case insensitive. Op string `json:"op"` // [JSON Pointer](https://datatracker.ietf.org...
openapi/model_patch_operation.go
0.799247
0.420302
model_patch_operation.go
starcoder
package quaternion import ( "math" ) // New returns a new quaternion func New(w, x, y, z float64) Quaternion { return Quaternion{W: w, X: x, Y: y, Z: z} } // Pure returns a new pure quaternion (no scalar part) func Pure(x, y, z float64) Quaternion { return Quaternion{X: x, Y: y, Z: z} } // Quaternion represents ...
vendor/github.com/westphae/quaternion/quaternion.go
0.918827
0.646767
quaternion.go
starcoder
package simplechain import ( "bytes" "crypto/sha256" ) // Types type SimpleBlock struct { hash []byte previousHash []byte data []byte } type SimpleChain struct { blocks []*SimpleBlock } // Chain functions func NewSimpleChain() *SimpleChain { return &SimpleChain{make([]*SimpleBlock, 0)} } f...
simplechain/chain.go
0.673621
0.428592
chain.go
starcoder