id stringlengths 1 3 | code_masked stringlengths 797 182k | target stringlengths 3 41 |
|---|---|---|
0 |
import {checkAvifFeature} from "./check-avif-feature.js";
import {checkWebpFeature} from "./check-webp-feature.js";
type FormatType = "avif" | "webp" | null;
const promisesPool: ((value: FormatType) => void)[] = [];
const resolvePromises = (format: FormatType): void => {
promisesPool.forEach((resolve) => resol... | isWebp |
1 | import * as v from 'valibot'
type Message<
Type extends string,
Payload extends object | undefined = undefined,
> = Payload extends object ? { type: Type } & Payload : { type: Type }
export type MessageToHostApp =
| Message<'request-auth-token'>
| Message<'request-query-params'>
| Message<'set-query-params'... | event |
2 | import * as yargs from 'yargs';
export class CliApp {
private args: yargs.Argv;
constructor() {
this.init();
}
public init(): void {
// Init as described in: https://github.com/yargs/yargs/blob/master/docs/advanced.md#using-the-non-singleton-interface
this.args = yargs((process... | dateRegex |
3 | import { u128, VM, Context as VMContext } from "near-sdk-as";
import {
name, symbol, decimals,
totalSupply, initialize, balanceOf, transfer,
allowance, approve, transferFrom
} from "../erc20";
import { getNewestTransferEvent, getNewestApprovalEvent } from "../events"
// accounts
const zero = "0x0"; ... | event2 |
4 | import { describe, it, expect, vi, beforeEach, afterEach } from 'vitest';
import { apiCall } from './api';
// Mock the auth module - move this before any constants
vi.mock('./auth', () => {
return {
refreshToken: vi.fn(),
};
});
// Get the mocked function after vi.mock
const mockRefreshToken = vi.mocked(await... | errorResponse |
5 | import { EmotivePoint } from "../shared/models/emotivePoint";
import { Face } from "../shared/models/faces";
import * as FaceApi from "../shared/faceapi";
import * as emojiLookup from "emoji-dictionary";
const EMOJIS_TO_TRAIN = [
"☺️",
"🤓",
"😃",
"😆",
"😉",
"😍",
"😎",
"😐",
"😕",
"😖",
"😘",
... | array |
6 | class Case {
CaseID: number;
DTCreated: Date;
DTReceived: Date;
DTClosed: Date;
DTAbandoned: Date;
CustomerFirstName: string;
CustomerLastName: string;
CustomerUserID: string;
CustomerComputerName: string;
CustomerPhone: string;
CustomerEmail: string;
SupportCategory: st... | hostAndPort |
7 | import {Component} from '@angular/core';
import {StompService} from 'ng2-stomp-service';
import {Subscription} from 'rxjs';
@Component({
selector: 'app-root',
templateUrl: './app.component.html',
styleUrls: ['./app.component.css']
})
export class AppComponent {
connected = false;
greetings = new Array<string... | data |
8 | // This code was generated by the angular-custom-elements-schematic. Any changes will be overwritten next time it runs.
import { Component, ElementRef, ChangeDetectionStrategy, ChangeDetectorRef, NgZone, Input, inject } from '@angular/core';
import { AccordionComponent as AccordionComponentCustomElement, defineAccordi... | changeDetectorRef |
9 | import { urlGenerator } from './urlGenerator'
export const getParentTitle = (slug: string, allMdx?: any) => {
const allContent =
allMdx &&
allMdx.edges &&
allMdx.edges.map((mdx: any) => ({
...mdx.node.fields,
title: mdx.node.frontmatter.title,
staticLink: mdx.node.frontmatter.staticLink... | slicedParts |
10 | import * as jspb from 'google-protobuf';
import { Event, MethodEnum } from './event_pb';
export class Context {
private bytes: Uint8Array;
constructor(bytes: Uint8Array) {
this.bytes = bytes;
}
toObject(pb: any): any {
const m = pb.deserializeBinary(this.bytes);
return m.toObject();
}
}
export interface ... | buffer |
11 | import { KeyRotator } from "@economist/aws-key-rotator";
import { IAM } from "aws-sdk";
import { createCircleCIHandler } from "./circleci";
import { RotationJob } from "./jobs";
export function batchRotateKeys(iam: IAM, jobs: RotationJob[]) {
const [MASK] : Promise<void>[] = [];
const failedJobs: { user: stri... | promises |
12 | import fs from 'fs'
import path from 'path'
import matter from 'gray-matter'
const postsDirectory = path.join(process.cwd(), 'content/blogs')
export interface Source {
title: string;
url: string;
author?: string;
publishedDate?: string;
}
export interface BlogPost {
slug: string
title: string... | allPostsData |
13 | import { Assets, Exports } from './typings/assets.typings';
import sendRequest from './utils/send-request';
import endpoints from './utils/endpoints';
/**
* Gets all asset paths in the current game version
* @returns Array of paths
*/
async function getAssets(): Promise<Assets> {
return await sendRequest<Assets>(... | parsed |
14 | import { Component, OnInit } from '@angular/core';
import { Web3Service } from '../../../services/web3/web3.service';
import { PersonService } from '../../../services/person/person.service';
import { AssetService } from '../../../services/asset/asset.service';
declare let require: any;
const assetListArtifacts = requi... | recover1 |
15 | const timeMessage = '⏰ The checks finished in';
console.time(timeMessage);
// Load config at the beginning
import { FileOption, getConfig } from './utils/config.js';
const config = await getConfig();
import fs from 'fs';
import path from 'path';
import { VFile } from 'vfile';
import { VFileMessage } from 'vfile-messag... | messageSummary |
16 | import { indexSearchParameterBundle, indexStructureDefinitionBundle } from '@medplum/core';
import { readJson, SEARCH_PARAMETER_BUNDLE_FILES } from '@medplum/definitions';
import { Bundle, Claim, HumanName, SearchParameter } from '@medplum/fhirtypes';
import { MockClient } from '@medplum/mock';
import { createWriteStre... | response |
17 | import { GameState } from "./models/GameState.ts";
import BulletController from "./controllers/BulletController.ts";
import EnemyController from "./controllers/EnemyController.ts";
import Player from "./models/Player.ts";
const background = new Image();
background.src = "assets/images/background.jpg";
export class Ga... | textOffset |
18 | import { setRequestLocale } from 'next-intl/server';
import { notFound } from "next/navigation";
import { buildIndexJSON } from "@/blogs/post"
import { locales } from "@/navigation"
export async function generateStaticParams() {
return locales.map((locale) => ({locale}))
}
export async function GET(req: Request, ... | props |
19 | import * as functions from "firebase-functions";
import {initializeApp} from "firebase-admin/app";
import {getFirestore} from "firebase-admin/firestore";
const app = initializeApp();
const db = getFirestore(app);
exports.assistantVotesCreatedListener = functions.firestore
.document("assistantVotes/{assistantVoteI... | pAssistantVote |
20 | import { HANDLE_CHECKS } from "./constants.js";
import logger from "./logger.js";
import {
createAccountReport,
createAccountComment,
createAccountLabel,
} from "./moderation.js";
export const checkHandle = async (
did: string,
handle: string,
time: number,
) => {
// Get a list of labels
const labels: ... | checkList |
21 | /* eslint-disable @typescript-eslint/no-explicit-any */
import { JestChrome } from "jest-chrome/types/jest-chrome"
import { sendMessage } from "./sendMessage"
describe("sendMessage", () => {
it("should send the message correctly", async () => {
const message: Message = { type: "rating", subType: "get" }
... | promiseResult |
22 | import {
BASE_URL,
COUNTERS_ENDPOINT,
LOGS_ENDPOINT,
TIMERS_ENDPOINT,
} from "./constants";
import { ConsoleTransport, MonitoringAPITransport } from "./transports";
/**
* DEPRECATED: will be removed once versioning is handled
*/
class Logger {
transports: ILoggingTransport[];
constructor(apiKey: string,... | useConsoleTransport |
23 | import { MiddlewareConsumer, Module, NestModule } from '@nestjs/common';
import { TypeOrmModule } from '@nestjs/typeorm';
import { AppController } from './app.controller';
import { AppService } from './app.service';
import { CommonModule } from './module/common/common.module';
import { AuthModule } from './module/auth/... | consumer |
24 | /*
Copyright 2021 The Matrix.org Foundation C.I.C.
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 ... | redactFn |
25 | import {Body, Controller, ForbiddenException, Get, HttpCode, Inject, Post} from '@nestjs/common'
import {LarkBotService} from './lark-bot.service'
import {LARK_BOT} from './lark-bot.constants'
import {BotMessageDto, SessionResponseDto} from './lark-bot.dto'
@Controller('lark')
export class LarkBotController {
@Injec... | body |
26 | /* eslint-disable no-console */
import * as jp from "jsonpath";
import * as _ from "lodash"
import payload from "./payload";
const jsonPaths: Array<string> = [
// '$',
// '$.level_0_string',
'$.name',
'$.description',
'$.packages[:].tour.itinerary',
// '$.*'
];
const pathMap= {}
const allPath... | keepMap |
27 | import nodeHashcash from './index';
const sleep = (time: number) => new Promise(r => setTimeout(r, time));
describe('NodeHashcash', () => {
const SECRET = 'my secret';
it('should generate random tokens', () => {
const firstValue = nodeHashcash['generateToken'](8);
const [MASK] = nodeHashcash... | secondValue |
28 | /**
* @copyright 2017 <NAME>
* @license Apache License, Version 2.0
* @see NOTICE file
*/
import {Constructable} from '../types/constructable';
import {instantiateFactories} from './instantiate-factories';
import {InjectionRecord} from '../interfaces/injection-record';
import {InjectionCycleError} from '../errors/i... | instanceMap |
29 | import { Component, Input, ViewChild, Optional } from '@angular/core';
import { Color, BaseChartDirective } from 'ng2-charts';
import { FilterValues } from '../filter/filtervalues.model';
import { StatisticsSourceInterface } from '../../services/statistics-source.interface';
import { Subscription, Observable, Subject }... | index |
30 | import { Logger } from '../logger/Logger';
/**
* 适配屏幕工具类
*/
export class FitScreenUtil {
// 当前设计分辨率
private curDR: any = null;
/**
* 适配屏幕
* @param canvasNode 画布节点
*/
fitScreen(canvasNode: cc.Node) {
if (cc.sys.isNative) {
this.fitNativeScreen(c... | aspect2 |
31 | import { ServerResponse } from 'http'
import {
TOKEN_RENEW_LIMIT,
DEVICES_COUNT_LIMIT,
EXPIRATION_CHECK_INTERVAL,
} from '@core/config'
import { User } from '@core/core-types'
import { createToken, parseToken } from '@core/token'
import { setToken, unsetToken } from '@core/cookie'
import { hashString } from '@c... | userId |
32 | import {IRepository} from "./interfaces/repository.interface.js";
import {User} from "../domain/user.js";
import {Bet} from "../domain/bet.js";
import {Dice} from "../domain/dice.js";
export class CreateBetUseCase {
constructor(private userRepository: IRepository<User>, private betRepository: IRepository<Bet>) {
... | updatedBalance |
33 | import { AbstractCommandModule, Message } from "botyo-api";
const Spotify = require('spotify-web-api-node');
export default class SpotifyCommand extends AbstractCommandModule
{
private readonly market: string;
private readonly spotify: any;
private readonly authPromise: Promise<void>;
private tokenExp... | tokenExpiresIn |
34 | import type {
UseQueryStoreResult,
MutationStoreResult,
} from '@sveltestack/svelte-query';
import { QueryClient, useQuery, useMutation } from '@sveltestack/svelte-query';
import { getVersion } from '@tauri-apps/api/app';
import { appDir } from '@tauri-apps/api/path';
import { type FsOptions, readTextFile, createDi... | filePath |
35 | import * as assert from 'assert';
import * as vscode from 'vscode';
import { getDocUri, activate } from './helper';
// You can import and use all API from the 'vscode' module
// as well as import your extension to test it
// import * as myExtension from '../../extension';
suite('Extension Test Suite', function () {
... | lineno1 |
36 | import { Item } from "../../components/products/item";
const items = new Array<Item>(
{
id: 1,
name: "Gura phone case",
description: "A Gawr Gura phone case, damn gura is too smart ",
img_cover:
"https://i.pinimg.com/originals/71/96/cf/7196cfdf85e22579fe08e82385d4061a.png",
fav: true,
},
... | req |
37 | import { createSlice, createAsyncThunk, createEntityAdapter } from '@reduxjs/toolkit';
import { Book, getBookList } from 'src/apis/booksApi';
import { RootState } from '../store';
const booksAdapter = createEntityAdapter<Book>();
interface InitialState {
status: 'idle' | 'loading' | 'succeeded' | 'failed';
error:... | response |
38 | import axios from 'axios';
import {
Message as DiscordMessage,
Channel as DiscordChannel,
} from 'discord.js';
import { axiosErrorHandler } from './errorHandler';
const { DISCORD_BOT_TOKEN = '' } = process.env;
const headers = {
Authorization: `Bot ${DISCORD_BOT_TOKEN}`,
'Content-Type': 'application/json',
};... | message3 |
39 | import * as React from 'react';
import * as ReactDom from 'react-dom';
import { Version } from '@microsoft/sp-core-library';
import {
IPropertyPaneConfiguration,
PropertyPaneTextField,
PropertyPaneToggle
} from '@microsoft/sp-property-pane';
import { BaseClientSideWebPart } from '@microsoft/sp-webpart-base';
impo... | element |
40 | import * as secp from "https://deno.land/x/secp256k1/mod.ts";
import { Buffer } from "https://deno.land/std/node/buffer.ts";
async function test() {
const [MASK] = Buffer.alloc(32);
var i = 0;
for (i = 0; i < [MASK] .length; i++) {
[MASK] [i] = Math.random() * 256;
}
//.toString("hex");
console.log... | privateKey |
41 | import "./index.css";
import Stats from "stats.js";
import * as BABYLON from "@babylonjs/core";
//import "@babylonjs/loaders/glTF";
import Level from "./level";
class Game {
private static mInstance: Game | null = null;
mStats: Stats | null = null;
//mLog: Log | null = null;
mEngine: BABYLON.Engine ... | canvasElement |
42 | import { createClient } from 'microcms-js-sdk';
export type worksItem = {
id: string;
createdAt: string;
updatedAt: string;
publishedAt: string;
revisedAt: string;
title: string;
thumbnail: {
url: string;
height: number;
width: number;
};
isWorks: string[]; /... | item |
43 | import { Component } from '@angular/core';
import { MyRandomNumberComponent } from './my.random.number.component';
import { DefaultService } from 'hello-world-api/api/default.service';
import { HelloWorldResponse } from 'hello-world-api/model/helloWorldResponse';
// HttpClient lives in a separate Angular module, so we'... | tmpName |
44 | import * as iam from '@aws-cdk/aws-iam';
import * as lambda from '@aws-cdk/aws-lambda';
import * as logs from '@aws-cdk/aws-logs';
import * as cdk from '@aws-cdk/core';
// eslint-disable-next-line import/prefer-default-export
export class Mem2CwStack extends cdk.Stack {
constructor(scope: cdk.Construct, id: string, ... | props |
45 | /*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
~ Copyright 2020 Adobe Systems Incorporated
~
~ 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
~
~ htt... | routerLinkInstance |
46 | import initSections, { goToSection } from "../sections";
import { allCardDataBase, UniqCard } from "../cards";
import initClient from "./thirdWebClient";
import initPrivateKey, {
generateNewPrivateKey,
setPrivateKey,
getPublicKey,
} from "./keys";
import { checkFile, setFile, getDeckContent, saveFile } from "./m... | cardData |
47 | import {
collection,
doc,
addDoc,
updateDoc,
deleteDoc,
getDoc,
getDocs,
query,
where,
orderBy,
limit,
startAfter,
DocumentData,
QueryDocumentSnapshot,
serverTimestamp,
Timestamp
} from "firebase/firestore";
import { db } from "./firebase";
import { ReportPost, ReportThread... | limitCount |
48 | import { Component, OnInit, Injectable } from '@angular/core';
import { OhmIndexService } from '../ohm-index.service';
import {SelectionModel} from '@angular/cdk/collections';
import {FlatTreeControl} from '@angular/cdk/tree';
import {BehaviorSubject} from 'rxjs';
import {MatTreeFlatDataSource, MatTreeFlattener} from '... | startIndex |
49 | import { BotBuilder, BotBuilderExt } from '@telefonica/bot-core';
import http = require('http');
export default [
dialog
];
function dialog(session: BotBuilder.Session, [MASK] : any, next: Function) {
let groupEntity: BotBuilder.IEntity = BotBuilder.EntityRecognizer.findEntity( [MASK] .entities, 'laura.group... | args |
50 | import type { UserFromGetMe } from "grammy/types"; // Types
import type { IJSONConfig } from "./utilities/types.ts";
import path from "path"; // stdlib
import { Bot } from "grammy"; // 3rd-party deps
import { ReadJson, CreateJsonFromDict } from "./utilities/json.ts";... | botInfo |
51 | import { graphql } from "@octokit/graphql";
import { map, of } from "rxjs";
const getEnv = () => {
const organization = process.env.ORGANIZATION as string;
const githubToken = process.env.GITHUB_TOKEN as string;
const projectNumber = parseInt(process.env.PROJECT_NUMBER as string);
const status = process.env.IT... | requestGraphql |
52 | ///<reference path="../node_modules/grafana-sdk-mocks/app/headers/common.d.ts" />
import _ from 'lodash';
import {WifiPlugQueryCtrl} from "./query_ctrl";
export default class WifiPlugDatasource {
id: number;
name: string;
url: string;
/** @ngInject */
constructor(instanceSettings, private backendSrv, priva... | results |
53 | import { storageGet } from 'stores/storage';
const FORCE_WHITELABEL = process.env.NEXT_PUBLIC_WHITELABEL; // 'jeoi.tkngate.com' || 'test.tkngate.com' || 'tachyon.tkngate.com' || example: 'www.hobbycartelnft.com'
const FORCE_PERMISSION_CONTRIB = null;
const TPP = process.env.NEXT_PUBLIC_TPP_SERVER || `https://mgate.... | urlStr |
54 | import {
exportToDirectory,
importDirectory,
cleanupSVG,
runSVGO,
deOptimisePaths,
scaleSVG,
resetSVGOrigin,
removeFigmaClipPathFromSVG,
convertSVGToMask,
} from '@iconify/tools';
import fs from "node:fs/promises";
import svgtofont from 'svgtofont';
import { createTTF } from 'svgtofont/lib/utils';
import pa... | exported |
55 | import { Injectable } from '@angular/core';
import {HttpClient} from '@angular/common/http';
import {AlertifyService} from './alertify.service';
import {City} from '../models/city';
import {Router} from '@angular/router';
import { Observable } from 'rxjs';
@Injectable({
providedIn: 'root'
})
export class CityServic... | cityId |
56 | import { shallowRef } from 'vue';
import { openDB, IDBPDatabase } from 'idb';
import router from '../router';
interface AssetDB {
assets: {
key: string;
value: Blob;
};
}
// 资产列表配置
const ASSET_LIST = {
sprite: [
'ax.png', 'bearman.png', 'blackbear.png', 'candle0.png', 'candle1.png',
'candle2.png... | reject |
RefineID-format TypeScript identifier recovery from The Stack v3
This public benchmark contains 1,000 examples from 1,000 source repositories and 3,029 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-typescript", 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
- 32