conversations
listlengths
2
3
source
stringclasses
1 value
stack
stringclasses
1 value
[ { "from": "system", "value": "Fix for python 2 compatibility\n" }, { "from": "human", "value": "#!/usr/bin/env python\n# encoding: utf-8\n\nfrom __future__ import print_function\nfrom __future__ import unicode_literals\nimport pytablereader\n\nprint(\"\\n\".join([\n \"load from URL\",\n \"...
python
chosen
[ { "from": "system", "value": "Use absolute path for running tests\n" }, { "from": "human", "value": "import sys\nimport pubrunner\nimport pubrunner.command_line\n\ndef test_countwords():\n\t#pubrunner.pubrun('examples/CountWords/',True,True)\n\tsys.argv = ['pubrunner', '--defaultsettings', '--te...
python
chosen
[ { "from": "system", "value": "Add units to Core import.\n" }, { "from": "human", "value": "\"\"\"\nThis package contains core modules and classes for representing structures and\noperations on them.\n\"\"\"\n\n__author__ = \"Shyue Ping Ong\"\n__date__ = \"Dec 15, 2010 7:21:29 PM\"\n\nfrom .perio...
python
chosen
[ { "from": "system", "value": "Clean up strings to use format and add better comments\n" }, { "from": "human", "value": "'''\nManage the state of the hosts file\n'''\n\ndef present(name, ip):\n '''\n Ensures that the named host is present with the given ip\n '''\n ret = {'name': name,...
python
chosen
[ { "from": "system", "value": "Add comments to abstract methods.\n" }, { "from": "human", "value": "\"\"\"\n\nFile: univariate_function.py\n\nPurpose: Class that defines a generic (abstract) univariate function.\n\n\"\"\"\nfrom abc import ABC, abstractmethod\n\n\nclass UnivariateFunction(ABC):\n ...
python
chosen
[ { "from": "system", "value": "Fix Activity CSV field test\n" }, { "from": "human", "value": "import datetime\n\nfrom django.test import TestCase\nfrom journal.models import Activity, Entry\nfrom journal.serializers import ActivitySerializer\n\n\nclass ActivityTestCase(TestCase):\n \"\"\"Sanit...
python
chosen
[ { "from": "system", "value": "Change current language only within context when building search indexes\n" }, { "from": "human", "value": "from django.apps import AppConfig\nfrom django.db.models.signals import post_save\nfrom django.utils import translation\nfrom django.conf import settings\n\nf...
python
chosen
[ { "from": "system", "value": "Add URLs to profile app.\n" }, { "from": "human", "value": "from django.conf.urls.defaults import *\nfrom django.conf import settings\n\n# Uncomment the next two lines to enable the admin:\nfrom django.contrib import admin\nadmin.autodiscover()\n\nurlpatterns = patt...
python
chosen
[ { "from": "system", "value": "Add : Load for redis\n" }, { "from": "human", "value": "#!/usr/bin/python\nimport redis \nimport re\nimport ast\n\n\ndef dump_redis():\n conn = redis.StrictRedis()\n out = {}\n for key in conn.keys():\n if re.search(\":[0-9]*$\", key) is not None:\n...
python
chosen
[ { "from": "system", "value": "fix: Fix Python3 error when decoding the response.\n" }, { "from": "human", "value": "try:\n from urllib.request import urlopen, Request, HTTPError\nexcept ImportError:\n from urllib2 import urlopen, Request, HTTPError\nimport json\n\n\nclass PasteryUploader()...
python
chosen
[ { "from": "system", "value": "Fix error handling to catch if JSON is not returned\n" }, { "from": "human", "value": "import six\n\n\nclass APIError(Exception):\n \"SmartFile API base Exception.\"\n pass\n\n\nclass RequestError(APIError):\n \"\"\" Exception for issues regarding a request...
python
chosen
[ { "from": "system", "value": "Add ability to create question from toolbar\n" }, { "from": "human", "value": "# -*- coding: utf-8 -*-\nfrom django.core.urlresolvers import reverse\nfrom django.utils.translation import ugettext_lazy as _\n\nfrom cms.toolbar_pool import toolbar_pool\nfrom cms.toolb...
python
chosen
[ { "from": "system", "value": "Add a trailing slash to the paginated talk list\n" }, { "from": "human", "value": "from django.conf.urls import patterns, url, include\nfrom rest_framework import routers\n\nfrom wafer.talks.views import (\n Speakers, TalkCreate, TalkDelete, TalkUpdate, TalkView,...
python
chosen
[ { "from": "system", "value": "Adjust test cause user links now use double quotes for attributes\n" }, { "from": "human", "value": "from adhocracy.tests import TestController\nfrom adhocracy.tests.testtools import tt_make_user\n\n\nclass TestText(TestController):\n\n def test_render(self):\n ...
python
chosen
[ { "from": "system", "value": "Add meaningful error for runnign with Python3\n\nIf we detect a Python3 interpreter at module init, tell the user to\nuse Python 2. And be sure to apologize because it's 2019...\n" }, { "from": "human", "value": "from PhonemeDetails import *\nfrom LetterDetails impo...
python
chosen
[ { "from": "system", "value": "Clean up the shell execute() function\n" }, { "from": "human", "value": "import os\nimport subprocess\n\nfrom ..platform_name import platform_name\n\nif platform_name() == 'windows':\n from .windows import *\nelse:\n from .posix import *\n\n\nclass shell_list(...
python
chosen
[ { "from": "system", "value": "Upgrade release number to 0.6.0 (oq-engine 1.3.0)\n" }, { "from": "human", "value": "# The Hazard Library\n# Copyright (C) 2012-2014, GEM Foundation\n#\n# This program is free software: you can redistribute it and/or modify\n# it under the terms of the GNU Affero Ge...
python
chosen
[ { "from": "system", "value": "Fix infinite loop when processing pictures.\n" }, { "from": "human", "value": "from django.db.models.signals import post_save\nfrom django.dispatch import receiver\n\nfrom gallery.tasks import create_thumbnail, process_patient_picture\n\n\n@receiver(post_save, sende...
python
chosen
[ { "from": "system", "value": "Adjust pulling tags in CI\n" }, { "from": "human", "value": "#!/usr/bin/env python3\n\nimport os\nimport subprocess\nimport semver\n\n\ndef tag_to_version(tag):\n return tag.split('-')[1].lstrip('v')\n\n\nsubprocess.check_call('git pull --tags', shell=True)\ntags...
python
chosen
[ { "from": "system", "value": "Move helper to end of module and remove double spaces.\n" }, { "from": "human", "value": "from __future__ import unicode_literals\n\nfrom conllu.models import TokenList\nfrom conllu.parser import parse_token_and_metadata\n\n\ndef parse(data, fields=None):\n retur...
python
chosen
[ { "from": "system", "value": "Disable vim mode in ptpython. Works meh\n" }, { "from": "human", "value": "__all__ = ('configure')\n\ndef configure(repl): \n repl.vi_mode = True\n\n repl.show_signature = True\n repl.show_meta_enter_message = True\n repl.show_line_numbers = True\n ...
python
chosen
[ { "from": "system", "value": "Update release number for pypi release\n" }, { "from": "human", "value": "VERSION = (0, 4, 0, \"a\", 1) # following PEP 386\nDEV_N = 1 # for PyPi releases, set this to None\n\n\ndef get_version(short=False):\n version = \"%s.%s\" % (VERSION[0], VERSION[1])\n i...
python
chosen
[ { "from": "system", "value": "Change the custom UUID column to work right\n" }, { "from": "human", "value": "# -*- coding: utf-8 -*-\n\n\"\"\"Implements custom SQLAlchemy TypeDecorators.\"\"\"\n\nimport uuid\n\nimport sqlalchemy.dialects.postgresql\nfrom sqlalchemy.types import BINARY, TypeDecor...
python
chosen
[ { "from": "system", "value": "Support new conf refactor from Nova\n\nThe core nova project is consolidating their conf options. This\nimpacted the PowerVM conf options as a few that we were explicitly\nimporting were moved.\n\nThis change set fixes the issue and allows PowerVM to work properly.\n\nThe chan...
python
chosen
[ { "from": "system", "value": "Fix for the return value of delete method\n" }, { "from": "human", "value": "from django.db.models import Manager\nfrom django.db.models.query import QuerySet\n\nfrom django.contrib.contenttypes.models import ContentType\nimport itertools\n\nclass VoteQuerySet(Query...
python
chosen
[ { "from": "system", "value": "Extend JSON serialiser to use serialize() method\n\nIf an object is a UUID, return a string representation of it.\n\nIf the object still can't be serialised, call its serialize() method.\nThis is useful when nesting Link models inside dashboards, for\nexample.\n" }, { "...
python
chosen
[ { "from": "system", "value": "Fix race condition involving account usernames.\n\nFix race condition causing random test failures by using get_or_create\non generated usernames. See https://factoryboy.readthedocs.io/en/latest/orms.html#factory.django.DjangoOptions.django_get_or_create\n" }, { "from":...
python
chosen
[ { "from": "system", "value": "Add test for parsing different file types\n\n- Add tests for bzip, gzip and normal files to parser tests.\n" }, { "from": "human", "value": "import tempfile\nimport unittest\n\nimport mock\n\nimport bin.parser\n\n\nclass ParserTest(unittest.TestCase):\n\n def set...
python
chosen
[ { "from": "system", "value": "Remove origin from meme model\n" }, { "from": "human", "value": "from wallace import models, memes, db\n\n\nclass TestMemes(object):\n\n def setup(self):\n self.db = db.init_db(drop_all=True)\n\n def teardown(self):\n self.db.rollback()\n ...
python
chosen
[ { "from": "system", "value": "4: Create script to save documentation to a file \n\nTask-Url: http://github.com/stoeps13/ibmcnx2/issues/issue/4" }, { "from": "human", "value": "######\n# Check ExId (GUID) by Email through JDBC\n#\n# Author: Christoph Stoettner\n# Mail: christop...
python
chosen
[ { "from": "system", "value": "Test for sleep(dt) without extra arg.\n" }, { "from": "human", "value": "\"\"\"Tests for tasks.py.\"\"\"\n\nimport time\nimport unittest\n\nfrom . import events\nfrom . import futures\nfrom . import tasks\n\n\nclass TaskTests(unittest.TestCase):\n\n def setUp(sel...
python
chosen
[ { "from": "system", "value": "Add proxy fix as in lr this will run with reverse proxy\n" }, { "from": "human", "value": "from flask import Flask\nfrom flask.ext.sqlalchemy import SQLAlchemy\nimport os\nfrom .health import Health\n\n\napp = Flask(__name__)\n\napp.config.from_object(os.environ.get...
python
chosen
[ { "from": "system", "value": "Fix missing parentheses in exception\n" }, { "from": "human", "value": "# -*- coding: utf-8 -*-\nfrom src.testers.decorators import requires_userinfo\n\n\n@requires_userinfo\ndef available(test):\n \"\"\"\n Check if MongoDB is compiled with OpenSSL support\n ...
python
chosen
[ { "from": "system", "value": "Order content on profile by most recent.\n" }, { "from": "human", "value": "from django.shortcuts import render\nfrom django.contrib.auth.models import User\nfrom django.http import Http404\nfrom django.views.generic import DetailView\nfrom django.contrib.auth.decor...
python
chosen
[ { "from": "system", "value": "Remove Python 2.6 compat from format\n" }, { "from": "human", "value": "# -*- coding: utf-8 -*-\n\n\"\"\"Functions for finding Cookiecutter templates and other components.\"\"\"\n\nimport logging\nimport os\n\nfrom .exceptions import NonTemplatedInputDirException\n\...
python
chosen
[ { "from": "system", "value": "Use pathlib for path segmentation\n" }, { "from": "human", "value": "from collections import defaultdict\nfrom pathlib import Path\nimport re\nfrom string import Template\nimport sys\n\n\ndef tree():\n return defaultdict(tree)\n\n\nroot = tree()\n\nfor src in Pat...
python
chosen
[ { "from": "system", "value": "Build proper Node in tests after refactoring constructor.\n" }, { "from": "human", "value": "from nose.tools import eq_\nfrom tornado.httpclient import HTTPRequest\nimport uuid\n\nfrom astral.api.tests import BaseTest\nfrom astral.models.node import Node\n\nclass No...
python
chosen
[ { "from": "system", "value": "Change the way that GPIO is verified\n" }, { "from": "human", "value": "import RPi.GPIO as GPIO\n\n\nclass relay():\n def __init__(self, gpio_num):\n self.gpio = gpio_num\n GPIO.setmode(GPIO.BCM)\n try:\n GPIO.input(self.gpio)\n ...
python
chosen
[ { "from": "system", "value": "Update for new docker install\n" }, { "from": "human", "value": "import pytest\n\n@pytest.mark.parametrize(\"name, user, group, mode, contains\", [\n (\"/etc/apt/sources.list.d/docker.list\", \"root\", \"root\", \"0644\", \"deb https://apt.dockerproject.org/repo\")...
python
chosen
[ { "from": "system", "value": "Config: Refactor to allow different connection class bindings.\n" }, { "from": "human", "value": "\"\"\"Cloud configuration.\"\"\"\nfrom cloud_browser.cloud.rackspace import RackspaceConnection\n\n\nclass Config(object):\n \"\"\"Cloud configuration helper.\"\"\"\...
python
chosen
[ { "from": "system", "value": "Add CommandResponse class to use instead of (out, err) tuple\n" }, { "from": "human", "value": "# -*- coding: utf-8 -*-\n\nimport subprocess\n\n\nclass SessionExists(Exception):\n description = \"Session already exists.\"\n pass\n\n\nclass ServerConnectionErro...
python
chosen
[ { "from": "system", "value": "Update the PyPI version to 8.1.2.\n" }, { "from": "human", "value": "# -*- coding: utf-8 -*-\nimport os\n\nfrom setuptools import setup\n\n\ndef read(fname):\n try:\n return open(os.path.join(os.path.dirname(__file__), fname)).read()\n except Exception:...
python
chosen
[ { "from": "system", "value": "Define the log level of the logger instead of the handler." }, { "from": "human", "value": "# -*- coding: utf-8 -*-\n\nimport logging\nfrom logging.handlers import RotatingFileHandler\nfrom knot import Container\nfrom sqlalchemy import create_engine\nfrom .domain im...
python
chosen
[ { "from": "system", "value": "Fix for accidental string continuation.\n" }, { "from": "human", "value": "#!/usr/bin/env python\n\nfrom setuptools import setup, find_packages\n\nREADME = 'README.md'\n\n\ndef long_desc():\n try:\n import pypandoc\n except ImportError:\n with op...
python
chosen
[ { "from": "system", "value": "Prepare for release of 0.0.3\n" }, { "from": "human", "value": "#!/usr/bin/env python\n\nfrom setuptools import setup\n\nsetup(name='tap-awin',\n version='0.0.2',\n description='Singer.io tap for extracting data from the Affiliate Window API',\n autho...
python
chosen
[ { "from": "system", "value": "Rename package so it doesn't clash\n" }, { "from": "human", "value": "import os\nfrom setuptools import setup\n\nNAME = 'sleuth'\nMODULES = ['sleuth']\nDESCRIPTION = 'A minimal Python mocking library'\nURL = \"https://github.com/kazade/sleuth\"\nLONG_DESCRIPTION = o...
python
chosen
[ { "from": "system", "value": "allergies: Rename 'list' to the more pythonic 'lst'\n" }, { "from": "human", "value": "class Allergies:\n\n _allergies = [\n \"eggs\",\n \"peanuts\",\n \"shellfish\",\n \"strawberries\",\n \"tomatoes\",\n \"chocolate\",\n...
python
chosen
[ { "from": "system", "value": "Increment tweepy version to 1.0.1\n" }, { "from": "human", "value": "# Tweepy\n# Copyright 2009 Joshua Roesslein\n# See LICENSE\n\n\"\"\"\nTweepy Twitter API library\n\"\"\"\n__version__ = '1.0'\n\nfrom . models import Status, User, DirectMessage, Friendship, SavedS...
python
chosen
[ { "from": "system", "value": "Improve naive bayes unit test.\n" }, { "from": "human", "value": "import unittest\nimport numpy as np\n\nfrom Orange import data\nimport Orange.classification.naive_bayes as nb\nfrom Orange.evaluation import scoring, testing\n\n\nclass NaiveBayesTest(unittest.TestCa...
python
chosen
[ { "from": "system", "value": "Change record output to strict GeoJSON.\n\nMeaning features in a FeatureCollection.\n" }, { "from": "human", "value": "# The Fiona data tool.\n\nif __name__ == '__main__':\n \n import argparse\n import fiona\n import json\n import pprint\n import s...
python
chosen
[ { "from": "system", "value": "Add `is_acquired` property to FileLock\n" }, { "from": "human", "value": "# -*- encoding: utf-8 -*-\n\nimport os\nimport fcntl\n\nfrom tagcache.utils import open_file\n\n\nclass FileLock(object):\n\n def __init__(self, path):\n\n self.path = path\n\n ...
python
chosen
[ { "from": "system", "value": "Use asserts instead of prints\n" }, { "from": "human", "value": "def powers_of_two(limit):\n value = 1\n while value < limit:\n yield value\n value += value\n\n# Use the generator\nfor i in powers_of_two(70):\n print(i)\n\n# Explore the mechan...
python
chosen
[ { "from": "system", "value": "Remove schedule for ended comic\n" }, { "from": "human", "value": "from comics.aggregator.crawler import CrawlerBase, CrawlerImage\nfrom comics.meta.base import MetaBase\n\nclass Meta(MetaBase):\n name = 'Treading Ground'\n language = 'en'\n url = 'http://w...
python
chosen
[ { "from": "system", "value": "Test with a dedicated plugin now\n" }, { "from": "human", "value": "from lisa.server.plugins.PluginManager import PluginManagerSingleton\nfrom twisted.trial import unittest\n\nimport json\n\nclass LisaClientTestCase_Plugin(unittest.TestCase):\n def setUp(self):\n...
python
chosen
[ { "from": "system", "value": "Add version number notes; set to dev\n" }, { "from": "human", "value": "#######################################################################\n# This file is part of steve.\n#\n# Copyright (C) 2012 Will Kahn-Greene\n#\n# steve is free software: you can redistribut...
python
chosen
[ { "from": "system", "value": "Expand default test years for PUDL to 2011-2015\n\nTests successfully passed for all EIA923 tables ingesting from 2011\nthrough 2015 (2016 still needs some id_mapping or exhaustie ID love).\n" }, { "from": "human", "value": "\"\"\"Tests excercising the pudl module f...
python
chosen
[ { "from": "system", "value": "Tweak the infratest a bit\n" }, { "from": "human", "value": "def test_service_running(Service):\n service = Service('znc')\n assert service.is_running\n\n\ndef test_socket_listening(Socket):\n socket = Socket('tcp://127.0.0.1:6666')\n assert socket.is_li...
python
chosen
[ { "from": "system", "value": "Update guide url to shuup-guide.readthedocs.io\n\nRefs SHUUP-3188\n" }, { "from": "human", "value": "# This file is part of Shuup.\n#\n# Copyright (c) 2012-2016, Shoop Ltd. All rights reserved.\n#\n# This source code is licensed under the AGPLv3 license found in the...
python
chosen
[ { "from": "system", "value": "Fix libmagic issue with Python 3\n" }, { "from": "human", "value": "def _magic_get_file_type(f, _):\n file_type = magic.from_buffer(f.read(1024), mime=True)\n f.seek(0)\n return file_type\n\n\ndef _guess_file_type(_, filename):\n return mimetypes.guess_t...
python
chosen
[ { "from": "system", "value": "Update deployed settings to access mysql.\n" }, { "from": "human", "value": "from settings import *\n\nDEBUG = TEMPLATE_DEBUG = False\nALLOWED_HOSTS = ['pttrack.snhc.wustl.edu']\n\nwith open(os.path.join(BASE_DIR, 'secrets/secret_key.txt')) as f:\n SECRET_KEY = f...
python
chosen
[ { "from": "system", "value": "Use tracer in debug IR interpretation mode\n" }, { "from": "human", "value": "# -*- coding: utf-8 -*-\n\n\"\"\"\nIR interpreter. Run a series of translation phases on a numba function, and\ninterpreter the IR with the arguments.\n\"\"\"\n\nfrom __future__ import pri...
python
chosen
[ { "from": "system", "value": "Set the timezone right after it gets activated.\n" }, { "from": "human", "value": "from django.conf import settings\nfrom django.utils import timezone\nfrom pytz import UnknownTimeZoneError\nfrom .models import TimezoneStore\n\n\nclass TimezonesMiddleware(object):\n...
python
chosen
[ { "from": "system", "value": "Clear sites cache on SiteInfo save\n" }, { "from": "human", "value": "from django.db import models\nfrom django.contrib.sites.models import Site\n\n\nclass DatedModel(models.Model):\n created_time = models.DateTimeField(auto_now_add=True, null=True)\n updated_...
python
chosen
[ { "from": "system", "value": "Fix running nailgun server under Windows\n" }, { "from": "human", "value": "import os\nimport os.path\n\nLOGPATH = os.path.join(os.path.dirname(os.path.abspath(__file__)), \"..\")\nLOGFILE = os.path.join(LOGPATH, \"nailgun.log\")\nLOGLEVEL = \"DEBUG\"\nCELERYLOGFILE...
python
chosen
[ { "from": "system", "value": "main: Print nicer error messages on invalid arguments\n\nSigned-off-by: Kai Blin <ad3597797f6179d503c382b2627cc19939309418@biosustain.dtu.dk>\n" }, { "from": "human", "value": "\"\"\"Command line handling for ncbi-genome-download.\"\"\"\nimport logging\nfrom ncbi_ge...
python
chosen
[ { "from": "system", "value": "Fix product_id filter on content delivery repos\n\nThe value should be an integer.\n\nJIRA: PDC-1104\n" }, { "from": "human", "value": "#\n# Copyright (c) 2015 Red Hat\n# Licensed under The MIT License (MIT)\n# http://opensource.org/licenses/MIT\n#\nimport django_fi...
python
chosen
[ { "from": "system", "value": "Revert \"also removing the un-needed import\"\n\nThis reverts commit 483a88a2c707a3e5d44b9db83c2a7d2184f9acff.\n" }, { "from": "human", "value": "DATABASES = {\n \"default\": {\n \"ENGINE\": \"django.db.backends.postgresql_psycopg2\",\n \"NAME\": \"...
python
chosen
[ { "from": "system", "value": "Write a model class for user posts.\n" }, { "from": "human", "value": "from django.db import models\n\n# Create your models here.\n" }, { "from": "gpt", "value": "from django.db import models\n\n\nclass UserPost(models.Model):\n text = models.TextFiel...
python
chosen
[ { "from": "system", "value": "Add command to quickly open a notes file\n" }, { "from": "human", "value": "import neovim\n\n\n@neovim.plugin\nclass VimpBuffers(object):\n def __init__(self, vim):\n self.vim = vim\n\n @neovim.command(\"ToggleTerminalBuffer\")\n def toggle_terminal_...
python
chosen
[ { "from": "system", "value": "Test transaction list in table is ordered\n" }, { "from": "human", "value": "from __future__ import absolute_import\n\nimport captable\nimport unittest\nimport datetime\nfrom ._helpers import StubTransaction\n\n\nclass TransactionTests(unittest.TestCase):\n \"\"\...
python
chosen
[ { "from": "system", "value": "Make namespace packages work for tests in windows\n" }, { "from": "human", "value": "# coding: utf-8\n\nfrom __future__ import unicode_literals\nfrom __future__ import absolute_import\n\nfrom os.path import join, realpath\n\nimport fs\n\n# Add the local code directo...
python
chosen
[ { "from": "system", "value": "Add calculate hash value method\n" }, { "from": "human", "value": "# Write hashtable class that stores strings in a hash table where keys are calculated using the first two letters of the string\n\nclass HashTable(object):\n\tdef __init__(self):\n\t\tself.table = [N...
python
chosen
[ { "from": "system", "value": "Add RGP request and report\n" }, { "from": "human", "value": "from ..Module import Module\nfrom ..TagData import TagData\n\n\nclass rgp(Module):\n opmap = {\n 'infData': 'descend',\n }\n\n def parse_rgpStatus(self, response, tag):\n statu...
python
chosen
[ { "from": "system", "value": "Update package version for release\n" }, { "from": "human", "value": "__version__ = '0.20.0rc'\n\nfrom dicomweb_client.api import DICOMwebClient\n" }, { "from": "gpt", "value": "__version__ = '0.20.0'\n\nfrom dicomweb_client.api import DICOMwebClient\n" ...
python
chosen
[ { "from": "system", "value": "Make ``path`` context processor return request absolute URI too.\n" }, { "from": "human", "value": "def path(request):\n \"\"\"\n kikola.core.context_processors.path\n ===================================\n\n Adds current path and full path variables to t...
python
chosen
[ { "from": "system", "value": "Update the ups and downs members of the Samples items.\n" }, { "from": "human", "value": "\"\"\"\n Watch Votes stream and update Sample ups and downs\n\"\"\"\n\nimport json\nimport boto3\nimport time\nimport decimal\nimport base64\nfrom boto3.dynamodb.conditions ...
python
chosen
[ { "from": "system", "value": "Include dev comment explaing filename\n" }, { "from": "human", "value": "\n#!/bin/python3\n\nimport math\nimport os\nimport random\nimport re\nimport sys\n\n# Complete the roadsAndLibraries function below.\ndef roadsAndLibraries(n, c_lib, c_road, cities):\n print...
python
chosen
[ { "from": "system", "value": "Make contributor dump a bit more robust\n" }, { "from": "human", "value": "import requests\nurl = \"https://api.github.com/repos/urschrei/pyzotero/contributors\"\nresult = requests.get(url)\nresult.raise_for_status()\nas_dict = result.json()\n# remove me from the li...
python
chosen
[ { "from": "system", "value": "Add support for python 3.5 and 3.6\n" }, { "from": "human", "value": "# renames ABI string in wheels from cp34m or cp35m to none\n\nimport os\n\nfor file in os.listdir('../dist'):\n if '-cp34m-' in file:\n file_parts = file.split('-cp34m-')\n os.ren...
python
chosen
[ { "from": "system", "value": "Add harvard reader to ALL_READERS\n" }, { "from": "human", "value": "# -*- coding: utf-8 -*-\n\nfrom iscc_bench.readers.bxbooks import bxbooks\n\n\nALL_READERS = (bxbooks,)\n" }, { "from": "gpt", "value": "# -*- coding: utf-8 -*-\n\nfrom iscc_bench.reade...
python
chosen
[ { "from": "system", "value": "Add created_at DateTimeField to Twitter example\n" }, { "from": "human", "value": "import json\nfrom urllib2 import urlopen\n\nimport micromodels\n\nclass TwitterUser(micromodels.Model):\n id = micromodels.IntegerField()\n screen_name = micromodels.CharField()...
python
chosen
[ { "from": "system", "value": "Add try for catching server error\n" }, { "from": "human", "value": "from flask import Flask, render_template, url_for, redirect\nfrom flask import session, escape, request\nfrom peewee import *\n#from datetime import date\n\napp = Flask(__name__)\n# http://docs.pee...
python
chosen
[ { "from": "system", "value": "Fix test case bug where wrong URL was being hit\n" }, { "from": "human", "value": "from flask.ext.testing import TestCase\n\nfrom chassis import create_app\nfrom chassis.models import db\nimport factories\n\n\nclass ChassisTestCase(TestCase):\n \"\"\"Base TestCas...
python
chosen
[ { "from": "system", "value": "Stop crashing when search doesn't have any matches\n" }, { "from": "human", "value": "import json\n\nfrom kivy.app import App\nfrom kivy.uix.boxlayout import BoxLayout\nfrom kivy.properties import ObjectProperty\nfrom kivy.network.urlrequest import UrlRequest\n\n\nc...
python
chosen
[ { "from": "system", "value": "Set previous action after executing\n" }, { "from": "human", "value": "\"\"\"\nSt. George Game\nmain.py\nSage Berg, Skyler Berg\nCreated: 5 Dec 2014\n\"\"\"\n\nimport places\nfrom character import Character\nfrom display import Display\nfrom actions import AskAboutA...
python
chosen
[ { "from": "system", "value": "Make test also work on Windows that uses backslash as path delimiter\n" }, { "from": "human", "value": "from nose2.tests._common import FunctionalTestCase\n\n\nclass TestCoverage(FunctionalTestCase):\n def test_run(self):\n proc = self.runIn(\n ...
python
chosen
[ { "from": "system", "value": "Fix redirect_uri issue with tornado reversed url\n\nWhen reversing URLs, tornado doesn't interpret the regex optional symbol\n'?'. This causes the redirect_uri to be\nhttps://example.com/complete/mybackend/? with the question mark\nappended. Some providers will simply append to...
python
chosen
[ { "from": "system", "value": "Add Copyright headers example for StackStorm" }, { "from": "human", "value": "# Copyright 2020 StackStorm Authors.\n# Copyright 2019 Extreme Networks, Inc.\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may not use this file except in...
python
chosen
[ { "from": "system", "value": "Add coreNLP models jar relative path as well\n" }, { "from": "human", "value": "#!/usr/bin/env python\nimport os\n\n\"\"\"\nPerforms some core NLP operations as a proof of concept for the library.\n\"\"\"\n\nfrom stanford_corenlp_pywrapper import CoreNLP\n\nclass S...
python
chosen
[ { "from": "system", "value": "Replace deprecated pd.load with pd.read_pickle.\n" }, { "from": "human", "value": "import unittest\nfrom numpy.testing.decorators import slow\nimport os\nimport pandas as pd\nfrom mr import ptraj\n\npath, _ = os.path.split(os.path.abspath(__file__))\n\nclass TestLab...
python
chosen
[ { "from": "system", "value": "Write tests in a better way\n" }, { "from": "human", "value": "from unittest import TestCase\nfrom ppp_datamodel.communication import Request\nfrom ppp_datamodel import Triple, Resource, Missing, Sentence\nfrom ppp_libmodule.tests import PPPTestCase\n\nfrom ppp_spel...
python
chosen
[ { "from": "system", "value": "Fix import of tmaps extensions\n" }, { "from": "human", "value": "from .gc3pie import GC3PieEngine\ngc3pie_engine = GC3PieEngine()\n\nfrom flask.ext.redis import FlaskRedis\nredis_store = FlaskRedis()\n\nfrom flask.ext.sqlalchemy import SQLAlchemy\ndb = SQLAlchemy()...
python
chosen
[ { "from": "system", "value": "Fix order of tools in the toolbar (translate tool on top)\n\nCURA-838\n" }, { "from": "human", "value": "# Copyright (c) 2015 Ultimaker B.V.\n# Uranium is released under the terms of the AGPLv3 or higher.\n\nfrom . import TranslateTool\n\nfrom UM.i18n import i18nCat...
python
chosen
[ { "from": "system", "value": "Remove the backwards compatibility as it wasn't working for some reason.\n" }, { "from": "human", "value": "\"\"\"\nThe FVCOM Python toolbox (PyFVCOM)\n\n\"\"\"\n\n__version__ = '1.3.4'\n__author__ = 'Pierre Cazenave'\n__credits__ = ['Pierre Cazenave']\n__license__ ...
python
chosen
[ { "from": "system", "value": "Add linux_chromeos_clang to the list of automatic trybots.\n\nBUG=none\nTEST=none\n\n\nReview URL: https://chromiumcodereview.appspot.com/10833037\n\ngit-svn-id: de016e52bd170d2d4f2344f9bf92d50478b649e0@148600 0039d316-1c4b-4281-b951-d872f2087c98\n" }, { "from": "human"...
python
chosen
[ { "from": "system", "value": "Add some checking that stuff is bound\n\nSpecifically we require that request is bound to the form.\n" }, { "from": "human", "value": "# File: csrf.py\n# Author: Bert JW Regeer <bertjw@regeer.org>\n# Created: 2013-01-26\n\nimport colander\nimport deform\n\n@colander...
python
chosen
[ { "from": "system", "value": "Make Organization Number a unique field\n" }, { "from": "human", "value": "from datetime import datetime\n\nfrom django.db import models\n\nfrom .constants import COMPANY_RATING_REPORT, RATING_CHOICES\nfrom .bisnode import get_bisnode_company_report\n\n\ndef bisnode...
python
chosen
[ { "from": "system", "value": "Implement an abstract base class model" }, { "from": "human", "value": "from django.db import models\n\n# Create your models here.\n" }, { "from": "gpt", "value": "from django.db import models\nfrom django.utils.timezone import now\n\n\nclass DateTimeCre...
python
chosen
[ { "from": "system", "value": "Add TEMPLATES configuration for Django v1.10 purposes." }, { "from": "human", "value": "import sys\nimport django\nfrom django.conf import settings\n\nsettings.configure(\n DEBUG=True,\n DATABASES={\n 'default': {\n 'ENGINE': 'django.db.backe...
python
chosen
[ { "from": "system", "value": "Use merge instead of add in setSettingValue\n" }, { "from": "human", "value": "from . import database\n\ndef getAllSettings():\n\tdatabaseConnection = database.ConnectionManager.getConnection(\"main\")\n\tquery = databaseConnection.session.query(database.tables.Sett...
python
chosen