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 gring import () type node struct { next int prev int value interface{} } // Ring is a circular doubly linked list using array as its underlying storage. // Nodes in the ring can be detached, reinserted, or swapped. type Ring struct { nodes []*node length int head int } // Creates a new empty ring...
ring.go
0.790328
0.453201
ring.go
starcoder
package merkle import ( "errors" "hash" "math" ) var errEmptyTree = errors.New("tree is empty") // Tree defines merkle tree type Tree struct { Nodes []Node Levels [][]Node } // NewTree create a tree func NewTree() Tree { return Tree{ Nodes: nil, Levels: nil, } } // Root retruns root of the tree func (...
tree.go
0.701406
0.424591
tree.go
starcoder
package diff import ( "fmt" "reflect" ) // ValueDiff describes the changes between a pair of values type ValueDiff struct { From interface{} `json:"from" yaml:"from"` To interface{} `json:"to" yaml:"to"` } // Empty indicates whether a change was found in this element func (diff *ValueDiff) Empty() bool { retu...
diff/value_diff.go
0.812086
0.446615
value_diff.go
starcoder
package gocsi const usage = `NAME {{.Name}} -- {{.Description}} SYNOPSIS {{.BinPath}} {{if .Usage}} STORAGE OPTIONS {{.Usage}}{{end}} GLOBAL OPTIONS CSI_ENDPOINT The CSI endpoint may also be specified by the environment variable CSI_ENDPOINT. The endpoint should adhere to Go's network addr...
vendor/github.com/rexray/gocsi/usage.go
0.636918
0.414662
usage.go
starcoder
package gozxing import ( "errors" ) type LuminanceSource interface { /** * Fetches one row of luminance data from the underlying platform's bitmap. Values range from * 0 (black) to 255 (white). Because Java does not have an unsigned byte type, callers will have * to bitwise and with 0xff for each value. It is...
luminance_source.go
0.898395
0.570391
luminance_source.go
starcoder
package binrpc import ( "bufio" "bytes" "encoding/binary" "fmt" "io" "math/rand" "strconv" "github.com/pkg/errors" ) // BinRPCMagic is a magic value at the start of every BINRPC packet. // BinRPCVersion is the version implemented (currently 1). const ( BinRPCMagic uint8 = 0xA BinRPCVersion uint8 = 0x1 ...
binrpc.go
0.687
0.446736
binrpc.go
starcoder
package gototp import ( "crypto/hmac" "crypto/sha1" "encoding/base32" "fmt" "math" "math/rand" "net/url" "strings" "time" ) // Time-based One Time Password type TOTP struct { key []byte // Base-32 decoded Secret Digits int // Number of digits for code. Defaults to 6. Period int // Number of secon...
Godeps/_workspace/src/github.com/craigmj/gototp/gototp.go
0.697918
0.40928
gototp.go
starcoder
package departureboardio // BaseCallingPoint models the common structure in all calling points returned by the departureboard.io API. type BaseCallingPoint struct { // Location name associated calling point. LocationName string `json:"locationName,omitempty"` // CRS is the Computer Reservation System, three letter ...
pkg/departureboardio/models.go
0.767516
0.455138
models.go
starcoder
package rbtree import ( "fmt" "github.com/zhangxianweihebei/gostl/utils/comparator" "github.com/zhangxianweihebei/gostl/utils/visitor" ) var ( defaultKeyComparator = comparator.BuiltinTypeComparator ) // Options holds RbTree's options type Options struct { keyCmp comparator.Comparator } // Option is a function...
ds/rbtree/rbtree.go
0.719778
0.460774
rbtree.go
starcoder
package util // FilterBitArray is an array of bits based on byte unit, so 8 bits at each // index. The array automatically increases if the set index is larger than the // current capacity. The bit index starts at 0. type FilterBitArray []byte const ( byteMask byte = 0xFF byteSize = 8 ) // NewFilterBitArray c...
core/ledger/util/filterbitarray.go
0.859384
0.686352
filterbitarray.go
starcoder
package onshape import ( "encoding/json" ) // TransformGroup struct for TransformGroup type TransformGroup struct { Instances *[]BTAssemblyInstanceDefinitionParams `json:"instances,omitempty"` Transform *[]float64 `json:"transform,omitempty"` } // NewTransformGroup instantiates a new TransformGroup object // This...
onshape/model_transform_group.go
0.778313
0.444866
model_transform_group.go
starcoder
package continuous import ( "github.com/jtejido/stats" "github.com/jtejido/stats/err" "math" "math/rand" ) // Triangular distribution // https://en.wikipedia.org/wiki/Triangular_distribution type Triangular struct { min, max, mode float64 // a, b, c src rand.Source } func NewTriangular(min, max, mod...
dist/continuous/triangular.go
0.788094
0.415077
triangular.go
starcoder
package mechanics import ( "image" "math" "github.com/SolarLune/resolv" "github.com/hajimehoshi/ebiten/v2" ) type ( Enemy struct { *Mover typ int animation []int scale float64 sprite *ebiten.Image spriteWidth, spriteHeight ...
mechanics/enemy.go
0.645343
0.427994
enemy.go
starcoder
package gosmparse import ( "time" "github.com/mattes/gosmparse/OSMPBF" ) // Element contains common attributes of an OSM element (node/way/relation). type Element struct { ID int64 Tags map[string]string // Info is only populated if you use NewDecoderWithInfo. Info *Info } // Node is an OSM data element wi...
elements.go
0.51879
0.406155
elements.go
starcoder
package expressions import ( "base/docs" "datavalues" ) func ADD(left interface{}, right interface{}) IExpression { exprs := expressionsFor(left, right) return &BinaryExpression{ name: "+", argumentNames: [][]string{ {"left", "right"}, }, description: docs.Text("Returns the sum of the two arguments.")...
src/expressions/expression_airthmetic.go
0.703142
0.472744
expression_airthmetic.go
starcoder
package driver import ( "math" ) // round is equivalent to math.Round, but less efficient. // It is here only for compatibility with Go 1.9 func round(x float64) float64 { t := math.Trunc(x) if math.Abs(x-t) >= 0.5 { return t + math.Copysign(1, x) } return t } func (m *Mixer) pruneTree(completions *Completion...
kite-go/lang/lexical/lexicalcomplete/driver/pruning.go
0.546012
0.417687
pruning.go
starcoder
package benten import ( "cloud.google.com/go/datastore" "github.com/dhowden/tag" ) // Metadata epresents a metadata of an audio file. This is equivalent to tag.Metadata except for the following members: // - Picture // - Hash // - Path type Metadata struct { // Format is the metadata Format used to encode the d...
metadata.go
0.583203
0.438244
metadata.go
starcoder
package qhull import ( "github.com/celer/csg/csg" ) // FaceState type FaceState int const ( VISIBLE FaceState = 1 NON_CONVEX = 2 DELETED = 3 ) // Face is a representation of a particular polygon, in a halfedge type structure type Face struct { csg.Plane edge *HalfEdge area flo...
qhull/face.go
0.592784
0.501831
face.go
starcoder
package slices import ( "constraints" "github.com/tdakkota/algo2/alg" ) func Repeat[T any](value T, count int) []T { switch { case count == 0: return []T{} case count == 1: return []T{value} case count < 0: panic("negative Repeat count") } nb := make([]T, count) bp := copy(nb, []T{value, value}) for...
slices/slices.go
0.741112
0.475666
slices.go
starcoder
package goutils import ( "fmt" "unicode" "bytes" "strings" ) // Typically returned by functions where a searched item cannot be found const INDEX_NOT_FOUND = -1 /* Abbreviate abbreviates a string using ellipses. This will turn the string "Now is the time for all good men" into "Now is the time for..." Spec...
vendor/github.com/aokoli/goutils/stringutils.go
0.636692
0.446555
stringutils.go
starcoder
package munkres import ( "fmt" "math" ) //FloatMatrix Code type FloatMatrix struct { N int64 A []float64 } //NewMatrix will return a pointer to a new FloatMatrix func NewMatrix(n int64) (m *FloatMatrix) { m = new(FloatMatrix) m.N = n m.A = make([]float64, n*n) return m } //GetElement will return the elemen...
munkres.go
0.591959
0.420302
munkres.go
starcoder
package iso20022 // Breakdown of cash movements into a fund as a result of investment funds transactions, eg, subscriptions or switch-in. type FundCashInBreakdown2 struct { // Amount of cash flow in, expressed as an amount of money. Amount *ActiveOrHistoricCurrencyAndAmount `xml:"Amt,omitempty"` // Amount of the ...
FundCashInBreakdown2.go
0.766031
0.453988
FundCashInBreakdown2.go
starcoder
package convolve import ( "errors" "fmt" "image" "image/draw" "math" ) // clamp clamps x to the range [x0, x1]. func clamp(x, x0, x1 float64) float64 { if x < x0 { return x0 } if x > x1 { return x1 } return x } // Kernel is a square matrix that defines a convolution. type Kernel interface { // Weight...
51_blur_image/graphics/convolve/convolve.go
0.854217
0.583263
convolve.go
starcoder
package series import ( "fmt" "math" "strconv" "strings" "time" ) type stringElement struct { e *string } func (e stringElement) Set(value interface{}) Element { var val string switch value.(type) { case string: val = string(value.(string)) if val == "NaN" { e.e = nil return e } case int: val...
series/type-string.go
0.592549
0.415077
type-string.go
starcoder
package forGraphBLASGo import ( "github.com/intel/forGoParallel/pipeline" ) type vectorAsMask[T Number] struct { v *vectorReference[T] } func newVectorAsMask[T Number](v *vectorReference[T]) functionalVector[bool] { return vectorAsMask[T]{v: v} } func (v vectorAsMask[T]) resize(ref *vectorReference[bool], newSiz...
functional_VectorAsMask.go
0.555918
0.578924
functional_VectorAsMask.go
starcoder
package execxp import ( "fmt" "math" "github.com/ChrisTrenkamp/goxpath/tree" ) func bothNodeOperator(left tree.NodeSet, right tree.NodeSet, f *xpFilt, op string) error { var err error for _, l := range left { for _, r := range right { lStr := l.ResValue() rStr := r.ResValue() if eqOps[op] { err ...
vendor/github.com/ChrisTrenkamp/goxpath/internal/execxp/operators.go
0.516839
0.444324
operators.go
starcoder
package boardgame import ( "encoding/json" "errors" "strconv" ) //ImmutableBoard is a version of a Board without any of the mutator methods. //See Board for more. type ImmutableBoard interface { ImmutableSpaces() []ImmutableStack ImmutableSpaceAt(index int) ImmutableStack Len() int state() *state setState(st ...
board.go
0.711832
0.433622
board.go
starcoder
package attrs import ( "strings" "github.com/gobuffalo/flect/name" ) //Attr is buffalo's implementation for model attributes type Attr struct { Original string Name name.Ident commonType string goType string } func (a Attr) String() string { return a.Original } //GoType returns the Go type for a...
movinglater/attrs/attrs.go
0.64579
0.403214
attrs.go
starcoder
package internal import ( "reflect" "github.com/tada/catch" "github.com/tada/dgo/dgo" ) type ( // tupleType represents an array with an exact number of ordered element types. tupleType struct { types []dgo.Value variadic bool } ) // DefaultTupleType is a tuple without size and type constraints var Defa...
internal/tuple.go
0.740925
0.450601
tuple.go
starcoder
package integration import ( "errors" "testing" "github.com/devhossamali/ari" "github.com/devhossamali/ari/client/arimocks" tmock "github.com/stretchr/testify/mock" ) var _ = tmock.Anything func TestConfigData(t *testing.T, s Server) { key := ari.NewKey("config", ari.ConfigID("c1", "o1", "id1")) runTest("ok...
internal/integration/config.go
0.510496
0.455259
config.go
starcoder
package poc import ( "math" "math/big" "github.com/massnetorg/mass-core/consensus" "github.com/massnetorg/mass-core/poc/chiapos" "github.com/massnetorg/mass-core/poc/pocutil" ) const ( // PoCSlot represents the unit Slot of PoC PoCSlot = 3 // KiB represents KiByte KiB = 1024 // MiB represents MiByte MiB...
poc/proof.go
0.793826
0.499695
proof.go
starcoder
package plasmacrypto import ( "math/big" "github.com/snjax/gmp" ) var RsaN *gmp.Int type Accumulator struct { value *gmp.Int } func (a *Accumulator) Value() *big.Int { return a.value.BigInt() } func (a *Accumulator) Clone() *Accumulator { return &Accumulator{new(gmp.Int).Set(a.value)} } func (a *Accumulator...
src/node/plasmautils/plasmacrypto/rsa.go
0.637144
0.465023
rsa.go
starcoder
package day7 import ( "ryepup/advent2021/utils" "sort" ) /* A giant whale has decided your submarine is its next meal, and it's much faster than you are. There's nowhere to run! Suddenly, a swarm of crabs (each in its own tiny submarine - it's too deep for them otherwise) zooms in to rescue you! They seem to be pr...
day7/part1.go
0.55447
0.4206
part1.go
starcoder
package remotemetrics import ( "fmt" "strings" ) type matchAll struct { matchers []Matcher } // MatchAll returns a matcher that matches all the given matchers. func MatchAll() MatcherCollection { return &matchAll{} } // Add adds the given matcher to the collection. func (m *matchAll) Add(matcher Matcher) Match...
pkg/remotemetrics/matcher.go
0.843315
0.420659
matcher.go
starcoder
package holidays import ( "errors" "fmt" "sort" "time" ) const day = 24 * time.Hour var ( HolidayDataNotFoundError = errors.New("Holiday data not found for requested country-code") holidayProviders = map[string]holidayDataSource{} ) func registerHolidayDataSource(code string, hds holidayDataSource) { ...
holidays/holiday.go
0.702632
0.414188
holiday.go
starcoder
package main import ( "fmt" "math" "math/big" ) // Each iteration through the convergents of the continued fraction of sqrt(D), // we want to check whether the numerator and denominator provide a solution to // the Diophantine equation: https://en.wikipedia.org/wiki/Pell%27s_equation // See the section entitled '...
go/problems/problem66.go
0.851691
0.663846
problem66.go
starcoder
package codegen import "strings" type TypeDecl struct { name *nameHelper } // Type creates a new type for a function func Type(name string) *TypeDecl { return &TypeDecl{name: newNameHelper("", name)} } // QualType creates a new type with an alias of an imported package func QualType(alias, name string) *TypeDecl ...
helper_type.go
0.716715
0.414662
helper_type.go
starcoder
package messagelayer import ( "time" "github.com/iotaledger/hive.go/configuration" ) // ParametersDefinition contains the definition of the parameters used by the messagelayer plugin. type ParametersDefinition struct { // TangleWidth can be used to specify the number of tips the Tangle tries to maintain. TangleW...
plugins/messagelayer/parameters.go
0.712732
0.42937
parameters.go
starcoder
package interval import "fmt" // These must increase numerically as the durations they represent increase in // size. Unfortunately, intervals are not perfectly sortable as 24 months will // still come before 1 day. The Less function has a red hot go, but it's not // perfect either as it checks against a fixed date, ...
interval/unit.go
0.631026
0.405625
unit.go
starcoder
package gjsonquery import ( "errors" "fmt" "reflect" ) func comparatorIs(actual, expected interface{}) bool { _d("[comparatorIs]\n\tactual: %#v \n\texpected: %#v\n", actual, expected) if actual != expected { _d("[comparatorIs] RETURN: False\n") return false } _d("[comparatorIs] RETURN: True\n") return tru...
comparators.go
0.5769
0.401776
comparators.go
starcoder
package datadog import ( "encoding/json" ) // LogsByRetentionMonthlyUsage Object containing a summary of indexed logs usage by retention period for a single month. type LogsByRetentionMonthlyUsage struct { // The month for the usage. Date *string `json:"date,omitempty"` // Indexed logs usage for each active rete...
api/v1/datadog/model_logs_by_retention_monthly_usage.go
0.728072
0.433921
model_logs_by_retention_monthly_usage.go
starcoder
package timsort import "math" type Ordered interface { type int, int8, int16, int32, int64, uint, uint8, uint16, uint32, uint64, uintptr, float32, float64, string } func binarySearch[T Ordered](data []T, item T, start int, end int) int { if start == end { if data[start] > item { return start } return star...
pkg/timsort/timsort.go
0.609408
0.426979
timsort.go
starcoder
package validator import ( "fmt" "reflect" "strconv" "strings" validator "github.com/go-playground/validator/v10" ) type Validator struct { *validator.Validate } func (v *Validator) validateRequiredIf(fl validator.FieldLevel) bool { param := fl.Param() paths := strings.SplitN(param, " ", 3) if len(paths) !...
validator/required_if.go
0.540924
0.407628
required_if.go
starcoder
package keys import ( "bytes" "encoding/hex" "github.com/dusk-network/dusk-blockchain/pkg/p2p/wire/encoding" "github.com/dusk-network/dusk-protobuf/autogen/go/rusk" ) // SecretKey is a Phoenix secret key, consisting of two JubJub scalars. type SecretKey struct { A []byte `json:"a"` B []byte `json:"b"` } // N...
pkg/core/data/ipc/keys/keys.go
0.832407
0.431524
keys.go
starcoder
package point import ( "math" ) type Point struct { X, Y float64 } type Points []Point // Rotate は任意の角度回転した座標を返す。 // cpは原点座標 func (p Point) Rotate(angle float64, cp Point) Point { p.X -= cp.X p.Y -= cp.Y var ( sin, cos = math.Sincos(angle * math.Pi / 180) nx = cos*p.X - sin*p.Y ny = sin*p.X +...
point/point.go
0.596786
0.486697
point.go
starcoder
package recurrent import ( "fmt" "math" "strings" "github.com/drakos74/go-ex-machina/xmath" "github.com/drakos74/go-ex-machina/xmachina" "github.com/drakos74/go-ex-machina/xmachina/net" ) const ( base = "base" ) type T func(i int) float64 type P func(i int, x float64) float64 func X(f float64) T { return...
examples/recurrent/train.go
0.608012
0.441131
train.go
starcoder
package midilib // the following functions are taken from github.com/afandian/go-midi // Copyright 2012 <NAME>. All rights reserved. // Use of this source code is governed by the MIT license // which can be found in the LICENSE file. // MIDI package // A package for reading Standard Midi Files, written in Go. // <NA...
internal/midilib/midi_functions.go
0.625667
0.444444
midi_functions.go
starcoder
package recurly import () type InvoiceCreate struct { // 3-letter ISO 4217 currency code. Currency *string `json:"currency,omitempty"` // An automatic invoice means a corresponding transaction is run using the account's billing information at the same time the invoice is created. Manual invoices are created with...
invoice_create.go
0.686475
0.40489
invoice_create.go
starcoder
package champ import ( math "github.com/chewxy/math32" "github.com/r4stl1n/micro-hal/code/pkg/champ/cbase" "github.com/r4stl1n/micro-hal/code/pkg/champ/cstructs" ) type Kinematics struct { quadBase *cbase.QuadBase } func (kinematics *Kinematics) Init(quadBase *cbase.QuadBase) *Kinematics { *kinematics = Kinemat...
code/pkg/champ/kinematics.go
0.693058
0.466481
kinematics.go
starcoder
package goolx // FltConn represents a fault connection for use with the DoFault procedure. // The codes are applied to FaultConfig and SteppedEventConfig as specified in ASPEN Oneliner documentation. type FltConn int // applyToFaultConfig applies the appropriate fault connection code to the provided FaultConfig. fun...
fault.go
0.586049
0.463991
fault.go
starcoder
package task import "sort" type lessFunc func(p1, p2 Task) bool // multiSorter implements the Sort interface, sorting the tasks within. type multiSorter struct { tasks []Task less []lessFunc } // Sort sorts the argument slice according to the less functions passed to orderedBy. func (ms *multiSorter) Sort(tasks ...
task/sort.go
0.68721
0.495117
sort.go
starcoder
package main import ( "github.com/g3n/engine/math32" "github.com/go-gl/glfw/v3.3/glfw" "github.com/go-gl/mathgl/mgl32" ) var Z_AXIS = mgl32.Vec3{0.0, 0.0, 1.0} type Camera struct { view mgl32.Mat4 proj mgl32.Mat4 projView mgl32.Mat4 invProjView mgl32.Mat4 pos mgl32.Vec3 dir mgl32.Vec3 up ...
camera.go
0.653901
0.439326
camera.go
starcoder
package cpu // OpCode for 6502 CPU type OpCode uint8 // InstructionStatus type InstructionStatus uint16 // Instruction implements the instructions for the 6502 CPU // The Exec implements the instruction and returns the total clock // cycles to be consumed by the instruction type Instruction struct { Mneumonic strin...
instructions.go
0.62395
0.476641
instructions.go
starcoder
package gravity import ( "math" "github.com/go-gl/mathgl/mgl32" ) // Cos ... func Cos(f float32) float32 { return float32(math.Cos(float64(f))) } // Sin ... func Sin(f float32) float32 { return float32(math.Sin(float64(f))) } // Mod ... func Mod(x, y float32) float32 { return float32(math.Mod(float64(x), floa...
math.go
0.800341
0.661123
math.go
starcoder
package hclspec // ObjectSpec wraps the object and returns a spec. func ObjectSpec(obj *Object) *Spec { return &Spec{ Block: &Spec_Object{ Object: obj, }, } } // ArraySpec wraps the array and returns a spec. func ArraySpec(array *Array) *Spec { return &Spec{ Block: &Spec_Array{ Array: array, }, } } ...
vendor/github.com/hashicorp/nomad/plugins/shared/hclspec/spec.go
0.842992
0.571707
spec.go
starcoder
package events import ( "errors" "fmt" "github.com/dogmatiq/example/messages" "github.com/dogmatiq/example/messages/internal/validation" ) // DailyDebitLimitConsumed is an event that indicates an amount of an account // daily debit limit has been consumed. type DailyDebitLimitConsumed struct { TransactionID ...
messages/events/dailydebitlimit.go
0.691185
0.418756
dailydebitlimit.go
starcoder
package context import ( "fmt" "log" "sort" "strings" "github.com/xiam/sexpr/ast" ) type Function struct { name string fn func(*Context) error } func NewFunction(fn func(*Context) error) *Function { return &Function{ fn: fn, } } func NewFunctionWithName(fn func(*Context) error, name string) *Function ...
context/value.go
0.556641
0.444022
value.go
starcoder
From Leetcode (https://leetcode.com/explore/challenge/card/july-leetcoding-challenge/546/week-3-july-15th-july-21st/3394/) There are a total of n courses you have to take, labeled from 0 to n-1. Some courses may have prerequisites, for example to take course 0 you have to first take course 1, which is expressed as a ...
common_problems/topological_sort.go
0.812161
0.516291
topological_sort.go
starcoder
package gocb // RemoveMt performs a Remove operation and includes MutationToken in the results. func (b *Bucket) RemoveMt(key string, cas Cas) (Cas, MutationToken, error) { if !b.mtEnabled { panic("You must use OpenBucketMt with Mt operation variants.") } span := b.startKvOpTrace("RemoveMt") defer span.Finish()...
vendor/github.com/couchbase/gocb/bucket_token.go
0.798108
0.416263
bucket_token.go
starcoder
package main import "fmt" // switchData represents a single encipher/deciphering series of permutations type switchData [][]byte // invert makes a new switchData table, inverting each permutation func (s switchData) invert() switchData { npositions := len(s) nperms := len(s[1]) r := make(switchData, npositions) ...
switch.go
0.643777
0.494507
switch.go
starcoder
package p256 import ( "math/big" "github.com/ethereum/go-ethereum/crypto/secp256k1" ) type MyBitCurve struct { secp256k1.BitCurve } // Add returns the sum of (x1,y1) and (x2,y2) func (BitCurve *MyBitCurve) Add(x1, y1, x2, y2 *big.Int) (*big.Int, *big.Int) { z := new(big.Int).SetInt64(1) return B...
crypto/vendor/ing-bank/zkrp/crypto/p256/mycurve.go
0.8415
0.569912
mycurve.go
starcoder
package path_traversal import ( "github.com/threagile/threagile/model" ) func Category() model.RiskCategory { return model.RiskCategory{ Id: "path-traversal", Title: "Path-Traversal", Description: "Quando um sistema de arquivos é acessado, podem surgir riscos de Traversal de Caminho ou Inclusão de Arquivo ...
risks/built-in/path-traversal/path-traversal-rule.go
0.577376
0.519948
path-traversal-rule.go
starcoder
package timetricks import ( "time" ) const ( dayFmt = "01/02" dayFormat = "20060102" weekPlusMinute = 7*24*time.Hour + time.Minute ) // SameDay returns true if t and t2 represent the same calendar date. func SameDay(t time.Time, t2 time.Time) bool { return t.Format(dayFormat) == t2.Format(dayFormat...
pkg/timetricks/timetricks.go
0.757794
0.451568
timetricks.go
starcoder
package shuffle import ( "crypto/cipher" "github.com/dedis/kyber" "github.com/dedis/kyber/proof" "github.com/dedis/kyber/util/random" ) func bifflePred() proof.Predicate { // Branch 0 of either/or proof (for bit=0) rep000 := proof.Rep("Xbar0-X0", "beta0", "G") rep001 := proof.Rep("Ybar0-Y0", "beta0", "H") r...
lib/dedis/kyber/shuffle/biffle.go
0.682362
0.401512
biffle.go
starcoder
package proj import ( "fmt" "math" ) // TMerc is a transverse Mercator projection. func TMerc(this *SR) (forward, inverse Transformer, err error) { e0 := e0fn(this.Es) e1 := e1fn(this.Es) e2 := e2fn(this.Es) e3 := e3fn(this.Es) ml0 := this.A * mlfn(e0, e1, e2, e3, this.Lat0) /** Transverse Mercator Forwa...
proj/tmerc.go
0.591369
0.431345
tmerc.go
starcoder
package eva import ( "fmt" "math" "github.com/dact221/eva/dist" "gonum.org/v1/plot" "gonum.org/v1/plot/plotter" ) // ScaleX can be used as the value of an Axis.Scale function to set the x-axis to a custom probability scale. type ScaleX func(x float64) float64 // Normalize returns the fractional transformed dis...
plot.go
0.859221
0.566438
plot.go
starcoder
package main import ( "bufio" "fmt" "io" "log" "math" "os" "sort" "strconv" ) func main() { heightmap, err := readHeightmap(os.Stdin) if err != nil { log.Fatal(err) } sumOfRiskLevels := calculateSumOfRiskLevels(heightmap) productOfTop3BasinSizes := getProductOfTop3BasinSizes(heightmap) fmt.Printf("S...
cmd/day09/main.go
0.547706
0.448245
main.go
starcoder
package plot import ( "encoding/json" ) // ColorTheme contains the theme colors for plot type ColorTheme struct { Name string `json:"name"` Colors []string `json:"colors"` } // ThemeColors contains all theme colors of ligo var ThemeColors = []ColorTheme{} // GetThemeColors get ThemeColors func GetThemeColors...
plot/theme.go
0.513425
0.441191
theme.go
starcoder
package jubjub import ( "math/big" "github.com/pkg/errors" ) var ( ErrInvalidPoint error = errors.New("not a valid jubjub point") ErrIdentity = errors.New("point was in the h-torsion") ) // Jubjub provides a context for working with the Jubjub elliptic curve. type Jubjub struct { fieldOrder *big.I...
jubjub.go
0.724675
0.442697
jubjub.go
starcoder
package tart // Developed by <NAME> in the late 1950s, the Stochastic Oscillator is // a momentum indicator that shows the location of the close relative to the // high-low range over a set number of periods. According to an interview with // Lane, the Stochastic Oscillator “doesn't follow price, it doesn't follow // ...
stochfast.go
0.733643
0.558447
stochfast.go
starcoder
package bulletproofs import ( "fmt" "github.com/incognitochain/go-incognito-sdk-v2/crypto" "github.com/incognitochain/go-incognito-sdk-v2/privacy/utils" ) type bulletproofParams struct { g []*crypto.Point h []*crypto.Point u *crypto.Point cs *crypto.Point } // Witness represents a Bulletproofs witness. typ...
privacy/v1/zkp/bulletproofs/bulletproofs.go
0.700997
0.525673
bulletproofs.go
starcoder
package gfx import ( "math" "github.com/goxjs/gl" ) // treat adjacent segments with angles between their directions <5 degree as straight const linesParallelEPS float32 = 0.05 type polyLine struct { join string halfwidth float32 } func determinant(vec1, vec2 []float32) float32 { return vec1[0]*vec2[1] - ...
gfx/polyline.go
0.813387
0.70108
polyline.go
starcoder
package geometry import ( "math" ) type Mat3x1 [3]Mat1x1 func (a Mat3x1) Add(b Mat3x1) Mat3x1 { return Mat3x1{ Mat1x1{a[0][0] + b[0][0]}, Mat1x1{a[1][0] + b[1][0]}, Mat1x1{a[2][0] + b[2][0]}, } } func (m Mat3x1) AddScalar(f float64) Mat3x1 { return Mat3x1{ Mat1x1{m[0][0] + f}, Mat1x1{m[1][0] + f}, M...
mat3.go
0.598899
0.592048
mat3.go
starcoder
package onshape import ( "encoding/json" ) // BTPTopLevelImport285 struct for BTPTopLevelImport285 type BTPTopLevelImport285 struct { BTPTopLevelNode286 BtType *string `json:"btType,omitempty"` CombinedNamespacePathAndVersion *string `json:"combinedNamespacePathAndVersion,omitempty"` ImportMicroversion *string `...
onshape/model_btp_top_level_import_285.go
0.666062
0.405802
model_btp_top_level_import_285.go
starcoder
package node import ( "fmt" ) // Type is the type of a node. type Type int // Exhaustive set of valid Type's. const ( InternalType Type = iota LeafType ) // Tag is an opaque tag that can be attached to a node. // See also internal/tag type Tag interface{} // Node is a single node in the DAG comprising a ROBDD. ...
internal/node/node.go
0.708414
0.450843
node.go
starcoder
package material import ( "gotracer/vmath" "math/rand" ) // Dielectric material allow light to pass trough them. // When a light ray hits them, it splits into a reflected ray and a refracted (transmitted) ray. type DieletricMaterial struct { // Refractive indice of the dielectric material. // Used to calculate t...
material/dieletric_material.go
0.74008
0.458106
dieletric_material.go
starcoder
package pdf import "fmt" // MoveTo starts a new path or subpath at x, y. func (p *Page) MoveTo(x, y float64) { fmt.Fprint(p.contents, x, y, " m ") } // LineTo adds a straight line to the current path. func (p *Page) LineTo(x, y float64) { fmt.Fprint(p.contents, x, y, " l ") } // CurveTo appends a cubic Bézier cur...
draw.go
0.749729
0.457682
draw.go
starcoder
package engine import ( "github.com/google/uuid" ) const ( // Player1Turn represents the turn of the Player #1 Player1Turn Turn = iota // Player2Turn represents the turn of the Player #2 Player2Turn ) const ( // Undefined represents a yet undefined result for a game Undefined Result = iota // Player1Wins rep...
internal/engine/game.go
0.773473
0.440108
game.go
starcoder
package gl import "fmt" // Enum is equivalent to GLenum, and is normally used with one of the // constants defined in this package. type Enum uint32 // Attrib identifies the location of a specific attribute variable. type Attrib struct { Value uint } // Program identifies a compiled shader program. type Program s...
types_opengl.go
0.644337
0.478773
types_opengl.go
starcoder
// A package containing an implementation of the BC5 red/green image compression algorithm. package bc5 import ( "bytes" "encoding/binary" "errors" "image" "image/color" "image/draw" "io" "io/ioutil" "math" "os" ) // Alias for decompression blue computation constants. type BlueMode int const ( Zero ...
bc5.go
0.820865
0.520009
bc5.go
starcoder
package qrcode import ( "errors" "fmt" ) var ( // ErrorOutRangeOfW x out of range of Width ErrorOutRangeOfW = errors.New("out of range of width") // ErrorOutRangeOfH y out of range of Height ErrorOutRangeOfH = errors.New("out of range of height") ) // newMatrix generate a matrix with map[][]qrbool func newMat...
matrix.go
0.640411
0.442215
matrix.go
starcoder
package htm import ( "bytes" "github.com/nupic-community/htm/utils" //"math" ) //Sparse binary matrix stores indexes of non-zero entries in matrix //to conserve space type DenseBinaryMatrix struct { Width int Height int entries []bool } //Create new sparse binary matrix of specified size func NewDenseBinary...
denseBinaryMatrix.go
0.695752
0.565419
denseBinaryMatrix.go
starcoder
package profile /* Vapour Transport assumes: - considers only vapour flux at the soil surface - isothermal and isobaric throughout the timestep - uniform soil temperature (model meant for soil surface) */ import ( "fmt" "math" "github.com/maseology/mmaths" ) const ( isFreeDrainage = true isInfiltratin...
profile/solver.go
0.528047
0.417153
solver.go
starcoder
package suffixtree import ( "strconv" ) // A Node has some children (mapped by the first byte of the edge to that child), // and an Edge (all the bytes for the edge to this Node from its parent). type Node struct { Child map[byte]*Node Edge []byte suffix *Node name string } var nodeNum int func newNode(edge...
suffixtree.go
0.600305
0.444263
suffixtree.go
starcoder
package ast import ( "github.com/biased-unit/planout-golang/compiler/token" ) // Statement denotes a top-level node such as an if statement, assignment statement, or return statement type Statement interface { statementNode() } // Expression denotes an internal node, such as numeric or string // literals, infix op...
compiler/ast/ast.go
0.771069
0.40928
ast.go
starcoder
package fixvec import ( "github.com/ugorji/go/codec" ) // FixVec provides a vector representation of value using fixed bits // Conceptually, FixVec represents a vector V[0...num), and each // value V[i] can represent in [0...2^(blen)) // The total working space is num * blen bits (+ some small overhead). type FixVec...
pkg/fixvec/fixvec.go
0.615781
0.453867
fixvec.go
starcoder
package value import ( "math/big" ) func logn(c Context, v Value) Value { negative := isNegative(v) if negative { // Promote to complex. The Complex type is never negative. v = newComplex(v, Int(0)) } if u, ok := v.(Complex); ok { if isNegative(u.real) { negative = true } if !isZero(u.imag) || nega...
value/log.go
0.751557
0.421016
log.go
starcoder
package fu import ( "reflect" "strconv" ) type dimension struct{ Channels, Height, Width int } func (d dimension) Volume() int { return d.Channels * d.Width * d.Height } func (d dimension) Dimension() (c, h, w int) { return d.Channels, d.Height, d.Width } type tensor32f struct { dimension values []...
fu/tensor.go
0.698124
0.512205
tensor.go
starcoder
package iso20022 // Details of breakdown of a quantity. type QuantityBreakdown4 struct { // Identification, for tax purposes, of a lot of identical securities that are bought at a certain date and at a certain price. LotNumber *Number2Choice `xml:"LotNb,omitempty"` // Quantity of financial instruments that is par...
data/train/go/39d996f6d907d0d762c74790bb351008336bd0e5QuantityBreakdown4.go
0.826607
0.414958
39d996f6d907d0d762c74790bb351008336bd0e5QuantityBreakdown4.go
starcoder
package num import ( "math" "github.com/cpmech/gosl/chk" "github.com/cpmech/gosl/fun" "github.com/cpmech/gosl/io" "github.com/cpmech/gosl/la" ) // NlSolver implements a solver to nonlinear systems of equations // References: // [1] G.Forsythe, M.Malcolm, C.Moler, Computer methods for mathematical // ...
num/nlsolver.go
0.632389
0.51751
nlsolver.go
starcoder
package testonly import ( "github.com/transparency-dev/merkle" "github.com/transparency-dev/merkle/compact" "github.com/transparency-dev/merkle/proof" ) // Tree implements an append-only Merkle tree. For testing. type Tree struct { hasher merkle.LogHasher size uint64 hashes [][][]byte // Node hashes, indexed...
testonly/tree.go
0.797754
0.461381
tree.go
starcoder
package benchmark import ( "reflect" "testing" ) func isBoolToInt64FuncCalibrated(supplier func() bool) bool { return isCalibrated(reflect.Bool, reflect.Int64, reflect.ValueOf(supplier).Pointer()) } func isIntToInt64FuncCalibrated(supplier func() int) bool { return isCalibrated(reflect.Int, reflect.Int64, reflec...
common/benchmark/06_to_int64_func.go
0.699562
0.817246
06_to_int64_func.go
starcoder
package osc import ( "encoding/json" ) // ListenerForCreation Information about the listener to create. type ListenerForCreation struct { // The port on which the back-end VM is listening (between `1` and `65535`, both included). BackendPort int32 `json:"BackendPort"` // The protocol for routing traffic to back-...
v2/model_listener_for_creation.go
0.796886
0.412057
model_listener_for_creation.go
starcoder
package signing import ( "fmt" codectypes "github.com/puneetsingh166/tm-load-test/codec/types" cryptotypes "github.com/puneetsingh166/tm-load-test/crypto/types" ) // SignatureV2 is a convenience type that is easier to use in application logic // than the protobuf SignerInfo's and raw signature bytes. It goes beyo...
types/tx/signing/signature.go
0.673406
0.410815
signature.go
starcoder
package fake import ( "github.com/stretchr/testify/mock" demoinfocs "github.com/markus-wa/demoinfocs-golang/v2/pkg/demoinfocs" common "github.com/markus-wa/demoinfocs-golang/v2/pkg/demoinfocs/common" st "github.com/markus-wa/demoinfocs-golang/v2/pkg/demoinfocs/sendtables" ) var _ demoinfocs.GameState = new(GameS...
pkg/demoinfocs/fake/game_state.go
0.670069
0.418697
game_state.go
starcoder
package rgb565 import ( "image" "image/color" "math" ) // RGB565 is an in-memory image whose At method returns RGB565 values. type RGB565 struct { // Pix holds the image's pixels, as RGB565 values in big-endian format. The pixel at // (x, y) starts at Pix[(y-p.Rect.Min.Y)*p.Stride + (x-p.Rect.Min.X)*2]. Pix []...
rgb565.go
0.863593
0.41745
rgb565.go
starcoder
package mathutil import ( "math" "sort" ) func notNaNVals(vals []float64) []float64 { newVals := make([]float64, 0, len(vals)) for _, v := range vals { if !math.IsNaN(v) { newVals = append(newVals, v) } } return newVals } // MinInt64 returns the smaller of x or y. func MinInt64(x, y int64) int64 { if x...
pkg/mathutil/math.go
0.829837
0.443179
math.go
starcoder
package expression import ( "fmt" "reflect" "strings" "time" "github.com/dolthub/vitess/go/vt/sqlparser" errors "gopkg.in/src-d/go-errors.v1" "github.com/dolthub/go-mysql-server/sql" ) var ( // errUnableToCast means that we could not find common type for two arithemtic objects errUnableToCast = errors.New...
sql/expression/arithmetic.go
0.557604
0.547283
arithmetic.go
starcoder
package mat type Matrix struct { Rows uint Cols uint Data [][]complex128 } type Vector struct { N uint Data []complex128 } func NewMatrix(r, c uint) Matrix { var data = make([][]complex128, r) var i,j uint for i=0; i<r; i++ { data[i] = make([]complex128, c) for j=0; j<c; j++ { data[i][j] = complex128(...
mat/mat.go
0.506103
0.420778
mat.go
starcoder
package rest import ( "strings" su "github.com/ClickerMonkey/sudogo/pkg" "golang.org/x/exp/constraints" ) func initAndValidate[T constraints.Ordered](out *T, def T, min T, max T, v Validator) { var empty T if *out == empty { *out = def } else if *out < min { v.Add("cannot be less than %v: %v", min, *out) ...
pkg/rest/types.go
0.655226
0.417153
types.go
starcoder