conversations
listlengths
2
3
source
stringclasses
1 value
stack
stringclasses
1 value
[ { "from": "system", "value": "Remove one of the pubannotation tests as their data seems to change\n" }, { "from": "human", "value": "\nimport kindred\n\ndef test_pubannotation_groST():\n\tcorpus = kindred.pubannotation.load('bionlp-st-gro-2013-development')\n\n\tassert isinstance(corpus,kindred....
python
chosen
[ { "from": "system", "value": "Add exception handler for attachment related operations\n" }, { "from": "human", "value": "class BugsyException(Exception):\n \"\"\"\n If while interacting with Bugzilla and we try do something that is not\n supported this error will be raised.\n ...
python
chosen
[ { "from": "system", "value": "Add more detail in docstring\n" }, { "from": "human", "value": "\"\"\"Django integration for codejail\"\"\"\n\nfrom django.core.exceptions import MiddlewareNotUsed\nfrom django.conf import settings\n\nimport codejail.jail_code\n\n\nclass ConfigureCodeJailMiddleware(...
python
chosen
[ { "from": "system", "value": "Set the process title on posix systems\n" }, { "from": "human", "value": "import tornado.web\nimport tornado.wsgi\nimport tornado.httpserver\nimport tornado.ioloop\n\nfrom mojibake.main import app\nfrom mojibake.settings import PORT\n\ncontainer = tornado.wsgi.WSGIC...
python
chosen
[ { "from": "system", "value": "tests/basics: Update array test for big-int with lL typecodes.\n" }, { "from": "human", "value": "# test array('q') and array('Q')\n\ntry:\n from array import array\nexcept ImportError:\n import sys\n print(\"SKIP\")\n sys.exit()\n\nprint(array('q'))\npr...
python
chosen
[ { "from": "system", "value": "Add tests for NoneTypeCheckerCreator class\n" }, { "from": "human", "value": "# encoding: utf-8\n\n\"\"\"\n.. codeauthor:: Tsuyoshi Hombashi <gogogo.vm@gmail.com>\n\"\"\"\n\nfrom __future__ import absolute_import\n\nimport pytest\n\nfrom dataproperty._type_checker_c...
python
chosen
[ { "from": "system", "value": "Revert \"fix test by switching to check_output\"\n\nThis reverts commit 6cfd9d01d68c2f7ff4a8bba3351ee618e770d315.\n" }, { "from": "human", "value": "from __future__ import absolute_import, division, print_function\n\nfrom subprocess import check_output\nimport os\n\...
python
chosen
[ { "from": "system", "value": "Add failing tests for rover forward movement\n" }, { "from": "human", "value": "\nfrom unittest import TestCase\nfrom rover import Rover\n\nclass TestRover(TestCase):\n\n def setUp(self):\n self.rover = Rover()\n\n def test_rover_compass(self):\n ...
python
chosen
[ { "from": "system", "value": "Add more useful display of the request data.\n" }, { "from": "human", "value": "\"\"\"\n Models.\n\"\"\"\nfrom django.contrib.auth.models import User\nfrom django.core.exceptions import ValidationError\nfrom django.db import models\n\nfrom pubsubpull.fields impor...
python
chosen
[ { "from": "system", "value": "Add url test for Flask\n" }, { "from": "human", "value": "import logging\nfrom flask import Flask\nfrom raven.base import Client\nfrom raven.contrib.flask import Sentry\nfrom unittest2 import TestCase\n\nclass TempStoreClient(Client):\n def __init__(self, *args, ...
python
chosen
[ { "from": "system", "value": "Support colours for rendering the layer view\n" }, { "from": "human", "value": "from UM.View.View import View\nfrom UM.View.Renderer import Renderer\nfrom UM.Scene.Iterator.DepthFirstIterator import DepthFirstIterator\nfrom UM.Resources import Resources\n\nclass Lay...
python
chosen
[ { "from": "system", "value": "Add tests for plot functions\n" }, { "from": "human", "value": "# Filename: test_plot.py\n# pylint: disable=locally-disabled,C0111,R0904,C0103\n\nimport numpy as np\n\nfrom km3pipe.testing import TestCase\nfrom km3pipe.plot import bincenters\n\n__author__ = \"Moritz...
python
chosen
[ { "from": "system", "value": "Improve memory error detection for less false positives\n" }, { "from": "human", "value": "\"\"\"\nScript to try do detect any memory leaks that may be lurking in the C implementation of the PVector.\n\"\"\"\nimport inspect\nimport sys\nimport time\nimport memory_pr...
python
chosen
[ { "from": "system", "value": "Add valid module name test case\n" }, { "from": "human", "value": "import unittest\nimport kyoto.server\nimport kyoto.tests.dummy\nimport kyoto.client\n\n\nclass ServiceTestCase(unittest.TestCase):\n\n def setUp(self):\n self.address = ('localhost', 1337)\...
python
chosen
[ { "from": "system", "value": "Make callback loader take into account directory names in loadable module name\n" }, { "from": "human", "value": "# -*- coding: latin-1 -*-\n'''\nCreated on 16.10.2012\n\n@author: Teemu Pkknen\n'''\n\nimport imp\nimport sys\nimport os\n\nfrom qsdl.simulator.errors.C...
python
chosen
[ { "from": "system", "value": "Fix up mistakes in tests\n" }, { "from": "human", "value": "import pytest\nfrom hypothesis import given\nfrom hypothesis.strategies import lists, integers, floats, one_of, composite\n\nfrom datatyping.datatyping import validate\n\n\ndef test_empty():\n assert val...
python
chosen
[ { "from": "system", "value": "Update EventSchemas per 2021-09-02 changes\n" }, { "from": "human", "value": "# Copyright (c) 2012-2019, Mark Peek <mark@peek.org>\n# All rights reserved.\n#\n# See LICENSE file for full license.\n#\n# *** Do not modify - this file is autogenerated ***\n# Resource s...
python
chosen
[ { "from": "system", "value": "Add docstring into load function\n\nFollow to Google style.\n" }, { "from": "human", "value": "# Copyright 2015-2016 Masayuki Yamamoto\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may not use this file except in compliance with t...
python
chosen
[ { "from": "system", "value": "Add constructor to summary downloader\n" }, { "from": "human", "value": "#!/usr/bin/env python\n# -*- coding: utf-8 -*-\n\n\nclass SummaryDownloader():\n\n # base url for official schedule json page\n SCHEDULE_URL_BASE = \"http://statsapi.web.nhl.com/api/v1/sc...
python
chosen
[ { "from": "system", "value": "Remove secret key from the gondor settings file\n" }, { "from": "human", "value": "import os\nimport urlparse\n\nfrom .settings import *\n\nDEBUG = True\nTEMPLATE_DEBUG = DEBUG\n\nADMINS = (\n# ('Your Name', 'your_email@example.com'),\n)\n\nMANAGERS = ADMINS\n\nif \...
python
chosen
[ { "from": "system", "value": "Increment version number to 0.17.3\n" }, { "from": "human", "value": "\"\"\"Configuration for Django system.\"\"\"\n\n__version__ = \"0.17.2\"\n__version_info__ = tuple(\n [\n int(num) if num.isdigit() else num\n for num in __version__.replace(\"-\"...
python
chosen
[ { "from": "system", "value": "Correct typing error and arrange indentation\n" }, { "from": "human", "value": "class PID:\n\tdef __init__(self, Kp=1, Ki=0.1, Kd=1, maxIntegralCorrection=0, minIntegralCorrection=-0):\n\t self.Kp = Kp # Proporiional gain\n\t self.Ki = Ki # Integral gain\n\t self...
python
chosen
[ { "from": "system", "value": "Refactor ConsoleFormatter.format() method to formatMessage()\n\nRe-use the standard Formatter.format() method, and only override the\nFormatter.formatMessage() method.\n\nSigned-off-by: Esben Haabendal <da90c138e4a9573086862393cde34fa33d74f6e5@haabendal.dk>\n" }, { "fro...
python
chosen
[ { "from": "system", "value": "Upgrade libchromiumcontent for dbus headers\n" }, { "from": "human", "value": "#!/usr/bin/env python\n\nimport platform\nimport sys\n\nBASE_URL = 'https://gh-contractor-zcbenz.s3.amazonaws.com/libchromiumcontent'\nLIBCHROMIUMCONTENT_COMMIT = '9f5271d31e0f32eac5a20ef...
python
chosen
[ { "from": "system", "value": "Fix regex for spliting fullnames\n" }, { "from": "human", "value": "import re\n\n\ndef split_fullname(fullname):\n rgx = re.compile(r\"(?P<login>.*)@(?P<name>.*)\")\n try:\n name = rgx.match(fullname).group(\"name\")\n login = rgx.match(fullname)...
python
chosen
[ { "from": "system", "value": "Return app passwords as string\n" }, { "from": "human", "value": "import os\nimport random\nimport uuid\n\n\nfrom django.contrib.auth.hashers import make_password,is_password_usable\nfrom django.utils import timezone\nfrom datetime import timedelta\n\n\nWORDLIST_FIL...
python
chosen
[ { "from": "system", "value": "Add utilities for controlling urbansim logging.\n" }, { "from": "human", "value": "import contextlib\nimport logging\n\n\n@contextlib.contextmanager\ndef log_start_finish(msg, logger, level=logging.DEBUG):\n \"\"\"\n A context manager to log messages with \"st...
python
chosen
[ { "from": "system", "value": "Change in the typ output.\n" }, { "from": "human", "value": "\n\n\"\"\"\nmunicipios_parser\n-----------------\nModule which contains the process of parsing data of municipios.\n\nTODO\n----\n\n\"\"\"\n\nimport pandas as pd\n\nfrom pythonUtils.ProcessTools import Pro...
python
chosen
[ { "from": "system", "value": "Return the output rather than print\n" }, { "from": "human", "value": "from django.core.management.base import BaseCommand\nfrom django.template.loader import render_to_string\n\n\nclass Command(BaseCommand):\n help = 'Generate redux boilerplate'\n\n def add_a...
python
chosen
[ { "from": "system", "value": "blog/en-2014-06-21: Add missing parentheses after 'chdir'.\n\nIt is a function, so we better add parentheses to make this clearer.\n" }, { "from": "human", "value": "\"\"\"\n chdir2\n ~~~~~~\n\n An alternative implementation of :func:`chdir.chdir`.\n\n :...
python
chosen
[ { "from": "system", "value": "Add new imports for apikey parameter support\n" }, { "from": "human", "value": "from cartodb_services.here.geocoder import HereMapsGeocoder\nfrom cartodb_services.here.bulk_geocoder import HereMapsBulkGeocoder\nfrom cartodb_services.here.routing import HereMapsRouti...
python
chosen
[ { "from": "system", "value": "Fix team permissions backend not pulling out manager_permissions\n\nSomething like\nrequest.user.has_perm('reviews.can_manage_%s' % proposal.kind.section.slug)\n\nWill aways return false as the backend does a lookup of team membership\n(member or manager) but only grabs the 'pe...
python
chosen
[ { "from": "system", "value": "Use print_verbose for conditional printing.\n" }, { "from": "human", "value": "# ome - Object Message Expressions\n# Copyright (c) 2015-2016 Luke McCarthy <luke@iogopro.co.uk>. All rights reserved.\n\nimport sys\nfrom .command import command_args\nfrom .error import...
python
chosen
[ { "from": "system", "value": "Change saveSimulationProfiles to False in minimal_sensitivity\n\njust to test a diff parameter in this job\n" }, { "from": "human", "value": "# Data sources\ndatabase(\n thermoLibraries = ['primaryThermoLibrary'],\n reactionLibraries = [],\n seedMechanisms ...
python
chosen
[ { "from": "system", "value": "Add date min-max filtering to API\n" }, { "from": "human", "value": "# -*- coding: utf-8 -*-\nfrom __future__ import unicode_literals\n\nfrom django.contrib.auth.models import User\n\nfrom rest_framework import viewsets\n\nfrom core.models import Timesheet, Task, En...
python
chosen
[ { "from": "system", "value": "[language_activation] Add language code to cache key explicitly\n" }, { "from": "human", "value": "from functools import wraps\n\nfrom django.conf import settings\nfrom django.core.cache import cache\nfrom django.template.response import ContentNotRenderedError\nfro...
python
chosen
[ { "from": "system", "value": "Add necessary arguments to the social_csrf_token tag.\n" }, { "from": "human", "value": "from django import template\n\nregister = template.Library()\n\n@register.tag\ndef social_csrf_token():\n \"\"\"\n Wrapper around the ``{% csrf_token %}`` template tag to ...
python
chosen
[ { "from": "system", "value": "Improve OS compatibility for settings\n" }, { "from": "human", "value": "import os\n\nsettings = {}\ndomain = 'localhost:8080'\nframework = 'flask'\ndebug = False\nclearOnLoad = False\nemailOnRegister = False\nregistrationDisabled = False\ncacheDirectory = \"./Site/...
python
chosen
[ { "from": "system", "value": "Add passing test for default image\n" }, { "from": "human", "value": "from django.test import Client, TestCase\nfrom django.contrib.auth.models import User\n\nHOME = '/'\nREGISTER = '/accounts/register/'\nLOGIN = '/login'\nLOGOUT = '/logout'\n\n\nclass Unauthenticat...
python
chosen
[ { "from": "system", "value": "Test pyproject.toml integration using git\n\nSee #374.\n" }, { "from": "human", "value": "import sys\n\nfrom setuptools_scm.utils import do\n\n\ndef test_pyproject_support(tmpdir, monkeypatch):\n monkeypatch.delenv(\"SETUPTOOLS_SCM_DEBUG\")\n pkg = tmpdir.ensu...
python
chosen
[ { "from": "system", "value": "Refactor request mechanics into an internal method on BaseService\n" }, { "from": "human", "value": "import logging\nimport requests\n\nfrom .exceptions import APIError\nfrom .version import __version__\n\nlogger = logging.getLogger(__name__)\n\n\nclass BaseService(...
python
chosen
[ { "from": "system", "value": "Make PyTarget object work again\n\nWe now save a base64 encoded pickled version of the object.\n" }, { "from": "human", "value": "from ..target import Target\nimport hashlib\nimport dill\nimport joblib\n\nclass PyTarget(Target):\n def __init__(self, name, obj=Non...
python
chosen
[ { "from": "system", "value": "Update to make sure we log an error with an invalid key\n" }, { "from": "human", "value": "\"\"\"Handle auth and authz activities in bookie\"\"\"\nfrom pyramid.httpexceptions import HTTPForbidden\n\n\nclass Authorize(object):\n \"\"\"Context manager to check if t...
python
chosen
[ { "from": "system", "value": "Use continue in task loop\n" }, { "from": "human", "value": "from flask import Flask, jsonify, request\nfrom dotenv import load_dotenv, find_dotenv\nfrom twilio import twiml\n\n\nfrom Queue import Queue\nfrom threading import Thread\nfrom time import sleep\n\n\nload...
python
chosen
[ { "from": "system", "value": "Fix for new column names\n" }, { "from": "human", "value": "#!/usr/bin/env python\n# -*- coding: utf-8 -*-\n\nfrom downstream_node.config import config\nfrom downstream_node.models import Challenges\n\nfrom heartbeat import Heartbeat\nfrom downstream_node.startup im...
python
chosen
[ { "from": "system", "value": "Quit Blender after writing FBX\n" }, { "from": "human", "value": "# !/usr/bin/env python\n\n# Blender has moved to Python 3!\n\nimport sys\nimport os\nimport bpy\n\nfor sysarg in sys.argv:\n print(sysarg)\n\npy_args = sys.argv[sys.argv.index('--') + 1]\npy_args =...
python
chosen
[ { "from": "system", "value": "Bump version number for another release with ducktyping in it\n" }, { "from": "human", "value": "VERSION = (1, 0, 'alpha', 11)\n\n\ndef get_version(join=' ', short=False):\n \"\"\"\n Return the version of this package as a string.\n\n The version number is ...
python
chosen
[ { "from": "system", "value": "Add done result to replay\n" }, { "from": "human", "value": "import json\nfrom os import path\n\nfrom tota.game import Drawer\n\n\nclass JsonReplayDrawer(Drawer):\n def __init__(self, replay_dir):\n self.replay_dir = replay_dir\n\n def draw(self, game):...
python
chosen
[ { "from": "system", "value": "Make matplotlib work with TravisCI\n" }, { "from": "human", "value": "from mpf.main import main\n\n\n\ndef test_main():\n main()\n" }, { "from": "gpt", "value": "import matplotlib\nmatplotlib.use('Agg') # Not to use X server. For TravisCI.\n\nfrom mp...
python
chosen
[ { "from": "system", "value": "Test if default rotor encodes backwards properly\n" }, { "from": "human", "value": "import unittest\n\nfrom enigma import Enigma, Steckerbrett, Umkehrwalze, Walzen\n\n\nclass RotorTestCase(unittest.TestCase):\n def test_rotor_encoding(self):\n rotor = Walz...
python
chosen
[ { "from": "human", "value": "Make the test data accessible to the tests.\n" }, { "from": "gpt", "value": "import os\nfrom functools import partial\n\n\nTESTS_DIR = os.path.dirname(os.path.abspath(__file__))\n\nTEST_DATA_DIR = os.path.join(TESTS_DIR, 'test_data')\n\nAppEventTestXml = partial(open...
python
chosen
[ { "from": "system", "value": "Make sure .git test directory is removed on Windows\n" }, { "from": "human", "value": "import os\nimport shutil\nimport tempfile\nimport builtins\nimport subprocess\n\nimport pytest\n\nfrom rever import environ\n\n\n@pytest.fixture\ndef gitrepo(request):\n \"\"\"...
python
chosen
[ { "from": "system", "value": "Add basic file system storage\n" }, { "from": "human", "value": "import os\nimport os.path\nimport logging\nimport datetime\nfrom .base import Storage\nfrom ocds.storage.errors import InvalidPath\n\n\nlogger = logging.getLogger(__name__)\n\n\nclass FSStorage(Storage...
python
chosen
[ { "from": "system", "value": "Improve query patterns on node job list\n" }, { "from": "human", "value": "from __future__ import absolute_import\n\nfrom sqlalchemy.orm import joinedload\n\nfrom changes.api.base import APIView\nfrom changes.api.serializer.models.job import JobWithBuildSerializer\n...
python
chosen
[ { "from": "system", "value": "Add a stub task for fetch_feed\n" }, { "from": "human", "value": "from celery import Celery\n\n\nclass Tasks(object):\n\n def __init__(self, debug=False):\n self.app = Celery()\n self.app.conf.update(\n CELERY_ACCEPT_CONTENT=['json'],\n ...
python
chosen
[ { "from": "system", "value": "Make the default HTML textarea smaller\n" }, { "from": "human", "value": "\"\"\"\nPlugin providing a simple textarea where raw HTML, CSS and JS code can be\nentered.\n\nMost useful for people wanting to shoot themselves in the foot.\n\"\"\"\n\nfrom django.db import ...
python
chosen
[ { "from": "system", "value": "Remove 'b' classifer on FileToList's read() usage\n" }, { "from": "human", "value": "\"\"\"\nClass for FileToList\n\"\"\"\n\n\nclass FileToList(object):\n \"\"\"\n FileToList is a helper class used to import text files and turn them into\n lists, with each ...
python
chosen
[ { "from": "system", "value": "Add PickleEncoder to the public API\n" }, { "from": "human", "value": "__version__ = '1.16.14'\n\nfrom model import BaseModel\n\nfrom feature import Feature, JSONFeature, TextFeature, CompressedFeature, \\\n PickleFeature\n\nfrom extractor import Node, Graph, Agg...
python
chosen
[ { "from": "system", "value": "Add index on patient id\n" }, { "from": "human", "value": "from sqlalchemy import Column, Integer, ForeignKey, String\r\nfrom sqlalchemy.orm import relationship\r\nfrom sqlalchemy.dialects import postgresql\r\n\r\nfrom radar.database import db\r\nfrom radar.models.c...
python
chosen
[ { "from": "system", "value": "Replace sleep() with wait() forever after monitor registers, this ensures the python interpreter alive before app starts\n" }, { "from": "human", "value": "import sys\nimport os\nimport threading\nimport time\nsys.path.append(os.getcwd() + '/app_package')\nfrom Mon...
python
chosen
[ { "from": "system", "value": "Add problem admin URL to problem report email" }, { "from": "human", "value": "from django.core.mail import mail_managers\nfrom django.conf import settings\nfrom django.urls import reverse\nfrom django.template.loader import render_to_string\nfrom django.utils.trans...
python
chosen
[ { "from": "system", "value": "Convert a condensed distance matrix (pdist) into an upper triangular matrix\n" }, { "from": "human", "value": "\nimport numpy as np\n\n\ndef arctan_transform(array, thresh):\n return np.arctan(array/thresh)\n" }, { "from": "gpt", "value": "\nimport nu...
python
chosen
[ { "from": "system", "value": "Add the view serializer for the account model.\n" }, { "from": "human", "value": "from django.shortcuts import render\nfrom django.http import HttpResponse\n\nfrom .models import Greeting\n\n# Create your views here.\ndef index(request):\n return HttpResponse('He...
python
chosen
[ { "from": "system", "value": "Add note to update old similarities\n" }, { "from": "human", "value": "from django.shortcuts import get_object_or_404\nfrom rest_framework import permissions, viewsets\n\nfrom similarities.utils import get_similar\nfrom .models import Artist\nfrom similarities.model...
python
chosen
[ { "from": "system", "value": "Add a title to the story the story\n" }, { "from": "human", "value": "__version__ = '1.0.0'\n\nfrom story.story import BaseStory\nfrom . import print_method\n\n\nclass Story(BaseStory):\n\n name = 'hellopython'\n adventures = [\n print_method\n ]\n" ...
python
chosen
[ { "from": "system", "value": "Remove reference in docs to removed function.\n" }, { "from": "human", "value": "#! /usr/bin/env python\n\n\"\"\"Functions on iterators, optimised for case when iterators are sorted.\n\nNote sift_o is hidden as _sift_o at the moment because it is broken.\nPlease don...
python
chosen
[ { "from": "system", "value": "Add missing Node view import\n" }, { "from": "human", "value": "from django.conf.urls import url, include\nfrom rest_framework import routers\n\nimport service.authors.views\nimport service.friendrequest.views\nimport service.users.views\nimport service.posts.views\...
python
chosen
[ { "from": "system", "value": "Add argparse to turn on/off fullscreen behavior\n" }, { "from": "human", "value": "import pyglet\n\nfrom levels import GameOver, IntroScreen, TheGame\nfrom levels.levels import Levels\n\nwindow = pyglet.window.Window()#fullscreen=True)\n\nlevels = Levels([IntroScree...
python
chosen
[ { "from": "system", "value": "Define mock @profile decorator in builtins.\n" }, { "from": "human", "value": "# -*- coding: utf-8 -*-\n# flake8: noqa\n\n\"\"\"\nphy is an open source electrophysiological data analysis package in Python\nfor neuronal recordings made with high-density multielectrod...
python
chosen
[ { "from": "system", "value": "Normalize total rank by distance between start and end\n" }, { "from": "human", "value": "from os import environ\nfrom urllib2 import urlopen\nfrom math import log\n\nfrom flask import Flask, json, jsonify\napp = Flask(__name__)\n\nfrom hip import get_ranking_array\...
python
chosen
[ { "from": "system", "value": "Fix extension loading functional test\n\nCall the agent _report_state() before checking the report state itself\n\nChange-Id: Idbf552d5ca5968bc95b0a3c395499c3f2d215729\nCloses-Bug: 1658089\n" }, { "from": "human", "value": "# Copyright (c) 2016 Red Hat, Inc.\n# All ...
python
chosen
[ { "from": "system", "value": "Fix bug in data collection\n" }, { "from": "human", "value": "import bson.json_util\nfrom bson.objectid import ObjectId\nimport json\nimport sys\n\n\ndef main():\n node_table = {}\n\n while True:\n line = sys.stdin.readline()\n if not line:\n ...
python
chosen
[ { "from": "system", "value": "Format go to the new design\n" }, { "from": "human", "value": "from evolution_master.runners import pkg, download\n\n# Install for Arch\nwith pkg.pacman() as pkg_man:\n pkg_man.install('go')\n\n# Install for Debian & Ubuntu\nwith pkg.apt() as pkg_man:\n pkg_ma...
python
chosen
[ { "from": "system", "value": "Add new repo into repolist\n" }, { "from": "human", "value": "\"\"\"List of repositories to check.\"\"\"\n\nrepositories = [\n \"fabric8-analytics-common\",\n \"fabric8-analytics-server\",\n \"fabric8-analytics-worker\",\n \"fabric8-analytics-jobs\",\n ...
python
chosen
[ { "from": "system", "value": "Rename links from *book* to *tale*\n" }, { "from": "human", "value": "from django.conf.urls import url\nfrom . import views\n\nurlpatterns = [\n\turl(r'^$', views.tale_list, name='tale_list'),\n\turl(r'^create-book/(?P<tale_id>[0-9]+)$', views.create_book, name='cre...
python
chosen
[ { "from": "system", "value": "Change subtext on main page\n" }, { "from": "human", "value": "#! /usr/bin/env python2.7\nfrom django.views.generic import TemplateView\n\nclass HomeView(TemplateView):\n template_name = 'home.html'\n\n def get(self, request, *args, **kwargs):\n context...
python
chosen
[ { "from": "system", "value": "Change tested model name to VendorProduct\n" }, { "from": "human", "value": "from django.test import TestCase\nfrom django.conf import settings\nfrom phonenumber_field.modelfields import PhoneNumberField\n\nfrom whats_fresh.models import *\nfrom django.contrib.gis.d...
python
chosen
[ { "from": "system", "value": "Fix password env variable name\n" }, { "from": "human", "value": "# -*- coding: utf-8 -*-\nimport os\n\n\nclass Config(object):\n DEBUG = False\n TESTING = False\n REDIS_URI = 'redis://@localhost:6379/0'\n BASIC_AUTH_USERNAME = os.environ['RBM2M_LOGIN']\...
python
chosen
[ { "from": "system", "value": "Disable feeds/announcements temporarily, it should be back alive now\n" }, { "from": "human", "value": "# -*- coding: utf-8 -*-\n\nfrom django.conf.urls.defaults import patterns, include, url\nfrom django.conf import settings\nfrom django.contrib.staticfiles.urls im...
python
chosen
[ { "from": "system", "value": "tests: Fix typo in mock usage\n\nThe error was made evident by a newer mock version that no longer\nswallowed the wrong assert as regular use of a spec-less mock.\n" }, { "from": "human", "value": "from __future__ import absolute_import, unicode_literals\n\nfrom moc...
python
chosen
[ { "from": "system", "value": "Update view to use different imports/decorators\n\n1. We can generally expect the json module to be\n available now, so no need to use what ships with\n django\n2. require_POST is just simpler and more direct\n3. Using login_required is clearer as well instead\n of using ...
python
chosen
[ { "from": "system", "value": "Disable the polymer.load_topeka perf benchmark\n\nThere's something weird about this test or one of the other\ntest cases in the benchmark_smoke_unittest test suite that is\ncausing this test to hang when it is not run first.\n\nI'm disabling this test for now so we can move on...
python
chosen
[ { "from": "system", "value": "Make yaml fields lowercase in serfnode section" }, { "from": "human", "value": "import os\nimport uuid\n\nfrom mischief.actors.pipe import get_local_ip\nimport yaml\n\n\ndef read_serfnode_yml():\n with open('/serfnode.yml') as input:\n conf = yaml.load(inp...
python
chosen
[ { "from": "system", "value": "Add Edition model creation test\n" }, { "from": "human", "value": "from django.test import TestCase\nfrom .models import Author, Publisher, Edition, Setting, Adventure\n\n\nclass AuthorTests(TestCase):\n def test_create_author(self):\n gygax = Author.objec...
python
chosen
[ { "from": "system", "value": "Add extra space between cat emoji and text\n" }, { "from": "human", "value": "\"\"\"Print utilities\"\"\"\nimport os\nimport emoji\nfrom termcolor import colored\nfrom clowder.utility.git_utilities import (\n git_current_sha,\n git_current_branch,\n git_is_...
python
chosen
[ { "from": "system", "value": "Print project name even if it doesn't exist on disk\n" }, { "from": "human", "value": "\"\"\"Print utilities\"\"\"\nimport os\nimport emoji\nfrom termcolor import colored\nfrom clowder.utility.git_utilities import (\n git_current_sha,\n git_current_branch,\n ...
python
chosen
[ { "from": "system", "value": "Drop all tables after tests - looks like we're back in business.\n" }, { "from": "human", "value": "import tornado.testing\n\nfrom astral.api.app import NodeWebAPI\nfrom astral.models import drop_all, setup_all, create_all, session\n\n\nclass BaseTest(tornado.testin...
python
chosen
[ { "from": "system", "value": "Exit with 1 when the RPC generator tests fail\n" }, { "from": "human", "value": "#!/usr/bin/env python3\n\"\"\"\nMain entry point to run all tests\n\"\"\"\nimport sys\nfrom pathlib import Path\nfrom unittest import TestLoader, TestSuite, TextTestRunner\n\nPATH = Pat...
python
chosen
[ { "from": "human", "value": "Add utility function to commit database item\n" }, { "from": "gpt", "value": "#!/usr/bin/env python\n# -*- coding: utf-8 -*-\n\nfrom .common import session_scope\n\n\ndef commit_db_item(self, db_item):\n with session_scope() as session:\n session.merge(db_i...
python
chosen
[ { "from": "system", "value": "admin_base: Select latest event when logged in.\n" }, { "from": "human", "value": "# -*- coding: utf-8 -*-\n\nfrom django.http import HttpResponseRedirect\nfrom django.contrib.auth.decorators import login_required\n\n@login_required(login_url='/control/auth/login/')...
python
chosen
[ { "from": "system", "value": "Add people and music to the main URL configuration.\n" }, { "from": "human", "value": "from django.conf.urls import patterns, include, url\nfrom django.contrib import admin\n\nfrom components.views import SiteView\n\n# Uncomment the next two lines to enable the admi...
python
chosen
[ { "from": "system", "value": "Use proper package name for pbr\n" }, { "from": "human", "value": "# vim: tabstop=4 shiftwidth=4 softtabstop=4\n\n# Copyright (c) 2016 Cisco Systems, Inc.\n#\n# Permission is hereby granted, free of charge, to any person obtaining a copy\n# of this software and asso...
python
chosen
[ { "from": "system", "value": "Add content_type to search results JSON.\n" }, { "from": "human", "value": "from django.core.paginator import Paginator, EmptyPage, PageNotAnInteger\nfrom django.http import JsonResponse\nfrom django.shortcuts import render\n\nfrom wagtail.wagtailcore.models import ...
python
chosen
[ { "from": "system", "value": "Add Properties and Caliber Relationship Between Issue and Severity\n" }, { "from": "human", "value": "\nimport thunderdome\nfrom machete.base import BaseVertex, BaseEdge\n\nclass Issue(BaseVertex):\n description = thunderdome.String()\n\nclass Severity(BaseVertex...
python
chosen
[ { "from": "system", "value": "Make sure we have both images and not just one of them before building\n" }, { "from": "human", "value": "\"\"\"Handles all command line actions for Berth.\"\"\"\n\nimport berth.build as build\nimport berth.config as config\nimport berth.utils as utils\nimport click...
python
chosen
[ { "from": "system", "value": "Handle TypeError for python 3.4.\n" }, { "from": "human", "value": "from django import template\nfrom twitter.models import Tweet\n\nregister = template.Library()\n\n\n@register.assignment_tag\ndef latest_tweets(number_of_tweets=2):\n try:\n tweets = Tweet...
python
chosen
[ { "from": "system", "value": "Add an implicit wait of 1 second\n" }, { "from": "human", "value": "import os\n\nimport pytest\nfrom pyvirtualdisplay import Display\nfrom selenium.webdriver import Chrome\nfrom selenium.webdriver.chrome.options import Options\n\nREPORTS_DIR = \"reports\"\n\n\n@pyte...
python
chosen
[ { "from": "system", "value": "Disable caching of identical images\n" }, { "from": "human", "value": "import logging\n\nimport yorm\nfrom yorm.types import List, Object\n\n\nlog = logging.getLogger(__name__)\n\n\n@yorm.attr(items=List.of_type(Object))\n@yorm.sync(\"data/images/cache.yml\")\nclass...
python
chosen
[ { "from": "system", "value": "Remove all reference to molfiles plugins\n" }, { "from": "human", "value": "# -* coding: utf-8 -*\nimport os\nfrom ctypes import cdll\nfrom ctypes.util import find_library\n\nfrom chemfiles import ffi\n\nROOT = os.path.dirname(__file__)\n\n\ndef load_clib():\n ''...
python
chosen
[ { "from": "system", "value": "Check for empty files when merging benchmarks\n" }, { "from": "human", "value": "import pandas as pd\nimport argparse\nimport os\n\nif __name__=='__main__':\n \"\"\"\n Merge benchmark output for all scenarios, methods and settings\n \"\"\"\n\n parser = a...
python
chosen