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 avro import ( "fmt" "time" ) // ReadNext reads the next Avro element as a generic interface. func (r *Reader) ReadNext(schema Schema) interface{} { var ls LogicalSchema lts, ok := schema.(LogicalTypeSchema) if ok { ls = lts.Logical() } switch schema.Type() { case Boolean: return r.ReadBool() ca...
reader_generic.go
0.553747
0.402891
reader_generic.go
starcoder
package genericjmx // MBeanMap is a map from the service name to the mbean definitions that this // service has type MBeanMap map[string]MBean // MergeWith combines the current MBeanMap with the one given as an // argument and returns a new map with values from both maps. func (m MBeanMap) MergeWith(m2 MBeanMap) MBe...
internal/monitors/collectd/genericjmx/mbeans.go
0.830044
0.460956
mbeans.go
starcoder
package equationscanner import ( "log" "unicode" "errors" "fmt" ) // EquationScanner scans given equation string and hold the equation's parameters. type EquationScanner struct { SecondDegreeCoefficientsOnLeft []int FirstDegreeCoefficientsOnLeft []int FreeNumbersOnLeft []int SecondDegreeCoefficient...
src/equationscanner/equation_scanner.go
0.654564
0.540257
equation_scanner.go
starcoder
package iso20022 // Execution of a redemption order. type RedemptionExecution4 struct { // Unique and unambiguous identifier for an order, as assigned by the instructing party. OrderReference *Max35Text `xml:"OrdrRef"` // Unique and unambiguous identifier for an order execution, as assigned by a confirming party....
RedemptionExecution4.go
0.818592
0.420362
RedemptionExecution4.go
starcoder
package elk import ( "entgo.io/ent/entc/gen" "errors" "fmt" "strings" ) const maxDepth = 25 type ( // Edge specifies and edge to load for a type. Edge struct { *gen.Edge Edges Edges } // Edges is a list of multiple EdgeToLoad. Edges []Edge // walk is a node sequence in the schema graph. Used to keep tr...
edge.go
0.659405
0.439447
edge.go
starcoder
package arrgo import "fmt" func (a *Arrf) Greater(b *Arrf) *Arrb { if len(a.data) == 0 || len(b.data) == 0 { panic(EMPTY_ARRAY_ERROR) } var t = EmptyB(a.shape...) for i, v := range a.data { t.data[i] = v > b.data[i] } return t } func (a *Arrf) GreaterEqual(b *Arrf) *Arrb { ...
compare_opt.go
0.61659
0.556882
compare_opt.go
starcoder
// En algunos lenguajes es idiomรกtico usar estucturas // de datos y algorรญtmos [genรฉricos](https://es.wikipedia.org/wiki/Programaci%C3%B3n_gen%C3%A9rica). // Go no soporta genรฉricos; en Go es comรบn tener // funciones que actuan sobre colecciones de datos si // tu programa y tipos de datos lo necesitan. // Aquรญ hay al...
examples/funciones-sobre-colecciones/funciones-sobre-colecciones.go
0.614972
0.551755
funciones-sobre-colecciones.go
starcoder
Package logger contains logging related API. It is possible to use a custom logger, but the builtin logger is used if one is not provided. Log levels for the builtin logger are described with type Level. Following log levels are supported: - OffLevel : Do not log anything. - FatalLevel : A critical error occured...
logger/doc.go
0.702122
0.450601
doc.go
starcoder
package datasource import ( "bytes" "encoding/json" "fmt" "strconv" ) // Coin represents the object used to represent cryptocurrency tickers type Coin struct { Symbol string Current string Open string High string Low string PercentChange string Response string ...
datasource/coin.go
0.645679
0.446796
coin.go
starcoder
package integration // Specifies the data collection integration between Microsoft Azure and SignalFx, in the form of a JSON object. type JiraIntegration struct { // The creation date and time for the integration object, in Unix time UTC-relative. The system sets this value, and you can't modify it. Created int64 `j...
integration/model_jira_integration.go
0.695338
0.448185
model_jira_integration.go
starcoder
package ecc import ( "fmt" "math/big" "github.com/ravdin/programmingbitcoin/util" ) // Useful constants for secp256k1: // _G: Generator point. // _A, _B: 0 and 7 respectively, for y^2 = x^3 + 7 // _N: order of the finite field. // _P: Large prime number that is less than 2^256. var ( _G *S256Point _A *s256Field...
ecc/s256point.go
0.768907
0.482978
s256point.go
starcoder
package easing import ( "github.com/gravestench/mathlib" "math" ) const ( defaultAmplitude = 0.1 defaultPeriod = 0.1 ) var _ EaseFunctionProvider = &ElasticOutEaseProvider{} var _ EaseFunctionProvider = &ElasticInEaseProvider{} var _ EaseFunctionProvider = &ElasticInOutEaseProvider{} type ElasticOutEaseProvi...
pkg/easing/elastic.go
0.714329
0.402157
elastic.go
starcoder
package forge import ( netv1 "k8s.io/api/networking/v1" netv1apply "k8s.io/client-go/applyconfigurations/networking/v1" ) // RemoteIngress forges the apply patch for the reflected ingress, given the local one. func RemoteIngress(local *netv1.Ingress, targetNamespace string) *netv1apply.IngressApplyConfiguration { ...
pkg/virtualKubelet/forge/ingresses.go
0.685107
0.422386
ingresses.go
starcoder
// Package gb provides holiday definitions for the United Kingdom. package gb import ( "time" "github.com/rickar/cal/v2" "github.com/rickar/cal/v2/aa" ) var ( // Standard UK weekend substitution rules: // Saturdays move to Monday // Sundays move to Monday weekendAlt = []cal.AltDay{ {Day: time.Saturday,...
v2/gb/gb_holidays.go
0.506591
0.592224
gb_holidays.go
starcoder
package anidb import ( "fmt" "regexp" "strconv" "strings" "time" "github.com/PuerkitoBio/goquery" "shitty.moe/satelit-project/satelit-scraper/proto/data" ) // Parses and returns list of episodes or empty slice if episodes not found. func (p *Parser) episodes() []*data.Episode { eps := make([]*data.Episode, 0...
parser/anidb/episode.go
0.627609
0.407039
episode.go
starcoder
package gp import ( "math" "time" ) type FitnessFunc func(gp *GP, inputs, outputs [][]float64) int // An example fitness function which treats // the output as a environment to compare // a modified environment by the GP to. func EnvFitness(g *GP, inputs, outputs [][]float64) int { fitness := 1 for i, envDiff :=...
gp/fitness.go
0.703957
0.452294
fitness.go
starcoder
package controller import ( "fmt" wfv1 "github.com/argoproj/argo-workflows/v3/pkg/apis/workflow/v1alpha1" ) type counter func(wfv1.NodeStatus) bool func (woc *wfOperationCtx) getActivePodsCounter(boundaryID string) counter { return func(node wfv1.NodeStatus) bool { return node.Type == wfv1.NodeTypePod && //...
workflow/controller/node_counters.go
0.628293
0.400749
node_counters.go
starcoder
package adaboost_classifier import ( "fmt" "sync" "sort" mlearn "datamining-hw/machine_learning" ) //---------------------------------------------------------------------------------------------------------------------- type CARTClassifier struct { tree_root *treeNode } type CARTClassifierTrai...
adaboost_classifier/cart_classifier.go
0.619932
0.434461
cart_classifier.go
starcoder
package charts import ( "github.com/weslintw/go-tachart/opts" ) type Overlaper interface { overlap() MultiSeries } // XYAxis represent the X and Y axis in the rectangular coordinates. type XYAxis struct { XAxisList []opts.XAxis `json:"xaxis"` YAxisList []opts.YAxis `json:"yaxis"` } func (xy *XYAxis) initXYAxis(...
charts/rectangle.go
0.783988
0.405566
rectangle.go
starcoder
package funk import ( "fmt" "math/rand" "reflect" "strings" ) // Chunk creates an array of elements split into groups with the length of size. // If array can't be split evenly, the final chunk will be // the remaining element. func Chunk(arr interface{}, size int) interface{} { if !IsIteratee(arr) { panic("Fi...
transform.go
0.734691
0.544862
transform.go
starcoder
package mocks import "time" // MetricsProvider implements a mock ActivityPub metrics provider. type MetricsProvider struct{} // OutboxPostTime records the time it takes to post a message to the outbox. func (m *MetricsProvider) OutboxPostTime(value time.Duration) { } // OutboxResolveInboxesTime records the time it ...
pkg/mocks/metricsprovider.go
0.708213
0.413832
metricsprovider.go
starcoder
package logreg import ( "context" "fmt" "math" "time" "github.com/campoy/mat" ) var matProduct = mat.Product // Accuracy computes the accuracy of x and theta predicting y. // It also returns a list of the misspredicted rows. func Accuracy(x, theta, y mat.Matrix) (float64, []int) { m := x.Rows() preds := HotD...
mnist/logreg/logreg.go
0.800146
0.644393
logreg.go
starcoder
package ext var symbols = map[string]rune{ `\exclam`: '!', `\#`: '#', `\$`: '$', `\%`: '%', `\&`: '&', `\lparen`: '(', `\rparen`: ')', `\plus`: '...
internal/ext/zsym.go
0.546254
0.613873
zsym.go
starcoder
package geo import ( "runtime" "sync" ) type Point struct { Y float64 // Lat X float64 // Lon } type Polygon struct { Points []Point } type BoundingBox struct { BottomLeft Point TopRight Point } func PointInPolygon(pt Point, poly Polygon) bool { bbox := GetBoundingBox(poly) if !PointInBoundingBox(pt, bb...
geo/geo.go
0.722135
0.429609
geo.go
starcoder
package dfl import ( "fmt" "reflect" "github.com/pkg/errors" ) // Within is a BinaryOperator that represents that the left value is between type Within struct { *BinaryOperator } // Dfl returns the DFL representation of this node as a string func (w Within) Dfl(quotes []string, pretty bool, tabs int) string { ...
pkg/dfl/Within.go
0.837254
0.473414
Within.go
starcoder
package merge import ( "reflect" "github.com/coreos/ignition/v2/config/util" ) // Rules of Config Merging: // 1) Parent and child configs must be the same version/type // 2) Only valid configs can be merged // 3) It is possible to merge two valid configs and get an invalid config // 3) For structs: // a) Member...
vendor/github.com/coreos/ignition/v2/config/merge/merge.go
0.565299
0.457379
merge.go
starcoder
package privacy import ( "crypto/subtle" "errors" "github.com/incognitochain/incognito-chain/common" ) // SchnorrPublicKey represents Schnorr Publickey // PK = G^SK + H^R type SchnorrPublicKey struct { publicKey *Point g, h *Point } func (schnorrPubKey SchnorrPublicKey) GetPublicKey() *Point { return schn...
privacy/schnorr.go
0.722331
0.407628
schnorr.go
starcoder
package main import ( "fmt" "go-guide/datastruct/binaryTree/traversal/levelorder" . "go-guide/datastruct/binaryTree/treeNode" "log" ) /** ้ข˜็›ฎ๏ผšhttps://leetcode-cn.com/problems/merge-two-binary-trees/ ๅˆๅนถไบŒๅ‰ๆ ‘ ็ป™ๅฎšไธคไธชไบŒๅ‰ๆ ‘๏ผŒๆƒณ่ฑกๅฝ“ไฝ ๅฐ†ๅฎƒไปฌไธญ็š„ไธ€ไธช่ฆ†็›–ๅˆฐๅฆไธ€ไธชไธŠๆ—ถ๏ผŒไธคไธชไบŒๅ‰ๆ ‘็š„ไธ€ไบ›่Š‚็‚นไพฟไผš้‡ๅ ใ€‚ ไฝ ้œ€่ฆๅฐ†ไป–ไปฌๅˆๅนถไธบไธ€ไธชๆ–ฐ็š„ไบŒๅ‰ๆ ‘ใ€‚ๅˆๅนถ็š„่ง„ๅˆ™ๆ˜ฏๅฆ‚ๆžœไธคไธช่Š‚็‚น้‡ๅ ๏ผŒ้‚ฃไนˆๅฐ†ไป–ไปฌ็š„ๅ€ผ็›ธๅŠ ไฝœไธบ่Š‚็‚นๅˆๅนถๅŽ็š„ๆ–ฐๅ€ผ๏ผŒๅฆๅˆ™ไธไธบNULL ็š„่Š‚็‚นๅฐ†...
datastruct/binaryTree/leetcodeQuestion/mergeTrees/mergeTrees.go
0.544801
0.49469
mergeTrees.go
starcoder
package processor import ( "encoding/xml" "fmt" "time" "github.com/Jeffail/benthos/v3/internal/docs" "github.com/Jeffail/benthos/v3/lib/log" "github.com/Jeffail/benthos/v3/lib/metrics" "github.com/Jeffail/benthos/v3/lib/types" "github.com/clbanning/mxj" "github.com/opentracing/opentracing-go" ) //----------...
lib/processor/xml.go
0.782953
0.698097
xml.go
starcoder
package rtda import ( "math" "jvm/pkg/rtda/heap" ) type OperandStack struct { size uint slots []Slot } func NewOperandStack(maxStack uint) *OperandStack { if maxStack > 0 { return &OperandStack{ slots: make([]Slot, maxStack), } } return nil } func (this *OperandStack) PushInt(val int32) { this.slo...
pkg/rtda/operand_stack.go
0.675765
0.446977
operand_stack.go
starcoder
package rbtree type Optional[T any] struct { v T some bool } func (o *Optional[T]) IsSome() bool { return o.some } func (o *Optional[T]) Unwrap() T { if o.some { return o.v } else { panic(`unwrap none`) } } func None[T any]() Optional[T] { return Optional[T]{} } func Some[T any](v T) Optional[T] { r...
goofy/rbtree-go2/rbtree.go
0.603698
0.403508
rbtree.go
starcoder
package geom import ( "github.com/water-vapor/euclidea-solver/configs" "github.com/water-vapor/euclidea-solver/pkg/hashset" "math" "math/rand" ) // Circle is a circle is uniquely determined by its center point and radius type Circle struct { hashset.Serializable center *Point r float64 } // NewCircleByPo...
pkg/geom/circle.go
0.877096
0.530054
circle.go
starcoder
package kv import ( "bytes" "encoding" "fmt" "strconv" ) // KeyValue represents a node in a KeyValue tree. type KeyValue interface { // Type returns the node's Type. Type() Type // SetType sets the node's Type and returns the receiver. SetType(Type) KeyValue // Key returns the node's Key. Key() string // S...
kv.go
0.802439
0.421492
kv.go
starcoder
package lbadd import ( "fmt" "regexp" ) // Contains a command and associated information required to execute such command type instruction struct { command command table string params []string } // A single column on a single row type record []byte // A row containing multiple records type row []record // ...
executor.go
0.601594
0.498779
executor.go
starcoder
package gbrt import ( "context" "image" "image/color" "math" "github.com/apache/beam/sdks/v2/go/pkg/beam" "github.com/apache/beam/sdks/v2/go/pkg/beam/core/sdf" "github.com/apache/beam/sdks/v2/go/pkg/beam/io/rtrackers/offsetrange" "github.com/apache/beam/sdks/v2/go/pkg/beam/log" ) //go:generate go install git...
gbrt/lib/beam.go
0.70304
0.405154
beam.go
starcoder
package components import ( "github.com/almerlucke/go-farsounds/farsounds" ) // Osc uses a phasor to do a lookup type Osc struct { // Lookup table *Lookup // Phasor for lookup *Phasor // Amplitude of output Amplitude float64 } // NewOsc creates a new table lookup oscillator func NewOsc(table []float64, phase ...
farsounds/components/osc.go
0.681409
0.427695
osc.go
starcoder
package main import ( "bufio" "fmt" "github.com/pkg/errors" "io" "math" "os" "strconv" "strings" ) type Point struct { x int y int } func (p *Point) Neighbours() []*Point { return []*Point{ {x: p.x + 1, y: p.y}, {x: p.x - 1, y: p.y}, {x: p.x, y: p.y + 1}, {x: p.x, y: p.y - 1}, {x: p.x + 1, y: p....
cmd/day6/day6.go
0.712632
0.477067
day6.go
starcoder
package firmware import ( "reflect" "sort" pb "chromiumos/tast/services/cros/firmware" ) // allGBBFlags has all the GBB Flags in sorted order. var allGBBFlags []pb.GBBFlag func init() { for _, v := range pb.GBBFlag_value { allGBBFlags = append(allGBBFlags, pb.GBBFlag(v)) } sort.Slice(allGBBFlags, func(i, j...
src/chromiumos/tast/common/firmware/gbb_flags.go
0.71423
0.497253
gbb_flags.go
starcoder
package cov import ( "fmt" "sort" "strings" ) type treeFile struct { tcm TestCoverageMap spangroups map[SpanGroupID]SpanGroup } func newTreeFile() *treeFile { return &treeFile{ tcm: TestCoverageMap{}, spangroups: map[SpanGroupID]SpanGroup{}, } } // Tree represents source code coverage acro...
tests/regres/cov/tree.go
0.722135
0.44348
tree.go
starcoder
package stored import ( "fmt" "strings" errorConfigAVA "github.com/ver13/ava/pkg/common/config/error" errorAVA "github.com/ver13/ava/pkg/common/error" ) const ( // DialectTypePostgreSQL is a DialectType of type PostgreSQL DialectTypePostgreSQL DialectType = iota // DialectTypeSqlite3 is a DialectType of type...
pkg/common/config/model/stored/dialectType_enum.go
0.53437
0.475484
dialectType_enum.go
starcoder
package flattree type iterator struct { index uint64 // keeps track of the current index of the iterator offset uint64 // keeps track of the current offset of the iterator factor uint64 // keeps track of the factor of the iterator (2^depth) } // NewIterator will construct a new iterator at the designated position...
iterator.go
0.825203
0.65714
iterator.go
starcoder
package kiwi import ( "strconv" "strings" ) type Expression struct { Terms []Term Constant float64 } var _ Constrainer = Expression{} func (e Expression) GetValue() float64 { result := e.Constant for _, t := range e.Terms { result += t.GetValue() } return result } func (e Expression) IsConstant() boo...
expression.go
0.804713
0.433202
expression.go
starcoder
package strmatcher import ( "regexp" "sync" "time" "v2ray.com/core/common/task" ) // Matcher is the interface to determine a string matches a pattern. type Matcher interface { // Match returns true if the given string matches a predefined pattern. Match(string) bool } // Type is the type of the matcher. type ...
common/strmatcher/strmatcher.go
0.772788
0.476884
strmatcher.go
starcoder
// Based on https://github.com/golang/text/blob/master/encoding/japanese/shiftjis.go // Package sjisreplace provides a encoder to safely convert to Shift-JIS. package sjisreplace import ( "unicode/utf8" "golang.org/x/text/transform" ) // NewEncoder returns a new transformer that is very similar to the Shift-JIS ...
sjisreplace.go
0.706089
0.434701
sjisreplace.go
starcoder
package timestampvm import ( "errors" "fmt" "time" "github.com/ava-labs/avalanchego/ids" "github.com/ava-labs/avalanchego/snow/choices" "github.com/ava-labs/avalanchego/snow/consensus/snowman" "github.com/ava-labs/avalanchego/utils/hashing" ) var ( errTimestampTooEarly = errors.New("block's timestamp is ear...
timestampvm/block.go
0.670069
0.426441
block.go
starcoder
package iso20022 // Set of characteristics related to a cheque instruction, such as cheque type or cheque number. type Cheque6 struct { // Specifies the type of cheque to be issued. ChequeType *ChequeType2Code `xml:"ChqTp,omitempty"` // Unique and unambiguous identifier for a cheque as assigned by the agent. Che...
Cheque6.go
0.740268
0.452173
Cheque6.go
starcoder
package jwtee import ( "time" ) // RegisteredClaims are the IANA registered โ€œJSON Web Token Claimsโ€. type RegisteredClaims struct { // The "aud" (audience) claim identifies the recipients that the JWT is // intended for. Each principal intended to process the JWT MUST // identify itself with a value in the...
claims.go
0.719876
0.457924
claims.go
starcoder
package schemax type collection []interface{} /* len returns the length of the receiver as an int. */ func (c *collection) len() int { return len(*c) } /* index is a panic-proof slice indexer that returns an interface member based on the idx integer argument. This method is not thread-safe unto itself, and should o...
collection.go
0.697609
0.53443
collection.go
starcoder
package material import ( "math" "github.com/nicholasblaskey/raytracer/matrix" "github.com/nicholasblaskey/raytracer/tuple" ) type Pattern interface { At(tuple.Tuple) tuple.Tuple AtObject(Object, tuple.Tuple) tuple.Tuple GetTransform() matrix.Mat4 SetTransform(matrix.Mat4) } // Hmmm rethink this abstraction....
material/pattern.go
0.503418
0.49469
pattern.go
starcoder
package parser import ( "github.com/ywangd/gobufrkit/table" "github.com/ywangd/gobufrkit/deserialize/ast" "fmt" "math/bits" ) // Parser creates a tree of ast.Node from an UnexpandedTemplate. // The tree is created according to the structural information of the template. // The goal of having this tree...
deserialize/parser/parser.go
0.782829
0.54056
parser.go
starcoder
package gmono256 /** This package implements monoalphabetic cipher for single byte, each byte may contain 256 numbers, monoalphabetic cipher is also called simple substitution cipher. Reference: https://en.wikipedia.org/wiki/Substitution_cipher This is a simple encryption algorithm that can be used in short or low sec...
crypto/gmono256/mono256.go
0.859472
0.41324
mono256.go
starcoder
package economist import ( "github.com/coschain/contentos-go/app" "github.com/coschain/contentos-go/common/constants" . "github.com/coschain/contentos-go/dandelion" "github.com/stretchr/testify/assert" "math" "math/big" "testing" ) type UtilTester struct {} func (tester *UtilTester) Test(t *testing.T, d *Dand...
tests/economist/util.go
0.556882
0.60743
util.go
starcoder
package should // Exports JSON (and potentially other data structures or mocks) as an interface import ( "fmt" "github.com/Jeffail/gabs" ) type StructureParser func(rawBody string) (StructureExplorer, error) // ParseJSONExplorer implements StructureParser, parsing a JSON string into a // GabsExplorer func ParseJ...
should/structureExplorer.go
0.736021
0.556098
structureExplorer.go
starcoder
package main var input = `rect 1x1 rotate row y=0 by 2 rect 1x1 rotate row y=0 by 5 rect 1x1 rotate row y=0 by 3 rect 1x1 rotate row y=0 by 3 rect 2x1 rotate row y=0 by 5 rect 1x1 rotate row y=0 by 5 rect 4x1 rotate row y=0 by 2 rect 1x1 rotate row y=0 by 2 rect 1x1 rotate row y=0 by 5 rect 4x1 rotate row y=0 by 3 rec...
days/8/input.go
0.628977
0.736282
input.go
starcoder
package idemix import ( "io" math "github.com/IBM/mathlib" "github.com/pkg/errors" ) // credRequestLabel is the label used in zero-knowledge proof (ZKP) to identify that this ZKP is a credential request const credRequestLabel = "credRequest" // Credential issuance is an interactive protocol between a user and an...
vendor/github.com/IBM/idemix/bccsp/schemes/dlog/crypto/credrequest.go
0.727298
0.540621
credrequest.go
starcoder
package apitest import ( "bufio" "bytes" "encoding/json" "errors" "fmt" "net/http" "reflect" "runtime" "strings" "time" "unicode" "unicode/utf8" ) // TestingT is an interface to wrap the native *testing.T interface, this allows integration with GinkgoT() interface // GinkgoT interface defined in https://g...
assert.go
0.711531
0.410638
assert.go
starcoder
package tdutil import ( "math" "reflect" "github.com/maxatome/go-testdeep/internal/visited" ) func cmpRet(less, gt bool) int { if less { return -1 } if gt { return 1 } return 0 } func cmpFloat(a, b float64) int { if math.IsNaN(a) { return -1 } if math.IsNaN(b) { return 1 } return cmpRet(a < b,...
vendor/github.com/maxatome/go-testdeep/helpers/tdutil/sort.go
0.615203
0.418816
sort.go
starcoder
package mbpqs // SignatureSeqNo is the sequence number (index) of signatures and wotsKeys in channels and the root tree. type SignatureSeqNo uint32 // Signature is the interface type for RootSignature, MsgSignature, and GrowSignature. type Signature interface { NextAuthNode(prevAuthNode ...[]byte) []byte // Retrieve...
signatures.go
0.717012
0.450118
signatures.go
starcoder
package common import ( "fmt" "math" "math/big" "reflect" "unicode" "unicode/utf8" ) // Numeric func Float64GetExponent(v float64) int { return int((math.Float64bits(v)>>52)&0x7ff) - 1023 } // Determines how many numeric digits can be stored per X bits var bitsToHexDigitsTable = []int{0, 1, 1, 1, 1, 2, 2, ...
internal/common/common.go
0.654453
0.492981
common.go
starcoder
// Get status of the first installed NVIDIA graphics card. Uses NVML to communicate with it. package main import ( "log" "time" "gitlab.com/Drauthius/gpu-monitoring-tools/bindings/go/nvml" ) // The type of a graphic card result type GraphicCardResult struct { Temperature float64 // The temperature in the desi...
nvidia.go
0.649134
0.455441
nvidia.go
starcoder
package glmki3d import ( "errors" "github.com/go-gl/gl/v3.3-core/gl" "github.com/mki1967/go-mki3d/mki3d" ) // DataShaderTr is a binding between data and a shader for triangles type DataShaderTr struct { ShaderPtr *ShaderTr // pointer to the GL shader program structure VAO uint32 // GL Vert...
glmki3d/data-shader.go
0.606265
0.506469
data-shader.go
starcoder
package conf // Uint64Var defines a uint64 flag and environment variable with specified name, default value, and usage string. // The argument p points to a uint64 variable in which to store the value of the flag and/or environment variable. func (c *Configurator) Uint64Var(p *uint64, name string, value uint64, usage ...
value_uint64.go
0.764012
0.715474
value_uint64.go
starcoder
package pgo type ShapeFlags uint32 const ( /** \brief The shape will partake in collision in the physical simulation. \note It is illegal to raise the eSIMULATION_SHAPE and eTRIGGER_SHAPE flags. In the event that one of these flags is already raised the sdk will reject any attempt to raise the other. To raise ...
pgo/shaperflags.go
0.674801
0.561215
shaperflags.go
starcoder
package main import ( "bytes" "fmt" "log" "math" ) type Point struct { X, Y float64 } // Angle determines the angle of the vector defined by [0,0] to this point func angle(p Point) float64 { if p.X == 0.0 { if p.Y > 0.0 { return 90.0 } else { return 270.0 } } ang := math.Atan(p.Y/p.X) / math.Pi *...
x/examples/maze/maze.go
0.708313
0.428891
maze.go
starcoder
package logging import ( "github.com/go-logr/logr" ) // A Logger logs messages. Messages may be supplemented by structured data. type Logger interface { // Info logs a message with optional structured data. Structured data must // be supplied as an array that alternates between string keys and values of // an arb...
pkg/logging/logging.go
0.716417
0.422207
logging.go
starcoder
package funk import ( "fmt" "reflect" ) // ForEachOption defines the options for ForEach type ForEachOption struct { Reverse bool } var boolType = reflect.TypeOf(true) // ForEach iterates over elements of collection and invokes iteratee for each element. func ForEach(arr interface{}, predicate interface{}, optio...
scan.go
0.561455
0.412708
scan.go
starcoder
package eval import ( "dito/src/object" "io" "math" "math/rand" "os" "time" ) // Builtins : map of builtin functions var Builtins = map[string]*object.Builtin{ // type conversions. "int": &object.Builtin{ Name: "int", Fn: typeSwitch(object.IntType), Info: "Convert value to `Int`", ArgC: ...
src/eval/builtins.go
0.64713
0.501953
builtins.go
starcoder
package mlpack /* #cgo CFLAGS: -I./capi -Wall #cgo LDFLAGS: -L. -lmlpack_go_det #include <capi/det.h> #include <stdlib.h> */ import "C" import "gonum.org/v1/gonum/mat" type DetOptionalParam struct { Folds int InputModel *dTree MaxLeafSize int MinLeafSize int PathFormat string SkipPruning bo...
det.go
0.645343
0.453746
det.go
starcoder
package specialized // CacheMetrics carries metrics about a cache usage. type CacheMetrics struct { // Stats on MFA // HitMFA is the count of hits that returned a value from MFA. // Note that a hit on MFA will make the cache skip LRU. HitMFA uint // MissMFA is the count of misses on MFA access. MissMFA uint /...
proxy/internal/specialized/metrics.go
0.656548
0.534248
metrics.go
starcoder
package main import "fmt" const ( RED = 0 BLACK = 1 ) type rb_node struct { key int val int color int parent *rb_node left_child *rb_node right_child *rb_node } type rb_tree struct { root_node *rb_node size int } var nil_node = __nil_node() func assert(result bool) { if !result { pa...
rb_tree.go
0.547948
0.443118
rb_tree.go
starcoder
package main import ( "bufio" "fmt" "os" "strconv" "strings" ) type Line struct { Xa, Ya, Xb, Yb int } func NewLine(xa, ya, xb, yb int) *Line { return &Line{Xa: xa, Ya: ya, Xb: xb, Yb: yb} } func ParseLine(s string) *Line { f := strings.Fields(s) if f[1] != "->" { panic("A line of input did not contain a...
five/main.go
0.574872
0.428413
main.go
starcoder
package sorting import "sort" func activityNotifications(expenditure []int32, d int32) int32 { // 0 <= expenditure[i] <= 200 // NOTE - https://en.wikipedia.org/wiki/Counting_sort counts := make([]int32, 201) for _, n := range expenditure[:d] { counts[n]++ } getMedian := medianOdd if d%2 == 0 { getMedian ...
hacker_rank/interview_preparation_kit/sorting/activity_notifications.go
0.643553
0.440229
activity_notifications.go
starcoder
package intintmap import ( "math" ) // IntPhi is for scrambling the keys const ( IntPhi = uint64(0x9E3779B9) minMapSize = 8 ) func phiMix(x uint64) uint64 { h := x * IntPhi return h ^ (h >> 16) } // Map is a map-like data-structure for int64s type Map struct { data []uint64 // interleaved keys and v...
intintmap.go
0.660939
0.529507
intintmap.go
starcoder
package main import "lang1/ast" import "log" import "strconv" import "math/rand" /** Various tests for the robot to detect a wall and other features of the maze **/ func (rstate RobotState) test_wall(dir string) bool { maze := rstate.maze posx := nMod(rstate.x, rstate.mx) posy := nMod(rstate.y,rstate.my) wall :=...
robot_sensor.go
0.655667
0.416441
robot_sensor.go
starcoder
package navigation import ( "errors" "math" ) //Position holds the current location type Position struct { X, Y int } //ManhattanDistance returns the manhattan distance of the location func (p *Position) ManhattanDistance() int { return int(math.Abs(float64(p.X)) + math.Abs(float64(p.Y))) } //NewPosition create...
pkg/navigation/navigation.go
0.79736
0.613381
navigation.go
starcoder
package check import "math" // AllKeyValuePairsInMapStringString checks if all key-value pairs from one map[string]string are in another map[string]string. // When any of the maps is empty, the function returns false. func AllKeyValuePairsInMapStringString(Map1, Map2 map[string]string) bool { if len(Map1) == 0 || le...
anyallkeyvaluepairs.go
0.794704
0.688665
anyallkeyvaluepairs.go
starcoder
package math import ( "math" "math/rand" "time" ) // Rounds value up to precision number of digits. func Ceil(value float64, precision int) float64 { multiplier := math.Pow10(precision) return math.Ceil(value*multiplier) / multiplier } // Rounds value down to precision number of digits. func Floor(value float64...
round.go
0.864582
0.794465
round.go
starcoder
package inode import ( P "github.com/chadnetzer/hardlinkable/internal/pathpool" ) type PathInfo struct { P.Pathsplit StatInfo } func (p1 PathInfo) EqualTime(p2 PathInfo) bool { return p1.Mtim.Equal(p2.Mtim) } func (p1 PathInfo) EqualMode(p2 PathInfo) bool { return p1.Mode == p2.Mode } func (p1 PathInfo) Equa...
internal/inode/path.go
0.625552
0.421969
path.go
starcoder
package callgraph import ( "github.com/vkcom/nocolor/internal/palette" ) // CallstackOfColoredFunctions is a structure for storing a stack of called // colored functions with a quick check for the presence of a certain node. type CallstackOfColoredFunctions struct { // Stack is functions placed in order, only color...
internal/callgraph/callstack.go
0.731251
0.495728
callstack.go
starcoder
package core // MetricSampleListener is a listener to receive samples for a distribution type MetricSampleListener interface { // AddSample will add a sample metric to the listener AddSample(value float64, tags ...string) } // EmptyMetricSampleListener implements a sample listener that ignores everything. type Empt...
core/metric_registry.go
0.903578
0.413773
metric_registry.go
starcoder
package processor import ( "bytes" "fmt" "strconv" "github.com/OneOfOne/xxhash" "github.com/Jeffail/benthos/lib/log" "github.com/Jeffail/benthos/lib/metrics" "github.com/Jeffail/benthos/lib/types" "github.com/Jeffail/gabs" ) //------------------------------------------------------------------------------ ...
lib/processor/dedupe.go
0.704262
0.611179
dedupe.go
starcoder
// Package ngt provides implementation of Go API for https://github.com/yahoojapan/NGT package ngt /* #cgo LDFLAGS: -lngt #include <NGT/Capi.h> */ import "C" import ( "strings" "github.com/kpango/fastime" "github.com/vdaas/vald/internal/errors" ) type Option func(*ngt) error var ( DefaultPoolSize = uint32(100...
internal/core/algorithm/ngt/option.go
0.576304
0.457864
option.go
starcoder
// Package aggregated constructs a checkin struct from a given batterystats proto. The checkin struct contains data categorized by each metric. package aggregated import ( "fmt" "log" "sort" "strings" "time" "github.com/golang/protobuf/proto" "github.com/google/battery-historian/bugreportutils" "github.com/g...
aggregated/aggregated_stats.go
0.804406
0.553204
aggregated_stats.go
starcoder
package gogm import ( "fmt" "math" ) // Vec4 is a vector with 4 components, of type T. type Vec4[T number] [4]T // Vec4CopyVec4 copies the content of src to dst. func Vec4CopyVec4[T1, T2 number](dst *Vec4[T1], src *Vec4[T2]) { dst[0] = T1(src[0]) dst[1] = T1(src[1]) dst[2] = T1(src[2]) dst[3] = T1(src[3]) } /...
vec4.go
0.743168
0.569853
vec4.go
starcoder
package iso20022 // Description of the financial instrument. type FinancialInstrumentAttributes50 struct { // Identification of a financial instrument. FinancialInstrumentIdentification *SecurityIdentification14 `xml:"FinInstrmId,omitempty"` // Place where the referenced financial instrument is listed. PlaceOfLi...
data/train/go/caea5ead9e4849f100973105cb2ca758e0e9c3a1FinancialInstrumentAttributes50.go
0.857813
0.469155
caea5ead9e4849f100973105cb2ca758e0e9c3a1FinancialInstrumentAttributes50.go
starcoder
package number import ( "github.com/miscoler/xlsx/internal/ml" ) var ( builtIn map[int]*builtInFormat typeDefault map[Type]int ) func init() { typeDefault = map[Type]int{ General: 0x00, Integer: 0x01, Float: 0x02, Date: 0x0e, Time: 0x14, DateTime: 0x16, DeltaTime: 0x2d, } ...
internal/number_format/indexed.go
0.511961
0.561155
indexed.go
starcoder
package main import ( "fmt" "io/ioutil" "log" "net/http" "regexp" "strconv" "strings" ) // Command is the interface that must be implemented by all commands // (eg: expect, tx) type Command interface { // Parse fills the command structure by parsing the data in the given // scanner, thus implementing the co...
commands.go
0.597138
0.403038
commands.go
starcoder
package types import ( "time" yaml "gopkg.in/yaml.v2" sdk "github.com/line/lfb-sdk/types" ) // NewCommissionRates returns an initialized validator commission rates. func NewCommissionRates(rate, maxRate, maxChangeRate sdk.Dec) CommissionRates { return CommissionRates{ Rate: rate, MaxRate: max...
x/staking/types/commission.go
0.823719
0.447219
commission.go
starcoder
package goyek import ( "errors" "strconv" ) // BoolParam represents a named boolean parameter that can be registered. type BoolParam struct { Name string Usage string Default bool } // IntParam represents a named integer parameter that can be registered. type IntParam struct { Name string Usage stri...
parameter.go
0.755457
0.429489
parameter.go
starcoder
package unit // Temperature represents a SI unit of temperature (in kelvin, K) type Temperature Unit // ... const ( Kelvin Temperature = 1e0 ) // FromCelsius converts temperature from ยฐC to ยฐK func FromCelsius(t float64) Temperature { return Temperature(t + 273.15) } // FromDelisle converts temperature from ยฐDe t...
temperature.go
0.93435
0.671999
temperature.go
starcoder
package fwk import ( "go-hep.org/x/hep/hbook" ) // Hist is a histogram, scatter or profile object that can // be saved or loaded by the HistSvc. type Hist interface { Name() string Value() interface{} } // HID is a histogram, scatter or profile identifier type HID string // H1D wraps a hbook.H1D for safe concur...
fwk/hsvc.go
0.738292
0.418519
hsvc.go
starcoder
package types // UniversityTeachingStaff holds the data for university teaching staff. type UniversityTeachingStaff struct { AssistantProfessors int `json:"assistant_professors" fake:"{number:100,1000}"` AssociateProfessors int `json:"associate_professors" fake:"{number:100,1000}"` FullProfessors int ...
types/education.go
0.500244
0.623979
education.go
starcoder
package abi import ( "encoding/binary" "fmt" "math/big" "reflect" "strconv" "github.com/mitchellh/mapstructure" "github.com/umbracle/go-web3" ) // Decode decodes the input with a given type func Decode(t *Type, input []byte) (interface{}, error) { if len(input) == 0 { return nil, fmt.Errorf("empty input") ...
vendor/github.com/umbracle/go-web3/abi/decode.go
0.68721
0.410815
decode.go
starcoder
package linbuf import ( "encoding/binary" "math" "github.com/valyala/bytebufferpool" ) type Encoder struct { b *bytebufferpool.ByteBuffer } func NewEncoder() Encoder { return Encoder{ b: bytebufferpool.Get(), } } func (e Encoder) Reset() { e.b.Reset() } func (e Encoder) Finalize() *bytebufferpool.ByteBuf...
encoder.go
0.706393
0.429429
encoder.go
starcoder
package sl import "github.com/theplant/cldr" var calendar = cldr.Calendar{ Formats: cldr.CalendarFormats{ Date: cldr.CalendarDateFormat{Full: "EEEE, dd. MMMM y", Long: "dd. MMMM y", Medium: "d. MMM y", Short: "d. MM. yy"}, Time: cldr.CalendarDateFormat{Full: "HH:mm:ss zzzz", Long: "HH:mm:ss z", Medium: "...
resources/locales/sl/calendar.go
0.500244
0.459197
calendar.go
starcoder
package eplot import ( "strings" "github.com/emer/etable/etable" "github.com/emer/etable/minmax" "github.com/goki/gi/gi" "github.com/goki/gi/gist" "github.com/goki/ki/kit" ) // PlotParams are parameters for overall plot type PlotParams struct { Title string `desc:"optional title at top of plot"` Typ...
eplot/params.go
0.681303
0.470007
params.go
starcoder
package batchnorm import ( "encoding/gob" "github.com/nlpodyssey/spago/ag" "github.com/nlpodyssey/spago/mat" "github.com/nlpodyssey/spago/mat/float" "github.com/nlpodyssey/spago/nn" ) var _ nn.Model = &Model{} // Model contains the serializable parameters. type Model struct { nn.Module W nn.Param `sp...
nn/normalization/batchnorm/batchnorm.go
0.897528
0.517388
batchnorm.go
starcoder
package tsm1 /* Tombstone file format: โ•”โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•Tombstone Fileโ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•— โ•‘ โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ” โ•‘ โ•‘ โ”‚ โ”‚โ”‚ ...
tsdb/tsm1/tombstone.go
0.650245
0.646586
tombstone.go
starcoder
package zstring import ( "errors" "strings" ) // Cut a string where a separator occurs func Cut(val string, separator string) (left, right string, found bool) { if i := strings.Index(val, separator); i >= 0 { return val[:i], val[i+len(separator):], true } return val, "", false } // Cut the string where the fi...
zstring/zstring.go
0.555676
0.448547
zstring.go
starcoder
package univ import ( "reflect" "strconv" ) // StructsIntSlice returns a slice of int. For more info refer to Slice types StructIntSlice() method. func StructsIntSlice(s interface{}, fieldName string) []int { return NewSlice(s).StructIntSlice(fieldName) } // StructsUintSlice returns a slice of int. For more info ...
lib/univ/slice.go
0.850251
0.526038
slice.go
starcoder