Dataset Viewer
Auto-converted to Parquet Duplicate
problem_id
string
source
string
task_type
string
in_source_id
string
prompt
string
golden_diff
string
verification_info
string
gh_patches_debug_36408
rasdani/github-patches
git_diff
mne-tools__mne-bids-74
We are currently solving the following issue within our repository. Here is the issue text: --- BEGIN ISSUE --- Remove .gz extension for fif: It's no longer part of the validator Throughout the current state of MNE BIDS, the file ending `.gz` is used as an identifier for FIF files: https://github.com/mne-tools/mne-b...
diff --git a/mne_bids/io.py b/mne_bids/io.py --- a/mne_bids/io.py +++ b/mne_bids/io.py @@ -9,7 +9,7 @@ from mne import io import os -ALLOWED_EXTENSIONS = ['.con', '.sqd', '.fif', '.gz', '.pdf', '.ds'] +ALLOWED_EXTENSIONS = ['.con', '.sqd', '.fif', '.pdf', '.ds'] def _parse_ext(raw_fname, verbose=False): @@ -37...
{"golden_diff": "diff --git a/mne_bids/io.py b/mne_bids/io.py\n--- a/mne_bids/io.py\n+++ b/mne_bids/io.py\n@@ -9,7 +9,7 @@\n from mne import io\n import os\n \n-ALLOWED_EXTENSIONS = ['.con', '.sqd', '.fif', '.gz', '.pdf', '.ds']\n+ALLOWED_EXTENSIONS = ['.con', '.sqd', '.fif', '.pdf', '.ds']\n \n \n def _parse_ext(raw_f...
gh_patches_debug_32737
rasdani/github-patches
git_diff
dask__dask-586
We are currently solving the following issue within our repository. Here is the issue text: --- BEGIN ISSUE --- Additional improvement for da.image.imread I think following 2 improvements make the function better. #### 1. Allow custom `imread` function. Some prefer `opencv` which reads color in BGR order, otherwise `s...
diff --git a/dask/array/image.py b/dask/array/image.py --- a/dask/array/image.py +++ b/dask/array/image.py @@ -13,7 +13,7 @@ return x[None, ...] -def imread(filename): +def imread(filename, imread=None, preprocess=None): """ Read a stack of images into a dask array Parameters @@ -21,6 +21,13 @@ ...
{"golden_diff": "diff --git a/dask/array/image.py b/dask/array/image.py\n--- a/dask/array/image.py\n+++ b/dask/array/image.py\n@@ -13,7 +13,7 @@\n return x[None, ...]\n \n \n-def imread(filename):\n+def imread(filename, imread=None, preprocess=None):\n \"\"\" Read a stack of images into a dask array\n \n Pa...
gh_patches_debug_19722
rasdani/github-patches
git_diff
iterative__dvc-7283
We are currently solving the following issue within our repository. Here is the issue text: --- BEGIN ISSUE --- 'None' does not contain DVC directory ```console cd "$(mktemp -d)" dvc add foo # or any other command ``` --- END ISSUE --- Below are some code segments, each from a relevant file. One or more of thes...
diff --git a/dvc/repo/__init__.py b/dvc/repo/__init__.py --- a/dvc/repo/__init__.py +++ b/dvc/repo/__init__.py @@ -314,8 +314,8 @@ def find_root(cls, root=None, fs=None) -> str: from dvc.fs.local import LocalFileSystem, localfs - root_dir = os.path.realpath(root or os.curdir) - _fs = fs + ...
{"golden_diff": "diff --git a/dvc/repo/__init__.py b/dvc/repo/__init__.py\n--- a/dvc/repo/__init__.py\n+++ b/dvc/repo/__init__.py\n@@ -314,8 +314,8 @@\n def find_root(cls, root=None, fs=None) -> str:\n from dvc.fs.local import LocalFileSystem, localfs\n \n- root_dir = os.path.realpath(root or os.curd...
gh_patches_debug_233
rasdani/github-patches
git_diff
learningequality__kolibri-6355
"We are currently solving the following issue within our repository. Here is the issue text:\n--- BE(...TRUNCATED)
"diff --git a/kolibri/core/content/serializers.py b/kolibri/core/content/serializers.py\n--- a/kolib(...TRUNCATED)
"{\"golden_diff\": \"diff --git a/kolibri/core/content/serializers.py b/kolibri/core/content/seriali(...TRUNCATED)
gh_patches_debug_65930
rasdani/github-patches
git_diff
iterative__dvc-2882
"We are currently solving the following issue within our repository. Here is the issue text:\n--- BE(...TRUNCATED)
"diff --git a/dvc/remote/base.py b/dvc/remote/base.py\n--- a/dvc/remote/base.py\n+++ b/dvc/remote/ba(...TRUNCATED)
"{\"golden_diff\": \"diff --git a/dvc/remote/base.py b/dvc/remote/base.py\\n--- a/dvc/remote/base.py(...TRUNCATED)
gh_patches_debug_60514
rasdani/github-patches
git_diff
kedro-org__kedro-1706
"We are currently solving the following issue within our repository. Here is the issue text:\n--- BE(...TRUNCATED)
"diff --git a/features/steps/cli_steps.py b/features/steps/cli_steps.py\n--- a/features/steps/cli_st(...TRUNCATED)
"{\"golden_diff\": \"diff --git a/features/steps/cli_steps.py b/features/steps/cli_steps.py\\n--- a/(...TRUNCATED)
gh_patches_debug_41327
rasdani/github-patches
git_diff
ibis-project__ibis-1988
"We are currently solving the following issue within our repository. Here is the issue text:\n--- BE(...TRUNCATED)
"diff --git a/ibis/pyspark/compiler.py b/ibis/pyspark/compiler.py\n--- a/ibis/pyspark/compiler.py\n+(...TRUNCATED)
"{\"golden_diff\": \"diff --git a/ibis/pyspark/compiler.py b/ibis/pyspark/compiler.py\\n--- a/ibis/p(...TRUNCATED)
gh_patches_debug_3876
rasdani/github-patches
git_diff
xorbitsai__inference-299
"We are currently solving the following issue within our repository. Here is the issue text:\n--- BE(...TRUNCATED)
"diff --git a/examples/gradio_chatinterface.py b/examples/gradio_chatinterface.py\n--- a/examples/gr(...TRUNCATED)
"{\"golden_diff\": \"diff --git a/examples/gradio_chatinterface.py b/examples/gradio_chatinterface.p(...TRUNCATED)
gh_patches_debug_57507
rasdani/github-patches
git_diff
scikit-image__scikit-image-7095
"We are currently solving the following issue within our repository. Here is the issue text:\n--- BE(...TRUNCATED)
"diff --git a/skimage/morphology/_skeletonize.py b/skimage/morphology/_skeletonize.py\n--- a/skimage(...TRUNCATED)
"{\"golden_diff\": \"diff --git a/skimage/morphology/_skeletonize.py b/skimage/morphology/_skeletoni(...TRUNCATED)
gh_patches_debug_29709
rasdani/github-patches
git_diff
opsdroid__opsdroid-1306
"We are currently solving the following issue within our repository. Here is the issue text:\n--- BE(...TRUNCATED)
"diff --git a/opsdroid/connector/slack/__init__.py b/opsdroid/connector/slack/__init__.py\n--- a/ops(...TRUNCATED)
"{\"golden_diff\": \"diff --git a/opsdroid/connector/slack/__init__.py b/opsdroid/connector/slack/__(...TRUNCATED)
End of preview. Expand in Data Studio
import re
import json
from datasets import load_dataset

PROMPT_TEMPLATE = """\
We are currently solving the following issue within our repository. Here is the issue text:
--- BEGIN ISSUE ---
{issue}
--- END ISSUE ---

Below are some code segments, each from a relevant file. One or more of these files may contain bugs.
--- BEGIN FILES ---
{file_context}
--- END FILES ---

Please first localize the bug based on the issue statement, and then generate a patch according to the `git diff` format fenced by three backticks.

Here is an example:

\```diff
diff --git a/examples/server_async.py b/examples/server_async.py
--- a/examples/server_async.py
+++ b/examples/server_async.py
@@ -313,4 +313,4 @@
 
 
 if __name__ == "__main__":
-    asyncio.run(run_async_server("."), debug=True)
+    asyncio.run(run_async_server(), debug=True)
diff --git a/examples/server_sync.py b/examples/server_sync.py
--- a/examples/server_sync.py
+++ b/examples/server_sync.py
@@ -313,5 +313,5 @@
 
 
 if __name__ == "__main__":
-    server = run_sync_server(".")
+    server = run_sync_server()
     server.shutdown()

\```
"""

# ds = load_dataset("rasdani/github-patches-10k-sample-sorted", split="train")
ds = load_dataset("rasdani/github-patches-decontaminated", split="train")


def prepend_line_numbers(file_content: str) -> str:
    if not file_content:
        return ""
    lines = file_content.split('\n')
    lines = [f"{i+1} {line}" for i, line in enumerate(lines)]
    ret = '\n'.join(lines)
    ret = ret.strip() + "\n"
    return ret

def normalize_diff(diff_text: str) -> str:
    diff_text = re.sub(r'(?m)^index [^\n]*\n', '', diff_text)
    diff_text = re.sub(r'(?m)^(@@[^@]*@@).*', r'\1', diff_text)
    diff_text = diff_text.strip() + "\n"
    return diff_text

def filter_diff_by_files(diff: str, touched_files: set) -> str:
    """Filter a git diff to only include changes for specific files."""
    if not touched_files:
        return diff
    
    lines = diff.split('\n')
    filtered_lines = []
    include_section = False
    
    for line in lines:
        if line.startswith('diff --git'):
            # Check if this file should be included
            # Extract the file path from "diff --git a/path b/path"
            match = re.match(r'diff --git a/(.*?) b/', line)
            if match:
                file_path = match.group(1)
                include_section = file_path in touched_files
            else:
                include_section = False
        
        if include_section:
            filtered_lines.append(line)
    
    return '\n'.join(filtered_lines)

def create_golden_diff(example):
    before_paths = [b["path"] for b in example["before_files"]]
    after_paths = [a["path"] for a in example["after_files"]]
    touched_files = set(before_paths) | set(after_paths)
    filtered_diff = filter_diff_by_files(example["pr_diff"], touched_files)
    golden_diff = normalize_diff(filtered_diff)
    for path in touched_files:
        assert path in golden_diff, f"Path {path} not found in golden diff {golden_diff}"
    verification_info_dict = {
        "golden_diff": golden_diff,
        "issue": example["issue"],
        "before_files": example["before_files"],
        "after_files": example["after_files"],
    }
    verification_info = json.dumps(verification_info_dict)
    return {"golden_diff": golden_diff, "verification_info": verification_info}

def create_prompt(example):
    golden_diff = example["golden_diff"]
    issue = example["issue"]
    before_files = example["before_files"]
    file_context = [f"Path: `{x['path']}`\nContent:\n```\n{prepend_line_numbers(x['content'])}```" for x in before_files]
    file_context = "\n\n".join(file_context)
    prompt = PROMPT_TEMPLATE.format(issue=issue, file_context=file_context, golden_diff=golden_diff)
    # print(prompt)
    # print("="*100)
    return {"prompt": prompt}

    

ds_up = ds.map(lambda x, idx: {"problem_id": f"gh_patches_debug_{idx}"}, with_indices=True)
ds_up = ds_up.map(lambda x: {"source": "rasdani/github-patches", "task_type": "git_diff"})

ds_up = ds_up.map(create_golden_diff, num_proc=10)
# example = ds_up[0]
# create_prompt(example)
ds_up = ds_up.map(create_prompt, num_proc=10)

ds_up = ds_up.select_columns(["problem_id", "source", "task_type", "in_source_id", "prompt", "golden_diff", "verification_info"])

# ds_up.push_to_hub("rasdani/github-patches-debug")
# ds_up.push_to_hub("rasdani/github-patches-debug-genesys")
ds_up = ds_up.shuffle(seed=42)
ds_up.push_to_hub("rasdani/github-patches-genesys")
Downloads last month
4