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 mysql import "github.com/go-jet/jet/v2/internal/jet" // Expression is common interface for all expressions. // Can be Bool, Int, Float, String, Date, Time, Timez, Timestamp or Timestampz expressions. type Expression = jet.Expression // BoolExpression interface type BoolExpression = jet.BoolExpression // Str...
mysql/expressions.go
0.587115
0.412648
expressions.go
starcoder
package processor import ( "bytes" "context" "fmt" "strconv" "time" "github.com/Jeffail/benthos/v3/internal/bloblang/field" "github.com/Jeffail/benthos/v3/internal/docs" "github.com/Jeffail/benthos/v3/internal/interop" "github.com/Jeffail/benthos/v3/lib/log" "github.com/Jeffail/benthos/v3/lib/message/tracin...
lib/processor/dedupe.go
0.800146
0.647826
dedupe.go
starcoder
// Package attrrange simplifies tracking of attributes that apply to a range of // items. // Refer to the examples in the test file for details on usage. package attrrange import ( "fmt" "sort" ) // AttrRange is a range of items that share the same attributes. type AttrRange struct { // Low is the first position ...
private/attrrange/attrrange.go
0.826922
0.431405
attrrange.go
starcoder
package execution import ( "reflect" "regexp" "github.com/cube2222/octosql" "github.com/pkg/errors" ) type Relation interface { Apply(variables octosql.Variables, left, right Expression) (bool, error) } type Equal struct { } func NewEqual() Relation { return &Equal{} } func (rel *Equal) Apply(variables octo...
execution/relation.go
0.804713
0.413773
relation.go
starcoder
package imageutil import ( "fmt" "image" "math" "strconv" ) // Areas represents a list of relative crop areas. type Areas []Area // Area represents a relative crop area. type Area struct { Name string `json:"name,omitempty"` X float32 `json:"x,omitempty"` Y float32 `json:"y,omitempty"` W float32 `j...
imageutil/area.go
0.911232
0.577793
area.go
starcoder
package cell func AppendTo(list Cell, elements ...Cell) Cell { var pair, prev, start Cell index := 0 start = Null if list == nil { panic("cannot append to non-existent list") } if list != Null { start = list for prev = list; Cdr(prev) != Null; prev = Cdr(prev) { } } else if len(elements) > 0 { ...
pkg/cell/cell.go
0.596551
0.582907
cell.go
starcoder
package vm const ( set2BitsMask = uint16(0b1100_0000_0000_0000) set3BitsMask = uint16(0b1110_0000_0000_0000) set4BitsMask = uint16(0b1111_0000_0000_0000) set5BitsMask = uint16(0b1111_1000_0000_0000) set6BitsMask = uint16(0b1111_1100_0000_0000) set7BitsMask = uint16(0b1111_1110_0000_0000) ) // bitvec is a bit v...
minigeth/core/vm/analysis.go
0.538255
0.444384
analysis.go
starcoder
package govatar import ( "github.com/disintegration/imaging" "golang.org/x/crypto/scrypt" "image" "image/color" "image/draw" "math/rand" ) var ( blockX int blockY int rows int columns int numBlocks int keyLength int ) type block struct{} // Create the avatar and return as image.Image func ...
govatar.go
0.610802
0.414425
govatar.go
starcoder
package marc21 import ( "bytes" "errors" "strings" ) /* https://www.loc.gov/marc/specifications/specrecstruc.html Data fields in MARC 21 formats are assigned tags beginning with ASCII numeric characters other than two zeroes. Such fields contain indicators and subfield codes, as well as data and a fi...
pkg/marc21/datafield.go
0.745954
0.703639
datafield.go
starcoder
package stats import ( "math" "sort" ) // Mean returns the mean of the slice. func Mean(input []float64) float64 { sum := 0.0 for _, in := range input { sum += in } return sum / float64(len(input)) } // Median returns the median of the slice. Panics if the input is not sorted. func Median(input []float64) (o...
stats.go
0.848455
0.586138
stats.go
starcoder
package st // node of the tree type node struct { key Comparable value interface{} left *node right *node nodes int // number of nodes in subtree rooted in this node } // BST is Binary Search Tree based implementation of the SymbolTable type BST struct { root *node } func NewBST() OrderedSymbolTable { retu...
st/bst.go
0.718792
0.416025
bst.go
starcoder
package rasterizer import ( "image" "github.com/tdewolff/canvas" "golang.org/x/image/draw" "golang.org/x/image/math/f64" "golang.org/x/image/vector" ) // Draw draws the canvas on a new image with given resolution (in dots-per-millimeter). // Higher resolution will result in bigger images. func Draw(c *canvas.Ca...
rasterizer/renderer.go
0.725551
0.561275
renderer.go
starcoder
package encryptedconfigvalue import ( "fmt" "github.com/palantir/go-encrypted-config-value/encryption" ) // AlgorithmType represents the algorithm used to encrypt a value. type AlgorithmType string const ( AES = AlgorithmType("AES") RSA = AlgorithmType("RSA") ) type keyPairGenerator func() (KeyPair, error) t...
vendor/github.com/palantir/go-encrypted-config-value/encryptedconfigvalue/algorithms.go
0.845049
0.481149
algorithms.go
starcoder
package server import ( "math" "sync/atomic" ) const ( gcTick uint64 = 3 // ChangeTickThreashold is the minimum number of ticks required to update // the state of the rate limiter. ChangeTickThreashold uint64 = 10 ) type followerState struct { tick uint64 inMemLogSize uint64 } // RateLimiter is the...
internal/server/rate.go
0.747432
0.501221
rate.go
starcoder
package iso20022 // Account between an investor(s) and a fund manager or a fund. The account can contain holdings in any investment fund or investment fund class managed (or distributed) by the fund manager, within the same fund family. type InvestmentAccount43 struct { // Unique and unambiguous identification for t...
InvestmentAccount43.go
0.692434
0.452899
InvestmentAccount43.go
starcoder
package main import ( "bufio" "fmt" "image" "image/color" "image/gif" "io" "os" "strconv" "strings" "sync" ) var palette = []color.Color{color.White, color.Black} const ( whiteIndex = iota blackIndex ) func usage() { fmt.Fprintln(os.Stderr, `Usage: ./mandelbrot [flags] The following flags are valid: ...
mandelbrot.go
0.550003
0.403391
mandelbrot.go
starcoder
package stat import ( fn "github.com/tokenme/go-fn/fn" "math" ) const π = float64(math.Pi) const ln2 = math.Ln2 const lnSqrt2π = 0.918938533204672741780329736406 // log(sqrt(2*pi)) const min64 = math.SmallestNonzeroFloat64 // DBL_MIN const eps64 = 1.1102230246251565e-16 // DBL_EPSILON const ...
stat/fn.go
0.701509
0.444927
fn.go
starcoder
package nn import ( "github.com/jcla1/matrix" "math" ) type TrainingExample struct { Input, ExpectedOutput *matrix.Matrix } type Parameters []*matrix.Matrix type Deltas []*matrix.Matrix func CostFunction(data []TrainingExample, thetas Parameters, lambda float64) float64 { cost := float64(0) var estimation []fl...
nn.go
0.816699
0.767123
nn.go
starcoder
package client import ( "encoding/json" ) // PeriodRetentionOptions struct for PeriodRetentionOptions type PeriodRetentionOptions struct { Type RetentionTypes `json:"type"` Count int32 `json:"count"` } // NewPeriodRetentionOptions instantiates a new PeriodRetentionOptions object // This constructor will assign d...
client/model_period_retention_options.go
0.826607
0.499573
model_period_retention_options.go
starcoder
package imagexp import ( "image/color" "math" ) func BasicGrayscale(r, g, b, _ uint32) color.Gray16 { avg := float64((r + g + b) / 3) return color.Gray16{uint16(math.Ceil(avg))} } func ImprovedGrayscale(r, g, b, _ uint32) color.Gray16 { avg := float64(0.3)*float64(r) + float64(0.59)*float64(g) + float64(0.11)*...
filters.go
0.824568
0.459076
filters.go
starcoder
package output import ( "github.com/Jeffail/benthos/v3/internal/docs" "github.com/Jeffail/benthos/v3/internal/metadata" "github.com/Jeffail/benthos/v3/lib/log" "github.com/Jeffail/benthos/v3/lib/metrics" "github.com/Jeffail/benthos/v3/lib/output/writer" "github.com/Jeffail/benthos/v3/lib/types" ) //------------...
lib/output/gcp_pubsub.go
0.720958
0.735784
gcp_pubsub.go
starcoder
// Package verify holds helpers for validating the correctness of various // artifacts and proofs used in the system. package verify import ( "bytes" "encoding/json" "fmt" "github.com/google/trillian-examples/binary_transparency/firmware/api" "github.com/google/trillian-examples/binary_transparency/firmware/int...
binary_transparency/firmware/internal/verify/bundle.go
0.626353
0.407186
bundle.go
starcoder
package main import "math" func isSameTree(p *TreeNode, q *TreeNode) bool { if p == nil || q == nil { return p == q } return p.Val == q.Val && isSameTree(p.Left, q.Left) && isSameTree(p.Right, q.Right) } func isMirror(p *TreeNode, q *TreeNode) bool { if p == nil || q == nil { return p == q } return p.Val =...
binarytree/checks.go
0.79799
0.465813
checks.go
starcoder
package nvm // Matrix is a matrix interface. type Matrix interface { // IsNaM reports whether `m` is "Not-a-Matrix". IsNaM() bool // Dims returns the rows `r` and cols `c` of the matrix. Dims() (r, c int) // At returns the element at position `i`th row and `j`th col. // At will panic if `i` or `j` is out of b...
nvm/matrix.go
0.902064
0.784897
matrix.go
starcoder
package raymath import ( "math" "github.com/gen2brain/raylib-go/raylib" ) // Vector2Zero - Vector with components value 0.0 func Vector2Zero() rl.Vector2 { return rl.NewVector2(0.0, 0.0) } // Vector2One - Vector with components value 1.0 func Vector2One() rl.Vector2 { return rl.NewVector2(1.0, 1.0) } // Vector...
raymath/raymath.go
0.9277
0.795896
raymath.go
starcoder
package linear import ( "github.com/amitkgupta/goodlearn/data/dataset" "github.com/amitkgupta/goodlearn/data/row" "github.com/amitkgupta/goodlearn/data/slice" "github.com/amitkgupta/goodlearn/errors/regressor/linearerrors" "github.com/amitkgupta/goodlearn/parameterestimator/gradientdescentestimator" ) func NewLi...
regressor/linear/linear.go
0.681409
0.426381
linear.go
starcoder
// Package se provides holiday definitions for Sweden. package se import ( "time" "github.com/devechelon/cal/v2" "github.com/devechelon/cal/v2/aa" ) var ( // Nyarsdagen represents New Year's Day on 1-Jan Nyarsdagen = aa.NewYear.Clone(&cal.Holiday{Name: "Nyårsdagen", Type: cal.ObservancePublic}) // Trettonded...
v2/se/se_holidays.go
0.52683
0.522385
se_holidays.go
starcoder
package model import ( "fmt" "log" "math" "github.com/drakos74/oremi/label" ) // Series is a collection of vectors type Series struct { vectors []Vector index int dim int min Vector max Vector labels []label.Label events chan Event } // NewSeries creates a new series of the specified dime...
internal/data/model/series.go
0.770637
0.54819
series.go
starcoder
package entropy import ( "encoding/binary" "errors" kanzi "github.com/flanglet/kanzi-go" ) const ( _BINARY_ENTROPY_TOP = uint64(0x00FFFFFFFFFFFFFF) _MASK_0_56 = uint64(0x00FFFFFFFFFFFFFF) _MASK_0_24 = uint64(0x0000000000FFFFFF) _MASK_0_32 = uint64(0x00000000FFFFFFFF) ) // BinaryEnt...
entropy/BinaryEntropyCodec.go
0.855036
0.420838
BinaryEntropyCodec.go
starcoder
package dither import ( "image" "image/color" ) // When determining which color is nearest to a pixel, // color.Palette.Convert() almost solves the problem, but doesn't // quite manage it. It does not contemplate colors with negative // values (as can happen after applying the error term in the // dithering algorit...
dither/dither.go
0.683947
0.455078
dither.go
starcoder
package gorgonnx import ( "errors" "github.com/owulveryck/onnx-go" "gorgonia.org/gorgonia" ) // SPEC: https://github.com/onnx/onnx/blob/master/docs/Operators.md#BatchNormalization // Gorgonia implem: https://godoc.org/gorgonia.org/gorgonia#BatchNorm type batchnorm struct { epsilon float64 momentum float64 } ...
backend/x/gorgonnx/batchnorm.go
0.687525
0.40436
batchnorm.go
starcoder
package scsu import ( "bytes" "errors" "fmt" "io" "strings" "unicode/utf16" ) type Reader struct { scsu brd io.ByteReader bytesRead int } var ( ErrIllegalInput = errors.New("illegal input") ) func NewReader(r io.ByteReader) *Reader { d := &Reader{ brd: r, } d.init() return d } func (r *Reader...
decode.go
0.596198
0.408926
decode.go
starcoder
package batchingchannels import ( "context" "errors" "github.com/askiada/external-sort/vector" "golang.org/x/sync/errgroup" "golang.org/x/sync/semaphore" ) // BatchingChannel implements the Channel interface, with the change that instead of producing individual elements // on Out(), it batches together the enti...
file/batchingchannels/batching_channel.go
0.707304
0.44089
batching_channel.go
starcoder
// Package bulletproof implements the zero knowledge protocol bulletproofs as defined in https://eprint.iacr.org/2017/1066.pdf package bulletproof import ( crand "crypto/rand" "math/big" "github.com/gtank/merlin" "github.com/pkg/errors" "github.com/coinbase/kryptology/pkg/core/curves" ) // RangeProver is the ...
pkg/bulletproof/range_prover.go
0.865053
0.474509
range_prover.go
starcoder
package techan import ( "fmt" "math" "math/rand" "testing" "time" "strconv" "github.com/adrenalyse/big" "github.com/stretchr/testify/assert" ) var candleIndex int var mockedTimeSeries = mockTimeSeriesFl( 64.75, 63.79, 63.73, 63.73, 63.55, 63.19, 63.91, 63.85, 62.95, 63.37, 61.33, 61.51) func randomTime...
testutils.go
0.61832
0.468365
testutils.go
starcoder
package voice import ( "github.com/gotracker/gomixing/panning" "github.com/gotracker/gomixing/sampling" "github.com/gotracker/gomixing/volume" "github.com/gotracker/voice" "github.com/gotracker/voice/period" "gotracker/internal/optional" ) type envSettings struct { enabled optional.Value //bool pos optio...
internal/voice/transaction.go
0.749912
0.497864
transaction.go
starcoder
package dt import ( "math" "reflect" ) func MapReflectType(p reflect.Kind) Type { switch p { case reflect.Bool: return BoolType case reflect.Int, reflect.Int8, reflect.Int16, reflect.Int32, reflect.Int64: return NumberType case reflect.Uint, reflect.Uint8, reflect.Uint16, reflect.Uint32, reflect.Uint64: r...
reflect.go
0.579043
0.574813
reflect.go
starcoder
package image2d // GetR returns the red value of the pixel at (x,y). func (img *Image2D) GetR(x, y int) uint8 { idx := img.getIdx(x, y) return img.data[idx] } // GetG returns the green value of the pixel at (x,y). func (img *Image2D) GetG(x, y int) uint8 { idx := img.getIdx(x, y) return img.data[idx+1] } // GetB...
pkg/view/image/image2d/pixel.go
0.881507
0.653991
pixel.go
starcoder
package primers import ( "bytes" "math" "strings" "github.com/Open-Science-Global/poly/transform" ) // For reference: https://www.sigmaaldrich.com/technical-documents/articles/biology/oligos-melting-temp.html // thermodynamics stores enthalpy (dH, kcal/mol) and entropy (dS, cal/mol-K) values for nucleotide pair...
poly/primers/primers.go
0.729905
0.523968
primers.go
starcoder
package lo import "sync" type synchronize struct { locker sync.Locker } func (s *synchronize) Do(cb func()) { s.locker.Lock() Try0(cb) s.locker.Unlock() } // Synchronize wraps the underlying callback in a mutex. It receives an optional mutex. func Synchronize(opt ...sync.Locker) *synchronize { if len(opt) > 1 ...
vendor/github.com/samber/lo/concurrency.go
0.764364
0.438725
concurrency.go
starcoder
package base62 import ( "fmt" "math" ) // Base62 alphabet, mapped from number to string, and from rune (char) to number var numberToString = [62]string{"0", "1", "2", "3", "4", "5", "6", "7", "8", "9", "a", "b", "c", "d", "e", "f", "g", "h", "i", "j", "k", "l", "m", "n", "o", "p", "q", "r", "s", "t", "u", "v", "w",...
base62.go
0.662796
0.430746
base62.go
starcoder
package ast // Node is the interface implemented by all nodes in the AST. It // provides information about the span of this AST node in terms // of location in the source file. It also provides information // about all prior comments (attached as leading comments) and // optional subsequent comments (attached as trail...
ast/node.go
0.73412
0.513912
node.go
starcoder
package graphql import ( "github.com/graphql-go/graphql" "github.com/graphql-go/graphql/language/ast" ) // CoerceType converts ast.Type to graphql.Type func CoerceType(typ ast.Type, typMap map[string]graphql.Type) graphql.Type { switch typ.GetKind() { case "Named": if IsScalarType(typ.(*ast.Named).Name.Value) {...
trigger/graphql/utils.go
0.692538
0.431345
utils.go
starcoder
package approvers import "k8s.io/apimachinery/pkg/util/sets" // NewApprovers create a new "Approvers" with no approval. func NewApprovers(owners Owners) Approvers { return Approvers{ owners: owners, approvers: sets.NewString(), assignees: sets.NewString(), } } // Approvers is struct that provide functiona...
approvers/approvers.go
0.650023
0.404419
approvers.go
starcoder
package internal import ( "io" "github.com/pkg/errors" "gonum.org/v1/plot" "gonum.org/v1/plot/plotter" "gonum.org/v1/plot/plotutil" "gonum.org/v1/plot/vg" ) // Plotter knows how to draw a picture to a writer type Plotter struct { } // ToPlotType converts a string name to a known plot type func ToPlotType(s st...
internal/plotter.go
0.734786
0.415551
plotter.go
starcoder
package plotting import ( . "github.com/WiseBird/genetic_algorithm" "math" pplot "code.google.com/p/plotinum/plot" "code.google.com/p/plotinum/plotter" "code.google.com/p/plotinum/plotutil" "io" "os" "path/filepath" "strings" "code.google.com/p/plotinum/vg" "code.google.com/p/plotinum/vg/vgeps" "code.go...
plotting/plotter.go
0.689724
0.400486
plotter.go
starcoder
package geom //go:generate goderive . import ( "errors" "fmt" "math" ) // A Layout describes the meaning of an N-dimensional coordinate. Layout(N) for // N > 4 is a valid layout, in which case the first dimensions are interpreted // to be X, Y, Z, and M and extra dimensions have no special meaning. M values // a...
vendor/github.com/whosonfirst/go-whosonfirst-static/vendor/github.com/whosonfirst/go-whosonfirst-readwrite-sqlite/vendor/github.com/whosonfirst/go-whosonfirst-sqlite-features/vendor/github.com/twpayne/go-geom/geom.go
0.774157
0.454654
geom.go
starcoder
package reldate import ( "errors" "strings" "time" ) const ( // The standard format for dates I find convient YYYYMMDD = "2006-01-02" // Version of this package Version = "v0.0.2" ) // finds the end of the month value (e.g. 28, 29, 30, 31) func EndOfMonth(t1 time.Time) string { location := t1.Location() yea...
reldate/reldate.go
0.575707
0.583055
reldate.go
starcoder
package tcg // Clear - fill whole buffer with White func (b *Buffer) Clear() { for y := 0; y < len(b.buffer); y++ { for x := 0; x < len(b.buffer[y]); x++ { b.buffer[y][x] = 0 } } } // Invert pixels in the buffer func (b *Buffer) Invert() { for y := 0; y < len(b.buffer); y++ { for x := 0; x < len(b.buffer[...
transform.go
0.576304
0.548492
transform.go
starcoder
package main import ( "log" "os" "fmt" "math" "math/rand" "time" ) // Terminal func expr_x(x float64, y float64) float64 { return x } func expr_y(x float64, y float64) float64 { return y } // Single func expr_sin(e float64) float64 { return math.Sin(math.Pi * e) } func expr_cos(e float64) float64 { ret...
random-art/art.go
0.556159
0.566139
art.go
starcoder
package option import ( "github.com/dairaga/gs" "github.com/dairaga/gs/funcs" ) // From returns a Some with given v if given ok is true, or returns a None. func From[T any](v T, ok bool) gs.Option[T] { if ok { return gs.Some(v) } return gs.None[T]() } // FromWithErr returns a Some with given v if given err i...
option/option.go
0.713032
0.583352
option.go
starcoder
package kvcodec import ( "fmt" "reflect" "strconv" "strings" ) func toString(in interface{}) (string, error) { inValue := reflect.ValueOf(in) switch inValue.Kind() { case reflect.String: return inValue.String(), nil case reflect.Bool: b := inValue.Bool() if b { return "true", nil } return "false...
vendor/github.com/bcicen/go-haproxy/kvcodec/types.go
0.555676
0.440108
types.go
starcoder
package forGraphBLASGo import "github.com/intel/forGoParallel/parallel" func isAnyIndexOutOfBounds(indices []int, size int) bool { return parallel.RangeOr(0, len(indices), func(low, high int) bool { for i := low; i < high; i++ { if index := indices[i]; index < 0 || index >= size { return true } } ret...
api_Assign.go
0.620507
0.50769
api_Assign.go
starcoder
package gridspech import "fmt" // Valid returns if all tiles in the grid are valid. func (g Grid) Valid() bool { for x := 0; x < g.Width(); x++ { for y := 0; y < g.Height(); y++ { if !g.ValidTile(TileCoord{X: x, Y: y}) { return false } } } return true } // ValidTile returns if t is valid in g. If al...
rules.go
0.787441
0.690523
rules.go
starcoder
package cbor import ( "math" "math/big" "github.com/gocardano/go-cardano-client/errors" log "github.com/sirupsen/logrus" "github.com/x448/float16" ) // decodeArray parses the next array object. // Only called after the majorType array has been determined. func (r *BitstreamReader) decodeArray() (*Array, error) ...
cbor/bitstreamreader_decoder.go
0.671471
0.426441
bitstreamreader_decoder.go
starcoder
package edwards25519 import ( "crypto/subtle" "encoding/hex" "fmt" ) // (X:Y:Z:T) satisfying x=X/Z, y=Y/Z, X*Y=Z*T. Aka P3. type ExtendedPoint struct { X, Y, Z, T FieldElement } // ((X:Z),(Y:T)) satisfying x=X/Z, y=Y/T. Aka P1P1. type CompletedPoint struct { X, Y, Z, T FieldElement } // (X:Y:Z) satisfying x=X...
vendor/github.com/bwesterb/go-ristretto/edwards25519/curve.go
0.679285
0.520374
curve.go
starcoder
package dst // F-distribution, alias Fisher-Snedecor distribution // FPDF returns the PDF of the F distribution. func FPDF(d1, d2 int64) func(x float64) float64 { df1 := float64(d1) df2 := float64(d2) normalization := 1 / B(df1/2, df2/2) return func(x float64) float64 { return normalization * sqrt(pow(df1*x, ...
dst/f.go
0.882079
0.566498
f.go
starcoder
package filter import ( "github.com/biogo/biogo/alphabet" "github.com/biogo/biogo/index/kmerindex" "github.com/biogo/biogo/seq/linear" "sort" ) const ( diagonalPadding = 2 ) // A Merger aggregates and clips an ordered set of trapezoids. type Merger struct { target, query *linear.Seq filterParam...
align/pals/filter/merge.go
0.691602
0.42054
merge.go
starcoder
package core import ( "log" "github.com/go-gl/mathgl/mgl64" ) // PhysicsSystem is an interface which wraps all physics related logic. type PhysicsSystem interface { // Start is called by the application at startup time. Implementations should perform bootstapping here. Start() // Stop is called by the applicat...
core/physics.go
0.762954
0.594698
physics.go
starcoder
package bookstore import ( "math" "sort" ) const bookPrice = 800 // 800 cents = $8.00 var discountTiers = [...]int{0, 5, 10, 20, 25} // Cost implements the book store exercise. func Cost(books []int) int { organize(books) return cost(books, 0) } // rework the input array so all the repetitions // are together ...
exercises/book-store/example.go
0.644896
0.407569
example.go
starcoder
package ttt import ( "sort" "strings" ) /* DataStore shows master of lectures and course data. */ type DataStore interface { Lectures() []Lecture Courses() []Course Init() error } /* Grade means target grades of lectures. */ type Grade int /* CreditCount means credits of a lectures. */ type CreditCount int /*...
ttt.go
0.543348
0.434581
ttt.go
starcoder
--------------------------------------------------------------------------- Copyright (c) 2013-2015 AT&T Intellectual Property Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at: h...
clike/atof.go
0.820901
0.454714
atof.go
starcoder
package country import ( "strconv" "strings" ) //go:generate go run parser.go type ( Name string Alpha2Code string Numeric3Code string ) // Country holds fields for a country as defined by ISO 3166. type Country struct { Name string Alpha2Code string Numeric3Code string } // NameToNum c...
country.go
0.575827
0.484868
country.go
starcoder
package golds // Slice is a sequence of values. // Basically it's an utility wrapper around a plain slice. type Slice[E any] []E // NewSlice puts provided values into resulting slice. //export func NewSlice[E any](vv ...E) Slice[E] { return Slice[E](vv) } // Repeat returns a new Slice[E] with n copies of v. func Re...
slice.go
0.777807
0.508178
slice.go
starcoder
package plot import ( "math" ) // Bar implements a stacked-bar plot. type Bar struct { Style Label string DynamicWidth bool DynamicMinWidth float64 Data []Point } // NewBar creates a bar plot from the given points. func NewBar(label string, points []Point) *Bar { return &Bar{ Label: label, ...
bar.go
0.853394
0.612657
bar.go
starcoder
package bst import ( "fmt" ) // ========================================================================== // Primary Tree Algorithms // __________________________________________________________________________ /*The basic tree structure has an integer for a value. Like most trees, it has "children" that can also...
bst/bst.go
0.741674
0.449393
bst.go
starcoder
package data import ( "expvar" "fmt" ) const ( // UnknownType indicates that the VarType wasn't set. UnknownType VarType = 0 // IntType indicates we are storing an Int. IntType VarType = 1 // FloatType indicates we are storing a Float. FloatType VarType = 2 // StringType indicates we are storing a String. S...
development/telemetry/streaming/river/state/data/data.go
0.686055
0.50952
data.go
starcoder
package dict import ( "errors" "fmt" "math/big" "github.com/mmcloughlin/addchain" "github.com/mmcloughlin/addchain/alg" "github.com/mmcloughlin/addchain/internal/bigint" "github.com/mmcloughlin/addchain/internal/bigints" ) // RunsAlgorithm is a custom variant of the dictionary approach that decomposes // a ta...
vendor/github.com/mmcloughlin/addchain/alg/dict/runs.go
0.77518
0.437583
runs.go
starcoder
package redblack import ( "sync" ) const ( red = false black = true ) // color is used to indicate the color of a node. type color bool // Key provides a method for determine if a value is less than another value. type Key interface{ // LessThan indicates that Key is less than LessThan(value). LessThan(in...
development/tree/redblack/redblack.go
0.765856
0.427815
redblack.go
starcoder
package quickhull import ( "github.com/golang/geo/r3" ) type ConvexHull struct { optimizedVertexBuffer []r3.Vector Vertices []r3.Vector Indices []int } func (hull ConvexHull) Triangles() [][3]r3.Vector { triangles := make([][3]r3.Vector, len(hull.Indices)/3) for i, idx := range hull...
convex_hull.go
0.623835
0.642531
convex_hull.go
starcoder
package view import ( "github.com/lesovsky/pgcenter/internal/query" "regexp" "time" ) // View describes how stats received from Postgres should be displayed. type View struct { Name string // View name MinRequiredVersion int // Minimum required Postgres version Q...
internal/view/view.go
0.500732
0.476945
view.go
starcoder
package binomial // Node is a user data node on a binomial Tree. type Node struct { Item interface{} // Consumer data t *Tree // Current tree for this Node } // Tree is a binomial tree. type Tree struct { n *Node // Container for user data k uint // Rank of the tree. // Tree structure pointers. parent *Tree...
binomial/tree.go
0.816809
0.522263
tree.go
starcoder
package onshape import ( "encoding/json" ) // BTAllowEdgePointFilter2371AllOf struct for BTAllowEdgePointFilter2371AllOf type BTAllowEdgePointFilter2371AllOf struct { AllowsEdgePoint *bool `json:"allowsEdgePoint,omitempty"` BtType *string `json:"btType,omitempty"` } // NewBTAllowEdgePointFilter2371AllOf instantia...
onshape/model_bt_allow_edge_point_filter_2371_all_of.go
0.695855
0.442094
model_bt_allow_edge_point_filter_2371_all_of.go
starcoder
package advent2021 import ( "bytes" "fmt" "strconv" log "github.com/sirupsen/logrus" ) // Day3Part1 returns the power consumption of the submarine based off of the diagnostic report intput func Day3Part1(diagnosticReport []string) (powerConsumption int) { var gammaRate []byte var epsilonRate []byte for col :...
internal/pkg/advent2021/day3.go
0.665628
0.558207
day3.go
starcoder
package analyzer import ( "errors" "fmt" "github.com/toshi0607/kompal-weather/pkg/status" "github.com/toshi0607/kompal-weather/pkg/storage" "golang.org/x/net/context" ) type analyzer struct { storage storage.Storage } type ( // Result is an analysis of the last two statuses of how Kompal-yu is crowded Resul...
pkg/analyzer/analyzer.go
0.566019
0.441492
analyzer.go
starcoder
package hist import ( "fmt" "math" "sort" "time" ) // Histogram defines a histogram. type Histogram struct { start int end int scale int max int n int errCnt int total int values []int } // NewHistogram creates a new Histogram. func NewHistogram(max int, scale int) *Histogram { return &His...
hist/hist.go
0.73029
0.46308
hist.go
starcoder
package diff // Line represents an atom of text from the source material, contextualized // by its original index. type Line struct { Index int Text string } // ToLines is a convenience function for creating a slice of Line structs from a // slice of strings as input for NewLCSTable. func ToLines(a []string) []Lin...
lcs.go
0.763484
0.476032
lcs.go
starcoder
package context import ( "github.com/jakubDoka/mlok/ggl" "github.com/jakubDoka/mlok/mat" "github.com/jakubDoka/mlok/mat/rgba" ) // C helps you draw complex objects built from multiple sprites type C []Part // Init Initialized context with given Defaults. This can be called multiple times on same context // and it...
ggl/drw/context/context.go
0.729038
0.478102
context.go
starcoder
package main import ( "bufio" "fmt" "image" "io" "strconv" "strings" ) type Grid struct { lines LineCollection Points [1000][1000]int } func NewGrid(input io.Reader, considerDiagonals bool) *Grid { result := &Grid{ lines: make(LineCollection, 0, 500), } scanner := bufio.NewScanner(input) for scanner....
cmd/day5/Grid.go
0.538741
0.422862
Grid.go
starcoder
// Package descriptions provides the descriptions as used by the graphql endpoint for Weaviate package descriptions // Local const LocalFetch = "Fetch Beacons that are similar to a specified concept from the Things and/or Actions subsets on a Weaviate network" const LocalFetchObj = "An object used to perform a Fuzzy ...
adapters/handlers/graphql/descriptions/fetch.go
0.710729
0.900267
fetch.go
starcoder
package main import ( dl "de.knallisworld/aoc/aoc2019/dayless" "fmt" "math" "strings" "time" ) const AocDay = 3 const AocDayName = "day03" const AocDayTitle = "Day 03" func main() { dl.PrintDayHeader(AocDay, AocDayTitle) defer dl.TimeTrack(time.Now(), AocDayName) dl.PrintStepHeader(0) fmt.Printf("💪 Comput...
day03/main.go
0.520496
0.406685
main.go
starcoder
package queues const ( INF = 2147483647 Gate = 0 Wall = -1 ) type Room struct { row int column int } var directions = [4][2]int{ { -1, 0 }, // North { 1, 0 }, // South { 0, 1 }, // East { 0, -1 }, // West } // wallsAndGates takes a grid of ints representing gates, walls, and empty rooms. // Grid types a...
leetcode_problems/queues/walls_and_gates.go
0.665519
0.458531
walls_and_gates.go
starcoder
package fixture import ( "bufio" "encoding/csv" "io" "log" "os" "strconv" "github.com/g3n/engine/math32" ) type Fixture struct { filepath string // File path pts []*math32.Vector3 // List of relative LED coordinates tpts []*math32.Vector3 // List of transformed coordinates tl ...
cmd/scenebuild/fixture/fixturefile.go
0.571288
0.449634
fixturefile.go
starcoder
package dynamics import ( "fmt" "github.com/SOMAS2020/SOMAS2020/internal/clients/team3/ruleevaluation" "github.com/SOMAS2020/SOMAS2020/internal/common/rules" "github.com/pkg/errors" "gonum.org/v1/gonum/mat" "math" ) func GetDistanceToSubspace(dynamics []dynamic, location mat.VecDense) float64 { if len(dynamics...
internal/clients/team3/dynamics/ruleanalysis.go
0.721154
0.505371
ruleanalysis.go
starcoder
package sortablemap import ( "errors" "fmt" "reflect" ) // convenient function that directly gives iterator, may panic if types are not supported func IteratorFromMap(v interface{}) (iterator *QueryResultIterator) { data, err := DataFromMap(v) if err != nil { panic(err) } return data.Iterator() } // use thi...
from_map.go
0.53777
0.415551
from_map.go
starcoder
package octree import ( "fmt" "strings" ) // Graph provides a basic public interface for graph types. It does not support multi-edges. type Graph interface { // Nodes returns all nodes in the graph. // The result should have a stable order. Nodes() []string // Neighbors returns a list of neighbors (successors)...
octree/graph.go
0.828106
0.592902
graph.go
starcoder
package it import ( "unsafe" "github.com/m4gshm/gollections/c" "github.com/m4gshm/gollections/notsafe" ) //NoStarted is the head Iterator position. const NoStarted = -1 //New creates the Iter based on elements Iter and returs its reference func New[T any, TS ~[]T](elements TS) *Iter[T] { iter := NewHeadS(elemen...
it/impl/it/slice.go
0.656438
0.432483
slice.go
starcoder
// Package mp3gain uses the mp3gain program to analyze MP3s and compute gain adjustments. package mp3gain import ( "fmt" "math" "os/exec" "strconv" "strings" ) // Info contains information about gain adjustments for a song. type Info struct { // TrackGain is the track's dB gain adjustment independent of its al...
cmd/nup/mp3gain/gain.go
0.774924
0.47658
gain.go
starcoder
package common import "math" type Matrix4 struct { elements [16]float32 // COLUMN-MAJOR (just like WebGL) } func NewMatrix4() *Matrix4 { matrix := Matrix4{elements: [16]float32{1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1}} // identity matrix return &matrix } func (self *Matrix4) GetElements() *[16]float32 { ...
common/matrix4.go
0.76207
0.660008
matrix4.go
starcoder
package google_type import proto "github.com/gogo/protobuf/proto" import fmt "fmt" import math "math" // Reference imports to suppress errors if they are not otherwise used. var _ = proto.Marshal var _ = fmt.Errorf var _ = math.Inf // Represents an amount of money with its currency type. type Money struct { // The...
vendor/go.pedge.io/pb/gogo/google/type/money.pb.go
0.564579
0.400398
money.pb.go
starcoder
package UpperBoundConfidence import "math" func UpperBoundConfidence(dataSet [][]float64) (float64, []float64, []float64, []int) { // full dataset N := dataSet // list of objects d := dataSet[0] // list of positives on each round var selected []int // Creates Vector of selections set to 0 numberOfSelections...
Go/UpperBoundConfidence.go
0.726037
0.403214
UpperBoundConfidence.go
starcoder
package conf // Int8Var defines an int8 flag and environment variable with specified name, default value, and usage string. // The argument p points to an int8 variable in which to store the value of the flag and/or environment variable. func (c *Configurator) Int8Var(p *int8, name string, value int8, usage string) { ...
value_int8.go
0.737631
0.418935
value_int8.go
starcoder
package main import ( "fmt" "image/color" "log" "math/rand" "time" "github.com/hajimehoshi/ebiten" "github.com/hajimehoshi/ebiten/ebitenutil" ) const RES int = 400 type Game struct { generation int board [][]int } var ( g *Game ) // A board with empty state func emptyGeneration() *Game { board := ...
main.go
0.626924
0.404949
main.go
starcoder
package p289 /** According to the Wikipedia's article: "The Game of Life, also known simply as Life, is a cellular automaton devised by the British mathematician <NAME> in 1970." Given a board with m by n cells, each cell has an initial state live (1) or dead (0). Each cell interacts with its eight neighbors (horizon...
algorithms/p289/289.go
0.772959
0.717259
289.go
starcoder
package uniline import "github.com/shinichy/go-wcwidth" // char represents a character in the terminal screen // Its size is defined as follows: // - 1 rune // - len(char.b) bytes // - char.colLen terminal columns type char struct { p []byte r rune colLen int } func charFromRune(r rune) char { return ...
vendor/github.com/tiborvass/uniline/utils.go
0.593727
0.493958
utils.go
starcoder
package main import ( "image" "image/color" "image/gif" ) func contain(colors color.Palette, c color.RGBA) (bool, uint8) { for idx, clr := range colors { if clr == c { return true, uint8(idx) } } return false, 0 } func extractPalette(img image.Image) color.Palette { palette := color.Palette{color.Trans...
generateFloorfillGif.go
0.718989
0.450178
generateFloorfillGif.go
starcoder
package main import ( "fmt" "gopkg.in/src-d/go-git.v4" "gopkg.in/src-d/go-git.v4/plumbing/object" "sort" "time" ) const outOfRange = 99999 const daysInLastSixMonths = 183 const weeksInLastSixMonths = 26 type column []int // stats calculates and prints the stats. func stats(repoDirectories []string, email strin...
cmd/git-process.go
0.585812
0.427277
git-process.go
starcoder
package dynamics import ( "math" "github.com/gonum/matrix/mat64" ) const ( oneQuarter = 1 / 4.0 ) var ( eye = mat64.NewDense(3, 3, []float64{1, 0, 0, 0, 1, 0, 0, 0, 1}) ) /*-----*/ /* Modified Rodrigez Parameters */ /*-----*/ // MRP defines Modified Rodrigez Parameters. type MRP struct { s1, s2, s3 float64 }...
examples/angularMomentum/attitude.go
0.818047
0.456894
attitude.go
starcoder
package day8 import ( "fmt" "strconv" "github.com/Marc3842h/Advent-of-Code-2019/inputs" ) var imageWidth = 25 var imageHeight = 6 func PartA() { input := inputs.ReadInputStr(8) layers := make([]layer, 0) counter := 0 layerCount := 0 for _, c := range input { char := string(c) pixel, _ := strconv.Atoi(...
day8/day8.go
0.531453
0.420362
day8.go
starcoder
package cmp import "reflect" // valueNode represents a single node within a report, which is a // structured representation of the value tree, containing information // regarding which nodes are equal or not. type valueNode struct { parent *valueNode Type reflect.Type ValueX reflect.Value ValueY ...
vendor/github.com/elastic/beats/vendor/github.com/google/go-cmp/cmp/report_value.go
0.693473
0.5752
report_value.go
starcoder