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 specs import ( "testing" "github.com/Fs02/grimoire" "github.com/Fs02/grimoire/c" "github.com/stretchr/testify/assert" ) // Aggregate tests count specifications. func Aggregate(t *testing.T, repo grimoire.Repo) { // preparte tests data user := User{Name: "name1", Gender: "male", Age: 10} repo.From(user...
adapter/specs/aggregate.go
0.526099
0.459925
aggregate.go
starcoder
package matrix import ( "fmt" "goray/common" "goray/tuple" ) type Matrix struct { Rows int Cols int D [][]float64 } func (m Matrix) Equal(o Matrix) bool { result := m.Rows == o.Rows && m.Cols == m.Cols if result { for i := 0; i < m.Rows; i++ { for j := 0; j < m.Cols; j++ { result = result && comm...
matrix/matrix.go
0.61682
0.47171
matrix.go
starcoder
package mathtoken import ( "errors" "strconv" "strings" "unicode" ) // Tokens defines a list of `Token` type Tokens []Token // Token defines a mathematical expression token type Token struct { Type Type Value string Associativity Associativity Precedence uint } // Type defines token type...
mathtoken.go
0.702938
0.409752
mathtoken.go
starcoder
package parser import ( "unicode" ) // Digit parses a single digit. func Digit() Parser { return CharRange('0', '9') } // LowerLetter parses a single lower case letter. func LowerLetter() Parser { return CharRange('a', 'z') } // UpperLetter parses a single upper case letter. func UpperLetter() Parser { return C...
vendor/github.com/reflect/parsego/parser/helpers.go
0.809765
0.600774
helpers.go
starcoder
package types import ( "bytes" "encoding/json" "fmt" ) type Board [9][7]Piece type Point [2]int var ( ADen = Point{3, 0} ATrap1 = Point{2, 0} ATrap2 = Point{4, 0} ATrap3 = Point{3, 1} BDen = Point{3, 8} BTrap1 = Point{3, 7} BTrap2 = Point{2, 8} BTrap3 = Point{4, 8} ) func NewBoard() *Board { return ...
pkg/types/board.go
0.621311
0.422505
board.go
starcoder
package genetic import ( "log" "math" "github.com/kevinburke/rct/geo" "github.com/kevinburke/rct/tracks" ) func rightTurn(trackEnd geo.Vector, stationStart geo.Vector) []tracks.Element { elem := tracks.Element{ Segment: tracks.TS_MAP[tracks.ELEM_RIGHT_QUARTER_TURN_3_TILES], } v := geo.AdvanceVector(trackEn...
genetic/track_completer.go
0.627381
0.552721
track_completer.go
starcoder
package geom // A Polygon represents a polygon as a collection of LinearRings. The first // LinearRing is the outer boundary. Subsequent LinearRings are inner // boundaries (holes). type Polygon struct { geom2 } // NewPolygon returns a new, empty, Polygon. func NewPolygon(layout Layout) *Polygon { return NewPolygon...
vendor/github.com/whosonfirst/go-whosonfirst-static/vendor/github.com/whosonfirst/go-whosonfirst-readwrite-sqlite/vendor/github.com/whosonfirst/go-whosonfirst-sqlite-features/vendor/github.com/twpayne/go-geom/polygon.go
0.907208
0.708313
polygon.go
starcoder
package terrain import ( "go-simulate-a-city/common/commonmath" "go-simulate-a-city/sim/config" "go-simulate-a-city/sim/core/dto/terraindto" "go-simulate-a-city/sim/core/gamegrid" "go-simulate-a-city/sim/core/mailroom" "go-simulate-a-city/sim/engine/subtile" "github.com/go-gl/mathgl/mgl32" ) var FORCE_REFRESH...
sim/engine/terrain/map.go
0.700792
0.422445
map.go
starcoder
package covid import ( "encoding/json" "github.com/go-resty/resty/v2" ) const ( rkiVaccinationDataAPIURL = "https://rki-vaccination-data.vercel.app" ) // VaccinationData is a struct that is JSON-compatible with the RKI vaccination data API. // It contains the current vaccination data grouped by province. type Vac...
covid/vaccination.go
0.70791
0.493226
vaccination.go
starcoder
package scale import "math" type Fn func(m float64) float64 func clamp(t, min, max float64) float64 { min, max = math.Min(min, max), math.Max(min, max) return math.Max(math.Min(t, max), min) } // Unclamp returns a function that scales a number from the interval [rMin,rMax] // to the interval [tMin,tMax]. func Unc...
scale/scale.go
0.918187
0.623979
scale.go
starcoder
package unum import ( "math" "github.com/UNO-SOFT/go-xsd/util" ) func Vec3_Back() Vec3 { return Vec3{0, 0, -1} } func Vec3_Down() Vec3 { return Vec3{0, -1, 0} } func Vec3_Fwd() Vec3 { return Vec3{0, 0, 1} } func Vec3_Left() Vec3 { return Vec3{-1, 0, 0} } func Vec3_One() Vec3 { ret...
util/num/vec3.go
0.813498
0.477737
vec3.go
starcoder
package dutil import ( "fmt" "reflect" ts "github.com/nikonsugar/gotch/tensor" ) // DataLoader combines a dataset and a sampler and provides // an iterable over the given dataset. type DataLoader struct { dataset Dataset indexes []int // order of samples in dataset for interation. batchSize int currIdx ...
dutil/dataloader.go
0.705582
0.562837
dataloader.go
starcoder
package datasize import "fmt" import "github.com/kormoc/unit" import "math" import "strings" type Datasize float64 type DatasizeSIBit Datasize type DatasizeSIByte Datasize type DatasizeIECBit Datasize type DatasizeIECByte Datasize var outputStringMaxPercision int = 3 var outputStringMaxLevels int = 1 ...
datasize/datasize.go
0.579638
0.472318
datasize.go
starcoder
package persist import ( "math/rand" "time" "github.com/jancona/ourroots/model" ) // MemoryPersister "persists" the model objects to an in-memory map. // It's mostly useful for testing type MemoryPersister struct { pathPrefix string categories map[string]model.Category collections map[string]model.Collection...
persist/memory_persister.go
0.771069
0.474936
memory_persister.go
starcoder
package mm import ( "fmt" "math" ) type Vector3 struct { X float64 Y float64 Z float64 } func NewVector3() *Vector3 { return &Vector3{0, 0, 0} } func Vector3_Max() *Vector3 { return &Vector3{ math.MaxFloat64, math.MaxFloat64, math.MaxFloat64, } } func Vector...
vector3.go
0.905376
0.806052
vector3.go
starcoder
package model import ( "github.com/alexandre-normand/glukit/app/apimodel" "time" ) // Represents a GlukitUser profile type GlukitUser struct { Email string `datastore:"email"` FirstName string `datastore:"firstName,noindex"` LastName string `datast...
app/model/glukituser.go
0.711431
0.533154
glukituser.go
starcoder
package mesh import ( "errors" "math" "github.com/ungerik/go3d/float64/vec3" ) const epsilon = 1e-5 type Triangle [3]vec3.T func (this Triangle) IntersectTriangle(other Triangle) (*Line, error) { planeA, planeB := this.Plane(), other.Plane() triApts := planeB.IntersectTriangle(this) triBpts := planeA.Inters...
src/geometry.go
0.71889
0.615463
geometry.go
starcoder
package mathutil import ( "math" "math/big" "github.com/shopspring/decimal" ) var ( //BigOne represents a single unit of an asset with precision 8 BigOne = uint64(math.Pow10(8)) //BigOneDecimal represents a single unit of an asset with precision 8 as decimal.Decimal BigOneDecimal = decimal.NewFromInt(int64(Bi...
pkg/mathutil/math.go
0.873242
0.725406
math.go
starcoder
package mediamachine import ( "bytes" "encoding/json" "fmt" "net/url" ) // SummaryType represent the possible output type of the summary. type SummaryType = string const ( // SummaryTypeGif - represents an output of type `gif` SummaryTypeGif SummaryType = "gif" // SummaryTypeMp4 - represents an output of type...
mediamachine/summary.go
0.81457
0.430387
summary.go
starcoder
package chart import ( "fmt" "math" // "os" // "strings" ) // PieChart represents pie and ring charts. // Data is exported but it you should use the AddData, AddDataPair and // AddIntDataPair methods to populate this field. // The FmtVal and FmtKey function are used to format optional labels // on the pie segment...
pie.go
0.66061
0.463748
pie.go
starcoder
package dns import ( "encoding/json" ) // ZonePatchZoneRecordMessage struct for ZonePatchZoneRecordMessage type ZonePatchZoneRecordMessage struct { // A zone record's name Name *string `json:"name,omitempty"` Type *ZoneRecordType `json:"type,omitempty"` // A zone record's time to live A record's TTL is the numb...
pkg/dns/model_zone_patch_zone_record_message.go
0.756447
0.417034
model_zone_patch_zone_record_message.go
starcoder
package main // uint24 returns func uint24(num uint32) [3]byte { if num > 0x00FFFFFF { panic("invalid uint24 passed") } result := fourByte(num) return [3]byte{result[1], result[2], result[3]} } // Instruction represents a 4-byte PowerPC instruction. type Instruction [4]byte // Instructions represents a group ...
powerpc.go
0.776792
0.519338
powerpc.go
starcoder
package ultralist import ( "errors" "fmt" "strconv" "time" ) // DateParser is a thing that parses relative, arbitrary, and absolute dates, and returns a date in the format of yyyy-mm-dd type DateParser struct{} // ParseDate takes a date from a Filter and turns it into a string with the format of yyyy-mm-dd func ...
ultralist/date_parser.go
0.692122
0.559471
date_parser.go
starcoder
package rfc2396 import "github.com/elimity-com/abnf/operators" // IPv4address = 1*digit "." 1*digit "." 1*digit "." 1*digit func IPv4address(s []byte) operators.Alternatives { return operators.Concat( "IPv4address", operators.Repeat1Inf("1*digit", Digit), operators.String(".", "."), operators.Repeat1Inf("1*...
rfc2396/syntax.go
0.575827
0.470493
syntax.go
starcoder
package pnoise import ( "math" "math/rand" ) var persistence = 1500 var numOctaves = 2 //3 prime numbers for noise generator var ( p1 int32 = 15731 p2 int32 = 789221 p3 int32 = 1376312589 ) //SetPersistence sets the persistence in the perlin noise algorithm //basically the amplitude func SetPersistence(p int) ...
pnoise/pnoise.go
0.672762
0.470615
pnoise.go
starcoder
package mach import ( "encoding/json" "fmt" "math" "strconv" "strings" "github.com/forsyth/jsonpath/paths" ) // JSON is a synonym for the interface{} structures returned by encoding/json, // used as values in the JSON machine, to make it clear that's what they are. type JSON = paths.JSON // temporary, during t...
mach/json.go
0.676406
0.442034
json.go
starcoder
package nist_sp800_22 import ( "math" ) func Rank(n uint64) (float64, bool, error) { var M uint64 = 32 // The number of rows in each matrix. var Q uint64 = 32 // The number of columns in each matrix. var R []uint64 // Rank var F []uint64 // the Number of Matrices with R_l = index (index means, rank) // (...
nist_sp800_22/binaryMatrixRank.go
0.597256
0.491761
binaryMatrixRank.go
starcoder
package unstructpath // SliceS is a "slice selector". It selects values as slices (if // possible) and filters those slices based on the "filtered" // predicates. type SliceS interface { // SliceS can be used as a Value predicate. If the selector // can't select any slice from the value, then the predicate is // fa...
pkg/framework/unstructpath/slices.go
0.80651
0.557303
slices.go
starcoder
package scc type ( // State is contains all the state for one run of the strongly connected components (SCC) graph algorithm. State interface { aState() // Don't allow interface to be implemented outside of this package // Visit has to be called when visiting a node, // before any recursion happens. Visit(n...
analysis/scc/strongly_connected_components.go
0.66072
0.464962
strongly_connected_components.go
starcoder
// Package prefixtree implements a prefix tree (technically, a trie). A prefix // tree enables rapid searching for strings that uniquely match a given // prefix. This implementation allows the user to associate data with each // string, so it can act as a sort of flexible key-value store. package prefixtree import ( ...
prefixtree.go
0.734024
0.467514
prefixtree.go
starcoder
package dxf import ( "fmt" "reflect" "strings" "testing" ) func roundTripDrawing(t *testing.T, d *Drawing) (result Drawing) { s := d.String() result = parse(t, s) return } func assert(t *testing.T, condition bool, message string) { if !condition { t.Error(message) } } func assertContains(t *testing.T, ex...
testHelpers.go
0.690246
0.598576
testHelpers.go
starcoder
package image import ( "bytes" "image" "io" "math" "encoding/base64" "github.com/abcum/orbit" "github.com/disintegration/imaging" "github.com/anthonynsimon/bild/adjust" "github.com/anthonynsimon/bild/blur" "github.com/anthonynsimon/bild/channel" "github.com/anthonynsimon/bild/clone" "github.com/anthon...
cpm/image/image.go
0.769514
0.447038
image.go
starcoder
package irmf import ( "fmt" "log" "strings" ) func matrixMult(mbb *MBB, vec0, vec1, vec2, vec3 []float64) *MBB { mult := func(x, y, z float64) (float64, float64, float64) { a := x*vec0[0] + y*vec0[1] + z*vec0[2] + vec0[3] b := x*vec1[0] + y*vec1[1] + z*vec1[2] + vec1[3] c := x*vec2[0] + y*vec2[1] + z*vec2[2...
irmf/matrix.go
0.550124
0.46952
matrix.go
starcoder
package isdef import ( "fmt" "reflect" "github.com/elastic/go-lookslike/llpath" "github.com/elastic/go-lookslike/llresult" ) // IsEqual tests that the given object is equal to the actual object. func IsEqual(to interface{}) IsDef { toV := reflect.ValueOf(to) isDefFactory, ok := equalChecks[toV.Type()] // If ...
vendor/github.com/elastic/go-lookslike/isdef/core.go
0.815049
0.476945
core.go
starcoder
package test import ( "reflect" ) func isNil(actual interface{}) bool { if actual == nil { return true } else { // a value that returns false on an equality check against nil isn't necessarily nil and requires further attention var value = reflect.ValueOf(actual) switch value.Kind() { case reflect.Chan: ...
test/util.go
0.746231
0.498413
util.go
starcoder
package rifs import ( "io" "os" "github.com/dsoprea/go-logging" ) // SeekableBuffer is a simple memory structure that satisfies // `io.ReadWriteSeeker`. type SeekableBuffer struct { data []byte position int64 } // NewSeekableBuffer is a factory that returns a `*SeekableBuffer`. func NewSeekableBuffer() *Se...
v2/filesystem/seekable_buffer.go
0.76986
0.419172
seekable_buffer.go
starcoder
package main import ( "math" "sort" . "github.com/9d77v/leetcode/pkg/algorithm/math" ) /* 题目:与数组中元素的最大异或值 给你一个由非负整数组成的数组 nums 。另有一个查询数组 queries ,其中 queries[i] = [xi, mi] 。 第 i 个查询的答案是 xi 和任何 nums 数组中不超过 mi 的元素按位异或(XOR)得到的最大值。换句话说,答案是 max(nums[j] XOR xi) ,其中所有 j 均满足 nums[j] <= mi 。如果 nums 中的所有元素都大于 mi,最终答案就是 -1 。...
internal/leetcode/1707.maximum-xor-with-an-element-from-array/main.go
0.511961
0.400398
main.go
starcoder
package serialize import ( "fmt" "strconv" "strings" "time" "github.com/dynatrace-oss/dynatrace-metric-utils-go/metric/dimensions" "github.com/dynatrace-oss/dynatrace-metric-utils-go/normalize" ) func joinPrefix(metricKey, prefix string) string { if prefix != "" { return fmt.Sprintf("%s.%s", prefix, metric...
serialize/serialize.go
0.887113
0.402833
serialize.go
starcoder
package evaluator import ( "github.com/niklaskorz/nklang/ast" ) func evaluateExpression(n ast.Expression, scope *DefinitionScope) (Object, error) { switch e := n.(type) { case *ast.Function: return &Function{Function: e, parentScope: scope}, nil case *ast.Integer: return (*Integer)(e), nil case *ast.Float: ...
evaluator/expressions.go
0.626696
0.418043
expressions.go
starcoder
package core import ( "errors" "math" "github.com/gonum/floats" "golang.org/x/exp/rand" ) // Clust type is an abbrevation for centroids indexed by labels. type Clust []Elemt // Initializer function initializes k centroids from the given elements. type Initializer func(k int, elemts []Elemt, space Space, src *r...
core/clustering.go
0.830628
0.567277
clustering.go
starcoder
package algo import ( "reflect" "github.com/puppetlabs/leg/datastructure" "github.com/puppetlabs/leg/graph" ) const ( TiernanSimpleCyclesSupportedFeatures = graph.DeterministicIteration ) type TiernanSimpleCycles struct { features graph.GraphFeature g graph.DirectedGraph } func (tsc *TiernanSimpleCyc...
graph/algo/tiernan_simple_cycles.go
0.611614
0.469399
tiernan_simple_cycles.go
starcoder
package p480 /** Median is the middle value in an ordered integer list. If the size of the list is even, there is no middle value. So the median is the mean of the two middle value. Examples: [2,3,4] , the median is 3 [2,3], the median is (2 + 3) / 2 = 2.5 Given an array nums, there is a sliding window of size k wh...
algorithms/p480/480.go
0.721743
0.734501
480.go
starcoder
package protocol import ( "log" "fmt" "encoding/binary" "github.com/NeilBetham/elements/radios" ) type Reading struct { StationID int Sensor Sensor SensorName string Value float64 RawValue uint32 Valid bool WindSpeed float64 WindDir float64 StationBatLow bool } func (r Reading) String() s...
protocol/reading.go
0.674158
0.508971
reading.go
starcoder
package spirv // OpVectorExtractDynamic reads a single, dynamically selected, component of // a vector. type OpVectorExtractDynamic struct { ResultType Id ResultId Id Vector Id Index Id } func (c *OpVectorExtractDynamic) Opcode() uint32 { return opcodeVectorExtractDynamic } func (c *OpVectorExtractDyn...
instructions_composite.go
0.802013
0.452778
instructions_composite.go
starcoder
package exphist type ExpHistVector struct { mergeSize int buckets VectorBuckets } func NewForVector(m int) *ExpHistVector { return &ExpHistVector{ mergeSize: m + 1, buckets: [][]VectorBucket{[]VectorBucket{}}, } } func (e *ExpHistVector) Add(x []float64) { bucket := VectorBucket{ contents: x, capaci...
exphist_vector.go
0.571288
0.707342
exphist_vector.go
starcoder
package point import ( "image" "github.com/borkshop/bork/internal/moremath" ) // Pt is a convenience constructor for Point. func Pt(x, y int) Point { return Point{x, y} } // Point represents a point in <X,Y> 2-space. type Point struct{ X, Y int } // Zero is the origin, the zero value of Point. var Zero = Point{}...
internal/point/point.go
0.928051
0.547283
point.go
starcoder
package hw1 // PermDumb is a naive implementation to calculate the Permutation statistic. // It will fail when n is greatr than about 20, as fact(n) will overflow a 64 bit int func PermDumb(n int, k int) int { //defer TimeIt(time.Now(), "permDumb") return Fact(n) / Fact(n-k) } // CombDumb is a naive implementation ...
hw1/combperm.go
0.733261
0.454048
combperm.go
starcoder
package day12 import ( "math" "github.com/segwin/adventofcode-2020/internal/geometry" ) type CardinalDirection uint const ( // cardinal directions North CardinalDirection = 0 East CardinalDirection = 1 South CardinalDirection = 2 West CardinalDirection = 3 numCardinalDirections = 4 ) func (d CardinalDir...
internal/solutions/day12/directions.go
0.776284
0.420659
directions.go
starcoder
package main import ( "errors" "image" "image/color" "image/png" "math" "net/http" "os" "github.com/lmbarros/sbxs_go_noise/fractalnoise" "github.com/lmbarros/sbxs_go_noise/opensimplex" "github.com/lmbarros/sbxs_go_rand/randutil" ) const ( // mapWidth is the final image width, in pixels. mapWidth = 1024 ...
simple_terrain_generator/main.go
0.68342
0.44065
main.go
starcoder
package models import ( "errors" ) // Provides operations to manage the alerts property of the microsoft.graph.security entity. type SecurityNetworkProtocol int const ( UNKNOWN_SECURITYNETWORKPROTOCOL SecurityNetworkProtocol = iota IP_SECURITYNETWORKPROTOCOL ICMP_SECURITYNETWORKPROTOCOL IGMP_SECURI...
models/security_network_protocol.go
0.601008
0.440469
security_network_protocol.go
starcoder
package arrowtools import ( "github.com/apache/arrow/go/arrow/array" ) // GetUint8SliceFromRecord returns a slice corresponding to the given // column position in the given record. func (rh *RecordHelper) Uint8Slice() []uint8 { return array.NewUint8Data(rh.rec.Column(rh.curpos).Data()).Uint8Values() } // GetUint1...
gen_record.go
0.848314
0.677792
gen_record.go
starcoder
package num import ( "math" "math/big" "strconv" ) // BIG INTS // Some calculcations are going to produce numbers that overflow Int(int64) // BigToSet returns a Set from the digits of a big.Int func BigToSet(n *big.Int) Set { var res Set for _, v := range n.String() { i, _ := strconv.ParseInt(string(v), 10, ...
big.go
0.768125
0.49884
big.go
starcoder
package godata import ( "github.com/tkhandel/go-data/element" "github.com/tkhandel/go-data/log" ) type DataFrame struct { columns map[string]Column stringColumns map[string]StringSeries intColumns map[string]IntSeries floatColumns map[string]FloatSeries } type Column struct { name string dType ele...
dataframe.go
0.528777
0.514095
dataframe.go
starcoder
package clientbrownfield import ( "encoding/json" "fmt" "testing" "github.com/ingrammicro/cio/api/types" "github.com/ingrammicro/cio/utils" "github.com/stretchr/testify/assert" ) // ListBrownfieldCloudAccountsMocked test mocked function func ListBrownfieldCloudAccountsMocked(t *testing.T, cloudAccountsIn []*t...
api/clientbrownfield/cloud_accounts_api_mocked.go
0.705988
0.507263
cloud_accounts_api_mocked.go
starcoder
package schemax import "sync" /* LDAPSyntaxTypeCollection describes all LDAPSyntax-based types. */ type LDAPSyntaxCollection interface { // Get returns the *LDAPSyntax instance retrieved as a result // of a term search, based on Name or OID. If no match is found, // nil is returned. Get(interface{}) *LDAPSyntax ...
ls.go
0.762866
0.45302
ls.go
starcoder
package bytes import ( "bytes" "encoding/json" ) // mutability determines whether the bytes are mutable by contract. type mutability int // A list of supported mutability modes. const ( mutable mutability = iota immutable ) // Bytes contains a byte slice alongside metadata informaion such as // mutability and o...
x/bytes/bytes.go
0.814791
0.479199
bytes.go
starcoder
package gomesh import "errors" // ErrVertexNotFound is returned when the FindVertex() function does not find the vertex var ErrVertexNotFound = errors.New("vertex not found") // ErrInvalidMesh is returned when a decoding function can not make a valid mesh from the data var ErrInvalidMesh = errors.New("invalid Mesh d...
mesh.go
0.816662
0.608041
mesh.go
starcoder
package ce import ( "github.com/kstenerud/go-concise-encoding/internal/arrays" ) // Copy byte slice data, interpreting as little endian data of larger types. func BytesToInt8Slice(data []byte) []int8 { return arrays.BytesToInt8Slice(data) } func BytesToUint16Slice(data []byte) []uint16 { return arrays.BytesToUint1...
ce/arrays.go
0.582372
0.497437
arrays.go
starcoder
package main import ( "fmt" "log" "github.com/saylorsolutions/passlock" ) // GenericDataStructure is an example data structure that holds an encrypted payload with a string identifier to allow // application code to reference the encrypted data. // The data structure can be safely transferred over an insecure net...
cmd/integrated-use-example/main.go
0.650689
0.40807
main.go
starcoder
package otlptext import ( "bytes" "fmt" "strconv" "strings" "go.opentelemetry.io/collector/model/pdata" ) type dataBuffer struct { buf bytes.Buffer } func (b *dataBuffer) logEntry(format string, a ...interface{}) { b.buf.WriteString(fmt.Sprintf(format, a...)) b.buf.WriteString("\n") } func (b *dataBuffer)...
internal/otlptext/databuffer.go
0.518546
0.41834
databuffer.go
starcoder
Coding Exercise #1 1. Using the var keyword declare a string called name and initialize it with your name. 2. Using short declaration syntax declare a string called country and assign the country you are living in to the string variable. 3. Print the following string on multiple lines like this: Your name: `here th...
more_code/coding_tasks/strings/main.go
0.760117
0.698593
main.go
starcoder
package ingest import ( "time" "github.com/uber-go/tally" ) // LatencyBuckets are a set of latency buckets useful for measuring things. type LatencyBuckets struct { WriteLatencyBuckets tally.DurationBuckets IngestLatencyBuckets tally.DurationBuckets } // NewLatencyBuckets returns write and ingest latency buck...
src/cmd/services/m3coordinator/ingest/metrics.go
0.68215
0.452536
metrics.go
starcoder
package secret import ( "fmt" "gopkg.in/yaml.v2" ) // YamlEncoder is an Encoder compatible object with additional helpers to work with yaml data: EncryptYamlData and DecryptYamlData type YamlEncoder struct { Encoder Encoder generateFunc func([]byte) ([]byte, error) extractFunc func([]byte) ([]byte, error) } ...
pkg/secret/yaml_encoder.go
0.711932
0.408218
yaml_encoder.go
starcoder
package board import ( "github.com/mandykoh/scrubble/coord" ) // Board represents a game board, which is a grid of positions on which tiles // can be placed. The zero-value of a Board is a zero-sized board. type Board struct { Rows int Columns int Positions []Position } // WithLayout creates a board with ...
board/board.go
0.853027
0.419588
board.go
starcoder
package info var ViewLocalCommandHelpText = ` View the current environment variables for a given ConfigMap and summon secrets.yml. This will retrieve the stored secrets within AWS Secrets Manager and map them via the secrets.yml file used by the 'summon' CLI tool to generate the current state of Environment Variables...
info/help.go
0.756807
0.606353
help.go
starcoder
package git_commands import ( "github.com/Jeffthedoor/generics/maps" "github.com/Jeffthedoor/generics/slices" "github.com/sirupsen/logrus" ) // although the typical terms in a git bisect are 'bad' and 'good', they're more // generally known as 'new' and 'old'. Semi-recently git allowed the user to define // their ...
pkg/commands/git_commands/bisect_info.go
0.528047
0.406214
bisect_info.go
starcoder
package forecast import ( "fmt" "time" "github.com/square/metrics/api" "github.com/square/metrics/function" ) // FunctionRollingMultiplicativeHoltWinters computes a rolling multiplicative Holt-Winters model for the data. // It takes in several learning rates, as well as the period that describes the periodicity...
function/builtin/forecast/rolling_function.go
0.703549
0.719593
rolling_function.go
starcoder
package iso20022 // Order to invest the investor's principal in an investment fund. type SubscriptionOrder3 struct { // Unique and unambiguous identifier for an order, as assigned by the instructing party. OrderReference *Max35Text `xml:"OrdrRef"` // Specifies the category of the investment fund order. OrderType...
SubscriptionOrder3.go
0.777638
0.425486
SubscriptionOrder3.go
starcoder
package ar3 import ( "fmt" "github.com/koeng101/kinematics" ) // AR3simulate struct represents an AR3 robotic arm interface for testing purposes. type AR3simulate struct { jointVals [7]int jointDirs [7]bool limitSwitchSteps [7]int } // ConnectMock connects to a mock AR3simulate interface. func Con...
mock.go
0.769514
0.546194
mock.go
starcoder
package weighted_levenshtein import ( "unicode/utf8" ) var defaultWeight = float64(1) func Distance(a string, b string, weights map[rune]map[rune]float64) float64 { if len(a) == 0 { return float64(utf8.RuneCountInString(b)) } if len(b) == 0 { return float64(utf8.RuneCountInString(a)) } if a == ...
weighted_levenshtein.go
0.63861
0.451992
weighted_levenshtein.go
starcoder
package faketime import ( "sync" "sync/atomic" "time" "github.com/kopia/kopia/internal/clock" ) // Frozen returns a function that always returns t. func Frozen(t time.Time) func() time.Time { return func() time.Time { return t } } // AutoAdvance returns a time source function that returns a time equal to //...
internal/faketime/faketime.go
0.771241
0.401248
faketime.go
starcoder
package si5351 import ( "io" ) // Frequency represents a frequency in Hz type Frequency float64 // Frequency multipliers const ( Hz Frequency = 1 KHz Frequency = 1000 MHz Frequency = 1000000 ) // ClockDivider represents a clock divider used at several places to divide a clock by a multiple of two. type ClockDi...
pkg/si5351/frequency.go
0.880457
0.527499
frequency.go
starcoder
package timex //-------------------- // IMPORTS //-------------------- import ( "time" ) //-------------------- // RANGES //-------------------- // YearInList test if the year of a time is in a given list. func YearInList(t time.Time, years []int) bool { for _, year := range years { if t.Year() == year { re...
timex/timex.go
0.769254
0.790369
timex.go
starcoder
package tick type Tick struct { t int delta int duration int } func (t Tick) Sub(u int) Tick { return Tick{ t: t.t - u, delta: t.delta, duration: t.duration, } } // Delta returns the value of delta that was last passed to Advance. func (t Tick) Delta() int { return t.d...
tick/tick.go
0.716913
0.503174
tick.go
starcoder
package types import ( "encoding/json" "fmt" "regexp" log "github.com/sirupsen/logrus" "github.com/smartystreets/assertions" "gopkg.in/yaml.v3" ) const ( DefaultMatcher = "ShouldEqual" ) type Assertion func(actual interface{}, expected ...interface{}) string var asserts = map[string]Assertion{ "ShouldResem...
types/matchers.go
0.665954
0.507934
matchers.go
starcoder
package tort import ( "fmt" "strings" "testing" ) // Assertions are the base set of assertions. type Assertions struct { t testing.TB msg string } // A provides an alias shortcut for assertions. Makes it easier to use the With function in test // cases. type A struct { Assertions } // NewAssertions creates...
assertions.go
0.64646
0.65782
assertions.go
starcoder
package main import ( "fmt" "strings" ) // ZFSDataset represents a zfs dataset (aka. zfs filesystem) type ZFSDataset struct { Name string Used string Avail string Refer string MountPoint string execZFS execZFSFunc } // ConvertToActualPath converts a given path in the snapshot to a pa...
zfs_dataset.go
0.693161
0.502197
zfs_dataset.go
starcoder
package bezier2 import ( "fmt" "github.com/rekrad/go3d/float64/vec2" ) // T holds the data to define a cubic bezier spline. type T struct { P0, P1, P2, P3 vec2.T } // Parse parses T from a string. See also String() func Parse(s string) (r T, err error) { _, err = fmt.Sscan(s, &r.P0[0], &r.P0[1], &r.P1[0], &...
float64/bezier2/bezier2.go
0.868743
0.582372
bezier2.go
starcoder
package graphviz import ( "fmt" "io" "os/exec" ) // Graph represents a set of nodes, edges and attributes that can be // translated to DOT language. type Graph struct { nodes map[int]*node edges map[int]*edge n, e int graphAttributes attributes nodeAttributes attributes edgeAt...
graphviz/graphviz.go
0.562777
0.427755
graphviz.go
starcoder
package types import ( "reflect" "github.com/open2b/scriggo/internal/runtime" ) // MapOf behaves like reflect.MapOf except when at least one of the map key or // the map element is a Scriggo type; in such case a new Scriggo map type is // created and returned as reflect.Type. func (types *Types) MapOf(key, elem r...
vendor/github.com/open2b/scriggo/internal/compiler/types/map.go
0.76145
0.487917
map.go
starcoder
package cflp import ( "fmt" "io" "math" "math/rand" ) // AreaOperator is an operator to change the solution to a near state. type AreaOperator int const ( // OpFlip AreaOperator. // Randomly open/close a facility. OpFlip AreaOperator = iota // OpRangeFlip AreaOperator. // Randomly open/close a sequence of f...
cflp/solution.go
0.577853
0.456713
solution.go
starcoder
package dao import ( "database/sql" "fmt" "time" "github.com/squat/and/dab/simple-temple-test-user/util" "github.com/google/uuid" // pq acts as the driver for SQL requests "github.com/lib/pq" ) // BaseDatastore provides the basic datastore methods type BaseDatastore interface { ListSimpleTempleTestUser() (*...
src/e2e/resources/simple-temple-expected/simple-temple-test-user/dao/dao.go
0.506591
0.40486
dao.go
starcoder
package dict import "reflect" // Dict is a pass-through implementation of the Dicter interface type Dict map[string]interface{} func (d Dict) String(key string, def *string) (r string, err error) { v, ok := d[key] if !ok { if def == nil { return r, ErrKeyRequired(key) } else { return *def, nil } } r...
dict/dict.go
0.668447
0.418222
dict.go
starcoder
package service import ( "fmt" "github.com/taufanmahaputra/forex/pkg/repository" "log" "math" "time" ) type Map map[string]interface{} type RateDataService struct { rateRepository repository.RateRepositoryItf rateDataRepository repository.RateDataRepositoryItf } func InitRateDataService(rateRepository re...
pkg/service/rate_data.go
0.506836
0.420302
rate_data.go
starcoder
package main import ( "fmt" "strconv" "github.com/fernomac/advent2020/lib" ) func main() { lines := lib.ReadLines("input.txt") defer lines.Close() p1 := partOne{dir: east} p2 := partTwo{dir: vector{x: 10, y: -1}} // Parse the instructions and apply each to each movement strategy in parallel. for lines.Nex...
day12/main.go
0.70791
0.517266
main.go
starcoder
package tag import ( "sort" ) // How well does a tagspec match a certain tag? MatchFailures counts which // elemnts of a tagsepc (and how often) they do not match the tag. type MatchFailures struct { Node *Node Content int ReqAttr, ForbAttr int ReqClass, ForbClass int Sub, Deep ...
tag/debug.go
0.616012
0.427994
debug.go
starcoder
package drawing // NewDashVertexConverter creates a new dash converter. func NewDashVertexConverter(dash []float64, dashOffset float64, flattener Flattener) *DashVertexConverter { var dasher DashVertexConverter dasher.dash = dash dasher.currentDash = 0 dasher.dashOffset = dashOffset dasher.next = flattener retur...
vendor/github.com/wcharczuk/go-chart/v2/drawing/dasher.go
0.788176
0.401101
dasher.go
starcoder
package perspectivefungo import ( "github.com/go-gl/mathgl/mgl32" "math" "time" ) const ( ACCELERATION = 98.1 INCREMENT = 0.02 ) type Animation interface { Tick() bool // Return true if animation has completed } var ( maxAngle = math.Pi / 20. xAxis = mgl32.Vec4{1, 0, 0, 1} yAxis = mgl32.Vec4{0, 1,...
animation.go
0.685423
0.606848
animation.go
starcoder
package scale import ( "fmt" "sort" "github.com/gvallee/collective_profiler/tools/internal/pkg/unit" ) /* func mapIntsScaleDown(unitType int, unitScale int, values map[int]int) (int, int, map[int]int) { if unitScale == -1 { // Unit not recognized, nothing we can do return unitType, unitScale, values } ne...
tools/internal/pkg/scale/scale_mapints.go
0.693369
0.450541
scale_mapints.go
starcoder
package g import ( "image" "log" "os" "path/filepath" "time" "image/draw" // reading jpeg and png images as textures _ "image/jpeg" _ "image/png" "github.com/go-gl/gl/v3.3-compatibility/gl" ) // Texture a texture type Texture struct { Path string modtime time.Time lasterr error Repeat bool RGBA *...
g/texture.go
0.593845
0.409457
texture.go
starcoder
package gollection func Indexer[T any](it Iterator[T]) Iterator[Pair[int, T]] { return &indexerStream[T]{-1, it} } type indexerStream[T any] struct { index int iterator Iterator[T] } func (a *indexerStream[T]) Next() Option[Pair[int, T]] { if v, ok := a.iterator.Next().Get(); ok { a.index++ return Some(Pa...
transform.go
0.691706
0.409634
transform.go
starcoder
package slang import "fmt" // Sequence is an interface for sequential composite types. Sequences are immutable collections that // are represented by its abstractions. type Sequence interface { Append(items LangType) Sequence First() LangType Rest() Sequence Nth(n Number) LangType Len() Number } type node struc...
sequence.go
0.849753
0.462473
sequence.go
starcoder
import "github.com/kaitai-io/kaitai_struct_go_runtime/kaitai" /** * Avantes USB spectrometers are supplied with a Windows binary which * generates one ROH and one RCM file when the user clicks "Save * experiment". In the version of 6.0, the ROH file contains a header * of 22 four-byte floats, then the spectrum a...
avantes_roh60/src/go/avantes_roh60.go
0.658088
0.510924
avantes_roh60.go
starcoder
package mario import ( "fmt" neural "github.com/poseidon4o/go-neural/src/neural" util "github.com/poseidon4o/go-neural/src/util" "math" ) const G_CONST float64 = 9.8 * 150 var G_FORCE util.Vector = util.Vector{ X: 0, Y: G_CONST, } const BLOCK_SIZE int = 25 var JUMP_FORCE util.Vector = util.Vector{ X: 0, Y:...
src/problems/mario/physics.go
0.539226
0.462048
physics.go
starcoder
package ta // MEAN calculates the mean value for values provided func MEAN(values []float64) float64 { var total float64 = 0 for _, element := range values { total += element } return total / float64(len(values)) } // SMA calculates the Simple Moving Average for the provided period func SMA(values []float64, pe...
ta/moving_averages.go
0.770724
0.522263
moving_averages.go
starcoder
package msgraph // RatingGermanyTelevisionType undocumented type RatingGermanyTelevisionType int const ( // RatingGermanyTelevisionTypeVAllAllowed undocumented RatingGermanyTelevisionTypeVAllAllowed RatingGermanyTelevisionType = 0 // RatingGermanyTelevisionTypeVAllBlocked undocumented RatingGermanyTelevisionType...
v1.0/RatingGermanyTelevisionTypeEnum.go
0.580114
0.536859
RatingGermanyTelevisionTypeEnum.go
starcoder
package filters import ( "encoding/json" "testing" "time" "github.com/infracloudio/botkube/test/e2e/env" "github.com/infracloudio/botkube/test/e2e/utils" "github.com/nlopes/slack" "github.com/stretchr/testify/assert" "k8s.io/api/core/v1" extV1beta1 "k8s.io/api/extensions/v1beta1" metav1 "k8s.io/apimachinery...
test/e2e/filters/filters.go
0.634656
0.694969
filters.go
starcoder
package ast import ( "errors" "fmt" "strings" "sync" "github.com/influx6/faux/metrics" "github.com/influx6/moz/gen" ) // TypeAnnotationGenerator defines a function which generates specific code related to the giving // Annotation for a non-struct, non-interface type declaration. This allows you to apply and cr...
vendor/github.com/influx6/moz/ast/registry.go
0.669853
0.465205
registry.go
starcoder
package main import ( "bufio" "fmt" "log" "math" "os" "sort" "sync" ) type Coord struct { x, y int } type vectorDist struct { x, y int distance float64 } type vectorDists []vectorDist func (s vectorDists) Len() int { return len(s) } func (s vectorDists) Swap(i, j int) { s[i], s[j] = s[j], s[i] } ...
2019-10/angch/main.go
0.606498
0.406332
main.go
starcoder
package test import ( "fmt" "testing" "github.com/codeready-toolchain/api/pkg/apis/toolchain/v1alpha1" "github.com/codeready-toolchain/host-operator/pkg/counter" "github.com/codeready-toolchain/host-operator/pkg/metrics" "github.com/codeready-toolchain/toolchain-common/pkg/test" "github.com/codeready-toolchain...
test/counter.go
0.599602
0.406803
counter.go
starcoder