conversations
listlengths
2
3
source
stringclasses
1 value
stack
stringclasses
1 value
[ { "from": "system", "value": "Make failIfDiff work with dict keys and values." }, { "from": "human", "value": "\"\"\"\nCode originally from: http://www.aminus.org/blogs/index.php/2009/01/09/assertnodiff\n\"\"\"\n\nimport difflib\nfrom pprint import pformat\n\n\nclass DiffTestCaseMixin(object):\n...
python
chosen
[ { "from": "system", "value": "Update default testing SMTP settings in project template" }, { "from": "human", "value": "\"\"\"\nSettings for local development.\n\nThese settings are not fast or efficient, but allow local servers to be run\nusing the django-admin.py utility.\n\nThis file should b...
python
chosen
[ { "from": "system", "value": "Cover more font extensions for CORS from static media\n\nWe were missing woff2, but this should just future proof us if more are\nadded.\n" }, { "from": "human", "value": "\"\"\"\nsentry.web.frontend.generic\n~~~~~~~~~~~~~~~~~~~~~~~~~~~\n\n:copyright: (c) 2010-2014 ...
python
chosen
[ { "from": "system", "value": "Remove the blind addition of prefech_related() to all Correlation querysets.\n" }, { "from": "human", "value": "# -*- coding: utf-8 -*-\nfrom datetime import date\n\nfrom django.contrib.contenttypes.models import ContentType\nfrom django.db import models\n\n\nclass ...
python
chosen
[ { "from": "system", "value": "Use a new interface for urlmapping in application template.\n" }, { "from": "human", "value": "# -*- coding: utf-8 -*-\n# %app_name%.urls\n\n\nfrom werkzeug.routing import (\n Map, Rule, Submount,\n EndpointPrefix, RuleTemplate,\n)\n\ndef make_rules():\n return [...
python
chosen
[ { "from": "system", "value": "doc: Add simple docs to Event entities\n" }, { "from": "human", "value": "\nfrom Entity import *\n\nclass EventEntity(Entity):\n EVENT_TEXT = 1\n EVENT_CSV = 2\n EVENT_BYTE = 3\n EVENT_WORD = 4\n EVENT_DWORD = 5\n\n def __init__(self, nsfile, ...
python
chosen
[ { "from": "system", "value": "Fix floating IP unit test.\n" }, { "from": "human", "value": "from django.test import TestCase\n\nfrom .. import factories\n\n\nclass FloatingIpHandlersTest(TestCase):\n\n def test_floating_ip_count_quota_increases_on_floating_ip_creation(self):\n tenant =...
python
chosen
[ { "from": "system", "value": "Change package name in tests\n" }, { "from": "human", "value": "import pytest\n\nfrom currypy import curry\n\n\nclass TestCurry:\n def test_curry_as_decorator(self):\n \"\"\"Ensure that currypy.curry can be used as a decorator\"\"\"\n @curry\n ...
python
chosen
[ { "from": "system", "value": "Convert Strings into Numerical Values\n" }, { "from": "human", "value": "import json\n\n#load data onto a list\nfilename = 'population_data.json'\nwith open(filename) as f:\n pop_data = json.load(f)\n\n#print the 2010 population for each country\nfor pop_dict in ...
python
chosen
[ { "from": "system", "value": "Add test for failing get_application_access_token\n" }, { "from": "human", "value": "\"\"\"Tests for the ``utils`` module.\"\"\"\n\nfrom mock import patch, Mock as mock\nfrom nose.tools import *\n\nfrom facepy import *\n\npatch = patch('requests.session')\n\ndef set...
python
chosen
[ { "from": "system", "value": "Add entire in Admin for managing HelpLink\n\nAn admin can _only_ modify the hyperlink associated with a HelpLink.\n\nAs a consequence, you cannot add new instances of the model nor delete\nthem. Only the existing HelpLinks can be modified because their\ninclusion (or existence)...
python
chosen
[ { "from": "system", "value": "Fix a couple of redirect URLs\n" }, { "from": "human", "value": "from django.conf.urls import url\n\nfrom parliament.core.utils import redir_view\nfrom parliament.hansards.redirect_views import hansard_redirect\n\nurlpatterns = [\n url(r'^hansards/$', redir_view(...
python
chosen
[ { "from": "system", "value": "Add test for subscriber timeout\n" }, { "from": "human", "value": "from twisted.trial import unittest\nfrom twisted.test import proto_helpers\n\nfrom ...test.support import DUMMY_EVENT_IVORN as DUMMY_IVORN\n\nfrom ..protocol import VOEventSubscriber\nfrom ..protocol...
python
chosen
[ { "from": "system", "value": "Introduce scope_types in migrate server\n\noslo.policy introduced the scope_type feature which can\ncontrol the access level at system-level and project-level.\n - https://docs.openstack.org/oslo.policy/latest/user/usage.html#setting-scope\n - http://specs.openstack.org/opensta...
python
chosen
[ { "from": "system", "value": "Add unicode encoding to sted.navn\n" }, { "from": "human", "value": "import pytest\n\nimport turbasen\n\n@pytest.fixture\ndef configure_dev():\n turbasen.configure(ENDPOINT_URL='http://dev.nasjonalturbase.no/')\n\n@pytest.mark.skipif(turbasen.settings.Settings.AP...
python
chosen
[ { "from": "system", "value": "Add fuzz call for SBBreakpointLocation.GetAddress().\n\n\ngit-svn-id: b33bab8abb5b18c12ee100cd7761ab452d00b2b0@141443 91177308-0d34-0410-b5e6-96231b3b80d8\n" }, { "from": "human", "value": "\"\"\"\nFuzz tests an object after the default construction to make sure it ...
python
chosen
[ { "from": "system", "value": "Add auto generated note on migration\n" }, { "from": "human", "value": "# -*- coding: utf-8 -*-\nfrom __future__ import unicode_literals\n\nfrom django.db import models, migrations\nfrom django.conf import settings\n\n\nclass Migration(migrations.Migration):\n\n ...
python
chosen
[ { "from": "system", "value": "Fix max noid detection when setting pid sequence\n" }, { "from": "human", "value": "# -*- coding: utf-8 -*-\nfrom __future__ import unicode_literals\n\nfrom django.db import migrations, models\nfrom pidman.pid.noid import decode_noid\nfrom pidman.pid import models a...
python
chosen
[ { "from": "system", "value": "Make proposed testing format with demo assignment\n" }, { "from": "human", "value": "\"\"\"Tests for hw1 demo assignment.\"\"\"\n\nTEST_INFO = {\n 'assignment': 'hw1',\n 'imports': ['from hw1 import *'],\n}\n\nTESTS = [\n\n # Test square\n {\n 'na...
python
chosen
[ { "from": "system", "value": "Make sure to activate modoboa_admin.\n" }, { "from": "human", "value": "\"\"\"Tests runner for modoboa_admin.\"\"\"\n\nimport unittest\n\nfrom modoboa.lib.test_utils import TestRunnerMixin\n\n\nclass TestRunner(TestRunnerMixin, unittest.TestCase):\n\n \"\"\"The t...
python
chosen
[ { "from": "system", "value": "Update test order to check for 401.\n" }, { "from": "human", "value": "# -*- coding: utf-8 -*-\n\"\"\"Functional tests using WebTest.\nSee: http://webtest.readthedocs.org/\nTESTS MUST START WITH \"test\"\n\"\"\"\nfrom flask import url_for\n\nclass TestBreakTheOrder:...
python
chosen
[ { "from": "system", "value": "Use requests' reponse.text per documentation\n" }, { "from": "human", "value": "import requests\n\n\nclass TestCase(object):\n \"\"\"\n Add assetion methods for HTTP Requests to TestCase\n \"\"\"\n\n def assertRequest(self, method=\"GET\", url=\"\", stat...
python
chosen
[ { "from": "system", "value": "Update dsub version to 0.3.7\n\nPiperOrigin-RevId: 292945859\n" }, { "from": "human", "value": "# Copyright 2017 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 complianc...
python
chosen
[ { "from": "system", "value": "FEAT: Add set_optimizer method to pytorch ImageClassifier class\n" }, { "from": "human", "value": "# %load_ext autoreload\n# %autoreload 2\nimport torch\nfrom torch import nn\nfrom torch.autograd import Variable\n\ndef accuracy(preds, labels):\n return (preds==la...
python
chosen
[ { "from": "system", "value": "Add wrapper for async receive event handler\n" }, { "from": "human", "value": "import asyncio\nimport inspect\nimport sys\n\nfrom rollbar.contrib.asgi import ASGIApp\n\n\ndef run(coro):\n if sys.version_info >= (3, 7):\n return asyncio.run(coro)\n\n ass...
python
chosen
[ { "from": "system", "value": "Test travisci windows build workaround. (3)\n\n" }, { "from": "human", "value": "#!/usr/bin/python\n# -*- coding: utf-8 -*-\n\nimport platform\nimport os\nimport subprocess\nimport sys\n\nif platform.system() == \"Windows\":\n import distutils.msvc9compiler as ms...
python
chosen
[ { "from": "system", "value": "Add optional copy on return\n" }, { "from": "human", "value": "from operator import mul\n\nimport xorshift.xorgen\n\n\ndef _compute_n_elements(shape):\n if shape is None:\n shape = (1,)\n try:\n nelts = reduce(mul, shape)\n except TypeError:\n...
python
chosen
[ { "from": "system", "value": "Use name over path for s3 backend support\n" }, { "from": "human", "value": "from django.conf import settings\nfrom django.urls import reverse\nfrom rest_framework import serializers\n\nfrom falmer.content.models import StaffMemberSnippet\nfrom falmer.matte.models i...
python
chosen
[ { "from": "system", "value": "Fix the warnings/errors messages from 'file_cache is unavailable when using oauth2client'\n" }, { "from": "human", "value": "# -*- coding: utf-8 -*-\n\"\"\"\nInit and user authentication in Earth Engine\n\"\"\"\nimport webbrowser\nfrom qgis.PyQt.QtWidgets import QIn...
python
chosen
[ { "from": "system", "value": "Fix Charged Hammer / Lightning Jolt\n" }, { "from": "human", "value": "from ..utils import *\n\n\n##\n# Hero Powers\n\n# Lightning Jolt\nclass AT_050t:\n\tplay = Hit(TARGET, 2)\n\n\n##\n# Minions\n\n# Tuskarr Totemic\nclass AT_046:\n\tplay = Summon(CONTROLLER, Rando...
python
chosen
[ { "from": "system", "value": "Use get_manager() for Counter direct\n" }, { "from": "human", "value": "# -*- coding: utf-8 -*-\n# Copyright 2017 - 2019 Avram Lubkin, All Rights Reserved\n\n# This Source Code Form is subject to the terms of the Mozilla Public\n# License, v. 2.0. If a copy of the M...
python
chosen
[ { "from": "system", "value": "Move choices outside of model class\n" }, { "from": "human", "value": "from django.db import models\nfrom django.utils.translation import pgettext_lazy\nfrom django.utils.encoding import python_2_unicode_compatible\n\n\n@python_2_unicode_compatible\nclass Setting(mo...
python
chosen
[ { "from": "system", "value": "Use 1.0 branch for stable channel builders\n\nTBR=ricow\n\nReview URL: https://codereview.chromium.org/69023002\n\ngit-svn-id: 239fca9b83025a0b6f823aeeca02ba5be3d9fd76@234222 0039d316-1c4b-4281-b951-d872f2087c98\n" }, { "from": "human", "value": "# Copyright 2013 Th...
python
chosen
[ { "from": "system", "value": "Fix version in breadcrumbs module.\n" }, { "from": "human", "value": "# -*- coding: utf-8 -*-\n__version__ = '1.1.3-p1'\n\nfrom .breadcrumbs import Breadcrumb\n" }, { "from": "gpt", "value": "# -*- coding: utf-8 -*-\n__version__ = '1.1.4'\n\nfrom .breadc...
python
chosen
[ { "from": "system", "value": "Use redis pipelining when sending events\n" }, { "from": "human", "value": "import datetime\nimport redis\nimport time\nimport urlparse\n\nimport beaver.transport\n\n\nclass RedisTransport(beaver.transport.Transport):\n\n def __init__(self, beaver_config, file_co...
python
chosen
[ { "from": "system", "value": "Adjust the number of bins\n" }, { "from": "human", "value": "#!/usr/bin/env python3\n\nimport os, sys\nsys.path.append(os.path.join(os.path.dirname(__file__), '..', 'lib'))\n\nimport glob, json\nimport matplotlib.pyplot as pp\n\nimport support\n\ndef main(index_path...
python
chosen
[ { "from": "system", "value": "Add automatic retry of cab extraction.\n\nIt fails occasionally with:\nOne or more files could not be expanded. Delta Package Expander Returned 0x80070002\nExpanding File ..\\third_party\\directxsdk\\files\\redist\\jun2010_d3dx9_43_x86.cab Incomplete, Error Code=0x80070002\nErr...
python
chosen
[ { "from": "system", "value": "Set required background color for RQ dashboard\n\nBYCEPS doesn't use ra dashboard's default settings, so they need to be set explicitly as necessary.\n" }, { "from": "human", "value": "\"\"\"\nbyceps.config_defaults\n~~~~~~~~~~~~~~~~~~~~~~\n\nDefault configuration v...
python
chosen
[ { "from": "system", "value": "Add get_rightside_face and Fix bug\n" }, { "from": "human", "value": "import numpy as np\n\ndef get_leftside_average(self):\n \"\"\"Return Array of Left Most Points.\"\"\"\n width = self.size[0]\n height = self.size[1]\n left_most_points = []\n for ro...
python
chosen
[ { "from": "system", "value": "Revert \"CW + AW | 225 | add instance path when building app\"\n\nThis reverts commit 9aa8d2ec4f49dfe8261893de70887052cf134bd5.\n" }, { "from": "human", "value": "# Copyright (c) 2015 ThoughtWorks\n#\n# See the file LICENSE for copying permission.\nimport os\n\nimpo...
python
chosen
[ { "from": "system", "value": "Fix migration file for new collection kind name\n" }, { "from": "human", "value": "# -*- coding: utf-8 -*-\n# Generated by Django 1.11.23 on 2019-12-04 04:59\nfrom __future__ import unicode_literals\n\nfrom django.db import migrations, models\n\n\nclass Migration(mi...
python
chosen
[ { "from": "system", "value": "Expand alternatives to import aio module\n" }, { "from": "human", "value": "# Copyright 2019 The gRPC Authors.\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 obta...
python
chosen
[ { "from": "system", "value": "Update call to `exec` to read the file in and execute the code.\n" }, { "from": "human", "value": "#!/usr/bin/env python\n# emacs: -*- mode: python; py-indent-offset: 4; indent-tabs-mode: nil -*-\n# vi: set ft=python sts=4 ts=4 sw=4 et:\n\"\"\"Wrapper to run setup.p...
python
chosen
[ { "from": "system", "value": "Use hifens instead of underscore for command names\n" }, { "from": "human", "value": "import click, importlib\nfrom shub.utils import missing_modules\n\ndef missingmod_cmd(modules):\n modlist = \", \".join(modules)\n @click.command(help=\"*DISABLED* - requires...
python
chosen
[ { "from": "system", "value": "Add min argument for n when generating ngrams\n" }, { "from": "human", "value": "import re\nfrom pattern import en\n\n# todo: use spacy tokenization\ndef ngrams(text, n=1):\n for i in xrange(n):\n for n in en.ngrams(text, n=i+1):\n yield ' '.joi...
python
chosen
[ { "from": "system", "value": "Add exhibitor_s3config option to Zookeeper creation\n" }, { "from": "human", "value": "from tyr.servers.server import Server\n\n\nclass ZookeeperServer(Server):\n\n SERVER_TYPE = 'zookeeper'\n\n CHEF_RUNLIST = ['role[RoleZookeeper]']\n\n IAM_ROLE_POLICIES =...
python
chosen
[ { "from": "system", "value": "Fix using LocalizedFieldsAdminMixin with inlines\n" }, { "from": "human", "value": "from django.contrib.admin import ModelAdmin\n\nfrom . import widgets\nfrom .fields import LocalizedField, LocalizedCharField, LocalizedTextField, \\\n LocalizedFileField\n\n\nFORM...
python
chosen
[ { "from": "system", "value": "Stop using the Flyduino sitemap.\n" }, { "from": "human", "value": "import scrapy\nfrom scrapy import log\nfrom scrapy.contrib.spiders import SitemapSpider, Rule\nfrom scrapy.contrib.linkextractors import LinkExtractor\nfrom rcbi.items import Part\n\nMANUFACTURERS =...
python
chosen
[ { "from": "system", "value": "Fix minimum date for uptime:reports\n" }, { "from": "human", "value": "from django import forms\n\nfrom bootstrap3_datetime.widgets import DateTimePicker\n\n\nclass ChooseReportForm(forms.Form):\n date_from = forms.DateField(\n widget=DateTimePicker(option...
python
chosen
[ { "from": "system", "value": "Fix simpletag -> simple_tag\nFix imports\n" }, { "from": "human", "value": "\nfrom django import template\n\nfrom damn.processors import find_processor\nfrom damn.utils import AssetRegistry, DepNode\n\n\nregister = template.Library()\n\n\nclass AssetsNode(template.N...
python
chosen
[ { "from": "system", "value": "Use default arguments removed by mypy\n" }, { "from": "human", "value": "from typing import Any\n\nfrom flask import Flask\nfrom relayer import Relayer\n\n\nclass FlaskRelayer(object):\n\n def __init__(self, app: Flask, logging_topic: str, kafka_hosts: str = None...
python
chosen
[ { "from": "system", "value": "Add placeholder to return array full of zeroes.\n" }, { "from": "human", "value": "\"\"\"\nSimulation of Buffon's Needle Experiment.\n\"\"\"\n\nimport math\n\nimport numpy as np\nimport numexpr as ne\n\nfrom utils import misc\n\ndef run_trials(length, gap_width, tri...
python
chosen
[ { "from": "system", "value": "Use the utility module's extract_publication_date logic.\n" }, { "from": "human", "value": "\"\"\"Populate the `publication_date` column.\n\nRevision ID: 17c1af634026\nRevises: 3c4c29f0a791\nCreate Date: 2012-12-13 21:03:03.445346\n\n\"\"\"\n# revision identifiers, ...
python
chosen
[ { "from": "system", "value": "Extend Broadcast protocol abstraction with a Handler interface for message delivery\n" }, { "from": "human", "value": "from abc import ABCMeta, abstractmethod\nimport socket, json\n\n\nclass Broadcast(metaclass=ABCMeta):\n \"\"\"\n An interface for defining a ...
python
chosen
[ { "from": "system", "value": "Use other ports and show inv problem solutions\n" }, { "from": "human", "value": "#!/usr/bin/env python3\nimport socketserver\nfrom socketserver import BaseRequestHandler\nfrom socketserver import TCPServer\n\nHOST = ''\nPORT = 7777\n\nclass ConnectionHandler(BaseRe...
python
chosen
[ { "from": "system", "value": "Fix Black linter mismatch with versions\n" }, { "from": "human", "value": "def monkeypatch_django():\n \"\"\"\n Monkeypatches support for us into parts of Django.\n \"\"\"\n # Ensure that the staticfiles version of runserver bows down to us\n # This o...
python
chosen
[ { "from": "system", "value": "Allow get_session to pass through arguments, like `safe`.\n" }, { "from": "human", "value": "\"\"\"\nUtilities used throughout the tests.\n\n\"\"\"\n\nfrom functools import wraps\nfrom mongoalchemy.session import Session\n\n\nDB_NAME = 'mongoalchemy-unit-test'\n\n\n...
python
chosen
[ { "from": "system", "value": "Remove previously added method because finally not used...\n" }, { "from": "human", "value": "\"\"\"(c) All rights reserved. ECOLE POLYTECHNIQUE FEDERALE DE LAUSANNE, Switzerland, VPSI, 2017\"\"\"\n\n\nclass MenuItem:\n \"\"\" To store menu item information \"\"\...
python
chosen
[ { "from": "system", "value": "Clean up of main module\n\nMoved two commands to the grade_project script. Added copyright\nstatement.\n" }, { "from": "human", "value": "#!/usr/bin/env python3\n# -*- coding: utf-8 -*-\n\n\"\"\"\nThis module is part of the Clemson ACM Auto Grader\n\nThis module is...
python
chosen
[ { "from": "system", "value": "Allow using non-Premium keys for Google Maps client\n" }, { "from": "human", "value": "#!/usr/local/bin/python\n# -*- coding: utf-8 -*-\n\nimport googlemaps\nimport base64\nfrom exceptions import InvalidGoogleCredentials\n\nclass GoogleMapsClientFactory():\n clie...
python
chosen
[ { "from": "system", "value": "Remove example setting from defaults, add INJECT_FONT_AWESOME\n" }, { "from": "human", "value": "from django.conf import settings\n\nBASED_LIB_RST = getattr(\n settings,\n 'BASED_LIB_RST',\n {\n \"font_awesome\": {\n \"url_patterns\": {\n ...
python
chosen
[ { "from": "system", "value": "Add test for '--filter' option\n\nThe goal now is to make this test pass by implementing the necessary\nproduction code.\n" }, { "from": "human", "value": "def test_dummy():\n assert True\n" }, { "from": "gpt", "value": "import subprocess\n\nimport py...
python
chosen
[ { "from": "system", "value": "Use new URLs module in test_app.\n" }, { "from": "human", "value": "from django.conf.urls.defaults import patterns, url, include\nfrom django.contrib import admin\nfrom django.http import HttpResponseNotFound, HttpResponseServerError\n\nfrom test_app import views\nf...
python
chosen
[ { "from": "system", "value": "Fix cprint: use stderr not stdout\n" }, { "from": "human", "value": "from __future__ import print_function\n\nimport sys\nimport string\nimport json\n\nfrom colors import *\n\n\ndef is_posix_filename(name, extra_chars=\"\"):\n CHARS = string.letters + string.digi...
python
chosen
[ { "from": "system", "value": "Fix typo in role check\n" }, { "from": "human", "value": "\"\"\"\n\nUsage:\n scripts/generate-user-email-list.py <data_api_url> <data_api_token>\n\"\"\"\nimport csv\nimport sys\n\nfrom docopt import docopt\nfrom dmutils.apiclient import DataAPIClient\n\n\ndef gen...
python
chosen
[ { "from": "system", "value": "Fix the scipy version display.\n" }, { "from": "human", "value": "major = 0\nminor = 4\nmicro = 3\n\n#try:\n# from __svn_version__ import version as svn_revision\n# scipy_version = '%(major)d.%(minor)d.%(micro)d_%(svn_revision)s'\\\n# % (loc...
python
chosen
[ { "from": "system", "value": "Refactor abstract method test to reduce duplication\n" }, { "from": "human", "value": "#!/usr/bin/env python3\n\"\"\"Functions for testing the Automaton abstract base class.\"\"\"\n\nimport nose.tools as nose\n\nfrom automata.base.automaton import Automaton\n\n\ndef...
python
chosen
[ { "from": "system", "value": "Remove extra %s from media path\n" }, { "from": "human", "value": "import settings\nfrom django.conf.urls.defaults import *\nfrom django.contrib import admin\n\nadmin.autodiscover()\n\nurlpatterns = patterns('',\n (r'^admin/(.*)', admin.site.root),\n (r'^publi...
python
chosen
[ { "from": "system", "value": "Set up test environment when launching tests." }, { "from": "human", "value": "#!/usr/bin/env python\n\"\"\"\n Default manage.py for django-configurations\n\"\"\"\nimport os\nimport sys\n\nif __name__ == \"__main__\":\n os.environ.setdefault(\"DJANGO_SETTINGS_...
python
chosen
[ { "from": "system", "value": "Make CORS debug logs go quiet\n\nOtherwise I'm just inundated with them and I'm rarely debugging CORS\n" }, { "from": "human", "value": "import logging\nimport os\n\nimport chryso.connection\nimport sepiida.config\nimport sepiida.log\n\nimport vanth.config\nimport v...
python
chosen
[ { "from": "system", "value": "Set the current language from the page\n" }, { "from": "human", "value": "from django.http import HttpResponseRedirect\nfrom django.shortcuts import render_to_response\nfrom django.template import RequestContext\n\nfrom feincms.models import Page\n\n\ndef handler(re...
python
chosen
[ { "from": "system", "value": "Use new-style exceptions in a TemplateSyntaxError\n" }, { "from": "human", "value": "from django import template\nfrom django.template.defaultfilters import stringfilter\nfrom currencies.models import Currency\nfrom currencies.utils import calculate_price\n\nregiste...
python
chosen
[ { "from": "system", "value": "Fix name of Django version attribute\n\nSigned-off-by: Byron Ruth <e9d71f5ee7c92d6dc9e92ffdad17b8bd49418f98@devel.io>\n" }, { "from": "human", "value": "import os\n\nos.environ['DJANGO_SETTINGS_MODULE'] = 'tests.settings'\n\nimport django # noqa\n\nif django.__vers...
python
chosen
[ { "from": "system", "value": "Change new_bmi fixture scope to be function level.\n" }, { "from": "human", "value": "import os\n\nimport pytest\nfrom scripting.contexts import cd\n\nfrom . import Bmi, INPUT_FILE\nfrom .utils import all_grids, all_names, out_names, strictly_input_names\n\n\n@pytes...
python
chosen
[ { "from": "system", "value": "examples/web/basecontroller: Change default port to 8000\n" }, { "from": "human", "value": "#!/usr/bin/env python\n\nfrom circuits.web import expose, Server\nfrom circuits.web.controllers import BaseController\n\nclass Root(BaseController):\n\n @expose(\"index\")...
python
chosen
[ { "from": "system", "value": "Add support for https redirect\n" }, { "from": "human", "value": "from .base import *\nimport dj_database_url\n\nif os.environ.get('DEBUG') == 'False':\n DEBUG = False\nelse:\n DEBUG = True\n\ntry:\n from .local import *\nexcept ImportError:\n pass\n\nAD...
python
chosen
[ { "from": "system", "value": "Remove PlaybackProvider that does nothing\n" }, { "from": "human", "value": "from __future__ import unicode_literals\n\nimport logging\nimport pykka\n\nfrom mopidy.backends import base\n\nfrom .library import VKLibraryProvider\nfrom .playlists import VKPlaylistsProv...
python
chosen
[ { "from": "system", "value": "Make address not required on OrganizationSerializer\n" }, { "from": "human", "value": "from django.core.exceptions import ValidationError\n\nfrom ovp_core import validators as core_validators\nfrom ovp_core.serializers import GoogleAddressSerializer, GoogleAddressCi...
python
chosen
[ { "from": "system", "value": "Write db errors to error.log\n" }, { "from": "human", "value": "import threading\nimport time\n\nimport accounts\nimport args\nimport config\n\nMAX_TEXT_LENGTH = 1024\n\nenabled = bool(args.args['database'])\nif enabled:\n import MySQLdb\nconnected = False\nconn ...
python
chosen
[ { "from": "system", "value": "Fix shebang and coding comment lines order\n" }, { "from": "human", "value": "# -*- coding: utf-8 -*-\n#!/usr/bin/env python\nimport os\nimport sys\n\nif __name__ == \"__main__\":\n os.environ.setdefault(\"DJANGO_SETTINGS_MODULE\", \"schoolidolapi.settings\")\n\n...
python
chosen
[ { "from": "system", "value": "Load the logging config right away so it actually works\n" }, { "from": "human", "value": "import logging.config\nimport os\nfrom paste.deploy import loadapp\nimport sys\n\nDIR = os.path.abspath(os.path.dirname(__file__))\nconf = os.path.join(DIR, '../conf/anygit.in...
python
chosen
[ { "from": "system", "value": "Make compatible with direct use by pymongo.\n\nI.e. for direct passing to collection.insert()\n" }, { "from": "human", "value": "# encoding: utf-8\n\nfrom collections import OrderedDict as odict, MutableMapping\nfrom itertools import chain\n\nfrom marrow.schema impo...
python
chosen
[ { "from": "system", "value": "Implement Corrupted Healbot, Corrupted Seer, and Midnight Drake\n" }, { "from": "human", "value": "from ..utils import *\n\n\n##\n# Minions\n\nclass OG_034:\n\t\"Silithid Swarmer\"\n\tupdate = (NUM_ATTACKS_THIS_TURN(FRIENDLY_HERO) == 0) & (\n\t\tRefresh(SELF, {GameT...
python
chosen
[ { "from": "system", "value": "Add more service lookups for Deploys\n" }, { "from": "human", "value": "\nif 'r2' in alert['resource'].lower():\n alert['service'] = [ 'R2' ]\nelif 'content-api' in alert['resource'].lower():\n alert['service'] = [ 'ContentAPI' ]\nelif 'flexible' in alert['res...
python
chosen
[ { "from": "system", "value": "Fix for weird signal we send ourselves\n" }, { "from": "human", "value": "from django.core.exceptions import ValidationError\nfrom django.dispatch import receiver\nfrom django.forms.models import model_to_dict\n\nfrom django_fsm import pre_transition, post_transitio...
python
chosen
[ { "from": "system", "value": "Make the phone number an int\n" }, { "from": "human", "value": "from rest_framework import serializers\n\nfrom people.models import Customer\nfrom people.models import InternalUser\n\nclass CustomerSerializer(serializers.ModelSerializer):\n\n class Meta:\n ...
python
chosen
[ { "from": "system", "value": "Move the get_online_users and get_active_users methods to the manager class.\n" }, { "from": "human", "value": "\"\"\"\nObjects managers for the user accounts app.\n\"\"\"\n\nfrom django.db import models\n\n\nclass UserProfileManager(models.Manager):\n \"\"\"\n ...
python
chosen
[ { "from": "system", "value": "Add DELETE to CORS header\n" }, { "from": "human", "value": "class AddResponseHeader:\n def process_response(self, req, resp, resource):\n resp.set_header('Access-Control-Allow-Origin', 'http://localhost:8000')\n resp.set_header('Access-Control-Allo...
python
chosen
[ { "from": "system", "value": "Make running gtk.main optional for testing\n" }, { "from": "human", "value": "import gtk\nimport keybinder\nimport configuration\nimport logging\n\nfrom azulejo_controller import AzulejoController\nfrom configuration import AzulejoConfiguration\n\ndef dispatcher(dis...
python
chosen
[ { "from": "system", "value": "Add support for apicalls in Bash package\n" }, { "from": "human", "value": "#!/usr/bin/env python\n# Copyright (C) 2015 Dmitry Rodionov\n# This file is part of my GSoC'15 project for Cuckoo Sandbox:\n#\thttp://www.cuckoosandbox.org\n# This software may be modified a...
python
chosen
[ { "from": "system", "value": "Fix typo - XML<->YAML configuration\n" }, { "from": "human", "value": "\"\"\" Plugin manager is Checker's main module.\n Plugin Manager is using Yapsy to find and load plugins from\n a directory and loads them via PluginRunner.\n\"\"\"\nfrom yapsy.PluginManage...
python
chosen
[ { "from": "system", "value": "Fix zero-length field error when building docs in Python 2.6\n" }, { "from": "human", "value": "import os\n\nimport taxii_services\n\nproject = u'django-taxii-services'\ncopyright = u'2014, The MITRE Corporation'\nversion = taxii_services.__version__\nrelease = vers...
python
chosen
[ { "from": "system", "value": "Change version for master status.\n" }, { "from": "human", "value": "\"\"\"\ndjango-all-access is a reusable application for user registration and authentication\nfrom OAuth 1.0 and OAuth 2.0 providers such as Twitter and Facebook.\n\"\"\"\n\n\n__version__ = '0.9.0'...
python
chosen
[ { "from": "system", "value": "Add a proxy method push in Solver -> Solver.sot.push.\n" }, { "from": "human", "value": "#!/usr/bin/env python\n# -*- coding: utf-8 -*-\n# Copyright 2011, Florent Lamiraux, Thomas Moulard, JRL, CNRS/AIST\n#\n# This file is part of dynamic-graph.\n# dynamic-graph is ...
python
chosen
[ { "from": "system", "value": "Implement GET Product using ListAPIView\n" }, { "from": "human", "value": "from django.http import HttpResponse\nfrom rest_framework.views import APIView\nfrom rest_framework.response import Response\nfrom .models import Product\nfrom .serializers import ProductSeri...
python
chosen
[ { "from": "system", "value": "Add a further path inside /sys to test\n\nOn (at least) a Debian \"stretch\" system, the charliecloud image contains\nnone of the tested paths inside /sys. This patch adds one that does\nexist there.\n\nSigned-off-by: Matthew Vernon <d2337109245c21c6e400ba5f0470cfb01956d9f2@san...
python
chosen
[ { "from": "system", "value": "Fix spelling left over from testing.\n" }, { "from": "human", "value": "#!/usr/bin/env python\n\nimport unittest\nfrom test import test_support\nimport smtplib\n\ntest_support.requires(\"network\")\n\nclass SmtpSSLTest(unittest.TestCase):\n testServer = 'smtp.gma...
python
chosen
[ { "from": "system", "value": "Fix users retrieval for daily meeting\n" }, { "from": "human", "value": "from datetime import datetime\nfrom tinydb import TinyDB, Query\nfrom tinydb_serialization import Serializer, SerializationMiddleware\n\nclass DateTimeSerializer(Serializer):\n OBJ_CLASS = d...
python
chosen
[ { "from": "system", "value": "Fix error, made command assume extras are params for now\n" }, { "from": "human", "value": "#!/usr/bin/env python\n\nimport json\nimport os\nimport sys\n\ndef raw_aliases():\n '''\n Reads in the aliases file as a Python object\n '''\n with open(os.enviro...
python
chosen
[ { "from": "system", "value": "Fix printing 'time: 303 µs' on py2.7\n" }, { "from": "human", "value": "from __future__ import print_function\n\ntry:\n from time import monotonic\nexcept ImportError:\n from monotonic import monotonic\n\nfrom IPython.core.magics.execution import _format_time ...
python
chosen