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 cmd import ( "strconv" "testing" "time" "github.com/gomodule/redigo/redis" "github.com/stretchr/testify/assert" ) //ExampleString verify the string command type ExampleString struct { values map[string]string conn redis.Conn } //NewExampleString create new string object func NewExampleString(conn r...
tools/autotest/cmd/string.go
0.664323
0.774605
string.go
starcoder
package pwr import ( "fmt" "io" "log" "github.com/itchio/savior" "github.com/itchio/wharf/wire" "github.com/pkg/errors" ) // A Compressor can compress a stream given a quality setting type Compressor interface { Apply(writer io.Writer, quality int32) (io.Writer, error) } // A Decompressor can decompress a st...
vendor/github.com/itchio/wharf/pwr/compression.go
0.737347
0.418043
compression.go
starcoder
package orbcore import ( "fmt" "log" "math" "time" ) /* MeanMotionStepped calculates a mean motion value for [count] [timeStep]s and returns a list of orbits. Note: The first entry in the returned list will always be the starting orbit object. */ func MeanMotionStepped(orbit *Orbit, timeStep time.Duration, count ...
orbcore/propagate.go
0.867794
0.526525
propagate.go
starcoder
package types import ( "reflect" "strings" ) // DetermineSize returns the required byte size of a buffer for // using SSZ to marshal an object. func DetermineSize(val reflect.Value) uint64 { if val.Kind() == reflect.Ptr { if val.IsNil() { return DetermineSize(reflect.New(val.Type().Elem()).Elem()) } retur...
types/determine_size.go
0.558568
0.515071
determine_size.go
starcoder
package main import "fmt" type Node struct { left *Node right *Node value int } type BST struct { root *Node; } func NewBST () * BST { return new(BST) } func (root *Node) insert (new_node *Node) { if new_node.value > root.value { if root.right == nil ...
BinarySearchTree/bst.go
0.636918
0.418875
bst.go
starcoder
package neat import ( "math" "sort" "github.com/klokare/evo" ) // Distancer calculates the compatibility distance between two genomes type Distancer interface { Distance(a, b evo.Genome) (float64, error) } // Compatibility distance measurer using the methods described by Stanley type Compatibility struct { Dis...
neat/distancer.go
0.763572
0.478285
distancer.go
starcoder
package generics import ( "fmt" "go/token" "reflect" "strings" ) func To_string(x interface{}) string { return fmt.Sprint(x) } func Equal(x, y interface{}) bool { return reflect.DeepEqual(x, y) } func NotEqual(x, y interface{}) bool { return !reflect.DeepEqual(x, y) } // BinaryOpTokens are all the binary op...
generics/builtins.gen.go
0.745306
0.459379
builtins.gen.go
starcoder
package model import ( "math" "github.com/xoba/goutil/gmath/blas" ) type NormalizationType int const ( _ = iota X_AND_Y X_ONLY ) type RiskCalculator interface { // rowMask is comprised of 1.0 and 0.0 elements, to respectively mask in or out various rows CalcRisk(model []float64, rowMask []float64, rp *Regre...
gmath/model/risks.go
0.702734
0.52141
risks.go
starcoder
package sarsa type State interface { GetRandomFirstPosition() State GetActions() []string GetActiveTiles(string) [][]int InGoalState() bool TakeAction(string) (State, float64) } type ValueFunction struct { Weights []float64 Tilings int Alpha float64 Features int } //constructor func (v *ValueFunction) ...
sarsa/sarsa.go
0.626467
0.430925
sarsa.go
starcoder
package api type Routes []Route type RouteKey string /* A Route defines a mapping from a request to a pool of Instances. The left side of the mapping is defined by a Zone, a Domain, a Path, and a vector of Rules. If none of the Rules applies to a given request, the Default AllConstraints are used; these define...
vendor/github.com/turbinelabs/api/route.go
0.761893
0.404743
route.go
starcoder
package gmath import "math" // Vector2i represents 2-dimensional vector with integer components type Vector2i struct { X, Y int } // Distance returns distance of this vector v to given vector as integer func (v *Vector2i) Distance(u *Vector2i) int { return int(math.Round(v.DistanceF(u))) } // DistanceF returns di...
gmath/vector.go
0.823577
0.790045
vector.go
starcoder
package cryptypes import "database/sql/driver" // EncryptedBool supports encrypting Bool data type EncryptedBool struct { Field Raw bool } // Scan converts the value from the DB into a usable EncryptedBool value func (s *EncryptedBool) Scan(value interface{}) error { return decrypt(value.([]byte), &s.Raw) } // V...
cryptypes/type_bool.go
0.80112
0.604195
type_bool.go
starcoder
package json import ( "errors" "fmt" "reflect" ) // GetValueFromJSONObject is a helper function for unpacking values out of // arbitrary JSON objects. `value` should be a pointer to a value of the type // you expect to retrieve. Inner objects are of type `map[string]interface{}`. // Inner arrays are of type `[]int...
geotrigger/json/json_helpers.go
0.772187
0.450843
json_helpers.go
starcoder
package parser import ( "regexp" "strings" ) // AWSRegion contains the name, code (as it appears in billing reports) and display name of an AWS region (e.g. us-west-1, USW1, US West (N. California)) // Some regions have an alternative display name that appears in the description. This is contained in the 'alias' fi...
parser/region.go
0.57678
0.433921
region.go
starcoder
package v1 import ( "encoding/json" ) // BgpNeighborDataRoutesOut struct for BgpNeighborDataRoutesOut type BgpNeighborDataRoutesOut struct { Route *string `json:"route,omitempty"` Exact *bool `json:"exact,omitempty"` } // NewBgpNeighborDataRoutesOut instantiates a new BgpNeighborDataRoutesOut object // This cons...
v1/model_bgp_neighbor_data_routes_out.go
0.759761
0.432123
model_bgp_neighbor_data_routes_out.go
starcoder
package daemon // GetBlockCountResponse represents the response model for GetBlockCount type GetBlockCountResponse struct { // Number of blocks in longest chain seen by the node. Count uint64 `json:"count"` // General RPC error code. "OK" means everything looks good. Status string `json:"status"` } // GetBlockTem...
daemon/models.go
0.753829
0.508422
models.go
starcoder
package value import ( "math/big" ) func sin(c Context, v Value) Value { if u, ok := v.(Complex); ok { if !isZero(u.imag) { return complexSin(c, u) } v = u.real } return evalFloatFunc(c, v, floatSin) } func cos(c Context, v Value) Value { if u, ok := v.(Complex); ok { if !isZero(u.imag) { return ...
value/sin.go
0.735547
0.529203
sin.go
starcoder
package solution import ( "math/rand" "sort" "time" ) // Specimen is a single solution for the genetic algorithm. type Specimen struct { Fitness uint Buf []byte } // Copy copies the values from the argument Specimen to the current specimen func (s *Specimen) Copy(s2 Specimen) { s.Fitness = s2.Fitness if s...
solution/solution.go
0.616474
0.439627
solution.go
starcoder
package main import ( "fmt" ) type Node struct { data int left *Node right *Node } type BinarySearchTree struct { root *Node size int } func (b *BinarySearchTree) Put(data int) { if b.root == nil { b.root = &Node{data: data, left: nil, right: nil} } else { b.put(b.root, data) } b.size++ } func (b *...
bst/go/BinarySearchTree.go
0.565299
0.601623
BinarySearchTree.go
starcoder
package sort import ( "math/rand" "reflect" "time" ) //QuickSort is a custom quick sort. //You should build your own compare function to sort in your own regulations. func QuickSort(data interface{}, cmp func(i, j interface{}) bool) []interface{} { value := reflect.ValueOf(data) dataS := make([]interface{}, valu...
QuickSort.go
0.639286
0.630571
QuickSort.go
starcoder
package trie import ( "github.com/caravan/go-immutable-trie/key" "github.com/caravan/go-immutable-trie/nibble" ) type ( Direction[Key key.Keyable, Value any] interface { Select[Key, Value] Ascending() Select[Key, Value] Descending() Select[Key, Value] } Select[Key key.Keyable, Value any] interface { All...
query.go
0.601242
0.549822
query.go
starcoder
package exp import ( "github.com/tsealex/dbutil/query" "bytes" "fmt" "strconv" ) type Exp interface { ToSQL(*query.SQLContext, *bytes.Buffer) error } type BaseExp struct { Exp } func (b *BaseExp) Add(exp Exp) *BinaryExp { return Binary(b, "+", exp) } func (b *BaseExp) Sub(exp Exp) *BinaryExp { return Binar...
query/exp/base.go
0.505615
0.420064
base.go
starcoder
// Utilizes a BSD-3-Clause license. Refer to the included LICENSE file for details. // Package dlx implements Dancing Links (Algorithm X). // The algorithm is described in the "Dancing Links" paper by <NAME> // published in "Millennial Perspectives in Computer Science. P159. Volume 187" // (2000). package dlx ...
dlx.go
0.809991
0.483709
dlx.go
starcoder
package main import ( "log" "os" "strconv" "github.com/TomasCruz/projecteuler" ) /* Problem 27; Quadratic primes Euler discovered the remarkable quadratic formula: n^2+n+41 It turns out that the formula will produce 40 primes for the consecutive integer values 0≤n≤39 . However, when n=40,402+40+41=40(40+1)+41...
001-100/021-030/027/main.go
0.647798
0.428054
main.go
starcoder
// Package topicmaps defines a vocabulary of simple types and common constants // that related packages can use to share topic maps and topic map items. package topicmaps // Reifiable is a mixin for any item that can be reified by a topic. type Reifiable struct { II []string } // Typed is a mixin for any item has a...
topicmaps/topicmaps.go
0.688783
0.40987
topicmaps.go
starcoder
package plain import ( "encoding/binary" "fmt" "io" "math" "github.com/segmentio/parquet-go/deprecated" "github.com/segmentio/parquet-go/encoding" "github.com/segmentio/parquet-go/format" ) const ( ByteArrayLengthSize = 4 MaxByteArrayLength = math.MaxInt32 ) type Encoding struct { encoding.NotSupported }...
encoding/plain/plain.go
0.534855
0.407805
plain.go
starcoder
package charset import ( "math/bits" "strconv" ) const log2WordSize = 6 const wordSize = 64 // A Set represents a set of chars. type Set struct { // Bits is the bit array for indicating which chars are in the set. // We have 256 bits because a char can have 256 different values. Bits [4]uint64 } // A SmallSet ...
charset/charset.go
0.765155
0.467757
charset.go
starcoder
package distribution import ( "math" "github.com/ready-steady/sort" ) var ( infinity = math.Inf(1.0) ) // CDF calculates an empirical cumulative distribution function. The granularity // of the function is specified by a set of edges; see Histogram. func CDF(data, edges []float64) (values []float64) { bins, _ :...
distribution/main.go
0.750095
0.524334
main.go
starcoder
package painter import ( "image" "math" "github.com/ravenlab/fyne/canvas" "github.com/srwiley/rasterx" "golang.org/x/image/math/fixed" ) // DrawCircle rasterizes the given circle object into an image. // The bounds of the output image will be increased by vectorPad to allow for stroke overflow at the edges. //...
internal/painter/draw.go
0.80329
0.607052
draw.go
starcoder
package main import "math" // Return the x coordinate of the intersection between two parabolas given their directrix and foci. // Since the beachline is x-monotone the breakpoints can be differentiated by which parabola is left // of the breakpoint and which is right (i.e. breakpoint (a,b) is not the same as (b,a) b...
parabola.go
0.874373
0.640889
parabola.go
starcoder
package clocks import ( "bytes" "image/color" "math" "time" "github.com/fogleman/gg" "golang.org/x/image/bmp" ) var ( clockRomanColorTicks color.Color = color.RGBA{R: 0x80, G: 0x80, B: 0x80, A: 0xFF} clockRomanColorArHour color.Color = color.RGBA{R: 0x40, G: 0x40, B: 0x80, A: 0xFF} clock...
service/pac/clocks/roman.go
0.601242
0.460774
roman.go
starcoder
package assert import ( "testing" "github.com/ppapapetrou76/go-testing/internal/pkg/values" ) // AssertableError is the assertable structure for error values. type AssertableError struct { t *testing.T actual values.ErrorValue } // ThatError returns an AssertableError structure initialized with the test re...
assert/error.go
0.728459
0.611063
error.go
starcoder
package xcom import ( "github.com/DomBlack/advent-of-code-2018/lib/vectors" "log" "sort" "strings" ) // The Map type Map struct { Cells map[vectors.Vec2]*Cell // The cells of this map Units Units // All the units on this map width, height int // The width and...
day-15/xcom/Map.go
0.706596
0.497192
Map.go
starcoder
package iso20022 // Specifies security rate details. type CorporateActionRate48 struct { // Quantity of additional intermediate securities/new equities awarded for a given quantity of securities derived from subscription. AdditionalQuantityForSubscribedResultantSecurities *RatioFormat11Choice `xml:"AddtlQtyForSbcbd...
CorporateActionRate48.go
0.881685
0.478346
CorporateActionRate48.go
starcoder
package ui import ( "log" "math" "math/rand" "github.com/eleniums/game-of-life-go/assets" "github.com/eleniums/game-of-life-go/game" "github.com/eleniums/game-of-life-go/sprites" "github.com/faiface/pixel" "github.com/faiface/pixel/pixelgl" ) const ( // default dimensions of grass tiles defaultGrassW = 8 ...
ui/board.go
0.57821
0.431644
board.go
starcoder
package paunch import ( gl "github.com/chsc/gogl/gl21" "image" "image/png" "os" ) // Sprite is a textured object, an object that is displayed on the screen using // image data. type Sprite struct { texcoordBuffer gl.Uint texture []gl.Uint shape *Shape } func imageToBytes(img image.Image) (int,...
sprite.go
0.750095
0.522568
sprite.go
starcoder
package runner import ( "sort" "testing" ) // NewRegistry returns a pointer to a new TestRegistry func NewRegistry() *TestRegistry { return &TestRegistry{ tests: make(map[string]Test), benchmarks: make(map[string]Benchmark), TestSuites: make(map[string]TestSuite), BenchSuites: make(map[string]Benc...
pkg/runner/registry.go
0.779574
0.548553
registry.go
starcoder
package measure import ( "fmt" "io" "time" "github.com/ipfs/go-datastore" "github.com/ipfs/go-datastore/query" "github.com/ipfs/go-metrics-interface" ) var ( // sort latencies in buckets with following upper bounds in seconds datastoreLatencyBuckets = []float64{1e-4, 1e-3, 1e-2, 1e-1, 1} // sort sizes in b...
measure.go
0.588889
0.504883
measure.go
starcoder
package inflector import ( "regexp" "strconv" "strings" "github.com/tzvetkoff-go/unidecode" ) // PluralizationRule represents a regular expression rule for pluralization type PluralizationRule struct { Pattern *regexp.Regexp Replacement string } // SingularizationRule represents a regular expression rule ...
inflector.go
0.807878
0.453867
inflector.go
starcoder
package matrix import ( "errors" "math" "github.com/calbim/ray-tracer/src/tuple" "github.com/calbim/ray-tracer/src/util" ) // Matrix represents a NxN matrix type Matrix struct { N int Values [][]float64 } // Identity is a 4x4 identity matrix var Identity = New([]float64{1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0...
src/matrix/matrix.go
0.75985
0.580709
matrix.go
starcoder
package hamt const arityBits = 5 const arity = 32 // hamt represents a HAMT data structure. type hamt struct { level uint8 children [arity]interface{} } // newHamt creates a new HAMT. func newHamt(level uint8) hamt { return hamt{level: level} } // Insert inserts a value into a HAMT. func (h hamt) Insert(e Ent...
hamt.go
0.78535
0.696475
hamt.go
starcoder
package state import ( ethpb "github.com/prysmaticlabs/ethereumapis/eth/v1alpha1" pbp2p "github.com/prysmaticlabs/prysm/proto/beacon/p2p/v1" "github.com/prysmaticlabs/prysm/shared/bytesutil" ) // CopyETH1Data copies the provided eth1data object. func CopyETH1Data(data *ethpb.Eth1Data) *ethpb.Eth1Data { if data ==...
.docker/Prysm/prysm-spike/beacon-chain/state/cloners.go
0.605682
0.530176
cloners.go
starcoder
package vat import ( "encoding/json" "errors" "net/http" "strings" "sync" "time" ) // RatePeriod represents a time and the various activate rates at that time. type RatePeriod struct { EffectiveFrom time.Time Rates map[string]float32 } // CountryRates holds the various differing VAT rate periods for ...
rates.go
0.757884
0.415017
rates.go
starcoder
package rottingOranges func orangesRotting(grid [][]int) int { freshOranges := 0 rottenOranges := 0 minutesToRotAll := 0 for row := range grid { for column := range grid[row] { if orange := grid[row][column]; orange == 1 { freshOranges++ } else if orange == 2 { rottenOranges++ } } } for ro...
problem/rottingOranges/solutionOne.go
0.693577
0.550184
solutionOne.go
starcoder
package automaton // Struct to store state type state struct { symbol rune edge1 *state edge2 *state } // Struct to store fragment of NFA type nfaFragment struct { initial *state accept *state } // Function to change our postfix regular expression to an NFA(Non-finite automaton) // Return a pointer to an NFA...
nfa.go
0.702224
0.494019
nfa.go
starcoder
package actions /* The actions system is a key component for process automation in WIT. It provides a way of executing user-configurable, dynamic process steps depending on user settings, schema settings and events in the WIT. The idea here is to provide a simple, yet powerful "publish-subscribe" system that ...
actions/actions.go
0.737725
0.529811
actions.go
starcoder
package imageErrorHeap import ( "container/heap" "image" "image/color" "image/draw" "math" ) type ImageRectangleError struct { // bb of sub-image Rect image.Rectangle // AvgColor denotes the average color for a sub-image AvgColor color.RGBA64 // AvgError denotes mean square error of color compared to averag...
heap/ImageErrorHeap.go
0.669421
0.465084
ImageErrorHeap.go
starcoder
package dungeongen import "errors" //DungeonCreationStrategy ... type DungeonCreationStrategy interface { Create(data *DungeonData, mask AreaMask) } //Builder .. type Builder interface { Build() *DungeonData WithSmallSize() Builder WithMask(mask AreaMask) Builder WithSize(width int, height int) Builder WithCr...
pkg/dungeongen/gen.go
0.625209
0.569853
gen.go
starcoder
package forGraphBLASGo func VectorExtract[D any](w *Vector[D], mask *Vector[bool], accum BinaryOp[D, D, D], u *Vector[D], indices []int, desc Descriptor) error { usize, err := u.Size() if err != nil { return err } nindices, _, err := checkIndices(indices, usize, w.expectSize) if err != nil { return err } is...
api_Extract.go
0.586286
0.525308
api_Extract.go
starcoder
// Package correlationvector contains library functions to manipulate CorrelationVectors. package correlationvector import ( "encoding/base64" "errors" "fmt" "math" "math/rand" "strconv" "strings" "sync/atomic" ) const ( // MaxVectorLength is the max length of a V1 correlation vector MaxVectorLength int = ...
correlationvector/correlationvector.go
0.853242
0.561575
correlationvector.go
starcoder
package domain import "time" var locationMap = map[int][]int{ 1: {1, 1}, 2: {2, 1}, 3: {3, 1}, 4: {1, 2}, 5: {2, 2}, 6: {3, 2}, 7: {1, 3}, 8: {2, 3}, 9: {3, 3}, } type Board struct { Tiles map[int]map[int]int FirstRow int LastRow int PlayerNumberTurn int WhoWentFirst int...
domain/board.go
0.519765
0.461805
board.go
starcoder
package knapsack /* * 0/1 Knapsack Given two integer arrays to represent weights and profits of ‘N’ items, we need to find a subset of these items which will give us maximum profit such that their cumulative weight is not more than a given number ‘C.’ Each item can only be selected once, which means either we put an i...
Pattern15 - 01 Knapsack/01_Knapsack/solution.go
0.784154
0.485234
solution.go
starcoder
package bits import "github.com/asukakenji/go-benchmarks" const ( uintSize = 32 << (^uint(0) >> 32 & 1) // 32 or 64 is32Bit = (^uint(0) >> 32 & 1) == 0 ) // UintSize is the size of a uint in bits. const UintSize = uintSize // --- LeadingZeros --- // LeadingZeros returns the number of leading zero bits in x; the...
math/bits/bits.go
0.71103
0.584271
bits.go
starcoder
package controller import ( "errors" "math" ) //MotorsController interface to control a motor type MotorsController interface { SetSpeed(speed float64) SetBalance(left, right float64) Start() Stop() RotateRight() RotateLeft() IsMoving() bool } //DualMotorController MotorController for 2 motors type DualMoto...
controller/dualmotor.go
0.834474
0.444565
dualmotor.go
starcoder
package solitaire import ( "math" "fyne.io/fyne" "fyne.io/fyne/canvas" "fyne.io/fyne/widget" "github.com/fyne-io/examples/solitaire/faces" ) // Table represents the rendering of a game in progress type Table struct { size fyne.Size position fyne.Position hidden bool game *Game selected *Card } ...
solitaire/table.go
0.720958
0.438124
table.go
starcoder
package sudoku import ( "fmt" "strings" ) const ( Size = 9 ) type Grid struct { values [Size][Size]int } func (grid *Grid) Clear(row, column int) error { // Checks for possible errors switch { case row < 0 || row >= Size: return ErrInvalidRow case column < 0 || column > Size: return ErrInvalidColumn } ...
internal/sudoku/grid.go
0.757615
0.613497
grid.go
starcoder
package cryptypes import "database/sql/driver" // EncryptedAny supports encrypting Any data type EncryptedAny struct { Field Raw interface{} } // Scan converts the value from the DB into a usable EncryptedAny value func (s *EncryptedAny) Scan(value interface{}) error { return decrypt(value.([]byte), &s.Raw) } //...
cryptypes/type_any.go
0.808823
0.496277
type_any.go
starcoder
package main import ( "image/color" "io/ioutil" "math" "math/rand" "strconv" "github.com/loov/plot" "github.com/loov/plot/plotsvg" ) func main() { defaultMargin := plot.R(20, 20, 20, 20) type Dataset struct { Red []float64 Green []float64 Blue []float64 } datasets := []*Dataset{} r := func() ...
cmd/plot-example/main.go
0.607896
0.52543
main.go
starcoder
package packed // Efficient sequential read/write of packed integers. type BulkOperationPacked22 struct { *BulkOperationPacked } func newBulkOperationPacked22() BulkOperation { return &BulkOperationPacked22{newBulkOperationPacked(22)} } func (op *BulkOperationPacked22) decodeLongToInt(blocks []int64, values [...
vendor/github.com/balzaczyy/golucene/core/util/packed/bulkOperation22.go
0.555918
0.632148
bulkOperation22.go
starcoder
package tensor3 type Matrix [3]Vector // missing parameters default to zero, more than 9 are ignored func NewMatrix(cs ...Scalar) (m Matrix) { switch len(cs) { default: m[2].z = baseScale(cs[8]) fallthrough case 8: m[2].y = baseScale(cs[7]) fallthrough case 7: m[2].x = baseScale(cs[6]) fallthrough ca...
scaledint/mat.go
0.593727
0.730963
mat.go
starcoder
package specs import ( "testing" "github.com/Fs02/grimoire" "github.com/Fs02/grimoire/c" "github.com/Fs02/grimoire/changeset" "github.com/Fs02/grimoire/errors" "github.com/Fs02/grimoire/params" "github.com/stretchr/testify/assert" ) var input = params.Map{ "name": "whiteviolet", "gender": "male", "age": ...
adapter/specs/transaction.go
0.583203
0.406214
transaction.go
starcoder
package uz import "github.com/ContextLogic/cldr" var calendar = cldr.Calendar{ Formats: cldr.CalendarFormats{ Date: cldr.CalendarDateFormat{Full: "EEEE, y MMMM dd", Long: "y MMMM d", Medium: "y MMM d", Short: "yy/MM/dd"}, Time: cldr.CalendarDateFormat{Full: "HH:mm:ss zzzz", Long: "HH:mm:ss z", Medium: "H...
resources/locales/uz/calendar.go
0.502197
0.406037
calendar.go
starcoder
package geojson import ( "github.com/mmadfox/geojson/geometry" "github.com/tidwall/gjson" ) // Point ... type Point struct { base geometry.Point extra *extra } // NewPoint ... func NewPoint(point geometry.Point) *Point { return &Point{base: point} } // NewPointZ ... func NewPointZ(point geometry.Point, z floa...
point.go
0.728748
0.475605
point.go
starcoder
package bigtable import ( "fmt" "strings" "time" btpb "google.golang.org/genproto/googleapis/bigtable/v2" ) // A Filter represents a row filter. type Filter interface { String() string proto() *btpb.RowFilter } // ChainFilters returns a filter that applies a sequence of filters. func ChainFilters(sub ...Filte...
bigtable/filter.go
0.889325
0.412027
filter.go
starcoder
// Protocol buffer comparison. package proto import ( "bytes" "log" "reflect" "strings" ) /* Equal returns true iff protocol buffers a and b are equal. The arguments must both be pointers to protocol buffer structs. Equality is defined in this way: - Two messages are equal iff they are the same type, cor...
vendor/github.com/golang/protobuf/proto/equal.go
0.696371
0.447158
equal.go
starcoder
package output import ( "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" "github.com/Jeffail/benthos/v3/lib/util/aws/session" "github.com/Jeffail/benthos/v3/lib/x/docs" ) //------------...
lib/output/s3.go
0.778607
0.445288
s3.go
starcoder
package chart import ( "fmt" "math" "github.com/SimonLovskog/go-chart/v2/matrix" ) // Interface Assertions. var ( _ Series = (*PolynomialRegressionSeries)(nil) _ FirstValuesProvider = (*PolynomialRegressionSeries)(nil) _ LastValuesProvider = (*PolynomialRegressionSeries)(nil) ) // PolynomialRegr...
polynomial_regression_series.go
0.856092
0.672696
polynomial_regression_series.go
starcoder
package environment import ( "context" "sync" "testing" "knative.dev/reconciler-test/pkg/feature" ) func categorizeSteps(steps []feature.Step) map[feature.Timing][]feature.Step { res := make(map[feature.Timing][]feature.Step, 4) res[feature.Setup] = filterStepTimings(steps, feature.Setup) res[feature.Require...
vendor/knative.dev/reconciler-test/pkg/environment/execution.go
0.53437
0.414958
execution.go
starcoder
package utils import ( "encoding/json" "fmt" ) // ToValuesMap converts the given value v to a values map, by first marshalling it to JSON, // and then unmarshalling the result from JSON into a values map. // If v cannot be marshalled to JSON, or if the result cannot be unmarshalled into a values map, an error is r...
vendor/github.com/gardener/gardener/pkg/utils/values.go
0.770033
0.544801
values.go
starcoder
package geo import ( "fmt" "math" "github.com/blevesearch/bleve/numeric" ) // GeoBits is the number of bits used for a single geo point // Currently this is 32bits for lon and 32bits for lat var GeoBits uint = 32 var minLon = -180.0 var minLat = -90.0 var maxLon = 180.0 var maxLat = 90.0 var minLonRad = minLon ...
vendor/github.com/blevesearch/bleve/geo/geo.go
0.750827
0.407923
geo.go
starcoder
package schema const RUMV3Schema = `{ "$id": "docs/spec/transactions/rumv3_transaction.json", "type": "object", "description": "An event corresponding to an incoming request or similar task occurring in a monitored service", "allOf": [ { "properties": { "id": { ...
model/transaction/generated/schema/rum_v3_transaction.go
0.782205
0.466299
rum_v3_transaction.go
starcoder
package worker import ( "database/sql" "hash/crc32" "log" "time" "github.com/ilbambino/csvomatic/parameters" ) // Job holds the information needed to execute a query. The query read from the file // and the DB connection type Job struct { parameters.QueryParams db *sql.DB } // Result of the execution of a jo...
worker/worker.go
0.569853
0.418994
worker.go
starcoder
package m3tsz import ( "math" "github.com/m3db/m3/src/dbnode/encoding" ) const ( bits12To6Mask = 4032 // 1111 1100 0000 bits6To0Mask = 63 // 0011 1111 ) // FloatEncoderAndIterator encapsulates the state required for a logical stream of bits // that represent a stream of float values compressed with XOR. typ...
src/dbnode/encoding/m3tsz/float_encoder_iterator.go
0.698227
0.455986
float_encoder_iterator.go
starcoder
package types import ( "encoding/hex" "fmt" "math/big" "strings" sdktypes "github.com/cosmos/cosmos-sdk/types" "github.com/stratosnet/sds/utils/crypto/sha3" "github.com/stratosnet/stratos-chain/types" "github.com/tendermint/tendermint/libs/bech32" ) // Lengths of hashes and addresses in bytes. const ( // Ha...
utils/types/account.go
0.799912
0.452536
account.go
starcoder
package rabbitmonit import "github.com/c-datculescu/rabbit-hole" /* NodeProperties is a structure offering slightly more flexibility/statistics than the rabbit-hole struct */ type NodeProperties struct { Stats NodeStat Error NodeAlert Warning NodeAlert NodeInfo rabbithole.NodeInfo } /* NodeStat Holds all ...
node.go
0.512693
0.423875
node.go
starcoder
package ndjson import ( "errors" ) // Any returns the position of the end of the current element that begins at pos; handles any valid json element func Any(in []byte, pos int) (int, error) { pos, err := SkipSpace(in, pos) if err != nil { return 0, err } switch in[pos] { case '{': return Object(in, pos) ca...
pkg/json/ndjson/types.go
0.654122
0.468365
types.go
starcoder
package memory import ( "errors" "fmt" "strconv" "strings" ) // base 2 and base 10 sizes. const ( B Size = 1 << (10 * iota) KiB MiB GiB TiB PiB EiB KB Size = 1e3 MB Size = 1e6 GB Size = 1e9 TB Size = 1e12 PB Size = 1e15 EB Size = 1e18 ) // Size implements flag.Value for collecting memory size in b...
vendor/storj.io/common/memory/size.go
0.717804
0.616359
size.go
starcoder
package yttlibrary import ( "fmt" "github.com/k14s/starlark-go/starlark" "github.com/k14s/starlark-go/starlarkstruct" "github.com/k14s/ytt/pkg/template/core" ) var ( AssertAPI = starlark.StringDict{ "assert": &starlarkstruct.Module{ Name: "assert", Members: starlark.StringDict{ "equals": starlark.N...
vendor/github.com/k14s/ytt/pkg/yttlibrary/assert.go
0.63624
0.423458
assert.go
starcoder
package mcts import ( "log" "math/rand" "sort" ) // A node in the (action, state) game tree. Wins are from the veiwpoint of the player-just-moved. type treeNode struct { parent *treeNode // What node contains this node? Root node's parent is nil. move Move // What move lead to this nod...
node.go
0.729423
0.679445
node.go
starcoder
package hitmap import ( "log" "math/big" "sort" "github.com/go-spatial/geom" "github.com/go-spatial/geom/planar" ) // PolygonHM implements a basic hit map that gives the label for a point based on the order of the rings. type PolygonHM struct { // clipBox this is going to be either the clipping area or the bou...
planar/makevalid/hitmap/polygon_hitmap.go
0.663887
0.594021
polygon_hitmap.go
starcoder
package example import ( "fmt" ) func anonymous() { // Note: the () at the end of the anonymous function will mean it's executed and the returned // value will be provided to the Printf command. Without the () it will instead return the function // to Printf. fmt.Printf("1. The output from the anonymous function...
chase/internal/pkg/example/closures.go
0.624179
0.546799
closures.go
starcoder
package unum import ( "math" ) func Vec4_One() Vec4 { return Vec4{1, 1, 1, 1} } func Vec4_Zero() Vec4 { return Vec4{0, 0, 0, 0} } func Vec4_Lerp(from, to *Vec4, t float64) *Vec4 { t = Clamp01(t) return &Vec4{t*(to.X-from.X) + from.X, t*(to.Y-from.Y) + from.Y, t*(to.Z-from.Z) + from.Z, t*(to.W-f...
util/num/vec4.go
0.821116
0.530419
vec4.go
starcoder
package testdata // ListMethodsResponse example var ListMethodsResponse = `{ "count": 13, "_embedded": { "methods": [ { "resource": "method", "id": "ideal", "description": "iDEAL", "minimumAmount": { "v...
testdata/methods.go
0.873552
0.47244
methods.go
starcoder
package effects func ApplyContinuationToEffectResult[L TypedEffectTag[A], E any, A any, B any](effect L, continuation evalRightNode[E, B], effectResult A) Eff[E, B] { return continuation.qApply(effectResult) } type Handler[E any, A any, B any] func(e Eff[E, A]) Eff[E, B] type HandlerWithState[E any, S any, A any, B...
monads/effects/interpreter.go
0.660939
0.414247
interpreter.go
starcoder
package pure import ( "context" "errors" "strconv" "time" "github.com/benthosdev/benthos/v4/internal/bundle" "github.com/benthosdev/benthos/v4/internal/component" "github.com/benthosdev/benthos/v4/internal/component/output" "github.com/benthosdev/benthos/v4/internal/component/output/processors" "github.com/b...
internal/impl/pure/output_fallback.go
0.728748
0.567457
output_fallback.go
starcoder
package v1 import ( "encoding/json" ) // Coordinates struct for Coordinates type Coordinates struct { Latitude *string `json:"latitude,omitempty"` Longitude *string `json:"longitude,omitempty"` } // NewCoordinates instantiates a new Coordinates object // This constructor will assign default values to properties ...
v1/model_coordinates.go
0.850018
0.484563
model_coordinates.go
starcoder
package trie // Match is matched data. type Match struct { Value interface{} } // MatchTree compares a string with multiple strings using Aho-Corasick // algorithm. type MatchTree struct { root *Node } type matchData struct { value interface{} fail *Node } // Compile compiles a MatchTree from a Tree. func Comp...
match.go
0.735831
0.465327
match.go
starcoder
package canvas import ( "reflect" "strings" "github.com/fogleman/gg" ) // Point is an auxiliary struct used during parsing. type Point struct { x, y int } // NewPoint instantiates a new Point. func NewPoint(x, y int) *Point { return &Point{x, y} } // Line struct defines the line x & y coordinates, the starti...
canvas/generator.go
0.766119
0.675965
generator.go
starcoder
package jdenticon import ( "strconv" ) type shapesGetter func(cell float64, index int) Shapes // nolint:gochecknoglobals var shapeInner = []shapesGetter{ func(cell float64, index int) Shapes { k := cell * 0.42 return Shapes{newPolygon([]Point{ {0, 0}, {cell, 0}, {cell, cell - k*2}, {cell - k, cell}...
shapes.go
0.683947
0.473596
shapes.go
starcoder
package sha3 // This file provides functions for creating instances of the SHA-3 // and SHAKE hash functions, as well as utility functions for hashing // bytes. import ( "hash" ) // NewKeccak256 creates a new Keccak-256 hash. func NewKeccak256() hash.Hash { return &state{rate: 136, outputLen: 32, dsbyte: 0x01} } ...
crypto/sha3/hashes.go
0.793946
0.507446
hashes.go
starcoder
package kata // All commands are implemented as functions on the machine structure type command = func(work *machine) // Dataset of the running Smallfuck machine // The code string is stored as array of command functions type machine struct { tape []bool tapePointer int program []command comma...
5_kyu/Esolang_Interpreters_2_Custom_Smallfuck_Interpreter.go
0.614857
0.44342
Esolang_Interpreters_2_Custom_Smallfuck_Interpreter.go
starcoder
package bls import ( "github.com/nlpodyssey/spago/pkg/mat" "github.com/nlpodyssey/spago/pkg/ml/ag" "github.com/nlpodyssey/spago/pkg/ml/nn" "log" ) // BroadLearningAlgorithm performs the ridge regression approximation to optimize the output params (Wo). // The parameters for feature mapping (Wz) can also be optim...
pkg/ml/nn/bls/bla.go
0.723798
0.511595
bla.go
starcoder
package convert import "encoding/json" type dataSample struct { data []byte err error } func NewDataSample() dataSample { return dataSample{} } func (d dataSample) Byte() []byte { return d.data } func (d dataSample) String() string { return string(d.data) } func (d dataSample) Any() interface{} { var v int...
convert/sample_data.go
0.564339
0.426322
sample_data.go
starcoder
package openapi // BatchControl struct for BatchControl type BatchControl struct { // Batch ID ID string `json:"ID,omitempty"` // Same as ServiceClassCode in BatchHeaderRecord ServiceClassCode int32 `json:"serviceClassCode,omitempty"` // EntryAddendaCount is a tally of each Entry Detail Record and each Addenda Re...
client/model_batch_control.go
0.569972
0.405949
model_batch_control.go
starcoder
package esproperties import ( "reflect" "strconv" ) // Datatype is a datatype for Elasticsearch. // The zero Datatype is not a valid Datatype. type Datatype int const ( // Invalid Datatype Invalid Datatype = iota // Text Datatype Text // Keyword Datatype Keyword // Long Datatype Long // Integer Datatype ...
esproperties/datatype.go
0.549641
0.428771
datatype.go
starcoder
package openapi // Callback Object // A map of possible out-of band callbacks related to the parent operation. // Each value in the map is a Path Item Object that describes a set of requests // that may be initiated by the API provider and the expected responses. The key // value used to identify the path item object...
callback.go
0.756897
0.485051
callback.go
starcoder
package mvt import ( "encoding/binary" "fmt" "math" ) // Tile represents a Mapbox Vector Tile type Tile struct { layers []*Layer } // Layer represents a layer type Layer struct { name string features []*Feature extent uint32 hasExtent bool } // SetExtent sets the layers extent. Default is 4096. fu...
mvt.go
0.647241
0.488954
mvt.go
starcoder
package operation import ( "fmt" "math" ) const swapV2ConfTarget = 250 // Approx 2 days type FeeWindow struct { TargetedFees map[uint]float64 } // SwapFeeRate gets the appropriate fee rate for a given swap (depends on confirmations needed). // Useful method for when swap doesn't have a fixed amount (e.g AmountLe...
libwallet/operation/fee_window.go
0.80147
0.465266
fee_window.go
starcoder
package xdr // IsFeeBump returns true if the transaction envelope is a fee bump transctoin func (e TransactionEnvelope) IsFeeBump() bool { return e.Type == EnvelopeTypeEnvelopeTypeTxFeeBump } // FeeBumpAccount returns the account paying for the fee bump transaction func (e TransactionEnvelope) FeeBumpAccount() Muxed...
xdr/transaction_envelope.go
0.856962
0.469095
transaction_envelope.go
starcoder
package modbus import ( "encoding/binary" "math" ) func uint16ToBytes(endianness Endianness, in uint16) (out []byte) { out = make([]byte, 2) switch endianness { case BIG_ENDIAN: binary.BigEndian.PutUint16(out, in) case LITTLE_ENDIAN: binary.LittleEndian.PutUint16(out, in) } return } func uint16sToBytes(endi...
encoding.go
0.547464
0.418875
encoding.go
starcoder