conversations listlengths 2 3 | source stringclasses 1
value | stack stringclasses 1
value |
|---|---|---|
[
{
"from": "human",
"value": "[dynamic-ast] Add test case for dynamic ast\n"
},
{
"from": "gpt",
"value": "#=======================================================================\n# verilog_from_ast_test.py\n#=======================================================================\n# This is the ... | python | chosen |
[
{
"from": "human",
"value": "Tools: Add script for gameifying testing\n"
},
{
"from": "gpt",
"value": "#!/usr/bin/python\n# -*- coding: utf-8 -*-\n\nimport argparse\nimport os\nimport subprocess\nimport re\n\nparser = argparse.ArgumentParser()\nparser.add_argument('-d', '--directory', help='The ... | python | chosen |
[
{
"from": "human",
"value": "Add script to generate pairs of LIWC categories\n\nAdded a script that generates pairs of LIWC categories for Body and\nPosemo words. The pairs are added to the index. And data about the pairs\nis written to std out.\nThe LIWC categories for which pairs are generated are hardcod... | python | chosen |
[
{
"from": "human",
"value": "DEMO: Add a demo about learning the shape parameter of gamma dist\n"
},
{
"from": "gpt",
"value": "\n\nfrom bayespy import nodes\nfrom bayespy.inference import VB\n\n\ndef run():\n\n a = nodes.GammaShape(name='a')\n b = nodes.Gamma(1e-5, 1e-5, name='b')\n\n ... | python | chosen |
[
{
"from": "human",
"value": "Add 2D helmholtz convergence test\n"
},
{
"from": "gpt",
"value": "from __future__ import absolute_import, division\nfrom firedrake import *\nimport numpy as np\n\n\ndef helmholtz_mixed(x, V1, V2):\n # Create mesh and define function space\n mesh = UnitSquareMe... | python | chosen |
[
{
"from": "human",
"value": "Fix relate_name on Bug 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 ('sprints', '0001_i... | python | chosen |
[
{
"from": "human",
"value": "Add ut for fused ops\n"
},
{
"from": "gpt",
"value": "# Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserved.\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 ... | python | chosen |
[
{
"from": "human",
"value": "Tests: Add construct test for known bad inplace string operations.\n"
},
{
"from": "gpt",
"value": "# Copyright 2015, Kay Hayen, mailto:kay.hayen@gmail.com\n#\n# Python test originally created or extracted from other peoples work. The\n# parts from me are... | python | chosen |
[
{
"from": "human",
"value": "Add test of removing unreachable terminals\n"
},
{
"from": "gpt",
"value": "#!/usr/bin/env python\n\"\"\"\n:Author Patrik Valkovic\n:Created 17.08.2017 14:23\n:Licence GNUv3\nPart of grammpy-transforms\n\n\"\"\"\n\n\nfrom unittest import main, TestCase\nfrom grammpy ... | python | chosen |
[
{
"from": "human",
"value": "Add a merge migration and bring up to date\n"
},
{
"from": "gpt",
"value": "# -*- coding: utf-8 -*-\n# Generated by Django 1.11.11 on 2018-04-26 14:30\nfrom __future__ import unicode_literals\n\nfrom django.db import migrations\n\n\nclass Migration(migrations.Migrati... | python | chosen |
[
{
"from": "human",
"value": "Solve Time Conversion in python\n"
},
{
"from": "gpt",
"value": "import sys\n\nh = 0\nm = 0\n\nfor t in sys.stdin:\n t = int(t)\n\n if t >= 60 * 60:\n h = t // (60 * 60)\n t %= 60 * 60\n\n if t >= 60:\n m = t // 60\n t %= 60\n\n ... | python | chosen |
[
{
"from": "human",
"value": "Add module for command-line interface\n"
},
{
"from": "gpt",
"value": "import argparse\n\nparser = argparse.ArgumentParser(description=\"Run the HUSC functions.\")\nsubpar = parser.add_subparsers()\n\nstitch = subpar.add_parser('stitch', \n ... | python | chosen |
[
{
"from": "system",
"value": "Handle stealable element with utils\n"
},
{
"from": "human",
"value": "# Copyright (C) 2015 Google Inc., authors, and contributors <see AUTHORS file>\n# Licensed under http://www.apache.org/licenses/LICENSE-2.0 <see LICENSE file>\n# Created By: jernej@reciprocitylab... | python | chosen |
[
{
"from": "human",
"value": "Add utility script for database setup\n"
},
{
"from": "gpt",
"value": "#!/usr/bin/env python\n# -*- coding: utf-8 -*-\n\nfrom setup.create_teams import migrate_teams\nfrom setup.create_divisions import create_divisions\n\n\nif __name__ == '__main__':\n # migrating... | python | chosen |
[
{
"from": "human",
"value": "Add tests for `check` command\n"
},
{
"from": "gpt",
"value": "\"\"\"\nTest check/validation command.\n\"\"\"\nimport os\nimport subprocess\n\nthis_folder = os.path.abspath(os.path.dirname(__file__))\n\n\ndef test_check_metamodel():\n \"\"\"\n Meta-model is als... | python | chosen |
[
{
"from": "human",
"value": "Add new topics migration file\n"
},
{
"from": "gpt",
"value": "# -*- coding: utf-8 -*-\n# Generated by Django 1.11.5 on 2017-11-08 08:40\nfrom __future__ import unicode_literals\n\nfrom django.db import migrations, models\n\n\nclass Migration(migrations.Migration):\n... | python | chosen |
[
{
"from": "human",
"value": "Add a command to extend the generation_high from generation 1 to 2\n"
},
{
"from": "gpt",
"value": "# The import of data into Kenyan MapIt had the constituencies in\n# generation 2, while all the other area types were in generation 1.\n# This is unfortunate since it ... | python | chosen |
[
{
"from": "human",
"value": "Add the migration for designations.\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 ('people', '... | python | chosen |
[
{
"from": "system",
"value": "Load all modules by default\n"
},
{
"from": "human",
"value": "\"\"\"\nAcoustics\n=========\n\nThe acoustics module...\n\n\"\"\"\nimport acoustics.ambisonics\nimport acoustics.utils\nimport acoustics.octave\nimport acoustics.doppler\nimport acoustics.signal\nimport ... | python | chosen |
[
{
"from": "human",
"value": "Add simple tests for password strength and sensitivity to MINIMUM_ZXCVBN_SCORE setting\n"
},
{
"from": "gpt",
"value": "from django import forms\nfrom django.test import SimpleTestCase, override_settings\n\nfrom corehq.apps.domain.forms import clean_password\n\n\ncla... | python | chosen |
[
{
"from": "human",
"value": "Update way we synchronize from citybik.es\n\nNow we only download the information we actually need. We also download\nand generate network information dynamically, which should enable some\ncool stuff\n"
},
{
"from": "gpt",
"value": "#!/usr/bin/env python\n\nfrom mul... | python | chosen |
[
{
"from": "human",
"value": "Test harness for checking wtf the HTTPClientResponseHandler is actually doing with data from the network"
},
{
"from": "gpt",
"value": "#!/usr/bin/python\n\nimport base64\nfrom Kamaelia.File.ReadFileAdaptor import ReadFileAdaptor \nfrom Kamaelia.File.Writing import S... | python | chosen |
[
{
"from": "human",
"value": "Add pagerteam tests file which had been missed despite its existence\n"
},
{
"from": "gpt",
"value": "from hc.api.models import Channel\nfrom hc.test import BaseTestCase\n\n\nclass AddPagerTeamTestCase(BaseTestCase):\n url = \"/integrations/add_pagerteam/\"\n\n ... | python | chosen |
[
{
"from": "human",
"value": "Add example to illustrate different optimization procedures\n"
},
{
"from": "gpt",
"value": "# showing the relation between cutting plane and primal objectives\n\nimport numpy as np\nimport matplotlib.pyplot as plt\n\nfrom sklearn.datasets import load_digits\nfrom sk... | python | chosen |
[
{
"from": "human",
"value": "Test effect of change in Laplacian. "
},
{
"from": "gpt",
"value": "import numpy \nimport scipy.sparse \nfrom apgl.graph import GraphUtils \nfrom apgl.util.Util import Util \n\nnumpy.set_printoptions(suppress=True, precision=3)\nn = 10\nW1 = scipy.sparse.rand(n, n, 0... | python | chosen |
[
{
"from": "human",
"value": "Add download random leader avatar to examples\n"
},
{
"from": "gpt",
"value": "# Run with Python 3\nimport json\nimport requests\nfrom random import randint\nimport shutil\nimport math\n\n# 1. Get your keys at https://stepic.org/oauth2/applications/ (client type = co... | python | chosen |
[
{
"from": "human",
"value": "TST: Add tests for msgpack reader.\n"
},
{
"from": "gpt",
"value": "import intake_bluesky.msgpack # noqa\nimport intake\nfrom suitcase.msgpack import Serializer\nimport os\nimport pytest\nimport shutil\nimport tempfile\nimport time\nimport types\n\nfrom .generic imp... | python | chosen |
[
{
"from": "system",
"value": "Move main code to function because of pylint warning 'Invalid constant name'\n"
},
{
"from": "human",
"value": "#! /usr/bin/env python\n# -*- coding: utf-8 -*-\n\nfrom __future__ import print_function\nimport grp\nimport pwd\nimport inspect\nimport argparse\n\n\ndef... | python | chosen |
[
{
"from": "human",
"value": "Add py solution for 714. Best Time to Buy and Sell Stock with Transaction Fee\n\n714. Best Time to Buy and Sell Stock with Transaction Fee: https://leetcode.com/problems/best-time-to-buy-and-sell-stock-with-transaction-fee/\n"
},
{
"from": "gpt",
"value": "class Solu... | python | chosen |
[
{
"from": "human",
"value": "Create Generic Sitemap abstract django\n"
},
{
"from": "gpt",
"value": "# -*- coding: utf-8 -*-\nfrom django.contrib.sitemaps import GenericSitemap as DjangoGenericSitemap\nfrom django.contrib.sitemaps import Sitemap as DjangoSitemap\nfrom django.utils import timezon... | python | chosen |
[
{
"from": "human",
"value": "Add tests from Gregor's PR\n"
},
{
"from": "gpt",
"value": "from functools import partial\nfrom mock import Mock\nfrom unittest import TestCase\n\nfrom readthedocs.restapi.permissions import APIRestrictedPermission\n\n\nclass APIRestrictedPermissionTests(TestCase):\n... | python | chosen |
[
{
"from": "human",
"value": "Add migration for on_delete SET_NULL\n"
},
{
"from": "gpt",
"value": "# -*- coding: utf-8 -*-\n# Generated by Django 1.9.8 on 2017-08-25 23:13\nfrom __future__ import unicode_literals\n\nfrom django.conf import settings\nfrom django.db import migrations, models\nimpo... | python | chosen |
[
{
"from": "human",
"value": "Add wsgi compatible example gunicorn application"
},
{
"from": "gpt",
"value": "from __future__ import unicode_literals\n\nimport multiprocessing\n\nimport gunicorn.app.base\n\nfrom gunicorn.six import iteritems\n\n\ndef number_of_workers():\n return (multiprocess... | python | chosen |
[
{
"from": "human",
"value": "Add a solution for the MadLibs lab\n"
},
{
"from": "gpt",
"value": "# Create a function for adjectives so I don't repeat myself in prompts.\ndef get_adjective():\n return raw_input(\"Give me an adjective: \")\n\ndef get_noun():\n return raw_input(\"Give me a no... | python | chosen |
[
{
"from": "human",
"value": "Add simple command to list speakers and tickets\n"
},
{
"from": "gpt",
"value": "import sys\nimport csv\nfrom optparse import make_option\n\nfrom django.core.management.base import BaseCommand\n\nfrom django.contrib.auth.models import User\nfrom wafer.talks.models im... | python | chosen |
[
{
"from": "human",
"value": "Add script for inserting project into DB\n"
},
{
"from": "gpt",
"value": "#!/usr/bin/env python3\nimport pymongo\nimport subprocess\nimport re\nfrom datetime import datetime\nimport argparse\nfrom json import load as load_json\nimport sys\n\n\ndef _info(msg):\n sy... | python | chosen |
[
{
"from": "human",
"value": "Test case for ioddrivesnmp class\n"
},
{
"from": "gpt",
"value": "#!/usr/bin/python\n# coding=utf-8\n################################################################################\n\nfrom test import CollectorTestCase\nfrom test import get_collector_config\n\nfrom ... | python | chosen |
[
{
"from": "human",
"value": "Add some basic UI tests\n"
},
{
"from": "gpt",
"value": "from app import app\nimport unittest\n\nclass UiTestCase(unittest.TestCase):\n def setUp(self):\n self.app = app.test_client()\n\n def test_index(self):\n self.assertEqual(self.app.get('/').... | python | chosen |
[
{
"from": "human",
"value": "LILY-2366: Create script for beta invites\n"
},
{
"from": "gpt",
"value": "import csv\nimport gc\nimport logging\nfrom datetime import date\nfrom hashlib import sha256\n\nfrom django.conf import settings\nfrom django.core.files.storage import default_storage\nfrom dj... | python | chosen |
[
{
"from": "human",
"value": "Add py solution for 537. Complex Number Multiplication\n\n537. Complex Number Multiplication: https://leetcode.com/problems/complex-number-multiplication/\n"
},
{
"from": "gpt",
"value": "import re\nclass Solution(object):\n def complexNumberMultiply(self, a, b):\... | python | chosen |
[
{
"from": "human",
"value": "Add py solution for 350. Intersection of Two Arrays II\n\n350. Intersection of Two Arrays II: https://leetcode.com/problems/intersection-of-two-arrays-ii/\n"
},
{
"from": "gpt",
"value": "from collections import Counter\nclass Solution(object):\n def intersect(sel... | python | chosen |
[
{
"from": "human",
"value": "Add demo MNH event scraper\n"
},
{
"from": "gpt",
"value": "from datetime import datetime, timezone, time\n\nimport requests\nfrom bs4 import BeautifulSoup\n\nfrom django.db import transaction\n\nfrom .base import BaseScraper\nfrom .exceptions import ScraperException... | python | chosen |
[
{
"from": "system",
"value": "Save team member picture with extension.\n"
},
{
"from": "human",
"value": "from django.db import models\n\n\ndef team_member_image_name(instance, filename):\n return 'team/{0}'.format(instance.name)\n\n\nclass TeamMember(models.Model):\n bio = models.TextFiel... | python | chosen |
[
{
"from": "system",
"value": "Fix null case for event details\n"
},
{
"from": "human",
"value": "from database.dict_converters.converter_base import ConverterBase\n\n\nclass EventDetailsConverter(ConverterBase):\n SUBVERSIONS = { # Increment every time a change to the dict is made\n 3... | python | chosen |
[
{
"from": "human",
"value": "Add solution for problem 26\n"
},
{
"from": "gpt",
"value": "#!/usr/bin/python\n\n\"\"\"\nFor resolve this, we have to find the maximum\nFull Reptend Prime int he given limit. To do that, we need\nto check if the 10 is a primitive root of p.\n\nSee http://mathworld.w... | python | chosen |
[
{
"from": "human",
"value": "Add functional tests for create_image\n\nChange-Id: Iadb70ca764fbc2c8102a988d6e03cf623b6df48d\n"
},
{
"from": "gpt",
"value": "# -*- coding: utf-8 -*-\n\n# Licensed under the Apache License, Version 2.0 (the \"License\"); you may\n# not use this file except in compli... | python | chosen |
[
{
"from": "human",
"value": "Add a management command to check if URNs are present in the database\n"
},
{
"from": "gpt",
"value": "import csv\nfrom django.core.management.base import BaseCommand\n\n\nfrom apps.plea.models import DataValidation, Case\nfrom apps.plea.standardisers import standard... | python | chosen |
[
{
"from": "human",
"value": "Add the middleware for reporting errors to gcloud.\n"
},
{
"from": "gpt",
"value": "from google.cloud import error_reporting\n\n\nclass ErrorReportingMiddleware(object):\n def __init__(self, *args, **kwargs):\n self.client = error_reporting.Client()\n\n ... | python | chosen |
[
{
"from": "human",
"value": "Infer: Add initial implementation of TempType.\n\n* This will be used to supply types to all type-bearing nodes during\n type inference.\n"
},
{
"from": "gpt",
"value": "\"\"\"\n# ----------------------------------------------------------------------\n# infer.py\n#\... | python | chosen |
[
{
"from": "human",
"value": "Add migration for change in profile model.\n"
},
{
"from": "gpt",
"value": "# -*- coding: utf-8 -*-\n# Generated by Django 1.11 on 2018-03-09 22:15\nfrom __future__ import unicode_literals\n\nfrom django.db import migrations, models\n\n\nclass Migration(migrations.Mi... | python | chosen |
[
{
"from": "human",
"value": "Add migration file for event slug changes\n"
},
{
"from": "gpt",
"value": "# -*- coding: utf-8 -*-\n# Generated by Django 1.11.2 on 2017-07-06 08:03\nfrom __future__ import unicode_literals\n\nimport autoslug.fields\nfrom django.db import migrations\n\n\nclass Migrat... | python | chosen |
[
{
"from": "human",
"value": "[AC-9512] Merge remote-tracking branch 'origin' into AC-9512\n"
},
{
"from": "gpt",
"value": "from django.db import migrations\n\n\ndef remove_bucket_list_program_roles(apps, schema_editor):\n BucketState = apps.get_model('accelerator', 'BucketState')\n Program... | python | chosen |
[
{
"from": "human",
"value": "Add script that recommends scrape task schedule based on recent run timings\n"
},
{
"from": "gpt",
"value": "import asyncio\nimport attr\nimport pprint\nimport dateutil.parser\nfrom datetime import timedelta\nfrom bobsled.core import bobsled\nfrom bobsled.base import... | python | chosen |
[
{
"from": "human",
"value": "Add migration for h5p kind.\n"
},
{
"from": "gpt",
"value": "# -*- coding: utf-8 -*-\n# Generated by Django 1.11.23 on 2019-12-19 02:29\nfrom __future__ import unicode_literals\n\nfrom django.db import migrations\nfrom django.db import models\n\n\nclass Migration(mig... | python | chosen |
[
{
"from": "human",
"value": "Add file lister for rclone export"
},
{
"from": "gpt",
"value": "#!/usr/bin/env python3\nimport glob\n\n# For use with --files-from argument for Rclone\n# This suits Edgar's structure with is\n# SPECIESNAME/{occurrences|projected-distributions}/[2nd-to-latest-file-is... | python | chosen |
[
{
"from": "human",
"value": "Add initial draft script to analyse Maven deps\n"
},
{
"from": "gpt",
"value": "#!/usr/bin/env python\n\nimport subprocess as sub\nimport yaml\nimport re\n\ndistrib_pom_path = '/home/uvsmtid/Works/maritime-singapore.git/clearsea-distribution/pom.xml'\n\n# Resolve (do... | python | chosen |
[
{
"from": "human",
"value": "Add test file for user functions.\n"
},
{
"from": "gpt",
"value": "from okcupyd.db import user\n\ndef test_have_messaged_before(T):\n message_thread_model = T.factory.message_thread()\n assert user.have_messaged_by_username(\n message_thread_model.initia... | python | chosen |
[
{
"from": "human",
"value": "Update test script to do match testing.\n"
},
{
"from": "gpt",
"value": "from util.decompose_graph import decompose_graph\n\nfrom core.himesis_utils import expand_graph, set_do_pickle, set_compression\n\nset_do_pickle(True)\nset_compression(6)\n\nfile_name = \"226482... | python | chosen |
[
{
"from": "human",
"value": "Implement a ThriftHandler for tornado\n\nThis Handler requires a processor=... kwarg (e.g., self.service) for the\nthird value in the handler description (e.g.,:\n ('/thrift', TornadoThriftHandler, dict(processor=self.service))\n).\n"
},
{
"from": "gpt",
"value": "f... | python | chosen |
[
{
"from": "human",
"value": "Convert a PDF document to JPEG/PNG image via /pdftoimg endpoint"
},
{
"from": "gpt",
"value": "import requests\nimport json\n# Convert a PDF document to JPEG/PNG image via /pdftoimg endpoint - https://pixlab.io/cmd?id=pdftoimg\nreq = requests.get('https://api.pixlab.... | python | chosen |
[
{
"from": "human",
"value": "Add basic test case for retrieve_dns module\n"
},
{
"from": "gpt",
"value": "import logging\nimport os\nimport tempfile\nimport unittest\n\nimport mock\n\nimport bin.retrieve_dns\n\n\nlogging.basicConfig(level=logging.INFO)\n\n\nclass RetrieveDnsTestCase(unittest.Tes... | python | chosen |
[
{
"from": "human",
"value": "Test a weighted affine solver.\n\n\nFormer-commit-id: b8876ed995f7c2ec029697ccd815957bc4a6cc93"
},
{
"from": "gpt",
"value": "#!/usr/bin/python\n\nimport sys\n\nsys.path.append('../lib')\nimport transformations\n\nv0 = [[0, 1031, 1031, 0], [0, 0, 1600, 1600]]\nv1 = [... | python | chosen |
[
{
"from": "human",
"value": "Add script for automating analysis for all corpora\n"
},
{
"from": "gpt",
"value": "import os\nimport argparse\nimport subprocess\n\nparser = argparse.ArgumentParser()\nparser.add_argument(\"corpusdir\", help = \"Path to the directory containing corpus directories\")... | python | chosen |
[
{
"from": "human",
"value": "Add recipe usage command for quick diagnostics.\n\nPiperOrigin-RevId: 432485870\n"
},
{
"from": "gpt",
"value": "###########################################################################\n#\n# Copyright 2022 Google LLC\n#\n# Licensed under the Apache License, Ver... | python | chosen |
[
{
"from": "human",
"value": "Add basic class structure, map functionality, and a set of consumer functions.\n\n"
},
{
"from": "gpt",
"value": "class pStream:\n###PRIVATE FUNCTIONS\n\n def _builder(self, expression):\n self.STR = expression\n return self\n\n\n###OVERRIDES\n de... | python | chosen |
[
{
"from": "human",
"value": "Add a python plotter that compares the results of with Stirling numbers\n"
},
{
"from": "gpt",
"value": "import matplotlib.pyplot as plt\nimport numpy\n\nfrom math import factorial\n\ndef binom(a,b):\n return factorial(a) / (factorial(b)*factorial(a-b))\n\ndef st... | python | chosen |
[
{
"from": "human",
"value": "Add py solution for 554. Brick Wall\n\n554. Brick Wall: https://leetcode.com/problems/brick-wall/\n\nApproach1:\n O(n_brick * log(n_row)) Use heap to find the least length of accumulated row\n and find how many rows can match such length\n"
},
{
"from": "gpt",
... | python | chosen |
[
{
"from": "human",
"value": "Add a simple script for looking at connections.\n"
},
{
"from": "gpt",
"value": "#!/usr/bin/python\n\nfrom __future__ import print_function, division\n\nimport networkx\n\nfrom reddit_meatspace.models import MeetupConnections\n\n\nconnections = MeetupConnections._byI... | python | chosen |
[
{
"from": "system",
"value": "Tweak syntax for f.close() concision, add typehints"
},
{
"from": "human",
"value": "from flare.struc import Structure\nfrom typing import List\nfrom json import dump, load\nfrom flare.util import NumpyEncoder\n\ndef md_trajectory_to_file(filename, structures: List[... | python | chosen |
[
{
"from": "human",
"value": "Add Timelapse script for sunrise timelapses\n"
},
{
"from": "gpt",
"value": "import sys\nimport time\nfrom goprocam import GoProCamera, constants\nimport threading\nimport logging\n\n\"\"\"\nI use PM2 to start my GoPro cameras, using a Raspberry Pi 4, works perfectly... | python | chosen |
[
{
"from": "human",
"value": "Add a simple CLI script for writing out results of scripts\n"
},
{
"from": "gpt",
"value": "#!/usr/bin/python\n\nimport os\nimport sys\nimport json\nsys.path.append(os.path.abspath(\"..\"))\nos.environ['DJANGO_SETTINGS_MODULE'] = 'ocradmin.settings'\n\nsys.path.inser... | python | chosen |
[
{
"from": "human",
"value": "Remove duplicates in all subdirectories - working raw version.\n"
},
{
"from": "gpt",
"value": "import hashlib, csv, os\n\ndef md5(fname):\n hash_md5 = hashlib.md5()\n with open(fname, \"rb\") as f:\n for chunk in iter(lambda: f.read(4096), b\"\"):\n ... | python | chosen |
[
{
"from": "human",
"value": "Test api endpoint for package show\n"
},
{
"from": "gpt",
"value": "import pytest\nimport tempfile\n\nfrom ckan import model\nfrom ckan import plugins\nfrom ckan.tests import factories\nimport ckan.tests.helpers as helpers\n\nfrom ckanext.archiver import model as arc... | python | chosen |
[
{
"from": "human",
"value": "Add LeNet example with custom scoring and train_samples_per_iteration.\n"
},
{
"from": "gpt",
"value": "from __future__ import print_function\nimport sys, os\nsys.path.insert(1, os.path.join(\"..\",\"..\",\"..\"))\nimport h2o\nfrom tests import pyunit_utils\nfrom h2o... | python | chosen |
[
{
"from": "human",
"value": "Introduce a timer based update of activities\n"
},
{
"from": "gpt",
"value": "# -*- coding: utf-8 -*-\nfrom __future__ import absolute_import\nfrom __future__ import unicode_literals\nfrom __future__ import print_function\n\nimport io\n\nimport datetime\nfrom django.... | python | chosen |
[
{
"from": "human",
"value": "Add native code emitters example.\n"
},
{
"from": "gpt",
"value": "import time\n\n@micropython.asm_thumb\ndef asm():\n movw(r0, 42)\n\n@micropython.viper\ndef viper(a, b):\n return a + b\n\n@micropython.native\ndef native(a, b):\n return a + b\n\n\nprint(asm... | python | chosen |
[
{
"from": "human",
"value": "Test the lit0,cmp before bra eliminator\n"
},
{
"from": "gpt",
"value": "from i8c.tests import TestCase\n\nSOURCE1 = \"\"\"\\\ndefine test::optimize_cmp_bra_const_const returns ptr\n argument ptr x\n\n dup\n load NULL\n beq return_the_null\n deref ptr\... | python | chosen |
[
{
"from": "human",
"value": "Save error_message for resources (SAAS-982)\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 ('no... | python | chosen |
[
{
"from": "human",
"value": "Create the converter (with span-conversion functionality)\n"
},
{
"from": "gpt",
"value": "\"\"\"\nA Very simple tool to convert latex documents to markdown documents\n\"\"\"\nimport re\n\n\nspan_substitutions = [\n (r'\\\\emph\\{(.+)\\}', r'*\\1*'),\n ... | python | chosen |
[
{
"from": "human",
"value": "Add retrieve_all_pages util method from mtp-cashbook\n\nThis method is duplicated in functionality in multiple\nfront end apps.\n"
},
{
"from": "gpt",
"value": "from django.conf import settings\n\n\ndef retrieve_all_pages(api_endpoint, **kwargs):\n \"\"\"\n Som... | python | chosen |
[
{
"from": "human",
"value": "Add beginning of main script\n"
},
{
"from": "gpt",
"value": "#!env /usr/bin/python3\n\nimport sys\nimport urllib.parse\nimport urllib.request\n\ndef main():\n search = sys.argv[1]\n url = 'http://rarbg.to/torrents.php?order=seeders&by=DESC&search='\n url = ... | python | chosen |
[
{
"from": "human",
"value": "Add file to test out kmc approach. Dump training k-mers to fasta file\n"
},
{
"from": "gpt",
"value": "# This code will test out the idea of using kmc to\n# 1. quickly enumerate the k-mers\n# 2. intersect these with the training database, output as fasta\n# 3. use th... | python | chosen |
[
{
"from": "human",
"value": "Add `issubset` and `issuperset` tests\n"
},
{
"from": "gpt",
"value": "# (c) 2016, Ansible, Inc\n#\n# This file is part of Ansible\n#\n# Ansible is free software: you can redistribute it and/or modify\n# it under the terms of the GNU General Public License as publish... | python | chosen |
[
{
"from": "human",
"value": "Add tests for masking of data based on being within a range of values\n"
},
{
"from": "gpt",
"value": "import unittest\n\nimport numpy as np\n\nimport yatsm._cyprep\n\n\nclass TestCyPrep(unittest.TestCase):\n\n @classmethod\n def setUpClass(cls):\n # Tes... | python | chosen |
[
{
"from": "human",
"value": "Add script to explore parameters units\n"
},
{
"from": "gpt",
"value": "# -*- coding: utf-8 -*-\n\n\nfrom openfisca_core.parameters import ParameterNode, Scale\nfrom openfisca_france import FranceTaxBenefitSystem\n\n\ntax_benefit_system = FranceTaxBenefitSystem()\npa... | python | chosen |
[
{
"from": "human",
"value": "Add file for Nongrammar entities tests\n"
},
{
"from": "gpt",
"value": "#!/usr/bin/env python\n\"\"\"\n:Author Patrik Valkovic\n:Created 23.06.2017 16:39\n:Licence GNUv3\nPart of grammpy\n\n\"\"\"\n\nfrom unittest import main, TestCase\nfrom grammpy import Rule\nfrom... | python | chosen |
[
{
"from": "human",
"value": "Add a simple sampler for playing wav files triggered by note on messages\n"
},
{
"from": "gpt",
"value": "import time\nimport wave\nimport pygame\nimport numpy\nimport Axon\nfrom Axon.SchedulingComponent import SchedulingComponent\n\nclass WavVoice(SchedulingComponen... | python | chosen |
[
{
"from": "human",
"value": "Add in a minor testcase.\n"
},
{
"from": "gpt",
"value": "# Copyright (c) Paul R. Tagliamonte <tag@pault.ag>, 2015\n#\n# Permission is hereby granted, free of charge, to any person obtaining a\n# copy of this software and associated documentation files (the \"Softwar... | python | chosen |
[
{
"from": "human",
"value": "Add python script to get group and module given a class name\n"
},
{
"from": "gpt",
"value": "#!/usr/bin/env python\n\n\"\"\" Given the path to the ITK Source Dir\nprint group and module of a given class\n\nfor instance, try:\n\n ./GetGroupAndModuleFromClassName /pa... | python | chosen |
[
{
"from": "human",
"value": "Add basic test for filesystem observer source\n"
},
{
"from": "gpt",
"value": "# -*- coding: utf-8 -*-\n# pylint: disable=too-many-public-methods\n\n\"\"\"\nIntegration tests for spreadflow filesystem observer source.\n\"\"\"\n\nfrom __future__ import absolute_import... | python | chosen |
[
{
"from": "human",
"value": "Add tests for form mixin.\n"
},
{
"from": "gpt",
"value": "# -*- coding: utf-8 -*-\nfrom __future__ import absolute_import, unicode_literals\nfrom django.test import TestCase\nfrom django import forms\nfrom mock import patch\nfrom test_app.models import AuthorshipMod... | python | chosen |
[
{
"from": "human",
"value": "Add tests for using the new Entity ID tracking in the rule matcher\n"
},
{
"from": "gpt",
"value": "from __future__ import unicode_literals\nimport spacy\nfrom spacy.vocab import Vocab\nfrom spacy.matcher import Matcher\nfrom spacy.tokens.doc import Doc\nfrom spacy.a... | python | chosen |
[
{
"from": "human",
"value": "Add migration to add userprofiles to existing users\n\nAll existing users on staging/production will be users of the Pollination Mapper app.\n\nRefs #290\n"
},
{
"from": "gpt",
"value": "# -*- coding: utf-8 -*-\nfrom __future__ import unicode_literals\n\nfrom django.... | python | chosen |
[
{
"from": "human",
"value": "Add an example of using fchollet multi_gpu_model on InceptionV3.\n\nAdapted from Keras example - parameterized number of GPUs, fixed imports,\ndifferent model class, fixed device placement for single GPU.\n"
},
{
"from": "gpt",
"value": "import tensorflow as tf\nfrom... | python | chosen |
[
{
"from": "human",
"value": "Add tests for custom authentication backend\n"
},
{
"from": "gpt",
"value": "\"\"\"logintokens app unittests for backends\n\n\"\"\"\nfrom time import sleep\n\nfrom django.test import TestCase, Client\nfrom django.contrib.auth import get_user_model, authenticate\n\nfr... | python | chosen |
[
{
"from": "human",
"value": "Add unit tests for bubble sort\n"
},
{
"from": "gpt",
"value": "import unittest\n\nfrom aids.sorting_and_searching.bubble_sort import bubble_sort\n\nclass BubbleSortTestCase(unittest.TestCase):\n '''\n Unit tests for bubble sort\n\n '''\n\n def setUp(self... | python | chosen |
[
{
"from": "human",
"value": "ADD PyGrid SetupService message tests\n"
},
{
"from": "gpt",
"value": "# syft absolute\nimport syft as sy\nfrom syft.core.io.address import Address\nfrom syft.grid.messages.setup_messages import CreateInitialSetUpMessage\nfrom syft.grid.messages.setup_messages import... | python | chosen |
[
{
"from": "human",
"value": "Add tests for template tags\n"
},
{
"from": "gpt",
"value": "from datetime import datetime\n\nfrom django.test import TestCase\n\nfrom geotrek.authent.tests.factories import UserFactory, UserProfileFactory\nfrom geotrek.feedback.templatetags.feedback_tags import (\n ... | python | chosen |
[
{
"from": "human",
"value": "Increase event image url limit from 200\n"
},
{
"from": "gpt",
"value": "# -*- coding: utf-8 -*-\n# Generated by Django 1.11.3 on 2017-09-05 11:08\nfrom __future__ import unicode_literals\n\nfrom django.db import migrations, models\n\n\nclass Migration(migrations.Mig... | python | chosen |
[
{
"from": "human",
"value": "Add test case for regular extrusion\n"
},
{
"from": "gpt",
"value": "# -*- coding: utf-8 -*-\n\"\"\"Creates regular cube mesh by extrusion.\n\"\"\"\nimport pygmsh\n\nfrom helpers import compute_volume\n\n\ndef test():\n x = 5\n y = 4\n z = 3\n x_layers = ... | python | chosen |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.