messages listlengths 2 2 | language stringclasses 8
values | prompt_type stringclasses 2
values | lint_errors int64 0 129 ⌀ | cyclomatic_complexity int64 0 32 ⌀ | license stringclasses 7
values | commit stringlengths 40 40 | repos stringlengths 5 116k | new_file stringlengths 4 220 | status stringclasses 6
values | error stringlengths 26 74 ⌀ | is_valid_syntax bool 2
classes |
|---|---|---|---|---|---|---|---|---|---|---|---|
[
{
"role": "user",
"content": "Write python code for the following: Add the prototype of the parser of letters"
},
{
"role": "assistant",
"content": "#coding=utf-8\nimport json\nFILE_PATH = '/file-path'\nFILE_NAME = 'file-name'\n\ndef main():\n fp = open(FILE_PATH + FILE_NAME + '.txt', 'r')\n ... | python | new_file | 1 | 8 | mit | 8174893b7226f53f89d7f52cfcb5dd073557da07 | LWAlphaMonkey/ArchitectureLaw,LWAlphaMonkey/ArchitectureLaw | tools/letters_parser.py | accepted | null | true |
[
{
"role": "user",
"content": "Write python code for the following: Add unit tests for pickle renderer"
},
{
"role": "assistant",
"content": "from flask import Flask\nfrom flask_webapi import WebAPI, APIView, renderer, route\nfrom flask_webapi.renderers import PickleRenderer\nfrom unittest import... | python | new_file | 1 | 1 | mit | 2f308fbefad5f5cee8b6e160e9a89fda7f4e1ba9 | viniciuschiele/flask-webapi | tests/test_renderers.py | accepted | null | true |
[
{
"role": "user",
"content": "Write python code for the following: Test ansi escape sequence function"
},
{
"role": "assistant",
"content": "#!/usr/bin/env python\n# -*- coding: utf-8 -*-\n\n\"\"\"Test the cprint function.\"\"\"\n\nfrom colorise.nix.color_functions import to_ansi\nimport pytest\... | python | new_file | 1 | 1 | bsd-3-clause | cebd5969fda658fd045c1228a8d28cc64fca103e | MisanthropicBit/colorise | tests/test_ansi.py | accepted | null | true |
[
{
"role": "user",
"content": "Here is the current file:\n```python\n#!/usr/bin/python\n\n# Gets stuff from Resident Advisor's awesome 'RA Recommends' section\n# Note: this is just regexing the HTML... so may stop working if page structure changes\n# This is not written by, or affiliated with Resident Adviso... | python | edit | 5 | 1 | mit | cd5678640e17cca0517c14f7d172b2ca1f10a560 | oldhill/ra-recommends | rarecommends.py | rejected_lint | Too many lint violations: 5 | true |
[
{
"role": "user",
"content": "Write python code for the following: Add some tests for bbox."
},
{
"role": "assistant",
"content": "import unittest\n\nfrom coral import bbox\n\nclass TestBBox(unittest.TestCase):\n\n def setUp(self):\n self.a = bbox.BBox((20, 30), (50, 40))\n self... | python | new_file | 1 | 3 | mit | 61747aa05f183e7b0712df08c81d9a181cd5abc5 | lecram/coral | tests/test_bbox.py | accepted | null | true |
[
{
"role": "user",
"content": "Write python code for the following: Add unit tests for util"
},
{
"role": "assistant",
"content": "#!/usr/bin/env python\n\n\"\"\"Package: mininet\n Test functions defined in mininet.util.\"\"\"\n\nimport unittest\n\nfrom mininet.util import quietRun\n\nclass tes... | python | new_file | 1 | 2 | bsd-3-clause | 5f69bf0adeee796ce2d66b605f1e65c67bc791bb | mininet/mininet,mininet/mininet,mininet/mininet | mininet/test/test_util.py | accepted | null | true |
[
{
"role": "user",
"content": "Write python code for the following: Add tests for send / get / remote op on parameters"
},
{
"role": "assistant",
"content": "import random\n\nimport torch\nimport torch.nn.functional as F\nfrom torch.nn import Parameter\nimport syft\n\nfrom syft.frameworks.torch.t... | python | new_file | 4 | 1 | apache-2.0 | 92d35c82ce4843129668d5102fa185a02f6d5b7a | OpenMined/PySyft,OpenMined/PySyft,OpenMined/PySyft,OpenMined/PySyft | test/torch/tensors/test_parameter.py | rejected_lint | Too many lint violations: 4 | true |
[
{
"role": "user",
"content": "Write python code for the following: Add the answer to the second question of Assignment 3"
},
{
"role": "assistant",
"content": "def evalQuadratic( a, b, c, x ):\n\n\ta = int ( a )\n\tb = int ( b )\n\tc = int ( c )\n\tx = int ( x )\n\n\ts = (a * (x ** 2)) + (b * x)... | python | new_file | 1 | 1 | mit | e4166b3cf4f37f74f6c7e1be2641f556e5763a1a | SuyashD95/python-assignments | evalQuadratic.py | accepted | null | true |
[
{
"role": "user",
"content": "Write python code for the following: Add test for general scoping case in nested blocks"
},
{
"role": "assistant",
"content": "import pytest\n\nfrom thinglang.execution.errors import UnknownVariable\nfrom thinglang.runner import run\n\n\ndef test_stack_resolution_in... | python | new_file | 4 | 1 | mit | 25889cd86d8c6a58793660d52dbdef3562f12b70 | ytanay/thinglang,ytanay/thinglang,ytanay/thinglang,ytanay/thinglang | tests/test_stack_operations.py | rejected_lint | Too many lint violations: 4 | true |
[
{
"role": "user",
"content": "Write python code for the following: Add script to generate webhooks"
},
{
"role": "assistant",
"content": "import requests\n\n\nURL = \"https://stripe.com/docs/api/curl/sections?all_sections=1&version=2019-02-19&cacheControlVersion=4\"\nresponse = requests.get(URL)... | python | new_file | 1 | 0 | mit | d9bdaf77e2b9834efd3539ec6ce599804a84b5dc | pinax/django-stripe-payments | update_webhooks.py | accepted | null | true |
[
{
"role": "user",
"content": "Write python code for the following: Add new Class Based Movment"
},
{
"role": "assistant",
"content": "import RPi.GPIO as gpio\nimport time\nclass move:\n\n def __init__(self, RF,RB,LF,LB,SLEEP):\n self.RF = RF\n self.RB = RB\n self.LF = LF\n ... | python | new_file | 2 | 2 | apache-2.0 | cf7e8ec08410ce4567d7fc32f7c37c8a639e2039 | aateichman/Vision | learn.py | accepted | null | true |
[
{
"role": "user",
"content": "Write python code for the following: Test async objects for __repr__ as well"
},
{
"role": "assistant",
"content": "from butter.asyncio.eventfd import Eventfd_async\nfrom butter.asyncio.fanotify import Fanotify_async\nfrom butter.asyncio.inotify import Inotify_async... | python | new_file | 3 | 1 | bsd-3-clause | b082b72fc0c6b297571131cbc23c78f62b1aa96b | arkaitzj/python-butter | tests/unit/asyncio/test_asyncio_repr.py | accepted | null | true |
[
{
"role": "user",
"content": "Write python code for the following: Add management command to report computed stats"
},
{
"role": "assistant",
"content": "from django.core.management.base import BaseCommand\n\nfrom dimagi.ext.couchdbkit import Document\n\nfrom corehq.util.metrics import metrics_g... | python | new_file | 1 | 3 | bsd-3-clause | 2ca3da2ffe97c1b77f8713d19819f44bf88728ed | dimagi/commcare-hq,dimagi/commcare-hq,dimagi/commcare-hq,dimagi/commcare-hq,dimagi/commcare-hq | corehq/apps/hqadmin/management/commands/report_code_metrics.py | accepted | null | true |
[
{
"role": "user",
"content": "Here is the current file:\n```python\nfrom scoring_engine.config_loader import ConfigLoader\n\n\nclass MockConfig(object):\n def __init__(self, location):\n self.file_location = location\n\n @property\n def config(self):\n return ConfigLoader(self.file_lo... | python | edit | 1 | 1 | mit | 5a0ec237878512c408dd392c20b440033aed402b | pwnbus/scoring_engine,pwnbus/scoring_engine,pwnbus/scoring_engine,pwnbus/scoring_engine | tests/mock_config.py | accepted | null | true |
[
{
"role": "user",
"content": "Write python code for the following: Add test cases for the first 4 problems"
},
{
"role": "assistant",
"content": "# Hack to allow import of ProjectEulerAnswers while it is still at top level.\nfrom os import path\nimport sys\nsys.path.append(path.dirname(path.dirn... | python | new_file | 1 | 3 | mit | e19d8b0deaf5c7d3d98d25ed42f932ee0281f728 | tofu-rocketry/project-euler | project_euler/test/tests.py | accepted | null | true |
[
{
"role": "user",
"content": "Write python code for the following: Add first example: cheapest destinations"
},
{
"role": "assistant",
"content": "'''\nFinds the cheapest fares filed to a given city\n\nExample:\n python cheapest-destinations.py YTO\n\nResult:\n FLL 165.62\n MCO 165.62\n... | python | new_file | 4 | 4 | mit | cfa1a738da0d8bff2ab20f7070eab9e6ea967c49 | Jamil/sabre_dev_studio | examples/cheapest_destinations.py | rejected_lint | Too many lint violations: 4 | true |
[
{
"role": "user",
"content": "Write python code for the following: Add tests for SA synonym"
},
{
"role": "assistant",
"content": "import sqlalchemy as sa\nfrom sqlalchemy.ext.hybrid import hybrid_property\nfrom wtforms_alchemy import ModelForm\nfrom tests import ModelFormTestCase\n\n\nclass Tes... | python | new_file | 1 | 1 | bsd-3-clause | 7bafcf68f419a87f996960fb9be304468bc5154a | quantus/wtforms-alchemy,kelvinhammond/wtforms-alchemy,williamwu0220/wtforms-alchemy | tests/test_synonym.py | accepted | null | true |
[
{
"role": "user",
"content": "Write python code for the following: Allow starting IPython as `python -m IPython`.\n\nCloses #2541."
},
{
"role": "assistant",
"content": "# encoding: utf-8\n\"\"\"Terminal-based IPython entry point.\n\"\"\"\n#-------------------------------------------------------... | python | new_file | 1 | 0 | bsd-3-clause | a846eadb0cdf02ace459e300ae4da7710754263f | ipython/ipython,ipython/ipython | IPython/__main__.py | accepted | null | true |
[
{
"role": "user",
"content": "Here is the current file:\n```python\n\"\"\"\nUdiskie automounter daemon.\n\"\"\"\n__all__ = ['AutoMounter']\n\nclass AutoMounter(object):\n \"\"\"\n Automatically mount newly added media.\n \"\"\"\n def __init__(self, mounter):\n self.mounter = mounter\n\n ... | python | edit | 1 | 1 | mit | 20f1dfd80dc6090c2b82ec0847315585d2ecf26b | khardix/udiskie,coldfix/udiskie,mathstuf/udiskie,coldfix/udiskie,pstray/udiskie,pstray/udiskie | udiskie/automount.py | accepted | null | true |
[
{
"role": "user",
"content": "Here is the current file:\n```python\nfrom invocations.docs import docs, www, sites, watch_docs\nfrom invocations.testing import test, coverage, integration, watch_tests\nfrom invocations.packaging import vendorize, release\n\nfrom invoke import Collection\nfrom invoke.util imp... | python | edit | 1 | 0 | bsd-2-clause | 0ebf0ecf1b4591960cd8b56a68eabf71fe85329d | mkusz/invoke,mkusz/invoke,pyinvoke/invoke,pyinvoke/invoke | tasks.py | accepted | null | true |
[
{
"role": "user",
"content": "Here is the current file:\n```python\n#This file is part of Tryton & Nereid. The COPYRIGHT file at the top level of\n#this repository contains the full copyright notices and license terms.\n\nfrom setuptools import setup\n\nsetup(\n name='Nereid',\n version='2.8.0.2',\n ... | python | edit | 1 | 0 | bsd-3-clause | 6676d3fdc7a50f7b694d557a1f3daff154fbd221 | fulfilio/nereid,prakashpp/nereid,usudaysingh/nereid,prakashpp/nereid,riteshshrv/nereid,riteshshrv/nereid,usudaysingh/nereid,fulfilio/nereid | setup.py | accepted | null | true |
[
{
"role": "user",
"content": "Write python code for the following: Add functions to calculate Fisher information."
},
{
"role": "assistant",
"content": "\"\"\"\nFisher information matrix of a Dirichlet distribution.\n\n\"\"\"\nfrom __future__ import division\n\nimport numpy as np\n\nimport scipy... | python | new_file | 5 | 3 | unlicense | 3e9c3fb3ba1a05a751f2587a24d163f9c9fca7cb | chebee7i/twitter,chebee7i/twitter,chebee7i/twitter | twitterproj/fisher.py | rejected_lint | Too many lint violations: 5 | true |
[
{
"role": "user",
"content": "Write python code for the following: Add a smoke test for negated phrase matches."
},
{
"role": "assistant",
"content": "\"\"\"Tests for string searches\"\"\"\n\nfrom nose.tools import eq_\n\nfrom dxr.testing import SingleFileTestCase, MINIMAL_MAIN\n\n\nclass String... | python | new_file | 1 | 1 | mit | e63f4e7b42b85e25fc89a31d0a622b19e01a1227 | gartung/dxr,jay-z007/dxr,kleintom/dxr,pelmers/dxr,gartung/dxr,KiemVM/Mozilla--dxr,jbradberry/dxr,srenatus/dxr,pelmers/dxr,erikrose/dxr,pelmers/dxr,gartung/dxr,erikrose/dxr,bozzmob/dxr,pombredanne/dxr,kleintom/dxr,kleintom/dxr,bozzmob/dxr,bozzmob/dxr,kleintom/dxr,jbradberry/dxr,jbradberry/dxr,gartung/dxr,srenatus/dxr,Ki... | tests/test_strings.py | accepted | null | true |
[
{
"role": "user",
"content": "Here is the current file:\n```python\nimport os\nimport subprocess\nfrom distutils.util import strtobool\n\nfrom rbtools.utils.filesystem import make_tempfile\n\n\ndef confirm(question):\n \"\"\"Interactively prompt for a Yes/No answer.\n\n Accepted values (case-insensiti... | python | edit | 3 | 4 | mit | cb12e5da17a115ea751df604158992af7c0d6573 | davidt/rbtools,haosdent/rbtools,halvorlu/rbtools,davidt/rbtools,halvorlu/rbtools,reviewboard/rbtools,datjwu/rbtools,beol/rbtools,reviewboard/rbtools,haosdent/rbtools,datjwu/rbtools,reviewboard/rbtools,beol/rbtools,haosdent/rbtools,datjwu/rbtools,beol/rbtools,halvorlu/rbtools,davidt/rbtools | rbtools/utils/console.py | accepted | null | true |
[
{
"role": "user",
"content": "Here is the current file:\n```python\n\"\"\"\nsetup.py\n\"\"\"\n\nfrom setuptools import setup, find_packages\n\nsetup(\n name='SATOSA',\n version='2.1.1',\n description='Protocol proxy (SAML/OIDC).',\n author='DIRG',\n author_email='<EMAIL>',\n license='Apach... | python | edit | 1 | 0 | apache-2.0 | eb09556cec13f2c80f57c7619d09d85d7fc29f32 | irtnog/SATOSA,irtnog/SATOSA,SUNET/SATOSA,its-dirg/SATOSA,SUNET/SATOSA | setup.py | accepted | null | true |
[
{
"role": "user",
"content": "Write python code for the following: Solve problem 1 in Python"
},
{
"role": "assistant",
"content": "sum = 0\n\nfor i in range(1, 1000):\n if i % 3 == 0 or i % 5 == 0:\n sum += i\n #print(\"i:\", i)\n\nprint(\"Result:\", sum)\n"
}
] | python | new_file | 1 | 0 | mit | d4ad071a80bdbbc7e1ecc278800191bdf33f95c2 | sirodoht/project-euler,sirodoht/project-euler,sirodoht/project-euler | problem_1.py | accepted | null | true |
[
{
"role": "user",
"content": "Write python code for the following: Add draft of the mixed operator for the gravity wave problem"
},
{
"role": "assistant",
"content": "from __future__ import absolute_import, print_function, division\n\nfrom firedrake import *\n\nfrom function_spaces import genera... | python | new_file | null | null | mit | 125e2e67d71a70e29d36c6538d805bbb50008e46 | thomasgibson/firedrake-hybridization | gravity_waves/mixedoperators.py | rejected_syntax | Syntax error detected by tree-sitter | false |
[
{
"role": "user",
"content": "Write python code for the following: Remove cascading deletes from quote foreign keys"
},
{
"role": "assistant",
"content": "revision = '72a56f6f1148'\ndown_revision = 'be28e555a2da'\nbranch_labels = None\ndepends_on = None\n\nimport alembic\nimport sqlalchemy\n\nde... | python | new_file | 3 | 1 | apache-2.0 | 9746e6f16dc0190dfd10c0499eec260a26d0c9f6 | mrphlip/lrrbot,andreasots/lrrbot,andreasots/lrrbot,andreasots/lrrbot,mrphlip/lrrbot,mrphlip/lrrbot | alembic/versions/72a56f6f1148_fix_foreign_key_cascades.py | accepted | null | true |
[
{
"role": "user",
"content": "Write python code for the following: Add module for reading sandboxed python from a file"
},
{
"role": "assistant",
"content": "# Copyright 2013 John Reese\n# Licensed under the MIT license\n\nimport json\n\nfrom os import path\n\ndef read_config(filepath, defaults=... | python | new_file | 3 | 3 | mit | 319342a34feab6781986efb30aa69b2623460654 | jreese/ircstat,jreese/ircstat | ircstat/config.py | accepted | null | true |
[
{
"role": "user",
"content": "Write python code for the following: Test file that works 4 me. Adding some info on the doc in a second."
},
{
"role": "assistant",
"content": "\"\"\"\n Code based on:\n https://github.com/mvillalba/python-ant/blob/develop/demos/ant.core/03-basicchannel.py... | python | new_file | 3 | 3 | mit | ed8514a2d9f60bad6bea8174ef5263164f9f4857 | jtoumey/powerBasedCC | test/antTest.py | accepted | null | true |
[
{
"role": "user",
"content": "Write python code for the following: Add tests to ensure seed values result in different samples"
},
{
"role": "assistant",
"content": "import numpy as np\n\nfrom SALib.sample import fast_sampler, finite_diff, latin, saltelli\nfrom SALib.sample.morris import sample ... | python | new_file | 1 | 1 | mit | edc0bf262e449d3b5ff2c9fb602f21536d7ba985 | jdherman/SALib,jdherman/SALib,SALib/SALib | tests/test_sample_seed.py | accepted | null | true |
[
{
"role": "user",
"content": "Write python code for the following: Add metadata to subscription request for welcome message setting"
},
{
"role": "assistant",
"content": "# -*- coding: utf-8 -*-\n# Generated by Django 1.9.1 on 2016-03-30 13:57\nfrom __future__ import unicode_literals\n\nimport d... | python | new_file | 1 | 0 | bsd-3-clause | ef3dc09af13bcb98667797a649cc9a2ff8af34ae | praekelt/hellomama-registration,praekelt/hellomama-registration | registrations/migrations/0005_subscriptionrequest_metadata.py | accepted | null | true |
[
{
"role": "user",
"content": "Write python code for the following: Add rough time so when Felix adds time since last play, he can use this to show it."
},
{
"role": "assistant",
"content": "def _DoRough(time, big, bigname, little, littlename):\n b = int(time / big / little)\n l = int(((tim... | python | new_file | 2 | 5 | bsd-3-clause | c7136b117696b10664a7b6427f5293813bd1d3b0 | erbridge/NQr,erbridge/NQr,erbridge/NQr | Time.py | accepted | null | true |
[
{
"role": "user",
"content": "Write python code for the following: Add missing file to git"
},
{
"role": "assistant",
"content": "import random\n\ndef random_choice(p=0.5):\n \"\"\"\n Return 'C' wit probability `p`, else return 'D'\n\n Emulates Python's random.choice(['C', 'D']) since i... | python | new_file | 1 | 2 | mit | 2a579b7df30546e642d87b70417ecf8a1a9590e0 | ranjinidas/Axelrod,marcharper/Axelrod,marcharper/Axelrod,ranjinidas/Axelrod | axelrod/random_.py | accepted | null | true |
[
{
"role": "user",
"content": "Write python code for the following: Add unittests module for cat2cohort\n\nI want to have unit tests for the methods in cat2cohort.\n\nAdd empty module implementing unittest."
},
{
"role": "assistant",
"content": "\"\"\"Unit tests for cat2cohort.\"\"\"\n\nimport un... | python | new_file | 3 | 0 | mit | 351ec5ef16a131d69054d05cef7666890a7d8888 | danmichaelo/wm_metrics,danmichaelo/wm_metrics,danmichaelo/wm_metrics,danmichaelo/wm_metrics,Commonists/wm_metrics,Commonists/wm_metrics,Commonists/wm_metrics,Commonists/wm_metrics | tests/test_cat2cohort.py | accepted | null | true |
[
{
"role": "user",
"content": "Write python code for the following: Add text plot 1d test case."
},
{
"role": "assistant",
"content": "import unittest\n\nfrom numpy import alltrue, arange\nfrom enable.compiled_path import CompiledPath\n\n# Chaco imports\nfrom chaco.api import (ArrayDataSource, Da... | python | new_file | 3 | 1 | bsd-3-clause | d3aa2c658ae3ba624b209a1d583fa97137ab2e23 | tommy-u/chaco,tommy-u/chaco,tommy-u/chaco | chaco/tests/text_plot_1d_test_case.py | accepted | null | true |
[
{
"role": "user",
"content": "Write python code for the following: Add script for computing total project size."
},
{
"role": "assistant",
"content": "#!/usr/bin/env python\n\nimport rethinkdb as r\nfrom optparse import OptionParser\n\n\ndef compute_project_size(project_id, conn):\n total = 0... | python | new_file | 2 | 3 | mit | 328eef0c145c1efbaedd9453d515955012d1a975 | materials-commons/materialscommons.org,materials-commons/materialscommons.org,materials-commons/materialscommons.org,materials-commons/materialscommons.org,materials-commons/materialscommons.org | backend/scripts/projsize.py | accepted | null | true |
[
{
"role": "user",
"content": "Write python code for the following: Create function for parameter correction."
},
{
"role": "assistant",
"content": "import numpy as np\n\n\ndef param_correction(start, params, order):\n pos = np.round(start.copy())\n oldpos = np.round(start.copy())\n pos_... | python | new_file | 1 | 2 | mit | 0df2f253dd2f5059b76cfa5527b9705375c9c617 | petroolg/robo-spline | utils.py | accepted | null | true |
[
{
"role": "user",
"content": "Write python code for the following: Add a snippet (Python OpenCV)."
},
{
"role": "assistant",
"content": "#!/usr/bin/env python\n# -*- coding: utf-8 -*-\n\n# Copyright (c) 2015 Jérémie DECOCK (http://www.jdhp.org)\n\n\"\"\"\nOpenCV - Read image: read an image given... | python | new_file | 1 | 1 | mit | d3da3bdd178de4cbda5b42db11bf17cab73056e5 | jeremiedecock/snippets,jeremiedecock/snippets,jeremiedecock/snippets,jeremiedecock/snippets,jeremiedecock/snippets,jeremiedecock/snippets,jeremiedecock/snippets,jeremiedecock/snippets,jeremiedecock/snippets,jeremiedecock/snippets,jeremiedecock/snippets,jeremiedecock/snippets,jeremiedecock/snippets | python/opencv/opencv_2/read_image.py | accepted | null | true |
[
{
"role": "user",
"content": "Write python code for the following: Add initial version of game parser test script"
},
{
"role": "assistant",
"content": "#!/usr/bin/env python\n# -*- coding: utf-8 -*-\n\nimport os\nimport requests\nfrom lxml import html\n\nfrom parsers.game_parser import GamePars... | python | new_file | 1 | 1 | mit | 23be51d959763235df8ab44b7dc90047c33002c3 | leaffan/pynhldb | tests/test_game_parser.py | accepted | null | true |
[
{
"role": "user",
"content": "Write python code for the following: Add missing migration to users"
},
{
"role": "assistant",
"content": "# -*- coding: utf-8 -*-\n# Generated by Django 1.11.2 on 2017-06-08 10:36\nfrom __future__ import unicode_literals\n\nfrom django.db import migrations, models\... | python | new_file | 1 | 0 | mit | fcbed0346d9f5abd1c4e2f6b98f28818a73d9ec5 | mikkokeskinen/tunnistamo,mikkokeskinen/tunnistamo | users/migrations/0010_add_fields_to_users_applications.py | accepted | null | true |
[
{
"role": "user",
"content": "Write python code for the following: Add fractional knapsack greedy algorithm\n\nImplemented in Python"
},
{
"role": "assistant",
"content": "def FractionalKnapsack(capacity, values, weights):\n rel_value = [val / weight for val, weight in zip(values, weights)]\n... | python | new_file | 1 | 6 | cc0-1.0 | 4afb6229c89237079966ab91bb4d2372818a7f44 | ZoranPandovski/al-go-rithms,ZoranPandovski/al-go-rithms,ZoranPandovski/al-go-rithms,ZoranPandovski/al-go-rithms,ZoranPandovski/al-go-rithms,ZoranPandovski/al-go-rithms,ZoranPandovski/al-go-rithms,ZoranPandovski/al-go-rithms,ZoranPandovski/al-go-rithms,ZoranPandovski/al-go-rithms,ZoranPandovski/al-go-rithms,ZoranPandovs... | greedy/fractional_knapsack/python/fractional_knapsack.py | accepted | null | true |
[
{
"role": "user",
"content": "Write python code for the following: Add snippet with code to generate new features"
},
{
"role": "assistant",
"content": "from sklearn.preprocessing import PolynomialFeatures\nfrom sklearn.decomposition import PCA\nimport numpy as np\n\nX = np.arange(9).reshape(3, ... | python | new_file | 5 | 0 | mit | 0267f8a61e067c7b1a92cb307de36c477f79b455 | davidgasquez/kaggle-airbnb | snippets/feature_generation.py | rejected_lint | Too many lint violations: 5 | true |
[
{
"role": "user",
"content": "Write python code for the following: Add UUID serialization test case (NC-1214)"
},
{
"role": "assistant",
"content": "from urlparse import urlparse\n\nfrom django.contrib.auth import get_user_model\nfrom django.core.urlresolvers import resolve\nfrom django.test imp... | python | new_file | 1 | 1 | mit | 7617826e2b9a01e9a377d6fa2c8f64768a184704 | opennode/nodeconductor,opennode/nodeconductor,opennode/nodeconductor | nodeconductor/structure/tests/unittests/test_serializer.py | accepted | null | true |
[
{
"role": "user",
"content": "Write python code for the following: Add basic ast to json converter"
},
{
"role": "assistant",
"content": "\"\"\"Parse python code into the abstract syntax tree and represent as JSON\"\"\"\nfrom __future__ import print_function\nimport ast\nfrom itertools import ch... | python | new_file | 3 | 5 | mit | e308575d9723c90d3a15e5e8de45b0232c5d0b75 | RishiRamraj/wensleydale | parse_ast.py | accepted | null | true |
[
{
"role": "user",
"content": "Write python code for the following: Add tool to fix up parsing tables"
},
{
"role": "assistant",
"content": "#!/usr/bin/env python\n\n\"\"\"\nA utility to fix PLY-generated lex and yacc tables to be Python 2 and\n3 compatible.\n\"\"\"\n\nimport os\n\nfor root, dirs... | python | new_file | 1 | 0 | bsd-3-clause | ef901f36d8eb8a3da1c747e64a79bd2fbad4878d | lpsinger/astropy,funbaker/astropy,tbabej/astropy,larrybradley/astropy,DougBurke/astropy,mhvk/astropy,DougBurke/astropy,larrybradley/astropy,MSeifert04/astropy,MSeifert04/astropy,AustereCuriosity/astropy,kelle/astropy,mhvk/astropy,mhvk/astropy,StuartLittlefair/astropy,AustereCuriosity/astropy,StuartLittlefair/astropy,ke... | dev/clean_parse_tables.py | accepted | null | true |
[
{
"role": "user",
"content": "Write python code for the following: Add test coverage for database resource"
},
{
"role": "assistant",
"content": "\"\"\" Tests the database class. \"\"\"\nimport requests_mock\n\nfrom . import BaseTest\nfrom ..resources import Database, BackupList\n\n@requests_moc... | python | new_file | 1 | 1 | mit | 4afbd87d3d6d0c4953f4c41b3c37abf1fc3be0f1 | skwashd/python-acquia-cloud | acapi/tests/test_database.py | accepted | null | true |
[
{
"role": "user",
"content": "Write python code for the following: Add a model field for states of Brazil"
},
{
"role": "assistant",
"content": "from django.utils.translation import ugettext_lazy as _\nfrom django.db.models.fields import CharField\n\nfrom .br_states import STATE_CHOICES\n\n\ncla... | python | new_file | 1 | 1 | bsd-3-clause | da4151a0e83e6738361b23edb2fda3ee0e386391 | zarelit/django-localflavor,rsalmaso/django-localflavor,maisim/django-localflavor,infoxchange/django-localflavor,M157q/django-localflavor,agustin380/django-localflavor,django/django-localflavor,thor/django-localflavor,jieter/django-localflavor | localflavor/br/models.py | accepted | null | true |
[
{
"role": "user",
"content": "Write python code for the following: Add rough state mapping class"
},
{
"role": "assistant",
"content": "import enum\nimport logging\nimport json\nimport cv2\nimport os\nfrom pynput import keyboard\n\nfrom src import screen, helper\n\nlogger = logging.getLogger(__n... | python | new_file | 5 | 8 | mit | 8fe69746a631054387019662d7aea37879909da7 | ENPH-479/dolphin-env-api,ENPH-479/dolphin-env-api,ENPH-479/dolphin-env-api,ENPH-479/dolphin-env-api | src/Mapping.py | rejected_lint | Too many lint violations: 5 | true |
[
{
"role": "user",
"content": "Write python code for the following: Add test suite for coin simulation."
},
{
"role": "assistant",
"content": "import unittest\nimport random\nimport math\n\nimport sims\n\nTRIALS = 1000 # number of trials to run per test case\nMAX_DEGREE = 1.5 # max degree of free... | python | new_file | 3 | 3 | mit | 374278b45dd8be76ef897881f61144ae79318827 | wei2912/bce-simulation,wei2912/bce-simulation,wei2912/bce-simulation,wei2912/bce-simulation | utils/test_sims.py | accepted | null | true |
[
{
"role": "user",
"content": "Here is the current file:\n```python\nfrom datetime import datetime\n\nfrom flask import render_template, redirect, jsonify\n\nfrom app.main import main\nfrom app.main.dao import users_dao\nfrom app.main.forms import RegisterUserForm\nfrom app.models import User\n\n\n@main.rout... | python | edit | 3 | 3 | mit | a4cd1c644d7b0636e0debc3a44df9d81a6fa7ce7 | alphagov/notifications-admin,alphagov/notifications-admin,gov-cjwaszczuk/notifications-admin,alphagov/notifications-admin,gov-cjwaszczuk/notifications-admin,gov-cjwaszczuk/notifications-admin,gov-cjwaszczuk/notifications-admin,alphagov/notifications-admin | app/main/views/register.py | accepted | null | true |
[
{
"role": "user",
"content": "Write python code for the following: Enable presubmit warning for \"git cl format\"\n\nBUG=None\n\nReview URL: https://codereview.chromium.org/835683004\n\nCr-Commit-Position: 972c6d2dc6dd5efdad1377c0d224e03eb8f276f7@{#311332}"
},
{
"role": "assistant",
"content": "... | python | new_file | 1 | 1 | bsd-3-clause | 3a0efca1a48563a50e634eeb3401b43b7e6b2da7 | PeterWangIntel/chromium-crosswalk,Just-D/chromium-1,ltilve/chromium,Pluto-tv/chromium-crosswalk,PeterWangIntel/chromium-crosswalk,axinging/chromium-crosswalk,TheTypoMaster/chromium-crosswalk,fujunwei/chromium-crosswalk,ltilve/chromium,chuan9/chromium-crosswalk,PeterWangIntel/chromium-crosswalk,Just-D/chromium-1,Fireble... | ash/PRESUBMIT.py | rejected_duplicate | Near-duplicate of sample 6930 | true |
[
{
"role": "user",
"content": "Write python code for the following: Fix svm drop columns test - add test that missing skipped_columns or skipped_columns = [] should work correctly and give the same frame as original one"
},
{
"role": "assistant",
"content": "from __future__ import print_function\... | python | new_file | 1 | 1 | apache-2.0 | 045e8b0dabd265e2f8cf0cbf26a5d912345a4533 | h2oai/h2o-3,michalkurka/h2o-3,michalkurka/h2o-3,michalkurka/h2o-3,michalkurka/h2o-3,h2oai/h2o-3,h2oai/h2o-3,h2oai/h2o-3,h2oai/h2o-3,michalkurka/h2o-3,michalkurka/h2o-3,h2oai/h2o-3,h2oai/h2o-3,michalkurka/h2o-3,h2oai/h2o-3 | h2o-py/tests/testdir_parser/pyunit_PUBDEV_5705_drop_columns_parser_svmlight_large.py | accepted | null | true |
[
{
"role": "user",
"content": "Write python code for the following: Add (currently failing) test with URR (n,gamma) reaction rate check"
},
{
"role": "assistant",
"content": "import openmc\nimport pytest\n\n\n@pytest.fixture\ndef th232_model():\n # URR boundaries for Th232\n e_min, e_max = ... | python | new_file | 1 | 1 | mit | e54785f1a7aa8aff1d652d3caef36f8aa04cd91f | amandalund/openmc,amandalund/openmc,walshjon/openmc,amandalund/openmc,walshjon/openmc,walshjon/openmc,shikhar413/openmc,amandalund/openmc,shikhar413/openmc,shikhar413/openmc,shikhar413/openmc,walshjon/openmc | tests/unit_tests/test_urr_capture.py | accepted | null | true |
[
{
"role": "user",
"content": "Write python code for the following: Prepare constants into seperate location"
},
{
"role": "assistant",
"content": "NIST_KEY_FREQUENCY = 'frequency'\nNIST_KEY_OUTPUT_VALUE = 'outputValue'\nNIST_KEY_PREVIOUS_OUTPUT_VALUE = 'previousOutputValue'\nNIST_KEY_SEED_VALUE ... | python | new_file | 1 | 0 | apache-2.0 | b1bb4154a69a6ae4bb31cbf27f0871069291e1d6 | urda/nistbeacon | nist_beacon_constants.py | accepted | null | true |
[
{
"role": "user",
"content": "Write python code for the following: Add skeleton script to draw similarites between objects"
},
{
"role": "assistant",
"content": "import json\nimport networkx as nx\nfrom networkx.readwrite import json_graph\n\nwith open(\"/query_results.json\") as f:\n json_da... | python | new_file | 3 | 0 | mit | dc2def7ab47c93ed9c92c5535609ebbb375dff56 | PinPinIre/Final-Year-Project,PinPinIre/Final-Year-Project,PinPinIre/Final-Year-Project | src/draw_json_graph.py | accepted | null | true |
[
{
"role": "user",
"content": "Write python code for the following: Add handy number checker script"
},
{
"role": "assistant",
"content": "# -*- coding: utf-8 -*-\nimport feedparser\n\nurl = \"https://edit.yournextmp.com/results/all.atom\"\nfeed = feedparser.parse(url)\n\nentries = {x['post_id']:... | python | new_file | 3 | 0 | mit | a3a8ba38c05741418c1a29e53a2079482b454453 | andylolz/ge2015-results-bot | check_numbers.py | accepted | null | true |
[
{
"role": "user",
"content": "Write python code for the following: Add an example with probability distribution estimates using GMM.\n\nThis is a work in progress. Also, the .eval() function from GMM\nmight very likely change it's return type in the future."
},
{
"role": "assistant",
"content": ... | python | new_file | 4 | 0 | bsd-3-clause | 32f4c67cda624f1840b1ab92d1d1afc826f13dd5 | mayblue9/scikit-learn,qifeigit/scikit-learn,rrohan/scikit-learn,shusenl/scikit-learn,jseabold/scikit-learn,huobaowangxi/scikit-learn,frank-tancf/scikit-learn,shangwuhencc/scikit-learn,Srisai85/scikit-learn,RPGOne/scikit-learn,appapantula/scikit-learn,raghavrv/scikit-learn,hdmetor/scikit-learn,yask123/scikit-learn,xyguo... | examples/plot_gmm_pdf.py | rejected_lint | Too many lint violations: 4 | true |
[
{
"role": "user",
"content": "Write python code for the following: Add a test Python script"
},
{
"role": "assistant",
"content": "from __future__ import print_function\nimport time\n\nfrom might_driver import MightyWattDriver\nfrom buck_driver import FCCBuckDriver\n\ndischarger = FCCMPPTDriver(... | python | new_file | 4 | 0 | bsd-2-clause | 7775d27af722031fc696693415d9f38d7f5409e2 | fnoorian/Free-buck-boost,fnoorian/Free-buck-boost,fnoorian/Free-buck-boost | drivers/test_logger.py | rejected_lint | Too many lint violations: 4 | true |
[
{
"role": "user",
"content": "Write python code for the following: Add unit test for process flood."
},
{
"role": "assistant",
"content": "# coding=utf-8\n\"\"\"Docstring here.\"\"\"\nimport unittest\nfrom django import test\n\nfrom realtime.tasks.realtime.flood import process_flood\nfrom realti... | python | new_file | 1 | 1 | bsd-2-clause | 4462b32aaa88628bc7c9f6746829c627bf79ddd2 | AIFDR/inasafe-django,AIFDR/inasafe-django,AIFDR/inasafe-django,AIFDR/inasafe-django | django_project/realtime/tasks/test/test_realtime_tasks.py | accepted | null | true |
[
{
"role": "user",
"content": "Write python code for the following: Add some scaffolding for Squid Proxy detection test"
},
{
"role": "assistant",
"content": "\"\"\"\n Squid Proxy Detector\n ********************\n\n\"\"\"\nimport os\nimport httplib\nimport urllib2\nfrom urlparse import urlp... | python | new_file | 7 | 3 | bsd-2-clause | da50bb53f05e487a00b3db2feb97ce37cf449afd | juga0/ooni-probe,Karthikeyan-kkk/ooni-probe,0xPoly/ooni-probe,0xPoly/ooni-probe,lordappsec/ooni-probe,0xPoly/ooni-probe,Karthikeyan-kkk/ooni-probe,kdmurray91/ooni-probe,Karthikeyan-kkk/ooni-probe,0xPoly/ooni-probe,juga0/ooni-probe,Karthikeyan-kkk/ooni-probe,kdmurray91/ooni-probe,juga0/ooni-probe,kdmurray91/ooni-probe,h... | tests/squid.py | rejected_lint | Too many lint violations: 7 | true |
[
{
"role": "user",
"content": "Write python code for the following: Add a script to copy data files conveniently."
},
{
"role": "assistant",
"content": "#! /usr/bin/python\n# -*- coding: utf-8 -*-\n\n\"\"\"Copy data from the given zip file to the project.\"\"\"\n\nimport argparse\nimport fnmatch\... | python | new_file | 1 | 4 | mit | 74ceceb6ccdb3b205a72aa6ca75b833c66eb659c | fyabc/MiniGames | HearthStone2/copy_data.py | accepted | null | true |
[
{
"role": "user",
"content": "Write python code for the following: Test that specific Failures are caught before parent Failures"
},
{
"role": "assistant",
"content": "from twisted.trial import unittest\n\nimport ooni.errors\n\nclass TestErrors(unittest.TestCase):\n\n def test_catch_child_fai... | python | new_file | 1 | 3 | bsd-2-clause | 525a8438bd601592c4f878ca5d42d3dab8943be0 | 0xPoly/ooni-probe,0xPoly/ooni-probe,0xPoly/ooni-probe,0xPoly/ooni-probe | ooni/tests/test_errors.py | rejected_duplicate | Near-duplicate of sample 7365 | true |
[
{
"role": "user",
"content": "Write python code for the following: Add some tests for dns config parsing"
},
{
"role": "assistant",
"content": "#!/usr/bin/env python\n# Copyright 2009 Google Inc. All Rights Reserved.\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you ... | python | new_file | 1 | 1 | apache-2.0 | 6e6f4b2ae0f085a649c1c4c3ebfe9c4aa6be37b1 | catap/namebench,jimmsta/namebench-1 | libnamebench/config_test.py | accepted | null | true |
[
{
"role": "user",
"content": "Write python code for the following: Add a basic integrator + solution class"
},
{
"role": "assistant",
"content": "import numpy as np\nfrom scipy.integrate import solve_ivp\nfrom scipy.interpolate import interp1d\nfrom scipy.sparse import csr_matrix, csc_matrix\nfr... | python | new_file | 1 | 2 | mit | f0e4228d648617e374fb4848f980d72684e913c7 | PMEAL/OpenPNM | openpnm/solvers/_scipy.py | accepted | null | true |
[
{
"role": "user",
"content": "Write python code for the following: Add locator file for winter '20. Without this file, Salesforce.py will throw an error when it's imported while testing Winter '20."
},
{
"role": "assistant",
"content": "from cumulusci.robotframework import locators_46\n\nlex_loc... | python | new_file | 1 | 0 | bsd-3-clause | 4307ae93af2ee440570d2f642e62aa0a3baeecde | SalesforceFoundation/CumulusCI,SalesforceFoundation/CumulusCI | cumulusci/robotframework/locators_47.py | accepted | null | true |
[
{
"role": "user",
"content": "Write python code for the following: Add an empty package (classifiers)."
},
{
"role": "assistant",
"content": "#!/usr/bin/env python3\n# -*- coding: utf-8 -*-\n\n# Copyright (c) 2016 Jérémie DECOCK (http://www.jdhp.org)\n\n# This script is provided under the terms ... | python | new_file | 1 | 0 | mit | 0ed11ea6b92741a0ed232a93f1876204e14b0c53 | jdhp-sap/data-pipeline-standalone-scripts,jdhp-sap/sap-cta-data-pipeline,jdhp-sap/sap-cta-data-pipeline,jdhp-sap/data-pipeline-standalone-scripts | datapipe/classifiers/__init__.py | accepted | null | true |
[
{
"role": "user",
"content": "Write python code for the following: Add simple scanner pipeline to help with job submission"
},
{
"role": "assistant",
"content": "\"\"\"\nCopyright [2009-2018] EMBL-European Bioinformatics Institute\nLicensed under the Apache License, Version 2.0 (the \"License\")... | python | new_file | 4 | 3 | apache-2.0 | 2901763a10aa318112efecc2b5a56d83391f4de5 | Rfam/rfam-production,Rfam/rfam-production,Rfam/rfam-production | pipelines/genome_scanner.py | rejected_lint | Too many lint violations: 4 | true |
[
{
"role": "user",
"content": "Write python code for the following: Add python driver (depend on PyV8)"
},
{
"role": "assistant",
"content": "#!/usr/bin/env python\n# -*- coding: utf-8 -*-\n\nimport os\nimport sys\nimport PyV8\nimport urllib\nfrom urlparse import urlparse\n\ntry:\n import json... | python | new_file | 2 | 1 | mit | 9e900eb16e92027cfe990a07c5703a6adbb41a09 | WPO-Foundation/Wappalyzer,WPO-Foundation/Wappalyzer,WPO-Foundation/Wappalyzer,AliasIO/wappalyzer,AliasIO/wappalyzer | drivers/python/wappalyzer.py | accepted | null | true |
[
{
"role": "user",
"content": "Write python code for the following: Add early analysis script for traces"
},
{
"role": "assistant",
"content": "import numpy as np\nfrom scipy import ndimage as ndi\nfrom skimage.filters import threshold_otsu\n\n\ndef _extract_roi(image, axis=-1):\n max_frame = ... | python | new_file | 1 | 1 | mit | 34080178f92de8e74138d2e8c361b877c55b6150 | jni/python-redshirt | redshirt/analyze.py | accepted | null | true |
[
{
"role": "user",
"content": "Write python code for the following: Add an example of interop with descartes and matplotlib"
},
{
"role": "assistant",
"content": "\nimport logging\nimport sys\n\nfrom matplotlib import pyplot\nfrom descartes import PolygonPatch\n\nfrom fiona import collection\n\n\... | python | new_file | 4 | 0 | bsd-3-clause | 94855b850f9ad71375ce0792a7b94f0d0662b9c0 | Toblerity/Fiona,rbuffat/Fiona,sgillies/Fiona,Toblerity/Fiona,johanvdw/Fiona,perrygeo/Fiona,rbuffat/Fiona,perrygeo/Fiona | examples/with-descartes.py | rejected_lint | Too many lint violations: 4 | true |
[
{
"role": "user",
"content": "Write python code for the following: Add function for python implementation of fibonacci sequence"
},
{
"role": "assistant",
"content": "# Implement fibonacci sequence function using recursion\n\ndef get_fib(position):\n\tif position < 2: # base case\n\t\treturn pos... | python | new_file | 1 | 2 | mit | 4a18d55f6d4785bc5e3f38b95ade854d5412b0df | derekmpham/interview-prep,derekmpham/interview-prep | fib-seq-recur.py | accepted | null | true |
[
{
"role": "user",
"content": "Write python code for the following: Add the management commands unit tests."
},
{
"role": "assistant",
"content": "\"\"\"Tests for the management commands\"\"\"\nfrom __future__ import absolute_import\nfrom django.conf import settings\nfrom django.core import manag... | python | new_file | 1 | 1 | mit | a83048076db03923f0b3eff1e9d77f3b4b259c34 | mingchen/django-cas-ng,nitmir/django-cas-ng,pbaehr/django-cas-ng,bgroff/django-cas-ng | tests/test_commands.py | accepted | null | true |
[
{
"role": "user",
"content": "Write python code for the following: Add the migration for the image field"
},
{
"role": "assistant",
"content": "# -*- coding: utf-8 -*-\nfrom __future__ import unicode_literals\n\nfrom django.db import models, migrations\n\n\nclass Migration(migrations.Migration):... | python | new_file | 1 | 0 | mit | 4a360a4d678d561bb74e37f857cfd09d35747db7 | mauricioabreu/speakerfight,luanfonceca/speakerfight,luanfonceca/speakerfight,luanfonceca/speakerfight,mauricioabreu/speakerfight,mauricioabreu/speakerfight | core/migrations/0002_profile_image.py | accepted | null | true |
[
{
"role": "user",
"content": "Write python code for the following: Add script to convert regex to enum in schemas\n\nThis script is just to record how regular expression patterns describing\nchoices were converted into enums in the json schemas."
},
{
"role": "assistant",
"content": "import json... | python | new_file | 1 | 7 | mit | 5fc353fed4c839a050ef986a39fbc63d5464f492 | RichardKnop/digitalmarketplace-api,mtekel/digitalmarketplace-api,mtekel/digitalmarketplace-api,alphagov/digitalmarketplace-api,alphagov/digitalmarketplace-api,mtekel/digitalmarketplace-api,RichardKnop/digitalmarketplace-api,RichardKnop/digitalmarketplace-api,alphagov/digitalmarketplace-api,RichardKnop/digitalmarketplac... | scripts/tmp/rewrite.py | accepted | null | true |
[
{
"role": "user",
"content": "Write python code for the following: Add my configuration file as an example."
},
{
"role": "assistant",
"content": "import libqtile\n\nkeys = [\n libqtile.Key(\n [\"mod1\"], \"k\",\n libqtile.command.Call(\"max_next\").when(layout=\"max\"),\n ... | python | new_file | 1 | 0 | mit | b670f82fa6cd9781b325a7906238e4beee0975ab | kseistrup/qtile,kynikos/qtile,nxnfufunezn/qtile,kseistrup/qtile,jdowner/qtile,kynikos/qtile,jdowner/qtile,himaaaatti/qtile,StephenBarnes/qtile,qtile/qtile,soulchainer/qtile,tych0/qtile,cortesi/qtile,bavardage/qtile,dequis/qtile,xplv/qtile,aniruddhkanojia/qtile,farebord/qtile,kopchik/qtile,kopchik/qtile,xplv/qtile,andre... | examples/cortesi-config.py | accepted | null | true |
[
{
"role": "user",
"content": "Write python code for the following: Add alembic script to fix the type of the column updated_at of shelters"
},
{
"role": "assistant",
"content": "\"\"\"fix the type of the updated_at column for shelters\n\nRevision ID: 953c5e0cebad\nRevises: 9bfedc780ac5\nCreate D... | python | new_file | 3 | 1 | mit | 0a3431a597cb0ff000431dcc79ceeeec3048a3c1 | cedricbonhomme/shelter-database,cedricbonhomme/shelter-database,cedricbonhomme/shelter-database,cedricbonhomme/shelter-database | migrations/versions/953c5e0cebad_fix_the_type_of_the_updated_at_column_.py | accepted | null | true |
[
{
"role": "user",
"content": "Write python code for the following: Add untested Fourier linear function approximator"
},
{
"role": "assistant",
"content": "# -*- coding: utf-8 -*-\n\nfrom __future__ import unicode_literals\n\nimport itertools\n\nimport numpy as np\n\ndef make_feature_vec(state_r... | python | new_file | 1 | 1 | mit | 49fbd4c43465888d706d336c78f187c3849539e4 | rmoehn/cartpole | hiora_cartpole/fourier_fa.py | accepted | null | true |
[
{
"role": "user",
"content": "Write python code for the following: tests: Add test for zlibd module."
},
{
"role": "assistant",
"content": "try:\n import zlib\nexcept ImportError:\n import zlibd as zlib\n\nPATTERNS = [\n # Packed results produced by CPy's zlib.compress()\n (b'0', b'x... | python | new_file | 1 | 0 | mit | 5073d3da07cff017cc567ebc73f06d862c21c839 | turbinenreiter/micropython,cwyark/micropython,ryannathans/micropython,alex-robbins/micropython,pfalcon/micropython,dhylands/micropython,warner83/micropython,henriknelson/micropython,AriZuu/micropython,mhoffma/micropython,adafruit/micropython,noahchense/micropython,adafruit/micropython,AriZuu/micropython,tobbad/micropyt... | tests/extmod/zlib_decompress.py | accepted | null | true |
[
{
"role": "user",
"content": "Write python code for the following: Add helper for git clean that keeps the IDE folders"
},
{
"role": "assistant",
"content": "import subprocess\n\n# Keep the following directories\n# - .vscode (Visual Studio code project settings)\n# - .vs (Visual Studio project f... | python | new_file | 1 | 0 | apache-2.0 | 1beb325fb2bf61689db6fc20ccb829285165227d | MSeifert04/iteration_utilities,MSeifert04/iteration_utilities,MSeifert04/iteration_utilities,MSeifert04/iteration_utilities | helper/git_clean_keep_ide_settings.py | accepted | null | true |
[
{
"role": "user",
"content": "Write python code for the following: Implement database driver for MongoDB"
},
{
"role": "assistant",
"content": "# coding: utf-8\n\nimport urllib.parse\n\nimport pymongo\nimport pymongo.database\nimport pymongo.uri_parser\n\nimport lglass.database.base\nimport lgla... | python | new_file | 1 | 4 | mit | 696be529ceaef9a9ab6fa43d599456d92336c083 | fritz0705/lglass | lglass/database/mongodb.py | accepted | null | true |
[
{
"role": "user",
"content": "Write python code for the following: Add script for profiling the generate process."
},
{
"role": "assistant",
"content": "#!/usr/bin/env python\n# -*- coding: utf-8 -*-\nfrom logya.generate import Generate\n\nimport cProfile, pstats, io\nfrom pstats import SortKey\... | python | new_file | 1 | 0 | mit | 73111cf0f1ab101ad0c75ab23de6e121a8eb656f | elaOnMars/logya,elaOnMars/logya,yaph/logya,yaph/logya,elaOnMars/logya | scripts/profile_generate.py | accepted | null | true |
[
{
"role": "user",
"content": "Write python code for the following: Add some tests for analyses handlers"
},
{
"role": "assistant",
"content": "import pytest\n\n\n@pytest.mark.parametrize(\"not_found\", [False, True], ids=[\"200\", \"404\"])\nasync def test_get(mocker, not_found, spawn_client):\n... | python | new_file | 1 | 6 | mit | 1d2463d7aa476608b95dc1ca37ced23e7dcb13d4 | igboyes/virtool,virtool/virtool,igboyes/virtool,virtool/virtool | tests/handlers/test_analyses.py | accepted | null | true |
[
{
"role": "user",
"content": "Here is the current file:\n```python\nimport re\nfrom pyqode.core.qt import QtGui\n\n\nclass MatchHighlighter(QtGui.QSyntaxHighlighter):\n def __init__(self, document):\n super().__init__(document)\n self.prog = None\n self._format = QtGui.QTextCharForma... | python | edit | 3 | 7 | mit | 0b9771c782394af2850161fab1e4947fc3c40cca | ColinDuquesnoy/QRegexEditor | qregexeditor/api/match_highlighter.py | accepted | null | true |
[
{
"role": "user",
"content": "Write python code for the following: [Android] Add a command line tool for reverse port forwarding\n\nThis patch adds a command line interface to\nbuild/android/pylib/forwarder.py. It allows an Android device to access\nservices running on the host machine or elsewhere. This is... | python | new_file | 1 | 7 | bsd-3-clause | 47bd7608cd67ab9657726ef024ac04a3c793aa82 | zcbenz/cefode-chromium,Jonekee/chromium.src,bright-sparks/chromium-spacewalk,M4sse/chromium.src,anirudhSK/chromium,chuan9/chromium-crosswalk,patrickm/chromium.src,jaruba/chromium.src,axinging/chromium-crosswalk,ltilve/chromium,ondra-novak/chromium.src,hujiajie/pa-chromium,ondra-novak/chromium.src,hujiajie/pa-chromium,c... | build/android/adb_reverse_forwarder.py | accepted | null | true |
[
{
"role": "user",
"content": "Write python code for the following: Check latest version of Python modules in Pypi"
},
{
"role": "assistant",
"content": "#!/usr/bin/env python\n\n# Adapted from http://code.activestate.com/recipes/577708-check-for-package-updates-on-pypi-works-best-in-pi/\n# Chang... | python | new_file | 1 | 0 | apache-2.0 | 1945a200cb8d517ce16eb039ecb4c3afc67acb9b | verdimrc/linuxcfg,verdimrc/linuxcfg,verdimrc/linuxcfg | bin/checkpypi.py | accepted | null | true |
[
{
"role": "user",
"content": "Write python code for the following: Add script for setting up DO nodes"
},
{
"role": "assistant",
"content": "#!/usr/bin/env python\nimport subprocess\nimport re\nimport os.path\n\n\nsubprocess.check_call(['fallocate', '-l', '2G', '/swapfile'])\nsubprocess.check_ca... | python | new_file | 1 | 0 | mit | 02512cb193372e02ac4e628631901f1ff7d0eab5 | muzhack/muzhack,muzhack/musitechhub,muzhack/musitechhub,muzhack/muzhack,muzhack/muzhack,muzhack/muzhack,muzhack/musitechhub,muzhack/musitechhub | scripts/setup-do-node.py | accepted | null | true |
[
{
"role": "user",
"content": "Write python code for the following: Add tests for main app"
},
{
"role": "assistant",
"content": "\"\"\"\nTest main pm functionality\n\"\"\"\n\nfrom cement.utils import test\nfrom pmtools import PmController, PmApp\nfrom test_default import config_defaults, PmTestA... | python | new_file | 7 | 1 | mit | 5d98c4109322d3346609fdb1bf44cfd4a16dc94c | SciLifeLab/scilifelab,kate-v-stepanova/scilifelab,senthil10/scilifelab,senthil10/scilifelab,SciLifeLab/scilifelab,jun-wan/scilifelab,SciLifeLab/scilifelab,jun-wan/scilifelab,senthil10/scilifelab,jun-wan/scilifelab,kate-v-stepanova/scilifelab,SciLifeLab/scilifelab,kate-v-stepanova/scilifelab,kate-v-stepanova/scilifelab,... | project_management/tests/test_main.py | rejected_lint | Too many lint violations: 7 | true |
[
{
"role": "user",
"content": "Here is the current file:\n```python\n#!/usr/bin/env python\n# -*- coding: utf-8 -*-\n\n\"\"\"\ntest_pytoon\n----------------------------------\n\nTests for `pytoon` module.\n\"\"\"\n\nimport unittest\nfrom mock import patch, Mock\nfrom pytoon.connection import BrickConnection\... | python | edit | 6 | 1 | bsd-3-clause | 06906b820f312bbc0a59eea7518470856df478ac | marcofinalist/pytoon,marcoplaisier/pytoon,marcoplaisier/pytoon,marcofinalist/pytoon | pytoon/tests/test_brick_connection.py | rejected_lint | Too many lint violations: 6 | true |
[
{
"role": "user",
"content": "Write python code for the following: Add py solution for 717. 1-bit and 2-bit Characters\n\n717. 1-bit and 2-bit Characters: https://leetcode.com/problems/1-bit-and-2-bit-characters/"
},
{
"role": "assistant",
"content": "class Solution(object):\n def isOneBitCha... | python | new_file | 1 | 4 | apache-2.0 | 68b5e3438b771afe4a70019a12fdd6d60a587c7e | ckclark/leetcode,ckclark/leetcode,ckclark/leetcode,ckclark/leetcode,ckclark/leetcode,ckclark/leetcode | py/1-bit-and-2-bit-characters.py | accepted | null | true |
[
{
"role": "user",
"content": "Write python code for the following: ADD Network roles unit tests"
},
{
"role": "assistant",
"content": "def test_create_role(client):\n result = client.post(\"/roles/\", data={\"role\": \"admin\"})\n assert result.status_code == 200\n assert result.get_jso... | python | new_file | 1 | 1 | apache-2.0 | 8a9f558387fbed5442f141a70aaffee265684755 | OpenMined/PySyft,OpenMined/PySyft,OpenMined/PySyft,OpenMined/PySyft | apps/network/tests/test_routes/test_roles.py | accepted | null | true |
[
{
"role": "user",
"content": "Write python code for the following: ENH: Add tool for downloading release wheels from Anaconda.\n\nThis is a simplified version of terryfy::wheel-uploader that has\ntwo advantages over the original:\n\n- It works with Anaconda where our wheels are now stored.\n- It is simplifi... | python | new_file | 3 | 2 | bsd-3-clause | a205a7032aa72111e1cb44f4989363b4e64be28a | mattip/numpy,pdebuyl/numpy,endolith/numpy,abalkin/numpy,mhvk/numpy,mhvk/numpy,charris/numpy,seberg/numpy,pbrod/numpy,mattip/numpy,numpy/numpy,pbrod/numpy,jakirkham/numpy,pdebuyl/numpy,seberg/numpy,pbrod/numpy,jakirkham/numpy,pdebuyl/numpy,simongibbons/numpy,charris/numpy,endolith/numpy,grlee77/numpy,grlee77/numpy,mhvk/... | tools/download-wheels.py | accepted | null | true |
[
{
"role": "user",
"content": "Write python code for the following: Handle Y' rosetta code series\n\nA very beautiful one, that once again raised a lot of errors..."
},
{
"role": "assistant",
"content": "# from http://rosettacode.org/wiki/Yin_and_yang#Python\nimport math\ndef yinyang(n=3):\n\trad... | python | new_file | 1 | 17 | bsd-3-clause | 93feee9e6d4221e6c876413055ee8be659ddeb36 | pombredanne/pythran,pbrunet/pythran,hainm/pythran,artas360/pythran,pbrunet/pythran,serge-sans-paille/pythran,serge-sans-paille/pythran,pombredanne/pythran,pbrunet/pythran,hainm/pythran,pombredanne/pythran,hainm/pythran,artas360/pythran,artas360/pythran | pythran/tests/rosetta/yin_and_yang.py | rejected_complexity | Cyclomatic complexity too high: 17 | true |
[
{
"role": "user",
"content": "Write python code for the following: Add first basic unittests using py.test"
},
{
"role": "assistant",
"content": "\"\"\"\n test_validators\n ~~~~~~~~~~~~~~\n \n Unittests for bundled validators.\n \n :copyright: 2007-2008 by James Crasta, Thomas ... | python | new_file | 1 | 1 | bsd-3-clause | 1fafccc7df5179ce89b100537e45307417658512 | clones/wtforms | tests/test_validators.py | rejected_duplicate | Near-duplicate of sample 5919 | true |
[
{
"role": "user",
"content": "Write python code for the following: Add a calc function for asymmetric hessian errors"
},
{
"role": "assistant",
"content": "\"\"\"Functions for calculating errors by combining different datasets.\"\"\"\n\nimport math\n\ndef asymmetric_hessian_error(value_lists):\n... | python | new_file | 1 | 3 | mit | 0738a6a4739db2a34659e469b4d262a971bc4938 | ebothmann/heppyplotlib | heppyplotlib/errorcalc.py | accepted | null | true |
[
{
"role": "user",
"content": "Write python code for the following: Add testcase for casefold plugin"
},
{
"role": "assistant",
"content": "# -*- coding: utf-8 -*-\nfrom irc3.testing import BotTestCase\n\n\nclass TestCasefold(BotTestCase):\n\n config = dict(includes=['irc3.plugins.casefold'])\... | python | new_file | 1 | 1 | mit | f03734d273914ab5ce31cf0e28f86732ddb35b0c | mrhanky17/irc3,mrhanky17/irc3,gawel/irc3 | tests/test_casefold.py | accepted | null | true |
[
{
"role": "user",
"content": "Write python code for the following: Print out image URLs from Mars"
},
{
"role": "assistant",
"content": "import requests\n\nrover_url = 'https://api.nasa.gov/mars-photos/api/v1/rovers/curiosity/photos'\nparameters = {'api_key': 'DEMO_KEY', 'sol': '1324'}\n\nrespon... | python | new_file | 1 | 0 | mit | 39bb9d8408cde59525a576119d28399c49e092f9 | sagnew/PhoningHome | mars.py | accepted | null | true |
[
{
"role": "user",
"content": "Write python code for the following: MovingEddies: Add simple test setup that follows two particles"
},
{
"role": "assistant",
"content": "from parcels import Particle, ParticleSet, JITParticle, JITParticleSet\nfrom parcels import NEMOGrid, ParticleFile, AdvectionRK... | python | new_file | 1 | 6 | mit | 443456f94a92f1844b99965ffcf3679bd939d42c | OceanPARCELS/parcels,OceanPARCELS/parcels | tests/test_moving_eddies.py | accepted | null | true |
[
{
"role": "user",
"content": "Write python code for the following: Add tests for task statuses"
},
{
"role": "assistant",
"content": "from taiga.requestmaker import RequestMaker, RequestMakerException\nfrom taiga.models.base import InstanceResource, ListResource\nfrom taiga.models import TaskSta... | python | new_file | 12 | 1 | mit | 5735595d4a465b2cc9f52bdd1fc524c0d26d60cb | bameda/python-taiga,mlq/python-taiga,jespino/python-taiga,bameda/python-taiga,mlq/python-taiga,erikw/python-taiga,jespino/python-taiga,erikw/python-taiga,nephila/python-taiga | tests/test_task_statuses.py | rejected_lint | Too many lint violations: 12 | true |
[
{
"role": "user",
"content": "Write python code for the following: Add class to support dependency graph visualisation"
},
{
"role": "assistant",
"content": "import logging\nimport re\nfrom graphviz import Digraph\nfrom IPython.display import SVG\n\n__all__ = ['DependencyGraph']\n\nlogger = logg... | python | new_file | 3 | 2 | mit | 96ed9d514541b18419b97d5187237f6fdba7b3c7 | maxalbert/tohu | tohu/v3/dependency_graph.py | accepted | null | true |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.