conversations listlengths 2 3 | source stringclasses 1
value | stack stringclasses 1
value |
|---|---|---|
[
{
"from": "human",
"value": "Enforce the nocase collation on the email table\n"
},
{
"from": "gpt",
"value": "\"\"\" Enforce the nocase collation on the email table\n\nRevision ID: 049fed905da7\nRevises: 49d77a93118e\nCreate Date: 2018-04-21 13:23:56.571524\n\n\"\"\"\n\n# revision identifiers, u... | python | chosen |
[
{
"from": "human",
"value": "Solve Simple Calculate in python\n"
},
{
"from": "gpt",
"value": "import sys\n\ns = 0.0\n\nfor line in sys.stdin:\n a, b, c = line.split()\n a, b, c = int(a), int(b), float(c)\n s += c * b\n\nprint(f'VALOR A PAGAR: R$ {s:.2f}')\n"
}
] | python | chosen |
[
{
"from": "human",
"value": "Add python script to compute fast fourier transforms.\n"
},
{
"from": "gpt",
"value": "#!/usr/bin/env python\nimport csv\nimport numpy as np\nfrom scipy import signal\nfrom scipy.fftpack import fft, ifft\nfrom scipy import fftpack\nimport matplotlib.pyplot as plt\n\n... | python | chosen |
[
{
"from": "human",
"value": "Add migration for Party meta option changes\n"
},
{
"from": "gpt",
"value": "# -*- coding: utf-8 -*-\n# Generated by Django 1.10.5 on 2017-02-06 00:37\nfrom __future__ import unicode_literals\n\nfrom django.db import migrations\n\n\nclass Migration(migrations.Migrati... | python | chosen |
[
{
"from": "system",
"value": "Support for username with extra chars.\n"
},
{
"from": "human",
"value": "from django.conf.urls.defaults import patterns, url\n\nurlpatterns = patterns('avatar.views',\n url('^add/$', 'add', name='avatar_add'),\n url('^change/$', 'change', name='avatar_change'... | python | chosen |
[
{
"from": "human",
"value": "Add test for the instantiation of deplete.Operator\n\nConstruct a minimal cross sections xml file that only\ncontains the depletion_chain node required by\nthe Operator. The path to this file is set to the\nOPENMC_CROSS_SECTIONS file, and reverted after the test.\n\nThe depletio... | python | chosen |
[
{
"from": "human",
"value": "Add helpers to determine verbose_name(_plural)? of arbitrary objects\n"
},
{
"from": "gpt",
"value": "import itertools\n\nfrom django import template\n\n\nregister = template.Library()\n\n\nPATHS = [\n '_meta', # model\n 'queryset.model._meta',\n 'instance._... | python | chosen |
[
{
"from": "human",
"value": "Add script to rotate Supervisor log files\n"
},
{
"from": "gpt",
"value": "#!/usr/bin/env python3\n#\n# Rotates and (optionally) compresses Supervisor logs using `logrotate`\n#\n# See:\n#\n# * https://www.rounds.com/blog/easy-logging-with-logrotate-and-supervisord/\n... | python | chosen |
[
{
"from": "human",
"value": "Add script that converts a field in a tabular data file to cptm input\n"
},
{
"from": "gpt",
"value": "\"\"\"Script that converts a field in a tabular data file to cptm input files\n\nUsed for the CAP vragenuurtje data.\n\nUses frog to pos-tag and lemmatize the data.... | python | chosen |
[
{
"from": "human",
"value": "Add DNS injection test for detecting censorship when DNS inject happens\n"
},
{
"from": "gpt",
"value": "# -*- encoding: utf-8 -*-\nfrom twisted.python import usage\nfrom twisted.internet import defer\n\nfrom ooni.templates import dnst\nfrom ooni import nettest\nfrom... | python | chosen |
[
{
"from": "human",
"value": "Add the Kucera Francis library\n"
},
{
"from": "gpt",
"value": "__author__ = 's7a'\n\n\n# The Kucera Francis class\nclass KuceraFrancis:\n\n # Constructor for the Kucera Francis class\n def __init__(self, dict_file):\n dict = open(dict_file, 'r')\n\n ... | python | chosen |
[
{
"from": "human",
"value": "Add speed test in examples\n"
},
{
"from": "gpt",
"value": "#!/usr/bin/env python\n# -*- coding: utf-8 -*-\n\nimport initExample\nfrom lase.core import KClient\nfrom lase.drivers import Oscillo\n\nimport numpy as np\nimport matplotlib.pyplot as plt\nimport time\n\nde... | python | chosen |
[
{
"from": "human",
"value": "Add RGBController class for LED indicator control"
},
{
"from": "gpt",
"value": "#!/usr/bin/env python\n\n### Class to control the RGB LED Indicator ###\n\nimport Adafruit_BBIO.GPIO as GPIO\nimport time\n\nclass RGBController(object):\n def __init__(self, red_pin ... | python | chosen |
[
{
"from": "human",
"value": "Add a new status to the job statuses to handle errors.\n"
},
{
"from": "gpt",
"value": "\"\"\"empty message\n\nRevision ID: 0071_add_job_error_state\nRevises: 0070_fix_notify_user_email\nCreate Date: 2017-03-10 16:15:22.153948\n\n\"\"\"\n\n# revision identifiers, use... | python | chosen |
[
{
"from": "human",
"value": "Add State to transform between references\n"
},
{
"from": "gpt",
"value": "#!/usr/bin/env python\n\nimport rospy\nimport tf\n\n\nclass TF_transformation:\n \"\"\"\n Transformation from a reference to another\n\n --in_ref frame_id first reference\n ... | python | chosen |
[
{
"from": "human",
"value": "Implement a base job validator using DRF serializers.\n"
},
{
"from": "gpt",
"value": "from rest_framework import serializers\n\n\nclass JobValidator(serializers.Serializer):\n \"\"\"\n A serializer class for validating and deserializing job data.\n Task is ... | python | chosen |
[
{
"from": "system",
"value": "Use xmlrpclib.escape for escaping in PangoMarkupRenderer\n\n"
},
{
"from": "human",
"value": "# vim:fileencoding=utf-8:noet\n\nfrom powerline.renderer import Renderer\nfrom powerline.colorscheme import ATTR_BOLD, ATTR_ITALIC, ATTR_UNDERLINE\n\n\nclass PangoMarkupRen... | python | chosen |
[
{
"from": "human",
"value": "Index Build (project_id, patch_id, date_created)\n"
},
{
"from": "gpt",
"value": "\"\"\"Index Build.project_id,patch_id,date_created\n\nRevision ID: 21b7c3b2ce88\nRevises: 4134b4818694\nCreate Date: 2013-12-03 16:19:11.794912\n\n\"\"\"\n\n# revision identifiers, used... | python | chosen |
[
{
"from": "human",
"value": "search: Add tests for 'available' module\n\nSigned-off-by: Kai Blin <ad3597797f6179d503c382b2627cc19939309418@biosustain.dtu.dk>\n"
},
{
"from": "gpt",
"value": "from api.search import available\n\n\ndef test_available_term_by_category_invalid():\n assert availabl... | python | chosen |
[
{
"from": "human",
"value": "Add a script that will use pyinstaller to create an exe.\n"
},
{
"from": "gpt",
"value": "\"\"\"\r\nBuild (freeze) the versionhero program.\r\n\"\"\"\r\nimport os\r\n\r\n\r\ndef main():\r\n \"\"\"\r\n Run this main function if this script is called directly.\r\... | python | chosen |
[
{
"from": "human",
"value": "TST: Test that there are no ambiguous dispatch definitions\n\nAuthor: Phillip Cloud <cpcloud@gmail.com>\n\nCloses #1026 from cpcloud/test-amb and squashes the following commits:\n\n073d7b8 [Phillip Cloud] TST: Test that there are no ambiguous dispatch definitions\n"
},
{
... | python | chosen |
[
{
"from": "human",
"value": "Add API tests for profile delete\n\nAdd API tests for profile delete\n\nChange-Id: I47a733ce203ba76fc57080a1b086661720e83930\n"
},
{
"from": "gpt",
"value": "# Licensed under the Apache License, Version 2.0 (the \"License\"); you may\n# not use this file except in co... | python | chosen |
[
{
"from": "human",
"value": "Add API test for receiver list\n\nAdd API test for receiver list\n\nChange-Id: I45d63410dc3a8cf361fe2ca446439abd0e9c2cec\n"
},
{
"from": "gpt",
"value": "# Licensed under the Apache License, Version 2.0 (the \"License\"); you may\n# not use this file except in compli... | python | chosen |
[
{
"from": "human",
"value": "Replace `ord` depends on Python version\n"
},
{
"from": "gpt",
"value": "from six import PY3, binary_type\n\n__all__ = 'byte_to_int',\n\n\ndef byte_to_int(x):\n if PY3 and isinstance(x, binary_type):\n return x\n else:\n return ord(x)\n"
}
] | python | chosen |
[
{
"from": "human",
"value": "Add unit test for DatasourceContext\n"
},
{
"from": "gpt",
"value": "import unittest\n\nfrom chassis.services import data_context\nfrom chassis.test.services.foo_context import FooContext\n\n\nclass UnextendedDatasourceContextTest(unittest.TestCase):\n \"\"\"Unit ... | python | chosen |
[
{
"from": "human",
"value": "Add outline of INDRA-based graph completeness checker\n\nThis is what we talked about @sgebel. This can be modified to give name-based checking instead of node-based checking as well as relation-level checking between nodes\n"
},
{
"from": "gpt",
"value": "# -*- codi... | python | chosen |
[
{
"from": "human",
"value": "Add special urls for license (add-on)\n"
},
{
"from": "gpt",
"value": "\"\"\"\nURLCONF for the blog app.\n\"\"\"\n\nfrom django.conf.urls import url\n\nfrom . import views, feeds\n\n\n# URL patterns configuration\nurlpatterns = (\n\n # License index page\n url(... | python | chosen |
[
{
"from": "human",
"value": "Grid: Add a simple set of tests for explicit grid sampling\n"
},
{
"from": "gpt",
"value": "from parcels import Grid\nimport numpy as np\nimport pytest\n\n\n@pytest.fixture\ndef grid(xdim=200, ydim=100):\n \"\"\" Standard grid spanning the earth's coordinates with... | python | chosen |
[
{
"from": "human",
"value": "Add migration to deals to add new currency\n"
},
{
"from": "gpt",
"value": "# -*- coding: utf-8 -*-\nfrom __future__ import unicode_literals\n\nfrom django.db import models, migrations\n\n\nclass Migration(migrations.Migration):\n\n dependencies = [\n ('dea... | python | chosen |
[
{
"from": "human",
"value": "Add iterative approach that changes to quickly\n"
},
{
"from": "gpt",
"value": "\"\"\"\r\nIn a given grid, each cell can have one of three values:\r\n\r\nthe value 0 representing an empty cell;\r\nthe value 1 representing a fresh orange;\r\nthe value 2 representing a... | python | chosen |
[
{
"from": "system",
"value": "Add policy description for 'os-hide-server-addresses'\n\nThis commit adds policy doc for 'os-hide-server-addresses' policies.\n\nPartial implement blueprint policy-docs\n\nChange-Id: I98edbd8579f052c74283bde2ec4f85d301a0807a\n"
},
{
"from": "human",
"value": "# Copy... | python | chosen |
[
{
"from": "human",
"value": "Create and find cases that were viewed two years ago\n\nSteps:\n1. Create 3 case: one new case and two cases with their 'created' property set to 3 years ago\n2. Create an event log for each case with code property 'CASE_VIEWED'\n3. The new case and one of the old cases will hav... | python | chosen |
[
{
"from": "human",
"value": "Read data from file and split the data nad print\n"
},
{
"from": "gpt",
"value": "openFile = open(\"sample.txt\")\nfor line in openFile:\n line = line.rstrip()\n if not line.startswith(\"From \"):\n continue\n words = line.split()\n #print type(wor... | python | chosen |
[
{
"from": "human",
"value": "hslog: Add some tests for an empty game\n"
},
{
"from": "gpt",
"value": "import pytest\nfrom io import StringIO\nfrom hearthstone.enums import PowerType\nfrom hearthstone.hslog import LogParser\n\n\nEMPTY_GAME = \"\"\"\nD 02:59:14.6088620 GameState.DebugPrintPower() ... | python | chosen |
[
{
"from": "human",
"value": "Add test for list project users when no user\n\nThere was no test that shows what happens when you list project users\n(GET /v2.0/tenants/{tenant_id}/users) and a user with a role on the\nproject doesn't exist. The server returns a 404 Not Found for the user.\n\nbp no-check-id\n... | python | chosen |
[
{
"from": "human",
"value": "Add management command to suspend users\n"
},
{
"from": "gpt",
"value": "from django.contrib.auth import get_user_model\nfrom django.core.management.base import BaseCommand, CommandError\n\nUserModel = get_user_model()\n\n\nclass Command(BaseCommand):\n \"\"\"\n ... | python | chosen |
[
{
"from": "human",
"value": "Create an object for create post request\n"
},
{
"from": "gpt",
"value": "from django import forms\nfrom blog_posting import models\n\n\nclass CreatePost(forms.ModelForm):\n class Meta:\n model = models.Post\n exclude = (\"created_at\", \"modified_at... | python | chosen |
[
{
"from": "human",
"value": "Add initial test of assess_cloud_combined."
},
{
"from": "gpt",
"value": "\nfrom mock import call, Mock, patch\n\nfrom assess_cloud import assess_cloud_combined\nfrom deploy_stack import BootstrapManager\nfrom fakejuju import fake_juju_client\nfrom tests import (\n ... | python | chosen |
[
{
"from": "human",
"value": "Write basic unit tests for scatter argument checks\n"
},
{
"from": "gpt",
"value": "\"\"\"test_visualise.py\nUnit testing for the pointcloud.visualise module\n\"\"\"\nimport pytest\nfrom simulocloud.visualise import scatter\nfrom simulocloud.exceptions import BadAxes... | python | chosen |
[
{
"from": "human",
"value": "Add migration file for the addition of andalusian instruments\n"
},
{
"from": "gpt",
"value": "# Generated by Django 2.1.7 on 2019-07-17 10:11\n\nfrom django.db import migrations, models\n\n\nclass Migration(migrations.Migration):\n\n dependencies = [\n ('a... | python | chosen |
[
{
"from": "human",
"value": "Add basic \"copy_app\" mgmt cmd\n"
},
{
"from": "gpt",
"value": "from __future__ import absolute_import, print_function, unicode_literals\n\nfrom django.core.management import BaseCommand\n\nfrom corehq.apps.app_manager.dbaccessors import get_build_doc_by_version, wr... | python | chosen |
[
{
"from": "human",
"value": "Add script to tools/security to check consistency of message file owners.\n\nPeriodic use of this script will show places where the OWNERS files\nhave become inconsistent. This poses a problem for CL authors when\nthe reviewer they have selected doesn't cover all message files,... | python | chosen |
[
{
"from": "human",
"value": "Add test for display module.\n"
},
{
"from": "gpt",
"value": "# -*- coding: utf-8 -*-\n\"\"\"\nTests for board display engine\n\"\"\"\nimport pytest\nfrom fen import Position\nfrom display import render_ascii_board\n\n@pytest.fixture\ndef samples():\n board_sample... | python | chosen |
[
{
"from": "human",
"value": "Test with each example image in the repository\n"
},
{
"from": "gpt",
"value": "#!/usr/bin/env py.test\n# -*- coding: utf-8 -*-\n# Created on Fri Apr 25 02:33:04 2014\n# License is MIT, see COPYING.txt for more details.\n# @author: Danilo de Jesus da Silva Bellini\n\... | python | chosen |
[
{
"from": "human",
"value": "Add simple wrapper script for command line usage\n"
},
{
"from": "gpt",
"value": "import click\n\nfrom thinglang import run\n\n\n@click.command()\n@click.argument('file', type=click.File('r'))\ndef thinglang(file):\n source = file.read()\n run(source)\n\nif __n... | python | chosen |
[
{
"from": "human",
"value": "Create file for positive is_valid tests\n"
},
{
"from": "gpt",
"value": "#!/usr/bin/env python\n\"\"\"\n:Author Patrik Valkovic\n:Created 23.06.2017 16:39\n:Licence GNUv3\nPart of grammpy\n\n\"\"\"\n\nfrom unittest import main, TestCase\nfrom grammpy import Rule\n\n\... | python | chosen |
[
{
"from": "human",
"value": "Add migration (only changes verbose names).\n"
},
{
"from": "gpt",
"value": "# -*- coding: utf-8 -*-\nfrom __future__ import unicode_literals\n\nfrom django.db import models, migrations\nimport partialdate.fields\n\n\nclass Migration(migrations.Migration):\n\n dep... | python | chosen |
[
{
"from": "human",
"value": "Add example for taking heap snapshot\n"
},
{
"from": "gpt",
"value": "#!/usr/bin/env python3\n\n# https://chromedevtools.github.io/debugger-protocol-viewer/tot/HeapProfiler/\n\nimport json\n\nimport requests\nimport selenium\nimport websocket\nfrom devtools.proxy imp... | python | chosen |
[
{
"from": "human",
"value": "Make a list of all non-edX people from people.yaml\n"
},
{
"from": "gpt",
"value": "\"\"\"Produce a list of the emails of all non-edX people in people.yaml\"\"\"\n\nimport yaml\n\nwith open(\"people.yaml\") as people_yaml:\n people = yaml.load(people_yaml)\nnon_edx... | python | chosen |
[
{
"from": "human",
"value": "Use partial index for responded_to_id\n"
},
{
"from": "gpt",
"value": "# -*- coding: utf-8 -*-\nfrom __future__ import unicode_literals\n\nfrom django.db import migrations, models\n\nINDEX_SQL = \"\"\"\n DO $$\n BEGIN\n\n IF NOT EXISTS (\n SELECT 1 FROM pg_class ... | python | chosen |
[
{
"from": "human",
"value": "Add a YouCompleteMe configuration file that contains C-family compilations tags specific to Plexus\n"
},
{
"from": "gpt",
"value": "def Settings(**kwargs):\n return {\n 'flags': [\n '-pthread',\n '-DNDEBUG',\n '-g',\n ... | python | chosen |
[
{
"from": "human",
"value": "Add test case for \"use_default\".\n"
},
{
"from": "gpt",
"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 information regarding copyright... | python | chosen |
[
{
"from": "human",
"value": "Add negative tests for deleting attached volume\n\nDue to lack of an error handling, Nova's delete-volume API returns\nHTTP500 error when deleting an attached volume.\nThis patch adds the corresponding test for reproducing the problem\non the gate and blocking the same issue in ... | python | chosen |
[
{
"from": "human",
"value": "Add export mapping cache tests\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\nimport mock\nfrom collections import defaultdict\n\nfrom ddt import data, ddt\n\nfrom... | python | chosen |
[
{
"from": "human",
"value": "Add a skeleton of builder test.\n"
},
{
"from": "gpt",
"value": "\"\"\"\ntest.test_builder\n~~~~~~~~~~~~~~~~~\n\nThis is the unit test file for site builder.\n\n:Copyright: Copyright 2014 Yang LIU <zesikliu@gmail.com>\n:License: BSD, see LICENSE for details.\n\"\"\"\... | python | chosen |
[
{
"from": "human",
"value": "Add script to print reward table.\n"
},
{
"from": "gpt",
"value": "import numpy as np\n\nimport common\n\n\ndef print_reward(inpaths, legend, budget=1e6, last=1e5, sort=False):\n runs = common.load_runs(inpaths, budget)\n if not legend:\n methods = sorted(set(ru... | python | chosen |
[
{
"from": "human",
"value": "Add basic tests for server.HTTPServer.bind_addr\n"
},
{
"from": "gpt",
"value": "\"\"\"Tests for the HTTP server.\"\"\"\n# -*- coding: utf-8 -*-\n# vim: set fileencoding=utf-8 :\n\nimport os\nimport tempfile\nimport threading\nimport time\n\nimport pytest\n\nimport c... | python | chosen |
[
{
"from": "human",
"value": "Add a client to migrate from ResultParent.user_agent_list to ResultParent.user_agent_pretty\n"
},
{
"from": "gpt",
"value": "#!/usr/bin/python2.4\n#\n# Copyright 2009 Google Inc.\n#\n# Licensed under the Apache License, Version 2.0 (the 'License')\n# you may not use ... | python | chosen |
[
{
"from": "human",
"value": "ADD Django migration for change in Post model\n"
},
{
"from": "gpt",
"value": "# -*- coding: utf-8 -*-\n# Generated by Django 1.10.5 on 2017-02-02 02:07\nfrom __future__ import unicode_literals\n\nfrom django.db import migrations\n\n\nclass Migration(migrations.Migra... | python | chosen |
[
{
"from": "human",
"value": "Implement the view class required to moderate account deletion requests.\n"
},
{
"from": "gpt",
"value": "# Copyright 2011 the Melange authors.\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may not use this file except in compliance w... | python | chosen |
[
{
"from": "human",
"value": "Add migration to backfill is_squashed on squashable models\n"
},
{
"from": "gpt",
"value": "# Generated by Django 2.2.8 on 2019-12-09 21:03\n\nfrom django.db import migrations\n\nBATCH_SIZE = 2500\n\n\ndef populate_is_squashed(apps, schema_editor):\n DailyCount = ... | python | chosen |
[
{
"from": "human",
"value": "Add tests for PropertyModTracker plugin\n"
},
{
"from": "gpt",
"value": "import sqlalchemy as sa\nfrom sqlalchemy_continuum.plugins import PropertyModTrackerPlugin\nfrom tests import TestCase\n\n\nclass TestPropertyModificationsTracking(TestCase):\n plugins = [Pro... | python | chosen |
[
{
"from": "human",
"value": "Add index on poll stats org and question\n"
},
{
"from": "gpt",
"value": "# Generated by Django 2.2.20 on 2021-05-26 16:49\n\nfrom django.db import migrations\n\nINDEX_SQL = \"\"\"\nCREATE INDEX IF NOT EXISTS stats_pollstats_org_question on stats_pollstats (org_id, q... | python | chosen |
[
{
"from": "human",
"value": "Add unit tests for VATINField, VATINValidator\n"
},
{
"from": "gpt",
"value": "import unittest\nfrom decimal import Decimal as D\nfrom oscar_vat_moss.fields import * # noqa\nfrom django.core.exceptions import ValidationError\n\n\nclass VATINValidatorTest(unittest.Te... | python | chosen |
[
{
"from": "human",
"value": "Add initial Falcon API tests\n"
},
{
"from": "gpt",
"value": "import pytest\nimport msgpack\nfrom falcon import API, testing\n\nfrom pianodb.routes import ValidatorComponent, SongFinish\n\n\nTOKEN = 'CB80CB12CC0F41FC87CA6F2AC989E27E'\nAPI_PREFIX = '/api/v1'\nSONGFINI... | python | chosen |
[
{
"from": "human",
"value": "Add tests for response codes for /search route\n"
},
{
"from": "gpt",
"value": "from .helpers import BaseApplicationTest\n\n\nclass TestApplication(BaseApplicationTest):\n def test_search_with_query(self):\n response = self.client.get('/search?q=email')\n ... | python | chosen |
[
{
"from": "human",
"value": "Add iOS api for spatial orientation\n"
},
{
"from": "gpt",
"value": "'''\niOS Spatial Orientation\n-----------------------\n\n'''\n\nfrom plyer.facades import SpatialOrientation\nfrom pyobjus import autoclass\n\n\nclass iOSSpatialOrientation(SpatialOrientation):\n\n ... | python | chosen |
[
{
"from": "human",
"value": "Add validation column for email address.\n"
},
{
"from": "gpt",
"value": "\"\"\"add email validation column\n\nRevision ID: bbba2255e00\nRevises: 38a8a6299086\nCreate Date: 2014-12-16 14:18:45.290836\n\n\"\"\"\n\n# revision identifiers, used by Alembic.\nrevision = '... | python | chosen |
[
{
"from": "human",
"value": "Add script to supervise gene mentions\n"
},
{
"from": "gpt",
"value": "#! /usr/bin/env python3\n#\n# Perform distant supervision on gene mentions\n#\n# Each input row contains a mention and the sentence it is from\n#\n\nimport fileinput\nimport json\n\nfrom dstruct.S... | python | chosen |
[
{
"from": "human",
"value": "Add tutorial loader script based on one in altair\n\nList tutorials from within Jupyter.\n"
},
{
"from": "gpt",
"value": "# Based on altair tutorial loader:\n# https://github.com/altair-viz/altair/blob/273a1fcf9cec1956474af755d5fe32f0e3f0aee8/altair/tutorial.py\n\n# ... | python | chosen |
[
{
"from": "human",
"value": "Create database row class (DBRow)\n"
},
{
"from": "gpt",
"value": "#!/usr/bin/env python\n\n\"\"\"\n dbcol.py: DBCol is a struct describing an sqlite database table column\n\"\"\"\n\nfrom dbcol import *\n\n\n# ----------------------------DATABASE-COLUMN-------------... | python | chosen |
[
{
"from": "human",
"value": "Create a program to Convert String to Camel Case\n"
},
{
"from": "gpt",
"value": "# python3\n# \n# Sample Input: min value array\n# Sample Output: minValueArray\n#\ninputString = input().strip().split(' ')\n\nresult = inputString[0]\n\nfor i in range(1,len(inputStri... | python | chosen |
[
{
"from": "human",
"value": "Add initial gpio commands to python file\n"
},
{
"from": "gpt",
"value": "import RPi.GPIO as gpio\n\n#use board numbering on the pi\n\ngpio.setmode(gpio.BOARD)\n\ngpio.setup(40, gpio.OUT)\ngpio.setup(38, gpio.IN)\n\n#true and 1 are the same\ngpio.output(40, True)\ngp... | python | chosen |
[
{
"from": "system",
"value": "[HOTFIX] Remove replaces line on 0001_squashed\n"
},
{
"from": "human",
"value": "# -*- coding: utf-8 -*-\nfrom __future__ import unicode_literals\n\nfrom django.db import models, migrations\n\n\nclass Migration(migrations.Migration):\n\n replaces = [(b'chat', '0... | python | chosen |
[
{
"from": "human",
"value": "Add script to parse pagerank results.\n"
},
{
"from": "gpt",
"value": "import pandas as pd\nimport argparse\nimport glob\nimport os\n\nif __name__ == \"__main__\":\n\n parser = argparse.ArgumentParser(description='Process some integers.')\n parser.add_argument(... | python | chosen |
[
{
"from": "human",
"value": "[breakdown] Add missing column for tasks\n"
},
{
"from": "gpt",
"value": "\"\"\"Add nb assets ready column\n\nRevision ID: a66508788c53\nRevises: 1e150c2cea4d\nCreate Date: 2021-11-23 00:07:43.717653\n\n\"\"\"\nfrom alembic import op\nimport sqlalchemy as sa\nimport ... | python | chosen |
[
{
"from": "human",
"value": "Add migration for globe channel type\n"
},
{
"from": "gpt",
"value": "# -*- coding: utf-8 -*-\nfrom __future__ import unicode_literals\n\nfrom django.db import migrations, models\n\n\nclass Migration(migrations.Migration):\n\n dependencies = [\n ('channels'... | python | chosen |
[
{
"from": "human",
"value": "Add script used to generate urls test file.\n\nThank you @woxcab for the script.\n"
},
{
"from": "gpt",
"value": "from urllib.parse import urljoin, urlparse\nfrom itertools import product\nimport csv\nimport posixpath\n\n\ndef resolveComponents(url):\n \"\"\"\n ... | python | chosen |
[
{
"from": "system",
"value": "Fix ExpressionEvalutator for Django 1.5 changes to cols property\n"
},
{
"from": "human",
"value": "from django.db.models.sql.expressions import SQLEvaluator\nfrom django.db.models.expressions import ExpressionNode\n\n\nOPERATION_MAP = {\n ExpressionNode.ADD: lam... | python | chosen |
[
{
"from": "human",
"value": "Add a more simple MasterQA example\n"
},
{
"from": "gpt",
"value": "from seleniumbase import MasterQA\n\n\nclass MasterQATests(MasterQA):\n\n def test_masterqa(self):\n self.open(\"http://xkcd.com/1700/\")\n self.verify(\"Do you see a webcomic?\")\n ... | python | chosen |
[
{
"from": "human",
"value": "Add a test for the party autocomplete view\n"
},
{
"from": "gpt",
"value": "from mock import patch, Mock\n\nfrom django_webtest import WebTest\n\n@patch('candidates.views.PopIt')\n@patch('candidates.views.requests')\nclass TestAutocompletePartyView(WebTest):\n\n d... | python | chosen |
[
{
"from": "human",
"value": "Add example for polymorphic inheritance\n"
},
{
"from": "gpt",
"value": "\"\"\"Example of using polymorphic inheritance features to keep multiple related\nmodels in a single collection\"\"\"\n\nimport uuid\n\nfrom modularodm import InheritableStoredObject, fields\nfr... | python | chosen |
[
{
"from": "human",
"value": "Add tests for Bioregistry module\n"
},
{
"from": "gpt",
"value": "from indra.databases import bioregistry\n\n\ndef test_get_ns_from_bioregistry():\n assert bioregistry.get_ns_from_bioregistry('xxxx') is None\n assert bioregistry.get_ns_from_bioregistry('noncode... | python | chosen |
[
{
"from": "human",
"value": "Add migration for ordering of projects\n"
},
{
"from": "gpt",
"value": "# -*- coding: utf-8 -*-\nfrom __future__ import unicode_literals\n\nfrom django.db import models, migrations\nfrom django.conf import settings\n\n\nclass Migration(migrations.Migration):\n\n d... | python | chosen |
[
{
"from": "human",
"value": "Add a script to tell if an Explorer PHAT or HAT is available\n"
},
{
"from": "gpt",
"value": "#!/usr/bin/env python\n# coding: Latin-1\n\nfrom explorerhat import motor\n\n# If ImportError raised, the library is not installed\n# If python exits with the following, the... | python | chosen |
[
{
"from": "human",
"value": "Add test module for IPFGraph\n"
},
{
"from": "gpt",
"value": "#!/usr/bin/python\n# -*- coding: utf-8 -*-\n\nimport unittest\n\n\nimport os, sys\ncmd_folder, f = os.path.split(os.path.dirname(os.path.abspath(__file__)))\nif cmd_folder not in sys.path:\n sys.path.in... | python | chosen |
[
{
"from": "human",
"value": "Add test for email logic (just config)\n"
},
{
"from": "gpt",
"value": "# -*- coding: utf-8 -*-\nimport mock\nimport unittest\n\nimport logic.email\n\n\nclass EmailTest(unittest.TestCase):\n \"\"\"We really just want to test that configuration is honored here.\"\"... | python | chosen |
[
{
"from": "system",
"value": "Remove dead code in dcos_installer.util\n"
},
{
"from": "human",
"value": "import logging\nimport os\n\nCONFIG_PATH = '/genconf/config.yaml'\nSSH_KEY_PATH = '/genconf/ssh_key'\nIP_DETECT_PATH = '/genconf/ip-detect'\nSERVE_DIR = '/genconf/serve'\nSTATE_DIR = '/gencon... | python | chosen |
[
{
"from": "human",
"value": "CC-5884: Modify Pypo -> Download files from cloud storage\n"
},
{
"from": "gpt",
"value": "import os\nimport logging\nimport ConfigParser\nimport urllib2\n\nfrom libcloud.storage.types import Provider, ContainerDoesNotExistError, ObjectDoesNotExistError\nfrom libclou... | python | chosen |
[
{
"from": "human",
"value": "Add solution to lintcode question 96\n"
},
{
"from": "gpt",
"value": "\"\"\"\nDefinition of ListNode\nclass ListNode(object):\n\n def __init__(self, val, next=None):\n self.val = val\n self.next = next\n\"\"\"\nclass Solution:\n \"\"\"\n @param... | python | chosen |
[
{
"from": "human",
"value": "Drop the old xref table\n"
},
{
"from": "gpt",
"value": "\"\"\"Remove the match table.\n\nRevision ID: a8849e4e6784\nRevises: 2979a1322381\nCreate Date: 2020-03-14 20:16:35.882396\n\n\"\"\"\nfrom alembic import op\n\n# revision identifiers, used by Alembic.\nrevision... | python | chosen |
[
{
"from": "human",
"value": "Choose default tab on homepage in settings (following or all)\n"
},
{
"from": "gpt",
"value": "# -*- coding: utf-8 -*-\nfrom __future__ import unicode_literals\n\nfrom django.db import models, migrations\n\n\nclass Migration(migrations.Migration):\n\n dependencies... | python | chosen |
[
{
"from": "human",
"value": "Create OwnStorj backend engine module"
},
{
"from": "gpt",
"value": "from UI.utilities import account_manager\nfrom UI.engine import StorjEngine\nfrom ownstorj_config_manager import OwnStorjConfigManager\n\n# OwnStorj backend enging\n\nstorj_engine = StorjEngine() ... | python | chosen |
[
{
"from": "human",
"value": "Add missing migration for Speaker.biography.\n\nSee 370690e.\n"
},
{
"from": "gpt",
"value": "# -*- coding: utf-8 -*-\n# Generated by Django 1.9.13 on 2018-01-26 18:57\nfrom __future__ import unicode_literals\n\nfrom django.db import migrations, models\n\n\nclass Mig... | python | chosen |
[
{
"from": "human",
"value": "Add script to check the current exercise translations\n"
},
{
"from": "gpt",
"value": "# -*- coding: utf-8 *-*\n\n# This file is part of wger Workout Manager.\n#\n# wger Workout Manager is free software: you can redistribute it and/or modify\n# it under the terms of ... | python | chosen |
[
{
"from": "human",
"value": "Add a test proving a bug in the notify app\n\nAdd a test that reproduces a failure seen in a production environment\nLeaving the actual fix for the people who know how they want it done\n\nNo refs\n"
},
{
"from": "gpt",
"value": "import pytest\n\nfrom shuup.notify.ba... | python | chosen |
[
{
"from": "human",
"value": "Add a XML pareser for GO OBO XML\n"
},
{
"from": "gpt",
"value": "import xml.etree.ElementTree as ElementTree\n\nclass GOXMLParser(object):\n\n def go_term_information(self, xml):\n tree = ElementTree.fromstring(xml)\n return{\n \"name\" :... | python | chosen |
[
{
"from": "human",
"value": "Add a health check tool for use by the deployment tools.\n\nBug: 812965\nChange-Id: I3edcc8830f186c6b02e3d2071a8d7c73b54a4193\nReviewed-on: https://chromium-review.googlesource.com/940382\nReviewed-by: Marc-Antoine Ruel <d2bf0fc09b08f7b0888b3ddab32b3e89c7122c8b@chromium.org>\nCo... | python | chosen |
[
{
"from": "human",
"value": "Add script to stream h264 frames from uv4l\n"
},
{
"from": "gpt",
"value": "#!/usr/bin/env python3\nimport requests\n\nframes = []\ndata = b\"\"\nfound_first = False\nresponse = requests.get(\"http://navigation.local:8080/stream/video.h264\", stream=True)\n\nfor chun... | python | chosen |
[
{
"from": "human",
"value": "Add command to compute the announcement open rate\n"
},
{
"from": "gpt",
"value": "#!/usr/bin/env python3\n\n# Akvo Reporting is covered by the GNU Affero General Public License.\n# See more details in the license.txt file located at the root folder of the Akvo RSR m... | python | chosen |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.