conversations
listlengths
2
3
source
stringclasses
1 value
stack
stringclasses
1 value
[ { "from": "system", "value": "Improve the ability for developers to extend or modify\n" }, { "from": "human", "value": "# -*- coding: utf-8 -*-\nfrom django import forms\nfrom django.db import models\nfrom django.utils.translation import ugettext_lazy as _\n\nfrom .widgets import AppHookConfigWi...
python
chosen
[ { "from": "system", "value": "Test string form of verify_unit\n" }, { "from": "human", "value": "# coding: utf-8\nfrom __future__ import absolute_import, division, print_function\n\nimport pytest\nfrom astropy import units as u\n\nfrom astrodynamics.util import verify_unit\n\n\ndef test_verify_u...
python
chosen
[ { "from": "system", "value": "Migrate correctly from scratch also\n\nUnfortunately, instrospection.get_table_description runs\nselect * from course_overview_courseoverview, which of course\ndoes not exist while django is calculating initial migrations, causing\nthis to fail. Additionally, sqlite does not s...
python
chosen
[ { "from": "system", "value": "Fix another occurence of same typo" }, { "from": "human", "value": "#!/usr/bin/env python\n# encoding: utf-8\n\"\"\"\n\nexceptions.py\n\nLicensed under a 3-clause BSD license.\n\nRevision history:\n 13 Feb 2016 J. Sánchez-Gallego\n Initial version\n\n\"\"\"\...
python
chosen
[ { "from": "system", "value": "Update TODO for MPD command 'kill'\n" }, { "from": "human", "value": "from mopidy import settings\nfrom mopidy.frontends.mpd.protocol import handle_pattern\nfrom mopidy.frontends.mpd.exceptions import MpdPasswordError\n\n@handle_pattern(r'^close$')\ndef close(contex...
python
chosen
[ { "from": "system", "value": "Apply bucket-owner-read acl to uploaded db dumps\n\nAs per https://docs.aws.amazon.com/AmazonS3/latest/dev/crr-troubleshoot.html\n\n> By default, the bucket owner does not have any permissions on the objects created by <another> account. And the replication configuration replic...
python
chosen
[ { "from": "system", "value": "Integrate `UserChangeForm` so we get nice password fields.\n" }, { "from": "human", "value": "from django.conf import settings\nfrom django.contrib import admin\nfrom django_polymorphic_auth.models import User\nfrom django_polymorphic_auth.usertypes.email.models imp...
python
chosen
[ { "from": "system", "value": "Test for uploading files to /media/ folder in S3\n" }, { "from": "human", "value": "# -*- coding: utf-8 -*-\nfrom __future__ import unicode_literals, absolute_import\n\nfrom django.contrib.auth.models import AbstractUser\nfrom django.core.urlresolvers import reverse...
python
chosen
[ { "from": "system", "value": "Rename run_test to invoke to avoid confusing nosetests\n" }, { "from": "human", "value": "import utu\nimport unittest\n\ndef run_test(test):\n runner = unittest.runner.TextTestRunner()\n loader = unittest.loader.defaultTestLoader\n test = loader.loadTestsFr...
python
chosen
[ { "from": "system", "value": "Add DB credentials to sqlalchemy connection.\n" }, { "from": "human", "value": "import pandas as pd\nimport sys\n\n\ndf = pd.read_csv(sys.argv[1])\ndf.columns = [c.lower() for c in df.columns]\n\nfrom sqlalchemy import create_engine\nengine = create_engine('postgres...
python
chosen
[ { "from": "system", "value": "Make code consistent with comments\n" }, { "from": "human", "value": "from django.conf import settings\n\ndef newman_media(request):\n \"\"\"\n Inject NEWMAN_MEDIA_URL to template. Use NEWMAN_MEDIA_PREFIX value from\n settings, if not available, use MEDIA_U...
python
chosen
[ { "from": "system", "value": "Remove a ton of metaclass complexity\n\nIf I'd read the jinja2 documentation, I'd have seen that dotted notation\nis equivalent to subscript notation, which means metaclasses and\ngenerated classes aren't necessary. At all.\n\nNote-to-self for the future: RTFM.\n" }, { ...
python
chosen
[ { "from": "system", "value": "Add json exporter module to modules coveraged" }, { "from": "human", "value": "DATABASES = {\n 'default': {\n 'ENGINE': 'django.db.backends.sqlite3',\n }\n}\n\nMODELTREES = {\n 'default': {\n 'model': 'tests.Employee'\n }\n}\n\nINSTALLED_AP...
python
chosen
[ { "from": "system", "value": "Disable import * as it seems to cause some unnecessary trouble\n" }, { "from": "human", "value": "\"\"\" This package contains native Python implementations of several `The NURBS Book <http://www.springer.com/gp/book/9783642973857>`_ algorithms for generating B-spli...
python
chosen
[ { "from": "system", "value": "Include attach method in DummyOperation\n" }, { "from": "human", "value": "from hoomd.triggers import Trigger\nfrom hoomd.meta import _Operation, _TriggeredOperation\n\n\nclass DummySimulation:\n def __init__(self):\n self.state = DummyState()\n sel...
python
chosen
[ { "from": "system", "value": "Fix get_link_title for non-string keys and values.\nInclude heading and main as possible titles.\n" }, { "from": "human", "value": "\"\"\"Methods for converting data between systems or formats.\"\"\"\n\n\ndef make_cm_url(url):\n \"\"\"Turns a Geokey url into a Co...
python
chosen
[ { "from": "system", "value": "Make CACHED_TRANSLATIONS global, fix get_value typo\n" }, { "from": "human", "value": "import gettext\n\nfrom bot.action.core.action import IntermediateAction\n\nLOCALE_DIR = \"locales\"\nTRANSLATION_DOMAIN = \"telegram-bot\"\n\nDEFAULT_LANGUAGE = \"en\"\n\n\nclass ...
python
chosen
[ { "from": "system", "value": "Update unit test app() fixture\n" }, { "from": "human", "value": "import pytest\n\nimport sys, os\n\nmyPath = os.path.dirname(os.path.abspath(__file__))\nsys.path.append(myPath + \"/../src/\")\nfrom app import create_app\n\n\n@pytest.fixture(scope=\"function\", aut...
python
chosen
[ { "from": "system", "value": "Remove unnecessary codec reader, fixes type issue\n" }, { "from": "human", "value": "\"\"\"\nbyceps.services.country.service\n~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\n\n:Copyright: 2006-2021 Jochen Kupperschmidt\n:License: Revised BSD (see `LICENSE` file for details)\n\"\"\...
python
chosen
[ { "from": "system", "value": "ADD Name of the configuration file in a environment variable\n" }, { "from": "human", "value": "from lettuce import *\nimport requests\nimport json\n\n\ntenantList = [ \"511\", \"615\", \"634\", \"515\" ]\n\ndef initialize():\n with open(\"properties.json\") as con...
python
chosen
[ { "from": "system", "value": "Store a timeout value on the TaskWrapper, defaulting to no timeout.\n\nSigned-off-by: Chris Lamb <711c73f64afdce07b7e38039a96d2224209e9a6c@thread.com>\n" }, { "from": "human", "value": "from .job import Job\nfrom .utils import get_backend\n\nfrom . import app_settin...
python
chosen
[ { "from": "system", "value": "Use a dynamic url to secure webhook\n" }, { "from": "human", "value": "import json\nimport os\n\nimport ieeebot\n\nfrom flask import Flask, request, abort\nfrom storage import Storage\n\napp = Flask(__name__)\napp.config['PROPAGATE_EXCEPTIONS'] = True\n\nieeebot.log...
python
chosen
[ { "from": "system", "value": "Use a smaller set of users in fake game two gameplay\n" }, { "from": "human", "value": "import random\n\nfrom django.core.management.base import BaseCommand\nfrom django.contrib.auth.models import User\n\nfrom ...models import (\n Transcript, TranscriptPhraseVote...
python
chosen
[ { "from": "system", "value": "Fix typo in upgrade script" }, { "from": "human", "value": "import os.path\nimport shutil\n\nsql = \"\"\"\n-- Remove empty values from the milestone list\nDELETE FROM milestone WHERE COALESCE(name,'')='';\n\n-- Add a description column to the version table, and remo...
python
chosen
[ { "from": "system", "value": "Add static white marble to sense hat maze\n" }, { "from": "human", "value": "# based on https://www.raspberrypi.org/learning/sense-hat-marble-maze/worksheet/\n\nfrom sense_hat import SenseHat\nimport time\n\nsense = SenseHat()\nsense.clear()\n\ntime.sleep(0.5)\n\nr ...
python
chosen
[ { "from": "system", "value": "Enforce consistent results for generated code\n" }, { "from": "human", "value": "# Copyright 2008 Paul Hodge\n\nimport os, string\n\ndef run(functionsDirectory, outputFilename):\n\n print \"dir is: \" +functionsDirectory\n\n files = os.listdir(functionsDirecto...
python
chosen
[ { "from": "system", "value": "Exclude collection groups from ADM UI\n" }, { "from": "human", "value": "from __future__ import absolute_import\n\nfrom django import forms\nfrom django.contrib.auth.models import Group\n\nfrom osf.models import AdminProfile\n\n\nclass LoginForm(forms.Form):\n em...
python
chosen
[ { "from": "system", "value": "Upgrade HAProxy to version 2.0.3\n" }, { "from": "human", "value": "from foreman import define_parameter\n\nfrom templates import pods\n\n\n(define_parameter('image-version')\n .with_doc('HAProxy image version.')\n .with_default('1.8.9'))\n\n\n@pods.app_specifier\nd...
python
chosen
[ { "from": "system", "value": "Allow zeros for recurring interval\n" }, { "from": "human", "value": "from ckan.lib.navl.validators import ignore_empty, not_empty\nfrom ckan.logic.validators import (\n name_validator, boolean_validator, is_positive_integer, isodate,\n group_id_exists)\n\n\nd...
python
chosen
[ { "from": "system", "value": "Use handlers defined in command package\n" }, { "from": "human", "value": "from cement.core.foundation import CementApp\nimport command\nimport util.config\n\nutil.config.Configuration()\n\n\nclass Manager(CementApp):\n class Meta:\n label = 'QLDS-Manager'...
python
chosen
[ { "from": "system", "value": "Change the way to import package dynamically\n" }, { "from": "human", "value": "\nimport os\nimport fnmatch\nimport re\nimport subprocess\nimport sys\nimport json\nimport imp\nimport time\n\nclass pipeline(object):\n def __init__(self):\n self.name = ''\n ...
python
chosen
[ { "from": "system", "value": "Increase task check time to 1h\n" }, { "from": "human", "value": "from __future__ import absolute_import\n\nfrom datetime import datetime, timedelta\n\nfrom changes.config import queue\nfrom changes.constants import Status\nfrom changes.models import Task\nfrom chan...
python
chosen
[ { "from": "system", "value": "Install PyYAML automatically before starting server\n" }, { "from": "human", "value": "#!/usr/bin/env python3\n\n# tsuserver3, an Attorney Online server\n#\n# Copyright (C) 2016 argoneus <argoneuscze@gmail.com>\n#\n# This program is free software: you can redistribu...
python
chosen
[ { "from": "system", "value": "Test that declarative fields actually work.\n" }, { "from": "human", "value": "from django.test import TestCase\n\nfrom django_tablib import ModelDataset, Field\n\nfrom .models import TestModel\n\n\nclass DjangoTablibTestCase(TestCase):\n def test_declarative_fie...
python
chosen
[ { "from": "system", "value": "Add required login to maedchenbund\n" }, { "from": "human", "value": "from django.shortcuts import render\n\nfrom .models import Document\n\n\ndef documents(request):\n docs = Document.objects.all().order_by(\"title\")\n return render(request, 'home.html', {'d...
python
chosen
[ { "from": "system", "value": "Revert \"Skip functional tests until they are fixed\"\n\nThis reverts commit 3946bf0e0186c8c2897f432029bad7873b6d03a0.\n\nChange-Id: Ic21137b208991c9ce738e5bf3ad5e6965b69e166\n" }, { "from": "human", "value": "# Licensed under the Apache License, Version 2.0 (the...
python
chosen
[ { "from": "system", "value": "Fix for MODPYTHON-55 : added a version attribute to the mod_python package.\n" }, { "from": "human", "value": " #\n # Copyright 2004 Apache Software Foundation \n # \n # Licensed under the Apache License, Version 2.0 (the \"License\"); you\n # may not use this file ...
python
chosen
[ { "from": "system", "value": "Remove json import, not needed yet\n" }, { "from": "human", "value": "import json\n\nimport sys, os\nsys.path.insert(0, os.path.abspath('./python-tastypie-client'))\n\nimport tastypie_client\n\nurl_root = \"http://vorol-dev.cdlib.org/\"\npath_collection_registry = ...
python
chosen
[ { "from": "system", "value": "MNT: Update NDBC example for removed buoy\n" }, { "from": "human", "value": "# Copyright (c) 2018 Siphon Contributors.\n# Distributed under the terms of the BSD 3-Clause License.\n# SPDX-License-Identifier: BSD-3-Clause\n\"\"\"\nNDBC Buoy Data Request (of any type)\...
python
chosen
[ { "from": "system", "value": "Adjust Account.databases() to new return format\n" }, { "from": "human", "value": "\nfrom .base import BaseWrapper\nfrom .database import Database\nfrom ..constants import URL_BASE\n\nclass Account(BaseWrapper):\n \"\"\"An object encapsulating a billing account o...
python
chosen
[ { "from": "system", "value": "Revert \"The same thing, but their way haha\"\n\nThis reverts commit ab12f6cc4593e81bc426a54e8aebc1671ac34e2a.\n" }, { "from": "human", "value": "import os\n\nfrom azure.storage import *\n\n\ndef store(image, entity, entity_id):\n blob_service = BlobService(accou...
python
chosen
[ { "from": "system", "value": "Use custom widget for template choices instead\n\nA bit more Djangonic than tweaking self.fields\n" }, { "from": "human", "value": "from django import forms\nfrom django.conf import settings\n\nfrom mptt.forms import MPTTAdminForm\n\nfrom .models import Page\n\n\nTE...
python
chosen
[ { "from": "system", "value": "Add angles to ball close decision\n" }, { "from": "human", "value": "from dynamic_stack_decider.abstract_decision_element import AbstractDecisionElement\n\n\nclass BallClose(AbstractDecisionElement):\n def __init__(self, blackboard, dsd, parameters=None):\n ...
python
chosen
[ { "from": "system", "value": "Fix css and heading test also removed localization test as no longer required\n\n" }, { "from": "human", "value": "from datetime import date\nfrom django.core.urlresolvers import reverse\nfrom django.contrib.staticfiles.testing import StaticLiveServerTestCase\nfrom ...
python
chosen
[ { "from": "system", "value": "Move to buttons & remove hardcoding of image size" }, { "from": "human", "value": "# coding: utf-8\n\n# ui.View subclass for the top ten iTunes songs.\n# Pull requests gladly accepted.\n\nimport feedparser, requests, ui\n\nurl = 'https://itunes.apple.com/us/rss/tops...
python
chosen
[ { "from": "system", "value": "Add a test that makes a new acq stats database\n" }, { "from": "human", "value": "from .. import acq_stats\n\n\ndef test_calc_stats():\n acq_stats.calc_stats(17210)\n" }, { "from": "gpt", "value": "import tempfile\nimport os\n\nfrom .. import acq_stat...
python
chosen
[ { "from": "system", "value": "Add real code in comments.\n" }, { "from": "human", "value": "from interruptingcow import timeout\nimport time\n\nwhile True:\n # simulate waiting for laser A\n print(\"Waiting for laser A\")\n time.sleep(2)\n print(\"laser A tripped\")\n try:\n ...
python
chosen
[ { "from": "system", "value": "Test now calls a public endpoint first\n" }, { "from": "human", "value": "\"\"\" Functions to call the api and test it \"\"\"\n\nimport sys\nimport fenix\n\napi = fenix.FenixAPISingleton()\nprint('Testing Fenix API SDK Python')\nauth_url = api.get_authentication_url...
python
chosen
[ { "from": "system", "value": "Fix circular dependency problem with django apps\n\nIt looks like translation is importing *all other* django apps in the project\nwhen it is used from treemap. This means that it will load apps that\ndepend on treemap when it is not finished import treemap. So while it\nappear...
python
chosen
[ { "from": "system", "value": "Return 404 if no message so we can poll from cucumber tests" }, { "from": "human", "value": "from kombu import Connection, Exchange, Queue\nfrom flask import Flask\nimport os\n\napp = Flask(__name__)\napp.config.from_object(os.environ.get('SETTINGS'))\n\n@app.route(...
python
chosen
[ { "from": "system", "value": "Update test to use pytest fixture\n" }, { "from": "human", "value": "from viridis import tree\nfrom six.moves import range\n\ndef test_split():\n t = tree.Ultrametric(list(range(6)))\n t.merge(0, 1, 0.1)\n t.merge(6, 2, 0.2)\n t.merge(3, 4, 0.3)\n t.m...
python
chosen
[ { "from": "system", "value": "Add reset on rotation support in log processor.\n" }, { "from": "human", "value": "import re\nimport snmpy\n\nclass log_processor(snmpy.plugin):\n def create(self):\n for k, v in sorted(self.conf['objects'].items()):\n extra = {\n ...
python
chosen
[ { "from": "system", "value": "Revert \"test not answered text present in report\"\n\nThis reverts commit 7e6caad91969bafdaefa0fc60fdfe25a8d8d8ab2.\n" }, { "from": "human", "value": "from io import BytesIO\n\nimport PyPDF2\n\nfrom wizard_builder import view_helpers as wizard_builer_helpers\n\nfro...
python
chosen
[ { "from": "system", "value": "Change siteuser string for clarity\n" }, { "from": "human", "value": "from django.db import models\nfrom django.contrib.auth.models import User\n\nclass SiteUser(models.Model):\n def __str__(self):\n return self.user.username\n # Using a OneToOneField so we can...
python
chosen
[ { "from": "system", "value": "Fix the order of parameters to hasAccess, which broke all topic changing when +t was set\n" }, { "from": "human", "value": "from twisted.words.protocols import irc\nfrom txircd.modbase import Mode\n\nclass TopiclockMode(Mode):\n\tdef checkPermission(self, user, cmd,...
python
chosen
[ { "from": "system", "value": "Add a MainWindow class to Wx and use it in printer and scanner\n" }, { "from": "human", "value": "from Cura.Wx.WxApplication import WxApplication\n\nclass PrinterApplication(WxApplication):\n def __init__(self):\n super(PrinterApplication, self).__init__()...
python
chosen
[ { "from": "system", "value": "Change to path, made relative\n\n\nFormer-commit-id: f00bf782fad3f6ddc6d2c97a23ff4f087ad3a22f" }, { "from": "human", "value": "#\n# Code to load project paths\n#\n\nimport os, sys\n\nMR_BASE_PATH = os.path.abspath(os.path.join(os.path.dirname(__file__), \"/Users/dmh...
python
chosen
[ { "from": "system", "value": "Fix manifest: add OCA in the authors\n\nAdded OCA in the authors" }, { "from": "human", "value": "# -*- coding: utf-8 -*-\n# © 2016 Elico Corp (https://www.elico-corp.com).\n# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).\n{\n 'name': 'Busine...
python
chosen
[ { "from": "system", "value": "Add extend_list method to OratioIgnoreParser\n\nTo make oratioignoreparser.py easily testable using unit tests.\n" }, { "from": "human", "value": "import os\nimport re\n\n\nclass OratioIgnoreParser():\n def __init__(self):\n self.ignored_paths = [\"oratiom...
python
chosen
[ { "from": "system", "value": "Remove unecessary code\nAdd first charakter remover\n" }, { "from": "human", "value": "import sys\n\ndef split(string, splitters):\n\tfinal = [string]\n\tfor x in splitters:\n\t\tfor i,s in enumerate(final):\n\t\t\tif x in s and x != s:\n\t\t\t\tleft, right = s.spli...
python
chosen
[ { "from": "system", "value": "Format with two spaces instead of four\n" }, { "from": "human", "value": "import os\n\nimport h5py\nimport numpy as np\n\nref = h5py.File(\n os.path.expanduser(\n \"~/tensorflow_datasets/downloads/extracted/TAR_GZ.datasets.lids.mit.edu_fastdept_nyudepthBjt...
python
chosen
[ { "from": "system", "value": "[IMP] resource: Set company_id on a resource.calendar on company creation\n\nPurpose\n=======\n\nCurrently, when creating a company, the resource calendar is created if not specified.\n\nThis lead to duplicated data. In Manufacturing > Configuration > Working Time, two same wor...
python
chosen
[ { "from": "system", "value": "Update ApplicationSearchProvider to reflect conf.settings.Application changes.\n" }, { "from": "human", "value": "import logging\n\nfrom molly.apps.search.providers import BaseSearchProvider\n\nfrom molly.conf import applications\n\nlogger = logging.getLogger('molly...
python
chosen
[ { "from": "system", "value": "Use transform instead of embed\n" }, { "from": "human", "value": "#!/usr/bin/env python\ndata = '../data/fm_train_real.dat'\nparameter_list = [[data, 20]]\n\ndef converter_stochasticproximityembedding (data_fname, k):\n\ttry:\n\t\tfrom shogun import RealFeatures,Sto...
python
chosen
[ { "from": "system", "value": "Fix gpio to uppercase GPIO\n" }, { "from": "human", "value": "#!/usr/bin/env python\n\nimport RPi.GPIO as GPIO\n\nLED_PIN = 23\nSWITCH_PIN = 24\n\n# new style class\nclass PiThing(object):\n \"\"\"Raspberry Pi Internet 'Thing'.\"\"\"\n \n def __init__(self)...
python
chosen
[ { "from": "system", "value": "Fix django app config default\n" }, { "from": "human", "value": "try:\n from actstream.signals import action\nexcept:\n pass\n\nimport django\n\n__version__ = '1.4.0'\n__author__ = 'Asif Saif Uddin, Justin Quick <justquick@gmail.com>'\n\nif django.VERSION < (3...
python
chosen
[ { "from": "system", "value": "Implement more TGT Priest cards\n" }, { "from": "human", "value": "from ..utils import *\n\n\n##\n# Minions\n\n# Holy Champion\nclass AT_011:\n\tevents = Heal().on(Buff(SELF, \"AT_011e\"))\n\n\n# Spawn of Shadows\nclass AT_012:\n\tinspire = Hit(ALL_HEROES, 4)\n\n\n#...
python
chosen
[ { "from": "system", "value": "Implement Infest, On the Hunt, Call of the Wild\n" }, { "from": "human", "value": "from ..utils import *\n\n\n##\n# Minions\n\nclass OG_179:\n\t\"Fiery Bat\"\n\tdeathrattle = Hit(RANDOM_ENEMY_CHARACTER, 1)\n\n\nclass OG_292:\n\t\"Forlorn Stalker\"\n\tplay = Buff(FRI...
python
chosen
[ { "from": "system", "value": "Add direction to Message listing\n" }, { "from": "human", "value": "from django.contrib import admin\nfrom .models import *\n\n\nclass MessageAdmin(admin.ModelAdmin):\n list_display = ('to_phone_number', 'from_phone_number', 'status', 'date_sent')\n list_displ...
python
chosen
[ { "from": "system", "value": "Add to doc string: time complexity\n" }, { "from": "human", "value": "from __future__ import absolute_import\nfrom __future__ import print_function\nfrom __future__ import division\n\n\ndef quick_sort(a_list):\n \"\"\"Quick sort algortihm with list comprehension ...
python
chosen
[ { "from": "system", "value": "Order feedback by most recent\n" }, { "from": "human", "value": "from django import forms\nfrom django.contrib import admin\n\nfrom feedback.models import Feedback\n\n\nclass FeedbackAdminForm(forms.ModelForm):\n class Meta:\n model = Feedback\n fie...
python
chosen
[ { "from": "system", "value": "Use double quotes to quote command arguments. The Windows command\nparser doesn't recognize single quotes.\n" }, { "from": "human", "value": "import sys\nimport os\nimport time\ntry:\n import subprocess\nexcept ImportError:\n # use private copy for old Python...
python
chosen
[ { "from": "system", "value": "Remove need for static pages\n" }, { "from": "human", "value": "# OSU SPS Website Build Script\n\ndef loadFile( src, prefx ):\n out = \"\"\n for line in open( src, 'r' ):\n out += prefx + line\n return out\n\ndef outputFile( name, content ):\n fil...
python
chosen
[ { "from": "system", "value": "Use io.open to support python 2.x _and_ python 3" }, { "from": "human", "value": "#!/usr/bin/env python3\n\nimport glob\nimport time\nimport re\n\ndef readfile(fn):\n with open(fn, 'Ur', encoding='utf8') as f:\n return f.read()\n\ndef loaderString(var):\n ...
python
chosen
[ { "from": "system", "value": "Put yaml config in Context.\n" }, { "from": "human", "value": "\"\"\"\nDataSet context\n\"\"\"\nclass DsContext(object):\n def __init__(self, config=\"okdataset.yml\"):\n self.workers = 8\n" }, { "from": "gpt", "value": "import yaml\nimport os\...
python
chosen
[ { "from": "system", "value": "Fix user, album factories; add setup for photo test case\n" }, { "from": "human", "value": "from __future__ import unicode_literals\nfrom django.contrib.auth.models import User\nfrom django.test import TestCase\nimport factory\nfrom faker import Faker\n\nfrom imager...
python
chosen
[ { "from": "system", "value": "Clean up PEP8 inconsistencies in header classes\n" }, { "from": "human", "value": "import hmac, hashlib\n\nclass Authenticate:\n def __init__(self, public_key, private_key, method, url, timestamp):\n self._public_key = public_key\n self._private_key...
python
chosen
[ { "from": "system", "value": "Include django.contrib.auth.views.login in django 1.10 way\n" }, { "from": "human", "value": "from django.conf.urls import include, url\nfrom django.conf.urls.static import static\nfrom django.views.generic import TemplateView\nfrom django.contrib import admin\nfrom...
python
chosen
[ { "from": "system", "value": "Add unit test to determine if the classes ExamineExe and ExamineSnap will work properly.\n" }, { "from": "human", "value": "import pytest\nfrom contextlib import contextmanager\nfrom pyroSAR._dev_config import ExamineExe\nfrom pyroSAR.snap.auxil import ExamineSnap\n...
python
chosen
[ { "from": "system", "value": "Add try accept block for bs4 features\n" }, { "from": "human", "value": "from ..darkobject import DarkObject\nfrom bs4 import BeautifulSoup\nimport requests\nimport logging\nimport time\n\n\nclass Scrubber(DarkObject):\n def __init__(self):\n super(Scrubbe...
python
chosen
[ { "from": "system", "value": "Use ujson for encoding responses.\n" }, { "from": "human", "value": "\"\"\"\n marvin\n ~~~~~~\n\n This is the main entry point to marvin, the API endpoints for streamr.\n\"\"\"\n\n# pylint: disable=invalid-name\n\nfrom flask import Flask\nfrom flask.ext.sql...
python
chosen
[ { "from": "system", "value": "Add click automatic environment variable prefix.\n" }, { "from": "human", "value": "# -*- encoding: utf-8 -*-\n\n__author__ = 'kotaimen'\n__date__ = '28-Feb-2018'\n\n\"\"\"Main cli entry point, called when awscfncli is run as a package, \nimported in setuptools int...
python
chosen
[ { "from": "system", "value": "Add user object to template context.\n" }, { "from": "human", "value": "# Create your views here.\nfrom django.shortcuts import render_to_response\nfrom studyplanner.courselist.models import Course\nfrom studyplanner.courselist.models import Faculty\nfrom studyplann...
python
chosen
[ { "from": "system", "value": "Update in the update function\n" }, { "from": "human", "value": "\n# Github Tray App\n\nimport rumps\nimport config\nimport contribs\n\nclass GithubTrayApp(rumps.App):\n\n def __init__(self):\n super(GithubTrayApp, self).__init__('Github')\n self.co...
python
chosen
[ { "from": "system", "value": "Fix the query test now that the hdf file order is fixed\n" }, { "from": "human", "value": "from __future__ import print_function\nimport tables\n\nfrom metatlas.mzml_loader import mzml_to_hdf, get_test_data\n\n\ndef test_loader():\n path = get_test_data()\n ou...
python
chosen
[ { "from": "system", "value": "Fix quality violation in UserInfo\n" }, { "from": "human", "value": "\"\"\"\nAdmin config for UserInfo app.\n\"\"\"\nfrom django.contrib import admin\nfrom common.utils import register_model_admins\n\nfrom .models import PledgeClass, UserInfo\n\n\nclass UserInfoAdmi...
python
chosen
[ { "from": "system", "value": "Implement backport of logging package for 2.6\n\ndebugging 3\n" }, { "from": "human", "value": "import logging\nfrom logging import *\n\n\nclass Logger26(logging.getLoggerClass()):\n\n def getChild(self, suffix):\n \"\"\"\n (copied from module \"log...
python
chosen
[ { "from": "system", "value": "Add build as a possible environment option\n" }, { "from": "human", "value": "\"\"\"Add application.properties to Application's S3 Bucket directory.\"\"\"\nimport logging\nimport argparse\nfrom .create_archaius import init_properties\n\nLOG = logging.getLogger(__nam...
python
chosen
[ { "from": "system", "value": "Use less verbose byte string syntax\n" }, { "from": "human", "value": "import unittest\nimport requests\n\n\nclass SmokeTest(unittest.TestCase):\n def test_maths(self):\n self.assertEquals(6, 2 + 4)\n\n def test_home_page_is_about_todo_lists(self):\n ...
python
chosen
[ { "from": "system", "value": "Remove \"htmlunit\" from browser options\n" }, { "from": "human", "value": "\"\"\"\nThis class containts some frequently-used constants\n\"\"\"\n\n\nclass Environment:\n QA = \"qa\"\n STAGING = \"staging\"\n PRODUCTION = \"production\"\n MASTER = \"maste...
python
chosen
[ { "from": "system", "value": "Use HWYNAME for road names in report\n\nRelated to #36\n" }, { "from": "human", "value": "# Hexagons\nHexID = 'HexID'\n\n# ProviderServiceAreas\nServiceClass = 'ServiceClass'\nProvName = 'ProvName'\n\n#Providers\nColloquial = 'Colloquial'\nCode = 'Code'\nURL = 'URL'...
python
chosen
[ { "from": "system", "value": "Fix bug of self injection into injector function\n" }, { "from": "human", "value": "from functools import wraps\nfrom typing import Callable\n\nfrom ._scope import Scope\n\n\nclass Injector(Callable):\n \"\"\"\n class decorator to inject dependencies into ...
python
chosen
[ { "from": "system", "value": "Fix serious problem using rsync\n\nIf env.remote_output not set, use rsync --delete option will\nempty the whole remote system, this is a very serious problem!\n" }, { "from": "human", "value": "#!/usr/bin/env python\n# -*- coding: utf-8 -*-\n\nfrom __future__ impor...
python
chosen
[ { "from": "system", "value": "Update which objects are used to write baseline file\n" }, { "from": "human", "value": "import json\nimport os\n\nfrom candidates.models import Ballot\nfrom bulk_adding.models import RawPeople\nfrom django.core.management.base import BaseCommand\n\n\nclass Command(B...
python
chosen
[ { "from": "system", "value": "Change style for pytest marker\n\nUpdate pytest.mark.django_db to be more consistent with rest of the project\n" }, { "from": "human", "value": "import pytest\nfrom celery.result import EagerResult\n\nfrom {{ cookiecutter.project_slug }}.users.tasks import get_users...
python
chosen
[ { "from": "system", "value": "Add wait_time to locust python package namespace (to not break `from locust.wait_time import ...` imports)" }, { "from": "human", "value": "from .user.sequential_taskset import SequentialTaskSet\nfrom .user.task import task, TaskSet\nfrom .user.users import HttpUser...
python
chosen
[ { "from": "system", "value": "Increase thumbnail quality to 80 from 60\n\nSome of them were looking pretty compressed.\n" }, { "from": "human", "value": "from imagekit import ImageSpec, register\nfrom imagekit.processors import ResizeToFit\n\nfrom spectator.core import app_settings\n\n\nclass Th...
python
chosen
[ { "from": "system", "value": "Remove route54 provider because the driver is not finished yet.\n\n\ngit-svn-id: 9ad005ce451fa0ce30ad6352b03eb45b36893355@1340889 13f79535-47bb-0310-9956-ffa450edef68\n" }, { "from": "human", "value": "# Licensed to the Apache Software Foundation (ASF) under one or ...
python
chosen
[ { "from": "system", "value": "Fix function object has no attribute __func__\n\nSigned-off-by: Dan Yeaw <2591e5f46f28d303f9dc027d475a5c60d8dea17a@yeaw.me>\n" }, { "from": "human", "value": "from builtins import object\nimport unittest\n\nfrom gaphas.state import reversible_pair, observed, _revers...
python
chosen
[ { "from": "system", "value": "Use decimal in the logger to get the most accurate time info\n" }, { "from": "human", "value": "import threading\nimport fresenius\nimport readline\nimport time\nimport sys\n\nprompt = '> '\n\nport = sys.argv[1]\nfresbase = fresenius.FreseniusComm(port = port)\n\nlo...
python
chosen