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
// Copyright 2017 Microsoft Corporation. All rights reserved. // Use of this source code is governed by an MIT // license that can be found in the LICENSE file. /* Package azblob can access an Azure Blob Storage. The azblob package is capable of :- - Creating, deleting, and querying containers in an account ...
sdk/storage/azblob/doc.go
0.694406
0.440108
doc.go
starcoder
package linkedlist import "github.com/clipperhouse/typewriter" var templates = typewriter.TemplateSlice{ list, } var list = &typewriter.Template{ Name: "bigratalias", Text: ` type {{.Name}}Time struct { rat *big.Rat } func New{{.Name}}Time(rat *big.Rat) *{{.Name}}Time { return &{{.Name}}Time{rat: rat} } // Le...
templates.go
0.796965
0.591133
templates.go
starcoder
package language import ( "bytes" "fmt" "reflect" ) // Eval runs the expression in the environment func Eval(n Node, env *Environment) Object { switch node := n.(type) { case *DynamoExpression: return Eval(node.Statement, env) case *ExpressionStatement: return Eval(node.Expression, env) case *PrefixExpress...
interpreter/language/evaluator.go
0.747708
0.414543
evaluator.go
starcoder
package diagnostic import "github.com/hashicorp/hcl/v2" // DedupDiagnostics allows the accumulation of hcl.Diagnostic while avoiding // duplicate entries. It implements a subset of the methods of hcl.Diagnostics. type DedupDiagnostics struct { diags hcl.Diagnostics // An index of the diagnostic entries present in t...
core/diagnostic/diagnostic.go
0.806052
0.440409
diagnostic.go
starcoder
package numberer import ( "fmt" "strconv" ) var ( // MinuteFactory is a factory to produce valid minute values MinuteFactory = Must(NewFactory("minute", 0, 59)) // HourFactory is a factory to produce valid hour values HourFactory = Must(NewFactory("hour", 0, 23)) // DayOfMonthFactory is a factory to produce ...
internal/numberer/number.go
0.681727
0.417865
number.go
starcoder
package main import ( "encoding/json" "fmt" . "github.com/eywa/configs" . "github.com/eywa/models" . "github.com/eywa/utils" ) var messages = ` { "messages": { "_all": { "enabled": false }, "_size" : {"enabled" : true}, "dynamic_templates": [ { "string_to_doc_values": { "mat...
setup_es.go
0.523664
0.461502
setup_es.go
starcoder
package entries import ( "bufio" "encoding/binary" "errors" "fmt" "os" ) const ( // TombstoneValue is the value given to deleted key-value pairs. TombstoneValue string = "\x00" ) // Entry represents a database entry that is written into disk type Entry struct { Key string Value string } // EntryScanner c...
entries/entries.go
0.678433
0.401541
entries.go
starcoder
package loader import ( "errors" "io" "time" "github.com/lestrrat/go-xslate/vm" ) // Mask... set of constants are used as flags to denote Debug modes. // If you're using these you should be reading the source code const ( MaskDumpByteCode = 1 << iota MaskDumpAST ) // Flags holds the flags to indicate if certa...
loader/loader.go
0.766031
0.424591
loader.go
starcoder
package cache import ( "sync" "github.com/disgoorg/snowflake/v2" ) // FilterFunc is used to filter cached entities. type FilterFunc[T any] func(T) bool // Cache is a simple key value store. They key is always a snowflake.ID. // The cache provides a simple way to store and retrieve entities. But is not guaranteed ...
cache/cache.go
0.665737
0.433082
cache.go
starcoder
package rke import ( "github.com/hashicorp/terraform-plugin-sdk/helper/schema" ) const ( rkeClusterCloudProviderAwsName = "aws" ) //Schemas func rkeClusterCloudProviderAwsGlobalFields() map[string]*schema.Schema { s := map[string]*schema.Schema{ "disable_security_group_ingress": { Type: schema.TypeBo...
rke/schema_rke_cluster_cloud_provider_aws.go
0.579519
0.411939
schema_rke_cluster_cloud_provider_aws.go
starcoder
package spline import ( "math" ) type Bspline struct { points [][]float64 degree int copy bool } var ( pts [][]float64 degree int dimension int baseFunc func(x float64) float64 baseFuncRangeInt int ) func NewBspline(points [][]float64, degree int, copy bool) *Bspline...
app/service/comparing/spline/bspline.go
0.505859
0.416263
bspline.go
starcoder
package sql // Code based on https://github.com/emirpasic/gods/tree/master/trees/redblacktree // Referenced https://en.wikipedia.org/wiki/Interval_tree#Augmented_tree import ( "fmt" "strings" ) // rangeTreeColor is a node's color for balancing a RangeColumnExprTree. type rangeTreeColor uint8 const ( black range...
sql/range_tree.go
0.806815
0.65922
range_tree.go
starcoder
package currency var currenciesByCode = map[string]currency{ `AFN`: { countries: Countries{`AFGHANISTAN`}, currency: `Afghani`, code: `AFN`, number: `971`, }, `EUR`: { countries: Countries{`ÅLAND ISLANDS`, `ANDORRA`, `AUSTRIA`, `BELGIUM`, `CYPRUS`, `ESTONIA`, `EUROPEAN UNION`, `FINLAND`, `FRANCE`...
currency_gen.go
0.68056
0.45423
currency_gen.go
starcoder
package go2linq // Reimplementing LINQ to Objects: Part 35 – Zip // https://codeblog.jonskeet.uk/2011/01/14/reimplementing-linq-to-objects-part-35-zip/ // https://docs.microsoft.com/dotnet/api/system.linq.enumerable.zip // Zip applies a specified function to the corresponding elements of two sequences, producing a s...
zip.go
0.759761
0.466906
zip.go
starcoder
package onshape import ( "encoding/json" ) // BTPlaneDescription692AllOf struct for BTPlaneDescription692AllOf type BTPlaneDescription692AllOf struct { BtType *string `json:"btType,omitempty"` IsOrientedWithFace *bool `json:"isOrientedWithFace,omitempty"` Normal *BTVector3d389 `json:"normal,omitempty"` Origin *B...
onshape/model_bt_plane_description_692_all_of.go
0.746139
0.494019
model_bt_plane_description_692_all_of.go
starcoder
package tables import ( "github.com/sudachen/go-ml/fu" "golang.org/x/xerrors" "reflect" ) /* Matrix the presentation of features and labels as plane []float32 slices */ type Matrix struct { Features []float32 Labels []float32 Width, Length int LabelsWidth int // 0 means no labels defined } /* Ma...
tables/matrix.go
0.573917
0.505249
matrix.go
starcoder
package bst import ( "errors" ds "github.com/DavidCai1993/datastructures.go" ) // Errors used by this package var ( ErrEmptyTree = errors.New("bst: empty tree") ) type node struct { val ds.Comparable parent *node left *node right *node } // Tree represents a binary search tree. type Tree struct { roo...
binary-search-tree/bst.go
0.862496
0.449211
bst.go
starcoder
package fuse // Opt : the struct to save the fuse operations type Opt struct { /** * Init * Initialize filesystem * * This function is called when libfuse establishes * communication with the FUSE kernel module. The file system * should use this module to inspect and/or modify the * connection parameter...
fuse/opt_h.go
0.57093
0.435481
opt_h.go
starcoder
package cppn import ( "errors" "fmt" "github.com/yaricom/goNEAT/neat/genetics" "github.com/yaricom/goNEAT/neat/network" "math" "os" ) // Defines point with float precision coordinates type PointF struct { X, Y float64 } func NewPointF(x, y float64) *PointF { return &PointF{X: x, Y: y} } func (p *PointF) Str...
cppn/cppn.go
0.82994
0.567997
cppn.go
starcoder
package engine import ( "fmt" "github.com/ivan1993spb/snake-bot/internal/types" ) type Area struct { Width uint8 Height uint8 } func NewArea(width, height uint8) Area { return Area{ Width: width, Height: height, } } func (a Area) Navigate(dot types.Dot) []types.Dot { dots := make([]types.Dot, 0, 4) ...
internal/bot/engine/area.go
0.718199
0.406361
area.go
starcoder
package hashmultimaps // New factory that creates a new Hash Multi Map func New() *HashMultiMap { multiMap := HashMultiMap{data: make(map[interface{}][]interface{})} return &multiMap } // HashMultiMap a data structure representing a map of keys with lists of values type HashMultiMap struct { data map[interface{}][...
datastructures/maps/hashmultimaps/hash_multi_map.go
0.822617
0.409103
hash_multi_map.go
starcoder
package util import ( "errors" "time" "github.com/deejross/mydis/pb" "github.com/gogo/protobuf/proto" ) // Value object. type Value struct { err error b []byte } // NewValue returns a new Value object. func NewValue(t interface{}) Value { switch t := t.(type) { case error: return Value{err: t} case Va...
util/value.go
0.708313
0.536859
value.go
starcoder
package ctime import ( "time" ) // An Interval is a period of time with a defined start and end. The interval // includes the start time and every time instant up to but not including the // end time. type Interval struct { Start time.Time End time.Time } // Duration returns the duration of the time interval i....
ctime.go
0.760384
0.494629
ctime.go
starcoder
package contains_duplicate import "math" /* 219. 存在重复元素 II https://leetcode-cn.com/problems/contains-duplicate-ii 给定一个整数数组和一个整数 k,判断数组中是否存在两个不同的索引 i 和 j, 使得 nums [i] = nums [j],并且 i 和 j 的差的绝对值最大为 k。 示例 1: 输入: nums = [1,2,3,1], k = 3 输出: true 示例 2: 输入: nums = [1,0,1,1], k = 1 输出: true 示例 3: 输入: nums = [1,2,3,1,2,3...
solutions/contains-duplicate/d.go
0.585338
0.46794
d.go
starcoder
package main var samples = ` { "contractState": { "activeAssets": [ "The ID of a managed asset. The resource focal point for a smart contract." ], "nickname": "TRADELANE", "version": "The version number of the current contract" }, "event": { "allottedCred...
contracts/industry/carbon_trading/samples.go
0.71403
0.595816
samples.go
starcoder
package camera import ( "github.com/g3n/engine/core" "github.com/g3n/engine/gui" "github.com/g3n/engine/math32" "github.com/g3n/engine/window" "math" ) // OrbitEnabled specifies which control types are enabled. type OrbitEnabled int // The possible control types. const ( OrbitNone OrbitEnabled = 0x00 OrbitRo...
camera/orbit_control.go
0.865622
0.550245
orbit_control.go
starcoder
package sampler import ( "github.com/mattkimber/gorender/internal/geometry" "image" "image/color" "image/draw" "math" "math/rand" ) type Sample struct { Location geometry.Vector2 Influence float64 } type SampleList []Sample type Samples [][]SampleList func (s Samples) Width() int { return len(s) } func ...
internal/sampler/sampler.go
0.789518
0.554832
sampler.go
starcoder
package nbt import "strconv" // ListByte satisfies the List interface for a list of Bytes type ListByte []Byte // Equal satisfies the equaler.Equaler interface, allowing for types to be // checked for equality func (l ListByte) Equal(e interface{}) bool { m, ok := e.(ListByte) if !ok { var n *ListByte if n, o...
nbt/lists.go
0.724188
0.443781
lists.go
starcoder
package geo import ( "math" ) // Represents a Physical Point in geographic notation [lat, lng]. type Point struct { lat float64 lng float64 } const ( EARTH_RADIUS = 6371 // Earth's radius ~= 6,371km, according to wikipedia ) // Returns a new Point populated by the passed in latitude (lat) and longitude (lng) va...
point.go
0.901232
0.646865
point.go
starcoder
package prettytest import ( "fmt" "os" "reflect" ) type Assertion struct { Line int Name string Filename string ErrorMessage string Passed bool suite *Suite testFunc *TestFunc } func (assertion *Assertion) fail() { assertion.Passed = false assertion.testFunc.Status = ...
Godeps/_workspace/src/github.com/remogatto/prettytest/assertions.go
0.661486
0.53279
assertions.go
starcoder
package iso20022 // Provides further details specific to the individual direct debit transaction(s) included in the message. type DirectDebitTransactionInformation17 struct { // Set of elements used to reference a payment instruction. PaymentIdentification *PaymentIdentification3 `xml:"PmtId"` // Set of elements ...
DirectDebitTransactionInformation17.go
0.751557
0.581244
DirectDebitTransactionInformation17.go
starcoder
package model import ( "github.com/newm4n/grool/pkg" "log" "reflect" "strings" "time" ) // GroolFunctions strucr hosts the built-in functions ready to invoke from the rule engine execution. type GroolFunctions struct { Knowledge *KnowledgeBase } func (gf *GroolFunctions) MakeTime(year, month, day, hour, minute...
model/GroolFunctions.go
0.688992
0.40536
GroolFunctions.go
starcoder
package oxyde import ( "fmt" "reflect" ) // Function AssertNil asserts that actual value is nil. // When actual value is not nil, an error is reported. func AssertNil(actual interface{}) { if !isNil(actual) { displayAssertionError(nil, actual) } } func AssertNotNil(actual interface{}) { i...
assert.go
0.757077
0.658414
assert.go
starcoder
package view import ( "fmt" "image" "log" "github.com/nictuku/stardew-rocks/parser" ) var treeRects = map[int]image.Rectangle{ 0: xnaRect(32, 128, 16, 16), 1: xnaRect(0, 128, 16, 16), 2: xnaRect(16, 128, 16, 16), 3: xnaRect(0, 96, 16, 32), 4: xnaRect(0, 96, 16, 32), } func treeAsset(terrainType string, tre...
view/draw_tree.go
0.543106
0.447581
draw_tree.go
starcoder
package convert import "time" // Converter supports conversion across Go types. type Converter interface { // Bool returns the bool representation from the given interface value. // Returns the default value of false and an error on failure. Bool(from interface{}) (to bool, err error) // Duration returns the tim...
lib/conv/internal/convert/convert.go
0.843154
0.603231
convert.go
starcoder
package trinary import ( "bytes" "math" "strings" . "github.com/iotaledger/iota.go/consts" iotaGoMath "github.com/iotaledger/iota.go/math" "github.com/pkg/errors" ) var ( // TryteValueToTritsLUT is a lookup table to convert tryte values into trits. TryteValueToTritsLUT = [TryteRadix][TritsPerTryte]int8{ {-...
trinary/trinary.go
0.654232
0.45944
trinary.go
starcoder
package edlib import ( "errors" "github.com/hbollon/go-edlib/internal/orderedmap" ) // Algorithm is an Integer type used to identify edit distance algorithms type Algorithm uint8 // Algorithm identifiers const ( Levenshtein Algorithm = iota DamerauLevenshtein OSADamerauLevenshtein Lcs Hamming Jaro JaroWink...
vendor/github.com/hbollon/go-edlib/string-analysis.go
0.737347
0.503601
string-analysis.go
starcoder
package asyncassertion import ( "errors" "fmt" "reflect" "time" "github.com/onsi/gomega/internal/oraclematcher" "github.com/onsi/gomega/types" ) type AsyncAssertionType uint const ( AsyncAssertionTypeEventually AsyncAssertionType = iota AsyncAssertionTypeConsistently ) type AsyncAssertion struct { asyncT...
vendor/github.com/onsi/gomega/internal/asyncassertion/async_assertion.go
0.668556
0.511656
async_assertion.go
starcoder
package k8sresource import ( "fmt" "math" "strconv" "strings" ) const ( _ = iota _ // Mi = Megabytes Mi float64 = 1 << (10 * iota) // Gi = Gigabytes Gi ) // Memory allows converstion between string and float representations and basic math operations on memory types type Memory struct { m float64 } // New...
memcalc.go
0.839668
0.438785
memcalc.go
starcoder
package period import ( "time" ) type Period struct { period string startTime time.Time endTime time.Time } func Parse(unit string) *Period { p := &Period{period: unit} now := time.Now() var start, end time.Time var period string switch unit { case "t": period = "Today" start = p.BeginningOfDay(...
reports/period/period.go
0.712432
0.770918
period.go
starcoder
package binary import ( "errors" "strings" "math" "fmt" ) // Binary tree // References: // https://appliedgo.net/bintree/ // https://github.com/karlstroetmann/Algorithms/blob/master/SetlX/BinaryTree/binary-tree.stlx type tree struct { root *node } func NewTree() *tree { return &tree{} } // Inserts new key-Va...
src/trees/binary/binaryTree.go
0.829077
0.469824
binaryTree.go
starcoder
package main import ( "../gen-go/com/maxeler/VectorAddition" "fmt" "git.apache.org/thrift.git/lib/go/thrift" "os" "math/rand" "time" ) func checkForErrors(err error){ if err != nil { fmt.Fprintln(os.Stderr, err) os.Exit(-1) } } func check(dataOutDFE []int32, dataOutCPU...
examples/VectorAddition/client/go/Dynamic/VectorAdditionClient.go
0.550366
0.418578
VectorAdditionClient.go
starcoder
package intersect // Rectangle is a simple geometry struct type Rectangle struct { X float64 Y float64 Width float64 Height float64 } // NewRect returns a new rectangle func NewRect(x, y, w, h float64) Rectangle { return Rectangle{x, y, w, h} } // IsPointIn returns true if the point is in the rectang...
rectangle.go
0.927519
0.837288
rectangle.go
starcoder
package imut import ( "bytes" "image" "image/color" "image/draw" "image/png" "io/ioutil" "github.com/gitchander/neural" ) func SaveImagePNG(m image.Image, filename string) error { var buf bytes.Buffer err := png.Encode(&buf, m) if err != nil { return err } return ioutil.WriteFile(filename, buf.Bytes(),...
neutil/imut/image.go
0.633524
0.404066
image.go
starcoder
package models import ( i336074805fc853987abe6f7fe3ad97a6a6f3077a16391fec744f671a015fbd7e "time" i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91 "github.com/microsoft/kiota-abstractions-go/serialization" ) // CloudPC type CloudPC struct { Entity // The Azure Active Directory (Azure ...
models/cloud_p_c.go
0.669096
0.41182
cloud_p_c.go
starcoder
package docs import ( "bytes" "encoding/json" "strings" "github.com/alecthomas/template" "github.com/swaggo/swag" ) var doc = `{ "schemes": {{ marshal .Schemes }}, "swagger": "2.0", "info": { "description": "{{.Description}}", "title": "{{.Title}}", "contact": {}, "l...
docs/docs.go
0.616359
0.412767
docs.go
starcoder
package function import ( "fmt" "math" "sort" "github.com/lindb/lindb/pkg/collections" ) type bucket struct { upperBound float64 count float64 itr *collections.FloatArrayIterator } type buckets []bucket func (bkt buckets) Len() int { return len(bkt) } func (bkt buckets) Less(i, j int)...
aggregation/function/quantile.go
0.742141
0.410047
quantile.go
starcoder
package csv import ( "fmt" "strconv" ) /* Row represents one line from a data source like a .csv file. Each Row is a map from column names to the string values under that columns on the current line. It is assumed that each column has a unique name. In a .csv file, the column names may either come from the first l...
plugins/data/encoding/csv/rows.go
0.829699
0.624866
rows.go
starcoder
package main import ( "github.com/gen2brain/raylib-go/raylib" ) func main() { screenWidth := int32(800) screenHeight := int32(450) raylib.InitWindow(screenWidth, screenHeight, "raylib [models] example - box collisions") camera := raylib.Camera{} camera.Position = raylib.NewVector3(0.0, 10.0, 10.0) camera.Tar...
examples/models/box_collisions/main.go
0.668123
0.432423
main.go
starcoder
package types import ( "bytes" "io" "reflect" "regexp" "github.com/lyraproj/issue/issue" "github.com/lyraproj/pcore/px" "github.com/lyraproj/pcore/utils" ) type ( RegexpType struct { pattern *regexp.Regexp } // Regexp represents RegexpType as a value Regexp RegexpType ) var regexpTypeDefault = &Regexp...
types/regexptype.go
0.642769
0.430626
regexptype.go
starcoder
package indicator import ( "math" "testing" ) // Check values same size. func checkSameSize(values ...[]float64) { if len(values) < 2 { return } n := len(values[0]) for i := 1; i < len(values); i++ { if len(values[i]) != n { panic("not all same size") } } } // Multiply values by multipler. func mu...
helper.go
0.735737
0.696268
helper.go
starcoder
package bing import "math" const ( // EarthRadius is the radius of the earth EarthRadius = 6378137.0 // MinLatitude is the min lat MinLatitude = -85.05112878 // MaxLatitude is the max lat MaxLatitude = 85.05112878 // MinLongitude is the min lon MinLongitude = -180.0 // MaxLongitude is the max lon MaxLongit...
internal/bing/bing.go
0.889229
0.718619
bing.go
starcoder
package function import ( "errors" "fmt" "time" "github.com/src-d/go-mysql-server/sql" "github.com/src-d/go-mysql-server/sql/expression" ) func getDate(ctx *sql.Context, u expression.UnaryExpression, row sql.Row) (interface{}, error) { val, err := u.Child.Eval(ctx, row) if err != nil { return nil, err }...
sql/expression/function/time.go
0.746878
0.451871
time.go
starcoder
package ec import ( "errors" "fmt" "math/big" "github.com/WaykiChain/wicc-wallet-utils-go/commons/bytes" ) const ( PubKeyBytesLenCompressed = 33 PubKeyBytesLenUncompressed = 65 PubKeyBytesLenHybrid = 65 pubKeyCompressed byte = 0x2 pubKeyUncompressed byte = 0x4 pubKeyHybrid byte = 0x6 ) // ...
commons/ec/pubkey.go
0.558568
0.459197
pubkey.go
starcoder
// Package dk provides holiday definitions for Denmark. package dk import ( "time" "github.com/rickar/cal/v2" "github.com/rickar/cal/v2/aa" ) var ( // Nytaarsdag represents New Year's Day on 1-Jan Nytaarsdag = aa.NewYear.Clone(&cal.Holiday{Name: "Nytårsdag", Type: cal.ObservancePublic}) // Skaertorsdag repre...
v2/dk/dk_holidays.go
0.542136
0.407451
dk_holidays.go
starcoder
package matrix import ( "sync" "time" ) // Plane stores consecutive axes. Each axis has StartTime, EndTime. The EndTime of each axis is the StartTime of its // next axis. Therefore satisfies: // len(Times) == len(Axes) + 1. type Plane struct { Times []time.Time Axes []Axis } // CreatePlane checks the given par...
pkg/keyvisual/matrix/plane.go
0.664649
0.560794
plane.go
starcoder
package camera import ( "math" "github.com/hajimehoshi/ebiten/v2" ) // Camera can look at positions, zoom and rotate. type Camera struct { X, Y, Rot, Scale float64 Width, Height int Surface *ebiten.Image } // NewCamera returns a new Camera func NewCamera(width, height int, x, y, rotation, zoom floa...
camera.go
0.901346
0.530419
camera.go
starcoder
package cmd import ( "context" "errors" "hash" "github.com/minio/highwayhash" "github.com/minio/minio/cmd/logger" sha256 "github.com/minio/sha256-simd" "golang.org/x/crypto/blake2b" ) // magic HH-256 key as HH-256 hash of the first 100 decimals of π as utf-8 string with a zero key. var magicHighwayHash256Key ...
cmd/bitrot.go
0.704872
0.406744
bitrot.go
starcoder
package vp8l // This file deals with image transforms, specified in section 3. // nTiles returns the number of tiles needed to cover size pixels, where each // tile's side is 1<<bits pixels long. func nTiles(size int32, bits uint32) int32 { return (size + 1<<bits - 1) >> bits } const ( transformTypePr...
vendor/golang.org/x/image/vp8l/transform.go
0.650689
0.608827
transform.go
starcoder
package tibialevellookup import ( "errors" "fmt" "math" ) var expTable []uint // Calculates approximate experience based on level. // The actual math formula has been taken from: https://tibia.fandom.com/wiki/Experience_Table // It is worth to mention that Tibia.com's experience table does not exceed level 2000: ...
level.go
0.755186
0.413004
level.go
starcoder
package golinear /* #include "wrap.h" */ import "C" // Parameters for training a linear model. type Parameters struct { // The type of solver SolverType SolverType // The cost of constraints violation. Cost float64 // The relative penalty for each class. RelCosts []ClassWeight // The number of threads to use...
param.go
0.79546
0.501953
param.go
starcoder
package rfc2869 import ( "errors" "strconv" "time" "fbc/lib/go/radius" ) const ( AcctInputGigawords_Type radius.Type = 52 AcctOutputGigawords_Type radius.Type = 53 EventTimestamp_Type radius.Type = 55 ARAPPassword_Type radius.Type = 70 ARAPFeatures_Type radius.Type = 71 ARAPZ...
feg/radius/lib/go/radius/rfc2869/generated.go
0.585931
0.561816
generated.go
starcoder
package configify import ( "strconv" "strings" "time" ) // Massage standardizes how we try to convert values from a source into raw values to // feed to your program. type Massage struct { } // StringToSlice splits the value by commas, stripping any spaces in the tokens. func (Massage) StringToSlice(value string)...
massage.go
0.733833
0.487307
massage.go
starcoder
package percentile import ( "math" "sort" log "github.com/cihub/seelog" ) // CompleteDS stores all the data and therefore provides accurate // percentiles to compare to. type CompleteDS struct { Values []float64 `json:"vals"` Min float64 `json:"min"` Max float64 `json:"max"` Count int64 `json:...
vendor/github.com/DataDog/datadog-agent/pkg/metrics/percentile/complete_ds.go
0.707708
0.401277
complete_ds.go
starcoder
package dsf import ( "encoding/binary" "fmt" ) // DataChunk is the file structure of the data chunk within a DSD stream file, // excluding the variable length sample data. See "DSF File Format // Specification", v1.01, Sony Corporation. All data is little-endian. This is // exported to allow reading with binary.Re...
audio/dsf/data.go
0.657318
0.545225
data.go
starcoder
package native import ( "bytes" "github.com/anthonynsimon/bild/clone" "github.com/anthonynsimon/bild/effect" "github.com/anthonynsimon/bild/transform" "github.com/gojek/darkroom/pkg/processor" "image" "image/color" "image/draw" ) // BildProcessor uses bild library to process images using native Golang image.I...
pkg/processor/native/processor.go
0.832407
0.454351
processor.go
starcoder
package openapi import ( "encoding/json" "fmt" "net/url" "strings" ) // Optional parameters for the method 'CreatePayments' type CreatePaymentsParams struct { // The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that will create the resource. PathAccountSid *string `json:"PathAccountSid,om...
rest/api/v2010/accounts_calls_payments.go
0.786869
0.480905
accounts_calls_payments.go
starcoder
package requirements import ( "fmt" "strings" "github.com/aquasecurity/tfsec/cmd/tfsec-skeleton/examples" ) func AttributeMustHaveValue(blockType string, blockLabel string, dotPath string, expectedValue interface{}, failCheckForDefaultValue bool, exampleCode string) Requirement { return NewAttributeRequirement(b...
cmd/tfsec-skeleton/requirements/attributes.go
0.645902
0.46393
attributes.go
starcoder
package game import ( "image/color" "github.com/hajimehoshi/ebiten/v2" ) const ( maxMovingCount = 5 maxPoppingCount = 6 ) var ( tileSize = 40 tileMargin = 3 tileImage = ebiten.NewImage(tileSize, tileSize) ) func init() { tileImage.Fill(color.White) } // TilePosition represents a tile position. type Ti...
game/tile.go
0.830457
0.422266
tile.go
starcoder
package density import ( "image" "image/color" "math" "github.com/lucasb-eyer/go-colorful" ) const TileSize = 256 func TileXY(zoom int, lat, lng float64) (x, y int) { fx, fy := TileFloatXY(zoom, lat, lng) x = int(math.Floor(fx)) y = int(math.Floor(fy)) return } func TileFloatXY(zoom int, lat, lng float64) ...
vendor/github.com/fogleman/density/tile.go
0.629205
0.403097
tile.go
starcoder
package lute func (t *Tree) parseInlineHTML(ctx *InlineContext) (ret *Node) { tokens := ctx.tokens startPos := ctx.pos ret = &Node{typ: NodeText, tokens: []byte{tokens[ctx.pos]}} if 3 > ctx.tokensLen || ctx.tokensLen <= startPos+1 { ctx.pos++ return } var tags []byte tags = append(tags, tokens[startPos]) ...
inline_html.go
0.515864
0.469642
inline_html.go
starcoder
package tsuki import ( "sync" ) type ExpectAction int const ( ExpectActionNothing = ExpectAction(0) ExpectActionRead = ExpectAction(1) ExpectActionWrite = ExpectAction(2) ) var strToExpectAction = map[string]ExpectAction { "read": ExpectActionRead, "write": ExpectActionWrite, } // token ->...
expectation_db.go
0.588653
0.454048
expectation_db.go
starcoder
package it import ( "math" "gonum.org/v1/gonum/mat" ) // Entropy calculates the entropy of a probability distribution. // H(X) = -\sum_x p(x) log(p(x)) func Entropy(p mat.Vector) float64 { var r float64 for i := 0; i < p.Len(); i++ { v := p.AtVec(i) if v > 0.0 { r -= v * math.Log(v) } } return r } ...
stat/it/entropy.go
0.765681
0.564399
entropy.go
starcoder
package mos65c02 import ( "fmt" "reflect" "runtime" "strings" "github.com/pevans/erc/pkg/asmrec" "github.com/pevans/erc/pkg/disasm" "github.com/pevans/erc/pkg/trace" ) // An Instruction is a function that performs an operation on the CPU. type Instruction func(c *CPU) // Below is a table of instructions that...
pkg/mos65c02/instruction.go
0.508544
0.478529
instruction.go
starcoder
package main import ( "image" "image/color" "math" "math/rand" ) // Given a source value and a stddev, return a mutated number // - insure that the abs val of the delta is at least 1 // - insure that the returned value is clamped to [mn,mx] func mutateNorm(src float64, sd float64, mn float64, mx float64) float64 ...
mutation.go
0.754734
0.506774
mutation.go
starcoder
package iso20022 // Specifies rates. type CorporateActionRate74 struct { // Cash dividend amount per equity before deductions or allowances have been made. GrossDividendRate []*GrossDividendRateFormat23Choice `xml:"GrssDvddRate,omitempty"` // Cash dividend amount per equity after deductions or allowances have bee...
CorporateActionRate74.go
0.836755
0.610599
CorporateActionRate74.go
starcoder
package bls12381 import ( "errors" "github.com/cloudflare/circl/ecc/bls12381/ff" ) // Scalar represents positive integers in the range 0 <= x < Order. type Scalar = ff.Scalar const ScalarSize = ff.ScalarSize // Order returns the order of the pairing groups, returned as a big-endian slice. // Order = 0x73eda7532...
ecc/bls12381/constants.go
0.521959
0.457561
constants.go
starcoder
package formula import ( "fmt" "go/ast" "go/parser" "go/token" "math" "reflect" "runtime" "strconv" "strings" ) // astParser handles the parsing of the AST produced by parsing the formula passed into the astParser as an // AST expression. It 'links' functions and variables when they are encountered. type ast...
v2/parser.go
0.617974
0.578805
parser.go
starcoder
package ahrs import ( "github.com/chewxy/math32" "github.com/itohio/EasyRobot/pkg/core/math/vec" ) type MadgwickAHRS struct { Options accel, gyro, mag vec.Vector3D q vec.Quaternion SamplePeriod float32 } func NewMadgwick(opts ...Option) AHRS { m := MadgwickAHRS{ Options: defaultOptions(),...
pkg/core/math/filter/ahrs/madgwick.go
0.7237
0.432003
madgwick.go
starcoder
package ode // #include <ode/ode.h> // extern int callTriCallback(dGeomID mesh, dGeomID other, int index); // extern int callTriRayCallback(dGeomID mesh, dGeomID ray, int index, dReal u, dReal v); import "C" import ( "unsafe" ) var ( triCallbacks = map[TriMesh]TriCallback{} triRayCallbacks = map[TriMesh]TriRay...
trimesh.go
0.745028
0.611295
trimesh.go
starcoder
package holidays import ( "errors" "fmt" "time" ) type Region string const ( Bangkok Region = "Bangkok" Berlin Region = "Berlin" Bulgaria Region = "Bulgaria" California Region = "California" NewYork Region = "New York" ) var ( NoHoliday = errors.New("No holiday") orthodoxEaster = map[int]...
holidays/holidays.go
0.553264
0.618896
holidays.go
starcoder
package model import ( "container/heap" "encoding/json" "fmt" "strings" ) // Heap is a min heap that implements heap.Interface. // It provides the methods PushHeap and PopHeap, so that clients don't need to use the heap package. // It also provides methods for cloning the heap, deleting items from the heap based ...
model/heap.go
0.801237
0.403714
heap.go
starcoder
package expression import ( "gopkg.in/src-d/go-errors.v1" "github.com/dolthub/go-mysql-server/sql" ) var ErrInvalidOffset = errors.NewKind("offset must be a non-negative integer; found: %v") // IsUnary returns whether the expression is unary or not. func IsUnary(e sql.Expression) bool { return len(e.Children())...
sql/expression/common.go
0.821295
0.4165
common.go
starcoder
package dbtest import ( "context" "fmt" "testing" "time" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" beaconlib "github.com/scionproto/scion/go/cs/beacon" dbtest "github.com/scionproto/scion/go/cs/beacon/beacondbtest" "github.com/scionproto/scion/go/lib/addr" "github.com/scio...
go/pkg/storage/beacon/dbtest/dbtest.go
0.598195
0.401717
dbtest.go
starcoder
package image import ( "image" "image/color" ) type Translate struct { image.Image Point image.Point } var _ image.Image = &Translate{} func (t *Translate) Bounds() image.Rectangle { return t.Image.Bounds().Add(t.Point) } func (t *Translate) At(x, y int) color.Color { return t.Image.At(x-t.Point.X, y-t.Point...
pkg/image/transform.go
0.732879
0.46217
transform.go
starcoder
package ewallet import ( "context" "github.com/ianeinser/xendit-go" ) // CreatePayment creates new payment func CreatePayment(data *CreatePaymentParams) (*xendit.EWallet, *xendit.Error) { return CreatePaymentWithContext(context.Background(), data) } // CreatePaymentWithContext creates new payment func CreatePaym...
ewallet/ewallet.go
0.527317
0.413892
ewallet.go
starcoder
package processor import ( "crypto/sha1" "crypto/sha256" "crypto/sha512" "fmt" "strconv" "time" "github.com/Jeffail/benthos/lib/log" "github.com/Jeffail/benthos/lib/metrics" "github.com/Jeffail/benthos/lib/response" "github.com/Jeffail/benthos/lib/types" "github.com/OneOfOne/xxhash" "github.com/opentraci...
lib/processor/hash.go
0.739705
0.623062
hash.go
starcoder
package xex import ( "fmt" "strings" ) //Set up built-in string functions func registerStringBuiltins() { RegisterFunction( NewFunction( "string", FunctionDocumentation{ Text: `Converts an input into a string using fmt.Sprint`, Parameters: map[string]string{ "in": "The value to convert to a st...
builtins_strings.go
0.630116
0.430447
builtins_strings.go
starcoder
package geometry import ( "errors" "fmt" pm_geojson "github.com/paulmach/go.geojson" "github.com/skelterjohn/geom" "github.com/tidwall/gjson" "github.com/whosonfirst/go-whosonfirst-geojson-v2" _ "log" _ "time" ) type Polygon struct { geojson.Polygon `json:",omitempty"` Exterior geom.Polygon `json:"...
vendor/github.com/whosonfirst/go-whosonfirst-geojson-v2/geometry/polygon.go
0.762778
0.472623
polygon.go
starcoder
package perlin import ( "math" "math/rand" ) const ( defaultOctaves = 8 defaultPersistence = 0.5 ) var defaultNoise = New(0, defaultOctaves, defaultPersistence) func Noise1D(x float64) float64 { return defaultNoise.Noise1D(x) } func Noise2D(x, y float64) float64 { return defaultNoise.Noise2D(x, y) ...
perlin.go
0.600657
0.442094
perlin.go
starcoder
package digraph import () // Nodes is a convenience wrapper aroung NodeItr for chained methods type Nodes struct { NodeIterator } // All returns all remaining nodes func (n Nodes) All() []Node { ret := make([]Node, 0) for n.HasNext() { ret = append(ret, n.Next()) } return ret } // NodeIterator iterates throu...
itr.go
0.754192
0.473414
itr.go
starcoder
package Example import ( flatbuffers "github.com/google/flatbuffers/go" MyGame "MyGame" ) /// an example documentation comment: "monster object" type MonsterT struct { Pos *Vec3T Mana int16 Hp int16 Name string Inventory []byte Color Color Test *AnyT Test4 []*TestT Testarrayofstring []string Testarrayof...
tests/MyGame/Example/Monster.go
0.656108
0.499023
Monster.go
starcoder
package input import ( "github.com/Jeffail/benthos/lib/input/reader" "github.com/Jeffail/benthos/lib/log" "github.com/Jeffail/benthos/lib/metrics" "github.com/Jeffail/benthos/lib/types" ) //------------------------------------------------------------------------------ func init() { Constructors[TypeS3] = TypeS...
lib/input/s3.go
0.822153
0.663689
s3.go
starcoder
package normalize import ( "github.com/VKCOM/noverify/src/ir" ) func sideEffectFree(n ir.Node) bool { f := sideEffectsFinder{} n.Walk(&f) return !f.sideEffects } type sideEffectsFinder struct { sideEffects bool } var pureBuiltins = func() map[string]struct{} { list := []string{ `\count`, `\sizeof`, // ...
src/ir/normalize/side_effects.go
0.671255
0.527256
side_effects.go
starcoder
package numbers import ( "log" "math" //DEBUG: "fmt" ) //LogCanConvert returns true if the input logSpace number can be converted to a number in normal space without overflow or underflow. func LogCanConvert(x float64) bool { return x < 709.4 && x > -745.1 } //AverageLog returns the average of a list of logSpace...
numbers/logSpace.go
0.783575
0.604107
logSpace.go
starcoder
package fmom import ( "fmt" "math" ) type IPtCotThPhiM struct { P4 Vec4 } func NewIPtCotThPhiM(pt, eta, phi, m float64) IPtCotThPhiM { return IPtCotThPhiM{P4: Vec4{X: pt, Y: eta, Z: phi, T: m}} } func (p4 IPtCotThPhiM) String() string { return fmt.Sprintf( "fmom.P4{IPt:%v, CotTh:%v, Phi:%v, M:%v}", p4.IPt...
fmom/iptcotthphim.go
0.770594
0.433981
iptcotthphim.go
starcoder
package geometry import ( "github.com/Laughs-In-Flowers/shiva/lib/graphics" "github.com/Laughs-In-Flowers/shiva/lib/math" glm "math" ) type sphere struct { Geometry Radius float64 WidthSegments int HeightSegments int PhiStart float64 PhiLength float64 ThetaStart float64 ThetaLength...
lib/graphics/geometry/sphere.go
0.574395
0.564279
sphere.go
starcoder
\brief C implementation of Perlin Simplex Noise over 1,2,3, and 4 dimensions. \author <NAME> (<EMAIL>) Adapted to Go by <NAME> (<EMAIL>) */ /* * This implementation is "Simplex Noise" as presented by * Ken Perlin at a relatively obscure and not often cited course * session "Real-Time Shading" at Siggraph 2001 (bef...
examples/mesh/simplexnoise.go
0.74008
0.525734
simplexnoise.go
starcoder
package deluge // IngestorOptionFunc is a function that configures an Ingestor. It is used in // NewIngestor. type IngestorOptionFunc func(*Ingestor) error // SetDocument sets the document type for the ingest. func SetDocument(ctor Constructor) IngestorOptionFunc { return func(i *Ingestor) error { if ctor != nil {...
options.go
0.655777
0.536981
options.go
starcoder
package p1825 type MKAverage struct { root *Node m int k int nums []int } func Constructor(m int, k int) MKAverage { nums := make([]int, 0, 100010) return MKAverage{nil, m, k, nums} } func (this *MKAverage) AddElement(num int) { this.nums = append(this.nums, num) this.root = Insert(this.root, num) n :...
src/leetcode/set1000/set1000/set1800/set1820/p1825/solution.go
0.627152
0.468608
solution.go
starcoder