conversations
listlengths
2
3
source
stringclasses
1 value
stack
stringclasses
1 value
[ { "from": "system", "value": "Add ability to test model on all images in some directory\n" }, { "from": "human", "value": "\"\"\"\nClassify images using random decision forests\n\"\"\"\n\nimport sys\n\nfrom mlearner import train_model\nfrom utils import get_feature_vector\n\n\ndef classify_image...
python
chosen
[ { "from": "system", "value": "Fix test failure by using unicode literals\n" }, { "from": "human", "value": "# coding: utf-8\n\nfrom io import StringIO\n\nword2vec_str = \"\"\", -0.046107 -0.035951 -0.560418\nde -0.648927 -0.400976 -0.527124\n. 0.113685 0.439990 -0.634510\n  -1.499184 -0.184280 -...
python
chosen
[ { "from": "system", "value": "Put the directories back as they were for the server\n" }, { "from": "human", "value": "from altitude import run\r\n\r\n\r\nrun.run(\"27279\", \"C://Program Files (x86)/Altitude/servers/command.txt\", \"C://Program Files (x86)/Altitude/servers/log.txt\",\r\n ...
python
chosen
[ { "from": "system", "value": "Fix redirect page size voor vjb\n" }, { "from": "human", "value": "from rest_framework import generics\n\nfrom bluebottle.bluebottle_drf2.pagination import BluebottlePagination\nfrom .models import Redirect\nfrom .serializers import RedirectSerializer\n\n\nclass Red...
python
chosen
[ { "from": "system", "value": "Fix prefix checking only working for botmaster commands\n" }, { "from": "human", "value": "from discord.ext import commands\n\nfrom bot_globals import bot_masters, blacklist\n\n#Check if a user is allowed to use a command\n#Perm 0 is simply blacklist checking\n#Perm...
python
chosen
[ { "from": "system", "value": "Fix steps calculation in dummy client -- how did this work before?\n" }, { "from": "human", "value": "\"\"\"MetricSource that serves dummy data.\"\"\"\n\nimport random\nfrom vumidash.base import MetricSource, UnknownMetricError\n\n\nclass DummyClient(MetricSource):\...
python
chosen
[ { "from": "system", "value": "Remove dead code from AlchemyJSONEncoder\n\nSigned-off-by: Michal Juranyi <29976087921aeab920eafb9b583221faa738f3f4@vnet.eu>\n" }, { "from": "human", "value": "import json\nimport decimal\nimport datetime\nimport sqlalchemy\n\n\nclass AlchemyJSONEncoder(json.JSONEnc...
python
chosen
[ { "from": "system", "value": "Enable online lookups for test.\n" }, { "from": "human", "value": "import os\nfrom wikipediabase.fetcher import CachingSiteFetcher\n\nALL_TEST_PAGES = [\n]\n\n\ndef data(fname):\n return os.path.abspath('/'.join([__package__, 'data', fname]))\n\n\ndef read_data(f...
python
chosen
[ { "from": "system", "value": "Fix the filename normalizing to keep extension\n" }, { "from": "human", "value": "# -*- coding: utf-8 -*-\nimport datetime\nimport slugify as unicodeslugify\n\nfrom django.db import models, transaction\nfrom django.conf import settings\nfrom django.contrib.auth impo...
python
chosen
[ { "from": "system", "value": "Index should be ones without a category.\n" }, { "from": "human", "value": "from django.http import Http404\nfrom django.views.generic import ListView, DetailView\n\nfrom faq.models import Question, Category\n\nclass FAQQuestionListView(ListView):\n\t\n\tcontext_obj...
python
chosen
[ { "from": "system", "value": "Add a memory used metric\n" }, { "from": "human", "value": "#!/usr/bin/python2\n# vim:set ts=4 sw=4 et nowrap syntax=python ff=unix:\n\n##############################################################################\n\nimport sys, time\n\ndef memory ():\n f = open...
python
chosen
[ { "from": "system", "value": "Print generated date & time\n" }, { "from": "human", "value": "import graph\n\ndef generate():\n count = graph.getTotalCount()\n zahajeni = graph.getSkupinaZahajeni(count)\n probihajici = graph.getSkupinaProbihajici(count)\n\n printHeader()\n printBod...
python
chosen
[ { "from": "system", "value": "Use a separate communicator for each cxi writer\n" }, { "from": "human", "value": "try:\n import h5writer\nexcept ImportError:\n print 100*\"*\"\n print \"ERROR: For using the utils.cxiwriter.CXIWriter class please install the package \\'h5writer\\'.\"\n ...
python
chosen
[ { "from": "system", "value": "Fix Bird Feeder Reader URL.\n" }, { "from": "human", "value": "import urllib\n\nfrom base.constants import CONSTANTS\nimport session\n\nclass IndexHandler(session.SessionApiHandler):\n def _get_signed_in(self):\n twitter_user = self._api.GetUser(self._sess...
python
chosen
[ { "from": "system", "value": "Complete update method of User Serializer\n" }, { "from": "human", "value": "from rest_framework import serializers\nfrom .models import CFUser\n\n\nclass CFUserSerializer(serializers.ModelSerializer):\n \"\"\"\n Serializes a CFUser Model\n \"\"\"\n user...
python
chosen
[ { "from": "system", "value": "Add --offline flag for testing without downloads\n" }, { "from": "human", "value": "\ndef pytest_addoption(parser):\n parser.addoption(\"--webdriver\", action=\"store\", default=\"None\",\n help=(\"Selenium WebDriver interface to use for runni...
python
chosen
[ { "from": "system", "value": "Set stories_set to read only field\n" }, { "from": "human", "value": "from rest_framework import serializers\n\nfrom users.serializers import AuthorSerializer\nfrom .models import Story, StoryLine\n\n\nclass StoryLineSerializer(serializers.ModelSerializer):\n cla...
python
chosen
[ { "from": "system", "value": "Hide documentation commands in non-python scope\n" }, { "from": "human", "value": "# -*- coding: utf-8 -*-\nimport sublime\nimport sublime_plugin\n\nfrom .utils import ask_daemon\n\n\nclass HelpMessageCommand(sublime_plugin.TextCommand):\n\n def run(self, edit, d...
python
chosen
[ { "from": "system", "value": "Use existing jquery for debug toolbar.\n" }, { "from": "human", "value": "from base import *\n\nEMAIL_BACKEND = 'django.core.mail.backends.console.EmailBackend'\n\nINSTALLED_APPS += [\n 'debug_toolbar',\n]\n" }, { "from": "gpt", "value": "from base im...
python
chosen
[ { "from": "system", "value": "Fix pyc test for python3\n\nTo import pyc modules, we must move them out of the __pycache__\ndirectory and rename them to remove \".cpython-%s%d\".\n\nThis should still faild with python3 (UnicodeDecodeError)\n" }, { "from": "human", "value": "\"\"\"\nTest completio...
python
chosen
[ { "from": "system", "value": "Add validator if latitude/longitude is empty\n" }, { "from": "human", "value": "from flask.ext.wtf import Form\nfrom wtforms.fields import FloatField, StringField, SubmitField\nfrom wtforms.validators import InputRequired, Length\n\n\nclass SingleResourceForm(Form):...
python
chosen
[ { "from": "system", "value": "Change jaro-winkler to cosine similarity\n" }, { "from": "human", "value": "from pygraphc.preprocess.ParallelPreprocess import ParallelPreprocess\nfrom pygraphc.similarity.JaroWinkler import JaroWinkler\nfrom pygraphc.pruning.TrianglePruning import TrianglePruning\n...
python
chosen
[ { "from": "system", "value": "Fix arguments order of reqon.deprecated.build_terms().\n" }, { "from": "human", "value": "import rethinkdb as r\n\nfrom . import coerce, geo, operators, terms\nfrom .coerce import COERSIONS\nfrom .operators import BOOLEAN, EXPRESSIONS, MODIFIERS\nfrom .terms import ...
python
chosen
[ { "from": "system", "value": "Reduce the verbosity of the tests.\n\nSigned-off-by: Gora Khargosh <a2078c57e3ac12c6dfb97b7c2c4e6d6d7db7e92f@gmail.com>\n" }, { "from": "human", "value": "#!/usr/bin/env python\n# -*- coding: utf-8 -*-\n\nimport os\nimport sys\nimport unittest2 as unittest\n\ncurren...
python
chosen
[ { "from": "human", "value": "Add config file for subsciber ID.\n" }, { "from": "gpt", "value": "from azure.mgmt.cognitiveservices import CognitiveServicesManagementClient\nfrom azure.common.credentials import UserPassCredentials\nimport cfg\n\nc = cfg.read_cfg()\n\nsubscription_id = c['txtkey']\...
python
chosen
[ { "from": "system", "value": "Use str(s) instead of s.unescape() to add support for escaping things inside. (took me a while to find that str() worked)\n" }, { "from": "human", "value": "import htmlmin\nfrom markupsafe import Markup\n\nfrom qxlc import app\n\n\n@app.template_filter(\"minify\")\n...
python
chosen
[ { "from": "system", "value": "Make get_signature support unicode characters by encoding to utf-8 instead of ascii.\n" }, { "from": "human", "value": "import hashlib\nimport hmac\nimport urllib, urllib2\n\nKEY_STATUSES = (\n ('U', 'Unactivated'),\n ('A', 'Active'),\n ('S', 'Suspended')\n...
python
chosen
[ { "from": "system", "value": "Make es-index-data command use multiprocess indexing.\n" }, { "from": "human", "value": "from pyramid.paster import get_app\nimport logging\nfrom webtest import TestApp\n\nindex = 'encoded'\n\nEPILOG = __doc__\n\n\ndef run(app, collections=None, record=False):\n ...
python
chosen
[ { "from": "system", "value": "Set default for BMI_VERSION_STRING to 1.1.\n" }, { "from": "human", "value": "# Both of these variables should be overriden to test a particular\n# BMI class\nBmi = None\nINPUT_FILE = None\n" }, { "from": "gpt", "value": "# Both of these variables should...
python
chosen
[ { "from": "system", "value": "structures: Raise more appropriate UnknownStructure exception rather than StructureError if a structure is not found.\n" }, { "from": "human", "value": "#!/usr/bin/python\n# -*- coding: utf-8 -*-\n\nfrom .base import DBStructure, _Generated\nfrom .files.main import ...
python
chosen
[ { "from": "system", "value": "Use get_caller_identity instead of default SG to determine account id\n" }, { "from": "human", "value": "import boto3\n\n\nclass Helpers(object):\n \"\"\"A container class for convenience functions.\"\"\"\n\n _aws_account_id = None\n\n @classmethod\n def...
python
chosen
[ { "from": "system", "value": "Fix syntax error, missing ')'" }, { "from": "human", "value": "import sys\r\n\r\n\r\nfai = sys.argv[1]\r\nchunk_size = int(sys.argv[2])\r\noverlap = 150 # Base pairs\r\nwith open(fai, 'r') as infile:\r\n for line in infile:\r\n name = line.split('\\t')[0]...
python
chosen
[ { "from": "system", "value": "Add utility function to get the robot that a given user currently has booked out (or None).\n" }, { "from": "human", "value": "from datetime import datetime\n\nfrom .exceptions import ClientError\nfrom .models import Booking, RobotTerminal\n\n\ndef get_robot_termina...
python
chosen
[ { "from": "system", "value": "Add the last line to the info message\n" }, { "from": "human", "value": "from collections import defaultdict\nfrom logging import getLogger\n\nfrom pip._vendor.resolvelib.reporters import BaseReporter\n\nfrom pip._internal.utils.typing import MYPY_CHECK_RUNNING\n\ni...
python
chosen
[ { "from": "system", "value": "Comment out the initial migration step by default (so that we're not inadvertently blowing peoples databases away\n" }, { "from": "human", "value": "from sqlalchemy import *\nfrom migrate import *\n\ndef upgrade(migrate_engine):\n # Upgrade operations go here. Do...
python
chosen
[ { "from": "system", "value": "Fix futures test\nChange: 115766190\n" }, { "from": "human", "value": "# Copyright 2016 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 compliance with the License.\n# Yo...
python
chosen
[ { "from": "system", "value": "Make test works with make and bazel\n" }, { "from": "human", "value": "# Copyright 2018 The Sonnet Authors. All Rights Reserved.\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may not use this file except in compliance with the Licens...
python
chosen
[ { "from": "system", "value": "Fix authentication from cookied token.\n" }, { "from": "human", "value": "import hashlib\nimport datetime\n\nfrom flask_login import UserMixin, AnonymousUserMixin\nimport mediacloud as mcapi\n\nfrom app.core import db, mc\n\n# User class\nclass User(UserMixin):\n ...
python
chosen
[ { "from": "system", "value": "Add TODO to check later if this should be here\n\nIt doesn't look like it serves any purpose.\n" }, { "from": "human", "value": "\"\"\"\nIn order to detect a filehandle that's been closed, our only clue may be the operating system\nreturning the same filehandle in r...
python
chosen
[ { "from": "system", "value": "Add better error message if URL doe not contain documentId\n\nImproves error messages like the one reported with #24\n" }, { "from": "human", "value": "#!/usr/bin/env python3\n# -*- coding: utf-8 -*-\n\nimport argparse\nimport contextlib\nimport sys\n\nfrom ard_medi...
python
chosen
[ { "from": "system", "value": "Add an argument to print stderr of test results\n" }, { "from": "human", "value": "# encoding: utf-8\n\n'''\n.. codeauthor:: Tsuyoshi Hombashi <tsuyoshi.hombashi@gmail.com>\n'''\n\nfrom __future__ import absolute_import, print_function, unicode_literals\n\n\ndef pri...
python
chosen
[ { "from": "system", "value": "Change order of imports to fix install into blank db or as dependency of\ncompany config.\n" }, { "from": "human", "value": "# -*- coding: utf-8 -*-\n\n##############################################################################\n#\n# Trading As Brands\n# Copyrigh...
python
chosen
[ { "from": "system", "value": "Change sphinx theme to rtd\n" }, { "from": "human", "value": "#!/usr/bin/env python3\n# -*- coding: utf-8 -*-\n\nimport os\nimport sys\nsys.path.insert(0, os.path.abspath('..'))\n\nextensions = [\n 'sphinx.ext.autodoc',\n]\n\nsource_suffix = '.rst'\n\nmaster_doc ...
python
chosen
[ { "from": "system", "value": "Create write to file function\n" }, { "from": "human", "value": "from s3v3 import *\n\n" }, { "from": "gpt", "value": "from s3v3 import *\nimport csv\n\ndef write_to_file(filename, data_sample):\n\texample = csv.write(open(filename, 'w', encoding='utf-8'...
python
chosen
[ { "from": "system", "value": "Use tuple in namedtuples initization\n" }, { "from": "human", "value": "#coding: utf-8\n\nfrom collections import namedtuple\n\nSubstance = namedtuple('Substance', 'name alias')\nMeasurement = namedtuple('Measurement', 'substance unit performed value')\nResult = nam...
python
chosen
[ { "from": "system", "value": "Use correct IO pins and serial port\n" }, { "from": "human", "value": "import signal\nimport sys\nimport serial\nimport sms\nfrom xbee import XBee\n\nMOBILE_NUM = '0400000000'\nNOTIFICATION_MSG = 'Cock-a-doodle-doo! An egg is waiting for you!'\n\negg_was_present = F...
python
chosen
[ { "from": "system", "value": "Use tuple for Sphinx extensions, not list\n\nRead the Docs is trying to append to the tuple during the docs build.\n" }, { "from": "human", "value": "import pkg_resources\nimport sphinx_rtd_theme\n\n\nproject = 'Spaceland'\ncopyright = '2017 Já hf'\nversion = releas...
python
chosen
[ { "from": "system", "value": "Remove old lightbox starting stuff that never got done" }, { "from": "human", "value": "# Copyright (c) 2010, Nate Stedman <natesm@gmail.com>\n#\n# Permission to use, copy, modify, and/or distribute this software for any\n# purpose with or without fee is hereby gran...
python
chosen
[ { "from": "system", "value": "Fix indeterminate ordering issue for extensions\n\nThe original code used set() to dedupe enabled extensions. This resulted\nin an arbitrary ordering of the values. The expected result was a\ndeterministic ordering of loaded extensions that matches the order given\nby the white...
python
chosen
[ { "from": "system", "value": "Add helpers to find the right character class\n" }, { "from": "human", "value": "from .character import *\n" }, { "from": "gpt", "value": "\"\"\"\nModule for all character objects.\n\"\"\"\n\nfrom .character import Character\nfrom .changeling import Chan...
python
chosen
[ { "from": "system", "value": "Test of Travis->autodeploy to PyPI for 3.0 RC2.\n" }, { "from": "human", "value": "\"\"\"\nThis package contains the Python modules used by the LOFAR Transients Pipeline\n(TraP). This includes:\n\n- Pipeline configuration management;\n- Task distribution;\n- Image l...
python
chosen
[ { "from": "system", "value": "Correct base_url usage, and force commit\n" }, { "from": "human", "value": "from flask import current_app\n\nfrom changes.config import queue\nfrom changes.backends.jenkins.builder import JenkinsBuilder\nfrom changes.constants import Status\nfrom changes.models.buil...
python
chosen
[ { "from": "system", "value": "Remove actual model downloading from tests\n" }, { "from": "human", "value": "# coding: utf-8\nfrom __future__ import unicode_literals\n\nfrom ..cli.download import download, get_compatibility, get_version, check_error_depr\nimport pytest\n\n\ndef test_download_fetc...
python
chosen
[ { "from": "system", "value": "Add an RNG to each cog.\n" }, { "from": "human", "value": "from collections import OrderedDict\n\nimport threading\n\nimport aiohttp\n\nfrom joku.bot import Jokusoramame\n\n\nclass _CogMeta(type):\n def __prepare__(*args, **kwargs):\n # Use an OrderedDict ...
python
chosen
[ { "from": "system", "value": "Fix inheritence error and return value\n\nIt shouldn't inherit from BaseWrapper, but merely object.\nIt should return None instead of 0.5 so it will have no effect on the average.\n" }, { "from": "human", "value": "from spicedham.basewrapper import BaseWrapper\n\ncl...
python
chosen
[ { "from": "system", "value": "Migrate script ot Python 3\n" }, { "from": "human", "value": "#! /usr/bin/env python\n# Copyright 2017 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.\n\n# This program reads a Unicode database and emits all lette...
python
chosen
[ { "from": "system", "value": "Set the rename directory to the test files directory\n" }, { "from": "human", "value": "from os import mkdir\nfrom os.path import abspath, dirname, exists, join\nfrom shutil import rmtree\n\nfrom tvrenamr.config import Config\nfrom tvrenamr.main import TvRenamr\nfro...
python
chosen
[ { "from": "system", "value": "Add search based on school name\n" }, { "from": "human", "value": "from django.contrib import admin\nfrom .models import *\n\n\nclass SchoolBuildingPhotoInline(admin.TabularInline):\n model = SchoolBuildingPhoto\n\n\n@admin.register(SchoolBuilding)\nclass SchoolB...
python
chosen
[ { "from": "system", "value": "Add edgesort as a frontend to topological_sort.\n\nSigned-off-by: Michael Markert <5eb998b7ac86da375651a4cd767b88c9dad25896@googlemail.com>\n" }, { "from": "human", "value": "\"\"\"\nThis module provides the parts to model and resolve dependencies in the flow of\nex...
python
chosen
[ { "from": "system", "value": "Replace deprecated np.asscalar(a) with a.item()\n" }, { "from": "human", "value": "# Licensed under a 3-clause BSD style license - see LICENSE.rst\n\"\"\"\nThis module provides tools to round numpy arrays.\n\"\"\"\n\nimport numpy as np\n\n\ndef _py2intround(a):\n ...
python
chosen
[ { "from": "system", "value": "Add support for auto-generated names in metadata\n" }, { "from": "human", "value": "#!/usr/bin/env python\n# -*- coding: utf-8\nfrom __future__ import absolute_import\n\nimport six\n\nfrom ..base import Model\nfrom ..fields import Field, ReadOnlyField, RequiredField...
python
chosen
[ { "from": "system", "value": "Add test for new custom landing format\n" }, { "from": "human", "value": "from __future__ import absolute_import\nfrom __future__ import unicode_literals\nfrom django.test import TestCase\nfrom django.test.utils import override_settings\nfrom django.urls import reve...
python
chosen
[ { "from": "system", "value": "Add option to verify jwt token\n" }, { "from": "human", "value": "from django.conf.urls import url, include\nfrom rest_framework.routers import DefaultRouter\nfrom rest_framework_jwt import views as jwt_views\n\nfrom . import views\n\nrouter = DefaultRouter()\nroute...
python
chosen
[ { "from": "system", "value": "Revert \"Return utf-8, not ascii.\"\n\nThis reverts commit 86cbefc74471e4c991c96e0385b931a2a20f5d50.\n\n\nFormer-commit-id: 3246e0bfefb806bd2b4d3dda0cb77e91f3481971" }, { "from": "human", "value": "from falcon.util.uri import parse_query_string\nimport json\nfrom ap...
python
chosen
[ { "from": "system", "value": "Fix mimetype detection to handle more types.\n" }, { "from": "human", "value": "MIME_TYPES = {\n '.png': 'image/png',\n '.jpg': 'image/jpeg',\n '.jpeg': 'image/jpeg',\n '.gif': 'image/gif',\n}\n\n\ndef to_mimetype(ext):\n if ext.lower() in MIME_TYPES:...
python
chosen
[ { "from": "system", "value": "Fix import path for url utilities.\n" }, { "from": "human", "value": "from django.conf.urls.defaults import url, patterns\n\nurlpatterns = patterns('',\n url(r'^$', 'invite.views.index', name='index'),\n url(r'^invite/$', 'invite.views.invite', name='invite'),...
python
chosen
[ { "from": "system", "value": "Fix some base64 auth keys are not captured by url\n" }, { "from": "human", "value": "from django.conf.urls import url\nfrom .views import serve_report\n\nurlpatterns = [\n url(\n r'^view/(?P<auth_key>[\\w:]+)/(?P<file_path>.*)',\n serve_report,\n ...
python
chosen
[ { "from": "system", "value": "Remove IF EXISTS from fix_fee_product_index\n" }, { "from": "human", "value": "# -*- coding: utf-8 -*-\n# Generated by Django 1.11.22 on 2019-10-31 16:33\nfrom __future__ import unicode_literals\n\nfrom django.db import migrations, OperationalError, ProgrammingError...
python
chosen
[ { "from": "system", "value": "Change encoding of URL parser\n" }, { "from": "human", "value": "from modules import *\n\nimport re\nimport urllib2\nimport traceback\ntry:\n import simplejson as json\nexcept ImportError:\n import json\n\nfrom unidecode import unidecode\n\nfrom twitter import...
python
chosen
[ { "from": "system", "value": "Use a correct algorithm to determine the length of word to use\n" }, { "from": "human", "value": "import os, sys\nimport random\nimport re\n\ntry:\n # Make Python2 work like Python3\n input = raw_input\nexcept NameError:\n # On Python3; already using input\...
python
chosen
[ { "from": "system", "value": "Add Skeleton class to package namespace\n" }, { "from": "human", "value": "from .csr import skeleton_to_csgraph, branch_statistics, summarise\n\n__version__ = '0.8.0-dev'\n\n__all__ = ['skeleton_to_csgraph',\n 'branch_statistics',\n 'summarise']\...
python
chosen
[ { "from": "system", "value": "Fix Django version check for 1.10\n" }, { "from": "human", "value": "# -*- encoding: utf-8 -*-\n\nfrom django import get_version\nfrom django.test import TestCase\nfrom django.core.management import call_command\n\nif get_version().split('.') >= ['1', '7']:\n fro...
python
chosen
[ { "from": "system", "value": "Load settings only on \"plugin_loaded\"\n\nSince sublime caches settings internally and subsequent \"load_settings\"\ncalls don't refer to the disk, it doesn't make sense to load the settings\neach time a command gets executed.\n" }, { "from": "human", "value": "imp...
python
chosen
[ { "from": "system", "value": "Use more specific session cookie name\n" }, { "from": "human", "value": "\"\"\"\nConfig parameters for the Flask app itself.\nNothing here is user-configurable; all config variables you can set yourself are in config.py.\nGenerally speaking, don't touch this file un...
python
chosen
[ { "from": "system", "value": "Fix ods-import for column repeat\n" }, { "from": "human", "value": "from odf.opendocument import load\nfrom odf.table import Table, TableRow, TableCell\nfrom odf.text import P\n\ndef import_ods(path):\n doc = load(path)\n\n db = {}\n\n tables = doc.spreadsh...
python
chosen
[ { "from": "system", "value": "Allow to manually generate brainkeys\n" }, { "from": "human", "value": "# -*- coding: utf-8 -*-\nimport click\nfrom .decorators import online\nfrom .main import main, config\nfrom .ui import print_table, print_tx\n\n\n@main.group()\ndef tools():\n \"\"\" Further ...
python
chosen
[ { "from": "system", "value": "Update get_tests to be backwards compatible with Python 2.6, since the library is compatible it seems worth this extra effort to test against it.\n" }, { "from": "human", "value": "import os.path\nimport unittest\n\n\ndef get_tests():\n start_dir = os.path.dirnam...
python
chosen
[ { "from": "system", "value": "Make it clear where we are getting LazySettings from\n" }, { "from": "human", "value": "# coding: utf-8\nimport os\nimport pytest\n\nfrom dynaconf import LazySettings\n\n\n@pytest.fixture(scope='module')\ndef settings():\n \"\"\"Settings fixture with some default...
python
chosen
[ { "from": "system", "value": "Fix pypy by using alternate cffi minibuffer syntax\n" }, { "from": "human", "value": "import six\nfrom xcffib.ffi import ffi, bytes_to_cdata\n\ndef test_bytes_to_cdata():\n bs = six.b('these are some bytes')\n assert bs == bytes(ffi.buffer(bytes_to_cdata(bs), ...
python
chosen
[ { "from": "system", "value": "Add a function to query available .net frameworks.\n\n" }, { "from": "human", "value": "import os\n\nfrom common import read_reg, debug\n\n_FRAMEWORKDIR_HKEY_ROOT = r'Software\\Microsoft\\.NETFramework\\InstallRoot'\n\ndef find_framework_root():\n # XXX: find it ...
python
chosen
[ { "from": "system", "value": "Rename the 'Avatar' class to 'ProjectAvatar'\n" }, { "from": "human", "value": "from panoptes_client.panoptes import (\n Panoptes,\n PanoptesObject,\n LinkResolver,\n)\nfrom panoptes_client.project import Project\n\n\nclass Avatar(PanoptesObject):\n _api...
python
chosen
[ { "from": "system", "value": "Use PEP 508 URL dependencies to specify patched jsonpatch\n\nSigned-off-by: Chris Harris <a361e89d1eba6c570561222d75facbbf7aaeeafe@kitware.com>\n" }, { "from": "human", "value": "from setuptools import setup, find_packages\n\nsetup(\n name='tomviz-pipeline',\n ...
python
chosen
[ { "from": "system", "value": "Implement User that extends Django's AbstractBaseUser.\n" }, { "from": "human", "value": "from django.db import models\n\n\n# Create your models here.\nclass User(models.Model):\n username = models.CharField(max_length=20)\n display_name = models.CharField(max...
python
chosen
[ { "from": "system", "value": "Increase options for EC2 and RDS instance types\n\nAdding small through large for both.\n" }, { "from": "human", "value": "EC2_INSTANCE_TYPES = [\n 't2.micro',\n 't2.small',\n 't2.medium'\n]\n\nRDS_INSTANCE_TYPES = [\n 'db.t2.micro'\n]\n\nELASTICACHE_INS...
python
chosen
[ { "from": "system", "value": "Refactor for new OptionParser interface\n\n" }, { "from": "human", "value": "from __future__ import division\n\n# Script to convert the output from refine_quadrants to a header file\n# Apply the header file to the cbfs with cxi.apply_metrology\n# Note hardcoded dist...
python
chosen
[ { "from": "system", "value": "Read datadict file as-is, without type-guessing\n" }, { "from": "human", "value": "import pandas as pd\n\ndef load_datadict(filepath, trim_index=True, trim_all=False):\n df = pd.read_csv(filepath, index_col=0)\n if trim_index:\n df.index = df.index.to_s...
python
chosen
[ { "from": "system", "value": "Add front end build step to comment on running manually\n" }, { "from": "human", "value": "\"\"\"Provide APP constant for the purposes of manually running the flask app\n\nFor example, set up environment variables then run the app::\n export FLASK_APP=smif.ht...
python
chosen
[ { "from": "system", "value": "Add int() function for casting from string to integer\n" }, { "from": "human", "value": "import json\nimport time\n\ndef lambda_handler(event,context):\n number_1 = event['key1']\n number_2 = event['key2']\n return {\"number\" : abs(number_1 - number_2)}" ...
python
chosen
[ { "from": "system", "value": "Increment version after unit testing refactoring\n" }, { "from": "human", "value": "\"\"\"\n:mod:`zsl` -- zsl module\n========================\n\nMain service module.\n\n :platform: Unix, Windows\n :synopsis: The Atteq Service Layer. Service for exposing data to...
python
chosen
[ { "from": "system", "value": "Fix in app initialization for generators\n" }, { "from": "human", "value": "from __future__ import unicode_literals\nimport importlib\nfrom goerr import err\nfrom django.apps import AppConfig\n\n\nGENERATORS = {}\ncf = None\n\n\ndef load_generator(modname, subgenera...
python
chosen
[ { "from": "system", "value": "docs(project): Fix module docstring for url config\n" }, { "from": "human", "value": "\"\"\"All available endpoints of the chaospizza web project.\"\"\"\n# pylint: disable=C0111\nfrom django.conf import settings\nfrom django.conf.urls import include, url\n# from dja...
python
chosen
[ { "from": "system", "value": "Change to the current session for registration opening\n" }, { "from": "human", "value": "# Copyright (c) 2011-2015 Berkeley Model United Nations. All rights reserved.\n# Use of this source code is governed by a BSD License (see LICENSE).\n\nSESSION = 66\n" }, {...
python
chosen
[ { "from": "system", "value": "Add search options for images, reorder field listing, use field names in list display rather than properties.\n" }, { "from": "human", "value": "from django.contrib import admin\n\nfrom icekit.utils.admin.mixins import ThumbnailAdminMixin\n\nfrom . import models\n\n...
python
chosen
[ { "from": "system", "value": "Add temporary redirect for stories URL\n" }, { "from": "human", "value": "# This Source Code Form is subject to the terms of the Mozilla Public\n# License, v. 2.0. If a copy of the MPL was not distributed with this\n# file, You can obtain one at https://mozilla.org/...
python
chosen
[ { "from": "system", "value": "Update test - Baker beach was turned into a relation.\n" }, { "from": "human", "value": "# Baker beach, SF\n# https://www.openstreetmap.org/way/195638009\nassert_has_feature(\n 18, 41881, 101308, 'landuse',\n { 'kind': 'beach' })\n" }, { "from": "gpt",...
python
chosen
[ { "from": "system", "value": "Add XNAT_CFG env var to config list.\n" }, { "from": "human", "value": "import os\n\n__all__ = ['default_configuration']\n\n\ndef default_configuration():\n \"\"\"\n Returns the XNAT configuration file location determined as the first file\n found in the fo...
python
chosen
[ { "from": "system", "value": "Use get_script_prefix to play nicely if not installed at the root.\n" }, { "from": "human", "value": "from django.core.urlresolvers import resolve\n\n\ndef get_breadcrumbs(url):\n \"\"\"Given a url returns a list of breadcrumbs, which are each a tuple of (name, u...
python
chosen
[ { "from": "system", "value": "Fix unit test for echo encoder\n" }, { "from": "human", "value": "import unittest\n\nfrom kafka_influxdb.encoder import echo_encoder\n\nclass TestEchoEncoder(unittest.TestCase):\n\n def setUp(self):\n self.encoder = echo_encoder.Encoder()\n self.mes...
python
chosen
[ { "from": "system", "value": "Fix atributo serializable de gravidades\n" }, { "from": "human", "value": "from . import APIMetadataModel\nfrom .properties import PropertyDescriptor\n\nclass InteracaoMetadata(APIMetadataModel):\n @property\n @PropertyDescriptor.serializable('evidencia')\n ...
python
chosen
[ { "from": "system", "value": "Update exception handling for levels argument\n" }, { "from": "human", "value": "\"\"\"\nscrapple.utils.exceptions\n~~~~~~~~~~~~~~~~~~~~~~~~~\n\nFunctions related to handling exceptions in the input arguments\n\"\"\"\n\nimport re\n\n\ndef handle_exceptions(args):\n\...
python
chosen