conversations
listlengths
2
3
source
stringclasses
1 value
stack
stringclasses
1 value
[ { "from": "system", "value": "Use the correct chesefolder objects\n" }, { "from": "human", "value": "from photofolder import Photofolder\nfrom folder import RealFolder\nfrom gphotocamera import Gphoto\nfrom main import Photobox\nfrom rcswitch import RCSwitch\n\n##########\n# config #\n##########...
python
chosen
[ { "from": "system", "value": "tests: Make printing of floats hopefully more portable.\n" }, { "from": "human", "value": "try:\n import ujson as json\nexcept:\n import json\n\ndef my_print(o):\n if isinstance(o, dict):\n print('sorted dict', sorted(o.items()))\n else:\n ...
python
chosen
[ { "from": "system", "value": "Fix bug with end of line comments which prevent detection of new fold level\n" }, { "from": "human", "value": "\"\"\"\nContains the python code folding mode\n\"\"\"\nfrom pyqode.core.api import IndentFoldDetector, TextBlockHelper, TextHelper\n\n\nclass PythonFoldDet...
python
chosen
[ { "from": "system", "value": "Add in the timestamp for each message, to enable tracking of how long problems take to resolve" }, { "from": "human", "value": "\nimport sys\nimport os\nimport inspect\n\ndef __LINE__ ():\n caller = inspect.stack()[1]\n return int (caller[2])\n \ndef __FUN...
python
chosen
[ { "from": "system", "value": "Fix ImportError in `python -m aspen`\n" }, { "from": "human", "value": "\"\"\"\npython -m aspen\n===============\n\nAspen ships with a server (wsgiref.simple_server) that is\nsuitable for development and testing. It can be invoked via:\n\n python -m aspen\n\ntho...
python
chosen
[ { "from": "system", "value": "Update latest green build migration\n" }, { "from": "human", "value": "\"\"\"add latest green build table\n\nRevision ID: 19b8969073ab\nRevises: 2b7153fe25af\nCreate Date: 2014-07-10 10:53:34.415990\n\n\"\"\"\n\n# revision identifiers, used by Alembic.\nrevision = '...
python
chosen
[ { "from": "system", "value": "Save record in migrations file\n" }, { "from": "human", "value": "# -*- coding: utf-8 -*-\n# Generated by Django 1.11.13 on 2018-05-08 19:56\nfrom __future__ import unicode_literals\nfrom __future__ import absolute_import\n\nfrom django.db import migrations\nfrom co...
python
chosen
[ { "from": "system", "value": "Fix DeprecationWarnings for serializer context\n\n* Pass a context containing a request to every serializer\n\nConflicts:\n\tpages/tests/test_serializers.py\n" }, { "from": "human", "value": "from mock import patch\n\nfrom django.test import TestCase\nfrom rest_fram...
python
chosen
[ { "from": "system", "value": "Include integrator modules for KPP and SMVGEAR\n" }, { "from": "human", "value": "# compatibility with both python 2 and 3\nfrom __future__ import print_function\nfrom . plotting_REDUNDENT import *\nfrom . plotting import *\nfrom . variables import *\nfrom . AC_time...
python
chosen
[ { "from": "system", "value": "Fix ticket bundle revocation order action\n" }, { "from": "human", "value": "\"\"\"\nbyceps.services.shop.order.actions.revoke_ticket_bundles\n~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\n\n:Copyright: 2014-2022 Jochen Kupperschmidt\n:License: Revised B...
python
chosen
[ { "from": "system", "value": "[12.0] Fix migration script 12.0.1.0.0 of partner_firstname\n" }, { "from": "human", "value": "def store_ir_config_param(cr):\n \"\"\"Prior to version 12.0 the default order of partner\n names was last_first. In order to retain this behaviour we\n store th...
python
chosen
[ { "from": "system", "value": "Fix bug with permissions matching\n" }, { "from": "human", "value": "# -*- coding:utf-8 -*-\n#\n# Copyright 2014 Hewlett-Packard Development Company, L.P.\n#\n#    Licensed under the Apache License, Version 2.0 (the \"License\"); you may\n#    not use this file exce...
python
chosen
[ { "from": "system", "value": "Handle missing __cvs_version__.py in a branch.\n" }, { "from": "human", "value": "major = 0\nminor = 3\nmicro = 3\n#release_level = 'alpha'\nrelease_level=''\n\nfrom __cvs_version__ import cvs_version\ncvs_minor = cvs_version[-3]\ncvs_serial = cvs_version[-1]\n\nif ...
python
chosen
[ { "from": "system", "value": "Revert \"BE: Update custom template filter\"\n\nThis reverts commit ea0c0beb1d2aa0d5970b629ac06e6f9b9708bfdd.\n" }, { "from": "human", "value": "import re\nfrom cla_public.apps.base import base\n\n@base.app_template_filter()\ndef matches(value, pattern):\n return...
python
chosen
[ { "from": "system", "value": "Fix transmission task for torrent files\n" }, { "from": "human", "value": "# -*- coding: utf-8 -*-\n\nfrom rpihelper.celery import current_app, celery\nfrom rpihelper.dropboxclient.logic import Client as DropBoxClient\nfrom rpihelper.transmission.logic import (\n ...
python
chosen
[ { "from": "system", "value": "Add player input evaluation, determines hit/miss\n" }, { "from": "human", "value": "import boards\n\ndef main():\n playerDead = False\n enemyDead = False\n \n enemyBoard = boards.makeEnemyBoard()\n enemyLocations = boards.setupEnemyBoard()\n player...
python
chosen
[ { "from": "system", "value": "Add __init__ method to fix parsing\n\nPorted this init method from ubx.py. This has the effect of removing the sentence sub-type from the data list.\r\n\r\nAddresses issue #44" }, { "from": "human", "value": "# Garmin\r\n\r\nfrom ... import nmea\r\n\r\nclass GRM(nme...
python
chosen
[ { "from": "system", "value": "Fix inaccurate docstring for dashboard issue count\n" }, { "from": "human", "value": "from sqlalchemy import func\n\nfrom catwatch.blueprints.user.models import db, User\nfrom catwatch.blueprints.issue.models import Issue\n\n\nclass Dashboard(object):\n @classmet...
python
chosen
[ { "from": "system", "value": "Fix error handling in get_model_field (passthrough).\n" }, { "from": "human", "value": "try:\n from django.db.models.constants import LOOKUP_SEP\nexcept ImportError: # Django < 1.5 fallback\n from django.db.models.sql.constants import LOOKUP_SEP\nfrom django.d...
python
chosen
[ { "from": "system", "value": "Add TODO to capture the fact that design discussion is pending.\n" }, { "from": "human", "value": "from st2common.transport import actionexecution, publishers\n\n__all__ = ['actionexecution', 'publishers']\n" }, { "from": "gpt", "value": "from st2common....
python
chosen
[ { "from": "system", "value": "Remove nom_port from options. This should be infered by the controller name. Add a name member for that. For now, infer the controller from the commandline string'\n" }, { "from": "human", "value": "import itertools\nimport string\n\nclass ControllerConfig(object):\...
python
chosen
[ { "from": "system", "value": "Allow creation of domains without BaseDomain\n\nGives the hook the ability to parse args.\n" }, { "from": "human", "value": "import logging\n\nlogger = logging.getLogger(__name__)\n\n\nfrom aws_helper.connection import ConnectionManager\n\nfrom stacker.util import c...
python
chosen
[ { "from": "system", "value": "Revert \"Reassign a variable following previous commit\"\n\nThis reverts commit 5c963691d3af4cddb0e3090a709110573ac97f6a.\n" }, { "from": "human", "value": "from PyDAQmx.DAQmxFunctions import *\n\ndef getDeviceName():\n\tbuffer = create_string_buffer(1024)\n\t# Buff...
python
chosen
[ { "from": "system", "value": "Update dev branch to 0.16.0b\n" }, { "from": "human", "value": "# This is the only location where the version will be written and changed.\n# Based on https://packaging.python.org/single_source_version/\n__version__ = '0.15.0'\n" }, { "from": "gpt", "val...
python
chosen
[ { "from": "system", "value": "Add signal map and human readable description\n" }, { "from": "human", "value": "#!/usr/bin/env python\n# Copyright Datacratic 2016\n# Author: Jean Raby <jean@datacratic.com>\n\n# This script is called by runsv when the mldb service exits.\n# See http://smarden.org/...
python
chosen
[ { "from": "system", "value": "Order by modified_at create problem with endless_navigation and browser cache\n\nNeed to handle cache properly before\n" }, { "from": "human", "value": "from django.views.generic import TemplateView\n\nfrom chickpea.models import Map\n\n\nclass Home(TemplateView):\n...
python
chosen
[ { "from": "system", "value": "Revert \"Redirect to same page\"\n\nThis reverts commit 1f49ee31c21e1bebefb3be9ecc9e4df7c115a5ef.\n" }, { "from": "human", "value": "# -*- coding: utf-8 -*-\n#\n\nfrom sethji.model.sync import SyncAws\nfrom sethji.views.account import requires_login\nfrom flask impo...
python
chosen
[ { "from": "system", "value": "Add backup and restore functions\n" }, { "from": "human", "value": "import sys\nfrom corvus.client import Corvus\n\ndef main():\n corvus = Corvus()\n corvus.init_drive()\n total_sectors = corvus.get_drive_capacity(1)\n with open(\"image.bin\", \"wb\") as...
python
chosen
[ { "from": "system", "value": "Add 2016 to copyright notice\n" }, { "from": "human", "value": "# -*- coding: utf-8 -*-\n\"\"\"SimPhoNy: Simulation framework for multi-scale phenomena in micro-\n and nanosystems.\n\nSimPhoNy is an EU-project funded by the 7th Framework Programme (Project\n number ...
python
chosen
[ { "from": "system", "value": "Include MetaField in things importable from root\n" }, { "from": "human", "value": "from .query import Q\nfrom .filter import F\nfrom .aggs import A\nfrom .function import SF\nfrom .search import Search\nfrom .field import *\nfrom .document import DocType\nfrom .map...
python
chosen
[ { "from": "system", "value": "Move all api routes into /api/\n" }, { "from": "human", "value": "#!/usr/bin/env python\n\"\"\"\n\nrun.py makes it easy to start Flask's built-in development webserver.\n\nTo start a development server, ensure all the necessary packages are\ninstalled: (I suggest se...
python
chosen
[ { "from": "system", "value": "Rename offer signal to remove unused conditions/benefits\n" }, { "from": "human", "value": "from django.db.models.signals import post_delete\nfrom django.dispatch import receiver\n\nfrom oscar.core.loading import get_model\n\nConditionalOffer = get_model('offer', 'C...
python
chosen
[ { "from": "system", "value": "[IMP] Allow to override any config parameter via config file" }, { "from": "human", "value": "# -*- encoding: utf-8 -*-\n##############################################################################\n#\n# OpenERP, Open Source Management Solution\n# Copyright ...
python
chosen
[ { "from": "system", "value": "Use map for smarter iteration.\n" }, { "from": "human", "value": "def read_file(filename):\n # Open the file\n file_obj = open(filename)\n\n # Iterate over lines in the file\n for line in file_obj:\n\n # Split line by spaces (creates a list)\n ...
python
chosen
[ { "from": "system", "value": "Make submit workflow's local_workflow be False\n" }, { "from": "human", "value": "from flow_workflow.commands.launch_base import LaunchWorkflowCommandBase\nfrom flow.configuration.inject.broker import BrokerConfiguration\nfrom flow.configuration.inject.redis_conf im...
python
chosen
[ { "from": "system", "value": "Add utilities to generate request doubles.\n\nThe new ``get_request`` function is a helper used to generate\nrequest doubles the first argument is the ``method``, an\noptional user can be attached to the request.\n" }, { "from": "human", "value": "from django.core.u...
python
chosen
[ { "from": "system", "value": "Add raw_password to Users in tests\n" }, { "from": "human", "value": "import factory\n\nfrom django.contrib.auth import get_user_model\n\n\nclass UserFactory(factory.DjangoModelFactory):\n FACTORY_FOR = get_user_model()\n name = factory.Sequence(lambda i: 'Tes...
python
chosen
[ { "from": "system", "value": "Fix variable in testcase from previous commit change\n" }, { "from": "human", "value": "#!/usr/bin/env python\n# -*- coding: utf-8 -*-\n\nimport unittest\nfrom nose.tools import raises\n\nfrom spec_cleaner.fileutils import FileUtils\nfrom spec_cleaner import RpmExce...
python
chosen
[ { "from": "system", "value": "Switch WebRTC recipe to Git.\n\nBUG=412012\n\nReview URL: https://codereview.chromium.org/765373002\n\ngit-svn-id: bd64dd6fa6f3f0ed0c0666d1018379882b742947@294546 4ff67af0-8c30-449e-8e8b-ad334ec8d88c\n" }, { "from": "human", "value": "# Copyright (c) 2014 The Chromi...
python
chosen
[ { "from": "system", "value": "Add git sha to version if available\n" }, { "from": "human", "value": "\"\"\"\nraven\n~~~~~\n\n:copyright: (c) 2010-2012 by the Sentry Team, see AUTHORS for more details.\n:license: BSD, see LICENSE for more details.\n\"\"\"\n\n__all__ = ('VERSION', 'Client', 'load'...
python
chosen
[ { "from": "system", "value": "Fix a bug where periodic timers weren't removed when application was stopped.\nFIXME: Check up on the semantics of will/did_start, will_migrate, did_migrate, will_stop.\n" }, { "from": "human", "value": "# -*- coding: utf-8 -*-\n\n# Copyright (c) 2015 Ericsson AB\n#...
python
chosen
[ { "from": "system", "value": "Set logging level to INFO\n" }, { "from": "human", "value": "import logging\nfrom time import time, sleep\n\nfrom .net_utils import *\n\nlogger = logging.getLogger(__name__)\n\ndef target_scaner(interface, min_interval=30):\n old_peers = {}\n while True:\n ...
python
chosen
[ { "from": "system", "value": "Use logger for hades-generate-config error messages\n" }, { "from": "human", "value": "import os\nimport sys\n\nfrom hades import constants\nfrom hades.common.cli import ArgumentParser, parser as common_parser\nfrom hades.config.generate import ConfigGenerator\nfrom...
python
chosen
[ { "from": "system", "value": "Update console link, intent-->task in comments" }, { "from": "human", "value": "# Download the helper library from https://www.twilio.com/docs/python/install\nfrom twilio.rest import Client\n\n# Your Account Sid and Auth Token from twilio.com/console\naccount_sid = ...
python
chosen
[ { "from": "system", "value": "Fix error in delta_minutes, use timedelta.total_seconds()/60 instead of timedelta.seconds/60.\n" }, { "from": "human", "value": "from __future__ import unicode_literals\nfrom config import settings\n\nimport os\nimport re\nimport string\nimport pytz\n\n\ndef clear_s...
python
chosen
[ { "from": "system", "value": "Add Info to Weather Check\n\nAdd current weather status to weather check features.\n" }, { "from": "human", "value": "from configparser import ConfigParser\nfrom googletrans import Translator\nimport pyowm\nimport logging\nimport re\n\nlogging.basicConfig(format='%(...
python
chosen
[ { "from": "system", "value": "Add usage comment and remove python version\n" }, { "from": "human", "value": "import schedule, time, os, sys, urllib2, base64\nfrom datetime import datetime\ndef check_connection():\n\tsys.stdout.write(datetime.now().strftime(\"%Y-%m-%d %H:%M:%S\") + \" Connection\...
python
chosen
[ { "from": "system", "value": "Add new URL for NDEx service\n" }, { "from": "human", "value": "import requests\nimport json\nimport time\n\n#ndex_base_url = 'http://services.bigmech.ndexbio.org'\nndex_base_url = 'http://52.37.175.128'\n\ndef send_request(url_suffix, params):\n res = requests.p...
python
chosen
[ { "from": "system", "value": "Refactor - Simplify the call to api\n" }, { "from": "human", "value": "# Copyright (C) 2015 The Software Heritage developers\n# See the AUTHORS file at the top-level directory of this distribution\n# License: GNU General Public License version 3, or any later versi...
python
chosen
[ { "from": "system", "value": "Support for django 1.9 and beyond!" }, { "from": "human", "value": "import django\n\nif django.get_version().startswith(\"1.8\"):\n from django_makemessages_xgettext import django18_makemessagesxgettext\n Command = django18_makemessagesxgettext.Command\n\nelse...
python
chosen
[ { "from": "system", "value": "Return serializable string from base64encode.\n" }, { "from": "human", "value": "from __future__ import print_function\nimport sys\nimport hashlib\nimport base64\n\ndef print_error(*args, **kwargs):\n print(*args, file=sys.stderr, **kwargs)\n\ndef to_unicode(cont...
python
chosen
[ { "from": "system", "value": "Support generating a completely absolute URL for the profile; added a\ndisplay_name method to the Profile model.\n" }, { "from": "human", "value": "from django.db import models\nfrom django.db.models import permalink\nfrom django.contrib.auth.models import User\n\nc...
python
chosen
[ { "from": "system", "value": "Change constructor of Vehicle to accept an Interface instead of just Source.\n" }, { "from": "human", "value": "from .measurements import Measurement\nfrom .sinks.base import MeasurementNotifierSink\n\nclass Vehicle(object):\n\n def __init__(self, source=None):\n...
python
chosen
[ { "from": "system", "value": "Send RSVP email even if PDF doesn't exist\n\nIf the PDF can't be found on the disk after the maximum number of\nretries, return None, instead of raising an exception. This ensures that\nthe RSVP email notification still sends even without the PDF attachment.\n\nRefs #1655\n" ...
python
chosen
[ { "from": "system", "value": "Allow ecdsa 384 bit keys too\n" }, { "from": "human", "value": "from django.db import models\n\nKEYTYPE_CHOICES = (\n ('RSA', 'ssh-rsa'),\n ('DSA', 'ssh-dsa'),\n ('ECC-256', 'ecdsa-sha2-nistp256'),\n ('ECC-521', 'ecdsa-sha2-nistp521'),\n)\n\nclass Node(m...
python
chosen
[ { "from": "system", "value": "Use filter macro for request validation\n\nStringifiedTrytesArray(Type) filter macro was\nintroduced in #243. Becasue of this, no request\nfilter test case is needed, hence the macro is\ncovered already in other test cases.\n" }, { "from": "human", "value": "# codin...
python
chosen
[ { "from": "system", "value": "Fix \"record does not exist\" when validating move line\n\nWhen _action_done is called on a transfer, it may delete a part of\nthe move lines. The extension of `_action_done()` that assigns\na packaging fails with \"Record does not exist or has been deleted\".\n\nCheck if the i...
python
chosen
[ { "from": "system", "value": "Revert \"changes to config during runtime are now saved\"\n\nThis reverts commit e09a780da17bb2f97d20aafc2c007fe3fc3051bb.\n" }, { "from": "human", "value": "# -*- coding: utf-8 -*-\n\n#script containing all pertinent tasks to prepare for software termination.\n#suc...
python
chosen
[ { "from": "system", "value": "Set up version 0.3.0 dev 1.\n" }, { "from": "human", "value": "\"\"\"\nNeuPy is the Artificial Neural Network library implemented in Python.\n\"\"\"\n\n\n__version__ = '0.2.2'\n" }, { "from": "gpt", "value": "\"\"\"\nNeuPy is the Artificial Neural Networ...
python
chosen
[ { "from": "system", "value": "Change the rules for infix coordinario\n" }, { "from": "human", "value": "__author__ = 's7a'\n\n# All imports\nfrom nltk.tree import Tree\n\n\n# The infix coordination class\nclass InfixCoordination:\n\n # Constructor for the infix coordination\n def __init__(...
python
chosen
[ { "from": "system", "value": "Delete *.pyc files from dials/extensions when doing libtbx.refresh" }, { "from": "human", "value": "from __future__ import division\n\ndef run():\n from dials.util.config import CompletionGenerator\n gen = CompletionGenerator()\n gen.generate()\n\ntry:\n run()\n...
python
chosen
[ { "from": "system", "value": "Move import statement on top for PEP8 compliancy.\n" }, { "from": "human", "value": "try:\n import hiredis\n HIREDIS_AVAILABLE = True\nexcept ImportError:\n HIREDIS_AVAILABLE = False\n\n\ndef from_url(url, db=None, **kwargs):\n \"\"\"\n Returns an act...
python
chosen
[ { "from": "system", "value": "Copy enumeration literals when pasting an Enumeration\n\nSigned-off-by: Dan Yeaw <2591e5f46f28d303f9dc027d475a5c60d8dea17a@yeaw.me>\n" }, { "from": "human", "value": "import itertools\n\nfrom gaphor.diagram.copypaste import copy, copy_named_element\nfrom gaphor.UML ...
python
chosen
[ { "from": "system", "value": "Add delete_min() and its helper func’s\n" }, { "from": "human", "value": "from __future__ import absolute_import\nfrom __future__ import division\nfrom __future__ import print_function\n\nclass BinaryHeap(object):\n def __init__(self):\n # Put single zero ...
python
chosen
[ { "from": "system", "value": "Revert to previous packaging of director's dependencies thx to @mvollrath\n" }, { "from": "human", "value": "#!/usr/bin/env python\n\nfrom distutils.core import setup\nfrom catkin_pkg.packages import find_packages\nfrom catkin_pkg.python_setup import generate_distut...
python
chosen
[ { "from": "system", "value": "Use a lambda to add a time delay function onto the mocked run method\n" }, { "from": "human", "value": "import time\nimport datetime\nimport unittest\nfrom unittest.mock import patch, call\n\nfrom billybot.billybot import MessageTriage\n\n\nclass TestMessageTriage(u...
python
chosen
[ { "from": "system", "value": "Fix migration history bug introduced with merge\n" }, { "from": "human", "value": "\"\"\"Add compound index to Contact and Event\n\nRevision ID: 1fd7b3e0b662\nRevises: 5305d4ae30b4\nCreate Date: 2015-02-17 18:11:30.726188\n\n\"\"\"\n\n# revision identifiers, used by...
python
chosen
[ { "from": "system", "value": "Make GenomeNetBase a SuccessFailureNet again\n" }, { "from": "human", "value": "from flow.petri_net.future_net import FutureNet\nfrom flow.petri_net.success_failure_net import SuccessFailureNet\n\n\nclass SimplifiedSuccessFailureNet(FutureNet):\n def __init__(sel...
python
chosen
[ { "from": "system", "value": "Clean up brew house yield calculator to deal with DME and LME additions\n" }, { "from": "human", "value": "# -*- coding: utf-8 -*-\n\nfrom .sugar import sg_to_gu\n\n__all__ = [\n u'calculate_brew_house_yield',\n]\n\n\ndef calculate_brew_house_yield(wort_volume, s...
python
chosen
[ { "from": "system", "value": "Use new resolver in LexicalID resolution\n" }, { "from": "human", "value": "from thinglang.utils.type_descriptors import ValueType\nfrom thinglang.lexer.symbols import LexicalSymbol\n\n\nclass LexicalQuote(LexicalSymbol): # \"\n EMITTABLE = False\n\n @classme...
python
chosen
[ { "from": "system", "value": "Move import at the top of module.\n" }, { "from": "human", "value": "import os\nfrom distutils.core import Command\nfrom numpy.distutils.misc_util import get_cmd\n\nclass install_clib(Command):\n description = \"Command to install installable C libraries\"\n\n ...
python
chosen
[ { "from": "system", "value": "Complete migration from conditional to arithmetic operation\n" }, { "from": "human", "value": "from thinglang.lexer.symbols.logic import LexicalEquality\nfrom thinglang.parser.tokens import BaseToken\n\n\nclass Conditional(BaseToken):\n\n ADVANCE = False\n COM...
python
chosen
[ { "from": "system", "value": "Update .py list-binding API snippet with 'new user' tag\n" }, { "from": "human", "value": "# NOTE: This example uses the next generation Twilio helper library - for more\n# information on how to download and install this version, visit\n# https://www.twilio.com/docs...
python
chosen
[ { "from": "system", "value": "Add test for mp3, ogg and flac support in gstreamer backend\n" }, { "from": "human", "value": "import unittest\nimport os\n\nfrom mopidy.models import Playlist, Track\nfrom mopidy.backends.gstreamer import GStreamerBackend\n\nfrom tests.backends.base import (BasePla...
python
chosen
[ { "from": "system", "value": "Add \"done\" tracking for fanout test.\n" }, { "from": "human", "value": "import uuid\n\nimport diesel\n\nfrom diesel.util.queue import Fanout\n\nclass FanoutHarness(object):\n def setup(self):\n self.fan = Fanout()\n self.subscriber_data = {}\n ...
python
chosen
[ { "from": "system", "value": "Remove extra inlines from django-taggit" }, { "from": "human", "value": "from django.contrib import admin\n\nfrom taggit.models import Tag, TaggedItem\n\n\nclass TaggedItemInline(admin.StackedInline):\n model = TaggedItem\n\nclass TagAdmin(admin.ModelAdmin):\n ...
python
chosen
[ { "from": "system", "value": "Add pair list formatting test\n" }, { "from": "human", "value": "import pytest\nfrom mappyfile.pprint import PrettyPrinter\n\ndef test_print_map():\n mf = {}\n pp = PrettyPrinter() # expected\n txt = pp.pprint(mf)\n assert(expected == txt)\n\ndef run_tes...
python
chosen
[ { "from": "system", "value": "Fix get_credentials so it returns a dict.\n" }, { "from": "human", "value": "# -*- coding: utf-8 -*-\n#\n# © 2011 SimpleGeo, Inc. All rights reserved.\n# Author: Paul Lathrop <paul@simplegeo.com>\n#\n\n\"\"\"Utility functions for AWS-related tasks.\"\"\"\n\nfrom get...
python
chosen
[ { "from": "system", "value": "Include participant in outgoing ack\n" }, { "from": "human", "value": "from yowsup.structs import ProtocolEntity, ProtocolTreeNode\nfrom .ack import AckProtocolEntity\nclass OutgoingAckProtocolEntity(AckProtocolEntity):\n\n '''\n <ack type=\"{{delivery | read}...
python
chosen
[ { "from": "system", "value": "Use absolute path for app import\n" }, { "from": "human", "value": "#!/usr/bin/env python\n# -*- coding: utf-8 -*-\n\nimport os\nos.environ[\"KIVY_NO_ARGS\"] = \"1\"\n\nimport click\n\nfrom {{cookiecutter.repo_name}} import {{cookiecutter.app_class_name}}\n\n\n@clic...
python
chosen
[ { "from": "system", "value": "Change character coding and a comment.\n" }, { "from": "human", "value": "#! /usr/bin/env python\n\n\n#\n# Show the USB camera\n#\n\n\n#\n# External dependencies\n#\nimport sys\nfrom PySide import QtGui\nimport VisionToolkit as vtk\n\n\n#\n# Main application\n#\nif ...
python
chosen
[ { "from": "system", "value": "Add main script to CSR simulations\n" }, { "from": "human", "value": "import random\nimport itertools as it\nfrom sklearn.externals import joblib\n\ndef simulate_loads(nfrag, ngt, q):\n loads = [1] * nfrag\n active = set(range(nfrag))\n for k in range(1, le...
python
chosen
[ { "from": "system", "value": "Change class name in tests\n" }, { "from": "human", "value": "# Licensed under an MIT open source license - see LICENSE\n\n\n'''\nTest function for Wavelet\n'''\n\nfrom unittest import TestCase\n\nimport numpy as np\nimport numpy.testing as npt\n\nfrom ..statistics ...
python
chosen
[ { "from": "system", "value": "Add Cert+PK generation to Certificate Interface\n\nChange-Id: I82aa573c7db13c7a491b18540379b234c1023eb9\n" }, { "from": "human", "value": "# Copyright (c) 2014 Rackspace US, Inc\n# All Rights Reserved.\n#\n# Licensed under the Apache License, Version 2.0 (the \"L...
python
chosen
[ { "from": "system", "value": "Revert \"Reimplement using explicit variable lookup\"\n\nThis reverts commit 94683e6c\n" }, { "from": "human", "value": "from simplekeys.verifier import verify_request\nfrom graphene_django.views import GraphQLView\nfrom django.conf import settings\n\n\nclass KeyedG...
python
chosen
[ { "from": "system", "value": "Add the msisdn provider test\n" }, { "from": "human", "value": "# coding=utf-8\n\nfrom __future__ import unicode_literals\n\nimport unittest\n\nfrom faker import Factory\nfrom .. import string_types\n\n\nclass TestJaJP(unittest.TestCase):\n \"\"\" Tests phone_num...
python
chosen
[ { "from": "system", "value": "Add a test for skip functionality\n" }, { "from": "human", "value": "import os\n\nfrom isort.pylama_isort import Linter\n\n\nclass TestLinter:\n instance = Linter()\n\n def test_allow(self):\n assert not self.instance.allow(\"test_case.pyc\")\n a...
python
chosen
[ { "from": "system", "value": "Fix version import during pip install\n" }, { "from": "human", "value": "__version__ = \"0.9\"\n\ndefault_app_config = 'channels.apps.ChannelsConfig'\nDEFAULT_CHANNEL_LAYER = 'default'\n\nfrom .asgi import channel_layers # NOQA isort:skip\nfrom .channel import Chan...
python
chosen
[ { "from": "system", "value": "Update export building fires script.\n" }, { "from": "human", "value": "from django.core.management.base import BaseCommand\nfrom firecares.firestation.models import FireDepartment\n\n\nclass Command(BaseCommand):\n \"\"\"\n This command is used to export data...
python
chosen
[ { "from": "system", "value": "Set poll_on_creation to False for run_job\n" }, { "from": "human", "value": "from civis import APIClient\nfrom civis.futures import CivisFuture\n\n\ndef run_job(job_id, api_key=None):\n \"\"\"Run a job.\n\n Parameters\n ----------\n job_id : str or int\n...
python
chosen
[ { "from": "system", "value": "Update docstring for IsSameUserOrAdmin permission.\n" }, { "from": "human", "value": "from rest_framework import permissions\n\n\nclass IsSameUserOrAdmin(permissions.BasePermission):\n \"\"\"\n Custom permissions to only allow same user or admins to view user ...
python
chosen
[ { "from": "system", "value": "Fix Flake8 error in migration.\n" }, { "from": "human", "value": "# -*- coding: utf-8 -*-\n# Generated by Django 1.11.13 on 2018-08-24 14:55\nfrom __future__ import unicode_literals\n\nfrom django.db import migrations, models\nimport ec2spotmanager.models\n\n\nclass...
python
chosen
[ { "from": "system", "value": "Revert \"migrations: Replace special chars in stream & user names with space.\"\n\nThis reverts commit acebd3a5e, as well as a subsequent fixup commit\n0975bebac \"quick fix: Fix migrations to be linear.\"\n\nThese changes need more work and thought before they're ready to\ndep...
python
chosen
[ { "from": "system", "value": "Revert \"Revert \"Revert \"do not use minified js on prod\"\"\"\n\nThis reverts commit c7d03f4f8d4d50ce837cf0df446a52b24e891cee.\n" }, { "from": "human", "value": "import os\n\nfrom rmc.config.flask_base import *\nimport rmc.shared.secrets as s\n\nJS_DIR = 'js'\nDEB...
python
chosen
[ { "from": "system", "value": "Rename variables to less haze-specific alternatives\n\n\n20070831150511-4210b-48ed5b3cc7b1f15f42885c043a1b9678257902a7.gz\n" }, { "from": "human", "value": "#!/usr/bin/python\nimport sys\nimport telepathy\nfrom telepathy.interfaces import CONN_MGR_INTERFACE\n\nif le...
python
chosen
[ { "from": "system", "value": "Fix db migration for tree model\n" }, { "from": "human", "value": "# Copyright (c) 2016 Cisco Systems\n# All Rights Reserved.\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\"); you may\n# not use this file except in compliance with the Lic...
python
chosen
[ { "from": "system", "value": "Change error status with config problems to critical\n" }, { "from": "human", "value": "# -*- coding: utf-8 -*-\n\n\"\"\"\n@author: Seva Zhidkov\n@contact: zhidkovseva@gmail.com\n@license: The MIT license\n\nCopyright (C) 2015\n\"\"\"\n\nfrom sheldon.adapter import ...
python
chosen
[ { "from": "system", "value": "Remove colon from title for RT search\n" }, { "from": "human", "value": "import requests\n\nfrom bs4 import BeautifulSoup\nfrom source.models.rt_rating import RTRating\n\n\nclass RottenTomatoesService:\n\n __URL = 'http://www.rottentomatoes.com/m/'\n __SEPERAT...
python
chosen
[ { "from": "system", "value": "Use django utils force_bytes to arguments of hashlib\n" }, { "from": "human", "value": "#-*- coding: utf-8 -*-\n\n\nimport hashlib\n\nfrom django.utils.http import urlencode, urlquote\n\nfrom .. import register\n\n\n@register.simple_tag()\ndef get_gravatar_url(user,...
python
chosen
[ { "from": "system", "value": "Fix bug, set notify_email to always after create portal user\n\n" }, { "from": "human", "value": "# -*- coding: utf-8 -*-\n##############################################################################\n#\n# Copyright (C) 2016 Compassion CH (http://www.compassion...
python
chosen