conversations
listlengths
2
3
source
stringclasses
1 value
stack
stringclasses
1 value
[ { "from": "system", "value": "downloads: Add view for displaying corrected solutions\n" }, { "from": "human", "value": "from django.conf.urls import patterns, url\nfrom django.utils.translation import ugettext_lazy as _\n\nfrom problems.models import UserSolution\n\nfrom .views import download_p...
python
chosen
[ { "from": "system", "value": "Put temp files in ~/tmp by default\n" }, { "from": "human", "value": "\"\"\"Show a command to edit fred files\"\"\"\n\nimport os\nimport sys\n\n\nfrom dotsite.paths import makepath, pwd\n\n\ndef get_freds(paths):\n if not paths:\n paths = ['.']\n result...
python
chosen
[ { "from": "system", "value": "Set CSRF token expirtion time to 6 hours\n" }, { "from": "human", "value": "SQLALCHEMY_DATABASE_URI = \"postgres://@/mailflow\"\nSECRET_KEY = 'Chi6riup1gaetiengaShoh=Wey1pohph0ieDaes7eeph'\n\nINBOX_LOGIN_LENGTH = 16\nINBOX_PASSWORD_LENGTH = 16\nINBOX_PAGE_SIZE = 50\...
python
chosen
[ { "from": "system", "value": "Fix to Travis build script.\n" }, { "from": "human", "value": "# -*- coding: utf-8 -*-\n\nimport os\n\nfrom travispy import travispy\nfrom travispy import TravisPy\n\n\ndef main():\n\n restarted = []\n building = []\n\n for domain in [travispy.PUBLIC, travi...
python
chosen
[ { "from": "system", "value": "Print out changed paths in pipeline file\n" }, { "from": "human", "value": "\n'''\nUpdate EVLA pipeline variables to the current system.\n'''\n\n\ndef update_paths(pipe_dict, ms_path, pipepath):\n\n pipe_dict['ms_active'] = ms_path\n pipe_dict['SDM_name'] = ms...
python
chosen
[ { "from": "system", "value": "Enable terminals in the lab example\n" }, { "from": "human", "value": "\"\"\"\nCopyright (c) Jupyter Development Team.\nDistributed under the terms of the Modified BSD License.\n\"\"\"\n\nimport os\nfrom jinja2 import FileSystemLoader\nfrom notebook.base.handlers im...
python
chosen
[ { "from": "system", "value": "Sort webhook requests by date\n" }, { "from": "human", "value": "\"\"\"Admin interface for fluidreview\"\"\"\nfrom django.contrib import admin\n\nfrom bootcamp.utils import get_field_names\nfrom fluidreview.models import WebhookRequest, OAuthToken\n\n\nclass Webhook...
python
chosen
[ { "from": "system", "value": "Adjust cowry return url now that we're up and running.\n" }, { "from": "human", "value": "try:\n from .secrets import *\nexcept ImportError:\n import sys\n sys.exit('secrets.py settings file not found. Please run `prepare.sh` to create one.')\n\nfrom .base ...
python
chosen
[ { "from": "system", "value": "Fix test on grid search\n" }, { "from": "human", "value": "import pytest\nimport torch\nfrom torch import Tensor\nimport syft as sy\n\n\ndef test_virtual_grid(workers):\n \"\"\"This tests our ability to simplify tuple types.\n\n This test is pretty simple sinc...
python
chosen
[ { "from": "system", "value": "Include call for screen scraping\n" }, { "from": "human", "value": "'''\nCreated on Apr 25, 2015\n\n@author: Sherry\n'''\n\nfrom json import dumps\n\nfrom twitterDataAcquisition import TwitterDataAcquisition\n\ndef main():\n twitterData = TwitterDataAcquisition()...
python
chosen
[ { "from": "system", "value": "Add debug log output to `cob testserver`\n" }, { "from": "human", "value": "import click\nimport logbook\n\nfrom ..app import build_app\nfrom ..bootstrapping import ensure_project_bootstrapped\n\n_logger = logbook.Logger(__name__)\n\n\n@click.command()\n@click.optio...
python
chosen
[ { "from": "system", "value": "Change naming schema for deploy\n" }, { "from": "human", "value": "from flask_script import Manager\nfrom config.config import app\n\nmanager = Manager(app)\n\n@manager.command\ndef run_local():\n app.run(debug=True)\n\n@manager.command\ndef run_test():\n # To...
python
chosen
[ { "from": "system", "value": "Drop the admin for srs this time\n" }, { "from": "human", "value": "from django.conf.urls import include, url\nfrom django.contrib import admin\n\nfrom .views import HomePageView\n\n\nurlpatterns = [\n url(r'^$', HomePageView.as_view(), name='home'),\n url(r'^...
python
chosen
[ { "from": "system", "value": "Add id in the room, venue endpoint\n" }, { "from": "human", "value": "from rest_framework import serializers\n\nfrom .models import Conference, ConferenceVenue, Room\n\n\nclass ConferenceSerializer(serializers.HyperlinkedModelSerializer):\n status = serializers.C...
python
chosen
[ { "from": "system", "value": "Return update flag from erase tool.\n\nFixes a bug introduced a couple commits earlier.\n" }, { "from": "human", "value": "class BaseTool (object):\n draw_locks = False\n def update_cursor(self, mouse):\n mouse.set_cursor(None)\n\nclass DrawTool (BaseTo...
python
chosen
[ { "from": "system", "value": "Change subject and content of registration email.\n" }, { "from": "human", "value": "from celery import task\nfrom django.core.mail import EmailMessage\nfrom webparticipation.apps.ureporter.models import delete_user_from_rapidpro as delete_from\n\n\n@task()\ndef sen...
python
chosen
[ { "from": "system", "value": "Correct model reference in comments." }, { "from": "human", "value": "# encoding: utf-8\nfrom django.views.generic import ListView\n\nfrom .viewmixins import OrderByMixin, PaginateMixin, SearchFormMixin\n\n\nclass BaseListView(PaginateMixin, OrderByMixin, SearchForm...
python
chosen
[ { "from": "system", "value": "Add support for more instrument output types\n" }, { "from": "human", "value": "from colors import Colors\nfrom line import Line\nimport re\n\nprefixes = [\n (\"Start\", \"\", Colors.GREEN_FG),\n (\"Pass\", \"\", Colors.GREEN_FG),\n ...
python
chosen
[ { "from": "system", "value": "Add Apache 2.0 license to source file\n\nAs per OpenStack licensing guide lines [1]:\n[H102 H103] Newly contributed Source Code should be licensed under\nthe Apache 2.0 license.\n[H104] Files with no code shouldn't contain any license header nor\ncomments, and must be left comp...
python
chosen
[ { "from": "system", "value": "Fix test loading wrong config\n" }, { "from": "human", "value": "import tempfile\nimport shutil\nimport os\n\nfrom voltgrid import ConfigManager\n\n\ndef test_config_manager():\n c = ConfigManager('voltgrid.conf.example')\n c.write_envs()\n\n\ndef test_config_...
python
chosen
[ { "from": "system", "value": "[JBKB-996] Delete findMetainfoRelatedTerms method from Genestack Core\nfindMetainfoRelatedTerms is deleted\n" }, { "from": "human", "value": "# -*- coding: utf-8 -*-\n\nimport sys\n\nif not ((2, 7, 5) <= sys.version_info < (3, 0)):\n sys.stderr.write(\n 'P...
python
chosen
[ { "from": "system", "value": "Use executemany instead of execute in write logic\n" }, { "from": "human", "value": "from __future__ import absolute_import\nfrom __future__ import unicode_literals\n\n\ndef insert_metric_ids(db, metric_ids):\n for metric_id in metric_ids:\n db.execute(\n ...
python
chosen
[ { "from": "system", "value": "Print the error in the regression test.\n" }, { "from": "human", "value": "\"\"\"\nA regression test for computing three kinds of spectrogram.\n\nJust to ensure we didn't break anything.\n\"\"\"\n\nimport numpy as np\nimport os\nfrom tfr.files import load_wav\nfrom ...
python
chosen
[ { "from": "system", "value": "Add more sanity checks to the trust list test\n" }, { "from": "human", "value": "# coding: utf-8\nfrom __future__ import unicode_literals, division, absolute_import, print_function\n\nimport unittest\nimport sys\n\nfrom oscrypto import trust_list\nfrom asn1crypto.x5...
python
chosen
[ { "from": "system", "value": "Change redis url and redis port\n" }, { "from": "human", "value": "import os\n\n# REDIS\nREDIS_HOST = '127.0.0.1'\nREDIS_PORT = 6379\n\nHOST = os.environ.get('HOST', 'http://localhost:9000')\nTHUMBOR_HOST = os.environ.get('HOST', 'http://localhost:8001')\n" }, {...
python
chosen
[ { "from": "system", "value": "Update management command for various changes\n" }, { "from": "human", "value": "from django.core.management.base import BaseCommand\nfrom django.db.models import Prefetch\n\nfrom mla_game.apps.transcript.tasks import update_transcript_stats\n\nfrom ...models import...
python
chosen
[ { "from": "system", "value": "ADD test to test iterative fit sparse\n" }, { "from": "human", "value": "import unittest\n\nfrom autosklearn.pipeline.components.regression.random_forest import RandomForest\nfrom autosklearn.pipeline.util import _test_regressor, _test_regressor_iterative_fit\n\nimp...
python
chosen
[ { "from": "system", "value": "Use plot_report._available instead of available()\n" }, { "from": "human", "value": "import unittest\nimport warnings\n\nfrom chainer import testing\nfrom chainer.training import extensions\n\n\nclass TestPlotReport(unittest.TestCase):\n\n def test_available(self...
python
chosen
[ { "from": "system", "value": "Make sure we're calling functions correctly\n" }, { "from": "human", "value": "def compfeats(url):\n print 'Feats called: ', url\n return url\n\ndef nfold(imgs, feats):\n print 'nfold called: ', imgs, feats\n\nimgs = ['images/img1.png','images/img2.png']\nf...
python
chosen
[ { "from": "system", "value": "Fix slot name in SoftwareImage\n\n" }, { "from": "human", "value": "\"\"\"\nModule with the SoftwareImage model.\n\"\"\"\n\nfrom launch_control.utils.json.pod import PlainOldData\n\n\nclass SoftwareImage(PlainOldData):\n \"\"\"\n Model for representing softwar...
python
chosen
[ { "from": "system", "value": "Change to use read-only router for data-apis\n" }, { "from": "human", "value": "\"\"\"\nAPI Builder\nBuild dynamic API based on the provided SQLAlchemy model\n\"\"\"\nfrom managers import AlchemyModelManager\nfrom viewsets import AlchemyModelViewSet\nfrom rest_frame...
python
chosen
[ { "from": "system", "value": "Revert \"merge alter statements together.\"\n\nThis reverts commit 0ed919a86c835956596e9e897423e6176625f158.\nReverting all IMAP folder handling patches.\n" }, { "from": "human", "value": "\"\"\"add folder_separator column for generic imap\n\nRevision ID: 4f8e995d1d...
python
chosen
[ { "from": "system", "value": "Fix user account prepending to machine detail remote connection plugin.\n" }, { "from": "human", "value": "\"\"\"Machine detail plugin to allow easy VNC or SSH connections.\"\"\"\n\n\nimport sal.plugin\nfrom server.models import Machine, SalSetting\nfrom server.util...
python
chosen
[ { "from": "system", "value": "Remove unnecessary coerce to int\n\nSince Django commit\nhttps://github.com/django/django/commit/190d2ff4a7a392adfe0b12552bd71871791d87aa\nHttpResponse.status_code is always an int.\n" }, { "from": "human", "value": "from django.template.response import SimpleTempla...
python
chosen
[ { "from": "system", "value": "Switch assets to debug by default. " }, { "from": "human", "value": "DEBUG = True\nSECRET_KEY = 'no'\n\nSITES_FILE = 'sites.yaml'\nFREEZER_DESTINATION = '../build'\nFREEZER_REMOVE_EXTRA_FILES = True\nFLATPAGES_AUTO_RELOAD = True" }, { "from": "gpt", "val...
python
chosen
[ { "from": "system", "value": "Store magic test. On MacOSX the temp dir in /var is symlinked into /private/var thus making this comparison fail. This is solved by using os.path.realpath to expand the tempdir into is's real directory.\n" }, { "from": "human", "value": "import tempfile, os\n\nimpor...
python
chosen
[ { "from": "system", "value": "Add aliases for MFR-related utilites\n" }, { "from": "human", "value": "from .views import node\n\n\n# Alias the project serializer\nserialize_node = node._view_project\n" }, { "from": "gpt", "value": "# -*- coding: utf-8 -*-\n\"\"\"Various node-related ...
python
chosen
[ { "from": "system", "value": "Add pytest hook to register online marker\n" }, { "from": "human", "value": "\"\"\"Module grouping session scoped PyTest fixtures.\"\"\"\n\nimport pytest\nfrom _pytest.monkeypatch import MonkeyPatch\n\nimport pydov\n\n\ndef pytest_runtest_setup():\n pydov.hooks =...
python
chosen
[ { "from": "system", "value": "Set drf to onyl render json response on all requests\n" }, { "from": "human", "value": "REST_FRAMEWORK = {\n 'DEFAULT_THROTTLE_CLASSES': (\n 'rest_framework.throttling.AnonRateThrottle',\n ),\n 'DEFAULT_THROTTLE_RATES': {\n 'anon': '5000/day',...
python
chosen
[ { "from": "system", "value": "Revert \"Do not display quesitons in script.\"\n\nThis reverts commit 5c7286c1dc6348f2212266871876376df15592c0.\n" }, { "from": "human", "value": "from demo7 import get_answer\nimport json\n\nclass TripleError(Exception):\n \"\"\"\n Raised when a triple co...
python
chosen
[ { "from": "system", "value": "[Bugfix] Add dummy parameter for UE4.\n\nSigned-off-by: Juri Berlanda <5bfdca9e82c53adb0603ce7083f4ba4f2da5cacf@hotmail.com>\n" }, { "from": "human", "value": "from flask import Flask\nfrom flask_socketio import SocketIO\n\n\n## Instanciate Flask (Static files and R...
python
chosen
[ { "from": "system", "value": "Use Python scheduler rather than the home-made one" }, { "from": "human", "value": "\"\"\"\n\nVery basic implementation of an event loop\n==========================================\n\nThe eventloop is a singleton to schedule and run events.\n\nExports\n-------\n\n- ...
python
chosen
[ { "from": "system", "value": "Fix minor syntax error in test\n" }, { "from": "human", "value": "import json\nimport logging\nimport os\nimport unittest\n\nimport ptn\n\n\nclass ParseTest(unittest.TestCase):\n\n def test_parser(self):\n with open('files/input.json') as input_file:\n ...
python
chosen
[ { "from": "system", "value": "Make our LiveFlotWidget not pull in jQuery\n" }, { "from": "human", "value": "# This file is part of Moksha.\n#\n# Moksha is free software: you can redistribute it and/or modify\n# it under the terms of the GNU General Public License as published by\n# the Free Soft...
python
chosen
[ { "from": "system", "value": "Implement poll saving and getting.\n" }, { "from": "human", "value": "\"\"\"Go API action dispatcher for dialogue conversations.\"\"\"\n\nfrom go.api.go_api.action_dispatcher import ConversationActionDispatcher\n\n\nclass DialogueActionDispatcher(ConversationActionD...
python
chosen
[ { "from": "system", "value": "UPDATE update_route_for_node method to accept new parameters (vpn_endpoint/vpn_key)\n" }, { "from": "human", "value": "# third party\nfrom sqlalchemy.engine import Engine\n\n# relative\nfrom ..node_table.node_route import NodeRoute\nfrom .database_manager import Dat...
python
chosen
[ { "from": "system", "value": "Make failing Karma tests actually count as failures.\n" }, { "from": "human", "value": "# Copyright 2012 Google Inc. All Rights Reserved.\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may not use this file except in compliance with t...
python
chosen
[ { "from": "system", "value": "Add IANA OID to file" }, { "from": "human", "value": "#!/usr/bin/python\n############################################################\n#\n# Copyright 2015 Interface Masters Technologies, Inc.\n#\n# Platform Driver for x86-64-im-n29xx-t40n-r0\n#\n####################...
python
chosen
[ { "from": "system", "value": "Increase default timeout for postcodeinfo to 30s\n\nIt seems that the current default of 5 seconds is too low for most of\nthe \"legal provider upload\" use cases.\n" }, { "from": "human", "value": "import re\nimport postcodeinfo\nimport pc_fallback\n\n\nclass Geoco...
python
chosen
[ { "from": "system", "value": "Use our CoverageTest base class to get isolation (in a new directory) for the data tests.\n" }, { "from": "human", "value": "\"\"\"Tests for coverage.data\"\"\"\n\nimport unittest\nfrom coverage.data import CoverageData\n\nclass DataTest(unittest.TestCase):\n def...
python
chosen
[ { "from": "system", "value": "Update Agent to use BaseModel classes to...\n\nrepresent Agent.role & Agent.phone_numbers fields\n\nThis will enable attribute access semantics for these fields\n\ni.e.\n> agent = client.agent.get(1234)\n> agent.role['id']\n> agent.phone_numbers[0]['number']\n\n> agent.role.id\...
python
chosen
[ { "from": "system", "value": "Make sure pubsubpull is installed.\n" }, { "from": "human", "value": "from slumber.connector.ua import get\n\nfrom django.test import TestCase\n\nfrom pubsubpull.models import *\n\n\nclass TestConfiguration(TestCase):\n def test_slumber(self):\n response, ...
python
chosen
[ { "from": "system", "value": "Fix testing on update_game_info management command\n" }, { "from": "human", "value": "from django.core.management import call_command\nfrom django.test import TestCase\n\n\nclass ServerTest(TestCase):\n def test_update_game_info(self):\n call_command('upda...
python
chosen
[ { "from": "system", "value": "Use regex instead of replace for Mako template preprocess\n" }, { "from": "human", "value": "\"\"\" Module providing standard output classes \"\"\"\r\n\r\nfrom abc import ABCMeta, abstractmethod\r\nfrom mako.template import Template\r\nfrom mako.lookup import Templa...
python
chosen
[ { "from": "system", "value": "Add Rule.validate class method that will raise exceptions\n" }, { "from": "human", "value": "#!/usr/bin/env python\n\"\"\"\n:Author Patrik Valkovic\n:Created 23.06.2017 16:39\n:Licence GNUv3\nPart of grammpy\n\n\"\"\"\n\nfrom .Rule import Rule\n\n\nclass IsMethodsRu...
python
chosen
[ { "from": "system", "value": "Store cleanet phone number for use in SQL extracts" }, { "from": "human", "value": "# -*- coding: utf-8 -*-\n\nfrom openerp import models, fields, api\nimport string\n\nclass ResPartner(models.Model):\n _inherit = ['res.partner']\n\n mobile_clean = fields.Char...
python
chosen
[ { "from": "system", "value": "Fix property name in test\n" }, { "from": "human", "value": "import hoomd\n\n\ndef test_before_attaching():\n filt = hoomd.filter.All()\n thermoHMA = hoomd.md.compute.ThermoHMA(filt, 1.0)\n assert thermoHMA._filter == filt\n assert thermoHMA.temperature ...
python
chosen
[ { "from": "system", "value": "Complete two pointers char count dict sol w/ time/space complexity\n" }, { "from": "human", "value": "\"\"\"Leetcode 340. Longest Substring with At Most K Distinct Characters\nHard\n\nURL: https://leetcode.com/problems/longest-substring-with-at-most-k-distinct-chara...
python
chosen
[ { "from": "system", "value": "Comment overflow problem on FindtheDiff_BitHash" }, { "from": "human", "value": "class Solution(object):\n def findTheDifference(self, s, t):\n \"\"\"\n :type s: str\n :type t: str\n :rtype: str\n \"\"\"\n chrs = {}\n ...
python
chosen
[ { "from": "system", "value": "Update mock method to match changed return value for libhxl\n" }, { "from": "human", "value": "\"\"\"Unit test suite for HXL proxy.\"\"\"\n\nimport os\nimport re\nimport hxl\nimport unittest.mock\n\nTEST_DATA_FILE = os.path.join(os.path.dirname(__file__), 'test-data...
python
chosen
[ { "from": "system", "value": "[Catapult] Work around test failure on Catapult CQ\n\nBug: chromium:1275181\nChange-Id: I78e2f62371ebc872706366bb897336c8e5c7f02f\nReviewed-on: https://chromium-review.googlesource.com/c/catapult/+/3309287\nCommit-Queue: John Chen <334fbfbb4df7c78f091ea1b77c69ca6ac731a3f3@chrom...
python
chosen
[ { "from": "system", "value": "Add session-scope clean up that removes the test database\n" }, { "from": "human", "value": "import os\n\nTEST_CONFIG = os.path.join(os.path.dirname(os.path.abspath(__file__)), 'cosmoconfig_test.yaml')\n\n# Check to make sure that the test config file is being used....
python
chosen
[ { "from": "system", "value": "Use parent process id, that of the apache process.\n" }, { "from": "human", "value": "from pyramid.httpexceptions import HTTPNotFound\nfrom pyramid.view import view_config\nfrom random import randint\nfrom ..contentbase import (\n Root,\n location_root,\n)\n\n...
python
chosen
[ { "from": "system", "value": "Use same settings in smoke test as in real use\n" }, { "from": "human", "value": "import unittest\n\nfrom celery import Celery\nfrom django.conf import settings\nfrom django.db import connection\n\n\nclass SmokeTests(unittest.TestCase):\n\n def setUp(self):\n ...
python
chosen
[ { "from": "system", "value": "Revert \"Revert \"Don't cache markers, admin files or uncompressed JS/CSS\"\"\n\nThis reverts commit 6c488d267cd5919eb545855a522d5cd7ec7d0fec.\n" }, { "from": "human", "value": "import os\nimport os.path\n\nfrom django.core.management.base import NoArgsCommand\nfrom...
python
chosen
[ { "from": "system", "value": "Fix docstring and remove unnecessary imports.\n" }, { "from": "human", "value": "\"\"\"\nBraubuddy Dummy thermometer unit tests.\n\"\"\"\n\nimport unittest\nfrom mock import patch, call, MagicMock\nfrom braubuddy.thermometer import auto \nfrom braubuddy.thermometer ...
python
chosen
[ { "from": "system", "value": "Add function to call problem_ids report generation\n" }, { "from": "human", "value": "\"\"\"\nIn this module we define the interface between the cli input provided\nby the user and the analytics required by the user\n\"\"\"\nfrom edx_data_research.reporting.basic im...
python
chosen
[ { "from": "system", "value": "Add unit test to check duplicate username error is handled in manage.py\n" }, { "from": "human", "value": "# -*- coding: utf-8 -*-\n\nimport manage\nimport unittest\n\n\nclass TestManagePy(unittest.TestCase):\n def test_parse_args(self):\n # just test that...
python
chosen
[ { "from": "system", "value": "Tag commit for v0.0.22-master generated by gitmake.py\n" }, { "from": "human", "value": "major = 0\nminor=0\npatch=21\nbranch=\"master\"\ntimestamp=1376526439.16" }, { "from": "gpt", "value": "major = 0\nminor=0\npatch=22\nbranch=\"master\"\ntimestamp=13...
python
chosen
[ { "from": "system", "value": "Remove now useless TearDown method." }, { "from": "human", "value": "# Basic test of dynamic code generation\nimport unittest\nimport os, glob\n\nimport stdio\nfrom ctypes import POINTER, c_int\n\nclass DynModTest(unittest.TestCase):\n def tearDown(self):\n ...
python
chosen
[ { "from": "system", "value": "Create 3 layer nt sample\n" }, { "from": "human", "value": "import numpy as np\n\narr1 = np.array([[1,2],[3,4]])\narr2 = np.array([[5,6],[7,8]])\narr3 = np.array([[1,2],[3,4],[5,6]])\narr4 = np.array([7,8])\n\n# 列出矩陣的維度\n# print(arr1.shape)\n# print(arr1.shape[0])\n...
python
chosen
[ { "from": "system", "value": "Store --keep-publish value in options['publish'] (duh)\n" }, { "from": "human", "value": "#!/usr/bin/env python\n# -*- coding: utf-8 -*-\n\"\"\"\nUpdate to the latest CAL-ACCESS snapshot and bake static website pages.\n\"\"\"\nimport logging\nfrom django.core.manage...
python
chosen
[ { "from": "system", "value": "Improve error handling of sipa API\n" }, { "from": "human", "value": "from flask import Blueprint\n\nfrom . import v0\n\nbp = Blueprint('api', __name__)\nv0.api.init_app(bp)\n\ndef errorpage(e):\n code = getattr(e, 'code', 500)\n if code == 404:\n retur...
python
chosen
[ { "from": "system", "value": "Make sure quarters are in the format catalyst wants\n\n\ngit-svn-id: 24222aecec59d6833d1342da1ba59f27d6df2b08@636 3f86a6b1-f777-4bc2-bf3d-37c8dbe90857\n" }, { "from": "human", "value": "\"\"\"\nThis is the interface for interacting w/ Catalyst GradeBook\n\"\"\"\n\nf...
python
chosen
[ { "from": "system", "value": "Add usage and intallation instructions\n" }, { "from": "human", "value": "from pelican import signals\n\n\"\"\"\nRelated posts plugin for Pelican\n================================\n\nAdds related_posts variable to article's context\n\"\"\"\nrelated_posts = []\ndef a...
python
chosen
[ { "from": "system", "value": "git: Fix top level hook to not use renames\n" }, { "from": "human", "value": "#!/usr/bin/env python3\n\nimport os\nimport subprocess\nimport sys\n\nif __name__ == '__main__':\n\n ref_name = sys.argv[1]\n old_commit = sys.argv[2]\n new_commit = sys.argv[3]\n...
python
chosen
[ { "from": "system", "value": "Delete Property Setters for Custom Fields, and set them inside Custom Field\n" }, { "from": "human", "value": "# Copyright (c) 2013, Web Notes Technologies Pvt. Ltd. and Contributors\n# License: GNU General Public License v3. See license.txt\n\nimport webnotes\nfrom...
python
chosen
[ { "from": "system", "value": "Fix order of components of shift\n\nFITS and bumpy have opposite conventions as to which axis is the first axis\n" }, { "from": "human", "value": "from image import ImageWithWCS\nimport numpy as np\nfrom os import path\n\n\ndef shift_images(files, source_dir, output...
python
chosen
[ { "from": "system", "value": "Update control panel test for fetch\n" }, { "from": "human", "value": "import httpretty\n\nfrom paystackapi.tests.base_test_case import BaseTestCase\nfrom paystackapi.cpanel import ControlPanel\n\n\nclass TestPage(BaseTestCase):\n\n @httpretty.activate\n def t...
python
chosen
[ { "from": "system", "value": "Section: Set end_paragraph to True by default\n" }, { "from": "human", "value": "# -*- coding: utf-8 -*-\n\"\"\"\nThis module implements the class that deals with sections.\n\n.. :copyright: (c) 2014 by Jelte Fennema.\n :license: MIT, see License for more detail...
python
chosen
[ { "from": "system", "value": "Rewrite assertions for Python 2.6 compatibility\n" }, { "from": "human", "value": "from ..helpers import *\n\n\ndef test_honcho_start_joins_stderr_into_stdout():\n ret, out, err = get_honcho_output(['-f', 'Procfile.output', 'start'])\n\n assert_equal(ret, 0)\n...
python
chosen
[ { "from": "system", "value": "Adjust import statements to be sorted\n" }, { "from": "human", "value": "import flask\nfrom flask import request, render_template, flash, redirect, url_for\nfrom flask_login import login_user\n\nfrom ..models import User\nfrom ..utils.auth import is_safe_url\n\nfrom...
python
chosen
[ { "from": "system", "value": "Check that editor exists when adding\n" }, { "from": "human", "value": "## Copyright (C) 2011 Aldebaran Robotics\n\"\"\"Display the current config \"\"\"\n\nimport os\n\nimport qitools\n\ndef configure_parser(parser):\n \"\"\"Configure parser for this action \"\"...
python
chosen
[ { "from": "system", "value": "Format with Black and sort\n" }, { "from": "human", "value": "__version__ = VERSION = (0, 5, 1)\n\nfrom humanize.time import *\nfrom humanize.number import *\nfrom humanize.filesize import *\nfrom humanize.i18n import activate, deactivate\n\n__all__ = ['__version__'...
python
chosen
[ { "from": "system", "value": "Remove erroneous newton milestone tag\n\nChange https://review.openstack.org/268941 inadvertently tagged\nalembic migration 3d0e74aa7d37 with the newton milestone.\nRemove it.\n\nChange-Id: I46f98a824d2a190c29fb26b62025772de2e4e33e\nPartial-Bug: #1623108\n" }, { "from":...
python
chosen
[ { "from": "system", "value": "Fix filter() usage due to python 3 compability\n\nBuilt-in method filter() returns a list in Python 2.x [1], but it\nreturns an iterator in Python 3.x [2]. To remove the difference (and\nmake code more readable, also), we use list comprehension instead of filer().\n\n[1] http:/...
python
chosen
[ { "from": "system", "value": "Add peek to get counter\n" }, { "from": "human", "value": "\nclass Semaphore(object):\n\n \"\"\"docstring for Semaphore\"\"\"\n def __init__(self, db, id, counter, value, collection_name='mongotools.semaphore'):\n self._db = db\n self._name = col...
python
chosen
[ { "from": "system", "value": "Rename offlineevent to offlineevents route\n" }, { "from": "human", "value": "from django.utils.translation import ugettext_lazy as _\n\nfrom meinberlin.apps.dashboard2 import DashboardComponent\nfrom meinberlin.apps.dashboard2 import content\n\nfrom . import views\...
python
chosen
[ { "from": "system", "value": "Add a test case for the tuple leak in ctraits property.\n\nCourtesy Robert Kern.\n" }, { "from": "human", "value": "\"\"\" General regression tests for fixed bugs.\n\"\"\"\n\nimport gc\nimport unittest\nimport sys\n\nfrom traits.has_traits import HasTraits\n\n\ndef ...
python
chosen
[ { "from": "system", "value": "Format code using black and remove comments" }, { "from": "human", "value": "# Copyright 2020 Google LLC. All Rights Reserved.\r\n#\r\n# Licensed under the Apache License, Version 2.0 (the \"License\");\r\n# you may not use this file except in compliance with the Li...
python
chosen
[ { "from": "system", "value": "Add a Content-type when it's not clear\n" }, { "from": "human", "value": "import web\nfrom os import path\n\nrootdir = path.abspath('./build')\ndef getFile(filename):\n filename = path.join(rootdir, filename)\n print filename\n if (not filename.startswith(r...
python
chosen
[ { "from": "system", "value": "Add --fail-fast flag to test command\n" }, { "from": "human", "value": "from runcommands import command\nfrom runcommands.commands import local as _local\n\n\n@command\ndef format_code(check=False):\n _local(f\"black . {'--check' if check else ''}\")\n\n\n@comman...
python
chosen
[ { "from": "system", "value": "Update default authorization code lifetime.\n" }, { "from": "human", "value": "# coding: utf-8\nfrom django.conf import settings\n\nfrom appconf import AppConf\n\nclass DJOAuth2Conf(AppConf):\n class Meta:\n prefix = 'djoauth2'\n\n ACCESS_TOKEN_LENGTH = 30\n A...
python
chosen
[ { "from": "system", "value": "Fix sorting dictionary key, value pairs in Python 3.\n" }, { "from": "human", "value": "from __future__ import unicode_literals\n\nfrom .conf import BREAKPOINTS\n\n\ndef _get_device_type(width):\n \"Returns the type based on set breakpoints.\"\n sorted_types =...
python
chosen
[ { "from": "system", "value": "Remove xfail in service broker negative tests\n\nAfter tempest-lib 0.14.0 release all fixes in tempest become present.\nThis patch removes xfail for negative test in service broker test\nsuite.\n\nChange-Id: Ide900d53fd478885208e53c333d6759e938a960b\nCloses-Bug: #1527949\n" }...
python
chosen
[ { "from": "system", "value": "Print out the last open price\n" }, { "from": "human", "value": "#!/usr/bin/python\n\nimport sys\nfrom pprint import pprint\n\nimport ystockquote\n\n\nfor quote in sys.argv[1:]:\n print 'Finding quote for %s' % quote\n\n # First thing we want is some basic inf...
python
chosen
[ { "from": "system", "value": "Add explicit language specifier to test.\n\ngit-svn-id: 4c4cc70b1ef44ba2b7963015e681894188cea27e@354048 91177308-0d34-0410-b5e6-96231b3b80d8\n" }, { "from": "human", "value": "\"\"\"Test that importing modules in C++ works as expected.\"\"\"\n\nfrom __future__ impor...
python
chosen
[ { "from": "system", "value": "Make sure decorator is being used with proper function signatures\n" }, { "from": "human", "value": "from functools import wraps\n\nfrom django.core.exceptions import PermissionDenied\n\n\ndef permission_required(permissions):\n def decorator(func):\n @wra...
python
chosen
[ { "from": "system", "value": "Make sure jenkins output contains logs\n" }, { "from": "human", "value": "#!/usr/bin/env python\nimport sys\nfrom os import path\n\nimport nose\n\ndef run_all(argv=None):\n sys.exitfunc = lambda: sys.stderr.write('Shutting down....\\n')\n # always insert cover...
python
chosen
[ { "from": "system", "value": "MINOR: Print debug info to stderr\n" }, { "from": "human", "value": "#!/usr/bin/env python3\n\nimport argparse\nfrom datetime import timedelta\nfrom subprocess import Popen\nfrom time import time, sleep\n\n\ndef red(text):\n RED = '\\033[91m'\n END = '\\033[0m...
python
chosen