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 cmp
import (
"fmt"
"reflect"
"strings"
"github.com/google/go-cmp/cmp/internal/flags"
"github.com/google/go-cmp/cmp/internal/value"
)
const (
pointerDelimPrefix = "⟪"
pointerDelimSuffix = "⟫"
)
// formatPointer prints the address of the pointer.
func formatPointer(p value.Pointer, withDelims bool) st... | vendor/github.com/google/go-cmp/cmp/report_references.go | 0.703855 | 0.419172 | report_references.go | starcoder |
package three
//go:generate go run geometry_method_generator/main.go -geometryType CylinderGeometry -geometrySlug cylinder_geometry
import (
"math"
"github.com/gopherjs/gopherjs/js"
)
// CylinderGeometry a class for generating cylinder geometries.
type CylinderGeometry struct {
*js.Object
RadiusTop float6... | geometries_cylinder_geometry.go | 0.77081 | 0.490663 | geometries_cylinder_geometry.go | starcoder |
package aesr
// Round32sle mixes the input values with aes tables and returns the result.
func Round32sle(x0, x1, x2, x3 uint32) (uint32, uint32, uint32, uint32) {
y0 := (kAes0[x0&0xFF] ^
kAes1[(x1>>8)&0xFF] ^
kAes2[(x2>>16)&0xFF] ^
kAes3[(x3>>24)&0xFF])
y1 := (kAes0[x1&0xFF] ^
kAes1[(x2>>8)&0xFF] ^
kAes2[... | crypto/x16rv3/aesr/aesr.go | 0.657318 | 0.644197 | aesr.go | starcoder |
package taxreturn
import (
"fmt"
"time"
)
const (
parseLayout string = "2006-01-02"
stringLayout string = "2006-01-02"
)
// Period describes interface of the generic time period.
type Period interface {
Start() time.Time
End() time.Time
String() string
}
// BillPeriod describes date period.
type BillPeriod ... | period.go | 0.800653 | 0.46952 | period.go | starcoder |
package script64
import (
"fmt"
"go/token"
"reflect"
data "github.com/seeder-research/uMagNUS/data64"
)
// converts in to an expression of type OutT.
// also serves as type check (not convertible == type error)
// pos is used for error message on impossible conversion.
func typeConv(pos token.Pos, in Expr, outT ... | script64/typeconv.go | 0.593374 | 0.608085 | typeconv.go | starcoder |
package schema
type Power struct {
// The type of a resource. [RO]
OdataType string `json:"@odata.type"`
// The identifier that uniquely identifies the Resource within
// the collection of similar Resources. [RO]
Id string `json:"Id"`
// The name of the Resource or array member. [RO]
Name string `json:"Name"`... | cmd/pemgr-server/schema/chassis-power.go | 0.801237 | 0.55941 | chassis-power.go | starcoder |
package msh
import (
"gosl/utl"
)
// EdgeKey holds 3 sorted numbers to identify an edge
type EdgeKey struct {
A int // id of one vertex on edge
B int // id of another vertex on edge
C int // id of a third vertex on edge or the number of mesh vertices if edge has only 2 vertices
}
// Edge holds the vertices and ... | gm/msh/topology.go | 0.588889 | 0.701189 | topology.go | starcoder |
package models
import (
"fmt"
"strings"
"github.com/SKF/go-utility/v2/uuid"
grpcapi "github.com/SKF/proto/v2/hierarchy"
)
// MeasurementPoint describes an assets measurement points
type MeasurementPoint struct {
// Bearing number on this asset
Bearing int32 `json:"bearing" example:"1"`
// Orientation of measu... | v2/services/hierarchy/models/measurement_point.go | 0.79956 | 0.530966 | measurement_point.go | starcoder |
package fp
func (q BoolQueue) IsEmpty() bool {
return (*q.in).IsEmpty() && (*q.out).IsEmpty()
}
func (q StringQueue) IsEmpty() bool {
return (*q.in).IsEmpty() && (*q.out).IsEmpty()
}
func (q IntQueue) IsEmpty() bool {
return (*q.in).IsEmpty() && (*q.out).IsEmpty()
}
func (q Int64Queue) IsEmpty() bool {
return (*q... | fp/bootstrap_queue_isempty.go | 0.788257 | 0.584716 | bootstrap_queue_isempty.go | starcoder |
package ipld
import (
"crypto/sha256"
"github.com/ipfs/go-cid"
"github.com/tendermint/tendermint/pkg/consts"
"github.com/celestiaorg/celestia-node/ipld/pb"
"github.com/celestiaorg/celestia-node/ipld/plugin"
"github.com/celestiaorg/nmt"
"github.com/celestiaorg/nmt/namespace"
)
const (
// MaxSquareSize is cur... | ipld/share.go | 0.589835 | 0.435421 | share.go | starcoder |
package amdsi
import (
"fmt"
"strings"
)
// Instruction contains all field of an instruction
type Instruction struct {
InstType string
InstText string
DstRegs []*Register
SrcRegs []*Register
VRegs [255]int
SRegs [102]int
Raw string
}
// NewInstruction returns an instruction
func NewInstruction(... | modules/instruction.go | 0.564579 | 0.418994 | instruction.go | starcoder |
package deep
import (
"fmt"
)
// Neural is a neural network
type Neural struct {
Layers []*Layer
Biases [][]*Synapse
Config *Config
}
// Config defines the network topology, activations, losses etc
type Config struct {
// Number of inputs
Inputs int
// Defines topology:
// For instance, [5 3 3] signifies a n... | plugins/data/learn/ml-libs-godeep/neural.go | 0.765155 | 0.500183 | neural.go | starcoder |
package parallel
import (
"encoding/base32"
"strconv"
"strings"
"time"
"github.com/mitchellh/hashstructure/v2"
"github.com/pkg/errors"
"k8s.io/utils/pointer"
execution "github.com/furiko-io/furiko/apis/execution/v1alpha1"
"github.com/furiko-io/furiko/pkg/utils/matrix"
)
// GenerateIndexes generates the ind... | pkg/execution/util/parallel/indexes.go | 0.701304 | 0.435781 | indexes.go | starcoder |
package engine
import (
"fmt"
"math/bits"
)
// bitboard.go contains the implementation of a bitboard datatype for the engine.
// A type representing a bitboard, which is a unsigned 64-bit number. Blunder's
// bitboard representation has the most significant bit being A1 and the least signficanrt
// bit being H8.
t... | engine/bitboard.go | 0.778186 | 0.436562 | bitboard.go | starcoder |
package chunk
import (
"unsafe"
"github.com/pingcap/tidb/types"
"github.com/pingcap/tidb/types/json"
"github.com/pingcap/tidb/util/hack"
)
// Chunk stores multiple rows of data in Apache Arrow format.
// See https://arrow.apache.org/docs/memory_layout.html
// Values are appended in compact format and can be dir... | util/chunk/chunk.go | 0.631708 | 0.503113 | chunk.go | starcoder |
package conf
// Uint8Var defines a uint8 flag and environment variable with specified name, default value, and usage string.
// The argument p points to a uint8 variable in which to store the value of the flag and/or environment variable.
func (c *Configurator) Uint8Var(p *uint8, name string, value uint8, usage string... | value_uint8.go | 0.755186 | 0.449332 | value_uint8.go | starcoder |
// Package tabulator provides a generic interface for tabulating data (to CSV, to tabwriter, etc).
package tabulator
import (
"fmt"
"strconv"
)
// Tabulator is the interface of things that can create tables.
type Tabulator interface {
// Header adds a header to the current table, if one has not yet been set.
// ... | internal/tabulator/tabulator.go | 0.669637 | 0.459622 | tabulator.go | starcoder |
// Copyright 2021 The Go Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
package main
import (
"errors"
"fmt"
)
// _Equal reports whether two slices are equal: the same length and all
// elements equal. All floating point NaNs a... | test/typeparam/graph.go | 0.777933 | 0.465691 | graph.go | starcoder |
package storage
import (
"errors"
"fmt"
"github.com/prometheus/prometheus/model/labels"
"github.com/parca-dev/parca/pkg/profile"
"github.com/parca-dev/parca/pkg/storage/chunkenc"
)
// MemRangeSeries is an iterator that only queries certain chunks within the range and
// then only the samples within the range.... | pkg/storage/series_iterator_range.go | 0.742982 | 0.409634 | series_iterator_range.go | starcoder |
package main
import (
"math/rand"
)
//InitializeClasses populates the slice that has classes( population proportions at various states/time) for a region
// It sets entire population as susceptible i.e. S=1.0
func InitializeClasses(numStates int) []float64 {
s := make([]float64, numStates)
s[0] = 1.0
... | covid1/initialization.go | 0.63409 | 0.435781 | initialization.go | starcoder |
package main
import "fmt"
// [func] function definition
// Can have more parameters.
func add(x int, y int) int {
// [return]
return x + y // [+]
}
// More parameters from the same type can be listed with same type.
func myMath(x, y float64) {
fmt.Println("x + y:", x+y) // [+] sum
fmt.Println("x - y:",... | src/func.go | 0.520009 | 0.47098 | func.go | starcoder |
package engine
import "math"
const (
RadianMode = iota
AngleMode
)
// enum "RadianMode", "AngleMode"
var TrigonometricMode = RadianMode
var defConst = map[string]float64{
"pi": math.Pi,
}
var defFunC = map[string]int{
"sin": 1,
"cos": 1,
"tan": 1,
"cot": 1,
"sec": 1,
"csc": 1,
"abs": 1,
"ceil": 1,
... | engine/def.go | 0.55254 | 0.432902 | def.go | starcoder |
package trees
import (
"errors"
"github.com/TectusDreamlab/go-common-utils/datastructure/shared"
)
// IndexedPriorityQueue defines an indexed priority queue based on a heap.
type IndexedPriorityQueue struct {
capacity int
size int
pq []int // This is a heap.
qp []int
values []inter... | datastructure/trees/indexes_priority_queue.go | 0.746139 | 0.520192 | indexes_priority_queue.go | starcoder |
package internal
import "github.com/mokiat/gomath/sprec"
const (
initialContourPointCount = 1024
initialContourSubContourCount = 4
)
func newContour() *Contour {
return &Contour{
points: make([]ContourPoint, 0, initialContourPointCount),
subContours: make([]SubContour, 0, initialContourSubContourCou... | framework/opengl/ui/internal/contour.go | 0.504394 | 0.449393 | contour.go | starcoder |
// Package write provides the Point struct
package write
import (
"fmt"
"sort"
"time"
lp "github.com/influxdata/line-protocol"
)
// Point is represents InfluxDB time series point, holding tags and fields
type Point struct {
measurement string
tags []*lp.Tag
fields []*lp.Field
timestamp time.Ti... | vendor/github.com/influxdata/influxdb-client-go/v2/api/write/point.go | 0.792705 | 0.50653 | point.go | starcoder |
package main
/*****************************************************************************************************
*
* Given a reference of a node in a connected undirected graph.
*
* Return a deep copy (clone) of the graph.
*
* Each node in the graph contains a val (int) and a list (List[Node]) of its neighbor... | leetcode/133.clone_graph/133.CloneGraph_zmillionaire.go | 0.626581 | 0.708339 | 133.CloneGraph_zmillionaire.go | starcoder |
package httpfake
import (
"bytes"
"fmt"
"io/ioutil"
"net/http"
"strings"
"testing"
)
const assertErrorTemplate = "assertion error: %s"
// Assertor provides an interface for setting assertions for http requests
type Assertor interface {
Assert(r *http.Request) error
Log(t testing.TB)
Error(t testing.TB, err ... | assertions.go | 0.802865 | 0.444987 | assertions.go | starcoder |
package pipe
import (
"github.com/modfin/henry/slicez"
)
func Of[A any](a []A) Pipe[A] {
return Pipe[A]{
in: a,
}
}
type Pipe[A any] struct {
in []A
}
func (p Pipe[A]) Slice() []A {
return p.in
}
func (p Pipe[A]) Peek(apply func(a A)) Pipe[A] {
slicez.Each(p.in, apply)
return p
}
func (p Pipe[A]) Concat(... | exp/pipe/pipe.go | 0.677687 | 0.561876 | pipe.go | starcoder |
package graphic
import (
"github.com/kasworld/h4o/geometry"
"github.com/kasworld/h4o/gls"
"github.com/kasworld/h4o/material"
"github.com/kasworld/h4o/math32"
"github.com/kasworld/h4o/node"
"github.com/kasworld/h4o/renderinfo"
)
// Mesh is a Graphic with uniforms for the model, view, projection, and normal matr... | graphic/mesh.go | 0.778944 | 0.504455 | mesh.go | starcoder |
package envh
import (
"reflect"
)
// StructWalker must be implemented, when using PopulateStruct* functions,
// to be able to set a value for a custom field with an unsupported field (a map for instance),
// to add transformation before setting a field or for custom validation purpose.
// Walk function is called whe... | struct.go | 0.684264 | 0.451568 | struct.go | starcoder |
package log
import "strconv"
// FieldType defines the type of field
type FieldType uint8
// Defines the types of fields
const (
UnknownFieldType FieldType = iota
BinaryType
IntegerType
FloatType
StringType
BoolType
)
// Field encapsulates logging fields
type Field struct {
Key string `json:"key"`
Ty... | log/field.go | 0.860428 | 0.431824 | field.go | starcoder |
package economist
import (
"github.com/coschain/contentos-go/app"
"github.com/coschain/contentos-go/common/constants"
. "github.com/coschain/contentos-go/dandelion"
"github.com/coschain/contentos-go/prototype"
"github.com/stretchr/testify/assert"
"math"
"math/big"
"testing"
)
type ReplyTester struct {
acc0,a... | tests/economist/reply.go | 0.521959 | 0.400808 | reply.go | starcoder |
package optimisation
import "github.com/gonum/matrix/mat64"
// BatchGradientDescent finds the local minimum of a function.
// See http://en.wikipedia.org/wiki/Gradient_descent for more details.
func BatchGradientDescent(x, y, theta *mat64.Dense, alpha float64, epoch int) *mat64.Dense {
m, _ := y.Dims()
// Helper fu... | optimisation/gradient_descent.go | 0.882479 | 0.687886 | gradient_descent.go | starcoder |
package risk
import (
"github.com/go-bongo/bongo"
"github.com/golang/glog"
"github.com/toolkits/slice"
"kube-scan/common"
)
type RiskCategory string
type RiskType string
type RiskFactorCategory string
type RiskCIACategory string
type RiskStatus string
type RiskAttackVector string
type RiskScope string
const (
N... | server/src/risk/types.go | 0.530723 | 0.409752 | types.go | starcoder |
package coin
import (
"math/big"
"strings"
"github.com/digitalbitbox/bitbox-wallet-app/util/errp"
)
// Amount represents an amount in the smallest coin unit (e.g. satoshi).
type Amount struct {
n *big.Int
}
// NewAmount creates a new amount.
func NewAmount(amount *big.Int) Amount {
return Amount{n: amount}
}
... | backend/coins/coin/amount.go | 0.774583 | 0.412826 | amount.go | starcoder |
package message
// http://www.fipa.org/specs/fipa00061/SC00061G.html
// Message represent a message object send between agents
type Message struct {
Type string // Performative :Type of communicative acts. http://www.fipa.org/specs/fipa00037/SC00037J.html
Sender string // Participant in communica... | message/message.go | 0.535098 | 0.406214 | message.go | starcoder |
package engine
import (
"math"
)
var (
BubblePos = NewVectorValue("ext_bubblepos", "m", "Bubble core position", bubblePos)
BubbleDist = NewScalarValue("ext_bubbledist", "m", "Bubble traveled distance", bubbleDist)
BubbleSpeed = NewScalarValue("ext_bubblespeed", "m/s", "Bubble velocity", bubbleSpeed)
BubbleMz ... | engine/ext_bubblepos.go | 0.585931 | 0.521471 | ext_bubblepos.go | starcoder |
package metrics
import (
"regexp"
"time"
"github.com/Masterminds/semver"
)
// AllJobs represents a regex that will collect results from all jobs.
var AllJobs = regexp.MustCompile(".*")
// Phase is a phase of an osde2e run.
type Phase string
// Result is the result of a JUnit test.
type Result string
const (
/... | pkg/metrics/objects.go | 0.821367 | 0.449393 | objects.go | starcoder |
package timespec
import (
"fmt"
"time"
)
type Interval uint
const (
Hourly Interval = iota
Daily
Weekly
Monthly
)
const ns = 1000 * 1000 * 1000
type Spec struct {
Interval Interval
TimeOfDay int
TimeOfHour int
DayOfWeek time.Weekday
DayOfMonth int
Week int
}
func roundM(t time.Time) time.Tim... | timespec/spec.go | 0.607896 | 0.487063 | spec.go | starcoder |
package bulletproofs
import (
"bytes"
"errors"
"fmt"
"github.com/sirupsen/logrus"
"io"
"math/big"
)
// Point is a group element of the secp256k1 curve in affine coordinates.
type Point struct {
X *big.Int
Y *big.Int
}
// Equals returns true if the given point is the same.
func (p *Point) Equals(other *Point)... | math.go | 0.818845 | 0.613844 | math.go | starcoder |
package xgboost
import (
"context"
"errors"
"runtime"
"github.com/foxever/go-xgboost/core"
)
// Matrix interface for 2D matrix
type Matrix interface {
Data() (data []float32, rowCount, columnCount int)
}
// FloatSliceVector float32 slice backed Matrix implementation
type FloatSliceVector []float32
// Data ret... | booster.go | 0.707607 | 0.401131 | booster.go | starcoder |
package encoding
import (
"sort"
)
// ByteArrayList is a container similar to [][]byte with a smaller memory
// overhead. Where using a byte slices introduces ~24 bytes of overhead per
// element, ByteArrayList requires only 8 bytes per element. Extra efficiency
// also comes from reducing GC pressure by using conti... | encoding/bytearray.go | 0.727395 | 0.488222 | bytearray.go | starcoder |
package tipb
import (
"fmt"
proto "github.com/golang/protobuf/proto"
math "math"
io "io"
)
// Reference imports to suppress errors if they are not otherwise used.
var _ = proto.Marshal
var _ = fmt.Errorf
var _ = math.Inf
type ExecType int32
const (
ExecType_TypeTableScan ExecType = 0
ExecType_TypeI... | go-tipb/executor.pb.go | 0.567937 | 0.40392 | executor.pb.go | starcoder |
package callrecords
import (
i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91 "github.com/microsoft/kiota-abstractions-go/serialization"
)
// DeviceInfo
type DeviceInfo struct {
// Stores additional data not described in the OpenAPI description found when deserializing. Can be used for seria... | models/callrecords/device_info.go | 0.732305 | 0.5 | device_info.go | starcoder |
package tu
import (
"time"
)
var (
// Yesterday get yesterday datetime of given datetime
Yesterday TimeFunc = func(t time.Time) time.Time {
return t.AddDate(0, 0, -1)
}
// Tomorrow get tomorrow datetime of given datetime
Tomorrow TimeFunc = func(t time.Time) time.Time {
return t.AddDate(0, 0, 1)
}
// Be... | timeutil.go | 0.571288 | 0.619457 | timeutil.go | starcoder |
package cryptoapis
import (
"encoding/json"
)
// ListOmniTransactionsByBlockHashRI struct for ListOmniTransactionsByBlockHashRI
type ListOmniTransactionsByBlockHashRI struct {
// Defines the amount of the sent tokens.
Amount string `json:"amount"`
// Defines whether the attribute can be divisible or not, as bool... | model_list_omni_transactions_by_block_hash_ri.go | 0.858289 | 0.444565 | model_list_omni_transactions_by_block_hash_ri.go | starcoder |
package structs
/* S t r u c t d e f i n i t i o n */
// StructRows represents a single row of a struct from a StructValue containing a slice
// of structs. If StructValue does not contain a slice of structs, StructRows cannot be
// initialized by contructor Rows. StructRows encapsulates high level functions a... | rows.go | 0.742141 | 0.438485 | rows.go | starcoder |
package bench
import (
"fmt"
"os"
"time"
"github.com/codahale/hdrhistogram"
)
// Summary contains the results of a Benchmark run.
type Summary struct {
Connections uint64
RequestRate uint64
SuccessTotal uint64
ErrorTotal uint64
TimeElapsed ... | latency/bench/summary.go | 0.764804 | 0.478468 | summary.go | starcoder |
package transforms
import (
"fmt"
"image"
"unsafe"
torch "github.com/wangkuiyi/gotorch"
)
// ToTensorTransformer transforms an image or an interger into a Tensor. If the
// image is of type image.Gray, the tensor has one channle; otherwise, the
// tensor has three channels (RGB).
type ToTensorTransformer struct... | vision/transforms/to_tensor.go | 0.897904 | 0.62939 | to_tensor.go | starcoder |
type pair struct {
w1, w2 string
}
type WordDistance struct {
wordsLocMap map[string][]int
//cacheMinDist map[pair]int
}
//time: O(n)
//space: O(n) where n = size of constructor input
func Constructor(wordsDict []string) WordDistance {
wordsLocMap := make(map[string][]int)
for idx, word := range... | 244-shortest-word-distance-ii/244-shortest-word-distance-ii.go | 0.606032 | 0.471102 | 244-shortest-word-distance-ii.go | starcoder |
package un
import "reflect"
func init() {
MakePartition(&Partition)
MakePartition(&PartitionInt)
// MakePartition(&PartitionString)
// MakePartition(&PartitionStringInt)
// MakePartitionP(&PartitionP)
}
// Partition func(func(A, B) bool, []A []A)
// Applies the given iterator function to partition element of a ... | partition.go | 0.690976 | 0.431524 | partition.go | starcoder |
package to
import (
"bytes"
"encoding/gob"
"encoding/json"
"fmt"
"strconv"
)
// String change val type to string
func String(val interface{}) string {
if val == nil {
return "nil"
}
switch t := val.(type) {
case bool:
return strconv.FormatBool(t)
case int:
return strconv.FormatInt(int64(t), 10)
case... | to.go | 0.645455 | 0.459986 | to.go | starcoder |
package graphics
import (
"encoding/binary"
"github.com/go-gl/gl/v4.6-core/gl"
"github.com/mokiat/gomath/sprec"
"github.com/mokiat/lacking/data/buffer"
"github.com/mokiat/lacking/framework/opengl"
)
type skyboxMeshVertex struct {
Position sprec.Vec3
}
func (v skyboxMeshVertex) Serialize(plotter *buffer.Plott... | framework/opengl/game/graphics/preset_skybox_mesh.go | 0.659186 | 0.451931 | preset_skybox_mesh.go | starcoder |
package data
import (
"github.com/wardlem/graphlite/util"
)
// error messages
const (
nilVertex = "attempt to operate on a nil vertex"
)
const vertexDataSize = 13
type Vertex struct {
Id uint32 // The Id of the vertex
class uint8 // Id of the class the vertex belongs to
out uint32 // Id of the first outbou... | data/vertex.go | 0.774754 | 0.567637 | vertex.go | starcoder |
package design
import (
. "github.com/goadesign/goa/design"
. "github.com/goadesign/goa/design/apidsl"
)
// Input Type.This defines the shape of the request.
// DepositPayload defines the data structure used in the create deposit request body
// It is also the base type for the deposit media type used to render de... | design/user_types.go | 0.563138 | 0.459379 | user_types.go | starcoder |
package aac
import (
"fmt"
)
// ADTSPacket is an ADTS packet
type ADTSPacket struct {
SampleRate int
ChannelCount int
Frame []byte
}
// DecodeADTS decodes an ADTS stream into ADTS packets.
func DecodeADTS(byts []byte) ([]*ADTSPacket, error) {
// refs: https://wiki.multimedia.cx/index.php/ADTS
var ret... | internal/aac/adts.go | 0.531453 | 0.47524 | adts.go | starcoder |
Package gerror provides an improved error type which captures an error tag and the stack trace
at construction time.
*/
package gerror
import (
"fmt"
"reflect"
"runtime"
)
const stackSize = 4096
// A Tag represents an error identifier of any type.
type Tag interface{}
// A Gerror is a tagged error with a stack t... | gerror/gerror.go | 0.880733 | 0.477859 | gerror.go | starcoder |
package main
import (
"bufio"
"fmt"
"os"
"strings"
)
// Type Position keeps track of most frequently seen letters in a given position.
type Position struct {
Frequency map[rune]int
}
// Type Code keeps track of various letters in various positions to determine
// the repetition code's message.
type Code struct ... | day06/main.go | 0.68763 | 0.447098 | main.go | starcoder |
package stdlib
import (
"fmt"
"github.com/onflow/cadence/runtime/common"
"github.com/onflow/cadence/runtime/interpreter"
"github.com/onflow/cadence/runtime/sema"
)
// This file defines functions built-in to Cadence.
// AssertFunction
const assertFunctionDocString = `
Terminates the program if the given conditi... | runtime/stdlib/builtin.go | 0.765155 | 0.482063 | builtin.go | starcoder |
package payouts
// AdditionalDataOpenInvoice struct for AdditionalDataOpenInvoice
type AdditionalDataOpenInvoice struct {
// The number of invoice lines included in `openinvoicedata`. There needs to be at least one line, so `numberOfLines` needs to be at least 1.
OpeninvoicedataNumberOfLines int32 `json:"openinvoic... | src/payouts/model_additional_data_open_invoice.go | 0.758511 | 0.428174 | model_additional_data_open_invoice.go | starcoder |
package regions
import (
"fmt"
"sort"
)
// Index is a searchable collection of intervals.
type Index struct {
idx []interval
}
// NewIndex returns an index on the given interval starts and ends. Starts and ends
// should be of the same length. End positions are exclusive, meaning that an end
// value of n implies... | regions/regions.go | 0.580947 | 0.40751 | regions.go | starcoder |
package dataframe
import (
"fmt"
"math"
"reflect"
"strings"
gotime "time"
"go.starlark.net/lib/time"
"go.starlark.net/starlark"
)
// convert starlark value to a string fit for printing
func toStr(val starlark.Value) string {
if text, ok := val.(starlark.String); ok {
return string(text)
}
if val == nil {... | dataframe/convert.go | 0.588653 | 0.400691 | convert.go | starcoder |
package main
import (
"log"
"strings"
"github.com/charmbracelet/bubbles/viewport"
tea "github.com/charmbracelet/bubbletea"
"github.com/evertras/bubble-data-tree/datatree"
)
type Trainer struct {
Name string
Age int
Hometown string
Description string
Pokemon []Pokemon
}
type Pokemon s... | examples/viewport/main.go | 0.518546 | 0.429848 | main.go | starcoder |
package contextionary
import (
"fmt"
annoy "github.com/creativesoftwarefdn/weaviate/contextionary/annoyindex"
)
type mmappedIndex struct {
word_index *Wordlist
knn annoy.AnnoyIndex
}
func (m *mmappedIndex) GetNumberOfItems() int {
return int(m.word_index.numberOfWords)
}
// Returns the length of the use... | contextionary/mmapped.go | 0.711331 | 0.432842 | mmapped.go | starcoder |
package tlv
import (
"encoding/binary"
"errors"
"math"
"github.com/named-data/YaNFD/ndn/util"
)
// EncodeVarNum encodes a non-negative integer value for encoding.
func EncodeVarNum(in uint64) []byte {
if in <= 0xFC {
// This is just here to avoid having to write this condition in every other conditional.
re... | ndn/tlv/helpers.go | 0.679072 | 0.41567 | helpers.go | starcoder |
package types
import (
"math"
"reflect"
"github.com/lyraproj/puppet-evaluator/eval"
"github.com/lyraproj/puppet-evaluator/utils"
)
// CommonType returns a type that both a and b are assignable to
func commonType(a eval.Type, b eval.Type) eval.Type {
if isAssignable(a, b) {
return a
}
if isAssignable(b, a) {... | types/commonality.go | 0.684053 | 0.506591 | commonality.go | starcoder |
package validate
import (
"fmt"
"reflect"
)
// InputAndOutputSig compares the argument and return signatures of actualFunc
// against expectedFunc. It returns an error unless everything matches.
func InputAndOutputSig(actualFunc, expectedFunc reflect.Type) error {
if err := InputSig(actualFunc, expectedFunc); err... | gomock/internal/validate/validate.go | 0.74055 | 0.595375 | validate.go | starcoder |
package model
import "encoding/json"
// Series represents time series.
type Series struct {
name string
values []float64
start int64 // timestamp of start.
step int // the interval seconds of values.
alias string
}
// NewSeries returns the Series object.
func NewSeries(name string, values []float64, sta... | pkg/model/series.go | 0.818845 | 0.40072 | series.go | starcoder |
package effect
import (
"github.com/df-mc/dragonfly/dragonfly/entity"
"image/color"
"time"
)
// instantEffect forms the base of an instant effect.
type instantEffect struct {
// Lvl holds the level of the effect. A higher level results in a more powerful effect, whereas a negative
// level will generally inverse... | dragonfly/entity/effect/effect.go | 0.855021 | 0.594286 | effect.go | starcoder |
package ql
import (
"bytes"
"fmt"
"regexp"
"strconv"
"strings"
)
// DataType represents the primitive data types available in samql.
type DataType int
const (
// Float means the data type is a float.
Float DataType = 0
// Integer means the data type is an integer.
Integer DataType = 1
// Unsigned means the... | ql/ast.go | 0.738763 | 0.50653 | ast.go | starcoder |
package units
var (
Pressure = UnitOptionQuantity("pressure")
// SI unit metric
Pascal = NewUnit("pascal", "Pa", Pressure, SI)
ExaPascal = Exa(Pascal, FactorLinear)
PetaPascal = Peta(Pascal, FactorLinear)
TeraPascal = Tera(Pascal, FactorLinear)
GigaPascal = Giga(Pascal, FactorLinear)
MegaPascal = M... | pressure_units.go | 0.627951 | 0.581957 | pressure_units.go | starcoder |
package jettison
import (
"encoding"
"encoding/json"
"reflect"
"sync"
"time"
"unsafe"
)
var (
timeTimeType = reflect.TypeOf(time.Time{})
timeDurationType = reflect.TypeOf(time.Duration(0))
syncMapType = reflect.TypeOf((*sync.Map)(nil)).Elem()
jsonNumberType = reflect.TypeO... | types.go | 0.54819 | 0.44354 | types.go | starcoder |
package quotas
import (
"encoding/json"
)
// Quota represents a quota information for a single billing resource.
type Quota struct {
// Name is a resource human-readable name.
Name string `json:"-"`
// ResourceQuotasEntities contains information about quotas of a single billing resource in different locations.
... | selvpcclient/resell/v2/quotas/schemas.go | 0.716615 | 0.448668 | schemas.go | starcoder |
package sweetiebot
import (
"math/rand"
"strconv"
"strings"
"github.com/bwmarrin/discordgo"
)
type QuoteCommand struct {
}
func (c *QuoteCommand) Name() string {
return "Quote"
}
func (c *QuoteCommand) Process(args []string, msg *discordgo.Message, info *GuildInfo) (string, bool) {
if len(args) < 1 {
l := 0... | sweetiebot/quote_command.go | 0.582491 | 0.639061 | quote_command.go | starcoder |
package list
// Iter iterates over the values, applying action to each value.
func Iter[T any](action func(T), values []T) {
for i := range values {
action(values[i])
}
}
// IterRev iterates over the values in reverse, applying action to each value.
func IterRev[T any](action func(T), values []T) {
DoRangeToRev(... | list/iter.go | 0.827828 | 0.888081 | iter.go | starcoder |
package alphafoxtrot
import (
"math"
"strconv"
"strings"
)
const (
AirportTypeUnknown uint64 = 0x00
AirportTypeClosed uint64 = 0x01
AirportTypeHeliport uint64 = 0x02
AirportTypeSeaplaneBase uint64 = 0x04
AirportTypeSmall uint64 = 0x08
AirportTypeMedium uint64 = 0x10
AirportTypeLa... | def.go | 0.708414 | 0.484258 | def.go | starcoder |
package clustering
import (
"time"
)
// ClusterResults represents the results of clustering a list of
// test failures.
type ClusterResults struct {
// AlgorithmsVersion is the version of clustering algorithms used to
// cluster test results in this chunk. (This is a version over the
// set of algorithms, distin... | go/src/infra/appengine/weetbix/internal/clustering/clusterresults.go | 0.742141 | 0.507385 | clusterresults.go | starcoder |
package rtc
import "math"
// Cube creates a cube at the origin ranging from -1 to 1 on each axis.
// It implements the Object interface.
func Cube() *CubeT {
return &CubeT{Shape{Transform: M4Identity(), Material: GetMaterial()}}
}
// CubeT represents a Cube.
type CubeT struct {
Shape
}
var _ Object = &CubeT{}
//... | rtc/cube.go | 0.899012 | 0.593167 | cube.go | starcoder |
package glmatrix
import (
"fmt"
"math"
)
// Quat2Create creates a new identity dual quat
func Quat2Create() []float64 {
return []float64{
0, 0, 0, 1,
0, 0, 0, 0,
}
}
// Quat2Clone creates a new quat initialized with values from an existing quaternion
func Quat2Clone(a []float64) []float64 {
return []float64... | quat2.go | 0.63114 | 0.598723 | quat2.go | starcoder |
package jaxfilter
func square(x float64) float64 {
return x * x
}
// A TranslationHighPassFilter is a high pass filter for translation.
type TranslationHighPassFilter struct {
SamplingTime uint
CutoffFrequency float64
inputs [3]float64
outputs [3]float64
}
// Filter passes the high frequenc... | jaxfilter/jaxfilter.go | 0.87879 | 0.578746 | jaxfilter.go | starcoder |
package assert
import (
"fmt"
"reflect"
"regexp"
"runtime"
"testing"
)
type Assertor interface {
Assert() error
}
type Equal struct {
Expect interface{}
Actual interface{}
}
func (r *Equal) Assert() error {
if !reflect.DeepEqual(r.Expect, r.Actual) {
return fmt.Errorf("Expect:%v, Actual:%v", r.Expect, r.... | assert.go | 0.522202 | 0.415492 | assert.go | starcoder |
package simple
import (
"k8s.io/kubernetes/third_party/forked/gonum/graph"
)
// DirectedAcyclicGraph implements graph.Directed using UndirectedGraph,
// which only stores one edge for any node pair.
type DirectedAcyclicGraph struct {
*UndirectedGraph
}
func NewDirectedAcyclicGraph(self, absent float64) *DirectedAc... | kubernetes-model/vendor/k8s.io/kubernetes/third_party/forked/gonum/graph/simple/directed_acyclic.go | 0.63023 | 0.484685 | directed_acyclic.go | starcoder |
package engine
import (
"bytes"
"fmt"
)
var (
// ErrInstantiation is an instantiation error exception.
ErrInstantiation = &Exception{
Term: &Compound{
Functor: "error",
Args: []Term{
Atom("instantiation_error"),
Atom("Arguments are not sufficiently instantiated."),
},
},
}
// ErrZeroDiviso... | engine/exception.go | 0.677261 | 0.438124 | exception.go | starcoder |
package vec
import (
"bytes"
"fmt"
sof "github.com/ninedraft/partridge/stringOrFloat"
)
type Frame struct {
strings []string
vector Vector
indexes []int
}
func FrameFromValues(values ...interface{}) Frame {
var frame = Frame{}
for _, value := range values {
var index int
switch value := value.(type) {
... | vec/frame.go | 0.546496 | 0.460471 | frame.go | starcoder |
package function
import (
"encoding/binary"
"fmt"
"math"
"strings"
"github.com/dolthub/go-mysql-server/sql"
"github.com/dolthub/go-mysql-server/sql/expression"
)
// AsWKB is a function that converts a spatial type into WKB format (alias for AsBinary)
type AsWKB struct {
expression.UnaryExpression
}
var _ sq... | sql/expression/function/wkb.go | 0.715821 | 0.468851 | wkb.go | starcoder |
package structmatcher
/*
* This file contains test structs and functions used in unit tests via dependency injection.
*/
import (
"fmt"
"reflect"
"strings"
. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"
"github.com/onsi/gomega/types"
)
/*
* If fields are to be filtered in or out, set shouldFilter to... | structmatcher/structmatcher.go | 0.633637 | 0.438485 | structmatcher.go | starcoder |
package runtime
import (
"encoding/base64"
"log"
"math"
"runtime"
"runtime/debug"
"strings"
"github.com/apmckinlay/gsuneido/util/dnum"
"github.com/apmckinlay/gsuneido/util/hacks"
"github.com/apmckinlay/gsuneido/util/regex"
)
var (
Zero Value = SuInt(0)
One Value = SuInt(1)
MinusOne Value = SuIn... | runtime/ops.go | 0.515376 | 0.485051 | ops.go | starcoder |
package pddl
import (
"io"
"log"
)
// Parse returns either a Domain, a Problem or a parse error.
func Parse(file string, r io.Reader) (ast interface{}, err error) {
defer func() {
r := recover()
if r == nil {
return
}
if e, ok := r.(Error); ok {
err = e
} else {
panic(r)
}
}()
p, err := new... | pddl/grammar.go | 0.510985 | 0.531817 | grammar.go | starcoder |
package gcs
import "math"
type (
// Sphere is a geometry represented as the set of points
// that are all at the same distance R from a given point,
// called center or origin.
Sphere struct {
R float64 // radius in meters
}
// SPoint is a point in the surface of the Sphere, ie, its
// distance from the ori... | gcs/sphere.go | 0.864496 | 0.784773 | sphere.go | starcoder |
package model
// SingleAxis is the option set for single axis.
// https://echarts.apache.org/en/option.html#singleAxis
type SingleAxis struct {
// The minimum value of axis.
// It can be set to a special value 'dataMin' so that the minimum value on this axis is set to be the minimum label.
// It will be automatica... | model/single_axis.go | 0.869035 | 0.434161 | single_axis.go | starcoder |
package paunch
import (
gl "github.com/chsc/gogl/gl21"
)
// Shape is an object that represents a vector shape, such as a triangle or
// other polygon, that can be drawn on screen.
type Shape struct {
mode gl.Enum
size int
vertexBuffer gl.Uint
verticies []float32
scaleX float64
scaleY ... | shape.go | 0.776962 | 0.6753 | shape.go | starcoder |
package tablehelpers
import (
"log"
"strconv"
"strings"
"time"
)
// Gives the suffix for the weekly tables that will be used during the successive week
func weeklyTableSuffix() string {
nextWeek := time.Now().UTC().AddDate(0, 0, 7)
return nextWeek.AddDate(0, 0, (1 - int(nextWeek.Weekday()))).Format("2006_01_02"... | tablehelpers/table-helper-methods.go | 0.657758 | 0.430147 | table-helper-methods.go | starcoder |
package hashmap
import (
"bytes"
"fmt"
"reflect"
"sync"
"sync/atomic"
"unsafe"
)
// MaxFillRate is the maximum fill rate for the slice before a resize will happen.
const MaxFillRate = 50
type (
hashMapData struct {
keyRightShifts uint64 // 64 - log2 of array size, to be used as index in the data ar... | vendor/github.com/cornelk/hashmap/hashmap.go | 0.738669 | 0.420302 | hashmap.go | starcoder |
package car_generic
import (
m "github.com/niclabs/intersection-simulator/vehicle"
"math"
)
func GetTurnAngle() float64 {
return FourwayTurnAngle
}
func GetTurnRadius(intention int, dangerZoneLength float64) float64 {
var radius float64
if intention == LeftIntention {
radius = dangerZoneLength * (3.0 / 4.0)
... | vehicle/car_generic/intersection_utils.go | 0.757256 | 0.588475 | intersection_utils.go | starcoder |
package template
/**
This package uses an adapted pattern from the Template design pattern.
The idea is that we have a set of steps we need to perform but the implementation of those steps may be handled by
specific templates how they see fit. E.g. The receipt pdf template may have the logo on the right side whereas ... | template/template.go | 0.643329 | 0.499878 | template.go | starcoder |
package commands
import (
"bytes"
"fmt"
"math"
"os"
"github.com/go-gl/mathgl/mgl32"
"github.com/gookit/color"
"github.com/roboticeyes/gorexfile/encoding/rexfile"
"github.com/urfave/cli/v2"
)
// DensityCommand reduces density of pointLists
var DensityCommand = &cli.Command{
Name: "density",
Usage: "Reduc... | cmd/rxi/commands/density.go | 0.598312 | 0.413122 | density.go | starcoder |
package virustotal
import (
"context"
virustotal "github.com/VirusTotal/vt-go"
"github.com/turbot/steampipe-plugin-sdk/grpc/proto"
"github.com/turbot/steampipe-plugin-sdk/plugin"
"github.com/turbot/steampipe-plugin-sdk/plugin/transform"
)
func tableVirusTotalIP(ctx context.Context) *plugin.Table {
return &plu... | virustotal/table_virustotal_ip.go | 0.57344 | 0.437944 | table_virustotal_ip.go | starcoder |
package binarytree
import (
"fmt"
"reflect"
"github.com/Thrimbda/dune/utils"
)
type BSTimpl struct {
root BinNode
}
func (b BSTimpl) Insert(value interface{}) {
var father BinNode
brother := b.root
node := &BinNodePtr{value, nil, nil, nil}
for brother != nil {
father = brother
if utils.LessComparator(no... | binarytree/binary_search_tree.go | 0.568176 | 0.429669 | binary_search_tree.go | starcoder |
package speaker
// 5. Path Attributes
// This section discusses the path attributes of the UPDATE message.
// Path attributes fall into four separate categories:
// 1. Well-known mandatory.
// 2. Well-known discretionary.
// 3. Optional transitive.
// 4. Optional non-trans... | old/speaker/speaker.go | 0.620392 | 0.533944 | speaker.go | starcoder |
package components
import (
"math"
"github.com/factorion/graytracer/pkg/primitives"
"github.com/factorion/graytracer/pkg/shapes"
)
// Computations Set of pre-computed values used for point detection
type Computations struct {
shapes.Intersection
Point, OverPoint, UnderPoint, EyeVector, NormalVector, ReflectVecto... | pkg/components/computations.go | 0.746139 | 0.593609 | computations.go | starcoder |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.