conversations listlengths 2 3 | source stringclasses 1
value | stack stringclasses 1
value |
|---|---|---|
[
{
"from": "human",
"value": "Solve Code Fights deposit profit problem\n"
},
{
"from": "gpt",
"value": "#!/usr/local/bin/python\n# Code Fights Deposit Profit Problem\n\n\ndef depositProfit(deposit, rate, threshold):\n years = 0\n while deposit < threshold:\n deposit *= 1 + rate / 100... | python | chosen |
[
{
"from": "human",
"value": "Add script to export NA members and their position start/end dates\n"
},
{
"from": "gpt",
"value": "\"\"\"Export a CSV listing National Assembly members with term dates.\"\"\"\n\nimport unicodecsv as csv\nimport os\nimport collections\n\nfrom pombola.core.models impo... | python | chosen |
[
{
"from": "human",
"value": "Add DB migration to remove unique on TalkGroup dec_id\n"
},
{
"from": "gpt",
"value": "# -*- coding: utf-8 -*-\n# Generated by Django 1.9.6 on 2017-03-05 21:36\nfrom __future__ import unicode_literals\n\nfrom django.db import migrations, models\n\n\nclass Migration(m... | python | chosen |
[
{
"from": "human",
"value": "Solve Code Fights prime sum problem\n"
},
{
"from": "gpt",
"value": "#!/usr/local/bin/python\n# Code Fights Prime Sum Problem\n\n\ndef primeSum(a, b):\n return sum(filter(lambda p: p > 1 and all(p % n for n in\n range(2, int(p**0.5) + 1)), range(a, b... | python | chosen |
[
{
"from": "human",
"value": "Add placeholder for gwas catalog coverage\n"
},
{
"from": "gpt",
"value": "# ------------------------------------------------\n# built-ins\nimport unittest\n\n# local\nfrom utils.base import TestPostgapBase\n# ------------------------------------------------\n\nclass... | python | chosen |
[
{
"from": "human",
"value": "Add a templatetag to display markdown\n"
},
{
"from": "gpt",
"value": "import bleach\nimport markdown\nfrom django import template\nfrom django.utils.safestring import mark_safe\n\nregister = template.Library()\n\nALLOWED_TAGS = [\n 'a',\n 'abbr',\n 'acronym... | python | chosen |
[
{
"from": "human",
"value": "migrations: Add migration to set default of can_remove_subscribers_group.\n\nThis migration sets can_remove_subscribers_group value to admins system\ngroup for all the existing streams. In further commit we would change\ncan_remove_subscribers_group to be not null and thus we ad... | python | chosen |
[
{
"from": "system",
"value": "Remove constraint on dependency version\n"
},
{
"from": "human",
"value": "from spack import *\n\nclass Hdf(Package):\n \"\"\"HDF4 (also known as HDF) is a library and multi-object\n file format for storing and managing data between machines.\"\"\"\n\n home... | python | chosen |
[
{
"from": "human",
"value": "Remove PyPy 2 as well.\n"
},
{
"from": "gpt",
"value": "import jpype\nimport jpype.imports\njpype.startJVM()\n\nfrom java.util.jar import JarOutputStream\nfrom java.util.jar import JarInputStream\nfrom java.util.jar import JarFile\nfrom java.util.zip import CRC32\nfr... | python | chosen |
[
{
"from": "human",
"value": "Add py solution for 566. Reshape the Matrix\n\n566. Reshape the Matrix: https://leetcode.com/problems/reshape-the-matrix/\n"
},
{
"from": "gpt",
"value": "from operator import add\nclass Solution(object):\n def matrixReshape(self, nums, r, c):\n \"\"\"\n ... | python | chosen |
[
{
"from": "human",
"value": "Add 'dtool copy' functional test\n"
},
{
"from": "gpt",
"value": "\"\"\"Test the ``dtool dataset copy`` command.\"\"\"\n\nimport os\n\nfrom click.testing import CliRunner\n\nfrom dtoolcore import DataSet, ProtoDataSet\n\nfrom . import chdir_fixture, tmp_dir_fixture ... | python | chosen |
[
{
"from": "human",
"value": "Add integration test for sts regionalization\n"
},
{
"from": "gpt",
"value": "# Copyright 2015 Amazon.com, Inc. or its affiliates. All Rights Reserved.\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\"). You\n# may not use this file except in comp... | python | chosen |
[
{
"from": "human",
"value": "Add basic tests for session\n"
},
{
"from": "gpt",
"value": "#!/usr/bin/env python\n# coding=utf-8\n\ntry:\n import unittest.mock as mock\nexcept ImportError:\n import mock\nimport unittest\ntry: \n from StringIO import StringIO\nexcept ImportError:\n fro... | python | chosen |
[
{
"from": "human",
"value": "Add example for AWS Product Advertising API\n"
},
{
"from": "gpt",
"value": "#!/usr/bin/env python3\n'''\nAmazon Product Advertising API Client\n'''\nfrom xml.etree import ElementTree\nimport urllib.parse\nimport dewpoint.aws\nimport sys\n\n\ndef camel_case(name):\n ... | python | chosen |
[
{
"from": "human",
"value": "Add conf file for Sarcelles, FR.\n"
},
{
"from": "gpt",
"value": "# -*- coding: utf-8 -*-\n\"\"\"Ideaxbox for Sarcelles, France\"\"\"\nfrom .idb import * # noqa\nfrom django.utils.translation import ugettext_lazy as _\n\nIDEASCUBE_NAME = u\"Sarcelles\"\nIDEASCUBE_PL... | python | chosen |
[
{
"from": "human",
"value": "Add disk space healthcheck test\n"
},
{
"from": "gpt",
"value": "import unittest\nimport mock\n\nfrom cla_public.apps.base import healthchecks\n\n\nclass DiskSpaceHealthcheckTest(unittest.TestCase):\n @mock.patch('os.statvfs')\n def test_disk_space_check_report... | python | chosen |
[
{
"from": "human",
"value": "Add APT plugin to alert of Debian security updates\n"
},
{
"from": "gpt",
"value": "from sauna.plugins import Plugin, PluginRegister\n\nmy_plugin = PluginRegister('Apt')\n\n\n@my_plugin.plugin()\nclass AptPlugin(Plugin):\n\n def __init__(self, config):\n su... | python | chosen |
[
{
"from": "human",
"value": "Add script to run server\n"
},
{
"from": "gpt",
"value": "# -*- coding: UTF-8 -*-\nfrom picar import app\n\n\nif __name__ == '__main__':\n app.run(debug=True, host='0.0.0.0', port=8080, master=True, processes=1)\n"
}
] | python | chosen |
[
{
"from": "human",
"value": "Add more time to mqtt.test.client\n"
},
{
"from": "gpt",
"value": "import time\nfrom django.test import TestCase\n\nfrom django.contrib.auth.models import User\nfrom django.conf import settings\n\nfrom rest_framework.renderers import JSONRenderer\nfrom rest_framework... | python | chosen |
[
{
"from": "human",
"value": "Add first version of genome merge pipeline\n"
},
{
"from": "gpt",
"value": "import os\nimport luigi\nimport json\nimport subprocess\n\nfrom support import merge_fasta as mf\n\n# add parent directory to path\nif __name__ == '__main__' and __package__ is None:\n os.... | python | chosen |
[
{
"from": "human",
"value": "Define a first concept of the backend API\n"
},
{
"from": "gpt",
"value": "# -*- coding: utf-8 -*-\n#\n# This file is part of TinyIDS.\n#\n# TinyIDS is a distributed Intrusion Detection System (IDS) for Unix systems. \n#\n# Project development web site:\n#\n# ... | python | chosen |
[
{
"from": "human",
"value": "Set up edit service serializers\n"
},
{
"from": "gpt",
"value": "# -*- coding: utf-8 -*-\n# Generated by Django 1.10.6 on 2017-05-05 18:05\nfrom __future__ import unicode_literals\n\nfrom django.db import migrations, models\nimport django.db.models.deletion\n\n\nclas... | python | chosen |
[
{
"from": "human",
"value": "Add a runner for all integration tests.\n"
},
{
"from": "gpt",
"value": "import sys\nfrom test_login_local import TestLoginLocal\nfrom test_registration import TestRegistration\nfrom unittest import TestSuite, TextTestRunner, TestLoader\n\ntest_cases = [\n TestLog... | python | chosen |
[
{
"from": "human",
"value": "Create the Account Detail Page - Part II > New Account - Create Form\n"
},
{
"from": "gpt",
"value": "from django import forms\n\nfrom .models import Account\n\nclass AccountForm(forms.ModelForm):\n class Meta:\n model = Account\n fields = ('name', '... | python | chosen |
[
{
"from": "human",
"value": "Patch to remove 'Add Recipients' button from Email Digest form\n"
},
{
"from": "gpt",
"value": "def execute():\n\timport webnotes\n\twebnotes.conn.sql(\"\"\"\n\t\tDELETE FROM tabDocField\n\t\tWHERE parent = 'Email Digest'\n\t\tAND label = 'Add Recipients'\n\t\tAND fi... | python | chosen |
[
{
"from": "human",
"value": "Add test module for SampleExpectationsDatasetProfiler\n\n- add test__find_next_low_card_column\n"
},
{
"from": "gpt",
"value": "import json\nimport os\nfrom collections import OrderedDict\n\nimport pytest\nfrom six import PY2\n\nimport great_expectations as ge\nfrom ... | python | chosen |
[
{
"from": "human",
"value": "Add example tests for \"load_html_string()\" and \"set_content()\"\n"
},
{
"from": "gpt",
"value": "import pytest\r\nfrom seleniumbase import BaseCase\r\n\r\n\r\n@pytest.mark.offline # Can be run with: \"pytest -m offline\"\r\nclass OfflineTests(BaseCase):\r\n\r\n ... | python | chosen |
[
{
"from": "human",
"value": "Add combined string formatting test\n"
},
{
"from": "gpt",
"value": "a = \"well\"\nb = \"seems to work\"\nc = \"something else\"\nd = 10\nf = 15\n\ns = \"%s: %d, %s: %d, %s: %d\" % (a, d, b, f, c, d)\nprint s\n"
}
] | python | chosen |
[
{
"from": "human",
"value": "Add functional test for listing profile_type\n\nThis patch adds a functional test case for listing Senlin profile\ntypes.\n\nChange-Id: I2510e3d0d7d3b9a216019dc1fda6aebe4a25e2fd\n"
},
{
"from": "gpt",
"value": "# Licensed under the Apache License, Version 2.0 (the \"... | python | chosen |
[
{
"from": "human",
"value": "Add a* tree search algorithm using manhattan distance heuristic\n"
},
{
"from": "gpt",
"value": "\"\"\"\npynpuzzle - Solve n-puzzle with Python\n\nA* tree search algorithm using manhattan distance heuristic\n\nVersion : 1.0.0\nAuthor : Hamidreza Mahdavipanah\nReposit... | python | chosen |
[
{
"from": "human",
"value": "Split the blast search functionality from the compare feature to compartmentalize time heavy features.\n"
},
{
"from": "gpt",
"value": "import os\nimport re\nimport sets\nimport glob\nimport logging\nimport MySQLdb\nimport library.genbank\nlogging.basicConfig(level=l... | python | chosen |
[
{
"from": "human",
"value": "Add migration for detailed_object_repr field\n"
},
{
"from": "gpt",
"value": "# -*- coding: utf-8 -*-\nfrom __future__ import unicode_literals\n\nfrom django.db import models, migrations\nimport jsonfield.fields\n\n\nclass Migration(migrations.Migration):\n\n depe... | python | chosen |
[
{
"from": "human",
"value": "Create ProcessedDataModels for OCD models, group loading into one cmd\n"
},
{
"from": "gpt",
"value": "#!/usr/bin/env python\n# -*- coding: utf-8 -*-\n\"\"\"\nLoad data extracted from scrape and raw data snapshot into OCD models.\n\"\"\"\nfrom django.apps import apps... | python | chosen |
[
{
"from": "human",
"value": "ADD script to generate test bench\n"
},
{
"from": "gpt",
"value": "import sys\nimport os\nimport string\nimport copy\nfrom string import Template\n\nsys.path.append(os.path.join(os.path.dirname(__file__), os.pardir))\nimport sim_utils as sutils\n\nimport gen_sim_top\... | python | chosen |
[
{
"from": "human",
"value": "Add tool to update method names.\n"
},
{
"from": "gpt",
"value": "#!/bin/env python3\n\nimport os\nimport re\nimport sys\n\nif len(sys.argv) < 2 :#or sys.argv[1] == \"--help\":\n print(\"rename_code.py <source_code_directory>\")\n print(\"Update python code to ... | python | chosen |
[
{
"from": "human",
"value": "Add script to read file and generate abuse\n"
},
{
"from": "gpt",
"value": "#!/usr/bin/env python\n\nimport sys\nimport random\n\nfrom abuse.parse import parse\nfrom abuse.generate import generate\nfrom abuse.generate import RuleSet\n\nclass RandomSelector(object):\n... | python | chosen |
[
{
"from": "human",
"value": "Add preprocessor for codefolding extension\n\nThes preprocessor removes folded lines in codecells as defined by the\ncell metadata\n"
},
{
"from": "gpt",
"value": "\"\"\"This preprocessor removes lines in code cells that have been marked as `folded`\nby the codefoldi... | python | chosen |
[
{
"from": "human",
"value": "Test creating letter notification via API\n"
},
{
"from": "gpt",
"value": "from retry.api import retry_call\nfrom config import Config\n\nfrom tests.postman import (\n send_notification_via_api,\n get_notification_by_id_via_api,\n NotificationStatuses\n)\n\n... | python | chosen |
[
{
"from": "human",
"value": "Add tag EC2 dependencies Lambda Python code.\n"
},
{
"from": "gpt",
"value": "'''\nCopyright 2017 Amazon.com, Inc. or its affiliates. All Rights Reserved.\n\nLicensed under the Apache License, Version 2.0 (the \"License\"). You may not use this file\nexcept in compli... | python | chosen |
[
{
"from": "human",
"value": "Add task to fix created_by for courses without it\n"
},
{
"from": "gpt",
"value": "from django.core.management.base import BaseCommand, CommandError\n\nfrom studygroups.models import Course\nfrom django.contrib.auth.models import User\n\nclass Command(BaseCommand):\n... | python | chosen |
[
{
"from": "human",
"value": "Add @njk345's initial work on networktables\n"
},
{
"from": "gpt",
"value": "import time\nfrom networktables import NetworkTables\n\nrioIP = '10.58.06.2' #this shouldn't change\ntableName = 'JetsonToRio' #should be same in rio's java NT program\nupdateRateSecs = 1 \n... | python | chosen |
[
{
"from": "human",
"value": "Add the Freenode module to contrib.\n"
},
{
"from": "gpt",
"value": "import logging\n\nfrom kitnirc.modular import Module\n\n\n_log = logging.getLogger(__name__)\n\n\nclass FreenodeModule(Module):\n \"\"\"A KitnIRC module which provides Freenode-specific functiona... | python | chosen |
[
{
"from": "human",
"value": "Add script to sort graphics\n"
},
{
"from": "gpt",
"value": "import os, shutil\n\ndef copyFile(src, dest):\n try:\n shutil.copy(src, dest)\n # eg. src and dest are the same file\n except shutil.Error as e:\n print('Error: %s' % e)\n # eg. so... | python | chosen |
[
{
"from": "human",
"value": "Add read soft dog data function.\n\nSigned-off-by: Yunchao Chen <c67c666c8087d4aedc12b7d32092a3c04fc5fd4b@xiaoyezi.com>\n"
},
{
"from": "gpt",
"value": "from ctypes import *\n\nSOFT_DOG_DATA_SIZE = 256\nSOFT_DOG_LIBRARY = \"win32dll.dll\"\n\ndef LOGE(message):\n\tpri... | python | chosen |
[
{
"from": "human",
"value": "Drop is_enabled column from people table\n"
},
{
"from": "gpt",
"value": "# Copyright (C) 2015 Google Inc., authors, and contributors <see AUTHORS file>\n# Licensed under http://www.apache.org/licenses/LICENSE-2.0 <see LICENSE file>\n# Created By: anze@reciprocitylab... | python | chosen |
[
{
"from": "human",
"value": "Refactor location of tests for login_manager.py\n"
},
{
"from": "gpt",
"value": "# !/usr/bin/python\n# -*- coding: utf-8 -*-\nfrom project.tests.base import UtilsTestCase\nimport base64\nimport project.home.login_manager as lm\n\n\nclass LoginManagerUtilsTestCase(Uti... | python | chosen |
[
{
"from": "human",
"value": "Create form widget multiple upload\n"
},
{
"from": "gpt",
"value": "from django import forms\nfrom django.conf import settings\nfrom django.template.loader import render_to_string\n\n\nclass MultipleUpload(forms.FileInput):\n\n def render(self, name, value, attrs=... | python | chosen |
[
{
"from": "human",
"value": "Add a United States ATIN module\n\nAn Adoption Taxpayer Identification Number (ATIN) is a temporary\nnine-digit number issued by the United States IRS for a child for whom\nthe adopting parents cannot obtain a Social Security Number.\n"
},
{
"from": "gpt",
"value": "... | python | chosen |
[
{
"from": "human",
"value": "Add failing test for missing About You section on review page when on passported benefits\n"
},
{
"from": "gpt",
"value": "from collections import defaultdict\nimport logging\nimport unittest\n\nfrom bs4 import BeautifulSoup\n\nfrom cla_public.app import create_app\n... | python | chosen |
[
{
"from": "human",
"value": "Create Jenkins jobs per Github repository\n"
},
{
"from": "gpt",
"value": "#!/usr/bin/env python\n\n\"\"\"\nCreate Jenkins job corresponding to each Github repository.\n\"\"\"\n\nimport os\nimport getpass\nimport github3\nimport jenkinsapi\n\n# Github user(s) which r... | python | chosen |
[
{
"from": "human",
"value": "ADD Network setup unit tests\n"
},
{
"from": "gpt",
"value": "\n\ndef test_initial_setup(client):\n result = client.post(\"/setup/\", data={\"setup\": \"setup_configs_sample\"})\n assert result.status_code == 200\n assert result.get_json() == {\"msg\": \"Run... | python | chosen |
[
{
"from": "human",
"value": "Add py solution for 658. Find K Closest Elements\n\n658. Find K Closest Elements: https://leetcode.com/problems/find-k-closest-elements/\n"
},
{
"from": "gpt",
"value": "class Solution(object):\n def findClosestElements(self, arr, k, x):\n \"\"\"\n :... | python | chosen |
[
{
"from": "human",
"value": "Implement a consistent way to check channel rank requirements\n"
},
{
"from": "gpt",
"value": "from twisted.plugin import IPlugin\nfrom txircd.module_interface import IModuleData, ModuleData\nfrom zope.interface import implements\n\nclass ChannelLevel(ModuleData):\n\... | python | chosen |
[
{
"from": "human",
"value": "Increase unit test coverage for exceptions in Packages API.\n\nImplements bp: murano-unit-test-coverage\nCo-Authored-By: David Purcell <david.purcell@att.com>\nCo-Authored-By: Samantha Blanco <samantha.blanco@att.com>\nCo-Authored-By: Julian Sy <julian.sy@att.com>\n\nChange-Id: ... | python | chosen |
[
{
"from": "human",
"value": "Implement monkey patching. It works!\n\nNeeded to fix a few bugs along the way:\n - make sure bind() isn't called twice -- need to be careful about the order\n we load POX modules\n - need to actually send data in send() [even if non-blocking]\n - don't assume that only MockSo... | python | chosen |
[
{
"from": "human",
"value": "Change summary map for generating notification emails\n"
},
{
"from": "gpt",
"value": "from collections import defaultdict\n\nfrom proposal.models import Change, Proposal\nfrom proposal.views import proposal_json\nfrom proposal.query import build_proposal_query\n\n\n... | python | chosen |
[
{
"from": "human",
"value": "[AC-7818] Add a migration to add meeting_info\n"
},
{
"from": "gpt",
"value": "# Generated by Django 2.2.10 on 2020-05-21 18:52\n\nfrom django.conf import settings\nfrom django.db import migrations, models\nimport django.db.models.deletion\n\n\nclass Migration(migrat... | python | chosen |
[
{
"from": "human",
"value": " Write a program to prompt for a score between 0.0 and 1.0. If the score is out of range, print an error message. If the\nscore is between 0.0 and 1.0, print a grade using the following table\n"
},
{
"from": "gpt",
"value": "# Write a program to prompt for a score be... | python | chosen |
[
{
"from": "human",
"value": "Add script to download refseq fungal genomes via FTP\n"
},
{
"from": "gpt",
"value": "#!/usr/bin/env python\nfrom __future__ import print_function\nimport ftplib\nimport sys\n\ngenome_list_fh = open(\"downloaded_genomes.txt\",\"w\")\n\nftp = ftplib.FTP(\"ftp.ncbi.nlm... | python | chosen |
[
{
"from": "human",
"value": "Extend capacity of verifiermain.ip field\n\nAdd migration script to extend the ip field capacity to hold up\nto 255 characters.\n\nResolves: #498\nSigned-off-by: Kaifeng Wang <5bfbeb450d06b1aa9e4417d3c7676f1231c80181@gmail.com>\n"
},
{
"from": "gpt",
"value": "\"\"\"... | python | chosen |
[
{
"from": "human",
"value": "Migrate Request revisions to Assessment revisions\n"
},
{
"from": "gpt",
"value": "# Copyright (C) 2017 Google Inc.\n# Licensed under http://www.apache.org/licenses/LICENSE-2.0 <see LICENSE file>\n\n\"\"\"\nMigrate requests change logs\n\nCreate Date: 2017-01-30 06:0... | python | chosen |
[
{
"from": "human",
"value": "[NF] Test for ECMA loudness computation\n"
},
{
"from": "gpt",
"value": "# -*- coding: utf-8 -*-\n\n# Third party imports\nimport pytest\nfrom numpy import mean\n\n# Local application imports\nfrom mosqito.functions.hearing_model.sine_wave_generator import sine_wave_... | python | chosen |
[
{
"from": "system",
"value": "[MIG] Change the version of module.\n"
},
{
"from": "human",
"value": "# -*- coding: utf-8 -*-\n# Copyright (C) 2009 Renato Lima - Akretion\n# License AGPL-3 - See http://www.gnu.org/licenses/agpl-3.0.html\n\n{\n 'name': 'Brazilian Localisation ZIP Codes',\n ... | python | chosen |
[
{
"from": "human",
"value": "Add tests for Locality management commands\n"
},
{
"from": "gpt",
"value": "# -*- coding: utf-8 -*-\nfrom django.test import TestCase\nfrom django.core.management import call_command\nfrom django.core.management.base import CommandError\n\nfrom .model_factories impor... | python | chosen |
[
{
"from": "human",
"value": "Add script to calculate registration trends\n"
},
{
"from": "gpt",
"value": "from competition.models import Competition\n\nimport collections\nimport csv\nimport datetime\nimport itertools\nimport json\nimport StringIO\n\n\ndef daterange(start_date, end_date):\n n... | python | chosen |
[
{
"from": "human",
"value": "Add migration to remove Emails associated with unconfirmed users\n\nThere should not be any Email records for unconfirmed users.\nThese users would not be able to log in nor confirm their email\n"
},
{
"from": "gpt",
"value": "# -*- coding: utf-8 -*-\n# Generated by ... | python | chosen |
[
{
"from": "human",
"value": "Add acceptance test for vital\n"
},
{
"from": "gpt",
"value": "import unittest\nfrom pathlib import Path\nimport subprocess\n\n\nclass TestVintDoNotDiedWhenLintingVital(unittest.TestCase):\n def assertVintStillAlive(self, cmd):\n try:\n got_outpu... | python | chosen |
[
{
"from": "human",
"value": "Add some basic tests for compound validators which can be expanded upon later.\n"
},
{
"from": "gpt",
"value": "# -*- coding: utf-8 -*-\n\nimport unittest\n\nfrom formencode import compound, Invalid\nfrom formencode.validators import DictConverter\n\n\nclass TestAllC... | python | chosen |
[
{
"from": "human",
"value": "Add tests for settings handlers\n"
},
{
"from": "gpt",
"value": "from flask import url_for\n\nimport pytest\n\nimport roomcontrol.utils.localstorage as ls\n\n\nTEST_FILE = \"\"\"\n[settings]\nserverip=0.0.0.0\nnotify=False\nsendpic=True\n\"\"\"\n\n\n@pytest.fixture\n... | python | chosen |
[
{
"from": "system",
"value": "Fix typo. contact should be context\n"
},
{
"from": "human",
"value": "\"\"\"\nOutput the collected values to . Zer0MQ pub/sub channel\n\"\"\"\n\nfrom Handler import Handler\n\nimport zmq\n\nclass zmqHandler ( Handler ):\n \"\"\"\n Implements the abstract Handle... | python | chosen |
[
{
"from": "human",
"value": "Add migration script for deleted osfstorage\n"
},
{
"from": "gpt",
"value": "import logging\nfrom modularodm import Q\nfrom website.app import init_app\nfrom website.addons.osfstorage.model import OsfStorageFileNode\nfrom scripts import utils as scripts_utils\n\n\nlo... | python | chosen |
[
{
"from": "human",
"value": "Implement the autojoin on connect module\n"
},
{
"from": "gpt",
"value": "from twisted.plugin import IPlugin\nfrom txircd.channel import IRCChannel\nfrom txircd.module_interface import IModuleData, ModuleData\nfrom zope.interface import implements\n\nclass AutoJoin(M... | python | chosen |
[
{
"from": "human",
"value": "Add a basic unit test\n"
},
{
"from": "gpt",
"value": "import requests\nfrom tornalet import tornalet\nfrom trequests import setup_session\nfrom tornado.ioloop import IOLoop\nfrom tornado.escape import json_decode\nfrom tornado.testing import AsyncHTTPTestCase\nfrom ... | python | chosen |
[
{
"from": "human",
"value": "Add minimal unit tests for the manage.py commands\n"
},
{
"from": "gpt",
"value": "from django.core.management import call_command\nfrom django.test import TestCase\n\ntry:\n from unittest.mock import patch\nexcept ImportError:\n from mock import patch\n\n\ncla... | python | chosen |
[
{
"from": "human",
"value": "Add validator for all testcase in dir\n"
},
{
"from": "gpt",
"value": "import re\nimport os\nimport sys\nimport subprocess\nfrom natsort import natsort_keygen, ns\n\nif len(sys.argv) < 2:\n print('python3 validator_all.py testbenchDir')\n exit(0)\n\nsolver = '.... | python | chosen |
[
{
"from": "human",
"value": "Add day 2 part 2 solution.\n"
},
{
"from": "gpt",
"value": "#!/usr/bin/env python\n\nimport re\n\ntotal = 0\n\nwith open('../inputs/02.txt') as f:\n for line in f:\n # data is like \"1x2x3\"\n matches = re.split(\"(\\d+)\", line)\n\n # 7 = 3 matches ... | python | chosen |
[
{
"from": "human",
"value": "Add test of empty geometry collection creation.\n"
},
{
"from": "gpt",
"value": "import unittest\nfrom shapely.geometry.collection import GeometryCollection\n\nclass CollectionTestCase(unittest.TestCase):\n def test_array_interface(self):\n m = GeometryColl... | python | chosen |
[
{
"from": "human",
"value": "Add simple spark on mesos test\n"
},
{
"from": "gpt",
"value": "import pytest\n\nfrom hdfs.client import Client\n\nimport utils\n\n\ndef setup_module(module):\n utils.invoke('install', 'spark')\n\n\n@utils.vagranttest\ndef test_salt_formulas():\n project = util... | python | chosen |
[
{
"from": "human",
"value": "Add AWS Hourly Spending Anomaly Detection\n\nNew plugin checks hourly spending data for all AWS instances and sends\nan alert if the cost threshold has been exceeded.\n\n[DEV-13347]\n"
},
{
"from": "gpt",
"value": "\"\"\"\nChecks the last hour of AWS Billing Data fro... | python | chosen |
[
{
"from": "human",
"value": "Add ratechecker migration to remove_fee_loader\n"
},
{
"from": "gpt",
"value": "# -*- coding: utf-8 -*-\n# Generated by Django 1.11.22 on 2019-10-31 16:33\nfrom __future__ import unicode_literals\n\nfrom django.db import migrations\n\n\nclass Migration(migrations.Mig... | python | chosen |
[
{
"from": "human",
"value": "Add test case for FindLines block\n"
},
{
"from": "gpt",
"value": "#-------------------------------------------------------------------------------\n# Copyright (c) 2011 Anton Golubkov.\n# All rights reserved. This program and the accompanying materials\n# are made a... | python | chosen |
[
{
"from": "human",
"value": "Solve Code Fights pressure gauges problem\n"
},
{
"from": "gpt",
"value": "#!/usr/local/bin/python\n# Code Fights Pressure Gauges Problem\n\n\ndef pressureGauges(morning, evening):\n return [list(map(min, zip(morning, evening))),\n list(map(max, zip(mor... | python | chosen |
[
{
"from": "human",
"value": "Add notification for alliance selections\n"
},
{
"from": "gpt",
"value": "from consts.notification_type import NotificationType\nfrom helpers.model_to_dict import ModelToDict\nfrom notifications.base_notification import BaseNotification\n\n\nclass AllianceSelectionNo... | python | chosen |
[
{
"from": "human",
"value": "Add commandline command for creating accounting data.\n"
},
{
"from": "gpt",
"value": "# -*- coding: utf-8 -*-\nfrom django.core.management.base import BaseCommand\nfrom django.utils.translation import activate\n\nfrom kirppu.accounting import accounting_receipt\n\n\... | python | chosen |
[
{
"from": "human",
"value": "Add a real python one-liner\n"
},
{
"from": "gpt",
"value": "#!/usr/bin/env pypy3\nfrom itertools import permutations as p\n\nprint([i for i in p(set(range(10)) - {1}, 8) if all([i[j] != 0 for j in range(0, 7, 2)]) and (i[0] * 10 + i[1])-(i[2] * 10 + i[3]) == i[4] * ... | python | chosen |
[
{
"from": "human",
"value": "Add a script to display statistics about games result.\n"
},
{
"from": "gpt",
"value": "#!/usr/bin/env python3\n# -*- coding: utf-8 -*-\n\n# Copyright (c) 2016 Jérémie DECOCK (http://www.jdhp.org)\n\n# Permission is hereby granted, free of charge, to any person obtai... | python | chosen |
[
{
"from": "human",
"value": "Add letter logo for Neath Port Talbot Council\n"
},
{
"from": "gpt",
"value": "\"\"\"empty message\n\nRevision ID: 0247_another_letter_org\nRevises: 0246_notifications_index\n\n\"\"\"\n\n# revision identifiers, used by Alembic.\nrevision = '0247_another_letter_org'\n... | python | chosen |
[
{
"from": "human",
"value": "Add check for the MMU type under petitboot\n\nWe expect the petitboot kernel to always use radix MMU on Power9. This\ntest case will also test that Power8 is using hash.\n\nIt uses /proc/cpuinfo while booted into the petitboot environment.\n\nSigned-off-by: Joel Stanley <4816dab... | python | chosen |
[
{
"from": "human",
"value": "Add basic tests for middleware\n"
},
{
"from": "gpt",
"value": "from django.http.response import HttpResponse\nfrom django.test import TestCase\nfrom mock import MagicMock\n\nfrom rewrite_external_links.middleware import RewriteExternalLinksMiddleware\n\n\nclass Test... | python | chosen |
[
{
"from": "human",
"value": "Add script for generating the regexp for which chars to escape.\n"
},
{
"from": "gpt",
"value": "lastback = False\nstartback = 0\n\nunprintable = []\n\nfor i in range(0x7f, 0x10001):\n\tc = chr(i)\n\tthisback = repr(c)[1] == \"\\\\\"\n\tif thisback != lastback:\n\t\t... | python | chosen |
[
{
"from": "human",
"value": "Solve Code Fights replace middle problem\n"
},
{
"from": "gpt",
"value": "#!/usr/local/bin/python\n# Code Fights Replace Middle Problem\n\n\ndef replaceMiddle(arr):\n n = len(arr)\n if n % 2 == 1:\n return arr\n else:\n mid = arr[n // 2 - 1] + ... | python | chosen |
[
{
"from": "human",
"value": "Add an example script to search through every mailbox\n"
},
{
"from": "gpt",
"value": "#! /usr/bin/env python\n# -*- coding: utf-8 -*-\n\n\n\"\"\"Use IMAP CLI to search trhough every mailbox on an account.\"\"\"\n\n\nimport argparse\nimport getpass\nimport logging\ni... | python | chosen |
[
{
"from": "human",
"value": "Add tests for message template admin\n"
},
{
"from": "gpt",
"value": "# -*- coding: utf-8 -*-\nfrom django.urls import reverse\n\nfrom bluebottle.notifications.models import MessageTemplate\nfrom bluebottle.test.utils import BluebottleAdminTestCase\n\n\nclass TestMes... | python | chosen |
[
{
"from": "human",
"value": "Add crawler for KAL's cartoon\n"
},
{
"from": "gpt",
"value": "from dateutil.parser import parse\n\nfrom comics.aggregator.crawler import CrawlerBase, CrawlerResult\nfrom comics.meta.base import MetaBase\n\nclass Meta(MetaBase):\n name = \"KAL's Cartoon\"\n lan... | python | chosen |
[
{
"from": "human",
"value": "Initialize Food scraper, add timing scraper\n"
},
{
"from": "gpt",
"value": "import requests\nfrom bs4 import BeautifulSoup\nfrom collections import OrderedDict\nimport json\nfrom ..scraper import Scraper\n\n\nclass Food(Scraper):\n \"\"\"A scraper for UofT restau... | python | chosen |
[
{
"from": "system",
"value": "Use dictionary lookup only once\n"
},
{
"from": "human",
"value": "from __future__ import absolute_import\n\nimport six\n\nfrom sentry.api.serializers import Serializer, register\nfrom sentry.models import Commit, CommitFileChange\nfrom sentry.api.serializers.models... | python | chosen |
[
{
"from": "human",
"value": "Rename relevant columns on the requests table\n"
},
{
"from": "gpt",
"value": "# Copyright (C) 2016 Google Inc., authors, and contributors <see AUTHORS file>\n# Licensed under http://www.apache.org/licenses/LICENSE-2.0 <see LICENSE file>\n# Created By: samo@reciproci... | python | chosen |
[
{
"from": "human",
"value": "Add a simple load test.\n"
},
{
"from": "gpt",
"value": "# A simple loadtest using locust.\n# launch using: locust -f simpleloadtest.py --host=http://pencilcode.net\n\nfrom locust import HttpLocust, TaskSet, task\nimport simplejson, random\n\nclass MyTaskSet(TaskSet)... | python | chosen |
[
{
"from": "human",
"value": "Copy of rfsom_example.py except with 200 steps instead of 10000, and a topo.gui.link_to_sim() call\n\n"
},
{
"from": "gpt",
"value": "\n\nfrom topo.inputsheet import *\nfrom topo.kernelfactory import *\nfrom topo.simulator import *\nfrom topo.rfsom import RFSOM\nfrom... | python | chosen |
[
{
"from": "human",
"value": "Add a script to check the aspirant MPs\n"
},
{
"from": "gpt",
"value": "from core.models import *\n\nfrom django.core.management.base import NoArgsCommand, CommandError\n\nclass Command(NoArgsCommand):\n\n help = \"Go through people who are MP aspirants, and check... | python | chosen |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.