conversations
listlengths
2
3
source
stringclasses
1 value
stack
stringclasses
1 value
[ { "from": "human", "value": "Increase max length of url field.\n" }, { "from": "gpt", "value": "# -*- coding: utf-8 -*-\n# Generated by Django 1.10 on 2016-09-01 11:22\nfrom __future__ import unicode_literals\n\nfrom django.db import migrations, models\n\n\nclass Migration(migrations.Migration):...
python
chosen
[ { "from": "human", "value": "Add test data generator script\n" }, { "from": "gpt", "value": "#! /usr/bin/env python\n\nimport time\nfrom redis import StrictRedis\nfrom flask_sse import Message\nimport json\n\ncount = 0\nredis=StrictRedis.from_url(\"redis://localhost\")\n\nprint \"Sending SSE eve...
python
chosen
[ { "from": "human", "value": "Add some simple tests for bug_submitted\n\nSigned-off-by: Chris Lamb <711c73f64afdce07b7e38039a96d2224209e9a6c@chris-lamb.co.uk>\n" }, { "from": "gpt", "value": "#!/usr/bin/env python\n# -*- coding: utf-8 -*-\n\nimport unittest\n\nimport os, sys\nsys.path.append(os.p...
python
chosen
[ { "from": "human", "value": "Add example for m3_ice + callback\n\nUsage:\n$ m3_ice snoop -c snsv7_par_csv_callback.py\n" }, { "from": "gpt", "value": "import csv\nfrom datetime import datetime\nimport sys\n\nlogfile = open('mbus_snoop_log.txt','w')\n\nwr = csv.writer(open('snsv7_snoop.txt','w'),...
python
chosen
[ { "from": "human", "value": "Add solution to lintcode question 87\n" }, { "from": "gpt", "value": "\"\"\"\nDefinition of TreeNode:\nclass TreeNode:\n def __init__(self, val):\n self.val = val\n self.left, self.right = None, None\n\"\"\"\nclass Solution:\n \"\"\"\n @param r...
python
chosen
[ { "from": "human", "value": "Update the field to eventbrite_organizer_id\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 ('ac...
python
chosen
[ { "from": "human", "value": "Add sketch for tree-diff test.\n" }, { "from": "gpt", "value": "\n\ndef p2c_to_c2p(p2c):\n c2p = {}\n nodes_needing_parents = list(p2c)\n for parent, children in p2c.items():\n if not children:\n continue\n for child in children:\n ...
python
chosen
[ { "from": "human", "value": "migration: Add migration to remove default status of private streams.\n\nThis commit adds migration which removes default status of exisitng\ndefault private streams, i.e. private stream exists but they are no\nlonger default.\n" }, { "from": "gpt", "value": "# Gener...
python
chosen
[ { "from": "human", "value": "Add test for memoization in N-dimensional pooling kernel generator.\n" }, { "from": "gpt", "value": "import unittest\n\nimport mock\n\nimport chainer\nfrom chainer import testing\nfrom chainer.testing import attr\nfrom chainer.functions.pooling import pooling_nd_kern...
python
chosen
[ { "from": "human", "value": "Add a command to send mail\n" }, { "from": "gpt", "value": "from django.core.management.base import BaseCommand\nfrom django.contrib.auth.models import User\nfrom optparse import make_option\nimport datetime\n\nclass Command(BaseCommand):\n option_list = BaseComma...
python
chosen
[ { "from": "human", "value": "Add a simple test script that invokes the pipeline\n\nSo that we can make sure that all the pieces work together.\nModelled on the existing testPipeline code.\nThanks to Gautham (@gaukes)\n" }, { "from": "gpt", "value": "import unittest\nimport json\nimport logging\n...
python
chosen
[ { "from": "human", "value": "Add a command to help find out-of-sync objects in Elasticsearch\n\nThis is to help trying to figure out the problems behind issue #1424.\n" }, { "from": "gpt", "value": "import sys\n\nfrom django.core.management.base import BaseCommand, CommandError\n\nfrom haystack ...
python
chosen
[ { "from": "human", "value": "recipe-server: Add migration to reset signatures\n\nThis is because the change to send only required fields in the\n/api/v1/recipe/signed/ in f816fbcfc63e4ce56896c0d9e09ff82930f191b9.\n" }, { "from": "gpt", "value": "\"\"\"\nRemoves signatures, so they can be easily ...
python
chosen
[ { "from": "human", "value": "[openid-provider] Create an openid url for the new user register\n\nCreate an openid url with username of the new user automatically when he\nregistered.\n" }, { "from": "gpt", "value": "from registration.signals import user_registered\nfrom django.contrib.auth.model...
python
chosen
[ { "from": "human", "value": "Add migration to allow sermon_preacher to be blank\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 ...
python
chosen
[ { "from": "human", "value": "Add package-level import for SNGP.\n\nPiperOrigin-RevId: 322276743\n" }, { "from": "gpt", "value": "# coding=utf-8\n# Copyright 2020 The Edward2 Authors.\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may not use this file except in co...
python
chosen
[ { "from": "human", "value": "Add a unittest for spacegroup. Still very basic.\n\n\nFormer-commit-id: 515d29a50e2b0abf9889329545a6218ec8dbb707 [formerly ad5f851b7959f7bf09d7cd669d8db126fa962982]\nFormer-commit-id: 51cd323da532e54c94f8d427ed631c11c9ecfae5" }, { "from": "gpt", "value": "#!/usr/bin/...
python
chosen
[ { "from": "human", "value": "Add (python) basic model itself\n" }, { "from": "gpt", "value": "# -*- coding: utf-8 -*-\n\nimport tensorflow as tf\n\nx = tf.placeholder(\"double\") \ny = tf.placeholder(\"double\")\nz = tf.mul(x, y)\n\nwith tf.Session() as sess:\n tf.train.write_graph(sess.graph...
python
chosen
[ { "from": "human", "value": "Add simple test that api functions are importable\n" }, { "from": "gpt", "value": "import unittest\nimport random\nimport importlib\n\nclass TestUnit(unittest.TestCase):\n def test_api_imports(self):\n expected_names = ['node', 'bind_call_state', 'star', 's...
python
chosen
[ { "from": "human", "value": "Add letter organisation for Companies House\n\nDepends on:\n- [ ] https://github.com/alphagov/notifications-template-preview/pull/37\n" }, { "from": "gpt", "value": "\"\"\"empty message\n\nRevision ID: 0114_another_letter_org\nRevises: 0113_job_created_by_nullable\nC...
python
chosen
[ { "from": "human", "value": "Add a snippet (Python GTK+3).\n" }, { "from": "gpt", "value": "#!/usr/bin/env python3\n# -*- coding: utf-8 -*-\n\n# Copyright (c) 2015 Jérémie DECOCK (http://www.jdhp.org)\n\n\"\"\"\nThis is the simplest Python GTK+3 Paned snippet.\n\nSee: https://lazka.github.io/pgi...
python
chosen
[ { "from": "human", "value": "Add script to show what python modules are installed\n" }, { "from": "gpt", "value": "# from http://stackoverflow.com/a/23885252\n\nimport pip\ninstalled_packages = pip.get_installed_distributions()\ninstalled_packages_list = sorted([\"%s==%s\" % (i.key, i.version)\n...
python
chosen
[ { "from": "human", "value": "Add tests for the share button\n" }, { "from": "gpt", "value": "# -*- coding: utf-8 -*-\nfrom selenium_tests.UserDriverTest import UserDriverTest\nfrom selenium.webdriver.common.by import By\nfrom selenium.webdriver.common.keys import Keys\n\n\nclass TestShareApplica...
python
chosen
[ { "from": "human", "value": "Add missed call service audio notification to active subscriptions\n" }, { "from": "gpt", "value": "from django.core.exceptions import ObjectDoesNotExist\nfrom django.core.management.base import BaseCommand, CommandError\n\nfrom subscriptions.models import Subscripti...
python
chosen
[ { "from": "human", "value": "Implement basic tests for GCI student form uploads.\n" }, { "from": "gpt", "value": "# Copyright 2012 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 with the License.\n# Y...
python
chosen
[ { "from": "human", "value": "Fix amount matching in wrong currency\n" }, { "from": "gpt", "value": "# -*- coding: utf-8 -*-\n# Generated by Django 1.11.15 on 2019-11-08 09:08\nfrom __future__ import unicode_literals\n\nfrom django.db import migrations\n\n\ndef fix_funding_matching_currencies(app...
python
chosen
[ { "from": "human", "value": "Add script to count label set statistics\n\nAdded a script that outputs statistics about label sets in the data.\n" }, { "from": "gpt", "value": "\"\"\"Count labelsets that occur in the multilabel data.\n\nInput: name of the directory that contains the multilabel dat...
python
chosen
[ { "from": "system", "value": "Use json_handler to force ugettext_lazy\n" }, { "from": "human", "value": "import json\nfrom datetime import datetime\nfrom django.core.management import BaseCommand, CommandError\nfrom corehq.apps.importer.tasks import do_import\nfrom corehq.apps.importer.util impo...
python
chosen
[ { "from": "human", "value": "Create function in python to transpose matrix\n" }, { "from": "gpt", "value": "def transpose_matrix(matrix):\n matrix_rows_quantity = len(matrix)\n matrix_column_quantity = len(matrix[0])\n\n transposed_matrix = [[0] * matrix_rows_quantity for _ in range(mat...
python
chosen
[ { "from": "human", "value": "Add notification email reply_to script\n" }, { "from": "gpt", "value": "\"\"\"empty message\n\nRevision ID: 0130_service_email_reply_to_row\nRevises: 0129_add_email_auth_permission\nCreate Date: 2017-08-29 14:09:41.042061\n\n\"\"\"\n\n# revision identifiers, used by ...
python
chosen
[ { "from": "human", "value": "Add mgmt cmd to clear bad location user data\n" }, { "from": "gpt", "value": "from django.core.management.base import BaseCommand\nfrom corehq.apps.es import UserES\nfrom corehq.apps.users.models import CommCareUser\nfrom corehq.util.couch import iter_update, DocUpda...
python
chosen
[ { "from": "human", "value": "Add template script for supporting OpenStreetMap\n" }, { "from": "gpt", "value": "# -*- coding: utf-8 -*-\n\"\"\"\n\tsphinxcontrib.openstreetmap\n\t===========================\n\n\tEmbed OpenStreetMap on your documentation.\n\n\t:copyright: Copyright 2015 HAYASHI Ken...
python
chosen
[ { "from": "human", "value": "Add SurveyKoboProject which optionally indicates a form/submission origin\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 ...
python
chosen
[ { "from": "human", "value": "Add a test for lib.environment\n" }, { "from": "gpt", "value": "# Run the following command to test:\n#\n# (in /usr/local/googkit)\n# $ python -m {test_module_name}\n#\n# See also: http://docs.python.org/3.3/library/unittest.html#command-line-interface\n#\n# ...
python
chosen
[ { "from": "human", "value": "Add test for basic builtin types.\n" }, { "from": "gpt", "value": "# basic types\n\nprint(bool)\nprint(int)\nprint(float)\nprint(complex)\nprint(tuple)\nprint(list)\nprint(set)\nprint(dict)\n\nprint(type(bool()) == bool)\nprint(type(int()) == int)\nprint(type(float()...
python
chosen
[ { "from": "human", "value": "Add test script for verifying counts.\n" }, { "from": "gpt", "value": "# -*- coding: utf-8 -*-\nimport sys\nimport logging\nfrom website.app import setup_django, init_app\nfrom scripts import utils as script_utils\nfrom django.db import transaction\n\nsetup_django()\...
python
chosen
[ { "from": "human", "value": "Add test for cis-splice-effects main\n" }, { "from": "gpt", "value": "#!/usr/bin/env python\n\n'''\ntest_cis_splice_effects_main.py -- Integration test for `regtools cis-splice-effects`\n\n Copyright (c) 2015, The Griffith Lab\n\n Author: Avinash Ramu <aramu@ge...
python
chosen
[ { "from": "human", "value": "Add file for tests of setting invalid nonterminal as start symbol\n" }, { "from": "gpt", "value": "#!/usr/bin/env python\n\"\"\"\n:Author Patrik Valkovic\n:Created 10.08.2017 23:20\n:Licence GNUv3\nPart of grammpy\n\n\"\"\"\n\nfrom unittest import TestCase, main\nfro...
python
chosen
[ { "from": "human", "value": "Add missing migration (validators on Route.url)\n" }, { "from": "gpt", "value": "# -*- coding: utf-8 -*-\nfrom __future__ import unicode_literals\n\nfrom django.db import models, migrations\nimport conman.routes.validators\n\n\nclass Migration(migrations.Migration):\...
python
chosen
[ { "from": "human", "value": "Update DB migrations following upstream change in ICEkit\n\nThe `WorkflowStateMixin` model in django-icekit --\nwhich is used as a basis for the `PressReleaseListing`\nmodel -- was updated with two new fields: `brief`,\nand `admin_notes`.\n\nThis change updates the model in this...
python
chosen
[ { "from": "human", "value": "Add a migration to replace notifications_template foreign key\n\nRemoves notifications.template_id foreign key and replaces it with\na composite foreign key constraint to TemplateHistory using the\nexisting notification columns for template ID and template version.\n\nForeign ke...
python
chosen
[ { "from": "human", "value": "Add migration for meta change on Extensions\n" }, { "from": "gpt", "value": "# Generated by Django 2.0.5 on 2018-05-10 22:56\n\nfrom django.db import migrations\n\n\nclass Migration(migrations.Migration):\n\n dependencies = [\n ('studies', '0001_initial'),\...
python
chosen
[ { "from": "human", "value": "Add migration for translation cleanup\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 ('connect_...
python
chosen
[ { "from": "human", "value": "Add migration to create echonest user\n" }, { "from": "gpt", "value": "# -*- coding: utf-8 -*-\nfrom __future__ import unicode_literals\n\nfrom django.db import models, migrations\n\n\ndef add_echonest_forward(apps, schema_editor):\n \"\"\"Create echonest user.\"\...
python
chosen
[ { "from": "human", "value": "Add post_save signal for annotations to add correct object level permissions\n" }, { "from": "gpt", "value": "from django.dispatch import receiver\nfrom django.db.models.signals import post_save\nfrom guardian.shortcuts import assign_perm\nfrom django.conf import set...
python
chosen
[ { "from": "human", "value": "Add new coupon category for edX.\n\nAdded a data migration to create a new coupon category for edX\nemployees.\n\nPROD-1177\n" }, { "from": "gpt", "value": "# -*- coding: utf-8 -*-\n# Generated by Django 1.11.27 on 2020-01-22 09:46\nfrom __future__ import unicode_lit...
python
chosen
[ { "from": "human", "value": "Add solution to exercise 4.4.\n" }, { "from": "gpt", "value": "# 4-5. Summing a Million\n\nnumbers = list(range(1, 1000001))\nprint(\"min = \", min(numbers))\nprint(\"max = \", max(numbers))\nprint(\"sum = \", sum(numbers))\n" } ]
python
chosen
[ { "from": "human", "value": "Add migration for removing unused columns in project\n" }, { "from": "gpt", "value": "\"\"\"delete unused project columns\n\nRevision ID: 36fba9f9069d\nRevises: 151b2f642877\nCreate Date: 2015-08-07 09:45:22.044720\n\n\"\"\"\n\n# revision identifiers, used by Alembic...
python
chosen
[ { "from": "human", "value": "Add tests for the base endpoint HTTP methods\n\nThis tests the `try: ... except: raise finally: ...` gotcha caught\nby @pocin.\n" }, { "from": "gpt", "value": "import unittest\n\nfrom requests import HTTPError\n\nfrom kbcstorage.base import Endpoint\n\n\nclass TestEn...
python
chosen
[ { "from": "human", "value": "Add next text of chaining when looking for nonterminals rewritable to epsilon\n" }, { "from": "gpt", "value": "#!/usr/bin/env python\n\"\"\"\n:Author Patrik Valkovic\n:Created 20.08.2017 16:07\n:Licence GNUv3\nPart of grammpy-transforms\n\n\"\"\"\n\n\nfrom unittest i...
python
chosen
[ { "from": "human", "value": "Set FlowRun.respnoded to be non-nullable\n" }, { "from": "gpt", "value": "# -*- coding: utf-8 -*-\nfrom __future__ import unicode_literals\n\nfrom django.db import migrations, models\nfrom django.conf import settings\n\n\nclass Migration(migrations.Migration):\n\n ...
python
chosen
[ { "from": "human", "value": "Add migration to resolve inconsistency between python2 and python3 strings\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 ...
python
chosen
[ { "from": "human", "value": "Add a script to load a Keras model from MongoDB where it was stored by Sacred.\n" }, { "from": "gpt", "value": "\"\"\"\nA simple Python API for loading Keras models from MongoDB run artifact stored\nby the Sacred library.\n\nUsage:\n\nrun_id = '5843062c4e60f9a60c9db4...
python
chosen
[ { "from": "human", "value": "Remove old files and empty directories\n" }, { "from": "gpt", "value": "#!/usr/bin/env python\n# -*- encoding: utf-8 -*-\nimport os\n\nimport time\n\nimport sys\n\n\ndef delete(path):\n print(path)\n try:\n os.unlink(path)\n except PermissionError as ...
python
chosen
[ { "from": "human", "value": "Add a check to assert a file is a minimum size\n\nEFG generates an extract of the IL2 data by extracting and converting\neach night to an IL0 representation.\n\nThis check is intended to be used to verify that the file is generated\nand looks reasonable.\n" }, { "from": ...
python
chosen
[ { "from": "human", "value": "Add compact watershed gallery example\n" }, { "from": "gpt", "value": "\"\"\"\n=============================================\nFind Regular Segments Using Compact Watershed\n=============================================\n\nThe watershed transform is commonly used as a...
python
chosen
[ { "from": "human", "value": "Add configurable jingle interval migration\n" }, { "from": "gpt", "value": "\"\"\"Add jingle interval\n\nRevision ID: 283afd3c9a32\nRevises: 53954e77cafc\nCreate Date: 2019-06-26 12:48:16.180224\n\n\"\"\"\n\n# revision identifiers, used by Alembic.\nrevision = '283af...
python
chosen
[ { "from": "human", "value": "Add an index to speed up update_status\n\nThis adds an index that speeds up the update_status method in\ndesignate-central\n\nChange-Id: I62600ebbf066dc746a696263f0e72ca373076353\nCloses-Bug: 1445115\n" }, { "from": "gpt", "value": "# Copyright (c) 2015 Rackspace Inc...
python
chosen
[ { "from": "human", "value": "Add test of full flow in WSGI app.\n" }, { "from": "gpt", "value": "import json\n\nimport pytest\nfrom future.backports.urllib.parse import urlencode\nfrom jwkest.jwk import RSAKey, rsa_load\nfrom jwkest.jws import JWS\n\n\nclass TestWSGIApp:\n @pytest.fixture(aut...
python
chosen
[ { "from": "human", "value": "Add data repository package. Link to externally installed nipy data." }, { "from": "gpt", "value": "\"\"\"Information used for locating nipy test data.\n\nNipy uses a set of test data that is installed separately. The test\ndata should be located in the directory `...
python
chosen
[ { "from": "human", "value": "Add smoke test for thread state collection\n\nOnly a smoke test until more advanced facilities to inspect the capture view\nare introduced.\n\nBug: http://b/176960292\n\nTest: Run the test locally.\n" }, { "from": "gpt", "value": "\"\"\"\nCopyright (c) 2020 The Orbit...
python
chosen
[ { "from": "human", "value": "Fix matching currency being different then target currency\n\nBB-15798 #resolve\n" }, { "from": "gpt", "value": "# -*- coding: utf-8 -*-\n# Generated by Django 1.11.15 on 2019-11-16 14:40\nfrom __future__ import unicode_literals\n\nfrom django.db import migrations\nf...
python
chosen
[ { "from": "human", "value": "Add test suite for SettingRelation\n\nExtremely simple test since SettingRelation is essentially a tuple.\n\nContributes to issue CURA-1278.\n" }, { "from": "gpt", "value": "# Copyright (c) 2016 Ultimaker B.V.\n# Uranium is released under the terms of the AGPLv3 or h...
python
chosen
[ { "from": "human", "value": "Add ordering for letters to migration\n" }, { "from": "gpt", "value": "# -*- coding: utf-8 -*-\n# Generated by Django 1.11.2 on 2017-08-04 19:28\nfrom __future__ import unicode_literals\n\nfrom django.db import migrations\n\n\nclass Migration(migrations.Migration):\n...
python
chosen
[ { "from": "human", "value": "Add inet read file tests\n" }, { "from": "gpt", "value": "# -*- coding: utf-8 -*-\nimport pytest\nimport csv\n\nfrom inet.inet import Inet\n\n\nclass TestInet():\n \"\"\"Test the Inet class functions as expected\"\"\"\n\n def test_no_data_file(self):\n w...
python
chosen
[ { "from": "human", "value": "Cover the type support with tests\n" }, { "from": "gpt", "value": "# -*- coding: utf-8 -*-\n\nfrom __future__ import unicode_literals\n\nfrom unittest import TestCase\n\nfrom centerline import Centerline\nfrom shapely.geometry import (GeometryCollection, LineString, ...
python
chosen
[ { "from": "human", "value": "Add a silly script for the centroid reports\n" }, { "from": "gpt", "value": "#!/usr/bin/env python\n# Licensed under a 3-clause BSD style license - see LICENSE.rst\nimport os\nimport argparse\n\nfrom mica import centroid_dashboard\n\n\n# Cheat. Needs entrypoint scrip...
python
chosen
[ { "from": "human", "value": "Add command to make testing incoming messages easier.\n" }, { "from": "gpt", "value": "from django.core.management.base import BaseCommand\nfrom optparse import make_option\nfrom rapidsms_httprouter.router import get_router\nfrom rapidsms.models import Connection\n\n...
python
chosen
[ { "from": "human", "value": "Add unit tests for repo client\n" }, { "from": "gpt", "value": "import unittest\n\nfrom cartoframes.data.clients import SQLClient\nfrom cartoframes.data.observatory.repository.repo_client import RepoClient\n\nfrom ..examples import db_dataset1, db_dataset2\n\ntry:\n ...
python
chosen
[ { "from": "human", "value": "Add command for checking & saving unassigned flatblocks in the database\n" }, { "from": "gpt", "value": "import os\n\nfrom django.core.management.base import BaseCommand\nfrom django.template.loader import get_template\n\nfrom django.conf import settings\n\nfrom flat...
python
chosen
[ { "from": "human", "value": "Add invalid ark and target uri field migration\n\nNot significant changes, but django complains about model changes\nnot matching otherwise.\n" }, { "from": "gpt", "value": "# -*- coding: utf-8 -*-\nfrom __future__ import unicode_literals\n\nfrom django.db import mig...
python
chosen
[ { "from": "human", "value": "Add unit test for summarize_model.py\n" }, { "from": "gpt", "value": "\"\"\"\nA unit test for the summarize_model.py script\n\"\"\"\nimport cPickle\nimport os\n\nfrom pylearn2.testing.skip import skip_if_no_matplotlib\nfrom pylearn2.models.mlp import MLP, Linear\nfro...
python
chosen
[ { "from": "human", "value": "Add migration for content types fields\n" }, { "from": "gpt", "value": "# Generated by Django 3.1.2 on 2020-10-12 12:08\n\nfrom django.db import migrations, models\nimport django.db.models.deletion\n\n\nclass Migration(migrations.Migration):\n\n dependencies = [\n...
python
chosen
[ { "from": "human", "value": "Mark projects that have a bluebottle payout as not needing approval\n\nBB-9612 #resolve\n" }, { "from": "gpt", "value": "# -*- coding: utf-8 -*-\n# Generated by Django 1.10.6 on 2017-04-24 14:53\nfrom __future__ import unicode_literals\n\nfrom django.db import migrat...
python
chosen
[ { "from": "human", "value": "Add functional tests for compute limits\n\nChange-Id: Ifb192d412081beadf15023343af71ab23ceba7a1\n" }, { "from": "gpt", "value": "# Licensed under the Apache License, Version 2.0 (the \"License\"); you may\n# not use this file except in compliance with the License. Yo...
python
chosen
[ { "from": "human", "value": "Rename 'tools' to 'rdtools' module directory.\n" }, { "from": "gpt", "value": "''' Energy Normalization Module\n\nThis module contains functions to help normalize AC energy output with measured\nirradiance in preparation for calculating PV system degradation.\n'''\n\...
python
chosen
[ { "from": "human", "value": "Add python program (really a collection of functions) which will choose a\nset of name pairings for a christmas gift exchange.\n" }, { "from": "gpt", "value": "#! /usr/bin/python\n\n# vim: set ai sw=4:\n\nimport random\nimport time\n\nfamily_list = [[\"Alia\", \"Tany...
python
chosen
[ { "from": "human", "value": "Change for_post_role of local & mayoral elections for better grouping\n\nOn various pages we're now grouping elections by the post role that\nthey're for. Unfortunately in some UK installations there's a different\nfor_post_role for each local councillor election, and each mayo...
python
chosen
[ { "from": "human", "value": "Add tests for floatingip pools API's new policy rules\n\nRelated-blueprint: bp/secure-rbac-roles\nChange-Id: I3f4f668866a7d1dacb583a177e8475617a762bf7\n" }, { "from": "gpt", "value": "# Copyright (c) 2021 Red Hat Inc.\n#\n# Licensed under the Apache License, Version ...
python
chosen
[ { "from": "human", "value": "Add utility to extract palette for the DOS version\n" }, { "from": "gpt", "value": "import glob\nfrom PIL import Image\nfrom math import floor\npalette = [[0,0,0]];\n\ndef transform( pixel ):\n return [ 20 * ( pixel[ 0 ] / 20), 20 * ( pixel[ 1 ] / 20), 20 * ( pixe...
python
chosen
[ { "from": "human", "value": "Add migration for earlier change to api models\n\nOops! Apparently I forgot to run makemigrations after a minor change to\nAPI models.\n" }, { "from": "gpt", "value": "# -*- coding: utf-8 -*-\nfrom __future__ import unicode_literals\n\nfrom django.db import migration...
python
chosen
[ { "from": "human", "value": "Fix column data type in vendors table\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\"\"\"\nBring vendors' start_date and end_date columns into conformity with the ...
python
chosen
[ { "from": "human", "value": "Add content_type migration to keep comments etc.\n" }, { "from": "gpt", "value": "# -*- coding: utf-8 -*-\nfrom __future__ import unicode_literals\n\nfrom django.db import migrations\n\nsql = \"\"\"UPDATE django_content_type\n SET model = 'chapter'\n ...
python
chosen
[ { "from": "human", "value": "Add solution for 232 implement queue using stack.\n" }, { "from": "gpt", "value": "class Stack(object):\n def __init__(self):\n \"\"\"\n initialize your data structure here.\n \"\"\"\n self.__queue = []\n\n def push(self, x):\n ...
python
chosen
[ { "from": "human", "value": "ADD Network association_requests unit tests\n" }, { "from": "gpt", "value": "\ndef test_send_association_request(client):\n result = client.post(\"/association-requests/request\", data={\"id\": \"54623156\", \"address\": \"159.15.223.162\"})\n assert result.sta...
python
chosen
[ { "from": "human", "value": "Make uid unique together with journal/user, not on its own.\n" }, { "from": "gpt", "value": "# -*- coding: utf-8 -*-\n# Generated by Django 1.10.4 on 2017-01-10 17:37\nfrom __future__ import unicode_literals\n\nfrom django.conf import settings\nimport django.core.val...
python
chosen
[ { "from": "human", "value": "Add test for optional Python database API features which are not implemented\n" }, { "from": "gpt", "value": "from unittest import TestCase\n\nfrom turbodbc import connect\n\n\ndsn = \"Exasol R&D test database\"\n\n\nclass TestCursorUnsupportedFeatures(TestCase):\n ...
python
chosen
[ { "from": "human", "value": "Add import from csv command\n" }, { "from": "gpt", "value": "# -*- coding: utf-8 -*-\nfrom __future__ import unicode_literals\n\nimport os\nfrom django.core.management.base import BaseCommand\nfrom django.core.files import File\nimport csv\n\nfrom users.models import...
python
chosen
[ { "from": "human", "value": "Add a simple hybrid recommender from Zhou et. al\n" }, { "from": "gpt", "value": "def predict(predictions_vector_0, predictions_vector_1, mixing_variable=0.5, num_partitions=30):\n \"\"\"Apply a simple linear hybrid recommender.\n\n This function implements the...
python
chosen
[ { "from": "system", "value": "Fix deadlock in remote debugger (PY-18546)\n" }, { "from": "human", "value": "def __getfilesystemencoding():\n '''\n Note: there's a copy of this method in interpreterInfo.py\n '''\n import sys\n try:\n ret = sys.getfilesystemencoding()\n ...
python
chosen
[ { "from": "human", "value": "Add alembic revision for that.\n" }, { "from": "gpt", "value": "\"\"\"Add a negated column for rules.\n\nRevision ID: 18ebf3181f87\nRevises: 4a95022fd7f3\nCreate Date: 2014-08-22 15:48:08.952913\n\n\"\"\"\n\n# revision identifiers, used by Alembic.\nrevision = '18ebf...
python
chosen
[ { "from": "human", "value": "Add tests for xforwardedfor middleware\n" }, { "from": "gpt", "value": "\"\"\"Test the X-Forwarded-For middleware.\"\"\"\n\nfrom ..middleware.xforwardedfor import xforwardedfor\n\n\ndef get_response_method(thing):\n \"\"\"Do nothing.\"\"\"\n return thing\n\n\nd...
python
chosen
[ { "from": "human", "value": "Create code to plot Horizontal Illuminance.\n" }, { "from": "gpt", "value": "#!/usr/bin/env python\n \nimport numpy as np\nfrom mpl_toolkits.mplot3d import Axes3D\nimport matplotlib.pyplot as plt\n\n# This code plot the horizontal illuminance inside a room using a SI...
python
chosen
[ { "from": "human", "value": "Fix old Briefs missing niceToHaveRequirements field\n\nThis was causing errors when suppliers applied to these Briefs\nand any copies of them.\n" }, { "from": "gpt", "value": "\"\"\"Adds missing 'niceToHaveRequirements' to old published Brief data blobs.\n\nRevision ...
python
chosen
[ { "from": "human", "value": "Add Celery file to async tasks\n" }, { "from": "gpt", "value": "from __future__ import absolute_import, unicode_literals\nimport os\nfrom celery import Celery\n\n# set the default Django settings module for the 'celery' program.\nos.environ.setdefault('DJANGO_SETTING...
python
chosen
[ { "from": "human", "value": "Increase length of company field\n" }, { "from": "gpt", "value": "# Generated by Django 3.2.7 on 2021-10-28 19:02\n\nfrom django.db import migrations, models\n\n\nclass Migration(migrations.Migration):\n\n dependencies = [\n ('museum_site', '0003_auto_20211...
python
chosen
[ { "from": "human", "value": "[UPD] Add a script to add manually a new user\n" }, { "from": "gpt", "value": "# !/usr/bin/env python3\n# -*- coding: utf-8 -*-\n\n\"\"\"Script to add a new user.\"\"\"\n\nimport os\nimport sys\n\nsys.path.append(os.path.abspath(os.path.join(os.path.dirname(__file__)...
python
chosen
[ { "from": "human", "value": "Remove Duplicates From Sorted Array II\n" }, { "from": "gpt", "value": "#Too many mistakes were made.\n#0. should use while loop instead of for.\n#1. messed up with index. maybe with the sleepy head at 3pm\nclass Solution:\n # @param a list of integers\n # @ret...
python
chosen
[ { "from": "human", "value": "Check AWS instances register in mesos\n\nThis is a quick attempt to give us visibility of AWS resources that\ndon't end up registering in mesos.\n\nThis covers a lot of potential problems with the bootstrap process.\n\nThis could be better:\n* maybe should check how long a resou...
python
chosen
[ { "from": "human", "value": "Add test for unicode characters in Validate errors\n" }, { "from": "gpt", "value": "#!/usr/bin/env python\n# -*- coding: utf-8 -*-\n\nfrom pyxform.tests_v1.pyxform_test_case import PyxformTestCase\n\nclass ValidateUnicodeException(PyxformTestCase):\n \"\"\"\n V...
python
chosen