conversations
listlengths
2
3
source
stringclasses
1 value
stack
stringclasses
1 value
[ { "from": "system", "value": "Move towards real spec usage\n" }, { "from": "human", "value": "from spec import skip\n\n\ndef simple_command_on_host():\n \"\"\"\n Run command on host \"localhost\"\n \"\"\"\n skip()\n Connection('localhost').run('echo foo')\n # => Result\n\ndef s...
python
chosen
[ { "from": "system", "value": "Use python's unit testing framework\n" }, { "from": "human", "value": "from Math.MathFunctions import *\n\ndef pointTest():\n point1 = (0, 0)\n point2 = (2, 4)\n\n print(\"Point 1: {}\".format(point1))\n print(\"Point 2: {}\".format(point2))\n print(\...
python
chosen
[ { "from": "system", "value": "Add result property to AsyncResult\n(it blocks if the result has not been previously retrieved, or return the\nresult otherwise)\n" }, { "from": "human", "value": "\"\"\"cell.result\"\"\"\n\nfrom __future__ import absolute_import\nfrom __future__ import with_stateme...
python
chosen
[ { "from": "system", "value": "Add import back to test script\n" }, { "from": "human", "value": "from runtests import Tester\nimport os.path\n\ntester = Tester(os.path.abspath(__file__), \"fake_spectra\")\n\ntester.main(sys.argv[1:])\n" }, { "from": "gpt", "value": "from runtests impo...
python
chosen
[ { "from": "system", "value": "Simplify this code and make sure AdminSite doesn't act like a singleton\n\n Create a faux-singleton for `AdminSite` and make sure it has a copy of\n all of the previously registered models. This makes\n `armstrong.hatband.site` look just like `django.contrib.admin.site`.\n" ...
python
chosen
[ { "from": "human", "value": "Fix \"invalid credentials\" error running functional tests\n\nThis fixes the \"invalid credentials\" error that you will get\nif you create a clean barbican environment and try to run the\nfunctional tests. It is actually a workaround for a change\nto tempest (see https://revie...
python
chosen
[ { "from": "system", "value": "Feature: Add Pinry plugin config to local_settings.py\n" }, { "from": "human", "value": "import os\n\n\n# Please don't change following settings unless you know what you are doing\nSTATIC_ROOT = '/data/static'\n\nMEDIA_ROOT = os.path.join(STATIC_ROOT, 'media')\n\n# ...
python
chosen
[ { "from": "system", "value": "Change BindTextureRenderNode to make fewer GL calls when the texture scale is None.\n" }, { "from": "human", "value": "\"\"\"\n bind_texture\n\"\"\"\nfrom __future__ import absolute_import, division, print_function, unicode_literals\nimport logging\nfrom OpenGL i...
python
chosen
[ { "from": "system", "value": "Add fake IBM Watson response for testing\n" }, { "from": "human", "value": "#!/usr/bin/env python3\n\n\nimport json\nimport watson_developer_cloud as wdc\n\nfrom api_aggregator import ApiAggregator\n\n\nclass WatsonConnector():\n \"\"\"\n Handles the connectio...
python
chosen
[ { "from": "system", "value": "Add sessions inline to classes\n" }, { "from": "human", "value": "from django.contrib import admin\n\nfrom classes.models import Attendee\nfrom classes.models import Attendance\nfrom classes.models import Session\nfrom classes.models import WalkinClass\n\n\nclass At...
python
chosen
[ { "from": "system", "value": "Bump version to 0.3.9 for development.\n\nGoing forward I think I will use the even/odd version scheme to mark\ndevelopment and stable versions to make minimum version checks easy." }, { "from": "human", "value": "# Copyright (c) 2005-2006 Itamar Shtull-Trauring.\n#...
python
chosen
[ { "from": "system", "value": "Hide ignorable error from googleApiClient\n" }, { "from": "human", "value": "#Initialize the logging.\n# InitLogging() should be called at the startup of each process in Procfile\n\nimport logging\n\ndef InitLogging():\n \"\"\"\n Initizalize the logging.\n ...
python
chosen
[ { "from": "system", "value": "Remove unused imports in interpeter." }, { "from": "human", "value": "# -*- coding: utf-8 -*-\n\nfrom os.path import dirname, join\n\nfrom .evaluator import evaluate\nfrom .parser import parse, unparse, parse_multiple\nfrom .types import Environment\n\n\ndef interpr...
python
chosen
[ { "from": "system", "value": "Add function to populate support from links.\n" }, { "from": "human", "value": "class MockStatement(object):\n \"\"\"A class to imitate real INDRA Statements for calculating belief.\"\"\"\n def __init__(self, mk_hash, evidence, supports=None, supported_by=None...
python
chosen
[ { "from": "system", "value": "Add kimochi client to request to make it available to views\n" }, { "from": "human", "value": "from pyramid.config import Configurator\n\n\ndef main(global_config, **settings):\n \"\"\" This function returns a Pyramid WSGI application.\n \"\"\"\n config = C...
python
chosen
[ { "from": "system", "value": "Return a base64 text/html response instead of a binary response\n" }, { "from": "human", "value": "import os.path\nimport re\n\nfrom pyramid.httpexceptions import HTTPBadRequest\nfrom pyramid.response import Response\nfrom pyramid.view import view_config\n\n\n@view_...
python
chosen
[ { "from": "system", "value": "Remove the now-defunct middleware from the test settings\n" }, { "from": "human", "value": "# Settings to be used when running unit tests\n# python manage.py test --settings=lazysignup.test_settings lazysignup\n\nDATABASE_ENGINE = 'sqlite3' # 'postgresql_p...
python
chosen
[ { "from": "system", "value": "Add service API methods to what should be implemented\n\nAdd service API methods\n" }, { "from": "human", "value": "# 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 obt...
python
chosen
[ { "from": "system", "value": "Add bots with no games to the leaderboard\n" }, { "from": "human", "value": "import datetime\nfrom sqlalchemy.sql import func\nfrom models import MatchResult, BotSkill, BotRank\n\n\nclass SkillUpdater(object):\n def run(self, db):\n session = db.session\n ...
python
chosen
[ { "from": "system", "value": "Add known location for HIT when loading pyhit\n\n(refs #17108)\n" }, { "from": "human", "value": "import os\nimport sys\nimport subprocess\nimport mooseutils\n\nmoose_dir = mooseutils.git_root_dir(os.path.dirname(__file__))\nstatus = mooseutils.git_submodule_status(...
python
chosen
[ { "from": "system", "value": "Improve ActiveLanguageMixin to hide original field\n" }, { "from": "human", "value": "from .conf import get_default_language\nfrom .translator import get_i18n_field\nfrom .utils import get_language\n\n\nclass ActiveLanguageMixin(object):\n '''\n Hide all trans...
python
chosen
[ { "from": "system", "value": "Simplify handling of image format.\n" }, { "from": "human", "value": "import os\nimport matplotlib.pyplot as plt\n\n\ndef save_all_figs(directory='./', fmt=None, default_name='untitled%i'):\n \"\"\"Save all open figures.\n\n Each figure is saved with the title...
python
chosen
[ { "from": "system", "value": "Adjust migration for new structure\n" }, { "from": "human", "value": "# -*- coding: utf-8 -*-\nimport datetime\nfrom south.db import db\nfrom south.v2 import SchemaMigration, DataMigration\nfrom django.db import models\n\n\nclass Migration(DataMigration):\n\n def...
python
chosen
[ { "from": "system", "value": "Add a new test - on date to day number conversion.\n" }, { "from": "human", "value": "from datetime import date as vanilla_date\n\nfrom calendar_testing import CalendarTest\n\nfrom calexicon.calendars.other import JulianDayNumber\n\nclass TestJulianDayNumber(Calenda...
python
chosen
[ { "from": "system", "value": "Initialize iptables rules on initialization of MetadataManager\n\nTo avoid multiple initialization of iptables rules if there are a few\nworkers for metadata service, perform iptables configuration in\n__init__() of MetadataManager.\n\nChange-Id: I674c04f973318f06cbb98693f0a884...
python
chosen
[ { "from": "system", "value": "Implement a basic authentication API\n" }, { "from": "human", "value": "from mailu import db, models, app, limiter\nfrom mailu.internal import internal, nginx\n\nimport flask\nimport flask_login\n\n\n@internal.route(\"/auth/email\")\n@limiter.limit(\n app.config[...
python
chosen
[ { "from": "system", "value": "Add other statistical measures for graphing\n" }, { "from": "human", "value": "import graph\nfrom corpus.mysql.reddit import RedditMySQLCorpus\n\nimport cred\n\nif __name__ == '__main__':\n corpus = RedditMySQLCorpus()\n corpus.setup(**(cred.kwargs))\n\n re...
python
chosen
[ { "from": "system", "value": "chore(Dev): Update Thema version static string\n" }, { "from": "human", "value": "# Generated by generate.js. Commit this file, but do not edit it.\n\nfrom manager.helpers import EnumChoice\n\n# The version of Thema to use\nversion = \"2.20.0\"\n\n\nclass Themes(Enu...
python
chosen
[ { "from": "system", "value": "Update new member example to not be broken.\n\nTook forever but better late than never.\n" }, { "from": "human", "value": "import discord\n\nclass MyClient(discord.Client):\n async def on_ready(self):\n print('Logged in as')\n print(self.user.name)\...
python
chosen
[ { "from": "system", "value": "Replace database_uri method with a property\n" }, { "from": "human", "value": "class Config(object):\n \"\"\"\n Base configuration class. Contains one method that defines the database URI.\n\n This class is to be subclassed and its attributes defined there...
python
chosen
[ { "from": "system", "value": "Create a server class from scratch\n" }, { "from": "human", "value": "# Touchscreen Kivy Interface for Lidar Project\n\nfrom kivy.app import App\nfrom kivy.uix.gridlayout import GridLayout\nfrom kivy.core.window import Window\n\n#Window.clearcolor=(1,1,1,1)\n\nclass...
python
chosen
[ { "from": "system", "value": "Allow key settings to be saved\n" }, { "from": "human", "value": "from __future__ import absolute_import\n\nfrom django import forms\nfrom django.utils.translation import ugettext_lazy as _\n\nfrom sentry.models import ApiKey, OrganizationMemberType\nfrom sentry.web...
python
chosen
[ { "from": "system", "value": "Change number of cores for submit\n" }, { "from": "human", "value": "\"\"\"\nDoc string here.\n\n@author mje\n@email: mads [] cnru.dk\n\n\"\"\"\nimport sys\nimport subprocess\n\ncmd = \"/usr/local/common/meeg-cfin/configurations/bin/submit_to_isis\"\n\nsubjects = [\...
python
chosen
[ { "from": "system", "value": "Fix failing of unittests in one thread\n\nWith change of default driver, that is used for unittests one additional\nmethod 'ensure_share' was not mocked, that caused problems running\nunittests in one thread.\n\nChange-Id: Iea08207bb6200c37f5608d222dccdfbdc509b234\nCloses-Bug: ...
python
chosen
[ { "from": "system", "value": "Create the Subscriber Form - Part III > Create Stripe Processing Code\n" }, { "from": "human", "value": "from django.db import models\nfrom django.contrib.auth.models import User\n\nclass Subscriber(models.Model):\n user_rec = models.ForeignKey(User)\n address...
python
chosen
[ { "from": "system", "value": "Allow for writing specific graph images\n" }, { "from": "human", "value": "\"\"\"Save graphical representations of all the lyman workflows.\"\"\"\nimport os\nimport re\nfrom glob import glob\nfrom lyman import workflows as wf\nfrom nipype import config\n\n\ndef main...
python
chosen
[ { "from": "system", "value": "Remove unused line from cached_property\n" }, { "from": "human", "value": "# coding: utf-8\n\"\"\"\nFunctions to dynamically attach attributes to classes.\nMost of parsing result is cached because of immutability of input data.\n\"\"\"\n\n\nclass cached_property(obj...
python
chosen
[ { "from": "system", "value": "Update unittest suite for new modules.\n" }, { "from": "human", "value": "\"\"\"Builds a test suite for all tests in the 'core' directory.\n\nThe django-admin command `tests` looks for a tests.py file and expects a suite()\nroutine to return a unittest.TestSuite.\n\...
python
chosen
[ { "from": "system", "value": "Complete the list of expected tests\n" }, { "from": "human", "value": "\"\"\"\nTests for StopWordFactory\n\"\"\"\nimport os\n\nfrom unittest import TestCase\n\nfrom mots_vides.stop_words import StopWord\nfrom mots_vides.factory import StopWordFactory\n\n\nclass Stop...
python
chosen
[ { "from": "system", "value": "Update public API to include get_version() so setup.py doesn't die.\n\nThanks to Curt Micol.\n" }, { "from": "human", "value": "from context_managers import warnings_only\nfrom decorators import hosts, roles, runs_once\nfrom operations import require, prompt, put, g...
python
chosen
[ { "from": "system", "value": "Add value to return if nothing is found\n" }, { "from": "human", "value": "from django.db import models\nfrom django.utils.timezone import now\nfrom django.utils.translation import get_language\nfrom django.utils.translation import ugettext_lazy as _\nfrom rdmo.core...
python
chosen
[ { "from": "system", "value": "Add colunm active in calls tables.\n" }, { "from": "human", "value": "from dataviva import db\n\nclass Call(db.Model):\n __tablename__ = 'partner_call'\n id = db.Column(db.Integer, primary_key=True)\n title = db.Column(db.String(400))\n link = db.Column(...
python
chosen
[ { "from": "system", "value": "Convert basic tests to pytest\n" }, { "from": "human", "value": "\"\"\"Basic Unit Tests.\"\"\"\nimport unittest\nfrom flask import current_app\nfrom .. import create_app\nfrom ..database import db\n\n\nclass BasicsTestCase(unittest.TestCase):\n \"\"\"Basic Test C...
python
chosen
[ { "from": "system", "value": "Add y to the check true function\n\nThis is an obvious omision.\n" }, { "from": "human", "value": "from fabric.api import hide, settings\nfrom fabric.colors import blue\nfrom contextlib import contextmanager\n\n\ndef header(txt):\n \"\"\"Decorate a string to make...
python
chosen
[ { "from": "system", "value": "Improve error message on DispatchError's\n" }, { "from": "human", "value": "# -*- coding: utf-8 -*-\nimport importlib\n\nfrom simpleflow.activity import Activity\n\nfrom .exceptions import DispatchError\n\n\nclass Dispatcher(object):\n \"\"\"\n Dispatch by nam...
python
chosen
[ { "from": "system", "value": "Allow version parsing code to use non-annotated tags" }, { "from": "human", "value": "# -*- coding: utf-8 -*-\n# ############# version ##################\nfrom pkg_resources import get_distribution, DistributionNotFound\nimport os.path\nimport subprocess\nimport re\...
python
chosen
[ { "from": "system", "value": "Bugfix: Allow integer ports in split_address.\n" }, { "from": "human", "value": "from .validation import valid_hostname, valid_port\n\n\ndef resolve(path_or_address=None, address=None, *ignored):\n \"\"\"Returns (path, address) based on consecutive optional argum...
python
chosen
[ { "from": "system", "value": "Access to all accounts only for superusers\n" }, { "from": "human", "value": "from django.contrib import admin\n\nfrom bejmy.categories.models import Category\n\n\n@admin.register(Category)\nclass CategoryAdmin(admin.ModelAdmin):\n list_display = (\n 'name...
python
chosen
[ { "from": "system", "value": "Add some files to Legion\n" }, { "from": "human", "value": "\"\"\"\nBenchExec is a framework for reliable benchmarking.\nThis file is part of BenchExec.\n\nCopyright (C) 2007-2015 Dirk Beyer\nAll rights reserved.\n\nLicensed under the Apache License, Version 2.0 (t...
python
chosen
[ { "from": "system", "value": "Fix tab spacing from 2 to 4 spaces\n" }, { "from": "human", "value": "#!/usr/local/bin/python3.6\n\n# read nginx access log\n# parse and get the ip addresses and times\n# match ip addresses to geoip\n# possibly ignore bots\n\nimport re\n\n\ndef get_log_lines(path):\...
python
chosen
[ { "from": "system", "value": "Remove needless creation of MarshmallowConverter\n" }, { "from": "human", "value": "import uplink\n\n# Local imports\nimport github\n\nBASE_URL = \"https://api.github.com/\"\n\nif __name__ == \"__main__\":\n # Create a client that uses the marshmallow converter\n...
python
chosen
[ { "from": "system", "value": "Add langs list, add random lang\n\nAdd langs list that includes all supported google translate languages.\nAdd random language selector.\n" }, { "from": "human", "value": "from translate import Translator\ntranslator= Translator(to_lang=\"ru\")\ntranslation = transl...
python
chosen
[ { "from": "system", "value": "Use more reliable method of detecting iterables in msgpack serializer\n" }, { "from": "human", "value": "import msgpack\nfrom datetime import datetime\nfrom . import Serializer\n\n\ndef default_handler(obj):\n\ttry:\n\t\titerable = iter(obj)\n\texcept TypeError:\n\t...
python
chosen
[ { "from": "system", "value": "Make everything a percentage of the total\n" }, { "from": "human", "value": "#!/usr/bin/env python\nimport sys\n\nif sys.argv.__len__() < 3:\n print \"Usage : Enter time needed for each portion of the code\"\n print \" % overhead <advance> <exchange> <regr...
python
chosen
[ { "from": "system", "value": "Make search signal handlers use get_indexed_objects\n" }, { "from": "human", "value": "from django.db.models.signals import post_save, post_delete\nfrom django.db import models\n\nfrom wagtail.wagtailsearch.index import Indexed\nfrom wagtail.wagtailsearch.backends i...
python
chosen
[ { "from": "system", "value": "Remove unneeded mixins from LandingView\n" }, { "from": "human", "value": "from django.views.generic import ListView\n\nfrom bills.mixins import AllSubjectsMixin\nfrom core.mixins import ConveneTimeMixin\nfrom legislators.mixins import AllLegislatorsMixin, ChambersM...
python
chosen
[ { "from": "system", "value": "Set default ordering of Calendars\n" }, { "from": "human", "value": "from django.db import models\n\n# Create your models here.\nclass Calendar(models.Model):\n name = models.CharField(max_length=30, unique=True)\n remote_id = models.CharField(max_length=60)\n...
python
chosen
[ { "from": "system", "value": "Move rabbit vars to globals\n" }, { "from": "human", "value": "import os\nimport sys\n# Append .. to sys path\nsys.path.append(os.path.dirname(os.path.dirname(os.path.abspath(__file__))))\nimport multiscanner\n\nfrom celery import Celery\n\napp = Celery('celery_work...
python
chosen
[ { "from": "system", "value": "Add comments to vex via wrapper\n" }, { "from": "human", "value": "import requests\nMATCH_LIST_URL = \"http://data.vexvia.dwabtech.net/mobile/events/csv\"\nDIVISION_URL = \"http://data.vexvia.dwabtech.net/mobile/{}/divisions/csv\"\nMATCH_URL = \"http://data.vexvia.d...
python
chosen
[ { "from": "system", "value": "Allow to import roles when importing people\n" }, { "from": "human", "value": "from zou.app.blueprints.source.csv.base import BaseCsvImportResource\n\nfrom zou.app.models.person import Person\nfrom zou.app.utils import auth, permissions\n\nfrom sqlalchemy.exc import...
python
chosen
[ { "from": "system", "value": "Fix trailing spaces/tabs in Python code\n" }, { "from": "human", "value": "#!/usr/bin/python\nimport os\nimport httplib\nimport string\n\n# To install run:\n# sudo wget http://$JENKINS_URL/plugin/ec2/AMI-Scripts/ubuntu-init.py -O /usr/bin/userdata\n# sudo chmod +x /...
python
chosen
[ { "from": "system", "value": "Change URL from Zolera (sob, snif, sigh :) to SF\n\n\ngit-svn-id: c4afb4e777bcbfe9afa898413b708b5abcd43877@123 7150bf37-e60d-0410-b93f-83e91ef0e581\n" }, { "from": "human", "value": "#! /usr/bin/env python\n# $Header$\nimport sys\nfrom distutils.core import setup\n\...
python
chosen
[ { "from": "system", "value": "Call to create_user fails because django-social-auth module requires 5 parameters now for create_user now.\n\nThe exception is quietly suppressed in social_auth/backends/__init__.py:143 in the pipeline\nstage for this module since TypeErrors in general are try/except in the aut...
python
chosen
[ { "from": "system", "value": "Update test to check more internals\n" }, { "from": "human", "value": "import pytest\n\n\ndef test_basic_import():\n import foyer\n assert 'forcefields' in dir(foyer)\n import foyer.forcefields.forcefields\n" }, { "from": "gpt", "value": "import...
python
chosen
[ { "from": "system", "value": "Remove some unused parts of skeleton\n" }, { "from": "human", "value": "from skvideo.stuff import *\nfrom skvideo.version import __version__\n\n# If you want to use Numpy's testing framerwork, use the following.\n# Tests go under directory tests/, benchmarks under d...
python
chosen
[ { "from": "system", "value": "Add \"AnyOf\" to public API.\n" }, { "from": "human", "value": "from .compiler import ParseResult\n\nfrom .expressions import (\n Alt,\n And,\n Any,\n Backtrack,\n Bind,\n End,\n Expect,\n Fail,\n ForwardRef,\n Left,\n List,\n Lit...
python
chosen
[ { "from": "system", "value": "Fix off-by-1 bug for `mid`\n\n- in SPOJ palin\n\nSigned-off-by: Karel Ha <70f8965fdfb04f1fc0e708a55d9e822c449f57d3@gmail.com>\n" }, { "from": "human", "value": "#!/usr/bin/env python3\ndef next_palindrome(k):\n\tpalin = list(k)\n\tn = len(k)\n\tmid = n // 2\n\t\n\t#...
python
chosen
[ { "from": "system", "value": "Add route for `trivial` (vacuous) command\n" }, { "from": "human", "value": "from aiohttp import web\n\nfrom . import __version__\n\n\nclass Server:\n def __init__(self, host='127.0.0.1', port=8080):\n self._host = host\n self._port = port\n ...
python
chosen
[ { "from": "system", "value": "Add an example for building and printing the index.\n\nYou can find the example inside the CrawlerExample.py.\n" }, { "from": "human", "value": "__author__ = 'pascal'\n\nfrom crawler.Crawler import Crawler\nfrom utils.path import RessourceUtil\n\n# _____ ...
python
chosen
[ { "from": "system", "value": "Split compiler and execution steps\n" }, { "from": "human", "value": "import os\n\nfrom thinglang import utils\nfrom thinglang.execution.execution import ExecutionEngine\nfrom thinglang.lexer.lexer import lexer\nfrom thinglang.parser.analyzer import Analyzer\nfrom t...
python
chosen
[ { "from": "system", "value": "Make path variable working for server side\n" }, { "from": "human", "value": "import feedparser\nimport pickle\nimport requests\n\nhub = \"http://feeds.feedburner.com/ampparit-politiikka\" ## collect from ampparit all politics related sites\n\nfeed = feedparser.pars...
python
chosen
[ { "from": "system", "value": "Add the use of task to the example app\n\n" }, { "from": "human", "value": "import time\n\nfrom dj_experiment.tasks.tasks import longtime_add\n\nif __name__ == '__main__':\n result = longtime_add.delay(1, 2)\n # at this time, our task is not finished, so it wi...
python
chosen
[ { "from": "system", "value": "Fix datetime usage in memorize model\n" }, { "from": "human", "value": "from datetime import datetime, timedelta\nimport datetime\nfrom django.utils.timezone import utc\n\nfrom django.db import models\nfrom django.contrib.auth.models import User\nfrom django.contrib...
python
chosen
[ { "from": "system", "value": "Make test suite pass when there are no tests\n" }, { "from": "human", "value": "from pathlib import Path\nimport shutil\nfrom subprocess import call\n\nfrom django.core.management.base import BaseCommand\nfrom django.core.management import call_command\nfrom django....
python
chosen
[ { "from": "system", "value": "Remove handling of apps tuple, it is always list now\n\nSince Django 1.11, app settings are lists by default\n" }, { "from": "human", "value": "from .settings import * # NOQA\n\n\n# Django 1.8 still has INSTALLED_APPS as a tuple\nINSTALLED_APPS = list(INSTALLED_APP...
python
chosen
[ { "from": "system", "value": "Update login task to get username from settings\n" }, { "from": "human", "value": "import requests\n\nfrom django.conf import settings\nfrom celery.task import Task\nfrom celery.utils.log import get_task_logger\n\nfrom .models import Account\n\nlogger = get_task_log...
python
chosen
[ { "from": "system", "value": "Allow overriding database and mail_debug settings\n\nUsing environment variables to override default database connection\nand mail_debug settings in development mode. This allows setting\nthe values needed by the Docker environment.\n" }, { "from": "human", "value":...
python
chosen
[ { "from": "system", "value": "Remove invalid migration script: it has been superceded by 0052_limit_components\n" }, { "from": "human", "value": "from django.db import migrations\n\nTENANT_TYPE = 'Packages.Template'\nLIMIT = 'limit'\n\n\ndef process_components(apps, schema_editor):\n Offering...
python
chosen
[ { "from": "system", "value": "Test getting invoice by code\n" }, { "from": "human", "value": "# -*- coding: utf-8 -*-\nimport os\nimport pytest\nimport holviapi\n\n@pytest.fixture\ndef connection():\n pool = os.environ.get('HOLVI_POOL', None)\n key = os.environ.get('HOLVI_KEY', None)\n ...
python
chosen
[ { "from": "system", "value": "Add UniformDH unit test to test for invalid HMACs.\n" }, { "from": "human", "value": "#!/usr/bin/env python\n# -*- coding: utf-8 -*-\n\nimport unittest\n\nimport const\nimport uniformdh\n\nimport obfsproxy.network.buffer as obfs_buf\n\nclass UniformDHTest( unittest....
python
chosen
[ { "from": "system", "value": "Handle ctrl-c and ctrl-d properly\n" }, { "from": "human", "value": "#!/usr/bin/env python3\n\nimport os\nimport shutil\nimport sys\nimport readline\nimport traceback\n\nreadline.parse_and_bind('tab: complete')\nreadline.parse_and_bind('set editing-mode vi')\nbuilti...
python
chosen
[ { "from": "system", "value": "Fix some things in evidence sources\n" }, { "from": "human", "value": "from util import pklload\nfrom collections import defaultdict\nimport indra.tools.assemble_corpus as ac\n\n\nif __name__ == '__main__':\n # Load cached Statements just before going into the mo...
python
chosen
[ { "from": "system", "value": "Make it possible to run this test stand-alone.\n" }, { "from": "human", "value": "# Test the frozen module defined in frozen.c.\nfrom __future__ import with_statement\n\nfrom test.test_support import captured_stdout, run_unittest\nimport unittest\nimport sys, os\n\n...
python
chosen
[ { "from": "system", "value": "Check that python-sqlite2 is installed\n\n\n\ngit-svn-id: ad91b9aa7ba7638d69f912c9f5d012e3326e9f74@147 3942dd89-8c5d-46d7-aeed-044bccf3e60c\n" }, { "from": "human", "value": "from pysqlite2 import dbapi2 as sqlite\nimport sys, os.path\n\nclass Statistics:\n def _...
python
chosen
[ { "from": "system", "value": "Adjust to current serialization conditions\n\n+ blp -> tsv\n" }, { "from": "human", "value": "# Third-party modules\nimport numpy as np\nimport pandas as pd\nfrom sklearn.model_selection import KFold\n# Hand-made modules\nfrom .base import BloscpackMixin\n\nKWARGS_R...
python
chosen
[ { "from": "system", "value": "Correct the Object service after rename of object_service.py file to object.py\n" }, { "from": "human", "value": "import os\n\n# Database configurations.\nDB_HOST = os.environ.get('OBJECTCUBE_DB_HOST', 'localhost')\nDB_USER = os.environ.get('OBJECTCUBE_DB_USER', os....
python
chosen
[ { "from": "system", "value": "Put useless module function into docstring\n" }, { "from": "human", "value": "\"\"\"Test plugin.\"\"\"\n\n\ndef load(*args, **kwargs):\n pass\n\n\ndef dump(*args, **kwargs):\n pass\n\n\ndef plugin():\n import sys\n return (__name__.split('.')[-1], sys.mo...
python
chosen
[ { "from": "system", "value": "Replace deprecated yield_fixture with fixture\n\nCommitted via https://github.com/asottile/all-repos\n" }, { "from": "human", "value": "# -*- coding: utf-8 -*-\nimport pytest\n\nfrom cheetah_lint import five\n\n\n@pytest.yield_fixture(autouse=True)\ndef no_warnings(...
python
chosen
[ { "from": "system", "value": "Test for error if not a postcode.\n" }, { "from": "human", "value": "\"\"\"\nIntegration-style tests for binalerts. These tests think of things from the web\nfrontend point of view. They are designed to make sure the application behaves\nas required to the user.\n\"...
python
chosen
[ { "from": "system", "value": "Upgrade version from 1.0.6 to 1.0.7\n" }, { "from": "human", "value": "\"\"\"\nSkCode (Python implementation of BBcode syntax) parser library.\n\"\"\"\n\n# Package information\n__author__ = \"Fabien Batteix (@skywodd)\"\n__copyright__ = \"Copyright 2015, TamiaLab\"\...
python
chosen
[ { "from": "system", "value": "Revert \"fix(ingest) - disable expired content removal\"\n\nThis reverts commit 281e051344c9fe8e835941117e2d2068ecdabd87.\n" }, { "from": "human", "value": "\"\"\"Superdesk IO\"\"\"\nfrom abc import ABCMeta, abstractmethod\nimport superdesk\nimport logging\n\nfrom s...
python
chosen
[ { "from": "system", "value": "Add more tests for ACF format\n" }, { "from": "human", "value": "import pytest\nfrom steamfiles import acf\n\n\n@pytest.yield_fixture\ndef acf_data():\n with open('tests/test_data/appmanifest_202970.acf', 'rt') as f:\n yield f.read()\n\n\n@pytest.mark.usef...
python
chosen
[ { "from": "system", "value": "Encrypt all provided GET parameters\n" }, { "from": "human", "value": "from django.conf import settings\nfrom django.views.generic import FormView\n\nfrom .crypto import Parchment\nfrom .forms import ParchmentForm\n\n\nclass ParchmentView(FormView):\n form_class ...
python
chosen
[ { "from": "system", "value": "Add /tours endpoint with dummy data\n" }, { "from": "human", "value": "import flask\n\napp = flask.Flask(__name__)\n\n@app.route('/')\ndef index():\n\treturn flask.jsonify(hello='world')\n\nif __name__ == '__main__':\n\tapp.run(debug=True)\n" }, { "from": "g...
python
chosen
[ { "from": "system", "value": "Refactor run_from_ipython() implementation to make it pass static code analysis test\n" }, { "from": "human", "value": "# -*- coding: utf-8 -*-\n\nimport six\n\nfrom formats import FormatBank, discover_json, discover_yaml\n\n\nformats = FormatBank()\n\ndiscover_json...
python
chosen
[ { "from": "system", "value": "Clone repository to playbooks directory\n" }, { "from": "human", "value": "from django.db import models\nimport git, os\n\nclass Github (models.Model):\n username = models.CharField(max_length=39)\n repository = models.CharField(max_length=100)\n\n def __st...
python
chosen
[ { "from": "system", "value": "Remove reference to now-deleted SettingSchema\n" }, { "from": "human", "value": "import json\n\nimport falcon\n\nimport models\nimport schemas\nimport api_util\n\n\nsettings_schema = schemas.SettingSchema(many=True)\nsetting_schema = schemas.SettingSchema()\n\n\ncla...
python
chosen
[ { "from": "system", "value": "Disable querystring auth for s3\n" }, { "from": "human", "value": "from default_settings import *\n\nimport dj_database_url\n\nDATABASES = {\n 'default': dj_database_url.config(),\n}\n\nSECRET_KEY = os.environ['SECRET_KEY']\n\nSTATICFILES_STORAGE = 's3storage.S3H...
python
chosen
[ { "from": "system", "value": "Fix app minification script on non-Windows systems\n" }, { "from": "human", "value": "# Python 3\n\nimport glob\nimport os\n\nuglifyjs = os.path.abspath(\"../lib/uglifyjs\")\ninput_dir = os.path.abspath(\"./Resources/Tracker/scripts\")\noutput_dir = os.path.abspath(...
python
chosen
[ { "from": "system", "value": "Fix variable names in model.\n" }, { "from": "human", "value": "from app import db\n\n\nclass User(db.Model):\n __tablename__ = 'users'\n\n username = db.Column(db.String(64), nullable=False, unique=True, primary_key=True)\n password = db.Column(db.String(...
python
chosen