conversations
listlengths
2
3
source
stringclasses
1 value
stack
stringclasses
1 value
[ { "from": "system", "value": "Fix import error of SimpleCookie for python 2.7\n\n`Cookie` was renamed to `http.cookies` in Python 3" }, { "from": "human", "value": "from http.cookies import SimpleCookie\nfrom django.conf import settings\nfrom sockjs.tornado.session import ConnectionInfo\nfrom sw...
python
chosen
[ { "from": "system", "value": "Remove use of check_output (not in Py2.6)\n" }, { "from": "human", "value": "from __future__ import absolute_import\n\nimport os.path\nimport pytest\nimport subprocess\n\nfrom django.conf import settings\n\nfrom raven.versioning import fetch_git_sha, fetch_package_v...
python
chosen
[ { "from": "system", "value": "Make roll better and worse\n" }, { "from": "human", "value": "import random\n\nfrom discord.ext import commands\n\n\nclass RNG:\n def __init__(self, bot):\n self.bot = bot\n\n @commands.command()\n async def roll(self, dice: str = None):\n \"\...
python
chosen
[ { "from": "system", "value": "Use InotifyObserver if the pyinotify dependency is satisfied.\n\nSigned-off-by: Gora Khargosh <a2078c57e3ac12c6dfb97b7c2c4e6d6d7db7e92f@gmail.com>\n" }, { "from": "human", "value": "# -*- coding: utf-8 -*-\n\nimport logging\n\nlogging.basicConfig(level=logging.DEBUG...
python
chosen
[ { "from": "system", "value": "Refactor out functions from rps1\n" }, { "from": "human", "value": "# A simple rock, paper, scissors script submitted as a demo of easy game-making\n# In Python\n# Certain parts of this program are functional—that is, written in functions that\n# work together. Some...
python
chosen
[ { "from": "system", "value": "Remove requests and drop external tests (now in integration)\n" }, { "from": "human", "value": "from cryptography.hazmat.backends import default_backend\nfrom cryptography.hazmat.primitives.asymmetric import padding\nfrom cryptography.hazmat.primitives import serial...
python
chosen
[ { "from": "system", "value": "Define unicode in Python 3\n\n__unicode__ was removed in Python 3 because all __str__ are Unicode.\r\n\r\n[flake8](http://flake8.pycqa.org) testing of https://github.com/mwouts/jupytext on Python 3.7.0\r\n\r\n$ __flake8 . --count --select=E901,E999,F821,F822,F823 --show-source ...
python
chosen
[ { "from": "system", "value": "Change the version string so it doesn't cause any errors.\n" }, { "from": "human", "value": "\"\"\"\nTicketing\n~~~~~~~~~\n\"\"\"\n\ntry:\n VERSION = __import__('pkg_resources') \\\n .get_distribution('django-ticketing').version\nexcept Exception, e:\n ...
python
chosen
[ { "from": "system", "value": "Remove some debugging print statements that slipped through.\n" }, { "from": "human", "value": "\"\"\"\nAll animators should be functions which take the input time as a number\nfrom 0 to 1 and return a new value for the property they are animating.\n\nFor numerical ...
python
chosen
[ { "from": "system", "value": "Handle subkey for submodule, in strconcat at least\n" }, { "from": "human", "value": "# pipestrconcat.py #aka stringbuilder\n#\n\nfrom pipe2py import util\n\ndef pipe_strconcat(context, _INPUT, conf, **kwargs):\n \"\"\"This source builds a string and yields it f...
python
chosen
[ { "from": "system", "value": "Add more tests around the proposal model behaviour\n" }, { "from": "human", "value": "import pytest\ntry:\n from unittest import mock\nexcept ImportError:\n import mock\n\nfrom k2catalogue import models\n\n\n@pytest.fixture\ndef proposal():\n return models....
python
chosen
[ { "from": "system", "value": "Update get_model_list to use app config rather than deprecated django.db.models.loading functions\n" }, { "from": "human", "value": "import os\nfrom django.conf import settings\nfrom django.db.models.loading import get_models, get_app\ndefault_app_config = 'calacces...
python
chosen
[ { "from": "system", "value": "Optimize SQL queries used for fetching clouds\n" }, { "from": "human", "value": "from rest_framework import permissions as rf_permissions\nfrom rest_framework import exceptions\n\nfrom nodeconductor.core import viewsets\nfrom nodeconductor.cloud import models\nfrom ...
python
chosen
[ { "from": "system", "value": "Add test capturing expected behavior under more complex inputs.\n" }, { "from": "human", "value": "import pytest\n\nfrom pmxbot import saysomething\n\n\nclass TestMongoDBChains:\n\t@pytest.fixture\n\tdef mongodb_chains(self, request, mongodb_uri):\n\t\tk = saysometh...
python
chosen
[ { "from": "system", "value": "Refactor test to use cool py.test's fixture\n" }, { "from": "human", "value": "# Licensed under the Apache License, Version 2.0 (the \"License\"); you may\n# not use this file except in compliance with the License. You may obtain\n# a copy of the License at\n#\n# ...
python
chosen
[ { "from": "system", "value": "Update to support python 3." }, { "from": "human", "value": "from os.path import join\nimport re\n\nfrom setuptools_scm.utils import data_from_mime, trace\nfrom setuptools_scm.version import meta, tags_to_versions\n\n\ntag_re = re.compile(r'(?<=\\btag: )([^,]+)\\b')...
python
chosen
[ { "from": "system", "value": "Add unique index on the subject model for @chrisseto\n" }, { "from": "human", "value": "from modularodm import fields\n\nfrom framework.mongo import (\n ObjectId,\n StoredObject,\n utils as mongo_utils\n)\n\nfrom website.util import api_v2_url\n\n@mongo_uti...
python
chosen
[ { "from": "system", "value": "Add get the element by col and row" }, { "from": "human", "value": "import numpy as np\n\nMatrix_A = np.array( [[1,1],[0,1]] )\nMatrix_B = np.array( [[2,0],[3,4]] )\n\nprint Matrix_A*Matrix_B\n\nprint Matrix_A.dot(Matrix_B) \n\nprint np.dot(Matrix_A, Matrix_B) \n...
python
chosen
[ { "from": "system", "value": "Send callback when finished moving\n" }, { "from": "human", "value": "import asyncio\n\nfrom waterbutler.core import utils\nfrom waterbutler.tasks import core\nfrom waterbutler.tasks import settings\n\n@core.celery_task\ndef move(src_bundle, dest_bundle):\n src_a...
python
chosen
[ { "from": "system", "value": "Use signals to add authenticated user URL to comment when posted\n" }, { "from": "human", "value": "from django.contrib.comments.models import Comment\nfrom django.db import models\n\nclass OslComment(Comment):\n parent_comment = models.ForeignKey(Comment, blank=...
python
chosen
[ { "from": "system", "value": "Use multiple ES host uris field from PaaS config\n" }, { "from": "human", "value": "from flask import Flask\nimport base64\nimport json\nfrom config import config as configs\nfrom flask.ext.elasticsearch import FlaskElasticsearch\nfrom dmutils import init_app, flask...
python
chosen
[ { "from": "system", "value": "Split line to avoid flake8 warning\n" }, { "from": "human", "value": "from comics.aggregator.crawler import CrawlerBase, CrawlerImage\nfrom comics.core.comic_data import ComicDataBase\n\n\nclass ComicData(ComicDataBase):\n name = 'GU Comics'\n language = 'en'\...
python
chosen
[ { "from": "system", "value": "Use the string module instead of string methods; this should still work\nwith Python 1.5.2 for now.\n" }, { "from": "human", "value": "\"\"\"Core XML support for Python.\n\nThis package contains three sub-packages:\n\ndom -- The W3C Document Object Model. This supp...
python
chosen
[ { "from": "system", "value": "Integrate search in home view\n" }, { "from": "human", "value": "# -*- coding: utf-8 -*-\nfrom django.views.generic import ListView, TemplateView\n\nfrom bakery.cookies.models import Cookie\n\n\nclass HomeView(ListView):\n model = Cookie\n template_name = 'hom...
python
chosen
[ { "from": "system", "value": "Add event field when editing posts\n" }, { "from": "human", "value": "from django.contrib import admin\n\nfrom .models import Post\n\n\nclass PostAdmin(admin.ModelAdmin):\n list_display = (\n 'title',\n 'slug',\n 'event',\n 'created_at...
python
chosen
[ { "from": "system", "value": "Add unit test for make_thumb_url()\n" }, { "from": "human", "value": "#!/usr/bin/env python\n# -*- coding: latin-1 -*-\n\n\"\"\"Unit tests.\"\"\"\n\nimport unittest\nimport commonsdownloader\n\n\nclass TestCommonsDownloader(unittest.TestCase):\n\n \"\"\"Testing m...
python
chosen
[ { "from": "system", "value": "Solve Code Fights array packing problem\n" }, { "from": "human", "value": "#!/usr/local/bin/python\n# Code Fights Are Equally Strong Problem\n\n\ndef arrayPacking():\n pass\n\n\ndef main():\n tests = [\n [],\n []\n ]\n\n for t in tests:\n ...
python
chosen
[ { "from": "system", "value": "Change the text format for drawing a stroke. To use 5 digits but not 8 digits to present a point.\n" }, { "from": "human", "value": "class TextCodec:\n\tdef __init__(self):\n\t\tpass\n\n\tdef encodeStartPoint(self, p):\n\t\treturn \"0000{0[0]:02X}{0[1]:02X}\".format...
python
chosen
[ { "from": "system", "value": "Add a few design comments.\n" }, { "from": "human", "value": "\n\n\nclass _NotSetType:\n def __repr__(self):\n return \"NotSet\" # pragma no cover\nNotSet = _NotSetType()\n\n\nclass BasicUntappdObject(object):\n\n def __init__(self, attributes):\n ...
python
chosen
[ { "from": "human", "value": "Add __version__ to Swarming bot 'api' package.\n\nIt will simplify making bot_config.py hooks work with different versions of\nbot code (e.g. when deploying changes to bot API).\n\nR=maruel@chromium.org\nBUG=\n\nReview-Url: https://codereview.chromium.org/2270113002\n" }, { ...
python
chosen
[ { "from": "system", "value": "Change to upload paths for images.\n" }, { "from": "human", "value": "__author__ = 'leif'\nimport os\n\nPROJ_PATH = os.getcwd()\nprint \"Project Path: %s\" % (PROJ_PATH)\nGAME_DB = os.path.join(PROJ_PATH,'game.db')\nTEMP_PATH = os.path.join(PROJ_PATH,'templates')\nS...
python
chosen
[ { "from": "system", "value": "Fix the bug that causes \"set frame range\" error on a scene that has no rigid body world.\n" }, { "from": "human", "value": "# -*- coding: utf-8 -*-\n\nimport bpy\n\ndef setupFrameRanges():\n s, e = 1, 1\n for i in bpy.data.actions:\n ts, te = i.frame_...
python
chosen
[ { "from": "system", "value": "Add sample param to Standard Deviation function\n\nBoolean param to make possible to calculate Standard Deviation\nfor population (Default is sample).\n" }, { "from": "human", "value": "import math\nfrom .variance import variance\n\ndef standard_deviation(data):\n ...
python
chosen
[ { "from": "system", "value": "Add T0 to the symbols available through the API\n" }, { "from": "human", "value": "\"\"\"Top-level objects and functions offered by the Skyfield library.\n\nImporting this ``skyfield.api`` module causes Skyfield to load up the\ndefault JPL planetary ephemeris ``de42...
python
chosen
[ { "from": "system", "value": "Set docstrings for check functions\n" }, { "from": "human", "value": "#!/usr/bin/env python\nimport socket\nimport sys\n\n\ndef host(name):\n return socket.gethostname() == name\n\ndef arg(name, expected_value=None):\n args = [\n arg.split('=') for arg ...
python
chosen
[ { "from": "system", "value": "Make DQN backward compatible with pytorch 0.1.2.\n" }, { "from": "human", "value": "from torch.autograd import Variable\n\n\nclass DeterministicPolicy(object):\n def __init__(self, policy):\n \"\"\"Assumes policy returns an autograd.Variable\"\"\"\n\n ...
python
chosen
[ { "from": "system", "value": "Fix warning in test suite when running under Django 1.11\n" }, { "from": "human", "value": "from django.db import models\nfrom django.utils.encoding import python_2_unicode_compatible\n\nfrom ..base import ModelLookup\nfrom ..registry import registry\n\n\n@python_2_...
python
chosen
[ { "from": "system", "value": "Add docstring to Dojo class\n" }, { "from": "human", "value": "class Dojo(object):\n\n def __init__(self):\n self.all_rooms = []\n self.all_people = []\n\n def create_room(self, room_type, room_name):\n pass\n\n\n" }, { "from": "gp...
python
chosen
[ { "from": "system", "value": "Make the use of quotes consistent.\n" }, { "from": "human", "value": "# Copyright 2015 Google Inc. All Rights Reserved.\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may not use this file except in compliance with the License.\n# You...
python
chosen
[ { "from": "system", "value": "Use utils to simplify code\n" }, { "from": "human", "value": "from .errors import ShakespeareRuntimeError\n\n\nclass Character:\n \"\"\"A character in an SPL play.\"\"\"\n\n def __init__(self, name):\n self.value = 0\n self.stack = []\n se...
python
chosen
[ { "from": "system", "value": "Order offers by company name\n\nCloses #373\n" }, { "from": "human", "value": "import graphene\nfrom .models import Offer\nfrom . import types\n\n\nclass Query(graphene.ObjectType):\n all_offers = graphene.List(types.Offer)\n\n def resolve_all_offers(self, inf...
python
chosen
[ { "from": "system", "value": "Add first pass at docs\n" }, { "from": "human", "value": "from tx_people.mixins import *\n\n\nclass DenormalizeOnSaveMixin(object):\n def save(self, denormalize=True, *args, **kwargs):\n obj = super(DenormalizeOnSaveMixin, self).save(*args, **kwargs)\n ...
python
chosen
[ { "from": "system", "value": "Update imports and added PyQt4 support\n" }, { "from": "human", "value": "import sys\nfrom PyQt5.QtCore import *\nfrom PyQt5.QtGui import *\nfrom PyQt5.QtWidgets import *\n\n\nclass ComboBox(QWidget):\n def __init__(self, parent=None, items=[]):\n super(Co...
python
chosen
[ { "from": "system", "value": "Add method for debug output\n" }, { "from": "human", "value": "# Copyright 2013 John Reese\n# Licensed under the MIT license\n\nimport logging\n\nlogging.addLevelName(logging.DEBUG, 'DBG')\nlogging.addLevelName(logging.INFO, 'INF')\nlogging.addLevelName(logging.WARN...
python
chosen
[ { "from": "system", "value": "Add post import hook discovery to public API.\n" }, { "from": "human", "value": "__version_info__ = ('1', '10', '3')\n__version__ = '.'.join(__version_info__)\n\nfrom .wrappers import (ObjectProxy, CallableObjectProxy, FunctionWrapper,\n BoundFunctionWrapper,...
python
chosen
[ { "from": "system", "value": "Remove (potentialy dangerous) data path recreation\n" }, { "from": "human", "value": "# pylint: disable=missing-docstring\nfrom __future__ import absolute_import, division, print_function, unicode_literals\n\nimport os\nimport shutil\n\nfrom django.conf import setti...
python
chosen
[ { "from": "system", "value": "Revert to using += to increment user's lines\nDoing it the \"atomic\" way was causing str(user.num_lines) to become \"\"user\".num_lines + :num_lines_1\" which is not intended\n" }, { "from": "human", "value": "import logging\n\nfrom pajbot.managers.handler import H...
python
chosen
[ { "from": "system", "value": "Remove a no longer used setting\n\nWith the removal of eventlet there is no longer a mechanism for\ntiming out a synchronization.\n" }, { "from": "human", "value": "from __future__ import absolute_import\nfrom __future__ import division\nfrom __future__ import unico...
python
chosen
[ { "from": "system", "value": "Make sure to load_backend as part of load_plugins\n" }, { "from": "human", "value": "from pkg_resources import iter_entry_points\n\nfrom spicedham.config import load_config\n\n_plugins = None\n\ndef load_plugins():\n \"\"\"\n If not already loaded, load plugin...
python
chosen
[ { "from": "system", "value": "Improve station-sensor link field addition to reading model migration using a paging system to prevent the migration being killed automatically.\n" }, { "from": "human", "value": "# -*- coding: utf-8 -*-\n# Generated by Django 1.10.6 on 2017-06-23 03:08\nfrom __futu...
python
chosen
[ { "from": "system", "value": "Allow receive of future-dated samples\n" }, { "from": "human", "value": "## Script (Python) \"guard_receive_transition\"\n##bind container=container\n##bind context=context\n##bind namespace=\n##bind script=script\n##bind subpath=traverse_subpath\n##parameters=\n##t...
python
chosen
[ { "from": "system", "value": "Fix URL patterns for ManufacturerPart and SupplierPart\n" }, { "from": "human", "value": "\"\"\"\nURL lookup for Company app\n\"\"\"\n\nfrom django.conf.urls import url, include\n\nfrom . import views\n\n\ncompany_detail_urls = [\n\n url(r'^thumb-download/', view...
python
chosen
[ { "from": "system", "value": "Add docstring for one-offish campaign_for_user\n" }, { "from": "human", "value": "import httplib as http\n\nfrom framework.exceptions import HTTPError\n\nfrom website import mails\n\nVALID_CAMPAIGNS = (\n 'prereg',\n)\n\nEMAIL_TEMPLATE_MAP = {\n 'prereg': mail...
python
chosen
[ { "from": "system", "value": "Update importing werkzeug middleware to support python3\n" }, { "from": "human", "value": "# -*- coding: utf-8 -*-\n\"\"\"\n wsgi\n ~~~~\n\n entrypoint wsgi script\n\"\"\"\n\nfrom werkzeug.serving import run_simple\nfrom werkzeug.wsgi import DispatcherMiddl...
python
chosen
[ { "from": "system", "value": "Test that scaling doesn't rotate vectors\n" }, { "from": "human", "value": "import pytest # type: ignore\nfrom hypothesis import assume, given\nfrom hypothesis.strategies import floats\nfrom math import isclose\nfrom utils import vectors\n\nfrom ppb_vector import V...
python
chosen
[ { "from": "system", "value": "Change default in migration file to be short enough\n" }, { "from": "human", "value": "# Generated by Django 3.0.2 on 2020-03-04 22:05\n\nfrom django.db import migrations, models\n\n\nclass Migration(migrations.Migration):\n\n dependencies = [\n ('userprof...
python
chosen
[ { "from": "system", "value": "Add the documentation to the web site.\n\n" }, { "from": "human", "value": "# Template makedist.py file\n\n# Set WEBSITE to the name of the web site that this package will be\n# deposited in. The URL will always be:\n#\thttp://$WEBSITE/$PACKAGE/\nWEBSITE = 'untroub...
python
chosen
[ { "from": "system", "value": "Refactor rietveld.event_handler test to use pytest-qt\n" }, { "from": "human", "value": "from __future__ import absolute_import, print_function\nimport unittest\nfrom qtpy.QtWidgets import QApplication\nfrom addie.rietveld import event_handler\n\n\nclass RietveldEve...
python
chosen
[ { "from": "system", "value": "Support both json and stdout the same\n" }, { "from": "human", "value": "import csv\nfrom argparse import ArgumentParser\nfrom json import dumps\n\nfrom pycargr.model import to_dict\nfrom pycargr.parser import parse_car_page\n\nparser = ArgumentParser()\nparser.add_...
python
chosen
[ { "from": "system", "value": "Add signals to call staticgenerator\n" }, { "from": "human", "value": "\nfrom django.db import models\n\nFORMAT_CHOICES = (\n ('html', 'Raw HTML'),\n ('markdown', 'Markdown'),\n)\n\nclass Blog(models.Model):\n date = models.DateTimeField(auto_now_add=True)\...
python
chosen
[ { "from": "system", "value": "Add enter and exit methods.\n" }, { "from": "human", "value": "#!/usr/bin/env python\n\"\"\"\nTiming context manager\n\"\"\"\n\n\nclass Timer:\n\n def __enter__(self):\n pass\n\n \n" }, { "from": "gpt", "value": "#!/usr/bin/env python\n\...
python
chosen
[ { "from": "system", "value": "[IMP] Use TransientModel for the dummy model used in translation testing\n" }, { "from": "human", "value": "# -*- coding: utf-8 -*-\nimport openerp\nfrom openerp.tools.translate import _\n\nclass m(openerp.osv.osv.Model):\n \"\"\" A model to provide source string...
python
chosen
[ { "from": "system", "value": "Fix broxen import in Python 3\n" }, { "from": "human", "value": "\"\"\"Core pep438 utility functions\"\"\"\nfrom __future__ import unicode_literals\n\nimport requests\nimport xmlrpclib\nimport lxml.html\nfrom requirements import parse\n\n\ndef valid_package(package_...
python
chosen
[ { "from": "system", "value": "Set attachment color based on log level\n" }, { "from": "human", "value": "import json\nimport traceback\nfrom logging import Handler\n\nfrom slacker import Slacker\n\n\nclass SlackLogHandler(Handler):\n def __init__(self, api_key, channel, stack_trace=False, use...
python
chosen
[ { "from": "system", "value": "Switch to GA universal id.\n" }, { "from": "human", "value": "#!/usr/bin/env python\n# -*- coding: utf-8 -*- #\nfrom __future__ import unicode_literals\n\n# This file is only used if you use `make publish` or\n# explicitly specify it as your config file.\n\nimport o...
python
chosen
[ { "from": "system", "value": "Refactor comic availability test to reflect changes to Comic class\n" }, { "from": "human", "value": "import pytest\n\nfrom webcomix.comic import Comic\nfrom webcomix.supported_comics import supported_comics\nfrom webcomix.util import check_first_pages\n\n\n@pytest....
python
chosen
[ { "from": "system", "value": "Add method for formatting client info (address, port, id)\n" }, { "from": "human", "value": "# Copyright (c) 2015 Nicolas JOUANIN\n#\n# See the file license.txt for copying permission.\n\n\ndef not_in_dict_or_none(dict, key):\n \"\"\"\n Check if a key exists i...
python
chosen
[ { "from": "system", "value": "Test failed because these was no expected-output file, but always printed\nto stdout. Repaired by not printing at all except in verbose mode.\n\nMade the test about 6x faster -- envelope analysis showed it took time\nproportional to the square of the # of tasks. Now it's line...
python
chosen
[ { "from": "system", "value": "Add check on ScatterSeries repr\n" }, { "from": "human", "value": "from unittest import TestCase\nfrom unittest.mock import patch\nfrom quickplots.series import ScatterSeries, Series\n\nclass LineSeriesCreationTests(TestCase):\n\n def test_can_create_line_series(...
python
chosen
[ { "from": "system", "value": "Remove old 3.x API cruft\n" }, { "from": "human", "value": "import dbus\n\nbus = dbus.SystemBus()\n\n\ndummy = dbus.Interface(bus.get_object('org.bluez', '/org/bluez'), 'org.freedesktop.DBus.Introspectable')\n\n#print dummy.Introspect()\n\n\nmanager = dbus.Interface...
python
chosen
[ { "from": "system", "value": "Add test_read_search_result() to test reading data from a local .html\n" }, { "from": "human", "value": "from scraper import search_CL\n\n\ndef test_search_CL():\n test_body, test_encoding = search_CL(minAsk=100)\n assert \"<span class=\\\"desktop\\\">craigsli...
python
chosen
[ { "from": "system", "value": "Allow passing User directly to get_change_metadata\n" }, { "from": "human", "value": "import sys\nfrom datetime import datetime\nfrom random import randint\n\n\ndef get_client_ip(request):\n x_forwarded_for = request.META.get(\"HTTP_X_FORWARDED_FOR\")\n if x_f...
python
chosen
[ { "from": "system", "value": "Stop writing Java code :/\n" }, { "from": "human", "value": "# LING 573 Question Answering System\n# Code last updated 4/17/14 by Clara Gordon\n# This code implements an InfoRetriever for the question answering system.\n\n\nfrom pymur import *\nfrom general_classes ...
python
chosen
[ { "from": "system", "value": "Drop config argument from ChangeAPI\n" }, { "from": "human", "value": "import changeling.models\n\n\nclass ChangeAPI(object):\n def __init__(self, config, storage):\n self.config = config\n self.storage = storage\n\n def list(self):\n for ...
python
chosen
[ { "from": "system", "value": "Update context manager test script\n" }, { "from": "human", "value": "import judicious\n\njudicious.seed(\"cc722bf6-e319-cf63-a671-cbae64dfdb0f\")\n\n# 1 (complete): 3799aa89-ccae-c268-d0e8-cc4e9ddddee4\n# 2 (timeout) : 4d30601d-dfe3-ee53-8594-7fc0aa8e68ec\n# 3 (com...
python
chosen
[ { "from": "system", "value": "Set acquisition freq to 1 minute.\n" }, { "from": "human", "value": "from servers.models import HttpSeries\n\nfrom django_cron import CronJobBase, Schedule\n\n\nclass HttpSeriesCronJob(CronJobBase):\n RUN_EVERY_MINS = 2\n schedule = Schedule(run_every_mins=RUN...
python
chosen
[ { "from": "system", "value": "Move import in try except (forgot the others)\n\n" }, { "from": "human", "value": "# -*- encoding: utf-8 -*-\r\nfrom __future__ import absolute_import\r\n\r\nfrom .client import EsiClient # noqa\r\nfrom .security import EsiSecurity # noqa\r\n\r\ntry:\r\n from p...
python
chosen
[ { "from": "system", "value": "Enforce minimum PO value for supplier.\n" }, { "from": "human", "value": "# -*- coding: utf-8 -*-\n\n##############################################################################\n#\n# Set minimum order on suppliers\n# Copyright (C) 2016 OpusVL (<http://opusvl.com/...
python
chosen
[ { "from": "system", "value": "Add note and fatal to Log\n" }, { "from": "human", "value": "import sys\nfrom colors import Colors\n\nclass Log:\n\n @classmethod\n def print_msg(cls, title, msg, color, new_line = True):\n Log.raw(\"{0}{1}{2}: {3}\".format(color, title, Colors.NORMAL, msg), ne...
python
chosen
[ { "from": "system", "value": "Sort constant names alphabetically in docstring" }, { "from": "human", "value": "\"\"\"\nContains astronomical and physical constants for use in Astropy or other\nplaces.\n\nThe package contains a `~astropy.constants.cgs` and `~astropy.constants.si`\nmodule that def...
python
chosen
[ { "from": "system", "value": "LIKA-410: Add not allowed organization test\n" }, { "from": "human", "value": "import pytest\nfrom ckan.tests.factories import User, Dataset, Organization\nfrom ckan.plugins.toolkit import get_action\n\n\n@pytest.mark.usefixtures('with_plugins', 'clean_db', 'clean_i...
python
chosen
[ { "from": "system", "value": "Move now sets the client position and allows the\nmovement plugin do its thing" }, { "from": "human", "value": "import logging\nfrom spock.mcp import mcdata, mcpacket\nfrom spock.mcmap import smpmap\nfrom micropsi_core.world.minecraft.psidispatcher import PsiDispatc...
python
chosen
[ { "from": "system", "value": "Test project: update settings names\n" }, { "from": "human", "value": "DJMERCADOPAGO_CLIENT_ID = 'your-mp-client-id'\nDJMERCADOPAGO_CLIENTE_SECRET = 'your-mp-secret'\nDJMERCADOPAGO_SANDBOX_MODE = True\nDJMERCADOPAGO_CHECKOUT_PREFERENCE_BUILDER = \\\n 'full.path.t...
python
chosen
[ { "from": "system", "value": "Add logging to Twitch emotes module\n" }, { "from": "human", "value": "from io import BytesIO\nimport requests\n\nfrom discord.ext import commands\nfrom discord.ext.commands import Bot\n\nTWITCH_EMOTES_API = 'https://twitchemotes.com/api_cache/v2/global.json'\n\n\nc...
python
chosen
[ { "from": "system", "value": "Update release version to 0.0.2\n" }, { "from": "human", "value": "\"\"\"\nA machine readable multilingual dialog corpus.\n\"\"\"\nfrom .corpus import Corpus\n\n__version__ = '0.0.1'\n__author__ = 'Gunther Cox'\n__email__ = 'gunthercx@gmail.com'\n__url__ = 'https://...
python
chosen
[ { "from": "system", "value": "fix: Add django version check for default_app_config\n" }, { "from": "human", "value": "from pathlib import Path\n\n__version__ = (Path(__file__).parent / \"VERSION\").open().read().strip()\n\ndefault_app_config = 'modeltranslation.apps.ModeltranslationConfig'\n" ...
python
chosen
[ { "from": "system", "value": "Add a generic utility to check any binary availability\n\nIn order to run, some test programs depend on the availability\nof binaries in locations that are part of PATH. So, we add a\ngeneric utility to simplify this.\n\nSigned-off-by: Sandipan Das <ae8113f64d9c72812e097938d25a...
python
chosen
[ { "from": "system", "value": "Put the JSON serializer in celery development settings, this has helped me a lot." }, { "from": "human", "value": "BROKER_URL = 'redis://{0}:6379/1'.format(MAIN_SERVER)\nCELERY_RESULT_BACKEND = BROKER_URL\n" }, { "from": "gpt", "value": "BROKER_URL = 're...
python
chosen
[ { "from": "system", "value": "Increase appengine-vm-runtime version field to 0.65\n" }, { "from": "human", "value": "# Copyright 2016 Google Inc. All Rights Reserved.\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may not use this file except in compliance with th...
python
chosen
[ { "from": "system", "value": "Create an address if none exists for a user\n" }, { "from": "human", "value": "from django.db import models\nfrom bluebottle.bb_accounts.models import BlueBottleBaseUser\nfrom bluebottle.utils.models import Address\nfrom djchoices.choices import DjangoChoices, Choic...
python
chosen
[ { "from": "system", "value": "Switch polling URL to git-on-borg.\n\nTBR=mmoss@chromium.org,cmp@chromium.org\nReview URL: https://codereview.chromium.org/12152002\n\ngit-svn-id: 239fca9b83025a0b6f823aeeca02ba5be3d9fd76@179999 0039d316-1c4b-4281-b951-d872f2087c98\n" }, { "from": "human", "value": ...
python
chosen
[ { "from": "system", "value": "Fix for my nefarious `warn` replacement\n" }, { "from": "human", "value": "import sys\nimport warnings\nfrom warnings import warn as orig_warn\n\n\ndef my_warn(message, category=None, stacklevel=1):\n # taken from warnings module\n # Get context information\n ...
python
chosen
[ { "from": "system", "value": "Add a method to create a measurement." }, { "from": "human", "value": "# -*- coding: utf-8 -*-\n\nfrom sqlalchemy import (\n Column,\n Date,\n Integer,\n MetaData,\n Numeric,\n String,\n Table,\n)\n\n\ndef define_tables(metadata):\n Table('me...
python
chosen
[ { "from": "system", "value": "Add a flash message for empty zone list" }, { "from": "human", "value": "# -*- coding: utf-8 -*-\n\"\"\" Tools for geographical zones management.\"\"\"\nimport logging\nfrom pyramid.view import view_config\nfrom webhelpers import paginate\n\n\nfrom anuket.models imp...
python
chosen
[ { "from": "system", "value": "Check for site config file\n" }, { "from": "human", "value": "import os\nimport sys\nfrom importlib import machinery as imp\n\nfrom stayput import Site\n\n\ndef main():\n cwd = os.path.abspath(os.getcwd())\n site = Site(root_path=cwd)\n site.scan()\n\n #...
python
chosen
[ { "from": "system", "value": "Fix missing import in contrib script added in [2630].\n\ngit-svn-id: f68c6b3b1dcd5d00a2560c384475aaef3bc99487@2631 af82e41b-90c4-0310-8c96-b1721e28e2e2\n" }, { "from": "human", "value": "#!/usr/bin/env python\n# \n# This script completely migrates a <= 0.8.x Trac en...
python
chosen
[ { "from": "system", "value": "Disable autoreload in integration tests\n" }, { "from": "human", "value": "import os\nimport subprocess\n\nimport pytest\nfrom chalice.utils import OSUtils\n\nCURRENT_DIR = os.path.dirname(os.path.abspath(__file__))\nPROJECT_DIR = os.path.join(CURRENT_DIR, 'testapp'...
python
chosen
[ { "from": "system", "value": "Change host test to check for 'irrigatorpro' instead of my laptop's\nname, since the latter changes depending on the (wireless) network.\n\n" }, { "from": "human", "value": "\"\"\"\nWSGI config for irrigator_pro project.\n\nIt exposes the WSGI callable as a module-l...
python
chosen
[ { "from": "system", "value": "TEST: Update Security class unit tests for Python3 compatibility\n" }, { "from": "human", "value": "from unittest import TestCase\nfrom zipline.assets._securities import Security\n\n\nclass TestSecurityRichCmp(TestCase):\n def test_lt(self):\n self.assertT...
python
chosen
[ { "from": "system", "value": "Make bouncer script pull from mlab-ns simulator\n" }, { "from": "human", "value": "#!/usr/bin/env python\n\nimport sys\nimport yaml\n\ndef read_parts_from_stdin():\n data = sys.stdin.read()\n parts_string = data.split(\"----\")\n parts_parsed = []\n for ...
python
chosen