conversations
listlengths
2
3
source
stringclasses
1 value
stack
stringclasses
1 value
[ { "from": "system", "value": "Add correct ip for my test\n" }, { "from": "human", "value": "import paramiko # pip install paramiko\nimport os\n\n\ndef ssh_command(ip, user, command):\n # you can run this script as\n # SSH_PRIV_KEY=[your private key path] python bh_sshcmd.py\n key = par...
python
chosen
[ { "from": "system", "value": "Create number of available cameras via OpenCV" }, { "from": "human", "value": "import cv2\n\n# Get the number of cameras available\ndef count_cameras():\n max_tested = 100\n for i in range(max_tested):\n temp_camera = cv2.VideoCapture(i)\n if tem...
python
chosen
[ { "from": "system", "value": "Fix missing test\nprobably got removed in my clumsy merge\n" }, { "from": "human", "value": "import sys\nfrom CITests import CITests\n\n# Libs in Application Examples\nappExamples = {\n\"KundurSMIB\":\"/ApplicationExamples/KundurSMIB/package.mo\",\n\"TwoAreas\":\"/A...
python
chosen
[ { "from": "system", "value": "Add Request, Response and ApiObject and Token classes\n" }, { "from": "human", "value": "from devicehive.transport import Request\nfrom devicehive.transport import Response\n\n\nclass Api(object):\n \"\"\"Api class.\"\"\"\n\n def __init__(self, transport):\n ...
python
chosen
[ { "from": "system", "value": "Make sure the tail subprocess does not actually list any prior records\n\nSigned-off-by: Jason Bernardino Alonso <f71c42a1353bbcdbe07e24c2a1c893f8ea1d05ee@hackorp.com>\n" }, { "from": "human", "value": "\"\"\"\nUtility functions for dhcp2nest\n\"\"\"\nfrom queue imp...
python
chosen
[ { "from": "system", "value": "Remove invalid argument for load command\n" }, { "from": "human", "value": "\"\"\"Module for the custom Django updatedata command.\"\"\"\n\nfrom django.core import management\n\n\nclass Command(management.base.BaseCommand):\n \"\"\"Required command class for the ...
python
chosen
[ { "from": "system", "value": "Fix name of macosx backend.\n\n\n" }, { "from": "human", "value": "#! /usr/bin/env python\n# Last Change: Mon Dec 08 03:00 PM 2008 J\n\nfrom os.path import join\nimport os\nimport warnings\n\nfrom setuphelp import info_factory, NotFoundError\n\ndef configuration(par...
python
chosen
[ { "from": "system", "value": "Improve output when no deduplication happened\n" }, { "from": "human", "value": "from django.core.management.base import BaseCommand, CommandError\n\nfrom ...utils import get_backend\n\n\nclass Command(BaseCommand):\n help = \"Command to deduplicate tasks in a re...
python
chosen
[ { "from": "system", "value": "Fix featureCounts test following change in consensus nomenclature in FeatureCounts obj\n" }, { "from": "human", "value": "import sequana.featurecounts as fc\nfrom sequana import sequana_data\n\n\ndef test_featurecounts():\n RNASEQ_DIR_0 = sequana_data(\"featureco...
python
chosen
[ { "from": "system", "value": "Adjust template path after change\n" }, { "from": "human", "value": "# Copyright (c) 2013, Sascha Peilicke <saschpe@gmx.de>\n#\n# This program is free software; you can redistribute it and/or modify\n# it under the terms of the GNU General Public License version 2 a...
python
chosen
[ { "from": "system", "value": "Fix Python 3 import error" }, { "from": "human", "value": "\"\"\"Image Processing SciKit (Toolbox for SciPy)\"\"\"\n\n\nimport os.path as _osp\n\ndata_dir = _osp.abspath(_osp.join(_osp.dirname(__file__), 'data'))\n\nfrom version import version as __version__\n\ndef ...
python
chosen
[ { "from": "system", "value": "Update list of channels when joining a new one\n" }, { "from": "human", "value": "'''\nCreated on Dec 20, 2011\n\n@author: Tyranic-Moron\n'''\n\nfrom IRCMessage import IRCMessage\nfrom IRCResponse import IRCResponse, ResponseType\nfrom Function import Function\nfrom...
python
chosen
[ { "from": "system", "value": "Fix indentation which causes error on restore\n\nFixes error message, that document with a specific number already exists, even if it doesn't." }, { "from": "human", "value": "# -*- coding: utf-8 -*-\n# Copyright (c) 2015, Frappe Technologies and contributors\n# For...
python
chosen
[ { "from": "system", "value": "Test the adjacency matrix finder\n" }, { "from": "human", "value": "\"\"\" Tests for the extraction of neighbourhoods \"\"\"\nfrom nose.tools import *\nimport marble as mb\n\n\n# Test that for a grid, corners are not neighbours (.touch might have to go)\n# Test clus...
python
chosen
[ { "from": "system", "value": "Add and __all__ designator to top-level\n" }, { "from": "human", "value": "from .fields import TimeZoneField # noqa\nfrom .forms import TimeZoneFormField # noqa\n\n__version__ = '1.0'\n" }, { "from": "gpt", "value": "__version__ = '1.0'\n__all__ = [...
python
chosen
[ { "from": "system", "value": "Set googleapiclient logging level to WARNING.\n" }, { "from": "human", "value": "from threading import local\n\nfrom apiclient import discovery\n\n_local = local()\n\n\ndef get_service(credentials):\n service = getattr(_local, 'service', None)\n if not service...
python
chosen
[ { "from": "system", "value": "Fix compatibility with Python 3\n\nThis patch removes a stray print statement that was causing problems\nwith Python 3.\n" }, { "from": "human", "value": "import yaml\nimport json\nimport os.path\nfrom .util import string\n\nclass ConfigReader(object):\n def __in...
python
chosen
[ { "from": "system", "value": "Increase default DRILL_TIMEOUT to 60 minutes\n" }, { "from": "human", "value": "### Redis Options\nREDIS_HOST=\"localhost\"\nREDIS_PORT=6379\nREDIS_DB=1\n\n### Celery Options\nBROKER_URL=\"amqp://guest@localhost//\"\n\nCELERY_ROUTES = {'fuzzer.tasks.fuzz': {'queue':...
python
chosen
[ { "from": "system", "value": "Change loading function to take a path instead of a python file\n" }, { "from": "human", "value": "\"\"\"@package Project\nThis module defines an interface to read and use InputGen projects\n\nSee C++ InputGen project for more details on Projects\n\"\"\"\n\nimport x...
python
chosen
[ { "from": "system", "value": "Update hook for SnowDegreeDay component\n" }, { "from": "human", "value": "import os\nimport shutil\n\nfrom wmt.config import site\nfrom wmt.models.submissions import prepend_to_path\nfrom wmt.utils.hook import find_simulation_input_file\nfrom topoflow_utils.hook im...
python
chosen
[ { "from": "system", "value": "Comment to explain numpy warnings filter\n" }, { "from": "human", "value": "#!/usr/bin/env python\n# -*- coding: utf-8 -*-\n\"\"\"smif\n\"\"\"\nfrom __future__ import division, print_function, absolute_import\n\nimport pkg_resources\nimport warnings\n\n__author__ = ...
python
chosen
[ { "from": "system", "value": "Remove useless \"unused-wildcard-import\" pylint suppression.\n" }, { "from": "human", "value": "#!/usr/bin/env python\n# coding=utf-8\n# flake8: noqa\n# pylint: disable=missing-docstring\n#\n# This Source Code Form is subject to the terms of the Mozilla Public\n# L...
python
chosen
[ { "from": "system", "value": "Use the readline module to allow arrow key movement in the REPL\n" }, { "from": "human", "value": "#!/usr/bin/env python3\n\nimport sys\n\nimport lexer as l\nimport parser as p\nimport evaluator as e\nimport context as c\nimport object as o\n\ndef m...
python
chosen
[ { "from": "system", "value": "ENH: Hide permissible NumPy warnings from users\n" }, { "from": "human", "value": "from ._version import get_versions\n__version__ = get_versions()['version']\ndel get_versions\n\nimport os\nimport yaml\nfrom cerberus import Validator\n\nMODULE_DIR = os.path.dirname...
python
chosen
[ { "from": "system", "value": "Set up the procedure to code out\n" }, { "from": "human", "value": "'''\nKaya Baber\nPhysics 440 - Computational Physics\nAssignment 5 - PDEs\nExploration 1 - Parabolic PDEs: Thermal Diffusion\n'''\n\nimport numpy as np\nfrom numpy import linalg as LA\nimport matpl...
python
chosen
[ { "from": "system", "value": "Fix missing import to API\n" }, { "from": "human", "value": "import enaml\n\nwith enaml.imports():\n from .bcolz_store import BColzStore\n from .display_value import DisplayValue\n from .event_log import EventLog\n from .epoch_counter import EpochCounter...
python
chosen
[ { "from": "system", "value": "Remove default_app_config for Django 3.2 and newer\n\nRemovedInDjango41Warning: 'psqlextra' defines default_app_config = 'psqlextra.apps.PostgresExtraAppConfig'. Django now detects this configuration automatically. You can remove default_app_config.\n" }, { "from": "hum...
python
chosen
[ { "from": "system", "value": "Fix package name for PCL ref assemblies\n" }, { "from": "human", "value": "import glob\nimport os\nimport shutil\n\n\nclass PCLReferenceAssembliesPackage(Package):\n def __init__(self):\n Package.__init__(self,\n name='PortableRefer...
python
chosen
[ { "from": "system", "value": "Add IndexError to getFeatured call" }, { "from": "human", "value": "from django.db import models\nfrom django.utils.translation import ugettext as _\nfrom django.contrib.auth.models import User\nfrom django.contrib.sites.models import Site\nfrom django.contrib.sites...
python
chosen
[ { "from": "human", "value": "Add package datas in the module, with the new name and repo\n" }, { "from": "gpt", "value": "\"\"\"django-emoticons\"\"\"\n__version__ = '0.1'\n__license__ = 'BSD License'\n\n__author__ = 'Fantomas42'\n__email__ = 'fantomas42@gmail.com'\n\n__url__ = 'https://github.c...
python
chosen
[ { "from": "system", "value": "Fix public fields from Event\n" }, { "from": "human", "value": "from django.forms import ModelForm, widgets\n\nfrom .models import Fellow, Event, Expense, Blog\n\nclass FellowForm(ModelForm):\n class Meta:\n model = Fellow\n fields = '__all__'\n\n\n...
python
chosen
[ { "from": "system", "value": "Check membership when a Member is saved\n" }, { "from": "human", "value": "from django.conf import settings\nfrom django.core.mail import EmailMultiAlternatives\nfrom django.dispatch import receiver\nfrom django.template import loader\nfrom simple_email_confirmation...
python
chosen
[ { "from": "system", "value": "Rename 'URL' to 'link' to match with .link property\n" }, { "from": "human", "value": "#!/usr/bin/env python\n# -*- coding:utf-8 -*-\n\n#\n# Script for displaying pretty RSS feeds\n#\n\nfrom sys import argv\nimport feedparser\n\n# Data for parsing\ndata = feedparser...
python
chosen
[ { "from": "system", "value": "Mark as 1.6.7 beta 1" }, { "from": "human", "value": "version = '1.6.7'\nrevision = ' development'\nmilestone = 'Yoitsu'\nrelease_number = '92'\nprojectURL = 'https://syncplay.pl/'\n" }, { "from": "gpt", "value": "version = '1.6.7'\nrevision = ' beta 1'\...
python
chosen
[ { "from": "system", "value": "Remove unused |date| array variables\n" }, { "from": "human", "value": "import plotly as py\nimport plotly.graph_objs as go\nfrom datetime import datetime\nfrom sys import argv\n\nimport names\nfrom csvparser import parse\n\ndata_file = argv[1]\nraw_data = parse(dat...
python
chosen
[ { "from": "system", "value": "Call parent with last set to True\n\nThis way we get __parent__.site set to a valid site, or it raises an\nerror.\n\nWe may want to change this in the future...\n" }, { "from": "human", "value": "import logging\nlog = logging.getLogger(__name__)\n\nfrom uuid import ...
python
chosen
[ { "from": "system", "value": "Remove duplicate Flask-Login session protection setting\n" }, { "from": "human", "value": "from flask import Flask\nfrom flask.ext.bootstrap import Bootstrap\nfrom flask.ext.mail import Mail\nfrom flask.ext.moment import Moment\nfrom flask.ext.sqlalchemy import SQLA...
python
chosen
[ { "from": "system", "value": "Use the new django management commands definition (ArgumentParser)\n" }, { "from": "human", "value": "# -*- coding: utf-8 -*-\nfrom __future__ import unicode_literals\nfrom optparse import make_option\nfrom django.core.management.base import BaseCommand\nfrom django...
python
chosen
[ { "from": "system", "value": "Add tooling to get all of edx's web services.\n" }, { "from": "human", "value": "import github\nfrom get_repos import *\n\n\nwebservices = []\n\nfor repo in expanded_repos_list(orgs):\n try:\n metadata = get_remote_yaml(repo, 'openedx.yaml')\n except gi...
python
chosen
[ { "from": "system", "value": "Add comment on ACM affil structure\n" }, { "from": "human", "value": "import requests\nfrom lxml import html, etree\n\ndef scrape_acm(page):\n tree = html.fromstring(page.content)\n author_affiliations = []\n authors = tree.xpath('//td/a[@title=\"Author Pro...
python
chosen
[ { "from": "system", "value": "Refactor problem 12 to increase test coverage\n" }, { "from": "human", "value": "\"\"\"Problem 12 of https://projecteuler.net\"\"\"\n\nfrom projecteuler.maths_functions import factor_count\nfrom itertools import count\n\n\ndef problem_12():\n \"\"\"Solution to pr...
python
chosen
[ { "from": "system", "value": "Add id in image API response\n" }, { "from": "human", "value": "from django.contrib.auth.models import User, Group\nfrom waterfall_wall.models import Image\nfrom rest_framework import serializers\n\n\nclass ImageSerializer(serializers.HyperlinkedModelSerializer):\n ...
python
chosen
[ { "from": "system", "value": "Add condition to avoid index error\n" }, { "from": "human", "value": "# File: grains.py\n# Purpose: Write a program that calculates the number of grains of wheat\n# on a chessboard given that the number on each square doubles.\n# Programmer:...
python
chosen
[ { "from": "system", "value": "Add straight-to-editor feature to grep script.\n" }, { "from": "human", "value": "#!/usr/bin/python\n\n\nimport argparse\nimport subprocess\nimport sys\n\n\nEXCLUSIONS = ['*.pyc', '*.log', 'venv*', 'static/*', 'site_static/*', 'datatableview/*', '*.db']\n\n\ndef mai...
python
chosen
[ { "from": "system", "value": "Add authenticator and context creator to example app\n" }, { "from": "human", "value": "import flask\n\nfrom pale.adapters import flask as pale_flask_adapter\n\nfrom tests.example_app import api\n\n\ndef create_pale_flask_app():\n \"\"\"Creates a flask app, and r...
python
chosen
[ { "from": "system", "value": "Update alias ManagedApplicationClient to ApplicationClient" }, { "from": "human", "value": "# coding=utf-8\n# --------------------------------------------------------------------------\n# Copyright (c) Microsoft Corporation. All rights reserved.\n# Licensed under t...
python
chosen
[ { "from": "system", "value": "Move adzerk.js into reddit-init to fix race condition.\n\nThis should ensure that the Adzerk postMessage receiver is loaded before\nAdzerk gets its payloads.\n" }, { "from": "human", "value": "from r2.lib.plugin import Plugin\nfrom r2.lib.js import Module\n\n\nclass...
python
chosen
[ { "from": "system", "value": "Fix for the new ResolverMatch object in Django 1.3.\n" }, { "from": "human", "value": "\nimport types\nfrom django.core import urlresolvers as django_urlresolvers\nfrom django.utils.functional import curry\n\nclass DecoratorMixin(object):\n \"\"\"\n Mixin clas...
python
chosen
[ { "from": "system", "value": "Fix FileSystemFinder's find return value if not all\n" }, { "from": "human", "value": "import os\nfrom .exceptions import ImproperlyConfigured\nfrom .utils import safe_join\n\n\nclass BaseFinder(object):\n\n def find(self, path, all=False):\n raise NotImpl...
python
chosen
[ { "from": "system", "value": "Update getwork to prune itself and use a list instead of a dictionary\n" }, { "from": "human", "value": "import time\r\n\r\nclass Getwork_store:\r\n \r\n def __init__(self):\r\n self.data = {}\r\n \r\n def add(self, server, merkle_root):\r\n ...
python
chosen
[ { "from": "system", "value": "Revert \"Make migration SQLite compatible\"\n\nThis reverts commit 768d85cccb17c8757dd8d14dad220d0b87568264.\n" }, { "from": "human", "value": "# -*- coding: utf-8 -*-\n# Generated by Django 1.9.5 on 2017-05-09 09:24\nfrom __future__ import unicode_literals\n\nfrom ...
python
chosen
[ { "from": "system", "value": "Add more to the restore script.\n" }, { "from": "human", "value": "#!/usr/bin/env python\nfrom pupa.utils import JSONEncoderPlus\nfrom contextlib import contextmanager\nfrom pymongo import Connection\nimport argparse\nimport json\nimport os\n\nparser = argparse.Argu...
python
chosen
[ { "from": "system", "value": "Implement loading of dictionary and postings list\n\n" }, { "from": "human", "value": "import io\nimport getopt\nimport sys\n\ndef usage():\n\tprint(\"usage: \" + sys.argv[0] + \" -d dictionary-file -p postings-file -q file-of-queries -o output-file-of-results\")\n\...
python
chosen
[ { "from": "system", "value": "Allow other_paths to be passed into TraceViewerProject\n\nThis allows external embedders to subclass TraceViewerProject and thus\nuse trace viewer.\n\ngit-svn-id: 3a56fcae908c7e16d23cb53443ea4795ac387cf2@1198 0e6d7f2b-9903-5b78-7403-59d27f066143\n" }, { "from": "human",...
python
chosen
[ { "from": "system", "value": "Handle non-matching lines which don't cause match errors and don't clean the empty lines if there are no cleaned lines\n" }, { "from": "human", "value": "# -*- coding: utf-8 -*-\nimport re\nimport sublime, sublime_plugin\n\nclass TotalFileCommand(sublime_plugin.Text...
python
chosen
[ { "from": "system", "value": "Delete board_slug parameter on 'delete_post' url\n" }, { "from": "human", "value": "# Created by JHJ on 2016. 10. 5.\n\nfrom django.conf.urls import url\n\nfrom . import views\n\napp_name = 'board'\nurlpatterns = [\n url(r'^$', views.board_list, name='board_list'...
python
chosen
[ { "from": "system", "value": "Add loops in __init__ for continuous convert\n" }, { "from": "human", "value": "class Roman(object):\n\n def __init__(self, number):\n self.number = number\n self.modern_convert()\n convert_table = {}\n\n def modern_convert(self):\n number = self.numbe...
python
chosen
[ { "from": "system", "value": "Change the key to be string\n" }, { "from": "human", "value": "import os\nfrom flask import Flask, request\nimport psycopg2\nimport json\n\napp = Flask(__name__)\n\nDATABASE_URL = os.environ['DATABASE_URL']\n\nconn = psycopg2.connect(DATABASE_URL)\n\n@app.route('/fi...
python
chosen
[ { "from": "system", "value": "Disable viewing the plasm in test.\n" }, { "from": "human", "value": "#!/usr/bin/env python\n\nimport ecto\nimport ecto_test\n\ndef test_feedback():\n plasm = ecto.Plasm()\n g = ecto_test.Generate(\"Generator\", step=1.0, start=1.0)\n add = ecto_test.Add()\...
python
chosen
[ { "from": "system", "value": "Fix error message 'ChannelError: channel disconnected'\n" }, { "from": "human", "value": "# encoding=utf-8\n\nfrom kombu import Exchange, Connection, Producer\nimport logging\n\nclass RabbitMqHandler(object):\n\n def __init__(self, connection, exchange_name, type...
python
chosen
[ { "from": "system", "value": "Update docstring and add fixme for future revision\n" }, { "from": "human", "value": "\"\"\"\nMiddleware for the user accounts app.\n\"\"\"\n\nfrom django.utils import timezone\n\n\nclass LastActivityDateUpdateMiddleware(object):\n \"\"\"\n Middleware for upda...
python
chosen
[ { "from": "system", "value": "Remove support for logging format style - doesn't work in Python 2 at all\n" }, { "from": "human", "value": "import logging\nimport logging.config\nimport logging.handlers\nimport six\nimport sys\n\nfrom ..utils import from_human_readable\n\n\ndef configure(config):...
python
chosen
[ { "from": "system", "value": "Add ldap3 to required modules\n" }, { "from": "human", "value": "# -*- coding: utf-8 -*-\n\nfrom setuptools import setup, find_packages\n\nwith open('README.rst') as f:\n readme = f.read()\n\nwith open('LICENSE') as f:\n license = f.read()\n\nsetup(\n name=...
python
chosen
[ { "from": "system", "value": "Allow Curve25519DH import to fail in crypto package\n\nWith the refactoring to avoid pylint warnings, a problem was introduced\nin importing the crypto module when the curve25519 dependencies were\nunavailable. This commit fixes that problem.\n" }, { "from": "human", ...
python
chosen
[ { "from": "system", "value": "Add ability to control read rate\n" }, { "from": "human", "value": "#!/usr/bin/env python3\n\nfrom Sensor import SenseController\nfrom KeyDispatcher import KeyDispatcher\nfrom Display import Display\nfrom DataLogger import SQLiteLogger\n\n\nDEVICE = \"PiSense\"\n\n\...
python
chosen
[ { "from": "system", "value": "Fix HMM release formatting bug\n\n" }, { "from": "human", "value": "import semver\nimport virtool.github\n\n\ndef format_hmm_release(updated, release, installed):\n # The release dict will only be replaced if there is a 200 response from GitHub. A 304 indicates t...
python
chosen
[ { "from": "system", "value": "Add a sub class for car\n" }, { "from": "human", "value": "class Car(object):\n condition = \"new\"\n def __init__(self, model, color, mpg):\n self.model = model\n self.color = color\n self.mpg = mpg\n\n def display_car(self):\n ...
python
chosen
[ { "from": "system", "value": "Fix the account for memberships payements\n" }, { "from": "human", "value": "# Copyright 2018 ACSONE SA/NV\n# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).\n\nfrom odoo import api, models\n\n\nclass AccountPayment(models.Model):\n\n _inherit = \"a...
python
chosen
[ { "from": "system", "value": "Fix rq jobs registration check\n" }, { "from": "human", "value": "from django.apps import AppConfig\nfrom django.conf import settings\n\nimport session_csrf\n\n\nclass AtmoAppConfig(AppConfig):\n name = 'atmo'\n\n def ready(self):\n # The app is now rea...
python
chosen
[ { "from": "system", "value": "Add yahoo game log header parsing\n" }, { "from": "human", "value": "from bs4 import BeautifulSoup, Tag\nimport requests\n\nclass YahooGameLog:\n def __init__(self, player_id):\n page = requests.get('http://sports.yahoo.com/nba/players/' + player_id + '/ga...
python
chosen
[ { "from": "system", "value": "Remove no longer needed import\n" }, { "from": "human", "value": "#! /usr/bin/env python\n\nimport os\nimport subprocess\nimport config\n\nNAME=\"init\"\nHELP=\"give git issues\"\n\ndef execute(args):\n\t# Check to see if the .ghi directories have already been creat...
python
chosen
[ { "from": "system", "value": "Fix a bug in alembic downgrading script\n" }, { "from": "human", "value": "\"\"\"Insert school data\n\nRevision ID: 13f089849099\nRevises: 3cea1b2cfa\nCreate Date: 2013-05-05 22:58:35.938292\n\n\"\"\"\n\n# revision identifiers, used by Alembic.\nrevision = '13f08984...
python
chosen
[ { "from": "system", "value": "Move main() into _main() to make testing easier\n" }, { "from": "human", "value": "import argparse\nimport os\nimport sys\nfrom urllib.parse import urlparse\n\nfrom .v5_client import LuminosoClient, get_token_filename\nfrom .v5_constants import URL_BASE\n\n\ndef mai...
python
chosen
[ { "from": "system", "value": "Break when done copying the working behaviour\n" }, { "from": "human", "value": "class DiffAgentBase(object):\n diff = []\n noise_reduction = []\n latest_observation = 0\n current_prediction = []\n name = ''\n behaviour = None\n working_behaviou...
python
chosen
[ { "from": "system", "value": "Add url for user's profile\n" }, { "from": "human", "value": "from django.conf.urls import patterns, url\nfrom django.contrib import auth\n\nurlpatterns = patterns('members.views',\n url(r'^login/$', 'login', name='login'),\n url(r'^logout/$', 'logout', name='...
python
chosen
[ { "from": "system", "value": "Remove primary_sid from common fields\n" }, { "from": "human", "value": "import uuid\nimport logging\nfrom django.db import models\nfrom django.contrib.auth.models import AbstractUser as DjangoAbstractUser\n\nlogger = logging.getLogger(__name__)\n\n\nclass AbstractU...
python
chosen
[ { "from": "system", "value": "Remove return statements from assert methods\n" }, { "from": "human", "value": "import requests\n\n\nclass TestCase(object):\n \"\"\"\n Add assetion methods for HTTP Requests to TestCase\n \"\"\"\n\n def assertRequest(self, method=\"GET\", url=\"\", stat...
python
chosen
[ { "from": "system", "value": "Add commented code to allow easily getting at the debug socket, needs eventlet fix to work\n" }, { "from": "human", "value": "# Copyright 2013 IBM Corporation\n# All rights reserved\n\n# This is the main application.\n# It should check for existing UDP socket to neg...
python
chosen
[ { "from": "system", "value": "Make the default cell size larger.\n" }, { "from": "human", "value": "RULES = 'B3/S23'\nWIDTH = 1280\nHEIGHT = 720\nCELL_SIZE = 8\nDENSITY = .5\n" }, { "from": "gpt", "value": "RULES = 'B3/S23'\nWIDTH = 1280\nHEIGHT = 720\nCELL_SIZE = 16\nDENSITY = .2\n"...
python
chosen
[ { "from": "system", "value": "Make listings script executable, add argument handling.\n" }, { "from": "human", "value": "\"\"\"\nGroups AMI datasets by pointing direction,\nthen dumps them in JSON format.\n\"\"\"\n\nimport ami\nimport json\n\nami_rootdir = '/opt/ami'\n\nr = ami.Reduce(ami_rootdi...
python
chosen
[ { "from": "system", "value": "Mark CMS pages as changed .. using CMS publisher signals.\n" }, { "from": "human", "value": "# -*- coding: utf-8 -*-\n\nfrom __future__ import unicode_literals\n\nfrom django.conf import settings\nfrom django.utils import translation\n\nfrom cms.models import Title\...
python
chosen
[ { "from": "system", "value": "Load plugins from entry point\n" }, { "from": "human", "value": "\"\"\"Statistical models for biomolecular dynamics\"\"\"\nfrom __future__ import print_function, absolute_import, division\nimport sys\nfrom ..cmdline import App\nfrom ..commands import *\nfrom ..versi...
python
chosen
[ { "from": "system", "value": "Call parse with markdown files, copy otherwise\n" }, { "from": "human", "value": "import os\n\nclass Generator:\n def run(self, sourcedir, outputdir):\n sourcedir = os.path.normpath(sourcedir)\n outputdir = os.path.normpath(outputdir)\n prefi...
python
chosen
[ { "from": "system", "value": "Call configure() on settings to ensure that the CELERY_PROGRESS_BACKEND variable can be picked up\n" }, { "from": "human", "value": "from django.conf import settings\nfrom django.utils.module_loading import import_by_path\n\nBACKEND = getattr(settings, 'CELERY_PROGR...
python
chosen
[ { "from": "system", "value": "Modify an importer skip minversion\n" }, { "from": "human", "value": "# encoding: utf-8\n\n\"\"\"\n.. codeauthor:: Tsuyoshi Hombashi <tsuyoshi.hombashi@gmail.com>\n\"\"\"\n\nfrom __future__ import print_function, unicode_literals\n\nimport pytest\nfrom pytablewriter...
python
chosen
[ { "from": "system", "value": "Add doc string to Output widget\n" }, { "from": "human", "value": "\"\"\"Output class. \n\nRepresents a widget that can be used to display output within the widget area.\n\"\"\"\n\n# Copyright (c) IPython Development Team.\n# Distributed under the terms of the Modi...
python
chosen
[ { "from": "system", "value": "Enable '-h' help option from the pdtools root level.\n" }, { "from": "human", "value": "\"\"\"\nParadrop command line utility.\n\nEnvironment Variables:\n PDSERVER_URL Paradrop controller URL [default: https://paradrop.org].\n\"\"\"\nimport os\n\nimport click\...
python
chosen
[ { "from": "system", "value": "Add tests for reading profile data\n" }, { "from": "human", "value": "#!/usr/bin/env python\n\nimport os\nimport sys\nimport unittest\nparentDir = os.path.join(os.path.dirname(__file__), \"../\")\nsys.path.insert(0, parentDir)\n\nfrom oxyfloat import OxyFloat\n\ncla...
python
chosen
[ { "from": "system", "value": "Add Triangle to shape tests\n" }, { "from": "human", "value": "import pytest\nfrom unittest import TestCase\n\nfrom stylo.shape import Ellipse, Circle, Rectangle, Square\nfrom stylo.testing.shape import BaseShapeTest\n\n\n@pytest.mark.shape\nclass TestEllipse(TestCa...
python
chosen
[ { "from": "system", "value": "Revise flu fasta fields to interface with nextflu.\n" }, { "from": "human", "value": "import os,datetime\nfrom download import download\nfrom download import get_parser\n\nclass flu_download(download):\n def __init__(self, **kwargs):\n download.__init__(se...
python
chosen
[ { "from": "system", "value": "Make status the last optional arg.\n" }, { "from": "human", "value": "from django.http import HttpResponse, HttpResponseServerError\nfrom django.template import RequestContext, loader\nfrom django.conf import settings\n\nfrom maintenancemode.http import HttpResponse...
python
chosen
[ { "from": "system", "value": "Use any for concise code\n" }, { "from": "human", "value": "import ctypes\r\nfrom ctypes import WinDLL, byref, WinError\r\nfrom ctypes.wintypes import MSG\r\n_user32 = WinDLL(\"user32\")\r\n\r\nGetMessage = _user32.GetMessageA\r\nGetMessage.argtypes = [\r\n ctype...
python
chosen
[ { "from": "system", "value": "Change for style checking warning\n" }, { "from": "human", "value": "\"\"\"dasem.\"\"\"\n\nfrom __future__ import absolute_import\n\nfrom .fullmonty import Word2Vec\n\n\n__all__ = ['Word2Vec']\n" }, { "from": "gpt", "value": "\"\"\"dasem.\"\"\"\n\nfrom _...
python
chosen
[ { "from": "system", "value": "Fix spelling of 'IPv4' and 'IPv6' (cosmetic)\n" }, { "from": "human", "value": "ACTION_CREATE = 0\nACTION_VIEW = 1\nACTION_UPDATE = 2\nACTION_DELETE = 3\nACTIONS = {\n ACTION_CREATE: 'Create',\n ACTION_VIEW: 'View',\n ACTION_UPDATE: 'Update',\n ACTION_...
python
chosen
[ { "from": "system", "value": "Add missing constant for ssl listener.\n" }, { "from": "human", "value": "\nSQL_PORT = 15000\nJSON_RPC_PORT = 15598\nHTTP_PORT = 15597\nJSON_PUBSUB_PORT = 15596\n" }, { "from": "gpt", "value": "\nSQL_PORT = 15000\nJSON_RPC_PORT = 15598\nHTTP_PORT = 15597...
python
chosen
[ { "from": "system", "value": "Update dsub version to 0.3.10.dev0\n\nPiperOrigin-RevId: 319887839\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 com...
python
chosen
[ { "from": "system", "value": "Make indexing on real time\n" }, { "from": "human", "value": "import datetime\nfrom haystack.indexes import SearchIndex, CharField, DateTimeField\nfrom haystack import site\nfrom models import Author, Material\n\n\nclass AuthorIndex(SearchIndex):\n # the used tem...
python
chosen
[ { "from": "system", "value": "Change location of photos json file" }, { "from": "human", "value": "import json\n\ndef main():\n input_json = json.load(open(\"photo_id_to_business_id.json\"))\n \n # print the header of output csv file\n print 'photo_id,business_id,label'\n \n # ...
python
chosen
[ { "from": "system", "value": "Add the new settings for the database\n" }, { "from": "human", "value": "import MySQLdb\n\n\ndef connection():\n conn = MySQLdb.connect(host=\"localhost\",\n user=\"root\",\n passwd=\"gichin124\",\n ...
python
chosen
[ { "from": "system", "value": "Fix typo in test assertion\n" }, { "from": "human", "value": "import datetime\n\nimport pytest\n\nfrom fsspec import AbstractFileSystem\nfrom fsspec.implementations.tests.conftest import READ_ONLY_FILESYSTEMS\n\nTEST_FILE = 'file'\n\n\n@pytest.mark.parametrize(\"fs\...
python
chosen