conversations
listlengths
2
3
source
stringclasses
1 value
stack
stringclasses
1 value
[ { "from": "system", "value": "Disable rei.com on oopif benchmarks.\n\nCQ_EXTRA_TRYBOTS=tryserver.chromium.perf:linux_perf_bisect\nBUG=522870\n\nReview URL: https://codereview.chromium.org/1334733002\n\nCr-Commit-Position: 972c6d2dc6dd5efdad1377c0d224e03eb8f276f7@{#348251}\n" }, { "from": "human", ...
python
chosen
[ { "from": "system", "value": "Remove imports that no longer used\n" }, { "from": "human", "value": "# encoding: utf-8\n\n\"\"\"\n.. codeauthor:: Tsuyoshi Hombashi <tsuyoshi.hombashi@gmail.com>\n\"\"\"\n\nfrom __future__ import print_function\n\nimport path\nimport pytest\nimport responses\nimpor...
python
chosen
[ { "from": "system", "value": "Add variavel url_root to url of the reboot router and status mainpage router\n" }, { "from": "human", "value": "#! /usr/bin/env python\n# -*- coding: utf-8 -*-\n\nimport urllib2 as http\n\n# URL with GET to reboot router\nurl_get_reboot = 'http://10.11.12.254/log/in...
python
chosen
[ { "from": "system", "value": "Fix GraphConvTensorGraph to GraphConvModel in tox21\n" }, { "from": "human", "value": "\"\"\"\nScript that trains graph-conv models on Tox21 dataset.\n\"\"\"\nfrom __future__ import division\nfrom __future__ import print_function\nfrom __future__ import unicode_lite...
python
chosen
[ { "from": "system", "value": "Change unit from \"it\" to \"files\"\n" }, { "from": "human", "value": "#!/usr/bin/env python2\n# (C) 2015 Jean Nassar\n# Released under BSD\nimport glob\nimport os\nimport subprocess as sp\n\nimport rospkg\nimport tqdm\n\n\ndef get_launch_dir(package):\n return...
python
chosen
[ { "from": "system", "value": "Make the response body available via readBody\n\ngit-svn-id: 81e381228600e5752b80483efd2b45b26c451ea2@6660 e27351fd-9f3e-4f54-a53b-843176b1656c\n" }, { "from": "human", "value": "##\n# Copyright (c) 2010 Apple Inc. All rights reserved.\n#\n# Licensed under the Apach...
python
chosen
[ { "from": "system", "value": "Include ids for scheduled events to make schedule data unique\n" }, { "from": "human", "value": "import gevent\nimport msgpack\nimport redis\nimport time\n\nfrom lymph.core.interfaces import Interface\nfrom lymph.core.decorators import rpc\n\n\nclass Scheduler(Inter...
python
chosen
[ { "from": "system", "value": "Add user:dataset count to backdrop user admin\n\n- Sortable by number of data-sets the user has access to\n- Vaguely useful, but mainly an exercise in seeing how easily we can customise the output of the manytomany field (not very easily)\n" }, { "from": "human", "v...
python
chosen
[ { "from": "system", "value": "Fix BrandProposalForm to use BrandType in a choice\n" }, { "from": "human", "value": "from django import forms\n\n\nclass BrandProposalForm(forms.Form):\n brand_nm = forms.CharField(max_length=255, label='Brand name')\n brand_type = forms.ChoiceField(choices=(...
python
chosen
[ { "from": "system", "value": "Tag commit for v0.0.27-master generated by gitmake.py\n" }, { "from": "human", "value": "major = 0\nminor=0\npatch=26\nbranch=\"master\"\ntimestamp=1376610243.26" }, { "from": "gpt", "value": "major = 0\nminor=0\npatch=27\nbranch=\"master\"\ntimestamp=13...
python
chosen
[ { "from": "system", "value": "Move event managers imports to setup in auditor\n" }, { "from": "human", "value": "import activitylogs\nimport tracker\n\nfrom auditor.manager import default_manager\nfrom event_manager.event_service import EventService\n\n\nclass AuditorService(EventService):\n ...
python
chosen
[ { "from": "system", "value": "Reset back to using sqlite default. Add console.EmailBackend default\n" }, { "from": "human", "value": "# coding: utf-8\n\n\nDATABASES = {\n 'default': {\n 'ENGINE': 'django.db.backends.postgresql_psycopg2',\n 'NAME': 'registration',\n },\n}\n\nI...
python
chosen
[ { "from": "system", "value": "Add tests for parser tokens\n" }, { "from": "human", "value": "\"\"\"parse_token test case\"\"\"\n\nimport unittest\n\nfrom lighty.templates.tag import parse_token\n\nclass FormFieldsTestCase(unittest.TestCase):\n ''' Test form fields '''\n\n def setUp(self):\...
python
chosen
[ { "from": "system", "value": "Add explicit test to ensure cindex is present.\n" }, { "from": "human", "value": "import sublime\n\nimport os.path\nimport time\n\nfrom YetAnotherCodeSearch.tests import CommandTestCase\n\n\nclass CindexCommandTest(CommandTestCase):\n\n def test_cindex(self):\n ...
python
chosen
[ { "from": "system", "value": "Fix for logging incorrect region information when using instance role for authentication.\n" }, { "from": "human", "value": "\"\"\" Handles connections to AWS \"\"\"\nimport logging\nimport sys\n\nfrom boto import ec2\nfrom boto.utils import get_instance_metadata\n\...
python
chosen
[ { "from": "system", "value": "Initialize title and description with empty string\n" }, { "from": "human", "value": "#!/usr/bin/python\nimport config, os, string\n\ndef format_filename(s):\n valid_chars = \"-_.() %s%s\" % (string.ascii_letters, string.digits)\n filename = s.replace('/','-')...
python
chosen
[ { "from": "system", "value": "Add last event time in Redis\n\nThis makes sure events are not missed if the server restarts.\n" }, { "from": "human", "value": "\"\"\"\nThis module defines the Castor server, that consumes the Docker events from\na given host. This module can be run as a command li...
python
chosen
[ { "from": "system", "value": "Add optional parameters for starting location\n" }, { "from": "human", "value": "#!/usr/bin/env python\nimport sys, time\nimport math\n\nclass Ball:\n\tgravity = -3 # Dots per second squared\n\n\tdef __init__(self):\n\t\tself.r = 255\n\t\tself.g = 0\n\t\tself.b = 0\...
python
chosen
[ { "from": "system", "value": "Convert zipped list to dictionary\n" }, { "from": "human", "value": "# File: grains.py\n# Purpose: Write a program that calculates the number of grains of wheat\n# on a chessboard given that the number on each square doubles.\n# Programmer: ...
python
chosen
[ { "from": "system", "value": "Remove blank field from Meta class\n" }, { "from": "human", "value": "from django.forms import ModelForm\nfrom .models import CompsocUser, DatabaseAccount, ShellAccount\n\n\nclass CompsocUserForm(ModelForm):\n class Meta:\n model = CompsocUser\n fie...
python
chosen
[ { "from": "system", "value": "Check if git shows graph nicely\n" }, { "from": "human", "value": "__author__ = 'Keyvan'\n\nfrom blending.agents import DummyBlendingAgent\nfrom opencog.atomspace import AtomSpace\nfrom opencog.cogserver import Server\n\n\nif __name__ == '__main__':\n server = Se...
python
chosen
[ { "from": "system", "value": "Add IPython support to satori.console\n" }, { "from": "human", "value": "# vim:ts=4:sts=4:sw=4:expandtab\n\ndef main():\n from satori.tools import setup\n\n setup()\n\n import code\n import readline\n console = code.InteractiveConsole()\n console.r...
python
chosen
[ { "from": "system", "value": "Increase seed length in database to fit default\n" }, { "from": "human", "value": "from django.utils.translation import ugettext_lazy as _\nfrom django.db import models\nfrom django.contrib.auth.models import User\nfrom two_factor import call_gateways, sms_gateways\...
python
chosen
[ { "from": "system", "value": "Exclude integration test in coverage report\n" }, { "from": "human", "value": "from fabric.api import local\n\n\ndef test():\n local('coverage run --source=btsync,test $(which nosetests) test/unit')\n\n\ndef coverage():\n test()\n local('coverage report -m'...
python
chosen
[ { "from": "system", "value": "Change lemon if speech is detected\n\nIf speech is detected, change lemon to whatever was detected. Also print\nit.\n" }, { "from": "human", "value": "# Say anything you type, and write anything you say.\n# Stops when you say \"turn off\" or type \"turn off\".\n\nim...
python
chosen
[ { "from": "system", "value": "Update test for timezones & file-based sessions.\n" }, { "from": "human", "value": "\nfrom django.conf import settings\nfrom django.core.cache import cache\nfrom django.test import TestCase\nfrom django.utils.importlib import import_module\nfrom session_cleanup.task...
python
chosen
[ { "from": "system", "value": "[14.0][IMP] account_wallet_sale: Migrate only if former column exist\n" }, { "from": "human", "value": "# Copyright 2021 ACSONE SA/NV\n# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).\nfrom odoo import api, SUPERUSER_ID\nfrom openupgradelib import ope...
python
chosen
[ { "from": "system", "value": "Remove no longer used extra boto file parameter\n\nThis doesn't break anything, but it isn't needed.\n(RunBuilders:Test-ChromeOS-Alex-GMA3150-x86-Debug,Test-ChromeOS-Alex-GMA3150-x86-Release,Perf-ChromeOS-Alex-GMA3150-x86-Release)\n\nR=rmistry@google.com\n\nReview URL: https://...
python
chosen
[ { "from": "system", "value": "Fix pylint error for redefined builtin input.\n" }, { "from": "human", "value": "# coding: utf-8\n\nfrom __future__ import unicode_literals, absolute_import\n\nfrom six.moves import input\n\nfrom .oauth2 import OAuth2\n\n\nclass DeveloperTokenAuth(OAuth2):\n ENTE...
python
chosen
[ { "from": "system", "value": "Allow deletion of tokens from admin (NC-224)\n" }, { "from": "human", "value": "from django.contrib.auth import get_user_model\n\nfrom nodeconductor.core.permissions import StaffPermissionLogic\n\n\nUser = get_user_model()\n\n\nPERMISSION_LOGICS = (\n (get_user_m...
python
chosen
[ { "from": "system", "value": "Add default encoding for py2\n" }, { "from": "human", "value": "\"\"\" Test the command line interface \"\"\"\n\nimport pytest\n\nfrom ..cli import _is_float, _resolve_type\n\n\n@pytest.mark.parametrize(\"test_input,expected\", [\n (\"True\", True),\n (\"False...
python
chosen
[ { "from": "system", "value": "Allow to exclude ticket types from badge export\n\n7 and 22 are partner program\n" }, { "from": "human", "value": "# -*- coding: utf-8 -*-\nfrom __future__ import unicode_literals\n\nfrom optparse import make_option\n\nfrom django.core.management.base import BaseCom...
python
chosen
[ { "from": "system", "value": "Add open and close methods to dummy archive." }, { "from": "human", "value": "\"\"\"Module containing `DummyArchive` class.\"\"\"\n\n\nclass DummyArchive(object):\n \n \"\"\"Trivial archive implementation for testing purposes.\"\"\"\n \n \n @staticmet...
python
chosen
[ { "from": "system", "value": "Change context object for product list view in Oscar contrib\n" }, { "from": "human", "value": "from ... import mixins\n\n\nclass OscarFancyPageMixin(mixins.FancyPageMixin):\n node_attr_name = 'category'\n slug_url_kwarg = 'category_slug'\n context_object_n...
python
chosen
[ { "from": "system", "value": "Add stub for integration test.\n" }, { "from": "human", "value": "\"\"\"\nIntegration tests for the Skytap XBlock.\n\"\"\"\n\nfrom xblockutils.studio_editable_test import StudioEditableBaseTest\n\n\nclass TestSkytap(StudioEditableBaseTest):\n \"\"\"\n Integrat...
python
chosen
[ { "from": "system", "value": "Fix tests due to pdb update\n" }, { "from": "human", "value": "import unittest\nfrom unittest import mock\nfrom io import StringIO\nfrom cref.sequence.alignment import Blast\n\n\nclass AlignmentTestCase(unittest.TestCase):\n\n def test_blast_local(self):\n ...
python
chosen
[ { "from": "system", "value": "Make sure we refresh modules synchronously\n\nbsc#1124784\n\nSigned-off-by: Alvaro Saurin <95275619247e0a0a4a5f7a8d5144a85ee8f50dbb@gmail.com>\n" }, { "from": "human", "value": "from __future__ import absolute_import\n\n\ndef __virtual__():\n return \"caasp_orch\...
python
chosen
[ { "from": "system", "value": "Move re compilation to the module load\n" }, { "from": "human", "value": "# -*- coding: utf-8 -*-\n'''\nVarious user validation utilities\n'''\n\n# Import python libs\nimport re\nimport logging\n\nlog = logging.getLogger(__name__)\n\n\ndef valid_username(user):\n ...
python
chosen
[ { "from": "system", "value": "Use dbm cache instead of file system\n" }, { "from": "human", "value": "# Scrapy settings for pystock-crawler project\n#\n# For simplicity, this file contains only the most important settings by\n# default. All the other settings are documented here:\n#\n# http:...
python
chosen
[ { "from": "system", "value": "Add a simple test case.\n" }, { "from": "human", "value": "import unittest\nfrom piptools.datastructures import SpecSet\n\n\nclass TestSpecSet(unittest.TestCase):\n def test_adding_specs(self):\n \"\"\"Adding specs to a set.\"\"\"\n specset = SpecSe...
python
chosen
[ { "from": "system", "value": "Add test for deprecated flask.Request properties.\n" }, { "from": "human", "value": "# -*- coding: utf-8 -*-\n\"\"\"\n tests.deprecations\n ~~~~~~~~~~~~~~~~~~\n\n Tests deprecation support. Not used currently.\n\n :copyright: (c) 2014 by Armin Ronacher.\...
python
chosen
[ { "from": "system", "value": "Remove undefined import in coach plugin.\n" }, { "from": "human", "value": "from __future__ import absolute_import\nfrom __future__ import print_function\nfrom __future__ import unicode_literals\n\nfrom . import hooks\nfrom kolibri.core.auth.constants.user_kinds imp...
python
chosen
[ { "from": "system", "value": "Add name to logout url.\n" }, { "from": "human", "value": "\"\"\"bikeshop URL Configuration\n\nThe `urlpatterns` list routes URLs to views. For more information please see:\n https://docs.djangoproject.com/en/1.9/topics/http/urls/\nExamples:\nFunction views\n ...
python
chosen
[ { "from": "system", "value": "Add callback to control output.\n" }, { "from": "human", "value": "\"\"\"\nCommand function to schema-validate a HXL dataset.\nDavid Megginson\nNovember 2014\n\nCan use a whitelist of HXL tags, a blacklist, or both.\n\nUsage:\n\n import sys\n from hxl.scripts.hxlv...
python
chosen
[ { "from": "system", "value": "Fix Account import in management command\n" }, { "from": "human", "value": "from django.core.management.base import BaseCommand, CommandError\n\nfrom backend.models import Account\nfrom backend.tasks import get_all_contributions\n\nclass Command(BaseCommand):\n h...
python
chosen
[ { "from": "system", "value": "Make redis backend work with redis-py 1.34.1\n" }, { "from": "human", "value": "from redis import Redis as Redis\nfrom ghettoq.backends.base import BaseBackend\n\n\nclass RedisBackend(BaseBackend):\n\n def establish_connection(self):\n return Redis(host=se...
python
chosen
[ { "from": "system", "value": "Fix bug in Pipeline call where we run the whole Pipeline on list input\n" }, { "from": "human", "value": "class Pipeline(object):\n \"\"\"Defines a pipeline for transforming sequence data.\"\"\"\n\n def __init__(self, convert_token=None):\n if convert_t...
python
chosen
[ { "from": "system", "value": "Raise exception on not found ticker\n" }, { "from": "human", "value": "import requests\nfrom bs4 import BeautifulSoup\ntry:\n from urllib.parse import urlparse\nexcept ImportError:\n from urllib2 import urlparse\n urlparse = urlparse.urlparse\n\ntry:\n C...
python
chosen
[ { "from": "system", "value": "Fix extraction of gevent version in test\n\nCurrent version of gevent installed in travis seems to have a \".post0\" as the last part of the version, which fails the integer conversion. Since we are only interested in the first two parts of the version anyway we can just strip ...
python
chosen
[ { "from": "system", "value": "Add inheritance from object for BaseWrapper to force new style classes in python 2.7.\n" }, { "from": "human", "value": "\"\"\"This module contains the main wrapper class.\"\"\"\n\n\nclass BaseWrapper:\n \"\"\"Define base template for function wrapper classes. \"...
python
chosen
[ { "from": "system", "value": "Switch to 'StaticLiveServerTestCase' to avoid having to set 'settings.STATIC_ROOT'\n" }, { "from": "human", "value": "from django.test import LiveServerTestCase\n\nfrom selenium import webdriver\n\n\nclass FunctionalTest(LiveServerTestCase):\n\n def setUp(self):\...
python
chosen
[ { "from": "system", "value": "Add an s3 revision class\n" }, { "from": "human", "value": "import os\n\nfrom waterbutler.core import metadata\n\n\nclass S3FileMetadata(metadata.BaseMetadata):\n\n @property\n def provider(self):\n return 's3'\n\n @property\n def kind(self):\n ...
python
chosen
[ { "from": "system", "value": "Index old papers less often\n" }, { "from": "human", "value": "from django.contrib.sitemaps import Sitemap\nfrom .papers.models import Paper\n\n\nclass PaperSitemap(Sitemap):\n changefreq = \"monthly\"\n priority = 0.5\n limit = 2000\n\n def items(self):...
python
chosen
[ { "from": "system", "value": "Fix unicode keys in addition to values for windows/py2 environment\n" }, { "from": "human", "value": "# -*- coding: utf-8 -*-\n# ----------------------------------------------------------------------------\n# Copyright © 2016, Continuum Analytics, Inc. All rights re...
python
chosen
[ { "from": "system", "value": "Fix bug that was causing this to not even work at all\n" }, { "from": "human", "value": "# project\nfrom checks import AgentCheck\n\nVM_COUNTS = {\n 'pgpgin': 'pages.in',\n 'pgpgout': 'pages.out',\n 'pswpin': 'pages.swapped_in',\n 'pswpout': 'pages.swapp...
python
chosen
[ { "from": "system", "value": "Create destination path if it does no exist and copy file using shutil\n" }, { "from": "human", "value": "import os\n\nclass Generator:\n\n def run(self, sourcedir, outputdir):\n sourcedir = os.path.normpath(sourcedir)\n outputdir = os.path.normpath...
python
chosen
[ { "from": "system", "value": "Use socket connection to get own IP.\n" }, { "from": "human", "value": "import sh\nfrom sh import docker\n\n\ndef get_ip():\n \"\"\"Return a string of the IP of the hosts eth0 interface.\"\"\"\n intf = sh.ifconfig.eth0()\n return sh.perl(intf, \"-ne\", 's/d...
python
chosen
[ { "from": "system", "value": "Test for HOST_NAME or HOSTNAME env var\n" }, { "from": "human", "value": "from cla_public.config.common import *\n\n\nDEBUG = os.environ.get('SET_DEBUG', False) == 'True'\n\nSECRET_KEY = os.environ['SECRET_KEY']\n\n# TODO - change this to True when serving over HTTP...
python
chosen
[ { "from": "system", "value": "Add mock pyqtSignal to try to get Travis to build\n" }, { "from": "human", "value": "from . import qt_api\n\nif qt_api == 'pyside':\n from PySide.QtCore import *\nelif qt_api == 'pyqt':\n from PyQt4.QtCore import *\nelse:\n # Mock objects\n Qt = None\n" ...
python
chosen
[ { "from": "system", "value": "CORRECT height/width conversion this time around\n" }, { "from": "human", "value": "import argparse\nimport numpy as np\n\n\nfrom PIL import Image\n\nlookup = \" .,:-?X#\"\n\n\ndef image_to_ascii(image):\n \"\"\"\n PIL image object -> 2d array of values\n\n ...
python
chosen
[ { "from": "system", "value": "Test group managers. Rename idols() => status().\n" }, { "from": "human", "value": "import pytest\n\nfrom components.people.factories import IdolFactory\nfrom components.people.models import Idol\nfrom components.people.constants import STATUS\n\npytestmark = pytest...
python
chosen
[ { "from": "system", "value": "Use `@` in message thread\n" }, { "from": "human", "value": "from django.conf.urls import url\n\nfrom .views import MessageCreateView, ThreadDetailView, ThreadListView\n\nurlpatterns = [\n url(r'^(?P<recipient>[a-zA-Z0-9_]+)/$', ThreadDetailView.as_view(),\n ...
python
chosen
[ { "from": "system", "value": "fix: Resolve `message` variable missing error\n" }, { "from": "human", "value": "\"\"\"Notify Slack channel.\"\"\"\nimport time\n\nfrom ..utils import get_properties, get_template, post_slack_message\n\n\nclass SlackNotification:\n \"\"\"Post slack notification.\...
python
chosen
[ { "from": "system", "value": "Add comment to solutions sub-tags test\n" }, { "from": "human", "value": "from __future__ import absolute_import, unicode_literals\n\nfrom corehq import toggles\nfrom corehq.toggles import ALL_TAGS\n\n\ndef test_toggle_properties():\n \"\"\"\n Check toggle pro...
python
chosen
[ { "from": "system", "value": "Update unit tests with new query helper names\n" }, { "from": "human", "value": "# Copyright (C) 2016 Google Inc.\n# Licensed under http://www.apache.org/licenses/LICENSE-2.0 <see LICENSE file>\n\nimport unittest\nimport mock\n\nfrom ggrc.converters import query_hel...
python
chosen
[ { "from": "system", "value": "Test that github requests are actually retried\n" }, { "from": "human", "value": "import unittest\n\nfrom cumulusci.core.github import get_github_api\n\n\nclass TestGithub(unittest.TestCase):\n\n def test_github_api_retries(self):\n gh = get_github_api('Te...
python
chosen
[ { "from": "system", "value": "Add api prefix for image API\n" }, { "from": "human", "value": "\"\"\"rcard URL Configuration\n\nThe `urlpatterns` list routes URLs to views. For more information please see:\n https://docs.djangoproject.com/en/1.8/topics/http/urls/\nExamples:\nFunction views\n ...
python
chosen
[ { "from": "system", "value": "Add test for finding a person by first name\n" }, { "from": "human", "value": "from unittest import TestCase\n\nfrom address_book import AddressBook, Person, Group\n\n\nclass AddressBookTestCase(TestCase):\n\n def test_add_person(self):\n address_book = Ad...
python
chosen
[ { "from": "system", "value": "Check whether there is a format given (this must be checked for validity though).\n" }, { "from": "human", "value": "# django imports\nfrom django.utils.translation import ugettext_lazy as _\nfrom django.db import models\n\n# lfs imports\nfrom lfs.plugins import Ord...
python
chosen
[ { "from": "system", "value": "Fix the last_fetched and repo commands\n" }, { "from": "human", "value": "import logging\nimport logging.config\n\nfrom django.core.management.base import NoArgsCommand\nfrom django.utils import timezone\n\nfrom package.models import Package\n\nlogger = logging.getL...
python
chosen
[ { "from": "system", "value": "Remove request membership feature from project\n\n - add in euth.memberships app\n" }, { "from": "human", "value": "from django.shortcuts import redirect\nfrom django.views import generic\nfrom rules.contrib import views as rules_views\n\nfrom . import mixins, model...
python
chosen
[ { "from": "system", "value": "Add support for arbitrary user actions on marking\n" }, { "from": "human", "value": "# -*- coding: utf-8 -*-\nfrom __future__ import print_function\nfrom __future__ import unicode_literals\nfrom __future__ import division\n\nfrom functools import wraps\n\nfrom djang...
python
chosen
[ { "from": "system", "value": "Add support for presenter and continuing frame capture\n\nClick the right click of the presenter will trigger frame capture.\n" }, { "from": "human", "value": "from cam import OpenCV_Cam\nimport cv2\n\ncam = OpenCV_Cam(0)\ncam.size = (1920, 1080)\n\nKEY_ESC = 27\nKE...
python
chosen
[ { "from": "system", "value": "Add the location as a georss:point element.\n" }, { "from": "human", "value": "from django.contrib.syndication.views import Feed\nfrom django.core.urlresolvers import reverse_lazy\nfrom django.utils.feedgenerator import Atom1Feed\n\nfrom . import app_settings\nfrom ...
python
chosen
[ { "from": "system", "value": "Set the alias of the function `val` to `v`.\n" }, { "from": "human", "value": "# encoding: utf-8\n\n\n### Attribute Wrapper\nclass AttrWrapper(object):\n attrs = []\n\n def __setattr__(self, name, value):\n if name not in self.attrs:\n raise ...
python
chosen
[ { "from": "system", "value": "Refactor tests in preparation of the merge of redirect tests.\n" }, { "from": "human", "value": "\"\"\"Check REDIRECTIONS\"\"\"\n\nimport io\nimport os\n\nimport pytest\n\nimport nikola.plugins.command.init\nfrom nikola import __main__\n\nfrom .helper import append_...
python
chosen
[ { "from": "system", "value": "Add postfix for subprocess metric\n" }, { "from": "human", "value": "import asyncio\n\nfrom . import Agent\nfrom asyncio.subprocess import PIPE\n\n\nclass SubprocessAgent(Agent):\n\n @property\n def script(self):\n return self._data[\"script\"]\n\n d...
python
chosen
[ { "from": "system", "value": "Add empty line for pep8\n" }, { "from": "human", "value": "# -*- coding: utf-8 -*\n\n\"\"\"\nSimple fabric file to test oinspect output\n\"\"\"\n\nfrom __future__ import print_function\n\nimport webbrowser\n\nimport oinspect.utils as utils\nimport oinspect.sphinxify...
python
chosen
[ { "from": "system", "value": "Add command for updating the node.js modules needed by the JS sandbox.\n" }, { "from": "human", "value": "from fabric.api import cd, sudo, env\n\nenv.path = '/var/praekelt/vumi-go'\n\n\ndef deploy_go():\n with cd(env.path):\n sudo('git pull', user='vumi')\...
python
chosen
[ { "from": "system", "value": "[f] Add failure message test for not_to.be.eq\n" }, { "from": "human", "value": "from robber import expect\nfrom robber.matchers.equal import Equal, NotEqual\n\n\nclass TestEqual:\n def test_matches(self):\n expect(Equal(1, 1).matches()).to.eq(True)\n ...
python
chosen
[ { "from": "system", "value": "Switch NotImplementedError to to_react_represetnation in mixin\n" }, { "from": "human", "value": "class RepresentationMixin(object):\n @property\n def react_representation(self):\n raise NotImplementedError(\n 'Missing property react_represen...
python
chosen
[ { "from": "system", "value": "Fix compat bug in concretization_strategies\n" }, { "from": "human", "value": "from angr.concretization_strategies.any import SimConcretizationStrategyAny\nfrom angr.concretization_strategies.max import SimConcretizationStrategyMax\nfrom angr.concretization_strategi...
python
chosen
[ { "from": "system", "value": "Add homepage to the recipe site\n" }, { "from": "human", "value": "\"\"\"recipe_site URL Configuration\n\nThe `urlpatterns` list routes URLs to views. For more information please see:\n https://docs.djangoproject.com/en/1.11/topics/http/urls/\nExamples:\nFunction...
python
chosen
[ { "from": "system", "value": "Add test for integration of DetailObject and EPIC\n" }, { "from": "human", "value": "from __future__ import with_statement, print_function\nimport pytest\ntry:\n from unittest import mock\nexcept ImportError:\n import mock\n\nfrom k2catalogue import models\n\n...
python
chosen
[ { "from": "system", "value": "Fix broken test for Python 2.x/3.x\n" }, { "from": "human", "value": "# coding=utf-8\nfrom unittest import TestCase\nfrom click.testing import CliRunner\n\nimport yoda\n\n\nclass TestHoroscope(TestCase):\n \"\"\"\n Test for the following commands:\n\n ...
python
chosen
[ { "from": "system", "value": "Make sure every payment state is\n" }, { "from": "human", "value": "# -*- coding: utf-8 -*-\n\n\"\"\"\nbyceps.blueprints.shop_admin.service\n~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\n\n:Copyright: 2006-2014 Jochen Kupperschmidt\n\"\"\"\n\nfrom collections import Counter...
python
chosen
[ { "from": "system", "value": "Prepend namespace in include guards\n" }, { "from": "human", "value": "#!/usr/bin/python\n\nimport sys\nimport os\n\ndef createHeader(guard, namespace):\n return \"#ifndef {}_HPP\\n#define {}_HPP\\n\\n{}\\n\\n#endif\".format(guard, guard, namespace)\n \ndef cr...
python
chosen
[ { "from": "system", "value": "Add a new TestRunner class to remove Django deprecation warnings\n" }, { "from": "human", "value": "def run_tests(test_labels, verbosity=1, interactive=True, extra_tests=[]):\n import sys\n from pkg_resources import load_entry_point\n sys.argv[1:] = sys.arg...
python
chosen
[ { "from": "system", "value": "Format parsed speed data for use in Chart.js\n" }, { "from": "human", "value": "import os\nimport re\nimport json\n\nclass Parser(object):\n \"\"\"Parse output from Speedtest CLI into JSON\"\"\"\n\n def parse_all(self):\n records = []\n for file ...
python
chosen
[ { "from": "system", "value": "Use TestAppCKAN in test instead of LocalCKAN\n" }, { "from": "human", "value": "import nose\nfrom ckanapi import LocalCKAN, ValidationError\nfrom ckan.tests import helpers, factories\n\neq_ = nose.tools.eq_\nassert_true = nose.tools.assert_true\n\n\nclass TestValida...
python
chosen
[ { "from": "system", "value": "Add TESTING-True in test config.\n" }, { "from": "human", "value": "\"\"\"Base stuff for testing.\n\"\"\"\n\nfrom flask.ext.testing import TestCase\n\nfrom abilian.application import Application\nfrom abilian.core.entities import db\n\n\nclass TestConfig(object):\n ...
python
chosen
[ { "from": "system", "value": "Add support for special characters\n" }, { "from": "human", "value": "import json\nimport sys\nif sys.version_info[0] == 2:\n from StringIO import StringIO\nelse:\n from io import StringIO\nfrom pygments import highlight\nfrom pygments.formatters import Termin...
python
chosen
[ { "from": "system", "value": "Fix relative path to only test xylem source directory.\n" }, { "from": "human", "value": "import pep8\nimport os\n\n\ndef test_pep8_conformance():\n \"\"\"Test source code for PEP8 conformance\"\"\"\n pep8style = pep8.StyleGuide(max_line_length=120)\n repor...
python
chosen
[ { "from": "system", "value": "Define a custom user model\n" }, { "from": "human", "value": "from django.db import models\n\n# Create your models here.\n" }, { "from": "gpt", "value": "# Define a custom User class to work with django-social-auth\nfrom django.contrib.auth.models import...
python
chosen
[ { "from": "system", "value": "Remove makeweatherfiles, add template for Windows version file\n" }, { "from": "human", "value": "#!/usr/bin/python\n#\nsource_files = ['check_siren.py', 'colours', 'credits', 'dataview', 'dijkstra_4',\n 'displayobject', 'displaytable', 'editini', 'fl...
python
chosen
[ { "from": "system", "value": "Add test for opening file\n" }, { "from": "human", "value": "from cffitsio import FitsFile\nimport os\n\ndef test_create_file(tmpdir):\n filename = str(tmpdir.join('test.fits'))\n f = FitsFile.create(filename)\n assert os.path.isfile(filename)\n" }, { ...
python
chosen
[ { "from": "system", "value": "Add new percolation alg to init - to be renamed later\n" }, { "from": "human", "value": "r\"\"\"\n###############################################################################\n:mod:`OpenPNM.Algorithms` -- Algorithms on Networks\n##################################...
python
chosen
[ { "from": "system", "value": "Call diff_fonts with correct params\n" }, { "from": "human", "value": "\"\"\"Functional tests\n\nTest will produce the following tuple of all path permutations\n\npaths = ['path/to/font_a', 'path/to/font_b']\n\n[\n (path/to/font_a, path/to/font_b),\n (path/to/...
python
chosen
[ { "from": "system", "value": "Revert \"Added logging to SiteTheme.get_theme\"\n\nThis reverts commit f1436a255bb22ecd7b9ddca803240262bf484981.\n" }, { "from": "human", "value": "import logging\n\nfrom django.conf import settings\nfrom django.contrib.sites.models import Site\nfrom django.db impor...
python
chosen
[ { "from": "system", "value": "Add failing test for m2m too.\n" }, { "from": "human", "value": "\"\"\"\nTest rest_framework_json_api's utils functions.\n\"\"\"\nfrom rest_framework_json_api import utils\n\nfrom ..serializers import EntrySerializer\nfrom ..tests import TestBase\n\n\nclass GetRelat...
python
chosen