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 query // GoColumnType represents the GO type that corresponds to a database column type GoColumnType int const ( ColTypeUnknown GoColumnType = iota ColTypeBytes ColTypeString ColTypeInteger ColTypeUnsigned ColTypeInteger64 ColTypeUnsigned64 ColTypeDateTime ColTypeFloat ColTypeDouble ColTypeBool ) ...
pkg/orm/query/goColumnType.go
0.806967
0.510435
goColumnType.go
starcoder
package visitorgen // simplified ast - when reading the golang ast of the ast.go file, we translate the golang ast objects // to this much simpler format, that contains only the necessary information and no more type ( // SourceFile contains all important lines from an ast.go file SourceFile struct { lines []Sast ...
go/vt/sqlparser/visitorgen/sast.go
0.669529
0.560192
sast.go
starcoder
package migration import ( "database/sql" "fmt" "magma/orc8r/cloud/go/sqorc" "github.com/pkg/errors" ) func DropNewTables(tx *sql.Tx) error { tablesToDrop := []string{ NetworksTable, NetworkConfigTable, EntityTable, EntityAssocTable, EntityAclTable, deviceServiceTable, StateServiceTable, } for...
orc8r/cloud/go/tools/migrations/m003_configurator/migration/migration_tables.go
0.516595
0.583797
migration_tables.go
starcoder
package swagger const ( Collection = `{ "swagger": "2.0", "info": { "title": "collection.proto", "version": "version not set" }, "schemes": [ "http", "https" ], "consumes": [ "application/json" ], "produces": [ "application/json" ], "paths": { "/exp/collection": { ...
api/exp/swagger/swagger.pb.go
0.692746
0.401981
swagger.pb.go
starcoder
package geom import "math" // A Vec3 represents a vector with coordinates X, Y and Z in 3-dimensional // euclidean space. type Vec3 struct { X, Y, Z float32 } var ( // V3Zero is the zero vector (0,0,0). V3Zero = Vec3{0, 0, 0} // V3Unit is the unit vector (1,1,1). V3Unit = Vec3{1, 1, 1} // V3UnitX is the x-axi...
vec3.go
0.911805
0.683697
vec3.go
starcoder
package collections import ( "fmt" "reflect" ) // Append appends from to a slice to and returns the resulting slice. // If length of from is one and the only element is a slice of same type as to, // it will be appended. func Append(to interface{}, from ...interface{}) (interface{}, error) { tov, toIsNil := indir...
common/collections/append.go
0.563618
0.449272
append.go
starcoder
package gridspech import "strings" // TileCoordSet represents a mathematical set of coordinates. type TileCoordSet struct { set map[TileCoord]struct{} } // NewTileCoordSet returns a TileCoordSet containing only tiles. func NewTileCoordSet(tiles ...TileCoord) TileCoordSet { var cs TileCoordSet for _, tile := range...
tileCoordSet.go
0.827166
0.445952
tileCoordSet.go
starcoder
package levenshtein /// Computes the Damerau-Levenshtein Distance between two strings, represented as arrays of /// integers, where each integer represents the code point of a character in the source string. /// Includes an optional threshhold which can be used to indicate the maximum allowable distance. /// <param na...
algorithm/levenshtein/levenshtein_damerau.go
0.883751
0.634925
levenshtein_damerau.go
starcoder
package main // # Bulk Process Manager // **BPM is a Process manager for [nodejs](http://nodejs.org) projects** // **Author: [<NAME>](http://eladyarkoni.com)** // <div style="text-align: center;"> // <img src="https://nodejs.org/static/images/logos/nodejs-new-pantone-black.png" height="100"> // <img src="ht...
doc.go
0.647575
0.407569
doc.go
starcoder
package linear import ( "errors" "fmt" "github.com/bayesiangopher/bayesiangopher/core" "gonum.org/v1/gonum/mat" "log" "math" ) var ( SVDDecompositionError = errors.New("ошибка во время SVD разложения") SVDResultComputeError = errors.New("вектор b посчитан неправильно") CoefBeforeFittingError = errors.New("об...
supervisedlearning/regressions/linear/linear.go
0.61057
0.448668
linear.go
starcoder
package data import "math" // ---------------------------------------------------------------------------- // (X,Y), (U,V) // XYUVer wraps the Len and XYUV methods. type XYUVer interface { // Len returns the number of x, y, u, v quadruples. Len() int // XYUV returns an x, y, u, v quadruple. XYUV(int) (x, y, u, ...
data/data.go
0.806281
0.487795
data.go
starcoder
package game // Universe contains the current generation of a universe, as well as other // important information about it. type Universe struct { current, alternate [][]int topLeft [2]int generation int } // NewUniverse creates a new universe and populates it, using the specified slice. func Ne...
Conways-Game/src/game/game.go
0.781914
0.535159
game.go
starcoder
package imaging import ( "image" "image/color" "math" ) func affineTransform(x, y float64, data []float64) (xout, yout float64) { a := data[:] a0 := a[0] a1 := a[1] a2 := a[2] a3 := a[3] a4 := a[4] a5 := a[5] xin := float64(x) + 0.5 yin := float64(y) + 0.5 xout = a0*xin + a1*yin + a2 yout = a3*xin + a...
geometry.go
0.649023
0.558748
geometry.go
starcoder
package main import ( "flag" "fmt" "os" ) var usage = `Usage: ep [OPTIONS...] COMMAND [COMMAND-OPTS...] ABOUT "ep" is a simple command line utility to distribute parallel work to a set of worker subprocesses. "ep" can be used as prefix of another command that reads lines from standard input, for example a list ...
cmd/ep/doc.go
0.583203
0.409073
doc.go
starcoder
package msgraph // RatingGermanyMoviesType undocumented type RatingGermanyMoviesType int const ( // RatingGermanyMoviesTypeVAllAllowed undocumented RatingGermanyMoviesTypeVAllAllowed RatingGermanyMoviesType = 0 // RatingGermanyMoviesTypeVAllBlocked undocumented RatingGermanyMoviesTypeVAllBlocked RatingGermanyMov...
v1.0/RatingGermanyMoviesTypeEnum.go
0.585338
0.600511
RatingGermanyMoviesTypeEnum.go
starcoder
package main import "fmt" // GraphNode is a single node in a graph list type GraphNode struct { name string value float64 } // Edge represents an edge between two vertices type Edge struct { src string dest string value float64 } // graph is a data structure which will be holding a graph type graph map[str...
algorithms/graphs/kruskals/graph.go
0.583559
0.52616
graph.go
starcoder
package metrics import "sync" // Observer is an interface that generalizes a group of metrics // that are receiving a set of numeric values in time type Observer interface { Observe(float64) } // HistogramBucketOptions an options to fine-tune histogram buckets type HistogramBucketOptions struct { Type string B...
metrics/observer.go
0.696268
0.411288
observer.go
starcoder
package hole import ( "math/rand" "strings" ) var ( notes = [...][2]string{ {"C", "B♯"}, {"C♯", "D♭"}, {"D", "D"}, {"D♯", "E♭"}, {"E", "F♭"}, {"F", "E♯"}, {"F♯", "G♭"}, {"G", "G"}, {"G♯", "A♭"}, {"A", "A"}, {"A♯", "B♭"}, {"B", "C♭"}, } triadTypes = [...]string{ "°", "m", "", "+", } tr...
hole/musical-chords.go
0.517083
0.453322
musical-chords.go
starcoder
package cluster import ( "context" "fmt" "github.com/elastic/terraform-provider-elasticstack/internal/clients" "github.com/elastic/terraform-provider-elasticstack/internal/utils" "github.com/hashicorp/terraform-plugin-sdk/v2/diag" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" ) func DataSourceSn...
internal/elasticsearch/cluster/snapshot_repository_data_source.go
0.68784
0.453988
snapshot_repository_data_source.go
starcoder
package main import ( "math/bits" ) type Processor struct { reg [4]uint8 // A, X, Y, Z flag [4]bool // zero, negative, carry, overflow ptr uint ram *Memory stack *Stack } // read and execute one instruction from the memory func (cpu Processor) Cycle () { // read the byte at t...
processor.go
0.560012
0.446193
processor.go
starcoder
package validator import ( "bytes" "fmt" "reflect" "sort" "strconv" "strings" "sync" "unicode/utf8" ) const tagName string = "valid" // Validator contruct type Validator struct { Translator *Translator Attributes map[string]string CustomMessage map[string]string } var loadValidatorOnce *Validator v...
validator.go
0.728265
0.476458
validator.go
starcoder
package clustering import ( "errors" "math" "reflect" "log" "fmt" ) type Coordinate interface { GetValue()interface{} SetValue(interface{})(error) PoweredDistanceTo(Coordinate,float64)(float64) GetAbsoluteDistanceTo(Coordinate)(float64) AddValue(interface{})() NormalizeValue(float64)() GetZeroValue()(inte...
auxiliary/clustering/coordinate.go
0.549157
0.407746
coordinate.go
starcoder
package iso20022 // Chain of parties involved in the settlement of a transaction, including receipts and deliveries, book transfers, treasury deals, or other activities, resulting in the movement of a security or amount of money from one account to another. type SettlementParties2 struct { // First party in the sett...
SettlementParties2.go
0.679604
0.498047
SettlementParties2.go
starcoder
package generalized_suffix_tree import "strings" type Tree struct { Root *Node } type Node struct { Start int Children map[string]*Node } const Terminators = "0123456789" // Can be any characters in any order. // Construction func NewGST(a ...string) *Tree { root := &Node{ -1, map[string]*Node{}, } f...
generalized_suffix_tree/go/generalized_suffix_tree.go
0.501465
0.424293
generalized_suffix_tree.go
starcoder
package server import ( "fmt" "sync" ) type neighborManager struct { neighbors []*neighbor neighborsMu sync.Mutex } func newNeighborManager() *neighborManager { return &neighborManager{ neighbors: make([]*neighbor, 0), } } func (nm *neighborManager) addNeighbor(n *neighbor) error { nm.neighborsMu.Lock() ...
protocols/bgp/server/bmp_neighbor_manager.go
0.585575
0.437223
bmp_neighbor_manager.go
starcoder
package main const ( helpConnect = `Connects to a beanstalk server. With no arguments, will try to connect to the 127.0.0.1:11300. Can also provide host and port arguments. To connect to a beanstalk server on <HOST> using port 11300: connect <HOST> To connect to a beanstalk server on <HOST> using port <PORT>: ...
help.go
0.704364
0.40869
help.go
starcoder
package mu import ( "math" ) // ODEs func RungeKutta(dy func(float64, float64) float64, tf float64, t float64, y float64, h float64) float64 { if tf <= t { return y } rk := []float64{h*dy(t, y)} for i := 1 ; i < 3 ; i++ { rk = append(rk, h*dy(t + h/2, y +...
analysis.go
0.781289
0.582164
analysis.go
starcoder
package compute import ( "log" "math" "sort" "sync" "time" "github.com/gbl08ma/sqalx" "github.com/underlx/disturbancesmlx/types" ) var rootSqalxNode sqalx.Node var mainLog *log.Logger // Initialize initializes the package func Initialize(snode sqalx.Node, log *log.Logger) { rootSqalxNode = snode mainLog = ...
compute/compute.go
0.572125
0.406214
compute.go
starcoder
// Package planner contains a query planner for Rego queries. package planner import ( "fmt" "github.com/open-policy-agent/opa/ast" "github.com/open-policy-agent/opa/internal/ir" ) type planiter func() error type binaryiter func(ir.Local, ir.Local) error // Planner implements a query planner for Rego queries. t...
vendor/github.com/open-policy-agent/opa/internal/planner/planner.go
0.63341
0.482124
planner.go
starcoder
Mac Cheese Grater Plate http://saccade.com/blog/2019/06/how-to-make-apples-mac-pro-holes/ */ //----------------------------------------------------------------------------- package main import ( "log" "math" "github.com/deadsy/sdfx/render" "github.com/deadsy/sdfx/sdf" ) //-------------------------------------...
examples/mcg/main.go
0.728845
0.487002
main.go
starcoder
package aoc2020 /* --- Day 25: Combo Breaker --- You finally reach the check-in desk. Unfortunately, their registration systems are currently offline, and they cannot check you in. Noticing the look on your face, they quickly add that tech support is already on the way! They even created all the room keys this morning...
app/aoc2020/aoc2020_25.go
0.582491
0.652338
aoc2020_25.go
starcoder
package constants import "strings" var Countries = strings.TrimPrefix(` /** Country represents a world country. */ export class Country { // The country's emoji flag. flag: string; // The country's name. name: string; // Two-letter country code (ISO 3166-1 alpha-2). code: string; // The country's abbrev...
src/gen/typescript/constants/countries.go
0.574753
0.513912
countries.go
starcoder
package bit // Note the use of << to create an untyped constant. const bitsPerWord = 32 << uint(^uint(0)>>63) // Implementation-specific size of int and uint in bits. const BitsPerWord = bitsPerWord // either 32 or 64 // Implementation-specific integer limit values. const ( MaxInt = 1<<(BitsPerWord-1) - 1 // eith...
vendor/github.com/andybalholm/go-bit/funcs.go
0.752286
0.526038
funcs.go
starcoder
package parser import ( "time" ) // Parser handles the parsing from time.Time to various language formats. type Parser interface { // ParseTime parses the time. ParseTime(time.Time) // Digit day of month Day() uint8 // Digit day of month with leading 0 if there's only one digit. PaddedDay() string // Digit mo...
parser/parser.go
0.731059
0.521898
parser.go
starcoder
package main const usage = ` Usage: ./pginsight <cmdname> [--flags] Commands: index usage Shows which indexes are being scanned and how many tuples are fetched index unused Shows the indexes which haven't been scanned index duplicate Finds indexes which index on the same key(s) ...
help.go
0.773045
0.615767
help.go
starcoder
package metrics import ( "time" kitmetrics "github.com/go-kit/kit/metrics" ) // defaultTimingUnit is the resolution we'll use for all duration measurements. const defaultTimingUnit = time.Millisecond // DurationTimer acts as a stopwatch, sending observations to a wrapped histogram. // It's a bit of helpful syntax...
go-kit/metrics/timer.go
0.8119
0.466846
timer.go
starcoder
package geomfn import ( "math" "github.com/cockroachdb/cockroach/pkg/geo" "github.com/cockroachdb/errors" "github.com/twpayne/go-geom" ) // SnapToGrid snaps all coordinates in the Geometry to the given grid size, // offset by the given origin. It will remove duplicate points from the results. // If the resultin...
pkg/geo/geomfn/snap_to_grid.go
0.75037
0.434101
snap_to_grid.go
starcoder
package editor import ( "fmt" "github.com/elpinal/coco3/editor/register" "github.com/elpinal/coco3/screen" ) type nvCommon struct { streamSet *editor count int } type normal struct { nvCommon regName rune } func newNormalWithRegister(s streamSet, e *editor, regName rune) *normal { return &normal{ nvCo...
editor/normal.go
0.521959
0.419291
normal.go
starcoder
package path_sum import ( "bytes" "sort" "strconv" ) /* 112. 路径总和 https://leetcode-cn.com/problems/path-sum 给定一个二叉树和一个目标和,判断该树中是否存在根结点到叶子结点的路径,这条路径上所有结点值相加等于目标和。 说明: 叶子结点是指没有子结点的结点。 示例: 给定如下二叉树,以及目标和 sum = 22, 5 / \ 4 8 / / \ 11 13 4 / ...
solutions/path-sum/d.go
0.52975
0.463505
d.go
starcoder
package sqlbuilder import ( "strings" ) // Update returns a new UPDATE statement with the default dialect. func Update() UpdateStatement { return UpdateStatement{dialect: DefaultDialect} } type updateSet struct { col string arg interface{} raw bool } // UpdateStatement represents an UPDATE statement. type Upda...
vendor/github.com/thcyron/sqlbuilder/update.go
0.666497
0.418103
update.go
starcoder
package main import ( "strconv" "strings" ) //point Typedef for an x,y pair type point struct { x uint16 y uint16 } // ParsePipeMap parses a string representation of a map of pipes // Accepts diagonal lines on a 45 degree angle if allowDiagonal is set // Returns a map of points and the times they overlap. func P...
day5.go
0.656438
0.520131
day5.go
starcoder
package pricing import ( "fmt" "github.com/transcom/mymove/pkg/models" ) //same values used in each parse and verify function const feeColIndexStart int = 6 // start at column 6 to get the rates const feeRowIndexStart int = 10 // start at row 10 to get the rates const originPriceAreaIDColumn int = 2 const originP...
pkg/parser/pricing/parse_international_prices.go
0.556641
0.592608
parse_international_prices.go
starcoder
package types import ( "encoding/json" "fmt" "math/big" "strings" "github.com/thetatoken/theta/common" ) var ( Zero *big.Int Hundred *big.Int ) func init() { Zero = big.NewInt(0) Hundred = big.NewInt(100) } type Coins struct { ThetaWei *big.Int TFuelWei *big.Int } type CoinsJSON struct { ThetaWei *...
VM/ledger/types/coin.go
0.693992
0.485661
coin.go
starcoder
package models import ( i336074805fc853987abe6f7fe3ad97a6a6f3077a16391fec744f671a015fbd7e "time" i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91 "github.com/microsoft/kiota-abstractions-go/serialization" ) // SynchronizationTaskExecution type SynchronizationTaskExecution struct { // Ide...
models/synchronization_task_execution.go
0.701713
0.424114
synchronization_task_execution.go
starcoder
package main import ( "fmt" "strings" "github.com/theatlasroom/advent-of-code/go/utils" ) /** --- Day 6: Custom Customs --- As your flight approaches the regional airport where you'll switch to a much larger plane, customs declaration forms are distributed to the passengers. The form asks a series of 26 yes-or-...
go/2020/6.go
0.665628
0.529263
6.go
starcoder
package configs import ( "errors" "fmt" "math/big" "os" "reflect" "strconv" "strings" ) // MustLoadWithPrefix loads the environment variables into a struct. // It panics if any of the environment variables' values can't be // coerced into the type defined on the struct. func MustLoadWithPrefix(container interf...
load.go
0.605916
0.520984
load.go
starcoder
package main import ( "math/rand" . "github.com/jakecoffman/cp" "github.com/jakecoffman/cp/examples" ) const ( bevel = 1 ) func randUnitCircle() Vector { v := Vector{rand.Float64()*2.0 - 1.0, rand.Float64()*2.0 - 1.0} if v.LengthSq() < 1.0 { return v } return randUnitCircle() } var simpleTerrainVerts = [...
examples/bench/bench.go
0.633864
0.579817
bench.go
starcoder
package synthesizer // EqualTemperedNote type EqualTemperedNote float64 // These constants represent the frequncies for the equal-tempered scale tuned to A4 = 440Hz const ( C0 EqualTemperedNote = 16.35 C0S EqualTemperedNote = 17.32 D0 EqualTemperedNote = 18.35 D0S EqualTemperedNote = 19.45 E0 EqualTemperedNot...
synthesizer/constants.go
0.665302
0.832169
constants.go
starcoder
package task import ( "github.com/twinj/uuid" "time" ) /* Task represents a task or a subtask. Tasks can be stand-alone todo items or they can be broken down into subtasks, which can then have their own subtasks, and so on. Subtasks have parents which they can be grouped into. Tasks can have multiple parents to cov...
task/task.go
0.508788
0.421909
task.go
starcoder
package tmux import ( "bytes" "fmt" "io" "strings" "github.com/arl/gitstatus" ) const truncateSymbol string = "..." // Config is the configuration of the Git status tmux formatter. type Config struct { // Symbols contains the symbols printed before the Git status components. Symbols symbols // Styles contai...
tmux/formater.go
0.608827
0.406509
formater.go
starcoder
package anvil import ( "errors" "fmt" "reflect" "strconv" "strings" ) type ( // mode of (non-)skipping empty values mode int // Anvil executor structure Anvil struct { //Mode behavior for skipping empty values Mode mode //Glue string to glue fields Glue string // modifier it's a list of functions ...
anvil.go
0.520984
0.476519
anvil.go
starcoder
package model import ( "math" "strconv" "time" "github.com/prometheus/common/model" "github.com/timescale/promscale/pkg/prompb" ) type SamplesInfo struct { Labels *Labels SeriesID SeriesID Samples []prompb.Sample } // SeriesID represents a globally unique id for the series. This should be equivalent // ...
pkg/pgmodel/model/samples.go
0.859693
0.44083
samples.go
starcoder
package bow import ( "fmt" "sort" ) // InnerJoin joins columns of two Bows on common columns and rows. // The Metadata of the two Bows are also joined by appending keys and values. func (b *bow) InnerJoin(other Bow) Bow { left := b right, ok := other.(*bow) if !ok { panic("bow.InnerJoin: non bow object passed ...
bowjoin.go
0.704465
0.527317
bowjoin.go
starcoder
package kpath import ( "errors" "strings" ) type kpath struct { Part string // current key part Path string // remaining path More bool // there is more path to parse } // Split parses a kpath string into an array of parts. // Kpath parts are delimited either by a period (ex: partA.partB) or brackets and quo...
pkg/kpath/kpath.go
0.561696
0.439687
kpath.go
starcoder
package stl import ( "io" "unsafe" ) func Sizeof[T any]() int { var v T return int(unsafe.Sizeof(v)) } func SizeOfMany[T any](cnt int) int { var v T return int(unsafe.Sizeof(v)) * cnt } type Bytes struct { Data []byte Offset []uint32 Length []uint32 } type Vector[T any] interface { // Close free the ve...
pkg/vm/engine/tae/stl/types.go
0.635675
0.402245
types.go
starcoder
package shp import ( "encoding/binary" "fmt" "github.com/pkg/errors" ) // Polyline is an ordered set of verticies that consists of one or more parts, where a part is one or more Point. type Polyline struct { BoundingBox BoundingBox Parts []Part number uint32 } // Part is a sequence of Points. type Part...
shp/polyline.go
0.779867
0.69416
polyline.go
starcoder
package entity import ( "time" ) type CameraMap map[string]Camera func (m CameraMap) Get(name string) Camera { if result, ok := m[name]; ok { return result } return *NewCamera(name, "") } func (m CameraMap) Pointer(name string) *Camera { if result, ok := m[name]; ok { return &result } return NewCamera(...
internal/entity/camera_fixtures.go
0.712132
0.501953
camera_fixtures.go
starcoder
package shared import ( "fmt" "reflect" "strings" ) // Intertuple defines an interface for manipulating tuples. type Intertuple interface { Length() int GetFieldAt(i int) interface{} SetFieldAt(i int, val interface{}) } // Tuple contains a set of fields, where fields can be any primitive or type. // A tuple is...
shared/tuple.go
0.659624
0.486636
tuple.go
starcoder
package observer import ( "fmt" "math" "math/rand" "github.com/gonum/floats" ) const ( // RandSeed Индекс для генератора случайных чисел. RandSeed = 512 minHeatIndexTemperature = 27 ) // Интерфейс визуального элемента. type displayer interface { Display() string } // DisplayElement Интерфейс...
pkg/behavioral/observer/displays.go
0.591487
0.593197
displays.go
starcoder
package creational import "fmt" /* Summary: Factory pattern is used to create product's objects without specifying concrete types. NewProduct() method is used to create the concrete product instead of &Product{} Example: Parking lot service. This service has a persistent storage as a dependency and Factory pattern ...
creational/factory_method.go
0.728459
0.417271
factory_method.go
starcoder
package set import ( "reflect" "sort" ) type Set[Key comparable] map[Key]struct{} // Creates a new set that contains all the given keys. func New[Key comparable](keys ...Key) Set[Key] { if len(keys) == 0 { return make(Set[Key]) } resultset := make(Set[Key], len(keys)) for i := range keys { resultset[keys[i...
set/set.go
0.745676
0.490846
set.go
starcoder
package analysis import ( "fmt" "math" "strings" "github.com/AlessandroPomponio/go-gibberish/consts" "github.com/AlessandroPomponio/go-gibberish/structs" ) // AverageTransitionProbability returns the probability of // generating the input string digraph by digraph according // to the occurrences matrix. func Av...
analysis/analysis.go
0.778102
0.432183
analysis.go
starcoder
package stathat import ( "encoding/json" "net/http" "net/url" "strconv" "time" ) // GetOptions are passed into Get to provide optional values type GetOptions struct { Start *time.Time Period string Interval string Summary bool } // Dataset is a dataset type Dataset struct { Name string Timefram...
get.go
0.725551
0.439687
get.go
starcoder
package main import ( "github.com/go-gl/gl/v2.1/gl" ) var ( bulletMaxHP = 1 bulletMass = 0.5 bulletColSize = 20.0 bulletScale = vertex{x: 10, y: 10, z: 10} bulletModel polyModel ) // bullet is a small projectile shot by players or enemies. type bullet struct { uidGenerator loc vertex moveDir vertex ...
bullet.go
0.709422
0.40248
bullet.go
starcoder
package gpsabl import ( "math" "time" ) // Copyright 2019 by <EMAIL>. All // rights reserved. Use of this source code is governed // by a BSD-style license that can be found in the // LICENSE file. // CompareFloat64With4Digits - Compare two float64 to 4 digits after decimal func CompareFloat64With4Digits(in1, in2 ...
src/tobi.backfrak.de/internal/gpsabl/MathHelper.go
0.903417
0.486332
MathHelper.go
starcoder
package main import ( "fmt" "github.com/faiface/pixel" "github.com/faiface/pixel/pixelgl" "github.com/strangedev/vroom/algebra" "github.com/strangedev/vroom/gfx" "github.com/faiface/pixel/imdraw" "github.com/rs/xid" ) type SteeringIntent struct { SteerRadians float64 Acceleration float64 } type Car struct {...
car.go
0.644337
0.416322
car.go
starcoder
package sunspec import ( "errors" "regexp" ) // Model defines a instantiated sunspec model. type Model interface { // Group defines a sunspec container for points. Group // ID returns the models identifier as defined by the first point "ID". ID() Uint16 // Length returns the model length as defined by the seco...
model.go
0.789437
0.401424
model.go
starcoder
package unityai type Matrix4x4f struct { m_Data [16]float32 } func (this *Matrix4x4f) SetTR(pos Vector3f, q Quaternionf) { QuaternionToMatrix4(q, this) this.m_Data[12] = pos.x this.m_Data[13] = pos.y this.m_Data[14] = pos.z } func (this *Matrix4x4f) SetTRS(pos Vector3f, q Quaternionf, s Vector3f) { QuaternionT...
matrix.go
0.777638
0.612976
matrix.go
starcoder
package gcs import ( "io" ) type bitWriter struct { bytes []byte p *byte // Pointer to last byte next byte // Next bit to write or skip } // writeOne writes a one bit to the bit stream. func (b *bitWriter) writeOne() { if b.next == 0 { b.bytes = append(b.bytes, 1<<7) b.p = &b.bytes[len(b.bytes)-1] ...
gcs/bits.go
0.526343
0.483222
bits.go
starcoder
package parser import ( "errors" "strconv" ) type interpol struct { t float64 u float64 } func ParseDigitalIn(ch uint8, data []byte) uint8 { hex := parseHexDigit(32, data) * 16 + parseHexDigit(33, data) if (hex & (1 << ch)) > 0 { return 1 } return 0 } // Sensor type A func ParseADCSensorA(ch int, data []by...
raspberry/gopath/src/b00lduck/datalogger/serial/parser/parser.go
0.614394
0.505066
parser.go
starcoder
package flatbuffers import ( "math" ) type ( // A SOffsetT stores a signed offset into arbitrary data. SOffsetT int32 // A UOffsetT stores an unsigned offset into vector data. UOffsetT uint32 // A VOffsetT stores an unsigned offset in a vtable. VOffsetT uint16 ) const ( // VtableMetadataField...
vendor/github.com/elastic/beats/vendor/github.com/google/flatbuffers/go/encode.go
0.765944
0.420481
encode.go
starcoder
package leetcode import ( "container/heap" "math" "sort" ) /* You are given two integer arrays nums1 and nums2 sorted in ascending order and an integer k. Define a pair (u,v) which consists of one element from the first array and one element from the second array. Find the k pairs (u1,v1),(u2,v2) ...(uk,vk) with...
impl-go/k-pairs-with-smallest-sums.go
0.544075
0.864539
k-pairs-with-smallest-sums.go
starcoder
package main import ( "fmt" ) /* Given two non-empty linked lists representing two non-negative integers. The digits are stored in reverse order, and each of their nodes contains a single digit. Add the two numbers and return the sum as a linked list. Input: l1 = [2,4,3], l2 = [5,6,4] Output: [7,0,8] Explanation: ...
Graphs/AddTwoNumbers/main.go
0.612773
0.454835
main.go
starcoder
package samples func init() { sampleDataProposalCreateOperation[52] = `{ "expiration_time": "2016-10-09T10:19:01", "extensions": [], "fee": { "amount": 2326143, "asset_id": "1.3.0" }, "fee_paying_account": "1.2.111576", "proposed_ops": [ { "op": [ 6, { "accoun...
gen/samples/proposalcreateoperation_52.go
0.527317
0.448306
proposalcreateoperation_52.go
starcoder
package prayertime import ( "github.com/buildscientist/prayertime/julian" "github.com/buildscientist/prayertime/trig" "math" "strconv" "time" ) var methodParams = make(map[int][]float64) var PrayerTimeNames = []string{FAJR, SUNRISE, DHUHR, ASR, SUNSET, MAGHRIB, ISHA} var julianDate float64 var prayerTimesCurrent...
prayertime.go
0.615435
0.453746
prayertime.go
starcoder
package utils import ( "log" "math" "strconv" ) // NextIndex finds next valid index in given collection. // It prevents index out of bound by wrapping back to 0 func NextIndex(collection []string, index int) int { max := len(collection) - 1 if index >= max { return 0 } return index + 1 } // StringPrefixSum ...
utils/genericutils.go
0.715623
0.401394
genericutils.go
starcoder
package raycaster import ( "github.com/mattkimber/gorender/internal/geometry" "github.com/mattkimber/gorender/internal/voxelobject" "math" ) func castFpRay(object voxelobject.ProcessedVoxelObject, loc0 geometry.Vector3, loc geometry.Vector3, ray geometry.Vector3, limits geometry.Vector3, flipY bool) (result RayRes...
internal/raycaster/fp.go
0.898553
0.561395
fp.go
starcoder
package spec_util import ( "github.com/golang/glog" "github.com/golang/protobuf/proto" pb "github.com/akitasoftware/akita-ir/go/api_spec" ) // A "view" into RefMap that keeps track of the prefix MethodTemplates in order // to avoid returning references that are not useful. A reference is defined as // "unuseful" ...
spec_util/ref_map_view.go
0.661704
0.400046
ref_map_view.go
starcoder
package pdfcpu import "fmt" type dim struct { w, h int } // AspectRatio returns the relation between width and height. func (d dim) AspectRatio() float64 { return float64(d.w) / float64(d.h) } // Landscape returns true if d is in landscape mode. func (d dim) Landscape() bool { return d.AspectRatio() > 1 } // Po...
pkg/pdfcpu/paperSize.go
0.672009
0.478102
paperSize.go
starcoder
package avro import ( "errors" "fmt" "reflect" ) // Reader is an interface that may be implemented to avoid using runtime reflection during deserialization. // Implementing it is optional and may be used as an optimization. Falls back to using reflection if not implemented. type Reader interface { Read(dec Decode...
datum_reader.go
0.808332
0.444866
datum_reader.go
starcoder
package timeutil import ( "strings" "time" ) const ( // OneSecond is the number of millisecond for a second OneSecond int64 = 1000 // OneMinute is the number of millisecond for a minute OneMinute = 60 * OneSecond // OneHour is the number of millisecond for an hour OneHour = 60 * OneMinute // OneDay is the nu...
pkg/timeutil/time.go
0.540439
0.436022
time.go
starcoder
package goose4 import ( "encoding/json" "time" ) // Test provides a way of having an API pass it's own healthcheck tests, // https://github.com/beamly/SE4/blob/master/SE4.md#healthcheck) // into goose4 to be run for the `/healthcheck/` endpoints. These are run in parallel // and so tests which rely on one another/ ...
healthcheck.go
0.776453
0.497192
healthcheck.go
starcoder
package condition import ( "encoding/json" "github.com/Jeffail/benthos/v3/lib/log" "github.com/Jeffail/benthos/v3/lib/message" "github.com/Jeffail/benthos/v3/lib/metrics" "github.com/Jeffail/benthos/v3/lib/types" ) //------------------------------------------------------------------------------ func init() { ...
lib/condition/any.go
0.736116
0.630002
any.go
starcoder
package bs import "github.com/rannoch/cldr" var calendar = cldr.Calendar{ Formats: cldr.CalendarFormats{ Date: cldr.CalendarDateFormat{Full: "EEEE, dd. MMMM y.", Long: "dd. MMMM y.", Medium: "dd. MMM. y.", Short: "dd.MM.yy."}, Time: cldr.CalendarDateFormat{Full: "HH:mm:ss zzzz", Long: "HH:mm:ss z", Mediu...
resources/locales/bs/calendar.go
0.508544
0.431884
calendar.go
starcoder
// affine2d provides affine transformation for 2D graphics. // This code is comes from nanovgo and added gopher.js optimization. // https://github.com/shibukawa/nanovgo package affine2d import ( "github.com/rkusa/gm/math32" ) // Scala is a type of element of vector and matrix. // Scala is a float32 on regular envir...
affine2d.go
0.874573
0.867261
affine2d.go
starcoder
package blockchain import ( "time" "github.com/incognitochain/incognito-chain/common" "github.com/incognitochain/incognito-chain/incognitokey" "github.com/incognitochain/incognito-chain/metadata" ) type ShardToBeaconPool interface { RemoveBlock(map[byte]uint64) //GetFinalBlock() map[byte][]ShardToBeaconBlock ...
blockchain/interface.go
0.538498
0.441372
interface.go
starcoder
package v1beta1 import ( "context" "reflect" "github.com/pkg/errors" "github.com/pulumi/pulumi/sdk/v3/go/pulumi" ) // Creates a new Connectivity Test. After you create a test, the reachability analysis is performed as part of the long running operation, which completes when the analysis completes. If the endpoi...
sdk/go/google/networkmanagement/v1beta1/connectivityTest.go
0.811489
0.441914
connectivityTest.go
starcoder
package quantile import ( "math" "sort" "github.com/caio/go-tdigest" ) type algorithm interface { Add(value float64) error Quantile(q float64) float64 } func newTDigest(compression float64) (algorithm, error) { return tdigest.New(tdigest.Compression(compression)) } type exactAlgorithmR7 struct { xs []fl...
plugins/aggregators/quantile/algorithms.go
0.770292
0.482246
algorithms.go
starcoder
package model import ( "math" "time" "k8s.io/autoscaler/vertical-pod-autoscaler/recommender/util" ) // ContainerUsageSample is a measure of resource usage of a container over some // interval. type ContainerUsageSample struct { // Start of the measurement interval. MeasureStart time.Time // Average CPU usage i...
vertical-pod-autoscaler/recommender/model/container.go
0.586168
0.479808
container.go
starcoder
package math import ( "math" ) func R2D(r float32) float32 { return 180.0 * r / Pi } func D2R(r float32) float32 { return Pi * r / 180.0 } func Absf(v float32) float32 { if v < 0 { return -v } else { return v } } func Round(v float32) int { if v < 0 { return int(v - 0.5) } else { return int(v + 0....
Beam/go/vendor/github.com/google/gxui/math/math.go
0.827096
0.610628
math.go
starcoder
package graph import "math/rand" // NamedVertices contains example named vertices var NamedVertices = []string{"A", "B", "C", "D", "E", "F", "G", "H", "I", "J", "K", "L", "M"} // DAG returns a weighted (random costs) directed acyclic graph. func DAG() *Graph { g := New() rand.Seed(1) g.AddVertices(NamedVertices)...
struct/graph/adjacency/examplegraph.go
0.665519
0.499268
examplegraph.go
starcoder
package blackjack import "github.com/shopspring/decimal" // DoubleRule represents different double rule variants. type DoubleRule int // When is it possible for the player to double their hand? const ( DoubleAny DoubleRule = iota DoubleOnly9_10_11 DoubleOnly10_11 ) //go:generate stringer -type=DoubleRule // Sur...
blackjack/rules.go
0.586049
0.48749
rules.go
starcoder
package siesta import ( "errors" "fmt" "io" "net" "strconv" "strings" "sync" "time" ) // InvalidOffset is a constant that is used to denote an invalid or uninitialized offset. const InvalidOffset int64 = -1 // Connector is an interface that should provide ways to clearly interact with Kafka cluster and hide...
Godeps/_workspace/src/github.com/elodina/siesta/connector.go
0.742048
0.416144
connector.go
starcoder
package pvss import ( "math/big" "github.com/jinzhu/copier" "github.com/torusresearch/torus-common/common" "github.com/torusresearch/torus-common/secp256k1" pcmn "github.com/torusresearch/torus-node/common" ) // Mobile Proactive Secret Sharing // Generate random polynomial // Note: this does not have a y-inte...
pvss/pss.go
0.627038
0.513729
pss.go
starcoder
package enigma // ReflectorModel specifies the type of reflector (different Enigma models supported different reflectors) type ReflectorModel string // all supported reflector models const ( UkwK ReflectorModel = "K" UkwA ReflectorModel = "A" UkwB ReflectorModel = "B" UkwC ReflectorModel = "C" Uk...
reflector_definition.go
0.721645
0.446374
reflector_definition.go
starcoder
package day03 import ( "math" ) const ( BearEast = iota BearSouth BearWest BearNorth ) type Position struct { X, Y int } func (p *Position) Move(bearing, moves int) { switch bearing { case BearNorth: p.Y -= moves case BearEast: p.X += moves case BearSouth: p.Y += moves case BearWest: p.X -= moves...
2017/day03/day03.go
0.67971
0.447038
day03.go
starcoder
package semver const ( LessThan = iota - 1 Equal GreaterThan ) func (a *Version) LessThan(b *Version) bool { return LessThan == compare(a, b) } func (a *Version) GreaterThan(b *Version) bool { return GreaterThan == compare(a, b) } func (a *Version) LessThanOrEqual(b *Version) bool { comparison := compare(a, b...
compare.go
0.815637
0.432003
compare.go
starcoder
package types var SubtleCyphers []Cypher = []Cypher{ Cypher{Name: "Analeptic", Level: "1d6 + 2", Effect: ` Restores $(LEVEL) to the user’s Speed Pool.`}, Cypher{Name: "Best tool", Level: "1d6", Effect: ` Provides an additional asset for any one task using a tool, even if that means exceeding the normal limit of two...
types/SubtleCyphers.go
0.782621
0.560974
SubtleCyphers.go
starcoder
package main import ( "fmt" "math/rand" ) // Start by building a prototype that generates 10 random tickets and displays // them in a tabular format with a nice header...The table should have four columns: // * The spaceline company providing the service // * The duration in days for the trip to Mars (one-way) // *...
lesson05/ticket-to-mars.go
0.564819
0.487978
ticket-to-mars.go
starcoder
package arrays // StringContains function checks if a string element is present in a slice. // false is returned if the given slice is nil. func StringContains(slice []string, element string) bool { return StringIndexOf(slice, element) != -1 } // RuneContains function checks if a rune element is present in a slice. ...
arrays/contains.go
0.891037
0.516595
contains.go
starcoder