conversations
listlengths
2
3
source
stringclasses
1 value
stack
stringclasses
1 value
[ { "from": "system", "value": "Add postmortem debugging option to CLI\n" }, { "from": "human", "value": "# -*- coding: utf-8 -*-\nfrom __future__ import division, print_function\nimport logging\nimport sys\n\nimport click\nfrom .. import __version__, get_logger\n\nlogging.basicConfig(stream=sys.s...
python
chosen
[ { "from": "system", "value": "Fix for PREFIX omission in S3 push\n" }, { "from": "human", "value": "import os\nimport pip\nimport tempfile\nimport subprocess\nimport opentis.version\n\n\nBUCKET_NAME = 'openpathsampling.org'\nif not opentis.version.release:\n PREFIX = 'latest'\nelse:\n PREF...
python
chosen
[ { "from": "system", "value": "Use @lru_cache now that memoize is gone.\n" }, { "from": "human", "value": "from django.utils.functional import memoize\n\nfrom . import app_settings\n\ndef get_render_method():\n return from_dotted_path(app_settings.EMAIL_RENDER_METHOD)\nget_render_method = memo...
python
chosen
[ { "from": "system", "value": "Update the profile alignment example.\n" }, { "from": "human", "value": "# Create sequences to be aligned.\nfrom alignment.sequence import Sequence\na = Sequence(\"what a beautiful day\".split())\nb = Sequence(\"what a disappointingly bad day\".split())\nprint \"Seq...
python
chosen
[ { "from": "system", "value": "Use duck typing when creating a RangeSet\n" }, { "from": "human", "value": "from itertools import chain\nfrom typing import Sized, Iterable, Container, Set\n\n\nclass RangeSet(Sized, Iterable, Container):\n def __init__(self, *ranges):\n self.ranges = []\n...
python
chosen
[ { "from": "system", "value": "Update version number to 0.1.10.dev0.\n\nPiperOrigin-RevId: 202663603\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 ...
python
chosen
[ { "from": "system", "value": "Add showname to playlist API view.\n\n* Even though it's obsolete now, we need it for old shows.\n" }, { "from": "human", "value": "from rest_framework import serializers\nfrom .models import Cd, Cdtrack, Show, Playlist, PlaylistEntry\n\n\nclass TrackSerializer(seri...
python
chosen
[ { "from": "system", "value": "Save trans to .po files\n" }, { "from": "human", "value": "# coding: utf-8\nfrom __future__ import unicode_literals\n\nfrom optparse import make_option\nfrom django.core.management.base import NoArgsCommand\n\n\nclass Command(NoArgsCommand):\n\n option_list = NoA...
python
chosen
[ { "from": "system", "value": "Configure package-level logging to avoid warning.\n" }, { "from": "human", "value": "try:\n from .allauth import *\nexcept ImportError:\n from .chinup import *\n\nfrom .exceptions import *\n\n\n__version__ = '0.1'\n" }, { "from": "gpt", "value": "f...
python
chosen
[ { "from": "system", "value": "Update our MessagingHub.subscribe method arguments\n" }, { "from": "human", "value": "# This file is part of Moksha.\n# Copyright (C) 2008-2010 Red Hat, Inc.\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may not use this file except...
python
chosen
[ { "from": "system", "value": "Add tests to cover update parent functionality.\n" }, { "from": "human", "value": "import unittest\nfrom odml import Property, Section, Document\n\n\nclass TestProperty(unittest.TestCase):\n\n def setUp(self):\n pass\n\n def test_value(self):\n p...
python
chosen
[ { "from": "system", "value": "Make the word display nice\n" }, { "from": "human", "value": "from django.db import models\n\n\nclass Word(models.Model):\n word = models.CharField(max_length=255)\n date_retired = models.DateTimeField(null=True, blank=True)\n date_active = models.DateTimeF...
python
chosen
[ { "from": "system", "value": "Change test function as existing method deprecated\n" }, { "from": "human", "value": "import pytest\n\n@pytest.mark.parametrize(\"name, enabled, running\", [\n (\"cron\", \"enabled\", \"running\"),\n (\"docker\", \"enabled\", \"running\"),\n (\"firewalld\", \"ena...
python
chosen
[ { "from": "system", "value": "Add config key for default cache lifetime\n" }, { "from": "human", "value": "PORT=1248\nBEACON_TIMEOUT=5\nDEFAULT_BUFSIZE=8192\n" }, { "from": "gpt", "value": "PORT=1248\nBEACON_TIMEOUT=5\nDEFAULT_BUFSIZE=8192\nDEFAULT_CACHE_LIFETIME=900\n" } ]
python
chosen
[ { "from": "system", "value": "Add warning about outdated pymongo versions.\n\nsignac currently only supports pymongo versions 3.x.\n" }, { "from": "human", "value": "import warnings\ntry:\n import pymongo # noqa\nexcept ImportError:\n warnings.warn(\"Failed to import pymongo. \"\n ...
python
chosen
[ { "from": "system", "value": "Convert unicode string to byte array on Python 3\n" }, { "from": "human", "value": "from django import template\nfrom django.template.defaultfilters import stringfilter\nfrom django.template.base import TemplateSyntaxError\nimport hashlib\nfrom django_hash_filter.te...
python
chosen
[ { "from": "system", "value": "Save over 50% of logfile 'bloat' by not repeating all args on success/failure\n\nThe data will be right above it just before we run the job.\n" }, { "from": "human", "value": "from __future__ import absolute_import\n\nimport logging\nimport traceback\n\nlog = loggin...
python
chosen
[ { "from": "system", "value": "Fix the command and make it actually work\n\nPass discord.Member as user\n" }, { "from": "human", "value": "import discord\r\nfrom discord.ext import commands\r\n\r\nclass Furry:\r\n \"\"\"A cog that adds weird furry commands or something\"\"\"\r\n\r\n def __i...
python
chosen
[ { "from": "system", "value": "Move workspace before window creation so config set for window\n\n" }, { "from": "human", "value": "import sys\nfrom PyQt5.QtWidgets import QApplication\n\nfrom datalogger.api.workspace import Workspace\nfrom datalogger.analysis_window import AnalysisWindow\nfrom da...
python
chosen
[ { "from": "system", "value": "Deploy Travis CI build 834 to GitHub\n" }, { "from": "human", "value": "\"\"\"Unit tests configuration file.\"\"\"\n\n\ndef pytest_configure(config):\n \"\"\"Disable verbose output when running tests.\"\"\"\n terminal = config.pluginmanager.getplugin('terminal...
python
chosen
[ { "from": "system", "value": "Add rev generation via normalized timestamps\n" }, { "from": "human", "value": "'''\nMisc utilities\n'''\n\n# Import python libs\nimport os\nimport binascii\n\n\ndef rand_hex_str(size):\n '''\n Return a random string of the passed size using hex encoding\n ...
python
chosen
[ { "from": "system", "value": "Add default encoding utf-8 for test file\n" }, { "from": "human", "value": "from __future__ import unicode_literals\n\nfrom spacy.lang.hi import Hindi\n\ndef test_issue3625():\n \"\"\"Test that default punctuation rules applies to hindi unicode characters\"\"\"\n...
python
chosen
[ { "from": "system", "value": "Rename the parser function to parse_jobs.\n" }, { "from": "human", "value": "# -*- coding: utf-8 -*-\n\nfrom logging import getLogger\nfrom scrapy.spiders import Rule, CrawlSpider\nfrom scrapy.linkextractors import LinkExtractor\n\n\nclass DataScienceJobsSpider(Craw...
python
chosen
[ { "from": "system", "value": "Handle entries that have no image associated with them\n" }, { "from": "human", "value": "from django.contrib import admin\nfrom django.contrib.contenttypes.generic import GenericTabularInline\n\nfrom sorl.thumbnail import get_thumbnail\nfrom sorl.thumbnail.admin im...
python
chosen
[ { "from": "system", "value": "Make pylint happy as per graphite-web example\n" }, { "from": "human", "value": "import os\nimport re\n\n# Use the built-in version of scandir/walk if possible, otherwise\n# use the scandir module version\ntry:\n from os import scandir, walk\nexcept ImportError:\...
python
chosen
[ { "from": "system", "value": "Synchronize testing module with BetterBatch one - and integrate Coverage reporting\n" }, { "from": "human", "value": "import unittest\r\n\r\nimport os.path\r\nimport os\r\nimport sys\r\nsys.path.append(\".\")\r\n\r\n#from pywinauto.timings import Timings\r\n#Timings...
python
chosen
[ { "from": "system", "value": "Modify return variable and partenesis\n" }, { "from": "human", "value": "# -*- coding:utf8 -*-\n\nfrom plantmeter.isodates import isodate\nfrom dateutil.relativedelta import relativedelta\n\nwaitYears = 1\nexpirationYears = 25\n\ndef previousAmortizationDate(purchas...
python
chosen
[ { "from": "system", "value": "Add border as option (set via alpha)" }, { "from": "human", "value": "# -*- coding: utf-8 -*-\nfrom kivy.lang import Builder\nfrom kivy.properties import BoundedNumericProperty, ReferenceListProperty\nfrom kivy.uix.boxlayout import BoxLayout\nfrom kivymd.elevationbe...
python
chosen
[ { "from": "system", "value": "Use doc-string, not comments in default config.\n" }, { "from": "human", "value": "# Default Config\n# Override these values in the instance/local_config.py file, not this one.\n\nDEBUG = None\n\nDOMAIN = 'localhost'\n\nHOST = 'localhost'\nPORT = 5000\n" }, { ...
python
chosen
[ { "from": "system", "value": "Add IOError custom message when rsa key file is missing.\n" }, { "from": "human", "value": "from django.conf import settings as django_settings\nfrom django.core.urlresolvers import reverse\n\nfrom oidc_provider import settings\n\n\ndef get_issuer():\n \"\"\"\n ...
python
chosen
[ { "from": "system", "value": "Add hash from the bot name to the log name\n" }, { "from": "human", "value": "# -*- coding: utf-8 -*-\n\nimport datetime\nimport logging\n\nimport os\n\n\ndef set_up_logging():\n \"\"\"\n Main logger for usual bot needs\n \"\"\"\n logs_directory = os.pat...
python
chosen
[ { "from": "system", "value": "Add fields to the public API.\n" }, { "from": "human", "value": "\"\"\"\nEliot: Logging as Storytelling\n\n Suppose we turn from outside estimates of a man, to wonder, with keener\n interest, what is the report of his own consciousness about his doings or\n ...
python
chosen
[ { "from": "system", "value": "Disable testing on Windows for now, it just takes too long for any CI service\n" }, { "from": "human", "value": "#!/usr/bin/env python\n\nimport os\nos.environ[\"MPLBACKEND\"] = 'agg'\n\nimport matplotlib\nmatplotlib.use('agg')\n\nimport pytest\nimport oggm\nimport ...
python
chosen
[ { "from": "system", "value": "Use simple prints for logging.\n" }, { "from": "human", "value": "#!/home/hadoop/anaconda2/bin/ipython\n\nimport logging\nfrom os import environ\nfrom mozaggregator.aggregator import aggregate_metrics\nfrom mozaggregator.db import submit_aggregates\n\nlogger = loggi...
python
chosen
[ { "from": "system", "value": "Make Member part of the public api\n" }, { "from": "human", "value": "from __future__ import absolute_import\n\nfrom etcd3.client import Etcd3Client\nfrom etcd3.client import client\nfrom etcd3.client import Transactions\n\n__author__ = 'Louis Taylor'\n__email__ = '...
python
chosen
[ { "from": "system", "value": "Fix website attribute in manifest\n" }, { "from": "human", "value": "# Copyright 2016 Tecnativa - Pedro M. Baeza\n# Copyright 2017 Tecnativa - Vicent Cubells\n# Copyright 2018 Tecnativa - Cristina Martin\n# License AGPL-3.0 or later (https://www.gnu.org/licenses/agp...
python
chosen
[ { "from": "system", "value": "Make all lines shorter than 80 characters\n" }, { "from": "human", "value": "import os\nimport re\n\n\nclass OratioIgnoreParser():\n def __init__(self):\n self.ignored_paths = [\"oratiomodule.tar.gz\"]\n\n def load(self, oratio_ignore_path):\n wi...
python
chosen
[ { "from": "system", "value": "Fix unicode in parsable text\n" }, { "from": "human", "value": "from docutils import core\n\n\nclass ParsableText:\n \"\"\"Allow to parse a string with different parsers\"\"\"\n \n def __init__(self,content,mode=\"rst\"):\n \"\"\"Init the object. Con...
python
chosen
[ { "from": "system", "value": "Add new agents to init file\n" }, { "from": "human", "value": "from .TDControlAgent import Q_Learning, SARSA\n# for compatibility of old scripts\nQ_LEARNING = Q_Learning\nfrom .Greedy_GQ import Greedy_GQ\nfrom .LSPI import LSPI\nfrom .LSPI_SARSA import LSPI_SARSA\nf...
python
chosen
[ { "from": "system", "value": "Use Linkr-unique session cookie name\n" }, { "from": "human", "value": "# flake8: noqa: E501\n\nimport config.options\n\n\n# Flask-SQLAlchemy\nSQLALCHEMY_DATABASE_URI = 'mysql://{database_user}:{database_password}@{database_host}/{database_name}'.format(\n databa...
python
chosen
[ { "from": "system", "value": "Rename program to string in tokenize\n" }, { "from": "human", "value": "# Kimi language interpreter in Python 3\n# Anjana Vakil\n# http://www.github.com/vakila/kimi\n\nimport sys\n\ndef tokenize(program):\n '''Take a Kimi program as a string, return the tokenized...
python
chosen
[ { "from": "system", "value": "Print detected content encoding info only if it's actually been detected\n" }, { "from": "human", "value": "import re\n\nimport requests\n\nfrom bs4 import BeautifulSoup as bs\nfrom jfr_playoff.logger import PlayoffLogger\n\nclass RemoteUrl:\n\n url_cache = {}\n\...
python
chosen
[ { "from": "system", "value": "Update the proxy list examples\n" }, { "from": "human", "value": "\"\"\"\nProxy Server \"Phone Book\".\n\nSimplify running browser tests through a proxy server\nby adding your frequently-used proxies here.\n\nNow you can do something like this on the command line:\n...
python
chosen
[ { "from": "system", "value": "Update plugin's register functions to return the object instance instead of performing the registration themselves\n" }, { "from": "human", "value": "#Shoopdawoop\nfrom . import CuraEngineBackend\n\nfrom UM.Preferences import Preferences\n\ndef getMetaData():\n r...
python
chosen
[ { "from": "system", "value": "Add a docblock for this mixin\n" }, { "from": "human", "value": "class OrganizationMixin(object):\n @property\n def organization(self):\n return {\n 'name': self.ORGANIZATION_NAME,\n 'children': [{\n 'name': unicode(...
python
chosen
[ { "from": "system", "value": "Use the more obvious linspace instead of arange\n" }, { "from": "human", "value": "# -*- coding: utf-8 -*-\n# Copyright (c) 2015, Vispy Development Team.\n# Distributed under the (new) BSD License. See LICENSE.txt for more info.\n\"\"\"\nCircular Layout\n===========...
python
chosen
[ { "from": "system", "value": "Update to include instruction and help texts in GET response.\n" }, { "from": "human", "value": "from python_cowbull_game.GameController import GameController\nfrom python_cowbull_game.GameMode import GameMode\n\n\nclass ExtGameController(GameController):\n \"\"\...
python
chosen
[ { "from": "system", "value": "Change version from 0.1.dev* to 0.1.0.dev*\n\nThe semantic versioning specification requires that the major, minor,\nand patch numbers always be present.\n" }, { "from": "human", "value": "##\n# Package metadata\n##\n\nimport ah_bootstrap\n\nfrom astropy_helpers.git...
python
chosen
[ { "from": "system", "value": "Test for create user in model. Remove test profile creation\n" }, { "from": "human", "value": "# coding: utf-8\n\nimport unittest\nfrom test.factories import UserFactory\n\nfrom django.contrib.auth.models import User\nfrom django.db.models.signals import post_save\...
python
chosen
[ { "from": "system", "value": "Fix incorrect call to logging module\n" }, { "from": "human", "value": "from __future__ import print_function\n\nimport time\nimport sys\nimport socket\nimport logging\n\n\ndef wait_ssh_ready(host, tries=40, delay=3, port=22):\n # Wait until the SSH is actually u...
python
chosen
[ { "from": "system", "value": "Remove the cluster and job_organization.\n" }, { "from": "human", "value": "__author__ = 'Wenzhi Mao'\n\n__all__ = []\n\n\ndef _Startup():\n '''Get _path__ and compile files.'''\n from os import path\n from mbio import _ABSpath\n global _path__\n _pat...
python
chosen
[ { "from": "system", "value": "Return -1 when tests fail\n" }, { "from": "human", "value": "#!/usr/bin/env python\n\"\"\"\nThis is the front end to the pcapfile test SUITE.\n\"\"\"\n\nimport unittest\n\n\nfrom pcapfile.test.linklayer_test import TestCase as LinklayerTest\nfrom pcapfile.test.savef...
python
chosen
[ { "from": "system", "value": "[x]: Fix Import Error for relative Import\n" }, { "from": "human", "value": "import os\nimport six\nimport ckanserviceprovider.web as web\n\nfrom . import jobs\n\n# check whether jobs have been imported properly\nassert(jobs.push_to_datastore)\n\n\ndef serve():\n ...
python
chosen
[ { "from": "system", "value": "Add test to verify single newline is not stripped\n" }, { "from": "human", "value": "\nimport unittest\nimport sparqllib\n\nclass TestBasicFormatter(unittest.TestCase):\n def setUp(self):\n self.formatter = sparqllib.formatter.BasicFormatter()\n\n def t...
python
chosen
[ { "from": "system", "value": "Fix a bad issue when PAYPAL returning utf8 encoded chars\n" }, { "from": "human", "value": "import urlparse\n\nfrom django.db import models\n\n\nclass ResponseModel(models.Model):\n\n # Debug information\n raw_request = models.TextField(max_length=512)\n ra...
python
chosen
[ { "from": "system", "value": "Use correct slug for Web backend.\n" }, { "from": "human", "value": "from notification.backends.base import NotificationBackend\n\nclass WebBackend(NotificationBackend):\n slug = u'web'\n display_name = u'E-mail'\n formats = ['short.txt', 'full.txt']\n\n ...
python
chosen
[ { "from": "system", "value": "[lldb] Update shebang python2 -> python\n\ngit-svn-id: 4c4cc70b1ef44ba2b7963015e681894188cea27e@352259 91177308-0d34-0410-b5e6-96231b3b80d8\n" }, { "from": "human", "value": "#!/usr/bin/env python2\n\nimport subprocess\nimport sys\n\nargs = sys.argv\n\nexpected_exit...
python
chosen
[ { "from": "system", "value": "Tweak a migration to run on non-transactional DBs\n\nA single migration failed to run on databases with no support for\ntransactions because those require explicit ordering of commands that's\ngenerally implicit on modern relational DBs.\n\nSwitch the order of those queries to ...
python
chosen
[ { "from": "system", "value": "Allow <del> and <ins> html tags.\n" }, { "from": "human", "value": "import bleach\n\n\nallowed_tags = [\n \"a\",\n \"img\", # links and images\n \"br\",\n \"p\",\n \"span\",\n \"blockquote\", # text layout\n \"strike\",\n \"strong\",\n \...
python
chosen
[ { "from": "system", "value": "Update insertion sort with list validation\n" }, { "from": "human", "value": "def insertion_sort(un_list):\n for idx in range(1, len(un_list)):\n current = un_list[idx]\n position = idx\n\n while position > 0 and un_list[position-1] > current...
python
chosen
[ { "from": "system", "value": "Raise Http404 instead of 404\n" }, { "from": "human", "value": "# Create your views here.\nimport json\nfrom django.template import RequestContext\nfrom django.shortcuts import render_to_response\nfrom django.utils import simplejson\nfrom django.http import HttpResp...
python
chosen
[ { "from": "system", "value": "Implement 'Delete' action for polls sample app\n" }, { "from": "human", "value": "from django.shortcuts import render\nfrom django.core.urlresolvers import reverse_lazy\n\nfrom singleurlcrud.views import CRUDView\nfrom .models import *\n\n# Create your views here.\n...
python
chosen
[ { "from": "system", "value": "Mark as release candidate version\n\n" }, { "from": "human", "value": "version = '0.59.8'\ntime = '2018-04-18 08:12:59'\n" }, { "from": "gpt", "value": "version = '0.60.0rc1'\ntime = '2018-04-18 08:12:59'\n" } ]
python
chosen
[ { "from": "system", "value": "Reformat VCS tests; need updated unit test values!\n" }, { "from": "human", "value": "# Licensed under an MIT open source license - see LICENSE\n\n'''\nTest functions for VCS\n'''\n\nfrom unittest import TestCase\n\nimport numpy as np\nimport numpy.testing as npt\n\...
python
chosen
[ { "from": "system", "value": "Clean up comments, fixing imports.\n" }, { "from": "human", "value": "'''\nFile: braket.py\nAuthor: Ivan Gonzalez\nDescription: A function to implement quantum-mechanics brakets\n'''\nfrom numpy import inner\nfrom core.exceptions import DMRGException\n\ndef braket(b...
python
chosen
[ { "from": "system", "value": "Add comments and clean-up import of GenomeNetBase\n" }, { "from": "human", "value": "from flow.petri_net import future\nfrom flow.petri_net import success_failure_net\n\n\n# XXX Maybe this turns into a historian mixin?\nclass GenomeNetBase(success_failure_net.Succes...
python
chosen
[ { "from": "system", "value": "Use logging levels to suppress non-error output with --quiet on the CLI.\n" }, { "from": "human", "value": "# -*- coding: utf-8 -*-\n\nimport os\nimport argparse\n\nfrom markdoc.cli import commands\nfrom markdoc.cli.parser import parser\nfrom markdoc.config import C...
python
chosen
[ { "from": "system", "value": "Update outdated design Target docstring\n" }, { "from": "human", "value": "from citrination_client.base.errors import CitrinationClientError\n\n\nclass Target(object):\n \"\"\"\n The optimization target for a design run. Consists of\n the name of the output...
python
chosen
[ { "from": "system", "value": "Enhance flags detection with regex when trying to remove apt cache\n" }, { "from": "human", "value": "#!/usr/bin/env python3\nfrom whalelinter.app import App\nfrom whalelinter.dispatcher import Dispatcher\nfrom whalelinter.commands.command i...
python
chosen
[ { "from": "system", "value": "Remove obsolete 'utils' entry from '__all__\n" }, { "from": "human", "value": "from __future__ import absolute_import\n\nimport etcd3.etcdrpc as etcdrpc\nfrom etcd3.client import Etcd3Client\nfrom etcd3.client import Transactions\nfrom etcd3.client import client\nfr...
python
chosen
[ { "from": "system", "value": "Replace another call to unsignedID.\n" }, { "from": "human", "value": "# System Imports\nimport StringIO\nimport urllib\n\n# Twisted Imports\nfrom twisted.python.util import unsignedID\n\n# Package Imports\nfrom ..data.errors import Immutable\n\nclass Image (object)...
python
chosen
[ { "from": "system", "value": "Revert \"Fix JSON encoding of `PacketLocation`\"\n\nThis reverts commit 9e91912c6c1764c88890ec47df9372e6ac41612c.\n" }, { "from": "human", "value": "import json\n\nfrom .compat import OrderedDict\nfrom .openpgp_message import OpenPGPMessage\n\n\ndef dump_stream(f, o...
python
chosen
[ { "from": "system", "value": "Remove the user field from the form to counter-balance making the field editable." }, { "from": "human", "value": "from django import forms\n\nfrom feedback.models import Feedback\n\nclass FeedbackForm(forms.ModelForm):\n class Meta:\n model = Feedback\n ...
python
chosen
[ { "from": "system", "value": "Make ipdb hook turn on only when --ipdb\n" }, { "from": "human", "value": "#!/usr/bin/env python\nimport sys\n\nfrom funcy import split, map\n\nfrom .analysis import global_usage, local_usage, FileSet\n\n\nimport sys, ipdb, traceback\n\ndef info(type, value, tb):\n ...
python
chosen
[ { "from": "system", "value": "Allow for the case where no plugin returns a score\n" }, { "from": "human", "value": "from pkg_resources import iter_entry_points\n\nfrom config import config\n\n\nplugins = []\nfor plugin in iter_entry_points(group='spicedham.classifiers', name=None):\n pluginCl...
python
chosen
[ { "from": "system", "value": "Add `_become_staff` method to AccountsTestCase.\n" }, { "from": "human", "value": "from factory import fuzzy\n\nfrom django.contrib.auth import get_user_model\nfrom django.test import TestCase\n\n\nclass AccountsTestCase(TestCase):\n def setUp(self):\n sup...
python
chosen
[ { "from": "system", "value": "Add test for blank audit name.\n" }, { "from": "human", "value": "from pyxform.tests_v1.pyxform_test_case import PyxformTestCase\n\n\nclass AuditTest(PyxformTestCase):\n def test_audit(self):\n self.assertPyxformXform(\n name=\"meta_audit\",\n ...
python
chosen
[ { "from": "system", "value": "Add pillar data to default renderer\n" }, { "from": "human", "value": "'''\nThe default rendering engine, process yaml with the jinja2 templating engine\n\nThis renderer will take a yaml file with the jinja2 template and render it to a\nhigh data format for salt sta...
python
chosen
[ { "from": "system", "value": "Remove .ssh keys on compute node from /mnt/home/salvus account, since this is a security risk (in case compute node is r00ted).\n" }, { "from": "human", "value": "#!/usr/bin/env python\n\n# This script is run by /etc/rc.local when booting up. It does special config...
python
chosen
[ { "from": "system", "value": "Configure pytest to enable/disable integration tests\n" }, { "from": "human", "value": "import sys\n\n\npytest_plugins = 'setuptools.tests.fixtures'\n\n\ndef pytest_addoption(parser):\n parser.addoption(\n \"--package_name\", action=\"append\", default=[],...
python
chosen
[ { "from": "system", "value": "Sensehat: Allow use of sensors from more than one actor concurrenctly\n" }, { "from": "human", "value": "# -*- coding: utf-8 -*-\n\n# Copyright (c) 2015 Ericsson AB\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may not use this file ...
python
chosen
[ { "from": "system", "value": "Update Arconaitv to new url" }, { "from": "human", "value": "import re\n\nfrom streamlink.plugin import Plugin\nfrom streamlink.plugin.api import http\nfrom streamlink.plugin.api import useragents\nfrom streamlink.stream import HLSStream\n\n_url_re = re.compile(r'''...
python
chosen
[ { "from": "system", "value": "Make \"/\" a non-permanent redirect\n" }, { "from": "human", "value": "from django.conf.urls import include, url\nfrom django.contrib import admin\nfrom django.views.generic.base import RedirectView\n\nfrom mygpoauth import oauth2\n\n\nurlpatterns = [\n # Example...
python
chosen
[ { "from": "system", "value": "Print each bpmx pv name along with the associated value to stdout\n" }, { "from": "human", "value": "import pytac.load_csv\nimport pytac.epics\n\ndef main():\n lattice = pytac.load_csv.load('VMX', pytac.epics.EpicsControlSystem())\n bpms = lattice.get_elements...
python
chosen
[ { "from": "system", "value": "Correct names, concat dataframes properly\n" }, { "from": "human", "value": "\n'''\nBulk spectral line fitting with SDSS galaxy spectra\n'''\n\nimport os\nfrom astropy.io import fits\nfrom pandas import concat\n\n# Bring in the package funcs\nfrom specfit import do_...
python
chosen
[ { "from": "system", "value": "Add param to ball close\n" }, { "from": "human", "value": "from dynamic_stack_decider.abstract_decision_element import AbstractDecisionElement\n\n\nclass BallClose(AbstractDecisionElement):\n def __init__(self, blackboard, dsd, parameters=None):\n super(Ba...
python
chosen
[ { "from": "system", "value": "Include '-' in ID, print IDs separated by ','\n" }, { "from": "human", "value": "import re\nimport sys\n\n# $ zmmailbox -z -m username@domain.tld search -l 200 \"in:/inbox (before:today)\"\n# num: 200, more: true\n#\n# Id Type From Subjec...
python
chosen
[ { "from": "system", "value": "Return None with invalid sample_width from sample_width_to_string.\n" }, { "from": "human", "value": "# Copyright 2017 Google Inc.\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may not use this file except in compliance with the Lice...
python
chosen
[ { "from": "system", "value": "Fix AttributeError getting project settings when no active view\n" }, { "from": "human", "value": "import sublime\n\n\nclass SBTSettings(object):\n\n def __init__(self, window):\n self.window = window\n self._plugin_settings = sublime.load_settings(...
python
chosen
[ { "from": "system", "value": "Make careerop only display active ops\n" }, { "from": "human", "value": "#-*- coding: utf-8 -*-\nfrom django.shortcuts import render_to_response\nfrom django.shortcuts import get_object_or_404\nfrom django.template import RequestContext\nfrom apps.careeropportunity....
python
chosen
[ { "from": "system", "value": "Fix incorrect ne_NP locale tests\n\nThis test incorrectly assumes a call to name() will\nyield only a first/last name, which isn't always true for this\nlocale. I suspect it hasn't been uncovered yet because the\ntests are seeded the same at the beginning of every run. It only\...
python
chosen
[ { "from": "system", "value": "Update runner tests to use parameters\n" }, { "from": "human", "value": "import tempfile\nimport StringIO\n\nimport pytest\n\nfrom shelltest.shelltest import ShellTest, ShellTestSource, ShellTestRunner\n\n\n@pytest.fixture\ndef tests():\n return [ShellTest('echo ...
python
chosen
[ { "from": "system", "value": "Remove redundant try/catch block in kill process handler\n" }, { "from": "human", "value": "import sys\nimport os\nfrom logging import Handler as LoggingHandler\n\n\nclass KillProcessHandler(LoggingHandler):\n\n def emit(self, record):\n if record.levelno ...
python
chosen
[ { "from": "system", "value": "Put all the Accessibility property tests in a single function\n\nWe already had machinery for that, anyway.\n" }, { "from": "human", "value": "# Pytest will pick up this module automatically when running just \"pytest\".\n#\n# Each test_*() function gets passed test...
python
chosen
[ { "from": "system", "value": "Modify to pass args to the base class constructor\n" }, { "from": "human", "value": "\"\"\"\n.. codeauthor:: Tsuyoshi Hombashi <tsuyoshi.hombashi@gmail.com>\n\"\"\"\n\nimport sqlite3\nfrom typing import Optional\n\nfrom tabledata import NameValidationError # noqa: ...
python
chosen
[ { "from": "system", "value": "Add fine tuning to silent helper" }, { "from": "human", "value": "# coding=utf-8\nfrom contextlib import contextmanager\n\nfrom fabric.context_managers import settings, hide, prefix\nfrom fabric.state import env\n\n__all__ = ['get_sudo_context', 'sudo', 'only_messag...
python
chosen
[ { "from": "system", "value": "Add created to votes api serializer\n" }, { "from": "human", "value": "from bluebottle.votes.models import Vote\nfrom bluebottle.bb_accounts.serializers import UserPreviewSerializer\nfrom rest_framework import serializers\n\n\nclass VoteSerializer(serializers.ModelS...
python
chosen
[ { "from": "system", "value": "Change the S3 URL expiration time from 12 to 24 hours\n" }, { "from": "human", "value": "# Copyright (c) 2017 Quilt Data, Inc. All rights reserved.\n\n\"\"\"\nDefault config values the Flask app.\nShared between dev, stage, and production.\n\nSee `app.config.from_ob...
python
chosen
[ { "from": "system", "value": "Change Feature classes to match the new config\n" }, { "from": "human", "value": "'''\nCreated on Nov 10, 2014\n\n@author: fechnert\n'''\n\nimport logging\n\n\nclass Feature(object):\n ''' Represents a abstract Feature '''\n\n def __init__(self, config, client...
python
chosen
[ { "from": "system", "value": "Fix flake8 E302 expected 2 blank lines, found 1\n" }, { "from": "human", "value": "\"\"\"dberrors: database exception classes for SQLObject.\n\n These classes are dictated by the DB API v2.0:\n\n http://www.python.org/topics/database/DatabaseAPI-2.0.html\n\"\"\"...
python
chosen