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 assert import ( "math" "reflect" "strings" "testing" ) // Assertion contains all the assertions functions with chaining support. type Assertion struct{} // Equal tests two objects for equality. func (a Assertion) Equal(t *testing.T, expected, actual interface{}) Assertion { Mark(t) if isNil(expected) ...
vendor/github.com/gsamokovarov/assert/assertion.go
0.779825
0.692661
assertion.go
starcoder
package hoff import ( "errors" "fmt" "github.com/google/go-cmp/cmp" ) // NodeSystem is a system to configure workflow between action nodes, or decision nodes. // The nodes are linked between them by link and join mode options. // An activated Node system will be walked throw Follow and Ancestors functions type No...
nodesystem.go
0.709321
0.557905
nodesystem.go
starcoder
package slices import ( "errors" "reflect" "github.com/golodash/godash/internal" ) // This method is like SortedIndex except that it accepts a function // which is invoked for value and each element of slice to compute // their sort ranking. The function is invoked with one argument: (value). func SortedIndexBy(s...
slices/sorted_index_by.go
0.809878
0.521349
sorted_index_by.go
starcoder
package gofpdf // SVGBasicWrite renders the paths encoded in the basic SVG image specified by // sb. The scale value is used to convert the coordinates in the path to the // unit of measure specified in New(). The current position (as set with a call // to SetXY()) is used as the origin of the image. The current l...
svgwrite.go
0.654784
0.916297
svgwrite.go
starcoder
package values import ( "fmt" "regexp" arrow "github.com/influxdata/flux/array" "github.com/influxdata/flux/memory" "github.com/influxdata/flux/semantic" ) func NewVectorValue(arr arrow.Array, typ semantic.MonoType) Vector { switch typ { case semantic.BasicInt: return NewIntVectorValue(arr.(*arrow.Int)) ...
values/vector_values.gen.go
0.664105
0.613208
vector_values.gen.go
starcoder
package difference_digest import ( "database/sql" "fmt" ) // InvertibleBloomFilter is a data structure for compactly storing a recoverable representation of a set // See: https://www.ics.uci.edu/~eppstein/pubs/EppGooUye-SIGCOMM-11.pdf type InvertibleBloomFilter struct { Cells []IBFCell Size int } // IBFCell rep...
invertible_bloom_filter.go
0.737347
0.627466
invertible_bloom_filter.go
starcoder
package challenge39 import ( "bytes" "crypto" "crypto/rand" "errors" "fmt" "math/big" ) type RSA struct { N *big.Int E *big.Int d *big.Int } var HashPrefixes = map[crypto.Hash][]byte{ crypto.MD5: {0x30, 0x20, 0x30, 0x0c, 0x06, 0x08, 0x2a, 0x86, 0x48, 0x86, 0xf7, 0x0d, 0x02, 0x05, 0x05, 0x00, 0x04, 0x10}...
set5/challenge39/39.go
0.519278
0.513851
39.go
starcoder
package challenge import "fmt" func makePositive(n int) int { if n >= 0 { return n } return n + -2*n } func makeNegative(n int) int { if n < 0 { return n } return n + -2*n } func rotateWaypoint(current [2]int, direction string, amount int) [2]int { if !(direction == "l" || direction == "r") { panic(fmt...
challenges/2020/12-rainRisk/go/challenge/partTwo.go
0.695855
0.568116
partTwo.go
starcoder
adp provides you with two microservices: 1) a wallet microservice (package wallet) that implements a RESTful API for user requests such as checking the balance of an address or account, sending and getting details of transactions and monitoring addresses. 2) an explorer microservice (package explorer) that provides ...
doc.go
0.739705
0.54958
doc.go
starcoder
package clinical import ( "time" "github.com/savannahghi/firebasetools" "github.com/savannahghi/scalarutils" ) // FHIRObservation definition: measurements and simple assertions made about a patient, device or other subject. type FHIRObservation struct { // The logical id of the resource, as used in the URL for ...
graph/clinical/observation.go
0.876898
0.527803
observation.go
starcoder
package fp // MapIntInt64Err takes two inputs - // 1. Function 2. List. Then It returns a new list after applying the function on each item of the list and error func MapIntInt64Err(f func(int) (int64, error), list []int) ([]int64, error) { if f == nil { return []int64{}, nil } newList := make([]int64, len(list))...
fp/mapioerr.go
0.735452
0.436802
mapioerr.go
starcoder
package storage import ( "sync" "sync/atomic" ) type bucketNode struct { ts uint64 next *bucketNode value uint64 } type timeSeriesAggregator struct { name string mu sync.RWMutex first *bucketNode nodes *sync.Map //map[uint64]*bucketNode formatTs func(uint64) uint64 // format t...
storage/time_series.go
0.568895
0.41117
time_series.go
starcoder
package arbitrary import ( "fmt" "reflect" "sort" "strings" ) type stringEncoder func(val reflect.Value) string func (s stringEncoder) Nil() stringEncoder { return func(val reflect.Value) string { switch val.Kind() { case reflect.Slice, reflect.Chan, reflect.Map, reflect.Ptr: if val.IsZero() { return...
arbitrary/encode-to-string.go
0.626924
0.425068
encode-to-string.go
starcoder
package basic import ( "fmt" "io" "github.com/urfave/cli/v2" "github.com/ipld/go-ipld-prime" "github.com/ipld/go-ipld-prime/codec" "github.com/ipld/go-ipld-prime/codec/dagjson" "github.com/ipld/go-ipld-prime/datamodel" "github.com/ipld/go-ipld-prime/node/basicnode" "github.com/ipld/go-ipld-prime/schema" "g...
app/basic/read.go
0.580828
0.408218
read.go
starcoder
package xex import ( "fmt" "math" "reflect" ) func registerCoreBuiltins() { RegisterFunction( NewFunction( "equals", FunctionDocumentation{ Text: `compares 2 inputs returning a bool`, Parameters: map[string]string{ "val1": "The first value to compare", "val2": "The second value to compa...
builtins_core.go
0.714429
0.625152
builtins_core.go
starcoder
package triangle import ( "github.com/gravestench/pho/geom" "github.com/gravestench/pho/geom/line" "github.com/gravestench/pho/geom/point" ) // New creates a new triangle func New(x1, y1, x2, y2, x3, y3 float64) *Triangle { return &Triangle{ Type: geom.Triangle, X1: x1, Y1: y1, X2: x2, Y2: y2, ...
geom/triangle/triangle.go
0.920874
0.748651
triangle.go
starcoder
package clustering import ( "errors" "fmt" ) // KMeans is a specific implementation of a clustering algorithm. // This is just the basic KMeans implementation. type KMeans struct { Clusterer // maxLoops tells us when to call it quits if we aren't getting // convergence. maxLoops int // tolerance tells us whe...
kmeans.go
0.720467
0.444987
kmeans.go
starcoder
package container import ( "github.com/nwillc/genfuncs" "golang.org/x/exp/maps" ) // GMap implements the Map interface. var _ Map[int, int] = (GMap[int, int])(nil) // GMap is a generic type employing the standard Go map and implementation Map. type GMap[K comparable, V any] map[K]V // All returns true if all valu...
container/gmap.go
0.822688
0.425665
gmap.go
starcoder
package iso20022 // Instruction, initiated by the creditor, to debit a debtor's account in favour of the creditor. A direct debit can be pre-authorised or not. In most countries, authorisation is in the form of a mandate between the debtor and creditor. type DirectDebitMandate2 struct { // Unique and unambiguous ide...
DirectDebitMandate2.go
0.613468
0.457076
DirectDebitMandate2.go
starcoder
package annotation import "fmt" // Definition describes the Annotation definition. type Definition struct { // Name is the Name of the Annotation e.x Hello for // @Hello(). name string // should the definition allow unknown parameters for an annotation allowUnknownParameters bool // parameters has a list of pa...
definition.go
0.775817
0.438725
definition.go
starcoder
package validate import ( "fmt" "time" ) // lessThanfloat64 validates `i` is less than `others`. func lessThanfloat64(i float64, others ...float64) error { for _, other := range others { if i >= other { return fmt.Errorf("expected %v to be less than %v", i, other) } } return nil } // lessThanOrEqualTof...
validate/comparable.go
0.760473
0.515376
comparable.go
starcoder
package fp func (l BoolArray) TakeRight(n int) BoolArray { size := len(l) Require(n >= 0, "index should be >= 0") if n >= size { n = size } acc := make([]bool, n) copy(acc, l[size - n: size]) return acc } func (l StringArray) TakeRight(n int) StringArray { size := len(l) Require(n >= 0, "index should...
fp/bootstrap_array_takeright.go
0.642881
0.632333
bootstrap_array_takeright.go
starcoder
package executor import ( "fmt" "github.com/hculpan/kablang/ast" ) // Executor contains the execution // environment for this interpreter type Executor struct { Errors []error blocks *ast.BlockStack } // NewExecutor ... func NewExecutor() *Executor { result := &Executor{blocks: ast.NewBlockStack()} result.Res...
executor/executor.go
0.648466
0.419886
executor.go
starcoder
package three import ( "math" ) var _vector = NewVector2(0, 0) // NewBox2 : func NewBox2(min, max Vector2) *Box2 { return &Box2{min, max} } // Box2 : type Box2 struct { Min Vector2 Max Vector2 } // Set : func (b Box2) Set(min, max Vector2) *Box2 { b.Min.Copy(min) b.Max.Copy(max) return &b } // SetFromPoi...
server/three/box2.go
0.790288
0.612339
box2.go
starcoder
package utils import ( "strconv" "math/big" ) func Factors(n uint64) ([]uint64) { factors := make([]uint64, 0, 2) for i := uint64(2); n > 1; { if n % i == 0 { factors = append(factors, i) n /= i } else { i++ } } return factors } fu...
go/src/utils/utils.go
0.623262
0.425009
utils.go
starcoder
package meshes import ( "errors" "fmt" "github.com/bloeys/assimp-go/asig" "github.com/bloeys/gglm/gglm" "github.com/bloeys/nmage/asserts" "github.com/bloeys/nmage/buffers" ) type Mesh struct { Name string Buf buffers.Buffer } func NewMesh(name, modelPath string, postProcessFlags asig.PostProcess) (*Mesh, e...
meshes/mesh.go
0.560253
0.483466
mesh.go
starcoder
package store import ( "errors" "math" ) // A bptree is an in-memory B+ tree implementation of Store. type bptree struct { b int root treenode } // Get searches for a value in the B+ tree. func (t *bptree) Get(key int) []byte { return t.root.get(key) } // GetRange searches for all key-value pairs with keys ...
store/bptree.go
0.764496
0.422922
bptree.go
starcoder
package scp import "sort" // ValueSet is a set of Value, implemented as a sorted slice. type ValueSet []Value func (vs ValueSet) find(v Value) int { return sort.Search(len(vs), func(index int) bool { return !vs[index].Less(v) }) } func ValueEqual(a, b Value) bool { return !a.Less(b) && !b.Less(a) } // Add pro...
go-lang/go/src/github.com/bobg/scp/set.go
0.706089
0.616272
set.go
starcoder
package main const testStr = `Immune System: 17 units each with 5390 hit points (weak to radiation, bludgeoning) with an attack that does 4507 fire damage at initiative 2 989 units each with 1274 hit points (immune to fire; weak to bludgeoning, slashing) with an attack that does 25 slashing damage at initiative 3 Inf...
2018/day24/data.go
0.845369
0.946843
data.go
starcoder
package tetra3d import ( "log" "time" "github.com/kvartborg/vector" ) const ( TrackTypePosition = "Pos" TrackTypeScale = "Sca" TrackTypeRotation = "Rot" InterpolationLinear = iota InterpolationConstant InterpolationCubic // Unimplemented ) type Data struct { contents interface{} } func (data *Data) A...
animation.go
0.739986
0.515437
animation.go
starcoder
package samples func init() { sampleDataProposalCreateOperation[40] = `{ "expiration_time": "2016-07-27T17:59:54", "extensions": [], "fee": { "amount": 2520347, "asset_id": "1.3.0" }, "fee_paying_account": "1.2.102580", "proposed_ops": [ { "op": [ 10, { "bitas...
gen/samples/proposalcreateoperation_40.go
0.656768
0.406509
proposalcreateoperation_40.go
starcoder
package mbtiles // Meta of data. // The metadata table MAY contain additional rows for tile sets that implement UTFGrid-based interaction or for other purposes. // see: https://github.com/mapbox/mbtiles-spec/blob/master/1.3/spec.md type Meta struct { // The human-readable name of the tile set. Name string `json:"nam...
pkg/mbtiles/meta.go
0.868172
0.418043
meta.go
starcoder
package day15 import ( "sort" "strings" "advent2021.com/util" ) type Cave struct { Grid *util.Grid } func gridToString(grid *util.Grid) string { var sb strings.Builder for r := 0; r < grid.Rows(); r++ { for c := 0; c < grid.Columns(); c++ { digit := grid.Value(r, c) sb.WriteRune(util.DigitToRune(digit...
day15/day15.go
0.703448
0.418281
day15.go
starcoder
package main import ( "math" "math/rand" ) type Material interface { Scatter(r *Ray, record *HitRecord) (bool, Vector, *Ray) } type Lambertian struct { Albedo Vector } func NewLambertian(albedo Vector) Lambertian { return Lambertian{albedo} } func (m Lambertian) Scatter(r *Ray, record *HitRecord) (bool, Vecto...
material.go
0.805058
0.58676
material.go
starcoder
package geo import( "fmt" "math" "regexp" "strconv" ) type Latlong struct { Lat float64 Long float64 } func (ll Latlong)String() string { return fmt.Sprintf("(%.4f,%.4f)", ll.Lat, ll.Long) } // Recognizes some common formats: // [36.7415306, -121.8942333] - google maps style full decimals // [36°57'02.96"...
latlong.go
0.7773
0.528047
latlong.go
starcoder
package simple import ( "sort" "strings" "unicode" ) /* https://leetcode-cn.com/problems/number-of-1-bits/ * 191. 位1的个数 * 编写一个函数,输入是一个无符号整数(以二进制串的形式),返回其二进制表达式中数字位数为 '1' 的个数(也被称为汉明重量)。 */ func hammingWeight(num uint32) int { one := 0 for ; num > 0; num &= num - 1 { one++ } return one } /* * 868. Binary ...
problems/simple/simple.go
0.684897
0.407805
simple.go
starcoder
package fft import ( "fmt" "math" "github.com/jamestunnell/go-dsp/transform" "github.com/jamestunnell/go-dsp/util/complexslice" "github.com/jamestunnell/go-dsp/util/freqresponse" ) const twoPi = math.Pi * 2.0 // FFT is a radix-2 FFT transform using decimation-in-time. // Can be used for both forward (anaysis) ...
transform/fft/fft.go
0.744563
0.511778
fft.go
starcoder
package main // O(n.log(k)) time | O(k) space // where N is the number of elements in the array and K is how far away the elements are from their sorted position func SortKSortedArray(array []int, k int) []int { if len(array) == 0 || k == 0 { return array } heapArray := make([]int, min(k+1, len(array))) copy(hea...
src/heaps/hard/sort-k-sorted-array/go/heap-sort.go
0.655115
0.49585
heap-sort.go
starcoder
package stats import "fmt" import "math" type Stats struct { Avg float64 Min float64 Max float64 P50 float64 P75 float64 P90 float64 P95 float64 P99 float64 } const msFactor = 1000000 // Accepts a sorted slice of durations in nanoseconds // Returns a Stats struct of millisecond statistics func Get(data []i...
client/stats/stats.go
0.755997
0.42662
stats.go
starcoder
package qrm import ( "database/sql" "fmt" "github.com/go-jet/jet/v2/internal/utils" "github.com/go-jet/jet/v2/qrm/internal" "github.com/google/uuid" "reflect" "strings" "time" ) var scannerInterfaceType = reflect.TypeOf((*sql.Scanner)(nil)).Elem() func implementsScannerType(fieldType reflect.Type) bool { if...
qrm/utill.go
0.557123
0.41561
utill.go
starcoder
package sml import ( "encoding/xml" "fmt" "strings" "time" "baliance.com/gooxml" ) func ParseStdlibTime(s string) (time.Time, error) { return time.Time{}, nil } func ParseSliceST_Sqref(s string) (ST_Sqref, error) { return ST_Sqref(strings.Fields(s)), nil } func ParseSliceST_CellSpans(s string) (ST_CellSpans,...
schema/soo/sml/common.go
0.562657
0.465691
common.go
starcoder
package advent2021 import ( "strings" "github.com/marjamis/advent-of-code/pkg/helpers" ) // Segments provides a mapping of the original positions to the new positions type Segments map[rune]rune // parseDisplayInput will take a given line of input and provided a list of strings for the inputs and outputs for proc...
internal/pkg/advent2021/day8.go
0.782746
0.654715
day8.go
starcoder
package siesta import ( "encoding/binary" ) // Decoder is able to decode a Kafka wire protocol message into actual data. type Decoder interface { // Gets an int8 from this decoder. Returns EOF if end of stream is reached. GetInt8() (int8, error) // Gets an int16 from this decoder. Returns EOF if end of stream is...
Godeps/_workspace/src/github.com/stealthly/siesta/decoder.go
0.756447
0.434521
decoder.go
starcoder
// Author: <NAME> (<EMAIL>) // Port of Raymond Hill's (<EMAIL>) javascript implementation // of Steven Forune's algorithm to compute Voronoi diagrams package voronoi import ( "math" ) // Vertex on 2D plane type Vertex struct { X float64 Y float64 } // Vertex representing lack of vertex (or bad vertex) var NO_V...
geometry.go
0.622574
0.445952
geometry.go
starcoder
package utils import ( "fmt" "math" "math/rand" "strconv" "strings" "time" "github.com/Alquimista/eyecandy/interpolate" "github.com/golang/freetype/truetype" //"github.com/Alquimista/fonts" // "github.com/stephenwithav/fontcache" "github.com/Alquimista/eyecandy/fontcache" "golang.org/x/image/font" ) co...
utils/utils.go
0.743168
0.403802
utils.go
starcoder
package xlsxfin import "math" func round(f float64) int { return int(math.Floor(f + .5)) } func PmtFloat64(rate float64, nper int, pv int, fv int, paymentFlag bool) float64 { if nper == 0 { return 0 } if rate == 0.0 { return -float64(pv+fv) / float64(nper) } pvif := math.Pow(1.0+rate, float64(nper)) pmt ...
xlsxfin.go
0.657758
0.470493
xlsxfin.go
starcoder
package query import ( "errors" "fmt" "github.com/google/go-cmp/cmp" ) //------------------------------------------------------------------------------ // ArithmeticOperator represents an arithmetic operation that combines the // results of two query functions. type ArithmeticOperator int // All arithmetic oper...
internal/bloblang/query/arithmetic.go
0.775817
0.435301
arithmetic.go
starcoder
package archive import ( "time" "github.com/streamingfast/search/metrics" "go.uber.org/zap" ) type Truncator struct { indexPool *IndexPool blockCount uint64 targetTruncateBlock uint64 } func NewTruncator(indexPool *IndexPool, blockCount uint64) *Truncator { return &Truncator{ indexPool: indexPool, bl...
archive/truncator.go
0.531939
0.486027
truncator.go
starcoder
package grid import ( "fmt" ) // Mark specifies a marker on the grid. type Mark int // The various markers. const ( MarkNone Mark = iota MarkO MarkX ) func (mark Mark) String() string { m := map[Mark]string{ MarkNone: "-", MarkO: "o", MarkX: "x", } return m[mark] } // Set sets the marker based o...
archive/vaga/grid/grid.go
0.829077
0.477798
grid.go
starcoder
package slide import ( "errors" "math" "runtime" "time" "github.com/paulmach/go.geo" geo_reducers "github.com/paulmach/go.geo/reducers" slide_reducers "github.com/paulmach/slide/reducers" ) // Optimization Parameter defaults const ( DefaultMinLoops = 100 DefaultMaxLoops = 4000 DefaultThresh...
slide.go
0.724188
0.438485
slide.go
starcoder
package rabin import ( "bytes" "fmt" "math/big" ) // polyGF2 is a polynomial over GF(2). type polyGF2 struct { coeff big.Int } // newPolyGF2 constructs a polyGF2 where the i'th coefficient is the // i'th bit of coeffs. func newPolyGF2(coeffs uint64) *polyGF2 { var p polyGF2 p.coeff.SetUint64(coeffs) return &...
vendor/github.com/opendedup/go-rabin/rabin/poly.go
0.699973
0.430866
poly.go
starcoder
Package dateslice creates slices containing time.Time elements. Sometimes you need a slice of dates. Here are some functions that make that a little easier. */ package dateslice import ( "fmt" "math" "strings" "time" ) /* Today returns a slice containing a single element - the current day. */ func Today() []ti...
dateslice.go
0.720565
0.715672
dateslice.go
starcoder
package ach import ( "flag" "fmt" "strings" ) func init() { flag.Lookup("alsologtostderr").Value.Set("true") } // Addenda provides business transaction information in a machine // readable format. It is usually formatted according to ANSI, ASC, X12 Standard type Addenda struct { // RecordType defines the type o...
addenda.go
0.667906
0.473109
addenda.go
starcoder
package action import "encoding/json" // DeviceState contains the state of a device. type DeviceState struct { Online bool Status string state map[string]interface{} } // NewDeviceState creates a new device state to be added to as defined by the relevant traits on a device. func NewDeviceState(online bool) Devic...
trait.go
0.867204
0.410343
trait.go
starcoder
package main import ( "strings" "unicode/utf8" ) const summary = `treerack - parser generator - https://github.com/aryszka/treerack` const commandsHelp = `Available commands: check validates an arbitrary input against a syntax definition show parses an arbitrary input with a syntax definition an...
cmd/treerack/doc.go
0.688154
0.65515
doc.go
starcoder
package unittest import ( "fmt" "reflect" "github.com/lrills/helm-unittest/unittest/common" "github.com/lrills/helm-unittest/unittest/validators" "github.com/mitchellh/mapstructure" ) // Assertion defines target and metrics to validate rendered result type Assertion struct { Template string DocumentInde...
unittest/assertion.go
0.660282
0.473536
assertion.go
starcoder
package compare import ( "fmt" "reflect" ) // NoOrder compares two values regardless of order func NoOrder(v1, v2 interface{}) bool { if v1 == nil || v2 == nil { return v1 == v2 } type1 := reflect.TypeOf(v1) type2 := reflect.TypeOf(v2) if type1 != type2 { return false } if isSimple(type1.Kind()) { r...
test/compare/compare.go
0.739516
0.404507
compare.go
starcoder
// Package list implements of a doubly link list in Go. package list import ( "fmt" "strings" ) // Node represents the data being stored. type Node struct { Data string next *Node prev *Node } // List represents a list of nodes. type List struct { Count int first *Node last *Node } // Add places a new nod...
topics/go/algorithms/data/list/list.go
0.741768
0.468487
list.go
starcoder
package vect import ( "math" ) //basic 2d vector. type Vect struct { X, Y float64 } //adds v2 to the given vector. func (v1 *Vect) Add(v2 Vect) { v1.X += v2.X v1.Y += v2.Y } //subtracts v2 rom the given vector. func (v1 *Vect) Sub(v2 Vect) { v1.X -= v2.X v1.Y -= v2.Y } //returns the squared length of the vec...
vect/vector.go
0.89628
0.656149
vector.go
starcoder
package trigram import "strings" const ( spaceChar byte = 32 notYetFound uint8 = 0 foundInT1 uint8 = 1 foundInBoth uint8 = 2 ) // TrigramsSimilarity returns how similar two slices of Trigrams are. func TrigramsSimilarity(t1, t2 Trigrams) float64 { unique := map[Trigram]uint8{} // Do this first so we are...
trigram/trigram.go
0.8119
0.512571
trigram.go
starcoder
package cryptypes import "database/sql/driver" // EncryptedUint16 supports encrypting Uint16 data type EncryptedUint16 struct { Field Raw uint16 } // Scan converts the value from the DB into a usable EncryptedUint16 value func (s *EncryptedUint16) Scan(value interface{}) error { return decrypt(value.([]byte), &s....
cryptypes/type_uint16.go
0.802013
0.452234
type_uint16.go
starcoder
package hexit import "errors" // Game represents the state of a game type Game struct { CurrentPlayer byte // The game starts on move 1, and each player's turn is a new move MoveNum int // Player 2 has the option to switch sides on their first move (the "pie rule"). // They switch sides on move 2, and their next...
src/game.go
0.733738
0.422505
game.go
starcoder
package vm import ( "fmt" "regexp" "time" "github.com/google/mtail/metrics" "github.com/google/mtail/metrics/datum" ) // compiler is data for the code generator. type codegen struct { name string // Name of the program. errors ErrorList // Compile errors. obj object // The object to return decos []...
vm/codegen.go
0.564579
0.444505
codegen.go
starcoder
package ast import ( "dyego0/assert" "dyego0/errors" ) // Visitor is an AST visitor type Visitor interface { Visit(element Element) bool } // Walk will call Visit with the element followed by walking the children func Walk(element Element, visitor Visitor) bool { if element != nil { if visitor.Visit(element) {...
ast/walk.go
0.648021
0.716144
walk.go
starcoder
package mlpack /* #cgo CFLAGS: -I./capi -Wall #cgo LDFLAGS: -L. -lmlpack_go_lars #include <capi/lars.h> #include <stdlib.h> */ import "C" import "gonum.org/v1/gonum/mat" type LarsOptionalParam struct { Input *mat.Dense InputModel *lars Lambda1 float64 Lambda2 float64 Responses *mat.Dense Te...
lars.go
0.64791
0.461502
lars.go
starcoder
package main import ( "fmt" "image" "image/color" "image/png" "os" "sort" "strconv" "strings" ) // ColorUsed - Colors and bounds type ColorUsed struct { color color.Color count int rectangles []image.Rectangle } // OrderByCount - order by count desc type OrderByCount []ColorUsed func (a OrderBy...
encoder.go
0.581303
0.404949
encoder.go
starcoder
package lit import ( "fmt" "log" "xelf.org/xelf/knd" "xelf.org/xelf/typ" ) // log ignored equal errors for a while until were certain everthing is fine const logEqual = true // Equal returns whtether two literal values are structurally equal. // Value types and implementations are not compared. func Equal(x, y ...
lit/comp.go
0.541409
0.548553
comp.go
starcoder
package solar import ( "time" c "github.com/rtovey/astro-lib/common" o "github.com/rtovey/astro-lib/orbit" t "github.com/rtovey/astro-lib/time" ) type SolarRiseSetTime struct { Rise time.Time Set time.Time Debug SolarRiseSetTimeDebug } type SolarRiseSetTimeDebug struct { date time.Time o...
solar/solarRiseSetTime.go
0.612426
0.542318
solarRiseSetTime.go
starcoder
package lb import "github.com/rannoch/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.yy"}, Time: cldr.CalendarDateFormat{Full: "HH:mm:ss zzzz", Long: "HH:mm:ss z", Medium: "HH:m...
resources/locales/lb/calendar.go
0.5144
0.482978
calendar.go
starcoder
// Package builtins contains utilities for implementing built-in functions. package builtins import ( "fmt" "math/big" "strings" "github.com/open-policy-agent/opa/ast" ) // Cache defines the built-in cache used by the top-down evaluation. The keys // must be comparable and should not be of type string. type Cac...
vendor/github.com/open-policy-agent/opa/topdown/builtins/builtins.go
0.817756
0.481698
builtins.go
starcoder
package gostatsd import "github.com/spf13/viper" // Timer is used for storing aggregated values for timers. type Timer struct { Count int // The number of timers in the series SampledCount float64 // Number of timings received, divided by sampling rate PerSecond float64 // The calculated ...
timers.go
0.782039
0.520192
timers.go
starcoder
package jingo // sliceencoder.go manages SliceEncoder and its responsibilities. // SliceEncoder follows the same principle of structencoder.go in that it generates lightweight // instructions as part of its compile stage which are executed later during the Marshal. The // slight difference here is that instruction is ...
sliceencoder.go
0.63861
0.404213
sliceencoder.go
starcoder
package soc import ( "github.com/pkg/errors" ) /** ** ** ** ShapeType61 *** ** * ShapeType62 **** ** ShapeType63 *** *** ShapeType641 *** *** ShapeType642 ** ** ** ShapeType65 * *** * * ShapeType66 * * * * * * ShapeType67 **** * * ShapeType68 ** *** * ShapeType69 ** ** * ShapeType511 ***...
rsyars.x/soc/soc_shape.go
0.52342
0.57069
soc_shape.go
starcoder
// Package descriptions provides the descriptions as used by the graphql endpoint for Weaviate package descriptions // Where filter elements const ( GetWhere = "Filter options for a local Get query, used to convert the result to the specified filters" GetWhereInpObj = "An object containing filter options for ...
adapters/handlers/graphql/descriptions/filters.go
0.767516
0.664948
filters.go
starcoder
//target:gomatrix.googlecode.com/hg/matrix //Linear algebra. package matrix import ( "errors" "fmt" "strconv" "strings" ) //The MatrixRO interface defines matrix operations that do not change the //underlying data, such as information requests or the creation of transforms /* Read-only matrix types (at the mome...
matrix.go
0.552057
0.566258
matrix.go
starcoder
package common import ( "fmt" "reflect" "unsafe" "elasticdl.org/elasticdl/pkg/proto" "github.com/tensorflow/tensorflow/tensorflow/go/core/framework/tensor_go_proto" "github.com/tensorflow/tensorflow/tensorflow/go/core/framework/tensor_shape_go_proto" "github.com/tensorflow/tensorflow/tensorflow/go/core/framew...
elasticdl/go/pkg/common/tensor.go
0.702632
0.543409
tensor.go
starcoder
package web // Controls is a data structure passed to conversation handlers to control the current // conversational flow, change states, store data, or end the conversation type Controls struct { b *Bot } // Get gets the value for a key in the current conversation func (c *Controls) Get(key string) (string, error) ...
web/conversation.go
0.708818
0.493897
conversation.go
starcoder
package types import ( "fmt" ) // IngrType indicates a Location's type in Ingress. type IngrType uint8 const ( // IngrTypeUnknown indicates that a Location is unknown in Ingress. IngrTypeUnknown IngrType = iota // IngrTypeNone indicates that a Location is not in Ingress. IngrTypeNone // IngrTypePortal indica...
types/type.go
0.64713
0.461623
type.go
starcoder
package iso20022 // Amount of money associated with a service. type Fee1 struct { // Type of fee (charge/commission). Type *ChargeType5Choice `xml:"Tp"` // Method used to calculate the fee (charge/commission). Basis *ChargeBasis2Choice `xml:"Bsis,omitempty"` // Standard fee (charge/commission) amount as specif...
Fee1.go
0.771757
0.414662
Fee1.go
starcoder
Package main holds the swaggergen executable. swaggergen is a custom tool to generate Go code from Swagger 2.0 spec files in a way that allows Magma to keep Swagger files modular. Because one Swagger file can reference definitions from any number of other Swagger files across modules, we have extended the Swagger...
orc8r/cloud/go/tools/swaggergen/main.go
0.728555
0.481393
main.go
starcoder
package main import ( toml ".." "fmt" "strconv" "time" ) /** * Some very rudimentary assert functions to easily test */ func assertTrue(desc string, v bool) { if !v { panic("Failed: " + desc) } fmt.Print(".") } func assertFalse(desc string, v bool) { if v { panic("Failed: " + desc) } fmt.Print(".") } fun...
tests/main.go
0.576423
0.463444
main.go
starcoder
package date import ( "time" ) // Time defines a type similar to time.Time but assumes a layout of RFC3339 date-time (i.e., // 2006-01-02T15:04:05Z). type Time struct { time.Time } // ParseTime creates a new Time from the passed string. func ParseTime(date string) (d Time, err error) { d = Time{} d.Time, err = t...
go/src/github.com/hashicorp/vendor/github.com/Azure/azure-sdk-for-go/Godeps/_workspace/src/github.com/Azure/go-autorest/autorest/date/time.go
0.816809
0.497803
time.go
starcoder
package toms import ( "github.com/dreading/gospecfunc/machine" "github.com/dreading/gospecfunc/utils" "math" ) // ABRAM0 calculates the Abramowitz function of order 0, // ∫ 0 to infinity exp( -t*t - x/t ) dt // The code uses Chebyshev expansions with the coefficients // given to an accuracy of 20 decimal plac...
integrals/internal/toms/abramowitz.go
0.63443
0.425665
abramowitz.go
starcoder
package main /* Control This is the part of Ground Control that handles invoking shell commands and exposing the UI. The invoking part needs commands to be present in the configuration like so: ``` "controls" : { "xbmc": { "on" : "/etc/init.d/xbmc start", "off" : "/etc/init.d/xbmc stop...
control.go
0.719482
0.568775
control.go
starcoder
package app import ( "encoding/binary" "go_srs/srs/utils" ) /* * the adaptation_field_control of ts packet * Table 2-5 - Adaptation field control values hls-mpeg-ts-iso13818-1.pdf, page 38 */ type SrsTsAdapationControl int const ( _ SrsTsAdapationControl = iota SrsTsAdapationContr...
srs/app/srs_ts_header.go
0.523908
0.462594
srs_ts_header.go
starcoder
package escape_a_large_maze import ( "container/list" "strconv" ) /* 1036. 逃离大迷宫 https://leetcode-cn.com/problems/escape-a-large-maze 在一个 10^6 x 10^6 的网格中,每个网格块的坐标为 (x, y),其中 0 <= x, y < 10^6。 我们从源方格 source 开始出发,意图赶往目标方格 target。 每次移动,我们都可以走到网格中在四个方向上相邻的方格,只要该方格不在给出的封锁列表 blocked 上。 只有在可以通过一系列的移动到达目标方格时才返回 true。否则,返...
solutions/escape-a-large-maze/d.go
0.522689
0.51068
d.go
starcoder
package mathgl import ( "math" ) type Vec2f [2]float32 type Vec3f [3]float32 type Vec4f [4]float32 func (v1 Vec2f) Add(v2 Vec2f) Vec2f { return Vec2f{v1[0] + v2[0], v1[1] + v2[1]} } func (v1 Vec3f) Add(v2 Vec3f) Vec3f { return Vec3f{v1[0] + v2[0], v1[1] + v2[1], v1[2] + v2[2]} } func (v1 Vec4f) Add(v2 Vec4f) Ve...
vectorf.go
0.77373
0.598371
vectorf.go
starcoder
package flame import ( "math" ) type Variation func(float64, float64, float64, float64, float64, float64, float64, float64) (float64, float64) type FullVar struct { Fn Variation Text string } func DefaultParams() (float64, float64, float64, float64, float64, float64) { return 1, 2, 1, 1, 4, 5 } func AllVari...
variations.go
0.625667
0.5919
variations.go
starcoder
package sm3 import "hash" // Size indicates the Size of a SM3 checksum in bytes. const Size = 32 // BlockSize indicates the blocksize of a SM3 checksum. const BlockSize = 64 const ( chunk = 64 // IV = 7380166f 4914b2b9 172442d7 da8a0600 a96f30bc 163138aa e38dee4d b0fb0e4e init0 = 0x7380166F init1 = 0x4914B2B9 ...
sm3/sm3.go
0.5564
0.447521
sm3.go
starcoder
package main /* Day 5 Part A For a given list of instructions ("list of integers"), treat each instruction as a `jmp n` where n is the value of the instruction ("integer"). Once the instruction is processed, and before processing moves on to the next instruction, it is stored in its same position with its value incre...
2017/day05.go
0.818011
0.590986
day05.go
starcoder
package data import "fmt" // Node is the abstract interface that every Node of the Query-AST implements. type Node interface { // Get the current node as string representation (In case of a leave this will be the contained Value). String() string // Walk the current node (Buttom-Up, Left-to-Right). Walk(func(v ...
pkg/data/ast.go
0.722918
0.471832
ast.go
starcoder
package imgproc import ( "fmt" "math" ) type Moments struct { M00 float64 M10 float64 M01 float64 M20 float64 M11 float64 M02 float64 M30 float64 M21 float64 M12 float64 M03 float64 Mu20 float64 Mu11 float64 Mu02 float64 Mu30 float64 Mu21 float64 Mu12 float64 Mu03 float64 Nu20 float64 N...
opencv3/imgproc/Moments.java.go
0.501709
0.521776
Moments.java.go
starcoder
package year2021 import ( "math" "regexp" "github.com/lanphiergm/adventofcodego/internal/utils" ) // HydrothermalVenture Part 1 computes {part 1 description} func HydrothermalVenturePart1(filename string) interface{} { return findDangerousAreas(filename, false) } // HydrothermalVenture Part 2 computes {part 2 d...
internal/puzzles/year2021/day_05_hydrothermal_venture.go
0.717012
0.466359
day_05_hydrothermal_venture.go
starcoder
package main import ( "fmt" "sort" ) func main() { rows := [][]string{ []string{"1", "a", "1", "10"}, []string{"1", "b", "1", "9"}, []string{"1", "c", "1", "8"}, []string{"1", "d", "1", "7"}, []string{"1", "e", "1", "6"}, []string{"1", "f", "1", "5"}, []string{"1", "g", "1", "4"}, []string{"1", "h"...
doc/go_sort_algorithm/code/06_sort_table.go
0.569134
0.549338
06_sort_table.go
starcoder
package monitoring import ( "fmt" "strings" "sync" "github.com/golang/glog" ) // InertMetricFactory creates inert metrics for testing. type InertMetricFactory struct{} // NewCounter creates a new inert Counter. func (imf InertMetricFactory) NewCounter(name, help string, labelNames ...string) Counter { return ...
monitoring/inert.go
0.727879
0.417271
inert.go
starcoder
package go2linq import ( "constraints" ) // Reimplementing LINQ to Objects: Part 28 – Sum // https://codeblog.jonskeet.uk/2011/01/08/reimplementing-linq-to-objects-part-28-sum/ // https://docs.microsoft.com/dotnet/api/system.linq.enumerable.sum // Reimplementing LINQ to Objects: Part 30 – Average // https://codebl...
sumaverage.go
0.82176
0.413536
sumaverage.go
starcoder
package coordconv import ( "errors" "math" "github.com/golang/geo/s2" ) // Hemisphere represents the hemisphere, north or south type Hemisphere byte // Hemisphere constants const ( HemisphereInvalid Hemisphere = iota HemisphereNorth HemisphereSouth ) // UPSCoord is a UPS coordinate with a specified easting/n...
ups.go
0.739611
0.453927
ups.go
starcoder
package trace import ( "github.com/df-mc/dragonfly/server/block/cube" "github.com/go-gl/mathgl/mgl64" "math" ) // BBoxResult is the result of a basic ray trace collision with a bounding box. type BBoxResult struct { bb cube.BBox pos mgl64.Vec3 face cube.Face } // BBox ... func (r BBoxResult) BBox() cube.BBo...
server/block/cube/trace/bbox.go
0.858155
0.468608
bbox.go
starcoder
package binarysearchtree import ( List "github.com/zimmski/container/list" dll "github.com/zimmski/container/list/doublylinkedlist" Tree "github.com/zimmski/container/tree" ) // node holds a single node of a binary search tree type node struct { parent *node // The parent of this node left *node //...
tree/binarysearchtree/binarysearchtree.go
0.757077
0.480601
binarysearchtree.go
starcoder
package path_traversal import ( "github.com/damianmcgrath/threagile/model" ) func Category() model.RiskCategory { return model.RiskCategory{ Id: "path-traversal", Title: "Path-Traversal", Description: "When a filesystem is accessed Path-Traversal or Local-File-Inclusion (LFI) risks might arise. " + "The...
risks/built-in/path-traversal/path-traversal-rule.go
0.686895
0.502502
path-traversal-rule.go
starcoder