conversations listlengths 2 3 | source stringclasses 1
value | stack stringclasses 1
value |
|---|---|---|
[
{
"from": "human",
"value": "Add concrete class `WORLD` that implements `Analyzer` and `Synthesizer`\n"
},
{
"from": "gpt",
"value": "# coding: utf-8\n\nfrom vctk import Analyzer, Synthesizer, SpeechParameters\nimport world\n\n\nclass WORLD(Analyzer, Synthesizer):\n\n \"\"\"\n WORLD-based ... | python | chosen |
[
{
"from": "human",
"value": "Make the website a bottle app\n"
},
{
"from": "gpt",
"value": "#!/usr/bin/env python3\n\"\"\"\nWurstmineberg: All The Items\n\"\"\"\n\nimport bottle\n\napplication = bottle.Bottle()\ndocument_root = '/var/www/alltheitems.wurstmineberg.de'\n\n@application.route('/')\n... | python | chosen |
[
{
"from": "human",
"value": "Pensinsula: Add example configuration for the pensinsula test case\n\nThis initialises a set of particles, advects them for 24h and plots their\nfinal position to screen.\n"
},
{
"from": "gpt",
"value": "from parcels import NEMOGrid, Particle\nfrom argparse import Ar... | python | chosen |
[
{
"from": "human",
"value": "Implement log rotation in config file.\n"
},
{
"from": "gpt",
"value": "# Use with --log-config option:\n# volttron --log-config rotatinglog.py\n\n{\n 'version': 1,\n 'disable_existing_loggers': False,\n 'formatters': {\n 'agent': {\n '(... | python | chosen |
[
{
"from": "human",
"value": "Add unit test for the Farmer model\n"
},
{
"from": "gpt",
"value": "from django.core.exceptions import ValidationError\nfrom django.test import TestCase\n\nfrom .models import Farmer\n\n\nclass FarmerModelTest(TestCase):\n\n def test_string_representation(self):\n... | python | chosen |
[
{
"from": "human",
"value": "Add unit test for method show_limits\n\nThis patch adds unit test for limits_client.\nSpecific about method show_limits.\n\nChange-Id: I03acbf807d388d5d6c61dafff0f2d9a07520775f\n"
},
{
"from": "gpt",
"value": "# Copyright 2015 NEC Corporation. All rights reserved.\n... | python | chosen |
[
{
"from": "human",
"value": "Add methods to retrieve a game instance backed live by shared memory or to retrieve a copy of the current state of the memory.\n"
},
{
"from": "gpt",
"value": "import mmap\nfrom carseour.definitions import GameInstance, SHARED_MEMORY_VERSION\n\ndef _get_mmapped():\n ... | python | chosen |
[
{
"from": "human",
"value": "Work with integrals from menu"
},
{
"from": "gpt",
"value": "# Кириллов Алексей, ИУ7-22\r\n# Работа с интегралами из меню\r\n\r\ndef f(x):\r\n return x*x\r\n\r\ndef parabola(a,b,n): \r\n s = 0 \r\n h = (b-a)/n \r\n for i in range(n): \r\n s += f(a+... | python | chosen |
[
{
"from": "human",
"value": "Test suite for the plistlib module.\n"
},
{
"from": "gpt",
"value": "# Copyright (C) 2003 Python Software Foundation\n\nimport unittest\nimport plistlib\nimport os\nfrom test import test_support\n\nclass TestPlistlib(unittest.TestCase):\n\n def tearDown(self):\n ... | python | chosen |
[
{
"from": "human",
"value": "Add a basic test to make sure acquisition works\n"
},
{
"from": "gpt",
"value": "import pytest\n\n\n@pytest.fixture\ndef testdir_with_map(testdir):\n testdir.makefile('.yaml', map='''\n version: 1\n\n environments:\n mock_env:\n r... | python | chosen |
[
{
"from": "system",
"value": "Fix a typo in MultipleMatchingFilesError.\n"
},
{
"from": "human",
"value": "class SC2ReaderError(Exception):\n pass\n\nclass MPQError(SC2ReaderError):\n pass\n\nclass NoMatchingFilesError(SC2ReaderError):\n pass\n\nclass MutipleMatchingFilesError(SC2Reader... | python | chosen |
[
{
"from": "human",
"value": "Add test for BCH electrum header\n"
},
{
"from": "gpt",
"value": "import electrumx.lib.coins as coins\n\n\ndef test_bitcoin_cash():\n raw_header = bytes.fromhex(\n \"00000020df975c121dcbc18bbb7ddfd0419fc368b45db86b48c87e0\"\n \"1000000000000000036ae3... | python | chosen |
[
{
"from": "human",
"value": "Add a test for loading files as a stream\n"
},
{
"from": "gpt",
"value": "#!/usr/bin/env python\n\nimport cle\nimport nose\nimport os\n\ntest_location = str(os.path.join(os.path.dirname(os.path.realpath(__file__)), '../../binaries/tests'))\n\ndef test_stream():\n ... | python | chosen |
[
{
"from": "human",
"value": "Add very very preliminary template for luigi-isation of ingestion\n"
},
{
"from": "gpt",
"value": "\nimport luigi\n\nimport logging\n\n_log = logging.getLogger()\n\nclass ImportLandsatScene(luigi.Task):\n dataset_path = luigi.Parameter()\n\n def requires(self):... | python | chosen |
[
{
"from": "human",
"value": "Add algorithm to count number of inversions in an array using divide and conquer\n"
},
{
"from": "gpt",
"value": "def countInversions(list):\n\tif len(list) == 1:\n\t\treturn list, 0;\n\telse:\n\t\tmiddle = int(len(list)/2)\n\t\tA = list[:middle]\n\t\tB = list[middle... | python | chosen |
[
{
"from": "human",
"value": "Add scraper for noslang abbrevations\n\nThis will be used for tweet preprocessing.\n"
},
{
"from": "gpt",
"value": "\"\"\"\nThis script grabs data from the slang dictionary\nhttp://www.noslang.com/dictionary and converts it into a python dictionary for\nserialization... | python | chosen |
[
{
"from": "human",
"value": "Add extension types validator module\n"
},
{
"from": "gpt",
"value": "# -*- coding: utf-8 -*-\n\n\"\"\"\nValidate method signatures and inheritance compatiblity.\n\"\"\"\n\nimport types\nimport warnings\nimport inspect\n\nimport numba\nfrom numba import *\nfrom numba... | python | chosen |
[
{
"from": "system",
"value": "Remove failing expectations for pixel tests.\n\nR=kbr@chromium.org\nBUG=252046, 371592\nNOTRY=true\n\nReview URL: https://codereview.chromium.org/282953002\n\ngit-svn-id: de016e52bd170d2d4f2344f9bf92d50478b649e0@270785 0039d316-1c4b-4281-b951-d872f2087c98\n"
},
{
"from"... | python | chosen |
[
{
"from": "human",
"value": "Add py solution for 448. Find All Numbers Disappeared in an Array\n\n448. Find All Numbers Disappeared in an Array: https://leetcode.com/problems/find-all-numbers-disappeared-in-an-array/\n"
},
{
"from": "gpt",
"value": "class Solution(object):\n def findDisappear... | python | chosen |
[
{
"from": "human",
"value": "Add test for 1305: Incorrect lemmatization of VBZ for English\n"
},
{
"from": "gpt",
"value": "import pytest\n\n@pytest.mark.models('en')\ndef test_issue1305(EN):\n '''Test lemmatization of English VBZ'''\n assert EN.vocab.morphology.lemmatizer('works', 'verb')... | python | chosen |
[
{
"from": "human",
"value": "Add ReMaterializeEventsInDevices to use in update.py\n"
},
{
"from": "gpt",
"value": "import pymongo\n\nfrom ereuse_devicehub.resources.device.domain import DeviceDomain\nfrom ereuse_devicehub.resources.device.hooks import MaterializeEvents\nfrom ereuse_devicehub.res... | python | chosen |
[
{
"from": "human",
"value": "Create default conatct for research methods\n"
},
{
"from": "gpt",
"value": "# -*- coding: utf-8 -*-\nfrom __future__ import unicode_literals\n\nfrom django.db import migrations\nimport uuid\nfrom cla_common.constants import RESEARCH_CONTACT_VIA\n\n\ndef create_defau... | python | chosen |
[
{
"from": "human",
"value": "Work begun on replacing old DMQMC script with a pyhande-based script.\n"
},
{
"from": "gpt",
"value": "#!/usr/bin/python\n'''finite_temp_analysis.py [options] file_1 file_2 ... file_N\n\nAnalyse the output of a HANDE DMQMC calculation by averaging\ntemperature-depend... | python | chosen |
[
{
"from": "human",
"value": "Set up Code Fights knapsack light problem\n"
},
{
"from": "gpt",
"value": "#!/usr/local/bin/python\n# Code Fights Knapsack Problem\n\n\ndef knapsackLight(value1, weight1, value2, weight2, maxW):\n if weight1 + weight2 <= maxW:\n return value1 + value2\n ... | python | chosen |
[
{
"from": "human",
"value": "Implement the 'trial division' algorithm.\n"
},
{
"from": "gpt",
"value": "#!/usr/bin/env python2\n\ndef find_primes(limit):\n primes = []\n\n for candidate in range(2, limit + 1):\n candidate_ok = True\n\n for divisor in range(2, candidate):\n ... | python | chosen |
[
{
"from": "human",
"value": "Add problem 49, prime permutations/same diff sequence\n"
},
{
"from": "gpt",
"value": "from time import time\nfrom problem_35 import is_prime\n\n\ndef is_list_of_permutations(ls):\n permutations = set([''.join(set(str(num))) for num in ls])\n return len(permuta... | python | chosen |
[
{
"from": "human",
"value": "Add management command for checking SOPN files after download\n"
},
{
"from": "gpt",
"value": "# -*- coding: utf-8 -*-\nfrom __future__ import print_function, unicode_literals\n\nfrom compat import BufferDictWriter\nimport requests\nimport hashlib\n\nfrom django.core... | python | chosen |
[
{
"from": "human",
"value": "Add simple example demonstrating line()\n"
},
{
"from": "gpt",
"value": "# -*- coding: utf-8 -*-\n'''Test of Folium polylines'''\n\nimport folium\n\n# Coordinates are 15 points on the great circle from Boston to \n# San Francisco.\n# Reference: http://williams.best.v... | python | chosen |
[
{
"from": "human",
"value": "Migrate Github URL to custom properties\n"
},
{
"from": "gpt",
"value": "\"\"\"Move github urls into custom properties.\"\"\"\n# -*- coding: utf-8 -*-\nfrom __future__ import unicode_literals\n\nfrom django.db import migrations\nfrom django.contrib.auth import get_us... | python | chosen |
[
{
"from": "human",
"value": "Add a script to get an EC2 IP address and add to SSH config.\n"
},
{
"from": "gpt",
"value": "#!/usr/bin/env /Users/alexrudy/.pyenv/versions/bitly-boto/bin/python\n\nimport boto3\nimport click\nimport re\nimport tempfile\nfrom pathlib import Path\n\n@click.command()\... | python | chosen |
[
{
"from": "human",
"value": "Add fab command to deploy\n"
},
{
"from": "gpt",
"value": "from fabric.api import cd, run\n\n\ndef deploy():\n with cd('who-broke-build-slack'):\n run('git reset --hard HEAD')\n run('git pull origin master')\n run('cp ../settings.py .')\n ... | python | chosen |
[
{
"from": "human",
"value": "Add a script that converts FIT files to TCX files\n\n- Requires FIT-to-TCX to convert files\n- Requires you to set the fittotcx variable to work\n"
},
{
"from": "gpt",
"value": "#!/usr/bin/python\n#\n# Script to run the FIT-to-TCX converter on every new FIT file that... | python | chosen |
[
{
"from": "human",
"value": "Add test for SOFIA text processing\n"
},
{
"from": "gpt",
"value": "from __future__ import absolute_import, print_function, unicode_literals\nfrom builtins import dict, str\n\nfrom nose.plugins.attrib import attr\n\nfrom indra.sources import sofia\n\n\n@attr('webserv... | python | chosen |
[
{
"from": "human",
"value": "Add redis utility for generating keys\n"
},
{
"from": "gpt",
"value": "## Utilities for Redis - mostly just a function for generating keys ##\n\ndef key_gen(**kwargs):\n \"\"\"\n Key generator for linux. Determines key based on\n parameters supplied in kwarg... | python | chosen |
[
{
"from": "system",
"value": "Cache: Add initial implementation of the bulk updates\n"
},
{
"from": "human",
"value": "import copy\nimport vim\n\nfrom taskwiki.task import VimwikiTask\n\n\nclass TaskCache(object):\n \"\"\"\n A cache that holds all the tasks in the given file and prevents\n... | python | chosen |
[
{
"from": "human",
"value": "Add basic CLI test coverage\n"
},
{
"from": "gpt",
"value": "\"\"\"tldextract integration tests.\"\"\"\n\nimport sys\n\nimport pytest\n\nfrom tldextract.cli import main\n\n\ndef test_cli_no_input(monkeypatch):\n monkeypatch.setattr(sys, \"argv\", [\"tldextract\"])... | python | chosen |
[
{
"from": "human",
"value": "Add a script to clear outputs from notebooks\n\nCurrently, it only supports in-place conversion.\n"
},
{
"from": "gpt",
"value": "#!/usr/bin/env python\n\n\"\"\"\nClear outputs of IPython notebooks.\n\nBy default, it prints the notebooks without outputs into stdout.\... | python | chosen |
[
{
"from": "human",
"value": "Define URL patterns for Browser list and detail views\n"
},
{
"from": "gpt",
"value": "from django.conf.urls import patterns, url\nfrom cms_genome_browser.views import BrowserListView, BrowserDetailView\n\nurlpatterns = patterns('',\n url(r'^$', BrowserListView.as... | python | chosen |
[
{
"from": "human",
"value": "Add Lab Members CMS app\n"
},
{
"from": "gpt",
"value": "# -*- coding: utf-8 -*-\n\nfrom django.utils.translation import ugettext_lazy as _\n\nfrom cms.app_base import CMSApp\nfrom cms.apphook_pool import apphook_pool\n\nfrom cms_lab_members.menu import LabMembersMen... | python | chosen |
[
{
"from": "human",
"value": "Add execution module for working in sls files\n"
},
{
"from": "gpt",
"value": "# -*- coding: utf-8 -*-\n'''\nUtility functions for use with or in SLS files\n'''\nfrom __future__ import absolute_import\n\nfrom salt.utils.dictupdate import merge, update\n\nupdate.__doc... | python | chosen |
[
{
"from": "human",
"value": "Add code on how to share variables\n\nAdd code on sharing variables between different nodes in the graph\n"
},
{
"from": "gpt",
"value": "# Sharing variables\n# Example code to use a shared threshold variable for all ReLUs\n# Create var and pass it to relu() function... | python | chosen |
[
{
"from": "human",
"value": "Add mngment command test case.\n"
},
{
"from": "gpt",
"value": "from django.core.management import call_command\nfrom .utils import BaseTestCase as TestCase\nfrom core.models import User, Group, Game, GameTag\nimport sys\nfrom cStringIO import StringIO\n\n\nclass Com... | python | chosen |
[
{
"from": "human",
"value": "Add identity patching for post unique ID generation\n"
},
{
"from": "gpt",
"value": "from celery.task import Task\nfrom celery.utils.log import get_task_logger\n\nfrom familyconnect_registration import utils\n\n\nlogger = get_task_logger(__name__)\n\n\nclass AddUniqu... | python | chosen |
[
{
"from": "human",
"value": "Add module info for politics.\n"
},
{
"from": "gpt",
"value": "# encoding: utf-8\n# Licensed to the Apache Software Foundation (ASF) under one or more\n# contributor license agreements. See the NOTICE file distributed with\n# this work for additional information reg... | python | chosen |
[
{
"from": "human",
"value": "Add missing files from Mac\n"
},
{
"from": "gpt",
"value": "from __future__ import absolute_import, division, print_function, unicode_literals\n\nclass Openable(object):\n def __init__(self):\n self.is_open = True\n\n def close(self):\n self.is_open = False\n... | python | chosen |
[
{
"from": "human",
"value": "Add py solution for 506. Relative Ranks\n\n506. Relative Ranks: https://leetcode.com/problems/relative-ranks/\n"
},
{
"from": "gpt",
"value": "from operator import itemgetter\nclass Solution(object):\n def findRelativeRanks(self, nums):\n \"\"\"\n :t... | python | chosen |
[
{
"from": "human",
"value": "Add solution to lintcode problem 179\n"
},
{
"from": "gpt",
"value": "class Solution:\n #@param n, m: Two integer\n #@param i, j: Two bit positions\n #return: An integer\n def updateBits(self, n, m, i, j):\n # write your code here\n def twos... | python | chosen |
[
{
"from": "human",
"value": "Add partial solution using combination of Prim\n"
},
{
"from": "gpt",
"value": "import networkx as nx\r\nfrom heapq import *\r\nfrom sys import argv\r\n \r\ndef main():\r\n G = nx.read_gml(argv[1])\r\n \r\n terms = [i for i,d in G.nodes(data=T... | python | chosen |
[
{
"from": "human",
"value": "Make a pos-tagging example using CRF\n"
},
{
"from": "gpt",
"value": "import collections\nimport itertools\n\nfrom nltk.corpus import brown\nimport numpy\n\nimport chainer\nimport chainer.functions as F\nimport chainer.links as L\nimport chainer.optimizers as O\n\n\n... | python | chosen |
[
{
"from": "human",
"value": "Add a dummy script which creates an hdf5 file\n"
},
{
"from": "gpt",
"value": "import numpy as np\nimport km3pipe as kp\n\n\nclass APump(kp.Pump):\n def configure(self):\n self.index = 0\n\n def process(self, blob):\n data = {'a': self.index * np.... | python | chosen |
[
{
"from": "system",
"value": "Allow for comparing to objects other than FuzzyNumber objects.\n"
},
{
"from": "human",
"value": "class FuzzyNumber(object):\n\n def __init__(self, value, threshold):\n self.value = value\n self.threshold = threshold\n\n def __repr__(self):\n ... | python | chosen |
[
{
"from": "human",
"value": "Remove unused fields for Subject via migration\n"
},
{
"from": "gpt",
"value": "# -*- coding: utf-8 -*-\n# Generated by Django 1.11.3 on 2017-10-18 15:28\nfrom __future__ import unicode_literals\n\nfrom django.db import migrations\n\n\nclass Migration(migrations.Migr... | python | chosen |
[
{
"from": "human",
"value": "Add django CMS toolbar entry\n"
},
{
"from": "gpt",
"value": "\nimport logging\n\nfrom django.conf import settings\nfrom django.utils.translation import ugettext_lazy as _\n\nfrom cms.toolbar_base import CMSToolbar\nfrom cms.toolbar_pool import toolbar_pool\nfrom cms... | python | chosen |
[
{
"from": "human",
"value": "Add solution to exercise 8.9.\n"
},
{
"from": "gpt",
"value": "# 8-9. Magicians\n\ndef show_magicians(names):\n\t\"\"\"Print each magician in the list\"\"\"\n\tfor name in names:\n\t\tprint (name)\n\nmagicians = [\n\t\"Harry Houdini\",\n\t\"David Cooperfield\",\n\t\"... | python | chosen |
[
{
"from": "human",
"value": "Add an example to chain dataflow tables.\n"
},
{
"from": "gpt",
"value": "import sys\nsys.path.append('../py')\n\nfrom iroha import *\nfrom iroha.iroha import *\n\nd = IDesign()\nmod = IModule(d, \"mod\")\n\ndef CreateTable(mod):\n tab = ITable(mod)\n st0 = ISt... | python | chosen |
[
{
"from": "human",
"value": "Add a visitor to apply the generated diffs as patches and commit them using git.\n"
},
{
"from": "gpt",
"value": "# -*- coding: utf-8 -*-\n\nfrom AbstractVisitor import AbstractVisitor\n\nfrom duralex.alinea_parser import *\n\nimport duralex.node_type\n\nimport subpr... | python | chosen |
[
{
"from": "human",
"value": "Add tests for new input types (FITS HDUs)\n"
},
{
"from": "gpt",
"value": "# Licensed under an MIT open source license - see LICENSE\n\nfrom unittest import TestCase\n\nimport numpy as np\nimport numpy.testing as npt\nimport astropy.units as u\nfrom astropy.io.fits i... | python | chosen |
[
{
"from": "human",
"value": "Add Alahsa Student Affairs Deanship\n"
},
{
"from": "gpt",
"value": "# -*- coding: utf-8 -*-\nfrom __future__ import unicode_literals\n\nfrom django.db import models, migrations\n\ndef add_alahsa_deanship(apps, schema_editor):\n Club = apps.get_model('clubs', 'Clu... | python | chosen |
[
{
"from": "human",
"value": "Add test skeleton for resource_parameters unit tests\n"
},
{
"from": "gpt",
"value": "class ResourceParametersTest(BaseTest):\n\n def test_resource_parameter_base_process_requested_values(self):\n pass\n\n def test_resource_parameter_base_process_value(s... | python | chosen |
[
{
"from": "human",
"value": "Add tests for CAS and other things\n\nRefs #63\n"
},
{
"from": "gpt",
"value": "import pylibmc\nfrom pylibmc.test import make_test_client\nfrom tests import PylibmcTestCase\nfrom nose.tools import eq_, ok_\n\nclass ClientTests(PylibmcTestCase):\n def test_zerokey(... | python | chosen |
[
{
"from": "human",
"value": "Support mbedtls, an alternative SSL library\n"
},
{
"from": "gpt",
"value": "from spack import *\n\nclass Mbedtls(Package):\n \"\"\"\n mbed TLS (formerly known as PolarSSL) makes it trivially easy for developers to include cryptographic and SSL/TLS capabilities... | python | chosen |
[
{
"from": "human",
"value": "Add tests for small script files\n"
},
{
"from": "gpt",
"value": "\"\"\"This module tests the small scripts - admin, model, and wsgi.\"\"\"\n\nimport unittest\n\n\nclass SmallScriptsTest(unittest.TestCase):\n def test_admin(self):\n import api.admin\n\n ... | python | chosen |
[
{
"from": "human",
"value": "Test of simulated graph reading. "
},
{
"from": "gpt",
"value": "\nimport apgl\nimport numpy \nimport unittest\nimport pickle \nimport numpy.testing as nptst \n\nfrom exp.viroscopy.HIVGraphReader import HIVGraphReader\n\nclass HIVGraphReaderTest(unittest.TestCase):\... | python | chosen |
[
{
"from": "human",
"value": "Read the data and output to terminal\n"
},
{
"from": "gpt",
"value": "#!/usr/bin/python3\n\nimport smbus\nimport time\nimport sys\n\n# Get I2C bus\n\nbus = smbus.SMBus(1)\n\n# number of channels the monitoring board has\nno_of_channels = 1\n\n# PECMAC125A address, 0x... | python | chosen |
[
{
"from": "human",
"value": "Add test for iris, same as example notebook\n"
},
{
"from": "gpt",
"value": "\ndef test_iris():\n from tsne import bh_sne\n from sklearn.datasets import load_iris\n\n iris = load_iris()\n\n X = iris.data\n y = iris.target\n\n X_2d = bh_sne(X)\n"
}... | python | chosen |
[
{
"from": "human",
"value": "Add collect ini field script.\n"
},
{
"from": "gpt",
"value": "\"\"\"\ncollect information about fields and values in ini file\n\nusage run script with file name in directory with unpacked stats.\n\nScript will collect data from all files with name.\n\nYou can specif... | python | chosen |
[
{
"from": "human",
"value": "Add a script to analyse profile output per shader.\n"
},
{
"from": "gpt",
"value": "#!/usr/bin/env python\n##########################################################################\n#\n# Copyright 2012 VMware, Inc.\n# All Rights Reserved.\n#\n# Permission is hereby ... | python | chosen |
[
{
"from": "human",
"value": "Update the DB with the new descriptions.\n\nThis shouldn't be necessary.\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 d... | python | chosen |
[
{
"from": "human",
"value": "Add some dummy arg parsing tests\n"
},
{
"from": "gpt",
"value": "\"\"\"\nUnittests for importing a course via management command\n\"\"\"\n\nimport unittest\n\nfrom django.core.management import CommandError\nfrom contentstore.management.commands.migrate_to_split imp... | python | chosen |
[
{
"from": "human",
"value": "Add missing migration for recent model refactor\n"
},
{
"from": "gpt",
"value": "# Generated by Django 2.0 on 2018-02-21 07:58\n\nfrom django.conf import settings\nfrom django.db import migrations, models\nimport django.db.models.deletion\n\n\nclass Migration(migrati... | python | chosen |
[
{
"from": "system",
"value": "Create the Contacts App - Part II > Edit Contact - Create URL\n"
},
{
"from": "human",
"value": "from django.conf.urls import patterns, url\n\ncontact_urls = patterns('',\n\n url(r'^$', 'crmapp.contacts.views.contact_detail', name=\"contact_detail\"),\n\n)\n"
}... | python | chosen |
[
{
"from": "human",
"value": "Add an example of pathway extraction from Reaction.\n"
},
{
"from": "gpt",
"value": "import requests\n\ndef httpRequestReactome(code):\n try:\n r = requests.get('http://www.reactome.org/ContentService/search/query?query=' + code +'&cluster=true')\n r... | python | chosen |
[
{
"from": "human",
"value": "Rename notify service to GOV.UK Notify\n"
},
{
"from": "gpt",
"value": "\"\"\"empty message\n\nRevision ID: 0026_rename_notify_service\nRevises: 0025_notify_service_data\nCreate Date: 2016-06-07 09:51:07.343334\n\n\"\"\"\n\n# revision identifiers, used by Alembic.\nr... | python | chosen |
[
{
"from": "human",
"value": "Add sample app calling SPL functions\n"
},
{
"from": "gpt",
"value": "# Licensed Materials - Property of IBM\n# Copyright IBM Corp. 2016\nimport sys\nimport string\nfrom streamsx.topology.topology import Topology\nfrom streamsx.topology import spl_ops\nfrom streamsx.... | python | chosen |
[
{
"from": "human",
"value": "Add basic Facebook service integration\n"
},
{
"from": "gpt",
"value": "\"\"\"facebook.py - Module for Facebook service functionality\"\"\"\n\nimport time\n\nimport click\n\n\nclass FacebookDestroyer():\n \"\"\"Destroyer class for Facebook integration.\n \"\"\"... | python | chosen |
[
{
"from": "human",
"value": "Write the initial PetIBM readable solution in 0000000 sub-folder\n"
},
{
"from": "gpt",
"value": "# file: createInitialPETScSolution.py\n# author: Olivier Mesnard (mesnardo@gwu.edu)\n# description: Creates the initial solution and write in a PETSc-readable format.\n\... | python | chosen |
[
{
"from": "human",
"value": "Add unit tests for nntools.init.\n"
},
{
"from": "gpt",
"value": "def test_shape():\n from nntools.init import Initializer\n\n # Assert that all `Initializer` sublasses return the shape that\n # we've asked for in `sample`:\n for klass in Initializer.__su... | python | chosen |
[
{
"from": "human",
"value": "Add data migration to build ForeignKey on Person.uuid field\n"
},
{
"from": "gpt",
"value": "# -*- coding: utf-8 -*-\n# Generated by Django 1.10.5 on 2017-01-17 20:19\nfrom __future__ import unicode_literals\n\nfrom django.db import migrations\n\ndef link_person_mode... | python | chosen |
[
{
"from": "human",
"value": "Test Python-Postgresql CRUD using psycopg2 driver\n"
},
{
"from": "gpt",
"value": "'''\nCreated on Aug 5, 2010\n\n@author: apm\n'''\n#Test CRUD on opengemdb database\n#CREATE : Create testTable\n# : Insert rows\n#READ : Read rows\n#UPDATE : Change row values\... | python | chosen |
[
{
"from": "human",
"value": "Test for an error that is still raised\n\nThis is needed since we now automatically expand objects if required.\n"
},
{
"from": "gpt",
"value": "\nimport os\nimport shutil\nimport sys\n\nfrom six import StringIO\n\nfrom eppy.runner.run_functions import parse_error, E... | python | chosen |
[
{
"from": "human",
"value": "Speed up request count by status in period of days\n"
},
{
"from": "gpt",
"value": "\"\"\"idx requests by status, completed\n\nRevision ID: 7f4a3b8c55d\nRevises: 4b96dd9974bb\nCreate Date: 2014-03-31 17:39:40.858182\n\n\"\"\"\n\n# revision identifiers, used by Alembi... | python | chosen |
[
{
"from": "human",
"value": "Add migrate on shell script\n"
},
{
"from": "gpt",
"value": "from django.db import connection\nfrom vpr_content import models\n\ndef removeDuplicatedTitleInMaterial():\n cur = connection.cursor()\n qr0 = 'select id from vpr_content_material'\n qr1 = 'select ... | python | chosen |
[
{
"from": "human",
"value": "Add regressiong test for missing road\n"
},
{
"from": "gpt",
"value": "# Relation: 611 (975266)\n#https://www.openstreetmap.org/relation/975266\ntest.assert_has_feature(\n 12, 1192, 1539, \"roads\",\n {\"kind\": \"major_road\",\n \"shield_text\": \"611\",\n... | python | chosen |
[
{
"from": "human",
"value": "Add adapter plugin for simplejtag level0 protocol.\n\nhttps://github.com/pfalcon/simplejtag\n"
},
{
"from": "gpt",
"value": "import time\nimport logging\n\nimport serial\nfrom SWDAdapterBase import *\n\n\nCMD_WRITE_TMS = ord('8') # +1\nCMD_WRITE_TCK = ord(' ') # +1... | python | chosen |
[
{
"from": "human",
"value": "Add basic TrackSocket using autobahn\n"
},
{
"from": "gpt",
"value": "import autobahn.asyncio.websocket\n\n\nclass TrackSocket(autobah.asyncio.websocket.WebSocketServerProtocol):\n\t@asyncio.coroutine\n\tdef onOpen(self):\n\t\t#TODO: Make this add to the client list\... | python | chosen |
[
{
"from": "human",
"value": "Add a command to fix invalid geometries in 2014-05 boundary line\n\nSome of the geometries the Ordnance Survey provided were invalid,\nhaving duplicated start and end points. This command fixes them up.\n"
},
{
"from": "gpt",
"value": "# This script is to be run as a... | python | chosen |
[
{
"from": "human",
"value": "Add management command to delete all objects that were imported from archive\n"
},
{
"from": "gpt",
"value": "from django.core.management.base import BaseCommand\nfrom django.db import models as registered_models\n\nclass Command(BaseCommand):\n\n def handle(self,... | python | chosen |
[
{
"from": "human",
"value": "Add a convert script from calib_pose.yaml to urdf format\n"
},
{
"from": "gpt",
"value": "#!/usr/bin/env python\n# -*- coding: utf-8 -*-\n\nimport argparse\nimport numpy as np\nimport os\nimport tempfile\nimport tf\nimport yaml\n\ndef read_calib_pose(fname):\n tmp... | python | chosen |
[
{
"from": "human",
"value": "Add script to plot ~LL's\n"
},
{
"from": "gpt",
"value": "#!/usr/bin/env python \n\nfrom __future__ import division\n\nimport sys\n\nimport logging\nfrom time import time\nimport cPickle as pickle\n\nimport numpy as np\nimport h5py\n\n\nimport pylab\n#import theano\n... | python | chosen |
[
{
"from": "human",
"value": "Add slide carousel helper function model.\n"
},
{
"from": "gpt",
"value": "import json\nfrom numpy.random import choice\n\ndef generate_slides():\n slides = json.load(open(\"static/carousel/slides.json\", \"r\"))\n weights = [x[\"weight\"] for x in slid... | python | chosen |
[
{
"from": "human",
"value": "Add a CLI script to fetch departures\n"
},
{
"from": "gpt",
"value": "#! /usr/bin/env python3\n# -*- coding: utf-8 -*-\n\nimport argparse\nimport sys\n\nfrom bvggrabber.api.actualdeparture import ActualDepartureQueryApi\n\nfrom bvggrabber.api.scheduleddeparture impor... | python | chosen |
[
{
"from": "human",
"value": "Add a simple command-logging cog\n"
},
{
"from": "gpt",
"value": "import logging\n\n\nclass CommandLog:\n \"\"\"A simple cog to log commands executed.\"\"\"\n def __init__(self):\n self.log = logging.getLogger('liara.command_log')\n\n async def on_com... | python | chosen |
[
{
"from": "human",
"value": "Add a widget (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\"\"\"\nA simple Python GTK+3 SearchEntry snippet.\n\nAPI: http://lazka.github.io/pgi-docs/Gt... | python | chosen |
[
{
"from": "human",
"value": "Add tests for data handler items\n"
},
{
"from": "gpt",
"value": "#!/usr/bin/env python\n# -*- coding: utf-8 -*-\n\nimport json\n\nfrom utils.data_handler import DataHandler\n\n\nsrc_rs = r\"D:\\nhl\\official_and_json\\_2015-16\\2016-04\\2016-04-10.zip\"\nsrc_po = r\... | python | chosen |
[
{
"from": "human",
"value": "Make sure EmailValidator.is_email raises NotImplementedError.\n"
},
{
"from": "gpt",
"value": "import unittest\nfrom pyisemail import EmailValidator\n\nclass EmailValidatorTest(unittest.TestCase):\n\n def test_abstract_is_email(self):\n v = EmailValidator()... | python | chosen |
[
{
"from": "human",
"value": "SymbolicData: Add tests for symbolic differentiation of data objects\n"
},
{
"from": "gpt",
"value": "from devito import DenseData, TimeData\nfrom sympy import symbols, Derivative, as_finite_diff\nimport pytest\nimport numpy as np\n\n\n@pytest.fixture\ndef shape(xdim... | python | chosen |
[
{
"from": "human",
"value": "Add a script to update RNAcentral descriptions\n"
},
{
"from": "gpt",
"value": "\"\"\"\nUpdate all RNAcentral descriptions to the latest version using RNAcentral API.\n\nUsage:\n\npython update_rnacentral_descriptions.py\n\"\"\"\n\nimport requests\n\nfrom utils impor... | python | chosen |
[
{
"from": "human",
"value": "Create an outline for the gaussian process interpolation class.\n"
},
{
"from": "gpt",
"value": "\"\"\"\nSet of routines and classes for interpolating light curves.\nThere include Gaussian Processes and Spline interpolation\n\"\"\"\nimport george\nfrom george.kernels... | python | chosen |
[
{
"from": "human",
"value": "Add shutdown at end to make sure that we dont crash on shutdown.\n"
},
{
"from": "gpt",
"value": "import sys\nimport _jpype\nimport jpype\nfrom jpype.types import *\nfrom jpype import JPackage, java\nimport common\nimport pytest\ntry:\n import numpy as np\nexcept ... | python | chosen |
[
{
"from": "human",
"value": "Add a test for the IATI Google Group\n\nThis tests the 200 response.\nIt would ideally be checked that there is a link to IATI Discuss.\nThis is not done because of the way the page loads.\nThis functionality could be added later with Selenium.\n"
},
{
"from": "gpt",
... | python | chosen |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.