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 pb import ( "encoding/binary" "github.com/golang/protobuf/proto" "github.com/pkg/errors" ) // OffsetReader defines a behavior needed for decoding, i.e. reading bytes starting at a particular offset. // For example, files implement this interface via their ReadAt method. type OffsetReader interface { // R...
pb/decode.go
0.748995
0.458591
decode.go
starcoder
package metrics // github.com/openshift-online/ocm-sdk-go/metrics // pathTreeData is the JSON representation of the tree of URL paths. var pathTreeData = `{ "api": { "accounts_mgmt": { "v1": { "access_token": null, "accounts": { "-": { "labels": { "-": n...
metrics/path_tree_data.go
0.63409
0.456955
path_tree_data.go
starcoder
package builtin import ( "fmt" "github.com/filecoin-project/go-state-types/big" ) // PARAM_SPEC // The duration of a chain epoch. // Motivation: It guarantees that a block is propagated and WinningPoSt can be successfully done in time all supported miners. // Usage: It is used for deriving epoch-denominated period...
actors/builtin/network.go
0.537527
0.479808
network.go
starcoder
package v1alpha1 import ( v1alpha1 "kubeform.dev/provider-azurerm-api/apis/machine/v1alpha1" "k8s.io/apimachinery/pkg/api/errors" "k8s.io/apimachinery/pkg/labels" "k8s.io/client-go/tools/cache" ) // LearningComputeClusterLister helps list LearningComputeClusters. // All objects returned here must be treated as ...
client/listers/machine/v1alpha1/learningcomputecluster.go
0.639511
0.442938
learningcomputecluster.go
starcoder
package clone import ( "errors" "regexp" "sort" "strings" "sync" "github.com/Open-Science-Global/poly/checks" "github.com/Open-Science-Global/poly/seqhash" "github.com/Open-Science-Global/poly/transform" ) /****************************************************************************** Apr 22, 2021 Cloning s...
poly/clone/clone.go
0.695338
0.507995
clone.go
starcoder
package simplvalidator import ( "net/url" "regexp" "unicode" ) /* String Validators */ //Checks if the given value is empty or not (ie) == "" func IsEmpty(value string) bool { return value == "" } //Checks if the length of the value is greater than the length(arg) func IsLengthGreater(value string, length int)...
validator.go
0.789356
0.441071
validator.go
starcoder
package iso20022 // Describes the type of product and the assets to be transferred. type ISATransfer24 struct { // Information identifying the primary individual investor, for example, name, address, social security number and date of birth. PrimaryIndividualInvestor *IndividualPerson8 `xml:"PmryIndvInvstr,omitempt...
ISATransfer24.go
0.721743
0.440409
ISATransfer24.go
starcoder
// Package otel provides data structures to represent and generate otel configuration. package otel import ( "fmt" yaml "github.com/goccy/go-yaml" "github.com/mitchellh/mapstructure" ) // Pipeline represents a single OT receiver and zero or more processors that must be chained after that receiver. type Pipeline ...
confgenerator/otel/modular.go
0.646237
0.444505
modular.go
starcoder
package config /** * Binding class showing the nslogpolicy that can be bound to lbvserver. */ type Lbvservernslogpolicybinding struct { /** * Name of the policy bound to the LB vserver. */ Policyname string `json:"policyname,omitempty"` /** * Priority. */ Priority uint32 `json:"priority,omitempty"` /** * ...
resource/config/lbvserver_nslogpolicy_binding.go
0.759671
0.417271
lbvserver_nslogpolicy_binding.go
starcoder
package bls377 import ( "github.com/consensys/gnark/ecc/bls377/fp" ) // e2 is a degree-two finite field extension of fp.Element: // A0 + A1u where u^2 == 5 is a quadratic nonresidue in fp type e2 struct { A0, A1 fp.Element } // SetString sets a e2 element from strings func (z *e2) SetString(s1, s2 string) *e2 { ...
ecc/bls377/e2.go
0.794544
0.508605
e2.go
starcoder
package qrm import ( "database/sql" "fmt" "github.com/go-jet/jet/v2/internal/utils" "github.com/go-jet/jet/v2/qrm/internal" "github.com/google/uuid" "reflect" "strings" "time" ) var scannerInterfaceType = reflect.TypeOf((*sql.Scanner)(nil)).Elem() func implementsScannerType(fieldType reflect.Type) bool { if...
qrm/utill.go
0.595728
0.411998
utill.go
starcoder
package http import "github.com/rsteube/carapace" // ActionTags completes html tags // a (Defines a hyperlink) // abbr (Defines an abbreviation or an acronym) func ActionTags() carapace.Action { // https://www.w3schools.com/TAgs/default.asp return carapace.ActionValuesDescribed( //"!--...--", "Defines a comm...
pkg/actions/net/http/tag.go
0.564339
0.613758
tag.go
starcoder
package labels import ( "bytes" "encoding/json" "fmt" "regexp" "strings" "github.com/prometheus/common/model" ) // MatchType is an enum for label matching types. type MatchType int // Possible MatchTypes. const ( MatchEqual MatchType = iota MatchNotEqual MatchRegexp MatchNotRegexp ) func (m MatchType) S...
pkg/labels/matcher.go
0.764716
0.402627
matcher.go
starcoder
package pain import ( "encoding/xml" "github.com/figassis/bankiso/iso20022" ) type Document00800101 struct { XMLName xml.Name `xml:"urn:iso:std:iso:20022:tech:xsd:pain.008.001.01 Document"` Message *CustomerDirectDebitInitiationV01 `xml:"pain.008.001.01"` } func (d *Document00800101) Ad...
generate/iso20022/pain/CustomerDirectDebitInitiationV01.go
0.756717
0.419232
CustomerDirectDebitInitiationV01.go
starcoder
package frame import ( "github.com/yomorun/y3" ) // DataFrame defines the data structure carried with user's data // transferring within YoMo type DataFrame struct { metaFrame *MetaFrame payloadFrame *PayloadFrame } // NewDataFrame create `DataFrame` with a transactionID string, // consider change transactionI...
core/frame/data_frame.go
0.770551
0.527377
data_frame.go
starcoder
package plan import ( "fmt" "strings" ) // Privilege specifies a privilege to be used in a GRANT or REVOKE statement. type Privilege struct { Type PrivilegeType Columns []string } // PrivilegeLevel defines the level that a privilege applies to. type PrivilegeLevel struct { Database string TableRoutine ...
sql/plan/grant_data.go
0.560012
0.492737
grant_data.go
starcoder
package wire import ( "fmt" "io" ) // BloomUpdateType specifies how the filter is updated when a match is found type BloomUpdateType uint8 const ( // BloomUpdateNone indicates the filter is not adjusted when a match is found. BloomUpdateNone BloomUpdateType = 0 // BloomUpdateAll indicates if the filter match...
pkg/chain/wire/msgfilterload.go
0.724675
0.410638
msgfilterload.go
starcoder
package main import ( "fmt" "math" ) // specification for an integration type spec struct { lower, upper float64 // bounds for integration n int // number of parts exact float64 // expected answer fs string ...
lang/Go/numerical-integration.go
0.728072
0.604866
numerical-integration.go
starcoder
package emulator import ( "math" "math/rand" "time" ) // Emulated event types const ( SinglePhaseFault = iota ThreePhaseFault = iota OverVoltage = iota UnderVoltage = iota OverFrequency = iota UnderFrequency = iota CapacitorOverCurrent = iota ) // EmulatedFaultStartSa...
emulator.go
0.647798
0.66035
emulator.go
starcoder
package tao import ( "fmt" "sync/atomic" ) //原子的int64 // AtomicInt64 provides atomic int64 type. type AtomicInt64 int64 // NewAtomicInt64 returns an atomic int64 type. func NewAtomicInt64(initialValue int64) *AtomicInt64 { a := AtomicInt64(initialValue) return &a } // Get returns the value of int64 atomically....
concurrent.go
0.811863
0.579817
concurrent.go
starcoder
package template import ( "bytes" "fmt" "io/ioutil" "os" "os/exec" "path" "reflect" "strings" "github.com/coveooss/gotemplate/v3/collections" "github.com/coveooss/gotemplate/v3/hcl" "github.com/coveooss/gotemplate/v3/utils" "github.com/fatih/color" ) const ( runtimeFunc = "Runtime" ) var runtimeFuncsAr...
template/extra_runtime.go
0.597138
0.506591
extra_runtime.go
starcoder
package identity // CreatePrincipalQueryParams represents valid query parameters for the CreatePrincipal operation // For convenience CreatePrincipalQueryParams can be formed in a single statement, for example: // `v := CreatePrincipalQueryParams{}.SetInviteId(...)` type CreatePrincipalQueryParams struct { // Inv...
services/identity/param_generated.go
0.934268
0.472927
param_generated.go
starcoder
package ansi import ( "fmt" "strconv" ) const ( numStaticBytes = 3 numStaticInts = 3 ) // Seq represents an escape sequence, led either by ESC or CSI control // sequence for writing to some output. May only be constructed by any of the // Escape.With family of methods. type Seq struct { id Escape numBytes in...
ansi/control.go
0.591133
0.517205
control.go
starcoder
package container import ( "fmt" "io" "reflect" "unsafe" "github.com/matrixorigin/matrixone/pkg/vm/engine/tae/stl" ) func NewStdVector[T any](opts ...*Options) *stdVector[T] { vec := &stdVector[T]{ buf: make([]byte, 0), slice: make([]T, 0), } var capacity int var buf []byte if len(opts) > 0 { opt :...
pkg/vm/engine/tae/stl/container/stdvec.go
0.596198
0.423339
stdvec.go
starcoder
package timecode // CountDroppedFrames counts the number of frames that have been dropped after a certain number of minutes. // This is used when we are going the opposite direction of the below function. When this function is used, // we're parsing a timecode into a specific frame index. We need to know how many appa...
dropframe.go
0.860134
0.641478
dropframe.go
starcoder
package primitives import ( "github.com/alexandreLamarre/Golang-Ray-Tracing-Renderer/pkg/algebra" "math" ) //Bounds handles AABB(axis-aligned bounding boxes) ray intersects to speed up complex Shape Groups rendering type Bounds struct { maximum *algebra.Vector minimum *algebra.Vector } //NewBounds Initializer fo...
pkg/geometry/primitives/bound.go
0.886285
0.534795
bound.go
starcoder
package decode import ( "fmt" "math/big" "github.com/wader/fq/pkg/bitio" "github.com/wader/fq/pkg/scalar" ) // Type BigInt // TryFieldBigIntScalarFn tries to add a field, calls scalar functions and returns actual value as a BigInt func (d *D) TryFieldBigIntScalarFn(name string, fn func(d *D) (scalar.S, error), ...
pkg/decode/decode_gen.go
0.829734
0.425486
decode_gen.go
starcoder
package plaid import ( "encoding/json" ) // MortgageInterestRate Object containing metadata about the interest rate for the mortgage. type MortgageInterestRate struct { // Percentage value (interest rate of current mortgage, not APR) of interest payable on a loan. Percentage NullableFloat32 `json:"percentage"` /...
plaid/model_mortgage_interest_rate.go
0.712132
0.553867
model_mortgage_interest_rate.go
starcoder
package primitives import ( "errors" "github.com/phoreproject/synapse/chainhash" "github.com/phoreproject/synapse/pb" ) // AttestationData is the part of the attestation that is signed. type AttestationData struct { Slot uint64 // FFG vote BeaconBlockHash chainhash.Hash SourceEpoch uint64 SourceHash chain...
primitives/attestation.go
0.68342
0.439026
attestation.go
starcoder
package models // PortRange represents a modifiable closed-open port range [Begin:End[ // used when assigning ports to tasks. // 端口范围 type PortRange struct { Begin uint64 End uint64 } // NewPortRange creates a new modifiable port range from a Mesos value range. // Both the begin and end ports are part of the por...
pkg/placement/models/ports.go
0.61173
0.460107
ports.go
starcoder
package gone import "github.com/fr3fou/gone/matrix" // Optimizer is the optimizer type (returns the error) type Optimizer func(n *NeuralNetwork, dataSet DataSet) float64 // SGD is Stochastic Gradient Descent (On-line Training) func SGD() Optimizer { return func(n *NeuralNetwork, dataSet DataSet) float64 { return ...
gone/optimizer.go
0.70477
0.468183
optimizer.go
starcoder
package phpgrep import ( "bytes" "fmt" "strings" "github.com/VKCOM/noverify/src/ir" ) type matcherState struct { literalMatch bool capture []CapturedNode } type matcher struct { // root is a compiled pattern node. root ir.Node // numVars is a max number of named captures this matcher may need. numVars i...
src/phpgrep/matcher.go
0.502686
0.424651
matcher.go
starcoder
package dsp import ( "math" ) // ToComplex returns the complex equivalent of the real-valued slice. func ToComplex(x []float32) []complex64 { y := make([]complex64, len(x)) for n, v := range x { y[n] = complex(v, 0) } return y } // IsPowerOf2 returns true if x is a power of 2, else false. func IsPowerOf2(x in...
internal/dsp/dsputils.go
0.867008
0.617138
dsputils.go
starcoder
package ogletest import ( "github.com/jacobsa/oglematchers" ) // AssertEq(e, a) is equivalent to AssertThat(a, oglematchers.Equals(e)). func AssertEq(expected, actual interface{}, errorParts ...interface{}) ExpectationResult { res := ExpectThat(actual, oglematchers.Equals(expected), errorParts...) res.SetCaller(g...
src/github.com/jacobsa/ogletest/assert_aliases.go
0.70416
0.50592
assert_aliases.go
starcoder
package formulas import "github.com/TaperBox/formulas/math" // Abs returns the absolute value (ie. the modulus) of a supplied number func Abs(number float64) (float64, error) { return mathlib.Abs(number) } // Exp returns e raised to a given power func Exp(number float64) (float64, error) { return mathlib.Exp(number)...
math.go
0.935788
0.831177
math.go
starcoder
package memory import ( "fmt" "reflect" "github.com/google/gapid/core/data" ) // Read reads the value pointed at p from the decoder d using C alignment rules. // If v is an array or slice, then each of the elements will be read, // sequentially. func Read(d *Decoder, p interface{}) { v := reflect.ValueOf(p) if...
gapis/memory/read.go
0.540681
0.422803
read.go
starcoder
// Package interpreter provides functions to evaluate parsed expressions with // the option to augment the evaluation with inputs and functions supplied at // evaluation time. package interpreter import ( "github.com/google/cel-go/common/packages" "github.com/google/cel-go/common/types/ref" "github.com/google/cel-...
vendor/github.com/google/cel-go/interpreter/interpreter.go
0.742795
0.679699
interpreter.go
starcoder
package vanity // Key consists of a ed25519 256-bit SpendKey and a ViewKey. // In order to make the mnemonic seeds work, ViewKey is actually derived from // SpendKey with Keccak256, also leading to SpendKey serving as the seed. type Key struct { SpendKey, ViewKey *[32]byte } func (k *Key) PublicSpendKey() *[32]byte ...
key.go
0.824885
0.579162
key.go
starcoder
package beerjson import "encoding/json" import "fmt" // ID: https://raw.githubusercontent.com/beerjson/beerjson/master/json/fermentable.json // FermentableAdditionType collects the attributes of each fermentable ingredient for use in a recipe fermentable bill. type FermentableAdditionType struct { Producer *string ...
fermentable.go
0.702632
0.406096
fermentable.go
starcoder
package c64image import ( "fmt" "image" "image/color" "image/draw" _ "image/jpeg" "image/png" "math" "os" ) // According to http://hitmen.c02.at/temp/palstuff/ var C64Colors = [16]color.RGBA{ {0x00, 0x00, 0x00, 0xFF}, // 0 - black {0xFF, 0xFF, 0xFF, 0xFF}, // 1 - white {0x67, 0x37, 0x2B, 0xFF}, // 2 - r...
internal/c64image/converter.go
0.532182
0.430387
converter.go
starcoder
package main import ( "fmt" "strconv" "strings" "time" ) // The number, 197, is called a circular prime because all rotations of the digits: 197, 971, and 719, are themselves prime. // There are thirteen such primes below 100: 2, 3, 5, 7, 11, 13, 17, 31, 37, 71, 73, 79, and 97. // How many circular primes are the...
0035-circular-primes/0035.go
0.622574
0.404743
0035.go
starcoder
package main import "fmt" func main() { // defining the size is mandatory in case of array declaration var myArray [3]int // when not initialized with values, it will default to their zero values. // In this case the default value is 0 fmt.Printf("myArray: %v\n\n", myArray) // Arrays are passed by value to fu...
essentials/section3/arraysdemo.go
0.505615
0.459319
arraysdemo.go
starcoder
package camt import ( "encoding/xml" "github.com/fairxio/finance-messaging/iso20022" ) type Document02700101 struct { XMLName xml.Name `xml:"urn:iso:std:iso:20022:tech:xsd:camt.027.001.01 Document"` Message *ClaimNonReceipt `xml:"camt.027.001.01"` } func (d *Document02700101) AddMessage() *ClaimNonRecei...
iso20022/camt/ClaimNonReceipt.go
0.682468
0.438665
ClaimNonReceipt.go
starcoder
package main var responseSchema string = ` { "$schema": "http://json-schema.org/draft-06/schema#", "$id": "https://standards.oftrust.net/v2/Schema/DataProductOutput/Forecast/Weather/AccuWeather?v=2.0", "required": [ "@context", "data", "signature" ], "properties": { "@context": { "type": "string", "...
schemas_response.go
0.674801
0.480844
schemas_response.go
starcoder
package linear import ( "time" ) // Units for Velocity values. Always multiply with a unit when setting the initial value like you would for // time.Time. This prevents you from having to worry about the internal storage format. const ( Knot Velocity = Velocity(NauticalMile) / Velocity(time.Hour) N...
linear/velocity_generated.go
0.935861
0.783823
velocity_generated.go
starcoder
package aiplan_vector_int import ( "bytes" "fmt" "html/template" "net/http" "github.com/kasworld/goguelike-single/enum/aiplan" ) type AIPlanVector_int [aiplan.AIPlan_Count]int func (es AIPlanVector_int) String() string { var buf bytes.Buffer fmt.Fprintf(&buf, "AIPlanVector_int[") for i, v := range es { f...
enum/aiplan_vector_int/aiplan_vector_gen.go
0.509276
0.46794
aiplan_vector_gen.go
starcoder
package cluster import ( "math" "github.com/ivan-pindrop/hclust/matrixop" "github.com/ivan-pindrop/hclust/tree" "github.com/ivan-pindrop/hclust/typedef" ) // NearestNeighbor clusters a distance matrix using one of the following linkage // methods: average, complete, mcquitty or ward. func NearestNeighbor(matrix ...
cluster/nearestneighbor.go
0.654674
0.583292
nearestneighbor.go
starcoder
package iso20022 // Provides further details specific to the individual transaction(s) included in the message. type CreditTransferTransaction3 struct { // Ultimate party that owes an amount of money to the (ultimate) creditor. UltimateDebtor *PartyIdentification43 `xml:"UltmtDbtr,omitempty"` // Party that initia...
CreditTransferTransaction3.go
0.754644
0.422028
CreditTransferTransaction3.go
starcoder
package entity import ( "github.com/photoprism/photoprism/pkg/s2" ) type CellMap map[string]Cell func (m CellMap) Get(name string) Cell { if result, ok := m[name]; ok { return result } return UnknownLocation } func (m CellMap) Pointer(name string) *Cell { if result, ok := m[name]; ok { return &result } ...
internal/entity/cell_fixtures.go
0.557123
0.442275
cell_fixtures.go
starcoder
package token import "fmt" // Type is a bitmask representing the type of a token type Type int const ( InvalidType Type = 1 << iota KeywordType // keyword, e.g. "static", "function" LiteralType // literal, e.g. 234, "a string", false MarkerType // marker for code blocks and groupings, e.g. {, ( Opera...
token/tokenTypes.go
0.623262
0.414899
tokenTypes.go
starcoder
package main import ( "flag" "image" "image/color" "image/png" "math" "math/rand" "os" "path" "sync" "time" ) func Thresholding(img *image.Gray, threshold uint8) (out *image.Gray) { // get image bounds rectangle := (*img).Bounds() // create output image out = image.NewGray(rectangle) for y := rectang...
task2/main.go
0.620966
0.52275
main.go
starcoder
package pqinterval import ( "database/sql/driver" "errors" "fmt" "strings" "time" ) // Interval can represent the full range of PostgreSQL's interval type. type Interval struct { // the top bit is the sign for the microseconds, // bottom 29 are the signed year. yrs uint32 hrs int32 // it takes 33 bits (ou...
interval.go
0.677581
0.418162
interval.go
starcoder
package nist_sp800_22 import ( "math" ) // param mode: A switch for applying the test either forward through the input sequence // mode = 0 : forward through the input sequence // mode = 1 : backward through the sequence func CumulativeSums(mode int, n uint64) (float64, bool, error) { if n...
nist_sp800_22/cumulativeSums.go
0.714728
0.46794
cumulativeSums.go
starcoder
package goutils /* int alias for uint byte alias for uint8 rune alias for int32 */ // Operate a,b: type TypeOperator func(a, b interface{}, op string) interface{} // Operate strings func StringOperator(a, b interface{}, op string) interface{} { aAsserted := a.(string) bAsserted := b.(string) switc...
goutils_typeoperator_functions.go
0.662032
0.556761
goutils_typeoperator_functions.go
starcoder
package types import ( "sync" "github.com/attic-labs/noms/go/d" "github.com/attic-labs/noms/go/util/functions" ) type DiffChangeType uint8 const ( DiffChangeAdded DiffChangeType = iota DiffChangeRemoved DiffChangeModified ) type ValueChanged struct { ChangeType DiffChangeType V Value } func send...
go/types/ordered_sequences_diff.go
0.580947
0.505554
ordered_sequences_diff.go
starcoder
package tc import ( "strings" "github.com/jho4us/tc/test" ) // Service is the interface that provides test contructor methods. type Service interface { // CreateTest registers a new empty test in the system CreateTest(name string) (test.ID, error) // LoadTest returns a read model of a test. LoadTest(id test.I...
tc/service.go
0.61682
0.426919
service.go
starcoder
package calendar import ( "errors" "fmt" "time" ) // Checks if the given time is at the given month and day func atMD(date time.Time, month, day int) bool { return (date.Month() == time.Month(month)) && (date.Day() == day) } // Checks if the two given times are at the same months and days func atDate(t, when tim...
vendor/github.com/xyproto/calendar/utils.go
0.857872
0.705931
utils.go
starcoder
package gtypes import ( "fmt" "github.com/llir/llvm/ir/types" ) // ByteCount returns the byte size of the type. func ByteCount(t types.Type) int { switch t := t.(type) { case *types.ArrayType: return ArrayByteCount(t) case *types.StructType: return StructByteCount(t) case *types.VoidType: return VoidByte...
pkg/gtypes/size.go
0.775562
0.616388
size.go
starcoder
package valprotocol import ( "fmt" "math/big" "math/rand" "github.com/offchainlabs/arbitrum/packages/arb-util/common" "github.com/offchainlabs/arbitrum/packages/arb-util/hashing" ) type ChildType uint const ( InvalidInboxTopChildType ChildType = 0 InvalidExecutionChildType ChildType = 1 ValidChildType ...
packages/arb-validator-core/valprotocol/nodeData.go
0.560012
0.413477
nodeData.go
starcoder
package basic // MergeTest is template to generate itself for different combination of data type. func MergeTest() string { return ` func TestMerge<FINPUT_TYPE1><FINPUT_TYPE2>(t *testing.T) { map1 := map[<INPUT_TYPE1>]<INPUT_TYPE2>{1: 10, 2: 20, 3: 30} map2 := map[<INPUT_TYPE1>]<INPUT_TYPE2>{4: 40, 5: 50, 3: 30} ...
internal/template/basic/mergetest.go
0.659186
0.76769
mergetest.go
starcoder
package main import "fmt" func merge(x int, y int) int { return x + y } func build(arr []int, low int, high int, tree []int, tree_index int) { if low == high { // leaf node, store value in node. tree[tree_index] = arr[low] return } mid := low + (high-low)/2 // recursive deeper for children. build(arr, low...
segment_tree.go
0.658527
0.576482
segment_tree.go
starcoder
package segmenttree import ( "github.com/Tv0ridobro/data-structure/math" ) // SegmentTree represents a segment tree. // Zero value of SegmentTree is invalid segment tree, should be used only with New(). type SegmentTree[T any] struct { op func(T, T) T neutral T elements []T } // New returns new SegmentTre...
segment-tree/segment-tree.go
0.745676
0.537527
segment-tree.go
starcoder
package agent import ( "math/rand" "github.com/arbori/population.git/population/space" ) type InterationRuleType func(a1 *MobileAgent, a2 *MobileAgent, contribuitionProbability float32, exchangeRate float32) type Exchange struct { ContribuitionProbability float32 ExchangeRate float32 interationRule...
agent/mobileAgent.go
0.58948
0.653777
mobileAgent.go
starcoder
package mvt import ( "fmt" "strconv" "github.com/everystreet/go-geojson/v2" "github.com/everystreet/go-mvt/internal/geometry" ) type ( // Layers is an ordered list of named layers in a tile. // Layer names must be unique inside a single tile. Layers map[LayerName]Layer // Layer is a single layer in a tile. ...
layer.go
0.858926
0.400046
layer.go
starcoder
package ahrs import ( "github.com/skelterjohn/go.matrix" "log" "math" ) type KalmanState struct { State } func (s *KalmanState) CalcRollPitchHeadingUncertainty() (droll float64, dpitch float64, dheading float64) { droll, dpitch, dheading = VarFromQuaternion(s.E0, s.E1, s.E2, s.E3, math.Sqrt(s.M.Get(6, 6)), ma...
goflying/ahrs/ahrs_kalman.go
0.714927
0.563378
ahrs_kalman.go
starcoder
package datadog import ( "encoding/json" ) // SLOHistorySLIData An object that holds an SLI value and its associated data. It can represent an SLO's overall SLI value. This can also represent the SLI value for a specific monitor in multi-monitor SLOs, or a group in grouped SLOs. type SLOHistorySLIData struct { // ...
api/v1/datadog/model_slo_history_sli_data.go
0.802285
0.511168
model_slo_history_sli_data.go
starcoder
package parser import ( "fmt" "strings" "unicode" "unicode/utf8" "github.com/ebay/akutan/util/cmp" "github.com/sirupsen/logrus" "github.com/vektah/goparsify" ) const ( // QuerySparql indicates that the query is in the sparql(ish) subset format. QuerySparql = "sparql" // QueryFactPattern indicates that the...
src/github.com/ebay/akutan/query/parser/parser.go
0.647241
0.414721
parser.go
starcoder
package unicornify import ( . "github.com/drbrain/go-unicornify/unicornify/core" . "github.com/drbrain/go-unicornify/unicornify/elements" . "github.com/drbrain/go-unicornify/unicornify/rendering" "github.com/drbrain/gopyrand" "image" "math" ) func MakeAvatar(hash string, size int, withBackground bool, zoomOut b...
unicornify/avatar.go
0.576184
0.538559
avatar.go
starcoder
package units // bunVelocity is the base unit name for velocity const bunVelocity = "metre/second" // velocityFamily represents the base unit of Velocity var velocityFamily = &Family{ baseUnitName: bunVelocity, description: "unit of velocity", name: Velocity, familyAliases: []string{"speed"}, } // Ve...
units/velocity.go
0.510008
0.496216
velocity.go
starcoder
package cios import ( "fmt" "math" "reflect" "sort" ) type NullableSeriesDataLocationStream []NullableSeriesDataLocation func NullableSeriesDataLocationStreamOf(arg ...NullableSeriesDataLocation) NullableSeriesDataLocationStream { return arg } func NullableSeriesDataLocationStreamFrom(arg []NullableSeriesDataLo...
cios/stream_nullableseriesdatalocation.go
0.533641
0.467818
stream_nullableseriesdatalocation.go
starcoder
package bayes import ( "strings" "github.com/hickeroar/gobayes/bayes/category" ) // Classification is the result object from a classify action against the Classifier struct type Classification struct { Category string Score float64 } // Classifier is responsible for classifying text samples type Classifier s...
bayes/bayes.go
0.85149
0.485966
bayes.go
starcoder
package line import ( "strings" "github.com/adamcolton/geom/d3" ) // Line in 3D space, invoked parametrically type Line struct { T0 d3.Pt D d3.V } // Pt1 returns a Pt on the line. func (l Line) Pt1(t float64) d3.Pt { return l.T0.Add(l.D.Multiply(t)) } // V1 always returns l.D, the slope of the line. func (l ...
d3/curve/line/line.go
0.733833
0.677451
line.go
starcoder
package storagetesting import ( "bytes" "context" "reflect" "sort" "testing" "github.com/kopia/repo/storage" ) // AssertGetBlock asserts that the specified storage block has correct content. func AssertGetBlock(ctx context.Context, t *testing.T, s storage.Storage, block string, expected []byte) { t.Helper() ...
internal/storagetesting/asserts.go
0.687735
0.551211
asserts.go
starcoder
package main import ( "bufio" "fmt" "io" "math/rand" "time" ) // choseLineRandomly implements the method described in the task. // input is a an io.Reader, which could be an os.File, for example. // Or, to implement a simulation, it could be anything else that implements // io.Reader. The method as described su...
tasks/One-of-n-lines-in-a-file/one-of-n-lines-in-a-file.go
0.611498
0.405508
one-of-n-lines-in-a-file.go
starcoder
// Package pipelinetest contains helper utilities for constructing test cases // that exercise the components of a NEL collector pipeline. package pipelinetest import ( "bytes" "fmt" "net/http" "net/http/httptest" "testing" "time" "github.com/google/nel-collector/pkg/collector" ) type simulatedClock struct {...
pkg/pipelinetest/pipelinetest.go
0.767341
0.435121
pipelinetest.go
starcoder
package iro // Gradient contains colors and interpolation points to allow for non-uniform // gradients. Also uses a base color for interpolations outside the gradient // range. type Gradient struct { Colors []Color Stops []float64 Base Color table []Color } // NewGradient creates a new gradient from colors, s...
iro/gradient.go
0.84338
0.52409
gradient.go
starcoder
package elarr import "reflect" // Filter will return a new slice containing only the elements // that return true from the condition. // supports array, slice. // this function use reflect, will more slow than other Filter functions. func Filter(data interface{}, condition func(interface{}) bool) []interface{} { v :...
elarr/filter.go
0.699768
0.438184
filter.go
starcoder
package helper import ( "math" "reflect" ) // InArray in_array() // haystack supported types: slice, array or map func InArray(needle interface{}, haystack interface{}) bool { val := reflect.ValueOf(haystack) switch val.Kind() { case reflect.Slice, reflect.Array: for i := 0; i < val.Len(); i++ { if reflect....
array.go
0.657538
0.4133
array.go
starcoder
package dates import ( "regexp" "strconv" "strings" "github.com/pkg/errors" ) // Parse receives text containing a potential date or range of dates, and translates them into a // slice of Historic, where the first element is the earliest date detected in the text, and the // second element is the latest date dete...
pkg/dates/parse.go
0.645679
0.48438
parse.go
starcoder
package store import ( "fmt" "strconv" "time" ) // CachePeriod is a custom type which describes the amount of time before // a cached value is considered to have been expired. This type has // several reserved values that govern caching behavior. type CachePeriod time.Duration const ( // CachePeriodForever is a...
store/cachePeriod.go
0.854126
0.50531
cachePeriod.go
starcoder
package jsonlogic import ( "fmt" ) // AddOpIf adds "if"/"?:" operation to the JSONLogic instance. func AddOpIf(jl *JSONLogic) { jl.AddOperation("if", opIf) jl.AddOperation("?:", opIf) } func opIf(apply Applier, params []interface{}, data interface{}) (res interface{}, err error) { var i int for i = 0; i < len(p...
logic.go
0.549399
0.444263
logic.go
starcoder
package transform import ( "image" "math" "github.com/anthonynsimon/bild/clone" "github.com/anthonynsimon/bild/parallel" ) // ShearH applies a shear linear transformation along the horizontal axis, // the parameter angle is the shear angle to be applied. // The transformation will be applied with the center of t...
transform/shear.go
0.806091
0.634175
shear.go
starcoder
package ecs // Graph is an auto-relation: one where both the A-side and B-side are the // same Core system. type Graph struct { Relation } // NewGraph creates a new graph relation for the given Core system. func NewGraph(core *Core, flags RelationFlags) *Graph { G := &Graph{} G.Init(core, flags) return G } // In...
internal/ecs/graph.go
0.712632
0.505371
graph.go
starcoder
package main import ( "github.com/montanaflynn/stats" "github.com/paulsmith/gogeos/geos" "github.com/venicegeo/geojson-go/geojson" ) const ( // DETECTION is the key for the GeoJSON property indicating whether a shoreline // was previously detected DETECTION = "detection" // DETECTEDSTATS is the key for the Geo...
qualitative.go
0.681939
0.522994
qualitative.go
starcoder
package openapi import ( "encoding/json" ) // SubscribeRate struct for SubscribeRate type SubscribeRate struct { SubscribeThrottlingRatePerConsumer *int32 `json:"subscribeThrottlingRatePerConsumer,omitempty"` RatePeriodInSecond *int32 `json:"ratePeriodInSecond,omitempty"` } // NewSubscribeRate instantiates a new...
openapi/model_subscribe_rate.go
0.707
0.447883
model_subscribe_rate.go
starcoder
package flow import ( "math/rand" "time" "github.com/chrislusf/gleam/script" "github.com/chrislusf/gleam/util" ) func New() (fc *FlowContext) { r := rand.New(rand.NewSource(time.Now().UnixNano())) fc = &FlowContext{ PrevScriptType: "luajit", Scripts: map[string]func() script.Script{ "luajit": script.Ne...
flow/context.go
0.565299
0.427158
context.go
starcoder
package main import ( "time" ) func kernel_measureFFT(N int, mintime float64, R *Random) float64{ twoN := 2*N x := RandomVector(twoN,R) var cycles int = 1 var result float64 = 0 var start time.Time for { start = time.Now() for i:=0;i<cycles;i++ { FFT_transform(twoN,x) FFT_inverse(t...
gcc/GO/kernel.go
0.605566
0.403097
kernel.go
starcoder
package eval import ( "github.com/dito/src/object" "io" "math" "math/rand" "os" "time" ) // Builtins : map of builtin functions var Builtins = map[string]*object.Builtin{ // type conversions. "int": &object.Builtin{ Name: "int", Fn: typeSwitch(object.IntType), Info: "Convert value to `Int`",...
src/eval/builtins.go
0.671363
0.467271
builtins.go
starcoder
package model // Common basic data structures: PdfRectangle, PdfDate, etc. // These kinds of data structures can be copied, do not need a unique copy of each object. import ( "errors" "fmt" "math" "regexp" "strconv" "time" "github.com/pzduniak/unipdf/core" ) // PdfRectangle is a definition of a rectangle. ty...
bot/vendor/github.com/pzduniak/unipdf/model/structures.go
0.786459
0.571767
structures.go
starcoder
package main // after 12h of fighting my mess of a code I looked for a solution that was // close to mine and then I adapted the following code: // https://github.com/dankoo97/AoC_2021/blob/06936b9707cdae0f2d88c46f2fda1899b6af1a07/BeaconScanner.py import ( "bufio" "fmt" "math" "os" "strconv" "strings" "time" )...
2021/day19/day19.go
0.570212
0.475301
day19.go
starcoder
// Package fifo models the First-In-First-Out position management // to calculate results of algorithmic trading by trade signals, // given that returns are not reinvested and positions are not rebalanced. package fifo import ( "fmt" "math" "strconv" ) const fairSize int = 9999 // iniSignals puts initial signa...
fifo/signals.go
0.543106
0.556038
signals.go
starcoder
package mixins import ( "io" "github.com/ipld/go-ipld-prime/datamodel" ) type BytesTraits struct { PkgName string TypeName string // see doc in kindTraitsGenerator TypeSymbol string // see doc in kindTraitsGenerator } func (BytesTraits) Kind() datamodel.Kind { return datamodel.Kind_Bytes } func (g BytesT...
schema/gen/go/mixins/bytesGenMixin.go
0.518059
0.431105
bytesGenMixin.go
starcoder
package storage // ClearDataForOriginArgs represents the arguments for ClearDataForOrigin in the Storage domain. type ClearDataForOriginArgs struct { Origin string `json:"origin"` // Security origin. StorageTypes string `json:"storageTypes"` // Comma separated origin names. } // NewClearDataForOriginAr...
vendor/github.com/mafredri/cdp/protocol/storage/command.go
0.843219
0.474814
command.go
starcoder
package math import ( "github.com/nuberu/engine/event" nativeMath "math" ) type Quaternion struct { x float32 y float32 z float32 w float32 changeEvent *event.Emitter } func NewDefaultQuaternion() *Quaternion { return NewQuaternion(0, 0, 0, 1) } func NewQuaternion(x float32, y float32, z float32, w float32...
quaternion.go
0.67694
0.525369
quaternion.go
starcoder
Introduction to interfaces So what is an interface? An interface is two things: it is a set of methods, but it is also a type. Let’s focus on the method set aspect of interfaces first. Typically, we’re introduced to interfaces with some contrived example. Let’s go with the contrived example of writing some applicatio...
01 | Go by Example/internal/20_Interfaces/ref/How to use interfaces in Go/interfaces1.go
0.681727
0.693914
interfaces1.go
starcoder
package tree import ( "errors" ) // Node is the structure of node type Node struct { tree *Tree parent *Node children []*Node prefix []byte Content interface{} } // GetParent return the parent node of current node func (n *Node) GetParent() (*Node, error) { if n.parent == nil { return nil, errors.New("...
node.go
0.667256
0.406509
node.go
starcoder
package metadata // Supplier is the interface for supplying a value type Supplier func() interface{} // Container is the metadata containe object. type Container struct { data map[string]interface{} } // Get will retrieve the value of supplied key. func (c *Container) Get(key string) (interface{}, bool) { if c.Emp...
metadata/metadata.go
0.778144
0.407451
metadata.go
starcoder
package cell // Weight behavior // ISynapse is a common interface. // A synapse is associated with a connection and one or more behaviors. // One such behavior is STDP for evaluating the Long-term effect. // Each synapse is part of a group called a Compartment. type ISynapse interface { Id() int Connect(IConnectio...
cell/synapse.go
0.854582
0.410874
synapse.go
starcoder
package packutil import ( "encoding/json" "fmt" "math/big" "math/rand" "reflect" "testing/quick" "time" "github.com/renproject/pack" ) // JSONFuzz is the same as the Fuzz testing function exposed by surge, but it // uses JSON. func JSONFuzz(t reflect.Type) { // Fuzz data data, ok := quick.Value(reflect.Typ...
packutil/packutil.go
0.576184
0.444927
packutil.go
starcoder
package elemental import ( "reflect" "time" ) // RemoveZeroValues reset all pointer fields that are pointing to a zero value to nil func RemoveZeroValues(obj interface{}) { vo := reflect.ValueOf(obj) vv := reflect.Indirect(vo) for _, field := range extractFieldNames(obj) { v := vv.FieldByName(field) if v...
utils.go
0.804981
0.460713
utils.go
starcoder