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 bwmf import ( "fmt" "log" "math/rand" "os" "strconv" "time" "github.com/golang/protobuf/proto" "github.com/taskgraph/taskgraph" pb "github.com/taskgraph/taskgraph/example/bwmf/proto" "github.com/taskgraph/taskgraph/filesystem" "github.com/taskgraph/taskgraph/op" "golang.org/x/net/context" "google...
example/bwmf/bwmf_task.go
0.534612
0.440168
bwmf_task.go
starcoder
package pps type particleGrid struct { cellSize int cells map[gridCell][]*Particle } type gridCell struct { x, y int } func (c gridCell) add(x, y int) gridCell { return gridCell{x: c.x + x, y: c.y + y} } func makeParticleGrid(cellSize int) particleGrid { return particleGrid{ cellSize: cellSize, cells: ...
grid.go
0.805785
0.66264
grid.go
starcoder
package timef import "strings" type format map[string]string // Format list of predefined formats var Format = format{ // Format for date year at begin plus timestamp FormatDateLongYearAtBegin11: strings.Join([]string{LongYear, ZeroMonth, ZeroDay}, "-") + " " + strings.Join([]string{Hour, ZeroMinute}, ":"), Forma...
format.go
0.532911
0.545104
format.go
starcoder
package optimization import ( "math" "math/rand" "sort" "time" ) func init() { rand.Seed(time.Now().Unix()) } // MCTS performs a Monte Carlo Tree Search with Upper Confidence Bound. func MCTS(first *State, simulations int, c float64, limit time.Duration) []*Node { start := time.Now() root := &MCTSNode{ stat...
optimization/mcts.go
0.730097
0.527682
mcts.go
starcoder
package main import "strings" // Path represents a fs path type Path []string func splitIntoPathInner(p Path, path string, state int) Path { s := 0 i := 0 c := 0 for c >= 0 { if i < len(path) { c = int(path[i]) } else { c = -1 } switch state { case 0: if c == '/' { i++ } else { stat...
path.go
0.59514
0.458046
path.go
starcoder
package stmt import "github.com/lindb/lindb/pkg/function" // Expr represents a interface for all expression types type Expr interface { // expr ensures spec expression type need implement the interface expr() } // TagFilter represents tag filter for searching time series type TagFilter interface { // TagKey retur...
sql/stmt/expr.go
0.599133
0.41834
expr.go
starcoder
package models import ( i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91 "github.com/microsoft/kiota-abstractions-go/serialization" ) // UnifiedRoleScheduleInstanceBase type UnifiedRoleScheduleInstanceBase struct { Entity // Read-only property with details of the app specific scope when ...
models/unified_role_schedule_instance_base.go
0.692746
0.413892
unified_role_schedule_instance_base.go
starcoder
package model import ( "fmt" "gopkg.in/yaml.v2" "io/ioutil" ) type ( // yaml tag for the proxy details yamlProxy struct { Http string `yaml:"http_proxy"` Https string `yaml:"https_proxy"` NoProxy string `yaml:"no_proxy"` } // yaml tag for stuff to be copied on volumes yamlCopy struct { //Once in...
model/yaml.go
0.590189
0.453867
yaml.go
starcoder
package data // FeedPtr represents the dynamic metadata value in which a feed is providing the value. type FeedPtr struct { FeedID string `json:"feed,omitempty"` } // Meta contains information on an entities metadata table. Metadata key/value // pairs are used by a records' filter pipeline during a dns query. // All...
vendor/gopkg.in/ns1/ns1-go.v2/rest/model/data/meta.go
0.683842
0.416085
meta.go
starcoder
package caesar import ( "errors" "strings" "github.com/stripedpajamas/caesar/runes" ) // Bifid represents the Bifid cipher // and conforms to the Cipher interface // https://en.wikipedia.org/wiki/Bifid_cipher type Bifid struct{} // Encrypt operates on a plaintext string and a key string // The function construct...
bifid.go
0.692538
0.41739
bifid.go
starcoder
package kyberk2so // byteopsLoad32 returns a 32-bit unsigned integer loaded from byte x. func byteopsLoad32(x []byte) uint32 { var r uint32 r = uint32(x[0]) r = r | (uint32(x[1]) << 8) r = r | (uint32(x[2]) << 16) r = r | (uint32(x[3]) << 24) return r } // byteopsLoad24 returns a 32-bit unsigned integer loaded ...
byteops.go
0.803405
0.404802
byteops.go
starcoder
package fp func (l BoolArray) DropWhile(p func(bool) bool) BoolArray { size := len(l) var n int for n = 0; n < size && p(l[n]); n ++ {} acc := make([]bool, size - n) copy(acc, l[n: size]) return acc } func (l StringArray) DropWhile(p func(string) bool) StringArray { size := len(l) var n int for n =...
fp/bootstrap_array_dropwhile.go
0.684475
0.556761
bootstrap_array_dropwhile.go
starcoder
package zipcodes import ( "bufio" "fmt" "log" "math" "os" "strconv" "strings" ) const ( earthRadiusKm = 6371 earthRadiusMi = 3958 ) // ZipCodeLocation struct represents each line of the dataset type ZipCodeLocation struct { ZipCode string PlaceName string AdminName string Lat float64 Lon ...
zipcodes.go
0.799716
0.51251
zipcodes.go
starcoder
package ray import ( "math" ) // Sphere is a canonical sphere, centered of origin, of radius 1 type Sphere struct { Transform Surface name string } // NewSphere instantiate a new sphere func NewSphere() *Sphere { return &Sphere{ Transform: IDTransform, Surface: DefaultSurface, } } // SetName ... func (s...
sphere.go
0.855926
0.494324
sphere.go
starcoder
package hashmap import ( "container/list" "fmt" ) const dataLen uint32 = 37 // HashMap struct provides associative array semantics for string key/value pairs // Implementation provides O(1) set, get & remove operations in average case // Based on an underlying array of linked lists type HashMap struct { len uint...
DataStruct/HashMap/go/hashmap.go
0.685423
0.409929
hashmap.go
starcoder
package validation import ( "github.com/overline-mining/gool/src/common" "github.com/overline-mining/gool/src/olhash" p2p_pb "github.com/overline-mining/gool/src/protos" "go.uber.org/zap" "math/big" "sort" ) func ValidateBlockRange(startingBlock *p2p_pb.BcBlock, blocks []*p2p_pb.BcBlock) (bool, int) { n := len...
src/validation/chain_validation.go
0.532911
0.508483
chain_validation.go
starcoder
package pgsql import ( "database/sql" "database/sql/driver" "strconv" ) // LsegArrayFromFloat64Array2Array2Slice returns a driver.Valuer that produces a PostgreSQL lseg[] from the given Go [][2][2]float64. func LsegArrayFromFloat64Array2Array2Slice(val [][2][2]float64) driver.Valuer { return lsegArrayFromFloat64A...
pgsql/lsegarr.go
0.569374
0.437343
lsegarr.go
starcoder
package graph // A Subgraph is a Graph that consists of a subset of the nodes and // vertices from another, underlying Graph. type Subgraph interface { Graph // Underlying returns the underlying graph that this is a // subgraph of. Underlying() Graph // NodeMap transduces a node property map on the underlying ...
graph/subgraph.go
0.794425
0.531027
subgraph.go
starcoder
package statsdtest import ( "bytes" "fmt" "strings" ) // Stat contains the raw and extracted stat information from a stat that was // sent by the RecordingSender. Raw will always have the content that was // consumed for this specific stat and Parsed will be set if no errors were hit // pulling information out of ...
vendor/github.com/cactus/go-statsd-client/statsd/statsdtest/stat.go
0.681303
0.415195
stat.go
starcoder
package generation import ( "math" "github.com/flowmatters/openwater-core/conv/rough" "github.com/flowmatters/openwater-core/conv/units" "github.com/flowmatters/openwater-core/data" ) /*OW-SPEC BankErosion: inputs: downstreamFlowVolume: totalVolume: states: parameters: riparianVegPercent: maxRiparian...
models/generation/bank_erosion.go
0.708515
0.475849
bank_erosion.go
starcoder
package types import ( "reflect" "strconv" ) var ( stringSliceType = reflect.TypeOf([]string(nil)) intSliceType = reflect.TypeOf([]int(nil)) int64SliceType = reflect.TypeOf([]int64(nil)) float64SliceType = reflect.TypeOf([]float64(nil)) ) var sliceAppenders = []AppenderFunc{ reflect.Bool: nil,...
vendor/gopkg.in/pg.v4/types/append_array.go
0.535341
0.401072
append_array.go
starcoder
package instructionsexplanation type InstructionExplanation struct { Instruction string Param string } var instructionExplanations = map[string]InstructionExplanation{ "nop": InstructionExplanation{ Instruction: "No operation", Param: "No param needed", }, "copy": InstructionExplanation{ Instru...
config/instructionsexplanation/index.go
0.710427
0.675928
index.go
starcoder
package assert import ( "bytes" "reflect" "testing" ) func NoError(t testing.TB, err error) { if err != nil { t.Helper() t.Fatalf("%+v", err) } } func Error(t testing.TB, err error) { if err == nil { t.Helper() t.Fatal("expected an error") } } func Equal(t testing.TB, a, b interface{}) { if ta, tb :...
assert.go
0.58166
0.469946
assert.go
starcoder
package kinematics import ( "math" "github.com/tab58/v1/spatial/pkg/geometry" ) // Transform3D is a 3x3 matrix that encodes a transformation. type Transform3D struct { *geometry.Matrix3D } func rotation3DFromAxisAngle(axis geometry.Vector3DReader, angle float64) [9]float64 { elements := [9]float64{} u := axis....
pkg/kinematics/transform3d.go
0.852706
0.67726
transform3d.go
starcoder
// Package pipeline provides abstraction of pipeline and stages. It is a basic tool to convert TAR/TAR GZ file into TFRecord file. package pipeline import ( "io" "github.com/NVIDIA/go-tfdata/tfdata/archive" "github.com/NVIDIA/go-tfdata/tfdata/core" "github.com/NVIDIA/go-tfdata/tfdata/filter" "github.com/NVIDIA/...
tfdata/pipeline/pipeline.go
0.892281
0.540924
pipeline.go
starcoder
package main import ( "fmt" "strconv" "strings" "github.com/kindermoumoute/adventofcode/pkg/execute" "github.com/kindermoumoute/adventofcode/pkg" ) // returns part1 and part2 func run(input string) (interface{}, interface{}) { var r = &Registers{r: make([]int, 4)} var Ops = []func(int, int, int){r.eqri, r.ba...
2018/day16/main.go
0.533154
0.440229
main.go
starcoder
package detection import ( "github.com/nodejayes/geolib/pkg/geometry" ) // BooleanPointInPolygon Takes a {@link Point} and a {@link Polygon} and determines if the point // resides inside the polygon. The polygon can be convex or concave. The function accounts for holes. func PointInPolygon(point *geometry.Point, pol...
pkg/detection/inpolygon.go
0.81899
0.5835
inpolygon.go
starcoder
package fixedwidth import ( "errors" "fmt" "io" "github.com/mattmc3/goetl" "github.com/mattmc3/gofurther/slicex" "github.com/mattmc3/gofurther/stringsx" ) // Formatter defines a function signature for formatting fixed width // values when writing them type Formatter func(fwdef *FieldDef, value string) (string,...
fixedwidth/fixedwidth.go
0.579638
0.427217
fixedwidth.go
starcoder
package filters import ( "github.com/golang/glog" "image" "image/color" "math" "github.com/go-gl/mathgl/mgl64" ) type StraightLine struct { // From, To 直线开始到结束的位置记录: From, To image.Point // Color 指定直线的颜色. Color color.Color // Thickness 指定直线的宽度 Thickness float64 // Rectangle enclosing straight line. r...
filters/straight_line.go
0.549882
0.429489
straight_line.go
starcoder
package onshape import ( "encoding/json" ) // BTPTopLevelTypeDeclaration287 struct for BTPTopLevelTypeDeclaration287 type BTPTopLevelTypeDeclaration287 struct { BTPTopLevelNode286 BtType *string `json:"btType,omitempty"` Name *BTPIdentifier8 `json:"name,omitempty"` SpaceAfterVersion *BTPSpace10 `json:"spaceAfter...
onshape/model_btp_top_level_type_declaration_287.go
0.695855
0.49762
model_btp_top_level_type_declaration_287.go
starcoder
package sqlutil import ( "database/sql" "fmt" "reflect" "time" "github.com/grafana/grafana-plugin-sdk-go/data" ) // FrameConverter defines how to convert the scanned value into a value that can be put into a dataframe (OutputFieldType) type FrameConverter struct { // FieldType is the type that is created for t...
data/sqlutil/converter.go
0.771112
0.624036
converter.go
starcoder
package flag import ( "time" "flag" ) // FlagSet represents an optionally scoped *flag.FlagSet. type FlagSet interface { // Scope creates a new scoped FlagSet. The name of any flag // added to the new FlagSet is prefixed with the given // prefix. In the flag's uage, the expression "{{NAME}}", is // replaced w...
vendor/github.com/turbinelabs/nonstdlib/flag/gen_flagset.go
0.6137
0.463262
gen_flagset.go
starcoder
package chaincfg import ( "github.com/p9c/pod/pkg/log" "strings" chainhash "github.com/p9c/pod/pkg/chain/hash" ) // String returns the hostname of the DNS seed in human-readable form. func (d DNSSeed) String() string { return d.Host } // Register registers the network parameters for a Bitcoin network. This may...
pkg/chain/config/params.go
0.720368
0.415077
params.go
starcoder
package shamir import ( "crypto/rand" "crypto/subtle" "fmt" mathrand "math/rand" "time" ) const ( // ShareOverhead is the byte size overhead of each share // when using Split on a secret. This is caused by appending // a one byte tag to the share. ShareOverhead = 1 ) // polynomial represents a polynomial of...
shamir/shamir.go
0.839306
0.547887
shamir.go
starcoder
package base45 import ( "bytes" "encoding/binary" "math" "net/url" ) /* Chapter references: [1] https://datatracker.ietf.org/doc/draft-faltstrom-base45/ 2021-07-01 draft-faltstrom-base45-07 */ /* [1] Chapter 4: A 45-character subset of US-ASCII is used; the 45 characters usable in a QR code in Alp...
base45.go
0.810891
0.541773
base45.go
starcoder
package rfc4757 import ( "crypto/hmac" "crypto/rand" "crypto/rc4" "errors" "fmt" "gopkg.in/L11R/gokrb5.v7/crypto/etype" ) // EncryptData encrypts the data provided using methods specific to the etype provided as defined in RFC 4757. func EncryptData(key, data []byte, e etype.EType) ([]byte, error) { if len(ke...
crypto/rfc4757/encryption.go
0.764979
0.415847
encryption.go
starcoder
package core import ( "encoding/binary" "hash/fnv" "math" "github.com/raviqqe/hamt" ) // NumberType represents a number in the language. // It will perhaps be represented by DEC64 in the future release. type NumberType float64 // Eval evaluates a value into a WHNF. func (n *NumberType) eval() Value { return n ...
src/lib/core/number.go
0.771069
0.5425
number.go
starcoder
package main import ( "github.com/adevinta/vulcan-report" ) var vulns = map[string]report.Vulnerability{ "dmarc-not-found": report.Vulnerability{ CWEID: 358, Summary: "DMARC DNS Record Not Found", Description: "No DMARC policy has been found for this domain.\nA DMARC " + "(Domain-based Message Authentica...
cmd/vulcan-dmarc/dmarc_vulnerabilities.go
0.640299
0.41941
dmarc_vulnerabilities.go
starcoder
package peruntest import ( "testing" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" "github.com/hyperledger-labs/perun-node" ) // AssertAPIError tests if the passed error contains expected category, code // and phrases in the message. func AssertAPIError(t *testing.T, e perun.APIErr...
peruntest/assert.go
0.619126
0.568985
assert.go
starcoder
Package builder provides methods to build admission webhooks. The following are 2 examples for building mutating webhook and validating webhook. webhook1, err := NewWebhookBuilder(). Mutating(). Operations(admissionregistrationv1beta1.Create). ForType(&corev1.Pod{}). WithManager(mgr). Handlers(mutatingHand...
vendor/sigs.k8s.io/controller-runtime/pkg/webhook/admission/builder/doc.go
0.654011
0.483953
doc.go
starcoder
package r1 import ( "fmt" "math" ) // Interval represents a closed interval on ℝ. // Zero-length intervals (where Lo == Hi) represent single points. // If Lo > Hi then the interval is empty. type Interval struct { Lo, Hi float64 } // EmptyInterval returns an empty interval. func EmptyInterval() Interval { return ...
Godeps/_workspace/src/github.com/golang/geo/r1/interval.go
0.891575
0.664734
interval.go
starcoder
package core import ( "fmt" ) // TypeParser parses a specific DataType, returning an error or nil if the parsing was successful. type TypeParser interface { Parse(d DataType) error } // SetStringFunc is a function that sets a string value. type SetStringFunc func(string) // SetIntFunc is a function that sets an i...
core/dxf_parseable.go
0.720368
0.532851
dxf_parseable.go
starcoder
package date import ( "fmt" "regexp" "strconv" "strings" "time" ) const day = time.Hour * 24 var daysOfWeek = map[string]time.Weekday{ "monday": time.Monday, "tuesday": time.Tuesday, "wednesday": time.Wednesday, "thursday": time.Thursday, "friday": time.Friday, "saturday": time.Saturday, "sunda...
language/date/rules.go
0.690455
0.420778
rules.go
starcoder
package vector import ( "fmt" "math" "github.com/jeinfeldt/raytracer/raytracing/util" ) type ( // Vector3 represent a vector with three coordinates Vector3 struct { x, y, z float64 } ) // New is a factory method to create a new vector with three positions func New(x, y, z float64) Vector3 { return Vector3{...
raytracing/vector/vector.go
0.908428
0.802401
vector.go
starcoder
package internal import ( "github.com/boombuler/barcode/code128" "github.com/boombuler/barcode/qr" "github.com/eyesore/maroto/pkg/props" "github.com/jung-kurt/gofpdf" "github.com/jung-kurt/gofpdf/contrib/barcode" ) // Code is the abstraction which deals of how to add QrCodes or Barcode in a PDF type Code interfa...
internal/code.go
0.758958
0.448668
code.go
starcoder
package simple import ( "k8s.io/kubernetes/third_party/forked/gonum/graph" ) // DirectedAcyclicGraph implements graph.Directed using UndirectedGraph, // which only stores one edge for any node pair. type DirectedAcyclicGraph struct { *UndirectedGraph } func NewDirectedAcyclicGraph(self, absent float64) *DirectedAc...
third_party/forked/gonum/graph/simple/directed_acyclic.go
0.63023
0.484685
directed_acyclic.go
starcoder
package benchmark import ( "reflect" "testing" ) func isBoolToUint64FuncCalibrated(supplier func() bool) bool { return isCalibrated(reflect.Bool, reflect.Uint64, reflect.ValueOf(supplier).Pointer()) } func isIntToUint64FuncCalibrated(supplier func() int) bool { return isCalibrated(reflect.Int, reflect.Uint64, re...
common/benchmark/11_to_uint64_func.go
0.713931
0.726644
11_to_uint64_func.go
starcoder
package test_persistence import ( "testing" cdata "github.com/pip-services3-go/pip-services3-commons-go/data" data1 "github.com/pip-templates-services/pip-service-data-go/data/version1" persist "github.com/pip-templates-services/pip-service-data-go/persistence" "github.com/stretchr/testify/assert" ) type Entiti...
test/persistence/EntitiesPersistenceFixture.go
0.639511
0.547706
EntitiesPersistenceFixture.go
starcoder
package tetra3d import "math" type Quaternion struct { X, Y, Z, W float64 } func NewQuaternion(x, y, z, w float64) *Quaternion { return &Quaternion{x, y, z, w} } func (quat *Quaternion) Clone() *Quaternion { return NewQuaternion(quat.X, quat.Y, quat.Z, quat.W) } // func (quat *Quaternion) Slerp(other *Quaternio...
quaternion.go
0.552298
0.422564
quaternion.go
starcoder
// Package action provides the interface and utilities for funnctions which // takes a context and returns an error on failure. package action import ( "context" "time" "chromiumos/tast/errors" "chromiumos/tast/testing" ) // Action is a function that takes a context and returns an error. type Action = func(cont...
src/chromiumos/tast/common/action/action.go
0.727589
0.439567
action.go
starcoder
// Package day11 solves AoC 2020 day 11. package day11 import ( "github.com/fis/aoc/glue" "github.com/fis/aoc/util" ) func init() { glue.RegisterSolver(2020, 11, glue.LevelSolver{Solver: solve, Empty: '.'}) } func solve(level *util.Level) ([]string, error) { fp1 := fixedPoint(level, nearMap, 4) fp2 := fixedPoi...
2020/day11/day11.go
0.548915
0.401805
day11.go
starcoder
package model import ( "encoding/json" "errors" "sort" "strings" "time" ) func ElementInArray(element interface{}, array []interface{}) bool { for _, comparison := range array { if comparison == element { return true } } return false } /* Removes an element form an array. If the array was ordered befo...
pkg/api/model/util.go
0.550366
0.457258
util.go
starcoder
package predicate import ( "fmt" "strings" "github.com/influxdata/influxdb" "github.com/influxdata/influxql" ) // a fixed buffer ring type buffer [3]struct { tok influxql.Token // last read token pos influxql.Pos // last read pos lit string // last read literal } // parser of the predicate will con...
predicate/parser.go
0.635222
0.403626
parser.go
starcoder
package dl import "fmt" // TimeOffset is the elapsed time. TimeOffset is measured in milliseconds type TimeOffset int64 // Format satisfies interface fmt.Formatter func (time TimeOffset) Format(f fmt.State, c rune) { formatUnit(f, c, "ms", time, int64(time)) } // Speed is the vehicle speed. Speed is measured in me...
unit_types.go
0.856647
0.73065
unit_types.go
starcoder
package rgass import ( "errors" ) // Model represents all nodes in the RGASS type Model struct { head *Node // A sentinel head node tail *Node // A sentinel tail node table map[ID]*Node // A map of node IDs to nodes } // NewModel creates a new Model func NewModel() Model { m := Model{table: make...
rgass/model.go
0.704973
0.476275
model.go
starcoder
package node import ( "sort" "github.com/insolar/insolar/insolar" ) type Accessor struct { snapshot *Snapshot refIndex map[insolar.Reference]insolar.NetworkNode sidIndex map[insolar.ShortNodeID]insolar.NetworkNode addrIndex map[string]insolar.NetworkNode roleIndex map[insolar.StaticRole]*refSet // should...
network/node/accessor.go
0.550124
0.421314
accessor.go
starcoder
package env import ( "os" "strconv" ) // Get parses an string from the environment variable key parameter. If the environment // variable is empty, the defaultValue parameter is returned. func Get(key string, defaultValue string) string { r := os.Getenv(key) if r == "" { return defaultValue } return r } // ...
pkg/env/env.go
0.721743
0.444022
env.go
starcoder
package starlarktruth import ( "fmt" "sort" "strings" "go.starlark.net/starlark" "go.starlark.net/syntax" ) type ( attr func(t *T, args ...starlark.Value) (starlark.Value, error) attrs map[string]attr ) var ( methods0args = attrs{ "contains_no_duplicates": containsNoDuplicates, "in_order": ...
pkg/starlarktruth/attrs.go
0.518059
0.409398
attrs.go
starcoder
package applier import ( "fmt" "github.com/skeema/skeema/fs" "github.com/skeema/skeema/workspace" "github.com/skeema/tengo" ) // VerifyDiff verifies the result of all AlterTable values found in // diff.TableDiffs, confirming that applying the corresponding ALTER would // bring a table from the version currently ...
applier/verifier.go
0.557604
0.402069
verifier.go
starcoder
package fields import "time" // Package level versions // SetInt64 instructs update to set given field to the provided value // Result is equivalent to: // field = value func SetInt64(field string, value int64) *Update { return Set(field, value) } // SetInt instructs update to set given field to the provided va...
fields/set.go
0.839175
0.45538
set.go
starcoder
package imagequant import ( "image/color" "unsafe" ) /* #include "libimagequant.h" */ import "C" // Callers must not use this object once Release has been called on the parent // Image struct. type Result struct { p *C.struct_liq_result im *Image } // Enables/disables dithering in liq_write_remapped_image(). D...
result.go
0.760384
0.474022
result.go
starcoder
package metrics // Histograms calculate distribution statistics from a series of int64 values. type Histogram interface { Clear() Count() int64 Max() int64 Mean() float64 Min() int64 Percentile(float64) float64 Percentiles([]float64) []float64 Sample() Sample Snapshot() Histogram StdDev() float6...
vendor/github.com/elastic/beats/vendor/github.com/rcrowley/go-metrics/histogram.go
0.904217
0.711022
histogram.go
starcoder
package iso20022 // Description of the financial instrument. type FinancialInstrumentAttributes46 struct { // Identifies the financial instrument. SecurityIdentification *SecurityIdentification14 `xml:"SctyId"` // Quantity of entitled intermediate securities based on the balance of underlying securities. Quantit...
data/train/go/c446fe7b8567cd67afe1d244acc29a2331b48aa0FinancialInstrumentAttributes46.go
0.848628
0.407864
c446fe7b8567cd67afe1d244acc29a2331b48aa0FinancialInstrumentAttributes46.go
starcoder
package imagecashletter import ( "encoding/json" "fmt" "strings" "time" "unicode/utf8" ) // Errors specific to a ReturnDetailAddendumB Record // ReturnDetailAddendumB Record type ReturnDetailAddendumB struct { // ID is a client defined string used as a reference to this record. ID string `json:"id"` // Reco...
returnDetailAddendumB.go
0.640074
0.469399
returnDetailAddendumB.go
starcoder
package spatialindex import ( "errors" "math" "sort" "sync" ) // Point represents an object in 2D space type Point struct { ID uint64 X, Y int64 } // Grid is a statically set series of slices that Points get put into type Grid struct { mtx *sync.RWMutex buckets [][][]Point allPoints map[uint64]*Po...
grid.go
0.631594
0.529932
grid.go
starcoder
package gkgen import ( "errors" "fmt" "reflect" "strconv" "strings" ) // SetValidator generates code that will verify a fields does Set one of an allowed set of values // The SetValidator will look at the field or the dereferenced value of the field // nil values for a field are not considered invalid type SetVa...
gkgen/set.go
0.60054
0.401688
set.go
starcoder
package html import "github.com/guillermo/golazy/lazyview/nodes" // A Creates a new a element func A(options ...interface{}) nodes.Element { return nodes.NewElement("a", options...) } // Abbr Creates a new abbr element func Abbr(options ...interface{}) nodes.Element { return nodes.NewElement("abbr", options...) } ...
lazyview/html/autotags.go
0.844281
0.436562
autotags.go
starcoder
package slicex import ( "constraints" "errors" "github.com/hsiafan/glow/v2/container/optional" "sort" ) // Copy shallow copy a slice. // copy can also trim slice underlying array to it's len. func Copy[T any](s []T) []T { t := make([]T, len(s)) copy(t, s) return t } // InvalidIndexErr slice index invalid var ...
container/slicex/slice_utils.go
0.840226
0.510313
slice_utils.go
starcoder
package main import ( "fmt" "io" "os" ) type point struct{ x, y int } func find(piece byte, board [8][8]byte) point { for i, vi := range board { for j, vj := range vi { if vj == piece { return point{i, j} } } } return point{} } func inBoard(x, y int) bool { return x >= 0 && x <= 7 && y >= 0 && ...
10196/10196.go
0.525125
0.414603
10196.go
starcoder
package main import ( rl "github.com/chunqian/go-raylib/raylib" "runtime" ) const ( FOVY_PERSPECTIVE = 45.0 WIDTH_ORTHOGRAPHIC = 10.0 ) func init() { runtime.LockOSThread() } func main() { screenWidth := int32(800) screenHeight := int32(450) rl.InitWindow(screenWidth, screenHeight, "raylib [models] exa...
examples/models/orthographic_projection/orthographic_projection.go
0.569853
0.415077
orthographic_projection.go
starcoder
package ai2048 func emptySquares(b *Board) float64 { return float64(16 - b.TileCount) } var boardIndices [4][4]int = [4][4]int{ {2, 1, 1, 2}, {1, 0, 0, 1}, {1, 0, 0, 1}, {2, 1, 1, 2}, } func tilePlacement(b *Board, weights []float64) float64 { sum := 0.0 k := 0 for i := 0; i != 4; i++...
ai2048/metrics.go
0.865096
0.537648
metrics.go
starcoder
package ast import ( "github.com/zoncoen/scenarigo/template/token" ) // All node types implement the Node interface. type Node interface { Pos() int } // All expression nodes implement the Expr interface. type Expr interface { Node exprNode() } type ( // BadExpr node is a placeholder for expressions containing...
template/ast/ast.go
0.574037
0.46035
ast.go
starcoder
package goja import ( "gonum.org/v1/gonum/stat" "math" "math/bits" "sort" ) func (r *Runtime) math_abs(call FunctionCall) Value { return floatToValue(math.Abs(call.Argument(0).ToFloat())) } func (r *Runtime) math_acos(call FunctionCall) Value { return floatToValue(math.Acos(call.Argument(0).ToFloat())) } func...
builtin_math.go
0.747984
0.527317
builtin_math.go
starcoder
package pointerAnalysis import ( "github.com/amit-davidson/Chronos/domain" "github.com/amit-davidson/Chronos/utils" "go/token" "golang.org/x/tools/go/pointer" "golang.org/x/tools/go/ssa" ) // Analysis starts by mapping between positions of the guard accesses (values inside) to the guard accesses themselves. // ...
pointerAnalysis/PointerAnalysis.go
0.532182
0.430626
PointerAnalysis.go
starcoder
package gfx import ( "sync" "unsafe" "github.com/go-gl/gl/v4.5-core/gl" "github.com/go-gl/mathgl/mgl32" ) const ( // MaximumPointLights is the maximum number of lights that the pointlight system is prepared to handle. MaximumPointLights = 1024 ) var ( // PointLights are the current pointlights in the scene. ...
gfx/pointlights.go
0.822902
0.425307
pointlights.go
starcoder
package wm import ( "github.com/cznic/interval" "github.com/cznic/mathutil" ) // Position represents 2D coordinates. type Position struct { X, Y int } func (p Position) add(q Position) Position { return Position{p.X + q.X, p.Y + q.Y} } func (p Position) sub(q Position) Position { return Position{p.X - q.X, p.Y -...
etc.go
0.918183
0.755772
etc.go
starcoder
package packed // Efficient sequential read/write of packed integers. type BulkOperationPacked10 struct { *BulkOperationPacked } func newBulkOperationPacked10() BulkOperation { return &BulkOperationPacked10{newBulkOperationPacked(10)} } func (op *BulkOperationPacked10) decodeLongToInt(blocks []int64, values [...
vendor/github.com/balzaczyy/golucene/core/util/packed/bulkOperation10.go
0.560373
0.738598
bulkOperation10.go
starcoder
package openapi import ( "encoding/json" ) // InlineObject2 struct for InlineObject2 type InlineObject2 struct { // Stromkonto account address of sender Account *string `json:"account,omitempty"` // Stromkonto account address of reciever To *string `json:"to,omitempty"` // Amount to transfer (in Watthours for ...
out/go/model_inline_object_2.go
0.763307
0.416203
model_inline_object_2.go
starcoder
package main import eb "github.com/hajimehoshi/ebiten" type coord struct { x, y float64 } // Une objet simple, qui a une image associée, des coordonnées, une vitesse (signée), // et qui peut entrer en collision avec d'autres objets type object struct { image *eb.Image coord width, height float64 speedX ...
collisions.go
0.596786
0.426322
collisions.go
starcoder
package orderedset // OrderedSet represents a set as defined at https://infra.spec.whatwg.org/#ordered-set type OrderedSet struct { set []string } // NewOrderedSet creates an OrderedSet with the specified contents func NewOrderedSet(contents []string) *OrderedSet { return &OrderedSet{contents} } /* Append adds an ...
orderedset.go
0.790934
0.462898
orderedset.go
starcoder
package shmensor import ( "fmt" ) // This file is used to define some package-default Tensor types. // Interface may become open in the future so clients can define their own. // For example, Tensor spaces over finite fields, or modules over arbitrary rings. // Integers. type defaultInt struct{} func (dt defaultInt...
shmensor/types.go
0.774839
0.425963
types.go
starcoder
package anomalies import ( "context" "math" "time" "github.com/trackit/trackit/config" ) // min returns the minimum between a and b. func min(a, b int) int { if a < b { return a } return b } // sum adds every element of a CostAnomaly slice. func sum(aCosts AnalyzedCosts) float64 { var sum float64 for _,...
anomaliesDetection/bollinger.go
0.775435
0.645776
bollinger.go
starcoder
package aoc2019 import ( "image" "image/color" "image/png" "io/ioutil" "math" "os" "strconv" "strings" "github.com/pkg/errors" ) type day3LineSegment [4]int func (d day3LineSegment) Draw(img *image.RGBA, col color.Color) { var ptMod func(x, y int) (int, int, bool) switch { case d.IsVertical() && d[1] <...
day03.go
0.576184
0.474144
day03.go
starcoder
package ent import ( "clock-in/app/record/service/internal/data/ent/record" "fmt" "strings" "time" "entgo.io/ent/dialect/sql" ) // Record is the model entity for the Record schema. type Record struct { config `json:"-"` // ID of the ent. ID int `json:"id,omitempty"` // User holds the value of the "user" fi...
app/record/service/internal/data/ent/record.go
0.660501
0.402686
record.go
starcoder
package plaid import ( "encoding/json" ) // UserCustomPassword Custom test accounts are configured with a JSON configuration object formulated according to the schema below. All fields are optional. Sending an empty object as a configuration will result in an account configured with random balances and transaction ...
plaid/model_user_custom_password.go
0.841858
0.598635
model_user_custom_password.go
starcoder
package main import ( "math" "math/rand" ) // GeneticAlgorithm represents type GeneticAlgorithm struct { PopulationSize int MutationRate float64 CrossoverRate float64 ElitismCount int TournamentSize int } func createGeneticAlgorithm(populationSize int, mutationRate float64, crossoverRate float64, elitism...
schedule-ga/geneticalgorithm.go
0.822082
0.521654
geneticalgorithm.go
starcoder
package process import ( "encoding/binary" "math" ) type TagEncoder interface { // Buffer returns the underlying byte buffer that the tags were encoded in to Buffer() []byte // Encode encodes the given tags in to the buffer and returns the index in the buffer where the data begins Encode(tags []string) int } ...
process/tags.go
0.731922
0.449513
tags.go
starcoder
package metrics import ( "sync" "time" "go.opentelemetry.io/otel/attribute" ) const ( cleanInterval = 5 * time.Minute ) // CalculateFunc defines how to process metric values by the calculator. It // passes previously received MetricValue, and the current raw value and timestamp // as parameters. Returns true i...
internal/aws/metrics/metric_calculator.go
0.762247
0.410225
metric_calculator.go
starcoder
package main /** 给定两个字符串text1 和text2,返回这两个字符串的最长 公共子序列 的长度。如果不存在 公共子序列 ,返回 0 。 一个字符串的子序列是指这样一个新的字符串:它是由原字符串在不改变字符的相对顺序的情况下删除某些字符(也可以不删除任何字符)后组成的新字符串。 例如,"ace" 是 "abcde" 的子序列,但 "aec" 不是 "abcde" 的子序列。 两个字符串的 公共子序列 是这两个字符串所共同拥有的子序列。 示例 1: 输入:text1 = "abcde", text2 = "ace" 输出:3 解释:最长公共子序列是 "ace" ,它的长度为 3 。 示例 2: 输入:text...
leetcode/longestCommonSubsequence/longestCommonSubsequence.go
0.524882
0.41561
longestCommonSubsequence.go
starcoder
package iso20022 // Extract of trade data for an investment fund switch order. type FundOrderData2 struct { // Amount of money used to derive the quantity of investment fund units to be redeemed. TotalRedemptionAmount *ActiveOrHistoricCurrencyAndAmount `xml:"TtlRedAmt,omitempty"` // Amount of money used to derive...
FundOrderData2.go
0.837454
0.512083
FundOrderData2.go
starcoder
package activitypub import ( "bytes" "encoding/gob" "github.com/valyala/fastjson" ) // LinkTypes represent the valid values for a Link object var LinkTypes = ActivityVocabularyTypes{ LinkType, MentionType, } type Links interface { Link | IRI } // A Link is an indirect, qualified reference to a resource identi...
link.go
0.792504
0.424531
link.go
starcoder
package bw761 import "math/big" // e6 is a degree-three finite field extension of fp2 type e6 struct { B0, B1, B2 e2 } // Equal returns true if z equals x, fasle otherwise // TODO can this be deleted? Should be able to use == operator instead func (z *e6) Equal(x *e6) bool { return z.B0.Equal(&x.B0) && z.B1.Equa...
bw761/e6.go
0.513668
0.574335
e6.go
starcoder
package xutil import ( "sync" ) // OrderedMap wraps around a Go map keeping the order with which // elements have been added. Keys must be strings, but values // can be anything (interface{}). // Unlike map, index assigment is not possible. Use the `Set` // method to set a key with a particular value. // Use the Ke...
xutil/mapping.go
0.805058
0.477615
mapping.go
starcoder
package interfacediagnostics import ( "strconv" "time" "github.com/arsonistgopher/jinfluxexporter/collector" channels "github.com/arsonistgopher/jinfluxexporter/rootchannels" "github.com/arsonistgopher/jinfluxexporter/rpc" ) type interfaceDiagnosticsCollector struct { } // NewCollector creates a new collector ...
collectors/interfacediagnostics/interface_diagnostics_collector.go
0.706798
0.402011
interface_diagnostics_collector.go
starcoder
package digitalocean import ( "context" "fmt" "strconv" "strings" "github.com/digitalocean/godo" "github.com/hashicorp/terraform-plugin-sdk/helper/schema" ) func dropletSchema() map[string]*schema.Schema { return map[string]*schema.Schema{ "id": { Type: schema.TypeInt, Description: "id of the D...
vendor/github.com/terraform-providers/terraform-provider-digitalocean/digitalocean/droplets.go
0.507568
0.462655
droplets.go
starcoder
package mat import ( "math" ) func NewRay(origin Set, direction Set) Ray { return Ray{Origin: origin, Direction: direction} } type Ray struct { Origin Set Direction Set } // Position multiplies direction of ray with the passed distance and adds the result onto the origin. // Used for finding the position alo...
internal/pkg/mat/rays.go
0.736021
0.680872
rays.go
starcoder
package attributes // Attributes is an immutable struct for storing and retrieving generic // key/value pairs. Keys must be hashable, and users should define their own // types for keys. Values should not be modified after they are added to an // Attributes or if they were received from one. If values implement 'Eq...
vendor/google.golang.org/grpc/attributes/attributes.go
0.807537
0.458773
attributes.go
starcoder
package rib import ( "net" "github.com/transitorykris/kbgp/bgp" "github.com/transitorykris/kbgp/radix" ) // 3.1. Routes: Advertisement and Storage // For the purpose of this protocol, a route is defined as a unit of // information that pairs a set of destinations with the attributes of a // path to tho...
old/rib/rib.go
0.675658
0.568895
rib.go
starcoder
package ts import ( "bytes" "github.com/m3db/m3x/checked" ) // Segment represents a binary blob consisting of two byte slices and // declares whether they should be finalized when the segment is finalized. type Segment struct { // Head is the head of the segment. Head checked.Bytes // Tail is the tail of the ...
ts/segment.go
0.73173
0.493531
segment.go
starcoder
package geom import ( "fmt" "math" math2 "github.com/roeldev/go-sdl2-experiments/pkg/sdlkit/math" ) // var ( // vectorUp = Vector{0, -1} // vectorDown = Vector{0, 1} // vectorLeft = Vector{-1, 0} // vectorRight = Vector{1, 0} // ) type Vector struct { X, Y float64 } // VectorFromInt creates a new Vec...
pkg/sdlkit/geom/vector.go
0.832849
0.648181
vector.go
starcoder