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 expr
import (
"fmt"
)
// EvalProgram returns the result of executing the program with the given resolver.
func EvalProgram(resolver Resolver, program *Program) (v interface{}, err error) {
defer func() {
if r := recover(); r != nil {
if rerr, ok := r.(error); ok {
err = rerr
} else {
panic(r... | sgx-tools/vendor/github.com/go-restruct/restruct/expr/eval.go | 0.661923 | 0.518485 | eval.go | starcoder |
package analyze
import (
"time"
)
type SummaryDay struct {
day time.Weekday
noOfTrades int
noOfProfitTrades int
noOfLossTrades int
profitTradesInPips float64
lossTradesInPips float64
netProfitTradesInPips float64
avgWinPct float64
pipsNetProfitGainPct float64
}
... | internal/simulator/analyze/aggregate_weekday.go | 0.795975 | 0.544499 | aggregate_weekday.go | starcoder |
//go:generate go run gen-benchmarks.go
// Package intNodes defines the integer function collection available for the GEP algorithm.
package intNodes
import (
"log"
"github.com/gmlewis/gep/v2/functions"
)
// IntNode is an integer function used for the formation of GEP expressions.
type IntNode struct {
index ... | functions/int_nodes/ints.go | 0.501953 | 0.672049 | ints.go | starcoder |
package testhelpers
import (
"bytes"
"encoding/json"
"fmt"
"regexp"
"strings"
"testing"
"github.com/pelletier/go-toml"
"gopkg.in/yaml.v3"
"github.com/buildpacks/pack/testhelpers/comparehelpers"
"github.com/google/go-cmp/cmp"
)
type AssertionManager struct {
testObject *testing.T
}
func NewAssertionMana... | testhelpers/assertions.go | 0.548432 | 0.438064 | assertions.go | starcoder |
package loader
import (
"context"
"fmt"
"strings"
"github.com/xo/xo/models"
"github.com/xo/xo/templates/gotpl"
)
func init() {
Register(&Loader{
Driver: "sqlserver",
Kind: map[Kind]string{
KindTable: "U",
KindView: "V",
},
ParamN: func(i int) string {
return fmt.Sprintf("@p%d", i+1)
},
Ma... | loader/sqlserver.go | 0.531696 | 0.440048 | sqlserver.go | starcoder |
package sparkline
// sparks.go contains code that determines which characters should be used to
// represent a value on the SparkLine.
import (
"fmt"
"math"
"github.com/mum4k/termdash/private/runewidth"
)
// sparks are the characters used to draw the SparkLine.
var sparks = []rune{'▁', '▂', '▃', '▄', '▅', '▆', ... | widgets/sparkline/sparks.go | 0.847432 | 0.493409 | sparks.go | starcoder |
package go2048
import (
"image"
"math/rand"
)
func DefaultSize() image.Point {
return image.Point{4, 4}
}
type grid struct {
size image.Point
sst [][]*Tile
}
func newGrid(size image.Point) *grid {
sst := make([][]*Tile, size.X)
for x := range sst {
sst[x] = make([]*Tile, size.Y)
}
return &grid{
size: ... | grid.go | 0.790004 | 0.532182 | grid.go | starcoder |
package iso20022
// Execution of a redemption order.
type RedemptionExecution6 struct {
// Unique and unambiguous identifier for an order, as assigned by the instructing party.
OrderReference *Max35Text `xml:"OrdrRef"`
// Unique and unambiguous investor's identification of an order. This reference can typically b... | RedemptionExecution6.go | 0.799129 | 0.433802 | RedemptionExecution6.go | starcoder |
package maps
type IntToInt interface {
Lookup(int) (int, bool)
ToMap() map[int]int
}
type Uint64ToInt interface {
Lookup(uint64) (int, bool)
ToMap() map[uint64]int
}
const (
zero = 0
one = 1
listMax = 14
)
func NewIntToInt(m map[int]int) IntToInt {
if len(m) == zero {
return &zeroIntToInt{}
}
if... | asm/maps/maps.go | 0.512937 | 0.485234 | maps.go | starcoder |
package discovery
import "fmt"
type Climate struct {
// A template to render the value received on the `action_topic` with
// Default: <no value>
ActionTemplate string `json:"action_template,omitempty"`
// The MQTT topic to subscribe for changes of the current action. If this is set, the climate graph uses the ... | climate.go | 0.843509 | 0.456107 | climate.go | starcoder |
package finverse
import (
"encoding/json"
)
// MonthlyIncomeEstimate struct for MonthlyIncomeEstimate
type MonthlyIncomeEstimate struct {
EstimatedIncome IncomeEstimate `json:"estimated_income"`
// The numeric month
Month float32 `json:"month"`
// The year
Year float32 `json:"year"`
}
// NewMonthlyIncomeEstim... | finverse/model_monthly_income_estimate.go | 0.801276 | 0.642517 | model_monthly_income_estimate.go | starcoder |
package keras
import (
"math"
)
//ReLU or rectified linear activation function is a piecewise linear function that will output the input directly if it is positive, otherwise, it will output zero
func ReLU(x float64) float64 {
if x < 0 {
return 0
}
return x
}
// Sigmoid activation function is commonly known as... | keras/functions.go | 0.897322 | 0.769687 | functions.go | starcoder |
package cnlib
import "errors"
import "github.com/btcsuite/btcd/wire"
/// Type Definitions
// Following constants are used for RBFOption.
const (
MustBeRBF int = 0
MustNotBeRBF int = 1
AllowedToBeRBF int = 2
)
// PlaceholderDestination is a constant which can be used to indicate a destination is not yet s... | transaction_data.go | 0.834373 | 0.459319 | transaction_data.go | starcoder |
package tf
import (
"fmt"
"github.com/pkg/errors"
tensorflow "github.com/tensorflow/tensorflow/tensorflow/go"
"github.com/tensorflow/tensorflow/tensorflow/go/op"
)
// Batcher takes a fixed number of tensors and concatenates them into one larger
// tensor. This is mostly used for creating mini-batches of tensors... | tf/batch.go | 0.744285 | 0.461259 | batch.go | starcoder |
package maths
import (
"fmt"
"math"
"math/rand"
)
type Tensor struct {
dimension []int
values []float64
}
func NewTensor(dimension []int, values []float64) *Tensor {
if values == nil {
//The length of our 1-dimensional values array needs to be equivalent to the product of all dimensions
//The values are... | pkg/cnn/maths/tensor.go | 0.807916 | 0.758309 | tensor.go | starcoder |
package bliss
/*
#cgo LDFLAGS: -lbliss
#include <bliss.h>
#define xstr(a) str(a)
#define str(a) #a
static inline const char * bl_version_str() {
return xstr(BL_VERSION);
}
*/
import "C"
import (
"errors"
"reflect"
"runtime"
"unsafe"
)
var version string
func init() {
version = C.GoString(C.bl_version_str())
... | bliss.go | 0.57821 | 0.524516 | bliss.go | starcoder |
package load
// IQM: Inter-Quake Model format.
// A binary format for 3D models that includes skeletal animation:
// http://www.opengl.org/wiki/Skeletal_Animation
// http://content.gpwiki.org/index.php?title=OpenGL:Tutorials:Basic_Bones_System
import (
"bytes"
"encoding/binary"
"fmt"
"io"
"github.com/gaz... | load/iqm.go | 0.712332 | 0.475057 | iqm.go | starcoder |
package pvss
// Asynchronous Verifiable Secret Sharing and Proactive Cryptosystems
import (
"errors"
"math/big"
"github.com/torusresearch/torus-common/common"
"github.com/torusresearch/torus-common/secp256k1"
pcmn "github.com/torusresearch/torus-node/common"
)
// GenerateRandomBivariatePolynomial -
// create a... | pvss/avss.go | 0.77535 | 0.596081 | avss.go | starcoder |
package wdteutil
import (
"errors"
"fmt"
"reflect"
"github.com/DeedleFake/wdte"
)
var (
arrayType = reflect.TypeOf(wdte.Array(nil))
numberType = reflect.TypeOf(wdte.Number(0))
stringType = reflect.TypeOf(wdte.String(""))
)
func fromWDTE(frame wdte.Frame, w wdte.Func, expected reflect.Type) reflect.Value {
... | wdteutil/wdteutil.go | 0.533397 | 0.54692 | wdteutil.go | starcoder |
package randomnames
// List of nouns from http://www.desiquintans.com/downloads/nounlist/nounlist.txt
import (
"math/rand"
"sync"
)
func init() {
nounSize = len(Nouns)
}
// RandomNoun returns a pseudo-random noun from the list
func RandomNoun() string {
return Nouns[rand.Intn(nounSize)]
}
// SafeRandomNoun ret... | nouns.go | 0.563978 | 0.421076 | nouns.go | starcoder |
package nist_sp800_22
import (
"math"
"math/cmplx"
"github.com/mjibson/go-dsp/fft"
)
// Discrete Fourier Transform
// 3.6 Discrete Fourier Transform (Specral) Test, Page 68.
// Wiki definition // https://en.wikipedia.org/wiki/Discrete_Fourier_transform#Definition
func DFT(X []float64) ([]float64, []float64) {
va... | nist_sp800_22/discreteFourierTransfrom_Spectral.go | 0.713432 | 0.414721 | discreteFourierTransfrom_Spectral.go | starcoder |
package vector3
import (
"fmt"
"math"
)
const Epsilon = 0.00001
type Vector3 struct {
X, Y, Z float64
}
func Dot(ihs *Vector3, rhs *Vector3) float64 {
return ihs.X*rhs.X + ihs.Y*rhs.Y + ihs.Z*rhs.Z
}
func Cross(ihs *Vector3, rhs *Vector3) *Vector3 {
return New(
ihs.Y*rhs.Z-ihs.Z*rhs.Y,
ihs.Z*rhs.X-ihs.X*r... | vector3/vector3.go | 0.854582 | 0.740292 | vector3.go | starcoder |
package mathf
import "fmt"
// Mat3 is a 3x3 matrix.
type Mat3 struct {
elements []float64
}
// NewMat3 creates a matrix with the given components
func NewMat3(e1 float64, e2 float64, e3 float64,
e4 float64, e5 float64, e6 float64,
e7 float64, e8 float64, e9 float64) *Mat3 {
return &Mat3{
elements: []float64{
... | server/mathf/mat3.go | 0.842151 | 0.673745 | mat3.go | starcoder |
package messages
const PleaseContactSupport = `Something went wrong in the cp-remote tool application logic.
Please contact support specifying the session number '%s'.`
const NoActivePodsFoundForSpecifiedServiceName = `No running pods were found for the specified service name '%s'.`
const ProjectsNotFound = `No proj... | messages/messages.go | 0.769946 | 0.610221 | messages.go | starcoder |
package dsl
// DataType indicates the possible fields data types
type DataType int
const (
// ID is an abstract type, use this if you want a numerical auto-increment primary key field
// Each dialect interpret this DataType differently
ID DataType = iota
CHAR
VARCHAR
BINARY
VARBINARY
TEXT
BOOL
INT
SERIAL... | dsl/dsl.go | 0.763219 | 0.417093 | dsl.go | starcoder |
package bender
import (
"math"
"sync"
"time"
)
// An IntervalGenerator is a function that takes the current Unix epoch time
// (in nanoseconds) and returns a non-negative time (also in nanoseconds)
// until the next request should be sent. Bender provides functions to create
// interval generators for uniform and ... | bender.go | 0.716715 | 0.447279 | bender.go | starcoder |
package iso20022
// Amount of money associated with a service.
type Fee3 struct {
// Type of fee (charge/commission).
Type *ChargeType5Choice `xml:"Tp,omitempty"`
// Modified value of the standard fee (charge/commission) amount applied on the order (the standard fee (charge/commission) amount in the original indi... | Fee3.go | 0.768038 | 0.558688 | Fee3.go | starcoder |
package intcode
import (
"log"
"github.com/afarbos/aoc/pkg/convert"
)
// OpCodes enumeration of operation code.
const (
// Add paramater 1 and 2 and store it in 3
Add = iota + 1
// Multiply paramater 1 and 2 and store it in 3
Multiply
// Input stored at parameter 1
Input
// Output the value of parameter 1
... | pkg/intcode/intcode.go | 0.501221 | 0.471527 | intcode.go | starcoder |
package eval
import (
"fmt"
"github.com/jbert/gol"
)
func MakeDefaultEnvironment() Environment {
defEnv := []gol.Frame{
gol.Frame{
"=": &NodeBuiltin{f: equalInt, description: "="},
"+": &NodeBuiltin{f: addInt, description: "+"},
"-": &NodeBuiltin{f: subInt, description: "-"},
"*": ... | eval/apply.go | 0.554591 | 0.500061 | apply.go | starcoder |
package managedtenants
import (
i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91 "github.com/microsoft/kiota-abstractions-go/serialization"
)
// RoleAssignment
type RoleAssignment struct {
// Stores additional data not described in the OpenAPI description found when deserializing. Can be use... | models/managedtenants/role_assignment.go | 0.668772 | 0.427755 | role_assignment.go | starcoder |
package team6
import (
"math"
"github.com/SOMAS2021/SOMAS2021/pkg/infra"
)
// Updates agent social motive:
// First updates behaviour weights, then computes behaviour change based on weights and input parameters (HP, floor)
func (a *CustomAgent6) updateBehaviour() {
a.updateBehaviourWeights()
aConf := a.config
... | pkg/agents/team6/behaviours.go | 0.741112 | 0.452294 | behaviours.go | starcoder |
package rtc
import "math"
// Translation returns a 4x4 translation matrix.
func Translation(x, y, z float64) M4 {
return M4{
Tuple{1, 0, 0, x},
Tuple{0, 1, 0, y},
Tuple{0, 0, 1, z},
Tuple{0, 0, 0, 1},
}
}
// Translate translates a 4x4 matrix and returns a new one.
func (m M4) Translate(x, y, z float64) M4 ... | rtc/transforms.go | 0.919177 | 0.806738 | transforms.go | starcoder |
package main
import "fmt"
import "math"
import "errors"
// The followings are a collection of functions
// that implement simple operations for illustration purposes.
// This contrive set of examples is designed to illustrate the
// different form and usage of Go functions.
var (
mul = func(op0, op1 int) int {
re... | ch05/funcs.go | 0.675336 | 0.49292 | funcs.go | starcoder |
package currency
import (
"encoding/json"
"errors"
"io/ioutil"
"log"
"net/http"
"time"
)
//Currency holds our base currency and the exchange rates of other currencies against the base currency
type Currency struct {
Rates map[string]interface{}
Base string
}
//getExchangeRate calculates the exchange rate
fu... | pkg/currency/currency.go | 0.756358 | 0.411052 | currency.go | starcoder |
package main
import (
"fmt"
"log"
)
// tag::solution[]
const (
// Our algorithm does not end by itself since we can never really be sure that we have found the
// highest y-velocity that will still result in a hit. Thus, we end after this many velocities
// at most. Empirically, this has been proven to be enoug... | day17/go/razziel89/solution.go | 0.654343 | 0.629547 | solution.go | starcoder |
package compiler
import (
"reflect"
"strings"
"github.com/gentee/gentee/core"
)
type initType struct {
name string
original reflect.Type
index string // support index of
}
// InitTypes appends stdlib types to the virtual machine
func InitTypes(ws *core.Workspace) {
typeArr := reflect.TypeOf(core.Arra... | compiler/types.go | 0.534127 | 0.457137 | types.go | starcoder |
package model
import (
"github.com/ClessLi/Game-test/sprite"
"github.com/ClessLi/resolvForGame/resolv"
"github.com/go-gl/mathgl/mgl32"
)
type Circle struct {
Shape *resolv.Circle
*MoveObj
friction float32
maxSpd float32
}
func NewCircle(x, y, radius int32, friction float32, moveList []string, standList []st... | model/circle.go | 0.803983 | 0.475484 | circle.go | starcoder |
package quantize
type matrix interface {
set(val float64)
add(r, l matrix)
sub(r, l matrix)
rcount() int
ccount() int
at(i, j int) float64
}
type mat3x3 [][]float64
func newMat3x3() mat3x3 {
v := make([][]float64, 3)
for i := range v {
v[i] = make([]float64, 3)
}
return mat3x3(v)
}
func (m mat3x3) at(r,... | matrix.go | 0.729231 | 0.467575 | matrix.go | starcoder |
//Package visualization has the collection of visualizations and its utilities for the platform
package visualization
import "github.com/cuttle-ai/octopus/interpreter"
//Metric holds the information about an metric to be used in the visualization
type Metric struct {
//ResourceID of the item which is represented by... | visualization/visualization.go | 0.639736 | 0.514278 | visualization.go | starcoder |
//go:generate msgp -file=$GOFILE -unexported
package cmd
import (
"time"
)
const (
sizeLessThan1KiB = iota
sizeLessThan1MiB
sizeLessThan10MiB
sizeLessThan100MiB
sizeLessThan1GiB
sizeGreaterThan1GiB
// Add new entries here
sizeLastElemMarker
)
// sizeToTag converts a size to a tag.
func sizeToTag(size int... | cmd/last-minute.go | 0.541894 | 0.50238 | last-minute.go | starcoder |
package fake
import (
"github.com/crossplane/crossplane/internal/dag"
)
var _ dag.DAG = &MockDag{}
// MockDag is a mock DAG.
type MockDag struct {
MockInit func(nodes []dag.Node, fns ...dag.NodeFn) ([]dag.Node, error)
MockAddNode func(dag.Node) error
MockAddNodes func(...dag.Node) er... | internal/dag/fake/mocks.go | 0.760206 | 0.411347 | mocks.go | starcoder |
package bitset
import (
"encoding/binary"
"fmt"
"math"
"strings"
"github.com/flu-network/client/common"
)
const wordSize = 64
// Bitset is simple bitset backed by a []uint64. The size of the bitset is unbounded and it will
// grow as required to support any Set() operations invoked. Bitset provides no compress... | common/bitset/bitset.go | 0.773559 | 0.408483 | bitset.go | starcoder |
package client
import "github.com/stretchr/testify/mock"
type MockCreator struct {
mock.Mock
}
func (m *MockCreator) Create(topic string, detail TopicDetail, validateOnly bool) error {
args := m.Called(topic, detail, validateOnly)
return args.Error(0)
}
func (m *MockCreator) CreatePartitions(topic string, count ... | pkg/client/mockkatclient.go | 0.76074 | 0.401453 | mockkatclient.go | starcoder |
package mal
import (
"github.com/PuerkitoBio/goquery"
"log"
"strconv"
"strings"
)
func parseRating(spanDarkText *goquery.Selection) string {
return strings.TrimSpace(spanDarkText.
FilterFunction(isTextEqualFilterFunc("Rating:")).
Nodes[0].
NextSibling.
Data)
}
func parseDuration(spanDarkText *goquery.Se... | mal/animeparser.go | 0.602296 | 0.48688 | animeparser.go | starcoder |
package container
import (
"ArchitectureExtended/matrices"
"fmt"
"math/rand"
"os"
"strconv"
"sync"
)
// Container structure.
type Cont struct {
// Size.
Size int
// Container itself
Container []*Box
}
// Creating an instance of a container and returning a pointer.
func NewCont(size int) *Cont {
cont := ne... | Go/container/cont.go | 0.567817 | 0.420362 | cont.go | starcoder |
package reflecth
import (
"github.com/apaxa-go/helper/goh/tokenh"
"github.com/apaxa-go/helper/strconvh"
"go/token"
"reflect"
)
// CompareOp performs compare operation <x><op><y> as Go language specification describes.
// Supported operations: < <= >= > == != .
// If operation cannot be performed then error will b... | back/vendor/github.com/apaxa-go/helper/reflecth/op-compare.go | 0.718693 | 0.597579 | op-compare.go | starcoder |
package models
import (
i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91 "github.com/microsoft/kiota-abstractions-go/serialization"
)
// InstitutionData
type InstitutionData struct {
// Stores additional data not described in the OpenAPI description found when deserializing. Can be used for ... | models/institution_data.go | 0.546496 | 0.428293 | institution_data.go | starcoder |
package prng
import (
"math"
"math/bits"
"unsafe"
)
// A Xosh with a xoshiro256 prng implements a 64-bit generator with 256-bit state.
type Xosh struct {
s0, s1, s2, s3 uint64
}
// NewXosh returns a new xoshiro256 generator seeded by the seed.
func NewXosh(seed uint64) Xosh {
x := Xosh{}
x.Seed(seed)
return x... | pkg/pool/prng/xosh.go | 0.843057 | 0.524821 | xosh.go | starcoder |
package astdiff
import (
"go/ast"
"go/token"
"reflect"
"github.com/uber-go/gopatch/internal/goast"
)
type value struct {
t reflect.Type
// Only one of the following three is set.
isNil bool
value interface{}
Elem *value
Children []*value
// Set only if this is a Node.
IsNode bool
pos, end... | internal/astdiff/snapshot.go | 0.594316 | 0.410343 | snapshot.go | starcoder |
package v1alpha1
import (
"fmt"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
)
// GetType returns the type of the record.
func (r *RecordSet) GetType() RecordType {
switch {
case len(r.A) > 0:
return RecordTypeA
case len(r.AAAA) > 0:
return RecordTypeAAAA
case len(r.TXT) > 0:
return RecordTypeTXT
case ... | apis/dns/v1alpha1/recordset_types.go | 0.560734 | 0.440409 | recordset_types.go | starcoder |
package unityai
type NavMeshPath struct {
m_timeStamp uint32
m_status NavMeshPathStatus
m_polygons []NavMeshPolyRef
m_sourcePosition Vector3f
m_targetPosition Vector3f
m_Size int32
}
type NavMeshPathStatus int32
const (
kPathComplete NavMeshPathStatus = 0
kPathPartial NavMeshPat... | nav_mesh_path.go | 0.551332 | 0.401629 | nav_mesh_path.go | starcoder |
package main
import (
"math"
"math/rand"
)
// Picks a random initial location to create a bacterium
func (b Bacteria) PickInitialLocation(petriRadius float64) (float64, float64) {
r := rand.Float64() * (petriRadius - b.sizeRadius)
theta := rand.Float64() * 2 * math.Pi
x := petriRadius + r*math.Sin(theta)
y := ... | simulation/initialization.go | 0.8119 | 0.527317 | initialization.go | starcoder |
package chanz
import (
"github.com/modfin/henry/slicez"
"sync"
)
// Map will take a chan, in, and executes mapper and put the resulting on to the return chan.
// The return chan has a buffer of 0.
// It will stop once "in" is closed
func Map[A any, B any](in <-chan A, mapper func(a A) B) <-chan B {
return MapUntil... | chanz/chanz.go | 0.590897 | 0.707493 | chanz.go | starcoder |
package main
import (
"errors"
"math"
"sort"
)
// VertexID is a generic interface type to represent vertex's identity.
type VertexID interface{}
// Vertex must implement this interface to be used in Graph.
type Vertex interface {
ID() VertexID
}
// Weight is assumed to be int. It's used for edge weight and path... | graph.go | 0.740831 | 0.423875 | graph.go | starcoder |
package boolean
// MaxVars is the maximum number of Boolean variables in a Term.
const MaxVars = 6
// Complexity values for the different Boolean operations.
const (
ConstComplexity = 0
VarComplexity = 1
UnaryComplexity = 1
BinaryComplexity = 1
)
const (
trueNotation = "1"
falseNotation = "0"
notNotatio... | pkg/boolean/term.go | 0.806014 | 0.40072 | term.go | starcoder |
package withreflection
import (
"bytes"
"encoding/binary"
"fmt"
"io"
"math"
"reflect"
)
// Implementation for Parity codec in Go.
// Derived from https://github.com/paritytech/parity-codec/
// While Rust implementation uses Rust type system and is highly optimized, this one
// has to rely on Go's reflection an... | withreflect/codec.go | 0.692434 | 0.448245 | codec.go | starcoder |
package notation
import "reflect"
func reflectFuncBaseType(t reflect.Type) node {
isVariadic := t.IsVariadic()
args := func(num func() int, typ func(int) reflect.Type) []node {
var t []node
for i := 0; i < num(); i++ {
if i == num()-1 && isVariadic {
t = append(t, nodeOf("...", reflectType(typ(i).Elem())... | reflecttype.go | 0.526586 | 0.44348 | reflecttype.go | starcoder |
package pdf
import "math"
import "strconv"
// PDF "Numeric" object
// Implements:
// pdf.Object
type Numeric interface {
Value() interface{}
Object
}
// RealNumeric implements Numeric
type RealNumeric struct {
value float32
}
// IntNumeric implements Numeric
type IntNumeric struct {
value int
}
func (n *RealNu... | pdf/numeric.go | 0.789071 | 0.434041 | numeric.go | starcoder |
package pm
import (
"math/big"
ethcommon "github.com/ethereum/go-ethereum/common"
"github.com/ethereum/go-ethereum/crypto"
)
// Constants for byte sizes of Solidity types
const (
addressSize = 20
uint256Size = 32
bytes32Size = 32
)
// TicketParams represents the parameters defined by a receiver that a sender ... | pm/ticket.go | 0.734024 | 0.442516 | ticket.go | starcoder |
package eyes
import (
"image"
"image/color"
"math"
"time"
"github.com/faiface/pixel"
"github.com/faiface/pixel/imdraw"
)
type Marker struct {
Width, Height int
Radius float64
ActivationTime time.Duration
activeSpots map[image.Point]bool
spots []spot
numFixations int
inFixation bool
... | marker.go | 0.573917 | 0.415373 | marker.go | starcoder |
package smp
import (
"fmt"
"github.com/myfantasy/mft"
)
// Errors codes and description
var Errors map[int]string = map[int]string{
500000000: "strategies.TakeProfitBuy: Command: `%v` does not exists",
500000010: "strategies.TakeProfitBuy: Command: `%v` param not set",
500000011: "strategies.TakeProfitBuy: Comm... | error.go | 0.596551 | 0.50891 | error.go | starcoder |
package jen
// Parens renders a single item in parenthesis. Use for type conversion or to specify evaluation order.
func Parens(item Code) *Statement {
return newStatement().Parens(item)
}
// Parens renders a single item in parenthesis. Use for type conversion or to specify evaluation order.
func (g *Group) Parens(... | vendor/github.com/dave/jennifer/jen/generated.go | 0.874326 | 0.50769 | generated.go | starcoder |
package imagevector
// ReadImageVector reads the image vector yaml file in the charts directory, unmarshals the content
import (
"fmt"
"io/ioutil"
"path/filepath"
"github.com/gardener/gardener/pkg/operation/common"
"github.com/gardener/gardener/pkg/utils"
yaml "gopkg.in/yaml.v2"
)
// ReadImageVector reads the... | pkg/utils/imagevector/imagevector.go | 0.761716 | 0.402392 | imagevector.go | starcoder |
package plaid
import (
"encoding/json"
)
// PaymentAmount The amount and currency of a payment
type PaymentAmount struct {
// The ISO-4217 currency code of the payment. For standing orders, `\"GBP\"` must be used.
Currency string `json:"currency"`
// The amount of the payment. Must contain at most two digits of ... | plaid/model_payment_amount.go | 0.816187 | 0.458106 | model_payment_amount.go | starcoder |
package amqp09
import (
"context"
"crypto/tls"
"errors"
"fmt"
"net/url"
"regexp"
"strconv"
"strings"
"sync"
"time"
amqp "github.com/rabbitmq/amqp091-go"
"github.com/benthosdev/benthos/v4/internal/bundle"
"github.com/benthosdev/benthos/v4/internal/component"
"github.com/benthosdev/benthos/v4/internal/co... | internal/impl/amqp09/input.go | 0.651798 | 0.482795 | input.go | starcoder |
package main
import (
"time"
RLBot "github.com/Trey2k/RLBotGo"
math "github.com/chewxy/math32"
rotator "github.com/xonmello/BotKoba/rotator"
vector "github.com/xonmello/BotKoba/vector3"
)
var lastJump int64
func initialSetup(koba *RLBot.PlayerInfo, opponent *RLBot.PlayerInfo, ball *RLBot.BallInfo) (*vector.Vec... | utils.go | 0.744656 | 0.573231 | utils.go | starcoder |
package iso20022
// Data common to all transactions of a data set.
type CommonData1 struct {
// Data related to the environment of the transaction, common to a set of transaction.
Environment *CardPaymentEnvironment5 `xml:"Envt,omitempty"`
// Data related to the context of the transaction, common to a set of tran... | CommonData1.go | 0.838713 | 0.453443 | CommonData1.go | starcoder |
package validate
import (
"fmt"
"reflect"
"regexp"
convert "github.com/szyhf/go-convert"
)
const (
regularMobile = `^((\+86)|(86))?(13\d|15[^4\D]|17[13678]|18\d)\d{8}|170[^346\D]\d{7}$`
regularEmail = `^([\w-_]+(?:\.[\w-_]+)*)@((?:[a-z0-9]+(?:-[a-zA-Z0-9]+)*)+\.[a-z]{2,6})$`
regularIPv4 = `^(25[0-5]|2[0-4]... | validate.go | 0.517327 | 0.408424 | validate.go | starcoder |
package main
import (
"math"
)
type Vector3 struct {
x float64
y float64
z float64
}
type SimplexDt struct {
n float64
a float64
freq float64
oct int
}
type Seeder struct {
perm [512]int
gradP [512]Vector3
}
var grad3 = [12]Vector3{
{1, 1, 0}, {-1, 1, 0}, {1, -1, 0}, {-1, -1, 0},
{1, 0, 1}, {-1... | noise.go | 0.635449 | 0.517205 | noise.go | starcoder |
package config
import (
"regexp"
"strings"
)
// Keep a copy of schema.json in case we need to directly use it.
var schema = `{
"$schema": "http://json-schema.org/draft-04/schema#",
"type": "object",
"description": "Amazon CloudWatch Agent JSON Schema",
"properties": {
"agent": {
"$ref": "#/defin... | translator/config/schema.go | 0.669096 | 0.403009 | schema.go | starcoder |
package fptower
import (
"github.com/consensys/gnark-crypto/ecc/bw6-764/fp"
)
// E3 is a degree-three finite field extension of fp2
type E3 struct {
A0, A1, A2 fp.Element
}
// Equal returns true if z equals x, fasle otherwise
// note this is more efficient than calling "z == x"
func (z *E3) Equal(x *E3) bool {
r... | ecc/bw6-764/internal/fptower/e3.go | 0.781331 | 0.458773 | e3.go | starcoder |
package paths
import "math"
// Vec2 is a 2-dimensional vector.
type Vec2 [2]float64
// A Path is a contiguous series of line segments, from the
// first point in the V slice to the last.
type Path struct {
V []Vec2
}
// Bounds describes an axis-aligned bounding box.
type Bounds struct {
Min, Max Vec2
}
// Paths ... | paths/paths.go | 0.832203 | 0.699331 | paths.go | starcoder |
package tree
import (
"encoding/hex"
"fmt"
"log"
"math/big"
)
var (
// Zero is the value used to represent 0 in the index bit string.
Zero = byte('0')
// One is the data used to represent 1 in the index bit string.
One = byte('1')
)
// BitString converts a byte slice index into a string of Depth '0' or '1'
... | core/tree/common.go | 0.671686 | 0.426859 | common.go | starcoder |
package evaluate
import (
"fmt"
)
type value struct {
v float64
err error
}
type node interface {
Type() nodeType
String() string
}
type nodeType int
const (
nodeBinaryOp nodeType = iota
nodeUnaryOp
nodeValue
nodeError
nodeAssign
nodeFunction
nodeVariableRef
)
type binaryOpType int
const (
binaryO... | go/calc/internal/evaluate/node.go | 0.515864 | 0.403508 | node.go | starcoder |
package chaosmonkey
import . "github.com/onsi/ginkgo"
// Disruption is the type to construct a chaosmonkey with; see Do for more information.
type Disruption func()
// Test is the type to register with a chaosmonkey. A test will run asynchronously across the
// chaosmonkey's Disruption. A Test takes a Semaphore as... | test/e2e/chaosmonkey/chaosmonkey.go | 0.632049 | 0.40698 | chaosmonkey.go | starcoder |
package iso20022
// Chain of parties involved in the settlement of a transaction, including receipts and deliveries, book transfers, treasury deals, or other activities, resulting in the movement of a security or amount of money from one account to another.
type SettlementParties10 struct {
// First party in the set... | SettlementParties10.go | 0.678753 | 0.478955 | SettlementParties10.go | starcoder |
package astits
import (
"fmt"
"time"
"github.com/asticode/go-astikit"
)
// parseDVBTime parses a DVB time
// This field is coded as 16 bits giving the 16 LSBs of MJD followed by 24 bits coded as 6 digits in 4 - bit Binary
// Coded Decimal (BCD). If the start time is undefined (e.g. for an event in a NVOD referenc... | dvb.go | 0.597021 | 0.449997 | dvb.go | starcoder |
package asttransform
import (
"sort"
"github.com/jensneuse/graphql-go-tools/pkg/ast"
)
type (
// Transformable defines the interface which needs to be implemented in order to apply Transformations
// This needs to be implemented by any AST in order to be transformable
Transformable interface {
// DeleteRootNo... | pkg/asttransform/asttransform.go | 0.615666 | 0.469459 | asttransform.go | starcoder |
package rt
import (
"strconv"
"github.com/peterbourgon/fastly-exporter/pkg/prom"
"github.com/prometheus/client_golang/prometheus"
)
// process the data from the realtime response, and feed the interpreted results
// to the Prometheus metrics as observations.
func process(resp realtimeResponse, serviceID, serviceN... | pkg/rt/process.go | 0.50293 | 0.536252 | process.go | starcoder |
package bit
var bitByteToString = [256]string{
0: `00000000`,
1: `00000001`,
2: `00000010`,
3: `00000011`,
4: `00000100`,
5: `00000101`,
6: `00000110`,
7: `00000111`,
8: `00001000`,
9: `00001001`,
10: `00001010`,
11: `00001011`,
12: `00001100`,
13: `00001101`,
14: `00001110`,
1... | pkg/reader/byteFormatters/bit/bit_lookup.go | 0.584983 | 0.444083 | bit_lookup.go | starcoder |
package model
import (
"encoding/json"
"fmt"
"github.com/tespkg/grule/pkg"
"reflect"
"time"
)
var (
// DateTimeLayout contains the date time layouting used by this data access layer.
DateTimeLayout = time.RFC3339
)
// NewJSONValueNode will create a new ValueNode structure backend using data structure as prov... | model/JsonDataAccessLayer.go | 0.744378 | 0.411998 | JsonDataAccessLayer.go | starcoder |
package populate
import (
"github.com/df-mc/dragonfly/server/block"
"github.com/df-mc/dragonfly/server/block/cube"
"github.com/df-mc/dragonfly/server/block/model"
"github.com/df-mc/dragonfly/server/world"
"github.com/df-mc/dragonfly/server/world/chunk"
"github.com/t14raptor/pm-gen/rand"
)
type Tree struct {
Ba... | populate/tree.go | 0.508544 | 0.430147 | tree.go | starcoder |
package iso20022
// Date and identification of a trade together with references to previous events in its life.
type TradeAgreement12 struct {
// Date on which the trading parties agreed on the trade.
TradeDate *ISODate `xml:"TradDt"`
// Identification of the present message assigned by the party issuing the mess... | TradeAgreement12.go | 0.776919 | 0.459804 | TradeAgreement12.go | starcoder |
package binarySearchTree
// package main
import (
"fmt"
"math"
)
type node struct {
val int
left *node
right *node
}
type btree struct {
root *node
}
func max(a, b int) int {
if a > b {
return a
}
return b
}
func newNode(val int) *node {
return &node{val, nil, nil}
}
func inorder(n *node) {
if n... | data-structures/binary-tree/binary-search-tree.go | 0.604165 | 0.415966 | binary-search-tree.go | starcoder |
package scheduler
import (
"math/rand"
"time"
)
// Scheduler simple interface that encapsulate the scheduling logic, this is useful if you want to
// test asynchronous code in a synchronous way.
type Scheduler interface {
WaitTick() <-chan time.Time
Stop()
}
// Stepper is a scheduler where each Tick is manually... | x-pack/elastic-agent/pkg/scheduler/scheduler.go | 0.809088 | 0.456531 | scheduler.go | starcoder |
package term
// Subst takes a Term and finds all instances of a variable called
// `name` and replaces them with the replacement.
func Subst(name string, replacement, t Term) Term {
return substAtLevel(0, name, replacement, t)
}
func substAtLevel(i int, name string, replacement, t Term) Term {
switch t := t.(type) ... | term/subst.go | 0.560493 | 0.505676 | subst.go | starcoder |
package g4
import (
"github.com/go-gl/gl/v3.3-core/gl"
"github.com/amortaza/go-g4/ace"
)
type TextureRect struct {
program *ace.Program
vao uint32
vbo uint32
}
func NewTextureRect(vertexShaderFilename, fragmentShaderFilename string) *TextureRect {
r := &TextureRect{}
r.program = ace.NewProgram(vertexShaderF... | TextureRect.go | 0.658088 | 0.435721 | TextureRect.go | starcoder |
package set_tool
import (
"fmt"
"strings"
)
//IntervalSet is an interval set, such as {[1,1],[5,100],[108,203],[300,400]}
type IntervalSet struct {
intervalSet []*Interval
}
//Interval between [start,end]
type Interval struct {
start uint64
end uint64
}
//NewIntervalSet create an interval set
... | set_tool/interval_set.go | 0.636579 | 0.410815 | interval_set.go | starcoder |
package cube
import (
"log"
"reflect"
"time"
)
type Dimensions interface{}
type Aggregates interface{}
type TimeIndexedDimensions interface {
TimeIndex() time.Time
}
type Cuber interface {
Insert(dimensions Dimensions, aggregates Aggregates)
Visit(func(Dimensions, Aggregates))
// Data() map[Dimensions]Aggreg... | cube/cube.go | 0.58439 | 0.432123 | cube.go | starcoder |
package stl
import (
"bytes"
"encoding/binary"
"io"
)
// A Scene holds all of the contents of an STL file, as well as
// derived values.
type Scene struct {
Header [80]byte
Triangles []Triangle
Bounds Subspace
}
// A Region is a region of the coordinate space from Min to Max
type Subspace struct {
Min ... | stl/stl.go | 0.716318 | 0.543954 | stl.go | starcoder |
package main
import (
"github.com/gen2brain/raylib-go/physics"
"github.com/gen2brain/raylib-go/raylib"
)
const (
velocity = 0.5
)
func main() {
screenWidth := float32(800)
screenHeight := float32(450)
raylib.SetConfigFlags(raylib.FlagMsaa4xHint)
raylib.InitWindow(int32(screenWidth), int32(screenHeight), "Phy... | examples/physics/physac/restitution/main.go | 0.647018 | 0.473536 | main.go | starcoder |
package fronius
import (
"encoding/json"
"net/http"
"net/url"
"time"
log "github.com/sirupsen/logrus"
)
type (
symoPowerFlow struct {
Body struct {
Data SymoData
}
}
// SymoData holds the parsed data from the Symo API.
SymoData struct {
Inverters map[string]Inverter
Site struct {
Mode ... | pkg/fronius/symo.go | 0.636692 | 0.422207 | symo.go | starcoder |
package ff
import (
"github.com/drakos74/go-ex-machina/xmachina/net"
"github.com/drakos74/go-ex-machina/xmath"
)
// Layer represents a layer in the network,
// it will receive a vector of inputs and transform them into another vectopr of inputs.
// Not necessarily of the same size.
type Layer struct {
n, m int
... | xmachina/net/ff/layer.go | 0.762954 | 0.58602 | layer.go | starcoder |
package engine
import (
"retro-carnage/assets"
"retro-carnage/engine/characters"
"retro-carnage/engine/geometry"
)
const (
BulletHeight = 5
BulletWidth = 5
EnemyBulletSpeed = 1.4
EnemyBulletRange = 500
)
// Bullet is a projectile that has been fired by a player or enemy.
type Bullet struct {
distanc... | src/engine/bullet.go | 0.677581 | 0.457743 | bullet.go | starcoder |
package main
import (
"fmt"
"math"
"strconv"
"strings"
)
const gridWidth int = 1000
const gridHeight int = 1000
var grid [gridHeight][gridWidth]int
type Point struct {
x int
y int
}
type Rectangle struct {
p1 Point
p2 Point
}
func main() {
instructions := strings.Split(input, "\n")
for _, instruction ... | 6.go | 0.635675 | 0.458106 | 6.go | starcoder |
package itests
import (
"context"
"fmt"
"testing"
"github.com/filecoin-project/go-state-types/abi"
"github.com/filecoin-project/lotus/chain/types"
"github.com/go-pg/pg/v10"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
"github.com/filecoin-project/lily/chain/indexer/tasktype"
"... | itests/validators.go | 0.579519 | 0.446676 | validators.go | starcoder |
package model
import (
"strings"
)
// Each feature gets its own weight vector, so weights is a dict-of-dicts
type Weights struct {
values [][]float64
classes [][]string
weights map[string]int
features map[string]int
}
// NewWeights init Weights
func NewWeights(cap int) *Weights {
return &Weights{
values:... | perceptron/model/weights.go | 0.680666 | 0.550607 | weights.go | starcoder |
package iso20022
// Parameters applied to the settlement of a security transfer.
type Transfer20 struct {
// Date and time at which the securities are to be exchanged at the International Central Securities Depository (ICSD) or Central Securities Depository (CSD).
RequestedSettlementDate *ISODate `xml:"ReqdSttlmDt,... | Transfer20.go | 0.806052 | 0.475362 | Transfer20.go | starcoder |
package service
import (
. "github.com/jotaen/klog/src"
gosort "sort"
)
// FilterQry represents the filter clauses of a query.
type FilterQry struct {
Tags []string
BeforeOrEqual Date
AfterOrEqual Date
Dates []Date
}
// Filter returns all records the matches the query.
// A matching record mu... | src/service/query.go | 0.69285 | 0.4575 | query.go | starcoder |
package gconv
import (
"reflect"
"time"
"github.com/gogf/gf/v2/os/gtime"
)
// Convert converts the variable `fromValue` to the type `toTypeName`, the type `toTypeName` is specified by string.
// The optional parameter `extraParams` is used for additional necessary parameter for this conversion.
// It supports co... | util/gconv/gconv_convert.go | 0.733738 | 0.400046 | gconv_convert.go | starcoder |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.