conversations
listlengths
2
3
source
stringclasses
1 value
stack
stringclasses
1 value
[ { "from": "system", "value": "DROP DATABASE IF EXISTS in tests." }, { "from": "human", "value": "\n\nimport sys\nimport os\nimport argparse\n\ndef write_csv(filename, nb_users):\n\twith open(filename, \"w\") as csv_file:\n\t\tcsv_file.write(\"SEQUENTIAL\\n\")\n\t\tfor x in xrange(nb_users):\n\t\...
python
chosen
[ { "from": "system", "value": "Add support for plugin settings" }, { "from": "human", "value": "class BasePlugin(object):\n\n ext = None\n\n def load(self, content):\n \"\"\"\n Return plugin data for content string\n \"\"\"\n return content\n\n def save(self, ...
python
chosen
[ { "from": "system", "value": "Add an initial ghetto asyncio test." }, { "from": "human", "value": "from unittest import TestCase\n\n\nclass AsyncioTransportTestCase(TestCase):\n pass\n" }, { "from": "gpt", "value": "from asyncio import get_event_loop\nfrom unittest import TestCase...
python
chosen
[ { "from": "system", "value": "Set CHECK_LINKS to False for default\n" }, { "from": "human", "value": "HOST = \"irc.twitch.tv\"\nPORT = 6667\n\nPASS = \"oauth:##############################\" # Your bot's oauth (https://twitchapps.com/tmi/)\nIDENTITY = \"my_bot\" ...
python
chosen
[ { "from": "system", "value": "Add datefmt to arguments that will be passed within decorated basicConfig\n" }, { "from": "human", "value": "\"\"\"Wrappers around the logging module\"\"\"\n\nfrom __future__ import absolute_import\n\nimport functools\nimport logging\n\nfrom colorlog.colorlog import...
python
chosen
[ { "from": "system", "value": "Fix django view closure issue.\n" }, { "from": "human", "value": "from __future__ import absolute_import\n\nfrom collections import OrderedDict\n\nfrom dependencies import this\nfrom django.views.generic import View\n\n\ndef view(injector):\n \"\"\"Create Django ...
python
chosen
[ { "from": "system", "value": "Support token as an argument to our requests wrapper\n" }, { "from": "human", "value": "'''\nWrappers around Python requests\n\nThis allows us to handle all the custom headers in a single place\n'''\nfrom __future__ import absolute_import\n\nimport requests\nfrom fu...
python
chosen
[ { "from": "system", "value": "Remove unused section of SettingsForm\n" }, { "from": "human", "value": "from django.contrib.auth.models import User\nfrom django import forms\n\nfrom account.models import UserProfile\n\n\nattributes = {\"class\": \"required\"}\n\n\nclass RegistrationForm(forms.For...
python
chosen
[ { "from": "system", "value": "Add _parent field with setter/getter\n" }, { "from": "human", "value": "\nclass DataModelAdapter(object) :\n\n def __init__(self, data) :\n self._data = data\n self._children = set()\n pass\n\n def numChildren(self) :\n return len(s...
python
chosen
[ { "from": "system", "value": "Add space_station field to detailed docking event\n" }, { "from": "human", "value": "from api.v330.common.serializers import *\n\n\nclass SpacecraftFlightSerializerForDockingEvent(serializers.HyperlinkedModelSerializer):\n spacecraft = SpacecraftSerializer(read_o...
python
chosen
[ { "from": "system", "value": "Add static highlighting on serviceDescription field\n" }, { "from": "human", "value": "from flask import Markup\n\n\nclass SearchResults(object):\n \"\"\"Provides access to the search results information\"\"\"\n\n def __init__(self, response, lots_by_slug):\n ...
python
chosen
[ { "from": "system", "value": "badges: Include style for all badges\n\nNot only global badges.\n" }, { "from": "human", "value": "def badge(badge):\n from adhocracy.lib.templating import render_def\n return render_def('/badge/tiles.html', 'badge', badge=badge,\n cached=...
python
chosen
[ { "from": "system", "value": "Load utils in cms contrib package.\n" }, { "from": "human", "value": "# coding: utf-8\n\n\"\"\"\nCMS-related contrib package. https://home.cern/about/experiments/cms\n\"\"\"\n\n\n__all__ = [\"CMSJobDashboard\", \"BundleCMSSW\"]\n\n\n# provisioning imports\nfrom law....
python
chosen
[ { "from": "system", "value": "Set release version to 1.0.0a2\n" }, { "from": "human", "value": "\"\"\"\nChatterBot is a machine learning, conversational dialog engine.\n\"\"\"\nfrom .chatterbot import ChatBot\n\n__version__ = '1.0.0a1'\n__author__ = 'Gunther Cox'\n__email__ = 'gunthercx@gmail.co...
python
chosen
[ { "from": "system", "value": "Caramel: Move pyramid_tm include to caramel.main\n\nMove the setting to include pyramid_tm to caramel.main from ini files.\nThis is a vital setting that should never be changed by the user.\n" }, { "from": "human", "value": "#! /usr/bin/env python\n# vim: expandtab ...
python
chosen
[ { "from": "system", "value": "Set HDF5TableSink as default sink\n" }, { "from": "human", "value": "# coding=utf-8\n# Filename: cmd.py\n\"\"\"\nKM3Pipe command line utility.\n\nUsage:\n km3pipe test\n km3pipe tohdf5 [-s] -i FILE -o FILE\n km3pipe (-h | --help)\n km3pipe --version\n\nO...
python
chosen
[ { "from": "system", "value": "Address @jchansen's requests. No dupes. POST for authorized users, PUT DELETE for cloud admins and staff.\n\n\tmodified: api/v2/views/tag.py\n" }, { "from": "human", "value": "from core.models import Tag\n\nfrom api.permissions import CloudAdminRequired\nfrom api....
python
chosen
[ { "from": "system", "value": "Add view and update decorators\n" }, { "from": "human", "value": "from django.conf.urls.defaults import *\n\nfrom . import views\n\nurlpatterns = patterns('',\n url(r'^profile/$', views.profile_index, name='survey_profile'),\n url(r'^profile/electric/$', views...
python
chosen
[ { "from": "system", "value": "Add \"where\" to top level dask.array module\n" }, { "from": "human", "value": "from __future__ import absolute_import, division, print_function\n\nfrom ..utils import ignoring\nfrom .core import (Array, stack, concatenate, tensordot, transpose, from_array,\n ...
python
chosen
[ { "from": "system", "value": "Update pubkey servlet to s/signers/keyring\n" }, { "from": "human", "value": "# -*- coding: utf-8 -*-\n\n# Copyright 2014 matrix.org\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may not use this file except in compliance with the Li...
python
chosen
[ { "from": "system", "value": "Add cache on article page (via url)\n" }, { "from": "human", "value": "#!/usr/bin/env python\n# -*- coding: utf-8 -*-\n#\nfrom django.conf.urls import patterns, url\n\nfrom .views import OppsDetail, OppsList, Search\n\n\nurlpatterns = patterns(\n '',\n url(r'^...
python
chosen
[ { "from": "system", "value": "Reduce the size of log_name so it fits within mysql's limit.\n" }, { "from": "human", "value": "\nfrom database import db\nfrom conversions import datetime_from_str\n\n\nclass LogEntry(db.Model):\n\n id = db.Column(db.Integer, primary_key=True)\n timestamp = d...
python
chosen
[ { "from": "system", "value": "Adjust --dump-config color theme for better readability\nAdd jinja highlighting to --dump-config\n" }, { "from": "human", "value": "from argparse import SUPPRESS\n\nfrom loguru import logger\nfrom rich.syntax import Syntax\n\nfrom flexget import options, plugin\nfro...
python
chosen
[ { "from": "system", "value": "Use new-style metadata in example\n" }, { "from": "human", "value": "from pupa.scrape import Jurisdiction\n\nfrom .people import PersonScraper\n\n\nclass Example(Jurisdiction):\n jurisdiction_id = 'ocd-jurisdiction/country:us/state:ex/place:example'\n\n def ge...
python
chosen
[ { "from": "system", "value": "Fix server error when login with u2f\n" }, { "from": "human", "value": "#!/usr/bin/env python3\n# -*- coding: utf-8 -*-\n\nimport json\nfrom u2flib_server.u2f import (begin_registration,\n begin_authentication,\n ...
python
chosen
[ { "from": "system", "value": "Monitor number of batches in a input batch queue\n" }, { "from": "human", "value": "import functools\nimport tensorflow as tf\n\nfrom . import cnn_dailymail_rc\nfrom ..flags import FLAGS\n\n\n\nREADERS = { \"cnn_dailymail_rc\": cnn_dailymail_rc.read_files }\n\n\ndef...
python
chosen
[ { "from": "system", "value": "Verify that the guess is a number, that it is between 1 and 100, and tells the user if the guessed number is too high or low.\n" }, { "from": "human", "value": "import random\n\nattempts = 1\nnumber = str(random.randint(1, 100))\nwhile True:\n print number\n i...
python
chosen
[ { "from": "system", "value": "Add alternative warning if sqlite is >=3.19 but is missing fts5 support\n" }, { "from": "human", "value": "from django.apps import AppConfig\nfrom django.core.checks import Tags, Warning, register\nfrom django.db import connection\nfrom django.utils.translation impo...
python
chosen
[ { "from": "system", "value": "Add back the development marker\n" }, { "from": "human", "value": "# Copyright 2013 Donald Stufft\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may not use this file except in compliance with the License.\n# You may obtain a copy of ...
python
chosen
[ { "from": "system", "value": "Make osBrain compatible with latest Pyro4 changes\n" }, { "from": "human", "value": "import Pyro4\nPyro4.config.SERIALIZERS_ACCEPTED.add('pickle')\nPyro4.config.SERIALIZER = 'pickle'\nPyro4.config.THREADPOOL_SIZE = 16\nPyro4.config.SERVERTYPE = 'multiplex'\n# TODO: ...
python
chosen
[ { "from": "system", "value": "Check for a fileversion region before copying them to the source region\n\nThis is mainly for test fileversions that are created without regions by default\n" }, { "from": "human", "value": "\ndef copy_files(src, target_node, parent=None, name=None):\n \"\"\"Copy...
python
chosen
[ { "from": "system", "value": "MB-13234: Make `top` work on Ubuntu 12.04\n\nThe `top` in Ubuntu12.04 seems to do different command line parsing\nthan the one on CentOS. Separating the parameters should work on\nboth.\n\nChange-Id: I8f9ec022bcb8e0158316fdaac226acbfb0d9d004\nReviewed-on: http://review.couchbas...
python
chosen
[ { "from": "system", "value": "Use absolute import to correctly import local.py config file\n" }, { "from": "human", "value": "from __future__ import unicode_literals\n\ntry:\n\tfrom local import *\nexcept ImportError:\n\ttry:\n\t\tfrom dev import *\n\texcept ImportError:\n\t\tpass\n\ntry:\n\tDEB...
python
chosen
[ { "from": "system", "value": "Set xml catalog to the right prefix.\n" }, { "from": "human", "value": "GnomePackage ('gtk-doc', version_major = '1', version_minor = '17', sources = [\n 'http://ftp.gnome.org/pub/gnome/sources/%{name}/%{version}/%{name}-%{version}.tar.bz2'\n\t])\n" }, { ...
python
chosen
[ { "from": "system", "value": "Add anonymous user to fake request object.\n" }, { "from": "human", "value": "from django.template import Library, Node\nfrom django.test.client import RequestFactory\n\n\nregister = Library()\nfactory = RequestFactory()\n\n\nclass FakeRequestNode(Node):\n def re...
python
chosen
[ { "from": "system", "value": "Make settings and requests menu items" }, { "from": "human", "value": "from django.apps import AppConfig\nfrom django.utils.translation import ugettext_lazy as _\n\n\nclass AccountConfig(AppConfig):\n name = 'froide.account'\n verbose_name = _(\"Account\")\n\n...
python
chosen
[ { "from": "system", "value": "Revert \"Remove AuthType.EVENT_DATA and renumber\"\n\nThis reverts commit 38248941eb47a04b82fe52e1adca7387dafcf7f3.\n" }, { "from": "human", "value": "class AuthType(object):\n \"\"\"\n An auth type defines what write privileges an authenticated agent has.\n ...
python
chosen
[ { "from": "system", "value": "Return self instead of select result in __aenter__" }, { "from": "human", "value": "import asyncio\nfrom enum import Enum\n\nimport aiormq\n\n\nclass TransactionStates(Enum):\n created = \"created\"\n commited = \"commited\"\n rolled_back = \"rolled back\"\...
python
chosen
[ { "from": "system", "value": "Use unittest2 if available and gracefully falls back to unittest.\n" }, { "from": "human", "value": "\"\"\"\nraven.utils.compat\n~~~~~~~~~~~~~~~~~~~~~~~~~~\n\n:copyright: (c) 2010-2012 by the Sentry Team, see AUTHORS for more details.\n:license: BSD, see LICENSE for...
python
chosen
[ { "from": "system", "value": "Make sequence marker types (:type) case insensitive\n" }, { "from": "human", "value": "import bpy\n\ndef find_seqs(scene, select_marker):\n sequences = {}\n sequence_flags = {}\n\n for marker in scene.timeline_markers:\n if \":\" not in marker.name o...
python
chosen
[ { "from": "system", "value": "Use more Pythonic name for test.\n" }, { "from": "human", "value": "\"\"\"\nTest the top-level Kafka Streams class\n\"\"\"\n\n\nimport pytest\n\nfrom winton_kafka_streams import kafka_config\nfrom winton_kafka_streams.errors.kafka_streams_error import KafkaStreamsEr...
python
chosen
[ { "from": "system", "value": "Add import for older versions of Django\n" }, { "from": "human", "value": "from test_utils import * # noqa\nfrom test_views import * # noqa\n" }, { "from": "gpt", "value": "from test_outgoing import * # noqa\nfrom test_utils import * # noqa\nfrom tes...
python
chosen
[ { "from": "system", "value": "Add delay to input-output test\n" }, { "from": "human", "value": "# TOOL test-data-in-out.py: \"Test data input and output in Python\" (Data input output test.) \n# INPUT input TYPE GENERIC\n# OUTPUT output\n# OUTPUT OPTIONAL missing_output.txt\n\nimport shutil\n\ns...
python
chosen
[ { "from": "system", "value": "Make sure to push the tags\n" }, { "from": "human", "value": "from fabric.api import local\n\n__author__ = 'derek'\n\n\ndef deploy(version):\n local('python runtests.py')\n local(\"git tag -a %s -m %s\" % (version, version))\n local('python setup.py sdist u...
python
chosen
[ { "from": "system", "value": "Make env.path to /var/praekelt/<PROJECT> an absolute path.\n" }, { "from": "human", "value": "from fabric.api import cd, sudo, env\nimport os\n\nexpected_vars = [\n 'PROJECT',\n]\n\nfor var in expected_vars:\n if var not in os.environ:\n raise Exception...
python
chosen
[ { "from": "system", "value": "Fix USER in fabric file (the deploy user and ssh user aren't necessarily the same). Set default value for PROJECT (this is the go-rts-zambia repo after all).\n" }, { "from": "human", "value": "from fabric.api import cd, sudo, env\nimport os\n\nexpected_vars = [\n ...
python
chosen
[ { "from": "system", "value": "Split out the css rebuilding into its own fab method.\n" }, { "from": "human", "value": "set(\n fab_hosts = ['startthedark.com'],\n fab_user = 'startthedark',\n)\n\ndef unlink_nginx():\n 'Un-link nginx rules for startthedark.'\n sudo('rm -f /etc/nginx/si...
python
chosen
[ { "from": "system", "value": "Print message when secrets file is missing\n" }, { "from": "human", "value": "import imp\nimport os\nimport sys\nimport traceback\n\nfrom os.path import dirname\n\nfrom configurations import values\nfrom .common import Common, BASE_DIR, external_keys\n\nSECRETS_DIR ...
python
chosen
[ { "from": "system", "value": "Fix example to use get\n" }, { "from": "human", "value": "\"\"\"An example application using Confit for configuration.\"\"\"\nfrom __future__ import print_function\nfrom __future__ import unicode_literals\nimport confit\nimport argparse\n\n\nconfig = confit.LazyConf...
python
chosen
[ { "from": "system", "value": "Fix static files finder errors\n" }, { "from": "human", "value": "from django.utils._os import safe_join\nimport os\nfrom django.conf import settings\nfrom django.contrib.staticfiles.finders import FileSystemFinder\nfrom bluebottle.clients.models import Client\n\n\n...
python
chosen
[ { "from": "system", "value": "Replace ASCII checking chars and space with library methods\n" }, { "from": "human", "value": "'''\nBase NLP utilities\n'''\n\n\ndef get_words(sentence):\n ''' Return all the words found in a sentence.\n Ignore whitespace and all punctuation\n >>> get_words...
python
chosen
[ { "from": "system", "value": "Add icon_url as abstract property\n" }, { "from": "human", "value": "from enum import Enum\n\n\nclass Status(Enum):\n ok = 1 # green\n maintenance = 2 # blue\n minor = 3 # yellow\n major = 4 # orange\n critical = 5...
python
chosen
[ { "from": "system", "value": "Add a test to check the right number of days in 400 year cycles.\n" }, { "from": "human", "value": "from datetime import date as vanilla_date\n\nfrom calendar_testing import CalendarTest\n\nfrom calexicon.calendars.other import JulianDayNumber\n\nclass TestJulianDay...
python
chosen
[ { "from": "system", "value": "Add missing event listener for new overrides\n\nWhile rolling the test code for creating overrides into the base code,\nwe remembered to make sure that we put the event handler used to handle\noverride creation in place but forgot to export them to to the base\nplugin so that i...
python
chosen
[ { "from": "system", "value": "Install github verison of boto in aws cookbook (for now)\n" }, { "from": "human", "value": "\nfrom kokki import *\n\nPackage(\"python-boto\")\n\n# Mount volumes and format is necessary\n\nfor vol in env.config.aws.volumes:\n env.cookbooks.aws.EBSVolume(vol['volum...
python
chosen
[ { "from": "system", "value": "Update should_write_image to return False\n\nUpdate should_write_image to return False" }, { "from": "human", "value": "# Licensed under the Apache License, Version 2.0 (the \"License\"); you may\n# not use this file except in compliance with the License. You ...
python
chosen
[ { "from": "system", "value": "Remove CLASSIFIER_TYPES constant - it was never used\n\nChange-Id: Ia6ba4453f6bc9b9de0da1e83d2dc75147fb91882\n" }, { "from": "human", "value": "# Copyright (c) 2015 Mirantis, Inc.\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\"); you may\n# not...
python
chosen
[ { "from": "system", "value": "Make that work with admin too\n" }, { "from": "human", "value": "from django import forms\n\nfrom main.models import Profile, LanProfile\n\n\nclass AdminLanProfileForm(forms.ModelForm):\n class Meta:\n model = LanProfile\n fields = '__all__'\n\n\ncl...
python
chosen
[ { "from": "system", "value": "TEST: Add warning for TempFATFS test\n" }, { "from": "human", "value": "# emacs: -*- mode: python; py-indent-offset: 4; indent-tabs-mode: nil -*-\n# vi: set ft=python sts=4 ts=4 sw=4 et:\n\"\"\"Test testing utilities\n\"\"\"\n\nfrom nipype.testing.utils import TempF...
python
chosen
[ { "from": "system", "value": "Update the authentication backend with upcoming features\n" }, { "from": "human", "value": "from django.contrib.auth.backends import ModelBackend\nfrom django.contrib.auth.models import User\nfrom hashlib import sha1\n\n\nclass SimpleHashModelBackend(ModelBackend):\...
python
chosen
[ { "from": "system", "value": "Update boilerplate to save a screenshot before the tearDown()\n" }, { "from": "human", "value": "'''\nYou can use this as a boilerplate for your test framework.\nDefine your customized library methods in a master class like this.\nThen have all your test classes inh...
python
chosen
[ { "from": "system", "value": "Make environmental override of osfstorage settings work\n\nSigned-off-by: Chris Wisecarver <5fccdd17c1f7bcc7e393d2cb5e2fad37705ca69f@cos.io>\n" }, { "from": "human", "value": "# encoding: utf-8\nimport importlib\nimport os\nimport logging\nfrom website import settin...
python
chosen
[ { "from": "system", "value": "Make handle function to behave similar as main function\n" }, { "from": "human", "value": "# Author: Milos Buncic\n# Date: 2017/10/14\n# Description: Convert YAML to JSON and vice versa (OpenFaaS function)\n\nimport os\nimport sys\nimport json\nimport yaml\n\n\ndef ...
python
chosen
[ { "from": "system", "value": "Make action python 3 compatible\n" }, { "from": "human", "value": "import pprint\nimport sys\n\nfrom st2actions.runners.pythonrunner import Action\n\n__all__ = [\n 'AssertObjectEquals'\n]\n\n\nclass AssertObjectEquals(Action):\n def run(self, object, expected)...
python
chosen
[ { "from": "system", "value": "BLD: Add support for *.pyi data-files to `np.testing._private`\n" }, { "from": "human", "value": "#!/usr/bin/env python3\n\ndef configuration(parent_package='',top_path=None):\n from numpy.distutils.misc_util import Configuration\n config = Configuration('test...
python
chosen
[ { "from": "system", "value": "Implement empty metadata a little differently\n" }, { "from": "human", "value": "import copy\nimport json\n\nfrom py4j.java_gateway import JavaClass, java_import\nfrom pymrgeo.instance import is_instance_of as iio\n\nclass RasterMapOp(object):\n mapop = None\n ...
python
chosen
[ { "from": "system", "value": "Change requirements to look for abstract (latest) versions.\n" }, { "from": "human", "value": "# coding=utf-8\n\"\"\"Setup file for distutils / pypi.\"\"\"\ntry:\n from ez_setup import use_setuptools\n use_setuptools()\nexcept ImportError:\n pass\n\nfrom se...
python
chosen
[ { "from": "system", "value": "Handle missing INCAR files gracefully\n" }, { "from": "human", "value": "from django.shortcuts import render_to_response\nfrom django.template import RequestContext\nimport os.path\n\nfrom qmpy.models import Calculation\nfrom ..tools import get_globals\n\nfrom bokeh...
python
chosen
[ { "from": "system", "value": "Fix Dockerfile so it can cache requirements\n" }, { "from": "human", "value": "from censusreporter.config.base.settings import *\nimport os\n\nDEBUG = False\nROOT_URLCONF = 'censusreporter.config.prod.urls'\nWSGI_APPLICATION = \"censusreporter.config.prod.wsgi.appli...
python
chosen
[ { "from": "system", "value": "Switch to using require_http_methods decorator.\n" }, { "from": "human", "value": "from decorator_plus import (\n require_form_methods, require_safe_methods)\nfrom django.shortcuts import (\n get_object_or_404, redirect, render)\n\nfrom .forms import ExampleFo...
python
chosen
[ { "from": "system", "value": "Allow passing use_list to msgpack_loads\n" }, { "from": "human", "value": "# coding: utf8\nfrom __future__ import unicode_literals\n\nimport gc\n\nfrom . import msgpack\nfrom .util import force_path\n\n\ndef msgpack_dumps(data):\n return msgpack.dumps(data, use_b...
python
chosen
[ { "from": "system", "value": "Fix state bleed, add fixture import test\n" }, { "from": "human", "value": "import os\nimport sys\n\nfrom spec import Spec, skip\nfrom invoke import run\n\n\nclass Integration(Spec):\n def setup(self):\n from tessera.application import db\n # Ensure...
python
chosen
[ { "from": "system", "value": "Add create email and delete email methods\n" }, { "from": "human", "value": "from collections import namedtuple\n\nimport requests\n\n\nQUERY_TEMPLATE = '?token={}&domain={}'\nBASE_URL = 'https://pddimp.yandex.ru/api2/'\n\nConnection = namedtuple('Connection', ['aut...
python
chosen
[ { "from": "system", "value": "Fix cluster group membership synchronization.\n" }, { "from": "human", "value": "import logging\n\nfrom celery import shared_task\nfrom django.conf import settings\n\nfrom waldur_keycloak.models import ProjectGroup\nfrom waldur_rancher.models import Cluster, Cluster...
python
chosen
[ { "from": "system", "value": "Fix sentence index shifting with empty sentences\n" }, { "from": "human", "value": "# -*- coding: utf-8 -*-\nfrom __future__ import unicode_literals\n\nfrom itertools import combinations\nfrom operator import itemgetter\n\nfrom distance import jaccard\nfrom networkx...
python
chosen
[ { "from": "system", "value": "Restructure major projects for spring evals 👷\n" }, { "from": "human", "value": "from flask import Blueprint\nfrom flask import render_template\nfrom flask import request\n\nspring_evals_bp = Blueprint('spring_evals_bp', __name__)\n\n@spring_evals_bp.route('/spring...
python
chosen
[ { "from": "system", "value": "Allow check_user_preferences for email to be passed from async templated email send\n" }, { "from": "human", "value": "from celery.task import task\nfrom utils import send_templated_email\n\n@task\ndef send_templated_email_async(to, subject, body_template, body_dict...
python
chosen
[ { "from": "system", "value": "Convert UnicodeDictReader to an iterator class, so that EmptyCSVError will get thrown on instantiation, rather than on iteration.\n" }, { "from": "human", "value": "# work around python2's csv.py's difficulty with utf8\n# partly cribbed from http://stackoverflow.com...
python
chosen
[ { "from": "system", "value": "Change test function as existing method deprecated\n" }, { "from": "human", "value": "import pytest\n\n@pytest.mark.parametrize(\"name\", [\n (\"apt-file\"),\n (\"apt-transport-https\"),\n (\"atom\"),\n (\"blktrace\"),\n (\"ca-certificates\"),\n (\"chromium-br...
python
chosen
[ { "from": "system", "value": "Add Bot.run and an on_ready message\n" }, { "from": "human", "value": "import asyncio\nimport configparser\nimport discord\nfrom discord.ext import commands\n\nclass Bot(commands.Bot):\n\tdef __init__(self, config_filepath, command_prefix):\n\t\tsuper().__init__(com...
python
chosen
[ { "from": "system", "value": "Create a pdf of the univariate pdfs instead of writing to a .csv file.\n" }, { "from": "human", "value": "\"\"\"\nPurpose: to recreate the univariate pdfs of Conlisk et al. (2007)\nin figure 2. This provides a test that the univariate pdfs are \nworking correctly\n\...
python
chosen
[ { "from": "system", "value": "Make XeLaTeX test harder (to actually test xelatex being used).\n" }, { "from": "human", "value": "from latex.build import LatexMkBuilder\n\n\ndef test_xelatex():\n min_latex = r\"\"\"\n\\documentclass{article}\n\\begin{document}\nHello, world!\n\\end{document}\n...
python
chosen
[ { "from": "system", "value": "Add test for custom css\n" }, { "from": "human", "value": "from django.test import TestCase, RequestFactory\nfrom molo.core.tests.base import MoloTestCaseMixin\nfrom freebasics.views import HomeView\nfrom freebasics.templatetags import freebasics_tags\n\n\nclass Env...
python
chosen
[ { "from": "system", "value": "Use common timezones and not all timezones pytz provides.\n\n\ngit-svn-id: 13ea2b4cf383b32e0a7498d153ee882d068671f7@13 86ebb30f-654e-0410-bc0d-7bf82786d749\n" }, { "from": "human", "value": "\nimport pytz\n\nTIMEZONE_CHOICES = zip(pytz.all_timezones, pytz.all_timezo...
python
chosen
[ { "from": "system", "value": "Add path_to_python fixture to make writing multiplatform job scripts easier.\n" }, { "from": "human", "value": "import pytest\nfrom .scripts import SCRIPTS\n\n# This module is loaded as a \"plugin\" by pytest by a setting in conftest.py\n# Any fixtures defined here ...
python
chosen
[ { "from": "system", "value": "Add unittest for missing parenthesis\n" }, { "from": "human", "value": "import unittest\nimport brainfuck\n\ntest_cases = [(\"++++++++[>++++[>++>+++>+++>+<<<<-]>+>+>->>+[<]<-]>>.>---.+++++++..+++.>>.<-.<.+++.------.--------.>>+.>++.\", \"Hello World!\\n\")]\n\nclass...
python
chosen
[ { "from": "system", "value": "Make the Bing images search pick a random top 20 image.\n" }, { "from": "human", "value": "from aiohttp import BasicAuth\nfrom plumeria import config, scoped_config\nfrom plumeria.command import commands, CommandError\nfrom plumeria.config.common import nsfw\nfrom p...
python
chosen
[ { "from": "system", "value": "Remove test enforcing listening on port 1883\n" }, { "from": "human", "value": "import os\nimport pytest\nimport testinfra.utils.ansible_runner\n\ntestinfra_hosts = testinfra.utils.ansible_runner.AnsibleRunner(\n os.environ['MOLECULE_INVENTORY_FILE']).get_hosts('...
python
chosen
[ { "from": "system", "value": "Use HTTPBasicAuth when connecting to the API\n" }, { "from": "human", "value": "from urllib.parse import urljoin\n\nfrom oauthlib.oauth2 import LegacyApplicationClient\nfrom requests_oauthlib import OAuth2Session\nimport slumber\n\nfrom . import settings\n\nREQUEST_...
python
chosen
[ { "from": "system", "value": "Fix integration tests for Python 3.\n" }, { "from": "human", "value": "from django.contrib.auth.models import User\nfrom django.test import TestCase\nfrom DjangoLibrary.middleware import FactoryBoyMiddleware\nfrom mock import Mock\n\nimport json\n\n\nclass TestFacto...
python
chosen
[ { "from": "system", "value": "Tidy up test imports a bit\n" }, { "from": "human", "value": "import mock\nimport pytest\n\nfrom flask.ext.wtf import Form\nfrom wtforms.fields.core import Field\nfrom wtforms.validators import StopValidation\n\nfrom app.main.forms import AdminEmailAddressValidator\...
python
chosen
[ { "from": "system", "value": "Add default BUFFER_SIZE for feeds\n" }, { "from": "human", "value": "# -*- coding: utf-8 -*-\n\nclass Strategy(object):\n TIMEFRAMES = [] # e.g. ['M30', 'H2']\n\n def __init__(self, instrument):\n self.instrument = instrument\n if not self.TIMEF...
python
chosen
[ { "from": "system", "value": "Add tests for dumping string and unicode values\n" }, { "from": "human", "value": "import redisdl\nimport unittest\nimport json\nimport os.path\n\nclass RedisdlTest(unittest.TestCase):\n def setUp(self):\n import redis\n self.r = redis.Redis()\n ...
python
chosen
[ { "from": "system", "value": "Fix nosetests for config file loading\n" }, { "from": "human", "value": "import json\nimport sys\n\n\ndef load_config_file(out=sys.stdout):\n default_filepath = \"../resources/config/default-config.json\"\n user_filepath = \"../resources/config/user-config.jso...
python
chosen
[ { "from": "system", "value": "Add test fot shape of result of accuracy function\n" }, { "from": "human", "value": "import unittest\n\nimport numpy\nimport six\n\nimport chainer\nfrom chainer import cuda\nfrom chainer import gradient_check\nfrom chainer.testing import attr\n\n\nif cuda.available:...
python
chosen
[ { "from": "system", "value": "Update to use new gate api\n" }, { "from": "human", "value": "\"\"\"Constant variables for Spinnaker IAM Pipe.\"\"\"\nAPI_URL = 'http://spinnaker.build.example.com:8084'\n" }, { "from": "gpt", "value": "\"\"\"Constant variables for Spinnaker IAM Pipe.\"\...
python
chosen
[ { "from": "system", "value": "Remove year from file copyright\n" }, { "from": "human", "value": "#!/usr/bin/env python\n# -*- coding: utf-8 -*-\n\n###############################################################################\n# Copyright 2015 Kitware Inc.\n#\n# Licensed under the Apache Lice...
python
chosen
[ { "from": "system", "value": "Enable ALA import by month or year\n" }, { "from": "human", "value": "import logging\nfrom django.core.management.base import BaseCommand\nfrom apps.processing.ala.util import util\nfrom dateutil.parser import parse\nfrom datetime import date, timedelta\n\nlogger = ...
python
chosen
[ { "from": "system", "value": "[Add] Add get and merge method.\nAdd Main Function to use class.\n" }, { "from": "human", "value": "class defaultDict(dict):\n def __init__(self, default=None):\n dict.__init__(self)\n self.default = default\n\n def __getitem__(self, key):\n ...
python
chosen
[ { "from": "system", "value": "Allow for the case when a header isn't needed\n" }, { "from": "human", "value": "# Licensed under an MIT open source license - see LICENSE\n\nfrom astropy.io.fits import PrimaryHDU\nfrom spectral_cube import SpectralCube\nfrom spectral_cube.lower_dimensional_structu...
python
chosen