crossfile_context_retrievalwref dict | prompt stringlengths 676 22k | right_context stringlengths 0 29.4k | metadata dict | crossfile_context_retrieval dict | groundtruth stringlengths 6 470 |
|---|---|---|---|---|---|
{
"list": [
{
"filename": "src/apiDebug.ts",
"retrieved_chunk": " response: Response;\n};\nexport const apiDebug = ({\n init,\n options,\n durationTime,\n getBody,\n response,\n}: ApiDebug) => {\n if (process.env.DEBUG !== 'true') {",
"score": 16.352674382866905
},
{
"filena... | import { RequestInfo, RequestInit, Response } from 'node-fetch';
import { cloneResponse } from './cloneResponse';
import { timeSpan } from './timeSpan';
import { apiDebug }from './apiDebug';
import { apiReport } from './apiReport';
import { getRequestMock, saveRequestMock } from './apiCache';
const fetch = (url: URL ... |
init,
options,
getBody,
response,
json,
text,
});
const { responseCopy } = await cloneResponse(response, text);
return responseCopy;
});
};
| {
"context_start_lineno": 0,
"file": "src/apiWithLog.ts",
"groundtruth_start_lineno": 70,
"repository": "entria-apiWithLog-be8c368",
"right_context_start_lineno": 71,
"task_id": "project_cc_typescript/17"
} | {
"list": [
{
"filename": "src/apiDebug.ts",
"retrieved_chunk": " return;\n }\n // eslint-disable-next-line\n const { agent, headers, ...optionsWithoutAgent } = options;\n const cleanHeaders = Object.keys(headers || {}).reduce((acc, key) => {\n if (!headers || ignoredHeaders.includes(key)) {... | await apiReport({ |
{
"list": [
{
"filename": "src/apiCache.ts",
"retrieved_chunk": " try {\n json = JSON.parse(text);\n } catch (err) {}\n if (json) {\n return {\n json,\n };\n }\n return {\n text,",
"score": 10.078164173943478
}... | import { RequestInfo, RequestInit, Response } from 'node-fetch';
import { cloneResponse } from './cloneResponse';
import { timeSpan } from './timeSpan';
import { apiDebug }from './apiDebug';
import { apiReport } from './apiReport';
import { getRequestMock, saveRequestMock } from './apiCache';
const fetch = (url: URL ... |
apiDebug({
init,
options,
durationTime,
getBody,
response,
});
await apiReport({
init,
options,
getBody,
response,
json,
text,
});
const { responseCopy } = await cloneResponse(response, text);
return responseCopy;
});
};
| {
"context_start_lineno": 0,
"file": "src/apiWithLog.ts",
"groundtruth_start_lineno": 60,
"repository": "entria-apiWithLog-be8c368",
"right_context_start_lineno": 61,
"task_id": "project_cc_typescript/25"
} | {
"list": [
{
"filename": "src/apiReport.ts",
"retrieved_chunk": "export const apiReport = async ({\n init,\n options,\n getBody,\n response,\n json,\n text,\n}: ApiReport) => {\n const canReport =\n typeof options?.shouldReport === 'boolean' ? options.shouldReport : true;",
"score": 1... | await saveRequestMock(init, options, text, response); |
{
"list": [
{
"filename": "src/apiCache.ts",
"retrieved_chunk": "export const saveRequestMock = async (\n init: RequestInfo,\n options: RequestInit,\n text: string,\n response: Response,\n) => {\n if (process.env.WRITE_MOCK !== 'true') {\n return;\n }\n // only save ok requests 200",
"... | import { RequestInfo, RequestInit, Response } from 'node-fetch';
import { cloneResponse } from './cloneResponse';
import { timeSpan } from './timeSpan';
import { apiDebug }from './apiDebug';
import { apiReport } from './apiReport';
import { getRequestMock, saveRequestMock } from './apiCache';
const fetch = (url: URL ... |
apiDebug({
init,
options,
durationTime,
getBody,
response,
});
await apiReport({
init,
options,
getBody,
response,
json,
text,
});
const { responseCopy } = await cloneResponse(response, text);
return responseCopy;
});
};
| {
"context_start_lineno": 0,
"file": "src/apiWithLog.ts",
"groundtruth_start_lineno": 60,
"repository": "entria-apiWithLog-be8c368",
"right_context_start_lineno": 61,
"task_id": "project_cc_typescript/16"
} | {
"list": [
{
"filename": "src/apiCache.ts",
"retrieved_chunk": " };\n };\n // eslint-disable-next-line\n debugConsole({\n init,\n options: optionsWithoutAgent,\n ...getBody(),\n ok: response.ok,\n status: response.status,\n curl,",
... | saveRequestMock(init, options, text, response); |
{
"list": [
{
"filename": "src/api.ts",
"retrieved_chunk": " ReturnType<typeof appliedService>\n >\n for (const method of HTTP_METHODS) {\n const lowerMethod = method.toLowerCase() as Lowercase<HTTPMethod>\n service[lowerMethod] = appliedService(method)\n }\n return service\n}\nexport { e... | import { HTTP_METHODS } from './constants'
import * as subject from './api'
import * as z from 'zod'
import { HTTPMethod } from './types'
import { kebabToCamel } from './transforms'
const reqMock = vi.fn()
function successfulFetch(response: string | Record<string, unknown>) {
return async (input: URL | RequestInfo, ... |
expect(
typeof service[method.toLocaleLowerCase() as Lowercase<HTTPMethod>],
).toBe('function')
}
})
it('should return an API with enhancedFetch', async () => {
vi.spyOn(global, 'fetch').mockImplementationOnce(
successfulFetch({ foo: 'bar' }),
)
const service = subject.ma... | {
"context_start_lineno": 0,
"file": "src/api.test.ts",
"groundtruth_start_lineno": 329,
"repository": "gustavoguichard-make-service-e5a7bea",
"right_context_start_lineno": 330,
"task_id": "project_cc_typescript/114"
} | {
"list": [
{
"filename": "src/api.ts",
"retrieved_chunk": ") {\n const fetcher = makeFetcher(baseURL, baseHeaders)\n function appliedService(method: HTTPMethod) {\n return async <T extends string>(\n path: T,\n requestInit: ServiceRequestInit<T> = {},\n ) => fetcher(path, { ...reque... | for (const method of HTTP_METHODS) { |
{
"list": [
{
"filename": "src/utils/prepare-code.ts",
"retrieved_chunk": "import { ImportGroups } from '../types'\nexport const prepareCode = (importGroups: ImportGroups) => {\n let result = ''\n for (const importData of importGroups.libraries) {\n result += `${importData.raw}\\n`\n }\n result... | import config from '../config'
import { ImportData, ImportGroups, LibraryRule } from '../types'
const getImportDepth = (path: string) => {
return path.split('/').length
}
const asc = (a, b) => {
const depthA = getImportDepth(a.path)
const depthB = getImportDepth(b.path)
if (depthA !== depthB) {
return de... |
return {
libraries: sortLibraries(inputGroups.libraries),
aliases: sortAliases(inputGroups.aliases),
relatives: sortRelatives(inputGroups.relatives),
directRelatives: sortRelatives(inputGroups.directRelatives),
}
}
| {
"context_start_lineno": 0,
"file": "src/utils/sort-import-groups.ts",
"groundtruth_start_lineno": 120,
"repository": "crmapache-prettier-plugin-sort-react-imports-a237c21",
"right_context_start_lineno": 121,
"task_id": "project_cc_typescript/32"
} | {
"list": [
{
"filename": "src/utils/split-imports-to-groups.ts",
"retrieved_chunk": " }\n }\n return {\n libraries,\n aliases,\n relatives,\n directRelatives,\n }\n}",
"score": 22.0318146366964
},
{
"filename": "src/utils/prepare-code.ts",
"retrieved_chunk"... | export const sortImportGroups = (inputGroups: ImportGroups) => { |
{
"list": [
{
"filename": "src/api.ts",
"retrieved_chunk": "}\n/**\n *\n * @param url a string or URL to be fetched\n * @param requestInit the requestInit to be passed to the fetch request. It is the same as the `RequestInit` type, but it also accepts a JSON-like `body` and an object-like `query` para... | import { typeOf } from './internals'
import { JSONValue, PathParams, SearchParams } from './types'
/**
* @param url a string or URL to which the query parameters will be added
* @param searchParams the query parameters
* @returns the url with the query parameters added with the same type as the url
*/
function add... |
// TODO: use the URL Pattern API as soon as it has better browser support
if (!params) return url as T
let urlString = String(url)
Object.entries(params).forEach(([key, value]) => {
urlString = urlString.replace(new RegExp(`:${key}($|\/)`), `${value}$1`)
})
return (url instanceof URL ? new URL(urlStri... | {
"context_start_lineno": 0,
"file": "src/primitives.ts",
"groundtruth_start_lineno": 94,
"repository": "gustavoguichard-make-service-e5a7bea",
"right_context_start_lineno": 96,
"task_id": "project_cc_typescript/123"
} | {
"list": [
{
"filename": "src/api.ts",
"retrieved_chunk": " * const users = await response.json(userSchema);\n * // ^? User[]\n * const untyped = await response.json();\n * // ^? unknown\n */\nasync function enhancedFetch<T extends string | URL>(\n url: T,\n requestInit?: EnhancedRequestInit<... | params: PathParams<T>,
): T { |
{
"list": [
{
"filename": "src/api.ts",
"retrieved_chunk": " ReturnType<typeof appliedService>\n >\n for (const method of HTTP_METHODS) {\n const lowerMethod = method.toLowerCase() as Lowercase<HTTPMethod>\n service[lowerMethod] = appliedService(method)\n }\n return service\n}\nexport { e... | import { HTTP_METHODS } from './constants'
import * as subject from './api'
import * as z from 'zod'
import { HTTPMethod } from './types'
import { kebabToCamel } from './transforms'
const reqMock = vi.fn()
function successfulFetch(response: string | Record<string, unknown>) {
return async (input: URL | RequestInfo, ... |
})
it('should return an API with enhancedFetch', async () => {
vi.spyOn(global, 'fetch').mockImplementationOnce(
successfulFetch({ foo: 'bar' }),
)
const service = subject.makeService('https://example.com/api')
const result = await service
.post('/users')
.then((r) => r.json(z.ob... | {
"context_start_lineno": 0,
"file": "src/api.test.ts",
"groundtruth_start_lineno": 331,
"repository": "gustavoguichard-make-service-e5a7bea",
"right_context_start_lineno": 334,
"task_id": "project_cc_typescript/115"
} | {
"list": [
{
"filename": "src/api.ts",
"retrieved_chunk": " ReturnType<typeof appliedService>\n >\n for (const method of HTTP_METHODS) {\n const lowerMethod = method.toLowerCase() as Lowercase<HTTPMethod>\n service[lowerMethod] = appliedService(method)\n }\n return service\n}\nexport { e... | as Lowercase<HTTPMethod>],
).toBe('function')
} |
{
"list": [
{
"filename": "src/utils/prepare-code.ts",
"retrieved_chunk": " result += '\\n'\n for (const importData of importGroups.relatives) {\n result += `${importData.raw}\\n`\n }\n if (importGroups.directRelatives.length > 0) {\n result += '\\n'\n for (const importData of importGroup... | import config from '../config'
import { ImportData, ImportGroups, LibraryRule } from '../types'
const getImportDepth = (path: string) => {
return path.split('/').length
}
const asc = (a, b) => {
const depthA = getImportDepth(a.path)
const depthB = getImportDepth(b.path)
if (depthA !== depthB) {
return de... |
const importElementsString = searchResult[0].replace(/[{}\s]/gm, '')
const importElements = importElementsString
.split(',')
.filter((importElement) => importElement)
importElements.sort(function (a, b) {
if (a.length === b.length) {
return a.localeCompare(b)
... | {
"context_start_lineno": 0,
"file": "src/utils/sort-import-groups.ts",
"groundtruth_start_lineno": 91,
"repository": "crmapache-prettier-plugin-sort-react-imports-a237c21",
"right_context_start_lineno": 94,
"task_id": "project_cc_typescript/40"
} | {
"list": [
{
"filename": "src/utils/prepare-code.ts",
"retrieved_chunk": " result += '\\n'\n for (const importData of importGroups.relatives) {\n result += `${importData.raw}\\n`\n }\n if (importGroups.directRelatives.length > 0) {\n result += '\\n'\n for (const importData of importGroup... | = importData.raw.match(/\{[\s\S]+?}/gm)
if (searchResult) { |
{
"list": [
{
"filename": "src/webgpu/helpers.ts",
"retrieved_chunk": "export function supportsWebGPU(): boolean {\n if (navigator.gpu) {\n return true;\n }\n return false;\n}\nexport function createBuffer(array: ArrayBuffer, usage: GPUBufferUsageFlags, device: GPUDevice): GPUBuffer {\n try {\n... | import { Vec2, Vec3, vec2 } from 'wgpu-matrix';
import { Camera } from './camera';
import { createBuffer } from './helpers';
import { WebGPUBindGroup } from './webgpubindgroup';
import { WebGPUBindGroupLayout } from './webgpubindgrouplayout';
import { WebGPURenderContext } from './webgpucontext';
import { WebGPUPipelin... |
const bindGroupLayout = new WebGPUBindGroupLayout();
bindGroupLayout.create({
device: this.context.device,
entries: [
{
binding: 0,
visibility: GPUShaderStage.FRAGMENT,
buffer: {
type: 'uniform',
},
},
],
});
this.u... | {
"context_start_lineno": 0,
"file": "src/webgpu/webgpurenderer.ts",
"groundtruth_start_lineno": 129,
"repository": "hsimpson-webgpu-fractals-41455fe",
"right_context_start_lineno": 134,
"task_id": "project_cc_typescript/79"
} | {
"list": [
{
"filename": "src/webgpu/camera.ts",
"retrieved_chunk": " // this.currentMousePosition = currentPos;\n };\n private onKeyDown = (event: KeyboardEvent) => {\n const movementSpeed = 0.25;\n let x = this.cameraPosition[0];\n let y = this.cameraPosition[1];\n switch (event.ke... | uniformParamsBuffer = createBuffer(
this.getUniformParamsArray(),
GPUBufferUsage.UNIFORM | GPUBufferUsage.COPY_DST,
this.context.device,
); |
{
"list": [
{
"filename": "src/webgpu/camera.ts",
"retrieved_chunk": " this.cameraPosition[2] = this.cameraPosition[2] + event.deltaY * 0.01;\n };\n private onMouseMove = (event: MouseEvent) => {\n // const currentPos: Vec2 = [event.clientX, event.clientY];\n // if (event.buttons === 1) {\n... | import { Vec2, Vec3, vec2 } from 'wgpu-matrix';
import { Camera } from './camera';
import { createBuffer } from './helpers';
import { WebGPUBindGroup } from './webgpubindgroup';
import { WebGPUBindGroupLayout } from './webgpubindgrouplayout';
import { WebGPURenderContext } from './webgpucontext';
import { WebGPUPipelin... |
passEncoder.setBindGroup(0, this.uniformParamsGroup.bindGroup);
passEncoder.draw(3, 1, 0, 0); // only 1 triangle
passEncoder.end();
this.context.queue.submit([commandEncoder.finish()]);
}
// private computePass(deltaTime: number) {
// const commandEncoder = this.context.device.createCommandEn... | {
"context_start_lineno": 0,
"file": "src/webgpu/webgpurenderer.ts",
"groundtruth_start_lineno": 237,
"repository": "hsimpson-webgpu-fractals-41455fe",
"right_context_start_lineno": 238,
"task_id": "project_cc_typescript/94"
} | {
"list": [
{
"filename": "src/webgpu/camera.ts",
"retrieved_chunk": " // this.currentMousePosition = currentPos;\n };\n private onKeyDown = (event: KeyboardEvent) => {\n const movementSpeed = 0.25;\n let x = this.cameraPosition[0];\n let y = this.cameraPosition[1];\n switch (event.ke... | passEncoder.setPipeline(this.renderPipeline.pipeline); |
{
"list": [
{
"filename": "src/webgpu/webgpurenderpipeline.ts",
"retrieved_chunk": "export class WebGPURenderPipeline {\n private renderPipeline: GPURenderPipeline;\n public get pipeline() {\n return this.renderPipeline;\n }\n public async create(options: WebGPURenderPipelineOptions) {\n thi... | import { Vec2, Vec3, vec2 } from 'wgpu-matrix';
import { Camera } from './camera';
import { createBuffer } from './helpers';
import { WebGPUBindGroup } from './webgpubindgroup';
import { WebGPUBindGroupLayout } from './webgpubindgrouplayout';
import { WebGPURenderContext } from './webgpucontext';
import { WebGPUPipelin... |
passEncoder.draw(3, 1, 0, 0); // only 1 triangle
passEncoder.end();
this.context.queue.submit([commandEncoder.finish()]);
}
// private computePass(deltaTime: number) {
// const commandEncoder = this.context.device.createCommandEncoder();
// const passEncoder = commandEncoder.beginComputePass(... | {
"context_start_lineno": 0,
"file": "src/webgpu/webgpurenderer.ts",
"groundtruth_start_lineno": 238,
"repository": "hsimpson-webgpu-fractals-41455fe",
"right_context_start_lineno": 239,
"task_id": "project_cc_typescript/95"
} | {
"list": [
{
"filename": "src/webgpu/camera.ts",
"retrieved_chunk": " // this.currentMousePosition = currentPos;\n };\n private onKeyDown = (event: KeyboardEvent) => {\n const movementSpeed = 0.25;\n let x = this.cameraPosition[0];\n let y = this.cameraPosition[1];\n switch (event.ke... | passEncoder.setBindGroup(0, this.uniformParamsGroup.bindGroup); |
{
"list": [
{
"filename": "src/webgpu/helpers.ts",
"retrieved_chunk": "export function supportsWebGPU(): boolean {\n if (navigator.gpu) {\n return true;\n }\n return false;\n}\nexport function createBuffer(array: ArrayBuffer, usage: GPUBufferUsageFlags, device: GPUDevice): GPUBuffer {\n try {\n... | import { Vec2, Vec3, vec2 } from 'wgpu-matrix';
import { Camera } from './camera';
import { createBuffer } from './helpers';
import { WebGPUBindGroup } from './webgpubindgroup';
import { WebGPUBindGroupLayout } from './webgpubindgrouplayout';
import { WebGPURenderContext } from './webgpucontext';
import { WebGPUPipelin... |
bindGroupLayout.create({
device: this.context.device,
entries: [
{
binding: 0,
visibility: GPUShaderStage.FRAGMENT,
buffer: {
type: 'uniform',
},
},
],
});
this.uniformParamsGroup = new WebGPUBindGroup();
this.unifor... | {
"context_start_lineno": 0,
"file": "src/webgpu/webgpurenderer.ts",
"groundtruth_start_lineno": 135,
"repository": "hsimpson-webgpu-fractals-41455fe",
"right_context_start_lineno": 136,
"task_id": "project_cc_typescript/80"
} | {
"list": [
{
"filename": "src/webgpu/camera.ts",
"retrieved_chunk": " // this.currentMousePosition = currentPos;\n };\n private onKeyDown = (event: KeyboardEvent) => {\n const movementSpeed = 0.25;\n let x = this.cameraPosition[0];\n let y = this.cameraPosition[1];\n switch (event.ke... | const bindGroupLayout = new WebGPUBindGroupLayout(); |
{
"list": [
{
"filename": "src/webgpu/helpers.ts",
"retrieved_chunk": "export function supportsWebGPU(): boolean {\n if (navigator.gpu) {\n return true;\n }\n return false;\n}\nexport function createBuffer(array: ArrayBuffer, usage: GPUBufferUsageFlags, device: GPUDevice): GPUBuffer {\n try {\n... | import { Vec2, Vec3, vec2 } from 'wgpu-matrix';
import { Camera } from './camera';
import { createBuffer } from './helpers';
import { WebGPUBindGroup } from './webgpubindgroup';
import { WebGPUBindGroupLayout } from './webgpubindgrouplayout';
import { WebGPURenderContext } from './webgpucontext';
import { WebGPUPipelin... |
const bindGroupLayout = new WebGPUBindGroupLayout();
bindGroupLayout.create({
device: this.context.device,
entries: [
{
binding: 0,
visibility: GPUShaderStage.FRAGMENT,
buffer: {
type: 'uniform',
},
},
],
});
this.u... | {
"context_start_lineno": 0,
"file": "src/webgpu/webgpurenderer.ts",
"groundtruth_start_lineno": 129,
"repository": "hsimpson-webgpu-fractals-41455fe",
"right_context_start_lineno": 134,
"task_id": "project_cc_typescript/88"
} | {
"list": [
{
"filename": "src/webgpu/camera.ts",
"retrieved_chunk": " // this.currentMousePosition = currentPos;\n };\n private onKeyDown = (event: KeyboardEvent) => {\n const movementSpeed = 0.25;\n let x = this.cameraPosition[0];\n let y = this.cameraPosition[1];\n switch (event.ke... | .uniformParamsBuffer = createBuffer(
this.getUniformParamsArray(),
GPUBufferUsage.UNIFORM | GPUBufferUsage.COPY_DST,
this.context.device,
); |
{
"list": [
{
"filename": "src/utils/sockets/appRoom.ts",
"retrieved_chunk": "}\n/**\n *\n * @param {*} socket - The socket instance\n * @param {Object} params - the params for the socket event\n * @param {String} params.app_version_id - app_version_id\n */\nexport async function leaveAppBuilderRoom(s... | import { AchoClient } from '.';
import { ClientOptions } from './types';
import { App } from './app';
import { SERVER_ADDRESS, SOCKET_NAMESPACE } from './constants';
import { Socket, Manager } from 'socket.io-client';
import { joinAppBuilderRoom, leaveAppBuilderRoom } from './utils/sockets/appRoom';
export class AppVe... |
return 'left';
}
public async disconnect() {
if (!this.socket) {
throw new Error('AppVersion not initialized');
}
this.socket.disconnect();
return 'closed';
}
}
| {
"context_start_lineno": 0,
"file": "src/version.ts",
"groundtruth_start_lineno": 76,
"repository": "acho-dev-acho-js-7eafc31",
"right_context_start_lineno": 77,
"task_id": "project_cc_typescript/4"
} | {
"list": [
{
"filename": "src/utils/sockets/appRoom.ts",
"retrieved_chunk": "}\n/**\n *\n * @param {*} socket - The socket instance\n * @param {Object} params - the params for the socket event\n * @param {String} params.app_version_id - app_version_id\n */\nexport async function leaveAppBuilderRoom(s... | leaveAppBuilderRoom(this.socket, { app_version_id: this.verId, is_editing: true }); |
End of preview. Expand in Data Studio
README.md exists but content is empty.
- Downloads last month
- 24