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 collections
import (
"fmt"
"math/rand"
)
type ImplicitTreap[T comparable] struct {
Root *ImplicitTreapNode[T]
}
type ImplicitTreapNode[T comparable] struct {
Left *ImplicitTreapNode[T]
Right *ImplicitTreapNode[T]
Value T
Size int
Priority float64
}
func NewImplicitTreapNode[T comparabl... | implicit_treap.go | 0.581778 | 0.473109 | implicit_treap.go | starcoder |
package main
import (
"fmt"
)
type tile struct {
x int
y int
visited bool
name string
}
var allTiles []tile
var edges map[*tile][]*tile
/*Part1 runs the code for part 1 of this puzzle*/
func Part1(fname string) {
allTiles = make([]tile, 0)
edges = make(map[*tile][]*tile)
maze := GetInput(fna... | puzzle20/part1.go | 0.544559 | 0.410993 | part1.go | starcoder |
package chronometer
import "time"
// Now returns a new timestamp.
func Now() time.Time {
return time.Now().UTC()
}
// Since returns the duration since another timestamp.
func Since(t time.Time) time.Duration {
return Now().Sub(t)
}
// Min returns the minimum of two times.
func Min(t1, t2 time.Time) time.Time {
i... | util.go | 0.915157 | 0.48688 | util.go | starcoder |
package apivideosdk
import (
//"encoding/json"
)
// Watermark struct for Watermark
type Watermark struct {
// The unique identifier of the watermark.
WatermarkId *string `json:"watermarkId,omitempty"`
// When the watermark was created, presented in ISO-8601 format.
CreatedAt *string `json:"createdAt,omitempty"`
... | model_watermark.go | 0.739422 | 0.418162 | model_watermark.go | starcoder |
package cdp
import (
"errors"
"log"
"math/big"
)
// CDP represents a CDP
type CDP struct {
ID int64
BytesID [32]byte
DaiDebt *big.Float
PethCol *big.Float
EthCol *big.Float
}
// GetRatio returns the collateralization ratio of the CDP at the actual price and Peth / Eth ratio
func (cdp *CDP) GetRatio(eth... | cdp/types.go | 0.759404 | 0.523238 | types.go | starcoder |
package roadmap
import (
"fmt"
"net/url"
"strings"
"time"
"github.com/peteraba/roadmapper/pkg/colors"
)
// VisualRoadmap represent a roadmap in a way that is prepared for visualization
type VisualRoadmap struct {
Title string
Projects []Project
Milestones []Milestone
Dates *Dates
DateFormat str... | pkg/roadmap/visual_roadmap_model.go | 0.652131 | 0.559531 | visual_roadmap_model.go | starcoder |
package traveler
import "strings"
// CountryAlpha2 is the country ISO_3166-1 alpha 2 code
type CountryAlpha2 string
// CountryAlpha3 is the country ISO_3166-1 alpha 3 code
type CountryAlpha3 string
// CountryInformation contains all the information associated with a country,
// according to ISO_3166-1
type CountryI... | traveler.go | 0.718397 | 0.45048 | traveler.go | starcoder |
package db
import (
"time"
"strings"
"strconv"
"encoding/json"
"database/sql/driver"
"github.com/s0ulw1sh/soulgost/utils"
)
type TimeMin struct {
Minutes int
}
func (d TimeMin) Value() (driver.Value, error) {
return d.String(), nil
}
func (d *TimeMin) Scan(value interface{}) error {
... | db/time.go | 0.645455 | 0.414129 | time.go | starcoder |
package config
type configItem struct {
label string
defaultValue string
description string
}
var logLevelDescription = `The level is either a name or a numeric value. The following table describes the meaning of the value.
|Value|Name |
|-----|-------|
|` + "`" + `0` + "`" + ` |` + "`" + `debug` + ... | config/default.go | 0.739893 | 0.531574 | default.go | starcoder |
package graphics
import (
"fmt"
"github.com/go-gl/gl/v4.6-core/gl"
"github.com/mokiat/gomath/sprec"
"github.com/mokiat/lacking/framework/opengl"
"github.com/mokiat/lacking/framework/opengl/game/graphics/internal"
"github.com/mokiat/lacking/game/graphics"
)
const (
framebufferWidth = int32(1920)
framebuffer... | framework/opengl/game/graphics/renderer.go | 0.616359 | 0.574335 | renderer.go | starcoder |
package bynom
import "context"
// Switch takes the result of the first parser from noms which finished without error.
// If all noms failed the function will return the last error encountered.
func Switch(noms ...Nom) Nom {
const funcName = "Switch"
return func(ctx context.Context, p Plate) (err error) {
var sta... | flow.go | 0.570331 | 0.441372 | flow.go | starcoder |
package record
import (
"encoding/json"
"errors"
"fmt"
"strings"
)
// Record represents data that belongs to an Skygear record
type Record struct {
RecordID string `json:"_id"`
Data map[string]interface{}
}
// Set sets value to a key in the record
func (r *Record) Set(key string, value interface{}) {
r.D... | record/record.go | 0.699049 | 0.443239 | record.go | starcoder |
package smath
/*
Golang package implementing quaternion math
Purpose is to provide quaternion support under the MIT license as existing
Go quaternion packages are under more restrictive or unspecified licenses.
This project is licensed under the terms of the MIT license.
*/
import (
"math"
)
// Set sets this Q fro... | smath/quaternion.go | 0.926345 | 0.570152 | quaternion.go | starcoder |
package main
import (
"fmt"
"github.com/golang-collections/go-datastructures/queue"
"math"
)
type Node struct {
value int
left, right *Node
}
type Tree struct {
root *Node
}
func (t *Tree) Add(value int) {
t.root = Add(t.root, value)
}
func Add(n *Node, value int) *Node {
if n == nil {
// Equivalen... | corpus/hermant.data-structure-algo/CH1/Tree.go | 0.621426 | 0.463566 | Tree.go | starcoder |
package datatypes
// const ticker
func (node ConstTickerNode) Vote (t Time) MaybeTime {
if t<node.ConstT {
return SomeTime(node.ConstT)
}
return NothingTime
}
func (node ConstTickerNode) Exec (t Time, _ InPipes) EvPayload {
if t==node.ConstT {
return Some(node.ConstW)
}
return... | striver-go/datatypes/tickernodes.go | 0.633637 | 0.433981 | tickernodes.go | starcoder |
package demofixtures
import (
"fmt"
"math"
"strconv"
"strings"
"unicode"
)
const absoluteZeroInCelsius float64 = -273.15
const absoluteZeroInFahrenheit float64 = -459.67
const parseError = "Expected float with suffix F, C or K but got '%v'"
const scaleError = "Unrecognized temperature scale: %v"
// NewTemperat... | examples/demofixtures/Temperature.go | 0.84672 | 0.489442 | Temperature.go | starcoder |
package control
import (
"encoding/binary"
"io"
)
// Type is the control block type.
type Type = byte
// Control Block Types
var (
Data Type = 0b1000_0000
DataSize Type = 0b0100_0000
Data1 Type = 0b0010_0000
Data2 Type = 0b0001_0000
Skip Type = 0b0000_1000
DataSizeSize Type ... | control/control.go | 0.640861 | 0.558508 | control.go | starcoder |
package horizon
import (
"fmt"
"github.com/golang/geo/s2"
)
// RoadPositions Set of states
type RoadPositions []*RoadPosition
// RoadPosition Representation of state (in terms of Hidden Markov Model)
/*
ID - unique identifier of state
GraphEdge - pointer to closest edge in graph
GraphVertex - indentifier of c... | road_position.go | 0.824533 | 0.541591 | road_position.go | starcoder |
package geom
// A MultiPoint is a collection of Points.
type MultiPoint struct {
// To represent an MultiPoint that allows EMPTY elements, e.g.
// MULTIPOINT ( EMPTY, POINT(1.0 1.0), EMPTY), we have to allow
// record ends. If there is an empty point, ends[i] == ends[i-1].
geom2
}
// NewMultiPoint retur... | multipoint.go | 0.7874 | 0.411111 | multipoint.go | starcoder |
package tomgjson
import (
"encoding/xml"
"fmt"
"math"
"time"
"strconv"
)
func degreesToRadians(degrees float64) float64 {
return degrees * math.Pi / 180
}
func radiansToDegrees(radians float64) float64 {
return radians * 180 / math.Pi
}
func distanceInMBetweenEarthCoordinates(lat1, lon1, lat2, lon2 float64) ... | fromgpx.go | 0.792745 | 0.592224 | fromgpx.go | starcoder |
package imaging
import (
"image"
"image/color"
)
// Clone returns a copy of the given image.
func Clone(img image.Image) *image.NRGBA {
srcBounds := img.Bounds()
dstBounds := srcBounds.Sub(srcBounds.Min)
dst := image.NewNRGBA(dstBounds)
dstMinX := dstBounds.Min.X
dstMinY := dstBounds.Min.Y
srcMinX := srcBo... | vendor/github.com/wujiang/imaging/clone.go | 0.58261 | 0.497803 | clone.go | starcoder |
package answer
import (
"fmt"
"strings"
"github.com/ann-kilzer/go-wordle/common"
)
// Word represents the answer to a Wordle game
type Word struct {
value string
}
func NewWord(word string) Word {
return Word{
value: strings.ToUpper(word),
}
}
func (w Word) String() string {
return w.value
}
// EvaluateG... | src/game/answer/word.go | 0.780495 | 0.466056 | word.go | starcoder |
package market
import (
"container/heap"
"github.com/robbrit/econerra/goods"
)
type doubleAuction struct {
bids orderMaxHeap
offers orderMinHeap
lastHigh Price
lastLow Price
high Price
low Price
lastVolume Size
volume Size
bid Price
ask Price
good good... | market/double_auction_market.go | 0.569015 | 0.444866 | double_auction_market.go | starcoder |
package senseobjdef
import (
"encoding/json"
"fmt"
"io/ioutil"
"os"
jsoniter "github.com/json-iterator/go"
"github.com/pkg/errors"
"github.com/qlik-oss/gopherciser/enummap"
"github.com/qlik-oss/gopherciser/helpers"
)
type (
// SelectType select function type
SelectType int
// DataType Get Data function ty... | senseobjdef/senseobjdef.go | 0.520984 | 0.411702 | senseobjdef.go | starcoder |
package utils
// Set - mathematical set with operations
// Empty struct requires zero bytes so is more efficient than bool
type Set map[string]struct{}
// CreateSet - create an empty set
func CreateSet() Set {
return Set(make(map[string]struct{}))
}
// Contains - check if elem in set
func (s Set) Contains(elem stri... | go/utils/set.go | 0.660391 | 0.448849 | set.go | starcoder |
package gset
import (
"bytes"
"fmt"
"reflect"
"sort"
"strings"
)
// Builder is a mutable builder for GSet (Generic Set). Functions that
// mutate instances of this type are not thread-safe.
type Builder struct {
result GSet
done bool
}
// GValue a value object associated with the set element name
type GValu... | gset/gset.go | 0.75274 | 0.422981 | gset.go | starcoder |
package main
import (
"fmt"
"math"
"github.com/go-gl/mathgl/mgl64"
"github.com/go-gl/mathgl/mgl32"
)
var LEFT = -1.0;
var RIGHT = 1.0;
type Paddle struct {
Rectangle
paddleSpeed float64
}
type Collision struct {
delta mgl64.Vec2
normal mgl64.Vec2
}
func (p *Paddle) move(dir float64, dt float64) {
p.pos = m... | block.go | 0.64713 | 0.548371 | block.go | starcoder |
package forest
// This is general implementation of the stack using slices and empty interface (interface{}) elements. This is convenient as one
// can use elements of any type to build a stack as long as one is carefull. It is advisable to use elements of the same type,
// though...
// Example usage is seen from the ... | stack.go | 0.813313 | 0.419826 | stack.go | starcoder |
package parser
import (
"errors"
"fmt"
"github.com/hashicorp/go-multierror"
"github.com/flier/gocombine/pkg/stream"
)
// Parser is a type that it can be used to parse an input stream `S` of token `T` into a `O` value.
type Parser[T stream.Token, O any] interface {
Parse(input []T) (out O, remaining []T, err er... | pkg/parser/parser.go | 0.76882 | 0.57066 | parser.go | starcoder |
package scale
// Scale must be implemented by scale-up and wind-down calculators.
// Three scale calculators come predefined: Incremental, Exponential
// and Constant.
type Scale interface {
IsValid() bool
Apply(n uint32) uint32
ApplyInverse(n uint32) uint32
}
// Constant scaling mode does not allow scaling.
type... | scale/scale.go | 0.881958 | 0.459925 | scale.go | starcoder |
package igloo
import (
"fmt"
"image"
"math"
)
// Vec2 describes a 2D vector or point in floats
type Vec2 struct {
X, Y float64
}
var (
// Vec2Zero is a Vec2 of (0, 0)
Vec2Zero = Vec2{0, 0}
// Vec2One is a Vec2 of (1, 1)
Vec2One = Vec2{1, 1}
)
// String returns vec2 as a string
func (v *Vec2) String() string... | vec2.go | 0.932353 | 0.69205 | vec2.go | starcoder |
package mel
import (
"log"
"math"
"github.com/emer/etable/etensor"
"github.com/goki/mat32"
"gonum.org/v1/gonum/dsp/fourier"
)
// FilterBank contains mel frequency feature bank sampling parameters
type FilterBank struct {
NFilters int `viewif:"On" def:"32,26" desc:"number of Mel frequency filters to com... | mel/mel.go | 0.721253 | 0.410461 | mel.go | starcoder |
package howlongtobeat
import (
"net/http"
"net/url"
"strings"
"github.com/PuerkitoBio/goquery"
"github.com/spf13/cobra"
)
const (
hltbURL = "https://howlongtobeat.com/search_main.php?page=1"
example = `
# How long takes to beat Life is Strange
!howlongtobeat Life is Strange
# How long takes to beat Lif... | pkg/command/howlongtobeat/howlongtobeat.go | 0.547222 | 0.50177 | howlongtobeat.go | starcoder |
package timeago
import (
"time"
)
var DefaultTimeAgo = TimeAgo{DefaultLocale}
type TimeAgo struct {
locale Locale
}
func NewTimeAgo(locale Locale) TimeAgo {
return TimeAgo{locale: locale}
}
// FromNowWithTime takes a specific end Time value
// and the current Time to return how much has been passed
// between t... | timeago.go | 0.751557 | 0.655901 | timeago.go | starcoder |
package discount
import (
"fmt"
)
const (
// Label holds the string label denoting the discount type in the database.
Label = "discount"
// FieldID holds the string denoting the id field in the database.
FieldID = "id"
// FieldPeriodStart holds the string denoting the period_start field in the database.
Field... | pkg/ent/discount/discount.go | 0.657758 | 0.406332 | discount.go | starcoder |
package blockchain
import (
"fmt"
"sort"
"github.com/BANKEX/plasma-research/src/node/types"
"github.com/BANKEX/plasma-research/src/node/types/slice"
"github.com/BANKEX/plasma-research/src/node/utils"
)
type SumTreeRoot struct {
// We use 24 bit
Length uint32
Hash types.Uint160
}
type SumTreeNode struct {
... | src/node/blockchain/sum-merkle-tree.go | 0.655336 | 0.454351 | sum-merkle-tree.go | starcoder |
package graphics
import (
"golang.org/x/mobile/exp/gl/glutil"
"golang.org/x/mobile/gl"
)
// Program is a graphics program that is send to the backend to render the Buffer data
type Program struct {
engine *Engine
shader gl.Program
}
// UniformLocation is the location of a uniform in a Program
type UniformLocatio... | graphics/program.go | 0.763307 | 0.438665 | program.go | starcoder |
package contourmap
import (
"math"
)
const closed = -math.MaxFloat64
type edge struct {
X0, Y0 int
X1, Y1 int
Boundary bool
}
func fraction(z0, z1, z float64) float64 {
const eps = 1e-9
var f float64
if z0 == closed {
f = 0
} else if z1 == closed {
f = 1
} else if z0 != z1 {
f = (z - z0) / (z1 - ... | marching.go | 0.588771 | 0.554531 | marching.go | starcoder |
package extractors
import (
"math"
"path/filepath"
"strconv"
"time"
"github.com/sauron/config"
"github.com/sauron/session"
)
//pathVector vector of features inherited from http path
type pathVector struct {
//Delay of the first request (to this path) in the session
started float64
last time.Time
//Total... | extractors/paths_vector.go | 0.617743 | 0.425546 | paths_vector.go | starcoder |
package outputs
import (
"fmt"
"time"
"github.com/cloudical-io/ancientt/pkg/config"
)
// Data structured parsed data
type Data struct {
TestStartTime time.Time
TestTime time.Time
Tester string
ServerHost string
ClientHost string
AdditionalInfo string
Data DataFormat
}
// D... | outputs/data.go | 0.698741 | 0.406273 | data.go | starcoder |
package un
import (
"reflect"
)
func init() {
}
var workers int = 6
// Maker takes a function pointer (fn) and implements it with the given reflection-based function implementation
// Internally uses reflect.MakeFunc
func Maker(fn interface{}, impl func(args []reflect.Value) (results []reflect.Value)) {
fnV := re... | underscore.go | 0.696165 | 0.437103 | underscore.go | starcoder |
package spliterator
type Characteristic int
const (
CharacteristicTODO Characteristic = 0x00000000
/**
* Characteristic value signifying that an encounter order is defined for
* elements. If so, this Spliterator guarantees that method
* {@link #trySplit} splits a strict prefix of elements, that method
* {@... | go/util/spliterator/characteristic.go | 0.648466 | 0.700466 | characteristic.go | starcoder |
package sampler
import (
"math"
"time"
"github.com/DataDog/datadog-agent/pkg/trace/atomic"
"github.com/DataDog/datadog-agent/pkg/trace/pb"
"github.com/DataDog/datadog-agent/pkg/trace/watchdog"
)
const (
// Sampler parameters not (yet?) configurable
defaultDecayPeriod time.Duration = 5 * time.Second
// With ... | pkg/trace/sampler/coresampler.go | 0.749821 | 0.444746 | coresampler.go | starcoder |
package models
// Represents the page setup properties of a section.
type PageSetup struct {
// Represents the page setup properties of a section.
Link *WordsApiLink `json:"Link,omitempty"`
// Represents the page setup properties of a section.
Bidi bool `json:"Bidi,omitempty"`
// Represents the p... | v2010/api/models/page_setup.go | 0.902371 | 0.4856 | page_setup.go | starcoder |
package topo
import (
"github.com/savalin/gonum/graph"
"github.com/savalin/gonum/graph/internal/ordered"
"github.com/savalin/gonum/graph/internal/set"
)
// DegeneracyOrdering returns the degeneracy ordering and the k-cores of
// the undirected graph g.
func DegeneracyOrdering(g graph.Undirected) (order []graph.No... | graph/topo/bron_kerbosch.go | 0.695958 | 0.44746 | bron_kerbosch.go | starcoder |
package powervs
import (
"fmt"
"sort"
"strings"
survey "github.com/AlecAivazis/survey/v2"
"github.com/AlecAivazis/survey/v2/core"
"github.com/openshift/installer/pkg/rhcos"
"github.com/pkg/errors"
)
func knownRegions() map[string]string {
regions := make(map[string]string)
for _, region := range rhcos.Pow... | pkg/asset/installconfig/powervs/regions.go | 0.629433 | 0.41253 | regions.go | starcoder |
package hego
import (
"fmt"
"math"
"math/rand"
"time"
)
// AnnealingState represents the current state of the annealing system. Energy is the
// value of the objective function. Neighbor returns another state candidate
type AnnealingState interface {
Energy() float64
Neighbor() AnnealingState
}
// SAResult rep... | anneal.go | 0.674801 | 0.572305 | anneal.go | starcoder |
package elf_reader
// This file contains the definition for an ELF file interface that can be used
// to read either 32- or 64-bit ELF files. Boilerplate wrappers for
// implementing this interface are also kept in this file.
import (
"fmt"
)
// This is a 32- or 64-bit agnostic way of reading an ELF file. If needed... | elf_interface.go | 0.733833 | 0.489198 | elf_interface.go | starcoder |
package sound
import (
"errors"
"math"
)
// CalcGoertzel calculates the power for a given frequency in a MonoSample. The Goertzel
// Algorithm requires much less CPU cycles than calculating the sprectrum power density
// through an FFT. For more details on the Goertzel Filter check out:
// https://courses.cs.washin... | sound/goertzel.go | 0.835349 | 0.538255 | goertzel.go | starcoder |
package tree
import (
"fmt"
"github.com/arr-ai/frozen/errors"
"github.com/arr-ai/frozen/internal/depth"
"github.com/arr-ai/frozen/internal/fu"
"github.com/arr-ai/frozen/internal/pkg/masker"
)
const (
fanoutBits = depth.FanoutBits
fanout = depth.Fanout
)
var (
// UseRHS returns its RHS arg.
UseRHS = fun... | internal/tree/branch.go | 0.613815 | 0.401923 | branch.go | starcoder |
package gui
import (
"fmt"
"math/big"
"time"
)
var (
// ZeroInt is the default value for a big.Int.
ZeroInt = new(big.Int).SetInt64(0)
// ZeroRat is the default value for a big.Rat.
ZeroRat = new(big.Rat).SetInt64(0)
// KiloHash is 1 KH represented as a big.Rat.
KiloHash = new(big.Rat).SetInt64(1000)
// ... | gui/formatting.go | 0.69035 | 0.449997 | formatting.go | starcoder |
package commands
import (
"github.com/BurntSushi/gribble"
"github.com/BurntSushi/wingo/workspace"
)
type AutoTile struct {
Workspace gribble.Any `param:"1" types:"int,string"`
Help string `
Initiates automatic tiling on the workspace specified by Workspace. If tiling
is already active, the layout will ... | commands/tile_auto.go | 0.71113 | 0.436382 | tile_auto.go | starcoder |
package output
import (
"sync/atomic"
"time"
"github.com/Jeffail/benthos/v3/lib/log"
"github.com/Jeffail/benthos/v3/lib/metrics"
"github.com/Jeffail/benthos/v3/lib/types"
)
//------------------------------------------------------------------------------
func init() {
Constructors[TypeInproc] = TypeSpec{
con... | lib/output/inproc.go | 0.599016 | 0.452173 | inproc.go | starcoder |
package main
import "strconv"
type heatPoint struct {
x int
y int
num int
}
// FindLowPoints finds the low points in a heatmap.
// Returns an array of heatPoints being the lowest nearby points.
func FindLowPoints(input []string) []heatPoint {
maxY := len(input) - 1
maxX := len(input[0]) - 1
lowPoints := ma... | day9.go | 0.712932 | 0.682097 | day9.go | starcoder |
package resource
import (
"fmt"
"sort"
"github.com/onsi/gomega"
"github.com/onsi/gomega/types"
)
func matcherToGomegaMatcher(matcher interface{}) (types.GomegaMatcher, error) {
switch x := matcher.(type) {
case string, int, uint, int64, uint64, bool, float64:
return gomega.BeEquivalentTo(x), nil
case []inte... | resource/gomega.go | 0.536799 | 0.460168 | gomega.go | starcoder |
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
// http://www.apache.org/licenses/LICENSE-2.0
// Unless required by applicable law or agreed to in writing, software
// distributed unde... | stats/math.go | 0.89402 | 0.406744 | math.go | starcoder |
package processor
import (
"fmt"
"time"
"github.com/Jeffail/benthos/v3/internal/bloblang"
"github.com/Jeffail/benthos/v3/internal/bloblang/field"
"github.com/Jeffail/benthos/v3/internal/docs"
"github.com/Jeffail/benthos/v3/lib/log"
"github.com/Jeffail/benthos/v3/lib/metrics"
"github.com/Jeffail/benthos/v3/lib... | lib/processor/cache.go | 0.73077 | 0.438364 | cache.go | starcoder |
package evaluator
import (
"regexp"
"strings"
"github.com/lyraproj/issue/issue"
"github.com/lyraproj/pcore/px"
"github.com/lyraproj/pcore/types"
"github.com/lyraproj/puppet-evaluator/pdsl"
"github.com/lyraproj/puppet-parser/parser"
)
func evalComparisonExpression(e pdsl.Evaluator, expr *parser.ComparisonExpre... | evaluator/comparison.go | 0.587115 | 0.413063 | comparison.go | starcoder |
package kamakiri
import "math"
// ShapeType indicates the type of a Shape.
type ShapeType uint8
const (
// ShapeTypeCircle is the ShapeType for circular Shapes.
ShapeTypeCircle ShapeType = iota
// ShapeTypePolygon is the ShapeType for polygon Shapes.
ShapeTypePolygon
)
// Shape is a physics shape.
type Shape s... | shape.go | 0.850593 | 0.788217 | shape.go | starcoder |
package graph
import (
i04eb5309aeaafadd28374d79c8471df9b267510b4dc2e3144c378c50f6fd7b55 "github.com/microsoft/kiota/abstractions/go/serialization"
)
// WorkbookChartAxis
type WorkbookChartAxis struct {
Entity
// Represents the formatting of a chart object, which includes line and font formatting. Read-o... | models/microsoft/graph/workbook_chart_axis.go | 0.797675 | 0.555556 | workbook_chart_axis.go | starcoder |
package ast
// Class represents a class type declaration of the form
// «"class" name { fields }»
type Class struct {
Annotations Annotations // the annotations applied to the class
Name *Identifier // the name of the class
Fields []*Field // the fields of the class
}
func (Class) isNode() {}
// F... | gapil/ast/type.go | 0.81134 | 0.540621 | type.go | starcoder |
package output
import (
"fmt"
"github.com/Jeffail/benthos/v3/lib/broker"
"github.com/Jeffail/benthos/v3/lib/log"
"github.com/Jeffail/benthos/v3/lib/metrics"
"github.com/Jeffail/benthos/v3/lib/types"
)
//------------------------------------------------------------------------------
func init() {
Constructors[T... | lib/output/try.go | 0.675122 | 0.768646 | try.go | starcoder |
// This file implements type parameter inference given
// a list of concrete arguments and a parameter list.
package types
import "github.com/tdakkota/go2go/golib/token"
// infer returns the list of actual type arguments for the given list of type parameters tparams
// by inferring them from the actual arguments ar... | golib/types/infer.go | 0.559771 | 0.457561 | infer.go | starcoder |
package plaid
import (
"encoding/json"
)
// TransactionData Information about the matched direct deposit transaction used to verify a user's payroll information.
type TransactionData struct {
// The description of the transaction.
Description string `json:"description"`
// The amount of the transaction.
Amount ... | plaid/model_transaction_data.go | 0.789396 | 0.410756 | model_transaction_data.go | starcoder |
package iso20022
// Execution of the redemption part, in a switch between investment funds or investment fund classes.
type SwitchRedemptionLegExecution3 struct {
// Unique technical identifier for an instance of a leg within a switch.
LegIdentification *Max35Text `xml:"LegId,omitempty"`
// Unique identifier for ... | SwitchRedemptionLegExecution3.go | 0.832237 | 0.481515 | SwitchRedemptionLegExecution3.go | starcoder |
// Package day08 solves AoC 2020 day 8.
package day08
import (
"fmt"
"io"
"strconv"
"strings"
"github.com/fis/aoc/glue"
"github.com/fis/aoc/util"
)
func init() {
glue.RegisterSolver(2020, 8, glue.LineSolver(solve))
glue.RegisterPlotter(2020, 8, glue.LinePlotter(plotFlow), map[string]string{"ex": example})
}... | 2020/day08/day08.go | 0.531453 | 0.404802 | day08.go | starcoder |
package Uint
import (
"crypto/sha256"
"math/big"
)
const (
// Bitwidth256 is the number of bits in a U256
Bitwidth256 = 256
// Bytewidth256 is the number of bytes in a U256
Bytewidth256 = 32
)
// U256 stores a 256 bit value in a big.Int
type U256 struct {
big.Int
}
type u256 interface {
Zero256() *U256
Assign(... | _old/newold/Uint/u256.go | 0.764716 | 0.439807 | u256.go | starcoder |
package model
type (
// yaml tag for the proxy details
yamlProxy struct {
Http string `yaml:"http_proxy"`
Https string `yaml:"https_proxy"`
NoProxy string `yaml:"no_proxy"`
}
// yaml tag for stuff to be copied on volumes
yamlCopy struct {
//Once indicates if the copy should be done only on one node ... | yaml.go | 0.586641 | 0.515803 | yaml.go | starcoder |
package placement
import (
"strings"
"github.com/matrixorigin/matrixcube/components/prophet/core"
"github.com/matrixorigin/matrixcube/components/prophet/util/slice"
"github.com/matrixorigin/matrixcube/pb/rpcpb"
)
// LabelConstraintOp defines how a LabelConstraint matches a container. It can be one of
// 'in', '... | components/prophet/schedule/placement/label_constraint.go | 0.720663 | 0.448668 | label_constraint.go | starcoder |
package routing
import (
"math"
"github.com/flowmatters/openwater-core/data"
)
/*OW-SPEC
InstreamParticulateNutrient:
inputs:
incomingMassUpstream:
incomingMassLateral:
reachVolume:
outflow:
streambankErosion:
lateralSediment:
floodplainDepositionFraction:
channelDepositionFraction:
states:
ch... | models/routing/instream_particulate_nutrient.go | 0.53777 | 0.511351 | instream_particulate_nutrient.go | starcoder |
package pinapi
import (
"encoding/json"
"time"
)
// ParlayLeg struct for ParlayLeg
type ParlayLeg struct {
SportId *int `json:"sportId,omitempty"`
// Parlay leg type.
LegBetType *string `json:"legBetType,omitempty"`
// Parlay Leg status. CANCELLED = The leg is canceled- the stake on this leg will be transferred... | pinapi/model_parlay_leg.go | 0.68721 | 0.433682 | model_parlay_leg.go | starcoder |
// This is an implementation of a variant of the Nelder-Mead (1965) downhill
// simplex optimization heuristic.
package dsl
import (
"math"
)
// nelderMeadOptimize function f with Nelder-Mead. start points to a slice of starting points
// It is the responsibility of the caller to make sure the dimensionality is co... | dsl/neldermead.go | 0.744378 | 0.550789 | neldermead.go | starcoder |
package gothumb
import (
"errors"
"image"
"image/draw"
)
type GenericTransformer struct {
In image.Image
Out image.Image
}
func (t GenericTransformer) None() error {
t.Out = t.In
return nil
}
func (t GenericTransformer) FlipH() error {
out, err := FlipH(t.In)
if err != nil {
return err
}
t.Out = ou... | generic_transformer.go | 0.682045 | 0.419053 | generic_transformer.go | starcoder |
package gorethink
import (
p "github.com/adjust/gorethink/ql2"
)
// Add sums two numbers or concatenates two arrays.
func (t RqlTerm) Add(args ...interface{}) RqlTerm {
enforceArgLength(1, -1, args)
return newRqlTermFromPrevVal(t, "Add", p.Term_ADD, args, map[string]interface{}{})
}
// Add sums two numbers or co... | query_math.go | 0.786418 | 0.453141 | query_math.go | starcoder |
package aws
import (
"github.com/infracost/infracost/internal/resources"
"github.com/infracost/infracost/internal/schema"
"strings"
"github.com/shopspring/decimal"
)
type KinesisAnalyticsV2Application struct {
Address string
Region string
RuntimeEnvironment stri... | internal/resources/aws/kinesisanalyticsv2_application.go | 0.515376 | 0.4206 | kinesisanalyticsv2_application.go | starcoder |
package wasm
// Opcode is the binary Opcode of an instruction. See also InstructionName
type Opcode = byte
const (
// OpcodeUnreachable causes an unconditional trap.
OpcodeUnreachable Opcode = 0x00
// OpcodeNop does nothing
OpcodeNop Opcode = 0x01
// OpcodeBlock brackets a sequence of instructions. A branch inst... | vendor/github.com/tetratelabs/wazero/internal/wasm/instruction.go | 0.555918 | 0.454412 | instruction.go | starcoder |
package stepdefinitions
import (
"fmt"
"github.com/DATA-DOG/godog"
"github.com/jaysonesmith/gopherhole/board"
"github.com/jaysonesmith/gopherhole/support"
"github.com/jaysonesmith/gopherhole/utils"
"github.com/pkg/errors"
)
var difficulty = map[string]int{"medium": 1, "hard": 2}
var characters = map[string]str... | step_definitions/steps.go | 0.616243 | 0.493103 | steps.go | starcoder |
package day369
import "math"
// Price is a stock price represented as float64.
type Price float64
// Timestamp is a Unix timestamp.
type Timestamp uint
// Datapoint is a timestamp and a price.
type Datapoint struct {
Timestamp Timestamp
Price Price
}
// StockService is the defined API for stock data points.
... | day369/problem.go | 0.778313 | 0.478773 | problem.go | starcoder |
package team4
import (
"math"
"github.com/SOMAS2020/SOMAS2020/internal/common/baseclient"
"github.com/SOMAS2020/SOMAS2020/internal/common/shared"
)
// MakeDisasterPrediction is called on each client for them to make a prediction about a disaster
// Prediction includes location, magnitude, confidence etc
// COMPUL... | internal/clients/team4/iifo.go | 0.726329 | 0.415729 | iifo.go | starcoder |
package v1alpha1
// CaptureListerExpansion allows custom methods to be added to
// CaptureLister.
type CaptureListerExpansion interface{}
// CaptureNamespaceListerExpansion allows custom methods to be added to
// CaptureNamespaceLister.
type CaptureNamespaceListerExpansion interface{}
// ImageListerExpansion allows... | client/listers/pi/v1alpha1/expansion_generated.go | 0.557364 | 0.42913 | expansion_generated.go | starcoder |
package metrics
import (
"context"
"fmt"
rfcontext "github.com/grailbio/reflow/context"
)
// Gauge wraps prometheus.Gauge. Gauges can be set to arbitrary values.
type Gauge interface {
// Set updates the value of the gauge
Set(float64)
// Inc increments the Gauge by 1. Use Add to increment it by arbitrary
//... | metrics/client.go | 0.668772 | 0.446434 | client.go | starcoder |
package edge_compute
import (
"encoding/json"
)
// MetricsData The data points in a metrics collection
type MetricsData struct {
Matrix *DataMatrix `json:"matrix,omitempty"`
Vector *DataVector `json:"vector,omitempty"`
}
// NewMetricsData instantiates a new MetricsData object
// This constructor will assign defau... | pkg/edge_compute/model_metrics_data.go | 0.854748 | 0.61477 | model_metrics_data.go | starcoder |
package generation
import (
"math"
"github.com/flowmatters/openwater-core/conv/units"
"github.com/flowmatters/openwater-core/data"
)
/*OW-SPEC
DynamicSednetGully:
inputs:
quickflow: m^3.s^-1
year: year
AnnualRunoff: 'mm.yr^-1'
annualLoad: ''
states:
parameters:
YearDisturbance: ''
GullyEndYear: ''
... | models/generation/sednet_gully.go | 0.623492 | 0.583678 | sednet_gully.go | starcoder |
package iso20022
// Specifies rates.
type CorporateActionRate1 struct {
// Annual rate of a financial instrument.
Interest *RateAndAmountFormat1Choice `xml:"Intrst,omitempty"`
// Index rate related to the interest rate of the forthcoming interest payment.
RelatedIndex *RateFormat1Choice `xml:"RltdIndx,omitempty"... | CorporateActionRate1.go | 0.801042 | 0.506164 | CorporateActionRate1.go | starcoder |
package wire
import (
"bytes"
"encoding/binary"
"io"
"time"
"github.com/btgsuite/btgd/chaincfg/chainhash"
)
// MaxSolutionSize is the max known Equihash solution size (1344 is for Equihash-200,9)
const MaxSolutionSize = 1344
// MaxBlockHeaderPayload is the maximum number of bytes a block header can be.
const ... | wire/blockheader.go | 0.812086 | 0.405684 | blockheader.go | starcoder |
package common
import (
"fmt"
"reflect"
)
// StatAggregator is the interface
type StatAggregator interface {
Aggregate(interface{}) error
Result() interface{}
String() string
}
type numericKind uint
const (
invalidNum numericKind = iota
intNum
uintNum
floatNum
)
// String returns the type of number.
func ... | pkg/common/stat_aggregator.go | 0.670716 | 0.40642 | stat_aggregator.go | starcoder |
package series
import (
"fmt"
"strings"
)
type boolElement struct {
e bool
valid bool
}
func (e *boolElement) Set(value interface{}) error {
e.valid = true
e.e = false
if value == nil {
e.valid = false
return nil
}
switch value.(type) {
case string:
switch strings.ToLower(value.(string)) {
case... | series/type-bool.go | 0.532911 | 0.539772 | type-bool.go | starcoder |
package leetcode
import (
"fmt"
)
// You are given two non-empty linked lists representing two non-negative integers. The digits are stored in reverse order and each of their nodes contain a single digit. Add the two numbers and return it as a linked list.
// You may assume the two numbers do not contain any leading... | add_two.go | 0.639849 | 0.492249 | add_two.go | starcoder |
package models
import (
i336074805fc853987abe6f7fe3ad97a6a6f3077a16391fec744f671a015fbd7e "time"
i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91 "github.com/microsoft/kiota-abstractions-go/serialization"
)
// UserSimulationDetails
type UserSimulationDetails struct {
// Stores additional... | models/user_simulation_details.go | 0.567577 | 0.464659 | user_simulation_details.go | starcoder |
package iso20022
// Additional restrictions on the financial instrument, related to the stipulation.
type FinancialInstrumentStipulations2 struct {
// Type of stipulation expressing geographical constraints on a fixed income instrument. It is expressed with a state or country abbreviation and a minimum or maximum pe... | data/train/go/dd70e9f33d046f048429ec3e23ac72fcb16fc09cFinancialInstrumentStipulations2.go | 0.915184 | 0.511168 | dd70e9f33d046f048429ec3e23ac72fcb16fc09cFinancialInstrumentStipulations2.go | starcoder |
package main
import "fmt"
const PieceStatusBits = 3
const BitsPerSquare = PieceStatusBits + 2
/*
Every board square is numbered this way:
0 1 2 3 4 5 6 7
8 9 10 11 12 13 14 15
16 17 ...
...
A uint64 in Board contains one bit for each of the 64 squares,
in that order.
The first PieceStatusBits bits for ... | src/chessAI/board.go | 0.688364 | 0.57087 | board.go | starcoder |
package gorgonia
import (
"fmt"
"math"
tf32 "github.com/chewxy/gorgonia/tensor/f32"
tf64 "github.com/chewxy/gorgonia/tensor/f64"
ti "github.com/chewxy/gorgonia/tensor/i"
"github.com/chewxy/gorgonia/tensor/types"
"github.com/gonum/graph"
)
func graphNodeToNode(in []graph.Node) (out Nodes) {
out = make(Nodes, ... | utils.go | 0.572006 | 0.403743 | utils.go | starcoder |
package dfl
import (
"github.com/spatialcurrent/go-dfl/pkg/dfl/builder"
)
// BinaryOperator is a DFL Node that represents the binary operator of a left value and right value.
// This struct functions as an embedded struct for many comparator operations.
type BinaryOperator struct {
Left Node
Right Node
}
func (... | pkg/dfl/BinaryOperator.go | 0.816736 | 0.552419 | BinaryOperator.go | starcoder |
package assert
import "reflect"
func valueEqual(v1, v2 reflect.Value) bool {
if !v1.IsValid() || !v2.IsValid() {
return v1.IsValid() == v2.IsValid()
}
if v1.CanInterface() && v2.CanInterface() {
return reflect.DeepEqual(v1.Interface(), v2.Interface())
}
v1, d1 := derefInterface(v1)
v2, d2 := derefInterface(... | assert/predict.go | 0.558809 | 0.583678 | predict.go | starcoder |
package three
import "github.com/go-gl/mathgl/mgl32"
// TextGeometry defines the geometry of 2D text.
type TextGeometry struct {
Vertices []mgl32.Vec2
UVs []mgl32.Vec2
Text string
Position mgl32.Vec2
Size float32
Font *Font
}
// NewTextGeometry creates a new 2D text geometry for the given tex... | text_geometry.go | 0.799481 | 0.580203 | text_geometry.go | starcoder |
package ha
import (
"context"
"github.com/atomix/go-client/pkg/client/map"
"github.com/atomix/go-client/pkg/client/session"
"github.com/google/uuid"
"github.com/onosproject/onos-test/pkg/onit/env"
"github.com/stretchr/testify/assert"
"testing"
"time"
)
// TestRaftHA : integration test
func (s *TestSuite) Tes... | test/ha/hatest.go | 0.533397 | 0.579192 | hatest.go | starcoder |
Package game contains the implementation of the state management and rules engine type.
The Game type contains manages the state and provides the rules engine interface. This
interface is described as the two actions a player may take each turn. Those are Place
and Move. A Place action is where a player takes a piece f... | game/doc.go | 0.841793 | 0.969757 | doc.go | starcoder |
package models
import (
i336074805fc853987abe6f7fe3ad97a6a6f3077a16391fec744f671a015fbd7e "time"
i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91 "github.com/microsoft/kiota-abstractions-go/serialization"
)
// Notification
type Notification struct {
Entity
// Sets how long (in second... | models/notification.go | 0.673943 | 0.420124 | notification.go | starcoder |
package descriptor
import (
"math"
"go.einride.tech/can"
)
// Signal describes a CAN signal.
type Signal struct {
// Name of the signal.
Name string
// LongName of the signal.
LongName string
// Start bit.
Start uint16
// Length in bits.
Length uint16
// IsBigEndian is true if the signal is big-endian.
I... | pkg/descriptor/signal.go | 0.726911 | 0.478773 | signal.go | starcoder |
package imagepipeline
import (
"bytes"
"context"
"image"
"github.com/disintegration/imaging"
)
type Image struct {
// previous is the previous before handle
previous *Image
// originalSize is the original raw data size of image
originalSize int
// grid is the grid of color.Color values
grid image.Image
/... | image.go | 0.794185 | 0.405302 | image.go | starcoder |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.