conversations
listlengths
2
3
source
stringclasses
1 value
stack
stringclasses
1 value
[ { "from": "system", "value": "Add full body text to RSS" }, { "from": "human", "value": "from django.contrib.syndication.views import Feed\n\nfrom .models import Post\nfrom .settings import (\n SYNDICATION_FEED_TITLE, SYNDICATION_FEED_LINK,\n SYNDICATION_FEED_DESCRIPTION, SYNDICATION_FEED_...
python
chosen
[ { "from": "system", "value": "Fix calling \"display\" method multiple times\n" }, { "from": "human", "value": "from ipywidgets import DOMWidget\nfrom IPython.display import display\nfrom traitlets import Unicode, Bytes, Dict\nfrom .objects import Objects\nfrom .factory import Factory\nimport bas...
python
chosen
[ { "from": "system", "value": "Make invoke() actually invoke the coroutine.\n" }, { "from": "human", "value": "\"\"\"\nModule for Kyokai routes.\n\"\"\"\nimport re\n\n\nclass Route(object):\n \"\"\"\n A route is simply a wrapped coroutine object for a request.\n\n It takes in a regular e...
python
chosen
[ { "from": "system", "value": "Add a stable url for the current API version\n" }, { "from": "human", "value": "\"\"\"\nCopyright [2009-2014] EMBL-European Bioinformatics Institute\nLicensed under the Apache License, Version 2.0 (the \"License\");\nyou may not use this file except in compliance wi...
python
chosen
[ { "from": "system", "value": "Add a basic test for models.\n" }, { "from": "human", "value": "from unittest import TestCase\n\nfrom ..models import Tunnel\n" }, { "from": "gpt", "value": "from unittest import TestCase\n\nfrom ..models import Tunnel\n\n\nclass TestModels(TestCase):\n ...
python
chosen
[ { "from": "system", "value": "Add option to enable self updating\n\nThis is a customization option for more flexibility.\nIf you want to autoupdate, then you can give a -u option.\nIf not - don't.\n" }, { "from": "human", "value": "import argparse\n\nfrom settings import HONEYPORT\n\n\"\"\"\nHer...
python
chosen
[ { "from": "system", "value": "Fix my coil version check\n" }, { "from": "human", "value": "# Copyright 2008-2009 ITA Software, Inc.\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...
python
chosen
[ { "from": "system", "value": "Fix priority of link postprocessor\n\nFixes #424\n" }, { "from": "human", "value": "import re\n\nfrom flask import request\nfrom markdown import Markdown\nfrom markdown.extensions import Extension\nfrom markdown.postprocessors import Postprocessor\n\n\ndef absolute_...
python
chosen
[ { "from": "system", "value": "Remove another reference to filter\n" }, { "from": "human", "value": "from functools import partial\n\n\nclass Library:\n '''\n Container for registering tags and filters\n '''\n def __init__(self):\n self.tags = {}\n self.filters = {}\n ...
python
chosen
[ { "from": "system", "value": "Adjust history capability for \"Dark Legacy\"\n" }, { "from": "human", "value": "from comics.aggregator.crawler import CrawlerBase, CrawlerImage\nfrom comics.core.comic_data import ComicDataBase\n\n\nclass ComicData(ComicDataBase):\n name = \"Dark Legacy\"\n l...
python
chosen
[ { "from": "system", "value": "Update name of rabbit queue\n" }, { "from": "human", "value": "# Licensed to the StackStorm, Inc ('StackStorm') under one or more\n# contributor license agreements. See the NOTICE file distributed with\n# this work for additional information regarding copyright own...
python
chosen
[ { "from": "system", "value": "Use 401 for CSRF failure. Always CSRF even in DEBUG\n" }, { "from": "human", "value": "# Oxypanel\n# File: util/csrf.py\n# Desc: csrf protection!\n\nfrom uuid import uuid4\n\nfrom flask import session, abort, request, Markup\n\nimport config\nfrom app import app\n\n...
python
chosen
[ { "from": "system", "value": "test: Change the info function name\n" }, { "from": "human", "value": "#!/usr/bin/env python3\n\nimport sys\nimport os\nimport unittest\n\nimport libaur.printer as printer\nimport libaur.aur as aur\n\nclass PrinterBadInput(unittest.TestCase):\n def test_string_in...
python
chosen
[ { "from": "system", "value": "Throw 500 error on multiple account in LocaleMiddleware so we can fix them.\n\ngit-svn-id: 51ba99f60490c2ee9ba726ccda75a38950f5105d@1120 45601e1e-1555-4799-bd40-45c8c71eef50\n" }, { "from": "human", "value": "from django.utils.cache import patch_vary_headers\nfrom d...
python
chosen
[ { "from": "system", "value": "FIX fix unit test by fixing import paths\n" }, { "from": "human", "value": "import unittest\n\nfrom autosklearn.pipeline.components.base import find_components, \\\n AutoSklearnClassificationAlgorithm\n\n\nclass TestBase(unittest.TestCase):\n\n def test_find_c...
python
chosen
[ { "from": "human", "value": "Set EVENTLET_NO_GREENDNS for IPv6 and dnspython compat\n\nIf dnspython is present it causes socket.getaddrinfo() to be\nmonkeypatched wiht code that does not work with IPv6. To get\naround this, the EVENTLET_NO_GREENDNS environment variable\nmust be set before importing eventlet...
python
chosen
[ { "from": "system", "value": "Fix assert for python 2.6 compatibility\n" }, { "from": "human", "value": "from __future__ import unicode_literals\n\nfrom unittest import TestCase\nfrom wtforms import TextField, validators\nfrom wtforms.ext.i18n.utils import get_translations\nfrom wtforms.ext.i18n...
python
chosen
[ { "from": "system", "value": "Add test for google feed\n" }, { "from": "human", "value": "from mock import patch\nimport logging\nimport congressbot\n\n\n@patch('congressbot.house_collection')\n@patch('congressbot.Reddit')\ndef test_feed_parse(reddit_mock, house_mock):\n house_mock.find_one.r...
python
chosen
[ { "from": "system", "value": "Fix error testing on python 2.7\n" }, { "from": "human", "value": "import os\nimport unittest\n\nimport transpiler\n\nclass TestTranspiler:\n\n def test_transpiler_creates_files_without_format(self):\n try:\n os.remove(\"/tmp/auto_functions.cpp\...
python
chosen
[ { "from": "system", "value": "Fix (parse|generate) table header label function\n" }, { "from": "human", "value": "def getTableColumnLabel(c):\n label = ''\n while True:\n label += 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'[c % 26]\n if c <= 26:\n break\n c = int(c/26)\n return label\n\ndef pa...
python
chosen
[ { "from": "system", "value": "Fix URL decoding (need to use urllib.unquote_plus).\n" }, { "from": "human", "value": "import urllib\n\ndef url_decode(string, encoding='utf8'):\n return urllib.unquote(string)\n\ndef url_encode(string, encoding='utf8'):\n return urllib.urlencode(string)\n" }, ...
python
chosen
[ { "from": "system", "value": "Fix plotter to use 'Agg'.\n" }, { "from": "human", "value": "import numpy as np\nfrom jug import TaskGenerator\nimport ezplot\n\n\n__all__ = ['plot_stack']\n\n\n@TaskGenerator\ndef plot_stack(stack_results, problems=None, policies=None, name=''):\n problems = pro...
python
chosen
[ { "from": "system", "value": "Add test function so tests can be run from within python terminal\n\nimport csympy\ncsympy.test()\n" }, { "from": "human", "value": "from .lib.csympy_wrapper import (Symbol, Integer, sympify, SympifyError, Add,\n Mul, Pow, sin, cos, sqrt, function_symbol, I)\...
python
chosen
[ { "from": "system", "value": "Return a list of strings for unittest results, not list of tuples\n\nThis is needed so the reporter can print a nicely formatted\ntraceback when the job is killed.\n" }, { "from": "human", "value": "from itertools import chain\nimport unittest\n\nfrom .test_runner i...
python
chosen
[ { "from": "system", "value": "Add parameter to choose journal date format\n\nThis allows for other journal date formats to be permissible, adding an optional date format parameter to the setting file." }, { "from": "human", "value": "import sublime, sublime_plugin\r\nimport os, string\r\nimport ...
python
chosen
[ { "from": "system", "value": "Revert \"Clean up a bit\"\n\nThis reverts commit 4500b571e2fd7a35cf722c3c9cc2fab7ea942cba.\n" }, { "from": "human", "value": "from django.core.management.base import BaseCommand\nfrom django.contrib.auth.models import User, Group\nfrom django.contrib import admin\n\...
python
chosen
[ { "from": "system", "value": "Remove not necessary code in Setting class\n" }, { "from": "human", "value": "\"\"\"\nThis class is used in kaggle competitions\n\"\"\"\n\nimport json\n\nclass Settings():\n train_path = None\n test_path = None\n model_path = None\n submission_path = Non...
python
chosen
[ { "from": "system", "value": "Return details from possible conception date\n" }, { "from": "human", "value": "from bottle import get, route\nimport redis\nimport json\nfrom datetime import datetime\n\nRED = redis.ConnectionPool(host='redis_01',port=6379,db=0)\n#RED = redis.ConnectionPool(host='t...
python
chosen
[ { "from": "system", "value": "Add whitespace in order to be PEP8 compliant\n" }, { "from": "human", "value": "import os\n\nfrom .bacman import BacMan\n\n\nclass MySQL(BacMan):\n \"\"\"Take a snapshot of a MySQL DB.\"\"\"\n\n filename_prefix = os.environ.get('BACMAN_PREFIX', 'mysqldump')\n\...
python
chosen
[ { "from": "system", "value": "Use Unipath for relative paths.\n" }, { "from": "human", "value": "from PySide import QtGui, QtCore, QtWebKit\n\n\nclass Preview(QtWebKit.QWebView):\n\tdef __init__(self, parent=None):\n\t\tsuper(Preview, self).__init__(parent)\n\t\tself.load(QtCore.QUrl.fromLocalFi...
python
chosen
[ { "from": "system", "value": "Make BasicGP kernel strings lowercase.\n" }, { "from": "human", "value": "\"\"\"\nSimple wrapper class for a Basic GP.\n\"\"\"\n\n# future imports\nfrom __future__ import division\nfrom __future__ import absolute_import\nfrom __future__ import print_function\n\n# gl...
python
chosen
[ { "from": "system", "value": "Replace initial D. and M. with similar-looking characters to get around archaic Twitter restriction.\n" }, { "from": "human", "value": "\"\"\"Twitter delivery mechanism for botfriend.\"\"\"\nfrom nose.tools import set_trace\nimport tweepy\nfrom bot import Publisher\...
python
chosen
[ { "from": "system", "value": "Make stub image url a real one\n" }, { "from": "human", "value": "from . import db\n\nclass Users(object):\n\n @classmethod\n def get_current(cls):\n return {\n 'data': {\n 'id': 1,\n 'type': 'user',\n ...
python
chosen
[ { "from": "system", "value": "Implement the cyclone request/response object\n" }, { "from": "human", "value": "# -*- coding: utf-8 -*-\nfrom __future__ import print_function, unicode_literals, division\nfrom armet import utils\nfrom armet.http import request, response\n\n\nclass Request(request....
python
chosen
[ { "from": "system", "value": "ADD CreateVMService at Device APP\n" }, { "from": "human", "value": "from syft.core.node.vm.vm import VirtualMachine\n\nnode = VirtualMachine(name=\"om-vm\")\n" }, { "from": "gpt", "value": "from syft.core.node.device.device import Device\nfrom syft.grid...
python
chosen
[ { "from": "system", "value": "Update of the google search code to be a command line program.\n" }, { "from": "human", "value": "#!/usr/bin/python\nimport json\nimport urllib\n\ndef showsome(searchfor):\n query = urllib.urlencode({'q': searchfor})\n url = 'http://ajax.googleapis.com/ajax/servic...
python
chosen
[ { "from": "system", "value": "Add in a way to start a shell using the results of a workflow\n" }, { "from": "human", "value": "\"\"\"\nGiven a config file, run a given workflow\n\"\"\"\n\nfrom percept.management.commands import BaseCommand\nfrom percept.utils.registry import registry, find_in_re...
python
chosen
[ { "from": "system", "value": "Add name property to exercise.\n" }, { "from": "human", "value": "class Exercise(object):\n\n name = None\n title = None\n\n def __init__(self, workshop):\n self.workshop = workshop\n\n def get_name(self):\n return self.name\n\n def get_...
python
chosen
[ { "from": "system", "value": "Use list of values and not subquery (less efficient but do not use limit)\n" }, { "from": "human", "value": "from django.core.management.base import BaseCommand, CommandError\nfrom api import models\nfrom django.db.models import Count, Q\n\nclass Command(BaseCommand...
python
chosen
[ { "from": "system", "value": "Correct typo in documentation of crop_corners" }, { "from": "human", "value": "import logging\n\n\nlogger = logging.getLogger(__name__)\n\n\ndef crop_corners(image, box=None, **kwargs):\n \"\"\"\n Crop corners to the selection defined by image_cropping\n\n ...
python
chosen
[ { "from": "system", "value": "Add functionality to establish connection with database, and disallow operation on said database if there is a problem with the connection\n" }, { "from": "human", "value": "# -*- coding: utf-8 -*-\nfrom flask import Flask\nfrom contextlib import closing\nimport os,...
python
chosen
[ { "from": "system", "value": "Modify crowdin_bot to only include languages that have >0 translations\n" }, { "from": "human", "value": "\"\"\"Script to print list of all crowdin language codes for project.\"\"\"\n\nfrom crowdin_bot import api\n\nNS_DICT = {\n 'ns': \"urn:oasis:names:tc:xliff:...
python
chosen
[ { "from": "system", "value": "Fix missing import in Client modified subscriber\n" }, { "from": "human", "value": "from Products.CMFCore.utils import getToolByName\n\ndef ObjectModifiedEventHandler(obj, event):\n \"\"\" Various types need automation on edit.\n \"\"\"\n if not hasattr(obj...
python
chosen
[ { "from": "system", "value": "Update tests with new default language\n" }, { "from": "human", "value": "\"\"\"\nRole tests\n\"\"\"\n\nfrom testinfra.utils.ansible_runner import AnsibleRunner\n\ntestinfra_hosts = AnsibleRunner('.molecule/ansible_inventory').get_hosts('all')\n\n\ndef test_packages...
python
chosen
[ { "from": "system", "value": "Use quiz index as user home temporarily\n" }, { "from": "human", "value": "from django.shortcuts import render\n\n\ndef index(request):\n if not request.user.is_authenticated():\n return render(request, 'account/index.html')\n\n else:\n return re...
python
chosen
[ { "from": "system", "value": "Simplify Eidos reader, use Eidos JSON String call\n" }, { "from": "human", "value": "from indra.java_vm import autoclass, JavaException\nfrom .scala_utils import get_python_json\n\nclass EidosReader(object):\n \"\"\"Reader object keeping an instance of the Eidos ...
python
chosen
[ { "from": "system", "value": "Fix regression introduced by updating taggit (27971d6eed)\n\ndjango-taggit 0.11+ introduced support for prefetch_related which breaks\nour taggit wrapping: alex/django-taggit@4f2e47f833\n" }, { "from": "human", "value": "\"\"\"\nThis abstracts some of the functional...
python
chosen
[ { "from": "system", "value": "Remove lingering reference to linked changelog.\n" }, { "from": "human", "value": "\"\"\"\nSetuptools is released using 'jaraco.packaging.release'. To make a release,\ninstall jaraco.packaging and run 'python -m jaraco.packaging.release'\n\"\"\"\n\nimport os\nimport...
python
chosen
[ { "from": "system", "value": "Make DataFrame available to module user\n" }, { "from": "human", "value": "#! /usr/bin/env python2.7\n\"\"\"Avoid some boilerplate rpy2 usage code with helpers.\n\nMostly I wrote this so that I can use xyplot without having\nto remember a lot of details.\n\n\"\"\"\n...
python
chosen
[ { "from": "system", "value": "Use store true in db creation script\n" }, { "from": "human", "value": "#!/usr/bin/env python3\nfrom database import db\nfrom database import bdb\nfrom database import bdb_refseq\nfrom import_data import import_data\nimport argparse\n\n\ndef restet_relational_db():\...
python
chosen
[ { "from": "system", "value": "Add default exploit to user migration.\n" }, { "from": "human", "value": "def migrate_user(self):\n \"\"\"\n Migrate to latest schema version.\n \"\"\"\n\n migrate_1_to_2(self)\n migrate_2_to_3(self)\n\ndef migrate_1_to_2(self):\n \"\"\"\n Migra...
python
chosen
[ { "from": "system", "value": "Add a scaffold for spiders to crawl annotations and images\n" }, { "from": "human", "value": "# This package will contain the spiders of your Scrapy project\n#\n# Please refer to the documentation for information on how to create and manage\n# your spiders.\n" }, ...
python
chosen
[ { "from": "system", "value": "Convert perms to a string\n" }, { "from": "human", "value": "from resource_management import *\nimport os\n\ndef create_hdfs_dir(path, owner, perms):\n Execute('hadoop fs -mkdir -p '+path, user='hdfs')\n Execute('hadoop fs -chown ' + owner + ' ' + path, user='hdfs...
python
chosen
[ { "from": "system", "value": "Document reason for previous change\n" }, { "from": "human", "value": "\"\"\"Network switch drivers for the HaaS.\n\nThis package provides HaaS drivers for various network switches. The\nfunctions in the top-level module should not be used; they only exist\nas a pla...
python
chosen
[ { "from": "system", "value": "Add temporary workaround for monkey-patching bug\n\npyuv_cffi needs to be imported BEFORE monkey-patching the standard library in\norder to successfully build the shared library. Need to find a workaround for\nthis. Once the library is built, subsequent imports will work fine e...
python
chosen
[ { "from": "system", "value": "Fix confidence filtering removed confidence=0 (False) items\n" }, { "from": "human", "value": "from app.readers import tsv as tsvreader\n\n\ndef filter_psms(psms, confkey, conflvl, lower_is_better):\n for psm in psms:\n if passes_filter(psm, conflvl, confk...
python
chosen
[ { "from": "system", "value": "Update IRCLevel and remove get_userlevels\n" }, { "from": "human", "value": "class IRCLevel:\n \"\"\" Enum class (Not really) for userlevels. \"\"\"\n user = 0\n voice = 1\n hop = 2\n op = 3\n aop = 4\n sop = 5\n\n\ndef get_userlevels(nick):\n ...
python
chosen
[ { "from": "system", "value": "Update codes for ldap wrapper so the username and password are passed to authenticate correctly.\n" }, { "from": "human", "value": "from django_auth_ldap.backend import LDAPBackend\n\n\nclass LDAPBackendWrapper(LDAPBackend):\n # def authenticate(self, identificat...
python
chosen
[ { "from": "system", "value": "Allow for minus signs in project slug.\n" }, { "from": "human", "value": "import re\n\n\nMODULE_REGEX = r\"^[_a-zA-Z][_a-zA-Z0-9]*$\"\nENVIRON_REGEX = r\"^[_a-zA-Z][_a-zA-Z0-9]*$\"\nPYTHONVERSION_REGEX = r\"^(3)\\.[6-9]$\"\n\nmodule_name = \"{{ cookiecutter.project_...
python
chosen
[ { "from": "system", "value": "Decrease splinter timeout to 3 seconds\n\n@alexmuller\n@maxfliri\n" }, { "from": "human", "value": "from pymongo import MongoClient\nfrom splinter import Browser\n\nfrom features.support.support import Api\n\n\nclass SplinterClient(object):\n\n def __init__(self,...
python
chosen
[ { "from": "system", "value": "Fix testing error when IPython not installed\n" }, { "from": "human", "value": "\"\"\"\nA print function that pretty prints SymPy objects.\n\n:moduleauthor: Brian Granger\n\nUsage\n=====\n\nTo use this extension, execute:\n\n %load_ext sympy.interactive.ipythonpr...
python
chosen
[ { "from": "system", "value": "Change field \"id\" to \"pk\" in order to not conflict with Python \"id\" keyword\n" }, { "from": "human", "value": "from app import db\n\n\nclass Base(db.Model):\n\n __abstract__ = True\n\n id = db.Column(db.Integer, primary_key=True)\n created_at = db.Col...
python
chosen
[ { "from": "system", "value": "Fix typo in requests helper\n" }, { "from": "human", "value": "from __future__ import absolute_import\nfrom __future__ import unicode_literals\n\nimport json\n\nimport requests\nfrom django.conf import settings\n\nfrom mesoshttp.acs import DCOSServiceAuth\n\nDCOS_AU...
python
chosen
[ { "from": "system", "value": "Fix sanitizer service reference for windows\n" }, { "from": "human", "value": "if __name__ == \"__main__\":\n import gaphor\n from gaphor import core\n from gaphor.core.modeling import ElementFactory\n from gaphor.plugins.console import ConsoleWindow\n ...
python
chosen
[ { "from": "system", "value": "Clean up after swift run\n" }, { "from": "human", "value": "import romanesco\nimport unittest\n\n\nclass TestSwiftMode(unittest.TestCase):\n def testSwiftMode(self):\n task = {\n 'mode': 'swift',\n 'script': \"\"\"\ntype file;\n\napp ...
python
chosen
[ { "from": "system", "value": "Add newline at end of file\n" }, { "from": "human", "value": "__all__ = ['CloneableMeta']\n\n\ndef attach_new_init_method(cls):\n \"\"\"\n Replace the existing cls.__init__() method with a new one which\n also initialises the _clones attribute to an empty l...
python
chosen
[ { "from": "system", "value": "Use an explicit test here\n" }, { "from": "human", "value": "import pytest\n\nfrom jacquard.odm import Session\nfrom jacquard.buckets import Bucket\nfrom jacquard.buckets.constants import NUM_BUCKETS\n\n\n@pytest.mark.parametrize('divisor', (\n 2,\n 3,\n 4,...
python
chosen
[ { "from": "system", "value": "Add test coverage for 1.10 CONTENT_LENGTH hack\n" }, { "from": "human", "value": "from django.test.client import RequestFactory\nfrom mock import Mock\nfrom unittest2 import TestCase\n\nfrom .helpers import RequestPatchMixin\nfrom .test_views import TestProxy\n\n\nc...
python
chosen
[ { "from": "system", "value": "Fix minor issue, reorganize imports, and register the RegistrationResource with the API.\n" }, { "from": "human", "value": "from django.conf.urls import patterns, include, url\nfrom tastypie.api import Api\nfrom tracker.api import UserResource, TaskResource, WorkSes...
python
chosen
[ { "from": "system", "value": "Add Python 3 compatibility and flake8 testing" }, { "from": "human", "value": "#!/usr/bin/env python2.7\n\nimport re, sys, markdown, requests, bs4 as BeautifulSoup\n\nreload(sys)\nsys.setdefaultencoding('utf8')\n\ndef check_url(url):\n try:\n return bool(r...
python
chosen
[ { "from": "system", "value": "Change variable name consistently to pool_config\n" }, { "from": "human", "value": "# pylint: disable=W0401\nfrom django.core.exceptions import ImproperlyConfigured\nfrom django.db.backends.oracle.base import *\nfrom django.db.backends.oracle.base import DatabaseWra...
python
chosen
[ { "from": "system", "value": "Add new fragments to data.frag_index\n" }, { "from": "human", "value": "import os\n\nfrom django.shortcuts import render, redirect\nfrom django.template import Context\nfrom django.http import HttpResponse\nfrom django.core.servers.basehttp import FileWrapper\n\nfro...
python
chosen
[ { "from": "system", "value": "Add preferences form built off model\n" }, { "from": "human", "value": "from registration.forms import RegistrationFormUniqueEmail\n\nclass RegistrationUserForm(RegistrationFormUniqueEmail):\n\n class Meta:\n model = User\n fields = (\"email\")\n" ...
python
chosen
[ { "from": "system", "value": "Replace cwd with current module's path" }, { "from": "human", "value": "# coding: utf-8\nimport os\nimport pytest\nfrom mock import patch\nfrom decouple import AutoConfig\n\n\ndef test_autoconfig_env():\n config = AutoConfig()\n path = os.path.join(os.getcwd()...
python
chosen
[ { "from": "system", "value": "Reformat random generator reformat code\n" }, { "from": "human", "value": "import sys\nimport time\nfrom random import shuffle\nfrom FairDistributor import FairDistributor\n\n\ndef main():\n # User input for the number of targets and objects.\n number_of_targe...
python
chosen
[ { "from": "system", "value": "Add client beta version 0.5.1\n" }, { "from": "human", "value": "\"\"\"Module for handling server and client versions\"\"\"\n\nSERVER_VERSION = '0.1.0'\nCLIENT_VERSIONS = ['0.5.0']\n\n\ndef validate(request):\n for acceptable_version in CLIENT_VERSIONS:\n ...
python
chosen
[ { "from": "system", "value": "Make handle_read a private method\n" }, { "from": "human", "value": "# -*- coding: utf-8 -*-\n\nimport logging\nimport time\nfrom kafka.client import KafkaClient\nfrom kafka.consumer import SimpleConsumer\n\n\nclass KafkaReader(object):\n def __init__(self, host,...
python
chosen
[ { "from": "system", "value": "Change the brew instruction. kinda dumb\n" }, { "from": "human", "value": "from genes.mac.traits import is_osx\n\nfrom genes.brew import brew\n\n\ndef main():\n if is_osx():\n brew.install()\n" }, { "from": "gpt", "value": "from genes.mac.trait...
python
chosen
[ { "from": "system", "value": "Fix test run on linux / travis\n" }, { "from": "human", "value": "import sys\nimport os\nimport unittest\nimport subprocess\nimport time\n\ncmd = 'python -m pretenders.server.server --host 127.0.0.1 --port 50000'\n\np = subprocess.Popen(cmd)\ntime.sleep(2)\n\nsys.pa...
python
chosen
[ { "from": "system", "value": "Allow to autocomplete on office & organization names\n" }, { "from": "human", "value": "# -*- coding: utf-8\n\"\"\"\n ain7/annuaire/autocomplete_light_registry.py\n\"\"\"\n#\n# Copyright © 2007-2015 AIn7 Devel Team\n#\n# This program is free software; you can re...
python
chosen
[ { "from": "system", "value": "fix(kakao): Change field name from 'nickname' to 'username'\n\n" }, { "from": "human", "value": "from allauth.account.models import EmailAddress\nfrom allauth.socialaccount.providers.base import ProviderAccount\nfrom allauth.socialaccount.providers.oauth2.provider i...
python
chosen
[ { "from": "system", "value": "Chipseq: Add warning when aligner is false\n" }, { "from": "human", "value": "from bcbio.ngsalign.bowtie2 import filter_multimappers\nimport bcbio.pipeline.datadict as dd\n\ndef clean_chipseq_alignment(data):\n aligner = dd.get_aligner(data)\n data[\"raw_bam\"...
python
chosen
[ { "from": "system", "value": "Improve list display of events\n" }, { "from": "human", "value": "from django.contrib import admin\nfrom django.contrib.admin import register\n\nfrom falmer.events.models import Event\n\n\n@register(Event)\nclass EventModelAdmin(admin.ModelAdmin):\n pass\n" }, ...
python
chosen
[ { "from": "system", "value": "Add type checking and piping to /dev/null\n" }, { "from": "human", "value": "\"\"\"A collection of common git actions.\"\"\"\n\nfrom subprocess import check_output, PIPE, Popen, STDOUT\n\n\ndef is_valid_reference(reference):\n \"\"\"Determines if a reference is v...
python
chosen
[ { "from": "system", "value": "Make sure we install monkey patches only once\n" }, { "from": "human", "value": "# -*- coding: utf-8 -*-\n\nimport doj.monkey.django_utils_functional_lazy\nimport doj.monkey.django_http_response_streaminghttpresponse\nimport doj.monkey.inspect_getcallargs\n\n\ndef i...
python
chosen
[ { "from": "system", "value": "Change redirect to application redirect\n" }, { "from": "human", "value": "from django.shortcuts import render\nfrom django.http import HttpResponseRedirect\nfrom django.core.urlresolvers import reverse\nfrom news.models import Article, Event\nfrom door.models impor...
python
chosen
[ { "from": "system", "value": "Fix repr calling unknown attribute\n" }, { "from": "human", "value": "from sqlalchemy import Column, BIGINT, String, Integer\n\nfrom meetup_facebook_bot.models.base import Base\n\n\nclass Speaker(Base):\n __tablename__ = 'speakers'\n id = Column(Integer, prima...
python
chosen
[ { "from": "system", "value": "Add continue when no extension \".jpg\" nor \".png\" is found in URL\n" }, { "from": "human", "value": "import urllib\nimport os\nimport hashlib\n\n\n\nwith open('media_urls.txt','r') as f:\n for url in f:\n \timagename = os.path.basename(url)\n \tm = hashl...
python
chosen
[ { "from": "system", "value": "Allow setting ridge regression parameters during creation\n" }, { "from": "human", "value": "from solver import Solver\nimport numpy as np\n\n\nclass RidgeRegression(Solver):\n \"\"\"\n Analytically performs ridge regression, where coefficients are regularized...
python
chosen
[ { "from": "system", "value": "Fix another situation where targets didn't get rebuilt\n" }, { "from": "human", "value": "import os\nfrom ..target import Target\n\nclass LocalFile(Target):\n def __init__(self, path):\n self._path = path\n super(LocalFile, self).__init__()\n ...
python
chosen
[ { "from": "system", "value": "Test dry run mode in erase_mail\n" }, { "from": "human", "value": "from io import StringIO\n\nfrom django.core.management import call_command\nfrom django.test import TestCase\nfrom django.utils import timezone\n\nfrom geotrek.feedback.models import Report\nfrom geo...
python
chosen
[ { "from": "system", "value": "Add extra DotDict subscriptability test\n" }, { "from": "human", "value": "from piper.utils import DotDict\nfrom piper.utils import dynamic_load\n\nimport pytest\n\n\nclass TestDotDict(object):\n def test_get_nonexistant_raises_keyerror(self):\n with pytes...
python
chosen
[ { "from": "system", "value": "Sort content for data import.\n" }, { "from": "human", "value": "from django.utils.translation import ugettext_lazy as _\nfrom django import forms\nfrom models import ExcelImportTask\nfrom django.forms import ModelForm\n\n\nclass ExcelFormatTranslateForm(forms.Form)...
python
chosen
[ { "from": "system", "value": "Refactor Zendesk client code for smoketest\n" }, { "from": "human", "value": "# -*- coding: utf-8 -*-\n\"Zendesk\"\n\nimport json\nimport requests\nfrom flask import current_app\n\n\nTICKETS_URL = 'https://ministryofjustice.zendesk.com/api/v2/tickets.json'\n\n\ndef ...
python
chosen
[ { "from": "system", "value": "Add some explaination on BigForeignKey\n" }, { "from": "human", "value": "from django.db import models\n\n\nclass BigForeignKey(models.ForeignKey):\n def db_type(self, connection):\n \"\"\" Adds support for foreign keys to big integers as primary keys.\n ...
python
chosen
[ { "from": "system", "value": "Create channel homepage if not exists in before request\n" }, { "from": "human", "value": "# coding: utf-8\n\n\ndef configure(app):\n @app.before_first_request\n def initialize():\n print \"Called only once, when the first request comes in\"\n" }, {...
python
chosen
[ { "from": "system", "value": "Increment patch version to 0.5.1\n" }, { "from": "human", "value": "\n\"\"\"\n\n__init__.py\n\nAuthor: Rob Cakebread <cakebread at gmail>\n\nLicense : BSD\n\n\"\"\"\n\n__docformat__ = 'restructuredtext'\n__version__ = '0.5'\n" }, { "from": "gpt", "value...
python
chosen
[ { "from": "system", "value": "Swap order of Key x and y to make Keys sortable\n" }, { "from": "human", "value": "import abc\nfrom collections import namedtuple\n\n\nKey = namedtuple('Key', ['x', 'y'])\n\n\nclass Keyboard(metaclass=abc.ABCMeta):\n def __init__(self):\n pass\n\n @abc....
python
chosen
[ { "from": "system", "value": "Add test for data type validation\n" }, { "from": "human", "value": "from unittest import TestCase\nfrom chatterbot_corpus import corpus\n\n\nclass CorpusUtilsTestCase(TestCase):\n \"\"\"\n This test case is designed to make sure that all\n corpus data adhe...
python
chosen
[ { "from": "system", "value": "Add test case for iter_source_code\n" }, { "from": "human", "value": "import os\nimport sys\n\nimport pytest\nfrom hypothesis_auto import auto_pytest_magic\n\nfrom isort import main\n\nauto_pytest_magic(main.sort_imports)\n\n\ndef test_is_python_file():\n assert ...
python
chosen