conversations
listlengths
2
3
source
stringclasses
1 value
stack
stringclasses
1 value
[ { "from": "system", "value": "Use the correct classifier for production\n" }, { "from": "human", "value": "import sys\n\ntry:\n from setuptools import setup\nexcept ImportError:\n from distutils.core import setup\n\nrequirements = [req.strip() for req in open('requirements.pip')]\n\nsetup(\n ...
python
chosen
[ { "from": "system", "value": "Use console_scripts entry_point instead of scripts\n" }, { "from": "human", "value": "import codecs\nfrom setuptools import find_packages, setup\n\nimport digestive\n\n\nsetup(\n name='digestive',\n version=digestive.__version__,\n url='https://github.com/a...
python
chosen
[ { "from": "system", "value": "Include any files ending in '.install' in package data\n\nThis makes sure the new `dpkg-reconfigure-dracut.install` file under resources\ngets included as package data.\n" }, { "from": "human", "value": "#!/usr/bin/python3\n# SPDX-License-Identifier: LGPL-2.1+\n\nfr...
python
chosen
[ { "from": "system", "value": "Add test for task to str params conversion\n" }, { "from": "human", "value": "import doctest\nimport unittest\n\nimport luigi.task\n\n\nclass TaskTest(unittest.TestCase):\n\t\n\tdef test_tasks_doctest(self):\n\t\tdoctest.testmod(luigi.task)\n" }, { "from": "...
python
chosen
[ { "from": "system", "value": "Test france compatibility with the new API\n" }, { "from": "human", "value": "# -*- coding: utf-8 -*-\n\nimport subprocess\nimport time\nfrom unittest import TestCase\nfrom nose.tools import assert_equal\n\n\nclass TestOldApi(TestCase):\n\n def setUp(self):\n ...
python
chosen
[ { "from": "system", "value": "Migrate profiles manager tests to pytest\n" }, { "from": "human", "value": "from nose.tools import eq_\nfrom mock import MagicMock, patch\n\nfrom buffpy.managers.profiles import Profiles\nfrom buffpy.models.profile import Profile, PATHS\n\nmocked_response = {\n 'na...
python
chosen
[ { "from": "system", "value": "Allow site names to be up to 40 chars long (instead of 20)\n" }, { "from": "human", "value": "\"\"\"\nbyceps.blueprints.admin.site.forms\n~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\n\n:Copyright: 2006-2019 Jochen Kupperschmidt\n:License: Modified BSD, see LICENSE for detail...
python
chosen
[ { "from": "system", "value": "Use scalable get_word by default\n" }, { "from": "human", "value": "\"\"\"Function to fetch words.\"\"\"\n\nimport random\n\nWORDLIST = 'wordlist.txt'\n\n\ndef get_random_word():\n \"\"\"Get a random word from the wordlist.\"\"\"\n words = []\n with open(WO...
python
chosen
[ { "from": "system", "value": "Update copyright string in docs\n\nSigned-off-by: Niklas Koep <342d5290239d9c5264c8f98185afedb99596601a@gmail.com>\n" }, { "from": "human", "value": "import pymanopt\n\n\n# Package information\nproject = \"Pymanopt\"\nauthor = \"Jamie Townsend, Niklas Koep, Sebastia...
python
chosen
[ { "from": "system", "value": "Add home button to falcon turret dev gui\n\n" }, { "from": "human", "value": "import falconoptics\nfrom ..FilterWheel import FilterWheel, FilterWheelFuture\n\n\nclass FalconTurret(FilterWheel):\n def __init__(self, dm, config, name):\n self.dev = falconopt...
python
chosen
[ { "from": "system", "value": "Print when pandas not installed and removed unnecessary imports\n" }, { "from": "human", "value": "# Copyright 2015 Google Inc. All Rights Reserved.\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may not use this file except in com...
python
chosen
[ { "from": "system", "value": "Move to 1.0.0; let's all use semver\n" }, { "from": "human", "value": "\"\"\"\naiosmtplib\n==========\n\nAn asyncio SMTP client.\n\nRoughly based (with API differences) on smtplib from the Python 3 standard\nlibrary by: The Dragon De Monsyne <dragondm@integral.org>\...
python
chosen
[ { "from": "system", "value": "Handle PY3 default data conversion vagaries in unit test\n" }, { "from": "human", "value": "from django.core.urlresolvers import reverse_lazy, reverse\nfrom django import forms\n\nfrom .models import Author\nfrom popupcrud.views import PopupCrudViewSet\n\n# Create y...
python
chosen
[ { "from": "system", "value": "Fix json bug for python35 in tests\n" }, { "from": "human", "value": "# -*- coding: utf-8 -*-\nimport json as _json\nfrom collections import OrderedDict as _OrderedDict\nimport os as _os\n\n_thisdir = _os.path.dirname(__file__)\n\nclass MenuData(object):\n _data_...
python
chosen
[ { "from": "system", "value": "Change arg from file to path\n" }, { "from": "human", "value": "#!/usr/bin/env/python\n\nimport sys\nimport os.path\nimport subprocess\n\n\n# Read in a pml file and save to an xml file\ndef translate_pml_file(xml_file, pml_file):\n\n pml_path = os.path.abspath(pm...
python
chosen
[ { "from": "system", "value": "Add custom KeyNotFoundError error to gpg module\n" }, { "from": "human", "value": "\"\"\"\n<Program Name>\n exceptions.py\n\n<Author>\n Santiago Torres-Arias <santiago@nyu.edu>\n Lukas Puehringer <lukas.puehringer@nyu.edu>\n\n<Started>\n Dec 8, 2017\n\n<Copyrigh...
python
chosen
[ { "from": "system", "value": "Set the EC API URL\n" }, { "from": "human", "value": "# settings for councils scraper\n\nYVM_LA_URL = \"https://www.yourvotematters.co.uk/_design/nested-content/results-page2/search-voting-locations-by-districtcode?queries_distcode_query=\" # noqa\nBOUNDARIES_URL =...
python
chosen
[ { "from": "system", "value": "Update the way the url is handled.\n" }, { "from": "human", "value": "#!/usr/bin/python\n\nimport argparse\nimport sys\n\n\ndef args():\n parser = argparse.ArgumentParser(description='Run the Furious Examples.')\n\n parser.add_argument('--gae-sdk-path', metava...
python
chosen
[ { "from": "system", "value": "Tweak boring regex to exclude more terms\n" }, { "from": "human", "value": "import re\nfrom twitterbot import TwitterBot\nimport wikipedia\n\n\nclass Genderbot(TwitterBot):\n boring_article_regex = (r\"municipality|village|town|football|genus|family|\"\n ...
python
chosen
[ { "from": "system", "value": "Remove \"A\" from start of title for RT search\n" }, { "from": "human", "value": "import requests\n\nfrom bs4 import BeautifulSoup\nfrom source.models.rt_rating import RTRating\n\n\nclass RottenTomatoesService:\n\n __URL = 'http://www.rottentomatoes.com/m/'\n ...
python
chosen
[ { "from": "system", "value": "Remove margin constrains from PDF printing\n" }, { "from": "human", "value": "# Copyright (c) 2013, Web Notes Technologies Pvt. Ltd. and Contributors\n# MIT License. See license.txt\nfrom __future__ import unicode_literals\n\nimport pdfkit, os, frappe\nfrom frappe.u...
python
chosen
[ { "from": "system", "value": "Disable stats after crash report until we find a alternative solution\n" }, { "from": "human", "value": "\nfrom datetime import datetime\nfrom seven23.models.profile.models import Profile\nfrom rest_framework.authentication import TokenAuthentication\nfrom seven23.m...
python
chosen
[ { "from": "system", "value": "Add skip html log output config key\n" }, { "from": "human", "value": "import logging\n\nfrom d_parser.helpers import url_lib\nfrom d_parser.helpers.get_body import get_body\nfrom helpers.config import Config\n\nlogger = logging.getLogger('ddd_site_parse')\n\n\ndef ...
python
chosen
[ { "from": "system", "value": "Add mime types to GCodeWriter plugin\n" }, { "from": "human", "value": "# Copyright (c) 2015 Ultimaker B.V.\n# Cura is released under the terms of the AGPLv3 or higher.\n\nfrom . import GCodeWriter\n\nfrom UM.i18n import i18nCatalog\ncatalog = i18nCatalog(\"cura\")\...
python
chosen
[ { "from": "system", "value": "Add !images as Bing !image alias.\n" }, { "from": "human", "value": "from aiohttp import BasicAuth\nfrom plumeria import config\nfrom plumeria.command import commands, CommandError\nfrom plumeria.message import Response\nfrom plumeria.util import http\nfrom plumeria...
python
chosen
[ { "from": "system", "value": "Reduce the number of processes used.\n" }, { "from": "human", "value": "import datetime\nimport multiprocessing\n\nfrom django.conf import settings\nfrom django.core.management.base import BaseCommand, CommandError\n\nfrom core.models import WebPage, PageScrapeResul...
python
chosen
[ { "from": "system", "value": "Add load gpg to get an instance of gpg\n" }, { "from": "human", "value": "import os\nimport gnupg\nimport logging\n\nfrom .utils import which\n\n\ndef create_key_input(gpg, passphrase, testing=False):\n key_input = gpg.gen_key_input(\n name_real='Pysswords...
python
chosen
[ { "from": "system", "value": "Print rule difference between good and bad sets.\n" }, { "from": "human", "value": "class ContractDebugger:\n\n def __init__(self, pathCondGen):\n self.pathCondGen = pathCondGen\n\n def explain_failures(self, contract_name, contract, success_pcs, failed...
python
chosen
[ { "from": "system", "value": "Add description to ethnicity model\n" }, { "from": "human", "value": "# -*- coding: utf-8 -*-\n# #############################################################################\n#\n# Tech-Receptives Solutions Pvt. Ltd.\n# Copyright (C) 2004-TODAY Tech-Receptives(<h...
python
chosen
[ { "from": "system", "value": "Check availability when approving rental request\n" }, { "from": "human", "value": "from django.http import HttpResponseForbidden\nfrom django.shortcuts import redirect, get_object_or_404\nfrom django.views import View\nfrom rental.state_transitions import allowed_t...
python
chosen
[ { "from": "system", "value": "Add block structure to perception handler. Slightly change perception handler logic.\n" }, { "from": "human", "value": "\"\"\"\nModule that holds classes that represent an agent's perception handler.\n\"\"\"\n\nimport abc\nimport world\nimport structure\n\nclass Per...
python
chosen
[ { "from": "system", "value": "Fix typo authored_data -> authored_date\n" }, { "from": "human", "value": "from github2.core import BaseData, GithubCommand, Attribute, DateAttribute\n\n\nclass Commit(BaseData):\n message = Attribute(\"Commit message.\")\n parents = Attribute(\"List of parent...
python
chosen
[ { "from": "system", "value": "Allow override of template through return value of render_fields.\n" }, { "from": "human", "value": "# -*- coding: utf-8 -*-\nfrom __future__ import print_function, division, absolute_import, unicode_literals\nimport itertools\nfrom .util import trim\n\ndef render(i...
python
chosen
[ { "from": "system", "value": "Allow svg as email logo attachment\n" }, { "from": "human", "value": "from email.mime.image import MIMEImage\n\nfrom django.contrib.staticfiles import finders\nfrom .base import EmailBase\n\n\nclass PlatformEmailMixin:\n \"\"\"\n Attaches the static file image...
python
chosen
[ { "from": "human", "value": "Add script to generate the yaml files for experiments\n" }, { "from": "gpt", "value": "import yaml\nimport copy\n\nvacuum_switching_lengths = [0, 100, 500, 1000, 5000, 10000]\nsolvent_switching_lengths = [500, 1000, 5000, 10000, 20000, 50000]\n\nuse_sterics = [True, ...
python
chosen
[ { "from": "system", "value": "Verify that event end and start keys exist before accessing.\n" }, { "from": "human", "value": "# -*- coding: utf-8 -*-\nfrom django.db import IntegrityError\nfrom scrapy.exceptions import DropItem\nfrom titlecase import titlecase\nfrom dateutil ...
python
chosen
[ { "from": "system", "value": "Test for presence of analytics in minified JS\n\nMinifying the JS shortens variable names wherever their scope makes it possible.\nThis means that `GOVUK.analytics.trackPageView` gets shortened to something like\n`e.t.trackPageView`, and not in a predicatable way. Because the `...
python
chosen
[ { "from": "system", "value": "Fix spelling mistake in comment.\n" }, { "from": "human", "value": "from rest_framework import permissions\n\n# TODO Add write permission for 1%CREW / Assitants.\nclass IsAuthorOrReadOnly(permissions.BasePermission):\n \"\"\"\n Custom permission to only allow ...
python
chosen
[ { "from": "system", "value": "Use plural names for resource types in URLs\n" }, { "from": "human", "value": "from django.conf.urls.defaults import patterns, include, url\n\nfrom boundaryservice.views import *\n\nurlpatterns = patterns('',\n url(r'^boundary-set/$', BoundarySetListView.as_view(...
python
chosen
[ { "from": "system", "value": "Remove man link for erlang in ubuntu\n" }, { "from": "human", "value": "\nimport os\nfrom kokki import *\n\nPackage(\"erlang\")\n\nPackage(\"mercurial\",\n provider = \"kokki.providers.package.easy_install.EasyInstallProvider\")\n\nScript(\"install-busket\",\n ...
python
chosen
[ { "from": "system", "value": "Use pathlib to read ext.conf\n" }, { "from": "human", "value": "import os\n\nimport pkg_resources\n\nfrom mopidy import config, ext\n\n__version__ = pkg_resources.get_distribution(\"Mopidy-NAD\").version\n\n\nclass Extension(ext.Extension):\n dist_name = \"Mopidy...
python
chosen
[ { "from": "human", "value": "Add abstract Consensus protocol class\n" }, { "from": "gpt", "value": "from abc import ABCMeta, abstractmethod\n\nclass Consensus(metaclass=ABCMeta):\n \"\"\"\n An interface for defining a consensus protocol.\n The 'propose' and 'decide' methods need to be d...
python
chosen
[ { "from": "system", "value": "Add newline at the end of the file for my sanity.\n" }, { "from": "human", "value": "# -*- coding: utf-8 -*-\n\"\"\"\n test_pops\n ~~~~~~~~~\n\n tests for population code\n\"\"\"\nfrom abm import pops\nfrom abm.entities import Task\nimport pytest\n\nfrom sc...
python
chosen
[ { "from": "system", "value": "Update \"Colleges Roomies from Hell\" after site change\n" }, { "from": "human", "value": "from comics.aggregator.crawler import CrawlerBase, CrawlerImage\nfrom comics.core.comic_data import ComicDataBase\n\n\nclass ComicData(ComicDataBase):\n name = \"Colleges R...
python
chosen
[ { "from": "system", "value": "Remove field that has now the same default implementation on it's super class.\n" }, { "from": "human", "value": "# Copyright (c) 2009-2010 gocept gmbh & co. kg\n# See also LICENSE.txt\n\nimport zeit.content.cp.browser.blocks.teaser\nimport zeit.content.cp.interface...
python
chosen
[ { "from": "system", "value": "Add method to rotate triangle\n" }, { "from": "human", "value": "#!/usr/bin/env python3\n\nclass Triangle:\n \"\"\"A class structure for storing and minipulating a triangle.\n\n The trianlge is represented as a 3-tuple of points. Each point is\n represented...
python
chosen
[ { "from": "system", "value": "Fix query string update helper.\n" }, { "from": "human", "value": "# coding: utf-8\nimport random\nimport urlparse\nfrom string import ascii_letters, digits\nfrom urllib import urlencode\n\n# From http://tools.ietf.org/html/rfc6750#section-2.1\nBEARER_TOKEN_CHARSET ...
python
chosen
[ { "from": "system", "value": "Fix hybrid2, but it is still no use\n" }, { "from": "human", "value": "Config(\n net=Config(attention_type='hybrid2',\n shift_predictor_dims=[100],\n max_left=10,\n max_right=100),\n initialization=[\n (\"/recog...
python
chosen
[ { "from": "system", "value": "Fix the FileNotFoundError when data director is not exist\n" }, { "from": "human", "value": "#-*- coding: utf-8 -*-\nimport pandas as pd\nimport pandas_datareader.data as web\nimport datetime\nimport config\nimport os\nimport re\nimport pickle\n\ndef get_file_path(c...
python
chosen
[ { "from": "system", "value": "Add functionality to connect to DB server and initialize our blog's database\n" }, { "from": "human", "value": "# -*- coding: utf-8 -*-\nfrom flask import Flask\n\nDB_SCHEMA = \"\"\"\nDROP TABLE IF EXISTS entries;\nCREATE TABLE entries (\n id serial PRIMARY KEY,\...
python
chosen
[ { "from": "system", "value": "Use more concise way to get tld\n" }, { "from": "human", "value": "from dateutil.parser import parse\n\n\nclass Domain(object):\n def __init__(self, data):\n self.name = data['name']\n self.auto_renew = (data['f_auto_renew'] == 'Y')\n self.ex...
python
chosen
[ { "from": "system", "value": "Add EntryTagsSerializer for returning tags of an Entry\n" }, { "from": "human", "value": "# -*- coding: utf-8 -*-\n#\n# (c) 2014 Bjoern Ricks <bjoern.ricks@gmail.com>\n#\n# See LICENSE comming with the source of 'trex' for details.\n#\n\nfrom rest_framework.serializ...
python
chosen
[ { "from": "system", "value": "Fix bug in EdgeDescriptor setting.\n" }, { "from": "human", "value": "\nfrom binary_descriptor import BinaryDescriptor\nimport amitgroup as ag\nimport amitgroup.features\n\n# TODO: This is temporarily moved\n#@BinaryDescriptor.register('edges')\nclass EdgeDescriptor...
python
chosen
[ { "from": "system", "value": "Change maker self URL name\n" }, { "from": "human", "value": "from django.conf.urls import patterns, url\n\nfrom maker.views import (RegsitrationView,\n AuthenticationView,\n MakerSelfView,\n ...
python
chosen
[ { "from": "system", "value": "Use correct rabbit certs on old IP setter\n" }, { "from": "human", "value": "import pytest\n\nfrom cosmo_tester.framework.test_hosts import Hosts, get_image\nfrom cosmo_tester.test_suites.snapshots import get_multi_tenant_versions_list\n\n\n@pytest.fixture(scope='fu...
python
chosen
[ { "from": "human", "value": "Add unit tests for InfrequentValueEncoder\n" }, { "from": "gpt", "value": "# pylint: disable=missing-docstring, invalid-name, import-error\nimport pandas as pd\n\nfrom mltils.encoders import InfrequentValueEncoder\n\n\ndef test_infrequent_value_encoder_1():\n ive ...
python
chosen
[ { "from": "system", "value": "Send an empty list instead of None if no projects\n\nselected for homepage.\n" }, { "from": "human", "value": "from bluebottle.quotes.models import Quote\nfrom bluebottle.slides.models import Slide\nfrom bluebottle.statistics.models import Statistic\nfrom bluebottle...
python
chosen
[ { "from": "system", "value": "Revert \"added a test for the map_reader before map_init -case which fails currently\"\n(deprecate init functions instead)\n\nThis reverts commit 88551bf444b7b358fea8e7eb4475df2c5d87ceeb.\n" }, { "from": "human", "value": "from disco.test import TestCase, TestJob\n\...
python
chosen
[ { "from": "system", "value": "Update the importer to use the places service\n" }, { "from": "human", "value": "from datetime import timedelta\nimport httplib\nfrom tempfile import TemporaryFile\nfrom zipfile import ZipFile\nfrom celery.schedules import schedule\n\nfrom molly.apps.places.parsers....
python
chosen
[ { "from": "system", "value": "Test that a request defaults to sending an image\n" }, { "from": "human", "value": "# pylint: disable=unused-variable\n\nfrom unittest.mock import patch, Mock\n\nfrom memegen.app import create_app\nfrom memegen.settings import get_config\nfrom memegen.routes._common...
python
chosen
[ { "from": "system", "value": "Fix the XML format produced\n" }, { "from": "human", "value": "#!/usr/bin/python\n\nimport sys\nimport os\n\nname = sys.argv[1]\n\nstatus = sys.stdin.readline()\nstatus = status.rstrip(os.linesep)\n\nprint(\"<%s>\" % name)\nprint(\"\\t<status=\\\"%s\\\" />\" % statu...
python
chosen
[ { "from": "system", "value": "Support multiple servers and retries\n\n" }, { "from": "human", "value": "# coding=utf-8\n# Distributed under the MIT software license, see the accompanying\n# file LICENSE or http://www.opensource.org/licenses/mit-license.php.\n\nimport sys\nfrom time import time\n...
python
chosen
[ { "from": "system", "value": "Create empty 'segments' object in session if none exists\n" }, { "from": "human", "value": "from personalisation.models import AbstractBaseRule, Segment\n\n\nclass SegmentMiddleware(object):\n \"\"\"Middleware for testing and putting a user in a segment\"\"\"\n\n...
python
chosen
[ { "from": "system", "value": "Make the odd string translatable.\n" }, { "from": "human", "value": "from django import forms\n\nfrom discussion.models import Comment, Post, Discussion\nfrom notification.models import NoticeSetting\n\n\nclass CommentForm(forms.ModelForm):\n class Meta:\n ...
python
chosen
[ { "from": "system", "value": "Remove admin docs by default since they are never used." }, { "from": "human", "value": "from django.conf.urls import patterns, include, url\nfrom django.contrib import admin\n\nadmin.autodiscover()\n\nurlpatterns = patterns('',\n url(r'^admin/doc/', include('dja...
python
chosen
[ { "from": "system", "value": "Update dsub version to 0.4.2\n\nPiperOrigin-RevId: 337172014\n" }, { "from": "human", "value": "# Copyright 2017 Google Inc. All Rights Reserved.\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may not use this file except in complianc...
python
chosen
[ { "from": "system", "value": "Upgrade to new urlpatterns format" }, { "from": "human", "value": "from django.conf.urls import patterns, url\n\n# API URLs\nfrom .views import LocationFromIpView\n\nurlpatterns = patterns('',\n url(r'^location/(?P<ip_address>(\\d{1,3}\\.\\d{1,3}\\.\\d{1,3}\\.\\d...
python
chosen
[ { "from": "system", "value": "Update what's needed to correct mask and model\n" }, { "from": "human", "value": "\n'''\nSwap the spatial axes. Swap the spectral and stokes axes.\n'''\n\nimport sys\nfrom astropy.io import fits\n\n\nhdu = fits.open(sys.argv[1], mode='update')\n\nhdu[0].data = hdu[0...
python
chosen
[ { "from": "system", "value": "Fix unit tests for the blacklist\n" }, { "from": "human", "value": "import unittest\n\nimport config\nfrom .. import ntokloapi\n\n\nclass BlacklistTest(unittest.TestCase):\n\n def setUp(self):\n self.blacklist = ntokloapi.Blacklist(config.TEST_KEY, config....
python
chosen
[ { "from": "system", "value": "Add __str__, __unicode__, and __repr__\n" }, { "from": "human", "value": "from django.db import models\n\n\nclass Lease(models.Model):\n class Meta:\n db_table = 'autoreg'\n\n mac = models.CharField(max_length=17, db_index=True)\n ip = models.Integer...
python
chosen
[ { "from": "system", "value": "Add get_resolver() util and remove get_device() (now use ua-parser).\n" }, { "from": "human", "value": "# -*- coding: utf-8 -*-\nimport importlib\nimport re\nimport warnings\n\nfrom django.conf import settings\nfrom django.utils.translation import ugettext_lazy as _...
python
chosen
[ { "from": "system", "value": "Add a -vvv mode to log when tests are queued for running.\n\nIf one is running a bunch of tests in parallel and something\nis not working right, it can be useful to see which tests are\ncurrently executing at the same time. There isn't a great way\nto do this in typ, because we...
python
chosen
[ { "from": "system", "value": "Add simple login form in the API.\n\nThis is usefull for developers to explore the Browlable api directly\non the browser.\n" }, { "from": "human", "value": "\"\"\"snowman URL Configuration\n\nThe `urlpatterns` list routes URLs to views. For more information please ...
python
chosen
[ { "from": "system", "value": "Remove all unused code in text renderer.\n" }, { "from": "human", "value": "import colorsys\nfrom PIL import Image, ImageFont, ImageDraw\n\n\nclass TextRenderer:\n\n def __init__(self, font=\"./NotoSansCJK-Bold.otf\",\n font_color=(0, 120, 0), col...
python
chosen
[ { "from": "system", "value": "Make sure layer artist icon updates when changing the color mode or colormaps" }, { "from": "human", "value": "from __future__ import absolute_import, division, print_function\n\nfrom glue.external.echo import CallbackProperty, keep_in_sync\nfrom glue.core.state_obj...
python
chosen
[ { "from": "system", "value": "Use managed transfer for uploading\n" }, { "from": "human", "value": "import pandas as pd\nimport gzip\nimport boto3\nimport re\n\n\ndef default_key_map(key):\n return re.sub('_input', '_output', key)\n\n\nclass S3Dest():\n def __init__(self, key_map=default_...
python
chosen
[ { "from": "system", "value": "Write hack locations to json after parsing log file\n" }, { "from": "human", "value": "from django.core.management.base import BaseCommand, CommandError\n\nfrom ...cron import parse_auth_log\n\nclass Command(BaseCommand):\n def handle(self, *args, **options):\n ...
python
chosen
[ { "from": "system", "value": "Use uitools.sip instead of straight sip" }, { "from": "human", "value": "\ntry:\n import sip\n from uitools.qt import QtCore\n import maya.OpenMayaUI as apiUI\n\n# These modules will not exist while building the docs.\nexcept ImportError:\n import os\n ...
python
chosen
[ { "from": "system", "value": "Remove explicit link to homepage view in i4p_base\n" }, { "from": "human", "value": "#-- encoding: utf-8 --\nfrom django.conf.urls.defaults import patterns, url\n\nfrom haystack.views import search_view_factory\n\nimport views\nimport ajax\n\nurlpatterns = patterns(...
python
chosen
[ { "from": "system", "value": "Return added stop in StopBin.add_stop()\n" }, { "from": "human", "value": "\"\"\"Stop Bins.\"\"\"\nimport util\nimport errors\nimport registry\nimport entities\n\nclass StopBin(object):\n def __init__(self, prefix):\n self.prefix = prefix\n self._stops = {}\n...
python
chosen
[ { "from": "system", "value": "Revert last commit and tiggers _count_attended_registration method when one registrations.state changes\n" }, { "from": "human", "value": "# -*- encoding: utf-8 -*-\n##############################################################################\n# For copyright and ...
python
chosen
[ { "from": "system", "value": "Implement correct function signature in dummy API and sleep trigger\n" }, { "from": "human", "value": "import os\n\nfrom celery import Celery\n\napp = Celery('dummy_tasks', broker=os.environ['TEST_HADES_BROKER_URI'],\n backend=os.environ['TEST_HADES_RESU...
python
chosen
[ { "from": "system", "value": "Use requirements.txt for all requirements, at least for now.\n" }, { "from": "human", "value": "import os\n\nfrom setuptools import setup, find_packages\n\nhere = os.path.abspath(os.path.dirname(__file__))\nREADME = open(os.path.join(here, 'README.txt')).read()\n\nv...
python
chosen
[ { "from": "system", "value": "Fix lint issues related to long lines\n" }, { "from": "human", "value": "from ..constants import FORMAT_CHECKS\nfrom ..post import HEADER_OPTIONAL_FIELD_TYPES, HEADER_REQUIRED_FIELD_TYPES\nfrom ..postprocessor import KnowledgePostProcessor\n\n\nclass FormatChecks(Kn...
python
chosen
[ { "from": "system", "value": "Fix infinite retry while deleting missing resource in WABS\n" }, { "from": "human", "value": "from wal_e import retries\nfrom wal_e.worker.base import _Deleter\n\n\nclass Deleter(_Deleter):\n\n def __init__(self, wabs_conn, container):\n super(Deleter, sel...
python
chosen
[ { "from": "system", "value": "Add PySide-style version metadata when PyQt4 is present.\n" }, { "from": "human", "value": "import os\n\nqt_api = os.environ.get('QT_API', 'pyqt')\n\nif qt_api == 'pyqt':\n from PyQt4.QtCore import *\n\n from PyQt4.QtCore import pyqtSignal as Signal\n from ...
python
chosen
[ { "from": "system", "value": "Add weighted graph in main()\n" }, { "from": "human", "value": "from __future__ import absolute_import\nfrom __future__ import division\nfrom __future__ import print_function\n\ndef kruskal():\n\t\"\"\"Kruskal's algorithm for minimum spanning tree in weighted graph....
python
chosen
[ { "from": "system", "value": "py_simple: Fix python example after the API update.\n" }, { "from": "human", "value": "#!/usr/bin/env python\nimport sys\n\nimport gfxprim.core as core\nimport gfxprim.loaders as loaders\nimport gfxprim.filters as filters\n\ndef main():\n if len(sys.argv) != 3:\n...
python
chosen
[ { "from": "system", "value": "Update dsub version to 0.3.7.dev0\n\nPiperOrigin-RevId: 281987296\n" }, { "from": "human", "value": "# Copyright 2017 Google Inc. All Rights Reserved.\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": "Allow user to specify image file w argv\n" }, { "from": "human", "value": "from PIL import Image\nimport sys\n\nimport pyocr\nimport pyocr.builders\n\n\ntools = pyocr.get_available_tools()\nif len(tools) == 0:\n print(\"Error: No OCR tool found\")\n sys.exit(1...
python
chosen
[ { "from": "system", "value": "Update to v0.7.0 for release\n" }, { "from": "human", "value": "# single source of truth for package version,\n# see https://packaging.python.org/en/latest/single_source_version/\n__version__ = \"0.6.0\"\n" }, { "from": "gpt", "value": "# single source o...
python
chosen
[ { "from": "system", "value": "Implement __getattr__ to handle KeyErrors\n" }, { "from": "human", "value": "#!/usr/bin/env python\n\nimport json\nimport sys\nimport os # For os.path and the like\n\nclass DictWrapper(object):\n def __init__(self, d):\n self.__dict__ = d\n def eval_scr...
python
chosen
[ { "from": "system", "value": "Add function for get filter types\n" }, { "from": "human", "value": "#!/usr/bin/env python\n\nimport click\nimport ebisearch\nfrom pprint import pprint\n\n\n@click.group()\ndef main():\n pass\n\n\n@click.command('get_results', short_help='Get list of results')\nd...
python
chosen
[ { "from": "system", "value": "Change dataset used in example (letter)\n\nXXX: UncertaintySampling(le) weird?\n" }, { "from": "human", "value": "#!/usr/bin/env python3\n#\n# This script is used for downloading the dataset used by the examples.\n# Dataset used: UCI / Pima Indians Diabetes (in libs...
python
chosen
[ { "from": "system", "value": "Fix migration of covid product\n" }, { "from": "human", "value": "from openupgradelib import openupgrade\n\n\n@openupgrade.migrate(use_env=True)\ndef migrate(env, version):\n if not version:\n return\n\n # Associate already created toilets fund to new x...
python
chosen
[ { "from": "system", "value": "Use argparse for 4D to 3D" }, { "from": "human", "value": "#!/usr/bin/env python\n''' Tiny script to write 4D files in any format that we read (nifti,\nanalyze, MINC, at the moment, as nifti 3D files '''\n\nimport os\nimport sys\n\nimport nipy.io.imageformats as nii...
python
chosen
[ { "from": "system", "value": "Mark package as not zip_safe\n\nThis package needs access to its templates to function. Thus, the\nzip_safe flag has been set to False to tell setuptools to not\ninstall the package's egg as a zip file.\n\nSee http://pythonhosted.org/distribute/setuptools.html#setting-the-zip-s...
python
chosen
[ { "from": "system", "value": "Update click requirement from <6.8,>=6.7 to >=6.7,<7.1\n\nUpdates the requirements on [click](https://github.com/pallets/click) to permit the latest version.\n- [Release notes](https://github.com/pallets/click/releases)\n- [Changelog](https://github.com/pallets/click/blob/maste...
python
chosen
[ { "from": "system", "value": "Move probes to their own directory\n" }, { "from": "human", "value": "from distutils.core import setup, Extension\nimport sys\n\n\next_modules = [\n Extension('classified._platform',\n ['src/classified._platform.c'],\n extra_compile_args=[\n ...
python
chosen
[ { "from": "system", "value": "Add entry point scripts for CLI create/delete\n" }, { "from": "human", "value": "from setuptools import setup, find_packages\nsetup(\n name = \"gitoriouslib\",\n version = \"0.1\",\n packages = find_packages(),\n install_requires = ['httplib2>=0.7.2']\n)...
python
chosen