conversations
listlengths
2
3
source
stringclasses
1 value
stack
stringclasses
1 value
[ { "from": "system", "value": "Read mail settings from config.\n" }, { "from": "human", "value": "import os\nimport sys\nimport web\nimport yaml\nfrom . import default_settings\n\n\ndef load_default_config():\n # take all vars defined in default_config\n config = dict((k, v) for k, v in def...
python
chosen
[ { "from": "system", "value": "Add match and case insensitive methods\n" }, { "from": "human", "value": "def display_usage():\n return 'Usage: python rgrep [options] pattern files\\nThe options are the '\\\n 'same as grep\\n'\n\n\ndef rgrep(pattern='', text='', case='', count=False, ...
python
chosen
[ { "from": "system", "value": "Allow arg to specify spawning type" }, { "from": "human", "value": "import os\nimport multiprocessing\nimport threading\n\nclass Sponsor(object):\n\n def __init__(self):\n print('Sponsor pid: {}'.format(os.getpid()))\n\n def create(self, behavior):\n ...
python
chosen
[ { "from": "system", "value": "Fix __all__ on module entry point\n" }, { "from": "human", "value": "# -*- coding: utf-8 -*-\n\"\"\"\n breakers\n ~~~~~\n Breakers is a simple python package that implements the circuit breaker\n pattern.\n :copyright: (c) 2015 by Marcus Martins.\n ...
python
chosen
[ { "from": "system", "value": "Use double quotes for strings\n" }, { "from": "human", "value": "# -*- coding: utf-8 -*-\n\nimport django\n\nDEBUG = False\nUSE_TZ = True\nDATABASES = {\n \"default\": {\n \"ENGINE\": \"django.db.backends.sqlite3\",\n }\n}\nINSTALLED_APPS = [\n \"eas...
python
chosen
[ { "from": "system", "value": "Fix 'cant import from .postgresql'\n" }, { "from": "human", "value": "###################################################################\n#\n# Copyright (c) 2013 Miing.org <samuel.miing@gmail.com>\n# \n# This software is licensed under the GNU Affero General Public...
python
chosen
[ { "from": "system", "value": "Increase character limit for pages\n\nCloses #70." }, { "from": "human", "value": "from django.db import models\n\nclass Page(models.Model):\n\tdef __str__(self):\n\t\treturn self.name\n\n\tname = models.CharField(max_length=64, blank=False)\n\tname.help_text='Inter...
python
chosen
[ { "from": "system", "value": "Add controls for storage size\n" }, { "from": "human", "value": "config = {\n \"CREATE_RETRIES\": 5,\n \"CHUNK_LOCK_TIMEOUT_SECONDS\": 10,\n \"WORKER_TIMEOUT_SECONDS\": 15\n}\n" }, { "from": "gpt", "value": "config = {\n \"CREATE_RETRIES\": 5...
python
chosen
[ { "from": "system", "value": "Remove not used app config.\n" }, { "from": "human", "value": "# Create your models here.\nfrom models_obj_rel import *\nfrom models_ufs_obj import *\n\n\n\ntry:\n # apps.py\n from django.apps import AppConfig\n try:\n import tagging\n\n taggi...
python
chosen
[ { "from": "system", "value": "Implement place class and homes generation\n\nThe Place class for places of interest has been implemented, as well as\nthe generation of homes, which is different from the generation of other\nplaces of interest.\n" }, { "from": "human", "value": "\"\"\"\nPlaces of ...
python
chosen
[ { "from": "system", "value": "Add integration test decorator to prevent certain tests running unless we really want them to.\n" }, { "from": "human", "value": "from functools import wraps\nfrom nose.plugins.attrib import attr\nfrom nose.plugins.skip import SkipTest\n\n__all__ = ['wip']\n\ndef fa...
python
chosen
[ { "from": "system", "value": "Buildbot: Add a scheduler for the master branch to run\n" }, { "from": "human", "value": "\"\"\"\nThis module contains the logic which returns the set of\nschedulers to use for the build master.\n\"\"\"\n\ndef get_schedulers():\n return []\n" }, { "from":...
python
chosen
[ { "from": "system", "value": "Switch to Flask, add oauth\n" }, { "from": "human", "value": "#!/usr/bin/env python\n\nimport cherrypy\nfrom jinja2 import Environment, FileSystemLoader\n\nj2_env = Environment(loader = FileSystemLoader('templates'))\n\nclass Root(object):\n\t@cherrypy.expose\n\tdef...
python
chosen
[ { "from": "system", "value": "Allow broker to be overridden\n" }, { "from": "human", "value": "from celery import Celery\nfrom cesium import _patch_celery\n\ncelery_config = {\n 'CELERY_ACCEPT_CONTENT': ['pickle'],\n 'CELERY_IMPORTS': ['cesium', 'cesium._patch_celery', 'cesium.celery_tasks...
python
chosen
[ { "from": "system", "value": "Make run_tests run all tests if no arguments are provided.\n" }, { "from": "human", "value": "#\n# For the license of this file, please consult the LICENSE file in the\n# root directory of this distribution.\n#\n\n# All tests in the test suite.\n__all__ = ( \"bitfie...
python
chosen
[ { "from": "system", "value": "Fix bug where there was an empty report\n" }, { "from": "human", "value": "from jinja2 import Environment, PackageLoader\nfrom qanta import qlogging\n\n\nlog = qlogging.get(__name__)\n\n\nclass ReportGenerator:\n def __init__(self, template):\n self.templa...
python
chosen
[ { "from": "system", "value": "Add attribute to choices field declaration\n" }, { "from": "human", "value": "\nfrom nap import models, fields, api, serialiser, publisher\n\nfrom .models import Choice, Poll\n\n\nclass ChoiceSerialiser(models.ModelSerialiser):\n\n class Meta:\n model = Ch...
python
chosen
[ { "from": "system", "value": "Use a filesystem db and add the sites app to fix a test failure.\n" }, { "from": "human", "value": "# -*- coding: utf-8 -*-\nDATABASES = {\n 'default': {\n 'ENGINE': 'django.db.backends.sqlite3',\n 'NAME': ':memory:',\n }\n}\n\nINSTALLED_APPS = [...
python
chosen
[ { "from": "system", "value": "Fix AttributeError when supplying email address as user\n" }, { "from": "human", "value": "import logging\n\nfrom django.core import mail\n\nfrom .tasks import task_email_user\n\nlogger = logging.getLogger(__name__)\n\n\ndef send_email(user, template, context, attac...
python
chosen
[ { "from": "system", "value": "Add test to __all__ in package, bump version to 0.4.1\n" }, { "from": "human", "value": "\"\"\"\ndistutilazy\n-----------\n\nExtra distutils command classes.\n\n:license: MIT, see LICENSE for more details.\n\"\"\"\n\n__version__ = \"0.4.0\"\n__all__ = (\"clean\", \"...
python
chosen
[ { "from": "system", "value": "Prepare for PyCon Belarus 2018\n" }, { "from": "human", "value": "# -*- coding: utf-8 -*-\n\n\"\"\"\n Eve Demo\n ~~~~~~~~\n\n A demostration of a simple API powered by Eve REST API.\n\n The live demo is available at eve-demo.herokuapp.com. Please keep in...
python
chosen
[ { "from": "system", "value": "Return distance from sump pump sensor\n" }, { "from": "human", "value": "import time\nfrom periphery import GPIO\nfrom piot.sensor.base import BaseAnalogSensor\n\nclass SumpPump(BaseAnalogSensor):\n def __init__(self):\n self.min_normal=30\n self.ma...
python
chosen
[ { "from": "system", "value": "Adjust for renamed CSV class\n" }, { "from": "human", "value": "\nfrom django.http import StreamingHttpResponse\nfrom django.utils.encoding import force_text\n\nfrom .models import modelserialiser_factory\nfrom .simplecsv import CSV\n\n\nclass ExportCsv(object):\n ...
python
chosen
[ { "from": "system", "value": "Send individual mails, to avoid showing the whole to list, BCC and spamholing from Google\n" }, { "from": "human", "value": "from django.conf import settings\nfrom django.core.mail import EmailMultiAlternatives\nfrom django.template.loader import get_template\nfrom ...
python
chosen
[ { "from": "system", "value": "Add new files to common io tests\n" }, { "from": "human", "value": "\"\"\"\nTests of neo.io.axonaio\n\"\"\"\n\nimport unittest\n\nfrom neo.io.axonaio import AxonaIO\nfrom neo.test.iotest.common_io_test import BaseTestIO\nfrom neo.io.proxyobjects import (AnalogSignal...
python
chosen
[ { "from": "system", "value": "Change current date in SQLite query to tuple\n" }, { "from": "human", "value": "import sqlite3\nimport csv\nfrom datetime import datetime\n\n\ncurrent_date = datetime.now().strftime('%Y-%m-%d')\n\ndestination_file = 'srvy' + current_date + '.csv'\nsqlite_file = 'srv...
python
chosen
[ { "from": "system", "value": "Refactor common items to more generic methods.\n\n* Refactor code that can be used in more than one place to a more\n generic method/function that's called by other methods\n" }, { "from": "human", "value": "es = None\ntry:\n from elasticsearch import Elasticsea...
python
chosen
[ { "from": "system", "value": "ref: Simplify query plan for repo tests\n" }, { "from": "human", "value": "from datetime import timedelta\nfrom sqlalchemy.sql import func\n\nfrom zeus.config import db\nfrom zeus.constants import Result, Status\nfrom zeus.models import Repository, TestCase, Job\nfr...
python
chosen
[ { "from": "system", "value": "Switch to flat sections to avoid double including subsections\n" }, { "from": "human", "value": "import mwparserfromhell as mwp\nfrom . import IndentTree\nfrom . import WikiComments as wc\n\nclass Page:\n def __init__(self):\n self.indent = -2\n\n def _...
python
chosen
[ { "from": "system", "value": "Add status to the daemon\n" }, { "from": "human", "value": "import time\nimport transaction\nfrom taskq import models\nfrom daemon import runner\n\n\nclass TaskRunner():\n\n def __init__(self):\n self.stdin_path = '/dev/null'\n self.stdout_path = '/...
python
chosen
[ { "from": "system", "value": "Fix failing API gen test\n" }, { "from": "human", "value": "import unittest\nfrom tools import generate_api_config\n\n\nclass TestAPIGen(unittest.TestCase):\n\n @classmethod\n def setUpClass(cls):\n from falafel.mappers import * # noqa\n pass\n\...
python
chosen
[ { "from": "system", "value": "Add ts statistics to the tests module.\n" }, { "from": "human", "value": "\n__author__ = 'To\\xc3\\xb1o G. Quintela (tgq.spm@gmail.com)'\n__version__ = '0.0.0'\n\n#from pyCausality.TimeSeries.TS import *\n\n\n#from pyCausality.TimeSeries.automatic_thresholding impor...
python
chosen
[ { "from": "system", "value": "Add tests for login oauth links\n" }, { "from": "human", "value": "# coding: utf-8\n\nfrom findaconf import app, db\nfrom findaconf.tests.config import set_app, unset_app\nfrom unittest import TestCase\n\n\nclass TestSiteRoutes(TestCase):\n\n def setUp(self):\n ...
python
chosen
[ { "from": "system", "value": "Make run_test output less verbose\n" }, { "from": "human", "value": "\"\"\"This module uses unittest TestLoader to run tests\"\"\"\nimport sys\nimport unittest\n\nif __name__ == '__main__':\n sys.dont_write_bytecode = True\n SUITE = unittest.TestLoader().disco...
python
chosen
[ { "from": "system", "value": "Change trans app label core models to CMS name\n" }, { "from": "human", "value": "# -*- coding: utf-8 -*-\nfrom django.utils.translation import ugettext_lazy as _\ntrans_app_label = _('Core')\n" }, { "from": "gpt", "value": "# -*- coding: utf-8 -*-\nfrom...
python
chosen
[ { "from": "system", "value": "Add stub methods for map handling\n" }, { "from": "human", "value": "\"\"\"This module provides views for application.\"\"\"\nfrom tof_server import app, versioning, mysql\nfrom flask import jsonify, make_response\nimport string, random\n\n@app.route('/')\ndef index...
python
chosen
[ { "from": "system", "value": "Update the pipeline to take into account the outlier rejection method to compute the RPP\n" }, { "from": "human", "value": "import sys\nimport os\nimport numpy as np\n\nfrom skcycling.utils import load_power_from_fit\nfrom skcycling.power_profile import Rpp\n\n# The...
python
chosen
[ { "from": "system", "value": "Add support for decoding data serialized as BSON.\n" }, { "from": "human", "value": "\nimport json\nfrom bson import json_util\n\nfrom flask.wrappers import Request, cached_property\n\ndef getBoolean(string):\n if string is None:\n return False\n return...
python
chosen
[ { "from": "system", "value": "Add wrapper methods for clarity.\n" }, { "from": "human", "value": "from ._abstract import AbstractScraper\n\n\"\"\"\n Note that innit hosts recipes for several companies. I found it while looking at centralmarket.com\n\"\"\"\n\n\nclass Innit(AbstractScraper):\n...
python
chosen
[ { "from": "system", "value": "Add option to turn on queue auto delete\n" }, { "from": "human", "value": "#!/usr/bin/env python\n\n\"\"\"Integration test base class and utils\"\"\"\n\nfrom contextlib import contextmanager\nimport unittest\n\nfrom pyon.container.cc import Container\nfrom pyon.core...
python
chosen
[ { "from": "system", "value": "Test fuer WAV write und read gleichheit\n" }, { "from": "human", "value": "import scipy.io.wavfile as wav\nimport numpy\nimport warnings\n\ndef wavread(filename):\n\twith warnings.catch_warnings():\n\t\twarnings.simplefilter(\"ignore\")\n\t\tfs,x = wav.read(filename...
python
chosen
[ { "from": "system", "value": "Update vigenereDicitonaryHacker: added full path to dictionary file\n" }, { "from": "human", "value": "# Vigenère Cipher Dictionary Hacker\n# https://www.nostarch.com/crackingcodes/ (BSD Licensed)\n\nfrom books.CrackingCodesWithPython.pyperclip import copy\nfrom boo...
python
chosen
[ { "from": "system", "value": "bpo-41003: Fix test_copyreg when numpy is installed (GH-20935)\n\nFix test_copyreg when numpy is installed: test.pickletester now\r\nsaves/restores warnings.filters when importing numpy, to ignore\r\nfilters installed by numpy.\r\n\r\nAdd the save_restore_warnings_filters() fun...
python
chosen
[ { "from": "system", "value": "[SW-1610][FollowUp] Fix running python tests by changing the env directly\n\n(cherry picked from commit 0d808a100cd14fce9d4fba4f9cde6ad5315fbc12)\n" }, { "from": "human", "value": "#\n# Licensed to the Apache Software Foundation (ASF) under one or more\n# contributo...
python
chosen
[ { "from": "system", "value": "Fix in Blog Category Naming\n" }, { "from": "human", "value": "# Copyright (c) 2013, Web Notes Technologies Pvt. Ltd. and Contributors\n# MIT License. See license.txt\n\nfrom __future__ import unicode_literals\nimport webnotes\nfrom webnotes.webutils import WebsiteG...
python
chosen
[ { "from": "system", "value": "Add logging to email daemon\n" }, { "from": "human", "value": "#!/usr/bin/env python\n# This Source Code Form is subject to the terms of the Mozilla Public License,\n# v. 2.0. If a copy of the MPL was not distributed with this file, You can\n# obtain one at http://m...
python
chosen
[ { "from": "system", "value": "Fix @DaVinci789's crappy spelling >:)\n" }, { "from": "human", "value": "import os\n\nvowels = ['a e i o u']\nconstanents = ['b c d f g h j k l m n p q r s t v w x y z 1 2 3 4 \\\n 5 6 7 8 9 0']\n\n\ndef inInventory(itemClass, player):\n for item i...
python
chosen
[ { "from": "system", "value": "Fix deprecation re url patterns\n" }, { "from": "human", "value": "from django.conf.urls import include, url\nfrom django.contrib import admin\n\n\nurlpatterns = [\n url(r'^admin/', include(admin.site.urls)),\n\n url(r'^flickr/', include('ditto.flickr.urls', n...
python
chosen
[ { "from": "system", "value": "Fix swappable model in signature export\n" }, { "from": "human", "value": "from import_export import resources\nfrom .models import Signature\n\n\nclass SignatureResource(resources.ModelResource):\n class Meta:\n exclude = ('created_on', 'modified_on')\n ...
python
chosen
[ { "from": "system", "value": "Implement GenerateCover using fake vars\n" }, { "from": "human", "value": "#Set Cover=Cover\n#Set BookCover=%BookName%%Cover%\n#Set BookCoverHTML=%BookCover%%HTMLExt%\n#Call pandoc ..\\source\\%BookCover%%BookExt% -o %BookCoverHTML% --standalone %CSS_%%Cover%%CSSExt...
python
chosen
[ { "from": "system", "value": "Update to next dev version" }, { "from": "human", "value": "from __future__ import absolute_import\nimport deployer.logger\nfrom celery.signals import setup_logging\n\n\n__version__ = '0.5.0'\n__author__ = 'sukrit'\n\ndeployer.logger.init_logging()\nsetup_logging.co...
python
chosen
[ { "from": "system", "value": "Use correct latest commit in __version__ endpoint\n" }, { "from": "human", "value": "#!/usr/bin/env python\n\nimport time\nnow = time.time()\nformatted = time.strftime(\"%B %d, %Y %H:%M:%S UTC\", time.gmtime())\n\nprint 'exports.string = %r' % formatted\n# Note Java...
python
chosen
[ { "from": "system", "value": "Remove category serializer from subcategory serializer\n" }, { "from": "human", "value": "from categories.models import Category, Keyword, Subcategory\nfrom rest_framework import serializers\n\n\nclass SubcategoryListSerializer(serializers.ModelSerializer):\n cla...
python
chosen
[ { "from": "system", "value": "Fix Python dataType Annotation [skip travis]\n\nFix in python dataType for Annotation [skip travis]" }, { "from": "human", "value": "from pyspark.sql.types import *\n\n\nclass Annotation:\n\n def __init__(self, annotator_type, begin, end, result, metadata, embedd...
python
chosen
[ { "from": "system", "value": "Fix /media/ redirects on devstack\n" }, { "from": "human", "value": "\"\"\"\nSettings for Appsembler on devstack/LMS.\n\"\"\"\nfrom os import path\n\nfrom openedx.core.djangoapps.appsembler.settings.settings import devstack_common\n\n\ndef plugin_settings(settings):...
python
chosen
[ { "from": "system", "value": "Complete Overhaul. Argeparse used. Outputs to csv\n" }, { "from": "human", "value": "from os import getenv\nimport sqlite3\nimport win32crypt\ncsv_file = open(\"chromepass.csv\",'wb')\ncsv_file.write(\"link,username,password\\n\".encode('utf-8'))\nappdata = getenv(\...
python
chosen
[ { "from": "system", "value": "Fix airflow.utils deprecation warning code being Python 3 incompatible\n\nSee https://docs.python.org/3.0/whatsnew/3.0.html#operators-and-special-methods\n" }, { "from": "human", "value": "# -*- coding: utf-8 -*-\n#\n# Licensed under the Apache License, Version 2.0 ...
python
chosen
[ { "from": "system", "value": "Remove superfluous 'is True' from the assert.\n" }, { "from": "human", "value": "\"\"\"\n.. module:: config_parser\n :platform: linux\n :synopsis: Module to test the bunch YAML configuration parser.\n\n.. moduleauthor:: Paul Fanelli <paul.fanelli@gmail.com>\n\n....
python
chosen
[ { "from": "system", "value": "Remove yammer api key that was accidentally committed\n" }, { "from": "human", "value": "from .base import *\n\nDEBUG = True\n\ntry:\n\tfrom .local import *\nexcept ImportError:\n\tpass\n\nSOCIAL_AUTH_YAMMER_KEY = 'OCnfR7VJNBbcSS8GXMCi3A'\nSOCIAL_AUTH_YAMMER_SECRET ...
python
chosen
[ { "from": "system", "value": "Fix bad path for mesh-reverse.db\n" }, { "from": "human", "value": "import logging, interfaces, os, IPy\nfrom StringIO import StringIO\n\nclass Shorewall(interfaces.IOpenMesherPlugin):\n def __init__(self):\n self._files = {}\n \n def process(self, m...
python
chosen
[ { "from": "system", "value": "Add Odoo Community Association (OCA) as author" }, { "from": "human", "value": "# -*- coding: utf-8 -*-\n##############################################################################\n#\n# Author Vincent Renaville\n# Copyright 2015 Camptocamp SA\n#\n# This...
python
chosen
[ { "from": "system", "value": "Set up basic imagerprofile and made first migration\n" }, { "from": "human", "value": "from django.db import models\n\n# Create your models here.\n" }, { "from": "gpt", "value": "\"\"\"Establish models for the imager site's User Profile.\"\"\"\nfrom djan...
python
chosen
[ { "from": "system", "value": "Mark broken pipe test with expected failure\n" }, { "from": "human", "value": "# Copyright 2012 Dietrich Epp <depp@zdome.net>\n# See LICENSE.txt for details.\n\n@test\ndef nostdin_1():\n check_output(['./nostdin'], 'Test', '')\n\n@test(fail=True)\ndef nostdin_2_f...
python
chosen
[ { "from": "system", "value": "Drop content type in migration as well\n" }, { "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 ('oaut...
python
chosen
[ { "from": "system", "value": "Kill multiple chains at once.\n" }, { "from": "human", "value": "import subprocess\nimport sys\nimport getpass\n\n### Kill a job and its chain of dependents (as created by sbatch_submit). ...
python
chosen
[ { "from": "system", "value": "Add extra line to separate functions\n" }, { "from": "human", "value": "import json\n\nfrom django.shortcuts import render\nfrom django.http import HttpResponse\nfrom source.forms.search_form import SearchForm\nfrom source.controllers.cater_controller import CaterCo...
python
chosen
[ { "from": "system", "value": "Fix LinearMean bias when bias=False\n" }, { "from": "human", "value": "#!/usr/bin/env python3\n\nimport torch\nfrom .mean import Mean\n\n\nclass LinearMean(Mean):\n def __init__(self, input_size, batch_shape=torch.Size(), bias=True):\n super().__init__()\n...
python
chosen
[ { "from": "system", "value": "Add new arg in message_handled signal definition\n" }, { "from": "human", "value": "from django.dispatch import Signal\n\nmessage_handled = Signal(providing_args=['message', 'instance', 'new_revision'])\n" }, { "from": "gpt", "value": "from django.dispat...
python
chosen
[ { "from": "system", "value": "Fix typoe items vs items()\n" }, { "from": "human", "value": "import time, gevent\n\nseen = None\n\ndef used(url, http_pool):\n __patch()\n seen[(url, http_pool)] = time.time()\n \ndef __patch():\n global seen\n if seen is None:\n seen = {}\n ...
python
chosen
[ { "from": "system", "value": "Add annotation required for mypy\n" }, { "from": "human", "value": "class RedisCleanupMixin(object):\n client = None\n prefix = None\n\n def setUp(self):\n super(RedisCleanupMixin, self).setUp()\n self.assertIsNotNone(self.client, \"Need a red...
python
chosen
[ { "from": "system", "value": "Remove the installed kcm binary after int tests.\n" }, { "from": "human", "value": "from . import integration\nimport os\nimport tempfile\n\n\ndef test_kcm_install():\n # Install kcm to a temporary directory.\n install_dir = tempfile.mkdtemp()\n integration...
python
chosen
[ { "from": "system", "value": "Add the shard ID to the command log\n" }, { "from": "human", "value": "import logging\n\n\nclass CommandLog:\n \"\"\"A simple cog to log commands executed.\"\"\"\n def __init__(self):\n self.log = logging.getLogger('liara.command_log')\n\n async def ...
python
chosen
[ { "from": "system", "value": "Improve test coverage of externals.\n" }, { "from": "human", "value": "from django.test import TestCase\n\nfrom ..externals import External\n\ntry:\n from contextlib import GeneratorContextManager\nexcept ImportError:\n from contextlib import _GeneratorContext...
python
chosen
[ { "from": "system", "value": "Make comparison of dates more explicit\n" }, { "from": "human", "value": "from functools import cmp_to_key\n\nfrom django import template\n\nfrom adhocracy4.modules.models import Module\nfrom adhocracy4.phases.models import Phase\nfrom meinberlin.apps.offlineevents....
python
chosen
[ { "from": "system", "value": "Fix __version__ missing for setuptools\n" }, { "from": "human", "value": "# Copyright (c) 2013 Facebook\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 co...
python
chosen
[ { "from": "system", "value": "Fix logging for system commands in CI\n" }, { "from": "human", "value": "''' Provide common utils to validators '''\nimport subprocess\nimport sys\n\n# Run cli command. By default, exit when an error occurs\ndef run_cli_cmd(cmd, exit_on_fail=True):\n '''Run a com...
python
chosen
[ { "from": "system", "value": "Use HTTP_X_REAL_IP to determine client ip address\n" }, { "from": "human", "value": "# -*- coding: utf-8 -*-\nimport logging\n\nfrom flask import Blueprint, render_template, request, send_from_directory, current_app\n\nfrom ..webapp import db\nfrom ..action import e...
python
chosen
[ { "from": "system", "value": "Use form variable instead hard-coding\n" }, { "from": "human", "value": "from .utils import SESSION_KEY_CURRENT_OS\nfrom .forms import OSForm\n\n\nclass CurrentOSMixin(object):\n\n allowed_oses = OSForm.OS_CHOICES\n\n def get_context_data(self, **kwargs):\n ...
python
chosen
[ { "from": "system", "value": "Add logging to icds reports task\n" }, { "from": "human", "value": "import os\n\nfrom celery.schedules import crontab\nfrom celery.task import periodic_task\nfrom django.conf import settings\n\nfrom django.db import connections\n\n\n@periodic_task(run_every=crontab(...
python
chosen
[ { "from": "system", "value": "Add docstring to Post class\n" }, { "from": "human", "value": "\"\"\"\npyblogit.posts\n~~~~~~~~~~~~~~\n\nThis module contains the data model to represent blog posts and methods\nto manipulate it.\n\"\"\"\n\nclass post(object):\n\n def __init__(self, post_id, titl...
python
chosen
[ { "from": "system", "value": "Use runghc instead of executables\n" }, { "from": "human", "value": "import subprocess\nimport unittest\nimport glob\n\ndef runTestcase(self, input_file, result_file):\n spillProg = subprocess.Popen(['./spill', input_file],stdout=subprocess.PIPE)\n idProg = su...
python
chosen
[ { "from": "system", "value": "Set config contained a bug after refactoring\n" }, { "from": "human", "value": "import argparse\nimport logging.config\nimport os\nfrom intexration import settings\nfrom intexration.server import Server\n\n# Logger\nlogging.config.fileConfig(settings.LOGGING_FILE)\n...
python
chosen
[ { "from": "system", "value": "Fix up import optional test to use temporary compiled file\n" }, { "from": "human", "value": "#!/usr/bin/env python3\n\nimport os\nimport subprocess\nimport sys\n\nneonc = sys.argv[1]\nexecutor = sys.argv[2:]\n\nout = subprocess.check_output([neonc, \"t/import-optio...
python
chosen
[ { "from": "system", "value": "Set logging level to INFO (changed to DEBUG in 47c50c0)\n\nIMHO, it's a UX issue." }, { "from": "human", "value": "# Logging for the pip accelerator.\n#\n# Author: Peter Odding <peter.odding@paylogic.eu>\n# Last Change: July 21, 2013\n# URL: https://github.com/paylo...
python
chosen
[ { "from": "system", "value": "Add select modules to the welcome steps. Redirect fixes to skip\n" }, { "from": "human", "value": "from django.conf.urls.defaults import *\n# Smrtr\n\n# Uncomment the next two lines to enable the admin:\nfrom django.contrib import admin\nadmin.autodiscover()\n\n\nur...
python
chosen
[ { "from": "system", "value": "Use python from env in example script\n\nThis makes the cycle-cards example script use python from the env\ninstead of harcoding the location. This allows a virtualenv to be\neasily used.\n" }, { "from": "human", "value": "#!/bin/python\n\nimport removinator\nimpor...
python
chosen
[ { "from": "system", "value": "Make sure tests are found in Django 1.6\n" }, { "from": "human", "value": "#!/usr/bin/env python\nimport sys\nfrom django.conf import settings\nfrom django.core.management import execute_from_command_line\n\nif not settings.configured:\n settings.configure(\n ...
python
chosen
[ { "from": "system", "value": "Add chat command framework and basic test commands.\n" }, { "from": "human", "value": "#!/usr/bin/env python3\n\n" }, { "from": "gpt", "value": "#!/usr/bin/env python3\n\nimport argparse\nimport discord\nimport asyncio\n\nclass commands():\n\tasync def t...
python
chosen
[ { "from": "system", "value": "Replace a redundant reference to app.config\n" }, { "from": "human", "value": "# -*- coding: utf-8 -*-\n\"\"\"\nurl-shortener\n==============\n\nAn application for generating and storing shorter aliases for\nrequested URLs. Uses `spam-lists`__ to prevent generating ...
python
chosen
[ { "from": "system", "value": "Add welcome message pinging using real time api\n" }, { "from": "human", "value": "import slackclient\nimport time\nimport os\n\nslackClient = slackclient.SlackClient(os.environ[\"SLACK_TOKEN\"])\nslackClient.rtm_connect()\n\nwhile True:\n print(slackClient.rtm_r...
python
chosen
[ { "from": "system", "value": "Fix typo on line 15" }, { "from": "human", "value": "# Copyright (c) 2013 Tom McLoughlin\nimport socket\n# Configuration\nmyNick = \"Bot\"\nmyIdent = \"Bot\"\nmyReal = \"Bot\"\nmyIRC = \"irc.example.org\"\nmyPort = \"6667\"\nmyChan = \"#example\" # only suppor...
python
chosen
[ { "from": "system", "value": "pyapi: Append version specific path to os.path rather than prepend\n\nOther code might depend on os.path[0] being the path of the executed\nscript, and there is no need for our new path to be at the front.\n" }, { "from": "human", "value": "# import the right SWIG m...
python
chosen
[ { "from": "system", "value": "Deal with strings in the first param to the FusionError constructor\n" }, { "from": "human", "value": "#!/usr/bin/python\nfrom __future__ import print_function\n\n__all__ = ['Fusion', 'FusionCollection', 'FusionError', 'FusionRequester', 'HttpFusionRequester']\n\n\n...
python
chosen
[ { "from": "system", "value": "Add real life test to functional tests... problem the actual code is at the moent not able to run on custom locations.\n" }, { "from": "human", "value": "#!/usr/bin/env python\n# -*- coding: utf-8 -*-\n\"\"\"\nHere are all the functional tests for the ludobox-ui app...
python
chosen
[ { "from": "system", "value": "Allow relative paths for corenlp deps\n" }, { "from": "human", "value": "#!/usr/bin/env python\nimport os\n\n\"\"\"\nPerforms some core NLP operations as a proof of concept for the library.\n\"\"\"\n\nfrom stanford_corenlp_pywrapper import CoreNLP\n\nclass StanfordC...
python
chosen
[ { "from": "system", "value": "Change _connect to connect, so that it can be used from within other modules\n" }, { "from": "human", "value": "'''\nModule to provide MySQL compatibility to salt.\n\nIn order to connect to MySQL, certain configuration is required \nin /etc/salt/minion on the releva...
python
chosen
[ { "from": "system", "value": "Make it so we don't rely on weird rounding in python to assign card to the correct index\n" }, { "from": "human", "value": "import random\n\nclass Blackjack:\n def __init__(self):\n self.deck = range(1, 53)\n self.shuffle()\n self.deal()\n\n ...
python
chosen
[ { "from": "system", "value": "Add json to accepted celery content\n\ncelery.conf.CELERY_ACCEPT_CONTENT accepts only json\n" }, { "from": "human", "value": "from flask import g\nfrom app import app, app_mongo\nfrom celery import Celery\n\ncelery = Celery(app.import_name, broker=app.config['CELERY...
python
chosen
[ { "from": "system", "value": "Add tests for implemented methods\n" }, { "from": "human", "value": "#!/usr/bin/env python\n# -*- coding: utf-8 -*-\n\"\"\"\ntest_collision.test_worlds\n\"\"\"\nfrom __future__ import unicode_literals, print_function, absolute_import\n\nimport unittest\n\nimport bul...
python
chosen
[ { "from": "system", "value": "Use the original COUNTRIES_FLAG_URL string for the JS replace.\n" }, { "from": "human", "value": "from django.conf import settings\nfrom django.forms import widgets\nfrom django.utils.safestring import mark_safe\n\nCOUNTRY_CHANGE_HANDLER = \"\"\"\nthis.nextSibling.s...
python
chosen