conversations
listlengths
2
3
source
stringclasses
1 value
stack
stringclasses
1 value
[ { "from": "human", "value": "Add Python script to generate users\n" }, { "from": "gpt", "value": "#!/usr/bin/python\n# -*- coding: utf-8 -*-\n\n\"\"\" \nAdds a sequential number of users into a test database\nwith username: newusern and password newusern\n\nNot for production usage\n\"\"\"\n\nim...
python
chosen
[ { "from": "human", "value": "Add ref create api test\n\n" }, { "from": "gpt", "value": "async def test_create(spawn_client, test_random_alphanumeric, static_time):\n client = await spawn_client(authorize=True, permissions=[\"create_ref\"])\n\n data = {\n \"name\": \"Test Viruses\",\...
python
chosen
[ { "from": "human", "value": "NG: Add a script to reimport the LGA boundaries from the GADM.org data\n\nThe original import of the LGA boundaries from the GADM.org data was\nmissing some polygons: some LGAs were entirely without geometry. My\nassumption (since I don't have the GADM ddata from that time) is ...
python
chosen
[ { "from": "human", "value": "Add new sanity test for demoproject views\n\nhelps boost test coverage but most importantly executes the code\npaths that were fixed in 9d9033ecd5a8592a12872293cdf6d710cebf894f\n" }, { "from": "gpt", "value": "from demoproject.urls import urlpatterns\nfrom django.tes...
python
chosen
[ { "from": "human", "value": "Move buckling calcs to continuum_analysis\n" }, { "from": "gpt", "value": "from abaqus_model import *\r\nfrom abaqus_postproc import *\r\nfrom continuum_analysis import *\r\nfrom rayleighritz import RayleighRitzDiscrete\r\nfrom stiffcalc import *\r\n" } ]
python
chosen
[ { "from": "human", "value": "Add answer to leetcode rotate list\n" }, { "from": "gpt", "value": "# coding=utf-8\n\"\"\"\nchimera.leetcode_rotate_list\n~~~~~~~~~~~~~~~~~~~~~~~~~~~~\n\nGiven a list, rotate the list to the right by k places, where k is\nnon-negative.\n\nFor example:\nGiven 1->2->3-...
python
chosen
[ { "from": "human", "value": "Add naive bayes SQL test.\n" }, { "from": "gpt", "value": "import unittest\n\nfrom numpy import array\n\nimport Orange.classification.naive_bayes as nb\nfrom Orange.data.discretization import DiscretizeTable\nfrom Orange.data.sql.table import SqlTable\nfrom Orange.da...
python
chosen
[ { "from": "human", "value": "Add code for stashing a single nuxeo image on s3.\n" }, { "from": "gpt", "value": "#!/usr/bin/env python\n# -*- coding: utf-8 -*-\nimport sys, os\nimport argparse\nimport logging\nimport json\nfrom s3stash.nxstashref_image import NuxeoStashImage\n\ndef main(argv=None...
python
chosen
[ { "from": "human", "value": "Add py solution for 393. UTF-8 Validation\n\n393. UTF-8 Validation: https://leetcode.com/problems/utf-8-validation/\n\nApproach:\n Observe the first item remaining in each step. The value will be added\n 1 << step either the remaining count is odd or it's a left-to-right\n...
python
chosen
[ { "from": "human", "value": "Add test script for segfault bug reported by Jeremy Hill.\n\ngit-svn-id: 033d166fe8e629f6cbcd3c0e2b9ad0cffc79b88b@1477 3a63a0ee-37fe-0310-a504-e92b6e0a3ba7\n" }, { "from": "gpt", "value": "#!/usr/bin/env python\n\n# Test for bug reported by Jeremy Hill in which re-op...
python
chosen
[ { "from": "human", "value": "Add example script for the newly added mixed_diffusivity" }, { "from": "gpt", "value": "import openpnm as op\nimport numpy as np\nimport matplotlib.pyplot as plt\n\n\n# Get Deff w/o including Knudsen effect\nspacing = 1.0\nnet = op.network.Cubic(shape=[10, 10, 10], s...
python
chosen
[ { "from": "human", "value": "[AIRFLOW-1495] Add TaskInstance index on job_id\n\nColumn job_id is unindexed in TaskInstance, it was\nused as\ndefault sort column in TaskInstanceView.\n\nThis commit adds the required migration to add the\nindex on\ntask_instance.job_id on future db upgrades.\n\nCloses #2520 f...
python
chosen
[ { "from": "human", "value": "Add test suite for bqlmath.\n" }, { "from": "gpt", "value": "# -*- coding: utf-8 -*-\n\n# Copyright (c) 2010-2016, MIT Probabilistic Computing Project\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may not use this file except in...
python
chosen
[ { "from": "system", "value": "Allow use of GoogleMaps plugin without Multilingual support\n" }, { "from": "human", "value": "from cms.plugin_pool import plugin_pool\nfrom cms.plugin_base import CMSPluginBase\nfrom django.utils.translation import ugettext_lazy as _\nfrom cms.plugins.googlemap.mod...
python
chosen
[ { "from": "system", "value": "Remove extraneous imports in the base view package" }, { "from": "human", "value": "from collections import OrderedDict\nfrom urllib.parse import urlparse\nimport re\n\nfrom flask import render_template, redirect, url_for, request, abort, jsonify,\\\n flash, ...
python
chosen
[ { "from": "human", "value": "Add producer written in Python\n" }, { "from": "gpt", "value": "#!/usr/bin/env python\nimport pika\n\n# Host in which RabbitMQ is running.\nHOST = 'localhost'\n\n# Name of the queue.\nQUEUE = 'pages'\n\n# The message to send.\nMESSAGE = 'Hi there! This is a test mess...
python
chosen
[ { "from": "human", "value": "Add tests for internal gregorian functions.\n" }, { "from": "gpt", "value": "import unittest\n\nfrom calexicon.internal.gregorian import is_gregorian_leap_year\n\n\nclass TestGregorian(unittest.TestCase):\n def test_is_gregorian_leap_year(self):\n self.asse...
python
chosen
[ { "from": "human", "value": "Make a control dataset that only contains sequences with titer data.\n\n" }, { "from": "gpt", "value": "from Bio import SeqIO\nfrom pprint import pprint\n\nwith open('../../data/dengue_titers.tsv', 'r') as f:\n\ttiterstrains = set([ line.split()[0] for line in f ])\n...
python
chosen
[ { "from": "human", "value": "Test two windows drawing GL with different contexts.\n\n--HG--\nextra : convert_revision : svn%3A14d46d22-621c-0410-bb3d-6f67920f7d95/trunk%4045\n" }, { "from": "gpt", "value": "#!/usr/bin/env python\n\n'''\n'''\n\n__docformat__ = 'restructuredtext'\n__version__ = '$...
python
chosen
[ { "from": "human", "value": "migrations: Remove disallowed characters from stream names.\n\ncharacter_is_printable logic is taken from similar work by @madrix01\n" }, { "from": "gpt", "value": "import unicodedata\n\nfrom django.db import connection, migrations\nfrom django.db.backends.postgresql...
python
chosen
[ { "from": "human", "value": "Add tests for path join\n" }, { "from": "gpt", "value": "from gypsy.path import _join\n\ndef test_join():\n assert _join('s3://', 'bucket', 'prefix') == 's3://bucket/prefix'\n assert _join('s3://bucket', 'prefix') == 's3://bucket/prefix'\n assert _join('buck...
python
chosen
[ { "from": "human", "value": "Add kv store for file storage\n" }, { "from": "gpt", "value": "import flask_fs as fs\n\nfrom zou.app import app\n\n\npictures = fs.Storage(\"pictures\", overwrite=True)\nmovies = fs.Storage(\"movies\", overwrite=True)\n\npictures.configure(app)\nmovies.configure(app)...
python
chosen
[ { "from": "human", "value": "Add feedback entries to the Admin panel\n" }, { "from": "gpt", "value": "# Copyright (C) 2014 Andrey Antukh <niwi@niwi.be>\n# Copyright (C) 2014 Jesús Espino <jespinog@gmail.com>\n# Copyright (C) 2014 David Barragán <bameda@dbarragan.com>\n# This program is free soft...
python
chosen
[ { "from": "human", "value": "Add a few simple pytest tests\n\n- These tests should eventually provide unit tests for all classes\n" }, { "from": "gpt", "value": "#!/usr/bin/env python\nimport pytest\nfrom datetime import datetime\nfrom mlbgame import standings\n\n\n\ndate = datetime(2017, 5, 15,...
python
chosen
[ { "from": "human", "value": "Add basic smoke tests for doc generation\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 complian...
python
chosen
[ { "from": "human", "value": "Add unit tests for bandit.core.issue\n\nBrings coverage for bandit.core.issue to 100%.\n\nChange-Id: I67dfbb64cb276d1c16b28e4bbc6b50c8254bd3f1\n" }, { "from": "gpt", "value": "# -*- coding:utf-8 -*-\n#\n# Copyright 2015 Hewlett-Packard Development Company, L.P.\n#\n#...
python
chosen
[ { "from": "human", "value": "Add a TensorFlow Probability sample\n" }, { "from": "gpt", "value": "#!/usr/bin/python3\r\n# coding: utf-8\r\n\r\n'''\r\nImplementation of the article below with TensorFlow Probability\r\n'Bayesian Methods for Hackers'\r\nhttps://github.com/CamDavidsonPilon/Probabili...
python
chosen
[ { "from": "human", "value": "Backup of some unused code\n" }, { "from": "gpt", "value": "import argparse\nimport itertools\n\nif __name__ == '__main__':\n\tparser = argparse.ArgumentParser(description='Generate the cartesian product of two ID files')\n\tparser.add_argument('--idFileA',required=T...
python
chosen
[ { "from": "human", "value": "Add utils to allow multiclass classification.\n" }, { "from": "gpt", "value": "from __future__ import division\n\nimport numpy as np\n\nfrom sklearn.multiclass import OneVsOneClassifier\nfrom sklearn.multiclass import _fit_binary\nfrom sklearn.externals.joblib import...
python
chosen
[ { "from": "human", "value": "Add python to make vv h5 file\n" }, { "from": "gpt", "value": "import tables\n\nvv_desc = dict(\nobsid=tables.IntCol(pos=0),\nrevision=tables.IntCol(pos=1),\nmost_recent=tables.IntCol(pos=2),\nslot=tables.IntCol(pos=3),\ntype=tables.StringCol(10,pos=4),\nn_pts=tables...
python
chosen
[ { "from": "human", "value": "tests: Add basic test for OrderedDict.\n\nMostly to have coverage of newly added code in map.c.\n" }, { "from": "gpt", "value": "try:\n from collections import OrderedDict\nexcept ImportError:\n try:\n from _collections import OrderedDict\n except Imp...
python
chosen
[ { "from": "human", "value": "Migrate Req/Ass to have verified/finished date\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: andraz@recipr...
python
chosen
[ { "from": "human", "value": "Create Python object detection script.\n" }, { "from": "gpt", "value": "'''\nCreated on Feb 28, 2014\n\n@author: Vance Zuo\n'''\n\nimport numpy\nimport cv2\n\nclass ObjectDetector(object):\n '''\n classdocs\n '''\n\n\n def __init__(self, params):\n ...
python
chosen
[ { "from": "human", "value": "Add py solution for 406. Queue Reconstruction by Height\n\n406. Queue Reconstruction by Height: https://leetcode.com/problems/queue-reconstruction-by-height/\n" }, { "from": "gpt", "value": "from collections import defaultdict\nclass Solution(object):\n def insert...
python
chosen
[ { "from": "human", "value": "Add partial benchmarking file for gala\n" }, { "from": "gpt", "value": "import os\n\nfrom gala import imio, features, agglo, classify\n\n\nrundir = os.path.dirname(__file__)\ndd = os.path.abspath(os.path.join(rundir, '../tests/example-data'))\n\n\nem3d = features.def...
python
chosen
[ { "from": "human", "value": "Add tests for logging of rest requests\n" }, { "from": "gpt", "value": "import datetime\nimport pytest\nfrom girder import auditLogger\n\n\n@pytest.fixture\ndef recordModel():\n from girder.plugins.audit_logs import Record\n yield Record()\n\n\n@pytest.fixture\...
python
chosen
[ { "from": "human", "value": "Add an ABC for all sub classes of `DataController`\n\n" }, { "from": "gpt", "value": "from typing import Dict, Optional\n\nfrom data_controller.enums import Medium, Site\nfrom utils.helpers import await_func\n\n\nclass DataController:\n \"\"\"\n An ABC for all ...
python
chosen
[ { "from": "human", "value": "Add shootout attempt item definition\n" }, { "from": "gpt", "value": "#!/usr/bin/env python\n# -*- coding: utf-8 -*-\n\nimport uuid\n\nfrom db.common import Base\nfrom db.specific_event import SpecificEvent\nfrom db.player import Player\nfrom db.team import Team\n\n\...
python
chosen
[ { "from": "human", "value": "Add a unit test for KaggleKernelCredentials.\n" }, { "from": "gpt", "value": "import unittest\n\nfrom kaggle_secrets import GcpTarget\nfrom kaggle_gcp import KaggleKernelCredentials\n\nclass TestKaggleKernelCredentials(unittest.TestCase):\n\n def test_default_targ...
python
chosen
[ { "from": "human", "value": "Bring table test coverage to 100%\n" }, { "from": "gpt", "value": "#!/usr/bin/env python3\n\nimport nose.tools as nose\nfrom table import Table\n\n\ndef test_init_default():\n \"\"\"should initialize table with required parameters and default values\"\"\"\n tab...
python
chosen
[ { "from": "human", "value": "Add a test for our more general views.\n" }, { "from": "gpt", "value": "import pytest\n\nfrom django.core.urlresolvers import reverse\n\n\ndef test_site_view(client):\n response = client.get(reverse('site-home'))\n assert response.status_code == 200\n assert...
python
chosen
[ { "from": "human", "value": "Add python script to get ECC608 Public Key\n\nChange-Id: I0826503e9b8d1bb5de3f83b82d0083754a7e2b8f\n" }, { "from": "gpt", "value": "#!/usr/bin/env python3\nimport base64\nimport ctypes\nimport sys\n\nCRYPTO_ADDRESS_DICT = {\n 'Vision Bonnet': 0x60,\n 'Voice Bon...
python
chosen
[ { "from": "human", "value": "Add python script to extract" }, { "from": "gpt", "value": "import json\nf=open('raw.json')\ng=open('extracted1','a')\ni=1\nfor s in f:\n j=json.loads(s)\n j=j['text']\n h=json.dumps(j)\n number=str(i) + ':' + ' '\n g.write(h)\n g.write('\\n\\n')\n ...
python
chosen
[ { "from": "human", "value": "Add migration for Comment schema upgrade. ...\n\nThis allows Comment to masquerade as an epistle and is required to use\nthe last several commits. I forgot to push the migration out. :p\n" }, { "from": "gpt", "value": "from sqlalchemy import *\nfrom migrate import *\...
python
chosen
[ { "from": "human", "value": "Add unit tests for BMI version of storm\n" }, { "from": "gpt", "value": "#! /usr/bin/env python\n#\n# Tests for the BMI version of `storm`.\n#\n# Call with:\n# $ nosetests -sv\n#\n# Mark Piper (mark.piper@colorado.edu)\n\nfrom nose.tools import *\nimport os\nimport...
python
chosen
[ { "from": "human", "value": "Revert \"Remove pgjsonb returner unit tests\"\n\nThis reverts commit ab4a670ff22878d5115f408baf0304a0ba3ec994.\n" }, { "from": "gpt", "value": "# -*- coding: utf-8 -*-\n'''\ntests.unit.returners.pgjsonb_test\n~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\n\nUnit tests for th...
python
chosen
[ { "from": "human", "value": "Add a hex dump utility class.\n" }, { "from": "gpt", "value": "# This hack by: Raymond Hettinger\nclass hexdumper:\n \"\"\"Given a byte array, turn it into a string. hex bytes to stdout.\"\"\"\n def __init__(self):\n\tself.FILTER=''.join([(len(repr(chr(x)))==3)...
python
chosen
[ { "from": "human", "value": "Add draft test module for linter\n" }, { "from": "gpt", "value": "import logging\nimport pytest\nfrom mappyfile.validator import Validator\n\n\ndef validate(d):\n v = Validator()\n return v.validate(d)\n\n\ndef get_from_dict(d, keys):\n for k in keys:\n ...
python
chosen
[ { "from": "human", "value": "Add basic first tests for new report driven by \"events\"\n" }, { "from": "gpt", "value": "from django.test import TestCase\n\nfrom deep_collector.core import RelatedObjectsCollector\n\nfrom .factories import BaseModelFactory\n\n\nclass TestLogReportGeneration(TestCa...
python
chosen
[ { "from": "human", "value": "Add dependency installer for linux and mac osx\n" }, { "from": "gpt", "value": "import platform\nimport subprocess\n\n\"\"\"\nThis is a standalone script that installs the required dependencies to run. It\n*should* be platform independent, and should work regardless ...
python
chosen
[ { "from": "human", "value": "Add new test setup required for py.test/django test setup\n" }, { "from": "gpt", "value": "import os\nimport django\n\nos.environ['DJANGO_SETTINGS_MODULE'] = 'testsettings'\n\n# run django setup if we are on a version of django that has it\nif hasattr(django, 'setup'...
python
chosen
[ { "from": "human", "value": "Add valid directory cleaner helper test\n\ngit-svn-id: https://svn.apache.org/repos/asf/incubator/climate/trunk@1563517 13f79535-47bb-0310-9956-ffa450edef68\n\nFormer-commit-id: a23ba7556854cb30faaa0dfc19fdbcc6cb67382c" }, { "from": "gpt", "value": "import os\nimport...
python
chosen
[ { "from": "human", "value": "Solve Code Fights make array consecutive 2 problem\n" }, { "from": "gpt", "value": "#!/usr/local/bin/python\n# Code Fights Make Array Consecutive 2 Problem\n\n\ndef makeArrayConsecutive2(statues):\n return (len(range(min(statues), max(statues) + 1)) - len(statues)...
python
chosen
[ { "from": "human", "value": "Make a command to make subsets. Subsets are useful for testing during development.\n" }, { "from": "gpt", "value": "\"\"\"\n Copyright 2014 Google Inc. All rights reserved.\n\n Licensed under the Apache License, Version 2.0 (the \"License\");\n you may not use thi...
python
chosen
[ { "from": "human", "value": "Add unit tests for VocabularySet\n" }, { "from": "gpt", "value": "#!/usr/bin/env python\nfrom __future__ import division\n\nfrom unittest import TestCase, main\nfrom metasane.core import VocabularySet\n\nclass VocabularySetTests(TestCase):\n def setUp(self):\n ...
python
chosen
[ { "from": "human", "value": "Implement channel mode +s (or what's left of it)\n" }, { "from": "gpt", "value": "from txircd.modbase import Mode\n\nclass SecretMode(Mode):\n\tdef listOutput(self, command, data):\n\t\tif command != \"LIST\":\n\t\t\treturn data\n\t\tcdata = data[\"cdata\"]\n\t\tif \...
python
chosen
[ { "from": "human", "value": "Create directory for useless symbols remove\n" }, { "from": "gpt", "value": "#!/usr/bin/env python\n\"\"\"\n:Author Patrik Valkovic\n:Created 17.08.2017 14:38\n:Licence GNUv3\nPart of grammpy-transforms\n\n\"\"\"" } ]
python
chosen
[ { "from": "human", "value": "Migration: Add all PLs to db\n" }, { "from": "gpt", "value": "\"\"\"populate-provincial-legislatures\n\nRevision ID: 299e1d15a55f\nRevises: 1f97f799a477\nCreate Date: 2018-08-20 16:17:28.919476\n\n\"\"\"\n\n# revision identifiers, used by Alembic.\nrevision = '299e1d...
python
chosen
[ { "from": "human", "value": "Add script for testing error reporting.\n" }, { "from": "gpt", "value": "#!/usr/bin/env python\n# Copyright 2012 The greplin-nagios-utils Authors.\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may not use this file except in complianc...
python
chosen
[ { "from": "human", "value": "contrib_bots: Add tests for xkcd bot.\n" }, { "from": "gpt", "value": "#!/usr/bin/env python\n\nfrom __future__ import absolute_import\nfrom __future__ import print_function\n\nimport mock\nimport os\nimport sys\n\nour_dir = os.path.dirname(os.path.abspath(__file__))...
python
chosen
[ { "from": "human", "value": "Add an audio output using the pygame mixer. This abuses pygame to a fair extent, but works reasonably with large-ish buffer sizes.\n" }, { "from": "gpt", "value": "import numpy\nimport Numeric\nimport pygame\nimport Axon\nimport time\n\nclass PyGameOutput(Axon.Threa...
python
chosen
[ { "from": "human", "value": "Add a very simple test that *must* always pass.\n* Useful for testing the newstyle API\n" }, { "from": "gpt", "value": "from ooni import nettest\nclass SimpleTest(nettest.TestCase):\n inputs = range(1,100)\n optParameters = [['asset', 'a', None, 'Asset file'],\...
python
chosen
[ { "from": "human", "value": "Add a script for plotting distance to target.\n" }, { "from": "gpt", "value": "import climate\nimport itertools\nimport lmj.plot\nimport numpy as np\n\nimport source as experiment\nimport plots\n\n\n@climate.annotate(\n root='plot data from this experiment subject...
python
chosen
[ { "from": "human", "value": "Add basic structure for \"/glossary\" routes test\n" }, { "from": "gpt", "value": "\"Integration tests for markdown routes\"\nimport unittest\n\nfrom bs4 import BeautifulSoup\n\nfrom wqflask import app\n\n\nclass TestGenMenu(unittest.TestCase):\n \"\"\"Tests for g...
python
chosen
[ { "from": "human", "value": "Implement classes to be used by the deserializer\n" }, { "from": "gpt", "value": "# -*- coding: utf-8 -*-\n\n\nclass TreeElement(object):\n \"\"\"Helper class to identify internal classes.\"\"\"\n def __init__(self, **kwargs):\n pass\n\n\nclass Container...
python
chosen
[ { "from": "system", "value": "Make class test-class name more specific\n\n... to make room for more client tests." }, { "from": "human", "value": "import unittest\nfrom IPython.parallel import Client\nfrom distarray.client import DistArrayContext\n\n\nclass TestClient(unittest.TestCase):\n\n ...
python
chosen
[ { "from": "human", "value": "Add model representing a listing\n" }, { "from": "gpt", "value": "from sqlalchemy import create_engine, Column, DateTime, Float, Integer, String\nfrom sqlalchemy.ext.declarative import declarative_base\n\nBase = declarative_base()\n\n\nclass Listing(Base):\n __tab...
python
chosen
[ { "from": "human", "value": "Add script to generate data from an experiment\n\nAdded a script that generates csv files of estimations of theta,\nphi_topic and phi_opinion and saves them to disk.\n" }, { "from": "gpt", "value": "import logging\nimport os\nimport pandas as pd\n\nfrom CPTCorpus imp...
python
chosen
[ { "from": "human", "value": "Add lemon drop elevator model\n" }, { "from": "gpt", "value": "import numpy as np\n\nKt = 1.41/89.0\nKv = 5840.0/3.0\nG = 10.0\nJ = 4.0*(2.54**2.0)/2.0 # 4 kg on a 1 inch pully\nR = 12.0/89.0\n\nA = np.asarray([[0, 1],\n [0, -(Kt*Kv)/((G**2)*J*R)]])\nB...
python
chosen
[ { "from": "human", "value": "Clear out unaligned NLCD19 GWLF-E results\n\nAdds a migration that clears out all stored results for GWLF-E\nprojects created on or after 2022-01-17, which is when 1.33.0\nwas released with incorrectly aligned NLCD19 layers, which had\nalso been made the default. Thus, every pro...
python
chosen
[ { "from": "human", "value": "Adjust the sorting of restaurants.\n" }, { "from": "gpt", "value": "\"\"\"empty message\n\nRevision ID: 9ef49beab95\nRevises: 4b7b5a7ddc5c\nCreate Date: 2016-02-07 15:00:45.614000\n\n\"\"\"\n\n# revision identifiers, used by Alembic.\nrevision = '9ef49beab95'\ndown_r...
python
chosen
[ { "from": "human", "value": "Migrate symbtr uuid field to django type\n" }, { "from": "gpt", "value": "# -*- coding: utf-8 -*-\nfrom __future__ import unicode_literals\n\nfrom django.db import models, migrations\nimport django_extensions.db.fields\n\n\nclass Migration(migrations.Migration):\n\n ...
python
chosen
[ { "from": "human", "value": "Add custom plot style contour_image.\n" }, { "from": "gpt", "value": "from matplotlib import cm\nimport matplotlib.pyplot as plt\nfrom mplstyles import cmap as colormap\nimport numpy as np\n\ndef contour_image(x,y,Z,cmap=None,vmax=None,vmin=None,interpolation='neares...
python
chosen
[ { "from": "human", "value": "Add unit test for DakotaBase\n\nStill need to determine how to test its non-abstract methods.\n" }, { "from": "gpt", "value": "#!/usr/bin/env python\n#\n# Tests for dakota.dakota_base module.\n#\n# Call with:\n# $ nosetests -sv\n#\n# Mark Piper (mark.piper@colorado...
python
chosen
[ { "from": "human", "value": "Create template_redacted entry for templates created by migration\n\nSo that we can edit those templates\n" }, { "from": "gpt", "value": "\"\"\"\n\nRevision ID: 0296_template_redacted_fix\nRevises: 0295_api_key_constraint\nCreate Date: 2019-06-07 17:02:14.350064\n\n\...
python
chosen
[ { "from": "system", "value": "Purge da página de palestra quando salva palestrante\n" }, { "from": "human", "value": "# -*- coding: utf-8 -*-\nimport roan\n\nfrom django.contrib.flatpages import models\n\nfrom palestras import models as pmodels\n\n\ndef connect():\n flatpages = models.FlatPag...
python
chosen
[ { "from": "system", "value": "Add local locale from file\n" }, { "from": "human", "value": "# -*- encoding: utf-8 -*-\n\n\"\"\"\npdt_locales\n\nAll of the included locale classes shipped with pdt.\n\"\"\"\n\ntry:\n import PyICU as pyicu\nexcept:\n pyicu = None\n\n\ndef lcase(x):\n retur...
python
chosen
[ { "from": "human", "value": "Add external driver and parameter file\n" }, { "from": "gpt", "value": "#=================================================\n# Observation\n#-------------------------------------------------\nsstObsPath = '/clim_obs/obs/ocn/mo/tos/UKMETOFFICE-HadISST-v1-1/130122_HadIS...
python
chosen
[ { "from": "human", "value": "Add command to print vault info\n" }, { "from": "gpt", "value": "import boto\n\nclass CommandVaultInfo(object):\n\n def execute(self, args, config):\n glacier_connection = boto.connect_glacier(aws_access_key_id=config.get('configuration', 'aws_key'), aws_secret_a...
python
chosen
[ { "from": "human", "value": "Add unit tests for security_scan\n\nChange-Id: Idda799c01408aa9afd09d573e23f42e011f3fafb\nSigned-off-by: Cédric Ollivier <d48310251a4a484d041bc5d09a9ac4d86d20f793@orange.com>\n" }, { "from": "gpt", "value": "#!/usr/bin/env python\n\n# Copyright (c) 2017 Orange and ot...
python
chosen
[ { "from": "human", "value": "Add a management command to register webhooks\n" }, { "from": "gpt", "value": "from django.core.management.base import NoArgsCommand\n\nfrom webhooks.models import Webhook\n\n\nclass Command(NoArgsCommand):\n help = 'Register all created Shopify webhooks'\n\n d...
python
chosen
[ { "from": "human", "value": "Create TwoSum II for Lint\n" }, { "from": "gpt", "value": "class Solution:\n # @param nums, an array of integer\n # @param target, an integer\n # @return an integer\n def twoSum2(self, nums, target):\n # Write your code here\n nums.sort()\n ...
python
chosen
[ { "from": "human", "value": "Add data migration to add category components for VPC.\n" }, { "from": "gpt", "value": "# -*- coding: utf-8 -*-\nfrom __future__ import unicode_literals\n\nfrom django.db import migrations\n\nfrom waldur_mastermind.marketplace_openstack import STORAGE_TYPE, RAM_TYPE,...
python
chosen
[ { "from": "human", "value": "Add negative API tests for policy validation\n\nAdd negative API tests for policy validation\n\nChange-Id: I0363bfd2165893b713059dc9db5ab9e632522091\n" }, { "from": "gpt", "value": "# Licensed under the Apache License, Version 2.0 (the \"License\"); you may\n# not us...
python
chosen
[ { "from": "human", "value": "Add task to get stats about files\n" }, { "from": "gpt", "value": "import json\nfrom collections import defaultdict\n\nfrom django.core.management.base import BaseCommand\nfrom common.util import load_yaml\nfrom games import models\n\n\nclass Command(BaseCommand):\n ...
python
chosen
[ { "from": "human", "value": "Add columns to User model\n" }, { "from": "gpt", "value": "from sqlalchemy import Column, Integer, String\nfrom bookmarks.database import Base\n\n\nclass User(Base):\n __tablename__ = 'users'\n id = Column(Integer, primary_key=True)\n username = Column(Strin...
python
chosen
[ { "from": "human", "value": "Add registration method for TB\n" }, { "from": "gpt", "value": "\"\"\"\nUtility functions to retrieve information about available services and setting up security for the Hops platform.\n\nThese utils facilitates development by hiding complexity for programs interact...
python
chosen
[ { "from": "system", "value": "Add test for yaml enviroment\n" }, { "from": "human", "value": "\"\"\"Test Home Assistant yaml loader.\"\"\"\nimport io\nimport unittest\n\nfrom homeassistant.util import yaml\n\n\nclass TestYaml(unittest.TestCase):\n \"\"\"Test util.yaml loader.\"\"\"\n\n def...
python
chosen
[ { "from": "human", "value": "Add new layout window command\n" }, { "from": "gpt", "value": "import sublime, sublime_plugin\n\nclass NewLayoutCommand(sublime_plugin.TextCommand):\n def run(self, edit, **args):\n self.view.window().run_command(\"set_layout\", args)\n self.view.window().run_...
python
chosen
[ { "from": "system", "value": "Use Django nose for tests." }, { "from": "human", "value": "#\n# Include your development machines hostnames here.\n#\n# NOTE: this is not strictly needed, as Django doesn't enforce\n# the check if DEBUG==True. But Just in case you wanted to disable\n# it temporaril...
python
chosen
[ { "from": "human", "value": "Add spider for Brookdale Senior Living\n" }, { "from": "gpt", "value": "# -*- coding: utf-8 -*-\nimport scrapy\nimport json\nfrom locations.items import GeojsonPointItem\n\nURL = 'https://www.brookdale.com/bin/brookdale/community-search?care_type_category=resident&lo...
python
chosen
[ { "from": "human", "value": "ptch: Add ptch module and base PatchFile class. This class can unpack RLE-compressed patchfiles.\n" }, { "from": "gpt", "value": "# -*- coding: utf-8 -*-\n\"\"\"\nPTCH files are a container format for Blizzard patch files.\nThey begin with a 72 byte header containing...
python
chosen
[ { "from": "human", "value": "Add script to generate big RUM_* files\n" }, { "from": "gpt", "value": "from rum_mapping_stats import aln_iter\nimport argparse\nimport sys\n\nparser = argparse.ArgumentParser()\n\nparser.add_argument('--times', type=int)\nparser.add_argument('--max-seq', type=int)\n...
python
chosen
[ { "from": "human", "value": "Make the migration for previous commit\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 dependenci...
python
chosen
[ { "from": "human", "value": "Add Script to encode raw RGB565\n\n* Encodes RGB565 raw stream to MP4/AVI\n" }, { "from": "gpt", "value": "#!/usr/bin/env python\n# Converts raw RGB565 video to MP4/AVI\n\nfrom sys import argv, exit\nfrom array import array\nfrom subprocess import call\n\nbuf=None\nT...
python
chosen
[ { "from": "human", "value": "Fix maybe all flake8 errors. Add first test.\n" }, { "from": "gpt", "value": "\"\"\"\nThis file demonstrates writing tests using the unittest module. These will pass\nwhen you run \"manage.py test\".\n\nReplace this with more appropriate tests for your application.\n...
python
chosen
[ { "from": "human", "value": "Add data migration for section\n" }, { "from": "gpt", "value": "# -*- coding: utf-8 -*-\nfrom __future__ import unicode_literals\n\nfrom django.db import models, migrations\n\n\ndef add_sections(apps, schema_editor):\n # Don't just use books.models.Section, that c...
python
chosen
[ { "from": "human", "value": "Add actor with behavior similar to old-style Delay\n" }, { "from": "gpt", "value": "# -*- coding: utf-8 -*-\n\n# Copyright (c) 2015 Ericsson AB\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 which fixes missing message IDs.\n" }, { "from": "gpt", "value": "# -*- coding: utf-8 -*-\n# Generated by Django 1.11.2 on 2017-06-28 15:27\nfrom __future__ import unicode_literals\n\nfrom django.db import migrations\n\nfrom datetime import timedelta\n\...
python
chosen
[ { "from": "human", "value": "Copy old script from @erinspace which added identifiers to existing preprints.\n" }, { "from": "gpt", "value": "import sys\nimport time\nimport logging\nfrom scripts import utils as script_utils\nfrom django.db import transaction\n\nfrom website.app import setup_djan...
python
chosen