conversations
listlengths
2
3
source
stringclasses
1 value
stack
stringclasses
1 value
[ { "from": "system", "value": "Add include keyword arg to is_tranformed\n" }, { "from": "human", "value": "import json\n\n\ndef is_transformed(transform, predicate, *args, exceptions=[\n Exception\n], msg='data can\\'t be transformed', **kwargs):\n def is_valid(data, explain=False):\n ...
python
chosen
[ { "from": "system", "value": "Test service with Component instead of Plan db object\n\nSince plan db objects are getting removed in add-plan-in-swift,\nwe need to test service with another object.\n\nChange-Id: I85537ef17f8c125d3de85ab3625ea91e9487376f\n" }, { "from": "human", "value": "# Licens...
python
chosen
[ { "from": "system", "value": "Fix ValueError when flowid is ???\n\nA filter like the following:\n tc filter add dev srvif parent 1: protocol ip u32 match ip dst 1.2.3.4/32 action drop\nis reported in \"tc show filter\" as:\n filter parent 1: protocol ip [...] flowid ??? [..]\n" }, { "from": "human...
python
chosen
[ { "from": "system", "value": "Add an exception if ssh not configured\n" }, { "from": "human", "value": "# -*- coding: utf-8 -*-\n__author__ = 'John Moylan'\nfrom paramiko import SSHClient, SSHConfig, AutoAddPolicy\n\nfrom pyvarnish.settings import SSH_CONFIG\n\n\nclass Varnish_admin():\n\n de...
python
chosen
[ { "from": "system", "value": "Use analysis base class form helper and form building blocks\n" }, { "from": "human", "value": "from crispy_forms.bootstrap import FormActions\nfrom crispy_forms.helper import FormHelper\nfrom crispy_forms.layout import Div, Field, Fieldset, HTML, Layout, Submit\nfr...
python
chosen
[ { "from": "system", "value": "Update SHOW TYPES command to handle no types being created\n" }, { "from": "human", "value": "from enum import Enum\nfrom graphene.commands.command import Command\nfrom graphene.utils import PrettyPrinter\n\nclass ShowCommand(Command):\n class ShowType(Enum):\n ...
python
chosen
[ { "from": "system", "value": "Fix import time issue with member_required decorator.\n" }, { "from": "human", "value": "from flask import flash, redirect\nfrom flask_login import current_user\nimport wrapt\n\nfrom ..account.views import default_url\n\n\ndef member_required(next_url=None, message=...
python
chosen
[ { "from": "system", "value": "Add the URL mappings for the plots app.\n" }, { "from": "human", "value": "__author__ = 'ankesh'\nfrom django.conf.urls import patterns, url\n" }, { "from": "gpt", "value": "__author__ = 'ankesh'\nfrom django.conf.urls import patterns, url\nfrom plots.vi...
python
chosen
[ { "from": "system", "value": "Make version match that from setup.py\n" }, { "from": "human", "value": "# keep this at the top -- name is needed for imports to succeed\nNOTEBOOK_TEMPLATE_NAME = 'reducer-template.ipynb'\n\n__version__ = '0.1.dev8'\n\nfrom .core import *\n" }, { "from": "gp...
python
chosen
[ { "from": "system", "value": "Switch to 2311 + 2357 branches\n" }, { "from": "human", "value": "# Copyright 2015 The Chromium Authors. All rights reserved.\n# Use of this source code is governed by a BSD-style license that can be\n# found in the LICENSE file.\n\n\nAUTOMERGER_NAME = 'Chromium+Bli...
python
chosen
[ { "from": "system", "value": "Fix check on the user's status when retrieving it\n" }, { "from": "human", "value": "from twisted.plugin import IPlugin\nfrom txircd.module_interface import IModuleData, ModuleData\nfrom zope.interface import implements\n\nclass StatusReport(ModuleData):\n\timplemen...
python
chosen
[ { "from": "system", "value": "[FIX] Set website in manifest to OCA repository" }, { "from": "human", "value": "# -*- coding: utf-8 -*-\n# Copyright 2018 Onestein (<http://www.onestein.eu>)\n# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).\n\n{\n 'name': 'Partner CoC',\n 'su...
python
chosen
[ { "from": "system", "value": "Remove python 3 syntax for python 2 compatibility\n" }, { "from": "human", "value": "from django.contrib.auth.models import AnonymousUser\nfrom django.db.models.base import ModelBase\nfrom django.test import TestCase\nfrom rest_framework.test import APIRequestFactor...
python
chosen
[ { "from": "system", "value": "Fix imports of past.builtins types\n" }, { "from": "human", "value": "from past import utils\n\nif utils.PY2:\n import __builtin__\n basestring = __builtin__.basestring\n dict = __builtin__.dict\n str = __builtin__.str\n long = __builtin__.long\n u...
python
chosen
[ { "from": "system", "value": "Set default_auto_field in wagtail.contrib.postgres_search AppConfig\n\nAdd default_auto_field = 'django.db.models.AutoField'\r\n\r\nCo-authored-by: Nick Moreton <7f1a4658c80dbc9331efe1b3861c4063f4838748@torchbox.com>" }, { "from": "human", "value": "from django.apps...
python
chosen
[ { "from": "system", "value": "Add section session varialbes to facilitate redirects\n" }, { "from": "human", "value": "from collections import namedtuple\n\nCONTENT_TYPES = [\n (\"core.ArticlePage\", \"Article\"),\n (\"core.SectionPage\", \"Section\"),\n]\n\nENDPOINTS = [\n (\"page\", \...
python
chosen
[ { "from": "system", "value": "Change adapter; fix filter func\n" }, { "from": "human", "value": "from requests.adapters import HTTPAdapter\n\n\nRetryAdapter = HTTPAdapter(max_retries=5)\n\n\ndef create_db_url(username, passwd, host, port):\n if username and passwd:\n cr = '{}:{}@'.form...
python
chosen
[ { "from": "system", "value": "FIX: Remove dependancy on vtkVersion\n Place a try/except around modules that required Numeric\n" }, { "from": "human", "value": "\"\"\"\nVTK.py \nAn VTK module for python that includes:\n\nWrappers for all the VTK classes that are wrappable\n\nA Tkinter vtkRend...
python
chosen
[ { "from": "system", "value": "Handle other kinds of errors.\n" }, { "from": "human", "value": "from bs4 import BeautifulSoup\n\nclass WWTException(Exception):\n pass\n\ndef handle_response(resp_str):\n soup = BeautifulSoup(resp_str)\n success = soup.layerapi.status.string\n if succes...
python
chosen
[ { "from": "system", "value": "Fix plural name for Categories model.\n" }, { "from": "human", "value": "# -*- coding: utf-8 -*-\nfrom __future__ import unicode_literals\n\nfrom django.db import models\nfrom django.utils import timezone\n\n# Create your models here.\n\nclass Event(models.Model):\n...
python
chosen
[ { "from": "system", "value": "Add extra config file env variable option\n\nChange-Id: Ic88b442098eff0c2e3a8cc3cb527fa3d29f085ea\n" }, { "from": "human", "value": "# Copyright (c) 2014 Rackspace, Inc.\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may not use this ...
python
chosen
[ { "from": "system", "value": "Remove the decorate `facts` from mapper `Hostname`\n\n- And update the class comment\n" }, { "from": "human", "value": "from .. import Mapper, mapper\n\n\n@mapper(\"facts\")\n@mapper(\"hostname\")\nclass Hostname(Mapper):\n\n def parse_content(self, content):\n ...
python
chosen
[ { "from": "system", "value": "Make port removing migrating a bit less flaky\n" }, { "from": "human", "value": "# Generated by Django 2.0.13 on 2019-12-29 21:11\n\nfrom django.db import migrations\nfrom django.db.migrations import RunPython\n\n\ndef forward(apps, schema):\n Node = apps.get_mod...
python
chosen
[ { "from": "system", "value": "Make mixed precision API available in `keras.mixed_precision`.\n\nPiperOrigin-RevId: 433886558\n" }, { "from": "human", "value": "# Copyright 2020 The TensorFlow Authors. All Rights Reserved.\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n#...
python
chosen
[ { "from": "system", "value": "Add unittests for geoip database version\n" }, { "from": "human", "value": "import os\n\nfrom twisted.internet import defer\nfrom twisted.trial import unittest\n\nfrom ooni.tests import is_internet_connected\nfrom ooni.settings import config\nfrom ooni import geoip\...
python
chosen
[ { "from": "system", "value": "Fix Python3-incompatible use of print.\n" }, { "from": "human", "value": "# Copyright 2013 Mark Dickinson\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 ...
python
chosen
[ { "from": "system", "value": "Fix a bug where rez.cli.output() errors when called without args. should produce an empty line of output.\n" }, { "from": "human", "value": "'''\nUtilities for cli tools\n'''\nimport sys\n\ndef error(msg):\n '''\n An error, formatted and printed to stderr\n ...
python
chosen
[ { "from": "system", "value": "Fix C++ accelerator constructor invocation\n" }, { "from": "human", "value": "import numpy as np\nimport pandas as pd\nfrom typing import Tuple, List\n\nfrom queryexpander.semantic_similarity import CppSemanticSimilarity\n\n\nclass QueryExpander:\n def __init__(s...
python
chosen
[ { "from": "system", "value": "Update auth backend to support kwargs\n" }, { "from": "human", "value": "from django.contrib.auth import get_user_model\n\n\nclass EmailAuthBackend(object):\n \"\"\"Docstring for EmailAuthBackend \"\"\"\n\n def authenticate(self, username=None, password=None):...
python
chosen
[ { "from": "system", "value": "Make the bot respond to its name\n\nImplements GH-7\n" }, { "from": "human", "value": "from twisted.plugin import IPlugin\nfrom heufybot.moduleinterface import BotModule, IBotModule\nfrom zope.interface import implements\n\n\nclass CommandHandler(BotModule):\n im...
python
chosen
[ { "from": "system", "value": "Test implicit `doCleanups` on tearDown\n" }, { "from": "human", "value": "from unittesting import DeferrableTestCase\n\n\nclass TestDoCleanups(DeferrableTestCase):\n\n def test_ensure_do_cleanups_works(self):\n messages = []\n\n def work(message):\n...
python
chosen
[ { "from": "system", "value": "Tweak parameters and allow runs over multiple networks\n" }, { "from": "human", "value": "from keras.models import Sequential\nfrom keras.layers import Dense, Dropout\nimport sys\nimport numpy as np\n\ndef main():\n input_filename = sys.argv[1]\n\n training = ...
python
chosen
[ { "from": "system", "value": "Add colorama for coloring on windows\n\nAdd the module colorama that makes ANSI escape character sequences work under MS Windows. The coloring is used to give a better overview about the testresults\n" }, { "from": "human", "value": "#!/usr/bin/env python2\nimport o...
python
chosen
[ { "from": "system", "value": "Abort migrations check if a version is present more than once\n\nlist_migrations checks whether we have more than one branch in the\nlist of migration versions. Since we've switched to a new revision\nnaming convention, pull requests open at the same time are likely\nto use the...
python
chosen
[ { "from": "system", "value": "Use self.assertEqual instead of assert\n\nChange-Id: Icae26d907eec2c4ab9f430c69491a96bd549c45a\n" }, { "from": "human", "value": "# Copyright 2014 - Savoir-Faire Linux inc.\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\"); you may\n# not use th...
python
chosen
[ { "from": "system", "value": "Set booked_by for cloned/additional showings\n" }, { "from": "human", "value": "from django import forms\nimport cube.diary.models\n\nclass DiaryIdeaForm(forms.ModelForm):\n class Meta(object):\n model = cube.diary.models.DiaryIdea\n\nclass EventForm(forms...
python
chosen
[ { "from": "system", "value": "Fix typo in T1SearchPath name\n" }, { "from": "human", "value": "#copyright ReportLab Inc. 2000-2001\n#see license.txt for license details\n#history http://cvs.sourceforge.net/cgi-bin/cvsweb.cgi/reportlab/rl_config.py?cvsroot=reportlab\n#$Header: /tmp/reportlab/repo...
python
chosen
[ { "from": "system", "value": "Bump version to 1.0.1 for unit test fix.\n" }, { "from": "human", "value": "import os.path\r\n\r\nVERSION = (1, 0, 0, 'stable')\r\n\r\n\r\ndef get_version():\r\n \"\"\"\r\n Return the version as a string. If this is flagged as a development\r\n release and ...
python
chosen
[ { "from": "system", "value": "Update SymPy/IPython version in test script\n" }, { "from": "human", "value": "#!/usr/bin/env python\n\ntry:\n import sympy\nexcept ImportError:\n print(\"sympy is required\")\nelse:\n\n if sympy.__version__ < '0.7.5':\n print(\"SymPy version 0.7.5 o...
python
chosen
[ { "from": "system", "value": "Add PlaybookFile edit view url\n" }, { "from": "human", "value": "from django.conf.urls import url\nfrom ansible.forms import AnsibleForm1, AnsibleForm2\nfrom ansible.views import (\n PlaybookWizard, PlaybookListView, PlaybookDetailView,\n PlaybookFileView\n)\...
python
chosen
[ { "from": "system", "value": "Fix broken attempts to open r+ non existant files\n" }, { "from": "human", "value": "import os\n\n\nclass Gref(object):\n def __init__(self, store, channel, identifier):\n self.store = store\n self.channel = channel.replace(\"/\", \"_\")\n se...
python
chosen
[ { "from": "system", "value": "Use Task instead of run_until_complete\n" }, { "from": "human", "value": "import asyncio\nimport logging\n\n# https://pypi.python.org/pypi/websockets\nimport websockets\n\nclients = set()\nlogging.basicConfig(level=logging.INFO)\n\n\n@asyncio.coroutine\ndef chat(web...
python
chosen
[ { "from": "system", "value": "Add a setting so that people can disable mirrored saves\n" }, { "from": "human", "value": "import os\n\n__VERSION__ = ''\n__PLUGIN_VERSION__ = ''\n\n# Config settings\nUSERNAME = ''\nSECRET = ''\nAPI_KEY = ''\n\nDEBUG = False\nSOCK_DEBUG = False\n\nALERT_ON_MSG = Tr...
python
chosen
[ { "from": "system", "value": "Use source keyword argument (instead of overriding get_attribute)\n\nThis allows the ImageRenditionField to be used on models that contain an\nimage field.\n" }, { "from": "human", "value": "from __future__ import absolute_import, unicode_literals\n\nfrom collection...
python
chosen
[ { "from": "system", "value": "Use leonardo helper for declare html text widget.\n" }, { "from": "human", "value": "\nfrom django.apps import AppConfig\nfrom django.utils.translation import ugettext_lazy as _\n\ndefault_app_config = 'leonardo_agenda.Config'\n\nLEONARDO_OPTGROUP = 'Events'\n\nLEON...
python
chosen
[ { "from": "system", "value": "Add support for XDG spec configuration\n" }, { "from": "human", "value": "import json\nimport os\n\nfrom jinja2 import Environment, FileSystemLoader\n\nBASE_PATH = os.path.abspath(os.path.dirname(__file__))\nDATA_PATH = os.path.join(BASE_PATH, 'data')\nTEMPLATE_PATH...
python
chosen
[ { "from": "system", "value": "Add some tests for the model\n" }, { "from": "human", "value": "import unittest\nfrom datetime import datetime\nfrom twofa import create_app, db\nfrom twofa.models import User\n\n\nclass UserTestCase(unittest.TestCase):\n def setUp(self):\n self.app = crea...
python
chosen
[ { "from": "system", "value": "Add docopt - not finished\n" }, { "from": "human", "value": "import threading\nimport socket\nimport logging\nimport os\nimport colorama\nfrom termcolor import colored\nfrom collections import deque\n\n\nmarkerStack = deque([''])\n\ndef colorMessage(message):\n i...
python
chosen
[ { "from": "system", "value": "Verify fails travis-ci due to pylama (just a test\n" }, { "from": "human", "value": "# Copyright 2016 Dravetech AB. All rights reserved.\n#\n# The contents of this file are licensed under the Apache License, Version 2.0\n# (the \"License\"); you may not use this fil...
python
chosen
[ { "from": "system", "value": "Remove test driver exceptions for bslstl_iteratorutil and bslstl_unorderedmultiset on Sun\n" }, { "from": "human", "value": "{\n 'bslstl_iteratorutil': [ {'OS': 'SunOS'} ],\n 'bslstl_unorderedmultiset': [ {'OS': 'SunOS'} ],\n 'bsls_atomic' : [\n {'ca...
python
chosen
[ { "from": "system", "value": "Add expiration value of 5m to the session.\n" }, { "from": "human", "value": "import json\nimport logging\n\nfrom django.http import HttpResponse\nfrom django.views.generic import View\nfrom django.utils.decorators import method_decorator\nfrom django.views.decorato...
python
chosen
[ { "from": "system", "value": "Use Python importlib instead of sjango.utils.importlib\n" }, { "from": "human", "value": "from django.conf import settings\nfrom django.utils.importlib import import_module\n\nclass InvalidTemplateFixture(Exception):\n pass\n\n# holds all the fixtures\ntemplate_f...
python
chosen
[ { "from": "system", "value": "Use haystack.autodiscover() again, in the hopes it no longer breaks the world\n" }, { "from": "human", "value": "################ We could, import haystack, but what's the point?\n#import haystack\n\n################# The docs suggest we do this:\n#haystack.autodisc...
python
chosen
[ { "from": "system", "value": "Add model stuff into DB\n" }, { "from": "human", "value": "#!/usr/bin/env python\n# -*- coding: utf-8 -*-\n\nfrom sqlalchemy import Table" }, { "from": "gpt", "value": "#!/usr/bin/env python\n# -*- coding: utf-8 -*-\nfrom downstream_node.startup import d...
python
chosen
[ { "from": "system", "value": "Fix date parsing having wrong offset\n" }, { "from": "human", "value": "from datetime import datetime, timedelta\nimport pytz\n\nDATE_PREFIX = '/Date('\nDATE_SUFFIX = ')/'\n\nELVIS_TIMEZONE = pytz.timezone('Europe/Tallinn')\n\n\ndef decode_elvis_timestamp(timestamp:...
python
chosen
[ { "from": "system", "value": "Add index in text field on Logging\n" }, { "from": "human", "value": "#!/usr/bin/env python\n# -*- coding: utf-8 -*-\nfrom django.db import models\nfrom django.conf import settings\nfrom django.utils.translation import ugettext_lazy as _\n\nfrom opps.core.models imp...
python
chosen
[ { "from": "system", "value": "Set up beginning template -\ndefinitely requires changes\n" }, { "from": "human", "value": "import gi\ngi.require_version('Gtk', '3.0')\nfrom gi.repository import Gtk\n\n\nclass MainWindow(Gtk.Window):\n\n def __init__(self):\n Gtk.Window.__init__(self, ti...
python
chosen
[ { "from": "system", "value": "Add policy description for instance actions\n\nThis commit adds policy doc for instance actions policies.\n\nPartial implement blueprint policy-docs\n\nChange-Id: Id336b660fb687d096cd55bf8758dc408c45f9382\n" }, { "from": "human", "value": "# Copyright 2016 Cloudbase...
python
chosen
[ { "from": "system", "value": "Update the sample proxy list\n" }, { "from": "human", "value": "\"\"\"\nProxy Server \"Phone Book\".\n\nSimplify running browser tests through a proxy server\nby adding your frequently-used proxies here.\n\nNow you can do something like this on the command line:\n\"...
python
chosen
[ { "from": "system", "value": "Add stats logging for GOG tasks\n" }, { "from": "human", "value": "\"\"\" Compare GOG games to the Lutris library \"\"\"\nimport os\nfrom celery import task\nfrom celery.utils.log import get_task_logger\nfrom django.conf import settings\n\nfrom providers.gog import ...
python
chosen
[ { "from": "system", "value": "Fix typo in localstorage test\n" }, { "from": "human", "value": "import pytest\n\nfrom roomcontrol.utils.localstorage import LocalStorage\n\n\nTEST_FILE = \"\"\"\n[kind1]\na=1\nb=2\n\n[kind]]\nc=3\n\"\"\"\n\n\n@pytest.fixture\ndef ls(tmpdir):\n p = tmpdir.join('t...
python
chosen
[ { "from": "system", "value": "Add monkeypatch for session query problems\n" }, { "from": "human", "value": "import bcrypt\nfrom sqlalchemy import create_engine\nfrom sqlalchemy.orm import scoped_session, sessionmaker\n\nfrom scoring_engine.config import config\n\n\nisolation_level = \"READ COMMI...
python
chosen
[ { "from": "system", "value": "Add a checkRaises method to check that an exception is raised, but also return it for futher tests.\n" }, { "from": "human", "value": "#!/usr/bin/python\n# -*- coding: utf-8 -*-\n\"\"\"\nUnit tests for pyes. These require an es server with thrift plugin running on ...
python
chosen
[ { "from": "system", "value": "Add a lot more tests\n" }, { "from": "human", "value": "from apiritif import http\nfrom unittest import TestCase\n\n\nclass TestRequests(TestCase):\n def test_get(self):\n http.get('http://blazedemo.com/?tag=get')\n\n def test_post(self):\n http....
python
chosen
[ { "from": "system", "value": "Fix broken bootloader build on systems that default to python3\n\nbinascii.hexlify was returning a byte array, which python would\nprint with a leading b'. Use decode() method to convert to\nstring.\n\n[ci skip]\n" }, { "from": "human", "value": "#!/usr/bin/env pyth...
python
chosen
[ { "from": "system", "value": "Add extra testcases for `sum`.\n" }, { "from": "human", "value": "from .. utils import TranspileTestCase, BuiltinFunctionTestCase\n\n\nclass SumTests(TranspileTestCase):\n pass\n\n\nclass BuiltinSumFunctionTests(BuiltinFunctionTestCase, TranspileTestCase):\n f...
python
chosen
[ { "from": "system", "value": "Add a print when running pulseaudio\n" }, { "from": "human", "value": "#!/usr/bin/env python3\n\nimport bot as chat_bot\nfrom intercom import Intercom\nimport logging\nfrom facerecognition import FaceRecognition\nimport nodered\nimport subprocess \nfrom sys import p...
python
chosen
[ { "from": "system", "value": "Add comment on FileProvider init\n\nI swear I added this prior to merging, somehow slipped through. Sorry\n" }, { "from": "human", "value": "import os\nimport io\nimport errno\nfrom xdg import BaseDirectory\nfrom .common import ProviderError\n\n\nclass Record(object...
python
chosen
[ { "from": "system", "value": "Make our python-qpid detection code use the logger, as to not anger mod_wsgi\n" }, { "from": "human", "value": "\"\"\"\nHere is where we configure which AMQP hub implementation we are going to use.\n\"\"\"\n\ntry:\n from qpid010 import QpidAMQPHub\n AMQPHub = ...
python
chosen
[ { "from": "system", "value": "Use new extension setup() API\n" }, { "from": "human", "value": "from __future__ import unicode_literals\n\nimport os\n\nfrom mopidy import ext, config\n\n__version__ = '0.2'\n\n\nclass SubsonicExtension(ext.Extension):\n\n dist_name = 'Mopidy-Subsonic'\n ext_...
python
chosen
[ { "from": "system", "value": "Make both test settings more similar\n" }, { "from": "human", "value": "__doc__ = \"\"\"Minimal django settings to run manage.py test command\"\"\"\n\nDATABASES = {\n 'default': {\n 'ENGINE': 'django.db.backends.sqlite3',\n 'NAME': __name__,\n ...
python
chosen
[ { "from": "system", "value": "Test that not all content types are overridden\n" }, { "from": "human", "value": "import pytest\nfrom rest_framework.request import Request\nfrom rest_framework.test import APIRequestFactory\n\nfrom rest_framework.parsers import JSONParser, FormParser, MultiPartPars...
python
chosen
[ { "from": "system", "value": "Fix bug in print statement\n" }, { "from": "human", "value": "\"\"\"Test garner.dates.\"\"\"\nfrom __future__ import absolute_import\n\nfrom .check import Check\nfrom proselint.checks.garner import dates\n\n\nclass TestCheck(Check):\n\n \"\"\"Test class for garne...
python
chosen
[ { "from": "system", "value": "Remove usage of deprecated NoArgsCommand\n" }, { "from": "human", "value": "from django.core.management.base import NoArgsCommand\n\nfrom ...models import Country, Region\n\n\nclass Command(NoArgsCommand):\n \"\"\"\n Countries and regions keep a denormalized c...
python
chosen
[ { "from": "system", "value": "Remove 0.0 from ings line\n" }, { "from": "human", "value": "from django.db import models\n\n# Create your models here.\nclass Ingredient(models.Model):\n name = models.CharField(max_length=100)\n abv = models.FloatField()\n type = models.CharField(max_leng...
python
chosen
[ { "from": "system", "value": "Update message for missing ResponsiveMiddleware\n" }, { "from": "human", "value": "from django.core.exceptions import ImproperlyConfigured\n\nfrom .conf import settings\nfrom .utils import Device\n\n\ndef device(request):\n responsive_middleware = 'responsive.mid...
python
chosen
[ { "from": "system", "value": "Use modern login required mixin\n" }, { "from": "human", "value": "from django.contrib.auth.decorators import login_required\nfrom django.core.exceptions import PermissionDenied\nfrom django.urls import reverse\nfrom django.utils.decorators import method_decorator\n...
python
chosen
[ { "from": "system", "value": "Make TrainingAlgorithm interface to respect reality.\n" }, { "from": "human", "value": "class TrainingAlgorithm(object):\n \"\"\"\n An abstract superclass that defines the interface of training\n algorithms.\n \"\"\"\n def setup(self, model):\n ...
python
chosen
[ { "from": "system", "value": "Add method to show a status by id.\n" }, { "from": "human", "value": "\"\"\"\nAPI Mapping for Twitter API 1.1\n\"\"\"\n\nmapping_table = {\n\n 'content_type': 'application/json',\n 'path_prefix': '/1.1',\n 'search_tweets' : {\n 'path': '/search/tweet...
python
chosen
[ { "from": "system", "value": "Add Page class and restructure hard-coded character limits\n" }, { "from": "human", "value": "from app import db\n\nclass User(db.Model):\n id = db.Column(db.Integer, primary_key=True)\n name = db.Column(db.String(64), index=True, unique=True)\n email = db....
python
chosen
[ { "from": "system", "value": "Disable caching for CMS plugin.\n\nCSRF tokens may get cached otherwise.\n\nThis is for compatibility with Django CMS 3.0+.\n" }, { "from": "human", "value": "from form_designer.contrib.cms_plugins.form_designer_form.models import CMSFormDefinition\nfrom form_design...
python
chosen
[ { "from": "system", "value": "Fix error message in the scikitlearn extension.\n" }, { "from": "human", "value": "\n# coding: utf-8\n\n# A jinja extension for the harness\n\n# In[9]:\n\ntry:\n from .base import HarnessExtension\nexcept:\n from base import HarnessExtension\n\nimport pandas, ...
python
chosen
[ { "from": "system", "value": "Add float extractor, fix extractors rules\n" }, { "from": "human", "value": "# re_set.py\n# Module for generating regex rules\n# r1\n\n\nimport re\n\n\nclass Ree:\n float = None\n number = None\n page_number = None\n extract_int = None\n\n @staticmeth...
python
chosen
[ { "from": "system", "value": "Select Block is no longer undoable\n" }, { "from": "human", "value": "\"\"\"\n select block\n\"\"\"\nfrom __future__ import absolute_import, division, print_function, unicode_literals\nimport logging\n\nfrom PySide import QtGui\n\nfrom mcedit2.editortools import ...
python
chosen
[ { "from": "system", "value": "Change path to mfr directory\n" }, { "from": "human", "value": "\"\"\"PDF renderer module.\"\"\"\nfrom mfr.core import RenderResult\nimport PyPDF2\nimport urllib\n\n\ndef is_valid(fp):\n \"\"\"Tests file pointer for validity\n\n :return: True if fp is a valid ...
python
chosen
[ { "from": "system", "value": "Add one more test skip on mica.report\n" }, { "from": "human", "value": "# Licensed under a 3-clause BSD style license - see LICENSE.rst\nimport tempfile\nimport os\nimport shutil\nimport pytest\n\nfrom .. import report\n\ntry:\n import Ska.DBI\n with Ska.DBI....
python
chosen
[ { "from": "system", "value": "TimeData: Add explicit test for reverse timestepping\n" }, { "from": "human", "value": "import numpy as np\nfrom sympy import Eq\n\nimport pytest\n\nfrom devito.interfaces import TimeData\nfrom devito.stencilkernel import StencilKernel\n\n\n@pytest.fixture\ndef a(sh...
python
chosen
[ { "from": "system", "value": "Add simple context push test\n" }, { "from": "human", "value": "# -*- coding: utf-8 -*-\n\nimport unittest\n\nimport stencil\n\nfrom stencil import Token\n\n\nclass ModuleTestCase(unittest.TestCase):\n \"\"\"Test cases for the stencil module.\"\"\"\n\n @static...
python
chosen
[ { "from": "system", "value": "Add event and image route\n" }, { "from": "human", "value": "from pyramid.config import Configurator\n\n\ndef main(global_config, **settings):\n \"\"\" This function returns a Pyramid WSGI application.\n \"\"\"\n config = Configurator(settings=settings)\n ...
python
chosen
[ { "from": "system", "value": "Modify text for management command message\n" }, { "from": "human", "value": "from django.core.management.base import NoArgsCommand\nfrom django.core.urlresolvers import reverse\n\nimport requests\n\nfrom deflect.models import ShortURL\n\n\nclass Command(NoArgsComma...
python
chosen
[ { "from": "system", "value": "Add data change to updates string only if new value is not None in order to preserve scraped data, that user decided to hide.\n" }, { "from": "human", "value": "from __future__ import unicode_literals\nfrom config import settings\n\nimport os\nimport re\nimport stri...
python
chosen
[ { "from": "system", "value": "Use threading.Event() to stop PeriodicTasks\n\nThis is a lot more cpu efficient and results in less tasks swapping\nrandomly.\n" }, { "from": "human", "value": "from ..vtask import VTask\nimport time\nfrom ..sparts import option\n\n\nclass PeriodicTask(VTask):\n ...
python
chosen
[ { "from": "system", "value": "Move files to archive test case\n" }, { "from": "human", "value": "\"\"\"test_remove_file_more_than_a_week.py: Creates an todo file with title name as current date\"\"\"\nimport os\nimport time\n\n\ndef get_files():\n files_array = []\n for file in os.listdir(...
python
chosen
[ { "from": "system", "value": "Update the Japanese example test\n" }, { "from": "human", "value": "# Japanese Language Test\nfrom seleniumbase.translate.japanese import セレニウムテストケース # noqa\n\n\nclass 私のテストクラス(セレニウムテストケース):\n def test_例1(self):\n self.を開く(\"https://ja.wikipedia.org/wiki/...
python
chosen
[ { "from": "system", "value": "Call same methods on parent class.\n" }, { "from": "human", "value": "import unittest\n\nimport numpy as np\nfrom scipy.sparse import csr_matrix, lil_matrix\nfrom Orange import data\n\nfrom Orange.tests import test_table as tabletests\n\n\nclass InterfaceTest(tablet...
python
chosen
[ { "from": "system", "value": "Modify CountPage to a public class\n" }, { "from": "human", "value": "#!/usr/bin/env python\n\n'''\nCopyright (c) 2016 anti-XSS developers\n'''\n\nclass CountPage(object):\n\n __number = 0\n\n def __init__(self, number=0):\n self.__number = number\n\n ...
python
chosen
[ { "from": "system", "value": "Remove copied comment from Rspec Syntax detector\n" }, { "from": "human", "value": "import sublime, sublime_plugin\nimport os\n\nclass JasmineCoffeeScriptDetectFileTypeCommand(sublime_plugin.EventListener):\n \"\"\" Detects current file type if the file's extension...
python
chosen
[ { "from": "system", "value": "Switch dummy_robot_bringup to use parameter for rsp.\n\nSigned-off-by: Chris Lalancette <281cd07d7578d97c83271fbbf2faddb83ab3791c@openrobotics.org>\n" }, { "from": "human", "value": "# Copyright 2018 Open Source Robotics Foundation, Inc.\n#\n# Licensed under the Apa...
python
chosen
[ { "from": "system", "value": "Return DNS data in the correct format\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(se...
python
chosen
[ { "from": "system", "value": "Fix Local class to work with older werkzeug." }, { "from": "human", "value": "\nimport collections\nfrom werkzeug.local import release_local, Local, LocalManager, LocalStack, allocate_lock\nfrom .proxy import Proxy\n\nclass Local(Local):\n\n # Just adding a __dic...
python
chosen