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 aoc2020 /* --- Day 17: Conway Cubes --- Part 2 For some reason, your simulated results don't match what the experimental energy source engineers expected. Apparently, the pocket dimension actually has four spatial dimensions, not three. The pocket dimension contains an infinite 4-dimensional grid. At every ...
app/aoc2020/aoc2020_17_part2.go
0.835215
0.819749
aoc2020_17_part2.go
starcoder
package main import ( "errors" f "fmt" "math" ) func Interfaces() { f.Println("********** Interfaces **********") r := rectangle{width: 3, height: 4} c := circle{radius: 5} t := triangle{sideA: 3, sideB: 4, sideC: 5} rImpossible := rectangle{width: 3, height: -4} cImpossible := circle{radius: -5} tImpossi...
08_interfaces.go
0.730963
0.403684
08_interfaces.go
starcoder
package ksdc type tBigram struct { firstRune rune secondRune rune } func createBigrams(word string) (map[tBigram]int, int, string) { bigrams := make(map[tBigram]int) runes := []rune(word) runesCount := len(runes) - 1 for index := 0; index < runesCount; index++ { bigrams[tBigram{firstRune: runes[index], sec...
ksdc.go
0.765506
0.548492
ksdc.go
starcoder
package graph import ( i04eb5309aeaafadd28374d79c8471df9b267510b4dc2e3144c378c50f6fd7b55 "github.com/microsoft/kiota/abstractions/go/serialization" ) // WorkbookWorksheetProtectionOptions type WorkbookWorksheetProtectionOptions struct { // Stores additional data not described in the OpenAPI description found...
models/microsoft/graph/workbook_worksheet_protection_options.go
0.687735
0.421433
workbook_worksheet_protection_options.go
starcoder
package main /* A triplet is an array of three integers. You are given a 2D integer array triplets, where triplets[i] = [ai, bi, ci] describes the ith triplet. You are also given an integer array target = [x, y, z] that describes the triplet you want to obtain. To obtain target, you may apply the following operation ...
golang/algorithms/others/merge_triplets_to_form_target_triplet/main.go
0.76769
0.820972
main.go
starcoder
package day06 import ( "errors" "fmt" "strings" ) const ( youID = "YOU" santaID = "SAN" ) // orbitalRelationship reads as "satellite is in orbit around parent" or "satellite orbits parent" type orbitalRelationship struct { parent string satellite string } type orbitMap struct { orbitalRelationships []o...
day06/day06.go
0.716417
0.425009
day06.go
starcoder
package list import "github.com/jesseduffield/generics/slices" // List is a struct which wraps a slice and provides convenience methods for it. // Unfortunately due to some limitations in Go's type system, certain methods // are not available e.g. Map. type List[T any] struct { slice []T } func New[T any]() *List[...
list/list.go
0.789356
0.587322
list.go
starcoder
package colorlab import ( "github.com/lucasb-eyer/go-colorful" ) // Accents . type Accents struct { Yellow HexColor Orange HexColor Red HexColor Magenta HexColor Violet HexColor Blue HexColor Cyan HexColor Green HexColor } type AccentColors [8]colorful.Color func NewAccents(cc [8]colorful.Co...
accents.go
0.693577
0.460046
accents.go
starcoder
package spirv // OpDPdx is equivalent to either OpDPdxFine or OpDPdxCoarse on P. // Selection of which one is based on external factors. type OpDPdx struct { ResultType Id ResultId Id P Id } func (c *OpDPdx) Opcode() uint32 { return opcodeDPdx } func (c *OpDPdx) Optional() bool { return false } func (c...
instructions_derivative.go
0.827515
0.442094
instructions_derivative.go
starcoder
package primitives import ( "github.com/alexandreLamarre/Golang-Ray-Tracing-Renderer/pkg/algebra" "github.com/alexandreLamarre/Golang-Ray-Tracing-Renderer/pkg/canvas" "math" ) //Cylinder defines a default cylinder Shape type Cylinder struct { parent Shape closed bool //determines if the cylinder is hollow ...
pkg/geometry/primitives/cylinder.go
0.846229
0.473292
cylinder.go
starcoder
package bmp280 import ( "fmt" "math" "periph.io/x/periph/conn/i2c" ) // BMP a BMP280 sensor type BMP struct { device *i2c.Dev config *Configuration lastTemperatureMeasurement float64 tempCalibration []calibrationData pressCalibration []calibrationD...
bmp.go
0.667906
0.428293
bmp.go
starcoder
package image // All Colors can convert themselves, with a possible loss of precision, // to 64-bit alpha-premultiplied RGBA. Each channel value ranges within // [0, 0xFFFF]. type Color interface { RGBA() (r, g, b, a uint32) } // An RGBAColor represents a traditional 32-bit alpha-premultiplied color, // having 8 bi...
src/pkg/image/color.go
0.901374
0.615695
color.go
starcoder
package app import ( "errors" "fmt" "time" ) func GetCharacter(today time.Time, config FestojiConfig) (string, error) { for _, rule := range config.Rules { var end time.Time month := time.Month(rule.Month) if rule.Day != 0 { end = GetEndOfDay(today, month, rule.Da...
app/app.go
0.684475
0.414603
app.go
starcoder
package bulletproof import ( "github.com/gtank/merlin" "github.com/pkg/errors" "github.com/coinbase/kryptology/pkg/core/curves" ) // RangeVerifier is the struct used to verify RangeProofs // It specifies which curve to use and holds precomputed generators // See NewRangeVerifier() for verifier initialization. typ...
pkg/bulletproof/range_verifier.go
0.821474
0.457621
range_verifier.go
starcoder
package gridlocator import ( "math" "strconv" "strings" "github.com/pkg/errors" ) // Convert converts the specified decimanl longitude and latitude into the six // digit Maidenhead grid locator. func Convert(latitude, longitude float64) (string, error) { lat := latitude + 90 lng := longitude + 180 // Field ...
grid.go
0.685107
0.434701
grid.go
starcoder
package state import "strings" // ASCIIToLower is a casemapping helper which will lowercase a rune as // described by the "ascii" CASEMAPPING setting. func ASCIIToLower(r rune) rune { // "ascii": The ASCII characters 97 to 122 (decimal) are // defined as the lower-case characters of ASCII 65 to 90 // (decimal). N...
casemapping.go
0.644113
0.451689
casemapping.go
starcoder
package rtp // Convenience functions for dealing with RTP packet formats. For example, the // first byte of the RTP packet header: // 0 1 2 3 4 5 6 7 // +-+-+-+-+-+-+-+-+ // |V=2|P|X| CC | // +-+-+-+-+-+-+-+-+ // can be parsed with // V, P, X, CC := splitByte2114(header[0]) // and put back together with /...
internal/rtp/util.go
0.683736
0.628037
util.go
starcoder
package game import ( "errors" "fmt" ) // gridSize standard tic-tac-toe sized grid (demonstrates Go constants) const gridSize int = 3 // *Row are navegational indexes within Grid const ( topRow = iota midRow botRow ) // *Column are navegational indexes within Grid (demonstrates Go enums) const ( leftColumn = ...
tictactoe/game/grid.go
0.793066
0.517754
grid.go
starcoder
package isodates import ( "errors" "time" ) // ParseMonthDay accepts an ISO-formatted month/day string (e.g. "--04-01" is April, 1) and returns the // month and day that it represents. func ParseMonthDay(input string) (time.Month, int, error) { var monthText, dayText string inputLength := len(input) switch { /...
month_day.go
0.75985
0.51879
month_day.go
starcoder
package Projector import ( "image" "image/color" ) type Sampler2D struct { numChannels int stride int pixData []byte } func MakeSampler2D(img image.Image) *Sampler2D { o := &Sampler2D{} switch v := img.(type) { case *image.RGBA: o.numChannels = 4 o.pixData = v.Pix o.stride = v.Stride case *i...
ImageProcessor/Projector/Sampler.go
0.760206
0.542015
Sampler.go
starcoder
package main import ( "fmt" "path/filepath" "github.com/derWhity/AdventOfCode/lib/input" ) // grid represents a 3-dimensional grid of cube states type grid map[int]map[int]map[int]map[int]bool func (g grid) set(x, y, z, w int, val bool) { yGrid, ok := g[x] if !ok { yGrid = map[int]map[int]map[int]bool{} g[...
2020/day_17/star_02/main.go
0.546496
0.48688
main.go
starcoder
package precond import ( "errors" "fmt" "strconv" ) // IllegalArgumentError indicates that a function has been passed an illegal or inappropriate argument. type IllegalArgumentError struct { msg string } func (e *IllegalArgumentError) Error() string { return e.msg } // IllegalStateError signals that a function...
base/precond/preconditions.go
0.818011
0.448366
preconditions.go
starcoder
package segtree import ( "math/bits" "strconv" "strings" ) // TreeFn is an associative operation we would like to maintain results for in the segment tree. // Associative means: f(f(x, y), z) = f(x, f(y, z)). // An example for the sum calculation: func(i, j int) int { return i + j }. type TreeFn func(val1, val2 in...
internal/segtree/segtree.go
0.784608
0.516047
segtree.go
starcoder
package datatype import "fmt" type typeGroup int //go:generate stringer -type=typeGroup const ( GroupBare typeGroup = iota GroupLength GroupWeight GroupTemperature GroupVolume GroupTime GroupCurrency GroupDataSize ) // ConvFunc - function that converts in value to out float. Specific for each datatype pair ...
frontend/core/datatype/datatype.go
0.620622
0.402069
datatype.go
starcoder
package mist import ( "encoding/gob" "math" "github.com/nlpodyssey/spago/ag" "github.com/nlpodyssey/spago/mat" "github.com/nlpodyssey/spago/mat/float" "github.com/nlpodyssey/spago/nn" ) var _ nn.Model = &Model{} // Model contains the serializable parameters. type Model struct { nn.Module Wx nn.Para...
nn/recurrent/mist/mist.go
0.856902
0.422981
mist.go
starcoder
package main import ( "fmt" "image" "image/color" "math" ) // Lab represents a color in the Lab color space. // See https://en.wikipedia.org/wiki/Lab_color_space#CIELAB type Lab struct { l float32 a float32 b float32 } // NewLab returns a new `Lab` from its components func NewLab(l float32, a float32, b float...
archive/evolver/ranker.go
0.847889
0.618608
ranker.go
starcoder
package geotiff import "fmt" type GeoTiffTag struct { Name string Code int } func (g GeoTiffTag) String() string { return fmt.Sprintf("Name: %s, Code: %d", g.Name, g.Code) } // Tags (see p. 28-41 of the spec). var tagMap = map[int]GeoTiffTag{ 254: GeoTiffTag{"NewSubFileType", 254}, 256: GeoTiffTag{"ImageWidth"...
geospatialfiles/raster/geotiff/tags.go
0.57523
0.515925
tags.go
starcoder
package flag import ( "flag" "fmt" "strings" "github.com/turbinelabs/nonstdlib/arrays/indexof" ) // Strings conforms to the flag.Value and flag.Getter interfaces, and // can be used populate a slice of strings from a flag.Flag. After // command line parsing, the values can be retrieved via the Strings // field. ...
vendor/github.com/turbinelabs/nonstdlib/flag/strings.go
0.648244
0.42477
strings.go
starcoder
package ytypes import ( "fmt" "reflect" log "github.com/golang/glog" "github.com/openconfig/goyang/pkg/yang" "github.com/openconfig/ygot/util" ) // Refer to: https://tools.ietf.org/html/rfc6020#section-9.2. var ( // defaultIntegerRange is the default allowed range of values for the key // integer type, if n...
ytypes/int_type.go
0.672869
0.45423
int_type.go
starcoder
package mappings // ComplianceProfiles mapping used to create the `compliance-profiles` index var ComplianceProfiles = Mapping{ Index: IndexNameProf, Type: DocType, Timeseries: false, Mapping: ` { "template": "` + IndexNameProf + `", "settings": { "index": { "refresh_interval": "1s" },...
components/compliance-service/ingest/ingestic/mappings/comp-profiles.go
0.682468
0.421195
comp-profiles.go
starcoder
package utils // APIKind a constant representing the kind of the API model const APIKind = "API" // ApplicationKind a constant to represent the kind of the Application model const ApplicationKind = "Application" // DriverKind a constant representing the kind of the Driver API model const DriverKind = "Driver" // D...
vendor/github.com/vmware/dispatch/pkg/utils/constants.go
0.640636
0.562537
constants.go
starcoder
package rwcas import ( "github.com/nagata-yoshiteru/go-vector" ) func init() { } // Agent : type Agent struct { ID int AgentType *AgentType Position vector.Vector PrevVelocity vector.Vector PrefVelocity vector.Vector NextVelocity vector.Vector WallNeighbors ...
src/rwcas/agent.go
0.59843
0.603085
agent.go
starcoder
package field import ( "math/rand" "time" "github.com/hajimehoshi/ebiten/v2" "github.com/kemokemo/kuronan-dash/internal/view" ) // genPosFunc generates the positions to place objects. type genPosFunc func(height int, laneHeights []float64, g genPosSet) []*view.Vector // genPosField generates the positions of ob...
internal/field/generator.go
0.702326
0.442215
generator.go
starcoder
package service import ( "github.com/bwmarrin/gokrb5/types" "sync" "time" ) /*The server MUST utilize a replay cache to remember any authenticator presented within the allowable clock skew. The replay cache will store at least the server name, along with the client name, time, and microsecond fields from the recen...
service/cache.go
0.567218
0.405802
cache.go
starcoder
package CombinationIterator type CombinationIterator struct { characters []byte indexes []int cursor int pointer int start int end int combinationLength int } func Constructor(characters string, combinationLength int) CombinationIterator { indexe...
algorithms/5123.IteratorforCombination/CombinationIterator/CombinationIterator.go
0.515864
0.50653
CombinationIterator.go
starcoder
package game import ( tl "github.com/JoelOtter/termloop" ) // PortRow represents a row within the PortMatrix. type PortRow struct { frags []int // represents port address fragments selectable bool // flag for determining if the player can select the row status tl.Attr // represents the state the row...
internal/game/ports.go
0.724286
0.51879
ports.go
starcoder
package errors import ( "fmt" "io" "strconv" "time" ) // WithFields annotate err with fields. func WithFields(err error) ErrorWithFields { e, ok := err.(*withBuffer) if !ok { e = &withBuffer{ error: err, buf: []byte{}, } } return e } type withBuffer struct { error buf []byte } func (b *withBuf...
buffer.go
0.61231
0.424889
buffer.go
starcoder
package stl import "math" type RotationMatrix struct { //Store the matrix matrix [3][3]float32 //[row][col] //And the start and end pts start Vertex end Vertex lineVec Vertex lineMag float32 } //Create the rotation matrix func NewRotationMatrix(start Vertex, end Vertex, theta float64) *RotationMatrix ...
stl/Rotation.go
0.720467
0.542136
Rotation.go
starcoder
package internal import ( "math" ) // A FITS image. // Spec here: https://fits.gsfc.nasa.gov/standard40/fits_standard40aa-le.pdf // Primer here: https://fits.gsfc.nasa.gov/fits_primer.html type FITSImage struct { ID int // Sequential ID number, for log output. Counted upwards from 0 for light fra...
internal/fits.go
0.659186
0.529689
fits.go
starcoder
package lists import ( "github.com/zimmski/tavor/token" ) // One implements a list token which chooses of a set of referenced token exactly one token // Every permutation chooses one token out of the token set. type One struct { tokens []token.Token value int } // NewOne returns a new instance of a One token giv...
token/lists/one.go
0.788461
0.492005
one.go
starcoder
// Package mqanttools 字节转化 package mqanttools import ( "encoding/binary" "encoding/json" "math" ) // BoolToBytes bool->bytes func BoolToBytes(v bool) []byte { var buf = make([]byte, 1) if v { buf[0] = 1 } else { buf[0] = 0 } return buf } // BytesToBool bytes->bool func BytesToBool(buf []byte) bool { va...
utils/params_bytes.go
0.54359
0.411229
params_bytes.go
starcoder
package tsm1 import ( "fmt" "github.com/influxdata/influxdb/tsdb/cursors" ) // DecodeBooleanArrayBlock decodes the boolean block from the byte slice // and writes the values to a. func DecodeBooleanArrayBlock(block []byte, a *cursors.BooleanArray) error { blockType := block[0] if blockType != BlockBoolean { re...
tsdb/tsm1/array_encoding.go
0.73678
0.440289
array_encoding.go
starcoder
package file const contentSchema = `{ "$schema": "http://json-schema.org/draft-04/schema#", "properties": { "_format_version": { "type": "string" }, "_info": { "$schema": "http://json-schema.org/draft-04/schema#", "$ref": "#/definitions/Info" }, "_plugin_configs": { "pat...
file/schema.go
0.599837
0.433022
schema.go
starcoder
// Command custommetric creates a custom metric and writes TimeSeries value // to it. It writes a GAUGE measurement, which is a measure of value at a // specific point in time. This means the startTime and endTime of the interval // are the same. To make it easier to see the output, a random value is written. // When ...
monitoring/custommetric/custommetric.go
0.832509
0.421909
custommetric.go
starcoder
package iso20022 // Specifies the elements of an entry in the report. type NotificationEntry1 struct { // Amount of money in the cash entry. Amount *CurrencyAndAmount `xml:"Amt"` // Specifies if an entry is a credit or a debit. CreditDebitIndicator *CreditDebitCode `xml:"CdtDbtInd"` // Indicates whether the en...
NotificationEntry1.go
0.812756
0.438545
NotificationEntry1.go
starcoder
package cryptypes import "database/sql/driver" // EncryptedInt16 supports encrypting Int16 data type EncryptedInt16 struct { Field Raw int16 } // Scan converts the value from the DB into a usable EncryptedInt16 value func (s *EncryptedInt16) Scan(value interface{}) error { return decrypt(value.([]byte), &s.Raw) }...
cryptypes/type_int16.go
0.794385
0.491578
type_int16.go
starcoder
package vector import ( "fmt" "math" //"strconv" ) const prec = 6 type Vector struct { coordinates []float64 dimension int } func New(c []float64) Vector { return Vector{c, len(c)} } func (v Vector) String() string { s := "" for i := 0; i < v.dimension-1; i++ { s += fmt.Sprintf("%.2f, ", v.coordinates[...
vector.go
0.793106
0.499756
vector.go
starcoder
package geom import ( "errors" "math" ) // ErrPointsAreCoLinear is thrown when points are colinear but that is unexpected var ErrPointsAreCoLinear = errors.New("given points are colinear") // Circle is a point (float tuple) and a radius type Circle struct { Center [2]float64 Radius float64 } // IsColinear retur...
vendor/github.com/go-spatial/geom/circle.go
0.856377
0.716653
circle.go
starcoder
package core import ( "github.com/nuberu/engine/math" ) type IGeometry interface { ApplyMatrix(m *math.Matrix4) RotateX(a math.Angle) RotateY(a math.Angle) RotateZ(a math.Angle) Translate(x, y, z float32) Scale(x, y, z float32) LookAt(v *math.Vector3) Center() Normalize() } // The basic geometry type Geome...
core/geometry.go
0.728169
0.579341
geometry.go
starcoder
package g3 type Frustum struct { Left, Right Plane Top, Bottom Plane Near, Far Plane } func MakeFrustumFromMatrix(m *Matrix4x4) *Frustum { left := Plane{Vec3{m.M41 + m.M11, m.M42 + m.M12, m.M43 + m.M13}, m.M44 + m.M14} left.Normalize() right := Plane{Vec3{m.M41 - m.M11, m.M42 - m.M12, m.M43 - m.M13}, m.M44 -...
src/pkg/g3/frustum.go
0.541409
0.525551
frustum.go
starcoder
package nist_sp800_22 import ( "math" ) // Input Size Recommendation // Choose m and n such that m < floor(log_2 (n))- 2. func Serial(m uint64, n uint64) ([]float64, []bool, error) { var v [][]uint64 = make([][]uint64, 3) var section2_index uint64 for section2_index = 0; section2_index <= 2; section2_index++ {...
nist_sp800_22/serial.go
0.52683
0.511717
serial.go
starcoder
package geometry import ( "math" ) type Matrix interface { Assessor } func Homogenous1x2() Mat1x2 { return Mat1x2{0, 1} } func Homogenous1x3() Mat1x3 { return Mat1x3{0, 0, 1} } func Homogenous1x4() Mat1x4 { return Mat1x4{0, 0, 0, 1} } func Homogenous2x1() Mat2x1 { return Mat2x1{ Mat1x1{0}, Mat1x1{1}, }...
matrix.go
0.823825
0.785597
matrix.go
starcoder
package geo import ( "math" ) // vec3I represents a 3D vector typed as int32 type vec3I struct { X int32 // X coordinate Y int32 // Y coordinate Z int32 // Z coordinate } const micronsAccuracy = 1E-6 func newvec3IFromVec3(vec Point3D) vec3I { a := vec3I{ X: int32(math.Floor(float64(vec.X() / micronsAccuracy)...
geo/node.go
0.88674
0.698985
node.go
starcoder
package certs import ( "errors" "fmt" "github.com/deiscc/workflow-e2e/tests/cmd" "github.com/deiscc/workflow-e2e/tests/model" "github.com/deiscc/workflow-e2e/tests/settings" . "github.com/onsi/gomega" . "github.com/onsi/gomega/gbytes" . "github.com/onsi/gomega/gexec" ) var ErrNoCertMatch = errors.New("\"No ...
tests/cmd/certs/commands.go
0.599485
0.44083
commands.go
starcoder
package util import ( "fmt" "strings" "time" "k8s.io/api/core/v1" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" ) const ( // a short time format; like time.Kitchen but with 24-hour notation. Kitchen24 = "15:04" // a time format that just cares about the day and month. YearDay = "Jan_2" ) // TimePeriod repr...
util/util.go
0.772788
0.514095
util.go
starcoder
package linkedlist import ( "bytes" "fmt" "strings" ) // Node contains data (and usually a value or a pointer to a value) and a pointer to the next node type Node struct { next *Node Data int } // LinkedList with a single pointer, https://en.wikipedia.org/wiki/Linked_list type LinkedList struct { Head *Node } ...
linkedlist.go
0.691497
0.437703
linkedlist.go
starcoder
package analysis import ( "fmt" "reflect" "github.com/google-research/korvapuusti/tools/spectrum" "github.com/google-research/korvapuusti/tools/synthesize/signals" tf "github.com/ryszard/tfutils/proto/tensorflow/core/example" ) // Calibration defines the calibration of the equipment before the evaluation. type...
experiments/partial_loudness/analysis/data.go
0.68784
0.617916
data.go
starcoder
package runtime // A Value is a runtime value. type Value struct { iface interface{} } // AsValue returns a Value for the passed interface. func AsValue(i interface{}) Value { return Value{iface: i} } // Interface turns the Value into an interface. func (v Value) Interface() interface{} { return v.iface } // In...
runtime/value_noscalar.go
0.857694
0.484868
value_noscalar.go
starcoder
package structmapper import ( "errors" "fmt" "reflect" "unicode" "encoding" "github.com/hashicorp/go-multierror" ) // This file contains the map to struct functionality of Mapper func (sm *Mapper) unmapPtr(in interface{}, out reflect.Value, t reflect.Type) error { child := reflect.New(t.Elem()) if err := s...
unmap.go
0.591133
0.402451
unmap.go
starcoder
package eval import ( "log" "math/big" ) /* * "As" functions. These retrieve evaluator functions from an * expr, panicking if the requested evaluator has the wrong type. */ func (a *expr) asBool() func(*Thread) bool { return a.eval.(func(*Thread) bool) } func (a *expr) asUint() func(*Thread) uint64 { return ...
expr1.go
0.619471
0.568955
expr1.go
starcoder
package chron import ( "time" "github.com/dustinevan/chron/dura" "fmt" "reflect" "database/sql/driver" "strings" ) type Minute struct { time.Time } func NewMinute(year int, month time.Month, day, hour, min int) Minute { return Minute{time.Date(year, month, day, hour, min, 0, 0, time.UTC)} } func ThisMinute...
minute.go
0.649912
0.443359
minute.go
starcoder
package vector import "math" // Vector3 defines a struct holding the X, Y, Z values of a vector // as float64 type Vector3 struct { X float64 Y float64 Z float64 } // NewVector3 constructs a new vector3 func NewVector3(x, y, z float64) Vector3 { return Vector3{ x, y, z, } } // Vector2 defines a struct ho...
internal/pkg/vector/vector.go
0.931283
0.84966
vector.go
starcoder
package xmmhandler import ( "encoding/binary" "fmt" "math" "math/big" "reflect" "strconv" ) const ( //XMMBYTES is the number of bytes inside a XMM register XMMBYTES = 16 //XMMREGISTERS is the number of xmm registers in intel x86 XMMREGISTERS = 16 //SIZEOFINT16 is the number of bytes inside an int16 SIZE...
backend/xmmhandler/xmmhandler.go
0.551332
0.436622
xmmhandler.go
starcoder
package martinez_rueda import ( "github.com/paulmach/orb" ) type PointChain struct { segments []orb.Point closed bool } func NewPointChain(initSegment Segment) *PointChain { return &PointChain{ segments: []orb.Point{initSegment.begin(), initSegment.end()}, } } func (pc *PointChain) begin() orb.Point { ret...
pointchain.go
0.713232
0.530601
pointchain.go
starcoder
package condition import ( "encoding/json" "github.com/Jeffail/benthos/v3/lib/log" "github.com/Jeffail/benthos/v3/lib/message" "github.com/Jeffail/benthos/v3/lib/metrics" "github.com/Jeffail/benthos/v3/lib/types" ) //------------------------------------------------------------------------------ func init() { ...
lib/condition/any.go
0.744935
0.630145
any.go
starcoder
package datadog import ( "encoding/json" ) // LogsRetentionSumUsage Object containing indexed logs usage grouped by retention period and summed. type LogsRetentionSumUsage struct { // Total indexed logs for this retention period. LogsIndexedLogsUsageSum *int64 `json:"logs_indexed_logs_usage_sum,omitempty"` // Li...
api/v1/datadog/model_logs_retention_sum_usage.go
0.726231
0.491761
model_logs_retention_sum_usage.go
starcoder
package indicators import ( "errors" "github.com/jaybutera/gotrade" "math" ) // A Stop and Reverse Indicator (Sar), no storage, for use in other indicators type SarWithoutStorage struct { *baseIndicatorWithFloatBounds // private variables periodCounter int isLong bool extremePoint ...
indicators/sar.go
0.733738
0.492737
sar.go
starcoder
package gah import ( opensimplex "github.com/ojrac/opensimplex-go" ) // CoherentNoise provides automatic layering of opensimplex noise using parameters type CoherentNoise struct { Noise opensimplex.Noise // open simplex noise generator Scale float64 // number that determines at what distance ...
coherentnoise.go
0.709824
0.601652
coherentnoise.go
starcoder
package payload import ( "fmt" "strconv" ) type toIntFunc func(source *interface{}) int type toInt64Func func(source *interface{}) int64 type toFloat32Func func(source *interface{}) float32 type toFloat64Func func(source *interface{}) float64 type toUint64Func func(source *interface{}) uint64 type numberTransform...
payload/numberTransformers.go
0.628635
0.446133
numberTransformers.go
starcoder
package iso20022 // Information about a statement of investment fund transactions. type StatementOfInvestmentFundTransactions3 struct { // General information related to the investment fund statement of transactions that is being cancelled. StatementGeneralDetails *Statement8 `xml:"StmtGnlDtls,omitempty"` // Info...
StatementOfInvestmentFundTransactions3.go
0.742888
0.408631
StatementOfInvestmentFundTransactions3.go
starcoder
package caleb import ( "fmt" "math" "time" ) type JewishDate struct { Shana int Chodesh int Yom int } // Short returns a numerical representation of the Jewish date: 5779-07-25. func (t JewishDate) Short() string { return fmt.Sprintf("%02d-%02d-%04d", t.Yom, t.Chodesh, t.Shana) } // String returns a re...
caleb.go
0.710929
0.437763
caleb.go
starcoder
package io import ( "github.com/hajimehoshi/ebiten" ) // GBIO represents the controller key matrix // <NAME> has a good description and diagram of how this works: // http://imrannazar.com/GameBoy-Emulation-in-JavaScript:-Input // When 0xFF00 is written to, one of two columns is selected as `col` // One column has Do...
io/io.go
0.569134
0.483831
io.go
starcoder
package main import ( "bufio" "encoding/csv" "fmt" "io" "log" "math" "math/rand" "os" "strconv" ) // sigmoid Sigmoid activation function: f(x) = 1 / (1 + e^(-x)) func sigmoid(x float64) float64 { return 1 / (1 + math.Exp(-x)) } // derivSigmoid Derivative of sigmoid: f'(x) = f(x) * (1 - f(x)) func derivSigm...
main.go
0.665519
0.544983
main.go
starcoder
package telegram // LabeledPrice : This object represents a portion of the price for goods or services. type LabeledPrice struct { Label string `json:"label"` // Portion label Amount int64 `json:"amount"` // Price of the product in the smallest units of the currency (integer, not float/double). For example, for a...
payment_types.go
0.856573
0.547162
payment_types.go
starcoder
// Package slices defines various functions useful with slices of any type. // Unless otherwise specified, these functions all apply to the elements // of a slice at index 0 <= i < len(s). package slices import "golang.design/x/go2generics/std/constraints" // See #45458 // Equal reports whether two slices are equal:...
std/slices/slice.go
0.817283
0.697345
slice.go
starcoder
package lottie // GetDdd returns the Ddd field if it's non-nil, zero value otherwise. func (a *Animation) GetDdd() int { if a == nil || a.Ddd == nil { return 0 } return *a.Ddd } // GetFrameRate returns the FrameRate field if it's non-nil, zero value otherwise. func (a *Animation) GetFrameRate() float64 { if a ...
lottie/lottie-accessors.go
0.872198
0.615926
lottie-accessors.go
starcoder
package template // SegmentTree define type SegmentTree struct { data, tree, lazy []int left, right int merge func(i, j int) int } // Init define func (st *SegmentTree) Init(nums []int, oper func(i, j int) int) { st.merge = oper data, tree, lazy := make([]int, len(nums)), make([]int, 4*len(nums))...
template/SegmentTree.go
0.512449
0.533154
SegmentTree.go
starcoder
package defs import ( "bytes" ) // Type definitions const ( baseURI = "https://www.w3.org/ns/activitystreams#" PublicActivityPub = "https://www.w3.org/ns/activitystreams#Public" ) var ( objectType = &Type{ Name: "Object", URI: baseURI + "Object", Notes: "Describes an object of any kind. The Ob...
tools/defs/defs.go
0.519278
0.523847
defs.go
starcoder
package tests import ( "encoding/json" "github.com/Jeffail/gabs" "github.com/stretchr/testify/require" "gopkg.in/resty.v1" "strings" "testing" ) func standardJsonResponseTests(response *resty.Response, expectedStatusCode int, t *testing.T) { t.Run("has standard json response ("+response.Request.URL+")", func(t...
tests/standard.go
0.573201
0.443179
standard.go
starcoder
package encoding import ( "fmt" "reflect" "strconv" "strings" ) func convertStruct(i interface{}, t reflect.Type, pointer bool) (reflect.Value, error) { m, ok := i.(map[string]interface{}) if !ok { return zeroValue, fmt.Errorf("Cannot convert %T to struct", i) } out := reflect.New(t) err := Unstringify(m...
cfn/encoding/unstringify.go
0.572962
0.420957
unstringify.go
starcoder
package continuous_nums_with_target_sum import "math" /* [面试题57 - II. 和为s的连续正数序列](https://leetcode-cn.com/problems/he-wei-sde-lian-xu-zheng-shu-xu-lie-lcof/) 输入一个正整数 target ,输出所有和为 target 的连续正整数序列(至少含有两个数)。 序列内的数字由小到大排列,不同序列按照首个数字从小到大排列。 示例 1: 输入:target = 9 输出:[[2,3,4],[4,5]] 示例 2: 输入:target = 15 输出:[[1,2,3,4,5],[...
solutions/continuous-nums-with-target-sum/d.go
0.607547
0.487612
d.go
starcoder
package collections import ( "reflect" "strconv" "strings" "unicode" ) // IntValue type alias for int type IntValue int // Int casts and returns int value func (i IntValue) Int() int { return int(i) } // Int32 casts and returns Int32 value func (i IntValue) Int32() int32 { return int32(i) } // Int64 casts an...
primitive_conversions.go
0.874158
0.514766
primitive_conversions.go
starcoder
package car_generic import ( m "github.com/niclabs/intersection-simulator/vehicle" "math" ) func (car *Car) GetPosition() m.Pos { return car.Position } func (car *Car) GetDirectionInRadians() float64 { return car.Direction * math.Pi / 180.0 } func (car *Car) Run(dt float64) { turnAngle := GetTurnAngle() car.A...
vehicle/car_generic/dynamics.go
0.766643
0.436622
dynamics.go
starcoder
package gblur import ( "image" "image/color" "math" ) // GaussianKernel returns a gaussian filter of size sz x sz with sigma standard deviation func GaussianKernel(sz int, sigma float64) [][]float64 { filter := make([][]float64, sz) for i := range filter { filter[i] = make([]float64, sz) } var sum float64 ...
05-scheduler/gaussianblur/gblur/gblur.go
0.889834
0.548794
gblur.go
starcoder
package tree import ( "fmt" "github.com/sap200/binarytree/node" ) type BST struct { root *node.TreeNode size int } // Creates a new binary tree func NewBST() *BST { return &BST{ root: nil, size: 0, } } func CreateBST(el []node.Comparable) *BST { bst := NewBST() for i := 0; i < len(el); i++ { bst.Inse...
tree/bst.go
0.726911
0.483222
bst.go
starcoder
package main import ( "flag" "fmt" "math" "runtime" "sort" ) // Note, the standard "image" package has Point and Rectangle but we // can't use them here since they're defined using int rather than // float64. type Circle struct{ X, Y, R, rsq float64 } func NewCircle(x, y, r float64) Circle { // We pre-calcula...
tasks/Total-circles-area/total-circles-area.go
0.68595
0.406096
total-circles-area.go
starcoder
package cspacegen import ( "encoding/json" "fmt" "math" ) // point struct to serialize. type point struct { X, Y, Z float64 } // triangle struct to serialize. type triangle struct { First, Second, Third int } // obstacle struct to serialize. type obstacle struct { Vertex []point Facet []triangle } // cspac...
generator/cspacegen/cspacegen_serialization.go
0.702734
0.473718
cspacegen_serialization.go
starcoder
package neural import ( "crypto/rand" "math/big" ) // Neuron is a set of weights + bias linked to a layer type Neuron struct { MaxInputs int `json:"-"` Weights []float64 `json:"Weights"` Bias float64 `json:"Bias"` // Previous momentum of every weight and bias Momentums []float64 `json:"-"` // L...
neuron.go
0.802633
0.588268
neuron.go
starcoder
package cryptoapis import ( "encoding/json" ) // ListTokensTransfersByTransactionHashRI struct for ListTokensTransfersByTransactionHashRI type ListTokensTransfersByTransactionHashRI struct { // Represents the contract address of the token, which controls its logic. It is not the address that holds the tokens. Con...
model_list_tokens_transfers_by_transaction_hash_ri.go
0.829216
0.425784
model_list_tokens_transfers_by_transaction_hash_ri.go
starcoder
package cl import ( "errors" "math/big" "github.com/getamis/alice/crypto/utils" "github.com/golang/protobuf/proto" ) var ( big0 = big.NewInt(0) big256bit = new(big.Int).Lsh(big1, 256) // ErrDifferentBQForms is returned if the two quadratic forms are different ErrDifferentBQForms = errors.New("differen...
crypto/homo/cl/proof.go
0.678433
0.482856
proof.go
starcoder
package go_cip import ( "bytes" eip "github.com/loki-os/go-ethernet-ip" "github.com/loki-os/go-ethernet-ip/typedef" ) type SegmentType typedef.Usint const ( SegmentTypePort SegmentType = 0 << 5 SegmentTypeLogical SegmentType = 1 << 5 SegmentTypeNetwork SegmentType = 2 << 5 SegmentTypeSymbolic Segmen...
segment.go
0.524882
0.48377
segment.go
starcoder
package bytes import ( "errors" "io" ) var ( // ErrNoEnoughData represents no enough data to return in a buffer. ErrNoEnoughData = errors.New("bytes.ReadOnlyBuffer: no engough data") ) // ReadOnlyBuffer defines a buffer only used for reading data. type ReadOnlyBuffer interface { // Read reads n bytes start with...
bytes/readonly_buffer.go
0.651022
0.441914
readonly_buffer.go
starcoder
package model2d import ( "math" "math/rand" ) // A Coord is a coordinate in 2-D Euclidean space. type Coord struct { X float64 Y float64 } // NewCoordRandNorm creates a random Coord with normally // distributed components. func NewCoordRandNorm() Coord { return Coord{ X: rand.NormFloat64(), Y: rand.NormFloa...
model2d/coords.go
0.888717
0.579579
coords.go
starcoder
package core import ( "image" "github.com/Laughs-In-Flowers/flip" "github.com/Laughs-In-Flowers/warhola/lib/canvas" ) var ( fliip = NewCommand( "", "flip", "Flip an image in an opposite direction", 1, func(o *Options) *flip.FlagSet { v := o.Vector fs := flip.NewFlagSet("flip", flip.ContinueOnError) ...
lib/core/translate.go
0.539954
0.466177
translate.go
starcoder
package life import "image/color" import "time" import "github.com/fyne-io/fyne" import "github.com/fyne-io/fyne/canvas" import "github.com/fyne-io/fyne/theme" type board struct { cells [][]bool width int height int } func (b *board) ifAlive(x, y int) int { if x < 0 || x >= b.width { return 0 } if y < 0 ...
life/main.go
0.516595
0.404449
main.go
starcoder
package scheduler import "time" // Scheduler is an interface for running tasks. // Scheduling of tasks is asynchronous/non-blocking. // Tasks can be executed in sequence or concurrently. type Scheduler interface { // Now returns the current time according to the scheduler. Now() time.Time // Since returns the tim...
scheduler.go
0.631481
0.405625
scheduler.go
starcoder
package xacml import ( "errors" "log" "regexp" ) const ( functionStringEqual = "urn:oasis:names:tc:xacml:1.0:function:string-equal" functionStringEqualIgnoreCase = "urn:oasis:names:tc:xacml:1.0:function:string-equal-ignore-case" functionBooleanEqual = "urn:oasis:names:tc:xacml:1.0:function...
Functions.go
0.500732
0.489442
Functions.go
starcoder
package constant import ( "bytes" "fmt" "github.com/geode-lang/geode/llvm/enc" "github.com/geode-lang/geode/llvm/ir/types" "github.com/geode-lang/geode/llvm/ir/value" ) // --- [ vector ] -------------------------------------------------------------- // Vector represents a vector constant. type Vector struct {...
llvm/ir/constant/complex.go
0.782372
0.538923
complex.go
starcoder
package ihex import ( "bytes" "encoding/hex" "fmt" "io" "strings" ) const ( // recordMaximumDataSize the largest size of the data payload of a record (in bytes) recordMaximumDataSize = 255 // recordMaximumSizeChars the largest size of a record (including header data, checksum and starting character) when hex...
record.go
0.804866
0.53692
record.go
starcoder
package zed import ( "encoding/binary" "fmt" "strings" "github.com/brimdata/zed/zcode" ) type TypeOfType struct{} func (t *TypeOfType) ID() int { return IDType } func (t *TypeOfType) String() string { return "type" } func (t *TypeOfType) Marshal(zv zcode.Bytes) (interface{}, error) { return t.Format(zv), n...
typetype.go
0.513668
0.481576
typetype.go
starcoder