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 sparse import ( "math" "github.com/kzahedi/goent/discrete" "github.com/kzahedi/goent/sm" ) // ConditionalMutualInformation calculates the conditional // mutual information with the given lnFunc function for each (x_t,y_t,z_t) // I(X_t,Y_t|Z_t) = (lnFunc(p(x,y|z)) - lnFunc(p(x|z)p(y|z))) func Conditional...
discrete/state/sparse/ConditionalMutualInformation.go
0.687105
0.419232
ConditionalMutualInformation.go
starcoder
package text import ( "unicode" ) // Calculates string width to be displayed. func Width(s string, eastAsianEncoding bool, countDiacriticalSign bool, countFormatCode bool) int { l := 0 inEscSeq := false // Ignore ANSI Escape Sequence for _, r := range s { if inEscSeq { if unicode.IsLetter(r) { inEscSeq ...
vendor/github.com/mithrandie/go-text/string.go
0.573678
0.406862
string.go
starcoder
package dcl // Bool converts a bool to a *bool func Bool(b bool) *bool { return &b } // Float64 converts a float64 to *float64 func Float64(f float64) *float64 { return &f } // Float64OrNil converts a float64 to *float64, returning nil if it's empty (0.0). func Float64OrNil(f float64) *float64 { if f == 0.0 { r...
terraform/google/vendor/github.com/GoogleCloudPlatform/declarative-resource-client-library/dcl/type.go
0.897586
0.53127
type.go
starcoder
package axis import ( "math" "time" "github.com/mayowa/chart/format" "github.com/mayowa/chart/image" ) // Axis defines an axis (doh) type Axis struct { position Position format Formatter duration time.Duration grid int ticks int center bool } // Formatter is the callback interface function used...
axis/axis.go
0.736685
0.476397
axis.go
starcoder
package lttb import ( "math" ) // Point represents a Cartesian coordinate pair. type Point struct { X float64 Y float64 } // Downsample selects the most visually significant points from a series. func Downsample(data []Point, threshold int) (sampled []Point) { dataLength := len(data) if threshold >= dataLength ...
master/internal/lttb/lttb.go
0.770896
0.602091
lttb.go
starcoder
package datatypes import ( "bytes" "encoding/json" ) // EntityName is the storage structure for a UTF-8 entity name type EntityName [32]byte // StringToEntityName converts a string to an entity name data func StringToEntityName(s string) EntityName { var e EntityName b := []byte(s) copy(e[:], b) return e } //...
datatypes/string.go
0.693058
0.464355
string.go
starcoder
package graphs // Graph holds vertices and edges of a graph type Graph struct { isDirected bool vertices []node } type node struct { name interface{} edges []interface{} } const infinity = int(^uint(0) >> 1) // NewDirectedGraph is for creating a directed graph func NewDirectedGraph() *Graph { g := Graph{} ...
graphs/graph.go
0.621196
0.474449
graph.go
starcoder
package schema // ActionSchemaJSON is the content of the file "actions.schema.json". const ActionSchemaJSON = `{ "$schema": "http://json-schema.org/draft-07/schema#", "$id": "actions.schema.json#", "title": "Action Definition", "description": "Describes an action with its scope and steps to perform.", "allo...
schema/action_stringdata.go
0.816699
0.47384
action_stringdata.go
starcoder
package main import ( "github.com/ByteArena/box2d" "github.com/wdevore/RangerGo/api" "github.com/wdevore/RangerGo/engine/nodes/custom" "github.com/wdevore/RangerGo/engine/rendering" ) // BoxComponent is a box type BoxComponent struct { visual api.INode b2Body *box2d.B2Body scale float64 categoryBits uint16 ...
examples/physics/intermediate/callback_listening/box_component.go
0.730963
0.527864
box_component.go
starcoder
package esearch6 import ( "encoding/json" "fmt" "time" "github.com/olivere/elastic" "git.coinninja.net/backend/blocc/blocc" "git.coinninja.net/backend/blocc/store" ) // InsertBlock replaces a block func (e *esearch) InsertBlock(symbol string, b *blocc.Block) error { request := elastic.NewBulkIndexRequest()....
store/esearch6/block.go
0.703448
0.417984
block.go
starcoder
package geometry import ( "github.com/g3n/engine/gls" "github.com/g3n/engine/math32" "math" ) // Torus represents a torus geometry type Torus struct { Geometry // embedded geometry Radius float64 // Torus radius Tube float64 // Diameter of the torus tube RadialSegments int ...
geometry/torus.go
0.788054
0.493775
torus.go
starcoder
package topo import ( "context" "crypto/tls" "google.golang.org/grpc" "google.golang.org/grpc/credentials" "io" "testing" "github.com/onosproject/onos-topo/api/device" "github.com/stretchr/testify/assert" ) // TestDeviceService : test func (s *TestSuite) TestDeviceService(t *testing.T) { client, err := get...
test/topo/deviceservicetest.go
0.511961
0.442335
deviceservicetest.go
starcoder
package ps // List is a persistent list of possibly heterogenous values. type List interface { // IsNil returns true if the list is empty IsNil() bool // Cons returns a new list with val as the head Cons(val interface{}) List // Head returns the first element of the list; // panics if the list is empty Head()...
deepfence_agent/tools/apache/scope/vendor/github.com/weaveworks/ps/list.go
0.798344
0.483587
list.go
starcoder
package webfan import "github.com/vjeantet/bitfan/processors/doc" func (p *processor) Doc() *doc.Processor { return &doc.Processor{ Name: "webfan", ImportPath: "github.com/vjeantet/bitfan/processors/webfan", Doc: "Example\n```\ninput{\n webhook{\n uri => \"toto/titi\"\n pipeline=> \...
processors/webfan/docdoc.go
0.666605
0.498047
docdoc.go
starcoder
package model type TypeInfo struct { TypeID1 int TypeID2 int TypeID3 int TypeID4 int } func (ti TypeInfo) IsEquipment() bool { return ti.TypeID1 == 3 && ti.TypeID2 == 1 } func (ti TypeInfo) IsItem() bool { return ti.TypeID1 == 3 } func (ti TypeInfo) IsContainer() bool { return ti.TypeID1 == 3 && ti.TypeID2 =...
model/type_info.go
0.590897
0.636847
type_info.go
starcoder
package asyncpi import ( "bufio" "bytes" "io" ) // scanner is a lexical scanner. type scanner struct { r *bufio.Reader pos TokenPos } // newScanner returns a new instance of Scanner. func newScanner(r io.Reader) *scanner { return &scanner{r: bufio.NewReader(r), pos: TokenPos{Char: 0, Lines: []int{}}} } // r...
scanner.go
0.582372
0.490236
scanner.go
starcoder
package main var ( // Datacenter list is adopted from https://cloud.google.com/compute/docs/regions-zones/ // and Cloud Run regions are at https://cloud.google.com/run/docs/locations datacenters = map[string]struct { location string flagURL string // flag images must be public domain, as SVG, ideally from Wik...
datacenters.go
0.544559
0.472197
datacenters.go
starcoder
package main import "sync" // LargestFreeAI is an AI which navigates the player in the direction of the largest free area (calculated as a line from the current position). type LargestFreeAI struct { l sync.Mutex i chan string } // GetChannel receives the answer channel. func (lf *LargestFreeAI) GetChannel(c cha...
ai_largestfree.go
0.502197
0.458712
ai_largestfree.go
starcoder
package it import ( "gonum.org/v1/gonum/mat" ) // Emperical1D is an empirical estimator for a one-dimensional // probability distribution func Emperical1D(d []int) mat.Vector { max := 0 for _, v := range d { if v > max { max = v } } max++ c := make([]float64, max, max) l := float64(len(d)) for _, v ...
stat/it/probabilityestimators.go
0.60778
0.482978
probabilityestimators.go
starcoder
package types import ( "bytes" "encoding/hex" "encoding/json" "errors" "math/big" "time" ) // BxBlockTransaction represents a tx in the BxBlock. type BxBlockTransaction struct { hash SHA256Hash content []byte } // NewBxBlockTransaction creates a new tx in the BxBlock. This transaction is usable for compre...
types/bxblock.go
0.810066
0.415492
bxblock.go
starcoder
package main import ( "github.com/ByteArena/box2d" "github.com/wdevore/RangerGo/api" "github.com/wdevore/RangerGo/engine/nodes/custom" ) // FenceComponent represents both the visual and physic components type FenceComponent struct { bottom api.INode right api.INode top api.INode left api.INode b2Body ...
examples/physics/intermediate/target_tracking/fence_component.go
0.675229
0.4206
fence_component.go
starcoder
package solar import ( "container/list" "math" "image/color" "github.com/golang/geo/r2" ) // PlanetIndex used to reference array of all planets type PlanetIndex int // Planet indexes const ( Sun PlanetIndex = 0 Mercury PlanetIndex = 1 Venus PlanetIndex = 2 Earth PlanetIndex = 3 Mars...
solar/solarSystem.go
0.709019
0.48987
solarSystem.go
starcoder
package stats import ( "fmt" "math" "sync" ) var defaultCutoffs = []float64{ .005, .01, .025, .05, .1, .25, .5, 1., 2.5, 5., 10., math.Inf(0), } type HistogramValue struct { Tags map[string]string Count int64 Sum float64 Buckets []Bucket } type HistogramVectorGetter interface { Labels() [...
vendor/github.com/upfluence/stats/histogram.go
0.545286
0.471345
histogram.go
starcoder
package math import ( "errors" ) type Matrix4 struct { M11, M12, M13, M14 float32 M21, M22, M23, M24 float32 M31, M32, M33, M34 float32 M41, M42, M43, M44 float32 } func NewMatrix4() *Matrix4 { return &Matrix4{} } func NewIdentityMatrix4() *Matrix4 { return &Matrix4{ M11: 1.0, M22: 1.0, M33: 1.0, M44...
matrix4.go
0.808294
0.54583
matrix4.go
starcoder
package partial import ( "errors" "fmt" "reflect" ) // structField defines the structure of a struct field. name = field name, tag = tag value type structField struct { name string tag string index int } // Partials interface allows for custom types. // If the value type isn't of Go's basic types, implement...
reflect.go
0.673084
0.478224
reflect.go
starcoder
package create import ( "encoding/json" "testing" "time" "github.com/infracloudio/botkube/pkg/config" "github.com/infracloudio/botkube/pkg/utils" "github.com/infracloudio/botkube/test/e2e/env" testutils "github.com/infracloudio/botkube/test/e2e/utils" "github.com/nlopes/slack" "github.com/stretchr/testify/as...
test/e2e/notifier/create/create.go
0.646349
0.666638
create.go
starcoder
package geos /* #include "geos.h" */ import "C" import ( "errors" "runtime" ) // PGeometry represents a "prepared geometry", a type of geometry object that is // optimized for a limited set of operations. type PGeometry struct { p *C.GEOSPreparedGeometry } // PrepareGeometry constructs a prepared geometry from a...
vendor/github.com/paulsmith/gogeos/geos/prepared.go
0.823364
0.425009
prepared.go
starcoder
package parser import ( "io" "github.com/zoncoen/scenarigo/template/ast" "github.com/zoncoen/scenarigo/template/token" ) // Parser represents a parser. type Parser struct { s *scanner cal *posCalculator pos int tok token.Token lit string errors Errors } // NewParser returns a new parser. f...
template/parser/parser.go
0.617859
0.435121
parser.go
starcoder
package bfv import ( "github.com/ldsec/lattigo/ring" ) // GaloisGen is an integer of order N/2 modulo M and that spans Z_M with the integer -1. The j-th ring automorphism takes the root zeta to zeta^(5j). // Any other integer or order N/2 modulo M and congruent with 1 modulo 4 could be used instead. const GaloisGen ...
bfv/bfv.go
0.687735
0.42471
bfv.go
starcoder
package ACO import ( "fmt" "math" "math/rand" ) // Checks if the output is correct. func isCorrect(output float64, expectedOutput float64, functionCall string) { if output != expectedOutput { fmt.Printf("%v : %v, Expected: %v\n", functionCall, output, expectedOutput) } } // Generates a graph with random weigh...
main.go
0.720172
0.454593
main.go
starcoder
package sign import ( "errors" "fmt" "github.com/drand/kyber" "github.com/drand/kyber/pairing" ) // Mask is a bitmask of the participation to a collective signature. type Mask struct { mask []byte publics []kyber.Point } // NewMask creates a new mask from a list of public keys. If a key is provided, it // ...
vendor/github.com/drand/kyber/sign/mask.go
0.752922
0.44348
mask.go
starcoder
package goluhn /* Package goluhn provides own implementation of Luhn algo checksum checking for given number and some related functions. These functions are: // LuhnInRange returns a slice of integers with correct Lun checksum in given range func LuhnInRange(start, end int) []int {} // LuhnByLen returns random i...
goluhn.go
0.710729
0.41401
goluhn.go
starcoder
package neko import ( lexer "github.com/hedarikun/neko/lexer" ) type Node interface { TokenLiteral() string } type Statement interface { Node statementNode() } type Expression interface { Node expressionNode() } type Program struct { Statements []Statement } type LetStatement struct { Token lexer.Token M...
ast/ast.go
0.667798
0.426799
ast.go
starcoder
package commitment import ( "encoding/binary" "math/big" "../group" ) //NewElGamalFactory creates a new ElGamal-type Commitments factory func NewElGamalFactory(h group.Elem) *ElGamalFactory { egf := &ElGamalFactory{h: h} egf.neutral = egf.Create(big.NewInt(0), big.NewInt(0)) return egf } //ElGamalFactory is a...
poc/tecdsa/pkg/crypto/commitment/commitment.go
0.694199
0.432902
commitment.go
starcoder
package ansigo import ( "fmt" "strings" ) // capabilityCheck builds an object testing out every ANSI capability that // gotui knows about. func capabilityCheck() check { test := map[string][]string{ "8 Color": make([]string, 8), "8 Color - Bright": make([]string, 8), "256 Color": make([]strin...
capability_check.go
0.571408
0.404566
capability_check.go
starcoder
package main // @docs.go contains the how to use this worker service. which is accessible from the root web interface. const version = " <jobs-worker-service> β€’ version 1.1 By <NAME>" const webv1docs = ` $$\ $$\ ...
docs.go
0.516108
0.566978
docs.go
starcoder
package main import ( "fmt" "strconv" s "strings" "github.com/theatlasroom/advent-of-code/go/utils" ) /** --- Day 2: Dive! --- Now, you need to figure out how to pilot this thing. It seems like the submarine can take a series of commands like forward 1, down 2, or up 3: forward X increases the horizontal ...
go/2021/2.go
0.720958
0.756852
2.go
starcoder
package serving import ( "fmt" "reflect" "github.com/Applifier/go-tensorflow/types/tensorflow/core/framework" ) // Tensor a tensorflow tensor type Tensor = framework.TensorProto // TensorMap map of tensors type TensorMap = map[string]*framework.TensorProto // Shape tensor shape type Shape = framework.TensorShap...
serving/tensor.go
0.520009
0.662998
tensor.go
starcoder
package math import ( "errors" ) type Matrix3 struct { M11, M12, M13 float32 M21, M22, M23 float32 M31, M32, M33 float32 } func NewMatrix3(m11, m12, m13, m21, m22, m23, m31, m32, m33 float32) *Matrix3 { return &Matrix3{m11, m12, m13, m21, m22, m23, m31, m32, m33} } func NewIdentityMatrix3() *Matrix3 { return ...
matrix3.go
0.880502
0.710727
matrix3.go
starcoder
package main import ( "log" "os" "strconv" "github.com/TomasCruz/projecteuler" ) /* Problem 25; 1000-digit Fibonacci number The Fibonacci sequence is defined by the recurrence relation: Fn = Fnβˆ’1 + Fnβˆ’2, where F1 = 1 and F2 = 1. Hence the first 12 terms will be: F1 = 1 F2 = 1 F3 = 2 F4 = ...
001-100/021-030/025/main.go
0.548674
0.479077
main.go
starcoder
package db import ( "github.com/alecthomas/participle" "github.com/alecthomas/participle/lexer" ) var schemaLexer = lexer.Must(lexer.Regexp(`(?P<Newline>\n)` + `|(?m)(\s+)` + `|(#.*$)` + `|(?P<Keyword>struct)` + `|(?P<Ident>[\p{L}\p{M}_-][\p{L}\p{M}\d_-]*)` + `|(?P<Punctuation>[:{}\[\]<>])`, )) // SchemaParse...
db/schema.go
0.627152
0.425307
schema.go
starcoder
package main import "math" // Evaluator is the default evaluator to be used across the neural network var Evaluator = &DefaultEvaluator{} // DefaultEvaluator is the default evaluator for our neural networks type DefaultEvaluator struct{} // AdjustLayer performs the actual fine tuning of the current layer given a ba...
evaluator.go
0.77081
0.562777
evaluator.go
starcoder
package gollection const defaultElementsSize = 10 func ArrayListOf[T any](elements ...T) ArrayList[T] { var size = len(elements) var list = MakeArrayList[T](size) copy(list.inner.elements, elements) list.inner.size = size return list } func MakeArrayList[T any](capacity int) ArrayList[T] { if capacity < defaul...
array_list.go
0.624752
0.444565
array_list.go
starcoder
package datum import ( "fmt" "sync/atomic" "time" ) // Type describes the type of value stored in a Datum. type Type int const ( // Int describes an integer datum Int Type = iota // Float describes a floating point datum Float ) func (t Type) String() string { switch t { case Int: return "Int" case Flo...
metrics/datum/datum.go
0.865395
0.519704
datum.go
starcoder
package basic import ( "bytes" "github.com/zhukovaskychina/xmysql-server/util" "strconv" ) type BigIntValue struct { value []byte } func (b BigIntValue) ToDatum() Datum { panic("implement me") } func (b BigIntValue) ToString() string { uint := util.ReadUB8Byte2Long(b.value) return strconv.FormatUint(uint, 10...
server/innodb/basic/bigint_value.go
0.58439
0.459137
bigint_value.go
starcoder
package hexutil import ( "errors" "fmt" "math" "math/big" "regexp" "strconv" "strings" "github.com/coming-chat/wallet-SDK/util/mathutil" ) var ( // Prefix hex prefix Prefix = "0x" // ErrInvalidHex is error for invalid hex ErrInvalidHex = errors.New("invalid hex") ) // HasPrefix tests for the existence ...
util/hexutil/hexutil.go
0.823186
0.45181
hexutil.go
starcoder
package models import ( i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91 "github.com/microsoft/kiota-abstractions-go/serialization" ) // UserExperienceAnalyticsWorkFromAnywhereHardwareReadinessMetric type UserExperienceAnalyticsWorkFromAnywhereHardwareReadinessMetric struct { Entity // T...
models/user_experience_analytics_work_from_anywhere_hardware_readiness_metric.go
0.654784
0.442034
user_experience_analytics_work_from_anywhere_hardware_readiness_metric.go
starcoder
package gofromto import ( "errors" "fmt" "regexp" "strconv" "strings" ) //go:generate go run ./conversions/generate.go // Measure holds the information on the amount and unit of a measure and allows conversions type Measure struct { Amount float64 Unit Unit Name string Imprecise bool } // NewM...
measure.go
0.760473
0.567218
measure.go
starcoder
package asserts import ( "Tiny-Godis/interface/redis" "Tiny-Godis/lib/utils" "Tiny-Godis/redis/reply" "fmt" "runtime" "testing" ) // AssertIntReply checks if the given redis.Reply is the expected integer func AssertIntReply(t *testing.T, actual redis.Reply, expected int) { intResult, ok := actual.(*reply.IntR...
redis/reply/asserts/assert.go
0.606149
0.542318
assert.go
starcoder
package main import ( "math" "math/rand" ) const deg = math.Pi / 180 type measurement []float64 // A magnetometer measurement like [m1, m2, m3] type direction []float64 // Angles pointing in a direction like [theta, phi], in degrees type measurer func(a direction) (m measurement) // makeRandomMeasurer creates a...
cmd/websim/measurer.go
0.73678
0.75158
measurer.go
starcoder
package assertjson import ( "bytes" "encoding/json" "errors" "fmt" "reflect" "strings" "github.com/bool64/shared" "github.com/stretchr/testify/assert" "github.com/yudai/gojsondiff" "github.com/yudai/gojsondiff/formatter" ) // Comparer compares JSON documents. type Comparer struct { // IgnoreDiff is a valu...
equal.go
0.71113
0.487429
equal.go
starcoder
package crf import ( "github.com/nlpodyssey/spago/ag" "github.com/nlpodyssey/spago/mat" ) // ViterbiStructure implements Viterbi decoding. type ViterbiStructure[T mat.DType] struct { scores mat.Matrix[T] backpointers []int } // NewViterbiStructure returns a new ViterbiStructure ready to use. func NewViter...
nn/crf/viterbi.go
0.747616
0.555435
viterbi.go
starcoder
package column import ( "bytes" "encoding/binary" "strconv" "strings" "github.com/RoaringBitmap/roaring" "github.com/bytehouse-cloud/driver-go/driver/lib/bytepool" "github.com/bytehouse-cloud/driver-go/driver/lib/ch_encoding" ) var bitmapZeroValue = []uint64{} // BitMapColumnData // Data representation is a...
driver/lib/data/column/bitmap.go
0.606732
0.476032
bitmap.go
starcoder
package finnhub import ( "encoding/json" ) // ForexCandles struct for ForexCandles type ForexCandles struct { // List of open prices for returned candles. O *[]float32 `json:"o,omitempty"` // List of high prices for returned candles. H *[]float32 `json:"h,omitempty"` // List of low prices for returned candles....
model_forex_candles.go
0.741112
0.500183
model_forex_candles.go
starcoder
package robot import ( "errors" "math" ) // Robot contains the configuration and state of the delta robot type Robot struct { BaseRadius float64 `json:"BaseRadius"` BicepLength float64 `json:"BicepLength"` ForearmLength float64 `json:"ForearmLength"` EndEffectorRadius float64 `json:"End...
pkg/robot/robot.go
0.857171
0.527073
robot.go
starcoder
package main // Code based on the Recursive backtracker algorithm. // https://en.wikipedia.org/wiki/Maze_generation_algorithm#Recursive_backtracker // See https://youtu.be/HyK_Q5rrcr4 as an example // YouTube example ported to Go for the Pixel library. // Created by <NAME> import ( "crypto/rand" "errors" "flag" ...
maze-generator.go
0.803444
0.413951
maze-generator.go
starcoder
package option import ( m "../measures" "github.com/phil-mansfield/gotetra/math/interpolate" "gonum.org/v1/gonum/optimize" "math" ) type Pricing func(option Option, spot m.Money, t m.Time) m.Money type Greek func(option Option, spot m.Money, t m.Time) float64 type Decision interface { EarlyExcercise(spot m.Mone...
src/option/option.go
0.600188
0.494202
option.go
starcoder
package square // Represents a bank account. For more information about linking a bank account to a Square account, see [Bank Accounts API](/docs/bank-accounts-api). type BankAccount struct { // The unique, Square-issued identifier for the bank account. Id string `json:"id"` // The last few digits of the account ...
square/model_bank_account.go
0.834339
0.489503
model_bank_account.go
starcoder
package forge import ( "image/color" "image/color/palette" ) // Helper function to compare pixel with each other func (p pixel) isSame(cP pixel) bool { isTheSameColor := false fColor := getP9RGBA var c1 color.RGBA var c2 color.RGBA c1.R, c1.G, c1.B, c1.A = fColor(p) c2.R, c2.G, c2.B, c2.A = fColor(cP) if c1...
forge/colgrad.go
0.785473
0.407392
colgrad.go
starcoder
package fp448 import "github.com/cloudflare/circl/internal/conv" // Size in bytes of an element. const Size = 56 // Elt is a prime field element. type Elt [Size]byte func (e Elt) String() string { return conv.BytesLe2Hex(e[:]) } // p is the prime modulus 2^448-2^224-1 var p = Elt{ 0xff, 0xff, 0xff, 0xff, 0xff, 0x...
math/fp448/fp.go
0.658857
0.516047
fp.go
starcoder
package Collection import ( "fmt" "reflect" stream "github.com/wushilin/stream" ) // Iterator for Collections type Iterator[T any] interface { // Iterator must be a stream.Iterator, which defines Next() T, bool stream.Iterator[T] // Remove last returned entry (can only be called once for every Next() call) R...
Collection/Collection.go
0.734215
0.440289
Collection.go
starcoder
package array import ( "fmt" ) // Array (Public) - Structure that defines type Array struct { size int collection []interface{} } // Init (Public) - initializes the array with whatever size is provided, This is what can be overrided by the user. func (a *Array) Init(capacity int) *Array { if capacity < 0 {...
array/array.go
0.741768
0.407098
array.go
starcoder
package gosmonaut import ( "bytes" "encoding/json" "fmt" ) // OSMType represents the type of an OSM entity. type OSMType uint8 // OSM Types: node, way, relation. const ( NodeType OSMType = 1 << iota WayType RelationType ) // OSMEntity is the common interface of all OSM entities. type OSMEntity interface { Ge...
osm_types.go
0.78968
0.431225
osm_types.go
starcoder
package binary_search /* You are given two non-empty arrays A and B consisting of N integers. These arrays represent N planks. More precisely, A[K] is the start and B[K] the end of the Kβˆ’th plank. Next, you are given a non-empty array C consisting of M integers. This array represents M nails. More precisely, C[I] is ...
binary-search/NailingPlanks.go
0.840783
0.85183
NailingPlanks.go
starcoder
package swat import ( "log" "math" ) const ( nsl = 50 // number of soilzone layers lythick = 10. // layer thickness [mm] satini = 1. // initial degree of soil saturation relative to fc minslp = 0.0001 // min CHS: channel slope secperday = 86400. hoursperday = 24. ) /* go im...
swat/constructors.go
0.599133
0.408808
constructors.go
starcoder
package gruff import ( "fmt" "github.com/google/uuid" "github.com/jinzhu/gorm" ) const ARGUMENT_TYPE_PRO_TRUTH int = 1 const ARGUMENT_TYPE_CON_TRUTH int = 2 const ARGUMENT_TYPE_PRO_STRENGTH int = 3 const ARGUMENT_TYPE_CON_STRENGTH int = 4 /* An Argument connects a Claim to another Claim or Argument That is: ...
gruff/argument.go
0.615203
0.564129
argument.go
starcoder
package maroto // Proportion represents a proportion from a rectangle, example: 16x9, 4x3... type Proportion struct { // Width from the rectangle: Barcode, image and etc Width float64 // Height from the rectangle: Barcode, image and etc Height float64 } // BarcodeProp represents properties from a barcode inside a...
properties.go
0.765856
0.72459
properties.go
starcoder
package cryptoapis import ( "encoding/json" ) // CoinsForwardingSuccessDataItem Defines an `item` as one result. type CoinsForwardingSuccessDataItem struct { // Represents the specific blockchain protocol name, e.g. Ethereum, Bitcoin, etc. Blockchain string `json:"blockchain"` // Represents the name of the block...
model_coins_forwarding_success_data_item.go
0.885551
0.404802
model_coins_forwarding_success_data_item.go
starcoder
package dot import ( "encoding/json" "strconv" "time" ) // Timestamp represents time as number of milliseconds from 1970. type Timestamp int64 const e6 = 1e6 const e3 = 1e3 var zeroTime = time.Unix(0, 0) // ToTimestamp converts from Go time to timestamp (in nanosecond). func ToTimestamp(t time.Time) Timestamp {...
be/pkg/dot/time.go
0.824002
0.481698
time.go
starcoder
package openweathermap type ForecastBase struct { DateEpochS int64 `json:"dt"` PressureHPa float64 `json:"pressure"` // Atmospheric pressure on the sea level, hPa HumidityPct float64 `json:"humidity"` // Humidity, % DewPointK float64 `json:"dew_point"` // Atmospheric temperature (varying according to pressure and ...
forecast.go
0.849019
0.533397
forecast.go
starcoder
package staque type BoolStaque []bool func NewBool() BoolStaque { return BoolStaque{} } func (staque BoolStaque) Push(xs ...bool) BoolStaque { return append(staque, xs...) } func (stk BoolStaque) Peekstk() (last bool, isempty error) { if ilast := len(stk) - 1; ilast < 0 { isempty = emptypeek } else { last ...
staque/staque_specialized.go
0.680348
0.640678
staque_specialized.go
starcoder
package roadway import ( "go-experiments/common/commonmath" "go-experiments/voxelli/geometry" "math" "github.com/go-gl/mathgl/mgl32" ) // Defines the default road type that is never in bounds type OutOfBoundsRoad struct { } func (oob OutOfBoundsRoad) InBounds(position mgl32.Vec2) bool { return false } func (...
voxelli/roadway/roadTypes.go
0.82176
0.642348
roadTypes.go
starcoder
package cluster import ( "fmt" "strconv" ) // NewIndex builds a new empty index for PodInfo. func NewIndex() *Index { return &Index{ Containers: make(Set), DaemonSets: make(Set), Deployments: make(Set), Namespaces: make(Set), Nodes: make(Set), Pods: make(Set), Running: make...
cluster/index.go
0.692122
0.407363
index.go
starcoder
package slippy import "math" func NewTile(z, x, y uint64, buffer float64, srid uint64) *Tile { return &Tile{ z: z, x: x, y: y, Buffer: buffer, SRID: srid, } } type Tile struct { // zoom z uint64 // column x uint64 // row y uint64 // buffer will add a buffer to the tile bounds. thi...
geom/slippy/tile.go
0.516595
0.436922
tile.go
starcoder
package KsanaDB import( "math" "errors" ) type aggFunc func(float64, float64, ...interface{}) float64 var fnRegistry = map[string] interface{} { "sum": func(sum float64, val float64, others ...interface{}) float64 { return sum + val }, "max": func() func(dummy float64, val fl...
Core/Aggregator.go
0.603114
0.410343
Aggregator.go
starcoder
// Package testonly contains code and data for testing Merkle trees, such as a // reference implementation of in-memory Merkle tree. package testonly import "encoding/hex" // LeafInputs returns a slice of leaf inputs for testing Merkle trees. func LeafInputs() [][]byte { return [][]byte{ hd(""), hd("00"), hd(...
testonly/constants.go
0.739328
0.449574
constants.go
starcoder
package consensus import "math" // The Difficulty is defined as the maximum target divided by the block hash. type Difficulty struct { num uint64 } func (p *Difficulty) zero() Difficulty { return Difficulty{num: 0} } // Difficulty of MIN_DIFFICULTY func (p *Difficulty) min() Difficulty { return Difficulty{num: ...
core/consensus/types.go
0.866373
0.447158
types.go
starcoder
package lexer import ( "io" ) // BufferedReader describes the interface for a buffered reader, that stores // the read contents in a buffer until it gets reset. type BufferedReader interface { // StartPos returns the position of the total input since the last reset. StartPos() int // CurrPos returns the current ...
lexer/reader.go
0.771672
0.493409
reader.go
starcoder
package callback import ( "encoding/binary" "io" "math" ) // WriteFn is a function type that writes the provided samples to the // specified io.Writer. It returns the number of bytes written and a non-nil // error if an error is encountered during write. type WriteFn func(out io.Writer, x []int16) (int, error) /...
helpers/callback/write.go
0.694199
0.487124
write.go
starcoder
package ast import ( "fmt" "strings" "github.com/genelet/sqlproto/xast" "github.com/akito0107/xsqlparser/sqlast" "github.com/akito0107/xsqlparser/sqltoken" ) func xposTo(pos sqltoken.Pos) *xast.Pos { return &xast.Pos{ Line:int32(pos.Line), Col:int32(pos.Col)} } func posTo(pos *xast.Pos) sqltoken.Pos { re...
ast/basic.go
0.526586
0.588771
basic.go
starcoder
package scene import "github.com/mokiat/gomath/dprec" type Segment struct { Left VerticalLine Right VerticalLine Normal dprec.Vec3 Lines []Line TextureName string } func (s Segment) Middle() VerticalLine { return VerticalLine{ X: (s.Left.X + s.Right.X) / 2.0, Z: (s.Left.Z + s.Right....
cmd/softgfx-lvlgen/internal/scene/segment.go
0.728072
0.440168
segment.go
starcoder
package vida import ( "bytes" "fmt" "strconv" ) // Value interface models the inteface for all Vida Values. type Value interface { TypeName() string Description() string Equals(Value) bool BinaryOp(byte, Value) (Value, error) PrefixOp(byte) (Value, error) IsIterable() bool MakeIterator() Iterator IsHashabl...
vida/value.go
0.774328
0.405096
value.go
starcoder
package knot import ( "errors" "fmt" ) // Orientation values: East, North, West, South. const ( E Orientation = iota N W S // Orientations used for crosses: EN // E over N NW // N over W WS // W over S SE // S over E ES // E over S NE // N over E WN // W over N SW // S over W // Used to clamp values...
go/knot/coding.go
0.773045
0.559471
coding.go
starcoder
package math import ( nativeMath "math" ) type Vector3 struct { Vector2 Z float32 } func NewDefaultVector3() *Vector3 { return NewVector3(0, 0, 0) } func NewVector3(x float32, y float32, z float32) *Vector3 { return &Vector3{ Vector2: *NewVector2(x, y), Z: z, } } func NewVector3Inf(sign int) *Vecto...
vector3.go
0.794704
0.83622
vector3.go
starcoder
package log import ( "encoding/json" "fmt" "strings" ) var ( _ WatcherHandler = (*assertBaseHandler)(nil) _ WatcherHandler = (*assertContainsHandler)(nil) _ WatcherHandler = (*assertJSONContainsHandler)(nil) _ WatcherHandlerFactory = (*assertBaseFactory)(nil) _ WatcherHandlerFactory = (*a...
go/oasis-test-runner/log/handlers.go
0.67694
0.425725
handlers.go
starcoder
package xdr // TimeBounds extracts the timebounds (if any) from the transaction's // Preconditions. func (tx *Transaction) TimeBounds() *TimeBounds { switch tx.Cond.Type { case PreconditionTypePrecondNone: return nil case PreconditionTypePrecondTime: return tx.Cond.TimeBounds case PreconditionTypePrecondV2: ...
xdr/transaction.go
0.761006
0.521532
transaction.go
starcoder
package main import ( "fmt" "math/rand" "os" "time" ) var commandsDescription = map[string]string{ "partition": "split a dataset file into more smaller files", "heatmap": "creates a heatmap of the datasets according to their accuracy", "similarities": "calculates and stores the similarity matrix of ...
data-profiler-utils/main.go
0.523908
0.561395
main.go
starcoder
package transform import ( "fmt" "math" "github.com/pzduniak/unipdf/common" ) // Matrix is a linear transform matrix in homogenous coordinates. // PDF coordinate transforms are always affine so we only need 6 of these. See newMatrix. type Matrix [9]float64 // IdentityMatrix returns the identity transform. func I...
bot/vendor/github.com/pzduniak/unipdf/internal/transform/matrix.go
0.930742
0.711706
matrix.go
starcoder
package scanner import ( "bufio" "bytes" "io" "os" "strconv" "github.com/lukasmalkmus/spl/internal/app/spl/token" ) var eof = rune(0) // Scanner represents a lexical scanner which tokenizes source code. type Scanner struct { r *bufio.Reader pos token.Position resetColumnCount bo...
internal/app/spl/scanner/scanner.go
0.675444
0.401043
scanner.go
starcoder
package audio import "syscall/js" // https://developer.mozilla.org/en-US/docs/Web/API/AudioParam type AudioParam struct { value js.Value } func (param AudioParam) Default() float64 { return param.value.Get("defaultValue").Float() } func (param AudioParam) Max() float64 { return param.value.Get("maxValue").Float(...
audio/audio_param.go
0.877299
0.421492
audio_param.go
starcoder
package termui import "strings" /* Table is like: β”ŒAwesome Table ────────────────────────────────────────────────┐ β”‚ Col0 | Col1 | Col2 | Col3 | Col4 | Col5 | Col6 | │──────────────────────────────────────────────────────────────│ β”‚ Some Item #1 | AAA | 123 | CCCCC | EEEEE | GGGGG | IIIII | │─────...
vendor/github.com/gizak/termui/table.go
0.708918
0.486027
table.go
starcoder
package main import ( "fmt" "os" "strings" "text/template" "github.com/aquasecurity/cfsec/internal/app/cfsec/rules" ) const ( baseWebPageTemplate = `--- title: {{$.Summary}} shortcode: {{$.ShortCode}} summary: {{$.Summary}} permalink: /docs/{{$.Service}}/{{$.ShortCode}}/ --- ### Explanation {{$.Explanation}...
cmd/cfsec-docs/webpage.go
0.661923
0.617657
webpage.go
starcoder
package manuals // Gif is the man page for `<prefix>man gif` const gif string = ` Gif(1) User Commands Gif(1) NAME gif - Selects a random gif to display based off the user's input. SYNOPSIS <prefix>gif [tag] DESCRIPTION Gif returns to the requester a single giy based off the input tag pr...
manuals/manpages.go
0.560734
0.502686
manpages.go
starcoder
package check import ( "fmt" "time" ) // Duration is the type of a check function which takes a time.Duration // parameter and returns an error or nil if the check passes type Duration func(d time.Duration) error // DurationGT returns a function that will check that the value is // greater than the limit func Dura...
check/duration.go
0.766206
0.566738
duration.go
starcoder
package output import ( "context" "errors" "fmt" "time" "github.com/Jeffail/benthos/v3/lib/log" "github.com/Jeffail/benthos/v3/lib/metrics" "github.com/Jeffail/benthos/v3/lib/types" ) //------------------------------------------------------------------------------ func init() { Constructors[TypeResource] = ...
lib/output/resource.go
0.591841
0.704697
resource.go
starcoder
package server import ( "errors" "github.com/influxdata/influxdb-client-go/v2/api/query" ) func MeasurementFromRecord(r *query.FluxRecord) (Measurement, error) { if r == nil { return nil, errors.New("nil record") } switch r.Field() { case "pressure": return pressureMeasurementFromRecord(r) case "humidity...
server/record_processing.go
0.742515
0.46478
record_processing.go
starcoder
package gm import ( "github.com/cpmech/gosl/la" "github.com/cpmech/gosl/utl" ) // Metrics holds data related to a position in a space represented by curvilinear coordinates type Metrics struct { U la.Vector // reference coordinates {r,s,t} X la.Vector // physical coordinates {x,y,z} ...
gm/metrics.go
0.506103
0.543772
metrics.go
starcoder
package floats import ( "github.com/chewxy/math32" ) // MatZero fills zeros in a matrix of 32-bit floats. func MatZero(x [][]float32) { for i := range x { for j := range x[i] { x[i][j] = 0 } } } // Zero fills zeros in a slice of 32-bit floats. func Zero(a []float32) { for i := range a { a[i] = 0 } } ...
floats/floats.go
0.775477
0.518241
floats.go
starcoder
package bin import ( "encoding/binary" "io" "reflect" "strconv" "strings" ) type tag string func (t tag) nonEmpty() bool { return len(t) > 0 } type tags reflect.StructTag func (t tags) hex() tag { return tag(reflect.StructTag(t).Get("hex")) } func (t tags) cond() tag { return tag(reflect.StructTag(t).Get(...
bin.go
0.539954
0.45175
bin.go
starcoder
package LeetCode type MyCircularDeque struct { f, r *node len, cap int } type node struct { value int pre, next *node } /** Initialize your data structure here. Set the size of the deque to be k. */ func Constructor(k int) MyCircularDeque { return MyCircularDeque{cap: k} } /** Adds an item at the front...
06.algorithm004-02/week01/04homework/Leetcode_641_052.go
0.685739
0.478651
Leetcode_641_052.go
starcoder