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 server
type L2MeasCellUeInfo struct {
AssociateId *AssociateId `json:"associateId,omitempty"`
// It indicates the data volume of the downlink GBR traffic of a UE, as defined in ETSI TS 136 314 [i.11].
DlGbrDataVolumeUe int32 `json:"dl_gbr_data_volume_ue,omitempty"`
// It indicates the packet delay of the d... | go-apps/meep-rnis/server/model_l2_meas_cell_ue_info.go | 0.537041 | 0.486454 | model_l2_meas_cell_ue_info.go | starcoder |
package main
import (
"fmt"
"reflect"
"strings"
)
type TypeClass func(a reflect.Kind) bool
func isParameterized(a reflect.Kind) bool {
for _, v := range parameterizedKinds {
if v == a {
return true
}
}
return false
}
func isNotParameterized(a reflect.Kind) bool { return !isParameterized(a) }
func isRa... | genlib2/genlib.go | 0.723114 | 0.444987 | genlib.go | starcoder |
package lisp
import (
"errors"
"fmt"
)
type Environment struct {
Parent *Environment
values map[IdentifierNode]Node
}
func NewEnvironment(parent *Environment) Environment {
return Environment{parent, make(map[IdentifierNode]Node)}
}
func (env *Environment) Get(id IdentifierNode) Node {
node, ok := env.values[... | lisp/evaluate.go | 0.522446 | 0.4575 | evaluate.go | starcoder |
package rulebasedconv
/*
Note:
Many re-implementation of Avro Classic Phonetic saw the JavaScript implementation
(https://github.com/torifat/jsAvroPhonetic/blob/master/src/avro-lib.js) and thought it might be a better idea to extract
the rules in a separate JSON file to make Avro Phonetic more configurable by the user... | rulebasedconv/rules_source.go | 0.61451 | 0.475118 | rules_source.go | starcoder |
package vec2
import (
"fmt"
"math"
)
// Rect is a coordinate system aligned rectangle defined by a Min and Max vector.
type Rect struct {
Min T
Max T
}
// ParseRect parses a Rect from a string. See also String()
func ParseRect(s string) (r Rect, err error) {
_, err = fmt.Sscan(s, &r.Min[0], &r.Min[1], &r.Max[0]... | vec2/rect.go | 0.923953 | 0.569254 | rect.go | starcoder |
package chunk
import (
"sort"
"github.com/pingcap/tidb/parser/mysql"
"github.com/pingcap/tidb/types"
)
// CompareFunc is a function to compare the two values in Row, the two columns must have the same type.
type CompareFunc = func(l Row, lCol int, r Row, rCol int) int
// GetCompareFunc gets a compare function f... | util/chunk/compare.go | 0.584153 | 0.42483 | compare.go | starcoder |
package main
import "fmt"
// Pos is a convenience struct for coordinate pairs
type Pos struct {
X, Y int
}
// NewPos is the constructor. It range-checks the coordinates to guarantee
// they fall within the board
func NewPos(x, y int) (*Pos, error) {
if x >= 0 && x <= 7 && y >= 0 && y <= 7 {
return &Pos{x, y}, ni... | pos.go | 0.824179 | 0.657078 | pos.go | starcoder |
package geopos
import (
"fmt"
"math"
"math/rand"
"sync"
)
// ========== addition methods
// random string {{{
var letterRunes = []rune("abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ")
func rndStr(n int) string {
rndStr := make([]rune, n)
for i := range rndStr {
rndStr[i] = letterRunes[rand.Intn(len(l... | back/geopos/model.go | 0.687315 | 0.444505 | model.go | starcoder |
package main
// A simple example that shows how to send activity to Bubble Tea in real-time
// through a channel.
import (
"fmt"
"math/rand"
"os"
"time"
"github.com/charmbracelet/bubbles/spinner"
tea "github.com/charmbracelet/bubbletea"
)
// A message used to indicate that activity has occurred. In the real w... | examples/realtime/main.go | 0.624408 | 0.406862 | main.go | starcoder |
package panel
import log "github.com/sirupsen/logrus"
// SetBrightness is a helper function that allows updating a StateSettings
// object with shorthand eg "settings.SetBrightness(20)"
func (settings *StateSettings) SetBrightness(brightness Brightness) {
brightnessSetting := brightnessSetting{Value: brightness}
se... | settings.go | 0.814643 | 0.490114 | settings.go | starcoder |
package math
import (
"golang.org/x/exp/constraints"
)
// Gcd returns the greatest common divisor of a and b.
func Gcd[T constraints.Integer](a, b T) T {
for b != 0 {
a, b = b, a%b
}
return a
}
// Lcm returns the least common multiple of a and b.
func Lcm[T constraints.Integer](a, b T) T {
g := Gcd(a, b)
ret... | math/prime.go | 0.72952 | 0.484014 | prime.go | starcoder |
package hashing
import (
"encoding/binary"
"fmt"
"math"
"reflect"
"sort"
)
/**
* Has value to byte array conversion functions.
* @author rnojiri
**/
// float64ToByteArray - converts a float64 to byte array
func float64ToByteArray(f float64) []byte {
var buffer = make([]byte, 8)
binary.BigEndian.PutUint64(bu... | byteconv.go | 0.778691 | 0.500793 | byteconv.go | starcoder |
package line
import (
"math"
"github.com/gravestench/pho/geom"
"github.com/gravestench/pho/geom/point"
)
// New creates a new line
func New(x1, y1, x2, y2 float64) *Line {
return &Line{
Type: geom.Line,
X1: x1,
Y1: y1,
X2: x2,
Y2: y2,
}
}
// Line defines a Line segment, a part of a line betwe... | geom/line/line.go | 0.916288 | 0.593491 | line.go | starcoder |
package exchangestream
import (
"context"
"errors"
"math"
"math/rand"
"time"
)
// PolicyExponential defines an executer for the exponential retry policy.
type PolicyExponential struct {
// Retries specifies the number of retries allowed.
// -1 means infinite number of retries
// 0 means to never retry
// Any... | pkg/exchangestream/retry.go | 0.795698 | 0.446917 | retry.go | starcoder |
package common
import (
"fmt"
"github.com/go-vgo/robotgo"
"strconv"
"strings"
)
//{0, 0}, {1535, 0}, {1920, 0}, {3839, 0},
//{0, 863}, {1535, 863}, {1920, 1079}, {3839, 1079},
// record pos, left and right all use 1.25 rate
// so if use in left x,y = x * LeftRate / RecordRate, y * LeftRate / RecordRate,
// so if... | common/posHelper.go | 0.533884 | 0.44734 | posHelper.go | starcoder |
package exec
import (
"encoding/binary"
"fmt"
"math"
)
var ErrLimitExceeded = fmt.Errorf("memory limit exceeded")
// Memory is a WASM linear memory.
type Memory struct {
min, max uint32
bytes []byte
}
// NewMemory creates a new linear memory with the given limits.
func NewMemory(min, max uint32) Memory {
... | exec/memory.go | 0.907993 | 0.520923 | memory.go | starcoder |
package onshape
import (
"encoding/json"
)
// BTFSTableColumnInfo623 struct for BTFSTableColumnInfo623
type BTFSTableColumnInfo623 struct {
BTTableColumnInfo1222
BtType *string `json:"btType,omitempty"`
CrossHighlightData *BTTableBaseCrossHighlightData2609 `json:"crossHighlightData,omitempty"`
}
// NewBTFSTableC... | onshape/model_btfs_table_column_info_623.go | 0.717606 | 0.479565 | model_btfs_table_column_info_623.go | starcoder |
package operators
import (
bs "github.com/sharnoff/badstudent"
"math"
)
// ****************************************
// ReLU
// ****************************************
type relu int8
// ReLU returns the standard rectified linear unit, which implements
// badstudent.Operator.
func ReLU() relu {
return relu(0)
}
... | operators/relus.go | 0.769254 | 0.4206 | relus.go | starcoder |
package types
import (
fmt "fmt"
fssz "github.com/ferranbt/fastssz"
)
var _ fssz.HashRoot = (Slot)(0)
var _ fssz.Marshaler = (*Slot)(nil)
var _ fssz.Unmarshaler = (*Slot)(nil)
// Slot represents a single slot.
type Slot uint64
// Mul multiplies slot by x.
func (s Slot) Mul(x uint64) Slot {
return Slot(uint64(s)... | slot.go | 0.835181 | 0.437163 | slot.go | starcoder |
// Package acd implements the double ratchet protocol specified by
// <NAME>, <NAME> and <NAME> in their paper
// The Double Ratchet: Security Notions, Proofs, and
// Modularization for the Signal Protocol (https://eprint.iacr.org/2018/1037.pdf).
// The scheme relies on novel cryptographic primitives like a forward-s... | acd/double-ratchet.go | 0.727298 | 0.471467 | double-ratchet.go | starcoder |
package connect4
/*
* How a connect4 - bitmap works
* https:github.com/denkspuren/BitboardC4/blob/master/BitboardDesign.md
*/
const BOTTOM uint64 = 0b_0000001_0000001_0000001_0000001_0000001_0000001_0000001
const THIRD uint64 = 0b_1111111_0000000_0000000
const SECOND uint64 = 0b_0000000_1111111_0000000
const FIRST... | core/modules/connect4/bitmapboard.go | 0.827201 | 0.422624 | bitmapboard.go | starcoder |
package mercantile
import (
"math"
)
type Bbox struct {
Left float64
Bottom float64
Right float64
Top float64
}
type LngLatBbox struct {
West float64
South float64
East float64
North float64
}
type Tile struct {
X int
Y int
Z int
}
type LngLat struct {
Lng float64
Lat float64
}
type XY struc... | mercantile.go | 0.750736 | 0.44077 | mercantile.go | starcoder |
package house
// Song generates the full text of "The House That Jack Built".
func Song() (song string) {
phrases := []struct {
object, predicate string
}{
{"the house that Jack built", "lay in"},
{"the malt", "ate"},
{"the rat", "killed"},
{"the cat", "worried"},
{"the dog", "tossed"},
{"the cow with ... | solutions/go/house/house.go | 0.545286 | 0.420124 | house.go | starcoder |
package enmime
import (
"container/list"
)
// PartMatcher is a function type that you must implement to search for Parts using the
// BreadthMatch* functions. Implementators should inspect the provided Part and return true if it
// matches your criteria.
type PartMatcher func(part *Part) bool
// BreadthMatchFirst ... | match.go | 0.694406 | 0.465813 | match.go | starcoder |
package example
import (
"encoding/json"
"fmt"
"io"
"os"
"sort"
"strings"
"github.com/kiteco/kiteco/kite-go/lang/python/pythoncomplete/offline/legacy"
"github.com/kiteco/kiteco/kite-golib/fileutil"
)
// Example describes a situation we want to provide completions in, defined as a buffer/cursor position, alon... | kite-go/lang/python/pythoncomplete/offline/example/example.go | 0.692954 | 0.407392 | example.go | starcoder |
package metadata
import (
"encoding/json"
"fmt"
)
type RpcBlock struct {
Author string `"&json:author&"`
Difficulty string `"&json:difficulty&"`
ExtraData string `"&json:extraData&"`
GasLimit string `"&json:gasLimit&"`
GasUsed stri... | metadata/etherBlock.go | 0.510985 | 0.471102 | etherBlock.go | starcoder |
package core
// BuildSpec defines how the software is to be built
type BuildSpec struct {
}
// PackageSpec defines how the software is to be packaged
type PackageSpec struct {
}
// DeploymentSpec defines how software is to be deployed
type DeploymentSpec struct {
}
// Metadata is a map of key value pairs the can be... | core/messages.go | 0.604632 | 0.489137 | messages.go | starcoder |
package bingo
import (
"encoding/base64"
"errors"
)
// Board represents a 5*5 square bingo board.
// The middle square (index 12) is left empty (0).
type Board [25]Number
// NewBoard creates a board by drawing numbers from a game.
// Each column of the board (5-cell group) only contains numbers of the same column.... | bingo/board.go | 0.741674 | 0.474022 | board.go | starcoder |
package gg
import (
"image"
"image/color"
"golang.org/x/image/font"
"gopkg.in/fogleman/gg.v1"
)
type Canvas struct {
ctx *gg.Context
}
func NewCanvas(width, height int) *Canvas {
return &Canvas{ctx: gg.NewContext(width, height)}
}
func (C *Canvas) Image() image.Image {
return C.ctx.Image()
}
func (C *Canva... | canvas/gg/canvas.go | 0.814828 | 0.449695 | canvas.go | starcoder |
package main
import (
"fmt"
"math"
"math/rand"
"github.com/ByteArena/box2d"
)
// Short names
var kinematic uint8 = box2d.B2BodyType.B2_kinematicBody
var dynamic uint8 = box2d.B2BodyType.B2_dynamicBody
var static uint8 = box2d.B2BodyType.B2_staticBody
// func initBox2D() *box2d.B2World {
// // Box2D is tuned fo... | cmd/Basics2/02-MazeBall/setupMaze.go | 0.608012 | 0.629888 | setupMaze.go | starcoder |
package utfc
// All characters below this code point are considered Latin, so within this range the state of `offs` stays equal to 0
const maxLatinCp = 0x02FF
// All characters starting from this code encoded in long (21-bit) mode
const min21BitCp = 0x2800
// Offs always includes top 6 bits of the codepoint (it iden... | go/utfc.go | 0.667256 | 0.483161 | utfc.go | starcoder |
package utils
import "strconv"
type NestedInteger struct {
Num int
Ns []*NestedInteger
}
// Return true if this NestedInteger holds a single integer, rather than a nested list.
func (n NestedInteger) IsInteger() bool {
return n.Ns == nil
}
// Return the single integer that this NestedInteger holds, if it holds... | golang/utils/nested_integer.go | 0.6973 | 0.444565 | nested_integer.go | starcoder |
package ds
import (
"fmt"
"math"
)
type Comparer func(interface{}, interface{}) int
type treeNode struct {
data interface{}
left *treeNode
right *treeNode
}
func insert(root *treeNode, data interface{}, compare Comparer) *treeNode {
if root == nil {
return &treeNode{data: data}
}
if compare(data, root.... | ds/binarytree.go | 0.588416 | 0.468487 | binarytree.go | starcoder |
package cmd
import (
"fmt"
"os"
"strconv"
"strings"
"github.com/jaredbancroft/aoc2020/pkg/assembly"
"github.com/jaredbancroft/aoc2020/pkg/helpers"
"github.com/spf13/cobra"
)
// day8Cmd represents the day8 command
var day8Cmd = &cobra.Command{
Use: "day8",
Short: "Advent of Code 2020 - Day 8: Handheld Halt... | cmd/day8.go | 0.63409 | 0.514339 | day8.go | starcoder |
package writer
import (
"github.com/theMPatel/streamvbyte-simdgo/pkg/encode"
"github.com/theMPatel/streamvbyte-simdgo/pkg/shared"
)
const (
jump = 16
jumpCtrl = jump / 4
)
// WriteAll will encode all the integers from in using the Stream VByte
// format and will return the byte array holding the encoded data... | pkg/stream/writer/writer.go | 0.551332 | 0.568715 | writer.go | starcoder |
package twobucket
import "errors"
type bucket struct {
level int
size int
name string
}
type waterPour struct {
a *bucket
b *bucket
goal *int
goalBucket *string
otherBucketLevel *int
steps *int
}
// Solve given:
// - the size of bucket one
// - t... | go/two-bucket/two_bucket.go | 0.636805 | 0.444444 | two_bucket.go | starcoder |
package cmd
import (
"fmt"
"log"
"os"
"time"
"github.com/kristinjeanna/third-monday/spec"
"github.com/kristinjeanna/third-monday/util"
"github.com/relvacode/iso8601"
"github.com/spf13/cobra"
)
// checkCmd represents the check command
var checkCmd = &cobra.Command{
Use: "check [flags] specification",
Shor... | cmd/check.go | 0.600305 | 0.438424 | check.go | starcoder |
package ordered
import (
"fmt"
"github.com/m4gshm/gollections/c"
"github.com/m4gshm/gollections/it/impl/it"
"github.com/m4gshm/gollections/op"
"github.com/m4gshm/gollections/slice"
)
//ToSet converts an elements slice to the set containing them.
func ToSet[T comparable](elements []T) *Set[T] {
var (
l ... | mutable/ordered/set.go | 0.736874 | 0.491883 | set.go | starcoder |
package labelarray
import (
"fmt"
"github.com/janelia-flyem/dvid/datastore"
"github.com/janelia-flyem/dvid/datatype/common/downres"
"github.com/janelia-flyem/dvid/datatype/common/labels"
"github.com/janelia-flyem/dvid/dvid"
)
// For any lores block, divide it into octants and see if we have mutated the correspo... | datatype/labelarray/downres.go | 0.541894 | 0.413122 | downres.go | starcoder |
package onthefly
// Various JavaScript and JQuery functions
// fn returns JavaScript code wrapped in an anonymous function
func fn(source string) string {
return "function() { " + source + " }"
}
// quote quotes the given string in a simple way, by wrapping it in double quotes
func quote(src string) string {
retur... | vendor/github.com/xyproto/onthefly/jquery.go | 0.808597 | 0.549338 | jquery.go | starcoder |
package gaia
import (
"fmt"
"time"
"github.com/globalsign/mgo/bson"
"github.com/mitchellh/copystructure"
"go.aporeto.io/elemental"
)
// GraphNodeTypeValue represents the possible values for attribute "type".
type GraphNodeTypeValue string
const (
// GraphNodeTypeAPIGateway represents the value APIGateway.
G... | graphnode.go | 0.776962 | 0.487734 | graphnode.go | starcoder |
package filters
import (
"github.com/gpayer/go-audio-service/snd"
"math"
)
type BiquadState struct {
b0, b1, b2 float32
a1, a2 float32
xn1, xn2 snd.Sample
yn1, yn2 snd.Sample
}
func (state *BiquadState) Process(input, output []snd.Sample) {
if len(input) != len(output) {
panic("input and output must... | filters/biquad.go | 0.541894 | 0.494263 | biquad.go | starcoder |
package field
import (
"fmt"
"time"
"go.uber.org/zap"
)
type Field = zap.Field
func Binary(key string, value []byte) zap.Field {
return zap.Binary(key, value)
}
func Bool(key string, value bool) zap.Field {
return zap.Bool(key, value)
}
func ByteString(key string, value []byte) zap.Field {
return zap.ByteSt... | log/field/field.go | 0.807195 | 0.46478 | field.go | starcoder |
package sequtil
import (
"fmt"
)
const (
// AminoAcids holds the single-letter amino acid symbols.
// These are the valid inputs to AminoName.
AminoAcids = "ABCDEFGHIKLMNPQRSTVWXYZ*"
)
// Translate translates the nucleotides in src to amino acids, appends the result to
// dst and returns the new slice. Nucleoti... | sequtil/amino.go | 0.645679 | 0.437583 | amino.go | starcoder |
package astar
import (
"math/rand"
"github.com/hajimehoshi/ebiten/v2"
)
// Board represents the game board.
type Board struct {
width int
height int
tiles []*Tile
graph *AStarGraph
initialized bool
}
// NewBoard generates a new Board with giving a size.
func NewBoard(height, width int)... | board.go | 0.820182 | 0.488466 | board.go | starcoder |
package nthash
import (
"fmt"
"math"
"sync"
)
const (
// maxK is the maximum k-mer size permitted
maxK uint = math.MaxUint32
// bufferSize is the size of te buffer used by the channel in the Hash method
bufferSize uint = 128
// offset is used as a mask to retrieve a base's complement in the seed table
offs... | ntHash.go | 0.517815 | 0.420719 | ntHash.go | starcoder |
package qdb
/*
#include <qdb/ts.h>
*/
import "C"
import (
"math"
"time"
"unsafe"
)
// TsDoublePoint : timestamped double data point
type TsDoublePoint struct {
timestamp time.Time
content float64
}
// Timestamp : return data point timestamp
func (t TsDoublePoint) Timestamp() time.Time {
return t.timestamp
}... | entry_timeseries_double.go | 0.709221 | 0.459743 | entry_timeseries_double.go | starcoder |
package tegola
import (
"encoding/json"
"fmt"
"io"
)
// Geometry describes a geometry.
type Geometry interface{}
// Point is how a point should look like.
type Point interface {
Geometry
X() float64
Y() float64
}
// Point3 is a point with three dimensions; at current is just converted and treated as a point.
... | geometry.go | 0.740737 | 0.437163 | geometry.go | starcoder |
package graph
import (
"fmt"
"github.com/DmitryBogomolov/algorithms/graph/internal/utils"
)
// ConnectedComponents is a collection of connected components in a graph.
// Connected component is a set of vertices connected by edges.
type ConnectedComponents struct {
count int
componentIDs []int
}
// Count ... | graph/graph/connected_components.go | 0.774583 | 0.445107 | connected_components.go | starcoder |
package bitslice
import (
"sort"
)
type BitSlice []int
func (nums *BitSlice) tidyRange(l, r int) (int, int) {
if l < 0 {
l = 0
}
if r < 0 {
n := len(*nums)
r = (n + r % n) % n
}
return l, r
}
// ConvertToBitSlice creates a BitSlice from a normal slice.
// Note that the bitSlice shares memory with the... | bitslice/bitslice.go | 0.681409 | 0.479808 | bitslice.go | starcoder |
package version
func license_cc0_v1() string {
return `
CC0 1.0 Universal
Statement of Purpose
The laws of most jurisdictions throughout the world automatically confer
exclusive Copyright and Related Rights (defined below) upon the creator and
subsequent owner(s) (each and all, an "owner") of an original work of
au... | version/license_cc0-v1.go | 0.613005 | 0.632559 | license_cc0-v1.go | starcoder |
package diff
// PatienceDiffer generates diffs using the Patience Diff algorithm. This:
// 1. Removes matching lines from the start and end of a file
// 2. Computes the LCS for lines that occur uniquely in both sequences
// 3. Do step 1 for the sections in between.
// It's described in http://bramcohen.livejournal.com... | patience.go | 0.521959 | 0.540075 | patience.go | starcoder |
package noise
type ImplicitFractalNormalized struct {
source ImplicitBase
/*
Octaves is the number of iterations, or the depth of the fractal. The more octaves, the better quality, but performance suffers. Keep this number as small as you can.
Frequency determines the wavelength of your noise. A low frequency m... | server/game/universe/generator/texture/noise/implicit-fractal-normalized.go | 0.8474 | 0.767254 | implicit-fractal-normalized.go | starcoder |
package interpret
import (
"strconv"
"github.com/cdkini/Okra/src/interpreter/ast"
"github.com/cdkini/Okra/src/okraerr"
)
// interpretExpr is a helper function used to interpret Expr attributes of Stmt instances and evaluating them
// into returnable values. The method determines which interpret method to use at r... | src/interpreter/interpret/interpreter_expr.go | 0.527317 | 0.612165 | interpreter_expr.go | starcoder |
package dot
import (
"fmt"
"github.com/gonum/graph"
"github.com/gonum/graph/formats/dot"
"github.com/gonum/graph/formats/dot/ast"
"golang.org/x/tools/container/intsets"
)
// Builder is a graph that can have user-defined nodes and edges added.
type Builder interface {
graph.Graph
graph.Builder
// NewNode add... | vendor/github.com/gonum/graph/encoding/dot/decode.go | 0.702836 | 0.40987 | decode.go | starcoder |
package quadedge
import (
"errors"
"fmt"
"log"
"github.com/go-spatial/geom"
"github.com/go-spatial/geom/planar"
)
var ErrLocateFailure = errors.New("failure locating edge")
/*
QuadEdgeSubdivision is a class that contains the QuadEdges representing a
planar subdivision that models a triangulation. The subdivisi... | planar/triangulate/quadedge/quadedgesubdivision.go | 0.667148 | 0.547101 | quadedgesubdivision.go | starcoder |
package guia2_ext_opencv
func (dExt *DriverExt) Swipe(pathname string, toX, toY int) (err error) {
return dExt.SwipeFloat(pathname, float64(toX), float64(toY))
}
func (dExt *DriverExt) SwipeFloat(pathname string, toX, toY float64) (err error) {
return dExt.SwipeOffsetFloat(pathname, toX, toY, 0.5, 0.5)
}
func (dEx... | swipe.go | 0.78016 | 0.465387 | swipe.go | starcoder |
package table
import (
"context"
"io"
"sort"
"github.com/liquidata-inc/dolt/go/libraries/doltcore/row"
"github.com/liquidata-inc/dolt/go/libraries/doltcore/schema"
"github.com/liquidata-inc/dolt/go/store/types"
)
// InMemTable holds a simple list of rows that can be retrieved, or appended to. It is meant pri... | go/libraries/doltcore/table/inmem_table.go | 0.646349 | 0.493287 | inmem_table.go | starcoder |
package common
// GeneralReference struct contains data for the name and path of a
// compliance reference.
// This struct is a one-to-one mapping of `references` in the component.yaml schema
// https://github.com/opencontrol/schemas#component-yaml
type GeneralReference struct {
Name string `yaml:"name" json:"name"`
... | pkg/lib/common/references.go | 0.87198 | 0.48182 | references.go | starcoder |
package chaindb
import (
"context"
api "github.com/attestantio/go-eth2-client/api/v1"
"github.com/attestantio/go-eth2-client/spec/phase0"
)
// AttestationsProvider defines functions to access attestations.
type AttestationsProvider interface {
// AttestationsForBlock fetches all attestations made for the given ... | services/chaindb/service.go | 0.564459 | 0.555375 | service.go | starcoder |
package twofive
import (
"github.com/francoispqt/gojay"
)
// Banner represents the most general type of impression. Although the term “banner” may have very
// specific meaning in other contexts, here it can be many things including a simple static image, an
// expandable ad unit, or even in-banner video (refer to t... | go/request/rtb_twofive/banner.go | 0.655336 | 0.487429 | banner.go | starcoder |
package ascanvas
func TransformRectangle(canvas *Canvas, args TransformRectangleArgs) error {
var (
maxX, maxY int
grid = canvas.AsGrid()
)
if err := args.Validate(); err != nil {
return err
}
if args.Width == 0 {
maxX = args.TopLeft.X
} else {
maxX = args.TopLeft.X + args.Width - 1
}
if max... | transform.go | 0.555676 | 0.403449 | transform.go | starcoder |
package hr
import "github.com/ContextLogic/cldr"
var calendar = cldr.Calendar{
Formats: cldr.CalendarFormats{
Date: cldr.CalendarDateFormat{Full: "EEEE, d. MMMM y.", Long: "d. MMMM y.", Medium: "d. MMM y.", Short: "dd.MM.y."},
Time: cldr.CalendarDateFormat{Full: "HH:mm:ss zzzz", Long: "HH:mm:ss z", Mediu... | resources/locales/hr/calendar.go | 0.513912 | 0.421254 | calendar.go | starcoder |
package incrdelaunay
import (
"math"
"sort"
)
// Delaunay represents a Delaunay triangulation.
type Delaunay struct {
triangles []Triangle
grid CircumcircleGrid // For fast detection of circumcircles containing a point.
pointMap pointMap
freeTriangles []uint16 // A list of free indexes in the triangles slice... | triangulation/incrdelaunay/delaunay.go | 0.748812 | 0.611556 | delaunay.go | starcoder |
package scheduler
import (
"math/rand"
)
// NodeIterator iterates over a list of nodes based on the defined policy
type NodeIterator interface {
// returns true if there are more values to iterate over
HasNext() (ok bool)
// returns the next node from the iterator
Next() (node *SchedulingNode)
// reset the iter... | pkg/scheduler/node_iterator.go | 0.833562 | 0.411111 | node_iterator.go | starcoder |
package types
import (
abci "github.com/tendermint/tendermint/abci/types"
"github.com/tendermint/tendermint/crypto"
)
// status of a validator
type BondStatus byte
// nolint
const (
Unbonded BondStatus = 0x00
Unbonding BondStatus = 0x01
Bonded BondStatus = 0x02
)
//BondStatusToString for pretty prints of B... | types/stake.go | 0.512205 | 0.407451 | stake.go | starcoder |
package tree
import (
"sort"
"github.com/anchore/stereoscope/pkg/tree/node"
)
type NodeVisitor func(node.Node) error
type WalkConditions struct {
// Return true when the walker should stop traversing (before visiting current node)
ShouldTerminate func(node.Node) bool
// Whether we should visit the current nod... | pkg/tree/depth_first_walker.go | 0.762513 | 0.463991 | depth_first_walker.go | starcoder |
package ring
import (
"math/big"
"math/bits"
"unsafe"
)
// Scaler is an interface that rescales polynomial coefficients by a fraction t/Q.
type Scaler interface {
// DivByQOverTRounded returns p1 scaled by a factor t/Q and mod t on the receiver p2.
DivByQOverTRounded(p1, p2 *Poly)
}
// RNSScaler implements the ... | ring/ring_scaling.go | 0.824214 | 0.495117 | ring_scaling.go | starcoder |
package agozon
var LocaleITMap = map[string]LocaleSearchIndex{
"All": LocaleIT.All, "Apparel": LocaleIT.Apparel, "Automotive": LocaleIT.Automotive, "Baby": LocaleIT.Baby,
"Books": LocaleIT.Books, "DVD": LocaleIT.DVD, "Electronics": LocaleIT.Electronics, "ForeignBooks": LocaleIT.ForeignBooks, "Garden": LocaleIT.Garde... | LocaleIT.go | 0.544075 | 0.402686 | LocaleIT.go | starcoder |
package paramsets
import (
"go.skia.org/infra/go/paramtools"
"go.skia.org/infra/golden/go/digest_counter"
"go.skia.org/infra/golden/go/shared"
"go.skia.org/infra/golden/go/tiling"
"go.skia.org/infra/golden/go/types"
)
// ParamSummary keep precalculated paramsets for each test, digest pair.
// It is considered im... | golden/go/paramsets/paramsets.go | 0.620852 | 0.432243 | paramsets.go | starcoder |
package main
var readmeText = `
This document is an attempt to document the way that bk backs up data in
sufficient detail so that (if ever necessary), it's possible to restore a
backup from a bk repository even without the existing bk source code. We'll
proceed in bottom-up fashion from the low-level storage system... | cmd/bk/readme.go | 0.699254 | 0.682838 | readme.go | starcoder |
package owl
import (
"github.com/meowpub/meow/ld"
)
// The property that determines the class that a universal property restriction refers to.
func GetAllValuesFrom(e ld.Entity) interface{} { return e.Get(Prop_AllValuesFrom.ID) }
func SetAllValuesFrom(e ld.Entity, v interface{}) { e.Set(Prop_AllValuesFrom.ID, v) }
... | ld/ns/owl/properties.gen.go | 0.854126 | 0.465873 | properties.gen.go | starcoder |
package hbook
import "sort"
// Bin1D models a bin in a 1-dim space.
type Bin1D struct {
xrange Range
dist dist1D
}
// Rank returns the number of dimensions for this bin.
func (Bin1D) Rank() int { return 1 }
func (b *Bin1D) scaleW(f float64) {
b.dist.scaleW(f)
}
func (b *Bin1D) fill(x, w float64) {
b.dist.fi... | hbook/bin1d.go | 0.874901 | 0.669448 | bin1d.go | starcoder |
package basic
import (
"math"
"github.com/starainrt/astro/planet"
. "github.com/starainrt/astro/tools"
)
func NeptuneL(JD float64) float64 {
return planet.WherePlanet(7, 0, JD)
}
func NeptuneB(JD float64) float64 {
return planet.WherePlanet(7, 1, JD)
}
func NeptuneR(JD float64) float64 {
return planet.WherePl... | basic/neptune.go | 0.689619 | 0.466542 | neptune.go | starcoder |
package detour
import (
"encoding/binary"
"io"
"math"
)
// TileRef is a reference to a tile of the navigation mesh.
type TileRef uint32
type navMeshTileHeader struct {
TileRef TileRef
DataSize int32
}
func (s *navMeshTileHeader) Size() int {
return 8
}
func (s *navMeshTileHeader) WriteTo(w io.Writer) (int64... | detour/tile.go | 0.630685 | 0.425725 | tile.go | starcoder |
package board
import (
"errors"
"fmt"
"strconv"
"strings"
)
// columns allows easy converstion of a column name to its index. The
// opposite conversion can be done by using strconv.Atoi() instead.
var columns = map[string]int{
"A": 0, "B": 1, "C": 2, "D": 3, "E": 4,
"F": 5, "G": 6, "H": 7, "I": 8, "J": 9,
}
/... | pkg/board/square.go | 0.79854 | 0.448668 | square.go | starcoder |
package memory
import (
"github.com/google/gapid/core/data/binary"
"github.com/google/gapid/core/math/u64"
"github.com/google/gapid/core/os/device"
)
// Decoder provides methods to read primitives from a binary.Reader, respecting
// a given MemoryLayout.
// Decoder will automatically handle alignment and types si... | gapis/memory/decoder.go | 0.853654 | 0.416856 | decoder.go | starcoder |
package parquet
import (
"bytes"
"fmt"
"github.com/segmentio/parquet-go/deprecated"
"github.com/segmentio/parquet-go/encoding"
"github.com/segmentio/parquet-go/format"
)
var (
BooleanType Type = primitiveType[bool]{class: &boolClass}
Int32Type Type = primitiveType[int32]{class: &int32Class}
Int64Type ... | type_go18.go | 0.630799 | 0.439146 | type_go18.go | starcoder |
package luhn
import (
"errors"
"fmt"
"math/rand"
"strconv"
"strings"
"time"
"github.com/thiepwong/smartid/pkg/logger"
)
// Valid returns a boolean indicating if the argument was valid according to the Luhn algorithm.
func Valid(luhnString string) bool {
checksumMod := calculateChecksum(luhnString, false) % 1... | pkg/luhn/luhn.go | 0.668015 | 0.431644 | luhn.go | starcoder |
package cryptoapis
import (
"encoding/json"
)
// GetLastMinedBlockRI struct for GetLastMinedBlockRI
type GetLastMinedBlockRI struct {
// Represents the hash of the block, which is its unique identifier. It represents a cryptographic digital fingerprint made by hashing the block header twice through the SHA256 algo... | model_get_last_mined_block_ri.go | 0.835819 | 0.469034 | model_get_last_mined_block_ri.go | starcoder |
package gfx
import (
"azul3d.org/engine/lmath"
)
// TexCoord represents a 2D texture coordinate with U and V components.
type TexCoord struct {
U, V float32
}
// Mat4 represents a 32-bit floating point 4x4 matrix for compatability with
// graphics hardware.
// lmath.Mat4 should be used anywhere that an explicit 3... | gfx/types.go | 0.861407 | 0.65769 | types.go | starcoder |
package main
import (
"fmt"
"math/rand"
"strings"
"time"
"advent/lib/util"
"github.com/smartystreets/assertions/assert"
"github.com/smartystreets/assertions/should"
)
func main() {
fmt.Println(assert.So(part1(), should.Equal, 509))
fmt.Println(assert.So(part2(), should.Equal, 195))
}
const (
molecule =... | go/2015/day19/main.go | 0.510252 | 0.491029 | main.go | starcoder |
package quadtree
import (
"github.com/rob05c/sauropoda/dino"
"math/rand"
"time"
)
const elementSize = 100
type Quadtree struct {
root *Node
dinos map[int64]*dino.PositionedDinosaur
}
func (q *Quadtree) GetByID(id int64) (*dino.PositionedDinosaur, bool) {
dino, ok := q.dinos[id]
if !ok {
return nil, false
... | quadtree/quadtree.go | 0.75037 | 0.432123 | quadtree.go | starcoder |
package expr
import (
"github.com/pkg/errors"
"go/ast"
"go/token"
"math"
"strconv"
)
type EvaluatorFunc func(s *Stack) interface{}
type evaluator struct {
identifiers map[string]interface{}
stack *Stack
err error
}
func newEvaluator() *evaluator {
e := &evaluator{
identifiers: make(map[stri... | expr/eval.go | 0.500977 | 0.423518 | eval.go | starcoder |
// Package block stores information about blocks in Minecraft.
package block
import (
"math"
)
// BitsPerBlock indicates how many bits are needed to represent all possible
// block states. This value is used to determine the size of the global palette.
var BitsPerBlock = int(math.Ceil(math.Log2(float64(len(StateID)... | data/block/block.go | 0.550124 | 0.453746 | block.go | starcoder |
package aggregator
import (
"fmt"
"github.com/Nextdoor/pg-bifrost.git/stats"
"math"
)
// aggregate type which keeps a unique Stat's metadata, a running count of it's value
// and calculated statistics.
type aggregate struct {
// What we aggregate on as a unique Stat.
component string // module from which... | stats/aggregator/aggregate.go | 0.741674 | 0.4436 | aggregate.go | starcoder |
package goTernaryTree
import (
"errors"
"strings"
)
// Item represents a single object in the Node.
type Item interface{}
// Node represents a single object in the tree.
type Node struct {
c uint8
left, mid, right *Node
value Item
}
//Ternary Tree
type TernaryTree struct {
size int
... | ternaryTree.go | 0.767167 | 0.424472 | ternaryTree.go | starcoder |
package core
import (
"fmt"
"sort"
"strings"
)
type IndexElem interface {
Less(than IndexElem) bool
}
type Index interface {
Get(IndexElem) IndexElem
Put(IndexElem) bool
Remove(IndexElem) bool
}
type BTreeIndex struct {
root *bTreeNode
t uint
}
type bTreeNode struct {
elems []IndexElem
children []... | core/index.go | 0.619126 | 0.437463 | index.go | starcoder |
// Using the template, declare a set of concrete types that implement the set
// of predefined interface types. Then create values of these types and use
// them to complete a set of predefined tasks.
package main
import "fmt"
// administrator represents a person or other entity capable of administering
// hardware ... | content/docs/design/composition/exercises/exercise1/exercise1.go | 0.535827 | 0.416352 | exercise1.go | starcoder |
package zoekt
import (
"fmt"
"log"
"regexp"
"sort"
"strings"
"github.com/google/zoekt/query"
)
var _ = log.Println
// An expression tree coupled with matches
type matchTree interface {
// returns whether this matches, and if we are sure.
matches(known map[matchTree]bool) (match bool, sure bool)
// clears... | eval.go | 0.506836 | 0.400955 | eval.go | starcoder |
package posthog
import (
"reflect"
"strings"
)
// Imitate what what the JSON package would do when serializing a struct value,
// the only difference is we we don't serialize zero-value struct fields as well.
// Note that this function doesn't recursively convert structures to maps, only
// the value passed as argu... | vendor/github.com/posthog/posthog-go/json.go | 0.735167 | 0.421671 | json.go | starcoder |
package morton
import "fmt"
type Morton64 struct {
dimensions uint64
bits uint64
masks []uint64
lshifts []uint64
rshifts []uint64
}
func Make64(dimensions uint64, bits uint64) *Morton64 {
if dimensions == 0 || bits == 0 || dimensions*bits > 64 {
panic(fmt.Sprintf("can't make morton64 with %d... | morton64.go | 0.52829 | 0.505676 | morton64.go | starcoder |
package heraldry
import (
"fmt"
"github.com/ironarachne/world/pkg/grid"
"github.com/ironarachne/world/pkg/heraldry/charge"
"math/rand"
)
// Field is the field of a coat of arms
type Field struct {
Division
ChargeGroups []charge.Group
FieldType FieldType
}
// FieldType is a type of field
type FieldType struct ... | pkg/heraldry/fields.go | 0.58166 | 0.40489 | fields.go | starcoder |
package criticality
// Criticality is
type Criticality string
// criticality
var (
// EmptyCriticality is used to mark any invalid criticality, and the empty criticality will be parsed as the default criticality later.
EmptyCriticality = Criticality("")
// CriticalPlus is reserved for the most critical requests, t... | pkg/net/criticality/criticality.go | 0.641535 | 0.433742 | criticality.go | starcoder |
package gocoder
import (
"context"
"go/ast"
"go/token"
)
type GoType struct {
rootExpr *GoExpr
astExpr ast.Expr
strType string
node GoNode
parent ast.Node
funcs []*GoFunc
}
func newGoType(rootExpr *GoExpr, parent ast.Node, astType ast.Expr) *GoType {
g := &GoType{
rootExpr: rootExpr,
astExpr: ast... | go_type.go | 0.50415 | 0.431165 | go_type.go | starcoder |
package rom
import (
"bytes"
"fmt"
"log"
)
// A Mutable is a memory data that can be changed by the randomizer.
type Mutable interface {
Mutate([]byte) error // change ROM bytes
Check([]byte) error // verify that the mutable matches the ROM
}
// A MutableRange is a length of mutable bytes starting at a given a... | rom/mutables.go | 0.674265 | 0.411584 | mutables.go | starcoder |
package examples
import (
"encoding/hex"
"github.com/cockroachdb/cockroach/pkg/workload"
)
type intro struct{}
func init() {
workload.Register(introMeta)
}
var introMeta = workload.Meta{
Name: `intro`,
Description: `Intro contains a single table with a hidden message`,
Version: `1.0.0`,
New: ... | pkg/workload/examples/intro.go | 0.697712 | 0.49109 | intro.go | starcoder |
package collection
import (
"errors"
"fmt"
"reflect"
)
// Node type holds the data element and pointer to next and previous node in the linked list
type Node struct {
Val interface{}
Next *Node
Prev *Node
}
// Collection type, stores the Head and Tail. It represents a Collection of address with each Collectio... | src/dataStructure/collection/collection.go | 0.658747 | 0.410461 | collection.go | starcoder |
// Copyright 2009 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.
// Test switch statements.
package main
import "os"
func assert(cond bool, msg string) {
if !cond {
print("assertion fail: ", msg, "\n")
panic(1)
}
}
... | test/switch.go | 0.629775 | 0.516535 | switch.go | starcoder |
package shortestcompletingword
import "strings"
/**
* Given a string licensePlate and an array of strings words, find the shortest completing word in words.
* A completing word is a word that contains all the letters in licensePlate. Ignore numbers and spaces in licensePlate, and treat letters as case insensitive. ... | shortestcompletingword/shortestcompletingword.go | 0.797281 | 0.544801 | shortestcompletingword.go | starcoder |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.