conversations
listlengths
2
3
source
stringclasses
1 value
stack
stringclasses
1 value
[ { "from": "system", "value": "Update create_request method / Create status method\n" }, { "from": "human", "value": "from typing import Union\nfrom typing import List\nfrom datetime import datetime\n\nfrom .database_manager import DatabaseManager\nfrom ..database.requests.request import Request\...
python
chosen
[ { "from": "system", "value": "Add a nice list of classifiers.\n" }, { "from": "human", "value": "#! /usr/bin/python\n\nimport os\nimport setuptools\nimport sys\n\n# FIXME explain why this is here\nsys.path.insert(0,\n os.path.join(\n os.path.dirname(__file__),\n \"lib\",\n ...
python
chosen
[ { "from": "system", "value": "Add root view to API\n" }, { "from": "human", "value": "from rest_framework.routers import SimpleRouter\n\n#\nfrom bingo_server.api import views as bingo_server_views\n\nrouter = SimpleRouter()\n\nrouter.register('games', bingo_server_views.GameViewSet)\n\nurlpatter...
python
chosen
[ { "from": "system", "value": "Add command-line option for program version.\n" }, { "from": "human", "value": "from __future__ import print_function\n\nimport argparse\nimport shcol\n\n__all__ = ['main']\n\ndef main(cmd_args):\n parser = argparse.ArgumentParser(\n description='Generate ...
python
chosen
[ { "from": "system", "value": "Adjust spacing to match Twisted's.\n\n--HG--\nextra : convert_revision : svn%3Ae60b0d31-0b1b-0410-851a-a02d0c527677/trunk%40258\n" }, { "from": "human", "value": "# Copyright (c) 2003-2008 Ralph Meijer\n# See LICENSE for details.\n\nclass Error(Exception):\n msg ...
python
chosen
[ { "from": "system", "value": "Fix displaying of the matrix.\n" }, { "from": "human", "value": "from fractions import Fraction\nfrom parser import Parser\n\nclass LinearProgram:\n\n def __init__(self):\n self.nbVariables = 0\n self.nbConstraints = 0\n self.objective = None...
python
chosen
[ { "from": "system", "value": "Make the two Stack implementations consistent\n\nIn terms of whether they inherit from `object` (now they both don't)." }, { "from": "human", "value": "class Stack(object):\n\n def __init__(self):\n self._items = []\n\n def is_empty(self):\n retu...
python
chosen
[ { "from": "system", "value": "Add unicode_literals import to test suite\n" }, { "from": "human", "value": "import unittest\n\nfrom mopidy_{{ cookiecutter.ext_name }} import Extension, frontend as frontend_lib\n\n\nclass ExtensionTest(unittest.TestCase):\n\n def test_get_default_config(self):\...
python
chosen
[ { "from": "system", "value": "Revert \"Don't try to save SubjectSet.links.project on exiting objects\"\n\nThis reverts commit b9a107b45cf2569f9effa1c8836a65255f2f3e64.\n\nSuperseded by 7d2fecab46f0ede85c00fba8335a8dd74fe16489\n" }, { "from": "human", "value": "from panoptes_client.panoptes impor...
python
chosen
[ { "from": "system", "value": "Move selection clearing to before running the action\n\nThis allows actions like \"jump\" to modify the selection\n" }, { "from": "human", "value": "import sublime, sublime_plugin\nimport os\nfrom SublimePlumb.Mouse import MouseCommand\n\nclass SublimePlumbSend(Mous...
python
chosen
[ { "from": "system", "value": "Delete cache first before setting new value\n" }, { "from": "human", "value": "from django.core.cache import cache\n\n#get the cache key for storage\ndef cache_get_key(*args, **kwargs):\n import hashlib\n serialise = []\n for arg in args:\n serialise...
python
chosen
[ { "from": "system", "value": "[IMP] project: Enable `Timesheets` option if `Time Billing` is enabled\n" }, { "from": "human", "value": "# -*- coding: utf-8 -*-\n# Part of Odoo. See LICENSE file for full copyright and licensing details.\n\nfrom odoo import api, fields, models\n\n\nclass ProjectCo...
python
chosen
[ { "from": "system", "value": "Update SQL data migration to exclude NULL and blank image values.\n" }, { "from": "human", "value": "# -*- coding: utf-8 -*-\nfrom __future__ import unicode_literals\n\nfrom django.db import migrations\n\n\nclass Migration(migrations.Migration):\n\n dependencies ...
python
chosen
[ { "from": "system", "value": "Use single quotes for strings\n" }, { "from": "human", "value": "# -*- coding: utf-8; -*-\n#\n# The MIT License (MIT)\n#\n# Copyright (c) 2014 Flavien Charlon\n#\n# Permission is hereby granted, free of charge, to any person obtaining a copy\n# of this software and ...
python
chosen
[ { "from": "system", "value": "Fix flags bug hasattr returns True if the attribute is None\n\nUse forward references for type hinting in entity\n" }, { "from": "human", "value": "from enum import IntFlag\n\n\nclass SystemFlag(IntFlag):\n controller = 1\n movement = 2\n graphics = 4\n ...
python
chosen
[ { "from": "system", "value": "Add profiling code (commented) for profiling the realtime processing.\n" }, { "from": "human", "value": "import django\n\ndjango.setup()\n\nfrom busshaming.data_processing import process_realtime_dumps\n\n\nif __name__ == '__main__':\n process_realtime_dumps.proc...
python
chosen
[ { "from": "system", "value": "Make statsd host configurable via env.\n" }, { "from": "human", "value": "from os import getenv\n\nGEOIP_DB_FILE = '/usr/local/share/GeoIP/GeoIP2-City.mmdb'\n\nSTATSD_HOST = 'graphite1.private.phx1.mozilla.com'\nSTATSD_PORT = 8125\nSTATSD_PREFIX = 'glow-workers-{}'....
python
chosen
[ { "from": "system", "value": "Add _height/_width on widget MultipleUpload\n" }, { "from": "human", "value": "from django import forms\nfrom django.conf import settings\nfrom django.template.loader import render_to_string\n\n\nclass MultipleUpload(forms.FileInput):\n def render(self, name, val...
python
chosen
[ { "from": "human", "value": "Add license to top of file. " }, { "from": "gpt", "value": "# Numenta Platform for Intelligent Computing (NuPIC)\n# Copyright (C) 2019, Numenta, Inc. Unless you have an agreement\n# with Numenta, Inc., for a separate license for this software code, the\n# follow...
python
chosen
[ { "from": "system", "value": "Fix dependency to remove std print isr button\n" }, { "from": "human", "value": "# Copyright 2012-2016 Camptocamp SA\n# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).\n{'name': 'Switzerland - ISR inpayment slip (PVR/BVR/ESR)',\n 'summary': 'Print inpa...
python
chosen
[ { "from": "system", "value": "Change the project_tags parameter to use build_key which makes it clearer.\n" }, { "from": "human", "value": "from django.template.base import Library\nfrom django.core.urlresolvers import reverse\n\nfrom projects.models import ProjectBuild\n\n\nregister = Library()...
python
chosen
[ { "from": "system", "value": "Add DM support, and first start at self-update\n" }, { "from": "human", "value": "import discord\nimport asyncio\nimport os\nimport signal\nimport sys\n\n#Set up Client State\nCLIENT_TOKEN=os.environ['TOKEN']\n\n#Create Discord client\nclient = discord.Client()\n\n#...
python
chosen
[ { "from": "system", "value": "Add FileSender to top level\n" }, { "from": "human", "value": "# This relies on each of the submodules having an __all__ variable.\n\n__version__ = '0.22.0a0'\n\nimport multidict # noqa\n\nfrom multidict import * # noqa\nfrom . import hdrs # noqa\nfrom .protocol ...
python
chosen
[ { "from": "system", "value": "Fix problem with __all__ variable and update weave docs a bit. Update compiler_cxx too.\n" }, { "from": "human", "value": "\ndef configuration(parent_package='',top_path=None):\n from numpy.distutils.misc_util import Configuration\n config = Configuration('sc...
python
chosen
[ { "from": "system", "value": "Add the source of this solution" }, { "from": "human", "value": "import signal\nimport time\nimport multiprocessing\n\n\ndef handle_KeyboardInterrupt():\n signal.signal(signal.SIGINT, signal.SIG_IGN)\n\ndef doSomething(number):\n time.sleep(1)\n print \"rec...
python
chosen
[ { "from": "system", "value": "Add more details to routes\n" }, { "from": "human", "value": "from schematics.models import Model\nfrom schematics.types import StringType\n\nclass Step(Model):\n\t\"\"\"\n\t\tRepresents an individual step\n\t\"\"\"\n\thtml_instructions = StringType()\n\nclass Leg(M...
python
chosen
[ { "from": "system", "value": "Set optional class on map widget if class attribute passed\n" }, { "from": "human", "value": "from django.forms import widgets\nfrom django.utils.safestring import mark_safe\n\n\nclass MapWidget(widgets.HiddenInput):\n \"\"\"Custom map widget for displaying inter...
python
chosen
[ { "from": "system", "value": "Exit in voice webhook deletion example, if result is empty\n" }, { "from": "human", "value": "#!/usr/bin/env python\nimport argparse\nimport messagebird\nfrom messagebird.voice_webhook import VoiceCreateWebhookRequest\n\nparser = argparse.ArgumentParser()\nparser.ad...
python
chosen
[ { "from": "system", "value": "Raise an exception when DtraceTestCase (and subclasses) is used on non-darwin machines\n" }, { "from": "human", "value": "#!/usr/bin/env python\n# Copyright (C) 2015 Dmitry Rodionov\n# This file is part of my GSoC'15 project for Cuckoo Sandbox:\n#\thttp://www.cuckoo...
python
chosen
[ { "from": "system", "value": "Send a message back to client\n" }, { "from": "human", "value": "import webapp2\n\nfrom google.appengine.api import channel\nfrom google.appengine.api import users\n\nclass Channel(webapp2.RequestHandler):\n def get(self):\n user = users.get_current_user()...
python
chosen
[ { "from": "system", "value": "Use the sexy, new decorator style syntax." }, { "from": "human", "value": "from django import template\nfrom django.template.defaulttags import CommentNode\n\nregister = template.Library()\n\n\ndef commen5(parser, token):\n \"\"\"\n Ignores everything between ...
python
chosen
[ { "from": "system", "value": "Change license to Apache 2" }, { "from": "human", "value": "#!/usr/bin/env python\n\n# Copyright (C) 2004 British Broadcasting Corporation and Kamaelia Contributors(1)\n# All Rights Reserved.\n#\n# You may only modify and redistribute this under the terms of any...
python
chosen
[ { "from": "system", "value": "Update syntax path for new settings file command\n" }, { "from": "human", "value": "import sublime_plugin\n\nfrom .sublime_lib.path import root_at_packages, get_package_name\n\n\nPLUGIN_NAME = get_package_name()\n\nSETTINGS_SYNTAX = (\"Packages/%s/Package/Sublime Te...
python
chosen
[ { "from": "system", "value": "Use __name__ from data object to set the test method name, if available.\n\nAllows to provide user-friendly names for the user instead of\nthe default raw data formatting.\n" }, { "from": "human", "value": "from functools import wraps\n\n__version__ = '0.1.1'\n\nMAG...
python
chosen
[ { "from": "system", "value": "Add friend_groups to the ChatForm\n" }, { "from": "human", "value": "from django import forms\nfrom django.contrib.auth.models import User\n\nfrom chats.models import Chat\nfrom profiles.models import FriendGroup\n\n\nclass PublicChatForm(forms.ModelForm):\n \"\"...
python
chosen
[ { "from": "system", "value": "Add test for custom tick locations, no labels\n" }, { "from": "human", "value": "\"\"\"Plot to test ticker.FixedFormatter\"\"\"\n\nimport matplotlib.pyplot as plt\nimport numpy as np\nimport mpld3\n\n\ndef create_plot():\n positions, labels = [0, 1, 10], ['A','B'...
python
chosen
[ { "from": "system", "value": "Revise output vertex_distances_d to shortest_path_d\n" }, { "from": "human", "value": "from __future__ import absolute_import\nfrom __future__ import print_function\nfrom __future__ import division\n\nfrom ds_binary_heap_tuple import BinaryHeap\n\ndef dijkstra(weigh...
python
chosen
[ { "from": "system", "value": "Fix required_fields looking at wrong jsonify file.\n" }, { "from": "human", "value": "import flask\nfrom flask import request\nimport functools\n\nfrom etiquette import jsonify\n\n\ndef required_fields(fields, forbid_whitespace=False):\n '''\n Declare that the...
python
chosen
[ { "from": "system", "value": "Add import script for Portsmouth\n\nCloses #1502\n" }, { "from": "human", "value": "from django.contrib.gis.geos import Point\nfrom data_collection.management.commands import BaseXpressDemocracyClubCsvImporter\n\n\nclass Command(BaseXpressDemocracyClubCsvImporter):\...
python
chosen
[ { "from": "system", "value": "Mark comment as safe. Otherwise it is displayed." }, { "from": "human", "value": "from django import template\nfrom django.utils.safestring import mark_safe\n\nfrom favicon.models import Favicon, config\n\nregister = template.Library()\n\n\n@register.simple_tag(take...
python
chosen
[ { "from": "system", "value": "ENH: Set logging level to be noisier, from CRITICAL to INFO.\n" }, { "from": "human", "value": "import logging\nsession_mgr._logger.setLevel(logging.CRITICAL)\nfrom ophyd.userapi import *\n" }, { "from": "gpt", "value": "import logging\nsession_mgr._logg...
python
chosen
[ { "from": "system", "value": "Increment minor version for release.\n" }, { "from": "human", "value": "__version__ = '1.3.3'\n__author__ = 'Cameron Higby-Naquin'\n" }, { "from": "gpt", "value": "__version__ = '1.4.0'\n__author__ = 'Cameron Higby-Naquin'\n" } ]
python
chosen
[ { "from": "system", "value": "Fix autoremove in wrong place\n" }, { "from": "human", "value": "# -*- coding: utf-8 -*-\nfrom django.core.management.base import BaseCommand, CommandError\nfrom slacksync.membersync import SlackMemberSync\nfrom slacksync.utils import api_configured\n\n\nclass Comma...
python
chosen
[ { "from": "system", "value": "Update syncdb to also regenerate the index." }, { "from": "human", "value": "from django.db.models.signals import post_syncdb\nfrom django.conf import settings\nfrom django.core import management\n\nimport os\nimport re\n\nFIXTURE_RE = re.compile(r'^[^.]*.json$')\n\...
python
chosen
[ { "from": "system", "value": "Fix __version__ in Python API\n" }, { "from": "human", "value": "from openmc.arithmetic import *\nfrom openmc.cell import *\nfrom openmc.checkvalue import *\nfrom openmc.mesh import *\nfrom openmc.element import *\nfrom openmc.geometry import *\nfrom openmc.nuclide ...
python
chosen
[ { "from": "system", "value": "Make shuffle handle the host list size changing.\n" }, { "from": "human", "value": "import os\nimport random\n\n\ndef get_random_word(config):\n file_size = os.path.getsize(config.paths.wordlist)\n word = \"\"\n\n with open(config.paths.wordlist, \"r\") as ...
python
chosen
[ { "from": "system", "value": "Add support for nested structure, e.g. attachments.\n\n> The optional attachments argument should contain a JSON-encoded array of\n> attachments.\n>\n> https://api.slack.com/methods/chat.postMessage\n\nThis enables simpler calls like this:\n\n sc.api_call('chat.postMessage',...
python
chosen
[ { "from": "system", "value": "Add parameter 'validate' to TLS handler" }, { "from": "human", "value": "from __future__ import print_function\nfrom pygelf.tcp import GelfTcpHandler\nimport ssl\nimport socket\nimport sys\n\n\nclass GelfTlsHandler(GelfTcpHandler):\n\n def __init__(self, cert=Non...
python
chosen
[ { "from": "system", "value": "Add \\r at the end of Web socket\n" }, { "from": "human", "value": "import os\nimport socket\nimport websocket\n\nfrom . import IOHandler\n\n\ndef resolve_hostname(hostname, port):\n # We do our own mDNS resolution\n # to enforce we only search for IPV4 addres...
python
chosen
[ { "from": "system", "value": "Add filters to message recipient autocomplete.\n" }, { "from": "human", "value": "import json\nfrom django.contrib.auth import get_user_model\nfrom dajaxice.decorators import dajaxice_register\n\n\n@dajaxice_register(method=\"GET\")\ndef getuser(request, query):\n ...
python
chosen
[ { "from": "system", "value": "Add type annotations for globus\n\n" }, { "from": "human", "value": "from parsl.utils import RepresentationMixin\n\n\nclass GlobusScheme(RepresentationMixin):\n \"\"\"Specification for accessing data on a remote executor via Globus.\n\n Parameters\n -------...
python
chosen
[ { "from": "system", "value": "Fix timer in @bench to be reset for each benched function call\n" }, { "from": "human", "value": "from functools import wraps\nfrom inspect import getcallargs\n\nfrom timer import Timer\n\n\ndef bench(f):\n \"\"\"Times a function given specific arguments.\"\"\"\n...
python
chosen
[ { "from": "system", "value": "Add includer handler as well as content renderer\n" }, { "from": "human", "value": "import sass\n\n\ndef render_sass(raw_content):\n return sass.compile(string=raw_content)\n\n\ndef register(context, plugin_config):\n sass_extensions = ['sass', 'scss']\n co...
python
chosen
[ { "from": "system", "value": "Make sure that missing blog pages don't 500\n" }, { "from": "human", "value": "import os\n\nfrom django.views.generic import TemplateView\n\n\nclass ArticleView(TemplateView):\n\n def get_template_names(self):\n article_name = self.kwargs.get('article_name...
python
chosen
[ { "from": "human", "value": "Add Settings class to top level package namespace\n" }, { "from": "gpt", "value": "#!/usr/bin/env python\n\n\"\"\"\nCLIMATECONTROL controls your apps configuration environment. It is a Python\nlibrary for loading app configurations from files and/or namespaced enviro...
python
chosen
[ { "from": "system", "value": "Check container IDs when making new References\n" }, { "from": "human", "value": "\nfrom pyscriptic.containers import CONTAINERS\nfrom pyscriptic.storage import STORAGE_LOCATIONS\n\nclass Reference(object):\n \"\"\"\n Contains the information to either create ...
python
chosen
[ { "from": "system", "value": "Tweak travis-ci settings for haystack setup and test\n" }, { "from": "human", "value": "# This file is exec'd from settings.py, so it has access to and can\n# modify all the variables in settings.py.\n\n# If this file is changed in development, the development serve...
python
chosen
[ { "from": "system", "value": "Increase simulation time for linear trajectory\n\n" }, { "from": "human", "value": "#!/usr/bin/env python\nTRAJECTORY = 'linear'\n\nif TRAJECTORY == 'linear':\n SIMULATION_TIME_IN_SECONDS = 40.0\nelif TRAJECTORY == 'circular':\n SIMULATION_TIME_IN_SECONDS = 12...
python
chosen
[ { "from": "system", "value": "Update our container test case\n" }, { "from": "human", "value": "# This file is part of Moksha.\n# Copyright (C) 2008-2009 Red Hat, Inc.\n# \n# This program is free software: you can redistribute it and/or modify\n# it under the terms of the GNU Affero General Pub...
python
chosen
[ { "from": "system", "value": "Add error function to remove duplicate code\n" }, { "from": "human", "value": "\"\"\"\ngithub-setup-irc-notifications - Configure all repositories in an organization\nwith irc notifications\n\"\"\"\n\nimport argparse\nimport getpass\nimport sys\n\nimport github3\n\n...
python
chosen
[ { "from": "system", "value": "Add a name for the recipe section\n" }, { "from": "human", "value": "\"\"\"\nCopyright 2010 Jason Chu, Dusty Phillips, and Phil Schalm\n\nLicensed under the Apache License, Version 2.0 (the \"License\");\nyou may not use this file except in compliance with the Licen...
python
chosen
[ { "from": "system", "value": "Make slug unique and fix the max_length.\n" }, { "from": "human", "value": "from django.contrib.contenttypes.models import ContentType\nfrom django.contrib.contenttypes.generic import GenericForeignKey\nfrom django.db import models\nfrom django.template.defaultfilte...
python
chosen
[ { "from": "system", "value": "Add `--all` to graph command to show other branches (esp. origin)\n" }, { "from": "human", "value": "from sublime_plugin import WindowCommand, TextCommand\n\nfrom ..git_command import GitCommand\n\nLOG_GRAPH_TITLE = \"GRAPH\"\n\n\nclass GsLogGraphCommand(WindowComma...
python
chosen
[ { "from": "system", "value": "Use zip instead of tar.gz to obtain setuptools\n\nNewer releases of setuptools on pypi are only available as zip archives.\n\nIn order to support higher versions of setuptools, zip should be\npreferred over tar.gz. Otherwise, installing e.g. setuptools==40.0.0\nwill fail.\n" ...
python
chosen
[ { "from": "system", "value": "Remove limit for search field\n" }, { "from": "human", "value": "from django import forms\nfrom django.db.models import get_model\nfrom django.utils.translation import ugettext as _\n\nStoreAddress = get_model('stores', 'StoreAddress')\n\n\nclass StoreSearchForm(for...
python
chosen
[ { "from": "system", "value": "Add assertion for issue gh-1089\n" }, { "from": "human", "value": "import os\n\nfrom .. import run_nbgrader\nfrom .base import BaseTestApp\n\n\nclass TestNbGraderGenerateConfig(BaseTestApp):\n\n def test_help(self):\n \"\"\"Does the help display without er...
python
chosen
[ { "from": "system", "value": "Add the staging client id too.\n" }, { "from": "human", "value": "\"\"\"Configuration parameters.\n\nContains things such as the database to connect to.\n\"\"\"\n\nCLOUDSQL_INSTANCE = 'pmi-drc-api-test:us-central1:pmi-rdr'\nCLOUDSQL_SOCKET = '/cloudsql/' + CLOUDSQL_...
python
chosen
[ { "from": "system", "value": "Make ReusableMessageGroup broadcast the notify_about_to_send_message to all limiters\n" }, { "from": "human", "value": "from bot.logger.message_sender.message_builder import MessageBuilder\nfrom bot.logger.message_sender.reusable.limiter import ReusableMessageLimite...
python
chosen
[ { "from": "system", "value": "Remove isPrivate field on league form\n" }, { "from": "human", "value": "from django import forms\nfrom django.forms import Textarea\nfrom sh_app.models import User, SH_User, League, Suggestion\n\nclass UserForm(forms.ModelForm):\n password = forms.CharField(widg...
python
chosen
[ { "from": "system", "value": "Allow assert_routing to cope with Feed instances used as route endpoints" }, { "from": "human", "value": "from nose.tools import eq_, ok_\nfrom django.core.urlresolvers import resolve, reverse\n\ndef assert_routing(url, view_function, name = '', kwargs = {}):\n r...
python
chosen
[ { "from": "system", "value": "Clean up Python example for sms-conversation-tracking\n" }, { "from": "human", "value": "from flask import Flask, request, redirect, session\nimport twilio.twiml\n\n# The session object makes use of a secret key.\nSECRET_KEY = 'a secret key'\napp = Flask(__name__)\n...
python
chosen
[ { "from": "system", "value": "Edit spreadsheet is now fixed.\n" }, { "from": "human", "value": "import urllib.request\r\nfrom io import BytesIO\r\nimport pandas as pd\r\nimport ujson\r\nfrom elasticsearch import Elasticsearch\r\n\r\ncsv = urllib.request.urlopen(\"https://docs.google.com/spreadsh...
python
chosen
[ { "from": "system", "value": "Move towards a normal bin directory.\n" }, { "from": "human", "value": "from pypy.jit.codewriter.policy import JitPolicy\n\nfrom rupypy.main import entry_point\n\n\ndef target(driver, args):\n driver.exe_name = \"rupypy-c\"\n return entry_point, None\n\ndef ji...
python
chosen
[ { "from": "system", "value": "Clean up the AuthComplete API a little\n" }, { "from": "human", "value": "import logging\n\nfrom django.contrib import messages\nfrom django.http import HttpResponseRedirect, HttpResponse\nfrom django.views.generic.base import View\nfrom social_auth.exceptions impor...
python
chosen
[ { "from": "system", "value": "Add incremental parsing versions of parse and parse_tree\n" }, { "from": "human", "value": "from __future__ import unicode_literals\n\nfrom conllu.models import TokenList\nfrom conllu.parser import parse_token_and_metadata\n\n\ndef parse(data, fields=None):\n ret...
python
chosen
[ { "from": "system", "value": "Add Hello class and related classes for v0x04\n\nFix #302\nFix #303\n" }, { "from": "human", "value": "\"\"\"Defines Hello message.\"\"\"\n\n# System imports\n\n# Third-party imports\n\nfrom pyof.v0x01.symmetric.hello import Hello\n__all__ = ('Hello',)\n" }, { ...
python
chosen
[ { "from": "system", "value": "Make sure we only write chars to stdout\n" }, { "from": "human", "value": "import sys\nfrom datamodel.base import node\n\n\nclass ConsolePrinter(node.Node):\n \"\"\"\n This node prints on stdout its context and then returns it as output.\n \"\"\"\n\n def...
python
chosen
[ { "from": "system", "value": "NXDRIVE-808: Add RandomBug for Linux on test_synchronize_remote_copy\n" }, { "from": "human", "value": "from tests.common_unit_test import UnitTestCase\n\n\nclass TestCopy(UnitTestCase):\n\n def test_synchronize_remote_copy(self):\n local = self.local_clie...
python
chosen
[ { "from": "system", "value": "Change order migration, user runpython instead\n" }, { "from": "human", "value": "# Generated by Django 2.0.13 on 2020-04-23 12:55\n\nfrom django.db import migrations, models\nimport django.db.models.deletion\n\n\nclass Migration(migrations.Migration):\n\n depend...
python
chosen
[ { "from": "system", "value": "Return full path if it exists for OSF\n" }, { "from": "human", "value": "from waterbutler.core import metadata\n\nclass BaseOsfStorageMetadata:\n @property\n def provider(self):\n return 'osfstorage'\n\n\nclass OsfStorageFileMetadata(BaseOsfStorageMetad...
python
chosen
[ { "from": "system", "value": "Fix test generating graph file\n" }, { "from": "human", "value": "from jg.__main__ import main, generate_template_graph\nfrom mock import patch\n\n\nFIXTURE_GRAPH = (\n 'digraph {\\n'\n '\\t\"snippets/sub/analytics.html\"\\n'\n '\\t\"snippets/ga...
python
chosen
[ { "from": "system", "value": "Add the sort_priority2 for python2.\n" }, { "from": "human", "value": "# -*- coding: utf-8 -*-\n\ndef sort_priority(num,pro):\n res=num[:]\n def helper(x):\n if x in pro:\n return (0,x)\n return (1,x)\n res.sort(key=helper)\n return res\n\ndef sort_pr...
python
chosen
[ { "from": "system", "value": "Add logger name to log output\n" }, { "from": "human", "value": "CONSOLE_LOG_FORMAT = u'%(levelname)-8s %(asctime)s\\n %(message)s'\nMPD_LINE_ENCODING = u'utf-8'\nMPD_LINE_TERMINATOR = u'\\n'\nMPD_SERVER_HOSTNAME = u'localhost'\nMPD_SERVER_PORT = 6600\n" }, { ...
python
chosen
[ { "from": "system", "value": "Change split file lines by line\n" }, { "from": "human", "value": "# -*- coding: utf-8 -*-\n\n#\n# Copyright (C) 2015-2016 Rodrigo Ramírez Norambuena <a@rodrigoramirez.com>\n#\n# Parse queue_log Asterisk file and add records into database.\n#\n\nfrom libs.qpanel imp...
python
chosen
[ { "from": "system", "value": "Add test for empty responses\n" }, { "from": "human", "value": "import unittest\nfrom testbase import MQWebTest\n\n'''\nTest for AuthenticationInformationController\n'''\nclass TestAuthInfoActions(MQWebTest):\n\n\t'''\n\tTest Inquire with HTTP GET\n\t'''\n\tdef test...
python
chosen
[ { "from": "system", "value": "Remove places default config. It doesn't appear to be used anywhere.\n" }, { "from": "human", "value": "# vim:ts=4:sw=4:noexpandtab\n\nimport socket\nimport logging as _logging\n\nfrom .dictlib import ConfigDict\n\nconfig = ConfigDict(\n\tbot_nickname='pmxbot',\n\td...
python
chosen
[ { "from": "system", "value": "Create the tests output directory automatically.\n" }, { "from": "human", "value": "from lettuce import world\nimport os\n\"\"\"\nSet world.basedir relative to this terrain.py file,\nwhen running lettuce from this directory,\nand add the directory it to the import p...
python
chosen
[ { "from": "system", "value": "Move hasher creation to constructor\n" }, { "from": "human", "value": "from hashids import Hashids\n\n\nclass Shortener(object):\n\n def __init__(self, secret, min_length, short_url_domain):\n self.secret = secret\n self.min_length = min_length\n ...
python
chosen
[ { "from": "system", "value": "Fix plug-in type and description key\n\n't Was a typo.\n\nContributes to issue CURA-1190.\n" }, { "from": "human", "value": "# Copyright (c) 2015 Ultimaker B.V.\n# Uranium is released under the terms of the AGPLv3 or higher.\n\nfrom . import SimpleView\n\nfrom UM.i1...
python
chosen
[ { "from": "system", "value": "Add note about potential work around\n\nThe bot itself cannot send a message only on presence_change actions\nWe may be able to contact the slack bot to send a message in our stead instead.\n" }, { "from": "human", "value": "from __future__ import unicode_literals\n...
python
chosen
[ { "from": "system", "value": "Add another solution for 496 next greater element\n" }, { "from": "human", "value": "class Solution(object):\n def nextGreaterElement(self, findNums, nums):\n \"\"\"\n :type findNums: List[int]\n :type nums: List[int]\n :rtype: List[in...
python
chosen
[ { "from": "system", "value": "Rename template_name @config arg to template\n" }, { "from": "human", "value": "from tangled.web import Resource, config\n\nfrom tangled.site.resources.entry import Entry\n\n\nclass Docs(Entry):\n\n @config('text/html', template_name='tangled.website:templates/do...
python
chosen
[ { "from": "system", "value": "Allow stream ids != 1 in frame factory.\n" }, { "from": "human", "value": "# -*- coding: utf-8 -*-\n\"\"\"\nhelpers\n~~~~~~~\n\nThis module contains helpers for the h2 tests.\n\"\"\"\nfrom hyperframe.frame import HeadersFrame, DataFrame\nfrom hpack.hpack import Enco...
python
chosen
[ { "from": "system", "value": "Add test for incorrect check properties\n" }, { "from": "human", "value": "from scoring_engine.engine.basic_check import BasicCheck\nfrom scoring_engine.models.service import Service\nfrom scoring_engine.models.environment import Environment\nfrom scoring_engine.mod...
python
chosen
[ { "from": "system", "value": "Use GLAMkit settings in default project template.\n" }, { "from": "human", "value": "# Do not commit secrets to VCS.\n\n# Local environment variables will be loaded from `.env.local`.\n# Additional environment variables will be loaded from `.env.$DOTENV`.\n# Local s...
python
chosen
[ { "from": "system", "value": "Delete blank line at end of file\n" }, { "from": "human", "value": "# Copyright (c) 2012-2013, Itzik Kotler\n# All rights reserved.\n#\n# Redistribution and use in source and binary forms, with or without\n# modification, are permitted provided that the following co...
python
chosen
[ { "from": "system", "value": "Fix pyqode main docstring (uniformised with other pyqode namespace packages)\n" }, { "from": "human", "value": "# -*- coding: utf-8 -*-\n\"\"\"\npyQode is a code editor framework for python qt applications.\n\"\"\"\nimport pkg_resources\npkg_resources.declare_namesp...
python
chosen
[ { "from": "system", "value": "Add User back into admin\n" }, { "from": "human", "value": "from django.contrib.admin.sites import AdminSite\nfrom django.conf.urls.defaults import patterns, url\n\nfrom shells.admin_views import ShellsImagesUploader, upload_species_spreadsheet\n\n\nclass ShellsAdmi...
python
chosen
[ { "from": "system", "value": "Remove unsupport M2M field in channelAdmin handler. Removes traceback when DEBUG=True.\n" }, { "from": "human", "value": "#\n# This sets up how models are displayed\n# in the web admin interface.\n#\n\nfrom django.contrib import admin\nfrom src.comms.models import C...
python
chosen
[ { "from": "system", "value": "Add user registration URLs. Use what django-registration provides for the moment.\n" }, { "from": "human", "value": "from django.conf.urls.defaults import *\n\n# Uncomment the next two lines to enable the admin:\nfrom django.contrib import admin\nadmin.autodiscover(...
python
chosen