conversations
listlengths
2
3
source
stringclasses
1 value
stack
stringclasses
1 value
[ { "from": "system", "value": "Use sha256 algorithm from pycrypto.\n" }, { "from": "human", "value": "#\n# Copyright (c) 2004-2008 rPath, Inc.\n#\n# This program is distributed under the terms of the Common Public License,\n# version 1.0. A copy of this license should have been distributed with t...
python
chosen
[ { "from": "system", "value": "Break down into core functions\n" }, { "from": "human", "value": "#!/usr/bin/env python3\n\nimport boto3\n\nclient = boto3.client('ses')\n\nclient.send_email(\n\tSource='david@severski.net',\n\tMessage={\n\t\t'Subject': {\n\t\t\t'Data': 'Here!',\n\t\t},\n\t\t'Body':...
python
chosen
[ { "from": "system", "value": "Add unit support for spacers\n" }, { "from": "human", "value": "# -*- coding: utf-8 -*-\r\n# See LICENSE.txt for licensing terms\r\n#$HeadURL$\r\n#$LastChangedDate$\r\n#$LastChangedRevision$\r\n\r\nimport shlex\r\n\r\nfrom reportlab.platypus import Spacer\r\n\r\nfro...
python
chosen
[ { "from": "system", "value": "Allow plugins to specify permissible update frequencies.\n\nFixed #2.\n" }, { "from": "human", "value": "import pkg_resources\n\nimport logging\nlog = logging.getLogger(\"fedmsg\")\n\n\ndef find_stats_consumer(hub):\n for cons in hub.consumers:\n if 'Stats...
python
chosen
[ { "from": "system", "value": "Fix pylint complaining about spaces and other stuff\n" }, { "from": "human", "value": "from django.contrib import admin\n\nfrom .models import Depot, Item\n\n\n# make items modifiable by admin\nadmin.site.register(Item)\n\nclass DepotAdmin(admin.ModelAdmin):\n\n ...
python
chosen
[ { "from": "system", "value": "Update comment and obey formatting requirements.\n" }, { "from": "human", "value": "import numpy as np\n\n\ndef test_fast_return():\n \"\"\"\"\"\"\n a = np.array([1, 2, 3], dtype='i')\n assert np.asarray(a) is a\n assert np.asarray(a, dtype='i') is a\n ...
python
chosen
[ { "from": "system", "value": "Implement checking if agent is up on Windows\n\nVery simple implementation using psutil\n\nChange-Id: I2b7c65d6d677f0f57e79277ac2298f0b73729b94\nPartial-Bug: #1783539\n" }, { "from": "human", "value": "#\n# Copyright (c) 2018 Juniper Networks, Inc. All rights reserv...
python
chosen
[ { "from": "system", "value": "Add module level imports and doc strings\n" }, { "from": "human", "value": "from wysteria.client import Client, TlsConfig\nfrom wysteria import errors\nfrom wysteria.constants import FACET_COLLECTION\nfrom wysteria.constants import FACET_ITEM_TYPE\nfrom wysteria.con...
python
chosen
[ { "from": "system", "value": "Fix a typo: patform -> platform" }, { "from": "human", "value": "import six\nimport hashlib\nimport ecdsa # We can use pyelliptic (uses OpenSSL) but this is more cross-patform\n\n# We use curve standard for Bitcoin by default\nCURVE = ecdsa.SECP256k1\n\n\nclass Sig...
python
chosen
[ { "from": "system", "value": "Add a regression test for the bug fixed in r28485.\n\n* subversion/bindings/swig/python/tests/core.py\n (SubversionCoreTestCase.test_SubversionException): Test explicit\n exception fields.\n\ngit-svn-id: f8a4e5e023278da1e04e203c7fe051e3c4285d88@868579 13f79535-47bb-0310-995...
python
chosen
[ { "from": "system", "value": "Add dependency for 'analytic_structure' and change version to 1.0\n" }, { "from": "human", "value": "# -*- coding: utf-8 -*-\n##############################################################################\n#\n#########################################################...
python
chosen
[ { "from": "system", "value": "Handle output passthrou from the cli\n" }, { "from": "human", "value": "'''\nUsed to manage the outputter system. This package is the modular system used\nfor managing outputters.\n'''\n\n# Import salt utils\nimport salt.loader\n\n\ndef display_output(data, out, opt...
python
chosen
[ { "from": "system", "value": "Add linting for pipeline step existence\n" }, { "from": "human", "value": "from .node import Node\n\n\nclass ExecutionNode(Node):\n type = 'execution'\n\n def __init__(self, name, step, override=None):\n if override is None:\n override = {}\n...
python
chosen
[ { "from": "system", "value": "Replace hard coded timestamp with time.time()\n" }, { "from": "human", "value": "# -*- coding: utf-8 -*-\nfrom chai import Chai\n\nfrom arrow import util\n\n\nclass UtilTests(Chai):\n def test_is_timestamp(self):\n timestamp_float = 1563047716.958061\n ...
python
chosen
[ { "from": "system", "value": "[TRAVIS] Correct the usage of nose.run.\n\nnose.run returns whether the test run was sucessful or not.\n" }, { "from": "human", "value": "\"\"\"Run tests under coverage's measurement system (Used in CI)\n\"\"\"\n\nimport os\nimport sys\nfrom os.path import join, rea...
python
chosen
[ { "from": "system", "value": "Add all endpoints to BEL API\n" }, { "from": "human", "value": "from .api import process_ndex_neighborhood\nfrom .api import process_belrdf\nfrom .api import process_belscript\nfrom .api import process_pybel_graph\nfrom .api import process_json_file\nfrom .api impor...
python
chosen
[ { "from": "system", "value": "Use pygtkhelpers refresh_gui in gtk_wait\n" }, { "from": "human", "value": "# -*- coding: utf-8 -*-\nimport gtk\nimport uuid\n\n\ndef gtk_wait(wait_duration_s):\n gtk.main_iteration_do()\n\n\ndef generate_plugin_name(prefix='plugin-'):\n '''\n Generate uniq...
python
chosen
[ { "from": "system", "value": "Update regex_utils unit test case" }, { "from": "human", "value": "# coding=utf-8\n\nimport unittest\nfrom text import regex_utils\n\nclass RegexUtilsTest(unittest.TestCase):\n\n def test_check_line(self):\n pass\n \n def test_parse_line(self):\n ...
python
chosen
[ { "from": "system", "value": "Use new open() function on TargetInfo, in example3\n" }, { "from": "human", "value": "import luigi\nimport sciluigi as sl\nimport time\n\nclass T1(sl.Task):\n\n # Parameter\n\n text = luigi.Parameter()\n\n # I/O\n\n def out_data1(self):\n return s...
python
chosen
[ { "from": "system", "value": "Use Octicons in Markdown editor\n" }, { "from": "human", "value": "from django.forms import ModelForm,Textarea,TextInput\n\n\nfrom .models import Post\n\n\nclass PostForm(ModelForm):\n class Meta:\n model = Post\n fields = ('subject','body')\n ...
python
chosen
[ { "from": "system", "value": "Make it easier to run\n" }, { "from": "human", "value": "\nfrom remedy.radremedy import create_app\n\napplication, manager = create_app('remedy.config.ProductionConfig')\napplication.debug = True\n\nif __name__ == '__main__':\n\n manager.run()\n\n" }, { "...
python
chosen
[ { "from": "system", "value": "Define inserts and deletes on CFs.\n" }, { "from": "human", "value": "# -*- coding: utf-8 -*-\n\n\"\"\"\n lilkv.columnfamily\n\n This module implements the client-facing aspect of the `lilkv` app. All\n requests are handled through this interface.\n\"\"\"\n...
python
chosen
[ { "from": "system", "value": "Remove tags and fixed .gitignore\n" }, { "from": "human", "value": "from django.db import models\nfrom django.utils import timezone\n\nclass Post(models.Model):\n title = models.CharField(max_length=200)\n author = models.CharField(max_length=100)\n tags = ...
python
chosen
[ { "from": "system", "value": "Fix django 1.5 warning - provide debug filter\n" }, { "from": "human", "value": "# A sample logging configuration. The only tangible logging\n# performed by this configuration is to send an email to\n# the site admins on every HTTP 500 error.\n# See http://docs.djan...
python
chosen
[ { "from": "system", "value": "Add content for basic tests\n" }, { "from": "human", "value": "import unittest\n\n\nclass TestDeterministicCache(unittest.TestCase):\n\n def test_init(self):\n pass\n\n def test_setitem(self):\n pass\n\n def test_save(self):\n pass\n\n ...
python
chosen
[ { "from": "system", "value": "Reduce how often this runs\n" }, { "from": "human", "value": "from apscheduler.schedulers.blocking import BlockingScheduler\n\nsched = BlockingScheduler()\n\n\n@sched.scheduled_job('cron', hour=\"*/3\", minute=0)\ndef updater():\n \"\"\"\n Run our update comma...
python
chosen
[ { "from": "system", "value": "Fix syntax error and reuse variable\n" }, { "from": "human", "value": "import json\nimport requests\n\n\nclass PushoverNotification(object):\n def __init__(self, pushover_user, pushover_token):\n self.pushover_api = 'https://api.pushover.net/1/messages.jso...
python
chosen
[ { "from": "system", "value": "Improve error handling for unknown backends\n" }, { "from": "human", "value": "from fusesoc.build.quartus import Quartus\nfrom fusesoc.build.ise import Ise\n\ndef BackendFactory(system):\n if system.backend_name == 'quartus':\n return Quartus(system)\n ...
python
chosen
[ { "from": "system", "value": "Make crude CLI commands work\n\nThis is mainly as an example to show what it can look like.\n" }, { "from": "human", "value": "import openstack\n\n\ndef main():\n print(\"Hello Clouds!\")\n" }, { "from": "gpt", "value": "import argparse\n\nfrom nubes ...
python
chosen
[ { "from": "system", "value": "Add more to the list of bad paths\n" }, { "from": "human", "value": "# -*- encoding: utf-8\n\"\"\"\nI get a bunch of requests that are uninteresting for some reason -- maybe\nsomebody trying to find a PHP admin page, or crawling for vulnerable WordPress\ninstances. ...
python
chosen
[ { "from": "system", "value": "Use username provided by telerik academy auth API\n" }, { "from": "human", "value": "from django.contrib.auth.models import User\n\nfrom dmoj import settings\n\nimport json\n\nimport requests\n\nfrom judge.models import Profile, Language\n\nclass RemoteUserBackend (...
python
chosen
[ { "from": "system", "value": "Use nltk to extract text from html data\n" }, { "from": "human", "value": "# coding: utf-8\n\"\"\"\nScript to download the raw data from http://www.rsssf.com/\nThe data was processed mostly by interactive sessions in ipython. Almost every\nfile had it's own format, ...
python
chosen
[ { "from": "system", "value": "Use six to add meta class\n" }, { "from": "human", "value": "import abc\nimport os\nfrom pkg_resources import DistributionNotFound, get_distribution\nfrom six.moves.configparser import SafeConfigParser\n\nfrom . import log_utils\n\n\ntry:\n __version__ = get_dist...
python
chosen
[ { "from": "system", "value": "Remove __all__ as it was not used and causing circular import errors when attempting to configure logging\n" }, { "from": "human", "value": "from waterbutler.core.utils import async_retry\nfrom waterbutler.core.utils import make_provider\n\n__all__ = [\n 'async_r...
python
chosen
[ { "from": "system", "value": "Update about version. It was outdated\n" }, { "from": "human", "value": "__title__ = 'facturapdf'\n__summary__ = 'Create PDF invoice according to Spanish regulations.'\n__version__ = '0.0.1'\n\n__license__ = 'BSD 3-Clause License'\n__uri__ = 'https://github.com/init...
python
chosen
[ { "from": "system", "value": "Use argparse instead of manually parsing [skip ci]\n" }, { "from": "human", "value": "#!/usr/bin/env python3\n# #############################################################################\n# Copyright (c) 2018-present lzutao <taolzu(at)gmail.com>\n# All rights ...
python
chosen
[ { "from": "system", "value": "Remove reference to old field and unused method\n" }, { "from": "human", "value": "from django.db import models\n\n\nclass Activity(models.Model):\n entry = models.ForeignKey('feeds.Entry', blank=True, null=True,\n unique=True)\n p...
python
chosen
[ { "from": "system", "value": "Improve report format and information\n\nInclude total number of files.\n" }, { "from": "human", "value": "#!/usr/bin/env python\n\nimport rethinkdb as r\nfrom optparse import OptionParser\n\n\ndef compute_project_size(project_id, conn):\n total = 0\n for f in...
python
chosen
[ { "from": "system", "value": "Add comments to permission utils\n" }, { "from": "human", "value": "from flask_principal import RoleNeed, Permission\nfrom werkzeug.exceptions import Forbidden\n\nadmin_permission = Permission(RoleNeed('admin'))\nmanager_permission = Permission(RoleNeed('manager'))\...
python
chosen
[ { "from": "system", "value": "Set default site string value\n" }, { "from": "human", "value": "from flask import Flask, render_template, jsonify\n\nfrom lanauth.api import load_api\n\n\nclass App(Flask):\n \"\"\"Web application.\n\n Routes:\n /\n /login Route to the main pag...
python
chosen
[ { "from": "system", "value": "Fix disappearing image bookmarks on refresh\n\nThe bookmark queryset was incorrect it had a filter that was returning an\nempty list.\n" }, { "from": "human", "value": "from core.models import ApplicationBookmark as ImageBookmark\nfrom django.utils import timezone\n...
python
chosen
[ { "from": "system", "value": "Read config-file and cluster options from environ\n\nThis would make it DRY in scripts/wrappers with non-default values.\n" }, { "from": "human", "value": "import fileinput\nimport os\nimport socket\nimport argparse\n\n\ndef local_addresses():\n ips = socket.geth...
python
chosen
[ { "from": "system", "value": "Fix DataFrameClient import error on python3.5\n" }, { "from": "human", "value": "# -*- coding: utf-8 -*-\n\"\"\"\nDataFrame client for InfluxDB\n\"\"\"\nfrom __future__ import absolute_import\nfrom __future__ import division\nfrom __future__ import print_function\nf...
python
chosen
[ { "from": "system", "value": "Add tests for maybe decorator\n" }, { "from": "human", "value": "from unittest import TestCase\n\nfrom importer.utils import find_first\n\n\nclass FindFirstTestCase(TestCase):\n def test_first_in_haystack(self):\n self.assertEqual(\n find_first(...
python
chosen
[ { "from": "system", "value": "Test speedup by swapping password hasher.\n" }, { "from": "human", "value": "from django.conf import settings\n\ntry:\n import honeypot\nexcept ImportError:\n honeypot = None\n\n\nif not settings.configured:\n INSTALLED_APPS = (\n 'django.contrib.aut...
python
chosen
[ { "from": "system", "value": "Clean main multi simulation script\n" }, { "from": "human", "value": "# -*- coding:utf-8 -*-\n\nfrom subprocess import check_output\nfrom multiprocessing import Pool\nfrom os import listdir, mkdir, path\nfrom sys import argv\n\ndef run_simu((psfile, dir_runs)):\n ...
python
chosen
[ { "from": "system", "value": "Return lines from plot command\n" }, { "from": "human", "value": "\"\"\"Convenience functions for matplotlib plotting and image viewing.\"\"\"\nimport numpy as np\nfrom matplotlib import pyplot as plt\n\n\ndef show(image, blocking=False, **kwargs):\n \"\"\"Show *...
python
chosen
[ { "from": "system", "value": "Use relative import for User\n" }, { "from": "human", "value": "import factory\n\nfrom access.models import User\n\n\nclass UserFactory(factory.django.DjangoModelFactory):\n class Meta:\n model = User\n\n email = factory.Sequence(lambda n: 'user{}@examp...
python
chosen
[ { "from": "system", "value": "Convert task output to UTF8\n" }, { "from": "human", "value": "import bosh_client\nimport os\nimport yaml\n\n\ndef do_step(context):\n settings = context.meta['settings']\n username = settings[\"username\"]\n home_dir = os.path.join(\"/home\", username)\n\n...
python
chosen
[ { "from": "system", "value": "Add StoqPluginException to default imports\n" }, { "from": "human", "value": "#!/usr/bin/env python3\n\n# Copyright 2014-2018 PUNCH Cyber Analytics Group\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may not use this file excep...
python
chosen
[ { "from": "system", "value": "Remove a no cover pragma having no effect (since the pragma only affects the current line)\n" }, { "from": "human", "value": "# pragma: no cover\n\nimport warnings\n\nimport django\n\n\nif django.VERSION < (3, 2):\n from feincms3.applications import * # noqa\n\n...
python
chosen
[ { "from": "system", "value": "Update failing metadata settings acceptance test.\n" }, { "from": "human", "value": "# disable missing docstring\n#pylint: disable=C0111\n\nfrom lettuce import world, step\n\n\n@step('I see the correct settings and default values$')\ndef i_see_the_correct_settings_a...
python
chosen
[ { "from": "system", "value": "Add external module reference to deal with html\n" }, { "from": "human", "value": "#!/usr/bin/python\n# -*- coding: UTF-8 -*-\n\n# enable web debugging\nimport cgitb\ncgitb.enable()\n\nprint(\"Content-Type: text/html;charset=utf-8\")\nprint()\n\nimport formar.fweb.W...
python
chosen
[ { "from": "system", "value": "Prepare for use as module\n" }, { "from": "human", "value": "from turtle import *\n\nGROESSE = 0.5\nFARBE = \"red\"\nFAERBEN = True\nSHAPE = \"turtle\"\n\nfillcolor(FARBE)\nshape(SHAPE)\n\ndef zeichneKerze(brennt):\n pd()\n begin_fill()\n forward(GROESSE*10...
python
chosen
[ { "from": "system", "value": "Fix \"Extend Expiration Date\" Server Action\n\nServer Action had bugs where server.expiration_date would cause an\nexception if it wasn't set, and was using the old method\n`group.approvers`. These issues have been fixed, and the plugin is more\nstable.\n\n[DEV-13752]\n" }, ...
python
chosen
[ { "from": "system", "value": "Complete max subarray sum by DP\n" }, { "from": "human", "value": "\"\"\"Leetcode 53. Maximum Subarray\nEasy\n\nGiven an integer array nums, find the contiguous subarray\n(containing at least one number) which has the largest sum and return its sum.\n\nExample:\n\nI...
python
chosen
[ { "from": "system", "value": "Fix build wheels and upload 3.\n" }, { "from": "human", "value": "from subprocess import call, check_output\nimport sys\n\nisPython3 = sys.version_info.major == 3\n\n# https://stackoverflow.com/a/3357357\ncommand = 'git log --format=%B -n 1'.split()\nout = check_out...
python
chosen
[ { "from": "system", "value": "Use the core, make example more useful.\n\n\ngit-svn-id: d4fdfcd4de20a449196f78acc655f735742cd30d@874 14d46d22-621c-0410-bb3d-6f67920f7d95\n" }, { "from": "human", "value": "import sys\nimport os\n\nimport pyglet.window\nfrom pyglet.gl import *\nfrom pyglet import c...
python
chosen
[ { "from": "system", "value": "Change to raw strings in exercise 4 checking\n" }, { "from": "human", "value": "from learntools.core import *\nimport tensorflow as tf\n\n\nclass Q1A(ThoughtExperiment):\n _solution = \"\"\n\n\nclass Q1B(ThoughtExperiment):\n _solution = \"\"\n\nQ1 = Multipart...
python
chosen
[ { "from": "system", "value": "Add 12/2 part 2 solution\n" }, { "from": "human", "value": "# Advent of Code\n# Dec 2, Part 2\n# @geekygirlsarah\n\n" }, { "from": "gpt", "value": "# Advent of Code\n# Dec 2, Part 1\n# @geekygirlsarah\n\ninputFile = \"input.txt\"\n\n# Tracking vars\nfina...
python
chosen
[ { "from": "system", "value": "Comment out erroneous process_with_pid_is_running() test\n" }, { "from": "human", "value": "import subprocess\n\nfrom mediawords.util.process import *\n\n\ndef test_process_with_pid_is_running():\n test_process = subprocess.Popen(['sleep', '999'])\n test_proce...
python
chosen
[ { "from": "system", "value": "Fix import template tag obj_tags on test case core\n" }, { "from": "human", "value": "from django.test import TestCase\n\nfrom opps.channels.templatetags.menu_tags import ofKey\n\n\nclass OfKeyTest(TestCase):\n def test_tag(self):\n result = ofKey({\"name\...
python
chosen
[ { "from": "system", "value": "Add a list filter to make looking a specific users easier.\n" }, { "from": "human", "value": "from django.contrib import admin\nfrom twitter.models import User, Tweet, Analytics, AnalyticsReport\n\n\nclass UserAdmin(admin.ModelAdmin):\n list_display = ('screen_na...
python
chosen
[ { "from": "system", "value": "Fix incorrect args to super\n" }, { "from": "human", "value": "from _nnpy import ffi, lib as nanomsg\n\nclass NNError(Exception):\n def __init__(self, error_no, *args, **kwargs):\n super().__init__(*args, **kwargs)\n self.error_no = error_no\n\ndef ...
python
chosen
[ { "from": "system", "value": "Add linked list class and add method\n" }, { "from": "human", "value": "# Given a singly linked list of integers l and an integer k, remove all elements from list l that have a value equal to k\n\nclass Node(object):\n\tdef __init__(self, value):\n\t\tself.value = v...
python
chosen
[ { "from": "system", "value": "Make the CustomerUserModelBackend Dj1.5 compatible\n" }, { "from": "human", "value": "from django.contrib.auth.backends import ModelBackend\nfrom django.contrib.auth.models import User\n\n\nclass CustomUserModelBackend(ModelBackend):\n def authenticate(self, user...
python
chosen
[ { "from": "system", "value": "Add pipeline run and operation run factories\n" }, { "from": "human", "value": "import factory\n\nfrom factories.factory_projects import ProjectFactory\nfrom factories.factory_users import UserFactory\nfrom pipelines.models import Pipeline, Operation\n\n\nclass Pipe...
python
chosen
[ { "from": "system", "value": "Use update,get,setdefault and so on.\n" }, { "from": "human", "value": "#!/usr/local/bin/python\n#items=[('a','b'),(1,2)]\n#b=dict(items)\n#print b\n#c=dict(name='c',age=42)\n#print c\n#print len(c)\n#c['sex']='female'\n#print c\n#del c['age']\n#print c\n#print 'sex...
python
chosen
[ { "from": "system", "value": "Work on chapter 7 enriching airlines with the name of the carrier from the openflights airline data\n" }, { "from": "human", "value": "# Load the on-time parquet file\non_time_dataframe = sqlContext.read.parquet('../data/on_time_performance.parquet')\n\nwikidata = s...
python
chosen
[ { "from": "system", "value": "Add a test that demonstrates calling a function within a class definition.\n" }, { "from": "human", "value": "\nfrom nose.tools import *\n\nfrom libeeyore.builtins import add_builtins\nfrom libeeyore.classvalues import *\nfrom libeeyore.environment import EeyEnviron...
python
chosen
[ { "from": "system", "value": "Change output format to a more reasonable one\n\n\ngit-svn-id: 056f9092885898c4775d98c479d2d33d00273e45@143 dda364a1-ef19-0410-af65-756c83048fb2\n" }, { "from": "human", "value": "\nimport re\nimport urllib\n\ndef handle_url(bot, user, channel, url, msg):\n \"\"\...
python
chosen
[ { "from": "system", "value": "Fix setting up AUTO_FOLLOWABLES models\n\nNote that `Signal.connect` expects the model class as the sender\nargument.\n\nAltough while using e.g. `post_save` it also works with a string\n`\"apname.model\"`\n" }, { "from": "human", "value": "from django.conf import s...
python
chosen
[ { "from": "system", "value": "Save file in correct folder\n" }, { "from": "human", "value": "from update import *\nfrom plot_and_save import *\nfrom Parameters.parametersA3 import n, n_t, n0\nanimate = False # animate the wave in the string upon completion\nplot = False # plo...
python
chosen
[ { "from": "system", "value": "Fix setting of QT_API environment variable\n" }, { "from": "human", "value": "import os\nimport warnings\n\nqt_api = os.environ.get('QT_API')\n\nif qt_api is None:\n try:\n import PySide\n qt_api = 'pyside'\n except ImportError:\n try:\n ...
python
chosen
[ { "from": "system", "value": "Switch to post Celery 2.2 task decorator syntax." }, { "from": "human", "value": "from celery.decorators import task\nfrom make_mozilla.bsd import BSDRegisterConstituent\n\n@task\ndef register_email_address_as_constituent(email_address, group):\n BSDRegisterConst...
python
chosen
[ { "from": "system", "value": "Move variable out of inline dict construction to debug production errors.\n" }, { "from": "human", "value": "\"\"\"\nHelpers for sharing\n\"\"\"\nfrom django.template import Library\n\nregister = Library()\n\ndef absolute(request):\n return request.build_absolute...
python
chosen
[ { "from": "system", "value": "Add scrape character unit test\n" }, { "from": "human", "value": "def test_scrape_item_by_id():\n from api.scrapers.item import scrape_item_by_id\n\n item = scrape_item_by_id('d19447e548d')\n\n assert item.id == 'd19447e548d'\n assert item.name == 'Thyru...
python
chosen
[ { "from": "system", "value": "Change name of start_scrapers() to be more accurate\n" }, { "from": "human", "value": "#!/usr/bin/env python3\n\nimport subprocess\nimport atexit\nimport sys\nfrom utils.safe_schedule import SafeScheduler\nfrom time import sleep\nfrom glob import glob\n\n\nMETA_IMPO...
python
chosen
[ { "from": "system", "value": "Add numpy array serializer field\n" }, { "from": "human", "value": "\"\"\"Serializer fields\"\"\"\nfrom django.contrib.gis import forms\nfrom rest_framework.fields import WritableField\n\nfrom spillway.compat import json\n\n\nclass GeometryField(WritableField):\n ...
python
chosen
[ { "from": "system", "value": "Add visit method to Mentor\n" }, { "from": "human", "value": "import random\n\nfrom characters import BaseCharacer\n\n\nclass Mentor(BaseCharacer):\n MENTORS_COUNT = 4\n\n def __init__(self, location, *groups):\n super(Mentor, self).__init__(location, *...
python
chosen
[ { "from": "system", "value": "Add message with link to seqclusterViz\n" }, { "from": "human", "value": "import os\nimport shutil\nimport logging\n\nfrom bcbio import install\ninstall._set_matplotlib_default_backend()\nimport matplotlib\nmatplotlib.use('Agg', force=True)\n\nfrom libs.read import ...
python
chosen
[ { "from": "system", "value": "Make sure shallow clone pulls all tags\n\nNo-single-branch flag ensures shallow-clone depth constraint does not make older tags invisible" }, { "from": "human", "value": "# Copyright FuseSoC contributors\n# Licensed under the 2-Clause BSD License, see LICENSE for de...
python
chosen
[ { "from": "system", "value": "Remove send_to config from tests since Vumi's application test class now adds this automatically.\n" }, { "from": "human", "value": "# -*- coding: utf-8 -*-\n\n\"\"\"Tests for go.vumitools.api_worker.\"\"\"\n\nfrom twisted.internet.defer import inlineCallbacks\n\nfr...
python
chosen
[ { "from": "system", "value": "Fix path to org field\n" }, { "from": "human", "value": "from celery import shared_task\nfrom mrbelvedereci.build.models import Build\nfrom mrbelvedereci.salesforce.models import Org\n\n@shared_task\ndef run_build(build_id):\n build = Build.objects.get(id=build_i...
python
chosen
[ { "from": "system", "value": "Rename create_dirs method to makedirs in line with os.path method\n" }, { "from": "human", "value": "# -*- coding: utf-8 -*-\n\n\"\"\"\nfile: model_files.py\n\nGraph model classes for working with files\n\"\"\"\n\nimport os\nimport logging\n\nfrom lie_graph.graph_mi...
python
chosen
[ { "from": "system", "value": "Fix browsable API in test project - add staticfiles app.\n" }, { "from": "human", "value": "import os\n\nDEBUG = True\n\nBASE_DIR = os.path.dirname(__file__)\n\nDATABASES = {\n 'default': {\n 'ENGINE': 'django.db.backends.sqlite3',\n 'NAME': os.path...
python
chosen
[ { "from": "system", "value": "Reorder so it's similar to imports, purely cosmetics/readability\n" }, { "from": "human", "value": "from .pipeline import (\n install,\n uninstall,\n\n Creator,\n\n ls,\n containerise,\n\n)\n\nfrom .lib import (\n lsattr,\n lsattrs,\n read,\n...
python
chosen
[ { "from": "system", "value": "Create a new figure for each plot\n" }, { "from": "human", "value": "# Plot image to screen\nimport cv2\nimport numpy\nimport matplotlib\nfrom plantcv.plantcv import params\nfrom matplotlib import pyplot as plt\nfrom plantcv.plantcv import fatal_error\n\n\ndef plot_...
python
chosen
[ { "from": "system", "value": "Make string example a bit less confusing\n" }, { "from": "human", "value": "import collections\nimport collections.abc\n\n\ndef strings_have_format_map_method():\n \"\"\"\n As of Python 3.2 you can use the .format_map() method on a string object\n to use ma...
python
chosen
[ { "from": "system", "value": "Allow vertices to define a `prepare_vertex` function which will be called just once at some point in the build process.\n" }, { "from": "human", "value": "import sys\n\nfrom pacman103.core import control\nfrom pacman103 import conf\n\nfrom . import builder\n\n\nclas...
python
chosen
[ { "from": "system", "value": "Remove spaces from around arguements\n" }, { "from": "human", "value": "from datetime import datetime, timedelta\nfrom random import randrange\n\nfrom todoman import ui\n\nDATE_FORMAT = \"%d-%m-%y\"\n\n\ndef test_format_date():\n \"\"\"\n Tests the format_date...
python
chosen
[ { "from": "system", "value": "Remove commented out packer import\n" }, { "from": "human", "value": "import os\n\n# pylint: disable=unused-wildcard-import,unused-import,wildcard-import\n\nSRC_DIR = os.path.dirname(os.path.abspath(__file__)) # elife-builder/src/\n\n# once called 'THIS_DIR', now de...
python
chosen
[ { "from": "system", "value": "Refactor code and add ability for many input.\n" }, { "from": "human", "value": "from flask import Flask, request, redirect\nimport twilio.twiml\n\napp = Flask(__name__)\n\n@app.route(\"/\", methods=['GET', 'POST'])\ndef hello_monkey():\n \"\"\"Respond to incomin...
python
chosen
[ { "from": "system", "value": "Add a requirements configuration exception\n" }, { "from": "human", "value": "class CommandConfigError(Exception):\n \"\"\"Exception for command configuration errors\"\"\"\n pass\n" }, { "from": "gpt", "value": "class CommandConfigError(Exception):...
python
chosen
[ { "from": "system", "value": "Add subparsers for power, rgb, hsb and temperature\n" }, { "from": "human", "value": "# -*- encoding: utf8 -*-\nfrom __future__ import division, print_function, division\n\nimport pylifx\n\n\nif __name__ == '__main__':\n import argparse\n\n parser = argparse.A...
python
chosen
[ { "from": "system", "value": "Fix the regex so that it catches all characters to the right of the equals-sign.\n" }, { "from": "human", "value": "#! /usr/bin/env python\nimport jinja2\nimport sys\nimport re\nimport os\n\n\nKEY_REGEX = re.compile('([A-Z]+)=(\\w+)')\n\n\ndef main():\n args = sy...
python
chosen
[ { "from": "system", "value": "Add another user for permission testing\n" }, { "from": "human", "value": "import json\n\nfrom django.test import TestCase, Client\n\n# Create your tests here.\n\nfrom login.models import myuser\n\nfrom rest_framework.authtoken.models import Token\n\n\nclass APITest...
python
chosen
[ { "from": "system", "value": "Fix the app config loading process\n" }, { "from": "human", "value": "# Main application file\n#\n# Copyright (c) 2017, Alexandre Hamelin <alexandre.hamelin gmail.com>\n\n\nimport os\nfrom flask import Flask\nfrom flask_login import LoginManager\napp = Flask(__name_...
python
chosen
[ { "from": "system", "value": "Update reservation object to use current time\n" }, { "from": "human", "value": "from django.db import models\n\nclass Author(models.Model):\n '''Object for book author'''\n\n first_name = models.CharField(max_length=128)\n last_name = models.CharField(max_length...
python
chosen
[ { "from": "system", "value": "Use temporary files for testing.\n" }, { "from": "human", "value": "from pbag.serialize import dump, load\n\n\ndata = [b'Hello\\n', 1, b'world!', None]\n\n\ndef test_core():\n with open('_foo.pack', 'wb') as f:\n dump(data, f)\n\n with open('_foo.pack',...
python
chosen