conversations listlengths 2 3 | source stringclasses 1
value | stack stringclasses 1
value |
|---|---|---|
[
{
"from": "human",
"value": "Add a test for library loading\n"
},
{
"from": "gpt",
"value": "from .utils import TemplateTestCase, Mock\n\nfrom knights import Template\n\n\nclass LoadTagTest(TemplateTestCase):\n\n def test_load_default(self):\n t = Template('{! knights.defaultfilters !}... | python | chosen |
[
{
"from": "human",
"value": "Add MSI generating tool for python updating\n"
},
{
"from": "gpt",
"value": "'''Quick and dirty script to generate vs.payload blocks for a set of URLs.\n\nUsage:\n make_payload.py URL [URL ...]\n\n\n'''\n\n__author__ = 'Steve Dower <steve.dower@microsoft.com>'\n__... | python | chosen |
[
{
"from": "human",
"value": "Add an example for just disabling password complexity\n"
},
{
"from": "gpt",
"value": "#!/usr/bin/env python\nimport pyghmi.util.webclient as webclient\nimport json\nimport os\nimport sys\n\ntmppassword = 'to3BdS91ABrd'\nmissingargs = False\nif 'XCCUSER' not in os.en... | python | chosen |
[
{
"from": "human",
"value": "Add script to compute articles improved for media collection\n"
},
{
"from": "gpt",
"value": "# -*- coding: utf-8 -*-\n\n\"\"\"Analysing a Glamorous report to identify articles improved.\"\"\"\n\nimport sys\nimport xml.dom.minidom\n\n\ndef handle_node_attribute(node,... | python | chosen |
[
{
"from": "human",
"value": "Add first draft of Flask type check decorator"
},
{
"from": "gpt",
"value": "#!/usr/bin/env python3\nimport json\nfrom flask import Response, Flask, request\n\nimport inspect\nfrom typecheck import typecheck\nfrom typing import (\n List,\n ... | python | chosen |
[
{
"from": "human",
"value": "Add script which logs realtime data into the db.\n"
},
{
"from": "gpt",
"value": "import os\nfrom datetime import datetime, timedelta\n\nimport django\nimport pytz\nimport requests\nfrom google.transit import gtfs_realtime_pb2\n\ndjango.setup()\n\nfrom busshaming.mod... | python | chosen |
[
{
"from": "human",
"value": "Add this little development tester for webapi\n"
},
{
"from": "gpt",
"value": "#! /usr/bin/env python\n\n# This tester listens on port 8051 for a single http request, with\n# a URL that starts with /api/v....\n# It exits after one request.\n# It assumes that GeoIP i... | python | chosen |
[
{
"from": "human",
"value": "Add a state for send requests to Wonderland.\n"
},
{
"from": "gpt",
"value": "#!/usr/bin/env python\n# encoding=utf8\n\nimport requests\nfrom flexbe_core import EventState, Logger\n\n\nclass Wonderland_Request(EventState):\n\t'''\n\tMoveArm receive a ROS pose as inpu... | python | chosen |
[
{
"from": "human",
"value": "Add migration script 22->23 (to be completed)\n"
},
{
"from": "gpt",
"value": "# -*- encoding: utf-8 -*-\n\nfrom storm.locals import Int, Bool, Unicode, DateTime, JSON, Reference, ReferenceSet\nfrom globaleaks.db.base_updater import TableReplacer\nfrom globaleaks.mod... | python | chosen |
[
{
"from": "human",
"value": "Add url parsing unit tests\n"
},
{
"from": "gpt",
"value": "import pytest\n\nfrom lib.purl import Purl\nfrom lib.purl_exc import *\n\nclass TestParserFunctions(object):\n\n def test_simple_url(self):\n str_url = 'http://blank'\n url = Purl(str_url)\n assert... | python | chosen |
[
{
"from": "human",
"value": "Move the lazy classes out for the serializer to be able to find them\n"
},
{
"from": "gpt",
"value": "# Lazy objects, for the serializer to find them we put them here\n\nclass LazyDriver(object):\n _driver = None\n \n def get(self):\n if self._driver ... | python | chosen |
[
{
"from": "system",
"value": "Add a timeout attr to NavigateAction.\n\nBUG=320748\n\nReview URL: https://codereview.chromium.org/202483006\n\ngit-svn-id: de016e52bd170d2d4f2344f9bf92d50478b649e0@257922 0039d316-1c4b-4281-b951-d872f2087c98\n"
},
{
"from": "human",
"value": "# Copyright 2013 The C... | python | chosen |
[
{
"from": "human",
"value": "Add example using the gaussian smoother/filter.\n\ngit-svn-id: acf0ef94bfce630b1a882387fc03ab8593ec6522@292 150532fb-1d5b-0410-a8ab-efec50f980d4\n"
},
{
"from": "gpt",
"value": "import matplotlib.pyplot as plt\n\nx = np.linspace(-10, 10, 40)\ny = np.linspace(-15, 15,... | python | chosen |
[
{
"from": "human",
"value": "Add plugin to parse values from log file\n"
},
{
"from": "gpt",
"value": "#!/usr/bin/env python\n#\n# logfile_values.py\n#\n# Copyright (c) 2017, InnoGames GmbH\n#\n\"\"\"\nlogfile_values.py -- a python script to find metrics values in log file\n\nThis script is usin... | python | chosen |
[
{
"from": "human",
"value": "Add new reschedule teacher weekly poll\n"
},
{
"from": "gpt",
"value": "'''\nCreated on Feb 21, 2013\n\n@author: raybesiga\n'''\n\nfrom django.core.management.base import BaseCommand\nfrom education.models import reschedule_teacher_weekly_polls\nfrom optparse import ... | python | chosen |
[
{
"from": "human",
"value": "Add a test for the digitdestroyer filter\n"
},
{
"from": "gpt",
"value": "from unittest import TestCase\n\nfrom spicedham.digitdestroyer import DigitDestroyer\n\nclass TestDigitDestroyer(TestCase):\n \n def test_classify(self):\n dd = DigitDestroyer()\n ... | python | chosen |
[
{
"from": "human",
"value": "Make simple script for finding terms used in marcframe\n"
},
{
"from": "gpt",
"value": "import json\n\ndef get_terms(marcframe):\n terms = set()\n for k, v in marcframe['entityTypeMap'].items():\n terms.add(k)\n terms.update(v.get('instanceTypes',... | python | chosen |
[
{
"from": "human",
"value": "Add eventlet db_pool use for mysql\n\nThis adds the use of eventlet's db_pool module so that we can make mysql\ncalls without blocking the whole process.\n\nNew config options are introduced:\n\nsql_dbpool_enable -- Enables the use of eventlet's db_pool\nsql_min_pool_size -- Set... | python | chosen |
[
{
"from": "human",
"value": "scripts: Add a script to fork all feedstocks one is a maintainer on.\n"
},
{
"from": "gpt",
"value": "#!/usr/bin/env conda-execute\n\n\"\"\"\nThis script can be run to fork conda-forge feedstocks to which you are a maintainer.\nThis is super useful if you maintain ma... | python | chosen |
[
{
"from": "human",
"value": "Add regression test for the message options bug.\n"
},
{
"from": "gpt",
"value": "import unittest\nfrom celery.messaging import MSG_OPTIONS, get_msg_options, extract_msg_options\n\n\nclass TestMsgOptions(unittest.TestCase):\n\n def test_MSG_OPTIONS(self):\n ... | python | chosen |
[
{
"from": "human",
"value": "Add a matplotlib example (needs cffi)\n"
},
{
"from": "gpt",
"value": "# Copyright 2013 Christoph Reiter\n#\n# This library is free software; you can redistribute it and/or\n# modify it under the terms of the GNU Lesser General Public\n# License as published by the F... | python | chosen |
[
{
"from": "human",
"value": "Add some tests for the new validation logic\n"
},
{
"from": "gpt",
"value": "from .helper import BJOTest\nfrom bernard.actors import Locker, Notifier\nfrom bernard.loader import YAMLLoader\nfrom praw.models import Comment, Submission\n\n\nclass TestValidation(BJOTest... | python | chosen |
[
{
"from": "human",
"value": "Add test cases for the logger\n"
},
{
"from": "gpt",
"value": "# encoding: utf-8\n\n\"\"\"\n.. codeauthor:: Tsuyoshi Hombashi <tsuyoshi.hombashi@gmail.com>\n\"\"\"\n\nfrom __future__ import print_function\nfrom __future__ import unicode_literals\n\nfrom dataproperty ... | python | chosen |
[
{
"from": "system",
"value": "Add email field to sample app.\n"
},
{
"from": "human",
"value": "from flask_wtf import Form\nfrom wtforms.fields import (TextField, SubmitField, BooleanField, DateField,\n DateTimeField)\nfrom wtforms.validators import Required\n\n\nclass... | python | chosen |
[
{
"from": "human",
"value": "Add python file with a list of simulation files.\n"
},
{
"from": "gpt",
"value": "\n#List of input files and reference databases\nsim_files = [(\"./inputs/physor/1_Enrichment_2_Reactor.xml\", \"./benchmarks/physor_1_Enrichment_2_Reactor.h5\"),\n (\"./input... | python | chosen |
[
{
"from": "human",
"value": "Add management command to migrate programs\n"
},
{
"from": "gpt",
"value": "from django.core.management.base import BaseCommand\nfrom corehq.apps.commtrack.models import Program\nfrom corehq.apps.domain.models import Domain\nfrom corehq.apps.commtrack.util import get... | python | chosen |
[
{
"from": "human",
"value": "Add minimal tests for PartHoleDrudge\n\nHere only the number of terms in the different forms of the Hamiltonian\nis checked. It should later be replaced with actual value inspection.\n"
},
{
"from": "gpt",
"value": "\"\"\"Tests on the particle-hole model.\"\"\"\n\ni... | python | chosen |
[
{
"from": "human",
"value": "Add minimal feed sourcing example\n"
},
{
"from": "gpt",
"value": "# Chap07/blogs_rss_get_posts.py\nimport json\nfrom argparse import ArgumentParser\nimport feedparser\n\n\ndef get_parser():\n parser = ArgumentParser()\n parser.add_argument('--rss-url')\n pa... | python | chosen |
[
{
"from": "human",
"value": "Add Spark Python word count program\n"
},
{
"from": "gpt",
"value": "from pyspark import SparkConf, SparkContext\nimport sys\n\n\nif __name__ == \"__main__\":\n if len(sys.argv) != 3:\n print \"Incorrect number of arguments, correct usage: wordcount.py [inp... | python | chosen |
[
{
"from": "human",
"value": "Solve Code Fights pref sum problem\n"
},
{
"from": "gpt",
"value": "#!/usr/local/bin/python\n# Code Fights Pref Sum Problem\n\nfrom itertools import accumulate\n\n\ndef prefSum(a):\n return list(accumulate(a))\n\n\ndef main():\n tests = [\n [[1, 2, 3], [... | python | chosen |
[
{
"from": "human",
"value": "Add unit test of g1.asyncs.kernels public interface\n"
},
{
"from": "gpt",
"value": "import unittest\n\nfrom g1.asyncs import kernels\n\n\nclass KernelsTest(unittest.TestCase):\n \"\"\"Test ``g1.asyncs.kernels`` public interface.\"\"\"\n\n def test_contexts(sel... | python | chosen |
[
{
"from": "human",
"value": "Add raven SSL fix mod.\n\nSee https://github.com/getsentry/raven-python/issues/1109.\n"
},
{
"from": "gpt",
"value": "# See https://github.com/getsentry/raven-python/issues/1109\n\n\"\"\"\nraven.transport.http\n~~~~~~~~~~~~~~~~~~~~\n:copyright: (c) 2010-2012 by the S... | python | chosen |
[
{
"from": "human",
"value": "Add A new Folder and file @AnaniSkywalker\n"
},
{
"from": "gpt",
"value": "#!/usr/bin/env python3\n# -*- coding: utf-8 -*-\n\"\"\"\nCreated on Sun Jul 16 15:53:32 2017\n\n@author: Anani Assoutovi\n\"\"\"\n\nimport numpy as np\nimport pandas as pd"
}
] | python | chosen |
[
{
"from": "human",
"value": "Add a rudimentary test for the platform module that at least calls each\ndocumented function once.\n"
},
{
"from": "gpt",
"value": "import unittest\nfrom test import test_support\nimport platform\n\nclass PlatformTest(unittest.TestCase):\n def test_architecture(se... | python | chosen |
[
{
"from": "human",
"value": "Write a basic test for filtering by user data\n"
},
{
"from": "gpt",
"value": "import uuid\n\nfrom django.test import TestCase\n\nfrom pillowtop.es_utils import initialize_index_and_mapping\n\nfrom corehq.apps.domain.shortcuts import create_domain\nfrom corehq.apps.e... | python | chosen |
[
{
"from": "human",
"value": "Add tests for tuple option to nd.as_py\n"
},
{
"from": "gpt",
"value": "import sys\nimport unittest\nfrom dynd import nd, ndt\n\nclass TestArrayAsPy(unittest.TestCase):\n def test_struct_or_tuple(self):\n a = nd.array((3, \"testing\", 1.5), type='{x:int, y:... | python | chosen |
[
{
"from": "human",
"value": "Add an auto-generated missing migration\n"
},
{
"from": "gpt",
"value": "# -*- coding: utf-8 -*-\n# Generated by Django 1.9.9 on 2016-11-07 15:14\nfrom __future__ import unicode_literals\n\nfrom django.db import migrations, models\nimport django.db.models.deletion\n\... | python | chosen |
[
{
"from": "human",
"value": "Add migration that sets score.user_id appropriately\n"
},
{
"from": "gpt",
"value": "\"\"\"Add score.user_id column\n\nRevision ID: 0c98b865104f\nRevises: 7b6a65c708b9\nCreate Date: 2016-10-27 19:03:44.901639\n\n\"\"\"\n\n# revision identifiers, used by Alembic.\nrev... | python | chosen |
[
{
"from": "human",
"value": "Add new case for function resolution of fp16 unary and binary operators\n"
},
{
"from": "gpt",
"value": "from numba.cuda.testing import unittest, skip_on_cudasim\nimport operator\nfrom numba.core import types, typing\n\n\n@skip_on_cudasim(\"Skip on simulator due to u... | python | chosen |
[
{
"from": "human",
"value": "Add short_url column to Graph\n\nMake username a nullable field in Graph, so people don't have to\nregister to share graphs.\n"
},
{
"from": "gpt",
"value": "\"\"\"empty message\n\nRevision ID: 75f579d01f0d\nRevises: 25f4f234760c\nCreate Date: 2017-05-06 23:15:02.228... | python | chosen |
[
{
"from": "human",
"value": "Add tool to extract routing from planning debug\n"
},
{
"from": "gpt",
"value": "#!/usr/bin/env python\n\n###############################################################################\n# Copyright 2017 The Apollo Authors. All Rights Reserved.\n#\n# Licensed under t... | python | chosen |
[
{
"from": "human",
"value": "Move mimetype column from module_files to files\n"
},
{
"from": "gpt",
"value": "# -*- coding: utf-8 -*-\n\"\"\"\\\n- Add a ``media_type`` column to the ``files`` table.\n- Move the mimetype value from ``module_files`` to ``files``.\n\n\"\"\"\nfrom __future__ import ... | python | chosen |
[
{
"from": "human",
"value": "Add script to clean Wikipedia categories\n"
},
{
"from": "gpt",
"value": "import re\ndef clean_categories(text):\n \"\"\"Replace Wikipedia category links with the name of the category in the\n text of an article.\n\n Text like \"[[Category:Foo]]\" will be re... | python | chosen |
[
{
"from": "human",
"value": "Add test to ensure sourceless specs are falsy\n\nCurrently failing; related to #187\n"
},
{
"from": "gpt",
"value": "from imagekit.cachefiles import ImageCacheFile\nfrom nose.tools import assert_false\nfrom .imagegenerators import TestSpec\n\n\ndef test_no_source():\... | python | chosen |
[
{
"from": "human",
"value": "Refactor of migration script for migrating invalid Guid objects\n\n- Remove import side effects\n- Add tests\n"
},
{
"from": "gpt",
"value": "\"\"\"Removes legacy Tag objects from the Guid namespace.\n\nTags were once GuidStoredObjects, but are no longer. The Guid ta... | python | chosen |
[
{
"from": "human",
"value": "Create a new util function that computes precision for floating-point quantization.\n\nPiperOrigin-RevId: 395302655\n"
},
{
"from": "gpt",
"value": "# coding=utf-8\n# Copyright 2021 The Google Research Authors.\n#\n# Licensed under the Apache License, Version 2.0 (th... | python | chosen |
[
{
"from": "human",
"value": "Add a forgotten migration (to add 'ignore' as a decision choice)\n\nThis should have gone into d5086f1d74d448\n"
},
{
"from": "gpt",
"value": "# -*- coding: utf-8 -*-\nfrom __future__ import unicode_literals\n\nfrom django.db import models, migrations\n\n\nclass Migr... | python | chosen |
[
{
"from": "human",
"value": "Remove Duplicates from Sorted Array II\n"
},
{
"from": "gpt",
"value": "class Solution:\n def removeDuplicates(self, nums):\n \"\"\"\n :type nums: List[int]\n :rtype: int\n \"\"\"\n \n if not nums:\n return 0\n ... | python | chosen |
[
{
"from": "human",
"value": "Add a script for saving paired posture/jacobian arrays.\n"
},
{
"from": "gpt",
"value": "import climate\nimport joblib\nimport numpy as np\n\n\ndef extract(trial, output, frames):\n dirname = os.path.join(output, trial.subject.key)\n pattern = '{}-{}-{{}}.npy'.... | python | chosen |
[
{
"from": "human",
"value": "Migrate auth for django 1.8\n"
},
{
"from": "gpt",
"value": "# -*- coding: utf-8 -*-\nfrom __future__ import unicode_literals\n\nfrom django.db import models, migrations\nimport django.core.validators\nimport django.contrib.auth.models\n\n\nclass Migration(migrations... | python | chosen |
[
{
"from": "human",
"value": "Add a redis_check management command\n\n(imported from commit 04a272ca8d8288f7e3b1a54fd5d73629bde938a0)\n"
},
{
"from": "gpt",
"value": "from __future__ import absolute_import\n\nfrom zephyr.models import UserProfile, get_user_profile_by_id\nfrom zephyr.lib.rate_limi... | python | chosen |
[
{
"from": "human",
"value": "Add solution for problem 20\n"
},
{
"from": "gpt",
"value": "#!/usr/bin/python\n\nfrom math import factorial\n\nfact = str(factorial(100))\n\nresult = 0\nfor i in range(len(fact)):\n result += int(fact[i])\n\nprint(result)\n"
}
] | python | chosen |
[
{
"from": "human",
"value": "Add migration (autogenerated via `manage.py makemigrations`)\n"
},
{
"from": "gpt",
"value": "# Generated by Django 2.1.7 on 2019-03-14 17:44\n\nfrom django.db import migrations, models\n\n\nclass Migration(migrations.Migration):\n\n dependencies = [\n ('ap... | python | chosen |
[
{
"from": "human",
"value": "Implement Prim's MST in Python\n"
},
{
"from": "gpt",
"value": "#!/usr/bin/env python\n\nimport sys\nfrom queue import PriorityQueue\n\n\nclass Graph(object):\n \"\"\"\n Represents a graph using an adjacency list.\n \"\"\"\n def __init__(self, N):\n ... | python | chosen |
[
{
"from": "human",
"value": "TESTS: Add crypto listing management qa test and test listings index.\n"
},
{
"from": "gpt",
"value": "import requests\nimport json\nimport time\nfrom collections import OrderedDict\nfrom test_framework.test_framework import OpenBazaarTestFramework, TestFailure\n\n\n... | python | chosen |
[
{
"from": "human",
"value": "Add tests for the build media storage\n"
},
{
"from": "gpt",
"value": "import os\nimport shutil\nimport tempfile\n\nfrom django.test import TestCase\n\nfrom readthedocs.builds.storage import BuildMediaFileSystemStorage\n\n\nfiles_dir = os.path.join(os.path.dirname(os... | python | chosen |
[
{
"from": "human",
"value": "Add migration for vaccine appointment update.\n"
},
{
"from": "gpt",
"value": "# -*- coding: utf-8 -*-\n# Generated by Django 1.9.1 on 2018-10-31 23:52\nfrom __future__ import unicode_literals\n\nimport datetime\nfrom django.db import migrations, models\nfrom django.... | python | chosen |
[
{
"from": "human",
"value": "TST: Test that `numpy.typing` can be imported in the the absence of typing-extensions\n"
},
{
"from": "gpt",
"value": "\"\"\"Tests for the optional typing-extensions dependency.\"\"\"\n\nimport sys\nimport types\nimport inspect\nimport importlib\n\nimport typing_exte... | python | chosen |
[
{
"from": "human",
"value": "Add tests for the object factory with various permutations\n"
},
{
"from": "gpt",
"value": "import unittest\nimport groundstation.objects.object_factory as object_factory\nfrom groundstation.objects.root_object import RootObject\nfrom groundstation.objects.update_obj... | python | chosen |
[
{
"from": "human",
"value": "Add class for symbolic ranges\n\nCompared with PySLATA, this definition is a lot more simplified. All\nthe ranges are assumed to be atomic and disjoint. No need to implement\nthe range arithmetic.\n"
},
{
"from": "gpt",
"value": "\"\"\"Tensor term definition and ut... | python | chosen |
[
{
"from": "human",
"value": "Add Queue implementation using two stacks\n"
},
{
"from": "gpt",
"value": "'''\nImplement Queue data structure using two stacks\n\n'''\n\nfrom stack import Stack\n\nclass QueueUsingTwoStacks(object):\n\tdef __init__(self):\n\t\t'''\n\t\tInitialize Queue\n\n\t\t'''\n\... | python | chosen |
[
{
"from": "human",
"value": "[dfg] Add SAM device data extractor\n"
},
{
"from": "gpt",
"value": "\nimport urllib.request\nimport zipfile\nimport re, io, os\nimport shutil\n\nfrom pathlib import Path\nfrom multiprocessing import Pool\nfrom collections import defaultdict\nfrom distutils.version i... | python | chosen |
[
{
"from": "human",
"value": "Add test module of hangul.\n"
},
{
"from": "gpt",
"value": "import hangul\n\ns = 'ㅎㅏㄴㅅㅓㅁㄱㅣ'\nprint(hangul.conjoin(s))\n\ns = '한섬기'\nprint(hangul.conjoin(s))\n\nprint(ord('ㅎ'))\nprint(ord(u'\\u1112'))\nprint(chr(12622))\nprint(chr(4370))\nprint(hex(12622))\nprint(hex... | python | chosen |
[
{
"from": "human",
"value": "Add management command to run SQL on form dbs\n\nThis is specifically to create an index concurrently, but could be useful in the future to run any SQL on multiple databases.\n\n[ci skip] tested locally"
},
{
"from": "gpt",
"value": "from __future__ import absolute_i... | python | chosen |
[
{
"from": "system",
"value": "Update middleware syntax with \"TykGateway\"\n"
},
{
"from": "human",
"value": "from tyk.decorators import *\n\n@Pre\ndef AddSomeHeader(request, session):\n # request['Body'] = 'tyk=python'\n request['SetHeaders']['SomeHeader'] = 'python2'\n return request,... | python | chosen |
[
{
"from": "system",
"value": "Fix install of pyYAML on Travis\n"
},
{
"from": "human",
"value": "from setuptools import setup, find_packages\n\nsetup(\n name='jupyterhub-kubespawner',\n version='0.5.1',\n install_requires=[\n 'jupyterhub',\n 'pyyaml',\n 'kubernetes=... | python | chosen |
[
{
"from": "human",
"value": "Add troposphere cloudformation domain and ssl script\n"
},
{
"from": "gpt",
"value": "import sys\n\ntry:\n from troposphere import Join, Sub, Output, Export\n from troposphere import Parameter, Ref, Template\n from troposphere.route53 import HostedZone\n ... | python | chosen |
[
{
"from": "human",
"value": "Add a script for combining graphs\n"
},
{
"from": "gpt",
"value": "#!/usr/bin/env python2.7\n#\n# Copyright 2011-2013 Colin Scott\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may not use this file except in compliance with the Licens... | python | chosen |
[
{
"from": "human",
"value": "Add generate Latvia bank registry script\n"
},
{
"from": "gpt",
"value": "#!/usr/bin/env python\nimport json\nimport xlrd\nimport requests\n\nURL = \"https://www.bank.lv/images/stories/pielikumi/makssist/bic_saraksts_22.01.2020_eng.xls\"\n\n\ndef process():\n regi... | python | chosen |
[
{
"from": "human",
"value": "Add little helper script to create DNS records\n"
},
{
"from": "gpt",
"value": "#!/usr/bin/env python\n\nimport os\nimport sys\nimport base64 as b64\nimport argparse\n\ndef smimea(usage, der):\n cert = []\n\n c = 0\n with open(der, \"rb\") as f:\n whi... | python | chosen |
[
{
"from": "human",
"value": "Add missing widget info element\n"
},
{
"from": "gpt",
"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@reciprocitylabs.com\n... | python | chosen |
[
{
"from": "human",
"value": "Add script to determine and plot tshirt size distribution\n"
},
{
"from": "gpt",
"value": "import csv\nimport plotly.plotly as py\nimport sys\n\nfrom collections import defaultdict\nfrom plotly.graph_objs import *\n\ncity = sys.argv[1].lower()\npath_to_csv_file = sys... | python | chosen |
[
{
"from": "human",
"value": "Add doc fragment for new OpenStack modules\n"
},
{
"from": "gpt",
"value": "# Copyright (c) 2014 Hewlett-Packard Development Company, L.P.\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 o... | python | chosen |
[
{
"from": "human",
"value": "Add test for action_runner.BeginInteraction and action_runner.EndInteraction.\n\nBUG=368767\n\nReview URL: https://codereview.chromium.org/294943006\n\ngit-svn-id: de016e52bd170d2d4f2344f9bf92d50478b649e0@272549 0039d316-1c4b-4281-b951-d872f2087c98\n"
},
{
"from": "gpt",... | python | chosen |
[
{
"from": "human",
"value": "Add utilities to work with LaTeX files\n"
},
{
"from": "gpt",
"value": "\"\"\"\nUtilities to work with LaTeX files.\n\"\"\"\n\nimport argparse\nimport re\n\ndef read_tex_file(tex_file, encoding=\"utf-8\"):\n with open(tex_file, 'r', encoding=encoding) as data:\n ... | python | chosen |
[
{
"from": "human",
"value": "Add code for LSTM based MNIST\n\nTraining takes time but accuracy is great after few\niterations.\n"
},
{
"from": "gpt",
"value": "import tensorflow as tf\nimport numpy as np\n\ntf.set_random_seed(5)\n\nn_inputs = 28\nn_neurons = 150\nn_layers = 3\nn_steps = 28\nn_ou... | python | chosen |
[
{
"from": "system",
"value": "Save our backtraces in a compatible manner with resque.\n"
},
{
"from": "human",
"value": "import sys\nimport traceback\n\nclass BaseBackend(object):\n \"\"\"Provides a base class that custom backends can subclass. Also provides basic\n traceback and message p... | python | chosen |
[
{
"from": "human",
"value": "Create Django migrations for statement text max length\n"
},
{
"from": "gpt",
"value": "from django.db import migrations, models\n\n\nclass Migration(migrations.Migration):\n\n dependencies = [\n ('django_chatterbot', '0017_tags_unique'),\n ]\n\n oper... | python | chosen |
[
{
"from": "human",
"value": "Add BSSRDF render widget file.\n"
},
{
"from": "gpt",
"value": "# -*- coding: utf-8 -*-\n\nfrom .image_widget import ImageWidget\n\nclass BSSRDFRenderWidget(ImageWidget):\n def __init__(self, parent=None):\n super(BSSRDFRenderWidget, self).__init__(parent)\... | python | chosen |
[
{
"from": "human",
"value": "Add a utility to parse the BJCP 2015 Styles csv\n"
},
{
"from": "gpt",
"value": "#! /usr/bin/env python\n\nimport csv\nimport pprint\nimport string\n\n\"\"\"\nParse the BJCP 2015 Styles CSV file\n\"\"\"\n\n\ndef main():\n styles = {}\n\n filename = '2015_Styles... | python | chosen |
[
{
"from": "human",
"value": "Add py solution for 682. Baseball Game\n\n682. Baseball Game: https://leetcode.com/problems/baseball-game/\n"
},
{
"from": "gpt",
"value": "class Solution(object):\n def calPoints(self, ops):\n \"\"\"\n :type ops: List[str]\n :rtype: int\n ... | python | chosen |
[
{
"from": "human",
"value": "Add a test case for lldbutil.lldb_iter() which returns an iterator object\nfor lldb objects which can contain other lldb objects. Examples are:\nSBTarget contains SBModule, SBModule contains SBSymbols, SBProcess contains\nSBThread, SBThread contains SBFrame, etc.\n\n\ngit-svn-i... | python | chosen |
[
{
"from": "human",
"value": "Add a password hasher for opers\n"
},
{
"from": "gpt",
"value": "import sys\nsys.path.append(\"..\") # This needs to work from the setup-utils subdirectory\nfrom txircd.modules.hash_pbkdf2 import HashPBKDF2\n\nif len(sys.argv) < 2:\n\tprint(\"Usage: {} password\".for... | python | chosen |
[
{
"from": "human",
"value": "Add a function can convert number to Hangul string.\n"
},
{
"from": "gpt",
"value": "##-*- coding: utf-8 -*- \n#!/usr/bin/python\n'''\nNumber to Hangul string util.\n'''\n\n__author__ = 'SeomGi, Han'\n__credits__ = ['SeomGi, Han']\n__copyright__ = 'Copyright 2015, Py... | python | chosen |
[
{
"from": "human",
"value": "Add means to dump model for manual classification\n"
},
{
"from": "gpt",
"value": "\nimport pickle\nimport numpy as np\nimport random\nimport os\nimport struct\n\nfrom config import *\n\ndef binary(num):\n \"\"\"\n Float to IEEE-754 single precision binary ... | python | chosen |
[
{
"from": "human",
"value": "Print sequence of bytes that comprise the class file\n"
},
{
"from": "gpt",
"value": "#!/usr/bin/python\n\nimport argparse\nimport sys\n\nclass MyParser(argparse.ArgumentParser):\n def error(self, message):\n sys.stderr.write('error: %s\\n' % message)\n ... | python | chosen |
[
{
"from": "human",
"value": "Add simple script for generating session keys\n\nSigned-off-by: Robbie Harwood <3f8631879978f4cea53bf1163760f1ac18f9cb08@redhat.com>\nReviewed-by: Simo Sorce <65f99581a93cf30dafc32b5c178edc6b0294a07f@redhat.com>\nCloses #105\n"
},
{
"from": "gpt",
"value": "#!/usr/bi... | python | chosen |
[
{
"from": "human",
"value": "Add plotting script for analyzing velocity based position controller\n"
},
{
"from": "gpt",
"value": "import numpy as np\nimport matplotlib.pyplot as plt\nimport sys\n\nif sys.argc < 2:\n print \"Usage ./plot_velocity_based_position_controller.py [File_name]\"\n ... | python | chosen |
[
{
"from": "human",
"value": "Add basic test of data_checksums\n"
},
{
"from": "gpt",
"value": "\"\"\" test data_checksums\"\"\"\nfrom nose.tools import assert_equal\n\n\ndef test_data_checksums():\n from pyne.data import data_checksums\n assert_equal(len(data_checksums), 6)\n assert_equ... | python | chosen |
[
{
"from": "human",
"value": "Add a script to installer/tools to dump a shortcut's property bag.\n\nThis is required to verify DualMode and AppUserModelId properties which\nare not otherwise visible in Windows shortcut properties UI.\n\nBUG=501166\n\nReview URL: https://codereview.chromium.org/1259213005\n\n... | python | chosen |
[
{
"from": "human",
"value": "Add loader for singleton apps\n"
},
{
"from": "gpt",
"value": "import fudge\nfrom bottling.factory import BottleSingletonAppLoader\n\n\nclass describe_init:\n\n def it_initializes_with_given_options(self):\n ref = 'my_module:app'\n kind = None\n ... | python | chosen |
[
{
"from": "human",
"value": "Add database revision which adds `stores_managers` table\n"
},
{
"from": "gpt",
"value": "\"\"\"Add `stores_managers` table\n\nRevision ID: 4fe474604dbb\nRevises: 5a0e003fafb2\nCreate Date: 2013-06-28 22:18:42.292040\n\n\"\"\"\n\n# revision identifiers, used by Alemb... | python | chosen |
[
{
"from": "human",
"value": "Add script for comparing rankings\n"
},
{
"from": "gpt",
"value": "\"\"\"\nCopyright 2017 Ronald J. Nowling\n\nLicensed under the Apache License, Version 2.0 (the \"License\");\nyou may not use this file except in compliance with the License.\nYou may obtain a copy o... | python | chosen |
[
{
"from": "human",
"value": "Add a migration for django 2.1.\n\nBefore this version django itself ignored the editale directive,\nso it now created a migration for it. Though it doesn't really\nmatter as we marked it as such for drf.\n"
},
{
"from": "gpt",
"value": "# Generated by Django 2.1.6 o... | python | chosen |
[
{
"from": "human",
"value": "Add some tests on download.py\n"
},
{
"from": "gpt",
"value": "import os\nimport unittest\n\nfrom chainer import dataset\nfrom chainer import testing\n\n\nclass TestGetSetDatasetRoot(unittest.TestCase):\n\n def test_set_dataset_root(self):\n orig_root = dat... | python | chosen |
[
{
"from": "human",
"value": "Introduce the LockQueue into the broker.\n\nThe aquilon.server.locks module instantiates a lock_queue for use\nby the broker.\n\nIt also defines a number of keys that can be used by the broker.\nEach of these keys carve out a swath of the namespace available\nand define the laye... | python | chosen |
[
{
"from": "human",
"value": "Add linting for bare six imports\n"
},
{
"from": "gpt",
"value": "import os\nimport botocore\nimport ast\n\n\nROOTDIR = os.path.dirname(botocore.__file__)\n\n\ndef test_no_bare_six_imports():\n for rootdir, dirnames, filenames in os.walk(ROOTDIR):\n if 'ven... | python | chosen |
[
{
"from": "human",
"value": "Add a little support for ejdb.\n"
},
{
"from": "gpt",
"value": "\"\"\"EJDB driver for Magpy.\nCurrently does not do much except support certain command line scripts.\n\"\"\"\nimport pyejdb\n\n\nclass Database(object):\n \"\"\"Simple database connection for use in ... | python | chosen |
[
{
"from": "human",
"value": "Move the conversion helpers into a separate module\n\nNo change in behaviour except more flexibility for m2pt pt_size\n"
},
{
"from": "gpt",
"value": "\"\"\"Unit conversion helpers.\"\"\"\n\ndef m2pt(x, pt_size=0.0254/72.0):\n \"\"\"Converts distance from meters t... | python | chosen |
[
{
"from": "human",
"value": "tests/integration/cli: Add CLI tests session scoped fixture.\n\nThe test fixture starts the blockchain with preconfigured\nsmoketest network, retrieves contract addresses and returns\nan object to be accessed by test cases.\n\nRefs: #1408\n"
},
{
"from": "gpt",
"valu... | python | chosen |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.