conversations
listlengths
2
3
source
stringclasses
1 value
stack
stringclasses
1 value
[ { "from": "system", "value": "Add notebook resources to Python 3 build process.\n" }, { "from": "human", "value": "import os.path\nfrom setuptools import setup\n\nfrom setupbase import (setup_args, find_scripts, find_packages)\n \nsetup_args['entry_points'] = find_scripts(True, suffix='3')\ns...
python
chosen
[ { "from": "system", "value": "Add matches method to AndRule class.\n" }, { "from": "human", "value": "class PriceRule:\n \"\"\"PriceRule is a rule that triggers when a stock price satisfies a condition.\n\n The condition is usually greater, equal or lesser than a given value.\n \"\"\"\n...
python
chosen
[ { "from": "system", "value": "Change to is_superuser and make email optional.\n" }, { "from": "human", "value": "\"\"\"Objects for users.\"\"\"\n\n__all__ = [\n \"User\",\n \"Users\",\n]\n\nfrom . import (\n check,\n Object,\n ObjectField,\n ObjectSet,\n ObjectType,\n)\n\n\n...
python
chosen
[ { "from": "system", "value": "Refactor Random Color as Flag Method\n" }, { "from": "human", "value": "import random\n\ndef random_color():\n colors = ['white', 'black',\n '#cc0033', #red\n '#ffcc00', #yellow\n '#009933', #green\n '#003399', ...
python
chosen
[ { "from": "system", "value": "Move specificication of classpath below imports\n" }, { "from": "human", "value": "import os\nJAR_FILE = \"/openrocket.jar\"\nos.environ['CLASSPATH'] = os.getcwd() + JAR_FILE\nfrom jnius import autoclass\n\nclass OpenRocketSimulations:\n ENTRY_CLASS = 'TeamRocket...
python
chosen
[ { "from": "system", "value": "Refactor the timing decorator to be less confusing\n\nAlso means that we don't have to ignore a flake8 error.\n" }, { "from": "human", "value": "from functools import wraps\nfrom time import time\n\nfrom django_statsd.clients import statsd\n\n\nclass UnauthorizedExc...
python
chosen
[ { "from": "system", "value": "Change name manager Publisher to Published\n" }, { "from": "human", "value": "#!/usr/bin/env python\nfrom django.db import models\nfrom django.utils.translation import ugettext_lazy as _\n\nfrom datetime import datetime\n\n\n\nclass PublisherMnager(models.Manager):\...
python
chosen
[ { "from": "system", "value": "Allow the USB index to be modified\n" }, { "from": "human", "value": "import logging\n# import picamera\n# import picamera.array\nfrom abc import ABCMeta, abstractmethod\n\nimport cv2\n\nLOG = logging.getLogger(__name__)\n\n\nclass Camera(metaclass=ABCMeta):\n\n ...
python
chosen
[ { "from": "system", "value": "Remove an import that no longer used\n" }, { "from": "human", "value": "# encoding: utf-8\n\n\"\"\"\n.. codeauthor:: Tsuyoshi Hombashi <tsuyoshi.hombashi@gmail.com>\n\"\"\"\n\nfrom __future__ import absolute_import, unicode_literals\n\nimport re\n\nfrom ._common imp...
python
chosen
[ { "from": "system", "value": "Change the order of the subcommands.\n" }, { "from": "human", "value": "from __future__ import absolute_import, print_function\n__author__ = 'katharine'\n\nimport argparse\nimport logging\nimport sys\n\nfrom .commands.base import register_children\nfrom .commands im...
python
chosen
[ { "from": "system", "value": "Update to allow more settings for font, color, position\n\n- copyright_text_font: a system or user font name, or absolute path to\n.ttf file\n- copyright_text_font_size: font size used when\ncopyright_text_font is set\n- copyright_text_color: text color\n- copyright_text_positi...
python
chosen
[ { "from": "system", "value": "Remove unneeded get_dependencies from course element\n" }, { "from": "human", "value": "import random\nimport chevron\n\ndef get_dependencies(element_html, element_index, data):\n return {\n 'styles': ['course_element.css'],\n 'scripts': ['course_el...
python
chosen
[ { "from": "system", "value": "Remove unused code for monkeyed methods\n" }, { "from": "human", "value": "from zope.interface import implements\n#from Products.Archetypes.CatalogMultiplex import CatalogMultiplex\n#from Products.CMFCore.CMFCatalogAware import CMFCatalogAware\nfrom zerodb.collectiv...
python
chosen
[ { "from": "system", "value": "Fix error of chainer v3 on chainer.cuda.cupy\n" }, { "from": "human", "value": "import chainer\n\n\ndef batch_states(states, xp, phi):\n \"\"\"The default method for making batch of observations.\n\n Args:\n states (list): list of observations from an e...
python
chosen
[ { "from": "system", "value": "Remove all of the SeriesNode inline stuff (doesn't work yet)\n" }, { "from": "human", "value": "from django.contrib import admin\nfrom django.contrib.contenttypes import generic\n\n\nfrom . import models\n\n\nclass SeriesNodeInline(generic.GenericTabularInline):\n ...
python
chosen
[ { "from": "system", "value": "Add class comment and a custom color for the decorator\n" }, { "from": "human", "value": "from pygments.style import Style\nfrom pygments.token import Keyword, Name, Comment, String, Error, \\\n Number, Operator, Generic\n\nclass IgorStyle(Style):\n default_s...
python
chosen
[ { "from": "system", "value": "Add ability for flat file table parsing module to skip ahead to first occurence of a regular expression (use case: consistently parsing DepthOfCoverage output for histogram section of file across file format changes)\n\n\ngit-svn-id: 4561c0a8f080806b19201efb9525134c00b76d40@237...
python
chosen
[ { "from": "system", "value": "Add more comments in capturist dashboard view\n" }, { "from": "human", "value": "from django.contrib.auth.decorators import user_passes_test, login_required\nfrom django.shortcuts import render\nfrom perfiles_usuario.utils import is_capturista\nfrom estudios_socioec...
python
chosen
[ { "from": "system", "value": "Adjust deployer to use new class name for ini file management.\n" }, { "from": "human", "value": "\"\"\"\nBased on environment variables make a config file (production.ini) for our encoded application.\n\"\"\"\n\nimport os\nfrom dcicutils.deployment_utils import Dep...
python
chosen
[ { "from": "system", "value": "Update timer test script to use non-reserved timer.\n" }, { "from": "human", "value": "# Timer Control Example\n#\n# This example shows how to use a timer for callbacks.\n\nimport time\nfrom pyb import Pin, Timer, LED\n\nblue_led = LED(3)\n\n# we will receive the t...
python
chosen
[ { "from": "system", "value": "Add ability to pass 'models' argument to ilamb-run\n\nThis is needed to benchmark individual models instead of all the\nmodels under the directory specified by `model_root`.\n" }, { "from": "human", "value": "\"\"\"Reads and parses a configuration file for the ILAMB...
python
chosen
[ { "from": "system", "value": "Remove auto start in loop with \"while True\".\n" }, { "from": "human", "value": "import logging.config\nimport sys\nimport os\nimport time\n\nimport serial\n\nfrom amber.hokuyo.hokuyo_common import HokuyoController\nfrom amber.tools import serial_port, config\n\n\n...
python
chosen
[ { "from": "system", "value": "Fix false bug flag by allowing empty lines\n" }, { "from": "human", "value": "# Copyright (C) 2017 Bran Seals. All rights reserved.\n# Created: 2017-06-05\nfrom UmlClass import UmlClass\n\nprint(\"== UML to CPP ==\")\nprint(\"Create or modify C++ header and implemen...
python
chosen
[ { "from": "system", "value": "DOC: Add missing member functions in fake CFFI class\n\nPR #160 introduced those calls on module load, which broke the Sphinx\nautodoc generation.\n" }, { "from": "human", "value": "\"\"\"Mock module for Sphinx autodoc.\"\"\"\n\n\nclass FFI(object):\n\n def cdef(...
python
chosen
[ { "from": "system", "value": "Remove debug prints from tests\n" }, { "from": "human", "value": "from gi.repository import Zeitgeist, GObject\nimport time\n\nlog = Zeitgeist.Log.get_default()\nmainloop = GObject.MainLoop()\n\ndef on_events_inserted(log, time_range, events):\n print \"===\"\n\n...
python
chosen
[ { "from": "system", "value": "Make sure only Sales Order with state in 'draft' or 'sent' is confirmed (state 'canceled' will not be confirmed)\n" }, { "from": "human", "value": "# -*- coding: utf-8 -*-\n# Copyright 2016 Onestein (<http://www.onestein.eu>)\n# License AGPL-3.0 or later (http://www...
python
chosen
[ { "from": "system", "value": "Add get_absolute_url method to serializer\n" }, { "from": "human", "value": "from rest_framework import serializers as ser\nfrom api.base.serializers import JSONAPISerializer, LinksField, RelationshipField\n\n\nclass IdentifierSerializer(JSONAPISerializer):\n\n c...
python
chosen
[ { "from": "system", "value": "Add CONN_MAX_AGE setting because it makes a huge difference on busy sites\n" }, { "from": "human", "value": "from project.settings import *\n\n\nDEBUG = False\nTEMPLATE_DEBUG = DEBUG\n\nDATABASES = {\n 'default': {\n 'ENGINE': 'django.db.backends.postgresq...
python
chosen
[ { "from": "system", "value": "Add constant for Character Schema file path\n" }, { "from": "human", "value": "\"\"\"This module loads character data from XML files and stores them in\nCharacterData objects that can be read by the game engine.\n\nAttributes:\n CHARACTER_LIST_PATH (String): The ...
python
chosen
[ { "from": "system", "value": "Add test for creating profile from serializer.\n" }, { "from": "human", "value": "from know_me import serializers\n\n\ndef test_serialize(profile_factory):\n \"\"\"\n Test serializing a profile.\n \"\"\"\n profile = profile_factory()\n serializer = se...
python
chosen
[ { "from": "system", "value": "Change list copy to list()\n" }, { "from": "human", "value": "\"\"\"\nSolution to code eval interrupted bubble sort:\nhttps://www.codeeval.com/open_challenges/158/\n\"\"\"\nimport sys\n\n\ndef bubble_sort(inputL):\n \"\"\"One iteration of bubble sort.\"\"\"\n ...
python
chosen
[ { "from": "system", "value": "Allow signal handlers to be disabled to run in subthread\n" }, { "from": "human", "value": "import time\nfrom twisted.internet import reactor\n\nfrom .http_protocol import HTTPFactory\n\n\nclass Server(object):\n\n def __init__(self, channel_layer, host=\"127.0.0...
python
chosen
[ { "from": "system", "value": "Change update value to produce less thrash on embedded side\n" }, { "from": "human", "value": "import blinkycolor\nimport serial\n\nclass BlinkyTape(object):\n def __init__(self, port, baud_rate = 115200, pixel_count = 60):\n self._serial = serial.Serial(p...
python
chosen
[ { "from": "system", "value": "Add zoom in/out action to the text edit context menu\n\nFix #5\n" }, { "from": "human", "value": "\"\"\"\nContains the quick reference widget\n\"\"\"\nimport re\nfrom pyqode.qt import QtWidgets\nfrom .forms import quick_ref_ui\n\nclass QuickRefWidget(QtWidgets.QWidg...
python
chosen
[ { "from": "system", "value": "Allow global settings to override.\n\nSigned-off-by: Chris Lamb <711c73f64afdce07b7e38039a96d2224209e9a6c@playfire.com>\n" }, { "from": "human", "value": "# Default cache duration\nCACHE_RELATION_DEFAULT_DURATION = 60 * 60 * 24 * 3\n" }, { "from": "gpt", ...
python
chosen
[ { "from": "system", "value": "Store current working directory before import\n" }, { "from": "human", "value": "#\n# This program provides a simple command line to query population statistics.\n# Author: Tay Joc Cing\n# Date: 20 Mar 2015\n#\n\nimport sys\nimport os\n\nfrom country import Country\...
python
chosen
[ { "from": "system", "value": "Add solution for problem 14\n\nLongest Collatz sequence\n" }, { "from": "human", "value": "\"\"\"Longest Collatz sequence\n\nThe following iterative sequence is defined for the set of positive integers:\n\nn -> n/2 (n is even)\nn -> 3n + 1 (n is odd)\n\nUsing the ru...
python
chosen
[ { "from": "system", "value": "Update Python tests for scoring_result\n" }, { "from": "human", "value": "#!@PYTHON_EXECUTABLE@\n#ckwg +5\n# Copyright 2011 by Kitware, Inc. All Rights Reserved. Please refer to\n# KITWARE_LICENSE.TXT for licensing information, or contact General Counsel,\n# Kitware...
python
chosen
[ { "from": "system", "value": "Add utility to iterate over numba base classes\n" }, { "from": "human", "value": "\"Simple utilities related to extension types\"\n\n#------------------------------------------------------------------------\n# Read state from extension types\n#----------------------...
python
chosen
[ { "from": "system", "value": "Add subdomain for educacion integral\n" }, { "from": "human", "value": "# -*- coding: utf-8 -*-\nfrom .base import *\n\n# SECURITY WARNING: don't run with debug turned on in production!\nDEBUG = False\n\nALLOWED_HOSTS = ['138.197.197.47', 'junipero.erikiado.com']\n\...
python
chosen
[ { "from": "system", "value": "Fix passing the search_term parameter to Searcher\n" }, { "from": "human", "value": "\n\"\"\"\ngrep_redone, version 0.9 \nSearch files for a pattern or string, optionally do this recursively.\n\nusage: grep_redone [-rnfe] [SEARCH_TERM]\n\nArguments:\n SEARCH_TERM ...
python
chosen
[ { "from": "system", "value": "Add the newsitems to GAE NDB\n\nIf not present, add the news item to the non relational database of google app\nengine.\n\nFor deciding unique keys, md5 hashing using the news item title and date is\nused.\n\nSigned-off-by: Venkatesh Shukla <8349e50bec2939976da648e286d7e261bcd1...
python
chosen
[ { "from": "system", "value": "Set response encoding based on apparent_encoding.\n\nHeaders from drweeaboo.net incorrectly tell us ISO-8859-1.\n" }, { "from": "human", "value": "import requests\n\ndef user_guide():\n r = requests.get(\"http://drweeaboo.net/msparp/userguide/duplicateguide.html\...
python
chosen
[ { "from": "system", "value": "Update front page of the documentation\n" }, { "from": "human", "value": "\"\"\"\nThis module implements a forms system for creating, filling out, and\nreviewing forms within an organization. This module depends on the\nConstellation-Base package to function correc...
python
chosen
[ { "from": "system", "value": "Fix bug in introspection rule" }, { "from": "human", "value": "from django.db import models\n\n\nclass CounterField(models.IntegerField):\n def __init__(self, *args, **kwargs):\n kwargs['default'] = kwargs.get('default', 0)\n super(CounterField, sel...
python
chosen
[ { "from": "system", "value": "Fix for the previous commit (Celery app removal)\n\nHaven't paid enough attention and missed what ready method does.\r\nRemoved the code. Libraries shouldn't do this - it's main project responsibility." }, { "from": "human", "value": "from django.apps import AppConf...
python
chosen
[ { "from": "system", "value": "Comment out assertion of environment variables(AWS_ACCESS_KEY_ID, AWS_SECRET_ACCESS_KEY).\nWhen test fail, all environment variables appear in the error log in some case.\nUse credential file(~/.aws/credential) configuration for testing.\n" }, { "from": "human", "va...
python
chosen
[ { "from": "system", "value": "Fix type: NoneType --> bool\n" }, { "from": "human", "value": "# coding: utf-8\n\nimport logging\nimport psutil\nfrom subprocess import PIPE\n\nclass FfmpegProcess(object):\n def __init__(self):\n self._cmdline = None\n self._process = None\n ...
python
chosen
[ { "from": "system", "value": "Add pragma: nocover to non-implemented methods\n" }, { "from": "human", "value": "#!/usr/bin/env python\n# coding: utf-8\n\nimport sys\nimport os\n\n# import argparse\n\n\nclass Infect(object):\n class Codes:\n symlink = {\n 'success': 0,\n ...
python
chosen
[ { "from": "system", "value": "Make download script work with Python 3.\n\nCloses #47." }, { "from": "human", "value": "from sys import maxsize\nimport os\n\n# There is similar code in ./debian/postinst. If you are changing this\n# you probably want to change that too.\ndef download_xflux():\n ...
python
chosen
[ { "from": "system", "value": "Allow overriding database name with DBNAME environment variable\n" }, { "from": "human", "value": "from flask import Flask\nfrom flask.ext.mongoengine import MongoEngine\nimport logging\nfrom os import environ\nimport urlparse\n\n# configure the logging\nlogging.bas...
python
chosen
[ { "from": "system", "value": "Revert \"Renames jQuery to jquery.\"\n\nThis reverts commit c1a1ad720326cd6c2877a89698534c9762d17df3.\n" }, { "from": "human", "value": "# -*- coding: utf-8 -*-\n\"\"\"Application assets.\"\"\"\nfrom flask_assets import Bundle, Environment\n\ncss = Bundle(\n 'lib...
python
chosen
[ { "from": "system", "value": "Change to modifiable error message\n" }, { "from": "human", "value": "# encoding: utf-8\n\n\"\"\"\n.. codeauthor:: Tsuyoshi Hombashi <gogogo.vm@gmail.com>\n\"\"\"\n\nfrom __future__ import absolute_import\nfrom __future__ import unicode_literals\n\nimport dataproper...
python
chosen
[ { "from": "system", "value": "[AC-7743] Change the user role key from userv to name\n" }, { "from": "human", "value": "# Generated by Django 2.2.10 on 2020-04-09 21:24\n\nfrom django.db import migrations\n\n\ndef add_deferred_user_role(apps, schema_editor):\n DEFERRED_MENTOR = 'Deferred Mento...
python
chosen
[ { "from": "system", "value": "Add sources to example scrape.\n" }, { "from": "human", "value": "from pupa.scrape import Scraper\nfrom pupa.models import Person, Organization\n\n\nclass PersonScraper(Scraper):\n\n def get_people(self):\n # committee\n tech = Organization('Technol...
python
chosen
[ { "from": "system", "value": "Move compact_quote() to main LCD ticker file.\n" }, { "from": "human", "value": "#!/usr/bin/env python\n\n\"\"\"Display stock quotes on LCD\"\"\"\n\nfrom ystockquote import get_price, get_change\nfrom lcd import lcd_string, tn\n\nsymbols = ['AAPL', 'MSFT', 'F', 'T',...
python
chosen
[ { "from": "system", "value": "Modify the URL helper to not rely on None values\n" }, { "from": "human", "value": "import logging\nlogger = logging.getLogger(__package__)\n\n\ndef request_retry_helper(function, retry_count: int, url: str):\n \"\"\"\n Given a function make a number of attemp...
python
chosen
[ { "from": "system", "value": "[AC-4959] Rename Test And Add Test For GET\n" }, { "from": "human", "value": "# MIT License\n# Copyright (c) 2017 MassChallenge, Inc.\n\nfrom django.urls import reverse\n\nfrom impact.middleware.method_override_middleware import METHOD_OVERRIDE_HEADER\nfrom impact.t...
python
chosen
[ { "from": "system", "value": "Fix the app compatibility for real.\n\nThe previous change was still wrong. This is what I meant to do in the\nfirst place.\n" }, { "from": "human", "value": "try:\n from django.apps.registry import apps\n\n # Django >= 1.7\n get_apps = apps.get_apps\n c...
python
chosen
[ { "from": "system", "value": "Change the default db name to dadd_db\n" }, { "from": "human", "value": "import os\n\ncurdir = os.getcwd()\n\nSECRET_KEY = 'something secret'\nSQLALCHEMY_DATABASE_URI = 'postgresql+psycopg2://dadapp:uhpqZ5pc@localhost/daddb'\nSTORAGE_DIR = os.path.join(curdir, 'temp...
python
chosen
[ { "from": "system", "value": "Fix patterns for Django > 1.10\n\nPike requires Django 1.11 so fix the template pattern import which was\nnot compatible with that version. This fixes:\n\nFile\n\"/srv/www/openstack-dashboard/openstack_dashboard/dashboards/help/guides/\\\n urls.py\", line 15, in <module>\nfr...
python
chosen
[ { "from": "system", "value": "Store cur_language in alternate before everything\n" }, { "from": "human", "value": "from django.conf import settings as django_settings\ntry:\n from django.core.urlresolvers import reverse, resolve\nexcept ImportError:\n from django.urls import reverse, resol...
python
chosen
[ { "from": "system", "value": "Make debug toolbar use local jquery\n" }, { "from": "human", "value": "from .base import * # noqa\n\n\nDEBUG = True\nALLOWED_HOSTS = ['*']\n\ntry:\n import dj_database_url\n DATABASES = {'default': dj_database_url.config(\n default='postgres://postgres...
python
chosen
[ { "from": "system", "value": "Print out number of lines found for chatlog\n" }, { "from": "human", "value": "#!/usr/bin/python\n\nimport argparse\nimport datetime\nimport string\n\n############\n### MAIN ###\n############\nparser = argparse.ArgumentParser(formatter_class = argparse.RawTextHelpFo...
python
chosen
[ { "from": "system", "value": "Increment version number to 0.16.6\n" }, { "from": "human", "value": "\"\"\"Configuration for Django system.\"\"\"\n\n__version__ = \"0.16.5\"\n__version_info__ = tuple(\n [\n int(num) if num.isdigit() else num\n for num in __version__.replace(\"-\"...
python
chosen
[ { "from": "system", "value": "Add interlinks urls for doc and tiliado\n\nSigned-off-by: Jiří Janoušek <2a48236b6dcae98c8c0e90f4673742773ee17d91@gmail.com>\n" }, { "from": "human", "value": "# -*- coding: utf-8 -*- #\nfrom __future__ import unicode_literals\nfrom common_conf import *\n\nSITEURL =...
python
chosen
[ { "from": "system", "value": "Call _render before _step to support BipedalWalker\n" }, { "from": "human", "value": "def make_rendered(env, *render_args, **render_kwargs):\n base_step = env._step\n\n def _step(action):\n env.render(*render_args, **render_kwargs)\n return base_...
python
chosen
[ { "from": "system", "value": "Delete the exercise bases, not the translations\n" }, { "from": "human", "value": "# Generated by Django 3.2.15 on 2022-08-25 17:25\n\nfrom django.db import migrations\nfrom django.conf import settings\n\n\ndef delete_pending_exercises(apps, schema_editor):\n \"\...
python
chosen
[ { "from": "system", "value": "Update common context processors tests.\n" }, { "from": "human", "value": "from nose.tools import eq_\n\nfrom django.test import TestCase\n\nfrom us_ignite.common.tests import utils\nfrom us_ignite.common import context_processors\n\n\nclass TestSettingsAvailableCon...
python
chosen
[ { "from": "system", "value": "Write function for getting expected args\n" }, { "from": "human", "value": "# Copyright (c) 2017 The Regents of the University of Michigan.\n# All Rights Reserved. Licensed according to the terms of the Revised\n# BSD License. See LICENSE.txt for details.\n\nclass F...
python
chosen
[ { "from": "system", "value": "Add party/province to politician search index\n" }, { "from": "human", "value": "from haystack import site\nfrom haystack import indexes\n\nfrom parliament.core.models import Politician\nfrom parliament.search.utils import SearchIndex\n\nclass PolIndex(SearchIndex):...
python
chosen
[ { "from": "system", "value": "Fix format of log file\n" }, { "from": "human", "value": "import logging\n\ndef start_logger(output=None, verbose=0):\n \"\"\"\n Start an instance of Logger for logging\n\n output : `str`\n output directory (./)\n\n verbose: `int`\n Verbosi...
python
chosen
[ { "from": "system", "value": "Remove no longer valid del sys statement\n" }, { "from": "human", "value": "\"\"\"\nGala\n===\n\n Gala is a Python package for nD image segmentation. \n\"\"\"\n\n__author__ = 'Juan Nunez-Iglesias <juan.n@unimelb.edu.au>, '+\\\n 'Ryan Kennedy <kenry@ci...
python
chosen
[ { "from": "system", "value": "Change for EAS invalid pw case, to allow user to re-enter pw once before raising error.\n\nSummary:\nOne line change in password_auth to allow password re-rentry.\nSee D106 too\n\nTest Plan: None\n\nReviewers: mg\n\nDifferential Revision: https://review.inboxapp.com/D107\n" }...
python
chosen
[ { "from": "system", "value": "Change User-agent header during unittests\n" }, { "from": "human", "value": "#!/usr/bin/env python\n# -*- coding: utf-8 -*-\nfrom __future__ import absolute_import\nfrom __future__ import division\nfrom __future__ import print_function\nfrom __future__ import unicod...
python
chosen
[ { "from": "system", "value": "Use AbstractEntry instead of EntryAbstractClass\n" }, { "from": "human", "value": "\"\"\"Placeholder model for Zinnia\"\"\"\nimport inspect\n\nfrom cms.models.fields import PlaceholderField\nfrom cms.plugin_rendering import render_placeholder\n\nfrom zinnia.models.e...
python
chosen
[ { "from": "system", "value": "Use 'isinstance' in preference to 'type' method\n" }, { "from": "human", "value": "from ._abstract import AbstractScraper\n\n\nclass AllRecipes(AbstractScraper):\n @classmethod\n def host(cls):\n return \"allrecipes.com\"\n\n def author(self):\n ...
python
chosen
[ { "from": "system", "value": "Add Atom feed for events that have 'syndicate' set in their source config.\n" }, { "from": "human", "value": "from been.couch import CouchStore\nfrom flask import render_template, abort\nfrom wake import app\n\nstore = CouchStore().load()\n\n@app.route('/')\ndef wak...
python
chosen
[ { "from": "system", "value": "Add a full_repository_name method on Repo model\n" }, { "from": "human", "value": "from django.db import models\n# Create your models here.\n\nclass Subscriber(models.Model):\n email = models.EmailField()\n valid = models.BooleanField(default=True)\n\nclass Re...
python
chosen
[ { "from": "system", "value": "Move process filter to observation_provider\n\nSee https://github.com/gis4dis/poster/wiki/Server-configuration/d9e22000c5e923adcb8ec7cee72b62d082799516" }, { "from": "human", "value": "PROPERTIES = {\n\n # common.Property.name_id\n 'air_temperature': {\n\n ...
python
chosen
[ { "from": "system", "value": "Add mechanism for defining registers in memory mapped peripherals of MCU\n" }, { "from": "human", "value": "import gdb\nimport struct\n\n\nclass DeviceMemory:\n def __init__(self):\n self.inferior = gdb.selected_inferior()\n\n def __del__(self):\n ...
python
chosen
[ { "from": "system", "value": "Refactor relative path to absolute for more reliability\n" }, { "from": "human", "value": "from api import db, migration\r\nimport os\r\n\r\nmigration.create_schema_version()\r\nmigrations = migration.get_filenames(\"migrations\")\r\n\r\nversions = [f.split('__')[0]...
python
chosen
[ { "from": "system", "value": "Update reference to babel documentation\n\nBabel changed it's link to their documents." }, { "from": "human", "value": "from decimal import Decimal as D\nfrom decimal import InvalidOperation\n\nfrom babel.numbers import format_currency\nfrom django import template\n...
python
chosen
[ { "from": "system", "value": "Improve format of logging output.\n" }, { "from": "human", "value": "\"\"\"\n@copyright: 2013 Single D Software - All Rights Reserved\n@summary: Debugging console interface for Light Maestro.\n\"\"\"\n\n# Standard library imports\nimport logging\nimport threading\ni...
python
chosen
[ { "from": "system", "value": "Set the vk key hex routine correctly\n" }, { "from": "human", "value": "# Import nacl libs\nimport libnacl\nimport libnacl.encode\n\n# Import python libs\nimport datetime\nimport binascii\n\n\nclass BaseKey(object):\n '''\n Include methods for key management c...
python
chosen
[ { "from": "system", "value": "Add test to smoke out contains problem in Ledger\n" }, { "from": "human", "value": "import Ledger\nfrom Transaction import Transaction\n\nimport unittest\n\nclass TestLedger(unittest.TestCase) :\n\n def setUp(self) :\n self.test_object = Ledger.Ledger()\n\...
python
chosen
[ { "from": "system", "value": "Add more tests for config list\n" }, { "from": "human", "value": "# -*- coding: utf-8 -*-\nfrom __future__ import absolute_import, division, print_function\n\nfrom mock import patch\nfrom tests.test_cli.utils import BaseCommandTestCase\n\nfrom polyaxon_cli.cli.confi...
python
chosen
[ { "from": "system", "value": "Fix bug due to typo\n" }, { "from": "human", "value": "import importlib\nimport glob\nfrom modules.exception import *\nfrom os.path import basename, splitext\n\nPLUGINS_DIR = \"./plugins\"\n\ndef get_plugins(plugins_dir = PLUGINS_DIR):\n plugins = {}\n plugin_...
python
chosen
[ { "from": "system", "value": "Test for dynamic tag creation.\n" }, { "from": "human", "value": "# -*- coding: utf-8 -*-\n\nimport pytest\n\nfrom repocket.rules import compile_rules, Rule\nfrom repocket.main import PocketItem\n\n\ndef test_single_rule():\n item1 = PocketItem(1, 'http://google....
python
chosen
[ { "from": "system", "value": "Add test for utility function json_error_message()\n" }, { "from": "human", "value": "\"\"\"Tests for the Texcavator utility functions\"\"\"\nimport os\nos.environ.setdefault(\"DJANGO_SETTINGS_MODULE\", \"texcavator.settings\")\n" }, { "from": "gpt", "va...
python
chosen
[ { "from": "system", "value": "Create IndexTests class. Implement uuid test.\n" }, { "from": "human", "value": "from django.test import TestCase\n\n# Create your tests here.\n" }, { "from": "gpt", "value": "import pdb\nfrom django.test import TestCase\nfrom .models import Move\n\n# Cr...
python
chosen
[ { "from": "system", "value": "Test - fix output dir name\n" }, { "from": "human", "value": "# Copyright 2015 0xc0170\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may not use this file except in compliance with the License.\n# You may obtain a copy of the License...
python
chosen
[ { "from": "system", "value": "Fix a typo in the valid message\n" }, { "from": "human", "value": "from pyisemail.diagnosis import BaseDiagnosis\n\n\nclass ValidDiagnosis(BaseDiagnosis):\n\n \"\"\"A diagnosis indicating the address is valid for use.\n\n \"\"\"\n\n DESCRIPTION = \"Address ...
python
chosen
[ { "from": "system", "value": "Add optional timeout argument to probe\n\nPopen.communicate() supports a timeout argument which is useful in case\nthere is a risk that the probe hangs.\n" }, { "from": "human", "value": "import json\nimport subprocess\nfrom ._run import Error\nfrom ._utils import c...
python
chosen
[ { "from": "system", "value": "Add test for conditional elses\n" }, { "from": "human", "value": "import pytest\n\nfrom thinglang.runner import run\n\n\ndef test_simple_conditionals():\n assert run(\"\"\"\nthing Program\n does start\n if \"dog\" eq \"dog\"\n Output.write(\"...
python
chosen
[ { "from": "system", "value": "Remove SIDESTICKIES_SCRAPBOX_COOKIE_CONNECT_SID from os.environ after reading\n" }, { "from": "human", "value": "import os\nc.NotebookApp.ip = '*'\nc.NotebookApp.allow_remote_access = True\nc.MultiKernelManager.kernel_manager_class = 'lc_wrapper.LCWrapperKernelManag...
python
chosen
[ { "from": "system", "value": "Update last seen if we found url in our database\n" }, { "from": "human", "value": "# -*- coding: utf-8 -*-\n\"\"\"\n Checks if the given URL was already processed\n\"\"\"\nimport logging\nfrom scrapy.exceptions import IgnoreRequest\nfrom sqlalchemy.orm import se...
python
chosen
[ { "from": "system", "value": "Add SVReg and BDP to import\n" }, { "from": "human", "value": "from .brainsuite import (Bse, Bfc, Pvc, Cerebro, Cortex, Scrubmask, Tca,\n Dewisp, Dfs, Pialmesh, Skullfinder, Hemisplit)\n" }, { "from": "gpt", "value": "from .brains...
python
chosen
[ { "from": "system", "value": "Make it so that the example runs without error\n" }, { "from": "human", "value": "from pupa.scrape import Scraper\nfrom pupa.scrape.helpers import Legislator, Organization\n\n\nclass PersonScraper(Scraper):\n\n def get_people(self):\n # committee\n ...
python
chosen
[ { "from": "system", "value": "Set develop version to 1.1-dev\n" }, { "from": "human", "value": "__version_info__ = (1, 0, 0, None)\n\n\n# Dot-connect all but the last. Last is dash-connected if not None.\n__version__ = '.'.join([str(i) for i in __version_info__[:-1]])\nif __version_info__[-1] is...
python
chosen