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 evaluator
import (
obj "aura/src/object"
"fmt"
"reflect"
)
// evluate infix expressions between objects
func evaluateInfixExpression(operator string, left obj.Object, right obj.Object) obj.Object {
switch {
case left.Type() == obj.INTEGERS && right.Type() == obj.INTEGERS:
return evaluateIntegerInfixEx... | src/evaluator/operators.go | 0.535827 | 0.548794 | operators.go | starcoder |
package bytes
import (
"unicode"
"github.com/flier/gocombine/pkg/parser"
"github.com/flier/gocombine/pkg/parser/choice"
"github.com/flier/gocombine/pkg/parser/repeat"
"github.com/flier/gocombine/pkg/parser/token"
"github.com/flier/gocombine/pkg/stream"
)
// Any parses any byte.
func Any() parser.Func[byte, byt... | pkg/parser/bytes/byte.go | 0.800614 | 0.417865 | byte.go | starcoder |
package job
import (
"os"
lotuscli "github.com/filecoin-project/lotus/cli"
"github.com/urfave/cli/v2"
"github.com/filecoin-project/lily/commands"
"github.com/filecoin-project/lily/lens/lily"
"github.com/filecoin-project/lily/schedule"
)
type watchOps struct {
confidence int
workers int
bufferSize int
}
... | commands/job/watch.go | 0.541651 | 0.415847 | watch.go | starcoder |
package crypto
import (
"crypto/subtle"
"fmt"
"math/big"
C25519 "github.com/incognitochain/go-incognito-sdk-v2/crypto/curve25519"
)
// Scalar represents a scalar of an elliptic curve.
type Scalar struct {
key C25519.Key
}
// GetKey returns the key of a Scalar.
func (sc Scalar) GetKey() C25519.Key {
return sc.... | crypto/scalar.go | 0.842896 | 0.47025 | scalar.go | starcoder |
package tuple
import (
"log"
"math"
)
const EPSILON = 0.00001
type Tuple struct {
X float64
Y float64
Z float64
W float64
}
func New(x, y, z, w float64) Tuple {
return Tuple{X: x, Y: y, Z: z, W: w}
}
func Point(x, y, z float64) Tuple {
return Tuple{X: x, Y: y, Z: z, W: 1.0}
}
func Vector(x, y, z float64) ... | tuple/tuple.go | 0.822653 | 0.664894 | tuple.go | starcoder |
package util
/**
* This interface imposes a total ordering on the objects of each class that
* implements it. This ordering is referred to as the class's <i>natural
* ordering</i>, and the class's {@code compareTo} method is referred to as
* its <i>natural comparison method</i>.<p>
*
* Lists (and arrays) of ob... | go/util/comparable.go | 0.919145 | 0.723212 | comparable.go | starcoder |
package main
/*
https://leetcode.com/problems/robot-return-to-origin/,
accessed 16 April 2019
There is a robot starting at position (0, 0), the origin, on a 2D plane.
Given a sequence of its moves, judge if this robot ends up at (0, 0)
after it completes its moves.
The move sequence is represented by a str... | 0657_RobotReturnToOrigin/main.go | 0.854945 | 0.407717 | main.go | starcoder |
package main
import (
"math"
)
type Camera struct {
Transformer
HSize int // Image width in pixel
VSize int // Image height in pixel
FOV float64 // Field of view in radians
aspect float64 // Aspect ratio
halfwidth float64 // Half width of projected image
halfheight float64 // Ha... | camera.go | 0.864811 | 0.536009 | camera.go | starcoder |
package timestore
import "time"
type FixedBoolSamples struct {
since time.Time
until time.Time
granularity time.Duration
earliestPos *int
latestPos *int
data []bool
times []time.Time
}
func (s *FixedBoolSamples) Len() int {
return len(s.data)
}
func (s *FixedBoolSamples) All() ([... | generated-fixed.go | 0.558568 | 0.555315 | generated-fixed.go | starcoder |
package main
import (
. "../utils"
"container/ring"
"fmt"
"strconv"
)
func main() {
rawLines := ReadFile("input1")
lines := make([]int64, len(rawLines))
for i, line := range rawLines {
z, _ := strconv.ParseInt(line, 10, 64)
lines[i] = z
}
var freq int64 = 0
for _, z := range lines {
freq += z
}
fm... | level_01/level_01.go | 0.625781 | 0.544499 | level_01.go | starcoder |
package graphdata
import (
"github.com/CloudNativeDataPlane/cndp/lang/go/tools/pkgs/asciichart"
"github.com/rivo/tview"
)
// GraphPoints used to build the graph
type GraphPoints []float64
// GraphData contains the points and name of graph
type GraphData struct {
index int
name string
maxPoints int
po... | lang/go/tools/pkgs/graphdata/graphdata.go | 0.767603 | 0.546436 | graphdata.go | starcoder |
package bgls
import (
"crypto/rand"
"math/big"
)
//MultiSig holds set of keys and one message plus signature
type MultiSig struct {
keys []Point2
sig Point1
msg []byte
}
//AggSig holds paired sequences of keys and messages, and one signature
type AggSig struct {
keys []Point2
msgs [][]byte
sig Point1
}
... | bgls.go | 0.68616 | 0.435781 | bgls.go | starcoder |
package cbor
/**
* NegativeInteger value is the -1 minus the encoded unsigned integer.
*
* When decoding: decodedValue = -1 - encodedValue
* When encoding: encodedValue = -1 - decodedValue
*/
import (
"fmt"
"math"
)
// NegativeInteger8 wraps a negative integer with 8 bits (range: -1 to -127)
type NegativeInte... | cbor/negative.go | 0.905589 | 0.499817 | negative.go | starcoder |
package processor
var cbInstructions []func()
// ExecuteCBInstruction executes given operation from extended instruction set
// and returns the amount of cycles takens.
func ExecuteCBInstruction(cpu *CPU, opCode byte) int {
if len(cbInstructions) != 0x100 {
initCBInstructionList(cpu)
}
cbInstructions[opCode]()
... | pkg/processor/cbinstructions.go | 0.508056 | 0.648181 | cbinstructions.go | starcoder |
package engine
import (
"math"
)
// Piece piece type
type Piece interface {
// Name Piece name
Identifier() PieceIdentifier
// Color piece color
Color() Color
// CanMove check if piece can be moved from, to Square,
// returns true if it's possible, even if a piece can be eaten
CanMove(board Board, movements [... | engine/pieces.go | 0.796372 | 0.412944 | pieces.go | starcoder |
// Package semver provides a way to parse and compare semantic versions.
package semver
import (
"errors"
"strconv"
"strings"
)
// SemVer describes a semantic version number.
type SemVer struct {
Major int
Minor int
Patch int
}
// New takes a semantic version number as a string and returns a SemVer object.
fu... | src/vendor/github.com/govend/govend/deps/semver/semver.go | 0.687105 | 0.443962 | semver.go | starcoder |
package rules
import (
"fmt"
"github.com/maczikasz/go-runs/internal/model"
"sync"
)
type (
RuleRunbookPair struct {
RunbookId string
Rule Rule
}
PriorityRuleManager struct {
ruleLock *sync.RWMutex
nameMatchers []RuleRunbookPair
messageMatchers []RuleRunbookPair
tagMatchers []Rule... | internal/rules/priority.go | 0.557123 | 0.456773 | priority.go | starcoder |
package runtime
import (
"../compiler"
"../datatypes"
"../types"
"bufio"
"fmt"
"os"
"strconv"
"strings"
"github.com/eiannone/keyboard"
)
func replaceAtIndex(in string, r rune, i uint64) string {
out := []rune(in)
out[i] = r
return string(out)
}
type stack []datatypes.Data
type intStack []int
var varAdd... | src/runtime/runtime.go | 0.551815 | 0.41567 | runtime.go | starcoder |
package gen
import (
"fmt"
)
type Voicing struct {
Chords [][]Note `json:"chords"`
Type string `json:"type"`
}
type Note int
// The description of a scale exercise. This describes how to build a
// scale exercise.
type Scale struct {
Intervals string // Intervals between the notes, must describe 1 octave.
... | gen/gen.go | 0.830388 | 0.47457 | gen.go | starcoder |
package twothree
import (
"strconv"
)
type tree struct {
root node
}
/// Creates new EmptyTree
func NewTree() *tree {
return &tree{}
}
func (t *tree) Insert(value int) {
if t.root == nil {
t.root = two{k: value}
} else {
t.root = t.root.insert(value)
}
}
/// Checks if the tree contains the given value
fu... | src/trees/twothree/tree.go | 0.844281 | 0.482795 | tree.go | starcoder |
package paths
// Parse the script expression language embedded within path expressions.
// It's a small subset of JavaScript (at least I hope it's a small subset.)
import (
// "errors"
"fmt"
"regexp"
)
// ParseScriptExpression gives direct access to the secondary parser for expressions, returning an Expr tree rep... | paths/parseexpr.go | 0.630912 | 0.465205 | parseexpr.go | starcoder |
package contagiongo
import (
"bytes"
"fmt"
)
// HostNetwork interface describes a host population connected together as
// a network.
type HostNetwork interface {
// ConnectedPopSize returns the total number of hosts in the network.
ConnectedPopSize() int
// GetNeighbors retrieves the unordered list of neighbors... | network.go | 0.796015 | 0.49707 | network.go | starcoder |
package query
import (
"fmt"
"sort"
)
// FunctionSet contains an explicit set of functions to be available in a
// Bloblang query.
type FunctionSet struct {
constructors map[string]FunctionCtor
specs []FunctionSpec
}
// Add a new function to this set by providing a spec (name and documentation),
// a cons... | internal/bloblang/query/function_set.go | 0.78842 | 0.459379 | function_set.go | starcoder |
package app
var symbolBipIDs map[string]uint32
// BipSymbolID returns the asset ID associated with a given ticker symbol.
// While there are a number of duplicate ticker symbols in the BIP ID list
// (cpc, cmt, xrd, dst, one, ask, ...), those are disambiguated in the bipIDs
// map here, so must be referenced with th... | app/bip-id.go | 0.744285 | 0.486941 | bip-id.go | starcoder |
package common
import (
"crypto/sha256"
"encoding/hex"
"github.com/turingchain2020/turingchain/common/crypto/sha3"
"golang.org/x/crypto/ripemd160"
)
//Sha256Len sha256 bytes len
const Sha256Len = 32
//Hash type
type Hash [Sha256Len]byte
//BytesToHash []byte -> hash
func BytesToHash(b []byte) Hash {
var h Has... | common/hash.go | 0.640523 | 0.42054 | hash.go | starcoder |
package worker
import (
"fmt"
"golang.org/x/net/context"
"gopkg.in/src-d/go-vitess.v1/sqlescape"
"gopkg.in/src-d/go-vitess.v1/sqltypes"
"gopkg.in/src-d/go-vitess.v1/vt/topo/topoproto"
"gopkg.in/src-d/go-vitess.v1/vt/wrangler"
tabletmanagerdatapb "gopkg.in/src-d/go-vitess.v1/vt/proto/tabletmanagerdata"
topod... | vendor/gopkg.in/src-d/go-vitess.v1/vt/worker/chunk.go | 0.53777 | 0.418578 | chunk.go | starcoder |
package pkg
import (
"fmt"
"io/ioutil"
"strings"
"gopkg.in/yaml.v2"
)
// Data interface - built from YAML data files.
type Data interface {
getChild(key string) (Data, error)
getValue() (string, error)
getList() ([]Data, error)
}
// DataNode - means there is more data below.
type DataNode map[string]Data
fun... | pkg/data.go | 0.587588 | 0.41745 | data.go | starcoder |
package hamming
// SSE4.x PopCnt is 10x slower
// References: check out Hacker's Delight
const (
m1 uint64 = 0x5555555555555555 //binary: 0101...
m2 uint64 = 0x3333333333333333 //binary: 00110011..
m4 uint64 = 0x0f0f0f0f0f0f0f0f //binary: 4 zeros, 4 ones ...
m8 uint64 = 0x00ff00ff00ff00ff //binary: 8 zeros... | vendor/gx/ipfs/QmeWQMDa5dSdP4n8WDeoY5z8L2EKVqF4ZvK4VEHsLqXsGu/hamming/hamming.go | 0.656328 | 0.643217 | hamming.go | starcoder |
package termui
import "image"
// Cell is a rune with assigned Fg and Bg
type Cell struct {
Ch rune
Fg Attribute
Bg Attribute
X, Y int
UIWidth int
BytesOff int
}
// Buffer is a renderable rectangle cell data container.
type Buffer struct {
IfNotRenderByTermUI bool
Area image.Rectan... | 3rdlib/github.com/gizak/termui/buffer.go | 0.78838 | 0.538498 | buffer.go | starcoder |
package strftime
import (
"strings"
"time"
)
// Parse a string with the specified strftime layout
func Parse(layout, value string) (t time.Time, err error) {
return time.Parse(Layout(layout), value)
}
// ParseInLocation is like Parse but differs in two important ways.
// First, in the absence of time zone informa... | strftime.go | 0.750004 | 0.422386 | strftime.go | starcoder |
package types
import (
"fmt"
"github.com/JFJun/go-substrate-rpc-client/v3/scale"
)
// Bytes represents byte slices. Bytes has a variable length, it is encoded with a scale prefix
type Bytes []byte
// NewBytes creates a new Bytes type
func NewBytes(b []byte) Bytes {
return Bytes(b)
}
// BytesBare represents byt... | types/bytes.go | 0.858185 | 0.459076 | bytes.go | starcoder |
package sprite
import (
"github.com/go-gl/mathgl/mgl32"
"github.com/tsunyoku/danser/app/bmath"
"github.com/tsunyoku/danser/framework/graphics/batch"
"github.com/tsunyoku/danser/framework/graphics/texture"
"github.com/tsunyoku/danser/framework/math/animation"
color2 "github.com/tsunyoku/danser/framework/math/colo... | framework/graphics/sprite/sprite.go | 0.717804 | 0.514766 | sprite.go | starcoder |
package transform
import (
"phys/vect"
"math"
)
type Rotation struct {
//sine and cosine.
C, S float32
}
func NewRotation(angle float32) Rotation {
return Rotation{
C: float32(math.Cos(float64(angle))),
S: float32(math.Sin(float64(angle))),
}
}
func (rot *Rotation) SetIdentity() {
rot.S = 0
rot.C = 1
}
... | vendor/phys/transform/transform.go | 0.840095 | 0.602325 | transform.go | starcoder |
package schema
import "github.com/dolthub/dolt/go/store/types"
// Schema is an interface for retrieving the columns that make up a schema
type Schema interface {
// GetPKCols gets the collection of columns which make the primary key.
GetPKCols() *ColCollection
// GetNonPKCols gets the collection of columns which... | go/libraries/doltcore/schema/schema.go | 0.649356 | 0.46035 | schema.go | starcoder |
package f32
import "strconv"
// A Point is a two dimensional point.
type Point struct {
X, Y float32
}
// String return a string representation of p.
func (p Point) String() string {
return "(" + strconv.FormatFloat(float64(p.X), 'f', -1, 32) +
"," + strconv.FormatFloat(float64(p.Y), 'f', -1, 32) + ")"
}
// A R... | pkg/gel/gio/f32/f32.go | 0.899675 | 0.654784 | f32.go | starcoder |
package histogram
import (
"fmt"
"math"
"sort"
"github.com/spf13/cast"
)
// Histogram holds a count of values partionned over buckets.
type Histogram struct {
// Min is the size of the smallest bucket.
Min int
// Max is the size of the biggest bucket.
Max int
// Count is the total size of all buckets.
Coun... | histogram/histogram.go | 0.788176 | 0.548855 | histogram.go | starcoder |
package calendar
import (
"math"
"time"
)
type Recurrence struct {
StartDate time.Time // Date to start Recurrence. Note that time and time zone information is NOT used in calculations
RecurrencePatternCode string // D for daily, W for weekly, M for monthly or Y for yearly
RecurEvery ... | recurrence.go | 0.673729 | 0.461988 | recurrence.go | starcoder |
package gofakeit
import (
"errors"
"math/rand"
)
// Weighted will take in an array of options and weights and return a random selection based upon its indexed weight
func Weighted(options []interface{}, weights []float32) (interface{}, error) {
return weighted(globalFaker.Rand, options, weights)
}
// Weighted wil... | weighted.go | 0.820182 | 0.458167 | weighted.go | starcoder |
package mapping
import (
"errors"
"fmt"
"strings"
"github.com/Jeffail/benthos/v3/internal/bloblang/query"
"github.com/Jeffail/benthos/v3/lib/types"
"github.com/Jeffail/gabs/v2"
)
//------------------------------------------------------------------------------
// AssignmentContext contains references to all po... | internal/bloblang/mapping/assignment.go | 0.699254 | 0.474631 | assignment.go | starcoder |
package plaid
import (
"encoding/json"
)
// JWKPublicKey A JSON Web Key (JWK) that can be used in conjunction with [JWT libraries](https://jwt.io/#libraries-io) to verify Plaid webhooks
type JWKPublicKey struct {
// The alg member identifies the cryptographic algorithm family used with the key.
Alg string `json:"... | plaid/model_jwk_public_key.go | 0.778186 | 0.49347 | model_jwk_public_key.go | starcoder |
package iso20022
// Specifies the type of price and information about the price.
type OtherPrices2 struct {
// Specifies the maximum price.
Maximum *Price4 `xml:"Max,omitempty"`
// Specifies the transaction price.
Transaction *Price4 `xml:"Tx,omitempty"`
// Market price including or excluding the broker's comm... | OtherPrices2.go | 0.872415 | 0.481698 | OtherPrices2.go | starcoder |
package intervaltree
import (
"time"
"errors"
// "fmt"
)
// wishlist
// polymorphic intervals with an interface and a method to compare them
// a payload within each interval
// AVL tree or red black tree insertion/deletion instead of BST
/*
Base IntervalTree class.
Entry point for the tree (i... | intervaltree.go | 0.570571 | 0.444083 | intervaltree.go | starcoder |
package client
import (
"bytes"
"context"
"encoding/binary"
"errors"
"math"
"reflect"
pb "github.com/socketfunc/faas/store/proto"
"google.golang.org/grpc"
)
const (
tagKey = "store"
)
func encodeEntity(value interface{}) (*pb.Entity, error) {
rv := reflect.ValueOf(value)
if rv.Kind() == reflect.Ptr && !... | store/client/client.go | 0.5 | 0.435902 | client.go | starcoder |
package solutions
import (
"math"
"sort"
)
func init() {
Map[10] = Solution10
}
type AsteroidMap struct {
Map [][]string
Asteroids [][]int
}
func BuildAsteroidMap(lines chan string) *AsteroidMap {
y := 0
aMap := [][]string{}
asteroids := [][]int{}
for line := range lines {
row := []string{}
for x... | pkg/solutions/aoc10.go | 0.737253 | 0.477859 | aoc10.go | starcoder |
package token
import (
"strings"
"unicode"
"github.com/gnames/gnfinder/io/dict"
)
// Features keep properties of a token as a possible candidate for a
// name part.
type Features struct {
// IsCapitalized is true if the first rune that is letter, is capitalized.
IsCapitalized bool
// HasDash is true if token ... | ent/token/features.go | 0.637934 | 0.483953 | features.go | starcoder |
package asm_arm64
import (
"github.com/tetratelabs/wazero/internal/asm"
"github.com/tetratelabs/wazero/internal/asm/golang_asm"
)
// NewAssembler implements asm.NewAssembler and is used by default.
// This returns an implementation of Assembler interface via our homemade assembler implementation.
func NewAssembler(... | vendor/github.com/tetratelabs/wazero/internal/asm/arm64/assembler.go | 0.778228 | 0.433322 | assembler.go | starcoder |
package swagger
import "math"
type InterestCalculator struct {
ICalculator
}
// Calculate loan repayment based on frequency
func (InterestCalculator) CalculateRepayment(InterestRate float64, LoanTerm int32, LoanAmount float64, totalNumberOfPayments int32) (repayment float64) {
if InterestRate != 0 {
rate := (In... | go/interest_calculator.go | 0.777131 | 0.532486 | interest_calculator.go | starcoder |
package main
import (
"crypto/sha256"
"encoding/hex"
"errors"
"fmt"
"golang.org/x/crypto/ripemd160"
)
// Point is a type for a bitcoin public point.
type Point struct {
x, y [32]byte
}
// SetHex takes two hexidecimal strings and decodes them into the receiver.
func (p *Point) SetHex(x, y string) error {
if l... | tasks/Bitcoin-public-point-to-address/bitcoin-public-point-to-address.go | 0.710025 | 0.40251 | bitcoin-public-point-to-address.go | starcoder |
package noise
type ImplicitGradient struct {
gradientX0 float64
gradientY0 float64
gradientZ0 float64
gradientW0 float64
gradientU0 float64
gradientV0 float64
gradientX1 float64
gradientY1 float64
gradientZ1 float64
gradientW1 float64
gradientU1 float64
gradientV1 float64
length2 float64
length3 fl... | server/game/universe/generator/texture/noise/implicit-gradient.go | 0.823825 | 0.581065 | implicit-gradient.go | starcoder |
package format
import (
"fmt"
"strings"
"time"
)
// Bytes attaches a unit to the bytes value and makes it human readable.
func Bytes(bytes int64) string {
if bytes >= 1e12 {
return fmt.Sprintf("%dTB", bytes/1e12)
} else if bytes >= 1e9 {
return fmt.Sprintf("%dGB", bytes/1e9)
} else if bytes >= 1e6 {
retur... | internal/format/format.go | 0.68742 | 0.51812 | format.go | starcoder |
package lossypng
import (
"image"
"image/color"
"image/draw"
)
const (
// NoConversion does not convert the image
NoConversion = iota
// GrayscaleConversion convert image to grayscale
GrayscaleConversion
// RGBAConversion convert image to 32-bit color
RGBAConversion
)
const deltaComponents = 4
type color... | lossypng.go | 0.747247 | 0.567517 | lossypng.go | starcoder |
package arn
import (
"fmt"
"image"
"math"
)
// HSLColor ...
type HSLColor struct {
Hue float64 `json:"hue"`
Saturation float64 `json:"saturation"`
Lightness float64 `json:"lightness"`
}
// String returns a representation like hsl(0, 0%, 0%).
func (color HSLColor) String() string {
return fmt.Sprintf("... | arn/HSLColor.go | 0.869355 | 0.432663 | HSLColor.go | starcoder |
package router
import (
"context"
"fmt"
"reflect"
"regexp"
"strings"
)
// Index contains the key and it's index of the submatches.
type Index struct {
// Key is the name for the value.
Key string
// Pos is the index of value in submatches.
Pos int
}
// RegexpNode contains information for matching a regexp s... | router/regexp.go | 0.6137 | 0.433022 | regexp.go | starcoder |
package treap
import "bytes"
// Iterator represents an iterator for forwards and backwards iteration over the contents of a treap (mutable or immutable).
type Iterator struct {
t *Mutable // Mutable treap iterator is associated with or nil
root *treapNode // Root node of treap iterator is associated... | pkg/util/treap/treapiter.go | 0.837321 | 0.528473 | treapiter.go | starcoder |
package ecpayBase
import (
"encoding/json"
)
// AioCheckOutCreditPeriodOption struct for AioCheckOutCreditPeriodOption
type AioCheckOutCreditPeriodOption struct {
// **每次授權金額** 每次要授權(扣款)的金額。 注意事項: 綠界會依此次授權金額`PeriodAmount`所設定的金額做為之後固定授權的金額。 交易金額`TotalAmount`設定金額必須和授權金額`PeriodAmount`相同。 請帶整數,不可有小數點。僅限新台幣。
... | base/model_aio_check_out_credit_period_option.go | 0.636918 | 0.444324 | model_aio_check_out_credit_period_option.go | starcoder |
package staticarray
import (
"github.com/influxdata/flux/array"
"github.com/influxdata/flux/memory"
"github.com/influxdata/flux/semantic"
)
type ints struct {
data []int64
alloc *memory.Allocator
}
func Int(data []int64) array.Int {
return &ints{data: data}
}
func (a *ints) Type() semantic.Type {
return sem... | internal/staticarray/int.go | 0.606032 | 0.494141 | int.go | starcoder |
package pricing
import (
"fmt"
"go.uber.org/zap"
"github.com/transcom/mymove/pkg/models"
)
// parseOtherIntlPrices: parser for: 3d) Other International Prices
var parseOtherIntlPrices processXlsxSheet = func(params ParamConfig, sheetIndex int, logger Logger) (interface{}, error) {
// XLSX Sheet consts
const xl... | pkg/parser/pricing/parse_other_intl_prices.go | 0.500244 | 0.487551 | parse_other_intl_prices.go | starcoder |
package geom
/*
This file describes optional Interfaces to make geometries mutable.
*/
// PointSetter is a mutable Pointer.
type PointSetter interface {
Pointer
SetXY([2]float64) error
}
// PointZSetter is a mutable PointZer
type PointZSetter interface {
PointZer
SetXYZ([3]float64) error
}
// PointMSetter is a... | set_geom.go | 0.673514 | 0.45538 | set_geom.go | starcoder |
package objects
type AsicGlobalState struct {
baseObj
ModuleId uint8 `SNAPROUTE: "KEY", ACCESS:"r", MULTIPLICITY: "1", DESCRIPTION:"Module identifier"`
VendorId string `DESCRIPTION: "Vendor identification value"`
PartNumber string `DESCRIPTION: "Part number of underlying switching asic"`
RevisionId strin... | OpenSnaproute/snaproute/src/models/objects/asicdObjects.go | 0.660829 | 0.510069 | asicdObjects.go | starcoder |
// This package implements a basic LISP interpretor for embedding in a go program for scripting.
// This file contains the built-in primitive functions.
package golisp
import (
"fmt"
)
func RegisterRelativePrimitives() {
MakePrimitiveFunction("<", "2", LessThanImpl)
MakePrimitiveFunction(">", "2", GreaterThanImp... | prim_relative_logical.go | 0.701202 | 0.433022 | prim_relative_logical.go | starcoder |
package kratos
import (
"encoding/json"
)
// VolumeUsageData VolumeUsageData Usage details about the volume. This information is used by the `GET /system/df` endpoint, and omitted in other endpoints.
type VolumeUsageData struct {
// The number of containers referencing this volume. This field is set to `-1` if the... | internal/httpclient/model_volume_usage_data.go | 0.790894 | 0.412116 | model_volume_usage_data.go | starcoder |
package spaceapivalidator
// CommitHash contains the hash of the commit the Validate function validates against
var CommitHash = "19afba712e0b9e9ab8138d3b1fd55d3523898872"
// SpaceAPISchemas load from the repository as a map
var SpaceAPISchemas = map[string]string{
"12": `{
"$id": "https://schema.spaceapi.io/12.js... | schemas.go | 0.704668 | 0.471284 | schemas.go | starcoder |
package helpers
import (
"fmt"
"strconv"
)
// TranslateStringArrToIntArr translates an array of strings to an array of ints
func TranslateStringArrToIntArr(a []string) (c []int) {
b := make([]int, len(a))
for i := 0; i < len(a); i++ {
b[i], _ = strconv.Atoi(a[i])
}
return b
}
// SumIntArrValues sums up all v... | helpers/arrayHelper.go | 0.678327 | 0.435781 | arrayHelper.go | starcoder |
package msgraph
// RatingUnitedStatesTelevisionType undocumented
type RatingUnitedStatesTelevisionType string
const (
// RatingUnitedStatesTelevisionTypeVAllAllowed undocumented
RatingUnitedStatesTelevisionTypeVAllAllowed RatingUnitedStatesTelevisionType = "AllAllowed"
// RatingUnitedStatesTelevisionTypeVAllBlock... | v1.0/RatingUnitedStatesTelevisionTypeEnum.go | 0.590425 | 0.42179 | RatingUnitedStatesTelevisionTypeEnum.go | starcoder |
package detect
import (
"image"
"image/draw"
)
// integral is an image.Image-like structure that stores the cumulative
// sum of the preceding pixels. This allows for O(1) summation of any
// rectangular region within the image.
type integral struct {
// pix holds the cumulative sum of the image's pixels. The pix... | 51_blur_image/graphics/detect/integral.go | 0.744378 | 0.483283 | integral.go | starcoder |
package world
import (
"fmt"
)
// Item represents an item that may be added to an inventory. It has a method to encode the item to an ID and
// a metadata value.
type Item interface {
// EncodeItem encodes the item to its Minecraft representation, which consists of a numerical ID and a
// metadata value.
EncodeIt... | dragonfly/world/item.go | 0.655557 | 0.415551 | item.go | starcoder |
package dsp
import (
"fmt"
"math/cmplx"
"time"
"github.com/go-echarts/go-echarts/v2/charts"
"github.com/go-echarts/go-echarts/v2/opts"
"github.com/go-echarts/go-echarts/v2/types"
"github.com/mjibson/go-dsp/fft"
)
// Signal represents a discrete signal.
type Signal struct {
// SampleRate is the sampling rate ... | pkg/prediction/dsp/signal.go | 0.77949 | 0.408277 | signal.go | starcoder |
package entrevista
import (
"fmt"
"reflect"
"regexp"
)
// Question is a question in an interview
type Question struct {
// The key for the answer map for the answer. Required.
Key string
// The text of the question. Required.
Text string
// The type of the expected answer.
AnswerKind reflect.Kind
// Whether... | example/github/starred/limo/vendor/github.com/hoop33/entrevista/question.go | 0.734215 | 0.430267 | question.go | starcoder |
package iso20022
// Order to invest the investor's principal in an investment fund.
type SubscriptionOrder15 struct {
// Unique and unambiguous identifier for the order, as assigned by the instructing party.
OrderReference *Max35Text `xml:"OrdrRef"`
// Unique and unambiguous investor's identification of the order... | SubscriptionOrder15.go | 0.830491 | 0.504578 | SubscriptionOrder15.go | starcoder |
package iterator
import (
"github.com/genkami/dogs/classes/algebra"
"github.com/genkami/dogs/classes/cmp"
"github.com/genkami/dogs/types/pair"
"golang.org/x/exp/constraints"
)
// Iterable iterates over some set of elements.
type Iterator[T any] interface {
// Next returns the next element in this Iterable and ad... | types/iterator/iterator.go | 0.728459 | 0.532607 | iterator.go | starcoder |
package main
/*
Create a program that will read in a quiz provided via a CSV file (more details below) and will then give
the quiz to a user keeping track of how many questions they get right and how many they get incorrect.
Regardless of whether the answer is correct or wrong the next question should be asked imme... | gophercises/quiz/main.go | 0.563858 | 0.480235 | main.go | starcoder |
package canvas
import (
"bytes"
"errors"
"fmt"
"github.com/austingebauer/go-ray-tracer/color"
"html/template"
"io"
"math"
)
// PixelMapTemplate is a template used for rendering a Canvas to a portable pixmap (PPM) file.
const PixelMapTemplate = `{{ .PPMIdentifier }}
{{ .Width }} {{ .Height }}
{{ .MaxColorValue ... | canvas/canvas.go | 0.848502 | 0.466359 | canvas.go | starcoder |
package average_of_levels_in_binary_tree
import (
"container/list"
"github.com/midnight-vivian/go-data-structures/data-structures/queue"
"github.com/midnight-vivian/go-data-structures/utils"
)
/*
Given a non-empty binary tree, return the average value of the nodes on each level in the form of an array.
Example 1:... | 637. Average of Levels in Binary Tree/average_of_levels_in_binary_tree.go | 0.683842 | 0.467575 | average_of_levels_in_binary_tree.go | starcoder |
package cluster
import (
"math"
"sort"
"github.com/knightjdr/hclust/matrixop"
"github.com/knightjdr/hclust/tree"
"github.com/knightjdr/hclust/typedef"
)
// neighborInfo stores information about a nodes nearest neighbor.
type neighborInfo struct {
Dist float64
Index int
Neighbor int
}
// Generic clust... | cluster/generic.go | 0.701406 | 0.517388 | generic.go | starcoder |
// Package skip32 implements the Skip32 blockcipher
/*
SKIP32 is a 32-bit block cipher based on SKIPJACK, written by G<NAME>ose of QUALCOMM Australia.
It is useful for obfuscating small integers (like sequential database ids)
that are exposed to prevent an analysis of growth rates as in:
https://en.wikipedia.org/wik... | vendor/github.com/yinqiwen/pmux/skip32.go | 0.561696 | 0.546859 | skip32.go | starcoder |
package data
import (
"errors"
"fmt"
"sort"
"strings"
"time"
"github.com/grokify/simplego/time/timeutil"
"github.com/grokify/simplego/type/maputil"
)
type TimeThin struct {
EpochMs int64
Time time.Time
}
type SlotData struct {
SeriesName string
SlotValue int64
SlotNumber int64
}
type SlotDataSeries... | data/slot_data.go | 0.571049 | 0.527073 | slot_data.go | starcoder |
package dom
import (
"fmt"
"github.com/dustismo/heavyfishdesign/dynmap"
"github.com/dustismo/heavyfishdesign/path"
"github.com/dustismo/heavyfishdesign/transforms"
)
// transform factories live here.
// when adding new factories, remember to update DefaultFactories in parser.go
func createMissingAttributeError(... | dom/transform_factories.go | 0.751101 | 0.534552 | transform_factories.go | starcoder |
package core
import (
"bytes"
"log"
"math"
"os/exec"
"strconv"
"strings"
)
// ScriptPairSimilarityEstimator executes a script of the extraction of the
// similarity between each pair of datasets
type ScriptPairSimilarityEstimator struct {
AbstractDatasetSimilarityEstimator
analysisScript string // the analysi... | core/similarityscriptpair.go | 0.769167 | 0.407628 | similarityscriptpair.go | starcoder |
package ode
// EulerForward is an implementation of the explicit Euler method.
func EulerForward(from, h, to float64, y []float64, fn func(float64, []float64) []float64) [][]float64 {
var steps = int((to-from)/h) + 1
var parameters = len(y)
var t = from
yn := make([]float64, parameters)
// initialize 'outer slic... | ode.go | 0.688154 | 0.521715 | ode.go | starcoder |
package kmeans
import (
"fmt"
"image"
"image/draw"
"image/png"
"math/rand"
"os"
"time"
colorful "github.com/lucasb-eyer/go-colorful"
)
// Image type is a decomposed image
type Image struct {
ImportedImage image.Image
Colors []Color
Centroids []*Centroid
//OldCentroids []Centroid
//CentroidPo... | kmeans/kmeans.go | 0.72331 | 0.407864 | kmeans.go | starcoder |
package mutate
import (
"fmt"
"regexp"
"strconv"
"strings"
"github.com/clbanning/mxj"
"github.com/vjeantet/bitfan/processors"
)
const (
PORT_SUCCESS = 0
)
// Performs mutations on fields
func New() processors.Processor {
return &processor{opt: &options{}}
}
type processor struct {
processors.Base
opt *op... | processors/filter-mutate/mutate.go | 0.628749 | 0.41484 | mutate.go | starcoder |
package vgimage
import (
"image"
"image/color"
)
type NormalMap struct{
BasePicture
Normals []float32
}
func NewNormalMap(r image.Rectangle) *NormalMap {
nm := new(NormalMap)
nm.BasePicture = NewBasePicture(r)
nm.Normals = make([]float32,nm.Length*3)
return nm
}
func (n NormalMap) SetNormal(x,y int, c Normal... | normalmap.go | 0.752468 | 0.529324 | normalmap.go | starcoder |
package conf
// BoolVar defines a bool flag and environment variable with specified name, default value, and usage string.
// The argument p points to a bool variable in which to store the value of the flag and/or environment variable.
func (c *Configurator) BoolVar(p *bool, name string, value bool, usage string) {
c... | value_bool.go | 0.796015 | 0.780871 | value_bool.go | starcoder |
package roaring
import (
"container/heap"
"sort"
)
type rblist []*RoaringBitmap
func (p rblist) Swap(i, j int) { p[i], p[j] = p[j], p[i] }
func (p rblist) Len() int { return len(p) }
func (p rblist) Less(i, j int) bool { return p[i].GetSizeInBytes() > p[j].GetSizeInBytes() }
// FastAnd computes the... | fastaggregation.go | 0.616474 | 0.482185 | fastaggregation.go | starcoder |
package iso20022
// Information about a transfer instruction.
type PEPISATransfer11 struct {
// Information identifying the primary individual investor, eg, name, address, social security number and date of birth.
PrimaryIndividualInvestor *IndividualPerson8 `xml:"PmryIndvInvstr,omitempty"`
// Information identif... | PEPISATransfer11.go | 0.695441 | 0.403038 | PEPISATransfer11.go | starcoder |
package filtering
import (
"time"
expr "google.golang.org/genproto/googleapis/api/expr/v1alpha1"
)
func Not(arg *expr.Expr) *expr.Expr {
return Function(FunctionNot, arg)
}
func Member(operand *expr.Expr, field string) *expr.Expr {
return &expr.Expr{
ExprKind: &expr.Expr_SelectExpr{
SelectExpr: &expr.Expr_... | filtering/expr.go | 0.633637 | 0.560373 | expr.go | starcoder |
package graphs
import (
"image"
"image/color"
sll "github.com/emirpasic/gods/lists/singlylinkedlist"
"github.com/fogleman/gg"
"github.com/veandco/go-sdl2/sdl"
"github.com/wdevore/Deuron4/simulation/samples"
)
// SpikesAccessor provides access to series data
// type SpikesAccessor func() (x, y float64, c color... | deuron/app/graphs/spikes_graph.go | 0.66072 | 0.430566 | spikes_graph.go | starcoder |
package series
import (
"math"
"time"
)
const (
_ = iota
// ConsolidateAverage represents an average consolidation type.
ConsolidateAverage
// ConsolidateFirst represents a first value consolidation type.
ConsolidateFirst
// ConsolidateLast represents a last value consolidation type.
ConsolidateLast
// Cons... | series/func.go | 0.773644 | 0.476153 | func.go | starcoder |
package rangeproof
import (
"github.com/privacybydesign/gabi/big"
"github.com/privacybydesign/gabi/internal/common"
"github.com/go-errors/errors"
)
type (
// SquareSplitter provides a combined interface for all facets describing a method for spliting positive numbers into a sum of squares.
SquareSplitter interf... | rangeproof/splitutils.go | 0.698021 | 0.409103 | splitutils.go | starcoder |
package mlpack
/*
#cgo CFLAGS: -I./capi -Wall
#cgo LDFLAGS: -L. -lmlpack_go_knn
#include <capi/knn.h>
#include <stdlib.h>
*/
import "C"
import "gonum.org/v1/gonum/mat"
type KnnOptionalParam struct {
Algorithm string
Epsilon float64
InputModel *knnModel
K int
LeafSize int
Query *mat.Dense
... | knn.go | 0.686685 | 0.505371 | knn.go | starcoder |
package randomgraph
import (
"errors"
"fmt"
"math/rand"
"time"
)
// Vertex is an alias for a string label.
type Vertex string
// Vertices is a list of Vertex.
type Vertices []Vertex
// Graph maps a Vertex (source) to destination Vertices.
type Graph map[Vertex]Vertices
// RandSeed seeds the rng.
func RandSeed(... | randomgraph.go | 0.673084 | 0.529628 | randomgraph.go | starcoder |
package texture
type RGBA struct {
R byte
G byte
B byte
A byte
}
type FlatDataPlayground interface {
Width() int
Height() int
Data() []byte
}
type RGBAFlatDataPlayground interface {
FlatDataPlayground
SetTexel(x, y int, rgba RGBA)
Texel(x, y int) RGBA
SetData([]byte)
}
func DedicatedRGBAFlatDataPlaygroun... | texture/playground.go | 0.753285 | 0.44734 | playground.go | starcoder |
package models
import (
i336074805fc853987abe6f7fe3ad97a6a6f3077a16391fec744f671a015fbd7e "time"
i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91 "github.com/microsoft/kiota-abstractions-go/serialization"
)
// SimulationAutomationRun
type SimulationAutomationRun struct {
Entity
// Da... | models/simulation_automation_run.go | 0.603348 | 0.493103 | simulation_automation_run.go | starcoder |
package tools
// StringMapsAreEqual compares two string maps, checking the first map to see if each
// of the keys are present and contains the same values as the second map
func StringMapsAreEqual(a, b map[string]string) bool {
if len(a) != len(b) {
return false
}
for k, v := range b {
value, found := a[k]
... | pkg/tools/utils.go | 0.878718 | 0.584004 | utils.go | starcoder |
package buffer
import (
"fmt"
"math"
)
// Stats is a set of statistical properties of a set of numbers.
type Stats struct {
count int
sum float64
first, last float64
min, max float64
mean, dSquared float64
}
// NewStats creates a new Stats.
func NewStats() *Stats {
return &Stats{... | xmath/buffer/stats.go | 0.810141 | 0.483526 | stats.go | starcoder |
package square
// Currency : Indicates the associated currency for an amount of money. Values correspond to [ISO 4217](https://wikipedia.org/wiki/ISO_4217).
type Currency string
// List of Currency
const (
UNKNOWN_CURRENCY_Currency Currency = "UNKNOWN_CURRENCY"
AED_Currency Currency = "AED"
AFN_Currency Currency = ... | square/model_currency.go | 0.791741 | 0.688767 | model_currency.go | starcoder |
package radam
import (
"github.com/nlpodyssey/spago/pkg/mat"
"github.com/nlpodyssey/spago/pkg/ml/nn"
"github.com/nlpodyssey/spago/pkg/ml/optimizers/gd"
"math"
)
var _ gd.MethodConfig = &Config{}
type Config struct {
gd.MethodConfig
StepSize float64
Beta1 float64
Beta2 float64
Epsilon float64
}
func... | pkg/ml/optimizers/gd/radam/radam.go | 0.730001 | 0.413596 | radam.go | starcoder |
// Package vault provides helper functions to improve the go-metrics to stackdriver metric
// conversions specific to HashiCorp Vault.
package vault
import "github.com/armon/go-metrics"
// Extractor extracts known patterns from the key into metrics.Label for better metric grouping
// and to help avoid the limit of 5... | vault/vault.go | 0.671363 | 0.441312 | vault.go | starcoder |
package models
import (
i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91 "github.com/microsoft/kiota-abstractions-go/serialization"
)
// TaskViewpoint
type TaskViewpoint struct {
// Stores additional data not described in the OpenAPI description found when deserializing. Can be used for seri... | models/task_viewpoint.go | 0.754463 | 0.419529 | task_viewpoint.go | starcoder |
package pewma
import (
"errors"
"math"
)
// Value represents acceptable and calculatable.
type Value float64
func (v Value) sqrt() float64 {
return math.Sqrt(float64(v))
}
func (v Value) square() Value {
return v * v
}
// Config represents coefficients for calculating specified time series.
type Config struct ... | pewma.go | 0.790045 | 0.473109 | pewma.go | starcoder |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.