conversations
listlengths
2
3
source
stringclasses
1 value
stack
stringclasses
1 value
[ { "from": "system", "value": "Allow app to be imported\n\nFlask httpdomain needs to import the Flask app. It turns out the the\nway to get the path to the configuration file assumed the app was always\nbeing run/imported from the base of the ltd-keeper repo, which isn't\nalways true, especially for Sphinx d...
python
chosen
[ { "from": "system", "value": "Add .get() method to AuthenticationBase\n" }, { "from": "human", "value": "import json\nimport requests\nfrom ..exceptions import Auth0Error\n\n\nclass AuthenticationBase(object):\n\n def post(self, url, data={}, headers={}):\n response = requests.post(url...
python
chosen
[ { "from": "system", "value": "Add verbose print on split dataset script\n" }, { "from": "human", "value": "import os\n\nimport numpy as np\n\ndata_dir = \"data/dataset/\"\njpg_filenames = list(filter(lambda x: x[-3:] == \"jpg\", os.listdir(data_dir)))\n\n# Randomly select the test dataset\ntest_...
python
chosen
[ { "from": "system", "value": "[2048] Fix error in state shape in EGP\n" }, { "from": "human", "value": "import tensorflow as tf\n\n\nclass EpsilonGreedyPolicy:\n def __init__(self, env, dqn, epsilon_max, epsilon_min, epsilon_decay):\n self.env = env\n self.dqn = dqn\n sel...
python
chosen
[ { "from": "system", "value": "Discard output when checking return code.\n" }, { "from": "human", "value": "import subprocess\nimport unittest\n\nclass CompareErrorMessages(unittest.TestCase):\n def test_missing_file_return_code_the_same_as_ls(self):\n args = ['./lss.sh', 'foo']\n ...
python
chosen
[ { "from": "system", "value": "Update module loader for Python 3.4+\n" }, { "from": "human", "value": "import unittest\nimport imp\n\nrollbar_agent = imp.load_source('rollbar-agent', './rollbar-agent')\n\n\nclass FakeScanner:\n def __init__(self, config):\n self.config = config\n\n\ncla...
python
chosen
[ { "from": "system", "value": "Use appspotmail.com instead of appspot.com for email sender\n" }, { "from": "human", "value": "# Copy this file to config.py and change the settings. Don't forget to specify your own SECRET_KEY.\n\n# The app name will be used in several places.\nAPP_NAME = 'Yelp Lov...
python
chosen
[ { "from": "system", "value": "Make it easier to kill the daemon\n" }, { "from": "human", "value": "#!/usr/bin/env python\nfrom daemon import Daemon, SerialDispatcher\nfrom serial import Serial\nimport api\nfrom threading import Thread\nimport sys\n\ndef callback(event):\n if event:\n p...
python
chosen
[ { "from": "system", "value": "Return processor w processed statements\n" }, { "from": "human", "value": "import csv\n\nppelm_s3_key = ''\n\n\ndef process_from_dump(fname=None, delimiter='\\t'):\n if fname is None:\n # ToDo Get from S3\n return []\n else:\n with open(fn...
python
chosen
[ { "from": "system", "value": "Fix failing import test (how did this ever work?)\n" }, { "from": "human", "value": "import json\nimport os\n\nimport pytest\n\nfrom issues.models import Issue\nfrom issues.sync.down import update_local_issue\n\n\n@pytest.mark.django_db\ndef test_import_taskful_geor...
python
chosen
[ { "from": "system", "value": "Update ASDF-related docs to reflect presence of schemas [docs only]\n" }, { "from": "human", "value": "# Licensed under a 3-clause BSD style license - see LICENSE.rst\n# -*- coding: utf-8 -*-\n\"\"\"\nThe **asdf** subpackage contains code that is used to serialize a...
python
chosen
[ { "from": "system", "value": "BUG: Fix nose call so tests run in __main__." }, { "from": "human", "value": "\"\"\"Test file for the ordered dictionary module, odict.py.\"\"\"\n\nfrom neuroimaging.externals.scipy.testing import *\n\nfrom neuroimaging.utils.odict import odict\n\nclass TestOdict(Te...
python
chosen
[ { "from": "system", "value": "Change how logging works again :)\n" }, { "from": "human", "value": "import logging\n\nfrom os import environ\nfrom os.path import join\nfrom distutils.sysconfig import get_python_lib\n\nVEXT_DEBUG_LOG = \"VEXT_DEBUG_LOG\"\nvext_pth = join(get_python_lib(), 'vext_im...
python
chosen
[ { "from": "system", "value": "Add migration safeguard to prevent accidental destruction of data\n" }, { "from": "human", "value": "from django.db import migrations\n\n\nclass Migration(migrations.Migration):\n\n dependencies = [\n ('dcim', '0144_fix_cable_abs_length'),\n ]\n\n op...
python
chosen
[ { "from": "system", "value": "Make name an argument instead of an option\n\nIt is required to specify a chunk name.\n" }, { "from": "human", "value": "#!/usr/bin/env python\nimport click\nimport os\nimport json\n\nfrom nlppln.utils import cwl_file\n\n\n@click.command()\n@click.argument('in_dir',...
python
chosen
[ { "from": "system", "value": "Fix 'Datacash' to 'Sagepay' in Dashboard\n\nCopy-paste did it again\n" }, { "from": "human", "value": "from django.conf.urls import patterns, url\nfrom django.contrib.admin.views.decorators import staff_member_required\n\nfrom oscar.core.application import Applicati...
python
chosen
[ { "from": "system", "value": "Allow contrail user to restart ifmap without password\ncloses-jira-bug: JCB-218958\n\nChange-Id: Id95001cf5ab455650b5b900b9b5f7bb33ccef8e3\n" }, { "from": "human", "value": "import string\n\ntemplate = string.Template(\"\"\"\nDefaults:contrail !requiretty\n\nCmnd_Al...
python
chosen
[ { "from": "system", "value": "Fix code style for custom attribute value\n" }, { "from": "human", "value": "# Copyright (C) 2014 Google Inc., authors, and contributors <see AUTHORS file>\n# Licensed under http://www.apache.org/licenses/LICENSE-2.0 <see LICENSE file>\n# Created By: laran@reciproci...
python
chosen
[ { "from": "system", "value": "Add buildbucket service account to Angle master.\n\nBUG=577560\nTBR=nodir@chromium.org\n\nReview URL: https://codereview.chromium.org/1624703003\n\ngit-svn-id: 239fca9b83025a0b6f823aeeca02ba5be3d9fd76@298368 0039d316-1c4b-4281-b951-d872f2087c98\n" }, { "from": "human", ...
python
chosen
[ { "from": "system", "value": "Include display_name in factory for tests\n" }, { "from": "human", "value": "# -*- coding: utf-8 -*-\n\nfrom factory import Sequence, SubFactory\nfrom tests.factories import ExternalAccountFactory, ModularOdmFactory, ProjectFactory, UserFactory\n\nfrom website.addon...
python
chosen
[ { "from": "system", "value": "Remove ajax urlconf since we don't use it anymore\n" }, { "from": "human", "value": "from django.conf.urls.defaults import patterns, include, url\nfrom django.conf import settings\n\n\n# Uncomment the next two lines to enable the admin:\nfrom django.contrib import a...
python
chosen
[ { "from": "system", "value": "Add a RedisStore to conveyor\n" }, { "from": "human", "value": "class BaseStore(object):\n\n def set(self, key, value):\n raise NotImplementedError\n\n def get(self, key):\n raise NotImplementedError\n\n\nclass InMemoryStore(BaseStore):\n\n de...
python
chosen
[ { "from": "system", "value": "Add a new field \"stargazers_count\"" }, { "from": "human", "value": "from data_types.user import User\n\n\nclass Repository:\n \"\"\"\n GitHub Repository\n\n https://developer.github.com/v3/repos/\n\n Attributes:\n id: GitHub internal id\n ...
python
chosen
[ { "from": "system", "value": "Add version handling in SummaryView for the patches BP\n" }, { "from": "human", "value": "# Copyright (C) 2015 The Debsources developers <info@sources.debian.net>.\n# See the AUTHORS file at the top-level directory of this distribution and at\n# https://anonscm.deb...
python
chosen
[ { "from": "system", "value": "Change default terminal size arguments - Add server debug log message\n" }, { "from": "human", "value": "# -*- coding: iso-8859-15 -*-\n\n\"\"\"Main HTTP routes request handlers.\"\"\"\n\nimport tornado.web\nimport tornado.escape\nfrom os import getcwd\n\n\nclass Ma...
python
chosen
[ { "from": "system", "value": "Extend Sender.send() to return boolean status.\n" }, { "from": "human", "value": "import datetime\nimport logging\nimport json\nimport urllib.parse\nimport requests\n\n\nclass Sender():\n \n SERVER_SERVICES = {\n 'collections': '/collections'}\n \n ...
python
chosen
[ { "from": "system", "value": "Remove statement without side effect.\n" }, { "from": "human", "value": "import tablib\nfrom import_export import fields, resources, widgets\n\nfrom . import models\n\nCategoryResource = resources.modelresource_factory(models.Category)\nQuestionResource = resources....
python
chosen
[ { "from": "system", "value": "Make lda.datasets available after import lda\n" }, { "from": "human", "value": "from __future__ import absolute_import, unicode_literals # noqa\n\nimport logging\n\nimport pbr.version\n\nfrom lda.lda import LDA # noqa\n\n__version__ = pbr.version.VersionInfo('lda'...
python
chosen
[ { "from": "system", "value": "Fix a copy paste fail\n" }, { "from": "human", "value": "from nose.tools import *\nfrom exercises import ex25\n\n\ndef test_make_ing_form_ie():\n '''\n Test for ie match\n '''\n\n present_verb = ex25.make_ing_form('tie')\n assert_equal(third_person_fo...
python
chosen
[ { "from": "system", "value": "Improve test coverage once again...\n" }, { "from": "human", "value": "from tinydb.utils import LRUCache\n\n\ndef test_lru_cache():\n cache = LRUCache(capacity=3)\n cache[\"a\"] = 1\n cache[\"b\"] = 2\n cache[\"c\"] = 3\n _ = cache[\"a\"] # move to f...
python
chosen
[ { "from": "system", "value": "[AC-5625] Address CodeClimate cognitive complexity concern\n" }, { "from": "human", "value": "# MIT License\n# Copyright (c) 2017 MassChallenge, Inc.\n\nfrom django.db.models import Q\nfrom impact.v1.helpers.criterion_helper import CriterionHelper\n\n\nclass Matchin...
python
chosen
[ { "from": "system", "value": "Add name field and object manager\n" }, { "from": "human", "value": "from django.db import models\n\n# Create your models here.\n" }, { "from": "gpt", "value": "from django.db import models\n\n\n# Create your models here.\n\n# Model of an Item\nclass Ite...
python
chosen
[ { "from": "system", "value": "Fix an issue in python 2 for the scratch extension.\n" }, { "from": "human", "value": "import os\nimport re\n\nfrom jinja2 import Template\n\nDEFAULT_TEMPLATE = os.path.join(os.path.dirname(__file__), 'extension.tpl.js')\n\nsupported_modules = [\n 'button',\n ...
python
chosen
[ { "from": "system", "value": "Fix entry point for Mako.\n" }, { "from": "human", "value": "import os\nimport sys\nimport re\n\nfrom setuptools import setup, find_packages\n\nv = open(os.path.join(os.path.dirname(__file__), 'dogpile', 'cache', '__init__.py'))\nVERSION = re.compile(r\".*__version_...
python
chosen
[ { "from": "system", "value": "[fix_installation] Remove package import to prevent missing dependencies error\n" }, { "from": "human", "value": "#!/usr/bin/env python\n\nfrom setuptools import setup\nfrom PyFileMaker import __version__\n\nsetup(\n name='PyFileMaker',\n version=__version__,\...
python
chosen
[ { "from": "system", "value": "Remove broken authorization header code\n\nThe authorization header generation code in receipt.py was setting\nthe authorization header to a byte stream rather than a string\n(b'...'). As requests provides a way to generate basic auth headers\nusing the auth param it makes more...
python
chosen
[ { "from": "system", "value": "Update example to match current register signature, avoids subclassing\n" }, { "from": "human", "value": "import autocomplete_light\n\nfrom cities_light.contrib.autocomplete_light_restframework import RemoteCountryChannel, RemoteCityChannel\nfrom cities_light.models...
python
chosen
[ { "from": "system", "value": "Add hostmgr. Currently sorts/cleans /etc/hosts\n" }, { "from": "human", "value": "#!/usr/bin/env python\nfrom setuptools import setup\n\"\"\"\nIf you only want to install some of the scripts, you can manually copy them\nto the /bin/ or /usr/bin directory and make th...
python
chosen
[ { "from": "system", "value": "Add a quick note about a homepage\n" }, { "from": "human", "value": "#!/usr/bin/python\n\nfrom setuptools import setup\nfrom distutils.extension import Extension\nfrom Pyrex.Distutils import build_ext\n\nsetup(\n name=\"PyHesiod\",\n version=\"0.2.0\",\n de...
python
chosen
[ { "from": "system", "value": "Add pypi url and download_url\n" }, { "from": "human", "value": "#!/usr/bin/env python\nfrom setuptools import setup\nsetup(\n name=\"segfault\",\n version=\"0.0.1\",\n author=\"Sean Kelly\",\n author_email=\"sean.kelly.2992@gmail.com\",\n description...
python
chosen
[ { "from": "system", "value": "Use latest version of EuPy\n\nThe latest version of EuPy has better connection handling and improved\nexponential backoff behavior.\n" }, { "from": "human", "value": "#!/usr/bin/env python3\n\nfrom setuptools import setup\n\nsetup(\n name='botbot',\n version='...
python
chosen
[ { "from": "system", "value": "Add Channel deletion side-effect that updates affected lessons\n" }, { "from": "human", "value": "from django.db.models import F\nfrom django.db.models.signals import pre_delete\nfrom django.dispatch import receiver\n\nfrom .models import ChannelMetadata\nfrom .mode...
python
chosen
[ { "from": "system", "value": "Fix typo: licence to license\n" }, { "from": "human", "value": "import os\nimport re\n\nfrom setuptools import setup\n\nv = open(os.path.join(os.path.dirname(__file__), 'pynuodb', '__init__.py'))\nVERSION = re.compile(r\".*__version__ = '(.*?)'\", re.S).match(v.read...
python
chosen
[ { "from": "system", "value": "Add python_requires to help pip\n\nWhen old Python versions are dropped, this will help pip install the right version for people still running those old Python versions.\r\n \r\nFor more info on how this works:\r\n* https://hackernoon.com/phasing-out-python-runtimes-gracefully-...
python
chosen
[ { "from": "system", "value": "Fix missing LICENCE in dist package\n" }, { "from": "human", "value": "#!/usr/bin/env python\n\nimport sys\nfrom setuptools import setup, find_packages\n\nif sys.version_info < (3, 3):\n sys.exit('Sorry, Python < 3.3 is not supported')\n\nsetup(\n name='pyecor...
python
chosen
[ { "from": "system", "value": "Adjust development status -> beta.\n" }, { "from": "human", "value": "import setuptools\nimport sys\n\nrequires = 'requires/python{0}.txt'.format(sys.version_info[0])\nprint(requires)\nwith open(requires) as handle:\n requirements = [line.strip() for line in hand...
python
chosen
[ { "from": "system", "value": "Add more python3 versions compatible\n" }, { "from": "human", "value": "#!/usr/bin/python\n# -*- coding: utf-8 -*-\n\nfrom setuptools import setup\n\nsetup(name='githublabelscopy',\n version='1.0.0',\n description='A tool to copy labels between repositorie...
python
chosen
[ { "from": "system", "value": "Add mock to test requirements.\n" }, { "from": "human", "value": "# import multiprocessing to avoid this bug (http://bugs.python.org/issue15881#msg170215)\nimport multiprocessing\nassert multiprocessing\nimport re\nfrom setuptools import setup, find_packages\n\n\nde...
python
chosen
[ { "from": "system", "value": "Apply Canny edge detection to grayscale. No big difference with colored Canny edge detection.\n" }, { "from": "human", "value": "\"\"\" Apply different filters here \"\"\"\n\nimport cv2 # import OpenCV 3 module\n\ncamera = cv2.VideoCapture(0) # get default camera\...
python
chosen
[ { "from": "system", "value": "Add invoicing_plan with quarterly and yearly options\n" }, { "from": "human", "value": "# -*- coding: utf-8 -*-\n# Generated by Django 1.11.13 on 2018-06-27 18:30\nfrom __future__ import unicode_literals\nfrom __future__ import absolute_import\n\nfrom django.db impo...
python
chosen
[ { "from": "system", "value": "Add coverage to util.py for IPv6 and make_index\n" }, { "from": "human", "value": "from django.test import TestCase\n\nfrom graphite import util\nfrom graphite.wsgi import application # NOQA makes sure we have a working WSGI app\n\n\nclass UtilTest(TestCase):\n ...
python
chosen
[ { "from": "system", "value": "Add the error handle if artist doesn't exist..\n" }, { "from": "human", "value": "#!/usr/bin/env python\nimport json\nfrom objects.album import Album\nfrom spotify_crawler import SpotifyCrawler\n\nif __name__ == \"__main__\":\n crawler = SpotifyCrawler()\n \n ...
python
chosen
[ { "from": "system", "value": "Disable default Django authorization URLs\n" }, { "from": "human", "value": "\"\"\"cvdb URL Configuration\n\nThe `urlpatterns` list routes URLs to views. For more information please see:\n https://docs.djangoproject.com/en/1.11/topics/http/urls/\nExamples:\nFunct...
python
chosen
[ { "from": "system", "value": "Add axis label and change import\n" }, { "from": "human", "value": "import numpy as np\nimport scipy as sp\nimport matplotlib.pyplot as plt\n\n\ndef sweep(x, sweep_time, fs):\n\n t = np.arange(0, sweep_time, 1 / fs)\n p = 20 * np.log10(abs(sp.fft(x)))\n f =...
python
chosen
[ { "from": "system", "value": "Fix internal server error at url /account/recover\n\nFixed a 500 error at /account/recover when trying to reset password on the\nlogin page.\n\nTesting Done:\nVerified that the server no longer returns a 500 error when loading the form.\n\nReviewed at https://reviews.reviewboar...
python
chosen
[ { "from": "system", "value": "Use worker_int to avoid \\n being printed too late\n" }, { "from": "human", "value": "\"\"\"Gunicorn configuration file used by gunserver's Gunicorn subprocess.\n\nThis module is not designed to be imported directly, but provided as\nGunicorn's configuration file.\n...
python
chosen
[ { "from": "system", "value": "Change server to debug mode\n" }, { "from": "human", "value": "from flask import Flask, render_template\n\napp = Flask(__name__)\n\n@app.route('/')\ndef home():\n return render_template('index.html')\n\nif __name__ == '__main__':\n\tapp.run()" }, { "from"...
python
chosen
[ { "from": "system", "value": "Use old index view when SOLR is disabled\n" }, { "from": "human", "value": "from django.conf import settings\nfrom django.conf.urls import include, patterns, url\n\nfrom . import views\n\nurlpatterns = [\n url(r'^$', views.index, name='index'),\n url(r'^search...
python
chosen
[ { "from": "system", "value": "Add Roots class to filter paths of children\n\nTakes out python dirs like .../cde/cde\n" }, { "from": "human", "value": "\"\"\"Types to make coding cde easier\"\"\"\nimport os\n\n\nfrom pysyte.types import paths\nfrom pysyte.types.lists import UniquelyTrues\n\n\ncla...
python
chosen
[ { "from": "system", "value": "Add find, update and comparison methods\n" }, { "from": "human", "value": "#!/usr/bin/env python\n# -*- coding: utf-8 -*-\n\nfrom .common import Base, session_scope\n\nfrom sqlalchemy import and_\n\n\nclass Buyout(Base):\n __tablename__ = 'buyouts'\n __autoloa...
python
chosen
[ { "from": "system", "value": "Add comment about moving hashlib extention creation to test harness\n" }, { "from": "human", "value": "# -*- coding: utf-8 -*-\n# Generated by Django 1.11.6 on 2017-12-04 08:36\nfrom __future__ import absolute_import, unicode_literals\n\nfrom django.db import migrat...
python
chosen
[ { "from": "system", "value": "Fix a unicode bug when printing EC2 instance types on Windows machines\n" }, { "from": "human", "value": "#!/usr/bin/env python\nfrom bs4 import BeautifulSoup\nimport urllib\n\nsite_content = urllib.urlopen('https://aws.amazon.com/ec2/instance-types/').read()\nsoup ...
python
chosen
[ { "from": "system", "value": "Remove syncdb signal - will move to migration shortly\n" }, { "from": "human", "value": "from django.db.models.signals import post_syncdb\n\nfrom accounts import models, names\n\n\ndef ensure_core_accounts_exists(sender, **kwargs):\n # We only create core account...
python
chosen
[ { "from": "system", "value": "Fix a bug in Cauldron click extension\n" }, { "from": "human", "value": "# -*- coding: utf-8 -*-\n\ntry:\n import click\nexcept ImportError:\n raise ImportError(\"Cauldron.ext.click requires the click package.\")\n\nfrom ...api import use\n\n__all__ = ['backen...
python
chosen
[ { "from": "system", "value": "Create new function for number of records and do a header check\n" }, { "from": "human", "value": "from s2v1 import *\n\ndef number_of_records(data_sample):\n\treturn len(data_sample)\n\nnumber_of_ties = number_of_records(data_from_csv) - 1 # minus header row\n\n# p...
python
chosen
[ { "from": "system", "value": "Remove the class surrounding the music tests. Staying strictly functional.\n" }, { "from": "human", "value": "import pytest\n\nfrom components.merchandise.music.models import Album, Single\nfrom components.merchandise.music.factories import (AlbumFactory,\n BaseF...
python
chosen
[ { "from": "system", "value": "Allow log time to be passed into logger\n" }, { "from": "human", "value": "import sqlite3\nimport time\n\nclass SQLiteLogger:\n def __init__(self, filename=\"test.db\"):\n self.filename = filename\n self.connection = None\n\n def __enter__(self):...
python
chosen
[ { "from": "system", "value": "Add the code that correctly adds the new payment source.\n" }, { "from": "human", "value": "# -*- coding: utf-8 -*-\nimport datetime\nfrom south.db import db\nfrom south.v2 import DataMigration\nfrom django.db import models\n\nclass Migration(DataMigration):\n\n ...
python
chosen
[ { "from": "system", "value": "Add url pattern for debug toolbar\n" }, { "from": "human", "value": "from django.conf.urls import include, url\nfrom django.contrib import admin\nadmin.site.site_header = 'Coworking space administration'\n\nurlpatterns = [\n url(r'^billjobs/', include('billjobs.u...
python
chosen
[ { "from": "system", "value": "Add meta class to FeaturedRequest model" }, { "from": "human", "value": "from django.db import models\nfrom django.utils.translation import ugettext as _\nfrom django.contrib.auth.models import User\nfrom django.contrib.sites.models import Site\nfrom django.contrib....
python
chosen
[ { "from": "system", "value": "Add a GeoJSON book locations hook\n\nLocated at URL/api/bookLocs.geojson.\nReturns all book locations." }, { "from": "human", "value": "from django.conf.urls import url\n\nfrom . import views\n\n\nurlpatterns = [\n url(r'^$', views.index, name='index'),\n]\n" }...
python
chosen
[ { "from": "system", "value": "Add methods to start and stop playing tone\n" }, { "from": "human", "value": "from flask import Flask, url_for\napp = Flask(__name__)\n\n@app.route('/')\ndef api_root():\n\treturn 'Welcome'\n\n# Deprecated\n\n# @app.route('/toggle')\n# def api_toggle():\n# # Togg...
python
chosen
[ { "from": "system", "value": "Revert \"Adding conf for geodjango buildpack\"\n\nThis reverts commit 6d2528e8eae37751d66d3138e52042111e42e239.\n\ngendjango buildpack messes with gunicorn\n" }, { "from": "human", "value": "# -*- coding: utf-8 -*-\nimport os\nimport dj_database_url\nfrom base impor...
python
chosen
[ { "from": "system", "value": "Add SUCCESS/FAILURE when reporting duration to shell\n" }, { "from": "human", "value": "#!/usr/bin/env python\n\nclass ShellReporter:\n def send_status(self, timestamp, context, metric_value):\n self._send(timestamp, context + '.STATUS', metric_value)\n\n ...
python
chosen
[ { "from": "system", "value": "Add password envar for db creation.\n" }, { "from": "human", "value": "import os\nimport sys\n\nimport psycopg2\nimport sqlalchemy as sa\nfrom psycopg2.extensions import ISOLATION_LEVEL_AUTOCOMMIT\n\n\ndef main():\n database = 'postgres'\n user = 'postgres'\n\...
python
chosen
[ { "from": "system", "value": "Add a test for stdio.h.\n\ngit-svn-id: ac2c3632cb6543e7ab5fafd132c7fe15057a1882@60472 6015fed2-1504-0410-9fe1-9d1591cc4771\n" }, { "from": "human", "value": "import unittest\nimport sys\nfrom ctypeslib import h2xml, xml2py\n\nclass ToolchainTest(unittest.TestCase):\...
python
chosen
[ { "from": "system", "value": "Remove use of timestamped value.\n\nThought it was dumb/inelegant to have a Value() object floating around\nwith value and timestamp . Instead, now all messages are sent around\nas json dicts.\n\nThe request enters the system as json, flows through to an endpoint\nwhere it bec...
python
chosen
[ { "from": "system", "value": "Edit intro evals data route\n" }, { "from": "human", "value": "from flask import Blueprint\nfrom flask import render_template\nfrom flask import request\n\nintro_evals_bp = Blueprint('intro_evals_bp', __name__)\n\n@intro_evals_bp.route('/intro_evals/')\ndef display_...
python
chosen
[ { "from": "system", "value": "Fix imports in plugin manager test to work with nosetests\n" }, { "from": "human", "value": "import socket\nimport time\nfrom threading import Event\nfrom unittest import TestCase\nfrom PluginManager import PluginManager\n\nclass TestPluginManager(TestCase):\n\n ...
python
chosen
[ { "from": "system", "value": "Read file name from command line in python wrapper\n" }, { "from": "human", "value": "from color_histogram_cuda import histogram\n\nprint histogram('../data/spotted_ball_3500.png', 16)" }, { "from": "gpt", "value": "import sys\nfrom color_histogram_cuda ...
python
chosen
[ { "from": "system", "value": "Use assertGreater(len(x), 0) over assertTrue(len(x) > 0)\n\nassertGreater provides a nicer error message if it fails.\n\nChange-Id: I2c13d28c54ae3a9ff562448e7a16ab54d71b29b5\n" }, { "from": "human", "value": "# Copyright 2014 NEC Corporation\n# All Rights Reserved.\...
python
chosen
[ { "from": "system", "value": "Update intersphinx links to Django 1.7\n" }, { "from": "human", "value": "# -*- coding: utf-8 -*-\n#\n# This file is execfile()d with the current directory set to its containing\n# directory.\n\nimport sys, os\nsys.path.append(os.path.join(os.path.abspath('.'), '_ex...
python
chosen
[ { "from": "system", "value": "Add user profile when reg via api\n\nWhen user is registered via api it will create profile, activation link\nand send it to given email just like a web registration flow.\n" }, { "from": "human", "value": "from django.contrib.auth.models import User\nfrom rest_fram...
python
chosen
[ { "from": "system", "value": "Adjust copyright line in docs\n" }, { "from": "human", "value": "import guzzle_sphinx_theme\n\nproject = \"argcomplete\"\ncopyright = \"Andrey Kislyuk\"\nauthor = \"Andrey Kislyuk\"\nversion = \"\"\nrelease = \"\"\nlanguage = None\nmaster_doc = \"index\"\nextensions...
python
chosen
[ { "from": "system", "value": "Update Postgres test connection string\n" }, { "from": "human", "value": "import pytest\n\nfrom sqlalchemy import text\nfrom sqlalchemy.exc import ProgrammingError\nfrom sqlalchemy.ext.asyncio import AsyncEngine, create_async_engine\nfrom sqlalchemy.ext.asyncio impo...
python
chosen
[ { "from": "system", "value": "Add missing dev config values\n" }, { "from": "human", "value": "# coding: utf-8\nfrom __future__ import unicode_literals, division, absolute_import, print_function\n\nimport os\n\n\npackage_name = \"certbuilder\"\n\nother_packages = []\n\npackage_root = os.path.abs...
python
chosen
[ { "from": "system", "value": "Add docstring, fix template param name\n" }, { "from": "human", "value": "# -*- coding: utf-8 -*-\n\nfrom flask import render_template\nfrom flask import request\n\n\ndef render_task(func):\n def rendered():\n params = dict(title=func.__module__.split('.')...
python
chosen
[ { "from": "system", "value": "Fix in action delete and not link\n\nFix in case of user want only delete duplicates, the error is, when did they the delete only duplicates, the links was created anyway.\n" }, { "from": "human", "value": "#! /usr/bin/env python\nimport os\n\ndef managerFiles(paths...
python
chosen
[ { "from": "system", "value": "Add a comment about line endings in Stardoc files.\n" }, { "from": "human", "value": "# Copyright 2021 Google LLC\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may not use this file except in compliance with the License.\n# You may o...
python
chosen
[ { "from": "system", "value": "Use inline flags with local scope.\n" }, { "from": "human", "value": "#!/usr/bin/env python3\n# -*- coding: utf-8 -*-\n\nextensions = ['sphinx.ext.autodoc', 'jaraco.packaging.sphinx', 'rst.linker']\n\nmaster_doc = \"index\"\n\nlink_files = {\n '../CHANGES.rst': d...
python
chosen
[ { "from": "system", "value": "Fix error in the apikey import task\n" }, { "from": "human", "value": "from celery.decorators import task\nfrom eve_api.api_puller.accounts import import_eve_account\nfrom eve_api.app_defines import *\nfrom sso.tasks import update_user_access\n\n@task()\ndef import_...
python
chosen
[ { "from": "system", "value": "Fix a build for travis-CI\n" }, { "from": "human", "value": "\"\"\"\nDownloads the necessary NLTK corpora for nalaf.\n\nUsage: ::\n\n $ python -m nalaf.download_corpora\n\n\"\"\"\nif __name__ == '__main__':\n import nltk\n\n CORPORA = ['punkt']\n\n for c...
python
chosen
[ { "from": "system", "value": "Drop ThreadPool, use joblib instead\n\n" }, { "from": "human", "value": "\"\"\"\nExample for parallel optimization with skopt.\nThe points to evaluate in parallel are selected according to the \"constant lie\" approach.\n\n\"\"\"\n\nimport numpy as np\nfrom multipro...
python
chosen
[ { "from": "system", "value": "Add input statements and edit parentheses in rate\n\nAttempted to add some input functions into the elevator constructor.\r\n\r\nRef #25 #23" }, { "from": "human", "value": "\"\"\"Creates the escalator class\"\"\"\n\n\nclass Escalator:\n \"\"\"\n Each escalato...
python
chosen
[ { "from": "system", "value": "Make RTF reader sample open in 'rb' mode explicitly\n" }, { "from": "human", "value": "from pyth.plugins.rtf15.reader import Rtf15Reader\nfrom pyth.plugins.xhtml.writer import XHTMLWriter\n\nimport sys\n\nif len(sys.argv) > 1:\n filename = sys.argv[1]\nelse:\n ...
python
chosen
[ { "from": "system", "value": "Add y log option and title offset\n" }, { "from": "human", "value": "import matplotlib.pyplot as plt\n\n#class RgChart(object):\n #__metaclass__ = ABCMeta\n\nclass RgChart(object):\n \n def with_grids(self):\n self._ax.xaxis.grid(True)\n self....
python
chosen
[ { "from": "system", "value": "Determine AVR's results more precisely\n" }, { "from": "human", "value": "# This file is part of BenchExec, a framework for reliable benchmarking:\n# https://github.com/sosy-lab/benchexec\n#\n# SPDX-FileCopyrightText: 2007-2020 Dirk Beyer <https://www.sosy-lab.org>\...
python
chosen
[ { "from": "system", "value": "Send descriptive responses for /ready and /healthy\n" }, { "from": "human", "value": "import bottle\nfrom bottle import response, request\nimport json\nimport jedi\nimport logging\n\n\napp = bottle.Bottle( __name__ )\nlogger = logging.getLogger( __name__ )\n\n\n@app...
python
chosen
[ { "from": "system", "value": "Simplify the province list API\n\nIt only contains province data as a list without the separate ordering\ninformation. The order of the province data in the list is the order of\nprovinces.\n" }, { "from": "human", "value": "from django.views.decorators.cache import...
python
chosen
[ { "from": "system", "value": "[AC-9046] Fix filter for people and mentor urls\n" }, { "from": "human", "value": "# Generated by Django 2.2.10 on 2021-11-05 12:29\n\nfrom django.db import migrations\n\n\ndef update_url_to_community(apps, schema_editor):\n people_url = \"/people\"\n mentor_url =...
python
chosen