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 xtime import ( "fmt" "strconv" "strings" "time" ) // The xtime package contains types and functions that provide supplementary functionality to the // built in standard library 'time' package. It also provides some additional time-related // functionality and types that help things like output. // Durati...
pkg/xtime/xtime.go
0.666822
0.505981
xtime.go
starcoder
package ws281x import ( "bytes" ) // FBU can be used to implement a frame buffer for UART based WS281x driver. FBU // encoding uses one byte of memory to encode three WS281x bits (8 bytes/pixel). type FBU struct { data []byte } // MakeFBU allocates memory for string of n pixels. func MakeFBU(n int) FBU { return F...
egpath/src/ws281x/fbu.go
0.68637
0.502869
fbu.go
starcoder
package json import ( "fmt" "io" "strconv" . "gx/ipfs/QmdBzoMxsBpojBfN1cv5GnKtB7sfYBMoLH7p9qSyEVYXcu/refmt/tok" ) func NewEncoder(wr io.Writer, cfg EncodeOptions) *Encoder { return &Encoder{ wr: wr, cfg: cfg, stack: make([]phase, 0, 10), } } func (d *Encoder) Reset() { d.stack = d.stack[0:0] d.cu...
vendor/gx/ipfs/QmdBzoMxsBpojBfN1cv5GnKtB7sfYBMoLH7p9qSyEVYXcu/refmt/json/jsonEncoder.go
0.500488
0.442335
jsonEncoder.go
starcoder
package imagick /* #include <wand/MagickWand.h> */ import "C" import ( "runtime" "sync" "sync/atomic" "unsafe" ) type PixelWand struct { pw *C.PixelWand init sync.Once } // Returns a new pixel wand func newPixelWand(cpw *C.PixelWand) *PixelWand { pw := &PixelWand{pw: cpw} runtime.SetFinalizer(pw, Destroy...
imagick/pixel_wand.go
0.813609
0.518424
pixel_wand.go
starcoder
package script import ( "time" "github.com/transmutate-io/atomicswap/cryptos" ) // Engine represents a scripting engine type Engine struct { b []byte Generator Generator } // NewEngine returns a scripting engine for the given crypto func NewEngine(c *cryptos.Crypto) (*Engine, error) { gen, ok := genera...
script/engine.go
0.816772
0.424531
engine.go
starcoder
package ahrsweb const Port = 8000 type AHRSData struct { // Kalman state variables U1, U2, U3 float64 // Vector for airspeed, aircraft frame, kt Z1, Z2, Z3 float64 // Vector for rate of change of airspeed, aircraft frame, G E0, E1, E2, E3 float64 // Quaternion rotating earth frame to aircraft frame H1, H...
ahrsweb/ahrs_data.go
0.581065
0.671721
ahrs_data.go
starcoder
package process import ( "fmt" "reflect" ) // Code from Go STL - template/funcs.go var ( errorType = reflect.TypeOf((*error)(nil)).Elem() ) // goodFunc checks that the function or method has the right result signature. func goodFunc(typ reflect.Type) bool { // We allow functions with 1 result or 2 results...
src/process/func_utils.go
0.581065
0.426859
func_utils.go
starcoder
package mathexp import ( "fmt" "sort" "time" "github.com/grafana/gel-app/pkg/mathexp/parse" "github.com/grafana/grafana-plugin-sdk-go/data" ) // Series has time.Time and ...? *float64 fields. type Series struct { Frame *data.Frame TimeIsNullable bool TimeIdx int ValueIsNullabe bool ValueIdx...
pkg/mathexp/type_series.go
0.558809
0.509093
type_series.go
starcoder
// CMAC message authentication code, defined in // NIST Special Publication SP 800-38B. package cmac import ( "crypto/cipher" "hash" "github.com/miscreant/miscreant/go/block" ) type cmac struct { // c is the block cipher we're using (i.e. AES-128 or AES-256) c cipher.Block // k1 and k2 are CMAC subkeys (for...
vendor/github.com/miscreant/miscreant/go/cmac/cmac.go
0.687945
0.443781
cmac.go
starcoder
package clock // Forked from github.com/andres-erbsen/clock to isolate a missing nap. import ( "container/heap" "sync" "time" ) // Mock represents a mock clock that only moves forward programmically. // It can be preferable to a real-time clock when testing time-based functionality. type Mock struct { sync.Mute...
clock/clock.go
0.831143
0.446314
clock.go
starcoder
package block import ( "github.com/df-mc/dragonfly/server/block/cube" "github.com/df-mc/dragonfly/server/item" "github.com/df-mc/dragonfly/server/world" "github.com/go-gl/mathgl/mgl64" "math/rand" ) // Kelp is an underwater block which can grow on top of solids underwater. type Kelp struct { empty transparent ...
server/block/kelp.go
0.631822
0.457016
kelp.go
starcoder
package main var cmdUsage = map[string]string{ "docs-commands-facts": `Discover and list facts on this system.`, "docs-commands-help": `The "help" shows a list of commands or help for one command.`, "docs-commands": `Arc is controlled via a very easy to use command-line interface (CLI).`, "docs-...
descriptions.go
0.54819
0.46223
descriptions.go
starcoder
// Package boxtree provides a very fast, static, flat (augmented) 2D interval Tree for reverse 2D range searches (box overlap). package boxtree import ( "math" "math/rand" ) // Box is the main interface expected by NewBOXTree(); requires Limits method to access box limits. type Box interface { Limits() (Lower, Up...
boxtree.go
0.666497
0.511595
boxtree.go
starcoder
package schedule import ( "fmt" "github.com/marcsantiago/gocron" "strings" "time" ) // Definition holds the data defining a schedule definition type Definition struct { // Internal value (every 1 minute would be expressed with an interval of 1). Must be set explicitly or implicitly (a weekday value implicitly se...
schedule/schedule.go
0.69987
0.425784
schedule.go
starcoder
package size import ( "fmt" "math" "math/rand" "regexp" "strconv" "strings" ) // Size is a signed type to avoid overflow problems when doing arithmetic and // conversions to other signed types. type Size int64 const MaxSize = math.MaxInt64 const ( Bytes Size = 1 << (10 * iota) KiB MiB GiB TiB PiB EiB ...
pkg/size/size.go
0.655667
0.454896
size.go
starcoder
//nolint package p0641 type MyCircularDeque struct { values []int start int end int size int } /** Initialize your data structure here. Set the size of the deque to be k. */ func Constructor(k int) MyCircularDeque { return MyCircularDeque{ values: make([]int, k), start: 0, end: 0, size: 0, ...
pkg/p0641/p0641.go
0.605449
0.645846
p0641.go
starcoder
package geom func min(x, y int) int { if x < y { return x } return y } func max(x, y int) int { if x > y { return x } return y } type Coord struct { X, Y int } type Rectangle struct { Min, Max Coord } func Add(lhs, rhs Coord) Coord { return Coord{lhs.X + rhs.X, lhs.Y + rhs.Y} } func (c *Coord) Add(rh...
geom/geom.go
0.877818
0.520009
geom.go
starcoder
package loader import ( "fmt" "strconv" "strings" "github.com/pingcap/log" "go.uber.org/zap" ) // DMLType represents the dml type type DMLType int // DMLType types const ( UnknownDMLType DMLType = 0 InsertDMLType DMLType = 1 UpdateDMLType DMLType = 2 DeleteDMLType DMLType = 3 ) // DML holds the dml in...
pkg/loader/model.go
0.588653
0.462352
model.go
starcoder
package xmetricstest import ( "github.com/Comcast/webpa-common/xmetrics" "github.com/go-kit/kit/metrics" ) // testingT is the expected behavior for a testing object. *testing.T implements this interface. type testingT interface { Errorf(string, ...interface{}) } // expectation is a metric expectation. The metri...
xmetrics/xmetricstest/expectations.go
0.870694
0.57087
expectations.go
starcoder
package types import "github.com/genjidb/genji/internal/errors" // A Value stores encoded data alongside its type. type value struct { tp ValueType v interface{} } var _ Value = &value{} // NewNullValue returns a Null value. func NewNullValue() Value { return &value{ tp: NullValue, } } // NewBoolValue encod...
types/value.go
0.782288
0.538255
value.go
starcoder
package distuv import ( "math" "golang.org/x/exp/rand" ) // AlphaStable represents an α-stable distribution with four parameters. // See https://en.wikipedia.org/wiki/Stable_distribution for more information. type AlphaStable struct { // Alpha is the stability parameter. // It is valid within the range 0 < α ≤ ...
stat/distuv/alphastable.go
0.905283
0.566978
alphastable.go
starcoder
package graphite import ( "errors" "github.com/ovh/erlenmeyer/core" ) // ---------------------------------------------------------------------------- // graphite functions implementations func absolute(node *core.Node, args []string, kwargs map[string]string) (*core.Node, error) { if len(args) < 1 { return nil...
proto/graphite/math.go
0.719876
0.406391
math.go
starcoder
package cards import ("math/rand"; "time") // Card is a struct holding the suit and value associated with a card. type Card struct { Suit string Value string } // NewCard creates a new instance of the card struct. func NewCard(suit, value string) Card { return Card{Suit: suit, Value: value} } // NewDeck crea...
cards.go
0.749546
0.470858
cards.go
starcoder
package converter import ( "math" ) var ( Float64 Float64Converter ) type Float64Converter float64 func (c Float64Converter) SampleSize() int { return 8 } func (c Float64Converter) ToFloat32(input []byte, output []float32) { for i, o, ln := 0, 0, len(input); i < ln; i += c.SampleSize() { ou...
converter/float64.go
0.518302
0.411466
float64.go
starcoder
package iso20022 // Tax related to an investment fund order. type Tax16 struct { // Type of tax applied. Type *TaxType10Code `xml:"Tp"` // Type of tax applied. ExtendedType *Extended350Code `xml:"XtndedTp"` // Amount of money resulting from the calculation of the tax. Amount *ActiveCurrencyAnd13DecimalAmount ...
Tax16.go
0.781664
0.41182
Tax16.go
starcoder
package v1 func (VirtualMachine) SwaggerDoc() map[string]string { return map[string]string{ "": "VirtualMachine is *the* VM Definition. It represents a virtual machine in the runtime environment of kubernetes.", "spec": "VM Spec contains the VM specification.", "status": "Status is the high level overv...
pkg/api/v1/types_swagger_generated.go
0.838448
0.434941
types_swagger_generated.go
starcoder
package ast import ( "strconv" "strings" "time" "github.com/jacobsimpson/jt/datetime" "github.com/shopspring/decimal" ) func lt(environment *Environment, left, right Expression) bool { left = resolveVar(environment, left) right = resolveVar(environment, right) switch l := left.(type) { case *AnyValue: sw...
ast/comparison_functions.go
0.593845
0.589894
comparison_functions.go
starcoder
package itertools //ProductIterator iterates over {0, ..., n[0] - 1} x {0, ..., n[1] - 1} x ... x {0, ..., n[len(n) - 1] - 1}. //It should be initliased using Product. type ProductIterator struct { state []int n []int empty bool } //Product returns a *ProductIterator to iterate over {0, ..., n[0] - 1} x {0, .....
itertools/product.go
0.574156
0.442697
product.go
starcoder
package skiplist import ( "math" "sync" "sync/atomic" "unsafe" ) /* * Algorithm: * Access barrier is used to facilitize safe remory reclaimation in the lockfree * skiplist. Every skiplist access needs to be passed through a gate which tracks * the safety premitives to figure out when is the right time to dealloca...
secondary/memdb/skiplist/access_barrier.go
0.519521
0.520435
access_barrier.go
starcoder
package vile import ( "math" "math/rand" "strconv" ) /* // TEST type Test struct { Value float64 } func Integer(i int) *Test { return &Test{Value: float64(i)} } */ // Zero is the Vile 0 value var Zero = Number(0) // One is the Vile 1 value var One = Number(1) // MinusOne is the Vile -1 value var MinusOne = N...
src/number.go
0.68595
0.457924
number.go
starcoder
package comparator import ( "fmt" "reflect" "strconv" "strings" "github.com/pkg/errors" ) // CompareInt compares integer numbers for specific operation // it check for the >=, >, <=, <, ==, != operators func (model Model) CompareInt() error { obj := Integer{} obj.setValues(reflect.ValueOf(model.a).String(), ...
pkg/probe/comparator/integer.go
0.657648
0.515376
integer.go
starcoder
package genetics import ( "fmt" "github.com/yaricom/goNEAT/v2/neat/network" ) // MIMOControlGene The Multiple-Input Multiple-Output (MIMO) control Gene allows creating modular genomes, in which several groups of genes // connected through single MIMO Gene and corresponding control function is applied to all inputs ...
neat/genetics/mimo_gene.go
0.617397
0.466116
mimo_gene.go
starcoder
package aoc2019 import ( "io/ioutil" "log" "math" "strings" "github.com/pkg/errors" ) type day19Fact uint8 const ( day19FactNoMoveDownPossible day19Fact = 1 << iota day19FactNoMoveLeftPossible day19FactNoMoveRightPossible day19FactNoMoveTopPossible day19FactOriginNotInBeam day19FactX100NotInBeam day19Fa...
day19.go
0.512937
0.444806
day19.go
starcoder
package cmd import ( "github.com/spf13/cobra" ) var range_diffCmd = &cobra.Command{ Use: "range-diff", Short: "Compare two commit ranges (e.g. two versions of a branch)", Run: func(cmd *cobra.Command, args []string) { }, } func init() { range_diffCmd.Flags().StringS("G", "G", "", "look for differences that c...
completers/git_completer/cmd/range_diff_generated.go
0.526586
0.468304
range_diff_generated.go
starcoder
package sunrisesunset import ( "errors" "math" "time" ) // The Parameters struct can also be used to manipulate // the data and get the sunrise and sunset type Parameters struct { Latitude float64 Longitude float64 UtcOffset float64 Date time.Time } // Just call the 'general' GetSunriseSunset function a...
vendor/github.com/kelvins/sunrisesunset/sunrisesunset.go
0.859605
0.828419
sunrisesunset.go
starcoder
package boleto import ( "errors" "time" ) const ( // DefaultFebrabanType defines the default febraban type used in the document DefaultFebrabanType = "dm" maxInstructionsSize = 6 ) var ( // ErrDiscountHigherThanValue is used when the discount value is higher than the value of the bank slip ErrDiscountHigherTh...
document.go
0.680242
0.415254
document.go
starcoder
package srg import ( "fmt" "sort" "strings" "github.com/serulian/compiler/compilergraph" "github.com/serulian/compiler/sourceshape" ) // FindCommentedNode attempts to find the node in the SRG with the given comment attached. func (g *SRG) FindCommentedNode(commentValue string) (compilergraph.GraphNode, bool) {...
graphs/srg/comments.go
0.696887
0.42471
comments.go
starcoder
package pricing import ( "fmt" "go.uber.org/zap" "github.com/transcom/mymove/pkg/models" ) var parsePriceEscalationDiscount processXlsxSheet = func(params ParamConfig, sheetIndex int, logger Logger) (interface{}, error) { const xlsxDataSheetNum int = 18 const discountsRowIndexStart int = 9 const contractYearC...
pkg/parser/pricing/parse_price_escalation_discount.go
0.634317
0.42477
parse_price_escalation_discount.go
starcoder
package proj import ( "fmt" "math" ) // AEA is an Albers Conical Equal Area projection. func AEA(this *SR) (forward, inverse Transformer, err error) { if math.Abs(this.Lat1+this.Lat2) < epsln { err = fmt.Errorf("proj.AEA: standard Parallels cannot be equal and on opposite sides of the equator") } temp := this...
proj/aea.go
0.619126
0.516291
aea.go
starcoder
package flow import ( "sync" ) // Tracker represents a structure responsible of tracking nodes type Tracker interface { // Flow returns the flow name of the assigned tracker Flow() string // Mark marks the given node as called Mark(node *Node) // Skip marks the given node as marked and flag the given node as sk...
pkg/flow/tracker.go
0.727782
0.444987
tracker.go
starcoder
package markov import ( "bufio" "fmt" "io" "math/rand" "strings" "encoding/json" "os" "github.com/sdukhovni/clyde-go/stringutil" ) // Prefix is a Markov chain prefix of one or more lowercase words. It // may begin with some number of empty strings followed by the string // "START" in all-caps, to indicate the...
markov/markov.go
0.733929
0.400925
markov.go
starcoder
package geom // A MultiPoint is a collection of Points. type MultiPoint struct { geom1 } // NewMultiPoint returns a new, empty, MultiPoint. func NewMultiPoint(layout Layout) *MultiPoint { return NewMultiPointFlat(layout, nil) } // NewMultiPointFlat returns a new MultiPoint with the given flat coordinates. func New...
vendor/github.com/twpayne/go-geom/multipoint.go
0.907246
0.490175
multipoint.go
starcoder
package codec import ( "encoding/binary" "github.com/pingcap/errors" ) const ( encGroupSize = 9 encPad = 0x0 ) /* This is the new algorithm. Similarly to the legacy format the input is split up into N-1 bytes and a flag byte is used as the Nth byte in the output. - If the previous segment needed...
pkg/codec/bytes.go
0.643777
0.538741
bytes.go
starcoder
package ast // These are the available root node types. In JSON it will either be an // object or an array at the base. const ( ObjectRoot RootNodeType = iota ArrayRoot ) // RootNodeType is a type alias for an int type RootNodeType int // RootNode is what starts every parsed AST. There is a `Type` field so that //...
pkg/ast/ast.go
0.71423
0.508971
ast.go
starcoder
package cdn import ( "encoding/json" ) // CustconfDynamicContent The dynamic content caching policy allows you to specify a set of query string and/or HTTP header key/value pairs that should create a unique cache entry for a given URL. This policy is useful when your origin returns unique content for the same URL ba...
pkg/cdn/model_custconf_dynamic_content.go
0.841272
0.428951
model_custconf_dynamic_content.go
starcoder
package square // Represents a line item in an order. Each line item describes a different product to purchase, with its own quantity and price details. type OrderLineItem struct { // Unique ID that identifies the line item only within this order. Uid string `json:"uid,omitempty"` // The name of the line item. Nam...
square/model_order_line_item.go
0.907235
0.464841
model_order_line_item.go
starcoder
// Package atomic provides simple wrappers around numerics to enforce atomic // access. package atomic import ( "encoding/json" "math" "strconv" "sync/atomic" "time" ) // Bool is an atomic Boolean. type Bool struct { nocmp // disallow non-atomic comparison v uint32 } // NewBool creates a Bool. func NewBool(...
vendor/go.uber.org/atomic/atomic.go
0.830078
0.499878
atomic.go
starcoder
package common const ( // LabelAnnotationPrefix is the prefix of every labels and annotations added by the controller. LabelAnnotationPrefix = "fluid.io/" // The format is fluid.io/s-{runtime_type}-{data_set_name}, s means storage LabelAnnotationStorageCapacityPrefix = LabelAnnotationPrefix + "s-" // The dataset ...
pkg/common/label.go
0.73848
0.433862
label.go
starcoder
package light import ( "github.com/austingebauer/go-ray-tracer/color" "github.com/austingebauer/go-ray-tracer/material" "github.com/austingebauer/go-ray-tracer/point" "github.com/austingebauer/go-ray-tracer/vector" "math" ) // Lighting computes the shading for a material given the light source, point being illum...
light/lighting.go
0.879509
0.441673
lighting.go
starcoder
package go2linq import ( "sort" "sync" ) // Reimplementing LINQ to Objects: Part 17 – Except // https://codeblog.jonskeet.uk/2010/12/30/reimplementing-linq-to-objects-part-17-except/ // https://docs.microsoft.com/dotnet/api/system.linq.enumerable.except // Except produces the set difference of two sequences using...
except.go
0.734215
0.444866
except.go
starcoder
package graphics // A Rectanglef contains the points with Min.X <= X < Max.X, Min.Y <= Y < Max.Y. // It is well-formed if Min.X <= Max.X and likewise for Y. Pointfs are always // well-formed. A rectangle's methods always return well-formed outputs for // well-formed inputs. type Rectanglef struct { Min, Max Pointf }...
graphics/rectanglef.go
0.923773
0.561455
rectanglef.go
starcoder
package membufio import ( "errors" "io" ) var ErrEmptyData = errors.New("empty data") var ErrRange = errors.New("index out of range") // This package implements an IO interface to perform stream operations on a byte slice type ByteSliceIO struct { Buffer []byte Index int64 BufferLength int64 } //...
membufio/membufio.go
0.809728
0.45175
membufio.go
starcoder
package internal import ( "fmt" "math" "reflect" "strconv" "github.com/lyraproj/dgo/util" "github.com/lyraproj/dgo/dgo" ) type ( // floatVal is a float64 that implements the dgo.Value interface floatVal float64 defaultFloatType int exactFloatType struct { exactType value floatVal } floatType stru...
internal/float.go
0.804367
0.554169
float.go
starcoder
package api import ( "strings" "github.com/pkg/errors" ) // PostReactionType represents a post reaction type type PostReactionType int const ( // Celebration represents a reaction emotion Celebration PostReactionType = iota // Love represents a reaction emotion Love // Anger represents a reaction emotion ...
server/apisrv/api/postReactionType.go
0.684791
0.451568
postReactionType.go
starcoder
package array // Given a sorted array, remove the duplicates in-place such that each element appear only once and return the new length. // Do not allocate extra space for another array, you must do this by modifying the input array in-place with O(1) extra memory. // https://leetcode.com/explore/interview/card/top-in...
algorithms/interview/array/easy.go
0.853943
0.44734
easy.go
starcoder
package chunk import ( "bytes" "crypto/sha256" "errors" "image" "io" "dennis-tra/image-stego/pkg/bit" "github.com/cbergoon/merkletree" "github.com/icza/bitio" ) // Chunk is a wrapper around an image.RGBA struct that keeps track of // the read and written bytes to the least significant bits of the underlying...
internal/chunk/chunk.go
0.765243
0.481759
chunk.go
starcoder
package circle import ( "github.com/gravestench/pho/geom" "github.com/gravestench/pho/geom/point" "github.com/gravestench/pho/geom/rectangle" ) // New creates a new circle func New(x, y, radius float64) *Circle { c := &Circle{ Type: geom.Circle, } return c.SetPosition(x, y).SetRadius(radius) } type Circle s...
geom/circle/circle.go
0.944842
0.692843
circle.go
starcoder
package ast import ( "fmt" "go/token" "strconv" "github.com/dave/dst" ) // AssignDSL translates to a dst.AssignStmt type AssignDSL struct{ Obj *dst.AssignStmt } // Assign creates a new AssignDSL func Assign(lhs ...dst.Expr) AssignDSL { return AssignDSL{Obj: &dst.AssignStmt{Lhs: lhs}} } // Tok specifies the to...
ast/dsl.go
0.758242
0.439747
dsl.go
starcoder
package geo import ( "fmt" "math" ) type Cell struct { X float64 // Cell center X Y float64 // Cell center Y H float64 // Half cell size D float64 // Distance from cell center to polygon Max float64 // max distance to polygon within a cell } func NewCell(x float64, y float64, h float64, p Polygon) *Ce...
geo/polylabel.go
0.728169
0.562417
polylabel.go
starcoder
package types import ( "context" "fmt" "reflect" "github.com/google/gapid/core/data/pod" "github.com/google/gapid/core/log" "github.com/google/gapid/core/math/sint" "github.com/google/gapid/core/os/device" "github.com/google/gapid/gapis/memory" ) type typeData struct { tp *Type rt reflect.Type } var type...
gapis/service/types/types.go
0.506347
0.434941
types.go
starcoder
package geometry import ( "github.com/samuelyuan/openbiohazard2/fileio" ) func NewMD1Geometry(meshData *fileio.MD1Output, textureData *fileio.TIMOutput) []float32 { vertexBuffer := make([]float32, 0) for _, entityModel := range meshData.Components { // Triangles for j := 0; j < len(entityModel.TriangleIndices...
geometry/md1geometry.go
0.771155
0.584093
md1geometry.go
starcoder
package BuildablePowerPole import ( "fmt" "github.com/l-ross/ficsit-toolkit/resource" ) type FGBuildablePowerPole struct { Name string ClassName string MAllowColoring bool MAttachmentPoints string MBuildEffectSpeed ...
resource/buildable_power_pole/buildable_power_pole.go
0.580947
0.405743
buildable_power_pole.go
starcoder
package graphics2d // General purpose interface that takes a path and turns it into // a slice of paths. For example, a stroked outline of the path or breaks the // path up into a series of dashes. // PathProcessor defines the interface required for function passed to the Process function in Path. type PathProcessor ...
pathprocess.go
0.815967
0.532
pathprocess.go
starcoder
package market import ( "bufio" "fmt" "strings" ) const maxScanTokenSize = 64 * 1024 const matrixMktBanner = `%%MatrixMarket` const ( // object mtxObjectMatrix = "matrix" // format mtxFormatArray = "array" mtxFormatCoordinate = "coordinate" mtxFormatDense = "array" mtxFormatSparse = "coordi...
market.go
0.731634
0.475057
market.go
starcoder
package main import ( "aoc2021/utils/conversions" "aoc2021/utils/files" "aoc2021/utils/intMath" "fmt" "sort" "strings" ) type coordinate struct { x, y int } type heightMap struct { grid map[coordinate]int height, width int } func (h heightMap) localMinimums() []coordinate { var minimums []coordin...
days/day09/day09.go
0.66454
0.407982
day09.go
starcoder
package epoch import ( "time" ) func nHourly(e Epoch, n int, prev time.Time, next time.Time) bool { if prev.After(next) { return e.IsEpochal(next, prev) } if next.Sub(prev).Hours() >= float64(n) { return true } return prev.Hour()/n != next.Hour()/n } // TwelveHourly models an epoch that changes every 12 h...
revisions/epoch/fractional.go
0.825203
0.494751
fractional.go
starcoder
package parser import ( "io" "github.com/arr-ai/wbnf/errors" ) // The following methods assume a valid parse. Call (Term).ValidateParse first if // unsure. func (t S) Unparse(g Grammar, e TreeElement, w io.Writer) (n int, err error) { return w.Write([]byte(e.(Scanner).String())) } func (t RE) Unparse(g Grammar,...
parser/unparse.go
0.695855
0.402304
unparse.go
starcoder
// Attack sbox lookup of first round of AES-128 using differential power analysis. // https://www.paulkocher.com/doc/DifferentialPowerAnalysis.pdf // $ go run power_analysis/attack_sbox_dpa.go -logtostderr -v=1 // [attack_sbox_dpa.go:89] Loaded capture with 500 traces / 5000 samples per trace // [attack_sbox_dpa.go:9...
cmd/attack_sbox_dpa.go
0.592195
0.653932
attack_sbox_dpa.go
starcoder
package binparsergen import "fmt" // A parser is an object which generates code to extract a specific // object from binary data. type Parser interface { // Generate a method on struct_name that extracts field field_name. Compile(struct_name string, field_name string) string // The name of the profile we are gen...
parser.go
0.768777
0.425605
parser.go
starcoder
package ts import ( "math" "time" ) // LTTB down-samples the data to contain only threshold number of points that // have the same visual shape as the original data. Inspired from // https://github.com/dgryski/go-lttb which is based on // https://skemman.is/bitstream/1946/15343/3/SS_MSthesis.pdf func LTTB(b *Serie...
src/query/graphite/ts/lttb.go
0.79158
0.597285
lttb.go
starcoder
package plaid import ( "encoding/json" ) // NumbersBACS Identifying information for transferring money to or from a UK bank account via BACS. type NumbersBACS struct { // The Plaid account ID associated with the account numbers AccountId string `json:"account_id"` // The BACS account number for the account Acco...
plaid/model_numbers_bacs.go
0.723798
0.423041
model_numbers_bacs.go
starcoder
package definition import ( "fmt" "reflect" "github.com/drgomesp/cargo/argument" "github.com/drgomesp/cargo/method" ) // Definition of a service or an argument type Definition struct { arguments []argument.Interface methodCalls []*method.Method constructor reflect.Value t reflect.Type } // New d...
definition/definition.go
0.609989
0.422147
definition.go
starcoder
package elastic import ( "fmt" "math" "gopkg.in/olivere/elastic.v3" "github.com/unchartedsoftware/veldt/binning" "github.com/unchartedsoftware/veldt/tile" ) // Bivariate represents an elasticsearch implementation of the bivariate tile. type Bivariate struct { tile.Bivariate // tiling tiling bool minX int...
vendor/github.com/unchartedsoftware/veldt/generation/elastic/bivariate.go
0.755817
0.416144
bivariate.go
starcoder
package common import ( "math" "math/big" "strconv" ) // IsPrime Checks if the input number is prime or not func IsPrime(n int) bool { out := false if n == 2 { out = true } else if (n % 2) == 0 { out = false } else if n < 2 { out = false } else { max := int(math.Sqrt(float64(n))) factors := 1 for ...
src/common/num-ops.go
0.688049
0.50708
num-ops.go
starcoder
Coding Exercise #1 1. Using the var keyword, declare a bidirectional unbuffered channel called c1 that works with values of type float64 2. Using the make() built-in function declare and initialize a receive-only channel called c2 and a send-only channel called c3. Both work with data of type rune. 3. Declare a bidi...
more_code/coding_tasks/concurrency/gorutines_channels.go
0.874305
0.658431
gorutines_channels.go
starcoder
package notation import ( "bytes" "fmt" "reflect" "sort" "strconv" "strings" ) func withType(o opts) (opts, bool, bool) { if o&types == 0 && o&allTypes == 0 { return o, false, false } if o&skipTypes != 0 && o&allTypes == 0 { return o &^ skipTypes, false, false } return o, true, o&allTypes != 0 } fun...
reflect.go
0.618089
0.41484
reflect.go
starcoder
package expect import ( "encoding/json" "fmt" "regexp" "sort" mtjson "github.com/jefflinse/melatonin/json" ) // A Predicate is a function that takes a test result value and possibly returns an error. type Predicate func(interface{}) error // Then chains a new Predicate to run after the current Predicate. func ...
expect/expect.go
0.755997
0.631566
expect.go
starcoder
package lib import ( "image" "image/draw" "math" lib_image "github.com/mchapman87501/go_mars_2020_img_utils/lib/image" lib_color "github.com/mchapman87501/go_mars_2020_img_utils/lib/image/color" ) // Compositor builds a composite image from constituent tile // images. type Compositor struct { Bounds image....
lib/compositor.go
0.731251
0.603202
compositor.go
starcoder
package jen // Parens renders a single item in parenthesis. Use for type conversion or to specify evaluation order. func Parens(item ...Code) *Statement { return newStatement().Parens(item...) } // Parens renders a single item in parenthesis. Use for type conversion or to specify evaluation order. func (g *Group) P...
jen/generated.go
0.878835
0.483709
generated.go
starcoder
package output import ( "os" "github.com/Jeffail/benthos/v3/internal/docs" "github.com/Jeffail/benthos/v3/lib/log" "github.com/Jeffail/benthos/v3/lib/metrics" "github.com/Jeffail/benthos/v3/lib/types" ) //------------------------------------------------------------------------------ func init() { Constructors...
lib/output/file.go
0.640636
0.649023
file.go
starcoder
package main import ( "fmt" "math" "math/rand" "time" "github.com/Knetic/govaluate" "gonum.org/v1/gonum/integrate" ) // Expr is an expression type Expr struct { Expr string `label:"" desc:"Equation: use x for the x value, t for the time passed since the marbles were ran (incremented ...
expr.go
0.684897
0.446796
expr.go
starcoder
package dpos import "github.com/DxChainNetwork/godx/common" const ( // Fixed number of extra-data prefix bytes reserved for signer vanity extraVanity = 32 // Fixed number of extra-data suffix bytes reserved for signer seal extraSeal = 65 // Number of recent block signatures to keep in memory inmemorySignatur...
consensus/dpos/defaults.go
0.520009
0.486271
defaults.go
starcoder
package typesutils import ( "errors" "reflect" ) // RecordSet is an approximation of models.RecordSet so as not to import models. type RecordSet interface { // ModelName returns the name of the model of this RecordSet ModelName() string // Ids returns the ids in this set of Records Ids() []int64 // Len return...
doxa/tools/typesutils/typesutils.go
0.621541
0.455441
typesutils.go
starcoder
package gfx import ( "image" "image/draw" "math" ) // GeoPoint represents a geographic point with Lat/Lon. type GeoPoint struct { Lon float64 Lat float64 } // GP creates a new GeoPoint func GP(lat, lon float64) GeoPoint { return GeoPoint{Lon: lon, Lat: lat} } // Vec returns a vector for the geo point based o...
vendor/github.com/peterhellberg/gfx/geo.go
0.897712
0.703116
geo.go
starcoder
package h3 import ( "math" ) //lint:file-ignore U1000 Ignore all unused code // CoordIJK holds IJK hexagon coordinates. // Each axis is spaced 120 degrees apart. type CoordIJK struct { i int // i component j int // j component k int // k component } var ( // UNIT_VECS are CoordIJK unit vectors corresponding to...
coordijk.go
0.681091
0.520374
coordijk.go
starcoder
package complete import ( "src.elv.sh/pkg/eval" "src.elv.sh/pkg/parse" ) type nodePath []parse.Node // Returns the path of Node's from n to a leaf at position p. Leaf first in the // returned slice. func findNodePath(root parse.Node, p int) nodePath { n := root descend: for len(parse.Children(n)) > 0 { for _, ...
pkg/edit/complete/node_path.go
0.627267
0.479138
node_path.go
starcoder
package imports import ( . "reflect" "crypto/elliptic" "math/big" ) // reflection: allow interpreted code to import "crypto/elliptic" func init() { Packages["crypto/elliptic"] = Package{ Binds: map[string]Value{ "GenerateKey": ValueOf(elliptic.GenerateKey), "Marshal": ValueOf(elliptic.Marshal), "P224": Va...
vendor/github.com/cosmos72/gomacro/imports/crypto_elliptic.go
0.581184
0.46041
crypto_elliptic.go
starcoder
package primeproofs import "github.com/privacybydesign/keyproof/common" import "github.com/privacybydesign/gabi/big" type expStepStructure struct { bitname string stepa expStepAStructure stepb expStepBStructure } type expStepCommit struct { isTypeA bool Acommit expStepACommit Aproof expStepAProof ...
primeproofs/expstep.go
0.566738
0.483466
expstep.go
starcoder
package minhash import "math" // MinWise is a collection of minimum hashes for a set type MinWise struct { minimums []uint64 h1 Hash64 h2 Hash64 } type Hash64 func([]byte) uint64 // NewMinWise returns a new MinWise Hashing implementation func NewMinWise(h1, h2 Hash64, size int) *MinWise { minimums ...
minwise.go
0.841761
0.437042
minwise.go
starcoder
// Package utf16 implements encoding and decoding of UTF-16 sequences. package utf16 import "unicode" const ( // 0xd800-0xdc00 encodes the high 10 bits of a pair. // 0xdc00-0xe000 encodes the low 10 bits of a pair. // the value is those 20 bits plus 0x10000. surr1 = 0xd800 surr2 = 0xdc00 surr3 = 0xe000 surrS...
src/pkg/utf16/utf16.go
0.538741
0.421671
utf16.go
starcoder
package logging import ( "errors" "fmt" "strings" ) // LogLevel is the numeric score of the significance of a message, where zero is non-significant and higher values are more significant. type LogLevel uint const ( // All allows all messages to be logged All = 0 // Trace allows messages with a significance o...
logging/level.go
0.580471
0.404743
level.go
starcoder
package netmap import ( "sort" ) type ( // aggregator can calculate some value across all netmap // such as median, minimum or maximum. aggregator interface { Add(float64) Compute() float64 } // normalizer normalizes weight. normalizer interface { Normalize(w float64) float64 } meanSumAgg struct { ...
pkg/netmap/aggregator.go
0.845305
0.540499
aggregator.go
starcoder
package vox import "github.com/mbrlabs/vox/glm" type FpsCameraController struct { MouseSensivity float32 // degress per pixel Velocity float32 cam *Camera pressedKeys map[Key]bool tmp *glm.Vector3 } func NewFpsController(cam *Camera) *FpsCameraController { return &FpsCameraController{ ...
nav.go
0.568895
0.403067
nav.go
starcoder
package graphics // https://github.com/ozankasikci/go-image-merge/blob/master/go-image-merge.go import ( "image" "image/color" "image/draw" ) // Specifies how the grid pixel size should be calculated type gridSizeMode int const ( // The size in pixels is fixed for all the grids fixedGridSize gridSizeMode = iot...
graphics/mergedimage.go
0.866726
0.598635
mergedimage.go
starcoder
package generator import "strings" // Params is a slice of Param. type Params []Param // Param is an argument to a function. type Param struct { Name string Type string IsVariadic bool IsSlice bool } // Slices returns those params that are a slice. func (p Params) Slices() Params { var result Pa...
vendor/github.com/maxbrunsfeld/counterfeiter/v6/generator/param.go
0.729905
0.426501
param.go
starcoder
package data const ColorsDataText = `[ { "name": "Absolute Zero", "hex": "#0048BA" }, { "name": "Acid Green", "hex": "#B0BF1A" }, { "name": "Aero", "hex": "#7CB9E8" }, { "name": "Aero Blue", "hex": "#C9FFE5" }, { "name": "African Violet", "hex": "#B284BE" }, ...
data/colors.go
0.500977
0.523116
colors.go
starcoder
package stats import ( "math" "strconv" "time" ) type Value struct { typ Type pad int32 bits uint64 } func MustValueOf(v Value) Value { if v.Type() == Invalid { panic("stats.MustValueOf received a value of unsupported type") } return v } func ValueOf(v interface{}) Value { switch x := v.(type) { case...
value.go
0.619817
0.476275
value.go
starcoder
package assertions import ( "fmt" "reflect" "strings" ) // ShouldStartWith receives exactly 2 string parameters and ensures that the first starts with the second. func ShouldStartWith(actual interface{}, expected ...interface{}) string { if fail := need(1, expected); fail != success { return fail }...
vendor/github.com/smartystreets/assertions/strings.go
0.721056
0.470311
strings.go
starcoder
package gittest import ( "crypto/rand" "io" "io/ioutil" "strings" "testing" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" "gitlab.com/gitlab-org/gitaly/internal/git" "gitlab.com/gitlab-org/gitaly/internal/gitaly/config" ) // TestDeltaIslands is based on the tests in // https://g...
internal/git/gittest/delta_islands.go
0.77586
0.584627
delta_islands.go
starcoder
package parse import "nli-go/lib/mentalese" type workingStep struct { states []chartState nodes []*mentalese.ParseTreeNode stateIndex int } func (step workingStep) getCurrentState() chartState { return step.states[step.stateIndex - 1] } func (step workingStep) getCurrentNode() *mentalese.ParseTreeNo...
lib/parse/working_stack.go
0.610802
0.45175
working_stack.go
starcoder