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 configuration // ConfigurationContract declares the service that provides configuration required by different demo automation functions type ConfigurationContract interface { // GetProjectId returns the Google Cloud project ID // Returns the Google Cloud project ID or error if something goes wrong GetProjec...
services/configuration/contract.go
0.689515
0.443902
contract.go
starcoder
package functiongrapher import ( "math" "github.com/benoitkugler/maths-online/maths/repere" ) // quadratic polinomial // x = At^2 + Bt + C // where // A = p0 + p2 - 2p1 // B = 2(p1 - p0) // C = p0 func bezierQuad(p0, p1, p2, t float64) float64 { return (p0+p2-2*p1)*t*t + 2*(p1-p0)*t + p0 } // derivative as at + ...
server/src/maths/functiongrapher/bounding_box.go
0.77827
0.535281
bounding_box.go
starcoder
package main import ( "fmt" "math" ) /** Roman numerals are represented by seven different symbols: I, V, X, L, C, D and M. Symbol Value I 1 V 5 X 10 L 50 C 100 D 500 M 1000 For example, two is written as II in Roman numeral,...
LeetCode/Algorithms/integer-to-roman/main.go
0.616474
0.464598
main.go
starcoder
package must /* BeEqual compares the expected and got interfaces, triggering an error on t if they are not equal. This error will include a diff of the two objects. The return value will be true if the interfaces are equal. Additional output for any error message can be provided as additional parameters, as with fmt...
checks.go
0.791499
0.781539
checks.go
starcoder
package dasel import ( "fmt" "reflect" ) // QueryMultiple uses the given selector to query the current node for every match // possible and returns all of the end nodes. func (n *Node) QueryMultiple(selector string) ([]*Node, error) { n.Selector.Remaining = selector if err := buildFindMultipleChain(n); err != ni...
node_query_multiple.go
0.781622
0.413418
node_query_multiple.go
starcoder
package parser import ( "github.com/hydralang/ptk/lexer" ) // ExprFirst functions are called to process the first token in an // expression. Functions of this type are typically declared on // literal tokens or prefix operators. type ExprFirst func(parser *Parser, power int, tok *lexer.Token) (Node, error) // Exp...
parser/table.go
0.650245
0.613237
table.go
starcoder
package gaia import ( "fmt" "github.com/globalsign/mgo/bson" "github.com/mitchellh/copystructure" "go.aporeto.io/elemental" ) // StatsQueryMeasurementValue represents the possible values for attribute "measurement". type StatsQueryMeasurementValue string const ( // StatsQueryMeasurementAccesses represents the ...
statsquery.go
0.794146
0.465266
statsquery.go
starcoder
package measure import ( "io" "time" "github.com/ipfs/fs-repo-migrations/ipfs-6-to-7/gx/ipfs/QmRg1gKTHzc3CZXSKzem8aR4E3TubFhbgXwfVuWnSK5CC5/go-metrics-interface" "github.com/ipfs/fs-repo-migrations/ipfs-6-to-7/gx/ipfs/QmXRKBQA4wXP7xWbFiZsR1GP4HV6wMDQ1aWFxZZ4uBcPX9/go-datastore" "github.com/ipfs/fs-repo-migration...
ipfs-6-to-7/gx/ipfs/QmbJgZGRtkFeSdCxBCPaMKWRDYbqMxHyFfvjQGcWzpqsDe/go-ds-measure/measure.go
0.57332
0.468365
measure.go
starcoder
package labels import ( "regexp" ) // Selector holds constraints for matching against a label set. type Selector []Matcher // Matches returns whether the labels satisfy all matchers. func (s Selector) Matches(labels Labels) bool { for _, m := range s { if v := labels.Get(m.Name()); !m.Matches(v) { return fal...
vendor/github.com/prometheus/tsdb/labels/selector.go
0.861596
0.610134
selector.go
starcoder
package apiary import ( "context" "encoding/json" "fmt" "log" "net/http" ) // VerseTrend is the rate of quotations in a single year for a single verse in a given corpus. The quotation rate is expressed in quotations per million words; the smoothed rate has the same units, and is a centered three-year rolling ave...
apb-verse-trend.go
0.63624
0.414899
apb-verse-trend.go
starcoder
package scenery import "fmt" import "github.com/lquesada/cavernal/assets" import "github.com/lquesada/cavernal/world" import "github.com/lquesada/cavernal/model" import "github.com/lquesada/cavernal/lib/g3n/engine/math32" // -- var concreteColumnModel = &model.NodeSpec{ Decoder: model.Load(dir, "concretecolumn",...
assets/scenery/floor.go
0.52902
0.476884
floor.go
starcoder
package strutils import ( "strings" "unicode" ) // ToSnakeCase convert argument to snake_case style string. // If argument is empty, return itself. func ToSnakeCase(s string) string { if len(s) == 0 { return s } fields := splitToLowerFields(s) return strings.Join(fields, "_") } // IsSnakeCase check whether...
internal/utils/strutils/casee.go
0.646349
0.458046
casee.go
starcoder
package xlsrpt import ( "fmt" "reflect" "sort" "strconv" "strings" "time" "github.com/tealeg/xlsx" ) // CellInt - Integer Cell Type. type CellInt int // CellStr - String Cell Type. type CellStr string // CellNumeric - Numeric Cell Type (Number with no format). type CellNumeric float64 // CellDecimal - Deci...
cellformatter.go
0.536313
0.518546
cellformatter.go
starcoder
package bmftype import ( "bufio" "bytes" "fmt" "unicode" "encoding/binary" "github.com/dsoprea/go-logging" "github.com/dsoprea/go-iso-bmf/common" ) // InfeItemType allows simple handling of item-types. It can be compared as a // uint32 or as a string, adds a few boolean tests, and allows exporting as a // s...
type/meta_infe.go
0.659953
0.47171
meta_infe.go
starcoder
package netpol import ( "fmt" v1 "k8s.io/api/core/v1" "k8s.io/kubernetes/test/e2e/framework" "strings" ) // TestCase describes the data for a netpol test type TestCase struct { ToPort int Protocol v1.Protocol Reachability *Reachability } // PodString represents a namespace 'x' + pod 'a' as "x/a". ty...
test/e2e/network/netpol/reachability.go
0.7478
0.403126
reachability.go
starcoder
package interval import ( "fmt" "time" "github.com/lindb/lindb/pkg/timeutil" ) // Type defines interval type type Type int const dayStr = "day" const monthStr = "month" const yearStr = "year" // Interval types. const ( Day Type = iota + 1 Month Year Unknown ) // String returns string value of interval type...
pkg/interval/interval.go
0.859413
0.49823
interval.go
starcoder
package vector import ( "fmt" "github.com/go-gl/mathgl/mgl32" "github.com/wieku/danser-go/framework/math/math32" ) type Vector2f struct { X, Y float32 } func NewVec2f(x, y float32) Vector2f { return Vector2f{x, y} } func NewVec2fP(x, y float32) *Vector2f { return &Vector2f{x, y} } func NewVec2fRad(rad, lengt...
framework/math/vector/vector2f.go
0.862178
0.704535
vector2f.go
starcoder
package plaid import ( "encoding/json" ) // Security Contains details about a security type Security struct { // A unique, Plaid-specific identifier for the security, used to associate securities with holdings. Like all Plaid identifiers, the `security_id` is case sensitive. SecurityId string `json:"security_id"`...
plaid/model_security.go
0.81283
0.413625
model_security.go
starcoder
package api func init() { Swagger.Add("applications", `{ "swagger": "2.0", "info": { "title": "api/external/applications/applications.proto", "version": "version not set" }, "schemes": [ "http", "https" ], "consumes": [ "application/json" ], "produces": [ "application/json" ]...
components/automate-gateway/api/applications.pb.swagger.go
0.725551
0.405096
applications.pb.swagger.go
starcoder
package hash // CyclicPoly provides a cyclic polynomial rolling hash. type CyclicPoly struct { h uint64 p []uint64 i int } // ror rotates the unsigned 64-bit integer to right. The argument s must be // less than 64. func ror(x uint64, s uint) uint64 { return (x >> s) | (x << (64 - s)) } // NewCy...
vendor/github.com/ulikunitz/xz/internal/hash/cyclic_poly.go
0.635901
0.401072
cyclic_poly.go
starcoder
package main import ( "errors" "strconv" ) // patternFromName returns an instruction pattern, which is a two-dimensional // slice describing the tokens that an instruction accepts as arguments. // The first dimension is an ordered list of lists of token types, which // describes how many tokens are accepted. The se...
instructions.go
0.600423
0.483831
instructions.go
starcoder
package main import ( "github.com/frangiz/adventofcode2019/pkg/aoc" "strings" ) type wireStep struct { wireID, steps int } var dirs = map[string]aoc.Vector2D{ "R": aoc.MakeVector2D(1, 0), "L": aoc.MakeVector2D(-1, 0), "U": aoc.MakeVector2D(0, -1), "D": aoc.MakeVector2D(0, 1), } type frontPanel struct { visi...
day3/main.go
0.551574
0.516047
main.go
starcoder
package typ import ( "fmt" "strings" "xelf.org/xelf/bfr" "xelf.org/xelf/cor" "xelf.org/xelf/knd" ) // Type describes the shape of a xelf expression, literal or value. type Type struct { Kind knd.Kind ID int32 Body } type BodyPair struct{ A, B Body } type Hist []BodyPair // Body contains additional type i...
typ/type.go
0.54359
0.418578
type.go
starcoder
package main //GameBoard is a two-dimensional slice of booleans type GameBoard []([]bool) //InitializeBoard takes a number of rows and columns as inputs and returns a gameboard with appropriate number of rows and colums, where all values = false. func InitializeBoard(numRows, numCols int) GameBoard { // make a 2-D s...
drawLab/GOL.go
0.737725
0.636974
GOL.go
starcoder
package atomic import ( "sync" ) // AtomicInt implements an int value with atomic semantics type AtomicInt struct { val int mutex sync.RWMutex } // NewAtomicInt generates a new AtomicInt instance. func NewAtomicInt(value int) *AtomicInt { return &AtomicInt{ val: value, } } // AddAndGet atomically adds the...
types/atomic/int.go
0.794664
0.456168
int.go
starcoder
package TS29122CommonData import ( externalRef0 "magma/feg/gateway/sbi/specs/TS29571CommonData" externalRef1 "magma/feg/gateway/sbi/specs/TS29572NlmfLocation" ) // AccumulatedUsage defines model for AccumulatedUsage. type AccumulatedUsage struct { // Unsigned integer identifying a volume in units of bytes. Downli...
feg/gateway/sbi/specs/TS29122CommonData/TS29122CommonData.gen.go
0.672439
0.405037
TS29122CommonData.gen.go
starcoder
package main import ( "errors" "strconv" ) //binaryEvaluate takes a root node and applies the given function to each subnode func binaryEvaluate(root tree, symbolTable map[string]interface{}, fn binaryFunc) (interface{}, error) { var err error err = nil var leftValue, rightValue, nodeValue interface{} //reuse ...
src/tree_walker.go
0.59796
0.402304
tree_walker.go
starcoder
package stationxml import ( "fmt" ) // Equivalent to SEED blockette 52 and parent element for the related the response blockettes. type Channel struct { BaseNode // URI of any type of external report, such as data quality reports. ExternalReferences []ExternalReference `xml:"ExternalReference,omitempty" json:",o...
vendor/github.com/ozym/fdsn/stationxml/channel.go
0.80905
0.476092
channel.go
starcoder
package parsers type value struct { isNil bool variable VariableName numeric NumericValue bl *bool strValue string } func createValueWithNil() Value { return createValueInternally(true, nil, nil, nil, "") } func createValueWithVariable(variable VariableName) Value { return createValueInternally(fals...
pangolin/domain/parsers/value.go
0.732113
0.401336
value.go
starcoder
package jin import ( "strconv" ) // Get returns the value that path has pointed. // It stripes quotation marks from string values. // Path can point anything, a key-value pair, a value, an array, an object. // Path variable can not be null, // otherwise it will provide an error message. func Get(json []byte, path .....
inter_get.go
0.755096
0.436742
inter_get.go
starcoder
package bls12381 import "io" // fp6 represents an element // a + b v + c v^2 of fp^6 = fp^2 / v^3 - u - 1. type fp6 struct { A, B, C fp2 } // Set fp6 = a func (f *fp6) Set(a *fp6) *fp6 { f.A.Set(&a.A) f.B.Set(&a.B) f.C.Set(&a.C) return f } // SetFp creates an element from a lower field func (f *fp6) SetFp(a *f...
pkg/core/curves/native/bls12381/fp6.go
0.771112
0.426919
fp6.go
starcoder
package server import ( "math" ) 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 { tick uint64 inMemLogSize uint64 maxSize ...
internal/server/rate.go
0.717111
0.478224
rate.go
starcoder
package nodespec import ( "github.com/giantswarm/microerror" "gopkg.in/yaml.v2" ) var ( // specYAML is the raw data on all necessary AWS instance types taken from // https://github.com/giantswarm/installations/blob/master/default-draughtsman-configmap-values.yaml // Warning: YAML in Golang is super fragile. Ther...
nodespec/aws.go
0.734501
0.45744
aws.go
starcoder
package core import ( "runtime" . "github.com/gooid/gocv/opencv3/internal/native" ) const _channelsMatOfKeyPoint = 7 var _depthMatOfKeyPoint = CvTypeCV_32F type MatOfKeyPoint struct { *Mat } func NewMatOfKeyPoint() (rcvr *MatOfKeyPoint) { rcvr = &MatOfKeyPoint{} rcvr.Mat = NewMat2() runtime.SetFinalizer(rcv...
opencv3/core/MatOfKeyPoint.java.go
0.651244
0.411939
MatOfKeyPoint.java.go
starcoder
package engine import ( "reflect" "github.com/mumax/3/cuda" "github.com/mumax/3/data" "github.com/mumax/3/util" ) var U displacement // displacement [m] func init() { DeclLValue("u", &U, `displacement [m]`) } // Special buffered quantity to store displacement // makes sure it's normalized etc. type displacemen...
engine/displacement.go
0.556641
0.426322
displacement.go
starcoder
package clusters import ( "math" "math/rand" "sync" "time" "gonum.org/v1/gonum/floats" ) const ( changesThreshold = 2 ) type kmeansClusterer struct { iterations, number int // variables keeping count of changes of points' membership every iteration. User as a stopping condition. changes, oldchanges, count...
kmeans.go
0.677047
0.464659
kmeans.go
starcoder
// Package trie implements a in-memory trie tree. // Reference: Trie - Wikipedia, the free encyclopedia package trie import ( "strings" "sync" ) // delim is the metric name delimeter, in banshee is a single dot. const delim = "." // tree is the internal tree. type tree struct { value interface{} children map...
util/trie/trie.go
0.828662
0.427158
trie.go
starcoder
package state import ( "sync" "github.com/pkg/errors" ethpb "github.com/prysmaticlabs/ethereumapis/eth/v1alpha1" coreutils "github.com/prysmaticlabs/prysm/beacon-chain/core/state/stateutils" pbp2p "github.com/prysmaticlabs/prysm/proto/beacon/p2p/v1" ) func init() { fieldMap = make(map[fieldIndex]dataType, fiel...
.docker/Prysm/prysm-spike/beacon-chain/state/types.go
0.628977
0.417271
types.go
starcoder
package sink import "fmt" // a block comment describing const assignments: const ( ONE = 1 // represents the number 1 TWO = 2 // represents the number 2 THREE = 3 // represents the number 3 ) // a block comment describing var assignments: var ( one = "one" // represents the english spelling of 1 two =...
sink/sink.go
0.767429
0.604632
sink.go
starcoder
package schema import ( "context" "errors" "fmt" "strings" "cloud.google.com/go/spanner" "github.com/cloudspannerecosystem/gcsb/pkg/schema/information" ) type ( Table interface { SetName(string) Name() string SetType(string) Type() string HasParent() bool SetParentName(string) ParentName() stri...
pkg/schema/table.go
0.50708
0.414247
table.go
starcoder
package _675_Cut_Off_Trees_for_Golf_Event import ( "fmt" "sort" ) /* https://leetcode.com/problems/cut-off-trees-for-golf-event/description/ You are asked to cut off trees in a forest for a golf event. The forest is represented as a non-negative 2D map, in this map: 0 represents the obstacle can't be reached. 1 r...
675_Cut_Off_Trees_for_Golf_Event/cut_off_trees.go
0.830525
0.58255
cut_off_trees.go
starcoder
package vision // VGG models import ( "fmt" "github.com/sugarme/gotch/nn" ts "github.com/sugarme/gotch/tensor" ) // NOTE: each list element contains multiple convolutions with some specified number // of features followed by a single max-pool layer. func layersA() [][]int64 { return [][]int64{ {64}, {128}, ...
vision/vgg.go
0.866571
0.417687
vgg.go
starcoder
//go:generate go run gen.go gen_common.go -output tables.go // Package currency contains currency-related functionality. package currency import ( "errors" "sort" "golang.org/x/text/internal/tag" "golang.org/x/text/language" ) // TODO: // - language-specific currency names. // - currency formatting. // - curre...
vendor/github.com/elastic/beats/vendor/golang.org/x/text/currency/currency.go
0.522202
0.450843
currency.go
starcoder
package scheduler import "time" // Schedule describes a job's duty cycle. type Schedule interface { // Next returns the next activation time, later than the given time. // Next returns 0(Time.IsZero()) to indicate job termination. Next(time.Time) time.Time } // ScheduleFunc is an adapter to allow the use of ordi...
schedule.go
0.812756
0.535341
schedule.go
starcoder
package optional import ( "time" ) // Bool represents an optional bool value. type Bool struct { value bool hasValue bool } // MakeBool makes a new optional bool value with the given value. func MakeBool(value bool) Bool { return Bool{value, true} } // Set sets the bool value. func (b *Bool) Set(value bool)...
optional.go
0.918016
0.572544
optional.go
starcoder
package handel import ( "bytes" "encoding/binary" "errors" "fmt" "io" ) // PublicKey represents either a generic individual or aggregate public key. It // contain methods to verify a signature and to combine multiple public // keys together to verify signatures. type PublicKey interface { // VerifySignature tak...
crypto.go
0.793866
0.403361
crypto.go
starcoder
package block import ( "github.com/df-mc/dragonfly/dragonfly/block/instrument" "github.com/df-mc/dragonfly/dragonfly/item" "github.com/df-mc/dragonfly/dragonfly/world" "github.com/df-mc/dragonfly/dragonfly/world/particle" "github.com/df-mc/dragonfly/dragonfly/world/sound" ) // NoteBlock is a musical block that e...
dragonfly/block/note_block.go
0.679072
0.478163
note_block.go
starcoder
package fuzzy import ( "sort" "strings" ) // Match represents a matched string. type Match struct { // The matched string. Str string // The index of the matched string in the supplied slice. Index int // The indexes of matched characters. Useful for highlighting matches. MatchedIndexes []int // Marker to id...
vendor/github.com/sahilm/fuzzy/fuzzy.go
0.692018
0.448004
fuzzy.go
starcoder
package bitmap import "fmt" //24 cores const defaultSize = 24 const maxSize = 1024 //two nodes const defaultNodeNum = 2 // NumaBitmap present NUMA cpu bits. type NumaBitmap struct { bits []byte size uint userSize uint //NUMA node num nodeNum int } // NewNumaBitmap create bitmap with default args. func NewNu...
bitmap/bitmap.go
0.504639
0.411229
bitmap.go
starcoder
package sqlx import ( "fmt" "reflect" "strings" ) type Queryer struct { Where interface{} Scanner interface{} } func (q *Queryer) scanner() interface{} { t := reflect.TypeOf(q.Scanner).Elem() if t == nil { return nil } switch t.Kind() { case reflect.Slice: t = t.Elem() if t.Kind() == reflect.Ptr...
queryer.go
0.550366
0.474996
queryer.go
starcoder
package linked_list import "fmt" type LinkedList[T any] struct { head T tail *LinkedList[T] } func (w *LinkedList[T]) String() string { return fmt.Sprintf("LinkedList {head: %v, tail: %v}", w.head, w.tail) } func Push[T any](h T, l *LinkedList[T]) *LinkedList[T] { if l == nil { return &LinkedList[T]{ head:...
linked_list/linked_list.go
0.526586
0.415847
linked_list.go
starcoder
package types import ( "fmt" "math" ) type ( Integer int Float float64 ) type Arithmetic interface { Add(Sexpr) (Sexpr, error) Sub(Sexpr) (Sexpr, error) Mul(Sexpr) (Sexpr, error) Div(Sexpr) (Sexpr, error) Mod(Sexpr) (Sexpr, error) } func (x Integer) Add(y Sexpr) (Sexpr, error) { switch y := y.(type) { ...
types/numbers.go
0.67662
0.496216
numbers.go
starcoder
package tick type Tick struct { t int delta int duration int } func (t Tick) Sub(u int) Tick { return Tick{ t: t.t - u, delta: t.delta, duration: t.duration, } } // Delta returns the value of delta that was last passed to Advance. func (t Tick) Delta() int { return t.delta } // Advanc...
tick.go
0.807233
0.675457
tick.go
starcoder
package elements import ( "errors" "github.com/fileformats/graphics/jt/model" ) // Base Shape Node Element represents the simplest form of a shape node that can exist within the LSG. type BaseShapeNode struct { BaseNode // Version Number is the version identifier for this node VersionNumber uint8 // The Transf...
jt/segments/elements/BaseShapeNode.go
0.805326
0.603552
BaseShapeNode.go
starcoder
package gfx import ( "context" "github.com/rainu/launchpad-super-trigger/pad" "time" ) // WaveSquare will animate a rectangle wave which begin at given point func (e Renderer) WaveSquare(x, y int, color pad.Color, delay time.Duration) context.CancelFunc { seq := make(Sequence, 0, 9) firstEmpty := true for i :=...
gfx/wave.go
0.691081
0.433622
wave.go
starcoder
package fragment import ( "reflect" "github.com/ludvigalden/go-typemeta" ) // IsValueUndefined returns whether a value is deemed to be undefined in the opinionated view of this package. // In this view, number is zero when it is possible that it was not specified by the user or specified by the user as undefined. ...
nullundefined.go
0.763131
0.514644
nullundefined.go
starcoder
package zset import ( "math" "math/rand" ) const ( SKIPLIST_MAXLEVEL = 32 /* For 2^32 elements */ SKIPLIST_Probability = 0.25 /* Skiplist probability = 1/4 */ ) type ( /* Links: - http://blog.wjin.org/posts/redis-internal-data-structure-skiplist.html - https://developpaper.com/skip-list-lookup-tree-b...
zset.go
0.621771
0.607052
zset.go
starcoder
package transforms import ( "encoding/binary" "errors" "hash" "strings" "math" "github.com/aldor007/mort/pkg/helpers" "github.com/spaolacci/murmur3" "gopkg.in/h2non/bimg.v1" ) var watermarkPosX = map[string]float32{ "left": 0, "center": 1. / 3., "right": 2. / 3., } var watermarkPosY = map[string]floa...
pkg/transforms/transforms.go
0.754644
0.409103
transforms.go
starcoder
package ln import ( "fmt" "io/ioutil" "strings" "github.com/fogleman/gg" ) type Path []Vector func (p Path) BoundingBox() Box { box := Box{p[0], p[0]} for _, v := range p { box = box.Extend(Box{v, v}) } return box } func (p Path) Transform(matrix Matrix) Path { var result Path for _, v := range p { r...
ln/path.go
0.579162
0.419707
path.go
starcoder
package engine const gravity float64 = 10 //cache hitters var workerPosition [2]float64 = [2]float64{} var workerPosition2 [2]float64 = [2]float64{} var workerSize [2]float64 = [2]float64{} var workerSize2 [2]float64 = [2]float64{} var workerInertia [2]float64 = [2]float64{} var workerTile [2]int = [2]int{} //basica...
src/physics.go
0.55447
0.546073
physics.go
starcoder
// Package camera implements a simple camera that should meet most users needs. package camera import ( "github.com/go-gl/gl/v4.1-core/gl" "github.com/go-gl/mathgl/mgl32" "github.com/hurricanerix/shade/entity" ) // Context contains the camera's state type Context struct { // Pos of the camera Pos mgl32.Vec3 /...
camera/camera.go
0.683314
0.614047
camera.go
starcoder
package charmap import ( "fmt" "github.com/zellyn/adventofcode/geom" "github.com/zellyn/adventofcode/util" ) // M is a map of geom.Vec2 to rune. type M map[geom.Vec2]rune // MinMax returns a geom.Vec2 for minimum coordinates, and one for maximum. func (m M) MinMax() (geom.Vec2, geom.Vec2) { return MinMax(m) } ...
charmap/charmap.go
0.802401
0.60212
charmap.go
starcoder
package lookup import ( "encoding/json" "reflect" "strconv" "strings" "google.golang.org/grpc/codes" "google.golang.org/grpc/status" ) const ( defaultSplitToken = "." indexCloseChar = "]" indexOpenChar = "[" ) type MatchFunc func(string) string type Options struct { // If true, any string that can...
lookup.go
0.725065
0.457682
lookup.go
starcoder
package models import ( i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91 "github.com/microsoft/kiota-abstractions-go/serialization" ) // FilterOperand type FilterOperand struct { // Stores additional data not described in the OpenAPI description found when deserializing. Can be used for seri...
models/filter_operand.go
0.682256
0.444263
filter_operand.go
starcoder
package dataframe import ( "fmt" "log" "github.com/ptiger10/pd/internal/index" "github.com/ptiger10/pd/options" ) // Values returns an []string of the values at each level of the cols. func (col Columns) Values() [][]string { ret := make([][]string, col.df.ColLevels()) for j := 0; j < col.df.ColLevels(); j++ ...
dataframe/columns.go
0.703142
0.407746
columns.go
starcoder
package main import ( "flag" "fmt" "math/rand" "time" "github.com/misterikkit/automata/wall" ) // Props to [1] for helping me understand Eller's algorithm! // [1]: https://weblog.jamisbuck.org/2010/12/29/maze-generation-eller-s-algorithm // state represents one row of the maze, which is all that the Eller algo...
eller_basic/main.go
0.58439
0.415017
main.go
starcoder
package fq import ( "encoding/binary" "encoding/hex" "github.com/jadeydi/jubjub/pkg/jubjub/futil" ) type Fq [4]uint64 //from_bytes func FromBytes(byt []byte) *Fq { d := &Fq{0, 0, 0, 0} d[0] = binary.LittleEndian.Uint64(byt[0:8]) d[1] = binary.LittleEndian.Uint64(byt[8:16]) d[2] = binary.LittleEndian.Uint64(...
pkg/jubjub/fq/fq.go
0.645455
0.479077
fq.go
starcoder
package spatial import ( "encoding/json" "math" "github.com/dhconnelly/rtreego" ) type PropertyRetriever interface { Properties() map[string]interface{} } type Filterable interface { Filter(BBox) []Feature } // Feature is a data structure which holds geometry and tags/properties of a geographical feature. typ...
lib/spatial/spatial.go
0.648911
0.446676
spatial.go
starcoder
package backwardio import ( "bufio" "io" "github.com/pkg/errors" ) var maxTok = bufio.MaxScanTokenSize // Scanner is similar to bufio.Scanner, except things are scanned from the // bottom up. type Scanner struct { r io.ReadSeeker buf []byte end int64 // last seeked, bound size for buf } // NewScanner creat...
backwardio.go
0.668231
0.438665
backwardio.go
starcoder
package interpolation import ( "fmt" "strings" "reflect" "github.com/hashicorp/hil/ast" ) // interpolationFuncList will accept a variable number of arguments and create a list func interpolationFuncList() ast.Function { return ast.Function{ ArgTypes: []ast.Type{}, ReturnType: ast.TypeList, Variadic...
internal/interpolation/lists.go
0.716913
0.403067
lists.go
starcoder
package defCauslate import ( "github.com/whtcorpsinc/milevadb/soliton/stringutil" ) const ( // magic number indicate weight has 2 uint64, should get from `longRuneMap` longRune uint64 = 0xFFFD // first byte of a 2-byte encoding starts 110 and carries 5 bits of data b2Mask = 0x1F // 0001 1111 // first byte of ...
soliton/collate/unicode_ci.go
0.510741
0.519399
unicode_ci.go
starcoder
package generators import ( "math/rand" "time" "github.com/rampager01/starfire-solar-galaxy-generator/pkg/mechanics" "github.com/rampager01/starfire-solar-galaxy-generator/pkg/moons" "github.com/rampager01/starfire-solar-galaxy-generator/pkg/planets" "github.com/rampager01/starfire-solar-galaxy-generator/pkg/st...
pkg/generators/generators.go
0.668123
0.571229
generators.go
starcoder
package imgo import ( "errors" "os" "image/jpeg" "image/png" "image" "image/color" ) func GetImageHeight(img image.Image) int { return img.Bounds().Max.Y } func GetImageWidth(img image.Image) int { return img.Bounds().Max.X } // decode a image and retrun golang image interface func DecodeImage(filePath st...
io.go
0.600774
0.417776
io.go
starcoder
package softheap type softHeapTree[T any] struct { prev *softHeapTree[T] next *softHeapTree[T] root *softHeapNode[T] // `suffmin` points to the tree in front of this tree in // the linked-list whose root has the smallest value // of `currentKey`. For example if this tree is T1 and we have // T1 -> T2 -> T3...
tree.go
0.82887
0.455138
tree.go
starcoder
package calendar import ( "encoding/json" "github.com/QuestScreen/api/web" "github.com/QuestScreen/api/web/modules" shared "github.com/QuestScreen/plugin-tutorial" ) /*title: State UI Implementation This file contains the code needed for our state UI to function. */ type RowKind int const ( DayRow RowKind = i...
web/calendar/state.go
0.680135
0.437643
state.go
starcoder
package execution import ( "context" "regexp" "github.com/pkg/errors" "github.com/cube2222/octosql" ) type Relation interface { Apply(ctx context.Context, variables octosql.Variables, left, right Expression) (bool, error) } type Equal struct { } func NewEqual() Relation { return &Equal{} } func (rel *Equal...
execution/relation.go
0.783823
0.402686
relation.go
starcoder
package openapi // Defines values for Result. const ( ResultN0 Result = 0 ResultN1 Result = 1 ResultN2 Result = 2 ResultN3 Result = 3 ) // Defines values for Turn. const ( TurnN0 Turn = 0 TurnN1 Turn = 1 ) // A side of the board type BoardSide struct { // The pits of the board side Pits []int64 `json:"...
internal/openapi/types.gen.go
0.587707
0.400163
types.gen.go
starcoder
package square // Represents a physical address. type Address struct { // The first line of the address. Fields that start with `address_line` provide the address's most specific details, like street number, street name, and building name. They do *not* provide less specific details like city, state/province, or cou...
square/model_address.go
0.791055
0.413418
model_address.go
starcoder
package openapi import ( "encoding/json" ) // AssetsData struct for AssetsData type AssetsData struct { Amount *string `json:"amount,omitempty"` Available *string `json:"available,omitempty"` ConversionRate *string `json:"conversionRate,omitempty"` Symbol *Symbols `json:"symbol,omitempty"` } // NewAssetsData i...
client/model_assets_data.go
0.779909
0.466724
model_assets_data.go
starcoder
package model import "citicup-admin/schema" type Finance struct { ts_code string `gorm:column:ts_code` Ar_to_or string `gorm:"column:ar_to_or"` Ar_turn string `gorm:"column:ar_turn"` Arturn_days string `gorm:"column:arturn_days"` Assets_to_eqt string `gorm:"column:asse...
citicup-admin/internal/model/finance.go
0.631253
0.455562
finance.go
starcoder
package main import ( "log" "strconv" "strings" ) // SpeechDetails contains the information of a speech. // The fields Min and Max are the minimum and maximum speaking times for a Speech. type SpeechDetails struct { Number int Name string Min int Max int } // Speech represents the Speech that will be ...
speech.go
0.614972
0.501404
speech.go
starcoder
package docs import ( "github.com/swaggo/swag" ) var doc = `{ "swagger": "2.0", "info": { "description": "This is the api page for all APIs in INSTANCE", "title": "INSTANCE APIs", "contact": { "name": "<NAME>", "email": "<EMAIL>" }, "license": ...
Terminus_Interface/instance/docs/docs.go
0.522933
0.427875
docs.go
starcoder
package matrix import "math" // LogMx allows to calculate log of each matrix element func LogMx(i, j int, x float64) float64 { return math.Log(x) } // SubtrMx allows to subtract a number from all matrix elements func SubtrMx(f float64) func(int, int, float64) float64 { return func(i, j int, x float64) float64 { ...
pkg/matrix/functions.go
0.864225
0.750827
functions.go
starcoder
package code import ( "bytes" "encoding/binary" "fmt" ) type Opcode byte const ( OpConstant Opcode = iota OpPop OpAdd OpSub OpMul OpDiv OpTrue OpFalse OpEqual OpNotEqual OpGreaterThan OpBang OpMinus OpJump OpJumpNotTruthy OpNull OpGetGlobal OpSetGlobal OpArray OpHash OpIndex OpCall OpReturn...
code/code.go
0.596198
0.453564
code.go
starcoder
package problem import ( "github.com/water-vapor/euclidea-solver/pkg/geom" "math" ) //Problem 1: Angle Bisector func angleBisector() *Statement { problem := geom.NewBoard() pt1 := geom.NewPoint(0, 0) pt2 := geom.NewPoint(1, 0) pt3 := geom.NewPoint(1, math.Sqrt(3)) problem.AddPoint(pt1) problem.HalfLines.Add(...
problem/beta.go
0.798344
0.42913
beta.go
starcoder
package gqlang import "golang.org/x/xerrors" const ( maxParseDepth = 50 maxSize = 16 << 10 // 16 KiB ) var errTooDeep = xerrors.New("syntax tree too deep") type parser struct { tokens []token eofPos Pos } // Parse parses a GraphQL document into an abstract syntax tree. func Parse(input string) (*Documen...
internal/gqlang/parser.go
0.505127
0.437343
parser.go
starcoder
package dbutil import ( "strings" "github.com/oom-ai/oomstore/pkg/errdefs" "github.com/oom-ai/oomstore/pkg/oomstore/types" ) func DBValueType(backend types.BackendType, valueType types.ValueType) (string, error) { var mp map[types.ValueType]string switch backend { case types.BackendPostgres: mp = valueTypeTo...
internal/database/dbutil/type_mapping.go
0.50952
0.439807
type_mapping.go
starcoder
package main import ( "bufio" "fmt" "os" "strconv" "strings" ) type Length struct { toMeter float64 toCentimeter float64 toMillimeter float64 toKilometer float64 toNauticalMile float64 toMile float64 toYard float64 toFoot float64 toInch float64 toLightYear ...
conversion_tool.go
0.684686
0.620305
conversion_tool.go
starcoder
package grid import ( "fmt" "math/rand" "time" ) func DetermineNextGen(grid [][]bool) [][]bool { // For each row r, send {r-1, r, r+1 } // If first row, r-1 = last row in grid // If last row, r+1 = first row in grid nextGrid := make([][]bool, len(grid)) numRows := len(grid) for index, row := range ...
grid/grid.go
0.729423
0.520374
grid.go
starcoder
package dynamic /* # Unique Paths # https://leetcode.com/explore/interview/card/top-interview-questions-medium/111/dynamic-programming/808/ A robot is located at the top-left corner of a m x n grid (marked 'Start' in the diagram below). The robot can only move either down or right at any point in time. The robot is ...
interview/medium/dynamic/uniquepath.go
0.760295
0.461988
uniquepath.go
starcoder
package elref import ( "github.com/el-ideal-ideas/ellib/elconv" "reflect" ) // If `v` is a struct, return true. Otherwise return false. func IsStruct(v interface{}) bool { r := elconv.AsValueRef(reflect.ValueOf(v)) return r.Kind() == reflect.Struct } // If `v` is a interface, return true. Otherwise return false....
elref/is.go
0.829837
0.427098
is.go
starcoder
package builtin import ( "math" "math/bits" "math/rand" "time" ) var objects = map[string]interface{}{ "Date": dateObject{ Now: now, }, "Math": mathObject{ E: E, LN2: LN2, LN10: LN10, LOG2E: LOG2E, LOG10E: LOG10E, PI: PI, SQRT1_2: SQRT1_2, SQRT2: SQRT2, Abs: math.A...
builtin/object.go
0.540196
0.446253
object.go
starcoder
package flect import ( "reflect" "strconv" "strings" "time" "github.com/jt0/gomer/gomerr" ) type zeroVal struct{} var ZeroVal = zeroVal{} func SetValue(targetValue reflect.Value, value interface{}) gomerr.Gomerr { if value == nil { return nil } else if value == ZeroVal { targetValue.Set(reflect.Zero(tar...
flect/value.go
0.559049
0.40489
value.go
starcoder
package sim import . "github.com/jrforrest/go-nicelife/cell" import . "github.com/jrforrest/go-nicelife/pos" type Simulation struct { cells map[Position]Cell // The cells in the current sim state newCells map[Position]Cell // The cells in the next iteration of the sim } func NewSimulation() Simulation { return...
sim/sim.go
0.670177
0.704745
sim.go
starcoder
package govaluate // sanitizedParameters is a wrapper for Parameters that does sanitization as // parameters are accessed. type sanitizedParameters struct { orig Parameters } func (p sanitizedParameters) Get(key string) (interface{}, error) { value, err := p.orig.Get(key) if err != nil { return nil, err } ret...
sanitizedParameters.go
0.618665
0.412885
sanitizedParameters.go
starcoder
package metrics import ( "encoding/json" "io/ioutil" "time" ) // HubMetrics describe some type HubMetrics struct { // HubAddress records the hub address HubAddress string `json:"hubAddress"` // HubPing uses pings to diagnose the system and figure out the uplink speed // between the hub and the source. Determin...
metrics/metrics.go
0.682468
0.414603
metrics.go
starcoder
package ofbx import ( "fmt" "github.com/pkg/errors" ) // Cluster is an entity which acts on a subset of a geometry's control points // For each control point that the cluster acts on, the intensity of the cluster's action is modulated by a weight. The link mode (ELinkMode) specifies how the weights are taken into ...
cluster.go
0.655115
0.44059
cluster.go
starcoder
package gochords import ( "os" "github.com/jesusGalan/goscales" "github.com/jesusGalan/goutils" ) //note_list = take_all_notes_from(tone) //note_list = note_list + note_list //scale_list = config_scale(note_list, scale_name, tone) func main() { } func getScale(scale, tone string) []string { return []string{"h...
chords/chords.go
0.55929
0.493348
chords.go
starcoder
import ( "github.com/kaitai-io/kaitai_struct_go_runtime/kaitai" "strconv" "bytes" ) /** * The NITF (National Image Transition Format) format is a file format developed by the U.S. Government for * storing imagery, e.g. from satellites. * * According to the [foreword of the specification](https://gwg.nga.mil/...
nitf/src/go/nitf.go
0.600305
0.420659
nitf.go
starcoder
package types import ( "bytes" "github.com/tendermint/tendermint/libs/kv" ) // Iterator over all the keys with a certain prefix in ascending order func KVStorePrefixIterator(kvs KVStore, prefix []byte) (Iterator, error) { return kvs.Iterator(prefix, PrefixEndBytes(prefix)) } // Iterator over all the keys with a c...
store/types/utils.go
0.696681
0.443962
utils.go
starcoder