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 spec // Header The Header Object follows the structure of the Parameter Object with the following changes: // 1. name MUST NOT be specified, it is given in the corresponding headers map. // 2. in MUST NOT be specified, it is implicitly in header. // 3. All traits that are affected by the location MUST be appli...
internal/oapi/spec/header.go
0.847369
0.500916
header.go
starcoder
package date import ( "bytes" "database/sql/driver" "encoding/json" "time" ) // ISO8601Date uses ISO 8601 as a default for parsing and rendering const ISO8601Date = "2006-01-02" type Date struct{ time.Time } func (date Date) format() string { return date.Time.Format(ISO8601Date) } // AddDate adds any number o...
date.go
0.860721
0.449755
date.go
starcoder
package id3v2reader import ( //"bytes" "bytes" "errors" "fmt" "io" "regexp" "unicode/utf16" ) // ID3Frames contain the data extracted from each frame. Data extraction functions are bound to ID3Frame to give human readable representations // Since flag handling differs between ID3 versions, each fr...
id3v2reader.go
0.522933
0.415314
id3v2reader.go
starcoder
package unstructpath // ValueS is a "value selector". It filters values based on the // "filtered" predicates. type ValueS interface { // ValueS can be used as a Value predicate. If the selector can't // select any value from the value, then the predicate is // false. ValueP // SelectFrom finds values from value...
pkg/framework/unstructpath/values.go
0.846324
0.581957
values.go
starcoder
package main /** This file is part of multicache, a library for handling caches with multiple keys and replacement algorithms. Copyright 2015 <NAME> <<EMAIL>> Licensed under the MIT license **/ import ( "fmt" "math/rand" "runtime" "sort" "strconv" "testing" "github.com/josephlewis42/multicache" "github.com...
examples/speedtest/speedtest.go
0.671255
0.413063
speedtest.go
starcoder
package main import ( "fmt" "io/ioutil" "strconv" "strings" ) type Command struct { Direction string Distance int } type Path []Command type Vector struct { IsHorizontal bool DirectionIsReversed bool Position int Bounds [2]int PreviousStepNumber int } func combined_step_...
day03/star2.go
0.519278
0.443239
star2.go
starcoder
package models import ( i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91 "github.com/microsoft/kiota-abstractions-go/serialization" ) // AssignmentFilterTypeAndEvaluationResult represents the filter type and evalaution result of the filter. type AssignmentFilterTypeAndEvaluationResult struct { ...
models/assignment_filter_type_and_evaluation_result.go
0.734596
0.46478
assignment_filter_type_and_evaluation_result.go
starcoder
package juroku import ( "errors" "image" "image/color" "math" "github.com/disintegration/gift" ) // GetPalette returns the palette of the image. func GetPalette(img image.Image) color.Palette { colors := make(map[color.RGBA]bool) for y := img.Bounds().Min.Y; y < img.Bounds().Max.Y; y++ { for x := img.Bound...
image.go
0.812012
0.502136
image.go
starcoder
package binary_tree_preorder_traversal /* 144. 二叉树的前序遍历 https://leetcode-cn.com/problems/binary-tree-preorder-traversal 给定一个二叉树,返回它的 前序 遍历。 示例: 输入: [1,null,2,3] 1 \ 2 / 3 输出: [1,2,3] 进阶: 递归算法很简单,你可以通过迭代算法完成吗? */ type TreeNode struct { Val int Left *TreeNode Right *TreeNode } // 递归实现,时空...
solutions/binary-tree-preorder-traversal/d.go
0.62681
0.470676
d.go
starcoder
package main /* Day 13: Packet Scanners 0: 3 1: 2 4: 4 6: 4 You need to cross a vast firewall. The firewall consists of several layers, each with a security scanner that moves back and forth across the layer. To succeed, you must not be detected by a scanner. A: What is the severity of your whole trip? B: What is...
2017/13-packet-scanners/main.go
0.635222
0.411643
main.go
starcoder
package features import ( "fmt" "strconv" "strings" ) // Feature represents a feature of dklb. type Feature string // FeatureMap is a mapping between features of dklb and their current status. type FeatureMap map[Feature]bool const ( // RegisterAdmissionWebhook is used to indicate whether dklb should register i...
pkg/features/features.go
0.696578
0.402304
features.go
starcoder
package main import ( "fmt" ) type Node struct { key int left *Node right *Node } type Tree struct { rootNode *Node } func (tree *Tree) insert(data int) { if tree.rootNode == nil { tree.rootNode = &Node{data, nil, nil} } else { tree.rootNode.insert(data) } } func (tree *Tree) Search(key int) *Node {...
chap-04/01-BinarySearchTrees/main.go
0.566498
0.415729
main.go
starcoder
package lzma import "errors" // reps represents the repetition table in the LZMA state. type reps [4]uint32 // index maps the given dist value to the correct index into the reps // table. If the dist will not be found 4 is returned. func (r reps) index(dist uint32) int { if dist == r[0] { return 0 } if dist ==...
vendor/github.com/ulikunitz/xz/lzma/reps.go
0.63861
0.474814
reps.go
starcoder
package parsec // Terminal type can be used to construct a terminal ParsecNode. // It implements Queryable interface, hence can be used with // AST object. type Terminal struct { Name string // contains terminal's token type Value string // value of the terminal Position int // Offset into the text ...
terminal.go
0.696268
0.516717
terminal.go
starcoder
package poly2tri type Node struct { Point *Point Triangle *Triangle Next *Node Prev *Node Value float64 } func NewNode(p *Point, t *Triangle) *Node { return &Node{ Point: p, Triangle: t, Next: nil, Prev: nil, Value: p.X, } } type AdvancingFront struct { Head *Node ...
vendor/github.com/ByteArena/poly2tri-go/advancingfront.go
0.618204
0.437944
advancingfront.go
starcoder
package gobit import ( "math" ) type Buf struct { Bytes []byte pos uint32 size uint32 } func NewBuf(byteSize uint32) *Buf { return &Buf{make([]byte, byteSize), 0, byteSize * 8} } func (b *Buf) BitSize() uint32 { return b.size } func (b *Buf) ByteSize() uint32 { return b.size / 8 } func (b *Buf) Pos() ui...
buf.go
0.697506
0.491517
buf.go
starcoder
package rules import ( "fmt" "net" "reflect" "strconv" "strings" "time" ) // Rules struct to run dynamic method name type Rules struct { Inputs reflect.Value } // Required to check value is empty or not becasue is required func (r Rules) Required(fieldName string, field reflect.Value) error { switch field.Ki...
pkg/rules/rules.go
0.642208
0.403097
rules.go
starcoder
package bloom import ( "crypto/sha256" "fmt" "math" "strconv" ) // Filter represents a Bloom filter. // Note, operations are not concurrency safe. type Filter struct { // prob is a desired probability of false positives. prob float64 // bitlen is how many bits are needed to store n elements. bitlen uint64 //...
bloom.go
0.685002
0.480113
bloom.go
starcoder
package opinion import ( "fmt" "github.com/dimchansky/ebsl-go/evidence" ) // Type of opinion type Type struct { B, D, U float64 } // String implements fmt.Stringer func (x *Type) String() string { return fmt.Sprintf("{B: %v, D: %v, U: %v}", x.B, x.D, x.U) } // New creates new instance of opinion func New(b, d,...
opinion/opinion.go
0.884383
0.566978
opinion.go
starcoder
package period import ( "bytes" "fmt" "strings" "github.com/rickb777/plural" ) // Format converts the period to human-readable form using the default localisation. func (period Period) Format() string { return period.FormatWithPeriodNames(PeriodYearNames, PeriodMonthNames, PeriodWeekNames, PeriodDayNames, Peri...
vendor/github.com/rickb777/date/period/format.go
0.741487
0.476641
format.go
starcoder
package formula import ( "fmt" "math" ) type LineType int const ( Liner LineType = iota // 直线 Reciprocal // 倒数 ) type XY struct { X float64 Y float64 } type Line struct { A XY B XY Type LineType } type Border interface { RangeOfX(x float64) (float64, float64, error) } type ba...
formula/border.go
0.549399
0.444083
border.go
starcoder
package formatters import ( "fmt" "io" "sort" "strings" ) type ScreenFormatter struct{} func (f *ScreenFormatter) PrintTable(w io.Writer, headers []string, rows [][]string, headerToColumnRatios []int) error { headerWidths, columnWidths, err := f.computeDimensions(headers, rows, headerToColumnRatios) if err != ...
lib/printer/formatters/screen.go
0.671363
0.41052
screen.go
starcoder
package payload const defaultQueryFrom = 0 const defaultQuerySize = 20 type tagNode struct { Tag string `json:"tag"` } type keyValueNode struct { Key string `json:"key"` Value string `json:"value"` } type hasKeyNode struct { Key string `json:"key"` } type parentNode struct { Parent string `json:"parent"` } ...
payload/query.go
0.864525
0.475605
query.go
starcoder
Package pinion provides a fast and simple set of routines to manage the storage and retrieval of structured records. Overview Pinion automates the task of managing record storage and multiple retrieval indexes. Its simple programming interface, comprising methods like Put() and Get(), operate on types that implement ...
doc.go
0.710528
0.733237
doc.go
starcoder
package primitives import ( "errors" "math" ) // Matrix A square matrix type Matrix [][]float64 // MakeMatrix Makes an emptry square matrix of the given size func MakeMatrix(size uint8) Matrix { m := make([][]float64, size) for x := uint8(0); x < size; x++ { m[x] = make([]float64, size) } return m } // Make...
pkg/primitives/matrix.go
0.82011
0.609931
matrix.go
starcoder
package blockchain import ( "time" "github.com/incognitochain/incognito-chain/common" "github.com/incognitochain/incognito-chain/metadata" ) type BFTBlockInterface interface { // UnmarshalJSON(data []byte) error } type ShardToBeaconPool interface { RemoveBlock(map[byte]uint64) //GetFinalBlock() map[byte][]Sha...
blockchain/interface.go
0.603348
0.409811
interface.go
starcoder
package mockutil import ( "bytes" "io" "io/ioutil" "regexp" ) // RegexMatcher is a gomock Matcher which matches strings against some // given regex. type RegexMatcher struct { expected *regexp.Regexp } // MatchRegex returns a new RegexMatcher which matches the expected regex. func MatchRegex(expected string) *R...
utils/mockutil/mockutil.go
0.82226
0.527317
mockutil.go
starcoder
package main /* * 3-D gear wheels. This program is in the public domain. * * Command line options: * -info print GL implementation information * * * <NAME> */ /* this is go version based on SDL version this version uses Go-SDL: https://github.com/banthar/Go-SDL */ import ( "flag" "math" "g...
sdl/gears/main.go
0.521227
0.462291
main.go
starcoder
package polynomial import ( "errors" "math/big" "github.com/aisuosuo/alice/crypto/utils" ) var ( // ErrEmptyCoefficients is returned if the coefficients is empty ErrEmptyCoefficients = errors.New("empty coefficient") ) // Polynomial represents a polynomial of arbitrary degree type Polynomial struct { fieldOr...
crypto/polynomial/polynomial.go
0.655887
0.718641
polynomial.go
starcoder
package kdtree import ( "bytes" "fmt" "math" "sort" ) type Point interface { DimCount() int // Dimension count in the vectors Val(i int) float64 // Retrieve value in dimension i String() string // String representation of the poi...
kdtree.go
0.779112
0.420481
kdtree.go
starcoder
package genworldvoronoi type QuadGeometry struct { I []int xyz []float64 tm []float64 } func NewQuadGeometry() *QuadGeometry { /* xyz = position in 3-space; tm = temperature, moisture I = indices for indexed drawing mode */ return &QuadGeometry{} } func (this *QuadGeometry) setMe...
genworldvoronoi/quad_geometry.go
0.656878
0.531939
quad_geometry.go
starcoder
package panorama import ( "log" "math" "time" "github.com/ftl/hamradio/bandplan" "github.com/ftl/panacotta/core" ) // Panorama controller type Panorama struct { width core.Px height core.Px frequencyRange core.FrequencyRange dbRange core.DBRange vfo core.VFO band ...
core/panorama/panorama.go
0.704465
0.42937
panorama.go
starcoder
package midas import ( "math" ) func countsToAnom(tot float64, cur float64, curT int) float64 { curMean := tot / cur sqerr := math.Pow(max(0, cur-curMean), 2) return (sqerr/curMean + sqerr/(curMean*max(1.0, float64(curT-1.0)))) } type MidasRModel struct { curCount *EdgeHash totalCount *EdgeHash srcScore *...
midasr.go
0.503906
0.577674
midasr.go
starcoder
package socket import ( "reflect" ) // BinaryPlaceholder represents the position of a particular binary // attachement in a string-encoded packet type BinaryPlaceholder struct { Placeholder bool `json:"_placeholder"` Number int `json:"num"` } // HasBinary returns true if the data contains []byte or fixed-le...
socket/encoder.go
0.690768
0.407746
encoder.go
starcoder
package graph import ( "errors" "fmt" "reflect" "sort" ) const ( // GraphDirected is a directed graph. GraphDirected Type = "directed" // GraphUndirected is an undirected graph. GraphUndirected Type = "undirected" ) // Type describes the known types of graphs. type Type string // Graph is the collection o...
graph.go
0.67104
0.444685
graph.go
starcoder
package gofrac import ( "github.com/lucasb-eyer/go-colorful" "image/color" "math" ) // ColorSampler converts a floating point value to a color.Color in a color // palette. type ColorSampler interface { // TODO: Make "blackout" color configurable // SampleColor returns the color.Color of a palette corresponding ...
palette.go
0.685529
0.446977
palette.go
starcoder
package firestore import ( "bytes" "fmt" "math" "sort" "strings" tspb "github.com/golang/protobuf/ptypes/timestamp" pb "google.golang.org/genproto/googleapis/firestore/v1beta1" ) // Returns a negative number, zero, or a positive number depending on whether a is // less than, equal to, or greater than b accor...
vendor/cloud.google.com/go/firestore/order.go
0.786295
0.446676
order.go
starcoder
package gospline // See https://en.wikipedia.org/wiki/Monotone_cubic_interpolation import ( "math" "sort" ) type hermite struct { x []float64 p []float64 m []float64 n int segs []*hermiteSegment } // p(x) = a(x - xk)^3 + b(x - xk)^2 + c(x - xk) + d type hermiteSegment struct { a float64 b float64 c float...
hermite.go
0.698432
0.44089
hermite.go
starcoder
package initializers import ( "github.com/nlpodyssey/spago/pkg/mat" "github.com/nlpodyssey/spago/pkg/mat/rand" "github.com/nlpodyssey/spago/pkg/mat/rand/normal" "github.com/nlpodyssey/spago/pkg/mat/rand/uniform" "github.com/nlpodyssey/spago/pkg/ml/ag" "math" ) // Gain returns a coefficient that help to initial...
pkg/ml/initializers/initializers.go
0.817975
0.514339
initializers.go
starcoder
package storetest import ( "sort" "strconv" "testing" "github.com/mattermost/mattermost-server/v6/model" "github.com/mattermost/mattermost-server/v6/store" "github.com/stretchr/testify/require" ) func TestRetentionPolicyStore(t *testing.T, ss store.Store, s SqlStore) { t.Run("Save", func(t *testing.T) { test...
store/storetest/retention_policy_store.go
0.506591
0.48377
retention_policy_store.go
starcoder
package tort import ( "fmt" "reflect" "strconv" ) // StructAssertions test object properties. type StructAssertions struct { Assertions name string obj interface{} isnil bool } // Struct identifies assertions about an object. func (assert Assertions) Struct(obj interface{}) StructAssertions { assert.t.Helper...
structs.go
0.760473
0.694497
structs.go
starcoder
// Package utf8 implements functions and constants to support text encoded in // UTF-8. It includes functions to translate between runes and UTF-8 byte sequences. package utf8 // The conditions RuneError==unicode.ReplacementChar and // MaxRune==unicode.MaxRune are verified in the tests. // Defining them locally avoid...
src/unicode/utf8/utf8.go
0.538498
0.433142
utf8.go
starcoder
package validate import "github.com/pkg/errors" // BoolValidationWithBoolArgsFunc is a custom validation function that can be applied to a bool value with bool args. type BoolValidationWithBoolArgsFunc func(i bool, args ...bool) error // Validate implements Validation. func (v BoolValidationWithBoolArgsFunc) Valida...
validate/validations_with_args.go
0.768125
0.555918
validations_with_args.go
starcoder
package apivideosdk import ( //"encoding/json" ) // VideoStatusIngest Details about the capturing, transferring, and storing of your video for use immediately or in the future. type VideoStatusIngest struct { // There are three possible ingest statuses. missing - you are missing information required to ingest the v...
model_video_status_ingest.go
0.701917
0.429429
model_video_status_ingest.go
starcoder
package plaid import ( "encoding/json" ) // Category Information describing a transaction category type Category struct { // An identifying number for the category. `category_id` is a Plaid-specific identifier and does not necessarily correspond to merchant category codes. CategoryId string `json:"category_id"` ...
plaid/model_category.go
0.796134
0.414069
model_category.go
starcoder
package util import ( "errors" "github.com/disintegration/imaging" "image" ) func IsSolidColor(img image.Image) bool { base := img.At(img.Bounds().Min.X, img.Bounds().Min.Y) for y := img.Bounds().Min.Y; y < img.Bounds().Max.Y; y++ { for x := img.Bounds().Min.X; x < img.Bounds().Max.X; x++ { if img.At(x, y) ...
util/image.go
0.569134
0.439627
image.go
starcoder
package unit import "math" // Angle represents a SI unit of angle (in radians, ㎭) type Angle Unit // ... const ( Yoctoradian = Radian * 1e-24 Zeptoradian = Radian * 1e-21 Attoradian = Radian * 1e-18 Femtoradian = Radian * 1e-15 Picoradian = Radian * 1e-12 Nanoradi...
angle.go
0.781664
0.476884
angle.go
starcoder
package evolution import ( "fmt" "math" "sort" ) // GetTopIndividualInRun returns the best protagonist and antagonist in the entire evolutionary process func GetTopIndividualInRun(sortedGenerations []*Generation, isMoreFitnessBetter bool) (topAntagonist *Individual, topProtagonist *Individual, err error) { if sor...
evolution/evolutionresultutility.go
0.683314
0.466177
evolutionresultutility.go
starcoder
package validation import ( "database/sql/driver" "errors" "fmt" "reflect" "time" ) var ( bytesType = reflect.TypeOf([]byte(nil)) valuerType = reflect.TypeOf((*driver.Valuer)(nil)).Elem() ) // EnsureString ensures the given value is a string. // If the value is a byte slice, it will be typecast into a strin...
vertical-pod-autoscaler/e2e/vendor/github.com/go-ozzo/ozzo-validation/util.go
0.800458
0.4165
util.go
starcoder
// Package other wraps an hash-to-curve implementation and exposes functions for operations on points and scalars. package other import ( H2C "github.com/armfazh/h2c-go-ref" "github.com/bytemare/crypto/group/internal" ) // Hash2Curve implements the Group interface to Hash-to-Curve primitives. type Hash2Curve stru...
group/other/group.go
0.880457
0.447038
group.go
starcoder
package main import ( "math/rand" ) type Game struct { gridSize int score int highScore int over bool won bool grid *Grid drawer *Drawer } type Vector struct { x int y int } type PositionTraversal struct { x []int y []int } func (g *Game) setup(gameInfo GameInfo) { g.grid = &Gr...
game.go
0.601945
0.407186
game.go
starcoder
package bn254 import ( "math/big" ) // E is type for target group element type E = fe12 // GT is type for target multiplicative group GT. type GT struct { fp12 *fp12 } // Set copies given value into the destination func (e *E) Set(e2 *E) *E { return e.set(e2) } // One sets a new target group element to one func...
pkg/crypto/internal/groth16/bn256/utils/bn254/gt.go
0.896427
0.402275
gt.go
starcoder
package util import ( "errors" "reflect" ) //BiMap provides a bidirectional map of keys and values. type BiMap struct { key2Val reflect.Value val2Key reflect.Value keyType reflect.Type valType reflect.Type } //NewBiMap instantiates BiMap func NewBiMap(k, v interface{}) *BiMap { ktype := reflect.TypeOf(k) vt...
vendor/github.com/DataDog/datadog-agent/pkg/util/bimap.go
0.744749
0.405625
bimap.go
starcoder
package mvt import ( "encoding/json" "fmt" "reflect" "github.com/Smadarl/orb" "github.com/Smadarl/orb/encoding/mvt/vectortile" "github.com/pkg/errors" ) const ( moveTo = 1 lineTo = 2 closePath = 7 ) func encodeGeometry(g orb.Geometry) (vectortile.Tile_GeomType, []uint32, error) { switch g := g.(type...
encoding/mvt/geometry.go
0.551091
0.49347
geometry.go
starcoder
package ui // Instance of a component. type componentInstance struct { component UiComponent x, y int // X and Y offset of this component height int // Height allocated to the component width int // Width allocated to the component } // A la...
ui/layout.go
0.580233
0.432483
layout.go
starcoder
package main import ( "fmt" "math" "runtime" "sync" ) // Input function for integrating on the given length func function(x float64) float64 { return x * math.Sin(x) } // Type of function to pass to calculateIntegral function type integrateFunction func(float64) float64 // Accuracy of integral calculation. Big...
integralCalc/main.go
0.705886
0.472988
main.go
starcoder
package schema import ( "errors" "math" "strings" "github.com/dolthub/dolt/go/libraries/doltcore/schema/typeinfo" "github.com/dolthub/dolt/go/store/types" ) // InvalidTag is used as an invalid tag const InvalidTag uint64 = math.MaxUint64 var ( // KindToLwrStr maps a noms kind to the kinds lowercased name Ki...
go/libraries/doltcore/schema/column.go
0.667148
0.430866
column.go
starcoder
package chans import "github.com/goki/mat32" // NMDAParams control the NMDA dynamics, based on Jahr & Stevens (1990) equations // which are widely used in models, from Brunel & Wang (2001) to Sanders et al. (2013). // The overall conductance is a function of a voltage-dependent postsynaptic factor based // on Mg ion...
chans/nmda.go
0.825449
0.58883
nmda.go
starcoder
package email import ( "time" spmail "github.com/xhit/go-simple-mail/v2" ) const dateFormat = "2006-01-02 15:04:05 MST" type email struct { spemail *spmail.Email firstBodySet bool } // SetFrom sets the From address. func (e *email) SetFrom(address string) { e.spemail.SetFrom(address) } // SetSender sets...
backend/pkg/golang-graphql-example/email/email.go
0.608478
0.433981
email.go
starcoder
package main import ( "fmt" "strconv" ) // Expression is an interface to wrap objects from the parser. type Expression interface { String() string Evaluate() Value } // Value is an interface to handle different types. type Value interface { String() string Evaluate() Value } // Int is a type to handle integer...
value.go
0.660391
0.459925
value.go
starcoder
package output import ( "fmt" "github.com/Jeffail/benthos/v3/internal/docs" "github.com/Jeffail/benthos/v3/lib/log" "github.com/Jeffail/benthos/v3/lib/message/batch" "github.com/Jeffail/benthos/v3/lib/metrics" "github.com/Jeffail/benthos/v3/lib/output/writer" "github.com/Jeffail/benthos/v3/lib/types" "github....
lib/output/kinesis.go
0.772917
0.461138
kinesis.go
starcoder
package tilecover import "github.com/macheal/orb/maptile" // MergeUp will merge up the tiles in a given set up to the // the give min zoom. Tiles will be merged up only if all 4 siblings // are in the set. The tiles in the input set are expected // to all be of the same zoom, e.g. outputs of the Geometry function. fu...
maptile/tilecover/merge.go
0.607896
0.478224
merge.go
starcoder
package distance /* This module provides common distance functions for measuring distance between observations. Minkowski Distance is one the most inclusive among one as other distances are only a specific case of Minkowski Distance(Chebyshev Distance is not straightforward, though). when p=1 in MinkowskiDistance, i...
distance/distance.go
0.874359
0.878783
distance.go
starcoder
package obj import ( m "go-3d-rasterizer/math3d" "go-3d-rasterizer/rasterizer" "math" rl "github.com/gen2brain/raylib-go/raylib" ) // RenderWireframe renders the model in wireframe mode func (o *Model) RenderWireframe(scene *rasterizer.Scene) { for _, t := range o.triangles { col1, col2, col3, col4 := m.Vecto...
obj/renderer.go
0.592784
0.661349
renderer.go
starcoder
package parse type NodeType int func (t NodeType) Type() NodeType { return t } func (t NodeType) String() string { return nodeNames[t] } func (t NodeType) IsDataNode() bool { return (t > NodeDataDef) && (t < NodeDataDefEnd) } func (t NodeType) IsTypeRestriction() bool { return (t > NodeTypeRestrictionStart && t ...
parse/ntypes.go
0.591015
0.534005
ntypes.go
starcoder
package deque import ( "errors" "fmt" ) // Constants definition const ( SegmentCapacity = 128 ) // Define internal errors var ( ErrOutOffRange = errors.New("out off range") ) // Deque is double-ended queue supports efficient data insertion from the head and tail, random access and iterator access. type Deque st...
ds/deque/deque.go
0.637369
0.412708
deque.go
starcoder
Ported from Java com.google.gwt.dev.util.editdistance, which is: Copyright 2010 Google Inc. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless requir...
triage/berghelroach/berghelroach.go
0.837055
0.528412
berghelroach.go
starcoder
// Package turing implements the Turing stream cipher, as defined in // <NAME> and <NAME> "Turing: a Fast Stream Cipher". // The package API mimics that of the crypto/rc4 package. package turing import ( "fmt" ) const reglen = 17 const minkey = 8 const maxkey = 32 const maxlen = 48 const confounder = 0x1020300 // ...
cipher.go
0.736401
0.425247
cipher.go
starcoder
package blend import ( "image" "image/draw" "runtime" "sync" ) type Drawer interface { draw.Drawer DrawMask(dst draw.Image, r image.Rectangle, src image.Image, sp image.Point, mask image.Image, mp image.Point) } type drawer interface { drawRGBAToRGBAUniform(dst *image.RGBA, r image.Rectangle, src *image.RGBA,...
blend/draw.go
0.531209
0.623406
draw.go
starcoder
package tfe import ( "context" "github.com/hashicorp/go-tfe" "github.com/turbot/steampipe-plugin-sdk/grpc/proto" "github.com/turbot/steampipe-plugin-sdk/plugin" "github.com/turbot/steampipe-plugin-sdk/plugin/transform" ) func tableTfeWorkspace(ctx context.Context) *plugin.Table { return &plugin.Table{ Name:...
tfe/table_tfe_workspace.go
0.598547
0.402568
table_tfe_workspace.go
starcoder
package bpool // WrapByteSlice wraps a []byte as a ByteSlice func WrapByteSlice(full []byte, headerLength int) ByteSlice { return ByteSlice{ full: full, current: full[headerLength:], head: headerLength, end: len(full), } } // ByteSlice provides a wrapper around []byte with some added convenience t...
vendor/github.com/oxtoacart/bpool/byteslice.go
0.877948
0.55266
byteslice.go
starcoder
package frac import ( "fmt" "unsafe" ) // Shortcut for `Parse(src, frac, 2)`. func ParseBin(src string, frac uint) (int64, error) { return Parse(src, frac, 2) } // Shortcut for `Parse(src, frac, 8)`. func ParseOct(src string, frac uint) (int64, error) { return Parse(src, frac, 8) } // Shortcut for `Parse(src, f...
frac.go
0.842831
0.4206
frac.go
starcoder
// Based on design first introduced in: http://blog.golang.org/two-go-talks-lexical-scanning-in-go-and // Portions copied and modified from: https://github.com/golang/go/blob/master/src/text/template/parse/lex.go //go:generate stringer -type=tokenType -trimprefix=tokenType package parser // lex creates a new scanne...
parser/lex_def.go
0.744563
0.441071
lex_def.go
starcoder
package datadog import ( "encoding/json" "fmt" ) // SecurityFilterCreateAttributes Object containing the attributes of the security filter to be created. type SecurityFilterCreateAttributes struct { // Exclusion filters to exclude some logs from the security filter. ExclusionFilters []SecurityFilterExclusionFilt...
api/v2/datadog/model_security_filter_create_attributes.go
0.739516
0.403273
model_security_filter_create_attributes.go
starcoder
package sqeasy import ( "fmt" ) // NamedParams enables the use of named parameters with any database by converting the query to use positional arguments type NamedParams map[string]interface{} // Parse replaces the named parameters with positional parameters and returns a slice of corresponding values func (np Name...
named.go
0.619126
0.404772
named.go
starcoder
package javo /* i2l == Operation Convert int to long == Format i2l == Forms i2l = 133 (0x85) == Operand Stack ..., value → ..., result == Description The value on the top of the operand stack must be of type int. It is popped from the operand stack and sign-extended to a long result. That result is pushed o...
javo/instructions_conversions.go
0.606498
0.651189
instructions_conversions.go
starcoder
package goquery import ( "code.google.com/p/cascadia" "exp/html" ) // Filter() reduces the set of matched elements to those that match the selector string. // It returns a new Selection object for this subset of matching elements. func (this *Selection) Filter(selector string) *Selection { return pushStack(this, w...
filter.go
0.83772
0.471406
filter.go
starcoder
package faker import ( "fmt" "strings" ) var ( phoneFormats = []string{ // International format "+1-{{areaCode}}-{{exchangeCode}}-####", "+1 ({{areaCode}}) {{exchangeCode}}-####", "+1-{{areaCode}}-{{exchangeCode}}-####", "+1.{{areaCode}}.{{exchangeCode}}.####", "+1{{areaCode}}{{exchangeCode}}####", /...
phone.go
0.573917
0.589303
phone.go
starcoder
package parser import ( "fmt" "log" "reflect" "strconv" ) // add returns the sum of a and b. func add(b, a interface{}) interface{} { av := reflect.ValueOf(a) bv := reflect.ValueOf(b) switch av.Kind() { case reflect.Int, reflect.Int8, reflect.Int16, reflect.Int32, reflect.Int64: switch bv.Kind() { case r...
pkg/parser/arithmetics.go
0.743168
0.539287
arithmetics.go
starcoder
package core import ( "math" ) type WorldView struct { CameraPosition Vector LookAtPoint Vector FocalLength float64 ux, uy, zero Vector ray Vector } func (wv *WorldView) Init() { view := wv.LookAtPoint.Plus(wv.CameraPosition.Neg()) n := view.Times(1.0 / view.Length()) wv.ux, wv.uy = Cros...
unicornify/core/worldview.go
0.698021
0.599485
worldview.go
starcoder
package nistec import ( "crypto/elliptic/internal/fiat" "crypto/subtle" "errors" ) var p224B, _ = new(fiat.P224Element).SetBytes([]byte{0xb4, 0x05, 0x0a, 0x85, 0x0c, 0x04, 0xb3, 0xab, 0xf5, 0x41, 0x32, 0x56, 0x50, 0x44, 0xb0, 0xb7, 0xd7, 0xbf, 0xd8, 0xba, 0x27, 0x0b, 0x39, 0x43, 0x23, 0x55, 0xff, 0xb4}) var p2...
src/crypto/elliptic/internal/nistec/p224.go
0.574872
0.435361
p224.go
starcoder
package object import ( "math" "github.com/gopherd/doge/math/mathutil" "github.com/gopherd/three/core" ) // PerspectiveCamera represents a perspective camera type PerspectiveCamera struct { cameraImpl fov, aspect core.Float filmGauge core.Float // width of the film (default in millimeters) filmOffset core...
object/camera_perspective.go
0.908934
0.544499
camera_perspective.go
starcoder
package tsl var emptyRange *immutableRange func init() { emptyRange = &immutableRange{ basicRange: basicRange{ first: nil, last: nil, elements: nil, }, } EmptyRange = emptyRange } // immutableRange is a SortedRange whose Elements never change. type immutableRange struct { basicRange } // new...
immutable.go
0.740174
0.709296
immutable.go
starcoder
package pt import "github.com/rannoch/cldr" var currencies = []cldr.Currency{ {Currency: "ADP", DisplayName: "Peseta de Andorra", Symbol: ""}, {Currency: "AED", DisplayName: "Dirrã dos Emirados Árabes Unidos", Symbol: "AED"}, {Currency: "AFA", DisplayName: "Afegane (1927–2002)", Symbol: ""}, {Currency: "AFN", Dis...
resources/locales/pt/currency.go
0.510496
0.411939
currency.go
starcoder
package iolimits import ( "io" "github.com/pkg/errors" ) // All constants below are intended to be used as limits for `ReadAtMost`. The // immediate use-case for limiting the size of in-memory copied data is to // protect against OOM DOS attacks as described inCVE-2020-1702. Instead of // copying data until runnin...
vendor/github.com/containers/image/v5/internal/iolimits/iolimits.go
0.771155
0.446133
iolimits.go
starcoder
package CloudForest /* WRFTarget wraps a numerical feature as a target for us weigted random forest. */ type WRFTarget struct { CatFeature Weights []float64 } /* NewWRFTarget creates a weighted random forest target and initializes its weights. */ func NewWRFTarget(f CatFeature, weights map[string]float64) (abt *WRF...
wrftarget.go
0.736969
0.411879
wrftarget.go
starcoder
package nn import ( "encoding/json" tsr "../tensor" ) // PoolingLayer is a layer that pools data into a smaller form. type PoolingLayer struct { inputShape LayerShape outputShape LayerShape inputs *tsr.Tensor outputs *tsr.Tensor PoolSize int Pooling PoolingFunction } // NewPoolingLayer crea...
nn/poolingLayer.go
0.863909
0.482734
poolingLayer.go
starcoder
package common import "fmt" // MT is a PRNG implementing the Mersenne Twister algorithm. // See https://en.wikipedia.org/wiki/Mersenne_Twister for details and pseudocode. type MT struct { mt []uint64 index int lmask uint64 umask uint64 params *MTParams } func newMT(params *MTParams, seed uint64) *MT { ...
common/prng.go
0.73173
0.434221
prng.go
starcoder
package smd import ( "errors" "fmt" "math" "github.com/gonum/floats" "github.com/gonum/matrix/mat64" ) // BPlane stores B-plane parameters and allows for differential correction. type BPlane struct { Orbit Orbit BR, BT, LTOF float64 goalBT, goalBR, goalLTOF float64 tolBT, tolB...
assists.go
0.749912
0.49469
assists.go
starcoder
package main import ( "fmt" "math" "math/rand" "os" ) // Stolen from gobyexample.com func check(e error) { if e != nil { panic(e) } } func RandomInUnitSphere() Vector { p := Vector{} for { p = Vector{ rand.Float64(), rand.Float64(), rand.Float64(), }.MultiplyFloat( 2, ).SubtractVector( ...
main.go
0.529263
0.528594
main.go
starcoder
package ipmi import ( "fmt" "strings" ) // 35.13 Get Sensor Event Status Command type GetSensorEventStatusRequest struct { SensorNumber uint8 } // For event boolean value, true means the event has occurred. type GetSensorEventStatusResponse struct { EventMessagesDisabled bool SensorScanningDisabled bool Readi...
cmd_get_sensor_event_status.go
0.636127
0.432423
cmd_get_sensor_event_status.go
starcoder
package fakeexec import ( "fmt" "os" "os/exec" "strconv" "strings" "testing" "github.com/stretchr/testify/require" ) // Expect controls the expected execution of a command type Expect struct { f func(t testing.TB, actualCommand string, actualArgs ...string) exitCode int stdout string } // E repre...
internal/fakeexec/fakeexec.go
0.610802
0.444203
fakeexec.go
starcoder
package rtda import ( "math" "jvm/pkg/rtda/heap" ) type Slot struct { num int32 ref heap.Object } type LocalVars []Slot func NewLocalVars(maxLocals uint) LocalVars { if maxLocals > 0 { return make([]Slot, maxLocals) } return nil } func (this LocalVars) SetInt(index uint, val int32) { this[index].num = v...
pkg/rtda/local_vars.go
0.656658
0.47384
local_vars.go
starcoder
package gogl import ( "github.com/go-gl/mathgl/mgl32" "math" ) type Direction int const ( Forward Direction = iota Backward Left Right Nowhere ) type Camera struct { Position mgl32.Vec3 Front mgl32.Vec3 Up mgl32.Vec3 Right mgl32.Vec3 WorldUp mgl32.Vec3 Yaw float32 Pitch ...
gogl/camera.go
0.719581
0.552117
camera.go
starcoder
package attr const UTR = `http://www.xbrl.org/utr/utr.xml` const LRR = `http://www.xbrl.org/2003/xbrl-role-2003-07-31.xsd` const IX = `http://www.xbrl.org/2013/inlineXBRL` const IXT = `http://www.xbrl.org/inlineXBRL/transformation/2015-02-26` const XSD = `http://www.w3.org/2001/XMLSchema` const XLINK = `http://www.w3....
pkg/attr/literals.go
0.585338
0.503113
literals.go
starcoder
package conv import ( "strconv" "github.com/vividvilla/simplesessions" ) // Int converts interface to integer. func Int(r interface{}, err error) (int, error) { if err != nil { return 0, err } switch r := r.(type) { case int: return r, nil case int64: x := int(r) if int64(x) != r { return 0, strco...
conv/conv.go
0.526586
0.403126
conv.go
starcoder
package path import ( "github.com/google/cayley/graph" "github.com/google/cayley/graph/iterator" "github.com/google/cayley/quad" ) func isMorphism(nodes ...string) morphism { return morphism{ Name: "is", Reversal: func() morphism { return isMorphism(nodes...) }, Apply: func(qs graph.QuadStore, it graph...
graph/path/morphism_apply_functions.go
0.632957
0.443661
morphism_apply_functions.go
starcoder
package api // IAffineTransform represents 2D transforms type IAffineTransform interface { Components() (float64, float64, float64, float64, float64, float64) // ToIdentity sets the transform to an identity matrix ToIdentity() // -------------------------------------------- // Setters // -----------------------...
api/iaffinetransform.go
0.71413
0.523116
iaffinetransform.go
starcoder
package mmark import "bytes" // returns asidequote prefix length func (p *parser) asidePrefix(data []byte) int { i := 0 for i < 3 && data[i] == ' ' { i++ } if data[i] == 'A' && data[i+1] == '>' { if data[i+2] == ' ' { return i + 3 } return i + 2 } return 0 } // parse an aside fragment func (p *pars...
vendor/github.com/miekg/mmark/quote.go
0.539711
0.444565
quote.go
starcoder
package rdf import ( "github.com/meowpub/meow/ld" ) // The first item in the subject RDF list. func GetFirst(e ld.Entity) interface{} { return e.Get(Prop_First.ID) } func SetFirst(e ld.Entity, v interface{}) { e.Set(Prop_First.ID, v) } // The object of the subject RDF statement. func GetObject(e ld.Entity) interfa...
ld/ns/rdf/properties.gen.go
0.668123
0.462412
properties.gen.go
starcoder