conversations listlengths 2 3 | source stringclasses 1
value | stack stringclasses 1
value |
|---|---|---|
[
{
"from": "human",
"value": "Add some tests for the brocker\n"
},
{
"from": "gpt",
"value": "from circus.client import CircusClient\n\nfrom onitu.utils import get_circusctl_endpoint\n\nfrom tests.utils.testdriver import TestDriver\nfrom tests.utils.loop import BooleanLoop\n\n\ndef test_abort_if_... | python | chosen |
[
{
"from": "human",
"value": "Add a test demonstrating how to use the django global settings.\n"
},
{
"from": "gpt",
"value": "import unittest\n\nfrom django.conf import global_settings as default\n\nimport cbs\n\n\nclass MySettings:\n\n @property\n def INSTALLED_APPS(self):\n # Cust... | python | chosen |
[
{
"from": "human",
"value": "Add some simple tests for grib_keys auto-detection and user definition.\n"
},
{
"from": "gpt",
"value": "\nimport numpy as np\nimport pytest\nimport xarray as xr\n\nfrom cfgrib import xarray_store\n\n\n@pytest.fixture()\ndef canonic_dataarray():\n da = xr.DataArra... | python | chosen |
[
{
"from": "human",
"value": "Add a function to insert dummy data in the database\n"
},
{
"from": "gpt",
"value": "from math import sqrt\nfrom random import random\nimport database as db\nfrom database.model import Team, Members, Location\n\n\ndef make_dummy_data(num_teams, confirmed=True):\n ... | python | chosen |
[
{
"from": "human",
"value": "Update the foreign key on `game_stats.stat_id` to reference `stats.id` instead of `shows.id`\n\nCloses #250.\n"
},
{
"from": "gpt",
"value": "revision = '7c9bbf3a039a'\ndown_revision = '89c5cb66426d'\nbranch_labels = None\ndepends_on = None\n\nimport alembic\nimport ... | python | chosen |
[
{
"from": "system",
"value": "Add to_dict() method for faked resource\n\nWhen testing node_get with details, we expect the profile to return a\nresource that has a to_dict() method. The existing faked resource\ndoesn't support this yet. This patch fixes it.\n\nChange-Id: I52e0dad74a1140f8233280ff10a9c14ff17... | python | chosen |
[
{
"from": "human",
"value": "Add tests of deep copy\n"
},
{
"from": "gpt",
"value": "#!/usr/bin/env python\n\"\"\"\n:Author Patrik Valkovic\n:Created 20.08.2017 18:45\n:Licence GNUv3\nPart of grammpy\n\n\"\"\"\n\nfrom copy import deepcopy\nfrom unittest import TestCase, main\nfrom grammpy import... | python | chosen |
[
{
"from": "human",
"value": "Add some simple iptables managing functions\n\nThe most important of these is `ensure_chain` for creating and managing\nthe rules on an entire chain.\n"
},
{
"from": "gpt",
"value": "#!/usr/bin/env python2.7\nfrom __future__ import absolute_import\nfrom __future__ im... | python | chosen |
[
{
"from": "human",
"value": "Test Overlap not included before\n"
},
{
"from": "gpt",
"value": "# AUTO-GENERATED by tools/checkspecs.py - DO NOT EDIT\nfrom nipype.testing import assert_equal\nfrom nipype.algorithms.misc import Overlap\n\ndef test_Overlap_inputs():\n input_map = dict(bg_overlap... | python | chosen |
[
{
"from": "human",
"value": "Add migrations for protected attribute\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 ('users',... | python | chosen |
[
{
"from": "human",
"value": "Add a management command to reset your stream colors to the default.\n\n(imported from commit f6891ad40088bf34686a7d8a2d910a9a0f3be7c2)\n"
},
{
"from": "gpt",
"value": "from django.core.management.base import BaseCommand\nfrom zephyr.models import StreamColor, UserPr... | python | chosen |
[
{
"from": "human",
"value": "Add random versions of series_functions\n"
},
{
"from": "gpt",
"value": "import numpy as np\n\nfrom simulator.series_functions import SinSeries, ConstantSeries\n\nclass RandomSinSeries(SinSeries):\n AMPLITUDE_LOW = 1.0\n AMPLITUDE_HIGH = 10.0\n FREQUENCY_LOW... | python | chosen |
[
{
"from": "human",
"value": "Add migration for RawDataVersion/File options, rcptcd.tran_type field options\n"
},
{
"from": "gpt",
"value": "# -*- coding: utf-8 -*-\n# Generated by Django 1.11 on 2017-04-21 18:21\nfrom __future__ import unicode_literals\n\nimport calaccess_raw.annotations\nimport... | python | chosen |
[
{
"from": "human",
"value": "Add hacky script for anonymising dumps of the Scrobbles table whilst still maintaining internal consistency"
},
{
"from": "gpt",
"value": "#!/usr/bin/env python\nimport random\n\ns = open(\"scrobbledump.sql\", \"r\")\no = open(\"scrobbles.anonymous.sql\", \"w\")\n\nd... | python | chosen |
[
{
"from": "human",
"value": "Add traversal lib to utils\n"
},
{
"from": "gpt",
"value": "# -*- coding: utf-8 -*-\n'''\nTraversal algorithms, used to traverse data stuctures such as can be found in\ndatbase documents\n'''\nDEFAULT_TARGET_DELIM = ':'\n\n\ndef traverse_dict_and_list(data, key, defa... | python | chosen |
[
{
"from": "human",
"value": "Add simulation script for ClaimChain in Autocrypt mode\n"
},
{
"from": "gpt",
"value": "import pickle\nimport logging\n\nfrom parseMaildir import Email\n\nlogging.basicConfig(level=logging.INFO) # Set to .DEBUG for gory details\n\n# Parse the pickles generated by pa... | python | chosen |
[
{
"from": "human",
"value": "Add test for faster fastforwarded\n"
},
{
"from": "gpt",
"value": "# System imports\nimport os\nfrom os.path import join\n\nfrom git import *\nfrom nose.tools import *\n\nfrom PyGitUp.tests import basepath, init_master, update_file\n\ntest_name = 'faster-forwarded'\n... | python | chosen |
[
{
"from": "human",
"value": "Define IPv4_validation and IPv6_validation method\n"
},
{
"from": "gpt",
"value": "#!/usr/bin/env python\n# -*- coding: utf-8 -*-\n\n# Copyright (C) 2011 Adriano Monteiro Marques\n#\n# Author: Amit Pal <amix.pal@gmail.com>\n#\n# This program is free software: you can... | python | chosen |
[
{
"from": "human",
"value": "Return the districts name by distance given coordinates\n"
},
{
"from": "gpt",
"value": "\n# coding: utf-8\n\n# In[79]:\n\nimport math\nimport operator\nimport json\nfrom geopy.distance import great_circle\n\n\n# In[90]:\n\nclass Order_districts():\n \n def get... | python | chosen |
[
{
"from": "human",
"value": "Implement TRIPS ontology manager with trips_isa\n"
},
{
"from": "gpt",
"value": "import os\nfrom indra.preassembler.hierarchy_manager import HierarchyManager\n\n# Make a TRIPS ontology\n_fname = os.path.join(os.path.dirname(__file__), 'trips_ontology.rdf')\ntrips_ont... | python | chosen |
[
{
"from": "human",
"value": "Add a test for loading file over a URL (dap)\n"
},
{
"from": "gpt",
"value": "#!python\n# coding=utf-8\nimport unittest\n\nfrom pocean.cf import CFDataset\nfrom pocean.dsg import OrthogonalMultidimensionalTimeseries as omt\n\nimport logging\nfrom pocean import logger... | python | chosen |
[
{
"from": "human",
"value": "Add some methods to log system calls\n"
},
{
"from": "gpt",
"value": "#!/usr/bin/env python3\n\nimport sys\nimport os\nimport logging\nimport subprocess\n\n# get the root handler to update his behavior (No prefix, no endline)\nlogger = logging.getLogger()\n\n\ndef lo... | python | chosen |
[
{
"from": "human",
"value": "Add invoke file for releases\n"
},
{
"from": "gpt",
"value": "import os\nimport subprocess\nimport currint\nfrom invoke import task\n\n\nVERSION_FILE = os.path.join(os.path.dirname(currint.__file__), \"__init__.py\")\n\n\ndef _write_to_version_file(version):\n wit... | python | chosen |
[
{
"from": "human",
"value": "Add script to generate cmake files\n"
},
{
"from": "gpt",
"value": "import os\nimport subprocess\n\n\ndef main():\n root_path = os.path.dirname(__file__)\n\n cmd = ['cmake',\n '-G', 'Visual Studio 15 2017 Win64',\n root_path]\n\n subproce... | python | chosen |
[
{
"from": "human",
"value": "Add test unit to check for matching md -> page\n"
},
{
"from": "gpt",
"value": "from os import walk\nimport os\nimport unittest\n\n\nclass MdTestCase(unittest.TestCase):\n def test_articles(self):\n for (dirpath, dirnames, filenames) in walk(\"md\"):\n ... | python | chosen |
[
{
"from": "human",
"value": "Update translations (for internal test project, cms itself has none)\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 depen... | python | chosen |
[
{
"from": "human",
"value": "Implement async test framework for the server\n"
},
{
"from": "gpt",
"value": "# -*- coding: utf-8\n\nimport json\nimport random\nimport string\nimport tornado.gen\nimport tornado.testing\nimport tornado.web\nimport tornado.websocket\n\nfrom sidecar.connection import... | python | chosen |
[
{
"from": "human",
"value": "Make fileup installable and callable with 'fu fname_here.py'\n"
},
{
"from": "gpt",
"value": "from setuptools import setup\n\nsetup(name='fileup',\n version=0.1,\n description='Easily upload files to an FTP-server and get back the url.',\n url='https:/... | python | chosen |
[
{
"from": "system",
"value": "Include uuid module as req (for older python versions) and mark zip_safe as False\n"
},
{
"from": "human",
"value": "#!/usr/bin/env python\n\nfrom setuptools import setup, find_packages\n\nsetup(\n name='django-uuidfield',\n version=\".\".join(map(str, __impor... | python | chosen |
[
{
"from": "system",
"value": "Add a [yaml] extra installer\n"
},
{
"from": "human",
"value": "#!/usr/bin/env python\n\"\"\"\njinja2-cli\n==========\n\n.. code:: shell\n\n $ jinja2 helloworld.tmpl data.json --format=json\n $ cat data.json | jinja2 helloworld.tmpl\n $ curl -s http://httpbin.org... | python | chosen |
[
{
"from": "human",
"value": "Add a test to show global variables and to verify that they do display as having\nglobal scopes.\n\n\ngit-svn-id: b33bab8abb5b18c12ee100cd7761ab452d00b2b0@107522 91177308-0d34-0410-b5e6-96231b3b80d8\n"
},
{
"from": "gpt",
"value": "\"\"\"Show global variables and che... | python | chosen |
[
{
"from": "human",
"value": "Add a migration for the `people` app\n"
},
{
"from": "gpt",
"value": "# -*- coding: utf-8 -*-\n# Generated by Django 1.9.6 on 2016-05-07 10:07\nfrom __future__ import unicode_literals\n\nfrom django.db import migrations, models\n\n\nclass Migration(migrations.Migrati... | python | chosen |
[
{
"from": "human",
"value": "Add a Python based documentation generator, which requires libxml2 and libxlst.\n\n"
},
{
"from": "gpt",
"value": "#!/usr/bin/env python\n# -*- coding: utf-8 -*-\n\nimport optparse\nimport os\n\nimport libxml2\nimport libxslt\n\ndef generate_documentation(src_file, d... | python | chosen |
[
{
"from": "human",
"value": "Add script for sending reminders\n"
},
{
"from": "gpt",
"value": "import json\nimport urllib2\nimport time\n\nfrom django.conf import settings\nfrom django.core.management.base import BaseCommand\nfrom django.utils import translation\n\nfrom events.models import Even... | python | chosen |
[
{
"from": "human",
"value": "Add a \"test\" for dials.reciprocal_lattice_viewer\n"
},
{
"from": "gpt",
"value": "def test_gltbx_is_available():\n \"\"\"\n This is not a real test for dials.rlv, which is slightly difficult to write.\n However, one common error mode is that the gltbx libr... | python | chosen |
[
{
"from": "human",
"value": "Add migration for Strain.reference TreeForeignKey\n"
},
{
"from": "gpt",
"value": "# -*- coding: utf-8 -*-\n# Generated by Django 1.11.6 on 2017-10-17 12:57\nfrom __future__ import unicode_literals\n\nfrom django.db import migrations\nimport django.db.models.deletion... | python | chosen |
[
{
"from": "human",
"value": "Add a demo of finding outliers, to be used in the sensor code (since we sometimes get out-of-the-way returns)\n"
},
{
"from": "gpt",
"value": "#!python3\nimport statistics\n\n#\n# Explanation from: http://www.wikihow.com/Calculate-Outliers\n#\n\nnumbers = [1.0, 2.0, ... | python | chosen |
[
{
"from": "human",
"value": "Add a United States PTIN module\n\nA Preparer Tax Identification Number (PTIN) is United States\nidentification number for tax return preparers. It is an eight-digit\nnumber prefixed with a capital P.\n"
},
{
"from": "gpt",
"value": "# ptin.py - functions for handlin... | python | chosen |
[
{
"from": "human",
"value": "Add migration to create voluntary_work table\n"
},
{
"from": "gpt",
"value": "\"\"\"Create `voluntary_work` table\n\nRevision ID: 63875fc6ebe\nRevises: 7d1ccd9c523\nCreate Date: 2014-02-09 13:49:24.946138\n\n\"\"\"\n\n# revision identifiers, used by Alembic.\nrevisio... | python | chosen |
[
{
"from": "human",
"value": "Create python script to generate svg from json reports\n"
},
{
"from": "gpt",
"value": "\"\"\"Generates a SVG by parsing json report.\n\nTask dependencyUpdates generates a json report. This script parses that file and\ngenerates a SVG showing percentage of up-to-date... | python | chosen |
[
{
"from": "human",
"value": "Introduce HadesSetupError and HadesUsageError for restart prevention\n"
},
{
"from": "gpt",
"value": "import functools\nimport logging\nimport os\nimport sys\nimport typing as t\nfrom contextlib import contextmanager\nfrom logging import Logger\n\n\nRESTART_PREVENTIN... | python | chosen |
[
{
"from": "human",
"value": "Add script to download paper from arxiv\n"
},
{
"from": "gpt",
"value": "import sys\nimport os\nimport bs4\nimport urllib2\nimport urllib\nBASE_URL = \"http://arxiv.org\"\nHEP_URL = 'http://arxiv.org/abs/hep-th/%d'\n\n# TODO: Change prints to logs\n\n\ndef get_pdf(pa... | python | chosen |
[
{
"from": "human",
"value": "Add test for missing migrations\n\ngh-122\n"
},
{
"from": "gpt",
"value": "\"\"\"\nTests that migrations are not missing\n\"\"\"\n\ntry:\n from io import StringIO\nexcept ImportError:\n from StringIO import StringIO\n\nimport pytest\n\nfrom django.core.manageme... | python | chosen |
[
{
"from": "human",
"value": "Add skeleton for plotting split.\n"
},
{
"from": "gpt",
"value": "\"\"\"\n========================================\nThe :mod:`array_split.split_plot` Module\n========================================\n\nUses :mod:`matplotlib` to plot a split.\n\nClasses and Functions\... | python | chosen |
[
{
"from": "human",
"value": "Add first, simple TVLA command test\n\nSigned-off-by: Andreas Kurth <62c4a7f75976b7a2fb8d79afddaccc3e9236aad5@lowrisc.org>\n"
},
{
"from": "gpt",
"value": "# Copyright lowRISC contributors.\n# Licensed under the Apache License, Version 2.0, see LICENSE for details.\n... | python | chosen |
[
{
"from": "human",
"value": "Add basic bluetooth support for salt\n"
},
{
"from": "gpt",
"value": "'''\nSupport for Bluetooth (using Bluez in Linux)\n'''\n\nimport salt.utils\nimport salt.modules.service\n\n\ndef __virtual__():\n '''\n Only load the module if bluetooth is installed\n ''... | python | chosen |
[
{
"from": "human",
"value": "Add unit tests for u2flib_host.utils\n"
},
{
"from": "gpt",
"value": "# coding=utf-8\n\nfrom u2flib_host.utils import (\n u2str,\n websafe_encode,\n websafe_decode,\n H,\n)\n\n\ndef test_u2str():\n data1 = {\n u'greeting_en': u'Hello world',\n ... | python | chosen |
[
{
"from": "human",
"value": "Add a tool info module for Deagle\n"
},
{
"from": "gpt",
"value": "# This file is part of BenchExec, a framework for reliable benchmarking:\n# https://github.com/sosy-lab/benchexec\n#\n# SPDX-FileCopyrightText: 2007-2020 Dirk Beyer <https://www.sosy-lab.org>\n#\n# SP... | python | chosen |
[
{
"from": "human",
"value": "Break out merging addresses and buildings.\n"
},
{
"from": "gpt",
"value": "# Merge addresses into buildings they intersect with\n\nfrom fiona import collection\nfrom rtree import index\nfrom shapely.geometry import asShape, Point, LineString\nfrom shapely import spe... | python | chosen |
[
{
"from": "human",
"value": "Add management command to export all user meails\n"
},
{
"from": "gpt",
"value": "import csv\nfrom django.core.management.base import BaseCommand\nfrom astrobin.models import UserProfile\n\n\nclass Command(BaseCommand):\n help = \"Export all user emails to a CSV f... | python | chosen |
[
{
"from": "human",
"value": "Add script to run all tests\n"
},
{
"from": "gpt",
"value": "\"\"\"Run all unit tests.\"\"\"\n\nimport glob\nimport os\nimport sys\nimport unittest\n\ndef main():\n test_dir = os.path.dirname(os.path.abspath(__file__))\n test_files = glob.glob(os.path.join(test... | python | chosen |
[
{
"from": "human",
"value": "Add coverage for init function.\n"
},
{
"from": "gpt",
"value": "from mock import Mock\n\nimport ubersmith\n\n\ndef it_sets_default_request_handler(monkeypatch):\n set_handler_mock = Mock()\n monkeypatch.setattr(ubersmith, 'set_default_request_handler',\n ... | python | chosen |
[
{
"from": "human",
"value": "Add unit tests for inode.\n\nSigned-off-by: Chris Lalancette <281cd07d7578d97c83271fbbf2faddb83ab3791c@openrobotics.org>\n"
},
{
"from": "gpt",
"value": "from __future__ import absolute_import\n\nimport pytest\nimport os\nimport sys\ntry:\n from cStringIO import S... | python | chosen |
[
{
"from": "human",
"value": "Add script for displaying jacobian as a matrix.\n"
},
{
"from": "gpt",
"value": "import climate\nimport lmj.cubes\nimport lmj.plot\nimport numpy as np\n\n\n@lmj.cubes.utils.pickled\ndef jacobian(root, pattern, frames):\n trial = list(lmj.cubes.Experiment(root).tri... | python | chosen |
[
{
"from": "system",
"value": "Move Pillow to the last version\n"
},
{
"from": "human",
"value": "try:\n from setuptools import setup\n kw = {'entry_points':\n \"\"\"[console_scripts]\\nglue = glue:main\\n\"\"\",\n 'zip_safe': False}\nexcept ImportError:\n from distutil... | python | chosen |
[
{
"from": "system",
"value": "Add homepage url to sitemap.xml\n"
},
{
"from": "human",
"value": "\nfrom django.contrib.sitemaps import Sitemap\nfrom django.db.models import get_models\n\nfrom mezzanine.conf import settings\nfrom mezzanine.core.models import Displayable\n\nblog_installed = \"mezz... | python | chosen |
[
{
"from": "system",
"value": "Upgrade taskcluster client for nice slugids\n\nThis fixes e.g. this failure:\n * https://tools.taskcluster.net/task-inspector/#2AAxnGTzSeGLTX_Hwp_PVg/\ndue to the TaskGroupId starting with a '-', by upgrading taskcluster\nclient. From version 0.0.26 of python taskcluster clien... | python | chosen |
[
{
"from": "human",
"value": "Add usage example as a python file\n"
},
{
"from": "gpt",
"value": "from pandarus import *\nimport geopandas as gpd\nimport rasterio\nimport os\nimport json\nfrom pprint import pprint\n\n# Get filepaths of data used in tests\ngrid_fp = os.path.join('..', 'tests', 'da... | python | chosen |
[
{
"from": "human",
"value": "Add MBTA provider test cases\n"
},
{
"from": "gpt",
"value": "import busbus\nfrom busbus.provider.mbta import MBTAProvider\nfrom .conftest import mock_gtfs_zip\n\nimport arrow\nimport pytest\nimport responses\n\n\n@pytest.fixture(scope='module')\n@responses.activate\... | python | chosen |
[
{
"from": "human",
"value": "Add test for adding piece to board.\n"
},
{
"from": "gpt",
"value": "from board import Board\n\ndef test_addPiece():\n print(\"Testing adding a piece.\")\n \n board = Board(5,5)\n board.addPiece(0, 1)\n assert board.boardMatrix.item(0,4) == 1\n"
}
] | python | chosen |
[
{
"from": "human",
"value": "Add analysis code for GC simulations.\n"
},
{
"from": "gpt",
"value": "\"\"\"Analyze direct (grand canonical) simulations.\"\"\"\n\nfrom __future__ import division\nimport os.path\n\nimport numpy as np\nfrom scipy.optimize import fsolve\n\nfrom coex.read import read_... | python | chosen |
[
{
"from": "human",
"value": "Test case from Levitt figure 4\n"
},
{
"from": "gpt",
"value": "from UpDownMethods import CORRECT, INCORRECT\nimport UpDownMethods as ud\nimport numpy as np\nimport matplotlib.pyplot as plt\nimport unittest\n\n#\n# Simulation parameters\n#\n\nresponses = [CORRECT, CO... | python | chosen |
[
{
"from": "human",
"value": "Add tools for getting models and tools repos\n\nThese are patterned on @mcflugen's \"components.py\" --\nhttps://github.com/csdms/wmt/blob/master/server/wmt/installer/components\n.py.\n"
},
{
"from": "gpt",
"value": "import os, shutil\nimport urllib\nimport zipfile\n... | python | chosen |
[
{
"from": "human",
"value": "Add tests for Flights To\n"
},
{
"from": "gpt",
"value": "import unittest\nimport datetime\nimport json\nimport sys\n\nsys.path.append('..')\nimport sabre_dev_studio\nimport sabre_dev_studio.sabre_exceptions as sabre_exceptions\n\n'''\nrequires config.json in the sam... | python | chosen |
[
{
"from": "human",
"value": "Add test for NumPyPrinter regression\n"
},
{
"from": "gpt",
"value": "from sympy import Piecewise\nfrom sympy.abc import x\nfrom sympy.printing.lambdarepr import NumPyPrinter\n\n\ndef test_numpy_piecewise_regression():\n \"\"\"\n NumPyPrinter needs to print Pie... | python | chosen |
[
{
"from": "human",
"value": "Add script for generating native wrappers\n\nThe script helps you see what arguments are passed to native functions\nin [stack] trace. It takes an include file as input and outputs code\nsimilar to:\n\nstock _print(const string[]) {\n\treturn print(string);\n}\n\nfor each native... | python | chosen |
[
{
"from": "human",
"value": "Add script to generate NYC examples\n"
},
{
"from": "gpt",
"value": "\"\"\"\nGenerate example images for GeoPandas documentation.\n\nTODO: autogenerate these from docs themselves\n\nKelsey Jordahl\nTime-stamp: <Sun Jul 7 17:31:12 IST 2013>\n\"\"\"\nimport numpy as n... | python | chosen |
[
{
"from": "human",
"value": "Add test case for hello plugin\n"
},
{
"from": "gpt",
"value": "from p1tr.test import *\n\nclass HelloTest(PluginTestCase):\n\n @test\n def hello_test(self):\n for data in self.dummy_data:\n self.assertEqual(self.plugin.hello(data.server, data... | python | chosen |
[
{
"from": "human",
"value": "Allow Notify service to send international sms\n\nRight now Notify restricts you to registering with a UK mobile number.\nThis is because when we built the user registration stuff we couldn’t\nsend to international mobiles.\n\nHowever we can send to international mobile numbers,... | python | chosen |
[
{
"from": "human",
"value": "Add CronJob class; appears to turn cron-job line into proper data (no weekday/month name aliasing yet)\n"
},
{
"from": "gpt",
"value": "import re\nfrom parsers import Parse\n\nclass CronJob(object):\n def __init__(self, line):\n # matches five fields separa... | python | chosen |
[
{
"from": "human",
"value": "Add command for S3 CORS configuration.\n\nTo be run on app startup or manually.\n\n[Resolves https://github.com/eregs/notice-and-comment/issues/57]\n"
},
{
"from": "gpt",
"value": "import boto3\nfrom django.conf import settings\nfrom django.core.management.base impor... | python | chosen |
[
{
"from": "human",
"value": "Add a conversion script to turn CSV into Lua table.\n"
},
{
"from": "gpt",
"value": "# Convert a CSV file to a Lua table script that can be imported using `dofile`.\n\nimport csv\n\ndef csv2lua(in_file, out_file, global_name):\n fp_in = open(in_file, 'r')\n row... | python | chosen |
[
{
"from": "human",
"value": "Add commands to run tagger server and tag using python.\n"
},
{
"from": "gpt",
"value": "from fabric.operations import local\n\ndef runserver():\n local(\"java -jar stagger/stagger.jar -modelfile models/swedish.bin -server 127.0.0.1 9000\")\n\ndef tag(filename):\n... | python | chosen |
[
{
"from": "system",
"value": "Attach category menu to CMSApp\n"
},
{
"from": "human",
"value": "# -*- coding: utf-8 -*-\nfrom cms.app_base import CMSApp\nfrom cms.apphook_pool import apphook_pool\nfrom django.utils.translation import ugettext_lazy as _, get_language\nfrom .menu import BlogCatego... | python | chosen |
[
{
"from": "human",
"value": "Load sub-classes without using explicit names\n"
},
{
"from": "gpt",
"value": "from pkgutil import iter_modules\nfrom pathlib import Path\nfrom importlib import import_module\n\nfrom transformations.SentenceTransformation import SentenceTransformation\n\n\ndef load(m... | python | chosen |
[
{
"from": "human",
"value": "Add tests for genson expression\n"
},
{
"from": "gpt",
"value": "import genson\n\n\ndef test_unary():\n\n g = genson.loads('{ \"p\" : sin(-1) } ')\n assert( g['p'].args[0] == -1)\n\n g = genson.loads('{ \"p\" : sin(+1) } ')\n assert( g['p'].args[0] == 1)\... | python | chosen |
[
{
"from": "human",
"value": "Add a test for \"from __future__ import ..\"\n"
},
{
"from": "gpt",
"value": "from __future__ import generator_stop\n\n\n\nfrom : keyword.control.flow.python, source.python\n : source.python\n__future__ : source.python, support.variable.magic... | python | chosen |
[
{
"from": "human",
"value": "Add python script to balance the line length in some text\n\nUseful to find the optimal newline placement in titles that have\nwrapped to balance the line length, for instance:\n\n\"This is a long long title that is just ever so slightly longer than one\nline.\"\n\nBecomes:\n\n\... | python | chosen |
[
{
"from": "human",
"value": "Add initial tests for discovery\n"
},
{
"from": "gpt",
"value": "\"\"\"\nTest discovering of registered languages and generators.\n\"\"\"\nimport subprocess\n\n\ndef test_list_languages_cli():\n \"\"\"\n Test list-languages command.\n \"\"\"\n output = su... | python | chosen |
[
{
"from": "human",
"value": "Add script to save liwc categories + words to elasticsearch\n\nAdded a script that saves the liwc categories + their words to\nelasticsearch. The liwc dictionary is saved in the type entitycategory,\nwith fields 'name', 'words'. This data is saved in order to be able to\nget an ... | python | chosen |
[
{
"from": "human",
"value": "Add 'one script to go' support\n"
},
{
"from": "gpt",
"value": "#!/usr/bin/env python\n#\n# Windows Azure Linux Agent setup.py\n#\n# Copyright 2013 Microsoft Corporation\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may not use this f... | python | chosen |
[
{
"from": "human",
"value": "Add a test script for model_utils"
},
{
"from": "gpt",
"value": "from __future__ import absolute_import\nfrom __future__ import print_function\nfrom keras.models import Sequential, Graph\nfrom keras.layers.core import Layer, Activation, Dense, Flatten, Reshape, Merge... | python | chosen |
[
{
"from": "human",
"value": "Add unit tests for C version of\n"
},
{
"from": "gpt",
"value": "#! /usr/bin/env python\n#\n# Tests for the C 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 shutil\nf... | python | chosen |
[
{
"from": "human",
"value": "Add script to calculate annotation statistics\n\nAdded a script that counts the number of annotated entities and\nemotional vs. non-emotional sentences.\n"
},
{
"from": "gpt",
"value": "\"\"\"Count the numbers of annotated entities and emotional sentences in the\ncor... | python | chosen |
[
{
"from": "human",
"value": "Add unit tests for gauge config\n\n Add test coverage for https://github.com/faucetsdn/faucet/issues/1441\n"
},
{
"from": "gpt",
"value": "#!/usr/bin/env python3\n\n\"\"\"Test config parsing\"\"\"\n\nimport logging\nimport os\nimport shutil\nimport tempfile\nimpor... | python | chosen |
[
{
"from": "human",
"value": "Add new and missing colleges.\n"
},
{
"from": "gpt",
"value": "# -*- coding: utf-8 -*-\nfrom __future__ import unicode_literals\n\nfrom django.db import models, migrations\n\ndef add_colleges(apps, schema_editor):\n College = apps.get_model('clubs', 'College')\n ... | python | chosen |
[
{
"from": "human",
"value": "Add draft submission tags form\n"
},
{
"from": "gpt",
"value": "from django import forms\nfrom django.utils.translation import ugettext as _\n\nfrom apps.core.models import Tag\nfrom .models import SubmissionProcess\n\n\nclass SubmissionTagsForm(forms.ModelForm):\n\n... | python | chosen |
[
{
"from": "human",
"value": "Add a test of using non-default hyperparameter for each optimizer implementation\n"
},
{
"from": "gpt",
"value": "import unittest\n\nimport six\n\nimport chainer\nfrom chainer import optimizers\nfrom chainer import testing\n\n\n@testing.parameterize(*testing.product(... | python | chosen |
[
{
"from": "human",
"value": "Add URL scheme for votes app\n"
},
{
"from": "gpt",
"value": "from django.conf.urls import include, url\n\nfrom django.views.generic import TemplateView\n\nfrom votes.views import VoteView\n\nurlpatterns = [\n url(r'^(?P<vote_name>[\\w-]+)$', VoteView.as_view()),\... | python | chosen |
[
{
"from": "human",
"value": "Implement a command to expunge old UserMessages and Messages from the database\n\n(imported from commit a4873dfa8737c483411d12f30daaebebebf859f9)\n"
},
{
"from": "gpt",
"value": "from django.core.management.base import BaseCommand\nfrom zephyr.retention_policy im... | python | chosen |
[
{
"from": "human",
"value": "Convert pcm files to wav files.\n"
},
{
"from": "gpt",
"value": "#!/usr/bin/env python\n\nimport re\nimport os\nimport sys\nimport wave\n\nif len(sys.argv) != 2:\n print \"Usage:%s pcm file\" % (sys.argv[0])\n print \"A wave will be created use same name. For e... | python | chosen |
[
{
"from": "human",
"value": "Test the pipeline code for genome indexing\n"
},
{
"from": "gpt",
"value": "\"\"\"\n.. Copyright 2017 EMBL-European Bioinformatics Institute\n\n Licensed under the Apache License, Version 2.0 (the \"License\");\n you may not use this file except in compliance wit... | python | chosen |
[
{
"from": "human",
"value": "Use asyncio_mongo for the server\n"
},
{
"from": "gpt",
"value": "import os\nimport asyncio\nimport logging\n\nimport tornado.web\nimport tornado.httpserver\nimport tornado.platform.asyncio\nfrom tornado.options import define\nfrom tornado.options import options\n\ni... | python | chosen |
[
{
"from": "human",
"value": "Load npz files and dump them to a pickle\n"
},
{
"from": "gpt",
"value": "\"\"\"\nLoad all the results and configuration data from directories containing\nmultiple .npz files and save them in a pickle. Strict data structure is\nassumed, as created from DataGenTaskFar... | python | chosen |
[
{
"from": "human",
"value": "Test of the old bookmarked links being redirected\n"
},
{
"from": "gpt",
"value": "\"\"\"Test old search links work.\n\ne.g: /report?q=dnstwister.report goes to /search/dnstwister.report\n\"\"\"\n\n\ndef test_redirect(webapp):\n \"\"\"Test we can redirect.\"\"\"\n... | python | chosen |
[
{
"from": "human",
"value": "Add February 2021 letter rates\n\nAll rates are changing, so we add an end date for the current rates and\ninsert new rates for every post_class, sheet count and crown status.\n"
},
{
"from": "gpt",
"value": "\"\"\"\n\nRevision ID: 0341_new_letter_rates\nRevises: 034... | python | chosen |
[
{
"from": "human",
"value": "Add module to set up plots for journally output\n"
},
{
"from": "gpt",
"value": "import numpy as np\nimport matplotlib\nfrom matplotlib import rcParams\nfrom matplotlib.backends.backend_pgf import FigureCanvasPgf\nmatplotlib.backend_bases.register_backend('pdf', Figu... | python | chosen |
[
{
"from": "human",
"value": "Add a script to use the pic.py module\n"
},
{
"from": "gpt",
"value": "from pic import Picture\nfrom path import Path\nimport argparse, json\nparser = argparse.ArgumentParser(\n description=\n \"Process the picture or the directory, given the json config file\"... | python | chosen |
[
{
"from": "human",
"value": "Add support for Dropbox and Google Drive\n"
},
{
"from": "gpt",
"value": "#!/usr/bin/env python\nimport json\nimport sys\nimport urllib2\n\ndef get_url(url):\n req = urllib2.Request(url)\n return urllib2.urlopen(req).fp.read()\n\ndef download_url(url, file_name... | python | chosen |
[
{
"from": "human",
"value": "Add solution to lintcode question 184\n"
},
{
"from": "gpt",
"value": "class Solution:\n #@param num: A list of non negative integers\n #@return: A string\n def largestNumber(self, num):\n # write your code here\n def quickSort(arr):\n ... | python | chosen |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.