conversations
listlengths
2
3
source
stringclasses
1 value
stack
stringclasses
1 value
[ { "from": "system", "value": "Update list of supported programming languages\n" }, { "from": "human", "value": "try:\n from setuptools import setup\nexcept ImportError:\n from distutils.core import setup\n\nsetup(name='parquet',\n version='1.0',\n description='Python support for Parq...
python
chosen
[ { "from": "system", "value": "Add video convert script to install.\n" }, { "from": "human", "value": "#!/usr/bin/env python\n\nimport os\nimport sys\nimport re\n\nfrom setuptools import find_packages, setup, Extension\n\n\ndef get_version():\n ver = 'unknown'\n if os.path.isfile(\"photosor...
python
chosen
[ { "from": "system", "value": "Set lowest version of oic to use\n\nSigned-off-by: Ivan Kanakarakis <f60d6943d72436645c4304926eeeac2718a1142c@gmail.com>\n" }, { "from": "human", "value": "from setuptools import setup, find_packages\n\nsetup(\n name='pyop',\n version='3.0.0',\n packages=fi...
python
chosen
[ { "from": "system", "value": "Use more standard compliant glob syntax\n" }, { "from": "human", "value": "# ! DO NOT MANUALLY INVOKE THIS setup.py, USE CATKIN INSTEAD\n\nfrom distutils.core import setup\nfrom catkin_pkg.python_setup import generate_distutils_setup\n\n# fetch values from package.x...
python
chosen
[ { "from": "system", "value": "Fix email address for pypi\n" }, { "from": "human", "value": "#!/usr/bin/python\n# -*- coding: utf-8 -*-\n\nfrom setuptools import setup\n\n\nsetup(name='rdspgbadger',\n version='1.2.0',\n description=(\"Fetch logs from RDS postgres instance and use them w...
python
chosen
[ { "from": "system", "value": "Remove CLI stuff, bump version to 0.1.0\n" }, { "from": "human", "value": "from setuptools import setup\n\nsetup(\n name='plumbium',\n version='0.0.5',\n packages=['plumbium'],\n zip_safe=True,\n install_requires=[\n 'Click',\n ],\n entry...
python
chosen
[ { "from": "system", "value": "Install ipython in development environment\n" }, { "from": "human", "value": "from setuptools import setup\n\nname = 'turbasen'\nVERSION = '2.4.6'\n\nsetup(\n name=name,\n packages=[name],\n version=VERSION,\n description='Client for Nasjonal Turbase RES...
python
chosen
[ { "from": "system", "value": "Update tattle version to 0.1.0\n\nPrevious version number was 0.1\n" }, { "from": "human", "value": "from setuptools import setup\n\nsetup(\n name='tattle',\n version='0.1',\n packages=[\n 'tattle',\n ],\n install_requires=[\n 'requests>...
python
chosen
[ { "from": "system", "value": "Fix link to spec in README\n" }, { "from": "human", "value": "from setuptools import setup\nimport codecs\n\n\ndef readme(fn):\n with codecs.open(fn, encoding='utf-8') as f:\n return f.read()\n\n\nsetup(name='openrtb',\n version='0.1.0',\n packag...
python
chosen
[ { "from": "system", "value": "Remove download URL since Github doesn't get his act together. Damnit\n\ngit-svn-id: https://django-robots.googlecode.com/svn/trunk@36 12edf5ea-513a-0410-8a8c-37067077e60f\n\ncommitter: leidel <leidel@12edf5ea-513a-0410-8a8c-37067077e60f>\n\n--HG--\nextra : convert_revision : a...
python
chosen
[ { "from": "system", "value": "Fix compiling flags for darwin.\n\nThe OpenBLAS formula is keg-only, which means it was not symlinked into\n/usr/local. Thus, we need to add the build variables manually.\nAlso, the library is named as openblas, which means `-llapack` and `-llapacke`\nwill cause library not fou...
python
chosen
[ { "from": "system", "value": "Change about read \"token\" & \"domain\"\n\n" }, { "from": "human", "value": "import requests\nimport json\nimport time\nimport sys\n\n_token = \"xxxxxxx\"\n_domain = \"xxxxxxx\"\n\ndef del_time(Day):\n Set_time = str(int(time.time())-Day*86400)\n return Set_t...
python
chosen
[ { "from": "system", "value": "fix: Update allowed hosts to the new domain\n" }, { "from": "human", "value": "import dj_database_url\nfrom .default import *\n\nDEBUG = False\n\nSECRET_KEY = os.getenv('DJANGO_SECRET_KEY', None)\n\nALLOWED_HOSTS = ['agendaodonto.herokuapp.com']\n\nDATABASES = {'def...
python
chosen
[ { "from": "system", "value": "Add lookup for an arbitrary date\n\nIn the form “mm dd yyyy”.\n" }, { "from": "human", "value": "from tenyksservice import TenyksService, run_service\nfrom ddate.base import DDate\n\nclass DiscordianDate(TenyksService):\n direct_only = True\n irc_message_filte...
python
chosen
[ { "from": "system", "value": "Revert \"[FIX] test_main_flows: missing dependency to run it in a browser\"\n\nThis reverts commit 58e914425033a9604885fb0cdd7de1a6a144c4da.\n" }, { "from": "human", "value": "# -*- coding: utf-8 -*-\n# Part of Odoo. See LICENSE file for full copyright and licensing...
python
chosen
[ { "from": "system", "value": "Define instance attributes on __init__.\n\nPySC2: Import of refs/pull/48/head\nPiperOrigin-RevId: 166837442\n" }, { "from": "human", "value": "# Copyright 2017 Google Inc. All Rights Reserved.\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n...
python
chosen
[ { "from": "system", "value": "Use protocol relative adzerk url\n" }, { "from": "human", "value": "from urllib import quote\n\nfrom pylons import tmpl_context as c\nfrom pylons import app_globals as g\n\nfrom r2.lib.pages import Ads as BaseAds\nfrom r2.models.subreddit import DefaultSR\n\n\nFRONT...
python
chosen
[ { "from": "system", "value": "Fix redirect generation for reverse proxied solutions\n" }, { "from": "human", "value": "from datetime import timedelta, datetime\nfrom functools import wraps\nimport hmac\nfrom hashlib import sha1\nfrom flask import Blueprint, session, redirect, url_for, request, c...
python
chosen
[ { "from": "system", "value": "Add some more simple tests\n" }, { "from": "human", "value": "# This tests the very basic talk stuff, to ensure some levels of sanity\n\n\ndef test_add_talk():\n \"\"\"Create a user and add a talk to it\"\"\"\n from django.contrib.auth.models import User\n ...
python
chosen
[ { "from": "system", "value": "Add tests for closing a socket\n" }, { "from": "human", "value": "from http_server import HttpServer\nimport socket\n\n\ndef test_200_ok():\n s = HttpServer()\n assert s.ok() == \"HTTP/1.1 200 OK\"\n\n\ndef test_200_ok_byte():\n s = HttpServer()\n assert...
python
chosen
[ { "from": "system", "value": "Fix the quantization factor for writing.\n" }, { "from": "human", "value": "import numpy as np\nfrom scipy.io import wavfile\n\ndef normalize(samples):\n max_value = np.max(np.abs(samples))\n return samples / max_value if max_value != 0 else samples\n\ndef sav...
python
chosen
[ { "from": "system", "value": "Add flag options for flush and offline modes\n\nFixes #65\n" }, { "from": "human", "value": "import sys\nfrom uiplib.scheduler import scheduler\n\nif __name__ == \"__main__\":\n print(\"Hey this is UIP! you can use it to download\"\n \" images from reddi...
python
chosen
[ { "from": "system", "value": "Add twitter API functionality test\n" }, { "from": "human", "value": "\"\"\"\nTests for TwitterSA\n\nThese tests might be overkill, it's my first time messing around\nwith unit tests.\n\nJesse Mu\n\"\"\"\n\nimport TwitterSA\nimport unittest\n\n\nclass TwitterSATestC...
python
chosen
[ { "from": "system", "value": "Add test for adding a page\n" }, { "from": "human", "value": "from django.test import TestCase\nfrom django.contrib.auth.models import User\nfrom mainstay.test_utils import MainstayTest\n\nfrom .models import Page\n\n\nclass WikiTestCase(MainstayTest):\n fixtures...
python
chosen
[ { "from": "system", "value": "Add basic data parsing, userrights changes\n" }, { "from": "human", "value": " #!/usr/bin/env python\n\n\"\"\" Returns basic statistics about the user, including edit count, creation date, and block log. \"\"\"\n\nDEPTH = 1\n\nimport config\nsite = config.site\n\ncl...
python
chosen
[ { "from": "system", "value": "TEST: Use bold_reference_wf to generate reference before enhancing\n" }, { "from": "human", "value": "''' Testing module for fmriprep.workflows.base '''\nimport pytest\n\nimport numpy as np\nfrom nilearn.image import load_img\nfrom ..utils import init_enhance_and_sk...
python
chosen
[ { "from": "system", "value": "Use related_name etc to avoid code\n\nSigned-off-by: Chris Lamb <711c73f64afdce07b7e38039a96d2224209e9a6c@chris-lamb.co.uk>\n" }, { "from": "human", "value": "from rest_framework import serializers, viewsets\nfrom rest_framework.response import Response\nfrom rest_f...
python
chosen
[ { "from": "system", "value": "Add get_filter_set_kwargs for instanciating FilterSet with additional arguments" }, { "from": "human", "value": "from django.core.exceptions import ImproperlyConfigured\nfrom django.views.generic import ListView\n\nclass ListFilteredMixin(object):\n \"\"\"\n M...
python
chosen
[ { "from": "system", "value": "Increase the version number to `0.4.4`\n" }, { "from": "human", "value": "# -*- coding: utf-8 -*-\n\nfrom __future__ import absolute_import\nfrom __future__ import division\nfrom __future__ import print_function\nfrom __future__ import unicode_literals\n\n__version_...
python
chosen
[ { "from": "system", "value": "Add default port to database connection script\n\nThe default port is used if the ~/.catmaid-db file doesn't contain it. This\nfixes #454.\n" }, { "from": "human", "value": "import sys\nimport psycopg2\nimport os\nimport yaml\n\nif 'CATMAID_CONFIGURATION' in os.envi...
python
chosen
[ { "from": "human", "value": "Make sure reports are loaded so location_safe is applied\n" }, { "from": "gpt", "value": "from django.apps import AppConfig\n\n\nclass ICDSReportsAppConfig(AppConfig):\n name = 'custom.icds_reports'\n\n def ready(self):\n import custom.icds_reports.repor...
python
chosen
[ { "from": "system", "value": "Fix token names format for readability.\n" }, { "from": "human", "value": "INTEGER, PLUS, MINUS, MULTIPLY, DIVIDE, LPAREN, RPAREN, EOF, OPEN, CLOSE, BANG, ASSIGN, SEMI, ID = (\n 'INTEGER',\n 'PLUS',\n 'MINUS',\n 'MULTIPLY',\n 'DIVIDE',\n 'LPAREN',\...
python
chosen
[ { "from": "system", "value": "Add author public key info to Transaction class\n" }, { "from": "human", "value": "import signature\n\n\nclass Transaction:\n def __init__(self, data, signature):\n self.data = data\n self.signature = signature\n\n def get_string(self):\n ...
python
chosen
[ { "from": "system", "value": "Remove endpoint from test (it has been removed in lieu of User admin).\n" }, { "from": "human", "value": "\"\"\"General functional tests for the Server admin.\"\"\"\n\n\nfrom sal.test_utils import AdminTestCase\n\n\nclass ServerAdminTest(AdminTestCase):\n \"\"\"T...
python
chosen
[ { "from": "system", "value": "Add `pathfinder` to the library namespace\n" }, { "from": "human", "value": "from .diagnostics import effective_sample_size as ess\nfrom .diagnostics import potential_scale_reduction as rhat\nfrom .kernels import (\n adaptive_tempered_smc,\n elliptical_slice,\...
python
chosen
[ { "from": "system", "value": "Add unit tests to mbed-greentea version printing API\n" }, { "from": "human", "value": "#!/usr/bin/env python\n\"\"\"\nmbed SDK\nCopyright (c) 2011-2015 ARM Limited\n\nLicensed under the Apache License, Version 2.0 (the \"License\");\nyou may not use this file excep...
python
chosen
[ { "from": "system", "value": "Comment out our one breaking example from pipeline\n" }, { "from": "human", "value": "#!/usr/bin/env python\n\nimport os\nfrom jinja2 import Template\n\nclusters = ['1-12', '2-0', '2-1', '2-2']\ntiles = [d for d in os.listdir('../examples') if os.path.isdir(os.path....
python
chosen
[ { "from": "system", "value": "Make sure to rename the sound file to its checksum\n" }, { "from": "human", "value": "import hashlib\n\nfrom rest.models import Sound\nfrom rest_framework import generics\nfrom rest.serializers import SoundListCreateSerializer\nfrom rest.serializers import SoundRetr...
python
chosen
[ { "from": "system", "value": "Add setUpClass method to DNSBLTest\n\nThis method is used to set up a common instance of DNSBL for testing\n" }, { "from": "human", "value": "#!/usr/bin/python\n# -*- coding: utf-8 -*-\n\nimport unittest\n\n\nclass DNSBLTest(unittest.TestCase):\n pass\n\n\n\nif _...
python
chosen
[ { "from": "system", "value": "Test for bigWig aggregation modes\n" }, { "from": "human", "value": "import clodius.tiles.bigwig as hgbi\nimport os.path as op\n\ndef test_bigwig_tiles():\n filename = op.join('data', 'wgEncodeCaltechRnaSeqHuvecR1x75dTh1014IlnaPlusSignalRep2.bigWig')\n\n meanv...
python
chosen
[ { "from": "system", "value": "Make spell test Python3 compatible\n" }, { "from": "human", "value": "\nfrom metakernel.tests.utils import (get_kernel, get_log_text, EvalKernel,\n clear_log_text)\n\n\ndef test_spell_magic():\n kernel = get_kernel(EvalKernel)\n...
python
chosen
[ { "from": "system", "value": "Use custom form for Banner model because style is a special case\n" }, { "from": "human", "value": "from django import forms\nfrom django.utils.translation import ugettext as _\n\n\nclass ImportForm(forms.Form):\n csv_file = forms.FileField(\n required=Tru...
python
chosen
[ { "from": "system", "value": "Align buffer_with_time_or_count signature with doc\n\nAccording to docs, `buffer_with_time_or_count` has an optional scheduler\nparameter but in reality it's mandatory. Let's make it optional for real\nas passing `None` as third argument all the time is a bit inconvenient.\n" ...
python
chosen
[ { "from": "system", "value": "Add @instruction decorator to mark module level funcs as handlers.\n" }, { "from": "human", "value": "\"\"\"\n ydf/instructions\n ~~~~~~~~~~~~~~~~\n\n Convert objects parsed from YAML to those that represent Dockerfile instructions.\n\"\"\"\n\n__all__ = []\...
python
chosen
[ { "from": "human", "value": "Add test that exposes leaky state\n" }, { "from": "gpt", "value": "import spylon.spark.launcher as sparklauncher\nimport os\n\ndef test_set_spark_property():\n c = sparklauncher.SparkConfiguration()\n c.driver_memory = \"4g\"\n\ndef test_spark_driver_memory():\...
python
chosen
[ { "from": "system", "value": "Add more complex move_file test" }, { "from": "human", "value": "#!/usr/bin/env python\n#encoding:utf-8\n#author:dbr/Ben\n#project:tvnamer\n#repository:http://github.com/dbr/tvnamer\n#license:Creative Commons GNU GPL v2\n# http://creativecommons.org/licenses/GPL/2.0...
python
chosen
[ { "from": "system", "value": "Add tz tests for ArrowType\n" }, { "from": "human", "value": "from datetime import datetime\nfrom pytest import mark\nimport sqlalchemy as sa\nfrom sqlalchemy_utils.types import arrow\nfrom tests import TestCase\n\n\n@mark.skipif('arrow.arrow is None')\nclass TestAr...
python
chosen
[ { "from": "system", "value": "Use `locale.format_string` to format monetary amounts\n\nPreviously used `locale.format` is deprecated as of Python 3.7 and\nsuggests to use `format_string` instead.\n" }, { "from": "human", "value": "\"\"\"\nbyceps.util.money\n~~~~~~~~~~~~~~~~~\n\nHandle monetary a...
python
chosen
[ { "from": "system", "value": "Reduce story sentences chunk size\n\nFor whatever reason 100k never finishes copying a chunk.\n" }, { "from": "human", "value": "#!/usr/bin/env python3\n\nfrom mediawords.db import connect_to_db\nfrom mediawords.util.log import create_logger\nfrom mediawords.util.pr...
python
chosen
[ { "from": "system", "value": "Include URLs from the quake project." }, { "from": "human", "value": "from django.conf.urls.defaults import patterns, include, url\nfrom django.contrib import admin\nadmin.autodiscover()\n\nurlpatterns = patterns('',\n # Examples:\n # url(r'^$', 'isthatanearth...
python
chosen
[ { "from": "system", "value": "Remove blank space at beginning\n" }, { "from": "human", "value": "\"\"\"Encodes a json representation of the business's hours into the 5-bit binary\nrepresentation used by the merge business hours turing machine. It takes input\nfrom stdin and outputs the initial t...
python
chosen
[ { "from": "system", "value": "Allow files to be uploaded through the TastyPie API\n" }, { "from": "human", "value": "import tastypie.resources\nimport tastypie.authentication\n\nimport django.db.models\n\nimport web.core.models\nimport web.core.api.authorization\n\nclass FileResource(tastypie.re...
python
chosen
[ { "from": "system", "value": "Add type annotation to EntryAlreadyExistsError\n" }, { "from": "human", "value": "\"\"\"errors\n\nJournal specific errors and exceptions\n\"\"\"\n\nclass Error(Exception):\n \"\"\"Base class for journal exceptions\"\"\"\n pass\n\n\nclass EntryAlreadyExistsErro...
python
chosen
[ { "from": "system", "value": "Fix for some version of py64 on win64\n" }, { "from": "human", "value": "from .compute_cluster_masks_cy import doaccum\n\n__all__ = ['accumulate_cluster_mask_sum']\n\ndef accumulate_cluster_mask_sum(kk, cluster_mask_sum):\n data = kk.data\n doaccum(kk.clusters...
python
chosen
[ { "from": "system", "value": "Update Seattle to print the mean at the end\n" }, { "from": "human", "value": "## Copyright (c) Cognitect, Inc.\n## All rights reserved.\n\nfrom transit.reader import JsonUnmarshaler\nimport json\nimport time\nfrom StringIO import StringIO\ndef run_tests(data):\n ...
python
chosen
[ { "from": "system", "value": "Change parameters power_curve and power_output to attributes\n" }, { "from": "human", "value": "\"\"\"\nThe ``wind_farm`` module contains the class WindFarm that implements\na wind farm in the windpowerlib and functions needed for the modelling of a\nwind farm.\n\n\...
python
chosen
[ { "from": "system", "value": "Disable npm steps on DDC bot for now\n\nThis will only regression test compilation (no running of generated\ncode), but that appears to work.\n\nR=leafp@google.com\n\nReview-Url: https://codereview.chromium.org/2646493003 .\n" }, { "from": "human", "value": "#!/usr/...
python
chosen
[ { "from": "system", "value": "Fix up to date checks for PyTarget\n" }, { "from": "human", "value": "from ..target import Target\nimport hashlib\nimport dill\nimport joblib\n\nclass PyTarget(Target):\n def __init__(self, name, obj=None):\n self._name = name\n self._obj = obj\n ...
python
chosen
[ { "from": "system", "value": "Remove tester code in publisher\n" }, { "from": "human", "value": "import os\nimport rospy\nfrom std_msgs.msg import String\n\n\n# Don't do this in your code, mkay? :)\nfib = lambda n: n if n < 2 else fib(n-1) + fib(n-2)\n\n\nclass SDPPublisher(object):\n\n def _...
python
chosen
[ { "from": "system", "value": "Add LogsManager to UserKit constructor\n" }, { "from": "human", "value": "from requestor import Requestor\nfrom users import UserManager\nfrom invites import InviteManager\nfrom emails import EmailManager\nfrom session import Session\nfrom widget import WidgetManage...
python
chosen
[ { "from": "system", "value": "Fix lingering logging statement in management command\n" }, { "from": "human", "value": "# -*- coding: utf-8 -*-\n\"\"\"Management command to list all active tokens.\"\"\"\nfrom django.core.management.base import BaseCommand\nfrom optparse import make_option\n\nfrom...
python
chosen
[ { "from": "system", "value": "Use proper relative path in django commands file\n" }, { "from": "human", "value": "from django.core.management.base import BaseCommand, CommandError\nfrom {{{ app_name }}} import model_factories\n\nMAX_RECORDS = 10\n\n\nclass Command(BaseCommand):\n help = 'Adds...
python
chosen
[ { "from": "system", "value": "Remove admin interface from emca.\n" }, { "from": "human", "value": "from django.conf.urls import patterns, include, url\n\n# Uncomment the next two lines to enable the admin:\nfrom django.contrib import admin\nadmin.autodiscover()\n\nurlpatterns = patterns('emca.vi...
python
chosen
[ { "from": "system", "value": "Drop index redirect, no longer needed\n" }, { "from": "human", "value": "from django.conf.urls import patterns, url, include\nfrom django.core.urlresolvers import get_script_prefix\nfrom django.views.generic import RedirectView\nfrom rest_framework import routers\n\...
python
chosen
[ { "from": "system", "value": "Fix a flake style issue\n" }, { "from": "human", "value": "'''TODO: Grade package docs\n'''\nfrom grader.grade.main import grade\nfrom docker import Client\n\nhelp = \"Grade assignments\"\n\n\ndef setup_parser(parser):\n parser.add_argument('folder', metavar='fol...
python
chosen
[ { "from": "system", "value": "Change to plugin interface: unload() is no longer part of the protocol, and any unloading a plugin needs to do can just be done by registering an atexit handler.\n\ngit-svn-id: b6fd099cd3d97ba56ca68c4d1ea7aaa6a131ba03@17 8b7adc99-b347-0410-ae0a-d9e86c8d69b5\n" }, { "fro...
python
chosen
[ { "from": "system", "value": "Change from CAF to MAF tag when looking for MAF in vcf file\n" }, { "from": "human", "value": "import logging\nimport json\n\nfrom loqusdb.models import ProfileVariant\nfrom .variant import get_variant_id\n\nLOG = logging.getLogger(__name__)\n\ndef get_maf(variant):...
python
chosen
[ { "from": "system", "value": "Add related name for group member\n" }, { "from": "human", "value": "from django.db.models import TextField, ManyToManyField\nfrom yunity.base.base_models import BaseModel, LocationModel\nfrom config import settings\n\n\nclass Group(BaseModel, LocationModel):\n n...
python
chosen
[ { "from": "system", "value": "Change default admin email to alex.smith@example.com\n" }, { "from": "human", "value": "# -*- coding: utf-8 -*-\nfrom __future__ import unicode_literals\n\nfrom django.db import migrations\nfrom django.contrib.auth.hashers import make_password\n\n\ndef create_users(...
python
chosen
[ { "from": "system", "value": "Fix test_format_xml with dot in path\n\nWhen the path contains dot \".\", replacing all dots will generate a non-exist result and raises a FileNotFoundError. Replacing only the last dot fixes this." }, { "from": "human", "value": "import pytest\n\nfrom mitmproxy.con...
python
chosen
[ { "from": "system", "value": "Add logging to http-get-statuscode monitor for docs example\n" }, { "from": "human", "value": "#!/usr/bin/python\n######################################################################\n# Cloud Routes Availability Manager: http-get-statuscode module\n# -------------...
python
chosen
[ { "from": "system", "value": "Add figshare CLIENT_ID and CLIENT_SECRET back into default settings.\n\n[skip ci]\n" }, { "from": "human", "value": "API_URL = 'http://api.figshare.com/v1/'\nAPI_OAUTH_URL = API_URL + 'my_data/'\n\nMAX_RENDER_SIZE = 1000\n" }, { "from": "gpt", "value": "...
python
chosen
[ { "from": "system", "value": "Fix incorrect hash in URL\n" }, { "from": "human", "value": "from challenge import Challenge\nimport flask\n\nclass c7(Challenge):\n '''\n Challenge 7\n Satoshi Base58 Encoding\n '''\n\n def __init__(self):\n super()\n self._id = '3aed43...
python
chosen
[ { "from": "system", "value": "Optimize the UI and allow the user to exit the program smoothly.\n" }, { "from": "human", "value": "import numpy as np\nimport os\nimport sys\nimport tensorflow as tf\n\nfrom settings import PROJECT_ROOT\nfrom chatbot.tokenizeddata import TokenizedData\nfrom chatbot...
python
chosen
[ { "from": "system", "value": "Break line in long line of imports." }, { "from": "human", "value": "# -*- coding: utf-8 -*-\n\nfrom .types import Environment, DiyLangError, Closure, String\nfrom .ast import is_boolean, is_atom, is_symbol, is_list, is_closure, is_integer, is_string\nfrom .parser i...
python
chosen
[ { "from": "system", "value": "Use a faster parser for bs4\n" }, { "from": "human", "value": "import scrapy\nfrom bs4 import BeautifulSoup\nfrom bs4.element import Comment\n\nclass TutorialSpider(scrapy.Spider):\n name = \"tutorialspider\"\n allowed_domains = ['*.gov']\n start_urls = ['h...
python
chosen
[ { "from": "system", "value": "Add a task to grab GNOME love bugs.\n" }, { "from": "human", "value": "from datetime import timedelta\nfrom mysite.search.models import Project\nfrom celery.task import PeriodicTask\nfrom celery.registry import tasks\nfrom mysite.search.launchpad_crawl import grab_l...
python
chosen
[ { "from": "system", "value": "Change static to new webfaction application\n" }, { "from": "human", "value": "from __future__ import absolute_import\nfrom .base import *\n\nimport json\nfrom django.core.exceptions import ImproperlyConfigured\n\n\ndef get_secret():\n try:\n with open(joi...
python
chosen
[ { "from": "system", "value": "Make COB_DATABASE_URI environment variable override existing settings\n" }, { "from": "human", "value": "import os\nimport logbook\n\nfrom .base import SubsystemBase\nfrom ..ctx import context\n\nfrom flask_migrate import Migrate\nfrom flask_sqlalchemy import SQLAlc...
python
chosen
[ { "from": "system", "value": "Add graphite cluster discovery support using rancher\n" }, { "from": "human", "value": "import os\nfrom datetime import datetime\n\nLOG_DIR = '/var/log/graphite'\nif os.getenv(\"CARBONLINK_HOSTS\"):\n CARBONLINK_HOSTS = os.getenv(\"CARBONLINK_HOSTS\").split(',')\...
python
chosen
[ { "from": "system", "value": "Remove build_assets from test since test client will neither interprete css nor javascript\n" }, { "from": "human", "value": "# -*- coding: utf-8 -*-\n\n\"\"\"Tests the application views.\n\"\"\"\nimport pytest\n\nfrom spz import app\nfrom util.init_db import recrea...
python
chosen
[ { "from": "system", "value": "Make broadcast editable for now.\n" }, { "from": "human", "value": "# -*- coding: utf-8 -*-\nfrom django.contrib import admin\n\nfrom .models import Quote\n\n\nclass QuoteAdmin(admin.ModelAdmin):\n fieldsets = (\n (None, {'fields': ('text', ('timestamp', '...
python
chosen
[ { "from": "system", "value": "dle: Use Expression, not Element, in copy_arrays\n" }, { "from": "human", "value": "import cgen as c\n\nfrom devito.codeprinter import ccode\nfrom devito.nodes import Element, Iteration\nfrom devito.visitors import MergeOuterIterations\n\n__all__ = ['compose_nodes',...
python
chosen
[ { "from": "system", "value": "Allow converting WAV to vorbis as well\n" }, { "from": "human", "value": "\"\"\"\nDub module that can be used when ffmpeg is available to deal with different\naudio formats.\n\"\"\"\nfrom io import BytesIO\n\nfrom pydub import AudioSegment\n\n\ndef convert_wav(wav, ...
python
chosen
[ { "from": "system", "value": "Disable registration of the HTML exporter for now\n" }, { "from": "human", "value": "from avocado.core import loader\nfrom avocado.conf import OPTIONAL_DEPS\nfrom _csv import CSVExporter\nfrom _sas import SASExporter\nfrom _r import RExporter\nfrom _json import JSON...
python
chosen
[ { "from": "system", "value": "Allow tokens to be created/changed on profile settings page\n" }, { "from": "human", "value": "from django import forms\nfrom django.contrib.auth.forms import UserCreationForm, AuthenticationForm\n\nfrom .models import User, Project\n\n\nclass ENUserCreationForm(Use...
python
chosen
[ { "from": "system", "value": "Add view definition for the general-insights page\n" }, { "from": "human", "value": "from django.shortcuts import render\nfrom .models import User, Text, Insight, Comment\n\n# Create your views here.\n\ndef index(request):\n \"\"\"\n View function for the home...
python
chosen
[ { "from": "system", "value": "Fix bug in current track\n" }, { "from": "human", "value": "import subprocess\n\n\ndef main():\n st = subprocess.getoutput(\"mpc\")\n lin = st.split(\"\\n\")\n if len(lin) > 1:\n sn_status = lin[1]\n duration = lin[1].split(\" \")\n if ...
python
chosen
[ { "from": "system", "value": "Use repr for assert failure\n" }, { "from": "human", "value": "IRRELEVANT = object()\n\n\nclass ChangeWatcher(object):\n\n def __init__(self, thing, *args, **kwargs):\n self.thing = thing\n self.args = args\n self.kwargs = kwargs\n sel...
python
chosen
[ { "from": "system", "value": "Remove run method (useless) in Base class\n" }, { "from": "human", "value": "\"\"\"The base command.\"\"\"\n\nimport ConfigParser\nimport os\n\nimport putiopy\n\n\nclass Base(object):\n \"\"\"A base command.\"\"\"\n\n def __init__(self, options):\n self...
python
chosen
[ { "from": "system", "value": "Set author to 'Mozilla Automation and Testing Team'\n" }, { "from": "human", "value": "# This Source Code Form is subject to the terms of the Mozilla Public\n# License, v. 2.0. If a copy of the MPL was not distributed with this\n# file, You can obtain one at http://...
python
chosen
[ { "from": "system", "value": "Move makeconf state tests to pytest\n" }, { "from": "human", "value": "\"\"\"\n :codeauthor: Jayesh Kariya <jayeshk@saltstack.com>\n\"\"\"\n\nimport pytest\nimport salt.states.makeconf as makeconf\nfrom tests.support.mock import MagicMock, patch\n\n\n@pytest.fixt...
python
chosen
[ { "from": "system", "value": "Add \"termu\" to the name of the font\n" }, { "from": "human", "value": "import fontforge\n\nfontforge.open('input.otf').save('termu.sfd')\n" }, { "from": "gpt", "value": "import fontforge\n\nfont = fontforge.open('input.otf')\nfont.fontname = 'Termu-' +...
python
chosen
[ { "from": "system", "value": "Set user loader and login view\n" }, { "from": "human", "value": "from flask import Flask\nfrom flask_sqlalchemy import SQLAlchemy\nfrom flask_login import LoginManager\nfrom flask_oauthlib.client import OAuth\n\nfrom config import config\n\ndb = SQLAlchemy()\nlm = ...
python
chosen
[ { "from": "system", "value": "Add more details about issue being fixed\n" }, { "from": "human", "value": "#!/usr/bin/env python\n# -*- coding: utf-8 -*-\n# Fix some iso3 IDs that are wrong in ne_10m_admin_0_countries_lakes.shp,\n# ne_10m_admin_1_states_provinces_lakes.shp seems ok though.\nimpor...
python
chosen
[ { "from": "system", "value": "Fix XBlock class loading in local resource view\n\nSome XBlock classes were being (randomly) incorrectly loaded. This was\ndue to an error in the way the XBlock.load_class method was called.\nError was happening randomly because of the cache mechanism in the class\nloading meth...
python
chosen
[ { "from": "system", "value": "Fix high cpu usage through sleep\n" }, { "from": "human", "value": "import thread\nimport json\nfrom SimpleWebSocketServer import WebSocket, SimpleWebSocketServer\nfrom game import Game\n\n\ndef client_thread(game, conn, data):\n player = game.add_player(conn, da...
python
chosen
[ { "from": "system", "value": "Add template path and URLs.\n" }, { "from": "human", "value": "from django.conf.urls.defaults import patterns, url, include\n\nurlpatterns = patterns('',\n url(r'^survey/',\n include('go.apps.surveys.urls', namespace='survey')),\n url(r'^multi_survey/',...
python
chosen
[ { "from": "system", "value": "Comment explaining random.choice() on 1-item list\n" }, { "from": "human", "value": "from dallinger.nodes import Source\nimport random\nimport base64\nimport os\nimport json\n\n\nclass DrawingSource(Source):\n \"\"\"A Source that reads in a random image from a fi...
python
chosen
[ { "from": "system", "value": "Allow the photo to be blank.\n" }, { "from": "human", "value": "import urlparse\n\nfrom django.db import models\nfrom django.db.models import permalink\nfrom django.core.urlresolvers import reverse\nfrom django.contrib.auth.models import User\n\nfrom commoner.util i...
python
chosen