conversations listlengths 2 3 | source stringclasses 1
value | stack stringclasses 1
value |
|---|---|---|
[
{
"from": "human",
"value": "Add test to exercise code snippet known to cause segfault\n"
},
{
"from": "gpt",
"value": "# ----------------------------------------------------------------------\n# Numenta Platform for Intelligent Computing (NuPIC)\n# Copyright (C) 2014-2015, Numenta, Inc. Unless... | python | chosen |
[
{
"from": "human",
"value": "Create weekday node and createweekday class\n"
},
{
"from": "gpt",
"value": "from django.core.exceptions import ValidationError\n\nimport graphene\nfrom graphene_django import DjangoObjectType\n\nfrom app.timetables.models import Weekday\nfrom .utils import get_error... | python | chosen |
[
{
"from": "human",
"value": "ADD a prototype for a plotting script of the learned model"
},
{
"from": "gpt",
"value": "#!/usr/bin/env python\n\nimport logging\nimport sys\nimport os\nimport inspect\ncmd_folder = os.path.realpath(os.path.abspath(os.path.split(inspect.getfile( inspect.currentframe... | python | chosen |
[
{
"from": "human",
"value": "Document from the reality that while breaking apps down is a good idea, even then you often have a sufficient number of topic areas to cover that can't be easily split into more apps, i.e. TestCase classes are insufficient to group the relevant tests together, and a 5k tests.py ... | python | chosen |
[
{
"from": "human",
"value": "Add some tests for url.\n"
},
{
"from": "gpt",
"value": "import unittest\n\nfrom django.test import Client\nfrom django.contrib.auth.models import User\n\nADMIN_PASSWORD = '123456'\n\nclass SimpleTest(unittest.TestCase):\n @classmethod\n def setUpClass(self):\n... | python | chosen |
[
{
"from": "human",
"value": "Create load balanced function to perform cross validation. Use main block to display best result\n"
},
{
"from": "gpt",
"value": "from IPython import parallel\nfrom sklearn.datasets import fetch_20newsgroups_vectorized\n\n\ndef get_results():\n # get data\n dat... | python | chosen |
[
{
"from": "human",
"value": "Add experiment groups search managers tests\n"
},
{
"from": "gpt",
"value": "from django.test import override_settings\nfrom polyaxon_schemas.settings import SettingsConfig\n\nfrom experiment_groups.iteration_managers import (\n HyperbandIterationManager,\n get... | python | chosen |
[
{
"from": "human",
"value": "Add model/simulation of cache eviction with a Bit-Pseudo-LRU cache\n"
},
{
"from": "gpt",
"value": "# Copyright 2015, Google, Inc.\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may not use this file except in compliance with the Licen... | python | chosen |
[
{
"from": "human",
"value": "Add raw data filter plugin\n"
},
{
"from": "gpt",
"value": "\"\"\"Show how to add a custom raw data filter for the TraceView and Waveform View\n\nUse Alt+R in the GUI to toggle the filter.\n\n\"\"\"\n\nimport numpy as np\nfrom scipy.signal import butter, lfilter\n\nf... | python | chosen |
[
{
"from": "human",
"value": "Sort a linked list using insertion sort\n"
},
{
"from": "gpt",
"value": "#!/usr/bin/python\n# -*- coding: utf-8 -*-\n# Definition for singly-linked list.\r\nclass ListNode:\n def __init__(self, x):\n self.val = x\n self.next = None\n\nclass Solution:... | python | chosen |
[
{
"from": "human",
"value": "Add directory to story python plotting scripts. Add script to plot a 3D ellipsoid.\n"
},
{
"from": "gpt",
"value": "'''\nCopyright (c) 2016 Abhishek Agrawal (abhishek.agrawal@protonmail.com)\nDistributed under the MIT License.\nSee accompanying file LICENSE.md or cop... | python | chosen |
[
{
"from": "human",
"value": "Create context manager to lock on ir.config_paramter record\n"
},
{
"from": "gpt",
"value": "import contextlib\n\nfrom openerp import exceptions\n\n\n@contextlib.contextmanager\ndef synchronize_on_config_parameter(env, parameter):\n param_model = env['ir.config_pa... | python | chosen |
[
{
"from": "human",
"value": "Add a regression test for whitespace normalization in the BibTeX parser.\n"
},
{
"from": "gpt",
"value": "from pybtex.database import BibliographyData\nfrom pybtex.core import Entry\nfrom pybtex.database.input.bibtex import Parser\nfrom cStringIO import StringIO\n\nt... | python | chosen |
[
{
"from": "human",
"value": "Add missing vouches to employees.\n"
},
{
"from": "gpt",
"value": "# -*- coding: utf-8 -*-\n# Generated by Django 1.11.15 on 2018-08-15 08:08\nfrom __future__ import unicode_literals\n\nfrom django.db import migrations\nfrom django.conf import settings\n\n\ndef add_m... | python | chosen |
[
{
"from": "human",
"value": "Add unit test for barrier\n"
},
{
"from": "gpt",
"value": "# -*- coding: iso-8859-1 -*-\n# Maintainer: jglaser\n\nfrom hoomd_script import *\ninit.setup_exec_conf();\nimport unittest\nimport os\n\n# unit test to run a simple polymer system with pair and bond potentia... | python | chosen |
[
{
"from": "human",
"value": "Add unit tests for Emails()\n"
},
{
"from": "gpt",
"value": "import unittest\nimport mock\nfrom ..emails import Emails\n\n\nclass TestEmails(unittest.TestCase):\n\n @mock.patch('auth0.v2.emails.RestClient')\n def test_get(self, mock_rc):\n mock_instance ... | python | chosen |
[
{
"from": "human",
"value": "Send mails to contacts referenced in a csv file.\n"
},
{
"from": "gpt",
"value": "from django.core.management.base import BaseCommand\nfrom django.core.mail import EmailMessage, get_connection\nfrom django.template import Template, Context\n\nfrom mezzanine.pages.mod... | python | chosen |
[
{
"from": "human",
"value": "Add beginning of splinter tests\n"
},
{
"from": "gpt",
"value": "from django.contrib.staticfiles.testing import LiveServerTestCase\nfrom django.contrib.auth.models import User\nfrom django.core.urlresolvers import reverse\nfrom django.test import Client, TestCase\n\n... | python | chosen |
[
{
"from": "human",
"value": "Add unit test for the BaseTrigger.parameters() method\n\nSigned-off-by: Samuel Dacanay <600ff55f21d6ff32f29d8ef60f49bc6b12380523@anchore.com>\n"
},
{
"from": "gpt",
"value": "import pytest\n\nfrom anchore_engine.services.policy_engine.engine.policy.gates import Packa... | python | chosen |
[
{
"from": "human",
"value": "Test that query results with None IDs (e.g. some outer join cases) \nare handled correctly, i.e. return None for that object.\n\n\ngit-svn-id: fe2f45b2405132b4a9af5caedfc153c2e6f542f4@777 95a46c32-92d2-0310-94a5-8d71aeb3d4b3\n"
},
{
"from": "gpt",
"value": "'''Test t... | python | chosen |
[
{
"from": "human",
"value": "Add migration for descriptor_dirty field in Sample\n"
},
{
"from": "gpt",
"value": "# -*- coding: utf-8 -*-\n# Generated by Django 1.10.5 on 2017-02-03 10:11\nfrom __future__ import unicode_literals\n\nfrom django.db import migrations, models\n\n\nclass Migration(mig... | python | chosen |
[
{
"from": "human",
"value": "Add automated script for determining which features to suppress\n\n"
},
{
"from": "gpt",
"value": "#!/usr/bin/env python3\n\nimport argparse\nimport subprocess\n\nfrom itertools import combinations\nfrom sys import executable\n\nparser = argparse.ArgumentParser()\npa... | python | chosen |
[
{
"from": "human",
"value": "Add Supernova report parser script\n"
},
{
"from": "gpt",
"value": "import sys\nimport re\nimport json\nimport fileinput\nimport argparse\n\ndef print_json(files):\n\tsamples = {}\n\tfor line in fileinput.input(files=files):\n\t\tm = re.search(r\"P\\d{4}_\\d{3}\", li... | python | chosen |
[
{
"from": "human",
"value": "Add unit tests on commands.\n"
},
{
"from": "gpt",
"value": "from unittest import TestCase\nfrom mock import Mock, patch\n\nfrom nyuki.commands import (_update_config, _merge_config, parse_init,\n exhaustive_config)\n\n\nclass TestUpdateCon... | python | chosen |
[
{
"from": "human",
"value": "Add integration test covering basic functionality\n"
},
{
"from": "gpt",
"value": "# -*- coding: utf-8 -*-\n#\n# Copyright © 2016- The Spyder Development Team\n# Licensed under the terms of the MIT License\n# (see ../../LICENSE for details)\n\n\"\"\"Tests for unittes... | python | chosen |
[
{
"from": "human",
"value": "Add py solution for 637. Average of Levels in Binary Tree\n\n637. Average of Levels in Binary Tree: https://leetcode.com/problems/average-of-levels-in-binary-tree/\n"
},
{
"from": "gpt",
"value": "from collections import defaultdict\nfrom Queue import Queue\n# Defini... | python | chosen |
[
{
"from": "human",
"value": "Add hero to press release listing\n"
},
{
"from": "gpt",
"value": "# -*- coding: utf-8 -*-\nfrom __future__ import unicode_literals\n\nfrom django.db import migrations, models\nimport django.db.models.deletion\n\n\nclass Migration(migrations.Migration):\n\n depend... | python | chosen |
[
{
"from": "human",
"value": "Add tests for RabbitMQ backend\n\nWe are testing here RabbitMQ Backend and RabbitMQ publisher class.\nI'm not sure yet how to implement Subscriber class\n"
},
{
"from": "gpt",
"value": "import mock\n\n\nfrom pubsub.backend.rabbitmq import RabbitMQ, RabbitMQPublisher\... | python | chosen |
[
{
"from": "human",
"value": "Add unittest for the Lambda Function\n"
},
{
"from": "gpt",
"value": "\"\"\"Created By: Andrew Ryan DeFilippis\"\"\"\n\nimport contextlib\nimport re\nimport unittest\nfrom io import StringIO\n\nimport context\nimport lambda_function\n\n\nclass TestLambdaFunction(unit... | python | chosen |
[
{
"from": "human",
"value": "Add Wav2Vec2 unit test to Python\n"
},
{
"from": "gpt",
"value": "# Copyright 2017-2022 John Snow Labs\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# You may obtain a ... | python | chosen |
[
{
"from": "human",
"value": "Add tasks to anonymize past opt outs\n"
},
{
"from": "gpt",
"value": "from django.core.management.base import BaseCommand, CommandError\n\nfrom studygroups.models import Application\n\nclass Command(BaseCommand):\n help = 'Anonymize applications that previously op... | python | chosen |
[
{
"from": "human",
"value": "Add open url (web page) script\n"
},
{
"from": "gpt",
"value": "#!/usr/bin/env python\n# -*- coding: utf-8 -*-\n\nimport urllib2\n\nresponse = urllib2.urlopen(\"https://www.python.org/\")\nhtml = response.read()\n\n# print out the HTML response\nprint(html)\n"
}
] | python | chosen |
[
{
"from": "human",
"value": "Add simplest integration test ever for dump\n"
},
{
"from": "gpt",
"value": "from ...testcases import DustyIntegrationTestCase\n\nclass TestDumpCLI(DustyIntegrationTestCase):\n def test_dump(self):\n result = self.run_command('dump')\n self.assertInS... | python | chosen |
[
{
"from": "human",
"value": "Add test file for lesson 0.\n"
},
{
"from": "gpt",
"value": "# This lesson teaches you how to define a Python method. Try running the tests for this file before doing anything!\n\n# Here's a python script you can use to run your tests from the top level directory of ... | python | chosen |
[
{
"from": "human",
"value": "Add beginnings of some gizmo test coverage\n"
},
{
"from": "gpt",
"value": "from unittest import TestCase\n\nfrom groundstation.transfer.request import Request\n\nclass TestGizmoRequest(TestCase):\n def test_loadable_after_serializing(self):\n gizmo = Reque... | python | chosen |
[
{
"from": "human",
"value": "Add level generation test util fn\n\nMaybe just create a general test util unless you're gonna build a\nlotta these.\n"
},
{
"from": "gpt",
"value": "from hunting.level.map import LevelMap, LevelTile\n\ndef generate_5x3_long_c():\n level_map = LevelMap([[LevelTile... | python | chosen |
[
{
"from": "human",
"value": "Add tests for wind_turbine module\n"
},
{
"from": "gpt",
"value": "import pandas as pd\nfrom pandas.util.testing import assert_series_equal\nimport pytest\n\nfrom windpowerlib.wind_turbine import read_turbine_data, WindTurbine\n\nclass TestWindTurbine:\n\n def tes... | python | chosen |
[
{
"from": "human",
"value": "Test if there is a pattern in sparsity structure"
},
{
"from": "gpt",
"value": "\n\"\"\"\nSome code to see if there is any pattern in the SVD of a matrix with fixed \nsparisty structure. \n\"\"\"\nimport sys \nimport logging\nimport scipy.sparse\nimport numpy\nfrom s... | python | chosen |
[
{
"from": "human",
"value": "Add simple function for outputting statistics for use with munin\n\nEventually we will want to replace this with statsd.\n\n(imported from commit 64246e9f2d13d72f53d009a5e3e456bc6be6296b)\n"
},
{
"from": "gpt",
"value": "import os\nimport logging\n\nSTATS_DIR = os.pa... | python | chosen |
[
{
"from": "human",
"value": "Set default ordering for ContributorRank\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 ('contr... | python | chosen |
[
{
"from": "human",
"value": "Create Support Vector Machine vectorizer and classifier pickles\n"
},
{
"from": "gpt",
"value": "from sklearn.feature_extraction.text import TfidfVectorizer\nfrom sklearn.linear_model import SGDClassifier\nfrom sklearn.externals import joblib\n\nprint \"Grabbing data... | python | chosen |
[
{
"from": "human",
"value": "Add a trivially basic test\n"
},
{
"from": "gpt",
"value": "from __future__ import (absolute_import, division, print_function,\n unicode_literals)\n\nfrom unittest import TestCase\n\nfrom .. import Draft, Color\n\n\nclass TestDraft(TestCase):\n... | python | chosen |
[
{
"from": "human",
"value": "Add script to restore a deleted node\n"
},
{
"from": "gpt",
"value": "\"\"\"Restores a deleted node.\nNOTE: Only use this for nodes that have no addons except for OSFStorage and Wiki.\n\"\"\"\nimport logging\nimport sys\n\nfrom framework.transactions.context import T... | python | chosen |
[
{
"from": "human",
"value": "Use closue default parameter for set arguments correctly in list comprehension.\n"
},
{
"from": "gpt",
"value": "#!/usr/bin/env python3\n\n\ndef create_multipliers_late_binding():\n \"\"\" https://www.toptal.com/python/top-10-mistakes-that-python-programmers-make ... | python | chosen |
[
{
"from": "human",
"value": "Add the GPIO proxy class for the Raspberry Pi\n"
},
{
"from": "gpt",
"value": "# The MIT License (MIT)\n#\n# Copyright (c) 2015 Frederic Jacob\n#\n# Permission is hereby granted, free of charge, to any person obtaining a copy\n# of this software and associated docume... | python | chosen |
[
{
"from": "human",
"value": "Write tests for socket: short, long and exact.\n"
},
{
"from": "gpt",
"value": "# -*- coding: utf-8 -*-\nimport subprocess\nimport pytest\n\n\ndef test_basic(string=\"This is a test.\"):\n process = subprocess.Popen(['./echo_client.py', string],\n ... | python | chosen |
[
{
"from": "human",
"value": "Add custom uility function which knows how to compare and match complex semver\nversion specifiers.\n"
},
{
"from": "gpt",
"value": "# Licensed to the StackStorm, Inc ('StackStorm') under one or more\n# contributor license agreements. See the NOTICE file distributed... | python | chosen |
[
{
"from": "human",
"value": "Add command to truncate table data in PostgreSQL db dump files\n\nExample usage:\n\n manage.py truncate_postgres_dbdump \\\n big.sql big_table_name1 big_table_name2 \\\n > small.sql\n"
},
{
"from": "gpt",
"value": "import sys # Needed to output unicode see ht... | python | chosen |
[
{
"from": "human",
"value": "Add management command to populate site codes\n"
},
{
"from": "gpt",
"value": "from django.core.management.base import BaseCommand\nfrom corehq.apps.locations.models import Location\n\n\nclass Command(BaseCommand):\n help = 'Generate missing site codes for locatio... | python | chosen |
[
{
"from": "human",
"value": "Configure betamax for pytest usage\n"
},
{
"from": "gpt",
"value": "\"\"\"Global test configuration\"\"\"\n\n\nimport os\n\nimport betamax\n\n\n# Ensure cassete dir\nCASSETE_DIR = 'tests/cassetes/'\nif not os.path.exists(CASSETE_DIR):\n os.makedirs(CASSETE_DIR)\n\... | python | chosen |
[
{
"from": "human",
"value": "Add check for None values in node or node.next\n\nWe raise a ValueError if the rules of the API are broken (passing a null node or the tail node)"
},
{
"from": "gpt",
"value": "\"\"\"\nWrite a function to delete a node (except the tail)\nin a singly linked list, give... | python | chosen |
[
{
"from": "human",
"value": "Add tests for the stacks.yml file\n"
},
{
"from": "gpt",
"value": "import json\n\nfrom dmaws.stacks import Stack\nfrom dmaws.context import Context\n\n\ndef is_true(x):\n assert x\n\n\ndef is_in(a, b):\n assert a in b\n\n\ndef valid_stack_json(stack):\n text... | python | chosen |
[
{
"from": "human",
"value": "Add joblaunch command to source control\n"
},
{
"from": "gpt",
"value": "# Copyright 2013, AnsibleWorks Inc.\n# Michael DeHaan <michael@ansibleworks.com>\n# Chris Church <cchurch@ansibleworks.com>\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\")... | python | chosen |
[
{
"from": "human",
"value": "Drop unused month and year columns from monthlybilling\n"
},
{
"from": "gpt",
"value": "\"\"\"\n\nRevision ID: 0014_drop_monthly_billing_cols\nRevises: 0113_job_created_by_nullable\nCreate Date: 2017-07-27 13:36:37.304344\n\n\"\"\"\nfrom alembic import op\nimport sql... | python | chosen |
[
{
"from": "human",
"value": "Add functions to build and parse variable-length (VLE) strings\n"
},
{
"from": "gpt",
"value": "import struct\n\ndef spdy_add_vle_string(frame, string):\n\tbuf = bytes(string, 'utf-8')\n\tbuf_len = len(buf)\n\n\tif buf_len >= 0xFA:\n\t\tstruct.pack_into('!BH', frame.... | python | chosen |
[
{
"from": "human",
"value": "Add tool for generating ublox config packets\n"
},
{
"from": "gpt",
"value": "#\n# Copyright (c) Michael Tharp <gxti@partiallystapled.com>\n#\n# This file is distributed under the terms of the MIT License.\n# See the LICENSE file at the top of this tree, or if it is ... | python | chosen |
[
{
"from": "human",
"value": "Fix the Ghostscript normalization output format\n\nAdds a migration to fix the Ghostscript normalization command \"Command\nTranscoding to pdfa with Ghostscript\" so that it documents its true output\nformat as PDF/A 1b (fmt/354) and not PDF/A 1a (fmt/95).\n\nContributes to fixi... | python | chosen |
[
{
"from": "human",
"value": "Add a forgotten migration for QueuedImage\n\nThis should have been generated when blank=True was added to the\njustification_for_use field, but I forgot.\n"
},
{
"from": "gpt",
"value": "# -*- coding: utf-8 -*-\nfrom __future__ import unicode_literals\n\nfrom django.... | python | chosen |
[
{
"from": "human",
"value": "Add unit tests for upcoming pygametemplate.Image class\n"
},
{
"from": "gpt",
"value": "from spec.helper import *\n\nfrom pygame import Surface\n\nfrom pygametemplate import Image\n\n\nwith description(\"pygametemplate.Image\"):\n with it(\"should initialise corre... | python | chosen |
[
{
"from": "human",
"value": "Add migration for reminder update\n"
},
{
"from": "gpt",
"value": "# -*- coding: utf-8 -*-\n# Generated by Django 1.11.29 on 2021-08-31 11:59\nfrom __future__ import unicode_literals\n\nfrom django.db import migrations, models\n\n\nclass Migration(migrations.Migratio... | python | chosen |
[
{
"from": "human",
"value": "Add basic proof of concept: encode and decode\n"
},
{
"from": "gpt",
"value": "import string\n\n# Pseudocode\n\n## Encode\ndef encode(secret_string, wordlist=[]):\n # TODO: wordlist is not intended for production\n message = []\n\n # Generate fibo values V_m... | python | chosen |
[
{
"from": "human",
"value": "Migrate SDE to remove redundant fields\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 ('sde', '... | python | chosen |
[
{
"from": "system",
"value": "Fix default get_user_home with dynamic dashboards\n\nThe existing get_user_home implementation expects both the 'admin'\nand 'project' dashboards to exist and throws an exception if they\nare missing. With the inclusion of configurable dashboard loading,\nwe can no longer coun... | python | chosen |
[
{
"from": "human",
"value": "Add backkwards-compatible Bankcard class factory\n\nThis provides a way for extensions that need to work with Oscar 0.5 and\n0.6 to consistently load the Banckard class (even though it was moved\nand had its API changed between versions).\n"
},
{
"from": "gpt",
"valu... | python | chosen |
[
{
"from": "human",
"value": "Add class to store caption data\n"
},
{
"from": "gpt",
"value": "\n\nclass Caption(object):\n def __init__(self, start, end, lines=None):\n self.start = start\n self.end = end\n self.lines = lines or []\n\n def add_line(self, line):\n ... | python | chosen |
[
{
"from": "human",
"value": "Test part 1 of day 7.\n"
},
{
"from": "gpt",
"value": "import unittest\n\nfrom address import has_reflection, is_compatible\n\n\nclass TestAddress(unittest.TestCase):\n def test_has_reflection(self):\n assert has_reflection(['mnop']) == False\n asser... | python | chosen |
[
{
"from": "human",
"value": "Add new buyer email domain table\n\nA simple table to store the email domain (currently held in a text\nfile).\n\nThe domain_name field has a uniqueness constraint.\n"
},
{
"from": "gpt",
"value": "\"\"\"Add buyer email domain table\n\nRevision ID: 1020\nRevises: 101... | python | chosen |
[
{
"from": "human",
"value": "Support for SSL in wsgi.Service\n\nEnable support for SSL as well using code from glance. We\nhave some new options for configuring the SSL support.\n\ntest_app starts wsgi.Service with a test app, then creates\na url to make sure the http requests are actually served\nproperly\... | python | chosen |
[
{
"from": "system",
"value": "Change docker-py dependency error to a warning, update fix command\n\nSigned-off-by: Joffrey F <2e95f49799afcec0080c0aeb8813776d949e0768@docker.com>\n"
},
{
"from": "human",
"value": "from __future__ import absolute_import\nfrom __future__ import print_function\nfro... | python | chosen |
[
{
"from": "human",
"value": "Add a test that imports runlint under both python2 and python3\n\nSummary:\nkhan-linter now runs under both python2 and python3, but it's going to be easy\nto break that. This commit adds a test that checks that runlint.py can be\nimported in both python2 and python3. This won... | python | chosen |
[
{
"from": "human",
"value": "Add udp sender for debug purpose\n"
},
{
"from": "gpt",
"value": "import socket\n\nUDP_IP = \"192.168.1.1\"\nUDP_PORT = 1234\nMESSAGE = \"Hello, World!\"\n\nprint \"UDP target IP:\", UDP_IP\nprint \"UDP target port:\", UDP_PORT\nprint \"message:\", MESSAGE\n\nsock = ... | python | chosen |
[
{
"from": "human",
"value": "Add some tests for the wiki markup.\n"
},
{
"from": "gpt",
"value": "# encoding: utf-8\n\nimport unittest\nimport ghmarkup\n\nclass test_ghmarkup(unittest.TestCase):\n def test_unadorned_text(self):\n self.assertEqual(\"<p>\\nfoo\\n</p>\", ghmarkup.ghmarkup(\"foo... | python | chosen |
[
{
"from": "human",
"value": "Add check script for WithHueAndSaturation\n"
},
{
"from": "gpt",
"value": "from __future__ import print_function, division\nimport imgaug as ia\nimport imgaug.augmenters as iaa\n\n\ndef main():\n image = ia.quokka_square(size=(128, 128))\n images = []\n\n fo... | python | chosen |
[
{
"from": "human",
"value": "Add script to find site-packages dirs.\n"
},
{
"from": "gpt",
"value": "import site\nfrom distutils.sysconfig import get_python_lib\n\nprint(\"Your main site-packages directory:\")\nprint(get_python_lib())\n\nprint\n\nprint(\"All global site-packages directories on y... | python | chosen |
[
{
"from": "human",
"value": "Add an examples directory to illustrate operator usage.\n"
},
{
"from": "gpt",
"value": "from opterator import opterate\n@opterate\ndef main(filename1, filename2, recursive=False, backup=False,\n suffix='~', *other_filenames):\n '''An example copy script wi... | python | chosen |
[
{
"from": "human",
"value": "Add Web tools: getHeader, getParticularClass, getLinks, errorHandling, bannerGrapper\n"
},
{
"from": "gpt",
"value": "import urllib, subprocess, random, re\nfrom bs4 import BeautifulSoup # http://www.crummy.com/software/BeautifulSoup/bs4/doc/#\nimport socket, struct... | python | chosen |
[
{
"from": "human",
"value": "Print installed packages in pytest\n"
},
{
"from": "gpt",
"value": "import os\nimport subprocess\nimport sys\n\n\ndef _is_pip_installed():\n try:\n import pip # NOQA\n return True\n except ImportError:\n return False\n\n\ndef _is_in_ci():\... | python | chosen |
[
{
"from": "human",
"value": "Add AWS poll for init complete plug-in.\n"
},
{
"from": "gpt",
"value": "import sys\nimport time\n\nfrom infrastructure.models import Server\nfrom jobs.models import Job\n\nTIMEOUT = 600\n\n\ndef is_reachable(server):\n \"\"\"\n :type server: Server\n \"\"\"... | python | chosen |
[
{
"from": "human",
"value": "Migrate product_template.cost_method to property (in stock_account)\n"
},
{
"from": "gpt",
"value": "# -*- coding: utf-8 -*-\n##############################################################################\n#\n# Author: Guewen Baconnier\n# Copyright 2014 Camptoc... | python | chosen |
[
{
"from": "human",
"value": "Add function to generate logarithmically spaced integers.\n"
},
{
"from": "gpt",
"value": "# encoding: utf-8\n\"\"\"\nMiscellaneous functions.\n\n\"\"\"\nfrom __future__ import division\n\nimport numpy as np\n\ndef logspace_int(limit, num=50):\n \"\"\"\n Return... | python | chosen |
[
{
"from": "human",
"value": "Automate initial seeding of user and oauth for development\n"
},
{
"from": "gpt",
"value": "from django.utils.timezone import now, timedelta\nfrom django.core.management.base import BaseCommand\nfrom datastore.models import *\nfrom django.contrib.auth.models import U... | python | chosen |
[
{
"from": "human",
"value": "Tests: Add simple test for `mde_reference_new_footnote` command\n\nStart to ensure not to break existing functions.\n"
},
{
"from": "gpt",
"value": "from MarkdownEditing.tests import DereferrablePanelTestCase\n\n\nclass TestMdeReferenceNewFootnoteCommand(Dereferrable... | python | chosen |
[
{
"from": "system",
"value": "Fix numbers in LO list.\n"
},
{
"from": "human",
"value": "from django.views import generic\nfrom django.contrib.auth.models import Group\n\nfrom django_countries.fields import Country\nfrom hosting.models import Profile, Place\nfrom hosting.utils import sort_by_nam... | python | chosen |
[
{
"from": "human",
"value": "Add example of usage of the simulation of 802.11\n"
},
{
"from": "gpt",
"value": "# Authors: CommPy contributors\n# License: BSD 3-Clause\n\nimport math\n\nimport matplotlib.pyplot as plt\nimport numpy as np\n\nimport commpy.channels as chan\n# ======================... | python | chosen |
[
{
"from": "human",
"value": "Add a simple test of one's h5py installation."
},
{
"from": "gpt",
"value": "\"\"\"\nSimple test of a parallel build of h5py (from h5py's documentation).\n\nhttp://h5py.readthedocs.org/en/latest/mpi.html#using-parallel-hdf5-from-h5py\n\nIf you've built h5py properly ... | python | chosen |
[
{
"from": "human",
"value": "Add oep user for wiki auth\n"
},
{
"from": "gpt",
"value": "# -*- coding: utf-8 -*-\n# Generated by Django 1.9.5 on 2016-08-05 11:11\nfrom __future__ import unicode_literals\n\nfrom django.db import migrations\n\n\nclass Migration(migrations.Migration):\n\n depend... | python | chosen |
[
{
"from": "human",
"value": "Add functions to read in message data and parse targets.\n"
},
{
"from": "gpt",
"value": "#! /usr/bin/python\n\nimport numpy as np\nimport os\nfrom sklearn import datasets\n\nMESSAGES_DIR = \"data/messages/\"\nJUDGMENTS_PATH = \"data/judgments/judgments.txt\"\n\ndef ... | python | chosen |
[
{
"from": "human",
"value": "Add a start for an ABC for the API"
},
{
"from": "gpt",
"value": "#!/usr/bin/env python\n\n\"\"\"\nThe APIRUS API as an Abstract Base Class\n\n\"\"\"\n\nfrom __future__ import absolute_import\nfrom __future__ import division\nfrom __future__ import print_function\nfr... | python | chosen |
[
{
"from": "system",
"value": "Fix loading root_target in migration\n\nMigrations don't allow accessing generic foreign keys, so we\nneed to load root_target manually.\n\nAlso:\n\n* add more logging\n* Bulk-update comments\n"
},
{
"from": "human",
"value": "from __future__ import unicode_literals... | python | chosen |
[
{
"from": "human",
"value": "Add test case to cover multiple future statements on separate lines of\na module.\n"
},
{
"from": "gpt",
"value": "from __future__ import nested_scopes\nfrom __future__ import division\nfrom __future__ import nested_scopes\n\ndef f(x):\n def g(y):\n return ... | python | chosen |
[
{
"from": "human",
"value": "Add initial code for starting Tor\n"
},
{
"from": "gpt",
"value": "import stem.process\n\ndef startTor(config):\n\tprocess = stem.process.launch_tor_with_config(config, take_ownership = True)\n\n\treturn process\n\ndef stopTor(process):\n\tif \"kil\" in dir(process):... | python | chosen |
[
{
"from": "human",
"value": "Change folder structure. Add Python folder\n"
},
{
"from": "gpt",
"value": "from __future__ import print_function\nfrom PIL import Image\n\ndef encode(image, string_to_encode):\n image_data = list(image.getdata())\n bin_string = \"\".join([\"{0:08b}\".format(or... | python | chosen |
[
{
"from": "human",
"value": "Add auto-link between User and Account models in migration\n"
},
{
"from": "gpt",
"value": "# -*- coding: utf-8 -*-\n# Generated by Django 1.10.5 on 2017-03-25 10:24\nfrom __future__ import unicode_literals\n\nfrom django.contrib.auth.models import User\nfrom django.... | python | chosen |
[
{
"from": "human",
"value": "Fix error message when expanding data asset\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: dan@reciprocityl... | python | chosen |
[
{
"from": "human",
"value": "Add very basic move plugin test\n"
},
{
"from": "gpt",
"value": "import pytest\n\n\n@pytest.mark.usefixtures('tmpdir')\nclass TestMove:\n config = \"\"\"\n tasks:\n test_move:\n mock:\n - title: a movie\n location... | python | chosen |
[
{
"from": "human",
"value": "Add helper tool to help with examining entries in a feed.\n"
},
{
"from": "gpt",
"value": "#!/usr/bin/python3\n# Copyright (c) 2016 Eric Eisenhart\n# This software is released under an MIT-style license.\n# See LICENSE.md for full details.\n\nimport sys\nimport pprin... | python | chosen |
[
{
"from": "human",
"value": "Add migration which no longer allows blank user representation fields\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 depe... | python | chosen |
[
{
"from": "human",
"value": "Add OpenStack Server facts module\n"
},
{
"from": "gpt",
"value": "#!/usr/bin/python\n\n# Copyright (c) 2014 Hewlett-Packard Development Company, L.P.\n#\n# This module is free software: you can redistribute it and/or modify\n# it under the terms of the GNU General P... | python | chosen |
[
{
"from": "human",
"value": "Add management command for forking Oscar's statics\n\nThis makes it easier for FEDs to get started styling a new Oscar\nproject. It copies all of Oscar's statics into a specified folder and\nchecks whether the new folder is in STATICFILES_DIRS.\n\nFixes #463\n"
},
{
"fr... | python | chosen |
[
{
"from": "human",
"value": "Add tests for Terminal when grammar is different so terminals should not be equal\n"
},
{
"from": "gpt",
"value": "#!/usr/bin/env python\n\"\"\"\n:Author Patrik Valkovic\n:Created 23.06.2017 16:39\n:Licence GNUv3\nPart of grammpy\n\n\"\"\"\nfrom unittest import TestC... | python | chosen |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.