conversations
listlengths
2
3
source
stringclasses
1 value
stack
stringclasses
1 value
[ { "from": "system", "value": "Fix syntax error in email service\n" }, { "from": "human", "value": "from flask_mail import Message\n\nfrom zou.app import mail, app\n\n\ndef send_email(subject, body, recipient_email, html=None):\n \"\"\"\n Send an email with given subject and body to given r...
python
chosen
[ { "from": "system", "value": "Update plugin's register functions to return the object instance instead of performing the registration themselves\n" }, { "from": "human", "value": "from . import LayerView\n\ndef getMetaData():\n return { \"name\": \"LayerView\", \"type\": \"View\" }\n\ndef re...
python
chosen
[ { "from": "system", "value": "Remove an import which snuck in but does not belong.\n\nSigned-off-by: Robert Deaton <eb00a885478926d5d594195591fb94a03acb1062@udel.edu>\n" }, { "from": "human", "value": "\"\"\"\nSpyral, an awesome library for making games.\n\"\"\"\n\n__version__ = '0.1.1'\n__licen...
python
chosen
[ { "from": "system", "value": "Make sure to return python values, not lxml objects\n\nBump version to 0.4.0\n" }, { "from": "human", "value": "\"Simple parser for Garmin TCX files.\"\n\nfrom lxml import objectify\n\n__version__ = '0.3.0'\n\n\nclass TcxParser:\n\n def __init__(self, tcx_file):\...
python
chosen
[ { "from": "system", "value": "Add infinite loop; Add env vars\n" }, { "from": "human", "value": "import json\nimport requests\nimport sys\nfrom temperusb import TemperHandler\n\n\nURL=\"http://dashing:3030/widgets/inside\"\nSCALE=1.0\nOFFSET=-3.0\n\n\nth = TemperHandler()\ndevs = th.get_devices(...
python
chosen
[ { "from": "system", "value": "Fix non-threadsafe failure in serializer - now using thread local serializer instance.\n" }, { "from": "human", "value": "\"\"\"Django DDP utils for DDP messaging.\"\"\"\nimport collections\nfrom django.core.serializers import get_serializer\n\n_SERIALIZER = None\n\...
python
chosen
[ { "from": "system", "value": "Use Alex's awesome new version of the GtkQuartz theme engine\n" }, { "from": "human", "value": "Package ('gtk-quartz-engine', 'master',\n\tsources = [ 'git://github.com/jralls/gtk-quartz-engine.git' ],\n\toverride_properties = { 'configure':\n\t\t'libtoolize --force...
python
chosen
[ { "from": "system", "value": "Fix error accessing class variable\n" }, { "from": "human", "value": "'''\nThis module retrieves the course catalog and overviews of the Udacity API\n\nLink to Documentation:\nhttps://s3.amazonaws.com/content.udacity-data.com/techdocs/UdacityCourseCatalogAPIDocument...
python
chosen
[ { "from": "human", "value": "Add header info and submodule imports to init\n" }, { "from": "gpt", "value": "__author__ = \"Justin Kitzes, Mark Wilber, Chloe Lewis\"\n__copyright__ = \"Copyright 2012, Regents of University of California\"\n__credits__ = []\n__license__ = \"BSD 2-clause\"\n__versi...
python
chosen
[ { "from": "system", "value": "Disable BSF Campus for RCA Alliance Française\n\n@barbayellow said so.\n" }, { "from": "human", "value": "# -*- coding: utf-8 -*-\n\"\"\"KoomBook conf\"\"\"\nfrom .kb import * # noqa\n\nLANGUAGE_CODE = 'fr'\nIDEASCUBE_NAME = 'Alliance française de Bangui'\n" }, ...
python
chosen
[ { "from": "system", "value": "Add a reset function stub\n\nAlso fix a typo.\n" }, { "from": "human", "value": "\nclass BaseWrapper(object):\n \"\"\"\n A base class for backend plugins.\n \"\"\"\n\n def get_key(self, tag, key, default=None):\n \"\"\"\n Gets the value hel...
python
chosen
[ { "from": "system", "value": "Remove last digit of version number if it's 0.\n" }, { "from": "human", "value": "# coding=UTF8\n\nimport datetime\n\nname = \"Devo\"\n\nrelease_date = datetime.date(2012, 12, 13)\n\nversion = (1, 0, 0)\n\nversion_string = \".\".join(str(x) for x in version)\n\niden...
python
chosen
[ { "from": "system", "value": "Make sure billing/shipping aren't populated if they aren't there\n" }, { "from": "human", "value": "from armstrong.utils.backends import GenericBackend\nfrom billing import get_gateway\n\nfrom . import forms\n\n\nclass AuthorizeNetBackend(object):\n def get_form_...
python
chosen
[ { "from": "system", "value": "Replace many double quotes with single quotes\n" }, { "from": "human", "value": "\"\"\"\nDefaults for all settings used by AnchorHub\n\"\"\"\n\nWRAPPER = \"{ }\"\n\nINPUT = \".\"\nOUTPUT = \"out-anchorhub\"\n\nARGPARSER = {\n \"description\": \"anchorhub parses t...
python
chosen
[ { "from": "system", "value": "Mark as test as \"todo\" for now.\n" }, { "from": "human", "value": "from twisted.trial import unittest\nfrom formal import util\n\n\nclass TestUtil(unittest.TestCase):\n\n def test_validIdentifier(self):\n self.assertEquals(util.validIdentifier('foo'), Tr...
python
chosen
[ { "from": "system", "value": "Use full URI for build failure reasons\n" }, { "from": "human", "value": "from __future__ import absolute_import\n\nfrom jinja2 import Markup\n\nfrom changes.buildfailures.base import BuildFailure\n\n\nclass TestFailure(BuildFailure):\n def get_html_label(self, b...
python
chosen
[ { "from": "system", "value": "Raise read-only fs on touch\n" }, { "from": "human", "value": "import os\nfrom errno import EROFS\n\nfrom fuse import FuseOSError\n\nfrom gitfs import FuseMethodNotImplemented\n\nfrom .view import View\n\n\nclass ReadOnlyView(View):\n def getxattr(self, path, fh)...
python
chosen
[ { "from": "system", "value": "Allow query without table to run\n" }, { "from": "human", "value": "from collections import namedtuple\n\nimport collections\n\nfrom six import string_types\n\nfrom aq.errors import QueryParsingError\nfrom aq.select_parser import select_stmt, ParseException\n\nTable...
python
chosen
[ { "from": "system", "value": "Fix the but There is an error (cannot concatenate str and int objects)\nwhen the user does not specify the inputs." }, { "from": "human", "value": "\"\"\"\nDummyProcess to check the WPS structure\n\nAuthor: Jorge de Jesus (jorge.de-jesus@jrc.it) as suggested by Kor ...
python
chosen
[ { "from": "system", "value": "Use float, not int for random WPM\n" }, { "from": "human", "value": "import math\nimport numpy\nimport random\nfrom demodulate.cfg import *\n\ndef gen_test_data():\n\tpattern = [1,0,1,1,1,0,0,0,0,0,0,0] # morse code 'A'\n\tcycles_per_sample = MORSE_FREQ/SAMPLE_FREQ\...
python
chosen
[ { "from": "system", "value": "Revert \"It seems the mechanism to declare a namespace package changed.\"\n\nThis reverts commit 68658fe9a3fee91963944937b80fcdaf3af4c8a1.\n\nChanging the backport to use setuptools namespaces broke all the other\npackages using the backports namespace. Switch back to standard...
python
chosen
[ { "from": "system", "value": "Add a custom admin site header.\n" }, { "from": "human", "value": "from django.conf.urls import url, include\nfrom django.contrib import admin\n\nurlpatterns = [\n url(r'^api/', include('api.urls')),\n url(r'^admin/', admin.site.urls),\n]\n" }, { "from...
python
chosen
[ { "from": "system", "value": "Add scan_steps wrapper for scan_nd\n" }, { "from": "human", "value": "# vim: sw=4 ts=4 sts expandtab smarttab\n# HXN step-scan configuration\n\nimport hxntools.scans\nfrom bluesky.global_state import get_gs\n\ngs = get_gs()\n\nhxntools.scans.setup()\nct = hxntools.s...
python
chosen
[ { "from": "system", "value": "Fix the AvailableActionsPrinter to support the new multiplayer action spec.\n\nPiperOrigin-RevId: 183247161\n" }, { "from": "human", "value": "# Copyright 2017 Google Inc. All Rights Reserved.\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n...
python
chosen
[ { "from": "system", "value": "Fix minor issues in 2020.10.1 file\n\nThe comment about the 1 being bad was incorrect, in fact it was good. I\nhad forgotten about adding the extra three-jolt difference for the final\nadapter in the device, and didn't make the connection between it and the\nthree-jolt count be...
python
chosen
[ { "from": "system", "value": "Use a comprehension instead of a lambda function\n" }, { "from": "human", "value": "import string\n\n\nUPPER = string.ascii_uppercase\nLOWER = string.ascii_lowercase\n\n\ndef rotate(s, n):\n rules = shift_rules(n)\n return \"\".join(map(lambda k: rules.get(k, ...
python
chosen
[ { "from": "system", "value": "Use factories instead of creating instance from model\n" }, { "from": "human", "value": "import datetime\n\nfrom django_webtest import WebTest\nfrom django.contrib.auth.models import User\n\nfrom pylab.core.models import Event\n\n\nclass AboutPageTests(WebTest):\n\n...
python
chosen
[ { "from": "system", "value": "Fix missing offset for Query\n\n" }, { "from": "human", "value": "# Copyright 2017 Oursky Ltd.\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 copy of the...
python
chosen
[ { "from": "system", "value": "[REF] openacademy: Add sql constraint identation fixed\n" }, { "from": "human", "value": "# -*- coding: utf-8 -*-\n\nfrom openerp import models, fields, api\n'''\nThis module create model of Course\n'''\n\nclass Course(models.Model):\n '''This class create model ...
python
chosen
[ { "from": "system", "value": "Swap out license with rights\n" }, { "from": "human", "value": "from django.db import models\n\nfrom share.models.base import ShareObject\nfrom share.models.people import Person\nfrom share.models.base import TypedShareObjectMeta\nfrom share.models.creative.meta imp...
python
chosen
[ { "from": "system", "value": "Update existing settings migration with minor field change.\n" }, { "from": "human", "value": "# -*- coding: utf-8 -*-\n\n# Copyright (c) 2016 Ansible, Inc.\n# All Rights Reserved.\n\nfrom __future__ import unicode_literals\n\nfrom django.db import migrations, model...
python
chosen
[ { "from": "system", "value": "Add functionality to copy any missing files to the other folder\n\n" }, { "from": "human", "value": "import os\n\ndropboxFiles = []\nlocalFiles = []\nfor dirpath, dirnames, filenames in os.walk(\n '/media/itto/TOSHIBA EXT/Photos/Dropbox/ITTO/Southeast Asia 20...
python
chosen
[ { "from": "system", "value": "Add Bitpay config model to Django Admin panel\n" }, { "from": "human", "value": "# coding=utf-8\n\nfrom django.contrib import admin\nfrom djangovirtualpos.models import VirtualPointOfSale, VPOSRefundOperation, VPOSCeca, VPOSRedsys, VPOSSantanderElavon, VPOSPaypal\n\...
python
chosen
[ { "from": "system", "value": "[casspy] Change to console command prompt\n" }, { "from": "human", "value": "#! /usr/bin/env python\n# -*- coding: utf-8 -*-\n\n\"\"\"\nCassoundra: admin-commands\n~~~~~~~~~~\n\nModule to handle special commands to control the bot once it is already running.\n\nCrea...
python
chosen
[ { "from": "system", "value": "Make verbose loading messages optional\n" }, { "from": "human", "value": "import sys\n\nmethod_count = 0\n\ndef method(argcount, nlocals, stacksize, flags, codestring, constants, names,\n varnames, filename, name, firstlineno, lnotab, modules, static):\n...
python
chosen
[ { "from": "system", "value": "Fix unicode import in test\n" }, { "from": "human", "value": "'''Test sentence boundaries are deserialized correctly,\neven for non-projective sentences.'''\n\nimport pytest\nimport numpy\nfrom ... tokens import Doc\nfrom ... vocab import Vocab\nfrom ... attrs impor...
python
chosen
[ { "from": "system", "value": "Add test for notify dataset/update\n" }, { "from": "human", "value": "from mock import patch\n\nimport unittest\n\nimport ckan.model as model\nfrom ckan.model.domain_object import DomainObjectOperation\n\nfrom ckanext.syndicate.plugin import SyndicatePlugin\n\n\ncla...
python
chosen
[ { "from": "system", "value": "Allow multiple alarms for same metric type\n" }, { "from": "human", "value": "import boto3\n\nfrom bluecanary.exceptions import NamespaceError\nfrom bluecanary.utilities import throttle\n\n\n@throttle()\ndef set_cloudwatch_alarm(identifier, **kwargs):\n if not kw...
python
chosen
[ { "from": "system", "value": "Update namespace monitor with exception handling\n" }, { "from": "human", "value": "import time\n\nfrom kubernetes.client.rest import ApiException\n\nfrom django.conf import settings\n\nfrom clusters.models import Cluster\nfrom events.management.commands._base_monit...
python
chosen
[ { "from": "system", "value": "Build tree for huffman coding\n" }, { "from": "human", "value": "\"\"\"\ncompression\n\"\"\"\n\nclass Compress():\n \"\"\"Compress\"\"\"\n def encode(self, string):\n \"\"\"Encodes string to byte representation\"\"\"\n return b'0'\n\n def deco...
python
chosen
[ { "from": "system", "value": "Move definition of substitution patterns inside the latex_substitutions dictionary\n" }, { "from": "human", "value": "import re\n\nclass Formatter(object):\n pat_square_open = re.compile(\"\\[\")\n pat_square_closed = re.compile(\"\\]\")\n pat_lt = re.co...
python
chosen
[ { "from": "system", "value": "Mark fields except appropriateness as readonly\n" }, { "from": "human", "value": "from import_export import fields, resources\n\nfrom .models import Review\n\n\nclass ReviewResource(resources.ModelResource):\n\n reviewer = fields.Field(\n attribute='review...
python
chosen
[ { "from": "system", "value": "Remove the code cleans up the temp file as temp files are already automatically cleaned\n" }, { "from": "human", "value": "import tempfile\nimport unittest\nimport os\nfrom nimoy.runner.spec_finder import SpecFinder\n\n\nclass TestSpecFinder(unittest.TestCase):\n ...
python
chosen
[ { "from": "system", "value": "Create an admin user on db initialisation. " }, { "from": "human", "value": "from flask.ext.script import Manager\n\nfrom datawire.core import app, db\nfrom datawire.model import Service\nfrom datawire.views import index\n\nmanager = Manager(app)\n\n\n@manager.comma...
python
chosen
[ { "from": "system", "value": "Use sphinxdoc html theme, cleaner than alabast.\n" }, { "from": "human", "value": "# -*- coding: utf-8 -*-\n\n# Copyright (c) 2010-2016, MIT Probabilistic Computing Project\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may not ...
python
chosen
[ { "from": "system", "value": "Update test for the getattr method.\n" }, { "from": "human", "value": "# Copyright 2014 PressLabs SRL\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 copy...
python
chosen
[ { "from": "system", "value": "Allow use of Check-And-Set option and raise exception if status is 4xx or 5xx\n" }, { "from": "human", "value": "import json\nimport re\nimport requests\n\nclass KeyValue(object):\n\n def __init__(self, url):\n self._url = \"%s/kv\" % url\n\n def _get(s...
python
chosen
[ { "from": "system", "value": "Check margin keyword to Row/Column is not None\n" }, { "from": "human", "value": "from __future__ import absolute_import, division, print_function, unicode_literals\nfrom PySide import QtGui\n\n\ndef _Box(box, *a):\n for arg in a:\n if isinstance(arg, tupl...
python
chosen
[ { "from": "system", "value": "Plugins: Read logger config from Preferences\n\nrequired due to 9b30d85d1b60fef4f4d7c35868dd406f0c5d94f3\n" }, { "from": "human", "value": "import logging\nimport sublime\n\nPACKAGE_NAME = __package__.split(\".\", 1)[0]\n\nlogging.basicConfig(\n level=logging.ERR...
python
chosen
[ { "from": "system", "value": "Update to new-style urlpatterns format\n" }, { "from": "human", "value": "# -*- coding: utf-8 -*-\n\nfrom django.conf.urls import patterns, url\n\nfrom . import views\n\nurlpatterns = patterns(\"\",\n url(r\"^login/(?P<uuid>[\\da-f]{8}-([\\da-f]{4}-){3}[\\da-f]{1...
python
chosen
[ { "from": "system", "value": "Fix issue mixing %s and format for ValueError in AES\n" }, { "from": "human", "value": "# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may not use this file except in compliance with the License.\n# You may obtain a copy of the License at...
python
chosen
[ { "from": "system", "value": "Make use of the version module\n" }, { "from": "human", "value": "from ._library import *\nfrom ._library import __version__, __api_version__\n\ndef get_include():\n \"\"\"Returns the directory containing the C/C++ API include directives\"\"\"\n\n return __import_...
python
chosen
[ { "from": "system", "value": "Add example of Value to Python list conversion\n" }, { "from": "human", "value": "#! /usr/bin/env python\n#\n# values.py\n#\n\"\"\"\nAn example of using values via Python API\n\"\"\"\n\nfrom opencog.atomspace import AtomSpace, TruthValue\nfrom opencog.type_construct...
python
chosen
[ { "from": "system", "value": "Update to run on port 5002\n\nFor development we will want to run multiple apps, so they should each bind to a different port number.\n" }, { "from": "human", "value": "#!/usr/bin/env python\n\nimport os\nfrom app import create_app\nfrom flask.ext.script import Mana...
python
chosen
[ { "from": "system", "value": "Add missing chars in URL for 'Morten M' crawler\n" }, { "from": "human", "value": "# encoding: utf-8\n\nfrom comics.aggregator.crawler import BaseComicCrawler\nfrom comics.meta.base import BaseComicMeta\n\nclass ComicMeta(BaseComicMeta):\n name = 'Morten M (vg.no...
python
chosen
[ { "from": "system", "value": "Update minimum conda version diagnostic\n" }, { "from": "human", "value": "from __future__ import absolute_import, division, print_function, unicode_literals\n\nfrom distutils.version import StrictVersion\n\nfrom conda import __version__ as CONDA_VERSION\n\nfrom ._v...
python
chosen
[ { "from": "system", "value": "Remove Unauthorized exception logging to slack\n" }, { "from": "human", "value": "import logging\nfrom slacker import Slacker\nimport os\n\n\nclass SlackHandler(logging.Handler):\n def __init__(self, slack_token):\n logging.Handler.__init__(self)\n ...
python
chosen
[ { "from": "system", "value": "Add tests for grammar's __clone__ method\n" }, { "from": "human", "value": "#!/usr/bin/env python\n\"\"\"\n:Author Patrik Valkovic\n:Created 16.08.2017 19:16\n:Licence GNUv3\nPart of grammpy\n\n\"\"\"\n\nfrom unittest import main, TestCase\nfrom grammpy import *\n\n...
python
chosen
[ { "from": "system", "value": "Use argparse to locate config file.\n" }, { "from": "human", "value": "#/usr/bin/env python\n\nimport json\nimport os\nimport subprocess\n\n\ndef run():\n with open('gtlaunch.json', 'r') as fp:\n config = json.load(fp)\n project = config['test']\n ar...
python
chosen
[ { "from": "system", "value": "Remove NotEmpty filter from Process.system.\n" }, { "from": "human", "value": "import os\nimport tee\n\n\nclass Process(object):\n \"\"\"Process related functions using the tee module (mostly).\"\"\"\n\n def __init__(self, quiet=False, env=None):\n self...
python
chosen
[ { "from": "system", "value": "Prepare kill test for mock - use hyperspeed\n" }, { "from": "human", "value": "# Copyright (c) 2012 - 2015 Lars Hupfeldt Nielsen, Hupfeldt IT\n# All rights reserved. This work is under a BSD license, see LICENSE.TXT.\n\nfrom __future__ import print_function\n\nimpor...
python
chosen
[ { "from": "system", "value": "Add tests for TCP flow interception\n" }, { "from": "human", "value": "import pytest\n\nfrom mitmproxy.addons import intercept\nfrom mitmproxy import exceptions\nfrom mitmproxy.test import taddons\nfrom mitmproxy.test import tflow\n\n\ndef test_simple():\n r = in...
python
chosen
[ { "from": "system", "value": "Test fail not to deploy\n" }, { "from": "human", "value": "from django.test import TestCase\nfrom django.urls import reverse\nfrom .models import Post\n\n\n# Create your tests here.\nclass PostModelTest(TestCase):\n\n def test_render_markdown(self):\n p = ...
python
chosen
[ { "from": "system", "value": "Remove fixed references from test_cxx.py\n" }, { "from": "human", "value": "def test_cxx_import():\n from microscopes.mixture.model import \\\n state, fixed_state, \\\n bind, bind_fixed, \\\n initialize, initialize_fixed, \\\n deserial...
python
chosen
[ { "from": "system", "value": "Add route for commenting page test\n" }, { "from": "human", "value": "from flask import Flask, jsonify, render_template, request, current_app, redirect, flash\nfrom functools import wraps\nimport json\n\napp = Flask(__name__)\n\ndef jsonp(f):\n\t'''Wrap JSONified ou...
python
chosen
[ { "from": "system", "value": "Allow for case insensitivity (and any other flag).\n" }, { "from": "human", "value": "from re import search\n\n\"Some baseline features for testing the classifier.\"\n\ndef make_searcher(substring, field='content'):\n\tdef result(datum):\n\t\tif search(substring, da...
python
chosen
[ { "from": "system", "value": "Improve visually how methods are Imported\n" }, { "from": "human", "value": "\"\"\"\nDataset collection package.\n\nThis package allows to easily manage and load pre-processed datasets in an easy\nway by using hdf5 files as metadata storage. By storing all the neces...
python
chosen
[ { "from": "system", "value": "Make vumi worker service available as vumi_worker and deprecate start_worker.\n" }, { "from": "human", "value": "from zope.interface import implements\nfrom twisted.application.service import IServiceMaker\nfrom twisted.plugin import IPlugin\n\nfrom vumi.start_worke...
python
chosen
[ { "from": "system", "value": "Make directory service the only service\n" }, { "from": "human", "value": "# from .directory_service import DirectoryService\nfrom .omdb_service import OMDBService\n\nALL_SERVICES = [\n # DirectoryService()\n OMDBService()\n]\n" }, { "from": "gpt", ...
python
chosen
[ { "from": "system", "value": "Test file reading for current view\n" }, { "from": "human", "value": "import os\n\nfrom tests.integrations.base import BaseTest\n\n\nclass TestReadCurrentView(BaseTest):\n def test_listdirs(self):\n assert os.listdir(\"%s/current\" % self.mount_path) == ['...
python
chosen
[ { "from": "system", "value": "Remove unneeded recoverFromRedirect and add markRedirectAsRecovered\n" }, { "from": "human", "value": "import flask\nfrom .. import auth\nimport urllib.parse\n\ndef checkForSession():\n\tif \"uid\" in flask.session:\n\t\tsession = auth.validateSession(flask.session[...
python
chosen
[ { "from": "system", "value": "Save the data fron cron\n" }, { "from": "human", "value": "import urllib, json\nimport numpy as np\n\nfrom secrets import API_KEY # JCDECAUX's API KEY\n\ndef retrieve_data(contract=\"paris\"):\n url = \"https://api.jcdecaux.com/vls/v1/stations?apiKey={}&contract=...
python
chosen
[ { "from": "system", "value": "Use z16 test to ensure no merging is done which would remove the id.\n" }, { "from": "human", "value": "# Add ramp properties to paths in roads layer\n\n# Steps with ramp:bicycle=yes in Copenhagen\n# https://www.openstreetmap.org/way/91275149\nassert_has_feature(\n ...
python
chosen
[ { "from": "system", "value": "Replace execfile with something compatible with both Py2/3.\n" }, { "from": "human", "value": "import os\nimport subprocess\n\nimport virtualenv\n\n\nclass VirtualEnvManager(object):\n def __init__(self, path):\n self.venv_home = path\n\n def install(s...
python
chosen
[ { "from": "system", "value": "Make sure the server has starded before launching tests\n" }, { "from": "human", "value": "#!/usr/bin/env python\n# -*- coding: utf-8 -*-\n\nimport os\nimport socket\nimport threading\n\nimport connexion\n\nfrom swagger_tester import swagger_test\n\n\ndef test_swagg...
python
chosen
[ { "from": "system", "value": "Create a jinja2 error in the test to ensure it has a message attribute\n" }, { "from": "human", "value": "# -*- coding: utf-8 -*-\n\nfrom cookiecutter import exceptions\n\n\ndef test_undefined_variable_to_str():\n undefined_var_error = exceptions.UndefinedVariabl...
python
chosen
[ { "from": "system", "value": "Add code to fix failing test\n" }, { "from": "human", "value": "def __open_worksheet():\n pass\n\ndef __get_data():\n pass\n\ndef __write_data():\n pass\n\n" }, { "from": "gpt", "value": "def __open_worksheet():\n pass\n\ndef __get_data():\n ...
python
chosen
[ { "from": "system", "value": "Update libc's DrillerRead to use the new posix read calling convention to support variable read\n" }, { "from": "human", "value": "import simuvex\nfrom simuvex.s_type import SimTypeFd, SimTypeChar, SimTypeArray, SimTypeLength\n\nclass DrillerRead(simuvex.SimProcedur...
python
chosen
[ { "from": "system", "value": "Replace generic PythonQtError with QtModuleNotInstalledError\n" }, { "from": "human", "value": "# -----------------------------------------------------------------------------\n# Copyright © 2009- The Spyder Development Team\n#\n# Licensed under the terms of the MIT...
python
chosen
[ { "from": "system", "value": "Fix script to include repos in PYTHONPATH\n\nThe repos checkout needs to be in the PYTHONPATH for the\nimport of the xstatic module to work. Since we invoke\nthe xstatic_check_version.py by absolute path, Python\ndoes not include the cwd() in the PYTHONPATH.\n\nChange-Id: Idd4f...
python
chosen
[ { "from": "system", "value": "Remove ref to dead Config class\n" }, { "from": "human", "value": "import sys\nimport argparse\nimport os\nimport mediachain.reader.api\nfrom mediachain.reader.api import Config\n\ndef main(arguments=None):\n if arguments == None:\n arguments = sys.argv[1:...
python
chosen
[ { "from": "system", "value": "Fix integration test for Python 2.6\n" }, { "from": "human", "value": "# Copyright (c) 2013 Amazon.com, Inc. or its affiliates.\n# All Rights Reserved\n#\n# Permission is hereby granted, free of charge, to any person obtaining a\n# copy of this software and associat...
python
chosen
[ { "from": "system", "value": "Handle situation where dav does not send length\n" }, { "from": "human", "value": "from __future__ import unicode_literals\nimport requests\nfrom django.core.files import File\nfrom django.core.files.storage import Storage\nfrom davstorage.utils import trim_trailing...
python
chosen
[ { "from": "system", "value": "Include all audio, video and subtitles streams\n" }, { "from": "human", "value": "'''\nMinimal VLC client for AceProxy. Messages class.\n'''\n\n\nclass VlcMessage(object):\n\n class request(object):\n SHUTDOWN = 'shutdown'\n\n @staticmethod\n ...
python
chosen
[ { "from": "system", "value": "Test suite requires me to spell contenttypes correctly\n" }, { "from": "human", "value": "#!/usr/bin/env python\nimport sys\nfrom os.path import dirname, abspath\n\nfrom django.conf import settings\n\nif not settings.configured:\n settings.configure(\n DAT...
python
chosen
[ { "from": "system", "value": "Add login to browsable API.\n" }, { "from": "human", "value": "from django.conf.urls import url\nfrom rest_framework.urlpatterns import format_suffix_patterns\nfrom . import views\n\n\nurlpatterns = [\n url(r'^notes/$', views.NoteList.as_view()),\n url(r'^note...
python
chosen
[ { "from": "system", "value": "Fix var name, is plural in site map\n" }, { "from": "human", "value": "# -*- coding: utf-8 -*-\nfrom django.contrib.sitemaps import GenericSitemap as DjangoGenericSitemap\nfrom django.contrib.sitemaps import Sitemap as DjangoSitemap\nfrom django.utils import timezon...
python
chosen
[ { "from": "system", "value": "Add third lesson and reword lesson topics\n" }, { "from": "human", "value": "# See also examples/example_track/example_meta.py for a longer, commented example\ntrack = dict(\n author_username='dansbecker',\n)\n\nlessons = [\n dict(topic='How Models Work'),...
python
chosen
[ { "from": "system", "value": "Remove broken reference to Image.LoaderError\n\nThis exception has not existed since Willow 0.3. Type checking on the 'except' line only happens when an exception occurs, so most of the time this is harmless, but if an unrelated exception occurs here (such as that caused by a f...
python
chosen
[ { "from": "system", "value": "Add common level convenience methods to Classic logger.\n" }, { "from": "human", "value": "# :coding: utf-8\n# :copyright: Copyright (c) 2013 Martin Pengelly-Phillips\n# :license: See LICENSE.txt.\n\nfrom .base import Logger\n\n\nclass Classic(Logger):\n '''Class...
python
chosen
[ { "from": "system", "value": "Add get_redirect_url and get_redirect helper" }, { "from": "human", "value": "from django.shortcuts import render\n\n\ndef get_next(request):\n # This is not a view\n return request.GET.get(\"next\", request.META.get(\"HTTP_REFERER\", \"/\"))\n\n\ndef render_c...
python
chosen
[ { "from": "system", "value": "Add get_properties class for simpler plugin usage\n" }, { "from": "human", "value": "\"\"\"\nModules exported by ``editorconfig`` package:\n\n- handler: used by plugins for locating and parsing EditorConfig files\n- exceptions: provides special exceptions used by ot...
python
chosen
[ { "from": "system", "value": "Prepare to distinct all slots per round.\n" }, { "from": "human", "value": "#!/usr/bin/python\n\nNUMTEAMS = 12\nROUNDBITS = 4\nMATCHBITS = 4\nSLOTBITS = 2\n\nprint \"(set-info :status unknown)\"\nprint \"(set-option :produce-models true)\"\nprint \"; Logic is now \\...
python
chosen
[ { "from": "system", "value": "Move name field to Production superclass\n\n" }, { "from": "human", "value": "from .production_part import ProductionPart\n\nfrom typing import List\n\n\nclass Production:\n def __str__(self):\n return repr(self)\n\n\nclass RuleAliasProduction(Production):...
python
chosen
[ { "from": "system", "value": "Add optional event_cmd bash file into the docs\n" }, { "from": "human", "value": "from i3pystatus import IntervalModule\n\n\nclass Pianobar(IntervalModule):\n \"\"\"\n Shows the title and artist name of the current music\n\n In pianobar config file must be ...
python
chosen
[ { "from": "system", "value": "hszinc: Add missed import for 'REMOVE' object\n" }, { "from": "human", "value": "# -*- coding: utf-8 -*-\n# Zinc dumping and parsing module\n# (C) 2016 VRT Systems\n#\n# vim: set ts=4 sts=4 et tw=78 sw=4 si:\n\nfrom .grid import Grid\nfrom .dumper import dump\nfrom ...
python
chosen
[ { "from": "system", "value": "Add default for 'initial' parameter on Select monkeypatch\n" }, { "from": "human", "value": "from django.apps import AppConfig\n\n\nclass DjangoCmsSpaConfig(AppConfig):\n name = 'djangocms_spa'\n\n def ready(self):\n from django.forms import CheckboxInp...
python
chosen
[ { "from": "system", "value": "Fix the `firstofas` template tag returning '' too early." }, { "from": "human", "value": "# -*- coding: utf-8 -*-\n\nfrom django import template\nfrom django.template.base import Node, TemplateSyntaxError\nfrom django.utils.encoding import smart_text\n\nregister = t...
python
chosen
[ { "from": "system", "value": "Allow filtering by author name\n" }, { "from": "human", "value": "from tastypie.authorization import DjangoAuthorization\nfrom tastypie import fields\nfrom tastypie.resources import ModelResource, ALL_WITH_RELATIONS\nfrom quotations.apps.quotations import models as ...
python
chosen
[ { "from": "system", "value": "Comment out test that doesn't pass on Windows\n\nIt appears to be assuming unix paths, so I'm going on the assumption\nthat it's not a valid test case on Windows.\n" }, { "from": "human", "value": "import os\nimport tempfile\nimport unittest\nfrom jupyter_core.paths...
python
chosen