conversations
listlengths
2
3
source
stringclasses
1 value
stack
stringclasses
1 value
[ { "from": "system", "value": "Change name for arff read test.\n\ngit-svn-id: 003f22d385e25de9cff933a5ea4efd77cb5e7b28@4095 d6536bca-fef9-0310-8506-e4c0a848fbcf\n" }, { "from": "human", "value": "#!/usr/bin/env python\n\"\"\"Test for parsing arff headers only.\"\"\"\nimport os\n\nfrom scipy.testi...
python
chosen
[ { "from": "system", "value": "Add accent marks normalization and missing docstrings\n" }, { "from": "human", "value": "from unidecode import unidecode\n\n\nclass Normalizer:\n\n def normalize(text):\n text = Normalizer.remove_extra_whitespaces(text)\n text = Normalizer.replace_h...
python
chosen
[ { "from": "system", "value": "Move QUESTIONS_BUILDER from blueprint to a global variable\n" }, { "from": "human", "value": "from flask import Flask, request, redirect\nfrom flask.ext.bootstrap import Bootstrap\nfrom config import configs\nfrom dmutils import apiclient, init_app, flask_featurefla...
python
chosen
[ { "from": "system", "value": "Update the kmip package to allow importing enums globally\n\nThis change updates the root-level kmip package, allowing users\nto now import enums directly from the kmip package:\n\nfrom kmip import enums\n\nEnumerations are used throughout the codebase and user applications\nan...
python
chosen
[ { "from": "system", "value": "Update paas-manifest command to load per-app manifests\n\nRemoves template file option in favour of the app-specific manifests.\n\nChanges the way variables are set for the manifest template. Once\nthe relevant variable files are loaded and merged the command will\nupdate the t...
python
chosen
[ { "from": "system", "value": "Fix import of import_module for Py2.6\n" }, { "from": "human", "value": "# coding: utf-8\nfrom __future__ import unicode_literals\nfrom importlib import import_module\n\nfrom django.conf import settings\nfrom django.core.exceptions import ImproperlyConfigured\n\n\nd...
python
chosen
[ { "from": "system", "value": "Allow sead.Random to be constructed by internal state\n" }, { "from": "human", "value": "\nclass Random:\n\tdef __init__(self, seed):\n\t\tmultiplier = 0x6C078965\n\t\t\n\t\ttemp = seed\n\t\tself.state = []\n\t\tfor i in range(1, 5):\n\t\t\ttemp ^= temp >> 30\n\t\t\...
python
chosen
[ { "from": "system", "value": "Make oep-2 checker run again\n" }, { "from": "human", "value": "\"\"\"\nTop-level definition of the ``oep2`` commandline tool.\n\"\"\"\n\nimport click\n\nfrom . import explode_repos_yaml\nfrom .report import cli\n\n\ndef _cli():\n cli(auto_envvar_prefix=\"OEP2\")...
python
chosen
[ { "from": "system", "value": "Fix problem after stopping process\n" }, { "from": "human", "value": "import time\nimport threading\nfrom . import app, mongo, controller\nfrom bson.objectid import ObjectId\n\n\nclass Monitor(object):\n def __init__(self, timeout=10):\n self.thread = None...
python
chosen
[ { "from": "system", "value": "Remove thumbor use on init image, thumbor not django application\n" }, { "from": "human", "value": "# -*- coding: utf-8 -*-\nfrom django.utils.translation import ugettext_lazy as _\nfrom django.conf import settings\n\n\n\ntrans_app_label = _('Image')\nsettings.INSTA...
python
chosen
[ { "from": "system", "value": "Fix print format for python3" }, { "from": "human", "value": "# -*- coding: utf-8 -*-\n\n\"\"\"\n Simple example showing evaluating embedding on similarity datasets\n\"\"\"\nimport logging\nfrom six import iteritems\nfrom web.datasets.similarity import fetch_MEN, fe...
python
chosen
[ { "from": "system", "value": "Add a image shortcut to compute height and width with a ratio\n" }, { "from": "human", "value": "#!/usr/bin/env python\n# -*- coding: utf-8 -*-\n\nfrom __future__ import absolute_import\n\nfrom reportlab.platypus import (\n Paragraph as BaseParagraph,\n Spacer...
python
chosen
[ { "from": "system", "value": "Add ComplexApplication class for WSGI apps that uses not only urls resolving.\n" }, { "from": "human", "value": "import functools\n\nfrom .handler import handler\nfrom .urls import load_urls, resolve\n\n\ndef WSGIApplication(app_settings):\n '''Create main applic...
python
chosen
[ { "from": "system", "value": "Add project to hook table so it's a little more clear what it's a global one.\n" }, { "from": "human", "value": "import django_tables2 as tables\n\nfrom fabric_bolt.core.mixins.tables import ActionsColumn, PaginateTable\n\nfrom fabric_bolt.web_hooks import models\n\...
python
chosen
[ { "from": "system", "value": "Add capability to read pmids and get medline.\n" }, { "from": "human", "value": "__all__ = ['process_pmc']\n\nimport logging\nimport requests\n\nfrom .processor import RlimspProcessor\n\n\nlogger = logging.getLogger(__name__)\n\n\nRLIMSP_URL = 'https://research.bioi...
python
chosen
[ { "from": "system", "value": "Use range so code works with python 3\n" }, { "from": "human", "value": "import re\n\n\ndef ensure_trailing_slash(mystr):\n if not mystr.endswith('/'):\n mystr = mystr + '/'\n return mystr\n\n\ndef remove_trailing_slash(mystr):\n if mystr.endswith('/...
python
chosen
[ { "from": "system", "value": "Handle special characters in xls cell values\n" }, { "from": "human", "value": "\"\"\"EcoData Retriever Excel Functions\r\n\r\nThis module contains optional functions for importing data from Excel.\r\n\r\n\"\"\"\r\n\r\nclass Excel:\r\n @staticmethod\r\n def em...
python
chosen
[ { "from": "system", "value": "Fix a bug in the ReportingYear initialization\n" }, { "from": "human", "value": "#! /usr/bin/env python2.7\n\nimport model\n\nclass ReportingYear(model.Model):\n\tpass\nReportingYear.init_model(\"reporting_years\", \"reporting_year\")\n" }, { "from": "gpt", ...
python
chosen
[ { "from": "system", "value": "Make the landing page tests work again with i18n url\n" }, { "from": "human", "value": "from django.core.urlresolvers import resolve\nfrom django.test import TestCase, RequestFactory\nimport unittest\n\nfrom landing.views import LandingView\n\nclass LandingPageTests...
python
chosen
[ { "from": "system", "value": "Bump version 0.21.0rc5 --> 0.21.0rc6\n\nSigned-off-by: Jack Robison <40884020c67726395ea162083a125620dc32cdab@lbry.io>\n" }, { "from": "human", "value": "import logging\n\n__version__ = \"0.21.0rc5\"\nversion = tuple(__version__.split('.'))\n\nlogging.getLogger(__na...
python
chosen
[ { "from": "system", "value": "Print traceback on captured errors when loglevel is DEBUG\n" }, { "from": "human", "value": "\"\"\"\nThis module implements the some simple utilitiy functions.\n\n.. :copyright: (c) 2016 by Jelte Fennema.\n :license: MIT, see License for more details.\n\"\"\"\n\...
python
chosen
[ { "from": "system", "value": "Repair the regex for the homepage.\n" }, { "from": "human", "value": "\"\"\"elmo URL Configuration\n\nThe `urlpatterns` list routes URLs to views. For more information please see:\n https://docs.djangoproject.com/en/1.11/topics/http/urls/\nExamples:\nFunction vie...
python
chosen
[ { "from": "system", "value": "Remove ending slashes from urls\n" }, { "from": "human", "value": "from django.conf.urls import patterns, url\nfrom oscar.core.application import Application\n\nfrom systempay import views\n\n\nclass SystemPayApplication(Application):\n name = 'systempay' \n\n ...
python
chosen
[ { "from": "system", "value": "[Bugfix] Use memo parameter in TapBailout.copy\n" }, { "from": "human", "value": "#!/usr/bin/env python\n# -*- coding: utf-8 -*-\n\n\"\"\"\n exc.py\n ~~~~~~\n\n Exceptions for TAP file handling.\n\n (c) BSD 3-clause.\n\"\"\"\n\nfrom __future__ import div...
python
chosen
[ { "from": "system", "value": "Use Nabu settings in token generation\n" }, { "from": "human", "value": "from datetime import datetime, timedelta\nimport jwt\nimport os\n\n\nfrom django.shortcuts import render\nfrom django.conf import settings\nfrom django.views.generic.base import TemplateView\n\...
python
chosen
[ { "from": "system", "value": "Move chickens to other app\n" }, { "from": "human", "value": "from django.conf.urls import patterns, url\nfrom django.views.generic import TemplateView\n\nfrom .views import (\n PizzaCreateView, PizzaDeleteView, PizzaDetailView, PizzaListView,\n PizzaUpdateVie...
python
chosen
[ { "from": "system", "value": "Add more info to pytest header\n" }, { "from": "human", "value": "import sys\nsys._running_pytest = True\n\nfrom sympy.core.cache import clear_cache\n\ndef pytest_terminal_summary(terminalreporter):\n if (terminalreporter.stats.get('error', None) or\n ...
python
chosen
[ { "from": "system", "value": "Use two LSTM LM’s instead of single huge one" }, { "from": "human", "value": "from keras.layers import LSTM, Input, Reshape\nfrom keras.models import Model\n\nfrom ..layers import LMMask, Projection\n\n\nclass LanguageModel(Model):\n def __init__(self, n_batch, d_W...
python
chosen
[ { "from": "system", "value": "Add automatic regeneration for CLion\n" }, { "from": "human", "value": "#!/usr/bin/env python3\n\n\"\"\"This is a **proof-of-concept** CLion project generator.\"\"\"\n\nimport functools\nimport json\nimport subprocess\n\nsubprocess.check_call(['cook', '--results'])\...
python
chosen
[ { "from": "system", "value": "Use with block to start/stop the patch context manager.\n\n - this is less code, hopefully is just as clear why we need to 'yield'\n rather than just 'return'.\n\nhttps://trello.com/c/OpWI068M/380-after-g9-go-live-removal-of-old-filters-from-search-api-mapping\n" }, { ...
python
chosen
[ { "from": "system", "value": "Fix video id regex to use digits only." }, { "from": "human", "value": "from django.conf.urls.defaults import patterns, url\n\nfrom flicks.videos import views\n\nurlpatterns = patterns('',\n url(r'^video/(?P<video_id>[\\w]+)$', views.details,\n name='flick...
python
chosen
[ { "from": "system", "value": "Set default Django middleware in test settings\n" }, { "from": "human", "value": "import os\n\nfrom django.urls import (\n include,\n path,\n)\n\nBASE_DIR = os.path.dirname(__file__)\nSTATIC_URL = \"/static/\"\n\nINSTALLED_APPS = (\n 'gcloudc',\n 'djanga...
python
chosen
[ { "from": "system", "value": "Clarify what _MultiVAlueEnum does and where it comes from.\n" }, { "from": "human", "value": "import random\nfrom enum import Enum\nfrom enum34_custom import _MultiValueMeta, OrderableMixin, CaseInsensitiveMultiValueEnum\nfrom types import DynamicClassAttribute\n\n\...
python
chosen
[ { "from": "system", "value": "Use filter_horizontal for many-to-many fields.\n" }, { "from": "human", "value": "from django.contrib import admin\n\nfrom .models import Discussion, Group\n\n\nadmin.site.register(Discussion)\nadmin.site.register(Group)\n" }, { "from": "gpt", "value": "...
python
chosen
[ { "from": "system", "value": "Update \"The Order of the Stick\" after site change\n" }, { "from": "human", "value": "from comics.aggregator.crawler import CrawlerBase, CrawlerImage\nfrom comics.core.comic_data import ComicDataBase\n\n\nclass ComicData(ComicDataBase):\n name = \"The Order of t...
python
chosen
[ { "from": "system", "value": "Add more types in protocol map\n" }, { "from": "human", "value": "SYNTAX_BUILDABLE_EXPRESSIBLE_AS_CONFORMANCES = {\n 'DeclBuildable': [\n 'CodeBlockItem',\n 'MemberDeclListItem',\n 'SyntaxBuildable'\n ],\n 'ExprList': [\n 'Condit...
python
chosen
[ { "from": "system", "value": "Set default path in EN/DE tests.\n" }, { "from": "human", "value": "import pytest\nimport os\n\nfrom ..en import English\nfrom ..de import German\n\n\n@pytest.fixture(scope=\"session\")\ndef EN():\n return English(path=False)\n\n@pytest.fixture(scope=\"session\")...
python
chosen
[ { "from": "system", "value": "Add test for media handlers\n" }, { "from": "human", "value": "import pytest\nfrom aiotg import TgBot\nfrom aiotg import MESSAGE_TYPES\n\nAPI_TOKEN = \"test_token\"\n\ndef text_msg(text):\n return {\n \"message_id\": 0,\n \"from\": {},\n \"ch...
python
chosen
[ { "from": "system", "value": "Add CBV for redirecting / to /ticket\n" }, { "from": "human", "value": "from django.conf import settings\nfrom django.conf.urls import patterns, include\nfrom django.contrib import admin\n\nurlpatterns = patterns('',\n (r'^ticket/', include('ticketus.ui.urls')),\...
python
chosen
[ { "from": "system", "value": "Make URI the only db config entry\n" }, { "from": "human", "value": "import datetime\n\n# Override this key with a secret one\nSECRET_KEY = 'default_secret_key'\nHASHIDS_SALT = 'default_secret_salt'\n\n# This should be set to true in the production config when using...
python
chosen
[ { "from": "system", "value": "Add UsesQCoreApplication in state machine test\n" }, { "from": "human", "value": "#!/usr/bin/python\nimport unittest\nfrom PySide.QtCore import QObject, QState, QFinalState, SIGNAL, QCoreApplication, QTimer, QStateMachine, QSignalTransition, QVariant, QParallelAnima...
python
chosen
[ { "from": "system", "value": "Add test for sessionadapter.refresh when segment is disable\n" }, { "from": "human", "value": "import pytest\n\nfrom wagtail_personalisation import adapters\nfrom tests.factories.segment import SegmentFactory\n\n\n@pytest.mark.django_db\ndef test_get_segments(rf, mo...
python
chosen
[ { "from": "system", "value": "Add accounting group to apidocs" }, { "from": "human", "value": "API_GROUPS = {\n 'authentication': ['/api-auth/', '/api/auth-valimo/',],\n 'user': ['/api/users/', '/api/user-invitations/', '/api/user-counters/',],\n 'organization': [\n '/api/custome...
python
chosen
[ { "from": "system", "value": "Fix menu items for noi/tickets\n\n" }, { "from": "human", "value": "# -*- coding: UTF-8 -*-\n# Copyright 2016 Luc Saffre\n# License: BSD (see file COPYING for details)\n\"\"\"Fixtures specific for the Team variant of Lino Noi.\n\n.. autosummary::\n :toctree:\n\n ...
python
chosen
[ { "from": "system", "value": "Migrate account_id from integer field to char field\n" }, { "from": "human", "value": "# -*- coding: utf-8 -*-\n\"\"\"\n configuration.py\n\n\"\"\"\nfrom trytond.model import fields, ModelSingleton, ModelSQL, ModelView\n\n__all__ = ['EndiciaConfiguration']\n\n\nc...
python
chosen
[ { "from": "system", "value": "Test Pycharm version control plugin.\n" }, { "from": "human", "value": "from django.http import HttpResponse\nfrom django.shortcuts import render\n\n\ndef func(request):\n return HttpResponse(\"This is my first django project!\")\n\n\ndef add(request):\n a = r...
python
chosen
[ { "from": "system", "value": "Remove unused moa exception class.\n" }, { "from": "human", "value": "'''\n* when dispatching events, returning True stops it.\n'''\n\n\nfrom weakref import ref\nfrom kivy.event import EventDispatcher\nfrom kivy.properties import StringProperty, OptionProperty, Obje...
python
chosen
[ { "from": "system", "value": "Increment minor version to 0.7\n" }, { "from": "human", "value": "\"\"\"yolk.\n\nAuthor: Rob Cakebread <cakebread at gmail>\n\nLicense : BSD\n\n\"\"\"\n\n__version__ = '0.6.2'\n" }, { "from": "gpt", "value": "\"\"\"yolk.\n\nAuthor: Rob Cakebread <cakebr...
python
chosen
[ { "from": "system", "value": "Use a smaller set of users in fake game one gameplay\n" }, { "from": "human", "value": "import random\n\nfrom django.core.management.base import BaseCommand\nfrom django.contrib.auth.models import User\n\nfrom ...models import (\n Transcript, TranscriptPhraseVote...
python
chosen
[ { "from": "system", "value": "Make test independent of whatever else is in the database.\nAlso, use a different way of calling subprocess.Popen so that we can\nuse quotes and dollars without having to do difficult\ncross-architectural escaping.\n" }, { "from": "human", "value": "import os, sys\n...
python
chosen
[ { "from": "system", "value": "Use is_naive here for clarity\n" }, { "from": "human", "value": "from __future__ import unicode_literals\n\nfrom calendar import timegm\nfrom datetime import datetime\n\nfrom django.conf import settings\nfrom django.utils import six\nfrom django.utils.functional imp...
python
chosen
[ { "from": "system", "value": "Fix bug in ranges (to middle)\n\n- in SPOJ palin\n\nSigned-off-by: Karel Ha <70f8965fdfb04f1fc0e708a55d9e822c449f57d3@gmail.com>\n" }, { "from": "human", "value": "#!/usr/bin/env python3\ndef next_palindrome(k):\n\tpalin = list(k)\n\tn = len(k)\n\tmid = n // 2\n\t\n...
python
chosen
[ { "from": "system", "value": "Fix import not ordered alphabetically\n" }, { "from": "human", "value": "from setuptools import setup\n\nsetup(\n name = 'g1.http.servers',\n packages = [\n 'g1.http.servers',\n ],\n install_requires = [\n 'g1.bases',\n 'g1.asyncs.ke...
python
chosen
[ { "from": "system", "value": "[DEV] Add meta information for damn package\n" }, { "from": "human", "value": "\"\"\"\n**damn** (aka *digital audio for music nerds*) is an easy-to-use python package\nfor digital audio signal processing, analysis and synthesis.\n\"\"\"\n\n__version__ = '0.0.0'\n" ...
python
chosen
[ { "from": "system", "value": "Fix configuration of email default sender\n" }, { "from": "human", "value": "from flask_mail import Message\n\nfrom zou.app import mail, app\n\n\ndef send_email(subject, body, recipient_email, html=None):\n \"\"\"\n Send an email with given subject and body to...
python
chosen
[ { "from": "system", "value": "Insert third_party into the second slot of sys.path rather than the last slot" }, { "from": "human", "value": "import os.path\nimport sys\n\n# This bit of evil should inject third_party into the path for relative imports.\nsys.path.append(os.path.dirname(__file__))\...
python
chosen
[ { "from": "system", "value": "Revert \"Python tests now return an error code on fail.\"\n" }, { "from": "human", "value": "#!/usr/bin/python\n\nimport os\nimport optparse\nimport sys\nimport unittest\n\nUSAGE = \"\"\"%prog SDK_PATH TEST_PATH\nRun unit tests for App Engine apps.\n\nSDK_PATH P...
python
chosen
[ { "from": "system", "value": "Fix bugs in new Highcharts options\n" }, { "from": "human", "value": "boilerplate = {\n 'chart': {\n 'renderTo': 'container',\n 'plotBackgroundColor': 'none',\n 'backgroundColor'': 'none',\n },\n 'title': {'text': 'null'}\n 'subtitle...
python
chosen
[ { "from": "system", "value": "Change default time between images\n" }, { "from": "human", "value": "import subprocess\nfrom datetime import datetime, timedelta\nframe_counter = 1\n\n# Time in seconds\n# 1 Hour = 3600\n# 1 Day = 86400\n\n# Time between each photo (seconds)\ntime_between_frames =...
python
chosen
[ { "from": "system", "value": "Fix reference to acq table file in script\n" }, { "from": "human", "value": "#!/usr/bin/env python\n# Licensed under a 3-clause BSD style license - see LICENSE.rst\n\nfrom mica.stats import update_acq_stats\nupdate_acq_stats.main()\n\nimport os\ntable_file = mica.st...
python
chosen
[ { "from": "system", "value": "Add random functionality to map move.\n" }, { "from": "human", "value": "from locust import HttpLocust, TaskSet, task\n\n\nclass UserBehavior(TaskSet):\n tasks = []\n\n def on_start(self):\n pass\n\n @task\n def index(self):\n self.client.g...
python
chosen
[ { "from": "system", "value": "Update wavedrom tests to get simulators via fixture" }, { "from": "human", "value": "import subprocess\nfrom utils import *\n\n\n@all_files_in_dir('wavedrom_0')\ndef test_wavedrom_0(datafiles):\n with datafiles.as_cwd():\n subprocess.check_call(['python3',...
python
chosen
[ { "from": "system", "value": "Test if pvs are loaded correctly from the database\n" }, { "from": "human", "value": "import rml.machines\n\n\ndef test_machine_load_elements():\n lattice = rml.machines.get_elements(machine='SRI21', elemType='BPM')\n assert len(lattice) == 173\n for elemen...
python
chosen
[ { "from": "system", "value": "Fix topn metric view regression on PyTorch 1.7\n" }, { "from": "human", "value": "\"\"\" Eval metrics and related\n\nHacked together by / Copyright 2020 Ross Wightman\n\"\"\"\n\n\nclass AverageMeter:\n \"\"\"Computes and stores the average and current value\"\"\"...
python
chosen
[ { "from": "system", "value": "Add unit test for str2cat method.\n" }, { "from": "human", "value": "\"\"\"Unit tests for cat2cohort.\"\"\"\n\nimport unittest\nfrom mw_util import str2cat\n\n\nclass TestMWutil(unittest.TestCase):\n\n \"\"\"Test methods from mw_util.\"\"\"\n\n pass\n" }, ...
python
chosen
[ { "from": "system", "value": "Add tests for a React Component\n" }, { "from": "human", "value": "# -*- coding: utf-8 -*-\nimport dukpy\n\n\nclass TestReactJS(object):\n def test_hello_world(self):\n jsx = dukpy.jsx_compile('var react_hello = <h1>Hello, world!</h1>;')\n jsi = duk...
python
chosen
[ { "from": "system", "value": "Clean a weird unicode char in beginning of file\n\nThe first char in clevercss.py filter is <U+FEFF>, which doesn't show up in vim or other editors.\nCan view it in less and can edit it using nano.\n\nThis was throwing up UnicodeDecodeErrors when running nosetests with html out...
python
chosen
[ { "from": "system", "value": "Add attributes to Mock object to fix Travis build\n" }, { "from": "human", "value": "from . import qt_api\n\nif qt_api == 'pyside':\n from PySide.QtCore import *\nelif qt_api == 'pyqt':\n from PyQt4.QtCore import *\nelse:\n # Mock objects\n Qt = None\n ...
python
chosen
[ { "from": "system", "value": "Load tests helpers using entry_points\n" }, { "from": "human", "value": "import os\nfrom importlib import import_module\n\nfrom .testdriver import TestDriver\n\n\nclass Driver(TestDriver):\n drivers = {}\n\n def __new__(cls, type, *args, **kwargs):\n if...
python
chosen
[ { "from": "system", "value": "Fix crash on non-logged in users.\n" }, { "from": "human", "value": "\"\"\"\nUtility functions for the accounts app.\n\"\"\"\nfrom django.core.exceptions import ObjectDoesNotExist\n\ndef get_user_city(user):\n \"\"\"Return the user's city. If unavailable, return...
python
chosen
[ { "from": "system", "value": "Update dsub version to 0.2.3.\n\nPiperOrigin-RevId: 222307052\n" }, { "from": "human", "value": "# Copyright 2017 Google Inc. All Rights Reserved.\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may not use this file except in complian...
python
chosen
[ { "from": "system", "value": "Add .herokuapp.com to ALLOWED_HOSTS to support review apps" }, { "from": "human", "value": "from service.settings.production import *\n\nALLOWED_HOSTS = [\n 'fantastic-doodle--staging.herokuapp.com',\n]\n" }, { "from": "gpt", "value": "from service.se...
python
chosen
[ { "from": "system", "value": "Remove unnecessary URL name in Sell app\n" }, { "from": "human", "value": "from django.conf.urls import url\n\nfrom sell import views\n\n\nurlpatterns = [\n url(r'^$', views.index, name='index'),\n url(r'^personal/$', views.personal_data),\n url(r'^books/$'...
python
chosen
[ { "from": "system", "value": "Use absolute path for config file so it works with apps like Hazel\n" }, { "from": "human", "value": "from os import path\nfrom ConfigParser import ConfigParser\nimport requests\nimport sys\n\ndef reverse_lookup(lat, lon):\n if(lat is None or lon is None):\n ...
python
chosen
[ { "from": "system", "value": "Fix missing import of formula in fmri." }, { "from": "human", "value": "\"\"\"\nTODO\n\"\"\"\n\n__docformat__ = 'restructuredtext'\n\nimport fmri, hrf, utils\nimport fmristat\n\nfrom nipy.testing import Tester\ntest = Tester().test\nbench = Tester().bench\n" }, ...
python
chosen
[ { "from": "system", "value": "Add docstring + fix missing import in allow_udnefined module." }, { "from": "human", "value": "import os\n\nfrom subprocess import Popen, PIPE\n\ndef get_darwin_version():\n p = Popen([\"sw_vers\", \"-productVersion\"], stdout = PIPE, stderr = PIPE)\n st = p.w...
python
chosen
[ { "from": "system", "value": "Fix the new get_app compatibility function.\n\nThe get_app compatibility function was trying to call get_apps() on\nthe apps variable, instead of calling the extracted version that was\npre-computed. Now it uses the correct versions.\n" }, { "from": "human", "value"...
python
chosen
[ { "from": "system", "value": "Fix database backends analyzer: 'postgresql' backend has been deprecated in 1.2\n" }, { "from": "human", "value": "import ast\n\nfrom .base import BaseAnalyzer, Result\n\n\nclass DB_BackendsVisitor(ast.NodeVisitor):\n\n def __init__(self):\n self.found = [...
python
chosen
[ { "from": "system", "value": "Add compute test cases for all complexity classes\n" }, { "from": "human", "value": "import unittest\nimport numpy as np\nfrom numpy.testing import assert_array_almost_equal\n\nfrom big_o import complexities\n\n\nclass TestComplexities(unittest.TestCase):\n\n def...
python
chosen
[ { "from": "system", "value": "Add MIDDLEWARE_CLASSES to settings, remove warnings\n" }, { "from": "human", "value": "import sys\n\ntry:\n from django.conf import settings\n\n settings.configure(\n DEBUG=True,\n USE_TZ=True,\n DATABASES={\n \"default\": {\n ...
python
chosen
[ { "from": "system", "value": "Order parents in Admin select field\n" }, { "from": "human", "value": "from django.contrib import admin\n\nfrom .models import Page, PageRead, Tag\n\n\nclass PageAdmin(admin.ModelAdmin):\n search_fields = [\"title\"]\n list_display = [\"title\", \"parent\", \"...
python
chosen
[ { "from": "system", "value": "Fix for json encoding Decimal values\n" }, { "from": "human", "value": "import json\nimport datetime\nfrom django.utils.encoding import force_unicode\nfrom django.utils.functional import Promise\n\n\nclass LazyEncoder(json.JSONEncoder):\n \"\"\"Taken from https:/...
python
chosen
[ { "from": "system", "value": "Make unittest test runner work in older pythons\n" }, { "from": "human", "value": "#!/usr/bin/env python\n\nimport unittest\n\nimport git_mnemonic as gm\n\nclass GitMnemonicTests(unittest.TestCase):\n def test_encode(self):\n self.assertTrue(gm.encode(\"ma...
python
chosen
[ { "from": "system", "value": "Add tests for a correct behaviour in cookiecutter.main for replay\n" }, { "from": "human", "value": "# -*- coding: utf-8 -*-\n\n\"\"\"\ntest_replay\n-----------\n\"\"\"\n\nimport pytest\n\nfrom cookiecutter import replay, main, exceptions\n\n\ndef test_get_replay_fi...
python
chosen
[ { "from": "system", "value": "Establish connection only when needed\n" }, { "from": "human", "value": "import xmlrpclib\nimport cPickle\nimport subprocess\nfrom time import sleep\n\np = None\ns = None\n\ndef start_plot_server():\n global p\n if p is None:\n p = subprocess.Popen([\"p...
python
chosen
[ { "from": "system", "value": "Use the TBinaryProtocolAccelerated protocol instead of TBinaryProtocol to improve performance.\n" }, { "from": "human", "value": "#!/usr/bin/python\n\nimport sys\nimport os\nimport glob\n#sys.path.append(os.path.join(os.path.dirname(__file__), \"gen-py\"))\nsys.path...
python
chosen
[ { "from": "system", "value": "Update support for passing in filenames.\n\nThis shit is gross\n" }, { "from": "human", "value": "from imhotep.tools import Tool\nfrom collections import defaultdict\nimport json\nimport os\nimport logging\n\nlog = logging.getLogger(__name__)\n\n\nclass FoodCritic(T...
python
chosen
[ { "from": "system", "value": "Make this into a partial to get the protocol correctly.\n" }, { "from": "human", "value": "\"\"\"\nAsphalt framework mixin for Kyokai.\n\"\"\"\nimport logging\n\nimport asyncio\nfrom functools import partial\nfrom typing import Union\n\nfrom asphalt.core import Comp...
python
chosen
[ { "from": "system", "value": "Test for the hx launcher.\n" }, { "from": "human", "value": "import pytest_twisted\n\nfrom hendrix.ux import main\nfrom hendrix.options import HendrixOptionParser\n\n\ndef test_no_arguments_gives_help_text(mocker):\n\n class MockFile(object):\n @classmetho...
python
chosen
[ { "from": "system", "value": "Call MPIOutput.file.Sync() in MPIOutput.file._write() to prevent log lines from intermittently being lost.\n" }, { "from": "human", "value": "#!/usr/bin/env python\n\n\"\"\"\nMPI utilities.\n\"\"\"\n\nfrom mpi4py import MPI\nimport twiggy\n\nclass MPIOutput(twiggy.o...
python
chosen
[ { "from": "system", "value": "Change comment from a charfield to a textfield, and add a date_created field; which is not working correctly.\n" }, { "from": "human", "value": "from django.db import models\nfrom django.contrib.auth.models import User\n\nclass Project(models.Model):\n user = mod...
python
chosen
[ { "from": "system", "value": "Use the existing util.cli module" }, { "from": "human", "value": "\"\"\"Displays currently active gpu by optimus-manager\nRequires the following packages:\n\n * optimus-manager\n\n\"\"\"\n\nimport subprocess\n\nimport core.module\nimport core.widget\n\n\nclass Mo...
python
chosen
[ { "from": "human", "value": "Allow modules that use dudebot to just import dudebot...\n" }, { "from": "gpt", "value": "from core import BotAI\nfrom core import Connector\n\nfrom decorators import message_must_begin_with\nfrom decorators import message_must_begin_with_attr\nfrom decorators import...
python
chosen
[ { "from": "system", "value": "Fix testcase for better coverage\n" }, { "from": "human", "value": "from .initial_data import request_user, chatid\n\nrequest = {\n \"endpoint\": \"/api/chats/{}/participants\".format(chatid),\n \"method\": \"post\",\n \"user\": request_user,\n \"body\":...
python
chosen
[ { "from": "system", "value": "Change categories field to non required.\n" }, { "from": "human", "value": "from __future__ import unicode_literals\n\nfrom django.db import models\nfrom django.contrib.auth.models import AbstractUser\nfrom django.utils.encoding import python_2_unicode_compatible\n\...
python
chosen
[ { "from": "system", "value": "Change the is_producttype template tag to return a boolean rather than a string.\n\n--HG--\nextra : convert_revision : svn%3Aa38d40e9-c014-0410-b785-c606c0c8e7de/satchmo/trunk%401200\n" }, { "from": "human", "value": "from django import template\nfrom django.conf im...
python
chosen
[ { "from": "system", "value": "Fix typo and improve grammar in doc string\n" }, { "from": "human", "value": "# -*- coding: utf-8 -*-\n\n\"\"\"Jinja2 extensions.\"\"\"\n\nimport json\n\nfrom jinja2.ext import Extension\n\n\nclass JsonifyExtension(Extension):\n \"\"\"Jinja2 extension to convert ...
python
chosen
[ { "from": "system", "value": "Add known offset for known bad calibration.\n\n\nFormer-commit-id: afa3d6a66e32bbcc2b20f00f7e63fba5cb45882e [formerly 0470ca22b8a24205d2eb1c66caee912c990da0b3] [formerly c23210f4056c27e61708da2f2440bce3eda151a8 [formerly 5c0a6b9c0fefd2b88b9382d4a6ed98d9eac626df]]\nFormer-commit...
python
chosen
[ { "from": "system", "value": "Include path_params in override constructor\n" }, { "from": "human", "value": "from getpass import getpass\nfrom bessie import BaseClient\n\nimport config \n\n\nclass MicroBlogApi(BaseClient):\n\n\tendpoints = config.available_endpoints\n\tseparator = '/'\n\tbase_ur...
python
chosen
[ { "from": "system", "value": "Add weakref assertion in test case\n" }, { "from": "human", "value": "\"\"\" Tests for the garbage collection of Scene objects.\n\"\"\"\n# Authors: Deepak Surti, Ioannis Tziakos\n# Copyright (c) 2015, Enthought, Inc.\n# License: BSD Style.\n\nimport unittest\nimport...
python
chosen