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 argparse import ( "errors" "regexp" "strconv" ) // ParameterMatcher defines the default matching algorithms type ParameterMatcher int const ( // StringMatcher returns the default implementation StringMatcher ParameterMatcher = 0 // IntegerMatcher converts the input to an integer IntegerMatcher = iota ...
parameter.go
0.80905
0.442938
parameter.go
starcoder
package neuralnetwork import ( "fmt" "time" ) //Model implements the model architecure. type Model struct { layers []Layer name string optimizer Optimizer loss func([]float64, []float64) float64 lossValues []float64 trainingDuration ...
nn/model.go
0.818809
0.501709
model.go
starcoder
package randomizer import ( "fmt" "gopkg.in/yaml.v2" ) // a prenode is the precursor to a graph node; its parents can be either // strings (the names of other prenodes) or other prenodes. the main difference // between a prenode and a graph node is that prenodes are trees, not graphs. // string references to other...
randomizer/logic.go
0.566618
0.579906
logic.go
starcoder
package phomath import "math" const numMatrix3Values = 3 * 3 // NewMatrix3 creates a new three-dimensional matrix. Argument is optional Matrix3 to copy from. func NewMatrix3(from *Matrix3) *Matrix3 { m := &Matrix3{Values: [numMatrix3Values]float64{}} if from != nil { return m.Copy(from) } return m.Identity()...
phomath/matrix3.go
0.887241
0.693489
matrix3.go
starcoder
package pkg import ( "math" ) const EarthRadiusInMeters = 6372797.560856 func degreesToRadians(degrees float64) float64 { return float64(degrees * math.Pi / 180.0) } func radiansToDegrees(radians float64) float64 { return float64(radians * 180.0 / math.Pi) } func getPointAhead(latLng []float64, distanceMeters f...
pkg/geo.go
0.857545
0.753058
geo.go
starcoder
package dataframe import ( "fmt" "strconv" "time" ) // String defines string data types. type String string // NewStringValue takes any interface and returns Value. func NewStringValue(v interface{}) Value { switch t := v.(type) { case string: return String(t) case []byte: return String(t) case bool: re...
vendor/github.com/gyuho/dataframe/value_string.go
0.698535
0.526769
value_string.go
starcoder
package firewall import ( "encoding/json" "fmt" "testing" "github.com/ingrammicro/cio/api/types" "github.com/ingrammicro/cio/utils" "github.com/stretchr/testify/assert" ) // GetPolicyMocked test mocked function func GetPolicyMocked(t *testing.T, policyIn *types.Policy) *types.Policy { assert := assert.New(t...
api/firewall/firewall_api_mocked.go
0.747432
0.444444
firewall_api_mocked.go
starcoder
// Package gl defines tge-gl API package gl import ( binary "encoding/binary" unsafe "unsafe" tge "github.com/thommil/tge" ) // Name name of the plugin const Name = "gl" var _pluginInstance = &plugin{} var nativeEndian binary.ByteOrder func init() { tge.Register(_pluginInstance) buf := [2]byte{} *(*uint16)...
gl.go
0.646795
0.416619
gl.go
starcoder
package geom import "math" // ZV = Vec{0,0} var ZV = Vec{} // Vec is a 2d Vector type Vec struct { X float64 Y float64 } // Equals returns v == other func (v Vec) Equals(other Vec) bool { return v.X == other.X && v.Y == other.Y } func (v Vec) EqualsEpsilon(other Vec) bool { return v.EqualsEpsilon2(other, Epsil...
geom/vec.go
0.92122
0.518668
vec.go
starcoder
package zpay32 import ( "fmt" "strconv" "github.com/decred/dcrlnd/lnwire" ) var ( // toMAtoms is a map from a unit to a function that converts an amount // of that unit to MilliAtoms. toMAtoms = map[byte]func(uint64) (lnwire.MilliAtom, error){ 'm': mDcrToMAtoms, 'u': uDcrToMAtoms, 'n': nDcrToMAtoms, 'p...
channeldb/migration_01_to_11/zpay32/amountunits.go
0.628065
0.616936
amountunits.go
starcoder
package main import ( "fmt" "math" ) // "uncertain number type" // a little optimization is to represent the error term with its square. // this saves some taking of square roots in various places. type unc struct { n float64 // the number s float64 // *square* of one sigma error term } // constructor, nice to h...
tasks/Numeric-error-propagation/numeric-error-propagation.go
0.795142
0.560974
numeric-error-propagation.go
starcoder
package x import ( "context" "github.com/confio/weave" "github.com/confio/weave/crypto" "github.com/tendermint/tmlibs/common" ) //--------------- expose helpers ----- // TestHelpers returns helper objects for tests, // encapsulated in one object to be easily imported in other packages type TestHelpers struct{} ...
x/helpers.go
0.772187
0.41401
helpers.go
starcoder
package ent import ( "fmt" "strings" "time" "entgo.io/ent/dialect/sql" "github.com/DanielTitkov/anomaly-detection-service/internal/repository/entgo/ent/detectionjob" "github.com/DanielTitkov/anomaly-detection-service/internal/repository/entgo/ent/detectionjobinstance" ) // DetectionJobInstance is the model en...
internal/repository/entgo/ent/detectionjobinstance.go
0.68763
0.411879
detectionjobinstance.go
starcoder
package gostr import ( "crypto/rand" "encoding/base64" "fmt" "regexp" "strings" "github.com/google/uuid" ) // Return the remainder of a string after the first occurrence of a given value. func After(s string, search string) string { if search == "" { return s } position := strings.Index(s, search) if ...
gostr.go
0.78436
0.480235
gostr.go
starcoder
package bgls import ( "math/big" ) // *complexNum is a complex number whose elements are members of field of size p // This is essentially an element of Fp[i]/(i^2 + 1) type complexNum struct { im, re *big.Int // value is ai+b, where a,b \in Fp } func getComplexZero() *complexNum { return &complexNum{new(big.Int...
complexNum.go
0.645455
0.551453
complexNum.go
starcoder
package mesh import ( "math" "github.com/DexterLB/traytor/maths" "github.com/DexterLB/traytor/ray" ) // If the depth of the KDtree reaches MaxTreeDepth, the node becomes leaf // whith node.Triangles the remaining triangles const ( MaxTreeDepth = 10 TrianglesPerLeaf = 20 ) // Vertex is a single vertex in a ...
mesh/mesh.go
0.89093
0.610715
mesh.go
starcoder
package unityai import "math" type Quaternionf struct { x, y, z, w float32 } func NewQuaternionf(x, y, z, w float32) Quaternionf { return Quaternionf{x, y, z, w} } func (this *Quaternionf) X() float32 { return this.x } func (this *Quaternionf) Y() float32 { return this.y } func (this *Quaternionf) Z() float32 {...
quaternion.go
0.825132
0.556219
quaternion.go
starcoder
package trie // A Trie is a set that is optimized for working with strings. type Trie interface { // Add inserts new values into the trie. Add(values ...string) // Complete returns all strings that complete the supplied prefix string. // If no relevant strings exist, the resulting array will be empty. Complete(pr...
trie/trie.go
0.756897
0.687522
trie.go
starcoder
package p5 import ( "math" "gioui.org/f32" "gioui.org/op" "gioui.org/op/clip" "gioui.org/op/paint" ) // Ellipse draws an ellipse at (x,y) with the provided width and height. func (p *Proc) Ellipse(x, y, w, h float64) { if !p.doFill() && !p.doStroke() { return } w *= 0.5 h *= 0.5 var ( ec float64 f...
shapes.go
0.747432
0.565659
shapes.go
starcoder
package date import "time" // Period is a time interval. type Period int const ( // Once represents the beginning of the interval. Once Period = iota // Daily is a daily interval. Daily // Weekly is a weekly interval. Weekly // Monthly is a monthly interval. Monthly // Quarterly is a quarterly interval. Q...
lib/date/date.go
0.745676
0.578329
date.go
starcoder
package either import ( "github.com/calebcase/base/data" "github.com/calebcase/base/data/list" ) type Class[A, B any] interface { NewLeft(A) Left[A, B] NewRight(B) Right[A, B] } type Type[A, B any] struct{} // Ensure Type implements Class. var _ Class[int, string] = Type[int, string]{} func NewType[A, B any]()...
data/either/either.go
0.71889
0.50177
either.go
starcoder
package ent import ( "fmt" "sign-in/app/record/service/internal/data/ent/record" "strings" "time" "entgo.io/ent/dialect/sql" ) // Record is the model entity for the Record schema. type Record struct { config `json:"-"` // ID of the ent. ID int `json:"id,omitempty"` // UserID holds the value of the "user_id...
app/record/service/internal/data/ent/record.go
0.663015
0.437042
record.go
starcoder
package texture import ( "fmt" "github.com/adrianderstroff/pbr/pkg/view/image/image2d" gl "github.com/adrianderstroff/pbr/pkg/core/gl" ) // Texture holds no to several images. type Texture struct { handle uint32 target uint32 texPos uint32 // e.g. gl.TEXTURE0 } // GetHandle returns the OpenGL of this texture...
pkg/view/texture/texture.go
0.764628
0.455138
texture.go
starcoder
package assert import ( "reflect" "time" ) // The idea here is to accept `*testing.T`, or another impl to be able to test this package itself. type Tester interface { Errorf(format string, args ...any) Helper() } // ExpectedActual logs a testing error and returns false if the expected and actual values are not e...
assert/assert.go
0.791781
0.605216
assert.go
starcoder
package square // A discount applicable to items. type CatalogDiscount struct { // The discount name. This is a searchable attribute for use in applicable query filters, and its value length is of Unicode code points. Name string `json:"name,omitempty"` // Indicates whether the discount is a fixed amount or percent...
square/model_catalog_discount.go
0.861086
0.541894
model_catalog_discount.go
starcoder
package testdata /* +extract openapi: 3.0.0 servers: - url: //petstore.swagger.io/v2 description: Default server - url: //petstore.swagger.io/sandbox description: Sandbox server info: description: | This is a sample server Petstore server. You can find out more about Swagger at [http://swagger.io](http://...
testdata/doc.go
0.702122
0.552178
doc.go
starcoder
package config /** * Configuration for LSN pool resource. */ type Lsnpool struct { /** * Name for the LSN pool. Must begin with an ASCII alphanumeric or underscore (_) character, and must contain only ASCII alphanumeric, underscore, hash (#), period (.), space, colon (:), at (@), equals (=), and hyphen (-) characte...
resource/config/lsnpool.go
0.775562
0.546375
lsnpool.go
starcoder
package pigosat import ( "fmt" ) // Minimizer allows you to find the lowest integer K such that // LowerBound() <= K <= UpperBound() // and IsFeasible(K) returns status Satisfiable. type Minimizer interface { // LowerBound returns a lower bound for the optimal value of k. LowerBound() int // UpperBound retur...
optimize.go
0.758332
0.405684
optimize.go
starcoder
package utils import ( "fmt" "strconv" "gopkg.in/yaml.v2" ) type InsertionOrderedStringMap struct { keys []string `yaml:"-"` values map[string]interface{} } func NewEmptyInsertionOrderedStringMap(size int) *InsertionOrderedStringMap { return &InsertionOrderedStringMap{ keys: make([]string, 0, size), v...
v2/pkg/utils/insertion_ordered_map.go
0.664976
0.468487
insertion_ordered_map.go
starcoder
package symphony import ( "fmt" ) // DAG (directed acyclic graph) is the representation of mathematical graph model of a flow type DAG struct { Active bool Name string Nodes []*Node Root []*Node } // Node is a part of a DAG, have his own identity and a link for the next Node to be executed type Node struct...
src/app/orchestration/symphony/dag.go
0.662687
0.459682
dag.go
starcoder
package pole import ( "fmt" "github.com/yaricom/goNEAT/v2/experiment" "github.com/yaricom/goNEAT/v2/experiment/utils" "github.com/yaricom/goNEAT/v2/neat" "github.com/yaricom/goNEAT/v2/neat/genetics" "github.com/yaricom/goNEAT/v2/neat/network" "math" "math/rand" ) const twelveDegrees = 12.0 * math.Pi / 180.0 ...
examples/pole/cartpole.go
0.664105
0.411347
cartpole.go
starcoder
package lander import ( "math" ) // Specific Impulse of fuel, in miles/second // These units mean fuel is measured by mass, not weight const fuelIsp = 1.8 // Gravity is the lunar gravity in miles/(second^2) const Gravity = 0.001 // Kinematics models the motion of the lunar lander // It also tracks elapsed time sin...
go/src/lander/lander.go
0.841435
0.748168
lander.go
starcoder
package item import "golang.org/x/exp/constraints" // Number constraint: ints, uints, complexes, floats and all their subtypes type Number interface { constraints.Integer | constraints.Float | constraints.Complex } // Number constraint any type that define the addition + operation, and their subtypes type Addable i...
item/item.go
0.564579
0.572872
item.go
starcoder
package types import ( "io" "github.com/lyraproj/puppet-evaluator/errors" "github.com/lyraproj/puppet-evaluator/eval" ) type TypeType struct { typ eval.Type } var typeType_DEFAULT = &TypeType{typ: anyType_DEFAULT} var Type_Type eval.ObjectType func init() { Type_Type = newObjectType(`Pcore::TypeType`, `Pco...
types/typetype.go
0.610453
0.44903
typetype.go
starcoder
package petstore import ( "bytes" "encoding/json" "errors" "time" ) var ErrInvalidNullable = errors.New("nullable cannot have non-zero Value and ExplicitNull simultaneously") // PtrBool is a helper routine that returns a pointer to given integer value. func PtrBool(v bool) *bool { return &v } // Ptr...
samples/client/petstore/go-experimental/go-petstore/utils.go
0.754915
0.461259
utils.go
starcoder
package hdrhistogram import "fmt" const truncatedErrStr = "Truncated compressed histogram decode. Expected minimum length of %d bytes and got %d." // Read an LEB128 ZigZag encoded long value from the given buffer func zig_zag_decode_i64(buf []byte) (signedValue int64, n int, err error) { buflen := len(buf) if bufl...
vendor/github.com/HdrHistogram/hdrhistogram-go/zigzag.go
0.522446
0.42322
zigzag.go
starcoder
package geography import ( "math" "time" "github.com/PlaceDescriber/PlaceDescriber/types" ) const ( D_R = math.Pi / 180.0 R_D = 180.0 / math.Pi R_MAJOR = 6378137.0 R_MINOR = 6356752.3142 RATIO = R_MINOR / R_MAJOR ) var ( ECCENT = math.Sqrt(1.0 - (RATIO * RATIO)) COM = 0.5 * ECCENT ) type Ma...
geography/tile.go
0.715424
0.437463
tile.go
starcoder
// Various functions to convert between numeric types. package conversions import ( "fmt" "math" "math/big" "strconv" "github.com/cockroachdb/apd/v2" compact_float "github.com/kstenerud/go-compact-float" "github.com/kstenerud/go-concise-encoding/internal/common" ) // apd.Decimal to other func BigDecimalFloa...
conversions/conversions.go
0.791821
0.423875
conversions.go
starcoder
package ringbuffer // ByteSliceBuffer implements a ringbuffer over bytes type ByteSliceBuffer struct { Buffer *Buffer data [][]byte } // NewByteSliceBuffer returns a ringbuffer over bytes with size. func NewByteSliceBuffer(size uint64) *ByteSliceBuffer { return &ByteSliceBuffer{ Buffer: New(size, 0), data: ...
ringbuffer/bufferbyteslice.go
0.833121
0.530905
bufferbyteslice.go
starcoder
package console import ( "fmt" "github.com/veandco/go-sdl2/img" "github.com/veandco/go-sdl2/sdl" "github.com/torlenor/asciiventure/renderers" ) // Char holds the position, width and height of a char texture segment. type Char struct { X int32 `json:"x"` Y int32 `json:"y"` Width int32 `json:"width"` Height...
console/tileset.go
0.626696
0.582847
tileset.go
starcoder
package util import ( "encoding/binary" "github.com/pingcap/errors" ) // EncodeRow encodes row data and column ids into a slice of byte. // Row layout: colID1, value1, colID2, value2, ... // valBuf and values pass by caller, for reducing EncodeRow allocates temporary bufs. If you pass valBuf and values as nil, //...
pkg/util/row.go
0.704465
0.414188
row.go
starcoder
package datatype import ( "bytes" "fmt" "github.com/datastax/go-cassandra-native-protocol/primitive" "io" "reflect" ) type MapType interface { DataType GetKeyType() DataType GetValueType() DataType } type mapType struct { keyType DataType valueType DataType } func (t *mapType) GetKeyType() DataType { ...
datatype/map.go
0.587707
0.468487
map.go
starcoder
package schema import ( "fmt" "github.com/k14s/ytt/pkg/filepos" "github.com/k14s/ytt/pkg/yamlmeta" ) // Type encapsulates a schema describing a yamlmeta.Node. type Type interface { AssignTypeTo(node yamlmeta.Node) TypeCheck GetValueType() Type GetDefaultValue() interface{} SetDefaultValue(interface{}) Check...
pkg/schema/type.go
0.619011
0.433382
type.go
starcoder
package logic2 import "math" /* We want to make a row of bricks that is goal inches long. We have a number of small bricks (1 inch each) and big bricks (5 inches each). Return True if it is possible to make the goal by choosing from the given bricks. */ func make_bricks(small, big, goal int) bool { if goal > 5*b...
Go/CodingBat/logic-2.go
0.709824
0.699896
logic-2.go
starcoder
package engine import ( "fmt" "image" "math" "sync" ) // Model is the model of the game. type Model struct { // Mutex to protect the model from concurrent access. sync.RWMutex // Game counter. Must be increased by one when a new game is initialized. // Can be used to invalidate caches when its value changes...
engine/model.go
0.549157
0.456894
model.go
starcoder
package api const ( docsRaml = `#%RAML 0.8 title: Sentinel API baseUri: http://sentinel.sh/api/{version} version: v1 documentation: - title: Signup content: | Signup an user using a valid email address and password to create a Sentinel account. After signup an email message is sent to the given ...
src/sentinel/api/docs_generated.go
0.856122
0.454472
docs_generated.go
starcoder
package ql import ( "reflect" "time" ) // Unvetted thots: // Given a query and given a structure (field list), there's 2 sets of fields. // Take the intersection. We can fill those in. great. // For fields in the structure that aren't in the query, we'll let that slide if db:"-". // For fields in the structure that...
select_load.go
0.771284
0.601038
select_load.go
starcoder
package codegen import ( "bytes" "fmt" "go/token" "reflect" ) type SnippetType interface { Snippet snippetType() } type ImportPathAliaser func(importPath string) string var TypeOf = createTypeOf(LowerSnakeCase) func createTypeOf(aliaser ImportPathAliaser) func(tpe reflect.Type) SnippetType { return func(tpe...
snippet_types.go
0.523177
0.412234
snippet_types.go
starcoder
package main import ( "fmt" "reflect" ) // A Tour is an activity that someone can partake in. type Tour struct { Id string Name string Price float64 } func (t Tour) String() string { return t.Id } // A SalesPromotion is a rule which determines the eligibility for price adjustments and/or fr...
316-sydney_tourist_shopping_cart/main.go
0.743727
0.433862
main.go
starcoder
package graph import ( "errors" "fmt" "io" "strconv" ) type ( GremlinTraversalSequence struct { GraphTraversal *GraphTraversal steps []GremlinTraversalStep extensions []GremlinTraversalExtension } GremlinTraversalStep interface { Exec(last GraphTraversalStep) (GraphTraversalStep, error) ...
topology/graph/traversal_parser.go
0.672547
0.566558
traversal_parser.go
starcoder
package translatedassert // OpADD has nodoc func OpADD(x interface{}, y interface{}) interface{} { switch x.(type) { case uint8: return x.(uint8) + y.(uint8) case uint16: return x.(uint16) + y.(uint16) case uint32: return x.(uint32) + y.(uint32) case uint64: return x.(uint64) + y.(uint64) case uint: re...
data/train/go/a4bac851010a26b86e5f8b33981630d64f0bdbb7op.go
0.58261
0.637003
a4bac851010a26b86e5f8b33981630d64f0bdbb7op.go
starcoder
package fb import ( "errors" "image" "image/color" "image/draw" ) // NewMonochrome returns a new Monochrome image with the given bounds // and stride. If stride is zero, a working stride is computed. func NewMonochrome(r image.Rectangle, stride int) *Monochrome { w, h := r.Dx(), r.Dy() if stride == 0 { strid...
fb/mono.go
0.869811
0.500427
mono.go
starcoder
package pinapi import ( "encoding/json" ) // SpecialsFixturesLeague struct for SpecialsFixturesLeague type SpecialsFixturesLeague struct { // FixturesLeague Id. Id *int `json:"id,omitempty"` // A collection of Specials Specials *[]SpecialFixture `json:"specials,omitempty"` } // NewSpecialsFixturesLeague instant...
pinapi/model_specials_fixtures_league.go
0.732113
0.596815
model_specials_fixtures_league.go
starcoder
package bfv import ( "github.com/ldsec/lattigo/ring" ) // Operand is a common interface for Ciphertext and Plaintext. type Operand interface { Element() *bfvElement Degree() uint64 } // bfvElement is a common struct for Plaintexts and Ciphertexts. It stores a value // as a slice of polynomials, and an isNTT flag ...
bfv/operand.go
0.736116
0.428353
operand.go
starcoder
// Copyright 2021 The Go Authors. All rights reserved. // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. package main import "strings" const Cf2 = 2.0 func fEqEq(a int, f float64) bool { return a == 0 && f > Cf2 || a == 0 && f < -Cf2 // ERROR "Redirect Eq64 ba...
test/fuse.go
0.732592
0.450178
fuse.go
starcoder
package sticking import ( "github.com/FelixDux/imposcg/dynamics/impact" "github.com/FelixDux/imposcg/dynamics/forcingphase" "github.com/FelixDux/imposcg/dynamics/parameters" "math" ) type ReleaseImpact struct { NewImpact bool Impact impact.Impact } type Sticking struct { PhaseIn float64 PhaseOut flo...
dynamics/sticking/sticking.go
0.687
0.492737
sticking.go
starcoder
package govector import ( "math" ) // Equal determines if two vectors have the same values. func Equal(a, b Vector) bool { if len(a) != len(b) { return false } for i, v := range a { if v != b[i] { return false } } return true } // CosineSimilarity calculates the cosine similarity of two vectors func...
similarity.go
0.798423
0.600745
similarity.go
starcoder
package physics //Shape type de la forme type Shape interface { Pos() Vec2 SetPos(Vec2) UpdatePos() Width() float64 Height() float64 Center() Vec2 SetCenter(Vec2) Velocity() Vec2 SetVelocity(Vec2) MaxVel() Vec2 SetMaxVel(Vec2) Accel() Vec2 SetAccel(Vec2) MaxAccel() Vec2 SetMaxAccel(Vec2) Gravity() Vec2...
shapes.go
0.594787
0.69903
shapes.go
starcoder
package parser import ( "luago/compiler/ast" "luago/compiler/lexer" "luago/number" "math" ) func optimizeLogicalOr(exp *ast.BinOpExp) ast.Exp { if isTrue(exp.Exp1) { return exp.Exp1 // true or x => true } if isFalse(exp.Exp1) && !isVarargOrFuncCall(exp.Exp2) { return exp.Exp2 // false or x => x } return...
compiler/parser/optimizer.go
0.533154
0.514522
optimizer.go
starcoder
package m3d import ( "bytes" "encoding/binary" "fmt" "io" "github.com/jonathaningram/dark-omen/internal/cstringutil" ) const ( // format is the format ID used in all .M3D files. // "PD3M" is probably "M3DP" backwards, which is probably "Model 3D // <something>". format = "PD3M" headerSize = 24 text...
encoding/m3d/m3d.go
0.644001
0.42316
m3d.go
starcoder
package render import ( "github.com/go-gl/gl/v4.1-core/gl" "github.com/go-gl/mathgl/mgl32" ) type SceneMD1Entity struct { TextureId uint32 // texture id in OpenGL VertexBuffer []float32 // 3 elements for x,y,z, 2 elements for texture u,v, and 3 elements for normal x,y,z ModelPosition mgl...
render/StaticEntity.go
0.621771
0.40751
StaticEntity.go
starcoder
package async /* Series is a shorthand function to List.RunSeries without having to manually create a new list, add the routines, etc. */ func Series(routines []Routine, callbacks ...Done) { l := New() l.Multiple(routines...) l.RunSeries(callbacks...) } /* SeriesParallel is a shorthand function to List.RunSeri...
series.go
0.596198
0.429429
series.go
starcoder
package automata import ( "fmt" "strconv" "github.com/cheggaaa/pb" "github.com/fogleman/gg" ) //NewGrid is the constructor function for the Grid object func NewGrid(xSize, ySize int) *Grid { myNewGrid := &Grid{ColSize: xSize, RowSize: ySize} for row := 1; row <= ySize; row++ { for col := 1; col <= xSize; col...
grid.go
0.566019
0.40248
grid.go
starcoder
package gohome import ( // "fmt" "github.com/PucklaMotzer09/mathgl/mgl32" ) // A transform storing everything needed for the transformation matrix type TransformableObject2D struct { // The position in the world Position mgl32.Vec2 // The size of the object in pixels Size mgl32.Vec2 ...
src/gohome/transformableobject2d.go
0.61832
0.413359
transformableobject2d.go
starcoder
package tee import "github.com/ethereum/go-ethereum/common" type Parameters struct { PowDepth uint64 // required confirmed block depth PhaseDuration uint64 // number of blocks of one phase (not epoch) ResponseDuration uint64 // challenge response grace period for operator at end...
tee/params.go
0.861858
0.446676
params.go
starcoder
package imaging import ( "image" "math" ) // Edge returns a new image that has had all the edges within the given // threshold set to 0xFFFFFFFF. // Img is the input image. // Image edges are detected using the Canny edge detection algorithm defined at // https://en.wikipedia.org/wiki/Canny_edge_detector . func Edg...
edge.go
0.81604
0.588978
edge.go
starcoder
package meta import ( "encoding/json" "fmt" "math" ) type entryType int const ( _ entryType = iota metaStringType metaInt64Type metaUInt64Type metaFloat64Type metaBoolType ) // Data is a map of meta data values. No setter and getter methods are // implemented for this, callers are expected to add and remov...
vendor/collectd.org/meta/meta.go
0.658747
0.461259
meta.go
starcoder
package fractal import ( "math" ) type Plane struct { complexSet ComplexSet width int height int iterations int values [][]int } func (p Plane) Width() int { return p.width } func (p Plane) Height() int { return p.height } func (p Plane) ComplexSet() ComplexSet { return p.complexSet } func (...
plane.go
0.78842
0.441312
plane.go
starcoder
package hangul // IsLead checks given rune is lead consonant func IsLead(r rune) bool { if LeadG <= r && r <= LeadH { return true } return false } // IsMedial checks given rune is medial vowel func IsMedial(r rune) bool { if MedialA <= r && r <= MedialI { return true } return false } // IsTail checks give...
jamo.go
0.637031
0.496216
jamo.go
starcoder
package ext4 import ( "encoding/binary" "fmt" "io" ) type ExtentHeader struct { Magic uint16 // Magic number, 0xF30A. Entries uint16 // Number of valid entries following the header. Max uint16 // Maximum number of entries that could follow the header. Depth uint16 // Depth of this extent no...
ext4/extent.go
0.589007
0.472197
extent.go
starcoder
package mediamachine // WatermarkPosition are references to named, pre-defined watermark locations type WatermarkPosition = string const ( // PositionTopLeft places a watermark in the top left corner of the output PositionTopLeft WatermarkPosition = "topLeft" // PositionTopRight places a watermark in the top right...
mediamachine/watermark.go
0.764276
0.797951
watermark.go
starcoder
package day17 // values that Conway's cube can get const ( ACTIVE = '#' INACTIVE = '.' ) // Program represents a Conway's cube program type Program struct { Map3D [][][]rune Map4D [][][][]rune Rounds int } // New3DProgram creates a new Program for a 3d map func New3DProgram(m [][][]rune, rounds int) *Progra...
day17/day17.go
0.598195
0.52208
day17.go
starcoder
package api const ( // ClientAuth authentication types // ServiceToken as a specific key for the service ServiceToken AuthType = "service_token" // ProviderKey for all services under an account ProviderKey AuthType = "provider_key" ) const ( // Rate limiting extension keys - see https://github.com/3scale/apiso...
threescale/api/types.go
0.840455
0.4206
types.go
starcoder
package geom import ( "image" "math" ) type Vec2[T intfloat] struct { X, Y T } type Vec2f = Vec2[float64] type Vec2i = Vec2[int] func PolarToVec2(r, theta float64) Vec2f { s, c := math.Sincos(theta) return Vec2f{c * r, s * r} } func (v Vec2[T]) Add(other Vec2[T]) Vec2[T] { return Vec2[T]{v.X + other.X, v.Y ...
geom2d.go
0.849379
0.682443
geom2d.go
starcoder
package rules import ( "github.com/tomkrush/money/finance" "strconv" ) func abs(value int) int { if value < 0 { return value * -1 } return value } // Bills contains a list of bill rules type Bills struct { Rules []TransactionRule Transactions finance.Transactions calculated bool goalAmo...
rules/bills.go
0.746416
0.433921
bills.go
starcoder
package anomalies import ( "time" "github.com/olivere/elastic" ) const ( // queryMaxSize is the maximum size of an Elastic Search Query queryMaxSize = 10000 ) // createQueryAccountFilter creates and return a new *elastic.TermsQuery on the accountList array func createQueryAccountFilter(accountList []string) *e...
costs/anomalies/es_request_constructor.go
0.677047
0.430506
es_request_constructor.go
starcoder
package pilosa import ( "errors" "fmt" "strings" "time" ) // ErrInvalidTimeQuantum is returned when parsing a time quantum. var ErrInvalidTimeQuantum = errors.New("invalid time quantum") // TimeQuantum represents a time granularity for time-based bitmaps. type TimeQuantum string // HasYear returns true if the ...
time.go
0.758153
0.529385
time.go
starcoder
This is an example of a daemon that listens for a stream of copy-and-paste audit messages from OpenText Exceed TurboX. This example daemon writes each image to its own file and logs all text copy messages to a single file. This program is not supported in any way, shape, or form, but is provided as an example for the e...
doc.go
0.520984
0.660651
doc.go
starcoder
package geometry import ( "fmt" "github.com/gopherd/doge/math/mathutil" "github.com/gopherd/three/core" ) type Box3 struct { Min, Max core.Vector3 } func (box Box3) Center() core.Vector3 { return box.Min.Add(box.Max).Div(2) } func (box Box3) Size() core.Vector3 { return box.Max.Sub(box.Min) } func (box Box3...
geometry/box3.go
0.814201
0.634883
box3.go
starcoder
package expect import(`fmt`; `runtime`; `path/filepath`; `strings`; `testing`) func Eq(t *testing.T, actual, expected interface{}) { log(t, actual, expected, equal(actual, expected)) } func Ne(t *testing.T, actual, expected interface{}) { log(t, actual, expected, !equal(actual, expected)) } func True(t *testing....
expect/expect.go
0.692538
0.687551
expect.go
starcoder
package cigar import ( "fmt" "github.com/vertgenlab/gonomics/common" "github.com/vertgenlab/gonomics/dna" "log" "strings" "unicode" ) //The Cigar struct contains information on the runLength, operation, and DNA sequence associated with a particular cigar character. type Cigar struct { RunLength int Op ...
cigar/cigar.go
0.627951
0.478285
cigar.go
starcoder
package geometry import ( "errors" "math" "github.com/bradfitz/slice" ) type Polygon struct { vertices []Vector } var InvalidPolygon = errors.New("A polygon must have at least 3 vertices!") func NewPolygon(vertices []Vector) Polygon { if len(vertices) < 3 { panic(InvalidPolygon) } sorted := clockwiseSort(...
geometry/polygon.go
0.624523
0.638737
polygon.go
starcoder
package dsp import "math" func computeNTaps(sampleRate, transitionWidth float64) int { var maxAttenuation = 53.0 var nTaps = int(maxAttenuation * sampleRate / (22.0 * transitionWidth)) nTaps |= 1 return nTaps } func computeNTapsAtt(sampleRate, transitionWidth, maxAttenuation float64) int { var nTaps = int(max...
dsp/tapsGen.go
0.709019
0.509459
tapsGen.go
starcoder
package idemix import ( "github.com/milagro-crypto/amcl/version3/go/amcl" "github.com/milagro-crypto/amcl/version3/go/amcl/FP256BN" "github.com/pkg/errors" ) // Identity Mixer Credential is a list of attributes certified (signed) by the issuer // A credential also contains a user secret key blindly signed by the i...
idemix/credential.go
0.639849
0.436022
credential.go
starcoder
// Package iseq contains the public interfaces for the Clojure sequence library (ported to #golang) package iseq import () // Equivable is the interface for types that support testing for equivalence. type Equivable interface { // Returns true if this equivalent to the given object. Equiv(o interface{}) bool } /...
iseq/iseq.go
0.767254
0.501099
iseq.go
starcoder
package aes import ( "crypto/cipher" "unsafe" ) // Assert that aesCipherAsm implements the ctrAble interface. var _ ctrAble = (*aesCipherAsm)(nil) // xorBytes xors the contents of a and b and places the resulting values into // dst. If a and b are not the same length then the number of bytes processed // will be ...
src/crypto/aes/ctr_s390x.go
0.621656
0.437884
ctr_s390x.go
starcoder
package md import ( "bytes" "github.com/yuin/goldmark/ast" "github.com/yuin/goldmark/parser" "github.com/yuin/goldmark/text" "github.com/yuin/goldmark/util" ) var fencedCodeBlockInfoKey = parser.NewContextKey() type fenced struct{} type fenceData struct { length int node ast.Node } func (b fenced) Trigger...
md/codeblock.go
0.649467
0.440168
codeblock.go
starcoder
package cephalobjects import ( "errors" "fmt" "math/rand" "time" ) //STRTS type CephaloTimeNode struct { Datetime time.Time Data float64 left *CephaloTimeNode right *CephaloTimeNode } type CephaloTimeSeries struct { Size int ID int Root *CephaloTimeNode } //NewCTS creates an empty first-Roo...
cephalobjects/cephalotimeseries.go
0.70791
0.60174
cephalotimeseries.go
starcoder
package client import ( "encoding/json" ) // Volume Volume volume type Volume struct { // Date/Time the volume was created. CreatedAt *string `json:"CreatedAt,omitempty"` // Name of the volume driver used by the volume. Driver string `json:"Driver"` // User-defined key/value metadata. Labels map[string]string...
clients/kratos/go/model_volume.go
0.784071
0.459682
model_volume.go
starcoder
// Package types provides the types that are used internally within the roomserver. package types import ( "github.com/matrix-org/gomatrixserverlib" ) // EventTypeNID is a numeric ID for an event type. type EventTypeNID int64 // EventStateKeyNID is a numeric ID for an event state_key. type EventStateKeyNID int64 ...
roomserver/types/types.go
0.690663
0.682117
types.go
starcoder
package conf // StringSliceVar defines a string flag and environment variable with specified name, default value, and usage string. // The argument p points to a []string variable in which to store the value of the flag and/or environment variable. // For example: // --string-slice="v1,v2" --string-slice="v3" // S...
value_string_slice.go
0.780871
0.534977
value_string_slice.go
starcoder
package specs import ( "errors" "fmt" ) // Repeated represents an array type of fixed size. type Repeated []Template // Template returns a Template for a given array. It checks the types of internal // elements to detect the data type(s). // Note that all the references must be resolved before calling this method....
pkg/specs/repeated.go
0.57678
0.420391
repeated.go
starcoder
package collision2d import ( "math" ) //PointInCircle returns true if the point is inside the circle. func PointInCircle(point Vector, circle Circle) bool { differenceV := NewVector(point.X, point.Y).Sub(circle.Pos) radiusSqr := circle.R * circle.R distanceSqr := differenceV.Len2() return distanceSqr <= radiusSq...
collision.go
0.870184
0.675577
collision.go
starcoder
package engine import ( "math/rand" "github.com/MathieuMoalic/mms/cuda" "github.com/MathieuMoalic/mms/data" "github.com/MathieuMoalic/mms/util" ) func init() { DeclFunc("SetGeom", SetGeom, "Sets the geometry to a given shape") DeclVar("EdgeSmooth", &edgeSmooth, "Geometry edge smoothing with edgeSmooth^3 sample...
engine/geom.go
0.585931
0.535766
geom.go
starcoder
package max_slice import ( "math" ) /* A non-empty zero-indexed array A consisting of N integers is given. A triplet (X, Y, Z), such that 0 ≤ X < Y < Z < N, is called a double slice. The sum of double slice (X, Y, Z) is the total of A[X + 1] + A[X + 2] + ... + A[Y − 1] + A[Y + 1] + A[Y + 2] + ... + A[Z − 1]. For...
max-slice/MaxDoubleSliceSum.go
0.876052
0.780119
MaxDoubleSliceSum.go
starcoder
package world import ( "fmt" "github.com/g3n/engine/math32" ) type Winding struct { Points []*math32.Vector3 } func NewWinding(points int) *Winding { w := &Winding{ Points: make([]*math32.Vector3, points), } for i := range w.Points { w.Points[i] = &math32.Vector3{} } return w } const splitEpsilon = 0...
core/world/winding.go
0.693369
0.483039
winding.go
starcoder
package cbftd import ( "fmt" "io/ioutil" "log" "sort" ) const ( ARRAY_LIMIT = 256 // assuming english files 256 is enough ) type ByteHistogram struct { Count [ARRAY_LIMIT]uint64 } type byteCountPair struct { b byte c uint64 } type byCountAsc []byteCountPair func (a byCountAsc) Len() int { return len(...
cbftd.go
0.653901
0.428473
cbftd.go
starcoder
package main import "fmt" var mySlice = make([]uint, 0, 7) var i uint // Slice, Maps, Channels are reference types to the underlaying premitive Data Structure of a similar type // Made/Build with 3 Headder elements, consists of // 'Address pointing to underlying data-Structure of a Kind' // 'Length of the Slice' // ...
04DataStructures/02Slices.go
0.54577
0.447943
02Slices.go
starcoder
package tile // Tile is a representation of an uniqe tile. THere are 34 unique tiles. // Tile values starts from value of `1` and ends with value of `34`. // Value `0` (TileNull) used for `undefined` (not set). // Tiles order is the following: // - `123456789` `Man` (numbers 1-9) // - `123456789` `Pin` (numbers 10-18)...
tile/tile.go
0.840357
0.749294
tile.go
starcoder
// series provides helpers for determining the series of // a host, and translating from os to series. package series import ( "strconv" "strings" "sync" "time" "github.com/juju/errors" "github.com/juju/os/v2" ) const ( genericLinuxSeries = "genericlinux" genericLinuxVersion = "genericlinux" ) var ( // H...
cluster-autoscaler/vendor/github.com/juju/os/v2/series/series.go
0.61057
0.422683
series.go
starcoder