conversations listlengths 2 3 | source stringclasses 1
value | stack stringclasses 1
value |
|---|---|---|
[
{
"from": "human",
"value": "Add metas information for the package\n"
},
{
"from": "gpt",
"value": "\"\"\"django-livereload\"\"\"\n__version__ = '0.1.dev'\n__license__ = 'BSD License'\n\n__author__ = 'Fantomas42'\n__email__ = 'fantomas42@gmail.com'\n\n__url__ = 'https://github.com/Fantomas42/dja... | python | chosen |
[
{
"from": "system",
"value": "Put candidate score in field object\n"
},
{
"from": "human",
"value": "import scrapy\nfrom realclearpolitics.items import TableItem\n\nclass RcpSpider(scrapy.Spider):\n name = \"realclearpoliticsSpider\"\n start_urls = []\n\n def __init__(self, url, state_c... | python | chosen |
[
{
"from": "human",
"value": "Add simple echo server test app\n"
},
{
"from": "gpt",
"value": "import sys\nimport socket\nimport select\nfrom papa.utils import cast_string\n\n__author__ = 'Scott Maxwell'\n\nif len(sys.argv) != 2:\n sys.stderr.write('Need one file descriptor\\n')\n sys.exit(... | python | chosen |
[
{
"from": "system",
"value": "Add populatedb admin creation test\n"
},
{
"from": "human",
"value": "import pytest\nfrom mock import Mock\n\nfrom saleor.core.utils import (\n Country, get_country_by_ip, get_currency_for_country)\n\n\n@pytest.mark.parametrize('ip_data, expected_country', [\n ... | python | chosen |
[
{
"from": "human",
"value": "Add tests for command stacking\n"
},
{
"from": "gpt",
"value": "# Copyright (c) 2016, LE GOFF Vincent\n# All rights reserved.\n\n# Redistribution and use in source and binary forms, with or without\n# modification, are permitted provided that the following condition... | 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\ndef test_numpy_piecewise_regression():\n \"\"\"\n NumPyPrinter needs to print Piece... | python | chosen |
[
{
"from": "human",
"value": "Add integration tests for VirtualService and DestinationRule\n"
},
{
"from": "gpt",
"value": "import os\nimport pytest\nimport subprocess\nfrom .common import random_str\nfrom .conftest import cluster_and_client, ClusterContext\n\nkube_fname = os.path.join(os.path.di... | python | chosen |
[
{
"from": "human",
"value": "Add tool for removing need for TrafficInjection backwards compatibility\n"
},
{
"from": "gpt",
"value": "#!/usr/bin/env python\n\nimport argparse\nimport os\nimport sys\n\nsys.path.append(os.path.join(os.path.dirname(__file__), \"..\"))\nimport sts.replay_event as re... | python | chosen |
[
{
"from": "human",
"value": "Add a test for module.attribute\n"
},
{
"from": "gpt",
"value": "from pymetabiosis.module import import_module\nfrom pymetabiosis.wrapper import MetabiosisWrapper\n\ndef test_getattr_on_module():\n sqlite = import_module(\"sqlite\")\n assert isinstance(sqlite, ... | python | chosen |
[
{
"from": "human",
"value": "Add admin form for password reset to limit to staff.\n"
},
{
"from": "gpt",
"value": "from django.contrib.auth.forms import PasswordResetForm\n\n\nclass PasswordResetForm(PasswordResetForm):\n \"\"\"\n An extended Password reset form designed for staff users.\n... | python | chosen |
[
{
"from": "human",
"value": "Add Newton-Raphson polynomial approximation problem\n"
},
{
"from": "gpt",
"value": "#!/Applications/anaconda/envs/Python3/bin\n\ndef main():\n # X^2 - 1\n p_1 = (-1, 0, 1)\n r_1 = newton_raphson(p_1)\n print('Polynomial {} has root of {}'.format(print_po... | python | chosen |
[
{
"from": "human",
"value": "Add better decorator for testing\n"
},
{
"from": "gpt",
"value": "from flask import abort, current_app, request\nfrom functools import wraps\nfrom twilio.util import RequestValidator\n\nimport os\n\n\ndef validate_twilio_request(f):\n \"\"\"Validates that incoming... | python | chosen |
[
{
"from": "human",
"value": "Solve Code Fights strings rearrangement problem\n"
},
{
"from": "gpt",
"value": "#!/usr/local/bin/python\n# Code Fights Cracking Password Problem\n\nimport itertools\n\n\ndef stringsRearrangement(inputArray):\n\n def f(x, y):\n c = 0\n for i in range... | python | chosen |
[
{
"from": "human",
"value": "Index of zero to get longest 1s\n"
},
{
"from": "gpt",
"value": "import unittest\n\"\"\"\nGiven an array of 0s and 1s, find the position of 0 to be replaced with 1 to get longest contiguous\nsequence of 1s.\nInput: 1 1 0 0 1 0 1 1 1 0 1 1 1\nOutput: index 9\nInput: 1... | python | chosen |
[
{
"from": "system",
"value": "Test verifying that CrawlerRunner populates spider class settings\n"
},
{
"from": "human",
"value": "import warnings\nimport unittest\n\nfrom scrapy.crawler import Crawler\nfrom scrapy.settings import Settings\nfrom scrapy.utils.spider import DefaultSpider\nfrom scr... | python | chosen |
[
{
"from": "human",
"value": "Add a command to delete all objects from PopIt\n"
},
{
"from": "gpt",
"value": "import json\n\nfrom candidates.models import PopItPerson\nfrom candidates.popit import PopItApiMixin, get_base_url\n\nfrom django.core.management.base import BaseCommand\n\nclass Command(... | python | chosen |
[
{
"from": "human",
"value": "Add stand-alone demo of pulsating LED using multiprocess.\n"
},
{
"from": "gpt",
"value": "'''\n\nDr Who Box: Blue Effects LED\n\n'''\n\nfrom __future__ import print_function\nimport RPi.GPIO as GPIO\nimport time\nfrom multiprocessing import Process\nimport math\n\n#... | python | chosen |
[
{
"from": "human",
"value": "Add Edit Distance DP Algorithm\n"
},
{
"from": "gpt",
"value": "\"\"\"\nAuthor : Turfa Auliarachman\nDate : October 12, 2016\n\nThis is a pure Python implementation of Dynamic Programming solution to the edit distance problem.\n\nThe problem is :\nGiven two strin... | python | chosen |
[
{
"from": "human",
"value": "Add basic config functionality and stubs for MockNode, MockDB, as well as different resizing methods, access patterns and eviction strategies.\n"
},
{
"from": "gpt",
"value": "'''\n- a way to separate entries by key to know which machine to store it at\n- eviction st... | python | chosen |
[
{
"from": "human",
"value": "TST: Add some smoke tests for x12/x13\n"
},
{
"from": "gpt",
"value": "from nose import SkipTest\nfrom numpy.testing import assert_\n\nfrom statsmodels.tsa.base.datetools import dates_from_range\nfrom statsmodels.tsa.x12 import _find_x12, select_arima_order\n\nx13pat... | python | chosen |
[
{
"from": "system",
"value": "Initialize TPU_ML_PLATFORM env variable with `Tensorflow`.\n\nPiperOrigin-RevId: 474832980\n"
},
{
"from": "human",
"value": "# Copyright 2017 The TensorFlow Authors. All Rights Reserved.\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you... | python | chosen |
[
{
"from": "human",
"value": "Increase test coverage for corner cases.\n"
},
{
"from": "gpt",
"value": "\"\"\"Additional tests for the caster to ensure full code coverage.\n\"\"\"\nimport pytest\ndef test_corner():\n from aflow.caster import cast\n assert cast(\"numbers\", \"spinD\", None) ... | python | chosen |
[
{
"from": "human",
"value": "Add transition method for legacy databases\n"
},
{
"from": "gpt",
"value": "from django.core.management.base import BaseCommand, CommandError\nfrom sqlalchemy.orm.session import sessionmaker\nfrom api.connection import _get_engine\nfrom dataedit.models import Table\n... | python | chosen |
[
{
"from": "human",
"value": "Add a script to remove trailing whitespace from a file.\n\nTypical usage:\n Tools/remove-trailing-whitespace.py Foo.h\nor:\n find SurgSim \\( -name '*.h' -o -name '*.cpp' \\) -print \\\n | xargs python Tools/remove-trailing-whitespace.py\n"
},
{
"from": "gpt",
"... | python | chosen |
[
{
"from": "human",
"value": "Create class to hold regions of data\n"
},
{
"from": "gpt",
"value": "class DataRegion:\n def __init__(self):\n self.data = []\n\n def addTimeData(self, data_time, data_value):\n self.data.append((data_time, data_value))\n\n def isTimeInRegion(... | python | chosen |
[
{
"from": "human",
"value": "Add migration that deletes old statscontent objects from homepage\n"
},
{
"from": "gpt",
"value": "# -*- coding: utf-8 -*-\n# Generated by Django 1.11.15 on 2020-07-17 08:37\nfrom __future__ import unicode_literals\n\nfrom django.core.exceptions import ObjectDoesNotE... | python | chosen |
[
{
"from": "human",
"value": "Add register and CPU stuff\n"
},
{
"from": "gpt",
"value": "class Register(object):\n def __init__(self, name, bitwidth):\n self.name = name\n self.value = 0\n self.past = [0] # maybe for rewind?\n self.symbVal = [z3.BitVec(self.name, b... | python | chosen |
[
{
"from": "human",
"value": "Add manual job triggering script.\n\nChange-Id: Ic396c845e5f61a98d3b0e8c3fc08c6f9dbfffc6a\nReviewed-on: https://review.openstack.org/34437\nReviewed-by: Jeremy Stanley <98883b97e35b7bb1ac282bb863f2e9d917db0454@yuggoth.org>\nApproved: Clark Boylan <635fc31d01fa593720982fa0568e871... | python | chosen |
[
{
"from": "human",
"value": "Add manafement command to Sync RemoteRepositories and RemoteOrganizations\n"
},
{
"from": "gpt",
"value": "from django.contrib.auth.models import User\nfrom django.core.management.base import BaseCommand\n\nfrom readthedocs.oauth.tasks import sync_remote_repositories... | python | chosen |
[
{
"from": "human",
"value": "Remove temp doc download service perms\n\nWe added a service permission to gate the new document download security\nfeatures. Now that these have been released, let's remove the\npermission.\n"
},
{
"from": "gpt",
"value": "\"\"\"\n\nRevision ID: 0378_remove_doc_down... | python | chosen |
[
{
"from": "human",
"value": "Test script for evaluating momentum conservation\n\ngit-svn-id: 0c14c15b0cdbdea73634a2d7d7d743954bb0522f@3197 fa922fa7-2fde-0310-acd8-f43f465a7996\n"
},
{
"from": "gpt",
"value": "#! /usr/bin/env hoomd\n\nfrom hoomd_script import *\n\ninit.create_random(N=10000, phi_... | python | chosen |
[
{
"from": "human",
"value": "Add stub for python client\n"
},
{
"from": "gpt",
"value": "import requests\n\nr = requests.get('http://localhost:8081/monitor_results/1')\nprint(r.json())\nfor monitoring_data in r.json():\n print 'URL: ' + monitoring_data['urlToMonitor']['url']\n"
}
] | python | chosen |
[
{
"from": "human",
"value": "Add metaclass and class for CEnumeration adoption.\n"
},
{
"from": "gpt",
"value": "from ctypes import c_int\n\n\nclass EnumerationType(type(c_int)):\n def __new__(metacls, name, bases, dictionary):\n if not \"_members_\" in dictionary:\n _member... | python | chosen |
[
{
"from": "human",
"value": "Implement auto generate db postings\n"
},
{
"from": "gpt",
"value": "from random_words import RandomWords\nfrom faker import Factory\nimport random\nimport sqlite3\n\nNUM_GENERATE = 100\n\nCATEGORIES = ['miscellaneous', 'appliance', 'bedding', 'toys', 'books', 'cloth... | python | chosen |
[
{
"from": "human",
"value": "Add the script to plot band structures with bandwidths\n"
},
{
"from": "gpt",
"value": "#!/usr/bin/env python\n# -*- coding: utf-8 -*-\nfrom __future__ import (absolute_import, division,\n print_function, unicode_literals)\n\n__author__ = \"Yuj... | python | chosen |
[
{
"from": "human",
"value": "Add migration script for [citations]nodesettings\n <provider>_list_id --> list_id\n"
},
{
"from": "gpt",
"value": "import logging\nimport sys\n\nfrom modularodm import Q\n\nfrom framework.mongo import database\nfrom framework.transactions.context import TokuTransa... | python | chosen |
[
{
"from": "human",
"value": "Add unit tests for basic role stuff\n"
},
{
"from": "gpt",
"value": "import pytest\n\n\n@pytest.fixture\ndef mockctl(testdir):\n testdir.makepyfile(mockctl=\"\"\"\n import mock\n pytest_plugins = 'sangoma.lab.roles'\n\n def pytest_lab_addroles... | python | chosen |
[
{
"from": "human",
"value": "Add a wrapper around llvm-objdump to look for indirect calls/jmps in x86 assembly.\n\nUseful when looking for indirect calls/jmps the need mitigation\nvia retpoline or other mitigations for Spectre v2.\n\nFeedback, extension, additional patches welcome.\n\ngit-svn-id: 0ff597fd15... | python | chosen |
[
{
"from": "human",
"value": "Add in migration for ManagedItem, MangementSource.\n"
},
{
"from": "gpt",
"value": "# Generated by Django 2.1.4 on 2019-02-02 15:20\n\nfrom django.db import migrations, models\nimport django.db.models.deletion\nimport ulid2\n\n\nclass Migration(migrations.Migration):... | python | chosen |
[
{
"from": "human",
"value": "Add test to study the change in inclination only\n"
},
{
"from": "gpt",
"value": "import numpy as np\n\nfrom astropy import units as u\n\nfrom poliastro.bodies import Earth\nfrom poliastro.twobody import State\nfrom poliastro.twobody.propagation import cowell\nfrom p... | python | chosen |
[
{
"from": "human",
"value": "Add very basic handling of options\n"
},
{
"from": "gpt",
"value": "#!/usr/bin/env python\n\nimport sys\nimport argparse\n\ndef _description():\n return 'A C preprocessor that interprets python'\n\n\"\"\" The usage\n\n We do override the usage since the one giv... | python | chosen |
[
{
"from": "human",
"value": "Add initial script for calculating cell areas\n"
},
{
"from": "gpt",
"value": "\"\"\"Script to calculate cell areas from a curated image of cell outlines.\n\nOutputs csv file with cell areas as well as an image where the colour\nof each cell represents its area.\n\"\... | python | chosen |
[
{
"from": "human",
"value": "Add python folder with a rest-test-file\n"
},
{
"from": "gpt",
"value": "import urllib\nimport urllib2\n\nurl = 'http://app.dev.inowas.com/api/results.json'\nparams = urllib.urlencode({\n 'id': '1',\n 'propertyType': 'gwHead',\n 'width': 4,\n 'height': 4,... | python | chosen |
[
{
"from": "human",
"value": "Add PMT time slewing example\n"
},
{
"from": "gpt",
"value": "# -*- coding: utf-8 -*-\n\"\"\"\n\n==================\nPMT Time Slewing\n==================\n\nShow different variants of PMT time slewing calculations.\n\nVariant 3 is currently (as of 2020-10-16) what's ... | python | chosen |
[
{
"from": "human",
"value": "Add solution for test problem\n"
},
{
"from": "gpt",
"value": "#!/usr/bin/env python3\n# -*- coding: utf-8 -*- \n\n# Copyright 2014 Fabian M.\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": "TEST - new test file added for propagation\n"
},
{
"from": "gpt",
"value": "import numpy as np\nimport dipy as dp\nimport nibabel as ni\n\nfrom nose.tools import assert_true, assert_false, \\\n assert_equal, assert_raises\n\nfrom numpy.testing import assert_array... | python | chosen |
[
{
"from": "human",
"value": "Add inventory script for LXC containers\n\nEnables an LXC server's configuration as an inventory source for LXC\ncontainers.\n\nIn LXC, containers can be defined with an \"lxc.group\" configuration\noption that is normally used with lxc-autostart -g. Here, we are using\nthe same... | python | chosen |
[
{
"from": "human",
"value": "Add test for command parsing, without executing\n"
},
{
"from": "gpt",
"value": "from string import ascii_letters\n\nimport pytest\n\nfrom nex.codes import CatCode\nfrom nex.instructions import Instructions\nfrom nex.instructioner import (Instructioner,\n ... | python | chosen |
[
{
"from": "human",
"value": "[lldb][NFC] Add test for invalid gui command\n\ngit-svn-id: 4c4cc70b1ef44ba2b7963015e681894188cea27e@370647 91177308-0d34-0410-b5e6-96231b3b80d8\n"
},
{
"from": "gpt",
"value": "import lldb\nfrom lldbsuite.test.lldbtest import *\nfrom lldbsuite.test.decorators import... | python | chosen |
[
{
"from": "human",
"value": "Check if a glideinFactory is running\n"
},
{
"from": "gpt",
"value": "#!/bin/env python\n#\n# Description:\n# Check if a glideinFactory is running\n# \n# Arguments:\n# $1 = glidein submit_dir (i.e. factory dir)\n#\n# Author:\n# Igor Sfiligoi Jul 9th 2008\n#\n\n... | python | chosen |
[
{
"from": "human",
"value": "Create a ros node for storing, replaying a robot's position\n"
},
{
"from": "gpt",
"value": "#!/usr/bin/env python\n\n'''\nCopyright 2016 William Baskin\n\n/*****************************************\n LICENSE SUMMARY\n\n This package is licensed under the\n MIT Li... | python | chosen |
[
{
"from": "human",
"value": "example: Add example of downloading a package\n"
},
{
"from": "gpt",
"value": "#!/usr/bin/env python\n\n\"\"\"\nlibrepo - download a package\n\"\"\"\n\nimport os\nimport sys\nimport shutil\nfrom pprint import pprint\n\nimport librepo\n\nDESTDIR = \"downloaded_metadat... | python | chosen |
[
{
"from": "human",
"value": "Add migration for fixing bad CA names\n\nThis migration removes all assessment template custom attribute\ndefinition names that match any of the assessment global custom\nattributes.\n\nResolves: GGRC-26, GGRC-111\n"
},
{
"from": "gpt",
"value": "# Copyright (C) 2016... | python | chosen |
[
{
"from": "human",
"value": "Add tests for Tafseer Views\n"
},
{
"from": "gpt",
"value": "from django.test import TestCase\nfrom django.urls import reverse\nfrom model_mommy import mommy\n\n\nclass TestTafsserViews(TestCase):\n def setUp(self):\n self.sura = mommy.make('quran_text.sura... | python | chosen |
[
{
"from": "human",
"value": "Add script to query vertica stats\n"
},
{
"from": "gpt",
"value": "import sys\nimport argparse\nfrom subprocess import Popen, PIPE\n\n\ndef parse_args():\n parser = argparse.ArgumentParser()\n parser.add_argument(\"--vertica_password\",\n ... | python | chosen |
[
{
"from": "human",
"value": "Add example with a manual_report decorator/context manager that can be used to easily measure the time of functions/code blocks and manually report them as stats entries to the Locust statistics"
},
{
"from": "gpt",
"value": "\"\"\"\nExample of a manual_report() func... | python | chosen |
[
{
"from": "human",
"value": "Add creator_id migration for streams\n"
},
{
"from": "gpt",
"value": "\"\"\"Add a creator_id to streams\n\nRevision ID: 1f8e3cf51fbc\nRevises: 70c7d046881\nCreate Date: 2013-12-08 16:55:14.142000\n\n\"\"\"\n\n# revision identifiers, used by Alembic.\nrevision = '1f8e... | python | chosen |
[
{
"from": "human",
"value": "Add crawler for 'Yet Another Fantasy Gamer Comic'\n"
},
{
"from": "gpt",
"value": "from comics.crawler.base import BaseComicCrawler\nfrom comics.crawler.meta import BaseComicMeta\n\nclass ComicMeta(BaseComicMeta):\n name = 'Yet Another Fantasy Gamer Comic'\n la... | python | chosen |
[
{
"from": "human",
"value": "Add simple tools for creating metadata\n"
},
{
"from": "gpt",
"value": "#! /usr/bin/env python\n\nimport os\nimport sys\nimport json\nimport clstm\nimport shutil\n\nfrom kraken.lib.models import load_clstm\n\nrnn = load_clstm(sys.argv[1])\n\nalphabet = []\ncls = clst... | python | chosen |
[
{
"from": "human",
"value": "Add test to ensure kubernetes client threadpool is cleaned up\n"
},
{
"from": "gpt",
"value": "# coding: utf-8\n\n\nimport atexit\nimport weakref\nimport unittest\n\nimport kubernetes\n\n\nclass TestApiClient(unittest.TestCase):\n\n def test_context_manager_closes... | python | chosen |
[
{
"from": "human",
"value": "Set 1 - Challenge 1\n"
},
{
"from": "gpt",
"value": "#!/usr/bin/env python\n\nimport codecs\n\n\ndef hex_2_b64(s):\n return codecs.encode(codecs.decode(s, 'hex'), 'base64').decode()\n\n\nif __name__ == '__main__':\n print(hex_2_b64(\"49276d206b696c6c696e6720796f... | python | chosen |
[
{
"from": "human",
"value": "Add missing migration for Template\n"
},
{
"from": "gpt",
"value": "# -*- coding: utf-8 -*-\n# Generated by Django 1.10.4 on 2016-12-29 20:36\nfrom __future__ import unicode_literals\n\nfrom django.db import migrations, models\n\n\nclass Migration(migrations.Migratio... | python | chosen |
[
{
"from": "human",
"value": "Add a viewer for the Allied Vision camera using OpenCV.\n"
},
{
"from": "gpt",
"value": "#! /usr/bin/env python\n# -*- coding:utf-8 -*-\n\n#\n# Test application to display live images from an Allied Vision camera using OpenCV 3\n#\n\n# External dependencies\nimport c... | python | chosen |
[
{
"from": "system",
"value": "Use zip_safe=False, as suggested by Stephan Richter.\n"
},
{
"from": "human",
"value": "#!/usr/bin/python\nfrom os.path import isfile, join\nimport glob\nimport os\nimport re\n\nfrom setuptools import setup\n\n\nif isfile(\"MANIFEST\"):\n os.unlink(\"MANIFEST\")\... | python | chosen |
[
{
"from": "human",
"value": "Install sqlalchemy, add nba game model\n"
},
{
"from": "gpt",
"value": "from sqlalchemy import Column, Integer, Float, String\nfrom sqlalchemy.ext.declarative import declarative_base\n\nBase = declarative_base()\n\nclass NbaGame(Base):\n __tablename__ = 'nba_game'... | python | chosen |
[
{
"from": "human",
"value": "Enforce non TestCase usage under `tests/nts`\n"
},
{
"from": "gpt",
"value": "# -*- coding: utf-8 -*-\n\"\"\"\n tests.nts.conftest\n ~~~~~~~~~~~~~~~~~~\n\"\"\"\nimport pathlib\n\nimport pytest\nfrom tests.support.runtests import RUNTIME_VARS\nfrom tests.support... | python | chosen |
[
{
"from": "human",
"value": "Test update and delete actions\n"
},
{
"from": "gpt",
"value": "import pytest\nfrom mock import patch\n\nfrom currencycloud import Client, Config\nfrom currencycloud.http import Http\nfrom currencycloud.resources.resource import Resource\nfrom currencycloud.resources... | python | chosen |
[
{
"from": "system",
"value": "Use HTTPS URL for repository.\n"
},
{
"from": "human",
"value": "#!/usr/bin/env python\nfrom distutils.core import setup\nimport os\n\ndef read(fname):\n return open(os.path.join(os.path.dirname(__file__), fname)).read()\n\n\nsetup(\n name='facebook-sdk',\n ... | python | chosen |
[
{
"from": "system",
"value": "Allow other_paths to be passed into TraceViewerProject\n\nThis allows external embedders to subclass TraceViewerProject and thus\nuse trace viewer."
},
{
"from": "human",
"value": "# Copyright (c) 2014 The Chromium Authors. All rights reserved.\n# Use of this source... | python | chosen |
[
{
"from": "human",
"value": "Add test for verifying archive contents.\n"
},
{
"from": "gpt",
"value": "from json import load\n\nfrom django_archive import __version__\n\nfrom .base import BaseArchiveTestCase\nfrom .sample.models import Sample\n\n\nclass ArchiveTestCase(BaseArchiveTestCase):\n ... | python | chosen |
[
{
"from": "human",
"value": "Rename instance_info_cache unique key constraints.\n\nRename (via drop and recreate) the instance_uuid unique\nconstraints on the instance_info_cache table so they reflect\nthe column change name (UUID conversion) we complete in Folsom.\n\nFixes LP Bug #1080837.\n\nChange-Id: I9... | python | chosen |
[
{
"from": "human",
"value": "Add tests with mocked http responses\n"
},
{
"from": "gpt",
"value": "import httpretty\n\nfrom bvg_cli import BVG_URL\nfrom bvg_cli import request_departures, request_station_ids\n\nfrom html_dumps import DEPARTURE_HTML, STATION_HTML\n\n\n@httpretty.activate\ndef tes... | python | chosen |
[
{
"from": "human",
"value": "Move utilities to separate file\n"
},
{
"from": "gpt",
"value": "\"\"\"\nUtility classes and funcitons for template mathcing framework.\n\"\"\"\n\nclass BoundingBox(object):\n\n def __init__(self, lr, ul):\n\n self.lrx = lr[0]\n self.lry = lr[1]\n ... | python | chosen |
[
{
"from": "human",
"value": "Add basic tests for main.py\n\nNeeds to be updated as main.py becomes complete.\n"
},
{
"from": "gpt",
"value": "\"\"\"\ntest_main.py - Tests for main.py\n\nmain.py:\nhttp://www.github.com/samjabrahams/anchorhub/main.py\n\"\"\"\n\nimport anchorhub.main as main\n\n\nd... | python | chosen |
[
{
"from": "human",
"value": "Add unit tests for device size setters and getters.\n"
},
{
"from": "gpt",
"value": "\nimport unittest\n\nfrom blivet.devices import StorageDevice\nfrom blivet import errors\nfrom blivet.formats import getFormat\nfrom blivet.size import Size\n\nclass StorageDeviceSiz... | python | chosen |
[
{
"from": "human",
"value": "Add a git hook script that will list all duplicate files within the directories specified\n"
},
{
"from": "gpt",
"value": "from os import walk\nfrom os.path import join\nfrom argparse import ArgumentParser\n\nif __name__ == \"__main__\":\n parser = ArgumentParser(... | python | chosen |
[
{
"from": "human",
"value": "Add make python portable script.\n"
},
{
"from": "gpt",
"value": "'''Module that when called from the command line will go through all\nfiles in the Scripts directory of the current python and will change the\npython path hardcoded in these files from a full python p... | python | chosen |
[
{
"from": "human",
"value": "Revert \"Remove WildCard module. Functionality is already available in glob. Not sure why\"\n\nThis reverts commit 44502648df007fd32d5818f2ac0d1df98d9b4550.\n"
},
{
"from": "gpt",
"value": "# coding: utf-8\n\"\"\"This module provides support for Unix shell-style wild... | python | chosen |
[
{
"from": "human",
"value": "Add utility to remove limit warnings.\n"
},
{
"from": "gpt",
"value": "#!/usr/bin/env python\n\n\"\"\"\nUtility to remove limit warnings from Filter API output.\n\nIf --warnings was used, you will have the following in output:\n{\"limit\": {\"track\": 2530, \"timesta... | python | chosen |
[
{
"from": "human",
"value": "Add an endless turn demo.\n"
},
{
"from": "gpt",
"value": "#!/usr/bin/env python3\n# -*- coding: utf-8 -*-\n\n# PyAX-12\n\n# The MIT License\n#\n# Copyright (c) 2010,2015,2017 Jeremie DECOCK (http://www.jdhp.org)\n#\n# Permission is hereby granted, free of charge, to... | python | chosen |
[
{
"from": "human",
"value": "Test minimal package import functionality\n\nOk, it's not really minimal, but it's one way to be sure, that the\npackage actually exists, is importable and some of it's exported things\nare accessible.\n"
},
{
"from": "gpt",
"value": "from nose.tools import ok_\n\nim... | python | chosen |
[
{
"from": "human",
"value": "Add a very simple test writing script\n"
},
{
"from": "gpt",
"value": "#!/usr/bin/env blender\n\nimport sys\nimport os\n\nimport bpy\nimport addon_utils\n\ndef _main(args):\n print(\"Writing\", args)\n\n default, state = addon_utils.check(\"io_EDM\")\n if not stat... | python | chosen |
[
{
"from": "human",
"value": "Document work in fixing movies table\n"
},
{
"from": "gpt",
"value": "#!/usr/bin/python\n\n# we've been outputting stuff to text so now I get to wedge it into a database\n# funtimes\n\n# set up the database with `sqlite3 netflix_genres.sqlite < create_tables.sql`\n\n... | python | chosen |
[
{
"from": "human",
"value": "Add readability grapher for brown corpus\n"
},
{
"from": "gpt",
"value": "from feature import simple\nimport graph\n\nfrom nltk.corpus import brown\n\n\ndef calc_readability(corpus):\n texts = []\n results = []\n for fileid in corpus.fileids():\n sent... | python | chosen |
[
{
"from": "human",
"value": "Decrypt a previously encrypted image"
},
{
"from": "gpt",
"value": "import requests\nimport json\n\n# Decrypt a previously encrypted image using the passphrase 'superpass'\n# https://pixlab.io/#/cmd?id=encrypt && https://pixlab.io/#/cmd?id=decrypt\n\n# Password used ... | python | chosen |
[
{
"from": "human",
"value": "Include Levitt figure 4 test\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#\n# Simulation parameters\n#\n\nresponses = [CORRECT, CO... | python | chosen |
[
{
"from": "human",
"value": "Add solution for 155 min stack. (tooooooo slow)\n"
},
{
"from": "gpt",
"value": "class MinStack(object):\n def __init__(self):\n \"\"\"\n initialize your data structure here.\n \"\"\"\n self._s = []\n self.t = len(self._s)-1\n ... | python | chosen |
[
{
"from": "human",
"value": "Add API tests for policy type list/show\n\nAdd API tests for policy type list/show\n\nChange-Id: I0d14727264491bbb6a9a668246fc267ab2245611\n"
},
{
"from": "gpt",
"value": "# Licensed under the Apache License, Version 2.0 (the \"License\"); you may\n# not use this fil... | python | chosen |
[
{
"from": "human",
"value": "Create master engagement data file and append old engagement records\n\nGoing forward, learner engagement downloads will be appended to a master\nfile. This commit adds a script I wrote to create a master file for each\ncourse and append existing engagement records.\n"
},
{
... | python | chosen |
[
{
"from": "human",
"value": "Add simple data extraction for the ATLAS and CMS compressed files\n"
},
{
"from": "gpt",
"value": "__author__ = 'jacob'\nimport tarfile\nimport glob\nimport os\n\natlas_filenames = glob.iglob(os.path.join(\"data\", \"atlas\", \"*.tgz\"))\ncms_filenames = glob.iglob(o... | python | chosen |
[
{
"from": "human",
"value": "Add a general REST API class\n"
},
{
"from": "gpt",
"value": "import os\nimport urllib.request\n\nclass RESTAPI(object):\n\n \"\"\"A general class that handles the local file access or the\n retrival of tha file.\n\n \"\"\"\n\n def _get_data(self, path_te... | python | chosen |
[
{
"from": "human",
"value": "Add tests for results finder.\n"
},
{
"from": "gpt",
"value": "# Case Conductor is a Test Case Management system.\n# Copyright (C) 2011-12 Mozilla\n#\n# This file is part of Case Conductor.\n#\n# Case Conductor is free software: you can redistribute it and/or modify\... | python | chosen |
[
{
"from": "human",
"value": "ENH: Add Xdmf Python Test that writes values to an XdmfArray\n"
},
{
"from": "gpt",
"value": "import Xdmf\nfrom Xdmf import *\n\nif __name__ == '__main__': \n array = Xdmf.XdmfArray()\n array.SetNumberType(Xdmf.XDMF_INT64_TYPE)\n assert(array.GetNumberType... | python | chosen |
[
{
"from": "human",
"value": "Add utility for calling functions across threads directly\n\n"
},
{
"from": "gpt",
"value": "try:\n import queue\nexcept ImportError:\n import Queue as queue\nfrom .future import Future\nfrom . import Qt\n\n\ndef runInThread(thread, func, *args, **kwds):\n \... | python | chosen |
[
{
"from": "human",
"value": "Add CustomUser user model named Hacker.\n"
},
{
"from": "gpt",
"value": "import re\nfrom django.conf import settings\nfrom django.contrib.auth.models import AbstractBaseUser, PermissionsMixin, UserManager\nfrom django.core import validators\nfrom django.core.mail imp... | python | chosen |
[
{
"from": "human",
"value": "Add HTTP2 error code registry\n"
},
{
"from": "gpt",
"value": "# -*- coding: utf-8 -*-\n\"\"\"\nhyper/http20/error_code_registry\n~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\n\nGlobal error code registry containing the established HTTP/2 error codes.\nThe registry is based on a... | python | chosen |
[
{
"from": "human",
"value": "Add the UUID template-tag that generate the UUID\n"
},
{
"from": "gpt",
"value": "# -*- coding: utf-8 -*-\n# \n# File: uuid.py\n# Author: Kenson Man <kenosn.idv.hk@gmail.com>\n# Desc: The template-tag used to generate a uuid into output.\n# Sample:\n# {%uuid%} ... | python | chosen |
[
{
"from": "human",
"value": "Add filter field to users (migration).\n"
},
{
"from": "gpt",
"value": "\"\"\"Add filter field to users.\n\nRevision ID: fa7e12c88c5\nRevises: 2325abc7de81\nCreate Date: 2015-10-13 21:06:15.875359\n\n\"\"\"\n\n# revision identifiers, used by Alembic.\nrevision = 'fa7... | python | chosen |
[
{
"from": "human",
"value": "Add a test for -- terminating option processing.\n\n\n"
},
{
"from": "gpt",
"value": "#!/usr/bin/env python\n\n__revision__ = \"test/option-n.py __REVISION__ __DATE__ __DEVELOPER__\"\n\nimport TestCmd\nimport os.path\nimport string\nimport sys\n\ntest = TestCmd.TestC... | python | chosen |
[
{
"from": "human",
"value": "Add example script for piecewise affine transform\n"
},
{
"from": "gpt",
"value": "\"\"\"\n===============================\nPiecewise Affine Transformation\n===============================\n\nThis example shows how to use the Piecewise Affine Transformation.\n\"\"\"\... | python | chosen |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.