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 gostructureless import "fmt" type Array struct { Path string t string x []interface{} } func newArray(path string, a []interface{}) *Array { return &Array{ Path: path, t: "array", x: a, } } func (a *Array) GetPath() string { return a.Path } func (a *Array) Bool() (bool, error) { retu...
array.go
0.609175
0.406862
array.go
starcoder
package main /** * <p>Implement the <code>myAtoi(string s)</code> function, which converts a string to a 32-bit signed integer (similar to C/C++&#39;s <code>atoi</code> function).</p> <p>The algorithm for <code>myAtoi(string s)</code> is as follows:</p> <ol> <li>Read in and ignore any leading whitespace.</li> <li...
algorithms/8.string-to-integer-atoi.go
0.752468
0.652408
8.string-to-integer-atoi.go
starcoder
package models import ( i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91 "github.com/microsoft/kiota-abstractions-go/serialization" ) // UnifiedRoleAssignmentMultiple type UnifiedRoleAssignmentMultiple struct { Entity // Ids of the app specific scopes when the assignment scopes are app s...
models/unified_role_assignment_multiple.go
0.649134
0.471102
unified_role_assignment_multiple.go
starcoder
package cpu import "errors" type amode func(bool) *uint8 // helper functions func setZeroAndNegative(value uint8) { zero = value == 0 negative = value >= 0x80 } func readUInt16(address uint16) uint16 { ticksToNext += 2 return uint16(Memory[address]) + (uint16(Memory[address + 1]) << 8) } func readUInt16WithErr...
cpu/instruction_set.go
0.554229
0.402099
instruction_set.go
starcoder
package recurrence import ( "encoding/json" "fmt" "strconv" "time" ) // A Day specifies a day of the month. (1, 2, 3, ...31) type Day int // IsOccurring implements the Schedule interface. func (d Day) IsOccurring(t time.Time) bool { dayInt := int(d) if dayInt == Last { return isLastDayInMonth(t) } return...
day.go
0.774199
0.577614
day.go
starcoder
package steg import ( "encoding/binary" "fmt" "github.com/DimitarPetrov/stegify/bits" "image" "io" "os" ) //Decode performs steganography decoding of Reader with previously encoded data by the Encode function and writes to result Writer. func Decode(carrier io.Reader, result io.Writer) error { RGBAImage, _, er...
steg/steg_decode.go
0.652906
0.45847
steg_decode.go
starcoder
package plaid import ( "encoding/json" ) // TaxpayerID Taxpayer ID of the individual receiving the paystub. type TaxpayerID struct { // Type of ID, e.g. 'SSN' IdType NullableString `json:"id_type,omitempty"` // ID mask; i.e. last 4 digits of the taxpayer ID IdMask NullableString `json:"id_mask,omitempty"` // L...
plaid/model_taxpayer_id.go
0.759047
0.415373
model_taxpayer_id.go
starcoder
package clip import ( "encoding/binary" "math" "github.com/p9c/gio/internal/opconst" "github.com/p9c/gio/op" ) // Stroke represents a stroked path. type Stroke struct { Path PathSpec Style StrokeStyle // Dashes specify the dashes of the stroke. // The empty value denotes no dashes. Dashes DashSpec } // ...
op/clip/stroke.go
0.817793
0.519948
stroke.go
starcoder
package promtest import ( "math" "testing" "github.com/prometheus/client_golang/prometheus" dto "github.com/prometheus/client_model/go" ) // TestRegistry is a prometheus registry meant to be used for testing type TestRegistry struct { *prometheus.Registry t *testing.T } // NewTestRegistry allocates and initia...
promtest.go
0.846006
0.464537
promtest.go
starcoder
package kgo import ( "errors" "strings" "time" ) // DateFormat pattern rules. var datePatterns = []string{ // year "Y", "2006", // A full numeric representation of a year, 4 digits Examples: 1999 or 2003 "y", "06", // A two digit representation of a year Examples: 99 or 03 // month "m", "01", // Numeric ...
time.go
0.553747
0.523847
time.go
starcoder
package box import ( "github.com/adamcolton/geom/d2" "github.com/adamcolton/geom/d2/curve/line" ) // Box is a rectangle that lies orthoganal to the plane. The first point should // be the min point and the second should be the max. type Box [2]d2.Pt // New Box containing all the points passed in. func New(pts ...d...
d2/shape/box/box.go
0.886782
0.608071
box.go
starcoder
package duration import ( "time" "github.com/Cloud-Foundations/tricorder/go/tricorder/units" ) // Duration represents a duration of time // For negative durations, both Seconds and Nanoseconds are negative. // Internal use only for now. type Duration struct { Seconds int64 Nanoseconds int32 } func New(d tim...
go/tricorder/duration/api.go
0.931665
0.514034
api.go
starcoder
package mongodb import ( "errors" "go/token" "strings" "time" "github.com/eroatta/src-reader/entity" "github.com/google/uuid" ) // identifierMapper maps an Identifier between its model and database representations. type identifierMapper struct{} // fromTokenToString transforms a token.Token value into a human...
port/outgoing/adapter/repository/mongodb/identifier_mapper.go
0.640748
0.435121
identifier_mapper.go
starcoder
package ast import ( "github.com/botobag/artemis/graphql" "github.com/botobag/artemis/graphql/ast" ) // TypeResolver is an utility class which tries to resolve type for an AST nodes in a given schema. type TypeResolver struct { Schema graphql.Schema } // ResolveType determines Type for an ast.Type. func (resolver...
graphql/util/ast/type_resolver.go
0.638272
0.473962
type_resolver.go
starcoder
package config // PoolingType is a type of pooling, using runtime or mmap'd bytes pooling. type PoolingType string const ( // SimplePooling uses the basic Go runtime to allocate bytes for bytes pools. SimplePooling PoolingType = "simple" // NativePooling uses a mmap syscall to allocate bytes for bytes pools, take...
src/cmd/services/m3dbnode/config/pooling.go
0.829665
0.441191
pooling.go
starcoder
package geogoth // NewPoint create Point with given coordinates func NewPoint(coordinate []float64) *Geometry { return &Geometry{ Type: Point, Coordinates: coordinate, } } // GetPointCoordinates returns longitude, latitude of Point geom func GetPointCoordinates(feature *Feature) (float64, float64) { // ...
geojson/coordinates.go
0.896679
0.733523
coordinates.go
starcoder
package sarama import ( "fmt" "strings" "github.com/gogf/gkafka/third/github.com/rcrowley/go-metrics" ) // Use exponentially decaying reservoir for sampling histograms with the same defaults as the Java library: // 1028 elements, which offers a 99.9% confidence level with a 5% margin of error assuming a normal di...
third/github.com/Shopify/sarama/metrics.go
0.850267
0.40486
metrics.go
starcoder
package cmp import ( "fmt" "reflect" "github.com/go-spatial/geom" ) func IsEmptyPoint(pt [2]float64) bool { return pt != pt } func IsEmptyPoints(pts [][2]float64) bool { for _, v := range pts { if !IsEmptyPoint(v) { return false } } return true } func IsEmptyLines(lns [][][2]float64) bool { for _, ...
vendor/github.com/go-spatial/geom/cmp/empty.go
0.620737
0.513363
empty.go
starcoder
package types import ( "bytes" "context" "github.com/liquidata-inc/dolt/go/store/hash" ) type ValueCallback func(v Value) error type RefCallback func(ref Ref) error // Valuable is an interface from which a Value can be retrieved. type Valuable interface { // Kind is the NomsKind describing the kind of value th...
go/store/types/value.go
0.755727
0.555496
value.go
starcoder
package aac import ( "fmt" ) // ADTSPacket is an ADTS packet. type ADTSPacket struct { Type int SampleRate int ChannelCount int AU []byte } // DecodeADTS decodes an ADTS stream into ADTS packets. func DecodeADTS(buf []byte) ([]*ADTSPacket, error) { // refs: https://wiki.multimedia.cx/index....
pkg/aac/adts.go
0.607663
0.472075
adts.go
starcoder
package notification // Status describes the current state of an outgoing message. type Status struct { // State is the current state. State State // Details can contain any additional information about the State (e.g. "ringing", "no-answer" etc..). Details string // Sequence can be used when the provider send...
notification/status.go
0.567457
0.401101
status.go
starcoder
// util.go contains various utility functions. // Prefer the free-form functions to member functions. package board // Pawns return the set of pawns of the given color. func Pawns(pos *Position, us Color) Bitboard { return pos.ByPiece(us, Pawn) } // Knights return the set of knights of the given color. func Knight...
util.go
0.852322
0.725758
util.go
starcoder
package images import ( "bytes" "image" "image/jpeg" "image/png" "io" "strings" "github.com/nfnt/resize" ) /* IResizer is an interface to describe structs that resize images */ type IResizer interface { ResizeImage(source io.ReadSeeker, contentType string, imageSize ImageSize) (*bytes.Buffer, error) ResizeI...
images/Resizer.go
0.690768
0.408218
Resizer.go
starcoder
package iso20022 // Parameters applied to the settlement of a security transfer. type Transfer8 struct { // Unique and unambiguous identifier for a group of individual transfers as assigned by the instructing party. This identifier links the individual transfers together. MasterReference *Max35Text `xml:"MstrRef,om...
Transfer8.go
0.856212
0.413063
Transfer8.go
starcoder
package randxdr import ( "math" "regexp" "strings" goxdr "github.com/xdrpp/goxdr/xdr" ) // Selector is function used to match fields of a goxdr.XdrType type Selector func(string, goxdr.XdrType) bool // Setter is a function used to set field values for a goxdr.XdrType type Setter func(*randMarshaller, string, go...
randxdr/presets.go
0.657868
0.74158
presets.go
starcoder
package main import "fmt" // Point represents a point on cartesian plane type Point struct { x, y int } func (point Point) String() string { return fmt.Sprintf("(%v, %v)", point.x, point.y) } // PointWithDistance is a node that has two properties: // distance - square of euclidean distance from some reference p...
k-closest.go
0.85405
0.644812
k-closest.go
starcoder
package framework import ( "strings" "sigs.k8s.io/kustomize/kyaml/yaml" ) // Function defines a function which mutates or validates a collection of configuration // To create a structured validation result, return a Result as the error. type Function func(nodes []*yaml.RNode) ([]*yaml.RNode, error) // Result def...
kyaml/fn/framework/types.go
0.62223
0.417093
types.go
starcoder
package serialization import ( "github.com/lyraproj/puppet-evaluator/eval" "github.com/lyraproj/puppet-evaluator/types" ) // A Collector receives streaming events and produces an eval.Value type Collector interface { ValueConsumer // Value returns the created value. Must not be called until the consumption // o...
serialization/collector.go
0.714927
0.415907
collector.go
starcoder
package money import ( "fmt" "math/big" "strings" ) // Money represents a monetary value type Money struct { rat *big.Rat } // New creates a new instance with a zero value. func New() *Money { return &Money{ rat: big.NewRat(0, 1), } } // NewFromCents creates a new instance with a cents value. func NewFromCe...
money.go
0.871105
0.572842
money.go
starcoder
package eff import ( "errors" "math" "math/rand" "strconv" ) const ( // Version current semantic version of eff Version = "0.4.8" ) // Point container for 2d points type Point struct { X int Y int } // Scale returns a new scaled point func (p *Point) Scale(s float64) Point { return Point{ X: int(float64...
eff.go
0.886936
0.461866
eff.go
starcoder
package msgraph // RatingFranceMoviesType undocumented type RatingFranceMoviesType int const ( // RatingFranceMoviesTypeVAllAllowed undocumented RatingFranceMoviesTypeVAllAllowed RatingFranceMoviesType = 0 // RatingFranceMoviesTypeVAllBlocked undocumented RatingFranceMoviesTypeVAllBlocked RatingFranceMoviesType ...
v1.0/RatingFranceMoviesTypeEnum.go
0.582016
0.499146
RatingFranceMoviesTypeEnum.go
starcoder
package cmd var example = ` The following examples make use of a basic.json file which contains JSON logs where each log line is a single JSON object. You can find the basic.json file in ./cmd/fixture/ along with other test fixtures used for golden file tests. Further note that you can configure flag de...
cmd/example.go
0.687945
0.525978
example.go
starcoder
package retrieval import ( "context" "math" "github.com/go-kit/kit/log" "github.com/go-kit/kit/log/level" promlabels "github.com/prometheus/prometheus/pkg/labels" "github.com/prometheus/tsdb/labels" "go.opencensus.io/stats" "go.opencensus.io/stats/view" ) // CounterAggregator provides the 'aggregated counte...
retrieval/aggregator.go
0.742795
0.456652
aggregator.go
starcoder
package actionlint import ( "fmt" "strconv" "strings" "gopkg.in/yaml.v3" ) // Pos represents position in the file. type Pos struct { // Line is a line number of the position. This value is 1-based. Line int // Col is a column number of the position. This value is 1-based. Col int } func (p *Pos) String() st...
ast.go
0.778313
0.437643
ast.go
starcoder
package policies import ( "fmt" cb "github.com/hyperledger/fabric-protos-go/common" "github.com/pkg/errors" ) // remap explores the policy tree depth first and remaps the "signed by" // entries according to the remapping rules; a "signed by" rule requires // a signature from a principal given its position in the ...
common/policies/convert.go
0.722135
0.446133
convert.go
starcoder
package benchmark import ( "reflect" "testing" ) func isBoolToInt16FuncCalibrated(supplier func() bool) bool { return isCalibrated(reflect.Bool, reflect.Int16, reflect.ValueOf(supplier).Pointer()) } func isIntToInt16FuncCalibrated(supplier func() int) bool { return isCalibrated(reflect.Int, reflect.Int16, reflec...
common/benchmark/04_to_int16_func.go
0.692122
0.769145
04_to_int16_func.go
starcoder
package big import ( "bytes" "fmt" "math/big" "regexp" "strconv" "strings" "github.com/golang-plus/errors" ) var ( // max decimal digits allowd for indivisible quotient (exceeding be truncated). MaxDecimalDigits = uint(200) ) // Decimal represents a decimal which can handing fixed precision. type Decimal s...
big/decimal.go
0.774114
0.429728
decimal.go
starcoder
package gcast import ( "errors" "fmt" "reflect" "strconv" "strings" ) var ( // ErrUnaddressable unaddressable val ErrUnaddressable = errors.New("val must be addressable") // ErrNotPointer pinter val ErrNotPointer = errors.New("val must be a pointer") ) // Decode decode interface into struct func Decode(src ...
decode.go
0.623377
0.426799
decode.go
starcoder
package rke import "github.com/hashicorp/terraform/helper/schema" func nodeSchema() map[string]*schema.Schema { return map[string]*schema.Schema{ "node_name": { Type: schema.TypeString, Optional: true, Computed: true, Description: "Name of the host provisioned via docker machine", }, "...
rke/node_schema.go
0.584745
0.434821
node_schema.go
starcoder
package palette import ( "github.com/Lexus123/gamut" colorful "github.com/lucasb-eyer/go-colorful" ) func init() { Crayola.AddColors( gamut.Colors{ {"Red", colorful.Color{R: 0.929412, G: 0.039216, B: 0.247059}, ""}, {"Maroon", colorful.Color{R: 0.764706, G: 0.129412, B: 0.282353}, ""}, {"Scarlet", color...
palette/crayola.go
0.60964
0.578389
crayola.go
starcoder
package sobel import ( "decompose/layer" "math" ) type Sobel struct { XKernel [][]float64 YKernel [][]float64 Crop float64 MinCrop float64 MaxCrop float64 MergeFunc func(uint, float64, float64) float64 } func With33Kernel() *Sobel { return &Sobel{ XKernel: [][]float64{ {-1, 0, 1}, {-2, ...
labo-3/decompose/sobel/sobel.go
0.596551
0.441312
sobel.go
starcoder
package main import ( "github.com/ByteArena/box2d" "github.com/wdevore/Ranger-Go-IGE/api" "github.com/wdevore/Ranger-Go-IGE/extras/shapes" ) type boxPhysicsComponent struct { physicsComponent } func newBoxPhysicsComponent() *boxPhysicsComponent { o := new(boxPhysicsComponent) return o } // EnableGravity enabl...
examples/complex/physics/basic/p2_linear_impulses/box_physics_component.go
0.734786
0.551453
box_physics_component.go
starcoder
package sweetiebot import ( "fmt" "strconv" "strings" "time" "github.com/bwmarrin/discordgo" ) type UsersModule struct { } func (w *UsersModule) Name() string { return "Users" } func (w *UsersModule) Register(info *GuildInfo) {} func (w *UsersModule) Commands() []Command { return []Command{ &NewUsersComm...
sweetiebot/users_command.go
0.57332
0.46873
users_command.go
starcoder
package samples import ( "fmt" sll "github.com/emirpasic/gods/lists/singlylinkedlist" ) // Samples is a fixed size array scaled to the length of the simulation. // The graph scans and renders the array. // The sim populates the array based on a moving index. // Samples is a 2D list of samples for synapses type Sa...
simulation/samples/samples.go
0.669637
0.437343
samples.go
starcoder
package rect import ( "errors" "image" "image/color" "gitlab.com/256/Underbot/cv/object" ) // CenterColor gets the color of the pixel in the middle of an image func CenterColor(tmpImg image.Image) (color.Color, error) { // Gets the underlying type of RGBA which supports At() img, ok := tmpImg.(*image.RGBA) if...
cv/rect/rect.go
0.78316
0.577287
rect.go
starcoder
package pinapi import ( "encoding/json" ) // GetBetsByTypeResponseV3 struct for GetBetsByTypeResponseV3 type GetBetsByTypeResponseV3 struct { // Whether there are more pages available. MoreAvailable *bool `json:"moreAvailable,omitempty"` // Page size. Default is 1000. PageSize *int `json:"pageSize,omitempty"` /...
pinapi/model_get_bets_by_type_response_v3.go
0.749546
0.409103
model_get_bets_by_type_response_v3.go
starcoder
package index import ( "bytes" "errors" "github.com/asdine/genji/engine" ) const ( separator byte = 0x1E ) var ( // ErrDuplicate is returned when a value is already associated with a key ErrDuplicate = errors.New("duplicate") ) // An Index associates encoded values with keys. // It is sorted by value followi...
index/index.go
0.710126
0.46308
index.go
starcoder
package runtime import "strings" // NumberType represents a type of number type NumberType uint16 const ( // IsFloat is the type of Floats IsFloat NumberType = 1 << iota // IsInt is the type of Ints IsInt // NaN is the type of values which are not numbers NaN // NaI is a type for values which a not Ints NaI ...
runtime/numconv.go
0.748444
0.445107
numconv.go
starcoder
package colour import ( "image/color" "math" ) type Colour struct { R float64 `json:"r"` G float64 `json:"g"` B float64 `json:"b"` } func NewColourFromRGB(rgb uint32) Colour { r := (rgb & 0xff0000) >> 16 g := (rgb & 0x00ff00) >> 8 b := (rgb & 0x0000ff) return Colour{ R: float64(r) / 0xff, G: float64(g) ...
colour/colour.go
0.81604
0.463748
colour.go
starcoder
// Taken from src/crypto/rsa/rsa.go package server import ( "crypto/rand" "crypto/rsa" "io" "math/big" ) var bigZero = big.NewInt(0) var bigOne = big.NewInt(1) // modInverse returns ia, the inverse of a in the multiplicative group of prime // order n. It requires that a be a member of the group (i.e. less than...
server/rsa_raw.go
0.539226
0.457621
rsa_raw.go
starcoder
package ast type keyType BasicType const ( MixedKey = String | Integer StringKey = String IntegerKey = Integer ) // ArrayType is an array type type ArrayType struct { KeyType keyType ValueType Type } // BasicType is a basic type type BasicType int const ( Invalid BasicType = iota String Integer Float...
ast/types.go
0.832441
0.475788
types.go
starcoder
package maptile import ( "math" "sync" "github.com/go-courier/geography/encoding/mvt" "github.com/go-courier/geography" ) func NewMapTile(z, x, y uint32) *MapTile { return &MapTile{ Z: z, X: x, Y: y, } } type MapTile struct { coordsTransform CoordsTransform Z uint32 X uin...
maptile/tile.go
0.627609
0.564519
tile.go
starcoder
package main import "strconv" // Device is the representation of the wrist device type Device [4]int func (d Device) isEqual(other Device) bool { for i, value := range d { if other[i] != value { return false } } return true } func initDevice(strslice []string) Device { result := Device{} for i := 0; i <...
2018/16_2/device.go
0.731826
0.443721
device.go
starcoder
package main import ( "fmt" "math/rand" "os" "path" "github.com/YadaYuki/deeplearning-golang/mnist" "github.com/YadaYuki/deeplearning-golang/model" "github.com/YadaYuki/deeplearning-golang/utils" "github.com/vorduin/nune" ) func getBatchData[T nune.Number](idxes []int, data nune.Tensor[T]) nune.Tensor[T] { ...
main.go
0.615781
0.460713
main.go
starcoder
package fpe import ( "encoding/binary" "math/bits" ) // A BlockCipher represents an implementation of block cipher using a given key. type BlockCipher interface { // BlockSize returns the cipher's block size. BlockSize() int // Encrypt encrypts the first block in src into dst. // Dst and src must overlap entir...
vendor/gitlab.com/starius/fpe/fpe.go
0.772015
0.511168
fpe.go
starcoder
package validator // MessageMap is a map of string, that can be used as error message for ValidateStruct function. var MessageMap = map[string]string{ "accepted": "The {{.Attribute}} must be accepted.", "activeUrl": "The {{.Attribute}} is not a valid URL.", "after": "The {{.Attribute...
message.go
0.699665
0.564819
message.go
starcoder
package parser // A Visitor's Visit method is invoked for each node encountered by Walk. // If the result visitor w is not nil, Walk visits each of the children // of node with the visitor w, followed by a call of w.Visit(nil). type Visitor interface { Visit(node Node) (w Visitor) } // Walk traverses an CST in depth...
parser/walk.go
0.674372
0.428951
walk.go
starcoder
package test_version1 import ( "testing" "github.com/pip-services-users/pip-clients-sessions-go/version1" "github.com/pip-services3-go/pip-services3-commons-go/data" "github.com/stretchr/testify/assert" ) type SessionsClientFixtureV1 struct { Client version1.ISessionsClientV1 } func NewSessionsClientFixtureV1(...
test/version1/SessionsClientFixtureV1.go
0.580114
0.406921
SessionsClientFixtureV1.go
starcoder
package main import ( "fmt" "github.com/404Polaris/RayTracing-go/pkg/camera" "github.com/404Polaris/RayTracing-go/pkg/geometry" "github.com/404Polaris/RayTracing-go/pkg/material" "github.com/404Polaris/RayTracing-go/pkg/mathplus" "github.com/404Polaris/RayTracing-go/pkg/scene" "image" "image/color" "image/png...
cmd/main.go
0.639849
0.460168
main.go
starcoder
package dackbox import ( "github.com/pkg/errors" "github.com/stackrox/rox/pkg/dbhelper" ) // Path represents path to go from one idspace to another type Path struct { Path [][]byte ForwardTraversal bool } // ForwardPath returns a forward path over the given elements. func ForwardPath(elems ...[]byte)...
pkg/dackbox/path.go
0.871543
0.457985
path.go
starcoder
package props import "github.com/madnikulin50/maroto/pkg/consts" // Proportion represents a proportion from a rectangle, example: 16x9, 4x3... type Proportion struct { // Width from the rectangle: Barcode, image and etc Width float64 // Height from the rectangle: Barcode, image and etc Height float64 } // Barcod...
pkg/props/prop.go
0.718496
0.644784
prop.go
starcoder
package types import ( "bytes" "github.com/attic-labs/noms/go/d" "github.com/attic-labs/noms/go/hash" ) type leafSequence struct { vrw ValueReadWriter buff []byte offsets []uint32 } func newLeafSequence(kind NomsKind, count uint64, vrw ValueReadWriter, vs ...Value) leafSequence { d.PanicIfTrue(vrw ==...
go/types/leaf_sequence.go
0.74382
0.48438
leaf_sequence.go
starcoder
package helpers import ( "net/url" "strings" "testing" "github.com/stretchr/testify/assert" ) // Custom URL matcher for outgoing pubnub server requests func UrlsEqual(expectedString, actualString string, ignoreKeys, mixedKeys []string) (bool, error) { expected, err := url.Parse(expectedString) if err != nil {...
tests/helpers/url_helpers.go
0.725162
0.435421
url_helpers.go
starcoder
package main import ( "fmt" "math" "io/ioutil" "encoding/json" "github.com/go-gl/gl/v4.1-core/gl" "github.com/go-gl/mathgl/mgl32" ) // Object Maps a generic object type Object struct { Name string Type string // {sphere|circle|circle-filled} Radius float32 // Kilometers ...
object.go
0.763396
0.404155
object.go
starcoder
package main import ( "fmt" "math/rand" "sort" "gonum.org/v1/plot" "gonum.org/v1/plot/plotter" "gonum.org/v1/plot/vg" "gonum.org/v1/plot/vg/draw" "github.com/pointlander/gradient/tf32" ) // XORNetwork is an xor neural network type XORNetwork struct { Input, Output *tf32.V Parameters []*tf32.V Genome ...
experiment_xor.go
0.643329
0.421195
experiment_xor.go
starcoder
package aws const ecsDescription = `Connects to one or more ECS clusters and updates API Clusters stored with the Turbine Labs API at startup and periodically thereafter. Within ECS, items are marked as Turbine Labs Cluster members through the use of a configurable Docker label (defaulting to ` + ecsDefaultClusterTag...
plugins/aws/ecs_helptext.go
0.852675
0.521593
ecs_helptext.go
starcoder
package runtime import "unsafe" // This garbage collector implementation allows TinyGo to use an external memory allocator. // It appends a header to the end of every allocation which the garbage collector uses for tracking purposes. // This is also a conservative collector. const ( gcDebug = false gcAsserts = ...
src/runtime/gc_extalloc.go
0.71103
0.487063
gc_extalloc.go
starcoder
package array import ( "reflect" ) // InMap check index in Map func InMap(needle string, haystack []string) bool { newStack := map[string]struct{}{} for _, val := range haystack { newStack[val] = struct{}{} } if _, ok := newStack[needle]; ok { return true } return false } // InSlice check index in slice...
array/array.go
0.632162
0.445831
array.go
starcoder
package grumpy var ( // ArithmeticErrorType corresponds to the Python type 'ArithmeticError'. ArithmeticErrorType = newSimpleType("ArithmeticError", StandardErrorType) // AssertionErrorType corresponds to the Python type 'AssertionError'. AssertionErrorType = newSimpleType("AssertionError", StandardErrorType) //...
runtime/exceptions.go
0.610918
0.470919
exceptions.go
starcoder
package geom import ( "log" "github.com/badu/term" "github.com/badu/term/style" ) // RootRectangle interface type RootRectangle interface { Orientation() style.Orientation HasRows() bool NumRows() int Rows() PixelsMatrix Row(index int) Pixels HasColumns() bool NumColumns() int Columns() PixelsMatrix Colu...
geom/root_rectangle.go
0.751466
0.512327
root_rectangle.go
starcoder
package search_query_injection import ( "github.com/threagile/threagile/model" ) func Category() model.RiskCategory { return model.RiskCategory{ Id: "search-query-injection", Title: "Search-Query Injection", Description: "When a search engine server is accessed Search-Query Injection risks might arise." + ...
risks/built-in/search-query-injection/search-query-injection-rule.go
0.773045
0.522019
search-query-injection-rule.go
starcoder
Simplifying and Isolating Failure-Inducing Input <NAME> (2002) https://www.st.cs.uni-saarland.de/papers/tse2002/tse2002.pdf */ package quickcheck type result int const ( // Pass indicates the test passed ddPass result = iota // Fail indicates the expected test failure was produced ddFail // Unresolved ind...
ddmin.go
0.640411
0.519156
ddmin.go
starcoder
package collections //-------------------- // IMPORTS //-------------------- import ( "fmt" "github.com/tideland/golib/errors" ) //-------------------- // STACK //-------------------- // stack implements the Stack interface. type stack struct { values []interface{} } // NewStack creates a stack with the passe...
vendor/github.com/tideland/golib/collections/stacks.go
0.710126
0.466967
stacks.go
starcoder
package v1beta1 import ( v1beta1 "github.com/kubeless/kinesis-trigger/pkg/apis/kubeless/v1beta1" "k8s.io/apimachinery/pkg/api/errors" "k8s.io/apimachinery/pkg/labels" "k8s.io/client-go/tools/cache" ) // KinesisTriggerLister helps list KinesisTriggers. type KinesisTriggerLister interface { // List lists all Kine...
pkg/client/listers/kubeless/v1beta1/kinesistrigger.go
0.609408
0.425367
kinesistrigger.go
starcoder
package fn import ( mat "github.com/nlpodyssey/spago/pkg/mat32" "github.com/nlpodyssey/spago/pkg/mat32/floatutils" matsort "github.com/nlpodyssey/spago/pkg/mat32/sort" "sort" ) // SparseMax function implementation, based on https://github.com/gokceneraslan/SparseMax.torch type SparseMax struct { x Operand y ma...
pkg/ml/ag/fn/sparsemax.go
0.74382
0.463444
sparsemax.go
starcoder
package main import ( "fmt" dataframe "github.com/rocketlaunchr/dataframe-go" ) type Stock struct { price float64 shares float64 mfee float64 end float64 steps float64 } func first_transaction(price float64, shares float64) []float64{ var principal float64 = shares * price var margin_amount float64 =...
Markets/Go/short.go
0.537041
0.450601
short.go
starcoder
package typ import ( "fmt" "xelf.org/xelf/cor" "xelf.org/xelf/knd" ) // Select reads path and returns the selected type from t or an error. func Select(t Type, path string) (Type, error) { p, err := cor.ParsePath(path) if err != nil { return Void, err } return SelectPath(t, p) } // SelectPath returns the s...
typ/path.go
0.500732
0.415314
path.go
starcoder
package blocks import ( "fmt" "regexp" "strings" yamlv3 "gopkg.in/yaml.v3" core "github.com/authzed/spicedb/pkg/proto/core/v1" "github.com/authzed/spicedb/pkg/commonerrors" "github.com/authzed/spicedb/pkg/tuple" ) // ParsedExpectedRelations represents the expected relations defined in the validation // file...
pkg/validationfile/blocks/expectedrelations.go
0.780662
0.439447
expectedrelations.go
starcoder
package onshape import ( "encoding/json" ) // BTExportTessellatedFacesFacet1417 struct for BTExportTessellatedFacesFacet1417 type BTExportTessellatedFacesFacet1417 struct { BtType *string `json:"btType,omitempty"` Indices *[]int32 `json:"indices,omitempty"` Normal *BTVector3d389 `json:"normal,omitempty"` Normals...
onshape/model_bt_export_tessellated_faces_facet_1417.go
0.752468
0.437763
model_bt_export_tessellated_faces_facet_1417.go
starcoder
// Package frames describes the Frame interface. // A set of standard frames are also defined in this package. These are: Fixed, Window, Wild and WildMin. package frames import ( "strconv" "github.com/richardlehane/siegfried/internal/bytematcher/patterns" "github.com/richardlehane/siegfried/internal/persist" ) /...
internal/bytematcher/frames/frames.go
0.802362
0.46873
frames.go
starcoder
package mingo // Object model type Object map[string]interface{} // Query model type Query struct { Criteria Object compiled []func(Object) bool } // Test method evaluates the query by processing the expression's operators. func (q *Query) Test(obj Object) bool { q.compile() for _, v := range q.compiled { if ...
query.go
0.647352
0.407923
query.go
starcoder
package types import ( "github.com/benbjohnson/immutable" ) var emptyMap = immutable.NewSortedMap(nil) var EmptyTypeMap = TypeMap{emptyMap} // TypeMap contains immutable mappings from labels to immutable lists of types. type TypeMap struct { m *immutable.SortedMap } func NewTypeMap() TypeMap { return TypeMap{em...
types/type_map.go
0.774924
0.588948
type_map.go
starcoder
package display import ( "fmt" "github.com/inkyblackness/shocked-model" "github.com/inkyblackness/shocked-client/graphics" "github.com/inkyblackness/shocked-client/opengl" ) var mapTileGridVertexShaderSource = ` #version 150 precision mediump float; in vec3 vertexPosition; uniform mat4 viewMatrix; uniform mat...
src/github.com/inkyblackness/shocked-client/editor/display/TileGridMapRenderable.go
0.750004
0.491883
TileGridMapRenderable.go
starcoder
package factory import ( "reflect" ) // Factory represents a factory defined by some model struct type Factory struct { ModelType reflect.Type Table string FiledValues map[string]interface{} SequenceFiledValues map[string]*sequenceValue DynamicFieldValues map[stri...
factory.go
0.807309
0.411702
factory.go
starcoder
package esi import ( "math" "github.com/gonum/floats" "github.com/gonum/stat" "github.com/evepraisal/go-evepraisal" ) func nanToZero(f float64) float64 { if math.IsNaN(f) { return 0 } return f } func getPriceAggregatesForOrders(orders []MarketOrder) evepraisal.Prices { var prices evepraisal.Prices buyPr...
esi/price_aggregates.go
0.566019
0.623635
price_aggregates.go
starcoder
package jsonlogic import ( "math" "strconv" ) type opAdd struct{} type opSub struct{} type opMul struct{} type opDiv struct{} type opMod struct{} type opGreater struct{} type opGreaterEqual struct{} type opLess struct{} type opLessEqual struct{} type opMax struct{} type opMin struct{} func getFloatNumber(v interfa...
op_numeric.go
0.558568
0.467879
op_numeric.go
starcoder
package water import ( "github.com/willbeason/worldproc/pkg/geodesic" "math" "sort" ) type IndexHeight struct { Index int Height float64 Water float64 } type Lake struct { // IndexHeights is the set of Geodesic indices this lake contains and how // much water they contain. IndexHeights []IndexHeight // W...
pkg/water/equalize.go
0.623721
0.489259
equalize.go
starcoder
package plot import ( "fmt" "io" "os" "strings" ) // Target for chart rendering. Defaults to standard output. var chartWriter io.Writer = os.Stdout // Plotable defines an interface for object which can be represented on a chart. type Plotable interface { // GetX() float64 GetY() float64 GetLabel() string } /...
plot.go
0.630799
0.403537
plot.go
starcoder
package pcm import ( "fmt" "io" ) var _ Reader = &IOReader{} // A Reader mimics io.Reader for pcm data. type Reader interface { Formatted ReadPCM(b []byte) (n int, err error) } // An IOReader converts an io.Reader into a pcm.Reader type IOReader struct { Format io.Reader } func (ior *IOReader) ReadPCM(p []by...
audio/pcm/interface.go
0.542379
0.400632
interface.go
starcoder
package xsort // MergeAndUints computes intersection of ids list. func MergeAndUints(ids ...[]uint32) []uint32 { if len(ids) == 0 { return nil } else if len(ids) == 1 { return ids[0] } // Find out the shortest list. shortest := 0 for i := 1; i < len(ids); i++ { if len(ids[i]) < len(ids[shortest]) { sho...
xsort/merge_xsort.go
0.630912
0.526586
merge_xsort.go
starcoder
package model import ( "strings" ) // A Rola represents a song, it contains the information present in // various frames from the id3v2 tag, namely, artist, title, album // track number, year, genre, and additionally, the path of the song // file, and the id assigned by the database to the song. type Rola struct { ...
pkg/model/rola.go
0.810366
0.449997
rola.go
starcoder
package main /* Day 6, part A Given a set of memory banks, each having a number of blocks stored in them, go through in turn to rebalance the banks by: Zero out the largest bank, saving the number of blocks. Starting with the next bank, deposit one block at a time, circling around to banks until all the blocks are go...
2017/day06.go
0.558327
0.47993
day06.go
starcoder
package input import ( "github.com/Jeffail/benthos/v3/internal/docs" "github.com/Jeffail/benthos/v3/lib/log" "github.com/Jeffail/benthos/v3/lib/metrics" "github.com/Jeffail/benthos/v3/lib/types" ) func init() { Constructors[TypeAzureQueueStorage] = TypeSpec{ constructor: fromSimpleConstructor(func(conf Config,...
lib/input/azure_queue_storage_config.go
0.735831
0.649801
azure_queue_storage_config.go
starcoder
package tree import ( "fmt" ) const ( MAX_OBJECTS = 12 MAX_LEVELS = 5 ) const ( TOP_LEFT = iota TOP_RIGHT BOTTOM_LEFT BOTTOM_RIGHT ) type QuadTree struct { bounds *Rectangle objects []*Rectangle nodes map[int]*QuadTree level int } // NewQuadTree creates a new quad tree at level pLevel and bounds f...
quadtree.go
0.627837
0.438966
quadtree.go
starcoder
package types import ( "bytes" "encoding/binary" "encoding/hex" "fmt" "github.com/MinterTeam/minter-go-node/hexutil" "github.com/tendermint/tendermint/crypto/ed25519" "math/big" "math/rand" "reflect" "strconv" "strings" ) // Types lengths const ( HashLength = 32 AddressLength = 20 ...
coreV2/types/types.go
0.814938
0.458894
types.go
starcoder
package result import ( "errors" "fmt" ) // Result is a type that represents either success (T) or failure (error). type Result[T any] struct { ok T err error } func Wrap[T any](some T, err error) Result[T] { if err != nil { return Err[T](err) } return Ok(some) } func Ok[T any](ok T) Result[T] { return R...
result.go
0.762689
0.548613
result.go
starcoder
package process import "fmt" // ChildrenIDs returns the list of node IDs with a dependency to the current node func (g Process) ChildrenKeys(nodeKey string) []string { nodeKeys := make([]string, 0) for _, edge := range g.EdgesFrom(nodeKey) { nodeKeys = append(nodeKeys, edge.Dst) } return nodeKeys } // ParentID...
process/graph.go
0.554953
0.556761
graph.go
starcoder
package main import ( "github.com/otyg/threagile/model" "github.com/otyg/threagile/model/confidentiality" "github.com/otyg/threagile/model/criticality" ) type missingMonitoring string var RiskRule missingMonitoring func (r missingMonitoring) Category() model.RiskCategory { return model.RiskCategory{ Id: ...
risks/missing-monitoring/missing-monitoring-rule.go
0.663887
0.457379
missing-monitoring-rule.go
starcoder
package types import ( "encoding/binary" "fmt" "math/big" "github.com/ethereum/go-ethereum/common/hexutil" "github.com/ethereum/go-ethereum/crypto" ) type bytesBacked interface { Bytes() []byte } const ( // BloomByteLength represents the number of bytes used in a header log bloom. BloomByteLength = 256 /...
ethereum_pack/core/types/bloom9.go
0.792585
0.538194
bloom9.go
starcoder
package main import ( "bytes" "errors" "github.com/michaelcmartin/tiledither/dither" "image" "image/color" "sort" ) type c64bmp struct { src image.Image pixmap [][]int palettes [][]color.Palette bg int } func newC64bmp(w, h int) *c64bmp { bmp := new(c64bmp) matrix := make([][]int, w) buf :=...
c64mcbmp.go
0.502686
0.417984
c64mcbmp.go
starcoder