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 logic1 import "math" /* When squirrels get together for a party, they like to have cigars. A squirrel party is successful when the number of cigars is between 40 and 60, inclusive. Unless it is the weekend, in which case there is no upper bound on the number of cigars. Return True if the party with the give...
Go/CodingBat/logic-1.go
0.653016
0.620737
logic-1.go
starcoder
package miner import ( "bytes" "fmt" "strconv" "time" "crypto/sha256" "encoding/hex" "encoding/json" ) type ( // Miner implementation which much be adheard to for Block struct. Miner interface { Mine() (pow int) IsMined() bool MarshalJSON() ([]byte, error) Encode() (j []byte) ValidatePoW(pow int) ...
miner/miner.go
0.783243
0.422743
miner.go
starcoder
package slice import "errors" // DeleteRangeBool deletes the elements between from and to index (inclusive) from a bool slice func DeleteRangeBool(a []bool, from, to int) ([]bool, error) { if len(a) == 0 { return nil, errors.New("Cannot delete from a nil or empty slice") } if from < 0 || from > len(a)-1 { ret...
deleterange.go
0.783368
0.601594
deleterange.go
starcoder
package lunar import ( "errors" "fmt" "math" "time" "github.com/rs/zerolog/log" ) const ( synodicDayMonth float64 = 29.530588853 timezoneDay float64 = float64(7) / 24 // UTC+7 ) var loc, _ = time.LoadLocation("Asia/Ho_Chi_Minh") func toJulianDayNumber(t time.Time) int64 { D := t.UTC().Day() M := int(t...
lunar/lunar.go
0.603932
0.432782
lunar.go
starcoder
package cisco_st_tc import ( "fmt" "github.com/CiscoDevNet/ydk-go/ydk" ) func init() { ydk.YLogDebug(fmt.Sprintf("Registering top level entities for package cisco_st_tc")) } // FcAddressType represents fcid(2) - address is FCID. type FcAddressType string const ( FcAddressType_wwn FcAddressType = "ww...
ydk/models/cisco_ios_xe/cisco_st_tc/cisco_st_tc.go
0.544317
0.420481
cisco_st_tc.go
starcoder
package cmd import ( "fmt" "regexp" "strconv" "github.com/jaredbancroft/aoc2020/pkg/helpers" "github.com/jaredbancroft/aoc2020/pkg/password" "github.com/spf13/cobra" ) // day2Cmd represents the day2 command var day2Cmd = &cobra.Command{ Use: "day2", Short: "Advent of Code 2020 - Day 2: Password Philosophy"...
cmd/day2.go
0.630571
0.505127
day2.go
starcoder
package sqlb import r "reflect" const ( TagNameDb = `db` TagNameJson = `json` ) /* Encodes the provided expressions and returns the resulting text and args. Shortcut for using `(*Bui).Exprs` and `Bui.Reify`. Provided mostly for examples. Actual code may want to use `Bui`: bui := MakeBui(4096, 64) panic(bui.Ca...
sqlb_misc.go
0.79999
0.403626
sqlb_misc.go
starcoder
package model import ( "math" "github.com/pkg/errors" ) // Variable represents a single node in a PGM, a random variable, or a marginal distribution. type Variable struct { ID int // A numeric ID for tracking a variable Name string // Variable name (just a zero-based index ...
model/variable.go
0.732974
0.521959
variable.go
starcoder
package processor import ( "github.com/Jeffail/benthos/lib/types" "github.com/Jeffail/benthos/lib/util/service/log" "github.com/Jeffail/benthos/lib/util/service/metrics" ) //------------------------------------------------------------------------------ func init() { constructors["blob_to_multi"] = typeSpec{ c...
plugin/benthos/lib/processor/blob_to_multi.go
0.705582
0.44065
blob_to_multi.go
starcoder
package condition import ( "fmt" "github.com/Jeffail/benthos/v3/lib/log" "github.com/Jeffail/benthos/v3/lib/metrics" "github.com/Jeffail/benthos/v3/lib/types" ) //------------------------------------------------------------------------------ func init() { Constructors[TypeXor] = TypeSpec{ constructor: NewXor...
lib/condition/xor.go
0.758779
0.621885
xor.go
starcoder
package iso20022 // Cash movements from or to a fund as a result of investment funds transactions, eg, subscriptions or redemptions. type EstimatedFundCashForecast6 struct { // Unique technical identifier for an instance of a fund cash forecast within a fund cash forecast report as assigned by the issuer of the repo...
EstimatedFundCashForecast6.go
0.869452
0.52543
EstimatedFundCashForecast6.go
starcoder
package osm import ( "fmt" "math" "github.com/ctessum/geom" "github.com/ctessum/geom/op" "github.com/paulmach/osm" ) // GeomTags holds a geometry object and the tags that apply to it. type GeomTags struct { geom.Geom Tags map[string][]string } func tagsToMap(tags osm.Tags) map[string][]string { if len(tags)...
encoding/osm/geom.go
0.66061
0.583144
geom.go
starcoder
package input import ( "github.com/Jeffail/benthos/v3/lib/input/reader" "github.com/Jeffail/benthos/v3/lib/log" "github.com/Jeffail/benthos/v3/lib/message/batch" "github.com/Jeffail/benthos/v3/lib/metrics" "github.com/Jeffail/benthos/v3/lib/types" "github.com/Jeffail/benthos/v3/lib/util/aws/session" "github.com...
lib/input/kinesis_balanced.go
0.640636
0.724334
kinesis_balanced.go
starcoder
Implements a basic perceptron neural network call. */ package main import ( "fmt" algo "github.com/redsofa/perceptron/algo" version "github.com/redsofa/perceptron/version" ) func generateTrainingData() []*algo.TrainingData { var trainingData []*algo.TrainingData var instance *algo.TrainingData instance = algo....
src/go/src/github.com/redsofa/perceptron/main/main.go
0.547948
0.556701
main.go
starcoder
package shopeego type GetOrdersListRequest struct { // The create_time_from and create_time_to fields specify a date range for retrieving orders (based on the order create time). The create_time_from field is the starting date range. The maximum date range that may be specified with the create_time_from and create...
model-orders.go
0.725162
0.486149
model-orders.go
starcoder
package syntax import ( "fmt" "github.com/strict-lang/sdk/pkg/compiler/diagnostic" "github.com/strict-lang/sdk/pkg/compiler/grammar/token" "github.com/strict-lang/sdk/pkg/compiler/grammar/tree" ) type keywordStatementParser func(*Parsing) tree.Node var keywordStatementParserTable map[token.Keyword]keywordStateme...
pkg/compiler/grammar/syntax/statement.go
0.623033
0.402774
statement.go
starcoder
package window import ( "syscall/js" ) type Text js.Value func (t Text) Equal(value js.Value) bool { return js.Value(t).Equal(value) } func (t Text) IsNull() bool { return js.Value(t).IsNull() } func (t Text) Node() Node { return t } func (t Text) JSValue() js.Value ...
text.go
0.653569
0.554712
text.go
starcoder
package geojson import ( "github.com/tidwall/tile38/pkg/geojson/geohash" ) // MultiPolygon is a geojson object with the type "MultiPolygon" type MultiPolygon struct { Coordinates [][][]Position BBox *BBox bboxDefined bool polygons []Polygon } func fillMultiPolygon(coordinates [][][]Position, bbox *BBo...
pkg/geojson/multipolygon.go
0.792585
0.560974
multipolygon.go
starcoder
package jago import ( "math" ) /*148 (0x94)*/ /* == Operation Compare long == Format lcmp == Forms lcmp = 148 (0x94) == Operand Stack ..., value1, value2 → ..., result == Description Both value1 and value2 must be of type long. They are both popped from the operand stack, and a signed integer comparison is...
src/jago/instructions_comparisons.go
0.526343
0.647422
instructions_comparisons.go
starcoder
package geom import ( "math" ) // Vec3 is a generic 3-tuple representation type Vec3 struct { X, Y, Z float64 } var ( // V3Zero is the zero vector (0,0,0) V3Zero = Vec3{0, 0, 0} // V3Unit is the unit vector (1,1,1) V3Unit = Vec3{1, 1, 1} // V3UnitX is the x-axis unit vector (1,0,0) V3UnitX = Vec3{1, 0, 0} /...
geom/vec3.go
0.935663
0.680726
vec3.go
starcoder
package timeseries import ( "github.com/lobocv/simpleflow/time" "time" ) // TimeTransformation converts one time to another. It is primarily used to set the granularity of a time series type TimeTransformation func(time.Time) time.Time // Entry is a specific entry in a time series, it contains a value at a specifi...
timeseries/timeseries.go
0.764276
0.714317
timeseries.go
starcoder
package tangle import ( "math" "testing" "time" "github.com/iotaledger/hive.go/identity" "github.com/stretchr/testify/assert" "github.com/iotaledger/goshimmer/packages/markers" ) // TestStep defines a test scenario step. type TestStep func(t *testing.T, testFramework *MessageTestFramework, testEventMock *Even...
packages/tangle/scenarios.go
0.698124
0.566678
scenarios.go
starcoder
package camt import ( "encoding/xml" "github.com/figassis/bankiso/iso20022" ) type Document03600103 struct { XMLName xml.Name `xml:"urn:iso:std:iso:20022:tech:xsd:camt.036.001.03 Document"` Message *DebitAuthorisationResponseV03 `xml:"DbtAuthstnRspn"` } func (d *Document03600103) AddMessag...
generate/iso20022/camt/DebitAuthorisationResponseV03.go
0.712232
0.414247
DebitAuthorisationResponseV03.go
starcoder
package types import "github.com/88250/vitess-sqlparser/tidbparser/dependency/types/json" // Row is an interface to read columns values. type Row interface { // Len returns the number of values in the row. Len() int // GetInt64 returns the int64 value with the colIdx. GetInt64(colIdx int) int64 // GetUint64 r...
tidbparser/dependency/types/row.go
0.796134
0.582432
row.go
starcoder
package shape import "github.com/g3n/engine/math32" // Sphere is an analytical collision sphere. type Sphere struct { radius float32 } // NewSphere creates and returns a pointer to a new analytical collision sphere. func NewSphere(radius float32) *Sphere { s := new(Sphere) s.radius = radius return s } // SetR...
experimental/collision/shape/sphere.go
0.925928
0.628222
sphere.go
starcoder
package PiHex // PiHex // Work // Copyright © 2016-2020 <NAME>. All rights reserved. Contacts: <<EMAIL>> import ( //"fmt" "math" ) // Pi structure type Pi struct { // Table exponents exponent *[NTP]float64 // Channel to return the results of the goroutines ch chan float64 } // genHex - generate 'num' hexadeci...
ph_work.go
0.718693
0.417212
ph_work.go
starcoder
package money import ( "fmt" "strings" eld "github.com/ericlagergren/decimal" ) type dec = *eld.Big // RoundingMode determines how rounding is performed. type RoundingMode = eld.RoundingMode // Rounding constants. const ( ToNearestEven RoundingMode = eld.ToNearestEven ToNearestAway RoundingMode = eld.ToNeares...
decimal.go
0.870611
0.698625
decimal.go
starcoder
//-go:build !s390x // -build !s390x // This is a large group of functions that most architectures don't // implement in assembly. package math const haveArchAcos = false func archAcos(x float64) float64 { panic("not implemented") } const haveArchAcosh = false func archAcosh(x float64) float64 { panic("not impl...
libgo/go/math/stubs.go
0.59796
0.543711
stubs.go
starcoder
// Package cli provides a simple, fast and complete API for building command line applications in Go. // In contrast to other libraries additional emphasis is put on the definition and validation of // positional arguments and consistent usage outputs combining options from all command levels into // one block. packag...
app.go
0.791861
0.413832
app.go
starcoder
package physics import ( "github.com/oakmound/oak/oakerr" "github.com/oakmound/oak/dlog" ) const frozen = -64 // ForceVector is a vector that has some force and can operate on entites with mass type ForceVector struct { Vector Force *float64 } // NewForceVector returns a force vector func NewForceVector(direct...
physics/force.go
0.671363
0.6585
force.go
starcoder
package conf // UintVar defines a uint flag and environment variable with specified name, default value, and usage string. // The argument p points to a uint variable in which to store the value of the flag and/or environment variable. func (c *Configurator) UintVar(p *uint, name string, value uint, usage string) { c...
value_uint.go
0.790854
0.674521
value_uint.go
starcoder
package ent import ( "fmt" "strings" "time" "entgo.io/ent/dialect/sql" "github.com/jackycsl/catalog/catalog-service/internal/data/ent/game" ) // Game is the model entity for the Game schema. type Game struct { config `json:"-"` // ID of the ent. ID int64 `json:"id,omitempty"` // Name holds the value of the...
catalog-service/internal/data/ent/game.go
0.675015
0.413477
game.go
starcoder
package curves import ( "github.com/wieku/danser-go/framework/math/math32" "github.com/wieku/danser-go/framework/math/mutils" "github.com/wieku/danser-go/framework/math/vector" ) type Bezier struct { Points []vector.Vector2f controlLength float32 ApproxLength float32 } // Creates a bezier curve with ap...
framework/math/curves/bezier.go
0.875495
0.445288
bezier.go
starcoder
package types import ( "fmt" "regexp" "sort" "strconv" "strings" ) // Coin hold some amount of one currency type Coin struct { Denom string `json:"denom"` Amount int64 `json:"amount"` } // String provides a human-readable representation of a coin func (coin Coin) String() string { return fmt.Sprintf("%v%v"...
types/coin.go
0.81772
0.52074
coin.go
starcoder
package opc // Basic Midi // Turns on one LED for each of the 128 MIDI pitches when that node is being played. // LEDs are colored in rainbow order according to the circle of fifths. import ( "time" "github.com/longears/pixelslinger/colorutils" "github.com/longears/pixelslinger/config" "github.com/longears/p...
opc/pattern-midi-switcher.go
0.527317
0.413596
pattern-midi-switcher.go
starcoder
package server import ( "github.com/fnproject/fn/api/common" "github.com/openzipkin/zipkin-go-opentracing" "github.com/openzipkin/zipkin-go-opentracing/thrift/gen-go/zipkincore" "github.com/prometheus/client_golang/prometheus" "strconv" "strings" "sync" "time" ) // PrometheusCollector is a custom Collector //...
api/server/prom_zip_collector.go
0.748444
0.530176
prom_zip_collector.go
starcoder
package vm import ( "math" "github.com/nitrogen-lang/nitrogen/src/object" ) func (vm *VirtualMachine) evalBinaryExpression(op string, left, right object.Object) object.Object { switch { case left.Type() != right.Type(): panic(object.NewException("type mismatch: %s %s %s", left.Type(), op, right.Type())) case ...
src/vm/binary.go
0.663451
0.428473
binary.go
starcoder
package intrinsicsolver import ( "bufio" "bytes" "fmt" "os" "strings" "github.com/Appliscale/perun/logger" ) var Functions = []string{"Base64", "GetAtt", "GetAZs", "ImportValue", "Ref", "FindInMap", "Join", "Select", "Split", "Sub", "And", "Equals", "If", "Not", "Or"} var mapNature = Functions[5:] /* FixFunc...
intrinsicsolver/fixFunctions.go
0.701406
0.413596
fixFunctions.go
starcoder
package algorithm import ( "fmt" "reflect" ) type Chooser func(interface{}) bool // // Given a pointer to a slice and a Chooser, type as the input // // slice that contains only those elements of the input slice for which // // choose() returns true. The elements of the returned slice will be in the // // sam...
util/algorithm/generic.go
0.655446
0.479991
generic.go
starcoder
// Imposes the structural rules that enforce a well-formed concise encoding // document. package rules import ( "fmt" "github.com/kstenerud/go-concise-encoding/events" ) type MarkedObjectKeyableRule struct{} func (_this *MarkedObjectKeyableRule) String() string { return "Marked Keyable Object Rule" } fun...
rules/rules_marker_ref.go
0.520496
0.405449
rules_marker_ref.go
starcoder
package types import ( "encoding/json" "fmt" ) // H160 is a hash containing 160 bits (20 bytes), typically used in blocks, extrinsics and as a sane default type H160 [20]byte // NewH160 creates a new H160 type func NewH160(b []byte) H160 { h := H160{} copy(h[:], b) return h } // Hex returns a hex string repre...
types/hash.go
0.820793
0.422743
hash.go
starcoder
package agnostic type Value interface { // isValue is not used, but allows us to ensure that only allowed values are passed in as a Value isValue() } type BooleanLiteralValue bool // isValue implements the Value interface so that BooleanLiteralValue can be used as a Value func (b BooleanLiteralValue) isValue() {} ...
value.go
0.803444
0.494873
value.go
starcoder
package goparquet import ( "fmt" "io" "github.com/fraugster/parquet-go/parquet" ) type booleanPlainDecoder struct { r io.Reader left []bool } // copy the left overs from the previous call. instead of returning an empty subset of the old slice, // it delete the slice (by returning nil) so there is no memory ...
type_boolean.go
0.702938
0.436202
type_boolean.go
starcoder
package counter import ( "encoding/json" "sort" "strconv" "github.com/marcsantiago/collections" ) type FloatMap64 map[float64]int // NewFloatMap64 takes in hash data, counts, and returns a concrete type that implements a CounterMap func NewFloatMap64(hash map[float64]int) FloatMap64 { var nh FloatMap64 if has...
counter/float64_map.go
0.759671
0.425665
float64_map.go
starcoder
package finnhub import ( "encoding/json" ) // Sentiment struct for Sentiment type Sentiment struct { // BearishPercent *float32 `json:"bearishPercent,omitempty"` // BullishPercent *float32 `json:"bullishPercent,omitempty"` } // NewSentiment instantiates a new Sentiment object // This constructor will assign ...
model_sentiment.go
0.767429
0.400515
model_sentiment.go
starcoder
package nats import ( "context" "crypto/tls" "fmt" "strconv" "strings" "sync" "time" "github.com/gofrs/uuid" "github.com/nats-io/nats.go" "github.com/nats-io/stan.go" "github.com/benthosdev/benthos/v4/internal/bundle" "github.com/benthosdev/benthos/v4/internal/component" "github.com/benthosdev/benthos/v...
internal/impl/nats/input_stream.go
0.695441
0.437523
input_stream.go
starcoder
package ann import ( "log" "math" "math/rand" "runtime" "sort" "sync" "github.com/gonum/stat/distuv" "github.com/sachaservan/private-ann/hash" "github.com/sachaservan/private-ann/pir/field" "github.com/sachaservan/vec" ) /* With small numbers of tables, choosing radii by sampling from the distribution can ...
ann/construct.go
0.661048
0.498718
construct.go
starcoder
package postgres import ( "errors" "fmt" "strconv" "strings" "ariga.io/atlas/sql/schema" ) // FormatType converts schema type to its column form in the database. // An error is returned if the type cannot be recognized. func FormatType(t schema.Type) (string, error) { var f string switch t := t.(type) { cas...
sql/postgres/convert.go
0.609524
0.463201
convert.go
starcoder
package hijri import ( "errors" "time" "github.com/hablullah/go-juliandays" ) // LeapYearsPattern is patterns of leap years in the 30 year cycle. type LeapYearsPattern uint8 const ( // Default is the most commonly used leap years pattern. In this pattern, leap year happened // on years 2, 5, 7, 10, 13, 16, 18,...
hijri.go
0.724091
0.468851
hijri.go
starcoder
package i18n import ( "fmt" "strconv" "github.com/golang-plus/errors" "github.com/golang-plus/math/big" ) // ExchangeableCurrency represents a currency with exchange rate. type ExchangeableCurrency struct { *Currency Rate float64 } // Equal reports two currencies are same. func (x *ExchangeableCurrency) Equal...
money.go
0.832305
0.555797
money.go
starcoder
package main import ( "bytes" "crypto/sha256" "fmt" "math" "math/big" ) var ( maxNonce = math.MaxInt64 ) // targetBits is the block header storing the difficulty // at which the block was mined. const targetBits = 16 // ProofOfWork holds a pointer to a block and a pointer to a target. type ProofOfWork struct ...
build-blockchain-in-go/proofofwork.go
0.662032
0.430147
proofofwork.go
starcoder
package v1 import ( "fmt" "os" "time" ) // Config defines the runtime configuration. // Two runs of the executable with the same Config must yield the same result. type Config struct { // ColorSpace to use for comparison. // Currently supported: {Y'UV, RGB} ColorSpace string // Timeout defines a duration thres...
v1/in_config.go
0.756088
0.467028
in_config.go
starcoder
package awc import ( "encoding/xml" "errors" "fmt" "io" "math" "net/http" "strings" "time" ) // METARQuery represents the query used to fetch METAR objects. // Please keep in mind that a call either to HoursBeforeNow or Between is required. // Please refer to https://aviationweather.gov/dataserver/example?dat...
awc/metar.go
0.745861
0.41739
metar.go
starcoder
package continuous import ( gsl "github.com/jtejido/ggsl" "github.com/jtejido/stats" "github.com/jtejido/stats/err" "math" "math/rand" ) // Gumbel distribution // https://en.wikipedia.org/wiki/Gumbel_distribution type Gumbel struct { location, scale float64 // mu, beta src rand.Source } func NewGu...
dist/continuous/gumbel.go
0.806319
0.45647
gumbel.go
starcoder
package compare import ( "fmt" "github.com/stretchr/testify/assert" "math" "reflect" "regexp" "strconv" "testing" ) var AnythingIsFine = "reql_test.AnythingIsFine" func Assert(t *testing.T, expected, actual interface{}) { expectedVal := expected if e, ok := expected.(Expected); ok { expectedVal = e.Val }...
internal/compare/compare.go
0.569494
0.685995
compare.go
starcoder
package plaid import ( "encoding/json" ) // PaystubFraudVerification An object containing information for whether or not the uploaded paystub is fradulent type PaystubFraudVerification struct { // Derived verification status. VerificationStatus NullableString `json:"verification_status"` FraudAttributes []FraudA...
plaid/model_paystub_fraud_verification.go
0.695131
0.403273
model_paystub_fraud_verification.go
starcoder
package validators import ( "reflect" "github.com/flyteorg/flytepropeller/pkg/compiler/typing" flyte "github.com/flyteorg/flyteidl/gen/pb-go/flyteidl/core" c "github.com/flyteorg/flytepropeller/pkg/compiler/common" "github.com/flyteorg/flytepropeller/pkg/compiler/errors" "k8s.io/apimachinery/pkg/util/sets" ) ...
pkg/compiler/validators/bindings.go
0.534127
0.401688
bindings.go
starcoder
package elements import ( "github.com/fileformats/graphics/jt/model" ) // A partition in a JT file must always be either the root or leaf node. // A leaf partition node represents an external JT file reference and provides a means to partition a model into multiple physical JT files type PartitionNode struct { Grou...
jt/segments/elements/PartitionNode.go
0.879263
0.624064
PartitionNode.go
starcoder
package Geo import "math" var MAXLON = Deg2Rad(75) var MINLON = Deg2Rad(-75) var MAXLAT = Deg2Rad(79) var MINLAT = Deg2Rad(-79) const radiusPoles = 6356.7523 const radiusEquator = 6378.1370 const vehicleDistance = 42142.5833 const planetAspectRatio = (radiusPoles * radiusPoles) / (radiusEquator * radiusEquator) cons...
XRIT/Geo/Tools.go
0.706494
0.454956
Tools.go
starcoder
package onshape import ( "encoding/json" ) // BTSpunDescription657 struct for BTSpunDescription657 type BTSpunDescription657 struct { BTSurfaceDescription1564 Axis *BTVector3d389 `json:"axis,omitempty"` BtType *string `json:"btType,omitempty"` Origin *BTVector3d389 `json:"origin,omitempty"` } // NewBTSpunDescri...
onshape/model_bt_spun_description_657.go
0.734976
0.418519
model_bt_spun_description_657.go
starcoder
Package cluster contains functions and types needed to connect to a Hazelcast cluster. Port Range Port Range configuration allows you to specify the port range for cluster addresses where you did not specify any port. If no port range was specified and also no port was set on an address, then the default port range w...
cluster/doc.go
0.761184
0.450359
doc.go
starcoder
package generator import ( "fmt" "math/rand" "time" ) // Copied and modified code from https://github.com/moby/moby/tree/master/pkg/namesgenerator because of K8S can't use char `_` in names var ( left = [...]string{ "admiring", "adoring", "affectionate", "agitated", "amazing", "angry", "awesome", ...
function/pkg/generator/name_generator.go
0.519034
0.41052
name_generator.go
starcoder
// +build example package main import ( "image" "image/color" "math" rv "github.com/TheGrum/renderview" "github.com/llgcode/draw2d/draw2dimg" ) const radcon = math.Pi / 180 type State struct { Location FPoint Direction float64 } type FPoint struct { X, Y float64 } func (f FPoint) Add(a FPoint) FPoint ...
examples/lsystem/lsystemrender.go
0.71403
0.473718
lsystemrender.go
starcoder
package onshape import ( "encoding/json" ) // BTLineDescription1559 struct for BTLineDescription1559 type BTLineDescription1559 struct { BTCurveDescription1583 BtType *string `json:"btType,omitempty"` Direction *BTVector3d389 `json:"direction,omitempty"` Origin *BTVector3d389 `json:"origin,omitempty"` } // NewB...
onshape/model_bt_line_description_1559.go
0.73307
0.419113
model_bt_line_description_1559.go
starcoder
package apivideosdk import ( //"encoding/json" ) // BytesRange struct for BytesRange type BytesRange struct { // The starting point for the range of bytes for a chunk of a video. From *int32 `json:"from,omitempty"` // The ending point for the range of bytes for a chunk of a video. To *int32 `json:"to,omitempty"`...
model_bytes_range.go
0.81571
0.48871
model_bytes_range.go
starcoder
package value import ( "math/big" ) func sqrt(c Context, v Value) Value { if u, ok := v.(Complex); ok { if !isZero(u.imag) { return complexSqrt(c, u) } v = u.real } if isNegative(v) { return newComplex(Int(0), evalFloatFunc(c, c.EvalUnary("-", v), floatSqrt)) } return evalFloatFunc(c, v, floatSqrt) ...
value/sqrt.go
0.677901
0.418519
sqrt.go
starcoder
package gopdf type Margins struct { Left, Top, Right, Bottom float64 } //SetLeftMargin : set left margin func (gp *GoPdf) SetLeftMargin(margin float64) { gp.UnitsToPointsVar(&margin) gp.margins.Left = margin } //SetTopMargin : set top margin func (gp *GoPdf) SetTopMargin(margin float64) { gp.UnitsToPointsVar(&ma...
margin.go
0.887863
0.449634
margin.go
starcoder
package main import ( "fmt" "math" "math/rand" r "github.com/lachee/raylib-goplus/raylib" ) type ball struct { x int y int vx int vy int texture *r.Texture2D } func (b *ball) getRect() r.Rectangle { return r.Rectangle{X: float32(b.x), Y: float32(b.y), Width: float32(b.texture.Width),...
raylib-example/ball/simple-ball.go
0.641984
0.432303
simple-ball.go
starcoder
package geopoint import ( "fmt" "regexp" "strconv" "strings" ) var ( geoPointRegex = regexp.MustCompile("^[0-9A-Za-z]{5}:[0-9A-Za-z]{5}:[0-9A-Za-z]{5}$") ) // Encode a point using Crypto-PAn algorithm func Encode(latitude float64, longitude float64) Value { // Render as string (precision 10^6) coords := fmt....
codec.go
0.780662
0.456107
codec.go
starcoder
package truetype // The Truetype opcodes are summarized at // https://developer.apple.com/fonts/TTRefMan/RM07/appendixA.html const ( opSVTCA0 = 0x00 // Set freedom and projection Vectors To Coordinate Axis opSVTCA1 = 0x01 // . opSPVTCA0 = 0x02 // Set Projection Vector To Coordinate Axis opSPVTC...
src/code.google.com/p/freetype-go/freetype/truetype/opcodes.go
0.563138
0.669718
opcodes.go
starcoder
package client type LocationInfo struct { // Horizontal accuracy / (semi-major) uncertainty of location provided in meters, as defined in [14]. Present only if \"shape\" equals 4, 5 or 6 Accuracy int32 `json:"accuracy,omitempty"` // Altitude accuracy / uncertainty of location provided in meters, as defined in [14]....
go-packages/meep-loc-serv-client/model_location_info.go
0.752831
0.42668
model_location_info.go
starcoder
package plan import ( "github.com/pkg/errors" "sort" ) // TopDownWalk will execute f for each plan node in the PlanSpec. // It always visits a node before visiting its predecessors. func (plan *PlanSpec) TopDownWalk(f func(node PlanNode) error) error { visited := make(map[PlanNode]struct{}) roots := make([]PlanN...
services/flux/plan/walk.go
0.74382
0.403391
walk.go
starcoder
package iso20022 // Card transaction for which the financial authorisation has been requested. type CardTransaction6 struct { // Type of transaction being undertaken for the main service. // It correspond partially to the ISO 8583, field number 3. TransactionType *CardPaymentServiceType7Code `xml:"TxTp"` // Iden...
CardTransaction6.go
0.858615
0.414366
CardTransaction6.go
starcoder
// Package other wraps an hash-to-curve implementation and exposes functions for operations on points and scalars. package other import ( "crypto/rand" "math/big" "github.com/bytemare/crypto/group/internal" "github.com/armfazh/tozan-ecc/field" ) // Scalar implements the Scalar interface for Hash-to-Curve field...
group/other/scalar.go
0.932867
0.527012
scalar.go
starcoder
package http import ( "fmt" "strconv" "time" "github.com/influxdata/influxdb/v2/kit/platform/errors" ) // ErrInvalidDuration is returned when parsing a malformatted duration. var ErrInvalidDuration = &errors.Error{ Code: errors.EInvalid, Msg: "invalid duration", } // ParseDuration parses a time duration from...
http/duration.go
0.620392
0.437403
duration.go
starcoder
package main import ( "fmt" "math" "math/rand" "github.com/fogleman/gg" ) const width = 1000 const height = 1000 const circleRadius = 500.0 type Point struct { x float64 y float64 } func lineCircleIntersection(p1, p2 Point) (Point, Point) { D := p1.x*p2.y - p2.x*p1.y dx := p2.x - p1.x dy := p2.y - p1.y d...
2019/2-19-19/2-19-19.go
0.712732
0.496765
2-19-19.go
starcoder
package fork import ( "crypto/rand" "encoding/hex" "github.com/parallelcointeam/pod/chaincfg/chainhash" "math/big" ) // HardForks is the details related to a hard fork, number, name and activation height type HardForks struct { Number uint32 Name string ActivationHeight int32 Algos ...
fork/fork.go
0.547948
0.421969
fork.go
starcoder
package raygui import rl "github.com/gen2brain/raylib-go/raylib" // SliderBar - Slider Bar element, returns selected value func SliderBar(bounds rl.Rectangle, value, minValue, maxValue float32) float32 { b := bounds.ToInt32() state := Normal mousePoint := rl.GetMousePosition() fixedValue := float32(0) fixedMin...
raygui/sliderbar.go
0.657978
0.442275
sliderbar.go
starcoder
package dist import ( "github.com/ematvey/gostat" "github.com/jesand/stats" "math" ) // Produce a new Beta distribution func NewBetaDist(alpha, beta float64) *Beta { dist := &Beta{ Alpha: alpha, Beta: beta, space: UnitIntervalSpace, } dist.DefContinuousDistSampleN.dist = dist dist.DefContinuousDistProb....
dist/beta.go
0.886985
0.616445
beta.go
starcoder
package mab import ( "fmt" "math" ) func NewEpsilonGreedy(e float64) *EpsilonGreedy { return &EpsilonGreedy{ Epsilon: e, } } // EpsilonGreedy implements the epsilon-greedy bandit strategy. // The Epsilon parameter must be greater than zero. // If any arm has a Null distribution, it will have zero selection pro...
epsilon_greedy.go
0.859561
0.545104
epsilon_greedy.go
starcoder
package math import ( "errors" "sort" ) // A translation of Apache Commons Math. // Returns an interpolation function, valid function, and an error if any. func BicubicInterpolator( xval, yval []float64, fval [][]float64) ( func(float64, float64) (float64, error), func(float64, float64) bool, error) { if le...
pkg/sdsai/math/bicubic.go
0.606032
0.587529
bicubic.go
starcoder
package fitness import ( "github.com/RH12503/Triangula/image" ) // pixelData stores data relating to the pixels of an image, and is used in TrianglesImageFitnessFunction. type pixelData struct { pixels [][]pixel width, height int } // Size returns the width and height of an pixelData. func (p pixelData) Si...
fitness/pixels.go
0.837487
0.763462
pixels.go
starcoder
package digitalocean import ( "context" "fmt" "strconv" "github.com/digitalocean/godo" "github.com/hashicorp/terraform-plugin-sdk/helper/schema" ) type imageListFunc func(ctx context.Context, opt *godo.ListOptions) ([]godo.Image, *godo.Response, error) func imageSchema() map[string]*schema.Schema { return map...
vendor/github.com/terraform-providers/terraform-provider-digitalocean/digitalocean/images.go
0.583203
0.480113
images.go
starcoder
package main import ( "fmt" "math" "github.com/EngoEngine/glm" "github.com/veandco/go-sdl2/img" "github.com/veandco/go-sdl2/sdl" ) const windowSizeX = 640 const windowSizeY = 480 const stride = 4 var upVector = glm.Vec3{0.0, 1.0, 0.0} var rightVector = glm.Vec3{1.0, 0.0, 0.0} var cameraWorldPosition = glm.Vec...
mode7.go
0.692746
0.514644
mode7.go
starcoder
package tables var ISO4217 = make(map[string]Currency) func init() { for _, ccy := range currencies { // set of ISO 4217 codes ISO4217[ccy.code] = ccy } } type Currency struct { // The ISO 4217 code of the currency. code string // The currency's three digit numeric code as assigned by ISO 4217. num string ...
internal/tables/currency.go
0.68056
0.540318
currency.go
starcoder
package interval import ( "fmt" "sort" "strings" "time" "github.com/grokify/gocharts/data/statictimeseries" "github.com/grokify/gotilla/time/timeutil" "github.com/grokify/gotilla/type/maputil" "github.com/pkg/errors" ) type SeriesType int const ( Source SeriesType = iota Output OutputAggregate ) // Data...
data/statictimeseries/interval/data_series_set_interval.go
0.585575
0.431764
data_series_set_interval.go
starcoder
package agozon // LocalCA Map var LocaleCAMap = map[string]LocaleSearchIndex{ "All": LocaleCA.All, "Automotive": LocaleCA.Automotive, "Baby": LocaleCA.Baby, "Beauty": LocaleCA.Beauty, "Blended": LocaleCA.Blended, "Books": LocaleCA.Books, "Classical": LocaleCA.Classical, "DVD": LocaleCA.DVD, "Electronics": LocaleCA.E...
LocaleCA.go
0.525125
0.478833
LocaleCA.go
starcoder
package common import ( "io" "github.com/go-errors/errors" "github.com/privacybydesign/gabi/big" ) // SmallPrimes is a list of small, prime numbers that allows us to rapidly // exclude some fraction of composite candidates when searching for a random // prime. This list is truncated at the point where SmallPrim...
internal/common/randomprime.go
0.610221
0.412648
randomprime.go
starcoder
package fragment import "sort" // CoverSet maintains Fragments ordered on |Begin| and |End|, with the invariant // that no Fragment is fully overlapped by another Fragment in the set (though it // may be overlapped by a combination of other Fragments). Intuitively, CoverSet // represents the set of offsets which are ...
broker/fragment/cover_set.go
0.770853
0.442877
cover_set.go
starcoder
package cli import ( "github.com/pkg/errors" "github.com/spf13/cobra" "github.com/spf13/viper" ) // Param represents an individual CLI parameter. type Param struct { // Name of the parameter, will be displayed to the user when inspecting the // help information for the command. Name string // Brief and clear ...
cli/params.go
0.563858
0.44065
params.go
starcoder
package liblsdj import ( "errors" "fmt" ) const ( chainCount = 0x7F + 1 //! The amount of chains in a song, UNUSED MAY BE 0X80 chainLength = 16 //! The number of steps in a chain chainNoPhrase = 0xFF //! The value of "no Phrase" at a given step chainAssignLength = 0x100 ) type Chain struct { p...
chain.go
0.647575
0.475544
chain.go
starcoder
// This file provides the Parse function, which will take // a bufio Reader and apply "grok" style pattern matching // and send the matched data to influxdb package grokflux import ( "bufio" "fmt" "strconv" "time" "github.com/vjeantet/grok" ) // Translate controls how the grok results are converted to a data ...
parse.go
0.575946
0.505737
parse.go
starcoder
package foundation // #include "time_zone.h" import "C" import ( "unsafe" "github.com/hsiafan/cocoa/objc" ) type TimeZone interface { objc.Object AbbreviationForDate(aDate Date) string SecondsFromGMTForDate(aDate Date) int IsDaylightSavingTimeForDate(aDate Date) bool DaylightSavingTimeOffsetForDate(aDate Date...
foundation/time_zone.go
0.649579
0.423339
time_zone.go
starcoder
package dungeon import ( "fmt" "math/rand" "sort" "time" ) type Rectangle struct { X, Y, Width, Height int } func (r *Rectangle) Contains(p Point) bool { return p.X >= r.X && p.Y >= r.Y && p.X <= r.X+r.Width && p.Y <= r.Y+r.Height } func Max(a, b int) int { if a > b { return a } else { return b }...
vendor/github.com/meshiest/go-dungeon/dungeon/dungeon.go
0.586168
0.534552
dungeon.go
starcoder
package gosigl import ( opengl "github.com/go-gl/gl/v4.1-core/gl" ) type TextureBindingId uint32 type TextureSlotId uint32 type PixelFormat uint32 const RGBA = PixelFormat(opengl.RGBA) const RGB = PixelFormat(opengl.RGB) const BGR = PixelFormat(opengl.BGR) const BGRA = PixelFormat(opengl.BGRA) const DXT1 = PixelFor...
texture.go
0.639849
0.491334
texture.go
starcoder
package schedule import ( "fmt" "sort" "time" ) // Frequency defines how often an event occurs type Frequency struct { offset int interval int timePeriod TimePeriod atMinutes []int atHours []int onDaysOfWeek []time.Weekday onDaysOfMonth []int } // Offset returns the frequency's of...
services/internal/core/schedule/frequency.go
0.883349
0.531027
frequency.go
starcoder
package aoc2021 import ( "fmt" "sort" "github.com/simonski/aoc/utils" ) /* -- Day 7: The Treachery of Whales --- A giant whale has decided your submarine is its next meal, and it's much faster than you are. There's nowhere to run! Suddenly, a swarm of crabs (each in its own tiny submarine - it's too deep for the...
app/aoc2021/aoc2021_07.go
0.655887
0.671982
aoc2021_07.go
starcoder
package model import ( "github.com/juju/errors" "github.com/newm4n/grool/context" "github.com/newm4n/grool/pkg" "github.com/sirupsen/logrus" "reflect" ) // ExpressionAtom holds an expression atom graph. it can form a mathematical expression, a simple contants, function all, method call. type ExpressionAtom stru...
model/ExpressionAtom.go
0.562898
0.443902
ExpressionAtom.go
starcoder
package mlpack /* #cgo CFLAGS: -I./capi -Wall #cgo LDFLAGS: -L. -lmlpack_go_softmax_regression #include <capi/softmax_regression.h> #include <stdlib.h> */ import "C" import "gonum.org/v1/gonum/mat" type SoftmaxRegressionOptionalParam struct { InputModel *softmaxRegression Labels *mat.Dense Lambda float...
softmax_regression.go
0.703142
0.478894
softmax_regression.go
starcoder
package avl // Node of a tree type Node struct { Key int Height int Left, Right *Node } // NewTree create a new AVL tree func NewTree() *Node { return nil } // Get : return node with given key func Get(root *Node, key int) *Node { if root == nil { return nil } if root.Key == key { return root...
structure/avl/avl.go
0.73029
0.565059
avl.go
starcoder