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 chart import ( "fmt" "math" "strings" "github.com/beevee/go-chart/util" ) // TicksProvider is a type that provides ticks. type TicksProvider interface { GetTicks(r Renderer, defaults Style, vf ValueFormatter) []Tick } // Tick represents a label on an axis. type Tick struct { Value float64 Label strin...
tick.go
0.779574
0.434941
tick.go
starcoder
package gorules import "fmt" // Expression refers to anytype that can be evaluated type Expression interface { Evaluate() (bool, error) } // RuleExpression stores the value and target be Operated on.Can act with different operates type RuleExpression struct { Operator Operator `json:"operator"` Value string ...
expression.go
0.739422
0.523542
expression.go
starcoder
package themefiles const DeckJs = ` /*! Deck JS - deck.core Copyright (c) 2011 <NAME> Dual licensed under the MIT license and GPL license. https://github.com/imakewebthings/deck.js/blob/master/MIT-license.txt https://github.com/imakewebthings/deck.js/blob/master/GPL-license.txt */ /* The deck.core module provides al...
web/view/themes/themefiles/deckjs.go
0.598077
0.40987
deckjs.go
starcoder
package scene import ( "github.com/mikee385/GolangRayTracer/color" "github.com/mikee385/GolangRayTracer/geometry" "math" ) const Bias = 1.0E-4 type Scene struct { backgroundColor color.ColorRGB refractiveIndex float32 maxRayDepth uint items []internalObject lights []internalLight } func NewScene(backg...
scene/Scene.go
0.722527
0.617541
Scene.go
starcoder
package arraymap import ( "encoding/json" "sync" ) type ArrayMap struct { positions map[interface{}]int keys []interface{} values []interface{} rwl sync.RWMutex } func NewArrayMap() *ArrayMap { return &ArrayMap{ positions: make(map[interface{}]int), keys: make([]interface{}, 0), value...
arraymap/arraymap.go
0.535341
0.430866
arraymap.go
starcoder
package webgraph import "errors" // Key: used for conversion between key and index into an array // Incoming: key of the source node where the arrow comes from and it's weight type Vertex struct { Key string Incoming map[string]float64 } // To make a graph first we gradually fill Keys by using AddNode. Keys h...
pkg/internal/webrank/webgraph.go
0.691393
0.566678
webgraph.go
starcoder
package solver2 import ( "errors" "github.com/Spi1y/tsp-solver/solver2/iterator" "github.com/Spi1y/tsp-solver/solver2/tasks" "github.com/Spi1y/tsp-solver/solver2/types" ) // Solver is a TSP solver object. It is used to set a distance matrix and start // calculations type Solver struct { RecursiveThreshold types...
solver2/solver.go
0.64646
0.490175
solver.go
starcoder
package gl import ( "fmt" "image" "image/draw" "strings" gl "github.com/go-gl/gl/v3.1/gles2" fyne "github.com/wrzfeijianshen/fyne2" "github.com/wrzfeijianshen/fyne2/canvas" "github.com/wrzfeijianshen/fyne2/theme" ) // Buffer represents a GL buffer type Buffer uint32 // Program represents a compiled GL pro...
sdk/painter/gl/gl_es.go
0.695028
0.406509
gl_es.go
starcoder
package phass import "fmt" /** * Equation */ // Equation represents the configuration for an equation used in a given // assessment. This is represented by input parameters used in equation and a // configuration. type Equation struct { in map[string]float64 conf *EquationConf } // NewEquation returnas a Equa...
common.go
0.901897
0.621483
common.go
starcoder
package block type emptyBlock struct { meta Metadata } // NewEmptyBlock creates an empty block with the given metadata. func NewEmptyBlock(meta Metadata) Block { return &emptyBlock{meta: meta} } func (b *emptyBlock) Close() error { return nil } func (b *emptyBlock) Info() BlockInfo { return NewBlockInfo(BlockEm...
src/query/block/empty.go
0.818628
0.62019
empty.go
starcoder
package day17 // Stores the points of all active cubes type CubeMap map[Point]bool type Point interface { getAdjacent() []Point } type Point3D struct { x, y, z int } type Point4D struct { x, y, z, w int } // Runs the boot process for the input in 3D and returns the number of active cubes after boot is complete....
day17/day17.go
0.798737
0.468304
day17.go
starcoder
package heatMap import ( "fmt" "sort" "github.com/go-graphite/carbonapi/expr/helper" "github.com/go-graphite/carbonapi/expr/interfaces" "github.com/go-graphite/carbonapi/expr/types" "github.com/go-graphite/carbonapi/pkg/parser" ) type heatMap struct { interfaces.FunctionBase } func GetOrder() interfaces.Orde...
expr/functions/heatMap/function.go
0.675336
0.42185
function.go
starcoder
package knowledge import ( "fmt" "github.com/clems4ever/go-graphkb/internal/query" "github.com/clems4ever/go-graphkb/internal/utils" ) // RelationDirection the direction of a relation type RelationDirection int const ( // Left relation Left RelationDirection = iota // Right relation Right RelationDirection =...
internal/knowledge/query_graph.go
0.693473
0.402979
query_graph.go
starcoder
package types import ( "crypto/md5" "fmt" "strings" "time" sdk "github.com/cosmos/cosmos-sdk/types" ) const ( timeFrame = 24 * 3600 ) // DataRecordHash is the hash key of the records time frame type DataRecordHash [16]byte // NodeChannel holds information about the data channel of the DataNode type NodeChann...
x/datanode/types/types.go
0.720958
0.452294
types.go
starcoder
package v1alpha2 import ( v1alpha2 "github.com/openfaas-incubator/ingress-operator/pkg/apis/openfaas/v1alpha2" "k8s.io/apimachinery/pkg/api/errors" "k8s.io/apimachinery/pkg/labels" "k8s.io/client-go/tools/cache" ) // FunctionIngressLister helps list FunctionIngresses. type FunctionIngressLister interface { // L...
pkg/client/listers/openfaas/v1alpha2/functioningress.go
0.610686
0.456955
functioningress.go
starcoder
package types // cypher-data\Numenera.txt var NumeneraCyphers []Cypher = []Cypher { Cypher{ Name: "<NAME>", Level: "1d6", Type: []string{ "Wearable: Gloves", "Usable: Handles with powerful suction cups", }, Effect: `Allows for automatic climbing of any surface, even horizontal ones. Lasts for ten mi...
types/NumeneraCyphers.go
0.5083
0.543045
NumeneraCyphers.go
starcoder
// Package types contains most of the data structures available to/from Noms. package types import ( "github.com/attic-labs/noms/go/d" "github.com/attic-labs/noms/go/hash" ) // Type defines and describes Noms types, both built-in and user-defined. // Desc provides the composition of the type. It may contain only a...
go/types/type.go
0.724091
0.591399
type.go
starcoder
package dimlayer import ( "errors" "fmt" ) type DimLayer struct { w int32 p, d, s int32 } func CreateDimLayer(w, p, d, s int32) DimLayer { return DimLayer{ w: w, p: p, d: d, s: s, } } func CopyDimsLayer(src []DimLayer) (copy []DimLayer) { copy = make([]DimLayer, len(src)) for i := range src { ...
utils/outputdim/dimlayer/dimlayer.go
0.754825
0.428233
dimlayer.go
starcoder
package mathx // dotProduct calculates the algebraic dot product of two slices. This is just // the sum of the products of corresponding elements in the slices. We use // this when we multiply matrices together. func dotProduct(a, b []float64) float64 { var total float64 for i := 0; i < len(a); i++ { ...
mathx/matrix.go
0.810366
0.579757
matrix.go
starcoder
package abstract import ( "vitess.io/vitess/go/vt/sqlparser" "vitess.io/vitess/go/vt/vtgate/semantics" ) type ( /*QueryGraph represents the FROM and WHERE parts of a query. It is an intermediate representation of the query that makes it easier for the planner to find all possible join combinations. Instead of st...
go/vt/vtgate/planbuilder/abstract/querygraph.go
0.646906
0.430866
querygraph.go
starcoder
package main import ( "context" "fmt" "github.com/jamespfennell/hoard" "github.com/jamespfennell/hoard/config" "github.com/jamespfennell/hoard/internal/util" "github.com/urfave/cli/v2" "os" "time" ) const configFile = "config-file" const endHour = "end-hour" const enforceCompression = "enforce-compression" co...
cmd/hoard.go
0.592313
0.413004
hoard.go
starcoder
package rr /*OW-SPEC Simhyd: inputs: rainfall: mm pet: mm states: SoilMoistureStore: Groundwater: TotalStore: parameters: baseflowCoefficient: '' imperviousThreshold: '' infiltrationCoefficient: '' infiltrationShape: '' interflowCoefficient: '' perviousFraction: '' rainfal...
models/rr/simhyd.go
0.574037
0.434341
simhyd.go
starcoder
package nav import ( "fmt" "math" astar "github.com/beefsack/go-astar" ) type KindType int32 // Kind* constants refer to tile kinds for input and output. const ( KindTypePlain KindType = iota KindTypeBlocker KindTypeMoveItem ) var ( kindTypeMap = map[KindType]string{ KindTypePlain: "地面", KindTypeBloc...
core/nav/tile.go
0.670932
0.513973
tile.go
starcoder
package ode // #cgo pkg-config: ode // #include <ode/ode.h> import "C" import ( "unsafe" ) // World constants const ( WorldStepThreadCountUnlimited = C.dWORLDSTEP_THREADCOUNT_UNLIMITED ) var ( worldData = map[World]interface{}{} ) // World represents a simulation world. type World uintptr // NewWorld returns a...
world.go
0.768733
0.620392
world.go
starcoder
package omnijson /* Result { "chain": "xxxx", (string) current network name as defined in BIP70 (main, test, regtest) "blocks": xxxxxx, (numeric) the current number of blocks processed in the server "headers": xxxxxx, (numeric) the current number of headers we have validated "bestblockhas...
omnijson/getblockchaininfo.go
0.61878
0.468912
getblockchaininfo.go
starcoder
package table import ( "sort" "strings" "github.com/giantswarm/columnize" "github.com/giantswarm/microerror" "github.com/giantswarm/gsctl/pkg/sortable" ) // Table represents a data structure that can hold and display the contents of a table. type Table struct { columns []Column rows [][]string // column...
pkg/table/table.go
0.700383
0.449151
table.go
starcoder
package util import "sync/atomic" // AtomicBool - Race condition free primative wrapper type AtomicBool struct { boolean int32 } // Get - returns the underlying primative func (b *AtomicBool) Get() bool { return atomic.LoadInt32(&(b.boolean)) != 0 } // Set - sets the underlying primative func (b *AtomicBool) Set(...
util/atomics.go
0.853699
0.426919
atomics.go
starcoder
package section import ( "fmt" "math" ) // Coord - coordinate of point in plane XOZ used for triangle points type Coord struct { X, Z float64 // coordinates // meter } // Triangle - elementary triangle element for design section and have 3 coordinate of points. type Triangle struct { P [3]Coord // 3 coordinate o...
section/triangle.go
0.717507
0.650856
triangle.go
starcoder
package ode // #cgo pkg-config: ode // #include <ode/ode.h> import "C" import ( "unsafe" ) // HeightfieldData represents heightfield data. type HeightfieldData uintptr func cToHeightfieldData(c C.dHeightfieldDataID) HeightfieldData { return HeightfieldData(unsafe.Pointer(c)) } func (h HeightfieldData) c() C.dHei...
heightfield.go
0.736306
0.417093
heightfield.go
starcoder
package formatters // Organise the possible columns to return in tables and CSVs. // The machine keys can be used as selectors. import ( "fmt" "sort" "strings" "github.com/mroach/rom64/rom" ) type columnValue func(rom.RomFile) string type Column struct { Header string Description string Generator col...
formatters/columns.go
0.556882
0.493409
columns.go
starcoder
package main import ( "math/rand" "math" "time" "fmt" "strconv" ) func random_sequence(smallest, maximum int) []int { //returns a shuffled array array := make([]int, 0) for i := smallest; i < maximum; i++ { //create array and append numbers to it array = append(array, i) } rand.Seed(time.Now().UnixNano())...
radix-sort/radix-sort.go
0.572245
0.532243
radix-sort.go
starcoder
package vector import "gonet/base/containers" func assertIteratorImplementation() { var _ containers.ReverseIteratorWithIndex = (*Iterator)(nil) } // Iterator holding the iterator's state type Iterator struct { vec *Vector index int } // Iterator returns a stateful iterator whose values can be fetched by an in...
base/vector/iterator.go
0.855685
0.405802
iterator.go
starcoder
package internal import ( "reflect" ) func IsScalarType(t reflect.Type) bool { switch t.Kind() { case reflect.Bool, reflect.Int, reflect.Int8, reflect.Int16, reflect.Int32, reflect.Int64, reflect.Uint, reflect.Uint8, reflect.Uint16, reflect.Uint32, reflect.Uint64, reflect.Uintptr, reflect.Float32, reflec...
internal/reflect.go
0.553505
0.463566
reflect.go
starcoder
package model const ( getAllModelsQuery = `SELECT id, name, expression, lex_expression, tag FROM models WHERE user_id=$1;` insertNewModelQuery = `INSERT INTO models (id, name, expression, lex_expression, tag, user_id) VALUES (DEFAULT, $1, $2, $3, $4, $5) RETURNING id, name, expression, lex_expression, tag;` del...
services/ModelService/model/sql_queries.go
0.522446
0.575499
sql_queries.go
starcoder
package gocqlx import ( "errors" "fmt" "reflect" "github.com/gocql/gocql" "github.com/scylladb/go-reflectx" ) // structOnlyError returns an error appropriate for type when a non-scannable // struct is expected but something else is given func structOnlyError(t reflect.Type) error { isStruct := t.Kind() == ref...
vendor/github.com/scylladb/gocqlx/gocqlx.go
0.728362
0.426023
gocqlx.go
starcoder
package fixtures import ( "github.com/gopinath-langote/1build/testing/def" "github.com/gopinath-langote/1build/testing/utils" "github.com/stretchr/testify/assert" "io/ioutil" "testing" ) func featureSetTestsData() []Test { feature := "set" return []Test{ shouldSetNewCommand(feature), shouldUpdateExistingC...
testing/fixtures/command_set_fixtures.go
0.504883
0.428293
command_set_fixtures.go
starcoder
package jgl import ( // "fmt" // "math" "github.com/Stymphalian/go.math/lmath" "github.com/go-gl/gl/v3.3-compatibility/gl" ) type TriMesh struct { // LightFlag bool Mat Material verts []lmath.Vec3 tris [][3]int } func NewTriMesh() *TriMesh { out := &TriMesh...
jgl/tri_mesh.go
0.557123
0.419826
tri_mesh.go
starcoder
package idemix import ( "github.com/hyperledger/udo-amcl/amcl" "github.com/hyperledger/udo-amcl/amcl/FP256BN" "github.com/pkg/errors" ) // credRequestLabel is the label used in zero-knowledge proof (ZKP) to identify that this ZKP is a credential request const credRequestLabel = "credRequest" // Credential issuanc...
idemix/credrequest.go
0.636014
0.495545
credrequest.go
starcoder
package iso20022 // Currency conversion accepted by the customer, either to convert the amount to dispense in the base currency of the ATM, or to convert the total requested amount in the currency of the customer (so called dynamic currency conversion). type CurrencyConversion9 struct { // Identification of the curr...
CurrencyConversion9.go
0.788949
0.597344
CurrencyConversion9.go
starcoder
package animate import ( "math" "golang.org/x/mobile/exp/sprite/clock" "gomatcha.io/matcha/comm" ) // ColorInterpolater represents an object that interpolates between floats given a float64 between 0-1. type FloatInterpolater interface { Interpolate(float64) float64 } // FloatInterpolate wraps n and returns a n...
animate/float.go
0.907772
0.45647
float.go
starcoder
package engine // Simulator represents a system that should be called as part of the main loop. type Simulator interface { Simulate(dt float64) } // PreSimulator allows systems to be called before the main Simulator systems. type PreSimulator interface { PreSimulate(dt float64) } // PreSimulator allows systems to ...
pkg/engine/world.go
0.81615
0.773901
world.go
starcoder
package transform import ( "RenG/config" "RenG/core" "RenG/lang/ast" "RenG/lang/evaluator" "RenG/lang/object" "RenG/lang/token" "fmt" "strconv" ) func TransformEval(node ast.Node, texture *core.SDL_Texture, env *object.Environment) object.Object { switch node := node.(type) { case *ast.BlockStatement: ret...
reng-core/reng/transform/eval.go
0.594198
0.496521
eval.go
starcoder
package store import "math" type CollapsingHighestDenseStore struct { DenseStore maxNumBins int isCollapsed bool } func NewCollapsingHighestDenseStore(maxNumBins int) *CollapsingHighestDenseStore { return &CollapsingHighestDenseStore{ DenseStore: DenseStore{minIndex: math.MaxInt32, maxIndex: math.MinInt32},...
vendor/github.com/DataDog/sketches-go/ddsketch/store/collapsing_highest_dense_store.go
0.614741
0.486514
collapsing_highest_dense_store.go
starcoder
package lpoint import ( "bytes" "encoding/csv" "encoding/json" "errors" "fmt" "os" "path/filepath" "sort" "strconv" "strings" "github.com/nathangreene3/kmeans" ) // LPoint labels a point. type LPoint struct { ID int `json:"id"` Label string `json:"label"` Point kmeans.Point `json:"poi...
lpoint/lpoint.go
0.718298
0.459258
lpoint.go
starcoder
package test import ( "fmt" "os" "strconv" "strings" "testing" toolchainv1alpha1 "github.com/codeready-toolchain/api/api/v1alpha1" "github.com/codeready-toolchain/host-operator/pkg/counter" "github.com/codeready-toolchain/host-operator/pkg/metrics" commontest "github.com/codeready-toolchain/toolchain-common/...
test/counter.go
0.578448
0.404655
counter.go
starcoder
package osm import ( "fmt" "sort" "strconv" "strings" ) // Type is the type of different osm objects. // ie. node, way, relation, changeset, note, user. type Type string // Constants for the different object types. const ( TypeNode Type = "node" TypeWay Type = "way" TypeRelation Type = "relation" ...
feature.go
0.701917
0.511961
feature.go
starcoder
package uiprogress import ( "bytes" "errors" "fmt" "sync" "time" "github.com/neflyte/uiprogress/util/strutil" ) const ( oneHundredPercent = 100.00 // OneHundredPercent represents the float value of 100% ) var ( // Fill is the default character representing completed progress Fill byte = '=' // Head is th...
bar.go
0.688259
0.437763
bar.go
starcoder
package mission // GeodesicCoordinates . type GeodesicCoordinates struct { latitudeDegree float64 longitudeDegree float64 } func NewGeodesicCoordinatesFromDegree( latitudeDegree, longitudeDegree float64, ) GeodesicCoordinates { return GeodesicCoordinates{ latitudeDegree: latitudeDegree, longitudeDegree: lon...
fleet-formation/pkg/mission/domain/mission/navigation.go
0.824321
0.660624
navigation.go
starcoder
package tiny import ( "bytes" "encoding/binary" "errors" "os" "github.com/boltdb/bolt" ) // DB is a small database abstraction built on top of Bolt DB modelled after Google's Big Table. type DB interface { // ListTables lists all the table names in the database. ListTables() [][]byte // GetOrCreateTable re...
tinytable.go
0.714728
0.416114
tinytable.go
starcoder
package scoreboard import ( "fmt" "strings" ) // Scoreboard represents a scoreboard that may be sent to a player. The scoreboard is shown on the right side // of the player's screen. type Scoreboard struct { name string lines []string } // New returns a new scoreboard with the display name passed. Once returned...
dragonfly/player/scoreboard/scoreboard.go
0.76207
0.400544
scoreboard.go
starcoder
package main // We want to identify in this test the performance differences by accessing a struct by array value vs initializing it at // the end and inserting it at that time. We use the orderbook.Delta structure to benchmark these both methods. import ( "fmt" "time" "github.com/gsalaz98/roadkill/orderbook" ) ...
playground/efficiency/struct_gc/struct_access.go
0.570212
0.455199
struct_access.go
starcoder
package gkgen import ( "errors" "fmt" "reflect" ) // NotEqualValidator generates code that will verify a fields does not equal a set value // The validator will look at the field or the dereferenced value of the field // nil values for a field are not considered invalid type NotEqualValidator struct { name string...
gkgen/not_equal.go
0.680985
0.479686
not_equal.go
starcoder
package grid import ( "image" "image/draw" ) // Grid List of ImageTile type Grid struct { Tiles []*ImageTile RowNb int ColumnNb int } // New Create new Grid func New(imageFilePaths []string, row int, column int) *Grid { g := &Grid{ RowNb: row, ColumnNb: column, } for _, path := range imageFilePa...
grid/grid.go
0.698432
0.474327
grid.go
starcoder
package data import ( "math" "reflect" "sort" "strconv" "strings" ) // Value represents a Soy data value, which may be one of the enumerated types. type Value interface { // Truthy returns true according to the Soy definition of truthy and falsy values. Truthy() bool // String formats this value for display ...
data/value.go
0.754915
0.449332
value.go
starcoder
package parse import ( "fmt" "reflect" "strconv" ) var ( stringSliceType = reflect.TypeOf([]string{}) boolSliceType = reflect.TypeOf([]bool{}) intSliceType = reflect.TypeOf([]int{}) int8SliceType = reflect.TypeOf([]int8{}) int16SliceType = reflect.TypeOf([]int16{}) int32SliceType ...
parse/parse_string.go
0.59843
0.435301
parse_string.go
starcoder
package gonet import ( "fmt" "log" "math" "sync" "time" ) // NeuralNet struct is used to represent a simple neural network type NeuralNet struct { numNodes []int // Number of input, hidden and output nodes zs []Vector // weight times input alphas []Vector // activatio...
neuralnet.go
0.644337
0.570092
neuralnet.go
starcoder
package bigquery import ( "fmt" "strings" SDK "google.golang.org/api/bigquery/v2" ) // see API documents: https://cloud.google.com/bigquery/docs/reference/rest/v2 // ========== // Datasets // ========== // CreateDataset performes Datasets.Insert operation. // Creates a new empty dataset. func (b *BigQuery) Crea...
bigquery/bigquery_api.go
0.736969
0.578091
bigquery_api.go
starcoder
// Package derefer contains helper routines for simplifying the getting of // optional fields of basic type. This allows you to get the value from the // pointer even if it is nil, because in this case the zero value of the // specified type will be received. package derefer import ( "reflect" ) // Any dereference ...
derefer.go
0.747432
0.618233
derefer.go
starcoder
package key_stat import ( "fmt" "math" ) // KeyStatsObject - the struct that holds the 'settings' and current values. type KeyStatsObject struct { values []int8 minWindow int8 maxWindow int8 cutoff float32 ignoreNanValues bool ignoreInfValues bool } // SetIgnoreInfValues - controls if we want to ignor...
key_stat.go
0.706798
0.461927
key_stat.go
starcoder
// Package solr provides a solr client that enables the user to easily connect to // one or more solr servers with support for the the basic CRUDL functionality package solr import ( "context" "fmt" "net/http" ) // Client is the interface encompasing all the solr service methods type Client interface { // SetBas...
solr.go
0.832917
0.418935
solr.go
starcoder
package sweetiebot import ( "fmt" "strings" "github.com/bwmarrin/discordgo" ) type AddGroupCommand struct { } func (c *AddGroupCommand) Name() string { return "AddGroup" } func (c *AddGroupCommand) Process(args []string, msg *discordgo.Message, info *GuildInfo) (string, bool) { if len(args) < 1 { return "``...
sweetiebot/groups_command.go
0.588534
0.477067
groups_command.go
starcoder
package chrono // Extent represents a period of time measured in nanoseconds. // The represented value is exactly equivalent to the standard library's time.Duration. type Extent int64 // Common time-based durations relative to 1 nanosecond. const ( Nanosecond Extent = 1 Microsecond = 1000 * Nanosecond Mill...
extent.go
0.924751
0.547041
extent.go
starcoder
package livedocs var LiveShort = `Deploy local packages to a cluster.` var LiveLong = ` The ` + "`" + `live` + "`" + ` command group contains subcommands for deploying local ` + "`" + `kpt` + "`" + ` packages to a cluster. ` var ApplyShort = `Apply a package to the cluster (create, update, prune).` var ApplyLong = ` ...
internal/docs/generated/livedocs/docs.go
0.877437
0.683297
docs.go
starcoder
package input import ( "github.com/Jeffail/benthos/v3/lib/input/reader" "github.com/Jeffail/benthos/v3/lib/log" "github.com/Jeffail/benthos/v3/lib/metrics" "github.com/Jeffail/benthos/v3/lib/types" ) //------------------------------------------------------------------------------ func init() { Constructors[Typ...
lib/input/redis_streams.go
0.695752
0.417628
redis_streams.go
starcoder
package entities import "github.com/rpaloschi/dxf-go/core" // LWPolyline Entity representation type LWPolyline struct { BaseEntity Closed bool Plinegen bool ConstantWidth float64 Elevation float64 Thickness float64 Points LWPolyLinePointSlice ExtrusionD...
vendor/github.com/rpaloschi/dxf-go/entities/lwpolyline.go
0.646572
0.633864
lwpolyline.go
starcoder
package automations import ( "fmt" "math" "math/rand" . "github.com/bspaans/bleep/sequencer/status" "github.com/bspaans/bleep/theory" ) type IntAutomation func(s *Status, counter, t uint) int type IntArrayAutomation func(s *Status, counter, t uint) []int type FloatAutomation func(s *Status, counter, t uint) flo...
sequencer/automations/automations.go
0.591133
0.462594
automations.go
starcoder
package assert import ( "fmt" "reflect" "testing" ) // F represents a testing function. type F func(testing.TB) // Nop does nothing. func Nop(tb testing.TB) {} // Eval runs the given function and returns a Nop. func Eval(f func()) F { f(); return Nop } // C creates a test case for the given name and testing fun...
assert.go
0.708717
0.51379
assert.go
starcoder
package main import ( "bufio" "fmt" "github.com/thompsonlabs/taskmaster" "github.com/thompsonlabs/taskmaster/pool" "os" "strconv" "time" ) func main() { var taskpool = buildTaskPool() go launchTaskPool(30, &taskpool) readUserInput(taskpool) } func buildTaskPool() pool.TaskPool { /** Here we build ...
example/taskpool-main.go
0.520496
0.422386
taskpool-main.go
starcoder
package main import ( "bytes" "fmt" "math/rand" "time" ) type maze struct { c2 [][]byte // cells by row h2 [][]byte // horizontal walls by row (ignore first row) v2 [][]byte // vertical walls by row (ignore first of each column) } func newMaze(rows, cols int) *maze { c := make([]byte,...
lang/Go/maze-solving.go
0.567457
0.414247
maze-solving.go
starcoder
package entities import "github.com/edanko/dxf-go/core" // Vertex Entity representation type Vertex struct { BaseEntity Location core.Point StartingWidth float64 EndWidth float64 Bulge float64 CreatedByCurveFitting bool CurveFitTangentDefined b...
entities/vertex.go
0.682785
0.471953
vertex.go
starcoder
package barchart import ( "math" ) // XY point in a 2D plot. type XY struct{ X, Y int } // XYf point in a 2D plot. type XYf struct { X float64 Y, ScaledY *float64 } // BarChart of XY points. type BarChart struct { MinX, MaxX, MinY, MaxY int xy []XY } // Add a XY point to the plot....
barchart/barchart.go
0.808219
0.594198
barchart.go
starcoder
package sunspec import ( "encoding/binary" "errors" "fmt" "math" "net" ) // Scalable defines the behavior of a point type which may be scaled using the definition: // ScaledValue = PointValue * (10^ScaleFactor) type Scalable interface { Scaled() bool Factor() int16 } // scale is internally used to store a sca...
types.go
0.904091
0.502991
types.go
starcoder
package merkletree2 import ( "math/big" ) // Position represents the position of a node in the tree. When converted to // bytes, a Position can be interpreted as a 1 followed (from left to right) by // a sequence of log2(Config.childrenPerNode)-bit symbols, where each such // symbol identifies which child to descend...
go/merkletree2/position.go
0.763924
0.703912
position.go
starcoder
package set import ( "context" "fmt" "math" "github.com/pbanos/botanic/feature" ) const ( sampleCountThresholdForSetImplementation = 1000 ) /* Set represents a collection of samples. Its Entropy method returns the entropy of the set for a given Feature: a measure of the disinformation we have on the classes o...
set/set.go
0.703855
0.503479
set.go
starcoder
package query import ( "fmt" "math/big" "strings" "time" "github.com/hyperledger/burrow/logging/errors" ) const ( // DateLayout defines a layout for all dates (`DATE date`) DateLayout = "2006-01-02" // TimeLayout defines a layout for all times (`TIME time`) TimeLayout = time.RFC3339 ) // Operator is an ope...
event/query/expression.go
0.694717
0.414543
expression.go
starcoder
package geometry import ( "math" "github.com/tab58/v1/spatial/pkg/numeric" "gonum.org/v1/gonum/blas/blas64" ) // Matrix3D is a row-major representation of a 3x3 matrix. type Matrix3D struct { elements [9]float64 } // Rows returns the number of rows in the matrix. func (m *Matrix3D) Rows() uint { return 3 } // ...
pkg/geometry/matrix3d.go
0.81457
0.729279
matrix3d.go
starcoder
package nne import ( "fmt" "math" "math/rand" "time" ) // sigmoid helper function func sigmoid(x float64) float64 { return 1 / (1 + math.Exp(-x)) } // Node for backpropagation training based feed forward network. type Node struct { Threshold float64 // threshold Weights []float64 activation float64 // act...
nne.go
0.701202
0.503845
nne.go
starcoder
package main import ( "bufio" "flag" "fmt" "os" "strconv" "strings" ) type Point struct { x int y int } func main() { // Use Flags to run a part methodP := flag.String("method", "p1", "The method/part that should be run, valid are p1,p2 and test") flag.Parse() switch *methodP { case "p1": PartOne() ...
2018/6-SafeZone/main.go
0.61878
0.450964
main.go
starcoder
package math import ( "unsafe" ) // Transform is a utility type used to aggregate transformations. Transform // concatenation, like matrix multiplication, is not commutative. type Transform Mat4 // NewTransform returns a new, initialized transform. func NewTransform() Transform { return Transform(Ident4()) } // I...
math/transform.go
0.791821
0.683406
transform.go
starcoder
package sg import "fmt" type Mat4Type int const ( IdentityType Mat4Type = 0x00 Translation2DType = 0x01 Scale2DType = 0x02 Rotation2DType = 0x04 ScaleAndRotate2DType = 0x07 // all of the above GenericType = 0xff ) type Mat4 struct...
sg/mat4.go
0.538255
0.612918
mat4.go
starcoder
3D Printable Nuts and Bolts */ //----------------------------------------------------------------------------- package main import . "github.com/deadsy/sdfx/sdf" //----------------------------------------------------------------------------- // Tolerance: Measured in mm. Typically 0.0 to 0.4. Larger is looser. //...
examples/3dp_nutbolt/main.go
0.635901
0.412885
main.go
starcoder
package circuit import ( "math" "github.com/heustis/tsp-solver-go/model" ) // ClosestGreedyByEdge is an O(n^3) greedy algorithm that: // 1. creates a separate ClosestGreedy for each edge in the convex hull, // 2. for each edge, update the corresponding ClosestGreedy by attaching that edge to its closest point, // ...
circuit/closestgreedybyedge.go
0.810329
0.706342
closestgreedybyedge.go
starcoder
package main import ( glmath "github.com/go-gl/mathgl/mgl64" "math" ) var ( forwardUnit = glmath.Vec3{1.0, 0.0, 0.0} rightUnit = glmath.Vec3{0.0, 0.0, 1.0} upUnit = glmath.Vec3{0.0, 1.0, 0.0} ) type Camera struct { position glmath.Vec3 velocity glmath.Vec3 acceleration glmath.Vec3 speed floa...
camera.go
0.884102
0.512876
camera.go
starcoder
package histogram import ( "io" "sort" "strconv" "strings" "github.com/grokify/mogo/type/maputil" "github.com/olekukonko/tablewriter" "github.com/grokify/gocharts/v2/data/point" "github.com/grokify/gocharts/v2/data/table" ) // Histogram stats is used to count how many times // an item appears and how many t...
data/histogram/histogram.go
0.61659
0.469095
histogram.go
starcoder
package desktop_parser import ( "fmt" ) type state uint8 // The parser works as a simple state machine. // These are the states, and roughly what they are for. const ( // The entry state. Only valid transition is to state_section, or state_key // once a section has been identified. state_none state = iota // T...
lib/desktop_parser/parser.go
0.521227
0.462412
parser.go
starcoder
package sorting // Description: Given an integer array nums sorted in non-decreasing order, return an array of the squares of each number sorted in non-decreasing order. // Time Complexity: O(N) where N is the lenth of the slice // Space Complexity: O(N) if we count the output O(1) otherwise. func SortedSquares(nums [...
algorithmsI/sorting/sorting.go
0.869119
0.766687
sorting.go
starcoder
package dex import ( "fmt" "math/big" . "github.com/ethereum/go-ethereum/common" ) const MAX_PRICE = 10000000 //Pricepoint contains pointers to the first and the last order entered at that price type PricePoint struct { orderHead *Order orderTail *Order } // The orderbook keeps track of the maximum bid and mi...
dex/orderbook.go
0.645567
0.421254
orderbook.go
starcoder
package txqr import ( "fmt" "strings" ) // Decoder represents protocol decode. type Decoder struct { buffer []byte read, total int frames []frameInfo cache map[string]struct{} } // frameInfo represents the information about read frames. // As frames can change size dynamically, we keep size inf...
decode.go
0.637031
0.500671
decode.go
starcoder
package main import ( "errors" "fmt" "os" "regexp" "strings" "github.com/kirsle/goadvent2016/advent" ) const ( ScreenWidth = 50 ScreenHeight = 6 ) // Type Screen represents our 50x6 LCD screen. The pixels are represented as an // array of rows (Y coord) with each row having the X coord. type Screen struct ...
day08/main.go
0.655226
0.458288
main.go
starcoder
package bst import "fmt" type KeyType int64 const ( maxKey = KeyType(0x7fffffffffffffff) minKey = -maxKey - 1 ) type Node struct { Key KeyType Left, Right *Node } type Tree struct { Root *Node } func makeNode(k KeyType) *Node { return &Node{Key: k, Left: nil, Right: nil} } func New...
Lecture 10- Red-black trees/src/bst/bst.go
0.690142
0.451568
bst.go
starcoder
package types import ( "stashware/oo" ) func (this *Block) TbBlock() (ret *TbBlock) { ret = &TbBlock{ IndepHash: this.IndepHash, Hash: this.Hash, Height: this.Height, PreviousBlock: this.PreviousBlock, Nonce: this.Nonce, Timestamp: this.Timestamp, LastRetarget: ...
types/transform.go
0.541894
0.438304
transform.go
starcoder
package axcelerate import jsontime "github.com/liamylian/jsontime/v2/v2" /* GetCoursesInstanceSearch Advanced Course Instance Search - Returns instances. Request Parameters ID The Activity Type ID. InstanceID The Instance ID. type The type of the activity. w = workshop, p = accredited program, el = e-learning, ...
courseInstanceSearch.go
0.695441
0.445107
courseInstanceSearch.go
starcoder
package api type Address = string // Range represents a set of one or more contiguous cells such as a cell, a row, a column, or a block of cells. // https://docs.microsoft.com/en-us/javascript/api/excel/excel.range?view=excel-js-preview\ // Currently, only rectangular, single-set ranges are supported. type Range stru...
pkg/api/range.go
0.841663
0.67112
range.go
starcoder
package myqlib import ( `bytes` `fmt` `sort` `strconv` `strings` `time` ) // Time Columns var ( Timestamp_col Col = NewFuncCol(`time`, `Time data was printed`, 8, func(state *MyqState, c Col) chan string { ch := make(chan string, 1) defer close(ch) ch <- fit_string(time.Now().Format(`15:04:05`), c.W...
myqlib/view_defaults.go
0.566019
0.552479
view_defaults.go
starcoder
package texture import ( "github.com/jphsd/graphics2d/util" "math" ) // Generator is used to construct a one dimensional pattern with a fixed wavelength, center and phase, rotated // by theta. It has an optional filter. The generator function takes a value in the range [0,1] and returns a // value in [-1,1]. type G...
generate.go
0.897538
0.704973
generate.go
starcoder
package e2e import ( "time" v1alpha1 "github.com/interconnectedcloud/qdr-operator/pkg/apis/interconnectedcloud/v1alpha1" "github.com/interconnectedcloud/qdr-operator/test/e2e/framework" . "github.com/onsi/ginkgo" . "github.com/onsi/gomega" ) var _ = Describe("[edge] Interconnect edge deployment tests", func() ...
test/e2e/deployment-plans/edge.go
0.53048
0.418637
edge.go
starcoder
package pass import ( "errors" "math" "github.com/mmcloughlin/avo/reg" ) // edge is an edge of the interference graph, indicating that registers X and Y // must be in non-conflicting registers. type edge struct { X, Y reg.Register } // Allocator is a graph-coloring register allocator. type Allocator struct { r...
vendor/github.com/mmcloughlin/avo/pass/alloc.go
0.735926
0.433442
alloc.go
starcoder
package algorithms import ( "github.com/dploop/golib/stl/iterators" "github.com/dploop/golib/stl/types" ) func MakeHeap(first, last iterators.MutableRandomAccessIterator, less types.BinaryPredicate) { if n := first.Distance(last); n > 1 { for start := (n - 2) / 2; start >= 0; start-- { siftDown(first, last, l...
stl/algorithms/heap.go
0.595375
0.471588
heap.go
starcoder
package polyline type ChartPoint struct { X float64 Y float64 } type Point interface { GetX() float64 GetY() float64 } func (p ChartPoint) GetX() float64 { return p.X } func (p ChartPoint) GetY() float64 { return p.Y } func getSqDist(p1 Point, p2 Point) float64 { dx := p1.GetX() - p2.GetX() dy := p1.GetY(...
simplify.go
0.744099
0.565419
simplify.go
starcoder
package gorgonia import ( "fmt" "hash" "github.com/chewxy/hm" "github.com/pkg/errors" "gorgonia.org/tensor" ) type byIndicesOp struct { axis int } func newByIndicesOp(axis int) *byIndicesOp { if axis < 0 { axis = 0 } return &byIndicesOp{ axis: axis, } } // ByIndices is an operation that takes the in...
op_by_indices.go
0.722429
0.536799
op_by_indices.go
starcoder