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 eZmaxApi import ( "encoding/json" ) // EzsignfolderRequestCompound An Ezsignfolder Object and children to create a complete structure type EzsignfolderRequestCompound struct { // An array of signers that will be invited to sign the Ezsigndocuments AEzsignfoldersignerassociation []Ezsignfoldersignerassocia...
model_ezsignfolder_request_compound.go
0.726231
0.435121
model_ezsignfolder_request_compound.go
starcoder
package de import ( mat "github.com/nlpodyssey/spago/pkg/mat32" "github.com/nlpodyssey/spago/pkg/mat32/rand" ) // DifferentialEvolution implements a simple and efficient heuristic for global optimization over continuous spaces. // Reference: https://link.springer.com/article/10.1023/A:1008202821328 (St<NAME>, 1997...
pkg/ml/optimizers/de/de.go
0.72487
0.567218
de.go
starcoder
package chart const ( // DefaultEMAPeriod is the default EMA period used in the sigma calculation. DefaultEMAPeriod = 12 ) // EMASeries is a computed series. type EMASeries struct { Name string Style Style YAxis YAxisType Period int InnerSeries ValueProvider cache []float64 } // GetName returns the n...
vendor/github.com/nicholasjackson/bench/vendor/github.com/wcharczuk/go-chart/ema_series.go
0.859782
0.414958
ema_series.go
starcoder
package p3 import "fmt" type polynomial struct { coeffArray []int highPower int } func ZeroPolynomial() *polynomial { return &polynomial{} } func AddPolynomial(p1, p2 *polynomial) *polynomial { pSum := ZeroPolynomial() pSum.highPower = p1.highPower if p2.highPower > pSum.highPower { pSum.highPower = p2.hig...
dtc/p3/p3polynomial.go
0.538983
0.513668
p3polynomial.go
starcoder
package halfgone import ( "image" "image/color" "math" "math/rand" "sort" ) // A Ditherer convert a grayscale image with intensities going from 0 (black) to // 255 (white) into a black and white image. type Ditherer interface { Apply(gray *image.Gray) *image.Gray } // ThresholdDitherer converts each pixel in a...
vendor/github.com/MaxHalford/halfgone/dither.go
0.784897
0.652463
dither.go
starcoder
package portutils // PortsRange holds a range of ports. type PortsRange struct { FromPort int64 ToPort int64 } // PortsRangeList holds a list of port range. type PortsRangeList []*PortsRange // HasOverlapWithPort returns true if the range overlaps the given port. func (p *PortsRange) HasOverlapWithPort(port int6...
portutils/interfaces.go
0.8549
0.554109
interfaces.go
starcoder
package dialects import ( "fmt" "reflect" "gopkg.in/gorp.v1" ) type ClickHouseDialect struct{} func (d ClickHouseDialect) QuerySuffix() string { return "" } func (d ClickHouseDialect) ToSqlType(val reflect.Type, maxsize int, isAutoIncr bool) string { switch val.Kind() { case reflect.Ptr: return d.ToSqlType(...
dialects/clickhouse.go
0.610337
0.400544
clickhouse.go
starcoder
package gopter import ( "fmt" "reflect" ) // BiMapper is a bi-directional (or bijective) mapper of a tuple of values (up) // to another tuple of values (down). type BiMapper struct { UpTypes []reflect.Type DownTypes []reflect.Type Downstream reflect.Value Upstream reflect.Value } // NewBiMapper creates a...
vendor/github.com/leanovate/gopter/bi_mapper.go
0.645343
0.471284
bi_mapper.go
starcoder
package core import ( "bytes" "github.com/pkg/errors" ) // EnsureValid ensures that Cache's invariants are respected. func (c *Cache) EnsureValid() error { // A nil cache is considered valid (though obviously that requires using // the GetEntries accessor). if c == nil { return errors.New("nil cache") } //...
pkg/synchronization/core/cache.go
0.732592
0.405802
cache.go
starcoder
package gsdflow // GetEdge returns the Edge from src to dst Vertex. // (Assume that there is no duplicate Edge for now.) func (g Graph) GetEdge(src, dst *Vertex) *Edge { slice := g.GetEdges() for _, edge := range *slice { if edge.(*Edge).Src == src && edge.(*Edge).Dst == dst { return edge.(*Edge) } } return...
graph/gsdflow/flow.go
0.873876
0.668999
flow.go
starcoder
package bdd import ( "github.com/onsi/gomega" ) // IsGreaterThan succeeds if actual is a greater than the passed-in number. var IsGreaterThan = &matcher{ minArgs: 1, maxArgs: 1, name: "IsGreaterThan", apply: func(actual interface{}, expected []interface{}) Result { return resultFromGomega(gomega.BeNumerical...
matcher_num.go
0.618204
0.582194
matcher_num.go
starcoder
package skiplist import ( "constraints" "github.com/Tv0ridobro/data-structure/math" "github.com/Tv0ridobro/data-structure/stack" "math/rand" ) // SkipList represents a skiplist // Zero value of SkipList is invalid skiplist, should be used only with New() or NewWithProbability() type SkipList[T constraints.Ordered...
skiplist/skiplist.go
0.75985
0.479016
skiplist.go
starcoder
package kubernetes import ( "fmt" "github.com/caos/orbos/internal/operator/common" "github.com/caos/orbos/mntr" "github.com/caos/orbos/pkg/kubernetes" ) type initializedMachines []*initializedMachine func (c initializedMachines) Len() int { return len(c) } func (c initializedMachines) Swap(i, j int) ...
internal/operator/orbiter/kinds/clusters/kubernetes/upgrade.go
0.520496
0.42913
upgrade.go
starcoder
package panorama import ( "math" "github.com/ftl/panacotta/core" ) func (p Panorama) fullRangeData() core.Panorama { if p.fft.Range.Width() == 0 || p.width == 0 { return core.Panorama{} } frequencyRange := p.fft.Range result := core.Panorama{ FrequencyRange: frequencyRange, VFO: p.vfo, Band...
core/panorama/fullrange.go
0.740737
0.460228
fullrange.go
starcoder
package heisenberg import ( "fmt" "math" "math/cmplx" ) const ( // CutoffPercent is the precent for sparse matrix cutoff CutoffPercent = .1 // CutoffSize is the size of a matrix row required for dense CutoffSize = 256 ) // Matrix128 is an algebriac matrix type Matrix128 struct { R, C int Matrix []interfa...
matrix.go
0.621771
0.46721
matrix.go
starcoder
package mapping import ( "bytes" "errors" "fmt" "math" enc "github.com/DataDog/sketches-go/ddsketch/encoding" "github.com/DataDog/sketches-go/ddsketch/pb/sketchpb" ) const ( A = 6.0 / 35.0 B = -3.0 / 5.0 C = 10.0 / 7.0 ) // CubicallyInterpolatedMapping is a fast IndexMapping that approximates the // memor...
ddsketch/mapping/cubically_interpolated_mapping.go
0.832951
0.498108
cubically_interpolated_mapping.go
starcoder
package slices import ( "errors" "reflect" "github.com/golodash/godash/internal" ) // This method is like Intersection except that it accepts comparator which is // invoked to compare elements of slices. The order and references of result // values are determined by the first slice. The comparator is invoked with...
slices/intersection_by.go
0.673729
0.417925
intersection_by.go
starcoder
package sparse import ( "math" "github.com/kzahedi/goent/sm" ) // ConditionalMutualInformation calculates the conditional mutual information with the given lnFunc function // I(X,Y|Z) = \sum_x,y, p(x,y,z) (lnFunc(p(x,y|z)) - lnFunc(p(x|z)p(y|z))) func ConditionalMutualInformation(pxyz sm.SparseMatrix, ln lnFunc)...
discrete/sparse/ConditionalMutualInformation.go
0.693577
0.404802
ConditionalMutualInformation.go
starcoder
package kmeans import ( "math" "math/rand" ) // Observation represents an data abstraction for an N-dimensional // observation with a label. type Observation struct { Point []float64 // The multi-dimentional point Label string // The label of the observation } // Clustered abstracts an observation with a clus...
kmeans.go
0.827967
0.813683
kmeans.go
starcoder
package iso20022 // Information about a securities account and its characteristics. type InvestmentAccount64 struct { // Name of the account. It provides an additional means of identification, and is designated by the account servicer in agreement with the account owner. Name *Max35Text `xml:"Nm,omitempty"` // Su...
InvestmentAccount64.go
0.673729
0.40592
InvestmentAccount64.go
starcoder
package diffdrive import ( "math" "time" ) type Robot struct { State // Mass (kg). M float64 // Inertia (kgm2). I float64 // Wheel radius (m). R float64 // Axle radius (m). L float64 } // Returns a new robot. func NewRobot(mass, wheelRadius, axleRadius float64) *Robot { robot := &Robot{ M: mass, ...
diffdrive.go
0.902025
0.549157
diffdrive.go
starcoder
package tiledb /* #cgo LDFLAGS: -ltiledb #include <tiledb/tiledb.h> #include <stdlib.h> */ import "C" import ( "fmt" "os" "runtime" "unsafe" ) /* ArraySchema Schema describing an array. The schema is an independent description of an array. A schema can be used to create multiple array’s, and stores information ...
array_schema.go
0.599368
0.436502
array_schema.go
starcoder
package mapval import ( "reflect" "sort" "strings" "github.com/elastic/beats/libbeat/common" ) // Is creates a named IsDef with the given checker. func Is(name string, checker ValueValidator) IsDef { return IsDef{name: name, checker: checker} } // Optional wraps an IsDef to mark the field's presence as option...
vendor/github.com/elastic/beats/libbeat/common/mapval/core.go
0.826397
0.477006
core.go
starcoder
package a_alg import "fmt" type cells2D [][]*Cell2D type Grid2D struct { Start *Cell2D Finish *Cell2D Content cells2D YLen int XLen int } func (this Grid2D) GetStart() Cell { return this.Start } func (this Grid2D) GetFinish() Cell { return this.Finish } func (this Grid2D) String() string { retur...
src/a_alg/Grid2D.go
0.610337
0.544256
Grid2D.go
starcoder
package types import ( "github.com/pkg/errors" ) // ErrInvalidSenseSequence is an error when the sense sequence is structured wrong var ErrInvalidSenseSequence = errors.New("invalid sense sequence") type withSenseSequence struct { SenseSequence SenseSequence `json:"sseq"` } // SenseSequence https://dictionaryapi....
merriam-webster/types/sseq.go
0.711331
0.400339
sseq.go
starcoder
package lua import ( "math" "math/rand" ) const radiansPerDegree = math.Pi / 180.0 func mathUnaryOp(f func(float64) float64) Function { return func(l *State) int { l.PushNumber(f(CheckNumber(l, 1))) return 1 } } func mathBinaryOp(f func(float64, float64) float64) Function { return func(l *State) int { l....
math.go
0.593845
0.507751
math.go
starcoder
package coretypes import ( "encoding/binary" "math/big" ) const ( Data byte = 0 Type byte = 1 Code byte = 0 DepGroup byte = 1 Byte32Size = 32 HashSize = 32 OutPointSize = 36 CellInputSize = 44 CellDepSize = 37 RawHeaderSize = 192 HeaderSize = ...
pkg/coretypes/types.go
0.652241
0.419886
types.go
starcoder
package serialize_and_deserialize_binary_tree import ( "bytes" "container/list" "strconv" "strings" ) /* 297. 二叉树的序列化与反序列化 https://leetcode-cn.com/problems/serialize-and-deserialize-binary-tree 序列化是将一个数据结构或者对象转换为连续的比特位的操作,进而可以将转换后的数据存储在一个文件或者内存中, 同时也可以通过网络传输到另一个计算机环境,采取相反方式重构得到原数据。 请设计一个算法来实现二叉树的序列化与反序列化。这里不限定你的...
solutions/serialize-and-deserialize-binary-tree/d.go
0.571767
0.468365
d.go
starcoder
package main import ( "bytes" "fmt" "io/ioutil" "os" "path" "path/filepath" "strings" // Caltech Library Package "github.com/caltechlibrary/cli" "github.com/caltechlibrary/cli/pkgassets" ) var ( synopsis = ` _pkgassets_ generates Go code for mapping path to text assets ` description = ` _pkgassets_ gene...
cmd/pkgassets/pkgassets.go
0.60054
0.525795
pkgassets.go
starcoder
package cmd import ( "bytes" "fmt" "github.com/olekukonko/tablewriter" "github.com/spf13/cobra" ) /* This "script" generates markdown that can be interpreted by the Slate (https://github.com/lord/slate) format. Use this to script to generate the documentation needed. */ // Uses portions of the help / cmd outp...
cmd/cli-documentation.go
0.588534
0.415521
cli-documentation.go
starcoder
package util import ( "crypto/sha256" "fmt" "github.com/btcsuite/btcd/wire" "github.com/mit-dci/utreexo/accumulator" ) type Hash [32]byte //simutil.Hash is just [32]byte var MainnetGenHash = Hash{ 0x6f, 0xe2, 0x8c, 0x0a, 0xb6, 0xf1, 0xb3, 0x72, 0xc1, 0xa6, 0xa2, 0x46, 0xae, 0x63, 0xf7, 0x4f, 0x93, 0x1e, 0x83...
util/types.go
0.540681
0.407982
types.go
starcoder
package main type AvlTree struct { root *TreeNode } func NewAvlTree() *AvlTree { return new(AvlTree) } func height(node *TreeNode) int { if node == nil { return 0 } return max(height(node.left), height(node.right)) } func max(a, b int) int { if a > b { return a } return b } func getBalance(node *TreeNo...
AvlTree/AvlTree.go
0.806815
0.492615
AvlTree.go
starcoder
package awscron import ( "fmt" "strconv" "strings" ) var intToDayWeekName = map[int]string{ 1: "Sunday", 2: "Monday", 3: "Tuesday", 4: "Wednesday", 5: "Thursday", 6: "Friday", 7: "Saturday", } var intToMonthName = map[int]string{ 1: "January", 2: "February", 3: "March", 4: "April", 5: "May", 6: ...
src/aws_cron/translator.go
0.564098
0.417093
translator.go
starcoder
package expression import ( "fmt" "time" "github.com/puppetlabs/wash/api/rql" "github.com/puppetlabs/wash/api/rql/internal/primary/meta" "github.com/puppetlabs/wash/plugin" "github.com/shopspring/decimal" ) /* Atom wraps p into a type that works with predicate expressions. The RQL will use this to call p's app...
api/rql/internal/predicate/expression/atom.go
0.796767
0.425426
atom.go
starcoder
package granularity import ( "encoding/json" "math" "time" "github.com/rickb777/date/period" ) var ( //OneMin is a static def for the 1 minute granularity string OneMin Granularity = newGranularity("PT1M") //FiveMin is a static def for the 5 minute granularity string FiveMin Granularity = newGranularity("PT5...
telemetry/query/granularity/granularity.go
0.635449
0.443781
granularity.go
starcoder
package redblack import ( "fmt" "reflect" ) // Tree contains a reference to the root of the Red-Black tree type Tree struct { Root *Node } // NewTree returns an empty red-black tree reference. func NewTree() *Tree { return &Tree{} } // Get searches a Red-Black Tree for a target, returns node ptr and boolean ind...
redblack/redblack.go
0.724091
0.412885
redblack.go
starcoder
package qppb import ( "github.com/snowzach/queryp" structpb "google.golang.org/protobuf/types/known/structpb" ) func QueryParametersPB(qp *queryp.QueryParameters) *QueryParameters { return &QueryParameters{ Filter: FilterPB(qp.Filter), Sort: SortPB(qp.Sort), Options: qp.Options, Limit: qp.Limit, O...
qppb/qppb.go
0.574395
0.427038
qppb.go
starcoder
package forGraphBLASGo import ( "github.com/intel/forGoParallel/parallel" "github.com/intel/forGoParallel/pipeline" ) type vectorEWiseMultBinaryOp[Dw, Du, Dv any] struct { op BinaryOp[Dw, Du, Dv] u *vectorReference[Du] v *vectorReference[Dv] } func newVectorEWiseMultBinaryOp[Dw, Du, Dv any]( op BinaryOp[Dw, ...
functional_Vector_ComputedEWise.go
0.547948
0.464902
functional_Vector_ComputedEWise.go
starcoder
package statext import ( "math" "golang.org/x/exp/rand" "gonum.org/v1/gonum/mathext" "gonum.org/v1/gonum/stat/combin" ) // BetaBinomial implements the beta-binomial distribution, a discrete probability distribution // that expresses the probability of a given number of successful Bernoulli trials // out of a to...
betabinomial.go
0.785309
0.636748
betabinomial.go
starcoder
package internal import ( "fmt" "math" "reflect" "github.com/lyraproj/dgo/dgo" ) // CheckAssignableTo checks if the given type t implements the ReverseAssignable interface and if // so, returns the value of calling its AssignableTo method with the other type as an // argument. Otherwise, this function returns fa...
internal/type.go
0.790328
0.439868
type.go
starcoder
package storetests import ( "testing" "time" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" "github.com/mattermost/focalboard/server/model" "github.com/mattermost/focalboard/server/services/store" "github.com/mattermost/focalboard/server/utils" ) func StoreTestNotificationHintsSt...
server/services/store/storetests/notificationhints.go
0.501709
0.461988
notificationhints.go
starcoder
package handshake import ( "bytes" ) /* epoch: A counter value that is incremented on every cipher state change; initially zero and incremented each time a ChangeCipherSpec message is sent. sequenceNumber: explicit sequence number; Sequence numbers are maintained separately for each epoch, with each seq...
handshake/dtlsRecord.go
0.599837
0.420838
dtlsRecord.go
starcoder
// Package reflect provides a mockable wrapper for reflect. package reflect import ( reflect "reflect" unsafe "unsafe" ) var _ Interface = &Impl{} var _ = reflect.Append type Interface interface { Append(s reflect.Value, x ...reflect.Value) reflect.Value AppendSlice(s reflect.Value, t reflect.Value) reflect.Val...
reflect/reflect.go
0.703651
0.543227
reflect.go
starcoder
package core import ( "image/color" "math" "github.com/fogleman/gg" ) const CellSize = 10 const WallThickness = 2.0 func (g Grid) backgroundColor(c *Cell) (float64, float64, float64) { distance, found := g.Distances.distanceTo(c) if found { _, maximum := g.Distances.Max() intensity := float64(maximum-dista...
core/png.go
0.733738
0.404978
png.go
starcoder
// Package search implements the DLNA query language, defined in the ContentDirectory spec. package search import ( "errors" "fmt" "strings" ) type ( // Criteria is a `searchCrit` from the ContentDirectory specification. Criteria interface { Criteria() Criteria String() string } // Everything matches eve...
upnpav/contentdirectory/search/api.go
0.776029
0.453262
api.go
starcoder
package ltree import "math" // Undilate deinterleaves word using shift-or algorithm. func Undilate(x uint64) uint64 { x = (x | (x >> 1)) & 0x33333333 x = (x | (x >> 2)) & 0x0F0F0F0F x = (x | (x >> 4)) & 0x00FF00FF x = (x | (x >> 8)) & 0x0000FFFF return (x & 0x0000FFFF) } // Decode retrieves column major positio...
ltree/ltree.go
0.784443
0.649092
ltree.go
starcoder
package imageutil import ( "fmt" "image" "image/color" "strings" "github.com/grokify/simplego/image/colors" "golang.org/x/image/draw" ) func OverlayCenterYLeftAlign(imgBg, imgOver image.Image) image.Image { output := image.NewRGBA(imgBg.Bounds()) draw.Draw(output, imgBg.Bounds(), imgBg, image.ZP, draw.Src) ...
image/imageutil/combine.go
0.642993
0.468669
combine.go
starcoder
package year2020 import ( "fmt" "regexp" "strings" "github.com/dhruvmanila/advent-of-code/go/util" ) var passwordRegex = regexp.MustCompile(`(\d+)-(\d+) ([a-z]): ([a-z]+)`) type password struct { // min and max are the lowest and highest number of times a given letter // must appear for the password to be val...
go/year2020/sol02.go
0.555194
0.457924
sol02.go
starcoder
package square // Defines parameters in a [CreateSubscription](#endpoint-subscriptions-createsubscription) endpoint request. type CreateSubscriptionRequest struct { // A unique string that identifies this `CreateSubscription` request. If you do not provide a unique string (or provide an empty string as the value), t...
square/model_create_subscription_request.go
0.874908
0.41324
model_create_subscription_request.go
starcoder
package kronasje import ( "time" "log" . "github.com/nlnwa/kronasje/time" ) type Schedule interface { Next(now time.Time) time.Time } type bitCron struct { minute, hour, dom, month, dow uint64 } // diff answers the question: How many times must the given value's bit field // be shifted (and possibly wrapped) ...
scheduler.go
0.675658
0.598987
scheduler.go
starcoder
package input import ( "context" "errors" "io" "sync" "time" "github.com/Jeffail/benthos/v3/internal/codec" "github.com/Jeffail/benthos/v3/internal/docs" sftpSetup "github.com/Jeffail/benthos/v3/internal/service/sftp" "github.com/Jeffail/benthos/v3/lib/input/reader" "github.com/Jeffail/benthos/v3/lib/log" ...
lib/input/sftp.go
0.622115
0.468
sftp.go
starcoder
package main import ( "context" "flag" "fmt" "io/ioutil" "strconv" "strings" "github.com/lizthegrey/adventofcode/2021/trace" "go.opentelemetry.io/otel" //"go.opentelemetry.io/otel/attribute" ) var inputFile = flag.String("inputFile", "inputs/day22.input", "Relative file path to use as input.") var tr = ote...
2021/day22.go
0.547222
0.408395
day22.go
starcoder
package strutil import ( "bytes" "math" "strings" ) const ( fingerNum = 10 zeroChr = '0' ) // Reverse is a function that returns a string in reverse order. func Reverse(s string) string { runes := []rune(s) for i, j := 0, len(runes)-1; i < j; i, j = i+1, j-1 { runes[i], runes[j] = runes[j], runes[i] } r...
strutil/strconv.go
0.715623
0.459864
strconv.go
starcoder
package openapi import ( "encoding/json" ) // PipelineStep Step creates a pipeline step. type PipelineStep struct { // ID of the step template. Id string `json:"id"` // Title for the step. Overrides the default title. Title *string `json:"title,omitempty"` // Description for the step. Overrides the default des...
internal/openapi/model_pipeline_step.go
0.794106
0.44077
model_pipeline_step.go
starcoder
// Package gf256 implements arithmetic over the finite field GF[2⁸] as well as // over the polynomial ring with coefficients in GF[2⁸]. package gf256 import "fmt" // Num is a bit-vector representation of the polynomial used to represent // numbers in GF[2⁸]. Concretely, values of Num will be unsigned integers // bet...
field.go
0.783036
0.68956
field.go
starcoder
package day5 import ( "fmt" "regexp" "ryepup/advent2021/utils" ) type vent struct { start, end point IsHorizontal, IsVertical, IsDiagonal bool } func (v vent) String() string { return fmt.Sprintf("%v -> %v", v.start, v.end) } func NewVent(x1, y1, x2, y2 int) vent { return vent{ st...
day5/vent.go
0.658088
0.461927
vent.go
starcoder
package mysql import ( . "github.com/aktau/gomig/db/common" "log" "regexp" "strconv" "strings" ) func MysqlToGenericType(mysqlType string) *Type { rt := mysqlType switch { case rt == "set": return SetType() case rt == "date": return DateType() case rt == "time": return TimeType() case rt == "datetime...
db/mysql/util.go
0.565539
0.433382
util.go
starcoder
package transaction import ( "github.com/ethereum/go-ethereum/rlp" "math/big" ) // CreateSwapPoolData is a Data of Transaction for creating a liquidity pool for two coins, in volumes specified within this transaction. The volumes will be withdrawn from your balance according to the figure you've specified in the tr...
transaction/swap_pool.go
0.888202
0.635929
swap_pool.go
starcoder
package server import ( "math" "sync/atomic" ) const ( gcTick uint64 = 2 ) type followerState struct { tick uint64 inMemLogSize uint64 } // RateLimiter is the struct used to keep tracking the in memory rate log size. type RateLimiter struct { size uint64 tick uint64 maxSize ...
internal/server/rate.go
0.726717
0.410697
rate.go
starcoder
package form import ( "os" "path/filepath" "strings" tea "github.com/charmbracelet/bubbletea" "github.com/muesli/termenv" ) // NOTE that even though completions are I/O, we want them to block so other // events aren't processed until the completion. type Completions interface { Suggest(value string) []string ...
cli/internal/commands/run/form/completion.go
0.534127
0.458591
completion.go
starcoder
package cc import ( "log" "strconv" "strings" ) //String provides helper function when reading problem data from string. type String string //String convert the value into a standard string func (s String) String() string { return string(s) } //Int convert the value into an int func (s String) Int() int { v, ...
string.go
0.62681
0.460107
string.go
starcoder
package week6 import ( "fmt" "math/big" ) // Factor factorizes an RSA modulus when the primes are too close. // We assume that |p-q| < 2 * N^(1/4). func Factor(n *big.Int) (*big.Int, *big.Int) { a := calcA(n) x := calcX(a, n) return calcFactors(a, x) } // Factor2 factorizes an RSA modulus when the primes are cl...
crypto1/week6/factor.go
0.79956
0.637849
factor.go
starcoder
package main import ( "bufio" "fmt" "math" "os" "strconv" "strings" "time" ) const ( RightBottomDiagonal = "RightBottomDiagonal" RightTopDiagonal = "RightTopDiagonal" LeftBottomDiagonal = "LeftBottomDiagonal" LeftTopDiagonal = "LeftTopDiagonal" Bottom = "Bottom" Top =...
basic/costmarking/costmarking.go
0.671363
0.435301
costmarking.go
starcoder
package predicate import ( pipeline "github.com/ccremer/go-command-pipeline" ) type ( // Predicate is a function that expects 'true' if a pipeline.ActionFunc should run. // It is evaluated lazily resp. only when needed. Predicate func(ctx pipeline.Context) bool ) // ToStep wraps the given action func in its own ...
predicate/predicate.go
0.830903
0.400867
predicate.go
starcoder
package cc import ( "fmt" "strconv" "strings" ) // Board represents a chess board. It contains columns*rows cells that can be // occupied by pieces. type Board struct { columns uint8 rows uint8 cells [][]cell } // NewBoard creates a new board of dimensions (columns*rows) with only // empty cells. func New...
board.go
0.728555
0.50061
board.go
starcoder
package geometry import ( "fmt" "math" "github.com/wdevore/RangerGo/api" ) type rectangle struct { // Top-left corner min api.IPoint // Bottom-right corner max api.IPoint width float64 height float64 } // NewRectangle constructs a new IRectangle func NewRectangle() api.IRectangle { o := new(rectangle) ...
engine/geometry/rectangle.go
0.873687
0.479869
rectangle.go
starcoder
package gease import ( "time" "gioui.org/f32" ) // PointEasing soothly animates a 2D-position. type PointEasing struct { target f32.Point x, y *interpolator last time.Time } // Point creaes a new PointEasing. func Point(pos f32.Point) *PointEasing { es := &PointEasing{target: pos, x: interp(float64(pos...
point.go
0.852137
0.598928
point.go
starcoder
package devices import ( "context" "crypto/sha256" "encoding/base64" "math/rand" "net/http" "time" "github.com/ant0ine/go-json-rest/rest" jwtgo "github.com/dgrijalva/jwt-go" petname "github.com/dustinkirkland/golang-petname" "gitlab.com/pantacor/pantahub-base/utils" "go.mongodb.org/mongo-driver/bson/primi...
devices/post-tokens.go
0.679285
0.459682
post-tokens.go
starcoder
package evaluator import ( "dara/ast" "fmt" "math" ) var ( NIL = &Nil{} TRUE = &Boolean{Value: true} FALSE = &Boolean{Value: false} ) func Eval(node ast.Node, env *Environment) Object { switch node := node.(type) { // Statements case *ast.Program: return evalProgram(node, env) case *ast.ExpressionSta...
evaluator/evaluator.go
0.622689
0.495545
evaluator.go
starcoder
package flip import ( "crypto/hmac" "crypto/rand" "encoding/hex" "fmt" "time" ) func (g GameID) String() string { return hex.EncodeToString(g) } func (u UID) String() string { return hex.EncodeToString(u) } func (d DeviceID) String() string { return hex.Enco...
go/chat/flip/types.go
0.673192
0.422266
types.go
starcoder
package data import ( "fmt" "math/rand" "regexp" "strconv" "strings" ) var ( // ErrorNotSupported means the part type is not supported ErrorNotSupported = fmt.Errorf("part type is not supported") ) // PartType is a type of a part type PartType int const ( // PartTypeLiteral is a literal part type PartType...
vendor/github.com/mashling-support/injectsec/data/parts.go
0.55929
0.538073
parts.go
starcoder
package tictactoe import ( "fmt" "strings" ) // State of a board cell. type State uint8 // States of a board cell. const ( F State = iota // Free cell. X // Cell with an X mark. O // Cell with an O mark. ) // Player X or O player type Player uint8 // Players const ( XPlayer Player =...
pkg/tictactoe/tictactoe.go
0.548674
0.481271
tictactoe.go
starcoder
package frontend import ( "image/color" "fyne.io/fyne" "fyne.io/fyne/theme" ) type toopieTheme struct{} func (toopieTheme) BackgroundColor() color.Color { return &color.RGBA{R: 0xf8, G: 0xf9, B: 0xfa, A: 0xff} } func (toopieTheme) ButtonColor() color.Color { return &color.RGBA{R: 0x36, G: 0x3a, B: 0x68, A: 0x...
frontend/theme.go
0.639286
0.458652
theme.go
starcoder
package asig type aiReturn int32 const ( //Indicates that a function was successful aiReturnSuccess = 0x0 //Indicates that a function failed aiReturnFailure = -0x1 //Indicates that not enough memory was available to perform the requested operation aiReturnOutofMemory = -0x3 ) type SceneFlag int32 const ( /...
asig/enums.go
0.811303
0.527134
enums.go
starcoder
package feature import ( "math" "strconv" ) type FeatureType int const ( Continuous FeatureType = iota Discrete ) type Feature struct { Type FeatureType Name string Create Create CreateContinuous CreateContinuous CreateDiscrete CreateDiscrete } type Instance struct { F...
feature/feature.go
0.525369
0.494629
feature.go
starcoder
package main import ( "math/rand" "time" ) // TileType identifies the type of the tile on the map type TileType = int const ( // TileEmpty identifies an empty tile TileEmpty TileType = iota // TileMetal identifies a tile with metal TileMetal // TileWater identifies a tile with water TileWater // TileCarbon ...
game.go
0.591605
0.601711
game.go
starcoder
package game import ( "fmt" term "github.com/nsf/termbox-go" ) // CardIdx is used to represent a card on the field. type CardIdx struct { Row int Column int } // State represents the current state of the game type State struct { field Field deck []*Card selected []CardIdx score int godModeEnabled bo...
game/game.go
0.644449
0.417153
game.go
starcoder
package processor import ( "errors" "fmt" "os" "path/filepath" "time" "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" // SA1019 Ignore deprecation warning until we can switch to "goog...
lib/processor/protobuf.go
0.76882
0.653224
protobuf.go
starcoder
package phys import ( "fmt" "phys/transform" "phys/vect" "time" ) // Used to keep a linked list of all arbiters on a body. type ArbiterEdge struct { Arbiter *Arbiter Next, Prev *ArbiterEdge Other *Body } type arbiterState int const ( arbiterStateFirstColl = iota arbiterStateNormal arbiterStateIgn...
vendor/phys/arbiter.go
0.690142
0.493958
arbiter.go
starcoder
package types import ( "github.com/pkg/errors" abci "github.com/hdac-io/tendermint/abci/types" "github.com/hdac-io/tendermint/crypto/tmhash" cmn "github.com/hdac-io/tendermint/libs/common" ) const ( // MaxBlockSizeBytes is the maximum permitted size of the blocks. MaxBlockSizeBytes = 104857600 // 100MB // Bl...
types/params.go
0.754192
0.410993
params.go
starcoder
package v1alpha1 import ( v1alpha1 "github.com/triggermesh/triggermesh/pkg/apis/flow/v1alpha1" "k8s.io/apimachinery/pkg/api/errors" "k8s.io/apimachinery/pkg/labels" "k8s.io/client-go/tools/cache" ) // XSLTTransformLister helps list XSLTTransforms. // All objects returned here must be treated as read-only. type X...
pkg/client/generated/listers/flow/v1alpha1/xslttransform.go
0.602062
0.42925
xslttransform.go
starcoder
package selection import ( "fmt" "sync" "github.com/loveandpeople-DAG/goHive/autopeering/distance" "github.com/loveandpeople-DAG/goHive/autopeering/peer" "github.com/loveandpeople-DAG/goHive/identity" ) type Neighborhood struct { neighbors []peer.PeerDistance size int mu sync.RWMutex } func NewN...
autopeering/selection/neighborhood.go
0.635562
0.422266
neighborhood.go
starcoder
package retry import ( cryptoRand "crypto/rand" "fmt" "io" "math" "math/big" mathRand "math/rand" "os" "time" ) // Delay defines a backoff / delay strategy for retrying type Delay func(iteration int) time.Duration // Exponential creates an exponential backoff delay, which uses the following sequence: // [ 1,...
delay.go
0.859192
0.417153
delay.go
starcoder
// Package doc implements the ``go doc'' command. package doc import ( "cmd/go/internal/base" "cmd/go/internal/cfg" ) var CmdDoc = &base.Command{ Run: runDoc, UsageLine: "go doc [-u] [-c] [package|[package.]symbol[.methodOrField]]", CustomFlags: true, Short: "show documentation for package or s...
src/cmd/go/internal/doc/doc.go
0.629205
0.414958
doc.go
starcoder
package plaid import ( "encoding/json" ) // APR Information about the APR on the account. type APR struct { // Annual Percentage Rate applied. AprPercentage float32 `json:"apr_percentage"` // The type of balance to which the APR applies. AprType string `json:"apr_type"` // Amount of money that is subjected to...
plaid/model_apr.go
0.680666
0.516291
model_apr.go
starcoder
package main import( "image/color" "log" "math/rand" "time" "github.com/hajimehoshi/ebiten" ) const ( width = 100 height = 50 ) var ( size = width * height pixels = make([]byte, size * 4) firePixel = make([]byte, size) fireColorPalette = []color.RGBA{ {R: 7, G: 7, B: 7}, {R: 31, G: 7, B: 7}, ...
Golang/main.go
0.522202
0.500244
main.go
starcoder
package bloomfilter import ( "encoding/binary" "math" "sync" ) type BloomFilter struct { m uint32 k int buckets []uint32 lock sync.RWMutex } // New creates a new bloom filter. m should specify the number of bits. // m is rounded up to the nearest multiple of 32. // k specifies the number of has...
bloomfilter.go
0.692122
0.404037
bloomfilter.go
starcoder
package scsu const ( /** Single Byte mode command values */ /** SQ<i>n</i> Quote from Window . <p> If the following byte is less than 0x80, quote from static window <i>n</i>, else quote from dynamic window <i>n</i>. */ SQ0 = 0x01 // Quote from window pair 0 SQ1 = 0x02 // Quote from window pair 1 SQ2 = 0x...
scsu.go
0.535341
0.40869
scsu.go
starcoder
package contracts import ( "context" "fmt" "reflect" "sync" "testing" "github.com/adamluzsi/frameless" "github.com/adamluzsi/frameless/cache" "github.com/adamluzsi/frameless/contracts" "github.com/adamluzsi/frameless/contracts/assert" "github.com/adamluzsi/frameless/extid" "github.com/adamluzsi/frameless/i...
cache/contracts/Storage.go
0.574275
0.458349
Storage.go
starcoder
package utils import ( "image/color" "time" "github.com/notargets/avs/functions" "github.com/notargets/avs/chart2d" utils2 "github.com/notargets/avs/utils" graphics2D "github.com/notargets/avs/geometry" ) type ColorName uint8 const ( White ColorName = iota Blue Red Green Black ) func GetColor(name Col...
utils/graphics.go
0.63443
0.45175
graphics.go
starcoder
package wimatrix import ( "image/color" "time" ) type eventType int const ( eventMessage eventType = iota eventTextColor eventType = iota eventBGColor eventType = iota eventTextBrightness eventType = iota eventBGBrightness eventType = iota eventNewSub eventType = iota eventNewFo...
wimatrix/events.go
0.58059
0.437643
events.go
starcoder
package geom import ( "github.com/go-gl/mathgl/mgl32" ) type Transform struct { position Vec3 scale Vec3 orientation Quat matrix *Mat4 } func NewTransform() Transform { return Transform{ position: Vec3{0, 0, 0}, scale: Vec3{1, 1, 1}, orientation: mgl32.QuatIdent(), } } // SetPosi...
transform.go
0.908214
0.641507
transform.go
starcoder
package gofa // SOFA Precession / Nutation / Polar Motion /* Bi00 Frame bias components, IAU 2000 Frame bias components of IAU 2000 precession-nutation models; part of the Mathews-Herring-Buffett (MHB2000) nutation series, with additions. Returned: dpsibi,depsbi float64 longitude and obliquity corrections...
pn.go
0.857798
0.659583
pn.go
starcoder
package anchoring import ( "github.com/Azbesciak/RealDecisionMaker/lib/model" ) //go:generate easytags $GOFILE json:camel type InlineAnchoringApplier struct { } const InlineAnchoringApplierName = "inline" func (i *InlineAnchoringApplier) Identifier() string { return InlineAnchoringApplierName } type InlineAnchor...
lib/logic/biases/anchoring/inline-anchoring-applier.go
0.508056
0.421969
inline-anchoring-applier.go
starcoder
package openapi import ( "encoding/json" "fmt" "net/url" "strings" "github.com/twilio/twilio-go/client" ) // Optional parameters for the method 'CreateParticipant' type CreateParticipantParams struct { // The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that will create the resource. Pat...
rest/api/v2010/accounts_conferences_participants.go
0.725357
0.407746
accounts_conferences_participants.go
starcoder
package inventory import ( "fmt" "github.com/Jim3Things/CloudChamber/simulation/internal/common" "github.com/Jim3Things/CloudChamber/simulation/internal/services/inventory/messages" "github.com/Jim3Things/CloudChamber/simulation/pkg/errors" pb "github.com/Jim3Things/CloudChamber/simulation/pkg/protos/inventory" ...
simulation/internal/services/inventory/cable.go
0.643777
0.490541
cable.go
starcoder
package geom import "math" // PointEmptyCoordHex is the hex representation of a NaN that represents // an empty coord in a shape. const PointEmptyCoordHex = 0x7FF8000000000000 // PointEmptyCoord is the NaN float64 representation of the empty coordinate. func PointEmptyCoord() float64 { return math.Float64frombits(P...
point.go
0.918599
0.676688
point.go
starcoder
package pktesting import ( "github.com/peake100/gRPEAKEC-go/pkerr" "github.com/stretchr/testify/assert" "google.golang.org/grpc/codes" "testing" ) type TraceInfoAssert struct { assertions *assert.Assertions traceInfo *pkerr.TraceInfo index int } func (traceAssert *TraceInfoAssert) AppName(expected string...
pktesting/assertErr.go
0.662906
0.644603
assertErr.go
starcoder
// Package geometry draws some geometric tests. package geometry import ( "image" "image/color" "math" "github.com/3dsinteractive/draw2d" "github.com/3dsinteractive/draw2d/draw2dkit" "github.com/3dsinteractive/draw2d/samples" "github.com/3dsinteractive/draw2d/samples/gopher2" ) // Main draws geometry and ret...
samples/geometry/geometry.go
0.799207
0.653293
geometry.go
starcoder
package dijkstra // Topology represents a network topology type Topology struct { nodes map[Node]int64 edges map[Node]map[Node]int64 } // Node represents a node in a graph type Node struct { Name string } // Edge represents a directed edge in a graph type Edge struct { NodeA Node NodeB Node Distance int6...
util/dijkstra/dijkstra.go
0.705684
0.571348
dijkstra.go
starcoder