conversations
listlengths
2
3
source
stringclasses
1 value
stack
stringclasses
1 value
[ { "from": "system", "value": "Use IndicesClient to get full URL\n" }, { "from": "human", "value": "from django.core.management import BaseCommand\n\nfrom corehq.apps.cleanup.utils import confirm_destructive_operation\nfrom corehq.elastic import get_es_new\n\n\nclass Command(BaseCommand):\n \"...
python
chosen
[ { "from": "system", "value": "Reduce pulls initial from args\n" }, { "from": "human", "value": "import logging\n\nfrom aque.utils import decode_callable\n\n\nlog = logging.getLogger(__name__)\n\n\ndef reduce_children(job):\n\n func = decode_callable(job.get('func'))\n sequence = [child.res...
python
chosen
[ { "from": "system", "value": "Update dev version to 1.10\n" }, { "from": "human", "value": "# file findingaids/__init__.py\n#\n# Copyright 2012 Emory University Library\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may not use this file except in compliance...
python
chosen
[ { "from": "system", "value": "Correct the path to the sqlite db on vagrant\n" }, { "from": "human", "value": "SQLALCHEMY_DATABASE_URI = 'sqlite:///srv/pwm-server/db.sqlite'\n" }, { "from": "gpt", "value": "SQLALCHEMY_DATABASE_URI = 'sqlite:////srv/pwm-server/db.sqlite'\n" } ]
python
chosen
[ { "from": "system", "value": "Remove implicit import of symbols\n\nCurrently, using libclient for python requires selecting the target node type (MN or CN) and the target DataONE API version, by specifying the appropriate client, so it better to use the library by explicitly importing only the needed client...
python
chosen
[ { "from": "system", "value": "Use os.path.join instead of string concatenation.\n\nUse `join` in order to create path intelligently on all operating\nsystems. See: http://docs.python.org/2/library/os.path.html#os.path.join\n" }, { "from": "human", "value": "# -*- coding: utf-8 -*-\nfrom nose.too...
python
chosen
[ { "from": "system", "value": "Change publisher and subscriber message type from Odometry to Twist\n\n" }, { "from": "human", "value": "#!/usr/bin/env python\nimport rospy\nfrom nav_msgs.msg import Odometry\n\npublisher = None\n\ndef send_computed_control_actions(msg):\n publisher.publish(msg)...
python
chosen
[ { "from": "system", "value": "Use re instead of regex.\nDon't rewrite the file in place.\n(Reported by Andy Dustman.)\n" }, { "from": "human", "value": "#! /usr/bin/env python\n\n# Fix Python script(s) to reference the interpreter via /usr/bin/env python.\n\nimport sys\nimport regex\nimport regs...
python
chosen
[ { "from": "system", "value": "Implement Darkshire Librarian, Darkshire Councilman, Possessed Villager\n" }, { "from": "human", "value": "from ..utils import *\n\n\n##\n# Minions\n\nclass OG_121:\n\t\"Cho'gall\"\n\tplay = Buff(CONTROLLER, \"OG_121e\")\n\nclass OG_121e:\n\tevents = OWN_SPELL_PLAY....
python
chosen
[ { "from": "system", "value": "Remove redundant parts of User class.\n" }, { "from": "human", "value": "from flask_login import UserMixin\n\n\nclass User(UserMixin):\n # proxy for a database of users\n user_database = {\"test\": (\"slot\", \"test\"), \"live\": (\"slot\", \"live\")}\n\n d...
python
chosen
[ { "from": "system", "value": "Fix to iterate over dictionary using items instead of iteritems to make it compatible with python3.x.\n" }, { "from": "human", "value": "# -*- coding: utf-8 -*-\n\nfrom django.conf import settings\n\n__all__ = (\n 'settings',\n)\n\n\ndefault_settings = {\n 'SL...
python
chosen
[ { "from": "system", "value": "Revert install requre optimization in python wrapper.\n" }, { "from": "human", "value": "from distutils.core import setup\n\nsetup(\n name='python3-indy',\n version='0.0.1',\n packages=['indy'],\n url='https://github.com/hyperledger/indy-sdk',\n licen...
python
chosen
[ { "from": "system", "value": "Add a sample of erroneous test.\n" }, { "from": "human", "value": "# -*- encoding: utf-8 -*-\n\"\"\"\n\n\"\"\"\n\nimport unittest\nimport time\n\nclass Case1(unittest.TestCase):\n\n def test_success(self):\n time.sleep(0.5)\n self.assertEqual(1, 1)\...
python
chosen
[ { "from": "system", "value": "Use bytes property with UUID objects\n" }, { "from": "human", "value": "import uuid\nimport hashlib\n\n\ndef short_hash():\n \"\"\"\n Generate a unique short hash (40 bytes) which is suitable as a token, secret or id\n \"\"\"\n return hashlib.sha1(uuid.u...
python
chosen
[ { "from": "system", "value": "Create test articles via service\n" }, { "from": "human", "value": "\"\"\"\n:Copyright: 2006-2020 Jochen Kupperschmidt\n:License: Modified BSD, see LICENSE for details.\n\"\"\"\n\nfrom testfixtures.shop_article import create_article\nfrom testfixtures.shop_shop impo...
python
chosen
[ { "from": "system", "value": "Add iatistandard.org homepage test for the newsletter signup\n" }, { "from": "human", "value": "from web_test_base import *\n\nclass TestIATIStandard(WebTestBase):\n \"\"\"\n TODO: Add tests to assert that:\n - the number of activities and publishers roughl...
python
chosen
[ { "from": "system", "value": "Include orders which are made during selected end date in reports\n\nComparing DateTimeField with date causes lack of precision which\ncan occur with range. This causes orders which order_date is\nthe same date than end_date will be not included in the queryset.\nFix this probl...
python
chosen
[ { "from": "system", "value": "Exclude persistent images in list\n" }, { "from": "human", "value": "#!/bin/python3\n\nimport os\nimport xml.etree.ElementTree as ET\n\noneimage = os.popen(\"oneimage list --xml\")\n\ntree = ET.fromstring(oneimage.read())\n\n#print(tree.tag)\n\nfor image in tree.fin...
python
chosen
[ { "from": "system", "value": "Check python version and possibly only import some things\n" }, { "from": "human", "value": "\n\n########################################################################\n# #\n# This script was wri...
python
chosen
[ { "from": "system", "value": "Bump version to fix previous bad version\n" }, { "from": "human", "value": "from .pool import create_pool\nfrom .pgsingleton import PG\nfrom .connection import compile_query\n\n__version__ = '0.11.0'\npg = PG()\n\n" }, { "from": "gpt", "value": "from .po...
python
chosen
[ { "from": "system", "value": "Disable powershell modules list\nAdd list_kbs function\n" }, { "from": "human", "value": "# -*- coding: utf-8 -*-\n'''\nMicrosoft Update files management via wusa.exe\n\n:maintainer: Thomas Lemarchand\n:platform: Windows\n:depends: PowerShell\n\n'''\n\...
python
chosen
[ { "from": "system", "value": "Add the GitHub-supported format extensions.\n" }, { "from": "human", "value": "# The supported extensions, as defined by https://github.com/github/markup\nsupported_extensions = ['.md', '.markdown']\n\n# The default filenames when no file is provided\ndefault_filena...
python
chosen
[ { "from": "system", "value": "Create a broadcast api: send\n" }, { "from": "human", "value": "from flask import Flask, render_template\nfrom flask_socketio import SocketIO, send, emit\napp = Flask(__name__, template_folder='./templates')\n\n# Websocket setting\napp.config['SECRET_KEY'] = '12qwas...
python
chosen
[ { "from": "system", "value": "CLOUDSTACK-9266: Make deleting static routes in private gw work\n" }, { "from": "human", "value": "# -- coding: utf-8 --\n# Licensed to the Apache Software Foundation (ASF) under one\n# or more contributor license agreements. See the NOTICE file\n# distributed with...
python
chosen
[ { "from": "system", "value": "Add image prefix for job settings\n" }, { "from": "human", "value": "#!/usr/bin/env python\n\nimport time\nimport picamera\nfrom settings import Job, IMAGES_DIRECTORY\n\n\ndef main():\n job = Job()\n if job.exists():\n resolution_x = job.image_settings....
python
chosen
[ { "from": "system", "value": "Make search term lower case so capitals match.\n" }, { "from": "human", "value": "import json\n\nfrom django.http import HttpResponse\nfrom django.core.urlresolvers import reverse\nfrom django.utils.html import conditional_escape as escape\n\nfrom .models import Sea...
python
chosen
[ { "from": "system", "value": "Fix event monitors app config\n" }, { "from": "human", "value": "from django.apps import AppConfig\n\n\nclass EventsConfig(AppConfig):\n name = 'event_monitors'\n verbose_name = 'EventMonitors'\n" }, { "from": "gpt", "value": "from django.apps impo...
python
chosen
[ { "from": "system", "value": "Set master version to 'master'\n" }, { "from": "human", "value": "\"\"\"A simple GTFS library.\n\nThis package is used internally to read and process GTFS files and to create OnestopIds.\n\n\"\"\"\n\n__version__ = '0.10.3'" }, { "from": "gpt", "value": "...
python
chosen
[ { "from": "system", "value": "Update 0.9 from alpha to beta\n" }, { "from": "human", "value": "from __future__ import absolute_import\nfrom __future__ import print_function\nfrom __future__ import unicode_literals\n\nfrom .utils.version import get_version\n\n#: This may not be the exact version ...
python
chosen
[ { "from": "system", "value": "docs: Update example, no need to disable cert validation.\n" }, { "from": "human", "value": "import os\n\nfrom IPython.terminal.embed import InteractiveShellEmbed\n\nfrom libcloud.compute.types import Provider\nfrom libcloud.compute.providers import get_driver\nimpo...
python
chosen
[ { "from": "system", "value": "Make the sample work by retrieving all contacts.\n" }, { "from": "human", "value": "import requests\nfrom apiclient.discovery import build\n\n\nfrom lino.api import rt\n\nuser = rt.models.users.User.objects.get(username='luc')\nsocial = user.social_auth.get(provider...
python
chosen
[ { "from": "system", "value": "Define the DSN const in a central location\n" }, { "from": "human", "value": "__author__ = 'moshebasanchig'\n\nfrom hydro.connectors.base_classes import DBBaseConnector\nimport pyodbc\nfrom hydro.exceptions import HydroException\n\nDSN = 'dsn'\n\n\nclass VerticaConn...
python
chosen
[ { "from": "system", "value": "Fix broken reference to ParseSentenceDefinitionTest.\n" }, { "from": "human", "value": "#!/usr/bin/env python\n# -*- coding: utf-8 -*-\n\nimport unittest\n\nfrom ParseArticleReferenceTest import ParseArticleReferenceTest\nfrom SortReferencesVisitorTest import SortRe...
python
chosen
[ { "from": "system", "value": "Handle multiple receiver domain properly\n" }, { "from": "human", "value": "import datetime\nimport smtpd\nfrom email.parser import Parser\nfrom mailchute import db\nfrom mailchute import settings\nfrom mailchute.model import RawMessage, IncomingEmail\nfrom logbook ...
python
chosen
[ { "from": "system", "value": "fix: Test fix. rebase_addr to mapped_base\n" }, { "from": "human", "value": "import angr\nimport os\nimport nose\n\ntest_location = str(os.path.join(os.path.dirname(os.path.realpath(__file__)),\n '../../binaries/tests'))\nbinpath = os...
python
chosen
[ { "from": "system", "value": "Print gin config includes and imports when starting training.\n\nPiperOrigin-RevId: 342367820\n" }, { "from": "human", "value": "# coding=utf-8\n# Copyright 2020 The Tensor2Robot Authors.\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you...
python
chosen
[ { "from": "system", "value": "Fix environment.validate() being called without branch name.\n" }, { "from": "human", "value": "#!/usr/bin/python\n\n# The MIT License (MIT)\n#\n# Copyright (c) 2013 CFEngine AS\n#\n# Permission is hereby granted, free of charge, to any person obtaining a copy\n# of...
python
chosen
[ { "from": "system", "value": "Add message if you're using default settings\n" }, { "from": "human", "value": "# Copyright 2014 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 c...
python
chosen
[ { "from": "system", "value": "Raise validation error if spec is in local run mode\n" }, { "from": "human", "value": "# -*- coding: utf-8 -*-\nfrom __future__ import absolute_import, division, print_function\n\nfrom django.core.exceptions import ValidationError\nfrom polyaxon_schemas.exceptions i...
python
chosen
[ { "from": "system", "value": "Change database init script for daemon tests\n" }, { "from": "human", "value": "# Licensed to the Apache Software Foundation (ASF) under one\n# or more contributor license agreements. See the NOTICE file\n# distributed with this work for additional information\n...
python
chosen
[ { "from": "system", "value": "Fix output of skipped tests.\n" }, { "from": "human", "value": "import unittest\nimport operator\nimport itertools\n\nclass NotImplementedByController(unittest.SkipTest, NotImplementedError):\n def __str__(self):\n return 'Not implemented by controller: {}...
python
chosen
[ { "from": "system", "value": "Fix an import error. pylons.config doesn't exist anymore, use pylons.configuration\n" }, { "from": "human", "value": "\"\"\"Base objects to be exported for use in Controllers\"\"\"\nfrom paste.registry import StackedObjectProxy\n\nfrom pylons.config import config\n\...
python
chosen
[ { "from": "system", "value": "Use bot.latency for ping time\n" }, { "from": "human", "value": "import time\n\nfrom discord.ext import commands\n\n\nclass Default:\n @commands.command(aliases=['p'])\n async def ping(self, ctx):\n \"\"\"Get the ping to the websocket.\"\"\"\n ms...
python
chosen
[ { "from": "system", "value": "Ch07: Revert TagForm Meta fields option.\n" }, { "from": "human", "value": "from django import forms\nfrom django.core.exceptions import ValidationError\n\nfrom .models import Tag\n\n\nclass TagForm(forms.ModelForm):\n class Meta:\n model = Tag\n ex...
python
chosen
[ { "from": "system", "value": "Reformat cmd to go under 120 character limit" }, { "from": "human", "value": "from SublimeLinter.lint import Linter, util\n\n\nclass Cppcheck(Linter):\n cmd = ('cppcheck', '--template={file}:{line}: {severity}: {message}', '--inline-suppr', '--quiet', '${args}', ...
python
chosen
[ { "from": "system", "value": "Add support for RubyNext and RubyExperimental" }, { "from": "human", "value": "#\n# linter.py\n# Linter for SublimeLinter3, a code checking framework for Sublime Text 3\n#\n# Written by Aparajita Fishman\n# Contributors: Francis Gulotta, Josh Hagins\n# Copyright (c)...
python
chosen
[ { "from": "system", "value": "Update to handle users with no final grade\n" }, { "from": "human", "value": "'''\nThis module will retrieve info about students registered in the course\n\nUsage:\n\npython user_info.py\n\n'''\n\nfrom collections import defaultdict\n\nfrom base_edx import EdXConnec...
python
chosen
[ { "from": "system", "value": "Remove self-touching tets first to reduce collision load.\n" }, { "from": "human", "value": "import igraph\n\ndef packing_graph(tets, vx, vy, vz, independent = 0):\n N = len(tets)\n g = igraph.Graph()\n g.add_vertices(N)\n for i in range(N):\n for...
python
chosen
[ { "from": "system", "value": "Set initial mode to lobby.\n" }, { "from": "human", "value": "from twisted.cred import portal\nfrom twisted.conch.checkers import SSHPublicKeyDatabase\n\nfrom carapace.util import ssh as util\n\nfrom peloid.app import mud\nfrom peloid.app.shell import gameshell, set...
python
chosen
[ { "from": "system", "value": "Check if mt is None before spliting it\n" }, { "from": "human", "value": "# -*- coding: utf-8 -*-\n# Generated by Django 1.11.14 on 2020-02-28 17:30\nfrom __future__ import unicode_literals\n\n\nfrom django.db import migrations\nimport mimetypes\n\n\ndef forward(app...
python
chosen
[ { "from": "system", "value": "Read from local environment file if available" }, { "from": "human", "value": "#!/usr/bin/env python\nimport os\nimport sys\n\nif __name__ == \"__main__\":\n os.environ.setdefault(\"DJANGO_SETTINGS_MODULE\", \"feed_to_kippt.settings\")\n\n from django.core.man...
python
chosen
[ { "from": "system", "value": "Correct `Builder.__call__` parameters when called by the `Simulator`\n" }, { "from": "human", "value": "import sys\n\nfrom pacman103.core import control\nfrom pacman103 import conf\n\nfrom . import builder\n\n\nclass Simulator(object):\n def __init__(self, model,...
python
chosen
[ { "from": "system", "value": "Add comment_required to category simple serializer\n" }, { "from": "human", "value": "from .models import Category, Keyword, Subcategory\r\nfrom rest_framework import serializers\r\n\r\n\r\nclass KeywordSerializer(serializers.ModelSerializer):\r\n class Meta:\r\n...
python
chosen
[ { "from": "system", "value": "Fix bug in exception handling\n" }, { "from": "human", "value": "from django.utils.translation import get_language\nfrom django.db.models import Model\nfrom django.conf import settings\n\ntry:\n from django.utils.translation import override\nexcept ImportError:\n...
python
chosen
[ { "from": "system", "value": "Make SQLite the default test setup\n" }, { "from": "human", "value": "\nfrom binder import Sqlite3Connection\nfrom binder import MysqlConnection\nimport os\n\n\n# sqlite3\n_bindertest_dir = os.path.dirname( __file__ )\nDBFILE = os.path.join(_bindertest_dir, \"test.d...
python
chosen
[ { "from": "system", "value": "Add fallback message when no sequence was found\n" }, { "from": "human", "value": "\"\"\"Finding a sequence.\n\nUsage: sequencefinding.py NUMBERS...\n\nArguments:\n NUMBERS your sequence of numbers\n\"\"\"\n\nimport docopt\n\n\ndef differences(a):\n return [...
python
chosen
[ { "from": "system", "value": "Send RideRegistration id through with api response\n" }, { "from": "human", "value": "import requests\nfrom django.conf import settings\nfrom rest_framework import serializers\nfrom rest_framework.validators import UniqueTogetherValidator\nfrom server.api.serializer...
python
chosen
[ { "from": "system", "value": "Fix patched module was never automatically imported\n\nCloses #1701. It has to be imported late in the process of\n`import telethon` for its side-effects.\n" }, { "from": "human", "value": "from .client.telegramclient import TelegramClient\nfrom .network import conn...
python
chosen
[ { "from": "system", "value": "Fix args err in wheel test\n" }, { "from": "human", "value": "# coding: utf-8\n\n# Import Salt Testing libs\nfrom __future__ import absolute_import\nimport integration\n\n# Import Salt libs\nimport salt.wheel\n\n\nclass KeyWheelModuleTest(integration.TestCase, integ...
python
chosen
[ { "from": "system", "value": "Return commonness instead of raw counts\n" }, { "from": "human", "value": "from collections import defaultdict\nimport operator\n\nimport six\n\nfrom semanticizest._util import ngrams_with_pos, tosequence\n\n\nclass Semanticizer(object):\n def __init__(self, link...
python
chosen
[ { "from": "system", "value": "Work around XUnit assumptions about streams.\n\nFixes #4735.\n" }, { "from": "human", "value": "import os\nfrom tempfile import SpooledTemporaryFile\nfrom contextlib import contextmanager\n\n@contextmanager\ndef redirect_stream(output_stream, destination):\n \"\"...
python
chosen
[ { "from": "system", "value": "Add case insensitive metric parsing\n" }, { "from": "human", "value": "import abc\n\n\nclass BaseMetric(abc.ABC):\n ALIAS = 'base_metric'\n\n @abc.abstractmethod\n def __call__(self, y_true, y_pred):\n \"\"\"\"\"\"\n\n def __repr__(self):\n ...
python
chosen
[ { "from": "system", "value": "Revise tests to reflect removed split\n" }, { "from": "human", "value": "#!/usr/bin/env python3\n\nfrom nose.tools import eq_\nfrom resumable import rebuild, split\n\n\ndef test_simple():\n @rebuild\n def function(original):\n return split(str.upper)(or...
python
chosen
[ { "from": "system", "value": "Add cached tempaltes and standard language is Ar\n" }, { "from": "human", "value": "from .base_settings import *\nimport dj_database_url\nimport os\n\nALLOWED_HOSTS = ['shaha-halaqat.herokuapp.com', '0.0.0.0']\n\ndb_from_env = dj_database_url.config(conn_max_age=500...
python
chosen
[ { "from": "system", "value": "Add dates to test OAI harvester\n" }, { "from": "human", "value": "from __future__ import unicode_literals\n\nimport httpretty\n\nfrom scrapi.base import OAIHarvester\nfrom scrapi.linter import RawDocument\n\nfrom .utils import TEST_OAI_DOC\n\n\nclass TestHarvester(...
python
chosen
[ { "from": "system", "value": "Fix string formatting for py26\n" }, { "from": "human", "value": "import uuid\n\n\ndef make_arn_for_topic(account_id, name):\n return \"arn:aws:sns:us-east-1:{}:{}\".format(account_id, name)\n\n\ndef make_arn_for_subscription(topic_arn):\n subscription_id = uu...
python
chosen
[ { "from": "system", "value": "[Feature] Create BucketList & BucketLists endpoints.\n" }, { "from": "human", "value": "\"\"\"This module runs the api server.\"\"\"\nimport os\nfrom app import flask_app, db\nfrom app.models import User, BucketList, BucketListItem\nfrom flask.ext.script import Mana...
python
chosen
[ { "from": "system", "value": "Add test for tests function\n" }, { "from": "human", "value": "# -*- coding: utf-8 -*-\n\nimport billboard\nimport unittest\nfrom nose.tools import raises\nfrom requests.exceptions import ConnectionError\nimport six\n\n\nclass MiscTest(unittest.TestCase):\n @rais...
python
chosen
[ { "from": "system", "value": "Fix test_version() to support 3 or 4 elements\n\nSigned-off-by: Stephen L. <bede04c5d6a425d8c5798b0cfa1ed9b901b16a3b@gmail.com>\n" }, { "from": "human", "value": "def test_version():\n from tqdm import __version__\n assert len(__version__.split('.')) == 4\n" ...
python
chosen
[ { "from": "system", "value": "Add basic heroku production settings\n" }, { "from": "human", "value": "import os\nfrom painindex.settings.settings_base import *\n\n# This file is NOT part of our repo. It contains sensitive settings like secret key\n# and db setup.\nfrom env import *\n\n\nDEBUG = ...
python
chosen
[ { "from": "system", "value": "Add docstrings to rules unit tests\n" }, { "from": "human", "value": "import unittest\nfrom src import rules\n\nclass TestRules(unittest.TestCase):\n\tdef test_good_value_1(self):\n\t\trules_obj = rules.Rules()\n\t\tresult = rules_obj.convertCharToInt('1')\n\t\tself...
python
chosen
[ { "from": "system", "value": "Refactor by using array T\n" }, { "from": "human", "value": "\"\"\"Leetcode 118. Pascal's Triangle\nEasy\n\nURL: https://leetcode.com/problems/pascals-triangle/\n\nGiven a non-negative integer numRows, generate the first numRows of \nPascal's triangle.\n\nIn Pascal'...
python
chosen
[ { "from": "system", "value": "Fix to validate schema function\n" }, { "from": "human", "value": "from jsonschema import validate, ValidationError\nfrom flask import current_app\nimport json\nimport os\n\n\ndef validate_schema(data, schema_name):\n \"\"\"\n Validate the provided data agains...
python
chosen
[ { "from": "system", "value": "Rename conflicting migration and remove extra\n\nchanges autogenerated by `./manage.py makemigrations`\n" }, { "from": "human", "value": "# -*- coding: utf-8 -*-\nfrom __future__ import unicode_literals\n\nfrom django.db import migrations, models\nimport jsonfield.f...
python
chosen
[ { "from": "system", "value": "Change how PSNR is computed\n" }, { "from": "human", "value": "import keras.backend as K\nimport numpy as np\n\n\ndef psnr(y_true, y_pred):\n \"\"\"Peak signal-to-noise ratio averaged over samples and channels.\"\"\"\n mse = K.mean(K.square(y_true - y_pred), a...
python
chosen
[ { "from": "system", "value": "Use safe load for yaml.\n" }, { "from": "human", "value": "\"\"\"\nThis file contains the code needed for dealing with some of the mappings. Usually a map is just a\ndictionary that needs to be loaded inside a variable.\nThis file carries the function to parse the f...
python
chosen
[ { "from": "system", "value": "Add check for running on Mac OS X\n" }, { "from": "human", "value": "try:\n import pync\n pync_available = True\nexcept ImportError:\n pync_available = False\n\nfrom .alerter import Alerter\n\nclass NotificationCenterAlerter(Alerter):\n \"\"\"Send alerts...
python
chosen
[ { "from": "system", "value": "Add coveralls to test requirements\n" }, { "from": "human", "value": "# This is imported from setup.py and the test script\ntests_require = [\n 'pytest',\n 'pytest-capturelog',\n 'pytest-cov',\n]\n" }, { "from": "gpt", "value": "# This is import...
python
chosen
[ { "from": "system", "value": "Use the 'with' statement to create the PR2 object\n" }, { "from": "human", "value": "#! /usr/bin/env python\n\nimport logging\nlogger = logging.getLogger(\"robots\")\nlogger.setLevel(logging.DEBUG)\n\nconsole = logging.StreamHandler()\nconsole.setLevel(logging.DEBUG...
python
chosen
[ { "from": "system", "value": "Make Public Body document search an EdgeNgram Field to improve search" }, { "from": "human", "value": "from haystack import indexes\nfrom haystack import site\n\nfrom publicbody.models import PublicBody\n\n\nclass PublicBodyIndex(indexes.SearchIndex):\n text = in...
python
chosen
[ { "from": "system", "value": "Bring down the server on (some?) uncaught errors.\n\nI added an errback to the LoopingCall for gameStateManager.tick, so\nit'll be called if any exception gets raised out of one of those calls.\nThe errback just prints a traceback and then brings down the server,\nensuring that...
python
chosen
[ { "from": "system", "value": "Use version 0.9 of pyimagediet\n" }, { "from": "human", "value": "from setuptools import setup\n\nlong_description = '''\\\nimage-diet2 is a Django application for removing unnecessary bytes from image\nfiles. It optimizes images without changing their look or visu...
python
chosen
[ { "from": "system", "value": "Fix bug on history file\n" }, { "from": "human", "value": "#!/usr/bin/env python\n# -*- coding: utf-8 -*-\n\nimport sys\nfrom setuptools import setup, find_packages\n\n\nwith open('README.rst') as readme_file:\n readme = readme_file.read()\n\nwith open('HISTORY.r...
python
chosen
[ { "from": "system", "value": "Test edit - to check svn email hook" }, { "from": "human", "value": "from distutils.core import setup\nimport os, glob, string, shutil\n\n# Packages\n\npackages = ['neuroimaging', 'neuroimaging.statistics', 'neuroimaging.image', 'neuroimaging.reference', 'neuroimagi...
python
chosen
[ { "from": "system", "value": "Expand trove classifiers and keywords\n" }, { "from": "human", "value": "#!/usr/bin/env python\n\nfrom distutils.core import setup\nimport os\n\nfrom deflect import __version__ as version\n\n\ndef read_file(filename):\n \"\"\"\n Utility function to read a prov...
python
chosen
[ { "from": "system", "value": "Use py.test directly instead of through runtests.py" }, { "from": "human", "value": "import subprocess\nimport sys\nfrom setuptools import setup, Command\n\nimport restle\n\n\nclass PyTest(Command):\n user_options = []\n\n def initialize_options(self):\n ...
python
chosen
[ { "from": "system", "value": "Stop being a legacy owl" }, { "from": "human", "value": "#!/usr/bin/env python\n\nfrom __future__ import absolute_import, division, print_function\n\nimport os, sys\n\nfrom setuptools import setup, find_packages\n\nsetup(\n name='towncrier',\n maintainer='Ambe...
python
chosen
[ { "from": "system", "value": "Add `curious.ext` as a namespace package correctly.\n" }, { "from": "human", "value": "from setuptools import setup\n\nsetup(\n name='discord-curious',\n version='0.1.1',\n packages=['curious', 'curious.http', 'curious.commands', 'curious.dataclasses', 'cur...
python
chosen
[ { "from": "system", "value": "Update some information for pypi package\n" }, { "from": "human", "value": "from setuptools import setup\n\n\nfiles = [\"journal_files/*\"]\nreadme = open('README.md','r')\nREADME_TEXT = readme.read()\nreadme.close()\n\nsetup(\n name=\"journalabbrev\",\n versi...
python
chosen
[ { "from": "system", "value": "Make sure that pip will install the template files too\n" }, { "from": "human", "value": "from setuptools import setup\n\nsetup(\n name='nchp',\n version='0.1',\n description='NGINX based Configurable HTTP Proxy for use with jupyterhub',\n url='http://gi...
python
chosen
[ { "from": "system", "value": "Add classifiers to indicate that the package works with python 3.\n" }, { "from": "human", "value": "from setuptools import setup\nimport sys\n\nversion = '2.0.0'\n\nif sys.version_info >= (3,):\n python_dateutils_version = 'python-dateutil>=2.0'\nelse:\n pyth...
python
chosen
[ { "from": "system", "value": "Choose lemma with fewest parts.\n" }, { "from": "human", "value": "#! /usr/bin/env python3\n\nfrom sys import stdin\n\nfor line in stdin:\n line = line.strip()\n\n if line == '':\n print('')\n else:\n wf, feats, lemma, label, ann = line.split(...
python
chosen
[ { "from": "system", "value": "Add a version number for scattering.\n" }, { "from": "human", "value": "from numpy.distutils.core import setup\nfrom numpy.distutils.misc_util import Configuration\nfrom numpy.distutils.system_info import get_info\nfrom os.path import join\n\nflags = ['-W', '-Wall',...
python
chosen
[ { "from": "system", "value": "Read the `__version__` parameter by directly running [trakt/version.py]\n" }, { "from": "human", "value": "from trakt.version import __version__\n\nfrom setuptools import setup, find_packages\n\nsetup(\n name='trakt.py',\n version=__version__,\n license='MI...
python
chosen
[ { "from": "system", "value": "Revert \"Changing our ``coverage`` test dependency to ``django-coverage``.\"\n\nThis reverts commit 68e8555cd2e07c4352ea06121ab262b19b3c2413.\n\nConflicts:\n\n\tsetup.py\n" }, { "from": "human", "value": "from os.path import abspath, dirname, join, normpath\n\nfrom ...
python
chosen
[ { "from": "system", "value": "Add full description to package.\n" }, { "from": "human", "value": "from setuptools import setup, find_packages\n\n\nextras_require = {\n 'backends': ('peewee', \"redis\"),\n}\n\nsetup(\n name='huey',\n version=__import__('huey').__version__,\n descripti...
python
chosen
[ { "from": "system", "value": "Create build/dist directories in ./..\n" }, { "from": "human", "value": "\"\"\"\nScript to install Souma on OsX, Windows, and Unix\n\nUsage:\n python setup.py py2app\n\"\"\"\nimport ez_setup\nez_setup.use_setuptools()\n\nimport sys\nfrom setuptools import setup\n...
python
chosen
[ { "from": "system", "value": "Update the way we fetch requirements, it wasn't resolving dependencies before.\n" }, { "from": "human", "value": "#!/usr/bin/env python\n# -*- coding: utf-8 -*-\n\n\ntry:\n from setuptools import setup, find_packages\nexcept ImportError:\n from distutils.core ...
python
chosen
[ { "from": "system", "value": "Exclude test folder from package\n\nDHC-1102\n\nIgnore the test directory when looking for python packages to\navoid having the files installed\n\nChange-Id: Ia30e821109c0f75f0f0c51bb995b2099aa30e063\nSigned-off-by: Rosario Di Somma <73b2fe5f91895aea2b4d0e8942a5edf9f18fa897@dre...
python
chosen
[ { "from": "system", "value": "Read README.rst for the long description\n" }, { "from": "human", "value": "#!/usr/bin/env python\n\nfrom distutils.core import setup\n\nlong_description = '''\nThis module allows you to perform IP subnet calculations, there is support\nfor both IPv4 and IPv6 CIDR n...
python
chosen