conversations
listlengths
2
3
source
stringclasses
1 value
stack
stringclasses
1 value
[ { "from": "system", "value": "Update module to version 2\n" }, { "from": "human", "value": "# This file is part of BenchExec, a framework for reliable benchmarking:\n# https://github.com/sosy-lab/benchexec\n#\n# SPDX-FileCopyrightText: 2007-2020 Dirk Beyer <https://www.sosy-lab.org>\n#\n# SPDX-L...
python
chosen
[ { "from": "system", "value": "Revise for loop to find neighbor vertices\n" }, { "from": "human", "value": "def topological_sort_recur(adjacency_dict, start_vertex,\n\t visited_set, finish_ls):\n\t\"\"\"Topological Sorting by Recursion.\"\"\"\n\tvisited_set.add(start_vertex)...
python
chosen
[ { "from": "system", "value": "Remove product_service from epages package\n" }, { "from": "human", "value": "# coding: utf-8\n\nfrom epages.client import *\n\nfrom epages.product_service import *\nfrom epages.shop_service import *\n\nfrom epages.shop import *\n" }, { "from": "gpt", "v...
python
chosen
[ { "from": "system", "value": "Update decode mirax a bit\n" }, { "from": "human", "value": "#!/usr/bin/python\n\nimport struct, sys\n\nf = open(sys.argv[1])\n\nHEADER_OFFSET = 37\n\nf.seek(HEADER_OFFSET)\n\ntry:\n while True:\n n = struct.unpack(\"<i\", f.read(4))[0]\n possible_l...
python
chosen
[ { "from": "system", "value": "Fix play example (thanks to Samuele CarCagno).\n" }, { "from": "human", "value": "import numpy as np\nfrom scikits.audiolab import play\n\n# output one second of stereo gaussian white noise at 48000 hz\nplay(0.05 * np.random.randn(2, 48000), rate=48000)\n" }, { ...
python
chosen
[ { "from": "system", "value": "Remove Tower reference from email backend\n" }, { "from": "human", "value": "# Copyright (c) 2016 Ansible, Inc.\n# All Rights Reserved.\n\nimport json\n\nfrom django.utils.encoding import smart_text\nfrom django.core.mail.backends.smtp import EmailBackend\nfrom djan...
python
chosen
[ { "from": "system", "value": "Update tests for new style\n\nAlso added test for printing molecule list and made the collisional rate\ntest more complicated.\n" }, { "from": "human", "value": "# Licensed under a 3-clause BSD style license - see LICENSE.rst\nfrom ... import lamda\n\ndef test_query...
python
chosen
[ { "from": "system", "value": "Refactor FTs to setup/teardown with pytest.fixture\n" }, { "from": "human", "value": "from selenium import webdriver\n\nbrowser = webdriver.Firefox()\nbrowser.get('http://localhost:8000')\n\nassert 'Django' in browser.title\n" }, { "from": "gpt", "value"...
python
chosen
[ { "from": "system", "value": "Add __all__ in package init for the test runner\n" }, { "from": "human", "value": "# Licensed under a 3-clause BSD style license - see LICENSE.rst\n\"\"\"\nPhotutils is an Astropy affiliated package to provide tools for\ndetecting and performing photometry of astron...
python
chosen
[ { "from": "system", "value": "Use PRAGMA synchronous=NORMAL instead of OFF, and set page_size to 4096.\n" }, { "from": "human", "value": "import sqlite3\n\nclass SQLiteWrapper:\n\tdef __init__(self, db):\n\t\tself.conn = sqlite3.connect(db)\n\t\tself.cursor = self.conn.cursor()\n\t\tself.cursor....
python
chosen
[ { "from": "system", "value": "Update outstanding bugs test file.\n" }, { "from": "human", "value": "#\n# This file is for everybody to add tests for bugs that aren't\n# fixed yet. Please add a test case and appropriate bug description.\n#\n# When you fix one of the bugs, please move the test to ...
python
chosen
[ { "from": "system", "value": "Change avatar to avatar_url in the user API\n" }, { "from": "human", "value": "\"\"\"Serializers for account models\"\"\"\n# pylint: disable=too-few-public-methods\nfrom rest_framework import serializers\nfrom accounts.models import User\n\n\nclass UserSerializer(se...
python
chosen
[ { "from": "human", "value": "Add algorithm for provably unspendable address generation\n" }, { "from": "gpt", "value": "import obelisk\n\nimport sys\nfrom twisted.internet import reactor\n\n\nTESTNET = True\n\ndef build_output_info_list(unspent_rows):\n unspent_infos = []\n for row in unsp...
python
chosen
[ { "from": "system", "value": "Fix script default to actually save plots\n" }, { "from": "human", "value": "#!/usr/bin/env python\n# Licensed under a 3-clause BSD style license - see LICENSE.rst\nimport mica.centroid_dashboard\n\n# Cheat. Needs entrypoint scripts\nmica.centroid_dashboard.update_o...
python
chosen
[ { "from": "system", "value": "Clean up logbook handler to use correct params for capture()\n" }, { "from": "human", "value": "import logbook\n\nimport sys\n\nclass SentryLogbookHandler(logbook.Handler):\n def emit(self, record):\n from sentry import capture\n\n # Avoid typical c...
python
chosen
[ { "from": "system", "value": "Revert \"Do not write to the configuration file on each stop.\"\n\nThis reverts commit 486d2c3e6062f370c7be499ddef10d816fc3f85c.\n" }, { "from": "human", "value": "import sys\n\nfrom PyQt5 import QtWidgets\n\nfrom gui.mainWindow import MainWindow\n\n\napp = QtWidget...
python
chosen
[ { "from": "system", "value": "Use new line style for Implementation item\n" }, { "from": "human", "value": "\"\"\"\nImplementation of interface.\n\"\"\"\n\nfrom gaphor import UML\nfrom gaphor.diagram.diagramline import DiagramLine\n\n\nclass ImplementationItem(DiagramLine):\n\n __uml__ = UML....
python
chosen
[ { "from": "system", "value": "Use kitchen.i18n to setup gettext. Setup b_() for exceptions.\n" }, { "from": "human", "value": "# Copyright 2008 Red Hat, Inc.\n# This file is part of python-fedora\n# \n# python-fedora is free software; you can redistribute it and/or\n# modify it under the terms ...
python
chosen
[ { "from": "system", "value": "Handle wrong formatted input, added comments, some cosmetics\n" }, { "from": "human", "value": "class Token(object):\n\tdef __init__( self, line ):\n\t\tentries = line.split('\\t')\n\t\tself.form = entries[0].lower()\n\t\tself.gold_pos = entries[1]\n\t\tself.predict...
python
chosen
[ { "from": "system", "value": "Move repo name to arg\n" }, { "from": "human", "value": "import os\nimport csv\nfrom parser import Parser\n\nclass Extract:\n\t\"\"\"\n\tExtract data from .git repo and persist as a data set\n\t\"\"\"\n\t# repos name git: .git\n\t# destination absolute path\n\tdef c...
python
chosen
[ { "from": "system", "value": "Add a frontpage rendering view\n" }, { "from": "human", "value": "from django.conf.urls import url, include\nfrom django.contrib import admin\n\n\nurlpatterns = [\n url(r'^material/', include('tk.material.urls')),\n url(r'^admin/', admin.site.urls),\n]...
python
chosen
[ { "from": "system", "value": "Revert \"TimeAndPlace no longer refers to realtime data\"\n\nThis reverts commit cf92e191e3748c67102f142b411937517c5051f4.\n" }, { "from": "human", "value": "#!/usr/bin/env python3\nfrom .base import Serializable\nfrom .locations import Platform\nfrom datetime impor...
python
chosen
[ { "from": "system", "value": "Use correct method to get classname of self\n" }, { "from": "human", "value": "import os.path\nfrom utils import file_sha1sum\n\n\nclass Artefact(object):\n def __init__(self, filename, extension):\n if not filename.endswith(extension):\n raise ...
python
chosen
[ { "from": "system", "value": "Fix XSS vulnerability in current user bootstrapping.\n" }, { "from": "human", "value": "# Copyright (c) 2011-2014 Berkeley Model United Nations. All rights reserved.\n# Use of this source code is governed by a BSD License (see LICENSE).\n\nimport json\n\nfrom huxley...
python
chosen
[ { "from": "system", "value": "Complete increasing heights idx stack sol\n" }, { "from": "human", "value": "\"\"\"Leetcode 84. Largest Rectangle in Histogram\nHard\n\nURL: https://leetcode.com/problems/largest-rectangle-in-histogram/\n\nGiven n non-negative integers representing the histogram's b...
python
chosen
[ { "from": "system", "value": "Simplify stony's response to exactly what the user sent\n\nRather than providing the \"from repeat1\" and \"in channel D???????\" noise.\n" }, { "from": "human", "value": "from __future__ import unicode_literals\n# don't convert to ascii in py2.7 when creating strin...
python
chosen
[ { "from": "system", "value": "Fix for python 2.6 compatibility in subprocess\n" }, { "from": "human", "value": "from __future__ import print_function\nimport os, pyrax, sys\nimport pyrax.exceptions as pexc\nfrom termcolor import colored\nimport ConfigParser\nfrom subprocess import check_output\n...
python
chosen
[ { "from": "system", "value": "Fix bug with array_agg_mult() function not actually being created.\n" }, { "from": "human", "value": "\"\"\"Actions to run at server startup.\n\"\"\"\n\nfrom django.db import connection\n\n\ndef run():\n \"\"\"Call this from manage.py or tests.\n \"\"\"\n _...
python
chosen
[ { "from": "system", "value": "Test case for Member/Person sync\n\nSkipped for now, to help with #4049\n" }, { "from": "human", "value": "\"\"\"\nThis file demonstrates two different styles of tests (one doctest and one\nunittest). These will both pass when you run \"manage.py test\".\n\nReplace ...
python
chosen
[ { "from": "system", "value": "Add metadata to visualization module\n" }, { "from": "human", "value": "\"\"\" NURBS-Python Visualization Component\n\n.. moduleauthor:: Onur Rauf Bingol <orbingol@gmail.com>\n\n\"\"\"\n" }, { "from": "gpt", "value": "\"\"\" NURBS-Python Visualization Co...
python
chosen
[ { "from": "system", "value": "Make sure official user type emails are lower case\n" }, { "from": "human", "value": "from flask_jwt_extended import current_user\nfrom flask_restful import Resource\nfrom marshmallow import fields, Schema\n\nfrom scuevals_api.auth import auth_required\nfrom scueval...
python
chosen
[ { "from": "system", "value": "Set static/docs as the default folder to generate the apidoc's files\n" }, { "from": "human", "value": "# Copyright 2015 Vinicius Chiele. All rights reserved.\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": "Use finally and so on.\n" }, { "from": "human", "value": "#!/usr/local/bin/python\nclass MuffledCalculator:\n muffled=False\n def calc(self,expr):\n try:\n return eval(expr)\n except ZeroDivisionError:\n if self.muffled:\n print \"Can't divi...
python
chosen
[ { "from": "system", "value": "Check for an empty user" }, { "from": "human", "value": "import json\n\nfrom django.conf import settings\nfrom django.http import HttpResponseRedirect, HttpResponseNotFound\nfrom django.shortcuts import get_object_or_404, resolve_url\nfrom django.utils.http import i...
python
chosen
[ { "from": "system", "value": "Enable filtering over the published field\n\nTastypie requires that we define a list of fields that can be used\nfor filtering; add the \"published\" to this list so we can query pinry\nfor the list of images created after some date.\n" }, { "from": "human", "value"...
python
chosen
[ { "from": "system", "value": "Use block quotes for Markov-chain plugin\n" }, { "from": "human", "value": "\"\"\"Displays a randomly generated witticism from Brian Chu himself.\"\"\"\n\nimport json\nimport random\n\n__match__ = r\"!brian\"\n\n\nwith open('plugins/brian_corpus/cache.json', 'r') as...
python
chosen
[ { "from": "system", "value": "Move hash256 to separate function\n" }, { "from": "human", "value": "import hashlib\n\n\ndef hash256(hash_data):\n return hashlib.sha256(hashlib.sha256(hash_data).digest()).digest()" }, { "from": "gpt", "value": "import hashlib\n\n\ndef hash256(hash_d...
python
chosen
[ { "from": "system", "value": "tests: Check bench mode==run with fixed block shape\n" }, { "from": "human", "value": "import os\nfrom subprocess import check_call\n\nimport pytest\n\n\ndef run(command, problem, so, shape, nbpml, *extra):\n args = [\"python\", \"../benchmarks/user/benchmark.py\...
python
chosen
[ { "from": "system", "value": "Fix permalinks test which was breaking other tests.\n" }, { "from": "human", "value": "from django.contrib.contenttypes.models import ContentType\nfrom django.core import urlresolvers\nfrom django.core.exceptions import ImproperlyConfigured\nfrom django.db import mo...
python
chosen
[ { "from": "system", "value": "Fix broken Mercenaries bountyxml test\n" }, { "from": "human", "value": "from hearthstone import bountyxml\n\n\ndef test_bountyxml_load():\n\tbounty_db, _ = bountyxml.load()\n\n\tassert bounty_db\n\n\tassert bounty_db[47].boss_name == \"Cap'n Hogger\"\n\tassert boun...
python
chosen
[ { "from": "system", "value": "Add only_http_implementation and only_websocket_implementation methods\n" }, { "from": "human", "value": "from devicehive import Handler\nfrom devicehive import DeviceHive\n\n\nclass TestHandler(Handler):\n \"\"\"Test handler class.\"\"\"\n\n def handle_connec...
python
chosen
[ { "from": "system", "value": "Remove manual indexing of args" }, { "from": "human", "value": "#!/usr/bin/python\n\"\"\"\ndemo.py -- Experimenting with expressing this forth-like pattern in Python.\n\nIt appears it can be done with varargs and splatting.\n\"\"\"\n\nimport sys\nimport time\n\n\nde...
python
chosen
[ { "from": "system", "value": "Fix errors with 2/3 FLO support\n" }, { "from": "human", "value": "# -*- coding: utf-8 -*-\n\nimport click\nfrom .compat import StringIO\nimport seria\n\n\nCONTEXT_SETTINGS = dict(help_option_names=['-h', '--help'])\n\n\n@click.command(context_settings=CONTEXT_SETTI...
python
chosen
[ { "from": "system", "value": "Improve time complexity of solution\n" }, { "from": "human", "value": "\n\n# A special triplet is defined as: a <= b <= c for\n# a in list_a, b in list_b, and c in list_c\ndef get_num_special_triplets(list_a, list_b, list_c):\n # remove duplicates and sort lists\...
python
chosen
[ { "from": "system", "value": "Fix GITDIR constant to use local gitdir if global doesn't exist\n" }, { "from": "human", "value": "import os\nimport pathlib\n\nGITDIR = pathlib.Path(os.environ.get('GITDIR', '/opt/git')) #TODO check permissions\n" }, { "from": "gpt", "value": "import os...
python
chosen
[ { "from": "system", "value": "Use the new reader classes in the template tag\n" }, { "from": "human", "value": "import json\n\nfrom django.core.cache import cache\nfrom django.conf import settings\nfrom django.template import Library, TemplateSyntaxError\n\nregister = Library()\n\n\n@register.in...
python
chosen
[ { "from": "system", "value": "tests/api: Add more \"GET /users\" tests\n" }, { "from": "human", "value": "from tests.data import add_fixtures, users\n\n\ndef test_list_users(db_session, client):\n john = users.john()\n add_fixtures(db_session, john)\n\n res = client.get('/users/')\n ...
python
chosen
[ { "from": "system", "value": "Fix messages in NDEx client\n" }, { "from": "human", "value": "import requests\nimport json\nimport time\n\nndex_base_url = 'http://services.bigmech.ndexbio.org'\n\ndef send_request(url_suffix, params):\n res = requests.post(ndex_base_url + url_suffix, data=json....
python
chosen
[ { "from": "system", "value": "Handle the case where the user exits the panel\n" }, { "from": "human", "value": "import sublime\nimport sublime_plugin\n\n\nclass QuickFileOpenCommand(sublime_plugin.WindowCommand):\n def run(self):\n settings = sublime.load_settings('QuickFileOpen.sublim...
python
chosen
[ { "from": "system", "value": "Remove needless import of sys module\n" }, { "from": "human", "value": "#!/usr/bin/env python3\n\n# card-fight-thingy - Simplistic battle card game... thingy\n#\n# The MIT License (MIT)\n#\n# Copyright (c) 2015 The Underscores\n#\n# Permission is hereby granted, fre...
python
chosen
[ { "from": "system", "value": "[r] Make import compatible with python 2.6\n" }, { "from": "human", "value": "from unittest.case import TestCase\n\nfrom mock import Mock\n\nfrom robber import expect\nfrom robber.matchers.called import Called\n\n\nclass TestCalled(TestCase):\n def test_matches(s...
python
chosen
[ { "from": "system", "value": "Add tests for vagrant guest OS\n" }, { "from": "human", "value": "from subprocess import call, check_output\n\nclass TestOs:\n \"\"\" Contains test methods to test \n if the vagrant OS got installed properly \"\"\"\n\n" }, { "from": "gpt", "value":...
python
chosen
[ { "from": "system", "value": "Revert \"Set version to v8.0.0.dev0\"\n\nThis reverts commit 69732c4f9f7ff1a89b85e9c211991154dcce59f4.\n" }, { "from": "human", "value": "# inspired from:\n\n# https://python-packaging-user-guide.readthedocs.org/en/latest/single_source_version/\n# https://github.com...
python
chosen
[ { "from": "system", "value": "Attach user with List and Item\n" }, { "from": "human", "value": "from django.db import models\nfrom django.utils.text import slugify\n\nfrom common.models import TimeStampedModel\n\n\nclass List(TimeStampedModel):\n name = models.CharField(max_length=50)\n sl...
python
chosen
[ { "from": "system", "value": "Use absolute import for main entry point.\n" }, { "from": "human", "value": "# -*- coding: utf-8 -*-\n# Copyright (c) 2013-2014 Simon Jagoe\n# All rights reserved.\n#\n# This software may be modified and distributed under the terms\n# of the 3-clause BSD license. S...
python
chosen
[ { "from": "system", "value": "Split into new branch for development of the main site\n" }, { "from": "human", "value": "import os\nfrom flask import Flask, redirect, request, render_template\nfrom flask_mail import Mail, Message\n\napp = Flask (__name__)\nALLOWED_EXTENSIONS = set(['txt', 'png', ...
python
chosen
[ { "from": "system", "value": "Remove run_hook from list of imported commands.\n" }, { "from": "human", "value": "# -*- coding: utf-8 -*-\n# Copyright (c) 2014-2019 Dontnod Entertainment\n\n# Permission is hereby granted, free of charge, to any person obtaining\n# a copy of this software and asso...
python
chosen
[ { "from": "system", "value": "Make ResaleApartmentSerializer return Decoration.name on decoration field.\n\nIt allows to show readable value at resale detailed page.\n" }, { "from": "human", "value": "from rest_framework import serializers\n\nfrom .models import ResaleApartment, ResaleApartmentI...
python
chosen
[ { "from": "system", "value": "Fix case when processing column names for MySQL\n" }, { "from": "human", "value": "# -*- coding: utf-8 -*-\n\nfrom .builder import SchemaBuilder\n\n\nclass MySQLSchemaBuilder(SchemaBuilder):\n\n def has_table(self, table):\n \"\"\"\n Determine if th...
python
chosen
[ { "from": "system", "value": "Fix upload form to only accept .zip files\n\n" }, { "from": "human", "value": "from django import forms\n\n\nclass MediaForm(forms.Form):\n zip_file = forms.FileField(label=\"Zipped Media File\")\n\n def clean_data_file(self):\n file = self.cleaned_data...
python
chosen
[ { "from": "system", "value": "Fix utils module import mechanism\n" }, { "from": "human", "value": "\"\"\"Object detection and tracking for cell biology\n\n`scikit-learn` is bla bla bla.\n\nSubpackages\n-----------\ncolor\n Color space conversion.\n\n\nUtility Functions\n-----------------\nimg...
python
chosen
[ { "from": "system", "value": "Add ballot paper ID to API\n" }, { "from": "human", "value": "from __future__ import unicode_literals\n\nfrom rest_framework import serializers\n\nfrom candidates.serializers import MembershipSerializer\n\nfrom .models import CandidateResult, ResultSet\n\n\nclass Ca...
python
chosen
[ { "from": "system", "value": "Use get_db_prep_value instead of get_db_prep_save. Closes gh-42\n" }, { "from": "human", "value": "from django.core.exceptions import ValidationError\nfrom django.db import models\nfrom django.utils import simplejson\n\n\nclass JSONField(models.TextField):\n \"\"...
python
chosen
[ { "from": "system", "value": "Modify to fit with PEP8 standard\n" }, { "from": "human", "value": "from app import db\nfrom flask_login import UserMixin\n\nclass User(UserMixin, db.Model):\n __tablename__ = 'users'\n id = db.Column(db.Integer, primary_key=True)\n nickname = db.Column(db....
python
chosen
[ { "from": "system", "value": "Add some extra fields to movie model\n" }, { "from": "human", "value": "from django.db import models\n\n\nclass Movie(models.Model):\n tmdb_id = models.IntegerField()" }, { "from": "gpt", "value": "from django.contrib.auth.models import User\nfrom dja...
python
chosen
[ { "from": "system", "value": "Add support for django 1.8 by using test runner\n" }, { "from": "human", "value": "#!/usr/bin/env python\n\nimport os\nimport sys\nimport django\n\nfrom django.conf import settings\n\n\nif not settings.configured:\n settings_dict = dict(\n INSTALLED_APPS=(...
python
chosen
[ { "from": "system", "value": "Fix catch socket timeout and error exceptions" }, { "from": "human", "value": "# -*- encoding: utf-8 -*-\n\nimport socket\n\ntry:\n import httplib\nexcept ImportError:\n import http.client as httplib\n\nfrom isso.wsgi import urlsplit\n\n\nclass curl(object):\n...
python
chosen
[ { "from": "system", "value": "Add test coverage for save pages (happy path)\n" }, { "from": "human", "value": "from __future__ import absolute_import\nfrom __future__ import division\nfrom __future__ import unicode_literals\n\nimport copy\n\nfrom twisted.internet import defer\n\nfrom mock import...
python
chosen
[ { "from": "system", "value": "Add android and ios client IDs\n" }, { "from": "human", "value": "#!/usr/bin/env python\n\n\"\"\"settings.py\n\nUdacity conference server-side Python App Engine app user settings\n\n$Id$\n\ncreated/forked from conference.py by wesc on 2014 may 24\n\n\"\"\"\n\n# Repl...
python
chosen
[ { "from": "system", "value": "Remove the unnecessary and never-used basic auth hack.\n" }, { "from": "human", "value": "# Universal Subtitles, universalsubtitles.org\n#\n# Copyright (C) 2012 Participatory Culture Foundation\n#\n# This program is free software: you can redistribute it and/or modi...
python
chosen
[ { "from": "system", "value": "[Update] Enable Cross Origin Resource Sharing\n" }, { "from": "human", "value": "\"\"\"Module containing factory function for the application\"\"\"\nfrom flask import Flask, redirect\nfrom flask_restplus import Api\n\nfrom config import app_config\nfrom api_v1 impor...
python
chosen
[ { "from": "system", "value": "Rework Lexer to use Token object\n" }, { "from": "human", "value": "from enum import Enum\nimport re\n\nToken = Enum('Token', 'load comment text var block',)\n\ntag_re = re.compile(\n '|'.join([\n r'{\\!\\s*(?P<load>.+?)\\s*\\!}',\n r'{%\\s*(?P<tag>...
python
chosen
[ { "from": "system", "value": "Datalogger: Remove time.sleep from example, no longer required\n" }, { "from": "human", "value": "from pymoku import Moku\nfrom pymoku.instruments import *\nimport time, logging\n\nlogging.basicConfig(format='%(asctime)s:%(name)s:%(levelname)s::%(message)s')\nloggin...
python
chosen
[ { "from": "system", "value": "Include all static files in build by default\n" }, { "from": "human", "value": "from appconf import AppConf\n\n\nclass StaticBuilderConf(AppConf):\n BUILD_COMMANDS = []\n COLLECT_BUILT = True\n INCLUDE_FILES = ['*.css', '*.js']\n\n class Meta:\n r...
python
chosen
[ { "from": "system", "value": "Fix urlconf to avoid string view arguments to url()\n" }, { "from": "human", "value": "\n__author__ = \"Individual contributors (see AUTHORS file)\"\n__date__ = \"$DATE$\"\n__rev__ = \"$REV$\"\n__license__ = \"AGPL v.3\"\n__copyright__ = \"\"\"\nThis...
python
chosen
[ { "from": "system", "value": "Add a new error code\n" }, { "from": "human", "value": "class Errors:\n '''enum-like values to use as exit codes'''\n USAGE_ERROR = 1\n DEPENDENCY_NOT_FOUND = 2\n VERSION_ERROR = 3\n GIT_CONFIG_ERROR = 4\n STRANGE_ENVIRONMENT = 5\n EATING_WITH_S...
python
chosen
[ { "from": "system", "value": "Add an option to output both realtime and monotime.\n" }, { "from": "human", "value": "import getopt, sys\n\nif __name__ == '__main__':\n sippy_path = None\n\n try:\n opts, args = getopt.getopt(sys.argv[1:], 's:S:i:o:b')\n except getopt.GetoptError:\...
python
chosen
[ { "from": "system", "value": "Fix publisher autocomplete so searches is case-insensitive\n" }, { "from": "human", "value": "from dal import autocomplete\n\nfrom .models import Publisher\n\n\nclass PublisherAutocomplete(autocomplete.Select2QuerySetView):\n # basic publisher autocomplete lookup...
python
chosen
[ { "from": "system", "value": "Set MEDIA_ROOT setting for Production.\n" }, { "from": "human", "value": "from .base import *\n\nDEBUG = False\n\n# Static files (CSS, JavaScript, Images)\n# https://docs.djangoproject.com/en/1.8/howto/static-files/\n\n# TODO: Add MEDIA_ROOT setting.\n#MEDIA_ROOT = ...
python
chosen
[ { "from": "system", "value": "Break potential cycle because we are storing the traceback\n" }, { "from": "human", "value": "#\n# This file is part of Evergreen. See the NOTICE for more information.\n#\n\nimport pyuv\nimport sys\n\nfrom evergreen.event import Event\nfrom evergreen.futures import ...
python
chosen
[ { "from": "system", "value": "Update test to check basic case for playback without current track\n" }, { "from": "human", "value": "from mopidy.models import Track\n\nclass BaseCurrentPlaylistControllerTest(object):\n uris = []\n backend_class = None\n\n def setUp(self):\n self.b...
python
chosen
[ { "from": "system", "value": "Change Django field filter kwarg from name to field_name for Django 2 support\n" }, { "from": "human", "value": "import django_filters\nfrom django_filters.filters import Lookup\n\nfrom apps.events.models import Event\n\n\nclass ListFilter(django_filters.Filter):\n ...
python
chosen
[ { "from": "system", "value": "tests: Use utf-8 when encoding our test data paths to bytes\n" }, { "from": "human", "value": "from __future__ import unicode_literals\n\nimport os\nimport sys\n\n\ndef path_to_data_dir(name):\n if not isinstance(name, bytes):\n name = name.encode(sys.getf...
python
chosen
[ { "from": "system", "value": "Add Let's Encrypt env var\n" }, { "from": "human", "value": "from .applications import get_application_domain, get_application_name\nfrom .machine import get_env_vars\nfrom .. import app\n\nfrom subprocess import Popen, STDOUT, PIPE\nfrom os import environ\nfrom os....
python
chosen
[ { "from": "system", "value": "Mark index migration as non atomic\n" }, { "from": "human", "value": "# Generated by Django 2.1.7 on 2019-05-12 16:08\n\nfrom django.db import migrations, models\n\n\nclass Migration(migrations.Migration):\n\n dependencies = [\n ('publishers', '0007_publis...
python
chosen
[ { "from": "system", "value": "Add test for osfclient's session object\n\nCheck that exceptions are raised on unauthed HTTP put/get\n" }, { "from": "human", "value": "from osfclient.models import OSFSession\n\n\ndef test_basic_auth():\n session = OSFSession()\n session.basic_auth('joe@examp...
python
chosen
[ { "from": "system", "value": "Add an initial rating to new links in the rss seeder.\n" }, { "from": "human", "value": "\nfrom datetime import datetime\nfrom time import mktime\n\nfrom django.core.management.base import BaseCommand\nfrom django.utils.timezone import get_default_timezone, make_awa...
python
chosen
[ { "from": "system", "value": "Fix opencage reverse issue where it was using self.lcoation instead of just location\n" }, { "from": "human", "value": "#!/usr/bin/python\n# coding: utf8\n\nfrom __future__ import absolute_import\n\nimport logging\n\nfrom geocoder.opencage import OpenCageResult, Ope...
python
chosen
[ { "from": "system", "value": "Change GroupSerializer to display attributes as strings\n" }, { "from": "human", "value": "from rest_framework import serializers\n\nfrom sigma_core.models.group import Group\n\n\nclass GroupSerializer(serializers.ModelSerializer):\n class Meta:\n model = ...
python
chosen
[ { "from": "system", "value": "Fix assumption that tornado.web was imported.\n" }, { "from": "human", "value": "# -*- coding: utf-8 -\n#\n# This file is part of gunicorn released under the MIT license. \n# See the NOTICE for more information.\n\nimport os\nimport sys\n\nfrom tornado.httpserver im...
python
chosen
[ { "from": "system", "value": "Fix proper default values for metadata migration\n" }, { "from": "human", "value": "\"\"\"Add movie metadata (imdb rating, number of votes, metascore) and relevancy\n\nRevision ID: 2c240cb3edd1\nRevises: 588336e02ca\nCreate Date: 2014-02-09 13:46:18.630000\n\n\"\"\"...
python
chosen
[ { "from": "system", "value": "Enable foreign key constraint for SQLite\n" }, { "from": "human", "value": "__all__ = [\n 'create_engine',\n]\n\nimport sqlalchemy\n\n\ndef create_engine(db_uri, check_same_thread=False, echo=False):\n engine = sqlalchemy.create_engine(\n db_uri,\n ...
python
chosen
[ { "from": "system", "value": "Fix badly named test class\n" }, { "from": "human", "value": "#!/usr/bin/env python3\n# -*- coding: utf-8 -*-\nfrom numpy.testing import assert_approx_equal\nfrom UliEngineering.Physics.Light import *\nfrom UliEngineering.EngineerIO import auto_format\nimport unitte...
python
chosen
[ { "from": "system", "value": "Add manual experiment that replaces a RGB image with grayscale\n" }, { "from": "human", "value": "import pytest\nimport imghdr\nfrom io import BytesIO\nfrom PIL import Image\n\nfrom pikepdf import _qpdf as qpdf\n\ndef test_jpeg(resources, outdir):\n pdf = qpdf.Pd...
python
chosen
[ { "from": "system", "value": "Fix template and static paths\n" }, { "from": "human", "value": "import os\n\nfrom flask import Flask\nfrom flask_login import LoginManager\nfrom flask_sqlalchemy import SQLAlchemy\n\ntemplate_directory = os.path.join(\n os.path.dirname(os.path.abspath(__file__))...
python
chosen
[ { "from": "system", "value": "Make catch-all actually catch all\n" }, { "from": "human", "value": "from django.conf.urls.defaults import *\n\n# Uncomment the next two lines to enable the admin:\nfrom django.contrib import admin\nadmin.autodiscover()\n\nurlpatterns = patterns('',\n # Example:\...
python
chosen
[ { "from": "system", "value": "Improve error message on invalid conf key\n" }, { "from": "human", "value": "from __future__ import annotations\n\nimport functools\nfrom pathlib import Path\nfrom typing import Mapping\n\nimport tomli\n\nDEFAULT_OPTS = {\n \"wrap\": \"keep\",\n \"number\": Fa...
python
chosen
[ { "from": "system", "value": "Change plugin type to profile_reader\n\nThis repairs the profile reading at startup. It should not be a mesh reader.\n\nContributes to issue CURA-34.\n" }, { "from": "human", "value": "# Copyright (c) 2015 Ultimaker B.V.\n# Cura is released under the terms of the AG...
python
chosen
[ { "from": "system", "value": "Revise grammar tests for atom\n\n" }, { "from": "human", "value": "import viper.grammar as vg\nimport viper.grammar.languages as vgl\nimport viper.lexer as vl\n\nimport pytest\n\n\n@pytest.mark.parametrize('line,sppf', [\n ('foo',\n vgl.SPPF(vgl.ParseTreeChar...
python
chosen
[ { "from": "human", "value": "Add tests for A2.4 and A2.5\n" }, { "from": "gpt", "value": "\"\"\"\n Tests for the NURBS-Python package\n Released under The MIT License. See LICENSE file for details.\n Copyright (c) 2018 Onur Rauf Bingol\n\n Tests geomdl.helpers module.\n\"\"\"\n\nfrom...
python
chosen