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 interp import ( "fmt" "math" "strconv" "strings" ) type valueType uint8 const ( typeNil valueType = iota typeStr typeNum ) // An AWK value (these are passed around by value) type value struct { typ valueType // Value type isNumStr bool // An AWK "numeric string" from user input s ...
interp/value.go
0.705176
0.456652
value.go
starcoder
package deepmerge import ( "errors" "fmt" "reflect" ) // DeepMerge instantiates initial counters / keys for traversal type DeepMerge struct { map1 interface{} map2 interface{} // Stores the keys that we have processed as we iterate the maps seenKeys map[interface{}]bool // Keeps track of nested parent keys ...
deepmerge.go
0.700792
0.453625
deepmerge.go
starcoder
package discover import ( "net" "time" "github.com/ThinkiumGroup/go-common" ) type ( packetSort interface { handleSort(t *udp_srt, from *net.UDPAddr, fromID common.NodeID, mac []byte) error nameSort() string } pingSort struct { Version uint ChainID common.ChainID NetType common.NetType F...
network/discover/sortpacket.go
0.579043
0.412471
sortpacket.go
starcoder
package types import ( "fmt" "regexp" "strings" ) // String type for clause attribute evaluation type String string // NewString creates a string with the object value func NewString(value interface{}) (*String, error) { str, ok := value.(string) if ok { newStr := String(str) return &newStr, nil } return ...
types/string.go
0.728941
0.451024
string.go
starcoder
package nifi import ( "encoding/json" ) // VersionedFlowEntity struct for VersionedFlowEntity type VersionedFlowEntity struct { VersionedFlow *VersionedFlowDTO `json:"versionedFlow,omitempty"` } // NewVersionedFlowEntity instantiates a new VersionedFlowEntity object // This constructor will assign default values ...
model_versioned_flow_entity.go
0.770119
0.487551
model_versioned_flow_entity.go
starcoder
package vector import "math" // Vector described mathematical Vector. // It stores []float64 array under the hood. type Vector struct { data []float64 } // NewVector creates new vector. // It panics when there is less than 2 arguments provided. func NewVector(data ...float64) Vector { if len(data) < 2 { panic("v...
vector.go
0.87938
0.746347
vector.go
starcoder
package pt import ( "fmt" "image" _ "image/jpeg" "image/png" "math" "math/rand" "os" "path" "strconv" "time" ) func Radians(degrees float64) float64 { return degrees * math.Pi / 180 } func Degrees(radians float64) float64 { return radians * 180 / math.Pi } func Cone(direction Vector, theta, u, v float64...
pt/util.go
0.699562
0.432902
util.go
starcoder
package main import ( "fmt" "strconv" ) //A basic Person struct type Person struct { name string age int } //Some slices of ints, floats and Persons type IntSlice []int type Float32Slice []float32 type PersonSlice []Person type MaxInterface interface { // Len is the number of elements in the collection. Len() ...
interface/slice.go
0.572723
0.428054
slice.go
starcoder
package vox // Matrix3x3 is an encoded 3x3 orthogonal matrix with entries 0, +1, -1. type Matrix3x3 uint8 // Matrix3x3Identity represents the identity matrix. const Matrix3x3Identity = Matrix3x3(4) func eqm3(a int, b Matrix3x3) int { if a == int(b) { return 1 } return 0 } func signm3(x Matrix3x3) int { if x =...
matrix.go
0.861217
0.732998
matrix.go
starcoder
package simplify import ( "context" "strings" "github.com/go-spatial/geom/planar" ) type DouglasPeucker struct { // Tolerance is the tolerance used to eliminate points, a tolerance of zero is not eliminate any points. Tolerance float64 // Dist is the distance function to use, defaults to planar.Perpendicular...
planar/simplify/douglaspeucker.go
0.603231
0.475727
douglaspeucker.go
starcoder
package ord import ( "testing" "github.com/calebcase/base/data/eq" "github.com/stretchr/testify/require" "golang.org/x/exp/constraints" ) type Class[A any] interface { eq.Class[A] Compare(A, A) Ordering LT(A, A) bool LTE(A, A) bool GT(A, A) bool GTE(A, A) bool Max(A, A) A Min(A, A) A } type Type[A an...
data/ord/ord.go
0.686475
0.643007
ord.go
starcoder
package timeseq import "time" // Interval indicates a continuous time range type Interval struct { NotBefore *time.Time NotAfter *time.Time } // Contain returns if time t is in the interval func (i Interval) Contain(t time.Time) bool { if i.NotAfter != nil && t.After(*i.NotAfter) { return false } if i.NotBef...
interval.go
0.830353
0.518912
interval.go
starcoder
package openmessaging type KeyValue interface { /** * Inserts or replaces {@code short} value for the specified key. * * @param key the key to be placed into this {@code KeyValue} object * @param value the value corresponding to <tt>key</tt> */ PutInt16(key string, value int16) (KeyValue, er...
openmessaging/key_value.go
0.923588
0.555435
key_value.go
starcoder
package msf import ( "bufio" "encoding/binary" "fmt" "io" "io/ioutil" "math" "mosaicmfg.com/ps-postprocess/gcode" "os" "path" "strings" ) func roundTo(value float32, maxDecimalPlaces int) float32 { multiplier := math.Pow(10, float64(maxDecimalPlaces)) rounded := math.Ro...
msf/utils.go
0.757794
0.418875
utils.go
starcoder
package date import ( "encoding/json" "fmt" "strconv" "strings" "time" ) // These are predefined formats to use in PersianDate.Format. const ( GenericFormat = "yyyy/mm/dd" GenericShortFormat = "yyyy/m/d" MonthDayFormat = "MMMM dd" MonthYearFormat = "MMMM, yyyy" WrittenFormat = "W" Serializ...
date/PersianDate.go
0.734691
0.407687
PersianDate.go
starcoder
package main import ( "machine" "math" "time" ) // Since machine.pwmGroup is not exported, we create our own type to allow it to be passed around & stored type PWM interface { Configure(config machine.PWMConfig) error Channel(pin machine.Pin) (channel uint8, err error) Set(channel uint8, value uint32) Top() ui...
elegoo_most_complete_starter_kit/13_analog_joystick_module/main.go
0.702428
0.454533
main.go
starcoder
package std import ( "github.com/mb0/xelf/cor" "github.com/mb0/xelf/exp" "github.com/mb0/xelf/lit" "github.com/mb0/xelf/typ" ) /* Container operations The len form returns the length of a str, raw, container literal, or the field count of a record. The fst, lst and nth are a short-circuiting loops that optional...
std/cont.go
0.61451
0.5425
cont.go
starcoder
package edgedetection import ( "github.com/Ernyoke/Imger/blend" "github.com/Ernyoke/Imger/convolution" "github.com/Ernyoke/Imger/grayscale" "github.com/Ernyoke/Imger/padding" "image" ) var horizontalKernel = convolution.Kernel{Content: [][]float64{ {-1, 0, 1}, {-2, 0, 2}, {-1, 0, 1}, }, Width: 3, Height: 3} ...
edgedetection/sobel.go
0.910264
0.553747
sobel.go
starcoder
package topojson import ( "github.com/paulmach/orb" geojson "github.com/paulmach/orb/geojson" ) func (t *Topology) ToGeoJSON() *geojson.FeatureCollection { fc := geojson.NewFeatureCollection() for _, obj := range t.Objects { switch obj.Type { case "GeometryCollection": for _, geometry := range obj.Geometr...
geojson.go
0.625896
0.460228
geojson.go
starcoder
package schema import ( "encoding/json" ) // NumericSchema represents the schema for a JSON number. type NumericSchema interface { SimpleSchema GetMultipleOf() float64 GetMaximum() float64 GetMinimum() float64 GetExclusiveMaximum() bool GetExclusiveMinimum() bool SetMultipleOf(multipleOf float64) SetMaximum...
schema/schema_numeric.go
0.806548
0.428293
schema_numeric.go
starcoder
package data import ( "strings" ) /* Defines projection parameters with list if fields to include into query results. The parameters support two formats: dot format and nested format. The dot format is the standard way to define included fields and subfields using dot object notation: "field1,field2.field21,field2.f...
data/ProjectionParams.go
0.722821
0.577138
ProjectionParams.go
starcoder
package go_kd_segment_tree import ( "fmt" mapset "github.com/deckarep/golang-set" "math/rand" "sort" ) type Segment struct { Rect Rect Data mapset.Set rnd float64 } func (s *Segment) String() string { return fmt.Sprintf("{%v, %v}", s.Rect, s.Data) } func (s *Segment) Clone() *Segment { newSegment := &Segm...
segment.go
0.607896
0.4206
segment.go
starcoder
This package contains all the runtime metrics collected by the SDK This is used to collect the runtime statistics of the process and publish it to IA This runs in a separate go process based on time interval configured in config */ package metric import ( "fmt" "os" "runtime" ) //The Metric type has the informatio...
internal/metric/metric.go
0.71602
0.514949
metric.go
starcoder
package testdata // CreateMandateResponse const CreateMandateResponse = `{ "resource": "mandate", "id": "mdt_h3gAaD5zP", "mode": "test", "status": "valid", "method": "directdebit", "details": { "consumerName": "<NAME>", "consumerAccount": "NL55INGB0000000000", "consumerB...
testdata/mandates.go
0.646014
0.436682
mandates.go
starcoder
package units import ( "fmt" "regexp" "sort" "strconv" "strings" ) const ( Bit Size = 1 Byte Size = 8 * Bit KiB Size = 1024 * Byte MiB Size = 1024 * KiB GiB Size = 1024 * MiB TiB Size = 1024 * GiB KB Size = 1000 * Byte MB Size = 1000 * KB GB Size = 1000 * MB TB Size = 1000 * GB Kb Size = 1000 * Bi...
units/units.go
0.527317
0.405743
units.go
starcoder
package ilog10 import "math/bits" const n = ^uint64(0) var lookup64 = [64]uint64{ // This initializer list is easier to read as follows: // 10000000000000000000, n, n, n, 1000000000000000000, n, n, 100000000000000000, n, n, // 10000000000000000, n, n, n, 1000000000000000, n, n, 100000000000000, n...
ilog10.go
0.58439
0.403831
ilog10.go
starcoder
// C illuminant conversion functions package white // C_A functions func C_A_Bradford(xs, ys, zs float64) (xd, yd, zd float64) { m := [3][3]float64{ {1.2040146, 0.1029527, -0.1567072}, {0.1407450, 0.9280261, -0.0558735}, {-0.0252839, 0.0387607, 0.2891656}} xd = m[0][0]*xs + m[0][1]*ys + m[0][2]*zs yd = m[1]...
f64/white/c.go
0.51879
0.671592
c.go
starcoder
package fidlgen import ( "bytes" "fmt" ) // In the masks used in the following functions, bytes requiring padding are marked 0xff and // bytes not requiring padding are marked 0x00. func (s Struct) populateFullStructMaskForStruct(mask []byte, flatten bool, getTypeShape func(Struct) TypeShape, getFieldShape func(S...
tools/fidl/lib/fidlgen/struct.go
0.608129
0.418103
struct.go
starcoder
package levels import ( "sort" mgl "github.com/go-gl/mathgl/mgl32" "github.com/inkyblackness/hacked/ss1/content/archive/level" ) type hoverItem interface { Pos() MapPosition Size() float32 IsIn(lvl *level.Level) bool } type tileHoverItem struct { pos MapPosition } func (item tileHoverItem) Pos() MapPositio...
editor/levels/HoverItems.go
0.554229
0.402686
HoverItems.go
starcoder
package blockpool import ( "bytes" "errors" "fmt" "chainmaker.org/chainmaker/common/v2/queue" "chainmaker.org/chainmaker/pb-go/v2/common" ) //BlockNode save one block and its children type BlockNode struct { block *common.Block children []string // the blockHash with children's block } //GetBlock get bloc...
module/consensus/chainedbft/block_pool/block_tree.go
0.589953
0.405566
block_tree.go
starcoder
package visualize import ( "github.com/go-gl/gl/v3.3-core/gl" ) // Type RenderObject is used to concisely represent information necessary to // perform a 2 dimensional textured render. type RenderObject struct { shaderProgram uint32 // The shader program. texture uint32 // The texture. vao uint32 ...
visualize/renderobject.go
0.734405
0.538619
renderobject.go
starcoder
package interpreter import ( "fmt" "io/ioutil" "log" "strings" ) const memorySize int = 30000 type stack []int func (s stack) push(v int) stack { return append(s, v) } func (s stack) pop() (stack, int) { if len(s) == 0 { log.Fatal("Popping empty stack!") } return s[:len(s)-1], s[len(s)-1] } // Interpret...
interpreter/interpreter.go
0.574753
0.405566
interpreter.go
starcoder
package tst // TernarySearchTree represents a Ternary Search Tree. // The zero value for List is an empty list ready to use. type TernarySearchTree struct { root Element // sentinel list element, only &root, root.prev, and root.next are used len int // current list length excluding (this) sentinel element } //...
container/tst/tst.go
0.810441
0.425426
tst.go
starcoder
package main /* cantor pair function reference https://en.wikipedia.org/wiki/Cantor_function https://en.wikipedia.org/wiki/Pairing_function https://gist.github.com/hannesl/8031402 */ import ( "fmt" "math" "math/big" ) func main() { a1 := cantor_pair_calculate(9, 1) // first pair 1 a2 := cantor_pair_ca...
cantor-pair-function/main.go
0.779783
0.629333
main.go
starcoder
package data import ( "math" "github.com/calummccain/coxeter/vector" ) const ( eVal43n = 4.0 pVal43n = 6.0 eVal43nTrunc = 4.0 pVal43nTrunc = 11.465072284 // math.Pi / math.Atan(math.Sqrt(1.0/(7.0+4.0*Rt2))) eVal43nRect = 4.0 pVal43nRect = 1e100 //∞ ) func GoursatTetrahedron43n(n float64) GoursatTetrahedro...
data/43n.go
0.557845
0.538741
43n.go
starcoder
package tokenizer import ( "math" "tokenizer/lib/utils" ) type tfidfTokenizer struct { Documents []*document AllDocumentsWordCount map[string]int InverseDocumentFrequency map[string]float64 TFIDFVector []map[string]float64 } type document struct { WordCount map[string]int T...
lib/tokenizer/TfidfTokenizer.go
0.7586
0.421492
TfidfTokenizer.go
starcoder
package main import ( "time" vector "github.com/xonmello/BotKoba/vector3" rotator "github.com/xonmello/BotKoba/rotator" math "github.com/chewxy/math32" RLBot "github.com/Trey2k/RLBotGo" ) var lastjump int64 func initialSetup(koba *RLBot.PlayerInfo, opponent *RLBot.PlayerInfo, ball *RLBot.BallInfo) (*vector.Vec...
utils.go
0.720172
0.557002
utils.go
starcoder
package iso20022 // Specifies an identification of a document assigned by and relative to the issuing party (of the identification). // Optionally, the component can contain a copy of the identified document and a URI/URL (Universal Resource Information/Location) facilitating retrieval of the document. // The componen...
QualifiedDocumentInformation1.go
0.667256
0.41401
QualifiedDocumentInformation1.go
starcoder
package bufr import "encoding/json" // Payload represents the meat of the data section of a BUFR message. // It is comprised of a list of Subset. type Payload struct { subsets []*Subset Compressed bool } func NewPayload(compressed bool) *Payload { return &Payload{Compressed: compressed} } func (p *Pa...
bufr/payload.go
0.741768
0.408129
payload.go
starcoder
package validator import ( "fmt" "net" "unicode/utf8" ) // ValidateBetweenString is func ValidateBetweenString(v string, left int64, right int64) bool { return ValidateDigitsBetweenInt64(int64(utf8.RuneCountInString(v)), left, right) } // InString check if string str is a member of the set of strings params func...
validator_string.go
0.663996
0.429669
validator_string.go
starcoder
package tsin import ( "encoding/xml" "github.com/fgrid/iso20022" ) type Document00400101 struct { XMLName xml.Name `xml:"urn:iso:std:iso:20022:tech:xsd:tsin.004.001.01 Document"` Message *FinancialInvoiceV01 `xml:"FinInvc"` } func (d *Document00400101) AddMessage() *FinancialInvoiceV01 { d.Message = new(Financ...
tsin/FinancialInvoiceV01.go
0.716219
0.438364
FinancialInvoiceV01.go
starcoder
package models import ( i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91 "github.com/microsoft/kiota-abstractions-go/serialization" ) // BookingWorkHours this type represents the set of working hours in a single day of the week. type BookingWorkHours struct { // Stores additional data not des...
models/booking_work_hours.go
0.764804
0.473779
booking_work_hours.go
starcoder
package rolling import "math" const ( // By default nan values are ignored ignoreNanValuesDefault bool = true // By default infinite values (both positive and negative) are ignored ignoreInfValuesDefault bool = true // By default zero values are treated as a per any other number (ie not ignored) ignoreZeroValue...
rolling.go
0.781038
0.600364
rolling.go
starcoder
Package nestedpendingoperations is a modified implementation of pkg/util/goroutinemap. It implements a data structure for managing go routines by volume/pod name. It prevents the creation of new go routines if an existing go routine for the volume already exists. It also allows multiple operations to execute in paralle...
vendor/k8s.io/kubernetes/pkg/volume/util/nestedpendingoperations/nestedpendingoperations.go
0.706697
0.4575
nestedpendingoperations.go
starcoder
package iso20022 // Net position of a segregated holding, in a single security, within the overall position held in a securities account at a specified place of safekeeping. type AggregateBalancePerSafekeepingPlace20 struct { // Place where the securities are safe-kept, physically or notionally. This place can be, ...
AggregateBalancePerSafekeepingPlace20.go
0.871734
0.412353
AggregateBalancePerSafekeepingPlace20.go
starcoder
package docstrings // Get - Get a document string func Get(key string) KeyStrings { switch key { case "agent": return KeyStrings{"agent <command>", "Commands that manage the Fly agent", `Commands that manage the Fly agent`, } case "agent.daemon-start": return KeyStrings{"daemon-start", "Run the Fly agent a...
docstrings/gen.go
0.632049
0.535949
gen.go
starcoder
package typeinfo import ( "context" "fmt" "github.com/dolthub/go-mysql-server/sql" "github.com/dolthub/dolt/go/store/types" ) // This is a dolt implementation of the MySQL type Point, thus most of the functionality // within is directly reliant on the go-mysql-server implementation. type polygonType struct { ...
go/libraries/doltcore/schema/typeinfo/polygon.go
0.68056
0.499146
polygon.go
starcoder
package marc21 /* https://www.loc.gov/marc/specifications/specrecstruc.html A directory entry in MARC 21 is made up of a tag, length-of-field, and field starting position. The directory begins in character position 24 of the record and ends with a field terminator. It is of variable length and consis...
pkg/marc21/directory.go
0.732305
0.457379
directory.go
starcoder
// +build kubeapiserver package cluster import ( ksmstore "github.com/DataDog/datadog-agent/pkg/kubestatemetrics/store" "github.com/DataDog/datadog-agent/pkg/util/log" ) /* labelJoiner ingests all the metrics used by label joins to build a tree that can then be used to efficiently find which labels should be a...
pkg/collector/corechecks/cluster/kubernetes_state_label_joins.go
0.653459
0.533337
kubernetes_state_label_joins.go
starcoder
package helper import ( "github.com/adamlenda/engine/core" "github.com/adamlenda/engine/geometry" "github.com/adamlenda/engine/gls" "github.com/adamlenda/engine/graphic" "github.com/adamlenda/engine/material" "github.com/adamlenda/engine/math32" ) // Normals is the visual representation of the normals of a tar...
util/helper/normals.go
0.783575
0.511656
normals.go
starcoder
package pure import ( "context" "strconv" "time" "github.com/benthosdev/benthos/v4/internal/bundle" "github.com/benthosdev/benthos/v4/internal/component/processor" "github.com/benthosdev/benthos/v4/internal/docs" "github.com/benthosdev/benthos/v4/internal/message" "github.com/benthosdev/benthos/v4/internal/tr...
internal/impl/pure/processor_catch.go
0.614163
0.498413
processor_catch.go
starcoder
package main import ( "image" "image/color" "image/jpeg" "image/png" "math" "os" "sync" "github.com/Sirupsen/logrus" ) func trap(img *image.RGBA, trapPath string, r, g, b *Histo) { } func plotImp() (err error) { img := image.NewRGBA(image.Rect(0, 0, width, height)) impMax := max(&importance) for x, col...
plot.go
0.647798
0.432063
plot.go
starcoder
package protocol import ( "time" "github.com/montanaflynn/stats" "go.opentelemetry.io/collector/model/pdata" ) func buildCounterMetric(parsedMetric statsDMetric, isMonotonicCounter bool, timeNow, lastIntervalTime time.Time) pdata.InstrumentationLibraryMetrics { ilm := pdata.NewInstrumentationLibraryMetrics() n...
receiver/statsdreceiver/protocol/metric_translator.go
0.621541
0.401424
metric_translator.go
starcoder
package registry import ( . "github.com/protolambda/zrnt/eth2/beacon/validator" . "github.com/protolambda/zrnt/eth2/core" "github.com/protolambda/zrnt/eth2/util/math" "github.com/protolambda/zrnt/eth2/util/ssz" "github.com/protolambda/zssz" "sort" ) var RegistryIndicesSSZ = zssz.GetSSZ((*RegistryIndices)(nil)) ...
eth2/beacon/registry/validators.go
0.595845
0.40116
validators.go
starcoder
package mo import ( xconv "github.com/goclub/conv" "github.com/goclub/mongo/internal/coord" ) // geojson https://zhuanlan.zhihu.com/p/141554586 // NewPoint(mo.WGS84{121.48294,31.2328}) // WGS84{经度,纬度} type Point struct { Type pointType `json:"type" bson:"type"` // []float64{longitude, latitude} []float64...
geojson.go
0.552298
0.568655
geojson.go
starcoder
package main import "math" func SimulateGravity(initialUniverse Universe, numGens int, time float64) []Universe { timePoints := make([]Universe, numGens+1) timePoints[0] = initialUniverse for i := 1; i <= numGens; i++ { timePoints[i] = UpdateUniverse(timePoints[i-1], time) } return timePoints } func UpdateUn...
jupiter/gravity.go
0.776538
0.466785
gravity.go
starcoder
package openapi import ( "encoding/json" "fmt" "net/url" "strings" "time" "github.com/twilio/twilio-go/client" ) // Optional parameters for the method 'CreateMessage' type CreateMessageParams struct { // The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that will create the resource. Pa...
rest/api/v2010/accounts_messages.go
0.794584
0.485417
accounts_messages.go
starcoder
package dynamic import ( "bytes" "reflect" "github.com/golang/protobuf/proto" "github.com/jhump/protoreflect/desc" ) // Equal returns true if the given two dynamic messages are equal. Two messages are equal when they // have the same message type and same fields set to equal values. For proto3 messages, fields ...
dynamic/equal.go
0.632503
0.405037
equal.go
starcoder
Package rbac provides role-based access control for vtadmin API endpoints. Functionality is split between two distinct components: the authenticator and the authorizer. The authenticator is optional, and is responsible for extracting information from a request (gRPC or HTTP) to produce an Actor, which is added to the...
go/vt/vtadmin/rbac/rbac.go
0.783409
0.418043
rbac.go
starcoder
package services import ( "github.com/gravitational/teleport/lib/utils" "github.com/gravitational/teleport/lib/utils/parse" "github.com/gravitational/trace" log "github.com/sirupsen/logrus" ) // TraitMapping is a mapping that maps a trait to one or // more teleport roles. type TraitMapping struct { // Trait is...
lib/services/traits.go
0.744656
0.423279
traits.go
starcoder
package grid import ( "context" "fmt" "strings" "github.com/airbusgeo/geocube/internal/utils/affine" "github.com/airbusgeo/geocube/internal/utils/proj" "github.com/airbusgeo/godal" "github.com/twpayne/go-geom" "github.com/twpayne/go-geom/encoding/wkb" ) // UnsupportedGrid is raised when the GridName is not s...
internal/utils/grid/abstractgrid.go
0.709824
0.45181
abstractgrid.go
starcoder
package iso20022 // Details of the margin call request. type MarginCall1 struct { // Sum of the exposures of all transactions which are in the favour of party A. That is, all transactions which would have an amount payable by party B to party A if they were being terminated. ExposedAmountPartyA *ActiveCurrencyAndAm...
MarginCall1.go
0.804598
0.572603
MarginCall1.go
starcoder
package simplify import ( "math" "github.com/macheal/orb" ) var _ orb.Simplifier = &VisvalingamSimplifier{} // A VisvalingamSimplifier is a reducer that // performs the vivalingham algorithm. type VisvalingamSimplifier struct { Threshold float64 ToKeep int } // Visvalingam creates a new VisvalingamSimplifie...
simplify/visvalingam.go
0.705481
0.430806
visvalingam.go
starcoder
package pattern import ( "regexp" "strings" ) // Params defines a map of stringed keys and values. type Params map[string]string // Matchable defines an interface for matchers. type Matchable interface { IsParam() bool HasHash() bool Segment() string Validate(string) bool } // Matchers defines a list of mache...
vendor/github.com/influx6/faux/pattern/pattern.go
0.831691
0.433862
pattern.go
starcoder
package fsm // ID is the id of the instance in a given set. It's unique in that set. type ID uint64 // Instance is the interface that returns ID and state of the fsm instance safely. type Instance interface { // ID returns the ID of the instance ID() ID // State returns the state of the instance. This is an exp...
pkg/fsm/instance.go
0.728652
0.449453
instance.go
starcoder
package expression import ( "fmt" "github.com/dolthub/go-mysql-server/sql" ) // Wrapper simply acts as a wrapper for another expression. If a nil expression is wrapped, then the wrapper functions // as a guard against functions that expect non-nil expressions. type Wrapper struct { inner sql.Expression } var _ ...
sql/expression/wrapper.go
0.725065
0.504883
wrapper.go
starcoder
package three import "github.com/gopherjs/gopherjs/js" // Quaternion - represents a Quaternion. type Quaternion struct { *js.Object X float64 `js:"x"` Y float64 `js:"y"` Z float64 `js:"z"` W float64 `js:"w"` } func NewQuaternion() Quaternion { return Quaternion{ Object: three.Get("Quaternion").New(), } } ...
math_quaternion.go
0.938618
0.680449
math_quaternion.go
starcoder
package null func (n *NullDouble) IsSet() (float64, bool) { if n == nil { return 0.0, false } return n.Value, n.Set } func (n *NullFloat) IsSet() (float32, bool) { if n == nil { return 0.0, false } return n.Value, n.Set } func (n *NullInt32) IsSet() (int32, bool) { if n == nil { return 0, false } r...
null/nullfunctions.go
0.670285
0.465934
nullfunctions.go
starcoder
package gioui import ( "image/color" "gioui.org/f32" "gioui.org/layout" "gioui.org/op/clip" "gioui.org/op/paint" ) type ( D = layout.Dimensions C = layout.Context ) var blackColor = color.NRGBA{R: 0, G: 0, B: 0, A: 255} type RaceProgressBarStyle struct { progress float32 // percentage of the race ...
acc/gioui/raceProgressBar.go
0.651022
0.402627
raceProgressBar.go
starcoder
package cmp import ( "constraints" "fmt" ) // Eq defines equality of type T. type Eq[T any] interface { // Equal returns true if and only if given two arguments are the same. Equal(T, T) bool } // DefaultEq is Eq with default implementations. type DefaultEq[T any] struct { EqualImpl func(T, T) bool } func (eq ...
classes/cmp/cmp.go
0.806967
0.673067
cmp.go
starcoder
package miner import ( "math" "sort" "github.com/filecoin-project/go-bitfield" "golang.org/x/xerrors" ) // Maps deadlines to partition maps. type DeadlineSectorMap map[uint64]PartitionSectorMap // Maps partitions to sector bitfields. type PartitionSectorMap map[uint64]bitfield.BitField // Check validates all b...
actors/builtin/miner/sector_map.go
0.720762
0.415907
sector_map.go
starcoder
package hego import ( "errors" "fmt" "math" "math/rand" "time" ) // PSOResult represents the results of the particle swarm optimization type PSOResult struct { BestParticles [][]float64 BestObjectives []float64 Result } // PSOSettings represents settings for the particle swarm optimization type PSOSettings ...
particle_swarm.go
0.564339
0.471771
particle_swarm.go
starcoder
package hashmultisets import "sort" // New factory that creates a new Hash Multi Set func New[T comparable](values ...T) *HashMultiSet[T] { set := HashMultiSet[T]{data: make(map[T]int, len(values))} set.Add(values...) return &set } // MultiSetPair a set's key/count pair type MultiSetPair[T comparable] struct { K...
datastructures/sets/hashmultisets/hash_multi_set.go
0.795022
0.538073
hash_multi_set.go
starcoder
package composite import ( "context" "image" "math" "runtime" "golang.org/x/image/draw" "golang.org/x/image/math/f64" "github.com/oov/psd/blend" ) type layerImage struct { Canvas tiledImage Mask tiledMask } type tiledImage map[image.Point]draw.Image func (t tiledImage) Get(tileSize int, pt image.Point)...
composite/layerimage.go
0.532668
0.421016
layerimage.go
starcoder
package udwTime import ( "time" ) func ToDateString(t time.Time) string { return t.Format(FormatDateMysql) } func ToDateStringInDefaultTz(t time.Time) string { return t.In(GetDefaultTimeZone()).Format(FormatDateMysql) } func ToDate(t time.Time) time.Time { y, m, d := t.Date() return time.Date(y, m, d, 0, 0, 0,...
udwTime/date.go
0.747247
0.560493
date.go
starcoder
package vision // InceptionV3 import ( "github.com/sugarme/gotch/nn" ts "github.com/sugarme/gotch/tensor" ) func convBn(p *nn.Path, cIn, cOut, ksize, pad, stride int64) ts.ModuleT { convConfig := nn.DefaultConv2DConfig() convConfig.Stride = []int64{stride, stride} convConfig.Padding = []int64{pad, pad} convCo...
vision/inception.go
0.816077
0.475423
inception.go
starcoder
package perfcounters import ( "fmt" "sync" "time" ) /* AverageTimer32 An average counter that measures the time it takes, on average, to complete a process or operation. Counters of this type display a ratio of the total elapsed time of the sample interval to the number of processes or operations completed durin...
perfcounters/averagetimer32.go
0.81899
0.47792
averagetimer32.go
starcoder
package gubernator // PERSISTENT STORE DETAILS // The storage interfaces defined here allows the implementor flexibility in storage options. Depending on the // use case an implementor can only implement the `Loader` interface and only support persistence of // ratelimits at startup and shutdown or implement `Store` ...
store.go
0.759136
0.437523
store.go
starcoder
package kdtree import ( "geo" "graph" ) // Parameters for the encoding that is used for storing k-d trees space efficient // Encoded vertex: vertex index + MaxEdgeOffset + MaxStepOffset // Encoded step: vertex index + edge offset + step offset const ( VertexIndexBits = 18 EdgeOffsetBits = 5 StepOffsetBits ...
src/kdtree/kdtree.go
0.530236
0.47317
kdtree.go
starcoder
package raylib import "math" //https://github.com/raysan5/raylib/blob/master/src/raymath.h //Quaternion A represntation of rotations that does not suffer from gimbal lock type Quaternion struct { X float32 Y float32 Z float32 W float32 } //NewQuaternionIdentity creates a Quaternion Identity (a blank quaternion)...
raylib/quanterion.go
0.932461
0.721363
quanterion.go
starcoder
package universe import ( "github.com/apache/arrow/go/v7/arrow/memory" "github.com/influxdata/flux" "github.com/influxdata/flux/array" ) type aggregateWindowSumInt struct { aggregateWindowBase vs *array.Int } func (a *aggregateWindowSumInt) Aggregate(ts *array.Int, vs array.Array, start, stop *array.Int, mem m...
stdlib/universe/aggregate_window.gen.go
0.587352
0.424949
aggregate_window.gen.go
starcoder
package evaluator import ( "fmt" "log" "github.com/gmlewis/go-csg/ast" "github.com/gmlewis/go-csg/object" ) // Singleton object types. var ( Null = &object.Null{} True = &object.Boolean{Value: true} False = &object.Boolean{Value: false} ) // Eval evaluates the AST node and returns the evaluated object. fun...
evaluator/evaluator.go
0.625438
0.506591
evaluator.go
starcoder
package gobaker import ( "fmt" "math" ) // Vertex desribes a 3D mesh vertex type Vertex struct { v Vector vt Vector // Texture coordinate vn Vector // Normal Vector va float64 // Vertex Color Alpha } //SetVertexAlpha set vertex alpha color func (v *Vertex) SetVertexAlpha(vAlpha float64) { v.va = vAlpha } ...
gobaker/triangle.go
0.831074
0.607372
triangle.go
starcoder
package wparams // ParamStorer is a type that stores safe and unsafe parameters. Keys should be unique across both SafeParams and // UnsafeParams (that is, if a key occurs in one map, it should not occur in the other). For performance reasons, // the maps returned by SafeParams and UnsafeParams are references to the u...
paramstorer.go
0.684159
0.524151
paramstorer.go
starcoder
package budgeting import ( "time" "github.com/shopspring/decimal" ) type Budget struct { Name string earliestMonth YearMonth latestMonth YearMonth tbb *Category categories map[string]*Category accounts []*Account budgeted map[YearMonth]monthBudget } type monthBudget struct { Mont...
budgeting/budget.go
0.7413
0.532425
budget.go
starcoder
package router import ( "math" "sync" "time" ) // Limit defines the maximum frequency of router events, represented as number of events per second. type Limit float64 // Inf is the infinite rate limit; it allows all events (even if burst is zero). const Inf = Limit(math.MaxFloat64) // A Limiter controls how freq...
internal/service/router/rate.go
0.797793
0.492615
rate.go
starcoder
package main // DataType is a models data structure type DataType interface { Type() string } // Model is the full db model structure and configuration // The model contains all the nessasary information for // Creating Query builders type Model struct { Driver string Pkg string Tables []*Table Types []Data...
datatype.go
0.785925
0.537345
datatype.go
starcoder
package ast import ( "strings" ) //Format formats the spacing in the Grammar. func (this *Grammar) Format() { if this.TopPattern != nil { this.TopPattern.format(false) } for i, p := range this.PatternDecls { p.format(i != 0 || this.TopPattern != nil) } this.After.format(false) } func (this *PatternDecl) f...
relapse/ast/format.go
0.578329
0.509032
format.go
starcoder
package iso20022 // Amount of money for which goods or services are offered, sold, or bought. type UnitPrice22 struct { // Type and information about a price. Type *TypeOfPrice46Choice `xml:"Tp"` // Value of the price, for example, as a currency and value. Value *PriceValue1 `xml:"Val"` // Type of pricing calc...
UnitPrice22.go
0.84367
0.458046
UnitPrice22.go
starcoder
package htsformats import ( "strings" ) // SamRecord holds all fields and tags from a single alignment of a SAM file type SamRecord struct { raw string qname string flag string rname string pos string mapq string cigar string rnext string pnext string tlen string seq string ...
internal/htsformats/samrecord.go
0.553747
0.407274
samrecord.go
starcoder
package main import ( "math" ) type vec3 struct { x float64 y float64 z float64 } func vec3Scale(vec vec3, factor float64) vec3 { return vec3{ x: vec.x * factor, y: vec.y * factor, z: vec.z * factor, } } func vec3Len(vec vec3) float64 { return math.Sqrt((vec.x*vec.x + vec.y*vec.y + vec.z*vec.z)) } fun...
ray/ray.go
0.893298
0.486575
ray.go
starcoder
package gohome import ( "github.com/PucklaMotzer09/mathgl/mgl32" "image/color" ) // This interface handles every low level rendering operation type Renderer interface { // Initialises the renderer Init() error // Gets called after the initialisation of the engine AfterInit() // Cleans everything up Terminate(...
src/gohome/renderer.go
0.801742
0.489992
renderer.go
starcoder
Package nanny implements logic to poll the k8s apiserver for cluster status, and update a deployment based on that status. */ package nanny import ( "time" log "github.com/golang/glog" api "k8s.io/kubernetes/pkg/api/v1" inf "speter.net/go/exp/math/dec/inf" ) // checkResource determines whether a specific resourc...
addon-resizer/nanny/nanny_lib.go
0.664431
0.437343
nanny_lib.go
starcoder
package chrono import ( "database/sql/driver" "errors" "fmt" "time" ) // Date is used to save and output YYYY-MM-DD format date string. type Date struct { time.Time } func (d Date) String() string { return d.In(time.UTC).Format(SQLDate) } // MarshalJSON converts a Time struct to ISO8601 string. func (d Date) ...
chrono/date.go
0.763043
0.427456
date.go
starcoder
package sdlang import ( "bytes" "encoding/base64" "errors" "fmt" "strconv" "time" ) type sdlValueTag int const ( tNull sdlValueTag = iota tString tInt tFloat tDateTime tTimeSpan tBool tBinary ) type SdlDebugLocation struct { File string Line string Loc int LineNumber int } // S...
ast.go
0.67971
0.425784
ast.go
starcoder
package stats import ( "fmt" "math" "sort" ) func New(values ...float64) *Stats { s := &Stats{} s.Add(values...) return s } type Stats struct { values []float64 sorted bool sum float64 } func (stats *Stats) Values() []float64 { return stats.values } func (stats *Stats) Add(values ...float64) { for _,...
stats/stats.go
0.72662
0.656782
stats.go
starcoder
package h3go import "math" // VertexNode is a single node in a vertex graph, part of a linked list. type VertexNode struct { from GeoCoord to GeoCoord next *VertexNode } // VertexGraph is a data structure to store a graph of vertices type VertexGraph struct { buckets []*VertexNode numBuckets int size ...
vertexgraph.go
0.68763
0.64994
vertexgraph.go
starcoder
package sqlp /* Notes on node representation In a language with variant types (tagged unions), we would have represented tokens/nodes as a variant. Go lacks variants, so the closest alternatives are: 1) Emulating a variant type by using a struct where every field is a pointer, and only one field must be non-nil. T...
sqlp_node.go
0.834677
0.742503
sqlp_node.go
starcoder
package shape import ( "gioui.org/f32" "gioui.org/op" "gioui.org/op/clip" "gioui.org/op/paint" "github.com/rs/xid" "image/color" ) type Path []f32.Point type rect [4]f32.Point func (r rect) hit(p f32.Point) bool { return pointInTriangle(p, r[0], r[1], r[2]) || pointInTriangle(p, r[0], r[3], r[2]) } type Lin...
wonder/shape/line.go
0.626238
0.464537
line.go
starcoder
package value import "strconv" // Float holds a single float64 value. type Float struct { valPtr *float64 } // NewFloat makes a new Float with the given float64 value. func NewFloat(val float64) *Float { valPtr := new(float64) *valPtr = val return &Float{valPtr: valPtr} } // NewFloatFromPtr makes a new Float w...
value/float.go
0.86342
0.607954
float.go
starcoder