conversations
listlengths
2
3
source
stringclasses
1 value
stack
stringclasses
1 value
[ { "from": "system", "value": "Fix typo in self.propagate_signal call" }, { "from": "human", "value": "from celery import task\nfrom django.dispatch.dispatcher import (\n _make_id,\n Signal,\n)\n\n\nclass AsyncSignal(Signal):\n\n def __init__(self, providing_args=None, queue=None):\n\n ...
python
chosen
[ { "from": "system", "value": "Fix issue for building PyZMQ\n" }, { "from": "human", "value": "from ..source import GitSource\nfrom ..package import Package\nfrom ..patch import LocalPatch\nfrom ..util import target_arch\n\nclass LibZMQ(Package):\n source = GitSource('https://github.com/AIPYX/...
python
chosen
[ { "from": "system", "value": "Write minimal code to implement MutableMapping\n" }, { "from": "human", "value": "# Copyright (c) 2016 The Regents of the University of Michigan.\n# All Rights Reserved. Licensed according to the terms of the Revised\n# BSD License. See LICENSE.txt for details.\n\nc...
python
chosen
[ { "from": "system", "value": "Add an entry for test case BasicExprCommandsTestCase.test_evaluate_expression_python,\ndue to crashes while running the entire test suite with clang-126.\n\nTo reproduce:\n\nCC=clang ./dotest.py -v -w 2> ~/Developer/Log/lldbtest.log\n\nTo skip this test case:\n\nCC=clang ./dote...
python
chosen
[ { "from": "system", "value": "Make the schema return object a bit more obvious and descriptive\n" }, { "from": "human", "value": "from django.conf import settings\nfrom json import loads as json_loads\nfrom os import path\n\n\ndef get_schema():\n schema_root = path.join(\n settings.BAS...
python
chosen
[ { "from": "system", "value": "Fix stats job job's name\n" }, { "from": "human", "value": "import sys\nimport time\nimport logging\nlogging.basicConfig(level=logging.DEBUG)\n\nfrom redis import StrictRedis\nfrom rq import Queue\nfrom apscheduler.schedulers.blocking import BlockingScheduler\n\nsys...
python
chosen
[ { "from": "system", "value": "Remove redundant parenthesis in Image\n" }, { "from": "human", "value": "import datetime\nfrom utils.utils import limit_file_name\n\n\nclass Image():\n _file_name_pattern = \"reddit_%s_%s_%s_album_%s_%s_%s\"\n\n def __init__(self, url, post, image_file):\n ...
python
chosen
[ { "from": "system", "value": "Complete one odd char count sol\n" }, { "from": "human", "value": "\"\"\"Leetcode 266. Palindrome Permutation (Premium)\nEasy\n\nURL: https://leetcode.com/problems/palindrome-permutation\n\nGiven a string, determine if a permutation of the string could form a palind...
python
chosen
[ { "from": "system", "value": "Add fee_account to BuildingData of legacy test base\n\n" }, { "from": "human", "value": "# Copyright (c) 2015 The Pycroft Authors. See the AUTHORS file.\n# This file is part of the Pycroft project and licensed under the terms of\n# the Apache License, Version 2.0. S...
python
chosen
[ { "from": "system", "value": "Add a mock API path for project details, used in e.g. test_init\n" }, { "from": "human", "value": "from uuid import uuid4\n\nimport requests_mock\n\nfrom tests.utils import get_project_list_data\nfrom valohai_cli.utils import get_random_string\n\n\ndef get_project_m...
python
chosen
[ { "from": "system", "value": "Add intersects, contains, and equality tests for Envelope\n" }, { "from": "human", "value": "import unittest\n\nfrom contones.geometry import Envelope\n\n\nclass EnvelopeTestCase(unittest.TestCase):\n\n def test_init(self):\n extent = (-120, 38, -110, 45)\...
python
chosen
[ { "from": "system", "value": "Set maxDiff to 'None' on the base ScraperTest class\n" }, { "from": "human", "value": "import os\nimport unittest\n\nimport pytest\n\n\nclass ScraperTest(unittest.TestCase):\n\n online = False\n test_file_name = None\n\n def setUp(self):\n os.environ...
python
chosen
[ { "from": "system", "value": "Refactor of one assignment test\n" }, { "from": "human", "value": "# -*- coding: utf-8 -*-\nimport unittest\ndbconfig = None\ntry:\n import dbconfig\n import erppeek\nexcept ImportError:\n pass\n@unittest.skipIf(not dbconfig, \"depends on ERP\")\nclass Assi...
python
chosen
[ { "from": "system", "value": "Fix build directory cleaner, to not follow links on Windows.\n\nBUG=\nR=ricow@google.com\n\nReview URL: https://codereview.chromium.org//1219833003.\n" }, { "from": "human", "value": "#!/usr/bin/env python\n#\n# Copyright (c) 2012, the Dart project authors. Please ...
python
chosen
[ { "from": "system", "value": "Add pruning step to skeletonization\n\nThis requires an updated Fiji, as detailed in this mailing list thread:\nhttps://list.nih.gov/cgi-bin/wa.exe?A1=ind1308&L=IMAGEJ#41\nhttps://list.nih.gov/cgi-bin/wa.exe?A2=ind1308&L=IMAGEJ&F=&S=&P=36891\n" }, { "from": "human", ...
python
chosen
[ { "from": "system", "value": "Use normal full names for translators\n\n- Remove and replace any existing module\n- Pull new module from ipfs and rename from multihash to normal name\n (ipfsApi doesn't support specifying output paths)\n- Rename full_path to full_name for consistency\n" }, { "from": ...
python
chosen
[ { "from": "system", "value": "Add Setting model creation test\n" }, { "from": "human", "value": "from django.test import TestCase\nfrom .models import Author, Publisher, Edition, Setting, Adventure\n\n\nclass AuthorTests(TestCase):\n def test_create_author(self):\n gygax = Author.objec...
python
chosen
[ { "from": "system", "value": "Add form to create a bucketlist item\n" }, { "from": "human", "value": "from flask_wtf import FlaskForm\nfrom wtforms import StringField, PasswordField, BooleanField, TextAreaField\nfrom wtforms.validators import DataRequired, Length, Email\n\n\nclass SignupForm(Fla...
python
chosen
[ { "from": "system", "value": "Allow additional args for ensure_table\n\nI had this at some point in some diff somewhere, but it got lost... that's\nworrying. Maybe in a stash somewhere.\n" }, { "from": "human", "value": "import rethinkdb as r\n\n\n# TODO(alpert): Read port and db from app.config...
python
chosen
[ { "from": "system", "value": "Fix tab vs spaces issue\n" }, { "from": "human", "value": "#!/usr/bin/env python\n\nimport json\nfrom api import config\n\nCURRENT_DATABASE_VERSION = 1 # An int that is bumped when a new \n\ndef confirm_schema_match():\n\t\"\"\"\n\tChecks version of database schema\...
python
chosen
[ { "from": "system", "value": "Update on file modification by running a scan on the directory\n" }, { "from": "human", "value": "from watchdog.events import FileSystemEventHandler\n\nfrom muzicast.meta import Track\n\nclass CollectionEventHandler(FileSystemEventHandler):\n def __init__(self, s...
python
chosen
[ { "from": "system", "value": "Disable non-critical logging in tests\n" }, { "from": "human", "value": "import os\n\n# Set environment variables before importing settings\nos.environ[\"PROTECTED_S3_CUSTOM_DOMAIN\"] = \"testserver/media\"\n\n# noinspection PyUnresolvedReferences\nfrom config.setti...
python
chosen
[ { "from": "system", "value": "Call APIVersion._api_version_detail not nonexistent self._api_version_detail.\n" }, { "from": "human", "value": "from common.apiversion import APIVersion\nfrom common.application import Application\n\nclass VersionsApp(Application):\n\n\tdef APIVersionList(self, req...
python
chosen
[ { "from": "system", "value": "Fix compatibility with absolute import of Py3\n" }, { "from": "human", "value": "from png import *\n\n# Following methods are not parts of API and imports only for unittest\nfrom png import _main\nfrom png import strtobytes" }, { "from": "gpt", "value":...
python
chosen
[ { "from": "system", "value": "Remove unneeded Python 2.7 compatibility imports.\n" }, { "from": "human", "value": "# -* coding: utf-8 -*-\n\"\"\"Contour calculations.\"\"\"\n\n# Python 2 support\n# pylint: disable=redefined-builtin,unused-wildcard-import,wildcard-import\nfrom __future__ import (...
python
chosen
[ { "from": "system", "value": "Add option for quick test on all python version\n" }, { "from": "human", "value": "\"\"\"\nUses conda to run and test all supported python + numpy versions.\n\"\"\"\n\nfrom __future__ import print_function\nimport itertools\nimport subprocess\nimport os\nimport sys\...
python
chosen
[ { "from": "system", "value": "Check make exit codes and stop on error\n" }, { "from": "human", "value": "# LIBTBX_SET_DISPATCHER_NAME dev.xia2.make_sphinx_html\n\nfrom __future__ import division\nfrom libtbx import easy_run\nimport libtbx.load_env\nimport os.path as op\nimport shutil\nimport os\...
python
chosen
[ { "from": "system", "value": "Add ADD_INSTALLED_APPS to 'enabled' file\n\nDjango looks for translation catalogs from directories in\nINSTALLED_APPS. To display translations for designate-dashboard,\n'designatedashboard' needs to be registered to INSTALLED_APPS.\n\n(cherry picked from commit 1ed7893eb2ae1017...
python
chosen
[ { "from": "system", "value": "Fix getting snapshotsoftware on old snapshots\n" }, { "from": "human", "value": "from pydash import find\n\nfrom ereuse_devicehub.resources.device.domain import DeviceDomain\nfrom ereuse_devicehub.resources.event.device import DeviceEventDomain\nfrom ereuse_devicehu...
python
chosen
[ { "from": "system", "value": "Rectify AttributeError: 'module' object has no attribute 'numeral'\n" }, { "from": "human", "value": "# File: roman_numerals.py\n# Purpose: Function to convert from normal numbers to Roman Numerals.\n# Programmer: Amal Shehu\n# Course: Exercism\n# ...
python
chosen
[ { "from": "system", "value": "Raise pypeSyntaxError in pype test\n" }, { "from": "human", "value": "from pype.lexer import lexer\nfrom pype.pipeline import Pipeline\n\nexample_error_ppl='test/samples/example_error.ppl'\nexample0_ppl='test/samples/example0.ppl'\nexample0_token='test/samples/examp...
python
chosen
[ { "from": "system", "value": "Disable test_pack.py unit test until it works on Travis-CI and for Python 2.7.\n" }, { "from": "human", "value": "# pyOCD debugger\n# Copyright (c) 2016 Arm Limited\n# SPDX-License-Identifier: Apache-2.0\n#\n# Licensed under the Apache License, Version 2.0 (the \"Li...
python
chosen
[ { "from": "system", "value": "Replace hyphen on test class name\n" }, { "from": "human", "value": "# -*- coding: utf-8 -*-\n\"\"\"\ntest_bgw_dl\n----------------------------------\n\nTests for `bgw_dl` module.\n\"\"\"\nimport pytest\nimport bgw_dl\n\n\nclass TestBgw-dl(object):\n @classmethod...
python
chosen
[ { "from": "system", "value": "Test the slug field is generated correctly\n" }, { "from": "human", "value": "import pytest\n\n\n@pytest.mark.django_db\ndef test_tinycontent_str(simple_content):\n assert \"foobar\" == str(simple_content)\n\n\n@pytest.mark.django_db\ndef test_tinycontentfile_str...
python
chosen
[ { "from": "system", "value": "Comment out CopyR test for now.\n" }, { "from": "human", "value": "#!/usr/bin/env python\n\n__author__ = 'Shyue Ping Ong'\n__copyright__ = 'Copyright 2014, The Materials Virtual Lab'\n__version__ = '0.1'\n__maintainer__ = 'Shyue Ping Ong'\n__email__ = 'ongsp@ucsd.ed...
python
chosen
[ { "from": "system", "value": "Use str and repr functions instead of magic methods\n" }, { "from": "human", "value": "\"\"\"\n\nNOTE: There are no tests that check for data validation at this point since\nthe interpreter doesn't have any data validation as a feature.\n\"\"\"\nimport pytest\n\nfro...
python
chosen
[ { "from": "system", "value": "tests: Test that we handle None->NULL conversion for TEXT and BINARY\n" }, { "from": "human", "value": "from asyncpg import _testbase as tb\n\n\nclass TestPrepare(tb.ConnectedTestCase):\n\n async def test_prepare_1(self):\n st = await self.con.prepare('SEL...
python
chosen
[ { "from": "system", "value": "Simplify a raise in debug mode\n" }, { "from": "human", "value": "from decimal import *\nfrom django.conf import settings\nfrom currencies.models import Currency\n\n\ndef calculate_price(price, currency):\n try:\n factor = Currency.objects.get(code__exact=...
python
chosen
[ { "from": "system", "value": "Use clear() instead of manually deleting all elements in the body\n" }, { "from": "human", "value": "#!/usr/bin/env python\nfrom __future__ import print_function\n\nimport sys\nimport argparse\n\nfrom lxml import etree\n\nNS = {'x': 'http://www.w3.org/1999/xhtml',\n...
python
chosen
[ { "from": "system", "value": "Update default_pool tests for new call tree (mocks are fragile).\n" }, { "from": "human", "value": "import mock\n\nfrom treq.test.util import TestCase\n\nimport treq\nfrom treq._utils import set_global_pool\n\n\nclass TreqAPITests(TestCase):\n def setUp(self):\n ...
python
chosen
[ { "from": "system", "value": "Add admin email list to instance configuration.\n" }, { "from": "human", "value": "# -*- coding: utf-8 -*-\n\n\"\"\"\n Instance configuration, possibly overwriting default values.\n\"\"\"\n\n\nclass Configuration:\n \"\"\"\n Instance specific configurat...
python
chosen
[ { "from": "system", "value": "Set state session-id only when state is present\n\nSigned-off-by: Ivan Kanakarakis <f60d6943d72436645c4304926eeeac2718a1142c@gmail.com>\n" }, { "from": "human", "value": "from uuid import uuid4\n\n\n# The state key for saving the session id in the state\nLOGGER_STAT...
python
chosen
[ { "from": "system", "value": "Implement UpperCamelCase name check for enum case\n" }, { "from": "human", "value": "from tailor.swift.swiftlistener import SwiftListener\nfrom tailor.utils.charformat import isUpperCamelCase\n\n\nclass MainListener(SwiftListener):\n\n def enterClassName(self, ct...
python
chosen
[ { "from": "system", "value": "Enable index for order column\n\nOrdering will be faster\n" }, { "from": "human", "value": "from django.db import models\nfrom django.core.exceptions import ValidationError\n\n\nclass OrderedModel(models.Model):\n order = models.PositiveIntegerField(blank=True, d...
python
chosen
[ { "from": "system", "value": "Add `get_or_create_for_user` method to default Manager." }, { "from": "human", "value": "from django.conf import settings\nfrom django.db import models\n\n\nclass UserOwnedModelManager(models.Manager):\n\n def filter_for_user(self, user, *args, **kwargs):\n ...
python
chosen
[ { "from": "system", "value": "Add endpoints for AWS production feeds\n\nAdded endpoints for pulling the data from AWS (vs pulling from CSV)\n" }, { "from": "human", "value": "from django.conf.urls import url\nfrom . import views\nfrom rest_framework_swagger.views import get_swagger_view\n\nschem...
python
chosen
[ { "from": "system", "value": "Use 'open' to open about dialog URLs on OS X\n" }, { "from": "human", "value": "import gtk\n\nimport os\n\ndef _find_program_in_path(progname):\n try:\n path = os.environ['PATH']\n except KeyError:\n path = os.defpath\n\n for dir in path.split...
python
chosen
[ { "from": "system", "value": "Change to_user to CharField for message model\n" }, { "from": "human", "value": "from __future__ import unicode_literals\n\nfrom django.db import models\n\n\nclass Activity(models.Model):\n datetime = models.DateTimeField(auto_now_add=True)\n detail = models.T...
python
chosen
[ { "from": "system", "value": "Fix error in History table if stack does not exist\n\nChange-Id: Ic47761ddff23207a30eae0b7b523a996c545b3ba\n" }, { "from": "human", "value": "# -*- coding: utf8 -*-\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\"); you may\n# not use this...
python
chosen
[ { "from": "system", "value": "Add more tests for general_object\n\n* wqflask/tests/base/test_general_object.py: test getattr() and `==`\n" }, { "from": "human", "value": "import unittest\n\nfrom base.GeneralObject import GeneralObject\n\n\nclass TestGeneralObjectTests(unittest.TestCase):\n \"...
python
chosen
[ { "from": "system", "value": "Fix missing refactorization in unit test\n\nsend_to_users unit test was not modified after parameter change.\n" }, { "from": "human", "value": "from django.test import TestCase\n\nfrom yunity.utils.session import RealtimeClientData\n\n\nclass TestSharedSession(TestC...
python
chosen
[ { "from": "system", "value": "Fix test broken by previous commit.\n" }, { "from": "human", "value": "#!/usr/bin/env python\n# -*- coding: utf-8 -*-\n\n# (c) 2015-2018, ETH Zurich, Institut fuer Theoretische Physik\n# Author: Dominik Gresch <greschd@gmx.ch>\n\"\"\"Tests for creating a simple tigh...
python
chosen
[ { "from": "system", "value": "Improve infected human approach AI.\n\nThe approach AI now only kicks in when the player is within 400 pixels\nof the enemy.\n\nThe direction it chooses to look in is a bit more sane now. It will\nfigure out whether the distance is greater in the X or Y location, and\npick a di...
python
chosen
[ { "from": "system", "value": "Use bson's JSON util to handle ObjectIds in a JSON context\n" }, { "from": "human", "value": "import os\nfrom pymongo import MongoClient\n\nMONGO_USER = os.getenv('MONGO_USER')\nMONGO_PASSWORD = os.getenv('MONGO_PASSWORD')\nMONGO_URI = 'mongodb://{0}:{1}@paulo.mongo...
python
chosen
[ { "from": "system", "value": "Use '-pedantic' to fix build with old GCC versions.\n" }, { "from": "human", "value": "import BaseEnvironment\nimport os\n\nclass Environment(BaseEnvironment.Environment):\n def __init__(self, **kw):\n apply(BaseEnvironment.Environment.__init__, (self,), kw)\...
python
chosen
[ { "from": "system", "value": "Remove yaml config and use config object\n" }, { "from": "human", "value": "import unittest\nimport os\nfrom performance_testing.command_line import Tool\nfrom performance_testing.result import Result\nfrom performance_testing.config import Config\n\n\nclass Command...
python
chosen
[ { "from": "system", "value": "[proposal] Remove addresses from \"To\" field, BCC instead.\n\nClosing privacy issue by hiding the \"To\" field altogether. Just commented out the \"To\" line. For issue #68" }, { "from": "human", "value": "import smtplib\nfrom celery import Celery\nfrom email.mime....
python
chosen
[ { "from": "system", "value": "Move assignments in Table.__init__ around\n" }, { "from": "human", "value": "# Copyright (c) 2017 The Regents of the University of Michigan.\n# All Rights Reserved. Licensed according to the terms of the Revised\n# BSD License. See LICENSE.txt for details.\n\nclass ...
python
chosen
[ { "from": "system", "value": "Remove simplejson for Python 3.2.x since there is no support\n" }, { "from": "human", "value": "#!/usr/bin/env python\nfrom setuptools import setup\nfrom distutils.core import Command\nfrom sys import stdout, version_info\nimport logging\n\nVERSION = '0.9'\nDESCRIPT...
python
chosen
[ { "from": "system", "value": "Fix error due to missing package in packages list\n" }, { "from": "human", "value": "from distutils.core import setup\n\nVERSION = '0.0.2.8'\n\n\nsetup(\n name='jpp',\n version=VERSION,\n packages=['jpp', 'jpp.parser', 'jpp.cli_test', 'jpp.cli_test.sub_path...
python
chosen
[ { "from": "system", "value": "Remove old packages only needed by Sphinx.\n" }, { "from": "human", "value": "from setuptools import setup\n\nimport species_separator\n\nsetup(\n name=\"species_separator\",\n version=species_separator.__version__,\n url='https://github.com/statbio/Sargass...
python
chosen
[ { "from": "system", "value": "Update URL to point to GitHub.\n" }, { "from": "human", "value": "# -*- coding: utf-8 -*-\n\nfrom __future__ import unicode_literals\nfrom setuptools import setup, find_packages\nfrom os.path import dirname, join\n\n\ndef main():\n base_dir = dirname(__file__)\n ...
python
chosen
[ { "from": "system", "value": "Copy data files for numpy\n" }, { "from": "human", "value": "#!/usr/bin/env python\n\n# Copyright (c) 2014, Michael Boyle\n# See LICENSE file for details: <https://github.com/moble/spherical_functions/blob/master/LICENSE>\n\nfrom distutils.core import setup\n\nsetup...
python
chosen
[ { "from": "system", "value": "Fix the problem in Python 2.x\n" }, { "from": "human", "value": "from setuptools import setup, find_packages\nfrom os import path\n\nhere = path.abspath(path.dirname(__file__))\n\nwith open(path.join(here, 'README.md'), encoding='utf-8') as f:\n long_description ...
python
chosen
[ { "from": "system", "value": "Use the latest version of pyoidc/oic dependency\n\nSigned-off-by: Ivan Kanakarakis <f60d6943d72436645c4304926eeeac2718a1142c@gmail.com>\n" }, { "from": "human", "value": "from setuptools import setup, find_packages\n\nsetup(\n name='pyop',\n version='2.0.8',\n...
python
chosen
[ { "from": "system", "value": "Fix a mistake in a git url\n" }, { "from": "human", "value": "#!/usr/bin/env python\n# -*- coding: utf-8 -*-\n\nfrom setuptools import setup, find_packages\nimport sys, os\nimport django_throttling\n\nsetup(\n name='django-throttling',\n version=django_throttl...
python
chosen
[ { "from": "system", "value": "Upgrade the version to force reinstall by wheels" }, { "from": "human", "value": "#!/usr/bin/env python\n# -*- coding: utf-8 -*-\ntry:\n from setuptools import setup\nexcept ImportError:\n from ez_setup import use_setuptools\n use_setuptools()\n from set...
python
chosen
[ { "from": "system", "value": "Add a short alias for bin/openprocurement_tests\n\nAlias is: bin/op_tests\n" }, { "from": "human", "value": "from setuptools import find_packages, setup\n\nversion = '2.3'\n\nsetup(name='op_robot_tests',\n version=version,\n description=\"\",\n long_d...
python
chosen
[ { "from": "system", "value": "Make description a string, not a tuple.\n\nFixes #1\n" }, { "from": "human", "value": "#!/usr/bin/env python\n\nfrom distutils.core import setup\n\nwith open('README.rst') as file:\n long_description = file.read()\n\nsetup(name='parmap',\n version='1.2.1',\n...
python
chosen
[ { "from": "system", "value": "Use a list for classifiers\n" }, { "from": "human", "value": "from setuptools import find_packages, setup\n\n\nversion = '0.1.0'\n\n\nsetup(\n name='django-user-deletion',\n packages=find_packages(),\n include_package_data=True,\n version=version,\n l...
python
chosen
[ { "from": "system", "value": "Fix a small typo in the github url\n\nSigned-off-by: Ben Lopatin <91803bfd2e5cab57e71a67949d71dc9d68ed4677@wellfireinteractive.com>\n" }, { "from": "human", "value": "#!/usr/bin/env python\n# -*- coding: utf-8 -*-\n\nimport os\nimport sys\n\n\ntry:\n from setupto...
python
chosen
[ { "from": "system", "value": "Declare required version of zeit.cms\n" }, { "from": "human", "value": "from setuptools import setup, find_packages\n\nsetup(\n name='zeit.content.portraitbox',\n version='1.22.10dev',\n author='gocept',\n author_email='mail@gocept.com',\n url='https:...
python
chosen
[ { "from": "system", "value": "Replace relative links with absolute links\n" }, { "from": "human", "value": "import setuptools\n\nwith open(\"README.md\", \"r\") as fin:\n long_description = fin.read()\n\nsetuptools.setup(\n name=\"geneagrapher\",\n version=\"1.0\",\n author=\"David A...
python
chosen
[ { "from": "system", "value": "Add aws-status-check to declared binaries\n" }, { "from": "human", "value": "import os\n\nfrom setuptools import setup, find_packages\n\nversion = __import__('aws_status').__version__\n\ndef read(path):\n \"\"\"Return the content of a file.\"\"\"\n with open(p...
python
chosen
[ { "from": "system", "value": "Drop `author_email` - oops, excessive copy-paste\n" }, { "from": "human", "value": "import os\nfrom setuptools import setup, find_packages\n\n__version__ = '0.1'\n\nHERE = os.path.dirname(__file__)\n\ntry:\n long_description = open(os.path.join(HERE, 'README.rst'...
python
chosen
[ { "from": "system", "value": "Order restaurants by name in ListView\n" }, { "from": "human", "value": "from django.contrib.auth.mixins import LoginRequiredMixin\nfrom django.http import HttpResponseRedirect\nfrom django.urls import reverse\nfrom django.views.generic import TemplateView, View\nfr...
python
chosen
[ { "from": "system", "value": "Add twitter_id as lookup for user\n" }, { "from": "human", "value": "from rest_framework_mongoengine.viewsets import ModelViewSet\nfrom server.documents import Vote, User\nfrom server.serializers import VoteSerializer, UserSerializer\n\n\nclass VoteViewSet(ModelView...
python
chosen
[ { "from": "system", "value": "Add 'apps.hello' as separation of default installed apps\n" }, { "from": "human", "value": "# settings for development\nfrom common import *\n\nINTERNAL_IPS = ('127.0.0.1',)\n\nMIDDLEWARE_CLASSES += (\n 'debug_toolbar.middleware.DebugToolbarMiddleware',\n)\n\n\nS...
python
chosen
[ { "from": "system", "value": "Use braces for Python sets\n" }, { "from": "human", "value": "assert(type(5) == int)\nassert(type(True) == bool)\nassert(type(5.7) == float)\nassert(type(9 + 5j) == complex)\nassert(type((8, 'dog', False)) == tuple)\nassert(type('hello') == str)\nassert(type(b'hello...
python
chosen
[ { "from": "system", "value": "Set up a imgdata route to fetch latest image.\n" }, { "from": "human", "value": "\"\"\"Set up a bottle server to accept post requests commanding the drone.\"\"\"\nfrom bottle import post, run, hook, response, get, abort\n\nfrom venthur_api import libardrone\n\n\ndro...
python
chosen
[ { "from": "system", "value": "Add an is_validated key t OrganisationUserSerializer.\n" }, { "from": "human", "value": "from rest_framework import serializers\nfrom django.contrib.auth.models import Group\nfrom iati.permissions.models import OrganisationUser, OrganisationAdminGroup, OrganisationG...
python
chosen
[ { "from": "system", "value": "Update back to dev tag\n" }, { "from": "human", "value": "# Copyright 2022 The KerasCV Authors\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 obtain a copy of the...
python
chosen
[ { "from": "system", "value": "Add support for ./hash to mcmanage\n" }, { "from": "human", "value": "from ..objects import File, Album, Feedback, RedisObject, FailedFile\nfrom ..files import delete_file\n\ndef files_delete(arguments):\n hash = arguments['<hash>']\n\n f = File.from_hash(hash...
python
chosen
[ { "from": "system", "value": "Remove strip context for CX assembly\n" }, { "from": "human", "value": "from __future__ import absolute_import, print_function, unicode_literals\nfrom builtins import dict, str\nfrom os.path import join as pjoin\nfrom indra.assemblers import CxAssembler\nimport indr...
python
chosen
[ { "from": "system", "value": "Remove output formatting to get back what was put in\n" }, { "from": "human", "value": "import warnings\nfrom bs4 import BeautifulSoup\nfrom v1 import parse_links\n\n\ndef process_external_links(doc):\n warnings.filterwarnings('ignore')\n for key, value in doc...
python
chosen
[ { "from": "system", "value": "Add test for bspwm widget\n" }, { "from": "human", "value": "\nfrom collections import OrderedDict\nimport pytest\n\nfrom barython.hooks.bspwm import BspwmHook\n\n\ndef test_bspwm_hook_parse_event():\n bh = BspwmHook()\n status = (\"WmHDMI-0:Ou:LT:MDVI-D-0:fo:...
python
chosen
[ { "from": "system", "value": "Validate user when favorite a show\n" }, { "from": "human", "value": "from rest_framework import serializers as drf_serializers\n\nfrom cinemair.common.api import serializers\nfrom cinemair.shows.serializers import ShowRelatedSerializer\n\nfrom . import models\n\n\...
python
chosen
[ { "from": "system", "value": "Fix whitespace errors and line lengths\n" }, { "from": "human", "value": "# pipeunion.py\n#\n\nfrom pipe2py import util\n\ndef pipe_union(context, _INPUT, **kwargs):\n \"\"\"This operator merges up to 5 source together.\n\n Keyword arguments:\n context -- p...
python
chosen
[ { "from": "system", "value": "Add a function called override_settings_for_testing\n\nIn it, set SVN_REPO_PATH to a tempfile.mkdtemp() path.\n" }, { "from": "human", "value": "from django.conf import settings\nimport xmlrunner.extra.djangotestrunner\nfrom django.test.simple import run_tests\nimpo...
python
chosen
[ { "from": "system", "value": "Read XML files from a directory and find textblock by id\n" }, { "from": "human", "value": "#!/usr/bin/env python3\n# -*- coding: UTF-8 -*-\n\"\"\"\nReader for the newspaper XML files\n\"\"\"\nimport argparse\n\nfrom lxml import etree\n\nargparser = argparse.Argume...
python
chosen
[ { "from": "system", "value": "Change code because failed the random test\n" }, { "from": "human", "value": "def array_diff(a, b):\n return a if not b else [x for x in a if x != b[0]]\n" }, { "from": "gpt", "value": "def array_diff(a, b):\n return [x for x in a if x not in set(b...
python
chosen
[ { "from": "system", "value": "Add example commands for the Systeminfo api\n\nCurrently the api documentation does not include example commands.\nIt would be very friendly for our users to have some example commands\nto follow and use the api.\n\nThis patch adds examples to the Systeminfo section of the api ...
python
chosen
[ { "from": "system", "value": "Allow render opts to div.\n" }, { "from": "human", "value": "# -*- coding: utf-8 -*-\n\nfrom riot.layout import render_layout, patch_layout\n\ndef test_render_div():\n assert render_layout([\n 'div', {}, []\n ]) == [\n 'div',\n {\n ...
python
chosen
[ { "from": "system", "value": "[build-script] Make sure that StageArgs are never passed a StageArgs as their args.\n\nNo good reason to do this and simplifies the state space.\n" }, { "from": "human", "value": "# ===--- compiler_stage.py -----------------------------------------------===#\n#\n# T...
python
chosen
[ { "from": "system", "value": "Update migration history to include trackchanges migrations\n" }, { "from": "human", "value": "# -*- coding: utf-8 -*-\nfrom __future__ import unicode_literals\n\nfrom django.db import migrations, models\nimport django.utils.timezone\n\n\nclass Migration(migrations....
python
chosen
[ { "from": "system", "value": "Fix translation issue on EmailAuthForm\n" }, { "from": "human", "value": "# -*- coding: utf-8 -*-\n\nfrom django import forms\nfrom django.contrib.auth import authenticate\nfrom django.utils.translation import ugettext as _\n\nclass EmailAuthForm(forms.Form):\n e...
python
chosen
[ { "from": "system", "value": "Remove default filter that breaks unknown users export filter\n" }, { "from": "human", "value": "from corehq.apps.es import CaseES, GroupES\nfrom corehq.apps.es import FormES\n\n\ndef get_form_export_base_query(domain, app_id, xmlns, include_errors):\n query = (F...
python
chosen
[ { "from": "system", "value": "ENH: Add verbose argument to cubic_rectification\n" }, { "from": "human", "value": "\"\"\"\nModule provides a simple cubic_rectification function.\n\"\"\"\n\nimport numpy as np\n\n\ndef cubic_rectification(x):\n \"\"\"\n Rectified cube of an array.\n\n Para...
python
chosen
[ { "from": "system", "value": "Fix URL trailing slash bug in teams endpoint\n" }, { "from": "human", "value": "\"\"\"Defines the URL routes for the Team API.\"\"\"\n\nfrom django.conf import settings\nfrom django.conf.urls import patterns, url\n\nfrom .views import (\n TeamsListView,\n Team...
python
chosen
[ { "from": "system", "value": "Allow custon io loops for ConnectionPools\n" }, { "from": "human", "value": "from __future__ import absolute_import\n\nimport celery\n\nfrom tornado import ioloop\n\nfrom .connection import ConnectionPool\nfrom .producer import NonBlockingTaskProducer\nfrom .result ...
python
chosen