conversations
listlengths
2
3
source
stringclasses
1 value
stack
stringclasses
1 value
[ { "from": "system", "value": "Remove newline character from stdout.\n" }, { "from": "human", "value": "import bcrypt\nimport sys\n\nif len(sys.argv) < 2:\n print('Error: please provide a password.', file=sys.stderr)\n sys.exit(2)\npassword = sys.argv[1]\nstrength = None\nif len(sys.argv) >...
python
chosen
[ { "from": "system", "value": "Refactor: Move some construction to __init__." }, { "from": "human", "value": "#!/usr/bin/python\nimport urlparse\nimport curie\nimport link\n\nclass Document(object):\n def expand_curie(self, link):\n return self.curie.expand(link)\n\n @classmethod\n ...
python
chosen
[ { "from": "system", "value": "Add default value for simulation time\n\n" }, { "from": "human", "value": "#!/usr/bin/env python\nTRAJECTORY = 'linear'\nCONTROLLER = 'euler'\n\n# control constants\nK_X = 0.90\nK_Y = 0.90\nK_THETA = 0.90\n\n# PID control constants\nK_P_V = 0.2\nK_I_V = 1.905\nK_D_V...
python
chosen
[ { "from": "system", "value": "Fix tests for python 3\n" }, { "from": "human", "value": "import re\n\nimport sh\n\nfrom .base import DjangoCookieTestCase\n\n\nclass TestCookiecutterSubstitution(DjangoCookieTestCase):\n \"\"\"Test that all cookiecutter instances are substituted\"\"\"\n\n def...
python
chosen
[ { "from": "system", "value": "Increase timeout to 10 hours (temporarily).\n\nThe job is expected to take 3-4 hours, but was intermittently\ntiming out at 6 hours. Increase to 10 hours while profiling and\ndebugging the job.\n" }, { "from": "human", "value": "from airflow import DAG\nfrom datetim...
python
chosen
[ { "from": "system", "value": "FIX : kwarg pb with annot contour in example\n" }, { "from": "human", "value": "import os\nfrom os.path import join as pjoin\nfrom surfer import io\nfrom surfer import viz\n\nsubj_dir = os.environ[\"SUBJECTS_DIR\"]\nsubject_id = 'fsaverage'\n\nsub = 'fsaverage'\nhem...
python
chosen
[ { "from": "system", "value": "Add SECRET_KEY which is required by Django 1.5.\n" }, { "from": "human", "value": "import os\nfrom settings import *\n\n# This needs to point at the test riak buckets.\nVUMI_API_CONFIG['riak_manager'] = {'bucket_prefix': 'test.'}\nVUMI_API_CONFIG['redis_manager'] = ...
python
chosen
[ { "from": "system", "value": "Remove old pipeline and compressor settings\n\nlibsass has a compresssion mode that's enabled by default in the 0.3\ndc base theme. This removes the need for uglifyjs\n" }, { "from": "human", "value": "from dc_theme.settings import get_pipeline_settings\nfrom dc_the...
python
chosen
[ { "from": "system", "value": "Change static directory, commented mongo dev stuff\n" }, { "from": "human", "value": "\"\"\"\nMain entry point of the logup-factory\n\"\"\"\n\nfrom flask import Flask\nfrom flask.ext.mongoengine import MongoEngine\n\nfrom flask import request\nfrom flask import rend...
python
chosen
[ { "from": "system", "value": "Remove some needless code from course extension tests\n" }, { "from": "human", "value": "import pytest\nfrom django.conf import settings\nfrom django.core.management import call_command\n\nfrom events.tests.conftest import (administrative_division, administrative_di...
python
chosen
[ { "from": "system", "value": "Use console highlighting in example\n" }, { "from": "human", "value": "# Copyright Hybrid Logic Ltd. See LICENSE file for details.\n\n\"\"\"\nSphinx extension to add a ``version-code-block`` directive\n\nThis directive allows Flocker's release version to be inserte...
python
chosen
[ { "from": "system", "value": "Remove duplicate code, leave comment about circular imports\n" }, { "from": "human", "value": "#!/usr/bin/env python\n# -*- coding: utf-8 -*-\n\nfrom os import environ\nfrom flask import Flask\nfrom flask.ext.mail import Mail\nfrom flask.ext.assets import Environmen...
python
chosen
[ { "from": "system", "value": "Support the new SublimeLinter `code` property\n" }, { "from": "human", "value": "from SublimeLinter.lint import NodeLinter\n\nclass XO(NodeLinter):\n\tnpm_name = 'xo'\n\tcmd = ('xo', '--stdin', '--reporter', 'compact', '--filename', '@')\n\tregex = (\n\t\tr'^.+?: li...
python
chosen
[ { "from": "system", "value": "Reduce direct dependencies on environ\n" }, { "from": "human", "value": "from urllib import parse\nfrom werkzeug.wrappers import Request\n\nfrom lexington.util.di import depends_on\n\n@depends_on(['environ'])\ndef get_request(environ):\n return Request(environ)\n...
python
chosen
[ { "from": "system", "value": "Add psycopg2's version to the comment\n" }, { "from": "human", "value": "# -*- coding: utf-8 -*-\nfrom __future__ import unicode_literals\n\nfrom distutils.version import LooseVersion\nimport re\nfrom django.db import connection\n\nPOSTGRES_FLAG = False\nif str(conn...
python
chosen
[ { "from": "system", "value": "jobs-041: Fix browsable API index regexp\n" }, { "from": "human", "value": "from django.conf import settings\nfrom django.conf.urls import include, url\nfrom django.conf.urls.static import static\nfrom django.contrib import admin\n\nfrom jobs_backend.views import AP...
python
chosen
[ { "from": "system", "value": "Bump version for nested cache fix\n" }, { "from": "human", "value": "\"\"\"\nWextracto is a library for extracting data from web resources.\n\n:copyright: (c) 2012-2016\n\n\"\"\"\n\n__version__ = '0.9.0' # pragma: no cover\n" }, { "from": "gpt", "value"...
python
chosen
[ { "from": "system", "value": "Make sure bot jobs can be deserialized\n" }, { "from": "human", "value": "\"\"\"Heroku web worker.\"\"\"\n\nimport os\nimport redis\n\n\nlisten = ['high', 'default', 'low']\nredis_url = os.getenv('REDIS_URL', 'redis://localhost:6379')\nconn = redis.from_url(redis_ur...
python
chosen
[ { "from": "system", "value": "Add test of deleteing child for nonterminal\n" }, { "from": "human", "value": "#!/usr/bin/env python\n\"\"\"\n:Author Patrik Valkovic\n:Created 31.08.2017 11:55\n:Licence GNUv3\nPart of grammpy\n\n\"\"\"\n\n\nfrom unittest import TestCase, main\nfrom grammpy import ...
python
chosen
[ { "from": "system", "value": "Add choices for challenge category\n" }, { "from": "human", "value": "from django.contrib.auth.models import User\nfrom django.db import models\nimport markdown\n\nfrom core.settings import CHALLENGE_NAME_LENGTH, FLAG_LENGTH, TEAM_NAME_LENGTH\n\n\nclass Challenge(mo...
python
chosen
[ { "from": "system", "value": "Create only one instance of pigpio\n" }, { "from": "human", "value": "from flask import Flask, request\nimport pigpio\napp = Flask(__name__)\n\n#rgb 22, 27, 17\n#base teal 40 97 15\n\nGPIO_RED = 22\nGPIO_GREEN = 27\nGPIO_BLUE = 17\n\ndef to_PWM_dutycycle(string):\n ...
python
chosen
[ { "from": "system", "value": "Correct bug introduced in the previous commit (last update in feed entries).\n" }, { "from": "human", "value": "from google.appengine.ext import db\nfrom google.appengine.api.users import User\n\nclass Cfp(db.Model):\n name = db.StringProperty()\n fullname = d...
python
chosen
[ { "from": "human", "value": "Add load image and create array data\n" }, { "from": "gpt", "value": "from scipy.io import loadmat\nimport numpy as np\nimport keras\nfrom keras.preprocessing.image import load_img, img_to_array\nfrom keras.models import Sequential\nfrom keras.layers import Activatio...
python
chosen
[ { "from": "system", "value": "Make use of array support in script() of LABjs to fix recursion errors\n" }, { "from": "human", "value": "#\n# JavaScript Tools\n# Copyright 2010 Sebastian Werner\n#\n\nfrom js.core.Profiler import *\nimport logging\n\nclass Loader():\n def __init__(self, classLi...
python
chosen
[ { "from": "system", "value": "Add test for using optimizers\n" }, { "from": "human", "value": "# -*- coding: utf-8 -*-\n\nfrom unittest import TestCase\n\nfrom sklearn.svm.classes import LinearSVC\n\nfrom ..Classifier import Classifier\nfrom ...language.Java import Java\n\n\nclass LinearSVCJavaT...
python
chosen
[ { "from": "system", "value": "Fix verbage around why we are disallowing removing a primary\n" }, { "from": "human", "value": "# Copyright (c) 2015 Ansible, Inc.\n# All Rights Reserved\n\nfrom django.core.management.base import CommandError\nfrom awx.main.management.commands._base_instance import...
python
chosen
[ { "from": "system", "value": "Use os.environ['PATH'] instead of sys.path\n" }, { "from": "human", "value": "\"\"\"Test setup.py.\"\"\"\n\n\nimport os\nimport subprocess\nimport sys\n\n\ndef test_setup():\n \"\"\"Run setup.py check.\"\"\"\n command = [sys.executable, 'setup.py', 'check', '-...
python
chosen
[ { "from": "system", "value": "Move a test-skipping decorator over to unittest.skipIf.\n" }, { "from": "human", "value": "import functools\nimport importlib._bootstrap\n\n\nusing___import__ = False\n\n\ndef import_(*args, **kwargs):\n \"\"\"Delegate to allow for injecting different implementat...
python
chosen
[ { "from": "system", "value": "Use previous commit as reference point for updates\n" }, { "from": "human", "value": "import binascii\nimport git\nimport sys\nimport os\nimport logging\n\nlogger = logging.getLogger('root')\n\n__match__ = r\"!update|!reload\"\n\ndef on_message(bot, channel, user, m...
python
chosen
[ { "from": "system", "value": "Make Bispectrum object assign values to attributes\n" }, { "from": "human", "value": "from __future__ import division\nimport numpy as np\n\nfrom stingray import lightcurve\n\nclass Bispectrum(object):\n def __init__(self, lc, maxlag, scale=None):\n \tself.lc ...
python
chosen
[ { "from": "system", "value": "Add printing of active/inactive pins\n" }, { "from": "human", "value": "from RPi import GPIO\n\nGPIO.setmode(GPIO.BCM)\n\nnum_pins = 28\n\npins = range(num_pins)\n\nfor pin in pins:\n GPIO.setup(pin, GPIO.IN, GPIO.PUD_UP)\n\npin_states = {pin: GPIO.input(pin) for...
python
chosen
[ { "from": "system", "value": "Add tests for failing registration forms\n" }, { "from": "human", "value": "import wtforms_json\nimport pytest\n\nfrom forms.RegistrationForm import RegistrationForm\n\nwtforms_json.init()\n\n\nclass TestRegistrationForm:\n\n def test_valid(self):\n json =...
python
chosen
[ { "from": "system", "value": "Append information to the zlib error\n" }, { "from": "human", "value": "from exporters.pipeline.base_pipeline_item import BasePipelineItem\nimport logging\nimport zlib\n\n__all__ = ['BaseDecompressor', 'ZLibDecompressor', 'NoDecompressor']\n\n\nclass BaseDecompresso...
python
chosen
[ { "from": "system", "value": "Add \"form-control\" attribute to some textareas\n" }, { "from": "human", "value": "from django import forms\nfrom django.utils.translation import ugettext as _, ugettext_lazy\nfrom modoboa.lib.exceptions import BadRequest, PermDeniedException\nfrom modoboa.lib.emai...
python
chosen
[ { "from": "system", "value": "Modify abstract parameter to match its children\n\nAll instances of this already accept the parameter, so we should codify\nit as part of the spec.\n" }, { "from": "human", "value": "from __future__ import unicode_literals\nfrom abc import ABCMeta, abstractmethod\n\...
python
chosen
[ { "from": "system", "value": "Add a docstring for `test_rule_linenumber`" }, { "from": "human", "value": "# Copyright (c) 2020 Albin Vass <albin.vass@gmail.com>\n#\n# Permission is hereby granted, free of charge, to any person obtaining a copy\n# of this software and associated documentation fil...
python
chosen
[ { "from": "system", "value": "Fix decode bug in Process() failures\n" }, { "from": "human", "value": "import subprocess as sub\n\nimport logbook\n\nfrom piper.logging import SEPARATOR\n\n\nclass Process(object):\n \"\"\"\n Helper class for running processes\n\n \"\"\"\n\n def __init_...
python
chosen
[ { "from": "system", "value": "Sort punctuation hits so output is based on line and column, not the order rules are checked\n" }, { "from": "human", "value": "#!/usr/bin/python3\n\nimport re\n\nimport wlint.common\nimport wlint.punctuation\n\n\nclass PunctuationStyle(wlint.common.Tool):\n\n de...
python
chosen
[ { "from": "system", "value": "Check content._content before using it to prevent errors\n" }, { "from": "human", "value": "\"\"\"\nEmbedded tweet plugin for Pelican\n=================================\n\nThis plugin allows you to embed Twitter tweets into your articles.\nAnd also provides a link f...
python
chosen
[ { "from": "system", "value": "Fix BOM issue with latest strings\n" }, { "from": "human", "value": "\"\"\"\nHearthstone Strings file\n\nFile format: TSV. Lines starting with `#` are ignored.\nKey is always `TAG`\n\"\"\"\nimport csv\nfrom typing import Dict\n\nimport hearthstone_data\n\n\nStringsR...
python
chosen
[ { "from": "system", "value": "fix(NotFoundPage): Set default value for http_status_code\n" }, { "from": "human", "value": "import os\nfrom urllib.parse import urlparse\n\nimport frappe\nfrom frappe.website.page_renderers.template_page import TemplatePage\nfrom frappe.website.utils import can_cac...
python
chosen
[ { "from": "system", "value": "Remove “username taken in abe” handling\n" }, { "from": "human", "value": "import traceback\n\nfrom flask import flash\nfrom sqlalchemy.exc import InternalError\n\nfrom pycroft.helpers import AutoNumber\nfrom pycroft.model import session\n\nfrom pycroft.lib.net impo...
python
chosen
[ { "from": "system", "value": "Use base TestCase to properly cleanup indices\n" }, { "from": "human", "value": "from django.test import TestCase\nfrom mock import patch\n\nfrom feedhq.feeds.models import Favicon, Feed\n\nfrom .factories import FeedFactory\nfrom . import responses\n\n\nclass Favic...
python
chosen
[ { "from": "system", "value": "Make Encoding accessible from speech.Encoding.\n" }, { "from": "human", "value": "# Copyright 2016 Google Inc.\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may not use this file except in compliance with the License.\n# You may obta...
python
chosen
[ { "from": "system", "value": "Add test for hashing multiple values\n" }, { "from": "human", "value": "from nose.tools import istest, assert_equal\n\nfrom whack.hashes import Hasher\n\n@istest\ndef hashing_the_same_single_value_gives_the_same_hash():\n def create_hash():\n hasher = Hash...
python
chosen
[ { "from": "system", "value": "feat(handlers): Make available via config file\n\n- Add to `logging.handlers` such that LogDNAHandler can be configured\n via a logging config file\n" }, { "from": "human", "value": "from .logdna import LogDNAHandler\n__all__ = ['LogDNAHandler']\n\n" }, { "...
python
chosen
[ { "from": "system", "value": "Add cross compile for debian" }, { "from": "human", "value": "from evolution_master.runners import pkg, download\n\n# Install for Arch\nwith pkg.pacman() as pkg_man:\n pkg_man.install('go')\n\n# Install for Debian & Ubuntu\nwith pkg.apt() as pkg_man:\n pkg_man...
python
chosen
[ { "from": "system", "value": "Bump version number to 1.0.6\n" }, { "from": "human", "value": "__title__ = 'rdmo'\n__version__ = '1.0.5'\n__author__ = 'Jochen Klar'\n__email__ = 'jklar@aip.de'\n__license__ = 'Apache-2.0'\n__copyright__ = 'Copyright 2015-2018 Leibniz Institute for Astrophysics Pot...
python
chosen
[ { "from": "system", "value": "Add placeholder to ID list field\n" }, { "from": "human", "value": "from django import forms\n\nfrom main.fields import RegexField\n\n\nclass IndexForm(forms.Form):\n id_list = forms.CharField(\n widget=forms.Textarea, label='ID List',\n help_text='...
python
chosen
[ { "from": "system", "value": "Allow dots in package names.\n\nPackages such as `backbone.wreqr` and `backbone.babysitter` where 404ing fixes #9" }, { "from": "human", "value": "from django.conf.urls import patterns, include, url\nfrom api.views import PackagesListView, PackagesFindView, Packages...
python
chosen
[ { "from": "system", "value": "Update url patterns - accept only exact patterns\n" }, { "from": "human", "value": "from django.conf import settings\nfrom django.conf.urls import include, url\nfrom django.conf.urls.static import static\nfrom django.contrib.staticfiles.views import serve\nfrom djan...
python
chosen
[ { "from": "system", "value": "Add aptitude and apt + bower" }, { "from": "human", "value": "import os\n\nhistory_file = os.path.expanduser(\"~\")+\"/.bash_history\"\nf = open(history_file,\"r\")\n\nkeywords = [\"pip\", \"tar\", \"brew\", \"apt-get\", \"install\", \"luarocks\", \"easy_install\", ...
python
chosen
[ { "from": "system", "value": "Handle Ping result in ResultIqProtocolEntity\n\nrefs #402\n" }, { "from": "human", "value": "from yowsup.layers import YowProtocolLayer\nfrom yowsup.common import YowConstants\nfrom .protocolentities import *\nclass YowIqProtocolLayer(YowProtocolLayer):\n def __...
python
chosen
[ { "from": "system", "value": "Allow SDK location to be overridden by environment variable.\n" }, { "from": "human", "value": "import os\n\nclass PblCommand:\n name = ''\n help = ''\n\n def run(args):\n pass\n\n def configure_subparser(self, parser):\n parser.add_argumen...
python
chosen
[ { "from": "system", "value": "Include URI scheme in Mesos cluster_url\n" }, { "from": "human", "value": "#!/usr/bin/env python\n# -*- coding: utf-8 -*-\n\nimport os\nimport sys\n\n# Get the Mesos cluster URL, assuming the EC2 script environment variables\n# are all available.\n\nactive_master = ...
python
chosen
[ { "from": "system", "value": "Return ARN directly if topic name appears to be an ARN\n" }, { "from": "human", "value": "\"\"\"SNS Topic functions.\"\"\"\nimport logging\n\nimport boto3\n\nfrom ..exceptions import SNSTopicNotFound\n\nLOG = logging.getLogger(__name__)\n\n\ndef get_sns_topic_arn(to...
python
chosen
[ { "from": "system", "value": "Add timing to __name__ block\n" }, { "from": "human", "value": "def insert_sort(my_list):\n for i in range(1, len(my_list)):\n j = i - 1\n key = my_list[i]\n while (j >= 0) and (my_list[j] > key):\n my_list[j + 1] = my_list[j]\n ...
python
chosen
[ { "from": "system", "value": "Revert \"Disable test that fails on bot\"\n\nThis reverts commit e214e46e748881e6418ffac374a87d6ad30fcfea.\n\nI have reverted the swift commit that was causing this failure.\n\nrdar://35264910\n" }, { "from": "human", "value": "# TestPOUnwrapping.py\n#\n# This sourc...
python
chosen
[ { "from": "human", "value": "Test api queries result in correct storage queries\n" }, { "from": "gpt", "value": "import unittest\nimport urllib\nimport datetime\nfrom hamcrest import *\nfrom mock import patch\nimport pytz\nfrom backdrop.read import api\n\n\nclass ReadApiTestCase(unittest.TestCas...
python
chosen
[ { "from": "system", "value": "Set default locale in test to avoid test failures when different default is used than expected.\n" }, { "from": "human", "value": "# -*- coding: utf-8 -*-\n\n\"\"\"\n Unit Test: orchard.app\n\"\"\"\n\nimport unittest\n\nimport orchard\n\n\nclass AppUnitTest(unitt...
python
chosen
[ { "from": "system", "value": "Increment patch version to 0.8.2\n" }, { "from": "human", "value": "\"\"\"yolk.\n\nAuthor: Rob Cakebread <cakebread at gmail>\n\nLicense : BSD\n\n\"\"\"\n\n__version__ = '0.8.1'\n" }, { "from": "gpt", "value": "\"\"\"yolk.\n\nAuthor: Rob Cakebread <cake...
python
chosen
[ { "from": "system", "value": "Convert CSV writer to a module definition.\n\nUse __import__ to import it as a dictionary.\n" }, { "from": "human", "value": "\ndef csv():\n\n def Receipt(meta, body, variables):\n output = []\n\n def add(s) : output.append(s)\n\n if \"store\...
python
chosen
[ { "from": "system", "value": "Update fjord l10n_completion file location\n" }, { "from": "human", "value": "import os\n\ndef truthy(item):\n return item.lower().startswith('t')\n\n\nDEBUG = truthy(os.environ.get('DEBUG', 'True'))\n\n\nPROJECTS = {\n 'SUMO': {\n 'name': 'SUMO',\n ...
python
chosen
[ { "from": "system", "value": "tests: Add testcases for catching user Exception subclasses.\n" }, { "from": "human", "value": "class MyExc(Exception):\n pass\n\ne = MyExc(100, \"Some error\")\nprint(e)\nprint(repr(e))\nprint(e.args)\n" }, { "from": "gpt", "value": "class MyExc(Exce...
python
chosen
[ { "from": "system", "value": "Return value of submit is now a json dict\n" }, { "from": "human", "value": "# Licensed Materials - Property of IBM\n# Copyright IBM Corp. 2017\nimport sys\nimport streamsx.topology.context\n\ndef standalone(test, topo):\n rc = streamsx.topology.context.submit(\"...
python
chosen
[ { "from": "system", "value": "Fix for DLL load failures when importing top-level package\n\nThe order of import affects the success of import pymatgen on certain 64-bit Windows setups and therefore a workaround has been added.\n\nFormer-commit-id: 0ff590e053d5e0be2959720a861d06d7ba74d132 [formerly 0da252fe0...
python
chosen
[ { "from": "system", "value": "Fix name of test object for enumerables\n" }, { "from": "human", "value": "class TestKernel(object):\n def test_inject(self, ec):\n w_res = ec.space.execute(ec, \"\"\"\n return (5..10).inject(1) do |prod, n|\n prod * n\n end\n ...
python
chosen
[ { "from": "system", "value": "Fix syntax bug on stream emptying" }, { "from": "human", "value": "import time\nimport numpy as np\nimport pyaudio\nimport config\n\n\ndef start_stream(callback):\n p = pyaudio.PyAudio()\n frames_per_buffer = int(config.MIC_RATE / config.FPS)\n stream = p.o...
python
chosen
[ { "from": "system", "value": "Fix regex on subdomain urls so empty string will match.\n" }, { "from": "human", "value": "from django.conf.urls.defaults import url, patterns\n\nfrom urls import urlpatterns as main_patterns\n\nurlpatterns = patterns('',\n url(r'^projects/(?P<project_slug>[\\w.-...
python
chosen
[ { "from": "system", "value": "Revert \"Revert \"Add tests to compare epsilon with another objects\"\"\n\nThis reverts commit d13b3d89124d03f563c2ee2143ae16eec7d0b191.\n" }, { "from": "human", "value": "#!/usr/bin/env python\r\n\"\"\"\r\n:Author Patrik Valkovic\r\n:Created 23.06.2017 16:39\r\n:Li...
python
chosen
[ { "from": "system", "value": "Make the test robust against usage for comparisons between minor Python versions.\n\nTypically, for Wine, I have an older version installed, than my Debian has, and\nthis then fails the test without strict need.\n" }, { "from": "human", "value": "# Copyright 201...
python
chosen
[ { "from": "system", "value": "Revert \"Remove redundant functions (one too many levels of abstraction)@\"\n\nThis reverts commit 9c5bf06d1427db9839b1531aa08e66574c7b4582.\n" }, { "from": "human", "value": "import amqp\nfrom contextlib import closing\n\n\ndef get_message(queue):\n \"\"\" Get t...
python
chosen
[ { "from": "system", "value": "Use existing test helper to create and assign permissions and roles\n" }, { "from": "human", "value": "\"\"\"\n:Copyright: 2006-2018 Jochen Kupperschmidt\n:License: Modified BSD, see LICENSE for details.\n\"\"\"\n\nfrom byceps.services.authorization import service a...
python
chosen
[ { "from": "system", "value": "Replace test user_id with a correct one\n" }, { "from": "human", "value": "import os\n\nimport vcr_unittest\n\nfrom app.messenger import messaging\n\n\nclass MessagingTestCase(vcr_unittest.VCRTestCase):\n \n def setUp(self):\n self.access_token = os.env...
python
chosen
[ { "from": "system", "value": "Allow simple syntax for `job` decorator.\n\nIt is nice to use simple syntax:\n\n @job\n def some_func():\n pass\n\nin cases, when you have only 'default' queue.\n" }, { "from": "human", "value": "from rq.decorators import job\n\nfrom .queues import get_...
python
chosen
[ { "from": "system", "value": "Use shell attribute of magics class\n" }, { "from": "human", "value": "import ast\n\nfrom snoop import snoop\nfrom IPython import get_ipython\nfrom IPython.core.magic import Magics, cell_magic, magics_class\n\n\n@magics_class\nclass SnoopMagics(Magics):\n @cell_m...
python
chosen
[ { "from": "system", "value": "Add \"lzma\" to \"python-imports\" test\n" }, { "from": "human", "value": "import platform\n\nisWindows = platform.system() == 'Windows'\nisNotPypy = platform.python_implementation() != 'PyPy'\nisCaveman = platform.python_version_tuple()[0] == '2'\n\nif not isWindow...
python
chosen
[ { "from": "system", "value": "Remove deprecated --optipng from glue options\n\nOptipng is now deprecated in glue, so including that option in\nCactus doesn't really make sense.\n\nhttps://github.com/jorgebastida/glue/blob/master/docs/changelog.rst#09\n" }, { "from": "human", "value": "import os\...
python
chosen
[ { "from": "system", "value": "Remove flag to enable single sign on\n" }, { "from": "human", "value": "LOG_LEVEL = \"DEBUG\"\nSINGLE_SIGN_ON = True\nBACKDROP_ADMIN_UI_HOST = \"http://backdrop-admin.dev.gov.uk\"\nALLOW_TEST_SIGNIN=True\nSECRET_KEY = \"something unique and secret\"\n\nDATABASE_NAME...
python
chosen
[ { "from": "system", "value": "Fix incorrect variable from TemperatureClient\n" }, { "from": "human", "value": "import requests\n\n\"\"\"Client to retrieve the current temperature reading\"\"\"\nclass TemperatureClient:\n def __init__(self, host, port):\n self.host = host\n self....
python
chosen
[ { "from": "system", "value": "Make raw_params an optional argument in Submessage\n" }, { "from": "human", "value": "from . import Message\n\nclass Submessage(object):\n\n need_lock_object = True\n\n def __init__(self, obj, message_id, sender, raw_params, need_lock_object=True):\n se...
python
chosen
[ { "from": "system", "value": "Feature: Allow JsonRender only in production mode\n" }, { "from": "human", "value": "import logging\n\nfrom .base import *\n\n\n# SECURITY WARNING: keep the secret key used in production secret!\nif 'SECRET_KEY' not in os.environ:\n logging.warning(\n \"No...
python
chosen
[ { "from": "system", "value": "Make the default OK page in the flask example obvious to find\n" }, { "from": "human", "value": "import flask\n\nimport mmstats\n\n\napplication = app = flask.Flask(__name__)\napp.config['DEBUG'] = True\n\n\nclass Stats(mmstats.MmStats):\n ok = mmstats.CounterFie...
python
chosen
[ { "from": "system", "value": "Remove distutils-mangling code from Combinator which breaks setuptools.\n\nAfter this change, Combinator will no longer attempt to force 'python setup.py install' to put things into your home directory. Use `setup.py --prefix ~/.local`, or, if your package is trying to use set...
python
chosen
[ { "from": "system", "value": "Handle application erroring to not break the server\n" }, { "from": "human", "value": "## module loader, goes to see which submodules have 'html' directories\n## and declares them at the toplevel\n\nimport os,importlib\n\ndef find_module_dirs():\n curdir = os.pat...
python
chosen
[ { "from": "system", "value": "Add test for empty string; cleanup\n" }, { "from": "human", "value": "import unittest\nimport sys\nsys.path.append('../src')\nimport BaseUtils\n\n\nclass TestBaseUtils(unittest.TestCase):\n def test_word_segmenter(self):\n segments = BaseUtils.get_words('t...
python
chosen
[ { "from": "system", "value": "Fix line continuation indent level.\n" }, { "from": "human", "value": "\"\"\"SOAP client.\"\"\"\nfrom __future__ import print_function\nimport requests\nfrom rinse import ENVELOPE_XSD\nfrom rinse.util import SCHEMA\nfrom rinse.response import RinseResponse\n\n\nclas...
python
chosen
[ { "from": "system", "value": "Raise exception if path not found, os not found, or command execution fails.\n" }, { "from": "human", "value": "import os, platform\n# I intend to hide the Operating Specific details of opening a folder\n# here in this module.\n#\n# On Mac OS X you do this with \"...
python
chosen
[ { "from": "system", "value": "Fix Compatibility issue with django 1.8+\n" }, { "from": "human", "value": "from map_service.models import LkState\nfrom map_service.models import SpatialObjects\nfrom rest_framework_mongoengine import serializers\n\n\nclass LkStateSerializer(serializers.DocumentSer...
python
chosen
[ { "from": "system", "value": "Change the logging format to begin with the threadname\n" }, { "from": "human", "value": "# Copyright (c) 2014 Wieland Hoffmann\n# License: MIT, see LICENSE for details\nimport argparse\nimport logging\n\n\nfrom . import config\nfrom .indexing import reindex\n\n\nlo...
python
chosen
[ { "from": "system", "value": "Update dict and set examples.\n" }, { "from": "human", "value": "# Copyright (c) 2013 Jordan Halterman <jordan.halterman@gmail.com>\n# See LICENSE for details.\nimport sys, os\nsys.path.insert(0, os.path.dirname(os.path.dirname(__file__)))\nfrom active_redis import ...
python
chosen
[ { "from": "system", "value": "Revert \"remove unecessary sys.exit call\"\n\nThis reverts commit 50b79fec1e96c1e5e5cc17f58f2c4ccfba16d6d6.\n" }, { "from": "human", "value": "\"\"\"The ``main`` function chooses and runs a subcommand.\"\"\"\nfrom __future__ import absolute_import, print_function\n\...
python
chosen
[ { "from": "system", "value": "Change sys.path for the test to succeed.\n\nTested locally with a python3 extension module (in\n/extensions/compiled33).\n\nAlso tested that reverting a75773cf9f7a9fde2a7b2c77b9846b4f0dd5b711 make\nthe test fail.\n" }, { "from": "human", "value": "\"\"\"\nTest compi...
python
chosen
[ { "from": "system", "value": "Update fancyflags version to 1.0\n\nPiperOrigin-RevId: 354582100\nChange-Id: Ib4ce53fd0fc197c0f92cd8d46348dec8849c51df\n" }, { "from": "human", "value": "# Copyright 2021 DeepMind Technologies Limited.\n#\n# Licensed under the Apache License, Version 2.0 (the \"Lice...
python
chosen
[ { "from": "system", "value": "Rename to osuapi to match module.\n" }, { "from": "human", "value": "__title__ = \"osssss\"\n__author__ = \"khazhyk\"\n__license__ = \"MIT\"\n__copyright__ = \"Copyright khazhyk\"\n__version__ = \"0.0.8\"\n\nfrom .osu import OsuApi\nfrom .connectors import *\nfrom ....
python
chosen
[ { "from": "system", "value": "Enable BOT_URL from env variable\n" }, { "from": "human", "value": "import logging\nimport pytz\n\nBOT_URL = \"\"\nLAST_UPDATE_ID_FILE = \"last_update\"\nTAGS_FILE = \"tags\"\nPOLL_PERIOD = 1\nMAX_TAGS = 5\nLOGGING_LEVEL = logging.DEBUG\nLOCAL_TIMEZONE = pytz.timezo...
python
chosen
[ { "from": "system", "value": "Allow some more chars in part names\n" }, { "from": "human", "value": "\"\"\"\nCustom field validators for InvenTree\n\"\"\"\n\nfrom django.core.exceptions import ValidationError\nfrom django.utils.translation import gettext_lazy as _\n\n\ndef validate_part_name(val...
python
chosen
[ { "from": "system", "value": "Test different mechanisms for job submission.\n" }, { "from": "human", "value": "#!/usr/bin/env python\n\nimport multyvac\n\nmultyvac.config.set_key(api_key='admin', api_secret_key='12345', api_url='http://docker:8000/api')\n\njid = multyvac.shell_submit(cmd='for i ...
python
chosen
[ { "from": "system", "value": "Add condition to check for latest commit activity\n" }, { "from": "human", "value": "'''\nThis module will send SMS reminders periodically, using Twilio.\nThe aim is to encourage user to code, commit and push to GitHub everyday\n'''\n\nimport requests\nfrom twilio.r...
python
chosen
[ { "from": "system", "value": "Add filters to Email Admin List View\n" }, { "from": "human", "value": "from django.contrib import admin\nfrom django.conf.urls import url\n\nfrom .models import Email, Tag\nfrom .views import SendEmailAdminView, UpdateTargetCountView\nfrom .forms import EmailAdminF...
python
chosen