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 onshape
import (
"encoding/json"
)
// BTPStatementTry1523 struct for BTPStatementTry1523
type BTPStatementTry1523 struct {
BTPStatement269
Body *BTPStatementBlock271 `json:"body,omitempty"`
BtType *string `json:"btType,omitempty"`
CatchBlock *BTPStatementBlock271 `json:"catchBlock,omitempty"`
CatchVaria... | onshape/model_btp_statement_try_1523.go | 0.724286 | 0.423518 | model_btp_statement_try_1523.go | starcoder |
package chunks
// Postings provides iterative access over a postings list.
type Postings interface {
// Next advances the iterator and returns true if another value was found.
Next() bool
// Seek advances the iterator to value v or greater and returns
// true if a value was found.
Seek(v uint64) bool
// At ret... | pkg/engine/tem/chunks/chunks.go | 0.71721 | 0.512144 | chunks.go | starcoder |
package data
import (
"encoding/json"
"time"
)
// Task represents a piece of work. A task can have multiple sub tasks
type Task struct {
ID int `json:"id"`
Title string `json:"title"`
Content string `json:"content"`
TimeCreated time.Time `json:"timeCreated"`
SubTasks ... | data/data.go | 0.566498 | 0.416589 | data.go | starcoder |
package aws
import (
"context"
"errors"
"fmt"
"sync"
"time"
"github.com/aws/aws-sdk-go/aws"
"github.com/aws/aws-sdk-go/service/lambda"
"github.com/aws/aws-sdk-go/service/lambda/lambdaiface"
"github.com/benthosdev/benthos/v4/internal/impl/aws/config"
"github.com/benthosdev/benthos/v4/public/service"
)
func... | internal/impl/aws/processor_lambda.go | 0.709321 | 0.67842 | processor_lambda.go | starcoder |
package ray
import (
"fmt"
"math"
)
type Matrix [][]float64
type RowValues []float64
func NewMatrix(rows, columns int, rowsValues ...RowValues) Matrix {
m := make(Matrix, rows)
for r := 0; r < rows; r++ {
m[r] = make([]float64, columns)
}
for r := range rowsValues {
for i := range rowsValues[r] {
m[r][... | go/internal/ray/matrices.go | 0.744656 | 0.469399 | matrices.go | starcoder |
package specifics
// EmptyIntSlice returns an empty, non-nil int slice
func EmptyIntSlice() []int {
return make([]int, 0)
}
// IntSlicesEqual returns whether two integer arrays are
// equal
func IntSlicesEqual(arr1, arr2 []int) bool {
if len(arr1) != len(arr2) {
return false
}
for i, num := range arr1 {
if nu... | intslices.go | 0.693784 | 0.452415 | intslices.go | starcoder |
package ucb1
import (
`math`
`math/rand`
`time`
)
func init() {
rand.Seed(time.Now().UnixNano())
}
type UCB1 struct {
probabilities []float64
cost float64
rewardsPerArm []float64
timesPerArm []int
steps []Step
totalTimes int
totalReward float64
}
func New(probabilities []float64, ... | B3S1 - Artifical Intelligence/Homework 5 - Multi-Armed Bandit (UCB1)/ucb1/ucb1.go | 0.668772 | 0.404272 | ucb1.go | starcoder |
package learn
import (
"math"
"github.com/egon12/cols"
)
type (
FieldName string
FieldContent string
Result string
ID3Processor struct {
Fields []FieldName
DB Data
}
Data struct {
Header []FieldName
Rows Rows
}
Row struct {
Input map[FieldName]FieldContent
Result Result
}
Row... | learn/learn.go | 0.74382 | 0.401893 | learn.go | starcoder |
package wid
import (
"image"
"gioui.org/f32"
"gioui.org/layout"
)
// Fit scales a widget to fit and clip to the constraints.
type Fit uint8
const (
// Unscaled does not alter the scale of a widget.
Unscaled Fit = iota
// Contain scales widget as large as possible without cropping,
// and it preserves aspect... | wid/fit.go | 0.786746 | 0.401189 | fit.go | starcoder |
package clover
// Query represents a generic query which is submitted to a specific collection.
type Query struct {
engine StorageEngine
collection string
criteria *Criteria
}
func (q *Query) satisfy(doc *Document) bool {
if q.criteria == nil {
return true
}
return q.criteria.p(doc)
}
// Count returns ... | query.go | 0.886684 | 0.402451 | query.go | starcoder |
package primitive
import (
"fmt"
"image"
"image/color"
"strings"
)
type Color struct {
R, G, B, A int
}
func (c *Color) NRGBA() color.NRGBA {
return color.NRGBA{uint8(c.R), uint8(c.G), uint8(c.B), uint8(c.A)}
}
func (c *Color) Delta(color *Color) Color {
x := Color{c.R - color.R, c.G - color.G, c.B - color.B... | primitive/color.go | 0.818701 | 0.423518 | color.go | starcoder |
package models
import (
i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91 "github.com/microsoft/kiota-abstractions-go/serialization"
)
// ApiApplication
type ApiApplication struct {
// When true, allows an application to use claims mapping without specifying a custom signing key.
acceptMa... | models/api_application.go | 0.748076 | 0.422505 | api_application.go | starcoder |
package schedule
import (
"fmt"
"time"
)
// Task describes when and how frequently a scheduled task should be executed and the component that provides a
// method to actually perform the task
type Task struct {
// A human-readable name for the task
Name string
// An optional unique ID for the task (the IoC com... | schedule/task.go | 0.624294 | 0.414129 | task.go | starcoder |
package typed
import (
"fmt"
yaml "gopkg.in/yaml.v2"
"sigs.k8s.io/structured-merge-diff/schema"
"sigs.k8s.io/structured-merge-diff/value"
)
// YAMLObject is an object encoded in YAML.
type YAMLObject string
// Parser implements YAMLParser and allows introspecting the schema.
type Parser struct {
Schema schema.... | vendor/sigs.k8s.io/structured-merge-diff/typed/parser.go | 0.726426 | 0.408159 | parser.go | starcoder |
// Package archer contains the structs that represent archer concepts, and the associated interfaces to manipulate them.
package archer
// Environment represents the configuration of a particular environment in a project. It includes
// the environment's account and region, name, as well as the project it belongs to.... | internal/pkg/archer/env.go | 0.643105 | 0.498291 | env.go | starcoder |
package xmlwriter
import (
"fmt"
"strconv"
)
// Attr represents an XML attribute to be written by the Writer.
type Attr struct {
Prefix string
URI string
Name string
Value string
}
func (a Attr) writable() {}
func (a Attr) kind() NodeKind { return AttrNode }
// Bool writes a boolean to an attribute.
fu... | vendor/github.com/shabbyrobe/xmlwriter/attr.go | 0.727007 | 0.445409 | attr.go | starcoder |
package codec
import (
"fmt"
"strconv"
"time"
)
type ParamCodec struct {
OnDecode func(value string) (interface{}, error)
OnEncode func(value interface{}) string
}
func (pc ParamCodec) Decode(name, value string, out interface{}) error {
// Convert a possible multi-valued query parameter (comma-separated string... | pkg/codec/httpv2/paramcodec.go | 0.647352 | 0.541712 | paramcodec.go | starcoder |
package alt
import (
"fmt"
"math"
"reflect"
"time"
"github.com/ohler55/ojg/gen"
)
// RecomposeFunc should build an object from data in a map returning the
// recomposed object or an error.
type RecomposeFunc func(map[string]interface{}) (interface{}, error)
// Recomposer is used to recompose simple data into ... | alt/recomposer.go | 0.573678 | 0.470433 | recomposer.go | starcoder |
package polling
import (
"io/ioutil"
"net/http"
)
type OpenExchangeRates struct {
Disclaimer string `json:"disclaimer"`
License string `json:"license"`
Timestamp string `json:"timestamp"`
Base string `json:"base"`
Currency OpenExchange... | polling/openexchange.go | 0.585101 | 0.503662 | openexchange.go | starcoder |
package anomalia
import (
"sort"
"sync"
)
type mapper func(float64) float64
type mapperWithIndex func(int, float64) float64
type predicate func(float64) bool
func minMax(data []float64) (float64, float64) {
var (
max = data[0]
min = data[0]
)
for _, value := range data {
if max < value {
max = value
... | helpers.go | 0.541409 | 0.49939 | helpers.go | starcoder |
package benchmark
import (
"reflect"
"testing"
)
func isBoolToUint32FuncCalibrated(supplier func() bool) bool {
return isCalibrated(reflect.Bool, reflect.Uint32, reflect.ValueOf(supplier).Pointer())
}
func isIntToUint32FuncCalibrated(supplier func() int) bool {
return isCalibrated(reflect.Int, reflect.Uint32, re... | common/benchmark/10_to_uint32_func.go | 0.713032 | 0.70076 | 10_to_uint32_func.go | starcoder |
package ql
import (
"fmt"
"io"
)
// parse an expression into it's AST counter part
type parser struct {
src *scanner
err error
}
// Parse convert any 'src' into an Expr (or error if it is not possible)
func Parse(src io.Reader) (x Expr, err error) {
//Start by building the scanner and cosuming the first token
... | ql/parser.go | 0.524395 | 0.423995 | parser.go | starcoder |
package gridserver
import (
"fmt"
"image/color"
)
// TileFormat specifies the types of tiles to generate.
type TileFormat int
const (
// JSONTile indicates the tile output should be GeoJSON.
JSONTile TileFormat = 0
// ImageTile indicates the tile output should be a PNG image.
ImageTile TileFormat = 1
)
// Til... | tile_server/gridserver/tileref.go | 0.829837 | 0.551755 | tileref.go | starcoder |
package nbt
// Interface because there will be faster implementations than the most intuitive, probably slow one,
// but they're gonna be very memory expensive and I can't decide whether that tradeoff shouldn't be
// something that the user must decide.
// Also, I know that this interface is a bad abstraction, but I n... | mapper.go | 0.508544 | 0.473292 | mapper.go | starcoder |
package q3bsp
import (
"image/color"
"github.com/g3n/engine/math32"
)
// BSP is a binary space partition
type BSP struct {
header bspHeader
EntityInfo string
Textures []*Texture
Planes []*Plane
Nodes []*Node
Leaves []*Leaf
LeafFaces []*LeafFace
// LeafBrushes stores lists of brush indic... | q3bsp/bsp.go | 0.591723 | 0.652643 | bsp.go | starcoder |
package tree
import (
"fmt"
dist "github.com/bkaraceylan/goophy/distance"
)
//NJ creates an evolutionary tree from a distance matrix using neighbor-joining algorithm.
func NJ(distmat dist.DistMat) *Tree {
var intnodes []*Node
tree := CreateTree("test")
for _, lbl := range distmat.Ids {
tree.AddNode(lbl, -1, ... | tree/nj.go | 0.727589 | 0.616445 | nj.go | starcoder |
package CloudForest
import (
"fmt"
)
/*
DensityTarget is used for density estimating trees. It contains a set of features and the
count of cases.
*/
type DensityTarget struct {
Features *[]Feature
N int
}
func (target *DensityTarget) GetName() string {
return "DensityTarget"
}
/*
DensityTarget.SplitImpur... | densitytarget.go | 0.75101 | 0.439868 | densitytarget.go | starcoder |
package klog
import (
"cloud.google.com/go/civil"
"errors"
"fmt"
"math"
"regexp"
"strings"
gotime "time"
)
// Date represents a day in the gregorian calendar.
type Date interface {
// Year returns the year as number, e.g. `2004`.
Year() int
// Month returns the month as number, e.g. `3` for March.
Month()... | src/date.go | 0.83752 | 0.561996 | date.go | starcoder |
package blip
import (
"errors"
"unsafe"
)
type buf_t = int32
// Sample buffer that resamples to output rate and accumulates samples until they're read out
type Blip struct {
factor uint64
offset uint64
avail int32
size int32
integrator int32
buffer []buf_t
}
// Creates new buffer that... | blip.go | 0.808029 | 0.434821 | blip.go | starcoder |
package gotree
import (
"log"
)
// BST is a struct for a Binary Search Tree.
type BST struct {
root *BSTNode
}
// Root returns the root node of this BST.
func (tree *BST) Root() *BSTNode {
return tree.root
}
// BSTNode is a Binary Search Tree Node.
type BSTNode struct {
value Element
left *BSTNode
right *BST... | bst.go | 0.827793 | 0.53783 | bst.go | starcoder |
package mu
// Sum returns the sum of its arguments.
// An empty argument list raises a panic.
func Sum(nums ...int) int {
if len(nums) == 0 {
panic("Sum argument list empty")
}
var total int = 0
for _, num := range nums {
total += num
}
return total
}
// SumI8 returns the sum of its arguments.
// An empty ... | mu_g.go | 0.747063 | 0.457864 | mu_g.go | starcoder |
package asciiturtle
import (
"fmt"
"math"
"strings"
)
const degToRad = math.Pi / 180.0
type Pen struct {
Canvas Canvas
X, Y int
Char byte
Heading float64
penUp bool
}
func NewPen(canvas Canvas, char byte, x, y int) (*Pen, error) {
if canvas == nil {
return nil, fmt.Errorf("canvas must not be nil... | asciiturtle.go | 0.659295 | 0.512144 | asciiturtle.go | starcoder |
package tictactoe
import "github.com/z-rui/game"
// N is the board size of the Tic-Tac-Toe game
const N = 3
// Cell represents a cell of the board.
// It has three states: Empty, O and X.
type Cell uint8
const (
Empty Cell = iota
O
X
)
// String converts a cell to the string representation.
func (c Cell) String... | tictactoe/state.go | 0.761006 | 0.476701 | state.go | starcoder |
package stargen
import (
"math"
"github.com/dayaftereh/discover/server/utils"
"github.com/dayaftereh/discover/server/mathf"
)
type StellarClass struct {
Class string
Color int64
Mass *mathf.Range
Radius *mathf.Range
Temperature *mathf.Range
Luminosity *mathf.Range
}
// Stellar cla... | server/game/universe/generator/stargen/stellar-classification.go | 0.633864 | 0.429011 | stellar-classification.go | starcoder |
package lstm
import (
"context"
"io"
"github.com/owulveryck/lstm/datasetter"
G "gorgonia.org/gorgonia"
"gorgonia.org/tensor"
)
// basicReadWriter is a dummy structure that fufil the datasetter.ReadWriter interface
// Is it used to build a one step execution graph
type basicReadWriter struct {
input *G.Node
s... | predict.go | 0.620162 | 0.464598 | predict.go | starcoder |
package parser
import (
"github.com/influxdata/telegraf/plugins/parsers"
"github.com/ulule/deepcopier"
)
// Config implements Telegraf parsers.Config, but with SignalFx Smart Agent struct tags
// and a methods for returning a Telegraf parsers.Config struct and a Telegraf parsers.Parser.
// Please refer to Telegraf'... | pkg/monitors/telegraf/common/parser/parsers.go | 0.707203 | 0.462109 | parsers.go | starcoder |
package advent
import (
"strings"
"advent/lib/util"
)
var exampleInput1 = strings.Split(`light red bags contain 1 bright white bag, 2 muted yellow bags.
dark orange bags contain 3 bright white bags, 4 muted yellow bags.
bright white bags contain 1 shiny gold bag.
muted yellow bags contain 2 shiny gold bags, 9 fade... | go/2020/day07/main.go | 0.644001 | 0.535402 | main.go | starcoder |
package avaclient
// SubDescriptionDto This is appended to a Position and is used to separate the complete Position into smaller amounts to be described separately, for example concrete walls could be attached to different building storeys.
type SubDescriptionDto struct {
// Elements GUID identifier.
Id string `json... | model_sub_description_dto.go | 0.753194 | 0.484929 | model_sub_description_dto.go | starcoder |
// F7 illuminant conversion functions
package white
// F7_A functions
func F7_A_Bradford(xs, ys, zs float64) (xd, yd, zd float64) {
m := [3][3]float64{
{1.2162616, 0.1109265, -0.1548306},
{0.1532455, 0.9152079, -0.0559592},
{-0.0239302, 0.0358725, 0.3151544}}
xd = m[0][0]*xs + m[0][1]*ys + m[0][2]*zs
yd = m... | f64/white/f7.go | 0.501221 | 0.558508 | f7.go | starcoder |
package main
import (
"image"
"math"
"sync"
"github.com/skelterjohn/go.wde"
_ "github.com/skelterjohn/go.wde/xgb"
t "github.com/tincann/go-path-tracer/tracer"
)
func main() {
go start()
wde.Run()
}
func start() {
w, _ := wde.NewWindow(500, 500)
screen := w.Screen()
bounds := screen.Bounds()
camera :=... | main.go | 0.556641 | 0.430207 | main.go | starcoder |
package sherbet
import (
"reflect"
"time"
"github.com/viant/toolbox"
)
// EncryptArrayToInt encrypt array to int64
func EncryptArrayToInt(array []bool) int64 {
var result int64 = 0
for _, val := range array {
result = result << 1
if val {
result++
} else {
}
}
return result
}
// DecryptArrayToIn... | kit.go | 0.591133 | 0.496033 | kit.go | starcoder |
package dataconverter
import (
"strconv"
"strings"
)
// Bluetooth Protocol Operation type
const (
BluetoothAdd string = "Add"
BluetoothSubtract string = "Subtract"
BluetoothMultiply string = "Multiply"
BluetoothDivide string = "Divide"
)
//Converter is the structure that contains data conversion specifi... | device/bluetooth_mapper/data_converter/data_converter.go | 0.637482 | 0.411643 | data_converter.go | starcoder |
package builtin
import (
"math"
"strconv"
. "github.com/apmckinlay/gsuneido/runtime"
"github.com/apmckinlay/gsuneido/util/dnum"
)
var minNarrow = dnum.FromInt(MinSuInt)
var maxNarrow = dnum.FromInt(MaxSuInt)
func init() {
NumMethods = Methods{
"Chr": method0(func(this Value) Value {
n := byte(ToInt(this)... | builtin/number.go | 0.515132 | 0.57678 | number.go | starcoder |
package polyline
import (
"gioui.org/f32"
"gioui.org/layout"
"gioui.org/op"
"gioui.org/op/clip"
"gioui.org/op/paint"
"image/color"
"math"
)
const (
rad90 = float32(90 * math.Pi / 180)
)
func Draw(points []f32.Point, width float32, col color.RGBA, gtx layout.Context) {
length := len(points)
for i, p := rang... | polyline.go | 0.730194 | 0.478285 | polyline.go | starcoder |
package sierpinski
import (
"fmt"
"image/color"
"math"
"math/rand"
"github.com/hajimehoshi/ebiten/v2"
"github.com/hajimehoshi/ebiten/v2/ebitenutil"
"github.com/hajimehoshi/ebiten/v2/inpututil"
)
// speedFactor is how many pixels to set per tick.
var speedFactor = 10
var colorMappings = map[int]color.Color{
... | pkg/sierpinski/game.go | 0.757256 | 0.526038 | game.go | starcoder |
package geom
import (
"math"
"math/rand"
)
// Dir is a unit vector that specifies a direction in 3D space.
type Dir Vec
// Up is the positive Direction on the vertical (Y) axis.
var Up = Dir{0, 1, 0}
func SphericalDirection(theta, phi float64) (Dir, bool) {
x := math.Sin(theta) * math.Cos(phi)
y := math.Cos(the... | pkg/geom/dir.go | 0.869285 | 0.659494 | dir.go | starcoder |
package contracts
import (
"context"
"testing"
"github.com/adamluzsi/frameless/contracts/assert"
"github.com/adamluzsi/frameless/extid"
"github.com/adamluzsi/frameless"
"github.com/adamluzsi/testcase"
"github.com/stretchr/testify/require"
)
// Updater will request an update for a wrapped entity object in th... | contracts/Updater.go | 0.630116 | 0.658239 | Updater.go | starcoder |
package dstream
type concatVertical struct {
// The streams to be concatenated
streams []Dstream
// The index of the current stream within streams
pos int
// The number of observations in the concatenated stream
nobs int
// True if nobs is known yet (nobs is not known until reading
// the entire concatenat... | dstream/concatvertical.go | 0.760651 | 0.413832 | concatvertical.go | starcoder |
package tiles
import (
"fmt"
"math"
)
var RE float64 = 6378137.0
var ORIGIN = RE * math.Pi
var CE float64 = 2.0 * ORIGIN
var DEG2RAD float64 = math.Pi / 180.0
// WebMercator tile, numbered starting from upper left
type TileID struct {
Zoom uint8
X uint32
Y uint32
}
func NewTileID(zoom uint8, x uint32, y ... | tiles/tileid.go | 0.778481 | 0.454775 | tileid.go | starcoder |
package cdn
import (
"encoding/json"
)
// CustconfBandWidthLimit The pattern based bandwidth throttling policy allows you to limit the transfer rate of assets to end users based on a set of rules matching the request's HTTP User-Agent and/or the path. Each rule must be expressed in the following format: <User-Agent ... | pkg/cdn/model_custconf_band_width_limit.go | 0.869908 | 0.449091 | model_custconf_band_width_limit.go | starcoder |
package main
import "fmt"
// NewNodeData returns a pointer to a NodeData structure, initialized with the provided data
// parsing Terraform output, reference: https://github.com/hashicorp/terraform/blob/master/command/output.go
func NewNodeData(data []byte) (result *NodeData) {
result = &NodeData{string(data), -1}
... | src/createconfig/tfeparser.go | 0.739893 | 0.579638 | tfeparser.go | starcoder |
package collisions
import (
"github.com/TrashPony/Veliri/src/mechanics/gameObjects/detail"
"github.com/TrashPony/Veliri/src/mechanics/globalGame/game_math"
)
type Polygon struct {
Sides []*SideRec `json:"sides"`
centerX, centerY float64
Height, Width float64
Angle int
}
type SideRec st... | src/mechanics/globalGame/collisions/polygon.go | 0.752649 | 0.497192 | polygon.go | starcoder |
package pgn
import (
"fmt"
)
// Nag represents a numeric annotation glyph.
type Nag int
// String returns the common representation of the NAG if it has one (!, ?, !?,
// +-, -+, ...). Otherwise it returns $<nag> ($56, $123, ...).
func (n Nag) String() string {
if int(n) >= len(nagData) || nagData[n].str == "" {
... | pgn/nag.go | 0.767472 | 0.487307 | nag.go | starcoder |
package utils
import (
"sort"
)
type signedInt interface {
~int | ~int8 | ~int16 | ~int32 | ~int64
}
type unsignedInt interface {
~uint | ~uint8 | ~uint16 | ~uint32 | ~uint64
}
type float interface {
~float32 | ~float64
}
type number interface {
signedInt | unsignedInt | float
}
type enumerable interface {
... | utils.go | 0.831588 | 0.423041 | utils.go | starcoder |
package opc
// Colorbox
// Every pixel's r,g,b is linearly related to its x,y,z.
import (
"github.com/longears/pixelslinger/colorutils"
"github.com/longears/pixelslinger/midi"
"math"
"time"
)
func MakePatternSpatialColorBox(locations []float64) ByteThread {
return func(bytesIn chan []byte, bytesOut chan []byte... | opc/pattern-colorbox.go | 0.648466 | 0.476945 | pattern-colorbox.go | starcoder |
package streebog
import (
"encoding/binary"
"encoding/hex"
)
// bit512 is an effective representation of 512 bits.
// Go leaks 128+ bit native structures so this is the most efficient way for doing xor512bit.
type bit512 [8]uint64
// bit512FromBytes64 should be called only on bytes slice with len 64.
func bit512Fr... | hash/streebog/bit512.go | 0.625209 | 0.455622 | bit512.go | starcoder |
package criteria_bounding
import (
"fmt"
"github.com/Azbesciak/RealDecisionMaker/lib/utils"
)
type CriteriaBounding struct {
AllowedValuesRangeScaling float64 `json:"allowedValuesRangeScaling"`
DisallowNegativeValues bool `json:"disallowNegativeValues"`
}
type CriteriaInRangeBounding struct {
bounding *... | lib/model/criteria-bounding/criteria-bounding.go | 0.847873 | 0.414188 | criteria-bounding.go | starcoder |
package maps
import (
"constraints"
gs "github.com/kigichang/goscala"
"github.com/kigichang/goscala/slices"
)
func Make[K comparable, V any](a ...int) gs.Map[K, V] {
return newGeneralMap[K, V](a...)
}
func Empty[K comparable, V any]() gs.Map[K, V] {
return Make[K, V]()
}
func From[K comparable, V any](pairs ... | maps/maps.go | 0.676406 | 0.480296 | maps.go | starcoder |
package model
import (
"errors"
"reflect"
"strconv"
"time"
"unsafe"
)
var timeType = reflect.TypeOf(time.Time{})
type visit struct {
a1 unsafe.Pointer
a2 unsafe.Pointer
typ reflect.Type
}
type DiffResult struct {
DiffMap map[string]interface{}
Equal bool
}
func Equal(x, y interface{}) (*DiffResult, e... | model/diff.go | 0.519521 | 0.412885 | diff.go | starcoder |
package block
import "crypto/cipher"
type ecb struct {
block cipher.Block
blockSize int
}
// NewECBEncrypter returns a new cipher.BlockMode which uses the given Block cipher to encrypt given blocks in
// electronic code book mode (ECB). ECB is the most simple (and also most unsecure) mode in which a Block ci... | block/ecb.go | 0.776114 | 0.542257 | ecb.go | starcoder |
package gocvsimd
import "unsafe"
//go:noescape
func _SimdSse2MedianFilterRhomb3x3(src unsafe.Pointer, srcStride, width, height, channelCount uint64, dst unsafe.Pointer, dstStride uint64)
//go:noescape
func _SimdSse2MedianFilterSquare3x3(src unsafe.Pointer, srcStride, width, height, channelCount uint64, dst unsafe.Po... | sse2/SimdSse2MedianFilter_amd64.go | 0.594551 | 0.500488 | SimdSse2MedianFilter_amd64.go | starcoder |
package vision
import (
"fmt"
"image"
"image/color"
"image/draw"
"math"
"github.com/fogleman/gg"
)
// HoughPoint represents a single point in the Hough space with
// its score, theta and rho values and and minimum and maximum
// corresponding spatial points.
type HoughPoint struct {
Indexes []int
Score ... | hough.go | 0.773772 | 0.550184 | hough.go | starcoder |
package win
import (
"image"
"image/color"
)
type DIB struct {
// Pix holds the image's pixels, in B, G, R order. The pixel at
// (x, y) starts at Pix[(p.Rect.Max.Y-y-p.Rect.Min.Y-1)*p.Stride + (x-p.Rect.Min.X)*3].
Pix []uint8
// Stride is the Pix stride (in bytes) between vertically adjacent pixels.
Stride in... | win/dib_windows.go | 0.785432 | 0.571169 | dib_windows.go | starcoder |
package conv
// UInt8ToBytes is the fastest way to convert uint8 into byte slice
func UInt8ToBytes(n uint8, buf *[3]byte) []byte {
if n == 0 {
return digits1[0]
} else if n < 10 {
return digits1[n]
} else if n < 100 {
return digits2[n]
}
n = n - 100
if n < 100 {
buf[0] = '1'
} else {
n = n - 100
buf... | conv/uint.go | 0.678647 | 0.577376 | uint.go | starcoder |
package objects
import (
"fmt"
"github.com/alexandreLamarre/Golang-Ray-Tracing-Renderer/pkg/algebra"
"github.com/alexandreLamarre/Golang-Ray-Tracing-Renderer/pkg/canvas"
"github.com/alexandreLamarre/Golang-Ray-Tracing-Renderer/pkg/geometry/primitives"
"math"
"reflect"
)
//ErrorCSGNormal returns an error if csg.... | pkg/geometry/objects/CSG.go | 0.824462 | 0.636184 | CSG.go | starcoder |
package GoStats
import (
"math"
"sort"
)
const (
// MaxFloat64 is the biggest number that can be used in Go using the float64 type.
MaxFloat64 = math.MaxFloat64
// MinFloat64 is the smallest number that can be used in Go using the float64 type.
MinFloat64 = -(MaxFloat64)
)
// Mean of the float64 numbers.
func... | GoStats.go | 0.78964 | 0.559711 | GoStats.go | starcoder |
package webmercator
import (
"errors"
"fmt"
"math"
)
const (
RMajor = 6378137.0
RMinor = 6356752.3142
Ratio = RMinor / RMajor
)
const (
SRID = 3857
EarthRadius = RMajor
Deg2Rad = math.Pi / 180
Rad2Deg = 180 / math.Pi
PiDiv2 = math.Pi / 2.0
PiDiv4 = math.Pi / 4.0
MinXExtent = -... | maths/webmercator/main.go | 0.758689 | 0.401131 | main.go | starcoder |
package lmath
import (
"fmt"
"math"
)
const (
mat3Dim = 3
)
var (
Mat3Identity = Mat3{[9]float64{
1, 0, 0,
0, 1, 0,
0, 0, 1}}
)
type Mat3 struct {
mat [9]float64
}
// New Mat3 with the given values.
// Row-Order.
func NewMat3(
m11, m12, m13,
m21, m22, m23,
m31, m32, m33 float64) *Mat3 {
// 0 1 ... | lmath/mat3.go | 0.807461 | 0.664867 | mat3.go | starcoder |
package export
import "github.com/prometheus/client_golang/prometheus"
// IngestionRealtimeExporter contains all the Prometheus metrics that are possible to gather from the Jetty service
type IngestionRealtimeExporter struct {
EventsThrownAway *prometheus.GaugeVec `description:"number of events rejected beca... | pkg/export/ingestion_realtime.go | 0.712832 | 0.426501 | ingestion_realtime.go | starcoder |
package libs
const gaugeQueryPartForOccurrences = `
| sum(sliceGoodCount) as totalGood, sum(sliceTotalCount) as totalCount
| (totalGood/totalCount)*100 as SLO | format("%.2f%%",SLO) as sloStr
| fields SLO
`
const gaugeQueryPartForTimeslice = `
| timeslice 1m
| sum(sliceGoodCount) as timesliceGoodCount, sum(sliceTota... | libs/queries.go | 0.528047 | 0.469885 | queries.go | starcoder |
package chunk
import (
"bytes"
"sort"
"github.com/pingcap/tidb/parser/mysql"
"github.com/pingcap/tidb/types"
"github.com/pingcap/tidb/types/json"
)
// CompareFunc is a function to compare the two values in Row, the two columns must have the same type.
type CompareFunc = func(l Row, lCol int, r Row, rCol int) i... | util/chunk/compare.go | 0.517327 | 0.406509 | compare.go | starcoder |
package bn256
import (
"math/big"
)
// twistPoint implements the elliptic curve y²=x³+3/ξ over GF(p²). Points are
// kept in Jacobian form and t=z² when valid. The group G₂ is the set of
// n-torsion points of this curve over GF(p²) (where n = Order)
type twistPoint struct {
x, y, z, t gfP2
}
var twistB = &gfP2{
... | ioporaclenode/internal/pkg/kyber/pairing/bn256/twist.go | 0.756987 | 0.495667 | twist.go | starcoder |
package client
import (
"encoding/json"
)
// UiNodeImageAttributes struct for UiNodeImageAttributes
type UiNodeImageAttributes struct {
// Height of the image
Height int64 `json:"height"`
// A unique identifier
Id string `json:"id"`
NodeType string `json:"node_type"`
// The image's source URL. format: ... | internal/httpclient/model_ui_node_image_attributes.go | 0.756987 | 0.412353 | model_ui_node_image_attributes.go | starcoder |
package iso20022
// Set of elements providing further details on the account statement.
type AccountStatement1 struct {
// Unique and unambiguous identification of the account report, assigned by the account servicer.
Identification *Max35Text `xml:"Id"`
// Sequential number of the report, assigned by the account... | AccountStatement1.go | 0.771069 | 0.429788 | AccountStatement1.go | starcoder |
package model
import (
"math"
)
// Rect ...
type Rect struct {
A *Point
B *Point
C *Point
D *Point
}
// Polygon ...
type Polygon struct {
Points []*Point
}
// RectCollider ...
type RectCollider struct {
ID uint8
Rect *Rect
Pivot *Point
Look *Point
... | model/rect_collider.go | 0.799403 | 0.671995 | rect_collider.go | starcoder |
package predicate
import "strings"
// Transformation captures one transformation step in the predicate evaluation
// chain, with a `Description` and an actual transformation function `Func`.
type Transformation struct {
Description string
Func TransformFunc
}
// TransformFunc is the function type for use in... | pkg/utils/predicate/predicate.go | 0.846815 | 0.420957 | predicate.go | starcoder |
package interpreter
import (
"fmt"
"sort"
"strings"
"github.com/aws/aws-sdk-go/service/dynamodb"
)
// UpdaterFunc function used emule to UpdateItem expressions
type UpdaterFunc func(map[string]*dynamodb.AttributeValue, map[string]*dynamodb.AttributeValue)
// MatcherFunc function used to filter data
type Matcher... | interpreter/native.go | 0.629547 | 0.414366 | native.go | starcoder |
package transforms
import (
"math"
"github.com/dustismo/heavyfishdesign/path"
)
// Will rotate and scale the path so that the PathStartPoint and PathEndPoint equal StartPoint
// and EndPoint. This is useful for using svg to connect two points
type RotateScaleTransform struct {
StartPoint path.Point
EndPoint p... | transforms/rotate_scale.go | 0.793146 | 0.624179 | rotate_scale.go | starcoder |
package assert
import (
http "net/http"
url "net/url"
time "time"
)
func Conditionf(t TestingT, comp Comparison, msg string, args ...interface{}) bool {
return Condition(t, comp, append([]interface{}{msg}, args...)...)
}
func Containsf(t TestingT, s interface{}, contains interface{}, msg string, args ...interfac... | assertion_format.go | 0.727879 | 0.47926 | assertion_format.go | starcoder |
package threefish
import (
"crypto/cipher"
)
const (
// Size of a 256-bit block in bytes
blockSize256 = 32
// Number of 64-bit words per 256-bit block
numWords256 = blockSize256 / 8
// Number of rounds when using a 256-bit cipher
numRounds256 = 72
)
type cipher256 struct {
t [(tweakSize / 8) + 1]uint64
k... | threefish/threefish256.go | 0.603815 | 0.536556 | threefish256.go | starcoder |
package set
type Set[T comparable] map[T]struct{}
func New[T comparable]() Set[T] {
return make(map[T]struct{})
}
func Add[T comparable](s Set[T], v T) {
s[v] = struct{}{}
}
func Remove[T comparable](s Set[T], v T) {
delete(s, v)
}
func Contains[T comparable](s Set[T], v T) bool {
_, ok := s[v]
return ok
}
f... | set/set.go | 0.666605 | 0.506713 | set.go | starcoder |
package internal
import (
"github.com/johnfercher/maroto/internal/fpdf"
"github.com/johnfercher/maroto/pkg/props"
)
const (
maxPercent = 100.0
)
// Math is the abstraction which deals with useful calc.
type Math interface {
GetRectCenterColProperties(imageWidth float64, imageHeight float64, colWidth float64, col... | internal/math.go | 0.808786 | 0.651175 | math.go | starcoder |
package features
// Followgrams [same as k-skip n-grams]:
// - We know that an n-gram of a string is any n-length substring of that string.
// - By analogy, we define an "n-followgram" to be a pair "ab" such that "b" follows "a" in the parent
// string within a window of size n+1 (e.g. the string "abcd" contains the... | features/followgrams.go | 0.758689 | 0.531878 | followgrams.go | starcoder |
package grid
import (
"fmt"
"math"
"github.com/gitchander/permutation"
)
func init() {
// Original foxhole problem definition
// BaseGrid = CreateLinearGrid(5)
BaseGrid = CreatePrismGrid([]int{8, 8})
}
/*
The default grid definition that will be used everywhere.
The format for this is a list of connecti... | grid/gridDefinition.go | 0.743634 | 0.463869 | gridDefinition.go | starcoder |
package airtime
import (
"errors"
"math"
"time"
)
// CodingRate defines the coding-rate type.
type CodingRate int
// Available coding-rates.
const (
CodingRate45 CodingRate = 1
CodingRate46 CodingRate = 2
CodingRate47 CodingRate = 3
CodingRate48 CodingRate = 4
)
// CalculateLoRaAirtime calculates the airtime... | airtime/airtime.go | 0.811153 | 0.491639 | airtime.go | starcoder |
package parser
import (
"github.com/viant/parsly"
ast2 "github.com/viant/velty/ast"
aexpr "github.com/viant/velty/ast/expr"
)
var dataTypeMatchers = []*parsly.Token{String, Boolean, Number}
func matchOperand(cursor *parsly.Cursor, candidates ...*parsly.Token) (*parsly.Token, ast2.Expression, error) {
matched := ... | parser/operand.go | 0.558568 | 0.452113 | operand.go | starcoder |
package sqlb
import (
"bytes"
"encoding/json"
"fmt"
r "reflect"
)
/*
Known SQL operations used in JEL. Serves as a whitelist, allowing us to
differentiate them from casts, and describes how to transform JEL Lisp-style
calls into SQL expressions (prefix, infix, etc.). This is case-sensitive and
whitespace-sensitiv... | sqlb_jel.go | 0.709019 | 0.501953 | sqlb_jel.go | starcoder |
package httpref
// Statuses represents all of the defined HTTP statuses
var Statuses = References{
{
Name: "1xx",
IsTitle: true,
Summary: "Informational response",
Description: `https://developer.mozilla.org/en-US/docs/Web/HTTP/Status
https://en.wikipedia.org/wiki/List_of_HTTP_status_codes#1xx_Informationa... | statuses.go | 0.882927 | 0.569374 | statuses.go | starcoder |
package model
import (
"fmt"
"strconv"
"strings"
"sync"
"unsafe"
"github.com/timescale/promscale/pkg/prompb"
)
// SeriesID represents a globally unique id for the series. This should be equivalent
// to the PostgreSQL type in the series table (currently BIGINT).
type SeriesID int64
const invalidSeriesID = -1... | pkg/pgmodel/model/series.go | 0.739986 | 0.460471 | series.go | starcoder |
package reward
import (
"github.com/filecoin-project/go-state-types/abi"
"github.com/filecoin-project/go-state-types/big"
"github.com/filecoin-project/specs-actors/v2/actors/util/smoothing"
)
// A quantity of space * time (in byte-epochs) representing power committed to the network for some duration.
type Spaceti... | actors/builtin/reward/reward_state.go | 0.778313 | 0.523238 | reward_state.go | starcoder |
package main
import "math"
type Pot struct {
minRaise money
totalToCall money
potNumber uint
bets []Bet
}
type Bet struct {
potNumber uint
player guid
value money
}
//newPot is a constructor for a new Pot struct
func newPot() *Pot {
pot := new(Pot)
pot.bets = make([]Bet, 0)
return pot
}
... | pot.go | 0.599485 | 0.422624 | pot.go | starcoder |
package zebra
import "fmt"
/* The Zebra Puzzle facts given:
1. There are five houses.
2. The Englishman lives in the red house.
3. The Spaniard owns the dog.
4. Coffee is drunk in the green house.
5. The Ukrainian drinks tea.
6. The green house is immediately to the right of the ivory house.
7. The Old Gold smoker o... | exercises/zebra-puzzle/example.go | 0.566978 | 0.537588 | example.go | starcoder |
package core
import "math/rand"
import "github.com/zhenghaoz/gorse/base"
// Split dataset to a training set and a test set with ratio.
func Split(data DataSetInterface, testRatio float64) (train, test DataSetInterface) {
testSize := int(float64(data.Count()) * testRatio)
perm := rand.Perm(data.Count())
// Test Dat... | core/splitter.go | 0.559771 | 0.543287 | splitter.go | starcoder |
package main
type Metrica struct {
Name string
Units string
DataKey *MetricaDataKey
DataSource *MetricsDataSource
}
type MetricaDataKey struct {
StatBlockKey string
KeyInsideStatBlock string
}
func (metrica *Metrica) GetName() string {
return metrica.Name
}
func (metrica *Metrica) GetUnits(... | metrics.go | 0.511717 | 0.400427 | metrics.go | starcoder |
package world
import "github.com/lquesada/cavernal/lib/g3n/engine/math32"
import "github.com/lquesada/cavernal/model"
type Coords struct {
X int
Z int
}
type World struct {
floor [][]ITile
tileSize float32
zeroX int
zeroZ int
defaultTile ITile
gravity float32
}
func Empty(tileSize, gravity float32) *World ... | world/world.go | 0.609059 | 0.513242 | world.go | starcoder |
package iso20022
// Formal document used to record a fact and used as proof of the fact, in the context of a commercial trade transaction.
type CertificateDataSet1 struct {
// Identifies the certificate data set.
DataSetIdentification *DocumentIdentification1 `xml:"DataSetId"`
// Specifies the type of the certifi... | CertificateDataSet1.go | 0.733165 | 0.403626 | CertificateDataSet1.go | starcoder |
package mappings
// Compliance mapping used to create the `comp-<version>-s-<date>` index
var ComplianceSumDate = Mapping{
Index: IndexNameSum,
Type: DocType,
Timeseries: true,
Mapping: `
{
"index_patterns": ["` + IndexNameSum + `-20*"],
"settings": {
"analysis": {
"analyzer": {
"a... | components/compliance-service/ingest/ingestic/mappings/comp-sum-date.go | 0.715126 | 0.479138 | comp-sum-date.go | starcoder |
package radiusgyration
import (
"bufio"
"fmt"
"strconv"
"strings"
)
// readCfgFirst reads the first configuration. It reads the number of atoms, the
// columns and performs the usual calculations like in readCfg.
func (r *RadiusGyration) readCfgFirst(rd *bufio.Reader) (xyz [][3]float64, types []string, err error)... | pkg/radiusgyration/read.go | 0.616474 | 0.411761 | read.go | starcoder |
package ns
/**
* Configuration for Policy Based Routing(PBR) entry resource.
*/
type Nspbr struct {
/**
* Name for the PBR. Must begin with an ASCII alphabetic or underscore \(_\) character, and must contain only ASCII alphanumeric, underscore, hash \(\#\), period \(.\), space, colon \(:\), at \(@\), equals \(=\), a... | resource/config/ns/nspbr.go | 0.821903 | 0.499329 | nspbr.go | starcoder |
package page
import (
"bytes"
)
var _ CellTyper = (*RecordCell)(nil)
var _ CellTyper = (*PointerCell)(nil)
//go:generate stringer -type=CellType
// CellType is the type of a page.
type CellType uint8
const (
// CellTypeUnknown indicates a corrupted page or an incorrectly decoded
// cell.
CellTypeUnknown CellTy... | internal/engine/page/cell.go | 0.649467 | 0.551211 | cell.go | starcoder |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.