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 triedb // A node represents a node in the persistent trie used as an index. type node struct { key byte depth int16 count int32 value Value next *node children *node } // createNode creates a new node. Every node must be created using this function // (or other based on this) in order ...
node.go
0.691497
0.472683
node.go
starcoder
package mathx import "math" // Sum returns the sum of values of the provided list. func Sum(ff []float64) float64 { var sum float64 for _, v := range ff { var isInf = math.IsInf(v, 1) || math.IsInf(v, -1) if isInf || math.IsNaN(v) { break } sum += v } return sum } // SumInt returns the sum of values o...
seq.go
0.756358
0.529568
seq.go
starcoder
package resize import ( "image" "math" "image/color" ) func (r *Resizer) NearestNeighbor(width uint, height uint) (image.Image) { pixelsX := float32(r.img.Bounds().Max.X) / float32(width) pixelsY := float32(r.img.Bounds().Max.Y) / float32(height) newImage := image.NewRGBA(image.Rect(0, 0, int(width), int(heigh...
algorithmic.go
0.683736
0.492798
algorithmic.go
starcoder
package traverser import ( "fmt" "reflect" ) // New traversal code is derivative of https://gist.github.com/hvoecking/10772475 // MIT License; Copyright (c) 2014 <NAME> - See LICENSE for full license const ( opNoop = iota opSet opUnset opSkip opSplice ) // Traverser is the main type and contains the Map & No...
traverser.go
0.767254
0.41739
traverser.go
starcoder
package fontman var consolasRegular24 font = font{ Height: 37, Description: fontDescription{ Family: "Consolas", Style: "Regular", Size: 24, }, Metricts: fontMetrics{ Ascender: 24, Descender: -9, Height: 37, }, Texture: fontTexture{ Name: "t_consolas_regular_24", Width: 256, Height: 2...
fontman/consolas_regular_24.go
0.596433
0.710748
consolas_regular_24.go
starcoder
package daemon // Daemon interface is a list of the monerod daemon RPC calls, their inputs and outputs, and examples of each. // Many RPC calls use the daemon's JSON RPC interface while others use their own interfaces, as demonstrated below. type Daemon interface { // GetBlockCount Look up how many blocks are in the ...
daemon/daemon.go
0.646906
0.421611
daemon.go
starcoder
package goop2 import "fmt" const ( tinyNum float64 = 0.01 ) // Solution stores the solution of an optimization problem and associated // metatdata type Solution struct { Values map[uint64]float64 // The objective for the solution Objective float64 // Whether or not the solution is within the optimality thresh...
solution.go
0.661267
0.481759
solution.go
starcoder
package settings import ( "encoding/json" "fmt" "testing" "github.com/ingrammicro/cio/api/types" "github.com/ingrammicro/cio/utils" "github.com/stretchr/testify/assert" ) // ListDefinitionsMocked test mocked function func ListDefinitionsMocked(t *testing.T, policyDefinitionsIn []*types.PolicyDefinition) []*ty...
api/settings/policy_definitions_api_mocked.go
0.723114
0.470128
policy_definitions_api_mocked.go
starcoder
package eval import ( "fmt" ) // Context contains the state used by the engine to execute the DSL. var Context *DSLContext type ( // DSLContext is the data structure that contains the DSL execution state. DSLContext struct { // Stack represents the current execution stack. Stack Stack // Errors contains the...
_vendor-20190311020953/goa.design/goa/eval/context.go
0.65202
0.468183
context.go
starcoder
package gotorch // #cgo CFLAGS: -I ${SRCDIR}/cgotorch // #cgo LDFLAGS: -L ${SRCDIR}/cgotorch -Wl,-rpath ${SRCDIR}/cgotorch -lcgotorch // #cgo LDFLAGS: -L ${SRCDIR}/cgotorch/libtorch/lib -Wl,-rpath ${SRCDIR}/cgotorch/libtorch/lib -lc10 -ltorch -ltorch_cpu // #include "cgotorch.h" import "C" import ( "runtime" "sync"...
tensor.go
0.697403
0.427935
tensor.go
starcoder
package utilsys import "math/big" // BayesFactor describes something which can alter our prediction // about something by a given factor. It is stateful and only // used for a single actor in a single world. type BayesFactor interface { // Attached is called once to tell the factor the world and actor // i...
pkg/utilsys/bayes_scorer.go
0.756987
0.443841
bayes_scorer.go
starcoder
package metrics import ( "sync" "time" ) // Meters count events to produce exponentially-weighted moving average rates // at one-, five-, and fifteen-minutes and a mean rate. type Meter interface { Clear() Count() int64 Mark(int64) Rate1() float64 Rate5() float64 Rate15() float64 RateMean() float64 Snapshot...
vendor/github.com/launchdarkly/go-metrics/meter.go
0.857619
0.50116
meter.go
starcoder
package nb import ( "github.com/go-voice/voice" ) // g711 are codecs in the ITU-T g711 specification type g711 struct{} func (g711) DecodeBlockSize() int { return 0 } func (g711) DecodedLen(n int) int { return n } func (g711) EncodeBlockSize() int { return 0 } func (g711) EncodedLen(n int) int { return n } func (g7...
nb/g711.go
0.596668
0.498413
g711.go
starcoder
package ode // #define dDOUBLE // #include <ode/ode.h> import "C" // Mass represents object mass properties. type Mass struct { Center Vector3 Inertia Matrix3 Mass float64 } func (m *Mass) toC(c *C.dMass) { c.mass = C.dReal(m.Mass) Vector(m.Center).toC((*C.dReal)(&c.c[0])) Matrix(m.Inertia).toC((*C.dReal)(...
mass.go
0.717606
0.557604
mass.go
starcoder
package accounting import ( "context" "time" "github.com/btcsuite/btcutil" "github.com/lightninglabs/faraday/fiat" "github.com/lightninglabs/faraday/utils" ) // usdPrice is a function which gets the USD price of bitcoin at a given time. type usdPrice func(timestamp time.Time) (*fiat.USDPrice, error) // satsTo...
accounting/conversions.go
0.766381
0.423637
conversions.go
starcoder
package data import ( "fmt" "hash/maphash" "math/rand" "github.com/kode4food/ale/types" "github.com/kode4food/ale/types/basic" ) type ( // Bool represents the values True or False Bool bool // Value is the generic interface for all values Value interface { fmt.Stringer Equal(Value) bool } // Values ...
data/value.go
0.768646
0.450722
value.go
starcoder
package stats import ( "bytes" "context" "encoding/json" "github.com/hscells/cqr" gpipeline "github.com/hscells/groove/pipeline" "github.com/hscells/transmute/backend" "github.com/hscells/transmute/lexer" "github.com/hscells/transmute/parser" tpipeline "github.com/hscells/transmute/pipeline" "github.com/hsce...
stats/elasticsearch.go
0.682785
0.40869
elasticsearch.go
starcoder
package main import "log" /** 题目:https://leetcode-cn.com/problems/median-of-two-sorted-arrays/solution/xiang-xi-tong-su-de-si-lu-fen-xi-duo-jie-fa-by-w-2/ 寻找两个正序数组的中位数 给定两个大小分别为 m 和 n 的正序(从小到大)数组nums1 和nums2。请你找出并返回这两个正序数组的 中位数 。 算法的时间复杂度应该为 O(log (m+n)) 。 示例 1: 输入:nums1 = [1,3], nums2 = [2] 输出:2.00000 解释:合并数组 = ...
algorithm/BinarySearch/leetcodeQuestion/findMedianSortedArrays/findMedianSortedArrays.go
0.584271
0.455259
findMedianSortedArrays.go
starcoder
package rui import ( "strconv" "strings" ) // Path is a path interface type Path interface { // Reset erases the Path Reset() // MoveTo begins a new sub-path at the point specified by the given (x, y) coordinates MoveTo(x, y float64) // LineTo adds a straight line to the current sub-path by connecting // th...
path.go
0.748076
0.7488
path.go
starcoder
package binheap // Heap provides basic methods: Push, Peak, Pop, Replace top element and PushPop. type Heap[T any] struct { comparator func(x, y T) bool data []T } // EmptyHeap creates empty heap with provided comparator. func EmptyHeap[T any](comparator func(x, y T) bool) Heap[T] { return Heap[T]{ compara...
binheap/generic.go
0.798344
0.532425
generic.go
starcoder
package jose // IANA registered JOSE headers (https://tools.ietf.org/html/rfc7515#section-4.1) const ( // HeaderAlgorithm identifies: // For JWS: the cryptographic algorithm used to secure the JWS. // For JWE: the cryptographic algorithm used to encrypt or determine the value of the CEK. HeaderAlgorithm = "alg" //...
pkg/doc/jose/common.go
0.722723
0.457258
common.go
starcoder
package transform import ( "reflect" ) // Rules is a slice where the elements are unary functions like func(*big.Float)json.Number. type Rules []interface{} func (rules Rules) Apply(in interface{}) interface{} { result := rules.apply(reflect.TypeOf(in), reflect.ValueOf(in)) if result.IsValid() { return result....
vendor/github.com/palantir/pkg/transform/transform.go
0.666388
0.477128
transform.go
starcoder
package block import ( "github.com/df-mc/dragonfly/dragonfly/event" "github.com/df-mc/dragonfly/dragonfly/world" "github.com/df-mc/dragonfly/dragonfly/world/sound" "time" ) // Water is a natural fluid that generates abundantly in the world. type Water struct { noNBT empty replaceable // Still makes the water...
dragonfly/block/water.go
0.68637
0.441492
water.go
starcoder
package redis_wrapper import ( "io" "log" "os" "strings" "time" "github.com/carltd/glib/internal" "github.com/garyburd/redigo/redis" ) const ( redisTag = "redis" ) type hashWrapper interface { // Removes the specified fields from the hash stored at key HashDel(key string, field ...string) error // Deter...
redis_wrapper/wrapper.go
0.671147
0.452657
wrapper.go
starcoder
package calculator import ( "fmt" "math" "strconv" "strings" ) // Add adds all the other numbers to the first. func Add(a float64, b ...float64) float64 { for _, v := range b { a += v } return a } // Subtract subtracts all the other numbers from the first. func Subtract(a float64, b ...float64) float64 { f...
calculator.go
0.793986
0.441071
calculator.go
starcoder
package medtronic import ( "fmt" "time" ) const ( maxBasal = 34000 // milliUnits maxDuration = 24 * time.Hour ) // TempBasalType represents the temp basal type. type TempBasalType byte //go:generate stringer -type TempBasalType const ( // Absolute represents the pump's use of absolute rates for temporary b...
tempbasal.go
0.653016
0.457864
tempbasal.go
starcoder
package heap import ( "errors" "math" ) type Heap struct { array []int size int isMax bool } func (obj *Heap) New(isMax bool, array ...int) { obj.isMax = isMax if len(array) > 0 { obj.array = array } else { obj.array = make([]int, 0) } } func (obj *Heap) GetSize() int { return obj.size } func (obj *...
go/heap/heap.go
0.503418
0.403097
heap.go
starcoder
package system import ( "github.com/stretchr/testify/require" "github.com/clearblade/cbtest" "github.com/clearblade/cbtest/config" "github.com/clearblade/cbtest/provider" ) // Import imports the system given by merging the base system given by // `systemPath` and the extra files given by each of the `extraPaths`...
modules/system/import.go
0.778818
0.44342
import.go
starcoder
package elements import ( "github.com/fileformats/graphics/jt/model" "errors" ) // Late Loaded Property Atom Element is a property atom type used to reference an associated piece of atomic // data in a separate addressable segment of the JT file. The connotation derives from the associated data being // stored in a...
jt/segments/elements/LateLoadedPropertyAtom.go
0.739705
0.463748
LateLoadedPropertyAtom.go
starcoder
package resample import ( "math" ) /* * The Lanczos kernel function L(x, a). */ func lanczosKernel(x float64, a float64) float64 { /* * Calculate the sections of the Lanczos kernel. */ if x == 0 { return 1.0 } else if (-a < x) && (x < a) { piX := math.Pi * x piXa := piX / a piXsquared := piX * piX ...
resample/resample.go
0.772702
0.523603
resample.go
starcoder
package navmeshv2 import ( "github.com/g3n/engine/math32" ) const ( CollisionTerrain = iota CollisionObject ) type CollisionFlag byte func (f CollisionFlag) IsTerrain() bool { return f == CollisionTerrain } func (f CollisionFlag) IsObject() bool { return f == CollisionObject } type Collision struct { Vector...
navmeshv2/collision.go
0.605099
0.54468
collision.go
starcoder
package schemax /* definitionFlags is an unsigned 8-bit integer that describes zero or more perceived values that only manifest visually when TRUE. Such verisimilitude is revealed by the presence of the indicated definitionFlags value's "label" name, such as `SINGLE-VALUE`. The actual value "TRUE" is never actually s...
flags.go
0.883626
0.516595
flags.go
starcoder
package de32 import ( "github.com/ziutek/matrix/matrix32" "math/rand" "time" ) type args struct { a, b, c matrix32.Dense // three vectors for crossover f, cr float32 // differential weight and crossover probability } type Agent struct { x matrix32.Dense in chan args // to send three vectors for c...
de32/agent.go
0.632957
0.41253
agent.go
starcoder
package clang // #include "./clang-c/Documentation.h" // #include "./clang-c/Index.h" // #include "go-clang.h" import "C" import ( "reflect" "unsafe" ) /* A cursor representing some element in the abstract syntax tree for a translation unit. The cursor abstraction unifies the different kinds of entities in a p...
clang/cursor_gen.go
0.755457
0.410284
cursor_gen.go
starcoder
package prx import ( "reflect" "strings" "time" "github.com/mb0/xelf/bfr" "github.com/mb0/xelf/cor" "github.com/mb0/xelf/lit" "github.com/mb0/xelf/typ" ) // Reflect returns the xelf type for the interface value v or an error. func Reflect(v interface{}) (typ.Type, error) { return ReflectType(reflect.TypeOf(v...
prx/reflect.go
0.541894
0.451024
reflect.go
starcoder
package openapi import ( "encoding/json" ) // DispatchRate struct for DispatchRate type DispatchRate struct { DispatchThrottlingRateInMsg *int32 `json:"dispatchThrottlingRateInMsg,omitempty"` DispatchThrottlingRateInByte *int64 `json:"dispatchThrottlingRateInByte,omitempty"` RelativeToPublishRate *bool `json:"re...
openapi/model_dispatch_rate.go
0.743727
0.5119
model_dispatch_rate.go
starcoder
package domain import ( "fmt" "math" apperrors "github.com/miguelramirez93/quasar_fire_operation/shared/app_errors" "github.com/miguelramirez93/quasar_fire_operation/shared/models" "github.com/miguelramirez93/quasar_fire_operation/shared/utils/numbers" valueobjects "github.com/miguelramirez93/quasar_fire_operat...
domain/radar.go
0.707607
0.467757
radar.go
starcoder
package faker import ( "regexp" "strings" ) const digits = "0123456789" const lowerLetters = "abcdefghijklmnopqrstuvwxyz" const upperLetters = "ABCDEFGHIJKLMNOPQRSTUVWXYZ" const charset = digits + lowerLetters + upperLetters // StringWithSize will build a random string of length size. func StringWithSize(size int)...
string.go
0.710226
0.512998
string.go
starcoder
package dataframe import ( "context" ) // ApplyDataFrameFn is used by the Apply function when used with DataFrames. // vals contains the values for the current row. The keys contain ints (index of Series) and strings (name of Series). // The returned map must only contain what values you intend to update. The key c...
apply.go
0.627152
0.556821
apply.go
starcoder
package ids import ( "bytes" "math/bits" ) // NumBits is the number of bits this patricia tree manages const NumBits = 256 // BitsPerByte is the number of bits per byte const BitsPerByte = 8 // EqualSubset takes in two indices and two ids and returns if the ids are // equal from bit start to bit end (non-inclusi...
ids/bits.go
0.729327
0.542015
bits.go
starcoder
package pwr import ( "fmt" "io" "log" "github.com/go-errors/errors" "github.com/itchio/wharf/wire" ) // A Compressor can compress a stream given a quality setting type Compressor interface { Apply(writer io.Writer, quality int32) (io.Writer, error) } // A Decompressor can decompress a stream with a given algo...
pwr/compression.go
0.774583
0.422147
compression.go
starcoder
package options import ( "time" ) // FindOptions represent all possible options to the find() function. type FindOptions struct { AllowPartialResults *bool // If true, allows partial results to be returned if some shards are down. BatchSize *int32 // Specifies the number of documents to...
vendor/github.com/mongodb/mongo-go-driver/mongo/options/findoptions.go
0.681515
0.409929
findoptions.go
starcoder
package iiif import ( "image" "strconv" "strings" ) // A RegionType tells us what a Region is representing so we know how to apply // the x/y/w/h values type RegionType int const ( // RTNone means we didn't find a valid region string RTNone RegionType = iota // RTFull means we ignore x/y/w/h and use the whole ...
src/iiif/region.go
0.721939
0.633155
region.go
starcoder
package geogoth // LineString ... type LineString struct { Coords [][]float64 } // NewLineString creates LineString func NewLineString(coords [][]float64) LineString { return LineString{ Coords: coords, } } // Coordinates returns array of longitude, latitude of the LineString func (l LineString) Coordinates() i...
linestring.go
0.879289
0.47098
linestring.go
starcoder
package mesh import ( "log" "math" "alvin.com/GoCarver/geom" "alvin.com/GoCarver/hmap" ) // gridRow: Rows of vertices form a grid; each square in that grid form 2 triangles. // row i+1: +---+---+---+-- - // | /| /| /| // | / | / | / | // |/ |/ |/ | // row i: +---+---+---+-- - /...
mesh/triangle_mesh.go
0.761804
0.578984
triangle_mesh.go
starcoder
package manifests // Type of resource const ( // service mesh resource SERVICE_MESH = iota // native Kubernetes resource K8s // native Meshery resource MESHERY ) // Json Paths type JsonPath []string type Component struct { Schemas []string Definitions []string } type Config struct { Name stri...
utils/manifests/definitions.go
0.533154
0.476336
definitions.go
starcoder
package engine import ( "fmt" "reflect" "time" ) type Assertion struct { name string nodeType NodeType parent *Assertion children []*Assertion details []Detail result Result Logger Logger } type Detail struct { Name string Message string RecordTime time.Time } func NewAssertion(name...
engine/assertion.go
0.529263
0.621756
assertion.go
starcoder
// Package queue implements a singly-linked list with queue behaviors. package queue import ( "fmt" coll "github.com/maguerrido/collection" ) // node of a Queue. type node struct { // value stored in the node. value interface{} // next points to the next node. // If the node is the back node, then points to n...
queue/queue.go
0.843541
0.452838
queue.go
starcoder
// Package counter implements counters that keeps track of their recent values // over different periods of time. // Example: // c := counter.New() // c.Incr(n) // ... // delta1h := c.Delta1h() // delta10m := c.Delta10m() // delta1m := c.Delta1m() // and: // rate1h := c.Rate1h() // rate10m := c.Rate10m() // rate1m := ...
x/ref/lib/stats/counter/counter.go
0.852091
0.405566
counter.go
starcoder
package evaluator import ( "fmt" "ghostlang.org/x/ghost/ast" "ghostlang.org/x/ghost/object" "ghostlang.org/x/ghost/value" ) type Evaluator func(node ast.Node, scope *object.Scope) object.Object // Evaluate is the heart of our evaluator. It switches off between the various // AST node types and evaluates each ac...
src/evaluator/evaluator.go
0.746971
0.489442
evaluator.go
starcoder
package rbtree const ( red = false black = true ) // Compare compares two values. Returns 0 if a==b, negative if a < b, and // positive a > b. type Compare func(a, b interface{}) int // RedBlackTree is a red-black tree. type RedBlackTree struct { // Compare is used to compare values in the red-black tree for or...
rbtree.go
0.822403
0.404596
rbtree.go
starcoder
package template import ( "fmt" "github.com/pkg/errors" "reflect" "strings" "text/template/parse" ) var ( zero reflect.Value errorType = reflect.TypeOf((*error)(nil)).Elem() ) // Data represent a data source, which contains the value used in template. template will find value in it. type Data interface {...
template/template.go
0.586049
0.42656
template.go
starcoder
package topo import ( "gonum.org/v1/gonum/graph" "gonum.org/v1/gonum/graph/internal/ordered" "gonum.org/v1/gonum/graph/internal/set" ) // Builder is a pure topological graph construction type. type Builder interface { AddNode(graph.Node) SetEdge(graph.Edge) } // CliqueGraph builds the clique graph of g in dst ...
graph/topo/clique_graph.go
0.731922
0.564879
clique_graph.go
starcoder
package math3 import ( "math" "github.com/golang/glog" ) type EulerChangeCallback func() type Euler struct { x float64 y float64 z float64 Order EulerOrder OnChangeCallback EulerChangeCallback } func NewEuler() *Euler { return &Euler{ 0, 0, 0, Eu...
math3/euler.go
0.785226
0.491273
euler.go
starcoder
package cluster import ( ddbRaft "github.com/armPelionEdge/devicedb/raft" ) type ClusterStateDeltaType int const ( DeltaNodeAdd ClusterStateDeltaType = iota DeltaNodeRemove ClusterStateDeltaType = iota DeltaNodeLoseToken ClusterStateDeltaType = iota DeltaNodeGainToken ClusterStateDeltaType = iota...
vendor/github.com/armPelionEdge/devicedb/cluster/delta.go
0.52342
0.712495
delta.go
starcoder
package go2linq // Reimplementing LINQ to Objects: Part 15 – Union // https://codeblog.jonskeet.uk/2010/12/30/reimplementing-linq-to-objects-part-15-union/ // https://docs.microsoft.com/dotnet/api/system.linq.enumerable.union // Union produces the set union of two sequences by using reflect.DeepEqual as equality com...
union.go
0.879425
0.472623
union.go
starcoder
Package command contains the commands used by vtctldclient. It is intended only for use in vtctldclient's main package and entrypoint. The rest of this documentation is intended for maintainers. Commands are grouped into files by the types of resources they interact with ( e.g. GetTablet, CreateTablet, DeleteTablet, G...
go/cmd/vtctldclient/command/doc.go
0.558327
0.539165
doc.go
starcoder
package dlx /* Dancing Links (Algorithm X) data struct. | | | | - columns 0 - columns 1 - columns 2 - ......... - columns i - | | | | - node(row)- node - node - node - | ...
dlx/dlx.go
0.633637
0.623291
dlx.go
starcoder
package katamari import ( "errors" "github.com/benitogf/katamari/key" ) // Apply filter function // type for functions will serve as filters // key: the key to filter // data: the data received or about to be sent // returns // data: to be stored or sent to the client // error: will prevent data to pass the filter...
filters.go
0.663451
0.418043
filters.go
starcoder
package record import ( "unsafe" store_pb "github.com/genzai-io/sliced/proto/store" ) const maxItems = 256 // max items per node const nBits = 8 // 1, 2, 4, 8 - match nNodes with the correct nBits const nNodes = 256 // 2, 4, 16, 256 - match nNodes with the correct nBits type cellT struct { id sto...
app/record/tree.go
0.557364
0.437763
tree.go
starcoder
package ydbsql import ( "context" ) // Compose returns a new Trace which has functional fields composed // both from t and x. func (t Trace) Compose(x Trace) (ret Trace) { switch { case t.OnDial == nil: ret.OnDial = x.OnDial case x.OnDial == nil: ret.OnDial = t.OnDial default: h1 := t.OnDial h2 := x.OnD...
ydbsql/trace_gtrace.go
0.605333
0.432782
trace_gtrace.go
starcoder
package pending_review import "time" // Review contains teh essentials of a submission type Review struct { ReviewerName string SubmittedAt time.Time HTMLURL string } // Reviews summarizes all the reviews of a given pull request type Reviews struct { Count int // Total number of comments, request...
pkg/pending_review/review.go
0.530723
0.472014
review.go
starcoder
package dateparse import ( "strings" "time" ) var ( sunday = `воскресенье|sunday` monday = `понедельник|monday` tuesday = `вторник|tuesday` wednesday = `среду|среда|wednesday` thursday = `четверг|thursday` friday = `пятницу|пятница|friday` saturday = `субботу|суббота|saturday` weeks = strin...
week.go
0.523177
0.485844
week.go
starcoder
package lexer import ( "github.com/domterion/yapl/token" ) // A struct to represent and hold data for the Lexer type Lexer struct { input string position int // The current position in the input, a pointer to current char readPosition int // The current reading position in the input, current char + 1...
lexer/lexer.go
0.627267
0.416975
lexer.go
starcoder
package yacht // funcMap maps categories to functions which calculate results for a given category. // interface type is used since the different functions have different signatures. var funcMap = map[string]interface{}{ "Ones": nOfNumber, "Twos": nOfNumber, "Threes": nOfNumber, "Fou...
yacht/yacht.go
0.638948
0.495056
yacht.go
starcoder
package main import ( "fmt" "math" "sort" ) func sumAgg(metrics []*float64) (float64, error) { vs := removeNulls(metrics) if len(vs) == 0 { return 0, fmt.Errorf("only null values returned") } sum := 0.0 for _, v := range vs { sum += v } return sum, nil } func avgAgg(metrics []*float64) (float64, erro...
aggregations.go
0.619701
0.431944
aggregations.go
starcoder
package copypasta import ( "bytes" "math" "regexp" "sort" "strconv" "strings" ) /* 其他无法分类的算法 三维 n 皇后 https://oeis.org/A068940 Maximal number of chess queens that can be placed on a 3-dimensional chessboard of order n so that no two queens attack each other Smallest positive integer k such that n = +-1+-2+-......
copypasta/misc.go
0.644449
0.617801
misc.go
starcoder
package set import ( "sort" "github.com/juju/errors" "gopkg.in/juju/names.v2" ) // Tags represents the Set data structure, it implements tagSet // and contains names.Tags. type Tags map[names.Tag]bool // NewTags creates and initializes a Tags and populates it with // inital values as specified in the parameters...
vendor/github.com/juju/utils/set/tags.go
0.777849
0.542379
tags.go
starcoder
package core import ( "fmt" "hash/fnv" "strings" "github.com/raviqqe/hamt" ) // StringType represents a string in the language. type StringType string // Eval evaluates a value into a WHNF. func (s StringType) eval() Value { return s } // NewString creates a string in the language from one in Go. func NewStri...
src/lib/core/string.go
0.704567
0.406862
string.go
starcoder
package exp type bitwise struct { lhs Expression rhs interface{} op BitwiseOperation } func NewBitwiseExpression(op BitwiseOperation, lhs Expression, rhs interface{}) BitwiseExpression { return bitwise{op: op, lhs: lhs, rhs: rhs} } func (b bitwise) Clone() Expression { return NewBitwiseExpression(b.op, b.lhs.C...
exp/bitwise.go
0.805938
0.420481
bitwise.go
starcoder
package reporting import ( "fmt" "sort" "strings" ) type Table struct { // title for the entire table title string // rows contains the captions for each row rows []string // rowWidth is the length of the longest row caption rowWidth int // cols contains the captions for each column cols []string // colWi...
v2/tools/generator/internal/reporting/table.go
0.770983
0.563498
table.go
starcoder
package idmapper // Forked from https://github.com/plar/go-adaptive-radix-tree // Callback function type for tree traversal. type Callback func(key Key, value Value) error // RadixTree is an Adaptive Radix Tree implementation for our internal Mapper. type RadixTree struct { root *artNode size int } // NewRadixTre...
pkg/koyeb/idmapper/radix_tree.go
0.873012
0.424412
radix_tree.go
starcoder
package main import ( "math" "sync" "time" "github.com/go-gl/glfw/v3.2/glfw" "github.com/go-gl/mathgl/mgl32" ) type Player struct { pos, rot, velocity mgl32.Vec3 lastMousePosition mgl32.Vec2 mouseInit sync.Once } func NewPlayer(pos mgl32.Vec3) *Player { return &Player{ pos: pos, } } func (p *...
player.go
0.601008
0.425725
player.go
starcoder
package datadog import ( "encoding/json" "fmt" ) // LogsIndex Object describing a Datadog Log index. type LogsIndex struct { // The number of log events you can send in this index per day before you are rate-limited. DailyLimit *int64 `json:"daily_limit,omitempty"` // An array of exclusion objects. The logs are...
api/v1/datadog/model_logs_index.go
0.753285
0.413803
model_logs_index.go
starcoder
package main func GitServer() *Container { return &Container{ Name: "gitserver", Title: "Git Server", Description: "Stores, manages, and operates Git repositories.", Groups: []Group{ { Title: "General", Rows: []Row{ { { Name: "disk_space_remaining", ...
monitoring/git_server.go
0.58261
0.406479
git_server.go
starcoder
package rtc import ( "math" ) // Cone creates a cone at the origin with its axis on the Y axis. // It implements the Object interface. func Cone() *ConeT { return &ConeT{ Shape: Shape{Transform: M4Identity(), Material: GetMaterial()}, Minimum: math.Inf(-1), Maximum: math.Inf(1), Closed: false, } } // C...
rtc/cone.go
0.91967
0.519399
cone.go
starcoder
package helpers import ( "errors" "strconv" ) var visaelectron map[string][]interface{} type digits [6]int func (d *digits) At(i int) int { return d[i-1] } //ReturningTypeCreditCard func ReturningTypeCreditCard(num string) (Company, error) { ccLen := len(num) ccDigits := digits{} for i := 0; i < 6; i++ { ...
helpers/maps.go
0.540196
0.614683
maps.go
starcoder
package attrs import ( "github.com/influx6/haiku/trees" ) // InputType defines the set type of input values for the input elements type InputType string // Types of input for attribute input types. const ( TypeButton InputType = "button" TypeCheckbox InputType = "checkbox" TypeColor InputType = "color" Type...
trees/attrs/attrs.go
0.773901
0.487124
attrs.go
starcoder
package reflection import ( "errors" "fmt" "reflect" "strconv" ) // Creates an instance of caller for methods. func ForMethod(m interface{}) Caller { return &caller{value: m} } // Creates an instance of reflector for structs. func ForInstance(value interface{}) Reflector { return &reflector{ value: value...
Reflection.go
0.776114
0.494507
Reflection.go
starcoder
package game // findwinner returns a color if four contiguous fields of the given // board of that color in a horizontal, vertical or diagonal line exist. // It returns none otherwise. // If this condition applies for both colors one of both will be returned. func findwinner(b *Board) color { if color := winHorizonta...
game/win.go
0.901627
0.434701
win.go
starcoder
package phass import ( "fmt" "time" ) /** * Constants */ // TimeLayout common date representation. const TimeLayout = "2006-Jan-02" // Gender constant values. const ( Male int = iota Female ) /** * Interfaces */ // Measurer is the interface to be implemented by any struct that should convey // a measureme...
assessment.go
0.857664
0.467393
assessment.go
starcoder
package main import "math" var ( // NeuronConnectionWeight the weight of a single neuron connection NeuronConnectionWeight = 0.1 // NeuronConnectionCountStep the step size for how much to increment/decrement // the neuron connection count NeuronConnectionCountStep = 1 // NeuronConnectionCountMinimum the mini...
neuron_connection.go
0.782953
0.447219
neuron_connection.go
starcoder
package timeutil import ( "fmt" "strings" "time" ) // Period represents a unit of time type Period int const ( // PeriodNone represents no period PeriodNone Period = iota // PeriodYear represents years as a Period PeriodYear // PeriodMonth represents months as a Period PeriodMonth // PeriodDay represent...
pkg/timeutil/period.go
0.807423
0.625209
period.go
starcoder
package enigma import "fmt" // RotorSet Represents a set of Rotors that are part of an Enigma machine. // Set to represent a Type 1 Enigma (3 Rotors) type RotorSet struct { refRotor Rotor leftRotor Rotor middleRotor Rotor rightRotor Rotor // Here for posterity. In the real machine, this rotor converts th...
rotorset.go
0.779406
0.483648
rotorset.go
starcoder
package main import ( "fmt" "io/ioutil" "strconv" "strings" ) type ship struct { pos []int waypoint []int } // makeShip creates a ship located at position (x, y) with a waypoint at (wx, wy) func makeShip(x, y, wx, wy int) ship { // The waypoint starts 10 units east and 1 unit north relative to the ship. ...
day12/main.go
0.612541
0.426441
main.go
starcoder
package gcode import ( "fmt" "math" "strings" ) const ( forceX = 1 << iota forceY forceZ forceXY = forceX | forceY forceYZ = forceY | forceZ forceXZ = forceX | forceZ forceXYZ = forceX | forceY | forceZ ) func (g *GCode) genChangedXYZ(opCode string, p Tuple, force int) string { pos := g.Position() va...
gcode/move.go
0.625324
0.41739
move.go
starcoder
package docs import ( "bytes" "encoding/json" "strings" "text/template" "github.com/swaggo/swag" ) var doc = `{ "schemes": {{ marshal .Schemes }}, "swagger": "2.0", "info": { "description": "{{escape .Description}}", "title": "{{.Title}}", "contact": {}, "version": "{...
internal/docs/docs.go
0.586641
0.400925
docs.go
starcoder
package circheatmap import ( "fmt" "math" "github.com/knightjdr/prohits-viz-analysis/pkg/color" "github.com/knightjdr/prohits-viz-analysis/pkg/float" customMath "github.com/knightjdr/prohits-viz-analysis/pkg/math" ) // Circle has properties for drawing one circle in a circular heatmap. type Circle struct { Att...
pkg/svg/circheatmap/circles.go
0.692746
0.437343
circles.go
starcoder
package bbvm import ( "context" "github.com/wenerme/bbvm/bbasm" "math" "math/rand" "time" ) func StdBase(rt bbasm.Runtime, std *Std) *Std { random := rand.New(rand.NewSource(0)) dataPtr := 0 return &Std{ FloatToInt: func(ctx context.Context, v float32) int { return int(v) }, IntToFloat: func(ctx cont...
bbvm/std_base.go
0.544559
0.403684
std_base.go
starcoder
package timex import ( "time" ) const WeekStartDay = time.Monday type Time struct { time.Time } func New(t time.Time) *Time { return &Time{Time: t} } func (now *Time) BeginningOfMinute() time.Time { return now.Truncate(time.Minute) } func (now *Time) BeginningOfHour() time.Time { y, m, d := now.Date() retur...
timex/time.go
0.673943
0.450782
time.go
starcoder
package pricing import ( "fmt" "github.com/tealeg/xlsx" "go.uber.org/zap" "github.com/transcom/mymove/pkg/models" ) var parseDomesticMoveAccessorialPrices processXlsxSheet = func(params ParamConfig, sheetIndex int, logger Logger) (interface{}, error) { // XLSX Sheet consts const xlsxDataSheetNum int = 17 // 5...
pkg/parser/pricing/parse_access_and_add_prices.go
0.523177
0.419232
parse_access_and_add_prices.go
starcoder
package types import ( "io" "reflect" "github.com/lyraproj/pcore/px" "github.com/lyraproj/pcore/utils" ) type PatternType struct { regexps []*RegexpType } var PatternMetaType px.ObjectType func init() { PatternMetaType = newObjectType(`Pcore::PatternType`, `Pcore::ScalarDataType { attributes => { patte...
types/patterntype.go
0.647798
0.503357
patterntype.go
starcoder
package kinematics import ( "errors" "math" "math/rand" "gonum.org/v1/gonum/mat" "gonum.org/v1/gonum/optimize" ) // DhParameters stand for "Denavit-Hartenberg Parameters". These parameters // define a robotic arm for input into forward or reverse kinematics. type DhParameters struct { ThetaOffsets []float64 A...
kinematics.go
0.840292
0.621799
kinematics.go
starcoder
package formula import ( "github.com/Chadius/creating-symmetry/entities/formula/coefficient" "math/cmplx" ) // Rosette formulas transform points around a central origin, similar to a rosette surrounding a center. type Rosette struct { formulaLevelTerms []Term } // NewRosetteFormula returns a new formula func NewR...
entities/formula/rosette.go
0.877451
0.408395
rosette.go
starcoder
package main import ( "math/rand" "sync" "github.com/dhconnelly/rtreego" "github.com/gravestench/mathlib" ) const tol = 0.01 type Boid struct { Id int position rtreego.Point Velocity *mathlib.Vector2 trail []mathlib.Vector2 } func (boid Boid) Bounds() *rtreego.Rect { return boid.position.ToRect(t...
boid.go
0.673729
0.548008
boid.go
starcoder
package queue const smallSize = 16 // Queue represents a single instance of the queue data structure. The zero // value for a Queue is an empty queue ready to use. type Queue struct { head, tail []interface{} } // Init initializes or clears the Queue. func (q *Queue) Init() { q.head, q.tail = nil, nil } // Cap re...
internal/queue/queue.go
0.850515
0.49408
queue.go
starcoder
package details import "github.com/gsiems/go-marc21/pkg/marc21" /* http://www.loc.gov/marc/bibliographic/bdintro.html Leader - Data elements that primarily provide information for the processing of the record. The data elements contain numbers or coded values and are identified by relative character pos...
pkg/details/leader.go
0.720467
0.436082
leader.go
starcoder
package fsm import ( "fmt" ) // State represents a possible transition state for the FSM type State string // FSM is an interface that defines the operation of different types of // state machines. Note that the interface does not include a Transition() function // that should be implemented separately by each con...
pkg/fsm/fsm.go
0.824321
0.473414
fsm.go
starcoder
package quadtree import ( "code.google.com/p/draw2d/draw2d" "image" "image/color" "image/draw" "image/png" "bufio" "log" "os" ) type QuadTree struct { MaxPointsPerNode int points []image.Point BoundingBox image.Rectangle BLeft, TLeft *QuadTree BRight, TRight *QuadTree hasChildren ...
ds-algorithms/quadtree/qtree.go
0.590543
0.457985
qtree.go
starcoder
package v1 import ( "context" "reflect" "github.com/pulumi/pulumi/sdk/v3/go/pulumi" ) // Gets the details of a rate plan. func LookupRatePlan(ctx *pulumi.Context, args *LookupRatePlanArgs, opts ...pulumi.InvokeOption) (*LookupRatePlanResult, error) { var rv LookupRatePlanResult err := ctx.Invoke("google-native...
sdk/go/google/apigee/v1/getRatePlan.go
0.819099
0.649273
getRatePlan.go
starcoder