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 sentiment import ( "fmt" "github.com/coderafting/panas-go/internal/text" ) /* Text validation, Extract sentiment types and Compute aggregate sentiment value for texts. Based on the PANAS-t paper. */ // ContainsTopic checks if the words-collection contains at least one word // that is similar to the suppli...
pkg/sentiment/panas.go
0.804406
0.455441
panas.go
starcoder
package parse import ( "sort" "github.com/alistairjudson/cronparse/internal/numberer" ) var ( // MinuteParser is a parser to parse the minute component of a cron expression MinuteParser = NewParser(numberer.MinuteFactory) // HourParser is a parser to parse the hour component of a cron expression HourParser = ...
internal/parse/adapter.go
0.640861
0.496826
adapter.go
starcoder
package jsonlogic import "fmt" type ErrReduceDataType struct { dataType string } func (e ErrReduceDataType) Error() string { return fmt.Sprintf("The type \"%s\" is not supported", e.dataType) } func filter(values, data interface{}) interface{} { parsed := values.([]interface{}) var subject interface{} if isS...
arrays.go
0.566019
0.46308
arrays.go
starcoder
package tpkt import ( "fmt" "hash" "strings" "github.com/scionproto/scion/go/lib/common" "github.com/scionproto/scion/go/lib/spath" ) // ScnPath contains the scion path (which is raw) and the path definition. // It is used to define hand-crafted paths. type ScnPath struct { spath.Path Segs Segments } // Gen...
go/border/braccept/tpkt/scnpath.go
0.520253
0.445952
scnpath.go
starcoder
package plaid import ( "encoding/json" ) // IncomeSummary The verified fields from a paystub verification. All fields are provided as reported on the paystub. type IncomeSummary struct { EmployerName EmployerIncomeSummaryFieldString `json:"employer_name"` EmployeeName EmployeeIncomeSummaryFieldString `json:"emplo...
plaid/model_income_summary.go
0.81409
0.470007
model_income_summary.go
starcoder
package aoc2015 /* --- Day 7: Some Assembly Required --- This year, Santa brought little Bobby Tables a set of wires and bitwise logic gates! Unfortunately, little Bobby is a little under the recommended age range, and he needs help assembling the circuit. Each wire has an identifier (some lowercase letters) and can ...
app/aoc2015/aoc2015_07.go
0.734691
0.673145
aoc2015_07.go
starcoder
package gofa // SOFA Astrometry Tools /* Ab Apply stellar aberration Apply aberration to transform natural direction into proper direction. Given: pnat [3]float64 natural direction to the source (unit vector) v [3]float64 observer barycentric velocity in units of c s float64 distance ...
astrometry.go
0.870735
0.675901
astrometry.go
starcoder
package spec // link The Link object represents a possible design-time link for a response. // The presence of a link does not guarantee the caller's ability to successfully invoke it, rather it provides a known relationship and traversal mechanism between responses and other operations. // Unlike dynamic links (i.e. ...
vendor/github.com/wzshiming/openapi/spec/link.go
0.763836
0.484075
link.go
starcoder
package gogeom import ( "fmt" "math" ) // (x-a)*2 + (y-b)*2 = r*2 // (x-c)*2 + (y-d)*2 = r*2 type RadiusFormOfCircle struct { A, B, R0, C, D, R1 float64 } // x2 + y2 + Ax + By+ C = 0 // x2 + y2 + Dx + Ey + F = 0 type GeneralFormOfCircle struct { A, B, C, D, E, F float64 } // DistanceBetweenTwoCenters is used to...
circle.go
0.74872
0.516717
circle.go
starcoder
package zoekt import ( "sort" ) type topOffset struct { top, off uint32 } // arrayNgramOffset splits ngrams into two 32-bit parts and uses binary search // to satisfy requests. A three-level trie (over the runes of an ngram) uses 20% // more memory than this simple two-level split. type arrayNgramOffset struct { ...
ngramoffset.go
0.66072
0.47171
ngramoffset.go
starcoder
package dateutil import ( "errors" "fmt" "regexp" "strconv" "time" ) // The regular expression which matches ISO 8601 date format pattern (e.g. 2013-02-08). var iso8601DateFormatPattern = regexp.MustCompile("^(\\d{4})-(\\d{2})-(\\d{2})") // The regular expression which matches a hh:mm time format pattern (e.g ...
common/util/dateutil/date.go
0.752013
0.5083
date.go
starcoder
package compose import ( "bytes" ) // Composes a request body for the v1/transactions endpoint with as many transactions as // `numTransactions`, each containing as many spans as `numSpans`, each containing as many // frames as `numFrames` * 10 func TransactionRequest(numTransactions int, numSpans int, numFrames int...
compose/composer.go
0.786582
0.413122
composer.go
starcoder
package sqldrivermock import ( "database/sql/driver" "fmt" "regexp" "strings" ) type expectation interface { fulfill(expectation) error fulfilled() bool fmt.Stringer } // ExpectationMismatchError is provided when a recorded event doesn't match expected type type ExpectationMismatchError struct { expected exp...
sqldrivermock/expect.go
0.770724
0.438184
expect.go
starcoder
package datarate import "fmt" import "github.com/kormoc/unit" import "github.com/kormoc/unit/datasize" import "strings" import "time" type Datarate float64 type DatarateSIBit Datarate type DatarateSIByte Datarate type DatarateIECBit Datarate type DatarateIECByte Datarate var outputStringMaxPercision int =...
datarate/datarate.go
0.732783
0.595728
datarate.go
starcoder
package loki import ( "fmt" "sort" "time" "github.com/grafana/grafana-plugin-sdk-go/data" "github.com/grafana/loki/pkg/loghttp" "github.com/grafana/loki/pkg/logqlmodel/stats" jsoniter "github.com/json-iterator/go" ) func parseResponse(value *loghttp.QueryResponse, query *lokiQuery) (data.Frames, error) { fra...
pkg/tsdb/loki/parse_response.go
0.627837
0.417865
parse_response.go
starcoder
package operators import ( "context" "strings" "github.com/MontFerret/ferret/pkg/runtime/core" "github.com/MontFerret/ferret/pkg/runtime/values" "github.com/MontFerret/ferret/pkg/runtime/values/types" ) type ( OperatorFunc func(left, right core.Value) core.Value baseOperator struct { src core.SourceMap ...
pkg/runtime/expressions/operators/operator.go
0.694095
0.443359
operator.go
starcoder
package tzx import "github.com/voytas/z80-go-zx/spectrum/helpers" type HeaderDataBlock struct { signature string // TZX signature eot byte // End of text file marker VerMajor byte // TZX major revision number VerMinor byte // TZX minor revision number } type StandardSpeedDataBlock struct { PauseAf...
spectrum/tape/tzx/blocks.go
0.537284
0.503052
blocks.go
starcoder
package datatype import ( "fmt" "github.com/datastax/go-cassandra-native-protocol/primitive" "io" ) type DataType interface { GetDataTypeCode() primitive.DataTypeCode Clone() DataType } func WriteDataType(t DataType, dest io.Writer, version primitive.ProtocolVersion) (err error) { if t == nil { return fmt.E...
datatype/datatype.go
0.519765
0.412944
datatype.go
starcoder
package syntax import ( "github.com/strict-lang/sdk/pkg/compiler/diagnostic" "github.com/strict-lang/sdk/pkg/compiler/grammar/token" "github.com/strict-lang/sdk/pkg/compiler/grammar/tree" ) func (parsing *Parsing) parseImportStatementList() (imports []*tree.ImportStatement) { for token.HasKeywordValue(parsing.tok...
pkg/compiler/grammar/syntax/declaration.go
0.566978
0.418103
declaration.go
starcoder
package nonlineareq import ( "errors" "math" ) //YEqFuncx function type is used to create y=f(x) type of functions //the params ..float64 variable allows the user to enter configuration parameters to standard funcions (e.g. for irr estimations or any standard function which parameters change case by case). type YEq...
nonlineareq/nonlinear.go
0.541894
0.603026
nonlinear.go
starcoder
package gerc // This is an implementation of Bram Cohen's patience diffing algorithm. // The concept is pretty simple. Pull matching lines off the head and tail // of each array, then process the differing lines inside by finding unique // matching lines. Next process each chunk between matching lines in // the same w...
third_party/google/zoekt/vendor/humungus.tedunangst.com/r/gerc/diff.go
0.509032
0.512449
diff.go
starcoder
// Package stats contains interfaces and utilities relating to the collection of // statistics from a fleetspeak server. package stats import ( "context" "time" "github.com/google/fleetspeak/fleetspeak/src/common" "github.com/google/fleetspeak/fleetspeak/src/server/db" fspb "github.com/google/fleetspeak/fleets...
fleetspeak/src/server/stats/collector.go
0.67662
0.450964
collector.go
starcoder
package samples func init() { sampleDataProposalCreateOperation[8] = `{ "expiration_time": "2015-12-31T23:59:59", "extensions": [], "fee": { "amount": 4000010, "asset_id": "1.3.0" }, "fee_paying_account": "1.2.282", "proposed_ops": [ { "op": [ 34, { "daily_pay...
gen/samples/proposalcreateoperation_8.go
0.589126
0.47591
proposalcreateoperation_8.go
starcoder
package log // Fields represents a map of key-value pairs where the value can be any Go // type. The value must be able to be converted to a string. type Fields map[string]interface{} // Logger is an interface for Logging type Logger interface { // Trace logs a message at the Trace level Trace(msg ...interface{}) ...
log.go
0.599602
0.448607
log.go
starcoder
package fwt import ( "errors" "fmt" "github.com/dolthub/dolt/go/libraries/doltcore/row" "github.com/dolthub/dolt/go/libraries/doltcore/schema" "github.com/dolthub/dolt/go/store/types" ) // TooLongBehavior determines how the FWTTransformer should behave when it encounters a column that is longer than what // i...
go/libraries/doltcore/table/untyped/fwt/formatter.go
0.628407
0.415966
formatter.go
starcoder
package egosat type queue struct { heap []Lit // Heap storage indices []int // Maps elements to their indices in the heap solver *Solver // Reference to solver for access to literal activities } // These functions are used for computing the indices of the parent and children // of heap nodes func parent(id...
egosat/priority_queue.go
0.74382
0.497864
priority_queue.go
starcoder
package rbt import ( "constraints" "fmt" ) // Tree represents red-black tree. type Tree[T constraints.Ordered] struct { Root *Node[T] } func (t *Tree[T]) Insert(v T) { if t.Root == nil { t.Root = &Node[T]{ Value: v, } return } top := t.Root.insert(v) // insert can replace root - so check it if top...
rbt.go
0.752195
0.40645
rbt.go
starcoder
package dsp import ( "math" ) const bwPercent = 0.80 // FloatResampler is a Polyphase Resampler based on GNU Radio Implementation type FloatResampler struct { internalBuffer []float32 taps [][]float32 diffTaps [][]float32 filters []*FloatFirFilter diffFilters ...
dsp/resampler.go
0.621311
0.512144
resampler.go
starcoder
package level0 import ( "fmt" "github.com/sfomuseum/go-edtf" "github.com/sfomuseum/go-edtf/common" "github.com/sfomuseum/go-edtf/re" "strings" "time" ) /* Date and Time [date][“T”][time] Complete representations for calendar date and (local) time of day Example 1 ‘1985-04-12T23:20:30’ ref...
vendor/github.com/sfomuseum/go-edtf/level0/date_and_time.go
0.549399
0.433022
date_and_time.go
starcoder
package oak import ( "image" "github.com/oakmound/oak/dlog" "github.com/oakmound/oak/event" "github.com/oakmound/oak/physics" ) var ( // ViewPos represents the point in the world which the viewport is anchored at. ViewPos = image.Point{} useViewBounds = false viewBounds rect ) type rect struct { m...
viewport.go
0.627267
0.480662
viewport.go
starcoder
package sql import ( "fmt" "regexp" "strings" ) // ComparisonOperator - comparison operator. type ComparisonOperator string const ( // Equal operator '='. Equal ComparisonOperator = "=" // NotEqual operator '!=' or '<>'. NotEqual ComparisonOperator = "!=" // LessThan operator '<'. LessThan ComparisonOpera...
pkg/s3select/sql/compexpr.go
0.763924
0.4917
compexpr.go
starcoder
package parquet import ( "bytes" "reflect" "github.com/mindhash/arrow-parquet-go/gen-go/parquet" ) func valuesToInterfaces(values interface{}, valueType parquet.Type) (tableValues []interface{}) { switch valueType { case parquet.Type_BOOLEAN: for _, v := range values.([]bool) { tableValues = append(tableVa...
common.go
0.508056
0.668326
common.go
starcoder
package main import ( "fmt" "math" "math/rand" "time" ) const ( NUM_RIGID_BODIES = 1 ) type Vector2 struct { x float32 y float32 } type BoxShape struct { width float32 height float32 mass float32 momentOfInertia float32 } func (boxShape *BoxShape) CalculateBoxInertia() { v...
Physics-Engine-Basics/rigid_body_dynamics.go
0.617051
0.555375
rigid_body_dynamics.go
starcoder
package uncheckTypeAssert func sink(args ...interface{}) {} func uncheckedTypeAssert() { var v interface{} _ = v.(int) // want `\Qavoid unchecked type assertions as they can panic` { x := v.(int) // want `\Qavoid unchecked type assertions as they can panic` _ = x } sink(v.(int)) // want `\Qavoid u...
testdata/src/uncheckTypeAssert/uncheck_type_assert.go
0.579043
0.401981
uncheck_type_assert.go
starcoder
package rp import ( "fmt" "strings" ) type stand struct { Name string Type string Desc string } func (st stand) apply(user string) string { var b strings.Builder fmt.Fprintf(&b, "%s's new Stand is ", user) fmt.Fprintf(&b, "[u]%s[/u] ", clean(st.Name)) fmt.Fprintf(&b, "([i]%s[/i]): ", clean(st.Type)) fmt.Fp...
rp/jojo.go
0.539226
0.530358
jojo.go
starcoder
package compute import ( "fmt" "github.com/haro87/dokerb/pkg/datastore" "github.com/haro87/dokerb/pkg/estimate" "sort" ) // CalculateAverageEstimate calculates the average estimate of all provided // estimates matching a given task ID func CalculateAverageEstimate(estimates []datastore.Estimate, id string) (estim...
backend/pkg/compute/compute.go
0.682679
0.475301
compute.go
starcoder
package codec import ( "bytes" "encoding/binary" "math" ) // Buffer provides buffer for encoding and decoding data on wire. type Buffer struct { buf []byte pos int } // NewBuffer creates new buffer using b as data. func NewBuffer(b []byte) *Buffer { return &Buffer{ buf: b, } } // Bytes returns buffer data...
vendor/git.fd.io/govpp.git/codec/codec.go
0.630571
0.562417
codec.go
starcoder
package main import "math" //main structs type Vector2 struct { x float64 y float64 } type Vector3 struct { x float64 y float64 z float64 } type Vector4 struct { x float64 y float64 z float64 w float64 } type Matrix2 struct { mtx [4]float64 } type Matrix3 struct { mtx [9]float64 } type Matr...
sparkmath.go
0.860061
0.804905
sparkmath.go
starcoder
package main import ( "image/color" "github.com/256dpi/gosom/functions" "github.com/gonum/plot" "github.com/gonum/plot/plotter" ) func plotCoolingFunctions(file string) { p, err := plot.New() if err != nil { panic(err) } p.Title.Text = "CoolingFunctions" p.X.Label.Text = "Input" p.Y.Label.Text = "Output...
gosom/functions.go
0.686685
0.49939
functions.go
starcoder
package a type Ordered interface { ~int | ~int8 | ~int16 | ~int32 | ~int64 | ~uint | ~uint8 | ~uint16 | ~uint32 | ~uint64 | ~uintptr | ~float32 | ~float64 | ~string } // Max returns the maximum of two values of some ordered type. func Max[T Ordered](a, b T) T { if a > b { return a } return b } // Min re...
test/typeparam/sliceimp.dir/a.go
0.790085
0.445771
a.go
starcoder
package participatingvolume import ( "fmt" "math" "math/rand" "github.com/paulwrubel/photolum/config/geometry" "github.com/paulwrubel/photolum/config/geometry/primitive" "github.com/paulwrubel/photolum/config/geometry/primitive/aabb" "github.com/paulwrubel/photolum/config/shading/material" ) // ParticipatingV...
config/geometry/primitive/participatingvolume/participatingvolume.go
0.821582
0.413063
participatingvolume.go
starcoder
// Package queueimpl7 implements an unbounded, dynamically growing FIFO queue. // Internally, queue store the values in fixed sized slices that are linked using // a singly linked list. // This implementation tests the queue performance when performing lazy creation of // the internal slice as well as starting with a ...
queueimpl7/queueimpl7.go
0.861028
0.543833
queueimpl7.go
starcoder
// D65 illuminant conversion functions package white // D65_A functions func D65_A_Bradford(xs, ys, zs float64) (xd, yd, zd float64) { m := [3][3]float64{ {1.2164557, 0.1109905, -0.1549325}, {0.1533326, 0.9152313, -0.0559953}, {-0.0239469, 0.0358984, 0.3147529}} xd = m[0][0]*xs + m[0][1]*ys + m[0][2]*zs yd ...
f64/white/d65.go
0.508056
0.655246
d65.go
starcoder
package main import ( "flag" "fmt" "math/rand" ) // Generates the initial population with a propability of "sponateous birth" via the probability argument func generateInitialPopulation(cols int, rows int, propability float64, generations int) []int { generation := make([]int, (cols+2)*(rows+2)) for i := 0; i < ...
golang/cmd/game-of-life/main.go
0.565539
0.407805
main.go
starcoder
// Package pps is an implementation of the Primordial Particle System (PPS) // described in: <NAME>., <NAME>. & <NAME>. // How a life-like system emerges from a simplistic particle motion law. // Sci Rep 6, 37969 (2016). https://doi.org/10.1038/srep37969 package pps import ( "image/color" "math" ) type Universe st...
universe.go
0.77518
0.514034
universe.go
starcoder
package dual import ( "fmt" "github.com/pkg/errors" G "gorgonia.org/gorgonia" "gorgonia.org/gorgonia/ops/nn" "gorgonia.org/tensor" ) type maebe struct { err error } type batchNormOp interface { SetTraining() SetTesting() Reset() error } // generic monad... may be useful func (m *maebe) do(f func() (*G.Nod...
dualnet/ermahagerdmonards.go
0.580352
0.430746
ermahagerdmonards.go
starcoder
package selfmap import ( "errors" "fmt" ) type BSTNode struct { key string value int left *BSTNode right *BSTNode } func (n *BSTNode) String() string { return fmt.Sprintf("{%s: %d}", n.key, n.value) } type BSTMap struct { root *BSTNode size int } func NewBSTMap() *BSTMap { return &BSTMap{} } func (m *BS...
go/map/bst_map.go
0.540681
0.476336
bst_map.go
starcoder
package main import ( "math" . "github.com/jakecoffman/cp" "github.com/jakecoffman/cp/examples" ) const numBalls = 5 var motor *SimpleMotor var balls [numBalls]*Body func main() { space := NewSpace() space.SetGravity(Vector{0, -600}) walls := []Vector{ {-256, 16}, {-256, 300}, {-256, 16}, {-192, 0}, {...
examples/pump/pump.go
0.546738
0.533397
pump.go
starcoder
package mask import ( "fmt" "strings" "github.com/pingcap/parser/ast" "github.com/pingcap/tidb/expression" "github.com/pingcap/tidb/kv" plannercore "github.com/pingcap/tidb/planner/core" ) type Expr = expression.Expression type CastGraph struct { Adj map[Node]([]Node) } type Node interface { } var _ Node =...
mask/cast_graph.go
0.520496
0.417806
cast_graph.go
starcoder
package opengl import ( "errors" "image" "github.com/go-gl/gl/v3.3-core/gl" ) // Texture is a single OpenGL texture type Texture struct { handle uint32 unit uint32 } // TextureOptions contains extra options for setting up a texture type TextureOptions struct { WrapS WrapType WrapR WrapType MinFilt...
opengl/texture.go
0.737253
0.41401
texture.go
starcoder
package ser // Sort the pre-(Anti)-Robinson matrix using Simulated Annealing. // Use functions in obj_fn_sim.go for Robinson, obj_fn_dis.go for Anti-Robinson matrix. import ( // "fmt" "math" "math/rand" // "time" ) type GenFn func(p IntVector) // Generates a new solution from an old one type CoolFn func(...
data/go/2640602fd43c49d38a439cd15786bdca_rob_sa.go
0.7659
0.6592
2640602fd43c49d38a439cd15786bdca_rob_sa.go
starcoder
package mpt import ( "bytes" "encoding/binary" "fmt" "io" "github.com/mit-dci/go-bverify/crypto" ) // DictionaryLeafNode represents a leaf node in a Merkle Prefix Trie // (MPT) dictionary. Dictionary leaf nodes store a key and a value, // both of which are fixed length byte arrays (usually // the outputs of a c...
mpt/dictionaryleafnode.go
0.730674
0.440529
dictionaryleafnode.go
starcoder
package shape import ( "fmt" "math" "math/rand" "github.com/benfrisbie/raytracer/geometry" ) const EPSILON = 0.000000001 type Triangle struct { Shape Vertices [3]geometry.Vector normal *geometry.Vector area *float64 } func (triangle Triangle) String() string { return fmt.Sprintf("Triangle(%v, %v, %v)",...
geometry/shape/triangle.go
0.828973
0.665672
triangle.go
starcoder
package forest import ( "math/rand" "time" "github.com/wlattner/rf/tree" ) func init() { rand.Seed(time.Now().UnixNano()) } type forestConfiger interface { setMinSplit(n int) setMinLeaf(n int) setMaxDepth(n int) setImpurity(f tree.ImpurityMeasure) setMaxFeatures(n int) setNumTrees(n int) setNumWorkers(n ...
forest/forest.go
0.748352
0.433622
forest.go
starcoder
package runtime /* 1. Background information This file contains the implementation of a concurrent extension for Go's map type. This is a novel lock-based implementation of a hash table. Similar to Go's default builtin hash table (see runtime/hashmap.go), data is arranged into an array of buckets, ...
src/runtime/concurrent_map.go
0.758332
0.701458
concurrent_map.go
starcoder
package sideeffect import ( dfa "github.com/skius/dataflowanalysis" "github.com/skius/stringlang/ast" "github.com/skius/stringlang/cfg" "github.com/skius/stringlang/optimizer/analysis/util" ) // Compute takes a CFG of a *normalized* program and computes the in and out sets of variables at each node that // are us...
optimizer/analysis/sideeffect/sideeffect.go
0.61057
0.442938
sideeffect.go
starcoder
package gorules import "fmt" // Rule is just a collection of expressions type Rule []Expression //Evaluate all the expressions in the rule func (r Rule) Evaluate() (bool, error) { // fmt.Println("5", r.expressions) result := evaluateExpressions(r) return result, nil } //Add Expressions to the Rule func (r Rule) ...
rule.go
0.623148
0.422683
rule.go
starcoder
package board import ( "encoding/json" "errors" "os" ) var ( // ErrRowMismatch is an error for when the number of rows and row hints are not the same ErrRowMismatch = errors.New("mismatch between number of rows and row hints") // ErrColMismatch is an error for when the number of cols and col hints are not the ...
internal/board/board.go
0.664323
0.472318
board.go
starcoder
package cstructs import ( math "github.com/chewxy/math32" "github.com/r4stl1n/micro-hal/code/pkg/hmath" ) type Rotation struct { Mat3 hmath.Mat3 } func (rotation *Rotation) FromEulerAngles(psi float32, theta float32, phi float32) *Rotation { *rotation = Rotation{} rotation.Mat3.SetAt(0, 0, math.Cos(psi)*math....
code/pkg/champ/cstructs/rotation.go
0.744378
0.853242
rotation.go
starcoder
package ratederivatives import ( "errors" "math" "time" "github.com/bridgefinance-net/bridgefinance/pkg/utils" log "github.com/sirupsen/logrus" ) // RateFactor returns the integer a rate is multiplied by in the computation // of (compounded) RFRs. func RateFactor(date time.Time, holidays []time.Time) (int, erro...
internal/pkg/rateDerivatives/rfr.go
0.7586
0.502502
rfr.go
starcoder
package infrastructure import ( "fmt" "reflect" "github.com/aws/aws-sdk-go/service/ec2" "github.com/aws/aws-sdk-go/service/iam" . "github.com/onsi/gomega" "github.com/onsi/gomega/types" ) // BeSemanticallyEqualTo returns a matcher that tests if actual is semantically // equal to the given value from the aws s...
pkg/aws/matchers/matchers.go
0.819099
0.528168
matchers.go
starcoder
package client // PersistentVolumeSpec is the specification of a persistent volume. type V1PersistentVolumeSpec struct { // AccessModes contains all ways the volume can be mounted. More info: https://kubernetes.io/docs/concepts/storage/persistent-volumes#access-modes AccessModes []string `json:"accessModes,omitempt...
vendor/github.com/kubernetes-client/go/kubernetes/client/v1_persistent_volume_spec.go
0.880784
0.561756
v1_persistent_volume_spec.go
starcoder
package helpers import ( "log" "strconv" "strings" ) // Edge contains data about the connection of two Nodes type Edge struct { Weight int Source Node Destination Node Directed bool } // Node contains details about a specific Node in the graph type Node struct { Name string Edges []Edge } // ...
pkg/helpers/dijkstra.go
0.560734
0.498108
dijkstra.go
starcoder
package board import ( "fmt" "sync" ) // COLS and ROWS define the size of the game board, and are largely manipulable for different game dynamics const ( COLS = 7 ROWS = 6 ) // Board holds the current state of the board, the history that got it there, and an rwmutex for thread safety. // Note that rows are fille...
board/board.go
0.756627
0.448004
board.go
starcoder
package events // A generic event callback type Callback func(...interface{}) // Create a callback adapter that adapts an event message to a single bool func Boolify(callback func(bool)) Callback { return func(data ...interface{}) { var value bool if len(data) > 0 { value = data[0].(bool) } callback(val...
callbacks.go
0.759939
0.463687
callbacks.go
starcoder
package main import ( "fmt" "regexp" "sort" "strconv" "strings" "time" ) type Metric struct { Key string Value int64 Tags map[string]string `json:"Tags,omitempty"` } func parseInt(s string) (i int) { i, _ = strconv.Atoi(s) return } func parseInt64(s string) (i int64) { i, _ = strconv.ParseInt(s, 10, ...
metric.go
0.515132
0.412826
metric.go
starcoder
package main import ( "fmt" "strconv" "strings" ) var input = ` light chartreuse bags contain 1 mirrored yellow bag, 2 vibrant violet bags. dotted silver bags contain 2 dotted orange bags, 3 bright fuchsia bags, 5 bright tomato bags, 3 faded turquoise bags. plaid indigo bags contain 1 pale violet bag, 4 mirrored v...
day7/main.go
0.550849
0.679466
main.go
starcoder
package example import "log" // Google Public DNS provides two distinct DoH APIs at these endpoints // Using the GET method can reduce latency, as it is cached more effectively. // RFC 8484 GET requests must have a ?dns= query parameter with a Base64Url encoded DNS message. The GET method is the only method supporte...
example/gen_config_optionGen.go
0.67662
0.469581
gen_config_optionGen.go
starcoder
package elasticsearch const Template = ` { "template" : "cypress-*", "settings" : { "index.refresh_interval" : "5s" }, "mappings" : { "_default_" : { "_all" : {"enabled" : true, "omit_norms" : true}, "dynamic_templates" : [ { "message_field" : { "match" : "message", ...
plugins/elasticsearch/template.go
0.587588
0.459379
template.go
starcoder
package turfgo import ( "errors" "math" ) // RadsToDegree convert a radians (assuming a spherical Earth) into degrees func RadsToDegree(rad float64) float64 { return rad * 180 / math.Pi } // DegreeToRads convert degrees (assuming a spherical Earth) into radians func DegreeToRads(degree float64) float64 { return ...
conversions.go
0.917774
0.840717
conversions.go
starcoder
package main import ( "bufio" "fmt" "os" "strings" ) type vector struct { x, y, z int } type planet struct { pos vector vel vector } func (p planet) String() string { return fmt.Sprintf("pos: %v, vel: %v", p.pos, p.vel) } type universe struct { planets []planet } func (u universe) String() string { var ...
12/12-pt1.go
0.554712
0.493409
12-pt1.go
starcoder
package terminal import ( "context" "runtime" "github.com/searKing/golang/go/error/exception" "github.com/searKing/golang/go/util/class" "github.com/searKing/golang/go/util/optional" "github.com/searKing/golang/go/util/spliterator" ) const ( MsgStreamLinked = "stream has already been operated upon or closed"...
go/container/stream/op/terminal/abstract_pipeline.go
0.843025
0.418994
abstract_pipeline.go
starcoder
package did import ( "fmt" "math/big" "strconv" "strings" "github.com/aviate-labs/candid-go/internal/candid" "github.com/di-wu/parser/ast" ) func convertNat(n *ast.Node) *big.Int { switch n := strings.ReplaceAll(n.Value, "_", ""); { case strings.HasPrefix(n, "0x"): n = strings.TrimPrefix(n, "0x") i, _ :=...
did/data.go
0.752649
0.446676
data.go
starcoder
package main /* 题目: 给定一个二维矩阵,计算其子矩形范围内元素的总和,该子矩阵的左上角为 (row1, col1) ,右下角为 (row2, col2)。 matrix = [ [3, 0, 1, 4, 2], [5, 6, 3, 2, 1], [1, 2, 0, 1, 5], [4, 1, 0, 1, 7], [1, 0, 3, 0, 5] ] 上图子矩阵左上角 (row1, col1) = (2, 1) ,右下角(row2, col2) = (4, 3),该子矩形内元素的总和为 8。 说明: 你可以假设矩阵不可变。 会多次调用 sumRegion 方法。 你可以假设 row1 ≤ r...
internal/leetcode/304.range-sum-query-2d-immutable/main.go
0.503662
0.526282
main.go
starcoder
package formula import ( "errors" "fmt" "github.com/Chadius/creating-symmetry/entities/formula/coefficient" "math" ) // ConvertToLatticeCoordinates changes the coordinate to match the axes defined by the latticeVectors. func ConvertToLatticeCoordinates(cartesianPoint complex128, latticeVectors []complex128) compl...
entities/formula/common.go
0.808446
0.629775
common.go
starcoder
package pbytes import ( "bytes" "sync" ) type rangePool struct { max int pool *sync.Pool } // BytesPool exists to contain multiple RangePool that lies within giving distance range. // It creates a internal array of BytesPool which are distanced between each other by // provided distance. Whenever giving call to...
vendor/github.com/influx6/faux/pools/pbytes/bytes.go
0.743634
0.418162
bytes.go
starcoder
package sudoku import ( "errors" "fmt" "math/rand" "strconv" "strings" ) // Board holds the Sudoku type Board struct { Puzzle string // Holds the puzzle of the Sudoku Solution string // Holds the solution of the Sudoku Level Level // The difficulty level of the Sudoku Backtracking uint //...
sudoku.go
0.668231
0.542318
sudoku.go
starcoder
package kalman import ( "time" "github.com/rosshemsley/kalman/models" "gonum.org/v1/gonum/mat" ) type kalmanStateChange struct { // The transition used to advance the model from the previous // aPosteriori estimate to the current a Priori estimate. // x_{k|k-1} = F_k x_{k-1} modelTransition mat.Matrix // St...
smoother.go
0.739328
0.652075
smoother.go
starcoder
package main /** 输入一棵二叉树的根节点,求该树的深度。从根节点到叶节点依次经过的节点(含根、叶节点)形成树的一条路径,最长路径的长度为树的深度。 例如: 给定二叉树 [3,9,20,null,null,15,7], 3 / \ 9 20 / \ 15 7 返回它的最大深度3 。 提示: 节点总数 <= 10000 注意:本题与主站 104题相同:https://leetcode-cn.com/problems/maximum-depth-of-binary-tree/ */ type TreeNode struct { Val int Left *Tree...
lcof/maxDepth/maxDepth.go
0.734405
0.441793
maxDepth.go
starcoder
package dispatch import ( "errors" "strings" "github.com/influx6/faux/pattern" ) // ResolveSubscriber defines a function type for a Resolver subcriber. type ResolveSubscriber func(Path) // Resolvable defines an interface for a resolvable type object. type Resolvable interface { Resolve(Path) } // Resolver defi...
dispatch/resolvers.go
0.789396
0.402128
resolvers.go
starcoder
package main import ( "math" "time" ) // Speed Maps current scene speed type Speed struct { TimePrevious float64 TimeElapsed float64 Factor float64 Framerate float64 } // InstanceSpeed Stores current scene speed var InstanceSpeed = Speed{0.0, 0.0, 1.0, ConfigSpeedFramerateDefault} func (spe...
speed.go
0.849847
0.416797
speed.go
starcoder
// This file must be kept in sync with index_bound_checks.go. //+build !bounds package mat64 import "github.com/gonum/blas" func (m *Dense) At(r, c int) float64 { if r >= m.mat.Rows || r < 0 { panic(ErrRowAccess) } if c >= m.mat.Cols || c < 0 { panic(ErrColAccess) } return m.at(r, c) } func (m *Dense) at...
gocv/Godeps/_workspace/src/github.com/gonum/matrix/mat64/index_no_bound_checks.go
0.686265
0.465266
index_no_bound_checks.go
starcoder
package fstest import ( "errors" "io" "os" "sort" "strings" "testing" "github.com/spf13/afero" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" ) func TestFileClose(t *testing.T, undertest, expected FSTester) { f, err := expected.FS().Create("foo") require.NoError(t, err) assert...
internal/fstest/file.go
0.530966
0.607023
file.go
starcoder
package gosmt import ( "bytes" "crypto/rand" "math/big" "strconv" ) // Cache specifies a caching approach. type Cache interface { Exists(height uint64, base []byte) bool Get(height uint64, base []byte) []byte HashCache(left, right []byte, height uint64, base, split []byte, interiorHash func(left, right []byt...
cache.go
0.75401
0.403156
cache.go
starcoder
package erlpack type scratchpad struct { // The allocation for the scratchpad. alloc []byte // Defines how many raw bytes are used out of the allocation. used uint // Defines rules on how the array should be constructed. rules []constructionRules // The initial allocation for the scratchpad. initAlloc uint ...
scratchpad.go
0.661814
0.593138
scratchpad.go
starcoder
package dialog import ( "github.com/KalbiProject/Kalbi/interfaces" "github.com/KalbiProject/Kalbi/log" "sync" ) /* RFC3261 - https://tools.ietf.org/html/rfc3261#section-12 12 Dialogs A key concept for a user agent is that of a dialog. A dialog represents a peer-to-peer SIP relationship between two user a...
sip/dialog/dialog.go
0.588298
0.485966
dialog.go
starcoder
package driver import "context" // DatabaseCollections provides access to all collections in a single database. type DatabaseCollections interface { // Collection opens a connection to an existing collection within the database. // If no collection with given name exists, an NotFoundError is returned. Collection(...
vendor/github.com/arangodb/go-driver/database_collections.go
0.804291
0.452475
database_collections.go
starcoder
package iso20022 // Set of characteristics shared by all individual transactions included in the message. type GroupHeader38 struct { // Point to point reference, as assigned by the instructing party and sent to the next party in the chain, to unambiguously identify the message. // Usage: The instructing party has ...
GroupHeader38.go
0.797399
0.484624
GroupHeader38.go
starcoder
package rdbms import ( "database/sql" "errors" "fmt" rt "github.com/graniticio/granitic/v2/reflecttools" "github.com/graniticio/granitic/v2/types" "reflect" "strconv" ) // RowBinder is used to extract the data from the results of a SQL query and inject the data into a target data structure. type RowBinder str...
rdbms/rowbind.go
0.640411
0.550849
rowbind.go
starcoder
package collection import ( "encoding/json" "github.com/shopspring/decimal" ) type BaseCollection struct { value interface{} length int } func (c BaseCollection) Value() interface{} { return c.value } // Length return the length of the collection. func (c BaseCollection) Length() int { return c.length } // ...
base_collection.go
0.8575
0.538073
base_collection.go
starcoder
package smart_energy import "hemtjan.st/zcl" type CommandID = zcl.CommandID type Frame = zcl.ReceivedZclFrame const CurrentMaxDemandDeliveredAttr zcl.AttrID = 2 func (CurrentMaxDemandDelivered) ID() zcl.AttrID { return CurrentMaxDemandDeliveredAttr } func (CurrentMaxDemandDelivered) Readable() bool { return tru...
cluster/smart_energy/struct.go
0.697506
0.406332
struct.go
starcoder
package pcapng import ( "bytes" "encoding/hex" "fmt" "strings" "github.com/bearmini/pcapng-go/pcapng/blocktype" "github.com/bearmini/pcapng-go/pcapng/optioncode" "github.com/pkg/errors" ) /* 4.3. Enhanced Packet Block An Enhanced Packet Block (EPB) is the standard container for storing the packets com...
pcapng/enhanced_packet_block.go
0.733738
0.446314
enhanced_packet_block.go
starcoder
package time import ( "bytes" "time" ) // emptyString contains an empty JSON string value to be used as output var emptyString = `""` // Time is a convenience wrapper around stdlib time, but with different // marshalling and unmarshaling for zero values type Time struct { time.Time } // Now returns the current t...
vendor/helm.sh/helm/v3/pkg/time/time.go
0.84039
0.652767
time.go
starcoder
package main import ( "fmt" "math" ) /* Given an array of words and a width maxWidth, format the text such that each line has exactly maxWidth characters and is fully (left and right) justified. You should pack your words in a greedy approach; that is, pack as many words as you can in each line. Pad extra spaces '...
Sequence/TextJustification/main.go
0.631822
0.536799
main.go
starcoder
package redfish import ( "encoding/json" "github.com/stmcginnis/gofish/common" ) // ControllerCapabilities shall describe the capabilities of a controller. type ControllerCapabilities struct { // DataCenterBridging shall contain capability, status, // and configuration values related to Data Center Bridging (DC...
redfish/networkadapter.go
0.529507
0.429908
networkadapter.go
starcoder
package maths import ( "fmt" "github.com/accek/tegola" "github.com/accek/tegola/basic" "github.com/accek/tegola/maths" ) var ErrUnableToClean = fmt.Errorf("Unable to clean MultiPolygon.") // cleanPolygon will take a look at a polygon and attempt to clean it, returning one or more valid polygons, and an invalid ...
basic/maths/clean.go
0.605449
0.543348
clean.go
starcoder
package bbox import "math" func toRadians(deg float64) float64 { return deg * math.Pi / 180 } func toDegrees(rad float64) float64 { return rad * 180 / math.Pi } func normalizeMeridian(lon float64) float64 { return math.Mod(lon+3*math.Pi, 2*math.Pi) - math.Pi } func calcAngularRadius(radius float64) float64 { con...
bbox.go
0.903534
0.798501
bbox.go
starcoder
package query // The Mapper interface allows to replace nodes for each respective part of the // query grammar. It is a visitor that will replace the visited node by the // returned value. type Mapper interface { MapNodes(v Mapper, node []Node) []Node MapOperator(v Mapper, kind operatorKind, operands []Node) []Node ...
internal/search/query/mapper.go
0.88054
0.481881
mapper.go
starcoder
package trie // trieNode saves trie structure type trieNode struct { childMap map[rune]*trieNode isEnd bool } // Trie struct contains data and methods type Trie struct { root *trieNode wordCount int } // NewTrie creates new instance of trie func NewTrie() *Trie { return &Trie{ root: &trieNode{ chil...
Go/trie/trie.go
0.705481
0.578508
trie.go
starcoder
package avl import ( "bytes" "encoding/binary" "encoding/hex" "fmt" "io" "math" "github.com/minio/highwayhash" "github.com/pkg/errors" "github.com/valyala/bytebufferpool" ) var ( hashKey = make([]byte, 32) ) type nodeType byte const ( MerkleHashSize = 16 NodeNonLeaf nodeType = iota NodeLeafValue ) ...
avl/node.go
0.6488
0.403567
node.go
starcoder