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 algo import ( "fmt" ) const ( VERTEX_NOT_FOUND = Vertex("vertex not found") ) type Vertex string type Graph struct { adjacent map[Vertex][]Vertex visited map[Vertex]struct{} } func NewGraph() *Graph { g := &Graph{ adjacent: make(map[Vertex][]Vertex), visited: make(map[Vertex]struct{}), } retur...
graph.go
0.673836
0.457621
graph.go
starcoder
package bst import ( "fmt" "math" ) type Node struct { value string left *Node right *Node } type BST struct { nodeCount int root *Node } func (b *BST) IsEmpty() bool { return b.nodeCount == 0 } func (b *BST) Size() int { return b.nodeCount } func (b *BST) Add(value string) bool { if b.Contains(va...
ds/bst/bst.go
0.518302
0.469216
bst.go
starcoder
package zfloat import ( "errors" "fmt" "reflect" "strconv" ) type Slice []float64 func GetAny(i interface{}) (float64, error) { switch i.(type) { case bool: if i.(bool) { return 1, nil } return 0, nil case int: return float64(i.(int)), nil case int8: return float64(i.(int8)), nil case int16: ...
zfloat/zfloat.go
0.597373
0.459379
zfloat.go
starcoder
package utils import ( "fmt" "sync/atomic" ) // AtomicInt64 type AtomicInt64 int64 // CreateAtomicInt64 with initial value func CreateAtomicInt64(initialValue int64) *AtomicInt64 { a := AtomicInt64(initialValue) return &a } // GetAtomic func (a *AtomicInt64) GetAtomic() int64 { return int64(*a) } // SetAtomic...
utils/atomic.go
0.59843
0.432123
atomic.go
starcoder
package vm import ( "commaql/vm/values" ) type VM struct { // Table Context Registers // 0: Main register (all queries are executed with this context) // 1: Working register for joins, sub-queries, etc tcr [2]tableContext // Limit and Iterator Registers // Used for maintaining scan position within contexts. ...
vm/vm.go
0.50293
0.450118
vm.go
starcoder
package camera import "C" import ( "github.com/faiface/pixel" "gotracer/vmath" "math" ) // Camera defocus is a camera that has support for defocus blur. type CameraDefocus struct { Camera // Lens radius affects how much the rays can drift from the center. LensRadius float64 // Lens aperture. Aperture float...
camera/camera_defocus.go
0.760917
0.507141
camera_defocus.go
starcoder
package day18 import ( "fmt" "strconv" ) var HEAD *Node type Node struct { left, right, parent *Node depth int val int } func (node *Node) String() string { if node.isSimple() { return fmt.Sprintf("%d", node.val) } return fmt.Sprintf("[%v,%v]", node.left, node.right) } func ...
day18/utils.go
0.546738
0.418875
utils.go
starcoder
Memory Sections A memory section is a contiguous region of real memory. The access attributes control it's usage (read.write, executable, misaligned access). Loading an ELF file will typically create a number of sections with appropriate attributes. */ //--------------------------------------------------------------...
mem/section.go
0.79649
0.491273
section.go
starcoder
package scl import ( "bufio" "fmt" "io" "math" "strconv" "strings" ) // A Scale is a sequence of pitches that can be applied relative to a base frequency. type Scale struct { Description string Pitches []Pitch } // Freqs returns one octave of frequencies in the scale, starting at and including // the giv...
scl.go
0.689933
0.402392
scl.go
starcoder
package dom import ( "encoding/json" "reflect" "strings" "unicode" "github.com/murlokswarm/app" "github.com/pkg/errors" ) // Mapping represents a component method or field descriptor. type Mapping struct { // The component identifier. CompoID string // A dot separated string that points to a component fiel...
internal/dom/map.go
0.655005
0.455441
map.go
starcoder
package tort import ( "fmt" "reflect" "regexp" "strconv" "strings" ) // StringAssertions are tests around string values. type StringAssertions struct { Assertions name string str string } // String identifies a string variable value and returns test functions for its values. func (assert Assertions) String(...
strings.go
0.774199
0.730891
strings.go
starcoder
package bexpr import ( "reflect" "strconv" ) // CoerceInt conforms to the FieldValueCoercionFn signature // and can be used to convert the raw string value of // an expression into an `int` func CoerceInt(value string) (interface{}, error) { i, err := strconv.ParseInt(value, 0, 0) return int(i), err } // CoerceI...
vendor/github.com/hashicorp/go-bexpr/coerce.go
0.778776
0.616849
coerce.go
starcoder
package stateindex import ( "errors" "math" ) const ( hextable = "0123456789abcdef" reverseOrder = '0' normalOrder = '1' ) // EncodeInt64 encodes a given int64 value to a hexadecimal representation to // preserve the order of actual value, i.e., -100 < -10 < 0 < 100 < 1000 func EncodeInt64(n int64) string ...
internal/stateindex/encoding.go
0.775009
0.454714
encoding.go
starcoder
package switchboard // Supply needs to be implemented by any type acting as a supplier. // Must be safe for concurrent use by multiple goroutines. type Supply interface { Estimate(demand Demand, choicesMade []Choice) (Choice, error) } // Demand is an empty interface that denotes a demand. type Demand interface { } ...
switchboard.go
0.844569
0.611237
switchboard.go
starcoder
package game import ( "fmt" ) const ( KeepPlaying int = iota Draw Win ) // Contains the state of the game. type Game struct { Board [3][3]byte Turn byte } // Creates a new game. i may either be a [3][3]byte, which represents an existing // game (this is useful for testing), or nil, in which case a Game with ...
game/game.go
0.651022
0.498413
game.go
starcoder
package cryptopals import ( "bytes" "crypto/rsa" "math/big" ) type challenge47 struct { } type oracleFunc func([]byte) bool type interval struct { a *big.Int b *big.Int } func (challenge47) mulEncrypt(s, e, n, c *big.Int) []byte { x := new(big.Int).Exp(s, e, n) return x.Mul(c, x).Mod(x, n).Bytes() } func ...
challenge47.go
0.650356
0.553686
challenge47.go
starcoder
package gdsp import ( "math" "sort" ) // Min returns the minimum value from a vector. func Min(v Vector) float64 { if len(v) == 0 { return 0.0 } minValue := math.MaxFloat64 for _, r := range v { if r < minValue { minValue = r } } return minValue } // Max returns the maximum value from a vector. fun...
stat.go
0.861887
0.491212
stat.go
starcoder
package datatable import ( "encoding/json" "errors" "fmt" "strings" "github.com/DATA-DOG/godog/gherkin" "github.com/jinzhu/copier" "github.com/tidwall/pretty" ) // Options defines field options for the DataTable. type Options struct { OptionalFields []string RequiredFields []string } // DataTable defines a...
datatable/datatable.go
0.7865
0.492981
datatable.go
starcoder
package physics import "github.com/zladovan/gorched/gmath" // Physics represents very simplistic physical model. // In this model there are some bodies which can move and fall. // Optionally body can land on the ground. // There are no other collisions resolved here instead of landing on the ground. // If you want to...
physics/physics.go
0.777131
0.566828
physics.go
starcoder
package autospotting import ( "math" "strconv" ) const ( // The tag names below allow overriding global setting on a per-group level. // They should follow the format below: // "autospotting_${overridden_command_line_parameter_name}" // For example the tag named "autospotting_min_on_demand_number" will overrid...
core/autoscaling_configuration.go
0.668664
0.406685
autoscaling_configuration.go
starcoder
package main import ( "bufio" "fmt" "os" "strconv" "strings" ) func Abs(a int) int { if (a >= 0) { return +a } else { return -a } } type Point struct { x, y int } func (p Point) ToString() string { return fmt.Sprintf("Point{ x: %d, y: %d }(dist: %d)", p.x, p.y, p.Distance()) } func (p Point) Print() ...
2019/day03/wires.go
0.535584
0.400661
wires.go
starcoder
package exception import ( "bytes" "fmt" "io" "os" "reflect" "runtime/debug" "github.com/searKing/golang/go/util/object" ) const ( /** Message for trying to suppress a null exception. */ NullCauseMessage string = "Cannot suppress a null exception." /** Message for trying to suppress oneself. */ SelfSuppr...
go/error/exception/throwable.go
0.719482
0.41324
throwable.go
starcoder
package setcover import "sort" // set holds the original set elements but also // a map of elements that are not yet covered in the resulting universe. type set struct { index int elements []int uncoveredElements map[int]struct{} } // newSet generates a new set by initializing the uncovered e...
setcover.go
0.625095
0.430626
setcover.go
starcoder
package set type Equaler[T any] interface { Equal(t T) bool } // Set defines a mutable set; members can be added // and removed and the set can be combined with // itself. type Set[ self any, elem Equaler[elem], ] interface { // New returns a new empty instance of the set. New() self // Union sets the contents...
set-2014/set.go
0.804252
0.530297
set.go
starcoder
package metadata import ( "blockwatch.cc/tzgo/tezos" "time" ) func init() { LoadSchema(tz21Ns, []byte(tz21Schema), &Tz21{}) } // https://gitlab.com/tzip/tzip/-/blob/master/proposals/tzip-21/metadata-schema.json const ( tz21Ns = "tz21" tz21Schema = `{ "$schema": "http://json-schema.org/draft/2019-09/schem...
etl/metadata/tzip21.go
0.816443
0.539408
tzip21.go
starcoder
package chain /* #include <stdint.h> void eosio_assert( uint32_t test, const char* msg ); void eosio_assert_message( uint32_t test, const char* msg, uint32_t msg_len ); void eosio_assert_code( uint32_t test, uint64_t code ); void eosio_exit( int32_t code ); uint64_t current_time( void ); char is_feature_activate...
system.go
0.552781
0.405449
system.go
starcoder
package ring // Ring implements a circular buffer. It has one different implementation from // a standard ring buffer in that most reads are expected to be done from head // rather than tail. type Ring struct { head int // most recent value position tail int // oldest value position buff []interface{} } // New ret...
ring.go
0.857127
0.509947
ring.go
starcoder
package row import ( "errors" "fmt" "strings" "unicode/utf8" ) // Row is a slice of strings. type Row []string // ColumnCap holds the number of maximum runs for each column. type ColumnCap []int var errItemCountNotEqual = errors.New(`Number of items in the head and body []string must be equal if there are more ...
row/row.go
0.579876
0.401277
row.go
starcoder
package debt import "fmt" // Graph represents the whole relationship between all vertices type Graph struct { Vertices map[string]*Vertex Edges []*EdgeVector } // NewEdgeVector creates an edge vector in graph // and add into the graph func (g *Graph) NewEdgeVector(id uint64, start, end string, amount int64) *Ed...
debt/graph.go
0.580352
0.493164
graph.go
starcoder
package main import ( "math" . "github.com/jakecoffman/cp" "github.com/jakecoffman/cp/examples" ) var motor *SimpleMotor func main() { space := NewSpace() space.Iterations = 20 space.SetGravity(Vector{0, -500}) var shape *Shape var a, b Vector walls := []Vector{ {-320, -240}, {-320, 240}, {320, -240}...
examples/theojansen/theojansen.go
0.63114
0.532121
theojansen.go
starcoder
package main import ( "time" "tetris/consts" "golang.org/x/exp/shiny/screen" ) type CurrentTile struct { MillisForOneStep int64 // how many tiles in one second CurrentTile []*Tile LastTick int64 } func FromNextTile(nextTile []*Tile) *CurrentTile { c := &CurrentTile{} c.LastTick = time.Now().Un...
current_tile.go
0.519521
0.461805
current_tile.go
starcoder
package vector import ( "fmt" "math/cmplx" "github.com/itsubaki/q/pkg/math/matrix" ) type Vector []complex128 func New(z ...complex128) Vector { out := Vector{} for _, zi := range z { out = append(out, zi) } return out } func Zero(n int) Vector { out := Vector{} for i := 0; i < n; i++ { out = append(...
pkg/math/vector/vector.go
0.690872
0.422683
vector.go
starcoder
// Package counter provides functions to generate a frequency histogram of values. package counter import ( "sort" ) // Counter is used for calculating a frequency histogram of strings. type Counter map[string]int // New returns a new Counter. func New() Counter { return Counter(map[string]int{}) } // Len return...
pkg/counter/Counter.go
0.858422
0.625438
Counter.go
starcoder
package pagerank import ( "math" ) // Pagerank is pagerank calculator type Pagerank struct { Matrix [][]uint64 Links []uint64 Keymap map[string]uint64 Rekeymap []string } // NewPagerank Create a pagerank calculator func NewPagerank() *Pagerank { return &Pagerank{ Keymap: map[string]uint64{}, } } // ...
pagerank.go
0.627152
0.460835
pagerank.go
starcoder
package advent2019 import "strings" type orbitPoint struct { Name string Orbits *orbitPoint OrbittedBy orbitPoints } type orbitPoints []*orbitPoint func findNode(op *orbitPoint, find string) *orbitPoint { if op.Name == find { return op } for _, p := range op.OrbittedBy { if res := findNode(p, f...
internal/pkg/advent2019/day6.go
0.535584
0.420659
day6.go
starcoder
package htm import ( //"math" "bytes" "github.com/nupic-community/htm/utils" ) //entries are positions of non-zero values type SparseEntry struct { Row int Col int } //Sparse binary matrix stores indexes of non-zero entries in matrix //to conserve space type SparseBinaryMatrix struct { Width int Height int...
sparseBinaryMatrix.go
0.715026
0.549882
sparseBinaryMatrix.go
starcoder
package split import "github.com/vjeantet/bitfan/processors/doc" func (p *processor) Doc() *doc.Processor { return &doc.Processor{ Name: "split", ImportPath: "github.com/vjeantet/bitfan/processors/filter-split", Doc: "The split filter clones an event by splitting one of its fields and placing each...
processors/filter-split/docdoc.go
0.655005
0.447279
docdoc.go
starcoder
package twod import ( "fmt" ) // Problem describes the situation we wish to optimize type Problem struct { Sheet Sheet `json:"sheet"` Items []Item `json:"items"` } // Validate checks if the problem can be solved. // If this returns an error the problem definitely cannot be solved. // If this does not return an e...
pkg/twod/twod.go
0.827375
0.41745
twod.go
starcoder
package shared import ( "fmt" "reflect" "strings" ) // Intertemplate an interface for manipulating templates. type Intertemplate interface { Length() int GetFieldAt(i int) interface{} NewTuple() Tuple } // Template structure used for matching against tuples. // Templates is, in princple, a tuple with additiona...
shared/template.go
0.603114
0.426023
template.go
starcoder
package goja import ( "fmt" "reflect" "strconv" "github.com/dop251/goja/unistring" ) /* DynamicObject is an interface representing a handler for a dynamic Object. Such an object can be created using the Runtime.NewDynamicObject() method. Note that Runtime.ToValue() does not have any special treatment for Dynami...
vendor/github.com/dop251/goja/object_dynamic.go
0.782829
0.411347
object_dynamic.go
starcoder
package bn256 import "math/bits" // GT target group of the pairing type GT = e12 type lineEvaluation struct { r0 e2 r1 e2 r2 e2 } // FinalExponentiation computes the final expo x**(p**6-1)(p**2+1)(p**4 - p**2 +1)/r func FinalExponentiation(z *GT, _z ...*GT) GT { var result GT result.Set(z) for _, e := rang...
bn256/pairing.go
0.620737
0.474936
pairing.go
starcoder
package types //go:generate msgp const ( // ReceiptStatusFailed is the status code of a transaction if execution failed. ReceiptStatusFailed = uint64(0) // ReceiptStatusSuccessful is the status code of a transaction if execution succeeded. ReceiptStatusSuccessful = uint64(1) ) type InternalTxCall struct { /** ...
types/tx.go
0.666931
0.408631
tx.go
starcoder
package build import "fmt" // InsertInto returns a new INSERT statement. func InsertInto(table string, columns ...string) *InsertStmt { stmt := &InsertStmt{table: Ident(table)} if len(columns) > 0 { stmt.columns = make([]Expression, len(columns)) for i := range columns { stmt.columns[i] = Ident(columns[i]) ...
build/insert.go
0.572842
0.473475
insert.go
starcoder
package duplo import ( "image" "image/color" "math" "math/rand" "sort" "github.com/nfnt/resize" "github.com/rivo/duplo/haar" ) // Hash represents the visual hash of an image. type Hash struct { haar.Matrix // Thresholds contains the coefficient threholds. If you discard all // coefficients with abs(coef) ...
hash.go
0.770551
0.569853
hash.go
starcoder
package video import ( "runtime" . "github.com/gooid/gocv/opencv3/internal/native" ) type DualTVL1OpticalFlow struct { *DenseOpticalFlow } func NewDualTVL1OpticalFlow(addr int64) (rcvr *DualTVL1OpticalFlow) { rcvr = &DualTVL1OpticalFlow{} rcvr.DenseOpticalFlow = NewDenseOpticalFlow(addr) runtime.SetFinalizer(...
opencv3/video/DualTVL1OpticalFlow.java.go
0.660172
0.405861
DualTVL1OpticalFlow.java.go
starcoder
package require import ( "reflect" "testing" ) func NoError(t *testing.T, err error, msgs ...string) { if err != nil { t.Errorf("Expected no error, but got: %s", err) for _, msg := range msgs { t.Errorf("\n" + msg) } t.FailNow() } } func NotNil(t *testing.T, object interface{}, msgs ...string) { if i...
helpers/require/require.go
0.579876
0.503845
require.go
starcoder
package tsdb import ( "strconv" "time" "github.com/timberio/go-datemath" ) func NewTimeRange(from, to string) *TimeRange { return &TimeRange{ From: from, To: to, now: time.Now(), } } func NewFakeTimeRange(from, to string, now time.Time) *TimeRange { return &TimeRange{ From: from, To: to, now:...
pkg/tsdb/time_range.go
0.64969
0.40204
time_range.go
starcoder
package docs import ( "bytes" "encoding/json" "fmt" "strings" "text/template" "github.com/Jeffail/benthos/v3/lib/util/config" "github.com/Jeffail/gabs/v2" "gopkg.in/yaml.v3" ) // AnnotatedExample is an isolated example for a component. type AnnotatedExample struct { // A title for the example. Title string...
internal/docs/component.go
0.694199
0.641984
component.go
starcoder
package fax import ( "errors" "image" "io" ) const ( white = 0xFF black = 0x00 ) var negativeWidth = errors.New("fax: negative width specified") // DecodeG4 parses a Group 4 fax image from reader. // The width will be applied as specified and the // (estimated) height helps memory allocation. func DecodeG4(re...
internal/fax/read.go
0.692018
0.483831
read.go
starcoder
package data_type //ICollection ISequence IAssociative IIndexed IStack type TypVector struct { buffers []interface{} count int } func (t *TypVector) Count() int { return t.count } func (t *TypVector) Conj(val ...interface{}) { if t.buffers == nil || t.count == cap(t.buffers) { t.allocateMore() } t.buffers[...
src/lib/lisp_core/data_type/Vector.go
0.504639
0.425605
Vector.go
starcoder
package models import ( i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91 "github.com/microsoft/kiota-abstractions-go/serialization" ) // OrganizationalBrandingProperties provides operations to manage the organizationalBranding singleton. type OrganizationalBrandingProperties struct { Entity ...
models/organizational_branding_properties.go
0.732113
0.509764
organizational_branding_properties.go
starcoder
package internal import ( "errors" "fmt" "math" "reflect" "github.com/lyraproj/dgo/dgo" ) type ( // structType describes each mapEntry of a map structType struct { additional bool keys array values array required []bool } structEntry struct { mapEntry required bool } ) // StructMa...
internal/mapstruct.go
0.62395
0.461563
mapstruct.go
starcoder
package asm_amd64 import ( "github.com/tetratelabs/wazero/internal/asm" ) // Assembler is the interface used by amd64 JIT compiler. type Assembler interface { asm.AssemblerBase // CompileRegisterToRegisterWithMode adds an instruction where source and destination // are `from` and `to` registers and the instructio...
vendor/github.com/tetratelabs/wazero/internal/asm/amd64/assembler.go
0.799207
0.455017
assembler.go
starcoder
package fp func(l BoolArray) ZipWithIndex() Tuple2Array { zipped := make([]Tuple2, len(l)) for i, e := range l { zipped[i] = Tuple2 { e, i } } return zipped } func(l StringArray) ZipWithIndex() Tuple2Array { zipped := make([]Tuple2, len(l)) for i, e := range l { zipped[i] = Tuple2 { e, i } } ...
fp/bootstrap_array_zipwithindex.go
0.636466
0.641703
bootstrap_array_zipwithindex.go
starcoder
package matrixexp import ( "github.com/gonum/blas/blas64" "strconv" ) // NewFuture constructs a Future MatrixLiteral from a Matrix Expression and // then begins evaluating it. func NewFuture(M MatrixExp) *Future { ch := make(chan struct{}) r, c := M.Dims() F := &Future{ r: r, c: c, ch: ch, m: nil, }...
future.go
0.776369
0.455501
future.go
starcoder
package pt import ( "math" ) type Matrix struct { x00, x01, x02, x03 float64 x10, x11, x12, x13 float64 x20, x21, x22, x23 float64 x30, x31, x32, x33 float64 } func Identity() Matrix { return Matrix{ 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1} } func Translate(v Vector) Matrix { return Matrix{ ...
pt/matrix.go
0.822011
0.668082
matrix.go
starcoder
package simple import ( "strings" ) /* twoSum: https://leetcode.com/problems/two-sum/ Given an array of integers nums and an integer target, return indices of the two numbers such that they add up to target. You may assume that each input would have exactly one solution, and you may not use the same element twice. ...
Algorithm-go/simple/map.go
0.826187
0.533154
map.go
starcoder
package goparquet import ( "io" "github.com/pkg/errors" ) // The two following decoder are identical, since there is no generic, I had two option, one use the interfaces // which was my first choice but its branchy and full of if and else. so I decided to go for second solution and // almost copy/paste this two ty...
deltabp_decoder.go
0.59843
0.428771
deltabp_decoder.go
starcoder
package fr import "github.com/MaxSlyugrov/cldr" var calendar = cldr.Calendar{ Formats: cldr.CalendarFormats{ Date: cldr.CalendarDateFormat{Full: "EEEE d MMMM y", Long: "d MMMM y", Medium: "d MMM y", Short: "dd/MM/y"}, Time: cldr.CalendarDateFormat{Full: "HH:mm:ss zzzz", Long: "HH:mm:ss z", Medium: "HH:mm...
resources/locales/fr/calendar.go
0.505859
0.464962
calendar.go
starcoder
package metrics import ( "time" "github.com/uber-go/tally/v4" "go.temporal.io/server/common/log" ) type ( excludeTags map[string]map[string]struct{} tallyMetricsHandler struct { tags []Tag scope tally.Scope perUnitBuckets map[MetricUnit]tally.Buckets excludeTags excludeTags } )...
common/metrics/tally_metric_provider.go
0.620737
0.405272
tally_metric_provider.go
starcoder
// Package vec2d offers a two-dimensional vector implementation for Go. package vec2d import "math" // Vector type defines vector using exported float64 values: X and Y type Vector struct { X, Y float64 } // New returns a new vector func New(x, y float64) *Vector { return &Vector{X: x, Y: y} } // IsEqual compare...
vector.go
0.919489
0.786295
vector.go
starcoder
package goa import "context" // Location is the enum defining where the value of key based security schemes should be read: // either a HTTP request header or a URL querystring value type Location string // LocHeader indicates the secret value should be loaded from the request headers. const LocHeader Location = "he...
security.go
0.867892
0.419648
security.go
starcoder
package jdwp import ( "fmt" "io" ) // Reader provides methods for decoding values. type Reader interface { io.Reader // Data reads the data bytes in their entirety. Data([]byte) // Bool decodes and returns a boolean value from the Reader. Bool() bool // Int8 decodes and returns a signed, 8 bit integer value ...
jdwp/reader.go
0.669853
0.427875
reader.go
starcoder
package eth import ( "encoding/hex" "encoding/json" "strings" "github.com/pkg/errors" "golang.org/x/crypto/sha3" "github.com/INFURA/go-ethlibs/rlp" ) type Data string type Data8 Data type Data20 Data type Data32 Data type Data256 Data // Aliases type Hash = Data32 type Topic = Data32 func NewData(value stri...
eth/data.go
0.691081
0.44083
data.go
starcoder
package shapes import ( "math" "github.com/factorion/graytracer/pkg/primitives" ) // Cube Basic cube representation type Cube struct { ShapeBase } // CheckAxis Checks two sides of a cube on an axis from a ray's path on that axis func CheckAxis(origin, direction, minimum, maximum float64) (float64, float64) { // ...
pkg/shapes/cube.go
0.930324
0.499939
cube.go
starcoder
package onshape import ( "encoding/json" ) // BTSplineDescription2118AllOf struct for BTSplineDescription2118AllOf type BTSplineDescription2118AllOf struct { BtType *string `json:"btType,omitempty"` ControlPoints *[]float64 `json:"controlPoints,omitempty"` Degree *int32 `json:"degree,omitempty"` IsPeriodic *bool...
onshape/model_bt_spline_description_2118_all_of.go
0.758689
0.441131
model_bt_spline_description_2118_all_of.go
starcoder
package api func init() { Swagger.Add("compliance_reporting_stats_stats", `{ "swagger": "2.0", "info": { "title": "components/automate-gateway/api/compliance/reporting/stats/stats.proto", "version": "version not set" }, "schemes": [ "http", "https" ], "consumes": [ "application/json" ...
components/automate-gateway/api/compliance_reporting_stats_stats.pb.swagger.go
0.614857
0.415077
compliance_reporting_stats_stats.pb.swagger.go
starcoder
package flagday import ( "sync" "time" ) var ( jstLocation *time.Location jstOnce sync.Once ) // HolidayKind is kind of holiday. type HolidayKind int const ( // PublicHoliday means that holiday is public holiday. PublicHoliday HolidayKind = iota // NationalHoliday means that holiday is national holiday. ...
holiday.go
0.571767
0.504944
holiday.go
starcoder
package main import ( "fmt" "strings" ) func basics() { /* A slice is a ... dynamically-sized, flexible view ... into the elements of an array. A slice does not store any data, it just describes a section of an underlying array. */ // 0 1 2 3 4 5 primes := [6]int{2, 3, 5, 7, 11, 13}...
tour13slices/slices.go
0.547222
0.578895
slices.go
starcoder
package kata import ( "strings" "unicode" ) // ----------------------- STORAGE ---------------------------------- // A digit in the problem. // The digit is a letter in the problem. // During the calculation the value of the digit will be found. // value < 0 if the value of the digit is unknown. type aDigit struct...
3_kyu/Alphametics_Solver.go
0.531453
0.52275
Alphametics_Solver.go
starcoder
// Package geomfn contains functions that are used for geometry-based builtins. package geomfn import "github.com/twpayne/go-geom" // applyCoordFunc applies a function on src to copy onto dst. // Both slices represent a single Coord within the FlatCoord array. type applyCoordFunc func(l geom.Layout, dst []float64, s...
pkg/geo/geomfn/geomfn.go
0.762247
0.516413
geomfn.go
starcoder
package stats import ( "math" "github.com/jgbaldwinbrown/go-moremath/mathx" ) // HypergeometicDist is a hypergeometric distribution. type HypergeometicDist struct { // N is the size of the population. N >= 0. N int // K is the number of successes in the population. 0 <= K <= N. K int // Draws is the number...
stats/hypergdist.go
0.821331
0.619097
hypergdist.go
starcoder
package ast import ( "fmt" "strings" ) func NewStringArrayNode(values []string) *StringArrayNode { result := &StringArrayNode{} for _, val := range values { result.values = append(result.values, &StringConstNode{value: val}) } return result } // StringArrayNode encapsulates a string array type StringArrayNod...
storage/ast/node_arrays.go
0.740456
0.443661
node_arrays.go
starcoder
package drawille import ( "fmt" "math" ) // Braille chars start at 0x2800 var brailleStartOrdinal = 0x2800 func internalPosition(n, base int) int { if n >= 0 { return n % base } result := n % base if result == 0 { return -base } return result } func getDot(y, x int, inverse bool) int { y = internalPosi...
vendor/github.com/Kerrigan29a/drawille-go/drawille.go
0.536799
0.564999
drawille.go
starcoder
package keys // All returns a new key range matching all keys func All() Range { return Range{} } // Range represents all keys such that // k >= Min and k < Max // If Min = nil that indicates the start of all keys // If Max = nil that indicatese the end of all keys // If multiple modifiers are called on a range th...
storage/kv/keys/range.go
0.840324
0.479016
range.go
starcoder
package x86_64 /* Instructions The below instructions implement a simple Instruction interface that allows them to be combined, optimised and encoded into machine code. x86_64 is a bit interesting in that instructions with different sets of operands might require subtly different machine code opcodes, even thou...
asm/x86_64/assembler.go
0.669313
0.57678
assembler.go
starcoder
package ahrs import ( "log" "math" "github.com/skelterjohn/go.matrix" ) const ( minDT = 1e-6 // Below this time interval, don't recalculate maxDT = 10.0 // Above this time interval, re-initialize--too stale minGS = 5.0 // Below this GS, don't use ...
ahrs/ahrs.go
0.669529
0.433802
ahrs.go
starcoder
package filter import "github.com/spiegel-im-spiegel/cov19data/values" //Filters is a filter class for entity classes type Filters struct { periods []values.Period prefJpCodes []values.PrefJpCode countryCodes []values.CountryCode regionCodes []values.RegionCode } //FiltersOptFunc type is self-referential ...
filter/filter.go
0.717012
0.455804
filter.go
starcoder
package number import schema "github.com/frolFomich/document-schema" func WithMaximum(m float64) schema.SchemaOption { return func(sch *schema.SchemaBase) { if sch != nil && (schema.NumberSchemaType == sch.Type() || schema.IntegerSchemaType == sch.Type()) { sch.Put(schema.MaximumSchemaKeyword, m) } } } func...
number/options.go
0.593845
0.472866
options.go
starcoder
package tty import ( "gopheros/device" "gopheros/device/video/console" "gopheros/kernel" "io" ) // VT implements a terminal supporting scrollback. The terminal interprets the // following special characters: // - \r (carriage-return) // - \n (line-feed) // - \b (backspace) // - \t (tab; expanded to tabWidth s...
src/gopheros/device/tty/vt.go
0.564579
0.413596
vt.go
starcoder
package carrot /* This file describes the construction and types of messages sent during the Picnic Protocol handshake between the server and primary and secondary devices. Example initial message to devices. Since the session_token and uuid are the same, this is a primary device message. The two fields would be ...
beacon.go
0.630685
0.455441
beacon.go
starcoder
package pinapi import ( "encoding/json" ) // Currency struct for Currency type Currency struct { // Currency code. Code *string `json:"code,omitempty"` // Currency name. Name *string `json:"name,omitempty"` // Exchange rate to USD. Rate *float64 `json:"rate,omitempty"` } // NewCurrency instantiates a new Curr...
pinapi/model_currency.go
0.821295
0.423458
model_currency.go
starcoder
package order import ( "github.com/MaximilianMeister/asset/broker" "github.com/shopspring/decimal" ) // Order contains data to calculate order figures type Order struct { brokerAlias string volume int64 target, actual, stop decimal.Decimal } // RiskRewardRatio returns a risk reward ratio ...
order/order.go
0.853852
0.452959
order.go
starcoder
package sql // PrivilegedOperation represents an operation that requires privileges to execute. type PrivilegedOperation struct { Database string Table string Column string Privileges []PrivilegeType } // NewPrivilegedOperation returns a new PrivilegedOperation with the given parameters. func NewPrivil...
sql/privileges.go
0.657318
0.509947
privileges.go
starcoder
package util import ( "bufio" "bytes" "math" "sort" "strconv" "strings" "github.com/sajari/regression" ) func ConvertToBoundingBox(x, y float64) BeamBoundingBox { hypotenuse := math.Sqrt( math.Pow(x, 2) + math.Pow(y, 2), ) angle := math.Acos(x/hypotenuse) * 180 / math.Pi bbb, x, y := BoundingBox(hypoten...
castle/util/linear.go
0.719482
0.521532
linear.go
starcoder
package datatype import ( "fmt" "github.com/i-sevostyanov/NanoDB/internal/sql" ) type Boolean struct { value bool } func NewBoolean(v bool) Boolean { return Boolean{value: v} } func (b Boolean) Raw() interface{} { return b.value } func (b Boolean) DataType() sql.DataType { return sql.Boolean } func (b Bool...
internal/sql/datatype/boolean.go
0.720958
0.460228
boolean.go
starcoder
package model import ( "errors" ) /* The Api type exposes the exernal API to the model package. In most cases, the api methods are simple wrappers to sister methods in the model type which take care of validating the input parameters like email names and skill Uids. This frees all the other modules from checking met...
model/api.go
0.591133
0.44342
api.go
starcoder
package xrand import ( "encoding/binary" "fmt" "math" "math/bits" "time" ) // https://prng.di.unimi.it/xoshiro512plus.c type Xoshiro512p struct { s [8]uint64 } func NewXoshiro512p(seed int64) *Xoshiro512p { x := Xoshiro512p{} x.Seed(seed) return &x } func (x Xoshiro512p) State() []byte { s := make([]byte...
xoshiro512p.go
0.513425
0.461259
xoshiro512p.go
starcoder
package gopark import ( "encoding/gob" "fmt" "math" "math/rand" "strings" "time" ) type Vector []float64 type IndexedVector map[interface{}]float64 func init() { gob.Register(new(Vector)) gob.Register(new(IndexedVector)) } // Vector methods func NewZeroVector(size int) Vector { v...
vector.go
0.77569
0.658424
vector.go
starcoder
package routex import "strconv" type value string type values map[string]value // ErrEmptyValue is a error returned from number conversion functions when the // string value is empty and does not represent a number. const ErrEmptyValue = errStr("value is empty") func (v value) String() string { return string(v) }...
values.go
0.685739
0.467575
values.go
starcoder
package bytehist import "sort" // ByteHistogram is an structure that holds the information of a byte histogram. type ByteHistogram struct { Count [256]uint64 DataSize uint64 } // NewByteHistogram creates a new ByteHistogram. func NewByteHistogram() *ByteHistogram { return &ByteHistogram{} } // Init initializ...
bytehist/bytehist.go
0.777891
0.604953
bytehist.go
starcoder
package templating import ( "fmt" "strings" ) // Template represents a pattern and tags to map a metric string to a influxdb Point type Template struct { separator string parts []string defaultTags map[string]string greedyField bool greedyMeasurement bool } // apply extracts th...
internal/templating/template.go
0.767516
0.455078
template.go
starcoder
// +build !amd64 package poly1305 const ( msgBlock = uint32(1 << 24) finalBlock = uint32(0) ) // Sum generates an authenticator for msg using a one-time key and puts the // 16-byte result into out. Authenticating two different messages with the same // key allows an attacker to forge messages at will. func Sum(...
vendor/github.com/aead/poly1305/poly1305_ref.go
0.578448
0.402451
poly1305_ref.go
starcoder
package main import ( "regexp" "strconv" . "github.com/asuahsahua/advent2019/cmd/common" ) func main() { // --- Day 4: Secure Container --- // You arrive at the Venus fuel depot only to discover it's protected by a // password. The Elves had written the password on a sticky note, but // someone threw it out. ...
cmd/day04/main.go
0.572723
0.462716
main.go
starcoder
// Package math provides a mockable wrapper for math. package math import ( math "math" ) var _ Interface = &Impl{} var _ = math.Abs type Interface interface { Abs(x float64) float64 Acos(x float64) float64 Acosh(x float64) float64 Asin(x float64) float64 Asinh(x float64) float64 Atan(x float64) float64 Ata...
math/math.go
0.879522
0.691595
math.go
starcoder
package square // A [CatalogObject](#type-CatalogObject) instance of the `ITEM` type, also referred to as an item, in the catalog. type CatalogItem struct { // The item's name. This is a searchable attribute for use in applicable query filters, its value must not be empty, and the length is of Unicode code points. N...
square/model_catalog_item.go
0.817392
0.401394
model_catalog_item.go
starcoder
package math import nativeMath "math" type Vector2 struct { X float32 Y float32 } func NewDefaultVector2() *Vector2 { return NewVector2(0, 0) } func NewVector2(x float32, y float32) *Vector2 { return &Vector2{ X: x, Y: y, } } func NewVector2Inf(sign int) *Vector2 { return &Vector2{ X: float32(nativeMat...
vector2.go
0.879393
0.862872
vector2.go
starcoder
package duration import ( "fmt" "regexp" "strconv" "strings" ) var reg = regexp.MustCompile(`(\d+)([a-zA-Z]+)`) // Duration represents a period of zero or more days, weeks, months, and/or years type Duration struct { Days int Weeks int Months int Years int } // unit represents a time unit during parsing...
src/duration/duration.go
0.683208
0.471467
duration.go
starcoder
package msgraph // OnPremisesPublishingType undocumented type OnPremisesPublishingType int const ( // OnPremisesPublishingTypeVAppProxy undocumented OnPremisesPublishingTypeVAppProxy OnPremisesPublishingType = 0 // OnPremisesPublishingTypeVExchangeOnline undocumented OnPremisesPublishingTypeVExchangeOnline OnPre...
beta/OnPremisesPublishingTypeEnum.go
0.552298
0.524699
OnPremisesPublishingTypeEnum.go
starcoder
package main //Multiple functions can read from the same channel until that channel is closed; // this is called fan-out. This provides a way to distribute work amongst a group of workers to parallelize CPU use and I/O. // A function can read from multiple inputs and proceed until all are closed by multiplexing the i...
messaging/fan_in_out/main.go
0.702224
0.612426
main.go
starcoder