conversations
listlengths
2
3
source
stringclasses
1 value
stack
stringclasses
1 value
[ { "from": "system", "value": "Modify version back to 3.0" }, { "from": "human", "value": "from setuptools import setup, find_packages\nimport os\n\nf = open(os.path.join(os.path.dirname(__file__), 'README.rst'))\nreadme = f.read()\nf.close()\n\nsetup(\n name='roku',\n version='3.1',\n d...
python
chosen
[ { "from": "system", "value": "Add argparse as a dependency\n" }, { "from": "human", "value": "import os\nfrom setuptools import setup\nimport mando\n\n\nwith open(os.path.join(os.path.dirname(__file__), 'README.rst')) as fobj:\n readme = fobj.read()\n\nsetup(name='mando',\n version=mando...
python
chosen
[ { "from": "system", "value": "Remove unused python packages from playout\n\n- anyjson is failing with setuptools >=58, because it\ndropped the use_2to3 support.\n- other package are simply not used.\n" }, { "from": "human", "value": "import os\n\nfrom setuptools import setup\n\n# Change director...
python
chosen
[ { "from": "system", "value": "Include template file in distribution\n" }, { "from": "human", "value": "from setuptools import setup\n\nsetup(\n name='nose2_html_report',\n packages=['nose2_html_report'],\n version='0.1.0',\n description='Generate an HTML report for your unit tests',\...
python
chosen
[ { "from": "system", "value": "Update orderedmultidict dependency to 0.7.3 and newer.\n" }, { "from": "human", "value": "import os\nimport re\nimport sys\nfrom sys import version_info\nfrom os.path import dirname, join as pjoin\nfrom setuptools import setup, find_packages\n\nwith open(pjoin(dirna...
python
chosen
[ { "from": "system", "value": "Update package to show readme\n" }, { "from": "human", "value": "#!/usr/bin/env python\nimport os\nfrom setuptools import setup, find_packages\n\n\ndef recursive_path(pack, path):\n matches = []\n for root, dirnames, filenames in os.walk(os.path.join(pack, pat...
python
chosen
[ { "from": "system", "value": "Remove matplotlib from required dependencies\n" }, { "from": "human", "value": "from setuptools import setup\nfrom tools.generate_pyi import generate_pyi\n\ndef main():\n # Generate .pyi files\n import pyxtf.xtf_ctypes\n generate_pyi(pyxtf.xtf_ctypes)\n ...
python
chosen
[ { "from": "system", "value": "Configure port via a Proxyfile\n" }, { "from": "human", "value": "#!/usr/bin/env python\n\nimport sys\nfrom BaseHTTPServer import BaseHTTPRequestHandler, HTTPServer\n\nclass ErrorHTTPRequestHandler(BaseHTTPRequestHandler):\n def do_GET(self):\n self.send_r...
python
chosen
[ { "from": "system", "value": "Make this work on python2.6 again" }, { "from": "human", "value": "import sys\n\n# Python version flags for Python 3 support\nPY2 = ( sys.version_info.major == 2 )\nPY3 = ( sys.version_info.major == 3 ) \n" }, { "from": "gpt", "value": "import sys\n\n# ...
python
chosen
[ { "from": "system", "value": "Put on Python 3 only\n" }, { "from": "human", "value": "from setuptools import setup\ntry:\n from pypandoc import convert\n read_md = lambda f: convert(f, 'rst')\nexcept ImportError:\n print(\"warning: pypandoc module not found, could not convert Markdown t...
python
chosen
[ { "from": "system", "value": "Mark package as OS independent\n" }, { "from": "human", "value": "# -*- coding: utf-8 -*-\nfrom setuptools import setup, find_packages\nimport os\n\n\ndef readfile(fname):\n with open(os.path.join(os.path.dirname(__file__), fname)) as f:\n return f.read()\...
python
chosen
[ { "from": "system", "value": "Add a script to show per-residue score from a PDB file.\n" }, { "from": "human", "value": "#!/usr/bin/env python2\n\nfrom setuptools import setup, find_packages\n\n# Uploading to PyPI\n# =================\n# The first time only:\n# $ python setup.py register -r pypi...
python
chosen
[ { "from": "system", "value": "Use the core, make example more useful.\n" }, { "from": "human", "value": "import sys\nimport os\n\nimport pyglet.window\nfrom pyglet.gl import *\nfrom pyglet import clock\nfrom pyglet.ext.scene2d import Image2d\n\nfrom ctypes import *\n\nif len(sys.argv) != 2:\n ...
python
chosen
[ { "from": "system", "value": "Use a setter for max_depth\n" }, { "from": "human", "value": "import ab_bridge\nimport alpha_beta\nfrom gui import *\n\nfrom player import *\n\nimport threading\n\nclass AIPlayer(Player):\n \"\"\" Yes there is a circular dependancy between AIPlayer and Game \"\"\...
python
chosen
[ { "from": "system", "value": "Fix Installation Issues -> missing Boto3\n" }, { "from": "human", "value": "import setuptools\nimport codecs\nimport os.path\n\n# Used to read the file\ndef read(rel_path):\n here = os.path.abspath(os.path.dirname(__file__))\n with codecs.open(os.path.join(her...
python
chosen
[ { "from": "system", "value": "Pip: Add more install meta-data, including dependency packages\n" }, { "from": "human", "value": "try:\n from setuptools import setup\nexcept ImportError:\n from distutils.core import setup\n\nsetup(name='devito',\n version='2.0.1',\n description=\"\...
python
chosen
[ { "from": "system", "value": "Bump version for another PyPI release, this time to remove accidental vendorized vcr.py\n" }, { "from": "human", "value": "\"\"\"vcrpy-unittest setup module based on\nhttps://github.com/pypa/sampleproject\n\"\"\"\nfrom __future__ import absolute_import, unicode_lite...
python
chosen
[ { "from": "system", "value": "Remove an unused method in FakeResourceTracker\n\nNothing calls _create and there is no _create in the super class for\nthis to be overriding.\n\nChange-Id: Ic41f2d249b9aaffb2caaa18dd492924a4ceb3653\n" }, { "from": "human", "value": "# Copyright (c) 2012 OpenStack F...
python
chosen
[ { "from": "system", "value": "Test behaviour of key deletion\n" }, { "from": "human", "value": "from winton_kafka_streams.state.in_memory_key_value_store import InMemoryKeyValueStore\n\n\ndef test_inMemoryKeyValueStore():\n store = InMemoryKeyValueStore('teststore')\n\n store['a'] = 1\n ...
python
chosen
[ { "from": "system", "value": "Remove tox and pep8 from \"install\" requires.\n\nhttps://github.com/jdowner/requires-provides/issues/2\n" }, { "from": "human", "value": "#!/usr/bin/env python\n\nimport setuptools\n\n\nsetuptools.setup(\n name='requires-provides',\n version='0.1',\n ...
python
chosen
[ { "from": "system", "value": "Fix image grouping in gallery view\n\n" }, { "from": "human", "value": "from django.shortcuts import render\nfrom .models import Image\nfrom .forms import ImageForm\nfrom django.views.generic import CreateView, DeleteView, UpdateView, ListView, View\nfrom django.sho...
python
chosen
[ { "from": "system", "value": "Deploy only for master ?\n" }, { "from": "human", "value": "from flask import Flask, render_template, abort, url_for\nfrom path import path\nimport settings\nimport lib\nfrom rq import Connection, Queue\nfrom redis import Redis\n\nflapp = Flask(__name__)\nflapp.debu...
python
chosen
[ { "from": "system", "value": "Fix provider constant in the example.\n\ngit-svn-id: 353d90d4d8d13dcb4e0402680a9155a727f61a5a@1090630 13f79535-47bb-0310-9956-ffa450edef68\n" }, { "from": "human", "value": "# Licensed to the Apache Software Foundation (ASF) under one or more\n# contributor license ...
python
chosen
[ { "from": "system", "value": "Use DeviceTree.__str__ when printing devices in examples.\n" }, { "from": "human", "value": "\ndef print_devices(b):\n for device in sorted(b.devices, key=lambda d: len(d.ancestors)):\n print(device) # this is a blivet.devices.StorageDevice instance\n\n...
python
chosen
[ { "from": "system", "value": "Enable project search form API.\n" }, { "from": "human", "value": "from django.conf.urls.defaults import patterns, url, include\n\nfrom surlex.dj import surl\n\nfrom .api import ProjectResource, ProjectDetailResource\nfrom .views import ProjectListView, ProjectDetai...
python
chosen
[ { "from": "system", "value": "Correct the plugin name typo mistake\n" }, { "from": "human", "value": "from distutils.core import setup\n\nsetup(\n name='cmsplugin_filery',\n version=\".\".join(map(str, __import__('cmsplugin_filery').__version__)),\n author='Alireza Savand',\n author_...
python
chosen
[ { "from": "system", "value": "docs: Fix simple typo, transfered -> transferred\n\nThere is a small typo in queued_storage/signals.py.\n\nShould read `transferred` rather than `transfered`.\n" }, { "from": "human", "value": "\"\"\"\ndjango-queued-storage ships with a signal fired after a file was...
python
chosen
[ { "from": "system", "value": "Add edge label and rotation.\n" }, { "from": "human", "value": "\"\"\"\nNodes can contain words\n=======================\n\nWe here at **Daft** headquarters tend to put symbols (variable\nnames) in our graph nodes. But you don't have to if you don't\nwant to.\n\n\"...
python
chosen
[ { "from": "system", "value": "Remove test for adding feedback\n" }, { "from": "human", "value": "# -*- coding: utf-8 -*-\nfrom django.test import TestCase, client\n\nfrom .models import Feedback\n\n\nclient = client.Client()\n\n\nclass FeedbackTest(TestCase):\n def test_add_feedback(self):\n ...
python
chosen
[ { "from": "system", "value": "config: Fix typo, cofig => config\n\nSigned-off-by: Vivek Anand <6cbec6cb1b0c30c91d3fca6c61ddeb9b64cef11c@gmail.com>\n" }, { "from": "human", "value": "# -*- coding: utf-8 -*-\n\nimport ConfigParser\nimport os\n\nPROJECT_ROOT = os.path.abspath(os.path.dirname(__name...
python
chosen
[ { "from": "system", "value": "Add note about needing to create the infopage\n" }, { "from": "human", "value": "from django.conf.urls import patterns, include, url\n\nfrom pombola.south_africa.views import LatLonDetailView, SAPlaceDetailSub, \\\n SAOrganisationDetailView, SAPersonDetail, SANew...
python
chosen
[ { "from": "system", "value": "Return absolute url for blog image\n" }, { "from": "human", "value": "from typing import Optional\n\nimport strawberry\nfrom api.scalars import DateTime\nfrom users.types import UserType\n\n\n@strawberry.type\nclass Post:\n id: strawberry.ID\n author: UserType...
python
chosen
[ { "from": "system", "value": "Substitute in our download bucket in that template tag now that the two things are separated\n" }, { "from": "human", "value": "import os\nfrom django import template\nfrom django.conf import settings\nfrom django.template.defaultfilters import stringfilter\nregiste...
python
chosen
[ { "from": "system", "value": "Check for PySide first, and proxy PyQt4 to it\n\nThis allows our other tools, which are rather dumb,\nto import the wrong one and generally continue to\nwork." }, { "from": "human", "value": "\"\"\"Convenience to import Qt if it is availible, otherwise provide stubs...
python
chosen
[ { "from": "system", "value": "Add username and password args\n" }, { "from": "human", "value": "\"\"\"\ngithub-setup-irc-notifications - Configure all repositories in an organization\nwith irc notifications\n\"\"\"\n\nimport github3\n" }, { "from": "gpt", "value": "\"\"\"\ngithub-set...
python
chosen
[ { "from": "system", "value": "Change metric type to int32\n\nThis was done as we may now send a -1 to indicate that we could not\nobtain response timing from request.\n" }, { "from": "human", "value": "#!/usr/bin/env python\n\nfrom maas_common import (status_ok, status_err, metric, get_keystone_...
python
chosen
[ { "from": "system", "value": "Fix small issue in the cleanup filter. It now supports {/code} closing tag (was only {code})\n" }, { "from": "human", "value": "import re\nimport os\n\n\ndef get_emoji_content(filename):\n full_filename = os.path.join(os.path.dirname(__file__), 'emojis', filename...
python
chosen
[ { "from": "system", "value": "Use category, not category title for list_filter\n" }, { "from": "human", "value": "# -*- coding: utf-8 -*-\n\nfrom django.contrib import admin\n\nfrom blanc_pages.admin import BlancPageAdminMixin\n\nfrom .models import Category, Event\n\n\n@admin.register(Category)...
python
chosen
[ { "from": "system", "value": "Fix retrieval of artifact names\n\nSigned-off-by: Aurélien Bompard <bceb368e7f2cb351af47298f32034f0587bbe4a6@bompard.org>\n" }, { "from": "human", "value": "import logging\n\nfrom fastapi import Depends\nfrom httpx import AsyncClient\n\nfrom ..core.config import Set...
python
chosen
[ { "from": "system", "value": "Add a bunch more JSON payload validation related funcionality\n" }, { "from": "human", "value": "#!/usr/bin/env python3\n\nfrom flask import Flask\nfrom flask import request\nfrom flask import jsonify\nfrom utils import download_file, is_video_json_valid\nfrom annot...
python
chosen
[ { "from": "system", "value": "Disable GC, since we no longer create cycles anywhere.\n" }, { "from": "human", "value": "#!/usr/bin/env python\n\n\"\"\"\nmake.py\n\nA drop-in or mostly drop-in replacement for GNU make.\n\"\"\"\n\nimport sys, os\nimport pymake.command, pymake.process\n\npymake.com...
python
chosen
[ { "from": "system", "value": "Add faculty_number to search's json\n" }, { "from": "human", "value": "from django.shortcuts import render\nfrom django.http import HttpResponse\n\nfrom hackfmi.utils import json_view\nfrom .models import User\n\n\ndef homepage(request):\n return render(request, ...
python
chosen
[ { "from": "system", "value": "Fix get_chan (which should return the channel)\n" }, { "from": "human", "value": "\ndef get_chan(channels, chan):\n channels.setdefault(chan['name'], {'producers': [], 'consumers': [], 'data': chan})\n" }, { "from": "gpt", "value": "\ndef get_chan(cha...
python
chosen
[ { "from": "system", "value": "Fix path to worker log on linux\n" }, { "from": "human", "value": "#!/usr/bin/env python\n\nimport subprocess\nimport sys\nimport time\n\nSRHOME = '/home/stoneridge'\nSRPYTHON = '%s/stoneridge' % (SRHOME,)\nSRRUN = '%s/srrun.py' % (SRPYTHON,)\nSRWORKER = '%s/srworke...
python
chosen
[ { "from": "system", "value": "Write a free/bound token finder\n" }, { "from": "human", "value": "import parser\nimport token\nimport symbol\n\nimport sys\nfrom pprint import pprint\n\ntree = parser.st2tuple(parser.suite(sys.argv[1]))\n\ndef convert_readable(tree):\n return tuple(((token.tok_n...
python
chosen
[ { "from": "system", "value": "Adjust loop delay to take into account switch undecidedness (Step one in presentation)\n" }, { "from": "human", "value": "import time\nimport urllib\n\nimport RPi.GPIO as GPIO\n\n# GPIO input pin to use\nLPR_PIN = 3\n# URL to get image from\nSOURCE = 'http://192.168...
python
chosen
[ { "from": "system", "value": "Fix a bug while replacing \"use strict\" JS pragmas\n" }, { "from": "human", "value": "# -*- coding: utf-8 -*-\n\nfrom compressor.filters import FilterBase\n\n\nclass JSUseStrictFilter(FilterBase):\n\n def output(self, **kwargs):\n return self.remove_use_s...
python
chosen
[ { "from": "system", "value": "Fix import for new Flask-SQlAlchemy (no longer in flaskext)\n" }, { "from": "human", "value": "\"\"\"\n # # #### ##### # # ##### # # # #\n # # # # # ## ## # # # ## # #\n ### #### #### # # # # # # ...
python
chosen
[ { "from": "system", "value": "Fix legacy import for Flask-Uploads\n" }, { "from": "human", "value": "\"\"\"\n # # #### ##### # # ##### # # # #\n # # # # # ## ## # # # ## # #\n ### #### #### # # # # # # # # #####\n ...
python
chosen
[ { "from": "system", "value": "Improve default for ip in 'where' event\n" }, { "from": "human", "value": "import os\n\nfrom serf_master import SerfHandler\nfrom utils import with_payload, truncated_stdout\n\n\nclass BaseHandler(SerfHandler):\n\n def __init__(self, *args, **kwargs):\n su...
python
chosen
[ { "from": "system", "value": "Add more documentation. Fix the expand_directory function\n" }, { "from": "human", "value": "import os\n\ndef expand_directory(directory_path):\n ret = []\n\n for file_path in os.listdir(directory_path):\n if os.path.isfile(os.path.join(directory_path, ...
python
chosen
[ { "from": "system", "value": "Remove the problematic migration entirely\n\n- The thumbnail check code is run every time the server is started anyway!\n" }, { "from": "human", "value": "# Generated by Django 2.2.10 on 2020-04-04 12:38\n\nfrom django.db import migrations\nfrom django.db.utils impo...
python
chosen
[ { "from": "system", "value": "Fix unmatched field in Authorization\n\nThe field in the formatted string was not matching the args" }, { "from": "human", "value": "\"\"\"\n.. module: lemur.authorizations.models\n :platform: unix\n :copyright: (c) 2018 by Netflix Inc., see AUTHORS for more\n...
python
chosen
[ { "from": "system", "value": "Add util function for getting diff content\n" }, { "from": "human", "value": "from score import score_funcs\nfrom db import conn\ncurr = conn.cursor()\n\n\ndef process_diff(diffiduser):\n try:\n diffid, user = diffiduser\n except:\n return\n d...
python
chosen
[ { "from": "system", "value": "Use www.wikidata.org instead of wikidata.org\nRewrite-followup to r11105\n\nPatch #3605769 by Legoktm\n\nBecause of various issues [1], using wikidata.org may cause random problems.\nUsing www.wikidata.org will fix these.\n\n[1] https://bugzilla.wikimedia.org/show_bug.cgi?id=45...
python
chosen
[ { "from": "system", "value": "Add a comment about where the basic example was taken\n[skip CI]\n" }, { "from": "human", "value": "import sys\nfrom browser import BrowserDialog\nfrom PyQt4 import QtGui\nfrom PyQt4.QtCore import QUrl\nfrom PyQt4.QtWebKit import QWebView\n\n\nclass MyBrowser(QtGui....
python
chosen
[ { "from": "system", "value": "Patch Data._data_path so it doesn't find the real data file.\n" }, { "from": "human", "value": "from pork.data import Data\n\nfrom mock import Mock, patch, mock_open\nfrom StringIO import StringIO\n\npatch.TEST_PREFIX = 'it'\n\nclass TestData:\n def it_loads_json...
python
chosen
[ { "from": "system", "value": "Remove unused static URL pathing\n" }, { "from": "human", "value": "\"\"\"csunplugged URL Configuration\n\nThe `urlpatterns` list routes URLs to views. For more information please see:\n https://docs.djangoproject.com/en/1.10/topics/http/urls/\nExamples:\nFunctio...
python
chosen
[ { "from": "system", "value": "Add timestamp upon each run.\n" }, { "from": "human", "value": "from coils import user_input\nfrom sqlalchemy import create_engine\n\nusername = user_input('Username', default='root')\npassword = user_input('Password', password=True)\ndbname = user_input('Database n...
python
chosen
[ { "from": "system", "value": "Save the image to png\n" }, { "from": "human", "value": "#! /usr/bin/env python\n\nfrom theora import Ogg\nfrom numpy import concatenate, zeros_like\nfrom scipy.misc import toimage\n\nf = open(\"video.ogv\")\no = Ogg(f)\nY, Cb, Cr = o.test()\nCb2 = zeros_like(Y)\nfo...
python
chosen
[ { "from": "system", "value": "Fix imports on Python 3\n\nOn Python 3, imports are absolute by default.\n\nBecause of these invalid imports, tests don't run anymore on\nPython 3, since tests cannot be loaded.\n\nChange-Id: Ib11a09432939df959568de400f60dfe981d0a403\n" }, { "from": "human", "value"...
python
chosen
[ { "from": "system", "value": "Use the config when creating users.\n" }, { "from": "human", "value": "import click\nfrom spanky.cli import pass_context\n\n\n@click.command('users', short_help='creates users base on /etc/spanky/users')\n@pass_context\ndef cli(ctx):\n config = ctx.config.load('u...
python
chosen
[ { "from": "system", "value": "Revert last change (breaks XSPT)\n" }, { "from": "human", "value": "class RepeatTracker(object):\n def __init__(self):\n self.repeater_map = {}\n\n def __setitem__(self, key, value):\n try:\n self.repeater_map[key].index = value\n except KeyError, e:...
python
chosen
[ { "from": "system", "value": "Add timeout for printout production\n" }, { "from": "human", "value": "#!/usr/bin/env python\nimport os\nimport subprocess\nimport time\nimport glob\nimport unittest\n\nclass ZxSpecTestCase(unittest.TestCase):\n def setUp(self):\n clean()\n\n def tearDo...
python
chosen
[ { "from": "system", "value": "[Telemetry] Disable flaky MSR power monitor unit test.\n\nBUG=chromium:712486\n\nReview-Url: https://codereview.chromium.org/2827723002\n" }, { "from": "human", "value": "# Copyright 2014 The Chromium Authors. All rights reserved.\n# Use of this source code is gover...
python
chosen
[ { "from": "system", "value": "Add documentation to BaseCaller and BaseOptimizer class\n" }, { "from": "human", "value": "\"\"\"\nAbstract optimizer defining the API of optimizer implementations.\n\"\"\"\nfrom __future__ import division, print_function, with_statement\n\nfrom abc import abstractm...
python
chosen
[ { "from": "system", "value": "Add method to get User's avatar\n" }, { "from": "human", "value": "from panoptes_client.panoptes import PanoptesObject, LinkResolver\n\n\nclass User(PanoptesObject):\n _api_slug = 'users'\n _link_slug = 'users'\n _edit_attributes = ()\n\nLinkResolver.regist...
python
chosen
[ { "from": "system", "value": "Fix unittest import and add copyright headers\n" }, { "from": "human", "value": "\"\"\"Tests for plugin.py.\"\"\"\nimport ckanext.wirecloudview.plugin as plugin\n\nfrom mock import MagicMock, patch\n\n\nclass DataRequestPluginTest(unittest.TestCase):\n\n def test...
python
chosen
[ { "from": "system", "value": "Change to the label name for resident status.\n" }, { "from": "human", "value": "from django import forms\nfrom django.utils.translation import ugettext_lazy as _\n\nfrom .models import Contact\n\n\nclass ContactForm(forms.ModelForm):\n class Meta:\n exclu...
python
chosen
[ { "from": "system", "value": "Set global stats for pagarme-python\n" }, { "from": "human", "value": "# encoding: utf-8\n\nfrom .pagarme import Pagarme\nfrom .exceptions import *\n" }, { "from": "gpt", "value": "# -*- coding: utf-8 -*-\n\n__version__ = '2.0.0-dev'\n__description__ = '...
python
chosen
[ { "from": "system", "value": "Fix url include for api app\n" }, { "from": "human", "value": "from django.conf.urls.defaults import patterns, include, url\n\n# Uncomment the next two lines to enable the admin:\n# from django.contrib import admin\n# admin.autodiscover()\n\nurlpatterns = patterns('...
python
chosen
[ { "from": "system", "value": "Add test harness to call_run_on_script_with_keras\n" }, { "from": "human", "value": "# Copyright 2020 Google LLC. All Rights Reserved.\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may not use this file except in compliance with the ...
python
chosen
[ { "from": "system", "value": "ENH: Customize programmatic Olog entries from bluesky\n" }, { "from": "human", "value": "\ndef detselect(detector_object, suffix=\"_stats_total1\"):\n \"\"\"Switch the active detector and set some internal state\"\"\"\n gs.DETS =[detector_object]\n gs.PLOT_...
python
chosen
[ { "from": "system", "value": "Halt on unrecognized constant pool tag\n" }, { "from": "human", "value": "#!/usr/bin/python\n\nimport argparse\nimport struct\nimport sys\n\n###############\n### CLASSES ###\n###############\nclass MyParser(argparse.ArgumentParser):\n def error(self, message):\n ...
python
chosen
[ { "from": "system", "value": "Add multiupload_link in post/album form\n" }, { "from": "human", "value": "#!/usr/bin/env python\n# -*- coding: utf-8 -*-\nfrom django import forms\n\nfrom .models import Post, Album, Link\n\nfrom opps.core.widgets import OppsEditor\n\n\nclass PostAdminForm(forms.Mo...
python
chosen
[ { "from": "system", "value": "Fix imports for py 3\n" }, { "from": "human", "value": "from django.conf.urls import url, include\nfrom rest_framework import routers\nimport views\n\nrouter = routers.DefaultRouter()\nrouter.register(r'schedule', views.ScheduleViewSet)\nrouter.register(r'messageset...
python
chosen
[ { "from": "system", "value": "Remove unneeded imports leading to failures\n" }, { "from": "human", "value": "\"\"\"\nThis API can be used to send text messages to any Threema user, and to\nreceive incoming messages and delivery receipts.\n\nThere are two main modes of operation:\n\n* Basic mode ...
python
chosen
[ { "from": "system", "value": "Support old environement variable names\n" }, { "from": "human", "value": "import logging\nimport os\n\nfrom apscheduler.schedulers.blocking import BlockingScheduler\nfrom raven.base import Client as RavenClient\n\nimport warner\nimport archiver\nimport announcer\ni...
python
chosen
[ { "from": "system", "value": "Update CodeArtifact per 2020-11-05 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# *** Do not modify - this file is autogenerated ***\n# Resource s...
python
chosen
[ { "from": "system", "value": "Use tempdir to ensure there will always be a directory which can be accessed.\n" }, { "from": "human", "value": "'''\nTests for the file state\n'''\n# Import python libs\nimport os\n#\n# Import salt libs\nfrom saltunittest import TestLoader, TextTestRunner\nimport i...
python
chosen
[ { "from": "system", "value": "Change dictionary name to avoid collision; fix dict.values() call\n" }, { "from": "human", "value": "from __future__ import unicode_literals\n\n\nclass Graph(object):\n \"\"\"A class for a simple graph data structure.\"\"\"\n def __init__(self):\n self....
python
chosen
[ { "from": "system", "value": "Add message shown when removing mods.\nAdd function to show some text to the screen - `show_message`\n" }, { "from": "human", "value": "\"\"\"This file is free software under the GPLv3 license\"\"\"\nimport sys\nimport os\nimport shutil\n\nimport renpy\n\nfrom modlo...
python
chosen
[ { "from": "system", "value": "Use repr so it's more obvious what the problem is\n" }, { "from": "human", "value": "import re\nimport os\n\nfrom django.core import checks\nfrom django.conf import settings\n\nre_url = re.compile(r'\\shref=\"(?P<url>/[^\"]*)\"')\n\n@checks.register()\ndef hardcoded...
python
chosen
[ { "from": "system", "value": "tests: Use unittest.mock to mock Windows Registry read.\n" }, { "from": "human", "value": "import sys\nimport unittest\n\nfrom asninja.parser import AtmelStudioProject\nfrom asninja.toolchains.atmel_studio import *\n\n\nclass TestAtmelStudioGccToolchain(unittest.Tes...
python
chosen
[ { "from": "system", "value": "Reduce debug logging in more_like_this\n" }, { "from": "human", "value": "from elasticsearch_dsl import Search, Index\nfrom elasticsearch_dsl.query import MultiMatch, Match, Q, MoreLikeThis\nfrom elasticsearch_dsl.connections import get_connection, connections\nfrom...
python
chosen
[ { "from": "system", "value": "Support visiting unknown nodes in SectNumFolder and SectRefExpander\n" }, { "from": "human", "value": "import docutils\n\nclass SectNumFolder(docutils.nodes.SparseNodeVisitor):\n def __init__(self, document):\n docutils.nodes.SparseNodeVisitor.__init__(sel...
python
chosen
[ { "from": "system", "value": "Document the reasons why we are monkeypatching six into sys.modules\n" }, { "from": "human", "value": "\"\"\"\npip.vendor is for vendoring dependencies of pip to prevent needing pip to\ndepend on something external.\n\nFiles inside of pip.vendor should be considered...
python
chosen
[ { "from": "system", "value": "Correct spacing in docs python\n\n(refs #6699)\n" }, { "from": "human", "value": "#!/usr/bin/env python\nimport sys\nimport os\n\n# Locate MOOSE directory\nMOOSE_DIR = os.getenv('MOOSE_DIR', os.path.join(os.getcwd(), 'moose'))\nif not os.path.exists(MOOSE_DIR):\n ...
python
chosen
[ { "from": "system", "value": "Fix issue when the cwd is not in the config directory\n" }, { "from": "human", "value": "#!/usr/bin/python\n\nimport sys\nimport os\n\nfrom Scripts.common import get_ini_conf, write_ini_conf\n\nif __name__ == \"__main__\":\n\n # Python 2 compatibility\n if sys...
python
chosen
[ { "from": "system", "value": "Update to run on port 5004\n\nFor development we will want to run multiple apps, so they should each bind to a different port number.\n" }, { "from": "human", "value": "#!/usr/bin/env python\n\nimport os\nfrom app import create_app\nfrom flask.ext.script import Mana...
python
chosen
[ { "from": "system", "value": "Fix issue with attempting to scroll through options when not-found package has no packages with matching names causing crash.\n" }, { "from": "human", "value": "\"\"\" This file provide some utility functions for Arch Linux specific rules.\"\"\"\nimport subprocess\n...
python
chosen
[ { "from": "system", "value": "Return the data not gzip decoded\n\nRequests does that by default so you need to use the underlying raw data and\nlet webtest decode it itself instead.\n" }, { "from": "human", "value": "# -*- coding: utf-8 -*-\nimport requests\n\n\nclass HttpClient(object):\n \"...
python
chosen
[ { "from": "system", "value": "Add hints column in challenge model\n" }, { "from": "human", "value": "# -*- coding: utf-8 -*-\n\nfrom hodor import db\nfrom sqlalchemy import inspect\n\n\nclass Challenges(db.Model):\n __tablename__= 'challenges'\n\n #Data variables for each Challenges\n c...
python
chosen
[ { "from": "system", "value": "Remove migration code of pip-tools legacy cache\n\nIt's not a responsibility of Prequ to remove legacy cache dir of\npip-tools.\n" }, { "from": "human", "value": "import os\nfrom shutil import rmtree\n\nfrom .click import secho\nfrom pip.utils.appdirs import user_ca...
python
chosen
[ { "from": "system", "value": "Remove some more paths from Racket\n" }, { "from": "human", "value": "from dmoj.executors.base_executor import CompiledExecutor\nfrom dmoj.executors.mixins import ScriptDirectoryMixin\nimport os\n\n\nclass Executor(ScriptDirectoryMixin, CompiledExecutor):\n ext =...
python
chosen
[ { "from": "system", "value": "Add markers to time series\n" }, { "from": "human", "value": "import plotly as py\nimport plotly.graph_objs as go\nfrom sys import argv\n\nimport names\nfrom csvparser import parse\n\ndata_file = argv[1]\nraw_data = parse(data_file)\n\nsleep_durations = []\nnap_dura...
python
chosen
[ { "from": "system", "value": "Bump version as instructed by bamboo." }, { "from": "human", "value": "#-*- coding: utf-8 -*-\n# version string following pep-0396 and pep-0386\n__version__ = '0.9pbs.23' # pragma: nocover\n" }, { "from": "gpt", "value": "#-*- coding: utf-8 -*-\n# versi...
python
chosen
[ { "from": "system", "value": "Set umask before starting logging.\n" }, { "from": "human", "value": "import logging\nimport flask\nimport sys\n\nclass Flask(flask.Flask):\n\n def __init__(self, *args, **kwargs):\n super(Flask, self).__init__(*args, **kwargs)\n # Set error handlers\n sel...
python
chosen
[ { "from": "system", "value": "Add a comment for robin\n" }, { "from": "human", "value": "\nimport re\nfrom htmlentitydefs import name2codepoint\n\n# From http://wiki.python.org/moin/EscapingHtml\n\n_HTMLENT_CODEPOINT_RE = re.compile('&({0}|#\\d+);'.format(\n '|'.join(name2codepoint.keys(...
python
chosen
[ { "from": "system", "value": "Add str/repr methods to ApiException\n" }, { "from": "human", "value": "import copy\n\n\nclass SigOptException(Exception):\n pass\n\n\nclass ApiException(SigOptException):\n def __init__(self, body, status_code):\n self.message = body.get('message', None) if bo...
python
chosen