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 model import ( "github.com/jesand/stats/channel/bsc" "github.com/jesand/stats/dist" "github.com/jesand/stats/factor" "github.com/jesand/stats/variable" "math" ) // Create a new MultipleBSCModel func NewMultipleBSCModel() *MultipleBSCModel { return &MultipleBSCModel{ Inputs: make(map[string]*varia...
model/multiple_bsc.go
0.705582
0.551755
multiple_bsc.go
starcoder
package dsl import ( "io" "time" ) //Entries is a list of invidiual Entry(ies) type Entries []Entry //First returns the *first* Entry that satisfies the passed in Matcher. //The second return value tells the caller if an entry was found or not func (e Entries) First(matcher Matcher) (Entry, bool) { for _, entry :...
dsl/entries.go
0.710226
0.464294
entries.go
starcoder
package egeom import ( "golang.org/x/image/math/fixed" "image" ) type Rectangle interface { X() int Y() int Width() int Height() int Equals(q Rectangle) bool TopLeft() Point TopCenter() Point TopRight() Point CenterLeft() Point Center() Point CenterRight() Point BottomLeft() Point BottomCenter() Poin...
egraphic/egeom/rectangle.go
0.828245
0.407392
rectangle.go
starcoder
package list import ( "golang.org/x/exp/constraints" ) // ValueEqual returns a function that tests equality of a with the value passed the returned function. // The primary purpose of this function is for use in ForAll or other predicates. func ValueEqual[T comparable](a T) func(T) bool { return func(b T) bool { ...
list/forAll.go
0.841468
0.676889
forAll.go
starcoder
package metrics import ( "context" "go.opencensus.io/stats" "go.opencensus.io/stats/view" ) // Recorder is our backend-independent metrics recorder. // This should be created with NewRecorder(). type Recorder struct { startPomCount *stats.Int64Measure runningPomCount *stats.Int64Measure serverCount *stat...
metrics/recorder.go
0.644449
0.431764
recorder.go
starcoder
package charlatan import "bytes" // Query is a query type Query struct { // the fields to select if condition match the object fields []*Field // the resource from wich we want to evaluate and select fields from string // the expression to evaluate on each record. The resulting constant will // always be conver...
plugins/data/parser/ql/charlatan/query.go
0.794385
0.450299
query.go
starcoder
package level import "fmt" // TileType describes the general type of a map tile. type TileType byte // Info returns the information associated with the tile type. func (t TileType) Info() TileTypeInfo { if int(t) < len(tileTypeInfoList) { return tileTypeInfoList[t] } info := tileTypeInfoList[TileTypeSolid] inf...
ss1/content/archive/level/TileType.go
0.793906
0.67633
TileType.go
starcoder
package mat //mat "gonum.org/v1/gonum/mat" /* func useless() *mat.Dense { return mat.NewDense() } */ //M64 represents a float64 matrix with r rows and c colomns type M64 struct { r int c int data []float64 } //Dims returns the number of rows and colomns func (m *M64) Dims() (int, int) { if m == nil { r...
mat64/mat.go
0.791176
0.558146
mat.go
starcoder
package samples func init() { sampleDataProposalCreateOperation[46] = `{ "expiration_time": "2016-08-30T16:33:53", "extensions": [], "fee": { "amount": 2419303, "asset_id": "1.3.0" }, "fee_paying_account": "1.2.126659", "proposed_ops": [ { "op": [ 6, { "accoun...
gen/samples/proposalcreateoperation_46.go
0.560974
0.434581
proposalcreateoperation_46.go
starcoder
package sweetiebot import ( "fmt" "sort" "strconv" "strings" "github.com/bwmarrin/discordgo" ) type CollectionsModule struct { AddFuncMap map[string]func(string) string RemoveFuncMap map[string]func(string) string } func (w *CollectionsModule) Name() string { return "Collection" } func (w *CollectionsMo...
sweetiebot/collections_command.go
0.646014
0.5526
collections_command.go
starcoder
package gofun import "reflect" // Foldable is the interface for folding. type Foldable interface { // FoldLeft folds Foldable from left side. Left folding is // calculated f(...f(f(z, xs[0]), xs[1])..., xs[n-1]). FoldLeft(f func(interface{}, interface{}) interface{}, z interface{}) interface{} // Fold...
foldable.go
0.792705
0.474996
foldable.go
starcoder
package shape import ( "fmt" "math" "strings" "github.com/fogleman/gg" "github.com/golang/freetype/raster" ) // Cubic represents a single cubic bezier curve type Cubic struct { X1, Y1 float64 X2, Y2 float64 X3, Y3 float64 X4, Y4 float64 Width float64 MinLineWidth float64 Ma...
primitive/shape/cubic.go
0.635222
0.482856
cubic.go
starcoder
package locstor import ( "bytes" "encoding/gob" "encoding/json" ) var ( // BinaryEncoding is a ready-to-use implementation of EncoderDecoder which // encodes data structures in a binary format using the gob package. BinaryEncoding = &binaryEncoderDecoder{} // JSONEncoding is a ready-to-use implementation of E...
encode.go
0.734786
0.410638
encode.go
starcoder
package destiny2 import "time" // Color represents a color with RGBA values represented between 0 and 255. type Color struct { Red, Green, Blue, Alpha byte } type AnimationReference struct { AnimName, AnimIdentifier, Path string } type HyperlinkReference struct { Title, Url string } type DyeReference struct { ...
misc.go
0.581897
0.489931
misc.go
starcoder
package parse import ( "go/ast" "strings" "github.com/ardnew/gosh/cmd/goshfun/util" ) // Return represents an individual return variable in the list of return // variables of an individual function definition. type Return struct { Name string Ref []Reference Type string } // NewReturn creates a new Return by...
cmd/goshfun/parse/return.go
0.737442
0.423577
return.go
starcoder
package main import ( "errors" "regexp" "strings" ) var ( QUOTES = []byte{'"', '\''} ALL_QUOTES = append(QUOTES, '`') ESCAPE byte = '\\' ) func getFirstLine(str string) (nextLine string) { breakLinePos := regexp.MustCompile(`\n`).FindStringIndex(str) if breakLinePos == nil { return str }...
syntax_utils.go
0.725454
0.541227
syntax_utils.go
starcoder
package ntw type ( // interface is used because of the nature of "go" language // because inheritance is managed through composition iToken interface { kind() int value() string isEmpty() bool parse() setAnd() setOrdinal() } token struct { input string pos int ordinal bool val strin...
ntw/token.go
0.63443
0.407805
token.go
starcoder
package bdf2array import ( "bytes" "fmt" "image" bdf "github.com/zachomedia/go-bdf" ) const maxNumBytesPerColumn = 4 const glyphHeaderSize = 5 // Glyph contains data for a single glyph type Glyph struct { Font *bdf.Font Codepoint int Character *bdf.Character Alpha *image.Alpha ...
glyph.go
0.690768
0.444444
glyph.go
starcoder
package draw import ( "context" "image" "image/color" "image/draw" "math" "gonum.org/v1/gonum/mat" ) func Rotate(ctx context.Context, img draw.Image, deg int) draw.Image { if deg%360 == 0 { return img } rotM := mat.NewDense(2, 2, []float64{ math.Cos(degToRad(-deg)), -math.Sin(degToRad(-deg)), math.S...
draw/transform.go
0.631708
0.506591
transform.go
starcoder
package main import ( "fmt" "math" "os" "sort" "strconv" "strings" ) type Spread struct { low int high int } func (s Spread) Contains(v int) bool { return s.low <= v && v <= s.high } func (s Spread) Surrounds(ns Spread) bool { return ns.low <= s.low && ns.high >= s.high } type Action string const ( ON...
22/main.go
0.533641
0.490785
main.go
starcoder
package main import "github.com/nsaje/dagger/dagger" type RelationalOperator int const ( LT RelationalOperator = iota GT LTE GTE ) type LogicalOperator int const ( OR LogicalOperator = iota AND ) type Node interface { eval(valueTable valueTable) (bool, map[dagger.StreamID][]float64) getLeafNodes() []LeafN...
computations/computation-alarm/tree.go
0.558086
0.400427
tree.go
starcoder
package primitives import ( "math" "math/rand" ) type Vector struct { X, Y, Z float64 } func (u Vector) RGBA() (r, g, b, a uint32) { // Sqrt() for gamma-2 correction r = uint32(math.Sqrt(u.X) * 0xffff) g = uint32(math.Sqrt(u.Y) * 0xffff) b = uint32(math.Sqrt(u.Z) * 0xffff) a = 0xffff return } var UnitVecto...
internal/primitives/vector.go
0.859531
0.558809
vector.go
starcoder
package openapi import ( "encoding/json" ) // VulnerabilityNote struct for VulnerabilityNote type VulnerabilityNote struct { Title *string `json:"Title,omitempty"` Audience *string `json:"Audience,omitempty"` Type *int32 `json:"Type,omitempty"` Ordinal *string `json:"Ordinal,omitempty"` Lang *stri...
openapi/model_vulnerability_note.go
0.761627
0.41484
model_vulnerability_note.go
starcoder
package passwordless import ( "crypto/rand" "errors" "strings" "context" ) var ( crockfordBytes = []byte("0123456789abcdefghjkmnpqrstvwxyz") ) // TokenGenerator defines an interface for generating and sanitising // cryptographically-secure tokens. type TokenGenerator interface { // Generate should return a to...
tokens.go
0.645567
0.42483
tokens.go
starcoder
package main import "fmt" import "time" import "math" import "image" import "image/color" import "image/png" import "bufio" import "os" type Vector struct { x float64 y float64 z float64 } type Color struct { r float64 g float64 b float64 } type Ray struct { start Vector dir Vector } type Intersection st...
go/RayTracer.go
0.845974
0.429968
RayTracer.go
starcoder
package convtree import ( "errors" "fmt" "github.com/google/uuid" "math" ) type ConvTree struct { ID string IsLeaf bool MaxPoints float64 MaxDepth int Depth int GridSize int ConvNum int Kernel [][]float64 Points []Poin...
conv-tree.go
0.562417
0.418637
conv-tree.go
starcoder
package test_multiassign func assert(want int, act int, code string) func println(format ...string) func strcmp(s1 string, s2 string) int func multiRet() (int, int, int, int, int, int) { return 1, 2, 3, 4, 5, 6 } func multiRetStr() (string, string, string, string, string, string) { return "abc", "def", "ghi", "jk...
testdata/multiassign.go
0.589953
0.469642
multiassign.go
starcoder
package gridon import "math" var tickTables = map[TickGroup][]struct { Lower float64 Upper float64 Tick float64 }{ TickGroupTopix100: { {Lower: 0, Upper: 1_000, Tick: 0.1}, {Lower: 1_000, Upper: 3_000, Tick: 0.5}, {Lower: 3_000, Upper: 10_000, Tick: 1}, {Lower: 10_000, Upper: 30_000, Tick: 5}, {Lower: ...
tick.go
0.565299
0.726147
tick.go
starcoder
package imaging import ( "image" ) // Rotate90 rotates the image 90 degrees counterclockwise and returns the transformed image. func Rotate90(img image.Image) *image.NRGBA { src := toNRGBA(img) srcW := src.Bounds().Max.X srcH := src.Bounds().Max.Y dstW := srcH dstH := srcW dst := image.NewNRGBA(image.Rect(0, 0...
vendor/github.com/wujiang/imaging/transform.go
0.869146
0.563858
transform.go
starcoder
package typeinfo import ( "fmt" "github.com/src-d/go-mysql-server/sql" "vitess.io/vitess/go/sqltypes" "github.com/liquidata-inc/dolt/go/store/types" ) type Identifier string const ( UnknownTypeIdentifier Identifier = "unknown" BitTypeIdentifier Identifier = "bit" BoolTypeIdentifier Identifi...
go/libraries/doltcore/schema/typeinfo/typeinfo.go
0.540681
0.420659
typeinfo.go
starcoder
package util import "strconv" import "time" const MomentLength = 32 func TimeString() string { return time.Now().UTC().String() } func ParseTimeString(timestr string) time.Time { yr, _ := strconv.Atoi(timestr[:4]) mo, _ := strconv.Atoi(timestr[5:7]) d, _ := strconv.Atoi(timestr[8:10]) hr, _ := strconv.Atoi(tim...
util/time.go
0.657758
0.455017
time.go
starcoder
package main import ( "fmt" "strconv" "strings" ) // size creates a function that returns the SSZ size of the struct. There are two components: // 1. Fixed: Size that we can determine at compilation time (i.e. uint, fixed bytes, fixed vector...) // 2. Dynamic: Size that depends on the input (i.e. lists, dynamic co...
sszgen/size.go
0.703448
0.487307
size.go
starcoder
package gonatsd import ( "strings" ) // Trie - prefix tree. type Trie struct { root *trieNode sep string nodes int values int } type trieNode struct { Name string Children map[string]*trieNode values []interface{} } func NewTrie(sep string) *Trie { trie := &Trie{} trie.root = &trieNode{} tri...
gonatsd/trie.go
0.501221
0.550487
trie.go
starcoder
package common import ( "bytes" "compress/gzip" "fmt" "io/ioutil" "github.com/klauspost/compress/snappy" "github.com/n1chre/minio/pkg/s3select/internal/parquet-go/gen-go/parquet" "github.com/pierrec/lz4" ) // ToSliceValue converts values to a slice value. func ToSliceValue(values []interface{}, parquetType pa...
pkg/s3select/internal/parquet-go/common/common.go
0.604516
0.465448
common.go
starcoder
package datatype import ( "database/sql/driver" "encoding/json" "errors" "fmt" "math" "github.com/go-gl/mathgl/mgl32" "github.com/mysll/toolkit" ) type ObjectId uint64 type Vec3 mgl32.Vec3 var ( Forward = Vec3{0, 0, 1} Back = Vec3{0, 0, -1} Up = Vec3{0, 1, 0} Down = Vec3{0, -1, 0} Left = ...
common/datatype/type.go
0.626581
0.436622
type.go
starcoder
package aiplatform import ( context "context" cmpopts "github.com/google/go-cmp/cmp/cmpopts" codes "google.golang.org/grpc/codes" status "google.golang.org/grpc/status" proto "google.golang.org/protobuf/proto" protocmp "google.golang.org/protobuf/testing/protocmp" fieldmaskpb "google.golang.org/protobuf/types/...
proto/gen/googleapis/cloud/aiplatform/v1/specialist_pool_service_aiptest.pb.go
0.560974
0.496155
specialist_pool_service_aiptest.pb.go
starcoder
package bebras_guard import ( "sync" "time" ) // Implements a very simple and approximate leaky bucket algorithm. // To keep it simple, each request will wait for a duration depending on the // number of other requests waiting ; and the bucket will leak at regular // intervals, independently of when the requests...
leaky_bucket.go
0.615781
0.435721
leaky_bucket.go
starcoder
package util import ( "fmt" "reflect" "github.com/pkg/errors" ) var floatType = reflect.TypeOf(float64(0)) var intType = reflect.TypeOf(int64(0)) var stringType = reflect.TypeOf("") var boolType = reflect.TypeOf(false) // AsFloat64 attempts to convert unk to a float64 func AsFloat64(unk interface{}) (float64, er...
pkg/util/types.go
0.610802
0.489564
types.go
starcoder
package week6 import ( "crypto/rsa" "errors" "math/big" ) func isSquareNumber(n *big.Int) (bool, *big.Int) { sqrtFloor := new(big.Int).Sqrt(n) squareSqrtFloor := new(big.Int).Mul(sqrtFloor, sqrtFloor) return squareSqrtFloor.Cmp(n) == 0, sqrtFloor } // FactorCloselyFactorSemiPrime finds p, q such that // N = p*...
week6/week6.go
0.768299
0.519217
week6.go
starcoder
package mint import ( "fmt" sdk "github.com/ftlnetwork/ftlnetwork-sdk/types" ) // Minter represents the minting state type Minter struct { Inflation sdk.Dec `json:"inflation"` // current annual inflation rate AnnualProvisions sdk.Dec `json:"annual_provisions"` // current annual expected provisions...
x/mint/minter.go
0.806281
0.441613
minter.go
starcoder
package trier import ( "math/rand" "time" ) // Iterator defines parameters to create new delay. type Iterator interface { Next() (time.Duration, bool) } // Iterable defines parameters to create new iterator. type Iterable interface { Iterator() Iterator } type constant time.Duration func (i constant) Next() (t...
iterator.go
0.775562
0.414069
iterator.go
starcoder
package goment import ( "time" ) // Diff returns the difference between two Goments as an integer. func (g *Goment) Diff(args ...interface{}) int { numArgs := len(args) if numArgs > 0 { units := "" input, err := New(args[0]) if err != nil { return 0 } if numArgs > 1 { if parsedUnits, ok := args[1...
display.go
0.815526
0.467514
display.go
starcoder
package main import "fmt" // PieceCount is the count of mens and kings type PieceCount struct { men [2]int kings [2]int } // Opposition is the other player func Opposition(player int) int { if player == 1 { return 2 } return 1 } // Direction says if "forward" is up or down the board. This allows us to // u...
board.go
0.750095
0.613121
board.go
starcoder
package mdc import ( "strconv" "github.com/hexops/vecty" ) // Series interface is meant to be used with the DataTable // component for displaying structured data. type Series interface { // Head is the title of the data. Head() string // Kind Kind() DataKind AtRow(i int) vecty.MarkupOrChild } type DataKind i...
series.go
0.650023
0.460774
series.go
starcoder
package telego import ( upp "github.com/SakoDroid/telego/Parser" objs "github.com/SakoDroid/telego/objects" ) //This is the interface used for creating normal keyboards and inline keyboards. type MarkUps interface { toMarkUp() objs.ReplyMarkup } //A normal keyboard. type keyboard struct { keys ...
keyboard.go
0.52756
0.430088
keyboard.go
starcoder
// Package descriptions provides the descriptions as used by the graphql endpoint for Weaviate package descriptions // AGGREGATE const AggregateProperty = "Aggregate this property" const AggregateThings = "Aggregate Things on a local Weaviate" const AggregateActions = "Aggregate Things on a local Weaviate" const Gro...
adapters/handlers/graphql/descriptions/aggregate.go
0.771413
0.441312
aggregate.go
starcoder
package compare import ( "encoding/json" "reflect" "regexp" "sort" "github.com/yudai/gojsondiff" "github.com/yudai/gojsondiff/formatter" ) // JSONDiff represents the differences between two JSON values. type JSONDiff struct { left map[string]interface{} ds []gojsondiff.Delta } // Deltas returns Deltas tha...
json.go
0.82485
0.44571
json.go
starcoder
package sensors import ( "github.com/b3nn0/goflying/mpu9250" "github.com/kidoman/embd" ) const ( mpu9250GyroRange = 250 // mpu9250GyroRange is the default range to use for the Gyro. mpu9250AccelRange = 4 // mpu9250AccelRange is the default range to use for the Accel. mpu9250UpdateFreq = 50 // mpu9250UpdateFr...
sensors/mpu9250.go
0.673514
0.402451
mpu9250.go
starcoder
package day20 import ( "fmt" "github.com/knalli/aoc" "strconv" ) const ( DARK int32 = '.' LIGHT int32 = '#' ) func enhanceImage(input *Grid, enhancementAlgorithm string, outside int32) *Grid { output := NewGrid(input.Width()+2, input.Height()+2) for y := 0; y < output.Height(); y++ { for x := 0; x < output...
day20/puzzle.go
0.593491
0.415966
puzzle.go
starcoder
package base import ( "bytes" "fmt" "io" "math" "math/rand" "runtime" "sync" "gonum.org/v1/gonum/blas" "gonum.org/v1/gonum/blas/blas64" "gonum.org/v1/gonum/mat" ) // MatConst is a matrix where all cless have the same value type MatConst struct { Rows, Columns int Value float64 } // Dims for MatC...
base/matrix.go
0.7413
0.423458
matrix.go
starcoder
package direct import ( "fmt" "google.golang.org/protobuf/types/known/structpb" ) func MapToProtoStruct(m map[string]interface{}) (*structpb.Struct, error) { fields := map[string]*structpb.Value{} for k, v := range m { val, err := ValueToStructValue(v) if err != nil { return nil, err } fields[k] = val...
internal/proxy/direct/utils.go
0.589362
0.404272
utils.go
starcoder
package matrix import ( "math/rand" ) /* A matrix backed by a flat array of all elements. */ type DenseMatrix struct { matrix // flattened matrix data. elements[i*step+j] is row i, col j elements []float64 // actual offset between rows step int } /* Returns an array of slices referencing the matrix data. Chan...
dense.go
0.678966
0.669677
dense.go
starcoder
package processor import ( "fmt" "sync" "time" "github.com/Jeffail/benthos/v3/internal/docs" "github.com/Jeffail/benthos/v3/internal/tracing" "github.com/Jeffail/benthos/v3/lib/log" "github.com/Jeffail/benthos/v3/lib/message" "github.com/Jeffail/benthos/v3/lib/metrics" "github.com/Jeffail/benthos/v3/lib/type...
lib/processor/aws_lambda.go
0.724286
0.699973
aws_lambda.go
starcoder
package common // Len returns len of specified domain func (m *AddressMap) Len(domains ...*Domain) int { switch len(domains) { case 0: // Len of the map return len(m.GetMap()) case 1: // Len of particular domain return m.GetList(domains[0]).Len() case 2: // Len of particular domain within particular dom...
pkg/api/common/address_map.jacket.go
0.714329
0.407333
address_map.jacket.go
starcoder
package registry import ( "fmt" "github.com/sirupsen/logrus" "k8s.io/apimachinery/pkg/util/sets" ) // Type identifies the type of registry element a Node refers to type Type int const ( Workflow Type = iota Chain Reference ) var nodeTypes = [3]string{Workflow: "workflow", Reference: "reference", Chain: "cha...
pkg/registry/graph.go
0.755005
0.470189
graph.go
starcoder
package stoichiometry import ( "math" "strconv" "strings" ) // MaxFuelForOre returns the maximum amount of fuel that can be produced wih the given ore. func MaxFuelForOre(reactions string, ore int64) int64 { reactionLookup := parseReactions(reactions) oreForOneFuel := calcMinOreForFuel(reactionLookup, 1) lowe...
14-space-stoichiometry/stoichiometry/stoichiometry.go
0.802285
0.531088
stoichiometry.go
starcoder
package day10 import ( "fmt" "math" "sort" "strings" "unicode" ) type asteroid struct { x int y int } func blastAsteroids(spaceMap *[][]string, station asteroid, rounds int) (last asteroid) { removeShootNumbers(spaceMap) reachableAsteroids := getDetectedAsteroidsInternal(spaceMap, station.x, station.y) so...
go/src/day10/day10.go
0.593963
0.501282
day10.go
starcoder
package gio import ( "image" "image/color" "gioui.org/f32" "gioui.org/layout" "gioui.org/op" "gioui.org/op/clip" "gioui.org/op/paint" "github.com/tdewolff/canvas" ) type Gio struct { ops *op.Ops width, height float64 xScale, yScale float64 dimensions layout.Dimensions } // New returns a ...
renderers/gio/gio.go
0.727879
0.457743
gio.go
starcoder
package medtronic import ( "fmt" "log" "strconv" "time" ) const ( // JSONTimeLayout specifies the format for JSON time values. JSONTimeLayout = time.RFC3339 // UserTimeLayout specifies a consistent, human-readable format for local time. UserTimeLayout = "2006-01-02 15:04:05" ) type ( // Duration allows cust...
time.go
0.718002
0.492005
time.go
starcoder
package assert import ( "testing" "github.com/ppapapetrou76/go-testing/internal/pkg/values" "github.com/ppapapetrou76/go-testing/types" ) // SliceOpt is a configuration option to initialize an AssertableAny Slice. type SliceOpt func(*AssertableSlice) // AssertableSlice is the implementation of AssertableSlice fo...
assert/slice.go
0.849285
0.718051
slice.go
starcoder
package xstats import ( "io" "time" ) // Sender define an interface to a stats system like statsd or datadog to send // service's metrics. type Sender interface { // Gauge measure the value of a particular thing at a particular time, // like the amount of fuel in a car’s gas tank or the number of users // connec...
vendor/github.com/rs/xstats/sender.go
0.706292
0.531878
sender.go
starcoder
package linkedlist // Node represents a doubly linked node. As the spec states, we keep a // reference to the next and previous nodes to avoid iteration. type Node struct { next, prev *Node Value interface{} } // Next returns the next node in the list unless there is no next node (it is // the sentinel node) a...
data-structures/linked-list/linkedlist.go
0.849691
0.532
linkedlist.go
starcoder
package conf import ( "fmt" "math" "reflect" "strconv" "strings" "time" ) const ( maxUint = uint64(^uint(0)) maxInt = int64(maxUint >> 1) minInt = -maxInt - 1 ) func decode(output, input reflect.Value) error { if input.Kind() == reflect.Interface && !input.IsNil() { input = input.Elem() } switch out...
decode.go
0.633524
0.532547
decode.go
starcoder
package fmom import ( "fmt" "math" "gonum.org/v1/gonum/spatial/r3" ) // Equal returns true if p1==p2 func Equal(p1, p2 P4) bool { return p4equal(p1, p2, 1e-14) } func p4equal(p1, p2 P4, epsilon float64) bool { if cmpeq(p1.E(), p2.E(), epsilon) && cmpeq(p1.Px(), p2.Px(), epsilon) && cmpeq(p1.Py(), p2.Py(),...
fmom/ops.go
0.693888
0.485417
ops.go
starcoder
package cpualt type BusReader = func(addr uint32) uint8 type BusWriter = func(addr uint32, val uint8) type Bus struct { M uint8 // last data access // 2^10 because segments are 4bits length Read [1048576]BusReader Write [1048576]BusWriter } func (b *Bus) Init() { for i := range b.Read { b.Read[i] = func(add...
emulator/cpualt/bus.go
0.532668
0.418519
bus.go
starcoder
package main import ( "fmt" "os" "path/filepath" intoto "github.com/in-toto/in-toto-golang/in_toto" "github.com/spf13/cobra" ) var ( recordStepName string recordMaterialsPaths []string recordProductsPaths []string ) var recordCmd = &cobra.Command{ Use: "record", Short: `Creates a signed link metada...
cmd/in-toto/record.go
0.567337
0.446917
record.go
starcoder
package types import ( "context" "strconv" "github.com/MontFerret/ferret/pkg/runtime/core" "github.com/MontFerret/ferret/pkg/runtime/values" ) // ToFloat takes an input value of any type and convert it into a float value. // @param value (Value) - Input value of arbitrary type. // @returns (Float) - // None and ...
pkg/stdlib/types/to_float.go
0.737725
0.465873
to_float.go
starcoder
package tui import ( "bytes" "fmt" "image" "strconv" ) type testCell struct { Rune rune Style Style } // A TestSurface implements the Surface interface with local buffers, // and provides accessors to check the output of a draw operation on the Surface. type TestSurface struct { cells map[image.Point]testC...
testing.go
0.731538
0.50061
testing.go
starcoder
package pb // {encode,decode}{I,S,U}{32,64} // DecodeS64 reads a single 64bit zigzag varint func DecodeS64(buf []byte, next *int) int64 { return DecodeZigZag(DecodeVarInt(buf, next)) } // DecodeI64 reads a single 64bit signed varint func DecodeI64(buf []byte, next *int) int64 { return int64(DecodeVarInt(buf, next)...
internal/pb/64.go
0.709019
0.409457
64.go
starcoder
package query import ( "context" "fmt" "sort" "strconv" "strings" "github.com/Peripli/service-manager/pkg/util" "github.com/Peripli/service-manager/pkg/web" ) // Operator is a query operator type Operator string const ( // EqualsOperator takes two operands and tests if they are equal EqualsOperator Operat...
pkg/query/selection.go
0.800809
0.662305
selection.go
starcoder
package climate import ( "github.com/willbeason/worldproc/pkg/geodesic" "math" ) // Flux is the solar flux at the equator at noon. const Flux = 400 // SB is the Stefan-Boltzmann constant. const SB = 5.670374419184429453970996731889231E-8 // WD is Wien's displacement constant. //const WD = 2.8977719E-3 const Zero...
pkg/climate/temperature.go
0.803983
0.670005
temperature.go
starcoder
package histogram import ( "math" "sync" "time" tdigest "github.com/caio/go-tdigest" ) // Histogram a quantile approximation data structure type Histogram interface { Update(v float64) Distributions() []Distribution Snapshot() []Distribution Count() uint64 Quantile(q float64) float64 Max() float64 Min() f...
src/telegraf/vendor/github.com/wavefronthq/wavefront-sdk-go/histogram/histogram.go
0.788909
0.443359
histogram.go
starcoder
package matrix import ( "fmt" ) type Dense struct { v []float64 // [row, row, ..., row] numrow int numcol int stride int // The distance between vertically adjacent elements. } // AsDense makes new dense matrix that refers to v func AsDense(numrow, numcol int, v []float64) Dense { n := numrow * numcol if...
dense.go
0.800692
0.567817
dense.go
starcoder
package rangeset import ( "fmt" "github.com/biogo/store/step" ) func max(a, b int) int { if a > b { return a } return b } type _bool bool const ( _true = _bool(true) _false = _bool(false) ) func (b _bool) Equal(e step.Equaler) bool { return b == e.(_bool) } // RangeSet acts like a bitvector where the ...
rangeset/rangeset.go
0.760828
0.402774
rangeset.go
starcoder
package matchers import ( "github.com/onsi/gomega/types" "github.com/vps2/agouti/matchers/internal" ) // HaveText passes when the expected text is equal to the actual element text. // This matcher fails if the provided selection refers to more than one element. func HaveText(text string) types.GomegaMatcher { retu...
matchers/selection_matchers.go
0.896704
0.642432
selection_matchers.go
starcoder
package reflect import ( r "reflect" xr "github.com/cosmos72/gomacro/xreflect" ) type none struct{} var ( Nil = r.Value{} None = r.ValueOf(none{}) // used to indicate "no value" TypeOfInt = r.TypeOf(int(0)) TypeOfInt8 = r.TypeOf(int8(0)) TypeOfInt16 = r.TypeOf(int16(0)) TypeOfInt32 = r.TypeOf(int32(0))...
vendor/github.com/cosmos72/gomacro/base/reflect/reflect.go
0.559531
0.470858
reflect.go
starcoder
package mandira import ( "fmt" "strconv" ) /* Parser for the extended features in Mandira. word = ([a-zA-Z1-9]+) binop = <|<=|>|>=|!=|== comb = or|and unary = not filter = | variable = word string = " .* " atom = variable | string | word funcexpr = word [( atom[, atom...] )] varexpr = variable [|funcexpr...] Cond...
parser.go
0.593138
0.561696
parser.go
starcoder
package gt import ( "database/sql/driver" "fmt" "time" ) /* Shortcut for making a date from a time: inst := time.Now() date := gt.NullDateFrom(inst.Date()) Reversible: date == gt.NullDateFrom(date.Date()) Note that `gt.NullDateFrom(0, 0, 0)` returns a zero value which is considered empty/null, but NOT equiv...
gt_null_date.go
0.79158
0.553747
gt_null_date.go
starcoder
package monitoringcommon const MonitoringGrafanaDBMultitenancyDetailedJSON = `{ "annotations": { "list": [ { "builtIn": 1, "datasource": "-- Grafana --", "enable": true, "hide": true, "iconColor": "rgba(0, 211, 255, 1)", "name": "Annotations & Alerts", ...
pkg/products/monitoringcommon/dashboards/multitenancyDetailed.go
0.587588
0.4831
multitenancyDetailed.go
starcoder
package aip import ( "encoding/hex" "errors" "strconv" "strings" "github.com/bitcoinschema/go-bob" ) // NewFromTape will create a new AIP object from a bob.Tape // Using the FromTape() alone will prevent validation (data is needed via SetData to enable) func NewFromTape(tape bob.Tape) (a *Aip) { ...
protocols/go-aip/bob.go
0.57523
0.423756
bob.go
starcoder
package lexer import ( "errors" "fmt" "io" ) // TokenType indicates the type of token type TokenType int const ( // EmptyToken is token with no content (just the delim byte) EmptyToken TokenType = iota // BitsToken is a token composed of 0 and 1 BitsToken // DigitsToken is a token composed of digits (0-9) ...
lexer/lexer.go
0.736969
0.610599
lexer.go
starcoder
package config /** * Configuration for Load Balancing Virtual Server resource. */ type Lbvserver struct { /** * Name for the virtual server. Must begin with an ASCII alphanumeric or underscore (_) character, and must contain only ASCII alphanumeric, underscore, hash (#), period (.), space, colon (:), at sign (@), e...
resource/config/lbvserver.go
0.816589
0.499878
lbvserver.go
starcoder
package iso20022 // Set of elements used to provide information specific to the individual transaction(s) included in the message. type CreditTransferTransactionInformation12 struct { // Ultimate party that owes an amount of money to the (ultimate) creditor. UltimateDebtor *PartyIdentification32 `xml:"UltmtDbtr,omi...
CreditTransferTransactionInformation12.go
0.735262
0.451387
CreditTransferTransactionInformation12.go
starcoder
package asserts import ( "errors" "sync" ) type memoryBackstore struct { top memBSBranch mu sync.RWMutex } type memBSNode interface { put(assertType *AssertionType, key []string, assert Assertion) error get(key []string, maxFormat int) (Assertion, error) search(hint []string, found func(Assertion), maxFormat...
vendor/github.com/snapcore/snapd/asserts/membackstore.go
0.547948
0.419707
membackstore.go
starcoder
package geobin import ( "encoding/binary" "github.com/tidwall/tile38/geojson" "github.com/tidwall/tile38/geojson/geohash" ) type BBox struct { Min, Max Position } // WithinBBox detects if the object is fully contained inside a bbox. func (g Object) WithinBBox(bbox BBox) bool { return g.bridge().WithinBBox(geoj...
bridge.go
0.76999
0.621713
bridge.go
starcoder
package version const dataTable = `[ { "vid": 1, "name": "LIFX", "defaults": { "hev": false, "color": false, "chain": false, "matrix": false, "relays": false, "buttons": false, "infrared": false, "multizone": false, "temperature_range": null, "e...
lifx/version/data.go
0.714728
0.45308
data.go
starcoder
package main import ( "os" "math" "errors" "fmt" "database/sql" _ "github.com/mattn/go-sqlite3" ) // Store a geolocation type Location struct { lat float64 long float64 } // Helper function to take care of errors func handleErrors(err error) { if err != nil { panic(err) } } // Converts degre...
thorney_distance.go
0.873134
0.421552
thorney_distance.go
starcoder
package three //go:generate go run geometry_method_generator/main.go -geometryType ConeGeometry -geometrySlug cone_geometry import ( "math" "github.com/gopherjs/gopherjs/js" ) // ConeGeometry a class for generating Cone geometries. type ConeGeometry struct { *js.Object Radius float64 `js:"radius"` Hei...
geometries_cone_geometry.go
0.798108
0.497986
geometries_cone_geometry.go
starcoder
package geometry import ( "fluorescence/shading" "math" "math/rand" ) // Vector is a 3D vector type Vector struct { X float64 `json:"x"` Y float64 `json:"y"` Z float64 `json:"z"` } // VectorZero references the zero vector var VectorZero = Vector{} // VectorMax references the maximum represen...
geometry/vector.go
0.925394
0.679797
vector.go
starcoder
package ltsv import ( "bytes" "golang.org/x/xerrors" ) type ( // Field is a struct to hold label-value pair. Field struct { Label string Value string } // Parser is for parsing LTSV-encoded format. Parser struct { // FieldDelimiter is the delimiter of fields. It defaults to '\t'. FieldDelimiter byte ...
parser.go
0.650467
0.446495
parser.go
starcoder
package runtime import ( "math" "github.com/apmckinlay/gsuneido/util/dnum" "github.com/apmckinlay/gsuneido/util/regex" ) var ( Zero Value = SuInt(0) One Value = SuInt(1) MaxInt Value = SuDnum{Dnum: dnum.FromInt(math.MaxInt32)} Inf Value = SuDnum{Dnum: dnum.PosInf} NegInf Value = SuDnum{Dnum: dnum.Ne...
runtime/ops.go
0.528047
0.59561
ops.go
starcoder
package token type ( Token interface { VisitToken(TokenVisitor) } TokenVisitor struct { Ident func(Ident) Function func(Function) AtKeyword func(AtKeyword) Hash func(Hash) String func(String) Url func(Url) Delim func(Delim) Number func(Number) Percentag...
pkg/asset/css/token/token.go
0.607547
0.515315
token.go
starcoder
package zplgfa import ( "encoding/hex" "fmt" "image" "image/color" "math" "strings" ) // GraphicType is a type to select the graphic format type GraphicType int const ( // ASCII graphic type using only hex characters (0-9A-F) ASCII GraphicType = iota // Binary saving the same data as binary Binary // Comp...
zplgfa.go
0.689619
0.440168
zplgfa.go
starcoder
package query // The nodeLinkI interface provides an interface to allow nodes to be linked in a parent child chain type nodeLinkI interface { setChild(NodeI) setParent(NodeI) getParent() NodeI getChild() NodeI copy() NodeI // all linkable nodes must be copyable } // The nodeLink is designed to be a mixin for the...
pkg/orm/query/nodeLink.go
0.679391
0.409339
nodeLink.go
starcoder
package utils import ( "strconv" "strings" "time" ) const TIME_LAYOUT_OFTEN = "2006-01-02 15:04:05" // DateFormat pattern rules. var datePatterns = []string{ // year "Y", "2006", // A full numeric representation of a year, 4 digits Examples: 1999 or 2003 "y", "06", //A two digit representation of a year Ex...
time.go
0.6488
0.440289
time.go
starcoder
package main import ( "fmt" "sort" "strconv" ) // Graph defines the structure for our graph type Graph struct { Edges []*Edge Nodes map[*Node]bool } // Edge defines a struct used to build Edges type Edge struct { Parent *Node Child *Node Cost int } // Node defines a struct used to build a Node type Node ...
algorithms/gr-dij/golang/dijkstras_algorithm.go
0.703855
0.52275
dijkstras_algorithm.go
starcoder
package store import ( "database/sql" "github.com/hashicorp/go-multierror" ) // ScanStrings scans a slice of strings from the return value of `*store.query`. func ScanStrings(rows *sql.Rows, queryErr error) (_ []string, err error) { if queryErr != nil { return nil, queryErr } defer func() { err = CloseRows(ro...
enterprise/internal/codeintel/bundles/persistence/sqlite/store/scan.go
0.805211
0.422147
scan.go
starcoder
package data import ( "strings" ) type ProjectionParams struct { values []string } func NewEmptyProjectionParams() *ProjectionParams { return &ProjectionParams{ values: make([]string, 0, 10), } } func NewProjectionParamsFromStrings(values []string) *ProjectionParams { c := &ProjectionParams{ values: make([...
data/ProjectionParams.go
0.513668
0.561876
ProjectionParams.go
starcoder
package arith import "github.com/egonelbre/exp/bit" type Model interface { NBits() uint Encode(enc *Encoder, value uint) Decode(dec *Decoder) (value uint) } type Shift struct { P P I byte } func (m *Shift) NBits() uint { return 1 } func (m *Shift) adapt(bit uint) { switch bit { case 1: m.P += (MaxP - m.P)...
coder/arith/models.go
0.535584
0.413714
models.go
starcoder
package level // TileTextureInfo describes the textures used for a map tile. type TileTextureInfo uint16 // WallTextureIndex returns the texture index into the texture atlas for the walls. // Valid range [0..63]. // This property is only valid in real world. func (info TileTextureInfo) WallTextureIndex() AtlasIndex {...
ss1/content/archive/level/TileTextureInfo.go
0.894115
0.542924
TileTextureInfo.go
starcoder