conversations
listlengths
2
3
source
stringclasses
1 value
stack
stringclasses
1 value
[ { "from": "system", "value": "Make JinjaTemplateLoader work with Python 2.4.\n" }, { "from": "human", "value": "\"\"\"Genshi template loader that supports dotted names.\"\"\"\n\nfrom os.path import exists, getmtime\nfrom jinja2.exceptions import TemplateNotFound\nfrom jinja2.loaders import FileS...
python
chosen
[ { "from": "system", "value": "Determine DEBUG flag at runtime - if we are under the SDK, we are debugging\n" }, { "from": "human", "value": "import webapp2\nimport settings\n\n\nclass SampleIndex(webapp2.RequestHandler):\n \"\"\"Stub request handler\"\"\"\n\n def get(self):\n self.r...
python
chosen
[ { "from": "system", "value": "Use directory for all interaction - duh!\n" }, { "from": "human", "value": "#!/usr/bin/env python\nfrom app.views.export import write_all_measurements_csv\nimport tempfile\nimport os\n\nf = open(\"{0}/app/static/exports/AllMeasurements_inprogress.csv\".format(os.pat...
python
chosen
[ { "from": "system", "value": "Revert \"Catch and ignore CTRL_LOGOFF_EVENT when run as a windows service\"\n\nThis reverts commit a7ddf81b37b578b1448f83b0efb4f7116de0c3fb.\n" }, { "from": "human", "value": "# Import salt libs\nfrom salt.utils.winservice import Service, instart\nimport salt\n\n# I...
python
chosen
[ { "from": "system", "value": "Refactor test incase results are backwards\n\nLooks like results can come in either way in this file. Loosen the ordering constraints.\n\ngit-svn-id: 0ff597fd157e6f4fc38580e8d64ab130330d2411@331945 91177308-0d34-0410-b5e6-96231b3b80d8\n" }, { "from": "human", "valu...
python
chosen
[ { "from": "system", "value": "Use argparse for more flexible usage.\n" }, { "from": "human", "value": "#!/usr/bin/env python\n\n\"\"\"\nTODO: Modify module doc.\n\"\"\"\n\nfrom __future__ import division\n\n__author__ = \"Shyue Ping Ong\"\n__copyright__ = \"Copyright 2012, The Materials Virtual ...
python
chosen
[ { "from": "system", "value": "[STORM-1] Implement Staction Controller\n* Fixing mis-typed name.\n" }, { "from": "human", "value": "from wsme import types as wtypes\n\nfrom mirantas.resource import Resource\n\nclass BaseAPI(Resource):\n # TODO: Does URI need a custom type?\n uri = wtypes.te...
python
chosen
[ { "from": "system", "value": "Fix expert request filter by customer and project name.\n" }, { "from": "human", "value": "import django_filters\n\nfrom nodeconductor.core import filters as core_filters\n\nfrom . import models\n\n\nclass ExpertProviderFilter(django_filters.FilterSet):\n custome...
python
chosen
[ { "from": "system", "value": "Switch to use database for image ui\n" }, { "from": "human", "value": "#!/usr/bin/env python\n# -*- coding: utf-8 -*-\n\nfrom __future__ import absolute_import, unicode_literals\n\nimport datetime\n\nfrom flask import render_template, Blueprint\n\nfrom zhihudaily.ut...
python
chosen
[ { "from": "system", "value": "Revert the commit \"bc85b4e\" to keep the current solution\n" }, { "from": "human", "value": "import functools\n\nfrom pyp2rpm import settings\n\ndef memoize_by_args(func):\n \"\"\"Memoizes return value of a func based on args.\"\"\"\n memory = {}\n\n @func...
python
chosen
[ { "from": "system", "value": "Adjust to match modern style conventions.\n" }, { "from": "human", "value": "# This is just a kludge so that bdist_rpm doesn't guess wrong about the\n# distribution name and version, if the egg_info command is going to alter\n# them, another kludge to allow you to b...
python
chosen
[ { "from": "system", "value": "Replace outdated deprecating comments with a proper doc string.\n" }, { "from": "human", "value": "# This is just a kludge so that bdist_rpm doesn't guess wrong about the\n# distribution name and version, if the egg_info command is going to alter\n# them, another kl...
python
chosen
[ { "from": "system", "value": "SimPreconstrainedFileStream: Fix a bug that leads to failures in pickling.\n" }, { "from": "human", "value": "\nfrom angr.state_plugins.plugin import SimStatePlugin\nfrom angr.storage.file import SimFileStream\n\n\nclass SimPreconstrainedFileStream(SimFileStream):\n...
python
chosen
[ { "from": "system", "value": "[FIX] l10n_ar: Fix ImportError: No module named 'stdnum.ar.cbu'\n\nSince stdnum.ar.cbu is not available in odoo saas enviroment because is\nusing an old version of stdnum package, we add a try exept in order to\ncatch this and manage the error properly which is raise an excepti...
python
chosen
[ { "from": "system", "value": "Revert \"Fixed faoiling jenkins tests. Mocked the required functions\"\n\nThis reverts commit 4b60c8dadaa413581cd373c9059ff95ecf751159.\n" }, { "from": "human", "value": "from flask import json\n\nfrom . import return_json_from_response, validate_v0\nfrom tests impo...
python
chosen
[ { "from": "system", "value": "Set bytes_mode=False for future compatability with Python3\n" }, { "from": "human", "value": "from django.conf import settings\nfrom ldapdb import escape_ldap_filter\nimport ldap\n\n\ndef authenticate(dn,pwd,ldap_conf_key):\n # Setup connection\n ldap_conf = s...
python
chosen
[ { "from": "system", "value": "Fix a CPython comparison test in CPython 3.3 which was apparently fixed only in 3.4 and later.\n" }, { "from": "human", "value": "# mode: run\n# tag: generator\n\nimport cython\nimport sys\n\n\ndef test_generator_frame_cycle():\n \"\"\"\n >>> test_generator_fr...
python
chosen
[ { "from": "system", "value": "doc: Drop json, bump copyright and Python version for intersphinx\n" }, { "from": "human", "value": "##\n# Copyright (c) 2011 Sprymix Inc.\n# All rights reserved.\n#\n# See LICENSE for details.\n##\n\n\n\"\"\"Default Sphinx configuration file for metamagic projects\...
python
chosen
[ { "from": "system", "value": "Add fuzz calls for SBType::IsPointerType(void *opaque_type).\n\n\ngit-svn-id: b33bab8abb5b18c12ee100cd7761ab452d00b2b0@134551 91177308-0d34-0410-b5e6-96231b3b80d8\n" }, { "from": "human", "value": "\"\"\"\nFuzz tests an object after the default construction to make ...
python
chosen
[ { "from": "system", "value": "Modify django orm filter, add only\n" }, { "from": "human", "value": "\"\"\"info services.\"\"\"\nfrom info.models import Article, News, Column\n\n\ndef get_column_object(uid):\n \"\"\"Get column object.\"\"\"\n try:\n obj = Column.objects.get(uid=uid)\...
python
chosen
[ { "from": "system", "value": "Change User.avatar to be a property\n" }, { "from": "human", "value": "from __future__ import absolute_import, division, print_function\n\nfrom panoptes_client.panoptes import PanoptesObject, LinkResolver\n\n\nclass User(PanoptesObject):\n _api_slug = 'users'\n ...
python
chosen
[ { "from": "system", "value": "Check if build number exists\n\n(so we won't create a package with 'None' in it's name)\n" }, { "from": "human", "value": "from glob import glob\nimport imp\nimport logging\nimport os\nimport subprocess\n\nimport mock\n\nfrom setuptools import setup as _setup\n\nfro...
python
chosen
[ { "from": "system", "value": "Fix track import for package\n" }, { "from": "human", "value": "import flask\nimport track\n\napp = flask.flask(__name__)\n\n@app.route(\"/\")\ndef root():\n\treturn \"{} by {} - {}\"\n" }, { "from": "gpt", "value": "import flask\nfrom . import track\n\n...
python
chosen
[ { "from": "system", "value": "Call default.brlUpdateText instead of brlUpdateText (which was undefined)\n" }, { "from": "human", "value": "# gnome-terminal script\n\nimport a11y\nimport speech\n\ndef onTextInserted (e):\n if e.source.role != \"terminal\":\n return\n speech.say (\"de...
python
chosen
[ { "from": "system", "value": "Add some :tiger2:s for `graph_objs_tools.py`." }, { "from": "human", "value": "from __future__ import absolute_import\n\nfrom unittest import TestCase\n" }, { "from": "gpt", "value": "from __future__ import absolute_import\n\nfrom unittest import TestCas...
python
chosen
[ { "from": "system", "value": "Improve handling of remote test drivers\n" }, { "from": "human", "value": "import os\nimport sys\nimport time\nfrom django.contrib.staticfiles.testing import StaticLiveServerTestCase\n\nfrom django.conf import settings\nfrom selenium import webdriver\n\n\n# could us...
python
chosen
[ { "from": "system", "value": "Tweak to migration in order to accomodate old names for data fields and allow for if data fields were not present\n" }, { "from": "human", "value": "import json\n\nfrom django.contrib.auth.models import Group\nfrom django.core.management.base import BaseCommand\n\nf...
python
chosen
[ { "from": "system", "value": "Fix incorrect reference to opts dict\n" }, { "from": "human", "value": "'''\nMake me some salt!\n'''\n# Import python libs\nimport os\nimport optparse\n# Import salt libs\nimport salt.master\nimport salt.minion\nimport salt.utils\n\nclass Master(object):\n '''\n ...
python
chosen
[ { "from": "system", "value": "Add version info to package init\n" }, { "from": "human", "value": "from .csr import skeleton_to_csgraph, branch_statistics, summarise\n\n__all__ = ['skeleton_to_csgraph',\n 'branch_statistics',\n 'summarise']" }, { "from": "gpt", "va...
python
chosen
[ { "from": "system", "value": "Rename svg output based on sort attribute\n" }, { "from": "human", "value": "import pygal\n\n\ndef horizontal_bar(sorted_streaks, sort_attrib):\n \"\"\"\n Render a horizontal bar chart of streaks.\n\n Values have already been sorted by sort_attrib.\n \"\...
python
chosen
[ { "from": "system", "value": "Add CMS Pages to staticgen registry.\n" }, { "from": "human", "value": "# -*- coding: utf-8 -*-\n\nfrom __future__ import unicode_literals\n\nfrom staticgen.staticgen_pool import staticgen_pool\nfrom staticgen.staticgen_views import StaticgenView\n\n\nclass Staicgen...
python
chosen
[ { "from": "system", "value": "Add user_id to returned transactions\n" }, { "from": "human", "value": "from django.db import models\nfrom django.db.models import Sum\n\n\nclass User(models.Model):\n name = models.CharField(max_length=254, unique=True)\n create_date = models.DateTimeField(au...
python
chosen
[ { "from": "system", "value": "Rewrite phis from outdated incoming exception blocks\n" }, { "from": "human", "value": "# -*- coding: utf-8 -*-\n\n\"\"\"\nRewrite exceptions that are thrown and caught locally to jumps.\n\"\"\"\n\nfrom numba2.compiler import excmodel\nfrom pykit.optimizations impor...
python
chosen
[ { "from": "system", "value": "[1119] Change next/prev finding logic to stay in same section\n\nThis uses code from speeches.models._get_next_previous_node.\nThanks to Matthew Somerville for that suggestion.\n" }, { "from": "human", "value": "from django import template\n\nregister = template.Lib...
python
chosen
[ { "from": "system", "value": "Use \"blank\" PD incident instance for triggering through PD service.\n" }, { "from": "human", "value": "from pagerduty_events_api.pagerduty_incident import PagerdutyIncident\nfrom pagerduty_events_api.pagerduty_rest_client import PagerdutyRestClient\n\n\nclass Page...
python
chosen
[ { "from": "system", "value": "Put the code in __main__ for lesson 5 guess-a-number example.\n" }, { "from": "human", "value": "\"\"\"\nThis is an example of the control structures.\n\"\"\"\n\n\nresult = \"\"\nour_number = 21\n\n\ndef test_number(answer):\n\n answer = int(answer)\n\n if ans...
python
chosen
[ { "from": "system", "value": "Clear websocket data to try and fix Travis\n" }, { "from": "human", "value": "from __future__ import unicode_literals\n\nimport json\n\nfrom test_helpers import MockTrack, get_websocket, make_frontend, patched_bot\nfrom mopidy_tachikoma import Extension\n\n\ndef tes...
python
chosen
[ { "from": "system", "value": "Add polling loop to allow time for callback to be invoked\n" }, { "from": "human", "value": "import os\n\nfrom chalice.cli.filewatch import stat\n\n\nclass FakeOSUtils(object):\n def __init__(self):\n self.initial_scan = True\n\n def walk(self, rootdir)...
python
chosen
[ { "from": "system", "value": "Fix for a small problem\n" }, { "from": "human", "value": "import ckan.plugins as plugins\nimport ckan.plugins.toolkit as toolkit\n\n\nclass Latvian_ThemePlugin(plugins.SingletonPlugin):\n plugins.implements(plugins.IConfigurer)\n\n # IConfigurer\n\n def up...
python
chosen
[ { "from": "system", "value": "Remove redundant import from test script.\n" }, { "from": "human", "value": "from threading import Thread\nglobal exit_flag\nexit_flag = False\ndef g():\n i = 1\n while not exit_flag:\n i = (i + 1) % 100000000\n if i % 100000 == 0: print(\"f maki...
python
chosen
[ { "from": "system", "value": "Use an ordereddict for sorting revisions\n" }, { "from": "human", "value": "import json\n\nfrom .load_data_from_file import load_data_from_file\nfrom .get_old_dict_values import get_old_dict_values\nfrom .log import log\nfrom .paths import make_course_path\n\n\ndef ...
python
chosen
[ { "from": "system", "value": "Include missing columns in output\n" }, { "from": "human", "value": "from collections import namedtuple\n\n\nclass Termite:\n def __init__(self, label, color):\n self.label = label\n self.color = color\n self.trail = []\n self.tracker ...
python
chosen
[ { "from": "system", "value": "Update OpenJDK version to support both 8 and 9.\n" }, { "from": "human", "value": "import re\n\nfrom versions.software.utils import get_command_stderr, get_soup, \\\n get_text_between\n\n\ndef name():\n \"\"\"Return the precise name for the software.\"\"\"\n ...
python
chosen
[ { "from": "system", "value": "Update ops integration test rkt version\n" }, { "from": "human", "value": "import unittest\n\nfrom subprocess import call, check_call, check_output\nimport os.path\n\nfrom .fixtures import Fixture\n\n\n@Fixture.inside_container\nclass DepsTest(Fixture, unittest.Test...
python
chosen
[ { "from": "system", "value": "fix: Use date_created for \"My Builds\" sort\n" }, { "from": "human", "value": "from sqlalchemy.orm import contains_eager, joinedload, subqueryload_all\n\nfrom zeus import auth\nfrom zeus.config import db\nfrom zeus.models import Author, Build, Email, Source, User\n...
python
chosen
[ { "from": "system", "value": "Return True for preview if workflow public\n" }, { "from": "human", "value": "from rest_framework import permissions\n\nfrom workflows.models import *\n\n\nclass IsAdminOrSelf(permissions.BasePermission):\n def has_permission(self, request, view):\n if req...
python
chosen
[ { "from": "system", "value": "Make pep8 run mostly cleanly\n" }, { "from": "human", "value": "#!/usr/bin/env python\n# encoding: utf-8\n\n# This is the command line interface for bake. For people who want to take\n# bake.py and extend it for their own circumstances, modifying the main routine\n#...
python
chosen
[ { "from": "system", "value": "Include compose in the top level\n" }, { "from": "human", "value": "from __future__ import absolute_import, unicode_literals\nfrom .api.psd_image import PSDImage\n" }, { "from": "gpt", "value": "from __future__ import absolute_import, unicode_literals\nf...
python
chosen
[ { "from": "system", "value": "Create BitEnum class for bitfields\n" }, { "from": "human", "value": "import pkgutil\nfrom enum import IntEnum\n\n_data = pkgutil.get_data('wikicurses', 'interwiki.list').decode()\nwikis = dict([i.split('|')[0:2] for i in _data.splitlines() if i[0]!='#'])\n\nclass f...
python
chosen
[ { "from": "system", "value": "Adjust TMDB import page URL\n" }, { "from": "human", "value": "import time\n\nfrom RatS.base.base_ratings_uploader import RatingsUploader\nfrom RatS.tmdb.tmdb_site import TMDB\n\n\nclass TMDBRatingsInserter(RatingsUploader):\n def __init__(self, args):\n s...
python
chosen
[ { "from": "system", "value": "Update description of the blog sidebar snippet.\n" }, { "from": "human", "value": "from django.core.management.base import BaseCommand\n\nfrom us_ignite.snippets.models import Snippet\n\n\nFIXTURES = [\n {\n 'slug': 'home-box',\n 'name': 'UP NEXT: L...
python
chosen
[ { "from": "system", "value": "Fix unicode error in subsection\n" }, { "from": "human", "value": "\"\"\"\nTemplate tags and helper functions for displaying breadcrumbs in page titles\nbased on the current micro site.\n\"\"\"\nfrom django import template\nfrom django.conf import settings\nfrom mic...
python
chosen
[ { "from": "system", "value": "Make SavedRollManager less static, also docstrings\n" }, { "from": "human", "value": "import sqlite3\n\n\nconnection = sqlite3.connect('data.db')\n\n\nclass SavedRoll:\n @staticmethod\n def save(user, name, args):\n pass\n\n @staticmethod\n def ge...
python
chosen
[ { "from": "system", "value": "Normalize strings for per object settings\n" }, { "from": "human", "value": "# Copyright (c) 2015 Ultimaker B.V.\n# Uranium is released under the terms of the AGPLv3 or higher.\n\nfrom . import PerObjectSettingsTool\n\nfrom UM.i18n import i18nCatalog\ni18n_catalog =...
python
chosen
[ { "from": "system", "value": "Add delete old sessions command\n" }, { "from": "human", "value": "from datetime import datetime\n\nfrom django.core.management.base import BaseCommand\nfrom django.contrib.sessions.models import Session\n\n\nclass Command(BaseCommand):\n\n args = '<count count ....
python
chosen
[ { "from": "system", "value": "Insert date when email was received\n\nSometimes we receive email reports like \"this is happening right now\" and there is no date/time included. So if we process emails once per hour - we don't have info about event time. Additional field `extra.email_received` in the mail bo...
python
chosen
[ { "from": "system", "value": "Fix parameter descriptions and change size to individual width and height parameters\n" }, { "from": "human", "value": "#!/usr/bin/env python\n\nimport argparse\n\nfrom s3imageresize import resize_image_folder\n\nparser = argparse.ArgumentParser(description='Upload ...
python
chosen
[ { "from": "system", "value": "Increment patch version to 0.8.5\n" }, { "from": "human", "value": "\"\"\"yolk.\n\nAuthor: Rob Cakebread <cakebread at gmail>\n\nLicense : BSD\n\n\"\"\"\n\n__version__ = '0.8.5a0'\n" }, { "from": "gpt", "value": "\"\"\"yolk.\n\nAuthor: Rob Cakebread <ca...
python
chosen
[ { "from": "system", "value": "Clean up to ill imports.\n\nStyle issue, but it's better to put these vertically. It makes it harder to forget a comma.\n" }, { "from": "human", "value": "__all__ = [\n 'ill', 'illappct_1st_dist' #'md',\n]\n" }, { "from": "gpt", "value": "__all__ = [\n...
python
chosen
[ { "from": "system", "value": "Fix missing parenthesis for default route in budget module.\n" }, { "from": "human", "value": "from flask import Blueprint\n\nbudget = Blueprint('budget', __name__, template_folder = 'templates')\n\n@budget.route('/')\ndef default:\n return \"Hello World!\"\n" ...
python
chosen
[ { "from": "system", "value": "Fix reading from hashed file names.\n\nBioformats expects file extensions to exist, so flag that we should\nalways appear as actual, fully-pathed files.\n" }, { "from": "human", "value": "# -*- coding: utf-8 -*-\n\n###################################################...
python
chosen
[ { "from": "system", "value": "Raise a more specific error when form is not passed to the template.\n" }, { "from": "human", "value": "# -*- coding: utf-8 -*-\n\nfrom __future__ import unicode_literals\n\n\"\"\"\nTemplate tags related to the contact form.\n\"\"\"\n\nfrom django import template\n\...
python
chosen
[ { "from": "system", "value": "Add \"dispatch_uid\" to ensure we connect the signal only once\n" }, { "from": "human", "value": "# -*- coding: utf-8 -*-\n\nfrom axes.models import AccessAttempt\nfrom django.conf import settings\nfrom django.db.models.signals import post_save\nfrom django.dispatch...
python
chosen
[ { "from": "system", "value": "Fix matching users against R: extbans\n" }, { "from": "human", "value": "from twisted.plugin import IPlugin\nfrom txircd.module_interface import IModuleData, ModuleData\nfrom txircd.utils import ircLower\nfrom zope.interface import implements\nfrom fnmatch import fn...
python
chosen
[ { "from": "system", "value": "Fix unicode for unknown names\n" }, { "from": "human", "value": "from django.contrib.gis.db import models\n\nfrom councils.models import Council\n\n\nclass PollingStation(models.Model):\n council = models.ForeignKey(Council, null=True)\n internal_council_id = ...
python
chosen
[ { "from": "system", "value": "Add the concept of series (like Whatever Wednesday).\n" }, { "from": "human", "value": "# -*- coding: utf-8 -*-\nfrom django.db import models\n\nfrom components.games.models import Game\n\n\nclass Broadcast(models.Model):\n airdate = models.DateField()\n statu...
python
chosen
[ { "from": "system", "value": "Use install_requires= and bump version\n\nIt appears that the \"requires\" keyword argument to setup() doesn't do\nthe right thing. This may be a brain-o on my part. This switches\nback to using \"install_requires\" and bumps the version for release.\n" }, { "from": "...
python
chosen
[ { "from": "system", "value": "Use all behave4cmd0 steps now.\n" }, { "from": "human", "value": "# -*- coding: utf-8 -*-\n\"\"\"\nUse behave4cmd0 step library (predecessor of behave4cmd).\n\"\"\"\n\n# -- REGISTER-STEPS:\nimport behave4cmd0.command_steps\n" }, { "from": "gpt", "value":...
python
chosen
[ { "from": "system", "value": "Handle different cases of city names\n" }, { "from": "human", "value": "from flask import Flask, jsonify\nfrom flask.helpers import make_response\n\nimport urls\nimport scrapy\n\napp = Flask(__name__)\n\n@app.route('/fuelprice/v1.0/petrol/', methods=['GET'])\ndef pe...
python
chosen
[ { "from": "system", "value": "fix(set): Fix django-pipeline configuration for development/test\n" }, { "from": "human", "value": "import os\nimport sys\n\n\n# Disable django-pipeline when in test mode\nPIPELINE_ENABLED = 'test' not in sys.argv\n\n# Main project directory\nBASE_DIR = os.path.absp...
python
chosen
[ { "from": "system", "value": "Change the name of SelfSerializableList to PrintableList\n" }, { "from": "human", "value": "\"\"\"\nA list field field that supports query string parameter parsing.\n\n\"\"\"\nfrom marshmallow.fields import List, ValidationError\n\n\nclass SelfSerializableList(list)...
python
chosen
[ { "from": "system", "value": "Use values_list instead of iterating over\n" }, { "from": "human", "value": "from corehq.apps.products.models import SQLProduct\nfrom custom.ewsghana.handlers import HELP_TEXT\nfrom custom.ilsgateway.tanzania.handlers.keyword import KeywordHandler\n\n\nclass HelpHan...
python
chosen
[ { "from": "system", "value": "Adjust URL configuration based on changes introduced in Django 1.9:\n\n- URL application namespace required if setting an instance namespace:\n https://docs.djangoproject.com/en/2.1/releases/1.9/#url-application-namespace-required-if-setting-an-instance-namespace\n" }, { ...
python
chosen
[ { "from": "human", "value": "Add Jaro-Winkler distance based pyjarowinkler library\n" }, { "from": "gpt", "value": "from pyjarowinkler import distance\nfrom itertools import combinations\nfrom time import time\n\nstart = time()\nlog_file = '/home/hs32832011/Git/labeled-authlog/dataset/Hofstede20...
python
chosen
[ { "from": "system", "value": "Update to include User ID in result\n" }, { "from": "human", "value": "'''\nThis module extracts the student IDs from the collection certificates_generatedcertificate\nof the students who completed the course and achieved a certificate. The ids\nare then used to ext...
python
chosen
[ { "from": "system", "value": "Fix Landscape complaint \"Method has no argument\"\n" }, { "from": "human", "value": "from django.test.runner import DiscoverRunner\n\nfrom behave_django.environment import BehaveHooksMixin\nfrom behave_django.testcase import (BehaviorDrivenTestCase,\n ...
python
chosen
[ { "from": "system", "value": "Add points for capital locations>\n" }, { "from": "human", "value": "\"\"\"\nU.S. state capitals overlayed on a map of the U.S\n================================================-\nThis is a geographic visualization that shows US capitals\noverlayed on a map.\n\"\"\"\...
python
chosen
[ { "from": "system", "value": "Fix teh fixed fix of fscked fix.\n" }, { "from": "human", "value": "# -*- coding: utf-8 -*-\n\"\"\"El-Marj box in Lebanon\"\"\"\nfrom .idb import * # noqa\nIDEASCUBE_NAME = u\"El-Marj Lebanon\" # Fixme\nCOUNTRIES_FIRST = ['LB', 'SY', 'JO', 'PS']\nTIME_ZONE = 'Asia...
python
chosen
[ { "from": "system", "value": "Fix docstring typo in ListingGenerator unit tests\n" }, { "from": "human", "value": "\"\"\"Test praw.models.front.\"\"\"\nfrom praw.models.listing.generator import ListingGenerator\n\nfrom ... import UnitTest\n\n\nclass TestListingGenerator(UnitTest):\n def test_...
python
chosen
[ { "from": "system", "value": "Allow all hosts on Heroku\n" }, { "from": "human", "value": "import os\n\nimport raven\n\nfrom flamingo.settings.base import BaseSettings\n\n\nclass ProdSettings(BaseSettings):\n\n DEBUG = False\n ALLOWED_HOSTS = ['127.0.0.1', 'localhost',]\n\n # Sentry\n ...
python
chosen
[ { "from": "system", "value": "Simplify the requesting of parameters.\n" }, { "from": "human", "value": "from django.core.management.base import BaseCommand\nfrom optparse import make_option\nfrom rapidsms_httprouter.router import get_router\nfrom rapidsms.models import Connection\n\nclass Comman...
python
chosen
[ { "from": "system", "value": "Implement location restriction more thoroughly.\n" }, { "from": "human", "value": "__author__ = 'katharine'\n\nimport PyV8 as v8\nfrom geolocation import Geolocation\n\n\nclass Navigator(v8.JSClass):\n def __init__(self, runtime):\n # W3C spec says that if...
python
chosen
[ { "from": "system", "value": "Add license + remove useless declaration\n" }, { "from": "human", "value": "from wtforms import TextField, BooleanField, Form\nfrom wtforms.validators import Required\n\nclass SearchPackageForm(Form):\n package = TextField('package', validators = [Required()])\n ...
python
chosen
[ { "from": "system", "value": "Remove unused (albeit confusing) variable\n\nSee #13\n" }, { "from": "human", "value": "from django.http import HttpResponse\nfrom django.utils.translation import ugettext as _\nfrom django.views.generic import View\n\nfrom .pdf import generate_receipt_pdf\n\n\nclas...
python
chosen
[ { "from": "system", "value": "Add new Agency resource fields\n" }, { "from": "human", "value": "from __future__ import unicode_literals\n\nfrom ...models import Address\nfrom ...models import AgencyDocument\nfrom .agency_chain import AgencyChain\n\nfrom ..base import Resource\nfrom ..tour import...
python
chosen
[ { "from": "system", "value": "Add correct reset-sent and reset-done redirect views, tidy regex\n" }, { "from": "human", "value": "from django.conf.urls import patterns, url\nfrom django.core.urlresolvers import reverse\n\nfrom .views import RegistrationView, PasswordChangeView, password_reset_do...
python
chosen
[ { "from": "system", "value": "Update the PyPI version to 0.2.13\n" }, { "from": "human", "value": "# -*- coding: utf-8 -*-\nimport os\nfrom setuptools import setup\n\ndef read(fname):\n try:\n return open(os.path.join(os.path.dirname(__file__), fname)).read()\n except:\n retu...
python
chosen
[ { "from": "system", "value": "Change the help and assignments to match.\n" }, { "from": "human", "value": "from optparse import make_option\n\nfrom django.core.management.base import BaseCommand, CommandError\nfrom django.db import transaction\n\nfrom credentials.management.helpers import import...
python
chosen
[ { "from": "system", "value": "Add small explaining note to the RSSContent updating management command\n" }, { "from": "human", "value": "from django.core.management.base import NoArgsCommand\n\nfrom feincms.content.rss.models import RSSContent\n\nclass Command(NoArgsCommand):\n help = \"Run t...
python
chosen
[ { "from": "system", "value": "Add assertion for checking arrays read from wavread\n" }, { "from": "human", "value": "import numpy as np\n\nfrom opensauce.helpers import wavread\n\nfrom test.support import TestCase, data_file_path, loadmat\n\n\nclass TestSupport(TestCase):\n\n def test_wavread...
python
chosen
[ { "from": "system", "value": "Fix bug when sometimes online event was reported twice\n" }, { "from": "human", "value": "import glib\nimport dbus\nfrom dbus.mainloop.glib import DBusGMainLoop\nfrom pyee import EventEmitter\nimport logbook\nlogger = logbook.Logger('connman-dispatcher')\n\n__all__ ...
python
chosen
[ { "from": "human", "value": "Add docstring to main module\n" }, { "from": "gpt", "value": "\"\"\"\nA Python library to create a simple FUSE file system.\n\n.. :copyright: (c) 2016 by Jelte Fennema.\n :license: MIT, see License for more details.\n\"\"\"\n" } ]
python
chosen
[ { "from": "system", "value": "Use common test helpers in a test\n" }, { "from": "human", "value": "import json\nimport time\nimport uuid\n\nimport pytest\nfrom jose import jwt\n\nfrom helusers.oidc import ApiTokenAuthentication\n\nfrom .keys import rsa_key\n\nISSUER = \"test_issuer\"\n\n\nclass ...
python
chosen
[ { "from": "system", "value": "stations: Correct the name of the devices' test case to TestDevices (copy&paste bug).\n" }, { "from": "human", "value": "# -*- coding: utf-8 -*- \nfrom stations.models import *\nfrom django.test import TestCase\nfrom datetime import datetime\nimport pytz\n\nclass Te...
python
chosen
[ { "from": "system", "value": "Refactor in preparation of merge of relative tests.\n" }, { "from": "human", "value": "\"\"\"Check relative REDIRECTIONS\"\"\"\n\nimport io\nimport os\n\nimport pytest\n\nimport nikola.plugins.command.init\nfrom nikola import __main__\n\nfrom .helper import append_c...
python
chosen
[ { "from": "system", "value": "Move survey action celery task import to method scope.\n" }, { "from": "human", "value": "from go.vumitools.conversation.definition import (\n ConversationDefinitionBase, ConversationAction)\nfrom go.apps.surveys.tasks import export_vxpolls_data\n\n\nclass SendSu...
python
chosen
[ { "from": "system", "value": "Add --admin option for connecting in admin mode\n" }, { "from": "human", "value": "import click\nimport os\nimport yaml\nfrom panoptes_client import Panoptes\n\n@click.group()\n@click.option(\n '--endpoint', type=str\n)\n@click.pass_context\ndef cli(ctx, endpoint...
python
chosen
[ { "from": "system", "value": "Test some basic properties of iterable()\n" }, { "from": "human", "value": "from sympy.core.compatibility import default_sort_key, as_int, ordered\nfrom sympy.core.singleton import S\nfrom sympy.utilities.pytest import raises\n\nfrom sympy.abc import x\n\n\ndef test...
python
chosen
[ { "from": "system", "value": "Change test UserFactory model to point to User\n" }, { "from": "human", "value": "from django.test import TestCase\nimport factory\n\n\nclass UserFactory(factory.django.DjangoModelFactory):\n class Meta:\n model = 'imagerprofile.ImagerProfile'\n dja...
python
chosen
[ { "from": "system", "value": "Make fields in example app non required\n" }, { "from": "human", "value": "import i18n\nfrom i18n.models import TranslatableModel\n\n\nclass Document(TranslatableModel):\n\n charfield = i18n.LocalizedCharField(max_length=50)\n textfield = i18n.LocalizedTextFie...
python
chosen