conversations
listlengths
2
3
source
stringclasses
1 value
stack
stringclasses
1 value
[ { "from": "system", "value": "Add test checking that unimplemented attribute raises error\n" }, { "from": "human", "value": "import sys\nsys.path.insert(0,\".\")\nimport unittest\nimport neuroml\nimport neuroml.writers as writers\nimport PyOpenWorm\nfrom PyOpenWorm import *\nimport networkx\nimp...
python
chosen
[ { "from": "system", "value": "Adjust init verbose and enabled mode handling\n\nReduce complexity and leave the enabled mode to be used\r\nwith the toggleable decorator that disables functionality\r\nwhen AXES_ENABLED is set to False for testing etc.\r\n\r\nThis conforms with the previous behaviour and logic...
python
chosen
[ { "from": "system", "value": "Add logic, visir and submarine to wcloud\n" }, { "from": "human", "value": "from weblab.admin.script import Creation\n\nAPACHE_CONF_NAME = 'apache.conf'\nMIN_PORT = 10000\n\nDEFAULT_DEPLOYMENT_SETTINGS = {\n Creation.COORD_ENGINE: 'redis',\n Creation.COORD_RED...
python
chosen
[ { "from": "system", "value": "Fix Python 3 packaging issue" }, { "from": "human", "value": "__author__ = 'Yifan Peng'\n\n__version__ = '1.0.0-SNAPSHOT'\n\nfrom bioc import BioCCollection, BioCDocument, BioCPassage, BioCSentence, BioCAnnotation, \\\n BioCRelation, BioCLocation, BioCNode, parse...
python
chosen
[ { "from": "system", "value": "Make convert command work with files or stdin/out\n" }, { "from": "human", "value": "\"\"\"\nAuthor: Ryan Brown <sb@ryansb.com>\nLicense: AGPL3\n\"\"\"\n\nimport click\n\n\n@click.group()\ndef cli():\n pass\n\n@cli.command()\ndef version():\n click.echo(\"You ...
python
chosen
[ { "from": "system", "value": "Add function to extract solution from valuation\n" }, { "from": "human", "value": "from boolean import *\n\ndef graphColouring2SAT(G, k):\n conj = []\n for i in range(len(G)):\n conj.append(Or(*((i, j) for j in range(k))))\n for j in range(k):\n ...
python
chosen
[ { "from": "system", "value": "Refactor imports to be less verbose\n" }, { "from": "human", "value": "import pytest\nimport mock\n\nfrom slackelot.slackelot import SlackNotificationError, send_message\n\n\ndef test_send_message_success():\n \"\"\"Returns True if response.status_code == 200\"\"...
python
chosen
[ { "from": "system", "value": "Use a separate set of urlpatterns for each file in views.\n" }, { "from": "human", "value": "from django.conf.urls import patterns, include, url\nfrom myuw_mobile.views.page import index, myuw_login\nfrom myuw_mobile.views.api import StudClasScheCurQuar, TextbookCur...
python
chosen
[ { "from": "system", "value": "Add the rest of Panda3D test program.\n" }, { "from": "human", "value": "from direct.showbase.ShowBase import ShowBase\n \nclass MyApp(ShowBase):\n \n def __init__(self):\n ShowBase.__init__(self)\n \napp = MyApp()\napp.run()\n" }, { "from": "gpt",...
python
chosen
[ { "from": "system", "value": "Add exceptions scraperwiki.CPUTimeExceededError and scraperwiki.Error.\nThis bring the library closer to the classic API, which provided\nboth these exceptions.\n" }, { "from": "human", "value": "#!/usr/bin/env python2\n# Thomas Levine, ScraperWiki Limited\n\n'''\nL...
python
chosen
[ { "from": "system", "value": "Build releases even without MIXPANEL_TOKEN\n" }, { "from": "human", "value": "import os\n\nwith open(\"src/conf.lua.bak\") as f:\n conf = f.read()\n\n conf = conf.replace(\"t.release = false\",\n \"t.release = true\")...
python
chosen
[ { "from": "system", "value": "Use subprocess.call rather than run\n" }, { "from": "human", "value": "import os\nimport json\nimport shutil\nimport subprocess\nimport string\nimport random\n\nfrom chunsabot.database import Database\nfrom chunsabot.botlogic import brain\n\nRNN_PATH = Database.load...
python
chosen
[ { "from": "system", "value": "Add name to api-token-auth url endpoint.\n" }, { "from": "human", "value": "from django.conf.urls import patterns, include, url\nfrom services.api import all_views as services_views\nfrom services.api import AccessibilityRuleView\nfrom observations.api import views ...
python
chosen
[ { "from": "system", "value": "Update FinSpace per 2021-11-18 changes\n" }, { "from": "human", "value": "# Copyright (c) 2012-2021, Mark Peek <mark@peek.org>\n# All rights reserved.\n#\n# See LICENSE file for full license.\n#\n# *** Do not modify - this file is autogenerated ***\n# Resource speci...
python
chosen
[ { "from": "system", "value": "Revert \"Import spareice per default.\"\n\nThis reverts commit d54042d41b981b3479adb140f2534f76c967fa1c.\n" }, { "from": "human", "value": "# -*- coding: utf-8 -*-\n\nfrom .version import __version__\n\ntry:\n __TYPHON_SETUP__\nexcept:\n __TYPHON_SETUP__ = Fal...
python
chosen
[ { "from": "system", "value": "Fix the comparison to work more robustly.\n" }, { "from": "human", "value": "from django.apps import AppConfig\nfrom django.db.models.signals import post_delete, post_save\nfrom wagtail.wagtailsearch.backends import get_search_backends\nfrom wagtail.wagtailsearch.in...
python
chosen
[ { "from": "system", "value": "Fix a harmless (but silly) cut-and-paste artifact\n" }, { "from": "human", "value": "from django.test import TestCase\nfrom mock import Mock\nfrom .middleware import RewriteNemoURLsMiddleware\n\nclass CartMiddlewareTest(TestCase):\n\n def setUp(self):\n se...
python
chosen
[ { "from": "system", "value": "Update example to demonstrate desired use case\n" }, { "from": "human", "value": "\"\"\"Provides an example of attaching an action on hug server startup\"\"\"\nimport hug\n\ndata = []\n\n\n@hug.startup()\ndef add_data(api):\n \"\"\"Adds initial data to the api on...
python
chosen
[ { "from": "system", "value": "Rename black_screen to ready_screen and make executable\n" }, { "from": "human", "value": "#!/usr/bin/env python\n\nimport pygame\n\nscreen_size = 640, 480\n\ndef start():\n pygame.init()\n screen = pygame.display.set_mode( screen_size )\n\ndef black_screen():...
python
chosen
[ { "from": "system", "value": "Comment added to create generic decode method\n\n\nFormer-commit-id: 256c0f9cfd1ca0c5982ac9ab001c5ced84a02c32" }, { "from": "human", "value": "#!/usr/bin/python\n\nimport sys\nfrom lib.bot import *\nfrom lib.utils import *\nfrom lib.event import *\nfrom lib.cache im...
python
chosen
[ { "from": "system", "value": "Add url to check for incoming sms's.\n" }, { "from": "human", "value": "# BULKSMS Configuration.\n\n# BULKSMS base url.\nBULKSMS_BASE_API_URL = 'https://bulksms.2way.co.za'\n\n# Credentials required to use bulksms.com API.\nBULKSMS_AUTH_USERNAME = ''\nBULKSMS_AUTH_P...
python
chosen
[ { "from": "system", "value": "Fix city scraper, doesn't throw type error\n\nCity scraper now prints out html for every city and territory in\nthe us without throwing any error.\n" }, { "from": "human", "value": "# Craigslist City Scraper\n# By Marshall Ehlinger\n# For sp2015 Systems Analysis and...
python
chosen
[ { "from": "system", "value": "Convert INSTALLED_APPS to list before concat\n" }, { "from": "human", "value": "#-*- coding: utf-8 -*-\n\nimport os\nimport sys\nimport unittest\n\ndef setup_django_settings():\n os.chdir(os.path.join(os.path.dirname(__file__), \"..\"))\n sys.path.insert(0, os...
python
chosen
[ { "from": "system", "value": "Remove reference to non-existant file.\n" }, { "from": "human", "value": "import sys\n\ntry:\n from django.conf import settings\n from django.test.utils import get_runner\n\n settings.configure(\n DEBUG=True,\n USE_TZ=True,\n DATABASES=...
python
chosen
[ { "from": "system", "value": "Fix test_tk under OS X with Tk 8.4. Patch by Ned Deily.\nThis should fix some buildbot failures.\n" }, { "from": "human", "value": "import unittest\nimport tkinter\nfrom tkinter import font\nfrom test.support import requires, run_unittest\nimport tkinter.test.suppor...
python
chosen
[ { "from": "system", "value": "Allow multiple SSH keys per file\n" }, { "from": "human", "value": "#!/usr/bin/env python\n# -*- coding: utf-8 -*-\n\nimport os.path\nimport sys\n\nfrom . import util\n\n\nclass SSHKey(object):\n @staticmethod\n def rebuild_authorized_keys():\n lines = ...
python
chosen
[ { "from": "system", "value": "Send flag when success push notifications\n" }, { "from": "human", "value": "# coding=utf-8\n\nimport time, os, json\nfrom apns import APNs, Frame, Payload\nfrom push.models import DevelopFileModel, ProductFileModel\nfrom django.conf import settings\n\nPEM_FILE_DIR ...
python
chosen
[ { "from": "system", "value": "Make sure organization is fetched only once\n" }, { "from": "human", "value": "\"\"\"\nThis module implements different strategies to resolve the current Organization we are using.\n\nBy default we use the simple single_org strategy, which assumes you have a\nsingle...
python
chosen
[ { "from": "system", "value": "Use feed as the foreign key of image\n" }, { "from": "human", "value": "# This is an auto-generated Django model module.\n# You'll have to do the following manually to clean this up:\n# * Rearrange models' order\n# * Make sure each model has one field with prima...
python
chosen
[ { "from": "system", "value": "Fix migration for squashed init\n" }, { "from": "human", "value": "\"\"\"git_branch\n\nRevision ID: 1c398722878\nRevises: f8d315a31e\nCreate Date: 2015-10-18 00:38:22.737519\n\n\"\"\"\n\n# revision identifiers, used by Alembic.\nrevision = '1c398722878'\ndown_revisi...
python
chosen
[ { "from": "system", "value": "Revert \"Added to allow local imports.\"\n\nThis reverts commit b1f8344f1525b97a73619fbd84ec26c72829eb7d.\n" }, { "from": "human", "value": "__author__ = \"Jarrod N. Bakker\"\n__status__ = \"development\"\n" }, { "from": "gpt", "value": "# Copyright 2015...
python
chosen
[ { "from": "system", "value": "Add verfication loop to prompt_for_answer\n\n" }, { "from": "human", "value": "def prompt_for_answer(question=\"\"):\n \"\"\" Prompts the user for an answer\n Args:\n question (String): The question to be displayed to the user\n \n Returns:\n ...
python
chosen
[ { "from": "system", "value": "Improve Admin for Authorization objects\n" }, { "from": "human", "value": "from django.contrib import admin\nfrom .models import Authorization\n\n\n@admin.register(Authorization)\nclass ApplicationAdmin(admin.ModelAdmin):\n pass\n" }, { "from": "gpt", ...
python
chosen
[ { "from": "system", "value": "Remove unused functions from the Mode base object\n" }, { "from": "human", "value": "# The purpose of this file is to provide base classes with the needed functions\n# already defined; this allows us to guarantee that any exceptions raised\n# during function calls a...
python
chosen
[ { "from": "system", "value": "Set user password for all sanitized users to '123'.\n" }, { "from": "human", "value": "#!/usr/bin/python\n\n# Setup import paths, since we are using Django models\nimport sys, os\nsys.path.append('/var/www/django')\nos.environ['DJANGO_SETTINGS_MODULE'] = 'wlanlj.set...
python
chosen
[ { "from": "system", "value": "Add update_tcbs.sql to the mix\n" }, { "from": "human", "value": "\"\"\"bug 958558 migration for update_product_version() and friends\n\nRevision ID: 2c48009040da\nRevises: 48e9a4366530\nCreate Date: 2014-01-13 12:54:13.988864\n\n\"\"\"\n\n# revision identifiers, us...
python
chosen
[ { "from": "system", "value": "Add missing lower() in create_container()\n" }, { "from": "human", "value": "import logging\nimport os\n\nfrom plumbum.commands.base import BaseCommand\n\nfrom benchbuild.settings import CFG\nfrom benchbuild.utils.cmd import podman\n\nLOG = logging.getLogger(__name_...
python
chosen
[ { "from": "system", "value": "Add optional parentheses for translation\n" }, { "from": "human", "value": "\"\"\"\nVerseBot for reddit\nBy Matthieu Grieger\nregex.py\nCopyright (c) 2015 Matthieu Grieger (MIT License)\n\"\"\"\n\nimport re\n\ndef find_verses(message_body):\n \"\"\" Uses regex to...
python
chosen
[ { "from": "system", "value": "Add a placeholder to device token\n" }, { "from": "human", "value": "# Put your device token here. To get a device token, register at http://stage.cloud4rpi.io\r\nDeviceToken = \"\"\r\n" }, { "from": "gpt", "value": "# Put your device token here. To get ...
python
chosen
[ { "from": "system", "value": "Fix compatibility with newer apispec\n" }, { "from": "human", "value": "from collections import defaultdict\n\nfrom flask import current_app\n\nfrom .operation import Operation\nfrom .utils import flask_path_to_swagger, get_state\n\nrules = {}\n\n\ndef schema_path_h...
python
chosen
[ { "from": "system", "value": "Fix compatibility with latest horizon\n\nClass \"NetworkClient\" from \"openstack_dashboards.api.network\" module\nwas removed from horizon repo. So, remove its usage and use neutron\ndirectly.\n\nChange-Id: Idcf51553f64fae2254c224d4c6ef4fbb94e6f279\nCloses-Bug: #1691466\n" }...
python
chosen
[ { "from": "system", "value": "Test extra args are used\n" }, { "from": "human", "value": "import os\n\nfrom arteria.web.app import AppService\nfrom unittest import TestCase\n\n\nclass AppServiceTest(TestCase):\n\n this_file_path = os.path.dirname(os.path.realpath(__file__))\n\n def test_ca...
python
chosen
[ { "from": "system", "value": "Fix not opening paths with spaces.\n" }, { "from": "human", "value": "#!/usr/bin/env python3\n\nimport os\nimport sys\nimport neovim\n\nfiles = {os.path.abspath(arg) for arg in sys.argv[1:]}\nif not files:\n sys.exit(1)\n\naddr = os.environ.get('NVIM_LISTEN_ADDRE...
python
chosen
[ { "from": "system", "value": "Update code for PEP8 compliance\n" }, { "from": "human", "value": "import os\nimport time\n\ntry:\n import unittest2 as unittest\nexcept ImportError:\n import unittest\n\nclass DateRangeTest(unittest.TestCase):\n def setUp(self):\n self.openlicensefi...
python
chosen
[ { "from": "system", "value": "Make buck wrapper logs human-readable.\n\nSummary: Simplify logging setup and make its format human-readable\n\nTest Plan:\n$ BUCK_WRAPPER_LOG_LEVEL=DEBUG buck run buck -- --version\n buck version 64999e5d3b446c062da5c3cc282a2e78ce133c92\n 2017-12-05 14:08:08,073 [DEBUG][buck...
python
chosen
[ { "from": "system", "value": "Add support for monitor deletion\n" }, { "from": "human", "value": "#\n# Copyright (c) 2014 NSONE, Inc.\n#\n# License under The MIT License (MIT). See LICENSE in project root.\n#\nfrom . import resource\n\n\nclass Monitors(resource.BaseResource):\n\n ROOT = 'moni...
python
chosen
[ { "from": "system", "value": "Handle errors in sync job\n" }, { "from": "human", "value": "import datetime\nfrom cucoslib.models import Analysis, Package, Version, Ecosystem\nfrom cucoslib.workers import GraphImporterTask\n\nfrom .base import BaseHandler\n\n\nclass SyncToGraph(BaseHandler):\n ...
python
chosen
[ { "from": "system", "value": "Remove default config settings from the BS\n" }, { "from": "human", "value": "sdk_path = \"/home/vagrant/android-sdk\"\nndk_paths = {\n 'r9b': \"/home/vagrant/android-ndk/r9b\",\n 'r10e': \"/home/vagrant/android-ndk/r10e\",\n}\nbuild_tools = \"22.0.1\"\nant = ...
python
chosen
[ { "from": "system", "value": "TST: Update to new databroker API.\n" }, { "from": "human", "value": "from collections import defaultdict\nfrom bluesky.examples import stepscan, det, motor\nfrom bluesky.callbacks.broker import post_run, verify_files_saved\nfrom functools import partial\n\n\ndef te...
python
chosen
[ { "from": "system", "value": "Remove authenticate call to fix issues with pymongo 3.7\n" }, { "from": "human", "value": "from .exceptions import ConnectionError\nfrom pymongo import MongoClient\nfrom pymongo.uri_parser import parse_uri\n\n_connections = {}\n\ntry:\n import gevent\nexcept Impo...
python
chosen
[ { "from": "system", "value": "Fix time-based lookups in REST API\n\nDon't encode the datetime argument to bytes; the underlying function\nexpects a string argument.\n" }, { "from": "human", "value": "\"\"\"\nWhip's REST API\n\"\"\"\n\n# pylint: disable=missing-docstring\n\nimport socket\n\nfrom ...
python
chosen
[ { "from": "system", "value": "Remove an example proxy server definition\n" }, { "from": "human", "value": "\"\"\"\nProxy Server \"Phone Book\".\n\nSimplify running browser tests through a proxy server\nby adding your frequently-used proxies here.\n\nNow you can do something like this on the comm...
python
chosen
[ { "from": "system", "value": "Add pagination to product list view\n" }, { "from": "human", "value": "from django.views import generic\n\nfrom ..mixins import BazaarPrefixMixin\nfrom .models import Product\n\n\nclass ProductListView(BazaarPrefixMixin, generic.ListView):\n model = Product\n\n\n...
python
chosen
[ { "from": "system", "value": "Make our account pages require a logged in user.\n\ncloses #221\n" }, { "from": "human", "value": "\"\"\"\nViews that allow us to edit user profile data\n\"\"\"\nfrom django.core.urlresolvers import reverse_lazy\nfrom django.views.generic.edit import UpdateView\n\nf...
python
chosen
[ { "from": "system", "value": "Fix pygame mixer init hogging cpu\n" }, { "from": "human", "value": "#!/usr/bin/env python3\n\nimport pygame\nfrom constants import *\nfrom music_maker import *\nfrom tkinter import Tk\n\ndef main():\n\n # initialize game engine\n pygame.init()\n \n # se...
python
chosen
[ { "from": "system", "value": "Use last version of PostgreSQL on CI\n" }, { "from": "human", "value": "import dj_database_url\n\nDEBUG = True\nTEMPLATE_DEBUG = True\n\nSECRET_KEY = 'this is my secret key' # NOQA\n\nTEST_RUNNER = 'django.test.runner.DiscoverRunner'\n\nDATABASES = {\n 'default'...
python
chosen
[ { "from": "system", "value": "Order judge list by load\n" }, { "from": "human", "value": "from django.shortcuts import render_to_response\nfrom django.template import RequestContext\n\nfrom judge.models import Judge\n\n__all__ = ['status', 'status_table']\n\n\ndef status(request):\n return re...
python
chosen
[ { "from": "system", "value": "Change script to accept non-number versions of sent and para attributes\n\nThe script relied on numeric sent and para attributes. The code was\nchanged to also accept non-numeric sent and para attributes. In some\ncases, the sent and para attributes returned by tools are not nu...
python
chosen
[ { "from": "system", "value": "Fix date to epoch converter to timestamp at exactly midnight\n" }, { "from": "human", "value": "# For now I am assuming the investment date will be returned from the db \n# as a string yyyy-mm-dd, representing the day the trend was purchased in UTC time\n\n#!/usr/bi...
python
chosen
[ { "from": "system", "value": "Fix STATIC_URL (for Django 1.5 admin tests)\n" }, { "from": "human", "value": "#!/usr/bin/env python\nimport sys\nfrom os.path import abspath, dirname\n\nfrom django.conf import settings\n\n\nsys.path.insert(0, abspath(dirname(__file__)))\n\n\nif not settings.config...
python
chosen
[ { "from": "system", "value": "Add a value trait to Value widgets." }, { "from": "human", "value": "# Copyright (c) Jupyter Development Team.\n# Distributed under the terms of the Modified BSD License.\n\n\"\"\"Contains the ValueWidget class\"\"\"\n\nfrom .widget import Widget\n\n\nclass ValueWid...
python
chosen
[ { "from": "system", "value": "Fix tests on Python2.7 xmlrpclib.Transport.parse_response calls 'getheader' on its response input\n" }, { "from": "human", "value": "\"\"\"Utils for Zinnia's tests\"\"\"\nimport cStringIO\nfrom xmlrpclib import Transport\n\nfrom django.test.client import Client\n\n\...
python
chosen
[ { "from": "system", "value": "Docs: Set stable version to 2.x\n" }, { "from": "human", "value": "# -*- coding: utf-8 -*-\nfrom __future__ import absolute_import, unicode_literals\n\nfrom sphinx_celery import conf\n\nglobals().update(conf.build_config(\n 'amqp', __file__,\n project='py-amqp...
python
chosen
[ { "from": "system", "value": "Update version 1.0.0.dev4 -> 1.0.0.dev5" }, { "from": "human", "value": "__version__ = '1.0.0.dev4'\n__author__ = 'D-Wave Systems Inc.'\n__authoremail__ = 'acondello@dwavesys.com'\n__description__ = 'A shared API for binary quadratic model samplers.'\n" }, { ...
python
chosen
[ { "from": "system", "value": "Remove accidental commit of credentials\n" }, { "from": "human", "value": "import base64, json, urllib2\n\napi_client_id = \"To3-IKknn36qAAAA\"\napi_client_secret = \"46d028xWl8zXGa3GCOYJMeXlr5pUebCNZcz3SCJj\"\nbasic_auth = base64.b64encode(\"%s:%s\" % (api_client_i...
python
chosen
[ { "from": "system", "value": "Move Zig source normalization to `create_files`\n\nThis actually works, even if I don't know why." }, { "from": "human", "value": "from dmoj.executors.compiled_executor import CompiledExecutor\n\n\nclass Executor(CompiledExecutor):\n ext = 'zig'\n name = 'ZIG'...
python
chosen
[ { "from": "system", "value": "Add URL for checking for deleted packages\n" }, { "from": "human", "value": "\n# IATI Data Quality, tools for Data QA on IATI-formatted publications\n# by Mark Brough, Martin Keegan, Ben Webb and Jennifer Smith\n#\n# Copyright (C) 2013 Publish What You Fund\n#\...
python
chosen
[ { "from": "system", "value": "Fix change in args between versions of python-daemon\n\nNewer version call __exit__ with exception data, old\nversions merely call __exit__().\n" }, { "from": "human", "value": "import os\n\n\nclass PIDFile():\n def __init__(self, path):\n if not path:\n ...
python
chosen
[ { "from": "system", "value": "Add __str__ to Preprocessor class\n" }, { "from": "human", "value": "import json\n\n\nclass Preprocessor:\n def __init__(self):\n self.reset()\n\n def reset(self):\n self.number_elements = 0\n self.length_elements = []\n self.E_elem...
python
chosen
[ { "from": "system", "value": "Remove migrations.RunPython.noop from reverse for Django<1.8\n" }, { "from": "human", "value": "# -*- coding: utf-8 -*-\nfrom __future__ import unicode_literals\n\nfrom django.db import models, migrations\nimport uuid, os\n\ndef gen_uuid(apps, schema_editor):\n W...
python
chosen
[ { "from": "system", "value": "Make JumboFieldsWorkflow fail if no env var\n\nIf SIMPLEFLOW_JUMBO_FIELDS_BUCKET is not set, the example doesn't work;\nmake this clear.\n\nSigned-off-by: Yves Bastide <3b1fe340dba76bf37270abad774f327f50b5e1d8@botify.com>\n" }, { "from": "human", "value": "from __fu...
python
chosen
[ { "from": "system", "value": "Make the expected HTTP status code configurable\n" }, { "from": "human", "value": "import sys, requests, argparse\nfrom retrying import retry\n\nargparser = argparse.ArgumentParser(formatter_class=argparse.ArgumentDefaultsHelpFormatter)\nargparser.add_argument('url'...
python
chosen
[ { "from": "system", "value": "Revert r67, which was not the changeset intended for commit.\n" }, { "from": "human", "value": "#!/usr/bin/env python\n\nimport sys\nsys.path.append(\"../zvm\")\n\nfrom zmemory import ZMemory\nfrom zlexer import ZLexer\n\nstory = file(\"../stories/zork.z1\").read()\...
python
chosen
[ { "from": "system", "value": "Make ready screen explicitly black, and shape screen white\n" }, { "from": "human", "value": "#!/usr/bin/env python\n\nimport pygame\nimport random\n\nscreen_width = 640\nscreen_height = 480\n\nscreen = None\nready_text = None\n\ndef start():\n global screen, rea...
python
chosen
[ { "from": "system", "value": "Remove unused `show_status` feature of `GitSavvyError`\n" }, { "from": "human", "value": "import sublime\nfrom ..common import util\n\n\nMYPY = False\nif MYPY:\n from typing import Sequence\n\n\nclass GitSavvyError(Exception):\n def __init__(self, msg, *args, ...
python
chosen
[ { "from": "system", "value": "Use tidy client for cinderblockapi tests too.\n" }, { "from": "human", "value": "# Copyright Hybrid Logic Ltd. See LICENSE file for details.\n\n\"\"\"\nFunctional tests for ``flocker.node.agents.cinder`` using a real OpenStack\ncluster.\n\"\"\"\n\n# A helper to che...
python
chosen
[ { "from": "system", "value": "Fix the migration to actual work.\n" }, { "from": "human", "value": "# Created by Noah Kantrowitz on 2007-07-04.\n# Copyright (c) 2007 Noah Kantrowitz. All rights reserved.\n\nfrom trac.db import Table, Column\n\nname = 'mastertickets'\nversion = 2\ntables = [\n ...
python
chosen
[ { "from": "system", "value": "Add a comment explaining how to run this unit test.\n" }, { "from": "human", "value": "import groupelo\n\ndef test_win_expectancy():\n assert groupelo.win_expectancy(1500, 1500) == 0.5\n assert groupelo.win_expectancy(1501, 1499) > 0.5\n assert groupelo.win...
python
chosen
[ { "from": "system", "value": "Remove the feed cache and storage from the globals. This lives in moksha.\n" }, { "from": "human", "value": "\"\"\"The application's Globals object\"\"\"\n\nfrom tg import config\nfrom shove import Shove\nfrom feedcache.cache import Cache\nfrom app_factory import A...
python
chosen
[ { "from": "system", "value": "Delete Report models before reloading them\n" }, { "from": "human", "value": "# -*- encoding: UTF-8 -*-\n\n#\n# Copyright 2015\n#\n# STIC-Investigación - Universidad de La Laguna (ULL) <gesinv@ull.edu.es>\n#\n# This file is part of CVN.\n#\n# CVN is fr...
python
chosen
[ { "from": "system", "value": "Fix typo in cases autocomplete\n" }, { "from": "human", "value": "import autocomplete_light\nfrom models import Case\n\n\nclass CaseAutocomplete(autocomplete_light.AutocompleteModelBase):\n search_fields = ['name']\n\n def choices_for_request(self, *args, **kw...
python
chosen
[ { "from": "system", "value": "Test with an existing id\n" }, { "from": "human", "value": "import subprocess\nimport unittest\n\n\nclass TestDataIsInstalled(unittest.TestCase):\n TEST_CMD = \"python -c 'from vulndb import DBVuln; DBVuln.from_id(123)'\"\n\n def test_data_is_installed_in_virt...
python
chosen
[ { "from": "system", "value": "Fix LineAnimator example to adhere to new pixel edges axis_ranges API.\n" }, { "from": "human", "value": "\"\"\"\n=============\nLineAnimator\n=============\n\nThis example shows off some ways in which you can use the\nLineAnimator object to animate line plots.\n\"\...
python
chosen
[ { "from": "system", "value": "Make test module return dynamic value\n" }, { "from": "human", "value": "from wutu.module import Module\n\n\nclass TestModule(Module):\n def __init__(self):\n super(TestModule, self).__init__()\n\n def ping(self):\n return \"pong\"\n\n def get...
python
chosen
[ { "from": "system", "value": "Add test at init to create couchdb database if not already exists\n" }, { "from": "human", "value": "\"\"\"Main entry point\n\"\"\"\nimport couchdb\n\nfrom pyramid.config import Configurator\nfrom pyramid.events import NewRequest\nfrom daybed.db import DatabaseConne...
python
chosen
[ { "from": "system", "value": "Replace a method call to use the latest version method\n" }, { "from": "human", "value": "# encoding: utf-8\n\n\"\"\"\n.. codeauthor:: Tsuyoshi Hombashi <tsuyoshi.hombashi@gmail.com>\n\"\"\"\n\nfrom __future__ import absolute_import\nfrom __future__ import unicode_l...
python
chosen
[ { "from": "system", "value": "Add some basic geometric functions.\n" }, { "from": "human", "value": "import numpy as np\n" }, { "from": "gpt", "value": "import numpy as np\n\n\ndef normalize(v):\n '''Normalize a vector based on its 2 norm.'''\n if 0 == np.linalg.norm(v):\n ...
python
chosen
[ { "from": "system", "value": "Make sure all unit types can be recruited.\n" }, { "from": "human", "value": "\"\"\"Check for inconsistancies in the database.\"\"\"\n\nfrom server.db import BuildingBuilder, BuildingType, load, UnitType\n\n\ndef main():\n load()\n for name in UnitType.resourc...
python
chosen
[ { "from": "system", "value": "Remove headline from create view\n" }, { "from": "human", "value": "# from django.shortcuts import render\nfrom django.views.generic import ListView, CreateView, DetailView, TemplateView\nfrom django.core.urlresolvers import reverse\nfrom braces.views import SetHead...
python
chosen
[ { "from": "system", "value": "Set the correct in-code policy for ec2 operations\n\nIn I8bd0fa342cdfee00acd3c7a33f7232fe0a87e23f we moved some of the policy\ndefaults into code. Some of the policy were accidentally changed.\n\nChange-Id: Ib744317025d928c7397ab00dc706172592a9abaf\nCloses-Bug: #1675377\n" },...
python
chosen
[ { "from": "system", "value": "Enable NullCache so we can start implementing cache\n" }, { "from": "human", "value": "# -*- coding: utf-8 -*-\n\nfrom flask import Flask, g\nfrom flask.ext.babel import Babel\nfrom flask.ext.sqlalchemy import SQLAlchemy, event\nfrom .sessions import MySessionInterf...
python
chosen
[ { "from": "system", "value": "Update Jenkins source to only update the Jenkins repository\n" }, { "from": "human", "value": "version_cmd = 'java -jar /usr/share/jenkins/jenkins.war --version'\nversion_re = '(\\d\\.\\d{3})'\ndepends = ['wget']\ninstall_script = \"\"\"\nwget -q -O - http://pkg.jen...
python
chosen
[ { "from": "system", "value": "Use kramdown for markdown convertion.\n" }, { "from": "human", "value": "from markdown import markdown\nfrom markdown.extensions.tables import TableExtension\n\nfrom .my_codehilite import CodeHiliteExtension\nfrom .my_fenced_code import FencedCodeExtension\nfrom .my...
python
chosen
[ { "from": "system", "value": "[1.6.x] Bump version number for 1.6 beta 3 security release.\n" }, { "from": "human", "value": "VERSION = (1, 6, 0, 'beta', 2)\n\ndef get_version(*args, **kwargs):\n # Don't litter django/__init__.py with all the get_version stuff.\n # Only import if it's actu...
python
chosen
[ { "from": "system", "value": "Use a django settings module, if defined, even if it wasn't already loaded by Django (for example, when using ./celeryd directly rather than the celeryd management command.\n" }, { "from": "human", "value": "import os\nfrom celery.loaders.djangoapp import Loader as ...
python
chosen
[ { "from": "system", "value": "Mark the py.test test as not to be run in nose.\n" }, { "from": "human", "value": "\"\"\"Tests of the test-runner plugins.\"\"\"\n\nimport py\nimport unittest\nfrom nose.plugins import PluginTester\nfrom coverage.runners.noseplugin import Coverage\n\nclass TestCover...
python
chosen
[ { "from": "system", "value": "Return resulting object from decorated function if any\n" }, { "from": "human", "value": "import os\nfrom functools import wraps\nfrom argparse import ArgumentParser\nfrom fabric.context_managers import prefix\n\n\ndef cached_property(func):\n cach_attr = '_{0}'....
python
chosen
[ { "from": "system", "value": "Use relative imports in compiler package now that it is required. (Should this go into 2.5 or should we do compiler.XXX?)\n" }, { "from": "human", "value": "\"\"\"Package for parsing and compiling Python source code\n\nThere are several functions defined at the top...
python
chosen
[ { "from": "system", "value": "Add skipped result status; future compatibilty for non-run tests\n" }, { "from": "human", "value": "\n# IATI Data Quality, tools for Data QA on IATI-formatted publications\n# by Mark Brough, Martin Keegan, Ben Webb and Jennifer Smith\n#\n# Copyright (C) 2013 Pu...
python
chosen
[ { "from": "system", "value": "Disable unicode filename test on Windows with Python 3.0 - 3.5\n\nBefore PEP 529 landed in Python 3.6, unicode filename handling on\nWindows is hit-and-miss, so don't break CI.\n" }, { "from": "human", "value": "# coding: utf8\n\nfrom .common import *\n\n\nclass Tes...
python
chosen