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 utils import ( "math" "math/rand" "sort" "time" ) func init() { rand.Seed(time.Now().UnixNano()) } //Gaussian returns the gaussien at zero func Gaussian(mean float64, std float64) float64 { return mean + std*gauassian() } func gauassian() float64 { //Polar method var x, y, z float64 for z >= 1 || ...
utils/gaussian.go
0.787441
0.569254
gaussian.go
starcoder
package GoNeuralNetwork import "math" func sigmoid(input float64) float64 { inp := float64(int(input*10000)) / 10000 return 1.0 / (1.0 + math.Exp(-inp)) } func elU(input float64) float64 { inp := float64(int(input*10000)) / 10000 if inp > 0 { return inp } return 1.0 * (math.Exp(inp) - 1) } func relU(input f...
activations.go
0.82755
0.507202
activations.go
starcoder
package gomodel import "database/sql" type ( // Store defines the interface to store data from databqase rows Store interface { // Init will be called twice, first to allocate initial data space, second to specified // the final row count // Init initial the data store with size rows, if size is not enough, ...
scan.go
0.508056
0.40116
scan.go
starcoder
package adventlang import ( "github.com/alecthomas/participle/v2" "github.com/alecthomas/participle/v2/lexer" ) type Program struct { Pos lexer.Position Statements []*Statement `@@*` } type Statement struct { Pos lexer.Position If *IfStatement `@@` For *ForStatement `| @@` While *WhileStatement `...
pkg/adventlang/parse.go
0.682891
0.420302
parse.go
starcoder
package binson import ( "bytes" "encoding/binary" "fmt" "math" ) const( binsonBegin byte = 0x40 binsonEnd = 0x41 binsonBeginArray = 0x42 binsonEndArray = 0x43 binsonTrue = 0x44 binsonFalse = 0x45 binsonInteger1 = 0x10 binsonInteger2 = 0x11 binsonInteger4 = 0x12 ...
pack_unpack.go
0.648578
0.444143
pack_unpack.go
starcoder
package animation import ( "github.com/juan-medina/goecs" ) // Sequence represent a set of frames that will be render with a delay type Sequence struct { Sheet string // Sheet is the sprite sheet where the animation sprites are Base string // Base is the base name for each frame. ex : Idle_%d.png Rotatio...
components/animation/animation.go
0.805364
0.409221
animation.go
starcoder
package warmup2 import "math" /* Given a string and a non-negative int n, return a larger string that is n copies of the original string. */ func string_times(str string, n int) string { var temp string = "" for i := 0; i < n; i++ { temp += str } return temp } /* Given a string and a non-negative int n, ...
Go/CodingBat/warmup-2.go
0.547948
0.443058
warmup-2.go
starcoder
package stackable import ( "errors" ) // Stackable is an interface for an element that can be placed into // a slice but should be incremented as a stack instead of appended // to the slice. type Stackable interface { GetItem() interface{} GetCount() uint SetCount(uint) } // Stack is a struct that represents the...
stackable/stack.go
0.793026
0.54153
stack.go
starcoder
package iso20022 // Set of elements used to provide information on the settlement of the instruction. type SettlementInformation15 struct { // Agent through which the instructing agent will reimburse the instructed agent. // Usage: If InstructingAgent and InstructedAgent have the same reimbursement agent, then only...
SettlementInformation15.go
0.667581
0.542742
SettlementInformation15.go
starcoder
package boruta import ( "math" "strings" ) // ListFilter is used to filter elements in a collection. type ListFilter interface { // Match tells if element matches the filter. Match(elem interface{}) bool } // SortOrder denotes in which order (ascending or descending) collection should be sorted. type SortOrder ...
lists.go
0.765769
0.410934
lists.go
starcoder
package main import ( "math" ray "github.com/gen2brain/raylib-go/raylib" ) func main() { screenWidth := int32(1000) screenHeight := int32(1000) ray.SetConfigFlags(ray.FlagMsaa4xHint) ray.InitWindow(screenWidth, screenHeight, "xtra") camera := ray.Camera{} camera.Position = ray.NewVector3(0.0, 10.0, 10.0) ...
plane/main.go
0.653127
0.534127
main.go
starcoder
package entries import ( "sort" "unicode" ) // List is a list of entries. type List struct { list []*Entry } func copyEntrySlice(slice []*Entry) []*Entry { return append([]*Entry{}, slice...) } // FromOffset returns n entries from a given offset. // If there aren't enough entries from offset, it will return as ...
entries/list.go
0.771456
0.466785
list.go
starcoder
package levenshtein func CalculateDistance(firstWord string, secondWord string) int { numOfColumns := len(firstWord) + 1 numOfRows := len(secondWord) + 1 distanceMatrix := createZeroedMatrix(numOfColumns, numOfRows) distanceMatrix = prepareMatrix(distanceMatrix) distanceMatrix = runLevenshteinAlgorithmOnMatrix(...
levenshtein.go
0.751375
0.785267
levenshtein.go
starcoder
package object import ( "fmt" "github.com/simp7/times" "time" ) type accurate struct { times.Object ms int } //Accurate is function that returns the struct that implements times.Object. //Minimum unit of Accurate is second. //As Accurate returns the most-accurate times.Object object, It is encouraged to compare...
object/accurate.go
0.84556
0.567517
accurate.go
starcoder
package service // Stability is a type that represents the relative stability of a service // module type Stability int const ( // StabilityExperimental represents relative stability of the most immature // service modules. At this level of stability, we're not even certain we've // built the right thing! Stabili...
pkg/service/types.go
0.75183
0.603873
types.go
starcoder
package renderer import ( "github.com/g3n/engine/math32" "log" ) // getCenter gets the centerpoint of a 3D box func getCenter(box math32.Box3) *math32.Vector3 { return box.Center(nil) } // focusOnSelection sets the camera focus on the current selection func (app *RenderingApp) focusOnSelection() { var bbox *math...
renderer/camera.go
0.628749
0.445469
camera.go
starcoder
package float32z import ( "sort" "strconv" ) const ( // BitSize is the size in bits of this type. BitSize = 32 ) var ( _ sort.Interface = Slice{} ) // Ptr returns a pointer to the value. func Ptr(v float32) *float32 { return &v } // PtrZeroToNil returns a pointer to the value, or nil if 0. func PtrZeroToNil(...
numeric/float32z/float32z.go
0.763484
0.403391
float32z.go
starcoder
package propertycost import ( "errors" "math" ) //DownPayment describes a down payment and //its assocciated costs. //AmountInHand - how much money you have to pay down on the price of the house //RequiredPercentage - The percentage of property cost that needs to be a down payment //Rent(decimal form) - The rent on...
pkg/propertycost/propertycost.go
0.713032
0.637214
propertycost.go
starcoder
package neural import "math" // ActivationFunc is the structure that represents a forward function and its derivative function type ActivationFunc struct { f func(float64) float64 fprime func(float64) float64 } // NewActivationFunc creates a new ActivationFunc structure func NewActivationFunc(f, fprime func(f...
activation.go
0.847258
0.591694
activation.go
starcoder
// Exercise 3.11: Enhance comma so that it deals correctly with floating-point numbers and an optional sign. // Exercise 3.12: Write a function that reports whether two strings are anagrams of each other, that is, they contain the same letters in a different order. package main import ( "bytes" "fmt" "reflect" ...
ch3/strings/strings.go
0.671794
0.445469
strings.go
starcoder
package pointers import ( "time" ) // ---- Public Functions ---- // Bool receives an input of bool and returns a pointer to that type. func Bool(b bool) *bool { return &b } // Byte receives an input of byte and returns a pointer to that type. func Byte(b byte) *byte { return &b } // Complex64 receives an input ...
pointers.go
0.846546
0.498657
pointers.go
starcoder
package mlpack /* #cgo CFLAGS: -I./capi -Wall #cgo LDFLAGS: -L. -lmlpack_go_local_coordinate_coding #include <capi/local_coordinate_coding.h> #include <stdlib.h> */ import "C" import "gonum.org/v1/gonum/mat" type LocalCoordinateCodingOptionalParam struct { Atoms int InitialDictionary *mat.Dense InputMo...
local_coordinate_coding.go
0.716913
0.425546
local_coordinate_coding.go
starcoder
package list import ( "github.com/peterzeller/go-fun/equality" "github.com/peterzeller/go-fun/iterable" "github.com/peterzeller/go-fun/slice" "github.com/peterzeller/go-fun/zero" ) // List is an immutable data type which is backed by a slice. type List[T any] struct { slice []T } // At returns the element at th...
list/list.go
0.745398
0.579192
list.go
starcoder
package arraylist import ( "errors" "github.com/WUMUXIAN/go-common-utils/datastructure/shared" ) type ArrayList struct { elements []interface{} size int capacity int Comparator shared.Comparator } // New creates a new array list with given comparator func New(comparator shared.Comparator) *ArrayList...
datastructure/arraylist/arraylist.go
0.742515
0.419886
arraylist.go
starcoder
package cogol import ( "fmt" "reflect" ) const ( failureMsg = "Expected %v, got %v" ) // assertion represents a typical assertion // Includes expected and actual values, as well as the context (ctx) of the the test type assertion struct { expected interface{} actual interface{} ctx *Context kill fu...
assertions.go
0.606615
0.524029
assertions.go
starcoder
package poc import ( "math/big" "github.com/shopspring/decimal" ) const ( iterativeMPrecision = 256 iterativeDecimalPrecision = 256 ) var ( //bigDecimalZero = decimal.NewFromInt(0) bigDecimalOne = decimal.NewFromInt(1) bigDecimalTwo = decimal.NewFromInt(2) power2Table [257]*big.Int negPower2Tabl...
poc/log2.go
0.61057
0.421373
log2.go
starcoder
package cp import "math" type DampedSpringForceFunc func(spring *DampedSpring, dist float64) float64 type DampedSpring struct { *Constraint AnchorA, AnchorB Vector RestLength, Stiffness, Damping float64 SpringForceFunc DampedSpringForceFunc targetVrn, vCoef float64 r1, r2 Vector...
dampedspring.go
0.83772
0.451266
dampedspring.go
starcoder
package nitro import ( "image" "image/color" ) // Tiled is an image.Image whose pixels are stored as a sequence of 8x8 tiles. // Since it is conceptually one-dimensional, its bounds may be undefined. type Tiled struct { Pix []uint8 Stride int // number of tiles per row Rect image.Rectangle Palette color...
nitro/tiled.go
0.770637
0.613208
tiled.go
starcoder
package ns_x import ( "github.com/bytedance/ns-x/v2/base" "reflect" "strconv" "strings" ) // Builder is a convenience tool to describe the whole network and build // when a node is described for the first time, a unique id is assigned to it, which will be the index of node in the built network type Builder interf...
builder.go
0.533397
0.532486
builder.go
starcoder
package kameria import ( mathOld "math" "reflect" "time" kmath "github.com/M-Quadra/kameria/k-math" ) type math struct{} // Math for call kmath func simply without type var Math = math{} // only support for ...{int|int64|string|float32|float64|time.Time} // default nil func (m math) Max(x ...interface{}) inte...
math.go
0.595022
0.414129
math.go
starcoder
// Sample program to show how to grow a slice using the built-in function append // and how append grows the capacity of the underlying array. package main import "fmt" func main() { // Declare a nil slice of strings. var data []string // Capture the capacity of the slice. lastCap := cap(data) // Append ~100...
content/docs/language/slices/example4/example4.go
0.672977
0.682838
example4.go
starcoder
package cmd // FunctionCall represents the details of the function call type FunctionCall struct { // ContractAddress Is a field element of 251 bits. Represented as up to 64 hex digits ContractAddress string `json:"contract_address"` // EntryPointSelector Is a field element of 251 bits. Represented as up to 64 hex ...
cmd/cli/types.go
0.776581
0.531757
types.go
starcoder
package utils import "math" // May be three dimensional, like in vase mode type Segment struct { SegmentLength float64 FeedRate float64 FilamentFeedLength float64 LayerHeight float64 } type HotEnd struct { filamentDiameter float64 nozzleDiameter float64 feedRatio flo...
utils/calculation.go
0.836588
0.563678
calculation.go
starcoder
package geogoth // LineStringLength counts length of LineString func LineStringLength(linestr *LineString) float64 { var length float64 coords := linestr.Coords lineCoords := make([][]float64, 0) // Creates slice for coords of one line for i := range coords { y, x := linestr.Coords[i][0], linestr.Coords[i][1] ...
lengths.go
0.816333
0.469095
lengths.go
starcoder
package main import ( "fmt" "log" "strings" "strconv" ) var input = "R3, R1, R4, L4, R3, R1, R1, L3, L5, L5, L3, R1, R4, L2, L1, R3, L3, R2, R1, R1, L5, L2, L1, R2, L4, R1, L2, L4, R2, R2, L2, L4, L3, R1, R4, R3, L1, R1, L5, R4, L2, R185, L2, R4, R49, L3, L4, R5, R1, R1, L1, L1, R2, L1, L4, R4, R5, R4...
days/1/main.go
0.518546
0.559771
main.go
starcoder
package ahrs import ( "github.com/chewxy/math32" "github.com/foxis/EasyRobot/pkg/core/math/vec" ) type MahonyAHRS struct { Options accel, gyro, mag vec.Vector3D q vec.Quaternion eInt vec.Vector3D SamplePeriod float32 } func NewMahony(opts ...Option) AHRS { m := MahonyAHRS{ Op...
pkg/core/math/filter/ahrs/mahony.go
0.754192
0.596022
mahony.go
starcoder
package main import "fmt" // 1st attempt at populating the integer array func populateIntegerArray(input [5]int) { input[0] = 3 input[1] = 6 input[2] = 9 input[3] = 12 input[4] = 15 } // 2nd attempt at populating the integer array func populateIntegerArrayWithReturnValue(input [5]int) [5]int { input[0] = 3 ...
Section 3/declarearrays.go
0.665737
0.550003
declarearrays.go
starcoder
package execute import ( "github.com/EMCECS/influx/query" uuid "github.com/satori/go.uuid" ) // Dataset represents the set of data produced by a transformation. type Dataset interface { Node RetractTable(key query.GroupKey) error UpdateProcessingTime(t Time) error UpdateWatermark(mark Time) error Finish(error...
query/execute/dataset.go
0.562898
0.428054
dataset.go
starcoder
package gcp import ( "context" "fmt" "path" "sync" "time" "cloud.google.com/go/storage" "github.com/Jeffail/benthos/v3/internal/bloblang/field" "github.com/Jeffail/benthos/v3/internal/bundle" ioutput "github.com/Jeffail/benthos/v3/internal/component/output" "github.com/Jeffail/benthos/v3/internal/docs" "gi...
internal/impl/gcp/cloud_storage_output.go
0.608361
0.631594
cloud_storage_output.go
starcoder
package benchkit import ( "math" "sort" "time" ) // TimeResult contains the memory measurements of a memory benchmark // at each point of the benchmark. type TimeResult struct { N int Setup time.Time Start time.Time Teardown time.Time Each []TimeStep } // TimeStep contains statistics about a...
vendor/github.com/aybabtme/benchkit/time_kit.go
0.819569
0.539469
time_kit.go
starcoder
package commonxl import ( "fmt" "log" "time" "github.com/Bridgement/grate" ) // Sheet holds raw and rendered values for a spreadsheet. type Sheet struct { Formatter *Formatter NumRows int NumCols int Rows [][]Cell CurRow int } // Resize the sheet for the number of rows and cols given. // Newly ad...
commonxl/sheet.go
0.567457
0.436382
sheet.go
starcoder
package iso20022 // Provides the details of each individual secured market transaction. type MoneyMarketTransactionStatus2 struct { // Unique transaction identifier will be created at the time a transaction is first executed, shared with all registered entities and counterparties involved in the transaction, and use...
MoneyMarketTransactionStatus2.go
0.796134
0.446796
MoneyMarketTransactionStatus2.go
starcoder
package values import ( "fmt" "regexp" "github.com/freetsdb/freetsdb/services/flux/semantic" ) type Typer interface { Type() semantic.Type PolyType() semantic.PolyType } type Value interface { Typer Str() string Int() int64 UInt() uint64 Float() float64 Bool() bool Time() Time Duration() Duration Rege...
services/flux/values/values.go
0.757166
0.564399
values.go
starcoder
package grid func NewGrid(values [][]int, allowDiagonalNeighbours bool) *Grid { g := &Grid{ colLength: len(values[0]), rowLength: len(values), cells: make([][]*Cell, len(values)), allowDiagonalNeighbours: allowDiagonalNeighbours, } for x, rows := range values {...
internal/grid/grid.go
0.810816
0.742445
grid.go
starcoder
package circuit import ( "sync" "github.com/consensys/gkr-mimc/common" "github.com/consensys/gkr-mimc/polynomial" "github.com/consensys/gnark-crypto/ecc/bn254/fr" ) // Circuit contains all the statical informations necessary to // describe a GKR circuit. type Circuit struct { Layers []Layer } // Assignment ga...
circuit/circuit.go
0.677047
0.408926
circuit.go
starcoder
package filter import ( "bytes" "encoding/json" "fmt" "github.com/AdRoll/baker" "github.com/jmespath/go-jmespath" ) const expandJSONhelp = ` ExpandJSON extracts values from a JSON formatted record field and writes them into other fields of the same record. It supports [JMESPath](https://jmespath.org/tutorial.ht...
filter/expand_json.go
0.6973
0.450782
expand_json.go
starcoder
package main import ( "fmt" "io/ioutil" "log" "path/filepath" "reflect" "strings" yaml "gopkg.in/yaml.v2" rivescript "github.com/aichaos/rivescript-go" ) // TestCase wraps each RiveScript test. type TestCase struct { file string name string username string rs *rivescript.RiveScript steps ...
go/main.go
0.595375
0.409575
main.go
starcoder
package flow import ( "github.com/skydive-project/skydive/common" "github.com/skydive-project/skydive/filters" ) // MergeContext describes a mechanism to merge flow sets type MergeContext struct { Sort bool SortBy string SortOrder common.SortOrder Dedup bool DedupBy string } // NewFlowSet create...
flow/set.go
0.747063
0.475179
set.go
starcoder
package number import ( "fmt" "github.com/codingsince1985/geo-golang" "github.com/codingsince1985/geo-golang/openstreetmap" "math" ) const ( earthRadius float64 = 6371 ) type city struct { name string latitude, longitude float64 } func getDistance(source, destination city) float64 { // Havers...
number/distancecalculator.go
0.668339
0.539105
distancecalculator.go
starcoder
package cp import ( "fmt" "math" ) type Vector struct { X, Y float64 } func (v Vector) String() string { return fmt.Sprintf("%f,%f", v.X, v.Y) } func (v Vector) Equal(other Vector) bool { return v.X == other.X && v.Y == other.Y } func (v Vector) Add(other Vector) Vector { return Vector{v.X + other.X, v.Y + o...
vector.go
0.907556
0.729423
vector.go
starcoder
package patch import ( "encoding/json" "fmt" "reflect" "strings" "github.com/pkg/errors" ) // ValidateError is the error type that will be returned if an update fails in the validation step. type ValidateError struct { key string err error } func (u ValidateError) Error() string { return fmt.Sprintf("valida...
patch.go
0.674694
0.401131
patch.go
starcoder
package chess type Board struct { x int y int cells map[int]map[int]*Cell } func (Board) Create(x int, y int) *Board { cells := make(map[int]map[int]*Cell, y) for i := 1; i <= y; i++ { cells[i] = make(map[int]*Cell, x) for j := 1; j <= y; j++ { cells[i][j] = &Cell{} } } board := &Board{x: x, ...
internal/chess/Board.go
0.813572
0.575111
Board.go
starcoder
package table import ( "fmt" "github.com/charmbracelet/lipgloss" ) // RowData is a map of string column keys to interface{} data. Data with a key // that matches a column key will be displayed. Data with a key that does not // match a column key will not be displayed, but will remain attached to the Row. // This...
table/row.go
0.722918
0.44342
row.go
starcoder
package jsonlogic import ( "fmt" "strings" ) // AddOpMap adds "map" operation to the JSONLogic instance. Param restriction: // - At least two params: the first evaluated to an array and the second the logic. func AddOpMap(jl *JSONLogic) { jl.AddOperation("map", opMap) } func opMap(apply Applier, params []interf...
array_str.go
0.714628
0.506774
array_str.go
starcoder
package plaid import ( "encoding/json" ) // PayPeriodDetails Details about the pay period. type PayPeriodDetails struct { // The amount of the paycheck. CheckAmount NullableFloat32 `json:"check_amount,omitempty"` DistributionBreakdown *[]DistributionBreakdown `json:"distribution_breakdown,omitempty"` // The pay...
plaid/model_pay_period_details.go
0.912631
0.416322
model_pay_period_details.go
starcoder
package scv import ( "sort" "github.com/knightjdr/prohits-viz-analysis/pkg/slice" customSort "github.com/knightjdr/prohits-viz-analysis/pkg/sort" "github.com/knightjdr/prohits-viz-analysis/pkg/types" ) func createPlotData(data map[string]map[string]map[string]float64, known map[string]map[string]bool, legend typ...
pkg/tools/analyze/scv/createplotdata.go
0.618089
0.413418
createplotdata.go
starcoder
package gl import "github.com/ContextLogic/cldr" var calendar = cldr.Calendar{ Formats: cldr.CalendarFormats{ Date: cldr.CalendarDateFormat{Full: "EEEE dd MMMM y", Long: "dd MMMM y", Medium: "d MMM, y", Short: "dd/MM/yy"}, Time: cldr.CalendarDateFormat{Full: "HH:mm:ss zzzz", Long: "HH:mm:ss z", Medium: "...
resources/locales/gl/calendar.go
0.534127
0.469095
calendar.go
starcoder
package ugo import ( "math" "strconv" "strings" "github.com/ozanh/ugo/token" ) // Int represents signed integer values and implements Object interface. type Int int64 // TypeName implements Object interface. func (Int) TypeName() string { return "int" } // String implements Object interface. func (o Int) Str...
numeric.go
0.726814
0.471771
numeric.go
starcoder
package utils import ( "fmt" "github.com/google/go-cmp/cmp" "github.com/google/go-cmp/cmp/cmpopts" "github.com/mitchellh/mapstructure" "math" "math/rand" "reflect" "testing" ) func ContainsString(slice *[]string, value *string) bool { for _, v := range *slice { if v == *value { return true } } retur...
lib/utils/utils.go
0.727782
0.511168
utils.go
starcoder
package datadog import ( "encoding/json" ) // SLOHistoryMetricsSeriesMetadata Query metadata. type SLOHistoryMetricsSeriesMetadata struct { // Query aggregator function. Aggr *string `json:"aggr,omitempty"` // Query expression. Expression *string `json:"expression,omitempty"` // Query metric used. Metric *str...
api/v1/datadog/model_slo_history_metrics_series_metadata.go
0.827061
0.414662
model_slo_history_metrics_series_metadata.go
starcoder
package kernels //XtraKerns returns the kernel names through methods type XtraKerns struct { } //ConcatNHWCEXHalf - Does a concat backward with multiple outputs func (t XtraKerns) ConcatNHWCEXHalf() string { return "ConcatNHWCEXHalf" } //ConcatNHWCEX - Does a concat backward with multiple outputs func (t XtraKerns)...
kernels/gocudnnxtra.go
0.916666
0.560914
gocudnnxtra.go
starcoder
package math import ( "math/big" ) func Mul(x, y *big.Int) *big.Int { return big.NewInt(0).Mul(x, y) } func Div(x, y *big.Int) *big.Int { return big.NewInt(0).Div(x, y) } func Add(x, y *big.Int) *big.Int { return big.NewInt(0).Add(x, y) } func Sub(x, y *big.Int) *big.Int { return big.NewInt(0).Sub(x, y) } fu...
utils/math/big.go
0.75274
0.630884
big.go
starcoder
package gokalman import ( "fmt" "math" "github.com/gonum/matrix/mat64" ) // NewInformation returns a new Information KF. To get the next estimate, call // Update() with the next measurement and the control vector. This will return a // new InformationEstimate which contains everything of this step and an error if...
information.go
0.781205
0.561876
information.go
starcoder
package mathservice import ( "context" "errors" "github.com/go-kit/kit/metrics" "math" "github.com/go-kit/kit/log" ) // Service describes a service that adds things together. type Service interface { // Divide two integers, a/b Divide(ctx context.Context, a, b float64) (float64, error) // Max two integers, r...
grpc_only/gokit/pkg/mathservice/service.go
0.841142
0.441432
service.go
starcoder
package address import ( "encoding/hex" "fmt" "github.com/alonp99/go-spacemesh/common" "github.com/alonp99/go-spacemesh/crypto/sha3" "math/big" "reflect" ) // Address represents the 20 byte address of an spacemesh account. type Address [common.AddressLength]byte var addressT = reflect.TypeOf(Address{}) // Byt...
address/address.go
0.829043
0.485112
address.go
starcoder
package pgn func (b Board) findAttackingRook(pos Position, color Color, check bool) (Position, error) { count := 0 retPos := NoPosition r := pos.GetRank() f := pos.GetFile() for { f-- testPos := PositionFromFileRank(f, r) if b.checkRookColor(testPos, color) && (!check || !b.moveIntoCheck(Move{testPos, pos,...
board_rook.go
0.512693
0.601125
board_rook.go
starcoder
package glist import ( "sync" ) type Array struct { sync.RWMutex slice []Element concurrent bool } func NewArray() *Array { return &Array{} } func NewArrayConcurrent() *Array { return &Array{concurrent: true} } // Add appends the specified element to the end of this list func (array *Array) Add(e Eleme...
go-collection/glist/array.go
0.619126
0.515071
array.go
starcoder
package stack import ( "eslang/core" "fmt" ) // StackValueInt struct  represents an integer value. type StackValueInt struct { value int64 } // NewStackValueInt function  creates a new integer value. func NewStackValueInt(value int64) StackValue { return StackValueInt{ value: value, } } // Type method ...
interpreter/stack/values.go
0.682574
0.558387
values.go
starcoder
package p2019 /** You are given a string s that contains digits 0-9, addition symbols '+', and multiplication symbols '*' only, representing a valid math expression of single digit numbers (e.g., 3+5*2). This expression was given to n elementary school students. The students were instructed to get the answer of the e...
src/leetcode/set1000/set2000/set2000/set2010/p2019/solution.go
0.841207
0.6937
solution.go
starcoder
package chunks import ( "fmt" "io" "github.com/attic-labs/noms/go/hash" ) // ChunkStore is the core storage abstraction in noms. We can put data anyplace we have a ChunkStore implementation for. type ChunkStore interface { ChunkSource ChunkSink RootTracker } // Factory allows the creation of namespaced Chunk...
go/chunks/chunk_store.go
0.748076
0.563138
chunk_store.go
starcoder
package crf import ( "fmt" "math" "math/rand" "strings" ) // Label is a label applied to a word in a sentence type Label string // FeatureFunction is a feature function for linear-chain CRF type FeatureFunction func(s []string, i int, labelCurr Label, labelPrev Label) bool // Feature includes the weight and fea...
crf/crf.go
0.7324
0.57827
crf.go
starcoder
package gem import ( "fmt" "regexp" "strings" "golang.org/x/xerrors" ) var ( constraintOperators = map[string]operatorFunc{ "": constraintEqual, "=": constraintEqual, "==": constraintEqual, "!=": constraintNotEqual, ">": constraintGreaterThan, "<": constraintLessThan, ">=": constraintGreaterT...
vendor/github.com/aquasecurity/go-gem-version/constraint.go
0.744378
0.410343
constraint.go
starcoder
package create import ( "encoding/json" "testing" "github.com/infracloudio/botkube/pkg/config" "github.com/infracloudio/botkube/pkg/notify" "github.com/infracloudio/botkube/pkg/utils" "github.com/infracloudio/botkube/test/e2e/env" testutils "github.com/infracloudio/botkube/test/e2e/utils" "github.com/nlopes/s...
test/e2e/notifier/create/create.go
0.561455
0.658822
create.go
starcoder
package input import ( "github.com/Jeffail/benthos/v3/internal/docs" "github.com/Jeffail/benthos/v3/lib/input/reader" "github.com/Jeffail/benthos/v3/lib/log" "github.com/Jeffail/benthos/v3/lib/metrics" "github.com/Jeffail/benthos/v3/lib/types" "github.com/Jeffail/benthos/v3/lib/util/aws/session" ) //-----------...
lib/input/s3.go
0.809276
0.752058
s3.go
starcoder
package main import ( "fmt" ecs "github.com/x-hgg-x/goecs/v2" ) func main() { // List of component data types type Shape struct{ shape string } type Color struct{ color string } type Name struct{ name string } // Structure for storing components // Several storage types are possible components := struct { ...
cmd/example/main.go
0.575588
0.401893
main.go
starcoder
package spec // Parameter Locations // There are four possible parameter locations specified by the in field: const ( InPath = "path" // Used together with Path Templating, where the parameter value is actually part of the operation's URL. This does not include the host or base path of the API. For example, in /i...
vendor/github.com/wzshiming/openapi/spec/parameter_util.go
0.762336
0.453927
parameter_util.go
starcoder
package collator // The Collator watches a log file in the Common Log format and sends data // to a listener. import ( "context" "github.com/RobinUS2/golang-moving-average" "github.com/gilramir/monitor-weblog/xojoc/logparse" "github.com/hpcloud/tail" "sort" "strings" "time" ) const ( // How often to report S...
collator/collator.go
0.624064
0.46035
collator.go
starcoder
package image import ( "image" "image/color" "sync" "github.com/hajimehoshi/ebiten/v2" ) // A NineSlice is an image that can be drawn with any width and height. It is basically a 3x3 grid of image tiles: // The corner tiles are drawn as-is, while the center columns and rows of tiles will be stretched to fit the ...
image/nineslice.go
0.733738
0.524029
nineslice.go
starcoder
package advent import ( "strconv" ) var _ Problem = &binaryDiagnostic{} type binaryDiagnostic struct { dailyProblem } func NewBinaryDiagnostic() Problem { return &binaryDiagnostic{ dailyProblem{ day: 3, }, } } func (b *binaryDiagnostic) Solve() interface{} { input := b.GetInputLines() var results []in...
internal/advent/day3.go
0.761538
0.681369
day3.go
starcoder
package types import ( "io" "github.com/lyraproj/pcore/px" ) type TypeType struct { typ px.Type } var typeTypeDefault = &TypeType{typ: anyTypeDefault} var TypeMetaType px.ObjectType func init() { TypeMetaType = newObjectType(`Pcore::TypeType`, `Pcore::AnyType { attributes => { type => { type => Option...
types/typetype.go
0.60743
0.53868
typetype.go
starcoder
package crdt import ( "fmt" "github.com/cloudstateio/go-support/cloudstate/entity" ) // A Vote is a CRDT which allows nodes to vote on a condition. It’s similar // to a GCounter, each node has its own counter, and an odd value is considered // a vote for the condition, while an even value is considered a vote aga...
cloudstate/crdt/vote.go
0.60964
0.401512
vote.go
starcoder
package series import "github.com/WinPooh32/math" type Data struct { samplesize int64 index []int64 data []float32 } func (d Data) Index() (data []int64) { return d.index } func (d Data) Data() (data []float32) { return d.data } func (d Data) Len() int { return len(d.index) } func (d Data) Sample...
data.go
0.654564
0.669509
data.go
starcoder
package mimir import ( "strconv" "strings" ) const ( abaExpectedLength = 9 abaStructure = "ffffaaaak" ) // IsABARTNValid checks if the given ABA Routing Number is valid. func IsABARTNValid(aba string) error { aba = standardizeABARTN(aba) if len(aba) != abaExpectedLength { return ErrABARTNInvalidLength ...
aba.go
0.712632
0.46035
aba.go
starcoder
package arts import ( "fmt" "math" "math/rand" "github.com/andrewwatson/generativeart" "github.com/andrewwatson/generativeart/common" "github.com/fogleman/gg" ) type circleLoop2 struct { depth int noise *common.PerlinNoise } func NewCircleLoop2(depth int) *circleLoop2 { return &circleLoop2{ depth: depth,...
arts/circleloop2.go
0.605449
0.410343
circleloop2.go
starcoder
package image import ( "bytes" "context" "errors" "fmt" "image" "image/color" "image/png" "io/ioutil" "math" "github.com/airbusgeo/geocube/internal/geocube" "github.com/airbusgeo/geocube/internal/utils" "github.com/airbusgeo/geocube/internal/utils/affine" "github.com/airbusgeo/godal" "github.com/google/...
internal/image/image.go
0.650911
0.469095
image.go
starcoder
package solver import ( "fmt" "sort" "strings" ) // Bit alignment divisor. const boardAlignment = 64 // allSet has is an int64 with all bits set. Used to skip over full board cells. const allSet = ^uint64(0) // Board is an array of uint64's, meant to be interpreted as a single long bitfield. // Unfortunately Go ...
solver/board.go
0.800497
0.414129
board.go
starcoder
package queue /** FanOutQueue structure +---------------------------------------------------------+ | Tail FanOutQueue Head | | | | | | +-----------+ +-----------+ ...
pkg/queue/doc.go
0.501465
0.532607
doc.go
starcoder
package pcapng /* 4.3.1. Enhanced Packet Block Flags Word The Enhanced Packet Block Flags Word is a 32-bit value that contains link-layer information about the packet. The word is encoded as an unsigned 32-bit integer, using the endianness of the Section Header Block scope it is in. In the following...
pcapng/enhanced_packet_block_flags.go
0.652463
0.585309
enhanced_packet_block_flags.go
starcoder
package iso20022 // Details of the statement reporting the bank services billing. type BillingStatement1 struct { // Identification of the customer billing statement. StatementIdentification *Max35Text `xml:"StmtId"` // Date range between the start date and the end date for which the statement is issued. FromToD...
BillingStatement1.go
0.78838
0.509276
BillingStatement1.go
starcoder
package labels import ( "encoding/json" "fmt" "testing" "github.com/ingrammicro/cio/api/types" "github.com/ingrammicro/cio/utils" "github.com/stretchr/testify/assert" ) // ListLabelsMocked test mocked function func ListLabelsMocked(t *testing.T, labelsIn []*types.Label) []*types.Label { assert := assert.New...
api/labels/labels_api_mocked.go
0.721841
0.559711
labels_api_mocked.go
starcoder
package main import ( "sort" ) type dungeonPath struct { dungeon *dungeon neighbors [8]position wcost int } func (dp *dungeonPath) Neighbors(pos position) []position { nb := dp.neighbors[:0] return pos.CardinalNeighbors(nb, func(npos position) bool { return npos.valid() }) } func (dp *dungeonPath) Cost(...
path.go
0.624866
0.565299
path.go
starcoder
package cxcore import ( "github.com/skycoin/skycoin/src/cipher/encoder" ) //Why do these functions need CXArgument as imput!? func ReadData(fp int, inp *CXArgument, dataType int) interface{} { elt := GetAssignmentElement(inp) if elt.IsSlice { return ReadSlice(fp, inp, dataType) } else if elt.IsArray { return...
cx/fix_read3.go
0.526343
0.490968
fix_read3.go
starcoder
package indicators import ( "container/list" "errors" "github.com/thetruetrade/gotrade" ) // A Weighted Moving Average Indicator (Wma), no storage, for use in other indicators type WmaWithoutStorage struct { *baseIndicatorWithFloatBounds // private variables periodTotal float64 periodHistory *list.L...
indicators/wma.go
0.660939
0.406126
wma.go
starcoder
package sql import ( "bytes" "context" "fmt" "github.com/cockroachdb/cockroach/pkg/sql/sem/tree" "github.com/cockroachdb/cockroach/pkg/sql/sem/types" "github.com/cockroachdb/cockroach/pkg/sql/sqlbase" "github.com/cockroachdb/cockroach/pkg/util/treeprinter" ) // explainPlanNode wraps the logic for EXPLAIN as ...
pkg/sql/explain_plan.go
0.721939
0.425187
explain_plan.go
starcoder
package influxql import ( "fmt" "github.com/influxdata/flux/ast" "github.com/influxdata/influxql" ) type joinCursor struct { expr ast.Expression m map[influxql.Expr]string exprs []influxql.Expr } func Join(t *transpilerState, cursors []cursor, on []string) cursor { if len(cursors) == 1 { return cursor...
query/influxql/join.go
0.5144
0.420421
join.go
starcoder
package as import ( "github.com/meowpub/meow/ld" ) // Specifies the accuracy around the point established by the longitude and latitude func GetAccuracy(e ld.Entity) interface{} { return e.Get(Prop_Accuracy.ID) } func SetAccuracy(e ld.Entity, v interface{}) { e.Set(Prop_Accuracy.ID, v) } // Subproperty of as:attri...
ld/ns/as/properties.gen.go
0.83602
0.53443
properties.gen.go
starcoder
package game import "fmt" /* 8 7 6 5 4 3 2 1 0 +--------------------------------------------+ | wL | wN | wS | wG | wK | wG | wS | wN | wL | a +--------------------------------------------+ | | wR | | | | | | wB | | b +--------------------------------------------+ | w...
pkg/game/board.go
0.608361
0.430147
board.go
starcoder
package core import ( "encoding/gob" "encoding/json" "io" ) // TODO: Store values at certain tick intervals and calculate values for a period. // MovingAverage contains logic related to a moving average. type MovingAverage struct { EMAs []float64 Period int Signal int SMAs []float64 Values []float64 } /...
core/ma.go
0.653348
0.529811
ma.go
starcoder
package sgd import ( "github.com/nlpodyssey/spago/gd" "github.com/nlpodyssey/spago/mat" "github.com/nlpodyssey/spago/nn" ) var _ gd.MethodConfig = &Config[float32]{} // Config provides configuration settings for an SGD optimizer. type Config[T mat.DType] struct { gd.MethodConfig LR T Mu T Nestero...
gd/sgd/sgd.go
0.735071
0.444746
sgd.go
starcoder
package gohex import ( "bufio" "encoding/hex" "io" "sort" ) // Constants definitions of IntelHex record types const ( _DATA_RECORD byte = 0 // Record with data bytes _EOF_RECORD byte = 1 // Record with end of file indicator _ADR_20_RECORD byte = 2 // Record with extended 20-bit linear address _ADR_...
gohex.go
0.570451
0.503601
gohex.go
starcoder