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 lru import ( "errors" "math" "sort" "sync" "time" ) // LRU is a least recently used collection that supports element acces and // item eviction. The first access of an unevicted value implicitly adds the // value to the collection. type LRU interface { // Access stores the current time as the "last acc...
api/query/cache/lru/lru.go
0.602529
0.447883
lru.go
starcoder
package opengl // OpenGl describes an Open GL interface usable for all environments of this // application. It is the common subset of WebGL (= OpenGL ES 2) and an equivalent // API on the desktop. type OpenGl interface { ActiveTexture(texture uint32) AttachShader(program uint32, shader uint32) BindAttribLocation(...
src/github.com/inkyblackness/shocked-client/opengl/OpenGl.go
0.584745
0.415847
OpenGl.go
starcoder
package main import ( "github.com/ByteArena/box2d" "github.com/wdevore/RangerGo/api" "github.com/wdevore/RangerGo/engine/rendering" ) // TriangleComponent is a triangle physics object type TriangleComponent struct { visual api.INode b2Body *box2d.B2Body scale float64 } // NewTriangleComponent constructs a com...
examples/physics/intermediate/sensors/triangle_component.go
0.730674
0.683172
triangle_component.go
starcoder
package chart // LinearRegressionSeries is a series that plots the n-nearest neighbors // linear regression for the values. type LinearRegressionSeries struct { Name string Style Style YAxis YAxisType Window int Offset int InnerSeries ValueProvider m float64 b float64 avgx float64 ...
vendor/github.com/nicholasjackson/bench/vendor/github.com/wcharczuk/go-chart/linear_regression_series.go
0.912295
0.802672
linear_regression_series.go
starcoder
package ds import ( "github.com/ritesh99rakesh/go-ds-algorithms/algorithms/search" "github.com/ritesh99rakesh/go-ds-algorithms/algorithms/sort" ) // IntSlice is data structure of slice of int type IntSlice []int // Len ... func (p IntSlice) Len() int { return len(p) } // Swap ... func (p IntSlice) Swap(i, j int) ...
ds/slice.go
0.632389
0.477798
slice.go
starcoder
package md5digest import ( "crypto/md5" "encoding/base64" "encoding/binary" "encoding/hex" ) var emptyDigest [md5.Size]byte // MD5Digest contain MD5 message digest. type MD5Digest struct { digest [md5.Size]byte } // NewMD5DigestWithInt64s create new instance of MD5Digest and initialize with int64s. func NewMD5...
md5digest.go
0.71413
0.476945
md5digest.go
starcoder
package main // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file /* This file is part of gocal, a PDF calendar generator in Go. This is the FreeSansBold Truetype font, a free GPL font, downloaded from https://www.gnu.org/software/freefont/. See gnufreefont-License.t...
freesansbold.go
0.501221
0.597021
freesansbold.go
starcoder
package leetcode /* Given a string containing digits from 2-9 inclusive, return all possible letter combinations that the number could represent. A mapping of digit to letters (just like on the telephone buttons) is given below. Note that 1 does not map to any letters. Example: Input: "23" Output: ["ad", "ae", "af"...
go-impl/017-LetterCombinationsofaPhoneNumber.go
0.572842
0.580709
017-LetterCombinationsofaPhoneNumber.go
starcoder
package algorithms import ( "github.com/bionoren/mazes/grid" "github.com/faiface/pixel" "github.com/faiface/pixel/imdraw" "github.com/faiface/pixel/text" "golang.org/x/image/font/basicfont" "image/color" "math" "strconv" ) type Dijkstra struct { reference grid.Cell distances []int grid grid.Grid } fu...
algorithms/dijkstra.go
0.794345
0.4016
dijkstra.go
starcoder
package radix import ( "sort" ) // Leaf is used to represent a value type Leaf struct { Key Key Value interface{} } type sortLeafByPattern []Leaf func (l sortLeafByPattern) Len() int { return len(l) } func (l sortLeafByPattern) Less(i, j int) bool { return lessKey(l[i].Key, l[j].Key) } func (l sortLeafByPa...
x/radix/node.go
0.603815
0.431764
node.go
starcoder
package models import ( i336074805fc853987abe6f7fe3ad97a6a6f3077a16391fec744f671a015fbd7e "time" i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91 "github.com/microsoft/kiota-abstractions-go/serialization" ) // AccessPackageAssignmentRequest type AccessPackageAssignmentRequest struct { En...
models/access_package_assignment_request.go
0.695235
0.413892
access_package_assignment_request.go
starcoder
package endless import ( "errors" "sync" ) type ( // Endless is an Endless (ring) buffer Endless struct { sync.RWMutex data []byte writeCursor uint64 start uint64 } // Reader represents a Reader interface for an Endless buffer Reader struct { source *Endless pos uint64 } ) // New...
endless.go
0.61173
0.401013
endless.go
starcoder
package immutable import ( "bytes" "encoding/base64" "errors" "io" "unicode" ) type Bytes struct { p []byte } func NewBytes(p []byte, copy bool) Bytes { if copy { p = append([]byte(nil), p...) } return Bytes{p} } func BytesFromString(s string) Bytes { return NewBytes([]byte(s), false) } func (t Bytes) ...
bytes.go
0.693784
0.505737
bytes.go
starcoder
package ewkb import ( "encoding/binary" "io" "github.com/devork/geom" ) // wraps the byte order and reader into a single struct for easier mainpulation type decoder struct { order binary.ByteOrder reader io.Reader dim dimension gtype geomtype srid uint32 } func (d *decoder) read(data interface{}) err...
ewkb/decoder.go
0.669205
0.42179
decoder.go
starcoder
package bome import ( "fmt" "strings" ) type Expression interface { eval() string setDialect(string) } type BoolExpr interface { sql() string setDialect(string) } type dialectValue struct { dialect string } func (v *dialectValue) setDialect(dialect string) { v.dialect = dialect } type stringExpression str...
expressions.go
0.610686
0.464416
expressions.go
starcoder
package geom import ( "errors" "image" ) var errSingularMatrix = errors.New("matrix is singular") // IntMatrix3 implements a 3x3 integer matrix. type IntMatrix3 [3][3]int // Apply applies the matrix to a vector to obtain a transformed vector. func (a IntMatrix3) Apply(v Int3) Int3 { return Int3{ X: v.X*a[0][0]...
geom/matrix.go
0.838911
0.640523
matrix.go
starcoder
package reflectricity import ( "reflect" "unsafe" ) type arrayMergeStrategy int const ( CONCAT arrayMergeStrategy = iota REPLACE ) // Merges 2 structs, field by field replacing all existing // field in the right structure into the left. If left is nil // returns right. If the types don't match up, returns right...
merge.go
0.617743
0.409162
merge.go
starcoder
package mvt import "math" type Point struct { X, Y int } func (p Point) Add(that Point) Point { x := p.X + that.X y := p.Y + that.Y return Point{X: x, Y: y} } func (p Point) Subtract(that Point) Point { x := p.X - that.X y := p.Y - that.Y return Point{X: x, Y: y} } func (p Point) Increment(x, y int) Point {...
mbt/mvt/point.go
0.80784
0.609466
point.go
starcoder
package dilithium //The first block of constants define internal parameters. //SEEDBYTES holds the lenght in byte of the random number to give as input, if wanted. //The remaining constants are exported to allow for fixed-lenght array instantiation. For a given security level, the consts are the same as the output of ...
crystals-dilithium/params.go
0.655005
0.602149
params.go
starcoder
package actions import ( "expvar" "github.com/johnsiilver/boutique" ) const ( // ActNameSet indicates we are going to change the VarState.Name field. ActNameSet boutique.ActionType = iota // ActIntSet indicates we are going to change the VarState.Int to a specific number. ActIntSet // ActIntAdd indicates we a...
development/telemetry/streaming/river/state/actions/actions.go
0.680454
0.558989
actions.go
starcoder
package pipeline import ( "github.com/dolthub/dolt/go/libraries/doltcore/row" "github.com/dolthub/dolt/go/libraries/doltcore/rowconv" ) // ReadableMap is an interface that provides read only access to map properties type ReadableMap interface { // Get retrieves an element from the map, and a bool which says if th...
go/libraries/doltcore/table/pipeline/row.go
0.772959
0.432663
row.go
starcoder
package lzma // literalCodec supports the encoding of literal. It provides 768 probability // values per literal state. The upper 512 probabilities are used with the // context of a match bit. type literalCodec struct { probs []prob } // deepcopy initializes literal codec c as a deep copy of the source. func (c *li...
vendor/github.com/ulikunitz/xz/lzma/literalcodec.go
0.702326
0.465448
literalcodec.go
starcoder
package gol import ( "fmt" "uk.ac.bris.cs/gameoflife/util" ) // Event represents any Game of Life event that needs to be communicated to the user. type Event interface { // Stringer allows each event to be printed by the GUI fmt.Stringer // GetCompletedTurns should return the number of fully completed turns. //...
gol/event.go
0.502686
0.430207
event.go
starcoder
package parser import ( "github.com/lthibault/php-parser/pkg/ast" "github.com/lthibault/php-parser/pkg/lexer" "github.com/lthibault/php-parser/pkg/token" ) func (p *Parser) parseInstantiation() ast.Expression { p.expectCurrent(token.NewOperator) p.next() p.instantiation = true expr := &ast.NewExpression{} ex...
pkg/oop.go
0.532911
0.504944
oop.go
starcoder
package day17 import "github.com/nlowe/aoc2020/challenge" const ( stateActive = '#' stateInactive = '.' ) type coord struct { x int y int z int w int } type dimension struct { enableW bool tiles map[coord]rune minX int maxX int minY int maxY int minZ int maxZ int minW int maxW int } func pa...
challenge/day17/map.go
0.598312
0.400339
map.go
starcoder
package codec import ( "encoding/binary" "math" "github.com/juju/errors" ) const signMask uint64 = 0x8000000000000000 // EncodeIntToCmpUint make int v to comparable uint type func EncodeIntToCmpUint(v int64) uint64 { return uint64(v) ^ signMask } // DecodeCmpUintToInt decodes the u that encoded by EncodeIntTo...
util/codec/number.go
0.823896
0.50116
number.go
starcoder
package ofbx import ( "fmt" "math" "github.com/oakmound/oak/v2/alg/floatgeom" ) // UpVector specifies which canonical axis represents up in the system (typically Y or Z). type UpVector int // UpVector Options const ( UpVectorX UpVector = 1 UpVectorY UpVector = 2 UpVectorZ UpVector = 3 ) // FrontVector is a v...
math.go
0.783988
0.689671
math.go
starcoder
package iso20022 // Specifies amounts in the framework of a corporate action event. type CorporateActionAmounts38 struct { // Amount of money before any deductions and allowances have been made. GrossCashAmount *ActiveCurrencyAndAmount `xml:"GrssCshAmt,omitempty"` // Amount of money after deductions and allowance...
CorporateActionAmounts38.go
0.770896
0.522202
CorporateActionAmounts38.go
starcoder
package scene import ( "sort" ) // Manager is an interface for scene Manager objects that contain systems and // entities and helps coordinate how those interact. type Manager interface { // AddEntity should be called to register an entity with the scene Manager. // The Manager should also inform all Systems it k...
scene/manager.go
0.695338
0.423875
manager.go
starcoder
package models import ( i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91 "github.com/microsoft/kiota-abstractions-go/serialization" ) // DateTimeTimeZone type DateTimeTimeZone struct { // Stores additional data not described in the OpenAPI description found when deserializing. Can be used fo...
models/date_time_time_zone.go
0.856558
0.427456
date_time_time_zone.go
starcoder
package awsemfexporter import ( "bytes" "errors" "regexp" "sort" "strings" "go.opentelemetry.io/collector/consumer/pdata" "go.uber.org/zap" ) // MetricDeclaration characterizes a rule to be used to set dimensions for certain // incoming metrics, filtered by their metric names. type MetricDeclaration struct {...
exporter/awsemfexporter/metric_declaration.go
0.788217
0.549399
metric_declaration.go
starcoder
package combination // MergeEachPairOfElementsInMultisetByAddition0 generates all combinations // according to the following rule, and apply f to each of them: // 1. Select 2 elements from the multiset s // 2. Add the selected elements and produce a sum // 3. Remove the selected elements from the multiset s // 4. Add ...
combination/merge.go
0.652352
0.628208
merge.go
starcoder
package nightscout import ( "encoding/json" "io" "os" "sort" "time" ) // Implement sort.Interface for reverse chronological order. // If date fields are the same, compare type fields. func (e Entries) Len() int { return len(e) } func (e Entries) Swap(i, j int) { e[i], e[j] = e[j], e[i] } // After returns tr...
entries.go
0.651355
0.422326
entries.go
starcoder
package geojson import ( "encoding/json" "fmt" "github.com/pkg/errors" ) // TypePropFeature is the value of the "type" property for Features. const TypePropFeature = "Feature" // GeometryType is a supported geometry type. type GeometryType string // Types of geometry. const ( PointGeometryType Geomet...
feature.go
0.793786
0.458106
feature.go
starcoder
package geo import ( "fmt" "math" "strings" "github.com/polastre/gogeos/geos" ) type ( // LatLng represents a point in WGS84 coordinates LatLng struct { Lat float64 Lng float64 } // Circle Circle struct { Center LatLng Radius float64 // meters } // Region Region struct { Vertices Coordinates ...
geo.go
0.788013
0.446615
geo.go
starcoder
package ajson import ( "strconv" "sync/atomic" ) // IsDirty is the flag that shows, was node changed or not func (n *Node) IsDirty() bool { return n.dirty } // Set updates current node value with the value of any type func (n *Node) Set(value interface{}) error { if value == nil { return n.SetNull() } switch...
node_mutations.go
0.648355
0.483648
node_mutations.go
starcoder
package proof import ( "fmt" ) // SignatureSuite is a set of algorithms that specify how to sign and verify provable objects. // This model is based on the W3C Linked-Data Proofs, see https://w3c-ccg.github.io/ld-proofs. type SignatureSuite interface { Type() SignatureType Sign(provable Provable, signer Signer, op...
proof/signaturesuite.go
0.79736
0.415551
signaturesuite.go
starcoder
package control import ( "context" "github.com/goradd/goradd/pkg/log" "github.com/goradd/goradd/pkg/page" "reflect" ) type DataBinder interface { // A DataBinder must be a control so that we can serialize it ID() string // BindData is called by the data manager to get the data for the control during draw time ...
pkg/page/control/data_binder.go
0.625324
0.455441
data_binder.go
starcoder
// Package types contains most of the data structures available to/from Noms. package types import ( "github.com/attic-labs/noms/go/hash" ) // Type defines and describes Noms types, both built-in and user-defined. // Desc provides the composition of the type. It may contain only a types.NomsKind, in the case of // ...
go/types/type.go
0.802052
0.624437
type.go
starcoder
package Projector import ( "crypto/sha256" "fmt" ) // LinearConverter // This is used for pixel map to coordinates from a reprojected image. type LinearConverter struct { minLat float64 minLon float64 maxLat float64 maxLon float64 imgWidth int imgHeight int } // MakeLinearConverter Creates a new instance o...
ImageProcessor/Projector/LinearProjectionConverter.go
0.915233
0.637426
LinearProjectionConverter.go
starcoder
package stats import ( "fmt" "time" "github.com/blend/go-sdk/timeutil" ) // Assert that the mock collector implements Collector. var ( _ Collector = (*MockCollector)(nil) ) // NewMockCollector returns a new mock collector. func NewMockCollector() *MockCollector { return &MockCollector{ Events: make(chan Mock...
stats/mock_collector.go
0.858333
0.428114
mock_collector.go
starcoder
package layout import ( "image" "github.com/cybriq/giocore/op" ) // Stack is a series of widgets drawn over top of each other type Stack struct { *stack stackChildren []stackChild } // NewStack starts a chain of widgets to compose into a stack func NewStack() (out *Stack) { out = &Stack{stack: &stack{}} retu...
layout/stack.go
0.666062
0.416797
stack.go
starcoder
package client import ( "fmt" "net/url" "strings" ) // Values is a modified, Ponzu-specific version of the Go standard library's // url.Values, which implements most all of the same behavior. The exceptions are // that its `Add(k, v string)` method converts keys into the expected format for // Ponzu data containin...
values.go
0.808029
0.507873
values.go
starcoder
package timeago import ( "errors" "strconv" "time" ) // FormatNow takes previous time and return that time in words. func FormatNow(past time.Time) (string, error) { // If time is zero, return an error with a message. if past.IsZero() { return "", errors.New("no date has been set") } now := time.Now() msg, ...
timeago.go
0.599602
0.429071
timeago.go
starcoder
package stateful import ( "fmt" "regexp" "time" "github.com/influxdata/kapacitor/tick/ast" ) type EvalUnaryNode struct { operator ast.TokenType nodeEvaluator NodeEvaluator constReturnType ast.ValueType } func NewEvalUnaryNode(unaryNode *ast.UnaryNode) (*EvalUnaryNode, error) { if !isValidUnaryOpera...
tick/stateful/eval_unary_node.go
0.637595
0.456834
eval_unary_node.go
starcoder
package operations // OpType represents a Golos operation type, i.e. vote, comment, pow and so on. type OpType string // Code returns the operation code associated with the given operation type. func (kind OpType) Code() uint16 { return opCodes[kind] } const ( TypeVote OpType = "vote" ...
operations/optype.go
0.585694
0.432663
optype.go
starcoder
package meta import ( "errors" "github.com/tomchavakis/turf-go/geojson" "github.com/tomchavakis/turf-go/geojson/feature" "github.com/tomchavakis/turf-go/geojson/geometry" ) // CoordAll get all coordinates from any GeoJSON object. func CoordAll(t interface{}, excludeWrapCoord *bool) ([]geometry.Point, error) { s...
meta/coordAll/coordAll.go
0.728362
0.447823
coordAll.go
starcoder
package sharedtest import ( "reflect" "sync" "testing" "time" "gopkg.in/launchdarkly/go-sdk-common.v2/ldlog" "github.com/stretchr/testify/require" "go.opencensus.io/stats/view" "go.opencensus.io/trace" ) // TestMetricsExporter accumulates OpenCensus metrics for tests. It deaggregates the view data to make i...
internal/core/sharedtest/metrics.go
0.593256
0.529689
metrics.go
starcoder
package main import ( "fmt" "os" "regexp" "strconv" "strings" "time" "github.com/bwmarrin/discordgo" ) func extendsHandler(s *discordgo.Session, m *discordgo.MessageCreate) { m.Content = strings.ToLower(m.Content) var isRythmChan bool var rythmChanID string for _, guild := range s.State.Guilds { // ...
src/extends.go
0.528533
0.426023
extends.go
starcoder
package im8 import ( "image" "image/color" "github.com/superloach/im8/col8" ) // Im8 is an in-memory image whose At method returns col8.Col8 values. type Im8 struct { // Pix holds the image's pixels. The pixel at (x, y) is at Pix[(y-Rect.Min.Y)*Stride + (x-Rect.Min.X)]. Pix []uint8 // Stride is the Pix stride...
im8.go
0.879121
0.483709
im8.go
starcoder
package predictor import ( "fmt" "log" "time" "gopkg.in/cheggaaa/pb.v1" G "gorgonia.org/gorgonia" "gorgonia.org/tensor" ) // NeuroNet represent predictor neuro net model type NeuroNet interface { Save(string) error Predict(tensor.Tensor) (solution *G.Node, err error) FromBackup(string) error Graph() *G.Ex...
predictor/shared.go
0.619356
0.417153
shared.go
starcoder
package search // ExportResultsQueryParams represents valid query parameters for the ExportResults operation // For convenience ExportResultsQueryParams can be formed in a single statement, for example: // `v := ExportResultsQueryParams{}.SetCount(...).SetFilename(...).SetOutputMode(...)` type ExportResultsQueryPa...
services/search/param_generated.go
0.941385
0.563678
param_generated.go
starcoder
package executor import ( "github.com/RoaringBitmap/roaring" "github.com/rs/zerolog" "github.com/rs/zerolog/log" ) // NewBinaryBitmapOperator creates a new bitmap binary operator. func NewBinaryBitmapOperator(ctx Context, op BinaryOperation, left BitmapOperator, right BitmapOperator) *BinaryBitmapOperator { retu...
internal/executor/bin_bitmap_operator.go
0.68763
0.563738
bin_bitmap_operator.go
starcoder
package main import "fmt" // Go requires explicit returns func plus(a int, b int) int { return a + b } // When you have multiple consecutive parameters of the same type, // you might omit the type name for the like-typed parameters up to // the final parameter that declares the type. func plusPlus(a, b, c int) int ...
functions/functions.go
0.775265
0.405772
functions.go
starcoder
package physics import ( "fmt" "math" ) type Entity struct { Mass float64 Position *Point Velocity *Vector2D Acceleration *Vector2D } // Made up gravity so reactions on the seconds scale at small range are fun to watch const G float64 = 6.67834E2 // NewEntity returns a new Entity struct from t...
physics/entities.go
0.901941
0.768863
entities.go
starcoder
package service import ( "reflect" "strconv" "strings" ) // Mask is a func given a struct it will mask everything with "[REDACTED]" if there are mask struct tags added func Mask(obj interface{}) interface{} { // Wrap the original in a reflect.Value original := reflect.ValueOf(obj) copy := reflect.New(original....
client/service/mask_utils.go
0.66628
0.439988
mask_utils.go
starcoder
package binaryTree func preorderTraversal(root *TreeNode) []int { if root == nil { return nil } stack := make([]*TreeNode, 0) result := make([]int, 0) for root != nil || len(stack) != 0 { for root != nil { result = append(result, root.Val) stack = append(stack, root) root = root.Left } node :=...
v1/binaryTree/preOrder.go
0.607081
0.487795
preOrder.go
starcoder
package object import ( "fmt" "github.com/simp7/times" "time" ) type standard struct { second, minute, hour int8 day int } //Standard is function that returns the struct that implements times.Object. //Minimum unit of Standard is second. func Standard(second, minute, hour, day int) times.Object...
object/standard.go
0.79653
0.486697
standard.go
starcoder
package utils import ( "fmt" "regexp" ) func IsIP(str string) bool { regular := `((2[0-4]\d|25[0-5]|[01]?\d\d?)\.){3}(2[0-4]\d|25[0-5]|[01]?\d\d?)` return regexp.MustCompile(regular).MatchString(str) } func IsEmail(str string) bool { regular := `^[_a-zA-Z0-9-]+(\.[_a-zA-Z0-9-]+)*@[a-zA-Z0-9-]+(\.[a-zA-Z0-9-]+)*...
utils/regutil.go
0.541409
0.453141
regutil.go
starcoder
package models import ( i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91 "github.com/microsoft/kiota-abstractions-go/serialization" ) // ApprovalStage type ApprovalStage struct { // Stores additional data not described in the OpenAPI description found when deserializing. Can be used for seri...
models/approval_stage.go
0.574156
0.406685
approval_stage.go
starcoder
// Convert natively non-D50 RGB colorspaces with D50 illuminator to CIE XYZ and back. // Bradford adaptation was used to calculate D50 matrices from colorspaces' native illuminators. // RGB values must be linear and in the nominal range [0.0, 1.0]. // Ref.: [24][30][31] package rgb // AdobeToXYZ_D50 converts from...
f64/rgb/rgb_d50.go
0.868562
0.60743
rgb_d50.go
starcoder
package main import ( "fmt" "io/ioutil" "strings" ) // Card represents a single playing card type Card struct { face int suit rune } // Hand represents a hand of cards type Hand [5]Card var ( intToFace = map[int]string{2: "2", 3: "3", 4: "4", 5: "5", 6: "6", 7: "7", 8: "8", 9: "9", 10: "T", 11: "J", 12: "Q", ...
golang/054/054.go
0.710528
0.414129
054.go
starcoder
package dpt import ( "fmt" ) // A DatapointValue is a value of a datapoint. type DatapointValue interface { // Pack the datapoint to a byte array. Pack() []byte // Unpack a the datapoint value from a byte array. Unpack(data []byte) error } // DatapointMeta gives meta information about a datapoint type. type D...
knx/dpt/types.go
0.779406
0.446133
types.go
starcoder
package flojson // Bool is a helper routine that allocates a new bool value to store v and // returns a pointer to it. This is useful when assigning optional parameters. func Bool(v bool) *bool { p := new(bool) *p = v return p } // Int is a helper routine that allocates a new int value to store v and // returns ...
flojson/helpers.go
0.848282
0.472075
helpers.go
starcoder
package staticcheck import "honnef.co/go/tools/analysis/lint" var Docs = lint.Markdownify(map[string]*lint.RawDocumentation{ "SA1000": { Title: `Invalid regular expression`, Since: "2017.1", Severity: lint.SeverityError, MergeIf: lint.MergeIfAny, }, "SA1001": { Title: `Invalid template`, Sin...
staticcheck/doc.go
0.66072
0.434521
doc.go
starcoder
// Package spatial implements geo spatial types and functions. package spatial import ( "math" "reflect" "strings" ) // NaN returns a 'not-a-number' value. func NaN() float64 { return math.NaN() } // Geometry is the interface representing a spatial type. type Geometry interface { geotype() } // Geometry2d is t...
driver/spatial/spatial.go
0.878686
0.794106
spatial.go
starcoder
package common import ( "fmt" "math" "github.com/m3db/m3/src/query/graphite/ts" "github.com/m3db/m3/src/x/errors" ) const ( // FloatingPointFormat is the floating point format for naming FloatingPointFormat = "%.3f" ) // ErrInvalidPercentile is used when the percentile specified is incorrect func ErrInvalidP...
src/query/graphite/common/percentiles.go
0.769167
0.492615
percentiles.go
starcoder
package pdf417 import ( "fmt" "github.com/ggiox/go-barcode/pkg/barcode" "github.com/ggiox/go-barcode/pkg/barcode/utils" ) const ( padding_codeword = 900 ) // Encodes the given data as PDF417 barcode. // securityLevel should be between 0 and 8. The higher the number, the more // additional error-correction codes...
pkg/barcode/pdf417/encoder.go
0.655667
0.415966
encoder.go
starcoder
package grid import "github.com/google/gapid/test/robot/web/client/dom" // Icons holds the characters to use to draw the icons using the icons font. type Icons struct { Succeeded rune Failed rune Unknown rune } // Style holds parameters to style the grid. type Style struct { GridPadding ...
test/robot/web/client/widgets/grid/style.go
0.567697
0.437403
style.go
starcoder
package shamir import ( cr "crypto/rand" "crypto/subtle" ) // Represents a polynomial of arbitrary degree. type polynomial struct { coefficients []uint8 } // Returns the value of the polynomial for the given x. func (p *polynomial) evaluate(x uint8) uint8 { // Special case the origin if x == 0 { return p.coef...
crypto/shamir/polynomial.go
0.845465
0.604107
polynomial.go
starcoder
package analyzer // Type represents SQL types. type Type interface { String() string EqualTo(t Type) bool CastTo(t Type) bool CoerceTo(t Type) bool } // SimpleType is types except for ARRAY and STRUCT. type SimpleType string const ( Int64Type SimpleType = "INT64" Float64Type SimpleType = "FLOAT64" BoolT...
pkg/analyzer/type.go
0.683842
0.499207
type.go
starcoder
package singlestat import ( "strings" "github.com/K-Phoen/grabana/target/prometheus" "github.com/K-Phoen/grabana/target/stackdriver" "github.com/grafana-tools/sdk" ) // Option represents an option that can be used to configure a single stat panel. type Option func(stat *SingleStat) // StatType let you set the f...
vendor/github.com/K-Phoen/grabana/singlestat/singlestat.go
0.811377
0.4881
singlestat.go
starcoder
package e2e import ( "bytes" "encoding/json" "fmt" "math" "time" "k8s.io/kubernetes/test/e2e/perftype" ) ///// PodLatencyData encapsulates pod startup latency information. type PodLatencyData struct { ///// Name of the pod Name string ///// Node this pod was running on Node string ///// Latency informatio...
test/e2e/metric_util.go
0.517327
0.436682
metric_util.go
starcoder
package jsoni import ( "context" "fmt" "strconv" ) type stringAny struct { baseAny val string } func (a *stringAny) Get(path ...interface{}) Any { if len(path) == 0 { return a } return &invalidAny{baseAny{}, fmt.Errorf("GetIndex %v from simple value", path)} } func (a *stringAny) Parse() *Iterator { r...
pkg/jsoni/any_str.go
0.510008
0.414366
any_str.go
starcoder
package util import "time" func IsSameMonth(time1 int64, time2 int64) bool { t1 := time.Unix(time1, 0) t2 := time.Unix(time2, 0) if t1.Year() != t2.Year() { return false } if t1.Month() != t2.Month() { return false } return true } func GetLastTimeByMonth(year int, month int, currentLocation *time.Locatio...
util/util_time.go
0.572723
0.53279
util_time.go
starcoder
package fsm // ID is the id of the instance in a given set. It's unique in that set. type ID uint64 // FSM is the interface that returns ID and state of the fsm instance safely. type FSM interface { // ID returns the ID of the instance ID() ID // State returns the state of the instance. This is an expensive cal...
pkg/fsm/types.go
0.696784
0.644547
types.go
starcoder
package tmpoptestcases import ( "bytes" "testing" "github.com/golang/mock/gomock" "github.com/stratumn/go-chainscript" "github.com/stratumn/go-chainscript/chainscripttest" "github.com/stratumn/go-core/store" "github.com/stratumn/go-core/tmpop" "github.com/stratumn/go-core/tmpop/tmpoptestcases/mocks" "github...
tmpop/tmpoptestcases/transaction.go
0.532425
0.469277
transaction.go
starcoder
package karytree const ( left = iota right = iota ) // Binary creates a binary karytree.Node func Binary(key interface{}) Node { return NewNode(key) } // SetLeft sets the left child. func (k *Node) SetLeft(other *Node) { k.SetNthChild(left, other) } // SetRight sets the left child. func (k *Node) SetRight(othe...
binary-tree.go
0.790854
0.516961
binary-tree.go
starcoder
package hashmultisets import "sort" // New factory that creates a new Hash Multi Set func New(values ...string) *HashMultiSet { set := HashMultiSet{data: make(map[string]int)} set.Add(values...) return &set } // MultiSetPair a set's key/count pair type MultiSetPair struct { Key string Count int } // HashMult...
datastructures/sets/hashmultisets/hash_multi_set.go
0.804943
0.475057
hash_multi_set.go
starcoder
package validator import ( "fmt" "math/big" "github.com/klyed/hivesmartchain/crypto" "github.com/tendermint/tendermint/types" ) // Safety margin determined by Tendermint (see comment on source constant) var maxTotalPower = big.NewInt(types.MaxTotalVotingPower) var minTotalPower = big.NewInt(4) type Bucket struc...
acm/validator/bucket.go
0.669205
0.420719
bucket.go
starcoder
package sql import ( "github.com/benthosdev/benthos/v4/public/bloblang" "github.com/benthosdev/benthos/v4/public/service" ) // DeprecatedProcessorConfig returns a config spec for an sql processor. func DeprecatedProcessorConfig() *service.ConfigSpec { return service.NewConfigSpec(). Deprecated(). Categories("I...
internal/impl/sql/processor_sql_deprecated.go
0.623721
0.423696
processor_sql_deprecated.go
starcoder
package computer func PowerConsumption(reports []int, bitRate int) int { reportLength := len(reports) analysis := reportAnalysis(reports, bitRate) gamma := powerGammaRate(analysis, reportLength) epsilon := powerEpsilonRate(analysis, reportLength) return gamma * epsilon } func LifeSupportRating(reports []int, bit...
pkg/submarine/computer/diagnostic.go
0.669961
0.426501
diagnostic.go
starcoder
package main import ( "fmt" "math" "math/rand" "time" ) func lnfnc(x [16]float64, a float64, b float64) [16]float64 { /* Basic linear equation function */ var y0 [16]float64 for i := 0; i < len(x); i++ { y0[i] = a * float64(x[i]) + b } return y0 } func chis...
mcmc.go
0.700383
0.469459
mcmc.go
starcoder
package main import ( "flag" "fmt" "math" "os" "strconv" "strings" "github.com/ajstarks/svgo" ) var ( outer = flag.String("outer", "#e74c3c", "Outer color") inner = flag.String("inner", "#2980b9", "Inner color") ) func f64s(val float64) string { return strconv.FormatFloat(val, 'f', -1, 64) } func polarTo...
misc/scripts/logo/logo.go
0.696991
0.459501
logo.go
starcoder
package anonbcast import ( "github.com/google/uuid" ) type OpType string const ( JoinOpType OpType = "join" StartOpType OpType = "start" MessageOpType OpType = "message" EncryptedOpType OpType = "encrypted" ScrambledOpType OpType = "scrambled" DecryptedOpType OpType = "decrypted" RevealOpType O...
anonbcast/op.go
0.638497
0.422386
op.go
starcoder
package dilation import ( "fmt" "github.com/acra5y/go-dilation/internal/eye" "github.com/acra5y/go-dilation/internal/positiveDefinite" "gonum.org/v1/gonum/mat" ) type isPositiveDefinite func(positiveDefinite.EigenComputer, *mat.Dense) (bool, error) type squareRoot func(*mat.Dense) (*mat.Dense, error)...
internal/dilation/dilation.go
0.746231
0.560914
dilation.go
starcoder
package latlong import ( "bytes" "encoding/json" "fmt" "github.com/golang/geo/s2" ) // Geometry is interface for each geometry class @ GeoJSON. type Geometry interface { Equal(Geometry) bool S2Region() s2.Region S2Point() s2.Point Radiusp() *float64 Type() string String() string } // GeoJSONGeometry is Ge...
GeoJSONGeometry.go
0.741861
0.406273
GeoJSONGeometry.go
starcoder
package main import ( "bufio" "os" "fmt" "strings" "strconv" ) /* set X Y sets register X to the value of Y. sub X Y decreases register X by the value of Y. mul X Y sets register X to the result of multiplying the value contained in register X by the value of Y. jnz X Y jumps with an offset of the value of Y, but...
day23/day23.go
0.515864
0.402363
day23.go
starcoder
package tuple import ( "fmt" "golang.org/x/exp/constraints" ) // T3 is a tuple type holding 3 generic values. type T3[Ty1, Ty2, Ty3 any] struct { V1 Ty1 V2 Ty2 V3 Ty3 } // Len returns the number of values held by the tuple. func (t T3[Ty1, Ty2, Ty3]) Len() int { return 3 } // Values returns the values held by...
tuple3.go
0.811601
0.543833
tuple3.go
starcoder
package qrcode type QRType = qrtype // qrtype type qrtype uint8 const ( // QRType_INIT represents the initial block state of the matrix QRType_INIT qrtype = 1 << 1 // QRType_DATA represents the data block state of the matrix QRType_DATA qrtype = 2 << 1 // QRType_VERSION indicates the version block of matrix QR...
matrix_type.go
0.727685
0.672873
matrix_type.go
starcoder
package doc import ( "fmt" "regexp" "text/template" "time" ) var ( nlToSpaces = regexp.MustCompile(`\n`) funcs = template.FuncMap{ "inline": func(txt string) string { if len(txt) == 0 { return txt } return fmt.Sprintf("`%s`", txt) }, "codeBlock": func(code string) string { return fmt.Spri...
docs/template.go
0.519521
0.566798
template.go
starcoder
package rabin import ( "crypto/sha256" "math/big" ) const PUBKEY_BITS = 3072 type Rabin struct { P *big.Int Q *big.Int N *big.Int ONE *big.Int TWO *big.Int FOUR *big.Int Qplus1over4 *big.Int Pplus1over4 *big.Int Qsub2 *big.Int Psub2 *big.Int PQ *big.Int QP *big.Int PubKey []byte } func (r *Ra...
lib/rabin/rabin.go
0.557604
0.485173
rabin.go
starcoder
package iso20022 // Tax related to an investment fund order. type Tax32 struct { // Type of tax applied. Type *TaxType3Choice `xml:"Tp"` // Amount of money resulting from the calculation of the tax. This amount is provided for information only. InformativeAmount *ActiveCurrencyAndAmount `xml:"InftvAmt,omitempty"...
Tax32.go
0.787237
0.429669
Tax32.go
starcoder
package plausible // Filter represents an API query filter over properties of the stats data. // The filter is a logic AND over all its properties and values. // Filters are used when making a request to the API to narrow the information returned. type Filter struct { // Properties to filter by Properties Properties...
plausible/filters.go
0.896775
0.493287
filters.go
starcoder
package qrcode type symbol struct { // Value of module at [y][x]. True is set. module [][]bool // True if the module at [y][x] is used (to either true or false). // Used to identify unused modules. isUsed [][]bool // Combined width/height of the symbol and quiet zones. size int // Width/height of the symbol...
symbol.go
0.633637
0.439928
symbol.go
starcoder
package cml import ( "errors" "math" "github.com/dgryski/go-farm" ) /* Sketch is a Count-Min-Log Sketch 16-bit registers */ type Sketch struct { w uint d uint exp float64 store [][]uint16 } /* NewSketch returns a new Count-Min-Log Sketch with 16-bit registers */ func NewSketch(w uint, d uint, exp float6...
log.go
0.73307
0.421969
log.go
starcoder
package mathutil import ( "errors" "sort" ) // SliceFloat64 represets a slice of integers and provides functions on that slice. type SliceFloat64 struct { Elements []float64 Stats SliceFloat64Stats } // NewSliceFloat64 creates and returns an empty SliceFloat64 struct. func NewSliceFloat64() SliceFloat64 { sf...
math/mathutil/slicefloat64.go
0.865352
0.624666
slicefloat64.go
starcoder
package webp import ( "image" "image/color" "reflect" ) var ( _ image.Image = (*RGBImage)(nil) _ MemP = (*RGBImage)(nil) ) type RGBImage struct { XPix []uint8 XStride int XRect image.Rectangle } func (p *RGBImage) MemPMagic() string { return MemPMagic } func (p *RGBImage) Bounds() image.Recta...
rgb.go
0.7773
0.408513
rgb.go
starcoder
package menge import ( "fmt" "math" "strings" ) // Float32Set represents a set of float32 elements. type Float32Set map[float32]struct{} // Add adds zero or more elements to the set. // Ignores NaN values. func (s Float32Set) Add(elems ...float32) { for _, e := range elems { if !math.IsNaN(float64(e)) { s[e...
float32.go
0.783243
0.497925
float32.go
starcoder
package plaid import ( "encoding/json" ) // MortgageLiability Contains details about a mortgage account. type MortgageLiability struct { // The ID of the account that this liability belongs to. AccountId string `json:"account_id"` // The account number of the loan. AccountNumber string `json:"account_number"` ...
plaid/model_mortgage_liability.go
0.749821
0.483648
model_mortgage_liability.go
starcoder