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 exchangerates import ( "encoding/json" "math" "strings" "time" "github.com/mayswind/ezbookkeeping/pkg/core" "github.com/mayswind/ezbookkeeping/pkg/errs" "github.com/mayswind/ezbookkeeping/pkg/log" "github.com/mayswind/ezbookkeeping/pkg/models" "github.com/mayswind/ezbookkeeping/pkg/utils" "github.co...
pkg/exchangerates/bank_of_canada_datasource.go
0.68616
0.408601
bank_of_canada_datasource.go
starcoder
//go:build ignore // +build ignore package math import "internal/cpu" func expTrampolineSetup(x float64) float64 func expAsm(x float64) float64 func logTrampolineSetup(x float64) float64 func logAsm(x float64) float64 // Below here all functions are grouped in stubs.go for other // architectures. const haveArchL...
libgo/go/math/arith_s390x.go
0.529263
0.677177
arith_s390x.go
starcoder
package exclusive import ( "context" "fmt" "bpxe.org/pkg/bpmn" "bpxe.org/pkg/errors" "bpxe.org/pkg/flow/flow_interface" "bpxe.org/pkg/flow_node" "bpxe.org/pkg/id" "bpxe.org/pkg/sequence_flow" "bpxe.org/pkg/tracing" ) type NoEffectiveSequenceFlows struct { *bpmn.ExclusiveGateway } func (e NoEffectiveSeque...
pkg/flow_node/gateway/exclusive/exclusive_gateway.go
0.580352
0.400515
exclusive_gateway.go
starcoder
package mapper import ( "github.com/rancher/norman/types" "github.com/rancher/norman/types/values" ) // These mappers copy data from the networking.k8s.io/v1-style Ingress fields // to extensions/v1beta1-style Ingress fields so that when the proxy store // serializes them into kubernetes resources, there is no loss...
pkg/schemas/mapper/ingress_backend.go
0.580352
0.417687
ingress_backend.go
starcoder
package economic // CustomerGroup In order to set up a new customer, it is necessary to specify a customer group. It is useful to group a company’s customers (e.g., ‘domestic’ and ‘foreign’ customers) and to link the group members to the same account when generating reports. type CustomerGroup struct { // The uniqu...
customers_post_structs.go
0.680242
0.46952
customers_post_structs.go
starcoder
package shogi import ( "fmt" ) // Piece represents shogi piece. type Piece int const ( // Empty is not piece, is just a empty cell. Empty Piece = 0 // Fu0 is a Fu owned by the first player. // Fu moves like a Pawn in chess. Fu0 Piece = 1 // Kyou0 is a Kyousha owned by the first player. // Kyousha moves li...
app/domain/entity/shogi/piece.go
0.568176
0.475179
piece.go
starcoder
package raytracing import ( "math" "math/rand" ) type Camera struct { lookFrom Point horizontal Vector vertical Vector toLowerLeftCorner Vector u Vector v Vector lensRadius float64 } type CameraConfig struct { aspectRatio float64 lookFrom ...
camera.go
0.815012
0.450903
camera.go
starcoder
package main import ( "log" "github.com/gdamore/tcell" "github.com/rivo/tview" ) // TableData will holds the table data and its header. type TableData struct { data [][]string header []string } // LoadData data from specified CSV file and set the TableData.data. func (td *TableData) LoadData(fileName string)...
viewer.go
0.609175
0.494385
viewer.go
starcoder
package aggregate import "go.mongodb.org/mongo-driver/bson" type Operation bson.M // The Pipe functions similar to the RxJS pipe function // (https://rxjs-dev.firebaseapp.com/api/index/function/pipe) in that // it accepts a set of functions as parameters. Each function receives // as its input, the output of the pre...
aggregate/pipeline.go
0.801198
0.655171
pipeline.go
starcoder
package main import ( "bufio" "fmt" "os" "strconv" ) // The goal of this assignment is to create a routine that sorts a series of ten integers using the bubble sort algorithm. // Write a Bubble Sort program in Go. The program should prompt the user to type in a sequence of up to 10 integers. // The program should...
bubblesort/bubblesort.go
0.612194
0.647617
bubblesort.go
starcoder
package module import ( "testing" "github.com/aws/aws-sdk-go/aws" "github.com/aws/aws-sdk-go/aws/session" "github.com/aws/aws-sdk-go/service/ec2" "github.com/stretchr/testify/assert" ) type Expectations struct { CIDRBlock string SubnetCIDRBlocks map[string]bool AvailabilityZones []string NATGateway...
test/module.go
0.581778
0.435301
module.go
starcoder
package csvdecoder import ( "encoding/json" "fmt" "reflect" "strconv" "strings" ) // convertAssignValues copies to dest the value in src, converting it if possible. // An error is returned if the conversion is not possible. // dest is expected to be a non-nil pointer type. func convertAssignValue(dest interface{...
convert.go
0.643105
0.445228
convert.go
starcoder
package main import ( "fmt" ) type BinarytreeNode struct { Value int Left *BinarytreeNode Right *BinarytreeNode } func getMaxNode(node *BinarytreeNode) *BinarytreeNode { if node == nil { return nil } currentNode := node for currentNode.Right != nil { currentNode = node.Right } return currentNode } ...
binary_search_tree.go
0.521471
0.512693
binary_search_tree.go
starcoder
package onshape import ( "encoding/json" ) // BTAndFilter110 struct for BTAndFilter110 type BTAndFilter110 struct { BTQueryFilter183 BtType *string `json:"btType,omitempty"` Operand1 *BTQueryFilter183 `json:"operand1,omitempty"` Operand2 *BTQueryFilter183 `json:"operand2,omitempty"` } // NewBTAndFilter110 insta...
onshape/model_bt_and_filter_110.go
0.69181
0.455259
model_bt_and_filter_110.go
starcoder
package paunch import ( "math" ) // polygon is an object that represents a series of connected lines that form // a shape. It is meant to be used through the Collider interface. type polygon struct { lines []*line bounds *bounding } func newPolygon(points []*point) *polygon { var poly polygon poly.lines = mak...
polygon.go
0.756358
0.518607
polygon.go
starcoder
package vpn /** * Binding class showing the aaapreauthenticationpolicy that can be bound to vpnvserver. */ type Vpnvserveraaapreauthenticationpolicybinding struct { /** * The name of the policy, if any, bound to the VPN virtual server. */ Policy string `json:"policy,omitempty"` /** * Integer specifying the polic...
resource/config/vpn/vpnvserver_aaapreauthenticationpolicy_binding.go
0.822011
0.435301
vpnvserver_aaapreauthenticationpolicy_binding.go
starcoder
package tf_idf import ( "errors" "math" ) const ( UnequalDocumentLength = "UnequalDocumentLength" EuclideanSumSquare = "EuclideanSumSquare" EuclideanSum = "EuclideanSum" ) type CountVectorizer interface { GetDictionary() map[string]uint64 VectorizedCounter() map[string][][]uint64 Vectorize([]string) (...
backend/vendor/github.com/adrian3ka/go-learn-ai/tf_idf/tf_idf.go
0.701815
0.438244
tf_idf.go
starcoder
package main import ( "fmt" "io/ioutil" "log" "strings" ) const ( inactive = byte('.') // false active = byte('#') // true ) // Supports 3 and 4 dimensions type Coord [4]int type Grid struct { gridCurr map[Coord]bool gridNext map[Coord]bool } func main() { // Read inputs into slice of int input := read...
day17_conway_cubes/main.go
0.576304
0.409988
main.go
starcoder
package inflector import ( "bytes" "fmt" "regexp" "strings" "sync" ) // Rule represents name of the inflector rule, can be // Plural or Singular type Rule int const ( Plural = iota Singular ) // InflectorRule represents inflector rule type InflectorRule struct { Rules []*ruleItem Irregular ...
inflector.go
0.578567
0.438304
inflector.go
starcoder
package interval import ( "fmt" "regexp" "strconv" "strings" "github.com/pkg/errors" ) // IntervalInteger represents an interval of integers type IntervalInteger struct { min int max int minIncluded bool maxIncluded bool } // NewIntegerInterval should be used to create a new interval of int...
vendor/github.com/normegil/interval/interval.go
0.82828
0.41401
interval.go
starcoder
package entity import ( "github.com/df-mc/dragonfly/dragonfly/entity/action" "github.com/df-mc/dragonfly/dragonfly/entity/physics" "github.com/df-mc/dragonfly/dragonfly/entity/state" "github.com/df-mc/dragonfly/dragonfly/item" "github.com/df-mc/dragonfly/dragonfly/world" "github.com/go-gl/mathgl/mgl64" "sync/at...
dragonfly/entity/item.go
0.776114
0.435781
item.go
starcoder
package quasigo import "strconv" func _() { // An "invalid array index" compiler error signifies that the constant values have changed. // Re-run the stringer command to generate them again. var x [1]struct{} _ = x[opInvalid-0] _ = x[opPop-1] _ = x[opDup-2] _ = x[opPushParam-3] _ = x[opPushIntParam-4] _ = x...
ruleguard/quasigo/opcode_string.go
0.525125
0.428293
opcode_string.go
starcoder
package bitfield import ( "encoding/binary" "math/bits" ) var _ = Bitfield(Bitvector512{}) // Bitvector512 is a bitfield with a fixed defined size of 512. There is no length bit // present in the underlying byte array. type Bitvector512 []byte const bitvector512ByteSize = 64 const bitvector512BitSize = bitvector5...
bitvector512.go
0.787931
0.426322
bitvector512.go
starcoder
package tsplib import ( "bufio" "fmt" "os" "regexp" "strconv" "strings" "github.com/heustis/tsp-solver-go/model" "github.com/heustis/tsp-solver-go/model2d" ) // TspLibData represents data used in "Symmetric traveling salesman problem" files from http://elib.zib.de/pub/mp-testdata/tsp/tsplib/tsplib.html. // I...
tsplib/tsplibdata.go
0.670824
0.427875
tsplibdata.go
starcoder
package crypto // hash.go supplies a few geneeral hashing functions, using the hashing // algorithm blake2b. Because changing the hashing algorithm for Sia has much // stronger implications than changing any of the other algorithms, blake2b is // the only supported algorithm. Sia is not really flexible enough to suppo...
vendor/github.com/NebulousLabs/Sia/crypto/hash.go
0.875867
0.455986
hash.go
starcoder
package pgtype import ( "encoding/binary" "fmt" "reflect" ) type RecordArray struct { Elements []Record Dimensions []ArrayDimension Status Status } func (dst *RecordArray) Set(src interface{}) error { // untyped nil and typed nil interfaces are different if src == nil { *dst = RecordArray{Status: Nu...
vendor/github.com/jackc/pgtype/record_array.go
0.515376
0.520253
record_array.go
starcoder
package gortex import "math" import ( "encoding/json" "fmt" "github.com/vseledkin/gortex/assembler" "math/rand" "os" "time" ) func init() { rand.Seed(time.Now().UTC().UnixNano()) } func Abs(f float32) float32 { if f < 0 { return -f } return f } func Max(x, y float32) float32 { if x < y { return y }...
gortex.go
0.675015
0.487124
gortex.go
starcoder
package iso20022 // Specifies rates of a corporate action. type CorporateActionRate66 struct { // Annual rate of a financial instrument. Interest *RateAndAmountFormat37Choice `xml:"Intrst,omitempty"` // Percentage of securities the offeror/issuer will purchase or redeem under the terms of the event. PercentageSo...
CorporateActionRate66.go
0.837254
0.661779
CorporateActionRate66.go
starcoder
package rtc import ( "io" "time" "github.com/mastercactapus/embedded/serial" ) func NewDS3231(rw io.ReadWriter) *DS3231 { return &DS3231{rw: rw} } type DS3231 struct { rw io.ReadWriter } type DS3231Alarm struct { Seconds int Minutes int Hours int IsPM bool // Only valid if Use12Hour is true. Day ...
driver/rtc/ds3231sn.go
0.572125
0.474753
ds3231sn.go
starcoder
package tensor3 type Vector struct { x, y, z Scalar } var xAxis, yAxis, zAxis = Vector{scale, 0, 0}, Vector{0, scale, 0}, Vector{0, 0, scale} var yzPlane, zxPlane, xyPlane = Vector{0, scale, scale}, Vector{scale, 0, scale}, Vector{scale, scale, 0} type Axis uint const ( XAxisIndex Axis = iota YAxisIndex ZAxisIn...
vec.go
0.663778
0.713756
vec.go
starcoder
package virtual import ( "log" "strings" "time" "github.com/davidscholberg/go-durationfmt" "github.com/rgeorgiev583/sofiatraffic/virtual/l10n" ) // VehicleArrival represents the event of arrival of an urban transit vehicle and describes the facilities in the vehicle. type VehicleArrival struct { Time ...
virtual/arrival.go
0.693473
0.411879
arrival.go
starcoder
package mlpack /* #cgo CFLAGS: -I./capi -Wall #cgo LDFLAGS: -L. -lmlpack_go_linear_regression #include <capi/linear_regression.h> #include <stdlib.h> */ import "C" import "gonum.org/v1/gonum/mat" type LinearRegressionOptionalParam struct { InputModel *linearRegression Lambda float64 Test *mat.Dense ...
linear_regression.go
0.743634
0.526099
linear_regression.go
starcoder
// Package coords keeps coordinates-related structs and their utilities for the // UI system. package coords import ( "fmt" "math" ) // Point represents a location. type Point struct { X int `json:"x"` Y int `json:"y"` } // NewPoint creates a new Point instance for given x,y coordinates. func NewPoint(x, y int)...
src/chromiumos/tast/local/coords/coords.go
0.908018
0.633382
coords.go
starcoder
package Find_the_Median_of_a_Number_Stream import ( "container/heap" ) /* Design a class to calculate the median of a number stream. The class should have the following two methods: 1. insertNum(int num): stores the number in the class 2. findMedian(): returns the median of all numbers inserted in the class If the...
Pattern09 - Two Heaps/Find_the_Median_of_a_Number_Stream/solution.go
0.755457
0.530358
solution.go
starcoder
package and import ( "regexp" "github.com/ZupIT/horusec-devkit/pkg/enums/confidence" "github.com/ZupIT/horusec-devkit/pkg/enums/severities" engine "github.com/ZupIT/horusec-engine" "github.com/ZupIT/horusec-engine/text" ) func NewCsharpAndCommandInjection() text.TextRule { return text.TextRule{ Metadata: eng...
internal/services/engines/csharp/and/and.go
0.62681
0.431944
and.go
starcoder
package types import ( abci "github.com/tendermint/tendermint/abci/types" "github.com/tendermint/tendermint/crypto" tmtypes "github.com/tendermint/tendermint/types" ) // status of a validator type BondStatus byte // nolint const ( Unbonded BondStatus = 0x00 Unbonding BondStatus = 0x01 Bonded BondStatus = 0...
types/stake.go
0.566378
0.422922
stake.go
starcoder
package ovsdb import ( "encoding/json" "fmt" "reflect" ) // OvsSet is an OVSDB style set // RFC 7047 has a weird (but understandable) notation for set as described as : // Either an <atom>, representing a set with exactly one element, or // a 2-element JSON array that represents a database set value. The // first...
go-controller/vendor/github.com/ovn-org/libovsdb/ovsdb/set.go
0.595022
0.511656
set.go
starcoder
package api import ( "math" "regexp" "strconv" "time" "github.com/xanzy/go-gitlab" ) type Overview struct { ID int `json:"id"` Type string `json:"type"` TimeSpents []TimeSpentEntry `json:"time-spents"` } type TimeSpentEntry struct { ID int `json:"id"` ...
pkg/api/overview.go
0.640523
0.42656
overview.go
starcoder
package main var data = []byte(`Note: The source for bufio.Reader is at source: https://cs.opensource.google/go/go/+/refs/tags/go1.18:src/bufio/bufio.go;l=62 So lets say we want use a bufio.Reader. We can see that the function signature for it looks like this: bufio.NewReader(rd io.Reader) *bufio.Reader So it takes an...
cmd/io/examples/data.go
0.500732
0.448728
data.go
starcoder
package automaton // Shunting-Yard Algorithm (https://en.wikipedia.org/wiki/Shunting-yard_algorithm) func ShuntingYardAlgo(inputString string) string { // Map to that we can map characters (e.g *(),.|) to integers // We choose these numbers due to the fact that certain characters have precedence over others charac...
shunt.go
0.816699
0.584716
shunt.go
starcoder
package expression import ( "fmt" errors "gopkg.in/src-d/go-errors.v1" "github.com/dolthub/go-mysql-server/sql" ) // GetField is an expression to get the field of a table. type GetField struct { table string fieldIndex int name string fieldType sql.Type nullable bool } // NewGetField creates ...
sql/expression/get_field.go
0.769167
0.428771
get_field.go
starcoder
package jaeger import ( "fmt" "net/url" "strings" "time" "go.opentelemetry.io/otel/attribute" "go.opentelemetry.io/otel/exporters/jaeger" "go.opentelemetry.io/otel/sdk/resource" tracesdk "go.opentelemetry.io/otel/sdk/trace" semconv "go.opentelemetry.io/otel/semconv/v1.7.0" "go.opentelemetry.io/otel/trace" ...
internal/impl/jaeger/tracer_jaeger.go
0.60288
0.437463
tracer_jaeger.go
starcoder
package api import ( "github.com/GoogleCloudPlatform/kubernetes/pkg/api" ) type Policy struct { api.TypeMeta `json:",inline"` // Holds the information to configure the fit predicate functions Predicates []PredicatePolicy `json:"predicates"` // Holds the information to configure the priority functions Priorities...
plugin/pkg/scheduler/api/types.go
0.694199
0.400046
types.go
starcoder
package ui import termbox "github.com/nsf/termbox-go" var ( // ZeroPoint x and y all are 0 ZeroPoint = &Point{0, 0} ) // Point represent a point in screen type Point struct { X, Y int } // Equals is used to compare two point func (p *Point) Equals(o *Point) bool { return p.X == o.X && p.Y == o.Y } // Right ret...
ui/point.go
0.845017
0.572723
point.go
starcoder
package plaid import ( "encoding/json" ) // Owner Data returned from the financial institution about the owner or owners of an account. Only the `names` array must be non-empty. type Owner struct { // A list of names associated with the account by the financial institution. These should always be the names of indi...
plaid/model_owner.go
0.640523
0.421909
model_owner.go
starcoder
package ag import ( "github.com/nlpodyssey/spago/ag/fn" ) // Abs returns a new operator node as a result of the `Abs` function. func Abs(x Node) Node { return NewOperator(fn.NewAbs(x)) } // Add returns a new operator node as a result of the fn.Add function. // As special case, the first node may be null. // This ...
ag/operators.go
0.880309
0.650828
operators.go
starcoder
// nolint: lll package pulumi import ( "context" "reflect" "sync" "github.com/pkg/errors" "github.com/pulumi/pulumi/sdk/go/pulumi/asset" ) const ( outputPending = iota outputResolved outputRejected ) // Output helps encode the relationship between resources in a Pulumi application. Specifically an output ...
sdk/go/pulumi/properties.go
0.652906
0.400163
properties.go
starcoder
package mana import ( "time" "github.com/iotaledger/hive.go/marshalutil" "github.com/iotaledger/hive.go/objectstorage" ) const ( // ConsensusBaseManaPastVectorMetadataStorageKey is the key to the consensus base vector metadata storage. ConsensusBaseManaPastVectorMetadataStorageKey = "consensusBaseManaVectorMeta...
packages/mana/consensusbasevectormetadata.go
0.777596
0.461684
consensusbasevectormetadata.go
starcoder
package forms import ( "math/rand" "time" "github.com/porter-dev/porter/internal/models" ) const randCharset string = "abcdefghijklmnopqrstuvwxyz1234567890" // CreateTestInfra represents the accepted values for creating test // infra via the provisioning container type CreateTestInfra struct { ProjectID uint `j...
internal/forms/infra.go
0.643105
0.482429
infra.go
starcoder
package minmax import "math" // F32 represents a min / max range for float32 values. // Supports clipping, renormalizing, etc type F32 struct { Min float32 Max float32 } // Set sets the min and max values func (mr *F32) Set(min, max float32) { mr.Min, mr.Max = min, max } // SetInfinity sets the Min to +MaxFloat...
minmax/minmax32.go
0.853623
0.540257
minmax32.go
starcoder
package dynamodb import ( "github.com/aws/aws-sdk-go/aws" "github.com/guregu/dynamo" ) type ( // Update : Represents changes to an existing item. Update interface { // Range : Specifies the range key (sort key) for the item to update. Range(name string, value interface{}) Update // Set : Changes path to the...
update.go
0.715722
0.496399
update.go
starcoder
package main import ( "image" "image/color" "image/png" "math" "math/cmplx" "os" ) func f(z complex128) complex128 { return cmplx.Pow(z, 4) - 1 } func df(z complex128) complex128 { return 4 * cmplx.Pow(z, 3) } func main() { const ( xmin, ymin, xmax, ymax = -2, -2, +2, +2 ...
workspaces/garymacindoe/src/garymacindoe.co.uk/mandelbrot/main.go
0.801858
0.427935
main.go
starcoder
package resourcetree import ( "fmt" "reflect" "strconv" "github.com/knative/test-infra/tools/webhook-apicoverage/coveragecalculator" ) // BasicTypeKindNode represents resource tree node of basic types like int, float, etc. type BasicTypeKindNode struct { NodeData values map[string]bool // Values seen for this ...
tools/webhook-apicoverage/resourcetree/basictypekindnode.go
0.665084
0.476823
basictypekindnode.go
starcoder
package acquire // Hotel represents the name of hotel chain type Hotel int const ( // HotelEmpty means a lack of a played tile HotelEmpty Hotel = iota // HotelNeutral is a neutral tile HotelNeutral // HotelTower hotels HotelTower // HotelLuxor hotels HotelLuxor // HotelAmerican hotels HotelAmerican //...
lib/hotel.go
0.630457
0.478041
hotel.go
starcoder
package config // InputJSONSchemaPredict defines the json schema for input payload to invoke prediction pipeline const InputJSONSchemaPredict string = `{ "$schema": "http://json-schema.org/draft-07/schema#", "definitions": { "uuid4": { "type": "string", "pattern": "^[a-fA-F0-9]{...
config/schema_predict.go
0.707405
0.444143
schema_predict.go
starcoder
package pretty import ( "io" "github.com/ohler55/ojg" ) // JSON encoded output. Arguments can be used to set the writer options. An // int sets the width while a float64 is separated into a width as the integer // portion of the float and the 10ths sets the maximum depth per line. A bool // sets the align option ...
pretty/pretty.go
0.773302
0.414306
pretty.go
starcoder
package geom import ( "math" ) //Envelope represents a two-dimensional rectangular region type Envelope struct { Min, Max Point } //NewEnvelope returns a new empty envelope func NewEnvelope() *Envelope { return &Envelope{ Min: Point{X: math.Inf(1), Y: math.Inf(1)}, Max: Point{X: math.Inf(-1), Y: math.Inf(-1)...
envelope.go
0.890993
0.721902
envelope.go
starcoder
package unionfind import ( "fmt" "strings" ) type Graph struct { count int // Number of connected components parents []int // Stores parent of each tree node at i. This stores the forest sizes []int // Stores size/weight of each tree rooted at i } // New instantiates a new graph with n nodes for union-fin...
graphs/unionfind/unionfind.go
0.705075
0.431644
unionfind.go
starcoder
package iso20022 // Provides information on the status of a trade. type TradeData14 struct { // Reference to the unique system identification assigned to the trade by the central matching system. MatchingSystemUniqueReference *Max35Text `xml:"MtchgSysUnqRef"` // Reference to the unique matching identification ass...
TradeData14.go
0.788094
0.442094
TradeData14.go
starcoder
package videooptimization /** * Configuration for videooptimization detectionpolicy resource. */ type Videooptimizationdetectionpolicy struct { /** * Name for the videooptimization detection policy. Must begin with a letter, number, or the underscore character (_), and must contain only letters, numbers, and the hyp...
resource/config/videooptimization/videooptimizationdetectionpolicy.go
0.78838
0.432782
videooptimizationdetectionpolicy.go
starcoder
package numeric import ( "math" "math/big" "strconv" "github.com/jackytck/gowboy/common" "github.com/jackytck/gowboy/number" ) // Sqrt computes the square root of n with precision number of decimal digits. // The first part gives the integer part, the second gives the integer + decimal part. // e.g. Sqrt(2, 20)...
numeric/numeric.go
0.740362
0.436562
numeric.go
starcoder
package conversions import ( "fmt" "go/token" "sort" "strings" "github.com/dave/dst" "github.com/pkg/errors" "github.com/Azure/azure-service-operator/hack/generator/pkg/astbuilder" "github.com/Azure/azure-service-operator/hack/generator/pkg/astmodel" ) // PropertyAssignmentFunction represents a function tha...
hack/generator/pkg/conversions/property_assignment_function.go
0.829527
0.406332
property_assignment_function.go
starcoder
package nifi import ( "encoding/json" ) // SnippetDTO struct for SnippetDTO type SnippetDTO struct { // The id of the snippet. Id *string `json:"id,omitempty"` // The URI of the snippet. Uri *string `json:"uri,omitempty"` // The group id for the components in the snippet. ParentGroupId *string `json:"parentGr...
model_snippet_dto.go
0.738858
0.422862
model_snippet_dto.go
starcoder
package iso20022 // Chain of parties involved in the settlement of a transaction, including receipts and deliveries, book transfers, treasury deals, or other activities, resulting in the movement of a security or amount of money from one account to another. type DeliveringPartiesAndAccount1 struct { // Party that se...
DeliveringPartiesAndAccount1.go
0.623148
0.492371
DeliveringPartiesAndAccount1.go
starcoder
ERROR: type should be string, got " https://arxiv.org/abs/1702.03154\n*/\npackage boomphf\n\nimport \"math/bits\"\n\n// H is hash function data\ntype H struct {\n\tb []bitvector\n\tranks [][]uint64\n}\n\n// Gamma is good default value for controlling space vs. construction speed\nconst Gamma = 2\n\n// New contructs a perfect hash function for the keys. The gamma value controls the space used.\nfunc New(gamma float64, keys []uint64) *H {\n\n\tvar h H\n\n\tvar level uint32\n\n\tsize := uint32(gamma * float64(len(keys)))\n\tsize = (size + 63) &^ 63\n\tA := newbv(size)\n\tcollide := newbv(size)\n\n\tvar redo []uint64\n\n\tfor len(keys) > 0 {\n\t\tfor _, v := range keys {\n\t\t\thash := xorshiftMult64(v)\n\t\t\th1, h2 := uint32(hash), uint32(hash>>32)\n\t\t\tidx := (h1 ^ rotl(h2, level)) % size\n\n\t\t\tif collide.get(idx) == 1 {\n\t\t\t\tcontinue\n\t\t\t}\n\n\t\t\tif A.get(idx) == 1 {\n\t\t\t\tcollide.set(idx)\n\t\t\t\tcontinue\n\t\t\t}\n\n\t\t\tA.set(idx)\n\t\t}\n\n\t\tbv := newbv(size)\n\t\tfor _, v := range keys {\n\t\t\thash := xorshiftMult64(v)\n\t\t\th1, h2 := uint32(hash), uint32(hash>>32)\n\t\t\tidx := (h1 ^ rotl(h2, level)) % size\n\n\t\t\tif collide.get(idx) == 1 {\n\t\t\t\tredo = append(redo, v)\n\t\t\t\tcontinue\n\t\t\t}\n\n\t\t\tbv.set(idx)\n\t\t}\n\t\th.b = append(h.b, bv)\n\n\t\tkeys = redo\n\t\tredo = redo[:0] // tricky, sharing space with `keys`\n\t\tsize = uint32(gamma * float64(len(keys)))\n\t\tsize = (size + 63) &^ 63\n\t\tA.reset()\n\t\tcollide.reset()\n\t\tlevel++\n\t}\n\n\th.computeRanks()\n\n\treturn &h\n}\n\nfunc (h *H) computeRanks() {\n\tvar pop uint64\n\tfor _, bv := range h.b {\n\n\t\tr := make([]uint64, 0, 1+(len(bv)/8))\n\n\t\tfor i, v := range bv {\n\t\t\tif i%8 == 0 {\n\t\t\t\tr = append(r, pop)\n\t\t\t}\n\t\t\tpop += uint64(bits.OnesCount64(v))\n\t\t}\n\t\th.ranks = append(h.ranks, r)\n\t}\n}\n\n// Query returns the index of the key\nfunc (h *H) Query(k uint64) uint64 {\n\n\thash := xorshiftMult64(k)\n\th1, h2 := uint32(hash), uint32(hash>>32)\n\n\tfor i, bv := range h.b {\n\t\tidx := (h1 ^ rotl(h2, uint32(i))) % uint32(len(bv)*64)\n\n\t\tif bv.get(idx) == 0 {\n\t\t\tcontinue\n\t\t}\n\n\t\trank := h.ranks[i][idx/512]\n\n\t\tfor j := (idx / 64) &^ 7; j < idx/64; j++ {\n\t\t\trank += uint64(bits.OnesCount64(bv[j]))\n\t\t}\n\n\t\tw := bv[idx/64]\n\n\t\trank += uint64(bits.OnesCount64(w << (64 - (idx % 64))))\n\n\t\treturn rank + 1\n\t}\n\n\treturn 0\n}\n\n// Size returns the size in bytes\nfunc (h *H) Size() int {\n\tvar size int\n\tfor _, v := range h.b {\n\t\tsize += len(v) * 8\n\t}\n\tfor _, v := range h.ranks {\n\t\tsize += len(v) * 8\n\t}\n\treturn size\n}\n\nfunc rotl(v uint32, r uint32) uint32 {\n\treturn (v << r) | (v >> (32 - r))\n}\n\n// 64-bit xorshift multiply rng from http://vigna.di.unimi.it/ftp/papers/xorshift.pdf\nfunc xorshiftMult64(x uint64) uint64 {\n\tx ^= x >> 12 // a\n\tx ^= x << 25 // b\n\tx ^= x >> 27 // c\n\treturn x * 2685821657736338717\n}\n\ntype bitvector []uint64\n\nfunc newbv(size uint32) bitvector {\n\treturn make([]uint64, uint(size+63)/64)\n}\n\n// get bit 'bit' in the bitvector d\nfunc (b bitvector) get(bit uint32) uint {\n\tshift := bit % 64\n\tbb := b[bit/64]\n\tbb &= (1 << shift)\n\n\treturn uint(bb >> shift)\n}\n\n// set bit 'bit' in the bitvector d\nfunc (b bitvector) set(bit uint32) {\n\tb[bit/64] |= (1 << (bit % 64))\n}\n\nfunc (b bitvector) reset() {\n\tfor i := range b {\n\t\tb[i] = 0\n\t}\n}"
boomphf.go
0.796451
0.522689
boomphf.go
starcoder
package dist import ( "bitbucket.org/dtolpin/infergo/mathx" "fmt" "math" ) // Common constants var ( logpi, log2pi float64 ) func init() { log2 := math.Log(2) logpi = math.Log(math.Pi) log2pi = log2 + logpi } // Unbounded distributions // Normal distribution type normal struct{} // Normal distribution, si...
dist/dist.go
0.867892
0.630116
dist.go
starcoder
package books import ( "log" "path" "regexp" "strings" "github.com/kapmahc/epub" ) // A MetadataParser is used to parse the metadata for a book from a list of BookFiles. // As some implementations will use info from BookFiles to make parsing decisions, // it is best to populate these as much as possible before ...
metadata.go
0.678753
0.431884
metadata.go
starcoder
package engine import ( "github.com/vova616/chipmunk" "github.com/vova616/chipmunk/vect" ) type Physics struct { BaseComponent Body *chipmunk.Body Box *chipmunk.BoxShape Shape *chipmunk.Shape lastPosition vect.Vect lastAngle vect.Float interpolatedPosition vect.Vect interpolatedAngle vect.Float ...
engine/Physics.go
0.601008
0.450662
Physics.go
starcoder
package iso20022 // Information about the message reference of the message for which the status is requested and the business reference of the transfer instruction. type MessageAndBusinessReference6 struct { // Reference to a linked message that was previously sent. PreviousReference *AdditionalReference3 `xml:"Prv...
MessageAndBusinessReference6.go
0.790934
0.400984
MessageAndBusinessReference6.go
starcoder
package similarities import ( "fmt" "github.com/jtejido/golucene/core/search" "math" ) type Normalization interface { Tfn(stats Stats, tf, len float32) float32 Explain(stats Stats, tf, len float32) search.Explanation String() string } type normalizationSPI interface { Tfn(stats Stats, tf, len float32) float32...
core/search/similarities/normalization.go
0.852966
0.412944
normalization.go
starcoder
package math // Rect represents a rectangle. type Rect struct { // Origin is the origin of the rectangle, typically the top left corner. Origin Pos // Size is the size of the rectangle, typically positive. Size Delta } // 3 l 2 = {3, 4} // 3 l 1 = {3} // 3 l 0 = {} // 3 l -1 = {2} // 3 l -2 = {2, 1} // Normaliz...
internal/math/rect.go
0.918013
0.582372
rect.go
starcoder
package xoodyak type KeyedXoodyak struct { xoodyak Xoodyak } const ( rateKeyedInput xoodyakRate = 44 rateKeyedOutput xoodyakRate = 24 rateRatchet xoodyakRate = 16 rateCounter xoodyakRate = 1 ) func NewKeyed(key, id, counter []byte) *KeyedXoodyak { if len(key) == 0 { panic("xoodyak: key is empty") }...
keyed.go
0.569613
0.413122
keyed.go
starcoder
package micro import ( "fmt" "github.com/awalterschulze/gominikanren/sexpr/ast" ) // State is a product of a list of substitutions and a variable counter. type State struct { Substitutions Counter uint64 } // String returns a string representation of State. func (s *State) String() string { if s.Substitutions ...
micro/goal.go
0.721351
0.413181
goal.go
starcoder
package tensor // Tensor is a datastructure that can store [1,n) dimensional float64 elements. type Tensor struct { Data []float64 Shape Shape } // Add performs elementwise addition of Tensor delta to Tensor a. // Tensor delta should be of the dimensions as Tensor a func (a *Tensor) Add(delta *Tensor) { for k := ...
tensor.go
0.883601
0.901401
tensor.go
starcoder
package fnsdk import ( "encoding/json" "fmt" "reflect" "strconv" "sigs.k8s.io/kustomize/kyaml/yaml" ) type variantKind string const ( variantKindMap variantKind = "Map" variantKindSlice variantKind = "Slice" variantKindScalar variantKind = "Scalar" ) type variant interface { Kind() variantKind Node()...
thirdparty/kyaml/fnsdk/variant.go
0.584864
0.487856
variant.go
starcoder
package camera import ( "math" "math/rand" "github.com/hunterloftis/pbr/pkg/geom" ) // SLR generates rays from a simulated physical camera into a Scene. // The rays produced are determined by position, // orientation, sensor type, focus, exposure, and lens selection. // TODO: Bloom filter: https://en.wikipedia.or...
pkg/camera/slr.go
0.666062
0.500244
slr.go
starcoder
package utils import ( "fmt" ) // HasPair is used to check if a slice of integers contains two numbers that sum // up to a value. This function takes a slice of integers and target value as // input. It returns true if the slice contains two numbers that sum up to the // value. func HasPair(input []int, target int) ...
pkg/utils/utils.go
0.879302
0.599221
utils.go
starcoder
package iso20022 // Conversion between the currency of a card acceptor and the currency of a card issuer, provided by a dedicated service provider. The currency conversion has to be accepted by the cardholder. type CurrencyConversion2 struct { // Identification of the currency conversion operation for the service pr...
CurrencyConversion2.go
0.847527
0.596139
CurrencyConversion2.go
starcoder
package application const ProviderSchema = ` { "$id": "https://appvia.io/schemas/serviceprovider/application.json", "$schema": "http://json-schema.org/draft-07/schema#", "description": "Kubernetes Application provider", "type": "object", "additionalProperties": false }` const AppSchema = ` { "$id": "https://...
pkg/serviceproviders/application/schemas.go
0.667148
0.436802
schemas.go
starcoder
package structtransformer import ( "reflect" ) type numericalTransformer interface { Fit(vals []float64) Transform(val float64) float64 } type stringTransformer interface { Fit(vals []string) Transform(val string) float64 } type stringExpandingTransformer interface { Fit(vals []string) NumFeatures() int Tra...
structtransformer/structtransformer.go
0.544075
0.410815
structtransformer.go
starcoder
package rtc import ( "math" ) const ( epsilon = 1e-4 ) // Tuple is a 4-float vector. type Tuple [4]float64 // X returns the X value of the Tuple. func (t Tuple) X() float64 { if len(t) == 0 { return 0 } return t[0] } // Y returns the Y value of the Tuple. func (t Tuple) Y() float64 { if len(t) == 0 { ret...
rtc/tuples.go
0.900823
0.811078
tuples.go
starcoder
package value import ( "fmt" "reflect" "strconv" "time" ) // Data holds an untyped (interface{}) value which can be assigned to a bool, // int, int64, uint, uint64, float64, string, or time.Duration. type Data struct { Set bool pointer interface{} } // New creates a new Data type with the given value. func...
value/data.go
0.669205
0.485112
data.go
starcoder
package Singular import ( "bytes" "fmt" "math" ) var DenseMatrixPrototype = DenseMatrix{ rows: 0, cols: 0, values: nil, } type DenseMatrix struct { rows, cols int values [][]float64 // [rows][cols]float64 } // 递归拷贝 func copyDenseValues(values [][]float64) [][]float64 { cp := make([][]float64, len(v...
dense_matrix.go
0.662687
0.650613
dense_matrix.go
starcoder
package processor import ( "fmt" "github.com/Jeffail/benthos/lib/log" "github.com/Jeffail/benthos/lib/metrics" "github.com/Jeffail/benthos/lib/types" "github.com/Jeffail/benthos/lib/util/text" ) //------------------------------------------------------------------------------ func init() { Constructors[TypeLo...
lib/processor/log.go
0.76856
0.672715
log.go
starcoder
package parsers import ( "fmt" "strconv" "strings" "unicode" "github.com/1pkg/gofire" ) // ParseTypeValue parses provided string value accordingly to the value type. func ParseTypeValue(t gofire.Typ, val string) (interface{}, bool, error) { k := t.Kind() switch k { case gofire.Array: return parseTypeValueR...
parsers/parsetv.go
0.506591
0.441854
parsetv.go
starcoder
package rangedbtest import ( "fmt" "math" "testing" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" "github.com/inklabs/rangedb" ) // VerifyRecordSerializer verifies the RecordSerializer interface. func VerifyRecordSerializer(t *testing.T, newSerializer func() rangedb.RecordSerializ...
rangedbtest/verify_record_serializer.go
0.602646
0.551211
verify_record_serializer.go
starcoder
package resp import ( "bufio" "bytes" "errors" "fmt" "io" "io/ioutil" "strconv" "github.com/shipwire/swutil/swio" ) // RedisType represents one of the five types RESP values may take or it is unknown or invalid. type RedisType int // RESP types const ( UnknownType RedisType = iota InvalidType SimpleStrin...
resp/resp.go
0.669205
0.400222
resp.go
starcoder
package mat import "math" // Vector3 is 1x3 matrix for 2D transformations and coordinate representation. type Vector3 [3]float64 // Matrix3 is 3x3 matrix for 2D transformations. type Matrix3 [9]float64 var Identity3 = Matrix3{ 1, 0, 0, 0, 1, 0, 0, 0, 1, } // DotMatrix calculates dot product of m·o. // The resul...
pkg/mat/mat3.go
0.794664
0.732711
mat3.go
starcoder
package incrdelaunay // pointMap is an optimized hashset like structure to indicate if and how many copies of a point exists. type pointMap struct { points [][]pointEntry // The table. } // newPointMap creates a pointMap with a specified size. func newPointMap(size int) pointMap { pMap := pointMap{} pMap.points = ...
triangulation/incrdelaunay/pointmap.go
0.877135
0.642236
pointmap.go
starcoder
package max_slice import "math" /* A zero-indexed array A consisting of N integers is given. It contains daily prices of a stock share for a period of N consecutive days. If a single share was bought on day P and sold on day Q, where 0 ≤ P ≤ Q < N, then the profit of such transaction is equal to A[Q] − A[P], provided...
max-slice/MaxProfit.go
0.861582
0.882276
MaxProfit.go
starcoder
package stringindex import ( "math" "sort" "strings" ) const ( substringPenaltyScale = 3 ) // Match stores the confidence that a result with the id is a match. type Match struct { ID int Confidence float64 } // Index is a simple search index. // It does not store values, only the value's ID provided b...
internal/stringindex/index.go
0.730194
0.491212
index.go
starcoder
package trees // Trie for unicode chars // Value stores the value corresponding to string for e.g. it can store phone number for a name // Children map is a map of char to next node. Since we can have many unicode runes, keeping an array is not good // For leaf nodes, Children map will be empty // isTerminal will...
collections/trees/trie.go
0.751101
0.476823
trie.go
starcoder
package bayesfactor import ( . "github.com/ljcolling/go-distributions" "math" ) func Bayesfactor(likelihood LikelihoodDef, altprior PriorDef, nullprior PriorDef) (float64, error) { var data Likelihood var alt Prior var null Prior switch likelihood.Name { case "noncentral_d": d := likelihood.Params[0] df :...
bayesfactor.go
0.754373
0.488405
bayesfactor.go
starcoder
package system // The system package is a dumping ground for globals that are shared between // the packages. const ( // CPUFrequency is the 6502 CPU frequency in Hz CPUFrequency = 1023000 // AudioSampleRate is the audio sample rate in Hz AudioSampleRate = 44100 ) var ( // PendingInterrupt is set when an inter...
system/system.go
0.520984
0.566198
system.go
starcoder
package simulator type LocusType int const ( LOCUS_UNDEFINED LocusType = iota LOCUS_DISCRETE LOCUS_CONTINUOUS ) // ImplicitLocus is the generic type of a locus. // Note that on the implementation, the value is always a float even if it is discrete. // This makes the implementation easier and more uniform. type Imp...
simulator/implicit_locus.go
0.718002
0.457137
implicit_locus.go
starcoder
package spatial import ( "math" "github.com/lethal-guitar/go_tracer/scene" ) const MAX_SPHERES_PER_CONTAINER = 64 // Back end for spatial data structures: A flat list of traceables, that allows // checking against rays. // When used directly as tracing Engine, you get the classic "naive ray tracing" // algo...
spatial/objectcontainer.go
0.841468
0.415195
objectcontainer.go
starcoder
import "github.com/kaitai-io/kaitai_struct_go_runtime/kaitai" /** * Compressed resource data in `'dcmp' (1)` format, * as stored in compressed resources with header type `8` and decompressor ID `1`. * * The `'dcmp' (1)` decompressor resource is included in the System file of System 7.0 and later. * This compre...
dcmp_1/src/go/dcmp_1.go
0.689828
0.434941
dcmp_1.go
starcoder
package binary_tree_inorder_traversal_ import "container/list" /* 94. 二叉树的中序遍历 https://leetcode-cn.com/problems/binary-tree-inorder-traversal 给定一个二叉树,返回它的中序 遍历。 示例: 输入: [1,null,2,3] 1 \ 2 / 3 输出: [1,3,2] */ type TreeNode struct { Val int Left *TreeNode Right *TreeNode } // 递归实现,时空复杂度O(n)...
solutions/binary-tree-inorder-traversal/d.go
0.599251
0.436322
d.go
starcoder
package aggregate import ( "fmt" "github.com/HdrHistogram/hdrhistogram-go" "math" "strconv" ) // Aggregator summarizes a set of integer data points to a single number. type Aggregator interface { // Add records a single data point. Add(n int64) // Result returns the final output of aggregation. Result() int64...
analysis/aggregate/aggregate.go
0.838713
0.448185
aggregate.go
starcoder
// Package day21 solves AoC 2017 day 21. package day21 import ( "fmt" "math/bits" "github.com/fis/aoc/glue" "github.com/fis/aoc/util" ) func init() { glue.RegisterSolver(2017, 21, glue.RegexpSolver{ Solver: solve, Regexp: `^(\S+) => (\S+)$`, }) } func solve(lines [][]string) ([]string, error) { book, er...
2017/day21/day21.go
0.575946
0.54692
day21.go
starcoder