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 pine import ( "time" "github.com/shopspring/decimal" "github.com/pkg/errors" ) // ArithmeticType defines the arthmetic operation type ArithmeticType int const ( // ArithmeticAddition adds values ArithmeticAddition ArithmeticType = iota // ArithmeticSubtraction subtracts values ArithmeticSubtraction ...
arithmetic.go
0.628521
0.484563
arithmetic.go
starcoder
package particles import ( "github.com/wdevore/Ranger-Go-IGE/api" "github.com/wdevore/Ranger-Go-IGE/engine/geometry" "github.com/wdevore/Ranger-Go-IGE/engine/maths" ) // NodeParticle is the base object of a NodeParticle system. type NodeParticle struct { elapsed float32 lifespan float32 position api.IPoint ve...
extras/particles/particle_node.go
0.761893
0.435001
particle_node.go
starcoder
package fbptree import ( "encoding/binary" ) func decodeUint16(data []byte) uint16 { return binary.BigEndian.Uint16(data) } func encodeUint16(v uint16) []byte { var data [2]byte binary.BigEndian.PutUint16(data[:], v) return data[:] } func decodeUint32(data []byte) uint32 { return binary.BigEndian.Uint32(data...
encoding.go
0.646014
0.427038
encoding.go
starcoder
package gimli import ( "encoding/binary" ) const rateInBytes = 16 // Hash computes the hash using the sponge construction func Hash(output, input []byte) { var state Gimli // absorb full input blocks for len(input) >= rateInBytes { state[0] ^= binary.LittleEndian.Uint32(input[0:4]) state[1] ^= binary.LittleE...
hash.go
0.574037
0.421611
hash.go
starcoder
package array import ( "errors" "fmt" ) // Array is a struct wrapper over slices to enable usage of methods indirectly on the slice type Array struct { items []interface{} } // New creates a new array struct func New(items []interface{}) *Array { newArray := Array{items: items} return &newArray } // Get return...
array.go
0.825379
0.548794
array.go
starcoder
package grbl import ( "github.com/centretown/tiny-fabb/forms" ) const ( Parameters forms.WebId = iota Motion PlaneSelection Diameter DistanceMode FeedRateMode Units CutterRadiusCompensation ToolLengthOffset ReturnModeInCannedCycles CoordinateSystemSelection Stopping ToolChange SpindleTurning Coolant ...
grbl/gcode.go
0.638046
0.409014
gcode.go
starcoder
package main import ( "encoding/csv" "fmt" "io" "math" "os" "strconv" "github.com/fang2hou/easyga" "github.com/wcharczuk/go-chart" ) type travellingSalesmanProblem struct { ga easyga.GeneticAlgorithm cityLocation [][]float64 fitnessData []float64 } func main() { // Initialize a travelling sal...
_examples/tsp/main.go
0.52975
0.406538
main.go
starcoder
package recommender import ( "fmt" "github.com/sirupsen/logrus" "math" "sort" ) // AttributeValueSelector interface comprises attribute selection algorythm entrypoints type AttributeValueSelector interface { // SelectAttributeValues selects a range of attributes from the given SelectAttributeValues(min float64...
pkg/recommender/attributes.go
0.627495
0.432543
attributes.go
starcoder
package cgen // File asm and the "asm" type provide a simple wrapper for generating // MIPS assembly. Many of the methods take an optional comment slice: // they only use the first element. They also attempt to return // correct write counts and errors from the underlying fmt.Fprintf // calls, in case anyone ever chec...
cgen/asm.go
0.649579
0.513729
asm.go
starcoder
package hll import ( "errors" "github.com/spaolacci/murmur3" "hash" "math" "math/bits" ) type HLL struct { numRegisterBits int registers []int murmur32 hash.Hash32 } // Returns new HLL instance configured to use the final 6 bits to denote the register (64 register total) func NewHLL() HLL { ret...
hll.go
0.708818
0.427636
hll.go
starcoder
package geo import ( "math" ) // A Polygon is carved out of a 2D plane by a set of (possibly disjoint) contours. // It can thus contain holes, and can be self-intersecting. type Polygon struct { points []*Point } // Creates and returns a new pointer to a Polygon // composed of the passed in points. Points are //...
polygon.go
0.811564
0.61682
polygon.go
starcoder
package main import ( "fmt" "image" "image/color" "image/png" "math" "os" ) type vector [3]float64 func (v *vector) normalize() { invLen := 1 / math.Sqrt(dot(v, v)) v[0] *= invLen v[1] *= invLen v[2] *= invLen } func dot(x, y *vector) float64 { return x[0]*y[0] + x[1]*y[1...
lang/Go/death-star.go
0.698844
0.457682
death-star.go
starcoder
package msgraph // OnPremisesPublishingType undocumented type OnPremisesPublishingType string const ( // OnPremisesPublishingTypeVAppProxy undocumented OnPremisesPublishingTypeVAppProxy OnPremisesPublishingType = "AppProxy" // OnPremisesPublishingTypeVExchangeOnline undocumented OnPremisesPublishingTypeVExchange...
beta/OnPremisesPublishingTypeEnum.go
0.553505
0.460895
OnPremisesPublishingTypeEnum.go
starcoder
package godouble //MockedMethodCall is a MethodCall that has pre-defined expectations for how often and sequence of invocations type MockedMethodCall interface { /* Matching is used to setup whether this call will match a given set of arguments. Empty matcherList list will fatally fail the test If th...
godouble/mock.go
0.774242
0.533519
mock.go
starcoder
package dtw import ( "math" ) type distanceFunction func(float64, float64) float64 type Dtw struct { m int n int distanceCostMatrix [][]float64 similarity float64 DistanceFunction distanceFunction } func distanceEuclidean(x float64, y float64) float64 { difference ...
dtw.go
0.750827
0.528898
dtw.go
starcoder
package quad import ( "github.com/ghthor/filu/rpg2d/coord" "github.com/ghthor/filu/rpg2d/entity" ) // A collision between 2 entities because the // entities bounds are overlapping. Intended to // be solved by the user defined NarrowPhaseHandler. type Collision struct { A, B entity.Entity } // A collision index st...
rpg2d/quad/collision.go
0.833833
0.533762
collision.go
starcoder
package main import ( "bufio" "fmt" "os" "strconv" "strings" ) func main() { origin := []int{} scanner := bufio.NewScanner(os.Stdin) // Read and process input from stdin for scanner.Scan() { for _, val := range strings.Split(scanner.Text(), ",") { num, _ := strc...
2019/day7.go
0.564819
0.441131
day7.go
starcoder
package ui import ( "fmt" "github.com/go-gl/gl/all-core/gl" "github.com/willauld/lpsimplex" ) // SpacingType represents what kind of spacing a row or column uses type SpacingType int const ( // Absolute means the spacing value is the exact number of pixels the row or column should be Absolute SpacingType = 0 ...
ui/TableLayout.go
0.778102
0.560253
TableLayout.go
starcoder
package ethabi import ( "fmt" "github.com/pkg/errors" "github.com/wavesplatform/gowaves/pkg/ride/meta" ) var UnsupportedType = errors.New("unsupported type") type ArgType byte // Type enumerator const ( IntType ArgType = iota UintType BytesType BoolType StringType SliceType TupleType AddressType //...
pkg/proto/ethabi/type.go
0.534127
0.405066
type.go
starcoder
package color import "math" // http://www.sjbrown.co.uk/2004/05/14/gamma-correct-rendering/ // http://www.brucelindbloom.com/Eqn_RGB_to_XYZ.html func linearize(v float64) float64 { if v <= 0.04045 { return v / 12.92 } return math.Pow((v+0.055)/1.055, 2.4) } // LinearRGB converts the color into the linear RGB s...
color/convert.go
0.893106
0.442335
convert.go
starcoder
package asterisk import ( "go/ast" "reflect" ) type ( BoolCondition func(bool) bool ChanDirCondition func(ast.ChanDir) bool ExprCondition func(ast.Expr) bool FilesMapCondition func(Files map[string]*ast.File) bool ImportsMapCondition func(map[string]*ast.Object) bool NodeCondition func(...
condition.go
0.680879
0.546496
condition.go
starcoder
package binaryTree const ( black = true red = false left = true ) type rbt struct { gbt } func (t *rbt) setColor(node *gbtElement, color bool) { node.SideValue = color } func (t *rbt) color(node *gbtElement) (black bool) { return t.IsNil(node) || node.SideValue.(bool) } func (t *rbt) otherSideNode(side bo...
tree/binaryTree/rbTree.go
0.646572
0.403567
rbTree.go
starcoder
package nn import ( "math" tsr "../tensor" ) // ActivationFunction represents a function used to activate neural network outputs. type ActivationFunction struct { Type ActivationType Function func(*tsr.Tensor) *tsr.Tensor Derivative func(*tsr.Tensor) *tsr.Tensor } // ActivationType is the identifying t...
nn/activation.go
0.810254
0.800809
activation.go
starcoder
package gfx import ( "github.com/brandonnelson3/GoRender/gfx/shaders" "github.com/go-gl/gl/v4.5-core/gl" "github.com/go-gl/mathgl/mgl32" ) // RenderablePortion allows rendering of a part of a vbo. type RenderablePortion struct { startIndex, numIndex int32 // TODO: This should be abstracted out to some form of "M...
gfx/renderable.go
0.519765
0.413773
renderable.go
starcoder
package matcher import ( "net" "strings" "github.com/gobwas/glob" ) // Matcher is a generic pattern matcher, // it gives the match result of the given pattern for specific v. type Matcher interface { Match(v string) bool } // NewMatcher creates a Matcher for the given pattern. // The acutal Matcher depends on t...
pkg/common/matcher/matcher.go
0.746971
0.413596
matcher.go
starcoder
package waves import "math" const c1 = 1.70158 const c2 = c1 * 1.525 const c3 = c1 + 1 const c4 = (2 * math.Pi) / 3 const c5 = (2 * math.Pi) / 4.5 // Given 0-1 return a scaling function type EaseFunc func(x float64) float64 // Registry of known scaling functions var EaseFunctions = map[string]EaseFunc{ "Linear": ...
pkg/waves/easing.go
0.757256
0.64124
easing.go
starcoder
package static const SwaggerJson = ` { "consumes": [ "application/json" ], "produces": [ "application/json" ], "schemes": [ "http", "https" ], "swagger": "2.0", "info": { "description": "The purpose of this application is to provide\nHoppity Hop manipulation REST API", "title": ...
src/hoppity/static/swagger_json.go
0.723505
0.484136
swagger_json.go
starcoder
package ui import ( "strconv" "github.com/RyoJerryYu/gogoengine/model" ) type boardRenderer func(uint32, uint32, model.Board) ([][]string, error) func (ui *userInterface) renderBoard( sizeX, sizeY uint32, board model.Board, ) ([][]string, error) { rendered := make([][]string, 0, sizeX) for x := uint32(0); x ...
ui/render_board.go
0.652241
0.407392
render_board.go
starcoder
package op import "fmt" // Encode encodes the instruction and returns a 16-bit representation of it. func Encode(inst interface{}) (buf uint16, err error) { switch v := inst.(type) { case *Nop: // op-code: 0 // operand: 000 case *LoadMem: // op-code: 1 // operand: RXY // R refers to the dst register....
archive/cs/risc/op/encode.go
0.66072
0.612078
encode.go
starcoder
// Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. // Package sortutil sorts and searches common slice types, and offers // helper functions for sorting floats with radixsort. package sortutil import ( "bytes" "github.com/twotwotwo/radixsort.test" "math" "sort...
sortutil/types.go
0.813201
0.576005
types.go
starcoder
package glm import "fmt" import "math" type Vector3 struct { X, Y, Z float32 } func (v *Vector3) Set(x, y, z float32) *Vector3 { v.X = x v.Y = y v.Z = z return v } func (v *Vector3) SetVector3(other *Vector3) *Vector3 { return v.Set(other.X, other.Y, other.Z) } func (v *Vector3) Add(x, y, z float32) *Vector...
glm/vec3.go
0.81409
0.691478
vec3.go
starcoder
package LeastSquareCircleFit /* This package implements a Circle Least Square Fit for a list of 2D-coordinates -> x1, x2, x3, x4, x5 ... x = y1, y2, y3, y4, y5 ... so that the resulting circle is a "best fit to the points given. The only exported function is CalcLeastSquareCircleFit which tak...
circlefit.go
0.852537
0.691881
circlefit.go
starcoder
package intervals import ( "fmt" "math" "sort" "strconv" "strings" "github.com/mmcloughlin/random" ) // Interval represents the inclusive range of integers [lo, hi]. type Interval struct { lo uint64 hi uint64 } // Range builds the interval [l, h]. func Range(l, h uint64) Interval { if h < l { panic("bad ...
internal/intervals/intervals.go
0.822937
0.475666
intervals.go
starcoder
package permutations import ( "fmt" ) // EnumerateInterval enumerate the integers in an intervall, s. sicp chapter 2.2.3 func EnumerateInterval(low, high int) []int { len := high - low + 1 res := make([]int, 0, len) for i := low; i <= high; i++ { res = append(res, i) } return res } // Faculty calculates the ...
permutations.go
0.677367
0.404684
permutations.go
starcoder
package nlp import ( "io" "math" "github.com/james-bowman/sparse" "gonum.org/v1/gonum/mat" ) // TfidfTransformer takes a raw term document matrix and weights each raw term frequency // value depending upon how commonly it occurs across all documents within the corpus. // For example a very commonly occurring wor...
weightings.go
0.762689
0.690813
weightings.go
starcoder
package fwncs import ( "net/http" "regexp" "strings" ) // Param is a single URL parameter, consisting of a key and a value. type Param struct { Key string Value string } // Params is a Param-slice, as returned by the router. // The slice is ordered, the first URL parameter is also the first slice value. // I...
tree.go
0.542136
0.423995
tree.go
starcoder
package extstr import ( "math/rand" "strconv" "strings" ) // Join concatenates the elements of its first argument to create a single string. The separator // string sep is placed between elements in the resulting string. func Join(elems []int64, sep string) string { switch len(elems) { case 0: return "" case ...
extstr/extstr.go
0.633864
0.436802
extstr.go
starcoder
package internal import ( "bytes" "encoding/json" "errors" "fmt" "math" "reflect" "sort" "github.com/lyraproj/dgo/dgo" "github.com/lyraproj/dgo/util" "gopkg.in/yaml.v3" ) type ( array struct { slice []dgo.Value typ dgo.ArrayType frozen bool } // defaultArrayType is the unconstrained array typ...
internal/array.go
0.718989
0.464537
array.go
starcoder
package set const WithParamFunctions = ` // Set:With[{{.TypeParameter}}] // FoldLeft{{.TypeParameter.LongName}} applies a binary operator to a start value and all elements of this set, going left to right. // Note: the result is well-defined only if the operator function is associative and commutative. func (set {{.T...
internal/set/withT.go
0.775945
0.706077
withT.go
starcoder
package assert import ( "testing" ) type Assert struct { t *testing.T } func New(t *testing.T) *Assert { return &Assert{t} } func (a *Assert) True(value bool) { True(a.t, value) } func (a *Assert) False(value bool) { False(a.t, value) } func (a *Assert) Nil(object interface{}) { Nil(a.t, object) } func (a ...
assert/assert.go
0.773302
0.567457
assert.go
starcoder
package projecteuler import "strings" // BigInt is a struct holding slice of digits in reversed order type BigInt struct { digits []byte } // MakeBigIntFromInt constructs BigInt out of int func MakeBigIntFromInt(input int) (result BigInt) { result.digits = make([]byte, 0) for i := 0; input > 0; i++ { result.di...
bigInt.go
0.734024
0.671248
bigInt.go
starcoder
package types import ( "sort" "github.com/liquidata-inc/dolt/go/store/d" ) func MakePrimitiveType(k NomsKind) (*Type, error) { switch k { case BoolKind: return BoolType, nil case FloatKind: return FloaTType, nil case UUIDKind: return UUIDType, nil case IntKind: return IntType, nil case UintKind: r...
go/store/types/make_type.go
0.604399
0.496521
make_type.go
starcoder
package lshIndex import "math" // Compute the integral of function f, lower limit a, upper limit l, and // precision defined as the quantize step func integral(f func(float64) float64, a, b, precision float64) float64 { var area float64 for x := a; x < b; x += precision { area += f(x+0.5*precision) * precision }...
src/lshIndex/probability.go
0.803906
0.649662
probability.go
starcoder
package pbf //go:generate stringer -type=ElementType import ( "fmt" "math" "strconv" "time" "github.com/golang/geo/s1" ) // Degrees is the decimal degree representation of a longitude or latitude. type Degrees float64 // Angle represents a 1D angle in radians. type Angle s1.Angle // Epsilon is an enumeratio...
models.go
0.804675
0.589687
models.go
starcoder
package fbmuck type array_iter inst type array_tree struct { left, right *array_tree key array_iter data interface{} height int } /* Primitives Package */ /* AVL binary tree code by Lynx (or his instructor) Modified for MUCK use by Sthiss Remodified by Revar */ /* ** This function compares two arrays in...
src/muck/array tree.go
0.599485
0.408513
array tree.go
starcoder
package kriging import ( "math" vec2d "github.com/flywave/go3d/float64/vec2" vec3d "github.com/flywave/go3d/float64/vec3" ) type Convex struct { vertices []vec3d.T hull []vec2d.T edges []Edge } type Edge struct { Start vec2d.T End vec2d.T Normal vec2d.T } func NewConvex(vertices []vec3d.T) *Con...
convex.go
0.784855
0.545407
convex.go
starcoder
package rootfinding import ( "math" ) // Brent - Brent's Method finds the root of the given quadratic function f in [a,b]. // The precision is the number of digits after the floating point. // reference: https://en.wikipedia.org/wiki/Brent%27s_method func Brent(f func(x float64) float64, a, b float64, precision int)...
brent.go
0.529993
0.551513
brent.go
starcoder
package parser import ( "github.com/bbuck/glox/token" "github.com/bbuck/glox/tree/expr" ) // P encapsulates the parsers current state allowing further calls to parse // to maintain positonal information within the token list. type P struct { tokens []*token.T current int Err error } // New constructs a new...
tree/parser/parser.go
0.61832
0.405449
parser.go
starcoder
package actions import ( "github.com/LindsayBradford/crem/internal/pkg/dataset/tables" "github.com/LindsayBradford/crem/internal/pkg/model/models/catchment/dataset" "github.com/LindsayBradford/crem/internal/pkg/model/models/catchment/parameters" "github.com/LindsayBradford/crem/internal/pkg/model/planningunit" as...
internal/pkg/model/models/catchment/actions/HillSlopeSedimentContribution.go
0.696578
0.401219
HillSlopeSedimentContribution.go
starcoder
package tracer import ( "github.com/eriklupander/pathtracer/internal/app/geom" "github.com/eriklupander/pathtracer/internal/app/shapes" ) func NewComputation() Computation { containers := make([]shapes.Shape, 8) containers = containers[:0] return Computation{ T: 0, Object: nil, Point: geo...
internal/app/tracer/computations.go
0.555918
0.50293
computations.go
starcoder
package geometry import "math" type Vector3 struct { X, Y, Z float64 } type Vector2 struct { X, Y float64 } func (a Vector2) Add(b Vector2) Vector2 { return Vector2{a.X + b.X, a.Y + b.Y} } func (a Vector2) DistanceSquared(b Vector2) float64 { return ((a.X - b.X) * (a.X - b.X)) + ((a.Y - b.Y) * (a.Y - b.Y)) } ...
internal/geometry/vector.go
0.927757
0.815233
vector.go
starcoder
package draw2d import ( "fmt" "math" ) // PathBuilder describes the interface for path drawing. type PathBuilder interface { // LastPoint returns the current point of the current sub path LastPoint() (x, y float64) // MoveTo creates a new subpath that start at the specified point MoveTo(x, y float64) // LineT...
vendor/github.com/llgcode/draw2d/path.go
0.723505
0.604895
path.go
starcoder
package go2d import ( "image" "os" "math" "github.com/tfriedel6/canvas" "github.com/tfriedel6/canvas/backend/softwarebackend" ) type ITexture interface { GetTexture() image.Image } type ImageEntity struct { Entity gImg image.Image cImg *canvas.Image } func NewImageEntity(im...
go2d/entity_image.go
0.765769
0.402275
entity_image.go
starcoder
package bls12381 import ( "errors" "math" "math/big" ) // PointG2 is type for point in G2. // PointG2 is both used for Affine and Jacobian point representation. // If z is equal to one the point is accounted as in affine form. type PointG2 [3]fe2 // Set copies valeus of one point to another. func (p *PointG2) Set...
g2.go
0.770724
0.547404
g2.go
starcoder
package cmd import ( "strconv" "strings" "github.com/pkg/errors" "github.com/ftl/si5351/pkg/si5351" ) func parseFrequency(f string) (si5351.Frequency, error) { input := strings.ToLower(strings.TrimSpace(f)) var magnitude si5351.Frequency switch { case strings.HasSuffix(input, "m"): magnitude = si5351.MHz ...
cmd/parse.go
0.570571
0.414662
parse.go
starcoder
package objects import ( "github.com/elainaaa/gosu-pp/beatmap/audio" "github.com/elainaaa/gosu-pp/beatmap/difficulty" "github.com/elainaaa/gosu-pp/beatmap/timing" "github.com/elainaaa/gosu-pp/math/vector" ) type IHitObject interface { Update(time float64) bool SetTiming(timings *timing.Timings) SetDifficulty(d...
beatmap/objects/hitobject.go
0.643329
0.411998
hitobject.go
starcoder
package id import "encoding/json" // DatasetID is an ID for Dataset. type DatasetID ID // NewDatasetID generates a new DatasetId. func NewDatasetID() DatasetID { return DatasetID(New()) } // DatasetIDFrom generates a new DatasetID from a string. func DatasetIDFrom(i string) (nid DatasetID, err error) { var did I...
pkg/id/dataset_gen.go
0.744285
0.480601
dataset_gen.go
starcoder
package unicornify import ( . "github.com/drbrain/go-unicornify/unicornify/core" "image" "image/color" "math" ) const ( CirclyGradient = iota DistanceGradient = iota ) type ColoringParameters struct { Shading float64 Gradient int } func DefaultGradientWithShading(shading float64) ColoringParameters { re...
unicornify/graphics.go
0.733356
0.45847
graphics.go
starcoder
package semver import ( "errors" "sort" "strconv" "strings" ) var ( // ErrEmpty means that given value is empty. ErrEmpty = errors.New("semver: empty string") // ErrEmptyElement means that some elements of version is empty. ErrEmptyElement = errors.New("semver: empty element") // ErrInvalidFormat means that ...
semver.go
0.565779
0.403244
semver.go
starcoder
package models import ( i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91 "github.com/microsoft/kiota-abstractions-go/serialization" ) // Profile type Profile struct { Entity // The account property account []UserAccountInformationable // Represents details of addresses associated...
models/profile.go
0.669745
0.437283
profile.go
starcoder
package geom // deriveCloneBounds returns a clone of the src parameter. func deriveCloneBounds(src *Bounds) *Bounds { if src == nil { return nil } dst := new(Bounds) deriveDeepCopy(dst, src) return dst } // deriveCloneCoord returns a clone of the src parameter. func deriveCloneCoord(src Coord) Coord { if src...
derived.gen.go
0.837021
0.454472
derived.gen.go
starcoder
package bayes // Highest probability interval for a discrete probability distribution. // Ref.: Albert (2009): 184 [mnormt.onesided()] import ( "sort" ) // cumSum returns cumulative sums of a slice. func cumSum(x []float64) []float64 { v := make([]float64, len(x)) for i, _ := range x { if i == 0 { v[i] = x[...
bayes/discint.go
0.778186
0.421314
discint.go
starcoder
package iso20022 // Account between an investor(s) and a fund manager or a fund. The account can contain holdings in any investment fund or investment fund class managed (or distributed) by the fund manager, within the same fund family. type InvestmentAccount14 struct { // Unique and unambiguous identification for t...
InvestmentAccount14.go
0.687735
0.447943
InvestmentAccount14.go
starcoder
package cenv import ( "os" "strconv" "strings" ) // Bool returns the boolean value from environment variable. // It accepts boolean string values from strconv.ParseBool. // Any other value returns an error. func Bool(keys ...string) (bool, error) { return strconv.ParseBool(get(keys)) } // Float32 returns the flo...
cenv.go
0.73412
0.454048
cenv.go
starcoder
package corde import ( "fmt" "time" ) // EmbedB is an Embed builder // https://regex101.com/r/gmVH2A/4 type EmbedB struct { embed Embed } // NewEmbed returns a new embed builder ready for use func NewEmbed() *EmbedB { return &EmbedB{ embed: Embed{ Title: "", Description: "", URL: "", ...
embed-builder.go
0.808446
0.457682
embed-builder.go
starcoder
package gofa // Fundamental Arguments (14) /* Fad03 mean elongation of the Moon from the Sun. Fundamental argument, IERS Conventions (2003) Given: t float64 TDB, Julian centuries since J2000.0 (Note 1) Returned (function value): float64 D, radians (Note 2) Notes: 1) Though t is strictly TDB,...
fundargs.go
0.923554
0.640074
fundargs.go
starcoder
package patience // DiffType defines the type of a diff element. type DiffType int8 const ( // Delete represents a diff delete operation. Delete DiffType = -1 // Insert represents a diff insert operation. Insert DiffType = 1 // Equal represents no diff. Equal DiffType = 0 ) // DiffLine represents a single line...
patience.go
0.814533
0.590838
patience.go
starcoder
package opc // Fire // Make a burning fire pattern. // This pattern is scaled to fit the layout from top to bottom (z). import ( "github.com/longears/pixelslinger/colorutils" "github.com/longears/pixelslinger/config" "github.com/longears/pixelslinger/midi" "math" "time" ) // this is used to cache some pe...
opc/pattern-fire.go
0.660391
0.515193
pattern-fire.go
starcoder
package copypasta import ( "math" "sort" ) /* 分块思想 Sqrt Decomposition 一种技巧:组合两种算法从而降低复杂度 O(n^2) -> O(n√n) 参考 Competitive Programmer’s Handbook Ch.27 题目花样很多,下面举个例子 有 n 个对象,每个对象有一个「关于其他对象的统计量」ci(一个数、一个集合的元素个数,等等) 为方便起见,假设 ∑ci 的数量级和 n 一样,下面用 n 表示 ∑ci 当 ci > √n 时,这样的对象不超过 √n 个,暴力枚举这些对象之间的关系(或者,该对象与其他所有对象的关系),时间复杂度为 O(...
copypasta/sqrt_decomposition.go
0.572723
0.437703
sqrt_decomposition.go
starcoder
package plandef import ( "fmt" "strings" ) // InferPO is an Operator that starts at the given object and transitively // follows predicate edges backwards to yield all reachable subjects. type InferPO struct { ID FreeTerm Subject FreeTerm Predicate FixedTerm Object FixedTerm } func (op *InferPO) a...
src/github.com/ebay/akutan/query/planner/plandef/lookups.go
0.767603
0.426859
lookups.go
starcoder
package gurvy import ( "crypto/rand" "crypto/sha256" "fmt" "io" "math/big" "regexp" "strings" "github.com/IBM/mathlib/driver" "github.com/IBM/mathlib/driver/common" "github.com/consensys/gnark-crypto/ecc/bn254" "github.com/consensys/gnark-crypto/ecc/bn254/fr" ) /*******************************************...
vendor/github.com/IBM/mathlib/driver/gurvy/bn254.go
0.656768
0.433322
bn254.go
starcoder
package main import ( "math" "math/rand" "github.com/unixpickle/model3d/model3d" ) const ( BaseWidth = 2.5 BaseLength = 6.0 BaseHeight = 1.0 BaseChunkSize = 0.2 ) func GenerateBase() model3d.Solid { extra := model3d.Coord3D{X: 1, Y: 1}.Scale(BaseChunkSize) return model3d.IntersectedSolid{ &mode...
examples/parody/flag_statue/base.go
0.666388
0.44565
base.go
starcoder
package camt import ( "encoding/xml" "github.com/figassis/bankiso/iso20022" ) type Document02900101 struct { XMLName xml.Name `xml:"urn:iso:std:iso:20022:tech:xsd:camt.029.001.01 Document"` Message *ResolutionOfInvestigation `xml:"camt.029.001.01"` } func (d *Document02900101) AddMessage() *Re...
generate/iso20022/camt/ResolutionOfInvestigation.go
0.758063
0.499756
ResolutionOfInvestigation.go
starcoder
package dataplane import ( "strings" "github.com/submariner-io/submariner/test/e2e/framework" . "github.com/onsi/ginkgo" . "github.com/onsi/gomega" ) var _ = Describe("[dataplane] Basic TCP connectivity tests across clusters without discovery", func() { f := framework.NewDefaultFramework("dataplane-conn-nd") ...
test/e2e/dataplane/tcp_pod_connectivity.go
0.570571
0.547404
tcp_pod_connectivity.go
starcoder
package pastry import ( "encoding/binary" "encoding/hex" "encoding/json" "errors" "fmt" "math" "math/big" ) const idLen = 32 // NodeID is a unique address for a node in the network. type NodeID [2]uint64 // NodeIDFromBytes creates a NodeID from an array of bytes. // It returns the created NodeID, trimmed to ...
nodeid.go
0.622574
0.537163
nodeid.go
starcoder
// Format for specifying a rectangle: // (x1, x2, y1, y2) where x1 is the min and x2 is the max y coordinate. // Similarly for y // Format for specifying a line: // (a, b) where a is a number and b is a binary number where // 0 -> || to Y axis AND 1 -> || to X axis // Format for specifying an interval: // (a1, a2) ...
main.go
0.622115
0.482307
main.go
starcoder
package data // Data contains a single set of data most likely imported from tsm. type Data struct { raw []float64 `` // raw values gap float64 `` // gap in % between bar chart values Max float64 `json:"fmax"` // max raw value NMax int `json:"max"` // max normali...
data/data.go
0.854521
0.680658
data.go
starcoder
package schema import ( "fmt" "testing" "github.com/danos/encoding/rfc7951" "github.com/danos/mgmterror" yang "github.com/danos/yang/schema" ) // TestLog provides the ability for tests to verify which components had // which operations performed on them (validate, set config, get config, get // state), and in ...
schema/compmgrtest.go
0.615203
0.40698
compmgrtest.go
starcoder
package math import ( "context" "fmt" "math" "github.com/influxdata/flux" "github.com/influxdata/flux/codes" "github.com/influxdata/flux/internal/errors" "github.com/influxdata/flux/semantic" "github.com/influxdata/flux/values" ) var SpecialFns map[string]values.Function func generateMathFunctionX(name stri...
stdlib/math/math.go
0.581541
0.498169
math.go
starcoder
package rti import ( "encoding/binary" "math" ) // AncillaryDataSet will contain all the Ancillary Data set values. // These values describe ensemble with float values. type AncillaryDataSet struct { Base BaseDataSet // Base Dataset FirstBinRange float32 // First bin location in meters BinSize ...
AncillaryDataSet.go
0.505859
0.541591
AncillaryDataSet.go
starcoder
package secp256k1go import ( "encoding/hex" "math/big" ) // Field represents the signature field type Field struct { n [10]uint32 } // String returns the hex string of the field func (fd *Field) String() string { var tmp [32]byte b := *fd b.Normalize() b.GetB32(tmp[:]) return hex.EncodeToString(tmp[:]) } //...
vendor/github.com/skycoin/skycoin/src/cipher/secp256k1-go/secp256k1-go2/field.go
0.577376
0.402656
field.go
starcoder
package packet import ( "github.com/sandertv/gophertunnel/minecraft/protocol" ) // LevelEventGeneric is sent by the server to send a 'generic' level event to the client. This packet sends an // NBT serialised object and may for that reason be used for any event holding additional data. type LevelEventGeneric struct ...
minecraft/protocol/packet/level_event_generic.go
0.524151
0.442817
level_event_generic.go
starcoder
package expvar import ( "expvar" "sync" "github.com/jjggzz/kit/metrics" "github.com/jjggzz/kit/metrics/generic" ) // Counter implements the counter metric with an expvar float. // Label values are not supported. type Counter struct { f *expvar.Float } // NewCounter creates an expvar Float with the given name, ...
metrics/expvar/expvar.go
0.840652
0.418697
expvar.go
starcoder
package v1alpha1 import ( v1alpha1 "kubeform.dev/kubeform/apis/google/v1alpha1" "k8s.io/apimachinery/pkg/api/errors" "k8s.io/apimachinery/pkg/labels" "k8s.io/client-go/tools/cache" ) // DataflowJobLister helps list DataflowJobs. type DataflowJobLister interface { // List lists all DataflowJobs in the indexer. ...
client/listers/google/v1alpha1/dataflowjob.go
0.613005
0.431944
dataflowjob.go
starcoder
package iterator import ( "fmt" "github.com/marcsantiago/collections" ) type _direction uint8 const ( _notSet _direction = iota _forward _backwards ) type Iter struct { currentIdx int values []collections.Data direction _direction shouldCycle bool } var _ IterTraitSlice = (*Iter)(nil) func NewIt...
slice_iter.go
0.775095
0.511961
slice_iter.go
starcoder
package packed // Efficient sequential read/write of packed integers. type BulkOperationPacked20 struct { *BulkOperationPacked } func newBulkOperationPacked20() BulkOperation { return &BulkOperationPacked20{newBulkOperationPacked(20)} } func (op *BulkOperationPacked20) decodeLongToInt(blocks []int64, values [...
vendor/github.com/balzaczyy/golucene/core/util/packed/bulkOperation20.go
0.563858
0.721154
bulkOperation20.go
starcoder
package DG1D import ( "math" "github.com/notargets/gocfd/utils" ) func (el Elements1D) SlopeLimitN(U utils.Matrix, M float64) (ULim utils.Matrix) { var ( Uh = el.Vinv.Mul(U) eps0 = 1.0e-8 nr, _ = U.Dims() ) Uh.SetRange(1, -1, 0, -1, 0) Uh = el.V.Mul(Uh) vk := Uh.Row(0) // End values of each elemen...
DG1D/operators.go
0.517815
0.524638
operators.go
starcoder
package vector import ( "bytes" "math" "strconv" ) const ( zero = 1.0e-7 // zero tolerance ) type Vector interface { String() string Eq(other Vector) bool Add(other Vector) Vector Sub(other Vector) Vector Scale(factor float64) DotProd(other Vector) float64 Angle(other Vector) float64 Mag() float64 Unit(...
ch12/vector/vec.go
0.896388
0.685989
vec.go
starcoder
package common import ( "math" "math/rand" ) // Distribution provides an interface to model a statistical distribution. type Distribution interface { Advance() Get() float64 // should be idempotent } // NormalDistribution models a normal distribution (stateless). type NormalDistribution struct { Mean float64 ...
pkg/data/usecases/common/distribution.go
0.914654
0.667723
distribution.go
starcoder
package hashdict import ( "fmt" "github.com/peterzeller/go-fun/dict" "github.com/peterzeller/go-fun/equality" "github.com/peterzeller/go-fun/hash" "github.com/peterzeller/go-fun/iterable" "github.com/peterzeller/go-fun/zero" ) // adapted from https://github.com/andrewoma/dexx/blob/master/collection/src/main/ja...
dict/hashdict/dict.go
0.778818
0.408336
dict.go
starcoder
package selector import ( "bytes" "path/filepath" "regexp" "github.com/CanalTP/mq/stomp/selector/parse" ) // state represents the state of an execution. It's not part of the // statement so that multiple executions of the same statement // can execute in parallel. type state struct { node parse.Node vars Row }...
stomp/selector/eval.go
0.666388
0.544075
eval.go
starcoder
package bitset import ( "strconv" "strings" ) // A set256 represents a set of integers in the range [0, 256). // It does so more efficiently than a Dense set of capacity 256. // For efficiency, the methods of set256 perform no bounds checking on their // arguments. type set256 struct { sets [4]Set64 } func (s *se...
set256.go
0.742795
0.5144
set256.go
starcoder
package example import ( "log" "time" ) type SubTest struct { HTTPAddress string `xconf:"http_address"` MapNotLeaf map[string]int `xconf:"map_not_leaf,notleaf"` Map2 map[string]int `xconf:"map2"` Map3 map[string]int `xconf:"map3"` Slice2 []int64 `xconf:"slice2"` } // Google ...
example/config.go
0.604632
0.463444
config.go
starcoder
package main type recommend struct { Risk string `json:"risk,omitempty"` Recommendation string `json:"recommendation,omitempty"` } type pluginMetaData struct { Score float32 Recommend recommend Tag []string } // pluginMap maps cloudsploit plugin meta data. // key: `{Categor}/{Plugin}`, value...
src/cloudsploit/plugin.go
0.704872
0.546678
plugin.go
starcoder
package vmath import ( "math" "github.com/maja42/vmath/math32" ) // Epsilon is the default epsilon value for float comparisons. const Epsilon = 1.0E-6 // Equalf compares two floats for equality. // Uses the default Epsilon as relative tolerance. func Equalf(a, b float32) bool { // Comparing floats is complicated...
utils.go
0.955152
0.68433
utils.go
starcoder
package util import ( "golang.org/x/image/colornames" "github.com/faiface/pixel" "github.com/faiface/pixel/imdraw" "github.com/hueypark/physics/core" "github.com/hueypark/physics/core/contact" "github.com/hueypark/physics/core/math/rotator" "github.com/hueypark/physics/core/math/vector" "github.com/hueypark/...
examples/util/util.go
0.697712
0.403097
util.go
starcoder
package models // This is the output of this board: Kubernetes / Compute Resources / Nodes, which comes as part of // prometheus operator install & // $datasource template variable replaced with "prometheus" & // $cluster template variable replaced with "" const staticBoardNodes = ` [[ $indexCheck := .indexCheck ]] { ...
models/prometheus_per_node_config.go
0.591959
0.42931
prometheus_per_node_config.go
starcoder
package layer import ( "fmt" "github.com/aunum/log" g "gorgonia.org/gorgonia" t "gorgonia.org/tensor" ) // FC is a fully connected layer of neurons. type FC struct { // Input is the number of units in input. // required Input int // Output is the number of units in the output. // required Output int //...
vendor/github.com/aunum/goro/pkg/v1/layer/fc.go
0.680135
0.483405
fc.go
starcoder
package core import "fmt" type Rect struct { X int Y int Width int Height int } func NewRect(x int, y int, width int, height int) (rcvr *Rect) { rcvr = &Rect{} rcvr.X = x rcvr.Y = y rcvr.Width = width rcvr.Height = height return } func NewRect2() (rcvr *Rect) { rcvr = NewRect(0, 0, 0, 0) retur...
opencv3/core/Rect.java.go
0.582491
0.561335
Rect.java.go
starcoder
package shim //we provide a unify interface for stubs interface provided from different fabric implement //(ya-fabric, 0.6, 1.x, etc) which is mainly a partial stack from shim interface of 0.6 import ( "time" ) // Chaincode interface purposed to be implemented by all chaincodes. The fabric runs // the transactions ...
chaincode/shim/interface.go
0.664649
0.453322
interface.go
starcoder