conversations
listlengths
2
3
source
stringclasses
1 value
stack
stringclasses
1 value
[ { "from": "system", "value": "Implement Bladed Cultist, Southsea Squidface, and Shadow Strike\n" }, { "from": "human", "value": "from ..utils import *\n\n\n##\n# Minions\n\n\n##\n# Spells\n\nclass OG_073:\n\t\"Thistle Tea\"\n\tplay = Draw(CONTROLLER).then(Give(CONTROLLER, Copy(Draw.CARD)) * 2)\n...
python
chosen
[ { "from": "system", "value": "Add Leaky ReLU activation.\nDifferentiation with autograd package confirmed to work correctly.\n" }, { "from": "human", "value": "import autograd.numpy as np\n\n\"\"\"\nReferences:\nhttps://en.wikipedia.org/wiki/Activation_function\n\"\"\"\n\n\ndef sigmoid(z):\n ...
python
chosen
[ { "from": "system", "value": "Fix import that was breaking py3k\n\n--HG--\nbranch : distribute\nextra : rebase_source : 76bf8f9213536189bce76a41e798c44c5f468cbd\n" }, { "from": "human", "value": "from distutils.core import Extension as _Extension\nfrom dist import _get_unpatched\n_Extension = _g...
python
chosen
[ { "from": "system", "value": "Clean - tool is not required, as tool_supported are there\n" }, { "from": "human", "value": "# Copyright 2014-2015 0xc0170\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# ...
python
chosen
[ { "from": "system", "value": "Add keyring to example config\n" }, { "from": "human", "value": "JIRA = {\n \"server\": \"https://example.com/jira/\",\n \"user\": \"user\",\n \"password\": \"password\"\n}\n" }, { "from": "gpt", "value": "import keyring\n\nJIRA = {\n \"serve...
python
chosen
[ { "from": "system", "value": "ENH: Remove errant printout in python cone layout example.\n" }, { "from": "human", "value": "from vtk import *\n\n\nreader = vtkXMLTreeReader()\nreader.SetFileName(\"vtkclasses.xml\")\nreader.Update()\nprint reader.GetOutput()\n\nview = vtkGraphLayoutView()\nview.A...
python
chosen
[ { "from": "system", "value": "tests: Check color length instead of value since the tests will fail on other versions of imageamgick\n" }, { "from": "human", "value": "\"\"\"Test imagemagick functions.\"\"\"\nimport unittest\n\nfrom pywal import colors\n\n\nclass TestGenColors(unittest.TestCase):...
python
chosen
[ { "from": "system", "value": "Add dependency on different migrations\n" }, { "from": "human", "value": "# -*- coding: utf-8 -*-\n# Generated by Django 1.10.2 on 2017-01-18 14:37\nfrom __future__ import unicode_literals\nimport binascii\nimport os\n\nfrom django.db import migrations\n\n\ndef gene...
python
chosen
[ { "from": "system", "value": "Update tests to cover every Roman WFI filter\n\n" }, { "from": "human", "value": "import pytest\n\nimport sncosmo\n\n\n@pytest.mark.might_download\ndef test_hst_bands():\n \"\"\" check that the HST and JWST bands are accessible \"\"\"\n for bandname in ['f606...
python
chosen
[ { "from": "system", "value": "Implement rdatatype-aware and NoAnswer-aware DNS handling\n\nThis will work for CNAME entries because CNAMEs hit by A or AAAA lookups behave like `dig` does - they will trigger a second resultset for the CNAME entry in order to return the IP address.\n\nThis also is amended to ...
python
chosen
[ { "from": "system", "value": "Change project factory default values\n" }, { "from": "human", "value": "import factory\nfrom django.contrib.auth.models import User\nfrom accounts.tests.factories import UserFactory\nfrom .. import models\n\n\nclass OrganizationFactory(factory.DjangoModelFactory):\...
python
chosen
[ { "from": "system", "value": "blog_page: Handle page module without translations extension too\n" }, { "from": "human", "value": "from django.utils import translation\nfrom feincms.module.page.models import Page\n\ndef blog_page(request):\n \"\"\" Used to get the feincms page navigation withi...
python
chosen
[ { "from": "system", "value": "Add basic Review model and use it for matches.\n" }, { "from": "human", "value": "from django.db import models\n\nfrom wrestlers.models import WrestlingEntity\n\n\nclass Card(models.Model):\n\n date = models.DateField()\n\n def __unicode__(self):\n retu...
python
chosen
[ { "from": "system", "value": "Add unittests for BMKG EQ List Scrapper\n" }, { "from": "human", "value": "# coding=utf-8\nimport logging\nimport unittest\n\nfrom django import test\nfrom timeout_decorator import timeout_decorator\n\nfrom realtime.app_settings import LOGGER_NAME\nfrom realtime.tas...
python
chosen
[ { "from": "system", "value": "Make checkPassword the only public API, remove verifyPassword\n" }, { "from": "human", "value": "\"\"\"\nA Twisted-friendly wrapper for scrypt.\n\"\"\"\nfrom txscrypt.wrapper import computeKey, verifyPassword\nfrom txscrypt._version import __version__\n\n__all__ = [...
python
chosen
[ { "from": "system", "value": "Add one more default option for git.\n" }, { "from": "human", "value": "from mykde import Action\n\n\nclass Action(Action):\n\n name = 'git'\n description = \"Git with helper programs and custom settings\"\n\n packages = ['git', 'gitk', 'giggle']\n\n def...
python
chosen
[ { "from": "system", "value": "Add a function to check status of internet connectivity\n" }, { "from": "human", "value": "import machine\n\ndef setntptime(maxretries=10):\n # ntptime is a helper module which gets packaged into the firmware\n # Check https://raw.githubusercontent.com/micropython...
python
chosen
[ { "from": "system", "value": "Write bytes; make Travis happy\n" }, { "from": "human", "value": "import pkgutil\nimport os\n\ndef install_kernel_resources(destination):\n \"\"\"\n Copy the resource files to the kernelspec folder.\n \"\"\"\n for filename in [\"logo-64x64.png\", \"logo-...
python
chosen
[ { "from": "system", "value": "Add __unicode__ method to UserAccount model\n" }, { "from": "human", "value": "# coding: utf-8\n\nfrom django.conf import settings\nfrom django.db import models\nfrom django.utils.translation import ugettext_lazy as _\nfrom registration.signals import user_activated...
python
chosen
[ { "from": "system", "value": "Include time of update start/end\n" }, { "from": "human", "value": "\"\"\"\nUpdates members and translations for all classes\n\nWhen LVF and LADL mappings change, everything under this change could change.\nWhen a frameset is hidden or shown, everything in that clas...
python
chosen
[ { "from": "system", "value": "Clean up return value for API\n" }, { "from": "human", "value": "import urlparse\nimport os, sys\nimport json\ntools_dir = os.environ.get('TOOLSDIR')\nlib_path = os.path.abspath(tools_dir)\nsys.path.append(lib_path)\nfrom msc_apps import *\n\ndata_dir_root = os.envi...
python
chosen
[ { "from": "system", "value": "Return text message on /\n" }, { "from": "human", "value": "from flask import Flask, render_template\nimport os\n\n\napp = Flask(__name__)\n\n@app.route('/')\ndef webprint():\n return(render_template('index.html'))\n\nif __name__ == \"__main__\":\n port = int(...
python
chosen
[ { "from": "system", "value": "MNT: Add StatusBase to top-level API.\n" }, { "from": "human", "value": "import logging\n\nlogger = logging.getLogger(__name__)\nlogger.addHandler(logging.NullHandler())\n\nfrom . import *\n\n\n# Signals\nfrom .signal import (Signal, EpicsSignal, EpicsSignalRO)\n\n#...
python
chosen
[ { "from": "system", "value": "Use sure in project tools cases\n" }, { "from": "human", "value": "from mock import MagicMock\nfrom django.core.exceptions import PermissionDenied\nfrom django.test import TestCase\nfrom accounts.tests.factories import UserFactory\nfrom ..utils import ProjectAccessM...
python
chosen
[ { "from": "system", "value": "Work with lists in functional way (map, filter)\n" }, { "from": "human", "value": "from geom2d import *\n\nl1 = []\n\nfor i in range(-5, 6):\n l1.append(Point(i, i*i))\n\nl2 = []\n\nfor el in l1:\n l2.append(Point(el.x, -el.y))\n\nprint(l1)\nprint(l2)\n\n# Lis...
python
chosen
[ { "from": "system", "value": "Correct output filename for data.\n" }, { "from": "human", "value": "#!/usr/bin/env python\n\nfrom rajab_roza import RajabRoza\n\nlat = 51.0 + 32.0/60.0\nlng = -22.0/60.0\nstart_year = 1400\nend_year = 1500\nfilename = \"london-durations.yml\"\n\nif __name__ == '__m...
python
chosen
[ { "from": "system", "value": "Improve API robustness\nCase where no JSON is sent\n" }, { "from": "human", "value": "#!/usr/bin/python3\nfrom flask import Flask, jsonify, request\nfrom funds_correlations import correlations, parse_performances_from_dict\nimport traceback\n\napp = Flask(__name__)\...
python
chosen
[ { "from": "system", "value": "Set middleware classes to suppress warning on 1.7+\n" }, { "from": "human", "value": "#!/usr/bin/env python\nimport os\nimport sys\n\nfrom django.conf import settings\ntry:\n from django import setup\nexcept ImportError:\n def setup():\n pass\n\n\nif no...
python
chosen
[ { "from": "system", "value": "Use a higher level command line api" }, { "from": "human", "value": "#!/usr/bin/env python\n\nimport os\nfrom django.core.management import call_command\n\n\nif __name__ == '__main__':\n os.environ['DJANGO_SETTINGS_MODULE'] = 'tests.settings'\n\n import django...
python
chosen
[ { "from": "system", "value": "Fix issue: 'URLResolver' object has no attribute 'regex'\n" }, { "from": "human", "value": "import re\n\nfrom django.core.management import BaseCommand\nfrom django.urls import get_resolver\n\nfrom corehq.apps.hqwebapp.decorators import waf_allow\n\n\nclass Command(...
python
chosen
[ { "from": "system", "value": "Update pull results default value in batches\n" }, { "from": "human", "value": "# -*- coding: utf-8 -*-\n# Generated by Django 1.11.11 on 2018-03-16 09:12\nfrom __future__ import unicode_literals\n\nfrom django.db import migrations, models\n\n\nclass Migration(migra...
python
chosen
[ { "from": "system", "value": "[ATMO-1201] Add 'DELETE' operation to Maintenance Record\n" }, { "from": "human", "value": "import django_filters\n\nfrom rest_framework import filters\nfrom rest_framework.serializers import ValidationError\n\nfrom core.models import AtmosphereUser, MaintenanceReco...
python
chosen
[ { "from": "system", "value": "Delete redundant lines of code\n" }, { "from": "human", "value": "# encoding: utf-8\n\n\"\"\"\n.. codeauthor:: Tsuyoshi Hombashi <gogogo.vm@gmail.com>\n\"\"\"\n\nfrom __future__ import absolute_import\n\nimport dataproperty\n\nfrom ._text_writer import TextTableWrit...
python
chosen
[ { "from": "system", "value": "[FIX] Return Ayah's pk instead of number\n" }, { "from": "human", "value": "from django.urls import reverse\n\nfrom rest_framework import serializers\n\nfrom .models import Tafseer, TafseerText\n\n\nclass TafseerSerializer(serializers.ModelSerializer):\n\n class ...
python
chosen
[ { "from": "system", "value": "Add warn and usage message options\n" }, { "from": "human", "value": "from __future__ import print_function\n\nimport sys\n\n\ndef error(message, exit=True):\n \"\"\"Print an error message and optionally exit.\"\"\"\n\n assert isinstance(message, str), \"messa...
python
chosen
[ { "from": "system", "value": "Change some errors to go to stderr.\n\nThese non-fatal errors violated GTP protocol.\n" }, { "from": "human", "value": "# Copyright 2018 Google LLC\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may not use this file except in complia...
python
chosen
[ { "from": "system", "value": "Update AWS::FMS::Policy per 2020-06-18 changes\n" }, { "from": "human", "value": "# Copyright (c) 2012-2020, Mark Peek <mark@peek.org>\n# All rights reserved.\n#\n# See LICENSE file for full license.\n\n\nfrom . import AWSProperty, AWSObject, Tags\nfrom .validators ...
python
chosen
[ { "from": "system", "value": "Fix unicode encoding of Slack message posts\n" }, { "from": "human", "value": "#! /usr/bin/env python2.7\n\nimport requests\n\n\nclass Slackbot(object):\n\n def __init__(self, slack_name, token):\n self.slack_name = slack_name\n self.token = token\n...
python
chosen
[ { "from": "system", "value": "Make redirect-to-API work even with URL prefix\n" }, { "from": "human", "value": "from django.conf.urls import url, include\nfrom django.views.generic import RedirectView\n\nfrom .api import LinkedEventsAPIRouter\n\nfrom django.contrib import admin\nadmin.autodiscov...
python
chosen
[ { "from": "system", "value": "Revert \"Implement send message functionality\"\n" }, { "from": "human", "value": "from lib.config import Config\nfrom slackclient import SlackClient\n\nclass Tubey():\n\n def __init__(self, **kwargs):\n ### Cache the client in memory ###\n self._cl...
python
chosen
[ { "from": "system", "value": "Add proxy fix as in lr this will run with reverse proxy\n" }, { "from": "human", "value": "import os\nimport logging\n\nfrom flask import Flask\nfrom flask.ext.sqlalchemy import SQLAlchemy\n\nfrom .health import Health\n\napp = Flask(__name__)\n\napp.config.from_obj...
python
chosen
[ { "from": "system", "value": "Add Accept header to use version 1.1\n" }, { "from": "human", "value": "from libcloud.utils.py3 import httplib\nfrom libcloud.common.types import InvalidCredsError\nfrom libcloud.common.base import JsonResponse\nfrom libcloud.common.base import ConnectionKey\n\n\ncl...
python
chosen
[ { "from": "system", "value": "Disable Wagtail update check in prod\n" }, { "from": "human", "value": "from .base import *\n\nDEBUG = False\n\ntry:\n from .local import *\nexcept ImportError:\n pass\n" }, { "from": "gpt", "value": "from .base import *\n\nDEBUG = False\n\nWAGTAIL...
python
chosen
[ { "from": "system", "value": "Set some event data on 404 logging\n" }, { "from": "human", "value": "from django.views import defaults\nfrom sentry_sdk import capture_message\n\n\ndef page_not_found(*args, **kwargs):\n capture_message(\"Page not found\", level=\"error\")\n\n return defaults...
python
chosen
[ { "from": "system", "value": "Update clean project jobs command\n" }, { "from": "human", "value": "from django.core.management import BaseCommand\nfrom django.db import ProgrammingError\nfrom django.db.models import Q\n\nfrom projects.models import Project\nfrom runner.schedulers import notebook...
python
chosen
[ { "from": "system", "value": "Add info about required updates in AttributeEntityType\n" }, { "from": "human", "value": "class AttributeInputType:\n \"\"\"The type that we expect to render the attribute's values as.\"\"\"\n\n DROPDOWN = \"dropdown\"\n MULTISELECT = \"multiselect\"\n F...
python
chosen
[ { "from": "system", "value": "Add compile_to_json invocation in Myrial test fixture\n" }, { "from": "human", "value": "\nimport collections\nimport math\nimport unittest\n\nimport raco.fakedb\nimport raco.myrial.interpreter as interpreter\nimport raco.myrial.parser as parser\n\nclass MyrialTestC...
python
chosen
[ { "from": "system", "value": "Delete cookie instead of setting to empty string.\n" }, { "from": "human", "value": "from inthe_am.taskmanager.models import TaskStore\n\n\nclass AuthenticationTokenMiddleware(object):\n def __init__(self, get_response):\n self.get_response = get_response\...
python
chosen
[ { "from": "system", "value": "Fix the migration to actual work." }, { "from": "human", "value": "# Created by Noah Kantrowitz on 2007-07-04.\n# Copyright (c) 2007 Noah Kantrowitz. All rights reserved.\n\nfrom trac.db import Table, Column\n\nname = 'mastertickets'\nversion = 2\ntables = [\n Ta...
python
chosen
[ { "from": "system", "value": "Increase size of the alternative field\n\n- NC-87\n" }, { "from": "human", "value": "from __future__ import unicode_literals\n\nfrom django.db import models\nfrom django.utils.encoding import python_2_unicode_compatible\nfrom django.utils.translation import ugettext...
python
chosen
[ { "from": "system", "value": "Add aliases for HIVE_WAREHOUSE_CONNECTOR, DATAFRAME_TO_STREAM and STREAM_TO_STREAM\n" }, { "from": "human", "value": "#\n# Licensed to the Apache Software Foundation (ASF) under one or more\n# contributor license agreements. See the NOTICE file distributed with\n# ...
python
chosen
[ { "from": "system", "value": "Fix indentation error in LongOnly.__ne__()\n\nAlso follow Python porting best practice [__use feature detection instead of version detection__](https://docs.python.org/3/howto/pyporting.html#use-feature-detection-instead-of-version-detection)." }, { "from": "human", ...
python
chosen
[ { "from": "system", "value": "lib/helpers: Use flask.flash instead of tg.flash\n" }, { "from": "human", "value": "# -*- coding: utf-8 -*-\n\n\"\"\"WebHelpers used in SkyLines.\"\"\"\n\nfrom __future__ import absolute_import\n\nimport datetime\nimport simplejson as json\nfrom urllib import urlenc...
python
chosen
[ { "from": "system", "value": "Increase version number to 0.2.0\n" }, { "from": "human", "value": "# Copyright (c) 2017 \"Shopify inc.\" All rights reserved.\n# Use of this source code is governed by a MIT-style license that can be found in the LICENSE file.\nfrom __future__ import unicode_litera...
python
chosen
[ { "from": "system", "value": "Add initial function for get_source_files\n" }, { "from": "human", "value": "__version__ = \"0.1\"\n" }, { "from": "gpt", "value": "__version__ = \"0.1\"\n\nimport requests\nimport io\nimport tarfile\n\nimport ccr\n\ndef get_source_files(pkgname, working...
python
chosen
[ { "from": "system", "value": "Increase minor version number + dev.\n\n\nFormer-commit-id: 44023123016583dcb692ce23c19978e6f5d90abd [formerly 01b7fa7fe0778c195d9f75d35d43618691778ef8]\nFormer-commit-id: a96aa4b8265bf7b15143879b0a3b98e30a9e5953" }, { "from": "human", "value": "__author__ = \"Shyue...
python
chosen
[ { "from": "system", "value": "Add an alias to file_open_zip_aware as openz.\n\n\nFormer-commit-id: 97796b7a5593858b2fc15c8009658926afa3eda0 [formerly 1ce26a0b0cbddb49047da0f8bac8214fb298c646]\nFormer-commit-id: 7bdb412108a247f3ebc9d3d9906f03c222178449" }, { "from": "human", "value": "__author__ ...
python
chosen
[ { "from": "system", "value": "Update utility module friendly imports.\n" }, { "from": "human", "value": "\"\"\"\nSkCode utilities library.\n\"\"\"\n\n# Auto paragraphs utility\nfrom .paragraphs import (PARAGRAPH_NODE_NAME,\n ParagraphTagOptions,\n ...
python
chosen
[ { "from": "system", "value": "Allow targets to be specified as files\n" }, { "from": "human", "value": "\"\"\"\ntaskmaster.util\n~~~~~~~~~~~~~~~\n\n:copyright: (c) 2010 DISQUS.\n:license: Apache License 2.0, see LICENSE for more details.\n\"\"\"\n\n\ndef import_target(target, default=None):\n ...
python
chosen
[ { "from": "system", "value": "Fix compatibility with Numpy 1.4.1" }, { "from": "human", "value": "# Licensed under a 3-clause BSD style license - see LICENSE.rst\nimport numpy as np\nfrom numpy.testing import assert_allclose\n\nfrom ....tests.helper import pytest\n\nfrom ..make_kernel import mak...
python
chosen
[ { "from": "system", "value": "Write response now returns None since after packaging, the code becomes unusable\n" }, { "from": "human", "value": "import os\n\nfrom mws.mws import DictWrapper\n\nrequesters_dir = os.path.dirname(os.path.abspath(__file__))\nresponses_dir = os.path.join(requesters_d...
python
chosen
[ { "from": "system", "value": "Remove extra slash from url (poster url returned from api is preceded by one)\n" }, { "from": "human", "value": "import os\nimport requests\n\n\nclass TmdbService:\n\n __TMDB_API = 'https://api.themoviedb.org/3/movie/'\n __IMAGE_URL = 'https://image.tmdb.org/t...
python
chosen
[ { "from": "system", "value": "Change to avoid a DeprecationWarning\n" }, { "from": "human", "value": "# encoding: utf-8\n\n\"\"\"\n.. codeauthor:: Tsuyoshi Hombashi <tsuyoshi.hombashi@gmail.com>\n\"\"\"\n\nfrom __future__ import absolute_import, unicode_literals\n\nimport subprocrunner as spr\n\...
python
chosen
[ { "from": "system", "value": "Revert deletion of clean_orientation function\n\nThe clean_orientation function is needed for the active configuration\nplot. I am yet to change that to using the plot function.\n" }, { "from": "human", "value": "#! /usr/bin/env python\n# -*- coding: utf-8 -*-\n# vi...
python
chosen
[ { "from": "system", "value": "stdlib: Make api directly available in stdlib\n" }, { "from": "human", "value": "\"\"\"\n:py:mod:`leapp.libraries.stdlib`\nrepresents a location for functions that otherwise would be defined multiple times across leapp actors\nand at the same time, they are really u...
python
chosen
[ { "from": "system", "value": "Remove a couple useless imports\n" }, { "from": "human", "value": "import datetime\nimport json\nimport logging\nimport socket\nimport traceback\n\nfrom threading import Thread\nfrom splunklib import client\n\n_client = None\n\n\nclass SplunkFilter(logging.Filter):\...
python
chosen
[ { "from": "system", "value": "Allow Logger to be subclassed and modified more easily\n" }, { "from": "human", "value": "import os\nfrom .core import Agent\nfrom .core import Proxy\n\n\ndef pyro_log():\n os.environ[\"PYRO_LOGFILE\"] = \"pyro_osbrain.log\"\n os.environ[\"PYRO_LOGLEVEL\"] = \...
python
chosen
[ { "from": "system", "value": "Fix multiprocessing tests in python2.7\n\nCloses #28 for python 2.\n\nApparently, process pools are not contexts in python 2.7.\nOn the other hand, in py2 you cannot pickle instance methods, so\nyou have to implement Pool tasks as independent functions.\n" }, { "from": ...
python
chosen
[ { "from": "system", "value": "Add cancel call to call buffer\n" }, { "from": "human", "value": "from constants import *\nimport collections\nimport uuid\n\nclass CallBuffer():\n def __init__(self):\n self.waiter = None\n self.queue = collections.deque(maxlen=CALL_QUEUE_MAX)\n ...
python
chosen
[ { "from": "system", "value": "Replace execfile with py3 equivalent\n" }, { "from": "human", "value": "# -*- coding: utf-8 -*-\n\nimport os\nimport stat\nfrom os.path import join, abspath\nfrom subprocess import call\n\ndef prepare(globs, locs):\n # RTD defaults the current working directory t...
python
chosen
[ { "from": "system", "value": "Add Mask to toplevel pygame namespace\n" }, { "from": "human", "value": "\"\"\" XXX: fish \"\"\"\n\nfrom pygame.color import Color\nfrom pygame.rect import Rect\nfrom pygame.surface import Surface\nfrom pygame.constants import *\nfrom pygame import (\n display, c...
python
chosen
[ { "from": "system", "value": "Add date to info reported for new links\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\n#\n# htt...
python
chosen
[ { "from": "system", "value": "Revise tests to use np.testing.assert_allclose\n\nthis is better - if na values mismatch (e,g, na in result where expected\nhas a value) this errors and gives a message to that effect. the\nprevious one just errored and it was very hard to tell why\n" }, { "from": "huma...
python
chosen
[ { "from": "system", "value": "Load job from a job file instead of stdin.\n" }, { "from": "human", "value": "\"\"\"\ncargo/condor/host.py\n\nHost individual condor jobs.\n\n@author: Bryan Silverthorn <bcs@cargo-cult.org>\n\"\"\"\n\nimport os\nimport sys\nimport cPickle as pickle\n\ndef main():\n ...
python
chosen
[ { "from": "system", "value": "Add db_name to options for use in model.Meta class\n" }, { "from": "human", "value": "VERSION = (0, 0, 0)\n__version__ = '.'.join(map(str, VERSION))\n\n\nfrom django import template\ntemplate.add_to_builtins('common.templatetags.common')\ntemplate.add_to_builtins('c...
python
chosen
[ { "from": "system", "value": "Use [] notation in wrapper module for task management\n" }, { "from": "human", "value": "from t2activity import NestedWorkflow\nfrom t2types import ListType, String\nfrom t2flow import Workflow\n\nclass WrapperWorkflow(Workflow):\n\n\tdef __init__(self, flow):\n\t\t...
python
chosen
[ { "from": "system", "value": "Remove an ancient configuration setting.\n" }, { "from": "human", "value": "\"\"\"@author: Bryan Silverthorn <bcs@cargo-cult.org>\"\"\"\n\nimport os\n\nmachine_speed = 1.0\nminimum_fake_run_budget = 1800.0 # XXX\nproc_poll_period = 1.0\nroot_log_level = os.environ.g...
python
chosen
[ { "from": "system", "value": "Add the staging service account to the account whitelist.\n" }, { "from": "human", "value": "\"\"\"Configuration parameters.\n\nContains things such as the database to connect to.\n\"\"\"\n\nCLOUDSQL_INSTANCE = 'pmi-drc-api-test:us-central1:pmi-rdr'\nCLOUDSQL_SOCKET...
python
chosen
[ { "from": "system", "value": "Fix ndimage complaining about shift being of NoneType\n" }, { "from": "human", "value": "# Perform alignment to the estimated rotation axis\n#\n# Developed as part of the tomviz project (www.tomviz.com).\n\n\ndef transform_scalars(dataset, SHIFT=None, rotation_angle...
python
chosen
[ { "from": "system", "value": "Rewrite urlpatterns to new format\n" }, { "from": "human", "value": "from __future__ import absolute_import, unicode_literals\n\nfrom django.conf.urls import patterns, url\nfrom django.views.generic import TemplateView\n\nurlpatterns = patterns( # pylint: disable=i...
python
chosen
[ { "from": "system", "value": "Add debug print of data\n" }, { "from": "human", "value": "from __future__ import print_function\n\nimport boto3\nimport json\nimport os\nimport btr3baseball\n\njobTable = os.environ['JOB_TABLE']\njobQueue = os.environ['JOB_QUEUE']\nqueue = boto3.resource('sqs').get...
python
chosen
[ { "from": "system", "value": "Replace call to deprecated virtool.file.processor\n\n" }, { "from": "human", "value": "import os\n\nimport virtool.file\nimport virtool.utils\nfrom virtool.handlers.utils import json_response, not_found\n\n\nasync def find(req):\n db = req.app[\"db\"]\n\n quer...
python
chosen
[ { "from": "system", "value": "Remove transport from WSGI script\n\nThe setup_app method no longer requires transport as input.\n\nChange-Id: I4caf397a48e30822d423c8cf7d40f2773f9aa951\nCloses-Bug: 1443654\n" }, { "from": "human", "value": "# Copyright 2015 - StackStorm, Inc.\n#\n# Licensed und...
python
chosen
[ { "from": "system", "value": "ENH: Add optional dependence on FFTW for faster bandpass\n" }, { "from": "human", "value": "import numpy as np\nfrom scipy.ndimage.filters import uniform_filter\nfrom scipy.ndimage.fourier import fourier_gaussian\n\n\ndef bandpass(image, lshort, llong, threshold=1):...
python
chosen
[ { "from": "system", "value": "Modify hostname for web integration tests\n" }, { "from": "human", "value": "import requests\nimport pytest\n\n\nclass TestWebUI(object):\n def get_page(self, page):\n return requests.get('http://127.0.0.1' + page)\n\n pages = [\n {\n ...
python
chosen
[ { "from": "system", "value": "Apply active_entries fix from payroll-reports branch\n" }, { "from": "human", "value": "from django.conf import settings\n\nfrom timepiece import models as timepiece\nfrom timepiece.forms import QuickSearchForm\n\n\ndef timepiece_settings(request):\n default_famf...
python
chosen
[ { "from": "system", "value": "Check github response before parsing\n" }, { "from": "human", "value": "import json, requests\nfrom wagtail.wagtailadmin.edit_handlers import FieldPanel\nfrom wagtail.wagtailcore.models import Page, Orderable\nimport django.utils.dateparse as dateparse\nfrom django....
python
chosen
[ { "from": "system", "value": "Fix import error caught by new version of isort (4.2.8)\n" }, { "from": "human", "value": "\"\"\"Patch ReSDK resources with analysis methods.\"\"\"\nfrom __future__ import absolute_import, division, print_function, unicode_literals\n\nfrom resdk.analysis.alignment i...
python
chosen
[ { "from": "system", "value": "Add the -v flag to work with linux nc\n" }, { "from": "human", "value": "# (C) Datadog, Inc. 2010-2016\n# All rights reserved\n# Licensed under Simplified BSD License (see LICENSE)\nimport os\n\nimport pytest\n\nfrom .common import INSTANCE, HOST\nfrom datadog_check...
python
chosen
[ { "from": "system", "value": "Use lxml instead of elementtree.\n" }, { "from": "human", "value": "#!/usr/bin/env python\n\nfrom xml.dom import minidom\nimport xml.etree.ElementTree as ET\nimport xmltodict\n\ndef add(k, parent=None, txt=None, attrs=None):\n if parent is None:\n handle = ET.El...
python
chosen
[ { "from": "system", "value": "Delete unneeded code form migration\n" }, { "from": "human", "value": "\"\"\"\n\nRevision ID: 0334_broadcast_message_number\nRevises: 0333_service_broadcast_provider\nCreate Date: 2020-12-04 15:06:22.544803\n\n\"\"\"\nfrom alembic import op\nimport sqlalchemy as sa\...
python
chosen
[ { "from": "system", "value": "Use old style string format method to avoid formatting warning\n" }, { "from": "human", "value": "'''\r\n@date 2013-5-9\r\n\r\n@author Hong-She Liang <starofrainnight@gmail.com>\r\n'''\r\n\r\nimport sys\r\nimport os\r\n\r\n# Import the global logging unit, not our l...
python
chosen
[ { "from": "system", "value": "Quit coverage task early if no coverage installed\n" }, { "from": "human", "value": "from invoke import ctask as task\n\n\n@task(help={\n 'module': \"Just runs tests/STRING.py.\",\n 'runner': \"Use STRING to run tests instead of 'spec'.\",\n 'opts': \"Extra...
python
chosen
[ { "from": "system", "value": "Clean up code a bit\n" }, { "from": "human", "value": "# -*- coding: utf-8 -*-\n\"\"\"User views.\"\"\"\nfrom flask import Blueprint, render_template\nfrom flask_login import login_required\n\nblueprint = Blueprint('user', __name__, url_prefix='/users', static_folde...
python
chosen
[ { "from": "system", "value": "Increase threshold for showing resource submissions\n" }, { "from": "human", "value": "\"\"\"Settings for POET application.\"\"\"\n\nNUM_RESOURCES_PER_FORM = 3\nMINIMUM_SUBMISSIONS_PER_RESOURCE = 10\n" }, { "from": "gpt", "value": "\"\"\"Settings for POE...
python
chosen
[ { "from": "system", "value": "Add index assertion during segment exit and fix segment cleanup logic\n" }, { "from": "human", "value": "class StackFrame(object):\n\n def __init__(self, instance):\n self.instance = instance\n self.data = {}\n self.idx = 0\n self.retu...
python
chosen
[ { "from": "system", "value": "Improve testing of student patching\n" }, { "from": "human", "value": "from flask import json\nfrom helper import TestCase\nfrom models import db, Major\n\n\nclass StudentsTestCase(TestCase):\n\n def setUp(self):\n super(StudentsTestCase, self).setUp()\n\n...
python
chosen
[ { "from": "system", "value": "Add tests for NotationConverter methods\n" }, { "from": "human", "value": "import unittest\nfrom src import conversion\n\nclass TestNotationConverter(unittest.TestCase):\n \"\"\"Tests for NotationConverter class\"\"\"\n def test_alg_search_good_input_a5(self):...
python
chosen
[ { "from": "system", "value": "Allow data operations to run for 'test'\n" }, { "from": "human", "value": "import sys\n\n\ndef canAppAccessDatabase():\n \"\"\"\n Returns True if the apps.py file can access database records.\n\n There are some circumstances where we don't want the ready fu...
python
chosen
[ { "from": "system", "value": "Add acre.one to allowed host\n" }, { "from": "human", "value": "from .base import *\nimport os\n\nDATABASES = {\n 'default': {\n 'ENGINE': 'django.db.backends.postgresql_psycopg2',\n 'NAME': os.environ['RDS_DB_NAME'],\n 'HOST': os.environ['RD...
python
chosen