conversations
listlengths
2
3
source
stringclasses
1 value
stack
stringclasses
1 value
[ { "from": "system", "value": "Fix pytest version report when database does not exist, add Django version header\n" }, { "from": "human", "value": "# -*- coding:utf-8 -*-\nfrom __future__ import unicode_literals\n\nfrom django.db import connection\n\n\ndef pytest_report_header(config):\n with ...
python
chosen
[ { "from": "system", "value": "Revert \"tweak host fixture limits\"\n\nThis reverts commit 06e9a964dec8392007e3af87d1a41bbe119158ca.\n" }, { "from": "human", "value": "import pytest\n\nfrom models.broadcasted_models import two_comp_model\nfrom utilities.phoenix_utils import load_starfish_spectrum...
python
chosen
[ { "from": "system", "value": "Fix date issue (I think)\n" }, { "from": "human", "value": "\n# Get Contribution Count\n\nimport urllib\nimport datetime\nimport HTMLParser\n\nclass ContribParser(HTMLParser.HTMLParser):\n\n today = datetime.date.today().isoformat()\n \n def handle_starttag...
python
chosen
[ { "from": "system", "value": "Use env value for client token\n" }, { "from": "human", "value": "import discord\nimport asyncio\n\nclient = discord.Client()\n\n@client.event\nasync def on_ready():\n print('Logged in as')\n print(client.user.name)\n print(client.user.id)\n print('-----...
python
chosen
[ { "from": "system", "value": "Add shebang to testing script\n" }, { "from": "human", "value": "# coding=utf-8\n\"\"\"This is a script for running pytest from the command line.\n\nThis script exists so that the project directory gets added to sys.path, which\nprevents us from accidentally testing...
python
chosen
[ { "from": "system", "value": "Reset all attempts when ip not specified\n\nWhen no ip address positional arguments are specified, reset all attempts, as with reset() and per documentation." }, { "from": "human", "value": "from django.core.management.base import BaseCommand\n\nfrom axes.utils impo...
python
chosen
[ { "from": "system", "value": "Change the re const name to uppercase.\n" }, { "from": "human", "value": "\"\"\"CVMFS Servcice.\"\"\"\nimport os\nimport re\nimport cherrypy\nimport html\nfrom natsort import natsorted\n\nversion_re = re.compile(r\"^release-(\\d{1,3}\\.\\d{1,3}\\.\\d{1,3})$\")\n\n\n...
python
chosen
[ { "from": "system", "value": "Return index.html in root and transform /status results\n" }, { "from": "human", "value": "from flask import jsonify\n\nfrom . import app\nimport mapper\nimport utils\nfrom predict import predictor\n\n\n@app.route(\"/\", methods=[\"GET\"])\ndef index():\n firebas...
python
chosen
[ { "from": "system", "value": "Tests: Fix version_info check for Python2.6" }, { "from": "human", "value": "import sys\nimport doctest\n\n\ndef fix_doctests(suite):\n if sys.version_info.major >= 3:\n return\n for case in suite._tests:\n # Add some more flags.\n case._d...
python
chosen
[ { "from": "system", "value": "Correct mismatched field names in EntryForm.\n" }, { "from": "human", "value": "from django import forms\n\nfrom foialist.models import *\n\n\nclass FileForm(forms.ModelForm):\n class Meta:\n model = File\n exclude = ('entry', 'size')\n \n \nc...
python
chosen
[ { "from": "system", "value": "Fix the exception logger to actually log to stdout\n" }, { "from": "human", "value": "import sys\nimport traceback\n\nclass ExceptionLogger(object):\n def __init__(self, app):\n self.app = app\n\n def __call__(self, environ, start_response):\n tr...
python
chosen
[ { "from": "system", "value": "Fix render git, if gif file not render via thumbor\n" }, { "from": "human", "value": "#!/usr/bin/env python\n# -*- coding: utf-8 -*-\nfrom libthumbor import CryptoURL\nfrom django.conf import settings\n\n\ncrypto = CryptoURL(key=settings.THUMBOR_SECURITY_KEY)\n\n\nd...
python
chosen
[ { "from": "system", "value": "Move default location for MCP logs into /var/log/rbuilder/\n" }, { "from": "human", "value": "#\n# Copyright (c) 2005-2006 rPath, Inc.\n#\n# All rights reserved\n#\n\nimport os\n\nfrom conary import conarycfg\nfrom conary.lib import cfgtypes\n\nclass MCPConfig(conar...
python
chosen
[ { "from": "system", "value": "Fix retrieving __version__ without Tornado installed.\n" }, { "from": "human", "value": "from .mixins import HandlerMixin\n\n\nversion_info = (1, 0, 2)\n__version__ = '.'.join(str(v) for v in version_info[:3])\n" }, { "from": "gpt", "value": "try:\n f...
python
chosen
[ { "from": "system", "value": "Print if nothing to update\n" }, { "from": "human", "value": "import sys\nimport sh\n\nfrom fabric import api as fab\n\nsed = sh.sed.bake('-i bak -e')\nTRAVIS_YAML = '.travis.yml'\nREPLACE_LANGUAGE = 's/language: .*/language: {}/'\n\n\ndef is_dirty():\n return \"...
python
chosen
[ { "from": "system", "value": "Add basic routes for controls and song info\n" }, { "from": "human", "value": "import flask\nfrom . import track\n\napp = flask.Flask(__name__)\n\n@app.route(\"/\")\ndef root():\n\tsong = track.getCurrentSong()\n\tartist = track.getCurrentArtist()\n\talbum = track.g...
python
chosen
[ { "from": "system", "value": "Add feature vector size calculation method to mapper interface\n" }, { "from": "human", "value": "import math\nimport numpy\n\nclass FeatureMapper(object):\n def __init__(self, features):\n self.features = features\n \n def map(self, fv):\n ra...
python
chosen
[ { "from": "system", "value": "Change cross-origin check to work behind proxies\n\nSigned-off-by: Jan Dvořák <86df5a4870880bf501c926309e3bcfbe57789f3f@anilinux.org>\n" }, { "from": "human", "value": "#!/usr/bin/python3 -tt\n# -*- coding: utf-8 -*-\n\n__all__ = ['internal_origin_only']\n\nfrom url...
python
chosen
[ { "from": "system", "value": "Use GroupedOperation for merging PlatformPhyisicsOperation\n" }, { "from": "human", "value": "from UM.Operations.Operation import Operation\nfrom UM.Operations.AddSceneNodeOperation import AddSceneNodeOperation\nfrom UM.Operations.TranslateOperation import Translate...
python
chosen
[ { "from": "system", "value": "Allow renderer argument to paginated_view decorator\n" }, { "from": "human", "value": "import functools\n\nfrom flask import jsonify, request\nfrom flask.ext.sqlalchemy import Pagination\nfrom .request_utils import dictify_model, error_abort\n\ndef paginate_query(qu...
python
chosen
[ { "from": "system", "value": "Use from __future__ import for print function" }, { "from": "human", "value": "\"\"\"\nlogging middleware example\n\"\"\"\n\n\ndef log_middleware(store):\n \"\"\"log all actions to console as they are dispatched\"\"\"\n def wrapper(next_):\n def log_dis...
python
chosen
[ { "from": "system", "value": "Use oslo_utils eventletutils to warn about eventlet patching\n\nChange-Id: I86ba0de51b5c5789efae187ebc1c46ae32ff8b8b\n" }, { "from": "human", "value": "# -*- coding: utf-8 -*-\n\n# Copyright (C) 2012 Yahoo! Inc. All Rights Reserved.\n#\n# Licensed under the Ap...
python
chosen
[ { "from": "system", "value": "Use requests package instead of urllib2\n" }, { "from": "human", "value": "import urllib2\nimport json\n\n\ndef send_gcm_message(api_key, regs_id, data, collapse_key=None):\n \"\"\"\n Send a GCM message for one or more devices, using json data\n api_key: Th...
python
chosen
[ { "from": "system", "value": "Fix pagination logic & typo\n" }, { "from": "human", "value": "import discord\nimport asyncio\n\nfrom typing import List, Tuple\nfrom discord.ext.commands import Context\n\nEMOJI_MAP = {\"back\": \"⬅️\", \"forward\": \"➡️\"}\nasync def paginate(ctx: Context, embeds:...
python
chosen
[ { "from": "system", "value": "Add functionality to print list of parseable files\n" }, { "from": "human", "value": "# -*- coding: utf-8 -*-\nimport os\nimport argparse\nimport fs_utils\nfrom pybtex.database.input import bibtex\n\n\ndef main():\n \"\"\"\n Command-line interface\n \"\"\"\...
python
chosen
[ { "from": "system", "value": "Use serial integer IDs for SQL records\n" }, { "from": "human", "value": "from sqlalchemy.ext.declarative import declarative_base\nfrom sqlalchemy import Column, String\n\nBase = declarative_base()\n\n\nclass Label(Base):\n __tablename__ = 'labels'\n\n id = Co...
python
chosen
[ { "from": "system", "value": "Add missing newline for flake8\n" }, { "from": "human", "value": "# -*- coding: utf-8 -*-\n\nfrom bson import ObjectId\nfrom modularodm import fields\n\nfrom framework.mongo import StoredObject\n\n\nclass Session(StoredObject):\n\n _id = fields.StringField(primar...
python
chosen
[ { "from": "system", "value": "Add compute_score to subliminal namespace\n" }, { "from": "human", "value": "# -*- coding: utf-8 -*-\n__title__ = 'subliminal'\n__version__ = '1.0.dev0'\n__author__ = 'Antoine Bertin'\n__license__ = 'MIT'\n__copyright__ = 'Copyright 2015, Antoine Bertin'\n\nimport l...
python
chosen
[ { "from": "system", "value": "Use %APPDATA% for CONFIGURATION_DIR on Windows\n\nReferences retext-project/retext#156.\n" }, { "from": "human", "value": "# This file is part of python-markups module\n# License: BSD\n# Copyright: (C) Dmitry Shachnev, 2012-2015\n\nimport os.path\n\n# Some common co...
python
chosen
[ { "from": "system", "value": "Break PEP8 and Pydocstring to check Travis\n" }, { "from": "human", "value": "\"\"\"Views for the general application.\"\"\"\n\nfrom django.views.generic import TemplateView\nfrom django.http import HttpResponse\n\n\nclass GeneralIndexView(TemplateView):\n \"\"\"...
python
chosen
[ { "from": "system", "value": "Revert \"Add test for mbed parsing\"\n\nThis reverts commit d37dc009f1c4f6e8855657dd6dbf17df9332f765.\n" }, { "from": "human", "value": "#!/usr/bin/env python\n\"\"\"\nmbed SDK\nCopyright (c) 2011-2015 ARM Limited\n\nLicensed under the Apache License, Version 2.0 (t...
python
chosen
[ { "from": "system", "value": "Fix tests with Octave 5.\n" }, { "from": "human", "value": "\"\"\"Example use of jupyter_kernel_test, with tests for IPython.\"\"\"\n\nimport sys\nimport unittest\nimport jupyter_kernel_test as jkt\n\n\nclass OctaveKernelTests(jkt.KernelTests):\n kernel_name = \"...
python
chosen
[ { "from": "system", "value": "Replace the placeholder in the live demo\n" }, { "from": "human", "value": "\"\"\"Insert the demo into the codemirror site.\"\"\"\n\nimport os\nimport fileinput\nimport shutil\n\nproselint_path = os.path.dirname(os.path.dirname(os.path.realpath(__file__)))\n\ncode_m...
python
chosen
[ { "from": "system", "value": "Add CUT to list of externally visible objects\n" }, { "from": "human", "value": "from sed.engine.StreamEditor import StreamEditor\nfrom sed.engine.sed_file_util import call_main\nfrom sed.engine.match_engine import ACCEPT, REJECT, NEXT, REPEAT, CUT\nfrom sed.engine....
python
chosen
[ { "from": "system", "value": "Use SQLA Session directly in tests\n" }, { "from": "human", "value": "import pytest\nfrom sqlalchemy import create_engine\nfrom sqlalchemy.orm import scoped_session, sessionmaker\nfrom sqlalchemy_utils import create_database, database_exists, drop_database\n\nfrom g...
python
chosen
[ { "from": "system", "value": "Create a valid blox file in tmpfile fixture\n" }, { "from": "human", "value": "# -*- coding: utf-8 -*-\n\nimport pytest\n\n\n@pytest.yield_fixture\ndef tmpfile(request, tmpdir):\n yield tmpdir.join('file.tmp').ensure().strpath\n" }, { "from": "gpt", "...
python
chosen
[ { "from": "system", "value": "Adjust paths and module name\n" }, { "from": "human", "value": "#!/usr/bin/env python\n#\n# PyUSBtmc\n# get_data.py\n#\n# Copyright (c) 2011 Mike Hadmack\n# This code is distributed under the MIT license\nimport numpy\nimport sys\nimport os\nfrom matplotlib import p...
python
chosen
[ { "from": "system", "value": "[MINOR] Allow access to classloaders methods\n" }, { "from": "human", "value": "# -------------------------------------------------------------\n#\n# Licensed to the Apache Software Foundation (ASF) under one\n# or more contributor license agreements. See the NOTIC...
python
chosen
[ { "from": "system", "value": "Fix tests failing from different tab_size\n" }, { "from": "human", "value": "import sublime\nfrom unittest import TestCase\n\nclass TestHelper(TestCase):\n def setUp(self):\n self.view = sublime.active_window().new_file()\n\n def tearDown(self):\n if self.vi...
python
chosen
[ { "from": "system", "value": "Increase timeout from 400 to 800 seconds.\n" }, { "from": "human", "value": "import unittest, time, sys, os\nsys.path.extend(['.','..','py'])\nimport h2o, h2o_cmd, h2o_hosts, h2o_import as h2i\n\nclass Basic(unittest.TestCase):\n def tearDown(self):\n h2o....
python
chosen
[ { "from": "system", "value": "Fix test for python 3\n" }, { "from": "human", "value": "# -*- coding: utf-8 -*-\nimport pytest\nimport odin\n\n\nclass MultiPartResource(odin.Resource):\n id = odin.IntegerField()\n code = odin.StringField()\n two_parts = odin.MultiPartField(('id', 'code')...
python
chosen
[ { "from": "system", "value": "Update tracker store test for 0.7.5\n" }, { "from": "human", "value": "from __future__ import absolute_import\nfrom __future__ import division\nfrom __future__ import print_function\nfrom __future__ import unicode_literals\n\nfrom rasa_core.channels import UserMessa...
python
chosen
[ { "from": "system", "value": "Fix for dynamic value of FacilityDataset.preset.choices causing migration inconsistencies\n" }, { "from": "human", "value": "# -*- coding: utf-8 -*-\n# Generated by Django 1.9.13 on 2017-12-26 19:25\nfrom __future__ import unicode_literals\n\nfrom django.db import m...
python
chosen
[ { "from": "system", "value": "Add view to add Zeiterfassung entries from a plain text submission\n" }, { "from": "human", "value": "# -*- coding: utf-8 -*-\n#\n# (c) 2014 Bjoern Ricks <bjoern.ricks@gmail.com>\n#\n# See LICENSE comming with the source of 'trex' for details.\n#\n\nfrom rest_framew...
python
chosen
[ { "from": "system", "value": "Update Cloud9 per 2021-04-01 changes\n" }, { "from": "human", "value": "# Copyright (c) 2012-2017, Mark Peek <mark@peek.org>\n# All rights reserved.\n#\n# See LICENSE file for full license.\n\nfrom . import AWSObject, AWSProperty\nfrom .validators import integer\n\n...
python
chosen
[ { "from": "system", "value": "Allow a TestCase to set a 'loglevel' attribute, which overrides the logging level while that testcase runs\n" }, { "from": "human", "value": "# -*- coding: utf-8 -*-\n# Copyright 2014 OpenMarket Ltd\n#\n# Licensed under the Apache License, Version 2.0 (the \"License...
python
chosen
[ { "from": "system", "value": "Test whether or not the right exception is thrown.\n" }, { "from": "human", "value": "from latex import build_pdf\n\n\ndef test_generates_something():\n min_latex = r\"\"\"\n\\documentclass{article}\n\\begin{document}\nHello, world!\n\\end{document}\n\"\"\"\n\n ...
python
chosen
[ { "from": "system", "value": "Change IMPLICIT relative imports (not allowed in Python3k) to EXPLICIT relative imports (allowed in both Python2k/3k).\n" }, { "from": "human", "value": "#!/usr/bin/env python\n# coding: utf-8\n\nfrom graphviz_wrapper import board\n\n__author__ = 'akimacho'\n__vers...
python
chosen
[ { "from": "system", "value": "QtSvG: Use star imports again instead of direct ones\n" }, { "from": "human", "value": "# -*- coding: utf-8 -*-\n# -----------------------------------------------------------------------------\n# Copyright © 2009- The Spyder Development Team\n#\n# Licensed under the...
python
chosen
[ { "from": "system", "value": "Implement ProductDetail with a generic RetrieveUpdateDestroyAPIView class\n" }, { "from": "human", "value": "from django.http import HttpResponse\nfrom django.http import Http404\nfrom rest_framework import generics\nfrom rest_framework.response import Response\nfro...
python
chosen
[ { "from": "system", "value": "Fix import and use queue the right way\n" }, { "from": "human", "value": "# coding: utf-8\nimport requests\nfrom redis_wrap import get_hash\nfrom rq.decorators import job\n\ndef vimtips(msg=None):\n try:\n existing_tips = get_hash('vimtips')\n _len ...
python
chosen
[ { "from": "system", "value": "Fix bug handling exceptions in RevisionMiddleware\n\nRecently the RevisionMiddleware was modified to avoid accessing\nrequest.user unncessarily for caching purposes. This works well\nexcept in some cases it can obscure errors generated elsewhere in a\nproject.\n\nThe RevisionC...
python
chosen
[ { "from": "system", "value": "Use log2 instead of log10.\n" }, { "from": "human", "value": "#! /usr/bin/python2\n\nfrom __future__ import division\n\nimport numpy\n\n\n# JAKE\ndef calc_perplexity(test_counts_dict, trigram_probs_dict):\n '''\n # Calculates perplexity of contents of file_str...
python
chosen
[ { "from": "system", "value": "Fix CORS when running the api server with Docker\n" }, { "from": "human", "value": "\"\"\"This module contains basic functions to instantiate the BigchainDB API.\n\nThe application is implemented in Flask and runs using Gunicorn.\n\"\"\"\nimport os\n\nfrom flask imp...
python
chosen
[ { "from": "system", "value": "Rewrite residual block as class rather than method\n" }, { "from": "human", "value": "from keras.layers import Convolution2D, Merge\nfrom keras.layers.advanced_activations import PReLU\n\nfrom eva.layers.masked_convolution2d import MaskedConvolution2D\n\ndef Residua...
python
chosen
[ { "from": "system", "value": "Remove Node interfaces (use origin id for objects)\n" }, { "from": "human", "value": "import graphene\n\nfrom graphene_django.types import DjangoObjectType, ObjectType\nfrom graphene_django_extras import (\n DjangoFilterPaginateListField, LimitOffsetGraphqlPagina...
python
chosen
[ { "from": "system", "value": "Remove the null control system\n" }, { "from": "human", "value": "\"\"\"\nTemplate module to define control systems.\n\"\"\"\n\n\nclass ControlSystem(object):\n \"\"\" Define a control system to be used with a device.\n\n It uses channel access to comunicate o...
python
chosen
[ { "from": "system", "value": "Fix missing newlines with Python3\n" }, { "from": "human", "value": "import sys\n\ndef expand(filename):\n for dir in ('.', '../common', '../anstests/'):\n try:\n f = open(dir + \"/\" + filename)\n except IOError:\n continue\n ...
python
chosen
[ { "from": "system", "value": "Fix `protocol not supported` on Windows" }, { "from": "human", "value": "import zmq\n\nfrom crankycoin import config, logger\n\n\nclass Queue(object):\n\n QUEUE_BIND_IN = config['user']['queue_bind_in']\n QUEUE_BIND_OUT = config['user']['queue_bind_out']\n ...
python
chosen
[ { "from": "system", "value": "Add filename in attrs if fails to load it.\n\nFilename in attrs helps to debug.\n" }, { "from": "human", "value": "# -*- coding: utf-8 -*-\n# Licensed under a 3-clause BSD style license - see LICENSE.rst\n\nimport logging\n\nfrom cotede.qc import ProfileQC\nfrom . i...
python
chosen
[ { "from": "system", "value": "Revoke earlier change: This migration has already been applied.\n" }, { "from": "human", "value": "# -*- coding: utf-8 -*-\nfrom __future__ import unicode_literals\n\nfrom django.db import migrations\nimport django.db\n\nclass Migration(migrations.Migration):\n d...
python
chosen
[ { "from": "system", "value": "Rename 'first_run' -> 'create_copy' in recursive_dict_merge()\n" }, { "from": "human", "value": "# Copyright (c) 2016 Fabian Kochem\n\n\nimport collections\nfrom copy import deepcopy\n\n\ndef recursive_dict_merge(left, right, first_run=True):\n \"\"\"\n Merge ...
python
chosen
[ { "from": "system", "value": "Set the right CKAN organization\n" }, { "from": "human", "value": "\"\"\"settings.py - settings and configuration used over all modules : \n\nCopyright (c) 2018 Heinrich Widmann (DKRZ)\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n...
python
chosen
[ { "from": "system", "value": "Fix ConfigObject to use class instead of class_name. Pass infinite width when dumping to yaml.\n" }, { "from": "human", "value": "import yaml\n\n\ndef from_config(config):\n config = dict(config) # shallow copy\n return config.pop('class').from_config(config)...
python
chosen
[ { "from": "system", "value": "Remove speaker email field from proposal listing.\n\nSave space in admin proposal listing by removing the speaker email\nfield.\n" }, { "from": "human", "value": "from django.contrib import admin\n\nfrom .models import Proposal, ProposalKeyword\n\n\n@admin.register(...
python
chosen
[ { "from": "system", "value": "Add a blank line in the test case for CI?\n" }, { "from": "human", "value": "import unittest\nfrom ogn.parser.aprs_comment.inreach_parser import InreachParser\n\nclass TestStringMethods(unittest.TestCase):\n def test_position_comment(self):\n message = Inr...
python
chosen
[ { "from": "system", "value": "Raise ValueError if n < 1\n" }, { "from": "human", "value": "from collections import Counter\nfrom functools import (\n lru_cache,\n reduce,\n)\nfrom itertools import combinations\nfrom prime import Prime\n\n\n@lru_cache(maxsize=None)\ndef get_prime_factors(n)...
python
chosen
[ { "from": "system", "value": "Print running and stopped Applications" }, { "from": "human", "value": "# Author: Christoph Stoettner\n# E-Mail: christoph.stoettner@stoeps.de\n# Blog: http://www.stoeps.de\n\n# Check if applications are running\nprint \"Getting application status of all installed a...
python
chosen
[ { "from": "system", "value": "Increment static resources for Firebase.\n" }, { "from": "human", "value": "import json\nimport os\n\nDEBUG = os.environ.get('SERVER_SOFTWARE', '').startswith('Dev')\n\n# For choosing what the main landing page displays\nKICKOFF = 1\nBUILDSEASON = 2\nCOMPETITIONSEAS...
python
chosen
[ { "from": "system", "value": "[FIX] pylint: Fix error String statement has no effect\n" }, { "from": "human", "value": "# -*- coding: utf-8 -*-\nfrom openerp import fields, models, api\n\n\"\"\"\nThis module create model of Wizard\n\"\"\"\n\n\nclass Wizard(models.TransientModel):\n \"\"\"\"\n...
python
chosen
[ { "from": "system", "value": "Add a __repr__ for RepositorySearchResult\n" }, { "from": "human", "value": "# -*- coding: utf-8 -*-\nfrom github3.models import GitHubCore\nfrom github3.repos import Repository\n\n\nclass RepositorySearchResult(GitHubCore):\n def __init__(self, data, session=Non...
python
chosen
[ { "from": "system", "value": "Fix massive bug in initialization\n" }, { "from": "human", "value": "# -*- coding: utf-8 -*-\n\n\nclass Heap(object):\n \"\"\"Implements a heap data structure in Python.\n\n The underlying data structure used to hold the data is an array.\n \"\"\"\n\n __heap = [...
python
chosen
[ { "from": "system", "value": "Improve usability of coordinator designation interaction\n\nI'm limiting the dropdown to actual coordinators so that admins don't\nhave to scroll through a giant list. I don't want to enforce/validate\nthis on the database level, though, as people may proceed through the\ncoord...
python
chosen
[ { "from": "system", "value": "Add some logging calls to the setting reading\n" }, { "from": "human", "value": "import os\n\n\ndef read_setting_from_env(settings, key, default=None):\n env_variable = key.upper()\n if env_variable in os.environ:\n return os.environ[env_variable]\n ...
python
chosen
[ { "from": "system", "value": "Add contrib.auth to test settings\n" }, { "from": "human", "value": "SECRET_KEY = 'dog'\n\nDATABASES = {\n 'default': {\n 'ENGINE': 'django.db.backends.sqlite3',\n }\n}\n\nCHANNEL_LAYERS = {\n 'default': {\n 'BACKEND': 'asgiref.inmemory.Channe...
python
chosen
[ { "from": "system", "value": "Update regex to match only UUIDs\n" }, { "from": "human", "value": "\"\"\"\nURL configuration for the JASMIN notifications app.\n\"\"\"\n\n__author__ = \"Matt Pryor\"\n__copyright__ = \"Copyright 2015 UK Science and Technology Facilities Council\"\n\nfrom django.con...
python
chosen
[ { "from": "system", "value": "Add domaintools to the import list\n" }, { "from": "human", "value": "from . import _vmray\n\n__all__ = ['vmray_submit', 'asn_history', 'circl_passivedns', 'circl_passivessl', 'countrycode', 'cve', 'dns',\n 'eupi', 'ipasn', 'passivetotal', 'sourcecache', '...
python
chosen
[ { "from": "system", "value": "Switch to headless UI testing by default\n" }, { "from": "human", "value": "\nfrom splinter import Browser\nimport urlparse\n\nfrom django.core.urlresolvers import reverse\nfrom django.test import LiveServerTestCase\n\n\nclass UITestCase(LiveServerTestCase):\n\n ...
python
chosen
[ { "from": "system", "value": "Fix broken import of socket errors\n" }, { "from": "human", "value": "from sockets.socket_closed_exception import SocketClosedException\nfrom sockets.stream_socket import StreamSocket\nimport socket.error\n\n\nfrom groundstation import settings\nimport groundstation...
python
chosen
[ { "from": "system", "value": "Comment email and activated SMS\n" }, { "from": "human", "value": "\n\nimport time\nfrom twilio.rest import TwilioRestClient\nimport smtplib\nfrom email.mime.text import MIMEText\nfrom Environ import config\n\nclass MessageClient(object):\n\n def __init__(self):\...
python
chosen
[ { "from": "system", "value": "Add FloodPlain class to module namespace\n" }, { "from": "human", "value": "from .acidity import Acidity # noqa\nfrom .niche import Niche, NicheDelta # noqa\nfrom .nutrient_level import NutrientLevel # noqa\nfrom .vegetation import Vegetation # noqa\nfrom .version i...
python
chosen
[ { "from": "system", "value": "Remove duplicate keybar host value\n" }, { "from": "human", "value": "from keybar.conf.base import *\n\n\nDATABASES = {\n 'default': {\n 'ENGINE': 'django.db.backends.postgresql_psycopg2',\n 'NAME': 'keybar_test',\n }\n}\n\ncertificates_dir = os....
python
chosen
[ { "from": "system", "value": "Tweak Sentry config to work in development\n\nThis makes a couple of changes:\n\n- Most importantly, it wraps the setup code in a conditional so that\ndevelopers don't need to have a DSN set to start the app locally.\n\n- Secondly, it removes the redundant call to \"set_level\"...
python
chosen
[ { "from": "system", "value": "Test cases specified for io\n" }, { "from": "human", "value": "# pcode_io.py 19/01/2016 D.J.Whale\n\n# simplest possible implementation. Only really works well\n# for small files.\n\ndef readline(filename, lineno):\n f = open(filename)\n lines = f.readlines(...
python
chosen
[ { "from": "system", "value": "comment_parser: Add __repr__ to Comment class.\n" }, { "from": "human", "value": "#!/usr/bin/python\n\"\"\"This module provides constructs common to all comment parsers.\"\"\"\n\n\nclass Error(Exception):\n \"\"\"Base Error class for all comment parsers.\"\"\"\n ...
python
chosen
[ { "from": "system", "value": "Rename Route model's start and end fields to be consistent with front end identification\n" }, { "from": "human", "value": "from django.db import models\n\n\n# Route model\n# Start and end locations with additional stop-overs\nclass Route(models.Model):\n origin ...
python
chosen
[ { "from": "system", "value": "Move hackish clobbering to the script that calls the dartium annotated steps\n\nAlso clean it up, we don't have any builders that starts with release\n\nI will remove this functionality from the dartium annotated step since it does not work correctly. This change allow us to us...
python
chosen
[ { "from": "system", "value": "Add __all__ to measure package\n" }, { "from": "human", "value": "from .find_contours import find_contours\nfrom ._regionprops import regionprops, perimeter\nfrom ._structural_similarity import structural_similarity\nfrom ._polygon import approximate_polygon, subdiv...
python
chosen
[ { "from": "system", "value": "Handle a '+' in organisation slugs\n" }, { "from": "human", "value": "from django.conf.urls import patterns, include, url\n\nfrom pombola.south_africa.views import LatLonDetailView, SAPlaceDetailSub, SAOrganisationDetailView\nfrom pombola.core.urls import organisati...
python
chosen
[ { "from": "system", "value": "Increase form length limits for news item's slug, title, and image URL path\n" }, { "from": "human", "value": "\"\"\"\nbyceps.blueprints.news_admin.forms\n~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\n\n:Copyright: 2006-2019 Jochen Kupperschmidt\n:License: Modified BSD, see L...
python
chosen
[ { "from": "system", "value": "Fix warning message to use 'varify' package instead of 'src'\n" }, { "from": "human", "value": "import os\nfrom global_settings import *\n\ntry:\n from local_settings import *\nexcept ImportError:\n import warnings\n warnings.warn('Local settings have not b...
python
chosen
[ { "from": "system", "value": "Add test for byteswapping bug resolved in r514.\n\n\ngit-svn-id: 5305e2c1a78737cf7dd5f8f44e9bbbd00348fde7@543 ed100bfc-0583-0410-97f2-c26b58777a21\n" }, { "from": "human", "value": "import pyfits\nimport sys\n\ndef test_with_statement():\n if sys.hexversion >= 0x...
python
chosen
[ { "from": "system", "value": "Remove ancient FIXME in `get_cid()`\n\nMaybe I had a great idea in mind when I wrote the comment. Or maybe it\nwas just a vague thought. I guess we'll never know.\n" }, { "from": "human", "value": "from threading import local\n\nfrom django.conf import settings\n\nf...
python
chosen
[ { "from": "system", "value": "Fix unit error, improve precision\n" }, { "from": "human", "value": "from astropy import units as u\n\nfrom numpy.testing import assert_almost_equal\n\nfrom poliastro.bodies import Earth\n\nfrom edelbaum import extra_quantities\n\n\ndef test_leo_geo_time_and_delta_v...
python
chosen
[ { "from": "system", "value": "Add alternative support for open in browser\n\nIntegrate SideBarEnhancements for ST3 for poplarity and browser detection\n" }, { "from": "human", "value": "import sublime\nimport os.path as fs\n\nif int(sublime.version()) < 3000:\n from elm_project import ElmProj...
python
chosen
[ { "from": "system", "value": "Add break duration argument and sleep timeout. Add notification when it is time to get back to work\n" }, { "from": "human", "value": "from pync import Notifier\nfrom time import sleep\nimport argparse\n\n\ndef main():\n parser = argparse.ArgumentParser()\n pa...
python
chosen
[ { "from": "system", "value": "Add docstring to recaptcha check" }, { "from": "human", "value": "from functools import wraps\nfrom django.conf import settings\n\nimport requests\n\n\ndef check_recaptcha(view_func):\n @wraps(view_func)\n def _wrapped_view(request, *args, **kwargs):\n ...
python
chosen
[ { "from": "system", "value": "Tag commit for v0.0.29-master generated by gitmake.py\n" }, { "from": "human", "value": "major = 0\nminor=0\npatch=28\nbranch=\"master\"\ntimestamp=1376705489.59" }, { "from": "gpt", "value": "major = 0\nminor=0\npatch=29\nbranch=\"master\"\ntimestamp=13...
python
chosen
[ { "from": "system", "value": "Reduce response data for HelpLink\n" }, { "from": "human", "value": "from django.contrib.auth.models import User\nfrom rest_framework import serializers\n\nfrom api.models import UserPreferences, HelpLink\n\n\nclass HelpLinkSerializer(serializers.HyperlinkedModelSer...
python
chosen
[ { "from": "system", "value": "Prepend S3 account username to buckets\n" }, { "from": "human", "value": "from boto.s3.connection import S3Connection\nfrom boto.s3.bucket import Bucket\nfrom boto.exception import S3CreateError\n\nfrom django.conf import settings\n\n\ndef upload(user, passwd, bucke...
python
chosen