CoolFace
Datasetpublic

12Parker/python-migrations

sourceHugging Faceupdated 2y agoView on Hugging Face
0likes92downloads
stacks-usecase-task-instances.jsonl.all2 linesDownload Raw Back to train
1{"repo": "intel/stacks-usecase", "pull_number": 37, "instance_id": "intel__stacks-usecase-37", "issue_numbers": "", "base_commit": "17a072d5b1a421ac40ae0464ca8965668578d9a6", "patch": "diff --git a/github-issue-classification/python/rest.py b/github-issue-classification/python/rest.py\n--- a/github-issue-classification/python/rest.py\n+++ b/github-issue-classification/python/rest.py\n@@ -16,39 +16,46 @@\n # limitations under the License.\n #\n \"\"\"a rest api for github issue classification\"\"\"\n-import flask\n-from flask_cors import CORS\n+import quart\n+\n+from quart import Quart\n+from quart_cors import cors\n+\n from infer import infer\n \n-app = flask.Flask(\"github issue classifier\")\n-CORS(app)\n \n-banner = {\"what\": \"github issue classifier\",\n-          \"usage\": {\n-              \"client\": \"curl -i -X POST -d '{'issue':'use experimental_jit_scope to enable XLA:CPU.' }' http://localhost:5059/github_issues/infer\",\n-              \"server\": \"docker run -d -p 5000:5000 stacks_img_recog\"\n-          }\n-          }\n+app = Quart(__name__)\n+cors(app)\n+\n+banner = {\n+    \"what\": \"github issue classifier\",\n+    \"usage\": {\n+        \"client\": \"curl -i -X POST -d '{'issue':'use experimental_jit_scope to enable XLA:CPU.' }' http://localhost:5059/github_issues/infer\",\n+        \"server\": \"docker run -d -p 5000:5000 stacks_img_recog\",\n+    },\n+}\n \n \n-@app.route('/github_issues/', methods=[\"GET\"])\n-def index():\n-    return flask.jsonify(banner), 201\n+@app.route(\"/\", methods=[\"get\"])\n+@app.route(\"/index\", methods=[\"get\"])\n+@app.route(\"/github_issues\", methods=[\"get\"])\n+async def index():\n+    return quart.jsonify(banner), 201\n \n \n-@app.route('/github_issues/infer', methods=[\"POST\"])\n-def pred():\n+@app.route(\"/github_issues/infer\", methods=[\"POST\"])\n+async def pred():\n     issue = list()\n-    issue.append(flask.request.json[\"issue\"])\n-    if not flask.request.json or not \"issue\" in flask.request.json:\n-        flask.abort(400)\n+    issue.append(quart.request.json[\"issue\"])\n+    if not quart.request.json or not \"issue\" in quart.request.json:\n+        quart.abort(400)\n     labels = infer(issue)\n-    return flask.jsonify({\"label\": labels}), 201\n+    return quart.jsonify({\"label\": labels}), 201\n \n \n @app.errorhandler(404)\n-def not_found(error):\n-    return flask.make_response(flask.jsonify({\"error\": \"Not found\"}), 404)\n+async def not_found(error):\n+    return quart.make_response(quart.jsonify({\"error\": \"Not found\"}), 404)\n \n \n if __name__ == \"__main__\":\n", "test_patch": "", "problem_statement": "", "hints_text": "", "created_at": "2019-11-26T20:06:53Z"}2