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 models import ( i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91 "github.com/microsoft/kiota-abstractions-go/serialization" ) // UnifiedRoleAssignment type UnifiedRoleAssignment struct { Entity // Details of the app specific scope when the assignment scope is app specific. Contai...
models/unified_role_assignment.go
0.624866
0.513729
unified_role_assignment.go
starcoder
package pgsql import ( "database/sql" "database/sql/driver" "strconv" ) // BoxArrayFromFloat64Array2Array2Slice returns a driver.Valuer that produces a PostgreSQL box[] from the given Go [][2][2]float64. func BoxArrayFromFloat64Array2Array2Slice(val [][2][2]float64) driver.Valuer { return boxArrayFromFloat64Array...
pgsql/boxarr.go
0.66454
0.490419
boxarr.go
starcoder
package iso20022 // Provides information about the rates related to securities movement. type RateDetails14 struct { // Rate used for additional tax that cannot be categorised. AdditionalTax *RateAndAmountFormat14Choice `xml:"AddtlTax,omitempty"` // Cash dividend amount per equity before deductions or allowances ...
RateDetails14.go
0.837121
0.644365
RateDetails14.go
starcoder
package schemes import "image/color" // PBJ is a gradient color scheme from orange to purple. var PBJ []color.Color func init() { PBJ = []color.Color{ color.RGBA{R: 0x29, G: 0xa, B: 0x59, A: 0xff}, color.RGBA{R: 0x29, G: 0xa, B: 0x59, A: 0xff}, color.RGBA{R: 0x2a, G: 0xa, B: 0x59, A: 0xff}, color.RGBA{R: 0x...
schemes/pbj.go
0.586523
0.726595
pbj.go
starcoder
package gift import ( "image" "image/draw" "math" "runtime" "sync" "sync/atomic" ) // parallelize parallelizes the data processing if enabled is true. func parallelize(enabled bool, datamin, datamax int, fn func(pmin, pmax int)) { datasize := datamax - datamin partsize := datasize numGoroutines := 1 if ena...
vendor/github.com/disintegration/gift/utils.go
0.642993
0.515681
utils.go
starcoder
package bubt import "encoding/binary" const ( zflagDeleted byte = 0x1 zflagVlog byte = 0x2 ) // zentry represents the binary layout of each entry in the leaf(z) block. // hdr1: flags[64:60] seqno[60:0] // hdr2: 8 bytes // key-len // hdr3: 8 bytes // value-len // byte array of key // 8-byte fpos into value log, ...
bubt/zentry.go
0.680985
0.401893
zentry.go
starcoder
package kal // locale: tr_TR // NOTE: Work in progress! // This calendar has a corresponding locale code in the NewCalendar function in calendar.go import ( "time" ) type TRCalendar struct{} // Create a new US calendar func NewTRCalendar() TRCalendar { return TRCalendar{} } // Finds the TR name for a day of the...
tr_TR.go
0.638385
0.434641
tr_TR.go
starcoder
package data type Category struct { Name string Desc string } type Author struct { Id string LastName string FirstName string } type Book struct { Id int64 Name string Authors []*Author Categories []*Category Price float32 Isbn string } func (book *Book) AddAuthors(aut...
examples/data/bookstore.go
0.515864
0.405331
bookstore.go
starcoder
package processor import ( "errors" "fmt" "sort" "time" "github.com/Jeffail/benthos/v3/internal/bloblang" "github.com/Jeffail/benthos/v3/internal/bloblang/field" "github.com/Jeffail/benthos/v3/internal/bloblang/mapping" "github.com/Jeffail/benthos/v3/internal/bloblang/query" "github.com/Jeffail/benthos/v3/in...
lib/processor/log.go
0.781789
0.618147
log.go
starcoder
package types import ( "encoding/json" "fmt" "regexp" log "github.com/sirupsen/logrus" "github.com/smartystreets/assertions" "gopkg.in/yaml.v3" ) const ( DefaultMatcher = "ShouldEqual" ) type Assertion func(actual interface{}, expected ...interface{}) string var asserts = map[string]Assertion{ "ShouldResem...
server/types/matchers.go
0.621196
0.509154
matchers.go
starcoder
package ids import "strings" // NodeIDSet is a set of NodeIDs type NodeIDSet map[NodeID]struct{} // Return a new NodeIDSet with initial capacity [size]. // More or less than [size] elements can be added to this set. // Using NewNodeIDSet() rather than ids.NodeIDSet{} is just an optimization that can // be used if y...
ids/node_id_set.go
0.703753
0.420719
node_id_set.go
starcoder
package gocvsimd import ( "unsafe" ) //go:noescape func _SimdSse2TextureBoostedSaturatedGradient(src unsafe.Pointer, srcStride, width, height uint64, saturation, boost uint64/*uint8*/, dx unsafe.Pointer, dxStride uint64, dy unsafe.Pointer, dyStride uint64) //go:noescape func _SimdSse2TextureBoostedUv(src unsafe.Po...
sse2/SimdSse2Texture_amd64.go
0.502197
0.516291
SimdSse2Texture_amd64.go
starcoder
package sql import ( "fmt" "io" "strings" ) // Row is a tuple of values. type Row []interface{} // NewRow creates a row from the given values. func NewRow(values ...interface{}) Row { row := make([]interface{}, len(values)) copy(row, values) return row } // Copy creates a new row with the same values as the ...
sql/row.go
0.766992
0.456591
row.go
starcoder
package code import ( "errors" "io/ioutil" "os" "os/exec" "regexp" "time" ) type Block struct { Code string Language string } type Result struct { Out string ExitCode int ExecutionTime time.Duration } // ?: means non-capture group var re = regexp.MustCompile("(?s)(?:```|~~~)(\\w+)\n(.*...
internal/code/code.go
0.616705
0.406774
code.go
starcoder
package photoprism import ( "bufio" "bytes" "errors" "fmt" "image" "io/ioutil" "math" "os" "path" "path/filepath" "sort" "strings" "github.com/disintegration/imaging" "github.com/photoprism/photoprism/internal/config" "github.com/photoprism/photoprism/internal/util" tf "github.com/tensorflow/tensorflo...
internal/photoprism/tensorflow.go
0.719975
0.42054
tensorflow.go
starcoder
package algos import ( "github.com/pires/go-dojo-algorithms/grokking_algorithms/util" ) const ( // ASC is ascending order ASC = 0 // DESC is descending order DESC = 1 ) // getSignificantValuePositionInArray returns the position in the array of the lower or higher value stored, based on an order. // If order is ...
grokking_algorithms/ch02/selection_sort.go
0.685739
0.4917
selection_sort.go
starcoder
package types import ( "io" "sync" "github.com/attic-labs/noms/go/chunks" "github.com/attic-labs/noms/go/constants" "github.com/attic-labs/noms/go/d" "github.com/attic-labs/noms/go/hash" ) // BatchStore provides an interface similar to chunks.ChunkStore, but batch-oriented. Instead of Put(), it provides Sched...
go/types/batch_store.go
0.772959
0.457561
batch_store.go
starcoder
package qubit import ( "fmt" "math" "math/cmplx" "strconv" "strings" "github.com/itsubaki/q/pkg/math/matrix" "github.com/itsubaki/q/pkg/math/number" "github.com/itsubaki/q/pkg/math/rand" "github.com/itsubaki/q/pkg/math/vector" ) type Qubit struct { vector vector.Vector Seed []int64 Rand func(seed ......
pkg/quantum/qubit/qubit.go
0.706494
0.654039
qubit.go
starcoder
package plaid import ( "encoding/json" ) // MFA Specifies the multi-factor authentication settings to use with this test account type MFA struct { // Possible values are `device`, `selections`, or `questions`. If value is `device`, the MFA answer is `1234`. If value is `selections`, the MFA answer is always the ...
plaid/model_mfa.go
0.853318
0.634458
model_mfa.go
starcoder
package constraint import ( "github.com/hecate-tech/engine/experimental/physics/equation" "github.com/hecate-tech/engine/math32" ) // Hinge constraint. // Think of it as a door hinge. // It tries to keep the door in the correct place and with the correct orientation. type Hinge struct { PointToPoint ...
experimental/physics/constraint/hinge.go
0.744656
0.432902
hinge.go
starcoder
package dns import ( "encoding/json" ) // ZoneBulkCreateOrUpdateZoneRecordMessage The fields needed to create or update a DNS zone resource record type ZoneBulkCreateOrUpdateZoneRecordMessage struct { // A zone record's name Name *string `json:"name,omitempty"` Type *ZoneRecordType `json:"type,omitempty"` // A z...
pkg/dns/model_zone_bulk_create_or_update_zone_record_message.go
0.800536
0.420778
model_zone_bulk_create_or_update_zone_record_message.go
starcoder
package common import ( "fmt" "strings" ) // FilePos specifies a position within a given file. type FilePos struct { L int // The line number of the position C int // The column number of the position } // Location specifies the exact range of locations of some entity. type Location struct { File string // Th...
parser/common/locations.go
0.632049
0.416975
locations.go
starcoder
package filter import "github.com/nerdynick/ccloud-go-sdk/telemetry/labels" const ( //OpEq is a static def for EQ Operand OpEq string = "EQ" OpGt string = "GT" OpGte string = "GTE" ) // Filter structure type FieldFilter struct { Op string `json:"op"` Field labels.Label `json:"field,omitempty"` Valu...
telemetry/query/filter/field.go
0.811601
0.442757
field.go
starcoder
package cbase import ( math "github.com/chewxy/math32" "github.com/r4stl1n/micro-hal/code/pkg/champ/cstructs" "github.com/r4stl1n/micro-hal/code/pkg/hmath" ) type QuadLeg struct { numberOfLinks int zeroStance cstructs.Transformation centerToNominal float32 id int lastTouchDown float32 i...
code/pkg/champ/cbase/quadleg.go
0.754915
0.423577
quadleg.go
starcoder
package spatial import ( "bytes" "math" "reflect" "strconv" "strings" ) func wktTypeName(g Geometry) string { name := reflect.TypeOf(g).Name() size := len(name) switch { case name[size-2:] == "ZM": return strings.ToUpper(name[:size-2]) + " ZM" case name[size-1:] == "M": return strings.ToUpper(name[:siz...
driver/spatial/wkt.go
0.670824
0.401541
wkt.go
starcoder
package gown import ( "bufio" "fmt" "io" "os" "strconv" "strings" ) /* From senseidx(5WN): The WordNet sense index provides an alternate method for accessing synsets and word senses in the WordNet database. It is useful to applications that retrieve synsets or other information related to a s...
sense_index.go
0.541651
0.427158
sense_index.go
starcoder
package versionedkv import ( "context" "errors" "fmt" "math/rand" "sync" "testing" "time" "github.com/go-tk/testcase" "github.com/stretchr/testify/assert" ) // StorageFactory is the type of the function creating storages. type StorageFactory func() (storage Storage, err error) // DoTestStorage tests storag...
teststorage.go
0.555194
0.508117
teststorage.go
starcoder
package skl import ( "fmt" "io" "strconv" "strings" "github.com/eliquious/lexer" ) const ( // DateFormat represents the format for date literals. DateFormat = "2006-01-02" // DateTimeFormat represents the format for date time literals. DateTimeFormat = "2006-01-02 15:04:05.999999" ) // Parser represents a...
skl/parser.go
0.791821
0.400163
parser.go
starcoder
package refl import ( "fmt" "reflect" ) // Function wraps a reflect.Value and provides some common reflective assertions about its type type Function reflect.Value // WrapFunction wraps a provided function into a refl.Function object. It panics if // the provided argument is not a function. func WrapFunction(fn in...
pkg/internal/refl/function.go
0.582016
0.409634
function.go
starcoder
package main import ( "fmt" "github.com/derat/advent-of-code/lib" ) func main() { grid := lib.InputByteGrid("2021/25") // This was a pretty easy one. My input is 137 rows by 139 columns, so it seemed // clear that checking every grid and its west/north neighbors each step isn't the // way to go. The only poin...
2021/25/main.go
0.521227
0.410993
main.go
starcoder
package rgass import ( "errors" ) // RGASS (replicated growable array supporting string) is a CRDT for efficient string-based // collaborative editing. type RGASS struct { Model Model } // NewRGASS creates a new RGASS. func NewRGASS() RGASS { rgass := RGASS{Model: NewModel()} return rgass } // MustGet returns t...
rgass/rgass.go
0.714927
0.424352
rgass.go
starcoder
package liquid import ( "fmt" "regexp" "strconv" ) // Expression objects contain specific types of usable data // that can be rendered to a string value at runtime. type Expression interface { // Evaluate with the supplied Context // XXX: not so certain this is actually necessary, will need to review once // mo...
expression.go
0.528533
0.411347
expression.go
starcoder
package cache import "github.com/ammario/cache/internal/doublelist" type Coster[T any] func(v T) int // ConstantCost always returns 1. func ConstantCost[T any](_ T) int { return 1 } // dataWithKey bundles data with its reference key. // This structure allows for reverse lookup from the doubly-linked list to the in...
lru.go
0.666171
0.493164
lru.go
starcoder
package types import "github.com/attic-labs/noms/go/d" func assertSubtype(t *Type, v Value) { if !isSubtype(t, v.Type(), nil) { d.Chk.Fail("Invalid type", "%s is not a subtype of %s", v.Type().Describe(), t.Describe()) } } // IsSubtype determines whether concreteType is a subtype is requiredType. For example, `...
go/types/assert_type.go
0.717111
0.439928
assert_type.go
starcoder
package schnorr import ( "crypto/elliptic" "crypto/rand" "crypto/sha256" "errors" "math/big" "github.com/btcsuite/btcd/btcec" ) var ( // Curve is a KoblitzCurve which implements secp256k1. Curve = btcec.S256() // One holds a big integer of 1 One = new(big.Int).SetInt64(1) // Two holds a big integer of 2 ...
crypto/bak/schnorr/schnorr.go
0.716715
0.476458
schnorr.go
starcoder
package geo import ( "github.com/engoengine/glm" "github.com/EngoEngine/math" ) // AABB is an axis-aligned bounding box type AABB struct { // Center represents the center of the bounding box. Center glm.Vec3 // HalfExtend represents the 3 half extends of the bounding box. HalfExtend glm.Vec3 } // TestAABBAABB...
geo/aabb.go
0.826887
0.479686
aabb.go
starcoder
package bls12381 import ( "fmt" "github.com/cloudflare/circl/ecc/bls12381/ff" ) // G2Size is the length in bytes of an element in G2. const G2Size = 2 * ff.Fp2Size // G2 is a point in the twist of the BLS12 curve over Fp2. type G2 struct{ x, y, z ff.Fp2 } func (g G2) String() string { return fmt.Sprintf("x: %v\n...
ecc/bls12381/g2.go
0.722821
0.488954
g2.go
starcoder
package rex import ( "regexp" "strings" ) /* Utility functions using regular expressions. CleanerFunc: TYPE Utility functions that take a string to do any cleanup work, return cleaned string RexFunc: TYPE Utility functions that take: x []string: String array that rx will generate and that rf can handl...
rex.go
0.625324
0.562417
rex.go
starcoder
package finverse import ( "encoding/json" ) // CurrencyAmount struct for CurrencyAmount type CurrencyAmount struct { Currency *string `json:"currency,omitempty"` Value float32 `json:"value"` Raw *string `json:"raw,omitempty"` } // NewCurrencyAmount instantiates a new CurrencyAmount object // This constr...
finverse/model_currency_amount.go
0.8505
0.447943
model_currency_amount.go
starcoder
package chow import ( "github.com/OpenWhiteBox/primitives/table" "github.com/OpenWhiteBox/AES/constructions/common" ) type Construction struct { InputMask [16]table.Block // [round] InputXORTables common.NibbleXORTables TBoxTyiTable [9][16]table.Word // [round][position] HighXORTable [9][32][3]table...
constructions/chow/chow.go
0.698535
0.49469
chow.go
starcoder
package seqio import ( "errors" "fmt" "strconv" "strings" "time" ) // Date represents a date stamp for record entries. type Date struct { Year int Month time.Month Day int } // FromTime creates a Date object from a time.Time object. func FromTime(t time.Time) Date { return Date{t.Year(), t.Month(), t.Day...
seqio/date.go
0.714528
0.44089
date.go
starcoder
package serverutil import ( "sync" "time" ) // The maximum number of visitors that a RateLimiter can track. const rateMaxVisitors = 100000 // RateLimiter implements a rate limiter with exponential backoff, // up to a specified maximum. type RateLimiter struct { // Backoff specifies an initial backoff duration fo...
serverutil/rate.go
0.713531
0.403537
rate.go
starcoder
package ast import ( "fmt" "funlang/context" "funlang/lex" ) type Builder struct { ctx *context.Context } func NewBuilder(ctx *context.Context) *Builder { return &Builder{ctx} } func (b *Builder) NewNilLiteral(pos lex.Position) *NilLiteral { return &NilLiteral{pos} } func (b *Builder) NewNumericLiteral(pos ...
ast/builder.go
0.697094
0.418637
builder.go
starcoder
package ahocorasick import ( "unicode/utf8" "github.com/koron/nvcheck/internal/trie" ) // Matcher is strings matcher uses aho-corasick algorithm. type Matcher struct { trie *trie.TernaryTrie } // Match represents a match by Matcher. type Match struct { Index int Pattern string Value interface{} } // Data...
internal/ahocorasick/ahocorasick.go
0.665845
0.492432
ahocorasick.go
starcoder
package py /* #include "Python.h" int IsPyTypeTrue(PyObject *o) { return o == Py_True; } int IsPyTypeFalse(PyObject *o) { return o == Py_False; } int IsPyTypeInt(PyObject *o) { return PyInt_CheckExact(o); } int IsPyTypeFloat(PyObject *o) { return PyFloat_CheckExact(o); } int IsPyTypeByteArray(PyObject *o...
py2go_converter_py2.go
0.532182
0.441252
py2go_converter_py2.go
starcoder
package game_theory import ( "github.com/xidongc/go-leetcode/utils" "math" "strconv" ) /* 877. stone game Alex and Lee play a game with piles of stones. There are an even number of piles arranged in a row, and each pile has a positive integer number of stones piles[i]. The objective of the game is to end with...
dp/game-theory/877-stone-game.go
0.614625
0.724505
877-stone-game.go
starcoder
package grok import ( "fmt" "regexp" "strconv" ) // CompiledGrok represents a compiled Grok expression. // Use Grok.Compile to generate a CompiledGrok object. type CompiledGrok struct { regexp *regexp.Regexp typeHints typeHintByKey removeEmpty bool } type typeHintByKey map[string]string // GetFields re...
vendor/github.com/trivago/grok/compiledgrok.go
0.83346
0.458773
compiledgrok.go
starcoder
package zfs import ( "strings" ) // DatasetKind enum of supported dataset types type DatasetKind string const ( // DatasetFilesystem enum entry DatasetFilesystem DatasetKind = `filesystem` // DatasetVolume enum entry DatasetVolume DatasetKind = `volume` // DatasetSnapshot enum entry DatasetSnapshot DatasetKin...
zfs/dataset.go
0.763836
0.407274
dataset.go
starcoder
package raytracer // DIFF floating point precision is a killing me. const DIFF = 0.000000001 // MDIFF Imagine a CPU with no dangling float precision. const MDIFF = -0.000000001 // ScreenToWorld conversion. func screenToWorld(x, y, width, height int, camera Vector, proj, view Matrix) (rayDir Vector) { var xF, yF flo...
raytracer/raycast.go
0.668664
0.607547
raycast.go
starcoder
package main import "fmt" /* Counting Valleys An avid hiker keeps meticulous records of their hikes. During the last hike that took exactly steps, for every step it was noted if it was an uphill, , or a downhill, step. Hikes always start and end at sea level, and each step up or down represents a unit change in ...
hackerrank/countvalleys/main.go
0.568056
0.640804
main.go
starcoder
package datamapper import ( "fmt" "github.com/juju/errors" ) // Entity defines a domain entity type Entity interface { // Return an entity's ID GetID() string } // UnitOfWork defines the persistence work needed to be accomplished for a // given business transaction type UnitOfWork struct { // A map of objects t...
unit_of_work.go
0.754915
0.400486
unit_of_work.go
starcoder
package hbook import ( "bytes" "encoding/gob" "fmt" "io" "math" "github.com/go-hep/rio" "github.com/gonuts/binary" ) type EvenBinAxis struct { nbins int // number of bins for this axis low float64 // low-edge of this axis high float64 // high-edge of this axis size float64 // bin size } func New...
axis1d.go
0.664867
0.505493
axis1d.go
starcoder
package filter import ( "fmt" "math" "sort" "time" "github.com/gonum/matrix/mat64" ) type PolyVariant int const ( PolyGoNum PolyVariant = iota PolyGoMatrix ) const timeDenominator = 1.0 / 3600.0 / 24.0 type dataPoint struct { t time.Time x float64 y float64 } type poly struct { variant PolyVariant ...
pairs/filter/polynomial.go
0.574872
0.491456
polynomial.go
starcoder
package util import ( "fmt" "io/ioutil" "strconv" "strings" ) const MaxUint = ^uint(0) const MaxInt = int(MaxUint >> 1) func LowestTrue(lowFalseStart int, pred func(int) (bool, error)) (int, error) { lf, err := pred(lowFalseStart) if err != nil { return 0, err } if lf { return 0, fmt.Errorf("lowestTrue e...
util/util.go
0.611034
0.409575
util.go
starcoder
package strategies import ( "fmt" "regexp" "strings" ) // TypeString is for string values (eg "something"): const TypeString = "STRING" // String asserts the given parameters then passes on for evaluation: func String(conditional string, options []interface{}, value interface{}) (bool, error) { // Type assert t...
pkg/strategies/type_string.go
0.709925
0.411702
type_string.go
starcoder
package main import ( "bufio" "fmt" "os" "strconv" "strings" ) /** Write a Bubble Sort program in Go. The program should prompt the user to type in a sequence of up to 10 integers. The program should print the integers out on one line, in sorted order, from least to greatest. As part of this program, you should...
src/bubblesort.go
0.509032
0.434401
bubblesort.go
starcoder
package preprocessing import ( "github.com/rom1mouret/ml-essentials/dataframe" ) type PreprocTraining interface { // TransformedColumns returns the columns used by the preprocessor. // Those columns are mandatory inputs. Other columns will be forwarded to the // output. // In the general case, the returned ...
preprocessing/interfaces.go
0.708918
0.480601
interfaces.go
starcoder
package dct import ( "github.com/mjibson/go-dsp/fft" "math" "math/cmplx" ) // References: // http://www.lokminglui.com/DCT_TR802.pdf // http://fourier.eng.hmc.edu/e161/lectures/dct/node2.html // DCT returns DCT-II coefficients given an input signal. func DCT(x []float64) []float64 { n := len(x) nh := n ...
dct/dct.go
0.801431
0.506774
dct.go
starcoder
package mockassert import ( "fmt" "github.com/derision-test/go-mockgen/internal/testutil" "github.com/stretchr/testify/assert" ) // Called asserts that the mock function object was called at least once. func Called(t assert.TestingT, mockFn interface{}, msgAndArgs ...interface{}) bool { callCount, ok := callCoun...
testutil/assert/assertions.go
0.661814
0.422088
assertions.go
starcoder
package bez import "github.com/MaxSlyugrov/cldr" var calendar = cldr.Calendar{ Formats: cldr.CalendarFormats{ Date: cldr.CalendarDateFormat{Full: "EEEE, d MMMM y", Long: "d MMMM y", Medium: "d MMM y", Short: "dd/MM/y"}, Time: cldr.CalendarDateFormat{Full: "h:mm:ss a zzzz", Long: "h:mm:ss a z", Medium: "h...
resources/locales/bez/calendar.go
0.502686
0.428233
calendar.go
starcoder
package internal import ( "errors" "fmt" "reflect" "runtime" "time" "github.com/onsi/gomega/types" ) type AsyncAssertionType uint const ( AsyncAssertionTypeEventually AsyncAssertionType = iota AsyncAssertionTypeConsistently ) type AsyncAssertion struct { asyncType AsyncAssertionType actualIsFunc bool a...
vendor/github.com/onsi/gomega/internal/async_assertion.go
0.6508
0.447823
async_assertion.go
starcoder
package models type CChainType uint16 var ( CChainIn CChainType = 1 CchainOut CChainType = 2 CChainImport CChainType = 1 CChainExport CChainType = 2 OutputTypesSECP2556K1Transfer OutputType = 7 OutputTypesSECP2556K1Mint OutputType = 6 OutputTypesNFTMint OutputType = 10 OutputTypesNFTTr...
models/types.go
0.500488
0.479443
types.go
starcoder
package average import ( "errors" "image" "image/color" "math" ) type colorAccum struct { sumR uint64 sumG uint64 sumB uint64 pixelCount uint64 } //TriangleAverage averages the colors of all points contained in or on the triangle defined by the given vertices func TriangleAverage(input *ima...
average/triangleAverage.go
0.771672
0.587233
triangleAverage.go
starcoder
package render import ( "errors" "image" "image/color" "image/draw" "golang.org/x/image/font" "golang.org/x/tools/godoc/vfs" ) // Canvas holds the image struct and associated properties. type Canvas interface { SetUnderlyingImage(newImage image.Image) Canvas GetUnderlyingImage() image.Image GetWidth() int ...
render/canvas.go
0.822831
0.532304
canvas.go
starcoder
package xiao import ( "github.com/OpenWhiteBox/primitives/matrix" "github.com/OpenWhiteBox/primitives/number" "github.com/OpenWhiteBox/primitives/random" "github.com/OpenWhiteBox/primitives/table" "github.com/OpenWhiteBox/AES/constructions/common" ) type side int const ( left side = iota right ) func sideFr...
constructions/xiao/keygen_primitives.go
0.721154
0.486819
keygen_primitives.go
starcoder
package main import ( "fmt" "math" "math/rand" "sort" "github.com/kiteco/kiteco/kite-go/lang/python/pythongraph/traindata" ) const ( eps = 1e-9 ) type symbolProb struct { // symbol that the user requested symbol string // canonicalize the symbol when requesting hashes canonicalize bool // cumulativeProb ...
kite-go/lang/python/cmds/graph-data-server/distribution.go
0.735547
0.479504
distribution.go
starcoder
package chapter01 import ( "encoding/binary" "fmt" ) // Pixel is a 4-byte struct that holds a single point of image data. type Pixel interface { R() byte G() byte B() byte A() byte } // IntPixel represents the Pixel interface using a single 32-bit unsigned // integer. type IntPixel struct { Value uint32 } //...
chapter01/1.7.go
0.798658
0.678493
1.7.go
starcoder
package annotations import ( "fmt" "go/ast" "go/parser" "go/token" "os" "regexp" "strings" "unicode" ) const ( // FixtureAnnotation used to label a function as a fixture FixtureAnnotation = "@fixture" // OnceFixtureAnnotation used to label a function as a fixture to be called once OnceFixtureAnnotation =...
annotations/parser.go
0.611498
0.550547
parser.go
starcoder
Party is a tool to automate the use of third party packages. Many existing Go package managers provide solutions to the problem of relying on other projects' code. Go handles the use of other packages elegantly, but is prone to problems when that code has breaking changes or is removed from the Internet. As a solution...
doc.go
0.720565
0.432603
doc.go
starcoder
package state import ( "math" "sort" "github.com/kzahedi/goent/continuous" pb "gopkg.in/cheggaaa/pb.v1" ) // FrenzelPompe is an implementation of // <NAME> and <NAME>. // Partial mutual information for coupling analysis of multivariate time series. // Phys. Rev. Lett., 99:204101, Nov 2007. // The function assume...
continuous/state/FrenzelPompe.go
0.754282
0.574275
FrenzelPompe.go
starcoder
package mitch import ( "fmt" "reflect" "sort" "strings" ) type Eq map[string]interface{} func (eq Eq) Match(el reflect.Value) bool { for k, v := range eq { vv := el.Elem().FieldByName(k) if !valueEqual(reflect.ValueOf(v), vv) { return false } } return true } func valueEqual(a reflect.Value, b reflec...
vendor/github.com/itchio/mitch/eq_by.go
0.665628
0.468973
eq_by.go
starcoder
package main import ( "fmt" "strconv" "strings" "github.com/kindermoumoute/adventofcode/pkg/execute" "github.com/kindermoumoute/adventofcode/pkg" ) type Registers struct { ip int r []int } // returns part1 and part2 func run(input string) (interface{}, interface{}) { instructions, insPointer := parse(inpu...
2018/day21/main.go
0.52756
0.438605
main.go
starcoder
package store import ( "fmt" "io" "time" ) const ( // KeyField contains the name of the record's value field containing the // record's key when exported through Fields() KeyField = "Name" ) // Record represents a Store's record. type Record struct { key string value *value file Reader } // NewRecord cr...
store/record.go
0.754192
0.452415
record.go
starcoder
package lang import ( "bufio" "encoding/base64" "fmt" "io" "strconv" "strings" "unicode" "github.com/markkurossi/iql/types" ) // Point specifies a position in the parser input data. type Point struct { Source string Line int Col int } func (p Point) String() string { return fmt.Sprintf("%s:%d:%d",...
lang/lexer.go
0.571169
0.457318
lexer.go
starcoder
package condition import ( "sync" "github.com/Jeffail/benthos/v3/lib/log" "github.com/Jeffail/benthos/v3/lib/metrics" "github.com/Jeffail/benthos/v3/lib/types" ) //------------------------------------------------------------------------------ func init() { Constructors[TypeCount] = TypeSpec{ constructor: New...
lib/condition/count.go
0.686895
0.435181
count.go
starcoder
package clinical import ( "time" "github.com/savannahghi/firebasetools" "github.com/savannahghi/scalarutils" ) // FHIRComposition definition: a set of healthcare-related information that is assembled together into a single logical package that provides a single coherent statement of meaning, establishes its own c...
graph/clinical/composition.go
0.74055
0.549701
composition.go
starcoder
In Go structure, the working of promoted methods is just like Promoted Fields. We use this concept in the nested structure where a structure is a field in another structure, simply by just adding the name of the structure into another structure and it behaves like the Anonymous Field to the nested structure...
day-18/Sanskriti/day18.go
0.581778
0.735974
day18.go
starcoder
package life import ( "math/rand" "time" ) // Life represents the board state and internal counters. type Life struct { width, height int Iteration int board []bool } // Positions contains the relative distance between the current // cell and it's neighbours. var positions = [8][2]int{ {-1, 1}, {0,...
life/life.go
0.680666
0.455925
life.go
starcoder
package perceptron import ( "fmt" "math/rand" "sync" "time" ) func init() { rand.Seed(time.Now().UTC().UnixNano()) } // getTrainAndTestData will return the data set divided based on k-fold cross validation func getTrainAndTestData(data [][]float64, k int) map[int][][][]float64 { indexes := rand.Perm(len(data))...
perceptron/helpers.go
0.650245
0.541651
helpers.go
starcoder
package main // Base code: https://golang.org/src/unicode/utf8/utf8.go // Numbers fundamental to the encoding. const ( // the "error" Rune or "Unicode replacement character" RuneError = '\uFFFD' // characters below Runeself are represented as themselves in a single byte. RuneSelf = 0x80 // Maximum valid Unicode ...
trinity/utf8.go
0.517083
0.442456
utf8.go
starcoder
package trie import ( "fmt" "sort" ) // WordData used to return found words and their word count type WordData struct { Word string Count int } // trieNode structure used by the Trie // Chars is a map with a character as the key and trieNode as the value. // Count keeps count of the number of words that end in ...
ace/trie/trie_node.go
0.53437
0.567877
trie_node.go
starcoder
package origin const ( loginLong = ` Log in to your server and save login for subsequent use First-time users of the client should run this command to connect to a server, establish an authenticated session, and save connection to the configuration file. The default configuration will be saved to your home directory...
pkg/appliance/openshift/origin/help.go
0.654011
0.435241
help.go
starcoder
package skiplist // adapted from https://github.com/MauriceGit/skiplist/blob/master/skiplist.go import ( "bytes" "fmt" "math/bits" "math/rand" "time" ) const ( // maxLevel denotes the maximum height of the skiplist. This height will keep the skiplist // efficient for up to 34m entries. If there is a need for ...
weed/util/skiplist/skiplist.go
0.798972
0.448849
skiplist.go
starcoder
package analysis import ( "sync" "image" "context" "runtime" "github.com/anthonynsimon/bild/convolution" ) // Return true if the board has been erased func BoardIsErased(img *image.RGBA, erasedBoard *image.RGBA) bool { return AreImgsEqual(img, erasedBoard) } // Convolve images before comparing them to discard ...
analysis/analysis.go
0.835651
0.497192
analysis.go
starcoder
package schemes import "image/color" // Classic is a color scheme that goes through a variety of colors. var Classic []color.Color func init() { Classic = []color.Color{ color.RGBA{R: 0xff, G: 0xed, B: 0xed, A: 0xff}, color.RGBA{R: 0xff, G: 0xe0, B: 0xe0, A: 0xff}, color.RGBA{R: 0xff, G: 0xd1, B: 0xd1, A: 0xf...
schemes/classic.go
0.546254
0.753285
classic.go
starcoder
package boopy import ( "hash" "github.com/jseam2/boopy/api" ) // Storage defines the interface that allows the node to communicate with the underlying distributed map of [key] to [value] type Storage interface { Get(string) ([]byte, error) Set(string, string) error Delete(string) error Between([]byte, []byte) ...
storage.go
0.744192
0.487185
storage.go
starcoder
package gochess // represents the state of a square on board type square struct { id int // used to represent the position of square 0-63 piecePointer *piece // pointer to a piece lying on it, if any } type direction int const ( left direction = iota right top bottom ) // A few helper functions /...
gochess/square.go
0.837055
0.441312
square.go
starcoder
package term import "math" // NelsonSiegelSvensson represents a spot-rate term structure // Source: https://data.snb.ch/en/topics/ziredev#!/doc/explanations_ziredev#interest_rates_meth_par_siegel type NelsonSiegelSvensson struct { B0 float64 `json:"b0"` B1 float64 `json:"b1"` B2 float64 `json:"b2"` B3...
pkg/term/nss.go
0.727395
0.573081
nss.go
starcoder
package queen import ( "github.com/xdean/share/go/genetic/genetic" "math" "math/rand" ) func ScoreNormalizeLossReciprocal(factor float64) func(genetic.ScoreFunc) genetic.ScoreFunc { return func(origin genetic.ScoreFunc) genetic.ScoreFunc { return func(p genetic.Population, i int) ([]float64, float64) { score...
go/genetic/queen/m2.go
0.647464
0.449755
m2.go
starcoder
package engine import "math" // Collider resolves collisions. type Collider struct { m *Tilemap } // SetTilemap sets the Collider's Tilemap. func (c *Collider) SetTilemap(m *Tilemap) { c.m = m } // Resolve handles a collision. func (c *Collider) Resolve(src, dst Vec2) Vec2 { if c.m == nil { return dst } ix,...
engine/collider.go
0.742328
0.467028
collider.go
starcoder
package camera import "fmt" // Camera provide coordinate transformation type Camera struct { screenW, screenH int // World coordinates lookAtX, lookAtY float64 // pointing camera at sTop, sBottom, sLeft, sRight float64 // area that is on screen zoom float64 zoomInv ...
camera.go
0.799207
0.408572
camera.go
starcoder
package metric import ( "sort" "sync" clientmodel "github.com/prometheus/client_golang/model" "github.com/prometheus/prometheus/utility" ) // An initialSeriesArenaSize of 4*60 allows for one hour's worth of storage per // metric without any major reallocations - assuming a sample rate of 1 / 15Hz. const initia...
storage/metric/memory.go
0.744471
0.42656
memory.go
starcoder
package native import ( "reflect" "unsafe" "github.com/pkg/errors" . "gorgonia.org/tensor" ) func checkNativeIterable(t *Dense, dims int, dt Dtype) error { // checks: if !t.IsNativelyAccessible() { return errors.Errorf("Cannot convert *Dense to *mat.Dense. Data is inaccessible") } if t.Shape().Dims() != ...
native/iterator_native.go
0.743261
0.413004
iterator_native.go
starcoder
package service import ( "image" "image/color" "image/draw" "math" "github.com/golang/freetype" "github.com/golang/freetype/truetype" ) // Image Image. type Image struct { *image.RGBA } // newImage create a new image func newImage(width, length int) *Image { img := &Image{image.NewRGBA(image.Rect(0, 0, widt...
app/interface/main/captcha/service/image.go
0.606964
0.413892
image.go
starcoder
package functional import ( "encoding/json" "math" "github.com/awslabs/karpenter/pkg/utils/log" "go.uber.org/multierr" ) // GreaterThanInt32 returns values greater than the target value func GreaterThanInt32(values []int32, target int32) (results []int32) { return FilterInt32(values, target, func(a int32, b int...
pkg/utils/functional/functional.go
0.745676
0.429609
functional.go
starcoder
package main import ( "github.com/0xe2-0x9a-0x9b/Go-SDL/sdl" "github.com/banthar/gl" "image" "image/color" "image/draw" _ "image/png" "math" "os" "unsafe" ) type Vector struct { x float32 y float32 } func (v Vector) Normalized() Vector { length := float32(math.Sqrt(float64(v.x*v.x + v.y*v.y))) if lengt...
utils.go
0.68658
0.431105
utils.go
starcoder
package quicktime import "bytes" import "encoding/binary" import "errors" import "io" import "fmt" // AtomHeaderLength is the length of a standard Atom header in bytes: // a 4 byte atom size, and a 4 byte atom type. const AtomHeaderLength = 8 // ExtendedHeaderLength is the length of an extended Quicktime Header: // ...
atom.go
0.818628
0.575349
atom.go
starcoder
package twod // implements the known-level algorithms of: // <NAME>, <NAME>, // A survey and comparison of guillotine heuristics for the 2D oriented offline strip packing problem, // Discrete Optimization, // Volume 6, Issue 2, // 2009, // Pages 174-188, // ISSN 1572-5286, // https://doi.org/10.1016/j.disopt.2008.11.0...
pkg/twod/knownlevel.go
0.724383
0.450903
knownlevel.go
starcoder
package utils import "math" // Vec2 is a coordinate in 2D space type Vec2 struct { x float32 y float32 length float32 } // V2 creates a new Vec2 func V2(x, y float32) Vec2 { return Vec2{ x: x, y: y, length: float32(math.Sqrt(float64(x*x + y*y))), } } // X coordinate func (a *Vec2) X()...
utils/vec2.go
0.919634
0.753829
vec2.go
starcoder
package list import ( "fmt" "github.com/flowonyx/functional/errors" "github.com/flowonyx/functional/option" ) // Item is the same as values[index] but instead of a panic // it returns a IndexOutOfRangeErr if index is outside of the range of indexes in values. func Item[T any](index int, values []T) (T, error) { ...
list/item.go
0.691289
0.659912
item.go
starcoder