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 gofields import ( "fmt" "reflect" "strconv" "strings" ) // GetValue will extract the value at the given path from the data Go struct // E.g data = { Friends: []Friend{ { Name: "John" } }, path = "Friends.0.Name" will return "John" func GetValue(data interface{}, path string) (interface{}, error) { value...
internal/gofields/gofields.go
0.614278
0.478346
gofields.go
starcoder
Package app contains OpenEBS Dynamic Local PV provisioner Provisioner is created using the external storage provisioner library: https://github.com/kubernetes-sigs/sig-storage-local-static-provisioner Local PVs are an extension to hostpath volumes, but are more secure. https://kubernetes.io/docs/concepts/policy/pod-...
cmd/provisioner-localpv/app/doc.go
0.894063
0.602822
doc.go
starcoder
package evolution const ( SurvivorSelectionFitnessBased = "SurvivorSelectionFitnessBased" SurvivorSelectionRandom = "SurvivorSelectionRandom" ) // FitnessBasedSurvivorSelection returns a set of survivors proportionate to the survivor percentage. // It orders some of the best parents and some of the best child...
evolution/survivorselection.go
0.768125
0.485112
survivorselection.go
starcoder
package helper import ( machinev1alpha1 "github.com/gardener/machine-controller-manager/pkg/apis/machine/v1alpha1" ) const ( nameLabel = "name" // MachineSetKind is the kind of the owner reference of a machine set MachineSetKind = "MachineSet" // MachineDeploymentKind is the kind of the owner reference of a mac...
vendor/github.com/gardener/gardener/extensions/pkg/controller/worker/helper/helper.go
0.674372
0.435481
helper.go
starcoder
package assert import ( "reflect" "testing" "github.com/ppapapetrou76/go-testing/internal/pkg/values" ) // AssertableAny is the assertable structure for interface{} values. type AssertableAny struct { t *testing.T actual values.AnyValue } // That returns an AssertableAny structure initialized with the tes...
assert/any.go
0.787114
0.741323
any.go
starcoder
package winlog import ( "fmt" "time" "unicode/utf16" "unsafe" ) /* Convenience functions to get values out of an array of EvtVariant structures */ const ( EvtVarTypeNull = iota EvtVarTypeString EvtVarTypeAnsiString EvtVarTypeSByte EvtVarTypeByte EvtVarTypeInt16 EvtVarTypeUInt16 EvtVarTypeInt32 EvtVa...
evt_variant.go
0.53048
0.41941
evt_variant.go
starcoder
package collections // A Range is an iterable which yields successive integer values // between two endpoints. Ranges are non-destructive and can be // safely iterated repeatedly type Range struct { begin int end int } func NewRange(begin int, end int) *Range { if end < begin { panic(ErrInvalidRangeBounds) } ...
range.go
0.772445
0.476092
range.go
starcoder
package state import ( "math" "sort" "github.com/kzahedi/goent/continuous" pb "gopkg.in/cheggaaa/pb.v1" ) // KraskovStoegbauerGrassberger1 is an implementation of the first // algorithm presented in // <NAME>, <NAME>, and <NAME>. // Estimating mutual information. Phys. Rev. E, 69:066138, Jun 2004. // The functio...
continuous/state/KraskovStoegbauerGrassberger.go
0.693265
0.513973
KraskovStoegbauerGrassberger.go
starcoder
package continuous import ( "github.com/jtejido/stats" "github.com/jtejido/stats/err" "math" "math/rand" ) // Pareto distribution // https://en.wikipedia.org/wiki/Pareto_distribution#Bounded_Pareto_distribution type ParetoBounded struct { min, max, shape float64 // L, H, α src rand.Source } func Ne...
dist/continuous/pareto_bounded.go
0.744749
0.562477
pareto_bounded.go
starcoder
package ionoscloud import ( "encoding/json" ) // MaintenanceWindow A weekly 4 hour-long window, during which maintenance might occur type MaintenanceWindow struct { Time *string `json:"time"` DayOfTheWeek *DayOfTheWeek `json:"dayOfTheWeek"` } // NewMaintenanceWindow instantiates a new MaintenanceWi...
model_maintenance_window.go
0.77827
0.425486
model_maintenance_window.go
starcoder
package pokemon import ( "github.com/asukakenji/pokemon-go/generic" ) // ById is designed to be used with Iterable.Sort. // It returns a function that is usable as a parameter for Sort. // When ordering is Ascending, // the returned function returns true if p1 is less than p2 by id. func ById(ordering generic.Orderi...
pokemon/pokemon_comparators.go
0.727589
0.446133
pokemon_comparators.go
starcoder
// package shp implements shape structures/routines package shp import "github.com/cpmech/gosl/la" // constants const MINDET = 1.0e-14 // minimum determinant allowed for dxdR // ShpFunc is the shape functions callback function type ShpFunc func(S []float64, dSdR [][]float64, r, s, t float64, derivs bool) // Shape ...
shp/shp.go
0.672439
0.541773
shp.go
starcoder
package commitmentzkp import ( "math/big" "github.com/xlab-si/emmy/crypto/commitments" "github.com/xlab-si/emmy/crypto/common" ) // DFCommitmentMultiplicationProver proves for given commitments // c1 = g^x1 * h^r1, c2 = g^x2 * h^r2, c3 = g^x3 * h^r3 that x3 = x1 * x2. // Proof consists of three parallel proofs: /...
crypto/zkp/primitives/commitments/damgard-fujisaki_multiplication.go
0.561696
0.476336
damgard-fujisaki_multiplication.go
starcoder
package onshape import ( "encoding/json" ) // BTPStatementExpression275 struct for BTPStatementExpression275 type BTPStatementExpression275 struct { BTPStatement269 BtType *string `json:"btType,omitempty"` Expression *BTPExpression9 `json:"expression,omitempty"` } // NewBTPStatementExpression275 instantiates a n...
onshape/model_btp_statement_expression_275.go
0.687735
0.536859
model_btp_statement_expression_275.go
starcoder
package encode_consts const ( // NilMarker represents the encoding marker byte for a nil object NilMarker = 0xC0 // TrueMarker represents the encoding marker byte for a true boolean object TrueMarker = 0xC3 // FalseMarker represents the encoding marker byte for a false boolean object FalseMarker = 0xC2 // Int...
encoding/encode_consts/const.go
0.628977
0.503784
const.go
starcoder
package flow import ( "reflect" ) // reference by task runner on exectutors var Contexts []*FlowContext type FlowContext struct { Id int Steps []*Step Datasets []*Dataset ChannelBufferSize int // configurable channel buffer size for reading } func New() (fc *FlowContext) { ...
vendor/github.com/chrislusf/glow/flow/context.go
0.542621
0.409988
context.go
starcoder
package producer // Bool represents a function that returns a bool. type Bool func() bool // Int represents a function that returns a int. type Int func() int // Int8 represents a function that returns a int8. type Int8 func() int8 // Int16 represents a function that returns a int16. type Int16 func() int16 // Int...
functional/producer/producer.go
0.668015
0.525734
producer.go
starcoder
package parse import "strconv" // NodeType identifies the type of a parse tree node. type NodeType int func (t NodeType) String() string { switch t { case NodePrefix: return "prefix" case NodeGroup: return "group" case NodeValue: return "value" default: return "unknown type: " + strconv.Itoa(int(t)) } ...
hash/parse/node.go
0.721253
0.403626
node.go
starcoder
package math import ( "math" ) type BoundingBox struct { Min Vector3 Max Vector3 } func NewBoundingBox(Minimum, Maximum Vector3) *BoundingBox { box := &BoundingBox{} box.Set(Minimum, Maximum) return box } func (box *BoundingBox) Set(Minimum, Maximum Vector3) *BoundingBox { if Minimum.X < Maximum.X { box.Mi...
boundingBox.go
0.81231
0.551634
boundingBox.go
starcoder
package karytree // A Node is a typical recursive tree node, and it represents a tree // when it's traversed. The key is for data stored in the node. type Node struct { key interface{} n uint firstChild *Node nextSibling *Node } // NewNode creates a new node data key. func NewNode(key interface...
k-ary-tree.go
0.813572
0.400632
k-ary-tree.go
starcoder
package pair import "fmt" // PairStepType defines the type of pairing steps. type PairStepType byte const ( // PairStepWaiting is the step when waiting server waits for pairing request from a client. PairStepWaiting PairStepType = 0x00 // PairStepStartRequest sent from the client to the accessory to start pairin...
hap/pair/sequence_types.go
0.651133
0.427875
sequence_types.go
starcoder
package templatefunctions import ( "context" "math" "reflect" ) type ( // JsMath is exported as a template function JsMath struct{} // Math is our Javascript's Math equivalent Math struct{} ) // Func as implementation of debug method func (ml JsMath) Func(ctx context.Context) interface{} { return func() Mat...
templatefunctions/js_math.go
0.688992
0.744656
js_math.go
starcoder
package dense import ( "fmt" "gorgonia.org/tensor" ) // EqWidthBinner bins values within diminsions to the given intervals. type EqWidthBinner struct { // Intervals to bin. Intervals *tensor.Dense // Low values are the lower bounds. Low *tensor.Dense // High values are the upper bounds. High *tensor.Dense ...
pkg/v1/dense/discretize.go
0.77949
0.447702
discretize.go
starcoder
package connect const testVersion = 3 // define the standard pieces const ( WHITE byte = 'O' BLACK byte = 'X' ) // Board is the collection of hexes for the playing area type Board []string // ResultOf determines the winner of the provided board state func ResultOf(board []string) (string, error) { b := Board(boa...
exercises/practice/connect/connect.go
0.796015
0.413359
connect.go
starcoder
package models import ( i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91 "github.com/microsoft/kiota-abstractions-go/serialization" ) // AccessPackageAnswer type AccessPackageAnswer struct { // Stores additional data not described in the OpenAPI description found when deserializing. Can be u...
models/access_package_answer.go
0.637369
0.421373
access_package_answer.go
starcoder
package testdata // GetInvoiceResponse example const GetInvoiceResponse = `{ "resource": "invoice", "id": "inv_xBEbP9rvAq", "reference": "2016.10000", "vatNumber": "NL001234567B01", "status": "open", "issuedAt": "2016-08-31", "dueAt": "2016-09-14", "netAmount": { "value": "45.00...
testdata/invoices.go
0.78016
0.487429
invoices.go
starcoder
package dfs import ( "fmt" "sort" "github.com/wangyoucao577/algorithms_practice/graph" ) // StronglyConnectedComponent represent a strongly connected component, // include all vertexs within type StronglyConnectedComponent []graph.NodeID // For Sort Interfaces func (s StronglyConnectedComponent) Len() int { retu...
dfs/strongly_connected_component.go
0.725649
0.407392
strongly_connected_component.go
starcoder
package neighbor import ( "sync/atomic" ) // Defines the metrics of a Neighbor type NeighborMetrics struct { allTxsCount uint32 invalidTxsCount uint32 staleTxsCount uint32 randomTxsCount uint32 sentTxsCount uint32 newTxsCount uint32 dro...
plugins/gossip/neighbor/neighborMetrics.go
0.802052
0.430147
neighborMetrics.go
starcoder
package pacmaneffect import ( "fmt" "reflect" "strconv" "strings" ) // Pacman contains the slice type Pacman struct { slice interface{} } // Effect describes the transformation to apply to the slice type Effect struct { start, end, step string effectType EffectType } // EffectType describes the possibl...
pacman.go
0.804214
0.613208
pacman.go
starcoder
package payload import ( "github.com/ywangd/gobufrkit/bufr" "github.com/ywangd/gobufrkit/deserialize/ast" "github.com/pkg/errors" "github.com/ywangd/gobufrkit/table" ) // assocPair is a wrapper of a pair of data representing the number of bits // and the associated field significance node. type assocP...
deserialize/payload/build.go
0.723602
0.517205
build.go
starcoder
package ecdsa // Copyright 2010 The Go Authors. All rights reserved. // Copyright 2011 ThePiachu. All rights reserved. // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. // Package bitelliptic implements several Koblitz elliptic curves over prime // fields. // Thi...
utils/ecdsa/bitelliptic.go
0.747247
0.645455
bitelliptic.go
starcoder
package root import ( "github.com/MakeNowJust/heredoc" "github.com/spf13/cobra" ) var HelpTopics = map[string]map[string]string{ "mintty": { "short": "Information about using gh with MinTTY", "long": heredoc.Doc(` MinTTY is the terminal emulator that comes by default with Git for Windows. It has known i...
pkg/cmd/root/help_topic.go
0.602179
0.40072
help_topic.go
starcoder
package sliceWrapper const pointerTemplate = `{{range .Types}} type {{.NameTitle}}Slice struct { s []*{{.Name}} } func New{{.NameTitle}}Slice() *{{.NameTitle}}Slice { return &{{.NameTitle}}Slice{} } func (v *{{.NameTitle}}Slice) Clear() { v.s = v.s[:0] } func (v *{{.NameTitle}}Slice) Equal(rhs *{{.NameTitle}}Sli...
sliceWrapper/pointerTemplate.go
0.657209
0.484868
pointerTemplate.go
starcoder
package rfc2868 import ( "strconv" "fbc/lib/go/radius" ) const ( TunnelType_Type radius.Type = 64 TunnelMediumType_Type radius.Type = 65 TunnelClientEndpoint_Type radius.Type = 66 TunnelServerEndpoint_Type radius.Type = 67 TunnelPrivateGroupID_Type radius.Type = 81 TunnelAssignmentID_Type ra...
feg/radius/lib/go/radius/rfc2868/generated.go
0.572484
0.416263
generated.go
starcoder
package geometry import ( "math" "github.com/tab58/v1/spatial/pkg/numeric" "gonum.org/v1/gonum/blas/blas64" ) // // MatrixReader is a read-only interface for a matrix. // type MatrixReader interface { // Rows() uint // Cols() uint // ElementAt(i, j uint) (float64, error) // ToBlas64General() blas64.General //...
pkg/geometry/matrix2d.go
0.756088
0.678294
matrix2d.go
starcoder
package main import ( "errors" "image" "image/color" _ "image/jpeg" _ "image/png" "log" "math" "os" _ "golang.org/x/image/webp" ) // Default SSIM constants var ( L = 255.0 K1 = 0.01 K2 = 0.03 C1 = math.Pow((K1 * L), 2.0) C2 = math.Pow((K2 * L), 2.0) ) func handleError(err error) { if err != nil { ...
ssim.go
0.741112
0.419113
ssim.go
starcoder
package promtest import ( "testing" "github.com/prometheus/client_golang/prometheus" ) type ExpectationLabelPair struct { LabelName string LabelValue string } // CheckPrometheusCounterVec is a helper method that checks that prometheus counter // has the expected value for the expected label on the passed in re...
verifier.go
0.788949
0.495422
verifier.go
starcoder
package reg // Collection represents a collection of virtual registers. This is primarily // useful for allocating virtual registers with distinct IDs. type Collection struct { idx map[Kind]Index } // NewCollection builds an empty register collection. func NewCollection() *Collection { return &Collection{ idx: ma...
tools/vendor/github.com/mmcloughlin/avo/reg/collection.go
0.904654
0.413773
collection.go
starcoder
package assertions import ( "fmt" "reflect" ) // ShouldHaveSameTypeAs receives exactly two parameters and compares their underlying types for equality. func ShouldHaveSameTypeAs(actual interface{}, expected ...interface{}) string { if fail := need(1, expected); fail != success { return fail } fir...
vendor/github.com/smartystreets/assertions/type.go
0.721645
0.631054
type.go
starcoder
package build import ( "fmt" "strings" ) // Stack is structure for a stack. A stack lists all targets that run during a build. type Stack struct { Targets []*Target } // NewStack makes a new stack // Returns: a pointer to the stack func NewStack() *Stack { stack := Stack{ Targets: make([]*Target, 0), } retur...
neon/build/stack.go
0.756987
0.405655
stack.go
starcoder
package tensor import ( "reflect" "unsafe" "sort" "github.com/pkg/errors" ) var ( _ Sparse = &CS{} ) // Sparse is a sparse tensor. type Sparse interface { Tensor Densor NonZeroes() int // NonZeroes returns the number of nonzero values } // coo is an internal representation of the Coordinate type sparse ma...
sparse.go
0.716516
0.444384
sparse.go
starcoder
package integration import ( "testing" "github.com/CyCoreSystems/ari" "github.com/pkg/errors" ) func TestBridgeCreate(t *testing.T, s Server) { key := ari.NewKey(ari.BridgeKey, "bridgeID") runTest("simple", t, s, func(t *testing.T, m *mock, cl ari.Client) { bh := ari.NewBridgeHandle(key, m.Bridge, nil) m...
internal/integration/bridge.go
0.593256
0.459804
bridge.go
starcoder
// Package counterlist is an example using go-frp modeled after the Elm example found at: // https://github.com/evancz/elm-architecture-tutorial/blob/master/examples/3/CounterList.elm package counterlist import ( c "github.com/gmlewis/go-frp/v2/examples/3/counter" h "github.com/gmlewis/go-frp/v2/html" ) // MODEL ...
examples/3/counterlist/counterlist.go
0.752286
0.407864
counterlist.go
starcoder
package selfupdate // Note: "|" will be replaced by backticks in the help string below var selfUpdateHelp = ` This command downloads the latest release of rclone and replaces the currently running binary. The download is verified with a hashsum and cryptographically signed signature. If used without flags (or with i...
cmd/selfupdate/help.go
0.559049
0.47171
help.go
starcoder
package bayesiannetwork import ( "math/rand" "sort" ) // Hold the PMF in sorted order by probabilty and the original indices of the // PMF (in "histogram order," I suppose) type Density struct { sorted []float64 // index is the original indices of the sorted probabilities -- corresponds // to Node State index ...
bayesiannetwork/node.go
0.587233
0.505859
node.go
starcoder
package primitives import ( "math" "math/rand" ) type Material interface { Bounce(ray Ray, hit HitRecord, rand *rand.Rand) (bool, Ray) Color() Vector } type Lambertian struct { C Vector } func (l Lambertian) Bounce(input Ray, record HitRecord, rand *rand.Rand) (bool, Ray) { direction := record.Normal.Add(Vect...
internal/primitives/material.go
0.803405
0.557484
material.go
starcoder
package objectbox /* This file implements obx_data_visitor forwarding to Go callbacks Overview: * Register a dataVisitor callback, getting a visitor ID. * Pass the registered visitor ID together with a generic dataVisitor (C.dataVisitorDispatch) to a C.obx_* function. * When ObjectBox calls dataVisitorDispatch, it...
objectbox/datavisitor.go
0.663451
0.431644
datavisitor.go
starcoder
package transform import ( "image" "net/url" "strconv" "strings" "github.com/Sirupsen/logrus" "github.com/disintegration/imaging" ) // RotateImage implements the rotating scheme described on: // https://docs.fastly.com/api/imageopto/orient func RotateImage(m image.Image, orient string) image.Image { switch or...
internal/image/transform/transform.go
0.695028
0.481698
transform.go
starcoder
package placement import ( "math" "sort" "github.com/pingcap/kvproto/pkg/metapb" "github.com/pingcap/pd/v4/pkg/slice" "github.com/pingcap/pd/v4/server/core" ) // RegionFit is the result of fitting a region's peers to rule list. // All peers are divided into corresponding rules according to the matching // rule...
server/schedule/placement/fit.go
0.727395
0.434161
fit.go
starcoder
Package admission provides implementation for admission webhook and methods to implement admission webhook handlers. The following snippet is an example implementation of mutating handler. type Mutator struct { client client.Client decoder types.Decoder } func (m *Mutator) mutatePodsFn(ctx context.Context, p...
vendor/sigs.k8s.io/controller-runtime/pkg/webhook/admission/doc.go
0.708818
0.482978
doc.go
starcoder
package cli import ( "bytes" "encoding/json" "fmt" "reflect" "strings" jmespath "github.com/danielgtaylor/go-jmespath-plus" "github.com/rs/zerolog/log" "gopkg.in/h2non/gentleman.v2/context" ) // The following equality functions are from stretchr/testify/assert. // objectsAreEqual determines if two objects ar...
cli/matcher.go
0.728845
0.533762
matcher.go
starcoder
package plt import ( "bytes" "github.com/cpmech/gosl/io" ) // The A structure holds arguments to configure plots, including style data for shapes (e.g. polygons) type A struct { // plot and basic options C string // color A float64 // transparency coefficient M string // marker Ls strin...
plt/arguments.go
0.505127
0.416144
arguments.go
starcoder
package fmom import ( "math" ) type EEtaPhiM [4]float64 func NewEEtaPhiM(et, eta, phi, m float64) EEtaPhiM { return EEtaPhiM([4]float64{et, eta, phi, m}) } func (p4 *EEtaPhiM) Clone() P4 { pp := *p4 return &pp } func (p4 *EEtaPhiM) E() float64 { return p4[0] } func (p4 *EEtaPhiM) Eta() float64 { return p4[...
fmom/eetaphim.go
0.710528
0.422862
eetaphim.go
starcoder
package make_geoimage import ( "github.com/skyhookml/skyhookml/skyhook" "github.com/skyhookml/skyhookml/exec_ops" gomapinfer "github.com/mitroadmaps/gomapinfer/common" geocoords "github.com/mitroadmaps/gomapinfer/googlemaps" "github.com/paulmach/go.geojson" "encoding/json" "fmt" "log" "math" "runtime" ) c...
exec_ops/make_geoimage/make_geoimage.go
0.653459
0.400691
make_geoimage.go
starcoder
package benchmark import ( "reflect" "testing" ) func isRunnableCalibrated(runnable func()) bool { return isCalibrated(reflect.Invalid, reflect.Invalid, reflect.ValueOf(runnable).Pointer()) } func isBoolSupplierCalibrated(supplier func() bool) bool { return isCalibrated(reflect.Invalid, reflect.Bool, reflect.Val...
common/benchmark/xx_runnable_and_supplier.go
0.715424
0.69849
xx_runnable_and_supplier.go
starcoder
package encoding import ( "github.com/OpenWhiteBox/primitives/matrix" ) func matrixMul(m *matrix.Matrix, dst, src []byte) { res := m.Mul(matrix.Row(src[:])) copy(dst, res) } // ByteAdditive implements the Byte interface over XORing with a fixed value. type ByteAdditive byte func (ba ByteAdditive) code(in byte) b...
encoding/linear.go
0.895099
0.780725
linear.go
starcoder
package sqlwriter import ( "fmt" "strings" ) type InsertStatement struct { tableName string columns []string values []interface{} returningColumn string } func Insert(tableName string, columns ...string) *InsertStatement { i := &InsertStatement{ tableName: tableName, columns: colu...
insert.go
0.550849
0.401277
insert.go
starcoder
package main import ( "bytes" "encoding/binary" "fmt" "log" ) // Value is a LZ77 sequence element - a literal or a pointer. type Value struct { IsLiteral bool // Literal val byte // Pointer distance uint16 length byte } func NewValue(isLiteral bool, value, length byte, distance uint16) Value { return ...
values.go
0.672869
0.427337
values.go
starcoder
package main import ( "fmt" "math" ) const ( INPUT = 368078 ) type Direction uint const ( UP Direction = iota LEFT DOWN RIGHT ) type Point struct{ x, y int } type Grid map[Point]int func turn(direction Direction) Direction { return (direction + 1) % 4 } func move(p Point, direction Direction) Point { sw...
03/main.go
0.67104
0.442697
main.go
starcoder
package vector import ( "math" "github.com/austingebauer/go-ray-tracer/maths" ) // Vector represents a vector in a left-handed 3D coordinate system type Vector struct { // X, Y, and Z represent components in a left-handed 3D coordinate system X, Y, Z float64 } // NewVector returns a new Vector that has the pass...
vector/vector.go
0.950595
0.870707
vector.go
starcoder
package comparator import ( "fmt" "reflect" "strconv" "strings" "github.com/litmuschaos/litmus-go/pkg/log" "github.com/pkg/errors" ) // CompareFloat compares floating numbers for specific operation // it check for the >=, >, <=, <, ==, != operators func (model Model) CompareFloat() error { obj := Float{} ob...
pkg/probe/comparator/float.go
0.680772
0.494385
float.go
starcoder
package bitmatrix import ( "fmt" "log" "github.com/dranidis/bitarray" "github.com/fatih/color" ) type bitMatrixArray struct { size int board *bitarray.BitArray } var rightMask map[int]*bitarray.BitArray var leftMask map[int]*bitarray.BitArray func initRightMask(num int) *bitarray.BitArray { rightMask := bi...
bitmatrixarr.go
0.647352
0.560192
bitmatrixarr.go
starcoder
package darts import ( "fmt" "strings" "github.com/deckarep/golang-set" "gonum.org/v1/gonum/mat" ) // Atom is the small cell in split type Atom struct { Image string //image of the atom St, End int // [start,end) of this atom in ori string Tags mapset.Set // type is set(string) } //String is...
src/darts/darts.go
0.628863
0.40698
darts.go
starcoder
package internal import ( "log" "reflect" ) func StrictEqual(actual interface{}, expectation interface{}) bool { if IsArray(actual) && IsArray(expectation) { actualArr, _ := actual.([]interface{}) expectationArr, _ := expectation.([]interface{}) return EqualArray(actualArr, expectationArr) } if IsObject(a...
internal/equal.go
0.624408
0.469763
equal.go
starcoder
// Package parse implements a simple expression parser. package parse import ( "strconv" "unicode" ) // Node is a node in the parse tree. It is a union of the three basic // types: Token (for all constants and variables), Call (for a // call expressions) and Map (for a curly-braces expressions) type Node struct {...
parse/types.go
0.817502
0.460653
types.go
starcoder
package termcolor import ( "go.uber.org/zap" "math" "strconv" "strings" ) var ( // ANSI terminal control codes // ColorPrefix contains the ANSI control code prefix ColorPrefix = "\u001b[" // ColorSuffix contains the ANSI control code suffix ColorSuffix = "m" // Reset contains the ANSI control code to rese...
pkg/termcolor/termcolor.go
0.735167
0.433322
termcolor.go
starcoder
package f5api // This describes a message sent to or received from some operations type NetStpGlobals struct { // Specifies the time interval in seconds between the periodic transmissions that communicate spanning tree information to the adjacent bridges in the network. The default value is 2 seconds, and the valid ...
net_stp_globals.go
0.845465
0.534855
net_stp_globals.go
starcoder
// Utility methods to calculate percentiles from raw data. package statscollector import ( "math" "sort" "time" "github.com/golang/glog" cadvisor "github.com/google/cadvisor/info" ) const milliSecondsToNanoSeconds = 1000000 const secondsToMilliSeconds = 1000 type uint64Slice []uint64 func (a uint64Slice) Le...
pkg/statscollector/util.go
0.710729
0.560433
util.go
starcoder
package models import ( i336074805fc853987abe6f7fe3ad97a6a6f3077a16391fec744f671a015fbd7e "time" i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91 "github.com/microsoft/kiota-abstractions-go/serialization" ) // AccessPackageAssignmentRequest type AccessPackageAssignmentRequest struct { En...
models/access_package_assignment_request.go
0.699357
0.434641
access_package_assignment_request.go
starcoder
// Package skein1024 implements the Skein1024 hash function // based on the Threefish1024 tweakable block cipher. package skein1024 import ( "hash" "github.com/aead/skein" ) // Sum512 computes the 512 bit Skein1024 checksum (or MAC if key is set) of msg // and writes it to out. The key is optional and can be nil....
vendor/github.com/aead/skein/skein1024/skein.go
0.840029
0.449211
skein.go
starcoder
package mathutil import ( "image" "golang.org/x/image/math/fixed" ) // Integer based float. Based on fixed.Int52_12. type Intf int64 func Intf1(x int) Intf { return Intf(x) << 12 } func Intf2(x fixed.Int26_6) Intf { return Intf(x) << 6 } func (x Intf) Floor() int { return int(x >> 12) } func (x Intf) C...
util/mathutil/geom.go
0.801936
0.508788
geom.go
starcoder
package field import ( "errors" "fmt" "github.com/xichen2020/eventdb/document/field" "github.com/xichen2020/eventdb/filter" "github.com/xichen2020/eventdb/index" "github.com/xichen2020/eventdb/values/impl" "github.com/xichen2020/eventdb/x/bytes" "github.com/xichen2020/eventdb/x/pool" "github.com/pilosa/pilo...
index/field/docs_field.go
0.684053
0.444263
docs_field.go
starcoder
package design import ( "io" "reflect" "github.com/gregoryv/draw" "github.com/gregoryv/draw/shape" ) // NewSequenceDiagram returns a sequence diagram with default column // width. func NewSequenceDiagram() *SequenceDiagram { return &SequenceDiagram{ Diagram: NewDiagram(), ColWidth: 190, VMargin: 10, } ...
design/seqdia.go
0.718594
0.491578
seqdia.go
starcoder
A Window tracks the number of times a counter has been incremented within a sliding window of epochs. These epochs are normally Unix epochs, but any monotonically incrementing counter is sufficient. The Window is initialized with the size of the sliding window and an epoch to consider as time 0. As events occur, ca...
timewindow.go
0.794584
0.635279
timewindow.go
starcoder
package animation import ( "github.com/wieku/danser-go/app/bmath" color2 "github.com/wieku/danser-go/framework/math/color" "github.com/wieku/danser-go/framework/math/vector" ) type TransformationType int64 type TransformationStatus int64 const ( Fade = TransformationType(1 << iota) Rotate Scale ScaleVector M...
framework/math/animation/transformation.go
0.744378
0.443962
transformation.go
starcoder
package elements import ( "github.com/ratorx/htmlgo" ) // A represents the HTML element 'a'. // For more information visit https://www.w3schools.com/tags/tag_a.asp. func A(attrs []htmlgo.Attribute, children ...HTML) HTML { return &htmlgo.Tree{Tag: "a", Attributes: attrs, Children: children} } // A_ is a convenien...
elements/elements.go
0.885471
0.410697
elements.go
starcoder
package stockdata import ( "github.com/windler/etf-dash/timeseries" ) //DataRetriever gets stockdata as timeseries.FloatSeries type DataRetriever interface { GetSeries(symbol string) timeseries.FloatSeries } //Analyzed reepresents analyzed stock data result type Analyzed struct { DepotValues map[string]timeserie...
stockdata/stockdata.go
0.74872
0.543348
stockdata.go
starcoder
package dfl import ( "fmt" "strings" "github.com/pkg/errors" "github.com/spatialcurrent/go-dfl/pkg/dfl/syntax" ) // ParseList parses a list of values. func ParseList(in string) ([]Node, error) { nodes := make([]Node, 0) singlequotes := 0 doublequotes := 0 backticks := 0 leftparentheses := 0 rightparen...
pkg/dfl/ParseList.go
0.51562
0.445288
ParseList.go
starcoder
// Package storetestcases defines test cases to test stores. package storetestcases import ( "testing" "github.com/stratumn/go-core/store" "github.com/stretchr/testify/require" ) // Factory wraps functions to allocate and free an adapter, // and is used to run the tests on an adapter. type Factory struct { // N...
store/storetestcases/storetestcases.go
0.659405
0.590897
storetestcases.go
starcoder
package bloomfilter // #cgo CFLAGS: -Wall // #cgo LDFLAGS: -lm // #include<math.h> import "C" import ( "bytes" "encoding/binary" "errors" "fmt" "io" "io/ioutil" "math" "github.com/Workiva/go-datastructures/bitarray" ) var strategyList []Strategy = []Strategy{&Murur128Mitz32{}, &Murur128Mitz64{}} // BloomFil...
bloomfilter.go
0.729327
0.443299
bloomfilter.go
starcoder
package controllers import ( "fmt" "io" "log" "os" "github.com/FelixDux/imposcg/charts" "github.com/FelixDux/imposcg/dynamics" "github.com/FelixDux/imposcg/dynamics/parameters" "github.com/FelixDux/imposcg/dynamics/impact" "github.com/gin-gonic/gin" ) type SingularitySetResult struct { Singularity []impac...
controllers/singularity-set.go
0.70912
0.405861
singularity-set.go
starcoder
package leap import "time" // A list of all two-second-long POSIX timestamps that cross a leap second. var Seconds = []int64{ time.Date(2015, 06, 30, 23, 59, 59, 0, time.UTC).Unix(), time.Date(2012, 06, 30, 23, 59, 59, 0, time.UTC).Unix(), time.Date(2008, 12, 30, 23, 59, 59, 0, time.UTC).Unix(), time.Date(2005, 1...
leap.go
0.527073
0.416559
leap.go
starcoder
package date import ( "bytes" "database/sql/driver" "errors" "fmt" "reflect" "time" ) // Date is an nullable date type without time and timezone. // In memory it stores year, month and day like joined hex integer 0x20180131 // what makes it comparable and sortable as integer. In database it stores // as DATE. N...
date.go
0.566139
0.418043
date.go
starcoder
import "github.com/kaitai-io/kaitai_struct_go_runtime/kaitai" /** * A variable-length integer, * in the format used by the 0xfe chunks in the `'dcmp' (0)` and `'dcmp' (1)` resource compression formats. * See the dcmp_0 and dcmp_1 specs for more information about these compression formats. * * This variable-len...
dcmp_variable_length_integer/src/go/dcmp_variable_length_integer.go
0.770206
0.489809
dcmp_variable_length_integer.go
starcoder
package pikselkapcio //getPaddedCharacterMap returns set of integers representing 7 rows of pixels of a given character, where first and last rows are empty ("padding") func getPaddedCharacterMap(character rune) [7]int8 { return padCharacterMap(getCharacterMap(character)) } //gadCharacterMap inserts zeros as first a...
character_map.go
0.699768
0.530054
character_map.go
starcoder
package geom func minf(x, y float64) float64 { if x < y { return x } return y } func maxf(x, y float64) float64 { if x > y { return x } return y } type Coordf struct { X, Y float64 } type Rectanglef struct { Min, Max Coordf } func Addf(lhs, rhs Coordf) Coordf { return Coordf{lhs.X + rhs.X, lhs.Y + rhs...
geom/geomf.go
0.888596
0.559892
geomf.go
starcoder
package models import ( i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91 "github.com/microsoft/kiota-abstractions-go/serialization" ) // Planner provides operations to manage the planner singleton. type Planner struct { Entity // Read-only. Nullable. Returns a collection of the specified ...
models/planner.go
0.708515
0.406302
planner.go
starcoder
package bloom import ( "math" ) type ( // Bloom is the standard bloom filter. Bloom interface { Add([]byte) AddString(string) Exist([]byte) bool ExistString(string) bool FalsePositive() float64 GuessFalsePositive(uint64) float64 M() uint64 K() uint64 N() uint64 Clear() } // CountingBloom is ...
pkg/bloom/bloom.go
0.673084
0.576959
bloom.go
starcoder
package cp import "fmt" type Shaper interface { Body() *Body MassInfo() *ShapeMassInfo HashId() HashValue SetHashId(HashValue) SetSpace(*Space) BB() BB SetBB(BB) } type ShapeClass interface { CacheData(transform Transform) BB Destroy() PointQuery(p Vector, info *PointQueryInfo) SegmentQuery(a, b Vector, r...
shape.go
0.716715
0.401834
shape.go
starcoder
package bigint import ( "math/big" "math/rand" "strings" ) // Zero returns 0. func Zero() *big.Int { return big.NewInt(0) } // One returns 1. func One() *big.Int { return big.NewInt(1) } // Hex constructs an integer from a hex string, returning the integer and a // boolean indicating success. Underscore may be...
vendor/github.com/mmcloughlin/addchain/internal/bigint/bigint.go
0.874037
0.536313
bigint.go
starcoder
package terminal import ( "github.com/cimomo/portfolio-go/pkg/portfolio" "github.com/gdamore/tcell" "github.com/rivo/tview" ) // ReturnViewer displays the trailing returns of a portfolio type ReturnViewer struct { performance *portfolio.Performance table *tview.Table } // NewReturnViewer returns a new vie...
pkg/terminal/return.go
0.742795
0.407098
return.go
starcoder
package assertions import ( "fmt" "testing" "github.com/buildpacks/pack/acceptance/managers" h "github.com/buildpacks/pack/testhelpers" ) type ImageAssertionManager struct { testObject *testing.T assert h.AssertionManager imageManager managers.ImageManager registry *h.TestRegistryConfig } func ...
acceptance/assertions/image.go
0.622345
0.50415
image.go
starcoder
package engine import ( "time" ) // TakeOff will start the blades and raise the drone to a normal flying height. func (e *Engine) TakeOff() { debug("Take off") e.ResetMovement() check(e.drone.TakeOff()) time.Sleep(5000 * time.Millisecond) } // Land will lower the drone to the ground and stop the blades. func (e...
engine/movement.go
0.653459
0.53358
movement.go
starcoder
package core import ( "encoding/hex" "fmt" // "log" "reflect" //"github.com/ethereum/go-ethereum/accounts/abi" "github.com/hpb-project/HCash-SDK/core/ebigint" solsha3 "github.com/miguelmota/go-solidity-sha3" "math/big" ) type GeneratorParams struct { g Point h Point gs *GeneratorVector hs *GeneratorVec...
core/algebra.go
0.542136
0.430207
algebra.go
starcoder
package hashtable import "github.com/jot85/collections" import "github.com/jot85/collections/list" import "unsafe" import "errors" var ErrFull = errors.New("HashTable container full") //HashFunction represents a function that can be used as a hash function for a hash table. //The first argument is a pointer to the d...
hashtable/hashtable.go
0.573678
0.413359
hashtable.go
starcoder
package interval import ( "fmt" "time" "github.com/eleme/lindb/pkg/util" ) // Type defines interval type type Type int const dayStr = "day" const monthStr = "month" const yearStr = "year" // Interval types. const ( Day Type = iota + 1 Month Year Unknown ) // String returns string value of interval type fun...
pkg/interval/interval.go
0.658198
0.433502
interval.go
starcoder
package bigqueue // Enqueue adds a new slice of byte element to the tail of the queue func (q *MmapQueue) Enqueue(message []byte) error { return q.enqueue(&bytesWriter{b: message}) } // EnqueueString adds a new string element to the tail of the queue func (q *MmapQueue) EnqueueString(message string) error { return ...
write.go
0.838812
0.5526
write.go
starcoder
package diagram import ( "fmt" "math" ) const arrowHeadLength = 21 // Block contains the x,y coordinates of the start of the block type Element struct { x, y float64 elementType string description string size int url string } type Point struct { x, y float64 } type Connector struct { b1, b2 int } type Tr...
diagram/diagram.go
0.718792
0.499573
diagram.go
starcoder
package exp import "strconv" // Eq type expEq struct { key string value float64 } func (eq expEq) Eval(p Params) bool { value, err := strconv.ParseFloat(p.Get(eq.key), 64) if err != nil { return false } return value == eq.value } func (eq expEq) String() string { return sprintf("[%s==%.2f]", eq.key, eq....
numbers.go
0.860266
0.621656
numbers.go
starcoder
package iso20022 // Specifies periods of a corporate action. type CorporateActionPeriod3 struct { // Period during which the price of a security is determined. PriceCalculationPeriod *Period1Choice `xml:"PricClctnPrd,omitempty"` // Period during which the interest rate has been applied. InterestPeriod *Period1Ch...
CorporateActionPeriod3.go
0.794225
0.659227
CorporateActionPeriod3.go
starcoder