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 healthz
// Severity specifies the seriousness of a component
type Severity int8
// Health specifies if a component is ready or not
type Health int8
const (
// Major means this component's failour disruptes some major
// functionalities of the system.
Major Severity = 1
// Unspecified is the default valu... | definitions.go | 0.605799 | 0.470311 | definitions.go | starcoder |
package main
import (
"fmt"
"github.com/gord-project/gview"
"strconv"
"strings"
"time"
"github.com/gdamore/tcell/v2"
)
const corporate = `Leverage agile frameworks to provide a robust synopsis for high level overviews. Iterative approaches to corporate strategy foster collaborative thinking to further the over... | demos/textview/main.go | 0.53437 | 0.409221 | main.go | starcoder |
package collections
import (
"encoding/binary"
"hash/maphash"
)
type hashKeyType = uint32
const bitsPerTrieDepth hashKeyType = 5
const sizeOfSlices hashKeyType = 32
const bitMask hashKeyType = sizeOfSlices - 1
type HashMap struct {
seed maphash.Seed
size int
root HAMTNode
}
func NewHashMap() *HashMap {
seed ... | map.go | 0.719876 | 0.44559 | map.go | starcoder |
package geojson
import (
"encoding/json"
"math"
)
// DefaultSegments controls the number of segments output in the geometry created
// by CircleGeom.
var DefaultSegments float64 = 20
// EarthRadiusM is the approximate radius of the earth in meters
const EarthRadiusM float64 = 6378137.0
// Haversine computes the d... | geojson/geojson.go | 0.818882 | 0.583945 | geojson.go | starcoder |
package graph
import (
i336074805fc853987abe6f7fe3ad97a6a6f3077a16391fec744f671a015fbd7e "time"
i04eb5309aeaafadd28374d79c8471df9b267510b4dc2e3144c378c50f6fd7b55 "github.com/microsoft/kiota/abstractions/go/serialization"
)
// AccessPackageAssignment
type AccessPackageAssignment struct {
Entity
// Rea... | models/microsoft/graph/access_package_assignment.go | 0.693161 | 0.40698 | access_package_assignment.go | starcoder |
package ast
import (
"fmt"
)
// Type representing a comparison of two integers.
type Comparison struct {
left IntegerTerm
right IntegerTerm
operator func(left int, right int) bool
operatorName string
}
func (c Comparison) Eval(state State) (bool, error) {
l, err := c.left.Eval(state)
if err... | ast/comparison.go | 0.9271 | 0.512571 | comparison.go | starcoder |
package transport
import (
"sync"
"time"
)
const (
// bdpLimit is the maximum value the flow control windows
// will be increased to.
bdpLimit = (1 << 20) * 4
// alpha is a constant factor used to keep a moving average
// of RTTs.
alpha = 0.9
// If the current bdp sample is greater than or equal to
// our b... | vendor/google.golang.org/grpc/transport/bdp_estimator.go | 0.796688 | 0.523908 | bdp_estimator.go | starcoder |
// Package sdnv packages implements the Self-Delimiting Numeric Values,
// as per https://tools.ietf.org/html/rfc5050#section-4.1
package sdnv
import (
"fmt"
"io"
"math/big"
"math/bits"
)
// MaxByteSize is the largest number of bytes a uint64 might be encoded into
const MaxByteSize = 10
// ErrOverflow64 is the ... | sdnv/codec.go | 0.605216 | 0.452838 | codec.go | starcoder |
package headlessexperimental
// Sends a BeginFrame to the target and returns when the frame was completed. Optionally captures a
// screenshot from the resulting frame. Requires that the target was created with enabled
// BeginFrameControl. Designed for use with --run-all-compositor-stages-before-draw, see also
// htt... | protocol/headlessexperimental/method.go | 0.743447 | 0.484319 | method.go | starcoder |
package table
import (
"fmt"
"io"
"reflect"
"strconv"
"strings"
"time"
semver "github.com/cppforlife/go-semi-semantic/version"
"github.com/dustin/go-humanize"
"gopkg.in/yaml.v2"
boshuifmt "github.com/cloudfoundry/bosh-cli/ui/fmt"
)
func NewValueString(s string) ValueString { return ValueString{S: s} }
fu... | ui/table/values.go | 0.594669 | 0.439266 | values.go | starcoder |
package analyzer
// CalcAverageMonthly caclulates average monthly open and close prices for each security
func CalcAverageMonthly(tickerMap map[string][]DailyStockData) map[string][]AverageMonthlyPrices {
tickerAveragesMap := make(map[string][]AverageMonthlyPrices)
for ticker, dailyDatas := range tickerMap {
avera... | analyzer/calculate.go | 0.763043 | 0.745167 | calculate.go | starcoder |
package collector
import (
"strconv"
"github.com/prometheus/client_golang/prometheus"
)
type topicStats []struct {
val func(topics *Topics) float64
vec *prometheus.GaugeVec
}
// TopicStats creates a new stats collector which is able to
// expose the topic metrics of a nsqd node to Prometheus.
func TopicStats(na... | collector/stats_topic.go | 0.70791 | 0.415492 | stats_topic.go | starcoder |
package function
import (
"errors"
"fmt"
"kanzi"
"kanzi/transform"
)
// Utility class to compress/decompress a data block
// Fast reversible block coder/decoder based on a pipeline of transformations:
// Forward: (Bijective) Burrows-Wheeler -> Move to Front -> Zero Run Length
// Inverse: Zero Run Length -> Move t... | go/src/kanzi/function/BWTBlockCodec.go | 0.724481 | 0.516535 | BWTBlockCodec.go | starcoder |
package gocarina
import (
"fmt"
"image"
"image/png"
"log"
"os"
)
// Tile represents a lettered square from a Letterpress game board.
type Tile struct {
Letter rune // the letter this tile represents, if known
img image.Image // the original tile image, prior to any scaling/downsampling
Reduced ima... | tile.go | 0.744749 | 0.538923 | tile.go | starcoder |
package graph
import (
i04eb5309aeaafadd28374d79c8471df9b267510b4dc2e3144c378c50f6fd7b55 "github.com/microsoft/kiota/abstractions/go/serialization"
)
// BucketAggregationRange provides operations to call the query method.
type BucketAggregationRange struct {
// Stores additional data not described in the Open... | models/microsoft/graph/bucket_aggregation_range.go | 0.836655 | 0.439386 | bucket_aggregation_range.go | starcoder |
package bigquery
import (
"io"
bq "google.golang.org/api/bigquery/v2"
)
// GCSReference is a reference to one or more Google Cloud Storage objects, which together constitute
// an input or output to a BigQuery operation.
type GCSReference struct {
// URIs refer to Google Cloud Storage objects.
URIs []string
F... | vendor/cloud.google.com/go/bigquery/gcs.go | 0.685529 | 0.436142 | gcs.go | starcoder |
package column
import (
"github.com/kelindar/bitmap"
"github.com/kelindar/column/commit"
)
// --------------------------- Float32s ----------------------------
// columnFloat32 represents a generic column
type columnfloat32 struct {
fill bitmap.Bitmap // The fill-list
data []float32 // The actual values
}
... | column_numbers.go | 0.784773 | 0.501343 | column_numbers.go | starcoder |
package client
import (
"encoding/json"
)
// IsFirstLoginResult struct for IsFirstLoginResult
type IsFirstLoginResult struct {
IsFirstLogin bool `json:"isFirstLogin"`
}
// NewIsFirstLoginResult instantiates a new IsFirstLoginResult object
// This constructor will assign default values to properties that have it d... | client/model_is_first_login_result.go | 0.63443 | 0.40031 | model_is_first_login_result.go | starcoder |
package main
import "math"
type Sphere struct {
material Material
transform Matrix
}
func MakeSphere() Sphere {
return Sphere{
material: MakeMaterial(),
transform: IdentityMatrix4,
}
}
func MakeSphereTransformed(transform Matrix) Sphere {
return Sphere{
material: MakeMaterial(),
transform: transform... | sphere.go | 0.88355 | 0.456107 | sphere.go | starcoder |
package samples
func init() {
sampleDataBlindTransferOperation[3] = `{
"fee": {
"amount": 1500000,
"asset_id": "1.3.0"
},
"inputs": [
{
"commitment": "02718abb1076837e57c484cfdde4b4393ea9a13eeb279f2aaca3c6188aa69bde44",
"owner": {
"account_auths": [],
"address_auths": [... | gen/samples/blindtransferoperation_3.go | 0.561816 | 0.427935 | blindtransferoperation_3.go | starcoder |
package encoder
import (
"reflect"
"regexp"
"strings"
"sync"
yaml "gopkg.in/yaml.v3"
)
const (
// HeadComment populates `yaml.Node` `HeadComment`.
HeadComment = iota
// LineComment populates `yaml.Node` `LineComment`.
LineComment
// FootComment populates `yaml.Node` `FootComment`.
FootComment
)
// Doc r... | encoder/documentation.go | 0.714927 | 0.403214 | documentation.go | starcoder |
package kinesisfirehoseevt
import (
"encoding/json"
"time"
)
// OutputRecord represents the transformed Amazon Kinesis Firehose record
type OutputRecord struct {
// The record ID is passed from Amazon Kinesis Firehose to AWS Lambda
// during the invocation. The transformed record must contain the same
// record... | service/lambda/runtime/event/kinesisfirehoseevt/definition.go | 0.821367 | 0.517083 | definition.go | starcoder |
package data
import (
"math"
)
// Space
type Space struct {
G float64
Entities []Entity
}
func NewSpace() *Space {
return &Space{G: 6.674e-11}
}
func (space *Space) AddEntity(entity *Entity) {
space.Entities = append(space.Entities, *entity)
}
func (space *Space) FindByName(name string) *Entity {
for ... | internal/data/space.go | 0.785432 | 0.461745 | space.go | starcoder |
// Package m32 math and gl math for floats32 it uses go-gl/mathgl/mgl32 for
// certain things
package m32
import (
"math"
"github.com/go-gl/mathgl/mgl32"
)
type (
vec2 = mgl32.Vec2
vec3 = mgl32.Vec3
vec4 = mgl32.Vec4
mat3 = mgl32.Mat3
mat4 = mgl32.Mat4
quat = mgl32.Quat
)
/*var (
up = vec3{0, 1, 0}
... | m32/m32.go | 0.857037 | 0.672273 | m32.go | starcoder |
package keras
//Network defines a simple neural network architecture.
type Network struct {
InputNodes, HiddenNodes, OutputNodes int
WeightsIh, WeightsHo, BiasO, BiasH Matrix
LearningRate float64
}
//Package network implements the
// InitNetwork initializes the network with the number of... | keras/neuralnetwork.go | 0.883406 | 0.766665 | neuralnetwork.go | starcoder |
package named
// ParamSet represents a set of parameters for a single query
type ParamSet struct {
// does this engine support named parameters?
hasNamedSupport bool
// the set of currently tracked named parameters
namedParams map[string]Param
// the locations of each of the named parameters
namedLocs map[string... | internal/sql/named/param_set.go | 0.82994 | 0.40392 | param_set.go | starcoder |
package parsing
import (
"errors"
"fmt"
"github.com/arnodel/golua/luastrings"
"github.com/arnodel/golua/ops"
"github.com/arnodel/golua/token"
"github.com/arnodel/golua/ast"
)
// Parser can parse lua statements or expressions
type Parser struct {
scanner Scanner
}
type Scanner interface {
Scan() *token.Toke... | parsing/parser.go | 0.599954 | 0.490358 | parser.go | starcoder |
package vorbis
import "errors"
// A Decoder stores the information necessary to decode a vorbis steam.
type Decoder struct {
headerRead bool
setupRead bool
sampleRate int
channels int
Bitrate Bitrate
blocksize [2]int
CommentHeader
codebooks []codebook
floors []floor
residues []residue
mappings... | vendor/github.com/jfreymuth/vorbis/vorbis.go | 0.820073 | 0.478041 | vorbis.go | starcoder |
package brotli
import "math"
/* Copyright 2013 Google Inc. All Rights Reserved.
Distributed under MIT license.
See file LICENSE for detail or copy at https://opensource.org/licenses/MIT
*/
func initialEntropyCodesCommand(data []uint16, length uint, stride uint, num_histograms uint, histograms []histogramComma... | vendor/github.com/andybalholm/brotli/block_splitter_command.go | 0.734024 | 0.443962 | block_splitter_command.go | starcoder |
package histogram
import (
"bytes"
"encoding/csv"
"encoding/json"
"sort"
"strconv"
"github.com/goark/cov19data/ecode"
"github.com/goark/cov19data/values"
"github.com/goark/errs"
)
//HistData is class of cases data record for histgram.
type HistData struct {
Period values.Period
Cases float64
Deaths float... | histogram/histogram.go | 0.680772 | 0.474022 | histogram.go | starcoder |
package metadbtest
import (
"testing"
"time"
"github.com/googleforgames/open-saves/internal/pkg/metadb"
"github.com/stretchr/testify/assert"
)
func assertTimestampsWithinDuration(t *testing.T, expected, actual *metadb.Timestamps, delta time.Duration, msgAndArgs ...interface{}) {
t.Helper()
assert.WithinDurati... | internal/pkg/metadb/metadbtest/metadbtest.go | 0.71403 | 0.837354 | metadbtest.go | starcoder |
package genetic_algorithm
import (
log "github.com/cihub/seelog"
"math/rand"
"sort"
)
type MultiPointCrossover struct {
crossPointsCount int
chromConstr EmptyChromosomeConstructor
canProduceCopiesOfParents bool
}
func NewMultiPointCrossover(chromConstr EmptyChromosomeConstructor, crossPo... | crossover_multi_point.go | 0.683947 | 0.405331 | crossover_multi_point.go | starcoder |
package noisey
/* Copyright 2014, <NAME> <<EMAIL>>
See the LICENSE file for more details. */
/*
This module performs fractal Brownian motion which combines mulitple steps
of a coherent noise generator, each with different frequency and amplitude.
Reference material:
* Overview: https://code.google.com/p/fractalterr... | fbm.go | 0.906173 | 0.560974 | fbm.go | starcoder |
package strings
// Trie is a search struct.
// https://algs4.cs.princeton.edu/52trie/TrieST.java.html
type Trie struct {
root *_TrieNode
alphabet Alphabet
size int
}
type _TrieNode struct {
value interface{}
nodes []*_TrieNode
}
func (trie *Trie) symbolsCount() int {
return trie.alphabet.Size()
}
func... | strings/trie.go | 0.778018 | 0.488039 | trie.go | starcoder |
package unicornify
import (
. "github.com/drbrain/go-unicornify/unicornify/core"
"github.com/drbrain/gopyrand"
"image"
"image/color"
"math"
)
type GrassData struct {
Seed uint32
RowSeedAdd uint32
Horizon float64
BladeHeightFar, BladeHeig... | unicornify/grass.go | 0.612773 | 0.400515 | grass.go | starcoder |
package base
import "math"
const (
// These values are established by empiricism with
// tests (tradeoff: performance VS precision)
NEWTON_ITERATIONS = 4
NEWTON_MIN_SLOPE = 0.001
SUBDIVISION_PRECISION = 0.0000001
SUBDIVISION_MAX_ITERATIONS = float64(10)
kSplineTableSize = 11
kSampleSt... | pkg/styled/base/raphson-newton.go | 0.761272 | 0.671898 | raphson-newton.go | starcoder |
package gotility
import (
"fmt"
"reflect"
"regexp"
"strings"
)
const (
// NUMBER_REGEX is the regex for real number
NUMBER_REGEX = "^[+-]?([0-9]+(\\.[0-9]*)?|\\.[0-9]+)([eE][+-]?[0-9]+)?$"
// EMAIL_REGEX is the regex for email
EMAIL_REGEX = "^[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+@[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a... | utility.go | 0.631253 | 0.40869 | utility.go | starcoder |
package lzma
// states defines the overall state count
const states = 12
// State maintains the full state of the operation encoding or decoding
// process.
type state struct {
rep [4]uint32
isMatch [states << maxPosBits]prob
isRepG0Long [states << maxPosBits]prob
isRep [states]prob... | vendor/github.com/ulikunitz/xz/lzma/state.go | 0.542136 | 0.444625 | state.go | starcoder |
package wgs84
import (
"fmt"
"math"
)
type Locality struct {
Name string
Longitude, Latitude float64
Distance float64
Bearing float64
}
type ByDistance []Locality
func (a ByDistance) Len() int { return len(a) }
func (a ByDistance) Swap(i, j int) { a[i], a[j... | vendor/github.com/GeoNet/kit/wgs84/localities.go | 0.817793 | 0.663396 | localities.go | starcoder |
package GoPolygons
import (
"math"
)
type Polygon struct {
Points []Point
ContainRect Rect
}
func NewPolygon(pts []Point) *Polygon {
left := pts[0].X
right := pts[0].X
top := pts[0].Y
bottom := pts[0].Y
for i := 0; i < len((pts)); i++ {
left = math.Min(left, pts[i].X)
right = math.Max(right, pts[i]... | polygon.go | 0.767341 | 0.592077 | polygon.go | starcoder |
package editor
import (
"fmt"
"io"
)
func Help(w io.Writer) error {
for _, x := range quickref {
_, err := w.Write([]byte(fmt.Sprintf("%-12s%s\n", x.k, x.v)))
if err != nil {
return err
}
}
return nil
}
// Reference: Vim's quickref.txt.
var quickref = []struct{ k, v string }{
{"h", "left"},
{"l", "ri... | editor/help.go | 0.569134 | 0.551332 | help.go | starcoder |
package heap
import (
"errors"
//"log"
)
// Direction holds whether heap returns minimum or maximum on Get and Extract
// operations.
type Direction int
const (
Ascending Direction = iota
Descending
)
// IntHeap structure
type IntHeap struct {
// Direction defines whether heap is ascending or descending
Direc... | heap.go | 0.780244 | 0.466238 | heap.go | starcoder |
package closure
import (
"fmt"
"math"
"net/http"
"sort"
"strings"
)
// AsGenerator is an example of the idea of closures. The state of the
// function is sealed away (closed away) and it keeps that state even after the
// scope is destroyed. Think of an oyster 🦪 with a grain of sand, turning into
// a pearl. ⚪
... | basics/completed/closure/closure.go | 0.588416 | 0.439026 | closure.go | starcoder |
package lexers
import (
. "github.com/johnsto/go-highlight"
"strings"
)
var JSON = Lexer{
Name: "json",
MimeTypes: []string{"application/json"},
Filenames: []string{"*.json"},
States: StatesSpec{
"root": {
{Include: "value"},
},
"whitespace": {
{Regexp: "\\s+", Type: Whitespace},
},
// lite... | lexers/lexer_json.go | 0.526343 | 0.517022 | lexer_json.go | starcoder |
package geom
/*
#include <liblwgeom.h>
#include <geos_c.h>
#include "lwgeom_geos.h"
#include "geos.h"
#include "geom.h"
*/
import (
"C"
)
import "errors"
// Buffer creates a buffer around a geometry object
func (lwg *Geom) Buffer(width float64) error {
bufferedGeom := C.buffer(lwg.LwGeom, C.double(width), C.int(8))... | geom/geom.go | 0.803482 | 0.47098 | geom.go | starcoder |
package asposeslidescloud
import (
"encoding/json"
)
// A bubble series.
type IBubbleSeries interface {
// Series type.
getType() string
setType(newValue string)
// Series name.
getName() string
setName(newValue string)
// True if each data marker in the series has a different color.
getIsColorVaried() bo... | bubble_series.go | 0.826747 | 0.504822 | bubble_series.go | starcoder |
package main
import (
"github.com/SymnaTEC/go-adcpi"
"github.com/buger/goterm"
"os"
"fmt"
"time"
"bufio"
"strings"
"flag"
"strconv"
"math/rand"
)
/*
This is the entry point of the application. When the program is run, this will be the first function that gets called.
It is re... | plot.go | 0.702224 | 0.437643 | plot.go | starcoder |
package cmd
import (
"time"
)
var (
// Reference: https://en.wikipedia.org/wiki/List_of_UTC_time_offsets
utcOffsets = []utcOffset{
{"UTC-12:00", "Y", -12 * time.Hour}, // 0
{"UTC-11:00", "X", -11 * time.Hour}, // 1
{"UTC-10:00", "W", -10 * time.Hour}, // 2
... | cmd/utc-offsets.go | 0.549882 | 0.492554 | utc-offsets.go | starcoder |
package closest_pair
import (
"math"
"strconv"
)
type point struct {
x float64
y float64
}
type Point interface {
toString() string
}
func makePoint(x float64, y float64) *point {
A := new(point)
A.x = x
A.y = y
return A
}
func (A *point) toString() string {
return "(" + strconv.FormatFloat(A.x, 'f', -1... | algorithms/maths/closest-pair/closest_pair.go | 0.752831 | 0.500061 | closest_pair.go | starcoder |
package operator
// Operator condition type
type Operator string
const (
// Tr Tree condition
Tr Operator = "tr"
// Query Selectors
// ========== Comparison =============
// Eq Matches values that are equal to a specified value
Eq Operator = "eq"
// Ne Matches all values that are not equal to a specified va... | bcs-common/pkg/odm/operator/condition.go | 0.698227 | 0.488527 | condition.go | starcoder |
// Package histogram implements a basic histogram to keep track of data
// distribution.
package histogram
import (
"time"
"v.io/v23/verror"
"v.io/x/ref/lib/stats/counter"
"v.io/x/ref/services/stats"
)
const pkgPath = "v.io/x/ref/lib/stats/histogram"
var (
errNoBucketForValue = verror.Register(pkgPath+".errNo... | x/ref/lib/stats/histogram/histogram.go | 0.736495 | 0.524029 | histogram.go | starcoder |
package main
const (
content = `
# Awesome Go
[](https://travis-ci.org/avelino/awesome-go) [](https://github.com/sindresorhus/awe... | examples/aho-corasick/data.go | 0.798344 | 0.773259 | data.go | starcoder |
package render
import (
geometry "basic-ray/pkg/geometry"
"math"
)
const BIAS = 0.00001
type Color [3]float64
type Photon struct {
vector geometry.Vector
rgb Color
}
type LightSource interface {
GetPhoton(destination geometry.Point) Photon
GetDistance(destination geometry.Point) float64
}
type DeltaLight... | pkg/render/light.go | 0.831417 | 0.737914 | light.go | starcoder |
package main
import (
"image/png"
"os"
"github.com/adamcolton/geom/angle"
"github.com/nfnt/resize"
"github.com/adamcolton/geom/d3"
"github.com/adamcolton/geom/d3/render/raytrace"
"github.com/adamcolton/geom/d3/render/scene"
"github.com/adamcolton/geom/d3/solid/mesh"
)
func main() {
s := &raytrace.Scene{
... | examples/raytrace/raytrace.go | 0.631367 | 0.485173 | raytrace.go | starcoder |
package unionfind
import (
"fmt"
"strings"
)
// Maintains sets and a number of connected elements.
type UnionFind struct {
sets map[interface{}]*set
count int
}
type set struct {
parent interface{}
rank int
}
// New return an initialized UnionFind data structure.
func New() *UnionFind {
return &UnionFind{... | unionfind.go | 0.778313 | 0.46041 | unionfind.go | starcoder |
package contourmap
import (
"image"
"math"
"sort"
)
type ContourMap struct {
W int // width of the contour map in pixels
H int // height of the contour map in pixels
Min float64 // minimum value contained in this contour map
Max float64 // maximum value contained in this contour map
grid []flo... | contourmap.go | 0.813238 | 0.518424 | contourmap.go | starcoder |
package gt
import (
"bytes"
"database/sql/driver"
"fmt"
)
/*
Valid representations of `gt.Ter`. Other values are considered invalid and will
cause panics.
*/
const (
TerNull Ter = 0
TerFalse Ter = 1
TerTrue Ter = 2
)
/*
Shortcut: parses successfully or panics. Provided only for consistency with
other types. ... | gt_ter.go | 0.795102 | 0.584004 | gt_ter.go | starcoder |
package plotter
import (
"fmt"
)
var commandSeparator string
func SetCommandSeparator(separator string) {
commandSeparator = separator
}
func CommandSeparator() string {
return commandSeparator
}
type Mode int
//go:generate stringer -type=Mode
const (
Absolute Mode = iota // Absolute used as a default value ... | plotter.go | 0.59302 | 0.534855 | plotter.go | starcoder |
package schema
import (
"reflect"
"strings"
"github.com/benpate/convert"
"github.com/benpate/derp"
"github.com/benpate/path"
)
// Array represents an array data type within a JSON-Schema.
type Array struct {
Items Element
Required bool
}
// Type returns the data type of this Schema
func (array Array) Type... | array.go | 0.78469 | 0.520496 | array.go | starcoder |
package bn256
import (
"crypto/rand"
"errors"
"io"
"math/big"
)
func randomK(r io.Reader) (k *big.Int, err error) {
for {
k, err = rand.Int(r, Order)
if k.Sign() > 0 || err != nil {
return
}
}
}
// G1 is an abstract cyclic group. The zero value is suitable for use as the
// output of an operation, but... | bn256.go | 0.720958 | 0.452899 | bn256.go | starcoder |
package buffer
import (
"errors"
"math"
"github.com/tidwall/geojson"
"github.com/tidwall/geojson/geo"
"github.com/tidwall/geojson/geometry"
"github.com/tidwall/gjson"
)
// TODO: detect of pole and antimeridian crossing and generate
// valid multigeometries
const bufferSteps = 15
// Simple performs a very sim... | internal/buffer/buffer.go | 0.519765 | 0.502563 | buffer.go | starcoder |
package plot
import (
"github.com/df-mc/dragonfly/server/block"
"github.com/df-mc/dragonfly/server/block/cube"
"github.com/df-mc/dragonfly/server/world"
"github.com/go-gl/mathgl/mgl64"
)
// Position represents the position of a plot. These positions are similar to chunk positions, in that they
// do not represent... | plot/pos.go | 0.87035 | 0.666765 | pos.go | starcoder |
package main
import (
"math"
"github.com/pkg/errors"
"github.com/prometheus/common/model"
)
// Auditor is a struct for auditing prometheus queries
type Auditor struct{}
// Diff stores a difference between two queries
type Diff struct {
Series int
Diff float64 // avg proportional diff across all s... | tools/query-audit/auditor.go | 0.76454 | 0.587766 | auditor.go | starcoder |
package world
import (
"bytes"
"encoding/binary"
"encoding/json"
"fmt"
"io"
"log"
"math"
"github.com/danhale-git/mine/nbt"
"github.com/danhale-git/nbt2json"
)
const subChunkBlockCount = 4096
const chunkSize = 16
// subChunkData is the parsed data for one 16x16 subchunk. A palette including all block states... | world/subchunk.go | 0.68458 | 0.535888 | subchunk.go | starcoder |
package main
import (
"math/rand"
"github.com/gonum/plot"
"github.com/gonum/plot/plotter"
"github.com/gonum/plot/plotutil"
"github.com/gonum/plot/vg"
"github.com/JoshuaKolden/interp"
)
func main() {
rand.Seed(int64(0))
stepsplot, err := plot.New()
if err != nil {
panic(err)
}
easeout, err := plot.New(... | cmd/plot/main.go | 0.551815 | 0.416559 | main.go | starcoder |
package lm
import (
"errors"
"fmt"
"github.com/alldroll/go-datastructures/rbtree"
)
// NGramVectorBuilder is an entity that responses for building NGramVector
type NGramVectorBuilder interface {
// Put adds the given sequence of nGrams and count to model
Put(nGrams []WordID, count WordCount) error
// Build cre... | pkg/lm/ngram_vector_builder.go | 0.640074 | 0.487917 | ngram_vector_builder.go | starcoder |
package geographiclibgo
import "math"
type GeodesicLine struct {
tiny_ float64
_A1m1 float64
_A2m1 float64
_A3c float64
_A4 float64
_B11 float64
_B21 float64
_B31 float64
_B41 float64
_C1a [_GEODESIC_ORDER + 1]float64
_C1pa [_GEODESIC_ORDER + 1]float64
_C2a [_GEODESIC_ORDER + 1]float6... | geodesicline.go | 0.702734 | 0.459986 | geodesicline.go | starcoder |
package creepto
import (
"encoding/hex"
"fmt"
"github.com/syahrul12345/secp256k1/curve"
"github.com/syahrul12345/secp256k1/fieldelement"
"github.com/syahrul12345/secp256k1/utils"
"math/big"
)
var (
//Order of fin
Order string = "0xfffffffffffffffffffffffffffffffebaaedce6af48a03bbfd25e8cd0364141"
//P is the m... | creepto/creepto.go | 0.633637 | 0.430866 | creepto.go | starcoder |
package mat32
import (
"github.com/nlpodyssey/spago/pkg/mat32/internal/math32"
"math"
)
// Float is the main float type for the mat32 package. It is an alias for float32.
type Float = float32
const (
// SmallestNonzeroFloat corresponds to math.SmallestNonzeroFloat32.
SmallestNonzeroFloat = Float(math.SmallestNo... | pkg/mat32/mat32.go | 0.917349 | 0.663001 | mat32.go | starcoder |
package dasel
import (
"fmt"
"reflect"
)
// propagate recursively propagates the given nodes value up to the root node.
func propagate(n *Node) error {
if n.Previous == nil {
return nil
}
if err := propagateValue(n); err != nil {
return fmt.Errorf("could not propagate value: %w", err)
}
return propagate(n... | node_propagate.go | 0.747155 | 0.418281 | node_propagate.go | starcoder |
package tart
// Developed by <NAME> and featured in Commodities
// magazine in 1980, the Commodity Channel Index (CCI) is
// a versatile indicator that can be used to identify a new
// trend or warn of extreme conditions. Lambert originally
// developed CCI to identify cyclical turns in commodities,
// but the indicat... | cci.go | 0.630685 | 0.524029 | cci.go | starcoder |
package onshape
import (
"encoding/json"
)
// BTPExpressionAs238AllOf struct for BTPExpressionAs238AllOf
type BTPExpressionAs238AllOf struct {
BtType *string `json:"btType,omitempty"`
Operand *BTPExpression9 `json:"operand,omitempty"`
TypeName *BTPTypeName290 `json:"typeName,omitempty"`
}
// NewBTPExpressionAs23... | onshape/model_btp_expression_as_238_all_of.go | 0.720663 | 0.499023 | model_btp_expression_as_238_all_of.go | starcoder |
package main
import (
"bufio"
"fmt"
"os"
"time"
// My packages
"github.com/rsdoiel/stngo"
// Caltech Library packages
"github.com/caltechlibrary/cli"
)
var (
synopsis = `
%s is a standard timesheet notation parser.
`
description = `
%s parses content in "Standard Timesheet Notation". By default
it parse t... | cmd/stnparse/stnparse.go | 0.536799 | 0.475666 | stnparse.go | starcoder |
package effect
import (
"korok.io/korok/gfx"
"korok.io/korok/math/f32"
"korok.io/korok/math"
)
// RadiusConfig used to configure the RadiusSimulator.
type RadiusConfig struct {
Config
Radius Range
Angle, AngleDelta Var
}
// RadiusSimulator works as the radius mode of the Cocos2D's particle-system.
type Ra... | effect/sim_radius.go | 0.647687 | 0.436382 | sim_radius.go | starcoder |
package expr
import (
"fmt"
"math"
"strconv"
)
func intRawString(i int64) string { return strconv.FormatInt(i, 10) }
func floatRawString(f float64) string { return fmt.Sprintf("%f", f) }
func stringAdd(s1, s2 Value) Value {
return Value{
kind: KindString,
rawValue: s1.rawValue + s2.rawValue,
}
}
fu... | vendor/github.com/mkideal/pkg/expr/internal.go | 0.625209 | 0.422266 | internal.go | starcoder |
package Geo
import (
"crypto/sha256"
"fmt"
"github.com/opensatelliteproject/SatHelperApp/ImageProcessor/Projector"
"github.com/opensatelliteproject/SatHelperApp/XRIT"
"math"
"regexp"
"strconv"
)
type Converter struct {
satelliteLongitude float64 // Satellite Longitude
coff int // Column Off... | XRIT/Geo/GeoConverter.go | 0.8156 | 0.446555 | GeoConverter.go | starcoder |
package main
import (
"bufio"
"fmt"
"log"
"os"
"strconv"
"strings"
)
// Condition is the input of a Transition
type Condition struct {
state string
symbol rune
}
func (c Condition) String() string {
return "state=" + c.state + " symbol=" + strconv.QuoteRuneToASCII(c.symbol)
}
// Effect is the output of a ... | 208-hard/turing-machina.go | 0.657868 | 0.427815 | turing-machina.go | starcoder |
package main
// Importing Necessary Packages
import
(
"fmt"
"math"
)
// Input Function To Get The Digits
func getDigits(number int64) uint {
var ans uint
if number == 0 {
return 1
}
if number < 0 {
number = -number
}
for number > 0 {
ans++
number = ... | Algo_Ds_Notes-master/Algo_Ds_Notes-master/Karatsuba_Algorithm/Karatsuba_Algorithm.go | 0.575111 | 0.632843 | Karatsuba_Algorithm.go | starcoder |
package parser
import "fmt"
type FunctionType struct {
Signature []DataType
Names []string
ReturnType DataType
}
var functionTypes map[string]FunctionType
// ParamStmt is the equivalent of [PARAM stmt.Name stmt.Type]
type ParamStmt struct {
*BasicStatement
Name string
Kind DataType
}
func (p *ParamStmt... | parser/functions.go | 0.55254 | 0.486088 | functions.go | starcoder |
package dictionary
// trieNode saves trie structure
type trieNode struct {
childMap map[rune]*trieNode
isEnd bool
}
// Dictionary struct contains data and methods
type Dictionary struct {
root *trieNode
wordCount int
}
// NewDictionary creates new instance of dictionary
func NewDictionary() *Dictionary {... | dictionary/dictionary.go | 0.700997 | 0.476823 | dictionary.go | starcoder |
package ion
import (
"bytes"
"io"
"github.com/pkg/errors"
)
// This file contains binary parsers for List, SExp, Struct, and Annotation.
// parseBinaryList attempts to read and parse the entirety of the list whether
// it be a List (high == binaryTypeList) or SExp (high == binaryTypeSExp).
func parseBinaryList(a... | ion/parse_binary_container.go | 0.726037 | 0.499268 | parse_binary_container.go | starcoder |
package utils
import (
"errors"
"fmt"
"github.com/onsi/gomega"
"github.com/onsi/gomega/format"
"github.com/onsi/gomega/types"
"github.com/pivotal-cf/brokerapi"
)
type BrokerAPIServiceMatcher struct {
service brokerapi.Service
}
func EquivalentBrokerAPIService(service brokerapi.Service) types.GomegaMatcher {
... | pkg/utils/brokerapi_matchers.go | 0.679923 | 0.41941 | brokerapi_matchers.go | starcoder |
package docs
import (
"bytes"
"encoding/json"
"strings"
"github.com/alecthomas/template"
"github.com/swaggo/swag"
)
var doc = `{
"schemes": {{ marshal .Schemes }},
"swagger": "2.0",
"info": {
"description": "{{.Description}}",
"title": "{{.Title}}",
"contact": {
... | docs/docs.go | 0.542621 | 0.431944 | docs.go | starcoder |
package model
type (
// Type is the data structure for storing the parsed values of schema string
Type map[string]Collection // key is database name
// Collection is a data structure for storing fields of schema
Collection map[string]Fields // key is collection name
// Fields is a data structure for storing the ... | gateway/model/schema_type.go | 0.715126 | 0.450178 | schema_type.go | starcoder |
package types
import (
"bytes"
"fmt"
"github.com/davecgh/go-spew/spew"
"math/big"
"reflect"
"testing"
"github.com/DxChainNetwork/godx/common"
)
var checkEqualityHandler map[reflect.Type]func(*testing.T, string, string, reflect.Value, reflect.Value)
var dumper = spew.ConfigState{DisableMethods: true, Indent: ... | core/types/comparator.go | 0.550124 | 0.48688 | comparator.go | starcoder |
package sorts
// BubbleSort sorts array with Bubble Sort method
func BubbleSort(array []int) []int {
for i := 1; i < len(array); i++ {
for j := 0; j < len(array)-i; j++ {
if array[j] > array[j+1] {
array[j], array[j+1] = array[j+1], array[j]
}
}
}
return array
}
// InsertSort sorts array with Insert... | golang/src/sorts/sorts.go | 0.54819 | 0.666212 | sorts.go | starcoder |
package fingerprint
// Get predefined DNS service providers
// taken from https://github.com/indianajson/can-i-take-over-dns#dns-providers
func Get() []DNS {
return []DNS{
{
Provider: "000Domains",
Status: []int{1, 3},
Pattern: `^(fw)?ns[\d]\.000domains\.com$`,
},
{
Provider: "AWS Route 53",
S... | pkg/fingerprint/fingerprint.go | 0.521471 | 0.458167 | fingerprint.go | starcoder |
package carray
import (
"reflect"
)
type CArray struct {
// count is the number of real data in ring buffer
count int
// cap is the cap of buf, and must be the power of two.
cap int
// buf is a ring-buffer structure with a fixed size.
buf []interface{}
// _type is the type of the buf's element which is deter... | carray.go | 0.540196 | 0.422803 | carray.go | starcoder |
package ast
type Assignment struct {
baseNode
Expression Node
Value Node
}
func CreateAssignment(r *Range, expression Node, value Node) *Assignment {
return &Assignment{
baseNode: baseNode{
nodeType: NodeTypeAssignment,
nodeRange: r,
},
Expression: expression,
Value: value,
}
}
type Inc... | ast/assignments.go | 0.629775 | 0.636452 | assignments.go | starcoder |
package forminput
import (
"math/big"
)
// Enumerates data types that are supported as subscription input values.
type InputDataType string
type inputDataTypeValuesType struct {
None InputDataType
String InputDataType
Number InputDataType
Boolean InputDataType
Guid InputDataType
Uri InputDataType... | vendor/github.com/microsoft/azure-devops-go-api/azuredevops/forminput/models.go | 0.756807 | 0.413063 | models.go | starcoder |
package resource
import (
"fmt"
"reflect"
)
func modelComplexDeepEqual(model1 map[string]interface{}, model2 map[string]interface{}, equivalent bool) bool {
var m1, m2 map[string]interface{}
if len(model1) >= len(model2) {
m1 = model1
m2 = model2
} else {
m1 = model2
m2 = model1
}
notFoundCount := 0
... | resource/dynamic_model_util.go | 0.514644 | 0.4165 | dynamic_model_util.go | starcoder |
package constant
import (
"fmt"
"math/big"
"strconv"
"subc/scan"
)
// Type is a valid constant type.
type Type int
// Various types.
const (
Unknown Type = iota
Int
String
)
// Value represents a constant value.
type Value interface {
Type() Type // The type of the value.
String() string // The value ... | src/subc/constant/value.go | 0.636014 | 0.441191 | value.go | starcoder |
package tiles
import (
"math"
)
// TileSize is a size of each tile in pixels
const TileSize = 256
// Tile contains tile properties
// Z,X,Y - tile coordinates according to OSM specs(see http://wiki.openstreetmap.org/wiki/Slippy_map_tilenames)
// Bounding box - geographical coordinates of each side of tile
type Tile... | tiles/tile.go | 0.897297 | 0.631481 | tile.go | starcoder |
package postgres
import (
"fmt"
"strings"
"github.com/jackc/pgx/v4"
"github.com/pkg/errors"
"github.com/uncharted-distil/distil-compute/model"
api "github.com/uncharted-distil/distil/api/model"
"github.com/uncharted-distil/distil/api/postgres"
)
const coordinateBuckets = 20
// CoordinateField defines behavi... | api/model/storage/postgres/coordinate.go | 0.705278 | 0.415907 | coordinate.go | starcoder |
package align
import (
"errors"
"fmt"
"strings"
"github.com/biogo/biogo/align/matrix"
)
type MatrixScores struct {
SubMatrix [][]int
GapOpen int
GapExtend int
K float64
Lambda float64
}
// Reference : https://github.com/bbuchfink/diamond/blob/master/src/basic/score_matrix.cpp
var (
AllMatrix... | pkg/align/matrixScores.go | 0.782247 | 0.560674 | matrixScores.go | starcoder |
package levels
import (
mgl "github.com/go-gl/mathgl/mgl32"
"github.com/inkyblackness/hacked/editor/graphics"
"github.com/inkyblackness/hacked/editor/render"
"github.com/inkyblackness/hacked/ui/opengl"
)
var mapIconsVertexShaderSource = `
#version 150
precision mediump float;
in vec3 vertexPosition;
in vec3 uvP... | editor/levels/MapIcons.go | 0.739799 | 0.555315 | MapIcons.go | starcoder |
package lister
import (
"errors"
"fmt"
"regexp"
"strconv"
)
// ListRunesWithinRange returns the rune slice that contains letters within the specified range.
func ListRunesWithinRange(from, to rune) ([]rune, error) {
if from > to {
return nil, errors.New("`from` is bigger than `to`: `from` must be smaller than ... | lister/range.go | 0.843219 | 0.450178 | range.go | starcoder |
package binarytree
// Tree represents a binary tree
type Tree struct {
Root *Node
}
// Iterator is a func that can iterate a tree
type Iterator func(key Comparable, value interface{})
// Return a new empty binary tree
func NewTree() *Tree {
return &Tree{Root: nil}
}
// Add the supplied key and value to the tree. ... | tree.go | 0.807157 | 0.417212 | tree.go | starcoder |
package fix16
import "math/bits"
var (
Minimum = T{^0x7FFFFFFF}
Maximum = T{0x7FFFFFFF}
)
var (
Pi = T{205887}
E = T{178145}
Zero = T{}
One = T{0x00010000}
)
var Overflow = T{^0x7FFFFFFF}
type T struct {
f int32
}
func Binary(a uint32) T {
return T{int32(a)}
}
func Int(a int) T {
return Int32(int3... | fix16.go | 0.689619 | 0.424114 | fix16.go | starcoder |
package poly2tri
import (
"math"
)
type Point struct {
X float64
Y float64
Edges []*Edge
}
func NewPoint(x, y float64) *Point {
return &Point{
X: x,
Y: y,
Edges: make([]*Edge, 0),
}
}
func (p *Point) GetX() float64 {
return p.X
}
func (p *Point) GetY() float64 {
return p.Y
}
func (p ... | vendor/github.com/ByteArena/poly2tri-go/point.go | 0.8308 | 0.633467 | point.go | starcoder |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.