conversations
listlengths
2
3
source
stringclasses
1 value
stack
stringclasses
1 value
[ { "from": "system", "value": "Make offlineimap sync every minute\n" }, { "from": "human", "value": "#!/usr/bin/env python3\n\nimport subprocess\nimport threading\nimport time\nimport os\n\n# Sync accounts asynchronously, but wait for all syncs to finish\ndef offlineimap():\n AAU = subprocess....
python
chosen
[ { "from": "system", "value": "Use SpooledTemp, not NamedTemp file\n" }, { "from": "human", "value": "import json\nimport re\nimport base64\nimport hashlib\nimport tempfile\nimport os\n\nfrom pymisp.tools import stix\n\nmisperrors = {'error': 'Error'}\nuserConfig = {}\ninputSource = ['file']\n\nm...
python
chosen
[ { "from": "system", "value": "Deal with the compass.rb -> config.rb change\n" }, { "from": "human", "value": "# Copyright 2013 Donald Stufft\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 obta...
python
chosen
[ { "from": "system", "value": "Replace `while True` with `while 1` for more web scale sauce.\r\n\r\nIn Python 2.x, True is not a keyword, so it can be reassigned. Compiler replaces `while 1` loop with a single jump, so it is faster by 10%.\r\n\r\nhttp://www.reddit.com/r/Python/comments/ppote/how_would_you_ex...
python
chosen
[ { "from": "system", "value": "Fix error in RaspberryPi environment <numpy type error>.\n" }, { "from": "human", "value": "#!/usr/bin/python\nfrom sys import argv\nimport numpy as np\nimport cv2\nimport cv2.cv as cv\n\ndef detectCircle(imagePath):\n image = cv2.imread(imagePath)\n gray = cv...
python
chosen
[ { "from": "system", "value": "Fix logger functions failures when an optional package not installed\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...
python
chosen
[ { "from": "system", "value": "Fix errors on create weekday\n" }, { "from": "human", "value": "from django.core.exceptions import ValidationError\n\nimport graphene\nfrom graphene_django import DjangoObjectType\n\nfrom app.timetables.models import Weekday\nfrom .utils import get_errors\n\n\nclass...
python
chosen
[ { "from": "system", "value": "Update comment to be a bit more helpful\n" }, { "from": "human", "value": "import logging\nfrom irc.schedule import IScheduler\nfrom tempora import schedule\nfrom tempora.schedule import Scheduler\n\n\nlog = logging.getLogger(__name__)\n\n\n# same as InvokeScheduler...
python
chosen
[ { "from": "system", "value": "Add auth models and validators to initial db migration.\n" }, { "from": "human", "value": "# -*- coding: utf-8 -*-\n\"\"\" Initial migration file for creating Note model \"\"\"\nfrom __future__ import unicode_literals\n\nfrom django.db import migrations, models\n\n\...
python
chosen
[ { "from": "system", "value": "Remove unnecessary variable assignment and print\n" }, { "from": "human", "value": "from django import template\nfrom dataedit import models\nimport webcolors\n\nregister = template.Library()\n\n\n@register.assignment_tag\ndef get_tags():\n return models.Tag.obje...
python
chosen
[ { "from": "system", "value": "Update to include djcelery in apps for prereq migrations to run\n" }, { "from": "human", "value": "DEBUG = True\n\nSECRET_KEY = 'ItsSekret'\n\nUSE_TZ = True\n\nDATABASES = {\n 'default': {\n 'ENGINE': 'django.db.backends.sqlite3',\n 'NAME': 'subscri...
python
chosen
[ { "from": "system", "value": "Update pixel's template file name to meta.xlsx\n" }, { "from": "human", "value": "from pathlib import PurePath\nfrom tempfile import mkdtemp\nfrom django.contrib.auth.mixins import LoginRequiredMixin\nfrom django.http import HttpResponse\nfrom django.views.generic i...
python
chosen
[ { "from": "system", "value": "Add policy description for image size\n\nThis commit adds policy doc for image size policies.\n\nPartial implement blueprint policy-docs\n\nChange-Id: I0de4aaa47e21c4e156569eebcb495412ab364417\n" }, { "from": "human", "value": "# Copyright 2016 Cloudbase Solutions S...
python
chosen
[ { "from": "system", "value": "Allow integer-only session name and hash for the example\n" }, { "from": "human", "value": "#!/usr/bin/env python3\nimport traceback\n\nfrom telethon.interactive_telegram_client import (InteractiveTelegramClient,\n pr...
python
chosen
[ { "from": "system", "value": "Add a map function over messages" }, { "from": "human", "value": "import time\n\nfrom .runtime import behavior, Actor, exception_message, Runtime\nfrom .eventloop import EventLoop\n\n\nclass Wait(object):\n \"\"\"A synchronizing object.\n\n Convenience object ...
python
chosen
[ { "from": "system", "value": "Fix for pydocstyle > 1.1.1" }, { "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# Copyright (c) 2015-2016 The SublimeLinter Community\n# Copyright (c) 2013-2014...
python
chosen
[ { "from": "system", "value": "Add test for mbed parsing\n" }, { "from": "human", "value": "#!/usr/bin/env python\n\"\"\"\nmbed SDK\nCopyright (c) 2011-2015 ARM Limited\n\nLicensed under the Apache License, Version 2.0 (the \"License\");\nyou may not use this file except in compliance with the Li...
python
chosen
[ { "from": "system", "value": "Add pseudocode for set_fm_for_complex_sets and set_fm_for_trivial_cases\n" }, { "from": "human", "value": "\n#!/usr/bin/env python\n\n\"\"\"mefdas.py: Description of what foobar does.\"\"\"\n\n__author__ = \"Philip Chase(pbc@ufl.edu, Chris Barnes(cpb@ufl.edu), ...
python
chosen
[ { "from": "system", "value": "Add git init to post generate hook\n" }, { "from": "human", "value": "import os\n\nsrc = '{{cookiecutter.repo_name}}/src/utils/prepare-commit-msg.py'\ndst = '{{cookiecutter.repo_name}}/.git/hooks/prepare-commit-msg'\n\nos.mkdir('{{cookiecutter.repo_name}}/.git/hooks...
python
chosen
[ { "from": "system", "value": "Fix pyreq test on Windows\n\nSigned-off-by: Uilian Ries <d4bad57018205bdda203549c36d3feb0bfe416a7@gmail.com>\n" }, { "from": "human", "value": "import unittest\n\nfrom conans.test.utils.tools import TestClient\nfrom cpt.test.test_client.tools import get_patched_mult...
python
chosen
[ { "from": "system", "value": "Use safe_load_all to detect errors in multi-document files\n" }, { "from": "human", "value": "#\n# linter.py\n# Linter for SublimeLinter3, a code checking framework for Sublime Text 3\n#\n# Written by NotSqrt\n# Copyright (c) 2013 NotSqrt\n#\n# License: MIT\n#\n\n\"...
python
chosen
[ { "from": "system", "value": "Update for SublimeLinter 4 API.\n\ngithub.com/ckaznocha/SublimeLinter-contrib-write-good/issues/14\ngithub.com/ckaznocha/SublimeLinter-contrib-write-good/issues/11\n" }, { "from": "human", "value": "#\n# linter.py\n# Linter for SublimeLinter3, a code checking framew...
python
chosen
[ { "from": "system", "value": "Use the platform() in sublime.py rather than importing platform.\n" }, { "from": "human", "value": "#\n# linter.py\n# Linter for SublimeLinter3, a code checking framework for Sublime Text 3\n#\n# Written by Jack Cherng\n# Copyright (c) 2015 jfcherng\n#\n# License: M...
python
chosen
[ { "from": "system", "value": "Fix value get - use offset\n" }, { "from": "human", "value": "# -*- coding: utf8 -*-\n\nfrom time import time\n\n__author__ = 'sergey'\n\nclass CacheTTLseconds(object):\n \"\"\"\n Simple cache storage\n \n {\n key (int | str) : [\n time...
python
chosen
[ { "from": "system", "value": "Make sure that user details are valid JSON\n" }, { "from": "human", "value": "from django.db import models\nfrom django.contrib.auth.models import User\n\nfrom django.contrib import admin\n\nfrom settings.models import VotingSystem\n\n# Create your models here.\ncla...
python
chosen
[ { "from": "system", "value": "Add method to clarify localhost data\n" }, { "from": "human", "value": "\"\"\"Simplified hosts for pysyte\"\"\"\n\nimport getpass\nimport socket\nfrom dataclasses import dataclass\n\n\n@dataclass\nclass Host:\n hostname: str\n aliases: list\n addresses: lis...
python
chosen
[ { "from": "system", "value": "Fix path for secret key to be relative\n" }, { "from": "human", "value": "\"\"\"\nDjango settings for pc_datamanger project.\n\nFor more information on this file, see\nhttps://docs.djangoproject.com/en/1.6/topics/settings/\n\nFor the full list of settings and their ...
python
chosen
[ { "from": "system", "value": "Set window size to something a little bigger.\n" }, { "from": "human", "value": "import os\nfrom urlparse import urljoin\n\nfrom django.conf import settings\n\nfrom splinter.browser import Browser\n\nfrom inthe_am.taskmanager import models\n\n\nTEST_COUNTERS = {}\n\...
python
chosen
[ { "from": "system", "value": "Use symbolic constant rather than literal value\n" }, { "from": "human", "value": "# 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 at\n#\n...
python
chosen
[ { "from": "system", "value": "Add create_word function in pattern class\n" }, { "from": "human", "value": "class Pattern(object):\n\n def __init__(self, pattern):\n self.consonants = ['b','c','d','f','g','h','j','k','l','m','n','p','q','r','s','t','v','w','x','y','z']\n self.vow...
python
chosen
[ { "from": "system", "value": "Increase maximum query length to 10K\n" }, { "from": "human", "value": "\"\"\"\nCopyright [2009-2014] EMBL-European Bioinformatics Institute\nLicensed under the Apache License, Version 2.0 (the \"License\");\nyou may not use this file except in compliance with the L...
python
chosen
[ { "from": "system", "value": "Remove out_dir from the drill task's list of arguments\n" }, { "from": "human", "value": "import redis\nfrom celery import Celery\n\nfrom .driller import Driller\n\napp = Celery('tasks', broker='amqp://guest@localhost//', backend='redis://localhost')\nredis_pool = r...
python
chosen
[ { "from": "system", "value": "Update motor API with new data model\n" }, { "from": "human", "value": "from Adafruit_MotorHAT import Adafruit_MotorHAT\n\n\nclass Vehicle:\n def __init__(self, motor_hat=Adafruit_MotorHAT()):\n self.motor_hat = motor_hat\n self.motors = []\n\n d...
python
chosen
[ { "from": "system", "value": "Increment version number to 0.13.0\n" }, { "from": "human", "value": "\"\"\"Configuration for Django system.\"\"\"\n\n__version__ = \"0.12.1\"\n__version_info__ = tuple(\n [\n int(num) if num.isdigit() else num\n for num in __version__.replace(\"-\"...
python
chosen
[ { "from": "system", "value": "Debug Google Cloud Run support\n" }, { "from": "human", "value": "#!/usr/bin/python3\n#\n# Define containerized environment for running Diosix on Qemu\n#\n# On Google Cloud Run: Creates HTTP server on port 8080\n# or whatever was specified using the PORT system vari...
python
chosen
[ { "from": "system", "value": "Add parallel capability for running the map\n" }, { "from": "human", "value": "'''\nRead in a vm map file. The map file contains a mapping of profiles to names\nallowing for individual vms to be created in a more stateful way\n'''\n\n# Import python libs\nimport os\...
python
chosen
[ { "from": "system", "value": "Make tools/gypdart independent of the directory from which it is called.\n\nThis enables more independence in the way you can structure your checkout using gclient.\n\nBUG=\nR=ahe@google.com\n\nReview URL: https://codereview.chromium.org//1023893003\n\ngit-svn-id: c93d8a2297af3...
python
chosen
[ { "from": "system", "value": "Fix module names for pytest.\n\nWe've shifted the directories but we still have the following horrid\ncode for determining the module name to mock. Eventually we should\nswitch to patch object (much more modern and use the module under test\ndirectly).\n" }, { "from": ...
python
chosen
[ { "from": "system", "value": "Reduce reraise pollution in runserver_plus traceback page\n" }, { "from": "human", "value": "# -*- coding: utf-8 -*-\nimport six\n\n\ndef null_technical_500_response(request, exc_type, exc_value, tb, status_code=500):\n six.reraise(exc_type, exc_value, tb)\n" }...
python
chosen
[ { "from": "system", "value": "Remove header comment, duplicated in docs\n" }, { "from": "human", "value": "# --------------------------------------------------------------------------------------------------\n# Ibis: a lightweight template engine.\n#\n# How it works: A lexer transforms a templat...
python
chosen
[ { "from": "system", "value": "Add example for werkzeug middleware installation.\n" }, { "from": "human", "value": "from sling import Application\nfrom sling.core.logger import logger\nfrom sling.ext import hello\nimport localmodule\n\n\napp = Application([\n hello,\n])\n\n\n# Other way of ins...
python
chosen
[ { "from": "system", "value": "Check slower endpoints during promotion\n" }, { "from": "human", "value": "import os\n\nimport pytest\nimport requests\n\n\n@pytest.fixture\ndef url():\n return os.getenv(\"SITE\", \"http://localhost:5000\")\n\n\ndef test_post_images(expect, url):\n params = {...
python
chosen
[ { "from": "system", "value": "DOC: Make plot2rst example more strict.\n" }, { "from": "human", "value": "#!/usr/bin/env python\n\"\"\"\n================\nTutorial example\n================\n\nHere's a line plot:\n\"\"\"\nimport numpy as np\nimport matplotlib.pyplot as plt\n\n'normal string'\n\nx...
python
chosen
[ { "from": "system", "value": "Use ** instead of math.pow\n" }, { "from": "human", "value": "import math\nfrom datetime import timedelta\n\nARCHIVE_PROVIDER = 'osfstorage'\n\nMAX_ARCHIVE_SIZE = math.pow(1024, 3) # 1 GB\nMAX_FILE_SIZE = MAX_ARCHIVE_SIZE # TODO limit file size?\n\nARCHIVE_TIMEOUT...
python
chosen
[ { "from": "system", "value": "Add some more output examples\n" }, { "from": "human", "value": "#\n# linter.py\n# Linter for SublimeLinter3, a code checking framework for Sublime Text 3\n#\n# Written by Jack Brewer\n# Copyright (c) 2015 Jack Brewer\n#\n# License: MIT\n\n\"\"\"Exports the Stylint ...
python
chosen
[ { "from": "system", "value": "Add a function to write a sequence of nodes into a file\n" }, { "from": "human", "value": "from graph import Graph\n\nclass Writer:\n '''\n Write a graph into file.\n '''\n def write_blossom_iv(self, graph, file_location):\n '''\n Write a g...
python
chosen
[ { "from": "system", "value": "Add more validation. Add to docstrings.\n" }, { "from": "human", "value": "import mongoengine as me\nfrom datetime import datetime\nfrom config import DATABASE_NAME\n\n\n# Connect to the Mongo database\nme.connect(DATABASE_NAME)\n\n\nclass Page(me.Document):\n \"...
python
chosen
[ { "from": "system", "value": "Maintain BC again in autocomplete_light ns until dj19\n" }, { "from": "human", "value": "\"\"\"\nProvide tools to enable nice autocompletes in your Django project.\n\"\"\"\nfrom django import VERSION\n\nif VERSION < (1, 7):\n from .shortcuts import * # noqa\nels...
python
chosen
[ { "from": "system", "value": "Raise an error if no file is specified\n" }, { "from": "human", "value": "#!/usr/bin/python\n# -*- coding: utf-8 -*-\n\n\"\"\"Command line utility for proselint.\"\"\"\n\nimport click\nimport os\nimport imp\n\n\ndef log_error(line, column, error_code, msg):\n \"\...
python
chosen
[ { "from": "system", "value": "Raise not Found on schema item_type error.\n" }, { "from": "human", "value": "from pyramid.view import view_config\nfrom random import randint\nfrom ..contentbase import (\n Root,\n location_root,\n)\n\n\ndef includeme(config):\n # Random processid so etags...
python
chosen
[ { "from": "system", "value": "Fix typo; Fix request never finish\n" }, { "from": "human", "value": "# coding: utf-8\nimport json\n\nimport tornado.ioloop\nimport tornado.web\nimport Adafruit_BMP.BMP085 as BMP085\n\n\nclass SensorAccess(tornado.web.RequestHandler):\n @tornado.web.asynchronous\...
python
chosen
[ { "from": "system", "value": "Add handling of InvalidRequestError in ``to_python`\n" }, { "from": "human", "value": "from django.db import models\nfrom django.core.exceptions import ValidationError\n\nfrom pyuploadcare.dj import forms, UploadCare\nfrom pyuploadcare.file import File\n\n\nclass Fi...
python
chosen
[ { "from": "system", "value": "[Discord] Use constant for SteamID64 base for Steam Account converter\n\n" }, { "from": "human", "value": "\nfrom discord.ext import commands\n\nclass Maptype(commands.Converter):\n\t\n\t'''\n\tFor Google Maps Static API parameter\n\thttps://developers.google.com/ma...
python
chosen
[ { "from": "system", "value": "Set PREFIX in make as well as makeinstall\n" }, { "from": "human", "value": "\nclass NuGetPackage(GitHubTarballPackage):\n\tdef __init__(self):\n\t\tGitHubTarballPackage.__init__(self,\n\t\t\t'mono', 'nuget',\n\t\t\t'2.8.1',\n\t\t\t'7b20cd5408852e725bd14a13855bd2385...
python
chosen
[ { "from": "system", "value": "Reboot and IE6 compatibility fixer messages\n" }, { "from": "human", "value": "import random\n\nfrom helga.plugins import command\n\n\nRESPONSES = [\n 'There is no hope for {thing}, {nick}',\n 'It looks ok to me...',\n 'Did you power cycle {thing}? Are any ...
python
chosen
[ { "from": "system", "value": "Add an action for server disconnects\n" }, { "from": "human", "value": "from twisted.internet.protocol import ClientFactory, ReconnectingClientFactory\nfrom heufybot.connection import HeufyBotConnection\n\n\nclass HeufyBotFactory(ReconnectingClientFactory):\n pro...
python
chosen
[ { "from": "system", "value": "Remove decorator for now-passing test\n\nThe underlying issue was actually a Clang bug, now fixed. The test now\nreports XPASS for me locally and on the buildbot.\n\nllvm.org/pr17183 (LLDB)\nllvm.org/pr18950 (Clang)\n\n\ngit-svn-id: 4c4cc70b1ef44ba2b7963015e681894188cea27e@206...
python
chosen
[ { "from": "system", "value": "Fix YAMLStorage as per TinyDB doc changes\n" }, { "from": "human", "value": "import yaml\nimport sys\nfrom tinydb.storages import Storage\n\nclass YAMLStorage(Storage):\n def __init__(self, filename): # (1)\n self.filename = filename\n\n def read(self)...
python
chosen
[ { "from": "system", "value": "Change image upload directory to images/\n" }, { "from": "human", "value": "from django.contrib.gis.db import models\nimport os\nfrom phonenumber_field.modelfields import PhoneNumberField\n\nclass Image(models.Model):\n \"\"\"\n The Image model holds an image ...
python
chosen
[ { "from": "system", "value": "Fix install order to fix wrong caret line color\n" }, { "from": "human", "value": "#!/usr/bin/env python\n# -*- coding: utf-8 -*-\n\"\"\"\nA simple example that shows how to setup CodeEdit.\n\nIn this example, we install a syntax highlighter mode (based on pygments)...
python
chosen
[ { "from": "system", "value": "Remove get user by id nonsense, now exponent.auth.name\n" }, { "from": "human", "value": "from exponent.auth import common\nfrom twisted.cred import checkers, portal\nfrom twisted.internet import defer\nfrom twisted.protocols import amp\nfrom zope import interface\n...
python
chosen
[ { "from": "system", "value": "Use env variable to indicate installer\n" }, { "from": "human", "value": "#!/usr/bin/env python\n# Copyright (c) 2012 Citrix Systems, Inc.\n#\n# This program is free software; you can redistribute it and/or modify\n# it under the terms of the GNU Lesser General Publ...
python
chosen
[ { "from": "system", "value": "Add a unicode value in a comment_intl value.\n" }, { "from": "human", "value": "#!/usr/bin/python\n\nfrom ADIF_log import ADIF_log\nimport datetime\nimport os\n\n# Create a new log...\nlog = ADIF_log('Py-ADIF Example')\nentry = log.newEntry()\n\n# New entry from K6B...
python
chosen
[ { "from": "system", "value": "Add play, render and Say to toplevel namespace.\n" }, { "from": "human", "value": "# -*- encoding: utf -*-\n\nimport pyximport\npyximport.install()\n\nfrom supriya.tools import * # noqa\nfrom supriya.tools.bindingtools import bind # noqa\nfrom supriya.tools.nonrea...
python
chosen
[ { "from": "system", "value": "Change order of notification types so that email is shown first and becomes the default\n" }, { "from": "human", "value": "from django.db import models\n\nfrom django.contrib.auth.models import User\n\nfrom common.models import Audit, Comment\n\nfrom farms.models im...
python
chosen
[ { "from": "system", "value": "Verify existence of *.html and *.py versions for every notebook\n" }, { "from": "human", "value": "from unittest import TestCase\n\n\nclass TestSerenataDeAmor(TestCase):\n\n def test_it_works(self):\n self.assertEqual(4, 2 + 2)\n self.assertNotEqual...
python
chosen
[ { "from": "system", "value": "Add function that gets presigned url for video.\n" }, { "from": "human", "value": "import sys\nimport boto3\n\nBUCKET_NAME = 'mitLookit'\n\ndef get_all_study_attachments(study_uuid):\n s3 = boto3.resource('s3')\n bucket = s3.Bucket(BUCKET_NAME)\n return buc...
python
chosen
[ { "from": "system", "value": "Use config instead of hardcoding target channel\n" }, { "from": "human", "value": "from irc3.plugins.command import command\nfrom irc3.plugins.cron import cron\nimport irc3\n\nfrom teamspeak_web_utils import nplstatus\n\n\n@irc3.plugin\nclass TS3NPL(object):\n de...
python
chosen
[ { "from": "system", "value": "Set unichr = chr for Python 3.\n" }, { "from": "human", "value": "\"\"\"\nInternal utility functions.\n\n`htmlentitydecode` came from here:\n http://wiki.python.org/moin/EscapingHtml\n\"\"\"\n\n\nimport re\nimport sys\ntry:\n from html.entities import name2cod...
python
chosen
[ { "from": "system", "value": "Add missing docstring on remove_punctuation\n" }, { "from": "human", "value": "from bs4 import BeautifulSoup\n\n\ndef html_to_text(html_text):\n \"\"\"Receive pure html and convert to text without tags\"\"\"\n soup = BeautifulSoup(html_text, \"html.parser\")\n...
python
chosen
[ { "from": "system", "value": "Use Memcache to cache tags\n" }, { "from": "human", "value": "from techism2.models import Event\nfrom datetime import datetime\n\n\ndef get_tags():\n # TODO: cache, use django cache which uses GAE memcache\n dict_list = Event.objects.values('tags')\n tags =...
python
chosen
[ { "from": "system", "value": "Remove testing dir from interface doc generation.\n\ngit-svn-id: 24f545668198cdd163a527378499f2123e59bf9f@1390 ead46cd0-7350-4e37-8683-fc4c6f79bf00\n" }, { "from": "human", "value": "#!/usr/bin/env python\n\"\"\"Script to auto-generate interface docs.\n\"\"\"\n# std...
python
chosen
[ { "from": "system", "value": "Add headers to migrations in ggrc_basic_permissions\n" }, { "from": "human", "value": "\n\"\"\"Add roles order column\n\nRevision ID: 99925466d6e\nRevises: 401fb7f0184b\nCreate Date: 2015-08-05 10:55:43.992382\n\n\"\"\"\n\nfrom alembic import op\nimport sqlalchemy a...
python
chosen
[ { "from": "system", "value": "Add TODO comment for get_data_index\n" }, { "from": "human", "value": "import numpy as np\nimport pandas\n\ndef main():\n\tdata = pandas.read_csv('sarcasm_v2.csv').as_matrix()\n\t# print(data.shape)\n\tdata[:, 0] = np.array([find_category(x) for x in data[:, 0]])\n\...
python
chosen
[ { "from": "system", "value": "Allow choosing which address to listen on from command-line\n\nCloses #12\n" }, { "from": "human", "value": "#!/usr/bin/python\n# coding: utf-8\n\n# This file is part of Supysonic.\n#\n# Supysonic is a Python implementation of the Subsonic server API.\n# Copyright (...
python
chosen
[ { "from": "system", "value": "Add value property to class Node\n\nvalue is the calculated output of a Node.\n" }, { "from": "human", "value": "class Node(object):\n def __init__(self):\n # Node(s) from which this Node receives values\n self.inbound_nodes = inbound_nodes\n # Node(s) to ...
python
chosen
[ { "from": "system", "value": "Join channels where the bot isn't already on\n" }, { "from": "human", "value": "#!/usr/bin/env python\n\nimport asyncio\nimport asyncio_redis\nimport asyncio_redis.encoders\nimport json\nimport irc3\nimport traceback\n\n__version__ = '3.0alpha'\n\n\nclass Redis2Irc(...
python
chosen
[ { "from": "system", "value": "Change the generated markup so that attribute names are properly marked.\n" }, { "from": "human", "value": "# Lame substitute for a fine script to generate the table from ast.txt\n\nfrom compiler import astgen\n\nAST_DEF = '../compiler/ast.txt'\n\ndef sort(l):\n ...
python
chosen
[ { "from": "system", "value": "Use importlib instead of django.utils.importlib\n\ndjango.utils.importlib is deprecated, and removed in Django 1.9\n" }, { "from": "human", "value": "\"\"\"Django Endless Pagination object loaders.\"\"\"\n\nfrom __future__ import unicode_literals\n\nfrom django.core...
python
chosen
[ { "from": "system", "value": "Update compiler recursion crasher to more reliably blow the stack and add a tracker issue for it\n" }, { "from": "human", "value": "\"\"\"\nThe compiler (>= 2.5) recurses happily.\n\"\"\"\n\ncompile('()'*9**5, '?', 'exec')\n" }, { "from": "gpt", "value":...
python
chosen
[ { "from": "system", "value": "Clean out testing keys with etcdctl\n" }, { "from": "human", "value": "\"\"\"\ntest_etcd3\n----------------------------------\n\nTests for `etcd3` module.\n\"\"\"\n\nimport pytest\n\nimport etcd3\n\n\nclass TestEtcd3(object):\n\n @classmethod\n def setup_class...
python
chosen
[ { "from": "system", "value": "Index localised URLs for search\n" }, { "from": "human", "value": "from django.apps import AppConfig\nfrom django.db.models.signals import post_save\n\nfrom watson import search\nfrom localized_fields.fields import LocalizedField\n\n\nclass MaterialSearchAdapter(sea...
python
chosen
[ { "from": "system", "value": "Revert unwanted change in tool/script.\n" }, { "from": "human", "value": "# -*- coding: utf-8 -*-\n\"\"\"\nParse and translate an EBNF grammar into a Python parser for\nthe described language.\n\"\"\"\nfrom __future__ import (absolute_import, division, print_functio...
python
chosen
[ { "from": "system", "value": "Use parametric tests for format tests so that it is clearer which type is failing.\n" }, { "from": "human", "value": "import numpy as np\nfrom numpy.testing import *\n\nclass TestPrint(TestCase):\n\n def test_float_types(self) :\n \"\"\" Check formatting.\...
python
chosen
[ { "from": "system", "value": "Test for constraint in message\n" }, { "from": "human", "value": "from tests.lib import create_basic_wheel_for_package\n\n\ndef test_new_resolver_conflict_requirements_file(tmpdir, script):\n create_basic_wheel_for_package(script, \"base\", \"1.0\")\n create_b...
python
chosen
[ { "from": "system", "value": "Add get_database_connection() and teardown_request() to handle getting and releasing a connnection.\n" }, { "from": "human", "value": "# -*- coding: utf-8 -*-\nfrom flask import Flask\nimport os\nimport psycopg2\nfrom contextlib import closing\n\nDB_SCHEMA = \"\"\"\...
python
chosen
[ { "from": "system", "value": "Add dashboard node for transaction list\n" }, { "from": "human", "value": "from django.conf.urls import patterns, url\nfrom django.contrib.admin.views.decorators import staff_member_required\n\nfrom oscar.core.application import Application\n\nfrom . import views\n\...
python
chosen
[ { "from": "system", "value": "Make pbr only a build-time dependency.\n\nThis lets you build python-marconiclient packages that don't require pbr\nto be installed at all. You would need pbr on the machine running\nrpmbuild / debuild, but not on the machines that install the packages.\n\nUnfortunately, this d...
python
chosen
[ { "from": "system", "value": "Fix bug to make template optional\n" }, { "from": "human", "value": "\"\"\"\nMixin fragment/html behavior into XBlocks\n\"\"\"\nfrom __future__ import absolute_import\nfrom django.template.context import Context\nfrom xblock.fragment import Fragment\n\n\nclass XBloc...
python
chosen
[ { "from": "system", "value": "Add default colors to plot formatting\n" }, { "from": "human", "value": "from __future__ import absolute_import, print_function, unicode_literals\nfrom builtins import dict, str\nimport matplotlib\n\nfontsize=7\n\ndef set_fig_params():\n matplotlib.rcParams['font...
python
chosen
[ { "from": "system", "value": "Correct license in module meta information\n" }, { "from": "human", "value": "from .parser import HTMLTableParser\n\n__author__ = 'Josua Schmid'\n__version__ = '0.1.1'\n__licence__ = 'GPLv3'\n" }, { "from": "gpt", "value": "from .parser import HTMLTableP...
python
chosen
[ { "from": "system", "value": "Load the application before running commands\n" }, { "from": "human", "value": "\"\"\"\nWSGI config for ideascube project.\n\nIt exposes the WSGI callable as a module-level variable named ``application``.\n\nFor more information on this file, see\nhttps://docs.djang...
python
chosen
[ { "from": "system", "value": "fix: Add get_link_doctype method in DocField\n" }, { "from": "human", "value": "# Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors\n# MIT License. See license.txt\n\nfrom __future__ import unicode_literals\n\nfrom frappe.model.document import Docum...
python
chosen
[ { "from": "system", "value": "[heroku] Set DJANGO_SETTINGS_MODULE before importing DjangoWhiteNoise\n" }, { "from": "human", "value": "\"\"\"\nWSGI config for wedding project.\n\nIt exposes the WSGI callable as a module-level variable named ``application``.\n\nFor more information on this file, ...
python
chosen
[ { "from": "system", "value": "Rewrite unicode join test to work with py25\n" }, { "from": "human", "value": "# -*- coding: utf-8 -*-\nimport paver.path\n\nimport sys\nimport os.path\n\ndef test_join_on_unicode_path():\n merged = b'something/\\xc3\\xb6'.decode('utf-8') # there is ö after somet...
python
chosen
[ { "from": "system", "value": "Implement Divine Strength and Stand Against Darkness\n" }, { "from": "human", "value": "from ..utils import *\n\n\n##\n# Minions\n\nclass OG_006:\n\t\"Vilefin Inquisitor\"\n\tplay = Summon(CONTROLLER, \"OG_006b\")\n\nclass OG_006b:\n\t\"The Tidal Hand\"\n\tactivate ...
python
chosen
[ { "from": "system", "value": "Add inputfields for new attributes on careeropportunities and placeholdertext\n" }, { "from": "human", "value": "from django import forms\n\nfrom apps.careeropportunity.models import CareerOpportunity\n\n\nclass AddCareerOpportunityForm(forms.ModelForm):\n descri...
python
chosen
[ { "from": "system", "value": "Fix error on different result structure rendering" }, { "from": "human", "value": "'''\nThis needs it's own module due to import cycles\nas it the class here is referenced in settings.\n'''\n\nfrom rest_framework_csv.renderers import PaginatedCSVRenderer\n\n\nclass ...
python
chosen
[ { "from": "system", "value": "Use filter() instead of get() since the key might be invalid\n" }, { "from": "human", "value": "from django.contrib.auth.models import User\n\nfrom onetime.models import Key\n\nclass OneTimeBackend:\n def authenticate(self, key):\n data = Key.objects.get(k...
python
chosen
[ { "from": "system", "value": "PM-133: Simplify and clean the livestream data logger\n" }, { "from": "human", "value": "from pymoku import Moku, MokuException, NoDataException\nfrom pymoku.instruments import *\nimport time, logging, traceback\n\nlogging.basicConfig(format='%(asctime)s:%(name)s:%(...
python
chosen