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 l3gd20 import ( "fmt" "math" "sync" "time" "github.com/golang/glog" "github.com/kidoman/embd" ) const ( address = 0x6B id = 0xD4 dpsToRps = 0.017453293 whoAmI = 0x0F ctrlReg1 = 0x20 ctrlReg2 = 0x21 ctrlReg3 = 0x22 ctrlReg4 = 0x23 ctrlReg5 = 0x24 tempData = 0x26 statusReg = 0x...
sensor/l3gd20/l3gd20.go
0.600891
0.470128
l3gd20.go
starcoder
package yaml import ( "fmt" "io/ioutil" "github.com/pbanos/botanic/feature" yaml "gopkg.in/yaml.v2" ) /* ReadFeatures takes a slice of bytes with a feature specification in YML and returns a slice of features parsed from it or an error. The YML is expected to be an object containing a features property. The valu...
feature/yaml/yaml.go
0.665519
0.466603
yaml.go
starcoder
package models import ( "fmt" "rbtree/utils" ) //Node represents a binary tree node type Node struct { Left *Node Right *Node Parent *Node Data int color color } //InsertData adds data as a node into the subtree func (n *Node) InsertData(data int) { if data >= n.Data { if n.Right != nil { n.Right....
models/node.go
0.7011
0.419232
node.go
starcoder
package math import ( "fmt" "math" "github.com/rs/zerolog/log" ) type ScaleFactor int const ( Normal ScaleFactor = iota + 1 Inverse ) type Format func(x float32) string type Transform func(x float32) float32 func voidTransform(x float32) float32 { return x } type Mapper interface { ScaleAt(i int, factor ...
internal/math/mapper.go
0.763043
0.536495
mapper.go
starcoder
package statistics import ( "math" "github.com/tikv/pd/server/core" ) // StoreLoadDetail records store load information. type StoreLoadDetail struct { *StoreSummaryInfo LoadPred *StoreLoadPred HotPeers []*HotPeerStat } // ToHotPeersStat abstracts load information to HotPeersStat. func (li *StoreLoadDetail) To...
server/statistics/store_load.go
0.661048
0.403214
store_load.go
starcoder
package board type Board struct { board [8*8]bool colFilled [8]bool rowFilled [8]bool } /* Replaces the column of the Board with one that has a queen on specified square row and col must both be between 0 and 7 */ func (b Board) PlaceQueen(row int, col int) Board{ b.board[row * 8 + col] = true b.r...
board/board.go
0.768386
0.53522
board.go
starcoder
package gozxing import ( "github.com/kaxap/gozxing/common/util" ) type ResultPoint interface { GetX() float64 GetY() float64 } type ResultPointBase struct { x float64 y float64 } func NewResultPoint(x, y float64) ResultPoint { return ResultPointBase{x, y} } func (rp ResultPointBase) GetX() float64 { return ...
result_point.go
0.883475
0.759181
result_point.go
starcoder
package shamir /* Copyright Hashicorp 2021 https://github.com/hashicorp/vault/blob/v1.9.0/shamir/shamir.go Mozilla Public License, version 2.0 1. Definitions 1.1. "Contributor" means each individual or legal entity that creates, contributes to the creation of, or owns Covered Software. 1.2. "Contributo...
hashicorp/shamir.go
0.928279
0.417509
shamir.go
starcoder
package main import "math" type intersection struct { x, y int steps map[int]int } type wireGrid struct { data [][]int sizeX int centralPortX int centralPortY int wires []*wire intersections map[int]intersection } func getRequiredSpace(wires []*wire) (x, y, centralPortX, centralP...
day3/wiregrid.go
0.602646
0.430088
wiregrid.go
starcoder
package main type IntersectionInfo struct { Intersection U, V float64 // Surface coordinates of intersection point Point Tuple // Intersection point OverPoint Tuple // Intersection point adjusted a bit in the normal direction (over the surface), used for shadows U...
intersection_info.go
0.673836
0.574514
intersection_info.go
starcoder
package models import "time" // UnparsedBuild represents the unparsed response from the CI type UnparsedBuild struct { ID int `json:"id"` Number int `json:"number"` Event string `json:"event"` Status string `json:"status"` EnqueuedAt int64 `json:"enqueued_at"` CreatedAt ...
models/build.go
0.633864
0.421373
build.go
starcoder
package golfcart import ( "fmt" "math" "strconv" "strings" "github.com/alecthomas/participle/v2/lexer" ) type Context struct { stackFrame StackFrame } func (context *Context) Init() { context.stackFrame = StackFrame{entries: make(map[string]Value)} } type StackFrame struct { entries map[string]Value paren...
pkg/golfcart/eval.go
0.655557
0.427994
eval.go
starcoder
package parser import ( "bytes" "io" "strconv" ) // AST type corresponds parsed BNF grammar. We use the same AST type for both // semantic parse tree and syntactic parse tree (which is actually a list of // lists). type AST struct { // Save the parsing error. err error // List of lists of terms. Each list corre...
pkg/parser/parser.go
0.605799
0.444384
parser.go
starcoder
package require import ( "testing" "github.com/tada/dgo/dgo" "github.com/tada/dgo/internal" "github.com/tada/dgo/test/util" ) func errorlog(t *testing.T, dflt string, args []interface{}) { t.Helper() if len(args) > 0 { t.Fatal(args...) } else { t.Fatal(dflt) } } // Assignable will fail unless a is assig...
test/require/require.go
0.512449
0.505188
require.go
starcoder
package shapes import ( "github.com/factorion/graytracer/pkg/primitives" "github.com/factorion/graytracer/pkg/patterns" ) // ShapeBase Base struct to be embedded in shape objects type ShapeBase struct { transform primitives.Matrix inverse primitives.Matrix material patterns.Material parent Shape } // MakeShape...
pkg/shapes/shape.go
0.849831
0.494263
shape.go
starcoder
package geom //LineString is a two-dimensional geometry representing a multi-vertex line type LineString []Point //LineStringZ is a three-dimensional geometry representing a multi-vertex line type LineStringZ []PointZ //LineStringM is a two-dimensional geometry representing a multi-vertex line, with an additional v...
linestring.go
0.838151
0.58818
linestring.go
starcoder
package esx import "github.com/vmware/govmomi/vim25/types" // Description is the default template for the TaskManager description property. // Capture method: // govc object.collect -s -dump TaskManager:ha-taskmgr description var Description = types.TaskDescription{ MethodInfo: []types.BaseElementDescription{ &t...
vendor/github.com/vmware/govmomi/simulator/esx/task_manager.go
0.506591
0.519278
task_manager.go
starcoder
package tin import ( "math" "github.com/flywave/go3d/float64/vec3" ) func averageOf(d1, d2, d3, d4, noDataValue float64) float64 { count := 0 sum := float64(0.0) lp := []float64{d1, d2, d3, d4} for d := range lp { if isNoData(lp[d], noDataValue) { continue } count++ sum += lp[d] } if count > 0 { ...
zemlya.go
0.535341
0.50952
zemlya.go
starcoder
package libtesting import ( "fmt" "github.com/luthersystems/elps/lisp" "github.com/luthersystems/elps/lisp/lisplib/internal/libutil" ) // DeafultPackageName is the package name used by LoadPackage. const DefaultPackageName = "testing" const DefaultSuiteSymbol = "test-suite" // LoadPackage adds the time package...
lisp/lisplib/libtesting/libtesting.go
0.587588
0.497437
libtesting.go
starcoder
package types import ( "github.com/consensys/gnark-crypto/ecc" "github.com/consensys/gnark/frontend" "github.com/consensys/gnark/std/hash/mimc" ) type WithdrawCircuit struct { //public TreeRootHash frontend.Variable `gnark:",public"` AuthorizeSpendHash frontend.Variable `gnark:",public"` NullifierHash ...
plugin/dapp/mix/types/withdraw.go
0.735452
0.436502
withdraw.go
starcoder
package main import ( "github.com/go-gl/mathgl/mgl32" "math" ) type Vector3 struct { X float32 Y float32 Z float32 } func (v *Vector3) Set(x, y, z float32) { v.X = x v.Y = y v.Z = z } func (v *Vector3) Add(a, b Vector3) { v.X = a.X + b.X v.Y = a.Y + b.Y v.Z = a.Z + b.Z } func (v *Vector3) AddScaled(a, b...
heli.go
0.853272
0.710013
heli.go
starcoder
package main import ( "bytes" "fmt" "log" "os" "sort" "strings" "text/template" "time" "unicode" "github.com/emicklei/melrose/core" "github.com/emicklei/melrose/dsl" ) var tmplSource = `--- title: "Language" description: "All language functions grouped by creation,compostion and audio control." lead: "Al...
generators/main.go
0.61173
0.596374
main.go
starcoder
package circular import ( "github.com/grailbio/base/bitset" "github.com/grailbio/base/log" "github.com/grailbio/base/simd" bi "github.com/grailbio/bio/interval" ) // BitsPerWord is the number of bits per machine word. (Don't want to import // base/simd or base/bitset in files where we only need this constant.) c...
circular/bitmap.go
0.540196
0.53048
bitmap.go
starcoder
package matrix // NewBitPrecMat returns a matrix with the given size. It can contain only // values that fit in the given number of bits. func NewBitPrecMat(w, h, bits int) BitPrecMat { if bits < 1 || bits > 31 { panic("NewBitPrecMat32: bits must be in the range [1..31]") } // add one padding because we later tre...
bit_prec_mat.go
0.724383
0.699639
bit_prec_mat.go
starcoder
package uniswap_core import ( "math/big" ) type SwapCache struct { // the protocol fee for the input token feeProtocol *big.Int // liquidity at the beginning of the swap liquidityStart *big.Int // the current value of the tick accumulator, computed only if we cross an initialized tick tickCumulative *big.Int ...
swap.go
0.695958
0.612556
swap.go
starcoder
package mini import ( "github.com/awalterschulze/gominikanren/micro" "github.com/awalterschulze/gominikanren/sexpr/ast" ) // defines two candidate functions for unrolling // the idea is to do partial application and 'unroll' recursive functions // into a disjunction/conjunction of goals, so that they can be // exec...
mini/unroll.go
0.501709
0.511229
unroll.go
starcoder
package s2prot // Bit masks having as many ones at the lowest bits as the index. var bitMasks = [...]byte{0x00, 0x01, 0x03, 0x07, 0x0f, 0x1f, 0x3f, 0x7f, 0xff} // The wrapper around a []byte providing access by arbitrary number of bits. type bitPackedBuff struct { contents []byte // Source of bits bigEndian bool ...
bitpackedbuff.go
0.748444
0.534795
bitpackedbuff.go
starcoder
package matrix import ( "fmt" "math" "sort" "sync" ) // Vector type -> 1D array type Vector []float64 // At returns vector element at index n func (v *Vector) At(n int) float64 { l := len(*v) if AbsInt(n) > l { panic("index out of range") } if n < 0 { n = l + n } return (*v)[n] } // Add adds two vecto...
matrix/vector.go
0.823044
0.502502
vector.go
starcoder
package finnhub import ( "encoding/json" ) // AggregateIndicators struct for AggregateIndicators type AggregateIndicators struct { TechnicalAnalysis *TechnicalAnalysis `json:"technicalAnalysis,omitempty"` Trend *Trend `json:"trend,omitempty"` } // NewAggregateIndicators instantiates a new AggregateIndicators obj...
model_aggregate_indicators.go
0.771843
0.446374
model_aggregate_indicators.go
starcoder
package namespaces import ( "github.com/chnsz/golangsdk" "github.com/chnsz/golangsdk/pagination" ) // CreateOpts allows to create a namespace using given parameters. type CreateOpts struct { // Kind is a string value representing the REST resource this object represents. // Servers may infer this from the endpoin...
openstack/cci/v1/namespaces/requests.go
0.798698
0.434161
requests.go
starcoder
package codelet import ( "errors" "godct/handler" "godct/memory" "strings" "time" ) type Codelet struct { Activation float64 `default:"0"` Threshold float64 `default:"0"` Enabled bool `default:"true"` Inputs []memory.Memory Outputs []memory.Memory Broadcasts []memory.Memory StartTime int64 ...
src/codelet/codelet.go
0.568176
0.428413
codelet.go
starcoder
package pipelines import ( "encoding/json" ) // PipelineStagePatchInput An input used to update some properties on a pipeline definition. type PipelineStagePatchInput struct { // A label used to organize pipeline stages in HubSpot's UI. Each pipeline stage's label must be unique within that pipeline. Label *strin...
generated/pipelines/model_pipeline_stage_patch_input.go
0.860149
0.419886
model_pipeline_stage_patch_input.go
starcoder
package cgl //-------------------- // IMPORTS //-------------------- import ( "log" "time" ) //-------------------- // DATE AND TIME //-------------------- // Calc nanoseconds from microseconds. func NsMicroseconds(count int64) int64 { return count * 1e3 } // Calc nanoseconds from milliseconds. func NsMillisecon...
eBook/examples/chapter_11/tideland-cgl.googlecode.com/hg/cgltim.go
0.749729
0.574574
cgltim.go
starcoder
package alphaVantage import ( "github.com/ClintonMorrison/goAlphaVantage/internal/parse" "sort" "time" ) type AdjustedQuote struct { Ticker string Time time.Time Open float64 High float64 Low float64 Close float64 AdjustedClose float64...
pkg/alphaVantage/quotes_adjusted.go
0.743727
0.473353
quotes_adjusted.go
starcoder
package set import ( "fmt" "strings" "github.com/luraim/fun" ) type OrderedSet[T comparable] struct { Elems []T `json:"set_elems"` EMap map[T]bool `json:"set_e_map"` } func (s OrderedSet[T]) String() string { elemStrs := fun.Map(s.Elems, func(e T) string { return fmt.Sprintf("%v", e) }) return fmt...
orderedset.go
0.676406
0.444987
orderedset.go
starcoder
package data func MapSlice[T, R any](sli []T, fun func(T) R) []R { res := make([]R, len(sli)) for i, x := range sli { res[i] = fun(x) } return res } // Like MapSlice but short circuits in case of error func MapSliceError[T, R any](sli []T, fun func(T) (R, error)) ([]R, error) { res := make([]R, len(sli)) for ...
data/slice.go
0.76207
0.549278
slice.go
starcoder
package operators import ( "fmt" "regexp" "strings" ) // Node represents a single node in a tree. type Node struct { Key string Value []byte Children Children } // String returns the string representation of the node without new lines and duplicate spaces. func (n *Node) String() string { return regex...
operators/tree.go
0.845289
0.500732
tree.go
starcoder
package filter import ( "errors" "regexp" "github.com/gobwas/glob" ) // StringFilter matches against simple strings type StringFilter interface { Matches(string) bool } // StringMapFilter matches against the values of a map[string]string. type StringMapFilter interface { Matches(map[string]string) bool } // B...
pkg/utils/filter/filter.go
0.759939
0.420124
filter.go
starcoder
package data // CountryCurrencyJSONData is a JSON glob of countries and currencies // Source: https://gist.github.com/tiagodealmeida/0b97ccf117252d742dddf098bc6cc58a const CountryCurrencyJSONData = `[ { "countryCode": "AD", "countryName": "Andorra", "currency...
data/currencies.go
0.521715
0.574156
currencies.go
starcoder
package machine import ( "fmt" . "github.com/onsi/gomega" "github.com/epinio/epinio/helpers" ) func (m *Machine) MakeCustomService(serviceName string) { out, err := m.Epinio(fmt.Sprintf("service create-custom %s username epinio-user", serviceName), "") ExpectWithOffset(1, err).ToNot(HaveOccurred(), out) // A...
acceptance/helpers/machine/services.go
0.527317
0.409575
services.go
starcoder
package arrays import "sort" //Questions regarding permutations of strings //QUESTION: Given two strings, determine if one is a permutation of the other type wordSort []rune func (s wordSort) Less(i, j int) bool { return s[i] < s[j] } func (s wordSort) Swap(i, j int) { s[i], s[j] = s[j], s[i] } func (s wordSor...
arrays/permutations.go
0.669205
0.403302
permutations.go
starcoder
package evidence // combinePairwise takes a pairwise combination function and two or more // MassFunctions and returns a new MassFunction according to the rule of // combination given by the combination function. Returns nil if no // MassFunctions are provided. func combinePairwise(combiner func(*MassFunction, *MassFu...
combination.go
0.804866
0.672691
combination.go
starcoder
package color256 import "fmt" // Bold returns a bold string. func Bold(format string, a ...interface{}) string { return fmt.Sprintf("\x1b[%dm%s\x1b[22m", FmtBold, fmt.Sprintf(format, a...)) } // Faint returns a faint string. func Faint(format string, a ...interface{}) string { return fmt.Sprintf("\x1b[%dm%s\x1b[2...
Formats.go
0.804483
0.410166
Formats.go
starcoder
package ipstack import ( "context" "github.com/turbot/steampipe-plugin-sdk/grpc/proto" "github.com/turbot/steampipe-plugin-sdk/plugin" "github.com/turbot/steampipe-plugin-sdk/plugin/transform" ) func ipstackIpColumns() []*plugin.Column { return []*plugin.Column{ // Top columns {Name: "ip", Type: proto.Colum...
ipstack/table_ipstack_ip.go
0.664649
0.450662
table_ipstack_ip.go
starcoder
package check import "fmt" // StringSlice is the type of a check function for a slice of strings. It // takes a slice of strings as a parameter and returns an error or nil if // there is no error type StringSlice func(v []string) error // StringSliceStringCheck returns a check function that checks that every // memb...
check/stringslice.go
0.70028
0.510741
stringslice.go
starcoder
package bingo import ( "bytes" "encoding/base64" "image" "image/color" "image/png" "math" "sort" ) type Avatar struct { X int Y int } // Gradient. func gradient(img *image.RGBA, from, to color.RGBA, x, y int, horizontal bool) { s := [3]float32{ (float32(to.R) - float32(from.R)) / float32(x), (float32(t...
avatar.go
0.68458
0.412885
avatar.go
starcoder
package main import ( "math" "github.com/unixpickle/model3d/model3d" ) const ( PersonRadius = 1.0 PersonHeight = 3.0 PersonTorsoHeight = 0.9 PersonTorsoWidth = 0.5 PersonTorsoThickness = 0.3 PersonLegHeight = 1.1 PersonLegSpace = 0.1 PersonWaistInset = 0.05 PersonWaistHeight = 0.1 PersonA...
examples/parody/flag_statue/person.go
0.640523
0.459379
person.go
starcoder
package main import ( "fmt" "sort" "github.com/james-wallis/adventofcode/utils" ) // CountDifferencesOf1Or3InSlice : counts how many differences or 1 and how many of 3 exist in a slice func CountDifferencesOf1Or3InSlice(input []int) map[int]int { differences := map[int]int{ 1: 0, 3: 0, } // Ensure that the...
10/adapterArray.go
0.656658
0.475484
adapterArray.go
starcoder
package components import ( "fmt" "github.com/pelletier/go-toml" ) // Animation structure type Animation struct { // List of times (must be in strictly increasing order, with first element equal to 0) Time []float64 // List of sprite numbers (must have one less element than the Time field, and at least one elem...
components/animation.go
0.738575
0.413418
animation.go
starcoder
package types const ( // DenomThetaWei is the basic unit of theta, 1 Theta = 10^18 ThetaWei DenomThetaWei string = "ThetaWei" // DenomTFuelWei is the basic unit of theta, 1 Theta = 10^18 ThetaWei DenomTFuelWei string = "TFuelWei" // MinimumGasPrice is the minimum gas price for a smart contract transaction Mini...
VM/ledger/types/const.go
0.710226
0.604487
const.go
starcoder
package binarytree import ( "errors" "go-dsa/common" "reflect" ) type Node interface { GetParent() Node SetParent(Node) GetLeft() Node SetLeft(Node) GetRight() Node SetRight(Node) GetEle() common.ComparableElement SetEle(common.ComparableElement) } type BinaryTree interface { GetRoot() Node Size() int ...
binarytree/binary_tree.go
0.562898
0.415254
binary_tree.go
starcoder
package utils import ( "math/rand" "reflect" "time" ) // StringSliceReflectEqual func StringSliceReflectEqual(a, b []string) bool { return reflect.DeepEqual(a, b) } // StringSliceEqual func StringSliceEqual(a, b []string) bool { if len(a) != len(b) { return false } if (a == nil) != (b == nil) { return fa...
pkg/nocalhost-api/pkg/utils/slice.go
0.64232
0.422147
slice.go
starcoder
Copyright 2017 The Kubernetes Authors. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, sof...
kubernetes-model/vendor/k8s.io/kubernetes/pkg/kubectl/apply/strategy/replace_visitor.go
0.778902
0.503662
replace_visitor.go
starcoder
package chromath // CIEKappa and CIEEps are the CIE defined constants (κ and ε) used for Lab and Luv transforms const ( CIEKappa = 24389.0 / 27.0 CIEEps = 216 / 24389.0 ) // Point is a generic 3-tuple colorspace point allowing for generic operations on points regardless of color space type Point [3]float64 // XY...
vendor/github.com/jkl1337/go-chromath/chromath.go
0.882959
0.69005
chromath.go
starcoder
package p468 import ( "strconv" "strings" ) /** Write a function to check whether an input string is a valid IPv4 address or IPv6 address or neither. IPv4 addresses are canonically represented in dot-decimal notation, which consists of four decimal numbers, each ranging from 0 to 255, separated by dots ("."), e.g....
algorithms/p468/468.go
0.731538
0.468487
468.go
starcoder
package meanshift import ( "github.com/biogo/cluster/cluster" "github.com/biogo/store/kdtree" "math" ) // shiftPoint is a weighted point which carries group identity and membership information. // shiftPoint satisfies the kdtree.Comparable interface. type shiftPoint struct { Point []float64 Weight float64 ...
meanshift/shifters.go
0.715523
0.539287
shifters.go
starcoder
package gorelic import ( "fmt" metrics "github.com/launchdarkly/go-metrics" ) const ( histogramMin = iota histogramMax histogramMean histogramPercentile histogramStdDev histogramVariance noHistogramFunctions ) type goMetricaDataSource struct { metrics.Registry } func (ds goMetricaDataSource) GetGaugeValue...
gometrica.go
0.787155
0.413359
gometrica.go
starcoder
package sql import "fmt" // andExpr - logical AND function. type andExpr struct { left Expr right Expr funcType Type } // String - returns string representation of this function. func (f *andExpr) String() string { return fmt.Sprintf("(%v AND %v)", f.left, f.right) } // Call - evaluates this function for...
pkg/s3select/sql/logicalexpr.go
0.725746
0.549399
logicalexpr.go
starcoder
package amqp import ( "bytes" "encoding/binary" "errors" "io" "time" ) /* Reads a frame from an input stream and returns an interface that can be cast into one of the following: methodFrame PropertiesFrame bodyFrame heartbeatFrame 2.3.5 frame Details All frames consist of a header (7 octets), a ...
read.go
0.81309
0.401131
read.go
starcoder
package hdrbench import ( "github.com/golang/glog" "math" "math/rand" "sort" ) func Sum(numbers []float64) (total float64) { for _, x := range numbers { total += x } return total } func Mean(numbers []float64) float64 { return Sum(numbers) / float64(len(numbers)) } func Median(numbers []float64) float64 {...
math.go
0.654453
0.452294
math.go
starcoder
package countminsketch import ( "encoding/binary" "errors" "hash" "hash/fnv" "math" ) // CountMinSketch struct. type CountMinSketch struct { matrix [][]uint64 // count matrix width uint // matrix width depth uint // matrix depth count uint64 // total number of items added hash hash....
pkg/countminsketch/countmin.go
0.802517
0.562297
countmin.go
starcoder
package common import ( "bufio" "fmt" "io" "os" "strconv" "strings" ) type Node struct { ID int Point Point In []*Edge Out []*Edge } func (node *Node) String() string { return fmt.Sprintf("Node(%v)", node.Point) } func (node *Node) RemoveEdge(edge *Edge) { filterFunc := func(edges []*Edge) []*Edge { v...
common/graph.go
0.631253
0.557845
graph.go
starcoder
package elements import ( . "github.com/balpha/go-unicornify/unicornify/core" ) type Ball struct { Center Vector Radius float64 Color Color } func NewBall(x, y, z, r float64, c Color) *Ball { return NewBallP(Vector{x, y, z}, r, c) } func NewBallP(center Vector, r float64, c Color) *Ball { return &Ball{ Cent...
unicornify/elements/ball.go
0.764276
0.579728
ball.go
starcoder
package ovs import ( "fmt" "strconv" "strings" "time" ) // ovsFlow represents an OVS flow type OvsFlow struct { Table int Priority int Created time.Time Cookie string Fields []OvsField Actions []OvsField ptype ParseType } type OvsField struct { Name string Value string } const ( minPriority...
pkg/util/ovs/parse.go
0.561936
0.452354
parse.go
starcoder
package ordered import "github.com/coderme/gonum/graph" // ByID implements the sort.Interface sorting a slice of graph.Node // by ID. type ByID []graph.Node func (n ByID) Len() int { return len(n) } func (n ByID) Less(i, j int) bool { return n[i].ID() < n[j].ID() } func (n ByID) Swap(i, j int) { n[i]...
graph/internal/ordered/sort.go
0.747247
0.463869
sort.go
starcoder
package types type QueryType uint64 //QueryType enumeration order matters, do not change order when adding new enums. const ( QueryTypeUnknown = QueryType(iota) QueryTypeUrl // Query by Url QueryTypeChainId // Query by chain id QueryTypeTxId // Query tx and pending chains By TxId Query...
types/query_types.go
0.610918
0.447038
query_types.go
starcoder
package classifier /* import "s32x.com/gamedetect/classifier" */ import ( "bytes" "errors" "image" "image/png" "io" "mime/multipart" "sort" "strings" tf "github.com/tensorflow/tensorflow/tensorflow/go" "github.com/tensorflow/tensorflow/tensorflow/go/op" ) // Prediction is a struct containing a class label ...
classifier/classify.go
0.773473
0.441131
classify.go
starcoder
package polynomial import ( "errors" "math/big" "github.com/getamis/alice/crypto/utils" ) var ( // ErrEmptyCoefficients is returned if the coefficients is empty ErrEmptyCoefficients = errors.New("empty coefficient") ) // Polynomial represents a polynomial of arbitrary degree type Polynomial struct { fieldOrd...
crypto/polynomial/polynomial.go
0.69181
0.660959
polynomial.go
starcoder
package field import ( "fmt" "time" "gorm.io/gorm/clause" ) type Time Field func (field Time) Eq(value time.Time) Expr { return expr{e: clause.Eq{Column: field.RawExpr(), Value: value}} } func (field Time) Neq(value time.Time) Expr { return expr{e: clause.Neq{Column: field.RawExpr(), Value: value}} } func (f...
field/time.go
0.715126
0.603319
time.go
starcoder
package types import ( "fmt" "github.com/attic-labs/noms/go/d" "github.com/attic-labs/noms/go/hash" ) type valueDecoder struct { nomsReader vr ValueReader validating bool } // |tc| must be locked as long as the valueDecoder is being used func newValueDecoder(nr nomsReader, vr ValueReader) *valueDecod...
go/types/value_decoder.go
0.604516
0.434821
value_decoder.go
starcoder
package btree import ( "github.com/pkg/errors" "github.com/bitsgofer/containers" ) // TreeNode is a node in the binary tree. type TreeNode struct { Value containers.Value Parent *TreeNode Left *TreeNode Right *TreeNode } // walkPreOrder executes fn() on nodes using pre-order. func walkPreOrder(node *TreeN...
btree/binary_tree.go
0.717606
0.493897
binary_tree.go
starcoder
package geom // A Polygon represents a polygon as a collection of LinearRings. The first // LinearRing is the outer boundary. Subsequent LinearRings are inner // boundaries (holes). type Polygon struct { geom2 } // NewPolygon returns a new, empty, Polygon. func NewPolygon(Lay Layout) *Polygon { return Ne...
polygon.go
0.855369
0.50238
polygon.go
starcoder
package main import ( "fmt" "math/rand" ) // Row Major matrix type Matrix []Vector func MakeMatrixWithData(r, c int, data []float32) Matrix { if len(data) != r*c { panic("Wrong amount of data for newly created matrix") } ret := make(Matrix, r) for i := 0; i < r; i++ { ret[i] = data[i*c : (i+1)*c] } retur...
matrix.go
0.694303
0.476214
matrix.go
starcoder
package com.google.spanner.v1; public interface PartialResultSetOrBuilder extends // @@protoc_insertion_point(interface_extends:google.spanner.v1.PartialResultSet) com.google.protobuf.MessageOrBuilder { /** * * * <pre> * Metadata about the result set, such as row type information. * Only...
proto-google-cloud-spanner-v1/src/main/java/com/google/spanner/v1/PartialResultSetOrBuilder.java
0.878171
0.464841
PartialResultSetOrBuilder.java
starcoder
package com.cedarsoftware.util; import java.math.BigDecimal; import java.math.BigInteger; /** * Useful Math utilities * * @author <NAME> (<EMAIL>) * <br> * Copyright (c) Cedar Software LLC * <br><br> * Licensed under the Apache License, Version 2.0 (the "License"); * yo...
src/main/java/com/cedarsoftware/util/MathUtilities.java
0.929616
0.44342
MathUtilities.java
starcoder
package org.n52.janmayen; import java.util.Comparator; import java.util.Scanner; import java.util.regex.Pattern; import javax.xml.namespace.QName; import com.google.common.collect.Ordering; public final class Comparables { public static final int LESS = -1; public static final int EQUAL = 0; public stat...
janmayen/src/main/java/org/n52/janmayen/Comparables.java
0.959922
0.590838
Comparables.java
starcoder
package com.googlecode.charts4j; import static com.googlecode.charts4j.collect.Preconditions.*; import java.util.List; import com.googlecode.charts4j.collect.ImmutableList; import com.googlecode.charts4j.collect.Lists; /** * Static factory class for {@link Plot} hierarchy. The plots can then be * rendered by a {@...
src/main/java/com/googlecode/charts4j/Plots.java
0.976152
0.613526
Plots.java
starcoder
package com.itemanalysis.psychometrics.reliability; import com.itemanalysis.psychometrics.data.VariableAttributes; import java.util.ArrayList; /** * * @author <NAME> <meyerjp at itemanalysis.com> */ public interface ScoreReliability { /** * An array of reliability estimates without the item indexed by ...
psychometrics-ctt/src/main/java/com/itemanalysis/psychometrics/reliability/ScoreReliability.java
0.911307
0.449876
ScoreReliability.java
starcoder
package io.servicetalk.concurrent.api; import io.servicetalk.concurrent.internal.DefaultThreadFactory; import io.servicetalk.concurrent.internal.SignalOffloader; import io.servicetalk.concurrent.internal.SignalOffloaderFactory; import io.servicetalk.concurrent.internal.SignalOffloaders; import java.util.concurrent.Ex...
servicetalk-concurrent-api/src/main/java/io/servicetalk/concurrent/api/Executors.java
0.912995
0.505127
Executors.java
starcoder
package com.helospark.tactview.core.timeline.effect.interpolation.pojo; import com.fasterxml.jackson.annotation.JsonProperty; public class Point { public double x; public double y; public Point(@JsonProperty("x") double x, @JsonProperty("y") double y) { this.x = x; this.y = y; } ...
tactview-api/src/main/java/com/helospark/tactview/core/timeline/effect/interpolation/pojo/Point.java
0.945033
0.59611
Point.java
starcoder
package org.penitence.influxdb.generator; import org.penitence.influxdb.domain.HumitureSensor; import org.penitence.influxdb.utils.RandomSupplierUtils; import java.time.Instant; import java.time.LocalDateTime; import java.time.ZoneId; import java.util.Random; import java.util.function.Supplier; /** * @author renjie...
src/main/java/org/penitence/influxdb/generator/HumitureDataGenerator.java
0.860735
0.616359
HumitureDataGenerator.java
starcoder
package de.matthiasmann.twl.renderer; import de.matthiasmann.twl.HAlignment; /** * A font rendering interface * @author <NAME> */ public interface Font extends Resource { /** * Returns true if the font is proportional or false if it's fixed width. * @return true if the font is proportional */ ...
src/main/java/de/matthiasmann/twl/renderer/Font.java
0.919109
0.507507
Font.java
starcoder
package com.google.devtools.build.lib.syntax; import com.google.common.base.CharMatcher; import com.google.common.collect.ImmutableSet; import com.google.devtools.build.lib.syntax.Printer.BasePrinter; import java.util.List; import java.util.Map; /** * A helper class that offers a subset of the functionality of Pytho...
src/main/java/com/google/devtools/build/lib/syntax/FormatParser.java
0.894456
0.435181
FormatParser.java
starcoder
package com.google_voltpatches.common.reflect; import com.google_voltpatches.common.annotations.Beta; import com.google_voltpatches.common.collect.ForwardingMap; import com.google_voltpatches.common.collect.ImmutableMap; import com.google_voltpatches.errorprone.annotations.CanIgnoreReturnValue; import java.util.Map; ...
src/app/voltdb/voltdb_src/third_party/java/src/com/google_voltpatches/common/reflect/ImmutableTypeToInstanceMap.java
0.934664
0.421076
ImmutableTypeToInstanceMap.java
starcoder
package com.tngtech.archunit.library.dependencies; import java.util.Collection; import java.util.HashMap; import java.util.List; import java.util.Map; import com.google.common.collect.ArrayListMultimap; import com.google.common.collect.ForwardingCollection; import com.google.common.collect.ImmutableList; import com.g...
archunit/src/main/java/com/tngtech/archunit/library/dependencies/Graph.java
0.900275
0.452778
Graph.java
starcoder
package com.australiapost.datediffreporter.util; import java.util.*; /** * This class performs different operations such as * 1. Population of entire date (day month year in dd mm yyyy format) from 1900 till 2020 * 2. Finds the total number of days for a month and year. * 3. Checks if a date is a valid date * 4....
src/main/java/com/australiapost/datediffreporter/util/DateUtil.java
0.918512
0.637398
DateUtil.java
starcoder
package org.pathvisio.core.view; import java.awt.Color; import java.awt.Graphics2D; import java.awt.Shape; import java.awt.geom.AffineTransform; import java.awt.geom.Ellipse2D; import java.awt.geom.Rectangle2D; /** * A Handle is a little marker (like a little * yellow square) that the user can grab with the mouse ...
modules/org.pathvisio.core/src/org/pathvisio/core/view/Handle.java
0.882136
0.589835
Handle.java
starcoder
package org.apache.cassandra.db; import java.io.IOException; import java.nio.ByteBuffer; import java.util.*; import com.google.common.collect.Iterators; import org.apache.cassandra.config.CFMetaData; import org.apache.cassandra.config.ColumnDefinition; import org.apache.cassandra.db.rows.*; import org.apache.cassand...
src/java/org/apache/cassandra/db/Slices.java
0.94051
0.538194
Slices.java
starcoder
package com.openalpr.jni.json; // Note: this class was written without inspecting the non-free org.json sourcecode. /** * Parses a JSON (<a href="http://www.ietf.org/rfc/rfc4627.txt">RFC 4627</a>) * encoded string into the corresponding object. Most clients of * this class will use only need the {@link #JSONTokene...
Openalpr API/src/bindings/java/src/com/openalpr/jni/json/JSONTokener.java
0.929144
0.404272
JSONTokener.java
starcoder
import java.util.Arrays; import java.util.Collection; import java.util.Comparator; import java.util.HashSet; import java.util.Optional; import java.util.Scanner; import java.util.Set; import java.util.stream.Collectors; class Solution { private static class Map { private final int rowCount; private final int...
medium/bender-a-depressed-robot/java/src/main/java/Solution.java
0.695648
0.439687
Solution.java
starcoder
package boofcv.alg.mvs; import boofcv.BoofVerbose; import boofcv.abst.disparity.DisparitySmoother; import boofcv.abst.disparity.StereoDisparity; import boofcv.abst.geo.bundle.SceneStructureMetric; import boofcv.alg.distort.ImageDistort; import boofcv.alg.geo.PerspectiveOps; import boofcv.alg.geo.RectifyDistortImageOps...
main/boofcv-ip-multiview/src/main/java/boofcv/alg/mvs/MultiBaselineStereoIndependent.java
0.741955
0.53206
MultiBaselineStereoIndependent.java
starcoder
package stixar.graph; import stixar.graph.attr.AttributableBase; import stixar.util.ListCell; /** Implementation of an edge for an undirected graph. */ /* The basic idea behine this class is that in fact every undirected edge is comprised of two distinct half-edges. Each half edge points to the other half...
src/java/stixar/graph/BasicUEdge.java
0.744563
0.406155
BasicUEdge.java
starcoder
package particionado; import java.util.ArrayList; import java.util.Collection; import java.util.Collections; public class ValidacionCruzada implements EstrategiaParticionado { @Override // Devuelve el nombre de la estrategia de particionado public String getNombreEstrategiaParticionado() { return nul...
Practica2FAA/src/particionado/ValidacionCruzada.java
0.694924
0.473596
ValidacionCruzada.java
starcoder
package com.top.bpnn; import java.io.Serializable; public class BPParameter implements Serializable { //输入层神经元个数 private int inputLayerNeuronCount = 3; //隐含层神经元个数 private int hiddenLayerNeuronCount = 3; //输出层神经元个数 private int outputLayerNeuronCount = 1; //归一化区间 private double normaliz...
src/main/java/com/top/bpnn/BPParameter.java
0.70912
0.501831
BPParameter.java
starcoder
package org.apache.commons.configuration2.tree; import java.util.Collection; import java.util.Collections; import java.util.HashMap; import java.util.Iterator; import java.util.Map; import org.apache.commons.configuration2.ex.ConfigurationRuntimeException; /** * <p> * A class which can track specific nodes in an {...
src/main/java/org/apache/commons/configuration2/tree/NodeTracker.java
0.956927
0.482124
NodeTracker.java
starcoder
package com.thinkaurelius.titan.diskstorage.keycolumnvalue; import com.google.common.collect.ImmutableList; import com.thinkaurelius.titan.diskstorage.StaticBuffer; import com.thinkaurelius.titan.diskstorage.StorageException; import java.util.List; /** * Interface to a data store that has a BigTable like representa...
titan-core/src/main/java/com/thinkaurelius/titan/diskstorage/keycolumnvalue/KeyColumnValueStore.java
0.926074
0.580352
KeyColumnValueStore.java
starcoder
package crazypants.enderio.conduit.geom; import java.util.EnumMap; import java.util.HashMap; import java.util.Map; import net.minecraftforge.common.util.ForgeDirection; import com.enderio.core.client.render.BoundingBox; import com.enderio.core.common.util.ForgeDirectionOffsets; import com.enderio.core.common.vecmath...
src/main/java/crazypants/enderio/conduit/geom/ConduitGeometryUtil.java
0.857082
0.560794
ConduitGeometryUtil.java
starcoder
package com.blackhat.vector; import java.security.InvalidParameterException; import java.util.Arrays; import java.util.Collections; import java.util.List; import java.util.stream.Collectors; import java.util.stream.DoubleStream; import java.util.stream.IntStream; import com.blackhat.lib.*; public class SparseVector im...
src/main/java/com/blackhat/vector/SparseVector.java
0.849971
0.417746
SparseVector.java
starcoder
package com.typesafe.config; import java.util.Map; /** * Subtype of {@link ConfigValue} representing an object (AKA dictionary or map) * value, as in JSON's curly brace <code>{ "a" : 42 }</code> syntax. * * <p> * An object may also be viewed as a {@link Config} by calling * {@link ConfigObject#toConfig()}. * ...
config/src/main/java/com/typesafe/config/ConfigObject.java
0.93929
0.459561
ConfigObject.java
starcoder
package com.github.mikephil.charting.data; import java.util.ArrayList; import java.util.List; import com.github.mikephil.charting.charts.ScatterChart; import com.github.mikephil.charting.interfaces.datasets.IScatterDataSet; import com.github.mikephil.charting.renderer.scatter.ChevronDownShapeRenderer; import com.gith...
MPChartLib/src/main/java/com/github/mikephil/charting/data/ScatterDataSet.java
0.913563
0.447943
ScatterDataSet.java
starcoder