conversations
listlengths
2
3
source
stringclasses
1 value
stack
stringclasses
1 value
[ { "from": "system", "value": "Build interface w/ docopt and add POD\n" }, { "from": "human", "value": "#!/usr/bin/env python\n\nif __name__ == \"__main__\":\n run()\n" }, { "from": "gpt", "value": "#!/usr/bin/env python\n\n\"\"\"Simple Genetic Algorithm for solving TSP.\n\nUsage:\...
python
chosen
[ { "from": "system", "value": "Fix typos: `dolphine` -> `dolphin`, `kangoroo` -> `kangaroo`\n" }, { "from": "human", "value": "#!/usr/bin/env python\n\"\"\"\nAutocompletion example that displays the autocompletions like readline does by\nbinding a custom handler to the Tab key.\n\"\"\"\nfrom __fu...
python
chosen
[ { "from": "system", "value": "Fix --check-fips invocation in test\n" }, { "from": "human", "value": "import unittest\n\nfrom .util import (DestructiveYubikeyTestCase, is_fips, ykman_cli)\n\n\nclass TestYkmanInfo(DestructiveYubikeyTestCase):\n\n def test_ykman_info(self):\n info = ykman...
python
chosen
[ { "from": "system", "value": "Add helper to paginate results\n" }, { "from": "human", "value": "def get_query_criterions_from_request(request):\n \"\"\"\n Turn request parameters into a dict where keys are attributes to filter and\n values are values to filter.\n \"\"\"\n criterio...
python
chosen
[ { "from": "system", "value": "Delete unused module local constants.\n" }, { "from": "human", "value": "import collections\nimport re\n\nfrom data import crossword, warehouse\nfrom puzzle.problems.crossword import _base_crossword_problem\n\n_CROSSWORD_REGEX = re.compile(r'^.*\\(([\\d\\s,|]+)\\)$'...
python
chosen
[ { "from": "system", "value": "Fix verson number in tests\n" }, { "from": "human", "value": "#!/usr/bin/python\n# -*- coding: utf-8 -*-\n\n# libthumbor - python extension to thumbor\n# http://github.com/heynemann/libthumbor\n\n# Licensed under the MIT license:\n# http://www.opensource.org/license...
python
chosen
[ { "from": "system", "value": "Set version to 0.5.2 to publish on Pypi\n" }, { "from": "human", "value": "#!/usr/bin/env python\n# -*- coding: utf-8 -*-\n\n\n\"\"\"\n Alignak REST backend client library\n\n This module is a Python library used the REST API of the Alignak backend\n\"\"\"\n# ...
python
chosen
[ { "from": "system", "value": "Handle responses without JSON or detail field\n\nCheck the response for JSON and a detail field before trying to access\nthem within SmartFileResponseException. This could occur if the server\nreturns a 500.\n" }, { "from": "human", "value": "from requests.exceptio...
python
chosen
[ { "from": "system", "value": "Make UnionFind.unite return whether the operation was successful\n" }, { "from": "human", "value": "\nclass UnionFind(object):\n \"\"\"A collection of distjoint sets.\"\"\"\n\n def __init__(self, n = 0):\n \"\"\"Creates a collection of n disjoint unit s...
python
chosen
[ { "from": "system", "value": "Remove unwanted prints in management command\n" }, { "from": "human", "value": "from django.core.management.base import BaseCommand\nfrom django.utils import timezone\n\nfrom salt_observer.models import Minion\nfrom . import ApiCommand\n\nimport json\n\n\nclass Comm...
python
chosen
[ { "from": "system", "value": "Add handler for case of HTTP errors case.\n\nAdded a try/catch to url requests to handle errors.\n" }, { "from": "human", "value": "from bs4 import BeautifulSoup\nfrom urllib.request import urlopen\nfrom urllib.request import Request\nfrom .const import constant\n\n...
python
chosen
[ { "from": "system", "value": "Add callbacks to matchzoo root scope.\n" }, { "from": "human", "value": "from pathlib import Path\n\nUSER_DIR = Path.expanduser(Path('~')).joinpath('.matchzoo')\nif not USER_DIR.exists():\n USER_DIR.mkdir()\nUSER_DATA_DIR = USER_DIR.joinpath('datasets')\nif not U...
python
chosen
[ { "from": "system", "value": "Add enrichment function in gsa module\n" }, { "from": "human", "value": "\"\"\"Gene Set Analysis Module\n\"\"\"\nfrom GeneSetCollection import GeneSetCollection\n" }, { "from": "gpt", "value": "\"\"\"Gene Set Analysis Module\n\"\"\"\nfrom GeneSetCollecti...
python
chosen
[ { "from": "system", "value": "Add send_push_notification function and separate android and ios functions\n" }, { "from": "human", "value": "from django.conf import settings\nimport requests\n\n\ndef send_message_android(destination, title, message):\n headers = {\n 'Authorization': 'ke...
python
chosen
[ { "from": "system", "value": "Make sure the exchange is there first\n" }, { "from": "human", "value": "import json\nimport pika\n\n\nclass Publisher(object):\n\n def __init__(self, rabbit_url, exchange):\n self._rabbit_url = rabbit_url\n self._exchange = exchange\n self._...
python
chosen
[ { "from": "system", "value": "Include activations in Sequential example.\n" }, { "from": "human", "value": "\"\"\"Combinators of modules, such as a Sequential.\"\"\"\n\nfrom typing import Callable, Sequence\n\nfrom flax.linen.module import Module\n\nclass Sequential(Module):\n \"\"\"Applies a l...
python
chosen
[ { "from": "system", "value": "Test HTTP access to server before saving server config\n" }, { "from": "human", "value": "# ==============================\n# Copyright 2011 Whamcloud, Inc.\n# ==============================\n\nfrom hydra_agent.plugins import AgentPlugin\n\n\ndef set_server_conf(arg...
python
chosen
[ { "from": "system", "value": "Change name of config repo for api-libs component\n\nSigned-off-by: Jon Ludlam <e7e3380887a8f95cc9dc4f0d51dedc7e849a287a@eu.citrix.com>\n" }, { "from": "human", "value": "#!/usr/bin/env python\n\nimport os\n\ncomponent = os.getenv(\"COMPONENT\")\n\nif component == \...
python
chosen
[ { "from": "system", "value": "Validate that the input file ends with .jiradoc\n" }, { "from": "human", "value": "# ------------------------------------------------------------\n# __main__.py\n#\n# The main program which expects a jiradoc formatted file to\n# be passed in as a cmdline option. It ...
python
chosen
[ { "from": "system", "value": "Remove internationalization because its not needed.\n" }, { "from": "human", "value": "###\n# Copyright (c) 2012-2013, spline\n# All rights reserved.\n#\n#\n###\n\nimport supybot.conf as conf\nimport supybot.registry as registry\nfrom supybot.i18n import PluginInter...
python
chosen
[ { "from": "system", "value": "Add object-oriented-style lookups for filsys, passwd, and uid lookups\n\nThe filsys entry parsing code is taken from pyHesiodFS and was explicitly\nrelicensed under the MIT license by Quentin Smith <quentin@mit.edu>\n" }, { "from": "human", "value": "#!/usr/bin/env ...
python
chosen
[ { "from": "system", "value": "Add docstrings to dynmen.new_dmenu and dynmen.new_rofi\n" }, { "from": "human", "value": "# -*- coding: utf-8 -*-\n\"\"\"\ndynmen - A simple python interface to dynamic menus like dmenu or rofi\n\nimport dynmen\nmenu = dynmen.Menu(['dmenu', '-fn', 'Sans-30'])\noutpu...
python
chosen
[ { "from": "system", "value": "Check that export-contacts is included in the top-level command.\n" }, { "from": "human", "value": "\"\"\" Tests for go_cli.main. \"\"\"\n\nfrom unittest import TestCase\n\nfrom click.testing import CliRunner\n\nfrom go_cli.main import cli\n\n\nclass TestCli(TestCas...
python
chosen
[ { "from": "system", "value": "Use regular send() instead of our writev()\n\nBuffering is apparently more rewarding performance-wise than using\nzero-copy vectorised I/O ala writev(), hence there's no point to keep\nusing our homemade write() extension.\n" }, { "from": "human", "value": "# -*- co...
python
chosen
[ { "from": "system", "value": "[ZA] Move party name to defaults argument\n\nSome party names have changed, but the slug remains the same, so to\navoid errors move the name to the defaults sections so it's not checked\nfor existing parties.\n" }, { "from": "human", "value": "import unicodecsv\n\nf...
python
chosen
[ { "from": "system", "value": "Replace `cls` argument with `self`\nNot sure if this was originally intended to be a `@classmethod` but it's now written and called as a method bound to an instance of the class.\n" }, { "from": "human", "value": "from datetime import datetime, date\n\nfrom sqlalche...
python
chosen
[ { "from": "system", "value": "Update excel_to_base64 to always close file handles\n" }, { "from": "human", "value": "\"\"\"Utils.\"\"\"\n\nfrom base64 import b64encode\n\nimport pandas as pd\n\n\ndef dataframe_to_base64(df: pd.DataFrame) -> str:\n \"\"\"Converts a dataframe to a base64-encode...
python
chosen
[ { "from": "system", "value": "Add type addaptation methods for generic field class.\n" }, { "from": "human", "value": "# -*- coding: utf-8 -*-\n\nfrom __future__ import unicode_literals, absolute_import\n\n\nclass SearchBackend(object):\n pass\n\n\nclass Field(object):\n \"\"\"\n Base c...
python
chosen
[ { "from": "system", "value": "Change definition of schema_version table\n" }, { "from": "human", "value": "from contextlib import contextmanager\n\n\nclass DatabaseMigratable:\n def __init__(self, conn):\n self.conn = conn\n\n @contextmanager\n def create_resource(self):\n ...
python
chosen
[ { "from": "system", "value": "Fix double indentation error in FFApi class\n" }, { "from": "human", "value": "from datetime import datetime\nfrom pprint import pformat\nfrom re import search as re_search\nfrom re import sub as re_sub\n\n\nclass FFApi:\n def __init__(self, content):\n ...
python
chosen
[ { "from": "system", "value": "Remove the syncing tests from the list.\n" }, { "from": "human", "value": "from apps.videos.tests.celery_tasks import *\nfrom apps.videos.tests.downloads import *\nfrom apps.videos.tests.feeds import *\nfrom apps.videos.tests.following import *\nfrom apps.videos.tes...
python
chosen
[ { "from": "system", "value": "Add an dummy import statement so that freeze programs pick up _internal.p\n\ngit-svn-id: 77a43f9646713b91fea7788fad5dfbf67e151ece@3807 94b884b6-d6fd-0310-90d3-974f1d3f35e1\n" }, { "from": "human", "value": "\nfrom info import __doc__\nfrom numpy.version import versi...
python
chosen
[ { "from": "system", "value": "Solve minor import problems with submodules\n" }, { "from": "human", "value": " # Module of Gaussian Mixture models for python\n \n__all__ = ['batch','online']" }, { "from": "gpt", "value": " # Module of Gaussian Mixture models for python\nimport megamix...
python
chosen
[ { "from": "system", "value": "Revert \"Fixed bug with imports\"\n\nThis reverts commit 7b63b268a002a0ceb0b7bb2c6c57237bf6d5f25b.\n" }, { "from": "human", "value": "# -*- coding: utf-8 -*-\n\"\"\"\nCreated on Wed Feb 24 11:01:10 2016\n\n@author: ererkka\n\"\"\"\n\n__version__ = '1.2.2'\n" }, ...
python
chosen
[ { "from": "system", "value": "Add test case for resources docs page\n" }, { "from": "human", "value": "from django.test import Client, TestCase\nfrom django.core.urlresolvers import reverse\n\nimport views\n\n\nclass DocsTestCase(TestCase):\n def setUp(self):\n self.client = Client()\n...
python
chosen
[ { "from": "system", "value": "Make this test a bit harder.\n" }, { "from": "human", "value": "import unittest\n\nfrom flask import Flask\nfrom flask.ext.autodoc import Autodoc\n\n\nclass TestAutodocWithFlask(unittest.TestCase):\n def setUp(self):\n self.app = Flask(__name__)\n s...
python
chosen
[ { "from": "system", "value": "Ch03: Declare Meta class in NewsLink model. [skip ci]\n" }, { "from": "human", "value": "from django.db import models\n\n\n# Model Field Reference\n# https://docs.djangoproject.com/en/1.8/ref/models/fields/\n\n\nclass Tag(models.Model):\n name = models.CharField(...
python
chosen
[ { "from": "system", "value": "Add house number to street label within address form\n" }, { "from": "human", "value": "def _():\n return 1\n\n\n_(u'Price excludes tax')\n_(u'Price includes tax')\n_(u'Street')\n_(u'Left')\n_(u'Right')\n_(u'Average Rating')\n_(u'Zip Code')\n_(u'Last Order Number...
python
chosen
[ { "from": "system", "value": "Change on the regex variable such that it distinguish warnings from errors.\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# Lice...
python
chosen
[ { "from": "system", "value": "Add -v and -q options for more or less output\n" }, { "from": "human", "value": "import asyncore\nimport logging\nimport multiprocessing\nimport os\nimport sys\n\nsys.path.insert(0,\n os.path.abspath(os.path.join(os.path.dirname(__file__), '../')))\n\nfrom mopidy...
python
chosen
[ { "from": "system", "value": "Create tabular q-function with kwarg random_state\n" }, { "from": "human", "value": "from ..learner import Learner\nfrom ..policies import RandomPolicy\nfrom ..value_functions import TabularQ\nfrom ...utils import check_random_state\n\n\nclass Sarsa(Learner):\n\n ...
python
chosen
[ { "from": "system", "value": "Remove line which was preventing stdout redirect\n\nI think this line tries to send stdout and stderr to the same file. I'm\nnot really sure why removing it causes the later specification of the\nstdout and stderr lines to be respected, but we don't want them in the\nsame file ...
python
chosen
[ { "from": "system", "value": "Use own model class on github task\n" }, { "from": "human", "value": "import datetime\nfrom goodtablesio.models.user import User\nfrom goodtablesio.models.source import Source\nfrom goodtablesio.services import database\nfrom goodtablesio.celery_app import celery_ap...
python
chosen
[ { "from": "system", "value": "Refactor to give faster solution\n" }, { "from": "human", "value": "def divisor_generator(n):\n big_factors = {1}\n for i in range(2, n):\n if i in big_factors:\n break\n if n % i == 0:\n big_factors.add(n // i)\n ...
python
chosen
[ { "from": "system", "value": "Use the base64 module for testing rather than md5 which is deprecated in python2.6\n" }, { "from": "human", "value": "\nimport tserver, sys, md5, math\nfrom disco import Disco, result_iterator\n\ndef data_gen(path):\n return path[1:] + \"\\n\"\n\ndef fun_map(...
python
chosen
[ { "from": "system", "value": "Fix the event APIv2 to account for retrieval of a single event.\n" }, { "from": "human", "value": "'''\nApi for the events app\n'''\nimport datetime\nfrom models import Event\nfrom tastypie.utils import trailing_slash\nfrom apis.resources.base import BaseResource\nf...
python
chosen
[ { "from": "system", "value": "Patch mnist example to specify theano for keras.\n" }, { "from": "human", "value": "from fabric.api import task, local, run, lcd, cd, env\nfrom os.path import exists as file_exists\nfrom fabtools.python import virtualenv\nfrom os import path\n\n\nPWD = path.join(pat...
python
chosen
[ { "from": "system", "value": "Switch to a ClueState class instead of just a dictionary\n\nThis makes the syntax a little easier to read, (such as \"st.count\"\ninstead of \"st['count']\").\n" }, { "from": "human", "value": "from __future__ import unicode_literals\n# don't convert to ascii in py2...
python
chosen
[ { "from": "system", "value": "Change listen(0) to listen(1) for Solaris 2 sockets\n" }, { "from": "human", "value": "#! /usr/local/bin/python\n\n# Python implementation of an 'echo' tcp server: echo all data it receives.\n#\n# This is the simplest possible server, sevicing a single request only....
python
chosen
[ { "from": "system", "value": "Make all astroplan warnings decend from an AstroplanWarning\n" }, { "from": "human", "value": "# Licensed under a 3-clause BSD style license - see LICENSE.rst\nfrom __future__ import (absolute_import, division, print_function,\n unicode_litera...
python
chosen
[ { "from": "system", "value": "Rename variable name from \"val\" to \"node\".\n" }, { "from": "human", "value": "# coding: utf-8\n\n\"\"\"\nExposes a class that represents a parsed (or compiled) template.\n\n\"\"\"\n\n\nclass ParsedTemplate(object):\n\n \"\"\"\n Represents a parsed or compi...
python
chosen
[ { "from": "system", "value": "Set up the app registry when running tests on django 1.7\n\n(cherry picked from commit 7b3c994758254f16e8f47bf0f13b363d98082f20)\nSigned-off-by: Antoine Catton <4589f2e060cef08c47d868a06754605a848a1006@fusionbox.com>\n" }, { "from": "human", "value": "#!/usr/bin/env...
python
chosen
[ { "from": "system", "value": "Update : extra_setup compiles code, and runs it into custom global context\n" }, { "from": "human", "value": "from functools import wraps\n\n\ndef extra_setup(setup_code):\n \"\"\"Allows to setup some extra context to it's decorated function.\n\n As a conventi...
python
chosen
[ { "from": "system", "value": "Revert \"Use new metric_bool function\"\n\nThis reverts commit e186b59c83f187900ce4bfd8b02b735d068434bb.\n" }, { "from": "human", "value": "#!/usr/bin/env python\n\nfrom maas_common import (status_ok, status_err, metric, metric_bool,\n get_au...
python
chosen
[ { "from": "system", "value": "Add contact email to context.\n" }, { "from": "human", "value": "from django.conf import settings\nfrom django.contrib.sites.models import Site\nfrom settings import DeploymentType\n\ndef default(request):\n context = {}\n context['DEPLOYMENT'] = settings.DEPL...
python
chosen
[ { "from": "system", "value": "Add try block to argv remove statement\n\nWhen running nose-watch withing an environment like django-nose argv doesn't contain any arguments to remove.\n" }, { "from": "human", "value": "import sys\nfrom nose.plugins import Plugin\nfrom subprocess import Popen\n\n\n...
python
chosen
[ { "from": "system", "value": "Use more appropriate status code\n" }, { "from": "human", "value": "\nfrom . import settings\n\nfrom django.http import HttpResponse\n\nimport time\nimport redis\n\n# Connection pool\nPOOL = redis.ConnectionPool(**settings.REDIS)\n\nclass RatedMiddleware(object):\n\...
python
chosen
[ { "from": "system", "value": "Remove redundant csv2iati test now site has been decommissioned\n" }, { "from": "human", "value": "import pytest\nfrom web_test_base import *\n\nclass TestCSV2IATI(WebTestBase):\n requests_to_load = {\n 'CSV2IATI Homepage': {\n 'url': 'http://cs...
python
chosen
[ { "from": "system", "value": "Add basic test to assert same shape of seg and gt\n" }, { "from": "human", "value": "import numpy as np\nfrom numpy.testing import assert_equal\nfrom gala import evaluate as ev\n\ndef test_contingency_table():\n seg = np.array([0, 1, 1, 1, 2, 2, 2, 3])\n gt = ...
python
chosen
[ { "from": "system", "value": "Fix bug in url creation.\n" }, { "from": "human", "value": "# Gets a list of services from the service resolver for each query. The module then\n# requests each service with the query in async fashion and returns a json response\nimport requests\nimport string\nimpo...
python
chosen
[ { "from": "system", "value": "Remove deprecated SL 'syntax' property override\n\nReplaced by 'defaults/selector':\nhttp://www.sublimelinter.com/en/stable/linter_settings.html#selector\n" }, { "from": "human", "value": "#\n# linter.py\n# Markdown Linter for SublimeLinter, a code checking framewor...
python
chosen
[ { "from": "system", "value": "Add @property for network layer inputs\n" }, { "from": "human", "value": "import numpy as np\nimport theano\nimport theano.tensor as T\nfrom theano.tensor.nnet import conv\nfrom theano.tensor.nnet import softmax\nfrom theano.tensor import shared_randomstreams\nfrom ...
python
chosen
[ { "from": "system", "value": "Send contact us message from the email the user inputted on the site or use the default setting\n" }, { "from": "human", "value": "\"\"\"\nCONTACT APP\n\nThis module provides a variety of tasks to be queued by Celery.\n\nClasses:\n n/a\n\nFunctions:\n email_co...
python
chosen
[ { "from": "system", "value": "Make thread name argument optional\n" }, { "from": "human", "value": "\"\"\"\nweitersager.util\n~~~~~~~~~~~~~~~~\n\nUtilities\n\n:Copyright: 2007-2021 Jochen Kupperschmidt\n:License: MIT, see LICENSE for details.\n\"\"\"\n\nimport logging\nfrom logging import Format...
python
chosen
[ { "from": "system", "value": "Set the exit code when running tests correctly\n" }, { "from": "human", "value": "#!/usr/bin/env python\nimport os\nimport unittest\nfrom flask.ext.script import Manager, Server\nfrom app import app\n\n\nmanager = Manager(app)\n\n\nserver = Server(host='0.0.0.0', us...
python
chosen
[ { "from": "system", "value": "Add some notes on database setup\n" }, { "from": "human", "value": "#!/usr/bin/env python\n\"\"\"\nRun the Varda REST server.\n\nTo reset the database:\n\n from varda import db\n db.drop_all()\n db.create_all()\n\n\"\"\"\n\n\nfrom flaskext.script import Man...
python
chosen
[ { "from": "system", "value": "Add convenience imports for models\n" }, { "from": "human", "value": "# -*- coding: utf-8 -*-\nfrom __future__ import absolute_import\n\nfrom teamsupport.services import TeamSupportService\n\n__author__ = 'Yola Engineers'\n__email__ = 'engineers@yola.com'\n__version...
python
chosen
[ { "from": "system", "value": "Add new line at end of file\n" }, { "from": "human", "value": "\nclass PyhunterError(Exception):\n \"\"\"\n Generic exception class for the library\n \"\"\"\n pass\n\n\nclass MissingCompanyError(PyhunterError):\n pass\n\n\nclass MissingNameError(Pyhun...
python
chosen
[ { "from": "system", "value": "Set the datadirectory to be that of the repo.\n" }, { "from": "human", "value": "from twisted.trial import unittest\n\nfrom ooni.settings import config\n\n\nclass ConfigTestCase(unittest.TestCase):\n def setUp(self):\n config.initialize_ooni_home(\"ooni_ho...
python
chosen
[ { "from": "system", "value": "Remove Cyl1DMesh from init file...\n" }, { "from": "human", "value": "from TensorMesh import TensorMesh\nfrom CylMesh import CylMesh\nfrom Cyl1DMesh import Cyl1DMesh\nfrom LogicallyRectMesh import LogicallyRectMesh\nfrom TreeMesh import TreeMesh\nfrom BaseMesh impor...
python
chosen
[ { "from": "system", "value": "Add option to unregister externals\n" }, { "from": "human", "value": "class ExternalManager(object):\n \"\"\"\n Manager the active externals\n \"\"\"\n def __init__(self, processors=None, optimizers=None):\n self.processors = processors if process...
python
chosen
[ { "from": "system", "value": "Include utils in base import\n" }, { "from": "human", "value": "#\n# Copyright (c) 2011-2014 LabKey Corporation\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 obt...
python
chosen
[ { "from": "system", "value": "Add lines to shut flake8 up.\n" }, { "from": "human", "value": "# vim: set fileencoding=utf-8\n\nimport sys\n\ntry:\n import readline\n # No idea if this is a license violation. Hope it isn't.\nexcept ImportError:\n print(\"Could not find readline, you will...
python
chosen
[ { "from": "system", "value": "Add placeholder text to URL form field\n" }, { "from": "human", "value": "# -*- coding: utf-8 -*-\nfrom flask_wtf import Form\nfrom flask_wtf.recaptcha import RecaptchaField, Recaptcha\nfrom wtforms import StringField, validators\n\nfrom .validation import not_black...
python
chosen
[ { "from": "system", "value": "Add call to random.seed() and change print statement to print function.\n" }, { "from": "human", "value": "# -*- coding: utf-8 -*-\nimport random\nimport webbrowser\n\nfrom pythonkc_meetups import PythonKCMeetups\nfrom optparse import OptionParser\n\n\ndef raffle_ti...
python
chosen
[ { "from": "system", "value": "Add shebang for Python to sample script\n" }, { "from": "human", "value": "import subprocess\nimport urllib\n\ndef main():\n api_url = 'https://uw-alert.herokuapp.com/check_availability'\n courses = [{'level': 'under',\n 'session': 1151,\n ...
python
chosen
[ { "from": "system", "value": "Add Comment Model for Photo and Album\n" }, { "from": "human", "value": "from google.appengine.ext import ndb\n\n\nclass Photo(ndb.Model):\n name = ndb.StringProperty()\n blob_info_key = ndb.BlobKeyProperty()\n date_created = ndb.DateTimeProperty(auto_now_a...
python
chosen
[ { "from": "system", "value": "Upgrade instance type due to RAM issues\n" }, { "from": "human", "value": "import boto3\nimport logging\n\nlogger = logging.getLogger()\nlogger.setLevel(logging.INFO)\n\ndef lambda_handler(event, context):\n ec2 = boto3.resource('ec2')\n\n with open('env.sh') ...
python
chosen
[ { "from": "system", "value": "Put the gc_content bug back.\n" }, { "from": "human", "value": "#!/usr/bin/env python2\n\nfrom __future__ import division\n\ndef reverse(seq):\n \"\"\"Return the reverse of the given sequence (i.e. 3' to \n 5').\"\"\"\n return seq[::-1]\n\ndef complement(se...
python
chosen
[ { "from": "system", "value": "Add action to zero out tips for given match\n" }, { "from": "human", "value": "from django.contrib import admin\nfrom .models import Match\nfrom .models import Tip\n\ndef delete_tips(modeladmin, request, queryset):\n for match in queryset:\n tips = Tip.obj...
python
chosen
[ { "from": "system", "value": "Reduce minor duplication in lifecycle test.\n" }, { "from": "human", "value": "from threading import Thread\nfrom Queue import Queue\n\nfrom doubles import lifecycle\n\n\nclass TestLifecycle(object):\n def test_stores_a_space_per_thread(self):\n queue = Qu...
python
chosen
[ { "from": "system", "value": "Print stuff when module is imported.\n" }, { "from": "human", "value": "import requests\nclass Bit:\n def __init__(self, auth_token, device_id):\n self.token = auth_token\n self.id = device_id\n self.version = '0.1.0'\n self.headers = ...
python
chosen
[ { "from": "system", "value": "Extend chstrings smoke test a little more.\n" }, { "from": "human", "value": "import chstrings\nimport config\n\nimport unittest\n\nclass CHStringsTest(unittest.TestCase):\n @classmethod\n def add_smoke_test(cls, cfg):\n def test(self):\n # W...
python
chosen
[ { "from": "system", "value": "Update ioc storage path for the raw tiffs.\n" }, { "from": "human", "value": "from ophyd.controls.area_detector import (AreaDetectorFileStoreHDF5,\n AreaDetectorFileStoreTIFF,\n AreaDe...
python
chosen
[ { "from": "system", "value": "Add newline at end of file\n" }, { "from": "human", "value": "from twilio.rest import TwilioRestClient\nimport config\n\n\nclient = TwilioRestClient(account_sid, auth_token)\n\nmessage = client.messages.create(to=\"+12316851234\", from_=\"+15555555555\",\n ...
python
chosen
[ { "from": "system", "value": "Add some details to docs\n" }, { "from": "human", "value": "\"\"\":mod:`cliche.services` --- Interfacing external services\n~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\n\nHow to add a new external service\n---------------------------------\n\nIn orde...
python
chosen
[ { "from": "system", "value": "Add a class for sign button \n\nWhat will make it easier to manipulate the theme" }, { "from": "human", "value": "from django.forms import ModelForm\nfrom django import forms\nfrom django.forms.widgets import TextInput\nfrom django.core.urlresolvers import reverse\...
python
chosen
[ { "from": "system", "value": "Update management command to check if a list of URNs is present in the database\n" }, { "from": "human", "value": "import csv\nfrom django.core.management.base import BaseCommand\n\n\nfrom apps.plea.models import DataValidation, Case\nfrom apps.plea.standardisers im...
python
chosen
[ { "from": "system", "value": "Add support for linkage in b2 projects\n" }, { "from": "human", "value": "import os\nimport subprocess\n\nfrom .. import project\n\n\nclass BoostBuildProject(project.Project):\n\n @staticmethod\n def identifier():\n return 'boostbuild'\n\n @staticmet...
python
chosen
[ { "from": "system", "value": "TST: Remove doct from the equation in attrs tests.\n" }, { "from": "human", "value": "from __future__ import absolute_import, division, print_function\n\nfrom databroker.core import Header\n\n\ndef test_header_dict_conformance(db):\n # TODO update this if / when ...
python
chosen
[ { "from": "system", "value": "Make sure celery_teardown_request gets called in DraftReg auto-approve script [skip ci]\n" }, { "from": "human", "value": "\"\"\" A script for testing DraftRegistrationApprovals. Automatically approves all pending\nDraftRegistrationApprovals.\n\"\"\"\nimport sys\nim...
python
chosen
[ { "from": "system", "value": "Use star args to invoke apply_async\n" }, { "from": "human", "value": "from __future__ import absolute_import\n\nimport celery\nimport os\nimport os.path\nimport sys\n\n# Add the project to the python path\nsys.path.insert(0, os.path.join(os.path.dirname(__file__), ...
python
chosen
[ { "from": "system", "value": "Remove DEV ONLY on the sub view since the super already has it\n" }, { "from": "human", "value": "from django.conf.urls import url\n\nfrom api.collections import views\nfrom website import settings\n\nurlpatterns = []\n\n# Routes only active in local/staging environ...
python
chosen
[ { "from": "system", "value": "Format keyword arguments like PEP-8.\n" }, { "from": "human", "value": "#! /usr/bin/env python\n\nfrom lsapi import lsapi\n\nl = lsapi('my-access-id', 'my-secret-key')\n\n# As you may have noticed, there are lots of columns available\n# I did what I could to make th...
python
chosen
[ { "from": "system", "value": "Convert pharaoh output format to Alignment object and vice versa:wq\n" }, { "from": "human", "value": "# Natural Language Toolkit: Aligner Utilities\n#\n# Copyright (C) 2001-2013 NLTK Project\n# Author: \n# URL: <http://www.nltk.org/>\n# For license information, see...
python
chosen
[ { "from": "system", "value": "Allow the same 'hosts' settings that Elasticsearch does\n" }, { "from": "human", "value": "# -*- coding: utf-8 -*-\n\nfrom functools import wraps\n\nfrom mock import patch\n\nfrom elasticmock.fake_elasticsearch import FakeElasticsearch\n\nELASTIC_INSTANCES = {}\n\n\...
python
chosen
[ { "from": "system", "value": "Replace deprecated slave_ok for read_preference in pymongo.Connection\n\nSee: http://api.mongodb.org/python/current/api/pymongo/connection.html\n" }, { "from": "human", "value": "try:\n from numbers import Number\n import pymongo\nexcept ImportError:\n Numb...
python
chosen
[ { "from": "system", "value": "Remove default for zone, add method for searching for specified zone in environ vars.\n" }, { "from": "human", "value": "from __future__ import absolute_import\n\nfrom toil import version\nimport logging\n\nlogger = logging.getLogger(__name__)\n\n\ndef addBasicProvi...
python
chosen
[ { "from": "system", "value": "Fix logging directory njot existing\n" }, { "from": "human", "value": "import sys\nimport os\nimport logging\n\nif not os.path.exists(os.path.expanduser(\"~/.chatserver\")):\n os.makedirs(os.path.expanduser(\"~/.chatserver\")\nlogging.basicConfig(filename=os.path...
python
chosen
[ { "from": "system", "value": "0.1.8: Remove unnecessary strip, add finally for release tagger\n" }, { "from": "human", "value": "# -*- coding: utf-8 -*-\nfrom malibu import command # noqa\nfrom malibu import config # noqa\nfrom malibu import database # noqa\nfrom malibu import design # noqa\...
python
chosen