conversations listlengths 2 3 | source stringclasses 1
value | stack stringclasses 1
value |
|---|---|---|
[
{
"from": "human",
"value": "Add unit test for get_annual_publication_count\n"
},
{
"from": "gpt",
"value": "import kpub\n\n\ndef test_annual_count():\n # Does the cumulative count match the annual count?\n db = kpub.PublicationDB()\n annual = db.get_annual_publication_count()\n cumu... | python | chosen |
[
{
"from": "human",
"value": "Add updated help text for order in networkgroup\n"
},
{
"from": "gpt",
"value": "# -*- coding: utf-8 -*-\nfrom __future__ import unicode_literals\n\nfrom django.db import migrations, models\n\n\nclass Migration(migrations.Migration):\n\n dependencies = [\n ... | python | chosen |
[
{
"from": "human",
"value": "Add tests for protected tags\n"
},
{
"from": "gpt",
"value": "from gitlabform.gitlabform.test import (\n run_gitlabform,\n)\n\n\nclass TestArchiveProject:\n def test__archive_project(self, gitlab, group, project):\n group_and_project = f\"{group}/{projec... | python | chosen |
[
{
"from": "human",
"value": "Read Dakota tabular graphics output file\n"
},
{
"from": "gpt",
"value": "\"\"\"Make plots of the results of Dakotathon experiments.\"\"\"\n\nimport numpy as np\nimport matplotlib.pyplot as mpl\n\n\n\ndef read_dat_header(dat_file):\n try:\n with open(dat_fi... | python | chosen |
[
{
"from": "human",
"value": "Add script to generate script from pbm files\n"
},
{
"from": "gpt",
"value": "import sys\nimport re\n\nwith open(sys.argv[1]) as f:\n magic = f.readline().strip()\n if magic != \"P1\":\n print \"Expected file to start with P1\"\n sys.exit(1)\n\n ... | python | chosen |
[
{
"from": "human",
"value": "Add a dumps_bytes() helper method to handle Python 2/3 compatibility.\n"
},
{
"from": "gpt",
"value": "# Copyright Least Authority Enterprises.\n# See LICENSE for details.\n\n\"\"\"\nHelpers for Python 2/3 compatibility.\n\"\"\"\n\nfrom json import dumps\n\nfrom twis... | python | chosen |
[
{
"from": "human",
"value": "Add script to subsample bam file entries\n"
},
{
"from": "gpt",
"value": "#!/usr/bin/env python\n\"\"\"\n\nThis script subsamples the alignments of a BAM file. For this a\nlikelihood (0.0 < p(keep) < 1.0) of keeping all alignments of a read\nhas to be provided. All a... | python | chosen |
[
{
"from": "human",
"value": "Add management command to add a refendeum election\n\n- Added to allow us to add Croydon referendum initially, with\nthe possibility of being able to use again in the future as required\n"
},
{
"from": "gpt",
"value": "from django.core.management import BaseCommand\n... | python | chosen |
[
{
"from": "human",
"value": "Add tests for download of game summaries\n"
},
{
"from": "gpt",
"value": "#!/usr/bin/env python\n# -*- coding: utf-8 -*-\n\nimport os\nimport itertools\nimport tempfile\nfrom zipfile import ZipFile\n\nfrom utils.summary_downloader import SummaryDownloader\n\n\ndef te... | python | chosen |
[
{
"from": "human",
"value": "Add queue thread convenience classes.\n"
},
{
"from": "gpt",
"value": "#! /usr/bin/env python\n\nimport threading\nimport time\n\nfrom pika.adapters import BlockingConnection\n\nclass QueueThread(threading.Thread):\n def __init__(self):\n threading.Thread.__init_... | python | chosen |
[
{
"from": "human",
"value": "Add testcase for pow builtin\n"
},
{
"from": "gpt",
"value": "# adapted from cython/tests/run/builtin_pow.pyx\n\n\"\"\"\n>>> pow3(2,3,5)\n3\n>>> pow3(3,3,5)\n2\n\n>>> pow3_const()\n3\n\n>>> pow2(2,3)\n8\n>>> pow2(3,3)\n27\n\n>>> pow2_const()\n8\n\"\"\"\n\n@autojit(ba... | python | chosen |
[
{
"from": "human",
"value": "Add a test case for auth protected inputs.\n"
},
{
"from": "gpt",
"value": "from disco.test import DiscoJobTestFixture, DiscoTestCase\n\nfrom disco.ddfs import DDFS\nfrom disco.util import ddfs_name\n\nfrom cStringIO import StringIO\n\nclass AuthJobTestCase(DiscoJobT... | python | chosen |
[
{
"from": "human",
"value": "Allow different schedulers for compute and volume."
},
{
"from": "gpt",
"value": "# vim: tabstop=4 shiftwidth=4 softtabstop=4\n\n# Copyright (c) 2010 Openstack, LLC.\n# Copyright 2010 United States Government as represented by the\n# Administrator of the National Aer... | python | chosen |
[
{
"from": "human",
"value": "Add a script to import elected candidates' photos from YNR\n\nThis script uses the YNR IDs that the kenya_import_2017_election_results\ncommand added to import the photos from YNR and add them to the\nappropriate person in Mzalendo. If there were existing photos of the\nperson, ... | python | chosen |
[
{
"from": "system",
"value": "Adjust gRPC/Python sample to handle events.\n"
},
{
"from": "human",
"value": "import coprocess_object_pb2\n\nimport grpc, time\n\n_ONE_DAY_IN_SECONDS = 60 * 60 * 24\n\nfrom concurrent import futures\n\ndef MyPreMiddleware(coprocess_object):\n coprocess_object.requ... | python | chosen |
[
{
"from": "system",
"value": "Exit with code 1 if tests fail.\n\nFixes #621 and Travis.\n"
},
{
"from": "human",
"value": "#!/usr/bin/python\nimport optparse\nimport sys\n# Install the Python unittest2 package before you run this script.\nimport unittest2\n\nUSAGE = \"\"\"%prog SDK_PATH\nRun uni... | python | chosen |
[
{
"from": "human",
"value": "Add ticket's status column migration.\n"
},
{
"from": "gpt",
"value": "\"\"\"Add status column to tickets.\n\nRevision ID: ec3035d61f8b\nRevises: 0397e48c5db8\nCreate Date: 2020-08-30 21:04:30.936267\n\n\"\"\"\nfrom alembic import op\nimport sqlalchemy as sa\n\n\n# r... | python | chosen |
[
{
"from": "human",
"value": "TST: Add tests for combining functions\n"
},
{
"from": "gpt",
"value": "from __future__ import division, print_function, absolute_import\n\nfrom nose.plugins.attrib import attr\nfrom nose.tools import assert_raises, raises\n\nimport numpy as np\nfrom scipy.stats impo... | python | chosen |
[
{
"from": "human",
"value": "Decrypt NACL passwords on ext_pillar\n"
},
{
"from": "gpt",
"value": "# -*- coding: utf-8 -*-\n\n'''\nDecrypt pillar data through the builtin NACL renderer\n\nIn most cases, you'll want to make this the last external pillar used. For\nexample, to pair with the builti... | python | chosen |
[
{
"from": "human",
"value": "feat: Add (currently empty) neural netowrks module\n\n"
},
{
"from": "gpt",
"value": "#!/usr/bin/env python2\n# -*- coding: utf-8 -*-\n\"\"\"\nCreated on Thu Apr 27 14:10:49 2017\n\n@author: daniele\n\"\"\"\n\nimport tensorflow as tf\n\nimport os\n\nimport numpy as n... | python | chosen |
[
{
"from": "system",
"value": "Update test for recent version of agate\n"
},
{
"from": "human",
"value": "#!/usr/bin/env python\n# -*- coding: utf8 -*-\n\ntry:\n import unittest2 as unittest\nexcept ImportError:\n import unittest\n\nimport agate\nimport agateremote\n\nclass TestArchive(agat... | python | chosen |
[
{
"from": "human",
"value": "Add tests for player draft items\n"
},
{
"from": "gpt",
"value": "#!/usr/bin/env python\n# -*- coding: utf-8 -*-\n\nfrom db.player_draft import PlayerDraft\nfrom db.team import Team\n\n\ndef test_find_by_id():\n pdft = PlayerDraft.find_by_player_id(8475883) # Fre... | python | chosen |
[
{
"from": "human",
"value": "Refactor HTTP Error status in a module\n"
},
{
"from": "gpt",
"value": "# -*- coding: utf8 -*-\n# This file is part of PyBossa.\n#\n# Copyright (C) 2013 SF Isle of Man Limited\n#\n# PyBossa is free software: you can redistribute it and/or modify\n# it under the terms... | python | chosen |
[
{
"from": "human",
"value": "Add a Python script to get ROM and RAM usage.\n"
},
{
"from": "gpt",
"value": "#!/usr/bin/env python\n\nfrom subprocess import Popen, PIPE\n\n\nclass app(object):\n def __init__(self):\n pass\n\n\nmotolink = app()\nmotolink.name = \"ch\"\nmotolink.path = \"... | python | chosen |
[
{
"from": "human",
"value": "Set up logging for a MongoDB cluster\n"
},
{
"from": "gpt",
"value": "import logging\n\nclass MongoCluster(object):\n\n log = logging.getLogger('Clusters.Mongo')\n log.setLevel(logging.DEBUG)\n ch = logging.StreamHandler()\n ch.setLevel(logging.DEBUG)\n ... | python | chosen |
[
{
"from": "human",
"value": "Add socket io client example"
},
{
"from": "gpt",
"value": "import websocket, httplib, sys, asyncore\n\n'''\n connect to the socketio server\n 1. perform the HTTP handshake\n 2. open a websocket connection '''\ndef connect(server, port):\n \n print(\"c... | python | chosen |
[
{
"from": "human",
"value": "Add python dynamic class sample\n"
},
{
"from": "gpt",
"value": "# -*- coding:utf-8 -*-\n\n\nclass CanDoSomething(object):\n\n message = \"You don't have permission\"\n\n def has_permission(self, request, view):\n return True\n\n\nclass CanDoSomethingOrR... | python | chosen |
[
{
"from": "human",
"value": "Add Windows support to group add\nAdd, remove and get info on Local Windows Groups\n"
},
{
"from": "gpt",
"value": "'''\nManage groups on Windows\n'''\n\ndef __virtual__():\n '''\n Set the group module if the kernel is Windows\n '''\n return 'group' if _... | python | chosen |
[
{
"from": "human",
"value": "Convert script for .gif -> spritesheet.\n"
},
{
"from": "gpt",
"value": "from AppKit import NSApplication, NSImage, NSImageCurrentFrame, NSGIFFileType; import sys, os\n\ndirname = sys.argv[1]\nfiles = os.listdir(dirname)\nfor f in files:\n if '.gif' not in f: cont... | python | chosen |
[
{
"from": "human",
"value": "Add subprocess trial for webserver app\n"
},
{
"from": "gpt",
"value": "import subprocess\nimport datetime\nfrom flask import Flask, render_template, redirect, url_for, request\n\napp = Flask(__name__)\n\n\n@app.route('/')\ndef index():\n return render_template('i... | python | chosen |
[
{
"from": "human",
"value": "Add silly un-mathy rotation function\n"
},
{
"from": "gpt",
"value": "from numpy import array, cross, eye, dot\nfrom scipy.linalg import expm3,norm\nfrom math import sin, cos\n\ndef rotate(axis, vector, angle):\n if axis == 'x':\n m = array([\n [... | python | chosen |
[
{
"from": "system",
"value": "Make comment of 'add_a_getter' method\n"
},
{
"from": "human",
"value": "import copy\n\ndef add_a_field(cls, field):\n setattr(cls, field.string, field)\n pass\n\ndef add_a_getter(cls, field):\n fieldname = field.string\n getter_template = copy.deepcopy(... | python | chosen |
[
{
"from": "human",
"value": "Add a test for git_branch_list rule\n"
},
{
"from": "gpt",
"value": "from thefuck import shells\nfrom thefuck.rules.git_branch_list import match, get_new_command\nfrom tests.utils import Command\n\ndef test_match():\n assert match(Command('git branch list'), None)... | python | chosen |
[
{
"from": "human",
"value": "Add pythonic way to install\n"
},
{
"from": "gpt",
"value": "from setuptools import setup\n\nsetup(name='LpSchedule',\n version='0.1',\n description='A API for Lviv Polytechnik schedule',\n author='Stepanov Valentyn',\n author_email='mr.valentyn.s... | python | chosen |
[
{
"from": "system",
"value": "Prepare for next development cycle.\n"
},
{
"from": "human",
"value": "from distutils.core import setup\n\nsetup(\n name='udiskie',\n version='0.3.8',\n description='Removable disk automounter for udisks',\n author='Byron Clark',\n author_email='byron... | python | chosen |
[
{
"from": "human",
"value": "Add py solution for 485. Max Consecutive Ones\n\n485. Max Consecutive Ones: https://leetcode.com/problems/max-consecutive-ones/\n"
},
{
"from": "gpt",
"value": "class Solution(object):\n def findMaxConsecutiveOnes(self, nums):\n \"\"\"\n :type nums: ... | python | chosen |
[
{
"from": "human",
"value": "Add test on anonymous file\n"
},
{
"from": "gpt",
"value": "# Copyright 2021 Sean Vig\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 of the License a... | python | chosen |
[
{
"from": "human",
"value": "Add example for pulling interfaces.\n"
},
{
"from": "gpt",
"value": "#!/usr/bin/env python\nimport requests\nfrom orionsdk import SwisClient\n\n\nnpm_server = 'localhost'\nusername = 'admin'\npassword = ''\n\nverify = False\nif not verify:\n from requests.packages... | python | chosen |
[
{
"from": "system",
"value": "Update the default twitter query since it's been flooded by movie tweets.\n"
},
{
"from": "human",
"value": "\"\"\"\nDefault settings for the ``mezzanine.twitter`` app. Each of these can be\noverridden in your project's settings module, just like regular\nDjango set... | python | chosen |
[
{
"from": "human",
"value": "Add a new example of powering on many VMs at once\n"
},
{
"from": "gpt",
"value": "#!/usr/bin/python\n\nimport time\nimport sys\n\nfrom psphere.client import Client\nfrom psphere.managedobjects import VirtualMachine\n\nscatter_secs = 8\n\nnodes = sys.argv[1:]\n\nclie... | python | chosen |
[
{
"from": "human",
"value": "Test of the pwd module\n"
},
{
"from": "gpt",
"value": "import pwd\nimport string\n\nverbose = 0\nif __name__ == '__main__':\n verbose = 1\n\nentries = pwd.getpwall()\n\nfor e in entries:\n name = e[0]\n uid = e[2]\n if verbose:\n\tprint name, uid\n db... | python | chosen |
[
{
"from": "human",
"value": "Add migration for CaseOffenceFilter model\n"
},
{
"from": "gpt",
"value": "# -*- coding: utf-8 -*-\nfrom __future__ import unicode_literals\n\nfrom django.db import models, migrations\n\n\nclass Migration(migrations.Migration):\n\n dependencies = [\n ('plea... | python | chosen |
[
{
"from": "system",
"value": "Change URL to point to GitHub\n"
},
{
"from": "human",
"value": "from setuptools import setup\n\nsetup(\n name=\"livejson\",\n version=\"0.1\",\n description=\"Bind Python objects to JSON files\",\n long_description=(\"An interface to transparantly bind ... | python | chosen |
[
{
"from": "human",
"value": "Add basic, and probably incomplete setyp.py.\n"
},
{
"from": "gpt",
"value": "#!/usr/bin/env python\n# -*- coding: utf-8 -*-\n\nfrom __future__ import print_function\nfrom setuptools import setup\nfrom setuptools.command.test import test as TestCommand\nimport io\nim... | python | chosen |
[
{
"from": "human",
"value": "Add program to calculate Linear Prediction Coefficients\n"
},
{
"from": "gpt",
"value": "# -*- coding: utf-8 -*-\n\"\"\"\nCreated on Sat Feb 27 22:01:37 2016\n\n@author: ORCHISAMA\n\"\"\"\n\n#calculate LPC coefficients from sound file\nfrom __future__ import division... | python | chosen |
[
{
"from": "human",
"value": "Add Analysis and InPlaceAnalysis base classes for analyzing experiment results.\n"
},
{
"from": "gpt",
"value": "import os\nimport retrying\nimport sys\nfrom .. import BaseAction\nfrom .. import experiments\nfrom ..helpers import get_first_existing_path, get_multipri... | python | chosen |
[
{
"from": "human",
"value": "Move template filters out of init file\n"
},
{
"from": "gpt",
"value": "\nimport re\nimport json\n\n\ndef nl2br(value):\n if value:\n _newline_re = re.compile(r'(?:\\r\\n|\\r|\\n)')\n return _newline_re.sub('<br>', value)\n\n\ndef tab2spaces(value):\... | python | chosen |
[
{
"from": "human",
"value": "Add tracking of zenodo file, put the secret key in the secret place.\n"
},
{
"from": "gpt",
"value": "import json\nimport requests \nfrom os.path import basename\nfrom dissemin.settings import ZENODO_KEY\n#THIS IS PRIVATE\n\n\n#url = \"https://zenodo.org/api/deposit/... | python | chosen |
[
{
"from": "human",
"value": "Check if n and double of n exists\n"
},
{
"from": "gpt",
"value": "# https://leetcode.com/problems/check-if-n-and-its-double-exist/\n# Given an array arr of integers, check if there exists two integers N and M such that\n# N is the double of M ( i.e. N = 2 * M).\n# M... | python | chosen |
[
{
"from": "human",
"value": "Add Diagonal Difference HackerRank Problem\n\n* https://www.hackerrank.com/challenges/diagonal-difference\n"
},
{
"from": "gpt",
"value": "#!/usr/bin/env python\nfrom typing import List\n\ndef get_matrix_row_from_input() -> List[int]:\n return [int(index) for inde... | python | chosen |
[
{
"from": "human",
"value": "Add tests for classify() method\n"
},
{
"from": "gpt",
"value": "#!/usr/bin/env python\n# -*- encoding: utf-8\n\nimport unittest\nfrom src.emo_cls import EmoClassifier\nfrom src.ec_settings import POS, NEG, NO_CLASS\n\nec = EmoClassifier(terms_fn=None,\n ... | python | chosen |
[
{
"from": "human",
"value": "Add tests to make CI happy\n"
},
{
"from": "gpt",
"value": "from bioframe.region import parse_region\nimport pytest\n\n\ndef test_parse_region():\n # UCSC-style names\n assert parse_region(\"chr21\") == (\"chr21\", 0, None)\n assert parse_region(\"chr21:1000... | python | chosen |
[
{
"from": "system",
"value": "Use a dev api token\n"
},
{
"from": "human",
"value": "import os\n\n\nclass Config(object):\n DEBUG = False\n ASSETS_DEBUG = False\n cache = False\n manifest = True\n\n SQLALCHEMY_COMMIT_ON_TEARDOWN = False\n SQLALCHEMY_RECORD_QUERIES = True\n S... | python | chosen |
[
{
"from": "human",
"value": "Create test harness for 'Read' and 'ReadParser' classes. (Note: Need to finish writing tests.)\n"
},
{
"from": "gpt",
"value": "# Tests for the ReadParser and Read classes.\n\n\nimport khmer\nfrom khmer import ReadParser\nimport khmer_tst_utils as utils\n\n\ndef test... | python | chosen |
[
{
"from": "human",
"value": "Add test to check range ghost are removed\n"
},
{
"from": "gpt",
"value": "from dtest import Tester\nfrom tools import *\nfrom assertions import *\n\nimport os, sys, time\nfrom ccmlib.cluster import Cluster\n\nclass TestRangeGhosts(Tester):\n\n def ghosts_test(sel... | python | chosen |
[
{
"from": "human",
"value": "[KE] Add command to email unassigned aliases\n\nThis is currently done as part of the `bin/update_hansard.bash` script,\nwhich runs the `hansard_list_unmatched_speakers` command. We want it to\nbe separate so that errors from running the Hansard update script go to\ndevelopers, ... | python | chosen |
[
{
"from": "human",
"value": "Add a logistic regression example\n"
},
{
"from": "gpt",
"value": "import os\nimport numpy as np\nimport matplotlib.pyplot as plt\n\nfrom keras.models import Sequential\nfrom keras.layers.core import Dense, Activation\n\n\"\"\"2-class logistic regression by keras\"\"... | python | chosen |
[
{
"from": "human",
"value": "Add script to extract table of propulsion methods\n\nTODO: Organize code\n"
},
{
"from": "gpt",
"value": "from lxml import etree\nfrom urllib.request import urlopen\n\nimport pandas as pd\n\nDATA_URL = \"https://en.wikipedia.org/w/index.php?title=Spacecraft_propulsio... | python | chosen |
[
{
"from": "human",
"value": "Include script to get users from jamdb lookit\n"
},
{
"from": "gpt",
"value": "import requests\nimport json\n\nJAMDB_AUTHORIZATION_TOKEN = 'JWT_SECRET_TOKEN'\n# To set this make this request\n# POST https://metadata.osf.io/v1/auth\n#\n# {\n# \"data\": {\n# \"ty... | python | chosen |
[
{
"from": "human",
"value": "Put my custom assert function into its own module.\n"
},
{
"from": "gpt",
"value": "from __future__ import print_function\n\ndef areEqual(expect, val, eps = 0.01):\n print(\"Expected: \", expect, \" actual: \", val)\n try:\n diff = abs(float(val) / float... | python | chosen |
[
{
"from": "human",
"value": "Add test for nonce generation\n"
},
{
"from": "gpt",
"value": "import unittest\nfrom nonce import *\n\nclass NonceTestCase(unittest.TestCase):\n\n def test_nonces(self):\n nonces = generate_nonces(42560, 661771, 4)\n self.assertEqual(nonces[0], 0x8c6... | python | chosen |
[
{
"from": "system",
"value": "Remove Django 1.9 simple_tag reference\n"
},
{
"from": "human",
"value": "import django\nfrom django import template\nfrom django_countries.fields import Country, countries\n\n\nregister = template.Library()\n\nif django.VERSION < (1, 9):\n # Support older versio... | python | chosen |
[
{
"from": "system",
"value": "Allow running tests with postgres\n"
},
{
"from": "human",
"value": "#!/usr/bin/env python\nimport sys\nfrom os.path import dirname, abspath\n\nfrom django.conf import settings\n\nif not settings.configured:\n settings.configure(\n DATABASE_ENGINE = 'sqlit... | python | chosen |
[
{
"from": "human",
"value": "migration: Add migration to remove user values for deleted options.\n\nThis commit adds migration to delete CustomProfileFieldValue\nobjects for deleted options of SELECT type custom profile\nfields.\n"
},
{
"from": "gpt",
"value": "# Generated by Django 3.2.13 on 20... | python | chosen |
[
{
"from": "system",
"value": "Add convert for the various RDDs\n"
},
{
"from": "human",
"value": "class Dummy(object):\n sum = max = min = count = distinct = mean = variance = stdev = None\n\ntry:\n from pyspark import SparkContext\n import pyspark\n from pyspark.rdd import RDD\n ... | python | chosen |
[
{
"from": "system",
"value": "Change to one package per line for channel import\n\nResolves #19.\n\nWhile this doesn't switch to the ideal standard of one import, one\nline, it makes the import from `flowz.channels.core` into\n`flowz.channels` easier to read and less likely to invite conflicts.\n\nDidn't go... | python | chosen |
[
{
"from": "human",
"value": "Add keycode table generator for Windows\n"
},
{
"from": "gpt",
"value": "#!/usr/bin/env python\nimport re, sys, os\nif len(sys.argv) != 2:\n print >>sys.stderr, \"Usage: win.py path/to/WinUser.h\"\n sys.exit(1)\nOUT = 'win2.txt'\nTMP = OUT + '.tmp'\nf = open(TM... | python | chosen |
[
{
"from": "human",
"value": "Add a Python 3000 emitter.\n"
},
{
"from": "gpt",
"value": "\"\"\"\\\nPython code emitter for C'Dent\n\"\"\"\n\nfrom cdent.emitter import Emitter as Base\n\nclass Emitter(Base):\n LANGUAGE_ID = 'py3'\n BLOCK_COMMENT_BEGIN = '\"\"\"\\\\\\n'\n BLOCK_COMMENT_PR... | python | chosen |
[
{
"from": "human",
"value": "Add experimental version of line.py (fancier :fire:)\n"
},
{
"from": "gpt",
"value": "from nxt import locator\nfrom nxt.sensor.common import PORT_1, PORT_2, PORT_3, PORT_4\nfrom nxt.motor import PORT_A, PORT_B, PORT_C\nfrom scripts.robot import Robot, SERVO_NICE, ON,... | python | chosen |
[
{
"from": "human",
"value": "Add limited unit test for tank structure.\n"
},
{
"from": "gpt",
"value": "import unittest\nimport tank_structure as ts\nfrom units import inch2meter, psi2pascal\n\n\nclass TestStringMethods(unittest.TestCase):\n\n def test_sample_8_3(self):\n # Do sample p... | python | chosen |
[
{
"from": "system",
"value": "docs: Fix building the docs without RTD theme.\n\nSigned-off-by: Andreas Schneider <5be00ddc76278cf6077f5047ca3384a88460c671@cryptomilk.org>\n"
},
{
"from": "human",
"value": "# vim:fileencoding=utf-8:noet\n\nimport os\nimport sys\n\nsys.path.insert(0, os.path.dirna... | python | chosen |
[
{
"from": "human",
"value": "Add basic test for inelastic_cs_fn, similar to phonon\n"
},
{
"from": "gpt",
"value": "from cstool.parse_input import (parse_to_model, check_settings, cstool_model)\nfrom cstool.inelastic import (inelastic_cs_fn)\nfrom cslib import (units)\n\nimport numpy as np\n\npm... | python | chosen |
[
{
"from": "human",
"value": "Add a snippet (walk directory).\n"
},
{
"from": "gpt",
"value": "#!/usr/bin/env python3\n# -*- coding: utf-8 -*-\n\nimport argparse\nimport os\n\n# GET THE ROOT DIRECTORY ######################################################\n\nparser = argparse.ArgumentParser(descr... | python | chosen |
[
{
"from": "human",
"value": "Add tests derived from RFC 3720, section B.4.\n"
},
{
"from": "gpt",
"value": "import pytest\n\n\ndef _call_extend(crc, chunk):\n import crc32c\n return crc32c.extend(crc, chunk, len(chunk))\n\n\ndef test_extend_w_empty_chunk():\n assert _call_extend(123, b'... | python | chosen |
[
{
"from": "human",
"value": "FIx fiscal offset. Could be negative too\n"
},
{
"from": "gpt",
"value": "# Generated by Django 2.2.24 on 2022-09-23 12:20\n\nimport bluebottle.bb_accounts.models\nfrom django.db import migrations, models\nimport django.db.models.deletion\n\n\nclass Migration(migrati... | python | chosen |
[
{
"from": "human",
"value": "Add solution to first problem\n"
},
{
"from": "gpt",
"value": "def calc():\n return sum(x for x in range(1000) if (x % 3) == 0 or (x % 5) == 0)\n\nif __name__ == \"__main__\":\n print(calc())\n"
}
] | python | chosen |
[
{
"from": "human",
"value": "Add unit tests for spam check\n"
},
{
"from": "gpt",
"value": "from sendgrid.helpers.mail.spam_check import SpamCheck\n\ntry:\n import unittest2 as unittest\nexcept ImportError:\n import unittest\n\n\nclass UnitTests(unittest.TestCase):\n\n def test_spam_all... | python | chosen |
[
{
"from": "human",
"value": "Add Newton solver for non-linear equations\n"
},
{
"from": "gpt",
"value": "import timeit\n\nimport numpy as np\nfrom scipy.linalg import lu_factor, lu_solve\n\n\ndef newton(x0, func, jacobian, tol=1e-2, verbose=False):\n\tdx = None\n\tx = np.copy(x0)\n\tstep = 0\n\t... | python | chosen |
[
{
"from": "human",
"value": "Add a script to generate a tinyquery table literal from data in bigquery\n\nSummary:\nCreating tinyquery tables by hand is kind of a pain for tables of any\ncomplexity. This revision adds a script that takes a dataset and table on the\ncommand line and generates a tinyquery tab... | python | chosen |
[
{
"from": "human",
"value": "Write a Python function that returns the sum of the pairwise products of two lists\n"
},
{
"from": "gpt",
"value": "# Problem 5\n# 10.0 points possible (graded)\n# Write a Python function that returns the sum of the pairwise products of listA and listB. You should as... | python | chosen |
[
{
"from": "human",
"value": "Add command to add new recipes\n"
},
{
"from": "gpt",
"value": "# cerbero - a multi-platform build system for Open Source software\n# Copyright (C) 2012 Andoni Morales Alastruey <ylatuya@gmail.com>\n#\n# This library is free software; you can redistribute it and/or\n... | python | chosen |
[
{
"from": "human",
"value": "Add script to plot benchmark results with matplotlib\n"
},
{
"from": "gpt",
"value": "#!/usr/bin/env python\n# -*- coding: utf-8 -*-\n\nimport sys\nimport pickle\nfrom matplotlib import pyplot as plt\n\nif len(sys.argv) < 2:\n sys.exit(\"Usage: plot-results.py <pi... | python | chosen |
[
{
"from": "human",
"value": "Add a small script to pull translation state from compile logs.\n"
},
{
"from": "gpt",
"value": "#!/usr/bin/env python\n# Extracts the progress of translations from the compilation\n# log in easily readable form. Make sure to delete all .qm\n# files beforehand.\n#\n#... | python | chosen |
[
{
"from": "human",
"value": "Add character encoding error handler\n"
},
{
"from": "gpt",
"value": "\"\"\"Character encoding error handlers.\"\"\"\n\n__all__ = [\n 'make_error_logger',\n]\n\n\ndef make_error_logger(logger):\n \"\"\"Make handlers that logs and ignores encoding errors.\"\"\"\... | python | chosen |
[
{
"from": "human",
"value": "Add a test for simulate_dialog\n"
},
{
"from": "gpt",
"value": "\nfrom .examples import load_email_client\nfrom ..policy import MDPDialogBuilder\nfrom ..util import simulate_dialog, cross_validation\n\n\nEMAIL_CLIENT = load_email_client()\n\n\ndef test_simulate_dialo... | python | chosen |
[
{
"from": "human",
"value": "Add tests for cross product\n"
},
{
"from": "gpt",
"value": "from ppb_vector import Vector2\nimport pytest\n\n@pytest.mark.parametrize(\"left, right, expected\", [\n (Vector2(1, 1), Vector2(0, -1), -1),\n (Vector2(1, 1), Vector2(-1, 0), 1),\n (Vector2(0, 1),... | python | chosen |
[
{
"from": "human",
"value": "Add script to generate images suitable for carousel.\n"
},
{
"from": "gpt",
"value": "\"\"\" XXX: Helper script ... \"\"\"\n\nfrom os.path import basename\nfrom PIL import Image\n\nASPECT_RATIOS = (1.5, 2, 2.5)\nPREFIX = '/assets/img/'\nSTYLE_MAPPING = {\n '1.5': ... | python | chosen |
[
{
"from": "human",
"value": "Add skeletal output test cases.\n"
},
{
"from": "gpt",
"value": "\"\"\"Test the output module.\"\"\"\n\nfrc_out = outputs.frc_eia923_df(pudl_engine)\ngens_out = outputs.gens_eia860_df(pudl_engine)\ngf_out = outputs.gf_eia923_df(pudl_engine)\npu_eia = outputs.plants_u... | python | chosen |
[
{
"from": "human",
"value": "Implement annealing learning rate schedules.\n"
},
{
"from": "gpt",
"value": "import abc\nfrom math import exp\n\n\"\"\"Classes for annealing learning rate schedules.\"\"\"\n\nclass AnnealingSchedule(object):\n\tdef __init__(self, initial_lr, decay_rate, decay_step):... | python | chosen |
[
{
"from": "human",
"value": "Add internal task to flush mail queue\n"
},
{
"from": "gpt",
"value": "#!/usr/bin/env python\n# -*- coding: utf-8 -*-\n#\n# NetProfile: Core module - Tasks\n# Copyright © 2017 Alex Unigovsky\n#\n# This file is part of NetProfile.\n# NetProfile is free software: you c... | python | chosen |
[
{
"from": "human",
"value": "Add simple test for included model IRF methods.\n"
},
{
"from": "gpt",
"value": "#! /usr/bin/env python\nimport os\n\nimport pytest\n\nfrom pymt import models\n\n\n@pytest.mark.parametrize(\"cls\", models.__all__)\ndef test_model_setup(cls):\n model = models.__dic... | python | chosen |
[
{
"from": "human",
"value": "Add the analysis driver script\n"
},
{
"from": "gpt",
"value": "#! /usr/bin/env python\n# Brokers communication between HydroTrend and Dakota through files.\n# Mark Piper (mark.piper@colorado.edu)\n\nimport sys\nimport os\nimport shutil\nfrom subprocess import call\n... | python | chosen |
[
{
"from": "human",
"value": "Add a unittest for spacegroup. Still very basic.\n\n\nFormer-commit-id: f539c5f894a6ebd867dfee0eeb5dc1248de11c97 [formerly 2a214050a30048eab177f696d891a33c2860bb55]\nFormer-commit-id: 26ca50b3c5eceb253d7371b8c0f2a4d08e7f48d7"
},
{
"from": "gpt",
"value": "#!/usr/bin/... | python | chosen |
[
{
"from": "human",
"value": "Add script used to add user counts stored in json file.\nStill need to modify this so that it is built directly.\n"
},
{
"from": "gpt",
"value": "\"\"\"\nTo each region, let's add the number of users that tweeted in the region.\n\n\"\"\"\nimport json\nimport pymongo\... | python | chosen |
[
{
"from": "human",
"value": "Add simple predict method to multi models\n"
},
{
"from": "gpt",
"value": "# -*- coding: utf-8 -*-\n#!/usr/bin/env python\n#\n# Copyright 2012 BigML\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\"); you may\n# not use this file except in complia... | python | chosen |
[
{
"from": "human",
"value": "Add draft of MNE example\n"
},
{
"from": "gpt",
"value": "\"\"\"\nUsing NeuroDSP with MNE\n=======================\n\nThis example explores some example analyses using NeuroDSP, integrated with MNE.\n\"\"\"\n\n#########################################################... | python | chosen |
[
{
"from": "human",
"value": "Add async task to update/create key ids.\n\nThis might need to be reworked so that Key instances always exist but then\nwe fill in 'name' etc. later/asynchronously.\n\nSigned-off-by: Chris Lamb <29e6d179a8d73471df7861382db6dd7e64138033@debian.org>\n"
},
{
"from": "gpt",
... | python | chosen |
[
{
"from": "system",
"value": "Include queued date in MQ messages"
},
{
"from": "human",
"value": "from tapiriik.database import db\nfrom tapiriik.messagequeue import mq\nfrom tapiriik.sync import Sync\nfrom datetime import datetime\nfrom pymongo.read_preferences import ReadPreference\nimport kom... | python | chosen |
[
{
"from": "human",
"value": "Add thermal conductivity trend analysis library.\n"
},
{
"from": "gpt",
"value": "# Analyze thermal conductivity results\n# Date: June 2017\n# Author: Kutay B. Sezginel\nimport os\nimport numpy as np\nfrom teemof.read import avg_kt, get_kt, read_runs, read_legend\n\n... | python | chosen |
[
{
"from": "human",
"value": "Add line SPW setup info for 16B\n"
},
{
"from": "gpt",
"value": "\n# Line SPW setup for 16B projects\nlinespw_dict = {0: [\"HI\", \"1.420405752GHz\"],\n 3: [\"OH1612\", \"1.612231GHz\"],\n 5: [\"OH1665\", \"1.6654018GHz\"],\n ... | python | chosen |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.