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 camera import ( "github.com/alexandreLamarre/Golang-Ray-Tracing-Renderer/pkg/algebra" "github.com/alexandreLamarre/Golang-Ray-Tracing-Renderer/pkg/canvas" "github.com/alexandreLamarre/Golang-Ray-Tracing-Renderer/pkg/geometry" "math" ) var RECURSIONDEPTH int = 3 //Camera describes a camera object that ren...
pkg/camera/camera.go
0.829803
0.555918
camera.go
starcoder
package cell import ( "math" "github.com/wdevore/Deuron8-Go/neuron_simulation/api" "github.com/wdevore/Deuron8-Go/neuron_simulation/model" ) // Dendrite is part of a compartment type Dendrite struct { soma api.ISoma simJ *model.SimJSON simModel api.IModel taoEff float64 // Minimum value. Typically 0.0...
neuron_simulation/cell/dendrite.go
0.732113
0.453625
dendrite.go
starcoder
package bigc import ( "errors" "fmt" "go/ast" "go/parser" "go/token" "math/big" "strconv" "strings" ) // A BigC object represents a rational complex number. // BigCは複素数を表します type BigC struct { re *big.Rat im *big.Rat } // NewBigC creates a new BigC with real-part r and imaginary-part i. func NewBigC(r *big...
bigc.go
0.731155
0.433981
bigc.go
starcoder
// Package graphic provides simple BLAST report graphic rendering. package graphic import ( "fmt" "image/color" "math" "github.com/biogo/ncbi/blast" "gonum.org/v1/plot/vg" ) const maxInt = int(^uint(0) >> 1) var ( black = color.RGBA{R: 0x00, G: 0x00, B: 0x00, A: 0xff} purple = color.RGBA{R: 0xc4, G: 0x00,...
blast/graphic/graphic.go
0.748076
0.428353
graphic.go
starcoder
package flightid import( "fmt" "math" "math/rand" "sort" "github.com/skypies/geo" ) // Randomness in public: Fri Mar 17, 18:00, until Sat Mar 18, 11:00 // Selector is a role for things (algorithms) that can select a problem aircraft from an airspace type Selector interface { String() string // Pick out the n...
flightid/selector.go
0.657758
0.440289
selector.go
starcoder
package grpc import ( "fmt" "reflect" "strconv" "strings" "google.golang.org/grpc/status" "github.com/golang/protobuf/proto" "github.com/pkg/errors" "github.com/zoncoen/scenarigo/assert" "github.com/zoncoen/scenarigo/context" "github.com/zoncoen/yaml" ) // Expect represents expected response values. type ...
protocol/grpc/expect.go
0.624866
0.406509
expect.go
starcoder
package byteorder import "math" var _ = (BigEndian)(nil) // BE is an Alias for BigEndian. type BE = BigEndian // BigEndian defines big-endian serialization. type BigEndian []byte // ReadUint16 reads the first 2 bytes. Panics when len(b) < 2. func (b BigEndian) ReadUint16() uint16 { _ = b[1] // bounds check hint t...
bigendian.go
0.621885
0.5835
bigendian.go
starcoder
package iso20022 // Conversion between the currency of a card acceptor and the currency of a card issuer, provided by a dedicated service provider. The currency conversion has to be accepted by the cardholder. type CurrencyConversion6 struct { // Identification of the currency conversion operation for the service pr...
CurrencyConversion6.go
0.810028
0.567277
CurrencyConversion6.go
starcoder
package poly import ( "fmt" "math/rand" "strings" ) // Int64M is a matrix with polynomial elements that have int64 terms and coefficients. // The matrix itself is implemented as a dense representation, i.e. all elements are stored. type Int64M struct { // Elements contains the actual elements, top-left to bottom...
go/poly/int64_m.go
0.676299
0.588091
int64_m.go
starcoder
package pgsql import ( "database/sql" "database/sql/driver" "strconv" ) // Float4ArrayFromFloat32Slice returns a driver.Valuer that produces a PostgreSQL float4[] from the given Go []float32. func Float4ArrayFromFloat32Slice(val []float32) driver.Valuer { return float4ArrayFromFloat32Slice{val: val} } // Float4A...
pgsql/float4arr.go
0.772616
0.525734
float4arr.go
starcoder
package waveforms import ( "errors" "math" "time" ) /** Waveforms is a simple library to generate wave formed signals with given amplitude, wavelength and phase for some period of time. This library is useful for generating of the sample time-series data i.e some metrics or stub telemetry. */ // generator is a pe...
waveforms.go
0.874198
0.667744
waveforms.go
starcoder
package d2 import ( "strconv" "strings" "github.com/adamcolton/geom/angle" "github.com/adamcolton/geom/calc/cmpr" "github.com/adamcolton/geom/geomerr" ) // V represents a Vector, the difference between two points. type V D2 // Pt converts a V to Pt func (v V) Pt() Pt { return Pt(v) } // V fulfills the Vector ...
d2/v.go
0.881104
0.565119
v.go
starcoder
package option import "math" type OptionType bool const ( CALL OptionType = true PUT OptionType = false ) // A probablity distribution of a value. type Distribution interface { // Probability density function. Pdf(value float64) float64 // Cumulative distribution function. Cdf(value float64) float64 } func ...
option/model.go
0.621426
0.443661
model.go
starcoder
package shape import ( "fmt" "math" "strings" "github.com/fogleman/gg" "github.com/golang/freetype/raster" ) // Quadratic represents a single quadratic bezier type Quadratic struct { X1, Y1 float64 X2, Y2 float64 X3, Y3 float64 Width float64 MinLineWidth float64 MaxLineWidth float...
primitive/shape/quadratic.go
0.687
0.547222
quadratic.go
starcoder
package clock import ( "strconv" "time" ) var datetimeLayouts = [48]string{ // Day first month 2nd abbreviated. "Mon, 2 Jan 2006 15:04:05 MST", "Mon, 2 Jan 2006 15:04:05 -0700", "Mon, 2 Jan 2006 15:04:05 -0700 (MST)", "2 Jan 2006 15:04:05 MST", "2 Jan 2006 15:04:05 -0700", "2 Jan 2006 15:04:05 -0700 (MST)", ...
vendor/github.com/vulcand/oxy/internal/holsterv4/clock/rfc822.go
0.623721
0.442396
rfc822.go
starcoder
package types import ( "regexp" "time" "github.com/pkg/errors" "github.com/shopspring/decimal" ) // CurrencyTime represents a currency denom and associated date type CurrencyTime struct { Cur string Date time.Time } // AmtCurTime represents a CurrencyTime and associated amount type AmtCurTime struct { CurTi...
types/currency.go
0.634883
0.551574
currency.go
starcoder
package feed_attributes import ( "math/big" "strconv" ) type Reputation int64 const REPUTATION_BASE = 100 var PostReputationCost Reputation = 10 * REPUTATION_BASE var ReplyReputationCost Reputation = 1 * REPUTATION_BASE var AduitReputationCost Reputation = 100 * REPUTATION_BASE func PenaltyForPostType(postT...
aws/go/src/feed/feed_attributes/reputation.go
0.625209
0.40642
reputation.go
starcoder
package ml import ( "math" "github.com/cpmech/gosl/chk" "github.com/cpmech/gosl/la" ) // PolyDataMapper maps features to expanded polynomial type PolyDataMapper struct { nOriFeatures int // number of original features nExtraFeatures int // number of added features iFeature int // selected iFeature to ...
ml/polydatamapper.go
0.621426
0.459197
polydatamapper.go
starcoder
package set_intersection_size_at_least_two import ( "container/list" "sort" ) /* 757. 设置交集大小至少为2 https://leetcode-cn.com/problems/set-intersection-size-at-least-two 一个整数区间 [a, b] ( a < b ) 代表着从 a 到 b 的所有连续整数,包括 a 和 b。 给你一组整数区间intervals,请找到一个最小的集合 S, 使得 S 里的元素与区间intervals中的每一个整数区间都至少有2个元素相交。 输出这个最小集合S的大小。 示例 1...
solutions/set-intersection-size-at-least-two/d.go
0.569613
0.468243
d.go
starcoder
package atlas import ( "math" "github.com/go-gl/gl/v4.5-core/gl" "github.com/wdevore/ranger/rendering" "github.com/wdevore/ranger/rmath" ) // BasicAtlas is an Atlas of basic vector shapes, for example, Square or Circle. type BasicAtlas struct { Atlas } // NewBasicAtlas creates a basic atlas. func NewBasicAtlas...
ranger/rendering/atlas/basic_atlas.go
0.845624
0.560072
basic_atlas.go
starcoder
package compress // DeltaStats is a histogram containing delta values which can be used // to compute various statistics of the delta distribution. type DeltaStats struct { hist, cSum []int nMin, nMax int64 } // Load loads an array into the DeltaStas array. It must be called // before other methods are called. func...
lib/compress/rotate.go
0.838779
0.703626
rotate.go
starcoder
package cntl // Equals returns whether the two given objects are equal func (v1 *SetList) Equals(v2 *SetList) bool { return v1.ID == v2.ID && v1.Name == v2.Name && songSelectorList(v1.Songs).Equals(songSelectorList(v2.Songs)) } // Equals returns whether the two given objects are equal func (v1 BarChange) Equals(...
pkg/cntl/types_equals.go
0.88382
0.545467
types_equals.go
starcoder
package common import ( "engo.io/engo" "engo.io/engo/math" "engo.io/gl" ) const ( orth = "orthogonal" iso = "isometric" ) // Level is a parsed TMX level containing all layers and default Tiled attributes type Level struct { // Orientation is the parsed level orientation from the TMX XML, like orthogonal, isom...
common/level.go
0.523664
0.563438
level.go
starcoder
package block import "fmt" // Colour represents the colour of a block. Typically, Minecraft blocks have a total of 16 different colours. type Colour struct { colour } // ColourWhite returns the white colour. func ColourWhite() Colour { return Colour{colour(0)} } // ColourOrange returns the orange colour. func Col...
server/block/colour.go
0.890282
0.69383
colour.go
starcoder
package chart import ( "fmt" "time" ) // MarketHoursRange is a special type of range that compresses a time range into just the // market (i.e. NYSE operating hours and days) range. type MarketHoursRange struct { Min time.Time Max time.Time MarketOpen time.Time MarketClose time.Time HolidayProvider HolidayP...
vendor/github.com/nicholasjackson/bench/vendor/github.com/wcharczuk/go-chart/market_hours_range.go
0.801237
0.487063
market_hours_range.go
starcoder
package blockchain import ( "fmt" "github.com/essentiaone/divid/txscript" "github.com/essentiaone/divid/wire" "github.com/essentiaone/btcutil" ) const ( // MaxBlockWeight defines the maximum block weight, where "block // weight" is interpreted as defined in BIP0141. A block's weight is // calculated as the s...
blockchain/weight.go
0.832883
0.460289
weight.go
starcoder
package main import ( "math" ) const ( avgWindSpeed = iota minWindSpeed maxWindSpeed temperature gas relativeHumidity pressure ) func eliminateOutliers(weather []Weather) []Weather { means := computeMeans(weather) stdDevs := computeStdDevs(weather, means) weather1 := make([]Weather, 0) for _, w := range...
server/stat.go
0.67405
0.484746
stat.go
starcoder
package models import ( i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91 "github.com/microsoft/kiota-abstractions-go/serialization" ) // FilterOperatorSchema type FilterOperatorSchema struct { Entity // Arity of the operator. Possible values are: Binary, Unary. The default is Binary. ...
models/filter_operator_schema.go
0.757346
0.409221
filter_operator_schema.go
starcoder
package svc import ( "math/big" "techpay-api-graphql/internal/types" "github.com/ethereum/go-ethereum/common" "github.com/ethereum/go-ethereum/common/hexutil" ) // handleFMintDeposit handles a new deposit on fMint contract. // event Deposited(address indexed token, address indexed user, uint256 amount) func hand...
internal/svc/logs_fmint.go
0.623377
0.452475
logs_fmint.go
starcoder
package _5_binarysearch // 二分查找的实现 func BinarySearch(a []int, v int) int { n := len(a) if n == 0 { return -1 } low := 0 high := n-1 for low <= high { mid := low + ((high - low) >> 1) if a[mid] == v { return mid } else if a[mid] > v { high = mid - 1 } else { low = mid + 1 } } return -1 } ...
data-structure/15_binarysearch/binarysearch.go
0.5083
0.445349
binarysearch.go
starcoder
package filter import ( "fmt" "github.com/tigrisdata/tigris/value" "google.golang.org/grpc/codes" "google.golang.org/grpc/status" ) const ( EQ = "$eq" GT = "$gt" ) // ValueMatcher is an interface that has method like Matches. type ValueMatcher interface { // Matches returns true if the receiver has the valu...
query/filter/comparison.go
0.807688
0.45847
comparison.go
starcoder
// Package module provides a test module that can be used in tests. package module import ( "testing" "time" "github.com/stretchrcom/testify/assert" "github.com/soumya92/barista/bar" ) // Time to wait for events that are expected. Overridden in tests. var positiveTimeout = time.Second // Time to wait for even...
testing/module/module.go
0.731826
0.691022
module.go
starcoder
package postgres import ( "fmt" "strings" "github.com/pkg/errors" "github.com/uncharted-distil/distil-compute/model" api "github.com/uncharted-distil/distil/api/model" ) const ( unnestedSuffix = "_unnested" ) // VectorField defines behaviour for any Vector type. type VectorField struct { BasicField Unneste...
api/model/storage/postgres/vector.go
0.711331
0.498291
vector.go
starcoder
package xpath import ( "bytes" "math" "strings" "unicode/utf8" "github.com/santhosh-tekuri/dom" ) // Arg defines the signature of a function argument. // It encapsulates: // - dataType of argument // - cardinality of argument type Arg int // Mandatory creates function argument which is mandatory // of given t...
functions.go
0.687735
0.436202
functions.go
starcoder
package tracee import ( "debug/dwarf" "encoding/binary" "fmt" "github.com/nkbai/tgo/log" ) // moduleData represents the value of the moduledata type. // It offers a set of methods to get the field value of the type rather than simply returns the parsed result. // It is because the moduledata can be large and the...
tracee/moduledata.go
0.513181
0.451871
moduledata.go
starcoder
package query // The Visitor interface allows to visit nodes for each respective part of the // query grammar. type Visitor interface { VisitNodes(v Visitor, node []Node) VisitOperator(v Visitor, kind operatorKind, operands []Node) VisitParameter(v Visitor, field, value string, negated bool, annotation Annotation) ...
internal/search/query/visitor.go
0.872551
0.601564
visitor.go
starcoder
package fn import ( "fmt" "log" "github.com/rwxrob/fn/each" ) // Number combines the primitives generally considered numbers by JSON // and other high-level structure data representations. type Number interface { int | int64 | int32 | int16 | int8 | uint64 | uint32 | uint16 | uint8 | float64 | float32 } // ...
fn.go
0.68458
0.488344
fn.go
starcoder
package parse import ( "math/rand" "time" "strings" ) func QuoteParserFactory(quoteChannelName string, QuotesMap map[string]interface{}, QuotesMapList []map[string]interface{}) map[string]interface{} { if strings.ToLower(quoteChannelName) == "programming" { return parseProgrammin...
backend/parse/quotesparser.go
0.530966
0.461563
quotesparser.go
starcoder
package resize import ( "image" "runtime" "sync" ) // An InterpolationFunction provides the parameters that describe an // interpolation kernel. It returns the number of samples to take // and the kernel function to use for sampling. type InterpolationFunction int // InterpolationFunction constants ...
vendor/github.com/nfnt/resize/resize.go
0.66236
0.492371
resize.go
starcoder
package cryptohelper import ( "crypto/aes" "crypto/cipher" "crypto/hmac" crand "crypto/rand" "crypto/sha256" "crypto/sha512" "encoding/base64" "encoding/hex" "errors" "math/big" mrand "math/rand" "strconv" "time" ) const ( AES128KeyLength = 16 AES192KeyLength = 24 AES256KeyLength = 32 HMA...
cryptohelper.go
0.748352
0.492493
cryptohelper.go
starcoder
package executor import ( "github.com/turingchain2020/turingchain/types" dty "github.com/turingchain2020/plugin/plugin/dapp/dposvote/types" ) //Exec_Regist DPos执行器注册候选节点 func (d *DPos) Exec_Regist(payload *dty.DposCandidatorRegist, tx *types.Transaction, index int) (*types.Receipt, error) { action := NewAction(d,...
plugin/dapp/dposvote/executor/exec.go
0.5
0.400925
exec.go
starcoder
package release import ( "math" "sort" "github.com/cespare/xxhash" shipper "github.com/bookingcom/shipper/pkg/apis/shipper/v1alpha1" ) const ( defaultClusterWeight = 100 ) type scoredCluster struct { cluster *shipper.Cluster score float64 } func buildPrefList(appIdentity string, clusterList []*shipper.Cl...
pkg/controller/release/weighted_preflist.go
0.617743
0.402128
weighted_preflist.go
starcoder
package period import ( "fmt" "io" "strings" "github.com/rickb777/plural" ) // Format converts the period to human-readable form using the default localisation. // Multiples of 7 days are shown as weeks. func (period Period) Format() string { return period.FormatWithPeriodNames(PeriodYearNames, PeriodMonthName...
period/format.go
0.760117
0.517815
format.go
starcoder
package main import ( "bufio" "fmt" "log" "os" "regexp" "strconv" ) type Point struct { x, y, z int } func (p Point) AbsSum() int { return abs(p.x) + abs(p.y) + abs(p.z) } func (p Point) ScaleUp(p0 Point) Point { return Point{ x: p.x + p0.x, y: p.y + p0.y, z: ...
2019/Day-12/The_N-Body_Problem/main.go
0.639849
0.443902
main.go
starcoder
package money import ( "strings" ) // Currency represents money currency information required for formatting type Currency struct { Code string Fraction int Grapheme string Template string Decimal string Thousand string } // currencies represents a collection of currency var currencies = map[string]*Curr...
currency.go
0.504639
0.416915
currency.go
starcoder
package main func Frontend() *Container { return &Container{ Name: "frontend", Title: "Frontend", Description: "Serves all end-user browser and API requests.", Groups: []Group{ { Title: "Search at a glance", Rows: []Row{ { { Name: "99th_percentile_search_re...
monitoring/frontend.go
0.650134
0.4231
frontend.go
starcoder
package elevation import ( "fmt" "math" ) // Elevation stores a numeric coordinate referencing a celestial bodies Z axis. type Elevation float32 // Absolute returns the numeric value held by the Elevation pointer to an absolute number. func (elevation *Elevation) Absolute() float32 { return float32(math.Abs(float...
elevation/elevation.go
0.944855
0.680048
elevation.go
starcoder
package utils import ( "time" ) func GetCurrentDateMinute() int32 { return GetDateMinute(time.Now().UTC()) } func GetCurrentPartitionPeriod( partitionPeriodLength int, ) int32 { now := time.Now().UTC() return GetDateMinute(now.Add(-(time.Minute * time.Duration(now.Minute()%partitionPeriodLength)))) } func Get...
utils/utils.go
0.722429
0.438665
utils.go
starcoder
package stats import ( "math" "sync" "time" ) // Tracker is a min/max value tracker that keeps track of its min/max values // over a given period of time, and with a given resolution. The initial min // and max values are math.MaxInt64 and math.MinInt64 respectively. type Tracker struct { mu sync.RWMut...
vendor/github.com/aristanetworks/goarista/monitor/stats/tracker.go
0.716913
0.480966
tracker.go
starcoder
// Package lorawan provides LoRaWAN decoding/encoding interfaces. package lorawan import ( "fmt" "go.thethings.network/lorawan-stack/pkg/ttnpb" ) const maxUint24 = 1<<24 - 1 func boolToByte(b bool) byte { if b { return 1 } return 0 } func copyReverse(dst, src []byte) { for i := range src { dst[i] = src[...
pkg/encoding/lorawan/lorawan.go
0.566738
0.434401
lorawan.go
starcoder
package oversampling import ( "fmt" "github.com/andrepxx/go-dsp-guitar/filter" "github.com/andrepxx/go-dsp-guitar/resample" ) /* * Global constants. */ const ( ATTENUATION_HALF_DECIBEL = 0.9440608762859234 LOOKAHEAD_SAMPLES_ONE_SIDE = 4 LOOKAHEAD_SAMPLES_BOTH_SIDES = 2 * LOOKAHEAD_SAMPLES_ONE_SIDE ) /*...
oversampling/oversampling.go
0.675015
0.445891
oversampling.go
starcoder
package schema // samSchema defined a JSON Schema that can be used to validate CloudFormation/SAM templates var samSchema = `{ "$schema": "http://json-schema.org/draft-04/schema#", "additionalProperties": false, "definitions": { "AWS::ApiGateway::Account": { "additionalProperties": fals...
schema/sam.go
0.629433
0.406626
sam.go
starcoder
package fp2 const mul = ` // Mul sets z to the {{.Name}}-product of x,y, returns z func (z *{{.Name}}) Mul(x, y *{{.Name}}) *{{.Name}} { {{ template "mul" dict "all" . "V1" "x" "V2" "y"}} return z } // MulAssign sets z to the {{.Name}}-product of z,x returns z func (z *{{.Name}}) MulAssign(x *{{.Name}}) *{{.Name}} ...
ecc/internal/tower/fp2/mul.go
0.711431
0.474083
mul.go
starcoder
package gmeasure import ( "fmt" "math" "sort" "time" "github.com/bsm/gomega/gmeasure/table" ) type MeasurementType uint const ( MeasurementTypeInvalid MeasurementType = iota MeasurementTypeNote MeasurementTypeDuration MeasurementTypeValue ) var letEnumSupport = newEnumSupport(map[uint]string{uint(Measurem...
gmeasure/measurement.go
0.669421
0.506225
measurement.go
starcoder
package opencvl // Examples contains some example pipelines that are also usable for image transforms import ( "fmt" "image" "gocv.io/x/gocv" ) // BlurPipeline performs a gaussian blur, given the magnitude of the blur on the x and y axis func BlurPipeline(xblur, yblur int) Pipeline { p := NewPipeline() layer :...
examples.go
0.83471
0.545104
examples.go
starcoder
package main import ( "fmt" "math/rand" "time" ) const boxW = 41 // Galton box width const boxH = 37 // Galton box height. const pinsBaseW = 19 // Pins triangle base. const nMaxBalls = 55 // Number of balls. const centerH = pinsBaseW + (boxW-pinsBaseW*2+1)/2 - 1 const ( empty = ' ' ba...
lang/Go/galton-box-animation.go
0.659734
0.420005
galton-box-animation.go
starcoder
package diff import ( "context" ) // LCS between x and y. // This implementation converts the LCS problem into LIS sub problems without recursion. // The memory complexity is O(x.Occurrence(y)). // The time complexicy is O(x.Occurrence(y).Complexity()). // The time complexicy is similar with Myer's diff algorithm, b...
lib/diff/lcs.go
0.755366
0.495911
lcs.go
starcoder
package code import ( "fmt" "go/types" ) // CompatibleTypes isnt a strict comparison, it allows for pointer differences func CompatibleTypes(expected types.Type, actual types.Type) error { //fmt.Println("Comparing ", expected.String(), actual.String()) // Special case to deal with pointer mismatches { expecte...
internal/code/compare.go
0.578448
0.588209
compare.go
starcoder
package mg import ( "context" "encoding/json" "fmt" "reflect" "time" ) // Fn represents a function that can be run with mg.Deps. Package, Name, and ID must combine to // uniquely identify a function, while ensuring the "same" function has identical values. These are // used as a map key to find and run (or not r...
mg/fn.go
0.658198
0.418994
fn.go
starcoder
package chunks import ( "io" "github.com/attic-labs/noms/go/hash" ) // ChunkStore is the core storage abstraction in noms. We can put data // anyplace we have a ChunkStore implementation for. type ChunkStore interface { // Get the Chunk for the value of the hash in the store. If the hash is // absent from the s...
go/chunks/chunk_store.go
0.601125
0.465752
chunk_store.go
starcoder
package bdd import ( "context" "fmt" "reflect" "testing" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" "github.com/inklabs/rangedb" "github.com/inklabs/rangedb/rangedbtest" ) // Command defines a CQRS command. type Command interface { rangedb.AggregateMessage CommandType() str...
rangedbtest/bdd/bdd.go
0.747247
0.442155
bdd.go
starcoder
package main import ( "fmt" ) type node struct { data int left *node right *node } type binarySearchTree struct { root *node } func createNode(data int) *node { myNode := node{ data: data, left: nil, right: nil, } return &myNode } func showPreOrderElements(root *node) { if root != nil { fmt.P...
src/dataStructures/tree/binarySearchTree.go
0.545286
0.448487
binarySearchTree.go
starcoder
package primitives import ( "errors" "github.com/phoreproject/synapse/chainhash" "github.com/phoreproject/synapse/pb" ) // Block represents a single beacon chain block. type Block struct { BlockHeader BlockHeader BlockBody BlockBody } // Copy returns a copy of the block. func (b *Block) Copy() Block { retur...
primitives/block.go
0.748995
0.41404
block.go
starcoder
package inject import ( "fmt" "reflect" ) // Context that is passed to scopes. type Context interface{} type Singleton struct{} // Key used to uniquely identify a binding. type Key interface{} type Tag interface{} // Type used to identify a tagged type binding. type TaggedKey struct { Key Tag } /* Signature ...
go/src/github.com/nicholasjackson/blackpuppy-api-mail/inject/inject.go
0.775732
0.490968
inject.go
starcoder
package model import ( "fmt" "math" "strings" "gonum.org/v1/gonum/mat" ) // State defines the interface for any state implementation. type State interface { IsTerminal() bool Vector() mat.Vector } // StateValue is a map of expected value for state. type StateValue map[State]float64 // Get ... func (sv StateV...
model/state.go
0.585931
0.451327
state.go
starcoder
package matrix import ( "errors" "fmt" ) // ScanDirection scan matrix driection type ScanDirection uint const ( // ROW for row first ROW ScanDirection = 1 // COLUMN for column first COLUMN ScanDirection = 2 ) // State value of matrix map[][] type State uint16 const ( // StateFalse 0xffff FALSE StateFalse ...
matrix/matrix.go
0.586996
0.445771
matrix.go
starcoder
package eval import ( "reflect" "unsafe" "github.com/DataDog/datadog-agent/pkg/security/secl/ast" "github.com/pkg/errors" ) // RuleID - ID of a Rule type RuleID = string // Rule - Rule object identified by an `ID` containing a SECL `Expression` type Rule struct { ID RuleID Expression string Tags ...
pkg/security/secl/eval/rule.go
0.782413
0.402157
rule.go
starcoder
package utils import ( "math" "strconv" pqueue "github.com/andela-sjames/priorityQueue" ) /** dijkstra function in it's base form takes a directed acyclic and uses a naive approach - a non Indexed Priority Queue (IPQ) to determine the shortest distance from the start of a graph to the end of the graph. It retur...
utils/dijkstra.go
0.735167
0.519704
dijkstra.go
starcoder
// This is a Go replica of https://github.com/google/or-tools/blob/master/ortools/linear_solver/samples/integer_programming_example.py // Small example to illustrate solving a MIP problem. package main import ( "fmt" "github.com/baobabsoluciones/ortoolslp" ) func main() { // Integer programming sample. // [STAR...
examples/MILP/integer_programming_example.go
0.855369
0.448849
integer_programming_example.go
starcoder
package nistec import ( "crypto/elliptic/internal/fiat" "crypto/subtle" "errors" ) var p384B, _ = new(fiat.P384Element).SetBytes([]byte{ 0xb3, 0x31, 0x2f, 0xa7, 0xe2, 0x3e, 0xe7, 0xe4, 0x98, 0x8e, 0x05, 0x6b, 0xe3, 0xf8, 0x2d, 0x19, 0x18, 0x1d, 0x9c, 0x6e, 0xfe, 0x81, 0x41, 0x12, 0x03, 0x14, 0x08, 0x8f, 0x50, ...
src/crypto/elliptic/internal/nistec/p384.go
0.531209
0.464537
p384.go
starcoder
package pbinfo import ( "strings" "time" "github.com/docker/go-units" ) // ProblemDifficulty represents the difficulty of a problem. type ProblemDifficulty int const ( Unknown ProblemDifficulty = iota Easy Medium Difficult Contest difficultyEasyString = "easy" difficultyMediumString = "medium" d...
pkg/pbinfo/problem.go
0.715921
0.434521
problem.go
starcoder
package compile import ( "github.com/danos/yang/parse" "github.com/danos/yang/schema" ) /* * To add extensions to the schema tree a simple pattern is followed. * The compiler turns a set of parse nodes into a schema node. As each * node is compiled, it is passed to the extensions which are given an * opportuni...
compile/extensions.go
0.719581
0.458227
extensions.go
starcoder
package zson import ( "errors" "fmt" "github.com/brimdata/zed" astzed "github.com/brimdata/zed/compiler/ast/zed" ) type Value interface { TypeOf() zed.Type SetType(zed.Type) } // Note that all of the types include a generic zed.Type as their type since // anything can have a zed.TypeNamed along with its norma...
zson/analyzer.go
0.592431
0.614568
analyzer.go
starcoder
// Package consensus implements different Matrix consensus engines. package consensus import ( "math/big" "github.com/matrix/go-matrix/common" "github.com/matrix/go-matrix/core/state" "github.com/matrix/go-matrix/core/types" "github.com/matrix/go-matrix/params" "github.com/matrix/go-matrix/rpc" ) // ChainRead...
consensus/consensus.go
0.694095
0.490053
consensus.go
starcoder
package core import ( "github.com/nuberu/engine/math" ) type Camera struct { Object3 matrixWorldInverse math.Matrix4 projectionMatrix math.Matrix4 projectionMatrixInverse math.Matrix4 } func NewCamera() *Camera { cam := Camera{ Object3: *NewObject(), matrixWorldInverse: *math.NewDefaultMatrix4...
core/camera.go
0.860808
0.560072
camera.go
starcoder
package anomalia // Detector is the default anomaly detector type Detector struct { threshold float64 timeSeries *TimeSeries } // NewDetector return an instance of the default detector. func NewDetector(ts *TimeSeries) *Detector { return &Detector{threshold: 2.0, timeSeries: ts} } // Threshold sets the threshold...
detector.go
0.86592
0.645274
detector.go
starcoder
package metrics import ( "sync" "time" "github.com/rcrowley/go-metrics" ) type timer struct { mutex sync.Mutex sum int64 prev int64 count int64 mean float64 } // GetOrRegisterTimer returns an existing Timer or constructs and registers a // new StandardTimer. func getOrRegisterTimer(name string, r metric...
metrics/timer.go
0.856827
0.525673
timer.go
starcoder
package dbnssystem import ( "errors" "math/big" ) var ( big1 = big.NewInt(1) big3 = big.NewInt(3) // ErrDBNSBase2And3 is returned if the integer can not represented by any linear combination 2^a3^b. ErrDBNSBase2And3 = errors.New("not represented by any linear combination 2^a3^b") // ErrPositiveInteger is ret...
crypto/dbnssystem/dbns.go
0.663996
0.450359
dbns.go
starcoder
package badgerhold import ( "fmt" "math/big" "reflect" "time" ) // ErrTypeMismatch is the error thrown when two types cannot be compared type ErrTypeMismatch struct { Value interface{} Other interface{} } func (e *ErrTypeMismatch) Error() string { return fmt.Sprintf("%v (%T) cannot be compared with %v (%T)",...
compare.go
0.668988
0.443721
compare.go
starcoder
package gohome import ( "github.com/PucklaMotzer09/mathgl/mgl32" ) // A tween that moves its parent to a certain position type TweenPosition2D struct { // The position to which the parent should move Destination mgl32.Vec2 // The time in which it should do this in seconds Time float32 // The type of this...
src/gohome/tweens.go
0.71423
0.586345
tweens.go
starcoder
package ordinarykriging import ( "math" ) // matrixTranspose The matrix is reversed, and the horizontal matrix becomes the vertical matrix // 矩阵颠倒,横向矩阵变成纵向矩阵 func matrixTranspose(X []float64, n, m int) []float64 { Z := make([]float64, m*n) for i := 0; i < n; i++ { for j := 0; j < m; j++ { Z[j*n+i] = X[i*m+j] ...
ordinarykriging/matrix.go
0.564339
0.553988
matrix.go
starcoder
package vmath import ( "fmt" "github.com/maja42/vmath/math32" ) // Rectf represents a 2D, axis-aligned rectangle. type Rectf struct { Min Vec2f Max Vec2f } // RectfFromCorners creates a new rectangle given two opposite corners. // If necessary, coordinates are swapped to create a normalized rectangle. func Rect...
rectf.go
0.940592
0.640938
rectf.go
starcoder
package models import ( "encoding/json" "fmt" "strings" ) // ConceptMapEquivalence is documented here http://hl7.org/fhir/ValueSet/concept-map-equivalence type ConceptMapEquivalence int const ( ConceptMapEquivalenceRelatedto ConceptMapEquivalence = iota ConceptMapEquivalenceEquivalent ConceptMapEquivalenceEqu...
models/conceptMapEquivalence.gen.go
0.705379
0.411052
conceptMapEquivalence.gen.go
starcoder
package integration import ( "testing" "github.com/CyCoreSystems/ari" "github.com/pkg/errors" tmock "github.com/stretchr/testify/mock" ) func TestApplicationList(t *testing.T, s Server) { runTest("emptyList", t, s, func(t *testing.T, m *mock, cl ari.Client) { m.Application.On("List", (*ari.Key)(nil)).Return([...
internal/integration/application.go
0.550124
0.432663
application.go
starcoder
package pulse import ( "fmt" "sort" "strings" "time" "github.com/insolar/insolar/longbits" "github.com/insolar/insolar/network/consensus/common/cryptkit" ) var _ DataReader = &Data{} type Data struct { PulseNumber Number DataExt } type DataHolder interface { GetPulseNumber() Number GetPulseData() Data ...
pulse/pulse_data.go
0.689515
0.538559
pulse_data.go
starcoder
package refutil import ( "fmt" "reflect" ) // IsKindComplex returns true if the given Kind is a complex value. func IsKindComplex(k reflect.Kind) bool { return reflect.Complex64 == k || k == reflect.Complex128 } // IsKindFloat returns true if the given Kind is a float value. func IsKindFloat(k reflect.Kind) bool ...
vendor/github.com/cstockton/go-conv/internal/refutil/refutil.go
0.805211
0.563798
refutil.go
starcoder
package timeseries import ( "errors" "strings" "github.com/grokify/mogo/time/timeutil" ) func (ts *TimeSeries) TimeSeriesMonthYOY() TimeSeries { return ts.TimeSeriesMonthXOX(-1, 0, 0, "YoY") } func (ts *TimeSeries) TimeSeriesMonthQOQ() TimeSeries { return ts.TimeSeriesMonthXOX(0, -3, 0, "QoQ") } func (ts *Tim...
data/timeseries/time_series_month_xox.go
0.684686
0.437824
time_series_month_xox.go
starcoder
package h21 // Row of data table. type Row struct { ID string Description string Comment string } // Table of data. type Table struct { ID string Name string Row []Row } // TableLookup provides valid values for field types. var TableLookup = map[string]Table{ `0001`: {ID: `0001`, Name: `SEX`,...
h21/table.go
0.665737
0.848972
table.go
starcoder
package pterm import ( "strings" ) // DefaultParagraph contains the default values for a ParagraphPrinter. var DefaultParagraph = ParagraphPrinter{ MaxWidth: GetTerminalWidth(), } // ParagraphPrinter can print paragraphs to a fixed line width. // The text will split between words, so that words will stick together...
paragraph_printer.go
0.633637
0.532972
paragraph_printer.go
starcoder
package main import ( "context" "fmt" "github.com/google/go-cmp/cmp" "github.com/sourcegraph/sourcegraph/lib/errors" ) // buildQueries returns a channel that is fed all of the test functions that should be invoked // as part of the test. This function depends on the flags provided by the user to alter the // be...
dev/codeintel-qa/cmd/query/queries.go
0.826151
0.451145
queries.go
starcoder
package lshensemble import ( "errors" "fmt" "sync" "time" cmap "github.com/orcaman/concurrent-map" ) type param struct { k int l int } // Partition represents a domain size partition in the LSH Ensemble index. type Partition struct { Lower int `json:"lower"` Upper int `json:"upper"` } // Lsh interface is ...
lshensemble.go
0.721154
0.403508
lshensemble.go
starcoder
package flight import ( "bytes" "encoding/json" "fmt" "io/ioutil" "net/http" "os" ) type Passengers struct { Kind string `json:kind` AdultCount int `json:adultCount` ChildCount int `json:childCount` InfantInLapCount int `json:infantInLapCount` InfantInSeatCount int `...
main.go
0.545044
0.533944
main.go
starcoder
package math4g // Mat32 is a 3x2 matrix is represented as float[6]. type Mat32 [6]Scala // NewMat32 creates Mat32 instance func NewMat32(a, b, c, d, e, f Scala) Mat32 { return Mat32{a, b, c, d, e, f} } // IdentityMatrix makes the transform to identity matrix. func IdentityMat32() Mat32 { return NewMat32(1.0, 0.0, ...
mat32.go
0.879781
0.808635
mat32.go
starcoder
package onshape import ( "encoding/json" ) // BTMassPropertiesBulkInfo struct for BTMassPropertiesBulkInfo type BTMassPropertiesBulkInfo struct { Bodies *map[string]BTMassPropertiesInfoNull `json:"bodies,omitempty"` MicroversionId *string `json:"microversionId,omitempty"` } // NewBTMassPropertiesBulkInfo instanti...
onshape/model_bt_mass_properties_bulk_info.go
0.693992
0.403302
model_bt_mass_properties_bulk_info.go
starcoder
package main import ( "fmt" "io" "text/template" ) const checkNativeiterable = `func checkNativeIterable(t *Dense, dims int, dt Dtype) error { // checks: if !t.IsNativelyAccessible() { return errors.Errorf("Cannot convert *Dense to *mat.Dense. Data is inaccessible") } if t.Shape().Dims() != dims { return ...
genlib2/native_iterator.go
0.667364
0.487185
native_iterator.go
starcoder
package gJson import ( "encoding/json" "reflect" "strconv" "unicode/utf8" ) // EncodeKeyVal writes the provide key/value to the encoder, with a leading // comma if `isFirst` is `false`. // The pair is not written if `canElide` is `true` and the value provided is a // zero value, is a JSONEncoder that did returned...
gJson/primitives.go
0.64579
0.433862
primitives.go
starcoder
package iso20022 // Account between an investor(s) and a fund manager or a fund. The account can contain holdings in any investment fund or investment fund class managed (or distributed) by the fund manager, within the same fund family. type InvestmentAccount21 struct { // Unique and unambiguous identification for t...
InvestmentAccount21.go
0.713631
0.440229
InvestmentAccount21.go
starcoder
// Package consumer contains interfaces that receive and process consumerdata. package consumer import ( "context" "github.com/open-telemetry/opentelemetry-collector/internal/data" "github.com/open-telemetry/opentelemetry-collector/translator/internaldata" ) // NewInternalToOCTraceConverter creates new internalT...
consumer/converter.go
0.664867
0.40751
converter.go
starcoder
RISC-V CPU Emulation Notes: We use uint64 for integer registers. The upper 32-bits is ignored for xlen == 32. For RV32e (16 integer registers) an out of range register (>=16) will generate an exception. We use uint64 for float registers. For CPUs that have only 32-bit float support the upper 32-bits are ignored. F...
rv/emu.go
0.740456
0.421373
emu.go
starcoder
package scene import ( "math" "github.com/carlosroman/aun-otra-ray-tracer/go/internal/object" "github.com/carlosroman/aun-otra-ray-tracer/go/internal/ray" ) const ( epsilon = 0.00000001 ) type Computation struct { t float64 //Intersect obj object.Object point ray.Vector overPoint ray.V...
go/internal/scene/computation.go
0.755907
0.531453
computation.go
starcoder