conversations
listlengths
2
3
source
stringclasses
1 value
stack
stringclasses
1 value
[ { "from": "system", "value": "Fix lint line length warnings (blocking manage checks)\n" }, { "from": "human", "value": "# -*- coding: utf-8 -*-\n# vim: sw=4:ts=4:expandtab\n# pylint: disable=invalid-name\n\"\"\"\ncsv2ofx.mappings.stripe\n~~~~~~~~~~~~~~~~~~~~~~~~\n\nProvides a mapping for transac...
python
chosen
[ { "from": "system", "value": "Add proxy module to __all__.\n\n\ngit-svn-id: 8b0eea19d26e20ec80f5c0ea247ec202fbcc1090@248 5646265b-94b7-0310-9681-9501d24b2df7\n" }, { "from": "human", "value": "# vim:nowrap:textwidth=0\n#\n# Sheared -- non-blocking network programming library for Python\n# Copyri...
python
chosen
[ { "from": "system", "value": "Fix the --verbose argument to properly take an int\n\nWithout this, the `i % args.verbose` check would fail since `args.verbose` was\na string\n" }, { "from": "human", "value": "import json\nimport bson.json_util as bju\nimport emission.core.get_database as edb\nimp...
python
chosen
[ { "from": "system", "value": "Add monitoring logo in form\n" }, { "from": "human", "value": "# -*- coding: utf-8 -*-\nfrom atom.ext.crispy_forms.forms import FormHorizontalMixin, SingleButtonMixin\nfrom braces.forms import UserKwargModelFormMixin\nfrom dal import autocomplete\nfrom django import...
python
chosen
[ { "from": "system", "value": "Update magic methods, and reorg args.\n" }, { "from": "human", "value": "class Node(object):\n def __init__(self, val, next=None):\n self.val = val\n self.next = next\n\n def __repr__(self):\n return '{val}'.format(val=self.val)\n\n\nclass...
python
chosen
[ { "from": "system", "value": "Swap out CometHandler for BroadcastCometHandler in the Spritzer demo.\n" }, { "from": "human", "value": "import os\n\nPROJECT_ROOT = os.path.abspath(os.path.dirname(__file__))\n\nHANDLERS = (\n 'spritzer.spritzer_handler.SpritzerHandler',\n 'hurricane.handlers...
python
chosen
[ { "from": "system", "value": "Hide Exscript.protocols.AbstractMethod from the API docs.\n" }, { "from": "human", "value": "#!/usr/bin/env python\n# Generates the API documentation.\nimport os, re, sys\n\nproject = 'Exscript'\nbase_dir = os.path.join('..', 'src', project)\ndoc_dir = 'api'\n\n# ...
python
chosen
[ { "from": "system", "value": "Update for function name change in Django 1.8\n" }, { "from": "human", "value": "from django import template\n\nregister = template.Library()\n\n\"\"\"\nCopied these from django/contrib/admin/templates/templatetags/admin_urls.\nThese are utility functions for genera...
python
chosen
[ { "from": "system", "value": "Fix API method names called by World.block_at\n" }, { "from": "human", "value": "import alltheitems.__main__ as ati\n\nimport api.v2\nimport enum\nimport minecraft\n\nclass Dimension(enum.Enum):\n overworld = 0\n nether = -1\n end = 1\n\nclass World:\n d...
python
chosen
[ { "from": "system", "value": "Handle no nearby users gracefully.\n" }, { "from": "human", "value": "from time import time\nfrom datetime import timedelta\n\nfrom . import api\nfrom . import models\n\n\nclass Session(object):\n\n def __init__(self, facebook_id, facebook_token, proxies=None):\n...
python
chosen
[ { "from": "system", "value": "Update fixture server with environ route.\n\nMinor changes to docstrings and change in quotation usage.\nRouter imported from aragog, not routing.decorator.\n" }, { "from": "human", "value": "\"\"\"\nTests against the URL Router\n\"\"\"\n\nfrom wsgiref.simple_server...
python
chosen
[ { "from": "system", "value": "Fix unittest for true headers..\n" }, { "from": "human", "value": "from twisted.trial import unittest\n\nfrom ooni.utils.txagentwithsocks import TrueHeaders\n\ndummy_headers_dict = {\n 'Header1': ['Value1', 'Value2'],\n 'Header2': ['ValueA', 'ValueB']\...
python
chosen
[ { "from": "system", "value": "Fix build on systems without a \"python\" executable\n\nThis script is technically 2/3 compatible, but 3 is required to build anyway,\nso whatever.\n" }, { "from": "human", "value": "#!/usr/bin/env python\n\n# Copyright 2021 David Robillard <d@drobilla.net>\n# SPDX-...
python
chosen
[ { "from": "system", "value": "Fix network quota test so it works on gate\n\nThe gate does not create quotas by default, but devstack does.\nThis test is not important enough to make work for the gate which\nwould probably require some reconfiguration, but it is nice to\nhave it for devstack.\n\nChange-Id: I...
python
chosen
[ { "from": "system", "value": "Mark master branch as 1.26.0.dev0 for RTD" }, { "from": "human", "value": "# This file is protected via CODEOWNERS\n__version__ = \"1.25.9\"\n" }, { "from": "gpt", "value": "# This file is protected via CODEOWNERS\n__version__ = \"1.26.0.dev0\"\n" } ]
python
chosen
[ { "from": "system", "value": "DOC: Fix unicode in citation (again)\n" }, { "from": "human", "value": "\"\"\"\nDefine citations for ESPEI\n\"\"\"\n\nESPEI_CITATION = \"B. Bocklund, R. Otis, A. Egorov, A. Obaied, I. Roslyakova, Z.-K. Liu, ESPEI for efficient thermodynamic database development, mod...
python
chosen
[ { "from": "system", "value": "Add inter-hive communication lotsamessages test\n" }, { "from": "human", "value": "from xudd.demos import special_hive\nfrom xudd.demos import lotsamessages\n\ndef test_special_hive():\n \"\"\"\n This demo tests that demos are actually actors and are in fact s...
python
chosen
[ { "from": "system", "value": "Make the description of the tests package more precise.\n" }, { "from": "human", "value": "\"\"\"\n tests\n ~~~~~\n\n Unit tests for the project.\n\n :copyright: © 2015 by Petr Zemek <s3rvac@gmail.com> and contributors\n :license: MIT, see the ``LICEN...
python
chosen
[ { "from": "system", "value": "Fix repr test for py34.\n" }, { "from": "human", "value": "import unittest\n\nfrom kiel.protocol import primitives\n\n\nclass PrimitivesTests(unittest.TestCase):\n\n def test_string_repr(self):\n s = primitives.String(u\"foobar\")\n\n self.assertEqu...
python
chosen
[ { "from": "system", "value": "Make our IFrameWidget more configurable\n" }, { "from": "human", "value": "# This file is part of Moksha.\n# Copyright (C) 2008-2009 Red Hat, Inc.\n#\n# This program is free software: you can redistribute it and/or modify\n# it under the terms of the GNU Affero Gen...
python
chosen
[ { "from": "system", "value": "STYLE: Fix missing line at end of file\n\nFix missing line\r\nRemove whitespace" }, { "from": "human", "value": "\"\"\"\nTests corresponding to sandbox.stats.runs\n\"\"\"\nfrom numpy.testing import assert_almost_equal\nfrom statsmodels.sandbox.stats.runs import runs...
python
chosen
[ { "from": "system", "value": "[pinpoint] Move Job handler out of exception block.\n\nThe exception block is solely used for Job loading exceptions.\n\nReview-Url: https://codereview.chromium.org/2768293003\n" }, { "from": "human", "value": "# Copyright 2016 The Chromium Authors. All rights reser...
python
chosen
[ { "from": "system", "value": "Print message if module is run on its own\n" }, { "from": "human", "value": "from nytapi import *\n\n__version__ = \"1.0.0\"\n__author__ = \"Matt Morrison @MattDMo mattdmo@mattdmo.com\"\n__all__ = [\"articleAPI\"]\n" }, { "from": "gpt", "value": "from se...
python
chosen
[ { "from": "system", "value": "Add more tests around ignored names\n" }, { "from": "human", "value": "#: Okay\ndef ok():\n pass\n#: N802\ndef __bad():\n pass\n#: N802\ndef bad__():\n pass\n#: N802\ndef __bad__():\n pass\n#: Okay\ndef _ok():\n pass\n#: Okay\ndef ok_ok_ok_ok():\n ...
python
chosen
[ { "from": "system", "value": "Add support for retrieving a Checkout Session\n" }, { "from": "human", "value": "from __future__ import absolute_import, division, print_function\n\nimport stripe\n\n\nTEST_RESOURCE_ID = \"loc_123\"\n\n\nclass TestSession(object):\n def test_is_creatable(self, re...
python
chosen
[ { "from": "system", "value": "Change exception from RecipeError to SystemExit\n" }, { "from": "human", "value": "import os\n\nimport pytest\n\nfrom conda_verify import utilities\nfrom conda_verify.errors import RecipeError\nfrom conda_verify.verify import Verify\n\n\n@pytest.fixture\ndef recipe_...
python
chosen
[ { "from": "system", "value": "Order locations and districts by name\n" }, { "from": "human", "value": "from django.db import models\nfrom django.utils.translation import ugettext_lazy as _\n\n\nclass District(models.Model):\n name = models.CharField(_('Name'), max_length=255, unique=True)\n\n...
python
chosen
[ { "from": "system", "value": "Enforce endianess when converting IPs to long.\n\ngit-svn-id: 21715c51dd601a1fb57681abbfe4e8ed6f4259bf@205 4c10cf09-d433-0410-9a0a-09c53010615a\n" }, { "from": "human", "value": "import socket, struct, math\n\ndef _least_bit(number):\n for n in range(0, 31):\n ...
python
chosen
[ { "from": "system", "value": "Add prefix to headshot filenames for easy exclusion from gitignore\n" }, { "from": "human", "value": "from django.core.management.base import BaseCommand, CommandError\nfrom django.core.files import File\nfrom django.conf import settings\n\n\nfrom opencivicdata.core...
python
chosen
[ { "from": "system", "value": "Send a newline with configuration commands.\n" }, { "from": "human", "value": "import logging\nimport os\n\nfrom lobster import util\nfrom lobster.core.command import Command\nfrom lockfile import AlreadyLocked\n\nclass Configure(Command):\n @property\n def he...
python
chosen
[ { "from": "system", "value": "Make the counter migration safer." }, { "from": "human", "value": "import json\nfrom redash import models\n\nif __name__ == '__main__':\n for vis in models.Visualization.select():\n if vis.type == 'COUNTER':\n options = json.loads(vis.options)\n...
python
chosen
[ { "from": "system", "value": "Fix pyflakes complaining of imported but unused module.\n" }, { "from": "human", "value": "# Copyright 2014-2015 Open Source Robotics Foundation, Inc.\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may not use this file except in comp...
python
chosen
[ { "from": "system", "value": "Add snapshot feature on s key press\nAdd recording feature\n" }, { "from": "human", "value": "import cv2\n\ncv2.namedWindow(\"preview\")\n\nvc = cv2.VideoCapture(0)\n\nif vc.isOpened(): # try to get the first frame\n rval, frame = vc.read()\nelse:\n rval = Fal...
python
chosen
[ { "from": "system", "value": "Fix filename instead of path in meta\n" }, { "from": "human", "value": "\nimport os\nimport hashlib\nimport magic\nfrom datetime import datetime\n\nfrom .settings import METADATA_PATH\nfrom .meta import get_meta\nfrom .encryption import copy_and_encrypt, decrypt_blo...
python
chosen
[ { "from": "system", "value": "Add a click() call to an example test\n" }, { "from": "human", "value": "from seleniumbase import BaseCase\r\n\r\n\r\nclass TestMFALogin(BaseCase):\r\n def test_mfa_login(self):\r\n self.open(\"https://seleniumbase.io/realworld/login\")\r\n self.typ...
python
chosen
[ { "from": "system", "value": "Move message id generation to requestmanager\n" }, { "from": "human", "value": "class Jsonrpc(object):\n\n def __init__(self):\n self.messageId = 0\n\n @staticmethod\n def getInstance():\n return Jsonrpc()\n\n def toPayload(self, method, pa...
python
chosen
[ { "from": "system", "value": "Add `clowder yaml` logic to Cement controller\n" }, { "from": "human", "value": "from cement.ext.ext_argparse import expose\n\nfrom clowder.cli.abstract_base_controller import AbstractBaseController\n\n\nclass YAMLController(AbstractBaseController):\n class Meta:...
python
chosen
[ { "from": "system", "value": "Remove out of date comment.\n" }, { "from": "human", "value": "# Licensed to the StackStorm, Inc ('StackStorm') under one or more\n# contributor license agreements. See the NOTICE file distributed with\n# this work for additional information regarding copyright own...
python
chosen
[ { "from": "system", "value": "Update the maximum allowed length for file name in sanitizer test\n" }, { "from": "human", "value": "from tempfile import TemporaryDirectory\n\nfrom expects import expect\nfrom hypothesis import given, assume, example\nfrom hypothesis.strategies import text, charact...
python
chosen
[ { "from": "system", "value": "Fix backward compatibility of migrations\n" }, { "from": "human", "value": "# -*- coding: utf-8 -*-\n# Generated by Django 1.10.6 on 2017-03-17 18:27\nfrom __future__ import unicode_literals\n\nimport django.contrib.auth.validators\nfrom django.db import migrations,...
python
chosen
[ { "from": "system", "value": "Revert \"Turn on DEBUG mode\"\n\nThis reverts commit 1c0e3251c3b502375a9738508f20a18ed58532ec.\n" }, { "from": "human", "value": "import dj_database_url\n\nfrom .base import *\n\n\nDEBUG = True\n\nALLOWED_HOSTS = ['*']\n\nMIDDLEWARE = MIDDLEWARE + [\n 'whitenoise...
python
chosen
[ { "from": "system", "value": "Reduce log level on OpenShift\n" }, { "from": "human", "value": "#!/usr/bin/env python3\n\nimport os\nimport logging\n\nfrom sqlalchemy import create_engine\n\nfrom portingdb import load\nfrom portingdb import htmlreport\n\nlevel = logging.DEBUG\nlogging.basicConfig...
python
chosen
[ { "from": "system", "value": "Add closing and argument for serial port\n" }, { "from": "human", "value": "#!/usr/bin/env python\nfrom daemon import Daemon, SerialDispatcher\nfrom serial import Serial\nfrom threading import Thread\nimport sys\n\ndef callback(event):\n print(\"EVENT: {0.house}{...
python
chosen
[ { "from": "system", "value": "Make sure we cleanup even if fails in example\n" }, { "from": "human", "value": "\"\"\"\nThis example:\n\n1. Connects to the current model\n2. Deploy a local charm with a oci-image resource and waits until it reports\n itself active\n3. Destroys the unit and appli...
python
chosen
[ { "from": "system", "value": "Use `html.escape` instead of the deprecated `cgi.escape`.\n" }, { "from": "human", "value": "# -*- coding: utf-8 -*-\n\n\"\"\"\nbyceps.blueprints.board.formatting\n~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\n\n:Copyright: 2006-2015 Jochen Kupperschmidt\n:License: Modified B...
python
chosen
[ { "from": "system", "value": "Add system support to export talkgroups\n" }, { "from": "human", "value": "import sys\nimport datetime\nimport csv\n\nfrom django.core.management.base import BaseCommand, CommandError\nfrom django.conf import settings\nfrom django.utils import timezone\nfrom radio.m...
python
chosen
[ { "from": "system", "value": "Add utility function for executable checking\n" }, { "from": "human", "value": "# -*- coding: utf-8 -*-\n\"\"\"\n pytest_pipeline.utils\n ~~~~~~~~~~~~~~~~~~~~~\n\n General utilities.\n\n :copyright: (c) 2014 Wibowo Arindrarto <bow@bow.web.id>\n :licen...
python
chosen
[ { "from": "system", "value": "Fix python data provider test\n" }, { "from": "human", "value": "# -*- coding: utf-8 -*-\n\nimport stromx.runtime as sr\n\nstream = sr.Stream()\nstream.setName(\"My stream\")\ndata = \"dfdsfdsds\\nkljöklöjkfldsjf\"\nfactory = sr.Factory()\n\nwith sr.ZipFileOutput(\"...
python
chosen
[ { "from": "system", "value": "tests: Use only 1 IMAP connection by default\n\nWe don't want to hammmer IMAP servers for the test series too much\nto avoid being locked out. We will need a few tests to test\nconcurrent connections, but by default one connection should be fine.\n\nSigned-off-by: Sebastian Spa...
python
chosen
[ { "from": "system", "value": "Add tests for all builtins\n" }, { "from": "human", "value": "import pytest\n\nimport sncosmo\n\n\n@pytest.mark.might_download\ndef test_hst_bands():\n \"\"\" check that the HST and JWST bands are accessible \"\"\"\n for bandname in ['f606w', 'uvf606w', 'f125...
python
chosen
[ { "from": "system", "value": "Use TensorFlow's test utilities and add a test for the L1 projection to simplex.\n" }, { "from": "human", "value": "from amii_tf_nn.projection import l1_projection_to_simplex\nimport tensorflow as tf\nimport pytest\n\n\ndef test_l1_no_negative():\n patient = l1_p...
python
chosen
[ { "from": "system", "value": "Use timezone aware datetime now.\n" }, { "from": "human", "value": "import datetime\n\nfrom django.db import models\n\n\nclass TwilioResponse(models.Model):\n date = models.DateTimeField()\n message = models.CharField(max_length=64, primary_key=True)\n acco...
python
chosen
[ { "from": "system", "value": "Make compiler invocation more Makefile-friendly\n" }, { "from": "human", "value": "from redux.codegenerator import compile_script\nfrom argparse import ArgumentParser\nfrom os.path import splitext\n\nparser = ArgumentParser(description='Compile a Redux script to Res...
python
chosen
[ { "from": "system", "value": "DOC: Add Take node to the node list in API doc\n" }, { "from": "human", "value": "################################################################################\n# Copyright (C) 2013 Jaakko Luttinen\n#\n# This file is licensed under the MIT License.\n#############...
python
chosen
[ { "from": "system", "value": "Check proper error when accessing source without instance\n" }, { "from": "human", "value": "from djangosanetesting.cases import DatabaseTestCase\n\nfrom djangomarkup.fields import RichTextField\nfrom djangomarkup.models import SourceText\n\nfrom exampleapp.models i...
python
chosen
[ { "from": "system", "value": "[REF] openacademy: Modify copy method into inherit\n" }, { "from": "human", "value": "from openerp import models, fields, api\n'''\nThis module create model of Course\n'''\n\nclass Course(models.Model):\n '''\n This class create model of Course\n '''\n ...
python
chosen
[ { "from": "system", "value": "Make sure land filters are setup when testing\n" }, { "from": "human", "value": "# -*- coding: utf-8 -*-\nfrom geotrek.land.tests.test_filters import LandFiltersTest\n\nfrom geotrek.trekking.filters import TrekFilterSet\nfrom geotrek.trekking.factories import TrekFa...
python
chosen
[ { "from": "system", "value": "Fix getting host ip on linux\n" }, { "from": "human", "value": "import asyncio\nimport os\nimport logging\nimport re\n\nimport dns.resolver\n\nlogging.basicConfig()\n\nfrom .server import HTTPServer\nfrom .mapper import update_config, add_container\n\nlogger = loggi...
python
chosen
[ { "from": "system", "value": "Remove numberToString/stringToNumber in pycrypto support package and add some int to long conversions so it can happily pass the tests (I bet this is enough to get it working)\n" }, { "from": "human", "value": "# Author: Trevor Perrin\n# See the LICENSE file for leg...
python
chosen
[ { "from": "system", "value": "Use MD5 password hasher for test runs\n" }, { "from": "human", "value": "from hellomama_registration.settings import * # flake8: noqa\n\n# SECURITY WARNING: keep the secret key used in production secret!\nSECRET_KEY = 'TESTSEKRET'\n\n# SECURITY WARNING: don't run w...
python
chosen
[ { "from": "system", "value": "Fix typo with return instead of raise\n" }, { "from": "human", "value": "__author__ = 'skird'\n\n\nclass ExplanationStorage:\n \"\"\"\n Interface of abstract readable/writeable resource\n Every resource is a map from string to list of strings\n It suppor...
python
chosen
[ { "from": "system", "value": "Add little bit comments for Planet model\n" }, { "from": "human", "value": "from django.db import models\nfrom django.utils.baseconv import base64\nfrom django_base64field.fields import Base64Field\n\n\nclass Planet(models.Model):\n ek = Base64Field()\n name =...
python
chosen
[ { "from": "system", "value": "Update dao to order by updated_at, number\n" }, { "from": "human", "value": "from app import db\nfrom app.dao.dao_utils import transactional\nfrom app.models import InboundNumber\n\n\ndef dao_get_inbound_numbers():\n return InboundNumber.query.all()\n\n\ndef dao_...
python
chosen
[ { "from": "system", "value": "Make C11 default. pio should actually do this.\n\nSigned-off-by: David Graeff <cddf4d21ffd604ccd3fdffe1267f1f9d72e179ea@web.de>\n" }, { "from": "human", "value": "Import('env')\nenv.Append(CXXFLAGS=[\"-std=c++11\"], CPPPATH=[\"src/wakaama\", \"wakaama\"])\n" }, ...
python
chosen
[ { "from": "system", "value": "Use view's function instead of its name\n" }, { "from": "human", "value": "from django.conf.urls.defaults import *\n\nurlpatterns = patterns('',\n (r'^profile/$', 'epiweb.apps.survey.views.profile_index'),\n (r'^thanks/$', 'epiweb.apps.survey.views.thanks'),\n...
python
chosen
[ { "from": "system", "value": "Simplify code loading MNIST dataset.\n" }, { "from": "human", "value": "import os\nimport gzip\nimport pickle\nimport sys\n\n# Python 2/3 compatibility.\ntry:\n from urllib.request import urlretrieve\nexcept ImportError:\n from urllib import urlretrieve\n\n\n'...
python
chosen
[ { "from": "system", "value": "Fix the profile test to log in as the test user." }, { "from": "human", "value": "import fudge\n\nfrom django.test import TestCase, Client\nfrom django.core.urlresolvers import reverse\nfrom django.contrib.auth.models import User\n\nfrom users.models import Profile,...
python
chosen
[ { "from": "system", "value": "Remove the requests dependency altogether.\n\n(Makes no sense for such small a tool.)\n" }, { "from": "human", "value": "from functools import partial\nimport subprocess\nimport requests\nimport multiprocessing\nimport json\n\n\ndef get_pkg_info(pkg_name, session):\...
python
chosen
[ { "from": "system", "value": "Add environment name to Sentry client\n\nSkyliner provides the ENV environment variable for our application,\nwhich contains either \"prod\" or \"qa\" depending on the environment.\n\nSentry supports partitioning reports based on the environment within a\nsingle application. Ad...
python
chosen
[ { "from": "system", "value": "Add forgotten program file for deployment\n" }, { "from": "human", "value": "\"\"\"\nBenchExec is a framework for reliable benchmarking.\nThis file is part of BenchExec.\nCopyright (C) 2007-2015 Dirk Beyer\nAll rights reserved.\nLicensed under the Apache License, V...
python
chosen
[ { "from": "system", "value": "Mark release as beta in setup.py\n" }, { "from": "human", "value": "__title__ = \"kiteconnect\"\n__description__ = \"The official Python client for the Kite Connect trading API\"\n__url__ = \"https://kite.trade\"\n__download_url__ = \"https://github.com/zerodhatech/...
python
chosen
[ { "from": "system", "value": "Update a version number from trunk r9016\n\ngit-svn-id: 9a050473c2aca1e14f53d73349e19b938c2cf203@9040 6a7f98fc-eeb0-4dc1-a6e2-c2c589a08aa6\n" }, { "from": "human", "value": "# -*- coding: utf-8 -*-\n\n__version__ = '$Id$'\n\nimport family\n\n# The Wikia Search fami...
python
chosen
[ { "from": "system", "value": "Remove SQLite database before running tests\n" }, { "from": "human", "value": "# -*- Mode: Python -*-\n\nimport os\nimport glob\nimport sys\nimport shutil\n\nimport unittest\n\ntestLoader = unittest.TestLoader()\n\nnames = []\nfor filename in glob.iglob(\"test_*.py\...
python
chosen
[ { "from": "system", "value": "Add testing for default grid_* values\n" }, { "from": "human", "value": "def test_rover_init_with_default_parameters():\n from rover import Rover\n rover = Rover()\n assert rover.x == 0\n assert rover.y == 0\n assert rover.direction == 'N'\n\ndef test...
python
chosen
[ { "from": "system", "value": "Fix flake8 error by adding extra line\n" }, { "from": "human", "value": "import os\n\ndef export_envs(request):\n data = {}\n data['FULLSTORY_ORG_ID'] = os.getenv('FULLSTORY_ORG_ID', '')\n return data\n" }, { "from": "gpt", "value": "import os\n...
python
chosen
[ { "from": "system", "value": "Tweak wording of password prompt\n\niCloud is branded with a lower case 'i' like most other Apple products.\n" }, { "from": "human", "value": "import getpass\nimport keyring\n\nfrom .exceptions import NoStoredPasswordAvailable\n\n\nKEYRING_SYSTEM = 'pyicloud://iclou...
python
chosen
[ { "from": "system", "value": "Use Computer Modern for \\LaTeX macro\n\nSource Sans pro (and most othe sans-serif fonts) render the LaTeX macro\npretty weirdly, so the classic Computer Modern should be okay here. It\nmay wind up being an odd contrast in an otherwise sans-serif document\nthough, so this may ...
python
chosen
[ { "from": "system", "value": "Add missing models to __all__ list\n" }, { "from": "human", "value": "#!/usr/bin/env python\n# -*- coding: utf-8 -*-\n\"\"\"\nImport all of the models from submodules and thread them together.\n\"\"\"\nfrom calaccess_processed.models.campaign.entities import (\n ...
python
chosen
[ { "from": "system", "value": "Update docstring for creating hosted graphite dashboards\n" }, { "from": "human", "value": "#!/usr/bin/env python\n# -*- coding: utf-8 -*-\n\"\"\"\nDescription:\n To add\n\nUsage:\n scripts/create-hosted-graphite-dashboards.py <hosted_graphite_api_key>\n\nExam...
python
chosen
[ { "from": "system", "value": "Move from celery task to regular-old function\n" }, { "from": "human", "value": "import urlparse\n\nimport celery\nimport requests\nfrom celery.utils.log import get_task_logger\nfrom api.base import settings\n\nfrom framework.tasks import app as celery_app\n\nlogger...
python
chosen
[ { "from": "system", "value": "Use a tuple instead of a list for protocol membership test\n" }, { "from": "human", "value": "# -*- coding: utf-8 -*-\n\nimport KISSmetrics\nfrom KISSmetrics import request\nfrom urllib3 import PoolManager\n\n\nclass Client:\n\n def __init__(self, key, trk_host=K...
python
chosen
[ { "from": "system", "value": "Make sure we import qtpy before importing any Qt wrappers directly" }, { "from": "human", "value": "import os\n\n\ndef pytest_configure(config):\n if 'USE_QT_API' in os.environ:\n os.environ['QT_API'] = os.environ['USE_QT_API'].lower()\n\n\ndef pytest_repo...
python
chosen
[ { "from": "system", "value": "Update settings for tinymce to allow show_blog_latest tag\n" }, { "from": "human", "value": "# if you want support for tinymce in the admin pages\n# add tinymce to the installed apps (after installing if needed)\n# and then import these settings, or copy and adjust ...
python
chosen
[ { "from": "system", "value": "Remove commented code [ci skip].\n" }, { "from": "human", "value": "\"\"\"From http://stackoverflow.com/a/12260597/400691\"\"\"\nimport sys\n\nfrom django.conf import settings\n\n\nsettings.configure(\n DATABASES={\n 'default': {\n 'ENGINE': 'dj...
python
chosen
[ { "from": "system", "value": "Append event merging on splash_events\n" }, { "from": "human", "value": "import datetime\nfrom django.shortcuts import render\nfrom apps.splash.models import SplashEvent, SplashYear\n\n\ndef index(request):\n # I'm really sorry ...\n splash_year = SplashYear.o...
python
chosen
[ { "from": "system", "value": "Make chapter validator loop over all chapter files in the knowledge model\n" }, { "from": "human", "value": "# Testing jsonschema error printing capabilities\nimport jsonschema\nimport json\n\n\n# Custom printing of errors (skip no-information messages)\n# TODO: sol...
python
chosen
[ { "from": "system", "value": "Set the DEBUG store setting\n" }, { "from": "human", "value": "# -*- coding: utf-8 -*-\nfrom django.conf import settings\n\n\nPAGINATE_BY = getattr(settings, 'STORE_PAGINATE_BY', 50)\nIS_MULTILINGUAL = getattr(settings, 'STORE_IS_MULTILINGUAL', False)\nHAS_CURRENCIE...
python
chosen
[ { "from": "system", "value": "Fix registration form replay issue\n" }, { "from": "human", "value": "from django.shortcuts import render, redirect\nfrom django.conf import settings\nfrom django.views import View\nfrom members.programmes import DEGREE_PROGRAMME_CHOICES\nfrom registration.forms imp...
python
chosen
[ { "from": "system", "value": "Append a trailing newline to the project directory\n" }, { "from": "human", "value": "\"\"\"\nCopyright 2010 Jason Chu, Dusty Phillips, and Phil Schalm\n\nLicensed under the Apache License, Version 2.0 (the \"License\");\nyou may not use this file except in complian...
python
chosen
[ { "from": "system", "value": "Add js_externs parameter for API\n" }, { "from": "human", "value": "#!/usr/local/bin/python3\n\nimport http.client, urllib.parse, sys, argparse\n\ndef main():\n parser = argparse.ArgumentParser()\n parser.add_argument(\"--js\", default='/dev/stdin', help=\"Inp...
python
chosen
[ { "from": "system", "value": "Remove try/except that should never be hit.\n\nIncreases code coverage.\n" }, { "from": "human", "value": "# -*- coding: utf-8 -*-\n\"\"\"Format adapter for the terminaltables module.\"\"\"\n\nimport terminaltables\n\nfrom cli_helpers.utils import filter_dict_by_key...
python
chosen
[ { "from": "system", "value": "Remove extra print in apt\n" }, { "from": "human", "value": "import os\nimport subprocess\nfrom string import find\n\ndef run_command(command):\n p = subprocess.Popen(command, stdout=subprocess.PIPE, stderr=subprocess.PIPE)\n out, err = p.communicate()\n re...
python
chosen
[ { "from": "system", "value": "Simplify detection of keys already bound\n" }, { "from": "human", "value": "class Bindings(object):\n def __init__(self):\n self._bindings = {}\n \n def bind(self, key):\n if key in self:\n raise AlreadyBoundException(\"Cannot rebin...
python
chosen
[ { "from": "system", "value": "PUT services rather than POSTing them\n" }, { "from": "human", "value": "#!/usr/bin/env python\nimport sys\nimport os\nimport requests\nimport multiprocessing\n\n\ndef list_files(directory):\n for root, subdirs, files in os.walk(directory):\n print(\"ROOT:...
python
chosen
[ { "from": "system", "value": "Add unicode representations for tags/positions\n" }, { "from": "human", "value": "from django.db import models\nfrom django.contrib.auth.models import User\n\n\nclass Tag(models.Model):\n description = models.TextField()\n\n\nclass Position(models.Model):\n co...
python
chosen
[ { "from": "system", "value": "Add session setup and teardown fixtures." }, { "from": "human", "value": "# pylint: disable=C0111\nimport pytest\nimport os\nimport tarfile\n\nBASEDIR = os.path.dirname(__file__)\n\n\n@pytest.fixture(autouse=False)\ndef set_up(tmpdir):\n#\tprint BASEDIR\n\ttmpdir.ch...
python
chosen
[ { "from": "system", "value": "Update tests to remove pgf.preamble\n" }, { "from": "human", "value": "import matplotlib\nimport fishbowl\n\n\noriginal = []\nupdated = [r'\\usepackage{mathspec}',\n r'\\setallmainfonts(Digits,Latin,Greek){Arbitrary}']\n\n\ndef test_context_set():\n fis...
python
chosen
[ { "from": "system", "value": "Add warning for skipped tests if pytest not available\n" }, { "from": "human", "value": "from __future__ import division\nimport libtbx.load_env\n\ndef discover_pytests(module):\n try:\n import os\n import pytest\n except ImportError:\n return []\n if 'L...
python
chosen
[ { "from": "system", "value": "Split the documentation compilation into different files\n" }, { "from": "human", "value": "import sys\nimport os\n\n\ndef find_code(text):\n START_TAG = '```lpg'\n END_TAG = '```'\n first_index = text.find(START_TAG)\n if first_index == -1:\n ret...
python
chosen
[ { "from": "system", "value": "Fix nierozpoznawania bledu gracza w pierwszym ruchu\n" }, { "from": "human", "value": "from game import Game\r\nfrom input_con import InputCon\r\nfrom output_con import OutputCon\r\n\r\n\r\nclass Harness():\r\n def __init__(self, output, inputs):\r\n self._game ...
python
chosen