conversations
listlengths
2
3
source
stringclasses
1 value
stack
stringclasses
1 value
[ { "from": "system", "value": "Add test for extract listings that asserts each listing is a bs4.element.Tag\n" }, { "from": "human", "value": "from scraper import search_CL\nfrom scraper import read_search_results\n\n\ndef test_search_CL():\n test_body, test_encoding = search_CL(minAsk=100)\n ...
python
chosen
[ { "from": "system", "value": "Increase tollerance for heat demand test\n" }, { "from": "human", "value": "\"\"\"\nTest the electricity demand\n\nSPDX-FileCopyrightText: Uwe Krien <krien@uni-bremen.de>\nSPDX-FileCopyrightText: Patrik Schönfeldt\n\nSPDX-License-Identifier: MIT\n\n\"\"\"\n\nimport ...
python
chosen
[ { "from": "system", "value": "Fix failing tests (version number)\n" }, { "from": "human", "value": "import mal_scraper\n\n\ndef test_import_mal_scraper():\n \"\"\"Can we import mal_scraper\"\"\"\n assert mal_scraper\n assert mal_scraper.__version__.split('.') == ['0', '1', '0']\n\n\ncla...
python
chosen
[ { "from": "system", "value": "Leverage isort's check mode to make our logic simpler\n\nThis avoids having to check for in_lines or compare against the\nout_lines by just asking for a check and using the results\n" }, { "from": "human", "value": "from isort import SortImports\nimport mothermayi.c...
python
chosen
[ { "from": "system", "value": "Create a basic VirtualBoxTestCase with helper assertions\n" }, { "from": "human", "value": "import virtualbox\n\n\ndef list_machines():\n vbox = virtualbox.vb_get_manager()\n for machine in vbox.getArray(vbox, \"Machines\"):\n print \"Machine '%s' logs ...
python
chosen
[ { "from": "system", "value": "Remove initializer..this is a 'static' class which\n\nwe are using functional approach with, e.g. no instances\nif we can help it..\n" }, { "from": "human", "value": "'''\nCreated on Feb 6, 2015\n\n@author: thomas\n'''\n\nclass Maximum (object):\n\n @staticmethod...
python
chosen
[ { "from": "system", "value": "Reduce code to a simpler form that checks if a user is already in the DB\n" }, { "from": "human", "value": "import json\n\n\nclass Database(dict):\n \"\"\"Holds a dict that contains all the information about the users in a channel\"\"\"\n def __init__(self, ir...
python
chosen
[ { "from": "system", "value": "Use matrix of axes not figure\n" }, { "from": "human", "value": "import matplotlib.pyplot as plt\n\n\ndef grid_axes_labels(f, xlabel=None, ylabel=None, **kws):\n\n axes = f.axes\n\n plt.setp(axes.flat, xlabel=\"\", ylabel=\"\")\n\n if xlabel is not None:\n ...
python
chosen
[ { "from": "system", "value": "Make test work under Python 2.6.\n" }, { "from": "human", "value": "from bpython import autocomplete\n\nimport unittest\ntry:\n from unittest import skip\nexcept ImportError:\n def skip(f):\n return lambda self: None\n\n#TODO: Parts of autocompletion to...
python
chosen
[ { "from": "system", "value": "Correct test to match the inverse test.\n" }, { "from": "human", "value": "import unittest\n\nfrom calexicon.calendars.tests.test_calendar import JulianGregorianConversion\n\nfrom calexicon.fn import julian_to_gregorian, gregorian_to_julian\nfrom calexicon.fn import...
python
chosen
[ { "from": "system", "value": "Print out file name after writing" }, { "from": "human", "value": "from __future__ import division\n\ndef nproc():\n from libtbx.introspection import number_of_processors\n return number_of_processors(return_value_if_unknown=-1)\n\ndef joiner(args):\n from dials....
python
chosen
[ { "from": "system", "value": "Add new filter to determine if today is within the time period for a season.\n" }, { "from": "human", "value": "from django import template\nfrom datetime import date, datetime, timedelta\n\nregister = template.Library()\n\n@register.filter(expects_localtime=True)\n...
python
chosen
[ { "from": "system", "value": "Add a simple UnicodeCSVWriter, probably flawed.\n" }, { "from": "human", "value": "# -*- coding: utf-8 -*-\nimport csv\nimport itertools\n\n\ndef grouper(iterable, n):\n \"\"\"\n Slice up `iterable` into iterables of `n` items.\n\n :param iterable: Iterable...
python
chosen
[ { "from": "system", "value": "Fix problem with __all__ variable and update weave docs a bit. Update compiler_cxx too.\n\ngit-svn-id: 003f22d385e25de9cff933a5ea4efd77cb5e7b28@2022 d6536bca-fef9-0310-8506-e4c0a848fbcf\n" }, { "from": "human", "value": "\ndef configuration(parent_package='',top_pa...
python
chosen
[ { "from": "system", "value": "Remove returned pile b/c mutating directly\n" }, { "from": "human", "value": "from collections import deque\n\n\ndef isVerticallyStackable(pile):\n vertical_stack = []\n while pile:\n largest_cube, cube_sizes = remove_largest_cube_from_pile(pile)\n ...
python
chosen
[ { "from": "system", "value": "Add workaround for Travis CI problems\n" }, { "from": "human", "value": "import subprocess\n\n\ndef test_subcommand():\n \"\"\"\n Test that a command from the example project is registered.\n \"\"\"\n output = subprocess.check_output(['textx'], stderr=su...
python
chosen
[ { "from": "system", "value": "Correct typo in debug function\n" }, { "from": "human", "value": "from .atflex import AtfLexer\nfrom .atfyacc import AtfParser\nfrom mako.template import Template\n\n\nclass AtfFile(object):\n\n template = Template(\"${text.serialize()}\")\n\n def __init__(sel...
python
chosen
[ { "from": "system", "value": "Change order of migration operations.\n" }, { "from": "human", "value": "# -*- coding: utf-8 -*-\n# Generated by Django 1.10.1 on 2016-10-24 23:38\nfrom __future__ import unicode_literals\n\nfrom django.db import migrations, models\n\n\nclass Migration(migrations.Mi...
python
chosen
[ { "from": "system", "value": "Resolve the library on windows\n" }, { "from": "human", "value": "# Copyright 2016 ELIFE. All rights reserved.\n# Use of this source code is governed by a MIT\n# license that can be found in the LICENSE file.\nfrom ctypes import CDLL\n\ndef get_libpath():\n \"\"\...
python
chosen
[ { "from": "system", "value": "Update dsub version to 0.3.8.dev0\n\nPiperOrigin-RevId: 293000641\n" }, { "from": "human", "value": "# Copyright 2017 Google Inc. All Rights Reserved.\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may not use this file except in comp...
python
chosen
[ { "from": "system", "value": "Bump version to 0.1.5 in preparation for a release\n\nPiperOrigin-RevId: 182068450\n" }, { "from": "human", "value": "# Copyright 2017 Google Inc. All Rights Reserved.\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may not use this fi...
python
chosen
[ { "from": "system", "value": "Add url for project_status_edit option\n" }, { "from": "human", "value": "from django.conf.urls import patterns, url\n\n\nurlpatterns = patterns('projects.views',\n url(r'^add/$', 'add_project', name='add_project'),\n url(r'^edit/(?P<project_id>\\d+)/$', 'edit...
python
chosen
[ { "from": "system", "value": "Remove old extra argument from track tests\n" }, { "from": "human", "value": "import unittest\nimport datetime\nimport hiro\nimport redis\nfrom sifr.span import Minute, Day\nfrom sifr.storage import MemoryStorage, RedisStorage\n\n\nclass RedisStorageTests(unittest.T...
python
chosen
[ { "from": "system", "value": "Add shutdown callback support to Action\n" }, { "from": "human", "value": "from bot.api.api import Api\nfrom bot.multithreading.scheduler import SchedulerApi\nfrom bot.storage import Config, State, Cache\n\n\nclass Action:\n def __init__(self):\n pass\n\n ...
python
chosen
[ { "from": "system", "value": "Fix a bug on Python 3.6\n" }, { "from": "human", "value": "# encoding: utf-8\n\nimport sys\n\n\nclass _const(object):\n class ConstError(TypeError):\n pass\n\n class ConstCaseError(ConstError):\n pass\n\n def __setattr__(self, name, value):\n ...
python
chosen
[ { "from": "system", "value": "Fix the initial search migration\n\nThere is no point in creating the model in this way, that's just not how\nit's used: instead we want to use the FTS4 extension from SQLite.\n" }, { "from": "human", "value": "# -*- coding: utf-8 -*-\nfrom __future__ import unicode...
python
chosen
[ { "from": "system", "value": "Fix overriding variable in problem report tag" }, { "from": "human", "value": "from collections import defaultdict\nfrom django import template\n\nfrom ..models import ProblemReport\nfrom ..forms import ProblemReportForm\n\nregister = template.Library()\n\n\n@regist...
python
chosen
[ { "from": "system", "value": "Add `TEMPLATE` config to test runner, to define template backend.\n" }, { "from": "human", "value": "#!/usr/bin/env python\nimport os, sys\n\nimport django\nfrom django.conf import settings\n\nDIRNAME = os.path.dirname(__file__)\nsettings.configure(\n DEBUG = T...
python
chosen
[ { "from": "system", "value": "Return empty responses (not HTTP 404) in REST API for missing data\n" }, { "from": "human", "value": "#!/usr/bin/env python\n\nimport socket\n\nfrom flask import Flask, abort, make_response, request\n\nfrom whip.db import Database\n\napp = Flask(__name__)\napp.confi...
python
chosen
[ { "from": "system", "value": "Add reference to user model and __unicode__() method to FacebookProfileModel\n" }, { "from": "human", "value": "from django.db import models\n\nclass FacebookProfileModel(models.Model):\n '''\n Abstract class to add to your profile model.\n \n NOTE: If y...
python
chosen
[ { "from": "system", "value": "Fix attempted import from non-existent module." }, { "from": "human", "value": "#!/usr/bin/python\n\nimport argparse\n\nfrom dx.dex import Dex\n\nfrom sha1 import update_signature\nfrom adler32 import update_checksum\n\ndef main():\n parser = argparse.ArgumentPar...
python
chosen
[ { "from": "system", "value": "Add reverse migration for new groups\n" }, { "from": "human", "value": "# -*- coding: utf-8 -*-\nfrom __future__ import unicode_literals\n\nfrom django.db import migrations\nfrom django.contrib.auth.models import Group\nimport logging\n\nlogger = logging.getLogger(_...
python
chosen
[ { "from": "system", "value": "Patch parameter --prefix does need a path seperator\n\nThe --prefix parameter of the patch command needs a path seperator at\nthe end to store the backup in a directory.\n" }, { "from": "human", "value": "# vim: fileencoding=utf-8 et sw=4 ts=4 tw=80:\n\n# python-qui...
python
chosen
[ { "from": "system", "value": "Make the jsroot magic a line magic for the C++ kernel\n" }, { "from": "human", "value": "# -*- coding:utf-8 -*-\n#-----------------------------------------------------------------------------\n# Copyright (c) 2016, ROOT Team.\n# Authors: Danilo Piparo <Danilo.Pipa...
python
chosen
[ { "from": "system", "value": "Fix django version problem with new menu options in admin app.\n" }, { "from": "human", "value": "from django.db import models\nfrom django.conf import settings\nfrom django.contrib.sites.admin import SiteAdmin\nfrom django.contrib.sites.models import Site\nfrom dja...
python
chosen
[ { "from": "system", "value": "Remove File Creation Command for UnitTesting\n" }, { "from": "human", "value": "\nimport os.path\nimport sys\nimport unittest\n\n\nsys.path.append(os.path.join(os.path.dirname(__file__), '../'))\nsys.path.append(os.path.join(os.path.dirname(__file__), '../vCenterShe...
python
chosen
[ { "from": "system", "value": "Use Google Translate API to get a female TTS\n" }, { "from": "human", "value": "#!/usr/bin/env python\n\nimport rospy\nfrom sound_play.msg import SoundRequest\nfrom sound_play.libsoundplay import SoundClient\nfrom std_msgs.msg import String\n\nclass ChatbotSpeaker:\...
python
chosen
[ { "from": "system", "value": "Add __pypi__ url to metadata\n" }, { "from": "human", "value": "__title__ = 'libtmux'\n__package_name__ = 'libtmux'\n__version__ = '0.8.0'\n__description__ = 'scripting library / orm for tmux'\n__email__ = 'tony@git-pull.com'\n__author__ = 'Tony Narlock'\n__github__...
python
chosen
[ { "from": "system", "value": "Fix an issue with repeated messages in json execution output provider.\n\ngit-svn-id: 555d7295f8287ebc42f8316c6775e40d702c4756@1726 3942dd89-8c5d-46d7-aeed-044bccf3e60c\n" }, { "from": "human", "value": "import logging\r\nfrom flask import render_template, request, ...
python
chosen
[ { "from": "system", "value": "Add 'quit' command to lmsh\n" }, { "from": "human", "value": "import cmd\n\n\nclass LMShell(cmd.Cmd):\n def __init__(self, lmapi, completekey='tab', stdin=None, stdout=None):\n cmd.Cmd.__init__(self, completekey, stdin, stdout)\n self._lmapi = lmapi...
python
chosen
[ { "from": "system", "value": "Refactor python if statement into dictionary\n" }, { "from": "human", "value": "\"\"\"\nElixir-related Ultisnips snippet helper functions.\nNOTE: Changes to this file require restarting Vim!\n\"\"\"\nimport re\n\n_DASHES_AND_UNDERSCORES = re.compile(\"[-_]\")\n_MODU...
python
chosen
[ { "from": "system", "value": "Correct test to catch SystemExit on normal exit.\n" }, { "from": "human", "value": "\"\"\"Usage: prog [-vqr] [FILE]\n prog INPUT OUTPUT\n prog --help\n\nOptions:\n -v print status messages\n -q report only file names\n -r show all occurrences...
python
chosen
[ { "from": "system", "value": "Add decorator for GDB connect test failing on FreeBSD\n\nllvm.org/pr18313\n\n\ngit-svn-id: 4c4cc70b1ef44ba2b7963015e681894188cea27e@197910 91177308-0d34-0410-b5e6-96231b3b80d8\n" }, { "from": "human", "value": "\"\"\"\nTest lldb 'process connect' command.\n\"\"\"\n\...
python
chosen
[ { "from": "system", "value": "Add S3 static deploy custom resource Lambda function\n" }, { "from": "human", "value": "# import boto3\n\n\ndef lambda_handler(event, context):\n pass\n" }, { "from": "gpt", "value": "# Invoked by: CloudFormation\n# Returns: A `Data` object to a pre-s...
python
chosen
[ { "from": "system", "value": "Patch by Russel Owen: if we have command line arguments zap pyc files\nin the directories given.\n" }, { "from": "human", "value": "# Zap .pyc files\nimport os\nimport sys\n\ndoit = 1\n\ndef main():\n\tif os.name == 'mac':\n\t\timport macfs\n\t\tfss, ok = macfs.GetD...
python
chosen
[ { "from": "system", "value": "Remove single quote marks from jsonif\n" }, { "from": "human", "value": "\"\"\"Add a template tag to turn python objects into JSON\"\"\"\nimport types\nimport json\n\nfrom django import template\nfrom django.utils.safestring import mark_safe\n\nregister = template.L...
python
chosen
[ { "from": "system", "value": "Switch to None based on feedback from @niran\n" }, { "from": "human", "value": "from django.core.exceptions import ImproperlyConfigured\nfrom django.views.generic import TemplateView\nfrom django.views.generic.list import MultipleObjectMixin\nfrom django.utils.trans...
python
chosen
[ { "from": "system", "value": "Make the game booleans editable.\n" }, { "from": "human", "value": "# -*- coding: utf-8 -*-\nfrom django.contrib import admin\n\nfrom .models import Game, Platform\n\n\nclass GameAdmin(admin.ModelAdmin):\n list_display = ['name', 'platform', 'gbid', 'is_abandoned...
python
chosen
[ { "from": "system", "value": "Add file browser to choose a CD.\n" }, { "from": "human", "value": "#!/usr/bin/env python\n\n\"\"\"Wizard to guide user to:\n - insert cd\n - please rip with eac\n - check for a good rip\n - upload with metadata (freedb, musicmind)\n\"\"\"\n\nfrom PyQt4 import QtGui...
python
chosen
[ { "from": "system", "value": "Fix up to the child watcher example.\n\nWithout yielding to the ioloop after each call to client.delete() the child\nznodes would be deleted but that would never be reported.\n" }, { "from": "human", "value": "import logging\nimport random\nfrom tornado import gen\n...
python
chosen
[ { "from": "system", "value": "ERR: Fix space problem and put try around os.kill\n" }, { "from": "human", "value": "\"\"\" Driver script for testing sockets\n Unix only\n\"\"\"\nimport os, sys, time\n\n# Fork, run server in child, client in parent\npid = os.fork()\nif pid == 0:\n # exec the...
python
chosen
[ { "from": "system", "value": "Disable hijacking of previously configured log handlers\n\nSee also:\n\nhttp://docs.celeryproject.org/en/3.1/configuration.html#celeryd-hijack-root-logger\n\nChange-Id: Ibf4618e8bfeb28f877db4a40b4a911ff00442cc9\nReviewed-on: http://review.couchbase.org/82543\nTested-by: Build B...
python
chosen
[ { "from": "system", "value": "Make sure current date is late enough\n" }, { "from": "human", "value": "integration_test = True\n\ntimeout = 2\n\nSLEEP_INTERVAL = int(100e6)\n\ndef check_state(state):\n import re\n from functools import partial\n from operator import is_not\n\n r = re...
python
chosen
[ { "from": "system", "value": "Switch the os import to it's own line for pep8 compliance.\n" }, { "from": "human", "value": "#!/usr/bin/env python\n\n\nimport sys, os\n\n\ndef main():\n django_env_dir = os.path.abspath('%s/../' % os.path.dirname(__file__))\n workon_home = os.environ.get('WO...
python
chosen
[ { "from": "system", "value": "Allow for list/tuples in config files when looking for comma delimited\nstrings.\n" }, { "from": "human", "value": "\"\"\" Module for helper functions used inside jinja2 templates \"\"\"\n\n# NB, each blueprint must individually load any functions defined below\n# f...
python
chosen
[ { "from": "system", "value": "Change estimator script based on modifications to estimator\n" }, { "from": "human", "value": "#!/usr/bin/env python2\nimport numpy as np\nimport matplotlib.pyplot as plt\nimport argparse\nimport sys\nimport os\n\nparser = argparse.ArgumentParser(\n prog='plot_tr...
python
chosen
[ { "from": "system", "value": "Fix Client returns requests's response.\n" }, { "from": "human", "value": "# -*- coding: utf-8 -*-\nfrom operator import methodcaller\n\nimport requests\nfrom furl import furl\n\n\nclass Client(object):\n\n def __init__(self, access_token, base_url='https://api.a...
python
chosen
[ { "from": "system", "value": "Make log filename configurable and optional\n" }, { "from": "human", "value": "\"\"\"\nGewebehaken\n~~~~~~~~~~~\n\nCommand-line interface\n\n:Copyright: 2015-2021 Jochen Kupperschmidt\n:License: MIT, see LICENSE for details.\n\"\"\"\n\nfrom argparse import ArgumentP...
python
chosen
[ { "from": "system", "value": "Update the Portuguese example test\n" }, { "from": "human", "value": "# Portuguese Language Test - Python 3 Only!\nfrom seleniumbase.translate.portuguese import CasoDeTeste\n\n\nclass MinhaClasseDeTeste(CasoDeTeste):\n\n def test_exemplo_1(self):\n self.ab...
python
chosen
[ { "from": "system", "value": "Remove use of metaclass for unit formats\n" }, { "from": "human", "value": "# Licensed under a 3-clause BSD style license - see LICENSE.rst\n\nclass _FormatterMeta(type):\n registry = {}\n\n def __new__(mcls, name, bases, members):\n if 'name' in member...
python
chosen
[ { "from": "system", "value": "Add __str__() method to license model\n\n__unicode__() is not used in python3\n" }, { "from": "human", "value": "from django.db import models\n\n\nclass License(models.Model):\n name = models.CharField(max_length=80, unique=True)\n symbols = models.CharField(m...
python
chosen
[ { "from": "system", "value": "Add booleans in for games.\n" }, { "from": "human", "value": "# -*- coding: utf-8 -*-\nfrom django.contrib import admin\n\nfrom .models import Game, Platform\n\n\nclass GameAdmin(admin.ModelAdmin):\n list_display = ['name', 'platform', 'gbid']\n\n raw_id_field...
python
chosen
[ { "from": "system", "value": "Convert the lat/lng to floats for Point.\n" }, { "from": "human", "value": "from django.views.generic import ListView\nfrom haystack.query import SearchQuerySet\nfrom haystack.utils.geo import Point, D\nfrom ..models import Store\nfrom ..utils import caching_geo_loo...
python
chosen
[ { "from": "system", "value": "8: Create documentation of DataSource Settings \n\nTask-Url: http://github.com/stoeps13/ibmcnx2/issues/issue/8" }, { "from": "human", "value": "######\n# Check ExId (GUID) by Email through JDBC\n#\n# Author: Christoph Stoettner\n# Mail: christoph....
python
chosen
[ { "from": "system", "value": "Add support to getBoolean function for None objects.\n" }, { "from": "human", "value": "\nimport json\nfrom bson import json_util\n\nfrom flask.wrappers import Request, cached_property\n\ndef getBoolean(string):\n return {\n '1': True, 'yes': True, 'true':...
python
chosen
[ { "from": "system", "value": "Add some data into the request context.\nBetter handling of missing Schema objects when logging in (should we raise an error?).\n" }, { "from": "human", "value": "\"\"\"\nMiddleware to automatically set the schema (namespace).\n\nif request.user.is_superuser, then l...
python
chosen
[ { "from": "system", "value": "Change suggested_company_name factory var to pystr\n" }, { "from": "human", "value": "# -*- coding: utf-8 -*-\nimport factory\n\nimport random\nfrom django.conf import settings\nfrom TWLight.resources.models import Partner, Stream, Video, Suggestion\n\n\nclass Partn...
python
chosen
[ { "from": "system", "value": "Enable file logging for the application.\n" }, { "from": "human", "value": "from flask import Flask\nfrom flask.ext.login import login_user, logout_user, current_user, login_required, LoginManager\nfrom flask.ext.sqlalchemy import SQLAlchemy\nfrom flask import Flask...
python
chosen
[ { "from": "system", "value": "Use create instead of instance and save\n" }, { "from": "human", "value": "from urllib import urlencode\nfrom datetime import datetime\n\nfrom django.http import HttpResponseForbidden\nfrom django.contrib.auth.models import AnonymousUser\nfrom django.utils.timezone ...
python
chosen
[ { "from": "system", "value": "Change LengthGenerator to get appropriate file path\n" }, { "from": "human", "value": "from pkg_resources import resource_filename\n\nimport pandas as pd\nimport numpy as np\n\n\nclass LengthGenerator(object):\n def __init__(self,\n length_file=re...
python
chosen
[ { "from": "system", "value": "Clean up some commented out code\n" }, { "from": "human", "value": "from weakref import WeakValueDictionary\n\nclass DuplicateEntryError(Exception):\n def __init__(self, name, obj, registry):\n self.name = name\n self.obj = obj\n self.registr...
python
chosen
[ { "from": "system", "value": "Add 'longdate' filter for readable dates in templates\n" }, { "from": "human", "value": "import datetime\nimport time\n\nfrom nib import jinja\n\n@jinja('time')\ndef timeformat(t=None, f='%Y-%m-%d %I:%M %p'):\n if t is None:\n t = time.gmtime()\n elif i...
python
chosen
[ { "from": "system", "value": "Set upscale to True by default for admin asset\n" }, { "from": "human", "value": "from django.conf import settings\n\n\n# Main Assets Directory. This will be a subdirectory within MEDIA_ROOT.\n# Set to None to use MEDIA_ROOT directly\nDIRECTORY = getattr(settings, \...
python
chosen
[ { "from": "system", "value": "Remove settle_time kwarg from c700\n\nThis kwarg has been removed from ophyd, but will be coming back (and be\nfunctional) soon. Revert these changes when that happens: ophyd 0.2.1)\n" }, { "from": "human", "value": "from ophyd import PVPositioner, EpicsSignal, Epi...
python
chosen
[ { "from": "system", "value": "Add Inline example on post model xadmin\n" }, { "from": "human", "value": "# -*- coding: utf-8 -*-\n#from django.contrib import admin\nfrom .models import Post, Album, Link\n\nfrom opps.contrib import admin\n\nadmin.site.register(Post)\nadmin.site.register(Album)\na...
python
chosen
[ { "from": "system", "value": "Move type_chack_prod module level variable and change its name to _type_check_prod\n" }, { "from": "human", "value": "import numpy\n\nfrom chainer import function\nfrom chainer.utils import type_check\n\n\nclass Reshape(function.Function):\n type_check_prod = typ...
python
chosen
[ { "from": "system", "value": "Add tests of get nonterms\n" }, { "from": "human", "value": "#!/usr/bin/env python\r\n\"\"\"\r\n:Author Patrik Valkovic\r\n:Created 23.06.2017 16:39\r\n:Licence GNUv3\r\nPart of grammpy\r\n\r\n\"\"\"\r\n\r\nfrom unittest import TestCase, main\r\nfrom grammpy import ...
python
chosen
[ { "from": "system", "value": "Add 1-hour expiry to requests_cache (formerly 5 minutes).\n" }, { "from": "human", "value": "\"\"\"\nTop-level Flask application for HXL Proxy\nDavid Megginson\nJanuary 2015\n\nLicense: Public Domain\nDocumentation: http://hxlstandard.org\n\"\"\"\n\nimport os\n\nimp...
python
chosen
[ { "from": "system", "value": "Use Django's Atomic decorator logic\n\nWe now keep Autocommit on it’s new default of True, as we only need the\nability to rollback the contents of a queue job. By setting\nsavepoint=False, the whole job will roll back if anything fails, rather\nthan just up to the containing s...
python
chosen
[ { "from": "system", "value": "Remove database details from acceptance test\n" }, { "from": "human", "value": "import shelve\n\n\ndef test_shows_player_rating(browser, test_server, database_url):\n with shelve.open(database_url) as db:\n db.clear()\n db['p1'] = 1000\n\n app = ...
python
chosen
[ { "from": "system", "value": "Allow saving to a file that does not already exist again.\n" }, { "from": "human", "value": "\nimport tkFileDialog\nimport joincsv\nimport os.path\nimport sys\n\nif __name__ == '__main__':\n filetypes=[(\"Spreadsheets\", \"*.csv\"),\n (\"Spreadsheet...
python
chosen
[ { "from": "system", "value": "Revert \"Remove IF EXISTS from DROP TABLE when resetting the db.\"\n\nThis reverts commit 271668a20a2262fe6211b9f61146ad90d8096486 [formerly a7dce25964cd740b0d0db86b255ede60c913e73d].\n\n\nFormer-commit-id: 08199327c411663a199ebf36379e88a514935399" }, { "from": "human",...
python
chosen
[ { "from": "system", "value": "Fix race conditions in migration 061\n\nMigration 061 is supposed to add new `data_timestamp` field and populate\nit with value of `created_at` column. This was done by selecting all the\nbackups and doing updates one-by-one. As it wasn't done in transaction\nsolution was prone...
python
chosen
[ { "from": "system", "value": "Make paver unittest run more verbose\n" }, { "from": "human", "value": "# -*- coding: utf-8 -*-\n\nfrom paver.easy import *\n\n@task\ndef test(options):\n info(\"Running tests for Python 2\")\n sh('python2 tests.py')\n info(\"Running tests for Python 3\")\n...
python
chosen
[ { "from": "system", "value": "Test the new tos view\n" }, { "from": "human", "value": "# Yith Library Server is a password storage server.\n# Copyright (C) 2012 Yaco Sistemas\n# Copyright (C) 2012 Alejandro Blanco Escudero <alejandro.b.e@gmail.com>\n# Copyright (C) 2012 Lorenzo Gil Sanchez <lore...
python
chosen
[ { "from": "system", "value": ":bug: Fix the inaccessible pages within the involvement package\n" }, { "from": "human", "value": "from __future__ import absolute_import, unicode_literals\n\nfrom django.conf import settings\nfrom django.conf.urls import include, url\n\nfrom search import views as ...
python
chosen
[ { "from": "system", "value": "Add event name and key to alliance selection notifications\n\nThis info is already included in 'event', but adding for consistency" }, { "from": "human", "value": "from consts.notification_type import NotificationType\nfrom helpers.model_to_dict import ModelToDict\n...
python
chosen
[ { "from": "system", "value": "Print an error message when table already exists without failing the script.\n" }, { "from": "human", "value": "import pandas as pd\nimport sys\n\n\ndf = pd.read_csv(sys.argv[1])\ndf.columns = [c.lower() for c in df.columns]\n\nfrom sqlalchemy import create_engine\n...
python
chosen
[ { "from": "system", "value": "Fix typo in method call\n\nTicket #342\n" }, { "from": "human", "value": "from django.template.loader import render_to_string\n\nfrom core.default_eventpage_content import (\n get_default_eventpage_data,\n get_default_menu,\n)\nfrom core.models import Event\n\...
python
chosen
[ { "from": "system", "value": "Add tests to afni To3d.\n\ngit-svn-id: 24f545668198cdd163a527378499f2123e59bf9f@165 ead46cd0-7350-4e37-8683-fc4c6f79bf00\n" }, { "from": "human", "value": "from nipype.interfaces import afni\n\nfrom nose.tools import assert_equal\n\n\ndef test_To3d():\n cmd = afn...
python
chosen
[ { "from": "system", "value": "Add missing module to the project.\n" }, { "from": "human", "value": "\"\"\"\nThe FVCOM Python toolbox (PyFVCOM)\n\n\"\"\"\n\n__version__ = '1.4.1'\n__author__ = 'Pierre Cazenave'\n__credits__ = ['Pierre Cazenave']\n__license__ = 'MIT'\n__maintainer__ = 'Pierre Caze...
python
chosen
[ { "from": "system", "value": "Add passes to Grizzly's lazyOp\n" }, { "from": "human", "value": "\"\"\"Summary\n\"\"\"\nfrom weld.weldobject import *\n\n\ndef to_weld_type(weld_type, dim):\n \"\"\"Summary\n\n Args:\n weld_type (TYPE): Description\n dim (TYPE): Description\n\n ...
python
chosen
[ { "from": "system", "value": "Use X-Frame-Options decorator to override middleware.\n" }, { "from": "human", "value": "\nfrom django.shortcuts import render\n\n\ndef intro(request, template='intro.html'):\n response = render(request, template)\n response['X-Frame-Options'] = 'SAMEORIGIN'\n...
python
chosen
[ { "from": "system", "value": "Remove redundant ast.fix_missing_locations call. Moved to transformer.\n" }, { "from": "human", "value": "import ast\nimport sys\n\nfrom data.logic import _grammar_transformer\nfrom puzzle.problems import problem\n\n\nclass LogicProblem(problem.Problem):\n @staticm...
python
chosen
[ { "from": "system", "value": "Switch cache ban request to new postcommit synchronous method\n" }, { "from": "human", "value": "from api.caching.tasks import ban_url\nfrom framework.tasks.handlers import enqueue_task\nfrom modularodm import signals\n\n@signals.save.connect\ndef log_object_saved(s...
python
chosen
[ { "from": "system", "value": "Add a special exception for capturing object conflicts.\n" }, { "from": "human", "value": "# Licensed to the StackStorm, Inc ('StackStorm') under one or more\n# contributor license agreements. See the NOTICE file distributed with\n# this work for additional informa...
python
chosen
[ { "from": "system", "value": "Set default value for Registry.playbook\n" }, { "from": "human", "value": "from django.db import models\nfrom django.conf import settings\n\nclass Playbook(models.Model):\n name = models.CharField(max_length=200)\n inventory = models.CharField(max_length=200, ...
python
chosen
[ { "from": "system", "value": "Use localhost rather than 0.0.0.0.\n" }, { "from": "human", "value": "import os\nimport tornado.httpserver\nimport tornado.ioloop\nimport tornado.options\nimport tornado.web\n\ntornado.options.define(\"port\", default=8888, type=int)\n\nif __name__ == \"__main__\":\...
python
chosen
[ { "from": "system", "value": "Return TODO rather than None, add pkg_name property for PackageData\n" }, { "from": "human", "value": "class PackageData(object):\n def __init__(self, local_file, name, version):\n self.local_file = local_file\n self.name = name\n self.versio...
python
chosen
[ { "from": "system", "value": "Throw on invalid / missing credentials.\n" }, { "from": "human", "value": "import requests\n\nfrom st2actions.runners.pythonrunner import Action\n\nAPI_URL = 'https://api.travis-ci.org'\nHEADERS_ACCEPT = 'application/vnd.travis-ci.2+json'\nCONTENT_TYPE = 'applicatio...
python
chosen