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 goja import ( "math" ) //Math.abs(x) //返回一个数的绝对值。 func (r *Runtime) math_abs(call FunctionCall) Value { return floatToValue(math.Abs(call.Argument(0).ToFloat())) } //Math.acos(x) //返回一个数的反余弦值。 func (r *Runtime) math_acos(call FunctionCall) Value { return floatToValue(math.Acos(call.Argument(0).ToFloat())) }...
builtin_math.go
0.547948
0.583678
builtin_math.go
starcoder
package wotoCrypto import ( "crypto/aes" "strings" ) // GenerateFutureKey is supposed to generate a new future key by using // the specified paskey's algorithm. func GenerateFutureKey(pastKey WotoKey) WotoKey { return &futureKey{ algorithm: pastKey.GetAlgorithm(), } } func GeneratePresentKey(algo WotoAlgorith...
wotoCrypto/helpers.go
0.745213
0.402686
helpers.go
starcoder
package semantic import ( "fmt" "github.com/influxdata/flux/ast" ) // ToAST will construct an AST from the semantic graph. // The AST will not be preserved when going from // AST -> semantic -> AST, but going from // semantic -> AST -> semantic should result in the same graph. func ToAST(n Node) ast.Node { switch...
semantic/ast.go
0.506591
0.568416
ast.go
starcoder
package dfs import ( "bytes" "fmt" ) func CircleDetect(m map[string]string) error { g := NewGraph(m) g.dfsAll() if circles := g.Circles(); len(circles) > 0 { return fmt.Errorf("circled on %v", g.Circles()) } return nil } // the search path begin from a node, util END or CIRCLED // 1. searched path // 2. if ...
dfs-find-circle/dfs-find-circle.go
0.503906
0.409221
dfs-find-circle.go
starcoder
package gohome import ( "github.com/PucklaMotzer09/mathgl/mgl32" "image/color" ) // The color in which the shapes will be drawn var DrawColor color.Color = Color{255, 255, 255, 255} // The point size which will be used var PointSize float32 = 1.0 // The line width which will be used var LineWidth float32 = 1.0 // W...
src/gohome/drawfunctions.go
0.721841
0.436442
drawfunctions.go
starcoder
package math import ( "container/heap" "github.com/ava-labs/avalanchego/ids" ) var ( _ AveragerHeap = averagerHeap{} _ heap.Interface = &averagerHeapBackend{} ) // AveragerHeap maintains a heap of the averagers. type AveragerHeap interface { // Add the average to the heap. If [nodeID] is already in the heap...
utils/math/averager_heap.go
0.662906
0.479808
averager_heap.go
starcoder
package prque import ( "container/heap" "time" "github.com/entropyio/go-entropy/common/timeutil" ) // LazyQueue is a priority queue data structure where priorities can change over // time and are only evaluated on demand. // Two callbacks are required: // - priority evaluates the actual priority of an item // - m...
common/prque/lazyqueue.go
0.693369
0.400896
lazyqueue.go
starcoder
// Package fifo models the First-In-First-Out position management // to calculate results of algorithmic trading by trade signals, // given that returns are not reinvested and positions are not rebalanced. package fifo // Asset for the results of simulated trading type Asset struct { // Bar ID, e.g. date/time stam...
fifo/fifo.go
0.559771
0.47384
fifo.go
starcoder
package kal import ( "errors" "time" ) // Calendar provides a common interface for calendars of all languages // and locales type Calendar interface { DayName(time.Weekday) string RedDay(time.Time) (bool, string, bool) NotableDay(time.Time) (bool, string, bool) NormalDay() string NotablePeriod(time.Time) (bool...
calendar.go
0.70304
0.459137
calendar.go
starcoder
package iso20022 // Specifies the balance adjustments for a specific service. type BalanceAdjustment1 struct { // Identifies the type of adjustment. Type *BalanceAdjustmentType1Code `xml:"Tp"` // Free-form description and clarification of the adjustment. Description *Max105Text `xml:"Desc"` // Amount of the ad...
BalanceAdjustment1.go
0.828939
0.4953
BalanceAdjustment1.go
starcoder
package bitmap import ( "image" "github.com/pzduniak/unipdf/common" ) // CombineBytes combines the provided bytes with respect to the CombinationOperator. func CombineBytes(oldByte, newByte byte, op CombinationOperator) byte { return combineBytes(oldByte, newByte, op) } // Extract extracts the rectangle of given...
bot/vendor/github.com/pzduniak/unipdf/internal/jbig2/bitmap/combine.go
0.652463
0.413714
combine.go
starcoder
package api import "fmt" // Equalizer represents an equalizer. A list of possible equalizers are // available when requesting product info. type Equalizer int // Equalizer enums. // {"data": {"type": 0, "value": 12}, "msg": "EQ_SETTING"} const ( EqualizerStandard Equalizer = 0 EqualizerBass Equalizer...
api/enum.go
0.644561
0.499084
enum.go
starcoder
package rogue import ( "fmt" "math" "math/rand" ) // Point ... type Point struct { X float64 Y float64 } func (p Point) String() string { return fmt.Sprintf("%f,%f", p.X, p.Y) } // Equals returns true of p and p2 has the same coordinates func (p Point) Equals(p2 Point) bool { if p.X == p2.X && p.Y == p2.Y {...
point.go
0.78502
0.462291
point.go
starcoder
package evaluator import ( "fmt" "github.com/raa0121/GoBCDice/pkg/core/ast" ) // DetermneValuesは、可変ノードの値を決定する func (e *Evaluator) DetermineValues(node ast.Node) error { switch n := node.(type) { case *ast.Command: return e.determineValuesInCommand(n) case ast.PrefixExpression: return e.determineValuesInPrefi...
pkg/core/evaluator/determine_values.go
0.653238
0.42471
determine_values.go
starcoder
package mlpack /* #cgo CFLAGS: -I./capi -Wall #cgo LDFLAGS: -L. -lmlpack_go_sparse_coding #include <capi/sparse_coding.h> #include <stdlib.h> */ import "C" import "gonum.org/v1/gonum/mat" type SparseCodingOptionalParam struct { Atoms int InitialDictionary *mat.Dense InputModel *sparseCoding Lambda1...
sparse_coding.go
0.718693
0.573977
sparse_coding.go
starcoder
package blob // Blob is a binary blob of data that can support platform-optimized mutations for better performance. type Blob interface { // Bytes returns the byte slice equivalent to the data in this Blob. Bytes() []byte // Len returns the number of bytes contained in this blob. // Can be used to avoid unnecessar...
keyvalue/blob/blob.go
0.865722
0.597608
blob.go
starcoder
package encoding import ( "encoding" "encoding/json" "fmt" "reflect" "strconv" ) func decodeToType(typ reflect.Kind, value string) interface{} { switch typ { case reflect.String: return value case reflect.Bool: v, _ := strconv.ParseBool(value) return v case reflect.Int: v, _ := strconv.ParseInt(value...
vendor/github.com/TheThingsNetwork/go-utils/encoding/decode.go
0.586878
0.466785
decode.go
starcoder
package nifi import ( "encoding/json" ) // ComponentDifferenceDTO struct for ComponentDifferenceDTO type ComponentDifferenceDTO struct { // The type of component ComponentType *string `json:"componentType,omitempty"` // The ID of the component ComponentId *string `json:"componentId,omitempty"` // The name of t...
model_component_difference_dto.go
0.732974
0.40116
model_component_difference_dto.go
starcoder
package bst import ( "errors" "fmt" "../queue" ) // 在我们的实现中,二叉搜索树是不包含重复元素的 // 没想到,用了递归,竟如此简单 type BST struct { root *Node size int } func New() *BST { return &BST{root: nil, size: 0,} } func (this *BST) GetSize() int { return this.size } func (this *BST) IsEmpty() bool { return this.size == 0 } func (this...
go/bst/bst.go
0.523177
0.496155
bst.go
starcoder
package convolve import ( "errors" ) // Slice32 convolves given kernel with given source slice, putting results in // destination, which is ensured to be the same size as the source slice, // using existing capacity if available, and otherwise making a new slice. // The kernel should be normalized, and odd-sized do...
convolve/convolve.go
0.73659
0.411347
convolve.go
starcoder
package awsutil import ( "io/ioutil" "net" "os" "strings" "time" ) // ComputeType is an enum for different compute types type ComputeType int const ( // ComputeUnknown is when the compute type could not be identified ComputeUnknown ComputeType = iota // ComputeEC2 is running in an EC2 instance ComputeEC2 /...
aws/awsutil/detector.go
0.683525
0.40592
detector.go
starcoder
package codewords var nouns = []string{ "aachen", "aalborg", "aalii", "aalst", "aalto", "aardvark", "aardwolf", "aare", "aarhus", "aaron", "aarp", "aave", "abaca", "abacus", "abadan", "abalone", "abamp", "abampere", "abandon", "abandonmen...
nouns.go
0.510496
0.467757
nouns.go
starcoder
package forGraphBLASGo import "github.com/intel/forGoParallel/pipeline" type matrixSelect[D, Ds any] struct { op IndexUnaryOp[bool, D, Ds] A *matrixReference[D] value Ds } func newMatrixSelect[D, Ds any](op IndexUnaryOp[bool, D, Ds], A *matrixReference[D], value Ds) computeMatrixT[D] { return matrixSelect...
functional_Matrix_ComputedSelect.go
0.663996
0.593167
functional_Matrix_ComputedSelect.go
starcoder
package orientation import ( "math" "math/rand" "time" ) // Quaternion represents q = w + Xi + Yj + Zk type Quaternion struct { W float64 // cos(theta/2) X float64 // vx Y float64 // vy Z float64 // vz } // Norm returns the norm of the quaternion func (q *Quaternion) Norm() float64 { return math.Sqrt(q.W*q....
orientation/quaternion.go
0.866979
0.646655
quaternion.go
starcoder
package bring import ( "image" "image/draw" "github.com/tfriedel6/canvas" "github.com/tfriedel6/canvas/backend/softwarebackend" ) type layer struct { width int height int image *image.RGBA gc *canvas.Canvas visible bool modified bool modifiedRect image.Rectangle pat...
layer.go
0.619932
0.490602
layer.go
starcoder
package geo import ( "github.com/golang/geo/s2" ) // LoopIntersectionWithCell returns sub-loops which contain // the intersection areas between the loop and a cell. func LoopIntersectionWithCell(loop *s2.Loop, cell s2.Cell) []*s2.Loop { if wrap := s2.LoopFromCell(cell); loop.ContainsCell(cell) { return []*s2.Loo...
geo/loop.go
0.684475
0.553747
loop.go
starcoder
package statext import ( "gonum.org/v1/gonum/mathext" "math" ) const ( maxDepth = 50 // Integrate to at most this depth (should never be reached) minDepth = 2 // Integrate to at least this depth ) // dirichletWinnerAdaptiveQuadFunc is the function to integrate for the // dirichlet winner probs. // Works in-plac...
dirichletwinner.go
0.601359
0.440048
dirichletwinner.go
starcoder
package exported import ( "fmt" ics23 "github.com/confio/ics23/go" "github.com/cosmos/iavl" ) // IavlSpec constrains the format from ics23-iavl (iavl merkle ics23) var IavlSpec = &ics23.ProofSpec{ LeafSpec: &ics23.LeafOp{ Prefix: []byte{0}, Hash: ics23.HashOp_SHA256, PrehashValue: ics23.HashO...
x/anconprotocol/exported/create_iavl_proof.go
0.554229
0.408749
create_iavl_proof.go
starcoder
package value import ( "errors" "fmt" ) // An environment maintains a set of bindings that are typically // referenced when evaluating a Lisp expression. type Environment interface { Value // Returns the list of defined symbols. Names() []string // Lookup the value of a symbol. Lookup(name string) (Value, bool...
value/env.go
0.770465
0.459622
env.go
starcoder
package tfbparser import ( "strconv" "strings" "github.com/PRETgroup/goFB/iec61499" ) //parseHFBarchitecture shall only be called once we have already parsed the // "architecture of [blockname]" part of the definition // so, we are up to the brace func (t *tfbParse) parseHFBarchitecture(fbIndex int) *ParseError {...
goTFB/tfbparser/parseHFBarchitecture.go
0.560854
0.466177
parseHFBarchitecture.go
starcoder
package sudogo // A cell holds a value or possible values in a Sudoku puzzle. type Cell struct { // The Value in the cell or 0 if a no Value exists yet. Value int // The unique Id of the cell. This is also the index of this cell in the puzzle's cells slice. Id int // The zero-based Row this cell is in. Row int ...
pkg/cell.go
0.781706
0.707291
cell.go
starcoder
package parser import ( "github.com/kasperisager/pak/pkg/asset/html/ast" "github.com/kasperisager/pak/pkg/asset/html/token" ) type SyntaxError struct { Offset int Message string } func (err SyntaxError) Error() string { return err.Message } func Parse(tokens []token.Token) (*ast.Document, error) { offset, to...
pkg/asset/html/parser/parse.go
0.6705
0.463809
parse.go
starcoder
package bstree import ( "fmt" "godev/basic" ) // BSTree Binary Search Tree // http://cslibrary.stanford.edu/110/BinaryTrees.html type BSTree struct { Root *Node Comparator basic.Comparator Diffidence func(a, b interface{}) interface{} } // NewBSTree create a nil BSTree func NewBSTree() *BSTree { return &...
basic/datastructure/tree/bstree/bstree.go
0.823044
0.50061
bstree.go
starcoder
package taskmaster import ( "strconv" "strings" "syscall" "time" "github.com/go-ole/go-ole" "github.com/rickb777/date/period" ) // DayOfWeek is a day of the week. type DayOfWeek uint16 const ( Sunday DayOfWeek = 1 << iota Monday Tuesday Wednesday Thursday Friday Saturday AllDays DayOfWeek = (1 << 7) ...
types.go
0.53048
0.406509
types.go
starcoder
package lexer import ( "github.com/yourfavoritedev/golang-interpreter/token" ) // Lexer converts a string input to produce tokens for the Monkey language. // It always keeps track of the current position, the next readable position and // the current character under examination. These tokens will be parsed by // the...
lexer/lexer.go
0.661048
0.459864
lexer.go
starcoder
package geomtest import ( "fmt" "reflect" "github.com/adamcolton/geom/calc/cmpr" "github.com/adamcolton/geom/geomerr" "github.com/stretchr/testify/assert" ) type tHelper interface { Helper() } // Equal calls AssertEqual with the default value of Small. If there is an error // it is passed into t.Error. The re...
geomtest/equal.go
0.73914
0.5564
equal.go
starcoder
package info import ( "fmt" "regexp" "strings" ) // ignore line contains: // wp-admin // DateRegex is a regex that catches the date from the log var DateRegex *regexp.Regexp func init() { DateRegex = regexp.MustCompile(`\[.* [+-][0-9]*\]`) } // Info represents an entire log entry type Info struct { IP ...
pkg/info/info.go
0.606615
0.421076
info.go
starcoder
package main import ( "bytes" "encoding/gob" "fmt" "math" "sort" "time" ) type BufferedStats struct { FlushIntervalMS int Counts map[string]float64 Gauges map[string]float64 Sets map[string]map[float64]struct{} Timers map[string][]float64 // When clear_stats_between_...
bufferedstats.go
0.594787
0.443841
bufferedstats.go
starcoder
package twistededwards import ( "math/big" "github.com/consensys/gnark/frontend" ) // Point point on a twisted Edwards curve in a Snark cs type Point struct { X, Y frontend.Variable } // Neg computes the negative of a point in SNARK coordinates func (p *Point) Neg(api frontend.API, p1 *Point) *Point { p.X = api...
std/algebra/twistededwards/point.go
0.84137
0.446555
point.go
starcoder
package aggregaterange import ( "github.com/pkg/errors" "math/big" "sync" "github.com/incognitochain/incognito-chain/common" "github.com/incognitochain/incognito-chain/privacy" ) // This protocol proves in zero-knowledge that a list of committed values falls in [0, 2^64) type AggregatedRangeWitness struct { v...
privacy/zeroknowledge/aggregaterange/aggregaterange.go
0.560373
0.444806
aggregaterange.go
starcoder
package big import ( "sort" ) // StringSlice attaches the methods of RadixSortable to []string, sorting in increasing order. type StringSlice []string func (p StringSlice) Len() int { return len(p) } func (p StringSlice) Less(i, j int) bool { return p[i] < p[j] } func (p StringSlice) Swap(i, j int) {...
src/big/bigsort.go
0.609873
0.450359
bigsort.go
starcoder
import ( "github.com/kaitai-io/kaitai_struct_go_runtime/kaitai" "bytes" ) /** * BSON, short for Binary JSON, is a binary-encoded serialization of JSON-like documents. Like JSON, BSON supports the embedding of documents and arrays within other documents and arrays. BSON also contains extensions that allow represen...
bson/src/go/bson.go
0.716814
0.567038
bson.go
starcoder
package dsu type node struct { value interface{} parent *node size int } // DSU is the type used to the Disjoint Set data structure. // it maps from a value to a node pointer corresponding to the element in the set. type DSU struct { nodes map[interface{}]*node } // New returns a pointer to an empty initiali...
dsu.go
0.817938
0.494568
dsu.go
starcoder
package common import ( "math" "math/rand" "strconv" "strings" "time" ) func init() { rand.Seed(time.Now().UnixNano()) } // Calculate seconds of one day func GetOneDaySeconds(convertDate string) int64 { dd, _ := time.Parse("20060102", convertDate) return dd.Unix() } func GetRandNumber(avgNum float64, randSe...
common.go
0.521227
0.443058
common.go
starcoder
package unit import "github.com/chippydip/go-sc2ai/api" func String(e api.UnitTypeID) string { return strings[uint32(e)] } var strings = map[uint32]string{ 0: "Invalid", 197: "Neutral_AberrationACGluescreenDummy", 1990: "Neutral_AccelerationZoneFlyingLarge", 1989: "Neutral_AccelerationZoneFlyingMedium", 19...
enums/unit/strings.go
0.522202
0.412294
strings.go
starcoder
package simple import "honnef.co/go/tools/analysis/lint" var Docs = map[string]*lint.Documentation{ "S1000": { Title: `Use plain channel send or receive instead of single-case select`, Text: `Select statements with a single case can be replaced with a simple send or receive. Before: select { case x := ...
simple/doc.go
0.738292
0.608885
doc.go
starcoder
package levels import ( "math" mgl "github.com/go-gl/mathgl/mgl32" ) // LimitedCamera is a camera implementation with ranged controls for zooming and moving. type LimitedCamera struct { viewportWidth, viewportHeight float32 minZoom, maxZoom float32 minPos, maxPos float32 requestedZ...
editor/levels/LimitedCamera.go
0.881092
0.481332
LimitedCamera.go
starcoder
package filter import ( "io" "regexp" ) // A Filter contains a list of regular expressions matching pathnames which // should be filtered out: excluded when building or not changed when pushing // images to a sub. // A Filter with no lines is an empty filter (nothing is excluded, everything is // changed when pushi...
lib/filter/api.go
0.809163
0.458712
api.go
starcoder
package hbook import "math" // dist0D is a 0-dim distribution. type dist0D struct { n int64 // number of entries sumW float64 // sum of weights sumW2 float64 // sum of squared weights } // Rank returns the number of dimensions of the distribution. func (*dist0D) Rank() int { return 1 } // Entries return...
hbook/dist.go
0.80969
0.658795
dist.go
starcoder
package config const ( PartIdentifier = "id" PartValue = "value" ) // Sources, // gitrob: https://github.com/michenriksen/gitrob/blob/master/core/signatures.go // shhgit: https://github.com/eth0izzle/shhgit/blob/046cf0b704291aafba97d1feff19fe57e5e09152/config.yaml var SecretMatchers = []map[string]string{ { ...
pkg/kev/config/secrets.go
0.68763
0.452113
secrets.go
starcoder
package mathx import "math" // Min returns the minimum value in the list of values [a, rest...] // If rest is empty, the result is a. func Min(a float64, rest ...float64) float64 { var min = a for _, v := range rest { switch { case math.IsNaN(v), math.IsInf(v, -1): return v default: min = math.Min(min, ...
cmp.go
0.802362
0.568536
cmp.go
starcoder
package main import ( "fmt" "math" "sort" "time" ) // Stat represents one statistical measurement. type Stat struct { Label []byte Value float64 } // Init safely initializes a stat while minimizing heap allocations. func (s *Stat) Init(label []byte, value float64) { s.Label = s.Label[:0] // clear s.Label = a...
cmd/bulk_load_influx/stats.go
0.682362
0.523603
stats.go
starcoder
package framework import ( "github.com/onsi/gomega" ) // ExpectEqual expects the specified two are the same, otherwise an exception raises func ExpectEqual(actual interface{}, extra interface{}, explain ...interface{}) { gomega.ExpectWithOffset(1, actual).To(gomega.Equal(extra), explain...) } // ExpectNotEqual exp...
test/e2e/framework/expect.go
0.727201
0.612455
expect.go
starcoder
package game import ( "math" "github.com/go-gl/mathgl/mgl32" "github.com/samuelyuan/openbiohazard2/fileio" "github.com/samuelyuan/openbiohazard2/world" ) const ( PLAYER_FORWARD_SPEED = 4000 PLAYER_BACKWARD_SPEED = 1000 ) type Player struct { Position mgl32.Vec3 RotationAngle float32 PoseNumber int...
game/player.go
0.772273
0.469642
player.go
starcoder
package storetest import ( "sort" "testing" "github.com/stretchr/testify/require" "github.com/zacmm/zacmm-server/model" "github.com/zacmm/zacmm-server/store" "github.com/stretchr/testify/assert" ) func TestPluginStore(t *testing.T, ss store.Store, s SqlSupplier) { t.Run("SaveOrUpdate", func(t *testing.T) { ...
store/storetest/plugin_store.go
0.592431
0.434641
plugin_store.go
starcoder
package restructure import ( "fmt" "reflect" ) var ( posType = reflect.TypeOf(Pos(0)) emptyType = reflect.TypeOf(struct{}{}) stringType = reflect.TypeOf("") byteSliceType = reflect.TypeOf([]byte{}) submatchType = reflect.TypeOf(Submatch{}) scalarTypes = []reflect.Type{ emptyType, stringType, ...
inflate.go
0.690768
0.448607
inflate.go
starcoder
package expr import ( "github.com/genjidb/genji/document" "github.com/genjidb/genji/internal/environment" "github.com/genjidb/genji/internal/sql/scanner" "github.com/genjidb/genji/internal/stringutil" "github.com/genjidb/genji/types" ) // A cmpOp is a comparison operator. type cmpOp struct { *simpleOperator } ...
internal/expr/comparison.go
0.765944
0.454775
comparison.go
starcoder
package basic import "strings" // MapIONumber is template to generate itself for different combination of data type. func MapIONumber() string { return ` func TestMap<FINPUT_TYPE><FOUTPUT_TYPE>(t *testing.T) { // Test : add 1 to the list expectedList := []<OUTPUT_TYPE>{2, 3, 4} newList := Map<FINPUT_TYPE><FOUTPUT...
internal/template/basic/mapiotest.go
0.587352
0.495117
mapiotest.go
starcoder
package year2021 import ( "fmt" "strings" "github.com/lanphiergm/adventofcodego/internal/utils" ) // Passage Pathing Part 1 computes the number of paths through the cave system if // small caves can be visited only once func PassagePathingPart1(filename string) interface{} { dsts := parsePaths(filename) paths :...
internal/puzzles/year2021/day_12_passage_pathing.go
0.659076
0.425546
day_12_passage_pathing.go
starcoder
package physics2d import ( "math" "github.com/puoklam/physics2d/collision" "github.com/puoklam/physics2d/force" "github.com/puoklam/physics2d/math/vector" "github.com/puoklam/physics2d/shape" ) type World struct { registry *force.Registry bodies []*shape.Body dt float64 collisions []collision.Colli...
world.go
0.620047
0.488649
world.go
starcoder
package assert import ( "fmt" "reflect" "runtime" "testing" ) // Version returns package version func Version() string { return "0.11.0" } // Author returns package author func Author() string { return "[<NAME>](https://www.likexian.com/)" } // License returns package license func License() string { return "...
vendor/github.com/likexian/gokit/assert/assert.go
0.703753
0.609844
assert.go
starcoder
package graph // Visit is a function type that is used by a BreadthFirst or DepthFirst to allow side-effects // on visiting new nodes in a graph traversal. type Visit func(u, v Node) // BreadthFirst is a type that can perform a breadth-first search on a graph. type BreadthFirst struct { q *queue visits []bool...
traverse.go
0.768038
0.566798
traverse.go
starcoder
package spec import ( "fmt" "sort" "strconv" "strings" "github.com/diamondburned/arikawa/v3/api" "github.com/diamondburned/arikawa/v3/discord" ) func (s Spec) Search(query string) []*Node { query = strings.ToLower(query) fields := strings.Fields(query) switch len(fields) { case 0: return nil } result...
spec/util.go
0.557123
0.42322
util.go
starcoder
package mat import ( "github.com/chewxy/math32" "github.com/foxis/EasyRobot/pkg/core/math/vec" ) type Matrix4x3 [4][3]float32 func New4x3(arr ...float32) Matrix4x3 { m := Matrix4x3{} if arr != nil { for i := range m { copy(m[i][:], arr[i*3 : i*3+3][:]) } } return m } // Returns a flat representation o...
pkg/core/math/mat/mat4x3.go
0.840815
0.580411
mat4x3.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 AggregateBalancePerSafekeepingPlace12 struct { // Place where the securities are safe-kept, physically or notionally. This place can be, ...
AggregateBalancePerSafekeepingPlace12.go
0.871707
0.409162
AggregateBalancePerSafekeepingPlace12.go
starcoder
package main type Age int type Person struct { name string age Age friend *Person } func main() { john := Person{"John", 25, nil} pJohn := &john pJohn.age++ //Indiquez true ou false en troisième argument assert("Q1", john.age == 25, false) assert("Q1", john.age == 26, true) assert("Q1", pJohn.age == ...
go100/14-exercices/correction/main.go
0.514644
0.660487
main.go
starcoder
package timef import ( "strings" "time" ) // ToFormat convert date to desired format func ToFormat(value, layout, format string) (string, error) { var ( res string trd time.Time err error ) if layout == "" { return value, nil } if trd, err = time.Parse(layout, value); err != nil { return value, err...
timef.go
0.508788
0.447762
timef.go
starcoder
package statistics import "fmt" type result map[string]interface{} type statOpt func(result) //Set flags to true to be able to configure process functions func (d *dataBuffer) SetConfigOption(stats []string) (map[string]statOpt, error) { statOpts := make(map[string]statOpt) for _, stat := range stats { switch st...
statistics/options.go
0.579043
0.461805
options.go
starcoder
package continuous import ( "github.com/jtejido/ggsl/specfunc" "github.com/jtejido/stats" "github.com/jtejido/stats/err" smath "github.com/jtejido/stats/math" "math" "math/rand" ) // Beta distribution // https://en.wikipedia.org/wiki/Beta_distribution type Beta struct { baseContinuousWithSource alpha, beta fl...
dist/continuous/beta.go
0.724578
0.456289
beta.go
starcoder
package noise import ( "net" "time" "go.uber.org/zap" ) // NodeOption represents a functional option that may be passed to NewNode for instantiating a new node instance with configured values type NodeOption func(n *Node) // WithNodeMaxDialAttempts sets the max number of attempts a connection is dialed before it...
node_options.go
0.783409
0.482856
node_options.go
starcoder
package models import ( i336074805fc853987abe6f7fe3ad97a6a6f3077a16391fec744f671a015fbd7e "time" i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91 "github.com/microsoft/kiota-abstractions-go/serialization" ) // SimulationAutomation type SimulationAutomation struct { Entity // Identity...
models/simulation_automation.go
0.557604
0.404302
simulation_automation.go
starcoder
package xpath import ( "fmt" "reflect" "strconv" ) // The XPath number operator function list. // valueType is a return value type. type valueType int const ( booleanType valueType = iota numberType stringType nodeSetType ) func getValueType(i interface{}) valueType { v := reflect.ValueOf(i) switch v.Kind...
operator.go
0.670069
0.441733
operator.go
starcoder
package interpreter import ( "strconv" "github.com/horvatic/vaticlang/pkg/parser" "github.com/horvatic/vaticlang/pkg/token" ) func isMath(tokenType token.TokenType) bool { return tokenType == token.Plus || tokenType == token.Subtract } func mathMode(node *parser.Node, dataStore *DataStore) int { if node.GetTok...
pkg/interpreter/math.go
0.533884
0.414958
math.go
starcoder
package mlpack /* #cgo CFLAGS: -I./capi -Wall #cgo LDFLAGS: -L. -lmlpack_go_mean_shift #include <capi/mean_shift.h> #include <stdlib.h> */ import "C" import "gonum.org/v1/gonum/mat" type MeanShiftOptionalParam struct { ForceConvergence bool InPlace bool LabelsOnly bool MaxIterations int Radius ...
mean_shift.go
0.707101
0.436802
mean_shift.go
starcoder
package miner import ( "math" "sync" "github.com/ubclaunchpad/cumulus/blockchain" "github.com/ubclaunchpad/cumulus/common/util" "github.com/ubclaunchpad/cumulus/consensus" ) const ( // Paused represents the MinerState where the miner is not running but the // previously running mining job can be resumed or st...
miner/miner.go
0.569613
0.417984
miner.go
starcoder
package taskmaster import ( "fmt" "time" "github.com/go-ole/go-ole" "github.com/go-ole/go-ole/oleutil" "github.com/rickb777/date/period" ) // AddExecAction adds an execute action to the task definition. The args // parameter can have up to 32 $(ArgX) values, such as '/c $(Arg0) $(Arg1)'. // This will allow the...
tasks.go
0.643329
0.426441
tasks.go
starcoder
package main import ( "bufio" "fmt" "os" "time" // My packages "github.com/rsdoiel/stngo" // Caltech Library packages "github.com/caltechlibrary/cli" ) var ( synopsis = ` %s a standard timesheet notation filter. ` description = ` %s will filter the output from stnparse based on date or matching text. ` ...
cmd/stnfilter/stnfilter.go
0.576304
0.592814
stnfilter.go
starcoder
package util import ( "fmt" bot "github.com/Tnze/gomcbot" "math" "time" ) // TweenLookAt is the Tween version of LookAt func TweenLookAt(g *bot.Game, x, y, z float64, t time.Duration) { p := g.GetPlayer() x0, y0, z0 := p.GetPosition() x, y, z = x-x0, y-y0, z-z0 r := math.Sqrt(x*x + y*y + z*z) yaw := -math.A...
util/tween.go
0.743727
0.430985
tween.go
starcoder
package kasclient import ( "encoding/json" ) // InstantQuery struct for InstantQuery type InstantQuery struct { Metric *map[string]string `json:"metric,omitempty"` Timestamp *int64 `json:"Timestamp,omitempty"` Value float64 `json:"Value"` } // NewInstantQuery instantiates a new Ins...
pkg/api/kas/client/model_instant_query.go
0.785391
0.405655
model_instant_query.go
starcoder
package strings import ( "errors" "fmt" "reflect" "regexp" "strings" "text/template" "time" "unicode" "unicode/utf8" "github.com/mantidtech/tplr/functions/helper" "github.com/mantidtech/wordcase" ) // Functions that primarily operate on strings func Functions() template.FuncMap { return template.FuncMap{...
functions/strings/strings.go
0.615781
0.448607
strings.go
starcoder
package selector import "fmt" type Operator string const ( // doubleEqualSignOpeator represents == DoubleEqualSignOperator Operator = "==" // notEqualOperator represents != NotEqualOperator Operator = "!=" // inOperator represents in InOperator Operator = "in" // notInOperator represents notin NotInOperator ...
backend/selector/parser.go
0.750553
0.430207
parser.go
starcoder
package ssa import ( "github.com/pgavlin/gc/src" "fmt" ) type lineRange struct { first, last uint32 } // An xposmap is a map from fileindex and line of src.XPos to int32, // implemented sparsely to save space (column and statement status are ignored). // The sparse skeleton is constructed once, and then reused b...
compile/ssa/xposmap.go
0.637708
0.550305
xposmap.go
starcoder
package ent import ( "fmt" "opencensus/core/ent/bedrecord" "strings" "time" "entgo.io/ent/dialect/sql" ) // BedRecord is the model entity for the BedRecord schema. type BedRecord struct { config `json:"-"` // ID of the ent. ID int `json:"id,omitempty"` // ReportedDate holds the value of the "reportedDate" ...
ent/bedrecord.go
0.657648
0.413536
bedrecord.go
starcoder
package cios import ( "encoding/json" ) // DataStoreChannelStats struct for DataStoreChannelStats type DataStoreChannelStats struct { Count *string `json:"count,omitempty"` Size *string `json:"size,omitempty"` LatestAt *string `json:"latest_at,omitempty"` } // NewDataStoreChannelStats instantiates a new DataSto...
cios/model_data_store_channel_stats.go
0.786172
0.410402
model_data_store_channel_stats.go
starcoder
package gohome import ( "image" "image/color" ) // This interface represents a cube map with six faces type CubeMap interface { // Loads a cube map from data with width and height Load(data []byte, width, height int, shadowMap bool) // Loads the cube map from an image LoadFromImage(img image.Image) // Binds th...
src/gohome/cubemap.go
0.80502
0.454835
cubemap.go
starcoder
package scan import ( "database/sql" "fmt" "reflect" "github.com/jmoiron/sqlx/reflectx" ) var ( mapper = reflectx.NewMapper("db") namedArgType = reflect.TypeOf(sql.NamedArg{}) ) // IsNil returns true if the value is nil func IsNil(src interface{}) bool { if src == nil { return true } value := refl...
dialect/sql/scan/value.go
0.712132
0.572006
value.go
starcoder
package e2e import ( "fmt" "strings" "time" "github.com/onsi/ginkgo" "github.com/onsi/gomega" v1 "k8s.io/api/core/v1" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" clientset "k8s.io/client-go/kubernetes" "k8s.io/kubernetes/test/e2e/framework" ) /* Test to verify fstype specified in storage-class is being h...
tests/e2e/vsphere_volume_fstype.go
0.562177
0.405449
vsphere_volume_fstype.go
starcoder
package sqlb import r "reflect" /* Short for "expression". Defines an arbitrary SQL expression. The method appends arbitrary SQL text. In both the input and output, the arguments must correspond to the parameters in the SQL text. Different databases support different styles of ordinal parameters. This package always ...
sqlb.go
0.823044
0.554591
sqlb.go
starcoder
package models import ( i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91 "github.com/microsoft/kiota-abstractions-go/serialization" ) // WorkbookTable type WorkbookTable struct { Entity // Represents a collection of all the columns in the table. Read-only. columns []WorkbookTableColu...
models/workbook_table.go
0.664214
0.409575
workbook_table.go
starcoder
package box2d import ( "fmt" "math" ) /// Wheel joint definition. This requires defining a line of /// motion using an axis and an anchor point. The definition uses local /// anchor points and a local axis so that the initial configuration /// can violate the constraint slightly. The joint translation is zero /// w...
DynamicsB2JointWheel.go
0.913382
0.813275
DynamicsB2JointWheel.go
starcoder
package heatmap import ( "context" "runtime" "github.com/vivint/rothko/draw" ) // Options are the things you can specify to control the rendering of a // heatmap. type Options struct { // Colors is the slice of colors to map the column data on to. Colors []draw.Color // Canvas to draw on to Canvas draw.Canv...
draw/heatmap/heatmap.go
0.654453
0.494141
heatmap.go
starcoder
package toolbox import ( "fmt" "reflect" "strconv" "strings" "time" ) //DefaultDateLayout is set to 2006-01-02 15:04:05.000 var DefaultDateLayout = "2006-01-02 15:04:05.000" //AsString converts an input to string. func AsString(input interface{}) string { switch inputValue := input.(type) { case string: ret...
converter.go
0.679391
0.402069
converter.go
starcoder
package models import ( i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91 "github.com/microsoft/kiota-abstractions-go/serialization" ) // SimulationReport type SimulationReport struct { // Stores additional data not described in the OpenAPI description found when deserializing. Can be used fo...
models/simulation_report.go
0.649801
0.533944
simulation_report.go
starcoder
package main import ( "fmt" "github.com/jeffwilliams/squarify" "io" "os" ) func main() { // Options modifying Squarify behaviour. opt := squarify.Options{ // Left, Right, and Bottom margin of 5, and a Top margin of 30. Margins: &squarify.Margins{5, 5, 30, 5}, // Sort biggest to smallest Sort: true, } ...
examples/svg/svg.go
0.697197
0.476519
svg.go
starcoder
package vm //go:generate stringer -type=Opcode // Opcode is an single operational instruction for the GO NEO virtual machine. type Opcode byte // List of supported opcodes. const ( // Constants Opush0 Opcode = 0x00 // An empty array of bytes is pushed onto the stack. Opushf Opcode = Opush0 Opushbytes...
vendor/github.com/CityOfZion/neo-go/pkg/vm/opcode.go
0.503906
0.5867
opcode.go
starcoder
package ipx import ( "fmt" "math/bits" "net" u128 "github.com/Pilatuz/bigx/v2/uint128" ) // SummarizeRange returns a series of networks which cover the range // between the first and last addresses, inclusive. func SummarizeRange(first, last net.IP) ([]*net.IPNet, error) { // first IPv4 or IPv6 var firstV4, fi...
summarize.go
0.826327
0.484624
summarize.go
starcoder
package openapi import ( "encoding/json" "fmt" "net/url" "strings" "time" "github.com/twilio/twilio-go/client" ) // Optional parameters for the method 'CreateFax' type CreateFaxParams struct { // The number the fax was sent from. Can be the phone number in [E.164](https://www.twilio.com/docs/glossary/what-e...
rest/fax/v1/faxes.go
0.674908
0.424591
faxes.go
starcoder
package matrix import ( "fmt" "strings" "algex/factor" "algex/terms" ) type Matrix struct { // row count and col count rows, cols int // The matrix elements arranged, [r=0,c=0], [0,1], [0,2] ... data []*terms.Exp } // NewMatrix creates a rows x cols matrix. func NewMatrix(rows, cols int) (*Matrix, error) { ...
src/algex/matrix/matrix.go
0.763131
0.557002
matrix.go
starcoder
package image import ( "fmt" "image" "image/color" "image/draw" "image/png" "os" _ "golang.org/x/image/bmp" _ "golang.org/x/image/tiff" _ "golang.org/x/image/webp" _ "image/jpeg" _ "image/png" ) // NewRGBA is a wrapper for image.RGBA which returns a new image of the desired size filled with color. func Ne...
image/util.go
0.813831
0.413004
util.go
starcoder
package main import ( "fmt" "os" "unicode" "github.com/syncd010/AoC2017/helpers" ) // Validates the input func validate(input []string) error { // Accept return nil } // Converts to an appropria format func convert(input []string) []string { return input } const UP, DOWN, LEFT, RIGHT = 'U', 'D', 'L', 'R' t...
day19/day19.go
0.547948
0.405772
day19.go
starcoder