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 types // LanguageType provides a structure for storing inflections rules of a language. type LanguageType struct { Short string // The short hand form represention the language, ex. `en` (English). Pluralizations RulesType // Rules for pluralizing standard words. Singularizatio...
go/src/github.com/chuckpreslar/inflect/types/language.go
0.835282
0.596639
language.go
starcoder
package lmath import ( "fmt" "math" ) const ( mat4Dim = 4 ) var ( Mat4Identity = Mat4{[16]float64{ 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1}} ) type Mat4 struct { mat [16]float64 } // New Mat4 with the given values. // Row-Order. func NewMat4( m11, m12, m13, m14, m21, m22, m23, m24, m31, m32,...
lmath/mat4.go
0.778313
0.565659
mat4.go
starcoder
package cryptoapis import ( "encoding/json" ) // ListWalletTransactionsRIFungibleTokens struct for ListWalletTransactionsRIFungibleTokens type ListWalletTransactionsRIFungibleTokens struct { // Defines the amount of the fungible tokens. Amount string `json:"amount"` // Defines the tokens' converted amount value....
model_list_wallet_transactions_ri_fungible_tokens.go
0.827932
0.426859
model_list_wallet_transactions_ri_fungible_tokens.go
starcoder
package geogoth // Point Point structure type Point struct { Y float64 X float64 } // NewPoint Creates new Point object func NewPoint(y, x float64) Point { return Point{ Y: y, X: x, } } // Coordinates returns y,x of the Point // @ ToDo: Add pointers: func (p *Point) Coordinates() interface{} { func (p Point)...
point.go
0.801742
0.768451
point.go
starcoder
package sampler import ( "jensmcatanho/raytracer-go/math/geometry" "math" "math/rand" "time" ) func Regular(numSamples, numSets int, samples *[]geometry.Vector) { n := math.Sqrt(float64(numSamples)) for i := 0; i < numSets; i++ { for j := 0; j < int(n); j++ { for k := 0; k < int(n); k++ { x := (float6...
math/sampler/methods.go
0.632503
0.541045
methods.go
starcoder
package ansi256 import ( "fmt" "strings" "github.com/shyang107/pencil" ) // Print formats using the default formats for its operands and writes to // standard output. Spaces are added between operands when neither is a // string. It returns the number of bytes written and any write error // encountered. This is t...
ansi256/print.go
0.789802
0.466906
print.go
starcoder
package dcos import ( "context" "log" "github.com/dcos/client-go/dcos" "github.com/hashicorp/terraform/helper/schema" ) func dataSourceDcosJob() *schema.Resource { return &schema.Resource{ Read: dataSourceDcosJobRead, Schema: map[string]*schema.Schema{ "name": { Type: schema.TypeString, Re...
dcos/data_source_dcos_job.go
0.570212
0.413418
data_source_dcos_job.go
starcoder
package template import ( "bytes" "io" "regexp" "strings" "text/template" "github.com/golang/gddo/doc" "github.com/posener/goreadme/internal/markdown" ) // Execute is used to execute the README.md template. func Execute(w io.Writer, data interface{}) error { return main.Execute(&multiNewLineEliminator{w: w},...
internal/template/template.go
0.571288
0.5769
template.go
starcoder
package communication import ( "bytes" "errors" "fmt" "reflect" "strings" "github.com/mitchellh/mapstructure" "github.com/schoeppi5/libts" ) // UnmarshalResponse attempts to parse body to value // If value is a single struct, only the first element of body is unmarsheld // If value is a slice of structs, Unma...
communication/response.go
0.593138
0.446796
response.go
starcoder
package schedule import "time" // BetweenExpression is the struct used to create cron between expressions. type BetweenExpression struct { x int y int step int } // Between is an expression that generates integers between the provided parameters (*inclusive*). func Between(x int, y int) *BetweenExpression {...
between_expression.go
0.811377
0.727153
between_expression.go
starcoder
package utils import ( "fmt" "math" "github.com/campus-iot/geo-api/models" ) func isEqualLat(gw1, gw2 models.GatewayReceptionTdoa) bool { return gw1.AntennaLocation.Latitude == gw2.AntennaLocation.Latitude } func isEqualLong(gw1, gw2 models.GatewayReceptionTdoa) bool { return gw1.AntennaLocation.Longitude == g...
utils/triloc.go
0.703244
0.503845
triloc.go
starcoder
package main import ( "log" "strings" ) type DisplayData struct { digits []string result []string } func parseDigits(line string) []string { return strings.Split(line, " ") } func parseDisplayData(line string) DisplayData { inAndOut := strings.Split(line, " | ") return DisplayData{parseDigits(inAndOut[0]), p...
2021/8.go
0.550849
0.41947
8.go
starcoder
package walker import ( "reflect" "strconv" "unicode" ) // Visitor is a function that will be called on each visited node. // value is a non-map value, corresponding to the above path. // branch is a slice containing consecutive interfaces used to arrive at the given value. // path is a slice containing consecutiv...
walker.go
0.738198
0.449997
walker.go
starcoder
package client const walletAPIDoc = `"keybase wallet api" provides a JSON API to the Keybase wallet. EXAMPLES: List the balances in all your accounts: {"method": "balances"} See payment history in an account: {"method": "history", "params": {"options": {"account-id": "<KEY>"}}} Get details about a single t...
go/client/wallet_api_doc.go
0.652463
0.500427
wallet_api_doc.go
starcoder
package onshape import ( "encoding/json" ) // BTFSTable953 struct for BTFSTable953 type BTFSTable953 struct { BTTable1825 BtType *string `json:"btType,omitempty"` CrossHighlightData *BTTableBaseCrossHighlightData2609 `json:"crossHighlightData,omitempty"` } // NewBTFSTable953 instantiates a new BTFSTable953 objec...
onshape/model_btfs_table_953.go
0.694095
0.528533
model_btfs_table_953.go
starcoder
package main import ( "fmt" "math" "os" "strconv" "strings" ) /*Parse control characters: uppercase letter: absolute coordinates : 0 lowercase letter: relative coordinates : 1 not a control character: 2 */ func IsControlCharacter(controlCharacter string) (controlValue int) { switch { case controlCharacter == "...
xparser.go
0.619817
0.405566
xparser.go
starcoder
package asciistat import ( "fmt" "io" "math" "sort" ) var symbols = []struct { p float64 r rune }{ {0.50, 'M'}, {0.25, '['}, {0.75, ']'}, {0.98, '}'}, {0.99, '>'}, {0.90, '|'}, {0.95, ')'}, } // Percentil represents a percentil value. type Percentil struct { P float64 // Percentil in [0, 1] V float64 ...
internal/asciistat/plot.go
0.633637
0.499634
plot.go
starcoder
package sort // A simple circular buffer of fixed length which has an empty and full // state. When full, the buffer will not accept any new entries. // CircularBuffer is an array of elements that is fixed in size and thus // will stop receiving new elements once full. Removing elements makes // room for new ones. B...
sort/circularbuffer.go
0.818084
0.596492
circularbuffer.go
starcoder
package tbox import ( "math" ) func min(x, y float64) float64 { if x > y { return y } return x } func max(x, y float64) float64 { if x > y { return x } return y } // Tile ... type Tile struct { Z, X, Y int } // BoundingBox ... type BoundingBox struct { MinLng, MinLat, MaxLng, MaxLat float64 } // Bb...
tile.go
0.862757
0.596227
tile.go
starcoder
package rook import ( "fmt" ) type NRook struct { MaxRook int Combination []Board Board *Board UniqueMap map[string]int } //Board is the main struct of rook type Board struct { Cell map[Coordinate]CellState Properties } type Properties struct { Size Size } //Size is the rook size struct type Si...
rook/rook.go
0.552057
0.506958
rook.go
starcoder
package iterator import ( "sync/atomic" "github.com/apache/arrow/go/arrow" "github.com/apache/arrow/go/arrow/array" "github.com/go-bullseye/bullseye/internal/debug" ) // Int64ValueIterator is an iterator for reading an Arrow Column value by value. type Int64ValueIterator struct { refCount int64 chunkIter...
iterator/valueiterator.gen.go
0.750278
0.467453
valueiterator.gen.go
starcoder
package drawing import ( "fmt" "math" ) // PathBuilder describes the interface for path drawing. type PathBuilder interface { // LastPoint returns the current point of the current sub path LastPoint() (x, y float64) // MoveTo creates a new subpath that start at the specified point MoveTo(x, y float64) // LineT...
vendor/github.com/wcharczuk/go-chart/v2/drawing/path.go
0.745584
0.61144
path.go
starcoder
package sad import ( "encoding/binary" "fmt" "io" "io/ioutil" "github.com/jonathaningram/dark-omen/internal/audio" ) type Stream struct { LeftBlocks []audio.Block RightBlocks []audio.Block // Note: storing these so that a re-encoded stream is correct. sample 99 is // always a different value and index 99 ...
encoding/sad/sad.go
0.705785
0.462776
sad.go
starcoder
package registry import ( "fmt" "net/url" "sort" "strings" ) var supportedTypes = []string{"string", "int", "float", "bool", "bytes"} // QueryStringParams is a collection of query string parameter definitions // The Format of a Query string has the following format: // "key1=<field1:type1>&key2=<field2:type1>" /...
registry/querystring.go
0.716318
0.523359
querystring.go
starcoder
package marshalddb import ( "math" "reflect" "strconv" "github.com/aws/aws-sdk-go/aws" "github.com/aws/aws-sdk-go/service/dynamodb" ) // ConvertFromAttributes maps a DB returned map[string]*dynamodb.AttributeValue into a specified struct. func ConvertFromAttributes(item map[string]*dynamodb.AttributeValue, v in...
dynamo_converter.go
0.677794
0.404272
dynamo_converter.go
starcoder
package modeling import "reflect" type Port interface { GetName() string // returns the name of the Port. Length() int // returns the number of elements stored in the Port. IsEmpty() bool // returns true if the Port does not contain any element. Clear() ...
pkg/modeling/port.go
0.830353
0.531757
port.go
starcoder
package v1 import ( "encoding/json" ) // SpotPricesPerFacility struct for SpotPricesPerFacility type SpotPricesPerFacility struct { Baremetal2a *SpotPricesPerBaremetal `json:"baremetal_2a,omitempty"` Baremetal2a2 *SpotPricesPerBaremetal `json:"baremetal_2a2,omitempty"` Baremetal1 *SpotPricesPerBaremetal `json:"b...
v1/model_spot_prices_per_facility.go
0.708515
0.405037
model_spot_prices_per_facility.go
starcoder
package go_tfidf import ( "errors" "fmt" "math" "strings" ) // A TfIdf represents the set of variables that are used for computing the reference documents Tf and Idf values. type TfIdf struct { // DocumentSeparator is the string that is going to be used to split the documents terms. DocumentSeparator string //...
go_tfidf.go
0.676299
0.42668
go_tfidf.go
starcoder
package anneal import ( "math" "math/rand" ) // A State can undergo simulated annealing optimization. type State interface { // Energy returns the energy of a State. // This is the quantity to be minimized: States with small energy are better than States with large energy. Energy() float64 // Neighbor returns ...
anneal.go
0.800887
0.621713
anneal.go
starcoder
package environment // Environment represents a deployment/execution environment where tasks can be executed type Environment interface { // Name is the human name of the environment. Examples: kubernetes, ECS, local Name() string // Configure connects to the environment with optional parameters and returns an erro...
environment/environment.go
0.617859
0.454593
environment.go
starcoder
package lie import ( "math/big" "sort" "github.com/mjschust/lieprod/util" ) // An Algebra supplies representation-theoretic methods acting on Weights. type Algebra interface { RootSystem ReprDimension(Weight) *big.Int DominantChar(Weight) WeightPoly Tensor(...Weight) WeightPoly TensorProduct() PolyProduct F...
lie/algebra.go
0.746046
0.448668
algebra.go
starcoder
package random import ( "math/rand" ) // Shuffle pseudo-randomizes the order of parameters. // it can be of any type: string, integer, floats, slices, bool, etc. // It returns the shuffled slice of type []interface{}. func Shuffle(a ...interface{}) interface{} { rand.Shuffle(len(a), func(i, j int) { a[i], a[j] = ...
shuffle.go
0.698432
0.408395
shuffle.go
starcoder
package fastconvert // region Complex64 Converters // ReadByteArrayToComplex64 reads a 8 byte array to a complex64 func ReadByteArrayToComplex64(data []byte) complex64 { var r = ReadByteArrayToFloat32(data[:4]) var i = ReadByteArrayToFloat32(data[4:8]) return complex(r, i) } // ReadByteArrayToComplex64Array reads ...
complexconverters.go
0.694303
0.661199
complexconverters.go
starcoder
package chacha20 import "github.com/tang0th/go-chacha20/chacha" // XORKeyStream crypts bytes from in to out using the given key and nonce. It // performs the 20 round chacha cipher operation. In and out may be the same // slice but otherwise should not overlap. Nonce must be 8 bytes long. Key // must be either 10, 16...
chacha20.go
0.629319
0.463869
chacha20.go
starcoder
package slice import "fmt" // SliceBasic shows how to create a slice and how to set and get values in it. func SliceBasic() { // Don't add a number between the // `[]` brackets and we `make` slices if we // want to have a capacity and length slice := make([]string, 3) fmt.Println("empty:", slice) slice[0] = "|...
basics/completed/slice/slice.go
0.596198
0.616474
slice.go
starcoder
package box2d import ( "fmt" "math" ) const b2_minPulleyLength = 2.0 /// Pulley joint definition. This requires two ground anchors, /// two dynamic body anchor points, and a pulley ratio. type B2PulleyJointDef struct { B2JointDef /// The first ground anchor in world coordinates. This point never moves. GroundA...
DynamicsB2JointPulley.go
0.848941
0.776369
DynamicsB2JointPulley.go
starcoder
package iso20022 // Key elements used to refer the original transaction. type OriginalTransactionReference19 struct { // Amount of money to be moved between the debtor and creditor, before deduction of charges, expressed in the currency as ordered by the initiating party. Amount *AmountType3Choice `xml:"Amt,omitemp...
OriginalTransactionReference19.go
0.718496
0.409929
OriginalTransactionReference19.go
starcoder
package risk import ( "github.com/golang/glog" "gopkg.in/yaml.v2" "io/ioutil" "sort" ) type ScoreConfig struct { Name string `yaml:"name"` Title string `yaml:"title"` ShortDescription string `yaml:"shortDescription"` Desc...
server/src/risk/config.go
0.628293
0.415729
config.go
starcoder
package tree import ( "fmt" "strings" ) // BST interface includes basic functions for a binary search tree item type BST interface { Left() BST Right() BST Value() interface{} SetLeft(BST) SetRight(BST) SetValue(interface{}) Find(interface{}) BST Has(interface{}) bool } // BSTNode represents a binary searc...
ds/tree/tree.go
0.723505
0.451508
tree.go
starcoder
package ldp import ( "github.com/meowpub/meow/ld" ) // Links a resource with constraints that the server requires requests like creation and update to conform to. func GetConstrainedBy(e ld.Entity) interface{} { return e.Get(Prop_ConstrainedBy.ID) } func SetConstrainedBy(e ld.Entity, v interface{}) { e.Set(Prop_Con...
ld/ns/ldp/properties.gen.go
0.784855
0.441131
properties.gen.go
starcoder
package processor import ( "context" "time" "github.com/Jeffail/benthos/v3/internal/interop" "github.com/Jeffail/benthos/v3/lib/log" "github.com/Jeffail/benthos/v3/lib/metrics" "github.com/Jeffail/benthos/v3/lib/response" "github.com/Jeffail/benthos/v3/lib/types" ) func init() { Constructors[TypeResource] = ...
lib/processor/resource.go
0.767777
0.504516
resource.go
starcoder
package currency // CLDRVersion is the CLDR version from which the data is derived. const CLDRVersion = "40.0.0" type numberingSystem uint8 const ( numLatn numberingSystem = iota numArab numArabExt numBeng numDeva numMymr ) type currencyInfo struct { numericCode string digits uint8 } type symbolInfo ...
data.go
0.531696
0.418103
data.go
starcoder
package vector import ( "github.com/Quant-Team/qvm/pkg/circuit/gates" "gorgonia.org/tensor" ) type Vector struct { *tensor.Dense } type Scalar struct { *tensor.Dense } func (a *Vector) ProductVector(b Vector) Vector { if !a.Shape().IsVector() || !b.Shape().IsVector() { panic("should be vectors") } ar := a....
pkg/math/vector/vector.go
0.671255
0.548371
vector.go
starcoder
package graph import ( "math" "github.com/moorara/algo/compare" "github.com/moorara/algo/heap" "github.com/moorara/algo/list" ) const ( listNodeSize = 1024 float64Epsilon = 1e-9 ) // TraversalStrategy is the strategy for traversing vertices in a graph. type TraversalStrategy int const ( // DFS is recursiv...
graph/graph.go
0.860516
0.463809
graph.go
starcoder
package asm type Registers [6]int type Instruction struct { F Op Operands [3]int } func (i Instruction) Run(r *Registers) { *r = i.F(*r, i.Operands[0], i.Operands[1], i.Operands[2]) } type Op func(Registers, int, int, int) Registers func Addr(r Registers, operA, operB, targetReg int) Registers { result :...
2018/src/asm/ops.go
0.516352
0.67832
ops.go
starcoder
Common 2D shapes. */ //----------------------------------------------------------------------------- package sdf //----------------------------------------------------------------------------- // PanelParms defines the parameters for a 2D panel. type PanelParms struct { Size V2 CornerRadius float64 Hole...
sdf/shapes2.go
0.810028
0.47384
shapes2.go
starcoder
package processor import ( "fmt" "time" "github.com/Jeffail/benthos/v3/internal/docs" "github.com/Jeffail/benthos/v3/internal/interop" "github.com/Jeffail/benthos/v3/lib/log" "github.com/Jeffail/benthos/v3/lib/message" "github.com/Jeffail/benthos/v3/lib/metrics" "github.com/Jeffail/benthos/v3/lib/types" ) //...
lib/processor/try.go
0.667256
0.691874
try.go
starcoder
package kriging import ( "errors" "math" "sort" vec3d "github.com/flywave/go3d/float64/vec3" ) type Kriging struct { pos []vec3d.T nugget float64 rangex float64 sill float64 A float64 n int K []float64 M []float64 model KrigingModel } func New(pos []vec3d.T) *Kriging { return &Kriging{p...
kriging.go
0.54577
0.461199
kriging.go
starcoder
package transforms import ( "image" ) // Rgb2GrayFast function converts RGB to a gray scale array. func Rgb2GrayFast(colorImg image.Image, pixels *[]float64) { bounds := colorImg.Bounds() w, h := bounds.Max.X-bounds.Min.X, bounds.Max.Y-bounds.Min.Y if w != h && w != pHashSize { return } switch c := colorImg....
imagehash/transforms/pixels.go
0.846609
0.45847
pixels.go
starcoder
package search import ( "github.com/jtejido/golucene/core/index" . "github.com/jtejido/golucene/core/search/model" "github.com/jtejido/golucene/core/util" ) // search/Weight.java /* Expert: calculate query weights and build query scorers. The purpose of Weight is to ensure searching does not modify a Qurey, so t...
core/search/weights.go
0.798187
0.458227
weights.go
starcoder
package msgraph // RatingCanadaMoviesType undocumented type RatingCanadaMoviesType int const ( // RatingCanadaMoviesTypeVAllAllowed undocumented RatingCanadaMoviesTypeVAllAllowed RatingCanadaMoviesType = 0 // RatingCanadaMoviesTypeVAllBlocked undocumented RatingCanadaMoviesTypeVAllBlocked RatingCanadaMoviesType ...
v1.0/RatingCanadaMoviesTypeEnum.go
0.593845
0.509215
RatingCanadaMoviesTypeEnum.go
starcoder
package rapl import "math" //parsers for turning the raw MSR uint into a struct //Handle the MSR_[DOMAIN]_POWER_LIMIT MSR func parsePowerLimit(msr uint64, units RAPLPowerUnit, singleLimit bool) RAPLPowerLimit { var powerLimit RAPLPowerLimit powerLimit.Limit1.PowerLimit = float64(msr&0x7fff) * units.PowerUnits p...
rapl/parsers.go
0.803675
0.429848
parsers.go
starcoder
package cmd import "github.com/spf13/cobra" func AllGitSubCommands() []*cobra.Command { return []*cobra.Command{ {Use: "add", Short: "Add file contents to the index"}, {Use: "am", Short: "Apply a series of patches from a mailbox"}, {Use: "archive", Short: "Create an archive of files from a named tree"}, {Use...
cmd/git_sub_cmds.go
0.501709
0.472562
git_sub_cmds.go
starcoder
package collisions import ( "github.com/TrashPony/Veliri/src/mechanics/gameObjects/coordinate" "github.com/TrashPony/Veliri/src/mechanics/gameObjects/map" "github.com/TrashPony/Veliri/src/mechanics/gameObjects/obstacle_point" "github.com/TrashPony/Veliri/src/mechanics/globalGame/game_math" ) func FillMapZone(x, y...
src/mechanics/globalGame/collisions/fill_map_zone.go
0.510008
0.485234
fill_map_zone.go
starcoder
package p384 import ( "fmt" "math/big" ) // affinePoint represents an affine point of the curve. The point at // infinity is (0,0) leveraging that it is not an affine point. type affinePoint struct{ x, y fp384 } func newAffinePoint(x, y *big.Int) *affinePoint { var P affinePoint P.x.SetBigInt(x) P.y.SetBigInt(...
ecc/p384/point.go
0.771672
0.525491
point.go
starcoder
package gridt import ( runewidth "github.com/mattn/go-runewidth" ) const ( // LeftToRight is a direction in which the values will be written. // It goes from the first cell (0,0) to the end of the line, returning to the beginning of the second line. // Exactly the same as a typewritter. LeftToRight Direction = i...
grid.go
0.833596
0.740362
grid.go
starcoder
package plaid import ( "encoding/json" ) // Location A representation of where a transaction took place type Location struct { // The street address where the transaction occurred. Address NullableString `json:"address"` // The city where the transaction occurred. City NullableString `json:"city"` // The regio...
plaid/model_location.go
0.881977
0.451085
model_location.go
starcoder
package main import "strconv" import "strings" import "math" import "fmt" type Int struct { Value int } type Float struct { Value float64 } type Adder interface { Plus(a Data) Data } type Subtracter interface { Minus(a Data) Data } type Multiplyer interface { Multiply(a Data) Data } type Divider interface {...
arithmetic.go
0.745491
0.560493
arithmetic.go
starcoder
package types import ( "math" "math/rand" u "github.com/csixteen/simulated-evolution/pkg/utils" ) type Direction int32 const ( C Direction = 0 N Direction = 1 NE Direction = 2 E Direction = 3 SE Direction = 4 S Direction = 5 SW Direction = 6 W Direction = 7 NW Direction = 8 ) const reproducingEne...
pkg/types/animal.go
0.599016
0.458409
animal.go
starcoder
package ts import "fmt" // QueryTimespan describes the time range information for a query - the start // and end bounds of the query, along with the requested duration of individual // samples to be returned. Methods of this structure are mutating. type QueryTimespan struct { StartNanos int64 EndNanos ...
pkg/ts/timespan.go
0.850639
0.523664
timespan.go
starcoder
package vec import ( "fmt" "math" ) // Vector is the vector struct type Vector struct { slice []float64 } // At returns the ith element func (v Vector) At(i int) float64 { return v.slice[i] } // Set sets the ith element to the given float func (v Vector) Set(i int, f float64) { v.slice[i] = f } // SetData rep...
vec/vector.go
0.871803
0.70044
vector.go
starcoder
package facts import ( "fmt" "regexp" "strconv" "strings" "github.com/tidwall/gjson" ) func eqMatch(fact gjson.Result, value string) (bool, error) { switch fact.Type { case gjson.String: return strings.EqualFold(fact.String(), value), nil case gjson.Number: if strings.Contains(value, ".") { v, err :=...
filter/facts/matchers.go
0.60778
0.417509
matchers.go
starcoder
package pgsql import ( "database/sql" "database/sql/driver" "strconv" ) // Int4RangeFromIntArray2 returns a driver.Valuer that produces a PostgreSQL int4range from the given Go [2]int. func Int4RangeFromIntArray2(val [2]int) driver.Valuer { return int4RangeFromIntArray2{val: val} } // Int4RangeToIntArray2 return...
pgsql/int4range.go
0.796094
0.620923
int4range.go
starcoder
package material import ( "math" "time" "github.com/kasworld/h4o/_examples/app" "github.com/kasworld/h4o/_examples/util" "github.com/kasworld/h4o/eventtype" "github.com/kasworld/h4o/geometry" "github.com/kasworld/h4o/graphic" "github.com/kasworld/h4o/gui" "github.com/kasworld/h4o/light" "github.com/kasworld...
_examples/demos/material/physical_variations.go
0.523177
0.519582
physical_variations.go
starcoder
package randomkeymap import ( "math/rand" ) type element struct { value interface{} keyIndex int } // RandomKeyMap stores key/values and provides the following // functions in O(1): // * Insert // * Delete // * Get // * GetRandomKey type RandomKeyMap struct { kv map[interface{}]element keys []interface{} } // ...
apps/augmentedstruct/randomkeymap/randomkeymap.go
0.628293
0.436262
randomkeymap.go
starcoder
package main import "os" import ( "bufio" "errors" "fmt" "log" "strconv" "strings" "time" ) /** Description: main runs the entire program, including reading in a game file, solving the game, and printing the outputs. Arguments: None Returns: Nothing */ func main() { // This section of code reads in a file...
src/SudukoSolver.go
0.669096
0.474875
SudukoSolver.go
starcoder
package mathexp import ( "math" "github.com/grafana/grafana/pkg/expr/mathexp/parse" ) var builtins = map[string]parse.Func{ "abs": { Args: []parse.ReturnType{parse.TypeVariantSet}, VariantReturn: true, F: abs, }, "log": { Args: []parse.ReturnType{parse.TypeVariantSet}, Va...
pkg/expr/mathexp/funcs.go
0.760828
0.526769
funcs.go
starcoder
package similarities import ( "fmt" "github.com/jtejido/golucene/core/search" "math" ) /** * The Pitman-Yor Process (PYP) is used for probabilistic modeling of distributions that follow a power law. * Inference on a PYP can be efficiently approximated by combining power-law discounting with a Dirichlet-smoothed ...
core/search/similarities/lmPitmanYorProcess.go
0.836321
0.434281
lmPitmanYorProcess.go
starcoder
// Package ryu implements the Ryu algorithm for quickly converting floating // point numbers into strings. package ryu import ( "math" "reflect" "unsafe" ) //go:generate go run maketables.go const ( mantBits32 = 23 expBits32 = 8 bias32 = 127 mantBits64 = 52 expBits64 = 11 bias64 = 1023 ) // For...
ryu.go
0.709019
0.505615
ryu.go
starcoder
package oksvg import ( "math" "github.com/srwiley/rasterx" "golang.org/x/image/math/fixed" ) type Matrix2D struct { A, B, C, D, E, F float64 } // matrix3 is a full 3x3 float64 matrix // used for inverting type matrix3 [9]float64 func otherPair(i int) (a, b int) { switch i { case 0: a, b = 1, 2 case 1: a...
vendor/github.com/whosonfirst/go-whosonfirst-static/vendor/github.com/whosonfirst/go-whosonfirst-image/vendor/github.com/srwiley/oksvg/matrix.go
0.783368
0.654984
matrix.go
starcoder
package main import ( "reflect" "strconv" "fmt" ) func Any(value interface{}) string { return formatAtom(reflect.ValueOf(value)) } func formatAtom(v reflect.Value) string { switch v.Kind() { case reflect.Invalid: return "invalid" case reflect.Int, reflect.Int8, reflect.Int16, refl...
gopl-sample/format.go
0.554953
0.438785
format.go
starcoder
package spanapi import ( "encoding/json" ) // NetworkOperator Operator holds information on the network operator. There might be several operators involved; one operator is running the network your devices are connected to and the SIM card in your device belongs to a different operator. type NetworkOperator struct ...
model_network_operator.go
0.813683
0.452173
model_network_operator.go
starcoder
package drawing import ( "strconv" ) var ( // ColorTransparent is a fully transparent color. ColorTransparent = Color{} // ColorWhite is white. ColorWhite = Color{R: 255, G: 255, B: 255, A: 255} // ColorBlack is black. ColorBlack = Color{R: 0, G: 0, B: 0, A: 255} // ColorRed is red. ColorRed = Color{R: 25...
drawing/color.go
0.820001
0.404507
color.go
starcoder
package frequency import ( "fmt" "time" ) type Freq int const ( Day Freq = iota DayB Week Tenday Month Quarter Halfyear Year ) func (f Freq) String() string { switch f { case Day: return "Day" case DayB: return "DayB" case Week: return "Week" case Tenday: return "Tenday" case Month: return...
edldate.go
0.507324
0.46308
edldate.go
starcoder
package gosfmt // Int63r generates pseudo random int64 between low and high. // Input: // low -- lower limit // high -- upper limit // Output: // random int64 func Int63r(low, high int64) int64 { return globalRand.Int63r(low, high) } // Int63s generates pseudo random integers between low and high. // Input...
gosfmt_gosl.go
0.671363
0.467514
gosfmt_gosl.go
starcoder
package fit import ( "math" "strconv" ) const ( sint32Invalid = 0x7FFFFFFF stringInvalid = "Invalid" precision = 5 // 1.1 m ) var ( semiToDegFactor = 180 / math.Pow(2, 31) degToSemiFactor = math.Pow(2, 31) / 180 ) // Latitude represents the geographical coordinate latitude. type Latitude struct { semici...
latlng.go
0.882326
0.419588
latlng.go
starcoder
// Package negtest provides utilities for writing negative tests. package negtest import ( "fmt" "reflect" "runtime" "testing" ) // ExpectFatal fails the test if the specified function does _not_ fail fatally, // i.e. does not call any of t.{FailNow, Fatal, Fatalf}. // If it does fail fatally, returns the fatal ...
negtest/negtest.go
0.749087
0.518668
negtest.go
starcoder
package xcore import ( "fmt" "strconv" "time" ) // ===================== // XDatasetCollection // ===================== // XDatasetCollection is the basic collection of XDatasetDefs type XDatasetCollection []XDatasetDef // NewXDatasetCollection is used to build an XDatasetCollection from a standard []map func Ne...
v2/xdatasetcollection.go
0.579638
0.468304
xdatasetcollection.go
starcoder
package gomini import ( "github.com/spf13/cast" ) func GetStrBool(strv string, def ...bool) (bool, error) { if len(strv) == 0 && len(def) > 0 { return def[0], nil } return cast.ToBoolE(strv) } func GetStrFloat(strv string, def ...float64) (float64, error) { if len(strv) == 0 && len(def) > 0 { return def[0],...
strconv.go
0.59302
0.416381
strconv.go
starcoder
package models import ( "strconv" "strings" ) var ( // CurrencyExchangeRate holds all the currency converted in chaos. CurrencyExchangeRate = map[string]float64{ "Ancient Orb": 27, "Ancient Shard": 2, "Annulment Shard": 3, "Apprentice Cartographe...
models/wealth.go
0.522933
0.452415
wealth.go
starcoder
package utils import ( "math" "sort" "time" "github.com/golang/glog" "github.com/google/cadvisor/info" ) const milliSecondsToNanoSeconds = 1000000 const secondsToMilliSeconds = 1000 type uint64Slice []uint64 func (a uint64Slice) Len() int { return len(a) } func (a uint64Slice) Swap(i, j int) {...
utils/percentiles.go
0.598782
0.435661
percentiles.go
starcoder
package main import ( "io" "io/ioutil" "strconv" "strings" "gopkg.in/yaml.v2" ) // Universe represents a set of configuration, often refered as data or database. type Universe struct { Backgrounds map[string][]Background `yaml:"backgrounds"` Aptitudes []Aptitude `yaml:"aptitudes"` Cha...
src/adeptus/universe.go
0.81409
0.45048
universe.go
starcoder
// Package status provides utility functions for google_rpc status objects. package status import ( rpc "github.com/gogo/googleapis/google/rpc" ) // OK represents a status with a code of rpc.OK var OK = rpc.Status{Code: int32(rpc.OK)} // New returns an initialized status with the given error code. func New(c rpc.C...
mixer/pkg/status/status.go
0.817647
0.423696
status.go
starcoder
package onshape import ( "encoding/json" ) // BTPTopLevelConstantDeclaration283AllOf struct for BTPTopLevelConstantDeclaration283AllOf type BTPTopLevelConstantDeclaration283AllOf struct { BtType *string `json:"btType,omitempty"` Declaration *BTPStatementConstantDeclaration273 `json:"declaration,omitempty"` } // N...
onshape/model_btp_top_level_constant_declaration_283_all_of.go
0.690559
0.464476
model_btp_top_level_constant_declaration_283_all_of.go
starcoder
package sorting import ( "fmt" "math/rand" "sort" "time" ) // Helper function to make a copy of a map of vectors func copyMap(m map[int][]int) map[int][]int { returnedMap := make(map[int][]int) for k, v := range m { // important, as copy to a vector with lenght 0 won't work tmp := make([]int, len(v)) copy...
sorting/sorting.go
0.672869
0.412234
sorting.go
starcoder
package helper import ( "fmt" "image" "image/color" "image/draw" _ "image/jpeg" _ "image/png" "os" ) // SubsamplingPixels 2.2.1 Implement 2:1 subsampling in the horizontal and vertical directions, so that only // 1/4-th of the input image pixels are taken into account func SubsamplingPixels(src []uint8, width,...
helper/helper.go
0.672547
0.423935
helper.go
starcoder
package graph import ( i04eb5309aeaafadd28374d79c8471df9b267510b4dc2e3144c378c50f6fd7b55 "github.com/microsoft/kiota/abstractions/go/serialization" ) // RecurrenceRange type RecurrenceRange struct { // Stores additional data not described in the OpenAPI description found when deserializing. Can be used for s...
models/microsoft/graph/recurrence_range.go
0.741112
0.457682
recurrence_range.go
starcoder
package propcheck import "fmt" type Pair[A, B any] struct { A A B B } func (w Pair[A, B]) String() string { return fmt.Sprintf("Pair{A: %v \n, B: %v\n}\n", w.A, w.B) } func Product[A, B any](fa func(SimpleRNG) (A, SimpleRNG), fb func(SimpleRNG) (B, SimpleRNG)) func(SimpleRNG) (Pair[A, B], SimpleRNG) { f := func...
propcheck/gen_applicative.go
0.739234
0.572902
gen_applicative.go
starcoder
package aggregation import ( "github.com/lindb/lindb/aggregation/fields" "github.com/lindb/lindb/aggregation/function" "github.com/lindb/lindb/pkg/collections" "github.com/lindb/lindb/pkg/timeutil" "github.com/lindb/lindb/series" "github.com/lindb/lindb/series/field" "github.com/lindb/lindb/sql/stmt" ) //go:g...
aggregation/expression.go
0.653459
0.436622
expression.go
starcoder
package gohome import ( "github.com/PucklaMotzer09/mathgl/mgl32" ) // A Model3D that renders instanced type InstancedModel3D struct { // The name of this object Name string meshes []InstancedMesh3D // The bounding box of this Model AABB AxisAlignedBoundingBox } // Adds a mesh to the drawn meshes func (this...
src/gohome/instancedmodel3d.go
0.700895
0.505737
instancedmodel3d.go
starcoder
package q import ( "math" "math/rand" "reflect" "time" agentv1 "github.com/aunum/gold/pkg/v1/agent" "github.com/aunum/gold/pkg/v1/common" "github.com/aunum/gold/pkg/v1/common/num" envv1 "github.com/aunum/gold/pkg/v1/env" "github.com/aunum/log" "gorgonia.org/tensor" ) // Agent that utilizes the Q-Learning a...
pkg/v1/agent/q/agent.go
0.657209
0.428114
agent.go
starcoder
package aes // Rijndael key schedule implementation func rotWord(in [4]byte) (out [4]byte) { // Circular shift left of one byte out[0] = in[1] out[1] = in[2] out[2] = in[3] out[3] = in[0] return } func subWord(in [4]byte) (out [4]byte) { // Substitutes bytes using sbox in aes.go for i...
keys.go
0.797557
0.4917
keys.go
starcoder
package linkedlist import "github.com/roadrunner-server/endure/pkg/vertex" // DllNode consists of the curr Vertex, Prev and Next DllNodes type DllNode struct { Vertex *vertex.Vertex Prev, Next *DllNode } // DoublyLinkedList is the node of DLL which is connected to the tail and the head type DoublyLinkedList st...
pkg/linked_list/linked_list.go
0.654343
0.564579
linked_list.go
starcoder
package client // PersistentVolumeSpec is the specification of a persistent volume. type V1PersistentVolumeSpec struct { // AccessModes contains all ways the volume can be mounted. More info: https://kubernetes.io/docs/concepts/storage/persistent-volumes#access-modes AccessModes []string `json:"accessModes,omitempt...
pkg/client/v1_persistent_volume_spec.go
0.881869
0.565899
v1_persistent_volume_spec.go
starcoder
package puzzle import "reflect" // Node represents a in the search tree type Node struct { Puzzle []int Value int // the index of the "0" in the puzzle Children []*Node Parent *Node Move string // used for printing files Heuristic int G int // the depth of the node in the search tree } ...
puzzle/puzzle.go
0.625667
0.433322
puzzle.go
starcoder
package convert import ( "errors" "strconv" ) // FloatToBool -- Converts a value from float64 to boolean func FloatToBool(value float64) (bool, error) { if float64(1) == value { return true, nil } else if float64(0) == value { return false, nil } return false, errors.New(cannotConvertErrMsg) } // FloatTo...
float.go
0.857559
0.631736
float.go
starcoder
package tsi1 import ( "bytes" "encoding/binary" "fmt" "hash/crc32" "io" "sort" "github.com/influxdata/influxdb/pkg/binaryutil" ) const ( // MeasurementCardinalityStatsMagicNumber is written as the first 4 bytes // of a data file to identify the file as a tsi1 cardinality file. MeasurementCardinalityStatsMa...
tsdb/tsi1/stats.go
0.753467
0.41567
stats.go
starcoder
package datetime import ( "time" ) const ( // YYYY_MM_DD_HH_MM_SS_SSS is the format "2006-01-02 15:04:05.000". YYYY_MM_DD_HH_MM_SS_SSS = "2006-01-02 15:04:05.000" // YYYY_MM_DD_HH_MM_SS is the format "2006-01-02 15:04:05". YYYY_MM_DD_HH_MM_SS = "2006-01-02 15:04:05" // YYYY_MM_DD is the format "2006-01-02". YY...
utils/datetime/datetime.go
0.720958
0.444987
datetime.go
starcoder
package numeralsort import ( "sort" "strings" ) // Less returns true if x < y in a numeral-aware comparison. // It is suitable for use with Go's standard sort.Interface. func Less(a, b string) bool { // the idea is to scan along a and b rune-by-rune (might as well the UTF-8 ready), // until a numeric [0-9] rune i...
numeralsort.go
0.75183
0.588919
numeralsort.go
starcoder
package main import ( "math" ) // Player contains information on a specific player used by the API type Player struct { X uint16 Y uint16 Direction Direction Speed uint8 } // ProcessAction moves the player according to action and turn. Returns visited coordinates func (player *Player) Proces...
client/player.go
0.61878
0.440349
player.go
starcoder