conversations
listlengths
2
3
source
stringclasses
1 value
stack
stringclasses
1 value
[ { "from": "system", "value": "Fix hardwired weights for res10ssd\n" }, { "from": "human", "value": "import cv2\n\n\n# TODO: make this downloadable\nPATH_PROTO = \"/mnt/kodi/blackbird/Scry/models/3rd_party/res10_ssd/deploy.prototxt.txt\"\nPATH_WEIGHTS = \"/mnt/kodi/blackbird/Scry/models/3rd_party...
python
chosen
[ { "from": "system", "value": "Change to \"ask for forgiveness\", as the 'client_roles' condition could get too complicated\n" }, { "from": "human", "value": "\"\"\"Facility to render node graphs using pydot\"\"\"\nimport os\n\nimport pydot\nfrom kitchen.settings import STATIC_ROOT, REPO\n\n\ndef...
python
chosen
[ { "from": "system", "value": "Use different logger name for the time being to avoid duplicate debug messages\n" }, { "from": "human", "value": "import logging\n\n__all__ = ['logger']\n\n#\n# Create logger\n#\nlogger = logging.getLogger('tohu')\nlogger.setLevel(logging.INFO)\nch = logging.StreamH...
python
chosen
[ { "from": "system", "value": "Update double_width_emojis list to improve \"rich\" printing\n" }, { "from": "human", "value": "from rich.console import Console\nfrom rich.markdown import Markdown\nfrom rich.syntax import Syntax\n\n\ndef process_syntax(code, lang, theme, line_numbers, code_width, ...
python
chosen
[ { "from": "system", "value": "Disable some apps for tests\n" }, { "from": "human", "value": "from os.path import expanduser\n\nfrom foundry.settings import *\n\n# Postgis because we want to test full functionality\nDATABASES = {\n 'default': {\n 'ENGINE': 'django.contrib.gis.db.backend...
python
chosen
[ { "from": "system", "value": "Refactor test case for compound terms\n" }, { "from": "human", "value": "import pytest\nfrom katana.storage import Node, Pair, prepare\nfrom katana.compound import sequence, group, repeat, option, maybe\nfrom katana.term import term\n\n\nA = term('a')\nB = term('b')...
python
chosen
[ { "from": "system", "value": "Test dispatch (un)register, basic handler\n" }, { "from": "human", "value": "import accordian\nimport pytest\n\n\ndef test_unknown_event(loop):\n \"\"\"\n An exception should be thrown when trying to register a\n handler for an unknown event.\n \"\"\"\n ...
python
chosen
[ { "from": "system", "value": "Add test for custom id in response\n" }, { "from": "human", "value": "import json\nimport unittest\n\nfrom alerta.app import create_app, db\n\n\nclass ApiResponseTestCase(unittest.TestCase):\n\n def setUp(self):\n test_config = {\n 'TESTING': Tr...
python
chosen
[ { "from": "system", "value": "Update docstrings and help() messages\n" }, { "from": "human", "value": "from pbr.version import VersionInfo\n\n__version__ = VersionInfo('instabrade').semantic_version().release_string()\n\nfrom .client import Client # NOQA\n" }, { "from": "gpt", "valu...
python
chosen
[ { "from": "system", "value": "Fix 'windows' property of Tabpage objects\n" }, { "from": "human", "value": "from util import RemoteMap\n\nclass Tabpage(object):\n @property\n def windows(self):\n if not hasattr(self, '_windows'):\n self._windows = RemoteSequence(self,\n ...
python
chosen
[ { "from": "system", "value": "FIX sale order prod attach prod pack\n" }, { "from": "human", "value": "# -*- coding: utf-8 -*-\n##############################################################################\n#\n# Ingenieria ADHOC - ADHOC SA\n# https://launchpad.net/~ingenieria-adhoc\n#\n# ...
python
chosen
[ { "from": "system", "value": "Add method stubs for sending and receiving tasks to/ from the database\n" }, { "from": "human", "value": "'''\nThe main app\n'''\n\n\nfrom flask import Flask\n\napp = Flask(__name__)\n\n@app.route('/', methods=['GET', 'POST'])\ndef index():\n return 'A work in pr...
python
chosen
[ { "from": "system", "value": "Tidy up python test script\n" }, { "from": "human", "value": "#!/usr/bin/env python\n\nfrom selenium import webdriver\nfrom selenium.webdriver.common.by import By\nfrom selenium.webdriver.support.ui import WebDriverWait\nfrom selenium.webdriver.support import expect...
python
chosen
[ { "from": "system", "value": "Put spaces between class methods\n" }, { "from": "human", "value": "import unittest\nimport brainfuck\n\nhello_case = (\"++++++++[>++++[>++>+++>+++>+<<<<-]>+>+>->>+[<]<-]>>.>---.+++++++..+++.>>.<-.<.+++.------.--------.>>+.>++.\", \"Hello World!\\n\")\n\nclass Inter...
python
chosen
[ { "from": "system", "value": "[UPDATE]: Add HTTP error exception and init some code.\n" }, { "from": "human", "value": "import sys\nfrom module import test\nfrom flask import Flask\n\napp = Flask(__name__)\n\n@app.route('/')\ndef index():\n return test.test_print()\n\nif __name__ == '__main__...
python
chosen
[ { "from": "system", "value": "Update migration file to lose dependency from discarded migration file\n" }, { "from": "human", "value": "# -*- coding: utf-8 -*-\nfrom __future__ import unicode_literals\n\nfrom django.db import migrations, models\nimport django.db.models.deletion\n\n\nclass Migrat...
python
chosen
[ { "from": "system", "value": "Change the api.update_status() call to explicitly state the 'status' message.\n\n - A recent version of Tweepy required it to be explicit, no harm in always being so\n" }, { "from": "human", "value": "#!/usr/bin/env python\n# twitterfunctions.py\n# description: T...
python
chosen
[ { "from": "system", "value": "Add default set of namespaces to test repository instance\n" }, { "from": "human", "value": "import pytest\n\nfrom d1lod import sesame\n\n@pytest.fixture(scope=\"module\")\ndef store():\n return sesame.Store('localhost', 8080)\n\n@pytest.fixture(scope=\"module\")...
python
chosen
[ { "from": "system", "value": "Use specified images for snapshot fixture\n" }, { "from": "human", "value": "import pytest\n\nfrom cosmo_tester.framework.test_hosts import Hosts\nfrom cosmo_tester.test_suites.snapshots import get_multi_tenant_versions_list\n\n\n@pytest.fixture(scope='function', pa...
python
chosen
[ { "from": "system", "value": "Remove unnecessary @db_txn decorator on alias_route\n" }, { "from": "human", "value": "from flask import redirect\nfrom flask import render_template\nfrom flask import request\n\nimport database.link\nfrom database import db_txn\nfrom linkr import app\nfrom uri.link...
python
chosen
[ { "from": "system", "value": "Add support for LTC in mtgox\n" }, { "from": "human", "value": "# -*- encoding: utf-8 -*-\nfrom __future__ import unicode_literals, print_function, division\n\n\ndef command_btc(bot, user, channel, args):\n \"\"\"Display current BTC exchange rates from mtgox. Usa...
python
chosen
[ { "from": "system", "value": "Add name filter to expert requests [WAL-989]\n" }, { "from": "human", "value": "import django_filters\n\nfrom nodeconductor.core import filters as core_filters\n\nfrom . import models\n\n\nclass ExpertProviderFilter(django_filters.FilterSet):\n customer = core_fi...
python
chosen
[ { "from": "system", "value": "Add ALLOWED_HOSTS to production settings\n" }, { "from": "human", "value": "from local_settings import *\n\n# Database\nDATABASES = {\n 'default': {\n 'ENGINE': 'django.db.backends.postgresql_psycopg2', # Add 'postgresql_psycopg2', 'postgresql', 'mysql', '...
python
chosen
[ { "from": "system", "value": "Use keys instead of iterkeys\n" }, { "from": "human", "value": "from handlers.base import MessageHandler\nimport settings\n\nclass ReactionHandler(MessageHandler):\n\n TRIGGER_ANCHOR = ''\n TRIGGER_PREFIX = ''\n TRIGGERS = sorted(settings.EMOJI_REACTIONS.iterkeys...
python
chosen
[ { "from": "system", "value": "Fix duplicate profile key errors with a less specific query.\n" }, { "from": "human", "value": "from celery.task import task\nfrom namelist.scrape import get_user_profile_id, scrape_profile, NotFound\nfrom namelist.models import Player, Category\n\n@task()\ndef impo...
python
chosen
[ { "from": "system", "value": "Make test logging level set by getenv.\n" }, { "from": "human", "value": "try:\n from psycopg2cffi import compat\n compat.register()\nexcept ImportError:\n pass\n\nDEBUG=False\nTEMPLATE=DEBUG\nUSE_TZ = True\nSTATIC_URL = '/static/'\nMEDIA_URL = '/media/'\n\...
python
chosen
[ { "from": "system", "value": "Make db query postgres compatible\n" }, { "from": "human", "value": "import frappe\n\ndef execute():\n\tfrappe.db.sql('''\n\t\tUPDATE `tabPrint Format`\n\t\tSET `print_format_type` = \"Jinja\"\n\t\tWHERE `print_format_type` in (\"Server\", \"Client\")\n\t''')\n\tfra...
python
chosen
[ { "from": "system", "value": "Add support for a configuration file\n" }, { "from": "human", "value": "import os\n\nTESTING_API_KEY = 'YourApiKeyToken'\nETHERSCAN_API_KEY = os.environ.get('ETHERSCAN_API_KEY', TESTING_API_KEY)\n" }, { "from": "gpt", "value": "import os\n\nHOME_DIR = os...
python
chosen
[ { "from": "system", "value": "Make module graph call return a file.\n" }, { "from": "human", "value": "\"\"\"Device call classes.\n\nThese classes implement any response cleaning and validation needed. If a\ncall class isn't defined for a given method then one is created using\nubersmith.calls....
python
chosen
[ { "from": "system", "value": "Test the feed using the request factory instead of the client.\n" }, { "from": "human", "value": "import pytest\n\nfrom django.core.urlresolvers import reverse\n\nfrom name.models import Name, Location\n\npytestmark = pytest.mark.django_db\n\n\ndef test_feed_has_geo...
python
chosen
[ { "from": "system", "value": "Add parameter import to main module\n" }, { "from": "human", "value": "# Date: August 2017\n# Author: Kutay B. Sezginel\n\"\"\"\nThermal conductivity calculations of porous crystals using Lammps\n\"\"\"\nfrom .simulation import Simulation\nfrom .trajectory import Tr...
python
chosen
[ { "from": "system", "value": "Add endpoint to convert the csv datafiles to json\n" }, { "from": "human", "value": "import flask\nimport os\n\ncurrent_dir = os.path.dirname(os.path.realpath(__file__))\nparent_dir = os.path.dirname(current_dir)\ndata_dir = os.path.join(parent_dir, \"static-site\",...
python
chosen
[ { "from": "system", "value": "Fix flake erros in UserFactory" }, { "from": "human", "value": "from feder.users import models\nimport factory\n\n\nclass UserFactory(factory.django.DjangoModelFactory):\n username = factory.Sequence(lambda n: 'user-{0}'.format(n))\n email = factory.Sequence(l...
python
chosen
[ { "from": "system", "value": "Update charms.hadoop reference to follow convention\n" }, { "from": "human", "value": "from charms.reactive import when, when_not, set_state, remove_state\nfrom charms.hadoop import get_hadoop_base\nfrom jujubigdata.handlers import YARN\nfrom jujubigdata import util...
python
chosen
[ { "from": "system", "value": "Add a command line launcher\n" }, { "from": "human", "value": "from twixer.twixer import main\n\nif __name__ == '__main__':\n main()" }, { "from": "gpt", "value": "#!/user/bin/env python\n\nfrom twixer.twixer import main\n\nif __name__ == '__main__':\...
python
chosen
[ { "from": "system", "value": "Call initial() on the transformed reducer rather than on the 'bottom' reducer.\n" }, { "from": "human", "value": "from transducer._util import UNSET\nfrom transducer.infrastructure import Reduced\n\n\n# Transducible processes\n\ndef transduce(transducer, reducer, it...
python
chosen
[ { "from": "system", "value": "flask/views: Use current_app in Blueprint module\n" }, { "from": "human", "value": "import os.path\n\nfrom flask import Blueprint, render_template\nfrom flask.ext.babel import _\n\nfrom skylines import app\nfrom skylines.lib.helpers import markdown\n\nabout_blueprin...
python
chosen
[ { "from": "system", "value": "Change the facet to sort by name instead of project count\n" }, { "from": "human", "value": "from registry.models import *\nfrom operator import attrgetter\n\nrelated_by_projects_Models = [\n BigAim,\n ClinicalArea,\n ClinicalSetting,\n Descriptor,\n]\n\...
python
chosen
[ { "from": "system", "value": "Allow max 20MB file chunks\n" }, { "from": "human", "value": "# Goal: Store settings which can be over-ruled\n# using environment variables.\n#\n# @authors:\n# Andrei Sura <sura.andrei@gmail.com>\n# Ruchi Vivek Desai <ruchivdesai@gmail.co...
python
chosen
[ { "from": "system", "value": "Handle missing files gracefully in ServeStatic\n" }, { "from": "human", "value": "\n'''\nHelper for serving static content.\n\n'''\nfrom antfarm import response\nimport mimetypes\n\nclass ServeStatic(object):\n def __init__(self, root):\n self.root = root\...
python
chosen
[ { "from": "system", "value": "Revert to python2, python3 converted code isn't working as expected\n" }, { "from": "human", "value": "#!/usr/bin/env python3\n\n#Python app to run a K-30 Sensor\nimport serial\nimport time\nfrom optparse import OptionParser\nimport sys\n\nser = serial.Serial(\"/dev...
python
chosen
[ { "from": "system", "value": "Return 403 Permission Denied error for unauthenticated AJAX requests\n" }, { "from": "human", "value": "# -*- coding: utf-8 -*-\nfrom __future__ import print_function, division, absolute_import, unicode_literals\n\nfrom functools import wraps\n\n\nclass Authenticati...
python
chosen
[ { "from": "system", "value": "Revert \"Deactivating Cling, let's see if that helps.\"\n\nThis reverts commit a43f5ffbb21ea85f5d0756a4fcf6019b824dfb84.\n" }, { "from": "human", "value": "\"\"\"\nWSGI config for assassins_guild project.\n\nIt exposes the WSGI callable as a module-level variable na...
python
chosen
[ { "from": "system", "value": "Fix double quotes in analyzer testcase\n" }, { "from": "human", "value": "from django.test import TestCase\nfrom breach.models import SampleSet, Victim, Target\nfrom breach.analyzer import decide_next_world_state\n\n\nclass AnalyzerTestCase(TestCase):\n def setUp...
python
chosen
[ { "from": "system", "value": "Make script for adding sample feeds more usable\n" }, { "from": "human", "value": "from smoke_signal import app, init_db\nfrom smoke_signal.database.helpers import add_feed\nfrom utils.generate_feed import SampleFeed\n\nfrom os import walk\n\nfeeds_dir = app.root_pa...
python
chosen
[ { "from": "system", "value": "Add the MidPointNormalize class, which allows one to define the midpoint of a colormap. Useful, e.g. if plotting data in the range [-6,3] with contourf and a diverging colormap, where zero still should be shaded in white.\n" }, { "from": "human", "value": "#!/usr/bi...
python
chosen
[ { "from": "system", "value": "Fix invalid annotation. The type of `self` in base class should be left to be deduced to the child type.\n" }, { "from": "human", "value": "\"\"\"Context manager base class man-in-the-middling the global stdout.\"\"\"\n\nimport sys\n\n\nclass Error(Exception):\n \"...
python
chosen
[ { "from": "system", "value": "Simplify the code a little\n" }, { "from": "human", "value": "from awacs.aws import Statement, Principal, Allow, Policy\nfrom awacs import sts\n\n\ndef get_default_assumerole_policy(region=''):\n \"\"\" Helper function for building the Default AssumeRole Policy\n...
python
chosen
[ { "from": "system", "value": "Use pagination on stations and districts endpoints with no filter\n\nIf no filter is passed to /pollingstations or /pollingdistricts\nuse pagination (when filtering, there is no pagination)\n\nThis means:\n- HTML outputs stay responsive/useful\n- People can't tie up our server ...
python
chosen
[ { "from": "system", "value": "Fix geting font list on Windows\n" }, { "from": "human", "value": "# -*- coding: utf-8 -*-\n\nimport platform\n\nWINDOWS = platform.system().lower() == \"windows\"\n\nVERSION = u'3.6.45'\n\n" }, { "from": "gpt", "value": "# -*- coding: utf-8 -*-\n\nimpor...
python
chosen
[ { "from": "system", "value": "Print data for each paraverb.\n" }, { "from": "human", "value": "from gensim import models\nimport time\n\nstart_time = time.perf_counter()\nprint('\\nLoading vectors...\\n')\nw = models.KeyedVectors.load_word2vec_format('/home/ubuntu/sim/CBOW|skipgram.bin', binary=...
python
chosen
[ { "from": "system", "value": "Remove element with deleted=true before removefield\n" }, { "from": "human", "value": "# Generated by Django 2.0.13 on 2020-04-23 12:55\n\nfrom django.db import migrations, models\nimport django.db.models.deletion\n\n\nclass Migration(migrations.Migration):\n\n d...
python
chosen
[ { "from": "system", "value": "Make the extra 'tiff' to be less confusing\n\nIt matches the new version of the documentation, and is how it is\nnormally spelled.\n\nSigned-off-by: Marcus D. Hanwell <cf7042e2e8eee958b5bcde1ae2cbefef82efc184@kitware.com>\n" }, { "from": "human", "value": "from setu...
python
chosen
[ { "from": "system", "value": "Fix unicode handling in bugwarrior run log.\n" }, { "from": "human", "value": "from django.db import models\n\nfrom .bugwarriorconfig import BugwarriorConfig\n\n\nclass BugwarriorConfigRunLog(models.Model):\n config = models.ForeignKey(\n BugwarriorConfig,...
python
chosen
[ { "from": "system", "value": "Change self.assertIn to self.assertTrue('Hello Implementer' in greeting.txt)\n" }, { "from": "human", "value": "import unittest\nimport os\nfrom selenium import webdriver\nfrom time import sleep\n\nclass TestClaimsLogin(unittest.TestCase):\n\n def setUp(self):\n ...
python
chosen
[ { "from": "system", "value": "Support input() on python 2.\n" }, { "from": "human", "value": "def yesno(prompt='? '):\n\t# raw_input returns the empty string for \"enter\"\n\tyes = set(['yes','y', 'ye', ''])\n\tno = set(['no','n'])\n\n\tchoice = input(prompt).lower()\n\tif choice in yes:\n\t\tre...
python
chosen
[ { "from": "system", "value": "Update async restore cache key\n" }, { "from": "human", "value": "# how long a cached payload sits around for (in seconds).\nINITIAL_SYNC_CACHE_TIMEOUT = 60 * 60 # 1 hour\n\n# the threshold for setting a cached payload on initial sync (in seconds).\n# restores that...
python
chosen
[ { "from": "system", "value": "Enable running tests against RAX and IBM\n\nRackspace requires performance flavors be used for boot from volume. IBM\ndoes not have Ubuntu or Cirros images in the cloud.\n\nChange-Id: I95c15d92072311eb4aa0a4b7f551a95c4dc6e082\n" }, { "from": "human", "value": "# -*-...
python
chosen
[ { "from": "system", "value": "Fix ArgumentParserTest.test_argv_from_args to be more portable.\n\nOne of the tests was testing --jobs 4, but on a machine w/\n4 CPUs, that would get reduced to the default. This patch\nchanges things to test --jobs 3, which is less likely to be\nseen in the wild.\n" }, { ...
python
chosen
[ { "from": "system", "value": "Change __name__ for label (Django 1.9)\n" }, { "from": "human", "value": "from django.db.models.signals import post_migrate\n\n\ndef mk_permissions(permissions, appname, verbosity):\n \"\"\"\n Make permission at app level - hack with empty ContentType.\n\n ...
python
chosen
[ { "from": "system", "value": "Refactor command to accept input or no input on delete" }, { "from": "human", "value": "import sys\nfrom django.core.management.base import BaseCommand\nfrom dateutil.relativedelta import relativedelta\n\nfrom legalaid.models import Case\nfrom cla_butler.tasks impor...
python
chosen
[ { "from": "system", "value": "Validate the Subscription policy is made up of Subscription objects\n" }, { "from": "human", "value": "# Copyright (c) 2012-2013, Mark Peek <mark@peek.org>\n# All rights reserved.\n#\n# See LICENSE file for full license.\n\nfrom . import AWSObject, AWSProperty\n\n\n...
python
chosen
[ { "from": "system", "value": "Fix args in entry point\n" }, { "from": "human", "value": "import sys\nimport serial\nfrom blueplayer import blueplayer\n\n\ndef main(args):\n # first argument should be a serial terminal to open\n if not len(args):\n port = \"/dev/ttyAMA0\"\n else:\...
python
chosen
[ { "from": "system", "value": "Raise Kotlin compiler time limit to 20s" }, { "from": "human", "value": "import os.path\n\nfrom dmoj.executors.java_executor import JavaExecutor\n\nwith open(os.path.join(os.path.dirname(__file__), 'java-security.policy')) as policy_file:\n policy = policy_file.r...
python
chosen
[ { "from": "system", "value": "Add OpenCV display for debug.\n" }, { "from": "human", "value": "#! /usr/bin/env python\n# -*- coding:utf-8 -*-\n\n\n#\n# Show the images from two Allied Vision cameras\n#\n\n\n#\n# External dependencies\n#\nimport sys\nfrom PySide import QtGui\nimport VisionToolkit...
python
chosen
[ { "from": "system", "value": "Use new configureable spreadsheet loader in script.\n\nThese are the correct positions currently.\n" }, { "from": "human", "value": "#!/usr/bin/env python\n\nimport os\nimport sys\n\ntry:\n username = os.environ['GOOGLE_USERNAME']\n password = os.environ['GOOG...
python
chosen
[ { "from": "system", "value": "Disable eventlet monkey-patching of DNS\n\nThis change avoids eventlet's monkey-patching of DNS\nresolution. eventlet's doesn't support IPv6, for example.\nA similar change was made in nova, so this is just copying\nthat code and technique to ceilometer.\nFixes bug #1404886 bug...
python
chosen
[ { "from": "system", "value": "Make BaseActionException mixin for pylint\n" }, { "from": "human", "value": "\"\"\" Exceptions relating to API issues \"\"\"\nfrom werkzeug.exceptions import HTTPException\n\n\nclass BaseActionException(HTTPException):\n \"\"\" An HTTP exception for when an actio...
python
chosen
[ { "from": "system", "value": "Correct DBC file path in hello world example.\n" }, { "from": "human", "value": "#!/usr/bin/env python3\n\nfrom __future__ import print_function\nimport os\nfrom binascii import hexlify\nimport cantools\n\n\nSCRIPT_DIR = os.path.dirname(os.path.realpath(__file__))\n...
python
chosen
[ { "from": "system", "value": "Fix entity type post deletion\n" }, { "from": "human", "value": "from .base import BaseModelResource, BaseModelsResource\n\nfrom zou.app.models.entity_type import EntityType\nfrom zou.app.utils import events\nfrom zou.app.services import entities_service\n\n\nclass ...
python
chosen
[ { "from": "system", "value": "Add new testing model `School`\n\nIssue #43\n" }, { "from": "human", "value": "from django.db import models\n\nclass ClassRoom(models.Model):\n number = models.CharField(max_length=4)\n\n def __unicode__(self):\n return unicode(self.number)\n\nclass Lab...
python
chosen
[ { "from": "system", "value": "Change glob for 242 tracks\n" }, { "from": "human", "value": "\n'''\nCombine the tracks, then split out the science fields\n'''\n\nimport os\nfrom glob import glob\n\nfrom tasks import virtualconcat, split\n\n# Grab all of the MS tracks in the folder (should be 12)\...
python
chosen
[ { "from": "system", "value": "Remove incorrect docstring in unittest.test\n" }, { "from": "human", "value": "\"\"\"Test suite for distutils.\n\nThis test suite consists of a collection of test modules in the\ndistutils.tests package. Each test module has a name starting with\n'test' and contain...
python
chosen
[ { "from": "system", "value": "Remove old Django compatibility code\n" }, { "from": "human", "value": "from django.contrib import admin\nfrom django.forms import ModelForm\nfrom article.models import Article\n\n# The timezone support was introduced in Django 1.4, fallback to standard library for ...
python
chosen
[ { "from": "system", "value": "Add sourceip and target parameters to AttackForm\n" }, { "from": "human", "value": "from django.forms import ModelForm\nfrom breach.models import Target, Victim\n\n\nclass TargetForm(ModelForm):\n class Meta:\n model = Target\n fields = (\n ...
python
chosen
[ { "from": "system", "value": "Return all most frequent subsequences\n" }, { "from": "human", "value": "import re\n\nclass dna():\n \"\"\"Instantiate a DNA object\"\"\"\n \n def __init__(self):\n self.sequence = \"\"\n\n \n def genSequence(self, N):\n \"\"\"Genera...
python
chosen
[ { "from": "system", "value": "Fix multiple instance bug in api\n" }, { "from": "human", "value": "from rest_framework import filters\n\nfrom frigg.builds.models import Build, Project\n\n\nclass ProjectPermissionFilter(filters.BaseFilterBackend):\n def filter_queryset(self, request, queryset, ...
python
chosen
[ { "from": "system", "value": "Add second delete url where users will send request to confirm they want to bulk delete.\n" }, { "from": "human", "value": "from django.conf.urls import url\n\nfrom api.nodes import views\n\nurlpatterns = [\n # Examples:\n # url(r'^$', 'api.views.home', name='...
python
chosen
[ { "from": "system", "value": "Deal with str/bytes mismatch in python 3\n" }, { "from": "human", "value": "import sys\nimport unittest\nimport ocookie.httplib_adapter\nfrom tests import app\n\npy3 = sys.version_info[0] == 3\nif py3:\n import http.client as httplib\nelse:\n import httplib\n\...
python
chosen
[ { "from": "system", "value": "main: Raise exception on empty device name\n" }, { "from": "human", "value": "from .timings import *\nfrom .pattern import *\nfrom .exceptions import *\n\nimport serial\nimport logging\n\nlogger = logging.getLogger(__name__)\n\nclass HDSignalGenerator(TimingsMixin, ...
python
chosen
[ { "from": "system", "value": "Update help text in migration\n" }, { "from": "human", "value": "# Generated by Django 2.2.13 on 2020-11-18 20:58\n\nfrom django.db import migrations, models\n\n\nclass Migration(migrations.Migration):\n\n dependencies = [\n ('workshops', '0222_workshopreq...
python
chosen
[ { "from": "system", "value": "Fix test broken in the previous commit\n" }, { "from": "human", "value": "from __future__ import print_function, unicode_literals\n\nimport glob\nimport json\n\n\ndef test_everything(realish_eventrouter, team):\n datafiles = glob.glob(\"_pytest/data/websocket/*.j...
python
chosen
[ { "from": "system", "value": "Support for writing this frame to serial port\n" }, { "from": "human", "value": "from .exceptions import MBusFrameDecodeError, MBusFrameCRCError, FrameMismatch\n\n\nclass TelegramACK(object):\n @staticmethod\n def parse(data):\n if data is None:\n ...
python
chosen
[ { "from": "system", "value": "Add some unit tests of the unflatten function\n" }, { "from": "human", "value": "from flattening_ocds.input import unflatten_line, SpreadsheetInput, unflatten\n\n\ndef test_unflatten_line():\n # Check flat fields remain flat\n assert unflatten_line({'a': 1, 'b...
python
chosen
[ { "from": "system", "value": "Add cache to make debug panel usable.\n" }, { "from": "human", "value": "from __future__ import absolute_import\nfrom __future__ import print_function\nfrom __future__ import unicode_literals\n\nfrom .dev import * # noqa\n\nINTERNAL_IPS = [\"127.0.0.1\"]\n\nDEBUG_T...
python
chosen
[ { "from": "system", "value": "Fix allowable domain otherwise filtered\n" }, { "from": "human", "value": "from scrapy.contrib.spiders import CrawlSpider, Rule\nfrom scrapy.contrib.linkextractors.sgml import SgmlLinkExtractor\nfrom scrapy.selector import Selector\nfrom .. import items\n\nclass Dat...
python
chosen
[ { "from": "system", "value": "Add check for nan values\n" }, { "from": "human", "value": "#!/usr/bin/python\n#\n# Copyright 2018-2020 Polyaxon, Inc.\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may not use this file except in compliance with the License.\n# You ...
python
chosen
[ { "from": "system", "value": "Put Question Admin fields in a fieldset and added a collapse class to the date field\n" }, { "from": "human", "value": "from django.contrib import admin\n\n# Register your models here.\nfrom .models import Question\n\n\n\nclass QuestionAdmin(admin.ModelAdmin):\n ...
python
chosen
[ { "from": "system", "value": "Make sequence optimization more efficient\n" }, { "from": "human", "value": "# -*- coding: utf-8 -*-\n'''\nThis is the default list matcher.\n'''\nfrom __future__ import absolute_import, print_function, unicode_literals\nimport collections\nimport salt.ext.six as si...
python
chosen
[ { "from": "system", "value": "Use node id (not project id) to create component Subscriptions\n" }, { "from": "human", "value": "from framework.auth.decorators import must_be_logged_in\nfrom model import Subscription\nfrom flask import request\nfrom modularodm import Q\nfrom modularodm.exceptions...
python
chosen
[ { "from": "system", "value": "Bring path function in line with oscar fancypages\n" }, { "from": "human", "value": "import os\n\n__version__ = (0, 0, 1, 'alpha', 1)\n\nFP_MAIN_TEMPLATE_DIR = os.path.join(\n os.path.dirname(os.path.abspath(__file__))\n)\n" }, { "from": "gpt", "value...
python
chosen
[ { "from": "system", "value": "Simplify code for working in container\n" }, { "from": "human", "value": "#!/usr/bin/env python\n# -*- coding: utf-8 -*-\n\nfrom __future__ import print_function\n\nimport os\n\nfrom .tools import location_of\n\nHERE = location_of(__file__)\n\n__author__ = 'Walter M...
python
chosen
[ { "from": "system", "value": "Add s3 lib to package.\n" }, { "from": "human", "value": "from .record import ArchiveRecord\nfrom .warc import WarcRecord\nfrom .arc import ArcRecord\nfrom .mixed import MixedRecord\nfrom .s3 import list_files\nfrom . import record, warc, arc\n\ndef expand_files(fil...
python
chosen
[ { "from": "system", "value": "Add completion log message to the background task" }, { "from": "human", "value": "from heltour.tournament.models import *\nfrom heltour.tournament import lichessapi\nfrom heltour.celery import app\nfrom celery.utils.log import get_task_logger\n\nlogger = get_task_l...
python
chosen
[ { "from": "system", "value": "Use count/scalar to test if key is present in SQL back end\n\nThis is simpler than using select/execute/fetchone. Also, scalar automatically\ncloses the result set whereas fetchone does not. This may fix some performance\nissues.\n" }, { "from": "human", "value": "f...
python
chosen
[ { "from": "system", "value": "Fix test descovery to correctly add test dir to path and import modules rather then files\n" }, { "from": "human", "value": "\"\"\"Greencard implementation.\"\"\"\nfrom functools import wraps\n\n\nTESTS = []\n\n\ndef greencard(func):\n \"\"\"\n A decorator for...
python
chosen
[ { "from": "system", "value": "Set client crontab file permissions before copying it into place\n\nSet the permissions on the client crontab file before copying it\nrather than after, so the time during which the file is inconsistent\nis reduced.\n" }, { "from": "human", "value": "#!/usr/bin/env ...
python
chosen
[ { "from": "system", "value": "Change DATE_FORMAT to be equivalent to datetime.isoformat()\n" }, { "from": "human", "value": "\"\"\"Default settings for all environments.\n\nThese settings will be extended by additional config files in ROOT/config.\nRun `python manage.py create_config` to create ...
python
chosen
[ { "from": "system", "value": "Remove side effect where observing connects\n" }, { "from": "human", "value": "from sqlalchemy import ForeignKey, Column, String, desc\nfrom .models import Node, Info\nfrom information import State\n\n\nclass Environment(Node):\n\n \"\"\"Defines an environment no...
python
chosen
[ { "from": "system", "value": "Fix broken reference to node_type.\n" }, { "from": "human", "value": "from AbstractVisitor import AbstractVisitor\n\nfrom duralex.alinea_parser import *\n\nimport duralex.node_type\n\nclass ForkReferenceVisitor(AbstractVisitor):\n def visit_node(self, node):\n ...
python
chosen