conversations
listlengths
2
3
source
stringclasses
1 value
stack
stringclasses
1 value
[ { "from": "system", "value": "Make sure email_access_validated_at is not null after being populated\n" }, { "from": "human", "value": "\"\"\"\n\nRevision ID: 0313_email_access_validated_at\nRevises: 0312_populate_returned_letters\nCreate Date: 2020-01-28 18:03:22.237386\n\n\"\"\"\nfrom alembic i...
python
chosen
[ { "from": "system", "value": "Set default for get_config to None." }, { "from": "human", "value": "from django.shortcuts import _get_queryset\nfrom django.conf import settings\n\n\ndef get_object_or_None(klass, *args, **kwargs):\n \"\"\"\n Uses get() to return an object or None if the obje...
python
chosen
[ { "from": "system", "value": "Remove unused import and redundant comment\n" }, { "from": "human", "value": "\"\"\"\nNOTE: this API is WIP and has not yet been approved. Do not use this API\nwithout talking to Christina or Andy.\n\nFor more information, see:\nhttps://openedx.atlassian.net/wiki/di...
python
chosen
[ { "from": "system", "value": "Fix bug where the service was added as a destination one time too many.\n" }, { "from": "human", "value": "\"\"\"\nOutput an Eliot message to a log file using the threaded log writer.\n\"\"\"\nfrom __future__ import unicode_literals, print_function\n\nfrom twisted.i...
python
chosen
[ { "from": "system", "value": "Add provisional (needs to be replaced with pkg_resources entry point discovery) template registry\n" }, { "from": "human", "value": "# -*- coding: utf-8 -*-\n'''\nCopyright 2014 Universitatea de Vest din Timișoara\n\nLicensed under the Apache License, Version 2.0 (t...
python
chosen
[ { "from": "system", "value": "Add base logic for finding Give Forward campaigns by query that are almost funded\n" }, { "from": "human", "value": "import requests\nimport json\n\n\nclass KickstarterScraper(object):\n # TODO: get list of all categories from projects for rendering possible list...
python
chosen
[ { "from": "system", "value": "Switch skeleton API to use flask-restful\n" }, { "from": "human", "value": "from flask import Flask\napp = Flask(__name__)\n\nVERSION_PREFIX=\"/api/v1\"\n\n@app.route(VERSION_PREFIX + \"/handovers\")\ndef handovers():\n return \"handovers\\n\"\n\n@app.route(VERSION...
python
chosen
[ { "from": "system", "value": "Resolve old Django 1.1 bug in URLs to keep it DRY.\n" }, { "from": "human", "value": "from django.conf.urls.defaults import *\n\nurlpatterns = patterns('django.contrib.auth.views',\n url(r'^login/', 'login', name='login'),\n url(r'^logout/', 'logout', {'next_p...
python
chosen
[ { "from": "system", "value": "Update \"Girls With Slingshots\" after feed change\n" }, { "from": "human", "value": "from comics.aggregator.crawler import CrawlerBase, CrawlerImage\nfrom comics.core.comic_data import ComicDataBase\n\n\nclass ComicData(ComicDataBase):\n name = \"Girls With Slin...
python
chosen
[ { "from": "system", "value": "Update VERSION to 0.12.5 final" }, { "from": "human", "value": "\"\"\"\nCAUTION! Keep everything here at at minimum. Do not import stuff.\nThis module is imported in setup.py, so you cannot for instance\nimport a dependency.\n\"\"\"\nfrom __future__ import absolute_...
python
chosen
[ { "from": "system", "value": "Fix typo from bad conflict resolution during merge\n" }, { "from": "human", "value": "import core\nfrom girder_worker.utils import JobStatus\nfrom .app import app\n\n\ndef _cleanup(*args, **kwargs):\n core.events.trigger('cleanup')\n\n\n@app.task(name='girder_wor...
python
chosen
[ { "from": "system", "value": "Add missing parser argument to BeautifulSoup instance\n" }, { "from": "human", "value": "#!/usr/bin/env python\n# -*- coding: utf-8 -*-\nfrom __future__ import absolute_import\nfrom __future__ import division\nfrom __future__ import print_function\nfrom __future__ i...
python
chosen
[ { "from": "system", "value": "Add special character name test case\n" }, { "from": "human", "value": "import unittest\n\nfrom tailor.utils import charformat\n\nclass MyTestCase(unittest.TestCase):\n\n def is_upper_camel_case_test_upper_camel_case_name(self):\n self.assertTrue(charforma...
python
chosen
[ { "from": "system", "value": "Fix missing username in test\n" }, { "from": "human", "value": "import pytest\nimport os\nimport rememberberry\nfrom rememberscript import RememberMachine, FileStorage\nfrom rememberberry.testing import tmp_data_path, assert_replies, get_isolated_story\n\n@pytest.ma...
python
chosen
[ { "from": "system", "value": "Remove print in unit test\n" }, { "from": "human", "value": "import unittest\n\nimport datetime\n\nfrom garage.timezones import TimeZone\n\n\nclass TimeZoneTest(unittest.TestCase):\n\n def test_time_zone(self):\n utc = datetime.datetime(2000, 1, 2, 3, 4, 0...
python
chosen
[ { "from": "system", "value": "Set CHROME_BIN on DDC bot\n\nNoticed the Linux bot is failing on this:\n\nhttps://build.chromium.org/p/client.dart.fyi/builders/ddc-linux-release-be/builds/1724/steps/ddc%20tests/logs/stdio\n\nR=whesse@google.com\n\nReview-Url: https://codereview.chromium.org/2640093002 .\n" ...
python
chosen
[ { "from": "system", "value": "Use open mode syntax on example file\n" }, { "from": "human", "value": "from __future__ import print_function\nimport os\nimport glob\nimport pyingest.parsers.aps as aps\nimport pyingest.parsers.arxiv as arxiv\nimport pyingest.serializers.classic\nimport traceback\n...
python
chosen
[ { "from": "human", "value": "Set up basic structure of code\n" }, { "from": "gpt", "value": "def heap_sort(arr):\n\t\"\"\" Heapsort\n\t\tComplexity: O(n log(n))\n\t\"\"\"\n\tpass\n\ndef heapify(arr):\n\tpass\n\narray = [1,5,65,23,57,1232,-1,-5,-2,242,100,4,423,2,564,9,0,10,43,64]\nprint(array)\n...
python
chosen
[ { "from": "system", "value": "Fix a crash if there is no ~/.python/rc.py\n" }, { "from": "human", "value": "import vx\n\nimport math\nimport os\nimport sys\n\n_tick_functions = []\ndef _register_tick_function(f, front=False):\n if front:\n _tick_functions.insert(0, f)\n else:\n ...
python
chosen
[ { "from": "system", "value": "Add a rudimentary quantile factory function.\n" }, { "from": "human", "value": "# encoding: utf-8\n\n# included for ease of use with Python 2 (which has no statistics package)\n\ndef mean(values):\n return float(sum(values)) / len(values)\n\ndef median(values):\n...
python
chosen
[ { "from": "system", "value": "Fix octopus.run for new events model.\n" }, { "from": "human", "value": "\n__version__ = \"trunk\"\n\ndef run (runnable, logging = True):\n\tfrom twisted.internet import reactor\n\n\tif reactor.running:\n\t\treturn runnable.run()\n\n\telse:\n\t\tdef _complete (resul...
python
chosen
[ { "from": "system", "value": "Use python import lib (django import lib will be removed in 1.9).\n" }, { "from": "human", "value": "\"\"\"\ngargoyle\n~~~~~~~~\n\n:copyright: (c) 2010 DISQUS.\n:license: Apache License 2.0, see LICENSE for more details.\n\"\"\"\n\n__all__ = ('gargoyle', 'ConditionS...
python
chosen
[ { "from": "system", "value": "Update i18n domain to correct project name\n\nThe current oslo_i18n domain name is listed as oslo.versionedobjects\n\nChange-Id: I493b66efbd83fb7704fe927866a24b765feb1576\n" }, { "from": "human", "value": "# Licensed under the Apache License, Version 2.0 (the \"L...
python
chosen
[ { "from": "system", "value": "Use module namespaces to distinguish names instead of 'original_' prefix\n" }, { "from": "human", "value": "\"\"\"Specific support for getpass.\"\"\"\nimport os\nimport getpass\n\nfrom keyring.core import get_password as original_get_password\n\ndef get_password(pro...
python
chosen
[ { "from": "system", "value": "Fix the displayed error message in V2 API\n\nChange-Id: I07c3f1ed79fa507dbe9b76eb8f5964475516754c\n" }, { "from": "human", "value": "# Copyright 2014 Hewlett-Packard Development Company, L.P.\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\");...
python
chosen
[ { "from": "system", "value": "Change default example for allowed hosts\n" }, { "from": "human", "value": "# Fill in this file and save as settings_local.py\n\nPROJECT_NAME = 'SuperTuxKart'\nPROJECT_URL = 'http://supertuxkart.net/'\n\n# SECURITY WARNING: don't run with debug turned on in producti...
python
chosen
[ { "from": "system", "value": "Add tests for website plugin\n" }, { "from": "human", "value": "import re\n\nfrom smartbot import utils\n\n\nclass Plugin:\n def on_message(self, bot, msg, reply):\n match = re.findall(r\"(https?://[^\\s]+)\", msg[\"message\"], re.IGNORECASE)\n for ...
python
chosen
[ { "from": "system", "value": "Use flask.__version__ instead of pkg_resources.\n\nThis is a simpler way of getting the Flask version.\n" }, { "from": "human", "value": "import pkg_resources\n\nfrom flask_debugtoolbar.panels import DebugPanel\n\n_ = lambda x: x\n\nflask_version = pkg_resources.get...
python
chosen
[ { "from": "system", "value": "Remove redundant case from padding test\n" }, { "from": "human", "value": "import unittest\nimport numpy as np\n\nclass CalculationMethodsTestCase(unittest.TestCase):\n def setUp(self):\n self.dem = DEMGrid()\n\n def test_calculate_slope(self):\n ...
python
chosen
[ { "from": "system", "value": "Use DataRequired to validate form\n" }, { "from": "human", "value": "from flask_wtf import FlaskForm\nfrom wtforms import StringField, PasswordField\nfrom wtforms.validators import Required, Length, Email\n\n\nclass SignupForm(FlaskForm):\n \"\"\"Render and valid...
python
chosen
[ { "from": "system", "value": "Replace ad-hoc pain with builtin methods\n" }, { "from": "human", "value": "import unittest\n\n\nclass DataDrivenTestCase(unittest.TestCase):\n cases = []\n\n @classmethod\n def generateCases(cls):\n return cls.cases\n\n @classmethod\n def load...
python
chosen
[ { "from": "system", "value": "Add current project path to the first position of sys.modules\n" }, { "from": "human", "value": "#!/usr/bin/env python\n# -*- coding: utf-8 -*-\n#\n# Copyright 2012 Zhang ZY<http://idupx.blogspot.com/> \n#\n# Licensed under the Apache License, Version 2.0 (the \"Lic...
python
chosen
[ { "from": "system", "value": "Make sure exit code is used in -E situation\n" }, { "from": "human", "value": "import sys\nimport os\n\ndef run():\n base = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))\n ## FIXME: this is kind of crude; if we could create a fake pip\n ## mod...
python
chosen
[ { "from": "system", "value": "Update head revision to 0.9.9\n\ngit-svn-id: 77a43f9646713b91fea7788fad5dfbf67e151ece@2524 94b884b6-d6fd-0310-90d3-974f1d3f35e1\n" }, { "from": "human", "value": "version='0.9.7'\n\nimport os\nsvn_version_file = os.path.join(os.path.dirname(__file__),\n ...
python
chosen
[ { "from": "system", "value": "Use `glob.glob` instead of `os.walk`\n" }, { "from": "human", "value": "# -*- coding: utf-8 -*-\n'''\n Detect SSDs\n'''\nimport os\nimport salt.utils\nimport logging\n\nlog = logging.getLogger(__name__)\n\ndef ssds():\n '''\n Return list of disk devices tha...
python
chosen
[ { "from": "system", "value": "Add support for manual journals\n" }, { "from": "human", "value": "from .manager import Manager\n\n\nclass Xero(object):\n \"\"\"An ORM-like interface to the Xero API\"\"\"\n\n OBJECT_LIST = (u'Contacts', u'Accounts', u'CreditNotes',\n u'Curr...
python
chosen
[ { "from": "system", "value": "Add absolute URLs to form and question admin\n" }, { "from": "human", "value": "#!/usr/bin/python\n# -*- coding: utf-8 -*-\n\nfrom django.utils.translation import ugettext as _\nfrom django.db import models\n\n\nclass Form(models.Model):\n title = models.CharFiel...
python
chosen
[ { "from": "system", "value": "Fix python siphashing to match c implementation\n\nSigned-off-by: Jan Losinski <577c4104c61edf9f052c616c0c23e67bef4a9955@wh2.tu-dresden.de>\n" }, { "from": "human", "value": "import serial\nimport struct\nfrom siphashc import siphash\n\ndef _hash(key: str, sender: i...
python
chosen
[ { "from": "system", "value": "Add a pytest hook for creating the coverage data_file directory\n" }, { "from": "human", "value": "from .fixtures import * # noqa\n\n\ndef pytest_addoption(parser):\n group = parser.getgroup('girder')\n group.addoption('--mock-db', action='store_true', defaul...
python
chosen
[ { "from": "system", "value": "Drop Python 2 support in split_level utility function\n" }, { "from": "human", "value": "try:\n # Python 3\n from collections.abc import Iterable\n string_types = (str,)\nexcept ImportError:\n # Python 2\n from collections import Iterable\n string_...
python
chosen
[ { "from": "system", "value": "Update version 1.0.0.dev3 -> 1.0.0.dev4" }, { "from": "human", "value": "__version__ = '1.0.0.dev3'\n__author__ = 'D-Wave Systems Inc.'\n__authoremail__ = 'acondello@dwavesys.com'\n__description__ = 'A shared API for binary quadratic model samplers.'\n" }, { ...
python
chosen
[ { "from": "system", "value": "Add a cookie based authentication source\n" }, { "from": "human", "value": "from zope.interface import implementer\n\nfrom .interfaces (\n IAuthSourceService,\n )\n\n@implementer(IAuthSourceService)\nclass SessionAuthSource(object):\n \"\"\" An auth...
python
chosen
[ { "from": "system", "value": "Add created and modified fields to Receipt\n" }, { "from": "human", "value": "from django.contrib.auth.models import User\nfrom django.db import models\nfrom django.db.models import fields\n\n\nclass Receipt(models.Model):\n title = fields.CharField(max_length=25...
python
chosen
[ { "from": "system", "value": "ENH: Add missing egun.bias in init\n" }, { "from": "human", "value": "from .dcct import DCCT\nfrom .li_llrf import LiLLRF\nfrom .rf import RF\nfrom .sofb import SOFB\nfrom .kicker import Kicker\nfrom .septum import Septum\nfrom .screen import Screen\nfrom .bpm impor...
python
chosen
[ { "from": "system", "value": "Add wrapper methods for clarity.\n" }, { "from": "human", "value": "from ._abstract import AbstractScraper\n\n\nclass WholeFoods(AbstractScraper):\n @classmethod\n def host(self, domain=\"com\"):\n return f\"www.wholefoodsmarket.{domain}\"\n" }, { ...
python
chosen
[ { "from": "system", "value": "Fix privileges of package frontend.\n" }, { "from": "human", "value": "# coding=utf-8\n\n\"\"\"\nDCRM - Darwin Cydia Repository Manager\nCopyright (C) 2017 WU Zheng <i.82@me.com> & 0xJacky <jacky-943572677@qq.com>\n\nThis program is free software: you can redistrib...
python
chosen
[ { "from": "system", "value": "Add RSS Feed Provider docs\n" }, { "from": "human", "value": "from datetime import datetime\nimport feedparser\nimport time\n\nfrom newswall.providers.base import ProviderBase\n\n\nclass Provider(ProviderBase):\n def update(self):\n feed = feedparser.parse...
python
chosen
[ { "from": "system", "value": "ENH: Add benchmark tests for numpy.random.randint.\n\nThis add benchmarks randint. There is one set of benchmarks for the\ndefault dtype, 'l', that can be tracked back, and another set for the\nnew dtypes 'bool', 'uint8', 'uint16', 'uint32', and 'uint64'.\n" }, { "from"...
python
chosen
[ { "from": "system", "value": "Update serializer to deal with new model\n" }, { "from": "human", "value": "from rest_framework.serializers import ModelSerializer\nfrom .models import CountInstance\n\n\nclass CountInstanceSerializer(ModelSerializer):\n class Meta:\n model = CountInstance...
python
chosen
[ { "from": "system", "value": "Update develop version to 0.36.0\n\nSigned-off-by: Uilian Ries <d4bad57018205bdda203549c36d3feb0bfe416a7@gmail.com>\n" }, { "from": "human", "value": "\n__version__ = '0.35.0-dev'\n\n\ndef get_client_version():\n from conans.model.version import Version\n from...
python
chosen
[ { "from": "system", "value": "Change url from relative to internal service endpoint\n" }, { "from": "human", "value": "import json\nfrom datetime import datetime\n\nimport requests\n\nfrom .model.puzzleboard import pop_puzzleboard\n\n\nclass HuntwordsPuzzleBoardPopCommand(object):\n '''Comman...
python
chosen
[ { "from": "system", "value": "Test image definition in SADL\n" }, { "from": "human", "value": "# TOOL test-data-in-out.py: \"Test data input and output in Python\" (Data input output test.) \n# INPUT input TYPE GENERIC\n# OUTPUT output\n# OUTPUT OPTIONAL missing_output.txt\n\nimport shutil\n\nsh...
python
chosen
[ { "from": "system", "value": "Stop using the extra field for Colombia\n\nAfter discussion, this is not something we will have in Ideascube.\n\nFixes #609\n" }, { "from": "human", "value": "\"\"\"Configuration for Llave Del Saber, Colombia\"\"\"\nfrom .idb import * # noqa\nfrom django.utils.tran...
python
chosen
[ { "from": "system", "value": "Fix issue in cloudwacth service credentials\n" }, { "from": "human", "value": "'''\n===================================\nBoto 3 - CloudWatch Service Example\n===================================\nThis application implements the CloudWatch service that lets you gets\n...
python
chosen
[ { "from": "system", "value": "Update repo entrypoint and remote_update stub.\n" }, { "from": "human", "value": "\"\"\"\nProblem repository management for the shell manager.\n\"\"\"\n\nimport spur, gzip\n\nfrom shutil import copy2\nfrom os.path import join\n\ndef local_update(repo_path, deb_paths...
python
chosen
[ { "from": "system", "value": "Add word_count parameter for lorem_ipsum generator\n" }, { "from": "human", "value": "# coding: utf-8\nimport string\nimport random\n\ndef generate_string(str_len=6, src=string.ascii_lowercase):\n return \"\".join(random.choice(src) for x in xrange(str_len))\n\nd...
python
chosen
[ { "from": "system", "value": "Add rename branch locally test\n" }, { "from": "human", "value": "from __future__ import print_function, division, absolute_import\n\nimport unittest\nimport gitnl\n\n\nclass GitnlTestCase(unittest.TestCase):\n \"\"\"Tests from 'gitnl.py'.\"\"\"\n\n def test_p...
python
chosen
[ { "from": "system", "value": "Allow tests to be run with Python <2.6.\n" }, { "from": "human", "value": "# -*- coding: latin-1 -*-\nimport unittest\n\nfrom github2.issues import Issue\nfrom github2.client import Github\n\n\nclass ReprTests(unittest.TestCase):\n \"\"\"__repr__ must return stri...
python
chosen
[ { "from": "system", "value": "Revert \"Adding request context for proper url generation.\"\n\nThis reverts commit 3fa12f6b36f7d1d0dd23cf28e79b7c54f1589fbc.\n" }, { "from": "human", "value": "from todo import app\n\nfrom flask import jsonify, request, url_for\nfrom flask import json\n\nfrom todo....
python
chosen
[ { "from": "system", "value": "Add comment to explain the length of the scripts taken into account in DuplicateScripts\n" }, { "from": "human", "value": "\"\"\"This module provides plugins for basic duplicate code detection.\"\"\"\n\nfrom hairball.plugins import HairballPlugin\n\nclass DuplicateS...
python
chosen
[ { "from": "system", "value": "Fix bug of invoking /bin/sh on several OSs\n" }, { "from": "human", "value": "# Copyright (c) 2017, MIT Licensed, Medicine Yeh\n\n# This file helps to read settings from bash script into os.environ\n\nimport os\nimport sys\nimport subprocess\n\n# This path is the lo...
python
chosen
[ { "from": "system", "value": "Update goodreads API to `show original_publication_year`\n" }, { "from": "human", "value": "#!/usr/bin/env python\n\nimport re\nfrom xml.parsers.expat import ExpatError\n\nimport requests\nimport xmltodict\n\nfrom settings import goodreads_api_key\n\n\ndef get_goodr...
python
chosen
[ { "from": "system", "value": "Exit method.\n- (New) Added exit method.\n" }, { "from": "human", "value": "# PMUtil.py\n# Phenotype microarray utility functions\n#\n# Author: Daniel A Cuevas\n# Created on 27 Jan. 2015\n# Updated on 27 Jan. 2015\n\nfrom __future__ import absolute_import, division,...
python
chosen
[ { "from": "system", "value": "Add Publications class to initialisation\n" }, { "from": "human", "value": "__all__ = [\n \"gtr.services.funds.Funds\",\n \"gtr.services.organisations.Organisations\",\n \"gtr.services.persons.Persons\",\n \"gtr.services.projects.Projects\"\n]\n__version...
python
chosen
[ { "from": "system", "value": "Change authenticate_credentials method to raise an exception if the account is disabled\n" }, { "from": "human", "value": "from django.conf import settings\nfrom rest_framework_jwt.authentication import JSONWebTokenAuthentication\nfrom rest_framework_jwt.settings im...
python
chosen
[ { "from": "system", "value": "Add more search fields to autocomplete\n" }, { "from": "human", "value": "import autocomplete_light\nfrom .models import Company\n\n\nclass CompanyAutocomplete(autocomplete_light.AutocompleteModelBase):\n search_fields = ['^name']\n model = Company\nautocomple...
python
chosen
[ { "from": "system", "value": "Remove add_view and add form for the hole admin\n" }, { "from": "human", "value": "# -*- coding: utf-8 -*-\nfrom __future__ import absolute_import, unicode_literals\nfrom django_services import admin\nfrom ..models import Maintenance\nfrom ..service.maintenance impo...
python
chosen
[ { "from": "system", "value": "InstallCommand: Use get_minion_path to get default dir.\n" }, { "from": "human", "value": "#!/usr/bin/env python\n# -*- coding: utf-8 -*-\n\nfrom optparse import make_option\nfrom optparse import OptionParser\nfrom scaffolder.core.template import TemplateManager\nfr...
python
chosen
[ { "from": "system", "value": "Fix update remote to ConanCenter and grpc to highest buildable/supported version\n" }, { "from": "human", "value": "from conans import ConanFile, CMake\n\nclass GrpccbConan(ConanFile):\n name = \"grpc_cb_core\"\n version = \"0.2\"\n license = \"Apache-2.0\"...
python
chosen
[ { "from": "system", "value": "conan: Make cmake-unit, cmake-linter-cmake and style-linter-cmake normal deps\n" }, { "from": "human", "value": "from conans import ConanFile\nfrom conans.tools import download, unzip\nimport os\n\nVERSION = \"0.0.7\"\n\n\nclass CMakeModuleCommonConan(ConanFile):\n ...
python
chosen
[ { "from": "system", "value": "Update for PYTHON 985: MongoClient properties now block until connected.\n" }, { "from": "human", "value": "# Copyright 2015 MongoDB, Inc.\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may not use this file except in compliance with ...
python
chosen
[ { "from": "system", "value": "Remove sdbus++ template search workaround\n\nsdbus++ was fixed upstream to find its templates automatically.\n\nChange-Id: I29020b9d1ea4ae8baaca5fe869625a3d96cd6eaf\nSigned-off-by: Brad Bishop <713d098c0be4c8fd2bf36a94cd08699466677ecd@fuzziesquirrel.com>\n" }, { "from":...
python
chosen
[ { "from": "system", "value": "Implement saving and loading the observer tau\n" }, { "from": "human", "value": "# -*- coding: utf-8 -*-\nimport halospectra as hs\nimport randspectra as rs\nimport sys\n\nsnapnum=sys.argv[1]\nsim=sys.argv[2]\n#base=\"/n/hernquistfs1/mvogelsberger/projects/GFM/Produ...
python
chosen
[ { "from": "system", "value": "Drop dashes from download urls.\n" }, { "from": "human", "value": "from uuid import UUID\n\nfrom werkzeug.routing import BaseConverter\n\n\nclass UUIDConverter(BaseConverter):\n to_python = UUID\n to_url = str\n" }, { "from": "gpt", "value": "from ...
python
chosen
[ { "from": "system", "value": "Fix building tar in deployment\n" }, { "from": "human", "value": "#! /usr/bin/python\nimport os\nimport subprocess\n\nroot_dir = os.path.abspath(os.path.join(os.path.dirname(__file__), \"..\"))\ntarfile = os.path.join(root_dir, \"src_pkg.tar\")\n\ndef _is_dir_newer(...
python
chosen
[ { "from": "system", "value": "Refactor Largest Palindrome Product for range of n is [1,8]\n" }, { "from": "human", "value": "# Find the largest palindrome made from the product of two n-digit numbers.\n\n# Since the result could be very large, you should return the largest palindrome mod 1337.\n...
python
chosen
[ { "from": "system", "value": "fedimg: Fix the script function args\n\nSigned-off-by: Sayan Chowdhury <5f0367a2b3b757615b57f51d912cf16f2c0ad827@gmail.com>\n" }, { "from": "human", "value": "#!/bin/env python\n# -*- coding: utf8 -*-\n\"\"\" Triggers an upload process with the specified raw.xz URL....
python
chosen
[ { "from": "system", "value": "Add wrapper for initscr() to copy the ACS_ and LINES,COLS bindings\n" }, { "from": "human", "value": "\"\"\"curses\n\nThe main package for curses support for Python. Normally used by importing\nthe package, and perhaps a particular module inside it.\n\n import cu...
python
chosen
[ { "from": "system", "value": "Fix numpy related errors on Mavericks.\n\nThe problem was due to the fact that operations (like sqrt) can return a\nfloat16 arrays which cannot be passed back to VTK directly. Added a\ntemporary conversion to float64. We should potentially handle this in\nVTK.\n" }, { "...
python
chosen
[ { "from": "system", "value": "Make the server example listen on 0.0.0.0 by default." }, { "from": "human", "value": "import argparse\nimport math\n\nfrom pythonosc import dispatcher\nfrom pythonosc import osc_server\n\ndef print_volume_handler(args, volume):\n print(\"[{0}] ~ {1}\".format(args[...
python
chosen
[ { "from": "system", "value": "Revert back to original settings for Celery Broker\n" }, { "from": "human", "value": "# -*- coding: utf-8 -*-\nfrom __future__ import absolute_import, unicode_literals\n\nimport os\n\nfrom .common import * # noqa\n\nDEBUG = True\nTEMPLATE_DEBUG = DEBUG\n\nDATABASES...
python
chosen
[ { "from": "system", "value": "Set a custom JSON Encoder to serialize date class.\n" }, { "from": "human", "value": "import flask\nimport json\n\nfrom datetime import datetime\nfrom apscheduler.job import Job\nfrom .utils import job_to_dict\n\n\nclass JSONEncoder(json.JSONEncoder):\n def defau...
python
chosen
[ { "from": "system", "value": "Support older versions of MongoEngine\n" }, { "from": "human", "value": "from flask.json import JSONEncoder\nfrom bson import json_util\nfrom mongoengine.base import BaseDocument\nfrom mongoengine import QuerySet\n\n\ndef _make_encoder(superclass):\n class MongoE...
python
chosen
[ { "from": "system", "value": "Use current user as email author\n" }, { "from": "human", "value": "from marrow.mailer import Mailer as MarrowMailer\nfrom message import Message\n\nimport sys\n\n\nclass Mailer:\n\n MAILER = MarrowMailer(dict(manager=dict(use='immediate'), transport=dict(use='send...
python
chosen
[ { "from": "system", "value": ": Create documentation of DataSource Settings \n\nTask-Url: " }, { "from": "human", "value": "######\n# Check ExId (GUID) by Email through JDBC\n#\n# Author: Christoph Stoettner\n# Mail: christoph.stoettner@stoeps.de\n# Documentation: http://scri...
python
chosen
[ { "from": "system", "value": "Revert the removal of an unused import (in [14175]) that was referenced in documentation. Thanks for noticing, clong.\n\ngit-svn-id: 554f83ef17aa7291f84efa897c1acfc5d0035373@14359 bcc190cf-cafb-0310-a4f2-bffc1f526a37\n" }, { "from": "human", "value": "from django.co...
python
chosen
[ { "from": "system", "value": "Allow Config to be initialised without any args\n" }, { "from": "human", "value": "import yaml\n\nfrom diamondash import utils\n\n\nclass ConfigError(Exception):\n \"\"\"Raised when there is an error parsing a configuration\"\"\"\n\n\nclass ConfigMetaClass(type):...
python
chosen
[ { "from": "system", "value": "Add standard header, use spack helpers\n\nAdded the standard header (stolen from R).\n\nTouched up the install to use set_executable rather than doing it\nmyself.\n" }, { "from": "human", "value": "from spack import *\nfrom glob import glob\nimport os\n\nclass Nextf...
python
chosen
[ { "from": "system", "value": "Improve logging of openended extension\n" }, { "from": "human", "value": "from django.core.management.base import BaseCommand, CommandError\nfrom atlas.prodtask.open_ended import check_open_ended\n\n\nclass Command(BaseCommand):\n args = '<request_id, request_id>...
python
chosen
[ { "from": "system", "value": "Make empty migration authent 3\n" }, { "from": "human", "value": "# -*- coding: utf-8 -*-\nfrom __future__ import unicode_literals\n\nfrom django.db import migrations\nfrom django.core.management import call_command\nfrom django.conf import settings\n\n\ndef add_per...
python
chosen
[ { "from": "system", "value": "Replace str into call in url\n" }, { "from": "human", "value": "from django.conf.urls import include, url\nfrom django.contrib import admin\nfrom django.views.generic import RedirectView\n\nfrom test_app.models import DummyModel, MushroomSpot\nfrom test_app.views im...
python
chosen
[ { "from": "system", "value": "Add licence header in fake camera test file.\n" }, { "from": "human", "value": "from os import listdir\nfrom os.path import isfile, join\n\n\nclass Camera(object):\n\n def __init__(self, path):\n self.files = [join(path, f) for f in listdir(path)]\n ...
python
chosen
[ { "from": "system", "value": "Handle logging unicode messages in python2.\n\n\nFormer-commit-id: 257d94eb71d5597ff52a18ec1530d73496901ef4" }, { "from": "human", "value": "import sys\nimport hashlib\n\ndef e(s):\n if type(s) == str:\n return str\n return s.encode('utf-8')\n\ndef d(s)...
python
chosen
[ { "from": "system", "value": "Test PEP8 integration into Atom\n" }, { "from": "human", "value": "import unittest\nfrom tip.algorithms.dummy import dummy_add\n\n\nclass TestDummyAdd(unittest.TestCase):\n def test_lcm(self):\n r = dummy_add(2, 2)\n self.assertEqual(r, 4)\n" }, ...
python
chosen
[ { "from": "system", "value": "Tweak up timeout in UDP test\n" }, { "from": "human", "value": "import contextlib, queue, time, unittest\n\nfrom bibliopixel.util import udp\n\nTEST_ADDRESS = '127.0.0.1', 5678\nTIMEOUT = 0.2\n\n\n@contextlib.contextmanager\ndef receive_udp(address, results):\n r...
python
chosen
[ { "from": "system", "value": "Add __getattr__ method in order to be able to call non-defined methods\n" }, { "from": "human", "value": "from currency_rates import rates\n\n\nclass Money(object):\n\n def __init__(self, amount, currency):\n self.amount = amount\n self.currency = c...
python
chosen
[ { "from": "system", "value": "Add docstrings and author reference\n" }, { "from": "human", "value": "import socket\nimport sys\n\n\nclass SimpleServer(object):\n \"\"\"Simple server using the socket library\"\"\"\n\n def __init__(self, blocking=False, connection_oriented=True):\n \"...
python
chosen
[ { "from": "system", "value": "Write out concatenated frame on decode test failure\n" }, { "from": "human", "value": "import argparse\nimport scanner\nimport numpy as np\nimport cv2\nfrom decode import db\n\n@db.loader('frame')\ndef load_frames(buf, metadata):\n return np.frombuffer(buf, dtype...
python
chosen
[ { "from": "system", "value": "Handle different environments, for automation (I4).\n" }, { "from": "human", "value": "import requests\nimport os\n\naport = os.environ.get('MYAPORT')\nif aport is None:\n aport = \"80\"\n\naport = \"23456\"\n\nurl1 = 'http://localhost:' + aport + '/'\nurl2 = 'ht...
python
chosen
[ { "from": "system", "value": "Use blank string instead of None as default origin\n\nSigned-off-by: Rohan Jain <f3a935f2cb7c3d75d1446a19169b923809d6e623@gmail.com>\n" }, { "from": "human", "value": "import logging\n\nfrom fnmatch import fnmatch\nfrom tornado import web\nfrom qotr.config import co...
python
chosen