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 stats import "math" // ClassMetrics provides methods to calculate Precision, Recall, F1Score, Accuracy // and other metrics useful to analyze the accuracy of a classifier. type ClassMetrics struct { TruePos int // The number of true positive results (correctly marked as positive) TrueNeg int // The numbe...
pkg/ml/stats/classmetrics.go
0.894055
0.694601
classmetrics.go
starcoder
package tarjan // Graph is a directed graph containing the vertex name and their Edges. type Graph map[string]Edges // Edges is a set of edges for a vertex. type Edges map[string]struct{} // SCC returns the strongly connected components of the given Graph. func SCC(g Graph) [][]string { t := tarjan{ g: g, inde...
runtime/internal/tarjan/tarjan.go
0.755817
0.587884
tarjan.go
starcoder
package filter import ( "bytes" "github.com/hidal-go/hidalgo/values" ) type ValueFilter interface { FilterValue(v values.Value) bool } type SortableFilter interface { ValueFilter FilterSortable(v values.Sortable) bool // ValuesRange returns an optional range of value that matches the filter. // It is used as...
filter/filters.go
0.793826
0.548734
filters.go
starcoder
package dataframe import ( "github.com/AdikaStyle/go-df/backend" "github.com/AdikaStyle/go-df/conds" "github.com/AdikaStyle/go-df/types" ) type defaultJoinable struct { df Dataframe } func newDefaultJoinable(df Dataframe) *defaultJoinable { return &defaultJoinable{df: df} } func (this *defaultJoinable) LeftJoi...
dataframe/default_joinable.go
0.572484
0.429489
default_joinable.go
starcoder
package parser import ( "github.com/itchyny/gojq" "github.com/pkg/errors" ) // postProcessQuery processes query to allow the realization of the special `assertThat` function. // Generally, functions defined via `def` may receive filters as arguments, but builtin functions will only ever see // the concrete values. ...
internal/parser/post_process.go
0.743634
0.450843
post_process.go
starcoder
package d2 import ( "strconv" "strings" "github.com/adamcolton/geom/angle" "github.com/adamcolton/geom/calc/cmpr" "github.com/adamcolton/geom/geomerr" ) // Pt represets a two dimensional point. type Pt D2 // Pt is defined on Pt to fulfill Point func (pt Pt) Pt() Pt { return pt } // V converts Pt to V func (pt...
d2/pt.go
0.851753
0.616416
pt.go
starcoder
package year2021 import ( "github.com/lanphiergm/adventofcodego/internal/utils" ) // Chiton Part 1 computes the lowest total risk level for a path through the cave func ChitonPart1(filename string) interface{} { grid := parseChitonGrid(filename) return relaxGrid(&grid) } // Chiton Part 2 computes the lowest total...
internal/puzzles/year2021/day_15_chiton.go
0.648021
0.434341
day_15_chiton.go
starcoder
package graphics import ( "github.com/inkyblackness/shocked-client/opengl" ) // ColorsPerPalette defines how many colors are per palette. This value is 256 to cover byte-based bitmaps. const ColorsPerPalette = 256 // BytesPerRgba defines the byte count for an RGBA color value. const BytesPerRgba = 4 // ColorProvid...
src/github.com/inkyblackness/shocked-client/graphics/PaletteTexture.go
0.820073
0.433142
PaletteTexture.go
starcoder
package osm import ( "encoding/json" "sort" ) // Polygon returns true if the way should be considered a closed polygon area. // OpenStreetMap doesn't have an intrinsic area data type. The algorithm used // here considers a set of heuristics to determine what is most likely an area. // The heuristics can be found he...
polygon.go
0.672654
0.436682
polygon.go
starcoder
package object_storage import ( "encoding/json" ) // DataVectorResult Time series containing a single sample for each time series, all sharing the same timestamp type DataVectorResult struct { // The data points' labels Metric *map[string]string `json:"metric,omitempty"` Value *DataValue `json:"value,omitempty"` ...
pkg/object_storage/model_data_vector_result.go
0.80406
0.605828
model_data_vector_result.go
starcoder
package version import ( "bytes" "fmt" "strings" "text/scanner" ) type constraintExpression struct { units [][]constraintUnit // only supports or'ing a group of and'ed groups comparators [][]Comparator // only supports or'ing a group of and'ed groups } func newConstraintExpression(phrase string, genF...
grype/version/constraint_expression.go
0.683736
0.417806
constraint_expression.go
starcoder
package models import ( "database/sql" "database/sql/driver" "encoding/json" "errors" "fmt" ) var ErrExampleTypeInvalid = errors.New("ExampleType is invalid") func init() { var v ExampleType if _, ok := interface{}(v).(fmt.Stringer); ok { defExampleTypeNameToValue = map[string]ExampleType{ interface{}(te...
models/exampletype_enums.go
0.617397
0.430686
exampletype_enums.go
starcoder
package vm import ( "reflect" "strings" ) type theArrayVectorType struct{} func (t *theArrayVectorType) String() string { return t.Name() } func (t *theArrayVectorType) Type() ValueType { return TypeType } func (t *theArrayVectorType) Unbox() interface{} { return reflect.TypeOf(t) } func (lt *theArrayVecto...
pkg/vm/vector.go
0.568416
0.517083
vector.go
starcoder
package view import ( "image" "github.com/mewmew/pgg/grid" ) // A View is a visible portion of the screen. type View struct { // The width and height of the view. Width, Height int // The width and height of the view in number of columns and rows // respectively. cols, rows int // The pixel offset between th...
view/view.go
0.710327
0.600364
view.go
starcoder
package binarysearchtree // BinarySearchTree is a binary search tree of ints. type BinarySearchTree struct { root *Node size int } // New creates a binary search tree of ints. func New() *BinarySearchTree { return &BinarySearchTree{} } // Insert adds a value to the binary search tree. func (bts *BinarySearchTree)...
binarysearchtree/binarysearchtree.go
0.908546
0.486027
binarysearchtree.go
starcoder
package canvas import ( "encoding/json" "golang.org/x/xerrors" ) const backgroundChar = '-' type Canvas struct { Name string `json:"name,omitempty"` Width uint `json:"width"` Height uint `json:"height"` Data []byte `json:"data,omitempty"` } func (c *Canvas) MarshalBinary() (data []byte, err error) {...
pkg/canvas/canvas.go
0.80954
0.45944
canvas.go
starcoder
package gdual // square, upper triangular Toeplitz matrix type UpperTriToeplitz struct { order int val []float64 } func NewUpperTriToeplitz(order int) *UpperTriToeplitz { mat := &UpperTriToeplitz{ order: order, val: make([]float64, order), } return mat } func importUpperTriToeplitz(val []float64) *Uppe...
matrix.go
0.864368
0.529872
matrix.go
starcoder
package prjn import ( "github.com/emer/emergent/evec" "github.com/emer/etable/etensor" "github.com/goki/mat32" ) // Circle implements a circular pattern of connectivity between two layers // where the center moves in proportion to receiver position with offset // and multiplier factors, and a given radius is used...
prjn/circle.go
0.742795
0.556882
circle.go
starcoder
package gouldian /* Endpoint is a composable function that abstract HTTP endpoint. The function takes HTTP request and returns value of some type: `Context => Output`. ↣ `Context` is a wrapper over HTTP request with additional context. ↣ `Output` is sum type that represents if it is matched on a given input or not....
endpoint.go
0.797044
0.400779
endpoint.go
starcoder
package v2d import "github.com/chewxy/math32" type Transform interface { // TransVec applies this Transform to a vector TransVec(Vec) Vec // TransRect applies this transform to a rectangle. Note that since rectangles always are axis // aligned the transformed rectangle will fully enclose the original rectangle. ...
trans.go
0.767341
0.644463
trans.go
starcoder
package costmodel import ( costAnalyzerCloud "github.com/kubecost/cost-model/pkg/cloud" "github.com/kubecost/cost-model/pkg/util" "k8s.io/klog" ) // NetworkUsageVNetworkUsageDataector contains the network usage values for egress network traffic type NetworkUsageData struct { ClusterID string PodName ...
pkg/costmodel/networkcosts.go
0.572962
0.492188
networkcosts.go
starcoder
package csg import ( "fmt" "strings" ) // BSP holds a node in a BSP tree. A BSP tree is built from a collection of // polygons by picking a polygon to split along. That polygon (and all other // coplanar polygons) are added directly to that node and the other polygons // are added to the front and/or back subtrees....
bsp.go
0.747063
0.536191
bsp.go
starcoder
package math import ( "errors" ) type Polygon struct { localVertices []float32 worldVertices []float32 dirty bool origin Vector2 position Vector2 rotation float32 scalar Vector2 bounds *Rectangle } func NewPolygon(vertices []float32) (*Polygon, error) { if len(vertice...
polygon.go
0.778944
0.703424
polygon.go
starcoder
package universe import ( "github.com/apache/arrow/go/v7/arrow/memory" "github.com/influxdata/flux" "github.com/influxdata/flux/array" "github.com/influxdata/flux/arrow" ) type derivativeInt struct { t int64 v int64 isValid bool unit float64 nonNegative bool initialized bool ...
stdlib/universe/derivative.gen.go
0.838415
0.541894
derivative.gen.go
starcoder
package main import ( "bytes" "fmt" "go/format" "io/ioutil" "log" "strings" "text/template" ) var opcodePrototypes = []opcodeProto{ {"LoadScalarConst", "op dst:wslot value:scalarindex"}, {"LoadStrConst", "op dst:wslot value:strindex"}, {"Zero", "op dst:wslot"}, {"Move", "op dst:wslot src:rslot"}, {"Move...
internal/bytecode/gen_opcodes.go
0.513912
0.47098
gen_opcodes.go
starcoder
package imageutil import ( "image" "image/color" "math" ) func Invert(img ImageReader) ImageReader { var ( invertedImage ImageReadWriter pp PP ) bounds := img.Bounds() switch img.(type) { case *image.Alpha, *image.Alpha16: return img case *image.Gray: invertedImage = image.NewGray(bounds)...
filter.go
0.703142
0.485783
filter.go
starcoder
package channel import ( "errors" "fmt" "io" ) // ThousandOp holds the data necessary to call ten HunredOps. type ThousandOp struct { op1 *HundredOp op2 *HundredOp op3 *HundredOp op4 *HundredOp op5 *HundredOp op6 *HundredOp op7 *HundredOp op8 *HundredOp op9 *HundredOp op10 *HundredOp } // NewTh...
channel/channel.go
0.584627
0.553867
channel.go
starcoder
package mqttp // ConnAck The CONNACK Packet is the packet sent by the Server in response to a CONNECT Packet // received from a Client. The first packet sent from the Server to the Client MUST // be a CONNACK Packet [MQTT-3.2.0-1]. // If the Client does not receive a CONNACK Packet from the Server within a reasonable...
mqttp/connack.go
0.730482
0.408395
connack.go
starcoder
package iso20022 // Payment obligation contracted between two financial institutions related to the financing of a commercial transaction. type PaymentObligation2 struct { // Bank that has to pay under the obligation. ObligorBank *BICIdentification1 `xml:"OblgrBk"` // Bank that will be paid under the obligation. ...
PaymentObligation2.go
0.708515
0.518973
PaymentObligation2.go
starcoder
package model import ( "database/sql" "errors" ) /* | Table Name | Column Name | Position | Matches | Qty | | ------------------------------------- | --------------------------------- | -------- | -------------------------------------...
model/columns.go
0.569853
0.445891
columns.go
starcoder
package model import ( "fmt" "google.golang.org/protobuf/proto" "gorm.io/gorm" ) // GormQuiz is the persisted version of the Quiz proto type GormQuiz struct { gorm.Model // ProtoData contains the serialized Quiz proto ProtoData []byte // GormQuestions are the persisted questions in this quiz GormQuestions [...
model/gormquiz.go
0.64791
0.409044
gormquiz.go
starcoder
// Copyright 2021 The Go Authors. All rights reserved. // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. // Package metrics provides tracking arbitrary metrics composed of // values of comparable types. package main import ( "fmt" "sort" "sync" ) // _Metric1 ...
test/typeparam/metrics.go
0.803714
0.412412
metrics.go
starcoder
package io import ( "encoding/csv" "encoding/gob" "fmt" "io" "math" "os" "strconv" "golem/pkg/model" mat "github.com/nlpodyssey/spago/pkg/mat32" ) // DataInstance holds data for a single data point. type DataRecord struct { // ContinuousFeatures contains the raw value of the continuous features // these...
pkg/io/io.go
0.683314
0.464476
io.go
starcoder
package hangulsimilarity import ( "regexp" "strings" ) // CompareBySyllables returns similarity of given two strings // based on the common syllables. func CompareBySyllables(first, second string) float64 { var similarity float64 var common int first = strings.TrimSpace(first) second = strings.TrimSpace(second...
week01/hangulSimilarity/src/hangulsimilarity/hangulSimilarity.go
0.809653
0.431524
hangulSimilarity.go
starcoder
package mockrequire import ( mockassert "github.com/derision-test/go-mockgen/testutil/assert" "github.com/stretchr/testify/require" ) // Called asserts that the mock function object was called at least once. func Called(t require.TestingT, mockFn interface{}, msgAndArgs ...interface{}) { if !mockassert.Called(t, m...
testutil/require/require.go
0.509276
0.413063
require.go
starcoder
package DG2D import ( "math" "github.com/notargets/gocfd/DG1D" "github.com/notargets/gocfd/utils" ) func Vandermonde2D(N int, r, s utils.Vector) (V2D utils.Matrix) { V2D = utils.NewMatrix(r.Len(), (N+1)*(N+2)/2) a, b := RStoAB(r, s) var sk int for i := 0; i <= N; i++ { for j := 0; j <= (N - i); j++ { V2D...
DG2D/element_utils.go
0.600423
0.637031
element_utils.go
starcoder
package querytee import ( "encoding/json" "fmt" "math" "github.com/go-kit/kit/log/level" "github.com/pkg/errors" "github.com/prometheus/common/model" util_log "github.com/cortexproject/cortex/pkg/util/log" ) // SamplesComparatorFunc helps with comparing different types of samples coming from /api/v1/query an...
tools/querytee/response_comparator.go
0.7478
0.429908
response_comparator.go
starcoder
package vocabulary import ( metrics "github.com/googleapis/gnostic/metrics" ) // mapIntersection finds the intersection between two Vocabularies. // This function takes a Vocabulary and checks if the words within // the current Vocabulary already exist within the global Vocabulary. // If the word exists in both str...
metrics/vocabulary/intersection.go
0.677794
0.418459
intersection.go
starcoder
package header /** * A CSeq header field in a request contains a single decimal sequence number * and the request method. The CSeq header field serves to identify and order * transactions within a dialog, to provide a means to uniquely identify * transactions, and to differentiate between new requests and request ...
sip/header/CSeqHeader.go
0.894375
0.606265
CSeqHeader.go
starcoder
package mapval import "fmt" // Results the results of executing a schema. // They are a flattened map (using dotted paths) of all the values []ValueResult representing the results // of the IsDefs. type Results struct { Fields map[string][]ValueResult Valid bool } // NewResults creates a new Results object. func...
vendor/github.com/elastic/beats/libbeat/common/mapval/results.go
0.833968
0.494385
results.go
starcoder
package imagex import ( "github.com/xuzhuoxi/infra-go/graphicx" "image" "image/color" "image/draw" ) type PixelImage struct { //A,R,G,B Pix []uint32 Width, Height int } func (i *PixelImage) Max() (maxX, maxY int) { return i.Width, i.Height } func (i *PixelImage) At(x, y int) uint32 { return i.Pix...
imagex/pixel.go
0.684791
0.566139
pixel.go
starcoder
package reshapes /* //TransposeChannelForward will take a nchw and change it to a nhwc and vice-versa. Will find the transpose of x and put it in y func (o *Ops) TransposeChannelForward(handle *cudnn.Handler, x, y *tensor.Volume) error { xfrmt, _, xdims, err := x.Properties() if err != nil { return err } _, _, y...
devices/gpu/nvidia/custom/reshapes/transpose.go
0.549157
0.553566
transpose.go
starcoder
package visibility import ( "regexp" "strconv" "strings" cnv "github.com/urkk/metar/conversion" ) // Unit of measurement. type Unit string const ( // M - meters M = "M" // FT - feet FT = "FT" // SM - statute miles SM = "SM" ) // Distance in units of measure type Distance struct { // By default, meters. ...
visibility/visibility.go
0.739328
0.474388
visibility.go
starcoder
package poly import ( "math" ) // Gets the value of the polynomial function for input x func (self *Poly) Call(x float64) float64 { if self == nil { return 0. } n := float64(len(self.Coefficients)) sum := 0. var i float64 for i = 0.; i < n; i += 1 { sum += self.Coefficients[int(i)] * math.Pow(x, i) } ret...
simplemath.go
0.796728
0.505737
simplemath.go
starcoder
package randomnames // List of animals from https://gist.githubusercontent.com/atduskgreg/3cf8ef48cb0d29cf151bedad81553a54/raw/82f142562cf50b0f6fb8010f890b2f934093553e/animals.txt import ( "math/rand" "sync" ) func init() { animalSize = len(Animals) } // RandomAnimal returns a pseudo-random animal from the list ...
animals.go
0.555676
0.445771
animals.go
starcoder
package softwarebackend import ( "image" "image/color" "image/draw" "math" ) func (b *SoftwareBackend) activateBlurTarget() { b.blurSwap = b.Image b.Image = image.NewRGBA(b.Image.Rect) } func (b *SoftwareBackend) drawBlurred(size float64) { blurred := box3(b.Image, size) b.Image = b.blurSwap draw.Draw(b.Ima...
backend/softwarebackend/blur.go
0.689515
0.50116
blur.go
starcoder
package fitness import ( "math" "math/rand" "github.com/200sc/geva/env" ) // FourPeaks represents a problem where there are four explicit // maxima in the search space and two of the maxima can hide the // other two. func FourPeaks(t int) func(e *env.F) int { return func(e *env.F) int { leadingOnes := 0 for ...
eda/fitness/peaks.go
0.564939
0.412796
peaks.go
starcoder
package search_in_rotated_sorted_array /* 33. 搜索旋转排序数组 https://leetcode-cn.com/problems/search-in-rotated-sorted-array 假设按照升序排序的数组在预先未知的某个点上进行了旋转。 ( 例如,数组 [0,1,2,4,5,6,7] 可能变为 [4,5,6,7,0,1,2] )。 搜索一个给定的目标值,如果数组中存在这个目标值,则返回它的索引,否则返回 -1 。 你可以假设数组中不存在重复的元素。 你的算法时间复杂度必须是 O(log n) 级别。 示例 1: 输入: nums = [4,5,6,7,0,1,2],...
solutions/search-in-rotated-sorted-array/d.go
0.745028
0.571348
d.go
starcoder
package graphics import ( "fmt" mgl "github.com/go-gl/mathgl/mgl32" "github.com/inkyblackness/shocked-client/opengl" ) var fillRectVertexShaderSource = ` #version 150 precision mediump float; in vec2 vertexPosition; uniform mat4 projectionMatrix; void main(void) { gl_Position = projectionMatrix * vec4(vertex...
src/github.com/inkyblackness/shocked-client/graphics/RectangleRenderer.go
0.843477
0.498596
RectangleRenderer.go
starcoder
package kamakiri import ( "math" "time" ) const ( // deg2Rad is the ratio of degrees to radians. deg2Rad = math.Pi / 180.0 // Epsilon is used for contacts. epsilon float64 = 0.000001 // k is 1/3. k float64 = 1.0 / 3 ) // World an abstraction of globals from original Physac lib. type World struct { Collisi...
world.go
0.83622
0.493348
world.go
starcoder
package coloralgorithms /** Shamelessly stolen from Apache commons math */ import ( "errors" "time" "math" "math/rand" ) // Represent a data point. The length of the array specifies the dimensions of the point type Point []float64 // Just a cleaner name for a set of points type Cluster []*Point // A holder f...
src/coloralgorithms/k-means.go
0.580828
0.513425
k-means.go
starcoder
package p16 import ( c "s13g.com/euler/common" ) func Solve(input string) (string, string) { resultA, resultB := solve(input, 1000000000) return resultA, resultB } func solve(input string, loops int) (string, string) { // Parse input into functions for speed. funcs := parse(input) // Perform one dance. _, res...
go/aoc17/p16/p16.go
0.579995
0.401394
p16.go
starcoder
package main import ( "math" "github.com/prometheus/client_golang/prometheus" ) type VastAiPriceStatsCollector struct { ondemand_price_median_dollars *prometheus.GaugeVec ondemand_price_p10_dollars *prometheus.GaugeVec ondemand_price_p90_dollars *prometheus.GaugeVec ondemand_price_per_100dlperf_median_d...
src/vastai_collector_price_stats.go
0.561936
0.506469
vastai_collector_price_stats.go
starcoder
package frame import ( "math" "github.com/spaolacci/murmur3" ) func init() { RegisterOps(func(slice []string) Ops { return Ops{ Less: func(i, j int) bool { return slice[i] < slice[j] }, HashWithSeed: func(i int, seed uint32) uint32 { return murmur3.Sum32WithSeed([]byte(slice[i]), seed) }, } })...
frame/ops_builtin.go
0.615088
0.602237
ops_builtin.go
starcoder
package json import ( "encoding/base64" "errors" "github.com/francoispqt/gojay" "github.com/jexia/semaphore/pkg/specs/types" ) // ErrUnknownType is thrown when the given type is unknown var ErrUnknownType = errors.New("unknown type") // AddTypeKey encodes the given value into the given encoder func AddTypeKey(e...
pkg/codec/json/types.go
0.677901
0.434341
types.go
starcoder
package course import "github.com/pkg/errors" type Course struct { id string title string period Period started bool creatorID string collaborators map[string]bool students map[string]bool tasks map[int]*Task nextTaskNumber int } type CreationParams struct { ID string...
internal/domain/course/course.go
0.554953
0.42185
course.go
starcoder
package main // cell-based version // * split region into CELL_SIZE x CELL_SIZE grid cells // * pick node closest to center in each grid cell // * iteratively find shortest paths between cell centers that are CELL_DISTANCE cells apart (Manhattan distance) // * cut PADDING off path and retain the rest // * also retain ...
server/prune.go
0.556038
0.422922
prune.go
starcoder
package magkal import ( "math" "../ahrs" ) const ( Pi = math.Pi Small = 1e-9 Big = 1e9 Deg = Pi / 180 AvgMagField = 4390 ) type MagKalState struct { T float64 // Time when state last updated K [3]float64 // Scaling factor for magnetometer L [3]float64 // Offset for magnetom...
magnetometer/magkal_defs.go
0.701713
0.626438
magkal_defs.go
starcoder
// This package provides a graph data struture // and graph functionality using ObjMetadata as // vertices in the graph. package graph import ( "bytes" "fmt" "sigs.k8s.io/cli-utils/pkg/object" ) // Graph is contains a directed set of edges, implemented as // an adjacency list (map key is "from" vertex, slice are...
pkg/object/graph/graph.go
0.796807
0.468304
graph.go
starcoder
package board // TetrisBlock holds bit pattern and orientation. The pattern and orientation are related. type TetrisBlock struct { Label string Type BlockType Orientation BlockOrientation Colour BlockColour Pattern [][]bool } // BlockType is one of the 5x possible type BlockType string // ...
01-tetrisgo/pkg/board/block.go
0.681197
0.495667
block.go
starcoder
package main import ( "fmt" t "github.com/wallberg/jbtracer" ) func main() { var material *t.Material // Configure the world world := t.NewWorld() world.Light = t.NewPointLight(t.White, t.NewPoint(-10, 10, -10)) // Configure the camera camera := t.NewCamera(300, 150, t.Pi3) camera.Transform = t.ViewTrans...
cmd/chapter7/chapter7.go
0.600305
0.434161
chapter7.go
starcoder
package chans import "github.com/goki/mat32" // AKParams control an A-type K Ca channel type AKParams struct { Gbar float32 `def:"0.01" desc:"strength of AK current"` Beta float32 `def:"0.01446,02039" desc:"multiplier for the beta term; 0.01446 for distal, 0.02039 for proximal dendrites"` Dm float32 `def:"0.5,0...
chans/ak.go
0.855806
0.424949
ak.go
starcoder
package colexec import "github.com/cockroachdb/cockroach/pkg/col/coldata" // populateEqChains populates op.scratch.eqChains with indices of tuples from b // that belong to the same groups. It returns the number of equality chains. // Passed-in sel is updated to include tuples that are "heads" of the // corresponding...
pkg/sql/colexec/hash_aggregator.eg.go
0.707506
0.436022
hash_aggregator.eg.go
starcoder
package msgraph // RatingNewZealandMoviesType undocumented type RatingNewZealandMoviesType int const ( // RatingNewZealandMoviesTypeVAllAllowed undocumented RatingNewZealandMoviesTypeVAllAllowed RatingNewZealandMoviesType = 0 // RatingNewZealandMoviesTypeVAllBlocked undocumented RatingNewZealandMoviesTypeVAllBlo...
v1.0/RatingNewZealandMoviesTypeEnum.go
0.587943
0.574335
RatingNewZealandMoviesTypeEnum.go
starcoder
package command import ( "context" "errors" "strings" ) const ( RootNode = iota LiteralNode ArgumentNode ) // Graph is a directed graph with a root node, representing all commands and how they are parsed. type Graph struct { // List of all nodes. The first element is the root node nodes []*Node } func NewGr...
server/command/command.go
0.610453
0.422386
command.go
starcoder
&compiler.Ast{ Pos: Position{Filename: "", Offset: 0, Line: 1, Column: 1}, Modules: []*compiler.Module{ &compiler.Module{ Pos: Position{Filename: "", Offset: 0, Line: 1, Column: 1}, Name: "wasi_unstable", End: "\n", ImportSection: compiler.ImportSection{ Pos: Position{Filename: "...
compiler/.snapshots/main.go
0.53048
0.550305
main.go
starcoder
package tile import ( "reflect" "runtime" "sync/atomic" "unsafe" ) // Iterator represents an iterator function. type Iterator = func(Point, Tile) type pageFn = func(*page) type indexFn = func(x, y int16) int type pointFn = func(i int) Point // Grid represents a 2D tile map. Internally, a map is composed of 3x3 ...
grid.go
0.822902
0.460592
grid.go
starcoder
package Character import "github.com/golang/The-Lagorinth/Items" import "github.com/golang/The-Lagorinth/Spells" import "github.com/golang/The-Lagorinth/Point" import "github.com/golang/The-Lagorinth/Labyrinth" import "math/rand" type NPC struct { Location *Point.Point Symbol ...
Characters/character.go
0.668664
0.41834
character.go
starcoder
// Package regression contains a simple Thiel-Sen estimator for linear regression. package regression import ( "container/heap" "sort" ) // LinearRegression returns the slope and intercept, using Thiel-Sen estimator. // This is the median of the slopes defined only from pairs of points having distinct x-coordinate...
regression/regression.go
0.78964
0.647422
regression.go
starcoder
package sphinx import "github.com/xlab/pocketsphinx-go/pocketsphinx" /* * Fast integer logarithmic addition operations. * * In evaluating HMM models, probability values are often kept in log * domain, to avoid overflow. To enable these logprob values to be * held in int32 variables without significant loss of p...
sphinx/logmath.go
0.847116
0.514644
logmath.go
starcoder
package cemi import ( "io" "github.com/vapourismo/knx-go/knx/util" ) // APCI is the Application-layer Protocol Control Information. type APCI uint8 // IsGroupCommand determines if the APCI indicates a group command. func (apci APCI) IsGroupCommand() bool { return apci < 3 } // These are usable APCI values. con...
knx/cemi/tpdu.go
0.677261
0.420124
tpdu.go
starcoder
package rewrite import ( "fmt" "reflect" "github.com/monnoroch/go-inject" ) /// Annotations mapping: a map from annotations to be replaced to annotations to replace them with. type AnnotationsMapping map[inject.Annotation]inject.Annotation /// Generate a module that takes all input module's providers and replace...
rewrite/annotations.go
0.775477
0.417568
annotations.go
starcoder
package geom import ( "fmt" "regexp" "strconv" "strings" ) // Vec2 is a two-element vector. type Vec2 struct { X int Y int } // Vec3 is a three-element vector. type Vec3 struct { X int Y int Z int } // Vec4 is a three-element vector. type Vec4 struct { W int X int Y int Z int } // String does the usua...
geom/geom.go
0.870115
0.440048
geom.go
starcoder
package slice import "errors" // MinByte returns the minimum value of a byte slice or an error in case of a nil or empty slice func MinByte(a []byte) (byte, error) { if len(a) == 0 { return 0, errors.New("Cannot get the minimum of a nil or empty slice") } min := a[0] for k := 1; k < len(a); k++ { if a[k] < m...
min.go
0.878705
0.589007
min.go
starcoder
package proverb import ( "math/rand" "time" ) // Proverb represents a particular proverb with a corresponding link to learn // more. type Proverb struct { Link string `json:"link"` Content string `json:"content"` } // NewProverbStore initializes a ProverbStore. func NewInMemProverbStore() *InMemProverbStore {...
proverb/store.go
0.652463
0.411466
store.go
starcoder
package main import "fmt" func main() { // A comparación de los arreglos, los slices son solo del tipo // de los elementos que contienen (no del numero de elementos). // Para crear un slice de tamaño cero, se usa la sentencia `make`. // En este ejemplo creamos un slice de `string`s de tamaño `3` ...
examples/slices/slices.go
0.561455
0.547585
slices.go
starcoder
package zopfli import ( "math" ) // Converts a series of Huffman tree bitLengths, to the bit values of the symbols. func lengthsToSymbols(lengths []uint, maxBits uint) (symbols []uint) { n := len(lengths) blCount := make([]uint, maxBits+1) nextCode := make([]uint, maxBits+1) symbols = make([]uint, n) // 1) Co...
vendor/git.townsourced.com/townsourced/go-zopfli/zopfli/tree.go
0.646125
0.536191
tree.go
starcoder
package check import ( "bufio" "fmt" _ "log" ) // Err is a function that checks if given error is nil. // If it is not nil, then exit with log.Fatal. func Err(err error) { if err != nil { // log.Fatal(err) panic(err) } } // Scanner is a function that checks if *bufio.Scanner.Err() is nil. // If it is not ni...
check.go
0.61832
0.490663
check.go
starcoder
package cork import ( "reflect" "time" ) // DecodeReflect decodes a reflect.Value value from the Reader. func (r *Reader) DecodeReflect(v reflect.Value) { b := r.peekOne() if b == cNil { r.readOne() return } t := v.Type() k := v.Kind() // First let's check to see if this is // a nil pointer, and if ...
reader_ref.go
0.593138
0.45944
reader_ref.go
starcoder
package ast import "fmt" // Inspect traverses the AST in depth-first order; It starts by calling f(node); // node must be non-nil. If f returns true, Inspect invokes f recursively for // each of the non-nil children, followed by a call of f(nil) func Inspect(node Node, f func(Node) bool) { Walk(inspector(f), node) }...
ql/ast/walk.go
0.684159
0.465266
walk.go
starcoder
* This source code is part of the near-RT RIC (RAN Intelligent Controller) * platform project (RICP). */ /* Package sdlgo provides a lightweight, high-speed interface for accessing shared data storage. Shared Data Layer (SDL) is a concept where applications can use and share data using a common storage. The storag...
doc.go
0.822225
0.735855
doc.go
starcoder
package metric // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // Millimeter // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // MMToCM converts millimeters to centimeters. func MMToCM(mm Millimeter) Centimeter { return Centimeter(mm * 0.1) } // MMToM...
ex_02.02-unit_conversion/metric/length_func.go
0.773131
0.437103
length_func.go
starcoder
package imagediff import ( "errors" "image" "image/color" ) // SimpleImageComparer considers pixels to be the same when their RGBA values are equal type SimpleImageComparer struct { ignoreColor *color.NRGBA useignoreColor bool DiffColor color.NRGBA } //NewSimpleImageComparer creates a new SimpleImageCo...
imagediff/SimpleImageComparer.go
0.823506
0.567817
SimpleImageComparer.go
starcoder
package export import "github.com/prometheus/client_golang/prometheus" // IngestionRealtimeIndexingExporter contains all the Prometheus metrics that are possible to gather from the Jetty service type IngestionRealtimeIndexingExporter struct { TaskRunTime *prometheus.HistogramVec `description:"milliseconds take...
pkg/export/ingestion_realtime_indexing.go
0.728748
0.431644
ingestion_realtime_indexing.go
starcoder
package bytealg const ( // Index can search any valid length of string. MaxLen = int(-1) >> 31 MaxBruteForce = MaxLen ) // Compare two byte slices. // Returns -1 if the first differing byte is lower in a, or 1 if the first differing byte is greater in b. // If the byte slices are equal, returns 0. // If th...
src/internal/bytealg/bytealg.go
0.808559
0.47993
bytealg.go
starcoder
// An implementation of Conway's Game of Life. package main import ( "bytes" "fmt" "math/rand" "time" ) // Field represents a two-dimensional field of cells. type Field struct { s [][]bool w, h int } // NewField returns an empty field of the specified width and height. func NewField(w, h int) *Field {...
software/baremetal/life/go/life_go.go
0.849113
0.474631
life_go.go
starcoder
package store type ( Strings struct { Values []string } Ints struct { Values []int } Bools struct { Values []bool } KVs struct { Keys []string Values []string } ) func (s *Strings) Init(size int) { if cap(s.Values) < size { s.Values = make([]string, size) } else { s.Values = s.Values[:siz...
store/store.go
0.5564
0.452234
store.go
starcoder
package texture import ( g2dcol "github.com/jphsd/graphics2d/color" "image" "image/color" "image/draw" "math" ) // Image holds the data to support a continuous bicubic interpolation over an image. type Image struct { Image *image.NRGBA Max []float64 LastX, LastY int HSL bool } // Ne...
image.go
0.733547
0.574693
image.go
starcoder
package main import "fmt" type Color string const ( R Color = "R" B = "B" ) type Tree interface { ins(x int) Tree } type E struct{} func (_ E) ins(x int) Tree { return T{R, E{}, x, E{}} } func (_ E) String() string { return "E" } type T struct { cl Color le Tree aa int ...
lang/Go/pattern-matching.go
0.739893
0.40486
pattern-matching.go
starcoder
package compare import ( "bytes" "time" ) // Compare returns a value indicating the sort order relationship between the // receiver and the parameter. // Given c = a.Compare(b): // c < 0 if a < b; // c == 0 if a == b; and // c > 0 if a > b. type Comparable interface { Compare(Comparable) int } type CompString ...
util/compare/comparator.go
0.792424
0.686498
comparator.go
starcoder
package dna import ( "log" ) // Count returns the number of each base present in the input sequence. func Count(seq []Base) (ACount int, CCount int, GCount int, TCount int, NCount int, aCount int, cCount int, gCount int, tCount int, nCount int, gapCount int) { ACount, CCount, GCount, TCount, NCount, aCount, cCount,...
dna/examine.go
0.674479
0.555737
examine.go
starcoder
package main import ( "math" ) // CalculateGammaEpsilon Calculates the gamma and epsilon // values for a byte array of \n seperated binary values func CalculateGammaEpsilon(input []byte) (int, int) { size := 0 for i, char := range input { if char == 10 { size = i break } i++ } posCount := make([]int,...
diagnosticReport.go
0.565059
0.504822
diagnosticReport.go
starcoder
package matrix // Map applies f to every element of the matrix and returns the result func Map(m Matrix, f Mapper) Matrix { n := New(m.Rows, m.Columns, nil) for i := 0; i < m.Rows; i++ { for j := 0; j < m.Columns; j++ { val := m.Data[i][j] n.Data[i][j] = f(val, i, j) } } return n } // Fold accumulates...
matrix/funcs.go
0.918945
0.738528
funcs.go
starcoder
package v1_0 func init() { Profile["/tosca/common/1.0/js/RESOLUTION.md"] = ` Topology Resolution =================== This is where we create the flat topology: relationships from templates to capabilities (the "sockets", if you will) in other node templates. We call this "resolving" the topology. Resolution is han...
tosca/profiles/common/v1_0/js-RESOLUTION.go
0.862786
0.477189
js-RESOLUTION.go
starcoder
// This file contains the definitions of the math elementary // (builtin) functions. package lisp1_5 import ( "math/big" ) // Arithmetic. func (c *Context) mathFunc(expr *Expr, fn func(*big.Int, *big.Int) *big.Int) *Expr { return atomExpr(number(fn(c.getNumber(Car(expr)), c.getNumber(Car(Cdr(expr)))))) } func (...
lisp1_5/math.go
0.573081
0.422266
math.go
starcoder
package three import "github.com/gopherjs/gopherjs/js" type Image struct { *js.Object } type Texture struct { *js.Object Id int `js:"id"` UUID string `js:"uuid"` Name string `js:"name"` Image *Image `js:"image"` // Array of user-specified mipmaps (optional). Mipmaps *js.Object `js:"mipmaps...
materials_texture.go
0.84891
0.435001
materials_texture.go
starcoder
package table import "math/rand" // Clone returns a new Table with the same contents as this one. func (m Table[K, V]) Clone() Table[K, V] { n := make(map[K]V) for k, v := range m { n[k] = v } return n } // Add adds a new element to the Table. func (m Table[K, V]) Add(k K, v V) { m[k] = v } // Remove removes...
collections/table/methods.go
0.825941
0.478468
methods.go
starcoder
package fmt import ( "os" ) // Printf formats according to a format specifier and writes to standard output. // It returns the number of bytes written and any write error encountered. func Printf(format string, a ...interface{}) (n int, err error) { return Fprintf(os.Stdout, format, a...) } // Print formats using...
src/fmt/stdio.go
0.761804
0.49347
stdio.go
starcoder
package values import ( "reflect" ) var ( int64Type = reflect.TypeOf(int64(0)) float64Type = reflect.TypeOf(float64(0)) ) // Equal returns a bool indicating whether a == b after conversion. func Equal(a, b interface{}) bool { // nolint: gocyclo a, b = ToLiquid(a), ToLiquid(b) if a == nil || b == nil { retur...
values/compare.go
0.729327
0.520374
compare.go
starcoder
package models import ( i336074805fc853987abe6f7fe3ad97a6a6f3077a16391fec744f671a015fbd7e "time" i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91 "github.com/microsoft/kiota-abstractions-go/serialization" ) // AccessReviewInstance type AccessReviewInstance struct { Entity // Returns ...
models/access_review_instance.go
0.710427
0.420272
access_review_instance.go
starcoder