conversations
listlengths
2
3
source
stringclasses
1 value
stack
stringclasses
1 value
[ { "from": "system", "value": "Fix for comparing with the wrong data type.\n" }, { "from": "human", "value": "\"\"\"\nDataWriter.py\n\"\"\"\n\nfrom DataController import DataController\nfrom DataReader import DataReader\nfrom vtk import vtkMetaImageWriter\nfrom vtk import vtkXMLImageDataWriter\n\...
python
chosen
[ { "from": "system", "value": "Change Flask interface to 0.0.0.0\n" }, { "from": "human", "value": "from flask import Flask\n\nclass Driver:\n '''\n Holds the driver state so the flasked script can change behaviour based\n on what the user injects via HTTP\n '''\n name = 'n...
python
chosen
[ { "from": "system", "value": "Add DEFAULT_FROM_EMAIL to default template context\n" }, { "from": "human", "value": "from django.conf import settings\n\ndef site_info(request):\n return {'DOMAIN_URL': settings.DOMAIN_URL,\n 'SECURE_DOMAIN_URL': settings.SECURE_DOMAIN_URL,\n ...
python
chosen
[ { "from": "system", "value": "Remove tvrage from active providers as site is shut down\n" }, { "from": "human", "value": "import asyncio\n\nfrom ..utils import load_plugins, invoke_plugins\nfrom .base import ProviderError\n\nplugins, broken_plugins = load_plugins('providers', ['thetvdb', 'tvrage...
python
chosen
[ { "from": "system", "value": "Add mcmod.info fix for SlopesAndCorners SlimevoidLib dependency\n" }, { "from": "human", "value": "#!/usr/bin/python\n\n# Fixes and mod-specific data for various mods' mcmod.info files\n\nDEP_BLACKLIST = set((\n \"mod_MinecraftForge\", # we always have Forge\n ...
python
chosen
[ { "from": "system", "value": "Use numpy instead of math to allow vectorization\n" }, { "from": "human", "value": "import math\n\ndef f1(x):\n \"\"\"\n Test function 1\n \"\"\"\n return x*x*x - math.pi*x + math.e/100\n" }, { "from": "gpt", "value": "import numpy as npy\n\n...
python
chosen
[ { "from": "system", "value": "Add tags for mobile flags when you need them\n" }, { "from": "human", "value": "from collections import namedtuple\n\n\nTAG_DIMAGI_ONLY = 'Dimagi Only'\n\n\nMobileFlag = namedtuple('MobileFlag', 'slug label tags')\n\n\nSUPERUSER = MobileFlag(\n 'superuser',\n ...
python
chosen
[ { "from": "system", "value": "Print one name at a time.\n" }, { "from": "human", "value": "from __future__ import unicode_literals, print_function\nimport sqlite3, os, random\n\n_select_random = 'select {0} from {1} limit 1 offset abs(random()) % (select count({0}) from {1});'\n_select_uncommon ...
python
chosen
[ { "from": "system", "value": "Fix issue on empty template with premailer\n\nIf premailer receives an empty value, such as an empty string,\non parsing, it returns None and fails when trying to call\n'etree.fromstring()' on this None result.\n\nWe should avoid to call premailer on an empty string, as the res...
python
chosen
[ { "from": "system", "value": "Remove job references from navigation\n" }, { "from": "human", "value": "from django.utils.text import capfirst\nfrom django.utils.translation import ugettext_lazy as _\n\nfrom feincms.module.page.extensions.navigation import NavigationExtension, PagePretender\n\n\n...
python
chosen
[ { "from": "system", "value": "Make the 2 mandatory parameters mandatory.\nMake the help message a bit clearer and provides an example.\n" }, { "from": "human", "value": "#!/usr/bin/env python3\n\n# https://faq.i3wm.org/question/3699/how-can-i-open-an-application-when-i-open-a-certain-workspace-f...
python
chosen
[ { "from": "system", "value": "Update example to use new event API" }, { "from": "human", "value": "from locust import HttpLocust, TaskSet, task, events, between\n\nfrom gevent.lock import Semaphore\n\nall_locusts_spawned = Semaphore()\nall_locusts_spawned.acquire()\n\ndef on_hatch_complete(**kw)...
python
chosen
[ { "from": "system", "value": "Clone git repos if they do not exist.\n" }, { "from": "human", "value": "\"\"\"\nVersion control management tools.\n\n\"\"\"\n\nimport abc\nimport brigit\nfrom docutils import nodes\nfrom docutils.parsers.rst import directives\n\nfrom .tool import Tool, Directive\n\...
python
chosen
[ { "from": "system", "value": "Fix Unicode field in Python 3.2\n" }, { "from": "human", "value": "\"\"\"Domain models fields.\"\"\"\n\n\nclass Field(property):\n \"\"\"Base field.\"\"\"\n\n def __init__(self):\n \"\"\"Initializer.\"\"\"\n self.name = None\n self.value =...
python
chosen
[ { "from": "system", "value": "Rework the versions form widget\n" }, { "from": "human", "value": "from __future__ import unicode_literals\n\nfrom django import forms\nfrom django.contrib.contenttypes.admin import GenericStackedInline\n\nfrom .forms import object_version_choices\nfrom .models impo...
python
chosen
[ { "from": "system", "value": "Use assertIsInstance() instead of assertTrue(isinstance()).\n" }, { "from": "human", "value": "import unittest\nimport appdirs\n\nclass Test_AppDir(unittest.TestCase):\n def test_metadata(self):\n self.assertTrue(hasattr(appdirs, \"__version__\"))\n ...
python
chosen
[ { "from": "system", "value": "Disable secure cookies for admin development.\n" }, { "from": "human", "value": "from datetime import timedelta\nfrom pathlib import Path\n\n\nDEBUG = True\nPERMANENT_SESSION_LIFETIME = timedelta(14)\nSECRET_KEY = b'\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00...
python
chosen
[ { "from": "system", "value": "fix(example): Fix example urlconf to be compatible with Django 2.0\n\n" }, { "from": "human", "value": "from django.conf.urls import include, url\nfrom django.contrib import admin\nfrom django.views.generic.base import TemplateView\nadmin.autodiscover()\n\nurlpatter...
python
chosen
[ { "from": "system", "value": "test_reflect_prop: Add a property tying reflect() and angle()\n" }, { "from": "human", "value": "from ppb_vector import Vector2\nimport pytest\nfrom hypothesis import given, assume, note\nfrom math import isclose, isinf\nfrom utils import units, vectors\n\n\nreflect...
python
chosen
[ { "from": "system", "value": "Fix init_db and clear_db functions\n" }, { "from": "human", "value": "import logging\nfrom contextlib import contextmanager\nfrom sqlalchemy import create_engine\nfrom sqlalchemy.orm import sessionmaker\nfrom sqlalchemy.exc import SQLAlchemyError\nfrom rtrss.excepti...
python
chosen
[ { "from": "system", "value": "Remove info dirs (for now)\n" }, { "from": "human", "value": "import xyz\nimport os\nimport shutil\n\nclass Binutils(xyz.BuildProtocol):\n pkg_name = 'binutils'\n supported_targets = ['arm-none-eabi']\n\n def check(self, builder):\n if builder.target...
python
chosen
[ { "from": "system", "value": "Remove message model as unused\n\nNo need in test class as soon as we have working api " }, { "from": "human", "value": "class MessageModel:\n def __init__(self, message, duration, creation_date, message_category):\n # We will automatically generate the ne...
python
chosen
[ { "from": "system", "value": "Make sure initial migration works for new installs.\n\nBootstrapping the Site model entirely in settings isn't great.\n" }, { "from": "human", "value": "from django.contrib.sites.models import Site\n\n\ndef set_site_info(domain='datahub-local.mit.edu', name='MIT Dat...
python
chosen
[ { "from": "system", "value": "Remove commented code and unused imports\n" }, { "from": "human", "value": "from flask import request, jsonify, session, g\nimport numpy as np\nfrom DatasetCreation import ConstructDataset\n\nfrom . import app\nfrom . import firebase\n\nfrom sklearn.ensemble import ...
python
chosen
[ { "from": "system", "value": "Install gperf on Linux builders\n" }, { "from": "human", "value": "config = {\n 'mock_target': 'mozilla-centos6-x86_64',\n 'mock_packages': ['freetype-devel', 'fontconfig-devel', 'glib2-devel', 'autoconf213', 'git', 'make', 'libX11-devel', 'mesa-libGL-devel', ...
python
chosen
[ { "from": "system", "value": "Remove __init__ since dont need to force style anymore\n\n" }, { "from": "human", "value": "# Config file for IDL demos\n# The IDLs all have comments in //. style\n\nfrom Synopsis.Config import Base\n\nclass Config (Base):\n class Parser:\n\tclass IDL (Base.Parse...
python
chosen
[ { "from": "system", "value": "Make sure we use python2\n" }, { "from": "human", "value": "# from the __future__ package, import division\n# to allow float division\n\nfrom __future__ import division\n\ndef estimate_probs(trigram_counts_dict):\n '''\n # Estimates probabilities of trigrams u...
python
chosen
[ { "from": "system", "value": "Fix xrange to range for supporting python3\n" }, { "from": "human", "value": "# -*- coding: utf-8 -*-\n\"\"\"Example for spinner that looks like loader\n\"\"\"\nfrom __future__ import unicode_literals, absolute_import, print_function\nimport os\nimport time\nimport ...
python
chosen
[ { "from": "system", "value": "Add __eq__, __ne__, __contains__ methods\n" }, { "from": "human", "value": "# encoding: utf-8\n\n'''\n@author: Tsuyoshi Hombashi\n'''\n\n\nclass MinMaxContainer(object):\n\n @property\n def min_value(self):\n return self.__min_value\n\n @property\n ...
python
chosen
[ { "from": "system", "value": "Make test call location independent.\n" }, { "from": "human", "value": "#!/usr/bin/env python\n# vim: set ts=4 sw=4 et sts=4 ai:\n#\n# Test some basic functionality.\n#\n\nimport unittest\nimport os\nimport sys\nsys.path.append('..')\n\n\nclass TestQBasic(unittest.T...
python
chosen
[ { "from": "system", "value": "Add attending as column to Guest\n" }, { "from": "human", "value": "from django.contrib import admin\nfrom rsvp.models import Guest, Location, Table, Event, Hotel, Party, Song\n\nclass AdminModel(admin.ModelAdmin):\n\tlist_display = ['name']\n\nclass GuestAdmin(admi...
python
chosen
[ { "from": "system", "value": "Correct UCI parsing in board state evaluation function\n" }, { "from": "human", "value": "import subprocess\n\nENGINE_BIN = \"stockfish\"\nDEPTH = 20\n\ndef evaluate_position(board, depth=DEPTH):\n \"\"\"Evaluates the board's current position.\n\n Returns the ...
python
chosen
[ { "from": "system", "value": "Update % to .format, add response to gtfo command" }, { "from": "human", "value": "# -*- coding: utf-8 -*-\n\"\"\"\nCreated on Dec 20, 2011\n\n@author: Tyranic-Moron\n\"\"\"\n\nfrom IRCMessage import IRCMessage\nfrom IRCResponse import IRCResponse, ResponseType\nfro...
python
chosen
[ { "from": "system", "value": "Use storage sub-namespace for generic annex\n" }, { "from": "human", "value": "from .base import AnnexBase\n\n__all__ = ('Annex',)\n\n# -----------------------------------------------------------------------------\n\n\ndef get_annex_class(storage):\n if storage =...
python
chosen
[ { "from": "system", "value": "Edit get_sentiment and add get_normalized_sentiment\n" }, { "from": "human", "value": "from textblob import TextBlob\n\n\nclass SentimentAnalysis(object):\n \"\"\"Get sentiment analysis with only positive and negative considered.\n\n Positive means normal logs...
python
chosen
[ { "from": "system", "value": "Fix version tests - don't sort, just reverse\n" }, { "from": "human", "value": "# Tests\n\nimport os\n\nfrom tests.base import BaseTestZSTD\n\nclass TestZSTD(BaseTestZSTD):\n\n def setUp(self):\n if os.getenv(\"ZSTD_EXTERNAL\"):\n self.ZSTD_EXTE...
python
chosen
[ { "from": "system", "value": "Change to use evdev 0.6.4\n\nSigned-off-by: tom <3abfbc22eec6ecd173d744487905db1fa6a502d5@gmail.com>\n" }, { "from": "human", "value": "__author__ = 'tom'\nfrom setuptools import setup\n\n# Makes use of the sphinx and sphinx-pypi-upload packages. To build for local ...
python
chosen
[ { "from": "system", "value": "Change migration to update_file rather than save it\n" }, { "from": "human", "value": "\"\"\"\nSaves every file to have new save() logic index those files.\n\"\"\"\nimport sys\nimport logging\n\nfrom website.app import init_app\nfrom website.files.models.osfstorage ...
python
chosen
[ { "from": "human", "value": "Add tests for feedback submission view.\n\nhttps://trello.com/c/Uak7y047/8-feedback-forms\n" }, { "from": "gpt", "value": "import mock\nfrom ...helpers import BaseApplicationTest\n\n\nclass TestFeedbackForm(BaseApplicationTest):\n def _post(self):\n return ...
python
chosen
[ { "from": "system", "value": "Update leaflet request to be over https\n" }, { "from": "human", "value": "from django.contrib.gis.forms import widgets\n\nclass LeafletPointWidget(widgets.BaseGeometryWidget):\n template_name = 'leaflet/leaflet.html'\n\n class Media:\n css = {\n ...
python
chosen
[ { "from": "system", "value": "Fix certificate regenerating each startup\n" }, { "from": "human", "value": "# Copyright (c) Jupyter Development Team.\n# Distributed under the terms of the Modified BSD License.\n\nfrom jupyter_core.paths import jupyter_data_dir\nimport subprocess\nimport os\nimpor...
python
chosen
[ { "from": "system", "value": "Add bidi (right-to-left layout) attr to locale resource\n" }, { "from": "human", "value": "# Copyright (C) 2015 Andrey Antukh <niwi@niwi.be>\n# Copyright (C) 2015 Jesús Espino <jespinog@gmail.com>\n# Copyright (C) 2015 David Barragán <bameda@dbarragan.com>\n# This p...
python
chosen
[ { "from": "system", "value": "Move import statement so that it was with other local imports\n" }, { "from": "human", "value": "from slot import basic_auth\nfrom flask_login import login_required\n\nfrom slot.main import app\nfrom slot import controller as con\n\n\n@app.route('/')\n@app.route('/d...
python
chosen
[ { "from": "system", "value": "Make db upgrade step 20 more robust.\n\ngit-svn-id: eda3d06fcef731589ace1b284159cead3416df9b@5815 af82e41b-90c4-0310-8c96-b1721e28e2e2\n" }, { "from": "human", "value": "from trac.db import Table, Column, Index, DatabaseManager\r\nfrom trac.core import TracError\r\n...
python
chosen
[ { "from": "system", "value": "Add unique constraint to User.email\n" }, { "from": "human", "value": "# coding: utf-8\nimport datetime\nfrom ._base import db\n\n\nclass User(db.Model):\n id = db.Column(db.Integer, primary_key=True)\n name = db.Column(db.String(50), unique=True)\n email =...
python
chosen
[ { "from": "system", "value": "Modify test to test for nested JSON\n" }, { "from": "human", "value": "\"\"\"Tests for respite.middleware.\"\"\"\n\nfrom nose.tools import *\n\nfrom urllib import urlencode\n\nfrom django.utils import simplejson as json\nfrom django.test.client import Client, Reques...
python
chosen
[ { "from": "system", "value": "Make numba the default implementation, as it beats weave in major parts of the benchmarks now\n" }, { "from": "human", "value": "def dummy_no_impl(*args, **kwargs):\n raise NotImplementedError(\"You may need to install another package (numpy, \"\n ...
python
chosen
[ { "from": "system", "value": "Create post admin form, custom content field\nadd texteditor\n" }, { "from": "human", "value": "# -*- coding: utf-8 -*-\nfrom django.contrib import admin\n\nfrom opps.core.models import Post\n\n\n\nclass PostAdmin(admin.ModelAdmin):\n prepopulated_fields = {\"slu...
python
chosen
[ { "from": "system", "value": "Fix test to work on Linux\n" }, { "from": "human", "value": "# usr/bin/env python3\n# svgTest.py - Test Slither's SVG support\n\nimport slither\n\nif slither.svgSupport:\n print(\"We have SVG support!\")\nelse:\n print(\"No SVGs today :(\")\n\nsvg = slither.Sp...
python
chosen
[ { "from": "system", "value": "Change single test verbosity to 2\n" }, { "from": "human", "value": "import sys\nimport unittest\nfrom unittest import TestSuite\n\n\ndef suite(test_name):\n suite = unittest.TestSuite()\n suite.addTest(unittest.defaultTestLoader.loadTestsFromName(test_name))\...
python
chosen
[ { "from": "system", "value": "Fix KeyError on test with axis\n" }, { "from": "human", "value": "# -*- coding: utf-8 -*-\n\n\nimport datetime\n\nfrom openfisca_tunisia import TunisiaTaxBenefitSystem\nfrom openfisca_tunisia.scenarios import init_single_entity\n\n\ntax_benefit_system = TunisiaTaxBe...
python
chosen
[ { "from": "system", "value": "Use bigint for ip4, fits addresses bigger dan 2^31\n" }, { "from": "human", "value": "from sqlalchemy import Column, Integer, String, BigInteger, ForeignKey\nfrom sqlalchemy.orm import relationship\n\nfrom uchan.database import ModelBase\n\n\nclass Post(ModelBase):\...
python
chosen
[ { "from": "system", "value": "Use global Jinja2 environment in render_template\n\nBefore this patch, a new environment was created in every call of\nrender_template().\n" }, { "from": "human", "value": "import os\n\ndef render_template(template_name, **kwargs):\n from jinja2 import Environmen...
python
chosen
[ { "from": "system", "value": "Create a task for data pushing\n" }, { "from": "human", "value": "import os\nimport time\n\nimport rethinkdb as r\nimport requests\n\nfrom krunchr.vendors.celery import celery, db\n\n\n@celery.task(bind=True)\ndef get_file(self, url, path):\n name, ext = os.path.sp...
python
chosen
[ { "from": "system", "value": "Test builds a number of schools, each of which has a number of subject areas.\n" }, { "from": "human", "value": "from django.test import TestCase\n\nfrom competencies.models import *\nimport testing_utilities as tu\n\nclass TestForkSchools(TestCase):\n\n def setU...
python
chosen
[ { "from": "system", "value": "Use os.path.join for Jar path to make it OS independent\n" }, { "from": "human", "value": "import subprocess, io, shlex, os\nimport pandas as pd\n\ndef read_pdf_table(input_path, options=\"\"):\n jar_path = os.path.abspath(os.path.dirname(__file__))\n JAR_NAME = \...
python
chosen
[ { "from": "system", "value": "Test upload with a small file\n" }, { "from": "human", "value": "import os\nfrom os.path import dirname, join\nimport uuid\n\nimport qiniu.conf\nimport qiniu.io\nimport qiniu.rs\nimport qiniu.rsf\n\n\nQINIU_ACCESS_KEY = os.environ.get('QINIU_ACCESS_KEY')\nQINIU_SECR...
python
chosen
[ { "from": "system", "value": "Update test case for sanitize_sensitive_data\n" }, { "from": "human", "value": "# -*- coding: utf-8 -*-\nfrom __future__ import absolute_import, unicode_literals\nfrom badwolf.utils import sanitize_sensitive_data\n\n\ndef test_sanitize_basic_auth_urls():\n text =...
python
chosen
[ { "from": "system", "value": "Test SPORE crud function descriptions\n" }, { "from": "human", "value": "import unittest\n\ntry:\n import simplejson as json\nexcept ImportError:\n import json\n\nfrom wsme.tests.protocol import WSTestRoot\nimport wsme.tests.test_restjson\nimport wsme.spore\n\...
python
chosen
[ { "from": "system", "value": "Use OAuth20Token only for facebook, google\n" }, { "from": "human", "value": "from django.contrib.auth.models import User\n\nfrom linked_accounts.handlers import AuthHandler\n\nfrom oauth_flow.handlers import OAuth20Token\n\n\nclass LinkedAccountsBackend(object):\n\...
python
chosen
[ { "from": "system", "value": "Update varsnap refresh with new endpoints\n" }, { "from": "human", "value": "\"\"\"\nThis script refreshes production varsnap snaps\n\"\"\"\n\nimport os\n\nfrom syspath import git_root # NOQA\n\nfrom app import serve\n\n\nos.environ['ENV'] = 'production'\napp = ser...
python
chosen
[ { "from": "system", "value": "Make some changes to the bci package file.\n" }, { "from": "human", "value": "from fakebci import FakeBCI" }, { "from": "gpt", "value": "import os\nimport sys\nimport platform\nimport shutil\nimport inspect\n\n#\n#def machine():\n# \"\"\"Return type o...
python
chosen
[ { "from": "system", "value": "Add method for scaling path\n" }, { "from": "human", "value": "import ui\n\n\ndef get_path_image(path):\n \"\"\" Get an image of a path \"\"\"\n bounds = path.bounds\n with ui.ImageContext(bounds.max_x, bounds.max_y) as ctx:\n path.fill()\n re...
python
chosen
[ { "from": "system", "value": "Configure json.dumps() to use an item separator of \",\" instead of the default \", \" to prevent single whitespace at the end of lines.\r\n\r\nWithout this option, all prettyfied JSON has one space at the end of each line, which is not so pretty:\r\n\r\n{\r\n \"key\": \"value...
python
chosen
[ { "from": "system", "value": "Add --host and --port flags\n" }, { "from": "human", "value": "import argparse\nimport logging\nimport timeit\n\nimport cv2\n\nfrom util import Action\nfrom game import GameEnvironment\n\n\ndef main(args):\n if args.debug_frames:\n cv2.namedWindow('debug-f...
python
chosen
[ { "from": "system", "value": "Correct import order in tests init file\n" }, { "from": "human", "value": "# tests.__init__\n\nimport os\nimport os.path\nimport shutil\nimport tempfile\n\nimport yvs.shared as yvs\nfrom mock import patch\n\n\ntemp_dir = tempfile.gettempdir()\nlocal_data_dir_patcher...
python
chosen
[ { "from": "system", "value": "Fix dict argument not hashable\n" }, { "from": "human", "value": "#!/usr/bin/env python\n# vim: set fileencoding=UTF-8 :\n\n\nfrom __future__ import print_function\n\n\nADD_OP = '+'\nMULTIPLY_OP = '*'\n\nOPERATORS = [ADD_OP, MULTIPLY_OP]\n\n\n_cache_map = dict()\n\n...
python
chosen
[ { "from": "system", "value": "Use the phase from the pre-FT'd file for the test FT\n" }, { "from": "human", "value": "# -*- coding: utf-8 -*-\n\"\"\"\nCreated on Mon Sep 30 20:22:29 2013\n\n@author: chris\n\nTest script for the pytnt project\n\"\"\"\n\nimport unittest\n\nfrom numpy.testing impor...
python
chosen
[ { "from": "system", "value": "Copy over train to new test data\n" }, { "from": "human", "value": "import time\n\nfrom clean_tweet import TweetClassifier as TC\nfrom gather_data import GatherData\n\n\ndef run_test(val, expected):\n print \"{0} (exp {1}) >> {2}\".format(t.predict(val), expected...
python
chosen
[ { "from": "system", "value": "[1268] Fix for getting site_user the first time. (A commit herecauses problems during a db write notification. Spotted when harvesting)\n" }, { "from": "human", "value": "import json\n\nimport ckan.model as model\nimport ckan.plugins as p\n\ndef get_site_url(config)...
python
chosen
[ { "from": "system", "value": "Save only 3 packages instead of 10\n" }, { "from": "human", "value": "#!/usr/bin/python2\n# -*- coding: utf-8 -*-\n\nimport os\nimport requests\n\ntoken = os.getenv(\"PACKAGECLOUD_TOKEN\")\nrepository = \"jollheef/henhouse\"\napi_url = \"https://%s:@packagecloud.io/...
python
chosen
[ { "from": "system", "value": "Save error message when cm not imported\n" }, { "from": "human", "value": "\"\"\"R markdown notebook format for Jupyter\n\nUse this module to read or write Jupyter notebooks as Rmd documents (methods 'read', 'reads', 'write', 'writes')\n\nUse the 'pre_save_hook' met...
python
chosen
[ { "from": "system", "value": "Allow the plugin to be compiled from anywhere\n\nBecause we were only using \"src/\" as the path, running build.py from anywhere but the 'plugin' would cause it to fail to locate the directory.\n\nWe're now using a path relative to the file, so it isn't dependant on where the f...
python
chosen
[ { "from": "system", "value": "Set the RELEASE_LINE to hawthorn\n" }, { "from": "human", "value": "\"\"\"\nInformation about the release line of this Open edX code.\n\"\"\"\n\n# The release line: an Open edX release name (\"ficus\"), or \"master\".\n# This should always be \"master\" on the maste...
python
chosen
[ { "from": "system", "value": "Add up all ints (base 10) and floats in the file\n" }, { "from": "human", "value": "import sublime, sublime_plugin\n\nclass SumCommand(sublime_plugin.TextCommand):\n def run(self, edit):\n sum_view = self.view.window().new_file()\n sum_view.set_name...
python
chosen
[ { "from": "system", "value": "Make Python3 friendly. Add appdata check and fix.\n\nConfirmed working on Windows 7 Python 3.4 Installation Now :D" }, { "from": "human", "value": "from os import getenv\nimport sqlite3\nimport win32crypt\n\nappdata = getenv(\"APPDATA\") \nconnection = sqlite3.conne...
python
chosen
[ { "from": "system", "value": "Raise word limit by 50%\n" }, { "from": "human", "value": "import os\nimport json\nfrom random import randrange, seed, sample\n\nMAX_LEN = 50\n\n\ndef shift(s, new):\n space = s.find(' ')\n if space == -1:\n raise Exception('bad shift string ' + s)\n ...
python
chosen
[ { "from": "system", "value": "Improve EmptyField exception string representation\n" }, { "from": "human", "value": "class ValidationError(Exception):\n pass\n\n\nclass EmptyField(ValidationError):\n def __init__(self, field_name):\n self.field_name = field_name\n\n def __str__(se...
python
chosen
[ { "from": "system", "value": "Make sure HOME is set when installing busket. Erlang requires it\n" }, { "from": "human", "value": "\nimport os\nfrom kokki import *\n\nPackage(\"erlang\")\n# ubuntu's erlang is a bit messed up.. remove the man link\nFile(\"/usr/lib/erlang/man\",\n action = \"del...
python
chosen
[ { "from": "system", "value": "Check for the existence of model.objects without calling it; may fix some weird buggy behaviour involving database migrations.\n" }, { "from": "human", "value": "# Copyright (c) Ecometrica. All rights reserved.\n# Distributed under the BSD license. See LICENSE for d...
python
chosen
[ { "from": "system", "value": "Update the echo Function to be similar to the template Function\n" }, { "from": "human", "value": "\"\"\"Created By: Andrew Ryan DeFilippis\"\"\"\n\nprint('Lambda cold-start...')\n\nfrom json import dumps, loads\n\n\ndef lambda_handler(event, context):\n print('L...
python
chosen
[ { "from": "system", "value": "Add use_decimal=True for json encoding\n" }, { "from": "human", "value": "from urlparse import parse_qs\r\nimport DQXUtils\r\nimport simplejson\r\nimport responders\r\n\r\n\r\ndef application(environ, start_response):\r\n returndata = dict((k,v[0]) for k,v in par...
python
chosen
[ { "from": "system", "value": "Update lame test to test on multiple parameters.\n" }, { "from": "human", "value": "# Just barely tests things to make sure they work\n\nfrom uwaterlooapi import UWaterlooAPI; api = UWaterlooAPI(api_key='fda8e642f9c9480800e8c02896744288')\n\nexclude = ['api_key', 'b...
python
chosen
[ { "from": "system", "value": "Make sure to use the Pyramid transaction manager\n" }, { "from": "human", "value": "import logging\nlog = logging.getLogger(__name__)\n\nfrom pyramid.config import Configurator\nfrom sqlalchemy import engine_from_config\n\nfrom .models import DBSession\n\nrequired_s...
python
chosen
[ { "from": "system", "value": "Remove price check from order email template\n\nFor some reason, only lines with prices were rendered in the email. Changed\nthis so that the free lines (from campaigns) are shown also.\n\nNo ref\n" }, { "from": "human", "value": "# -*- coding: utf-8 -*-\n# This fil...
python
chosen
[ { "from": "system", "value": "Add activity logs to auditor tracking\n" }, { "from": "human", "value": "import tracker\n\nfrom auditor.manager import default_manager\nfrom event_manager.event_service import EventService\n\n\nclass AuditorService(EventService):\n \"\"\"An service that just pass...
python
chosen
[ { "from": "system", "value": "Stop resolving paths to the static files.\n\nFixed #33" }, { "from": "human", "value": "import json\nfrom builtins import super\n\nfrom django import forms\nfrom django.templatetags.static import static\n\n\nclass JSONEditorWidget(forms.Widget):\n class Media:\n ...
python
chosen
[ { "from": "system", "value": "Fix bug on images widget CropExample\n" }, { "from": "human", "value": "from django import forms\nfrom django.conf import settings\nfrom django.template.loader import render_to_string\n\n\nclass MultipleUpload(forms.FileInput):\n\n def render(self, name, value, a...
python
chosen
[ { "from": "system", "value": "Make agents able to see each other.\n" }, { "from": "human", "value": "\"\"\"\nModule that holds classes that represent an agent's perception handler.\n\"\"\"\n\nimport abc\nimport world\nimport structure\n\nclass PerceptionHandler(object):\n \"\"\"\n Abstract...
python
chosen
[ { "from": "system", "value": "Fix error while running compare.sh\n\nbash compare.sh \r\n#pyvcf\r\nTraceback (most recent call last):\r\n File \"filter-pyvcf.py\", line 5, in <module>\r\n vcf = Reader(open(sys.argv[1], 'rt'))\r\n File \"/home/raony/.virtualenvs/cuvcf2/lib/python3.5/site-packages/vcf/par...
python
chosen
[ { "from": "system", "value": "Write iface choice to file\n\nThis seems unnecessary but I can't see a way to pass a string back from python, because of the prompt.\r\n\r\n" }, { "from": "human", "value": "#apt-get install python-pip\n#pip install netifaces\nimport netifaces\n\ndef select_iface(if...
python
chosen
[ { "from": "system", "value": "Disable static to get something running" }, { "from": "human", "value": "\"\"\"receipt_tracker URL Configuration\n\nThe `urlpatterns` list routes URLs to views. For more information please see:\n https://docs.djangoproject.com/en/1.10/topics/http/urls/\nExamples:...
python
chosen
[ { "from": "system", "value": "Change EraseBasic's step type from 'Zero' to 'Zeros'\n" }, { "from": "human", "value": "step = {\n '@type': {\n 'type': 'string',\n 'allowed': ['Zero', 'Random'],\n 'required': True\n },\n 'success': {\n 'type': 'boolean',\n ...
python
chosen
[ { "from": "system", "value": "Use get_or_create instead of catching exception\n" }, { "from": "human", "value": "from django.core.management.base import BaseCommand\nfrom django.db import IntegrityError\n\nfrom utils.create_random_data import create_items, create_users, create_orders\n\nfrom sal...
python
chosen
[ { "from": "system", "value": "Fix URL pattern for validating OAuth2 tokens\n" }, { "from": "human", "value": "# Copyright (C) 2014 Universidad Politecnica de Madrid\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may not use this file except in compliance with the Lic...
python
chosen
[ { "from": "system", "value": "Add get_absolute_url to State model\n" }, { "from": "human", "value": "# -*- coding: utf-8 -*-\nfrom __future__ import absolute_import, unicode_literals\n\nfrom localflavor.us.models import USStateField\n\nfrom django.contrib.gis.db import models\nfrom django.utils....
python
chosen
[ { "from": "system", "value": "Add date at the end\n" }, { "from": "human", "value": "# -*- coding: utf-8 -*-\n\nimport json\nfrom collections import defaultdict\nfrom datetime import datetime\nfrom unidecode import unidecode\nfrom .items import Subject\nfrom .spiders.cagr import SEMESTER\n\n\n# ...
python
chosen
[ { "from": "system", "value": "Add proxy method for python2 iterator support\n" }, { "from": "human", "value": "from .base import Base\n\n\nclass List(Base):\n current = None\n\n def __init__(self, result, object_type):\n Base.__init__(self, result)\n self.object_type = object...
python
chosen
[ { "from": "system", "value": "Use modify with the orderbook\n" }, { "from": "human", "value": "from order import Order\nfrom orderbook import OrderBook\nfrom client import FinanceClient\nfrom ordermanager import OrderManager\nfrom strategy import Vanilla, Strawberry\nimport sys\n\n# local server...
python
chosen
[ { "from": "system", "value": "Fix a flow issue (long standing bug)\n" }, { "from": "human", "value": "from django.contrib.comments.forms import CommentForm\nfrom recaptcha_comments.fields import RecaptchaField\n\nclass RecaptchaCommentForm(CommentForm):\n captcha = RecaptchaField()\n\n def...
python
chosen