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 common import ( "fmt" ) // Vector is a resizeable array. It takes its name from the C++ std::vector class. type Vector struct { array []interface{} emptyIndices Queue Length int } // MakeVector returns a pointer to a Vector func MakeVector() *Vector { return &Vector{ make([]interface{}, 0...
common/vector.go
0.734405
0.770292
vector.go
starcoder
package main /* // Example of interfacing between Go and C programs. */ import ( "C" ) import ( "fmt" "strconv" "strings" "unsafe" ) // A main function must be present, even if empty. func main() {} // All exported functions must have a '//export [name]' comment. //export add // add adds two integers func add(...
go2c.go
0.777131
0.488405
go2c.go
starcoder
package color /* */ import ( "math" "strconv" ) // Custom types to hold return values // The RGB type holds three values: one for red (R), green, (G) and // blue (B). Each of these colors are on the domain of [0, 255]. type RGB struct { R int `json:"R"` G int `json:"G"` B int `json:"B"` } // HSV type holds t...
types.go
0.83825
0.601418
types.go
starcoder
package fsm import ( "bytes" "fmt" ) const highlightingColor = "#00AA00" // MermaidDiagramType the type of the mermaid diagram type type MermaidDiagramType string const ( // FlowChart the diagram type for output in flowchart style (https://mermaid-js.github.io/mermaid/#/flowchart) (including current state) Flow...
mermaid_visualizer.go
0.672224
0.602442
mermaid_visualizer.go
starcoder
package discovery import "fmt" type Sensor struct { // A list of MQTT topics subscribed to receive availability (online/offline) updates. Must not be used together with `availability_topic` // Default: <no value> Availability []Availability `json:"availability,omitempty"` // When `availability` is configured, t...
sensor.go
0.813164
0.422028
sensor.go
starcoder
package golassert import ( "fmt" "reflect" ) /* AssertType asserts type of expected and result. */ func AssertType(expected interface{}, result interface{}) { expectedType := reflect.TypeOf(expected) resultType := reflect.TypeOf(result) if expectedType != resultType { err := "Error: [AssertEqual] Mismatched Ty...
golassert/equal.go
0.583203
0.651064
equal.go
starcoder
package preprocessor import ( "bytes" "encoding/json" "errors" "github.com/armory/dinghy/pkg/git" "strconv" "strings" "text/template" "unicode" ) func parseWhitespace(it *iterator) string { for !it.end() && unicode.IsSpace(it.get()) { it.pos++ } return " " } func parseString(it *iterator) string { begi...
pkg/preprocessor/preprocessor.go
0.510008
0.407628
preprocessor.go
starcoder
package contnet import ( "github.com/asaskevich/EventBus" "sort" "sync" ) type Trend struct { Topic Topic Popularity float64 } var trendPopularityCriteria = func(t1, t2 *Trend) bool { return t1.Popularity > t2.Popularity } // function that defines ordering between trend objects type TrendBy func(t1, t2 *...
contnet/trendstore.go
0.655667
0.41834
trendstore.go
starcoder
package gmgmap import ( "errors" "math" "math/rand" ) type vec2 struct { x, y int } type rect struct { x, y, w, h int } func (r rect) IsAdjacent(r2 rect, overlapSize int) bool { // If left/right edges adjacent if r.x-(r2.x+r2.w) == 0 || r2.x-(r.x+r.w) == 0 { return r.y+overlapSize < r2.y+r2.h && r2.y+overl...
gmgmap/util.go
0.614278
0.477554
util.go
starcoder
package token // LexItr represents an iterator of Lexemes. type LexItr struct { Items []Lexeme Idx int } // NewLexItr returns a new initialised LexItr. func NewLexItr(items []Lexeme) *LexItr { return &LexItr{ Items: items, Idx: -1, } } // More returns true if the end of iterator has not been reached yet....
scarlet/token/lexitr.go
0.752286
0.466846
lexitr.go
starcoder
package gubrak import ( "errors" "fmt" "reflect" ) func inspectFunc(err *error, data interface{}) (reflect.Value, reflect.Type) { var dataValue reflect.Value var dataValueType reflect.Type dataValue = reflect.ValueOf(data) if dataValue.Kind() == reflect.Ptr { dataValue = dataValue.Elem() } if dataValue....
operation_chainable_helper.go
0.524395
0.636014
operation_chainable_helper.go
starcoder
package gocomplex import "math" // Complex128 is the float structure representing the complex number type Complex128 struct { real float64 imaginary float64 } // CreateComplex128 Returns a Complex 128 structure func CreateComplex128(real float64, imaginary float64) Complex128 { c := Complex128{real: real, im...
complex.go
0.877962
0.555857
complex.go
starcoder
package golispy import ( "errors" ) type greaterThanCallable struct {} func (g greaterThanCallable) Call(exps []Exp, env Env) (Exp, error) { exp := Exp{} var ret int64 atom := Atom{integer: &ret} exp.atom = &atom if op1, op2 := Eval(exps[0], env), Eval(exps[1], env); len(exps) == 2 && op1.IsNumber() && op2.IsN...
functions.go
0.565899
0.453504
functions.go
starcoder
package scenario import ( "errors" "fmt" "math" "reflect" "strconv" "github.com/isucon/isucon11-final/benchmarker/api" "github.com/isucon/isucon11-final/benchmarker/model" ) func AssertEqual(msg string, expected interface{}, actual interface{}) bool { r := assertEqual(expected, actual) if !r { AdminLogger...
benchmarker/scenario/assert.go
0.60871
0.638356
assert.go
starcoder
package runtime import ( "strings" "sync/atomic" "github.com/apmckinlay/gsuneido/util/pack" ) /* Record is an immutable record stored in a string using the same format as cSuneido and jSuneido. NOTE: This is the post 2019 format using a two byte header. It is used for storing data records in the database and f...
runtime/record.go
0.616012
0.522507
record.go
starcoder
package circuit import ( "math" "math/rand" "time" "github.com/heustis/tsp-solver-go/model" ) // SimulatedAnnealing implements [simulated annealing](https://en.wikipedia.org/wiki/Simulated_annealing) to stochastically approximate the optimum circuit through a set of points. // Unlike the convex-concave algorithm...
circuit/simulatedannealing.go
0.864968
0.7586
simulatedannealing.go
starcoder
package mlpack /* #cgo CFLAGS: -I./capi -Wall #cgo LDFLAGS: -L. -lmlpack_go_lmnn #include <capi/lmnn.h> #include <stdlib.h> */ import "C" import "gonum.org/v1/gonum/mat" type LmnnOptionalParam struct { BatchSize int Center bool Distance *mat.Dense K int Labels *mat.Dense LinearScan bool ...
lmnn.go
0.704668
0.656135
lmnn.go
starcoder
package hyperscan import ( "bufio" "fmt" "io" "strconv" "strings" "github.com/flier/gohs/internal/hs" ) // ExprInfo containing information related to an expression. type ExprInfo = hs.ExprInfo // ExtFlag are used in ExprExt.Flags to indicate which fields are used. type ExtFlag = hs.ExtFlag const ( // ExtMin...
hyperscan/pattern.go
0.753693
0.543227
pattern.go
starcoder
package storage import ( "math" "github.com/flowmatters/openwater-core/data" "github.com/flowmatters/openwater-core/models/routing" ) /* OW-SPEC StorageDissolvedDecay: inputs: inflowMass: kg.s^-1 inflow: m^3.s^-1 outflow: m^3.s^-1 storageVolume: m^3 states: storedMass: kg parameters: DeltaT: '[1,86...
models/storage/dissolved_decay.go
0.656218
0.443962
dissolved_decay.go
starcoder
package msgraph // RatingGermanyTelevisionType undocumented type RatingGermanyTelevisionType string const ( // RatingGermanyTelevisionTypeVAllAllowed undocumented RatingGermanyTelevisionTypeVAllAllowed RatingGermanyTelevisionType = "AllAllowed" // RatingGermanyTelevisionTypeVAllBlocked undocumented RatingGermany...
v1.0/RatingGermanyTelevisionTypeEnum.go
0.582254
0.477859
RatingGermanyTelevisionTypeEnum.go
starcoder
package function import ( "fmt" "regexp" "strconv" "time" "github.com/square/metrics/api" ) // Value is the result of evaluating an expression. // They can be floating point values, strings, or series lists. type Value interface { ToSeriesList(api.Timerange) (api.SeriesList, *ConversionFailure) ToString() (s...
function/value.go
0.785966
0.424233
value.go
starcoder
type Node struct { cnt, length int } type Interval struct { begin, end int } type ByEnd []Interval func (a ByEnd) Len() int { return len(a) } func (a ByEnd) Swap(i, j int) { a[i], a[j] = a[j], a[i] } func (a ByEnd) Less(i, j int) bool { return a[i].end < a[j].end } func max(a, b Node) Node { if a.c...
leetcode/maximum-number-of-non-overlapping-substrings/solution.go
0.54577
0.426381
solution.go
starcoder
package bactract import ( "encoding/hex" "fmt" "math" ) // readGeography reads the value for a varchar column func readGeography(r *tReader, tc TableColumn) (ec ExtractedColumn, err error) { fn := "readGeography" if debugFlag { debOut(fmt.Sprintf("Func %s", fn)) } // Determine how many bytes to read ss, e...
bactract/geography.go
0.506836
0.469885
geography.go
starcoder
package mlpack /* #cgo CFLAGS: -I./capi -Wall #cgo LDFLAGS: -L. -lmlpack_go_krann #include <capi/krann.h> #include <stdlib.h> */ import "C" import "gonum.org/v1/gonum/mat" type KrannOptionalParam struct { Alpha float64 FirstLeafExact bool InputModel *rannModel K int LeafSize int Naive bool ...
krann.go
0.730578
0.491334
krann.go
starcoder
package day3 import ( "adventofcode/utils" "fmt" "log" "strconv" "strings" ) type Point struct { X int Y int } const MaxUint = ^uint(0) const MaxInt = int(MaxUint >> 1) // 1. index all points in wire 1 // 2. index points in wire 2 func nextPointInDirection(p Point, direction byte) Point { switch direction ...
day3/day3.go
0.568176
0.426023
day3.go
starcoder
package topojson import ( geojson "github.com/paulmach/orb/geojson" ) // Filter topology into a new topology that only contains features with the given IDs func (t *Topology) Filter(ids []string) *Topology { result := &Topology{ Type: t.Type, Transform: t.Transform, BBox: t.BBox, Objects: make(m...
encoding/topojson/filter.go
0.727685
0.431764
filter.go
starcoder
package primitives import ( "bytes" "context" "github.com/atomix/go-client/pkg/client/map" "github.com/atomix/go-client/pkg/client/session" "github.com/onosproject/onos-test/pkg/onit/env" "github.com/stretchr/testify/assert" "testing" "time" ) // TestAtomixMap : integration test func (s *TestSuite) TestAtomi...
test/primitives/maptest.go
0.591133
0.608914
maptest.go
starcoder
package rotate import ( "math" "math/rand" "github.com/paulwrubel/photolum/config/geometry" "github.com/paulwrubel/photolum/config/geometry/primitive" "github.com/paulwrubel/photolum/config/geometry/primitive/aabb" "github.com/paulwrubel/photolum/config/shading/material" ) // RotationY is a primiti...
config/geometry/primitive/transform/rotate/rotatey.go
0.813387
0.449211
rotatey.go
starcoder
package camera import ( "math" "github.com/go-gl/mathgl/mgl32" ) // Camera movements const ( FORWARD = iota BACKWARD LEFT RIGHT ) const ( cYaw = -90 cPitch = 0 cSpeed = 2.5 cSensitivity = 0.1 cZoom = 45 ) // Camera Contains information about the camera type Camera struct { po...
camera/camera.go
0.742888
0.402627
camera.go
starcoder
// Package byteutil provides various operations on bytes and byte strings. package byteutil var ( digit [256]bool hexdigit [256]bool letter [256]bool uppercase [256]bool lowercase [256]bool alphanum [256]bool tolower [256]byte toupper [256]byte ) func init() { for _, b := range "0123456789" { ...
src/vendor/github.com/golang-commonmark/markdown/byteutil/byteutil.go
0.592195
0.450178
byteutil.go
starcoder
package main import ( "fmt" "math" ) type PromptTriangle struct { a, b, c, A, B, C float64 } func NewPromptTriangle(partialValues PromptTriangle) (result *PromptTriangle) { result = new(PromptTriangle) result.C = math.Pi / 2 if 0 < partialValues.a { result.a = partialValues.a } if 0 < partialValues.b { ...
easy/101-200/160/go/main.go
0.537284
0.443962
main.go
starcoder
package dfl import ( "github.com/pkg/errors" "github.com/spatialcurrent/go-adaptive-functions/pkg/af" "github.com/spatialcurrent/go-reader-writer/pkg/io" ) // In is a BinaryOperator that evaluates to true if the left value is in the right value. // The left value is cast as a string using "fmt.Sprint(lv)". // If...
pkg/dfl/In.go
0.691185
0.460046
In.go
starcoder
package mgl import ( "math" "unsafe" "github.com/go-gl/gl/v2.1/gl" ) const ( NUM_SEG = 16 ) var ( dir [NUM_SEG * 2]float32 _init = false ) func init() { for i := 0; i < NUM_SEG; i++ { a := float64(i) / float64(NUM_SEG) * float64(math.Pi*2) dir[i*2] = float32(math.Cos(a)) dir[i*2+1] = float32(math.Si...
demo/src/mgl/mgl.go
0.520009
0.461138
mgl.go
starcoder
package fullerene import ( "time" ) type Fullerene struct { t time.Time } func Now() Fullerene { return Fullerene{ t: time.Now(), } } func (fr Fullerene) Date() (year int, month time.Month, day int) { return fr.t.Date() } func (fr Fullerene) After(u Fullerene) bool { return fr.t.After(u.t) } func (fr Full...
fullerene.go
0.675122
0.58818
fullerene.go
starcoder
package learnML import ( "../matrix" ) type LayerType int type Dims []int const ( LayerLinear LayerType = iota LayerTanh LayerConv LayerLeakyRectifier LayerMaxPooling2D LayerComposite LayerSinusoidal ) type Layer interface { Activate(x *matrix.Vector) *matrix.Vector BackProp(prevBlame *matrix.Vector) ini...
goml/learnML/layer.go
0.723212
0.553505
layer.go
starcoder
package main import ( "github.com/ByteArena/box2d" "github.com/wdevore/Ranger-Go-IGE/api" "github.com/wdevore/Ranger-Go-IGE/extras/shapes" ) type landPhysicsComponent struct { physicsComponent categoryBits uint16 // I am a... maskBits uint16 // I can collide with a... } func newLandPhysicsComponent() *lan...
examples/complex/physics/complex/c4_lava/land_physics_component.go
0.568176
0.475544
land_physics_component.go
starcoder
package state // batched_storage.go - stores arbitrary data for given key prefix, batching it in a way // that no single value in db is larger than specified `batchSize` in bytes. // data is sequence of records of similar size, batchedStorage also provides iterators // to move through records, in range from most recen...
pkg/state/batched_storage.go
0.729809
0.465145
batched_storage.go
starcoder
package parser import ( "io/ioutil" "log" "net/http" "strings" ) // Question , type Question struct { Number int `json:"number"` Statement string `json:"statement"` Code string `json:"code"` Options map[string]string `json:"options"` CorrectAnswer...
backend/parser/parser.go
0.665737
0.441914
parser.go
starcoder
package functions import ( "fmt" "github.com/aokoli/goutils" "github.com/huandu/xstrings" "strings" ) var FuncAbbrev = Function{ Description: `Abbreviates a string using ellipses. This will turn the string "Now is the time for all good men" into "Now is the time for..."`, Parameters: Parameters{{ Name: ...
template/functions/strings.go
0.731442
0.599427
strings.go
starcoder
package ordinarykriging import "image/color" type ModelType string const ( Gaussian ModelType = "gaussian" Exponential ModelType = "exponential" Spherical ModelType = "spherical" ) var ( DefaultLegendColor = []color.Color{ NewRGBA(40, 146, 199, 255), NewRGBA(96, 163, 181, 255), NewRGBA(140, 184, 164,...
ordinarykriging/type.go
0.670824
0.421195
type.go
starcoder
package vector3 import ( "github.com/louis030195/protometry/api/quaternion" "math" "math/rand" ) // NewVector3 constructs a Vector3 func NewVector3(x, y, z float64) *Vector3 { return &Vector3{X: x, Y: y, Z: z} } // Clone a vector func (v *Vector3) Clone() *Vector3 { return NewVector3(v.X, v.Y, v.Z) } ...
api/vector3/vector3.go
0.946312
0.744169
vector3.go
starcoder
package imagecolor import ( "image" "math" "sort" "github.com/lucasb-eyer/go-colorful" "gonum.org/v1/gonum/stat" ) // Box - x1, y1, x2, y2 int type Box struct { Rect image.Rectangle Focused float64 Score float64 MeanL float64 StdL float64 SkewL float64 values []float64 } // NewBox - Create ...
box.go
0.794026
0.494263
box.go
starcoder
// Package ged implements a global-purpose encoding/decoding library. package ged import ( "math" "strings" "github.com/nkcr/ged/alphabet" "golang.org/x/xerrors" ) // EncodeHex encodes data to hexadecimal. Uses the lower case letter form. func EncodeHex(data []byte) string { return EncodeString(data, alphabet...
mod.go
0.878985
0.406921
mod.go
starcoder
package yurit /* import ( "fmt" "io" ) // id3v2Header is a type which represents an ID3v2 tag header. type id3v2Header struct { Version Format Unsynchronisation bool ExtendedHeader bool Experimental bool Footer bool Size uint } // readID3v2Header reads the ID3v2 head...
id3v2header.go
0.583915
0.412885
id3v2header.go
starcoder
package require import ( "reflect" "regexp" "runtime" "testing" ) // Matches checks that a string matches a regular-expression. func Matches(tb testing.TB, expectedMatch string, actual string, msgAndArgs ...interface{}) { r, err := regexp.Compile(expectedMatch) if err != nil { fatal(tb, msgAndArgs, "Match str...
src/client/pkg/require/require.go
0.563378
0.435902
require.go
starcoder
package asdf import ( "bytes" "compress/bzip2" "compress/zlib" "crypto/md5" "encoding/binary" "io" "io/ioutil" "github.com/pierrec/lz4" "github.com/pkg/errors" ) var blockMagic = [4]byte{0xd3, 0x42, 0x4c, 0x4b} // CompressionKind indicates the block compression type: none, zlib, bzip2 or lz4. type Compress...
block.go
0.626581
0.483526
block.go
starcoder
package eurorack import ( "github.com/jsleeio/go-eagle/pkg/panel" ) const ( // PanelHeight3U represents the total height of a Eurorack panel. Note in // particular that this is NOT the same as the Eurocard standard, as the // latter does not use lipped rails PanelHeight3U = 128.5 // ExtraMountingHolesThreshold...
pkg/format/eurorack/eurorack.go
0.848251
0.696236
eurorack.go
starcoder
package models import ( i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91 "github.com/microsoft/kiota-abstractions-go/serialization" ) // RelyingPartyDetailedSummary type RelyingPartyDetailedSummary struct { Entity // Number of failed sign in on Active Directory Federation Service in the ...
models/relying_party_detailed_summary.go
0.630344
0.414899
relying_party_detailed_summary.go
starcoder
package ent import ( "fmt" "strings" "time" "entgo.io/ent/dialect/sql" "github.com/open-privacy/opv/pkg/ent/apiaudit" ) // APIAudit is the model entity for the APIAudit schema. type APIAudit struct { config `json:"-"` // ID of the ent. ID string `json:"id,omitempty"` // CreatedAt holds the value of the "cr...
pkg/ent/apiaudit.go
0.649023
0.421433
apiaudit.go
starcoder
package main const kartaQMLString = ` // Start of the QML string import QtQuick 2.0 import QtQuick.Particles 2.0 import GoExtensions 1.0 Rectangle { id: root property alias seed: seedInput.text property int clickX: 0 property int clickY: 0 width: 800 height: 600 color: "#030f14" Rectangle { id: backgrou...
cmd/karta-gui/qml.go
0.575111
0.467636
qml.go
starcoder
package raster import ( "bytes" "errors" "image" "image/jpeg" "image/png" "math" "github.com/xeonx/geographic" ) //n returns 2^level func n(level int) int { return 1 << uint(level) } //X2Lon transforms x into a longitude in degree at a given level. func X2Lon(level int, x int) float64 { return float64(x)/f...
raster.go
0.853196
0.504333
raster.go
starcoder
package board import ( "fmt" "math" ) type Tile struct { Visit int X int Y int } type Board struct { Tiles [][]Tile PositionX int PositionY int } func NewBoard(size, startX, startY int) Board { b := Board{PositionX: startX, PositionY: startY} for i := 0; i < size; i++ { b.Tiles = append(b.Ti...
board/board.go
0.578924
0.477981
board.go
starcoder
package strmatcher // Type is the type of the matcher. type Type byte const ( // Full is the type of matcher that the input string must exactly equal to the pattern. Full Type = 0 // Domain is the type of matcher that the input string must be a sub-domain or itself of the pattern. Domain Type = 1 // Substr is th...
common/strmatcher/strmatcher.go
0.738575
0.579014
strmatcher.go
starcoder
package uitheme import ( "image/color" "fyne.io/fyne" "fyne.io/fyne/theme" ) type DarkBlue struct{} func NewDarkBlue() *DarkBlue { return &DarkBlue{} } func (DarkBlue) BackgroundColor() color.Color { return color.RGBA{R: 0x1e, G: 0x1e, B: 0x1e, A: 0xff} } //func (DarkBlue) ButtonColor() color.Color { return colo...
uitheme/darkBlue.go
0.682891
0.40439
darkBlue.go
starcoder
package tile import ( "fmt" "math" "time" ) //ToRegularProjectedGrid converts a regular geographic grid to a regular Mercator grid. func ToRegularProjectedGrid(grid Grid) Grid { h := grid.Header projector := MercatorProjector{} defer TimeTrack(time.Now(), fmt.Sprint("Project ", h.Nx, "*", h.Ny, "=", (h.Nx*h.Ny...
tile/project.go
0.794305
0.586464
project.go
starcoder
package sitrep import ( "github.com/gocql/gocql" "time" "github.com/relops/cqlc/cqlc" "log" ) const ( CQLC_VERSION = "0.10.5" ) type CreateUsersInExerciseEmailColumn struct { } func (b *CreateUsersInExerciseEmailColumn) ColumnName() string { return "email" } func (b *CreateUsersInExerciseEmailColumn) To(...
schema/sitrep.go
0.569972
0.451085
sitrep.go
starcoder
package boid import ( "math" v "github.com/BozeBro/boids/vector" "github.com/hajimehoshi/ebiten/v2" ) type Boid interface { Update(float64, float64, []Boid, int, chan *Data) Draw(*ebiten.Image) Coords() v.Vector2D Velocity() v.Vector2D Apply(*v.Vector2D, *v.Vector2D) } type Data struct { ...
boid/boid.go
0.553747
0.610947
boid.go
starcoder
package geom type Rect struct { Vec // Position (contains X,Y) Size Vec // Size (X,Y) } func (rect *Rect) Pos() Vec { return rect.Vec } func (rect *Rect) Left() float64 { return rect.Vec.X } func (rect *Rect) Right() float64 { return rect.Vec.X + rect.Size.X } func (rect *Rect) Top() float64 { return r...
gml/internal/geom/rect.go
0.867738
0.568416
rect.go
starcoder
package interpreter import ( "fmt" "log" "strconv" "strings" ) type Token interface { Eval(c Context) (Token, bool) String() string Galaxy() string } type Value interface { Token Value() int64 } type Var interface { Token Get(c Context) Token } type Func interface { Token Apply(v Token) Token } type ...
diseaz/interpreter/tokens.go
0.682891
0.419707
tokens.go
starcoder
package prettyformat import ( "bytes" "errors" "fmt" "reflect" "sort" "strings" ) var ( // ErrInvalidType is returned when the type of the passed value cannot be determined ErrInvalidType = errors.New("invalid type") // ErrArbitraryPointerType is returned when an arbitrary pointer is passed ErrArbitraryPoin...
pretty.go
0.646237
0.421314
pretty.go
starcoder
package must import ( "fmt" "reflect" "github.com/kylelemons/godebug/diff" "github.com/kylelemons/godebug/pretty" ) var _ MustTester = Tester{} /* Tester implements MustTester and provides a TestingT to be used for all check functions. */ type Tester struct { T TestingT ...
tester.go
0.733643
0.451508
tester.go
starcoder
package geo import ( "fmt" "strconv" "strings" ) // GGALat2DD converts a GGA latitude to decimal degrees. // Latitude and north/south designation should be provided separately, with // north/south presented as one of "NnSs". Decimal degree coordinates are // returned with precision to 4 decimal places (11.132 m). ...
geo/geo.go
0.712832
0.483587
geo.go
starcoder
package scanfix import ( "fmt" "strconv" f0 "github.com/protofix/protofix/codecfix" ) // Field is a Protoscan splitter which splits field of the FIX message. type Field struct { Format f0.Format Tag int // Tag is a unique number of the last successfully tokenized FIX field. Gaps []byte // Last s...
scanfix/scanfix_field.go
0.565179
0.446072
scanfix_field.go
starcoder
package hexagolang // Hexagons implementation interpreted from // https://www.redblobgames.com/grids/hexagons/implementation.html // and // https://www.redblobgames.com/grids/hexagons/ import ( "image" "math" ) // H is a single hexagon in the grid. type H struct { Q, R int } // Delta converts the hex to a delta....
hex.go
0.935685
0.692304
hex.go
starcoder
package main import "fmt" /* Here we'll look at different ways of writing a process. The implementation will depend highly on how components and ports have been defined. Overall we need to make decisions: 1. who owns the ports: process or component or connection 2. who owns the data: process or component 3. ...
12-process-definition/definitions.go
0.550366
0.700203
definitions.go
starcoder
package cryptolib import ( "crypto/rand" "crypto/sha256" "errors" "math/big" "strings" "golang.org/x/crypto/bn256" ) //GeneratePairingKey generate a private key and two public keys. (Because Pairing goes from G1 x G2 -> G3) func GeneratePairingKey() (priv []byte, g1Pub []byte, g2Pub []byte, err error) { privI...
goService/src/cryptolib/certificate.go
0.709321
0.446133
certificate.go
starcoder
package nanocms_compiler import ( "fmt" "reflect" "github.com/go-yaml/yaml" ) /* A representation of an object tree, preserving ordering. */ type OTree struct { _data map[interface{}]interface{} _kidx []interface{} } func NewOTree() *OTree { return new(OTree).Flush() } // Flush the content of the tree func ...
nanostate/compiler/otree.go
0.708213
0.402216
otree.go
starcoder
package data import ( "bufio" "bytes" "regexp" "strconv" "strings" ) type ParseSeq func (seqType SeqType, data []byte) []string // ParseSequences parses emoji sequences of the specified type from the specified data. // Note that prior to version 3.0, type information is not included in the sequence data // file...
data/parse_sequences.go
0.540439
0.437523
parse_sequences.go
starcoder
package tmuxfmt import ( "fmt" "strconv" "strings" ) // Value receives a value from the tmux output as a string and parses it. type Value interface { Set(string) error } type captureExpr struct { Expr Expr Value Value } // Capturer captures the output of tmuxfmt expressions into Go values. type Capturer stru...
internal/tmux/tmuxfmt/capture.go
0.665628
0.502991
capture.go
starcoder
package router import ( "math/rand" "time" "github.com/streamingfast/dmesh" "go.uber.org/zap" "google.golang.org/grpc" ) // dmeshPlanner is the engine that dispatches queries to the different // backend nodes, based on the state of the available services // (through the `dmesh` discovery package), and the rang...
router/planner.go
0.608361
0.462109
planner.go
starcoder
package secp256k1 import ( "crypto/ecdsa" "errors" "fmt" "math/big" ) // These constants define the lengths of serialized public keys. const ( PubKeyBytesLenCompressed = 33 PubKeyBytesLenUncompressed = 65 PubKeyBytesLenHybrid = 65 ) func isOdd(a *big.Int) bool { return a.Bit(0) == 1 } // decompress...
pubkey.go
0.658527
0.531635
pubkey.go
starcoder
package rds import ( "database/sql/driver" "fmt" "github.com/aws/aws-sdk-go/aws" "github.com/aws/aws-sdk-go/service/rdsdataservice" "reflect" "time" ) // FieldConverter is a function that converts the passed result row field into the expected type. type FieldConverter func(field *rdsdataservice.Field) (interfac...
dialect.go
0.554953
0.400105
dialect.go
starcoder
package sortsearch import ( "sort" ) /* # Top K Frequent Elements # https://leetcode.com/explore/interview/card/top-interview-questions-medium/110/sorting-and-searching/799/ Given a non-empty array of integers, return the k most frequent elements. Example 1: Input: nums = [1,1,1,2,2,3], k = 2 Output: [1,2] Exampl...
interview/medium/sortsearch/array.go
0.815269
0.530662
array.go
starcoder
package utils import ( "errors" "fmt" "reflect" "time" ) // Comparator imposes a total ordering on some collection of objects, and it allows precise control over the sort order. type Comparator interface { // Compare compares its two arguments for order. // It returns a negative integer, zero, or a positive in...
utils/comparator.go
0.660829
0.50293
comparator.go
starcoder
package villa import ( "fmt" "github.com/golangplus/bytes" ) /* IntMatrix is 2D array of integers. Elements are store in a single int slice and slices of each row are created. NOTE the matrix can be sized of 0x0, but never 0x10 or 10x0. */ type IntMatrix [][]int // NewIntMatrix creates a new IntMatrix instance w...
intmat.go
0.777596
0.512876
intmat.go
starcoder
package radolan type spec struct { px int // plain data dimensions py int dx int // data (layer) dimensions dy int rx float64 // resolution ry float64 } // local picture products do not provide dimensions in header var dimensionCatalog = map[string]spec{ "OL": {200, 224, 200, 200, 2, 2}, // reflectivity (no...
catalog.go
0.557966
0.586168
catalog.go
starcoder
package primitive // edgeMap is a map of edges. edgeMap are not concurrency safe. type edgeMap map[string]map[string]*Edge func (e edgeMap) Types() []string { var typs []string for t, _ := range e { typs = append(typs, t) } return typs } // RangeType executes the function over a list of edges with the given ty...
primitive/edges.go
0.776369
0.638074
edges.go
starcoder
package tensor import ( "reflect" "unsafe" "github.com/pkg/errors" ) // Set sets the value of the underlying array at the index i. func (a *array) Set(i int, x interface{}) { switch a.t.Kind() { case reflect.Bool: xv := x.(bool) a.SetB(i, xv) case reflect.Int: xv := x.(int) a.SetI(i, xv) case reflect...
vendor/gorgonia.org/tensor/array_getset.go
0.533884
0.564038
array_getset.go
starcoder
package block import ( "github.com/df-mc/dragonfly/server/block/cube" "github.com/df-mc/dragonfly/server/entity/effect" "github.com/df-mc/dragonfly/server/entity/physics" "github.com/df-mc/dragonfly/server/internal/nbtconv" "github.com/df-mc/dragonfly/server/item" "github.com/df-mc/dragonfly/server/world" "gith...
server/block/beacon.go
0.709019
0.432483
beacon.go
starcoder
package storage import ( "math" "github.com/tony2001/prometheus/v2/tsdb/chunkenc" ) // MemoizedSeriesIterator wraps an iterator with a buffer to look back the previous element. type MemoizedSeriesIterator struct { it chunkenc.Iterator delta int64 lastTime int64 ok bool // Keep track of the previou...
v2/storage/memoized_iterator.go
0.842863
0.436682
memoized_iterator.go
starcoder
package interpolate import "math" type Interp func(float64, float64, float64) float64 // Interpolate funcs // https://play.golang.org/p/OKSM_h0zn- func Linear(t, start, end float64) float64 { return t*(end-start) + start } // For gradient Color correction // http://youtu.be/LKnqECcg6Gw func LinearSqr(t, start, e...
interpolate/interpolate.go
0.893988
0.731346
interpolate.go
starcoder
package driver type Read struct { Key string Raw []byte } type ResultsIterator interface { // Next returns the next item in the result set. The `QueryResult` is expected to be nil when // the iterator gets exhausted Next() (*Read, error) // Close releases resources occupied by the iterator Close() } type Vers...
platform/view/services/db/driver/driver.go
0.679817
0.454048
driver.go
starcoder
package format import ( "math" "strconv" "time" ) // https://en.wikipedia.org/wiki/Measuring_network_throughput // https://en.wikipedia.org/wiki/Data_rate_units const ( kilo = float64(1000) mega = float64(1000) * kilo giga = float64(1000) * mega tera = float64(1000) * giga kibi = float64(1024) mebi = float...
pkg/helper/format/throughput.go
0.754825
0.457137
throughput.go
starcoder
Package iState is used to easily manage perform CRUD operations on states/assets in Hyperledger Fabric chaincode. It also can be used to easily enable encryption when storing states and auto decryption when reading from state db. The main purpose of this package is to enable high performance Rich Queries when usi...
doc.go
0.538741
0.493042
doc.go
starcoder
package transformation import ( "math" "time" ) var ( emptyDatapoint = Datapoint{Value: math.NaN()} ) // Datapoint is a metric data point containing a timestamp in // Unix nanoseconds since epoch and a value. type Datapoint struct { TimeNanos int64 Value float64 } // IsEmpty returns whether this is an emp...
src/metrics/transformation/func.go
0.875654
0.688763
func.go
starcoder
package radius import ( "math" "github.com/dayaftereh/stargen/mathf" "github.com/dayaftereh/stargen/stargen/constants" "github.com/dayaftereh/stargen/types" ) // volumeRadius calculates the radius from the volume. The mass is in units of solar masses, and the density is in units of grams/cc. // The radius return...
stargen/radius/radius.go
0.820685
0.506836
radius.go
starcoder
// Package types contains most of the data structures available to/from Noms. package types import ( "context" "github.com/liquidata-inc/dolt/go/store/d" "github.com/liquidata-inc/dolt/go/store/hash" ) // Type defines and describes Noms types, both built-in and user-defined. // Desc provides the composition of ...
go/store/types/type.go
0.714429
0.551091
type.go
starcoder
package timer import ( "math" "github.com/shasderias/ilysa/ease" "github.com/shasderias/ilysa/scale" ) type Range interface { B() float64 // current beat // T is the current time in the current range on a 0-1 scale. As a special case, // T returns 1 when the range only has 1 step. T() float64 Ordinal() int ...
timer/range.go
0.805441
0.579281
range.go
starcoder
package generator // singlesChains removes candidates by two methods. Prior to removing any candidates, chains are created between cells that contain the only two occurances of a digit in a unit (box, row, or column). The chains connect the units together through the doubly occurring digits. Starting at an arbitrary l...
generator/singlesChains.go
0.836921
0.733762
singlesChains.go
starcoder
package ecc import ( "fmt" "math/big" ) type Point struct { X FieldInterface Y FieldInterface A FieldInterface B FieldInterface Err error } func NewPoint(x FieldInterface, y FieldInterface, a FieldInterface, b FieldInterface) (*Point, error) { if x == nil || y == nil { return &Point{X: nil, Y: nil,...
ecc/point.go
0.689828
0.469642
point.go
starcoder
package simpleregtest import ( "fmt" "reflect" "strconv" "testing" "time" "github.com/decred/dcrd/dcrjson" "github.com/decred/dcrd/integration" "github.com/decred/dcrd/integration/harness" "github.com/decred/dcrd/rpcclient" ) // JoinType is an enum representing a particular type of "node join". A node // j...
integration/harness/simpleregtest/helpers.go
0.591841
0.431045
helpers.go
starcoder
package rfc6979 import ( "bytes" "crypto/ecdsa" "crypto/elliptic" "crypto/hmac" "crypto/sha256" "errors" "hash" "math/big" ) var ( // Used in RFC6979 implementation when testing the nonce for correctness one = big.NewInt(1) // oneInitializer is used to fill a byte slice with byte 0x01. It is provided //...
ecdsa/rfc6979/rfc6979.go
0.779154
0.41834
rfc6979.go
starcoder
package aggregation // https://docs.mongodb.com/manual/reference/operator/aggregation/#trigonometry-expression-operators // Sin returns the sine of a value that is measured in radians. // New in version 4.2. // https://docs.mongodb.com/manual/reference/operator/aggregation/sin/ func Sin(number interface{}) M { retur...
pkg/aggregation/trigonometry.go
0.93528
0.423875
trigonometry.go
starcoder
package anomaly import ( "github.com/luuphu25/data-sidecar/stat" ) func anomalyLabels(labels map[string]string, model string) map[string]string { anomalyLabels := make(map[string]string) for xx, yy := range labels { if xx == "ft_target" { continue } anomalyLabels[xx] = yy } anomalyLabels["__name__"] = "...
scoring/anomaly/nelson.go
0.697609
0.453867
nelson.go
starcoder
package uatype func init() { nodeInfoMap[1] = nodeInfo{ displayName: "Boolean", class: NodeClassDataType, description: "Describes a value that is either TRUE or FALSE.", } nodeInfoMap[2] = nodeInfo{ displayName: "SByte", class: NodeClassDataType, description: "Describes a value that is an integer betwe...
stack/uatype/node_id_info_auto.go
0.639624
0.667256
node_id_info_auto.go
starcoder
package gobacktest import ( "math" "time" // "github.com/shopspring/decimal" ) // Position represents the holdings position type Position struct { timestamp time.Time symbol string qty int64 // current qty of the position, positive on BOT position, negativ on SLD position qtyBOT int64 /...
position.go
0.643777
0.51562
position.go
starcoder
package models import ( i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91 "github.com/microsoft/kiota-abstractions-go/serialization" ) // AccessPackageApprovalStage type AccessPackageApprovalStage struct { // Stores additional data not described in the OpenAPI description found when deseriali...
models/access_package_approval_stage.go
0.574514
0.404743
access_package_approval_stage.go
starcoder
package strings import ( "bytes" "strings" "unicode" ) // ToLower returns a copy of the string s with all Unicode letters mapped to their lower case. func ToLower(s string) string { return strings.ToLower(s) } // ToLowerFirst returns a copy of the string s with first Unicode letters mapped to their lower case. f...
vendor/gopkg.in/goyy/goyy.v0/util/strings/case.go
0.656108
0.445409
case.go
starcoder
package primitive import ( "math" "math/rand" ) type Vector struct { X, Y, Z float64 } var UnitVector = Vector{1, 1, 1} func VectorInUnitSphere(rnd *rand.Rand) Vector { for { r := Vector{rnd.Float64(), rnd.Float64(), rnd.Float64()} p := r.MultiplyScalar(2.0).Subtract(UnitVector) if p.SquaredLength() >= 1....
primitive/vector.go
0.864668
0.696513
vector.go
starcoder
package search type JSONHeatmapFacetMap JSONFacetMap func CreateJSONHeatmapFacetMap(fieldname string) *JSONHeatmapFacetMap { jfm := CreateJSONFacetMap(fieldname) return (*JSONHeatmapFacetMap)(jfm) } func (jfm *JSONHeatmapFacetMap) withSubFacet(string, *JSONFacetMap) *JSONHeatmapFacetMap { panic("subfacets not sup...
pkg/search/solrJSONHeatmapFacetMap.go
0.926412
0.447883
solrJSONHeatmapFacetMap.go
starcoder