conversations
listlengths
2
3
source
stringclasses
1 value
stack
stringclasses
1 value
[ { "from": "system", "value": "Clean things up a little" }, { "from": "human", "value": "#!/usr/bin/env python\n\nimport json\nimport sys\nimport csv\nfrom pymongo import MongoClient\n\nif len(sys.argv) < 2:\n print 'usage: python read.py filepath'\n sys.exit(1)\n\nreader = csv.DictReader(open(...
python
chosen
[ { "from": "system", "value": "Replace version of Python to install in test_{un,}install test\n\nPyPy 2.6.1's download link is not working anymore.\n" }, { "from": "human", "value": "import sys\nimport os\nfrom subprocess import check_call\nfrom pew._utils import invoke_pew as invoke\nfrom utils ...
python
chosen
[ { "from": "system", "value": "Add check for pushed tag version to version tests\n\nWhen getting Lasio's version in GITHUB_WORK flow environment, test for\nboth a '--no-tag' empty string version and a pushed release tag string\nversion.\n" }, { "from": "human", "value": "# coding=utf-8\n\nimport ...
python
chosen
[ { "from": "system", "value": "Replace tabs with spaces, use parens to get rid of backslashes\n" }, { "from": "human", "value": "from yacron import config\n\n\ndef test_mergedicts():\n\tassert dict(config.mergedicts({\"a\": 1}, {\"b\": 2})) == {\"a\": 1, \"b\": 2}\n\n\ndef test_mergedicts_nested(...
python
chosen
[ { "from": "system", "value": "Add tests for raise_if_error function\n" }, { "from": "human", "value": "def test_test():\n assert True\n" }, { "from": "gpt", "value": "import pytest\n\nfrom xbee_helper import device, exceptions, ZigBee\n\n\ndef test_raise_if_error_no_status():\n ...
python
chosen
[ { "from": "system", "value": "Add vcr to scan test\n" }, { "from": "human", "value": "from sharepa.search import ShareSearch\nfrom sharepa.search import basic_search\n\nimport elasticsearch_dsl\nimport types\n\n\ndef test_basic_search():\n results = basic_search.execute()\n assert results....
python
chosen
[ { "from": "system", "value": "Allow multiple permissions for an endpoint\n" }, { "from": "human", "value": "from functools import wraps\nfrom flask_jwt_extended import get_jwt_identity, jwt_required, current_user\nfrom werkzeug.exceptions import Unauthorized\n\nfrom scuevals_api.models import Us...
python
chosen
[ { "from": "system", "value": "Simplify how we get lat and long from GPGGA sentence.\n" }, { "from": "human", "value": "import re\n\ndef gpgga_get_position(gpgga_sentence):\n\tgps = re.search(\"\\$GPGGA,,([0-9]+\\.[0-9]+),([NS]),([0-9]+\\.[0-9]+),([WE]),,,,([0-9]+),M,+\\*(\\w+)\", gpgga_sentence)...
python
chosen
[ { "from": "system", "value": "Make db upgrade step 20 more robust.\n\ngit-svn-id: 0d96b0c1a6983ccc08b3732614f4d6bfcf9cbb42@5815 af82e41b-90c4-0310-8c96-b1721e28e2e2\n" }, { "from": "human", "value": "from trac.db import Table, Column, Index, DatabaseManager\r\nfrom trac.core import TracError\r\n...
python
chosen
[ { "from": "system", "value": "Add logs for test start and end\n" }, { "from": "human", "value": "import pytest\n\ndef pytest_addoption(parser):\n parser.addoption(\"--filter-project-name\",\n action=\"store\",\n default=None,\n help=...
python
chosen
[ { "from": "system", "value": "Move symlinked page field to \"Other options\"\n" }, { "from": "human", "value": "\"\"\"\nThis introduces a new page type, which has no content of its own but inherits\nall content from the linked page.\n\"\"\"\n\nfrom django.db import models\nfrom django.utils.tran...
python
chosen
[ { "from": "system", "value": "Copy data directory to ~/.local/mltsp during install; fix path to mltsp.yaml.example\n" }, { "from": "human", "value": "\"\"\"Machine Learning Time-Series Platform (MLTSP)\n\nSee http://mltsp.io for more information.\n\"\"\"\n\n__version__ = '0.3dev'\n\n\ndef instal...
python
chosen
[ { "from": "system", "value": "Fix reading json from client (ignore mimetype).\n\n• http://stackoverflow.com/a/14112400/2517622\n" }, { "from": "human", "value": "from heutagogy import app\nimport heutagogy.persistence\n\nfrom flask import request, jsonify, Response\nimport json\nimport datetime\...
python
chosen
[ { "from": "system", "value": "Modify to use shlex for getting command arguments\n" }, { "from": "human", "value": "import discord\n\nrolesTriggerString = '!role'\n\nasync def parse_roles_command(message, client):\n msg = 'Role!'\n await client.send_message(message.channel, msg)\n" }, {...
python
chosen
[ { "from": "system", "value": "Add auth example to default config\n" }, { "from": "human", "value": "DEBUG = False\nSECRET_KEY = \"changeme\"\nSQLALCHEMY_DATABASE_URI = \"postgresql://impala:changeme@localhost/impala\"\n" }, { "from": "gpt", "value": "DEBUG = False\nSECRET_KEY = \"cha...
python
chosen
[ { "from": "system", "value": "Create product in setUp() method for DRY\n\nCreate the product to be reused in the test methods in the setUp method\nthat is run before each test method\n" }, { "from": "human", "value": "from .base import FunctionalTest\n\nfrom store.tests.factories import *\n\n\nc...
python
chosen
[ { "from": "system", "value": "Fix formatting as per PEP8\n" }, { "from": "human", "value": "from struct import unpack\n\nclass KaitaiStruct:\n def read_u1(self):\n return unpack('B', self._io.read(1))[0]\n" }, { "from": "gpt", "value": "from struct import unpack\n\nclass KaitaiSt...
python
chosen
[ { "from": "system", "value": "Add receipt_email to payment processing on donations\n" }, { "from": "human", "value": "import logging\n\nfrom django import forms\nfrom django.conf import settings\nfrom django.utils.translation import ugettext_lazy as _\n\nimport stripe\n\nfrom .models import Supp...
python
chosen
[ { "from": "system", "value": "Test returning items with minimum support\n" }, { "from": "human", "value": "import unittest\nfrom itertools import chain\n\nfrom apriori import subsets\n\n\nclass AprioriTest(unittest.TestCase):\n def test_subsets_should_return_empty_subsets_if_input_empty_set(s...
python
chosen
[ { "from": "system", "value": "fix: Add the new module sin the list of modules availables.\n" }, { "from": "human", "value": "from . import _vmray # noqa\n\n__all__ = ['vmray_submit', 'bgpranking', 'circl_passivedns', 'circl_passivessl',\n 'countrycode', 'cve', 'dns', 'btc_steroids', '...
python
chosen
[ { "from": "system", "value": "Remove extraneous vim editor configuration comments\n\nChange-Id: Id8fb52db12695bff4488ea9e74b492a9dabbbccf\nPartial-Bug: #1229324\n" }, { "from": "human", "value": "# vim: tabstop=4 shiftwidth=4 softtabstop=4\n\n# Licensed under the Apache License, Version 2.0 (...
python
chosen
[ { "from": "system", "value": "Make header file variables private\n" }, { "from": "human", "value": "from __future__ import unicode_literals\n\nimport os\n\nfrom cffi import FFI\n\n\n__version__ = '2.0.0a1'\n\n\nheader_file = os.path.join(os.path.dirname(__file__), 'api.processed.h')\nheader = op...
python
chosen
[ { "from": "system", "value": "Remove superfluous check for default\n" }, { "from": "human", "value": "\"\"\"\nCompatibility support for Python 3.3. Remove when Python 3.3 support is\nno longer required.\n\"\"\"\n\nfrom .py27compat import builtins\n\n\ndef max(*args, **kwargs):\n \"\"\"\n A...
python
chosen
[ { "from": "system", "value": "Stop Sopel from relying rudely to the bot's owner.\n" }, { "from": "human", "value": "# coding=utf8\n\"\"\"\nping.py - Sopel Ping Module\nAuthor: Sean B. Palmer, inamidst.com\nAbout: http://sopel.chat\n\"\"\"\nfrom __future__ import unicode_literals\n\nimport random...
python
chosen
[ { "from": "system", "value": "Fix static page sitemap urls\n" }, { "from": "human", "value": "from common.helpers.constants import FrontEndSection\nfrom django.contrib.sitemaps import Sitemap\nfrom .models import Project\nfrom datetime import date\n\n\nclass SectionSitemap(Sitemap):\n protoco...
python
chosen
[ { "from": "system", "value": "Fix format check to ignore case." }, { "from": "human", "value": "\n\ndef split_resources(pkg_dict):\n \"\"\"\n Splits the resources in the provided package based on the format field\n with DOC, DOCX, PDF being returned as documents, all other formats as da...
python
chosen
[ { "from": "system", "value": "Add support to min command\n" }, { "from": "human", "value": "\"\"\"calc.py: A simple python calculator.\"\"\"\n\nimport sys\n\ndef add_all(nums):\n return sum(nums)\n\ndef multiply_all(nums):\n return reduce(lambda a, b: a * b, nums)\n\nif __name__ == '__main...
python
chosen
[ { "from": "system", "value": "Add default options for FlashJob.\n" }, { "from": "human", "value": "import scrollphat\nfrom pijobs.scrollphatjob import ScrollphatJob\n\nclass FlashJob(ScrollphatJob):\n def run(self):\n scrollphat.clear()\n for i in range(int(self.options['loop'])...
python
chosen
[ { "from": "system", "value": "Revert \"Added configuration options for Redis\"\n\nThis reverts commit 80129aac1fb4471e7a519b8f86df2db0b978903a.\n" }, { "from": "human", "value": "from contextlib import contextmanager\nfrom flask import current_app\nfrom redis import StrictRedis\nimport rq\n\n\n_...
python
chosen
[ { "from": "system", "value": "Add a primary category which will decide which category is shown as current in the chrome for this article.\n\nTODO: Enforce including the primary category as one of the categories for the article, both in UI and server side.\n" }, { "from": "human", "value": "from ...
python
chosen
[ { "from": "system", "value": "Set package version info to 0.3.0.dev0\n" }, { "from": "human", "value": "# -*- coding: utf-8 -*-\n# -----------------------------------------------------------------------------\n# Copyright (c) Spyder Project Contributors\n#\n# Licensed under the terms of the MIT ...
python
chosen
[ { "from": "system", "value": "Allow the median method to overwrite in-memory intermediate\n\nSigned-off-by: Lizhou Sha <d6acb26e253550574bc1141efa0eb5e6de15daeb@mit.edu>\n" }, { "from": "human", "value": "import argparse\nimport astropy.io.fits as fits\nimport numpy as np\nimport sys\n\nMETHOD_M...
python
chosen
[ { "from": "system", "value": "Add author_name, color, and fallback to payload\n" }, { "from": "human", "value": "import time\nimport requests\n\n\nclass SlackNotificationError(Exception):\n pass\n\n\ndef send_slack_message(message, webhook_url, pretext=None, title=None):\n \"\"\" Send slac...
python
chosen
[ { "from": "system", "value": "Remove active key since is deprecated\n" }, { "from": "human", "value": "# -*- coding: utf-8 -*-\n##############################################################################\n#\n# Copyright (C) 2014-15 Agile Business Group sagl\n# (<http://www.agilebg.com>)...
python
chosen
[ { "from": "system", "value": "Test draw function. Set K to 8.\n" }, { "from": "human", "value": "# -*- coding: utf-8 -*-\n\nimport clusters\n\nK = 10\n\nblognames,labels,data = clusters.readfile(\"blogdata1.txt\")\n\n#coords = clusters.scaledown(data)\n\nprint \"Generating clusters...\"\nkclust ...
python
chosen
[ { "from": "system", "value": "Use constants dictionary in lenCpStruct()\n" }, { "from": "human", "value": "#!/usr/bin/python\n\nimport argparse\nimport os\nimport struct\nimport sys\n\n###############\n### CLASSES ###\n###############\nclass MyParser(argparse.ArgumentParser):\n def error(self...
python
chosen
[ { "from": "system", "value": "Allow config access to app object\n" }, { "from": "human", "value": "#! /usr/bin/env python3\n\nimport config # pylint: disable=unused-import\n\nfrom functools import partial\n\nfrom flask import Flask\nfrom flask.ext.sqlalchemy import SQLAlchemy\nfrom flask.ext.lo...
python
chosen
[ { "from": "system", "value": "Add namespace for blog and add about url\n" }, { "from": "human", "value": "from django.conf.urls import include, url\nfrom django.contrib import admin\nfrom django.conf import settings\nfrom django.conf.urls.static import static\n\nurlpatterns = [\n # Examples:\...
python
chosen
[ { "from": "system", "value": "Update to hello world example\n" }, { "from": "human", "value": "#!/usr/bin/env python\n# encoding: utf-8\n\n\"\"\"\nA Simple Example Flask Application\n==================================\n\"\"\"\n\n# Third Party Libs\nfrom flask import Flask\nfrom flask_hal import ...
python
chosen
[ { "from": "system", "value": "Make create_crontab fall back to default settings search before explicitly searching for DJANGO_SETTINGS_MODULE\n" }, { "from": "human", "value": "import urllib2, sys, os.path, imp\n\nclass AnyMethodRequest(urllib2.Request):\n def __init__(self, url, data=None, h...
python
chosen
[ { "from": "system", "value": "Replace invalid string format '{}' by '{0}' for Python 2.6 compatibility.\n" }, { "from": "human", "value": "# -*- coding: utf-8 -*-\n\nimport functools\nimport inspect\nimport warnings\n\nstring_types = (type(b''), type(u''))\n\n\ndef deprecated(reason):\n \"\"\...
python
chosen
[ { "from": "system", "value": "Use raw ID fields for users, organizations\n\nAvoids slowing down admin sites\n" }, { "from": "human", "value": "from django.contrib import admin\n\nfrom organizations.models import (Organization, OrganizationUser,\n OrganizationOwner)\n\n\nclass OwnerInline(...
python
chosen
[ { "from": "system", "value": "Upgrade and remove some bugs\n" }, { "from": "human", "value": "# -*- coding: utf-8 -*-\n\"\"\"\n.. module:: MyCapytain\n :platform: Unix, Windows\n :synopsis: Canonical PrototypeText Service and Canonical URN tool suite for Python\n\n.. moduleauthor:: Thibault ...
python
chosen
[ { "from": "system", "value": "Address review comment: comma comma comma comma chameleon, it comes and goes etc.\n" }, { "from": "human", "value": "# Copyright Hybrid Logic Ltd. See LICENSE file for details.\n\n\"\"\"\nControl service for managing a Flocker cluster.\n\nA Flocker cluster is compo...
python
chosen
[ { "from": "system", "value": "Add unit tests for write_to and write_packed_to\n" }, { "from": "human", "value": "import unittest\n\nfrom examples import books\n\n\nclass BooksTest(unittest.TestCase):\n\n def test_builder(self):\n book = books.MallocMessageBuilder().init_root(books.Book...
python
chosen
[ { "from": "system", "value": "Remove Python 2 ImportError, let python_requires handle it\n" }, { "from": "human", "value": "# osmviz module #\n# Copyright (c) 2010 Colin Bick, Robert Damphousse\n\n# Permission is hereby granted, free of charge, to any person obtaining a copy\n# of this software ...
python
chosen
[ { "from": "system", "value": "Allow the user to specify a hostname and port\n" }, { "from": "human", "value": "#!/usr/bin/env python\n\nfrom socket import *\n\nHOST = 'localhost'\nPORT = 21567\nBUFSIZ = 1024\nADDR = (HOST, PORT)\n\nwhile True:\n tcpCliSock = socket(AF_INET, SOCK_STREAM)\n ...
python
chosen
[ { "from": "system", "value": "Add SubscriptionRequestAdmin - reviewed over shoulder by @gsvr\n" }, { "from": "human", "value": "from django.contrib import admin\nfrom .models import Source, Registration\n\n\nclass RegistrationAdmin(admin.ModelAdmin):\n list_display = [\n \"id\", \"stag...
python
chosen
[ { "from": "system", "value": "Add names to Parameters/Variables to surpress DepricationWarnings\n" }, { "from": "human", "value": "from __future__ import division\n\nimport sympy\n\nfrom symfit import Variable, Parameter\nfrom symfit.distributions import Gaussian, Exp\n\n\ndef test_gaussian():\n...
python
chosen
[ { "from": "system", "value": "Fix an unreferenced module bug\n" }, { "from": "human", "value": "from couchdb.schema import *\nfrom couchdb.schema import View\nfrom wiki.auth.models import User\n\nclass Page(Document):\n created_date = DateTimeField()\n last_edited_date = DateTimeFi...
python
chosen
[ { "from": "system", "value": "Add a State model and some enums\n" }, { "from": "human", "value": "from __future__ import unicode_literals\n\nfrom django.db import models\n\n# Create your models here.\n" }, { "from": "gpt", "value": "from __future__ import unicode_literals\n\nfrom dja...
python
chosen
[ { "from": "system", "value": "Update permission required to match new permission name\n" }, { "from": "human", "value": "from django.views.generic import TemplateView\nfrom django.contrib.auth.mixins import PermissionRequiredMixin\n\nfrom admin.base.settings import KEEN_CREDENTIALS\n\n\nclass Me...
python
chosen
[ { "from": "system", "value": "Refactor for python 3 and shinyness\n" }, { "from": "human", "value": "from django.db import models\nfrom django.utils.translation import ugettext_lazy as _\n\nclass Chapter(models.Model):\n \"\"\"\n Video section.\n \"\"\"\n video = models.ForeignKey('v...
python
chosen
[ { "from": "system", "value": "Add missing select_related to badgify_badges\n" }, { "from": "human", "value": "# -*- coding: utf-8 -*-\nfrom django import template\n\nfrom ..models import Badge, Award\nfrom ..compat import get_user_model\n\nregister = template.Library()\n\n\n@register.assignment_...
python
chosen
[ { "from": "system", "value": "Fix window test border _again_ (more fixed).\n\n--HG--\nextra : convert_revision : svn%3A14d46d22-621c-0410-bb3d-6f67920f7d95/trunk%401383\n" }, { "from": "human", "value": "#!/usr/bin/python\r\n# $Id:$\r\n\r\nfrom pyglet.gl import *\r\n\r\ndef draw_client_border(wi...
python
chosen
[ { "from": "system", "value": "Adjust the module __version__ to match the version advertised in PyPI.\n" }, { "from": "human", "value": "# Copyright 2013 Getlogic BV, Sardar Yumatov\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may not use this file except in comp...
python
chosen
[ { "from": "system", "value": "Add logging for missing CELERY_BROKER_URL\n" }, { "from": "human", "value": "from celery import Celery\n\n\nclass NewAcropolisCelery(Celery):\n def init_app(self, app):\n super(NewAcropolisCelery, self).__init__(\n app.import_name,\n ...
python
chosen
[ { "from": "system", "value": "Allow alpha versions in the versioning string\n" }, { "from": "human", "value": "__version_info__ = (0, 1, 1)\n__version__ = '.'.join(map(str, __version_info__))\n" }, { "from": "gpt", "value": "__version_info__ = (0, 1, 1, 'a1')\n__version__ = '.'.join(...
python
chosen
[ { "from": "system", "value": "Rewrite delayed_remove task: instance is gone, so cannot retrieve. Fake instance with proper pk and let haystack remove it from index.\n" }, { "from": "human", "value": "from django.conf import settings\nfrom django.utils import translation\n\nfrom celery.task impor...
python
chosen
[ { "from": "system", "value": "Use DefaultSelector as context manager." }, { "from": "human", "value": "from .selectors import (\n HAS_SELECT,\n DefaultSelector,\n EVENT_READ,\n EVENT_WRITE\n)\n\n\ndef _wait_for_io_events(socks, events, timeout=None):\n \"\"\" Waits for IO events t...
python
chosen
[ { "from": "system", "value": "Use configurable hash_type for general Key fingerprinting\n" }, { "from": "human", "value": "# -*- coding: utf-8 -*-\n'''\nFunctions to view the minion's public key information\n'''\nfrom __future__ import absolute_import\n\n# Import python libs\nimport os\n\n# Impo...
python
chosen
[ { "from": "system", "value": "Fix the manifest.load call in the test runner.\n" }, { "from": "human", "value": "import imp\nimport json\nimport os\nimport sys\n\nhere = os.path.dirname(__file__)\nlocalpaths = imp.load_source(\"localpaths\", os.path.abspath(os.path.join(here, os.pardir, \"localpa...
python
chosen
[ { "from": "system", "value": "Fix problem with South migrations.\n" }, { "from": "human", "value": "from django.db import models\nfrom django.contrib.sites.models import Site\n\n\nclass MultiSiteField(models.ManyToManyField):\n\n def __init__(self, **kwargs):\n defaults = {\n 'blank':...
python
chosen
[ { "from": "system", "value": "Add auth and contentypes django apps on tests to prevent RuntimeError on Django 1.9\n" }, { "from": "human", "value": "import django\nfrom django.conf import settings\n\nif not settings.configured:\n settings.configure(\n DEBUG=True,\n INSTALLED_APP...
python
chosen
[ { "from": "system", "value": "Fix typo in annotation script location\n\nIn 2a07fd1866 I erroneously pointed to the wrong location\nfor the annotation script for main waterfall. This fixes that.\n\nTBR=nsylvain@chromium.org\nBUG=\n\nReview URL: https://chromiumcodereview.appspot.com/10917129\n\ngit-svn-id: ...
python
chosen
[ { "from": "system", "value": "Resolve Minor Issues with Test\nEnsure that the tensorflow tests run on the CPU\n" }, { "from": "human", "value": "# Lint as: python3\n\"\"\"Tests for spectral.\"\"\"\n\nfrom __future__ import absolute_import\nfrom __future__ import division\nfrom __future__ import ...
python
chosen
[ { "from": "system", "value": "Add BzTar and EGG format to Fabric script\n" }, { "from": "human", "value": "from fabric.api import local, cd\n\ndef docs():\n local(\"./bin/docs\")\n local(\"./bin/python setup.py upload_sphinx --upload-dir=docs/html\")\n\ndef release():\n # update version...
python
chosen
[ { "from": "system", "value": "Add content type of long description\n" }, { "from": "human", "value": "import os\nfrom setuptools import setup\n\n\ndef read(fname):\n return open(os.path.join(os.path.dirname(__file__), fname)).read()\n\n\nsetup(name='windpowerlib',\n version='0.1.3',\n ...
python
chosen
[ { "from": "system", "value": "Use long_description_content_type': 'text/markdown' in README\n" }, { "from": "human", "value": "from setuptools import setup\n\nsetup(\n name='dblp',\n version='0.1.0',\n author='Sebastian Gehrmann',\n author_email='gehrmann@seas.harvard.edu',\n pack...
python
chosen
[ { "from": "system", "value": "Add BuildEnv and ENV to __all__\n" }, { "from": "human", "value": "__all__ = ['Config', 'Chdir', 'cmd', 'log','Properties','replace_vars','cmd']\n\nfrom buildtools.config import Config, Properties, replace_vars\nfrom buildtools.os_utils import Chdir, cmd, ENV, Build...
python
chosen
[ { "from": "system", "value": "Return route, hip rank and total rank\n" }, { "from": "human", "value": "from os import environ\nfrom urllib2 import urlopen\n\nfrom flask import Flask, json, make_response\napp = Flask(__name__)\n\nurl = 'http://open.mapquestapi.com/directions/v2/route'\nparams = '...
python
chosen
[ { "from": "human", "value": "Update Byzantine Randomized Consensus protocol class\n" }, { "from": "gpt", "value": "from base.consensus import Consensus\n\n\nclass ByzantineRandomizedConsensus(Consensus):\n \"\"\"\n Implements a Byzantine Fault Tolerant Randomized Consensus Broadcast protoc...
python
chosen
[ { "from": "system", "value": "tests/basics: Add test for tuple compare with class derived from tuple.\n\nOnly the \"==\" operator was tested by the test suite in for such arguments.\nOther comparison operators like \"<\" take a different path in the code so\nneed to be tested separately.\n" }, { "fr...
python
chosen
[ { "from": "system", "value": "Allow some simplt matching on message tags\n" }, { "from": "human", "value": "#!/usr/bin/python\n\"\"\"\nPrint log for given DNA program run\n\"\"\"\n\nimport os\nimport sys\nfrom readevtlog import *\n\nhome = os.getenv('HOME')\nlogdir = os.path.join(home,'_dna','...
python
chosen
[ { "from": "system", "value": "Use mock_create_person to test increments work\n" }, { "from": "human", "value": "from django.test import TestCase\n\nfrom .models import CachedCount\n\nclass CachedCountTechCase(TestCase):\n def setUp(self):\n initial_counts = (\n {\n ...
python
chosen
[ { "from": "system", "value": "Add Show.ticket_coverage() to get statistics on coverage\n\nVery left join, much SQL, wow.\n" }, { "from": "human", "value": "from django.db import models\nimport datetime\n\n\nclass Production(models.Model):\n name = models.CharField(max_length=100)\n descrip...
python
chosen
[ { "from": "system", "value": "Fix router details's name empty and change inheritance project table\n\nIn admin router details page, the name column is empty,\nchange to if no name show id. And change to inheritance\nfrom port table of project.\n\nChange-Id: I54d4ad95bd04db2432eb47f848917a452c5f54e9\nCloses-...
python
chosen
[ { "from": "system", "value": "Replace condition to patch distutils.dist.log\n\nAs `distutils.log.Log` was backfilled for compatibility we no longer can\nuse this as a condition.\n" }, { "from": "human", "value": "import sys\nimport logging\nimport distutils.log\nfrom . import monkey\n\n\ndef _no...
python
chosen
[ { "from": "system", "value": "Fix nova client usage, it should not be initialized this way\n" }, { "from": "human", "value": "from os import environ as env\n\nfrom glanceclient import Client as glclient\nimport keystoneclient.v2_0.client as ksclient\nimport novaclient.v2.client as nvclient\n\n\n...
python
chosen
[ { "from": "system", "value": "Allow deallocation of running jobsteps\n" }, { "from": "human", "value": "from __future__ import absolute_import, division, unicode_literals\n\nfrom changes.api.base import APIView\nfrom changes.constants import Status\nfrom changes.config import db\nfrom changes.jo...
python
chosen
[ { "from": "system", "value": "Use queryset in validate publicbodies command" }, { "from": "human", "value": "from io import StringIO\nfrom contextlib import contextmanager\n\nfrom django.conf import settings\nfrom django.core.management.base import BaseCommand\nfrom django.utils import translati...
python
chosen
[ { "from": "system", "value": "Change indentation from 2 spaces (Google standard) to 4 spaces (PEP-8).\n\nAdd comments." }, { "from": "human", "value": "#!/usr/bin/python -tt\n# Copyright 2010 Google Inc.\n# Licensed under the Apache License, Version 2.0\n# http://www.apache.org/licenses/LICENSE-...
python
chosen
[ { "from": "system", "value": "Remove deprecated version requirement settings\n\nLinter plugins can no longer set version requirements.\r\nhttps://github.com/SublimeLinter/SublimeLinter/issues/1087" }, { "from": "human", "value": "#\n# linter.py\n# Markdown Linter for SublimeLinter, a code checki...
python
chosen
[ { "from": "system", "value": "Add exception for invalid captions\n" }, { "from": "human", "value": "\n\nclass MalformedFileError(Exception):\n \"\"\"Error raised when the file is not well formatted\"\"\"\n\n\nclass MalformedCaptionError(Exception):\n \"\"\"Error raised when a caption is no...
python
chosen
[ { "from": "system", "value": "Add new initial migration for reports\n" }, { "from": "human", "value": "from datetime import datetime\n\nfrom django.db import models\nfrom django.utils.translation import ugettext_lazy as _\n\n\nclass Report(models.Model):\n addressed_to = models.TextField()\n ...
python
chosen
[ { "from": "system", "value": "Change handling for inaccessible pages\n" }, { "from": "human", "value": "import requests\n\ndef can_access(url):\n try:\n current_page = (requests.get(url).text, 'lxml')\n answer = \"SL\"\n except requests.exceptions.ConnectionError:\n an...
python
chosen
[ { "from": "system", "value": "Add getting started section to the docs.\n" }, { "from": "human", "value": "\"\"\"\nWelcome to the Resin Python SDK documentation.\nThis document aims to describe all the functions supported by the SDK, as well as\nshowing examples of their expected usage.\n\nInstal...
python
chosen
[ { "from": "system", "value": "ENH: Make CIP compatible with Slicer 5\n\n- remove CIP UI Editor includes to enable CIP loading in Slicer preview\n" }, { "from": "human", "value": "from .CIP_EditorWidget import CIP_EditorWidget\nfrom .CIP_EditBox import *\nfrom .CaseReportsWidget import *\nfrom .P...
python
chosen
[ { "from": "system", "value": "Handle working without the qpid module\n" }, { "from": "human", "value": "\"\"\"\nHere is where we configure which AMQP hub implementation we are going to use.\n\"\"\"\n\nfrom qpid010 import QpidAMQPHub\nAMQPHub = QpidAMQPHub\n\n#from pyamqplib import AMQPLibHub\n#A...
python
chosen
[ { "from": "system", "value": "Embed constants into toplevel module\n" }, { "from": "human", "value": "# websocket_server -- WebSocket server library\n# https://github.com/CylonicRaider/websocket-server\n\n\"\"\"\nwebsocket_server -- WebSocket server library\n\nThis is a little stand-alone librar...
python
chosen
[ { "from": "system", "value": "Remove obsolete imports, add logging\n" }, { "from": "human", "value": "import logging\nfrom contextlib import contextmanager\nfrom sqlalchemy import create_engine\nfrom sqlalchemy.orm import sessionmaker\nfrom sqlalchemy.exc import SQLAlchemyError\nfrom rtrss impor...
python
chosen
[ { "from": "system", "value": "Make function exist when called.\n" }, { "from": "human", "value": "\nif random:\n numbers = 1\n print_numbers(numbers)\nelse:\n numbers = 1, 2, 3\n print_numbers(numbers)\n\ndef print_numbers(numbers):\n for n in numbers:\n print(n)\n\n\n" }...
python
chosen
[ { "from": "system", "value": "Update file for pep8 compliance\n" }, { "from": "human", "value": "import unittest\n\nfrom mock import Mock, patch\n\nfrom tools import create_mock_json\nfrom twilio.rest.resources import Account\n\nclass AccountTest(unittest.TestCase):\n\n @patch(\"twilio.rest.r...
python
chosen
[ { "from": "system", "value": "Add a test mode, handle 429 errors, stop corrupting state file\n" }, { "from": "human", "value": "#!/usr/bin/env python\n\nimport sys,requests\n\nREDDIT=sys.argv[1]\nCHANNEL=sys.argv[2]\nFEED=sys.argv[3]\n\nSTATEFILE=\"/home/ircbot/state/reddit-%s-%s-storyids\"%(CHA...
python
chosen
[ { "from": "system", "value": "Disable SSL warnings by default.\n" }, { "from": "human", "value": "import sys\n\ndef format_cols(cols):\n widths = [0] * len(cols[0])\n\n for i in cols:\n for idx, val in enumerate(i):\n widths[idx] = max(len(val), widths[idx])\n\n f = \"...
python
chosen
[ { "from": "system", "value": "Clean up imports and whitespace." }, { "from": "human", "value": "import couchdb\nfrom been.couch import CouchStore\n\nfrom flask import Flask, render_template\napp = Flask(__name__)\napp.jinja_env.trim_blocks = True\n\nstore = CouchStore()\nstore.load()\n\n@app.rou...
python
chosen
[ { "from": "system", "value": "Add test for round-robin selector\n" }, { "from": "human", "value": "import random\nimport unittest\n\nfrom aioes.pool import RandomSelector\n\n\nclass TestRandomSelector(unittest.TestCase):\n\n def setUp(self):\n random.seed(123456)\n\n def tearDown(se...
python
chosen
[ { "from": "system", "value": "Remove crm as dependency of event_sale\n\nThere is no need for CRM to have event management. Introduced at 64d63ffaa6f5f2e72084ea6aedc6f2c2b7130ca6 for probably no reason..." }, { "from": "human", "value": "# -*- coding: utf-8 -*-\n\n{\n 'name': 'Events Sales',\n...
python
chosen
[ { "from": "system", "value": "Change environment variable for app configuration\n" }, { "from": "human", "value": "import os\nfrom flask_script import Manager\nfrom flask_migrate import Migrate, MigrateCommand\n\nfrom app import create_app, db\n\napp = create_app(os.getenv(\"FLASK_CONFIG\") or \...
python
chosen
[ { "from": "system", "value": "Add command to mock some db data\n" }, { "from": "human", "value": "import os\nimport unittest\n\nfrom flask.ext.script import Manager\n\nfrom server import app\nfrom server.models import db\n\nmanager = Manager(app)\n\n\n@manager.command\ndef init_db():\n \"\"\"...
python
chosen