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 unnecessary_data_transfer import ( "sort" "github.com/threagile/threagile/model" ) func Category() model.RiskCategory { return model.RiskCategory{ Id: "unnecessary-data-transfer", Title: "Unnecessary Data Transfer", Description: "Quando um ativo técnico envia ou recebe ativos de dados, que não pr...
risks/built-in/unnecessary-data-transfer/unnecessary-data-transfer-rule.go
0.585338
0.504089
unnecessary-data-transfer-rule.go
starcoder
package cache import ( "sync" "github.com/disgoorg/snowflake/v2" ) // GroupedFilterFunc is used to filter grouped cached entities. type GroupedFilterFunc[T any] func(groupID snowflake.ID, entity T) bool // GroupedCache is a simple key value store grouped by a snowflake.ID. They key is always a snowflake.ID. // Th...
cache/grouped_cache.go
0.682468
0.463566
grouped_cache.go
starcoder
package qrcode import ( "github.com/yeqown/go-qrcode/v2/matrix" ) // maskPatternModulo ... // mask Pattern ref to: https://www.thonky.com/qr-code-tutorial/mask-patterns type maskPatternModulo uint32 const ( // modulo0 (x+y) mod 2 == 0 modulo0 maskPatternModulo = iota // modulo1 (x) mod 2 == 0 modulo1 // modulo...
mask.go
0.707809
0.468243
mask.go
starcoder
package resolv import ( "github.com/ClessLi/2d-game-engin/core/render" "github.com/ClessLi/2d-game-engin/resource" "github.com/go-gl/mathgl/mgl32" ) // Shape is a basic interface that describes a Shape that can be passed to collision testing and resolution functions and // exist in the same Space. type Shape inter...
core/resolv/shape.go
0.682785
0.512815
shape.go
starcoder
package day39 import ( "math" "strings" ) // Coord represents a coordinate in the game of life. type Coord struct { X, Y int64 } // GameOfLife represents the game state. // '*' represents a live cell and '.' represents a dead cell. type GameOfLife struct { living map[Coord]struct{} minX, minY, m...
day39/problem.go
0.745861
0.463505
problem.go
starcoder
package encoder import ( "encoding/binary" "errors" "hash/crc32" ) // EncodeEntry takes in a key, value and timestamp and then creates a buffer containing // all of the data from that. This data is appended to a datafile. func EncodeEntry(key []byte, value []byte, ts uint32) []byte { // the header contains the fi...
encoder/encoder.go
0.8067
0.421373
encoder.go
starcoder
package math import "fmt" import "regexp" import "strconv" import "math" type Color struct { R float64 G float64 B float64 } type HSL struct { H float64 S float64 L float64 } func NewColor( r float64, g float64, b float64) *Color { color := &Color{} color.R = r color.G = g color.B = b return color } f...
math/color.go
0.673299
0.455138
color.go
starcoder
package three import ( "math" ) const ( // DefaultOrder : DefaultOrder = "xyz" ) // RotationOrders : var RotationOrders = []string{"XYZ", "YZX", "ZXY", "XZY", "YXZ", "ZYX"} var _matrix = NewMatrix4() var _quaternion = NewQuaternion(0, 0, 0, 1) // NewEuler : func NewEuler(x, y, z float64, order string) *Euler {...
server/three/euler.go
0.729038
0.560373
euler.go
starcoder
package tags import ( "fmt" "strings" ) // SEP is the seperator to split the string into tags var SEP string = "," // Tags allows the managements of tags in a single string be comma seperation type Tags string // Add the tags in the string seperated by SEP func (t *Tags) Add(tags string) { t.AddSlice(strings.Spl...
tags.go
0.641759
0.468122
tags.go
starcoder
package mock import ( "crypto/rand" "encoding/binary" "math" ) // RandInt Returns an int64 between min and max. func RandInt(min, max int64) int64 { off := min size := max - min return int64(randUint64()%uint64(size)) + off } // RandIntStep Returns an int64 whose step distance between min and max is step. func...
mock_number.go
0.778228
0.416915
mock_number.go
starcoder
package hmath import ( "fmt" "github.com/barnex/fmath" ) type Mat3 [9]float32 func (mat3 *Mat3) Pointer() *[9]float32 { return (*[9]float32)(mat3) } func (mat3 *Mat3) Slice() []float32 { return mat3[:] } func (mat3 *Mat3) String() string { return fmt.Sprintf("[%f,%f,%f,\n %f,%f,%f,\n %f,%f,%f,]", mat3[0], m...
code/pkg/hmath/mat3.go
0.587588
0.689541
mat3.go
starcoder
package frequency import . "github.com/deinspanjer/units/unit" // Frequency represents a SI unit of frequency (in hertz, Hz) type Frequency Unit // ... const ( // SI Yoctohertz = Hertz * 1e-24 Zeptohertz = Hertz * 1e-21 Attohertz = Hertz * 1e-18 Femtohertz = Hertz * 1e-1...
frequency/frequency.go
0.86129
0.497559
frequency.go
starcoder
package graph import ( "fmt" "github.com/gonum/graph" "github.com/goulash/pacman" "github.com/goulash/pacman/aur" ) // Node implements graph.Node. type Node struct { id int pacman.AnyPackage } // ID returns the unique (within the graph) ID of the node. func (n *Node) ID() int { return n.id } // IsFromAUR re...
vendor/github.com/goulash/pacman/graph/graph.go
0.799442
0.475118
graph.go
starcoder
package cirno import ( "fmt" "math" ) // NormalTo returns the normal from the given circle // to the other shape. func (circle *Circle) NormalTo(shape Shape) (Vector, error) { if shape == nil { return Zero(), fmt.Errorf("the shape is nil") } switch other := shape.(type) { case *Circle: return circle.Normal...
normal.go
0.921605
0.716095
normal.go
starcoder
package base import ( "strconv" sdkTypes "github.com/cosmos/cosmos-sdk/types" "github.com/persistenceOne/persistenceSDK/constants/errors" "github.com/persistenceOne/persistenceSDK/schema/types" "github.com/persistenceOne/persistenceSDK/utilities/meta" ) var _, _ types.Data = (*Data_HeightData)(nil), (*HeightDat...
schema/types/base/heightData.go
0.68941
0.490175
heightData.go
starcoder
Package bytecode provides requisite structs and utility functions to build and validate unlinked and unlinked bytecode objects for the ethpm v2 manifest. Information about these objects can be found here http://ethpm.github.io/ethpm-spec/package-spec.html#the-bytecode-object */ package bytecode import ( "encoding/jso...
pkg/bytecode/bytecode.go
0.750278
0.479138
bytecode.go
starcoder
package iso20022 // Reversal card transaction. type CardTransaction7 struct { // TTransaction type of the transaction to be reversed. // It correspond partially to the ISO 8583, field number 3. TransactionType *CardPaymentServiceType7Code `xml:"TxTp"` // Identification of the reconciliation period between the ac...
CardTransaction7.go
0.879768
0.423041
CardTransaction7.go
starcoder
package gke // There should be no imports as it is used standalone in e2e tests const ( // MiB - MebiByte size (2^20) MiB = 1024 * 1024 // Duplicating an upstream bug treating GB as 1000*MiB (we need to predict the end result accurately). mbPerGB = 1000 millicoresPerCore = 1000 ) // PredictKubeReserve...
cluster-autoscaler/cloudprovider/gke/reserved.go
0.691081
0.445409
reserved.go
starcoder
package variation import ( "context" "fmt" "image" "math" "github.com/fogleman/gg" "github.com/ironarachne/world/pkg/heraldry/tincture" "github.com/ironarachne/world/pkg/random" "github.com/ironarachne/world/pkg/words" ) // Variation is a variation of the field type Variation struct { Name str...
pkg/heraldry/variation/variation.go
0.653569
0.437703
variation.go
starcoder
package spec // Parameter Describes a single operation parameter. // A unique parameter is defined by a combination of a name and location. // Parameter Locations // There are four possible parameter locations specified by the in field: // path - Used together with Path Templating, where the parameter value is actuall...
internal/oapi/spec/parameter.go
0.841598
0.607605
parameter.go
starcoder
package ent import ( "fmt" "strings" "time" "entgo.io/ent/dialect/sql" "github.com/gitploy-io/gitploy/model/ent/deploymentstatistics" "github.com/gitploy-io/gitploy/model/ent/repo" ) // DeploymentStatistics is the model entity for the DeploymentStatistics schema. type DeploymentStatistics struct { config `js...
model/ent/deploymentstatistics.go
0.612078
0.418994
deploymentstatistics.go
starcoder
package codingame import ( "fmt" "math" "strconv" "strings" ) const EARTH_RADIUS = 6371 const RADIAN_MULTIPLIER = math.Pi / 180 /* AngleDec represents an angle in Decimal Degrees https://en.wikipedia.org/wiki/Decimal_degrees Angle North (+0°-90°) or South (-0°-90°) of Equator (0°) = Latitude, or East (+0°-180°...
codingame/defibrillators.go
0.812496
0.421909
defibrillators.go
starcoder
package ckks import ( "math" "math/bits" ) // EvaluateChebyFast evaluates the input Chebyshev polynomial on the input ciphertext. // Faster than EvaluateChebyEco but consumes ceil(log(deg)) + 2 levels. func (eval *evaluator) EvaluateChebyFast(op *Ciphertext, cheby *ChebyshevInterpolation, evakey *EvaluationKey) (op...
ckks/chebyshev_evaluation.go
0.724481
0.40439
chebyshev_evaluation.go
starcoder
package main import "fmt" type NaiveBayesianModel struct { xTrain [][]int yTrain []int } type NaiveBayesianClassifier interface { predict(xTest []int) int } /** 미션: P(A|C)와 P(B|C)의 확률값을 비교해서 더 큰 값의 레이블을 반환한다. 풀이 과정: P(A|array) = (P(array|A) * P(A)) / P(array) P(B|array) = (P(array|B) * P(B)) / P(a...
golang/src/coding-training/naive_bayesian_example.go
0.543106
0.800185
naive_bayesian_example.go
starcoder
package digest import ( "bufio" "errors" "hash" "hash/adler32" "io" "os" ) var ( // errReadFewerThanExpectedBytes returned when number of bytes read is fewer than expected errReadFewerThanExpectedBytes = errors.New("number of bytes read is fewer than expected") // errChecksumMismatch returned when the calc...
vendor/github.com/m3db/m3/src/dbnode/digest/reader.go
0.650356
0.453141
reader.go
starcoder
package plangenerator import ( "fmt" "math" "time" ) // Struct to store the input loan details for repayment plan generation. // Note: Duration field takes the duration of the loan period in months and not years. type LoanDetails struct { LoanAmount float64 `json:"loanAmount"` NominalRate float64 `json:"nom...
plangenerator.go
0.619817
0.45308
plangenerator.go
starcoder
package master import ( "math" "strconv" "time" "github.com/ipfs/go-ds-bench/options" "golang.org/x/tools/benchmark/parse" "gonum.org/v1/plot" ) type ysel struct { name string sel func(*parse.Benchmark) float64 } type xsel struct { name string sel func(options.BenchOptions) float64 } var yselNsPerOp =...
master/plotutils.go
0.783326
0.41739
plotutils.go
starcoder
package core import ( "git.maze.io/go/math32" ) type Vector3 struct { X, Y, Z float32 } func (x *Vector3) LengthSqr() float32 { return DotVector3(*x, *x) } func (x *Vector3) Length() float32 { return math32.Sqrt(x.LengthSqr()) } func (x *Vector3) Minus() Vector3 { return Vector3{-x.X, -x.Y,...
core/vector3.go
0.758153
0.732687
vector3.go
starcoder
package wax import ( "math" "math/bits" "github.com/pgavlin/warp/exec" "github.com/pgavlin/warp/wasm/code" ) type values []uint64 func (vs values) U8(i int) uint8 { return uint8(vs[i]) } func (vs values) U16(i int) uint16 { return uint16(vs[i]) } func (vs values) U32(i int) uint32 { return uint32(vs[i]) } ...
compiler/wax/evaluate.go
0.523908
0.459622
evaluate.go
starcoder
package graphics import ( "encoding/json" "fmt" "github.com/stnma7e/betuol/common" "github.com/stnma7e/betuol/component" "github.com/stnma7e/betuol/event" "github.com/stnma7e/betuol/graphics" "github.com/stnma7e/betuol/math" "github.com/stnma7e/betuol/res" ) // GraphicsManager is a component manager used to ...
component/graphics/manager.go
0.624637
0.415907
manager.go
starcoder
package arithmetic import "fmt" func (parser Parser) Expression(input string) (float64, error) { check, value := parser.m19([]rune(input), 0) if check.Ok { return value, nil } var zero float64 return zero, fmt.Errorf("%s", check.Explain()) } func NewParser(input string) Parser { return Parser{ input: []...
example/arithmetic/parse.go
0.576542
0.414958
parse.go
starcoder
package donna import ( `bytes` `regexp` ) const ( isCapture = 0x00F00000 isPromo = 0x0F000000 isCastle = 0x10000000 isEnpassant = 0x20000000 ) // Bits 00:00:00:FF => Source square (0 .. 63). // Bits 00:00:FF:00 => Destination square (0 .. 63). // Bits 00:0F:00:00 => Piece making the move. // Bits 00:...
move.go
0.768038
0.594787
move.go
starcoder
package jsonlogic import ( "bytes" "encoding/json" "fmt" "reflect" "strconv" "strings" "github.com/dariubs/percent" "github.com/spf13/cast" "github.com/buger/jsonparser" ) // Errors var ( ErrInvalidOperation = "invalid operation: %s" ) // Operators holds any operators var Operators = make(map[string]func...
jsonlogic.go
0.546133
0.414217
jsonlogic.go
starcoder
one another.*/ package eq // Generic returns true if two arrays are the same type and have the same values // and false otherwise. Only []byte, []string, []uint32, []uint64, []float32, // []float64, [][3]float32, [][3]float64. func Generic(x, y interface{}) bool { switch xx := x.(type) { case []byte: yy, ok := y.(...
lib/eq/eq.go
0.666714
0.455259
eq.go
starcoder
package network_manager // enum NMCapability NMCapability names the numbers in the Capabilities property. Capabilities are positive numbers. They are part of stable API and a certain capability number is guaranteed not to change. // NM_CAPABILITY_TEAM Teams can be managed. This means the team device plugin is loaded....
enum.go
0.538498
0.604866
enum.go
starcoder
package monitoring const MonitoringGrafanaDBCROResourcesJSON = `{ "annotations": { "list": [ { "builtIn": 1, "datasource": "-- Grafana --", "enable": true, "hide": true, "iconColor": "rgba(0, 211, 255, 1)", "name": "Annotations & Alerts", "type": "das...
pkg/products/monitoring/dashboards/croResources.go
0.561335
0.445168
croResources.go
starcoder
package types import ( "io" "math" "github.com/lyraproj/puppet-evaluator/errors" "github.com/lyraproj/puppet-evaluator/eval" ) type CollectionType struct { size *IntegerType } var Collection_Type eval.ObjectType func init() { Collection_Type = newObjectType(`Pcore::CollectionType`, `Pcore::AnyType { attrib...
types/collectiontype.go
0.634656
0.407864
collectiontype.go
starcoder
package economist import ( "github.com/coschain/contentos-go/common/constants" . "github.com/coschain/contentos-go/dandelion" "github.com/coschain/contentos-go/prototype" "github.com/stretchr/testify/assert" "math/big" "testing" ) type DappTester struct { acc0,acc1,acc2,acc3,acc4 *DandelionAccount } func (tes...
tests/economist/dapp.go
0.518059
0.403684
dapp.go
starcoder
package dp import ( "math" "sort" ) // A helper function for converting weights and scores from []float64 to []int. // For example, Round(dollars, 2) incorporates cents and Round(dollars, 0) // ignores (truncates) change. This may inherently alter the units of the // solution's max value. func Round(floats []float6...
dp/dp.go
0.739328
0.41253
dp.go
starcoder
package util import ( "fmt" "time" "github.com/jinzhu/now" ) // Now is the func used for system time within gtm // This allows for manipulating system time during testing var Now = func() time.Time { return time.Now() } // DateRange creates predefined date ranges and validates if dates are within the range type...
util/date.go
0.793666
0.487429
date.go
starcoder
// Package tree contains the data generator to build the tree benchmark data. package tree import ( "fmt" "math" "github.com/google/badwolf/tools/benchmark/generator" "github.com/google/badwolf/triple" "github.com/google/badwolf/triple/node" "github.com/google/badwolf/triple/predicate" ) // treeGenerator gene...
tools/benchmark/generator/tree/tree.go
0.786746
0.466724
tree.go
starcoder
package ztype import ( zserio "github.com/woven-planet/go-zserio" ) // BitSizeOfDescriptor returns the bit size of a descriptor. func bitSizeOfDescriptor(packingNode *zserio.PackingContextNode, bitPosition int) (int, error) { endBitPosition := bitPosition if packingNode.HasContext() { endBitPosition += packingNo...
ztype/array.go
0.753829
0.475423
array.go
starcoder
package builtin import ( "fmt" "github.com/filecoin-project/go-state-types/abi" "github.com/filecoin-project/go-state-types/big" ) const SecondsInHour = 60 * 60 const SecondsInDay = 24 * SecondsInHour type NetworkPolicy struct { // The duration of a chain epoch. // Motivation: It guarantees that a block is pro...
actors/builtin/network.go
0.794943
0.529263
network.go
starcoder
package geocoding import ( "fmt" "log" "bitbucket.org/kleinnic74/photos/domain/gps" ) type entry struct { bounds gps.Rect data interface{} } type ResultFunc func(interface{}, gps.Rect) type quadtree struct { count int Bounds gps.Rect root *node capacity int maxDepth int } type node struct { bou...
geocoding/quadtree.go
0.593374
0.400749
quadtree.go
starcoder
package tree type Node struct { data int left, right *Node flag bool } func NewNode(value int) *Node { return &Node{ data: value, left: nil, right: nil, flag: false, } } type BinarySearchTree struct { root *Node count uint } func NewBinarySearchTree(root *Node) *BinarySearchTree { ...
tree/binarysearchtree.go
0.624637
0.424889
binarysearchtree.go
starcoder
package goval import "reflect" const ( TypeNil = iota TypeBool TypeInt8 TypeInt16 TypeInt32 TypeInt64 TypeUint8 TypeUint16 TypeUint32 TypeUint64 TypeFloat32 TypeFloat64 TypeComplex64 TypeComplex128 TypeString TypeBytes ) var ( ValTypes = struct { Nil Type Bool Type Int8 Type...
type.gen.go
0.523664
0.540136
type.gen.go
starcoder
package spiral_memory import ( "math" ) var DIM = 2000 var OFFSET = DIM / 2 type square struct { index uint64 distance uint64 weight uint64 } type spiral []square type matrix []uint64 func GetIndex(x int, y int) uint64 { return uint64((OFFSET+x)*DIM + (OFFSET + y)) } func GetVal(mat matri...
2017/03-spiral_memory/spiral_memory.go
0.722625
0.594816
spiral_memory.go
starcoder
package hdkeys import ( "crypto/sha256" "fmt" "math/big" "github.com/runeaune/bitcoin-crypto/bitecdsa" "github.com/runeaune/bitcoin-crypto/bitelliptic" "golang.org/x/crypto/ripemd160" ) type point struct { x, y *big.Int } func RIPEMD160Hash(data []byte) []byte { first := sha256.Sum256(data) hasher := ripem...
util.go
0.550607
0.44903
util.go
starcoder
package day10 import ( "fmt" "math/big" "sort" "strings" "github.com/OctaviPascual/AdventOfCode2019/util" ) const ( asteroid = '#' empty = '.' ) // Day holds the data needed to solve part one and part two type Day struct { asteroidMap [][]bool } type position struct { // instead of working with the coo...
day10/day10.go
0.70253
0.458591
day10.go
starcoder
package runtime_data_area import ( "math" "github.com/Frederick-S/jvmgo/runtime_data_area/heap" ) type OperandStack struct { size uint operands []Variable } func newOperandStack(maxStackSize uint) *OperandStack { if maxStackSize > 0 { return &OperandStack{ operands: make([]Variable, maxStackSize), }...
runtime_data_area/operand_stack.go
0.692538
0.448668
operand_stack.go
starcoder
package atacdemultiplexutils import ( "bufio" "os" "strings" "github.com/biogo/store/interval" "time" "fmt" "strconv" "github.com/jinzhu/copier" ) //IntInterval Integer-specific intervals type IntInterval struct { Start, End int UID uintptr Payload interface{} } //PeakIntervalTreeObject Peak ...
ATACdemultiplexUtils/intervalUtils.go
0.578091
0.490114
intervalUtils.go
starcoder
package chapter06 // BFS I find that BFS is better explained at // [Red Blob Games](https://www.redblobgames.com/pathfinding/a-star/introduction.html). With // lovely animations. But this one wasn't too bad either. // This implementation will use the simple map based search from the book. // Also note, that this imple...
chapter06/bfs.go
0.815049
0.598107
bfs.go
starcoder
package main import "fmt" // Coord4 represents an integral coordinate type Coord4 struct { x int y int z int w int } func doDeltas4() []Coord4 { coords := make([]Coord4, 0) for x := -1; x <= 1; x++ { for y := -1; y <= 1; y++ { for z := -1; z <= 1; z++ { for w := -1; w <= 1; w++ { if x == 0 && y =...
day17/space4.go
0.729616
0.414247
space4.go
starcoder
package hash import ( "math/rand" "github.com/sachaservan/vec" ) /* Construct a higher dimensional lattice as a direct product of copies of the leech lattice For example, with 2 copies we have: 1) view a 48-dimensional vector as the concatenation of 2 24-dimensional vectors 2) Find the closest leech lattice ...
hash/multilattice_hash.go
0.80479
0.673245
multilattice_hash.go
starcoder
package main import ( rl "goray/raylib" "math" "runtime" ) var ( G = 400 PLAYER_JUMP_SPD = float32(350.0) PLAYER_HOR_SPD = float32(200.0) ) type Player struct { Position rl.Vector2 Speed float32 CanJump bool } type EnvItem struct { Rect rl.Rectangle Blocking bool Color rl.Colo...
examples/core/2d_camera_platformer/2d_camera_platformer.go
0.573917
0.4575
2d_camera_platformer.go
starcoder
package main import ( "bytes" "errors" "fmt" "log" "strconv" "strings" ) type rover struct { x int y int direction byte } func (r *rover) String() string { return fmt.Sprintf("%d %d %s", r.x, r.y, string(r.direction)) } type directionNode struct { left byte right byte } // compass dire...
main.go
0.627381
0.405625
main.go
starcoder
package assert import ( "errors" "reflect" "runtime/debug" "strconv" "strings" "testing" ) var ( errorInterface = reflect.TypeOf((*error)(nil)).Elem() ) // Matcher hold the current state of the assertion. type Matcher struct { t *testing.T actual interface{} match bool } // With creates a new Matcher wi...
matcher.go
0.744192
0.486514
matcher.go
starcoder
package value import ( "math/big" "unicode/utf8" ) // Unary operators. // To avoid initialization cycles when we refer to the ops from inside // themselves, we use an init function to initialize the ops. // unaryBigIntOp applies the op to a BigInt. func unaryBigIntOp(c Context, op func(Context, *big.Int, *big.In...
value/unary.go
0.698741
0.493531
unary.go
starcoder
package command import ( "fmt" "strings" "github.com/hashicorp/serf/coordinate" ) // RTTCommand is a Command implementation that allows users to query the // estimated round trip time between nodes using network coordinates. type RTTCommand struct { BaseCommand } func (c *RTTCommand) Help() string { helpText :...
vendor/github.com/hashicorp/consul/command/rtt.go
0.746416
0.407982
rtt.go
starcoder
package metric import ( "github.com/zchee/goimportz/internal/event/keys" "github.com/zchee/goimportz/internal/event/label" ) // Scalar represents the construction information for a scalar metric. type Scalar struct { // Name is the unique name of this metric. Name string // Description can be used by observers ...
internal/event/export/metric/info.go
0.850934
0.556701
info.go
starcoder
package SetSimilaritySearch import "math" func min(a, b int) int { if a < b { return a } return b } func max(a, b int) int { if a > b { return a } return b } // IntersectionSize computes the number of overlaps of two transformed sets // (sorted integers). func intersectionSize(s1, s2 []int) int { var i, ...
similarity.go
0.814311
0.443962
similarity.go
starcoder
package condition import ( "errors" "fmt" "regexp" "strconv" "strings" "github.com/Jeffail/benthos/lib/log" "github.com/Jeffail/benthos/lib/metrics" "github.com/Jeffail/benthos/lib/types" radix "github.com/armon/go-radix" "github.com/spf13/cast" ) //--------------------------------------------------------...
lib/condition/metadata.go
0.792625
0.759315
metadata.go
starcoder
package wsm import ( "color-thief/argsort" "color-thief/wu" "math" ) const ( HistBits = 5 Shift = 8 - HistBits HistSize = 1 << (3 * HistBits) ) // encode image pixels to 1d histogram with weight proportion to its frequency // normalize by the total number of pixels func getHistogram(src [][3]int, size float...
wsm/wsm.go
0.605682
0.442938
wsm.go
starcoder
package day17 import ( "fmt" "io" "github.com/mjm/advent-of-code-2019/pkg/point" ) // Canvas is an infinitely paintable 2D surface. type Canvas struct { paint map[point.Point2D]int minCorner point.Point2D maxCorner point.Point2D } // NewCanvas creates an empty canvas. func NewCanvas() *Canvas { return &C...
day17/canvas.go
0.762866
0.436022
canvas.go
starcoder
package life import ( "math/rand" "time" ) // Life contains all data about the current game type Life struct { Generation int Width int Height int data [2][]uint8 readBuf int } // New returns a new Life structure func New(width, height int) *Life { size := width * height return &Life{ G...
life/life.go
0.598899
0.426979
life.go
starcoder
package parquet import ( "github.com/segmentio/parquet-go/deprecated" "github.com/segmentio/parquet-go/encoding/plain" "github.com/segmentio/parquet-go/format" "github.com/segmentio/parquet-go/internal/bits" ) type booleanPageIndex struct{ page *booleanPage } func (index booleanPageIndex) NumPages() int {...
column_index_default.go
0.583559
0.423577
column_index_default.go
starcoder
package interactors import ( "fmt" "github.com/CESARBR/knot-babeltower/pkg/thing/entities" "github.com/go-playground/validator" ) type schemaType struct { valueType interface{} unit interface{} } type interval struct { min int max int } // rules reference table: https://knot-devel.cesar.org.br/doc/thin...
pkg/thing/interactors/update_schema.go
0.579995
0.433742
update_schema.go
starcoder
package cryptoapis import ( "encoding/json" ) // GetAssetDetailsByAssetSymbolRISC Crypto Type Data type GetAssetDetailsByAssetSymbolRISC struct { // Represents the percentage of the asset's current price against the its price from 1 hour ago. Var1HourPriceChangeInPercentage string `json:"1HourPriceChangeInPercent...
model_get_asset_details_by_asset_symbol_risc.go
0.799677
0.403332
model_get_asset_details_by_asset_symbol_risc.go
starcoder
package config type DocField struct { Name string Type string Comment string } var Doc = map[string][]DocField{ "API": []DocField{ { Name: "ListenAddress", Type: "string", Comment: `Binding address for the Lotus API`, }, { Name: "RemoteListenAddress", Type: "string", Comment: ``, ...
node/config/doc_gen.go
0.583915
0.485722
doc_gen.go
starcoder
package internal import ( "log" "reflect" ) func ConformWithWarning(actual interface{}, expectation interface{}, shallwarn bool) bool { if IsArray(actual) && IsArray(expectation) { actualArr, _ := actual.([]interface{}) expectationArr, _ := expectation.([]interface{}) return ConformArray(actualArr, expectati...
internal/conform.go
0.527073
0.570481
conform.go
starcoder
package grpc import ( "fmt" "strconv" log "github.com/sirupsen/logrus" "github.com/c9s/bbgo/pkg/bbgo" "github.com/c9s/bbgo/pkg/fixedpoint" "github.com/c9s/bbgo/pkg/pb" "github.com/c9s/bbgo/pkg/types" ) func toSubscriptions(sub *pb.Subscription) (types.Subscription, error) { switch sub.Channel { case pb.Cha...
pkg/grpc/convert.go
0.599485
0.407098
convert.go
starcoder
Package planbuilder allows you to build execution plans that describe how to fulfill a query that may span multiple keyspaces or shards. The main entry points for this package are Build and BuildFromStmt. */ package planbuilder /* The main strategy of the planbuilder is to push down as much of the work as possible dow...
go/vt/vtgate/planbuilder/doc.go
0.74512
0.776072
doc.go
starcoder
package gfx import "math" // SignedDistance holds 2D signed distance functions based on // https://iquilezles.org/www/articles/distfunctions2d/distfunctions2d.htm type SignedDistance struct { Vec } // SignedDistanceFunc is a func that takes a SignedDistance and returns a float64. type SignedDistanceFunc func(Signe...
vendor/github.com/peterhellberg/gfx/signed_distance.go
0.914262
0.759894
signed_distance.go
starcoder
package date import ( "regexp" "strings" "time" ) // PatternTranslation are the map of regexs in different languages var PatternTranslation = map[string]PatternTranslations{ "en": { DateRegex: `(of )?(the )?((after )?tomorrow|((today|tonight)|(next )?(monday|tuesday|wednesday|thursday|friday|saturday|sunday))|(...
language/date/date.go
0.595493
0.5816
date.go
starcoder
package chip8 import ( termbox "github.com/nsf/termbox-go" ) const ( GraphicsWidth = 64 // Pixels GraphicsHeight = 32 // Pixels ) // Display represents the output display for the CHIP-8 graphics array. type Display interface { // Render should render the current graphics array to the display. Render(*Graphics...
graphics.go
0.835651
0.479991
graphics.go
starcoder
package plaid import ( "encoding/json" ) // NetPay An object representing information about the net pay amount on the paystub. type NetPay struct { // Raw amount of the net pay for the pay period CurrentAmount NullableFloat32 `json:"current_amount,omitempty"` // Description of the net pay Description NullableSt...
plaid/model_net_pay.go
0.837055
0.470128
model_net_pay.go
starcoder
package blockchain import ( "crypto/sha256" "errors" "fmt" "log" ) type ( // Chain is an array of Blocks Chain struct { Links []Block } ) // GetBlock returns a block by the index func (c Chain) GetBlock(index int) Block { return c.Links[index] } // GetLatestBlock returns the newest block func (c...
chain.go
0.83152
0.488405
chain.go
starcoder
package ln import "math" type Cylinder struct { Radius float64 Z0, Z1 float64 } func NewCylinder(radius, z0, z1 float64) *Cylinder { return &Cylinder{radius, z0, z1} } func (c *Cylinder) Compile() { } func (c *Cylinder) BoundingBox() Box { r := c.Radius return Box{Vector{-r, -r, c.Z0}, Vector{r, r, c.Z1}} } ...
ln/cylinder.go
0.788257
0.473536
cylinder.go
starcoder
package stats import ( "runtime" "sync" "sync/atomic" hist "github.com/samaritan-proxy/circonusllhist" ) var ( defaultSupportedQuantiles = []float64{0.0, 0.25, 0.5, 0.9, 0.95, 0.99, 1.0} ) // HistogramStatistics holds the computed statistic of a histogram. type HistogramStatistics struct { *hist.Histogram mu...
vendor/github.com/kirk91/stats/histogram.go
0.777975
0.447823
histogram.go
starcoder
package gorm import ( "context" "fmt" "reflect" "strings" "github.com/golang/protobuf/jsonpb" "github.com/golang/protobuf/proto" "github.com/golang/protobuf/protoc-gen-go/generator" "github.com/infobloxopen/atlas-app-toolkit/query" "github.com/infobloxopen/atlas-app-toolkit/rpc/resource" ) // FilterStringT...
gorm/filtering.go
0.668015
0.416619
filtering.go
starcoder
package gtk3Import import ( "bytes" "fmt" "sort" "strings" ) var pangoEscapeChar = [][]string{{"<", "&lt;", string([]byte{0x15})}, {"&", "&amp;", string([]byte{0x16})}} var markupType = map[string][]string{ "bold": {"<b>", "</b>"}, "bld": {"<b>", "</b>"}, // Bold "big": {"<big>", "</big>"}, ...
vendor/github.com/hfmrow/gtk3Import/pango/pangoMarkupBinder.go
0.734215
0.543833
pangoMarkupBinder.go
starcoder
// Package no provides holiday definitions for Norway. package no import ( "time" "github.com/devechelon/cal/v2" "github.com/devechelon/cal/v2/aa" ) var ( // FoersteNyttaarsdag represents New Year's Day on 1-Jan FoersteNyttaarsdag = aa.NewYear.Clone(&cal.Holiday{Name: "Første nyttårsdag", Type: cal.ObservanceP...
v2/no/no_holidays.go
0.50293
0.403861
no_holidays.go
starcoder
package tsm1 import ( "sync" "sync/atomic" "github.com/influxdata/influxql" ) // entry is a set of values and some metadata. type entry struct { // Tracks the number of values in the entry. Must always be accessed via // atomic; must be 8b aligned. n int64 mu sync.RWMutex values Values // All stored val...
tsdb/tsm1/cache_entry.go
0.648689
0.560253
cache_entry.go
starcoder
package progress import ( "fmt" ) // UnitsNotationPosition determines units position relative of tracker value. type UnitsNotationPosition int // Supported unit positions relative to tracker value; // default: UnitsNotationPositionBefore const ( UnitsNotationPositionBefore UnitsNotationPosition = iota UnitsNotati...
progress/units.go
0.733165
0.659021
units.go
starcoder
package galtonwatson import ( "sort" "golang.org/x/exp/rand" "gonum.org/v1/gonum/stat/distuv" "github.com/tommyreddad/galtonwatson/stat/dist" "github.com/tommyreddad/galtonwatson/tree" ) // GaltonWatson implements a conditioned Galton-Watson tree generator. The // conditioned Galton-Watson tree is specified by...
galtonwatson.go
0.754192
0.472014
galtonwatson.go
starcoder
package primitives import ( "fmt" "github.com/zimmski/tavor/token" "reflect" ) // Pointer implements a general pointer token which references a token type Pointer struct { token token.Token typ reflect.Type cloned bool } // NewPointer returns a new instance of a Pointer token and sets the token reference ty...
token/primitives/pointer.go
0.784113
0.439086
pointer.go
starcoder
package datadog import ( "encoding/json" ) // MetricIngestedIndexedVolumeAttributes Object containing the definition of a metric's ingested and indexed volume. type MetricIngestedIndexedVolumeAttributes struct { // Indexed volume for the given metric. IndexedVolume *int64 `json:"indexed_volume,omitempty"` // Ing...
api/v2/datadog/model_metric_ingested_indexed_volume_attributes.go
0.844922
0.66182
model_metric_ingested_indexed_volume_attributes.go
starcoder
package insteon import ( "fmt" "sync" ) // SwitchConfig contains the HouseCode and UnitCode for a switch's // X10 configuration type SwitchConfig struct { // HouseCode is the X10 house code of the switch or dimmer HouseCode int // UnitCode is the X10 unit code of the switch or dimmer UnitCode int } // Unmars...
switch.go
0.599837
0.404684
switch.go
starcoder
package units import ( "math" ) type magnitude struct { Symbol string Prefix string Power float64 } var mags = map[string]magnitude{ "exa": magnitude{"E", "exa", 18.0}, "peta": magnitude{"P", "peta", 15.0}, "tera": magnitude{"T", "tera", 12.0}, "giga": magnitude{"G", "giga", 9.0}, "mega": magnitude{"...
metric.go
0.687525
0.546254
metric.go
starcoder
package springweb import "math" var ArmResist float64 = 1e-3 var SpringResist float64 = 1e-3 type Arm struct { K, w, InitAngle, PrevAngle, prevAngleUnrest float64 Rotations int } type Spring struct { To *Node K,Distance,prevDistance float64 FromArm, ToArm Arm } type Node struct...
springweb.go
0.721841
0.476092
springweb.go
starcoder
package goutils import( "time"; ) /* int alias for uint byte alias for uint8 rune alias for int32 */ // Compare a,b: // -1 , if a < b // 0 , if a == b // 1 , if a > b type TypeComparator func(a, b interface{}) int // Compare strings func StringComparator(a, b interface{}) int { s1 := a.(strin...
goutils_typecomparator_functions.go
0.657318
0.438665
goutils_typecomparator_functions.go
starcoder
//nolint:unparam // golangci-linter 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 considered as in affine form. type PointG2 [3]fe2 // Se...
plugin/dapp/evm/executor/vm/common/crypto/bls12381/g2.go
0.562657
0.436502
g2.go
starcoder
package spec import ( "strings" "sync/atomic" "testing" "time" "github.com/256dpi/gomqtt/client" "github.com/256dpi/gomqtt/packet" "github.com/256dpi/gomqtt/transport" "github.com/256dpi/gomqtt/transport/flow" "github.com/stretchr/testify/assert" ) // PublishSubscribeTest tests the broker for basic pub sub...
spec/base.go
0.543833
0.551091
base.go
starcoder
package continuous import ( "github.com/jtejido/stats" "github.com/jtejido/stats/err" "math" ) // Benktander type I distribution (Benktander-Gibrat Distribution) // https://en.wikipedia.org/wiki/Benktander_type_I_distribution type BenktanderType1 struct { a, b float64 } func NewBenktanderType1(a, b float64) (*Be...
dist/continuous/benktander_type_1.go
0.713432
0.452475
benktander_type_1.go
starcoder
package algorithm import ( "reflect" ) // Getter can get a value at 'i'th position. type Getter interface { Get(i int) interface{} } // Lesser compares two elements. type Lesser interface { Less(i, j int) bool } // Lenner has a length type Lenner interface { Len() int } // Swapper can swap type Swapper interf...
algorithm/algorithm.go
0.78374
0.445891
algorithm.go
starcoder
package data import "fmt" // FrameInputConverter is a type to support building a Frame while also // doing conversion as data is added to the Frame. type FrameInputConverter struct { Frame *Frame fieldConverters []FieldConverter } // A FieldConverter is a type to support building Frame fields of a differ...
vendor/github.com/grafana/grafana-plugin-sdk-go/data/conversion_input.go
0.708515
0.598987
conversion_input.go
starcoder
package common import ( "image/color" "engo.io/engo" "engo.io/gl" ) type TriangleType uint8 const ( // Indicates a Triangle where two sides have equal length TriangleIsosceles TriangleType = iota // Indicates a Triangles where one angle is at 90 degrees TriangleRight ) // Triangle is a basic triangular form...
common/render_shapes.go
0.837421
0.660515
render_shapes.go
starcoder
package container import "github.com/nwillc/genfuncs" var _ Queue[int] = (*Deque[int])(nil) // Deque is a doubly ended implementation of Queue with default behavior of a Fifo but provides left and right access. // Employs a List for storage. type Deque[T any] struct { list *List[T] } // NewDeque creates a Deque co...
container/deque.go
0.782496
0.521167
deque.go
starcoder
package fptower import ( "github.com/consensys/gnark-crypto/ecc/bls12-377/fp" ) // Mul sets z to the E2-product of x,y, returns z func (z *E2) Mul(x, y *E2) *E2 { var a, b, c fp.Element a.Add(&x.A0, &x.A1) b.Add(&y.A0, &y.A1) a.Mul(&a, &b) b.Mul(&x.A0, &y.A0) c.Mul(&x.A1, &y.A1) z.A1.Sub(&a, &b).Sub(&z.A1, &...
ecc/bls12-377/internal/fptower/e2_bls377.go
0.644561
0.461805
e2_bls377.go
starcoder
package models import ( "fmt" "strings" grpcapi "github.com/SKF/proto/v2/hierarchy" ) // InspectionPoint - holds parameters for inspection point type InspectionPoint struct { // Type of value to record ValueType ValueType `json:"valueType" example:"numeric" swaggertype:"string" enums:"numeric,single_choice,mult...
v2/services/hierarchy/models/inspection_point.go
0.691185
0.477554
inspection_point.go
starcoder