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 pi import ( "fmt" "math" "math/big" "github.com/go-logr/logr" ) const ( // The number of MR rounds to use when determining if the number is // probably a prime. A value of zero will apply a Baillie-PSW only test // and requires Go 1.8+. DEFAULT_MILLER_RABIN_ROUNDS = 0 ) var ( TWO = big.NewInt(2) ) ...
v2/pi.go
0.707203
0.404919
pi.go
starcoder
package imager import ( "image" "image/color" "math" ) // RotateImager type RotateImager struct { img image.Image radian float64 } // ColorModel func (ri *RotateImager) ColorModel() color.Model { return ri.img.ColorModel() } // Bounds func (ri *RotateImager) Bounds() image.Rectangle { rect := ri.img.Bound...
rotate_imager.go
0.663015
0.612484
rotate_imager.go
starcoder
package solve import ( gs "github.com/deanveloper/gridspech-go" ) // PathsIter returns an channel of direct paths from start to end. // These paths will: // 1. never contain a goal tile that isn't start or end. // 2. never make a path that would cause start or end to become invalid Goal tiles. // 3. have the s...
solve/path.go
0.727492
0.453564
path.go
starcoder
package puzzle // parse and evaluate mathematical expressions // precedence by power, division, multiplication, addition, and subtraction import ( "fmt" "math" "strconv" "strings" "github.com/dockerian/go-coding/ds/stack" u "github.com/dockerian/go-coding/utils" ) var ( operators = []string{ "+", "-", ...
puzzle/eval.go
0.682362
0.402979
eval.go
starcoder
package quadedge import ( "github.com/go-spatial/geom" ) /* TrianglePredicate contains algorithms for computing values and predicates associated with triangles. For some algorithms extended-precision implementations are provided, which are more robust (i.e. they produce correct answers in more cases). Also, some mor...
planar/triangulate/quadedge/trianglepredicate.go
0.923825
0.736827
trianglepredicate.go
starcoder
package operator import ( "github.com/matrixorigin/matrixone/pkg/container/nulls" "github.com/matrixorigin/matrixone/pkg/container/vector" "github.com/matrixorigin/matrixone/pkg/vm/process" ) func ColAndCol(lv, rv *vector.Vector, proc *process.Process) (*vector.Vector, error) { lvs, rvs := lv.Col.([]bool), rv.Col...
pkg/sql/plan2/function/operator/and.go
0.52829
0.44071
and.go
starcoder
package types func NewPopulatedStdDouble(r randyWrappers, easy bool) *float64 { v := NewPopulatedDoubleValue(r, easy) return &v.Value } func SizeOfStdDouble(v float64) int { pv := &DoubleValue{Value: v} return pv.Size() } func StdDoubleMarshal(v float64) ([]byte, error) { size := SizeOfStdDouble(v) buf := mak...
vendor/github.com/gogo/protobuf/types/wrappers_gogo.go
0.713931
0.409339
wrappers_gogo.go
starcoder
package fem import ( "github.com/cpmech/gofem/inp" "github.com/cpmech/gosl/fun" "github.com/cpmech/gosl/la" ) // OutIpData is an auxiliary structure to transfer data from integration points (IP) to output routines. type OutIpData struct { Eid int // id of element that owns this ip X []float64...
fem/element.go
0.579519
0.404684
element.go
starcoder
package storage import ( "math" "time" "github.com/m3db/m3x/close" ) // A Series is a series of datapoints, bucketed into fixed time intervals type Series interface { xclose.Closer Len() int // Len returns the number of datapoints in the series StepSize() time.Duration // StepSize is t...
series.go
0.850562
0.572125
series.go
starcoder
package termios var coldef256 = make(coldef) func init() { coldef256[&Color256Black] = RGB{0, 0, 0} coldef256[&Color256Maroon] = RGB{128, 0, 0} coldef256[&Color256Green] = RGB{0, 128, 0} coldef256[&Color256Olive] = RGB{128, 128, 0} coldef256[&Color256Navy] = RGB{0, 0, 128} coldef256[&Color256Purple] = RGB{128, ...
spectrum256.go
0.656438
0.460168
spectrum256.go
starcoder
package money // Currency represents a currency. type Currency struct { // The name of the currency. Name string // The 3 char identifier of the currency (ISO 4217). IsoCode string // The symbol of the currency. Symbol string // Is true if the symbol will be displayed before the amount. SymbolFirst bool // Nu...
currency.go
0.608943
0.473901
currency.go
starcoder
package cryptoapis import ( "encoding/json" ) // ListInternalTransactionsByAddressRI struct for ListInternalTransactionsByAddressRI type ListInternalTransactionsByAddressRI struct { // Defines the specific amount of the transaction. Amount string `json:"amount"` // Represents the hash of the block where this tra...
model_list_internal_transactions_by_address_ri.go
0.858955
0.452838
model_list_internal_transactions_by_address_ri.go
starcoder
package gomatrixserverlib import ( "strings" ) // A stateResV2ConflictedPowerLevel is used to sort the events by effective // power level, origin server TS and the lexicographical comparison of event // IDs. It is a bit of an optimisation to use this - by working out the // effective power level etc ahead of time, ...
stateresolutionv2heaps.go
0.672869
0.41947
stateresolutionv2heaps.go
starcoder
package lcd import ( "fmt" "strconv" "github.com/aamcrae/config" ) // Create a 7 segment decoder using the configuration data provided. func CreateLcdDecoder(conf config.Conf) (*LcdDecoder, error) { var xoff, yoff int l := NewLcdDecoder() // threshold is a percentage defining the point between the // min and...
config.go
0.660829
0.438605
config.go
starcoder
package iso20022 // Provides information on the status of a trade. type TradeData1 struct { // Refers to the identification of a notification. NotificationIdentification *Max35Text `xml:"NtfctnId"` // Reference to the unique identification assigned to a trade by a central matching system. MatchingSystemUniqueRef...
TradeData1.go
0.770292
0.422505
TradeData1.go
starcoder
package memstore import ( "bufio" "fmt" "github.com/uber/aresdb/memstore/common" "github.com/uber/aresdb/memstore/list" "github.com/uber/aresdb/utils" "io" "os" "reflect" "unsafe" ) // cLiveVectorParty is the implementation of LiveVectorParty with c allocated memory // this vector party stores columns with ...
memstore/live_vector_party.go
0.658527
0.422326
live_vector_party.go
starcoder
package router import ( "github.com/kwoodhouse93/audio-playground/source" "github.com/kwoodhouse93/audio-playground/types" ) // Gain returns a filter that multiplies the signals in the buffer by a constant value func Gain(src source.Source, gain float32) source.Source { return func(step int) types.Sample { in :=...
router/router.go
0.830937
0.455259
router.go
starcoder
package bst import ( "bufio" "fmt" "io" "strings" ) // Order specifies a tree traversal order for a Tree's Walk method. type Order int // Possible Order values. const ( PreOrder Order = iota InOrder PostOrder ) // A Tree is a basic binary search tree. type Tree struct { root *Node } // ParseTree creates a ...
go/algorithms/bst/bst.go
0.726426
0.421433
bst.go
starcoder
package primitives import ( "encoding/xml" ) //ConditionOperatorType is a direct mapping of XSD ST_ConditionalFormattingOperator type ConditionOperatorType byte //ConditionOperatorType maps for marshal/unmarshal process var ( ToConditionOperatorType map[string]ConditionOperatorType FromConditionOperatorType ma...
internal/ml/primitives/condition_operator.go
0.643329
0.446374
condition_operator.go
starcoder
package cmd const dashboardJsonV3 = ` { "id": 1, "title": "Belt", "originalTitle": "Belt", "tags": [], "style": "dark", "timezone": "browser", "editable": true, "hideControls": true, "sharedCrosshair": false, "rows": [ { "collapse": false, "editable": false, "height": "250px",...
cmd/dashboard_json_v3.go
0.568536
0.415729
dashboard_json_v3.go
starcoder
package filter // Filter wraps the values of a Record's "filters" attribute type Filter struct { Type string `json:"filter"` Disabled bool `json:"disabled,omitempty"` Config Config `json:"config"` } // Enable a filter. func (f *Filter) Enable() { f.Disabled = false } // Disable a filter. func (f *Filter)...
vendor/gopkg.in/ns1/ns1-go.v2/rest/model/filter/filter.go
0.873902
0.484807
filter.go
starcoder
package main import ( "container/list" ) /* 210 course schedule II There are a total of n courses you have to take labelled from 0 to n - 1. Some courses may have prerequisites, for example, if prerequisites[i] = [ai, bi] this means you must take the course bi before the course ai. Given the total number of courses...
bfs/topological-sorting/210-course-schedule.go
0.545286
0.673036
210-course-schedule.go
starcoder
package operators import ( "context" "github.com/MontFerret/ferret/pkg/runtime/core" "github.com/MontFerret/ferret/pkg/runtime/values" ) type ( MathOperatorType string MathOperator struct { *baseOperator opType MathOperatorType fn OperatorFunc leftOnly bool } ) const ( MathOperatorTypeAdd ...
pkg/runtime/expressions/operators/math.go
0.612773
0.430806
math.go
starcoder
package gfx import ( "errors" "github.com/rainu/launchpad-super-trigger/pad" ) func (e Renderer) HorizontalProgressbar(y, percent int, dir Direction, fill, empty pad.Color) error { return e.horizontalQuadrantProgressbar(y, minX, padLength, percent, dir, fill, empty) } func (e Renderer) HorizontalQuadrantProgressb...
gfx/progressbar.go
0.647575
0.443902
progressbar.go
starcoder
package sqlspanner import ( "database/sql/driver" "fmt" "cloud.google.com/go/spanner" "github.com/xwb1989/sqlparser" ) // because spanner has multiple primary keys support, EVERY field // found in the query is assumed to be a primary key. It will build the spanner.Key with the fields in the // query in the or...
parse_sql_delete.go
0.563378
0.418459
parse_sql_delete.go
starcoder
package list const predicatedFunctions = ` //------------------------------------------------------------------------------------------------- // Filter returns a new {{.TName}}List whose elements return true for func. func (list {{.TName}}List) Filter(fn func({{.PName}}) bool) {{.TName}}Collection { result := make(...
internal/list/predicated.go
0.784071
0.538012
predicated.go
starcoder
package reckon const ( statsTempl = ` {{define "base"}} # of keys sampled: {{.KeyCount}} {{ if .StringKeys }} --- Strings ({{summarize .StringSizes}}) --- {{template "exampleKeys" .StringKeys}} {{template "exampleValues" .StringValues}} Sizes ({{template "stats" .StringSizes}}): {{template "freq" .StringSizes}} ^2 S...
templates_text.go
0.532911
0.409811
templates_text.go
starcoder
package parse import ( "github.com/cdkini/Okra/src/interpreter/ast" "github.com/cdkini/Okra/src/okraerr" ) // Expression is triggered to parse an Expr or the contents of a Stmt that includes an Expr as a property. // The method uses recursive descent like the rest of the parser, moving down parser helper methods in...
src/interpreter/parse/parser_expr.go
0.73029
0.479016
parser_expr.go
starcoder
package api import ( "fmt" "math" "regexp" ) func getMetricValue(key string) float64 { metricValue := map[string]float64{ "AV:N": 0.85, "AV:A": 0.62, "AV:L": 0.55, "AV:P": 0.2, "MAV:N": 0.85, "MAV:A": 0.62, "MAV:L": 0.55, "MAV:P": 0.2, "AC:L": 0.77, "AC:H": 0.44, "MAC:L": 0....
api/cvss.go
0.544075
0.425546
cvss.go
starcoder
package fp type intSlice []int type intFunctorForMap func(int) int type intFunctorForFilter func(int) bool type intSlicePtr []*int type intFunctorForMapPtr func(*int) *int type intFunctorForFilterPtr func(*int) bool // MakeIntSlice - creates slice for the functional method such as map, filter func MakeIntSlice(value...
fp/methodchain.go
0.649023
0.488283
methodchain.go
starcoder
package pricing import ( "fmt" "github.com/transcom/mymove/pkg/models" ) // parseNonStandardLocnPrices: parser for 3e) Non-Standard Loc'n Prices var parseNonStandardLocnPrices processXlsxSheet = func(params ParamConfig, sheetIndex int, logger Logger) (interface{}, error) { // XLSX Sheet consts const xlsxDataShee...
pkg/parser/pricing/parse_nonstandard_location_prices.go
0.502441
0.453625
parse_nonstandard_location_prices.go
starcoder
package unit // Flow represents a SI unit of volume flow rate in cubic meters per second, m3/s type Flow Unit // ... const ( // SI CubicMeterPerSecond Flow = 1e0 LiterPerSecond = CubicMeterPerSecond * 1e-3 LiterPerMinute = LiterPerSecond * 1 / 60 LiterPerHour = LiterPerSecond * 1 ...
flow.go
0.876264
0.400456
flow.go
starcoder
package physics import ( "fmt" ) const ( velocityTolerance float64 = 0.001 ) //CollisionInfo Informations sur une collision ou son absence type CollisionInfo struct { first Shape second Shape penetration float64 normal Vec2 resolved bool } //IsColliding retourne true s'il y a collision fu...
collision.go
0.581778
0.596551
collision.go
starcoder
package ora // GoColumnType defines the Go type returned from a sql select column. type GoColumnType uint // go column types const ( // D defines a sql select column based on its default mapping. D GoColumnType = iota + 1 // I64 defines a sql select column as a Go int64. I64 // I32 defines a sql select column a...
vendor/gopkg.in/rana/ora.v4/const.go
0.538983
0.566258
const.go
starcoder
package geom import ( "fmt" "math" ) // A Rectangle represents a rectangle using 2 corner points. // Only rectangles aligned with the coordinate axes can be represented. type Rectangle struct { Min, Max Point } // RectWithSideLengths creates a new rectangle with the given size. func RectWithSideLengths(p Point) R...
pkg/geom/rect.go
0.949926
0.798187
rect.go
starcoder
package covertree import "math" type coverSet struct { layers []coverSetLayer totalItemCount int visibleItemCount int } func coverSetWithItems(items []interface{}, parent interface{}, query interface{}, distanceFunc DistanceFunc, loadChildren func(...interface{}) ([]LevelsWithItems, error)) (coverSet,...
coverset.go
0.550124
0.410402
coverset.go
starcoder
package args import ( "fmt" "math" "strings" "time" ) /* NB! "µs" require 3 bytes, not 2 bytes, hence the difference with "ms" on a number of decimal positions */ func DurationFixedLen(d time.Duration, expectedLen int) string { return durationFixedLen(d, d, expectedLen) } func durationFixedLen(d, base time.Du...
network/consensus/common/args/fmt_duration.go
0.791015
0.409014
fmt_duration.go
starcoder
package description // Provides an interface to assemble a D3M pipeline DAG as a protobuf PipelineDescription. This created // description can be passed to a TA2 system for execution and inference. The pipeline description is // covered in detail at https://gitlab.com/datadrivendiscovery/metalearning#pipeline with ...
primitive/compute/description/builder.go
0.84228
0.476884
builder.go
starcoder
package main import ( "bufio" "errors" "fmt" "math" "os" "strconv" "strings" ) // For debug output: export DEBUG=1 // Type Step represents a step from the input file, which contains a direction // (left or right) and the number of blocks to travel. type Step struct { Direction Direction Steps int } // ...
day01/main.go
0.673943
0.418222
main.go
starcoder
* SOURCE: * Record.avsc */ package dtsavro import ( "encoding/json" "fmt" "io" "github.com/actgardner/gogen-avro/v7/vm" "github.com/actgardner/gogen-avro/v7/vm/types" ) type UnionNullIntegerCharacterDecimalFloatTimestampDateTimeTimestampWithTimeZoneBinaryGeometryTextGeometryBinaryObjectTextObjectEmptyObj...
dtsavro/union_null_integer_character_decimal_float_timestamp_date_time_timestamp_with_time_zone_binary_geometry_text_geometry_binary_object_text_object_empty_object.go
0.81119
0.41834
union_null_integer_character_decimal_float_timestamp_date_time_timestamp_with_time_zone_binary_geometry_text_geometry_binary_object_text_object_empty_object.go
starcoder
package opt type Factory interface { // Metadata returns the query-specific metadata, which includes information // about the columns and tables used in this particular query. Metadata() *Metadata // StoreList allocates storage for a list of group IDs in the memo and // returns an ID that can be used for later ...
pkg/sql/opt/opt/factory.og.go
0.647575
0.447762
factory.og.go
starcoder
package rbt import "fmt" type KeyType int64 const ( maxKey = KeyType(0x7fffffffffffffff) minKey = -maxKey - 1 ) const ( Red = 0 Black = 1 ) type Node struct { Key KeyType Parent, Left, Right *Node Color uint8 } type Tree struct { Root, Nil *Node nilN Node } func New() *Tree { ...
Lecture 10- Red-black trees/src/rbt/rbt.go
0.745769
0.550366
rbt.go
starcoder
package ext import ( "reflect" "time" ) func IsNil(value interface{}) bool { if value == nil { return true } v := reflect.ValueOf(value) return v.Kind() == reflect.Ptr && v.IsNil() } func IsEmpty(test *string) bool { if test == nil { return true } return *test == "" } // Pointers func Bool(val bool) ...
ext/Tools.go
0.602763
0.42054
Tools.go
starcoder
package svg import ( "github.com/goki/gi/gi" "github.com/goki/gi/gist" "github.com/goki/ki/ki" "github.com/goki/ki/kit" "github.com/goki/mat32" ) // Marker represents marker elements that can be drawn along paths (arrow heads, etc) type Marker struct { NodeBase RefPos mat32.Vec2 `xml:"{refX,refY}" desc:...
svg/marker.go
0.764364
0.429968
marker.go
starcoder
package dlogproofs import ( "math/big" "github.com/xlab-si/emmy/crypto/common" "github.com/xlab-si/emmy/crypto/groups" ) type Transcript struct { A *big.Int B *big.Int Hash *big.Int ZAlpha *big.Int } func NewTranscript(a, b, hash, zAlpha *big.Int) *Transcript { return &Transcript{ A: a, ...
crypto/zkp/primitives/dlogproofs/dlog_equality_blinded_transcript.go
0.654122
0.430806
dlog_equality_blinded_transcript.go
starcoder
package conf import "time" // DurationVar defines a time.Duration flag and environment variable with specified name, default value, and usage string. // The argument p points to a time.Duration variable in which to store the value of the flag and/or environment variable. func (c *Configurator) DurationVar(p *time.Dur...
value_duration.go
0.766206
0.657909
value_duration.go
starcoder
package indicators import ( "errors" "github.com/jaybutera/gotrade" ) // A Moving Average Convergence-Divergence (Macd) Indicator type Macd struct { *baseIndicator *baseFloatBounds // private variables valueAvailableAction ValueAvailableActionMacd fastTimePeriod int slowTimePeriod int signalTime...
indicators/macd.go
0.73412
0.560914
macd.go
starcoder
package pixelmunk import ( "fmt" "github.com/faiface/pixel" "github.com/faiface/pixel/imdraw" "github.com/vova616/chipmunk" "golang.org/x/image/colornames" "math" ) var _ Drawable = &Object{} // NewObject creates a new Object for the provided Body and ObjectOptions func NewObject(body *chipmunk.Body, options O...
object.go
0.732687
0.429489
object.go
starcoder
package main import ( . "github.com/9d77v/leetcode/pkg/algorithm/unionfind" ) /* 题目:除法求值 给你一个变量对数组 equations 和一个实数值数组 values 作为已知条件,其中 equations[i] = [Ai, Bi] 和 values[i] 共同表示等式 Ai / Bi = values[i] 。每个 Ai 或 Bi 是一个表示单个变量的字符串。 另有一些以数组 queries 表示的问题,其中 queries[j] = [Cj, Dj] 表示第 j 个问题,请你根据已知条件找出 Cj / Dj = ? 的结果作为答案。 返...
internal/leetcode/399.evaluate-division/main.go
0.54359
0.416441
main.go
starcoder
package pixel import ( "image" "image/color" ) type Option struct { Threshold float32 IncludeAA bool } func Match(img1, img2 image.Image, rect image.Rectangle, output *image.RGBA, opt *Option) int { var threshold float32 threshold = 0.1 if opt != nil { threshold = opt.Threshold } maxDelta := 35215 * thres...
pixel.go
0.720368
0.469399
pixel.go
starcoder
package canfinish /* * @lc app=leetcode id=207 lang=golang * * [207] Course Schedule * * https://leetcode.com/problems/course-schedule/description/ * * algorithms * Medium (37.19%) * Total Accepted: 208.1K * Total Submissions: 554.5K * Testcase Example: '2\n[[1,0]]' * * There are a total of n courses ...
207-canfinish/207.course-schedule.go
0.823186
0.53965
207.course-schedule.go
starcoder
package wallify import ( "image" ) type Wallifier interface { IsWallable(p image.Point) bool IsSeen(p image.Point) bool } /* Wallify determins the type of wall rune to use for a given cell. A bitmask of its neighbors is made: 1 8#2 4 The bit is set if the corresponding neighbor IsW...
roguelike/wallify/wallify.go
0.507568
0.522872
wallify.go
starcoder
package buffer import ( "encoding/gob" "io" ) type swap struct { A BufferAt B BufferAt } // NewSwap creates a Buffer which writes to a until you write past a.Cap() // then it io.Copy's from a to b and writes to b. // Once the Buffer is empty again, it starts over writing to a. // Note that if b.Cap() <= a.Cap() ...
vendor/github.com/djherbis/buffer/swap.go
0.579162
0.538923
swap.go
starcoder
package flow // Map operates on each row, and the returned results are passed to next dataset. func (d *Dataset) Map(code string) *Dataset { ret, step := add1ShardTo1Step(d) step.Name = "Map" step.Script = d.FlowContext.createScript() step.Script.Map(code) return ret } // ForEach operates on each row, but the re...
flow/dataset_map.go
0.799364
0.481637
dataset_map.go
starcoder
package libaural2 import ( "bytes" "crypto/sha256" "encoding/base32" "encoding/binary" "encoding/gob" "fmt" "image/color" "github.com/lucasb-eyer/go-colorful" "github.ibm.com/Blue-Horizon/aural2/urbitname" ) // Duration of audio clip in seconds const Duration int = 10 // SampleRate of audio const SampleRa...
libaural2/libaural2.go
0.702326
0.407628
libaural2.go
starcoder
package forwardt import "github.com/melvinodsa/goOdsa/utils" //FTransform does the forward transform of a given string func FTransform(iString []byte) utils.Data { result := utils.NewODSAData() if len(iString) == 0 { return result } result.SetLastLetter(0) result.SetLastPos(-1) sLen := len(iString) //Algorit...
modules/forwardt/forwardt.go
0.612541
0.405625
forwardt.go
starcoder
package main import ( "image" "image/color" "math" ) // Channel stores a histogram of all values present in // and image for a specific colour channel type Channel struct { Shades [65536]uint32 Min, Max, Total uint32 } // Add adds a colour value to the channel func (c *Channel) Add(val uint32) { c.Sha...
palette.go
0.744192
0.416915
palette.go
starcoder
package sdl // #include "includes.h" import "C" // CPU feature detection for SDL. const ( CACHELINE_SIZE = C.SDL_CACHELINE_SIZE ) // This function returns the number of CPU cores available. // ↪ https://wiki.libsdl.org/SDL_GetCPUCount func GetCPUCount() (retval int) { retval = int(C.SDL_GetCPUCount()) ...
sdl/SDL_cpuinfo.h.go
0.560734
0.427038
SDL_cpuinfo.h.go
starcoder
package rbt import ( "github.com/smartystreets/assertions" ) // https://www.bilibili.com/video/BV1oq4y1d7jv?spm_id_from=333.999.0.0 0:35:0 双黑节点 func (t *RedBlackTree) Remove(v Key) (ret bool) { ret = true cur := t.Find(v) if cur == nil { return false } for { // case 1 if cur.Left == nil && cur.Right ==...
rb_tree_delete.go
0.546496
0.496948
rb_tree_delete.go
starcoder
package insights import ( "math" "sort" "time" ) type Timeline map[time.Time]Conversation func NewTimeline(c Conversation, d time.Duration) (t Timeline) { if d == 0 { d = time.Hour * 24 } first, last := c.First(), c.Last() start := time.Date(first.Time.Year(), first.Time.Month(), first.Time.Day(), 0, 0, 0,...
timeline.go
0.593609
0.428712
timeline.go
starcoder
package nudge import ( "fmt" "strings" "time" "github.com/robfig/cron/v3" ) var ( weekDays = map[time.Weekday]string{ time.Sunday: strings.ToLower(time.Sunday.String()), time.Monday: strings.ToLower(time.Monday.String()), time.Tuesday: strings.ToLower(time.Tuesday.String()), time.Wednesday: stri...
pkg/nudge/schedule.go
0.603815
0.409457
schedule.go
starcoder
package poly import "fmt" // Point is simple 2D point type Point struct { X, Y, Z float64 } // InsideRect detects point is inside of another rect func (p Point) InsideRect(rect Rect) bool { if p.X < rect.Min.X || p.X > rect.Max.X { return false } if p.Y < rect.Min.Y || p.Y > rect.Max.Y { return false } ret...
pkg/geojson/poly/poly.go
0.869105
0.607052
poly.go
starcoder
package parquet import "strings" type columnPath []string func (path columnPath) append(name string) columnPath { return append(path[:len(path):len(path)], name) } func (path columnPath) equal(other columnPath) bool { return stringsAreEqual(path, other) } func (path columnPath) less(other columnPath) bool { ret...
column_path.go
0.603581
0.441854
column_path.go
starcoder
package mimemagic import ( "sort" "strings" ) type byteMatcher interface { matchByte(byte) bool } type matcher interface { len() int match(string) bool } type glob interface { matcher isCaseSensitive() bool mediaType() simpleGlob } type value string type list string type byteRange struct{ min, max byte } typ...
glob.go
0.506591
0.431345
glob.go
starcoder
package iter // Any represents any type. type Any interface{} type ( // UnaryPredicate checks if a value satisfy condition. UnaryPredicate func(Any) bool // EqComparer checks if first value equals to the second value. EqComparer func(Any, Any) bool // LessComparer checks if first value is less than the second va...
funcs.go
0.843089
0.481576
funcs.go
starcoder
package life // Game of life. Constructor functions should be used to create instances. type Game struct { cells Cells neighbors func(Point) []Point } // State of a cell type State int const ( // Dead indicates that a cell is dead Dead State = iota // Alive indicates that a cell is alive Alive ) // Cells ...
life/game.go
0.826537
0.755389
game.go
starcoder
package rove import ( "log" "github.com/mdiluz/rove/pkg/maths" "github.com/mdiluz/rove/proto/roveapi" ) // chunk represents a fixed square grid of tiles type chunk struct { // Tiles represents the tiles within the chunk Tiles []byte // Objects represents the objects within the chunk // only one possible obje...
pkg/rove/chunkAtlas.go
0.794704
0.695884
chunkAtlas.go
starcoder
package bufio import ( "bufio" "bytes" "io" ) const defaultBufferSize = 1024 // Reader implements buffering for an io.Reader object. type Reader struct { err error buf []byte rd io.Reader rpos int wpos int slice SliceAlloc } // NewReader returns a new Reader whose buffer has the default size. func NewR...
lib/bufio/bufio.go
0.670932
0.422088
bufio.go
starcoder
package colorgrad import ( "math" "github.com/lucasb-eyer/go-colorful" "github.com/mazznoer/csscolorparser" ) type interpolator interface { at(float64) float64 } // Adapted from https://qroph.github.io/2018/07/30/smooth-paths-using-catmull-rom-splines.html type catmullRomInterpolator struct { segments [][4]fl...
spline.go
0.638497
0.468122
spline.go
starcoder
package pars import ( "bytes" "fmt" "strings" "github.com/go-ascii/ascii" ) // Byte creates a Parser which will attempt to match the next single byte. // If no bytes are given, it will match any byte. // Otherwise, the given bytes will be tested for a match. func Byte(p ...byte) Parser { switch len(p) { case 0...
bytes.go
0.679072
0.424591
bytes.go
starcoder
package stats import ( "math/rand" "sync" "sync/atomic" "time" ) // Measurer represents a monitoring contract. type Measurer interface { Snapshotter Measure(name string, value int32) MeasureElapsed(name string, start time.Time) MeasureRuntime() Tag(name, tag string) } // Metric maintains a combination of a...
metric.go
0.813313
0.457561
metric.go
starcoder
package util import ( "fmt" "regexp" "strconv" "time" ) var yearRE = regexp.MustCompile(`^(\d{4})$`) var monthRE = regexp.MustCompile(`^(\d{4})-(\d{2})$`) var weekRE = regexp.MustCompile(`^(\d{4})-W(\d{2})$`) var dayRE = regexp.MustCompile(`^(\d{4})-(\d{2})-(\d{2})$`) var hourRE = regexp.MustCompile(`^(\d{4})-(\d...
internal/pkg/magneticod/util/iso8601.go
0.534127
0.483039
iso8601.go
starcoder
package pooly import ( "math" "math/rand" "sync" ) // SoftMax strategy varies host selection probabilities as a graded function of their estimated scores. // The temperature parameter is used to tweak the algorithm behavior: // high temperature (+inf) means that all hosts will have nearly the same probability of b...
bandit.go
0.749362
0.53279
bandit.go
starcoder
package graphics import ( "github.com/ironarachne/world/pkg/geometry" "image" "image/color" "os" "github.com/fogleman/gg" ) // Pattern is a fill pattern type Pattern struct { Type string Color color.RGBA PatternFileName string } // Center returns the center point of a given rectangle fu...
pkg/graphics/graphics.go
0.90941
0.695267
graphics.go
starcoder
package uhttp import ( "math/rand" "time" ) // RepeatFunc generates delays between successive repeats of a request. prev will // contain the value of the previous repeat (zero for the first). It should return // nil to stop repeating, and should not be called after that. type RepeatFunc func(prev time.Duration) *...
repeat.go
0.590425
0.460713
repeat.go
starcoder
package challenges import ( "bufio" "fmt" "math" "os" ) // D6C1 - Day 6 Challenge 1 // Input is a list of strings in the form of `346, 260` // Output is a single unsigned int func D6C1() { var coords [][2]int maxX, maxY, minX, minY := 0, 0, 0, 0 // Populate coords for in := bufio.NewScanner(os.Stdin); in.Sca...
challenges/day6.go
0.621771
0.496765
day6.go
starcoder
Pyrios is an Elasticsearch proxy. Pyrios forwards the HTTP request from a client to the on prem ElasticSearch cluster and sends the response back to the client. The in-cluster application can access the pyrios API endpoint via the `pyrios` service. */ package main import ( "cloud.google.com/go/compute/metadata" "co...
pyrios/main.go
0.69451
0.411939
main.go
starcoder
package canopen type DicArray struct { Description string Index uint16 Name string SDOClient *SDOClient SubIndexes map[uint8]DicObject SubNames map[string]uint8 } func (array *DicArray) GetIndex() uint16 { return array.Index } func (array *DicArray) GetSubIndex() uint8 { return 0 } func (arr...
dic_array.go
0.625324
0.450359
dic_array.go
starcoder
package song2 // https://www.youtube.com/watch?v=SSbBvKaM6sk import ( "image" "image/color" "image/draw" "math" "runtime" "sync" ) func GaussianBlur(src image.Image, r float64) *image.RGBA { clone := CloneToRGBA(src) dst := CloneToRGBA(src) bxs := BoxesForGauss(r, 3) for _, b := range bxs { boxBlur(clo...
song2.go
0.532911
0.438064
song2.go
starcoder
package currency var ( byNumeric = map[string]*Currency{} byISO = map[string]*Currency{} // Testing currency // For tesing purposes this currency should have 2 decimal digits // just like other major currencies xts = Currency{ Numeric: "963", ISO: "XTS", Decimals: 2, Name: "Testing currenc...
all.go
0.591959
0.571229
all.go
starcoder
package locale import ( "sort" ) // A lang id is an identifier of a specific fixed-width string and defines // a 1-based index into a lookup string. The lookup consists of concatenated // blocks of size 3, where each block contains a lang string. type langID uint8 type langLookup string func (l langLookup) lang(i...
internal/locale/tags.go
0.658857
0.403626
tags.go
starcoder
package shamir import ( "errors" "github.com/superarius/shamir/modular" ) type Share struct { X *modular.Int Y *modular.Int } func Shares(threshold, total int, raw []byte) ([]*Share, error) { if threshold > total { return nil, errors.New("cannot require more shares then existing") } // Convert the secre...
shamir.go
0.707809
0.414543
shamir.go
starcoder
package vmath import ( "fmt" "github.com/maja42/vmath/math32" ) type Vec4f [4]float32 func (v Vec4f) String() string { return fmt.Sprintf("Vec4f[%f x %f x %f x %f]", v[0], v[1], v[2], v[3]) } // Format the vector to a string. func (v Vec4f) Format(format string) string { return fmt.Sprintf(format, v[0], v[1], ...
vec4f.go
0.92607
0.656497
vec4f.go
starcoder
package roadway import ( "fmt" "go-experiments/common/commonio" "go-experiments/common/commonmath" "go-experiments/voxelli/config" "go-experiments/voxelli/geometry" "math" "strconv" "strings" "github.com/go-gl/mathgl/mgl32" ) // Defines the road types that exist in our file. type RoadType int // Ordering i...
voxelli/roadway/roadway.go
0.784608
0.544741
roadway.go
starcoder
package main import ( "errors" ) var ( corpus = map[int]*httpcode{ 100: { 100, "Continue", "This interim response indicates that everything so far is OK and that the client should continue the request, or ignore the response if the request is already finished.", "https://developer.mozilla.org/en-US/do...
corpus.go
0.65202
0.405949
corpus.go
starcoder
package v1 import ( "encoding/json" ) // BgpNeighborData struct for BgpNeighborData type BgpNeighborData struct { // Address Family for IP Address. Accepted values are 4 or 6 AddressFamily *float32 `json:"address_family,omitempty"` // The customer's ASN. In a local BGP deployment, this will be an internal ASN us...
v1/model_bgp_neighbor_data.go
0.824144
0.426083
model_bgp_neighbor_data.go
starcoder
package aips import ( "image" "image/color" "math" ) func Rotate(src image.Image, ang float64) image.Image { // 计算旋转后保留完整图像的宽和高 cosA, sinA := math.Cos(-ang), math.Sin(-ang) srcRect := src.Bounds() srcWidth := srcRect.Dx() srcHeight := srcRect.Dy() dstWidth := int(math.Abs(float64(srcWidth)*cosA - float64(src...
base.go
0.59408
0.648807
base.go
starcoder
package main var samples = ` { "aircraftEvent": { "aircraft": { "airline": "AssetID of airline that owns this airplane", "code": "Aircraft code -- e.g. WN / SWA", "dateOfBuild": "Aircraft build completed / in service date", "mode-s": "Aircraft transponder res...
contracts/industry/aviation_sample_contract/samples.go
0.759761
0.542257
samples.go
starcoder
package encoder import ( "github.com/humilityai/sam" ) // JamesSteinRegression is a one way encoder. // You cannot decode JamesSteinRegression values // as some values may be encoded with the same // numerical code. // JamesSteinRegression is a target-based encoder. type JamesSteinRegression struct { ...
james-stein.go
0.655226
0.513546
james-stein.go
starcoder
package kubernetes import ( "context" "crypto/tls" _ "embed" "errors" "fmt" "github.com/datadog/stratus-red-team/internal/providers" "github.com/datadog/stratus-red-team/pkg/stratus" "github.com/datadog/stratus-red-team/pkg/stratus/mitreattack" "io" authenticationv1 "k8s.io/api/authentication/v1" metav1 "k8...
internal/attacktechniques/k8s/privilege-escalation/nodes-proxy/main.go
0.759404
0.503235
main.go
starcoder
package spt // http://iquilezles.org/www/articles/distfunctions/distfunctions.htm import ( "encoding/gob" "math" ) func init() { gob.Register(SDFExtrude{}) gob.Register(SDFRevolve{}) gob.Register(SDFSphere{}) gob.Register(SDFCube{}) gob.Register(SDFTorus{}) gob.Register(SDFCone{}) gob.Register(SDFRounded{})...
sdf3.go
0.714827
0.441131
sdf3.go
starcoder
package storage import ( "math" "github.com/flowmatters/openwater-core/data" "github.com/flowmatters/openwater-core/util/m" ) /* OW-SPEC StorageParticulateTrapping: inputs: inflowLoad: kg.s^-1 inflow: m^3.s^-1 outflow: m^3.s^-1 storage: m^3 states: storedMass: kg parameters: DeltaT: '[1,86400] Time...
models/storage/sediment_trapping.go
0.621081
0.430267
sediment_trapping.go
starcoder
package main import ( "errors" "fmt" ) func main() { t := &TreeNode{value: 8} t.Insert(1) t.Insert(2) t.Insert(3) t.Insert(4) t.Insert(5) t.Insert(6) t.Insert(7) t.Delete(5) t.Delete(7) t.PrintInOrder() fmt.Println("") fmt.Printf("min is %d\n", t.FindMin()) fmt.Printf("max is %d\n", t.FindMax()) }...
main.go
0.730866
0.654011
main.go
starcoder
package iotmaker_geo_osm import ( "bytes" "crypto/md5" "encoding/binary" "errors" "fmt" "github.com/helmutkemper/gOsm/consts" "github.com/helmutkemper/gOsm/utilMath" "github.com/helmutkemper/mgo/bson" log "github.com/helmutkemper/seelog" "github.com/helmutkemper/zstd" "io" "io/ioutil" "math" "os" "strco...
typePoint.go
0.627723
0.40031
typePoint.go
starcoder
package advent import ( "strings" . "github.com/davidparks11/advent2021/internal/advent/day12" ) var _ Problem = &theTreacheryOfWhales{} type passagePathing struct { dailyProblem } func NewPassagePathing() Problem { return &passagePathing{ dailyProblem{ day: 12, }, } } func (p *passagePathing) Solve()...
internal/advent/day12.go
0.641984
0.428592
day12.go
starcoder
package chm import ( "math" "github.com/CRAB-LAB-NTNU/PPS-BS/biooperators" "github.com/CRAB-LAB-NTNU/PPS-BS/types" ) // R2S struct defines the parameters needed by r2s and the methods available type R2S struct { Z float64 //InitialDeltaIn, InitialDeltaOut float64 DeltaIn, DeltaOut []float64 HasCheck...
chm/r2s.go
0.607081
0.465813
r2s.go
starcoder
package graph import ( "github.com/DmitryBogomolov/algorithms/graph/internal/utils" ) // In a DFS tree a vertex is articulation point if: // - it is root and has at least two children // - it is not root and has subtree with no back edges to ancestors func findCutVerticesCore( gr Graph, // original vertex distance...
graph/graph/cut_vertices.go
0.68784
0.517815
cut_vertices.go
starcoder
package chunk import ( "container/list" "github.com/df-mc/dragonfly/server/block/cube" ) // insertBlockLightNodes iterates over the chunk and looks for blocks that have a light level of at least 1. // If one is found, a node is added for it to the node queue. func (a *lightArea) insertBlockLightNodes(queue *list.Li...
server/world/chunk/light.go
0.632049
0.500916
light.go
starcoder
package jit import ( "fmt" ) // unary expression OP X type Expr1 struct { X Expr Op Op1 K Kind } // binary expression X OP Y type Expr2 struct { X Expr Y Expr Op Op2 K Kind } func NewExpr1(op Op1, x Expr) *Expr1 { kind := x.Kind() if op.IsCast() { // cast Ops have the same values // as the corres...
vendor/github.com/cosmos72/gomacro/jit/expr.go
0.577972
0.420778
expr.go
starcoder
package types import ( "fmt" fssz "github.com/ferranbt/fastssz" ) var _ fssz.HashRoot = (Epoch)(0) var _ fssz.Marshaler = (*Epoch)(nil) var _ fssz.Unmarshaler = (*Epoch)(nil) // Epoch represents a single epoch. type Epoch uint64 // Mul multiplies epoch by x. func (e Epoch) Mul(x uint64) Epoch { return Epoch(uin...
epoch.go
0.882377
0.428831
epoch.go
starcoder