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 main
import (
"encoding/gob"
"fmt"
"github.com/mijia/gopark"
"math/rand"
"strconv"
"strings"
)
func CloseCenter(p gopark.Vector, centers []gopark.Vector) int {
minDist := p.EulaDistance(centers[0])
minIndex := 0
for i := 1; i < len(centers); i++ {
dist := p.EulaDist... | examples/kmeans.go | 0.569613 | 0.413655 | kmeans.go | starcoder |
// Package attr defines types and helpers for accessing typed attributes.
package attr
// Getter is an interface which is implemented by types which want to export typed
// values.
type Getter interface {
GetInt(string) int
GetString(string) string
GetStrings(string) []string
}
// Interface is a type which define... | index/attr/attr.go | 0.790773 | 0.422803 | attr.go | starcoder |
package main
import (
"fmt"
"strings"
)
/* slice is an array-like data type:
- can be size-flexible, up to a size of an array
- a 'window' on an underlying array
- every slice has 3 properties:
1. pointer: start of the slice
2. length: the number of elements in the slice: len()
3. capacity: maximum number of ele... | basics/slices.go | 0.59561 | 0.461866 | slices.go | starcoder |
package main
import (
"github.com/nsf/termbox-go"
"github.com/simp7/nonogram"
"github.com/simp7/nonogram/unit"
)
type player struct {
problemPosition Pos
position Pos
playerMap [][]signal
bitmap [][]bool
color Color
core nonogram.Core
}
//Player returns in-play log... | player.go | 0.603465 | 0.446796 | player.go | starcoder |
package graphql
import (
"fmt"
"math"
"strconv"
"github.com/sprucehealth/graphql/language/ast"
)
func coerceInt(value interface{}) interface{} {
switch v := value.(type) {
case bool:
if v {
return 1
}
return 0
case int:
return value
case int8:
return int(v)
case int16:
return int(v)
case int... | scalars.go | 0.74158 | 0.422088 | scalars.go | starcoder |
package miner
import (
"github.com/NebulousLabs/Sia/encoding"
"github.com/NebulousLabs/Sia/modules"
"github.com/NebulousLabs/Sia/types"
)
// ProcessConsensusDigest will update the miner's most recent block.
func (m *Miner) ProcessConsensusChange(cc modules.ConsensusChange) {
m.mu.Lock()
defer m.mu.Unlock()
// ... | modules/miner/update.go | 0.508544 | 0.538983 | update.go | starcoder |
package freesound
import (
"net/http"
"fmt"
"io/ioutil"
"encoding/json"
)
const (
SORT_SCORE = "score" //Sort by a relevance score returned by our search engine (default).
SORT_DURATION_DESC = "duration_desc" //Sort by the duration of the sounds, longest sounds first.
SORT_DURATION_ASC = "duration_asc" //Same a... | Scraper/freesound/freesound.go | 0.687 | 0.505249 | freesound.go | starcoder |
package bitfield
import (
"encoding/binary"
"math/bits"
)
var _ = Bitfield(Bitvector128{})
// Bitvector128 is a bitfield with a fixed defined size of 128. There is no length bit
// present in the underlying byte array.
type Bitvector128 []byte
const bitvector128ByteSize = 16
const bitvector128BitSize = bitvector1... | bitvector128.go | 0.801819 | 0.437223 | bitvector128.go | starcoder |
package day08
import (
"errors"
"fmt"
"math/bits"
"sort"
"strings"
"advent2021.com/util"
)
type Display int
const (
DisplayZero Display = iota
DisplayOne
DisplayTwo
DisplayThree
DisplayFour
DisplayFive
DisplaySix
DisplaySeven
DisplayEight
DisplayNine
DisplayUnknown
)
type Entry struct {
Input []... | day08/day08.go | 0.593256 | 0.42471 | day08.go | starcoder |
package main
import (
"strconv"
"gopkg.in/yaml.v2"
)
// CostMatrix is matrix of upgrade costs.
type CostMatrix map[string]map[int]map[int]int
// costMatrixYAML is the Json representation of the matrix.
type costMatrixYAML map[string]map[string]map[string]int
// Price returns the cost in the matrix corresponding... | src/adeptus/cost_matrix.go | 0.684791 | 0.510924 | cost_matrix.go | starcoder |
package artifacts
import (
"github.com/pkg/errors"
"github.com/insolar/insolar/insolar"
)
func NewCodeDescriptor(code []byte, machineType insolar.MachineType, ref insolar.Reference) CodeDescriptor {
return &codeDescriptor{
code: code,
machineType: machineType,
ref: ref,
}
}
// CodeDescript... | logicrunner/artifacts/descriptors.go | 0.84556 | 0.428413 | descriptors.go | starcoder |
package pflag
import "strconv"
// -- float64 Value
type float64Value float64
func newFloat64Value(val float64, p *float64) *float64Value {
*p = val
return (*float64Value)(p)
}
func (f *float64Value) Set(s string) error {
v, err := strconv.ParseFloat(s, 64)
*f = float64Value(v)
return err
}
func (f *float64Val... | vendor/github.com/spf13/pflag/float64.go | 0.837985 | 0.574992 | float64.go | starcoder |
package f64
import (
"context"
"log"
)
// DenseVector a vector
type DenseVector struct {
l int // length of the sparse vector
values []float64
}
// NewDenseVector returns a DenseVector
func NewDenseVector(l int) *DenseVector {
return &DenseVector{l: l, values: make([]float64, l)}
}
// NewDenseVectorFromA... | f64/denseVector.go | 0.835685 | 0.776326 | denseVector.go | starcoder |
package builder
import (
"strconv"
"github.com/skriptble/wilson/bson/decimal"
"github.com/skriptble/wilson/bson/objectid"
)
// ArrayElementer is the interface implemented by types that can serialize
// themselves into a BSON array element.
type ArrayElementer interface {
ArrayElement(pos uint) Elementer
}
// Ar... | bson/builder/array_constructor.go | 0.827515 | 0.646237 | array_constructor.go | starcoder |
package condition
import (
"bytes"
"errors"
"fmt"
"net"
"regexp"
"github.com/Jeffail/benthos/v3/lib/log"
"github.com/Jeffail/benthos/v3/lib/metrics"
"github.com/Jeffail/benthos/v3/lib/types"
"github.com/Jeffail/benthos/v3/lib/x/docs"
radix "github.com/armon/go-radix"
"github.com/spf13/cast"
)
//----------... | lib/condition/text.go | 0.784567 | 0.628977 | text.go | starcoder |
package mailgun
import (
"fmt"
"time"
)
// Events are open-ended, loosely-defined JSON documents.
// They will always have an event and a timestamp field, however.
type Event map[string]interface{}
// noTime always equals an uninitialized Time structure.
// It's used to detect when a time parameter is provided.
va... | vendor/github.com/mailgun/mailgun-go/events.go | 0.671471 | 0.407864 | events.go | starcoder |
package function
import (
"errors"
"fmt"
kanzi "github.com/flanglet/kanzi-go"
)
const (
_TRANSFORM_SKIP_MASK = 0xFF
)
// ByteTransformSequence encapsulates a sequence of transforms or functions in a function
type ByteTransformSequence struct {
transforms []kanzi.ByteTransform // transforms or functions
skipFl... | function/ByteTransformSequence.go | 0.818773 | 0.660035 | ByteTransformSequence.go | starcoder |
package main
import (
"fmt"
t "github.com/wallberg/jbtracer"
)
func main() {
var material *t.Material
// Configure the world
world := t.NewWorld()
world.Light = t.NewPointLight(t.White, t.NewPoint(-10, 10, -10))
// Configure the camera
camera := t.NewCamera(300, 150, t.Pi3)
camera.Transform = t.ViewTrans... | cmd/chapter7/snowman/snowman.go | 0.620392 | 0.418637 | snowman.go | starcoder |
package advent
import (
"container/heap"
"math"
. "github.com/davidparks11/advent2021/internal/advent/day15"
"github.com/davidparks11/advent2021/internal/coordinate"
)
type chiton struct {
dailyProblem
}
func NewChiton() Problem {
return &chiton{
dailyProblem{
day: 15,
},
}
}
func (c *chiton) Solve()... | internal/advent/day15.go | 0.766643 | 0.524821 | day15.go | starcoder |
package bynom
import (
"context"
"fmt"
"strconv"
"strings"
)
// ErrExpectationFailed describes what have been expected and what encountered.
type ErrExpectationFailed struct {
Expected interface{} // Which range has been expected.
Have byte // Which byte encountered.
Not bool // Not nega... | errors.go | 0.536313 | 0.423995 | errors.go | starcoder |
package grok
import (
"regexp"
)
// Config is used to pass a set of configuration values to the grok.New function.
type Config struct {
NamedCapturesOnly bool
SkipDefaultPatterns bool
RemoveEmptyValues bool
Patterns map[string]string
}
// Grok holds a cache of known pattern substitions and acts a... | grok.go | 0.840717 | 0.405096 | grok.go | starcoder |
package stacks
import "errors"
const FixedStackSize = 3
// ThreeStacksInOneArray struct that holds three stacks in one array
type ThreeStacksInOneArray struct {
numberOfStacks int
stackCapacity int
values []int
sizes []int
}
// MakeThreeInOneStack creates a three in one (fixed size stack)
func... | internal/stacks/three_in_one.go | 0.672224 | 0.425665 | three_in_one.go | starcoder |
package storage
import (
"math"
"math/rand"
"time"
"github.com/google/uuid"
)
type SensorValueType string
const (
Temperature SensorValueType = "temperature"
Pressure SensorValueType = "pressure"
Humidity SensorValueType = "humidity"
Co2Level SensorValueType = "co2level"
)
const (
SensorId strin... | storage/weather-data.go | 0.679604 | 0.449211 | weather-data.go | starcoder |
package yqlib
import (
"container/list"
yaml "gopkg.in/yaml.v3"
)
// A yaml expression evaluator that runs the expression once against all files/nodes in memory.
type Evaluator interface {
EvaluateFiles(expression string, filenames []string, printer Printer, leadingContentPreProcessing bool) error
// EvaluateNo... | pkg/yqlib/all_at_once_evaluator.go | 0.561936 | 0.400837 | all_at_once_evaluator.go | starcoder |
package steps
import (
"context"
"encoding/json"
"fmt"
"io"
"strconv"
"time"
"github.com/ONSdigital/dp-healthcheck/healthcheck"
"github.com/ONSdigital/dp-kafka/v3/kafkatest"
"github.com/ONSdigital/dp-search-data-finder/models"
"github.com/ONSdigital/dp-search-data-finder/schema"
"github.com/cucumber/godog"... | features/steps/steps.go | 0.667039 | 0.408277 | steps.go | starcoder |
package consts
const (
// MaxGridSum represents the max value from a cell grid width
MaxGridSum float64 = 12.0
)
// Family is a representation of a family Font
type Family string
const (
// Arial represents an arial Font
Arial Family = "arial"
// Helvetica represents a helvetica Font
Helvetica Family = "helvet... | pkg/consts/consts.go | 0.680879 | 0.433262 | consts.go | starcoder |
package apply
import (
"fmt"
)
// Element contains the record, local, and remote value for a field in an object
// and metadata about the field read from openapi.
// Calling Merge on an element will apply the passed in strategy to Element -
// e.g. either replacing the whole element with the local copy or merging ea... | pkg/kubectl/apply/element.go | 0.619471 | 0.513059 | element.go | starcoder |
package linode
import (
"github.com/pkg/errors"
"github.com/pulumi/pulumi/sdk/go/pulumi"
)
// Provides a Linode Instance resource. This can be used to create, modify, and delete Linodes.
// For more information, see [Getting Started with Linode](https://linode.com/docs/getting-started/) and the [Linode APIv4 docs... | sdk/go/linode/instance.go | 0.735071 | 0.435121 | instance.go | starcoder |
package graphics
import (
"image/color"
"github.com/hajimehoshi/ebiten/v2"
)
var (
brushImage = ebiten.NewImage(1, 1)
)
func init() {
brushImage.Fill(color.RGBA{255, 255, 255, 255})
}
var (
boxIndices = [6]uint16{0, 1, 2, 1, 2, 3}
)
func AppendQuadVerticesIndices(vertices []ebiten.Vertex, indices []uint16, x... | graphics/quad.go | 0.546496 | 0.425367 | quad.go | starcoder |
package lib
// Min returns the minimum of the supplied values.
func Min(vals ...int) int {
Assertf(len(vals) > 0, "No values given")
min := vals[0]
for _, v := range vals[1:] {
if v < min {
min = v
}
}
return min
}
// Max returns the maximum of the supplied values.
func Max(vals ...int) int {
Assertf(len... | lib/math.go | 0.853348 | 0.44746 | math.go | starcoder |
package conditions
import (
"fmt"
"github.com/onsi/gomega"
"github.com/onsi/gomega/types"
clusterv1 "sigs.k8s.io/cluster-api/api/v1beta1"
)
// MatchConditions returns a custom matcher to check equality of clusterv1.Conditions.
func MatchConditions(expected clusterv1.Conditions) types.GomegaMatcher {
return &ma... | util/conditions/matcher.go | 0.783119 | 0.427098 | matcher.go | starcoder |
package result
type Result struct {
Success interface{}
Failure error
}
// Create a new failure result
func NewFailure(err error) Result {
result := Result {
Success: nil,
Failure: err,
}
return result
}
// Create a new success Result
func NewSuccess(value interface{}) Result {
result := Result... | src/result/result.go | 0.842183 | 0.442998 | result.go | starcoder |
package iso20022
// Parameters applied to the settlement of a security transfer.
type Transfer5 struct {
// Unique and unambiguous identifier for a group of individual transfers as assigned by the instructing party. This identifier links the individual transfers together.
MasterReference *Max35Text `xml:"MstrRef,om... | Transfer5.go | 0.813053 | 0.400925 | Transfer5.go | starcoder |
package matchers
import (
"bytes"
"debug/macho"
"encoding/binary"
)
// Java bytecode and Mach-O binaries share the same magic number.
// More info here https://github.com/threatstack/libmagic/blob/master/magic/Magdir/cafebabe
func classOrMachOFat(in []byte) bool {
// There should be at least 8 bytes for both of t... | internal/matchers/binary.go | 0.750461 | 0.415551 | binary.go | starcoder |
package models
import (
"encoding/json"
"fmt"
"io/ioutil"
"net/http"
"github.com/aosousa/go-lol-esports/utils"
)
// Match is the struct that represents a League of Legends eSports match.
type Match struct {
Winner Winner `json:"winner"` // Information about the winner of the match
Opponents Opponents `j... | models/match.go | 0.59749 | 0.484014 | match.go | starcoder |
package introspection
import (
"fmt"
"github.com/ccbrown/api-fu/graphql/schema"
)
type SchemaData struct {
QueryType TypeData
MutationType *TypeData
SubscriptionType *TypeData
Types []TypeData
Directives []DirectiveData
}
// Gets a schema definition for the given schema data. This... | graphql/schema/introspection/schema_data.go | 0.565179 | 0.441492 | schema_data.go | starcoder |
package associations
import (
"reflect"
"github.com/gobuffalo/nulls"
"github.com/gobuffalo/pop/v5/columns"
)
// Association represents a definition of a model association
// field. It can represent a association of the type has_many
// belongs_to or has_one, and other customized types.
type Association interface ... | associations/association.go | 0.784402 | 0.44059 | association.go | starcoder |
package goapi
import . `github.com/yak-labs/chirp-lang`
import (
bufio `bufio`
bytes `bytes`
encoding_base64 `encoding/base64`
fmt `fmt`
io_ioutil `io/ioutil`
math `math`
math_big `math/big`
net `net`
net_http `net/http`
os `os`
reflect `reflect`
regexp `regexp`
strconv `strconv`
strings `strings`
time ... | goapi/default/wrap.go | 0.533641 | 0.537041 | wrap.go | starcoder |
package condition
import (
"encoding/json"
"github.com/Jeffail/benthos/v3/lib/log"
"github.com/Jeffail/benthos/v3/lib/metrics"
"github.com/Jeffail/benthos/v3/lib/types"
)
//------------------------------------------------------------------------------
func init() {
Constructors[TypeNot] = TypeSpec{
construct... | lib/condition/not.go | 0.752286 | 0.721369 | not.go | starcoder |
package mat
import (
"fmt"
"github.com/jacsmith21/gnn/vec"
)
// Matrix Matrix
type Matrix struct {
cols []vec.Vector
}
// At returns the element at the ith row and jth column
func (m Matrix) At(i, j int) float64 {
return m.cols[j].At(i)
}
// Set sets the number at the ith row & jth column to the given number
f... | mat/matrix.go | 0.821689 | 0.724749 | matrix.go | starcoder |
package sweetiebot
import (
"math/rand"
"strconv"
"strings"
"github.com/bwmarrin/discordgo"
)
type QuoteModule struct {
}
func (w *QuoteModule) Name() string {
return "Quotes"
}
func (w *QuoteModule) Register(info *GuildInfo) {}
func (w *QuoteModule) Commands() []Command {
return []Command{
&QuoteCommand{... | sweetiebot/quote_command.go | 0.647018 | 0.503723 | quote_command.go | starcoder |
package mp4
import "github.com/wader/fq/pkg/scalar"
// from:
// https://cconcolato.github.io/mp4ra/filetype.html
// https://exiftool.org/TagNames/QuickTime.html
var brandDescriptions = scalar.StrToScalar{
"3g2a": {Description: "3GPP2"},
"3g2b": {Description: "3GPP2 Media (.3G2) compliant with 3GPP2 C.S0050-A V1.0.0... | format/mp4/brands.go | 0.769427 | 0.477676 | brands.go | starcoder |
package cryptoapis
import (
"encoding/json"
)
// ListTransactionsByBlockHashRI struct for ListTransactionsByBlockHashRI
type ListTransactionsByBlockHashRI struct {
// Represents the index position of the transaction in the specific block.
Index int32 `json:"index"`
// Represents the hash of the block where this ... | model_list_transactions_by_block_hash_ri.go | 0.882231 | 0.405743 | model_list_transactions_by_block_hash_ri.go | starcoder |
package fov
import (
"math"
)
// GridMap is meant to represent the basic functionality that is required to detect the opaqueness
// and boundaries of a 2D grid
type GridMap interface {
InBounds(x, y int) bool
IsOpaque(x, y int) bool
}
//point to hold a x, y position
type point struct {
x, y int
}
// gridSet is ... | fov/fov.go | 0.813794 | 0.754486 | fov.go | starcoder |
package types
import (
"github.com/attic-labs/noms/go/d"
"github.com/attic-labs/noms/go/hash"
"github.com/attic-labs/noms/go/util/orderedparallel"
)
const (
objectWindowSize = 8
orderedSequenceWindowSize = 1
objectPattern = uint32(1<<6 - 1) // Average size of 64 elements
)
var emptyKey = ... | go/types/meta_sequence.go | 0.624294 | 0.429429 | meta_sequence.go | starcoder |
package main
import (
"fmt"
)
func main() {
// fake an input channel, and make it feed values to it.
chIn := make(chan int)
go func() {
for i := 1; i <= 20; i++ {
chIn <- i
}
close(chIn)
}()
b := newBuffer(5)
b.start(chIn)
// Loop and read a value from the out channel, and also show the content
//... | slice/07-slice-buffer-reading-from-channel/main.go | 0.511717 | 0.42913 | main.go | starcoder |
// Package literal provides an abstraction to manipulate BadWolf literals.
package literal
import (
"bytes"
"encoding/binary"
"fmt"
"math"
"strconv"
"strings"
"sync"
"github.com/pborman/uuid"
)
// bufPool keeps a pool of bytes.Buffer for the UUID() method.
var bufPool = sync.Pool{New: func() interface{} { r... | triple/literal/literal.go | 0.791136 | 0.474205 | literal.go | starcoder |
package parser
import (
"mutant/ast"
"mutant/token"
)
func (p *Parser) parseIfExpression() ast.Expression {
exp := &ast.IfExpression{Token: p.curToken}
if !p.expectPeek(token.LPAREN) {
return nil
}
p.nextToken()
exp.Condition = p.parseExpression(LOWEST)
if !p.expectPeek(token.RPAREN) {
return nil
}
if... | parser/parse_expressions.go | 0.61057 | 0.430866 | parse_expressions.go | starcoder |
package xmobilebackend
import (
"image"
"math"
"unsafe"
"github.com/gsvigruha/canvas/backend/backendbase"
"golang.org/x/mobile/gl"
)
func (b *XMobileBackend) Clear(pts [4]backendbase.Vec) {
b.activate()
// first check if the four points are aligned to form a nice rectangle, which can be more easily
// clear... | backend/xmobilebackend/fill.go | 0.576542 | 0.46794 | fill.go | starcoder |
package parser
import (
"errors"
"fmt"
"strconv"
"strings"
"github.com/bradford-hamilton/dora/pkg/ast"
"github.com/bradford-hamilton/dora/pkg/lexer"
"github.com/bradford-hamilton/dora/pkg/token"
)
// Parser holds a Lexer, errors, the currentToken, and the peek peekToken (next token).
// Parser methods handle ... | pkg/parser/parser.go | 0.640748 | 0.448426 | parser.go | starcoder |
package gt
import (
"database/sql/driver"
r "reflect"
"strconv"
)
/*
Similar to `json.RawMessage` but supports text, JSON, SQL. In all contexts,
stores and returns self as-is, with no encoding or decoding.
*/
type Raw []byte
var (
_ = Encodable(Raw(nil))
_ = Decodable((*Raw)(nil))
)
// Implement `gt.Zeroable`.... | gt_raw.go | 0.780621 | 0.425904 | gt_raw.go | starcoder |
package ansi8
// BlackString is a convenient helper function to return a string with black
// foreground.
func BlackString(format string, a ...interface{}) string { return colorString(format, FgBlack, a...) }
// RedString is a convenient helper function to return a string with red
// foreground.
func RedString(format... | ansi8/colorstring.go | 0.866839 | 0.422266 | colorstring.go | starcoder |
package ast
// LocalStat is a statement node representing the declaration / definition of a
// list of local variables.
type LocalStat struct {
Location
NameAttribs []NameAttrib
Values []ExpNode
}
var _ Stat = LocalStat{}
// NewLocalStat returns a LocalStat instance defining the given names with the
// given... | ast/localstat.go | 0.619817 | 0.437163 | localstat.go | starcoder |
package tiletools
import (
"bufio"
"fmt"
"image"
"image/draw"
"os"
"github.com/disintegration/imaging"
)
// Section indicates which part of the image to keep
type Section int
// ...
const (
Top Section = iota
Bottom
Left
Right
)
// KeepSize indicates the size of the image to keep
type KeepSize int
// ..... | image.go | 0.592784 | 0.42477 | image.go | starcoder |
package stateful
import (
"regexp"
"time"
"github.com/influxdata/kapacitor/tick/ast"
)
type operationKey struct {
operator ast.TokenType
leftType ast.ValueType
rightType ast.ValueType
}
var boolTrueResultContainer = resultContainer{BoolValue: true, IsBoolValue: true}
var boolFalseResultContainer = resultCon... | tick/stateful/evaluation_funcs.go | 0.619011 | 0.506774 | evaluation_funcs.go | starcoder |
package migration
import (
"github.com/beego/beego/v2/client/orm/migration"
)
// Index struct defines the structure of Index Columns
type Index migration.Index
// Unique struct defines a single unique key combination
type Unique migration.Unique
// Column struct defines a single column of a table
type Column migr... | adapter/migration/ddl.go | 0.764452 | 0.50653 | ddl.go | starcoder |
package common
import (
"fmt"
"github.com/shopspring/decimal"
)
type HashRate float64
var (
HashRateUnit = int64(1)
HashRateUnitK = HashRateUnit * int64(1000)
HashRateUnitM = HashRateUnitK * int64(1000)
HashRateUnitG = HashRateUnitM * int64(1000)
HashRateUnitT = HashRateUnitG * int64(1000)
HashRateUnitP = H... | common/hashrate.go | 0.655115 | 0.428174 | hashrate.go | starcoder |
package vec2d
import "math"
// Rotated rotates a Vector by given angle degrees in float64 and returns a new one
func Rotated(vector *Vector, angle_degrees float64) *Vector {
new_vector := New(vector.X, vector.Y)
new_vector.Rotate(angle_degrees)
return new_vector
}
// GetAngleBetween returns the angle between two... | utils.go | 0.948513 | 0.856512 | utils.go | starcoder |
package iso20022
// Information related for the transportation of goods by sea.
type TransportBySea6 struct {
// Identifies the port where the goods are loaded on board the ship.
PortOfLoading []*Max35Text `xml:"PortOfLoadng,omitempty"`
// Identifies the port where the goods are discharged.
PortOfDischarge []*Ma... | TransportBySea6.go | 0.754644 | 0.424352 | TransportBySea6.go | starcoder |
package dataframe
import (
"fmt"
"time"
)
// Vector represents a collection of Elements.
type Vector interface {
Set(idx int, i interface{})
Append(i interface{})
At(i int) interface{}
Len() int
PrimitiveType() VectorPType
//buildArrowColumn(pool memory.Allocator, field arrow.Field) *array.Column
}
func newV... | vendor/github.com/grafana/grafana-plugin-sdk-go/dataframe/vector.go | 0.63341 | 0.579073 | vector.go | starcoder |
// Package kunstruct provides unstructured from api machinery and factory for creating unstructured
package kunstruct
import (
"fmt"
"strconv"
"strings"
)
// A PathSection contains a list of nested fields, which may end with an
// indexable value. For instance, foo.bar resolves to a PathSection with 2
// fields a... | api/k8sdeps/kunstruct/helper.go | 0.539469 | 0.54958 | helper.go | starcoder |
package is
import (
"fmt"
"github.com/sammiq/charmset"
"github.com/sammiq/charmset/internal"
)
// EqualTo returns a matcher that checks whether a value is equal to an expected value.
// There are some small type conversions allowed of this expected value, and numbers can be
// converted provided that no truncatio... | matchers/is/equal.go | 0.820577 | 0.518607 | equal.go | starcoder |
package intrusive
import "unsafe"
// Heap presents a binary heap.
type Heap struct {
nodeOrderer HeapNodeOrderer
nodes []*HeapNode
}
// Init initializes the heap and then returns the heap.
func (h *Heap) Init(nodeOrderer HeapNodeOrderer, initialCapacity int) *Heap {
h.nodeOrderer = nodeOrderer
h.nodes = ma... | heap.go | 0.862496 | 0.483892 | heap.go | starcoder |
package expr
func init() {
registerCond("<", func(left float64, right float64) bool {
return left < right
})
registerCond("<=", func(left float64, right float64) bool {
return left <= right
})
registerCond("=", func(left float64, right float64) bool {
return left == right
})
registerCond("<>", func(lef... | expr/conds.go | 0.885601 | 0.718224 | conds.go | starcoder |
package transaction
import (
"fmt"
"github.com/iotaledger/goshimmer/dapps/valuetransfers/packages/address"
"github.com/iotaledger/hive.go/marshalutil"
"github.com/mr-tron/base58"
)
// OutputID is the data type that represents the identifier for a Output.
type OutputID [OutputIDLength]byte
// NewOutputID is the ... | dapps/valuetransfers/packages/transaction/outputid.go | 0.793026 | 0.418816 | outputid.go | starcoder |
package cmd
import (
"fmt"
"math"
)
type stepper interface {
step(x, y float64) stepper
values(format string) []string
ready() bool
}
type inPlaceStepper struct {
xsaved, ysaved float64 // saved values for printing
xstart, ystart, xprev, yprev float64
anglemin, anglemax float64
stepN... | cmd/stepper.go | 0.60054 | 0.603815 | stepper.go | starcoder |
package query
type Pageable interface {
/**
* Returns the page to be returned.
*
* @return the page to be returned.
*/
GetPageNumber() int32
/**
* Returns the number of items to be returned.
*
* @return the number of items of that page
*/
GetPageSize() int32
/**
* Returns the offset to be tak... | query/pageable.go | 0.908894 | 0.408749 | pageable.go | starcoder |
package buffer
import (
"fmt"
"github.com/KlyuchnikovV/stack"
)
type BufferTree struct {
root *Line
size int
}
func NewTree(data []rune) *BufferTree {
return &BufferTree{
root: NewLine(data),
size: 1,
}
}
func (tree *BufferTree) Insert(data []rune, position int) error {
if position > tree.size || positi... | tree.go | 0.590543 | 0.407923 | tree.go | starcoder |
package render
import (
"image"
"image/color"
"math"
)
type progressFunction func(x, y, w, h int) float64
// Progress functions
var (
//HorizontalProgress measures progress as x / w
HorizontalProgress = func(x, y, w, h int) float64 {
return float64(x) / float64(w)
}
//VerticalProgress measures progress as y... | render/gradientbox.go | 0.763396 | 0.446917 | gradientbox.go | starcoder |
package reckon
import "math"
const (
// MaxExampleKeys sets an upper bound on the number of example keys that will
// be captured during sampling
MaxExampleKeys = 10
// MaxExampleElements sets an upper bound on the number of example elements that
// will be captured during sampling
MaxExampleElements = 10
// M... | stats.go | 0.877109 | 0.644435 | stats.go | starcoder |
package bdd
// Matcher can check if a passed-in value matches the matcher's expectations.
// Depending on the matcher arguments are required for the matching.
type Matcher interface {
// Apply applies the matcher to the passed-in data and returns a Result.
Apply(obtained interface{}, args []interface{}) Result
}
/... | matcher.go | 0.835752 | 0.492615 | matcher.go | starcoder |
package shoot
import (
"github.com/hashicorp/terraform/helper/schema"
)
func workerKubernetes() *schema.Resource {
return &schema.Resource{
Schema: map[string]*schema.Schema{
"kubelet": {
Type: schema.TypeList,
Description: "Kubelet contains configuration settings for the kubelet.",
Optional... | shoot/schema_shoot.go | 0.593845 | 0.417568 | schema_shoot.go | starcoder |
// stats is a simple commandline helper script for calculating basic
// statistics on a data file expected to consist of a single column
// of floating point numbers.
// NOTE: Currently stats will read in all the data to compute the statistics
// and thus require memory on the order of the data set size.
package main
... | stats.go | 0.594904 | 0.609117 | stats.go | starcoder |
package suggest
import (
"errors"
"math"
"github.com/suggest-go/suggest/pkg/index"
"github.com/suggest-go/suggest/pkg/merger"
)
// Candidate is an item of Collector
type Candidate struct {
// Key is a position (docId) in posting list
Key index.Position
// Score is a float64 number that represents a score of a... | pkg/suggest/collector.go | 0.791459 | 0.414899 | collector.go | starcoder |
package ion
import (
"io"
)
// Writing binary ion is a bit tricky: values are preceded by their length,
// which can be hard to predict until we've actually written out the value.
// To make matters worse, we can't predict the length of the /length/ ahead
// of time in order to reserve space for it, because it uses ... | ion/buf.go | 0.639961 | 0.441071 | buf.go | starcoder |
package vat
import (
"encoding/json"
"strings"
"github.com/tim-online/go-exactonline/edm"
"github.com/tim-online/go-exactonline/utils"
)
type VatCodes []VatCode
type VatCode struct {
ID edm.GUID `json:"ID"` // Primary key
Account ... | vat/models.go | 0.637482 | 0.45744 | models.go | starcoder |
Package hazelcast provides the Hazelcast Go client.
Hazelcast is an open-source distributed in-memory data store and computation platform. It provides a wide variety of distributed data structures and concurrency primitives.
Hazelcast Go client is a way to communicate to Hazelcast IMDG clusters and access the cluster... | doc.go | 0.677154 | 0.566258 | doc.go | starcoder |
package goutils
import (
"time"
)
// BeginningOfDate returns the beginning date of a time.
func BeginningOfDate(t time.Time) time.Time {
return time.Date(t.Year(), t.Month(), t.Day(), 0, 0, 0, 0, t.Location())
}
// BeginningOfThisWeek returns the beginning date of this week.
func BeginningOfThisWeek() time.Time {
... | dateutils.go | 0.840701 | 0.654605 | dateutils.go | starcoder |
package day14
import (
"fmt"
"math"
"regexp"
"strconv"
"strings"
"github.com/OctaviPascual/AdventOfCode2019/util"
)
// Day holds the data needed to solve part one and part two
type Day struct {
reactions []reaction
}
type reaction struct {
reactants []balancedChemical
product balancedChemical
}
type bal... | day14/day14.go | 0.725649 | 0.462776 | day14.go | starcoder |
package texture
import (
"github.com/go-gl/gl/v3.3-core/gl"
"log"
"runtime"
)
type rectangle struct {
x, y, width, height int
}
func (rect rectangle) area() int {
return rect.width * rect.height
}
type TextureAtlas struct {
*TextureMultiLayer
padding int
subTextures map[string]*TextureRegion
emptySpace... | framework/graphics/texture/atlas.go | 0.778649 | 0.44571 | atlas.go | starcoder |
// Package bloom implements a Bloom Filter.
package bloom
import (
"encoding/binary"
"errors"
"fmt"
"io"
"math/bits"
"strconv"
"github.com/dchest/siphash"
)
// Filter is a delta-compressable bloom filter.
// following the logic from http://www.eecs.harvard.edu/~michaelm/NEWWORK/postscripts/cbf2.pdf
type Filt... | bloom.go | 0.79538 | 0.415373 | bloom.go | starcoder |
package sentiment
import (
"github.com/coderafting/panas-go/internal/text"
)
/*
Utility functions used to build `SelfRefSoundexIndex` and `StatesSoundexIndex` indexes.
*/
// BuildSoundexIndex generates a map of Soundex codes with their corresponding original strings.
func BuildSoundexIndex(words []string) map[strin... | pkg/sentiment/index.go | 0.668339 | 0.458773 | index.go | starcoder |
package utils
import (
"reflect"
"unicode"
"github.com/alecthomas/repr"
)
func Debug(arg interface{}) {
if arg != nil {
repr.Println(arg)
} else {
repr.Println("nil")
}
}
// Is the symbol exported by Go? Only names with upper case are exported.
func IsExported(name string) bool {
switch name {
// Ignore... | utils/utils.go | 0.545044 | 0.410106 | utils.go | starcoder |
package loghistogram
import "math"
type WindowedHistogram struct {
Histogram
prev struct { // previous window's data
n uint64
counts []uint64
}
}
func NewWindowed(low, high float64, num_buckets int) *WindowedHistogram {
h := &WindowedHistogram{}
h.Histogram.init(low, high, num_buckets)
h.prev.counts ... | window.go | 0.607896 | 0.471345 | window.go | starcoder |
package qrcode
// maskPatternModulo ...
// mask Pattern ref to: https://www.thonky.com/qr-code-tutorial/mask-patterns
type maskPatternModulo uint32
const (
// modulo0 (x+y) mod 2 == 0
modulo0 maskPatternModulo = iota
// modulo1 (x) mod 2 == 0
modulo1
// modulo2 (y) mod 3 == 0
modulo2
// modulo3 (x+y) mod 3 == ... | mask.go | 0.759939 | 0.497864 | mask.go | starcoder |
package config
/**
* Configuration for LSN group resource.
*/
type Lsngroup struct {
/**
* Name for the LSN group. Must begin with an ASCII alphanumeric or underscore (_) character, and must contain only ASCII alphanumeric, underscore, hash (#), period (.), space, colon (:), at (@), equals (=), and hyphen (-) chara... | resource/config/lsngroup.go | 0.782912 | 0.618377 | lsngroup.go | starcoder |
package main
import (
"fmt"
"github.com/golang-demos/chalk"
"math"
"strconv"
"strings"
)
// InputDice asks the user for their dice.
// If computer == 3 (so you plug in the input from the main option) it runs automatically.
func InputDice(computer int, keep [4]int, oldDice [5]int, reRollDuplicates bool) (dice [5]... | dice.go | 0.593845 | 0.499146 | dice.go | starcoder |
package jedi
import (
"bytes"
"math/big"
"github.com/ucbrise/jedi-pairing/lang/go/cryptutils"
"github.com/ucbrise/jedi-pairing/lang/go/wkdibe"
)
// PatternComponentType encodes the type of a pattern component.
type PatternComponentType int
// These constants describe the types of pattern components.
const (
UR... | pattern.go | 0.806358 | 0.477676 | pattern.go | starcoder |
package learner
import(
"github.com/hansen1101/go_heating/auxiliary/clustering"
"errors"
)
type simpleCluster struct {
clustersize int
centroid *deltaPoint
satelite, min,max *deltaPoint
averagePairOfPoints, density, radius, diameter float64
}
func (cluster *simpleCluster) DistanceTo(other *simpleCluster, pointD... | learner/simpleCluster.go | 0.595728 | 0.568056 | simpleCluster.go | starcoder |
package nifi
import (
"encoding/json"
)
// ControllerBulletinsEntity struct for ControllerBulletinsEntity
type ControllerBulletinsEntity struct {
// System level bulletins to be reported to the user.
Bulletins *[]BulletinEntity `json:"bulletins,omitempty"`
// Controller service bulletins to be reported to the us... | model_controller_bulletins_entity.go | 0.600188 | 0.430746 | model_controller_bulletins_entity.go | starcoder |
package light
import (
"github.com/g3n/engine/geometry"
"github.com/g3n/engine/graphic"
"github.com/g3n/engine/gui"
"github.com/g3n/engine/material"
"github.com/g3n/engine/math32"
"github.com/g3n/g3nd/app"
"github.com/g3n/g3nd/demos"
"math"
"github.com/g3n/g3nd/util"
)
type PointLight struct {
vl *util.... | light/point.go | 0.683102 | 0.450239 | point.go | starcoder |
package interpreter
import (
"fmt"
"github.com/smackem/ylang/internal/lang"
"reflect"
)
type Kernel struct {
Width int
Height int
Values []lang.Number
}
func (k Kernel) Compare(other Value) (Value, error) {
if r, ok := other.(Kernel); ok {
if reflect.DeepEqual(k, r) {
return Number(0), nil
}
}
retur... | internal/interpreter/kernel.go | 0.712732 | 0.448849 | kernel.go | starcoder |
package astp
import "go/ast"
// IsStmt reports whether a given ast.Node is a statement(ast.Stmt).
func IsStmt(node ast.Node) bool {
_, ok := node.(ast.Stmt)
return ok
}
// IsBadStmt reports whether a given ast.Node is a bad statement(*ast.BadStmt)
func IsBadStmt(node ast.Node) bool {
_, ok := node.(*ast.BadStmt)
... | vendor/github.com/go-toolsmith/astp/stmt.go | 0.765243 | 0.546738 | stmt.go | starcoder |
package assets
import (
"embed"
"image/color"
"github.com/sedyh/mizu/examples/particles/helper"
)
// This is where the images, colors and gradients are loaded.
var (
Background = color.RGBA{R: 41, G: 44, B: 45, A: 255}
FireA = helper.Image(fs, "data/image/fire-a.png")
FireB = helper.Image(fs, ... | examples/particles/assets/bundle.go | 0.640074 | 0.533154 | bundle.go | starcoder |
Common Password List
GT.M 03-DEC-2018 10:24:22
^commonPasswords(1000)
^commonPasswords(1001)
^commonPasswords(1002)
^commonPasswords(1003)
^commonPasswords(1004)
^commonPasswords(1005)
^commonPasswords(1007)
^commonPasswords(1008)
^commonPasswords(1009)
^commonPasswords(1010)
^commonPasswords(1011)
^commonPa... | oidc_provider/openid-connect-server/commonPasswords.go | 0.502197 | 0.661096 | commonPasswords.go | starcoder |
package gohotdraw
import (
_"container/vector"
"fmt"
)
type Figure interface {
MoveBy(figure Figure, dx int, dy int)
basicMoveBy(dx int, dy int)
changed(figure Figure)
GetDisplayBox() *Rectangle
GetSize(figure Figure) *Dimension
IsEmpty(figure Figure) bool
Includes(figure Figure) bool
Draw(g Graphics)
GetH... | code/gohotdraw-master/figures.go | 0.516595 | 0.404684 | figures.go | starcoder |
package riseset
import (
"math"
"strconv"
"time"
)
/*
RiseSet holds the rise and set times as strings in the form hh:mm
*/
type RiseSet struct {
Rise string
Set string
}
// Object specifies the astronomical object to calculate i.e. Sun, Moon or twilight
type Object int
const (
Moon Object = 1 + iota
Sun
Tw... | riseset.go | 0.570571 | 0.455078 | riseset.go | starcoder |
package solve
import (
gs "github.com/deanveloper/gridspech-go"
)
// SolveJoins returns a channel of solutions for all of the Join tiles.
func (g GridSolver) SolveJoins() <-chan gs.TileSet {
joinTiles := g.Grid.TilesWith(func(o gs.Tile) bool {
return o.Data.Type == gs.TypeJoin1 || o.Data.Type == gs.TypeJoin2
}).... | solve/join.go | 0.762159 | 0.496765 | join.go | starcoder |
package serverutil
import (
"fmt"
"sync/atomic"
"time"
)
// RateCounter is a counter that tracks how many values have been added per
// unit of time, averaged over a certain period. RateCounter is an expvar and
// thus can be used to count time-based events such as requests per second.
type RateCounter struct {
... | serverutil/ratecounter.go | 0.681409 | 0.554048 | ratecounter.go | starcoder |
package plotter
import (
"github.com/rainu/launchpad-super-trigger/config"
"github.com/rainu/launchpad-super-trigger/config/expressions"
"github.com/rainu/launchpad-super-trigger/pad"
"github.com/rainu/launchpad-super-trigger/plotter"
)
func buildStatic(allPlotter map[plotter.Plotter]config.Datapoint, staticPlott... | config/plotter/static.go | 0.59796 | 0.446977 | static.go | starcoder |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.