conversations
listlengths
2
3
source
stringclasses
1 value
stack
stringclasses
1 value
[ { "from": "system", "value": "Use current user for tests\n" }, { "from": "human", "value": "from .settings import * # noqa\n\nDEBUG = True\nTEMPLATE_DEBUG = True\n\nDATABASES = {\n 'default': {\n 'ENGINE': 'django.db.backends.sqlite3',\n 'NAME': 'db.sqlite',\n },\n 'volat...
python
chosen
[ { "from": "system", "value": "Replace double quotes with single quotes as requested\n" }, { "from": "human", "value": "from django.db import models\n\nfrom django_countries.fields import CountryField\nfrom model_utils.models import TimeStampedModel\n\nfrom .constants import JOB_COMPENSATION_CHOI...
python
chosen
[ { "from": "system", "value": "Remove all obsolete code and test only initial problem\n" }, { "from": "human", "value": "# coding: utf8\nfrom __future__ import unicode_literals\n\nimport gc\n\nfrom ...lang.en import English\n\n\ndef test_issue1506():\n nlp = English()\n\n def string_generat...
python
chosen
[ { "from": "system", "value": "Make sound generator use common\n\nSigned-off-by: Ian Macalinao <57a33a5496950fec8433e4dd83347673459dcdfc@giza.us>\n" }, { "from": "human", "value": "from wavebender import *\nimport sys\n\nstart = 10\nfinal = 200\n\nend_time= 10\n\ndef val(i):\n time = float(i) ...
python
chosen
[ { "from": "system", "value": "Add ImplicitClawSolver1D to base namespace\n" }, { "from": "human", "value": "# =====================================================================\n# Package: petclaw\n# File: __init__.py\n# Authors: Amal Alghamdi\n# David Ketches...
python
chosen
[ { "from": "system", "value": "Refactor class so the now time is always defined\n\nAdded code to class to run the setup method which assigns a variable to self.now (ie. defines a time for now)" }, { "from": "human", "value": "from django.core.management.base import BaseCommand\nfrom dateutil.rela...
python
chosen
[ { "from": "system", "value": "Add samovar as allowed host\n" }, { "from": "human", "value": "DEBUG = False\n\nALLOWED_HOSTS = ['xon.teichisma.info', 'portal.exe.pub']\n" }, { "from": "gpt", "value": "DEBUG = False\n\nALLOWED_HOSTS = ['xon.teichisma.info', 'portal.exe.pub', 'samovar.t...
python
chosen
[ { "from": "system", "value": "Remove unnecessary attrs 'name' in title\n" }, { "from": "human", "value": "from django import forms\nfrom django.forms.utils import ErrorList\nfrom django_summernote.widgets import SummernoteWidget\n\nfrom .models import Post\n\nEMPTY_TITLE_ERROR = \"제목을 입력하세요\"\nE...
python
chosen
[ { "from": "system", "value": "Add BaseMesh to the init file.\n" }, { "from": "human", "value": "from TensorMesh import TensorMesh\nfrom CylMesh import CylMesh\nfrom Cyl1DMesh import Cyl1DMesh\nfrom LogicallyRectMesh import LogicallyRectMesh\nfrom TreeMesh import TreeMesh\n" }, { "from": ...
python
chosen
[ { "from": "system", "value": "Test fix for exit handler\n\nPiperOrigin-RevId: 436937697\n" }, { "from": "human", "value": "# Copyright 2021 Google LLC. All Rights Reserved.\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may not use this file except in compliance w...
python
chosen
[ { "from": "system", "value": "Allow specific migrations to be run\n" }, { "from": "human", "value": "\"\"\"\nRun all migrations\n\"\"\"\nimport imp\nimport os\nimport sys\nimport pymongo\nfrom os.path import join\nimport logging\nfrom backdrop.core.database import Database\n\nlogging.basicConfig...
python
chosen
[ { "from": "system", "value": "Update test harness to use new REST API path for OpenShift.\n" }, { "from": "human", "value": "from pytest import fixture, mark\n\nfrom ..openshift import OpenShiftOAuthenticator\n\nfrom .mocks import setup_oauth_mock\n\n\ndef user_model(username):\n \"\"\"Return...
python
chosen
[ { "from": "system", "value": "fix: Return useful data from App creation\n" }, { "from": "human", "value": "\"\"\"AWS Spinnaker Application.\"\"\"\nfrom pprint import pformat\n\nfrom foremast.app import base\nfrom foremast.utils import wait_for_task\n\n\nclass SpinnakerApp(base.BaseApp):\n \"\...
python
chosen
[ { "from": "system", "value": "Fix test data for PyArgumentListInspectionTest.testDictFromKeys.\n" }, { "from": "human", "value": "print(dict.fromkeys(<warning descr=\"Parameter 'seq' unfilled\">)</warning>)\nprint(dict.fromkeys(['foo', 'bar']))\n" }, { "from": "gpt", "value": "print(...
python
chosen
[ { "from": "system", "value": "Refactor and add playback funcs.\n" }, { "from": "human", "value": "\"\"\"Container classes for VLC under GTK\"\"\"\nimport gtk\nimport sys\n\n\n# pylint: disable-msg=R0904\nclass VLCSlave(gtk.DrawingArea):\n \"\"\"VLCSlave provides a playback window with an unde...
python
chosen
[ { "from": "system", "value": "Update dict instead of doc\n" }, { "from": "human", "value": "from __future__ import absolute_import\nfrom __future__ import unicode_literals\nfrom corehq.util.log import with_progress_bar\nfrom corehq.util.couch import iter_update, DocUpdate\nfrom django.core.manag...
python
chosen
[ { "from": "system", "value": "Add new fields to label document\n\n- Make default default value False\n" }, { "from": "human", "value": "#!/usr/bin/env python3\n\"\"\"Document models for mongoengine\"\"\"\nfrom mongoengine import *\nfrom bson import ObjectId\n\n\nclass Label(Document):\n \"\"\...
python
chosen
[ { "from": "system", "value": "Add support for varnish backend secret and pass a domain when it's defined in settings\n" }, { "from": "human", "value": "import varnish\nimport logging\nfrom django.conf import settings\n\n#STUB config options here\nVARNISH_HOST = settings.VARNISH_HOST\nVARNISH_POR...
python
chosen
[ { "from": "system", "value": "Fix Duration.__str__ to show Conference name and code\n" }, { "from": "human", "value": "from django.core.validators import MinValueValidator\nfrom django.db import models\nfrom django.utils.translation import ugettext_lazy as _\n\n\nclass Duration(models.Model):\n ...
python
chosen
[ { "from": "system", "value": "Add test for non-registered user\n" }, { "from": "human", "value": "import unittest\n\nfrom api.test import BaseTestCase\n\n\nclass TestLogin(BaseTestCase):\n\n @unittest.skip(\"\")\n def test_login(self):\n login_credentials = {\n \"password...
python
chosen
[ { "from": "system", "value": "Set the payout status to created BEFORE we call out to dorado. This way\nwe do not override that status that dorado set.\n\nBB-9471 #resolve\n" }, { "from": "human", "value": "import json\nimport requests\n\nfrom django.core.exceptions import ImproperlyConfigured\nf...
python
chosen
[ { "from": "system", "value": "Add another test case - add multiple words\n" }, { "from": "human", "value": "import nose\nfrom lib.wordfilter import Wordfilter\n\n# Run with `python -m test.wordfilter_test`\nclass Wordfilter_test:\n def setup(self):\n self.wordfilter = Wordfilter()\n\n def t...
python
chosen
[ { "from": "system", "value": "Remove cytoolz usage in CLI\n" }, { "from": "human", "value": "# coding: utf8\nfrom __future__ import unicode_literals\n\nimport cytoolz\n\nfrom ...gold import iob_to_biluo\n\n\ndef iob2json(input_data, n_sents=10, *args, **kwargs):\n \"\"\"\n Convert IOB file...
python
chosen
[ { "from": "system", "value": "PSv2: Fix asan test for various targets.\n\nPiperOrigin-RevId: 325441069\nChange-Id: I1fa1b2b10670f34739323292eab623d5b538142e\n" }, { "from": "human", "value": "# Copyright 2017 The TensorFlow Authors. All Rights Reserved.\n#\n# Licensed under the Apache License, V...
python
chosen
[ { "from": "system", "value": "Add feedback during county loader\n" }, { "from": "human", "value": "# -*- coding: utf-8 -*-\nfrom __future__ import absolute_import, unicode_literals\n\nimport csv\nimport os\n\nfrom django.conf import settings\nfrom django.core.management.base import BaseCommand\n...
python
chosen
[ { "from": "system", "value": "Make sure current dynamic_choices module has priority over possible installed one for tests.\n" }, { "from": "human", "value": "#!/usr/bin/env python\nfrom django.core.management import execute_manager\ntry:\n import settings # Assumed to be in the same directory...
python
chosen
[ { "from": "system", "value": "Make progress bar visible by default.\n" }, { "from": "human", "value": "from __future__ import print_function, absolute_import, division, unicode_literals\n\nfrom ..libs import *\nfrom .base import Widget\n\n\nclass ProgressBar(Widget):\n def __init__(self, max=...
python
chosen
[ { "from": "system", "value": "Make sure the verbosity stuff actually works\n" }, { "from": "human", "value": "from daisyproducer.dictionary.brailleTables import writeWhiteListTables, writeLocalTables\nfrom daisyproducer.dictionary.models import Word\nfrom daisyproducer.documents.models import Do...
python
chosen
[ { "from": "system", "value": "Fix issue in get_app_dir() test which is caused by platfrom-dependent problem\n" }, { "from": "human", "value": "# -*- coding: utf-8 -*-\nfrom __future__ import absolute_import, division, print_function, unicode_literals\n\nimport os\nfrom ava.util import time_uuid,...
python
chosen
[ { "from": "system", "value": "Replace \"<platform>\" with \"-p <platform>\" in CIS wwise command.\n\nThis is what the Buildbot configuration uses, and it makes sense. It\nused to not break because we were ignoring unknown commandline flags.\n" }, { "from": "human", "value": "# -*- coding: utf-8 ...
python
chosen
[ { "from": "system", "value": "Add entry detail HTTP endpoint\n" }, { "from": "human", "value": "from flask import Flask, jsonify, request\nfrom .chain import DocumentChain\nfrom .storage import DiskStorage\n\napp = Flask(__name__)\nchain = DocumentChain(DiskStorage('data/'))\n\n@app.route('/entr...
python
chosen
[ { "from": "system", "value": "Set max threads for MKL.\n" }, { "from": "human", "value": "import logging, gensim, bz2\nfrom knub.thesis.util.memory import limit_memory\n\nlogging.basicConfig(format='%(asctime)s : %(levelname)s : %(message)s', level=logging.INFO)\n\ndef main():\n logging.info(...
python
chosen
[ { "from": "system", "value": "Add polling_district_id in Sheffield import script\n" }, { "from": "human", "value": "\"\"\"\nImport Sheffield\n\"\"\"\nfrom data_collection.management.commands import BaseShpShpImporter\n\nclass Command(BaseShpShpImporter):\n \"\"\"\n Imports the Polling Stat...
python
chosen
[ { "from": "system", "value": "Revert \"Bump up to 0.5.3\"\n\nThis reverts commit bc8e02970ee80a6cd0a57f4fe1553cc8faf092dc.\n" }, { "from": "human", "value": "\"\"\":mod:`settei.version` --- Version data\n~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\n\n.. versionadded:: 0.2.0\n\n\"\"\"\n\n#: (:class...
python
chosen
[ { "from": "system", "value": "Make 35 use number_to_list and inverse\n" }, { "from": "human", "value": "from typing import List\n\n\nfrom ..library.sqrt import fsqrt\nfrom ..library.number_theory.primes import is_prime, prime_sieve\n\n\ndef is_circular_prime(n: int, sieve: List[int]) -> bool:\n ...
python
chosen
[ { "from": "system", "value": "Add social events to 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_evals/')\...
python
chosen
[ { "from": "system", "value": "Check if relation objects are class of SerializeMixin\n" }, { "from": "human", "value": "from collections.abc import Iterable\n\nfrom .inspection import InspectionMixin\n\n\nclass SerializeMixin(InspectionMixin):\n \"\"\"Mixin to make model serializable.\"\"\"\n\...
python
chosen
[ { "from": "system", "value": "Test that returned result is a str instance\n" }, { "from": "human", "value": "#!/usr/bin/env python\n\n# Copyright 2020 The StackStorm Authors.\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may not use this file except in compliance...
python
chosen
[ { "from": "system", "value": "Patch up version for direct running of code in repo.\n" }, { "from": "human", "value": "__author__ = 'Peter Brittain'\n\nfrom .version import version\n__version__ = version\n" }, { "from": "gpt", "value": "__author__ = 'Peter Brittain'\n\ntry:\n from ...
python
chosen
[ { "from": "system", "value": "Fix error handling to show error messages\n\nWe removed this during a refactor, but it means we get very generic\nmessages in the UI instead of the actual error string.\n" }, { "from": "human", "value": "\"\"\"Helpers for capturing requests exceptions.\"\"\"\n\nfrom...
python
chosen
[ { "from": "system", "value": "Increase timeout in TabConsoleTest.testConsoleOutputStream twice.\n\nOn machines with low performance this test can fail by timeout.\nIncreasing timeout improves stability of this unittest passing.\n\nChange-Id: I83a97022bbf96a4aaca349211ae7cfb9d19359b1\nReviewed-on: https://ch...
python
chosen
[ { "from": "system", "value": "Remove 'stock' field from template products\n" }, { "from": "human", "value": "from django.db import models\nfrom wagtail.wagtailcore.fields import RichTextField\nfrom longclaw.longclawproducts.models import ProductVariantBase\n\nclass ProductVariant(ProductVariantB...
python
chosen
[ { "from": "system", "value": "Refactor introduction to make it the same as the other tests\n" }, { "from": "human", "value": "\"\"\"\"\nIntroduction Adventure\n\nAuthor: Ignacio Avas (iavas@sophilabs.com)\n\"\"\"\nimport codecs\nimport io\nimport sys\nimport unittest\nfrom story.adventures impor...
python
chosen
[ { "from": "system", "value": "Create regexp to match at least some last lines\n" }, { "from": "human", "value": "def get_users_at(timestamp, last_output=None, now=None):\n \"\"\"\n Return a set of strings corresponding to which users were logged in from\n which addresses at a given time...
python
chosen
[ { "from": "system", "value": "Add own locale directory to LOCALE_PATHS" }, { "from": "human", "value": "# -*- coding: utf-8 -*-\nfrom froide.settings import Base, ThemeBase, HerokuPostmark, HerokuPostmarkS3 # noqa\n\n\nclass CustomThemeBase(ThemeBase):\n FROIDE_THEME = 'froide_theme.theme'\n...
python
chosen
[ { "from": "system", "value": "Fix object access on None" }, { "from": "human", "value": "from haystack.fields import NgramField\n\n\ntry:\n from .elasticsearch import SuggestField\nexcept ImportError:\n class SuggestField(NgramField):\n pass\n\n\nclass SearchQuerySetWrapper(object):...
python
chosen
[ { "from": "system", "value": "Add input_pattern instead of min_pattern_length\n\nSigned-off-by: Koichi Shiraishi <13fbd79c3d390e5d6585a21e11ff5ec1970cff0c@zchee.io>\n" }, { "from": "human", "value": "import deoplete.util\n\nfrom .base import Base\n\nclass Source(Base):\n def __init__(self, vi...
python
chosen
[ { "from": "system", "value": "Change env variables for node setup to single URI varieable\n" }, { "from": "human", "value": "from django.conf import settings\n\nfrom web3 import HTTPProvider, Web3\nfrom web3.middleware import geth_poa_middleware\n\nfrom .utils import Singleton\n\n\nclass Web3Ser...
python
chosen
[ { "from": "system", "value": "[FIX] medical_medicament_us: Add missing dependency\n* medical.medicament.ndc relates to medical.manufacturer, which does not exist without it defined as a dependency.\n" }, { "from": "human", "value": "# -*- coding: utf-8 -*-\n# © 2016 LasLabs Inc.\n# License AGPL-...
python
chosen
[ { "from": "system", "value": "Update TestGenerateApexDocs regex to fix windows test\n\nThis commit updates the test regex to match either windows or unix file\nseparators.\n\nThe command generated on Windows:\n java -jar c:\\users\\ieuser\\appdata\\local\\temp\\tmp9splyd\\apexdoc.jar -s \\Users\\IEUser\\...
python
chosen
[ { "from": "system", "value": "gst1: Send in an argument to Gst.init\n\nAs of gst-python 1.5.2, the init call requires one argument. The\nargument is a list of the command line options. I don't think we need to\nsend any.\n\nThis relates to #1432.\n" }, { "from": "human", "value": "from __future_...
python
chosen
[ { "from": "system", "value": "Add Experiment to the init file of speech module\n" }, { "from": "human", "value": "\"\"\"\nThe :mod:`pambox.speech` module gather speech intelligibility\nmodels.\n\"\"\"\nfrom __future__ import absolute_import\n\nfrom .sepsm import Sepsm\nfrom .mrsepsm import MrSep...
python
chosen
[ { "from": "system", "value": "Make sure that there's a dot separating the first and second halves of the secret.\n" }, { "from": "human", "value": "# THIRD PARTY\nfrom djangae.fields import CharField\nfrom django.db import models\n\n\nclass Secret(models.Model):\n created = models.DateTimeFie...
python
chosen
[ { "from": "system", "value": "Remove useless imports from flask alchemy demo\n" }, { "from": "human", "value": "import os\nimport unittest\nimport tempfile\n\nimport demoapp\nimport demoapp_factories\n\nclass DemoAppTestCase(unittest.TestCase):\n\n def setUp(self):\n demoapp.app.config...
python
chosen
[ { "from": "system", "value": "feat: Update deploy and stage with new environ" }, { "from": "human", "value": "from subprocess import check_call\n\nfrom blackbelt.handle_github import get_current_branch\nfrom blackbelt.messages import post_message\n\n\ndef deploy_staging():\n branch_name = get...
python
chosen
[ { "from": "system", "value": "Remove y-axis ticks and top x-axis ticks\n" }, { "from": "human", "value": "import matplotlib.pyplot as plt\nimport numpy as np\n\n\ndef horizontal_bar(sorted_streaks, sort):\n \"\"\"\n Render a horizontal bar chart of streaks.\n\n Values have already been ...
python
chosen
[ { "from": "system", "value": "Add a new exception since we are making a directory now.\n" }, { "from": "human", "value": "class InvalidPidFileError(Exception):\n \"\"\" An exception when an invalid PID file is read.\"\"\"\n\nclass PidFileExistsError(Exception):\n \"\"\" An exception when a...
python
chosen
[ { "from": "system", "value": "Disable weave tests that cause compilation failure, since this causes\ndistutils to do a SystemExit, which break the test suite.\n\ngit-svn-id: 003f22d385e25de9cff933a5ea4efd77cb5e7b28@5402 d6536bca-fef9-0310-8506-e4c0a848fbcf\n" }, { "from": "human", "value": "from...
python
chosen
[ { "from": "system", "value": "Add TODO on how to make a better libspotify lookup\n" }, { "from": "human", "value": "import logging\nimport multiprocessing\n\nfrom spotify import Link\n\nfrom mopidy.backends.base import BaseLibraryController\nfrom mopidy.backends.libspotify import ENCODING\nfrom ...
python
chosen
[ { "from": "system", "value": "Remove BinaryWriter dependency on MessageContainer\n" }, { "from": "human", "value": "from . import TLObject, GzipPacked\nfrom ..extensions import BinaryWriter\n\n\nclass MessageContainer(TLObject):\n constructor_id = 0x73f1f8dc\n\n def __init__(self, messages...
python
chosen
[ { "from": "system", "value": "Revert \"[Timeout] Fix an assert\"\n\nThis reverts commit 05f0fb77716297114043d52de3764289a1926752.\n" }, { "from": "human", "value": "import signal\n\n\nclass Timeout(Exception):\n \"\"\"Context manager which wraps code in a timeout.\n If the timeout is exceede...
python
chosen
[ { "from": "system", "value": "Use range instead of xrange as it is also available in python 3\n" }, { "from": "human", "value": "from __future__ import print_function\nimport io\nimport string\nimport random\n\nfrom boggle.boggle import list_words\n\n\ndef main():\n with io.open(\"/usr/share/...
python
chosen
[ { "from": "system", "value": "Create wrapper tag for SO html\n" }, { "from": "human", "value": "import os\nimport pickle as pkl\nfrom gso import load_up_answers, load_up_questions\n\n#for result in load_up_questions(\"How to write a bubble sort\", \"python\"):\n #print result\n #break\n\n#...
python
chosen
[ { "from": "system", "value": "Deploy script now checks to see if virtualenv has\nthe latest dependencies" }, { "from": "human", "value": "from __future__ import with_statement\n\nfrom fabric.api import local, cd, env, run\nfrom fabric.colors import green\n\nenv.use_ssh_config = True\nenv.user = ...
python
chosen
[ { "from": "system", "value": "Add shebang to main script and switch to Unix line endings\n" }, { "from": "human", "value": "import functools\r\nimport signal\r\nimport sys\r\nimport logging as log\r\n\r\nfrom firesimgui import FireSimGUI\r\nfrom lib.arguments import parse_args\r\n\r\ndef sig_han...
python
chosen
[ { "from": "system", "value": "Comment out the failing Plan test\n" }, { "from": "human", "value": "# -*- coding: utf-8 -*-\n# vim: ft=python:sw=4:ts=4:sts=4:et:\nimport json\n\nfrom silver.models import Plan\n\nfrom django.test.client import Client\nfrom django.test import TestCase\n\n\nclass Pl...
python
chosen
[ { "from": "system", "value": "Add description for `lib` package\n" }, { "from": "human", "value": "#-------------------------------------------------------------------------------\n#\n# This file is part of pygimplib.\n#\n# Copyright (C) 2014, 2015 khalim19 <khalim19@gmail.com>\n#\n# pygimplib i...
python
chosen
[ { "from": "system", "value": "Use a better method for silencing 'no handlers found' error\n" }, { "from": "human", "value": "import logging\n\n\ndef setUp():\n log = logging.getLogger('elasticsearch.trace')\n log.setLevel(logging.CRITICAL)\n" }, { "from": "gpt", "value": "impor...
python
chosen
[ { "from": "system", "value": "Update ptvsd version number for 2.2 beta.\n" }, { "from": "human", "value": "#!/usr/bin/env python\r\n\r\n#-------------------------------------------------------------------------\r\n# Copyright (c) Microsoft. All rights reserved.\r\n#\r\n# Licensed under the Apac...
python
chosen
[ { "from": "system", "value": "Use included carton executable on deploy\n" }, { "from": "human", "value": "from fabric.api import *\n\nenv.hosts = [\n 'shaperia@lynx.uberspace.de'\n]\n\nenv.target_directory = './happyman'\n\ndef init():\n run('git clone -q https://github.com/skyshaper/happy...
python
chosen
[ { "from": "system", "value": "Reduce the name of a function\n" }, { "from": "human", "value": "#!/usr/bin/env python\nimport rospy,copy\nfrom geometry_msgs.msg import Twist\nfrom std_srvs.srv import Trigger, TriggerResponse\nfrom pimouse_ros.msg import LightSensorValues\n\nclass WallStop():\n ...
python
chosen
[ { "from": "system", "value": "Allow 0-9 in song names.\n" }, { "from": "human", "value": "#!/usr/bin/env python2.7\n\nimport os\nimport re\nimport sys\nfrom mutagen.easyid3 import EasyID3\n\nreplaceChars = (\n (\" \", \"-\"),\n (\"(\", \"\"),\n (\")\", \"\"),\n (\",\", \"\"),\n (\".\", \"\"...
python
chosen
[ { "from": "system", "value": "Add test validating key format validation\n" }, { "from": "human", "value": "import requests\n\ndef register_asheesh():\n return requests.post(\n 'http://localhost:3000/register',\n {'rawHostname': 'asheesh',\n 'email': 'asheesh@asheesh.org'...
python
chosen
[ { "from": "system", "value": "Add default NFSN test url\n" }, { "from": "human", "value": "# Test for one implementation of the interface\nfrom lexicon.providers.nfsn import Provider\nfrom integration_tests import IntegrationTests\nfrom unittest import TestCase\nimport pytest\n\nimport os\n\n\"\...
python
chosen
[ { "from": "system", "value": "Fix docstring, remove unused import\n" }, { "from": "human", "value": "# -*- coding: utf-8 -*-\n\"\"\"Factory boy factories for the Box addon.\"\"\"\nimport mock\nfrom datetime import datetime\nfrom dateutil.relativedelta import relativedelta\n\nfrom factory import ...
python
chosen
[ { "from": "system", "value": "Add test for funicular feature\n" }, { "from": "human", "value": "# way 93671417\nassert_has_feature(\n 16, 10486, 25367, 'transit',\n { 'kind': 'monorail' })\n" }, { "from": "gpt", "value": "# way 93671417\nassert_has_feature(\n 16, 10486, 2536...
python
chosen
[ { "from": "system", "value": "Speed up results API view\n" }, { "from": "human", "value": "from rest_framework import viewsets\nfrom django_filters import filters, filterset\n\nfrom api.v09.views import ResultsSetPagination\n\nfrom ..models import CandidateResult, ResultSet\nfrom ..serializers i...
python
chosen
[ { "from": "system", "value": "Fix svc_monitor tests by adding a missing arg\n\nThis commit d318b73fbab8f0c200c71adf642968a624a7db29\nintroduced a cluster_id arg but this arg is not\ninitialized in the test file.\n\nChange-Id: I770e5f2c949afd408b8906439e711e7f619afa57\n" }, { "from": "human", "va...
python
chosen
[ { "from": "system", "value": "Add specific iterable-like pickling handler for sb5b tweet data\n" }, { "from": "human", "value": "#!/usr/bin/env python\nimport os\nfrom tsa.lib import tabular, html\n\nxlsx_filepath = '%s/ohio/sb5-b.xlsx' % os.getenv('CORPORA', '.')\nlabel_keys = ['For', 'Against'...
python
chosen
[ { "from": "system", "value": "Test settings when setup.py test is run.\n" }, { "from": "human", "value": "import os\nimport unittest\n\n\ndef suite():\n test_dir = os.path.dirname(__file__)\n return unittest.TestLoader().discover(test_dir, )\n\ntest_suite = suite()\n\n\nif __name__ == '__m...
python
chosen
[ { "from": "system", "value": "Complete naive longest palindromic substring\n" }, { "from": "human", "value": "\"\"\"Leetcode 5. Longest Palindromic Substring\nMedium\n\nGiven a string s, find the longest palindromic substring in s. \nYou may assume that the maximum length of s is 1000.\n\nExampl...
python
chosen
[ { "from": "system", "value": "Fix a python3 import .\n" }, { "from": "human", "value": "import urllib\nimport datetime\nimport multiprocessing\n\nfrom django.conf import settings\nfrom django.core.urlresolvers import reverse\nfrom django.contrib.sites.models import Site\nfrom django.core.managem...
python
chosen
[ { "from": "system", "value": "Clean up content and header output\n" }, { "from": "human", "value": "#!/usr/bin/env python\n\nimport BaseHTTPServer\n\nServerClass = BaseHTTPServer.HTTPServer\nRequestHandlerClass = BaseHTTPServer.BaseHTTPRequestHandler\n\nSERVER_NAME = ''\nSERVER_PORT = 9000\n\ncl...
python
chosen
[ { "from": "system", "value": "Add debug page that tells id\n" }, { "from": "human", "value": "import random\n\nfrom flask import render_template, session, request\n\nfrom app import app\nimport config\nfrom app import request_logger\nfrom app import questions\n\n@app.route('/', methods=['GET', '...
python
chosen
[ { "from": "system", "value": "Return coverage data in CoverageCommand::coverage()\n" }, { "from": "human", "value": "import sublime_plugin\nfrom php_coverage.finder import CoverageFinder\n\n\nclass CoverageCommand(sublime_plugin.TextCommand):\n\n \"\"\"\n Base class for a text command whic...
python
chosen
[ { "from": "system", "value": "Add test for full processing pipeline.\n" }, { "from": "human", "value": "# encoding: utf-8\n\nimport time\n\nfrom web.core.context import Context\nfrom web.ext.analytics import AnalyticsExtension\n\n\ndef test_analytics_extension():\n\tctx = Context(response=Contex...
python
chosen
[ { "from": "system", "value": "Change method of search for utils setup_file\n" }, { "from": "human", "value": "# Standard library imports\nimport json\n\n# Our setup file\nwith open('../../pixie/setup.json') as file:\n setup_file = json.load(file)\n\n# Our user agent\nuser_agent = \"Pixie (htt...
python
chosen
[ { "from": "system", "value": "Add rating field to User model\n" }, { "from": "human", "value": "import datetime\n\nfrom project import db, bcrypt\n\n\nclass User(db.Model):\n\n __tablename__ = \"users\"\n\n id = db.Column(db.Integer, primary_key=True)\n email = db.Column(db.String, uniq...
python
chosen
[ { "from": "system", "value": "Improve clarity of fake assetstore model fixture\n" }, { "from": "human", "value": "import pytest\nfrom girder.models.file import File\nfrom girder.models.model_base import Model\nfrom girder.utility import assetstore_utilities\nfrom girder.utility.model_importer im...
python
chosen
[ { "from": "system", "value": "Add Raid to the API.\n" }, { "from": "human", "value": "# -*- coding: utf-8 -*-\nfrom rest_framework import serializers\n\nfrom apps.broadcasts.models import Broadcast, Series\nfrom apps.games.models import Game\n\n\nclass BroadcastSerializer(serializers.ModelSerial...
python
chosen
[ { "from": "system", "value": "Add more detailed print in first module\n" }, { "from": "human", "value": "from jtapi import *\nimport os\nimport sys\nimport re\nimport numpy as np\nfrom scipy import misc\n\n\nmfilename = re.search('(.*).py', os.path.basename(__file__)).group(1)\n\n#########\n# in...
python
chosen
[ { "from": "system", "value": "Convert Redis keys and values to str\n" }, { "from": "human", "value": "import time\n\nimport redis\n\n\ndef connect_to_redis(*args, **kwargs):\n client = redis.Redis(*args, unix_socket_path='redis/redis.sock', **kwargs)\n\n while True:\n try:\n ...
python
chosen
[ { "from": "system", "value": "Add missing 'logging' module import\n" }, { "from": "human", "value": "import requests\n\n\ndef input_file(filename):\n \"\"\"\n Read a file and return list of usernames.\n\n Assumes one username per line and ignores blank lines.\n \"\"\"\n with open(...
python
chosen
[ { "from": "system", "value": "Use DjangoJSONEncoder for JSON serialization\n" }, { "from": "human", "value": "# coding: utf-8\nimport logging\nfrom socket import gethostname\n\nfrom .compat import json, text_type\n\n\nclass JSONFormatter(logging.Formatter):\n \"\"\"\n Formatter to convert ...
python
chosen
[ { "from": "system", "value": "Handle signals for daemon processes, removed deprecated python var sub\n" }, { "from": "human", "value": "#!/usr/bin/python\n\nimport sys\nfrom url_cleaner import removeBlackListedParameters\n\n\nwhile True:\n line = sys.stdin.readline().strip()\n urlList = li...
python
chosen
[ { "from": "system", "value": "Test the only untested line\n" }, { "from": "human", "value": "from json import loads\nfrom os import close, unlink\nfrom tempfile import mkstemp\nfrom unittest import TestCase\nfrom cunhajacaiu import app\n\n\nclass FlaskTestCase(TestCase):\n\n def setUp(self):\...
python
chosen
[ { "from": "system", "value": "Add logging of tested package version\n" }, { "from": "human", "value": "#!/usr/bin/env python\n# encoding: utf8\nfrom __future__ import (absolute_import, print_function, division, unicode_literals)\n\n# REV - This has no effect - http://stackoverflow.com/q/18558666...
python
chosen
[ { "from": "system", "value": "Add entity link to basic crud tests\n" }, { "from": "human", "value": "from . import uuid\n\n\ndef task_crud(self, shotgun, trigger_poll=lambda: None):\n\n name = uuid(8)\n a = shotgun.create('Task', {'content': name})\n trigger_poll()\n b = self.cached....
python
chosen
[ { "from": "system", "value": "Fix support for older gevent versions.\n\nGevent 1.5 removed the `gevent.signal` alias, but some older versions\ndo not have the new `signal_handler` function.\n" }, { "from": "human", "value": "import os\nimport signal\nimport sys\n\nimport click\nimport gevent\n\n...
python
chosen
[ { "from": "system", "value": "Use 'rb' mode explicitly in file_md5sum and allow for custom encoding\n" }, { "from": "human", "value": "# -*- coding: utf-8 -*-\n\"\"\"\n pytest_pipeline.utils\n ~~~~~~~~~~~~~~~~~~~~~\n\n General utilities.\n\n :copyright: (c) 2014 Wibowo Arindrarto <bo...
python
chosen