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 fp
func (o BoolOption) IsEmpty() bool { return o == NoneBool }
func (o StringOption) IsEmpty() bool { return o == NoneString }
func (o IntOption) IsEmpty() bool { return o == NoneInt }
func (o Int64Option) IsEmpty() bool { return o == NoneInt64 }
func (o ByteOption) IsEmpty() bool { return o == NoneByte ... | fp/bootstrap_option_isempty.go | 0.705481 | 0.508483 | bootstrap_option_isempty.go | starcoder |
package nexus
// use only if you are sure it is indicated
const certsDefault = `
Certificate:
Data:
Version: 3 (0x2)
Serial Number:
0a:18:9e:cb:e2:e2:ee:ca:ed:4b:b6:14:4c:a6:fb:0e:ac:34:27:08
Signature Algorithm: sha256WithRSAEncryption
Issuer: CN = localhost
Val... | nexus/const.go | 0.51879 | 0.516291 | const.go | starcoder |
package stripe
// The type of the credit note line item, one of `invoice_line_item` or `custom_line_item`. When the type is `invoice_line_item` there is an additional `invoice_line_item` property on the resource the value of which is the id of the credited line item on the invoice.
type CreditNoteLineItemType string
... | creditnotelineitem.go | 0.818882 | 0.423875 | creditnotelineitem.go | starcoder |
package sql_nosql_injection
import (
"github.com/threagile/threagile/model"
)
func Category() model.RiskCategory {
return model.RiskCategory{
Id: "sql-nosql-injection",
Title: "SQL/NoSQL-Injection",
Description: "When a database is accessed via database access protocols SQL/NoSQL-Injection risks might aris... | risks/built-in/sql-nosql-injection/sql-nosql-injection-rule.go | 0.648132 | 0.457197 | sql-nosql-injection-rule.go | starcoder |
package rtime
import (
"strings"
"time"
)
// Returns the minute offset within the hour specified by t, in the range [0, 59].
func (t Time) Minute() int {
return time.Time(t).Minute()
}
// Returns the second offset within the minute specified by t, in the range [0, 59].
func (t Time) Second() int {
return time.Ti... | time.go | 0.671471 | 0.578895 | time.go | starcoder |
package roster
import (
"github.com/google/uuid"
"github.com/dansage/synergySync/pkg/orm"
)
// Course represents a course from the roster data
type Course struct {
orm.NumericID
orm.Timestamps
// Active indicates if the course is still listed in the roster data
Active bool `gorm:"not null; default(false)" jso... | app/roster/models.go | 0.571527 | 0.479077 | models.go | starcoder |
package operator
import (
"github.com/matrixorigin/matrixcube/components/prophet/core"
"github.com/matrixorigin/matrixcube/components/prophet/limit"
"github.com/matrixorigin/matrixcube/components/prophet/pb/metapb"
)
// OpInfluence records the influence of the cluster.
type OpInfluence struct {
ContainersInfluen... | components/prophet/schedule/operator/influence.go | 0.649134 | 0.410047 | influence.go | starcoder |
package datadog
import (
"encoding/json"
)
// GraphSnapshot Object representing a graph snapshot.
type GraphSnapshot struct {
// A JSON document defining the graph. `graph_def` can be used instead of `metric_query`. The JSON document uses the [grammar defined here](https://docs.datadoghq.com/graphing/graphing_json... | api/v1/datadog/model_graph_snapshot.go | 0.834373 | 0.401248 | model_graph_snapshot.go | starcoder |
package day11
import (
"fmt"
)
// Coordinate is a value with x and y parts
type Coordinate struct {
x int
y int
}
// Square represents a square of Coordinates in a Grid
type Square struct {
Coordinate
Size int
Sum int
}
// Grid representes an x,y plane of power levels
type Grid struct {
SN int
Cells map[int... | day11/day11.go | 0.762778 | 0.463566 | day11.go | starcoder |
package base36
// Simplified code based on https://godoc.org/github.com/mr-tron/base58
// which in turn is based on https://github.com/trezor/trezor-crypto/commit/89a7d7797b806fac
import (
"fmt"
)
const UcAlphabet = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ"
const LcAlphabet = "0123456789abcdefghijklmnopqrstuvwxyz"
con... | vendor/github.com/multiformats/go-base36/base36.go | 0.709925 | 0.479382 | base36.go | starcoder |
package iso20022
// Creation/cancellation of investment units on the books of the fund or its designated agent, as a result of executing an investment fund order.
type InvestmentFundTransaction4 struct {
// Underlying transaction or corporate action.
EventType *TransactionType1Choice `xml:"EvtTp"`
// Status of an... | InvestmentFundTransaction4.go | 0.817283 | 0.482795 | InvestmentFundTransaction4.go | starcoder |
package heap
type
// A PairingHeapInt implements the Heap interface using the Pairing Heap data structure
// see: wikipedia.org/wiki/Pairing_heap
PairingHeapInt struct {
less func(int, int) bool
root *pairingHeapNodeInt
}
type
// A PairingHeapInt8 implements the Heap interface using the Pairing Heap data structur... | heap/reified_pairingheap.go | 0.858199 | 0.550668 | reified_pairingheap.go | starcoder |
package cocmath
import (
"errors"
"fmt"
"unicode"
"github.com/catsworld/botmaid/random"
)
// Result includes the minimize, maximum and exact result of an expression.
type Result struct {
Min, Max, Value int
}
// Operator includes some information of an operator.
type Operator struct {
Op rune
LeftComb ... | cocmath/expression.go | 0.577972 | 0.555616 | expression.go | starcoder |
// Code to execute a parsed template.
package template
import (
"bytes"
"io"
"reflect"
"strings"
)
// Internal state for executing a Template. As we evaluate the struct,
// the data item descends into the fields associated with sections, etc.
// Parent is used to walk upwards to find variables higher in the tr... | llgo/third_party/gofrontend/libgo/go/old/template/execute.go | 0.571647 | 0.450722 | execute.go | starcoder |
package plaid
import (
"encoding/json"
)
// LiabilityOverride Used to configure Sandbox test data for the Liabilities product
type LiabilityOverride struct {
// The type of the liability object, either `credit` or `student`. Mortgages are not currently supported in the custom Sandbox.
Type string `json:"type"`
/... | plaid/model_liability_override.go | 0.790004 | 0.624709 | model_liability_override.go | starcoder |
package input
import (
"time"
"github.com/Jeffail/benthos/v3/lib/types"
)
//------------------------------------------------------------------------------
// WithPipeline is a type that wraps both an input type and a pipeline type
// by routing the input through the pipeline, and implements the input.Type
// inte... | lib/input/wrap_with_pipeline.go | 0.792986 | 0.445771 | wrap_with_pipeline.go | starcoder |
package streaming
import (
"github.com/alexandre-normand/glukit/app/apimodel"
"github.com/alexandre-normand/glukit/app/container"
"github.com/alexandre-normand/glukit/app/glukitio"
"time"
)
type GlucoseReadStreamer struct {
head *container.ImmutableList
startTime *time.Time
wr glukitio.GlucoseReadB... | app/streaming/glucosereadstreamer.go | 0.755907 | 0.404449 | glucosereadstreamer.go | starcoder |
package floatring
// Buffer is the ring buffer of float64 values.
type Buffer struct {
ring []float64
full bool
wc int
rc int
}
// New creates a new buffer with the given capacity.
func New(cp int) *Buffer {
return &Buffer{
ring: make([]float64, cp),
}
}
// IsFull returns true if the buffer if filled wit... | floatring.go | 0.824285 | 0.461927 | floatring.go | starcoder |
package packets
import (
"encoding/binary"
"unicode/utf8"
"unsafe"
)
// bytesToString provides a zero-alloc, no-copy byte to string conversion.
// via https://github.com/golang/go/issues/25484#issuecomment-391415660
func bytesToString(bs []byte) string {
return *(*string)(unsafe.Pointer(&bs))
}
// decodeUint16 e... | server/internal/packets/codec.go | 0.808143 | 0.403391 | codec.go | starcoder |
package pt
type Triangle struct {
Material *Material
V1, V2, V3 Vector
N1, N2, N3 Vector
T1, T2, T3 Vector
}
func NewTriangle(v1, v2, v3, t1, t2, t3 Vector, material Material) *Triangle {
t := Triangle{}
t.V1 = v1
t.V2 = v2
t.V3 = v3
t.T1 = t1
t.T2 = t2
t.T3 = t3
t.Material = &material
t.FixNormals()
... | pt/triangle.go | 0.714329 | 0.647157 | triangle.go | starcoder |
package errors
import "net/http"
// nolint: lll
func getBuiltin(code string) (cbe EMFErrorType, ok bool) {
cbe, ok = map[string]EMFErrorType{
"emf.400.QueryParameterInvalid": {
ErrorCode: "emf.400.QueryParameterInvalid",
StatusCode: http.StatusBadRequest,
Description: "An invalid query parameter was pr... | emf/context/errors/builtin_errors.go | 0.545286 | 0.40869 | builtin_errors.go | starcoder |
package science
/*
A fairly substantial redraft of NodeBuilders -- in this one,
the recursion happens in such a way that you *don't* get a handle to a Node
immediately when completing every builder.
The idea is that this might make it easier to build large recursive values
(both for caller ergonomics, and for interna... | _rsrch/nodeassembler/nodeAssembler.go | 0.552057 | 0.579103 | nodeAssembler.go | starcoder |
package value
import (
"strconv"
"strings"
)
type compareFloatFunc func(a, b float64) bool
// FloatSlice holds a slice of float64 values
type FloatSlice struct {
valsPtr *[]float64
}
// NewFloatSlice makes a new FloatSlice with the given float64 values.
func NewFloatSlice(vals ...float64) *FloatSlice {
slice :=... | value/floatslice.go | 0.88282 | 0.673296 | floatslice.go | starcoder |
package spogoto
import (
"strconv"
)
// NewIntegerStack generates an integer DataStack.
func NewIntegerStack(ints []int64) *datastack {
elements := Elements{}
for _, v := range ints {
elements = append(elements, int64(v))
}
d := NewDataStack(elements, FunctionMap{}, func(str string) (Element, bool) {
val, e... | integer_stack.go | 0.549641 | 0.422981 | integer_stack.go | starcoder |
package walkeralias
import (
"errors"
"math/rand"
)
// walkerAlias holds an internal rand reference instead of sharing with global rand.
type walkerAlias struct {
buckets []*bucket
r *rand.Rand
}
var ErrIllegalProbMap = errors.New("illegal probability map values")
// NewWalkerAlias accepts a map {key: pro... | walker-alias.go | 0.790571 | 0.514278 | walker-alias.go | starcoder |
package collectors
import (
"fmt"
"github.com/prometheus/client_golang/prometheus"
cephclient "github.com/rook/rook/pkg/ceph/client"
"github.com/rook/rook/pkg/clusterd"
)
// OSDCollector displays statistics about OSD in the ceph cluster.
// An important aspect of monitoring OSDs is to ensure that when the clust... | pkg/ceph/collectors/osd.go | 0.606964 | 0.451387 | osd.go | starcoder |
package main
const helpLongMsg = `
NAME:
%_COMMAND_NAME_% - Lists the best common ancestors of the two passed commit revisions
SYNOPSIS:
usage: %_COMMAND_NAME_% <path> <commitRev> <commitRev>
or: %_COMMAND_NAME_% <path> --independent <commitRev>...
or: %_COMMAND_NAME_% <path> --is-ancestor <commitRev> ... | _examples/merge_base/help-long.msg.go | 0.629547 | 0.48932 | help-long.msg.go | starcoder |
// Package unicodes implements unicode utility functions.
package unicodes
import (
"unicode"
)
// IsGraphic reports whether the rune is defined as a Graphic by Unicode.
// Such characters include letters, marks, numbers, punctuation, symbols, and
// spaces, from categories L, M, N, P, S, Zs.
func IsGrap... | util/unicodes/graphic.go | 0.709321 | 0.402862 | graphic.go | starcoder |
package kata
import (
"errors"
"fmt"
"regexp"
"strconv"
"strings"
)
// matchData holds the string encoded results of a match.
type matchData struct {
team [2]string
points [2]string
}
// teamData holds the points scored and conceded in match by a team.
type teamData struct {
pointsScored, pointsConceded in... | 6_kyu/Ranking_NBA_teams.go | 0.622689 | 0.476641 | Ranking_NBA_teams.go | starcoder |
package query
func DerivedResults(qr Results, ch <-chan Result) Results {
return &results{
query: qr.Query(),
proc: qr.Process(),
res: ch,
}
}
// NaiveFilter applies a filter to the results.
func NaiveFilter(qr Results, filter Filter) Results {
ch := make(chan Result)
go func() {
defer close(ch)
defe... | vendor/gx/ipfs/QmXRKBQA4wXP7xWbFiZsR1GP4HV6wMDQ1aWFxZZ4uBcPX9/go-datastore/query/query_impl.go | 0.72027 | 0.407392 | query_impl.go | starcoder |
package tetra3d
import (
"math"
"github.com/kvartborg/vector"
)
// BoundingTriangles is a Node specifically for detecting a collision between any of the triangles from a mesh instance and another BoundingObject.
type BoundingTriangles struct {
*Node
BoundingAABB *BoundingAABB
Mesh *Mesh
}
// NewBoundin... | boundsTriangles.go | 0.900122 | 0.768168 | boundsTriangles.go | starcoder |
package stats
import (
"fmt"
"math"
"sort"
"github.com/heustis/tsp-solver-go/model"
)
// DistanceGaps tracks the distance between one vertex and each edge in the current circuit.
// From those distances, it analyzes the gaps between successive distances, sorted from smallest to largest,
// to facilitate finding ... | stats/distancegaps.go | 0.764628 | 0.798462 | distancegaps.go | starcoder |
package main
/*
# Eller's maze algorithm implemented using FB Horizon's object/event model
# High level overview
For each row,
1. Compute east-west openings
1.1. randomly decide which ones (last row special case!)
1.2. merge sets
1.3. mark state as open
2. Compute north-south openings
2.1. from each set
2.1.1. ... | eller/main.go | 0.76454 | 0.746693 | main.go | starcoder |
package twistededwards
import (
"math/bits"
"github.com/consensys/gnark/cs/internal/curve"
)
// Point point on a twisted Edwards curve
type Point struct {
X, Y curve.Element
}
// NewPoint creates a new instance of Point
func NewPoint(x, y curve.Element) Point {
return Point{x, y}
}
// IsOnCurve checks if a poi... | cs/std/reference/algebra/twisted_edwards/point.go | 0.693992 | 0.409811 | point.go | starcoder |
package timeseries
import (
"errors"
"math"
"sort"
"time"
"github.com/grafana/grafana-plugin-sdk-go/backend"
"github.com/grafana/grafana-plugin-sdk-go/data"
)
// Aligns point's time stamps according to provided interval.
func (ts TimeSeries) Align(interval time.Duration) TimeSeries {
if interval <= 0 || ts.Le... | pkg/timeseries/timeseries.go | 0.728072 | 0.467271 | timeseries.go | starcoder |
package bn256
// For details of the algorithms used, see "Multiplication and Squaring on
// Pairing-Friendly Fields, Devegili et al.
// http://eprint.iacr.org/2006/471.pdf.
// gfP2 implements a field of size p² as a quadratic extension of the base field
// where i²=-1.
type gfP2 struct {
X, Y gfP // value is xi+Y.
}... | gfp2.go | 0.817246 | 0.434161 | gfp2.go | starcoder |
package blockchain
import (
"bytes"
"encoding/base64"
"encoding/json"
"errors"
)
// BlockChain object to be instantiated and to have Blocks appended to its Genesis Block
type BlockChain struct {
Chain []Block
Difficulty int32
PendingTransactions TransactionList
MiningReward float... | internal/blockchain/blockchain.go | 0.737536 | 0.450903 | blockchain.go | starcoder |
package adapt
import (
"reflect"
"github.com/nobuenhombre/suikat/pkg/ge"
)
// Check compares reflect.Value with a string representation of the expected type.
// If the type does not match the expected one, the ge.MismatchError{} error is returned
func Check(val reflect.Value, expectType string) error {
if val.Typ... | pkg/adapt/adapt.go | 0.781747 | 0.528594 | adapt.go | starcoder |
package vterrors
/*
Vitess uses canonical error codes for error reporting. This is based
on years of industry experience with error reporting. This idea is
that errors should be classified into a small set of errors (10 or so)
with very specific meaning. Each error has a code, and a message. When
errors are passed ar... | vendor/github.com/youtube/vitess/go/vt/vterrors/doc.go | 0.821295 | 0.524577 | doc.go | starcoder |
package config
/*
CONFIGURATION FILE
------------------
The Git configuration file contains a number of variables that affect
the Git commands' behavior. The `.git/config` file in each repository
is used to store the configuration for that repository, and
`$HOME/.gitconfig` is used to store a per-user configuration ... | vendor/gopkg.in/src-d/go-git.v4/plumbing/format/config/doc.go | 0.731155 | 0.685555 | doc.go | starcoder |
package cloud
import (
"encoding/json"
"fmt"
"testing"
"github.com/ingrammicro/cio/api/types"
"github.com/ingrammicro/cio/utils"
"github.com/stretchr/testify/assert"
)
// CreateTemporaryArchiveMocked test mocked function
func CreateTemporaryArchiveMocked(t *testing.T, temporaryArchiveIn *types.TemporaryArchiv... | api/cloud/temporary_archives_api_mocked.go | 0.592902 | 0.489381 | temporary_archives_api_mocked.go | starcoder |
package example_body
import (
"github.com/hueypark/framework/core/random"
"github.com/hueypark/physics/core"
"github.com/hueypark/physics/core/body"
"github.com/hueypark/physics/core/math/rotator"
"github.com/hueypark/physics/core/math/vector"
"github.com/hueypark/physics/core/shape/bullet"
"github.com/hueypark... | example/example_body/example_body.go | 0.794823 | 0.456531 | example_body.go | starcoder |
package parser
import (
"encoding/json"
"fmt"
"sort"
"strconv"
"strings"
"time"
)
// Series is a flat JSON serializable representation of the series.
type Series struct {
id string
Start time.Time `json:"start"`
End time.Time `json:"end"`
Tags Tags `json:"tags"`
Datapoints Datap... | src/cmd/services/m3comparator/main/parser/parser.go | 0.822759 | 0.416144 | parser.go | starcoder |
package game
import (
"errors"
"fmt"
"strings"
)
// Board represents a 3x3 tic-tac-toe game board.
type Board struct {
grid [][]*Mark
}
// NewBoard is the constructor for Board.
func NewBoard() *Board {
return &Board{
grid: [][]*Mark{
{nil, nil, nil},
{nil, nil, nil},
{nil, nil, nil},
},
}
}
// A... | internal/game/board.go | 0.787155 | 0.427636 | board.go | starcoder |
package shellGenerator
import (
"fmt"
"math"
"github.com/Konstantin8105/Convert-INP-to-STD-format/inp"
)
// Shell - input data of shell
type Shell struct {
Height float64 // unit - meter. Height of shell
Diameter float64 // unit - meter. Diameter of shell
Precision float64 // unit - meter. Maximal distance... | shellGenerator/shell.go | 0.525125 | 0.422207 | shell.go | starcoder |
package repeatgenome
import (
"bytes"
"github.com/mmcco/jh-bio/bioutils"
"unsafe"
)
/*
Returns the total number of bases in a RepeatGenome's reference chromosomes.
*/
func (repeatGenome *RepeatGenome) Size() uint64 {
var numBases uint64 = 0
for _, seqs := range repeatGenome.chroms {
for _, seq := range seqs... | repeatgenome/stats-rg.go | 0.732592 | 0.412826 | stats-rg.go | starcoder |
package gap
import (
"context"
"fmt"
"time"
)
// GoalFlag is a uint value type, that is used to specify different genetic
// algorithm goals of cancellation.
type GoalFlag uint
const (
// TIME is a goal type flag. If this flag is set a counter is started
// using the TimeN field in the goal structure which requ... | goal.go | 0.513181 | 0.426202 | goal.go | starcoder |
package eval
import (
"fmt"
"path/filepath"
"reflect"
"runtime"
"strings"
)
// RunDSL iterates through the root expressions and calls WalkSets on each to
// retrieve the expression sets. It iterates over the expression sets multiple
// times to first execute the DSL, then validate the resulting expressions and
/... | eval/eval.go | 0.656438 | 0.456349 | eval.go | starcoder |
package data
import (
"fmt"
"github.com/fogleman/gg"
"github.com/nmaupu/gocube/math3D"
"log"
"math"
)
/**
* 3D calculations are based on:
* x axis going to the right
* y axis going up
* z axis going backwards
* Matrices computation are using column
* [1 0 0 0] [x]
* |0 1 0 0| |y|
* |0 0 1 0| x |z|
*... | data/cube3d.go | 0.703448 | 0.626738 | cube3d.go | starcoder |
package gaussproc
import (
"github.com/btracey/kernel"
"gonum.org/v1/gonum/mat"
"gonum.org/v1/gonum/stat"
)
// MeanStdMat returns the mean and standard deviations of the columns of the
// data matrix. If all of the elements of the column have the same value, a
// standard deviation of 1 is returned. If x == nil, M... | gen.go | 0.713132 | 0.641871 | gen.go | starcoder |
package arc
func min(x, y int) int {
if x < y {
return x
}
return y
}
func max(x, y int) int {
if x > y {
return x
}
return y
}
// container represents a ARC cache container.
type container struct {
Capacity int
p int // target size of t1
t1 *list
t2 *list
b1 *list
b2 ... | cache/container/memory/arc/container.go | 0.729712 | 0.450662 | container.go | starcoder |
package rui
import (
"strconv"
"strings"
)
const (
// ColumnCount is the constant for the "column-count" property tag.
// The "column-count" int property specifies number of columns into which the content is break
// Values less than zero are not valid. if the "column-count" property value is 0 then
// the numb... | columnLayout.go | 0.749179 | 0.402128 | columnLayout.go | starcoder |
package esbuilder
// blockNode defines a statement block in the AST.
type blockNode struct {
// statements are the statements under the block.
statements []StatementBuilder
}
// returnNode defines a return statement in the AST.
type returnNode struct {
// value is the optional value being returned.
value Express... | generator/escommon/esbuilder/statements_base.go | 0.665954 | 0.466481 | statements_base.go | starcoder |
package keyvalue
import (
"strings"
"github.com/coreos/bbolt"
)
// Bucket represents a bucket of key-value pairs. Keys are strings, but values are simply bytes.
// Buckets can form a hierarchy of buckets.
type Bucket interface {
BucketView
// Put sets the value for a key in the bucket. If the key exist then it... | pkg/data/keyvalue/bucket.go | 0.745954 | 0.408985 | bucket.go | starcoder |
package geometry
import (
"fmt"
"math"
)
const epsilon = 0.00001
type Value interface {
shift(dx float64, dy float64) Value
intersect(other Value) Value
fmt.GoStringer
}
type nowhere struct {
}
type everywhere struct {
}
type point struct {
x float64
y float64
}
type line struct {
angle float64
d float... | geometry/geometry.go | 0.59972 | 0.558688 | geometry.go | starcoder |
package fast
import (
"go/ast"
r "reflect"
. "github.com/cosmos72/gomacro/base"
xr "github.com/cosmos72/gomacro/xreflect"
)
// Convert compiles a type conversion expression
func (c *Comp) Convert(node ast.Expr, t xr.Type) *Expr {
e := c.Expr1(node, nil)
return c.convert(e, t, node)
}
// Convert compiles a ty... | vendor/github.com/cosmos72/gomacro/fast/convert.go | 0.652906 | 0.492066 | convert.go | starcoder |
package crdt
import (
"math/rand"
"github.com/johnny-morrice/godless/internal/testutil"
)
func GenNamespace(rand *rand.Rand, size int) Namespace {
if size > 30 {
size = 30
}
const tableMax = 10
const maxStr = 20
gen := EmptyNamespace()
tableCount := testutil.GenCountRange(rand, 1, tableMax)
for i := 0;... | crdt/gen.go | 0.536556 | 0.575767 | gen.go | starcoder |
package board
import (
"errors"
"fmt"
"math/rand"
"time"
)
const CellDead = 0
const CellAlive = 1
type board struct {
state [][]int
rows int
columns int
}
/* Creates a new Board with the given dimensions. The dimensions, rows and columns,
must be positive integers greater than 0.
Returns a board populat... | golang/board/board.go | 0.689619 | 0.509642 | board.go | starcoder |
package vue
import (
"reflect"
"runtime"
"strings"
)
// Option uses the option pattern for components.
type Option func(*Comp)
// El is the element option for components.
// The root element of a component is query selected from the value, e.g. #app or body.
func El(el string) Option {
return func(comp *Comp) {
... | option.go | 0.787768 | 0.485112 | option.go | starcoder |
package gogeom
import (
"math"
)
//sides of square
type SquareSides struct {
Side float64
}
//diagonals of square
type SquareDiagonals struct {
Diagonal float64
}
//sides of rectangle
type RectangleSides struct {
Length, Breadth float64
}
//sides of parallelogram
type ParallelogramSides struct {
Base, Slant, ... | quadrilaterals.go | 0.864339 | 0.596463 | quadrilaterals.go | starcoder |
package timef
// List of dates in number or string format
const (
StampDashDateLongYearAtBegin = "2006-01-02 15:04:05" // 2006-01-02 15:04:05
StampDashDateYearAtBegin = "06-01-02 15:04:05" // 06-01-02 15:04:05
StampDashDayLongYearAtBegin = "2006-01-02" // 2006-01-02
StampSlashDateLongYearAtBegin =... | var.go | 0.505371 | 0.432723 | var.go | starcoder |
package quicktime
import (
"bytes"
"encoding/binary"
"io"
"reflect"
)
// AtomInfo has common information of atom
type AtomInfo struct {
// Offset specifies an offset of the atom in a file.
Offset uint64
// Size specifies size(bytes) of atom.
Size uint64
// HeaderSize specifies size(bytes) of common fields ... | quicktime/atom_info.go | 0.644784 | 0.407274 | atom_info.go | starcoder |
package flip
// Interface represents a type whose order of elements can be flipped by the
// routines in this package. The methods require that the elements of the
// collection be enumerated by an integer index.
type Interface interface {
Len() int
Swap(i, j int)
}
// Flip flips the data.
func Flip(data Interface)... | flip.go | 0.841826 | 0.536313 | flip.go | starcoder |
package main
import (
"fmt"
"io"
"math/rand"
"os"
)
var (
// InhibitoryNeuronDensity the density with which to create inhibitory neurons
InhibitoryNeuronDensity = 0.0
)
// NetworkLayer an individual, 2D layer of neurons
type NetworkLayer struct {
Neurons [][]*Neuron `json:"neurons"`
}
// NewNetworkLayer crea... | network_layer.go | 0.739986 | 0.542621 | network_layer.go | starcoder |
package main
import (
"math"
"github.com/adrianderstroff/pbr/pkg/cgm"
"github.com/go-gl/mathgl/mgl32"
)
// Ray primitive consisting of a position o and a direction dir.
type Ray struct {
o mgl32.Vec3
dir mgl32.Vec3
}
// Sphere consists of a position o and a radius r.
type Sphere struct {
o mgl32.Vec3
r flo... | cmd/cosdist/cosdist.go | 0.82963 | 0.602676 | cosdist.go | starcoder |
package stream
import (
"mime"
"os"
"path/filepath"
"testing"
"vincent.click/pkg/preflight/expect"
)
// File is a set of expectations about a file stream
type File struct {
*testing.T
r reader
b []byte
}
// ExpectFile returns expectations based on a file descriptor
func ExpectFile(t *testing.T, file *os.Fi... | stream/file.go | 0.721351 | 0.408631 | file.go | starcoder |
package subtest
import (
"errors"
"reflect"
"regexp"
"strconv"
"testing"
"time"
)
// Test returns a test that fails fatally with the error f returned by f.
func Test(f func() error) func(t *testing.T) {
return func(t *testing.T) {
if err := f(); err != nil {
t.Fatal(err)
}
}
}
// ValueFunc is a functi... | value.go | 0.838746 | 0.585901 | value.go | starcoder |
package facet
import (
"fmt"
"math"
)
// A GroupID identifies a set of values belonging together.
type GroupID struct {
Row, Col string
}
type Grouper interface {
Group() GroupID
}
// Aestetic is a function mapping a certain data point to an aestehtic.
type Aesthetic func(i int) float64
// DiscreteAestetic is ... | group.go | 0.784773 | 0.701795 | group.go | starcoder |
package comparing
import (
m "math"
"github.com/Willsem/compare-trajectories/app/model"
"github.com/Willsem/compare-trajectories/app/service/comparing/interpolation"
"github.com/Willsem/compare-trajectories/app/service/comparing/speed"
"github.com/Willsem/compare-trajectories/app/service/math"
)
func difference... | app/service/comparing/difference.go | 0.54819 | 0.537041 | difference.go | starcoder |
package match
import (
"reflect"
"regexp"
"strings"
"testing"
)
// Matcher is a helper object for chaining matcher conditions.
type Matcher struct {
t *testing.T
value interface{}
}
// Fatal causes the unit test to immediately fail is one of the previous
// conditions has fail.
// Note: This will only affe... | matcher.go | 0.785103 | 0.526951 | matcher.go | starcoder |
package main
import (
"crypto/sha256"
"encoding/hex"
"errors"
"strconv"
"strings"
"sync"
"sync/atomic"
"time"
)
const genesisBlockData = "The Times 03/Jan/2009 Chancellor on brink of second bailout for banks" // https://en.bitcoin.it/wiki/Genesis_block
// Block is the element of the Blockchain.
type Block st... | cmd/blockchain.go | 0.639173 | 0.449936 | blockchain.go | starcoder |
package commands
import "github.com/urfave/cli"
const artisticShort = `
Copyright Datajin Technologies, Inc. 2015,2017. All rights reserved.
This software is released under the Artistic License 2.0.
`
const artisticFull = `
The Artistic License 2.0
Copyright (c) 2000-2006, The Perl Foundat... | commands/legal.go | 0.732974 | 0.469885 | legal.go | starcoder |
package crazy
import "math"
// Exponential adapts a Source to generate random numbers under an exponential
// distribution.
type Exponential struct {
Source
Rate float64
}
// NewExponential creates an exponential distribution drawing from the
// specified source with given rate parameter.
func NewExponential(src S... | expo.go | 0.691393 | 0.465387 | expo.go | starcoder |
package congestion
// WindowedFilter Use the following to construct a windowed filter object of type T.
// For example, a min filter using QuicTime as the time type:
// WindowedFilter<T, MinFilter<T>, QuicTime, QuicTime::Delta> ObjectName;
// A max filter using 64-bit integers as the time type:
// WindowedFilter<T... | internal/congestion/windowed_filter.go | 0.887519 | 0.659693 | windowed_filter.go | starcoder |
package types
// Scannable is a thing that knows how to describe itself to a Scanner for
// construction in a SQL query string and query argument list.
type Scannable interface {
// Scan takes two slices and a pointer to an int. The first slice is a
// slice of bytes that the implementation should copy its string
... | pkg/types/interface.go | 0.63273 | 0.68172 | interface.go | starcoder |
package geometry
import (
"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"
"log"
"math"
"reflect"
)
//World manages the world space of the S... | pkg/geometry/world.go | 0.818338 | 0.54825 | world.go | starcoder |
package gofra
import (
"encoding/json"
"fmt"
)
// Anti-aliasing
// https://en.wikipedia.org/wiki/Spatial_anti-aliasing
// https://en.wikipedia.org/wiki/Multisample_anti-aliasing
// https://en.wikipedia.org/wiki/Supersampling
/*
+---+
| |
+---+
4x - 2*2
+---+---+
| | |
+---+---+
| | |
+---+---+
9x - 3... | anti_aliasing.go | 0.608361 | 0.52756 | anti_aliasing.go | starcoder |
package zgeo
import (
"fmt"
"math"
"strconv"
"github.com/torlangballe/zutil/zdict"
"github.com/torlangballe/zutil/zlog"
"github.com/torlangballe/zutil/zstr"
)
type Size struct {
W float64 `json:"w"`
H float64 `json:"h"`
}
type Sizes []Size
// SizeF creates a Size from float64 w and h
func SizeF(w, h float3... | zgeo/size.go | 0.879826 | 0.455562 | size.go | starcoder |
package seekable
import (
"encoding/binary"
"fmt"
"math"
"go.uber.org/zap/zapcore"
)
const (
/*
The format consists of a number of frames (Zstandard compressed frames and skippable frames), followed by a final skippable frame at the end containing the seek table.
Seek Table Format
The structure of the s... | seekable.go | 0.850779 | 0.624923 | seekable.go | starcoder |
package client
import (
"encoding/json"
)
// RetentionSetting struct for RetentionSetting
type RetentionSetting struct {
TimeRetentionDuration int32 `json:"timeRetentionDuration"`
RetentionDurationType string `json:"retentionDurationType"`
}
// NewRetentionSetting instantiates a new RetentionSetting object
// Th... | client/model_retention_setting.go | 0.745306 | 0.517754 | model_retention_setting.go | starcoder |
package argparse
import (
"fmt"
"regexp"
"strings"
"github.com/skillian/errors"
)
// Argument holds the definition of an argument.
type Argument struct {
// parser holds a reference back to the parser that instantiated the
// argument.
parser *ArgumentParser
// Action holds the action to perform after succe... | argument.go | 0.736401 | 0.488405 | argument.go | starcoder |
package hexgrid
import (
"image"
"math"
)
type Point64 struct {
X float64
Y float64
}
func (p *Point64) ToPoint() image.Point {
return image.Point{X: int(math.Round(p.X)), Y: int(math.Round(p.Y))}
}
type HexLayout struct {
orientation Orientation
scale Point64 // multiplication factor relative to the c... | layout.go | 0.898658 | 0.601886 | layout.go | starcoder |
package astvisit
import (
"go/ast"
"golang.org/x/tools/go/ast/astutil"
)
type Cursor interface {
// Path returns the current path of the cursor
Path() Path
// Node returns the current Node.
Node() ast.Node
// Parent returns the parent of the current Node.
Parent() ast.Node
// ParentField returns the name... | cursor.go | 0.742702 | 0.490358 | cursor.go | starcoder |
package timeinterval
import (
"encoding/json"
"fmt"
"time"
)
// Repeating describes an interval with recurring events distributed evenly by the duration of the interval.
// The number of Repetitions determine the bounds of the repeating interval (from StartsAt).
// When Repetitions is unset, then the repeating int... | timeinterval/repeating.go | 0.835215 | 0.431704 | repeating.go | starcoder |
package formats
import (
"fmt"
"io"
"sort"
"github.com/anaminus/rbxmk"
"github.com/anaminus/rbxmk/dump"
"github.com/anaminus/rbxmk/rtypes"
"github.com/robloxapi/rbxattr"
"github.com/robloxapi/types"
)
func decodeAttributeValue(a rbxattr.Value) (t types.Value, err error) {
switch a := a.(type) {
case *rbxat... | formats/rbxattr.go | 0.558809 | 0.403861 | rbxattr.go | starcoder |
package ast
// Packge ast implement the Abstract Syntax Tree that represents the parsed
// source code before being passed on to the interpreter for evaluation.
import (
"bytes"
"strings"
"Primate/token"
)
// Node defines an interface for all nodes in the AST.
type Node interface {
TokenLiteral() string
String... | ast/ast.go | 0.874359 | 0.484197 | ast.go | starcoder |
package randomvariate
import (
"math"
"math/rand"
)
// Multinomial draws n samples from a probability distribution given by the
// set of probabilities p. Uses the inversion method which may be inefficient
// when the number of categories and number of samples are both large.
func Multinomial(n int, p []float64) []... | multinomial.go | 0.710025 | 0.594963 | multinomial.go | starcoder |
package simplevdf
import (
"crypto/sha256"
"fmt"
"math/big"
"runtime"
"time"
)
type pair struct {
a *big.Int
b *big.Int
}
type trip struct {
g1 *big.Int
h1 *big.Int
t int
}
type cipherPair struct {
c *big.Int
proof []trip
}
func square(base, modulus *big.Int) *big.Int {
return new(big.Int).Mod(ne... | go/candidates/simple_vdf/pvdf.go | 0.530966 | 0.427815 | pvdf.go | starcoder |
package gridspech
import (
"strings"
)
// TileSet represents a mathematical set of tiles. Tiles are compared using ==.
type TileSet struct {
set map[Tile]struct{}
}
// NewTileSet returns a TileSet containing only tiles.
func NewTileSet(tiles ...Tile) TileSet {
var ts TileSet
for _, tile := range tiles {
ts.Add... | tileSet.go | 0.80567 | 0.471588 | tileSet.go | starcoder |
package gonum
import (
"math/cmplx"
"gonum.org/v1/gonum/blas"
"gonum.org/v1/gonum/internal/asm/c128"
)
// Zgerc performs the rank-one operation
// A += alpha * x * y^H
// where A is an m×n dense matrix, alpha is a scalar, x is an m element vector,
// and y is an n element vector.
func (Implementation) Zgerc(m, ... | blas/gonum/level2cmplx128.go | 0.601477 | 0.443902 | level2cmplx128.go | starcoder |
package merkle
import (
"bytes"
"fmt"
)
type SimpleProof struct {
Aunts [][]byte `json:"aunts"` // Hashes from leaf's sibling to a root's child.
}
// proofs[0] is the proof for items[0].
func SimpleProofsFromHashers(items []Hasher) (rootHash []byte, proofs []*SimpleProof) {
trails, rootSPN := trailsFromHashers(i... | pkg/merkle/simple_proof.go | 0.727879 | 0.44089 | simple_proof.go | starcoder |
// Sample program demonstrating decoupling with interface composition.
package main
import (
"errors"
"fmt"
"io"
"math/rand"
"time"
)
func init() {
rand.Seed(time.Now().UnixNano())
}
// =============================================================================
// Data is the structure of the data we are c... | topics/composition/example4/example4.go | 0.662469 | 0.422564 | example4.go | starcoder |
package p726
import (
"bufio"
"bytes"
"sort"
"strconv"
"strings"
)
type Atom struct {
atom string
cnt int
}
type Atoms []Atom
// Len is the number of elements in the collection.
func (a Atoms) Len() int {
return len(a)
}
// Less reports whether the element with
// index i should sort before the element wi... | algorithms/p726/726.go | 0.657978 | 0.413418 | 726.go | starcoder |
package input
import (
"time"
"github.com/Jeffail/benthos/lib/pipeline"
"github.com/Jeffail/benthos/lib/types"
"github.com/Jeffail/benthos/lib/util"
)
//------------------------------------------------------------------------------
// WithPipeline is a type that wraps both an input type and a pipeline type
// ... | plugin/benthos/lib/input/wrap_with_pipeline.go | 0.753285 | 0.432962 | wrap_with_pipeline.go | starcoder |
package util
import (
"sort"
"sync"
)
// IterAsync executes the given function f up to n times concurrently.
// Each call is done in a separate goroutine. On each iteration, the function f
// will be called with a unique sequential index i such that the index can be
// used to reference an element in an array or s... | vendor/github.com/atomix/go-client/pkg/client/util/async.go | 0.69946 | 0.41182 | async.go | starcoder |
package schema
import (
"errors"
"fmt"
"unicode"
)
type DataType string
const (
// DataTypeCRef The data type is a cross-reference, it is starting with a capital letter
DataTypeCRef DataType = "cref"
// DataTypeString The data type is a value of type string
DataTypeString DataType = "string"
// DataTypeText... | entities/schema/data_types.go | 0.587352 | 0.743098 | data_types.go | starcoder |
package iso20022
// Specifies rates.
type CorporateActionRate70 struct {
// Cash dividend amount per equity before deductions or allowances have been made.
GrossDividendRate []*GrossDividendRateFormat21Choice `xml:"GrssDvddRate,omitempty"`
// Cash dividend amount per equity after deductions or allowances have bee... | CorporateActionRate70.go | 0.836821 | 0.621455 | CorporateActionRate70.go | starcoder |
package atomic
import "sync/atomic"
// AtomicInt implements an int value with atomic semantics
type AtomicInt struct {
val int64
}
// NewAtomicInt generates a newVal AtomicInt instance.
func NewAtomicInt(value int) *AtomicInt {
v := int64(value)
return &AtomicInt{
val: v,
}
}
// AddAndGet atomically adds the... | vendor/github.com/aerospike/aerospike-client-go/types/atomic/int.go | 0.865991 | 0.58516 | int.go | starcoder |
package versionary
import (
"sort"
)
// TextValue represents a key-value pair where the value is a string.
type TextValue struct {
Key string `json:"key"`
Value string `json:"value"`
}
// NumValue represents a key-value pair where the value is a number.
type NumValue struct {
Key string `json:"key"`
Value ... | record.go | 0.844922 | 0.556701 | record.go | starcoder |
package xpath
import (
"errors"
"fmt"
)
// NodeType represents a type of XPath node.
type NodeType int
const (
// RootNode is a root node of the XML document or node tree.
RootNode NodeType = iota
// ElementNode is an element, such as <element>.
ElementNode
// AttributeNode is an attribute, such as id='123'... | xpath.go | 0.68056 | 0.516047 | xpath.go | starcoder |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.