conversations
listlengths
2
3
source
stringclasses
1 value
stack
stringclasses
1 value
[ { "from": "system", "value": "Set package version to 0.4.2\n" }, { "from": "human", "value": "#!/usr/bin/env python\n# -*- coding: utf-8 -*-\n\n\n\"\"\"\nAlignak REST backend\n\"\"\"\n# Application manifest\nVERSION = (0, 4, 1)\n\n__application__ = u\"Alignak_Backend\"\n__version__ = '.'.join((s...
python
chosen
[ { "from": "system", "value": "Add path_only support to URLArgument\n" }, { "from": "human", "value": "from __future__ import absolute_import\nimport string\nimport urlparse\n\nfrom pale.arguments.string import StringArgument\nfrom pale.errors import ArgumentError\n\nclass URLArgument(StringArgum...
python
chosen
[ { "from": "system", "value": "Add Stemmed Kucera Francis to extras package\n" }, { "from": "human", "value": "__author__ = 's7a'\n\n# All imports\nfrom logger import Logger\nfrom sanitizer import Sanitizer\nfrom kucera_francis import KuceraFrancis" }, { "from": "gpt", "value": "__aut...
python
chosen
[ { "from": "system", "value": "Remove dead code, os.path.mkdir does not even exist\n" }, { "from": "human", "value": "import os, shutil\nfrom nose import with_setup\nfrom mbutil import mbtiles_to_disk, disk_to_mbtiles\n\ndef clear_data():\n try: shutil.rmtree('test/output')\n except Excepti...
python
chosen
[ { "from": "system", "value": "Rename data objects to 'events'\n" }, { "from": "human", "value": "from tastypie.resources import ModelResource\nfrom models import Event\n\nclass EventResource(ModelResource):\n class Meta:\n queryset = Event.objects.all()\n resource_name = 'events...
python
chosen
[ { "from": "system", "value": "api: Hide \"No Environment\" environment from project environments\n" }, { "from": "human", "value": "from __future__ import absolute_import\n\nfrom rest_framework.response import Response\n\nfrom sentry.api.bases.project import ProjectEndpoint\nfrom sentry.api.seri...
python
chosen
[ { "from": "system", "value": "base_report_auto_create_qweb: Change authors to new ones\n" }, { "from": "human", "value": "# -*- coding: utf-8 -*-\n# Authors: See README.RST for Contributors\n# Copyright 2015-2016 See __openerp__.py for Authors\n# License AGPL-3.0 or later (http://www.gnu.org/lic...
python
chosen
[ { "from": "system", "value": "Handle having a single role in the SAML assertion\n" }, { "from": "human", "value": "import base64\nimport xmltodict\nimport json\n\nimport colorama\nfrom . safe_print import safe_print\nfrom . exceptions import SAMLAssertionParseError\n\n\ndef parse_assertion(asser...
python
chosen
[ { "from": "system", "value": "Add default test db name to travis local.py\n" }, { "from": "human", "value": "# -*- coding: utf-8 -*-\n'''Example settings/local.py file.\nThese settings override what's in website/settings/defaults.py\n\nNOTE: local.py will not be added to source control.\n'''\n\n...
python
chosen
[ { "from": "system", "value": "Refactor manager argument to sceneinventory\n" }, { "from": "human", "value": "import argparse\n\nfrom . import pipeline\n\n\nif __name__ == '__main__':\n parser = argparse.ArgumentParser()\n parser.add_argument(\"--creator\", action=\"store_true\",\n ...
python
chosen
[ { "from": "system", "value": "Remove duplicate setting of config variable\n" }, { "from": "human", "value": "# -*- coding: utf8 -*-\n\nimport sys\nimport os\nimport libcrowds_statistics as plugin\n\n# Use the PyBossa test suite\nsys.path.append(os.path.abspath(\"./pybossa/test\"))\n\nos.environ[...
python
chosen
[ { "from": "system", "value": "Update email_ping.py with header and SSL default" }, { "from": "human", "value": "import smtplib\nimport time\nfrom email.mime.text import MIMEText\n\nto_list = ('',) # add recipient (your remote account) here\nfrom_email = '' # email from which the e-mail is sent...
python
chosen
[ { "from": "system", "value": "Change name from 'over' to 'ended'.\n" }, { "from": "human", "value": "\"\"\"\nAn enum describing the various possible game states.\n\nAuthor: Isaac Arvestad\n\"\"\"\nclass GameState(Enum):\n playing = 1\n over = 2\n" }, { "from": "gpt", "value": "...
python
chosen
[ { "from": "system", "value": "Initialize unread column to 0\n" }, { "from": "human", "value": "import sqlite3\n\ndef migrate(database_path):\n print \"migrating to db version 5\"\n conn = sqlite3.connect(database_path)\n conn.text_factory = str\n cursor = conn.cursor()\n\n # updat...
python
chosen
[ { "from": "system", "value": "Clean out the _key from the data, no need to double entry\n" }, { "from": "human", "value": "'''\nCreate a stock database with a built in nesting key index\n'''\n\n# Import maras libs\nimport maras.database\nimport maras.tree_index\n\n\n# We can likely build these o...
python
chosen
[ { "from": "system", "value": "Return namu.wiki contribution data as JSON\n" }, { "from": "human", "value": "\"\"\"namuhub --- namu.wiki contribution graph\"\"\"\nfrom flask import Flask, jsonify, render_template, request, url_for\n\napp = Flask('namuhub')\n\n@app.route('/', methods=['GET'])\ndef...
python
chosen
[ { "from": "system", "value": "Update to use tags instead of custom metadata\n" }, { "from": "human", "value": "# -*- coding: utf-8 -*-\n\"\"\"\nnbtutor - a small utility to indicate which cells should be cleared (exercises).\n\"\"\"\n\nimport os\n\ntry:\n from nbconvert.preprocessors.base imp...
python
chosen
[ { "from": "system", "value": "Update test now that response is iterable\n" }, { "from": "human", "value": "\nfrom unittest import TestCase, main\n\nfrom antfarm import App, Response\nfrom antfarm.response import STATUS\n\nBASE_ENV = {\n 'REQUEST_METHOD': 'GET',\n}\n\nclass AppTest(TestCase):\...
python
chosen
[ { "from": "system", "value": "Test ChildCount on an empty registry\n" }, { "from": "human", "value": "PROPERTIES_IFACE = 'org.freedesktop.DBus.Properties'\nACCESSIBLE_IFACE = 'org.a11y.atspi.Accessible'\n\ndef get_property(proxy, iface_name, prop_name):\n return proxy.Get(iface_name, prop_nam...
python
chosen
[ { "from": "system", "value": "Ch03: Define NewsLink model related fields. [skip ci]\n\n https://docs.djangoproject.com/en/1.8/ref/models/fields/#foreignkey\n\nThe NewsLink model now has a ForeignKey pointing to the Startup model.\nExternal news articles may thus only point to a single startup business,\n...
python
chosen
[ { "from": "system", "value": "Add better error handling for non-200 responses\n" }, { "from": "human", "value": "from requests import get\n\n\nclass WrapperBase(object):\n\n def __init__(self, bearer, token):\n self.bearer = bearer\n self.token = token\n\n @property\n def ...
python
chosen
[ { "from": "system", "value": "Stop device discovery after onboarding\n" }, { "from": "human", "value": "from cornice.service import Service\n\nfrom ..commands import create_configuration_files_and_restart_apps_\nfrom ..config import path\n\n\nconfiguration_service = Service(\n name='configura...
python
chosen
[ { "from": "system", "value": "Add @property exports\nAdd @property imports\n" }, { "from": "human", "value": "from beam_construct import beam\n\nclass BeamFile(object):\n\tdef __init__(self, filename):\n\t\tself._tree = beam.parse(file(filename,\"r\").read())\n\n\tdef selectChunkByName(self, nam...
python
chosen
[ { "from": "system", "value": "Add the functionality for choosing the serial port\n" }, { "from": "human", "value": "# -*- coding: utf-8 -*-\n\nimport wx\nimport wxClass\n\n\nclass wxGestaltApp(wxClass.MyFrame1):\n\n def __init__(self, *args, **kw):\n super(wxGestaltApp, self).__init__(...
python
chosen
[ { "from": "system", "value": "Add missing github field to Author serializer.\n" }, { "from": "human", "value": "# Author: Braedy Kuzma\n\nfrom rest_framework import serializers\nfrom dash.models import Post, Author, Comment, Category\n\nclass AuthorSerializer(serializers.ModelSerializer):\n c...
python
chosen
[ { "from": "system", "value": "Make coverage module optional during test run\n\nChange-Id: I79f767a90a84c7b482e0cc9acd311619611802e9\n" }, { "from": "human", "value": "#!/usr/bin/env python3\n# Copyright (c) 2013 Spotify AB\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\"); y...
python
chosen
[ { "from": "system", "value": "Remove truth assertion on origin\n\nThis is a remnant from testing in the SERRANO_CORS_ORIGIN string. Now\nthat the `in` applies to a list, this assertion is no longer needed.\n" }, { "from": "human", "value": "from warnings import warn\nfrom django.conf import sett...
python
chosen
[ { "from": "system", "value": "Add multiple permissions to a single export\n" }, { "from": "human", "value": "'''\nModule for managing NFS.\n'''\n\n# Import python libs\nimport logging\n\nimport salt.utils\n\nlog = logging.getLogger(__name__)\n\n\ndef __virtual__():\n '''\n Only work on pos...
python
chosen
[ { "from": "system", "value": "Add method to encrypt files\n" }, { "from": "human", "value": "#!/usr/bin/env python\n\nimport subprocess\nfrom Tkinter import *\nfrom tkFileDialog import *\nimport os\n\nclass GpgApp(object):\n def __init__(self, master):\n frame = Frame(master)\n ...
python
chosen
[ { "from": "system", "value": "Remove the ending slash for handle ipn url\n" }, { "from": "human", "value": "from django.conf.urls import patterns, url\nfrom oscar.core.application import Application\n\nfrom systempay import views\n\n\nclass SystemPayApplication(Application):\n name = 'systemp...
python
chosen
[ { "from": "system", "value": "Change pysoundcard and pysoundfile to pyglet\n" }, { "from": "human", "value": "import json\nimport logging\nimport pysoundcard\nimport pysoundfile\nfrom tikplay.database import interface\n\n\nclass API():\n \"\"\" Implements the audio parsing interface for tikpl...
python
chosen
[ { "from": "system", "value": "Deploy Travis CI build 646 to GitHub\n" }, { "from": "human", "value": "\"\"\"Package for PythonTemplateDemo.\"\"\"\n\nimport sys\n\n__project__ = 'PythonTemplateDemo'\n__version__ = '0.0.0'\n\nVERSION = \"{0} v{1}\".format(__project__, __version__)\n\nPYTHON_VERSIO...
python
chosen
[ { "from": "system", "value": "Change name of a filter field\n" }, { "from": "human", "value": "\"\"\"Filter classes corresponding to each one of the works app's models that has the\nsame fields as the model for an equalTo filter.\nThere can be added extra fields inside each class as gt, lt, gte,...
python
chosen
[ { "from": "system", "value": "Allow for case-insensitive checking of file formats. Support m4a\n\n" }, { "from": "human", "value": "import re\nimport os\n\n# Root directory that we scan for music from\n# Do not change this unless you're not using the docker-compose\n# It is preferred you use ju...
python
chosen
[ { "from": "system", "value": "Fix typo and convert TV season/ep to str\n" }, { "from": "human", "value": "#!/usr/bin/python3\n# scrapeOMDB.py - parses a movie and year from arguments and returns JSON\n\nimport json, requests\n\nURL_BASE = 'http://www.omdbapi.com/?'\n\ndef OMDBmovie(mTitle, mYear...
python
chosen
[ { "from": "system", "value": "Ch05: Use attribute for template in Post List.\n" }, { "from": "human", "value": "from django.shortcuts import (\n get_object_or_404, render)\nfrom django.views.generic import View\n\nfrom .models import Post\n\n\ndef post_detail(request, year, month, slug):\n ...
python
chosen
[ { "from": "system", "value": "Put in at least two spaces before inline comment\n" }, { "from": "human", "value": "# -*- coding: utf-8 -*-\n'''Consolidates settings from defaults.py and local.py.\n\n::\n >>> from api.base import settings\n >>> settings.API_BASE\n 'v2/'\n'''\nfrom .defaul...
python
chosen
[ { "from": "system", "value": "Make the Environment object available to build.bfg files\n" }, { "from": "human", "value": "import functools\nimport glob\nimport os\nimport pkgutil\n\n_all_builtins = {}\n_loaded_builtins = False\n\nclass Binder(object):\n def __init__(self, fn):\n self.f...
python
chosen
[ { "from": "system", "value": "Add url mapping for the tag details view\n" }, { "from": "human", "value": "# -*- coding: utf-8 -*-\n#\n# (c) 2014 Bjoern Ricks <bjoern.ricks@gmail.com>\n#\n# See LICENSE comming with the source of 'trex' for details.\n#\n\nfrom django.conf.urls import patterns, url...
python
chosen
[ { "from": "system", "value": "Change verbage on program profile info.\n\nFixes issue 1601.\n" }, { "from": "human", "value": "#!/usr/bin/env python2.5\n#\n# Copyright 2009 the Melange authors.\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may not use this file ex...
python
chosen
[ { "from": "system", "value": "Fix encoding issue when test lcd\n" }, { "from": "human", "value": "from ev3.ev3dev import Lcd\n# -*- coding: utf-8 -*-\nimport unittest\nfrom util import get_input\nimport time\nfrom PIL import Image,ImageDraw,ImageFont\nclass TestLcd(unittest.TestCase):\n\n def...
python
chosen
[ { "from": "system", "value": "Add axiom and theorem checks\n" }, { "from": "human", "value": "# Chapter 2: The pq-system\n\ndef make_axiom(n):\n assert type(n) == int\n assert n > 0\n x = '-' * n\n return x + 'p' + '-q' + x + '-'\n\ndef next_theorem(theorem):\n assert 'p' in theorem\n asse...
python
chosen
[ { "from": "system", "value": "Set the initial dependency version information\n\nThis sets our initial version tuple to 0.0.1, which is as far as I know\nthe smallest possible version, or at least the smallest semver that \nmakes any sense.\n\nFrom this point forward, changes to anything that we want anyone ...
python
chosen
[ { "from": "system", "value": "Enable Selenium tests for Travis.\n" }, { "from": "human", "value": "\n# SECRET_KEY and DATABASES needs to be defined before the base settings is imported.\nSECRET_KEY = 'hbqnTEq+m7Tk61bvRV/TLANr3i0WZ6hgBXDh3aYpSU8m+E1iCtlU3Q=='\n\nDATABASES = {\n 'default': {\n ...
python
chosen
[ { "from": "human", "value": "Add test for solver/proofread pair\n" }, { "from": "gpt", "value": "import os\nimport threading\n\nimport numpy as np\n\nimport pytest\nfrom skimage import io\n\nfrom gala import serve, evaluate as ev\n\nD = os.path.dirname(os.path.abspath(__file__))\n\nos.chdir(os.p...
python
chosen
[ { "from": "system", "value": "Fix problem in as_json and as_jsonp\n" }, { "from": "human", "value": "import json\nfrom functools import wraps\n\nfrom django.http import HttpResponse\nfrom django.shortcuts import render_to_response\nfrom django.template import RequestContext\n\n\ndef as_json(func...
python
chosen
[ { "from": "system", "value": "Add repr method for TohuNamespace\n" }, { "from": "human", "value": "from bidict import bidict, ValueDuplicationError\n\n\ndef is_anonymous(name):\n return name.startswith(\"ANONYMOUS_ANONYMOUS_ANONYMOUS_\")\n\n\nclass TohuNamespaceError(Exception):\n \"\"\"\n...
python
chosen
[ { "from": "system", "value": "Add is_crop for celebA example" }, { "from": "human", "value": "import os\n\ntag = 'celebA_dcgan'\ndataset = 'celebA'\n\ncommand = 'python main.py --dataset %s --is_train True ' \\\n '--sample_dir samples_%s --checkpoint_dir checkpoint_%s --tensorboard_run ...
python
chosen
[ { "from": "system", "value": "Add returns to test class properties\n" }, { "from": "human", "value": "# Licensed under a 3-clause BSD style license - see LICENSE.rst\n# Tests of NDDataBase\n\nfrom __future__ import (absolute_import, division, print_function,\n unicode_lite...
python
chosen
[ { "from": "system", "value": "Add timing for problem 3's python implementation\n" }, { "from": "human", "value": "def largest_prime_factor(n, h):\n for i in xrange(2, n+1):\n d, m = divmod(n, i)\n if m == 0:\n largest_prime_factor(d, i)\n break\n if n ==...
python
chosen
[ { "from": "system", "value": "Set up environment specific connection to rabbitmq\n" }, { "from": "human", "value": "# -*- coding: utf-8 -*-\n\nimport time\nimport json\nimport sys\nimport pika\nfrom tweepy.streaming import StreamListener\n\nclass Listener(StreamListener):\n def __init__(self)...
python
chosen
[ { "from": "system", "value": "Change model File to Show Better and Correct Image Field\n" }, { "from": "human", "value": "import os\n\nfrom django.db import models\n\ndef get_image_path(filename):\n return os.path.join('photos',filename)\n\nclass Location(models.Model):\n name = models.Cha...
python
chosen
[ { "from": "system", "value": "Refactor selection sort w/ comments\n" }, { "from": "human", "value": "from __future__ import absolute_import\nfrom __future__ import print_function\nfrom __future__ import division\n\n\ndef selection_sort(ls):\n \"\"\"Selection Sort algortihm.\n\n Time comple...
python
chosen
[ { "from": "system", "value": "Fix import to support Python3\n" }, { "from": "human", "value": "# -*- coding: utf-8 -*-\n#\n# escpos/impl/__init__.py\n#\n# Copyright 2015 Base4 Sistemas Ltda ME\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may not use this file ex...
python
chosen
[ { "from": "system", "value": "Test runner is now class-based.\n" }, { "from": "human", "value": "from django.test.simple import run_tests as default_run_tests \nfrom django.conf import settings \n\n\ndef run_tests(test_labels, *args, **kwargs):\n\tdel test_labels\n\treturn default_run_tests(sett...
python
chosen
[ { "from": "system", "value": "Change import InviteForm from private.forms to accounts.forms\n" }, { "from": "human", "value": "from django.contrib.auth.decorators import user_passes_test\nfrom django.http import Http404\nfrom django.shortcuts import redirect, render\n\nfrom accounts.utils import...
python
chosen
[ { "from": "system", "value": "Change script to update offering on Host instead Instance\n" }, { "from": "human", "value": "# coding: utf-8\n\n\nclass UpdateInstances(object):\n\n @staticmethod\n def do():\n from dbaas_cloudstack.models import DatabaseInfraOffering\n from dbaa...
python
chosen
[ { "from": "system", "value": "Print configuration contents in main.\n" }, { "from": "human", "value": "\"\"\"\nThis module is responsible for handling configuration and files related to it,\nincluding calibration parameters.\n\"\"\"\n\nimport configparser\nfrom os import path\nimport syslog\n\n\...
python
chosen
[ { "from": "system", "value": "Add encoder to wheel velocity test\n" }, { "from": "human", "value": "#!/usr/bin/python\n\nfrom config import Config\nfrom motor import Motor\nimport Rpi.GPIO as GPIO\nimport json\nimport sys\nimport time\n\ndef _init_motor(self, pin1_s, pin2_s, pinE_s):\n pin1 =...
python
chosen
[ { "from": "system", "value": "Fix weird distutils.log reloading/caching situation\n\nFor some reason `distutils.log` module is getting cached in `distutils.dist`\nand then loaded again when we have the opportunity to patch it.\nThis implies: id(distutils.log) != id(distutils.dist.log).\nWe need to make sure...
python
chosen
[ { "from": "system", "value": "Clarify error if otp is wrong" }, { "from": "human", "value": "#!/usr/bin/python\n\"\"\"An example demonstrating the client-side usage\nof the cretificate request API endpoint.\n\"\"\"\n\nimport requests, sys, json\n\notp = sys.argv[1]\n\ndomain_req_url = 'https://s...
python
chosen
[ { "from": "system", "value": "Fix map issues with Python3\n\nPartially implements: blueprint python-3\n\nChange-Id: Ia7dfc2a28c311a378ca5ada477d18a5b741782b2\n" }, { "from": "human", "value": "# Copyright (c) 2013 Mirantis Inc.\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\...
python
chosen
[ { "from": "system", "value": "Remove tracker field from ParsedBug. Add _tracker_name\n" }, { "from": "human", "value": "import scrapy.item\n\nclass ParsedBug(scrapy.item.Item):\n # Fields beginning with an underscore are not really part of a\n # bug, but extra information that can be expor...
python
chosen
[ { "from": "system", "value": "Refresh the grid every 20 seconds.\n" }, { "from": "human", "value": "from django.core import serializers\nfrom django.http import HttpResponse, HttpResponseBadRequest, HttpResponseForbidden\nfrom django.shortcuts import get_object_or_404, redirect, render_to_respon...
python
chosen
[ { "from": "system", "value": "Add FTPSHook in _hooks register." }, { "from": "human", "value": "# Imports the hooks dynamically while keeping the package API clean,\n# abstracting the underlying modules\nfrom airflow.utils import import_module_attrs as _import_module_attrs\n\n_hooks = {\n 'ft...
python
chosen
[ { "from": "system", "value": "Return http status code 301 when api version is wrong\n" }, { "from": "human", "value": "# -*- coding: utf-8 -*-\nfrom functools import wraps, partial\n\nfrom flask import request\nfrom flask_api import status\nfrom flask.wrappers import Response\n\nfrom app.config ...
python
chosen
[ { "from": "system", "value": "Add an initial model for an issue\n" }, { "from": "human", "value": "from django.db import models\n\n# Create your models here.\n" }, { "from": "gpt", "value": "\"\"\"Mini Issue Tracker program. Originally taken from Paul Bissex's blog post:\nhttp://news...
python
chosen
[ { "from": "system", "value": "Test variable argument in a function\n" }, { "from": "human", "value": "#!/usr/bin/env python\n# function\ndef sum(op1, op2):\n return op1 + op2\n\nmy_sum = sum\nprint my_sum(1, 2)\nprint my_sum(\"I am \", \"zzz\");\n\n# Default value in a fuction\ninit = 12\ndef...
python
chosen
[ { "from": "system", "value": "Improve error reporting for content item testing utils\n" }, { "from": "human", "value": "from django.contrib.contenttypes.models import ContentType\n\n\n# USEFUL FUNCTIONS FOR FLUENT CONTENTS #############################################################\n\n# Fluent...
python
chosen
[ { "from": "system", "value": "Make sure that the wrapped function inherits doctring\n" }, { "from": "human", "value": "import threading\nimport contextlib\n\nthe_current_shell = threading.local()\nthe_current_shell.value = None\n\n\n@contextlib.contextmanager\ndef set_current_shell(shell):\n ...
python
chosen
[ { "from": "system", "value": "Add explicit ordering to inlist items\n" }, { "from": "human", "value": "# -*- coding: utf-8\nfrom django.conf import settings\nfrom django.db import models\n\nclass InlistItem(models.Model):\n text = models.CharField(max_length=255, default='')\n user = model...
python
chosen
[ { "from": "system", "value": "Make imports compliant to PEP 8 suggestion\n" }, { "from": "human", "value": "from turtle import *\n\nGROESSE = 0.5\nFARBE = \"red\"\nFAERBEN = True\nSHAPE = \"turtle\"\n\nfillcolor(FARBE)\nshape(SHAPE)\n\ndef zeichneKerze(brennt):\n pd()\n begin_fill()\n f...
python
chosen
[ { "from": "system", "value": "Fix patched _format_coroutine to support Cython generators\n" }, { "from": "human", "value": "import asyncio\n\nfrom asyncio import coroutines\n\n\ndef _format_coroutine(coro):\n if asyncio.iscoroutine(coro) and not hasattr(coro, 'cr_code'):\n # Most likel...
python
chosen
[ { "from": "system", "value": "Change project name (back) to \"DistAlgo\".\n\n* setup.py: Change project name to \"DistAlgo\".\n" }, { "from": "human", "value": "from distutils.core import setup\n\nimport dpy\n\nsetup(name = \"DistPy\",\n version = dpy.__version__,\n author= \"bolin\",\...
python
chosen
[ { "from": "system", "value": "Make txrudp the sole distributed package.\n" }, { "from": "human", "value": "\"\"\"Setup module for txrudp.\"\"\"\n\nimport codecs\nfrom os import path\nimport sys\n\nfrom setuptools import find_packages, setup\n\n\n_HERE = path.abspath(path.dirname(__file__))\nwith...
python
chosen
[ { "from": "system", "value": "Fix peek method to return value instead of object\n" }, { "from": "human", "value": "#!/usr/bin/env python\n\n'''Implementation of a simple stack data structure.\nThe stack has push, pop, and peek methods. Items in the stack have a value,\nand next_item attribute. T...
python
chosen
[ { "from": "system", "value": "Add import JsonRpcClientContext in the main module\n" }, { "from": "human", "value": "from .decorators import raw_response, validate # NOQA\nfrom .client import JsonRpcClient # NOQA\nfrom .rpc import JsonRpc # NOQA\n\nfrom .exceptions import ( # NOQA\n RpcGen...
python
chosen
[ { "from": "system", "value": "Fix Activity Stream category title\n" }, { "from": "human", "value": "class AllHangs(object):\n title = \"All Hangs\"\n\n @staticmethod\n def matches_hang(_):\n return True\n\nclass DevtoolsHangs(object):\n title = \"Devtools Hangs\"\n\n @stati...
python
chosen
[ { "from": "system", "value": "Fix Travis while the Atom support is incomplete.\n" }, { "from": "human", "value": "# Copyright (c) 2014, Matt Layman\n\nimport os\nimport sys\n\nfrom werkzeug.contrib.atom import AtomFeed\n\nfrom handroll import logger\nfrom handroll.composers import Composer\n\n\n...
python
chosen
[ { "from": "system", "value": "Correct variable name is singular here\n" }, { "from": "human", "value": "from app.actions.mslookup import proteinquant as lookups\nfrom app.drivers.mslookup import base\n\n\nclass ProteinQuantLookupDriver(base.LookupDriver):\n \"\"\"Creates lookup of protein tab...
python
chosen
[ { "from": "system", "value": "Add exception for streams forcefully reset\n" }, { "from": "human", "value": "# -*- coding: utf-8 -*-\n\"\"\"\nhyper/http20/exceptions\n~~~~~~~~~~~~~~~~~~~~~~~\n\nThis defines exceptions used in the HTTP/2 portion of hyper.\n\"\"\"\n\nclass HTTP20Error(Exception):\n...
python
chosen
[ { "from": "system", "value": "Add name when creating Target\n" }, { "from": "human", "value": "import django\nimport os\nimport yaml\nfrom backend.settings import BASE_DIR\n\nos.environ.setdefault('DJANGO_SETTINGS_MODULE', 'backend.settings')\ndjango.setup()\n\nfrom breach.models import Target\n...
python
chosen
[ { "from": "system", "value": "Fix dictionary access pattern for setting auth tokens\n" }, { "from": "human", "value": "import os\n\nmylang = 'test'\nfamily = 'wikipedia'\n\n\ncustom_path = os.path.expanduser('~/user-config.py')\nif os.path.exists(custom_path):\n with open(custom_path, 'rb') a...
python
chosen
[ { "from": "system", "value": "Make test output more verbose so we can figure out what is hanging\n" }, { "from": "human", "value": "from bongo.settings.prod import *\n\n# The same settings as production, but no database password.\n\nDATABASES = {\n 'default': {\n 'ENGINE': 'django.db.b...
python
chosen
[ { "from": "system", "value": "Use tornado settings, webapp deprecated\n" }, { "from": "human", "value": "# Configuration file for ipython-notebook.\n\nc = get_config()\nc.NotebookApp.ip = '*'\nc.NotebookApp.open_browser = False\nc.NotebookApp.port = 8888\n\n# Whether to trust or not X-Scheme/X-F...
python
chosen
[ { "from": "system", "value": "Document utility functions in buildlet.runner\n" }, { "from": "human", "value": "\"\"\"\nRunner classes to execute tasks.\n\"\"\"\n\n_namemodmap = dict(\n SimpleRunner='simple',\n IPythonParallelRunner='ipythonparallel',\n MultiprocessingRunner='multiproces...
python
chosen
[ { "from": "system", "value": "Set celery task results to expire in 1h\n" }, { "from": "human", "value": "# This program is free software: you can redistribute it and/or modify\n# it under the terms of the GNU Affero General Public License as\n# published by the Free Software Foundation, either v...
python
chosen
[ { "from": "system", "value": "browse: Use correct Django HTML template for default view\n" }, { "from": "human", "value": "# Copyright (C) 2017-2018 The Software Heritage developers\n# See the AUTHORS file at the top-level directory of this distribution\n# License: GNU Affero General Public Lic...
python
chosen
[ { "from": "system", "value": "Add (failing) test for returning numba objects\n" }, { "from": "human", "value": "# -*- coding: utf-8 -*-\nfrom __future__ import print_function, division, absolute_import\n\nimport unittest\n\nfrom numba2 import jit, int32\n\n#===-----------------------------------...
python
chosen
[ { "from": "system", "value": "Rename test user to avoid clash\n" }, { "from": "human", "value": "\"\"\"\n:Copyright: 2006-2020 Jochen Kupperschmidt\n:License: Modified BSD, see LICENSE for details.\n\"\"\"\n\nfrom unittest.mock import patch\n\nimport pytest\n\nfrom byceps.services.user_message i...
python
chosen
[ { "from": "system", "value": "refactor: Move initialisations inside main to avoid running them if not necessary\n" }, { "from": "human", "value": "#! /usr/bin/env python\n\nimport os\nfrom slackclient import SlackClient\nimport pyrebase\nimport linkatos.firebase as fb\nimport linkatos.activities...
python
chosen
[ { "from": "system", "value": "Add acl method to Entry model\n" }, { "from": "human", "value": "from sqlalchemy import (\n Column,\n DateTime,\n Integer,\n Unicode,\n UnicodeText,\n )\n\nfrom sqlalchemy.ext.declarative import declarative_base\nimport datetime\nimport psycopg2\n\...
python
chosen
[ { "from": "system", "value": "Increase resource size check limits\n\nThis brings the limits to the greatest value with 2sf that is\nbelow the actual value without becoming higher.\n" }, { "from": "human", "value": "import pytest\n\nimport iati.core.resources\n\nclass TestResources(object):\n ...
python
chosen
[ { "from": "system", "value": "Reduce results per page to 30\n" }, { "from": "human", "value": "import os\nfrom dmutils.status import get_version_label\n\nbasedir = os.path.abspath(os.path.dirname(__file__))\n\n\nclass Config:\n\n VERSION = get_version_label(\n os.path.abspath(os.path.d...
python
chosen
[ { "from": "system", "value": "Add options for setting the port.\n" }, { "from": "human", "value": "#!/usr/bin/env python\n\nimport rethinkdb as r\n\nconn = r.connect('localhost', 30815, db='materialscommons')\n\nif __name__ == \"__main__\":\n selection = list(r.table('datadirs').run(conn))\n ...
python
chosen
[ { "from": "system", "value": "Fix indentation to be a multiple of 4\n" }, { "from": "human", "value": "# (c) 2012-2014, Michael DeHaan <michael.dehaan@gmail.com>\n#\n# This file is part of Ansible\n#\n# Ansible is free software: you can redistribute it and/or modify\n# it under the terms of the ...
python
chosen
[ { "from": "system", "value": "Use posixpath for paths in the cloud.\n\nFixes build break on Windows.\n\nR=borenet@google.com\n\nReview URL: https://codereview.chromium.org/18074002\n\ngit-svn-id: 32fc27f4dcfb6c0385cd9719852b95fe6680452d@9792 2bbb7eff-a529-9590-31e7-b0007b416f81\n" }, { "from": "huma...
python
chosen
[ { "from": "system", "value": "Add _is_pos_on_board() to determine if a position is on the board\n" }, { "from": "human", "value": "# Use x, y coords for unit positions\n# (97, 56) ... (104, 56)\n# ... ...\n# (97, 49) ... (104, 49)\n#\n# Algebraic notation for a position is:\n# algebr...
python
chosen
[ { "from": "system", "value": "Add unittest for type check during backward in TestDropout\n" }, { "from": "human", "value": "import unittest\n\nimport numpy\n\nimport chainer\nfrom chainer import cuda\nfrom chainer import functions\nfrom chainer import testing\nfrom chainer.testing import attr\n\...
python
chosen
[ { "from": "system", "value": "[tools] Format codepoints according to the Namelist spec.\n" }, { "from": "human", "value": "#!/usr/bin/env python\n# Copyright 2015, Google Inc.\n# Author: Dave Crossland (dave@understandinglimited.com)\n#\n# Licensed under the Apache License, Version 2.0 (the \"...
python
chosen