conversations
listlengths
2
3
source
stringclasses
1 value
stack
stringclasses
1 value
[ { "from": "system", "value": "Speed up draft registrations query.\n" }, { "from": "human", "value": "REG_CAMPAIGNS = {\n 'prereg': 'Prereg Challenge',\n 'registered_report': 'Registered Report Protocol Preregistration',\n}\n\ndef get_campaign_schema(campaign):\n from osf.models import R...
python
chosen
[ { "from": "system", "value": "Make task type short field bigger\n" }, { "from": "human", "value": "from sqlalchemy_utils import UUIDType\n\nfrom zou.app import db\nfrom zou.app.models.serializer import SerializerMixin\nfrom zou.app.models.base import BaseMixin\n\n\nclass TaskType(db.Model, BaseM...
python
chosen
[ { "from": "system", "value": "[telemetry] Rename Memory benchmark to avoid conflict with Memory measurement.\n\nQuick fix for now, but I may need to reconsider how run_measurement resolved name conflicts.\n\n\nBUG=263511\nTEST=None.\nR=tonyg@chromium.org\n\nReview URL: https://chromiumcodereview.appspot.com...
python
chosen
[ { "from": "system", "value": "Create model for session, add properties for user\n" }, { "from": "human", "value": "\"\"\"\nModels for the Jukebox application\n\nUser - All users\nVote - Votes on songs\n\"\"\"\n\nimport logging\n\nfrom peewee import SqliteDatabase, Model, CharField, DateTimeField...
python
chosen
[ { "from": "system", "value": "Return 404 instead of incorrect JS file when screen does not exist.\n" }, { "from": "human", "value": "# -*- coding: utf-8 -*-\n# (c) Nelen & Schuurmans, see LICENSE.rst.\n\nfrom __future__ import absolute_import\nfrom __future__ import division\nfrom __future__ imp...
python
chosen
[ { "from": "system", "value": "Change constructor to be more appropriate\n" }, { "from": "human", "value": "class ResponseError(Exception):\n \"\"\"For throwing in case of a non-200 response status.\"\"\"\n def __init__(self, *args, code=None, **kwargs):\n self.code = code\n s...
python
chosen
[ { "from": "system", "value": "Allow request vars to work even with disabled session middleware.\n" }, { "from": "human", "value": "from django.template.loader import render_to_string\nfrom debug_toolbar.panels import DebugPanel\n\nclass RequestVarsDebugPanel(DebugPanel):\n \"\"\"\n A panel...
python
chosen
[ { "from": "system", "value": "Add quotes so all params are strings\n" }, { "from": "human", "value": "# -*- coding: utf-8 -*-\n\nimport os\nimport subprocess\n\n\nclass ProtractorTestCaseMixin(object):\n protractor_conf = 'protractor.conf.js'\n suite = None\n specs = None\n\n @classm...
python
chosen
[ { "from": "system", "value": "[python] Make hello world (asyncio) more involved\n" }, { "from": "human", "value": "import asyncio\nimport pytest\n\ndef test_hello_world(workspace):\n workspace.src('main.py', r\"\"\"\n import asyncio\n\n async def main():\n print('Hello, ', end=''...
python
chosen
[ { "from": "system", "value": "Add lang to global export list.\n" }, { "from": "human", "value": "#!/usr/bin/env python\n# -*- coding: utf-8 -*-\n\n# Copyright 2011-2014, Nigel Small\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may not use this file except in com...
python
chosen
[ { "from": "system", "value": "Implement UpperCamelCase name check for enums\n" }, { "from": "human", "value": "from tailor.swift.swiftlistener import SwiftListener\nfrom tailor.utils.charformat import isUpperCamelCase\n\n\nclass MainListener(SwiftListener):\n\n def enterClassName(self, ctx):\...
python
chosen
[ { "from": "system", "value": "Comment typo fix and move newline.\n" }, { "from": "human", "value": "# -*- coding: utf-8 -*-\n\n\"\"\"\nrequests._oauth\n~~~~~~~~~~~~~~~\n\nThis module comtains the path hack neccesary for oauthlib to be vendored into requests\nwhile allowing upstream changes.\n\"\...
python
chosen
[ { "from": "system", "value": "Use unique identifier name for ASGIApp type\n\nDue to collision with ASGIApp class decorator\n" }, { "from": "human", "value": "__all__ = [\"ASGIMiddleware\"]\n\nimport rollbar\n\ntry:\n from starlette.types import ASGIApp, Receive, Scope, Send\nexcept ImportErro...
python
chosen
[ { "from": "system", "value": "Support DNS round-robin balancing through Route53\n\nOur codegen actions for adding/updating A records in Route53 only support a single IP as a value. Changing to accept a comma-separated list, which will add an unweighted round-robin A record.\r\n\r\nShould also add WRR at som...
python
chosen
[ { "from": "system", "value": "Fix episode finding logic to handle specials and cases where episodes are out of order in tvdb api result\n\n\ngit-svn-id: 056f9092885898c4775d98c479d2d33d00273e45@374 dda364a1-ef19-0410-af65-756c83048fb2\n" }, { "from": "human", "value": "#!/usr/bin/python\n\nfrom ...
python
chosen
[ { "from": "system", "value": "Allow girder to show load errors in more cases.\n\nIf girder is installed but requirements of large_image are not, the\nplugin would report as enabled but not be functional. This checks if\ngirder is available, and, if so, allows girder to report errors.\n\nEventually, it will...
python
chosen
[ { "from": "system", "value": "Move NullFile and NullStream to monty\n" }, { "from": "human", "value": "# coding: utf-8\n\nfrom __future__ import division, unicode_literals\n\n\"\"\"\nThis module defines some useful design patterns.\n\"\"\"\n\n\n__author__ = \"Shyue Ping Ong\"\n__copyright__ = \"...
python
chosen
[ { "from": "system", "value": "Send email when motion is detected\n" }, { "from": "human", "value": "from gpiozero import MotionSensor\n\n##Quick script to check communication between motion sensor and Pi on GPIO 4.\n\npir = MotionSensor(4)\ni = 0\nwhile(i < 5):\n if pir.motion_detected:\n ...
python
chosen
[ { "from": "system", "value": "Change font of ASCII to Courier\n" }, { "from": "human", "value": "import tkinter as tk\nfrom time import sleep\nfrom movie01 import reel\n\nwindow = tk.Tk()\n\ndef main():\n \n window.title(\"Tkinter Movie Player\")\n button = tk.Button(window, text = \"Pl...
python
chosen
[ { "from": "system", "value": "Add basic HTTP error handling.\n" }, { "from": "human", "value": "import requests\n\n\nclass myElsClient:\n \"\"\"A class that implements a Python interface to api.elsevier.com\"\"\"\n\n # local variables\n __base_url = \"https://api.elsevier.com/\"\n\n ...
python
chosen
[ { "from": "system", "value": "Add postion lookup stuff to script. Use acquistion_time for timestamp\n" }, { "from": "human", "value": "#! /usr/bin/env python\n\nimport django\nfrom datetime import datetime\nimport pytz\ndjango.setup()\nfrom basaltApp.models import BasaltImageSet, BasaltSingleIm...
python
chosen
[ { "from": "system", "value": "Downgrade 'Failed to reconcile' from error to warning\n" }, { "from": "human", "value": "from __future__ import absolute_import\nfrom celery import shared_task\nfrom django.core.exceptions import ValidationError\nfrom wellsfargo.connector import actions\nfrom wellsf...
python
chosen
[ { "from": "system", "value": "Add a method to noop the make_key in Django" }, { "from": "human", "value": "\"\"\"\ndjango_casscache\n~~~~~~~~~~~~~~~~\n\n:copyright: (c) 2013 by Matt Robenolt.\n:license: BSD, see LICENSE for more details.\n\"\"\"\n\nfrom django.core.cache.backends.memcached impor...
python
chosen
[ { "from": "system", "value": "Fix force_unicode for Python 3, use force_text()\n" }, { "from": "human", "value": "\"\"\"\nInternal utils for search.\n\"\"\"\nfrom django.utils.encoding import force_unicode\nfrom django.utils.html import strip_tags\nimport six\n\n\ndef get_search_field_values(con...
python
chosen
[ { "from": "system", "value": "Add default value for matrix and methods to get columns and rows.\n" }, { "from": "human", "value": "\"\"\"Pixelmap\n\nCool pixelmap of Pixels.\nLast updated: March 7, 2017\n\"\"\"\n\nfrom pixel import Pixel\n\n\nclass Pixelmap:\n\n def __init__(self, width, heig...
python
chosen
[ { "from": "system", "value": "Fix to only match '>' at the beginning of a line\n\nWhich was the intention with the '\\n' in the pattern before, but I had\nmade it optional for the common case of the '>' being at the beginning\nof the message, which of course had the side effect of allowing the\n'>' to be ma...
python
chosen
[ { "from": "system", "value": "Fix broken tests because of virtualenv handler\n" }, { "from": "human", "value": "from .dir import ext_dir\nfrom .makegit import ext_git\nfrom .download import ext_download\nfrom .template import ext_template\n\nextension_handles = {\n 'dir':ext_dir,\n 'git':e...
python
chosen
[ { "from": "system", "value": "Add a tripped message to the suspenders, but disable for now\n" }, { "from": "human", "value": "from bluesky.suspenders import (SuspendFloor, SuspendBoolHigh, SuspendBoolLow)\nfrom bluesky.global_state import get_gs\n\ngs = get_gs()\nRE = gs.RE\n\n\n# Here are some ...
python
chosen
[ { "from": "system", "value": "Work on master is now 1.7 dev work\n" }, { "from": "human", "value": "\"\"\"\nClient for Swift\n\nCopyright 2012 Gregory Holt\n\nLicensed under the Apache License, Version 2.0 (the \"License\");\nyou may not use this file except in compliance with the License.\nYou ...
python
chosen
[ { "from": "system", "value": "Make remove all annotation also remove classes and relations\n" }, { "from": "human", "value": "#!/usr/bin/python\n\n# This is a small helper script to remove all annotations from a\n# project.\n\n# You may need to install psycopg2, e.g. with:\n# sudo apt-get inst...
python
chosen
[ { "from": "system", "value": "Raise an error if the user doesn't have a _config.py\n\nThis raises a less cryptic error.\n" }, { "from": "human", "value": "# This module contains the user's configurations, to be accessed like:\n# `print cytoplasm.configuration.build_dir`\nimport os, imp\n\n# If t...
python
chosen
[ { "from": "system", "value": "Enable On the rocks plugin\n" }, { "from": "human", "value": "# -*- coding: utf-8 -*-\n\n# Execute this file to see what plugins will be loaded.\n\n# Implementation leans to Lex Toumbourou's example:\n# https://lextoumbourou.com/blog/posts/dynamically-loading-module...
python
chosen
[ { "from": "system", "value": "Fix syntax error in service_status\n" }, { "from": "human", "value": "import logging\nfrom django.utils.translation import ugettext as _\n\nfrom molly.utils.views import BaseView\nfrom molly.utils.breadcrumbs import *\n\nlogger = logging.getLogger(\"molly.apps.servi...
python
chosen
[ { "from": "system", "value": "Order Pis in list by lastseen, showing non-communicating pis at the top\n" }, { "from": "human", "value": "from pi_director.models.models import (\n DBSession,\n MyModel,\n )\n\ndef get_pis():\n PiList=DBSession.query(MyModel).filter(MyModel.uuid!=\"defa...
python
chosen
[ { "from": "system", "value": "Update gfycat plugin for python3 support\n" }, { "from": "human", "value": "import re\ntry:\n import urllib.request as urllib\nexcept:\n import urllib # Python 2\n\ndef title(source):\n gfyId = re.findall(r'href=\\\".*gfycat.com/(\\w+).*\\\">', source)[-1]\...
python
chosen
[ { "from": "system", "value": "Fix in string representation of product model.\n" }, { "from": "human", "value": "from django.db import models\nfrom amadaa.models import AmadaaModel\nfrom django.urls import reverse\nfrom ckeditor.fields import RichTextField\n\n# Create your models here.\n\nclass P...
python
chosen
[ { "from": "system", "value": "Add update queries for reservation\n" }, { "from": "human", "value": "UPDATE_MOVIE = '''\n UPDATE MOVIE\n SET column1=?, RATING=?\n WHERE MOVIE.ID=?;\n'''\n\nUPDATE_PROJECTION = '''\n UPDATE PROJECTION\n SET MOVIE_ID=?, TYPE=?, DATE=?\n WHERE PROJE...
python
chosen
[ { "from": "system", "value": "Add test for setting cwd in LocalShell.run\n" }, { "from": "human", "value": "from nose.tools import istest, assert_equal\n\nfrom spur import LocalShell\n\nshell = LocalShell()\n\n@istest\ndef output_of_run_is_stored():\n result = shell.run([\"echo\", \"hello\"])...
python
chosen
[ { "from": "system", "value": "tests/pyb: Add test for ExtInt when doing swint while disabled.\n" }, { "from": "human", "value": "import pyb\n\next = pyb.ExtInt('X1', pyb.ExtInt.IRQ_RISING, pyb.Pin.PULL_DOWN, lambda l:print('line:', l))\next.disable()\next.enable()\nprint(ext.line())\next.swint()...
python
chosen
[ { "from": "system", "value": "Add test to make sure memoize works for methods\n" }, { "from": "human", "value": "import cachelper\n\n\nclass TestMemorize:\n\n def test_should_cache_return_value(self, mocker):\n func = mocker.Mock()\n func.side_effect = lambda i: i * 2\n f...
python
chosen
[ { "from": "system", "value": "Update test suite generator to import tests in source_test.\n" }, { "from": "human", "value": "#! /usr/bin/env python\n#\n# test_suite.py\n#\n# Copyright (c) 2015-2016 Junpei Kawamoto\n#\n# This software is released under the MIT License.\n#\n# http://opensource.org...
python
chosen
[ { "from": "system", "value": "Prepend path so we always get the local copy.\n" }, { "from": "human", "value": "# Copyright 2012 Christoph Reiter\n#\n# This program is free software; you can redistribute it and/or modify\n# it under the terms of the GNU General Public License version 2 as\n# publ...
python
chosen
[ { "from": "system", "value": "Add support for `n` Node.js version manager\n" }, { "from": "human", "value": "import os\nimport platform\nimport subprocess\n\nIS_OSX = platform.system() == 'Darwin'\nIS_WINDOWS = platform.system() == 'Windows'\n\ndef node_bridge(data, bin, args=[]):\n\tenv = None\...
python
chosen
[ { "from": "system", "value": "Allow override of backend urls from env variables\n" }, { "from": "human", "value": "from flask import Flask\nfrom flask import redirect\nfrom flask import url_for\nfrom kqueen_ui.blueprints.ui.views import ui\nfrom werkzeug.contrib.cache import SimpleCache\n\nimpor...
python
chosen
[ { "from": "system", "value": "Fix column name in tests\n" }, { "from": "human", "value": "\nimport pytest\nimport astropy.units as u\nfrom astropy.coordinates import SkyCoord\n\nfrom .. import Ogle\n\n\n@pytest.mark.remote_data\ndef test_ogle_single():\n co = SkyCoord(0, 3, unit=(u.degree, u....
python
chosen
[ { "from": "system", "value": "Create classroom and some encapsulation\n" }, { "from": "human", "value": "class Person:\n\n def __init__(self, name):\n self.name = name\n\n def say_hello(self):\n print(\"Hello, \", self.name)\n\np1 = Person(\"Allan\")\np1.say_hello()\n\np2 = P...
python
chosen
[ { "from": "system", "value": "Replace raise with return for Ctrl+C in Windows\n\n- Replace the raise `const.CtrlC` with `return const.CtrlC` the match the\n unix implementation and prevent a stacktrace when cancelling a command\n on Windows\n" }, { "from": "human", "value": "import sys\nimport...
python
chosen
[ { "from": "system", "value": "Add method for raising not supported error\n" }, { "from": "human", "value": "def check_spark():\n SparkContext = False\n try:\n from pyspark import SparkContext\n finally:\n return SparkContext\n\ndef check_path(path, credentials=None):\n ...
python
chosen
[ { "from": "system", "value": "Add enable and dissable hooks\n" }, { "from": "human", "value": "\nfrom models import custom_modules\n\nfrom . import handlers\n\n\ndef register_module():\n \"\"\"Registers this module in the registry.\"\"\"\n\n global_urls = [\n ('/new-global-url', han...
python
chosen
[ { "from": "system", "value": "Add util to test network connection\n" }, { "from": "human", "value": "import os\nimport glob\nimport logging\nimport dropbox\nfrom dropbox.client import DropboxClient, ErrorResponse\nimport settings\nfrom settings import DROPBOX_TOKEN_FILE\n\n\ndef load_dropbox_tok...
python
chosen
[ { "from": "system", "value": "Fix typo in CustomSignatureForm fields definition\n" }, { "from": "human", "value": "from petition.forms import SignatureForm\nfrom crispy_forms.layout import Layout, Submit\nfrom crispy_forms.bootstrap import PrependedText\nfrom crispy_forms.helper import FormHelpe...
python
chosen
[ { "from": "system", "value": "Fix echo endpoint in testproject\n" }, { "from": "human", "value": "from channels.sessions import enforce_ordering\n\n\n#@enforce_ordering(slight=True)\ndef ws_connect(message):\n pass\n\n\n#@enforce_ordering(slight=True)\ndef ws_message(message):\n \"Echoes m...
python
chosen
[ { "from": "system", "value": "Update tests for new redirect-after-create stream.\n" }, { "from": "human", "value": "from tornado.httpclient import HTTPRequest\nfrom nose.tools import eq_, ok_\nimport json\nimport faker\n\nfrom astral.api.tests import BaseTest\nfrom astral.models import Stream\nf...
python
chosen
[ { "from": "system", "value": "Remove gorlin_glue from generated docs for now. It produces about 100 warnings during doc build.\n\ngit-svn-id: 24f545668198cdd163a527378499f2123e59bf9f@926 ead46cd0-7350-4e37-8683-fc4c6f79bf00\n" }, { "from": "human", "value": "#!/usr/bin/env python\n\"\"\"Script ...
python
chosen
[ { "from": "system", "value": "Remove creation of service files.\n" }, { "from": "human", "value": "\"\"\"\nInstall Wabbit Systemd service.\n\"\"\"\n\nfrom glob import glob\nfrom shutil import copy\nfrom os import chdir\nfrom os.path import dirname, realpath\nfrom subprocess import call\nimport s...
python
chosen
[ { "from": "system", "value": "Remove unused test class attr\n" }, { "from": "human", "value": "from django.test import TestCase\n\nfrom conman.tests.utils import RequestTestCase\nfrom . import factories\nfrom .. import views\n\n\nclass TestPageDetail(RequestTestCase):\n def test_get_object(se...
python
chosen
[ { "from": "system", "value": "Set osBrain version to 0.2.3-devel\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'\nPyro4.config.REQUIRE_EX...
python
chosen
[ { "from": "system", "value": "Use fully qualified module names\n\nThis is so that the tiddlyweb instance used in the tests can find the renderer\n" }, { "from": "human", "value": "config = {\n 'wikitext.default_renderer': 'twikified',\n 'wikitext.type_render_map': {\n 'text/x-tiddly...
python
chosen
[ { "from": "system", "value": "Add mixin to put the username in context" }, { "from": "human", "value": "import urlparse\n\nfrom functools import wraps\n\nfrom django.conf import settings\nfrom django.utils.decorators import available_attrs, method_decorator\n\nfrom django.contrib.auth import RED...
python
chosen
[ { "from": "system", "value": "Fix warning on running tests adding missing setting.\n" }, { "from": "human", "value": "# -*- encoding: utf-8 -*-\n\nimport os, sys\n\nsys.path.insert(0, '..')\n\nPROJECT_ROOT = os.path.dirname(__file__)\nDEBUG = True\nTEMPLATE_DEBUG = DEBUG\n\nDATABASES = {\n 'd...
python
chosen
[ { "from": "human", "value": "Check that the MP3 files actually exist.\n\nSigned-off-by: Chris Lamb <711c73f64afdce07b7e38039a96d2224209e9a6c@chris-lamb.co.uk>\n" }, { "from": "gpt", "value": "import os\n\nfrom django.core import checks\nfrom django.contrib.staticfiles.finders import find\n\nfrom...
python
chosen
[ { "from": "system", "value": "Add heroku host to ALLOWED_HOSTS\n" }, { "from": "human", "value": "# Django settings for pyvideo project.\nfrom richard.settings import *\n\nALLOWED_HOSTS = ['pyvideo.ru']\nTIME_ZONE = 'Europe/Moscow'\nLANGUAGE_CODE = 'ru'\nSECRET_KEY = 'this_is_not_production_so_w...
python
chosen
[ { "from": "system", "value": "Add tests for most functions in clean module\n\nIterate over the complete and parsed test data and confirm we can still\nproduce the excepted output for most functions in clean.py.\n" }, { "from": "human", "value": "from mergepurge import clean\nimport pandas as pd\...
python
chosen
[ { "from": "system", "value": "Style: Fix `flake8` E275 missing whitespace after keyword\n" }, { "from": "human", "value": "from sqlobject import IntCol, SQLObject\nfrom sqlobject.tests.dbtest import getConnection, setupClass\n\n\n########################################\n# Identity (MS SQL)\n###...
python
chosen
[ { "from": "system", "value": "Add util function for accepting input by PM\n" }, { "from": "human", "value": "\"\"\"\nContains utilities regarding messages\n\"\"\"\n\n\ndef paginate(string, pref='```\\n', aff='```', max_length=2000, sep='\\n'):\n 'Chop a string into even chunks of max_length a...
python
chosen
[ { "from": "system", "value": "Store data set as dict instead of list\n" }, { "from": "human", "value": "class PrefixList:\n \"\"\" The PrefixList holds the data received from routing registries and\n the validation results of this data. \"\"\"\n\n def __init__(self, name):\n ...
python
chosen
[ { "from": "system", "value": "JSONFieldDescriptor: Use DjangoJSONEncoder, it knows how to handle dates and decimals\n" }, { "from": "human", "value": "from django.utils import simplejson\n\n\nclass JSONFieldDescriptor(object):\n def __init__(self, field):\n self.field = field\n\n de...
python
chosen
[ { "from": "system", "value": "Fix bug that arose through grammar tweaking\n" }, { "from": "human", "value": "from .models import Node, Info\nfrom sqlalchemy import ForeignKey, Column, String\nimport random\n\n\nclass Source(Node):\n __tablename__ = \"source\"\n __mapper_args__ = {\"polymor...
python
chosen
[ { "from": "system", "value": "Update fetching nodes to manually get all keys with iid prefix instead of using an index\n" }, { "from": "human", "value": "import json\nimport itertools\nimport logging\n\n__author__ = 'patrickwalsh'\n\nfrom flask import Flask\nfrom redis import Redis\n\napp = Flas...
python
chosen
[ { "from": "system", "value": "Add scrapi create rename iterable if we want to move to chunks in the fuure\n" }, { "from": "human", "value": "from datetime import datetime\n\nimport pytz\n\n\ndef timestamp():\n return pytz.utc.localize(datetime.utcnow()).isoformat().decode('utf-8')\n\n\ndef co...
python
chosen
[ { "from": "system", "value": "Fix a lint indent issue\n" }, { "from": "human", "value": "from ..auth_provider import KnowledgeAuthProvider\nfrom ..models import User\nfrom flask import (\n redirect,\n render_template,\n request,\n url_for,\n)\nfrom ldap3 import Server, Connection, AL...
python
chosen
[ { "from": "system", "value": "Trim down merge verbosity to avoid overly large log files.\n" }, { "from": "human", "value": "import FWCore.ParameterSet.Config as cms\nfrom FWCore.ParameterSet.VarParsing import VarParsing\nimport subprocess\nimport os\nimport sys\n\noptions = VarParsing('analysis'...
python
chosen
[ { "from": "system", "value": "Remove reference to no longer existing command update_affairs\n" }, { "from": "human", "value": "from timeit import default_timer as timer\n\nfrom django.core.management.base import BaseCommand\n\nfrom apps.curia_vista.management.commands.update_affair_summaries imp...
python
chosen
[ { "from": "system", "value": "Add OTP to test filters\n" }, { "from": "human", "value": "# Test for one implementation of the interface\nfrom lexicon.providers.dnsimple import Provider\nfrom integration_tests import IntegrationTests\nfrom unittest import TestCase\n\n# Hook into testing framework...
python
chosen
[ { "from": "system", "value": "Test that specifying fields and exclude in ModelDataset.Meta works.\n" }, { "from": "human", "value": "from django.test import TestCase\n\nfrom django_tablib import ModelDataset, Field\n\nfrom .models import TestModel\n\n\nclass DjangoTablibTestCase(TestCase):\n ...
python
chosen
[ { "from": "system", "value": "Set the content security policy\n" }, { "from": "human", "value": "# Configuration file for ipython-notebook.\n\nc = get_config()\nc.NotebookApp.ip = '*'\nc.NotebookApp.open_browser = False\nc.NotebookApp.port = 8888\n\n# Whether to trust or not X-Scheme/X-Forwarded...
python
chosen
[ { "from": "system", "value": "Add unittest for testing file path\n" }, { "from": "human", "value": "import pandas\nimport unittest\n\nimport cocoscore.ml.fasttext_helpers as fth\n\n\nclass CVTest(unittest.TestCase):\n train_path = 'ft_simple_test.txt'\n ft_path = '/home/lib/fastText'\n ...
python
chosen
[ { "from": "system", "value": "Add testing for the WebAuthn implementation\n" }, { "from": "human", "value": "\"\"\"\nThis test file tests the lib.tokens.webauthntoken, along with lib.tokens.webauthn.\nThis depends on lib.tokenclass\n\"\"\"\n\nfrom .base import MyTestCase\nfrom privacyidea.lib.to...
python
chosen
[ { "from": "system", "value": "Remove debug flag from tests\n" }, { "from": "human", "value": "import unittest\n\nfrom knights import compiler\n\n\nclass Mock(object):\n def __init__(self, **kwargs):\n for k, v in kwargs.items():\n setattr(self, k, v)\n\n\nclass TemplateTestC...
python
chosen
[ { "from": "system", "value": "Add country field to Address model\n" }, { "from": "human", "value": "from django.db import models\n\nclass Facility(models.Model):\n name = models.CharField(max_length=30)\n\n def __unicode__(self):\n return self.name\n\nclass Address(models.Model):\n ...
python
chosen
[ { "from": "system", "value": "Fix pyinstall-build by including discovery cache documents.\n\nProduced an error related to serviceusage API.\n\nChange-Id: Idf6b83912c3e71e7081ef1b6b0a2836a18723542\nGitOrigin-RevId: e38c69cfc7269177570a8aa8c23f8eaa2d32ddd2\n" }, { "from": "human", "value": "# Copy...
python
chosen
[ { "from": "system", "value": "Use 'rb' mode for reading files\n\nTo stick to pwb conventions\n" }, { "from": "human", "value": "import os\n\ncustom_path = os.path.expanduser('~/user-fixes.py')\nif os.path.exists(custom_path):\n with open(custom_path, 'r') as f:\n exec(compile(f.read(),...
python
chosen
[ { "from": "system", "value": "Address review comment: Link to issue.\n" }, { "from": "human", "value": "# Copyright Hybrid Logic Ltd. See LICENSE file for details.\n\n\"\"\"\nCombine and retrieve current cluster state.\n\"\"\"\n\nfrom twisted.application.service import Service\n\nfrom ._model i...
python
chosen
[ { "from": "system", "value": "Add new Parser class argument (spider) and fix test parameters.\n" }, { "from": "human", "value": "\"\"\" Test the data_science_jobs spider. \"\"\"\n\n\nfrom joby.items import JobLoader, Job\nfrom joby.tests.utilities import make_offline_parser\nfrom datetime import...
python
chosen
[ { "from": "system", "value": "Use a custom response renderer\n\nThis lets us specify the error codes and make sure we always return\njson.\n" }, { "from": "human", "value": "#!/usr/bin/env python\n\nfrom flask import Flask, abort, jsonify\n\nimport validations\n\n\napp = Flask(__name__)\n\n\n@ap...
python
chosen
[ { "from": "system", "value": "Add new marker interface for a digest method\n" }, { "from": "human", "value": "from zope.interface import Interface\n\nclass ISerializer(Interface):\n \"\"\"Marker Interface\"\"\"\n" }, { "from": "gpt", "value": "from zope.interface import Interface\...
python
chosen
[ { "from": "system", "value": "Set upper bound to urllib3\n" }, { "from": "human", "value": "__requires__ = ['eventlet>=0.9.15', 'urllib3>=1.9']\n" }, { "from": "gpt", "value": "__requires__ = ['eventlet>=0.9.15', 'urllib3>=1.9,<2.0']\n" } ]
python
chosen
[ { "from": "system", "value": "Remove at exit handler it doesnt work...\n" }, { "from": "human", "value": "\nimport subprocess\nimport atexit\n\nfrom delivery.models.execution import ExecutionResult, Execution\n\n\nclass ExternalProgramService():\n\n @staticmethod\n def run(cmd):\n p...
python
chosen
[ { "from": "system", "value": "Make remove commands match docstring\n" }, { "from": "human", "value": "import logging\nimport json\nfrom gather.gatherbot import GatherBot\nfrom gather import commands\n\n\nif __name__ == '__main__':\n logging.basicConfig(\n level=logging.INFO,\n f...
python
chosen
[ { "from": "system", "value": "Set the modification dates of the created files to that of the notes\n" }, { "from": "human", "value": "import os, sys, json\nfrom simperium.core import Api as SimperiumApi\n\nappname = 'chalk-bump-f49' # Simplenote\ntoken = os.environ['TOKEN']\nbackup_dir = sys.arg...
python
chosen
[ { "from": "system", "value": "Add support for countries with accented characters\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_CHOICES...
python
chosen
[ { "from": "system", "value": "Remove full CommonMark syntax for a simplified version\n" }, { "from": "human", "value": "from django.utils.safestring import mark_safe\nimport CommonMark\n\n\n# Convert a markdown string into HTML5, and prevent Django from escaping it\ndef mdToHTML(value):\n\tparse...
python
chosen
[ { "from": "human", "value": "Add logging to spam tasks\n\n[#OSF-6977]\n[skip ci]\n" }, { "from": "gpt", "value": "from celery.utils.log import get_task_logger\n\nfrom framework.celery_tasks import app as celery_app\n\nfrom website import settings\nfrom website.util import akismet\n\nlogger = get...
python
chosen
[ { "from": "system", "value": "Remove duplicate INSTALLED_APPS from settings\n" }, { "from": "human", "value": "from zerrenda.settings import *\n\nDEBUG = True\n\nINSTALLED_APPS = (\n 'django.contrib.admin',\n 'django.contrib.auth',\n 'django.contrib.contenttypes',\n 'django.contrib.s...
python
chosen
[ { "from": "system", "value": "Make publisher store emit the right event name\n" }, { "from": "human", "value": "from flask_socketio import SocketIO\nfrom flask import current_app\n\nfrom zou.app import config\n\nhost = config.KEY_VALUE_STORE[\"host\"]\nport = config.KEY_VALUE_STORE[\"port\"]\nre...
python
chosen
[ { "from": "system", "value": "Make a model 'Filesys'. (not yet, because of uploader field)\n" }, { "from": "human", "value": "from django.db import models\n\n# Create your models here.\n" }, { "from": "gpt", "value": "from django.db import models\n\nclass Filesys(models.Model):\n ...
python
chosen
[ { "from": "system", "value": "Change default web server port\n" }, { "from": "human", "value": "from willtherebespace.web import app\n\n\napp.run(port=5000, debug=True)\n" }, { "from": "gpt", "value": "from willtherebespace.web import app\n\n\napp.run(host='0.0.0.0', port=8000, debug...
python
chosen
[ { "from": "system", "value": "Define a few convenience aliases in the public API\n" }, { "from": "human", "value": "\"\"\"\nzseqfile - transparently handle compressed files\n\"\"\"\n\n# Expose the public API.\nfrom .zseqfile import ( # noqa\n open,\n open_gzip,\n open_bzip2,\n open_...
python
chosen
[ { "from": "system", "value": "Fix errors due to quotes and parenthesis in reading\n" }, { "from": "human", "value": "import json\n\nimport requests\nfrom bs4 import BeautifulSoup\n\nfrom SenseCells.tts import tts\n\n# NDTV News\nfixed_url = 'http://profit.ndtv.com/news/latest/'\nnews_headlines_l...
python
chosen
[ { "from": "system", "value": "TST: Enable running tests from inside a container\n\nby setting an env var for the path to the test volume data on the host\n" }, { "from": "human", "value": "\"\"\"\nUtilities for dockorm tests.\n\"\"\"\n# encoding: utf-8\nfrom __future__ import unicode_literals\nf...
python
chosen