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 main import ( "fmt" "math" "github.com/jakubDoka/mlok/ggl" "github.com/jakubDoka/mlok/logic/frame" "github.com/jakubDoka/mlok/logic/spatial" "github.com/jakubDoka/mlok/mat" "github.com/jakubDoka/mlok/mat/angle" "github.com/jakubDoka/mlok/mat/rgba" _ "image/png" ) const ( RepelCof = 7.5 ...
examples/basics/hasher/main.go
0.568416
0.411495
main.go
starcoder
package quicksort import "math/rand" func quicksort(array []int) []int { if len(array) == 0 { return array } pivot := array[len(array)/2] less, equal, greater := []int{}, []int{}, []int{} for ind := range array { if array[ind] < pivot { less = append(less, array[ind]) } if array[ind] == pivot { e...
Algorithms/Sorting/Quicksort/quicksort.go
0.662578
0.553928
quicksort.go
starcoder
package cursors // FieldType represents the primitive field data types available in tsm. type FieldType int const ( Float FieldType = iota // means the data type is a float Integer // means the data type is an integer Unsigned // means the data type is an unsigned integer ...
tsdb/cursors/schema.go
0.774328
0.49469
schema.go
starcoder
package bccsp const ( SM4 = "SM4" SM3 = "SM3" SM2 = "SM2" SM2ReRand="SM2ReRand" // HMACTruncated256 HMAC truncated at 256 bits. HMACTruncated256 = "HMAC_TRUNCATED_256" // HMAC keyed-hash message authentication code HMAC = "HMAC" // X509Certificate Label for X509 certificate related operation X509Cert...
bccsp/opts.go
0.755186
0.411406
opts.go
starcoder
package character import "github.com/genshinsim/gcsim/pkg/core" func (c *Tmpl) QueueParticle(src string, num int, ele core.EleType, delay int) { p := core.Particle{ Source: src, Num: num, Ele: ele, } c.AddTask(func() { c.Core.Energy.DistributeParticle(p) }, "particle", delay) } func (c *Tmpl) Cons...
internal/tmpl/character/energy.go
0.593491
0.45048
energy.go
starcoder
package eval import ( "reflect" "go/token" "errors" ) func evalBinaryExpr(binary *BinaryExpr, env Env) (r reflect.Value, err error) { if binary.IsConst() { return binary.Const(), nil } xexpr := binary.X yexpr := binary.Y op := binary.Op() var zt []reflec...
Godeps/_workspace/src/github.com/0xfaded/eval/evalbinaryexpr.go
0.552057
0.515864
evalbinaryexpr.go
starcoder
package dst // Geometric distribution (type 1). // The probability distribution of the number Y = X − 1 of failures before the first success, supported on the set {1, 2, 3, ... } // Parameters: // ρ ∈ (0, 1] probability of success in each trial // Support: // k ∈ {1, ... , n} // Geometric1PMF returns the PMF of t...
dst/geom1.go
0.882288
0.828523
geom1.go
starcoder
package datautils import ( "bytes" "fmt" ) // FileType is the type URI for files const FileType = "http://sdr.sul.stanford.edu/models/sdr3-file.jsonld" // FilesetType is the type URI for filesets const FilesetType = "http://sdr.sul.stanford.edu/models/sdr3-fileset.jsonld" // ObjectTypes is the list of object subt...
datautils/resource.go
0.629661
0.466542
resource.go
starcoder
package worktime import ( "fmt" "time" ) // Day is a full calendar day const Day = time.Hour * 24 // WorkTime represents a day that could be a normal week day with office hours type WorkTime struct { time.Time start time.Duration end time.Duration } // NewStandardWorkTime returns a WorkTime with 9-5 as the ...
worktime.go
0.850158
0.514339
worktime.go
starcoder
package search import ( "bytes" "regexp" "github.com/VictorLowther/simplexml/dom" ) // Match is the basic type of a search function. // It takes a single element, and returns a boolean // indicating whether the element matched the func. type Match func(*dom.Element) bool // And takes any number of Match, and ret...
search/search.go
0.803637
0.510741
search.go
starcoder
package isaac import "unsafe" // Isaac64 represents ISAAC64 random generator type Isaac64 struct { randrsl [256]uint64 randmem [256]uint64 randcnt uint64 aa uint64 bb uint64 cc uint64 } // NewIsaac64 returns a new instance of ISAAC64. func NewIsaac64() *Isaac64 { return &Isaac64{ randmem: [2...
isaac64.go
0.558207
0.479686
isaac64.go
starcoder
package gwc import ( "math" "math/rand" ) // Builds a Node from the provided state function and neighbours. func NewNode(id NodeID, fn NodeStateFn, neighbours ...NodeID) Node { return &BaseNode{id, neighbours, fn} } // Builds a Node from the provided superposition and neighbours. func NewSuperpositionNode(id Node...
node.go
0.710528
0.488039
node.go
starcoder
package document import ( "fmt" "strconv" "time" "github.com/unchartedsoftware/deluge/util" ) // TSV represents a basic tsv based document. type TSV struct { Cols []string } // SetData sets the internal TSV column. func (d *TSV) SetData(data interface{}) error { // cast back to a string line, ok := data.(str...
document/tsv.go
0.740174
0.402421
tsv.go
starcoder
package goDataStructure import "fmt" type BSTreeMap struct { root *treeMapNode size int } type treeMapNode struct { key Comparable value interface{} left, right *treeMapNode } func CreateBSTreeMap() *BSTreeMap { return &BSTreeMap{ root: nil, size: 0, } } func (tm *BSTreeMap) Add(k interfac...
bsTreeMap.go
0.580233
0.438905
bsTreeMap.go
starcoder
package deref // BoolOr returns a dereferenced value or the given default value if p is nil. func BoolOr(p *bool, defVal bool) bool { if p == nil { return defVal } return *p } // Bool returns a dereferenced value or the zero value if p is nil. func Bool(p *bool) bool { var defVal bool return BoolOr(p, defVal) ...
ptr/deref/deref.go
0.808672
0.524516
deref.go
starcoder
package colors // package colors contains functions to quickly and easily generate tetra3d.Color instances by name (i.e. "White()", "Blue()", "Green()", etc). import "github.com/solarlune/tetra3d" // White generates a tetra3d.Color instance of the provided name. func White() *tetra3d.Color { return tetra3d.NewColor...
colors/colors.go
0.868618
0.542379
colors.go
starcoder
package keras import ( "math/rand" ) // Matrix type is a 2D slice of float64 Values. type Matrix struct { Matrix [][]float64 } // ColNum returns the number of columns in a matrix. func ColNum(m Matrix) int { return len(m.Matrix[len(m.Matrix)-1]) } // RowNum returns the number of rows in a matrix. func RowNum(m M...
keras/matrix.go
0.887564
0.813831
matrix.go
starcoder
package jopher import ( "errors" "reflect" ) // reflectFunction converts a supplied interface into a reflect.Value func reflectFunction(function interface{}) reflect.Value { reflected := reflect.ValueOf(function) if reflected.Kind() != reflect.Func { panic(errors.New("please supply a function")) } return re...
reflect.go
0.693473
0.416144
reflect.go
starcoder
// Package day17 solves AoC 2021 day 17. package day17 import ( "fmt" "math" "strconv" "github.com/fis/aoc/glue" "github.com/fis/aoc/util" ) func init() { glue.RegisterSolver(2021, 17, glue.RegexpSolver{ Solver: solve, Regexp: `^target area: x=(-?\d+)\.\.(-?\d+), y=(-?\d+)\.\.(-?\d+)$`, }) } func solve(...
2021/day17/day17.go
0.597256
0.401131
day17.go
starcoder
package tree import ( "strings" ) type Tree struct { Label string Children []*Tree } func (t *Tree) Walk(cb func(t *Tree)) { cb(t) for _, c := range t.Children { c.Walk(cb) } } func (t *Tree) WalkPositions(cb func(t *Tree, p []int), p []int) { cb(t, p) for s, c := range t.Children { c.WalkPositions...
pkg/tree/tree.go
0.619471
0.403743
tree.go
starcoder
package ms import "github.com/ContextLogic/cldr" var calendar = cldr.Calendar{ Formats: cldr.CalendarFormats{ Date: cldr.CalendarDateFormat{Full: "EEEE, d MMMM y", Long: "d MMMM y", Medium: "d MMM y", Short: "d/MM/yy"}, Time: cldr.CalendarDateFormat{Full: "h:mm:ss a zzzz", Long: "h:mm:ss a z", Medium: "h...
resources/locales/ms/calendar.go
0.533154
0.427337
calendar.go
starcoder
package influx2otel import ( "fmt" "strconv" "strings" "time" "github.com/influxdata/influxdb-observability/common" "go.opentelemetry.io/collector/model/pdata" ) func (b *MetricsBatch) addPointTelegrafPrometheusV2(measurement string, tags map[string]string, fields map[string]interface{}, ts time.Time, vType co...
influx2otel/metrics_telegraf_prometheus_v2.go
0.69368
0.608536
metrics_telegraf_prometheus_v2.go
starcoder
package constraint import ( "github.com/hecate-tech/engine/experimental/physics/equation" "github.com/hecate-tech/engine/math32" ) // Lock constraint. // Removes all degrees of freedom between the bodies. type Lock struct { PointToPoint rotEq1 *equation.Rotational rotEq2 *equation.Rotational rotE...
experimental/physics/constraint/lock.go
0.719975
0.435301
lock.go
starcoder
package main const SwaggerJSON = `{ "swagger": "2.0", "info": { "title": "BTrDB v4 API", "version": "v4.11.1" }, "schemes": [ "http", "https" ], "consumes": [ "application/json" ], "produces": [ "application/json" ], "paths": { "/v4/alignedwindows": { "post": { ...
tools/apifrontend/swagger.json.go
0.588298
0.433142
swagger.json.go
starcoder
package iso20022 // Security that is a sub-set of an investment fund, and is governed by the same investment fund policy, eg, dividend option or valuation currency. type FinancialInstrument22 struct { // Features of units offered by a fund. For example, a unit may have a specific load structure, eg, front end or bac...
FinancialInstrument22.go
0.843992
0.427875
FinancialInstrument22.go
starcoder
package core import ( "encoding/binary" "fmt" ) // All the Read* functions below will panic if something goes wrong. // ReadAt reads len(b) bytes at address a in the inferior // and stores them in b. func (p *Process) ReadAt(b []byte, a Address) { for { m := p.findMapping(a) if m == nil { panic(fmt.Errorf...
internal/core/read.go
0.640861
0.515925
read.go
starcoder
package aoc import ( "bufio" "bytes" "crypto/sha256" "fmt" "io" "math" "os" ) var ( DirectionUp Pos = Pos{0, -1} DirectionRight Pos = Pos{1, 0} DirectionDown Pos = Pos{0, 1} DirectionLeft Pos = Pos{-1, 0} ) type Pos struct { X int Y int } func NewPos(x, y int) Pos { return Pos{x, y} } func (p Po...
go/2019/grid.go
0.710226
0.480662
grid.go
starcoder
package gp import ( "github.com/xlvector/hector/core" "math" "strconv" ) type GaussianProcessParameters struct { Dim int64 Theta float64 } type GaussianProcess struct { Params GaussianProcessParameters CovarianceFunc CovFunc CovMatrix *core.Matrix TargetValues *core.Vector InvC...
vendor/github.com/xlvector/hector/gp/gaussian_process.go
0.723114
0.441191
gaussian_process.go
starcoder
package cmb import ( "bytes" "fmt" "math" "regexp" ) // Parselet is a single combinable recognizer of grammatical structure. type Parselet func(s []byte, pos int, parser *Parser) (*ParseTreeNode, error) // Rule matches a named production rule. func Rule(name string) Parselet { return func(s []byte, pos int, par...
parselets.go
0.618665
0.478773
parselets.go
starcoder
package types import ( "bytes" "fmt" "io" "math" "strconv" "reflect" "github.com/lyraproj/issue/issue" "github.com/lyraproj/pcore/px" ) type ( IntegerType struct { min int64 max int64 } // integerValue represents int64 as a pcore.Value integerValue int64 ) var IntegerTypePositive = &IntegerType{0,...
types/integertype.go
0.682362
0.411525
integertype.go
starcoder
package utils import ( "errors" "regexp" "strconv" ) // ExtractUserIDFromMention takes in a mention (<@ID>) and spits out only the ID. func ExtractUserIDFromMention(mention string) string { if len(mention) >= 3 && mention[:2] == "<@" && mention[len(mention)-1:] == ">" { return mention[2:][:len(mention)-3] // -3...
utils/utils.go
0.578924
0.404066
utils.go
starcoder
package tpdu // DeliverReport represents a SMS-Deliver-Report PDU as defined in 3GPP TS 23.038 Section 9.2.2.1a. type DeliverReport struct { TPDU FCS byte PI byte } // NewDeliverReport creates a DeliverReport TPDU and initialises non-zero fields. func NewDeliverReport() *DeliverReport { return &DeliverReport{TP...
encoding/tpdu/deliverreport.go
0.701509
0.68762
deliverreport.go
starcoder
package openpose import ( "math" tf "github.com/tensorflow/tensorflow/tensorflow/go" "github.com/tensorflow/tensorflow/tensorflow/go/op" ) // nonMaxSuppression uppress performs non-max suppression on a sorted list of detections. func nonMaxSuppression(imap [][]float32, scale float64, threshold float32) ([][]float...
nms.go
0.64969
0.459986
nms.go
starcoder
package blockchain import ( "bytes" "encoding/binary" "io" "math" "github.com/ubclaunchpad/cumulus/common/util" "gopkg.in/fatih/set.v0" ) // TxHashPointer is a reference to a transaction on the blockchain. type TxHashPointer struct { BlockNumber uint32 Hash Hash Index uint32 } // Marshal conve...
blockchain/transaction.go
0.804444
0.407628
transaction.go
starcoder
package stat import ( "math" "sort" ) type IntSlice struct { Data []int } func NewIntSlice(data []int) *IntSlice { return &IntSlice{Data: data} } // Sort sort data func (s *IntSlice) Sort() { sort.Ints(s.Data) } func (s *IntSlice) Percentile(p float64) float64 { if len(s.Data) == 0 { return 0 } k := fl...
stat/percentile.go
0.680135
0.417628
percentile.go
starcoder
package reactnative const ( deployWorkflowDescription = `Tests, builds and deploys the app using *Deploy to bitrise.io* Step. Next steps: - Set up an [Apple service with API key](https://devcenter.bitrise.io/en/accounts/connecting-to-services/connecting-to-an-apple-service-with-api-key.html). - Check out [Getting st...
vendor/github.com/bitrise-io/bitrise-init/scanners/reactnative/const.go
0.796609
0.558146
const.go
starcoder
package chain import ( "bytes" "fmt" "log" "strings" "github.com/edotau/goFish/simpleio" ) // Chain alignment fields. type Chain struct { Score int TName string TSize int TStrand byte TStart int TEnd int QName string QSize int QStrand byte QStart int QEnd int ...
chain/chain.go
0.580709
0.401688
chain.go
starcoder
package volume // Matrix is an array of Volumes type Matrix struct { StaticMatrix Channels int } // Apply takes a volume matrix and multiplies it by incoming volumes func (m Matrix) ApplyToMatrix(mtx Matrix) Matrix { if mtx.Channels == 0 { return m } if m.Channels == mtx.Channels { // simple straight-throug...
volume/matrix.go
0.86592
0.677179
matrix.go
starcoder
package math type Rect struct { Min, Max Point } func CreateRect(minX, minY, maxX, maxY int) Rect { return Rect{Point{minX, minY}, Point{maxX, maxY}} } func (r Rect) Mid() Point { return Point{ (r.Min.X + r.Max.X) / 2, (r.Min.Y + r.Max.Y) / 2, } } func (r Rect) W() int { return r.Max.X - r.Min.X } func (...
math/rect.go
0.877319
0.577019
rect.go
starcoder
package cryptypes import "database/sql/driver" // EncryptedInt64 supports encrypting Int64 data type EncryptedInt64 struct { Field Raw int64 } // Scan converts the value from the DB into a usable EncryptedInt64 value func (s *EncryptedInt64) Scan(value interface{}) error { return decrypt(value.([]byte), &s.Raw) }...
cryptypes/type_int64.go
0.800458
0.611817
type_int64.go
starcoder
package circuit import ( "sort" "github.com/heustis/tsp-solver-go/model" "github.com/heustis/tsp-solver-go/stats" ) const minimumSignificance = 1.0 const maxClones uint16 = 1000 // DisparityClonable relies on the following priniciples to approximate the smallest concave circuit: // 1. That the minimum convex hul...
circuit/disparityclonable.go
0.805364
0.710176
disparityclonable.go
starcoder
package ui import ( "github.com/gdamore/tcell/v2" "github.com/rivo/tview" ) const ( logo = ` ____ ____ | | ______ __| _/____ ____ | |/ / _ \ / __ |/ _ \ / _ \ | ( (_) ) /_/ ( (_) | (_) ) |__|_ \____/\____ |\____/ \____/ \/ \/ ` note = `[yell...
internal/ui/home.go
0.5083
0.445891
home.go
starcoder
package grader var _ BlockGrader = (*V2BlockGrader)(nil) // V2BlockGrader implements the V2 grading algorithm. // Entries are encoded in Protobuf with 25 winners each block. // Valid assets can be found in ´opr.V2Assets´ type V2BlockGrader struct { baseGrader } // Version 2 func (v2 *V2BlockGrader) Version() uint8 ...
modules/grader/v2grader.go
0.767341
0.437583
v2grader.go
starcoder
package main const pikari = `/** * @file Pikari API * @see https://github.com/olliNiinivaara/Pikari * @author <NAME> * @copyright <NAME> 2019 * @license MIT * @version 0.9 */ /** @namespace * @description The global Pikari object. To initialize, add listeners and call {@link Pikari.start}. * @global * */ window.Pika...
pikarijs.go
0.885953
0.465205
pikarijs.go
starcoder
// Package geo contains the base types for spatial data type operations. package geo import ( "github.com/cockroachdb/cockroach/pkg/geo/geopb" "github.com/cockroachdb/cockroach/pkg/geo/geos" "github.com/golang/geo/s2" "github.com/twpayne/go-geom" "github.com/twpayne/go-geom/encoding/ewkb" // Force these into ve...
pkg/geo/geo.go
0.53048
0.431225
geo.go
starcoder
package entropy import ( "bufio" "fmt" "io" "math" "strings" ) // NGramCounter contains counts and totals for Ngrams of a // particular size type NGramCounter struct { Size int Counts map[string]uint64 Total uint64 } // NewNGramCounter returns a new ngram counter func NewNGramCounter(maxNGramSize int) (co...
entropy.go
0.750278
0.40869
entropy.go
starcoder
package bwt import ( "fmt" "sort" "strings" ) // Bstring holds one ciclic permutation of the input strig to BWT type Bstring struct { Pos int Ch string } // Bstrings holds a list of Bstring type Bstrings []Bstring // FIXME: This sucks big time. Was the quickest thing to get sorting work though....
burrows_wheeler_transform.go
0.534855
0.520984
burrows_wheeler_transform.go
starcoder
package state import ( "bytes" "fmt" "github.com/cc14514/go-ydcoin/common" "github.com/cc14514/go-ydcoin/rlp" "github.com/cc14514/go-ydcoin/trie" ) // NodeIterator is an iterator to traverse the entire state trie post-order, // including all of the contract code and contract state tries. type NodeIterator stru...
core/state/iterator.go
0.58439
0.514644
iterator.go
starcoder
package main import ( "fmt" "strings" ) // marshal creates a function that encodes the structs in SSZ format. It creates two functions: // 1. MarshalTo(dst []byte) marshals the content to the target array. // 2. Marshal() marshals the content to a newly created array. func (e *env) marshal(name string, v *Value) st...
sszgen/marshal.go
0.657648
0.422743
marshal.go
starcoder
package phy import ( "math" "github.com/Tnze/go-mc/bot/world" ) type MinMax struct { Min, Max float64 } // Extends adjusts the bounds of the MinMax. A negative number will reduce the // minimum bound, whereas a positive number will increase the maximum bound. func (mm MinMax) Extend(delta float64) MinMax { if d...
bot/phy/aabb.go
0.864682
0.72829
aabb.go
starcoder
package v1 func (CloudInitNoCloudSource) SwaggerDoc() map[string]string { return map[string]string{ "": "Represents a cloud-init nocloud user data source.\nMore info: http://cloudinit.readthedocs.io/en/latest/topics/datasources/nocloud.html", "secretRef": "UserDataSecretRef references a k8s se...
pkg/api/v1/schema_swagger_generated.go
0.891162
0.41739
schema_swagger_generated.go
starcoder
package input import ( "context" "fmt" "time" "github.com/benthosdev/benthos/v4/internal/component/input" "github.com/benthosdev/benthos/v4/internal/component/metrics" "github.com/benthosdev/benthos/v4/internal/docs" "github.com/benthosdev/benthos/v4/internal/interop" "github.com/benthosdev/benthos/v4/interna...
internal/old/input/resource.go
0.627381
0.509642
resource.go
starcoder
package sq import ( "bytes" "fmt" "strings" ) // InsertBuilder builds SQL INSERT statements. type InsertBuilder interface { // Prefix adds an expression to the beginning of the query. Prefix(sql string, args ...interface{}) InsertBuilder // Options adds keyword options before the INTO clause of the query. Opt...
insert.go
0.583441
0.406862
insert.go
starcoder
package yqlib import ( "container/list" "fmt" yaml "gopkg.in/yaml.v3" ) func entrySeqFor(key *yaml.Node, value *yaml.Node) *yaml.Node { var keyKey = &yaml.Node{Kind: yaml.ScalarNode, Tag: "!!str", Value: "key"} var valueKey = &yaml.Node{Kind: yaml.ScalarNode, Tag: "!!str", Value: "value"} return &yaml.Node{ ...
pkg/yqlib/operator_entries.go
0.526099
0.434221
operator_entries.go
starcoder
package streamer import ( "github.com/lyraproj/dgo/dgo" "github.com/lyraproj/dgo/vf" ) // A BasicCollector is an extendable basic implementation of the Consumer interface type BasicCollector struct { // Values is an array of all values that are added to the BasicCollector. When adding // a reference, the referenc...
streamer/basiccollector.go
0.802362
0.46478
basiccollector.go
starcoder
package preprocessing import ( "github.com/Wieku/gosu-pp/beatmap/difficulty" "github.com/Wieku/gosu-pp/beatmap/objects" "github.com/Wieku/gosu-pp/math/math32" "github.com/Wieku/gosu-pp/math/vector" "math" ) const ( NormalizedRadius = 50.0 CircleSizeBuffThreshold = 30.0 MinDeltaTime = 25 ) t...
performance/osu/preprocessing/object.go
0.679285
0.443239
object.go
starcoder
package casbin import "github.com/Knetic/govaluate" // GetAllSubjects gets the list of subjects that show up in the current policy. func (e *Enforcer) GetAllSubjects() []string { return e.model.GetValuesForFieldInPolicyAllTypes("p", 0) } // GetAllNamedSubjects gets the list of subjects that show up in the current ...
management_api.go
0.762778
0.420897
management_api.go
starcoder
package graph import ( i04eb5309aeaafadd28374d79c8471df9b267510b4dc2e3144c378c50f6fd7b55 "github.com/microsoft/kiota/abstractions/go/serialization" ) // AverageComparativeScore provides operations to manage the security singleton. type AverageComparativeScore struct { // Stores additional data not described i...
models/microsoft/graph/average_comparative_score.go
0.831246
0.406626
average_comparative_score.go
starcoder
package utils /* * bit.go - some collection of bitwise operations * see more @ * - https://en.wikipedia.org/wiki/Bitwise_operation * - https://en.wikipedia.org/wiki/Bitwise_operations_in_C * - http://www.cprogramming.com/tutorial/bitwise_operators.html * - https://discuss.leetcode.com/topic/50315/ */ import...
utils/bit.go
0.830181
0.489442
bit.go
starcoder
package parse import ( "fmt" "go/ast" "strings" ) func parseLiteralExpression(expr *ast.BasicLit) *Expression { // Literal value of int: 0, 1, 2, ... res := &Expression{ Type: ExpressionTypeDefault, Name: expr.Value, NameType: strings.ToLower(expr.Kind.String()), } return res } func parseIdenti...
parse/expression_parse.go
0.520009
0.497253
expression_parse.go
starcoder
package condition import ( "encoding/json" "github.com/Jeffail/benthos/lib/log" "github.com/Jeffail/benthos/lib/metrics" "github.com/Jeffail/benthos/lib/types" ) //------------------------------------------------------------------------------ func init() { Constructors[TypeNot] = TypeSpec{ constructor: NewN...
lib/processor/condition/not.go
0.722918
0.714697
not.go
starcoder
package iso20022 // Summary information about amount financed. type FinancingAllowedSummary1 struct { // Number of invoices/instalments financed. FinancedItemNumber *Number `xml:"FincdItmNb"` // Sum of the original total amounts of the invoices accepted for financing. TotalAcceptedItemsAmount *ActiveCurrencyAndA...
FinancingAllowedSummary1.go
0.831998
0.405272
FinancingAllowedSummary1.go
starcoder
package math32 // Plane represents a plane in 3D space by its normal vector and a constant. // When the the normal vector is the unit vector the constant is the distance from the origin. type Plane struct { normal Vector3 constant float32 } // NewPlane creates and returns a new plane from a normal vector and a c...
math32/plane.go
0.93315
0.845751
plane.go
starcoder
package assertions import ( "fmt" "reflect" ) import ( "github.com/smartystreets/oglematchers" ) // ShouldContain receives exactly two parameters. The first is a slice and the // second is a proposed member. Membership is determined using ShouldEqual. func ShouldContain(actual interface{}, expected ...interface{}...
src/github.com/smartystreets/goconvey/assertions/collections.go
0.79909
0.602909
collections.go
starcoder
package onshape import ( "encoding/json" ) // BTPAnnotation231 struct for BTPAnnotation231 type BTPAnnotation231 struct { Atomic *bool `json:"atomic,omitempty"` BtType *string `json:"btType,omitempty"` DocumentationType *string `json:"documentationType,omitempty"` EndSourceLocation *int32 `json:"endSourceLocatio...
onshape/model_btp_annotation_231.go
0.76882
0.452354
model_btp_annotation_231.go
starcoder
package ugfx import ( "image" "image/png" "math" "os" ) // Describes a literal color using four 32-bit floating-point numbers in RGBA order. type Rgba32 struct { // Red component R float32 // Green component G float32 // Blue component B float32 // Alpha component A float32 } // Conv...
util/gfx/gfx.go
0.746046
0.424054
gfx.go
starcoder
package card import ( "context" "github.com/xendit/xendit-go" ) /* Charge */ // CreateCharge creates new card charge func CreateCharge(data *CreateChargeParams) (*xendit.CardCharge, *xendit.Error) { return CreateChargeWithContext(context.Background(), data) } // CreateChargeWithContext creates new card charge w...
card/card.go
0.719186
0.503906
card.go
starcoder
package iex // BalanceSheets pulls balance sheet data. Available quarterly (4 quarters) and // annually (4 years). type BalanceSheets struct { Symbol string `json:"symbol"` Statements []BalanceSheet `json:"balancesheet"` } // BalanceSheet models one balance sheet statement. Normally the amounts // retu...
stocks.go
0.708616
0.424949
stocks.go
starcoder
package interp import ( "fmt" "math" "strconv" "github.com/benhoyt/goawk/internal/strutil" ) type valueType uint8 const ( typeNull valueType = iota typeStr typeNum typeNumStr ) // An AWK value (these are passed around by value) type value struct { typ valueType // Type of value s string // String v...
interp/value.go
0.705075
0.453504
value.go
starcoder
package factor import ( "fmt" "math/big" "sort" "strings" ) // Value captures a single factor. It is either a number or a symbol. type Value struct { num *big.Rat pow int sym string } // IsNum indicates that v is a rational number. func (v Value) IsNum() bool { return v.num != nil } // Num simply returns t...
src/algex/factor/factor.go
0.747247
0.525004
factor.go
starcoder
package work import ( "context" "database/sql" "time" ) type DayStats struct { Date time.Time Total time.Duration Worked time.Duration Expected time.Duration } type Stats struct { Total time.Duration Worked time.Duration Expected time.Duration DayStats []DayStats From time.Time To ...
stats.go
0.576423
0.407333
stats.go
starcoder
package constraint import ( "reflect" "strings" "time" "github.com/jt0/gomer/flect" "github.com/jt0/gomer/gomerr" ) type ComparisonType = string const ( EQ ComparisonType = "EQ" NEQ = "NEQ" GT = "GT" GTE = "GTE" LT = "LT" LTE =...
constraint/comparison.go
0.773088
0.586404
comparison.go
starcoder
package spec import ( "testing" "time" "github.com/256dpi/gomqtt/client" "github.com/256dpi/gomqtt/packet" "github.com/stretchr/testify/assert" ) // OfflineSubscriptionTest tests the broker for properly handling offline // subscriptions. func OfflineSubscriptionTest(t *testing.T, config *Config, topic string, ...
spec/offline.go
0.62681
0.493226
offline.go
starcoder
package examples import ( "encoding/json" "fmt" "os" ) // Go offers built-in support for JSON encoding and decoding, // including to and from built-in and custom data types. // We’ll use these two structs to demonstrate encoding and decoding of custom types below. type response1 struct { Page int Fruits []str...
examples/json.go
0.695648
0.422803
json.go
starcoder
package spdx // CreationInfo2_1 is a Document Creation Information section of an // SPDX Document for version 2.1 of the spec. type CreationInfo2_1 struct { // 2.1: SPDX Version; should be in the format "SPDX-2.1" // Cardinality: mandatory, one SPDXVersion string // 2.2: Data License; should be "CC0-1.0" // Ca...
spdx/creation_info.go
0.679498
0.452717
creation_info.go
starcoder
package rrule import "time" // validFunc is a kind of function that checks if a time is valid against a rule. It returns true if the time is valid. // A pointer is accepted in order to avoid the memory copy of the entire time structure. Nil is never considered valid. type validFunc func(t *time.Time) bool func alway...
validators.go
0.70253
0.554591
validators.go
starcoder
// Package entity defines entities used in sdk package entity import ( "encoding/binary" "errors" "math" "github.com/milvus-io/milvus-sdk-go/internal/proto/schema" ) //go:generate go run gen/gen.go // Column interface field type for column-based data frame type Column interface { Name() string Type() FieldTy...
entity/columns.go
0.632843
0.406626
columns.go
starcoder
package dht import ( "math" "math/big" ) // Full token range. const ( Murmur3MinToken = int64(math.MinInt64) Murmur3MaxToken = int64(math.MaxInt64) ) // Murmur3Partitioner see // https://github.com/scylladb/scylla/blob/master/dht/murmur3_partitioner.hh // https://github.com/scylladb/scylla/blob/master/dht/murmu...
pkg/dht/murmur3partitioner.go
0.77081
0.413359
murmur3partitioner.go
starcoder
package cmd import ( "io" "github.com/minio/minio/pkg/bpool" ) // ReadFile reads as much data as requested from the file under the given volume and path and writes the data to the provided writer. // The algorithm and the keys/checksums are used to verify the integrity of the given file. ReadFile will read data fr...
cmd/erasure-readfile.go
0.501465
0.4184
erasure-readfile.go
starcoder
package main import ( "flag" "fmt" "math" "math/cmplx" "github.com/pointlander/datum/iris" ) const ( // LFSRMask is a LFSR mask with a maximum period LFSRMask = 0x80000057 // LFSRInit is an initial LFSR state LFSRInit = 0x55555555 ) var ( // FlagXOR xor flag FlagXOR = flag.Bool("xor", false, "xor mode")...
main.go
0.59749
0.439567
main.go
starcoder
package model /* we deviate from the Constructor convention (New...) by intention, to enable concise expressions like a := And(Equals(Variable(7), Variable(6)), Equals(Variable(5), Variable(5))) */ type Expression interface { Interprete(map[string]Expression) bool //Interprete(Map<String,Expression> variables) b...
model/interpreter.go
0.808483
0.683183
interpreter.go
starcoder
package renderer import ( "math" "math/rand" ) type PathTracer struct { } var defaultColor Vector3 = NewVector3(0, 0, 0) var M_PI float64 = math.Pi var M_1_PI float64 = 1. / M_PI var nbSamples int = 4 func (r PathTracer) Sample(x, y uint, camera Camera, scene Scene, options RenderingOptions, rnd *rand.Rand) Vect...
renderer/pathtracer.go
0.790288
0.551393
pathtracer.go
starcoder
package math type Box3 struct { min Vector3 max Vector3 } // Equivalent to makeEmpty func NewDefaultBox3() *Box3 { return NewBox3( NewVector3Inf(1), NewVector3Inf(-1), ) } func NewBox3(min *Vector3, max *Vector3) *Box3 { return &Box3{ min: Vector3{Vector2: Vector2{X: min.X, Y: min.Y}, Z: min.Z}, max: Ve...
box3.go
0.864839
0.593315
box3.go
starcoder
package jsonassert import ( "fmt" ) // Printer is any type that has a testing.T-like Errorf function. // You probably want to pass in a *testing.T instance here if you are using // this in your tests. type Printer interface { Errorf(msg string, args ...interface{}) } // Asserter represents the main type within the...
exports.go
0.728941
0.471223
exports.go
starcoder
package main import ( "fmt" "math" "math/bits" "sort" "github.com/pointlander/datum/iris" ) // SharedLayer is a neural network layer with shared weights type SharedLayer struct { Rows int Columns int Weights []float32 Rand Rand } // SharedNetwork is a neural network with shared weights type SharedNe...
shared.go
0.600657
0.426979
shared.go
starcoder
package multicrc import ( "sync" ) //Params describes the parameters of a CRC. It also contains a table that is calculated on first use, //therefore it is best to share the params as much as possible type Params struct { Len uint Name string Polynomial uint64 ReflectInput bool ReflectOutp...
multicrc/core.go
0.573798
0.404096
core.go
starcoder
package goassessment // SLICES // For those functions that take a slice as input and return a slice, // you can either modify the input slice or make a copy for the return // the tests don't require that the input slice is not modified // write a function that returns the index of an item in a slice func indexOf(a []...
app/slices.go
0.815196
0.424173
slices.go
starcoder
package wasmlib import ( "encoding/binary" "strconv" ) type ScImmutableAddress struct { objId int32 keyId Key32 } func (o ScImmutableAddress) Exists() bool { return Exists(o.objId, o.keyId, TYPE_ADDRESS) } func (o ScImmutableAddress) String() string { return o.Value().String() } func (o ScImmutableAddress) ...
packages/vm/wasmlib/immutable.go
0.649245
0.435121
immutable.go
starcoder
package asp import ( "reflect" "strings" ) // FindTarget returns the statement in a BUILD file that corresponds to a target // of the given name (or nil if one does not exist). func FindTarget(statements []*Statement, name string) (target *Statement) { WalkAST(statements, func(stmt *Statement) bool { if arg := F...
src/parse/asp/util.go
0.707
0.407569
util.go
starcoder
package main import ( "fmt" "log" "sort" ) /* Activity Selection Problem Greedy Algorithm - 1 ------------------------------------------------------- You are given n activities with their start and finish times. Select the maximum number of activities that can be performed by a single person, assuming that...
Golang/Greedy Algorithms/activitySelection.go
0.589716
0.406567
activitySelection.go
starcoder
package framework import ( "fmt" "github.com/onsi/ginkgo" "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), ex...
e2e/framework/helper.go
0.745491
0.575916
helper.go
starcoder
package pack import "io" // A Match is the basic unit of LZ77 compression. type Match struct { Unmatched int // the number of unmatched bytes since the previous match Length int // the number of bytes in the matched string; it may be 0 at the end of the input Distance int // how far back in the stream to copy ...
pack.go
0.611266
0.571707
pack.go
starcoder
package transform import ( "errors" "fmt" "reflect" "strconv" "strings" ) // Note: isEmpty panics if v is nil. func isEmpty(v interface{}) bool { value := reflect.ValueOf(v) switch value.Kind() { case reflect.Slice, reflect.Map, reflect.Array, reflect.String, reflect.Chan: return value.Len() == 0 } return...
extensions/omniv21/transform/value.go
0.500488
0.447823
value.go
starcoder
package pdf import ( "fmt" "strings" "github.com/jung-kurt/gofpdf" ) var Formats = map[string]gofpdf.SizeType{ "100x70": gofpdf.SizeType{Wd: 707.00, Ht: 1000.00}, "36x90_standard": gofpdf.SizeType{Wd: 914.40, Ht: 2286.00}, "500x700": gofpdf.SizeType{Wd: 500.00, Ht: 700.00}, "50x70": ...
internal/pdf/formats.go
0.534612
0.685242
formats.go
starcoder
package preview import ( "bytes" "errors" "fmt" ) // MediaPart has the binary data expected after downloading a PieceRange from the // DownloadPlan. So, usually it's going to be a partial video from a Torrent. type MediaPart struct { torrentID string pieceRange PieceRange data []byte } // NewMediaPart c...
internal/preview/media.go
0.742328
0.617945
media.go
starcoder
package base import ( r "reflect" ) func KindToCategory(k r.Kind) r.Kind { switch k { case r.Int, r.Int8, r.Int16, r.Int32, r.Int64: return r.Int case r.Uint, r.Uint8, r.Uint16, r.Uint32, r.Uint64, r.Uintptr: return r.Uint case r.Float32, r.Float64: return r.Float64 case r.Complex64, r.Complex128: retur...
vendor/github.com/cosmos72/gomacro/base/literal.go
0.666171
0.480235
literal.go
starcoder
package wordShuffler import ( "fmt" "sort" ) type GramSequencer struct { // the sequence involved for "word" formation and matching later on Sequence string // the rule implementation on formulation of "words" based on the given sequence shuffleRule AdvanceSuffleRule // the rule implementa...
GramSequencer.go
0.720368
0.475118
GramSequencer.go
starcoder
package schema import ( "github.com/graphql-go/graphql" "github.com/ob-vss-ss18/ppl-stock/models" ) var skiType = graphql.NewObject(graphql.ObjectConfig{ Name: "Ski", Description: "A ski.", Fields: graphql.Fields{ "id": &graphql.Field{ Type: graphql.NewNonNull(graphql.Int), Description: "T...
schema/ski.go
0.517571
0.468487
ski.go
starcoder
package staticarray import ( "github.com/influxdata/flux/array" "github.com/influxdata/flux/memory" "github.com/influxdata/flux/semantic" ) type floats struct { data []float64 alloc *memory.Allocator } func Float(data []float64) array.Float { return &floats{data: data} } func (a *floats) Type() semantic.Type...
internal/staticarray/float.go
0.67822
0.53959
float.go
starcoder
package main import "fmt" type visitor interface { visitForSquare(*square) visitForCircle(*circle) visitForRectangle(*rectangle) } //square квадрат type square struct { side int } //rectangle треугольник type rectangle struct { l int b int } //circle круг type circle struct { radius in...
pattern/03_visiter.go
0.639173
0.525917
03_visiter.go
starcoder