id stringlengths 1 3 | code_masked stringlengths 801 162k | target stringlengths 3 28 |
|---|---|---|
0 | package main
import (
"fmt"
"github.com/nsf/termbox-go"
"time"
"strings"
"math/rand"
)
var score = 0
var colon string = `
§
##§
§
##§
§
`
var upArrow string = `
§
- §
/@\ §
/@@@\ §
/@@@@@\§
§
§
`
var downArrow string = `
§
§
\@@@@@/§
\@@@/ §
\@/ §
- ... | msg |
1 | package main
import (
"log"
"os/exec"
"regexp"
"strconv"
"github.com/bluele/slack"
)
const (
webhook = "webHook"
)
func getTemp() float64 {
reg, err := regexp.Compile("[^0-9.]+")
if err != nil {
log.Fatal(err)
}
output, execErr := exec.Command("vcgencmd", " measure_temp").Output()
if execErr != nil {
... | tmp |
2 | package natsio
import (
"encoding/json"
"github.com/nats-io/nats.go"
"{{ cookiecutter.go_module_path.strip() }}/internal/config"
"github.com/rs/zerolog/log"
"io"
"os"
"sync"
"time"
)
type Nats struct {
Conn *nats.Conn
EncConn *nats.EncodedConn
once sync.Once
}
func Encoder(v io.Reader, ptr interface... | reconnectDelay |
3 | package main
import (
"bytes"
"encoding/json"
"flag"
"fmt"
"strings"
"time"
"github.com/aws/aws-lambda-go/lambda"
"github.com/aws/aws-sdk-go/aws"
"github.com/aws/aws-sdk-go/aws/awserr"
"github.com/aws/aws-sdk-go/aws/session"
"github.com/aws/aws-sdk-go/service/s3"
"github.com/aws/aws-sdk-go/service/s3/s3ma... | today |
4 | // Copyright (c) 2019, the Drone Plugins project authors.
// Please see the AUTHORS file for details. All rights reserved.
// Use of this source code is governed by an Apache 2.0 license that can be
// found in the LICENSE file.
package drone
import (
"encoding/json"
"fmt"
"os"
"path/filepath"
)
// RegistryType... | artifactFilePath |
5 | // Copyright 2020 arugal, <EMAIL>
//
// 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 required by applicable law or agreed to... | conf |
6 | package main
import (
"database/sql"
"fmt"
"log"
"net/http"
"os"
"github.com/gin-gonic/gin"
_ "github.com/lib/pq"
)
type URL struct {
Route string `json:"route"`
URL string `json:"url"`
}
func main() {
router := gin.Default()
router.Use(allowCORS())
// Define a GET endpoint
router.GET("/health", fun... | routeId |
7 | package main
import (
"strings"
"github.com/larsve/aoc2023/tools"
)
const (
one = "one"
two = "two"
three = "three"
four = "four"
five = "five"
six = "six"
seven = "seven"
eight = "eight"
nine = "nine"
)
var nbrs = [...]string{one, two, three, four, five, six, seven, eight, nine}
// nbrsToi1 is... | input |
8 | // Package main provides the entry point for the application. It loads the configuration, initializes the server, and starts the server.
package main
import (
"log"
"lemma/internal/app"
"lemma/internal/logging"
)
// @title Lemma API
// @version 1.0
// @description This is the API for Lemma markdown note taking ap... | cfg |
9 | package main
import (
"bufio"
"fmt"
"google.golang.org/api/youtube/v3"
"log"
"os"
"strings"
)
func lookupChannel(service *youtube.Service, reader *bufio.Reader) Channel {
title := quittingInput(reader, "Enter channel title")
request := service.Search.List([]string{"snippet"}).Type("channel").MaxResults(10).Q(... | choices |
10 | package main
import (
"context"
"flag"
"fmt"
"log"
"os"
"os/signal"
"syscall"
"time"
"github.com/spf13/viper"
"github.com/wureny/FluxGo/internal/gateway"
"github.com/wureny/FluxGo/internal/limiter"
"github.com/wureny/FluxGo/pkg/client"
)
var (
configFile string
)
func init() {
flag.StringVar(&configFi... | ctx |
11 | package door
import (
"strings"
"github.com/golang/protobuf/proto"
"github.com/gorilla/websocket"
)
// Context 内容.
type Context struct {
Method MethodEnum
door *Door
conn *websocket.Conn
data []byte
num uint32
filter int
path string
}
// Execute 执行过滤器.
func (context *Context) Execute(path strin... | eventBytes |
12 | // github.com/Guohuixixi/crawDemo/craw
package craw
import (
"bufio"
"fmt"
"io"
"io/ioutil"
"net/http"
"os"
"path"
"regexp"
"strconv"
"strings"
"time"
)
var (
// 正则查找图片的地址
reImg = `http://i.52desktop.cn:81/upimg/allimg/[^"]+?(\.((jpg)|(png)|(jpeg)|(gif)|(bmp)))`
)
// 读取链接中所有的内容
func GetPageStr(url strin... | pagebytes |
13 | package internal
import (
"encoding/json"
"errors"
"fmt"
"os"
"time"
)
type baseOptions struct {
VersionNumber int64 `json:"versionNumber"`
}
type optionsV1 struct {
VersionNumber int64 `json:"versionNumber"`
GlowVersion string `json:"glowVersion"`
}
type optionsV2 struct {
VersionNumber int64 `json:"v... | ov1 |
14 | package main
import twodee "../../libs/twodee"
type AudioSystem struct {
app *Application
bgmusic *twodee.Music
menumusic *twodee.Music
click *twodee.SoundEffect
sel *twodee.SoundEffect
bgmusicObserverId int
menumusicObserverId ... | audioSystem |
15 | // Copyright 2018 PingCAP, 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 required by applicable law or agreed to i... | leftMask |
16 | package main
import (
"encoding/json"
"flag"
"fmt"
"log"
"net/url"
"os"
"github.com/frobware/grawler"
)
var concurrency int
func init() {
flag.IntVar(&concurrency, "j", 50, "number of concurrent downloads")
}
var usage = func() {
fmt.Fprintf(os.Stderr, "%s [ -j <concurrency> ] URL\n", os.Args[0])
flag.Pr... | fetcher |
17 | package mydeployment
import (
"context"
"fmt"
corev1 "k8s.io/api/core/v1"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/apimachinery/pkg/labels"
"k8s.io/client-go/kubernetes"
k8slisters "k8s.io/client-go/listers/core/v1"
"k8s.io/client-go/tools/cache"
kubeclient "knative.dev/pkg/client/injection/kube/... | logger |
18 | package cmd
import (
"fmt"
"os"
"sort"
"strings"
"time"
"unicode"
"github.com/containers/common/pkg/report"
"github.com/containers/podman-bootc/pkg/utils"
"github.com/containers/podman/v5/pkg/bindings/images"
"github.com/containers/podman/v5/pkg/domain/entities"
"github.com/distribution/reference"
"github... | filters |
19 | // Copyright 2022 <NAME>
//
// 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 required by applicable law or agreed to in writ... | ctx |
20 | package main
import (
"fmt"
"github.com/qiuzhanghua/common/util"
"os"
)
func main() {
if len(os.Args) <= 1 {
fmt.Printf("Usage:\n %s <filename>\n", os.Args[0])
os.Exit(0)
}
hasMode := false
var replaceMode util.ReplaceMode = util.Keep
if os.Args[1] == "-b" {
replaceMode = util.BackSlash
hasMode = tr... | content |
21 | // Package bridge implements the Bridge design pattern.
// In the context of woodworking projects, the bridge is implemented through dependency inversion.
// The specific projects (Desk, Chair) are not tightly coupled to a particular tool set (ManualToolSet or PowerToolSet),
// but instead depend on an abstract interfa... | deskProject |
22 | package main
import (
"bytes"
"flag"
"io/fs"
"os"
"os/exec"
"path/filepath"
"strings"
"testing"
"time"
"github.com/google/go-cmp/cmp"
libtime "go.starlark.net/lib/time"
)
var update = flag.Bool("update", false, "update golden files")
type testFile struct {
path string
content []byte
}
type goldenTe... | tmpdir |
23 | package tools
import (
"fmt"
"log"
"time"
"os"
"runtime"
"io"
"net/http"
"regexp"
"github.com/gorilla/websocket"
)
type WS struct {
Server *http.Server
Mux *http.ServeMux
Addr string
DemoPath string
Repo string
}
type RequestJSON struct {
Command string
Text string
}
type ResponseJSON struct {
Sta... | filepath |
24 | // Author: yann
// Date: 2021/9/27 3:21 下午
// Desc:
package utils
import (
"fmt"
"sync"
"sync/atomic"
"time"
)
// 如果传入任务超时返回的错误信息
var ErrScheduleTimeout = fmt.Errorf("schedule error: timed out")
// 线程池模型
type GoPool struct {
sem chan struct{} //线程池队列
work chan func() //任务队列
stop chan int
min uint32 //最小... | opt |
25 | package embench
import (
"bufio"
_ "embed"
"fmt"
"os"
"riscv/tools/bootloader"
bld "riscv/tools/build-scripts"
"strconv"
"github.com/magefile/mage/sh"
)
const workDir = "./programs/compliance-tests/"
// Build builds test for a selected instruction
func Build(instruction string) error {
if err := compile(in... | referencePath |
26 | package main
import (
"fmt"
"log"
"net"
"net/http"
_ "net/http/pprof" // register in DefaultServerMux
"os"
"time"
"crypto/tls"
"github.com/grpc-ecosystem/go-grpc-middleware"
"github.com/grpc-ecosystem/go-grpc-middleware/logging/logrus"
"github.com/grpc-ecosystem/go-grpc-prometheus"
"github.com/improbable... | director |
27 | package main
import (
"bytes"
"fmt"
"io"
"strings"
)
// 字节读取
func main() {
//ByteReaderByte()
//RuneReaderReader()
ReaderLimited()
}
func ByteReaderByte() {
var ch byte
fmt.Println("输入:")
fmt.Scanf("%c\n", &ch)
[MASK] := new(bytes.Buffer)
err := [MASK] .WriteByte(ch)
if err == nil {
fmt.Println("写入... | buffer |
28 | package data
import (
"math"
"sort"
)
// a node in the kdtree
type kdnode struct {
axis int
data Interface
left *kdnode
right *kdnode
}
// KDTree implements SpacialTree using the kd-tree data structure.
type KDTree struct {
root *kdnode
dimensions int
items []Interface
}
// NewKDTree creates ... | sum |
29 | package main
import (
"bufio"
"encoding/base64"
"errors"
"fmt"
"github.com/realth000/ToGoTool/html"
"github.com/realth000/ToGoTool/http"
"net/url"
"os"
"path/filepath"
"regexp"
)
const (
mediaDownloadUrlPrefix = `https://res.wx.qq.com/voice/getvoice?mediaid=`
)
var (
mediaIdRegexp = regexp.MustCompile(`m... | info |
30 | package main
import (
"fmt"
"os"
"runtime"
"path/filepath"
"github.com/chainhero/heroes-service/blockchain"
"github.com/chainhero/heroes-service/web"
"github.com/chainhero/heroes-service/web/controllers"
)
// Fix empty GOPATH with golang 1.8 (see https://github.com/golang/go/blob/1363eeba6589fca217e155c829b2a7... | fabricSdk |
31 | package main
import (
"encoding/json"
"fmt"
"log"
"net/http"
"os"
"strings"
"time"
)
func startWebServer() {
pageHTML := getHtmlContent(htmlFile)
http.HandleFunc("/", func(w http.ResponseWriter, r *http.Request) {
w.Header().Set("Content-Type", "text/html")
fmt.Fprint(w, pageHTML)
})
http.HandleFunc("... | ipStatus |
32 | package lister
import (
"time"
corev1 "k8s.io/api/core/v1"
"k8s.io/client-go/informers"
"k8s.io/client-go/kubernetes"
leaselisterv1 "k8s.io/client-go/listers/coordination/v1"
listerv1 "k8s.io/client-go/listers/core/v1"
"k8s.io/client-go/tools/cache"
)
const (
resyncInt = 5 * time.Second
)
var (
factory inf... | lInformer |
33 | package analysis
import (
"fmt"
"strings"
"github.com/montanaflynn/stats"
)
func AvailableStats() map[string]func(stats.Float64Data) (float64, error) {
return map[string]func(stats.Float64Data) (float64, error){
"count": Count,
"mean": stats.Mean,
"std": stats.StandardDeviation,
"stds": stats.StandardDev... | maxNameLen |
34 | package gosilk
// #include <stdio.h>
// #include <silk/silk.h>
// #include <silk/sksite.h>
// #include <silk/skstream.h>
// #include <silk/utils.h>
// #include <silk/silk_types.h>
// #include <silk/rwrec.h>
// #cgo LDFLAGS: -lsilk
import "C"
import "fmt"
import "log"
import "time"
import "net"
import "encoding/binary"... | options |
35 | /*
Copyright 2022.
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 required by applicable law or agreed to in writing, software
distributed un... | mgr |
36 | package main
import (
"encoding/json"
"fmt"
"io/ioutil"
"net/http"
"github.com/aws/aws-lambda-go/events"
"github.com/aws/aws-lambda-go/lambda"
)
type Payload struct {
Url string `json:"url"`
ValueKeyName string `json:"value_key_name"`
MaxKeyName string `json:"max_key_name"`
}
func handler(reques... | upstreamStatusCode |
37 | // SPDX-FileCopyrightText: 2023 <NAME> <<EMAIL>>
//
// SPDX-License-Identifier: MIT
package main
import (
"log/slog"
"os"
"os/signal"
"path/filepath"
"syscall"
"github.com/wneessen/logranger"
)
const (
// LogErrKey is the keyword used in slog for error messages
LogErrKey = "error"
)
func main() {
logger :... | signalChan |
38 | package controllers
import (
"encoding/json"
"rustdesk-api-server/app/dto"
"rustdesk-api-server/app/services"
"rustdesk-api-server/utils/beegoHelper"
"strings"
"strconv"
)
var Address = new(AddressBookController)
type AddressBookController struct {
BaseController
}
// 查看地址谱列表
func (ctl *AddressBookController... | tokens |
39 | package raftnode
import (
"encoding/json"
"errors"
"fmt"
"net"
"os"
"path/filepath"
"strings"
"time"
"github.com/forjoin92/depot/store"
"github.com/hashicorp/raft"
"github.com/hashicorp/raft-boltdb"
)
type RaftNode struct {
id string
peers []string
dataDir string
snapshotPath string
raftDBPa... | clusters |
40 | package client
import (
"bytes"
"crypto/tls"
"encoding/json"
"fmt"
"io"
"io/ioutil"
"net/http"
"net/url"
"os"
"strconv"
"github.com/drone/drone/model"
"golang.org/x/net/proxy"
"golang.org/x/oauth2"
)
const (
pathPull = "%s/api/queue/pull/%s/%s"
pathWait = "%s/api/queue/wait/%d"
pathStream =... | values |
41 | /*
* @Author: <NAME>
* @Date: 2021-03-10 17:02:24
* @LastEditTime: 2021-03-10 17:45:17
* @LastEditors: Please set LastEditors
* @Description: 系统接口
* @FilePath: \readygo\api\system.go
*/
package api
import (
"context"
"readygo/apistruct"
"readygo/permission/permutil"
"github.com/cloudwego/hertz/pkg/app"
)... | err |
RefineID-format Go identifier recovery from The Stack v3
This public benchmark contains 1,000 examples from 1,000 source repositories and 3,222 masked identifier positions. Each example is a full source file with one chosen identifier name masked at every eligible identifier token position. The target is the original name.
Format and use
test.csv has no header and exactly three columns in the same order as the
original RefineID benchmark: id, code_masked, target. IDs are 0 through
999. Each target position is the literal, whitespace-delimited
[MASK]. test.parquet holds the identical rows with named string columns and
is the default Hugging Face test split:
from datasets import load_dataset
ds = load_dataset("D4vidHuang/refineid-stack-v3-go", split="test")
assert len(ds) == 1000
provenance.jsonl is aligned by ID and records the upstream repository, commit,
file path, content ID, detected SPDX licenses, source revision, source text hash,
and the half-open Unicode character spans used for masking. manifest.json
records checksums, parameters and corpus-level counts.
Construction and interpretation
Source: HuggingFaceCode/stack-v3-train
at commit 8f3f25d86e44fd691428131efd17af75d4716499. We use the upstream PII-redacted,
quality-filtered train corpus and accept only files marked permissive with
detected licenses. Vendored files, short/oversized files, parse failures,
ambiguous identifier uses, and files with a few obvious remaining sensitive
patterns are excluded. Candidates whose target spelling remains visible in
comments, strings, or other code are also excluded. A seeded Parquet traversal selects at most one
example per repository for this language. This is a deterministic convenience
sample, not a uniform random sample of all Stack v3 files. See the manifest
for the exact seed and scan boundary.
The source is a single code snapshot. These examples evaluate identifier name recovery; they are not observed before/after rename commits. Syntax-tree filters reduce false targets, but they do not prove compiler-resolved binding, compilation, or behavior. Original RefineID has a different source and length/ site distribution, so scores across the two datasets require separate reporting.
License and removal
The Stack v3 collection is ODC-By. Each source file retains its original license;
this dataset does not assign one blanket license to the underlying code. Check the per-row
detected_licenses and upstream repository before reuse. License detection
and PII redaction are imperfect. The Stack v3 card documents its
opt-out process. We pin an
upstream release and will review new opt-outs before future republishes.
Citation
Please cite The Stack v3 dataset card and the original RefineID paper when using this benchmark.
- Downloads last month
- 39