conversations listlengths 2 3 | source stringclasses 1
value | stack stringclasses 1
value |
|---|---|---|
[
{
"from": "human",
"value": "Add a base Django model to share common functionality.\n"
},
{
"from": "gpt",
"value": "from django.db import models\n\nclass ComradeBaseModel(models.Model):\n created = models.DateTimeField(auto_now_add=True)\n modified = models.DateTimeField(auto_now=True)\n\... | python | chosen |
[
{
"from": "human",
"value": "tests/basics: Add test for string module formatting with int argument.\n"
},
{
"from": "gpt",
"value": "# test string modulo formatting with int values\n\n# test + option with various amount of padding\nfor pad in ('', ' ', '0'):\n for n in (1, 2, 3):\n for... | python | chosen |
[
{
"from": "human",
"value": "Add Tests for gateway creation\n"
},
{
"from": "gpt",
"value": "'''\n\tTest gateway creation\n'''\n\nimport unittest\nfrom wirecurly.configuration import gateway\nfrom nose import tools\n\n\nclass testGatewayCreation(unittest.TestCase):\n\t'''\n\t\tTest gateway creat... | python | chosen |
[
{
"from": "human",
"value": "Add test for rendering integer 0 in form input\n"
},
{
"from": "gpt",
"value": "from flask_wtf import FlaskForm as Form\n\nfrom app.main.forms import GovukTextInputField\n\n\ndef test_GovukTextInputField_renders_zero(client_request):\n class FakeForm(Form):\n ... | python | chosen |
[
{
"from": "human",
"value": "Add 02-task sample test file.\n"
},
{
"from": "gpt",
"value": "import unittest\n\nimport solution\n\n\nclass SampleTest(unittest.TestCase):\n def test_five_plus_three(self):\n plus = solution.create_operator('+', lambda lhs, rhs: lhs + rhs)\n x = sol... | python | chosen |
[
{
"from": "human",
"value": "Add first pass at checking dhcp namespaces for taps\n"
},
{
"from": "gpt",
"value": "import re\nimport subprocess\n\n\ndef get_namespace_list():\n \"\"\"Retrieve the list of DHCP namespaces.\"\"\"\n return subprocess(['ip', 'netns', 'list']).split()\n\n\ndef ge... | python | chosen |
[
{
"from": "human",
"value": "Add tests for encoding password\n\n* wqflask/tests/wqflask/test_user_login.py: New tests.\n"
},
{
"from": "gpt",
"value": "\"\"\"Test cases for some methods in login.py\"\"\"\n\nimport unittest\nfrom wqflask.user_login import encode_password\n\n\nclass TestUserLogin(... | python | chosen |
[
{
"from": "human",
"value": "Add some tests for crypto/aes\n"
},
{
"from": "gpt",
"value": "#/usr/bin/python\n# -*- coding: utf-8 -*-\n# Run from Cryptchat\n# python -m unittest discover\n\nimport unittest\nfrom ..crypto.aes import AESCipher\n\n\nclass testAESCipher(unittest.TestCase):\n\n de... | python | chosen |
[
{
"from": "human",
"value": "Print doc on help or no args\n"
},
{
"from": "gpt",
"value": "#!/bin/python\n\"\"\"modify-color\n------------\n\"\"\"\n\nimport sys\nimport colorsys\n\nclass Color(object):\n def __init__(self, color_str, color_format=\"hex\"):\n pass\n\nif __name__ == \"__... | python | chosen |
[
{
"from": "human",
"value": "Add unit tests for find_packages\n\n--HG--\nextra : rebase_source : 75f5ce4d2fb9d0ccd7168739c23d9ea1eeeb9112\n"
},
{
"from": "gpt",
"value": "\"\"\"Tests for setuptools.find_packages().\"\"\"\nimport os\nimport shutil\nimport tempfile\nimport unittest\n\nfrom setupto... | python | chosen |
[
{
"from": "human",
"value": "[ADD] Add common report header default file (Tested with central journal only) => Need to improve it and work of all journals reports (Under development)\n\nbzr revid: mra@mra-laptop-20100710071957-ddp1dmz5ve9f5qdt"
},
{
"from": "gpt",
"value": "# -*- coding: utf-8 -... | python | chosen |
[
{
"from": "human",
"value": "Add tests for compare module\n"
},
{
"from": "gpt",
"value": "import unittest\n\nimport pandas.util.testing as pdt\nimport recordlinkage\nimport numpy as np\nimport pandas as pd\n\nclass TestCompare(unittest.TestCase):\n\n def test_exact_two_series(self):\n\n ... | python | chosen |
[
{
"from": "human",
"value": "Add a test for package generation\n"
},
{
"from": "gpt",
"value": "import argparse\nimport mock\nimport os\nimport tempfile\nimport unittest\nimport shutil\nimport re\nimport sys\n\nfrom dogen.plugins.repo import Repo\nfrom dogen.generator import Generator\n\nclass T... | python | chosen |
[
{
"from": "human",
"value": "Create .sql file to automatically import data into database\n"
},
{
"from": "gpt",
"value": "from __future__ import print_function\nimport os\nimport re\n\n#http://stackoverflow.com/questions/3964681/find-all-files-in-directory-with-extension-txt-with-python\ncreate_... | python | chosen |
[
{
"from": "human",
"value": "Add solution to lintcode question 112\n"
},
{
"from": "gpt",
"value": "\"\"\"\nDefinition of ListNode\nclass ListNode(object):\n def __init__(self, val, next=None):\n self.val = val\n self.next = next\n\"\"\"\nclass Solution:\n \"\"\"\n @param ... | python | chosen |
[
{
"from": "human",
"value": "Add example of CCSD DIIS\n"
},
{
"from": "gpt",
"value": "#!/usr/bin/env python\n#\n# Author: Qiming Sun <osirpt.sun@gmail.com>\n#\n\n'''\nAdjust CCSD DIIS\n'''\n\nfrom pyscf import gto, scf, cc\n\nmol = gto.M(\n atom = 'H 0 0 0; F 0 0 1.1',\n basis = 'ccpvdz')... | python | chosen |
[
{
"from": "human",
"value": "Add tests for RuleCondition and Rule\n"
},
{
"from": "gpt",
"value": "from rulefit import RuleCondition, Rule, RuleEnsemble, RuleFit\nimport numpy as np\n\n\n\nrule_condition_smaller = RuleCondition(1, 5, \"<=\", 0.4)\nrule_condition_greater = RuleCondition(0, 1, \">... | python | chosen |
[
{
"from": "human",
"value": "Add python script to generate the bits needed for the prime generator.\n"
},
{
"from": "gpt",
"value": "primes = [2, 3, 5, 7]\nsafe = True\n\nmuliplier = 1\nfor p in primes:\n muliplier *= p\n\noffsets = []\nfor x in range(3, muliplier + 3, 2):\n prime = True\n... | python | chosen |
[
{
"from": "human",
"value": "Add a test to check the ScrapydError's repr().\n\nTakes us to 100% coverage.\n"
},
{
"from": "gpt",
"value": "from scrapyd_api.exceptions import ScrapydError\n\n\ndef test_scrapyd_error():\n err = ScrapydError()\n assert repr(err) == 'ScrapydError(\"Scrapyd Err... | python | chosen |
[
{
"from": "human",
"value": "Add py solution for 392. Is Subsequence\n\n392. Is Subsequence: https://leetcode.com/problems/is-subsequence/\n\nApproach:\n Observe the first item remaining in each step. The value will be added\n 1 << step either the remaining count is odd or it's a left-to-right\n st... | python | chosen |
[
{
"from": "human",
"value": "Add py solution for 606. Construct String from Binary Tree\n\n606. Construct String from Binary Tree: https://leetcode.com/problems/construct-string-from-binary-tree/\n"
},
{
"from": "gpt",
"value": "# Definition for a binary tree node.\n# class TreeNode(object):\n# ... | python | chosen |
[
{
"from": "human",
"value": "Add table for OAI repositories\n"
},
{
"from": "gpt",
"value": "\"\"\" Add table for OAI repositories\n\nRevision ID: 71874271208e\nRevises: a80b4f777c12\nCreate Date: 2017-01-15 21:47:58.946488\n\n\"\"\"\nfrom alembic import op\nimport sqlalchemy as sa\n\n\n# revisi... | python | chosen |
[
{
"from": "human",
"value": "Add utility functions to query the languages\n"
},
{
"from": "gpt",
"value": "from django.conf import settings\n\nlanguages = dict([(item['name'], item) for item in settings.TEMPEL_LANGUAGES])\n\ndef get_languages():\n return sorted([(item['name'], item['label']) ... | python | chosen |
[
{
"from": "human",
"value": "[enh] Add a basic test for simple_search_shortcut templatetag\n"
},
{
"from": "gpt",
"value": "from . import TestCase\nfrom memopol.search.templatetags.search_tags import simple_search_shortcut\n\n\nclass TestSearchTemplateTags(TestCase):\n\n def test_simple_searc... | python | chosen |
[
{
"from": "human",
"value": "Add basics for a restore script\n\n (Yes, sadly, still debugging, need the prod db)\n"
},
{
"from": "gpt",
"value": "#!/usr/bin/env python\nfrom pupa.utils import JSONEncoderPlus\nfrom contextlib import contextmanager\nfrom pymongo import Connection\nimport argparse\... | python | chosen |
[
{
"from": "human",
"value": "Add some tests for Context\n"
},
{
"from": "gpt",
"value": "from dmaws.context import Context\n\n\nclass TestContext(object):\n def test_empty_context(self):\n ctx = Context()\n\n assert ctx.stage is None\n assert ctx.environment is None\n\n ... | python | chosen |
[
{
"from": "system",
"value": "Add hybrid (XEP-0126 & XEP-0186) service to initial presence test.\n"
},
{
"from": "human",
"value": "\"\"\"\nTests setting your own presence before calling Connect(), allowing the user to\nsign in as Busy/Invisible/whatever rather than available.\n\"\"\"\n\nfrom tw... | python | chosen |
[
{
"from": "human",
"value": "Add example of creating a pandas graph\n"
},
{
"from": "gpt",
"value": "import pandas as pd\nimport numpy as np\nimport matplotlib.pyplot as plt\n\ndata = {'date': ['2014-05-01 18:47:05.069722', '2014-05-01 18:47:05.119994', '2014-05-02 18:47:05.178768', '2014-05-02 ... | 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 MicroversionMixin for microversion support\n\nThis generic mixin overloads plugin client() method to return\na client with max microversion unless a specific version is requested.\n\nThis provides two abstract methods\n- get_max_microversion()\n- is_version_supported()\n\nfo... | python | chosen |
[
{
"from": "human",
"value": "Add a tool to dump the contents of SignedCertificateTransparencyList structures.\n"
},
{
"from": "gpt",
"value": "#!/usr/bin/env python\n\"\"\" This is a util to dump the SCTs contained within a\n SignedCertificateTimestampList structure.\n This structure is us... | python | chosen |
[
{
"from": "human",
"value": "Add tests for dual secret keys\n"
},
{
"from": "gpt",
"value": "# Import libnacl libs\nimport libnacl.public\nimport libnacl.dual\n\n# Import python libs\nimport unittest\n\nclass TestPublic(unittest.TestCase):\n '''\n '''\n def test_secretkey(self):\n ... | python | chosen |
[
{
"from": "human",
"value": "ADD mig script to fix refunds taxes\n"
},
{
"from": "gpt",
"value": "# -*- coding: utf-8 -*-\nfrom openupgradelib import openupgrade\n\n\n@openupgrade.migrate(use_env=True)\ndef migrate(env, version):\n # now that we have account_fix as depend we fix previous invo... | python | chosen |
[
{
"from": "human",
"value": "Add unit test for logging level convention\n"
},
{
"from": "gpt",
"value": "\"\"\"\nLogging level test convention.\n\n\"\"\"\nfrom json import loads\n\nfrom hamcrest import (\n assert_that,\n equal_to,\n has_entries,\n has_items,\n is_,\n)\nfrom microc... | python | chosen |
[
{
"from": "human",
"value": "Create very rudimentary Flask JSON API to list the experiments.\n"
},
{
"from": "gpt",
"value": "from flask import Flask\nfrom flask import jsonify\nimport json\nfrom bson.json_util import dumps as bson_dumps\n# from flask_cors import CORS\n\nimport sacred_mongo\n\na... | python | chosen |
[
{
"from": "human",
"value": "Add test for happy path of validate_metadata\n\nA good test for our parametrised decorator, too.\n"
},
{
"from": "gpt",
"value": "#!/usr/bin/env python\n#-*- coding: utf-8 -*-\n\n#This software is distributed under the Creative Commons license (CC0) version 1.0. A co... | python | chosen |
[
{
"from": "human",
"value": "Add 1 check, unlucky days\n"
},
{
"from": "gpt",
"value": "#!/usr/bin/env python\n\nfrom datetime import date\n\n\ndef checkio(year):\n day_count = 0\n for month in range(1, 13):\n day = date(year, month, 13)\n # Day = ISO8601 1..7 for Mon -> Sun\... | python | chosen |
[
{
"from": "human",
"value": "Add migration script for recurring_contract\n"
},
{
"from": "gpt",
"value": "# -*- encoding: utf-8 -*-\n##############################################################################\n#\n# Copyright (C) 2017 Compassion CH (http://www.compassion.ch)\n# Releasing... | python | chosen |
[
{
"from": "human",
"value": "Add new command to check if domains are valid\n"
},
{
"from": "gpt",
"value": "from django.core.management.base import BaseCommand\n\nfrom salt_observer.models import Domain\n\n\nclass Command(BaseCommand):\n help = 'Check all domains if they are valid'\n\n def... | python | chosen |
[
{
"from": "human",
"value": "Add unittest of 'url_parameter' template tag\n"
},
{
"from": "gpt",
"value": "from django.core.urlresolvers import reverse\n\nfrom .base import BoardAppTest\nfrom board.templatetags.url_parameter import url_parameter\n\n\nclass UrlParameterTest(BoardAppTest):\n de... | python | chosen |
[
{
"from": "human",
"value": "Include management command missing from a080693\n"
},
{
"from": "gpt",
"value": "from optparse import make_option\nfrom django.core.management.base import BaseCommand, CommandError\nfrom django.contrib.auth.models import User\n\nfrom hub.models import ExtraUserDetail... | python | chosen |
[
{
"from": "human",
"value": "Raise with upgrade instructions on old import path\n"
},
{
"from": "gpt",
"value": "raise ImportError(\n '\\n\\n'\n 'Your WhiteNoise configuration is incompatible with WhiteNoise v4.0\\n'\n 'This can be fixed by following the upgrade instructions... | python | chosen |
[
{
"from": "human",
"value": "Implement a simple launcher for ZVM, to help test the machine.\n"
},
{
"from": "gpt",
"value": "#!/usr/bin/env python\n\nimport sys\nimport os.path\nfrom zvm import zmachine\n\ndef usage():\n print \"\"\"Usage: %s <story file>\n\nRun a Z-Machine story under ZVM.\n... | python | chosen |
[
{
"from": "human",
"value": "Add a command to append tags quickly\n"
},
{
"from": "gpt",
"value": "# -*- coding: utf-8 -*-\n# vim: set ts=4\n\n# Copyright 2017 Rémi Duraffort\n# This file is part of DataTag.\n#\n# DataTag is free software: you can redistribute it and/or modify\n# it under the te... | python | chosen |
[
{
"from": "human",
"value": "Add tests for multiple hashes\n"
},
{
"from": "gpt",
"value": "# -*- coding: utf-8 -*-\n# Import sorbic libs\nimport sorbic.db\n\n# Import python libs\nimport os\nimport shutil\nimport unittest\nimport tempfile\n\ntry:\n import libnacl.blake\n HAS_BLAKE = True\... | python | chosen |
[
{
"from": "human",
"value": "Write script to convert HDF5 to other format\n"
},
{
"from": "gpt",
"value": "#!/usr/bin/env python\n\nimport argparse\nimport os.path\n\nimport pandas as pd\n\n\nif __name__ == '__main__':\n parser = argparse.ArgumentParser(description='Convert HDF5 to other '\n ... | python | chosen |
[
{
"from": "human",
"value": "Add a helper script which will transform a file full of SQL commands into a\nheader file suitable for inclusion in a standard C file and use with the\nSubversion SQLite APIs. The goal here is that we can maintain our SQL schema\ndirectly as such, and let this script do the appr... | python | chosen |
[
{
"from": "human",
"value": "Add utility to remove un-needed rules\n"
},
{
"from": "gpt",
"value": "import glob\nimport os\nimport re\n\n\ndef process(text, start=None):\n # Full Definition\n # ((.*) =\\s+([\\s\\S]*?)\\s*;\\n)\n # Group1 is the full rule definition\n # Group2 is only... | python | chosen |
[
{
"from": "human",
"value": "Add report kernel with API for Spacewalk\n"
},
{
"from": "gpt",
"value": "'''\n# ..######.\n# .##....##\n# .##......\n# ..######.\n# .......##\n# .##....##\n# ..######.\n\n################################################################################\n#\n# Script: ... | python | chosen |
[
{
"from": "human",
"value": "Add clean jython class command module\n\nSo it's possible to use this command when users add\ndistutilazy to their setup.cfg instead of\nusing command classes in their setup.py cmdclass.\n"
},
{
"from": "gpt",
"value": "\"\"\"\ndistutilazy.command.clean_jython_class\... | python | chosen |
[
{
"from": "human",
"value": "FIX: Add check for line endings\n"
},
{
"from": "gpt",
"value": "# Adapted from vispy\n#\n# License: BSD (3-clause)\n\nimport os\nfrom nose.plugins.skip import SkipTest\nfrom os import path as op\nimport sys\n\nimport mne\nfrom mne.utils import run_tests_if_main\n\n\... | python | chosen |
[
{
"from": "human",
"value": "Add Ironic Service detection plugin\n\nChange-Id: I829988eeeb53ffa2f8a21f25fcce83f7ff92143b\n"
},
{
"from": "gpt",
"value": "import logging\nimport monasca_setup.detection\n\nlog = logging.getLogger(__name__)\n\n\nclass Ironic(monasca_setup.detection.ServicePlugin):\... | python | chosen |
[
{
"from": "system",
"value": "Refactor to_dict method on the Message model\n"
},
{
"from": "human",
"value": "from django.db import models\n\n\nclass Channel(models.Model):\n def __str__(self):\n return self.name\n\n name = models.CharField(max_length=20, unique=True)\n\n\nclass Mes... | python | chosen |
[
{
"from": "human",
"value": "Add heem label sets as importable variables\n\nLists of HEEM labels have been added as variables that can be imported\nby other modules and used to print the labels in fixed orders.\n"
},
{
"from": "gpt",
"value": "heem_concept_type_labels = ['Emotie', 'Lichaamswerki... | python | chosen |
[
{
"from": "human",
"value": "Add an example of using .basic_auth_required()\n"
},
{
"from": "gpt",
"value": "from flask import Flask, g, request, session, redirect, url_for\nfrom flask.ext.simpleldap import LDAP\n\napp = Flask(__name__)\napp.secret_key = 'dev key'\napp.debug = True\n\napp.config... | python | chosen |
[
{
"from": "human",
"value": "Add extract sparse matrix script\n"
},
{
"from": "gpt",
"value": "from __future__ import print_function\nimport sys\n\n# Given a matrix in Matrix Market format, converts it into the following format:\n# Line 1: # of rows\n# Line 2..n: Row# col1_# col1_weight col2_# c... | python | chosen |
[
{
"from": "human",
"value": "Add missing migrations for removing default from Card.source_id\n"
},
{
"from": "gpt",
"value": "# Generated by Django 2.0 on 2017-12-03 01:21\n\nfrom django.db import migrations\nimport djstripe.fields\n\n\nclass Migration(migrations.Migration):\n\n dependencies ... | python | chosen |
[
{
"from": "human",
"value": "Test master and minion shipped with sha256\n"
},
{
"from": "gpt",
"value": "import yaml\n\n\ndef test_master_shipped_with_sha256():\n \"\"\"\n Test the Master is *shipped* with hash type set to SHA256.\n \"\"\"\n with open('/etc/salt/master', 'rb') as mas... | python | chosen |
[
{
"from": "human",
"value": "Make a simple json transformer tool\n"
},
{
"from": "gpt",
"value": "# -*- coding: utf-8 -*-\nimport re\nfrom collections import OrderedDict\nimport json\n\n\ndef camelize(data, source, dest=None):\n dest = dest or source\n for o in data.values():\n if s... | python | chosen |
[
{
"from": "human",
"value": "Add test for user admin api\n"
},
{
"from": "gpt",
"value": "from django.test import TestCase\nfrom django.contrib.auth.models import User\nfrom rest_framework import status\nfrom rest_framework.test import APIClient, APIRequestFactory, \\\n force_authenticate... | python | chosen |
[
{
"from": "human",
"value": "Add a script to watch the queue speed\n"
},
{
"from": "gpt",
"value": "# -*- coding: utf-8 -*-\nfrom __future__ import print_function\ntry:\n from insight.insight_settings import DEFAULT_REDIS_QUEUE_KEY\nexcept ImportError:\n DEFAULT_REDIS_QUEUE_KEY = 'insight-... | python | chosen |
[
{
"from": "human",
"value": "Add a commonly used subprocess command of mine\n"
},
{
"from": "gpt",
"value": "#! /usr/bin/env python\n\nfrom subprocess import Popen, PIPE\n\n\ndef _popen(cmd):\n \"\"\"\n Fork the specified command, returning a tuple of (stdout, stderr)\n \"\"\"\n retu... | python | chosen |
[
{
"from": "human",
"value": "Add support for Google URL Shortener API\n"
},
{
"from": "gpt",
"value": "import json\nimport requests\n\nfrom twitter_bot.config.api_keys import GOOGLE_API_KEYS\n\n\ndef get_short_url(long_url):\n \"\"\"Call Google URL Shortener API to return shortened URL\"\"\"\... | python | chosen |
[
{
"from": "human",
"value": "Add geon gix idx to markers and discussions\n"
},
{
"from": "gpt",
"value": "\"\"\"Adding geom geographical index to markers and discussions\n\nRevision ID: 4c4b79f8c4a\nRevises: 10ffa15c5d24\nCreate Date: 2018-03-07 13:49:06.780319\n\n\"\"\"\n# revision identifiers,... | python | chosen |
[
{
"from": "human",
"value": "Refactor settings to be pure python\n\nThis starts to bring the settings in to line with a) all the other DC\nprojects and b) a pure python way of settings everything up\n"
},
{
"from": "gpt",
"value": "from .base import * # noqa\n\n\nDATABASES['default']['CONN_MAX_... | python | chosen |
[
{
"from": "human",
"value": "Add test for polar motion warnings\n"
},
{
"from": "gpt",
"value": "from astropy.time import Time\nfrom astropy.coordinates.builtin_frames.utils import get_polar_motion\nfrom astropy.utils.exceptions import AstropyWarning\nimport pytest\n\n\ndef test_polar_motion_uns... | python | chosen |
[
{
"from": "human",
"value": "Add 1st macro script; ability to run macros is here already.\n\nThe 'run' command from IPython already has the ability to work like\na macro reader/executer, with only simple changes to the script\nfiles to allow for the OPEN magics. Don't forget the -i option to\nexpose the cur... | python | chosen |
[
{
"from": "human",
"value": "Add tests for Presentation viewset.\n"
},
{
"from": "gpt",
"value": "import datetime\n\nfrom django.core.urlresolvers import reverse\n\nfrom rest_framework import status\nfrom symposion.schedule.models import (\n Presentation,\n Slot,\n SlotKind,\n Sectio... | python | chosen |
[
{
"from": "human",
"value": "Add a helper script to add a DFU header\n\nThis is so simple we can do it in 10 lines of Python. It matches the format of\nthe `add_capsule_header.py` utility.\n"
},
{
"from": "gpt",
"value": "#!/usr/bin/python3\n# -*- coding: utf-8 -*-\n#\n# Copyright (C) 2020 Richa... | python | chosen |
[
{
"from": "human",
"value": "Add problem 32, pandigital products\n"
},
{
"from": "gpt",
"value": "from time import time\n\nDIGITS = 9\n\n\ndef calculate_pandigitals():\n pandigitals = set()\n for multiplicand in range(2, 99):\n for multiplier in range(123, 9876/multiplicand):\n ... | python | chosen |
[
{
"from": "human",
"value": "Add temporary testing script for qllbot v2.\n"
},
{
"from": "gpt",
"value": "import select\nimport socket\nimport time\n\n\nHOST, PORT = 'localhost', 5000\n\n\nclass Bot(object):\n timeout = 1\n watchdog_threshold = 120\n\n def __init__(self, host, port, max... | python | chosen |
[
{
"from": "human",
"value": "Add basic package directory and init file\n\nAdd a basic package directory containing a simple __init__.py file to define the elements of the package.\n"
},
{
"from": "gpt",
"value": "\"\"\"The init file for the blackjack package.\"\"\"\n\n__author__ = 'Christopher R... | python | chosen |
[
{
"from": "human",
"value": "tests/basics: Add test for builtin \"delattr\".\n"
},
{
"from": "gpt",
"value": "# test builtin delattr\n\nclass A: pass\na = A()\na.x = 1\nprint(a.x)\n\ndelattr(a, 'x')\n\ntry:\n a.x\nexcept AttributeError:\n print('AttributeError')\n\ntry:\n delattr(a, 'x'... | python | chosen |
[
{
"from": "human",
"value": "Add test for SwapSpace max size\n"
},
{
"from": "gpt",
"value": "import test_compat # pylint: disable=unused-import\n\nimport six\nimport unittest\n\nfrom blivet.devices.storage import StorageDevice\nfrom blivet.errors import DeviceError\nfrom blivet.formats import ... | python | chosen |
[
{
"from": "human",
"value": "Add a signal processor that only records Models that have indexes.\n"
},
{
"from": "gpt",
"value": "\"\"\" Additional Haystack Signal Processors\n\nThis module provides additional HAYSTACK_SIGNAL_PROCESSOR classes to reindex more effeciently.\nThey may be tied to var... | python | chosen |
[
{
"from": "human",
"value": "Add script to remove notes\n\nThe script can be used to remove the notes in a compiled presentation.\nThis is useful when publishing slides so the notes intended for the\npresenter only are not published as well.\n"
},
{
"from": "gpt",
"value": "#!/usr/bin/env python... | python | chosen |
[
{
"from": "human",
"value": "Add ep.io config for historical purposes.\n"
},
{
"from": "gpt",
"value": "\"\"\"\\\nEpio Config\n\nThe recommended usage of this file is to rename it to <servername>_config.py.\nThis can be loaded by setting the SETTINGS_MODULE environment variable to here.\n\nSee '... | python | chosen |
[
{
"from": "system",
"value": "Support for log_delay for all tasks\n"
},
{
"from": "human",
"value": "import logging\n\n\nclass BaseTask(object):\n TASK_API_VERSION = 1\n\n def __init__(self, bot, config):\n \"\"\"\n\n :param bot:\n :type bot: pokemongo_bot.PokemonGoBot\n :param con... | python | chosen |
[
{
"from": "human",
"value": "Add a test for custom struct examples.\n"
},
{
"from": "gpt",
"value": "import re\nimport unittest\n\nfrom example_tests import example_test\n\n\nclass TestCustomStruct(unittest.TestCase):\n\n def test_builtin_vectors(self):\n output = example_test.run_exam... | python | chosen |
[
{
"from": "human",
"value": "Add first pass at a PackageVersion class\n"
},
{
"from": "gpt",
"value": "# *-8 coding: utf-8 -*-\n\"\"\"\nParse requirements file, and work out whether there are any updates.\n\"\"\"\nimport requests\nfrom semantic_version import Version\n\n\ndef package_url(package... | python | chosen |
[
{
"from": "human",
"value": "Add a script to pin deps\n"
},
{
"from": "gpt",
"value": "#!/usr/bin/env python\n# -*- coding: utf-8 -*-\n\n\nimport os\nimport subprocess as sp\nfrom tempfile import mkstemp\n\n\ndef skip(g, *ks):\n for k, x in enumerate(g):\n if k not in ks:\n ... | python | chosen |
[
{
"from": "human",
"value": "Add state-averaged test (benchmarks not yet added), for testing.\n"
},
{
"from": "gpt",
"value": "#!/usr/bin/env python\n\nimport unittest\nimport numpy\nfrom pyscf import gto\nfrom pyscf import scf\nfrom pyscf import mcscf\nfrom pyscf import fciqmcscf\n\nb = 1.4\nmo... | python | chosen |
[
{
"from": "system",
"value": "Set Postgres autocommit as supported only if server version is < 7.4\n\nThe server-side autocommit setting was removed here http://www.postgresql.org/docs/7.4/static/release-7-4.html\n\nResolves: #690\n"
},
{
"from": "human",
"value": "import psycopg2\n\nfrom airflo... | python | chosen |
[
{
"from": "human",
"value": "Add tests for base class.\n"
},
{
"from": "gpt",
"value": "\"\"\"Test the Reporter base class.\"\"\"\n\nimport pytest\n\n\n@pytest.fixture\ndef klass():\n \"\"\"Return the CUT.\"\"\"\n from agile_analytics.reporters import Reporter\n return Reporter\n\n\ndef... | python | chosen |
[
{
"from": "human",
"value": "Split logging functions from utilities.py into its own file.\n"
},
{
"from": "gpt",
"value": "# -*- coding: utf-8 -*-\n\n# MIT license\n#\n# Copyright (C) 2019 by XESS Corp.\n#\n# Permission is hereby granted, free of charge, to any person obtaining a copy\n# of this... | python | chosen |
[
{
"from": "human",
"value": "Write a script to get the details for all records in the H2020 dump\n"
},
{
"from": "gpt",
"value": "import csv\nimport json\nimport sys\nimport tqdm\n\nfrom cordis_scraper import get_project\n\ndataset_path = sys.argv[1]\noutput_path = sys.argv[2]\n\nwith open(datas... | python | chosen |
[
{
"from": "human",
"value": "Add script to create mask applied dataset\n"
},
{
"from": "gpt",
"value": "#!/usr/bin/env python\n# -*- coding: utf-8 -*-\n\nimport argparse\nimport os\nimport re\n\nimport cv2\nfrom jsk_recognition_utils import bounding_rect_of_mask\n\n\nparser = argparse.ArgumentPa... | python | chosen |
[
{
"from": "human",
"value": "Add solution for problem 30\n"
},
{
"from": "gpt",
"value": "#!/usr/bin/python\n\npower_sum = 0\n# Upper limit is a 6 digits number\nfor i in range(2, (9 ** 5) * 6):\n # I'm loving Python sugar\n if sum(int(j) ** 5 for j in str(i)) == i:\n # If you want ... | python | chosen |
[
{
"from": "system",
"value": "Return a fallback \"version\" if dosage is not installed\n\nAdditionally, inform the user on how to fix the problem. Thanks to twb\nfor noticing this.\n"
},
{
"from": "human",
"value": "# -*- coding: utf-8 -*-\n# Copyright (C) 2004-2008 Tristan Seligmann and Jonatha... | python | chosen |
[
{
"from": "human",
"value": "Add extinction strain rate example\n"
},
{
"from": "gpt",
"value": "#!/usr/bin/python\n\"\"\"\nA steady flame is established at a starting strain rate far from exctinction.\nThen the strain rate parameter (a) is systematically increased until a steady\nflame can no l... | python | chosen |
[
{
"from": "human",
"value": "Test to apply anomaly detection Q.C.\n"
},
{
"from": "gpt",
"value": "#!/usr/bin/env python\n# -*- coding: utf-8 -*-\n\n\"\"\" Check anomaly detection QC test\n\"\"\"\n\nimport numpy as np\n\nfrom cotede.utils.supportdata import download_testdata\nfrom cotede.qc impo... | python | chosen |
[
{
"from": "human",
"value": "examples: Add example of I2C usage, taking PyBoard accelerometer as subject.\n"
},
{
"from": "gpt",
"value": "# This is an example on how to access accelerometer on\n# PyBoard directly using I2C bus. As such, it's more\n# intended to be an I2C example, rather than ac... | python | chosen |
[
{
"from": "human",
"value": "Add unittest for daphn3 mutator.\n"
},
{
"from": "gpt",
"value": "import unittest\nfrom ooni.kit import daphn3\n\nclass TestDaphn3(unittest.TestCase):\n def test_mutate_string(self):\n original_string = '\\x00\\x00\\x00'\n mutated = daphn3.daphn3Muta... | python | chosen |
[
{
"from": "human",
"value": "Add test for 256bit address signing and verification\n"
},
{
"from": "gpt",
"value": "#!/usr/bin/env python3\n# Copyright (c) 2016-2018 The Bitcoin Core developers\n# Distributed under the MIT software license, see the accompanying\n# file COPYING or http://www.opens... | python | chosen |
[
{
"from": "human",
"value": "Make tests trivially runnable without py.test\n"
},
{
"from": "gpt",
"value": "import unittest\n\n# Import test modules.\nfrom .test_events import *\nfrom .test_forms import *\nfrom .test_frames import *\nfrom .test_navigation import *\nfrom .test_open import *\nfrom... | python | chosen |
[
{
"from": "human",
"value": "Add unit tests for pack db models\n"
},
{
"from": "gpt",
"value": "# Licensed to the StackStorm, Inc ('StackStorm') under one or more\n# contributor license agreements. See the NOTICE file distributed with\n# this work for additional information regarding copyright ... | python | chosen |
[
{
"from": "human",
"value": "Add model for 'autoreg' table\n"
},
{
"from": "gpt",
"value": "from django.db import models\n\n\nclass Autoreg(models.Model):\n class Meta:\n db_table = 'autoreg'\n\n mac = models.CharField(max_length=17, db_index=True)\n ip = models.IntegerField(prim... | python | chosen |
[
{
"from": "human",
"value": "Add script to rank tne activities on when they reached a specific target\n"
},
{
"from": "gpt",
"value": "from datetime import date\nimport xlsxwriter\n\nfrom bluebottle.clients.models import Client\nfrom bluebottle.clients.utils import LocalTenant\n\nfrom bluebottle... | python | chosen |
[
{
"from": "human",
"value": "Make a B+C config HI cube matched to the C-only\n"
},
{
"from": "gpt",
"value": "\n'''\nFor comparison, smooth and regrid to the 14B data.\n'''\n\nimport os\n\nfrom cube_analysis.reprojection import reproject_cube\n\nfrom paths import (data_path, fourteenB_wGBT_HI_fi... | python | chosen |
[
{
"from": "human",
"value": "Add script to convert nodes.json version 2 to version 1\n"
},
{
"from": "gpt",
"value": "#!/usr/bin/env python3 \nimport json\nimport argparse\nimport os\nimport sys\n\nparser = argparse.ArgumentParser()\n... | python | chosen |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.