conversations
listlengths
2
3
source
stringclasses
1 value
stack
stringclasses
1 value
[ { "from": "system", "value": "Remove print statement so Stephan won't be annoyed anymore\n" }, { "from": "human", "value": "from flask import Markup\nfrom flask import render_template\n\nfrom application.page.models import Page\n\ndef find_subpages(pages, parent):\n\tsubpages = []\n\n\tfor page ...
python
chosen
[ { "from": "system", "value": "Add help text for plugin enable option\n" }, { "from": "human", "value": "from haas.utils import uncamelcase\nfrom .i_plugin import IPlugin\n\n\nclass BasePlugin(IPlugin):\n\n name = None\n enabled = False\n enabling_option = None\n\n def __init__(self, ...
python
chosen
[ { "from": "system", "value": "Add more NTC unit tests\n" }, { "from": "human", "value": "#!/usr/bin/env python3\n# -*- coding: utf-8 -*-\nfrom numpy.testing import assert_approx_equal, assert_allclose, assert_array_less\nfrom nose.tools import raises, assert_true, assert_equal\nfrom UliEngineeri...
python
chosen
[ { "from": "system", "value": "Use urls without a slash in project/media project/support\n\nBB-7765 #resolve\n" }, { "from": "human", "value": "from bluebottle.projects.views import ProjectMediaDetail, ProjectSupportDetail\nfrom ..views import (\n ManageProjectBudgetLineDetail, ManageProjectBu...
python
chosen
[ { "from": "system", "value": "Fix botos rudeness when handling nonexisting files.\n" }, { "from": "human", "value": "#!/usr/bin/env python\n\nimport pytest\n\nboto = pytest.importorskip('boto')\nfrom simplekv.net.botostore import BotoStore\n\nfrom basic_store import BasicStore\nfrom url_store im...
python
chosen
[ { "from": "system", "value": "Use cluster length of 3\n" }, { "from": "human", "value": "\nimport random\n\n__metaclass__ = type\n\nclass Generator:\n def __init__(self, data):\n if isinstance(data, str):\n data = data.split('\\n')\n self.clusters = []\n for it...
python
chosen
[ { "from": "system", "value": "Use CTR as encrypton mode. Works with iOS6.\n" }, { "from": "human", "value": "from Crypto.Cipher import AES\n\nclass Cryptor(object):\n\n\tdef __init__(self, key, iv):\n\t\t#self.aes = AES.new(key, mode=AES.MODE_CBC, IV=iv) # This resembles stuff from shairtunes\n\...
python
chosen
[ { "from": "system", "value": "Correct mocked response from Asana API\n" }, { "from": "human", "value": "import json\n\nfrom .oauth import OAuth2Test\n\n\nclass AsanaOAuth2Test(OAuth2Test):\n backend_path = 'social_core.backends.asana.AsanaOAuth2'\n user_data_url = 'https://app.asana.com/ap...
python
chosen
[ { "from": "system", "value": "Remove auth_request as no used\n\nFunction auth_request() isn't be used, it can be removed for the\ncode clean.\n\nChange-Id: I979b67e934c72f50dd62c75ac614f99f136cfeae\n" }, { "from": "human", "value": "# Copyright 2014 Hewlett-Packard Development Company, L.P.\n# A...
python
chosen
[ { "from": "system", "value": "Check if classes are derived from object\n\nThis makes sure we don't regress to old style classes\n" }, { "from": "human", "value": "#!/usr/bin/python\n\nimport libvirt\n\nglobals = dir(libvirt)\n\n# Sanity test that the generator hasn't gone wrong\n\n# Look for cor...
python
chosen
[ { "from": "system", "value": "fix: Use different import for better testing\n" }, { "from": "human", "value": "\"\"\"AWS Spinnaker Application.\"\"\"\nfrom pprint import pformat\nfrom foremast.app.base import BaseApp\nfrom foremast.utils import wait_for_task\n\n\nclass SpinnakerApp(BaseApp):\n ...
python
chosen
[ { "from": "system", "value": "Add the helper to the default\n" }, { "from": "human", "value": "import os\nimport requests\nimport json\nfrom flask import Flask, jsonify, abort, make_response, request\n\nFLICKR_BASE = \"http://api.flickr.com/services/rest/\"\n\napp = Flask(__name__)\n\nif __name_...
python
chosen
[ { "from": "system", "value": "MISC: Add back the extra requires for the [app]\n\n\n" }, { "from": "human", "value": "INFO = {\n 'name': 'Mayavi',\n 'version': '3.4.1',\n 'install_requires': [\n 'AppTools >= 3.4.1.dev',\n 'Traits >= 3.6.0.dev',\n ],\n}\n" }, { "f...
python
chosen
[ { "from": "system", "value": "Fix for OPTIONS method to an instance\n\nOPTIONS /track/1\nTypeError: options() got an unexpected keyword argument 'track_id'\n" }, { "from": "human", "value": "from flask import current_app as app, Response\nfrom flask.ext import restful\n\nfrom shiva.decorators im...
python
chosen
[ { "from": "system", "value": "Fix bug where only PDF files in current directory can be found\n" }, { "from": "human", "value": "\"\"\"Main Module of PDF Splitter\"\"\"\nimport argparse\nimport os\n\nfrom PyPDF2 import PdfFileWriter\n\nfrom Util import all_pdf_files_in_directory, split_on_conditi...
python
chosen
[ { "from": "system", "value": "Add the support for custom setting given by bash script (run as \"python_script.py sizeOfDataset numOfEpochs nameOfExp\")\n" }, { "from": "human", "value": "import keras\nfrom DatasetHandler.CreateDataset import *\nfrom ModelHandler.CreateModel.functions_for_vgg16 i...
python
chosen
[ { "from": "system", "value": "Remove commented out code that isn't needed\n" }, { "from": "human", "value": "from django.db.models.signals import post_save\nfrom django.dispatch import receiver\nfrom django.contrib.auth.models import User\nfrom imagerprofile.models import ImagerProfile\n\n\n@rec...
python
chosen
[ { "from": "system", "value": "Support for text input via args.\n\n 1. better help message\n 2. support for input arguments\n 3. better defaults\n 4. columnar display of fonts\n" }, { "from": "human", "value": "#!/usr/bin/env python\n\nimport sys\nfrom pyfiglet import Figlet\nfrom opt...
python
chosen
[ { "from": "system", "value": "Fix imports on Python <= 3.8\n" }, { "from": "human", "value": "from __future__ import annotations\n\nfrom collections.abc import Iterable, Mapping\nfrom typing import Any, Callable, Dict, Tuple\n\nfrom typing_extensions import TypeAlias\nfrom werkzeug.wrappers impo...
python
chosen
[ { "from": "system", "value": "Add an dummy import statement so that freeze programs pick up _internal.p\n" }, { "from": "human", "value": "\nfrom info import __doc__\nfrom numpy.version import version as __version__\n\nimport multiarray\nimport umath\nimport numerictypes as nt\nmultiarray.set_ty...
python
chosen
[ { "from": "system", "value": "Add a `ECS` ami ids as a region mapping\n" }, { "from": "human", "value": "from troposphere import (\n Parameter,\n Ref,\n)\n\nfrom troposphere.ecs import (\n Cluster,\n)\n\nfrom .template import template\n\n\ncontainer_instance_type = Ref(template.add_para...
python
chosen
[ { "from": "system", "value": "Fix missing __init__ in native directory\n" }, { "from": "human", "value": "\"\"\"\n\nThis script downloads and updates the module builder.\n\n\"\"\"\n\n\n# Dont checkout all files\nIGNORE_FILES = [\n \"__init__.py\",\n \".gitignore\",\n \"LICENSE\",\n \...
python
chosen
[ { "from": "system", "value": "Tweak the wording just a bit\n" }, { "from": "human", "value": "class OrganizationMixin(object):\n \"\"\"\n Adds a generic ``organization`` property to the class\n\n This requires that the class mixing it in adds an\n ``ORGANIZATION_NAME`` property of th...
python
chosen
[ { "from": "human", "value": "Divide collocations package into submodules\n" }, { "from": "gpt", "value": "\"\"\"\nThis module contains classes to find collocations between datasets. They are\ninspired by the implemented CollocatedDataset classes in atmlab written by\nGerrit Holl.\n\nTODO: I woul...
python
chosen
[ { "from": "system", "value": "Remove BaseListingMixin as superclass for SubmissionListingMixin\n" }, { "from": "human", "value": "\"\"\"Provide the SubmissionListingMixin class.\"\"\"\nfrom ....const import API_PATH\nfrom ..generator import ListingGenerator\nfrom .base import BaseListingMixin\nf...
python
chosen
[ { "from": "system", "value": "Clear warnings and errors when type checking passes\n" }, { "from": "human", "value": "from app.questionnaire_state.item import Item\n\n\nclass Answer(Item):\n def __init__(self, id):\n super().__init__(id=id)\n # typed value\n self.value = N...
python
chosen
[ { "from": "system", "value": "Add MPD_SERVER_PASSWORD to list of relevant frontend settings\n" }, { "from": "human", "value": "import logging\n\nfrom mopidy.frontends.base import BaseFrontend\nfrom mopidy.frontends.mpd.dispatcher import MpdDispatcher\nfrom mopidy.frontends.mpd.thread import MpdT...
python
chosen
[ { "from": "system", "value": "Fix bug: continue running when fail to open file\n" }, { "from": "human", "value": "#--coding:utf-8--\n#StartPage.py\n#Create/Edit file:'../cfg/StartPage.json'\nimport os\nimport re\nimport sys\nimport json\nfrom __common__code__ import CreateFile\nfrom __tmpl__ imp...
python
chosen
[ { "from": "system", "value": "Handle different default encoding on Windows in tests\n" }, { "from": "human", "value": "import pytest\nfrom in_place import InPlace\nfrom test_in_place_util import UNICODE, pylistdir\n\ndef test_py3_textstr(tmpdir):\n \"\"\" Assert that `InPlace` w...
python
chosen
[ { "from": "system", "value": "Allow specifying which unit-tests to run\n\ne.g. 0test ../0release.xml -- testrelease.TestRelease.testBinaryRelease\n" }, { "from": "human", "value": "#!/usr/bin/env python\nimport unittest, os, sys\ntry:\n\timport coverage\n\tcoverage.erase()\n\tcoverage.start()\ne...
python
chosen
[ { "from": "system", "value": "Use the right way to limit queries\n" }, { "from": "human", "value": "from django import template\n\nfrom fullcalendar.models import Occurrence\n\nregister = template.Library()\n\n@register.inclusion_tag('events/agenda_tag.html')\ndef show_agenda(*args, **kwargs):\n...
python
chosen
[ { "from": "system", "value": "10: Test all scripts on Windows \n\nTask-Url: http://github.com/stoeps13/ibmcnx2/issues/issue/10" }, { "from": "human", "value": "######\n# Create a backup of J2EE Security Roles\n#\n# Author: Christoph Stoettner\n# Mail: christoph.stoettner@stoep...
python
chosen
[ { "from": "system", "value": "Set Account logo_color to be read only" }, { "from": "human", "value": "from rest_framework import serializers\n\nfrom ..utils.fields import DomainNameField\nfrom .fields import SignupDomainsField\nfrom .models import Account\n\n\nclass ValidateSignupDomainsSerializ...
python
chosen
[ { "from": "system", "value": "Change number-jokes to match the tutorial.\n" }, { "from": "human", "value": "import random\nfrom botfriend.bot import TextGeneratorBot\n\nclass ExampleBot(TextGeneratorBot):\n\n def generate_text(self):\n \"\"\"Tell a joke about numbers.\"\"\"\n nu...
python
chosen
[ { "from": "system", "value": "Add vendor and patch directories to pew path\n\n- Fixes #1661\n" }, { "from": "human", "value": "from pipenv.patched import pew\n\nif __name__ == '__main__':\n pew.pew.pew()\n" }, { "from": "gpt", "value": "from pipenv.patched import pew\nimport os\ni...
python
chosen
[ { "from": "human", "value": "Add structure and methods to double linked list.\n" }, { "from": "gpt", "value": "class Node(object):\n def __init__(self, val, prev=None, next_=None):\n self.val = val\n self.prev = prev\n self.next = next_\n\n def __repr__(self):\n ...
python
chosen
[ { "from": "system", "value": "Change the notifier to be sent on finish_bundle instead of teardown\n\nChange-Id: I6b80b1d0431b0fe285a5b59e9a33199bf8bd3510\n" }, { "from": "human", "value": "# Copyright 2022 Google LLC\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you ...
python
chosen
[ { "from": "system", "value": "Add arg --https even for non-443.\n" }, { "from": "human", "value": "import gevent.monkey\ngevent.monkey.patch_all()\n\nimport logging\nhandler = logging.StreamHandler()\nlog_format = '{levelname}:etiquette.{module}.{funcName}: {message}'\nhandler.setFormatter(loggi...
python
chosen
[ { "from": "system", "value": "antler: Use custom theme by default.\n" }, { "from": "human", "value": "from caribou.settings.setting_types import *\nfrom caribou.i18n import _\n\nAntlerSettings = SettingsTopGroup(\n _(\"Antler Preferences\"), \"/org/gnome/antler/\", \"org.gnome.antler\",\n ...
python
chosen
[ { "from": "system", "value": "Add check for isdir to handle non-directories\n" }, { "from": "human", "value": "# encoding: utf-8\nfrom __future__ import absolute_import, print_function, division\n\nimport os\nimport subprocess\n\nfrom pebble_tool.exceptions import ToolError\nfrom pebble_tool.uti...
python
chosen
[ { "from": "system", "value": "Remove mention of 'apache example'\n\nRemoved explicit mention of 'apache'" }, { "from": "human", "value": "# Copyright (c) 2015 Ansible, Inc\n#\n# This file is part of Ansible\n#\n# Ansible is free software: you can redistribute it and/or modify\n# it under the ter...
python
chosen
[ { "from": "system", "value": "Correct documentation for path to load test runner" }, { "from": "human", "value": "from __future__ import absolute_import\n\nfrom django.conf import settings\nfrom django.test.simple import DjangoTestSuiteRunner\n\nUSAGE = \"\"\"\\\nCustom test runner to allow test...
python
chosen
[ { "from": "system", "value": "Replace quota deletion with cleanup [WAL-433]\n" }, { "from": "human", "value": "# -*- coding: utf-8 -*-\nfrom __future__ import unicode_literals\n\nfrom django.contrib.contenttypes.models import ContentType\nfrom django.db import migrations\n\nfrom nodeconductor.qu...
python
chosen
[ { "from": "system", "value": "Refactor get_default_finder to work without importing finders\n" }, { "from": "human", "value": "from django.utils.module_loading import import_string\nfrom django.conf import settings\n\nfrom wagtail.wagtailembeds.finders.oembed import oembed\nfrom wagtail.wagtaile...
python
chosen
[ { "from": "system", "value": "Remove new modes for testing.\n" }, { "from": "human", "value": "from python_cowbull_game.GameController import GameController\nfrom python_cowbull_game.GameMode import GameMode\n\n\nclass ExtGameController(GameController):\n additional_modes = [\n GameMod...
python
chosen
[ { "from": "system", "value": "Use correct named view for organization detail view\n" }, { "from": "human", "value": "from django.contrib.auth.models import User\nfrom django.db import models\nfrom uuidfield.fields import UUIDField\nfrom storybase.fields import ShortTextField\n\nclass Organizatio...
python
chosen
[ { "from": "system", "value": "Update migration script so it only runs if executed as a script. Also updated module references.\n" }, { "from": "human", "value": "from pmxbot import logging\nfrom pmxbot import util\nfrom pmxbot import rss\nfrom pmxbot import storage\nstorage.migrate_all('sqlite:p...
python
chosen
[ { "from": "system", "value": "Handle the case of an empty path\n\nThis will deal with the root domain request going to default page." }, { "from": "human", "value": "import boto3\nimport botocore\nfrom flask import (\n abort,\n current_app,\n flash,\n make_response,\n redirect,\n ...
python
chosen
[ { "from": "system", "value": "Fix test string (Confirmed that incorrect string fails on CI)\n" }, { "from": "human", "value": "from subprocess import Popen, PIPE\nimport json\nimport platform\n\n# Remove \"sys.exit\" after feedstock creation when running\n# on linux-anvil-cos7-x86_64 image\nif p...
python
chosen
[ { "from": "system", "value": "Revert \"output flask logging into simpledaemon's log file.\"\n\nThis is completely superfluous - logging does this already\nautomatically.\n\nThis reverts commit 18091efef351ecddb1d29ee7d01d0a7fb567a7b7.\n" }, { "from": "human", "value": "\nimport logging\n\nimport...
python
chosen
[ { "from": "system", "value": "Fix typo in users autocomplete\n" }, { "from": "human", "value": "import autocomplete_light\nfrom models import User\n\n\nclass UserAutocomplete(autocomplete_light.AutocompleteModelBase):\n search_fields = ['username']\n\n def choices_for_request(self, *args, ...
python
chosen
[ { "from": "system", "value": "Make done a top-level function rather than a nested one.\n" }, { "from": "human", "value": "#!/usr/bin/env python\n\nimport sys\n\nfrom twisted.internet import reactor, defer\nfrom twisted.internet.protocol import ClientCreator\nfrom twisted.protocols import amp\nfr...
python
chosen
[ { "from": "system", "value": "Update sub-plugin example - Require restart on install\n" }, { "from": "human", "value": "# coding=utf-8\nfrom __future__ import absolute_import\n\n__author__ = \"Shawn Bruce <kantlivelong@gmail.com>\"\n__license__ = \"GNU Affero General Public License http://www.gn...
python
chosen
[ { "from": "system", "value": "Return exception for non ajax\n" }, { "from": "human", "value": "import json\n\nfrom django.http import HttpResponse\nfrom django.conf import settings\n\n\nclass AjaxExceptionMiddleware(object):\n\n def process_exception(self, request, exception):\n respon...
python
chosen
[ { "from": "system", "value": "Make the url name for autosuggest clearer\n" }, { "from": "human", "value": "from django.conf.urls import url\nfrom django.contrib.admin.views.decorators import staff_member_required\n\nfrom winthrop.people.views import ViafAutoSuggest\n\n\nurlpatterns = [\n url(...
python
chosen
[ { "from": "system", "value": "Fix to the Build and Run script\n" }, { "from": "human", "value": "import os\nimport subprocess\n\n# Update to the latest version\nfor line in os.popen('git fetch -p -q; git merge -q origin/master').readlines():\n print line.strip()\n \n# Move the old version ...
python
chosen
[ { "from": "system", "value": "Remove whitespace around brackets in example code\n" }, { "from": "human", "value": "#!/usr/bin/env python\n\"\"\"Generate fixtures.\"\"\"\n\nimport os\nimport json\nimport numpy as np\nfrom scipy import special\n\n\n# Get the file path:\nFILE = os.path.realpath(__f...
python
chosen
[ { "from": "system", "value": "Make uvloop except be explicit ImportError\n" }, { "from": "human", "value": "#!/usr/bin/env python3.6\nimport argparse\nimport asyncio\nimport logging\nimport sys\nfrom pathlib import Path\nfrom MoMMI.logsetup import setup_logs\n\n# Do this BEFORE we import master,...
python
chosen
[ { "from": "system", "value": "Change the MainHandler to Schedule_Handler and changed the “/“ to “/schedule”\n" }, { "from": "human", "value": "# Import blockmodels file\nimport BlockModels\nimport webapp2, jinja2, os\nfrom datetime import *\n\njinja_environment = jinja2.Environment(autoescape=Tr...
python
chosen
[ { "from": "system", "value": "Add helpers for nested attributes\n\ngetattrpath is for nested retrieval (getting obj.a.b.c with\ngetattrpath(obj, 'a.b.c))\n\nprefix_keys generates key, value pairs with the prefix prepended to each\nkey.\n" }, { "from": "human", "value": "import collections\n\n\nd...
python
chosen
[ { "from": "system", "value": "Replace lambda with higher-order function\n" }, { "from": "human", "value": "import sys\nfrom itertools import imap\nfrom collections import Counter\n\n\nclass Room:\n pass\n\ndef parse_room(s):\n last_dash = s.rfind(\"-\")\n after_name = s[last_dash+1:]\n ...
python
chosen
[ { "from": "system", "value": "4: Create script to save documentation to a file \n\nTask-Url: http://github.com/stoeps13/ibmcnx2/issues/issue/4" }, { "from": "human", "value": "import ibmcnx.filehandle\n\nemp1 = ibmcnx.filehandle.Ibmcnxfile()\n\nemp1.writeToFile( execfile('ibmcnx/doc/JVMSettings....
python
chosen
[ { "from": "system", "value": "bears/julia: Add Skip Condition for JuliaBear\n\nAdd prerequisite_command and prerequisite_fail_msg\nto JuliaBear.\n\nFixes https://github.com/coala-analyzer/coala-bears/issues/222\n" }, { "from": "human", "value": "from coalib.bearlib.abstractions.Lint import Lint\...
python
chosen
[ { "from": "system", "value": "Remove unnecessary 'import views' line\n" }, { "from": "human", "value": "from django.conf.urls.defaults import *\nfrom mozorg.util import page\nimport views\n\nurlpatterns = patterns('',\n page('', 'persona/persona.html'),\n page('about', 'persona/about.html'...
python
chosen
[ { "from": "system", "value": "Add __version__=None if no VERSION found\n\n" }, { "from": "human", "value": "from datalogger import api\nfrom datalogger import analysis\nfrom datalogger import acquisition\nfrom datalogger import analysis_window, acquisition_window\n#from datalogger.api import wor...
python
chosen
[ { "from": "system", "value": "Fix thirdparty imports for Python3\n" }, { "from": "human", "value": "try:\n from ordereddict import OrderedDict\nexcept:\n from sleekxmpp.thirdparty.ordereddict import OrderedDict\n" }, { "from": "gpt", "value": "try:\n from collections import ...
python
chosen
[ { "from": "system", "value": "Fix import statement in Python 3\n" }, { "from": "human", "value": "# bdateutil\n# -----------\n# Adds business day logic and improved data type flexibility to\n# python-dateutil.\n#\n# Author: ryanss <ryanssdev@icloud.com>\n# Website: https://github.com/ryan...
python
chosen
[ { "from": "system", "value": "Add exception handling to batch copy\n" }, { "from": "human", "value": "import ee\nimport os\nimport csv\nimport logging\n\ndef copy(source, destination):\n with open(source, 'r') as f:\n reader = csv.reader(f)\n for line in reader:\n nam...
python
chosen
[ { "from": "system", "value": "Fix for de-serialization.\nUsing vanilla django-money, when one did the following:\n\n./manage.py dumpdata\n\nthe values were saved properly, i.e:\n\n{\n 'amount': '12',\n 'amount_currency': 'USD',\n}\n\nhowever, after the de-serialization:\n\n./manage.py loaddata [fixtures]\...
python
chosen
[ { "from": "system", "value": "Fix Artist detail view url\n" }, { "from": "human", "value": "from django.conf.urls import url\n\nfrom . import views\n\napp_name = 'event'\nurlpatterns = [\n url(r'^$', views.IndexView.as_view(), name='index'),\n url(r'^artist/$', views.ArtistView.as_view(), ...
python
chosen
[ { "from": "system", "value": "Print the URL that erred out, along with the other info\n" }, { "from": "human", "value": "import asyncio\nimport aiohttp\nimport logging\nlog = logging.getLogger(__name__)\n\n\n@asyncio.coroutine\ndef http_get_auth_request(auth_string,\n ur...
python
chosen
[ { "from": "system", "value": "Add Flake-8 docstring pep requirements for template\n" }, { "from": "human", "value": "# -*- coding: utf-8 -*-\n\n__author__ = \"\"\"Chris Tabor (dxdstudio@gmail.com)\"\"\"\n\nif __name__ == '__main__':\n from os import getcwd\n from os import sys\n sys.pat...
python
chosen
[ { "from": "system", "value": "aafig: Improve package short and long description\n" }, { "from": "human", "value": "# -*- coding: utf-8 -*-\n\nfrom setuptools import setup, find_packages\n\nlong_desc = '''\nThis package contains the aafigure Sphinx extension.\n\nAllow embeded ASCII art figure to ...
python
chosen
[ { "from": "system", "value": "tests: Raise AssertionError to mark tests as failed instead of errored\n" }, { "from": "human", "value": "import os\nimport sys\nimport glob\nfrom babel.messages.pofile import read_po\nimport nose\n\n\ndef get_language_code(filename):\n filename = os.path.split(f...
python
chosen
[ { "from": "system", "value": "Replace page test url views with lambdas.\n" }, { "from": "human", "value": "from django.conf.urls import patterns, url\n\n\ndef view():\n pass\n\nurlpatterns = patterns(\n \"\",\n url(\"^$\", view, name=\"index\"),\n url(\"^(?P<url_title>[^/]+)/$\", vie...
python
chosen
[ { "from": "system", "value": "Use the correct template, and call the aflafrettir route decorator\n" }, { "from": "human", "value": "from flask import render_template\n\nfrom . import aflafrettir\n\n@aflafrettir.route('/')\ndef index():\n return render_template('aflafrettir/index.html')\n\n@talk...
python
chosen
[ { "from": "system", "value": "Remove booleanfield from example app for now\n\nWe rather want a non required field for testing and should add a\nNullBooleanField anyway\n" }, { "from": "human", "value": "from django.db import models\nimport i18n\nfrom i18n.models import TranslatableModel\n\n\ncla...
python
chosen
[ { "from": "system", "value": "Implement the login/logout functionality on the REST endpoints\n" }, { "from": "human", "value": "from pyramid.view import (\n view_config,\n view_defaults,\n )\n\nfrom pyramid.security import (\n remember,\n forget,\n )\n\n...
python
chosen
[ { "from": "system", "value": "Make all asset URLs absolute\n" }, { "from": "human", "value": "from __future__ import absolute_import\n\nfrom django.template import Library\n\nfrom sentry.utils.assets import get_asset_url\n\nregister = Library()\n\n\n@register.simple_tag\ndef asset_url(module, pa...
python
chosen
[ { "from": "system", "value": "Remove unnecessary assert from view for Notice home.\n" }, { "from": "human", "value": "# -*- coding: utf-8 -*-\n\nfrom __future__ import unicode_literals\n\nfrom operator import itemgetter\n\nimport logging\n\nfrom django.http import Http404\nfrom django.template.r...
python
chosen
[ { "from": "system", "value": "Set the version to the next patch release number (in dev mode)\n" }, { "from": "human", "value": "__version__ = (0, 2, 1, '', 0)\n\ndef get_version():\n version = '%d.%d.%d' % __version__[0:3]\n if __version__[3]:\n version = '%s-%s%s' % (version, __versio...
python
chosen
[ { "from": "system", "value": "Add --midi option to CLI\n" }, { "from": "human", "value": "\"\"\"\nModule that contains the command line app.\n\nWhy does this file exist, and why not put this in __main__?\n\n You might be tempted to import things from __main__ later, but that will cause\n probl...
python
chosen
[ { "from": "system", "value": "Remove fantastic from COB theme\n\nUpdates #10\n" }, { "from": "human", "value": "import ckan.plugins as plugins\nimport ckan.plugins.toolkit as toolkit\n\ndef groups():\n # Return a list of groups\n return toolkit.get_action('group_list')(data_dict={'all_fiel...
python
chosen
[ { "from": "system", "value": "Change 'language' to 'syntax', that is more precise terminology.\n" }, { "from": "human", "value": "#\n# linter.py\n# Linter for SublimeLinter3, a code checking framework for Sublime Text 3\n#\n# Written by Aparajita Fishman\n# Copyright (c) 2013 Aparajita Fishman\n...
python
chosen
[ { "from": "system", "value": "Add initial status code assertion\n" }, { "from": "human", "value": "# -*- coding: utf-8 -*-\n# Copyright (c) 2014 Simon Jagoe\n# All rights reserved.\n#\n# This software may be modified and distributed under the terms\n# of the 3-clause BSD license. See the LICENS...
python
chosen
[ { "from": "system", "value": "Create an API auth token for every newly created user\n\n* Add a post_save signal to add a new authtoken for every new user. For use with\n the Geoprocessing API\n" }, { "from": "human", "value": "# -*- coding: utf-8 -*-\nfrom django.contrib.auth.models import User...
python
chosen
[ { "from": "system", "value": "Reset mock befor running test.\n\nNot strictly required however ensures test doesn't fail if run multiple\ntimes in succession.\n" }, { "from": "human", "value": "from __future__ import absolute_import\nfrom __future__ import unicode_literals\n\nfrom guardian.compat...
python
chosen
[ { "from": "system", "value": "Implement support for the 'D' type in packb()\n" }, { "from": "human", "value": "\ndef packb(type=None, year=None, month=None, day=None):\n raise NotImplementedError()\n" }, { "from": "gpt", "value": "\nimport struct\n\nSUPPORTED_TYPES = set([\n 'D...
python
chosen
[ { "from": "system", "value": "Fix wrong redirect on logout\n" }, { "from": "human", "value": "from django.contrib import messages\nfrom django.contrib.auth import REDIRECT_FIELD_NAME, logout\nfrom django.core.urlresolvers import reverse_lazy\nfrom django.views.generic import RedirectView, Templa...
python
chosen
[ { "from": "system", "value": "Add __str__ function for SgTable\n" }, { "from": "human", "value": "\"\"\"A class to store tables.\"\"\"\n\n\nclass SgTable:\n \"\"\"A class to store tables.\"\"\"\n\n def __init__(self):\n self._fields = []\n self._table = []\n\n def __len__(...
python
chosen
[ { "from": "system", "value": "Support for inbox.util.eas in the /inbox-eas repo; this is where EAS-specific util code would live.\n\nSummary: As above.\n\nTest Plan: Sync runs as before.\n\nReviewers: spang\n\nDifferential Revision: https://review.inboxapp.com/D226\n" }, { "from": "human", "valu...
python
chosen
[ { "from": "system", "value": "Fix Python 3.3 calling another virtualenv as a subprocess.\n" }, { "from": "human", "value": "# -*- coding: utf-8 -*-\n# Licensed under a 3-clause BSD style license - see LICENSE.rst\n\nfrom __future__ import (absolute_import, division, print_function,\n ...
python
chosen
[ { "from": "system", "value": "Work around deprecation warning with new cssutils versions.\n" }, { "from": "human", "value": "import logging\r\nimport logging.handlers\r\nfrom django.conf import settings\r\n\r\nfrom django_assets.filter import BaseFilter\r\n\r\n\r\n__all__ = ('CSSUtilsFilter',)\r...
python
chosen
[ { "from": "system", "value": "Fix vote app URL patterns\n" }, { "from": "human", "value": "from django.conf.urls import include, url\n\nfrom django.views.generic import TemplateView\n\nfrom votes.views import VoteView, results, system_home\n\nurlpatterns = [\n url(r'^$', system_home, name=\"s...
python
chosen
[ { "from": "system", "value": "Remove TODO to add requirements.txt\n" }, { "from": "human", "value": "\"\"\"\nStart active players for the week\n\nIdeas:\n- Include the names of players who cannot be started\n - And maybe the full roster on those dates\n\nTODO:\n- Add required packages in requ...
python
chosen
[ { "from": "system", "value": "Support wildcard matches on coverage/junit results\n" }, { "from": "human", "value": "from __future__ import absolute_import, print_function\n\nfrom .manager import Manager\nfrom .coverage import CoverageHandler\nfrom .xunit import XunitHandler\n\n\nmanager = Manage...
python
chosen
[ { "from": "system", "value": "Add additional test case for comments\n" }, { "from": "human", "value": "from hypothesis_auto import auto_pytest_magic\n\nfrom isort import comments\n\nauto_pytest_magic(comments.parse)\nauto_pytest_magic(comments.add_to_line)\n" }, { "from": "gpt", "val...
python
chosen
[ { "from": "system", "value": "Use proper way to access package resources.\n" }, { "from": "human", "value": "import os\n\nfrom cqlengine.columns import *\nfrom cqlengine.functions import *\nfrom cqlengine.models import Model\nfrom cqlengine.query import BatchQuery\n\n__cqlengine_version_path__ =...
python
chosen
[ { "from": "system", "value": "Add process_request method to Application\n\nThis allows to override a process_request method without having to\nadd webob to child project.\n\nChange-Id: Ic5369076704f1ba459b2872ed0f4632a15b75c25\n" }, { "from": "human", "value": "# vim: tabstop=4 shiftwidth=4 soft...
python
chosen
[ { "from": "system", "value": "Update test to check newer logic\n" }, { "from": "human", "value": "\ndef test_environ(script, tmpdir):\n \"\"\"$PYTHONWARNINGS was added in python2.7\"\"\"\n demo = tmpdir.join('warnings_demo.py')\n demo.write('''\nfrom pip._internal.utils import deprecati...
python
chosen