conversations
listlengths
2
3
source
stringclasses
1 value
stack
stringclasses
1 value
[ { "from": "human", "value": "Add python unittest template from TextMate\n" }, { "from": "gpt", "value": "#!/usr/bin/env python\n# encoding: utf-8\n\"\"\"\n${TM_NEW_FILE_BASENAME}.py\n\nCreated by ${TM_FULLNAME} on ${TM_DATE}.\nCopyright (c) ${TM_YEAR} ${TM_ORGANIZATION_NAME}. All rights reserved...
python
chosen
[ { "from": "human", "value": "Add script from printing the DB schema\n" }, { "from": "gpt", "value": "#!/usr/bin/env python3\nimport argparse\n\nfrom sqlalchemy import MetaData\nfrom sqlalchemy_schemadisplay import create_schema_graph\n\n\ndef plot_schema(fn):\n graph = create_schema_graph(\n ...
python
chosen
[ { "from": "human", "value": "Use datetime.date.today() and then if__name__ = '__main__': to make CURDATE available.\n" }, { "from": "gpt", "value": "#!/usr/bin/env python\n# -*- coding: utf-8 -*-\n\"\"\"This is a module gets today's date.\"\"\"\n\nimport datetime\n\nCURDATE = None\n\n\ndef get_c...
python
chosen
[ { "from": "human", "value": "Remove unique constraint for ServiceSmsSenders.\nThis will allow a service to have multiple sms senders.\n" }, { "from": "gpt", "value": "\"\"\"\n\nRevision ID: 0125_remove_unique_constraint\nRevises: 0124_add_free_sms_fragment_limit\nCreate Date: 2017-10-17 16:47:37...
python
chosen
[ { "from": "human", "value": "Add tool for subsetting symbols.\n\n\ngit-svn-id: ed1ad396822b1b6daf934b380f36d983ac38e44f@276 37e447bf-a746-2f79-0798-35135ca55e94\n" }, { "from": "gpt", "value": "#!/usr/bin/python\n#\n# Copyright 2014 Google Inc. All rights reserved.\n#\n# Licensed under the Apach...
python
chosen
[ { "from": "human", "value": "Add tests for version check and metadata behavior\n" }, { "from": "gpt", "value": "from cwltool.load_tool import load_tool\nfrom cwltool.context import LoadingContext, RuntimeContext\nfrom cwltool.errors import WorkflowException\nimport pytest\nfrom .util import (get...
python
chosen
[ { "from": "human", "value": "Revert \"Delete duplicate Python example\"\n" }, { "from": "gpt", "value": "# Copyright 2010-2019 Amazon.com, Inc. or its affiliates. All Rights Reserved.\r\n#\r\n# This file is licensed under the Apache License, Version 2.0 (the \"License\").\r\n# You may not use th...
python
chosen
[ { "from": "system", "value": "Bump PROVISION_VERSION for recent package upgrades.\n" }, { "from": "human", "value": "ZULIP_VERSION = \"1.6.0+git\"\nPROVISION_VERSION = '5.7'\n" }, { "from": "gpt", "value": "ZULIP_VERSION = \"1.6.0+git\"\nPROVISION_VERSION = '5.8'\n" } ]
python
chosen
[ { "from": "human", "value": "Add CodinGame Power of Thor\n" }, { "from": "gpt", "value": "# LX: the X position of the light of power\n# LY: the Y position of the light of power\n# x: Thor's starting X position\n# y: Thor's starting Y position\nLX, LY, x, y = [int(i) for i in raw_input().split()]...
python
chosen
[ { "from": "human", "value": "Add unit tests for SCons.Tool.javac (pathopt class only).\nThis carefully avoids known bugs in order to have passing tests.\n" }, { "from": "gpt", "value": "#\n# __COPYRIGHT__\n#\n# Permission is hereby granted, free of charge, to any person obtaining\n# a copy of th...
python
chosen
[ { "from": "human", "value": "Set up Code Fights weak numbers problem\n" }, { "from": "gpt", "value": "#!/usr/local/bin/python\n# Code Fights Weak Numbers Problem\n\n\ndef weakNumbers(n):\n def get_divisors(n):\n divs = []\n for i in range(1, n + 1):\n count = 0\n ...
python
chosen
[ { "from": "system", "value": "Apply login decorator before permissions check; less 403s, more 302s\n" }, { "from": "human", "value": "from django.http import HttpResponseForbidden\nfrom corehq.apps.domain.decorators import login_and_domain_required\n\ndef require_permission(permission, data=None...
python
chosen
[ { "from": "human", "value": "Add missing phone model test in carepoint cph\n" }, { "from": "gpt", "value": "# -*- coding: utf-8 -*-\n# © 2015-TODAY LasLabs Inc.\n# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).\n\nimport unittest\nfrom sqlalchemy.schema import Table\nfrom car...
python
chosen
[ { "from": "human", "value": "Update image metadata in a project\n" }, { "from": "gpt", "value": "# -*- coding: utf-8 -*-\n\n#\n# * Copyright (c) 2009-2015. Authors: see NOTICE file.\n# *\n# * Licensed under the Apache License, Version 2.0 (the \"License\");\n# * you may not use this file except ...
python
chosen
[ { "from": "human", "value": "Add bulk collection task creator\n" }, { "from": "gpt", "value": "from courtreader import readers\nfrom courtutils.database import Database\nfrom courtutils.logger import get_logger\nfrom datetime import datetime, timedelta\nimport csv\nimport pymongo\nimport os\nimp...
python
chosen
[ { "from": "human", "value": "Put a regression test in place for commit f468afef89d1\n" }, { "from": "gpt", "value": "#!/usr/bin/env python\n\"\"\"when seconds or nano_seconds was set to 0 rather than None (the default) the\nvalue would not be reset to 0 but instead the previous value would remai...
python
chosen
[ { "from": "human", "value": "Add feed support for bookmarks by ericfo\n\n\ngit-svn-id: e32780fd4e06e3e07c0119d454e1aebcae894468@13 413268e4-d34f-0410-bd0d-61523dc7b0b6\n" }, { "from": "gpt", "value": "from atomformat import Feed\nfrom django.core.urlresolvers import reverse\nfrom django.conf imp...
python
chosen
[ { "from": "human", "value": "[NB] Add script to create init portable settings\n\nUsage:\n\n python -m microdrop.bin.create_portable_config [-h] output_dir\n\n Create portable MicroDrop settings directory.\n\n positional arguments:\n output_dir\n\n optional arguments:\n -h, --help show...
python
chosen
[ { "from": "human", "value": "Add config file for Grande Synthe France\n" }, { "from": "gpt", "value": "# -*- coding: utf-8 -*-\n\"\"\"Ideaxbox for Grande Synthe, France\"\"\"\nfrom .idb import * # noqa\nfrom django.utils.translation import ugettext_lazy as _\n\nIDEASCUBE_NAME = u\"Grande-Synthe...
python
chosen
[ { "from": "human", "value": "Add tests for hidden address on ProjectRetrieveSerializer and ProjectSearchSerializer\n" }, { "from": "gpt", "value": "from django.test import TestCase\nfrom django.test import RequestFactory\n\nfrom ovp_projects.models import Project\nfrom ovp_projects.serializers.p...
python
chosen
[ { "from": "human", "value": "Fix migrations for 0.8 -> 0.9 upgrade\n" }, { "from": "gpt", "value": "# -*- coding: utf-8 -*-\nfrom __future__ import unicode_literals\n\nfrom django.db import models, migrations\n\n\ndef update_status(apps, schema_editor):\n Process = apps.get_model(\"viewflow\"...
python
chosen
[ { "from": "human", "value": "Add solution to exercise 3.1.\n" }, { "from": "gpt", "value": "# 3-1 Names\n\nfriend_names = [\"Albert Einstein\", \"Isac Newton\", \"Marie Curie\", \"Galileo Galilei\"]\n\nprint(friend_names[0])\nprint(friend_names[1])\nprint(friend_names[2])\nprint(friend_names[3])...
python
chosen
[ { "from": "human", "value": "Add a basic test case for the unix socket support in cherrypy.\n" }, { "from": "gpt", "value": "import os\nimport sys\nimport socket\nimport atexit\n\nimport cherrypy\nfrom cherrypy.test import helper\nfrom cherrypy._cpcompat import HTTPConnection\n\n\nUSOCKET_PATH =...
python
chosen
[ { "from": "human", "value": "Add a script to rename CATMAID image directories to take account of missing layers\n" }, { "from": "gpt", "value": "#!/usr/bin/python\n\n# This script renames the directories in a CATMAID stack's image root\n# to take into account missing layers corresponding to part...
python
chosen
[ { "from": "human", "value": "Add tests for abstract method NotImplementedError\n" }, { "from": "gpt", "value": "#!/usr/bin/env python3\n\"\"\"Functions for testing the Automaton abstract base class.\"\"\"\n\nimport nose.tools as nose\n\nfrom automata.base.automaton import Automaton\n\n\ndef test...
python
chosen
[ { "from": "system", "value": "Add another test to make sure you can import settings and change them before importing the singleton\n" }, { "from": "human", "value": "import unittest\nfrom nose.tools import *\nimport mock\n\nfrom gargoyle.settings import manager\nimport gargoyle.models\n\n\nclass...
python
chosen
[ { "from": "human", "value": "Correct regridded mask and model\n" }, { "from": "gpt", "value": "\n'''\nSwap the spatial axes. Swap the spectral and stokes axes.\n'''\n\nimport sys\nfrom astropy.io import fits\n\n\nhdu = fits.open(sys.argv[1], mode='update')\n\nhdu[0].data = hdu[0].data.swapaxes(0...
python
chosen
[ { "from": "human", "value": "Add a custom topology example\n" }, { "from": "gpt", "value": "\"\"\"Custom topology example\ns1---s2\n| /\n| /\n| /\ns3\n\nConsist of three fixed core switches, and each core switches will connect to m hosts through n switches. \n\n\"\"\"\n\nfrom mininet.topo imp...
python
chosen
[ { "from": "human", "value": "Add new ISO15008 profile and proportion check" }, { "from": "gpt", "value": "\"\"\"\nChecks for suitability for in-car displays (ISO 15008).\n\"\"\"\n\nfrom fontbakery.callable import check\nfrom fontbakery.section import Section\nfrom fontbakery.status import PASS, ...
python
chosen
[ { "from": "human", "value": "Add a new strategy filtering tasks\n\nIdeally Ansible should allow (from a playbook) to run only part\nof a role thanks to its tags (like the --skip-tags or --tags from\nthe cli). But it's not possible now.\n\nThis code is a PoC code for introducing a kind of filtering,\nwhich b...
python
chosen
[ { "from": "system", "value": "Raise DependencyError when series plugin is missing\n" }, { "from": "human", "value": "from __future__ import unicode_literals, division, absolute_import\nimport logging\n\nfrom sqlalchemy import desc, func\n\nfrom flexget.manager import Session\nfrom flexget.plugin...
python
chosen
[ { "from": "human", "value": "Add unit tests for text_utils\n" }, { "from": "gpt", "value": "\"\"\"\nTests for text_utils.py\n\npart of https://github.com/evil-mad/plotink\n\n\"\"\"\n\nimport unittest\n\nfrom plotink import text_utils\n\n# python -m unittest discover in top-level package dir\n\n#...
python
chosen
[ { "from": "human", "value": "Add script to split indexed files\n" }, { "from": "gpt", "value": "import argparse\nimport os\nimport struct\n\nimport tqdm\n\nif __name__ == '__main__':\n parser = argparse.ArgumentParser()\n parser.add_argument('--input', required=True)\n parser.add_argume...
python
chosen
[ { "from": "human", "value": "Add boilerplate for increment tests\n\nThese would have been very helpful when introducing cython for increment\nfunctions. It is a lot easier to debug at this fine grained level than\nin wrapping functions.\n" }, { "from": "gpt", "value": "from gypsy import incremen...
python
chosen
[ { "from": "human", "value": "Update some comments on audio-in mode, including links to new wiki page. Also add tool wrapper around alsaaudio.cards()\n" }, { "from": "gpt", "value": "#!/usr/bin/env python\n#\n# Licensed under the BSD license. See full license in LICENSE file.\n# http://www.ligh...
python
chosen
[ { "from": "human", "value": "Add a motifdb debug script\n" }, { "from": "gpt", "value": "import requests\n\nserver_url = 'http://ms2lda.org/motifdb/'\n# server_url = 'http://localhost:8000/motifdb/'\n\n\"\"\"Grabbing the latest Motifs from MS2LDA\"\"\"\nmotifset_dict = requests.get(server_url + ...
python
chosen
[ { "from": "human", "value": "Add file for misc tests\n" }, { "from": "gpt", "value": "# coding: utf-8\nfrom __future__ import unicode_literals\n\nfrom ..util import ensure_path\n\nfrom pathlib import Path\nimport pytest\n\n\n@pytest.mark.parametrize('text', ['hello/world', 'hello world'])\ndef t...
python
chosen
[ { "from": "human", "value": "Add barebone content-based, Solr-powered recommender\n" }, { "from": "gpt", "value": "# -*- coding: utf-8 -*-\n\n\"\"\"\n zeit.recommend.morelikethis\n ~~~~~~~~~~~~~~~~~~~~~~~~~~~\n\n This module has no description.\n\n Copyright: (c) 2013 by Nicolas Dreb...
python
chosen
[ { "from": "human", "value": "Add tests for camera linking\n" }, { "from": "gpt", "value": "# -*- coding: utf-8 -*-\n# -----------------------------------------------------------------------------\n# Copyright (c) Vispy Development Team. All Rights Reserved.\n# Distributed under the (new) BSD Lic...
python
chosen
[ { "from": "human", "value": "Add an octave build script\n" }, { "from": "gpt", "value": "#!/usr/bin/python\nfrom __future__ import print_function\nimport os\nimport sys\nimport shutil\nimport subprocess\n\n# Check the system platform first\nplatform = sys.platform\nprint(\"This is a \" + platfor...
python
chosen
[ { "from": "human", "value": "Add failing regression test case for timeout argument preservation on the\nBaseDriver class.\n" }, { "from": "gpt", "value": "# Licensed to the Apache Software Foundation (ASF) under one or more\n# contributor license agreements. See the NOTICE file distributed with...
python
chosen
[ { "from": "human", "value": "Add an example test for get_pdf_text(pdf, page)\n" }, { "from": "gpt", "value": "from seleniumbase import BaseCase\n\n\nclass PdfTestClass(BaseCase):\n\n def test_get_pdf_text(self):\n pdf = (\"https://nostarch.com/download/\"\n \"Automate_the...
python
chosen
[ { "from": "human", "value": "Add initial tests for fsdb\n" }, { "from": "gpt", "value": "# -*- coding: utf-8 -*-\n#\n# Copyright 2016 SUSE LLC\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 ob...
python
chosen
[ { "from": "human", "value": "Implement web scraping functionality for ESPN FC\n" }, { "from": "gpt", "value": "import datetime\n\nfrom aggregator import exceptions\nfrom aggregator.base import Aggregator, Article, InvalidArticle, make_soup\n\nEXCLUDE_IF_IN_TITLE = ['LIVE:', 'WATCH:', 'LISTEN:']\...
python
chosen
[ { "from": "human", "value": "Add unit test for volume extensions client\n\nThis patch adds unit test for volume v2 extensions client.\n\nPartially Implements: blueprint tempest-lib-missing-test-coverage\n\nChange-Id: I5a614fb92f44f5960610dc39299c6effb979be9a\n" }, { "from": "gpt", "value": "# Co...
python
chosen
[ { "from": "human", "value": "Add the Docker client helper\n" }, { "from": "gpt", "value": "from mailu import app\n\nimport docker\nimport signal\n\n\n# Connect to the Docker socket\ncli = docker.Client(base_url=app.config['DOCKER_SOCKET'])\n\n\ndef get(*names):\n result = {}\n all_containe...
python
chosen
[ { "from": "system", "value": "Add maintainer and download URL" }, { "from": "human", "value": "from setuptools import setup, find_packages\n\n\ndef get_long_description():\n with open('./README.rst', 'r') as readme:\n return readme.read()\n\nsetup(\n name='django-email-tracker',\n ...
python
chosen
[ { "from": "system", "value": "Use lowercase name for library\n" }, { "from": "human", "value": "from setuptools import setup\n\n\nsetup(\n name='PyHunter',\n packages=['PyHunter'],\n version='0.2',\n description='An (unofficial) Python wrapper for the Hunter.io API',\n author='Que...
python
chosen
[ { "from": "human", "value": "Solve Code Fights float range problem\n" }, { "from": "gpt", "value": "#!/usr/local/bin/python\n# Code Fights Float Range Problem\n\nfrom itertools import count, takewhile\n\n\ndef floatRange(start, stop, step):\n gen = takewhile(lambda x: x < stop, count(start, s...
python
chosen
[ { "from": "human", "value": "Add Application class,for init all self write module\n" }, { "from": "gpt", "value": "# -*- coding:utf-8 -*-\nimport os,time,asyncio,json\nimport logging\nlogging.basicConfig(level=logging.ERROR)\ntry:\n\tfrom aiohttp import web\nexcept ImportError:\n\tlogging.error(...
python
chosen
[ { "from": "human", "value": "Add migration to change managers\n" }, { "from": "gpt", "value": "# -*- coding: utf-8 -*-\nfrom __future__ import unicode_literals\n\nfrom django.db import migrations, models\nimport zues.utils\n\n\nclass Migration(migrations.Migration):\n\n dependencies = [\n ...
python
chosen
[ { "from": "human", "value": "Add Kavrayskiy VII utils lib\n" }, { "from": "gpt", "value": "\"\"\"Functions that produce a Kavrayskiy VII projection map.\"\"\"\n\nimport math\n\n\ndef coords_to_kavrayskiy(coords):\n \"\"\"Convert geographical coordinates to Kavrayskiy VII coordinates.\n\n A...
python
chosen
[ { "from": "human", "value": "Add functional test for HA template\n\nChange-Id: I6d3304b807492e7041264402d161365447fa6ce1\nSigned-off-by: Angus Salkeld <86b65304d27d8de73dd7d624c33df7e088f8d94b@redhat.com>\n" }, { "from": "gpt", "value": "# vim: tabstop=4 shiftwidth=4 softtabstop=4\n#\n# Licen...
python
chosen
[ { "from": "human", "value": "Add spider for the amendments to the Zan DDL\n" }, { "from": "gpt", "value": "# -*- coding: utf-8 -*-\n\nimport os\nimport re\n\nimport scrapy\n\nAMENDMENT_XPATH = '//dl[@class=\"emendamenti\"]/dt/a/@href'\nAMENDMENT_URL = '/leg/18/BGT/Testi/Emend/0{parent}/0{_id}.ak...
python
chosen
[ { "from": "human", "value": "Add server daily backup script\n" }, { "from": "gpt", "value": "#!/usr/bin/env python2\n# coding: utf-8\n'''\nA daily backup script\nHow to use:\n0. Init a borg repository using `borg init ...`\n1. Fill information in this script\n2. Set a daily cron job for this scr...
python
chosen
[ { "from": "human", "value": "Add script to merge ABR files\n" }, { "from": "gpt", "value": "import os.path\n\nfrom cochlear.util import merge_abr_files\n\n\nif __name__ == '__main__':\n import argparse\n description = 'Merge ABR files'\n parser = argparse.ArgumentParser(description=desc...
python
chosen
[ { "from": "system", "value": "FIX sparse OneClassSVM was using the wrong parameter\n" }, { "from": "human", "value": "import numpy as np\nimport scipy.sparse\nfrom abc import ABCMeta, abstractmethod\n\nfrom ..base import BaseLibSVM\n\n\nclass SparseBaseLibSVM(BaseLibSVM):\n __metaclass__ = AB...
python
chosen
[ { "from": "human", "value": "Add crawler for Johnny Wander\n" }, { "from": "gpt", "value": "from comics.crawler.base import BaseComicCrawler\nfrom comics.crawler.meta import BaseComicMeta\n\nclass ComicMeta(BaseComicMeta):\n name = 'Johnny Wander'\n language = 'en'\n url = 'http://www.j...
python
chosen
[ { "from": "human", "value": "Add protein preview generation script\n" }, { "from": "gpt", "value": "##This script takes a path with PDB files, an output path and a csv file as inputs, and creates a high quality static image\n#of each uniprot in the csv file in the right orientation, coloured by ...
python
chosen
[ { "from": "system", "value": "Update email_id cache when user has registered\n" }, { "from": "human", "value": "from django.db import models\n\nclass Profile(models.Model):\n user = models.EmailField(unique=True)\n nickname = models.CharField(max_length=64, blank=True)\n intro = models....
python
chosen
[ { "from": "human", "value": "Add script demonstrating vlen memory leak\n" }, { "from": "gpt", "value": "\n\"\"\"\n Demonstrates memory leak involving variable-length strings.\n\"\"\"\n\nimport sys\nimport resource\nimport numpy as np\n\nimport h5py\n\nFNAME = 'test.hdf5'\n\nif 'linux' in sys....
python
chosen
[ { "from": "human", "value": "Add migration test for rename\n" }, { "from": "gpt", "value": "import copy\nimport pytest\nimport mock\n\nimport scrapi\nfrom scrapi.linter.document import NormalizedDocument, RawDocument\n\nfrom scrapi import tasks\n\nfrom scrapi.migrations import rename\nfrom scrap...
python
chosen
[ { "from": "human", "value": "Test article structure replacing lettuce tests\n" }, { "from": "gpt", "value": "import unittest\nfrom ddt import ddt, data, unpack\nfrom provider.article_structure import ArticleInfo\n\n\n@ddt\nclass TestArticleStructure(unittest.TestCase):\n\n @unpack\n @data(...
python
chosen
[ { "from": "human", "value": "Add script to connect ExternalAccounts and folders\n -after the pre-merge migrations have been done\n" }, { "from": "gpt", "value": "#!/usr/bin/env python\n# -*- coding: utf-8 -*-\n\"\"\"\nFirst run \n rm -rf website/addons/box/views/\n\nThen change the user_se...
python
chosen
[ { "from": "human", "value": "[modules] Add module for measuring CPU utilization\n\nAdd module \"cpu\", which uses psutil to measure CPU utilization between\ntwo consecutive calls.\n" }, { "from": "gpt", "value": "import bumblebee.module\nimport psutil\n\nclass Module(bumblebee.module.Module):\n ...
python
chosen
[ { "from": "human", "value": "Create skeleton for new rule chooser\n" }, { "from": "gpt", "value": "import random\n\nfrom collections import namedtuple\n\nRule = namedtuple('Rule', ['changes', 'environments'])\n\nsonorization = Rule({'p': 'b', 't': 'd', 'ʈ': 'ɖ', 'c':'ɟ', 'k': 'g', 'q': 'ɢ'},\n ...
python
chosen
[ { "from": "human", "value": "Add a script for the exploration of app-user pairs\n" }, { "from": "gpt", "value": "#!/usr/bin/env python3\n\nimport os, sys\nsys.path.append(os.path.dirname(__file__))\n\nimport random, support\nimport matplotlib.pyplot as pp\n\nsupport.figure()\napp_count = support...
python
chosen
[ { "from": "human", "value": "Add a forker class: spawn children and return results via XML-RPC\n" }, { "from": "gpt", "value": "\nfrom abc import *\nimport os\nfrom SimpleXMLRPCServer import SimpleXMLRPCServer\nimport xmlrpclib\nimport sys\n\nclass Forker(object):\n ''' Easily fork a job and re...
python
chosen
[ { "from": "human", "value": "Add OU Noise as given in ddpg paper\n" }, { "from": "gpt", "value": "# --------------------------------------\n# Reference: https://github.com/rllab/rllab/blob/master/rllab/exploration_strategies/ou_strategy.py\n# --------------------------------------\n\nimport nump...
python
chosen
[ { "from": "human", "value": "Add script to generate sheets formula for personal usage\n" }, { "from": "gpt", "value": "#! /usr/bin/python3\n\nimport argparse\n\ndef generate_rows(lower, upper):\n assert (lower <= upper), \"Lower limit can not be larger than upper\"\n for i in range(lower, uppe...
python
chosen
[ { "from": "human", "value": "Add some dummy test for negative cases when version splitting\n" }, { "from": "gpt", "value": "import pytest\n\nfrom leak.version_parser import versions_split\n\n\ndef test_versions_split():\n pass\n\n\ndef test_wrong_versions_split():\n # too many dots\n as...
python
chosen
[ { "from": "system", "value": "Fix bug in checkConfirmationKey, call the model directly instead of\neval(arg)\n" }, { "from": "human", "value": "from django.contrib.sites.models import Site\nfrom django.core.mail import send_mail\nfrom okupy.libraries.encryption import random_string\nfrom okupy.l...
python
chosen
[ { "from": "human", "value": "Add missing file, which actually belongs to last commit\n" }, { "from": "gpt", "value": "from django import forms\nfrom django.utils.translation import ugettext_lazy as _\n\nfrom . import models\n\n\nclass GameControlAdminForm(forms.ModelForm):\n \"\"\"\n Form ...
python
chosen
[ { "from": "human", "value": "Fix powerdns db table records missing column disabled\n\nFix powerdns db table 'records' missing column 'disabled', which makes powerdns\nservice unable to start.\n\nChange-Id: I3b4c056ca68c44b7e42d20faba555471171b661f\nCloses-Bug: 1409629\n" }, { "from": "gpt", "val...
python
chosen
[ { "from": "system", "value": "Fix bug in email confirmation scripts.\n" }, { "from": "human", "value": "'''\nSend an email to users who haven't confirmed their passwords asking them to confirm.\n'''\n\nimport logging\n\nfrom community_share.models.user import User\nfrom community_share.models.sh...
python
chosen
[ { "from": "human", "value": "Add tests for new 'other_identifier' filter\n" }, { "from": "gpt", "value": "from django.urls import reverse\nfrom rest_framework import status\nfrom rest_framework.test import APITestCase\n\nfrom iati.factory.iati_factory import ActivityFactory, OtherIdentifierFacto...
python
chosen
[ { "from": "human", "value": "Add unit tests for zinnia.context\n" }, { "from": "gpt", "value": "\"\"\"Test cases for Zinnia Context\"\"\"\nfrom django.test import TestCase\nfrom django.template import Context\nfrom django.core.paginator import Paginator\n\nfrom zinnia.context import get_context_...
python
chosen
[ { "from": "human", "value": "Define layer for Mongo client\n" }, { "from": "gpt", "value": "import os\n\nfrom pymongo import MongoClient\nfrom urllib.parse import urlparse\n\nmongo_url = os.environ.get('MONGODB_URL', 'mongodb://localhost:27017/') \n# mongo_url_parse = urlparse(mongo_url)\nmongo_...
python
chosen
[ { "from": "human", "value": "Add some tools for detecting the remote distribution.\n" }, { "from": "gpt", "value": "from fabric.api import run, quiet\nfrom braid import succeeds, cacheInEnvironment\n\n@cacheInEnvironment\ndef distroName():\n \"\"\"\n Get the name of the distro.\n \"\"\"...
python
chosen
[ { "from": "human", "value": "Add tests for lineinfo in cuda.jit\n" }, { "from": "gpt", "value": "from numba.cuda.testing import skip_on_cudasim\nfrom numba import cuda\nfrom numba.core import types\nfrom numba.cuda.testing import CUDATestCase\nimport re\nimport unittest\n\n\n@skip_on_cudasim('Si...
python
chosen
[ { "from": "human", "value": "migrations: Replace special chars in stream & user names with space.\n\nAlso handle potential duplicate stream names created.\nFixes #6534\n" }, { "from": "gpt", "value": "# -*- coding: utf-8 -*-\nfrom django.db import models, migrations\nfrom django.db.backends.post...
python
chosen
[ { "from": "system", "value": "Make Selenium shut down after it's done\n" }, { "from": "human", "value": "#!/usr/bin/python\n\nfrom pyvirtualdisplay import Display\nfrom selenium import webdriver\nfrom selenium.common.exceptions import NoSuchElementException\nfrom selenium.webdriver.common.keys i...
python
chosen
[ { "from": "human", "value": "Add a base class for the backends\n" }, { "from": "gpt", "value": "\nclass BaseWrapper(object):\n\n def set_up():\n pass\n\n def get_key(key, default=None):\n raise NotImplementedError()\n\n def get_key_list(keys, default=None):\n return...
python
chosen
[ { "from": "human", "value": "Make migrate file database members\n\n- Migrate field last_logout to member & field scim_external_id to member\n" }, { "from": "gpt", "value": "# -*- coding: utf-8 -*-\n# Generated by Django 1.11.15 on 2019-02-22 08:30\nfrom __future__ import unicode_literals\n\nfrom...
python
chosen
[ { "from": "human", "value": "Add migration that removes bank_account_reviewed flag on project\n" }, { "from": "gpt", "value": "# -*- coding: utf-8 -*-\n# Generated by Django 1.10.8 on 2018-12-07 13:35\nfrom __future__ import unicode_literals\n\nimport bluebottle.utils.fields\nfrom django.db impo...
python
chosen
[ { "from": "human", "value": "Add test of OperatorCloud auth_type=None\n\nIronic features a noauth mode which is intended for use in isolated\ntrusted environments. As this is not a normal use case for shade,\nit is an increadibly important item to have a test for.\n\nChange-Id: If86b9df238982d912105fb08dcd...
python
chosen
[ { "from": "human", "value": "Add a testcase for CPAN\n" }, { "from": "gpt", "value": "from tests.helper import ExternalVersionTestCase\n\n\nclass CPANTest(ExternalVersionTestCase):\n def test_cpan(self):\n self.assertEqual(self.sync_get_version(\"POE-Component-Server-HTTPServer\", {\"c...
python
chosen
[ { "from": "human", "value": "Add script to show what cairo is doing that is strange\n" }, { "from": "gpt", "value": "import cairo\n\n# this shows that even though we are using integer values\n# for set_source_surface, the subpixel translation is\n# capturing pixel values from adjacent pixels of ...
python
chosen
[ { "from": "human", "value": "Add test module, omitted from prior commit.\n" }, { "from": "gpt", "value": "from jaraco.packaging import depends\n\n\n\ndef test_dependencies_no_namespaces():\n \"\"\"\n Until #1673 lands, ensure dependencies do not employ\n namespace packages.\n \"\"\"\...
python
chosen
[ { "from": "human", "value": "Add some tiny synthetic data for testing\n" }, { "from": "gpt", "value": "import numpy as np\n\n\ntinycycle = np.array([[0, 1, 0],\n [1, 0, 1],\n [0, 1, 0]], dtype=bool)\n\n\nskeleton1 = np.array([[0, 1, 1, 1, 1, 1, 0],\n ...
python
chosen
[ { "from": "human", "value": "Add unit test for xobox.utils.filters.file\n" }, { "from": "gpt", "value": "# -*- coding: utf-8 -*-\n\"\"\"\n tests.t_utils.test_filters\n ~~~~~~~~~~~~~~~~~~~~~~~~~~\n\n :copyright: Copyright 2017 by The Stormrose Project team, see AUTHORS.\n :license: MI...
python
chosen
[ { "from": "human", "value": "Add script to process pending changes separately from the regular refresh cycle\n" }, { "from": "gpt", "value": "from constants import *\nimport sys, time, datetime\nfrom scraper import Scraper\nfrom dateutil import tz\nfrom execute_query import execute_query\n\n\ntr...
python
chosen
[ { "from": "human", "value": "Add tests to verify the proper functioning of decorators\n" }, { "from": "gpt", "value": "from dtest import *\nfrom dtest.util import *\n\n\n@skip\ndef test_skip():\n pass\n\n\n@failing\ndef test_failing():\n pass\n\n\n@attr(attr1=1, attr2=2)\ndef test_attr():\...
python
chosen
[ { "from": "human", "value": "Add tests for playsongin filter\n" }, { "from": "gpt", "value": "#!/usr/bin/env python\n# coding=utf-8\n\nfrom __future__ import print_function, unicode_literals\n\nimport os\nimport os.path\n\nimport nose.tools as nose\n\nfrom tests.utils import run_filter\n\n\ndef ...
python
chosen
[ { "from": "human", "value": "Add main file. Initial functionality, no error checking.\n" }, { "from": "gpt", "value": "#!/usr/bin/env python\n\nimport sys\nimport csv\nimport string\n\n\nclass CSVParetoer():\n\n \"\"\"\n This class represents an instance of paretoization. In short,\n ...
python
chosen
[ { "from": "human", "value": "Include ona database router file\n" }, { "from": "gpt", "value": "from __future__ import unicode_literals, absolute_import\n​\nfrom .constants import SHADOW_MODEL_APP_LABEL\n​\n​\nclass DefaultDatabaseRouter(object):\n​\n def db_for_read(self, model, **hints):\n ...
python
chosen
[ { "from": "system", "value": "Make sure executing lettuce still results in something sane\n" }, { "from": "human", "value": "from lettuce import before, world, after\nfrom splinter.browser import Browser\nfrom salad.logger import logger\n\n\n@before.all\ndef setup_master_browser():\n world.ma...
python
chosen
[ { "from": "human", "value": "Add test for project comments\n" }, { "from": "gpt", "value": "import datetime\n\nfrom django.test import TestCase\n\nfrom django.contrib.auth.models import User\n\nfrom django_comments.models import Comment\n\nfrom pylab.core.models import Project\n\n\nclass Comment...
python
chosen
[ { "from": "human", "value": "Add outbound pifacedigitalio module which uses interrupt events instead of polling.\n" }, { "from": "gpt", "value": "import argparse\nimport json\n\nimport pifacedigitalio as pfdio\nimport zmq\n\n\nPINS = (\n 0b00000001,\n 0b00000010,\n 0b00000100,\n 0b00...
python
chosen
[ { "from": "human", "value": "Add a sample on memoryBP + singlestep (cc Heurs :D)\n" }, { "from": "gpt", "value": "import sys\nimport os.path\nimport pprint\nsys.path.append(os.path.abspath(__file__ + \"\\..\\..\"))\n\nimport windows\nimport windows.test\nimport windows.debug\n\nimport windows.na...
python
chosen