conversations
listlengths
2
3
source
stringclasses
1 value
stack
stringclasses
1 value
[ { "from": "system", "value": "Fix stepping on other tests >:(\n" }, { "from": "human", "value": "# Copyright 2020 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 obtain a copy of th...
python
chosen
[ { "from": "system", "value": "Change the insert to use updated_at as the reported_at date\n" }, { "from": "human", "value": "\"\"\"\n\nRevision ID: 0311_populate_returned_letters\nRevises: 0310_returned_letters_table\nCreate Date: 2019-12-09 12:13:49.432993\n\n\"\"\"\nfrom alembic import op\n\nf...
python
chosen
[ { "from": "system", "value": "Make continued fractions sqrt much faster\n" }, { "from": "human", "value": "from fractions import Fraction\nfrom math import sqrt\nfrom itertools import chain, cycle\n\nfrom typing import Generator, Iterable, List, Tuple\n\n\ndef convergent_sequence(generator: Iter...
python
chosen
[ { "from": "system", "value": "Clean up transpose helper method\n" }, { "from": "human", "value": "import string\nimport math\nimport itertools\n\n\nclass CryptoSquare:\n\n @classmethod\n def encode(cls, msg):\n if len(cls.normalize(msg)) == 0:\n return ''\n return ...
python
chosen
[ { "from": "system", "value": "Fix a DHT reading error\n" }, { "from": "human", "value": "#!/usr/bin/env python\n\nimport time\nimport thread\nimport Adafruit_DHT as dht\nimport config\n\nh = 0.0\nt = 0.0\n\ndef get_ht_thread():\n while True:\n ht = dht.read_retry(dht.DHT22, config.DHT2...
python
chosen
[ { "from": "system", "value": "TST: Test of error estimation of Runge-Kutta methods\n" }, { "from": "human", "value": "import pytest\nfrom numpy.testing import assert_allclose\nimport numpy as np\nfrom scipy.integrate import RK23, RK45, DOP853\nfrom scipy.integrate._ivp import dop853_coefficients...
python
chosen
[ { "from": "system", "value": "Add test for implied timescales plot\n\n" }, { "from": "human", "value": "import numpy as np\nfrom msmbuilder.msm import MarkovStateModel, BayesianMarkovStateModel\nfrom matplotlib.axes import SubplotBase\nfrom seaborn.apionly import JointGrid\n\nfrom ..plots import...
python
chosen
[ { "from": "system", "value": "Add logging to background assign\n" }, { "from": "human", "value": "\"\"\"\nAssign articles from AmCAT sets for background processing in nlpipe\n\"\"\"\n\nimport sys, argparse\n\nfrom nlpipe import tasks\nfrom nlpipe.pipeline import parse_background\nfrom nlpipe.bac...
python
chosen
[ { "from": "system", "value": "Remove bad delete_unique call as it was already applied in migration 0015\n" }, { "from": "human", "value": "# -*- coding: utf-8 -*-\nimport datetime\nfrom south.db import db\nfrom south.v2 import SchemaMigration\nfrom django.db import models\n\n\nclass Migration(Sc...
python
chosen
[ { "from": "system", "value": "Fix libpng to use a better URL\n\nSourceforge URLs like this eventually die when the libpng version is bumped:\n http://sourceforge.net/projects/libpng/files/libpng16/1.6.14/libpng-1.6.14.tar.gz/download\n\nBut ones like this give you a \"permanently moved\", which curl -L w...
python
chosen
[ { "from": "system", "value": "Fix a test for AdditiveOU\n" }, { "from": "human", "value": "from __future__ import unicode_literals\nfrom __future__ import print_function\nfrom __future__ import division\nfrom __future__ import absolute_import\nfrom future import standard_library\nstandard_librar...
python
chosen
[ { "from": "system", "value": "Add __str__ method for better representation in frontend\n" }, { "from": "human", "value": "from django.db import models\n\nfrom cms.models import CMSPlugin\n\n\nclass MarkdownPlugin(CMSPlugin):\n markdown_text = models.TextField(max_length=8000)\n" }, { ...
python
chosen
[ { "from": "system", "value": "Increase timeout of ukwsj to get more consistent SKP captures\n\nBUG=skia:3574\nTBR=borenet\nNOTRY=true\n\nReview URL: https://codereview.chromium.org/1038443002\n" }, { "from": "human", "value": "# Copyright 2014 The Chromium Authors. All rights reserved.\n# Use of...
python
chosen
[ { "from": "system", "value": "Change TestPmacStatusPart to not use i10\n" }, { "from": "human", "value": "from malcolm.core import Process\nfrom malcolm.modules.builtin.controllers import ManagerController\nfrom malcolm.modules.pmac.blocks import pmac_status_block\nfrom malcolm.modules.pmac.part...
python
chosen
[ { "from": "system", "value": "Rename RawContent text field, describes field better\n" }, { "from": "human", "value": "from django.db import models\nfrom django.utils.safestring import mark_safe\nfrom django.utils.translation import ugettext_lazy as _\n\n\nclass RawContent(models.Model):\n tex...
python
chosen
[ { "from": "system", "value": "Add an assert to make mypy check pass again\n" }, { "from": "human", "value": "#!/usr/bin/env python\n\nimport os.path\nimport sys\nimport subprocess\nimport unittest\n\ntests_dir = os.path.dirname(__file__)\nsys.path.insert(0, os.path.dirname(tests_dir))\n\nimport ...
python
chosen
[ { "from": "system", "value": "test: Add tests for bench execute\n" }, { "from": "human", "value": "# Copyright (c) 2020, Frappe Technologies Pvt. Ltd. and Contributors\n\nfrom __future__ import unicode_literals\n\nimport shlex\nimport subprocess\nimport unittest\n\nimport frappe\n\n\ndef clean(v...
python
chosen
[ { "from": "system", "value": "Fix search paths not being added from arguments.\n" }, { "from": "human", "value": "import argparse\n\nimport vfp2py\n\ndef parse_args(argv=None):\n parser = argparse.ArgumentParser(description='Tool for rewriting Foxpro code in Python')\n parser.add_argument(...
python
chosen
[ { "from": "system", "value": "Modify language generation script to make JSON for iOS\n\nChange-Id: Ib5aec2f6cfcb5bd1187cf8863ecd50f1b1a2d20c\n" }, { "from": "human", "value": "from urllib2 import urlopen\nimport csv\nimport lxml.builder as lb\nfrom lxml import etree\n\n# Returns CSV of all wikip...
python
chosen
[ { "from": "system", "value": "Switch to non-privledged port to make testing easier\n" }, { "from": "human", "value": "import smtplib, time\n\nmessages_sent = 0.0\nstart_time = time.time()\nmsg = file('examples/benchmarking/benchmark.eml').read()\n\nwhile True:\n \n if (messages_sent % 10) ...
python
chosen
[ { "from": "system", "value": "Add support for hiding untranslated content\n" }, { "from": "human", "value": "from django import template\nfrom copy import copy\nfrom molo.yourwords.models import (YourWordsCompetition, ThankYou,\n YourWordsCompetitionIndexPage)\n...
python
chosen
[ { "from": "system", "value": "Use known-to-trigger-exceptions sites to test crawler restart method\n" }, { "from": "human", "value": "#!/usr/bin/env python3.5\n\n# This test crawls some sets that have triggered http.client.RemoteDisconnected\n# exceptions\n\nimport unittest\nfrom crawler import ...
python
chosen
[ { "from": "system", "value": "Fix the path to create-postgres.sql\n" }, { "from": "human", "value": "import codecs\nfrom frameworkbenchmarks.models import DBSession\n\nif __name__ == \"__main__\":\n \"\"\"\n Initialize database\n \"\"\"\n with codecs.open('../config/create-postgres.s...
python
chosen
[ { "from": "system", "value": "Add Google Apps email address validation\n" }, { "from": "human", "value": "import DNS\nfrom validate_email import validate_email\nfrom DNS.Lib import PackError\n\n\ndef is_google_apps_email(email):\n hostname = email[email.find('@')+1:]\n \n try:\n mx_hosts =...
python
chosen
[ { "from": "system", "value": "Add shutdown scripts to turn_off servo after subscribing\n" }, { "from": "human", "value": "#!/usr/bin/env python\n# coding: utf-8\n\nfrom futaba_serial_servo import RS30X\nimport rospy\nfrom sensor_msgs.msg import JointState\n\nclass Slave:\n def __init__(self):...
python
chosen
[ { "from": "system", "value": "Add description to the table and populate it with two categories\n" }, { "from": "human", "value": "\"\"\"create category table\n\nRevision ID: 47dd43c1491\nRevises: 27bf0aefa49d\nCreate Date: 2013-05-21 10:41:43.548449\n\n\"\"\"\n\n# revision identifiers, used by A...
python
chosen
[ { "from": "system", "value": "Fix context processor to correctly display internal featured videos.\n" }, { "from": "human", "value": "from django.conf import settings\n\nfrom airmozilla.main.models import Event\n\n\ndef sidebar(request):\n featured = Event.objects.approved().filter(public=Tru...
python
chosen
[ { "from": "system", "value": "Add external url to preprint provider serializer\n" }, { "from": "human", "value": "from rest_framework import serializers as ser\n\nfrom api.base.utils import absolute_reverse\nfrom api.base.serializers import JSONAPISerializer, LinksField\n\n\nclass PreprintProvid...
python
chosen
[ { "from": "system", "value": "Add transaction support for django models.\n" }, { "from": "human", "value": "# coding: utf-8\n#\n# Copyright 2013 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 complia...
python
chosen
[ { "from": "system", "value": "Revert \"Fallback is test location\"\n\nThis reverts commit 2ba9865fa0f05e9ae244b2513e046c961540fca1.\n" }, { "from": "human", "value": "from corehq.apps.locations.models import SQLLocation\nfrom dimagi.utils.logging import notify_exception\n\n\ndef is_submission_fr...
python
chosen
[ { "from": "system", "value": "Fix osf clone test that was asking for a password\n" }, { "from": "human", "value": "\"\"\"Test `osf clone` command.\"\"\"\n\nimport os\n\nfrom mock import patch, mock_open, call\n\nfrom osfclient import OSF\nfrom osfclient.cli import clone\n\nfrom osfclient.tests.m...
python
chosen
[ { "from": "system", "value": "Make windows bigger in this test so the captions can be read.\n\n\nIndex: tests/window/WINDOW_CAPTION.py\n===================================================================\n--- tests/window/WINDOW_CAPTION.py\t(revision 777)\n+++ tests/window/WINDOW_CAPTION.py\t(working copy)\...
python
chosen
[ { "from": "system", "value": "Add check for unsuccessful date checks\n" }, { "from": "human", "value": "import os\r\nfrom dateutil.parser import parse\r\nfrom ...common import run, chdir\r\n\r\n\r\ndef check_dates(spec_id, username, spec, basedir):\r\n \"\"\" Port of the CheckDates program fr...
python
chosen
[ { "from": "system", "value": "Expand bock7k to be a multi-resolution project.\n" }, { "from": "human", "value": "#\n# Configuration for the will database\n#\n\nimport dbconfig\n\nclass dbConfigBock7k ( dbconfig.dbConfig ):\n\n # cubedim is a dictionary so it can vary \n # size of the cube at ...
python
chosen
[ { "from": "system", "value": "[fire-models] Set test area to a burnable one.\n" }, { "from": "human", "value": "import unittest\nimport fire_rs.firemodel.propagation as propagation\n\n\nclass TestPropagation(unittest.TestCase):\n\n def test_propagate(self):\n env = propagation.Environm...
python
chosen
[ { "from": "system", "value": "Fix if ginga is not installed" }, { "from": "human", "value": "try:\n from .client import *\n from .qt_widget import *\nexcept ImportError:\n import warnings\n warnings.warn(\"Could not import ginga plugin, since ginga is required\")\n\n# Register qt cli...
python
chosen
[ { "from": "system", "value": "Adjust for Python 3.3 change in gmtime() exception type\n\nhttps://github.com/behdad/fonttools/issues/99#issuecomment-66776810\n\nFixes https://github.com/behdad/fonttools/issues/99\n" }, { "from": "human", "value": "\"\"\"fontTools.misc.timeTools.py -- miscellaneou...
python
chosen
[ { "from": "system", "value": "[libFuzzer] Fix output format in data flow merge script after Py3 change.\n\nReviewers: Dor1s\n\nReviewed By: Dor1s\n\nSubscribers: delcypher, #sanitizers, llvm-commits\n\nTags: #llvm, #sanitizers\n\nDifferential Revision: https://reviews.llvm.org/D60288\n\ngit-svn-id: c199f293...
python
chosen
[ { "from": "system", "value": "Add the sanity checks, but doing it right this time.\n" }, { "from": "human", "value": "#!/usr/bin/env python3\n\nimport os\nimport sys\n_upper_dir = os.path.abspath(\n os.path.join(os.path.dirname(__file__), '..'))\nif _upper_dir not in sys.path:\n sys.path.a...
python
chosen
[ { "from": "system", "value": "Change to sample pachube script\n" }, { "from": "human", "value": "import clr\n\nfrom System import *\nfrom System.Net import WebClient\nfrom System.Xml import XmlDocument\nfrom System.Diagnostics import Trace\n\nurl = \"http://pachube.com/api/\"\napiKey = \"40ab667...
python
chosen
[ { "from": "system", "value": "Use consistent naming for tokens\n" }, { "from": "human", "value": "# Copy this file to development_environment.py\n# and replace OAuth credentials your dev credentials\nTOKENS = {\n '_foo_bucket': '_foo_bucket-bearer-token',\n 'bucket': 'bucket-bearer-token',...
python
chosen
[ { "from": "system", "value": "Fix include path and ascii / utf8 errors.\n" }, { "from": "human", "value": "#!/usr/bin/python\n\nimport sys\nimport glob\nsys.path.append(\"python_scripts/gen-py\")\nsys.path.append(\"gen-py/thrift_solr/\")\n\nfrom thrift.transport import TSocket \nfrom thrift.serv...
python
chosen
[ { "from": "system", "value": "Remove assosiate user social auth step\n" }, { "from": "human", "value": "SHELL_PLUS = \"ipython\"\n\nSOCIAL_AUTH_STEAM_EXTRA_DATA = ['player']\nSOCIAL_AUTH_LOGIN_REDIRECT_URL = '/'\nSOCIAL_AUTH_LOGIN_ERROR_URL = '/login/error/'\nSOCIAL_AUTH_INACTIVE_USER_URL = '/lo...
python
chosen
[ { "from": "system", "value": "tests: Test slicing a range that does not start at zero.\n" }, { "from": "human", "value": "# test builtin range type\n\n# print\nprint(range(4))\n\n# bool\nprint(bool(range(0)))\nprint(bool(range(10)))\n\n# len\nprint(len(range(0)))\nprint(len(range(4)))\nprint(len...
python
chosen
[ { "from": "system", "value": "Fix month filter for recap passage report\n" }, { "from": "human", "value": "from __future__ import absolute_import\nfrom __future__ import unicode_literals\nfrom memoized import memoized\nfrom custom.intrahealth.filters import RecapPassageLocationFilter2, FRMonthFi...
python
chosen
[ { "from": "system", "value": "Add logic to verify and login admin\n" }, { "from": "human", "value": "from flask import Blueprint, render_template, redirect, session, url_for\n\nfrom app.decorators import login_required\n\nblueprint = Blueprint('public', __name__)\n\n\n@blueprint.route('/')\ndef ...
python
chosen
[ { "from": "system", "value": "Fix passing of params to optimizer in Softmax\n" }, { "from": "human", "value": "from .affine import Affine\nfrom ... import describe\nfrom ...describe import Dimension, Synapses, Biases\n\n\n@describe.attributes(\n W=Synapses(\"Weights matrix\",\n lambda ...
python
chosen
[ { "from": "system", "value": "Modify FlowSpaceForm to use actual stored rules\n" }, { "from": "human", "value": "'''\r\nCreated on Jun 20, 2010\r\n\r\n@author: jnaous\r\n'''\r\nfrom django import forms\r\nfrom expedient.ui.html.models import SliceFlowSpace\r\n\r\nclass FlowSpaceForm(forms.ModelF...
python
chosen
[ { "from": "system", "value": "Add bitcoin address to donation addresses\n" }, { "from": "human", "value": "# Shared project info\n\nname = 'telegram-bot-framework'\n\ndescription = 'Python Telegram bot API framework'\n\nurl = 'https://github.com/alvarogzp/telegram-bot-framework'\n\nauthor_name =...
python
chosen
[ { "from": "system", "value": "Use updated app config for getting the path\n\nPrevent warning with Django 1.8, fixes #3\n" }, { "from": "human", "value": "import os.path\n\nfrom blanc_basic_assets.models import Image\nfrom django.apps import apps\nfrom django.core.files import File\nfrom django.c...
python
chosen
[ { "from": "system", "value": "Fix missing `kwargs` argument to enqueue.\n" }, { "from": "human", "value": "from rq import Worker, Queue, Connection\nfrom rq.job import Job\n\nfrom cloudly.cache import redis\nfrom cloudly.memoized import Memoized\n\ndef enqueue(function, *args):\n return _get_...
python
chosen
[ { "from": "system", "value": "project...DevilryTestRunner: Update warning ignores for Django 1.10.\n" }, { "from": "human", "value": "import warnings\n\nfrom django.test.runner import DiscoverRunner\nfrom django.utils.deprecation import RemovedInDjango20Warning, RemovedInDjango110Warning\n\n\ncl...
python
chosen
[ { "from": "system", "value": "Fix test on Python 2.6\n" }, { "from": "human", "value": "from __future__ import print_function, division, absolute_import, unicode_literals\nfrom fontTools.misc.py23 import *\nimport unittest\nimport fontTools.encodings.codecs # Not to be confused with \"import cod...
python
chosen
[ { "from": "system", "value": "Fix error in error log\n" }, { "from": "human", "value": "import hashlib\n\nfrom datapackage_pipelines.utilities.extended_json import json\n\nfrom ..errors import SpecError\nfrom .dependency_resolver import resolve_dependencies\n\n\nclass HashCalculator(object):\n\n...
python
chosen
[ { "from": "system", "value": "Add more attributes to resolved method\n" }, { "from": "human", "value": "\nfrom archinfo.arch_soot import SootMethodDescriptor\n\n\n# TODO implement properly\n# this will need the expression, the class hierarchy, and the position of the instruction (for invoke-supe...
python
chosen
[ { "from": "system", "value": "Implement the basics of the TRIPS reader.\n" }, { "from": "human", "value": "from indra.tools.reading.readers.core import EmptyReader\n\nfrom indra.sources import trips\n\n\nclass TripsReader(EmptyReader):\n \"\"\"A stand-in for TRIPS reading.\n\n Currently, w...
python
chosen
[ { "from": "system", "value": "Add Synonym and related classes\n" }, { "from": "human", "value": "class Synonym(object):\n def __init__(self):\n pass\n" }, { "from": "gpt", "value": "from pywatson.util.map_initializable import MapInitializable\n\n\nclass SynSetSynonym(MapIni...
python
chosen
[ { "from": "system", "value": "Add initial fixtures for the categories.\n" }, { "from": "human", "value": "import urlparse\n\nfrom django.conf import settings\nfrom django.core.management.base import BaseCommand\nfrom django.contrib.sites.models import Site\n\nfrom us_ignite.profiles.models impor...
python
chosen
[ { "from": "system", "value": "Fix oauth2 revoke URI, new URL doesn't seem to work\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 compliance with th...
python
chosen
[ { "from": "system", "value": "Change .env variable to KCLS_USER\n" }, { "from": "human", "value": "import requests\nfrom bs4 import BeautifulSoup\nimport json\nfrom dotenv import load_dotenv\nimport os\n\nload_dotenv(\".env\")\n\ns = requests.Session()\n\nr = s.get(\"https://kcls.bibliocommons.c...
python
chosen
[ { "from": "system", "value": "Make timestamps more specific as temporal context fades.\n\nFixes #6.\n" }, { "from": "human", "value": "import itertools\n\nimport pytz\n\nfrom babel.dates import format_time\nfrom pylons import c\n\n\ndef pairwise(iterable):\n a, b = itertools.tee(iterable)\n ...
python
chosen
[ { "from": "system", "value": "Remove history name error for absolute paths\n" }, { "from": "human", "value": "from Simulator import *\nimport XMLParser\nimport textToXML\n\ndef getHistoryFileName(xmlFileName):\n\ty = xmlFileName[:-3]\n\treturn 'history_' + y + 'txt'\n\ndef plotFromXML(fileName,s...
python
chosen
[ { "from": "system", "value": "Add a setting for debugging\n" }, { "from": "human", "value": "BROKER_URL = 'amqp://guest@localhost'\nCELERY_RESULT_BACKEND = 'amqp://guest@localhost'\nCELERY_EAGER_PROPAGATES_EXCEPTIONS = True\n\nSTORAGE_METHOD = 'disk'\nARCHIVE_DIRECTORY = 'archive/'\nRECORD_DIREC...
python
chosen
[ { "from": "system", "value": "Replace @ with . in soa form clean\n" }, { "from": "human", "value": "from django.forms import ModelForm\nfrom cyder.base.mixins import UsabilityFormMixin\nfrom cyder.base.eav.forms import get_eav_form\nfrom cyder.cydns.soa.models import SOA, SOAAV\n\n\nclass SOAFor...
python
chosen
[ { "from": "system", "value": "Fix for mismamed threshold parameter in allow desc\n" }, { "from": "human", "value": "from citrination_client.views.descriptors.descriptor import MaterialDescriptor\n\n\nclass AlloyCompositionDescriptor(MaterialDescriptor):\n def __init__(self, key, balance_eleme...
python
chosen
[ { "from": "system", "value": "Fix unlink, >1 filter and lines too long" }, { "from": "human", "value": "# -*- coding: utf-8 -*-\n# © 2016 Carlos Dauden <carlos.dauden@tecnativa.com>\n# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).\n\nfrom openerp import api, models\n\n\nclass Pur...
python
chosen
[ { "from": "system", "value": "Mark ObjC testcase as skipUnlessDarwin and fix a typo in test function.\n\ngit-svn-id: 4c4cc70b1ef44ba2b7963015e681894188cea27e@326640 91177308-0d34-0410-b5e6-96231b3b80d8\n" }, { "from": "human", "value": "\"\"\"Test that the clang modules cache directory can be co...
python
chosen
[ { "from": "system", "value": "Update celery setup according to docs\n" }, { "from": "human", "value": "# This will make sure the app is always imported when\n# Django starts so that shared_task will use this app.\nfrom .celery import app as celery_app\n\n__version__ = \"dev\"\nGIT_REVISION = \"d...
python
chosen
[ { "from": "system", "value": "Update LoginForm to match reality\n" }, { "from": "human", "value": "import logging\n\nfrom django import forms\nfrom django.contrib.auth import forms as authforms\n\nfrom ..models import UserProfile\n\nlogger = logging.getLogger(__name__)\n\n\nclass LoginForm(forms...
python
chosen
[ { "from": "system", "value": "Add multiple skeletons for the moment.\n" }, { "from": "human", "value": "#!/usr/bin/env python\n\nimport climate\n\nimport database\nimport plots\n\n\n@climate.annotate(\n root='plot data rooted at this path',\n pattern=('plot data from files matching this pa...
python
chosen
[ { "from": "system", "value": "Use pip instead of easy_install\n" }, { "from": "human", "value": "#! /usr/bin/env python3\n\nfrom setuptools.command import easy_install\n\nrequires = [\"dnslib\", \"dkimpy>=0.7.1\", \"pyyaml\", \"ddt\", \"authheaders\"]\n\nfor module in requires:\n easy_install...
python
chosen
[ { "from": "system", "value": "Add test for categorical colors staying around after subsetting\n" }, { "from": "human", "value": "import numpy as np\nimport pandas as pd\n\nfrom anndata import AnnData\n\n\ndef test_uns_color_subset():\n # Tests for https://github.com/theislab/anndata/issues/25...
python
chosen
[ { "from": "system", "value": "Allow WOW animations to be used in text plugin.\n" }, { "from": "human", "value": "# -*- coding: utf-8 -*-\nfrom django.utils.translation import ugettext_lazy as _\n\nfrom cms.plugin_base import CMSPluginBase\nfrom cms.plugin_pool import plugin_pool\n\nfrom . import...
python
chosen
[ { "from": "system", "value": "Change polling interval to 5 seconds\n" }, { "from": "human", "value": "\nfrom ._events import _Events\nfrom ..error import InvalidTokenError\n\nimport time\n\nclass Events(_Events):\n POLL_INTERVAL = 1000\n\n def get_next(self, params):\n params = para...
python
chosen
[ { "from": "system", "value": "Add default type formatters for Enum\n" }, { "from": "human", "value": "from jinja2 import Markup\nfrom flask_admin._compat import text_type\n\n\ndef null_formatter(view, value):\n \"\"\"\n Return `NULL` as the string for `None` value\n\n :param val...
python
chosen
[ { "from": "system", "value": "Handle spotify: -type urls\nCleanup\n\n\ngit-svn-id: 056f9092885898c4775d98c479d2d33d00273e45@144 dda364a1-ef19-0410-af65-756c83048fb2\n" }, { "from": "human", "value": "\nimport re\nimport urllib\n\ndef handle_url(bot, user, channel, url, msg):\n \"\"\"Handle IM...
python
chosen
[ { "from": "system", "value": "py3: Remove Python 2 compatibility code\n" }, { "from": "human", "value": "import gmusicapi\nfrom mopidy import commands\nfrom oauth2client.client import OAuth2WebServerFlow\n\n\nclass GMusicCommand(commands.Command):\n def __init__(self):\n super().__init...
python
chosen
[ { "from": "system", "value": "Simplify database query when looking up an alias\n" }, { "from": "human", "value": "from __future__ import unicode_literals\n\nimport base32_crockford\nimport logging\n\nfrom django.db.models import F\nfrom django.http import Http404\nfrom django.http import HttpRes...
python
chosen
[ { "from": "system", "value": "Validate the presence of CONTENT_STORE.\n" }, { "from": "human", "value": "# -*- coding: utf-8 -*-\n\nimport argparse\nimport sys\nfrom os import path\n\nfrom builder import DeconstJSONBuilder\nfrom sphinx.application import Sphinx\nfrom sphinx.builders import BUILT...
python
chosen
[ { "from": "system", "value": "Change the VCAP_SERVICE key for elasticsearch\n\nGOV.UK PaaS have recently changed the name of their elasticsearch service in preparation for migration.\n\nThis quick fix will work until elasticsearch-compose is withdrawn; a future solution should use a more robust way of deter...
python
chosen
[ { "from": "system", "value": "[AIRFLOW-810] Correct down_revision dag_id/state index creation\n\nDue to revert the revision were not correct anymore and an unclean\nbuild environment would still consider it for alembic migrations.\n" }, { "from": "human", "value": "#\n# Licensed under the Apache...
python
chosen
[ { "from": "system", "value": "Remove and replace task.id field, instead of Alter" }, { "from": "human", "value": "# -*- coding: utf-8 -*-\nfrom __future__ import unicode_literals\n\nfrom django.db import models, migrations\n\n\nclass Migration(migrations.Migration):\n\n dependencies = [\n ...
python
chosen
[ { "from": "system", "value": "MOLLY-188: Change PyZ3950 to use git+git\n" }, { "from": "human", "value": "# Packages which Molly needs, but Pip can't handle\nPIP_PACKAGES = [\n ('PyZ3950', 'git+http://github.com/oucs/PyZ3950.git'), # Custom PyZ3950, contains some bug fixes\n ('django-compr...
python
chosen
[ { "from": "system", "value": "Improve Worker resistance against external code exceptions\n" }, { "from": "human", "value": "import queue\nimport threading\n\n\nclass Worker:\n def __init__(self, name: str, work_queue: queue.Queue, error_handler: callable):\n self.name = name\n s...
python
chosen
[ { "from": "system", "value": "Change init param of wordnet" }, { "from": "human", "value": "#!/usr/bin/env python\n################################################################################\n# Created by Oscar Martinez #\n# o.rubi@escie...
python
chosen
[ { "from": "system", "value": "Use formatted flag on astyle to simplify code\n" }, { "from": "human", "value": "# -*- coding: utf-8 -*-\n\"\"\"astyle plugin for zazu\"\"\"\nimport zazu.styler\nimport zazu.util\n\n__author__ = \"Nicholas Wiles\"\n__copyright__ = \"Copyright 2017\"\n\n\nclass Astyl...
python
chosen
[ { "from": "system", "value": "Fix `clifford.test.run_all_tests` to use pytest\n\nCloses gh-91. Tests can be run with\n```python\nimport clifford.test\nclifford.test.run_all_tests()\n```\n" }, { "from": "human", "value": "from .test_algebra_initialisation import *\nfrom .test_clifford import *\nf...
python
chosen
[ { "from": "system", "value": "Fix issue when GIT is not tagged.\n" }, { "from": "human", "value": "from django_git.models import RepoInfo\nfrom tagging.models import Tag, TaggedItem\n\n\ndef enum_git_repo(tag_name=\"git\"):\n tag_filter = Tag.objects.filter(name=tag_name)\n if tag_filter.e...
python
chosen
[ { "from": "system", "value": "Fix bug in RegEx parser mixin\n" }, { "from": "human", "value": "import re\nfrom itertools import repeat\n\n\nclass RegexParserMixin(object):\n quoted_re = r'''(?P<q>\"|')(?P<x>.+)(?P=q)'''\n version_re = r'''(?P<s>[<>=~]*)\\s*(?P<n>.*)'''\n\n def _get_valu...
python
chosen
[ { "from": "system", "value": "Allow specifying modules to be mocked\n" }, { "from": "human", "value": "import sys\n\nfrom unittest.mock import MagicMock\n\nclass MockAnkiModules:\n \"\"\"\n I'd like to get rid of the situation when this is required, but for now this helps with the situatio...
python
chosen
[ { "from": "system", "value": "Add numpy.round to model api\n" }, { "from": "human", "value": "# -*- coding: utf-8 -*-\n\nfrom datetime import date # noqa analysis:ignore\n\nfrom numpy import maximum as max_, minimum as min_, logical_not as not_, where, select # noqa analysis:ignore\n\nfrom .c...
python
chosen
[ { "from": "system", "value": "Fix url pattern to stop requiring two trailing slashes.\n\nIn order to match this urlpattern, I had to make a request\nto localhost:6060/1// with two trailing slashes required.\n" }, { "from": "human", "value": "from __future__ import print_function\nfrom __future__...
python
chosen
[ { "from": "system", "value": "Implement experiment workflow execution with transpose method.\n" }, { "from": "human", "value": "import sys\nfrom damis.models import Experiment\n\nexp_pk = sys.argv[1]\nexp = Experiment.objects.get(pk=exp_pk)\nexp.status = 'FINISHED'\nexp.save()\n" }, { "f...
python
chosen
[ { "from": "system", "value": "Change URLs to format used in templates (consistent with news app)\n" }, { "from": "human", "value": "from django.conf.urls.defaults import *\n\nfrom .views import IndexView, ItemListView, ItemDetailView\n\nurlpatterns = patterns('',\n (r'^$',\n IndexView, {...
python
chosen
[ { "from": "system", "value": "Comment out lines accidentally left in the last commit. Oops.\n" }, { "from": "human", "value": "import sys\nimport megatableau, data_prob\nimport scipy, scipy.optimize\n\n# Argument parsing\nassert len(sys.argv)==2\ntableau_file_name = sys.argv[1]\n\n# Read in dat...
python
chosen
[ { "from": "system", "value": "Enable markdown extensions for TOC and linebreaks\n" }, { "from": "human", "value": "import bbcode\nimport markdown\nimport html\n\nfrom c2corg_ui.format.wikilinks import C2CWikiLinkExtension\n\n\n_markdown_parser = None\n_bbcode_parser = None\n\n\ndef _get_markdown...
python
chosen
[ { "from": "system", "value": "Use raw string for Windows paths\n\nThis avoids:\r\n\r\n DeprecationWarning: invalid escape sequence \\P\r\n _search_path.append('C:\\Program Files')" }, { "from": "human", "value": "import os\nimport platform\n\nfrom .generic import MeshScript\nfrom ..con...
python
chosen
[ { "from": "system", "value": "Add Django Custom Tag SSO\n" }, { "from": "human", "value": "from django import template\nfrom django.template import Template\n\nregister = template.Library()\n\n\n@register.simple_tag(takes_context=True)\ndef sso_meta(context):\n return Template('<meta name=\"t...
python
chosen
[ { "from": "system", "value": "Fix public API root view links\n" }, { "from": "human", "value": "from django.conf.urls import include, url\nfrom rest_framework.routers import DefaultRouter\n\nfrom .parking_area import PublicAPIParkingAreaViewSet\nfrom .parking_area_statistics import PublicAPIPark...
python
chosen
[ { "from": "system", "value": "Add reporting unit URL to region serializer.\n\n" }, { "from": "human", "value": "import json\n\nfrom rest_framework import serializers\n\nfrom landscapesim.models import Region\n\n\nclass ReportingUnitSerializer(serializers.Serializer):\n type = serializers.Seri...
python
chosen