conversations
listlengths
2
3
source
stringclasses
1 value
stack
stringclasses
1 value
[ { "from": "system", "value": "Make the openquake namespace compatible with old setuptools\n" }, { "from": "human", "value": "__import__('pkg_resources').declare_namespace(__name__)\n" }, { "from": "gpt", "value": "# -*- coding: utf-8 -*-\n# vim: tabstop=4 shiftwidth=4 softtabstop=4\n...
python
chosen
[ { "from": "system", "value": "Use project name to retrieve version info\n\nChange-Id: Iaef93bde5183263f900166b8ec90eefb7bfdc99b\n" }, { "from": "human", "value": "# -*- coding: utf-8 -*-\n\n# Licensed under the Apache License, Version 2.0 (the \"License\"); you may\n# not use this file except in...
python
chosen
[ { "from": "system", "value": "Remove more remnants of print sequence message\n\nI found this other place that was helping to display the message that warns that print sequcence is set per-object. Since the latter is no longer possible, this message shouldn't be displayed any more.\n\nContributes to issue CU...
python
chosen
[ { "from": "system", "value": "Update solution to be consistent\n" }, { "from": "human", "value": "\ndef my_init(shape, dtype=None):\n array = np.zeros(shape=(5,5,3,3))\n array[2,2] = np.eye(3) \n return array\n\ninp = Input((None, None, 3), dtype=\"float32\")\nx = Conv2D(kernel_size=(5,...
python
chosen
[ { "from": "system", "value": "Configure logging in client tests, so client logs show up.\n\n" }, { "from": "human", "value": "import copy\nimport json\nimport os\nimport unittest\n\nfrom client.client import Client\n\n# To run the tests against the test instance instead,\n# set environment varia...
python
chosen
[ { "from": "system", "value": "Test for existence of node before clearing it\n" }, { "from": "human", "value": "\"\"\"\nClasses for customising node caching.\n\"\"\"\n\n\nclass BasicCacher(object):\n \"\"\"\n Basic in-memory caching.\n \"\"\"\n def __init__(self, logger=None):\n ...
python
chosen
[ { "from": "system", "value": "Work with new and *older* kombu versions\n" }, { "from": "human", "value": "from Queue import Empty\n\nfrom anyjson import serialize, deserialize\nfrom kombu.transport import virtual\n\nfrom django.conf import settings\nfrom django.core import exceptions as errors\n...
python
chosen
[ { "from": "system", "value": "Refactor test, test export email return text/csv content type\n" }, { "from": "human", "value": "from django.test import TestCase\nfrom django.http import HttpResponse\nfrom django.contrib.admin.sites import AdminSite\nfrom django.contrib.auth.models import User\nfr...
python
chosen
[ { "from": "system", "value": "Add test forecast.io API call\n" }, { "from": "human", "value": "import juliet_module\nfrom pygame import Rect\nfrom time import time\n\nfrom os import getcwd\n\nclass weather_module(juliet_module.module):\n mod_name = \"weather_module\"\n\n __last_update = ti...
python
chosen
[ { "from": "system", "value": "Update Ctrl+Alt+Del Sillies crawler with new URL\n" }, { "from": "human", "value": "from comics.crawler.base import BaseComicCrawler\nfrom comics.crawler.meta import BaseComicMeta\n\nclass ComicMeta(BaseComicMeta):\n name = 'Ctrl+Alt+Del Sillies'\n language = ...
python
chosen
[ { "from": "system", "value": "Create tables on application start\n" }, { "from": "human", "value": "import logging\nimport sys\n\nfrom sqlalchemy import text\nfrom sqlalchemy.ext.asyncio import AsyncConnection, create_async_engine\n\nlogger = logging.getLogger(__name__)\n\n\nasync def connect(po...
python
chosen
[ { "from": "system", "value": "Add important todo for fixing prod\n" }, { "from": "human", "value": "import os\nimport logging\n\nfrom flask import Flask\nfrom flask.ext.bcrypt import Bcrypt\nimport flask.ext.login as flask_login\nfrom flask.ext.sqlalchemy import SQLAlchemy\n\n\nlog = logging.get...
python
chosen
[ { "from": "system", "value": "Fix test for updated text" }, { "from": "human", "value": "# -*- coding: utf-8 -*-\n\nfrom __future__ import unicode_literals\n\nfrom django_webtest import WebTest\n\nfrom . import factories\n\nclass TestApiHelpView(WebTest):\n\n def setUp(self):\n factori...
python
chosen
[ { "from": "system", "value": "Remove useless TODO from codebase.\n" }, { "from": "human", "value": "\"\"\"\nfunsize.fetch\n~~~~~~~~~~~~~~~~~~\n\nThis module contains fetch functions\n\n\"\"\"\n\nimport logging\nimport requests\n\nfrom .csum import verify\nfrom .oddity import DownloadError\n\n\nd...
python
chosen
[ { "from": "system", "value": "Add another url pattern for debugging public layers\n\n--HG--\nbranch : bookmarks\n" }, { "from": "human", "value": "from django.conf.urls.defaults import *\n\n\nurlpatterns = patterns('lingcod.layers.views',\n url(r'^public/', \n 'get_public_layers', \n ...
python
chosen
[ { "from": "system", "value": "Fix a bug on platform detection on Mac OSX\n" }, { "from": "human", "value": "# This file is part of Moksha.\n#\n# Moksha is free software: you can redistribute it and/or modify\n# it under the terms of the GNU General Public License as published by\n# the Free Soft...
python
chosen
[ { "from": "system", "value": "Fix bugs in sentiment analysis code so entity sentiment is returned\n" }, { "from": "human", "value": "from flask import Flask, request, session, g, redirect, url_for, abort, \\\n render_template, jsonify, make_response\nimport json\n\nfrom decorators import Mon...
python
chosen
[ { "from": "system", "value": "[trunk] Convert line endings for .h, .c and .cpp files as well as .cs\n" }, { "from": "human", "value": "#!/usr/bin/python\n\nimport os\nimport sys\n\ndef convert_line_endings(file):\n if '\\r\\n' in open(file, 'rb').read():\n print '%s contains DOS line endings...
python
chosen
[ { "from": "system", "value": "Fix import issue with Python 3.6/Support future Python by forcing absolute import\n" }, { "from": "human", "value": "__version__ = '2.2.0'\n\nfrom libsbol import *\nimport unit_tests" }, { "from": "gpt", "value": "from __future__ import absolute_import\n...
python
chosen
[ { "from": "system", "value": "Fix uia_controls registration only when UIA is supported\n" }, { "from": "human", "value": "# GUI Application automation and testing library\r\n# Copyright (C) 2015 Intel Corporation\r\n# Copyright (C) 2009 Mark Mc Mahon\r\n#\r\n# This library is free software; you ...
python
chosen
[ { "from": "system", "value": "Reduce path to shortest possible from current dir.\n" }, { "from": "human", "value": "#\n# Jasy - JavaScript Tooling Refined\n# Copyright 2010 Sebastian Werner\n#\n\nimport os, sys\n\n\ndef root():\n \"\"\" Returns the root path of Jasy \"\"\"\n return os.path...
python
chosen
[ { "from": "system", "value": "Add fqdn verification to BVT\n" }, { "from": "human", "value": "#!/usr/bin/python\n\nfrom azuremodules import *\n\n\nimport argparse\nimport sys\nimport time\n #for error checking\nparser = argparse.ArgumentParser()\n\nparser.add_argument('-e', '--expected', ...
python
chosen
[ { "from": "system", "value": "Fix bug in admin_module checking\n" }, { "from": "human", "value": "from tinydb import TinyDB, Query\n\n\nclass BotModule:\n name = '' # name of your module\n\n description = '' # description of its function\n\n help_text = '' # help text for explaining ...
python
chosen
[ { "from": "system", "value": "Update cogprints to emit preprints\n" }, { "from": "human", "value": "from share.provider import OAIProviderAppConfig\n\n\nclass AppConfig(OAIProviderAppConfig):\n name = 'providers.org.cogprints'\n version = '0.0.1'\n title = 'cogprints'\n long_title = ...
python
chosen
[ { "from": "system", "value": "Add working_dir and copy_steps options\n" }, { "from": "human", "value": "from scriptcwl import WorkflowGenerator as WFGenerator\n\nfrom .utils import CWL_PATH\n\n\nclass WorkflowGenerator(WFGenerator):\n def __init__(self):\n WFGenerator.__init__(self, st...
python
chosen
[ { "from": "system", "value": "Make the FullUserCreationForm work on a fresh database which doesn't have Django's auth_user table." }, { "from": "human", "value": "# -*- coding: utf-8 -*-\n\nimport logging\n\n#from django import forms\n#from django.utils.translation import ugettext_lazy as _\nfro...
python
chosen
[ { "from": "system", "value": "Refactor json_response to more BDD methods\n" }, { "from": "human", "value": "from django.http import JsonResponse\n\n\nclass ApiBase(object):\n\n STATUS_ERROR = 0\n STATUS_SUCCESS = 1\n STATUS_WARNING = 2\n\n def json_response(self, data=None, status=ST...
python
chosen
[ { "from": "system", "value": "Work with broken Koschei rules\n\nMessages sent in the morning of 2015-09-25 were missing the groups\nfield. Deal with that not existing.\n\nExample messages:\n- 2015-eebf137e-cc22-48c2-87f0-7d736950f76b\n- 2015-2a5361ec-9c36-438a-8233-709e9f006003\n\nSigned-off-by: Patrick Uit...
python
chosen
[ { "from": "system", "value": "Remove package transitions in documentation\n" }, { "from": "human", "value": "\"\"\"\nThird-party modules which are essential and must always available.\n\nFor maximum compatibility, these modules should be pure Python without\nnon-standard dependencies.\n\nList of...
python
chosen
[ { "from": "system", "value": "Allow ValueError as a notify exception\n" }, { "from": "human", "value": "from dbus.exceptions import DBusException\ntry:\n import gi\n gi.require_version('Notify', '0.7')\n from gi.repository import Notify\nexcept (ImportError, AttributeError):\n from s...
python
chosen
[ { "from": "system", "value": "Fix user not defined error for not logged in users\n" }, { "from": "human", "value": "from django import forms\nfrom django_fixmystreet.fixmystreet.models import FMSUser, getLoggedInUserId\nfrom django.contrib.auth.models import User\nfrom django.conf import setting...
python
chosen
[ { "from": "system", "value": "Add explicit (rather than broad/general) exceptions in get_version\n" }, { "from": "human", "value": "import sys\nimport warnings\n\n\ndef get_version(modulename):\n \"Return a string containing the module name and the library version.\"\n version = '?'\n\n ...
python
chosen
[ { "from": "system", "value": "Fix silly prefix change on this branch so that it won't affect master again\n" }, { "from": "human", "value": "# coding: utf-8\n\n\"\"\"\nCreated on 2016-08-23\n@author: naoey\n\"\"\"\n\nVERSION = \"0.0.3\"\n\nBOT_PREFIX = \":\"\n\nPATHS = {\n \"logs_dir\": \"./....
python
chosen
[ { "from": "system", "value": "Fix import in integration test\n" }, { "from": "human", "value": "from hamcrest import *\nimport pytest\n\n@pytest.mark.xfail\ndef test_should_get_correct_embedding():\n consumer = REmbedConsumer()\n embedding = consumer.embed('https://twitter.com/BarackObama/...
python
chosen
[ { "from": "system", "value": "Use an actually random transcript; update stats immediately\n" }, { "from": "human", "value": "import random\n\nfrom django.core.management.base import BaseCommand\nfrom django.contrib.auth.models import User\n\nfrom mla_game.apps.accounts.models import Profile\n\nf...
python
chosen
[ { "from": "system", "value": "Add dependency on wagtailcore migration 0002 (necessary to cleanly merge the other migration 0005 being added in 0.9)\n" }, { "from": "human", "value": "# -*- coding: utf-8 -*-\nfrom __future__ import unicode_literals\n\nfrom django.db import models, migrations\n\n\...
python
chosen
[ { "from": "system", "value": "Fix OPPS_APPS, get object_name in dropdawn\n" }, { "from": "human", "value": "#!/usr/bin/env python\n# -*- coding: utf-8 -*-\n#from django.conf import settings\n#from django.utils.importlib import import_module\nfrom django.db import models\nfrom django.utils.transl...
python
chosen
[ { "from": "system", "value": "Fix cache clearing with TextItem plugins\n" }, { "from": "human", "value": "from django.db import models\nfrom django.utils.html import strip_tags\nfrom django.utils.text import truncate_words\nfrom django.utils.translation import ugettext_lazy as _\nfrom fluent_con...
python
chosen
[ { "from": "system", "value": "Update local store base class\n" }, { "from": "human", "value": "# -*- coding: utf-8 -*-\nfrom __future__ import absolute_import, division, print_function\n\nfrom polyaxon_client.stores.stores.base_store import Store\n\n\nclass LocalStore(Store):\n \"\"\"\n Lo...
python
chosen
[ { "from": "system", "value": "Gdrive: Add another empty line between imports and def.\n" }, { "from": "human", "value": "import os.path\nimport webbrowser\nimport pydrive.auth, pydrive.drive\n\ndef upload(document):\n \"\"\"Upload .docx file to Google Drive and return a web view link to it.\"...
python
chosen
[ { "from": "system", "value": "Create commandline options for the clampval\n" }, { "from": "human", "value": "import numpy as np\nimport matplotlib.pyplot as plt\nfrom mpl_toolkits.mplot3d import Axes3D\nimport sys\n\ndef loadCudaStream(name):\n \"\"\"\n reads the file specified by name int...
python
chosen
[ { "from": "system", "value": "Use new\nutil function for getting current people\n" }, { "from": "human", "value": "from django.shortcuts import render\nfrom django.db import transaction\n# from django.views.generic import TemplateView\n\nfrom registration.forms import RegistrationFormUniqueEmail...
python
chosen
[ { "from": "system", "value": "Add Channel and the convenience exchange classes\n" }, { "from": "human", "value": "\"\"\"\nrabbitpy, a pythonic RabbitMQ client\n\n\"\"\"\n__version__ = '0.14.0'\nversion = __version__\n\nDEBUG = False\n\nimport logging\n\ntry:\n from logging import NullHandler\...
python
chosen
[ { "from": "system", "value": "Update p560m subarray sum in Python\n" }, { "from": "human", "value": "from typing import List\nfrom collections import defaultdict\n\n\nclass Solution:\n def subarraySum(self, nums: List[int], k: int) -> int:\n sum_count = defaultdict(int)\n sum_co...
python
chosen
[ { "from": "system", "value": "Fix logging bug: mkdir -> makedirs.\n" }, { "from": "human", "value": "import errno\nimport os\nimport logging\n\n\ndef _mkdir_p(path):\n try:\n os.mkdir(path)\n except OSError as exc:\n if exc.errno == errno.EEXIST and os.path.isdir(path):\n ...
python
chosen
[ { "from": "system", "value": "Improve commenting for setupplan unittest.\n" }, { "from": "human", "value": "def test_show_fixtures_and_test(testdir):\n p = testdir.makepyfile('''\n import pytest\n @pytest.fixture\n def arg():\n assert False\n def test_ar...
python
chosen
[ { "from": "system", "value": "Add eg to get number of peaks\n" }, { "from": "human", "value": "#!/usr/bin/env python\n# -*- coding: utf-8 -*-\nimport numpy as np\nfrom vector import vector, plot_peaks\nimport scipy.signal\n\nprint('Detect peaks without any filters (maxima).')\nindexes = scipy.si...
python
chosen
[ { "from": "system", "value": "feat: Make class ComparisonPlotter inherit from Plotter\n\n" }, { "from": "human", "value": "#!/usr/bin/env python\nimport matplotlib.pyplot as plt\n\nfrom .constants import PLOT\n\n\nclass ComparisonPlotter:\n def __init__(self, data_list):\n self.traject...
python
chosen
[ { "from": "system", "value": "Handle case when response is None\n" }, { "from": "human", "value": "import datetime\nimport decimal\n\nfrom django.utils import timezone\n\n\ndef convert_tstamp(response, field_name=None):\n try:\n if field_name and response[field_name]:\n retu...
python
chosen
[ { "from": "system", "value": "Implement validation to the username field.\n" }, { "from": "human", "value": "from django import forms\nfrom django.core import validators\nfrom django.contrib.auth.models import User\nfrom django.contrib.auth.forms import UserCreationForm\n\nclass RegistrationForm...
python
chosen
[ { "from": "system", "value": "Switch to CSV and add important info\n" }, { "from": "human", "value": "from django.core.management.base import BaseCommand\nfrom corehq.apps.domain.models import Domain\n\n\nclass Command(BaseCommand):\n def handle(self, *args, **options):\n self.stdout.w...
python
chosen
[ { "from": "system", "value": "Make the confdir option optional, with default value the conf subdir in the source tree. Wrap long lines. Add a -l alias for option --logfile.\n" }, { "from": "human", "value": "#!/usr/bin/python\n\n\"\"\"\nStart the Reporting API application using Paste Deploy.\n\"...
python
chosen
[ { "from": "system", "value": "Use getpass to get password\n" }, { "from": "human", "value": "\"\"\"\nCheck that application ldap creds are set up correctly.\n\"\"\"\nfrom argparse import ArgumentParser\nfrom pprint import pprint\n\nfrom werkzeug.utils import import_string\n\n\ndef main():\n p...
python
chosen
[ { "from": "system", "value": "Remove High Peak election id (complaint from user)\n" }, { "from": "human", "value": "from data_collection.management.commands import BaseShpStationsShpDistrictsImporter\n\nclass Command(BaseShpStationsShpDistrictsImporter):\n srid = 27700\n council_id = 'E070...
python
chosen
[ { "from": "system", "value": "Correct cyrillic to match preferred pronunciation.\n" }, { "from": "human", "value": "# coding: utf-8\n\nfrom __future__ import unicode_literals\n\nimport io\n\nimport six\n\nfrom setuptools.command import setopt\nfrom setuptools.extern.six.moves import configparser...
python
chosen
[ { "from": "system", "value": "Fix the data format of our metrics consumer\n" }, { "from": "human", "value": "# This file is part of Moksha.\n# Copyright (C) 2008-2009 Red Hat, Inc.\n#\n# This program is free software: you can redistribute it and/or modify\n# it under the terms of the GNU Affero...
python
chosen
[ { "from": "system", "value": "Add functional Pocket auth and bulk_add\n" }, { "from": "human", "value": "#!/usr/bin/env python\n\n# Requires https://github.com/samuelkordik/pocketlib\n\nfrom readinglistlib import ReadingListReader\nfrom pocket.pocket import Pocket\n\n\nimport argparse\nimport sy...
python
chosen
[ { "from": "system", "value": "[Order] Order 2: Login system by https\n" }, { "from": "human", "value": "import json\nimport requests\n\n\"\"\" Order 2: Login system by https\n\nThis is the code which use curl to login system\n```\ncurl -k https://192.168.105.88/axapi/v3/auth -H \"Content-type:ap...
python
chosen
[ { "from": "system", "value": "Refactor Project to use new mixins and methods\n" }, { "from": "human", "value": "from __future__ import absolute_import\nfrom __future__ import division\nfrom __future__ import unicode_literals\n\nfrom sqlalchemy import event\nfrom sqlalchemy.schema import FetchedV...
python
chosen
[ { "from": "system", "value": "Remove six.moves and disable linter\n" }, { "from": "human", "value": "from __future__ import absolute_import\n\n\ndef register_scheme(name):\n from six.moves.urllib import parse as urlparse\n uses = urlparse.uses_netloc, urlparse.uses_query, urlparse.uses_rel...
python
chosen
[ { "from": "system", "value": "Make prosthetic-runner work with GAE SDK 1.6\n" }, { "from": "human", "value": "from google.appengine.api import apiproxy_stub_map\nimport os\n\nhave_appserver = bool(apiproxy_stub_map.apiproxy.GetStub('datastore_v3'))\n\nif have_appserver:\n appid = os.environ.g...
python
chosen
[ { "from": "system", "value": "Set Mongoengine user for Django 1.5 in tests.\n" }, { "from": "human", "value": "# Django settings for test_project project\n\nDEBUG = True\n\n# We are not really using a relational database, but tests fail without\n# defining it because flush command is being run, ...
python
chosen
[ { "from": "system", "value": "Fix and hide --use-cache option\n" }, { "from": "human", "value": "import os\n\nimport blah.repositories\nimport blah.fetcher\n\nclass WhatIsThisCommand(object):\n def create_parser(self, subparser):\n subparser.add_argument(\"directory\", nargs=\"?\")\n ...
python
chosen
[ { "from": "system", "value": "Revert \"Try to fix mpl invocation\"\n\nThis reverts commit c5f0e32eb12ae7809b9fde0371bfb73ec86d47a3.\n" }, { "from": "human", "value": "#!/usr/bin/env python\n\nimport os\nos.environ[\"MPLBACKEND\"] = 'agg'\n\nimport matplotlib\nmatplotlib.use('agg')\n\nimport pyte...
python
chosen
[ { "from": "system", "value": "Patch to make work like we expect\n" }, { "from": "human", "value": "import json\nimport logging\nimport os\nimport sys\n\n\ndef json_patch(path):\n logging.warn(\"Attempting to load local settings from %r\" % (path,))\n try:\n d = json.load(open(path))...
python
chosen
[ { "from": "system", "value": "Modify regexp to pick up MiSeqs as well. Thanks @senthil10\n" }, { "from": "human", "value": "\"\"\" Filesystem utilities\n\"\"\"\nimport contextlib\nimport os\n\nRUN_RE = '\\d{6}_[a-zA-Z\\d\\-]+_\\d{4}_[AB][A-Z\\d]{9}'\n\n@contextlib.contextmanager\ndef chdir(new_d...
python
chosen
[ { "from": "system", "value": "Add py prefix to OpenGL and serial. Exit when error.\n" }, { "from": "human", "value": "#!/usr/bin/python\n\nimport os, sys\n\ntry:\n import OpenGL\n import wx\n import serial\n import numpy\n import power\nexcept ImportError as e:\n module = e.mes...
python
chosen
[ { "from": "system", "value": "Make a beta of 4.2\n" }, { "from": "human", "value": "# Licensed under the Apache License: http://www.apache.org/licenses/LICENSE-2.0\n# For details: https://bitbucket.org/ned/coveragepy/src/default/NOTICE.txt\n\n\"\"\"The version and URL for coverage.py\"\"\"\n# Th...
python
chosen
[ { "from": "system", "value": "Update SessionMiddleware to bypass CSRF if request token is present\n\nFor non-session-based authentication, Serrano resources handle\nauthenticating using a token based approach. If it is present, CSRF\nmust be turned off to exempt the resources from the check.\n" }, { ...
python
chosen
[ { "from": "system", "value": "Use the version in the config file\n" }, { "from": "human", "value": "__author__ = 'matt'\n\nimport datetime\n\nimport blockbuster\n\nblockbuster.app.debug = blockbuster.config.debug_mode\n\nblockbuster.bb_logging.logger.info(\"@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@...
python
chosen
[ { "from": "system", "value": "Test for getting virtualenv name, prompting the user\n" }, { "from": "human", "value": "# -*- coding: utf-8 -*-\n\n\"\"\"\n.. module:: tests.test_pipeline.test_python\n :synopsis: Tests for bundled python pipelines\n\"\"\"\n\nfrom mock import patch, PropertyMock\n...
python
chosen
[ { "from": "system", "value": "Allow it to configure side\n" }, { "from": "human", "value": "# vim:fileencoding=utf-8:noet\nfrom __future__ import (unicode_literals, division, absolute_import, print_function)\n\nfrom libqtile.bar import CALCULATED\nfrom libqtile.widget import TextBox\n\nfrom powe...
python
chosen
[ { "from": "system", "value": "Bump version number to 1.0.0\n" }, { "from": "human", "value": "__version_info__ = (0, 1, 5)\n__version__ = '.'.join(map(str, __version_info__))\n" }, { "from": "gpt", "value": "__version_info__ = (1, 0, 0)\n__version__ = '.'.join(map(str, __version_info...
python
chosen
[ { "from": "system", "value": "Remove unused test code in test_util.py\n\nThis doesn't seem to do anything\n\nChange-Id: Ieba6b5f7229680146f9b3f2ae2f3f2d2b1354376\n" }, { "from": "human", "value": "# Copyright 2013 OpenStack LLC.\n# All Rights Reserved.\n#\n# Licensed under the Apache License,...
python
chosen
[ { "from": "system", "value": "Update TalkForm to use checked labels\n" }, { "from": "human", "value": "from django import forms\n\nfrom .models import Label, Talk\n\n\nclass TalkForm(forms.ModelForm):\n\n def __init__(self, *args, **kwargs):\n super(TalkForm, self).__init__(*args, **kw...
python
chosen
[ { "from": "system", "value": "Use exists() check from QuerySet; give logger-info context\n" }, { "from": "human", "value": "import logging\n\nfrom troposphere.query import only_current_tokens\n\n\nlogger = logging.getLogger(__name__)\n\n\ndef has_valid_token(user):\n \"\"\"\n Returns boole...
python
chosen
[ { "from": "system", "value": "Support being given protobuf Messages\n" }, { "from": "human", "value": "import socket\n\nimport groundstation.logger\nlog = groundstation.logger.getLogger(__name__)\n\nfrom groundstation.peer_socket import PeerSocket\n\nclass StreamSocket(object):\n \"\"\"Wraps ...
python
chosen
[ { "from": "system", "value": "Add a new passing test for invalid week numbers.\n" }, { "from": "human", "value": "import unittest\nfrom hypothesis import given\nfrom hypothesis.strategies import integers\nfrom hypothesis.extra.datetime import datetimes\n\nimport qual\n\nfrom datetime import date...
python
chosen
[ { "from": "system", "value": "Dimension: Add dtype of iteration variable\n" }, { "from": "human", "value": "import cgen\nfrom sympy import Symbol\n\n__all__ = ['Dimension', 'x', 'y', 'z', 't', 'p']\n\n\nclass Dimension(Symbol):\n \"\"\"Index object that represents a problem dimension and thus...
python
chosen
[ { "from": "system", "value": "Fix error - rm test dir command is not executed in correct branch.\n" }, { "from": "human", "value": "#!/usr/bin/env python3\n\nfrom passwd_change import passwd_change, shadow_change, mails_delete\n\nfrom unittest import TestCase, TestLoader, TextTestRunner\nimport ...
python
chosen
[ { "from": "system", "value": "Set testing script to use YAML file (oops)\n" }, { "from": "human", "value": "#!/usr/bin/env python\n\n# ----------------------------------------------------------------------------------------------\n# Created by: Lee & Matt\n#\n# Description: Contains unit test fo...
python
chosen
[ { "from": "system", "value": "Test and capture the CLI output\n" }, { "from": "human", "value": "from unittest import TestCase\nfrom ass2m.cli import CLI\nfrom tempfile import mkdtemp\nimport shutil\n\nclass BaseCLITest(TestCase):\n def setUp(self):\n self.root = mkdtemp(prefix='ass2m_...
python
chosen
[ { "from": "system", "value": "Add directory for state files\n" }, { "from": "human", "value": "#!/usr/bin/env python\n\n# Copyright 2015 University of Chicago\n# Available under Apache 2.0 License\n\nfrom distutils.core import setup\n\nsetup(name='htcondor-es-probes',\n version='0.6.3',\n ...
python
chosen
[ { "from": "system", "value": "Test moving average filter for 5th order\n" }, { "from": "human", "value": "from unittest import TestCase\n\nimport numpy as np\n\nfrom hrv.filters import moving_average\n\n\nclass Filter(TestCase):\n def test_moving_average_order_3(self):\n fake_rri = np....
python
chosen
[ { "from": "system", "value": "Add validation on category parent field\n" }, { "from": "human", "value": "from django import forms\n\nfrom ...product.models import Category\n\n\nclass CategoryForm(forms.ModelForm):\n class Meta:\n model = Category\n exclude = []" }, { "fr...
python
chosen
[ { "from": "system", "value": "MNT: Add explicit test for deprecation decorator\n" }, { "from": "human", "value": "# Copyright (c) 2019 MetPy Developers.\n# Distributed under the terms of the BSD 3-Clause License.\n# SPDX-License-Identifier: BSD-3-Clause\n\"\"\"Test MetPy's testing utilities.\...
python
chosen
[ { "from": "system", "value": "Create index on session_id in order to speed tests\n\nIt seems that session querying has been the longest component of all my\ntests, and adding one test raised my test time signifigantly. Hopefully\nthis smooths somet of that out.\n" }, { "from": "human", "value": ...
python
chosen
[ { "from": "system", "value": "Remove some tests because of new required arg\n" }, { "from": "human", "value": "\nimport unittest\n\nfrom tailorscad.arg_parser import parse_args\n\n\nclass TestArgParser(unittest.TestCase):\n\n def test_parse_args_none(self):\n\n args = []\n argv ...
python
chosen
[ { "from": "system", "value": "Add api call to open binary and grab stdout\n" }, { "from": "human", "value": "from web_433Mhz import app\nfrom flask import render_template\n\n@app.route('/', methods=['GET', 'POST'])\ndef index():\n return render_template('index.html')\n" }, { "from": "...
python
chosen
[ { "from": "system", "value": "Increase timeout of update_graph job to 7 days\n" }, { "from": "human", "value": "import sys\nimport time\nimport logging\nlogging.basicConfig(level=logging.DEBUG)\n\nfrom redis import StrictRedis\nfrom rq import Queue\nfrom apscheduler.schedulers.blocking import Bl...
python
chosen
[ { "from": "system", "value": "Change format to satify pedantic linter\n" }, { "from": "human", "value": "#!/usr/bin/env python\nimport socket\n\n\ndef main():\n server_socket = socket.socket(socket.AF_INET, socket.SOCK_STREAM,\n socket.IPPROTO_IP)\n server_...
python
chosen
[ { "from": "system", "value": "Add receive support to Twilio backend" }, { "from": "human", "value": "# encoding: utf-8\nfrom twilio.rest import TwilioRestClient\n\nfrom mobile.backends.base import BaseBackend\n\nclass Backend(BaseBackend):\n \"\"\"Twilio Gate Backend.\"\"\"\n\n class SMS:\...
python
chosen
[ { "from": "system", "value": "Return early for legacy processes\n" }, { "from": "human", "value": "\"\"\"Metadata generation logic for source distributions.\n\"\"\"\n\n\ndef get_metadata_generator(install_req):\n if install_req.use_pep517:\n return install_req.prepare_pep517_metadata\n...
python
chosen
[ { "from": "system", "value": "Create a pre-release version for PyPI, to test the new readme format.\n" }, { "from": "human", "value": "# Package versioning solution originally found here:\n# http://stackoverflow.com/q/458550\n\n# Store the version here so:\n# 1) we don't load dependencies by sto...
python
chosen
[ { "from": "system", "value": "Remove import of missing module\n" }, { "from": "human", "value": "#\n# Copyright (c) SAS Institute, Inc.\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may not use this file except in compliance with the License.\n# You may obtain a ...
python
chosen
[ { "from": "system", "value": "Use better exception for AUTH_USER_MODEL\n\nIf AUTH_USER_MODEL is improperly configured as 'project.customer.User',\nthe error is:\n\nValueError: too many values to unpack\n\nUse rather standard Django's error:\n\nImproperlyConfigured: AUTH_USER_MODEL must be of the form\n'app_...
python
chosen
[ { "from": "system", "value": "Add closing paren to tuple expression\n\nUnder Python 2.7.6, this file didn't compile for me as-is. I still need to clone and rerun the test suite, but I thought I'd try Github's nifty \"fork and edit online\" feature. Will comment again when the tests pass." }, { "fr...
python
chosen
[ { "from": "system", "value": "Use splitlines instead of hard-coding the line endings.\n\ngit-svn-id: 15b99a5ef70b6649222be30eb13433ba2eb40757@14 cdb1d5cb-5653-0410-9e46-1b5f511687a6\n" }, { "from": "human", "value": "\nimport sha\n\nfrom django.contrib.contenttypes.models import ContentType\n\nf...
python
chosen
[ { "from": "system", "value": "Use YAML params instead of XML params\n" }, { "from": "human", "value": "# -*- coding: utf-8 -*-\n\nimport os\n\nfrom openfisca_core.taxbenefitsystems import TaxBenefitSystem\n\nfrom . import entities\n\n\nCOUNTRY_DIR = os.path.dirname(os.path.abspath(__file__))\n\n...
python
chosen
[ { "from": "system", "value": "Make client available at the package level\n\nThis will make imports easier for anyone willing to use esis as a\nlibrary\n" }, { "from": "human", "value": "# -*- coding: utf-8 -*-\n\"\"\"Elastic Search Index & Search.\"\"\"\n\n__author__ = 'Javier Collado'\n__email_...
python
chosen