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 streaming import ( "github.com/alexandre-normand/glukit/app/apimodel" "github.com/alexandre-normand/glukit/app/container" "github.com/alexandre-normand/glukit/app/glukitio" "time" ) type ExerciseStreamer struct { head *container.ImmutableList startTime *time.Time wr glukitio.ExerciseBatchWr...
app/streaming/exercisestreamer.go
0.774669
0.438785
exercisestreamer.go
starcoder
package rlwe import ( "math" ) // SecretKey is a type for generic RLWE secret keys. type SecretKey struct { Value PolyQP } // PublicKey is a type for generic RLWE public keys. type PublicKey struct { Value [2]PolyQP } // SwitchingKey is a type for generic RLWE public switching keys. type SwitchingKey struct { V...
rlwe/keys.go
0.772616
0.421671
keys.go
starcoder
package main import ( "math" "math/rand" . "github.com/jakecoffman/cp" "github.com/jakecoffman/cp/examples" ) const ( DENSITY = 1.0 / 10000.0 MAX_VERTEXES_PER_VORNOI = 16 ) type WorleyContex struct { seed uint32 cellSize float64 width, height int bb BB focus ...
examples/shatter/shatter.go
0.598547
0.474388
shatter.go
starcoder
package main func (ControllerDeployment) GetFieldDocString(fieldName string) string { switch fieldName { case "Affinity": return `Node affinity for pod assignment` case "ContainerSecurityContext": return "Container Security Context to be set on the controller component container\nref: https://kubernetes.io/doc...
example/values/comments_generated.go
0.85449
0.426202
comments_generated.go
starcoder
// Package add implements the rec.add command, // i.e. add specimen records. package add import ( "encoding/csv" "io" "os" "strconv" "strings" "time" "github.com/js-arias/biodv" "github.com/js-arias/biodv/cmdapp" "github.com/js-arias/biodv/geography" "github.com/js-arias/biodv/records" "github.com/pkg/er...
cmd/biodv/internal/records/add/add.go
0.609175
0.427755
add.go
starcoder
package main import ( "fmt" "strings" "github.com/diamondburned/arikawa/v3/discord" "github.com/hhhapz/doc" ) const ( docLimit = 2800 defLimit = 1000 accentColor = 0x00ADD8 ) func pkgEmbed(pkg doc.Package, full bool) (discord.Embed, bool) { c, more := comment(pkg.Overview, 32, full) return discord.Embed{ ...
embed.go
0.613931
0.526891
embed.go
starcoder
package measurement import ( "regexp" "strconv" "strings" "github.com/wayn3h0/gop/decimal" "github.com/wayn3h0/gop/errors" ) // VolumeUnit represents the unit of volume. type VolumeUnit int // Volume Units. const ( CubicMillimeter VolumeUnit = 1 // base CubicCentimeter VolumeUnit = 1000 CubicMeter Volu...
measurement/volume.go
0.867892
0.507324
volume.go
starcoder
package slice import ( "fmt" "math/rand" "sort" ) // Clone returns a copy of the slice. func (slice Slice[T]) Clone() Slice[T] { ns := make(Slice[T], len(slice)) copy(ns, slice) return ns } // Reduce applies a function against an initial and each element in the slice. func (slice Slice[T]) Reduce(f func(T, T) ...
collections/slice/methods.go
0.861567
0.517632
methods.go
starcoder
// Package main a sample match function that uses the GRPC harness to set up // the match making function as a service. This sample is a reference // to demonstrate the usage of the GRPC harness and should only be used as // a starting point for your match function. You will need to modify the // matchmaking logic in ...
examples/functions/golang/simple/main.go
0.708213
0.474692
main.go
starcoder
package linear import ( "bytes" "fmt" "math" tolerancepkg "github.com/a-h/linear/tolerance" "github.com/a-h/round" ) // Vector represents an array of values. type Vector []float64 // NewVector creates a vector with the dimensions specified by the argument. func NewVector(values ...float64) Vector { return Vec...
vector.go
0.888831
0.775095
vector.go
starcoder
package generator // yWing removes candidates. If a cell has two candidates (AB) and in a neighboring unit (box, row, or column) of AB is another cell containing AC and in a second neighboring unit of AB is a cell containing BC, then any cell that can be "seen" by AC and BC (in both neighborhoods of AC and BC) that co...
generator/yWing.go
0.795777
0.571946
yWing.go
starcoder
package ast import ( "fmt" "strings" "mal/ast/token" ) type AtomKind uint8 const ( Nil AtomKind = iota Bool Int Float String Keyword Vector Map ) type ( Node interface { fmt.Stringer Pos() token.Pos End() token.Pos } Comment struct { pos token.Pos Content string // No newline included ...
go/src/mal/ast/node.go
0.582135
0.438244
node.go
starcoder
package holiday import ( "time" "github.com/onwsk8r/gotime" ) // TradingHolidays are days the US stock markets are closed. // This list does not include the days the markets close early: on July 3, // the day before Thanksgiving, and Christmas Eve the markets close at 1pm ET. var TradingHolidays List = []Finder{ ...
holiday/holiday.go
0.620852
0.5526
holiday.go
starcoder
package storyboard import ( "github.com/wieku/danser-go/bmath" "github.com/go-gl/mathgl/mgl32" "unicode" "strings" "math" "github.com/wieku/danser-go/render/texture" "github.com/wieku/danser-go/render/batches" ) const ( storyboardArea = 640.0 * 480.0 maxLoad = 1.3328125 //480*480*(16/9)/(640*480) ) t...
storyboard/object.go
0.617628
0.474996
object.go
starcoder
package distuv import ( "math" "golang.org/x/exp/rand" "gonum.org/v1/gonum/mathext" ) // Poisson implements the Poisson distribution, a discrete probability distribution // that expresses the probability of a given number of events occurring in a fixed // interval. // The poisson distribution has density functi...
stat/distuv/poisson.go
0.903268
0.644756
poisson.go
starcoder
package tsm1 import ( "sort" "github.com/influxdata/platform/tsdb" ) // Array Cursors type floatArrayAscendingCursor struct { cache struct { values Values pos int } tsm struct { buf *tsdb.FloatArray values *tsdb.FloatArray pos int keyCursor *KeyCursor } end int64 res *tsdb.F...
tsdb/tsm1/array_cursor.gen.go
0.581065
0.476032
array_cursor.gen.go
starcoder
package main import ( "math" ) /** For clarity, the base computational `struct`s (per side aka 'option' and the total) will use the explicit 'PearsonsChiSq` naming convention. For simplicity, all `func`s will use the abbreviated `PCS` naming convention. */ const d20ChiTableLookup = 30.143 type DieConstantsBySides ...
pearsons-chi-sq-compute.go
0.645679
0.407451
pearsons-chi-sq-compute.go
starcoder
package pc import ( "encoding/binary" "math" "github.com/seqsense/pcgol/mat" ) type binaryIterator struct { data []byte pos int stride int } func (i *binaryIterator) Incr() { i.pos += i.stride } func (i *binaryIterator) Len() int { return len(i.data) / i.stride } type Float32Iterator interface { Inc...
pc/iterator.go
0.738103
0.411702
iterator.go
starcoder
package mporous // scratchpad for TPM calculations var TPM struct { // other porous media data Sg float64 // sl: saturation of gas Pc float64 // pc: capillary pressure: pg - pl P float64 // p: averaged pressue of fluids in porous // n variables Ns float64 // Ns: volume fraction of solids Nf float64 // Nf: v...
mporous/tpm.go
0.531696
0.732592
tpm.go
starcoder
package blockchain import ( "encoding/json" "fmt" "github.com/incognitochain/incognito-chain/common" ) type BeaconBlock struct { // AggregatedSig string `json:"AggregatedSig"` // R string `json:"R"` // ValidatorsIdx [][]int `json:"ValidatorsIdx"` //[0]: r | [1]:AggregatedSig // ProducerSig str...
blockchain/beaconblock.go
0.58059
0.435121
beaconblock.go
starcoder
package gohome import ( "io" "strings" "sync" ) const ( READ_ALL_BUFFER_SIZE = 512 * 512 ) // Reads the entire content of a reader. Uses a bigger buffer than the normal one func ReadAll(r io.Reader) (str string, err error) { str = "" var n int = 1 for err == nil && n != 0 { buf := make([]byte, READ_ALL_BUFF...
src/gohome/utils.go
0.631253
0.4436
utils.go
starcoder
package types // difficulty.go defines the difficulty type and implements a few helper functions for // manipulating the difficulty type. import ( "bytes" "errors" "fmt" "io" "math/big" "github.com/threefoldtech/rivine/pkg/encoding/rivbin" "github.com/threefoldtech/rivine/build" "github.com/threefoldtech/ri...
vendor/github.com/threefoldtech/rivine/types/difficulty.go
0.770551
0.411998
difficulty.go
starcoder
package timeslotutil import ( "fmt" "strconv" "time" ) //GetPreviousDate Returns a int data number based of passed in time and option // input option: select how far in the past you would like to calculate // options include: 0 (1 year), 1 (1 month), 2 (1 week), 3 (1 day) func GetPreviousDate(option int, now time....
pkg/timeslotutil/timeslotutil.go
0.58747
0.638863
timeslotutil.go
starcoder
package tsm1 import ( "github.com/ivopetiz/influxdb/tsdb" ) // ReadFloatArrayBlock reads the next block as a set of float values. func (c *KeyCursor) ReadFloatArrayBlock(values *tsdb.FloatArray) (*tsdb.FloatArray, error) { LOOP: // No matching blocks to decode if len(c.current) == 0 { values.Timestamps = values...
tsdb/engine/tsm1/file_store_array.gen.go
0.549157
0.471953
file_store_array.gen.go
starcoder
package route import ( "fmt" "net/http" "regexp" "strings" ) type matcher interface { match(*http.Request) *match setMatch(match *match) canMerge(matcher) bool merge(matcher) (matcher, error) canChain(matcher) bool chain(matcher) (matcher, error) } func hostTrieMatcher(hostname string) (matcher, error) {...
vendor/github.com/vulcand/vulcand/Godeps/_workspace/src/github.com/vulcand/route/matcher.go
0.693369
0.411879
matcher.go
starcoder
package transactionpool import ( "encoding/json" "github.com/acejam/Sia/build" "github.com/acejam/Sia/encoding" "github.com/acejam/Sia/modules" "github.com/acejam/Sia/types" "github.com/coreos/bbolt" "gitlab.com/NebulousLabs/errors" ) // database.go contains objects related to the layout of the transaction p...
modules/transactionpool/database.go
0.640636
0.400398
database.go
starcoder
package graphson import ( "fmt" "io" "reflect" "unsafe" jsoniter "github.com/json-iterator/go" "github.com/modern-go/reflect2" ) // DecoratorOfSlice decorates a value encoder of a slice type. func (encodeExtension) DecoratorOfSlice(typ reflect2.Type, enc jsoniter.ValEncoder) jsoniter.ValEncoder { encoder := ...
dialect/gremlin/encoding/graphson/slice.go
0.762689
0.408454
slice.go
starcoder
package main import ( "github.com/MattSwanson/raylib-go/physics" "github.com/MattSwanson/raylib-go/raylib" ) const ( velocity = 0.5 ) func main() { screenWidth := float32(800) screenHeight := float32(450) rl.SetConfigFlags(rl.FlagMsaa4xHint) rl.InitWindow(int32(screenWidth), int32(screenHeight), "Physac [ray...
examples/physics/physac/movement/main.go
0.599133
0.463748
main.go
starcoder
package merkle import ( "bytes" amino "github.com/tendermint/go-amino" "github.com/okex/exchain/libs/tendermint/crypto/tmhash" "github.com/okex/exchain/libs/tendermint/libs/kv" ) // Merkle tree from a map. // Leaves are `hash(key) | hash(value)`. // Leaves are sorted before Merkle hashing. type simpleMap struct...
libs/tendermint/crypto/merkle/simple_map.go
0.760917
0.402803
simple_map.go
starcoder
package main import ( "math" "github.com/pkg/errors" "gonum.org/v1/gonum/stat/distuv" "gorgonia.org/tensor" ) type NN struct { hidden, final *tensor.Dense b0, b1 float64 } func New(input, hidden, output int) (retVal *NN) { r := make([]float64, hidden*input) r2 := make([]float64, hidden*output) fillR...
Chapter06/rawnn.go
0.727589
0.422028
rawnn.go
starcoder
package schulze import "sort" // Voting holds voting state in memory for a list of choices and provides // methods to vote, to export current voting state and to calculate the winner // using the Schulze method. type Voting struct { choices []string matrix [][]voteCount } // NewVoting initializes a new voting wi...
voting.go
0.765593
0.57093
voting.go
starcoder
package universe import ( "math" "github.com/influxdata/flux" "github.com/influxdata/flux/array" "github.com/influxdata/flux/codes" "github.com/influxdata/flux/execute" "github.com/influxdata/flux/internal/errors" "github.com/influxdata/flux/interpreter" "github.com/influxdata/flux/plan" "github.com/influxda...
stdlib/universe/covariance.go
0.806815
0.402333
covariance.go
starcoder
// Package diff implements the Myers diff algorithm. package diff import "strings" // Sources: // https://blog.jcoglan.com/2017/02/17/the-myers-diff-algorithm-part-3/ // https://www.codeproject.com/Articles/42279/%2FArticles%2F42279%2FInvestigating-Myers-diff-algorithm-Part-1-of-2 type Op struct { Kind OpKind ...
tenant/vendor/golang.org/x/tools/internal/lsp/diff/diff.go
0.697712
0.468669
diff.go
starcoder
package file import ( "sync" "time" "github.com/elastic/beats/libbeat/logp" ) // States handles list of FileState. One must use NewStates to instantiate a // file states regisry. Using the zero-value is not safe. type States struct { sync.RWMutex // states store states []State // idx maps state IDs to stat...
filebeat/input/file/states.go
0.642545
0.455865
states.go
starcoder
// Package flow contains a number of constructors for Flow nodes // that are convenient for testing. package flow import ( "net/url" "regexp" "github.com/grailbio/reflow" "github.com/grailbio/reflow/flow" "github.com/grailbio/reflow/values" ) // Exec constructs a new flow.OpExec node. func Exec(image, cmd stri...
test/flow/constructor.go
0.771585
0.539105
constructor.go
starcoder
package ckks import ( "github.com/ldsec/lattigo/ring" "math/big" ) // 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. con...
ckks/ckks.go
0.683208
0.441011
ckks.go
starcoder
package ioutil import ( "bufio" "io" ) var ( nByte byte = 10 // the byte that corresponds to the '\n' rune. rByte byte = 13 // the byte that corresponds to the '\r' rune. ) // DelimitedReader reduces the custom delimiter to `\n`. type DelimitedReader struct { r *bufio.Reader delimiter []rune // Sel...
pkg/ioutil/delimited-reader.go
0.638497
0.438364
delimited-reader.go
starcoder
package model import ( "sort" ) const SeparatorByte byte = 255 var ( emptyLabelSignature = hashNew() ) func LabelsToSignature(labels map[string]string) uint64 { if len(labels) == 0 { return emptyLabelSignature } labelNames := make([]string, 0, len(labels)) for labelName := range labels { labelNames = ap...
vendor/github.com/prometheus/common/model/signature.go
0.572245
0.428592
signature.go
starcoder
package network import ( "fmt" "github.com/yaricom/goNEAT/v2/neat" ) // Link is a connection from one node to another with an associated weight. // It can be marked as recurrent. type Link struct { // Weight of connection Weight float64 // NNode inputting into the link InNode *NNode // NNode that the link affe...
neat/network/link.go
0.675872
0.400779
link.go
starcoder
package metar // Routines to implement an on-demand data source for NOAA metar data, stored in DS // All 'Report' objects for the same UTC day stored into a singleton DS object, called a DayReport. // We store one such object per airport per day. // LookupOrFetch (via cron+ui:lookupHandler) will fetch new data from ...
metar/dayreport.go
0.540196
0.4575
dayreport.go
starcoder
package main import ( "image" "image/draw" "log" "os" "github.com/go-gl/gl/v2.1/gl" "github.com/paulmach/go.geo" ) // NewTexture loads texture from file. func NewTexture(file string) (texture uint32, bounds Rect) { imgFile, err := os.Open(file) if err != nil { log.Fatalf("texture %q not found on disk: %v\n...
utils.go
0.669529
0.417093
utils.go
starcoder
package method import ( "fmt" "math" ) /* Note: 1.Go does not have classes, but we can define methods on types such as struct and non-struct types. A method is a function with a special receiver argument. 2.We can only declare a method with a receiver whose type is defined in the same package as the method. 3.We ca...
golang/src/std/method/method.go
0.816333
0.569673
method.go
starcoder
package helper import ( "errors" "fmt" "strings" ) /** This Method will return a functionName along with column name. we did this so that we can handle multiple datatype. The implementation of each datatypes belongs to the helper package. Parameters: - colType: is the datatype of the column - colName: is the...
internal/impl/laravel/5.8/handler/helper/column_datatype.go
0.663669
0.611005
column_datatype.go
starcoder
package core import ( "math/rand" "git.maze.io/go/math32" ) type MaterialSample struct { Continue bool PDF float32 Weight Vector3 Scattered Vector3 } type Material interface { Sample(wi Vector3, eta0, eta1 float32) MaterialSample Scatter(ray *Ray, hitRecord *HitRecord, attenuation *Vector3, scattered *Ray) b...
core/material.go
0.788135
0.533458
material.go
starcoder
package cuj import ( "context" "fmt" "chromiumos/tast/common/action" "chromiumos/tast/errors" "chromiumos/tast/local/bundles/cros/ui/cuj/volume" "chromiumos/tast/local/chrome/uiauto" "chromiumos/tast/local/power" "chromiumos/tast/testing" ) const ( // expectedBrightness indicates the default screen brightn...
src/chromiumos/tast/local/bundles/cros/ui/cuj/setup.go
0.758421
0.447279
setup.go
starcoder
package fixtures const NoSecurityGroups = `{ "pagination": { "total_results": 0, "total_pages": 1, "first": { "href": "https://api.[your-domain.com]/v3/apps?page=1&per_page=10" }, "last": { "href": "https://api.[your-domain.com]/v3/apps?page=1&per_page=10" } }, "resources": []...
src/code.cloudfoundry.org/policy-server/cc_client/fixtures/get_security_groups.go
0.611614
0.423935
get_security_groups.go
starcoder
package bitcoin import ( "bytes" "encoding/hex" "errors" "fmt" "io" ) const Hash20Size = 20 // Hash20 is a 20 byte integer in little endian format. type Hash20 [Hash20Size]byte func NewHash20(b []byte) (*Hash20, error) { if len(b) != Hash20Size { return nil, errors.New("Wrong byte length") } result := Has...
pkg/bitcoin/hash20.go
0.807157
0.40157
hash20.go
starcoder
package config import "fmt" // LookupValues is a map of field names to field values for an individual row of a lookup. type LookupValues map[string]string // valuesForLookupFields returns a list of strings representing a LookupRow in the context of a LookupFields object. func (lookupValues LookupValues) valuesForLo...
internal/splunkconfig/config/lookupvalues.go
0.827445
0.449332
lookupvalues.go
starcoder
package types import "fmt" type TxType uint64 //Never change the order of these types. //If any types are deleted use a placeholder to prevent index number from changing. const ( TxTypeUnknown = TxType(iota) TxTypeIdentityCreate TxTypeTokenAccountCreate TxTypeTokenTx TxTypeDataChainCreate TxTypeDataEntry //per...
types/transaction_types.go
0.531209
0.452052
transaction_types.go
starcoder
package iso20022 // Set of elements used to provide further means of referencing a payment transaction. type PaymentIdentification3 struct { // Unique identification, as assigned by an instructing party for an instructed party, to unambiguously identify the instruction. // // Usage: The instruction identification...
PaymentIdentification3.go
0.790611
0.546375
PaymentIdentification3.go
starcoder
package trie type TrieBuilder struct { words []string optimize bool } func NewTrie() *TrieBuilder { return &TrieBuilder{ optimize: true, } } // AddWord adds new word to list of words we will be searching for func (tb *TrieBuilder) AddWord(word string) *TrieBuilder { if len(word) != 0 { tb.words = append(...
trie_builder.go
0.709523
0.41941
trie_builder.go
starcoder
package wkb import ( "bytes" "encoding/binary" "fmt" "io" "github.com/airmap/tegola" ) // geometry types // http://edndoc.esri.com/arcsde/9.1/general_topics/wkb_representation.htm const ( GeoPoint uint32 = 1 GeoLineString = 2 GeoPolygon = 3 GeoMultiPoint ...
wkb/wkb.go
0.661048
0.407628
wkb.go
starcoder
// Package time provide common time and date operation common method. package timeutil import ( "strings" "time" ) const ( DEFAULTTIMEFORMAT = "2006-01-02 15:04:05" TIMEFORMAT = "20060102150405" ) // get current time func GetNowTime() time.Time { return time.Now() } // Gets the formatted string of the ...
time/timeutil.go
0.783243
0.514827
timeutil.go
starcoder
package dist import ( "github.com/jesand/stats" "math" ) // An ID for a particular outcome in a space type Outcome int // A set of outcomes for some probability measure. type Space interface { // Ask whether the space is the same as some other space Equals(other Space) bool } // Methods contained by spaces ove...
dist/space.go
0.847179
0.507446
space.go
starcoder
package color import ( "fmt" "math" ) const ( epsilon float64 = 216.0 / 24389.0 kappa float64 = 24389.0 / 27.0 ) // 3 компонента для определения цветов type Point [3]float64 type Matrix [9]float64 func (p Point) mulMatrix(m *Matrix) (result Point) { result[0] = p[0]*m[0] + p[1]*m[1] + p[2]*m[2] result[1] = ...
color/color.go
0.641871
0.47457
color.go
starcoder
package client // APIServiceSpec contains information for locating and communicating with a server. Only https is supported, though you are able to disable certificate verification. type V1beta1ApiServiceSpec struct { // CABundle is a PEM encoded CA bundle which will be used to validate an API server's serving certi...
vendor/github.com/kubernetes-client/go/kubernetes/client/v1beta1_api_service_spec.go
0.726037
0.419351
v1beta1_api_service_spec.go
starcoder
package skate import "strings" type runestring []rune // A safe way to index a runestring. It will return a null rune if you try // to index outside of the bounds of the runestring. func (r *runestring) SafeAt(pos int) rune { if pos < 0 || pos >= len(*r) { return 0 } else { return (*r)[pos] } } // A safe way...
nysiis.go
0.547222
0.447098
nysiis.go
starcoder
package bls377 // 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 := range _z { result.Mul...
bls377/pairing.go
0.72952
0.466359
pairing.go
starcoder
package date import ( "database/sql/driver" "fmt" "time" ) // Date represents a calendar day (and thus has day precision). It's stored as // the number of days since the epoch date 1970-01-01. It can be negative, to // represent dates before the epoch. Because it's a date, it doesn't exist // within any particular...
date.go
0.853165
0.54153
date.go
starcoder
package goTrie import "unicode/utf8" // Trie defines a Trie node representation type Trie struct { end bool letters map[rune]*Trie children uint32 } // New initializes new Trie object with attributes default values func New() *Trie { return &Trie{ end: false, letters: make(map[rune]*Trie), chil...
trie.go
0.549882
0.456046
trie.go
starcoder
package fuzzy import ( "math" "sort" "strings" "unicode/utf8" ) // Ratio computes a score of how close two unicode strings are // based on their Levenshtein edit distance. // Returns an integer score [0,100], higher score indicates // that strings are closer. func Ratio(s1, s2 string) int { return int(round(100 ...
vendor/github.com/paul-mannino/go-fuzzywuzzy/fuzz.go
0.837188
0.465327
fuzz.go
starcoder
package rexfile import ( "github.com/go-gl/mathgl/mgl32" "math" "sort" ) // NewCylinder returns a new cylinder with radius and height (meters) func NewCylinder(id, matID uint64, radius float32, height float32) (Mesh, Material) { const numberOfSegments = 16 mesh := Mesh{ ID: id, Name: "Cylinder...
encoding/rexfile/cylinder.go
0.688049
0.521288
cylinder.go
starcoder
package txn import ( "fmt" "strings" "github.com/pingcap/tipocket/pkg/elle/core" ) // FilterExType is a predication on a cycle case type FilterExType = func(cycleCase *core.CycleExplainerResult) bool // CycleAnomalySpecType specifies different anomalies type CycleAnomalySpecType struct { // A set of relationshi...
pkg/elle/txn/cycle.go
0.652574
0.42656
cycle.go
starcoder
package main import ( "fmt" "math" "gonum.org/v1/plot" "gonum.org/v1/plot/plotter" "gonum.org/v1/plot/plotutil" "gonum.org/v1/plot/vg" ) const G = 6.674e-11 type Satellite struct { //Each satellite variable represents one particle Mass, radius float64 Coords, Force, Velocity Vector Name string } type Sys...
Orbits/Orbits.go
0.609524
0.526099
Orbits.go
starcoder
Package flexconfig provides a uniform interface to retrieve configuration properties, independent of how or where the properties are specified. Files, environment variables, command line arguments, and a configuration store can be used alone or in combination with each other to define the configuration for the applicat...
doc.go
0.838217
0.794704
doc.go
starcoder
package chesseract import ( "fmt" ) func init() { RegisterRuleSet("Chesseract", func() RuleSet { return Chesseract{} }) } // A position4D represents a position on the hyper-board type position4D [4]int func (p position4D) String() string { return fmt.Sprintf("%c%d%c%d", 'a'+rune(p[0]), p[1]+1, 'm'+rune(p[2]),...
chesseract/hyperboard.go
0.662469
0.548008
hyperboard.go
starcoder
package onshape import ( "encoding/json" ) // BTExportTessellatedEdgesBody890 struct for BTExportTessellatedEdgesBody890 type BTExportTessellatedEdgesBody890 struct { BTExportTessellatedBody3398 BtType *string `json:"btType,omitempty"` Edges *[]BTExportTessellatedEdgesEdge1364 `json:"edges,omitempty"` } // NewBT...
onshape/model_bt_export_tessellated_edges_body_890.go
0.643441
0.583559
model_bt_export_tessellated_edges_body_890.go
starcoder
package vida import ( "fmt" "math/rand" "strings" "time" "unsafe" ) // Record is a non-ordered structured {property:value} data type. type Record struct { Properties Namespace } // Interface SelectorOperator. func (record Record) SelectorGet(field string) (Value, error) { if value, ok := record.Properties[fie...
vida/record.go
0.626696
0.468304
record.go
starcoder
package quantile import ( "fmt" "github.com/influxdata/telegraf" "github.com/influxdata/telegraf/plugins/aggregators" ) type Quantile struct { Quantiles []float64 `toml:"quantiles"` Compression float64 `toml:"compression"` AlgorithmType string `toml:"algorithm"` newAlgorithm newAlgorithmFunc cac...
plugins/aggregators/quantile/quantile.go
0.813053
0.476458
quantile.go
starcoder
package device // A Weatherlink device is simulated by guessing what commands were // requested based on the packet sizes. It's not perfect but is a // convenient way to allow low level protocol testing. import ( "io" "math/rand" "time" "github.com/ebarkie/weatherlink/data" ) // Sim represents a simulted Weat...
internal/device/sim.go
0.695441
0.51501
sim.go
starcoder
package vm import ( "crypto/sha256" "github.com/Dipper-Protocol/x/vm/common" math2 "github.com/Dipper-Protocol/x/vm/common/math" "math/big" "golang.org/x/crypto/ripemd160" ethsecp256k1 "github.com/ethereum/go-ethereum/crypto/secp256k1" sdk "github.com/Dipper-Protocol/types" "github.com/tendermint/tendermint...
x/vm/contracts.go
0.648132
0.424591
contracts.go
starcoder
package vit import ( "fmt" "github.com/omniskop/vitrum/vit/script" ) // Component describes a generic vit component type Component interface { DefineProperty(name string, vitType string, expression string, position *PositionRange) error // Creates a new property. On failure it returns either a RedeclarationError ...
vit/vit.go
0.816699
0.452113
vit.go
starcoder
package main import ( "../aoc" "fmt" "log" "strings" ) var Active = "#" var Inactive = "." type Grid3D struct { Points map[aoc.Point3D]string MinX, MaxX, MinY, MaxY, MinZ, MaxZ int Neighbors map[aoc.Point3D][]aoc.Point3D } func NewGrid() *Grid3D { var gri...
2020/day17/main.go
0.529507
0.552359
main.go
starcoder
package ai import ( "github.com/xwjdsh/2048-ai/grid" ) type AI struct { // Grid is 4x4 grid. Grid *grid.Grid // Active is true represent need to select a direction to move, else represent computer need fill a number("2" or "4") into grid. Active bool } var directions = []grid.Direction{ grid.UP, grid.LEFT, g...
ai/ai.go
0.636692
0.460835
ai.go
starcoder
package sqlx import ( "database/sql" "github.com/tietang/sqlx/reflectx" "reflect" "upper.io/db.v3" ) type hasConvertValues interface { ConvertValues(values []interface{}) []interface{} } // fetchRow receives a *sql.Rows value and tries to map all the rows into a // single struct given by the poin...
fetch.go
0.722233
0.409693
fetch.go
starcoder
This file contains abstractions of certain complex map types that are used often throughout summarize.go. They also have some often-used methods such as getting just the keys, or getting the key-value pairs as a map. */ package summarize import ( "sort" ) // map[string][]failure type alias // failuresGroup maps st...
triage/summarize/map_abstractions.go
0.888451
0.427337
map_abstractions.go
starcoder
package kv import "github.com/vjeantet/bitfan/processors/doc" func (p *processor) Doc() *doc.Processor { return &doc.Processor{ Name: "kv", ImportPath: "github.com/vjeantet/bitfan/processors/filter-kv", Doc: "This filter helps automatically parse messages (or specific event fields)\nwhich are of t...
processors/filter-kv/docdoc.go
0.788827
0.691771
docdoc.go
starcoder
package mahalanobis import ( "errors" "github.com/skelterjohn/go.matrix" "math" ) // Given a set a points, return the mean vector. // points.Rows() = dimensions. points.Cols() = number of points. func MeanVector(points *matrix.DenseMatrix) *matrix.DenseMatrix { mean := matrix.Zeros(points.Rows(), 1) for i := 0; ...
mahalanobis.go
0.708717
0.584242
mahalanobis.go
starcoder
package unit import ( "math" "gitlab.com/alephledger/consensus-go/pkg/gomel" ) // unitInDag is a unit that is already inside the dag, and has all its properties precomputed and cached. // It uses forking heights to optimize AboveWithinProc calls. type unitInDag struct { gomel.Unit forkingHeight int } // Embed t...
pkg/unit/unit_in_dag.go
0.681197
0.454351
unit_in_dag.go
starcoder
package chunk import ( "bytes" "fmt" "io" ) // Chunk provides meta information as well as access to its contained blocks. type Chunk struct { // Fragmented tells whether the chunk should be serialized with a directory. // Fragmented chunks can have zero, one, or more blocks. // Unfragmented chunks always have e...
chunk/Chunk.go
0.735547
0.450722
Chunk.go
starcoder
package wot import ( "time" ) const MediaTypeThingDescription = "application/td+json" /* This file has go models for Web Of Things (WoT) Things Description following : https://www.w3.org/TR/2019/CR-wot-thing-description-20191106/ (W3C Candidate Recommendation 6 November 2019) */ type any = interface{} // ThingDe...
wot/thing_description.go
0.817647
0.465387
thing_description.go
starcoder
package physics import ( "time" "github.com/g3n/engine/experimental/physics" "github.com/g3n/engine/experimental/physics/object" "github.com/g3n/engine/geometry" "github.com/g3n/engine/gls" "github.com/g3n/engine/graphic" "github.com/g3n/engine/light" "github.com/g3n/engine/material" "github.com/g3n/engine/m...
demos/experimental/physics/spheres2.go
0.578567
0.436622
spheres2.go
starcoder
package trees import ( "errors" "github.com/TectusDreamlab/go-common-utils/datastructure/shared" ) // BTree defines a B-Tree type BTree struct { Root *BTreeNode // root has min 2 children if it's not leaf. size int order int comparator shared.Comparator } // BTreeNode defines a B-Tree Node ty...
datastructure/trees/b_tree.go
0.720467
0.453443
b_tree.go
starcoder
package simat import ( "fmt" "github.com/emer/etable/etensor" "github.com/emer/etable/metric" ) // Tensor computes a similarity / distance matrix on tensor // using given metric function. Outer-most dimension ("rows") is // used as "indexical" dimension and all other dimensions within that // are compared. // ...
simat/tensor.go
0.755457
0.620593
tensor.go
starcoder
package engine import ( "github.com/alexandre-normand/glukit/app/apimodel" "github.com/alexandre-normand/glukit/app/model" "github.com/alexandre-normand/glukit/app/store" "github.com/alexandre-normand/glukit/app/util" "context" "google.golang.org/appengine/log" "google.golang.org/appengine/taskqueue" "math" "...
app/engine/engine.go
0.602997
0.512937
engine.go
starcoder
package imagex type IPixelChanImage interface { Max() (maxX, maxY int) NumberChanel() int } //------------------------------- type PixelChanImage struct { C []uint8 Width, Height int NumChan int } func (p *PixelChanImage) Max() (maxX, maxY int) { return p.Width, p.Height } func (p *PixelCha...
imagex/pixel_chan.go
0.776157
0.575767
pixel_chan.go
starcoder
package proto import ( "github.com/pkg/errors" "github.com/umbracle/fastrlp" "github.com/wavesplatform/gowaves/pkg/crypto" "github.com/wavesplatform/gowaves/pkg/util/common" ) const ( // EthereumHashSize is the expected length of the hash in bytes EthereumHashSize = 32 ) // EthereumHash represents the 32 byte ...
pkg/proto/eth_hash.go
0.727104
0.414129
eth_hash.go
starcoder
package timecode import ( "errors" "regexp" "strconv" "time" ) // TimecodeRegex is the pattern for a valid SMPTE timecode var TimecodeRegex = regexp.MustCompile(`^(\d\d)(:|;)(\d\d)(:|;)(\d\d)(:|;)(\d\d)$`) // Parse parses a timecode from a string, and treats it using the provided frame rate value func Parse(time...
parse.go
0.800029
0.427337
parse.go
starcoder
package terminal import ( "github.com/cimomo/portfolio-go/pkg/portfolio" "github.com/gdamore/tcell" "github.com/rivo/tview" ) // PortfolioViewer displays real-time portfolio data type PortfolioViewer struct { portfolio *portfolio.Portfolio table *tview.Table } // NewPortfolioViewer returns a new viewer for ...
pkg/terminal/portfolio.go
0.595728
0.47591
portfolio.go
starcoder
package mafsa import ( "encoding/binary" "sort" ) // Encoder is a type which can encode a BuildTree into a byte slice // which can be written to a file. type Encoder struct { queue []*BuildTreeNode counter int } // Encode serializes a BuildTree t into a byte slice. func (e *Encoder) Encode(t *BuildTree) ([]byt...
encoder.go
0.750461
0.548129
encoder.go
starcoder
package utils import ( "errors" "gopkg.in/yaml.v2" "reflect" "strconv" ) // GetAsBool parses a string to a bool or returns the bool if bool is passed in func GetAsBool(value interface{}, defaultValue bool) (result bool, err error) { result = defaultValue switch value.(type) { case string: fromString, e := s...
utils/utils.go
0.668231
0.435481
utils.go
starcoder
package imagext import ( "image" "image/color" "image/gif" "image/jpeg" "image/png" "os" "path/filepath" ) // Gray converts values r (red), g (green) and b (blue) // to a value of gray and returns it. func Gray(r, g, b uint8) uint8 { return uint8((uint(r)*1742 + uint(g)*5859 + uint(b)*591) >> 13) } // NewGra...
imagext.go
0.652906
0.430566
imagext.go
starcoder
package entity import ( "math/rand" "github.com/relnod/evo/pkg/math64" "github.com/relnod/evo/pkg/math64/collision" ) // InitPopulation initializes a population with a given count and a world size. func InitPopulation(count, width, height int) []*Creature { creatures := make([]*Creature, count) for i := range ...
pkg/entity/population.go
0.737725
0.455199
population.go
starcoder
package astutil import ( "fmt" "github.com/mewkiz/pkg/errutil" "github.com/mewmew/uc/ast" ) // Walk traverses the given parse tree, calling f(n) for each node n in the // tree, in a bottom-up traversal. func Walk(node ast.Node, f func(ast.Node) error) error { nop := func(n ast.Node) error { return nil } return ...
ast/astutil/walk.go
0.668988
0.423041
walk.go
starcoder
package responses type ScoringBreakdown2016 struct { Red ScoringBreakdownAlliance2016 `mapstructure:"red"` Blue ScoringBreakdownAlliance2016 `mapstructure:"blue"` } type ScoringBreakdownAlliance2016 struct { AutoPoints int `mapstructure:"autoPoints"` TeleopPoints int `mapstructure:"te...
responses/scoring.go
0.657978
0.430896
scoring.go
starcoder
package orbplot import ( "image/color" "math" "github.com/emilyselwood/orbcalc/orbcore" "github.com/emilyselwood/orbcalc/orbdata" "gonum.org/v1/plot" "gonum.org/v1/plot/plotter" "gonum.org/v1/plot/vg" "gonum.org/v1/plot/vg/draw" ) // PlotSolarSystemLines plots the major planets of the solar system on the pro...
orbplot/plotting.go
0.854536
0.494263
plotting.go
starcoder
package intsets import ( "sort" ) // Naive is a naive intsets representation type Naive struct { vals []int } // Copy sets s to the value of x func (s *Naive) Copy(x *Naive) { n := len(x.vals) s.ensure(n) s.vals = s.vals[:n] copy(s.vals, x.vals) } // AppendTo appends the entries to dst and returns the respons...
internal/intsets/naive.go
0.68784
0.530966
naive.go
starcoder
package dprotocol import ( "encoding/binary" "fmt" "time" ) // Packet represents a D protocol packet. type Packet struct { // Header is the packet header. Header Header // EventID is the event ID. EventID EventID // EventInformation contains additional, event-dependent information. EventInformation uint8 ...
dprotocol/packet.go
0.646237
0.567997
packet.go
starcoder
package iso20022 // Chain of parties involved in the settlement of a transaction, including receipts and deliveries, book transfers, treasury deals, or other activities, resulting in the movement of a security or amount of money from one account to another. type SettlementParties13 struct { // First party in the set...
SettlementParties13.go
0.683631
0.499573
SettlementParties13.go
starcoder
package types type AutoCompleteValueSyncDefinition struct { // The label of the autocomplete value. Label string `json:"label"` // The value of the autocomplete value. Value string `json:"value"` } type EstimatedUsageDetails struct { // Amount of data scanned in bytes, to run the query. DataScannedInBytes int64...
service/cip/types/log_searches_estimated_usage_types.go
0.711631
0.574305
log_searches_estimated_usage_types.go
starcoder