conversations
listlengths
2
3
source
stringclasses
1 value
stack
stringclasses
1 value
[ { "from": "system", "value": "Revert configure logger at initialization\n" }, { "from": "human", "value": "#!/usr/bin/env python3\n# -*- coding: utf-8 -*-\n\nfrom wdom.log import configure_logger\n\nconfigure_logger()\n" }, { "from": "gpt", "value": "#!/usr/bin/env python3\n# -*- cod...
python
chosen
[ { "from": "system", "value": "Add optional env kwargs to logging method\n" }, { "from": "human", "value": "import binascii\nimport base64\n\nimport click\n\n\ndef to_base64(value):\n value = base64.urlsafe_b64encode(value.encode(\"utf-8\")).decode(\"utf-8\")\n return f\"base64:{value}\"\n\...
python
chosen
[ { "from": "system", "value": "Fix inconsistent linebreaks after file headers\n" }, { "from": "human", "value": "# This file is part of the Indico plugins.\n# Copyright (C) 2020 - 2021 CERN and ENEA\n#\n# The Indico plugins are free software; you can redistribute\n# them and/or modify them under ...
python
chosen
[ { "from": "system", "value": "Create output dir if does not exist.\n" }, { "from": "human", "value": "import os\nimport zipfile\n\nimport zipfile\ntry:\n import zlib\n mode= zipfile.ZIP_DEFLATED\nexcept:\n mode= zipfile.ZIP_STORED\n\n\n\ndef unzipDir(inputDir):\n for root, dirs, file...
python
chosen
[ { "from": "system", "value": "Change morning transition color to white\n\nFixes #25\n" }, { "from": "human", "value": "from control_milight.models import LightAutomation\nfrom control_milight.views import update_lightstate\nfrom django.conf import settings\nfrom django.core.management.base impor...
python
chosen
[ { "from": "system", "value": "Add description for iOS in facade\n" }, { "from": "human", "value": "'''UniqueID facade.\n\nReturns the following depending on the platform:\n\n* **Android**: Android ID\n* **OS X**: Serial number of the device\n* **Linux**: Serial number using lshw\n* **Windows**: ...
python
chosen
[ { "from": "system", "value": "Remove Code specific for IronPython - useless with 2.7\n" }, { "from": "human", "value": "from rpyc.core.stream import SocketStream, PipeStream\nfrom rpyc.core.channel import Channel\nfrom rpyc.core.protocol import Connection\nfrom rpyc.core.netref import BaseNetref...
python
chosen
[ { "from": "system", "value": "Remove BitVector import - Build fails" }, { "from": "human", "value": "import sys, os\nmyPath = os.path.dirname(os.path.abspath(__file__))\nprint(myPath)\nsys.path.insert(0, myPath + '/../SATSolver')\n\nfrom unittest import TestCase\nfrom individual import Individua...
python
chosen
[ { "from": "system", "value": "Remove debug print on getVersion\n" }, { "from": "human", "value": "import os\nimport re\n\nfrom citrination_client.base import *\nfrom citrination_client.search import *\nfrom citrination_client.data import *\nfrom citrination_client.models import *\nfrom citrinati...
python
chosen
[ { "from": "system", "value": "Remove old docstring with link to old django docs\n" }, { "from": "human", "value": "# flake8: noqa\n\"\"\"\nWSGI config for nucleus project.\n\nIt exposes the WSGI callable as a module-level variable named ``application``.\n\nFor more information on this file, see\...
python
chosen
[ { "from": "system", "value": "Fix 'index out of bound' issue\n" }, { "from": "human", "value": "VERSION = (0, 1, 0)\n\ndef get_version():\n version = '%s.%s' % (VERSION[0], VERSION[1])\n if VERSION[2]:\n version = '%s.%s' % (version, VERSION[2])\n if VERSION[3:] == ('alpha', 0):\...
python
chosen
[ { "from": "system", "value": "Change the version number to 0.1.3\n" }, { "from": "human", "value": "from __future__ import division, print_function, unicode_literals\n\n__version__ = '0.1.2'\n\nfrom hindkit.constants import paths, linguistics, styles, templates\nfrom hindkit.family import Fam...
python
chosen
[ { "from": "system", "value": "Add proper use of property setter.\n" }, { "from": "human", "value": "import numpy as np\nimport theano\nimport theano.tensor as T\nfrom theano.tensor.nnet import conv\nfrom theano.tensor.nnet import softmax\nfrom theano.tensor import shared_randomstreams\nfrom thea...
python
chosen
[ { "from": "system", "value": "Fix geocoder.options being also exported as `geopy.options`\n" }, { "from": "human", "value": "\"\"\"\ngeopy is a Python 2 and 3 client for several popular geocoding web services.\n\ngeopy makes it easy for Python developers to locate the coordinates of\naddresses, ...
python
chosen
[ { "from": "system", "value": "Remove referencetree-related imports from the top level vytree package.\n" }, { "from": "human", "value": "# vytree.__init__: package init file.\n#\n# Copyright (C) 2014 VyOS Development Group <maintainers@vyos.net>\n#\n# This library is free software; you ...
python
chosen
[ { "from": "system", "value": "Fix build path detection on SunOS\n\nInside the hiredis directory there is another directory that contains the\nshared object. This is specific to the platform so we shouldn't care where the\nshared object itself is placed.\n" }, { "from": "human", "value": "import ...
python
chosen
[ { "from": "system", "value": "Set default shell editor for ipython to gvim\n" }, { "from": "human", "value": "c.InteractiveShellApp.exec_lines = []\n# ipython-autoimport - Automatically import modules\nc.InteractiveShellApp.exec_lines.append(\n \"try:\\n %load_ext ipython_autoimport\\nexce...
python
chosen
[ { "from": "system", "value": "Revert \"AndroidResource: Add a UiautoApk resource type.\"\n\nThis reverts commit bc6af25366aacf394f96b5a93008109904a89e93.\n" }, { "from": "human", "value": "# Copyright 2014-2015 ARM Limited\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\")...
python
chosen
[ { "from": "system", "value": "Rename hash variable to prevent colision with native method\n" }, { "from": "human", "value": "from Crypto.Hash import MD5\n\n\ndef derive_openssl_key(key, salt, hash=MD5):\n key = key[0:-16]\n openssl_key = bytes()\n prev = bytes()\n while len(openssl_k...
python
chosen
[ { "from": "system", "value": "Fix tests for updated TinyDB/Tinyrecord\n" }, { "from": "human", "value": "from pypinfo import db\n\nCREDS_FILE = '/path/to/creds_file.json'\n\n\ndef test_get_credentials(tmp_path):\n # Arrange\n db.DB_FILE = str(tmp_path / 'db.json') # Mock\n\n # Assert\n...
python
chosen
[ { "from": "system", "value": "Remove indra prefix from logger\n" }, { "from": "human", "value": "from __future__ import print_function, unicode_literals\nimport logging\nimport os\nimport sys\n__version__ = '1.10.0'\n\n__all__ = ['assemblers', 'belief', 'databases', 'explanation', 'literature',\...
python
chosen
[ { "from": "system", "value": "Add populate es function to test driver\n" }, { "from": "human", "value": "#!/usr/bin/env python\n\nfrom storage import Storage\n\nNEW_REPORT = {'foo': 'bar', 'boo': 'baz'}\n\ndef main():\n db_store = Storage.get_storage()\n for key, value in db_store.__dict__...
python
chosen
[ { "from": "system", "value": "compile(): Use the __debug__ flag to determine the proper filename extension\n\tto use for the cached module code object.\n" }, { "from": "human", "value": "# Routine to \"compile\" a .py file to a .pyc file.\n# This has intimate knowledge of how Python/import.c do...
python
chosen
[ { "from": "system", "value": "Update mailer timeout to 5 seconds\n" }, { "from": "human", "value": "import logging\n\nimport requests\nfrom requests.exceptions import ConnectionError, Timeout\n\nlog = logging.getLogger(__name__)\n\n\nclass MailNotifier(object):\n url = None\n api_key = Non...
python
chosen
[ { "from": "system", "value": "Set more reasonable job sizes\n\nI'll follow this up by adding exponential backoff and then increasing the defaults to something reasonable." }, { "from": "human", "value": "# Your bucket to delete things from.\nBUCKET = 'ADDME'\n\n# How many processes to fork.\nPRO...
python
chosen
[ { "from": "system", "value": "Add TODO to refactor backend registration\n" }, { "from": "human", "value": "from chainer.backends import chainerx # NOQA\nfrom chainer.backends import cpu # NOQA\nfrom chainer.backends import cuda # NOQA\nfrom chainer.backends import intel64 # NOQA\n" }, { ...
python
chosen
[ { "from": "system", "value": "Add url for latest latlon url\n" }, { "from": "human", "value": "from . import views\nfrom django.conf.urls import url\n\n\nurlpatterns = [\n url(r'^find_legislator/', views.find_legislator),\n url(r'^get_latlon/', views.get_latlon)\n]\n" }, { "from": ...
python
chosen
[ { "from": "human", "value": "Apply monkey patch in agent package for direct import main() from dvs_neutron_agent module\n" }, { "from": "gpt", "value": "# Copyright 2016 Mirantis, Inc.\n# All Rights Reserved.\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\"); you may\n# n...
python
chosen
[ { "from": "system", "value": "Add a workaround since somewhere in the Mistral \"publish variable\"\npipeline, trealing and leading whitespace is removed.\n" }, { "from": "human", "value": "#!/usr/bin/env python\n\nimport base64\nimport rsa\nimport six\n\nfrom st2common.runners.base_action import...
python
chosen
[ { "from": "system", "value": "Fix compatibility with the latest release of Sphinx\n\n`l_` from sphinx.locale has been deprecated for a long time.\n`_` is the new name for the same function but it seems that the\nimports there are useless.\n\nhttps://github.com/sphinx-doc/sphinx/commit/8d653a406dc0dc6c263217...
python
chosen
[ { "from": "system", "value": "Increment version number to 0.12.0\n" }, { "from": "human", "value": "\"\"\"Configuration for Django system.\"\"\"\n\n__version__ = \"0.11.0\"\n__version_info__ = tuple(\n [\n int(num) if num.isdigit() else num\n for num in __version__.replace(\"-\"...
python
chosen
[ { "from": "system", "value": "Return the correct thing for modules\n" }, { "from": "human", "value": "from twisted.plugin import IPlugin\nfrom txircd.module_interface import IModuleData, ModuleData\nfrom zope.interface import implements\n\nclass ModulesCommand(ModuleData):\n\timplements(IPlugin,...
python
chosen
[ { "from": "system", "value": "Allow SceneObjects to render themselves\n" }, { "from": "human", "value": "from Cura.View.View import View\n\nclass MeshView(View):\n def __init__(self):\n super(MeshView, self).__init__()\n\n def render(self):\n scene = self.getController().getS...
python
chosen
[ { "from": "system", "value": "Remove redirected pages from the sitemap\n" }, { "from": "human", "value": "# -*- coding: utf-8 -*-\nfrom django.contrib.sitemaps import Sitemap\nfrom django.utils import translation\nfrom cms.models import Title\n\n\ndef from_iterable(iterables):\n \"\"\"\n B...
python
chosen
[ { "from": "system", "value": "Fix relative path in relation to app root dir\n" }, { "from": "human", "value": "# coding=utf-8\n\nimport sys\nsys.path.append('../../')\nimport roche.settings\n\nfrom eulexistdb.db import ExistDB\nfrom roche.settings import EXISTDB_SERVER_URL\n\n#\n# Timeout higher...
python
chosen
[ { "from": "system", "value": "Add partition router to base\n" }, { "from": "human", "value": "\"\"\"\nnydus.db.routers\n~~~~~~~~~~~~~~~~\n\n:copyright: (c) 2011 DISQUS.\n:license: Apache License 2.0, see LICENSE for more details.\n\"\"\"\n\nfrom .base import BaseRouter, RoundRobinRouter\n" }, ...
python
chosen
[ { "from": "system", "value": "Add Python version agnostic helpers for creating byte and unicode literals." }, { "from": "human", "value": "# compatibility module for different python versions\nimport sys\n\nif sys.version_info[:2] > (3, 0):\n\n PY2 = False\n PY3 = True\n\n Bytes = bytes...
python
chosen
[ { "from": "system", "value": "Add 'Unset' to the wsme module\n" }, { "from": "human", "value": "from wsme.api import expose, validate\nfrom wsme.root import WSRoot\nfrom wsme.types import wsattr, wsproperty\n" }, { "from": "gpt", "value": "from wsme.api import expose, validate\nfrom ...
python
chosen
[ { "from": "system", "value": "Add name to trigger list view\n" }, { "from": "human", "value": "from django.contrib import admin\nfrom mrbelvedereci.trigger.models import Trigger\n\nclass TriggerAdmin(admin.ModelAdmin):\n list_display = ('repo', 'type', 'flows', 'org', 'regex', 'active', 'publ...
python
chosen
[ { "from": "system", "value": "Add non-working test for X-Forwarded-For\n" }, { "from": "human", "value": "import requests\n\ndef register_asheesh():\n return requests.post(\n 'http://localhost:3000/register',\n {'rawHostname': 'asheesh',\n 'email': 'asheesh@asheesh.org',...
python
chosen
[ { "from": "system", "value": "Sort and indent the map lists.\n\nPiperOrigin-RevId: 249276696\n" }, { "from": "human", "value": "#!/usr/bin/python\n# Copyright 2019 Google Inc. All Rights Reserved.\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may not use this fil...
python
chosen
[ { "from": "system", "value": "Remove pinned Stripe API version.\n" }, { "from": "human", "value": "from django.conf import settings\nimport stripe\n\nstripe.api_key = settings.STRIPE_API_KEY\nstripe.api_version = \"2018-10-31\"\n\n\nclass StripeGateway:\n \"\"\"A gateway to Stripe\n\n This...
python
chosen
[ { "from": "system", "value": "Fix to suit latest Yahoo changes\n" }, { "from": "human", "value": "# pipeitembuilder.py\n#\n\nimport urllib\nfrom pipe2py import util\n\ndef pipe_itembuilder(context, _INPUT, conf, **kwargs):\n \"\"\"This source builds an item.\n \n Keyword arguments:\n ...
python
chosen
[ { "from": "system", "value": "Increment version number to 0.17.0\n" }, { "from": "human", "value": "\"\"\"Configuration for Django system.\"\"\"\n\n__version__ = \"0.16.6\"\n__version_info__ = tuple(\n [\n int(num) if num.isdigit() else num\n for num in __version__.replace(\"-\"...
python
chosen
[ { "from": "system", "value": "Implement more TGT Warlock cards\n" }, { "from": "human", "value": "from ..utils import *\n\n\n##\n# Minions\n\n# Dreadsteed\nclass AT_019:\n\tdeathrattle = Summon(CONTROLLER, \"AT_019\")\n\n\n# Tiny Knight of Evil\nclass AT_021:\n\tevents = Discard(FRIENDLY).on(Buf...
python
chosen
[ { "from": "system", "value": "Fix buffering issue in udp bridge\n" }, { "from": "human", "value": "#!/usr/bin/env python\n\nimport select\nimport serial\nimport socket\n\ndef run_lux_udp(host, port, dev):\n with serial.Serial(dev, baudrate=3000000, xonxoff=False) as ser:\n sock = socke...
python
chosen
[ { "from": "system", "value": "Make mamba more friendly to linters and IDE's\n\nSome empty functions are added and we are able to optionally import them\n" }, { "from": "human", "value": "__version__ = '0.8.6'\n" }, { "from": "gpt", "value": "__version__ = '0.8.6'\n\n\ndef description...
python
chosen
[ { "from": "system", "value": "Fix in tests for terminal definitions.\n" }, { "from": "human", "value": "import pytest\nfrom parglare import Grammar\nfrom parglare.exceptions import GrammarError\n\n\ndef test_terminal_nonterminal_conflict():\n\n # Production A is a terminal (\"a\") and non-ter...
python
chosen
[ { "from": "system", "value": "Use JSON for API GET /auth/test response\n" }, { "from": "human", "value": "# Copyright (C) 2016 University of Zurich. All rights reserved.\n#\n# This file is part of MSRegistry Backend.\n#\n# MSRegistry Backend is free software: you can redistribute it and/or\n# m...
python
chosen
[ { "from": "system", "value": "Print new line after operation title\n" }, { "from": "human", "value": "\nimport datetime\n\nfrom django.core.management.base import BaseCommand, CommandError\n\nfrom pontoon.administration.files import (\n update_from_repository,\n extract_to_database,\n)\n\n...
python
chosen
[ { "from": "system", "value": "Allow for startup in a different dir\n" }, { "from": "human", "value": "#!/bin/env python\n#\n# cat_StartdLog.py\n#\n# Print out the StartdLog for a glidein output file\n#\n# Usage: cat_StartdLog.py logname\n#\n\nimport sys\nSTARTUP_DIR=sys.path[0]\nsys.path.append(...
python
chosen
[ { "from": "system", "value": "Fix a minor bug due to renaming the lbfgs module.\n" }, { "from": "human", "value": "from .direct import *\nfrom .lbfgs import *\n\n__all__ = []\n__all__ += direct.__all__\n__all__ += lbfgsb.__all__\n" }, { "from": "gpt", "value": "from .direct import *\...
python
chosen
[ { "from": "system", "value": "Fix big from bayeslite to bdbcontrib.\n" }, { "from": "human", "value": "from bayeslite.api import barplot\nfrom bayeslite.api import cardinality\nfrom bayeslite.api import draw_crosscat\nfrom bayeslite.api import estimate_log_likelihood\nfrom bayeslite.api import h...
python
chosen
[ { "from": "system", "value": "Rewrite settings to application.very nice~\n" }, { "from": "human", "value": "#!/usr/bin/env python\n# -*- coding: utf-8 -*-\n\n\ndebug = True\nport = 8000\nprocessor = 1\n\nsettings = None\n\napp_static_path = None\napp_template_path = None\n\n\n\n\n\n\n\n# \n# imp...
python
chosen
[ { "from": "system", "value": "Use daemon threads for follow_file()\n\nSigned-off-by: Jason Bernardino Alonso <f71c42a1353bbcdbe07e24c2a1c893f8ea1d05ee@hackorp.com>\n" }, { "from": "human", "value": "\"\"\"\nUtility functions for dhcp2nest\n\"\"\"\nfrom queue import Queue\nfrom subprocess import ...
python
chosen
[ { "from": "system", "value": "Abort when the page model does not have a template_key field\n" }, { "from": "human", "value": "# ------------------------------------------------------------------------\n# coding=utf-8\n# ------------------------------------------------------------------------\n\n...
python
chosen
[ { "from": "system", "value": "Add more ways to suck line numbers from nodes\n" }, { "from": "human", "value": "from pychecker2.util import type_filter\n\nfrom compiler import ast\n\nclass File:\n def __init__(self, name):\n self.name = name\n self.parseTree = None\n self....
python
chosen
[ { "from": "system", "value": "Language: Add definition into default import\n\nFixes https://github.com/coala/coala/issues/4688" }, { "from": "human", "value": "\"\"\"\nThis directory holds means to get generic information for specific languages.\n\"\"\"\n\n# Start ignoring PyUnusedCodeBear\nfrom...
python
chosen
[ { "from": "system", "value": "Test category example rename for ordering\n" }, { "from": "human", "value": "\"\"\"\nTESTS is a dict with all you tests.\nKeys for this will be categories' names.\nEach test is dict with\n \"input\" -- input data for user function\n \"answer\" -- your right an...
python
chosen
[ { "from": "system", "value": "Change the interface of the kernel submodule to prepare for the API change.\n * Remove legacy support\n * Add load_single()\n * Fix missing keyword argument in load()\n" }, { "from": "human", "value": "#!/usr/bin/env python\n#-*- coding:utf-8 -*-\n\nfrom .highlevel ...
python
chosen
[ { "from": "system", "value": "Comment view with saving and lists\n" }, { "from": "human", "value": "import forms\n\nfrom django.views.generic.edit import CreateView\n\n\nclass CommentView(CreateView):\n \"\"\"\n View for creating and listing comments.\n \"\"\"\n anonymous_comment_for...
python
chosen
[ { "from": "system", "value": "Use the new style urlpatterns syntax to fix Django deprecation warnings\n\nThe `patterns()` syntax is now deprecated:\nhttps://docs.djangoproject.com/en/1.8/releases/1.8/#django-conf-urls-patterns\n\nAnd so under Django 1.8 results in warnings:\nrest_framework_swagger/urls.py:1...
python
chosen
[ { "from": "system", "value": "Add external depedencies to pylint bin\n" }, { "from": "human", "value": "{\n 'name': 'Runbot Pylint',\n 'category': 'Website',\n 'summary': 'Runbot',\n 'version': '1.0',\n 'description': \"Runbot\",\n 'author': 'OpenERP SA',\n 'depends': ['runb...
python
chosen
[ { "from": "system", "value": "Add solution for the isomorphic strings\n" }, { "from": "human", "value": "class Solution:\n # @param {string} s\n # @param {string} t\n # @return {boolean}\n def isIsomorphic(self, s, t):\n\n if len(s) != len(t):\n return False\n\n ...
python
chosen
[ { "from": "system", "value": "Fix bug with dash-separated gallery name\n" }, { "from": "human", "value": "from django.conf.urls import patterns, include, url\nfrom django.contrib import admin\n\nfrom paintings.views import GalleryDetailView, PaintingDetailView\n\nadmin.autodiscover()\n\n\nurlpat...
python
chosen
[ { "from": "system", "value": "Add test to make sure certain classes are always found in cc.license,\nno matter where they are internally.\n" }, { "from": "human", "value": "\"\"\"Tests for functionality within the cc.license module.\n This file is a catch-all for tests with no place else to go...
python
chosen
[ { "from": "system", "value": "Write test data as list unless otherwise needed\n" }, { "from": "human", "value": "from simulocloud import PointCloud\nimport json\nimport numpy as np\n\n_TEST_XYZ = \"\"\"[[10.0, 12.2, 14.4, 16.6, 18.8],\n [11.1, 13.3, 15.5, 17.7, 19.9],\n ...
python
chosen
[ { "from": "system", "value": "Fix exception subclass in worker exception handler\n" }, { "from": "human", "value": "from rq import Connection, Queue, Worker\nfrom worker.exceptions import WorkerException\n\n\ndef worker_exc_handler(job, exc_type, exc_value, traceback):\n if isinstance(exc_typ...
python
chosen
[ { "from": "system", "value": "Use generator instead of list.\n\nCo-authored-by: Teemu Erkkola <ee6c9b9748887a4d25e9c1c5e0aff697ac55fd56@gofore.com>" }, { "from": "human", "value": "from ckan.plugins import toolkit\nfrom ckanext.apply_permissions_for_service import model\n\n\ndef service_permissi...
python
chosen
[ { "from": "system", "value": "Integrate Draftail-related assets with Django widget\n" }, { "from": "human", "value": "from django.forms import widgets\n\nfrom wagtail.admin.edit_handlers import RichTextFieldPanel\nfrom wagtail.admin.rich_text.converters.contentstate import ContentstateConverter\...
python
chosen
[ { "from": "system", "value": "Add new fields to response\n" }, { "from": "human", "value": "from flask.ext.restful import fields\nfrom meta import BasicResource\nfrom config.pins import PinHttpManager\nfrom pi_gpio import app\n\nHTTP_MANAGER = PinHttpManager()\n\n\nclass Pin(BasicResource):\n\n ...
python
chosen
[ { "from": "system", "value": "Fix aio RPC error extraction\n" }, { "from": "human", "value": "# -*- coding: utf-8 -*-\nimport asyncio\nimport websockets\nimport logging\nimport json\n\nfrom jsonrpcclient.clients.websockets_client import WebSocketsClient\n\nfrom .rpc import Rpc\n\nlog = logging.g...
python
chosen
[ { "from": "system", "value": "Swap to using submission prediction writer function\n" }, { "from": "human", "value": "#!/usr/bin/env python\n\nimport neukrill_net.utils as utils\nimport neukrill_net.image_processing as image_processing\n\nimport csv\nimport pickle\nfrom sklearn.externals import j...
python
chosen
[ { "from": "system", "value": "Add levelname to log output\n" }, { "from": "human", "value": "import logging\n\n\ndef init_logging():\n \"\"\"Initialise logging.\n\n Set up basic logging.\n \"\"\"\n logging.basicConfig(\n level=logging.DEBUG,\n datefmt='%Y-%m-%d %H:%M:%S...
python
chosen
[ { "from": "system", "value": "Change send email to contact namespace" }, { "from": "human", "value": "# -*- coding: utf-8 -*-\n\n\"\"\"\nFile: tests.py\nCreator: MazeFX\nDate: 12-7-2016\n\nTests written for testing main website pages (home, about, contact, etc)\n\"\"\"\n\nfrom django.core.urlres...
python
chosen
[ { "from": "system", "value": "Set verbose name of NewResource.\n" }, { "from": "human", "value": "from django.db import models\n\nfrom bulletin.models import Post\n\n\nclass Event(Post):\n\n start_date = models.DateTimeField()\n end_date = models.DateTimeField(null=True, blank=True)\n t...
python
chosen
[ { "from": "system", "value": "Fix return on active user accessing the portal\n" }, { "from": "human", "value": "from alexandria import app, mongo\nfrom decorators import *\nfrom flask import render_template, request, jsonify, g, send_from_directory, redirect, url_for, session, flash\nimport os\n...
python
chosen
[ { "from": "system", "value": "Add regression test for generating yaml with unicode\n" }, { "from": "human", "value": "import pytest\nfrom apispec import yaml_utils\n\n\ndef test_load_yaml_from_docstring():\n def f():\n \"\"\"\n Foo\n bar\n baz quux\n\n ...
python
chosen
[ { "from": "system", "value": "Use LoggingHandler in Celery worker to emit logs from workers\n" }, { "from": "human", "value": "from celery import Celery\nfrom celery.loaders.base import BaseLoader\n\n\nclass CobLoader(BaseLoader):\n\n def on_worker_init(self):\n from ..app import build...
python
chosen
[ { "from": "system", "value": "Refactor some redundancy in the views tests\n" }, { "from": "human", "value": "from django.test import TestCase\nfrom django.http import HttpRequest\nfrom campaigns.views import create_campaign\nfrom campaigns.models import Campaign\nfrom campaigns.forms import Camp...
python
chosen
[ { "from": "system", "value": "Enhance readability of test output\n" }, { "from": "human", "value": "\"\"\"Use Mayapy for testing\n\nUsage:\n $ mayapy run_maya_tests.py\n\n\"\"\"\n\nimport sys\nimport nose\nimport warnings\n\nfrom nose_exclude import NoseExclude\n\nwarnings.filterwarnings(\"ig...
python
chosen
[ { "from": "system", "value": "Correct the comment of BLOCKSIZE\n" }, { "from": "human", "value": "#!/usr/env python\n# -*- coding: utf-8 -*-\n\n\"\"\"Convert file codecs\n\nUsage:\n convert_codecs.py <sourceFile> <targetFile> <sourceEncoding> <targetEncoding>\n convert_codecs.py (-h | --he...
python
chosen
[ { "from": "system", "value": "Add a test for stdio.h." }, { "from": "human", "value": "import unittest\nimport sys\nfrom ctypeslib import h2xml, xml2py\n\nclass ToolchainTest(unittest.TestCase):\n if sys.platform == \"win32\":\n def test(self):\n h2xml.main([\"h2xml\", \"-q\...
python
chosen
[ { "from": "system", "value": "Add generate sql example as comment\n" }, { "from": "human", "value": "\"\"\"Add username\n\nRevision ID: 30d0a626888\nRevises: 51375067b45\nCreate Date: 2015-10-29 10:32:03.077400\n\n\"\"\"\n\n# revision identifiers, used by Alembic.\nrevision = '30d0a626888'\ndown...
python
chosen
[ { "from": "system", "value": "Move command dispatch into full module\n" }, { "from": "human", "value": "import argh\n\nfrom .environments import Environment\nfrom .frameworks import Tempest\nfrom .utils import cleanup, Reporter\n\nLOG = Reporter(__name__).setup()\n\n\ndef main(endpoint, username...
python
chosen
[ { "from": "system", "value": "[py] Add command line argument capability\n" }, { "from": "human", "value": "#!/usr/bin/env python\n# -*- Coding: utf-8 -*-\n\n\"\"\"\n\" In its present form, it simply takes a comma delimited .csv file and outputs a .txt file containing valid 301 redirect statement...
python
chosen
[ { "from": "system", "value": "Use named capture group \"col\" for column number\n\nReference: http://www.sublimelinter.com/en/latest/linter_attributes.html#regex\n" }, { "from": "human", "value": "#\n# linter.py\n# Linter for SublimeLinter3, a code checking framework for Sublime Text 3\n#\n# Wri...
python
chosen
[ { "from": "system", "value": "Handle unsupported version at runtime.\n\nIf you have an ancient setuptools, 4a36ddb3aa77b8d1b1a64c197607fa652705856c\nwon't successfully prevent installing. These changes will at least give a sane error,\nrather then just barfing on random syntax errors due to the `unicode` t...
python
chosen
[ { "from": "system", "value": "Enable building hybrid capsule/non-capsule packages (CNY-3271)\n" }, { "from": "human", "value": "#\n# Copyright (c) 2009 rPath, Inc.\n#\n# This program is distributed under the terms of the Common Public License,\n# version 1.0. A copy of this license should have b...
python
chosen
[ { "from": "system", "value": "Remove brute and inconvinient star import" }, { "from": "human", "value": "# need to install python-opencv, pygame, numpy, scipy, PIL\nimport sys\n\nimport pygame\nfrom pygame.locals import *\n\nimport opencv\n#this is important for capturing/displaying images\nfrom...
python
chosen
[ { "from": "system", "value": "Use stride tricks to save data memory\n" }, { "from": "human", "value": "import numpy as np\nfrom scipy import sparse\nfrom .sparselol_cy import extents_count\n\ndef extents(labels):\n \"\"\"Compute the extents of every integer value in ``arr``.\n\n Parameters...
python
chosen
[ { "from": "system", "value": "Switch away from sphinx.parsers which isn't available in sphinx 1.3.5 on Read The Docs.\n" }, { "from": "human", "value": "import sphinx.parsers\nimport docutils.parsers.rst as rst\n\nclass CStrip(sphinx.parsers.Parser):\n def __init__(self):\n self.rst_parser =...
python
chosen
[ { "from": "system", "value": "Make .contollers() deterministic (was using hash.values())\n" }, { "from": "human", "value": "from sts.util.console import msg\n\nclass ControllerManager(object):\n ''' Encapsulate a list of controllers objects '''\n def __init__(self, controllers):\n self.uuid...
python
chosen
[ { "from": "system", "value": "Use the PlaygroundQuickLook(reflecting:) constructor in this test case\n" }, { "from": "human", "value": "# TestREPLQuickLookObject.py\n#\n# This source file is part of the Swift.org open source project\n#\n# Copyright (c) 2014 - 2015 Apple Inc. and the Swift projec...
python
chosen
[ { "from": "system", "value": "Add global_weakrefs dict to keep strings in structs, etc alive\n" }, { "from": "human", "value": "from __future__ import unicode_literals\n\nimport os\n\nimport cffi\n\n\n__version__ = '2.0.0a1'\n\n\n_header_file = os.path.join(os.path.dirname(__file__), 'api.proces...
python
chosen
[ { "from": "system", "value": "Convert GpuBenchmarkingExtension to a gin::Wrappable class\n\nv8 extensions are slowing down context creation and we're trying to get\nrid of them.\n\nBUG=334679\nR=ernstm@chromium.org,nduca@chromium.org\n\nReview URL: https://codereview.chromium.org/647433003\n\nCr-Commit-Posi...
python
chosen
[ { "from": "system", "value": "Add a simple test for calculating the size of a structure\n" }, { "from": "human", "value": "import steel\nimport unittest\n\n\nclass NameAwareOrderedDictTests(unittest.TestCase):\n def setUp(self):\n self.d = steel.NameAwareOrderedDict()\n\n def test_i...
python
chosen
[ { "from": "system", "value": "Add a bit to the get customer to show handling not-found and testing for canceled status\n" }, { "from": "human", "value": "from sharpy.product import CheddarProduct\n\n# Get a product instance to work with\nproduct = CheddarProduct(\n username = CHEDDAR_USERNAME...
python
chosen
[ { "from": "system", "value": "Add test for credentials reload\n" }, { "from": "human", "value": "import json\n\nimport keyring\n\nfrom pyutrack import Credentials\nfrom tests import PyutrackTest\n\n\nclass CredentialsTests(PyutrackTest):\n def test_empty(self):\n c = Credentials('root'...
python
chosen
[ { "from": "system", "value": "Fix test by passing placeholder variables.\n" }, { "from": "human", "value": "import unittest\n\nfrom vendcrawler.scripts.vendcrawler import VendCrawler\n\nclass TestVendCrawlerMethods(unittest.TestCase):\n\n def test_get_links(self):\n links = VendCrawler...
python
chosen