conversations listlengths 2 3 | source stringclasses 1
value | stack stringclasses 1
value |
|---|---|---|
[
{
"from": "human",
"value": "Add script to download chromium prebuilt clang for Linux.\n"
},
{
"from": "gpt",
"value": "#!/usr/bin/python3 -u\n\n'''Download the prebuilt clang binary built by chromium and is used by chromium.'''\n\nimport os\nimport os.path\nimport subprocess\n\nUPDATE_SH_URL = ... | python | chosen |
[
{
"from": "human",
"value": "Add a script to setup a PayPal email address\n"
},
{
"from": "gpt",
"value": "#!/usr/bin/env python\n\"\"\"Set the PayPal email address for a user.\n\nUsage:\n\n [gittip] $ heroku config -s -a gittip | foreman run -e /dev/stdin ./env/bin/python ./bin/set-paypal-em... | python | chosen |
[
{
"from": "human",
"value": "Add prior node i.e unit id in course's resources\n"
},
{
"from": "gpt",
"value": "def set_prior_nodes_from_collection_set(node_obj):\n\tprint \"\\n Name : \", node_obj.name, \" -- \", node_obj.member_of_names_list , \" --- \", node_obj._id\n\tif node_obj.collection_s... | python | chosen |
[
{
"from": "human",
"value": "Add initial framework for Kimochi client\n"
},
{
"from": "gpt",
"value": "import requests\n\nclass Kimochi:\n def __init__(self, url, api_key, site_key = None):\n if not url.endswith('/'):\n url += '/'\n\n if site_key:\n self.ur... | python | chosen |
[
{
"from": "human",
"value": "Test using sqlite in production\n\nThis lets Django create a new database for every test run, which should be done\nvia the admin interface for PostgreSQL databases\n"
},
{
"from": "gpt",
"value": "from __future__ import absolute_import\n\nfrom .base import *\n\n####... | python | chosen |
[
{
"from": "human",
"value": "Add the submission script for GPAW on Sherlock at Stanford\n"
},
{
"from": "gpt",
"value": "#!/usr/bin/env python\nfrom sys import argv\nimport os\n\njob = argv[1]\nnodes = argv[2]\ntime = argv[3] + \":00\"\n\nif len(argv) > 4:\n gpaw_options = ' '.join(argv[4:])\... | python | chosen |
[
{
"from": "human",
"value": "Add missing Django 3.1 migration.\n\nMissing from d9890245e30bf7036c05f2359cc48d89b5361ba5.\n"
},
{
"from": "gpt",
"value": "from django.db import migrations, models\n\n\nclass Migration(migrations.Migration):\n\n dependencies = [\n ('kirppuauth', '0004_aut... | python | chosen |
[
{
"from": "human",
"value": "Add all fours submission generation\n"
},
{
"from": "gpt",
"value": "\"\"\"Generate all_threes.dta submission file with every rating as 3.0\n\n.. moduleauthor:: Quinn Osha stolen from Jan Van Bruggen <jancvanbruggen@gmail.com>\n\"\"\"\n\n\ndef run():\n fours = ['4... | python | chosen |
[
{
"from": "human",
"value": "Add module for DPMS state\n"
},
{
"from": "gpt",
"value": "from i3pystatus import IntervalModule\nfrom i3pystatus.core.command import run_through_shell\n\nclass DPMS(IntervalModule):\n \"\"\"\n Shows and toggles status of DPMS which prevents screen from blankin... | python | chosen |
[
{
"from": "human",
"value": "Add command line access to uncertainty classifier\n"
},
{
"from": "gpt",
"value": "import argparse\n\nfrom uncertainty.classifier import Classifier\n\n\ndef train(args):\n classifier = Classifier(\n granularity=args.granularity, binary=not args.multicla... | python | chosen |
[
{
"from": "human",
"value": "Add move file after TomatoBanana; ctrl-z for one cell in Meta Entr; updated commands in help\n"
},
{
"from": "gpt",
"value": "import uuid\n\n\nmbid_directory = \"Ready To Filewalk\"\npicard_directory = \"Picard Me!\"\n\n\ndef has_mbid(track):\n \"\"\"\n Check w... | python | chosen |
[
{
"from": "human",
"value": "Implement simple CSV parsing utility\n"
},
{
"from": "gpt",
"value": "import csv\n\ndef csv_as_list(csv_file_name, delim = ';'):\n with open(csv_file_name, 'rb') as csv_file:\n data = csv.DictReader(csv_file, delimiter = delim)\n csv_list = []\n ... | python | chosen |
[
{
"from": "human",
"value": "Add a classification about page numbers of searching results to the get_sxs function.\n"
},
{
"from": "gpt",
"value": "# -*- coding:utf-8 -*-\n# This version is mainly used for a test. It doesn't have a GUI yet.\nimport shelve\nfrom getIntern import get_sxs\n\n# Use ... | python | chosen |
[
{
"from": "human",
"value": "Add initial test for bail\n"
},
{
"from": "gpt",
"value": "from wb2k.__main__ import bail\n\n\ndef test_bail():\n msg_type = 'fatal'\n color = 'red'\n text = \"It doesn't go beyond 11.\"\n\n given = bail(msg_type, color, text)\n expected = \"\\x1b[31mf... | python | chosen |
[
{
"from": "human",
"value": "Add some tests for yaml header handling\n"
},
{
"from": "gpt",
"value": "from . import IpynbTest, RmdTest\n\nyaml_source = \"\"\"---\ntitle: Test document\nauthor: foobar <foo@bar.tld>\ndate: 1970-01-01T00:00:00+0000\noutput:\n html_document:\n toc: true\nü... | python | chosen |
[
{
"from": "human",
"value": "[util] Test file for Graph code\n"
},
{
"from": "gpt",
"value": "import urllib2\n\ntoken = 'test_token'\nchannel = 'test_channel'\ngraphtype = 'test'\n\nurl = 'http://{}/ocpgraph/{}/{}/{}/'.format('localhost:8000', token, channel, graphtype)\ntry:\n req = urllib2.Re... | python | chosen |
[
{
"from": "human",
"value": "Add first draft of opensim statistics file analyzer\n"
},
{
"from": "gpt",
"value": "#!/usr/bin/python\n\nimport pprint\nimport re\nimport sys\n\nif len(sys.argv) <= 1:\n print \"Usage: %s <stats-log-path>\"\n sys.exit(1)\n\nlineRe = re.compile(\"(.* .*) - (.*)... | python | chosen |
[
{
"from": "human",
"value": "Add work and holidays get\n"
},
{
"from": "gpt",
"value": "import calendar\nfrom datetime import timedelta\n\n\ndef get_num_of_workdays_holidays(init_date, end_date, holidays_list):\n workdays = 0\n holidays = 0\n\n _date = end_date\n while _date <= init_... | python | chosen |
[
{
"from": "human",
"value": "Add script to insert Dash TOC anchors in HTML files.\n"
},
{
"from": "gpt",
"value": "#!/usr/bin/env python3\n# -*- coding: utf-8 -*-\n\n\"\"\"\nAdd Dash-style anchors to already-generated HTML documentation.\n\nThis script iterates over pre-specified HTML files gene... | python | chosen |
[
{
"from": "human",
"value": "Add missing test for Status compatibility\n"
},
{
"from": "gpt",
"value": "# -*- coding: UTF-8 -*-\n\"\"\"\n(Additional) Unit tests for :mod:`behave.model_core` module.\n\"\"\"\n\nfrom __future__ import print_function\nfrom behave.model_core import Status\nimport pyt... | python | chosen |
[
{
"from": "human",
"value": "Add simple test for Keras\n"
},
{
"from": "gpt",
"value": "from __future__ import print_function\n\nimport numpy as np\nnp.random.seed(1337)\n\nimport keras.backend as K\nfrom keras.models import Sequential\nfrom keras.layers.core import Dense\nfrom keras.layers.wrap... | python | chosen |
[
{
"from": "system",
"value": "Fix highlighting groups for workspaces segment\n"
},
{
"from": "human",
"value": "# vim:fileencoding=utf-8:noet\n\nfrom powerline.theme import requires_segment_info\nimport i3\n\ndef calcgrp( w ):\n\tgroup = [\"workspace\"]\n\tif w['urgent']: group.append( 'w_urgent... | python | chosen |
[
{
"from": "human",
"value": "Add tests for use of keywords in definition and using inherited Part table\n"
},
{
"from": "gpt",
"value": "from . import PREFIX, CONN_INFO\nimport datajoint as dj\nfrom nose.tools import assert_true\n\n\nschema = dj.schema(PREFIX + '_keywords', locals(), connection=... | python | chosen |
[
{
"from": "human",
"value": "Add simpleaudio test play script\n"
},
{
"from": "gpt",
"value": "import simpleaudio as sa\nimport time\nimport sys\n\nwave_obj = sa.WaveObject.from_wave_file(sys.argv[1])\n#for i in range(1000):\n #play_obj = wave_obj.play()\n #time.sleep(0.001)\n\nplay_obj = ... | python | chosen |
[
{
"from": "human",
"value": "Add sample for using the task scheduler\n"
},
{
"from": "gpt",
"value": "#!/usr/bin/env python\n\"\"\"\nWritten by Gaël Berthaud-Müller\nGithub : https://github.com/blacksponge\n\nThis code is released under the terms of the Apache 2\nhttp://www.apache.org/licenses/L... | python | chosen |
[
{
"from": "human",
"value": "Create class to manage data regions\n\nThis currently manages depth and temperature data only\n"
},
{
"from": "gpt",
"value": "import sqlite3\nfrom DataRegion import DataRegion\n\nSELECT_DEPTH = \"\"\"\nselect\n date, property, value\nfrom\n readings\nwhere\n ... | python | chosen |
[
{
"from": "human",
"value": "Add a basic map partitions examples for python\n"
},
{
"from": "gpt",
"value": "\"\"\"\n>>> from pyspark.context import SparkContext\n>>> sc = SparkContext('local', 'test')\n>>> b = sc.parallelize([\"KK6JKQ\", \"Ve3UoW\", \"kk6jlk\", \"W6BB\"])\n>>> fetchCallSigns(b)... | python | chosen |
[
{
"from": "human",
"value": "ENH: Add example of using xarray projection info\n"
},
{
"from": "gpt",
"value": "# Copyright (c) 2018 MetPy Developers.\n# Distributed under the terms of the BSD 3-Clause License.\n# SPDX-License-Identifier: BSD-3-Clause\n\"\"\"\nXArray Projection Handling\n========... | python | chosen |
[
{
"from": "human",
"value": "Add a symmetric random walk script\n"
},
{
"from": "gpt",
"value": "import numpy as np\nfrom matplotlib import pylab as plt\n\nnp.random.seed(31415926) # Set a seed for reproducibility\n\nN_STEPS = 1000\nrandom_data = np.random.randint(0, 2, N_STEPS)\n# A symmetric ... | python | chosen |
[
{
"from": "human",
"value": "Add Exitable - a tool to simplify context managers.\n"
},
{
"from": "gpt",
"value": "import inspect\n\nclass Exitable(object):\n\t__slots__ = (\"_at_exit_cbs\")\n\n\tdef _at_exit(self, cb):\n\t\ttry:\n\t\t\tself._at_exit_cbs\n\t\texcept AttributeError:\n\t\t\tself._a... | python | chosen |
[
{
"from": "human",
"value": "Add crude way of selecting game interface/version\n"
},
{
"from": "gpt",
"value": "#! /usr/bin/env python\n# title :play.py\n# description :Decides between 2 versions of reversi\n# author :andresthor\n# date :07-02-2017\n# usage ... | python | chosen |
[
{
"from": "human",
"value": "Add bubble sort method in python\n"
},
{
"from": "gpt",
"value": "# Bubble sort python implementation\n\ndef bubble_sort(arr):\n\tlength = len(arr)\n\n\tfor i in range(length):\n\n\t\tfor j in range(0, length-i-1):\n\t\t\tif arr[j] > arr[j+1]:\n\t\t\t\ttemp = arr[j]\... | python | chosen |
[
{
"from": "human",
"value": "Add simple uWSGI helper script\n"
},
{
"from": "gpt",
"value": "# Copyright (c) 2014 Matthias Klumpp <mak@debian.org>\n#\n# Permission is hereby granted, free of charge, to any person obtaining a\n# copy of this software and associated documentation files (the \"Soft... | python | chosen |
[
{
"from": "human",
"value": "Use current Jenkins plugin API to generate puppet class for plugins.\n\nThis script can connect to a live jenkins instance and fetch plugin\ndata, then output a puppet class with the plugin versions and\ndependencies specified.\n\nThis does not handle the job of configuring any ... | python | chosen |
[
{
"from": "human",
"value": "Add a benchmark for moving events between calendars\n\ngit-svn-id: 81e381228600e5752b80483efd2b45b26c451ea2@6294 e27351fd-9f3e-4f54-a53b-843176b1656c\n"
},
{
"from": "gpt",
"value": "\nfrom itertools import count, cycle\nfrom urllib2 import HTTPDigestAuthHandler\n\nf... | python | chosen |
[
{
"from": "human",
"value": "Add solution for excel sheet column number\n"
},
{
"from": "gpt",
"value": "\"\"\"\nSource : https://oj.leetcode.com/problems/excel-sheet-column-number/\nAuthor : Changxi Wu\nDate : 2015-01-21\n\nGiven a column title as appear in an Excel sheet, return its correspo... | python | chosen |
[
{
"from": "human",
"value": "Create mapping of characters to percentage values\n"
},
{
"from": "gpt",
"value": "char_map = {\n 'a': 3,\n 'b': 6,\n 'c': 9,\n 'd': 12,\n 'e': 15,\n 'f': 18,\n 'g': 21,\n 'h': 24,\n 'i': 27,\n 'j': 30,\n 'k': 33,\n 'l': 36,\n '... | python | chosen |
[
{
"from": "human",
"value": "Make module executable with `python -m rosrepo`\n"
},
{
"from": "gpt",
"value": "# coding=utf-8\n#\n# ROSREPO\n# Manage ROS workspaces with multiple Gitlab repositories\n#\n# Author: Timo Röhling\n#\n# Copyright 2016 Fraunhofer FKIE\n#\n# Licensed under the Apache Li... | python | chosen |
[
{
"from": "human",
"value": "Add class for handling routes\n"
},
{
"from": "gpt",
"value": "from .station_map import station_map\n\n\nclass Route:\n\n def __init__(self, trip_attrs, legs):\n self.origin = trip_attrs['origin']\n self.destination = trip_attrs['destination']\n ... | python | chosen |
[
{
"from": "human",
"value": "Add a script to show undistorted images from the USB camera.\n"
},
{
"from": "gpt",
"value": "#! /usr/bin/env python\n# -*- coding:utf-8 -*-\n\n#\n# Show the images from a USB camera\n#\n\n# External dependencies\nimport pickle\nimport cv2\n\n# Load calibration file\... | python | chosen |
[
{
"from": "human",
"value": "Update DB migrations following upstream change in ICEkit\n\nThe `WorkflowStateMixin` model in django-icekit -- which\nis used as a basis for the `EventBase` model -- was updated\nwith two new fields: `brief`, and `admin_notes`.\n\nThis change updates the model in this project to... | python | chosen |
[
{
"from": "human",
"value": "Add unit tests for straight text output\n"
},
{
"from": "gpt",
"value": "\"\"\"Unit tests for straight text output.\"\"\"\n\nimport unittest\n\nimport utils\n\nclass TestText(utils.TestCase):\n def test_short_string(self):\n self.assertEqual(self.render('{%... | python | chosen |
[
{
"from": "human",
"value": "Clean up tests; add tests for user-defined models and pagination\n"
},
{
"from": "gpt",
"value": "\"\"\"Tests for non-core functionality in sandman2.\"\"\"\n\nfrom pytest_flask.fixtures import client\n\nexclude_tables = ('Invoice')\n\ndef test_pagination(client):\n ... | python | chosen |
[
{
"from": "human",
"value": "Add script with basic traffic data retrieval\n"
},
{
"from": "gpt",
"value": "#!/usr/bin/env python3\n\nimport json\nimport requests\n\n# Configuration\n\n# To create an authentication key, see\n# https://msdn.microsoft.com/en-ca/library/ff701720.aspx\nbing_maps_auth... | python | chosen |
[
{
"from": "human",
"value": "Add file forgotten in 731ad8c.\n"
},
{
"from": "gpt",
"value": "#!/usr/bin/env python\n\nimport asyncio\nimport datetime\nimport random\nimport websockets\n\nCONNECTIONS = set()\n\nasync def register(websocket):\n CONNECTIONS.add(websocket)\n try:\n awai... | python | chosen |
[
{
"from": "human",
"value": "Add example for repeated / continuous recordings\n"
},
{
"from": "gpt",
"value": "#!/usr/bin/env python3\n\n# One common issue is that Saleae records traces into memory, which means that\n# it can't handle very long captures. This example shows how to use scripting t... | python | chosen |
[
{
"from": "human",
"value": "Implement Finnish individual tax number validation\n"
},
{
"from": "gpt",
"value": "# veronumero.py - functions for handling Finnish individual tax numbers\n# coding: utf-8\n#\n# Copyright (C) 2017 Holvi Payment Services Oy\n# Copyright (C) 2017 Arthur de Jong\n#\n# ... | python | chosen |
[
{
"from": "human",
"value": "Add some tests for base.py\n"
},
{
"from": "gpt",
"value": "import pytest\n\nfrom celery.schedules import crontab\n\nfrom scrapi import _Registry\nfrom scrapi.base import BaseHarvester\nfrom scrapi.base import HarvesterMeta\n\n\n@pytest.fixture\ndef mock_registry(mon... | python | chosen |
[
{
"from": "human",
"value": "Add test for this module\n"
},
{
"from": "gpt",
"value": "\"\"\"tests/test_this.py.\n\nTests the Zen of Hug\n\nCopyright (C) 2019 Timothy Edmund Crosley\n\nPermission is hereby granted, free of charge, to any person obtaining a copy of this software and associated\nd... | python | chosen |
[
{
"from": "human",
"value": "Add checking of commits using mendertesting.\n\nChangelog: None\n\nSigned-off-by: Kristian Amlie <505e66ae45028a0596c853559221f0b72c1cee21@mender.io>\n"
},
{
"from": "gpt",
"value": "#!/usr/bin/python\n# Copyright 2016 Mender Software AS\n#\n# Licensed under the A... | python | chosen |
[
{
"from": "human",
"value": "Add a test helper function\n"
},
{
"from": "gpt",
"value": "# encoding: utf-8\n\n'''\n.. codeauthor:: Tsuyoshi Hombashi <tsuyoshi.hombashi@gmail.com>\n'''\n\nfrom __future__ import absolute_import, print_function, unicode_literals\n\n\ndef print_result(expected, actu... | python | chosen |
[
{
"from": "human",
"value": "Add script to initialize db with schools, unis etc\n"
},
{
"from": "gpt",
"value": "import json\nimport os\nimport django\nimport logging\n\nos.environ.setdefault('DJANGO_SETTINGS_MODULE', 'backend.settings')\ndjango.setup()\n\nfrom unichat.models import Country, Cit... | python | chosen |
[
{
"from": "human",
"value": "Add tests for PolycompChunk class\n"
},
{
"from": "gpt",
"value": "import numpy as np\nimport pypolycomp\n\ndef test_polycomp():\n inv_cheby = pypolycomp.Chebyshev(samples.size, pypolycomp.PCOMP_TD_INVERSE)\n \n for alg in (pypolycomp.PCOMP_ALG_USE_CHEBYSHEV... | python | chosen |
[
{
"from": "human",
"value": "Add solution for problem 12, really slow, need to be optimize\n"
},
{
"from": "gpt",
"value": "#!/usr/bin/python\n\nfrom math import sqrt\n\n\"\"\" Our limit \"\"\"\nLIMIT = 500\n\"\"\" We start from 6 \"\"\"\ntest = 1 + 2 + 3\n\"\"\" Next to add \"\"\"\nadd = 4\ndiv... | python | chosen |
[
{
"from": "human",
"value": "Add solution for problem 17\n"
},
{
"from": "gpt",
"value": "#!/usr/bin/python\n\nvalues = {}\nvalues[1] = \"one\"\nvalues[2] = \"two\"\nvalues[3] = \"three\"\nvalues[4] = \"four\"\nvalues[5] = \"five\"\nvalues[6] = \"six\"\nvalues[7] = \"seven\"\nvalues[8] = \"eight... | python | chosen |
[
{
"from": "human",
"value": "Add basic PyPI reading logic\n"
},
{
"from": "gpt",
"value": "# -*- coding: utf-8 -*-\n\"\"\"\ntestifi.pypi\n~~~~~~~~~~~~\n\nThis module contains the portions of testifi code that know how to handle\ninteracting with PyPI.\n\"\"\"\nimport treq\n\nfrom twisted.interne... | python | chosen |
[
{
"from": "human",
"value": "tests: Add test on set/frozenset equality.\n"
},
{
"from": "gpt",
"value": "try:\n frozenset\nexcept NameError:\n print(\"SKIP\")\n import sys\n sys.exit()\n\n# Examples from https://docs.python.org/3/library/stdtypes.html#set\n# \"Instances of set are co... | python | chosen |
[
{
"from": "human",
"value": "Add few tests of HashContainer\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 TestCase, main\nfrom grammpy.HashContainer import Hash... | python | chosen |
[
{
"from": "human",
"value": "Create an alert on attempts to use known exfil domains\n\nFor example, pastebin.com"
},
{
"from": "gpt",
"value": "#!/usr/bin/env python\n\n# This Source Code Form is subject to the terms of the Mozilla Public\n# License, v. 2.0. If a copy of the MPL was not distribu... | python | chosen |
[
{
"from": "human",
"value": "Add CRUD model db test cases for RBAC models.\n"
},
{
"from": "gpt",
"value": "# Licensed to the StackStorm, Inc ('StackStorm') under one or more\n# contributor license agreements. See the NOTICE file distributed with\n# this work for additional information regardin... | python | chosen |
[
{
"from": "human",
"value": "Verify the given string has unique characters\n"
},
{
"from": "gpt",
"value": "def verifyUnique(string):\n if len(string) > 128:\n return False\n characterHash = [0] * 128\n for character in string:\n hashKey = ord(character)%128\n if(ch... | python | chosen |
[
{
"from": "system",
"value": "Add wallet serialization to disk\n"
},
{
"from": "human",
"value": "import werkzeug.security as ws\nfrom flask import Flask, request, jsonify, abort\napp = Flask(__name__)\napp.debug = True\n\nLOGIN_DIFFICULTY = '0400'\nSERVER_SECRET = 'SoSecret!'\n\n@app.route('/sa... | python | chosen |
[
{
"from": "human",
"value": "Add solution for problem 36\n\n- Added solution for problem 36\n (double-base palindromes)\n"
},
{
"from": "gpt",
"value": "# Double-base palindromes\n\n\ndef decimal_to_binary(n):\n binary = []\n while n > 0:\n binary.append(n % 2)\n n /= 2\n\n ... | python | chosen |
[
{
"from": "human",
"value": "Add miscellaneous tests for remaining code\n"
},
{
"from": "gpt",
"value": "from flask.ext.resty import Api, GenericModelView\nfrom marshmallow import fields, Schema\nimport pytest\nfrom sqlalchemy import Column, Integer\n\nimport helpers\n\n# -----------------------... | python | chosen |
[
{
"from": "system",
"value": "Revert \"Fix python random number generator.\"\n"
},
{
"from": "human",
"value": "from random import randint\n\ndef get_random_number(start=1, end=10):\n \"\"\"Generates and returns random number between :start: and :end:\"\"\"\n return randint(start, end)\n"
... | python | chosen |
[
{
"from": "human",
"value": "Move to home. Not sure that this builds.\n"
},
{
"from": "gpt",
"value": "import argparse\nimport empaths\nimport dbconfig\nimport dbconfighayworth5nm\nimport numpy as np\nimport urllib, urllib2\nimport cStringIO\nimport sys\n\nimport anncube\nimport anndb\nimport z... | python | chosen |
[
{
"from": "human",
"value": "Implement first version of NB classifier\n"
},
{
"from": "gpt",
"value": "import numpy as np\nimport feature_extractor as fe\nfrom sklearn.naive_bayes import MultinomialNB\n\n# X = np.random.randint(5, size=(6, 100))\n# y = np.array([1, 2, 3, 4, 5, 6])\n\n(features, ... | python | chosen |
[
{
"from": "human",
"value": "Add an Invoke task for generating documentation.\n"
},
{
"from": "gpt",
"value": "import os\n\nfrom invoke import task\n\n@task\ndef docs(ctx, version=None):\n targets = [\"latest\"]\n if version:\n targets.append(version)\n for target in targets:\n ... | python | chosen |
[
{
"from": "human",
"value": "Add shim module to allow flattening of namespace.\n"
},
{
"from": "gpt",
"value": "import sys\nimport types\n\n\nclass ShimModule(types.ModuleType):\n\n def __getattribute__(self, key):\n exec 'from IPython import %s' % key\n return eval(key)\n\nsys.... | python | chosen |
[
{
"from": "human",
"value": "Add script to generate proper alanine-dipeptide explicit solvent PDB file with CRYST record.\n"
},
{
"from": "gpt",
"value": "\"\"\"\nGenerate PDB file containing periodic box data.\n\n\"\"\"\n\nfrom simtk import openmm, unit\nfrom simtk.openmm import app\n\nprmtop_f... | python | chosen |
[
{
"from": "human",
"value": "Add migration for replicating legact permissions to ObjectPermissions\n"
},
{
"from": "gpt",
"value": "from django.db import migrations\n\n\nACTIONS = ['view', 'add', 'change', 'delete']\n\n\ndef replicate_permissions(apps, schema_editor):\n \"\"\"\n Replicate ... | python | chosen |
[
{
"from": "human",
"value": "Add ssh password auth violation alert\n"
},
{
"from": "gpt",
"value": "#!/usr/bin/env python\n\n# This Source Code Form is subject to the terms of the Mozilla Public\n# License, v. 2.0. If a copy of the MPL was not distributed with this\n# file, You can obtain one at... | python | chosen |
[
{
"from": "human",
"value": "Add a script to update our sparkle XML files\n"
},
{
"from": "gpt",
"value": "#!/usr/bin/env python\n\n# Updates a sparkle appcast xml file with a new release\n\nfrom optparse import OptionParser\nfrom xml.dom.minidom import parse\nfrom datetime import datetime\n\nim... | python | chosen |
[
{
"from": "human",
"value": "Add a virtual machine, with a stub for the bytecode\n"
},
{
"from": "gpt",
"value": "class VirtualMachine:\n def __init__(self, ram_size=256, stack_size=32):\n self.data = [None]*ram_size\n self.stack = [None]*stack_size\n self.stack_size = st... | python | chosen |
[
{
"from": "human",
"value": "Add a script to export pixels masks for mr_filter's -I option.\n"
},
{
"from": "gpt",
"value": "#!/usr/bin/env python3\n# -*- coding: utf-8 -*-\n\n# Copyright (c) 2016 Jérémie DECOCK (http://www.jdhp.org)\n\n# This script is provided under the terms and conditions of... | python | chosen |
[
{
"from": "human",
"value": "Implement a basic Action class\n"
},
{
"from": "gpt",
"value": "import logging\nfrom .entity import Entity\n\n\nclass Action: # Lawsuit\n\targs = ()\n\tdef __init__(self, target, *args, **kwargs):\n\t\tself.target = target\n\t\tself.times = 1\n\t\tself._args = args\n... | python | chosen |
[
{
"from": "human",
"value": "Add module that helps to generate configuration files.\n"
},
{
"from": "gpt",
"value": "import abc\nimport json\n\n\nclass Script(list):\n def __init__(self, filename=None, iterable=None):\n if iterable is not None:\n super().__init__(iterable)\n... | python | chosen |
[
{
"from": "human",
"value": "Add a Python3 + urllib example\n"
},
{
"from": "gpt",
"value": "import sys\nimport ssl\nimport urllib.error\nimport urllib.request\n\nhost = sys.argv[1]\nport = sys.argv[2]\ncafile = sys.argv[3] if len(sys.argv) > 3 else None\n\ntry:\n urllib.request.urlopen(\"htt... | python | chosen |
[
{
"from": "human",
"value": "Append intelligently at the end of a file\n"
},
{
"from": "gpt",
"value": "import os\nimport shutil\n\nclass FileAppender(object):\n \n def __init__(self, filename):\n self.filename = filename\n self.lines = []\n self.newLines = []\n ... | python | chosen |
[
{
"from": "human",
"value": "Add test to illustrate GH-295\n"
},
{
"from": "gpt",
"value": "from nose.tools import assert_false\nfrom mock import Mock, PropertyMock, patch\nfrom .models import Photo\n\n\ndef test_dont_access_source():\n \"\"\"\n Touching the source may trigger an unneeded ... | python | chosen |
[
{
"from": "human",
"value": "Move these classes into their own file\n"
},
{
"from": "gpt",
"value": "\"\"\"\nRejected data objects\n\n\"\"\"\nimport copy\n\n\nclass DataObject(object):\n \"\"\"A class that will return a plain text representation of all of the\n attributes assigned to the o... | python | chosen |
[
{
"from": "human",
"value": "Add migration for last commit\n"
},
{
"from": "gpt",
"value": "# encoding: utf-8\nimport datetime\nfrom south.db import db\nfrom south.v2 import SchemaMigration\nfrom django.db import models\n\nclass Migration(SchemaMigration):\n\n def forwards(self, orm):\n ... | python | chosen |
[
{
"from": "human",
"value": "Add gevent version of switching hub example\n"
},
{
"from": "gpt",
"value": "import logging\nimport twink\nimport twink.ovs\nimport twink.gevent\nimport twink.ext\nimport twink.ofp4 as ofp4\nimport twink.ofp4.parse as ofp4parse\nimport twink.ofp4.build as b\nimport t... | python | chosen |
[
{
"from": "human",
"value": "Add test case for printcolor() function\n\nAlso adds isatty fixture and uses monkeypatch to actually test the\ncolored output\n"
},
{
"from": "gpt",
"value": "#\n\nimport pytest\nimport re\nfrom sdsc import printcolor\n\n\n@pytest.mark.parametrize(\"msg\", (\"hello\... | python | chosen |
[
{
"from": "system",
"value": "Decrease patience for each layerwise trainer.\n"
},
{
"from": "human",
"value": "#!/usr/bin/env python\n\nimport matplotlib.pyplot as plt\nimport theanets\n\nfrom utils import load_mnist, plot_layers, plot_images\n\n\ntrain, valid, _ = load_mnist()\n\ne = theanets.E... | python | chosen |
[
{
"from": "human",
"value": "Test http-api (only the success path)\n"
},
{
"from": "gpt",
"value": "import json\nimport six\n\nfrom twisted.trial import unittest\nfrom twisted.internet.defer import inlineCallbacks\nfrom twisted.web import server\nfrom twisted.internet.defer import succeed\nfrom ... | python | chosen |
[
{
"from": "human",
"value": "Add hand written migration for large_file inclusion in datapoint model\n"
},
{
"from": "gpt",
"value": "# -*- coding: utf-8 -*-\nfrom __future__ import unicode_literals\n\nfrom django.db import models, migrations\nfrom s3direct.fields import S3DirectField\n\nclass Mi... | python | chosen |
[
{
"from": "human",
"value": "Add tests for desired automatic url creation feature\n"
},
{
"from": "gpt",
"value": "\"\"\"tests/test_interface.py.\n\nTests hug's defined interfaces (HTTP, CLI, & Local)\n\nCopyright (C) 2016 Timothy Edmund Crosley\n\nPermission is hereby granted, free of charge, t... | python | chosen |
[
{
"from": "human",
"value": "Add migration to finally remove the last playerdb_ tables\n"
},
{
"from": "gpt",
"value": "# -*- coding: utf-8 -*-\n# Generated by Django 1.11.3 on 2017-07-13 18:47\nfrom __future__ import unicode_literals\n\nfrom django.db import migrations, OperationalError, connec... | python | chosen |
[
{
"from": "human",
"value": "Add the secondary ClassFactory class to generate models on the fly"
},
{
"from": "gpt",
"value": "def ClassFactory(name, argnames, BaseClass=BaseClass):\n def __init__(self, **kwargs):\n for key, value in kwargs.items():\n if key not in argnames:... | python | chosen |
[
{
"from": "human",
"value": "Add ex4.2: multiple tornado requests\n"
},
{
"from": "gpt",
"value": "from tornado.ioloop import IOLoop\nfrom tornado.httpclient import AsyncHTTPClient\nfrom tornado.gen import coroutine\nimport time\n\n\nURLS = [\n 'http://127.0.0.1:8000',\n 'http://127.0.0.1:... | python | chosen |
[
{
"from": "human",
"value": "Add new multiple bivariate KDE example\n"
},
{
"from": "gpt",
"value": "\"\"\"\nMultiple bivariate KDE plots\n============================\n\n_thumb: .6, .4\n\"\"\"\nimport seaborn as sns\nimport matplotlib.pyplot as plt\n\nsns.set(style=\"darkgrid\")\niris = sns.loa... | python | chosen |
[
{
"from": "human",
"value": "Add model for preview emails\n\n"
},
{
"from": "gpt",
"value": "from django.db import models\nfrom api.models import Hackathon\nfrom django.contrib import admin\nfrom hackfsu_com.admin import hackfsu_admin\n\n\nclass PreviewEmail(models.Model):\n hackathon = model... | python | chosen |
[
{
"from": "human",
"value": "Add data migration for email privacy field.\n"
},
{
"from": "gpt",
"value": "# -*- coding: utf-8 -*-\n# Generated by Django 1.11.13 on 2018-07-04 13:34\nfrom __future__ import unicode_literals\n\nfrom django.db import migrations\n\n\ndef migrate_privacy_email(apps, s... | python | chosen |
[
{
"from": "human",
"value": "Add basic tests of number str() formatting.\n"
},
{
"from": "gpt",
"value": "import numpy as np\nfrom numpy.testing import *\n\nclass TestPrint(TestCase):\n\n def test_float_types(self) :\n \"\"\" Check formatting.\n\n This is only for the str fu... | python | chosen |
[
{
"from": "human",
"value": "Create search indexes article on post models\n"
},
{
"from": "gpt",
"value": "#!/usr/bin/env python\n# -*- coding: utf-8 -*-\nfrom datetime import datetime\n\nfrom haystack.indexes import SearchIndex, CharField, DateTimeField\nfrom haystack import site\n\nfrom .model... | python | chosen |
[
{
"from": "human",
"value": "Add new base and fake driver classes.\n"
},
{
"from": "gpt",
"value": "# vim: tabstop=4 shiftwidth=4 softtabstop=4\n\n# Copyright 2013 Hewlett-Packard Development Company, L.P.\n# All Rights Reserved.\n#\n# Licensed under the Apache License, Version 2.0 (the \"Lic... | python | chosen |
[
{
"from": "human",
"value": "Add a module for listing courses on schedule website\n"
},
{
"from": "gpt",
"value": "\"\"\"\nModule for searching on SVSU Course Schedule website\n\"\"\"\nimport bs4\nimport re\nfrom selenium import webdriver\nfrom selenium.webdriver.support.ui import Select\nfrom t... | python | chosen |
[
{
"from": "human",
"value": "Add implementation for Sharp IR distance sensor\n"
},
{
"from": "gpt",
"value": "class SharpIrDistanceSensor(object):\n\n def __init__(self, spi_interface, pin_id):\n self.spi_interface = spi_interface\n self.pin_id = pin_id\n\n def _voltageToMete... | python | chosen |
[
{
"from": "human",
"value": "Add tests per gwas_snp and disease\n"
},
{
"from": "gpt",
"value": "# ------------------------------------------------\n# built-ins\nimport unittest\n\n# local\nfrom utils.base import TestPostgapBase\n# ------------------------------------------------\n\nclass TestPo... | python | chosen |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.