conversations listlengths 2 3 | source stringclasses 1
value | stack stringclasses 1
value |
|---|---|---|
[
{
"from": "system",
"value": "Test case: _check_max_active method to check both scenarios\n"
},
{
"from": "human",
"value": "import unittest\nfrom liveblog.blogs.blogs import BlogService\nfrom superdesk.errors import SuperdeskApiError\n\nclass BlogsTestCase(unittest.TestCase):\n\n def setUp(s... | python | chosen |
[
{
"from": "system",
"value": "Set the stride to scale\n"
},
{
"from": "human",
"value": "\"\"\"Example experiment.\"\"\"\nfrom functools import partial\n\nfrom toolbox.data import load_set\nfrom toolbox.models import compile\nfrom toolbox.models import fsrcnn\nfrom toolbox.experiment import FSRC... | python | chosen |
[
{
"from": "system",
"value": "tests/member_access: Make {index.key}_access into Hypothesis tests\n"
},
{
"from": "human",
"value": "import pytest # type: ignore\n\nfrom ppb_vector import Vector\n\n\n@pytest.fixture()\ndef vector():\n return Vector(10, 20)\n\n\ndef test_class_member_access(ve... | python | chosen |
[
{
"from": "system",
"value": "Remove code to force ENABLE_ASYNCIO to False\n\nForcing ENABLE_ASYNCIO to False was interfering\nwith testing under async drivers when the\n(third-party dialect) test suite included both\nSQLAlchemy and Alembic tests.\n\nChange-Id: I2fe40049c24ba8eba0a10011849a912c03aa381e\n"
... | python | chosen |
[
{
"from": "system",
"value": "Add logic for displaying help if no args are specified.\n"
},
{
"from": "human",
"value": "\"\"\" A simple CLI tool for quickly copying common emoticon/emoji to your\nclipboard. \"\"\"\nimport pyperclip\nimport json\nimport sys\nimport argparse\n\nwith open(\"mappin... | python | chosen |
[
{
"from": "system",
"value": "Add ProxyFix() middleware component to fix the HTTPS redirection issue. See !17\n"
},
{
"from": "human",
"value": "from flask import Flask\nfrom flask.ext.login import LoginManager\nfrom flask.ext.sqlalchemy import SQLAlchemy\n\napp = Flask(__name__)\napp.config.fro... | python | chosen |
[
{
"from": "system",
"value": "Revert \"Roll to version 0.3.0\"\n\nThis reverts commit d98b62b366317a6188a743912ee6feea035e998b.\n"
},
{
"from": "human",
"value": "\n#!/usr/bin/env python\n# encoding: utf-8\n\"\"\"\ntempodb/setup.py\n\nCopyright (c) 2012 TempoDB Inc. All rights reserved.\n\"\"\"\... | python | chosen |
[
{
"from": "system",
"value": "Add missing email validation during initial setup\n"
},
{
"from": "human",
"value": "# This file is part of Indico.\n# Copyright (C) 2002 - 2019 CERN\n#\n# Indico is free software; you can redistribute it and/or\n# modify it under the terms of the MIT License; see t... | python | chosen |
[
{
"from": "system",
"value": "Add BaseMiddleware to vumi.middleware API for 3rd-party middleware that wants to support both transports and applications.\n"
},
{
"from": "human",
"value": "\"\"\"Middleware classes to process messages on their way in and out of workers.\n\"\"\"\n\nfrom vumi.middle... | python | chosen |
[
{
"from": "system",
"value": "Fix python 3 support for exec\n"
},
{
"from": "human",
"value": "import sys # Used to get rid of py2/3 differences\n\n# Blatantly stolen from the excellent `six` library\n# Allows the same calls between python2 and python3\nif sys.version_info[0] == 3:\n exec_ = ... | python | chosen |
[
{
"from": "system",
"value": "Define 'city' at top decorator\n"
},
{
"from": "human",
"value": "from functools import wraps\n\nfrom django.http import HttpResponseNotFound\nfrom django.shortcuts import redirect\n\nfrom core.utils import get_event_page\n\n\ndef organiser_only(function):\n \"\"... | python | chosen |
[
{
"from": "system",
"value": "Allow ignored params to Elasticsearch\n"
},
{
"from": "human",
"value": "# -*- coding: utf-8 -*-\n\nfrom functools import wraps\n\nfrom mock import patch\n\nfrom elasticmock.fake_elasticsearch import FakeElasticsearch\n\nELASTIC_INSTANCES = {}\n\n\ndef _get_elasticm... | python | chosen |
[
{
"from": "system",
"value": "Change verbose name of Layout Page to ‘Page’ for simplicity.\n"
},
{
"from": "human",
"value": "from . import abstract_models\n\nclass LayoutPage(abstract_models.AbstractLayoutPage):\n\n class Meta:\n verbose_name = \"Layout page\"\n # Fluent prepen... | python | chosen |
[
{
"from": "system",
"value": "Check we get some sane XML back\n\nSigned-off-by: Chris Lamb <711c73f64afdce07b7e38039a96d2224209e9a6c@chris-lamb.co.uk>\n"
},
{
"from": "human",
"value": "from takeyourmeds.utils.test import TestCase\n\nfrom ..enums import TypeEnum, SourceEnum\n\nfrom .enums import... | python | chosen |
[
{
"from": "system",
"value": "Update supported currencies in gateways, set default currency for dummy gateway\n"
},
{
"from": "human",
"value": "import warnings\nfrom typing import TYPE_CHECKING, List\n\nfrom django.conf import settings\n\nif TYPE_CHECKING:\n from ..interface import GatewayCo... | python | chosen |
[
{
"from": "system",
"value": "Allow some blank fields in Booki model from search\n"
},
{
"from": "human",
"value": "\n# Imports #####################################################################\n\nfrom haystack import indexes\n\nfrom .models import Book\n\n\n# Classes #######################... | python | chosen |
[
{
"from": "system",
"value": "Use parent 'post' function to actually send message\n"
},
{
"from": "human",
"value": "from __future__ import absolute_import\nimport logging\n\nfrom .telegram import TelegramBot\n\n\nlogger = logging.getLogger(__name__)\n\n\nclass TelegramBotSplit(TelegramBot):\n ... | python | chosen |
[
{
"from": "system",
"value": "Improve general classes with input from Ilan Ellison Moyer's thesis\n"
},
{
"from": "human",
"value": "# -*- coding: utf-8 -*-\n\n# Import\n\n# Import for changing the Python Path for importing Gestalt\nimport sys\nimport os\n\n# Change the Python Path\nbase_dir = o... | python | chosen |
[
{
"from": "system",
"value": "Change imports of helper functions\n\nThese are now in the utils app\n"
},
{
"from": "human",
"value": "#!/usr/bin/env python\nimport os\nimport sys\n\nfrom django.core.management import execute_from_command_line\n\nfrom wger.main import get_user_config_path, setup_... | python | chosen |
[
{
"from": "system",
"value": "Add tests for period_intersect logic"
},
{
"from": "human",
"value": "from datetime import date\n\nfrom ..period_utils import get_month_shift, get_periods\n\n\ndef test_get_month_shift_handles_december():\n new_month, _ = get_month_shift(12, 1)\n assert 12 == ... | python | chosen |
[
{
"from": "system",
"value": "Add ssh thin_dir integration test\n"
},
{
"from": "human",
"value": "# -*- coding: utf-8 -*-\n'''\nsalt-ssh testing\n'''\n# Import Python libs\nfrom __future__ import absolute_import\n\n# Import salt testing libs\nfrom tests.support.case import SSHCase\n\n\nclass SS... | python | chosen |
[
{
"from": "system",
"value": "Update dsub version to 0.1.3.dev0\n\nPiperOrigin-RevId: 173965107\n"
},
{
"from": "human",
"value": "# Copyright 2017 Google Inc. All Rights Reserved.\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may not use this file except in comp... | python | chosen |
[
{
"from": "system",
"value": "Add unit test for print_board()\n"
},
{
"from": "human",
"value": "\"\"\" Tests for the HistoryNode module \"\"\"\n\npass\n"
},
{
"from": "gpt",
"value": "\"\"\" Tests for the HistoryNode module \"\"\"\n\nfrom contextlib import contextmanager\nfrom io im... | python | chosen |
[
{
"from": "system",
"value": "Create post source inline (admin Tabular Inline) on core post\n"
},
{
"from": "human",
"value": "# -*- coding: utf-8 -*-\nfrom django.contrib import admin\nfrom django import forms\n\nfrom opps.core.models import Post, PostImage\n\nfrom redactor.widgets import Redac... | python | chosen |
[
{
"from": "system",
"value": "Fix a regression where the user_gesture bit isn't set for ClickElement.\n\nThe regrssion was introduced in\nhttps://chromium-review.googlesource.com/c/catapult/+/1335627\n\nOnce this rolls into Chromium, I'll add a chromium side test to prevent\nit from regress again in the fut... | python | chosen |
[
{
"from": "system",
"value": "Fix issue with old wagtail core paths\n"
},
{
"from": "human",
"value": "#!/usr/bin/env python\n\nimport sys\n\nfrom django.conf import settings\nfrom django.core.management import execute_from_command_line\n\n\nif not settings.configured:\n params = dict(\n ... | python | chosen |
[
{
"from": "system",
"value": "Add a setperson function to test complex function arguments\n"
},
{
"from": "human",
"value": "# coding=utf8\n\"\"\"\nA mini-demo of what wsme can do.\n\nTo run it::\n\n python setup.py develop\n\nThen::\n\n paster serve demo.cfg\n\"\"\"\n\nfrom wsme import *\... | python | chosen |
[
{
"from": "system",
"value": "Write output to text file\n"
},
{
"from": "human",
"value": "# -*- coding: utf-8 -*-\n\nimport sys, datetime, getopt\nfrom reddit_user import RedditUser\n\nlongopts, shortopts = getopt.getopt(sys.argv[2:], shortopts=\"\", longopts=[\"file=\"])\nargs = dict(longopts)... | python | chosen |
[
{
"from": "system",
"value": "Fix tests to handle Locale as a foreign key.\n"
},
{
"from": "human",
"value": "import factory\n\nfrom normandy.base.tests import FuzzyUnicode\nfrom normandy.recipes.models import Action, Recipe, RecipeAction\n\n\nclass RecipeFactory(factory.DjangoModelFactory):\n ... | python | chosen |
[
{
"from": "system",
"value": "Change key and value to more descriptive names\n"
},
{
"from": "human",
"value": "\nfrom rest_framework import status\nfrom rest_framework.exceptions import APIException, ParseError\n\n\ndef json_api_exception_handler(exc, context):\n \"\"\" Custom exception hand... | python | chosen |
[
{
"from": "system",
"value": "Fix bug in file path.\n"
},
{
"from": "human",
"value": "import os\nimport sh\nfrom sh import docker\n\n\ndef setup_package():\n \"\"\"\n Sets up docker images and host containers for running the STs.\n \"\"\"\n # Pull and save each image, so we can use ... | python | chosen |
[
{
"from": "system",
"value": "Add pubish action helper for influxdb\n"
},
{
"from": "human",
"value": "#-*- coding:utf-8 -*-\nimport sys\nimport logging\n\nfrom influxdb import InfluxDBClient\n\nclass InfluxDBPublish(object):\n\n def __init__(self, influxdb, measurement, tags):\n asser... | python | chosen |
[
{
"from": "system",
"value": "Reduce search response time by keeping wordlist in memory\n"
},
{
"from": "human",
"value": "from flask import Flask, render_template, jsonify\n\n\napp = Flask(__name__)\napp.config.update(\n JSONIFY_PRETTYPRINT_REGULAR=False,\n)\n\n\n@app.route('/')\ndef index()... | python | chosen |
[
{
"from": "system",
"value": "Add a property to an exception class\n"
},
{
"from": "human",
"value": "# encoding: utf-8\n\n\"\"\"\n.. codeauthor:: Tsuyoshi Hombashi <tsuyoshi.hombashi@gmail.com>\n\"\"\"\n\nfrom __future__ import absolute_import, unicode_literals\n\n\nclass CommandError(Exception... | python | chosen |
[
{
"from": "system",
"value": "Rename locale field to language.\n"
},
{
"from": "human",
"value": "# -*- coding: utf-8 -*-\nfrom django.db import models\nfrom django.utils.translation import ugettext_lazy as _\nfrom django.utils.encoding import python_2_unicode_compatible\n\nfrom .. import settin... | python | chosen |
[
{
"from": "system",
"value": "Fix exception message if app path is invalid"
},
{
"from": "human",
"value": "from importlib import import_module\n\nfrom django.apps import apps\nfrom django.core.exceptions import ImproperlyConfigured\n\n\ndef get_callable(func_or_path):\n \"\"\"\n Receives ... | python | chosen |
[
{
"from": "system",
"value": "Use snake case for API's URL: generic_records instead of genericRecord and species_observation instead of speciesObservation.\n"
},
{
"from": "human",
"value": "from __future__ import absolute_import, unicode_literals, print_function, division\n\nfrom django.conf.ur... | python | chosen |
[
{
"from": "system",
"value": "Make sure we don't expose translator as global"
},
{
"from": "human",
"value": "import six\n\nfrom autotranslate.compat import importlib\nfrom django.conf import settings\n\n\ndef perform_import(val, setting_name):\n \"\"\"\n If the given setting is a string i... | python | chosen |
[
{
"from": "system",
"value": "Add tests of automated identification of the delimiter\n"
},
{
"from": "human",
"value": "\"\"\"Tests for the EcoData Retriever\"\"\"\n\nfrom StringIO import StringIO\nfrom engine import Engine\n\ndef test_escape_single_quotes():\n \"\"\"Test escaping of single q... | python | chosen |
[
{
"from": "system",
"value": "Add quantity to shopping item model\n"
},
{
"from": "human",
"value": "\"\"\"\nThis is the sqlalchemy class for communicating with the shopping item table\n\n\"\"\"\n\nfrom sqlalchemy import Column, Integer, Unicode, ForeignKey\nimport base\n\n\nclass ShoppingItem(b... | python | chosen |
[
{
"from": "system",
"value": "Update script to store the basename instead of the complete path\n"
},
{
"from": "human",
"value": "#!/usr/bin/env python\nimport click\nimport os\nimport codecs\nimport json\nimport pandas as pd\n\n\n@click.command()\n@click.argument('input_files', nargs=-1, type=c... | python | chosen |
[
{
"from": "system",
"value": "Fix template load on PageDetail flatpages app\n"
},
{
"from": "human",
"value": "#!/usr/bin/env python\n# -*- coding: utf-8 -*-\nfrom django.views.generic.detail import DetailView\nfrom django.contrib.sites.models import get_current_site\nfrom django import template... | python | chosen |
[
{
"from": "system",
"value": "Add functionality for edit and delete functions\n"
},
{
"from": "human",
"value": "from flask import Blueprint, render_template\nfrom organise.models import Todo\nfrom organise import db\nfrom flask import render_template, request, redirect, url_for, flash\n\ntodos ... | python | chosen |
[
{
"from": "system",
"value": "Include webpack-dev-server URL as a valid redirect\n"
},
{
"from": "human",
"value": "# -*- coding: utf-8 -*-\n# Generated by Django 1.11.3 on 2017-07-26 20:29\nfrom __future__ import unicode_literals\n\nfrom django.db import migrations\nfrom oauth2_provider.models ... | python | chosen |
[
{
"from": "system",
"value": "Fix testing of metadata - hashing is too strict\n"
},
{
"from": "human",
"value": "\"\"\"\nTests for BSE metadata\n\"\"\"\n\nimport os\nimport hashlib\nimport bse\nfrom bse import curate\n\ndata_dir = bse.default_data_dir\n\ndef test_get_metadata():\n bse.get_met... | python | chosen |
[
{
"from": "system",
"value": "Fix tests on Django 1.8.\n"
},
{
"from": "human",
"value": "DATABASES = {\n 'default': {\n 'ENGINE': 'django.db.backends.sqlite3',\n 'NAME': ':memory:',\n }\n}\n\nSECRET_KEY = 'fake-key'\n\nINSTALLED_APPS = [\n 'django.contrib.auth',\n 'dja... | python | chosen |
[
{
"from": "system",
"value": "Drop cost filtering from TB_GiftExchange_Treasure_Spell\n\nIt doesn't work, and makes things harder than they need to be.\n"
},
{
"from": "human",
"value": "\"\"\"\nGift Exchange\n\"\"\"\n\nfrom ..utils import *\n\n\n# Hardpacked Snowballs\nclass TB_GiftExchange_Sno... | python | chosen |
[
{
"from": "system",
"value": "Remove some route_base tests that are no longer valid with Flask 0.10\n"
},
{
"from": "human",
"value": "from flask import Flask\nfrom .view_classes import BasicView, RouteBaseView\nfrom nose.tools import *\n\napp = Flask('route_base')\nBasicView.register(app, route... | python | chosen |
[
{
"from": "system",
"value": "Add Vega Lite template test\n"
},
{
"from": "human",
"value": "from django.test import TestCase\n\n# Create your tests here.\n"
},
{
"from": "gpt",
"value": "from django.test import TestCase\nfrom .views import ChartsView\n\n# Create your tests here.\ncl... | python | chosen |
[
{
"from": "system",
"value": "Change a URL to a ftp file in the ftp staging test.\n"
},
{
"from": "human",
"value": "import pytest\n\nimport parsl\nfrom parsl.app.app import App\nfrom parsl.data_provider.files import File\nfrom parsl.tests.configs.local_threads import config\n\nparsl.clear()\npa... | python | chosen |
[
{
"from": "system",
"value": "Add import for APIError to make it easy to import by users\n"
},
{
"from": "human",
"value": "# Make marshmallow's functions and classes importable from flask-io\nfrom marshmallow import pre_load, pre_dump, post_load, post_dump, Schema, ValidationError, validates_sc... | python | chosen |
[
{
"from": "system",
"value": "Create a new file if the path is invalid.\n"
},
{
"from": "human",
"value": "from .compat import decode, encode\n\n\ndef read_data(path):\n \"\"\"\n Reads a file and returns a json encoded representation of the file.\n \"\"\"\n db = open(path, \"r+\")\n ... | python | chosen |
[
{
"from": "system",
"value": "Change site name to Westminster DAily\n"
},
{
"from": "human",
"value": "#!/usr/bin/env python\n\n# http://flask.pocoo.org/docs/config/#development-production\n\n\nclass Config(object):\n SITE_TITLE = \"Westminster Standards\"\n SITE_TAGLINE = \"Read the Westm... | python | chosen |
[
{
"from": "system",
"value": "Use inline radio buttons for priority changes.\n\nChange-Id: Ifb9a685bca654c5139aef3ca78e800b66ce77eb9\n"
},
{
"from": "human",
"value": "from django import template\nfrom django.utils.safestring import mark_safe\nfrom lava_scheduler_app.models import TestJob\n\nreg... | python | chosen |
[
{
"from": "system",
"value": "Fix management command for fixing slugs\n"
},
{
"from": "human",
"value": "# coding: utf-8\nfrom django.core.management import BaseCommand\nfrom django.template.defaultfilters import slugify\nfrom unidecode import unidecode\n\nfrom richard.videos.models import Speak... | python | chosen |
[
{
"from": "system",
"value": "Prepare for the next development iteration\n"
},
{
"from": "human",
"value": "# -*- coding: utf-8 -*-\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 copy... | python | chosen |
[
{
"from": "system",
"value": "Test missing content and failed navigation tests.\n\nThis commit adds unit tests outside of the happy path where\na url does not exist or the test is looking for conten that\ndoesn't exist on the page. Since testing for missing informaion\nrequires timeouts to be sure, some of... | python | chosen |
[
{
"from": "system",
"value": "Fix typo with expected metric\n"
},
{
"from": "human",
"value": "\"\"\"\nContains tests for the timer metric.\n\"\"\"\n\nfrom statsite.metrics import Timer\n\nclass TestTimerMetric(object):\n def test_fold_sum(self):\n \"\"\"\n Tests that folding ge... | python | chosen |
[
{
"from": "system",
"value": "Fix table name for MySQL\n"
},
{
"from": "human",
"value": "from django.db import models\n\n# Create your models here.\n\nclass World(models.Model):\n randomnumber = models.IntegerField()\n class Meta:\n db_table = 'world'\n\nclass Fortune(models.Model):\n mes... | python | chosen |
[
{
"from": "system",
"value": "Remove imports of omitted modules.\n"
},
{
"from": "human",
"value": "from ._version import get_versions\n__version__ = get_versions()['version']\ndel get_versions\n\nimport intake # Import this first to avoid circular imports during discovery.\nfrom .netcdf import... | python | chosen |
[
{
"from": "system",
"value": "Make code compatible with no user agent\n"
},
{
"from": "human",
"value": "import copy\n\nfrom django import template\nfrom django.conf import settings\n\nfrom games import models\n\nregister = template.Library()\n\n\ndef get_links(user_agent):\n systems = ['ubun... | python | chosen |
[
{
"from": "system",
"value": "Fix other tests with same regexp issue"
},
{
"from": "human",
"value": "import unittest, sys\n\nfrom HARK.validators import non_empty\n\nclass ValidatorsTests(unittest.TestCase):\n '''\n Tests for validator decorators which validate function arguments\n '''... | python | chosen |
[
{
"from": "system",
"value": "Clean user data before passing it to keywordsearch.get_total_n()\n"
},
{
"from": "human",
"value": "from django import forms\nfrom webscript import WebScript\nfrom django.template.loader import render_to_string\n\nimport amcat.scripts.forms\nimport amcat.forms\nfrom... | python | chosen |
[
{
"from": "system",
"value": "Use localhost instead of 127.0.0.1\n"
},
{
"from": "human",
"value": "\nimport webbrowser\nfrom uuid import uuid4\n\nfrom alertaclient.auth.token import TokenHandler\n\n\ndef login(client, oidc_auth_url, client_id):\n xsrf_token = str(uuid4())\n redirect_uri =... | python | chosen |
[
{
"from": "system",
"value": "[AC-9046] Remove unused import and fix linting issues\n"
},
{
"from": "human",
"value": "# Generated by Django 2.2.10 on 2021-11-05 12:29\n\nfrom django.db import migrations\nfrom django.db.models.query_utils import Q\n\n\ndef update_url_to_community(apps, schema_ed... | python | chosen |
[
{
"from": "system",
"value": "Add some more logging methods. (@JayH5)\n"
},
{
"from": "human",
"value": "\"\"\"\nVery limited reimplementation of some of `twisted.logger.Logger`'s public\nAPI so we can use older Twisted versions that don't have the new logging\nfeatures.\n\"\"\"\n\ntry:\n fro... | python | chosen |
[
{
"from": "system",
"value": "Make work with modern markdown2\n\nWithin a pre block, links don't link, which is good.\n"
},
{
"from": "human",
"value": "from tiddlywebplugins.markdown import render\nfrom tiddlyweb.model.tiddler import Tiddler\n\n\ndef test_urlification():\n tiddler = Tiddler(... | python | chosen |
[
{
"from": "system",
"value": "Use $PATH instead of sys.path\n"
},
{
"from": "human",
"value": "\"\"\"Test setup.py.\"\"\"\n\n\nimport os\nimport subprocess\nimport sys\n\n\ndef test_setup():\n \"\"\"Run setup.py check.\"\"\"\n command = [sys.executable, 'setup.py', 'check', '--metadata', '... | python | chosen |
[
{
"from": "system",
"value": "Use random.sample() rather than reinventing it.\n"
},
{
"from": "human",
"value": "# -*- coding: utf-8\n\nfrom random import choice\nimport string\n\ndef random_string(length,\n letters=True,\n digits=True,\n punctuation=False,\n whitespa... | python | chosen |
[
{
"from": "system",
"value": "Add test for highest_ancestor function\n"
},
{
"from": "human",
"value": "from viridis import tree\nfrom six.moves import range\n\nimport pytest\n\n@pytest.fixture\ndef base_tree():\n t = tree.Ultrametric(list(range(6)))\n t.merge(0, 1, 0.1) # 6\n t.merge(... | python | chosen |
[
{
"from": "system",
"value": "Add additional testcase for finally/return.\n"
},
{
"from": "human",
"value": "def func1():\n try:\n return \"it worked\"\n finally:\n print(\"finally 1\")\n\nprint(func1())\n"
},
{
"from": "gpt",
"value": "def func1():\n try:\n ... | python | chosen |
[
{
"from": "system",
"value": "Use __module__ to make @lock unique\n\nSummary: Fixes T49428.\n\nTest Plan:\nHard to test on changes_dev because it can't run both handlers (no\nplace to send notifications to), but this seems simple enough...\n\nReviewers: armooo, kylec\n\nReviewed By: kylec\n\nSubscribers: ch... | python | chosen |
[
{
"from": "human",
"value": "Add tool info for Korn\n\nFor more information, see https://github.com/gernst/korn\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-20... | python | chosen |
[
{
"from": "human",
"value": "Add migration to populate site_values in SiteConfigurationHistory\n\nRight now the ORM is very unhappy about the JSONField `site_values`\nin SiteConfigurationHistory containing non-JSON (empty strings). We\ncannot even write a data migration using the ORM to populate the field\... | python | chosen |
[
{
"from": "system",
"value": "Remove use of deprecated types.\n\nReviewer: Hugo Parente Lima <e250cbdf6b5a11059e9d944a6e5e9282be80d14c@openbossa.org>,\n Luciano Wolf <luciano.wolf@openbossa.org>\n"
},
{
"from": "human",
"value": "'''Test cases for QDeclarativeView'''\n\nimport unittest\... | python | chosen |
[
{
"from": "human",
"value": "Raise exception depending request type\n"
},
{
"from": "gpt",
"value": "import json\n\nfrom werkzeug.exceptions import HTTPException\nfrom werkzeug.utils import escape\n\nfrom utils.views import serialize_response, get_request_type\n\n\nclass BaseHttpException(HTTPEx... | python | chosen |
[
{
"from": "human",
"value": "Migrate postage into templates_history table\n"
},
{
"from": "gpt",
"value": "\"\"\"\n\nRevision ID: 0256_set_postage_tmplt_hstr\nRevises: 0255_another_letter_org\nCreate Date: 2019-02-05 14:51:30.808067\n\n\"\"\"\nfrom alembic import op\nimport sqlalchemy as sa\n\n\... | python | chosen |
[
{
"from": "human",
"value": "Add a very simple test for dftModel analysis + synthesis.\n"
},
{
"from": "gpt",
"value": "import numpy as np\nfrom scipy.signal import get_window\nimport smst.models.dftModel as DFT\n\ndef test_simple_sinusoid():\n window_size = 1024\n t = np.linspace(0, 1, wi... | python | chosen |
[
{
"from": "human",
"value": "Add a test script for the flstats module\n"
},
{
"from": "gpt",
"value": "# -*- coding: utf-8 -*-\n\n\"\"\"\nflstats test script\n~~~~~~~~~~~~~~~~~~~\n\nThis script is intended to test the flstats module.\n\"\"\"\n\nimport json\nimport random\nimport unittest\n\nfrom... | python | chosen |
[
{
"from": "human",
"value": "Move bad images to new dir.\n"
},
{
"from": "gpt",
"value": "import cv2\nimport numpy as np\nimport os\nimport shutil\nimport sys\nfrom os.path import join\nfrom tqdm import tqdm\n\nif __name__ == \"__main__\":\n source_dir = sys.argv[1]\n dest_dir = sys.argv[2... | python | chosen |
[
{
"from": "human",
"value": "Add example for custom response header parsing\n\nSigned-off-by: Christopher Arndt <711c73f64afdce07b7e38039a96d2224209e9a6c@chrisarndt.de>\n"
},
{
"from": "gpt",
"value": "import mrequests\n\n\nclass MyResponse(mrequests.Response):\n def __init__(self, *args, **k... | python | chosen |
[
{
"from": "human",
"value": "Append classified tax name to lower ranking unclassified names\n"
},
{
"from": "gpt",
"value": "#!/usr/bin/env python\n\nimport pandas as pd, sys\n\n\ndef append_classified(df):\n ## Append classified name to each Unclassified rank in turn\n p_unc = df[df.phylu... | python | chosen |
[
{
"from": "human",
"value": "Add small plot of power spectral density\n"
},
{
"from": "gpt",
"value": "# -*- encoding: utf-8 -*-\n# JN 2016-02-16\n\n\"\"\"\nPlot a spectrum from the first 1000 records of data\n\"\"\"\nimport sys\nimport scipy.signal as sig\nimport matplotlib.pyplot as mpl\n\nfro... | python | chosen |
[
{
"from": "human",
"value": "Add a toy script to fetch images from Amazon\n\n\ngit-svn-id: 76cb8c96a56e2e269d2baf461dc2f0a164399ff5@1178 f01d2545-417e-4e96-918e-98f8d0dbbcb6\n"
},
{
"from": "gpt",
"value": "#!/usr/bin/python\n\n## Copyright (C) 2005 Nick Piper <nick-gtkpod at nickpiper co uk>\n... | python | chosen |
[
{
"from": "human",
"value": "Store .csv daily precipitation in hec .dss database\n\n- Store precipitation data in .dss before running HEC-HMS model\n- Also updated the Jython version of Hec-dssuve into 2.5\nMore details - http://resourceoptimism.blogspot.com/2017/03/store-csv-data-on-hec-dssuve-dss-for.html... | python | chosen |
[
{
"from": "human",
"value": "Add unit tests for loop.until state\n"
},
{
"from": "gpt",
"value": "# -*- coding: utf-8 -*-\n'''\nTests for loop state(s)\n'''\n\n# Import Python Libs\nfrom __future__ import absolute_import, print_function, unicode_literals\n\n# Import Salt Testing Libs\nfrom tests... | python | chosen |
[
{
"from": "human",
"value": "Add config feature verification script\n\nThis commit adds a new tool to tempest that will verify that API\nqueryable config options are set correctly. Right now the list of\noptions that are verified is very short. Later on additional checks\nwill be added to verify other servi... | python | chosen |
[
{
"from": "human",
"value": "Add test of BIND9 backend\n\nAdd test of the following source code.\n designate/designate/backend/impl_bind9.py\n\nChange-Id: If2c3292de483881d732d88397574de8e5a12f78a\n"
},
{
"from": "gpt",
"value": "# Copyright 2015 FUJITSU LIMITED\n#\n# Licensed under the Apache... | python | chosen |
[
{
"from": "human",
"value": "Add framework for Rayleigh-Ritz polynomial approximations for a single truss\n"
},
{
"from": "gpt",
"value": "import string\nimport numpy as np\nfrom scipy.optimize import fsolve\nfrom scipy.optimize import minimize\n\nletter_list=list(string.ascii_uppercase)\n\npoly... | python | chosen |
[
{
"from": "human",
"value": "Save testbed for a27 + a28.\n"
},
{
"from": "gpt",
"value": "from fabric.api import env\n\nos_username = 'admin'\nos_password = 'contrail123'\nos_tenant_name = 'demo'\n\nhost1 = 'root@10.84.5.27'\nhost2 = 'root@10.84.5.28'\n\next_routers = []\nrouter_asn = 64512\npub... | python | chosen |
[
{
"from": "human",
"value": "Add simple test to verify LocalizedField can be used in bulk_create\n"
},
{
"from": "gpt",
"value": "import json\n\nfrom django.db import models\nfrom django.conf import settings\nfrom django.test import TestCase\n\nfrom localized_fields.fields import LocalizedField\... | python | chosen |
[
{
"from": "human",
"value": "Add tests for power-law functions\n"
},
{
"from": "gpt",
"value": "\nfrom ..gen_field import make_3dfield, make_extended\n\nimport pytest\nimport numpy as np\nimport numpy.testing as npt\n\n\n@pytest.mark.parametrize(('shape', 'slope'), [(shape, slope) for shape in\n... | python | chosen |
[
{
"from": "human",
"value": "Add script to auto-generate our index of example notebooks.\n\nIt's highly hard-coded for now, but will do in the meantime. We can\ngeneralize it later, but we're really hurting by not having this index\nanywhere.\n"
},
{
"from": "gpt",
"value": "#!/usr/bin/env pyth... | python | chosen |
[
{
"from": "human",
"value": "Add managed Endpoint unit tests\n"
},
{
"from": "gpt",
"value": "import glob\nfrom jgo.jgo import InvalidEndpoint\nimport jgo\nimport os\nimport pathlib\nimport unittest\nimport shutil\nimport tempfile\n\nimport logging\n\n_logger = logging.getLogger(__name__)\n_logg... | python | chosen |
[
{
"from": "human",
"value": "Add utility for baut setting\n"
},
{
"from": "gpt",
"value": "#!/usr/bin/python\n\n\"\"\"Looks for sensor on the bus and changes it's address to the one specified on command line\"\"\" \n\nimport argparse\n\nimport minimalmodbus\nimport serial\nfrom time import sleep... | python | chosen |
[
{
"from": "human",
"value": "Add script to condense test directory names.\n"
},
{
"from": "gpt",
"value": "#!/usr/bin/env python3\n\n\n# Copyright 2018 The Meson development team\n\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may not use this file except in complia... | python | chosen |
[
{
"from": "human",
"value": "backend: Make old DummyBackend imports work\n"
},
{
"from": "gpt",
"value": "from __future__ import unicode_literals\n\n# Make classes previously residing here available in the old location for\n# backwards compatibility with extensions targeting Mopidy < 0.18.\nfrom... | python | chosen |
[
{
"from": "human",
"value": "Add default flask-index file that also sends index.html to /\n"
},
{
"from": "gpt",
"value": "from flask import Flask, send_file\napp = Flask(__name__)\n\n@app.route(\"/hello\")\ndef hello():\n return \"Hello World from Flask (default)\"\n\n@app.route(\"/\")\ndef ... | python | chosen |
[
{
"from": "human",
"value": "Add .editorconfig.py to suggest indent amount, spaces over tabs, etc.\n"
},
{
"from": "gpt",
"value": "# http://editorconfig.org\n\nroot = true\n\n[*]\nindent_style = space\nindent_size = 4\ntrim_trailing_whitespace = true\ninsert_final_newline = true\ncharset = utf-... | python | chosen |
[
{
"from": "human",
"value": "scripts: Add script to create MySQL user.\n"
},
{
"from": "gpt",
"value": "#!/usr/bin/env python\n# -*- coding: utf-8 -*-\n\n#==============================================================================\n# Script for creating MySQL user\n#==========================... | python | chosen |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.