Dataset Viewer
Auto-converted to Parquet
in_source_id
string
before_files
list
after_files
list
pr_diff
string
issue
string
golden_diff
string
verification_info
string
prompt
string
conda-forge__conda-smithy-864
[ { "content": "", "path": "conda_smithy/vendored/__init__.py" } ]
[ { "content": "\n", "path": "conda_smithy/vendored/__init__.py" } ]
diff --git a/.gitignore b/.gitignore index 4f4b3b35c..5761ca997 100644 --- a/.gitignore +++ b/.gitignore @@ -10,3 +10,9 @@ dist/ # Rever rever/ + +# Notepad++ files +nppBackup/ + +# Pytest dirs/files +.pytest_cache/ diff --git a/conda_smithy/templates/README.md.tmpl b/conda_smithy/templates/README.md.tmpl index 662b86f9e..2cfd535bb 100644 --- a/conda_smithy/templates/README.md.tmpl +++ b/conda_smithy/templates/README.md.tmpl @@ -136,3 +136,4 @@ In order to produce a uniquely identifiable distribution: * If the version of a package **is** being increased, please remember to return the [``build/number``](http://conda.pydata.org/docs/building/meta-yaml.html#build-number-and-string) back to 0. +{# this comment ensures a trailing newline #} diff --git a/conda_smithy/vendored/__init__.py b/conda_smithy/vendored/__init__.py index e69de29bb..8b1378917 100644 --- a/conda_smithy/vendored/__init__.py +++ b/conda_smithy/vendored/__init__.py @@ -0,0 +1 @@ + diff --git a/news/fix-no-newline.rst b/news/fix-no-newline.rst new file mode 100644 index 000000000..dbd5462fc --- /dev/null +++ b/news/fix-no-newline.rst @@ -0,0 +1,3 @@ +**Fixed:** + +* Fix missing newline in last line of generated readmes and add unit test for it (#864) diff --git a/tests/recipes/click-test-feedstock/README.md b/tests/recipes/click-test-feedstock/README.md index 3b8f66040..37a014e57 100644 --- a/tests/recipes/click-test-feedstock/README.md +++ b/tests/recipes/click-test-feedstock/README.md @@ -103,4 +103,4 @@ In order to produce a uniquely identifiable distribution: the [``build/number``](http://conda.pydata.org/docs/building/meta-yaml.html#build-number-and-string). * If the version of a package **is** being increased, please remember to return the [``build/number``](http://conda.pydata.org/docs/building/meta-yaml.html#build-number-and-string) - back to 0. \ No newline at end of file + back to 0. diff --git a/tests/test_configure_feedstock.py b/tests/test_configure_feedstock.py index 1fd6e41d1..e98233b10 100644 --- a/tests/test_configure_feedstock.py +++ b/tests/test_configure_feedstock.py @@ -222,3 +222,14 @@ def test_render_windows_with_skipped_python(python_skipped_recipe, jinja_env): matrix_dir = os.path.join(python_skipped_recipe.recipe, '.ci_support') # matrix has 2.7, 3.5, 3.6, but 3.6 is skipped. Should be 2 entries. assert len(os.listdir(matrix_dir)) == 2 + + +def test_readme_has_terminating_newline(noarch_recipe, jinja_env): + cnfgr_fdstk.render_README(jinja_env=jinja_env, + forge_config=noarch_recipe.config, + forge_dir=noarch_recipe.recipe) + readme_path = os.path.join(noarch_recipe.recipe, 'README.md') + assert os.path.exists(readme_path) + with open(readme_path, 'rb') as readme_file: + readme_file.seek(-1, os.SEEK_END) + assert readme_file.read() == b'\n'
Autogenerated README.md missing final newline ## The Problem As I've confirmed is the case on multiple repos here, including our own ``spyder-feedstock`` and ``spyder-kernels-feedstock`` as well as two arbitrary conda-forge repos I checked conda-forge, the last line in README.md lacks a terminating newline (LF/``x0D``), and is thus ill-formed. I'd be happy to submit a PR to fix it since I imagine it is probably pretty trivial, if someone more knowlegable than me can let me know how to approach it. ## Proposed Solutions A naive hack would seem to be just writing an additional ``\n`` [here](https://github.com/conda-forge/conda-smithy/blob/855f23bb96efb1cbdbdc5e60dfb9bbdd3e142d31/conda_smithy/configure_feedstock.py#L718), but editing the [template ](https://github.com/conda-forge/conda-smithy/blob/master/conda_smithy/templates/README.md.tmpl) would seem to make far more sense. However, the template *has* a trailing newline and hasn't been edited in a while, so not sure what's going on—is it not writing the last one; is it getting stripped, or what? Thanks!
diff --git a/conda_smithy/vendored/__init__.py b/conda_smithy/vendored/__init__.py --- a/conda_smithy/vendored/__init__.py +++ b/conda_smithy/vendored/__init__.py @@ -0,0 +1 @@ +
{"golden_diff": "diff --git a/conda_smithy/vendored/__init__.py b/conda_smithy/vendored/__init__.py\n--- a/conda_smithy/vendored/__init__.py\n+++ b/conda_smithy/vendored/__init__.py\n@@ -0,0 +1 @@\n+\n"}
We are currently solving the following issue within our repository. Here is the issue text: --- BEGIN ISSUE --- Autogenerated README.md missing final newline ## The Problem As I've confirmed is the case on multiple repos here, including our own ``spyder-feedstock`` and ``spyder-kernels-feedstock`` as well as two arbitrary conda-forge repos I checked conda-forge, the last line in README.md lacks a terminating newline (LF/``x0D``), and is thus ill-formed. I'd be happy to submit a PR to fix it since I imagine it is probably pretty trivial, if someone more knowlegable than me can let me know how to approach it. ## Proposed Solutions A naive hack would seem to be just writing an additional ``\n`` [here](https://github.com/conda-forge/conda-smithy/blob/855f23bb96efb1cbdbdc5e60dfb9bbdd3e142d31/conda_smithy/configure_feedstock.py#L718), but editing the [template ](https://github.com/conda-forge/conda-smithy/blob/master/conda_smithy/templates/README.md.tmpl) would seem to make far more sense. However, the template *has* a trailing newline and hasn't been edited in a while, so not sure what's going on—is it not writing the last one; is it getting stripped, or what? Thanks! --- END ISSUE --- Below are some code segments, each from a relevant file. One or more of these files may contain bugs. --- BEGIN FILES --- Path: `conda_smithy/vendored/__init__.py` Content: ``` ``` --- 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() ```
microsoft__AzureTRE-1754
[ { "content": "__version__ = \"0.2.28\"\n", "path": "api_app/_version.py" } ]
[ { "content": "__version__ = \"0.3.0\"\n", "path": "api_app/_version.py" } ]
diff --git a/api_app/_version.py b/api_app/_version.py index 968391a2db..493f7415d7 100644 --- a/api_app/_version.py +++ b/api_app/_version.py @@ -1 +1 @@ -__version__ = "0.2.28" +__version__ = "0.3.0" diff --git a/resource_processor/version.txt b/resource_processor/version.txt index 6852ddf8f7..493f7415d7 100644 --- a/resource_processor/version.txt +++ b/resource_processor/version.txt @@ -1 +1 @@ -__version__ = "0.1.22" +__version__ = "0.3.0" diff --git a/templates/shared_services/firewall/porter.yaml b/templates/shared_services/firewall/porter.yaml index 4b64405355..2f3fc2bed0 100644 --- a/templates/shared_services/firewall/porter.yaml +++ b/templates/shared_services/firewall/porter.yaml @@ -1,6 +1,6 @@ --- name: tre-shared-service-firewall -version: 0.0.7 +version: 0.3.0 description: "An Azure TRE Firewall shared service" registry: azuretre dockerfile: Dockerfile.tmpl diff --git a/templates/shared_services/gitea/porter.yaml b/templates/shared_services/gitea/porter.yaml index 39c3b39254..12085e792f 100644 --- a/templates/shared_services/gitea/porter.yaml +++ b/templates/shared_services/gitea/porter.yaml @@ -1,6 +1,6 @@ --- name: tre-shared-service-gitea -version: 0.0.5 +version: 0.3.0 description: "A Gitea shared service" registry: azuretre dockerfile: Dockerfile.tmpl diff --git a/templates/shared_services/gitea/version.txt b/templates/shared_services/gitea/version.txt index 9cb17e7976..493f7415d7 100644 --- a/templates/shared_services/gitea/version.txt +++ b/templates/shared_services/gitea/version.txt @@ -1 +1 @@ -__version__ = "0.1.8" +__version__ = "0.3.0" diff --git a/templates/shared_services/sonatype-nexus/porter.yaml b/templates/shared_services/sonatype-nexus/porter.yaml index 150565da27..8e22c5a6f3 100644 --- a/templates/shared_services/sonatype-nexus/porter.yaml +++ b/templates/shared_services/sonatype-nexus/porter.yaml @@ -1,6 +1,6 @@ --- name: tre-shared-service-nexus -version: 0.0.2 +version: 0.3.0 description: "A Sonatype Nexus shared service" registry: azuretre credentials: diff --git a/templates/workspace_services/azureml/porter.yaml b/templates/workspace_services/azureml/porter.yaml index cdffe945ba..e5b4340c26 100644 --- a/templates/workspace_services/azureml/porter.yaml +++ b/templates/workspace_services/azureml/porter.yaml @@ -1,6 +1,6 @@ --- name: tre-service-azureml -version: 0.1.9 +version: 0.3.0 description: "An Azure TRE service for Azure Machine Learning" registry: azuretre dockerfile: Dockerfile.tmpl diff --git a/templates/workspace_services/azureml/user_resources/aml_compute/porter.yaml b/templates/workspace_services/azureml/user_resources/aml_compute/porter.yaml index ac905db7fe..45d1c56b79 100644 --- a/templates/workspace_services/azureml/user_resources/aml_compute/porter.yaml +++ b/templates/workspace_services/azureml/user_resources/aml_compute/porter.yaml @@ -1,6 +1,6 @@ --- name: tre-user-resource-aml-compute-instance -version: 0.1.1 +version: 0.3.0 description: "Azure Machine Learning Compute Instance" registry: azuretre dockerfile: Dockerfile.tmpl diff --git a/templates/workspace_services/devtestlabs/porter.yaml b/templates/workspace_services/devtestlabs/porter.yaml index 8fa596d432..9e9767a23e 100644 --- a/templates/workspace_services/devtestlabs/porter.yaml +++ b/templates/workspace_services/devtestlabs/porter.yaml @@ -1,6 +1,6 @@ --- name: tre-service-devtestlabs -version: 0.1.0 +version: 0.3.0 description: "An Azure TRE service for Dev Test Labs" registry: azuretre diff --git a/templates/workspace_services/gitea/porter.yaml b/templates/workspace_services/gitea/porter.yaml index a66314a715..af5e0a60a5 100644 --- a/templates/workspace_services/gitea/porter.yaml +++ b/templates/workspace_services/gitea/porter.yaml @@ -1,6 +1,6 @@ --- name: tre-workspace-service-gitea -version: 0.2.17 +version: 0.3.0 description: "A Gitea workspace service" registry: azuretre dockerfile: Dockerfile.tmpl diff --git a/templates/workspace_services/gitea/version.txt b/templates/workspace_services/gitea/version.txt index aa0be21390..493f7415d7 100644 --- a/templates/workspace_services/gitea/version.txt +++ b/templates/workspace_services/gitea/version.txt @@ -1 +1 @@ -__version__ = "0.2.17" +__version__ = "0.3.0" diff --git a/templates/workspace_services/guacamole/porter.yaml b/templates/workspace_services/guacamole/porter.yaml index 39a0be920c..3c7d9bb30d 100644 --- a/templates/workspace_services/guacamole/porter.yaml +++ b/templates/workspace_services/guacamole/porter.yaml @@ -1,6 +1,6 @@ --- name: tre-service-guacamole -version: 0.1.15 +version: 0.3.0 description: "An Azure TRE service for Guacamole" registry: azuretre dockerfile: Dockerfile.tmpl diff --git a/templates/workspace_services/guacamole/user_resources/guacamole-azure-linuxvm/porter.yaml b/templates/workspace_services/guacamole/user_resources/guacamole-azure-linuxvm/porter.yaml index 8c5874b840..46a3a67fdb 100644 --- a/templates/workspace_services/guacamole/user_resources/guacamole-azure-linuxvm/porter.yaml +++ b/templates/workspace_services/guacamole/user_resources/guacamole-azure-linuxvm/porter.yaml @@ -1,6 +1,6 @@ --- name: tre-service-guacamole-linuxvm -version: 0.1.11 +version: 0.3.0 description: "An Azure TRE User Resource Template for Guacamole (Linux)" registry: azuretre dockerfile: Dockerfile.tmpl diff --git a/templates/workspace_services/guacamole/user_resources/guacamole-azure-windowsvm/porter.yaml b/templates/workspace_services/guacamole/user_resources/guacamole-azure-windowsvm/porter.yaml index 1577773cef..7c6911c456 100644 --- a/templates/workspace_services/guacamole/user_resources/guacamole-azure-windowsvm/porter.yaml +++ b/templates/workspace_services/guacamole/user_resources/guacamole-azure-windowsvm/porter.yaml @@ -1,6 +1,6 @@ --- name: tre-service-guacamole-windowsvm -version: 0.1.11 +version: 0.3.0 description: "An Azure TRE User Resource Template for Guacamole (Windows 10)" registry: azuretre dockerfile: Dockerfile.tmpl diff --git a/templates/workspace_services/guacamole/user_resources/guacamole-dev-vm/porter.yaml b/templates/workspace_services/guacamole/user_resources/guacamole-dev-vm/porter.yaml index 75ee52e3ad..4e1cd2fd25 100644 --- a/templates/workspace_services/guacamole/user_resources/guacamole-dev-vm/porter.yaml +++ b/templates/workspace_services/guacamole/user_resources/guacamole-dev-vm/porter.yaml @@ -1,6 +1,6 @@ --- name: tre-service-dev-vm -version: 0.1.11 +version: 0.3.0 description: "An Azure TRE User Resource Template for a Dev VM" registry: azuretre dockerfile: Dockerfile.tmpl diff --git a/templates/workspace_services/guacamole/version.txt b/templates/workspace_services/guacamole/version.txt index 970659c2b1..493f7415d7 100644 --- a/templates/workspace_services/guacamole/version.txt +++ b/templates/workspace_services/guacamole/version.txt @@ -1 +1 @@ -__version__ = "0.1.16" +__version__ = "0.3.0" diff --git a/templates/workspace_services/innereye/porter.yaml b/templates/workspace_services/innereye/porter.yaml index c82c7b7265..e03ede698d 100644 --- a/templates/workspace_services/innereye/porter.yaml +++ b/templates/workspace_services/innereye/porter.yaml @@ -1,6 +1,6 @@ --- name: tre-service-innereye -version: 0.1.6 +version: 0.3.0 description: "An Azure TRE service for InnerEye Deep Learning" registry: azuretre dockerfile: Dockerfile.tmpl diff --git a/templates/workspace_services/mlflow/mlflow-server/version.txt b/templates/workspace_services/mlflow/mlflow-server/version.txt index 3dc1f76bc6..493f7415d7 100644 --- a/templates/workspace_services/mlflow/mlflow-server/version.txt +++ b/templates/workspace_services/mlflow/mlflow-server/version.txt @@ -1 +1 @@ -__version__ = "0.1.0" +__version__ = "0.3.0" diff --git a/templates/workspace_services/mlflow/porter.yaml b/templates/workspace_services/mlflow/porter.yaml index ca72784ece..ea37ca830d 100644 --- a/templates/workspace_services/mlflow/porter.yaml +++ b/templates/workspace_services/mlflow/porter.yaml @@ -1,6 +1,6 @@ --- name: tre-service-mlflow -version: 0.1.0 +version: 0.3.0 description: "An Azure TRE service for MLflow machine learning lifecycle" registry: azuretre dockerfile: Dockerfile.tmpl diff --git a/templates/workspaces/base/porter.yaml b/templates/workspaces/base/porter.yaml index 32b0e652f2..e47a87d707 100644 --- a/templates/workspaces/base/porter.yaml +++ b/templates/workspaces/base/porter.yaml @@ -1,6 +1,6 @@ --- name: tre-workspace-base -version: 0.2.13 +version: 0.3.0 description: "A base Azure TRE workspace" registry: azuretre diff --git a/templates/workspaces/innereye/porter.yaml b/templates/workspaces/innereye/porter.yaml index d2fcba8b2e..c3bb249f64 100644 --- a/templates/workspaces/innereye/porter.yaml +++ b/templates/workspaces/innereye/porter.yaml @@ -1,7 +1,7 @@ --- name: tre-workspace-innereye -version: 0.1.10 +version: 0.3.0 description: "An Azure TRE workspace with Azure Machine Learning, Dev Test Labs and InnerEye deep learning" registry: azuretre
Release version 0.3 ## Description As a TRE developer I want to release current code base as version 0.3 So that people can use a more stable version going forward ## Acceptance criteria - [ ] All core apps are bumped to 0.3 - [ ] All bundles are bumped to 0.3 - [ ] A tag is created - [ ] A release is created
diff --git a/api_app/_version.py b/api_app/_version.py --- a/api_app/_version.py +++ b/api_app/_version.py @@ -1 +1 @@ -__version__ = "0.2.28" +__version__ = "0.3.0"
{"golden_diff": "diff --git a/api_app/_version.py b/api_app/_version.py\n--- a/api_app/_version.py\n+++ b/api_app/_version.py\n@@ -1 +1 @@\n-__version__ = \"0.2.28\"\n+__version__ = \"0.3.0\"\n"}
We are currently solving the following issue within our repository. Here is the issue text: --- BEGIN ISSUE --- Release version 0.3 ## Description As a TRE developer I want to release current code base as version 0.3 So that people can use a more stable version going forward ## Acceptance criteria - [ ] All core apps are bumped to 0.3 - [ ] All bundles are bumped to 0.3 - [ ] A tag is created - [ ] A release is created --- END ISSUE --- Below are some code segments, each from a relevant file. One or more of these files may contain bugs. --- BEGIN FILES --- Path: `api_app/_version.py` Content: ``` 1 __version__ = "0.2.28" 2 ``` --- 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() ```
OpenEnergyPlatform__oeplatform-1475
[ { "content": "__version__ = \"0.16.1\"\n", "path": "oeplatform/__init__.py" } ]
[ { "content": "__version__ = \"0.16.2\"\n", "path": "oeplatform/__init__.py" } ]
"diff --git a/.bumpversion.cfg b/.bumpversion.cfg\nindex d51e9eadd..46cdebef9 100644\n--- a/.bumpver(...TRUNCATED)
"Scenario bundles: Output datasets render weirdly\n## Description of the issue\r\n\r\nI added an out(...TRUNCATED)
"diff --git a/oeplatform/__init__.py b/oeplatform/__init__.py\n--- a/oeplatform/__init__.py\n+++ b/o(...TRUNCATED)
"{\"golden_diff\": \"diff --git a/oeplatform/__init__.py b/oeplatform/__init__.py\\n--- a/oeplatform(...TRUNCATED)
"We are currently solving the following issue within our repository. Here is the issue text:\n--- BE(...TRUNCATED)
OCHA-DAP__hdx-ckan-1655
[ { "content": "hdx_version = 'v0.4.5'\n", "path": "ckanext-hdx_theme/ckanext/hdx_theme/version.py" } ]
[ { "content": "hdx_version = 'v0.4.6'\n", "path": "ckanext-hdx_theme/ckanext/hdx_theme/version.py" } ]
"diff --git a/ckanext-hdx_search/ckanext/hdx_search/tests/test_search.py b/ckanext-hdx_search/ckanex(...TRUNCATED)
"Main Nav changes to accomodate \"Feedback\" button\nUpdating the action based on discussions:\n1. R(...TRUNCATED)
"diff --git a/ckanext-hdx_theme/ckanext/hdx_theme/version.py b/ckanext-hdx_theme/ckanext/hdx_theme/v(...TRUNCATED)
"{\"golden_diff\": \"diff --git a/ckanext-hdx_theme/ckanext/hdx_theme/version.py b/ckanext-hdx_theme(...TRUNCATED)
"We are currently solving the following issue within our repository. Here is the issue text:\n--- BE(...TRUNCATED)
OCHA-DAP__hdx-ckan-2076
[ { "content": "hdx_version = 'v0.5.13'\n", "path": "ckanext-hdx_theme/ckanext/hdx_theme/version.py" } ]
[ { "content": "hdx_version = 'v0.5.15'\n", "path": "ckanext-hdx_theme/ckanext/hdx_theme/version.py" } ]
"diff --git a/ckanext-hdx_theme/ckanext/hdx_theme/fanstatic/css/login.css b/ckanext-hdx_theme/ckanex(...TRUNCATED)
"Login page: change spacing on left panel \nThe spacing in the left panel is odd. Change to somethi(...TRUNCATED)
"diff --git a/ckanext-hdx_theme/ckanext/hdx_theme/version.py b/ckanext-hdx_theme/ckanext/hdx_theme/v(...TRUNCATED)
"{\"golden_diff\": \"diff --git a/ckanext-hdx_theme/ckanext/hdx_theme/version.py b/ckanext-hdx_theme(...TRUNCATED)
"We are currently solving the following issue within our repository. Here is the issue text:\n--- BE(...TRUNCATED)
sql-machine-learning__elasticdl-1463
[ { "content": "", "path": "elasticdl/python/elasticdl/__init__.py" } ]
[{"content":"from elasticdl.python.elasticdl import layers # noqa: F401\n","path":"elasticdl/python(...TRUNCATED)
"diff --git a/elasticdl/python/elasticdl/__init__.py b/elasticdl/python/elasticdl/__init__.py\nindex(...TRUNCATED)
"No module named 'elasticdl.python.elasticdl.layers' on master\n```\r\nTraceback (most recent call l(...TRUNCATED)
"diff --git a/elasticdl/python/elasticdl/__init__.py b/elasticdl/python/elasticdl/__init__.py\n--- a(...TRUNCATED)
"{\"golden_diff\": \"diff --git a/elasticdl/python/elasticdl/__init__.py b/elasticdl/python/elasticd(...TRUNCATED)
"We are currently solving the following issue within our repository. Here is the issue text:\n--- BE(...TRUNCATED)
codespell-project__codespell-2626
[{"content":"#! /usr/bin/env python\n\nfrom setuptools import setup\n\nif __name__ == \"__main__\":\(...TRUNCATED)
[ { "content": null, "path": "setup.py" } ]
"diff --git a/.github/workflows/codespell-private.yml b/.github/workflows/codespell-private.yml\nind(...TRUNCATED)
"`python setup.py check` → `twine check`\nBecause `setup.py ...` is deprecated, we need an alterna(...TRUNCATED)
"diff --git a/setup.py b/setup.py\ndeleted file mode 100755\n--- a/setup.py\n+++ /dev/null\n@@ -1,6 (...TRUNCATED)
"{\"golden_diff\": \"diff --git a/setup.py b/setup.py\\ndeleted file mode 100755\\n--- a/setup.py\\n(...TRUNCATED)
"We are currently solving the following issue within our repository. Here is the issue text:\n--- BE(...TRUNCATED)
django__channels-1860
[{"content":"__version__ = \"3.0.4\"\n\ntry:\n import django\n\n if django.VERSION < (3, 2):\n(...TRUNCATED)
[{"content":"__version__ = \"3.0.5\"\n\ntry:\n import django\n\n if django.VERSION < (3, 2):\n(...TRUNCATED)
"diff --git a/CHANGELOG.txt b/CHANGELOG.txt\nindex b013f0f0a..a81f6254c 100644\n--- a/CHANGELOG.txt\(...TRUNCATED)
"Current version on Pypi is incompatible with Django 4.0+\nThe current version available on Pypi, ch(...TRUNCATED)
"diff --git a/channels/__init__.py b/channels/__init__.py\n--- a/channels/__init__.py\n+++ b/channel(...TRUNCATED)
"{\"golden_diff\": \"diff --git a/channels/__init__.py b/channels/__init__.py\\n--- a/channels/__ini(...TRUNCATED)
"We are currently solving the following issue within our repository. Here is the issue text:\n--- BE(...TRUNCATED)
MongoEngine__mongoengine-2224
[{"content":"# Import submodules so that we can expose their __all__\nfrom mongoengine import connec(...TRUNCATED)
[{"content":"# Import submodules so that we can expose their __all__\nfrom mongoengine import connec(...TRUNCATED)
"diff --git a/docs/changelog.rst b/docs/changelog.rst\nindex b308c5fba..06eb8d0ce 100644\n--- a/docs(...TRUNCATED)
"New release\nHi,\r\n\r\nWhen is coming new release, because I can't update to mongodb 4.2 because o(...TRUNCATED)
"diff --git a/mongoengine/__init__.py b/mongoengine/__init__.py\n--- a/mongoengine/__init__.py\n+++ (...TRUNCATED)
"{\"golden_diff\": \"diff --git a/mongoengine/__init__.py b/mongoengine/__init__.py\\n--- a/mongoeng(...TRUNCATED)
"We are currently solving the following issue within our repository. Here is the issue text:\n--- BE(...TRUNCATED)
scikit-image__scikit-image-6307
[{"content":"__all__ = ['python_to_notebook', 'Notebook']\n\nimport json\nimport copy\nimport warnin(...TRUNCATED)
[{"content":"__all__ = ['Notebook']\n\nimport json\nimport copy\nimport warnings\n\n\n# Skeleton not(...TRUNCATED)
"diff --git a/doc/ext/notebook_doc.py b/doc/ext/notebook_doc.py\nindex 432f1374c91..628ddd04727 1006(...TRUNCATED)
"Undefined names in Python code found with flake8\n## Description\r\n\r\n\r\n## Way to reproduce\r\n(...TRUNCATED)
"diff --git a/doc/ext/notebook_doc.py b/doc/ext/notebook_doc.py\n--- a/doc/ext/notebook_doc.py\n+++ (...TRUNCATED)
"{\"golden_diff\": \"diff --git a/doc/ext/notebook_doc.py b/doc/ext/notebook_doc.py\\n--- a/doc/ext/(...TRUNCATED)
"We are currently solving the following issue within our repository. Here is the issue text:\n--- BE(...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")


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

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 = json.dumps({"golden_diff": golden_diff})
    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(create_golden_diff, num_proc=10)
# example = ds_gen[-1]
# create_prompt(example)
ds_up = ds_gen.map(create_prompt, num_proc=10)
ds_up.push_to_hub("rasdani/github-patches-debug")
Downloads last month
0