conversations
listlengths
2
3
source
stringclasses
1 value
stack
stringclasses
1 value
[ { "from": "system", "value": "Fix deprecation warning for get_query_set\n\nget_query_set was renamed get_queryset in django 1.6\n" }, { "from": "human", "value": "from django.db import models\n\n\nclass BasisModelManager(models.Manager):\n def get_query_set(self):\n return super(BasisM...
python
chosen
[ { "from": "system", "value": "Remove unnecessary rename on input\n" }, { "from": "human", "value": "\"\"\"\nTest tools for the storage service.\n\"\"\"\n\nimport unittest\n\nfrom storage.storage import app as storage_app, db\n\n\nclass InMemoryStorageTests(unittest.TestCase):\n \"\"\"\n Se...
python
chosen
[ { "from": "system", "value": "Test the command class inheritance for each command.\n" }, { "from": "human", "value": "import pytest\n\nfrom pip._internal.commands import commands_dict, create_command\n\n\ndef test_commands_dict__order():\n \"\"\"\n Check the ordering of commands_dict.\n ...
python
chosen
[ { "from": "system", "value": "Use multiple context managers on one with statement (thanks Anna)\n" }, { "from": "human", "value": "import unittest.mock\n\n\ndef _test_module_init(module, main_name=\"main\"):\n with unittest.mock.patch.object(module, main_name, return_value=0):\n with u...
python
chosen
[ { "from": "system", "value": "Fix initial migration until ContentType is available\n" }, { "from": "human", "value": "# -*- coding: utf-8 -*-\nfrom django.contrib.contenttypes.models import ContentType\nfrom django.db.models.signals import post_save\nfrom django.dispatch import receiver\nfrom .t...
python
chosen
[ { "from": "system", "value": "Remove commented code and replace by improved comment\n" }, { "from": "human", "value": "import pytest\nfrom qtpy import PYSIDE2, PYSIDE6, PYQT5, PYQT6\n\ndef test_qtopengl():\n \"\"\"Test the qtpy.QtOpenGL namespace\"\"\"\n from qtpy import QtOpenGL\n\n as...
python
chosen
[ { "from": "system", "value": "Check that a certain date is invalid.\n\nThis distinguishes correctly between the proleptic Gregorian calendar, and the historical or astronomical calendars, where this date would be valid.\n" }, { "from": "human", "value": "import unittest\n\nfrom datetime import d...
python
chosen
[ { "from": "system", "value": "Add option to process SolverParameters.\n" }, { "from": "human", "value": "#! /usr/bin/env python\n\nimport Gen.caffe_pb2 as pb2\nimport google.protobuf.text_format as pb2_text\nimport sys\n\n\ndef binary_to_text(binary_file, text_file):\n msg = pb2.NetParameter(...
python
chosen
[ { "from": "system", "value": "Test the parsing of all of the uploaded Jaguar files\n" }, { "from": "human", "value": "import os\r\nfrom cclib.parser import Jaguar\r\n\r\nos.chdir(os.path.join(\"..\",\"data\",\"Jaguar\",\"basicJaguar\"))\r\n\r\nos.chdir(\"eg01\")\r\n\r\nfor file in [\"dvb_gopt.ou...
python
chosen
[ { "from": "system", "value": "Fix for Python 2.6 and Python 3.\n" }, { "from": "human", "value": "\"\"\"Like the raw_input built-in, but with bells and whistles.\"\"\"\n\nimport getpass\n\ndef user_input(field, default='', choices=None, password=False, empty_ok=False, accept=False):\n \"\"\"P...
python
chosen
[ { "from": "system", "value": "Use CuDNN implementation for ReLU on GPU\n" }, { "from": "human", "value": "import numpy\nimport pycuda.gpuarray as gpuarray\n\nfrom chain import Function\n\nclass ReLU(Function):\n \"\"\"Rectified Linear Unit.\"\"\"\n # TODO(beam2d): Implement in-place versio...
python
chosen
[ { "from": "system", "value": "Change statement text max-length to 255\n" }, { "from": "human", "value": "\"\"\"\nChatterBot constants\n\"\"\"\n\n'''\nThe maximum length of characters that the text of a statement can contain.\nThis should be enforced on a per-model basis by the data model for eac...
python
chosen
[ { "from": "system", "value": "Hide AbstractMethod class from the docs.\n" }, { "from": "human", "value": "#!/usr/bin/env python\n# Generates the *public* API documentation.\n# Remember to hide your private parts, people!\nimport os, re, sys\n\nproject = 'Exscript'\nbase_dir = os.path.join('..',...
python
chosen
[ { "from": "system", "value": "Ch20: Use login_required decorator in URL pattern.\n" }, { "from": "human", "value": "from django.conf.urls import url\n\nfrom ..views import (\n TagCreate, TagDelete, TagDetail, TagList,\n TagUpdate)\n\nurlpatterns = [\n url(r'^$',\n TagList.as_view...
python
chosen
[ { "from": "system", "value": "Check for Python 2.7 as well\n" }, { "from": "human", "value": "#!/usr/bin/env python\nimport os\nimport warnings\nwarnings.filterwarnings('ignore', category=DeprecationWarning)\n\n\ndef test_for_version(filename):\n stdin, stdout = os.popen4('%s -V' % filename, ...
python
chosen
[ { "from": "system", "value": "Add Runner unit-tests: constructor with validation.\n" }, { "from": "human", "value": "from .test_common import CommonTestCase\nfrom ..runner import Runner, RunnerForm\nfrom ..utils import xml_from_file\n\n\nclass RunnerTestCase(CommonTestCase):\n\n def setUp(sel...
python
chosen
[ { "from": "system", "value": "Fix super() call for python <= 3.2\n" }, { "from": "human", "value": "# -*- coding: utf-8 -*-\n\nimport six\n\nfrom formats import FormatBank, discover_json, discover_yaml\n\n\nformats = FormatBank()\n\ndiscover_json(formats, content_type='application/json')\ndiscov...
python
chosen
[ { "from": "system", "value": "Allow PiSense readings to be toggled on/off\n" }, { "from": "human", "value": "#!/usr/bin/env python3\n\nfrom Sensor import SenseController\nfrom KeyDispatcher import KeyDispatcher\nfrom Display import Display\nfrom DataLogger import SQLiteLogger\nimport time\n\n\nD...
python
chosen
[ { "from": "system", "value": "Remove spaces and set to lowercase\n" }, { "from": "human", "value": "\"\"\"\nVerseBot for reddit\nBy Matthieu Grieger\nverse.py\nCopyright (c) 2015 Matthieu Grieger (MIT License)\n\"\"\"\n\nclass Verse:\n \"\"\" Class that holds the properties and methods of a V...
python
chosen
[ { "from": "system", "value": "Change directory test to look for link, rather than just file name\n" }, { "from": "human", "value": "from echo_client import client\n\n\ndef test_ok():\n response = client('GET a_web_page.html HTTP/1.1').split('\\r\\n')\n first_line = response[0]\n assert ...
python
chosen
[ { "from": "system", "value": "Update release version to 0.6.1\n" }, { "from": "human", "value": "\"\"\"\nChatterBot is a machine learning, conversational dialog engine.\n\"\"\"\nfrom .chatterbot import ChatBot\n\n__version__ = '0.6.0'\n__author__ = 'Gunther Cox'\n__email__ = 'gunthercx@gmail.com...
python
chosen
[ { "from": "system", "value": "Make it work for Python 2\n\nGabbi is designed to work with both Python 2.7 and 3.4.\n" }, { "from": "human", "value": "\"\"\"Share utility functions.\"\"\"\n\nfrom urllib import parse\n\n\ndef get_route_value(environ, name):\n value = environ['wsgiorg.routing_ar...
python
chosen
[ { "from": "system", "value": "Fix the imports for Python 3\n" }, { "from": "human", "value": "from mdsxray import open_mdsdataset\nfrom gridops import GCMDataset\nfrom regridding import regrid_vertical\n" }, { "from": "gpt", "value": "from .mdsxray import open_mdsdataset\nfrom .grido...
python
chosen
[ { "from": "system", "value": "FIX opt_out prevention for mailchimp export\n" }, { "from": "human", "value": "##############################################################################\n#\n# Copyright (C) 2020 Compassion CH (http://www.compassion.ch)\n# Releasing children from poverty i...
python
chosen
[ { "from": "system", "value": "Make use of expanduser() more sane\n" }, { "from": "human", "value": "import logging\nimport logging.config\n\nLOG_CONFIG = {\n 'version': 1,\n 'formatters': {\n 'standard': {'format': 'voltron: [%(levelname)s] %(message)s'}\n },\n 'handlers': {\n...
python
chosen
[ { "from": "system", "value": "Add fs Opener based on the builtin FTPFS opener\n" }, { "from": "human", "value": "from __future__ import absolute_import\nfrom __future__ import unicode_literals\n\nfrom .sshfs import SSHFS\n" }, { "from": "gpt", "value": "from __future__ import absolut...
python
chosen
[ { "from": "system", "value": "Fix gemm calls in Softmax\n" }, { "from": "human", "value": "from .affine import Affine\nfrom ... import describe\nfrom ...describe import Dimension, Synapses, Biases\nfrom ...check import has_shape\nfrom ... import check\n\n\n@describe.attributes(\n W=Synapses(\...
python
chosen
[ { "from": "system", "value": "Add a render method to view that should be reimplemented\n" }, { "from": "human", "value": "#Abstract for all views\nclass View(object):\n def __init__(self):\n self._renderer = None" }, { "from": "gpt", "value": "#Abstract for all views\nclass...
python
chosen
[ { "from": "system", "value": "Add github and facebook oauth credentials.\n" }, { "from": "human", "value": "\" Production settings must be here. \"\n\nfrom .core import *\nfrom os import path as op\n\n\nSECRET_KEY = 'SecretKeyForSessionSigning'\nADMINS = frozenset([MAIL_USERNAME])\n\n# flask.ext...
python
chosen
[ { "from": "system", "value": "[AC-4857] Switch from () to __call__()\n" }, { "from": "human", "value": "from abc import (\n ABCMeta,\n abstractmethod,\n)\nfrom impact.v1.helpers import (\n STRING_FIELD,\n)\n\n\nclass BaseHistoryEvent(object):\n __metaclass__ = ABCMeta\n\n CLASS_FI...
python
chosen
[ { "from": "system", "value": "Split file collecting algorithm to FileFilter\n" }, { "from": "human", "value": "import os\nimport os.path\nimport re\nimport logging\nfrom pathlib import Path\n\nVIM_SCRIPT_FILE_NAME_PATTERNS = r'(?:[\\._]g?vimrc|.*\\.vim$)'\n\n\ndef build_environment(cmdargs):\n ...
python
chosen
[ { "from": "system", "value": "Store the basename of the generated files, to allow the unittests to\nclean up in the tearDown method.\n" }, { "from": "human", "value": "import os\nfrom ctypeslib.dynamic_module import include\nfrom ctypes import *\n\nif os.name == \"nt\":\n _libc = CDLL(\"msvcr...
python
chosen
[ { "from": "system", "value": "Add config items for server, timeout\n" }, { "from": "human", "value": "# Licensed under a 3-clause BSD style license - see LICENSE.rst\n\n\"\"\"\n<Put Your Tool Name Here>\n-------------------------\n\n:author: <your name> (<your email>)\n\"\"\"\n\n# Make the URL o...
python
chosen
[ { "from": "system", "value": "Use 'array' rather than 'real' for data array name in olfactory stimulus generation script.\n" }, { "from": "human", "value": "#!/usr/bin/env python\n\n\"\"\"\nGenerate sample olfactory model stimulus.\n\"\"\"\n\nimport numpy as np\nimport h5py\n\nosn_num = 1375\n\n...
python
chosen
[ { "from": "system", "value": "Disable pool generation by default\n" }, { "from": "human", "value": "import urllib2\n\n#Database settings\ndatabase_connect = \"dbname='ridprod'\"\nkv1_database_connect = \"dbname='kv1tmp'\"\niff_database_connect = \"dbname='ifftmp'\"\npool_generation_enabled = Tru...
python
chosen
[ { "from": "system", "value": "feat: Add drf serializer for environment variables\n" }, { "from": "human", "value": "from rest_framework import serializers\n\nfrom frigg.builds.serializers import BuildInlineSerializer\n\nfrom .models import Project\n\n\nclass ProjectSerializer(serializers.ModelSe...
python
chosen
[ { "from": "system", "value": "Make still class available when decorating class with @page\n" }, { "from": "human", "value": "#!/usr/bin/python\n# -*- encoding: utf-8 -*-\n\"\"\"\n\n\"\"\"\nimport inspect\nfrom tornado.web import Application\n\nfrom .Route import Route\nfrom .Index import IndexRo...
python
chosen
[ { "from": "system", "value": "Fix typo in doc string\n" }, { "from": "human", "value": "from django.db import models\nfrom django.utils.translation import ugettext_lazy as _\n\nfrom wagtail.wagtailcore.models import Page\n\n\nclass Category(Page):\n \"\"\"\n user oscars category as a wagta...
python
chosen
[ { "from": "system", "value": "Add utility function to convert a language code to a its full name\n" }, { "from": "human", "value": "\"\"\"Shared utility functions\"\"\"\n\nfrom django.template.defaultfilters import slugify as django_slugify\n\ndef slugify(value):\n \"\"\"\n Normalizes stri...
python
chosen
[ { "from": "system", "value": "Change the url patters from python_social_auth to social_django\n" }, { "from": "human", "value": "\"\"\"djangoTemplate URL Configuration\n\nThe `urlpatterns` list routes URLs to views. For more information please see:\n https://docs.djangoproject.com/en/1.10/top...
python
chosen
[ { "from": "system", "value": "Update basic test\nNow uses the new format by @BookOwl.\n" }, { "from": "human", "value": "import slither, pygame, time\n\n\nsnakey = slither.Sprite()\nsnakey.setCostumeByName(\"costume0\")\n\nSoExcited = slither.Sprite()\nSoExcited.addCostume(\"SoExcited.png\", \"a...
python
chosen
[ { "from": "system", "value": "Consolidate hasattr + getter to single statement with default value.\n" }, { "from": "human", "value": "# -*- coding: utf-8 -*-\n\nfrom flask import request\nfrom modularodm.storedobject import StoredObject as GenericStoredObject\nfrom modularodm.ext.concurrency imp...
python
chosen
[ { "from": "system", "value": "Make fitters available at main import level.\n" }, { "from": "human", "value": "from __future__ import division, absolute_import, print_function\n\nfrom ._version import __version__, __version_info__\n\nversion = __version__\n\nfrom .configuration import Configurati...
python
chosen
[ { "from": "system", "value": "Add Discord Admin for debugging.\n" }, { "from": "human", "value": "# -*- coding: utf-8 -*-\nfrom __future__ import unicode_literals\n\nfrom django.contrib import admin\nfrom . import models\n\n\n@admin.register(models.Notification)\nclass NotificationAdmin(admin.Mo...
python
chosen
[ { "from": "system", "value": "Add new changes to th branch\n" }, { "from": "human", "value": "import os\ndef get_project_path():\n root_dir = os.path.abspath(os.path.dirname(__file__))\n return root_dir" }, { "from": "gpt", "value": "import os\ndef get_project_path():\n root...
python
chosen
[ { "from": "system", "value": "Update to v3 of the auth0 client for the exception handling\n" }, { "from": "human", "value": "\ntry:\n from auth0.v2.exceptions import Auth0Error\nexcept ImportError: # pragma: no cover\n class Auth0Error(Exception):\n def __init__(self, status_code, ...
python
chosen
[ { "from": "system", "value": "REVERT remove application id validation\n" }, { "from": "human", "value": "import handlers.events as events\n\nAPPLICATION_ID = \"amzn1.ask.skill.dd677950-cade-4805-b1f1-ce2e3a3569f0\"\n\n\ndef lambda_handler(event, context):\n if event['session']['new']:\n ...
python
chosen
[ { "from": "system", "value": "[Discord] Remove Audio Already Done error\n\n" }, { "from": "human", "value": "\nfrom discord.ext.commands.errors import CommandError\n\nclass NotServerOwner(CommandError):\n\t'''Not Server Owner'''\n\tpass\n\nclass VoiceNotConnected(CommandError):\n\t'''Voice Not C...
python
chosen
[ { "from": "system", "value": "Add support for v2 endpoints in config.\n" }, { "from": "human", "value": "import json\n\nfrom go.vumitools.conversation.definition import (\n ConversationDefinitionBase, ConversationAction)\n\n\nclass ViewLogsAction(ConversationAction):\n action_name = 'view_...
python
chosen
[ { "from": "system", "value": "Add CustomizeBrowserOptions method to Metric base class\n\nBUG=271177\n\nReview URL: https://chromiumcodereview.appspot.com/22938004\n\ngit-svn-id: de016e52bd170d2d4f2344f9bf92d50478b649e0@217198 0039d316-1c4b-4281-b951-d872f2087c98\n" }, { "from": "human", "value":...
python
chosen
[ { "from": "system", "value": "Update crossfilter to gray/blue scheme\n\nSame as in https://vega.github.io/editor/#/examples/vega-lite/interactive_layered_crossfilter" }, { "from": "human", "value": "\"\"\"\nInteractive Crossfilter\n=======================\nThis example shows a multi-panel view o...
python
chosen
[ { "from": "system", "value": "Fix gzip test for Python 2.6\n" }, { "from": "human", "value": "import io\nimport os\n\nfrom ...tests.helper import pytest\nfrom .. import gzip\n\ndef test_gzip(tmpdir):\n fd = gzip.GzipFile(str(tmpdir.join(\"test.gz\")), 'wb')\n fd = io.TextIOWrapper(fd, enco...
python
chosen
[ { "from": "system", "value": "Change default value of checkpoint frequency\n\nThe default values of evaluation and checkpoint frequency are the same,\nand they are approximately equal to the number of steps in each epoch.\n" }, { "from": "human", "value": "# Data set split\nTRAIN_FRACTION = 0.75...
python
chosen
[ { "from": "system", "value": "Fix unit test for essentia dissonance\n" }, { "from": "human", "value": "#! /usr/bin/env python\n\nfrom unit_timeside import unittest, TestRunner\nfrom timeside.plugins.decoder.file import FileDecoder\nfrom timeside.core import get_processor\n\nfrom timeside.core.to...
python
chosen
[ { "from": "system", "value": "Print a line telling where the site is available at\n" }, { "from": "human", "value": "from http import server\nfrom socketserver import TCPServer\nimport os\n\n\nclass Server:\n def __init__(self, own_config, config, builder):\n self.directory = config.fo...
python
chosen
[ { "from": "system", "value": "Fix SSHOpener to use the new ClosingSubFS\n" }, { "from": "human", "value": "from ._base import Opener\nfrom ._registry import registry\n\n\n@registry.install\nclass SSHOpener(Opener):\n protocols = ['ssh']\n\n @staticmethod\n def open_fs(fs_url, parse_resu...
python
chosen
[ { "from": "system", "value": "Increase size of bottleneck layer.\n" }, { "from": "human", "value": "#!/usr/bin/env python\n\nimport matplotlib.pyplot as plt\nimport theanets\n\nfrom utils import load_mnist, plot_layers, plot_images\n\n\ntrain, valid, _ = load_mnist()\n\ne = theanets.Experiment(\...
python
chosen
[ { "from": "system", "value": "MNT: Rework the import finding logic\n" }, { "from": "human", "value": "import ast\n\n\ndef get_imported_libs(code):\n tree = ast.parse(code)\n # ast.Import represents lines like 'import foo' and 'import foo, bar'\n # the extra for name in t.names is needed...
python
chosen
[ { "from": "system", "value": "Fix add_page_if_missing context processor when no pages exist yet\n" }, { "from": "human", "value": "from feincms.module.page.models import Page\n\n\ndef add_page_if_missing(request):\n # If this attribute exists, the a page object has been registered already\n ...
python
chosen
[ { "from": "system", "value": "Allow for a longer image path\n\nMy profile image for example does not fit\nin the default VARCHAR(100)\n" }, { "from": "human", "value": "from django.db import models\nfrom django.core.urlresolvers import reverse\nfrom django.http import HttpResponseRedirect\n\ncla...
python
chosen
[ { "from": "system", "value": "Change page title and heading\n" }, { "from": "human", "value": "from flask import Flask\nfrom flask import render_template, url_for\n\nimport parse_data\n\napp = Flask(__name__)\n\n\n@app.route(\"/dashboard\")\ndef dashboard():\n data = parse_data.load_and_forma...
python
chosen
[ { "from": "system", "value": "Add function to create name strings with random characters\n\nIssues:\nFixes #48\n\nProblem: Need a function that will generate names with random chars.\n\nAnalysis: Added new function, random_name().\n\nTests: test_solution.py\n" }, { "from": "human", "value": "# C...
python
chosen
[ { "from": "system", "value": "Set icon, summary for notification\n" }, { "from": "human", "value": "#!/usr/bin/env python\n# -*- coding: utf-8 -*-\n\nimport datetime\nimport subprocess as spr\nimport time\n\n\ndef main():\n start = datetime.datetime.now()\n spr.call(['notify-send', 'Starte...
python
chosen
[ { "from": "system", "value": "Return proper WWW-Authenticate header if API authentication fails\n" }, { "from": "human", "value": "\"\"\"\nbyceps.blueprints.api.decorators\n~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\n\n:Copyright: 2006-2021 Jochen Kupperschmidt\n:License: Revised BSD (see `LICENSE` file f...
python
chosen
[ { "from": "system", "value": "Make Python example output identical to C++ and Java by removing redundant\nspaces.\n\n\n" }, { "from": "human", "value": "#! /usr/bin/python\n\n# See README.txt for information and build instructions.\n\nimport addressbook_pb2\nimport sys\n\n# Iterates though all p...
python
chosen
[ { "from": "system", "value": "Use dict() syntax that works in Python 2.6 onward\n" }, { "from": "human", "value": "from . import openmath as om\n\nopenmath_ns = \"http://www.openmath.org/OpenMath\"\n\nomtags = {\n \"OMOBJ\": om.OMObject,\n \"OMR\": om.OMReference,\n \"OMI\": om.OMIntege...
python
chosen
[ { "from": "system", "value": "Add real plugin state tests for plugins that always work (meta, containers, services).\n" }, { "from": "human", "value": "from contextlib import contextmanager\nfrom os import path\nfrom unittest import TestCase\n\nfrom canaryd_packages import six\nfrom dictdiffer i...
python
chosen
[ { "from": "system", "value": "Fix remaining load_suparsers typo instance" }, { "from": "human", "value": "from __future__ import absolute_import, unicode_literals\n\nimport argparse\nimport unittest\n\nfrom streamparse.cli import sparse\n\nfrom nose.tools import ok_\n\n\nclass SparseTestCase(uni...
python
chosen
[ { "from": "system", "value": "Make use of chained comparisons\n" }, { "from": "human", "value": "# Copyright (c) 2016 Renata Hodovan, Akos Kiss.\n#\n# Licensed under the BSD 3-Clause License\n# <LICENSE.rst or https://opensource.org/licenses/BSD-3-Clause>.\n# This file may not be copied, modifie...
python
chosen
[ { "from": "system", "value": "Add the minimum scalar value to the result of the InvertOperator\n\nWithout it, all results would be shifted so the minimum was 0.\n" }, { "from": "human", "value": "import tomviz.operators\n\nNUMBER_OF_CHUNKS = 10\n\n\nclass InvertOperator(tomviz.operators.Cancelab...
python
chosen
[ { "from": "system", "value": "Use common testHarness in derived projects\n" }, { "from": "human", "value": "from SCons.Script import *\n\n\ndef run_tests(env):\n import shlex\n import subprocess\n import sys\n\n cmd = shlex.split(env.get('TEST_COMMAND'))\n print('Executing:', cmd)...
python
chosen
[ { "from": "system", "value": "Add create_app method to __init__.py\n" }, { "from": "human", "value": "from flask import Flask, jsonify\nfrom modals.modals import User, Bucket, Item\nfrom api.__init__ import app, db\n\n\n@app.errorhandler(404)\ndef page_not_found(e):\n response = jsonify({'err...
python
chosen
[ { "from": "system", "value": "Correct env_key input argument default value\n" }, { "from": "human", "value": "# -*- coding: utf-8 -*-\nimport os\nimport os.path as op\nimport yaml\nimport logging.config\n\nfrom .text_files import read\nfrom ..config import LOG_LEVEL\n\nMODULE_NAME = __name__.spl...
python
chosen
[ { "from": "system", "value": "Reset the num threads to the env variable, not the default\n" }, { "from": "human", "value": "from numba.np.ufunc.parallel import get_thread_count\nfrom os import environ as env\nfrom numba.core import config\nimport unittest\n\n\nclass TestParallelEnvVariable(unitt...
python
chosen
[ { "from": "system", "value": "Fix linkage in the RSS feed\n" }, { "from": "human", "value": "\"\"\"\nGenerate an RSS feed of published crosswords from staff users.\n\nUses the built-in feed framework. There's no attempt to send the actual\ncrossword, it's just a message indicating that a new one...
python
chosen
[ { "from": "system", "value": "Fix overwriting resolution with empty text" }, { "from": "human", "value": "from django.contrib import admin\nfrom django.utils.html import format_html\nfrom django.urls import reverse\nfrom django.utils.translation import gettext_lazy as _\n\nfrom froide.helper.adm...
python
chosen
[ { "from": "system", "value": "Add __repr__() and __str__() to Result\n" }, { "from": "human", "value": "from ..util import cached_property\n\n\nclass Result:\n\n def __init__(self, return_code, stdout_data, stderr_data, encoding):\n self.return_code = return_code\n self.stdout_d...
python
chosen
[ { "from": "system", "value": "[tests] Remove test for deprecated createmultsig option\n" }, { "from": "human", "value": "#!/usr/bin/env python3\n# Copyright (c) 2017 The Bitcoin Core developers\n# Distributed under the MIT software license, see the accompanying\n# file COPYING or http://www.open...
python
chosen
[ { "from": "system", "value": "Revert keyword optimization for current release" }, { "from": "human", "value": "\"\"\"\n :copyright: (c) 2011 Local Projects, all rights reserved\n :license: Affero GNU GPL v3, see LICENSE for more details.\n\"\"\"\nfrom framework.controller import log\n\n# f...
python
chosen
[ { "from": "system", "value": "Write the critical multiplier or the range when the damage gets converted into a String\n" }, { "from": "human", "value": "from random import random\n\nclass Die:\n \"\"\"\n Abstracts the random dice throw. Roll will produce the result.\n The die can be fur...
python
chosen
[ { "from": "system", "value": "Add view mixin for working with filters in templates\n" }, { "from": "human", "value": "import json\n\nimport django\n\nfrom rules.contrib.views import PermissionRequiredMixin\n\n\nclass PermissionMixin(PermissionRequiredMixin):\n @property\n def raise_excepti...
python
chosen
[ { "from": "system", "value": "Fix a bug that would add updated control ip address instead of replace\n" }, { "from": "human", "value": "from pprint import pprint\nfrom netaddr import *\n\ndef merge(dbag, ip):\n added = False\n for dev in dbag:\n if dev == \"id\":\n continu...
python
chosen
[ { "from": "system", "value": "Fix test data for PyPackageRequirementsInspectionTest.testImportsNotInRequirementsTxt.\n" }, { "from": "human", "value": "import pip\nimport <weak_warning descr=\"Package 'opster' is not listed in project requirements\">opster</weak_warning>\nfrom <weak_warning desc...
python
chosen
[ { "from": "system", "value": "Add team project list to docs\n" }, { "from": "human", "value": "from __future__ import absolute_import\n\nfrom rest_framework import serializers, status\nfrom rest_framework.response import Response\n\nfrom sentry.api.bases.team import TeamEndpoint\nfrom sentry.api...
python
chosen
[ { "from": "system", "value": "Switch Swift trunk to 1.4.1, now that the 1.4.0 release branch is branched out.\n" }, { "from": "human", "value": "import gettext\n\n\nclass Version(object):\n def __init__(self, canonical_version, final):\n self.canonical_version = canonical_version\n ...
python
chosen
[ { "from": "system", "value": "Correct path to frontend views\n" }, { "from": "human", "value": "from flask import Flask\nfrom flaskext.redis import Redis\n\ndef create_app():\n from codesharer.apps.classifier.views import frontend\n\n app = Flask(__name__)\n app.config.from_object('code...
python
chosen
[ { "from": "system", "value": "Exclude Fast test for Python 2\n" }, { "from": "human", "value": "import unittest\n\ntry:\n import spotpy\nexcept ImportError:\n import sys\n sys.path.append(\".\")\n import spotpy\n\n\nfrom spotpy.examples.spot_setup_hymod_python import spot_setup\n\n\n...
python
chosen
[ { "from": "system", "value": "Update minimum support boto version.\n\nboto 2.20.0 introduces kinesis. alternatively, this requirement could be\nrelaxed by using conditional imports.\n" }, { "from": "human", "value": "#!/usr/bin/env python\nfrom __future__ import unicode_literals\nfrom setuptool...
python
chosen
[ { "from": "system", "value": "Add another missing heroku config variable\n" }, { "from": "human", "value": "\"\"\"\nFile to easily switch between configurations between production and\ndevelopment, etc.\n\"\"\"\n\nimport os\n\n\n# You must set each of these in your heroku environment with the he...
python
chosen
[ { "from": "system", "value": "Remove carriage returns from the output\n" }, { "from": "human", "value": "#!/usr/bin/env python\n# Copyright 2014 Boundary, 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 Licen...
python
chosen
[ { "from": "system", "value": "Remove old views and replace with new PasswordResetConfirmView\n" }, { "from": "human", "value": "from django.conf.urls import patterns, url\n\nfrom cellcounter.accounts import views\n\nurlpatterns = patterns('',\n url('^new/$', views.RegistrationView.as_view(), ...
python
chosen
[ { "from": "system", "value": "Use new MainApplication Tk class.\n" }, { "from": "human", "value": "import extractor.ui.mainapplication as ui\nimport Tkinter as tk\n\ndef main():\n root = tk.Tk()\n root.title('SNES Wolfenstein 3D Extractor')\n root.minsize(400, 100)\n ui.MainApplicati...
python
chosen
[ { "from": "system", "value": "Fix exit code of unittest.\n" }, { "from": "human", "value": "# TODO: Test robustness, test speed\nimport unittest, time, sys\nfrom common_conf import *\nfrom test_server import EchoServer, MessageServer\nimport argparse\nimport threading\nfrom test_server import Te...
python
chosen
[ { "from": "system", "value": "Add __all__ in exceptions module." }, { "from": "human", "value": "class YubicoError(Exception):\n \"\"\" Base class for Yubico related exceptions. \"\"\"\n pass\n\n\nclass StatusCodeError(YubicoError):\n def __init__(self, status_code):\n self.statu...
python
chosen
[ { "from": "system", "value": "Add trailing slash to /docs/api/ url pattern. This provides more flexibility for end users in that they can choose to navigate to /docs/api or /docs/api/ successfully. Without the trailing slash in the url pattern, /docs/api/ returns a 404.\n" }, { "from": "human", ...
python
chosen
[ { "from": "system", "value": "Fix an error in __unicode__\n\n__unicode__ name displaying incorrectly - FIXED\n" }, { "from": "human", "value": "# -*- coding: utf-8 -*-\n\nfrom django.db import models\nfrom phonenumber_field.modelfields import PhoneNumberField\n\n\nclass Caller(models.Model):\n ...
python
chosen
[ { "from": "system", "value": "Fix did not return HttpResponse when comment\n" }, { "from": "human", "value": "from django.views.generic.detail import ContextMixin\nfrom django.utils.decorators import method_decorator\nfrom django.contrib.auth.decorators import login_required\n\nfrom apps.categor...
python
chosen
[ { "from": "system", "value": "Remove reference to old, bad migration that was in my local tree.\n" }, { "from": "human", "value": "# -*- coding: utf-8 -*-\n# Generated by Django 1.9.13 on 2018-07-24 22:43\nfrom __future__ import unicode_literals\n\nimport django.contrib.postgres.fields.jsonb\nfr...
python
chosen
[ { "from": "system", "value": "Fix args manipulation in when translating ksdefs\n" }, { "from": "human", "value": "class APIMismatch(Exception):\n pass\n\ndef translateArgs(request, api_version):\n args = request.args\n if request.method == 'system_add_keyspace' \\\n or request.method...
python
chosen
[ { "from": "system", "value": "Set the default prefix for ProjectSurveys to gsoc_program.\n" }, { "from": "human", "value": "#!/usr/bin/python2.5\n#\n# Copyright 2009 the Melange authors.\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may not use this file except i...
python
chosen