conversations listlengths 2 3 | source stringclasses 1
value | stack stringclasses 1
value |
|---|---|---|
[
{
"from": "human",
"value": "Add command to debug packages\n"
},
{
"from": "gpt",
"value": "# cerbero - a multi-platform build system for Open Source software\n# Copyright (C) 2012 Andoni Morales Alastruey <ylatuya@gmail.com>\n#\n# This library is free software; you can redistribute it and/or\n#... | python | chosen |
[
{
"from": "human",
"value": "Add failing test for eval'd numeric array keys\n"
},
{
"from": "gpt",
"value": "if __name__ == \"__main__\":\n import sys\n sys.path.append('../plugin/python/')\nimport unittest2 as unittest\nimport vdebug.dbgp\nimport xml.etree.ElementTree as ET\n\nclass EvalP... | python | chosen |
[
{
"from": "human",
"value": "Add screen rotation script for surface\n"
},
{
"from": "gpt",
"value": "import sys\nimport os\nimport subprocess\nimport re\n\nstatus = subprocess.check_output([\"xrandr\", \"-q\"])\nprint (status)\n\nlines = status.split(\"\\n\")\nprint (lines)\nstat = \"\"\nfor lin... | python | chosen |
[
{
"from": "human",
"value": "Add simple test that table is readable\n"
},
{
"from": "gpt",
"value": "from astropy.table import Table\n\nTABLE_NAME = 'feder_object_list.csv'\n\n\ndef test_table_can_be_read():\n objs = Table.read(TABLE_NAME, format='ascii', delimiter=',')\n columns = ['objec... | python | chosen |
[
{
"from": "human",
"value": "Create a new scripted agent: copy from the deepmind one but do not select the two marins, only one\n"
},
{
"from": "gpt",
"value": "import numpy\n\nfrom pysc2.agents import base_agent\nfrom pysc2.lib import actions\nfrom pysc2.lib import features\n\n_PLAYER_RELATIVE ... | python | chosen |
[
{
"from": "human",
"value": "Add script to calculate box proto recall.\n"
},
{
"from": "gpt",
"value": "#!/usr/bin/env python\n\nfrom vdetlib.utils.protocol import proto_load, proto_dump, track_box_at_frame, boxes_at_frame\nfrom vdetlib.utils.common import iou\nimport argparse\nimport numpy as n... | python | chosen |
[
{
"from": "human",
"value": "Fix missing contexts for assessment evidence\n"
},
{
"from": "gpt",
"value": "# Copyright (C) 2017 Google Inc.\n# Licensed under http://www.apache.org/licenses/LICENSE-2.0 <see LICENSE file>\n\n\"\"\"\nFix Assessment contexts\n\nCreate Date: 2017-02-19 22:18:07.51899... | python | chosen |
[
{
"from": "human",
"value": "Add RRClass generation script to git\n"
},
{
"from": "gpt",
"value": "import enumgen\nfrom pprint import pprint\nimport os\nimport os.path\n\ndata = enumgen.fetch_csv(\n\t\"http://www.iana.org/assignments/dns-parameters/dns-parameters-2.csv\")\n\ndata_dict = []\nfor ... | python | chosen |
[
{
"from": "human",
"value": "Write a program that has a user guess your name, but they only get 3 chances to do so until the program quits.\n"
},
{
"from": "gpt",
"value": "#!/usr/bin/env python3\n# -*- coding: utf-8 -*-\n##########################################################################... | python | chosen |
[
{
"from": "human",
"value": "Create Template class and implement json handler\n"
},
{
"from": "gpt",
"value": "# -*- coding: utf-8 -*-\n\nimport json\nimport logging\nimport pathlib\n\nGITHUB_URL = 'https://github.com/{user}/{repo}'\n\nTEMPLATE_DIR = pathlib.Path.home() / '.cibopath'\nTEMPLATE_D... | python | chosen |
[
{
"from": "human",
"value": "Add a snippet (Python OpenCV).\n"
},
{
"from": "gpt",
"value": "#!/usr/bin/env python\n# -*- coding: utf-8 -*-\n\n# Copyright (c) 2015 Jérémie DECOCK (http://www.jdhp.org)\n\n\"\"\"\nOpenCV - Play video: play videos from files\n\nRequired: opencv library (Debian: apt... | python | chosen |
[
{
"from": "system",
"value": "Remove test that is probably more trouble than it's worth.\n"
},
{
"from": "human",
"value": "# -*- coding: utf-8 -*-\n\nfrom __future__ import absolute_import\n\nimport mock\n\nfrom sentry import app\nfrom sentry.testutils import TestCase\n\n\nclass AppTest(TestCas... | python | chosen |
[
{
"from": "human",
"value": "Add a basic dev config\n"
},
{
"from": "gpt",
"value": "from pycon.settings import *\n\nDEFAULT_URL_PREFIX='http://localhost:8000'\nDEBUG=True\n\nPAYPAL_TEST = True\n\nTEMPLATES[0]['OPTIONS']['debug'] = True"
}
] | python | chosen |
[
{
"from": "human",
"value": "Add script to print bot id\n"
},
{
"from": "gpt",
"value": "import os\nfrom slackclient import SlackClient\n\n# Update with your bot's name\nBOT_NAME = 'watsonbot'\n\nslack_client = SlackClient(os.environ.get('SLACK_BOT_TOKEN'))\n\n\nif __name__ == \"__main__\":\n ... | python | chosen |
[
{
"from": "human",
"value": "Print out a note, during change upload, on running Remoting browser-tests before commiting changes under $src/remoting.\n\nBUG=\n\nReview URL: https://codereview.chromium.org/1166123004\n\nCr-Commit-Position: 972c6d2dc6dd5efdad1377c0d224e03eb8f276f7@{#333390}\n"
},
{
"fr... | python | chosen |
[
{
"from": "human",
"value": "Add diff bench test script."
},
{
"from": "gpt",
"value": "\n# use time() instead on unix\nimport sys\nif sys.platform=='win32':\n from time import clock\nelse:\n from time import time as clock\n\nfrom sympycore import profile_expr\n\ndef time1(n=5):\n from ... | python | chosen |
[
{
"from": "human",
"value": "Add test for projecting parameters upward.\n\n\n\ngit-svn-id: 4c7b13231a96299fde701bb5dec4bd2aaf383fc6@489 979d6bd5-6d4d-0410-bece-f567c23bd345\n"
},
{
"from": "gpt",
"value": "import unittest\nimport numpy\nimport dadi\n\nclass ProjectionTestCase(unittest.TestCase):... | python | chosen |
[
{
"from": "human",
"value": "Add TwrSearch class basic test\n"
},
{
"from": "gpt",
"value": "#!/usr/bin/env python\n#\n# Copyright (c) 2013 Martin Abente Lahaye. - tch@sugarlabs.org\n\n#Permission is hereby granted, free of charge, to any person obtaining a copy\n#of this software and associated... | python | chosen |
[
{
"from": "human",
"value": "Add simple script for benchmark execution\n"
},
{
"from": "gpt",
"value": "# *****************************************************************************\n# Copyright (c) 2020, Intel Corporation All rights reserved.\n#\n# Redistribution and use in source and binary ... | python | chosen |
[
{
"from": "human",
"value": "Add new coupon script to generate coupons using a CSV file.\n"
},
{
"from": "gpt",
"value": "\n\"\"\" Create a batch of single use discount coupons from a CSV file.\n\n Parameters: <conference> <csv-file>\n\n Creates coupons based on the CSV file contents:\n ... | python | chosen |
[
{
"from": "human",
"value": "Create Node holder for Eve.\n"
},
{
"from": "gpt",
"value": "# -*- coding: utf-8 -*-\nfrom eve_neo4j.utils import node_to_dict, count_selection\n\n\nclass Neo4jResultCollection(object):\n \"\"\"\n Collection of results. The object holds onto a py2neo-NodeSelect... | python | chosen |
[
{
"from": "human",
"value": "Add example for inverted image comparison.\n\nAn additional example which tests if\na rotation of the testimages along both axis still\nyields the same results after a PIV evaluation.\nPlease note that this works, except for the outlier detection\nwhich is probably due to an asy... | python | chosen |
[
{
"from": "human",
"value": "Add useful python script to launch an interactive debugging session in ipython\n"
},
{
"from": "gpt",
"value": "# Useful to launch an interactive debugging session in ipython with %ed or %run\nfrom nxdrive.controller import Controller\nfrom nxdrive.model import Serve... | python | chosen |
[
{
"from": "human",
"value": "Add Solution to Problem 7.\n"
},
{
"from": "gpt",
"value": "# 10001st prime\n# Find the 10001st prime number\n# \nimport math\ndef generate_primes(n):\n\tp = 2\n\tprimes = [p]\n\tp += 1\n\tprimes.append(p)\n\n\twhile len(primes) != n:\n\n\t\tp += 2\n\n\t\ttest_prime ... | python | chosen |
[
{
"from": "human",
"value": "Add a python script for combining imports\n"
},
{
"from": "gpt",
"value": "from __future__ import with_statement\nimport os\n\nfile_contents = {}\nfile_imports = {}\n\ndef get_file(file_name):\n if file_name[-2:] != '.v': file_name += '.v'\n if file_name not in... | python | chosen |
[
{
"from": "human",
"value": "Add example of listing exposed URLs for services.\n"
},
{
"from": "gpt",
"value": "import openshift3.endpoints as endpoints\nimport openshift3.resources as resources\n\nclient = endpoints.Client()\n\nprojects = client.oapi.v1.projects.get()\n\n#print(projects)\n#prin... | python | chosen |
[
{
"from": "human",
"value": "Test process for running on COMPSs\n"
},
{
"from": "gpt",
"value": "import argparse, time\nfrom pycompss.api.task import task\nfrom pycompss.api.parameter import *\n\n#class process_test:\n# \n# def __init__(self):\n# self.ready = True\n \n@task(x = I... | python | chosen |
[
{
"from": "human",
"value": "Add a simple script to help build android.\n"
},
{
"from": "gpt",
"value": "\"\"\"Configuration for the Caffe2 installation.\n\"\"\"\n\nfrom build import Config\nimport sys\n\nConfig.USE_SYSTEM_PROTOBUF = False\nConfig.PROTOC_BINARY = 'gen/third_party/google/protoc'\... | python | chosen |
[
{
"from": "human",
"value": "Add conv to tflite script for conv_actions.\n"
},
{
"from": "gpt",
"value": "# Copyright 2017 The TensorFlow 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 t... | python | chosen |
[
{
"from": "human",
"value": "CUDA: Add Dispatcher specialization cache tests\n"
},
{
"from": "gpt",
"value": "from numba import cuda, float32, int32\nfrom numba.cuda.testing import skip_on_cudasim, unittest, CUDATestCase\n\n\n@skip_on_cudasim('Dispatcher objects not used in the simulator')\nclas... | python | chosen |
[
{
"from": "human",
"value": "Add configuration file for client\n"
},
{
"from": "gpt",
"value": "from os import environ\n\nDEMODULATION_COMMAND = environ.get('DEMODULATION_COMMAND', None)\nENCODING_COMMAND = environ.get('ENCODING_COMMAND', None)\nDECODING_COMMAND = environ.get('DECODING_COMMAND',... | python | chosen |
[
{
"from": "human",
"value": "Check in a script to debug usercache processing\n\nCurrently, if there are errors in processing the usercache, we store the\nerroneous values into a separate usercache error database. But then, we want to\nevaluate the errors and fix them if they reflect bugs. This is a script t... | python | chosen |
[
{
"from": "human",
"value": "Solve Code Fights avoid obstacles problem\n"
},
{
"from": "gpt",
"value": "#!//urs/local/bin/python\n# Code Fights Avoid Obstacles Problem\n\n\ndef avoidObstacles(inputArray):\n for jump in range(2, 40):\n safe = True\n for item in inputArray:\n ... | python | chosen |
[
{
"from": "human",
"value": "Move plotting out of main\n"
},
{
"from": "gpt",
"value": "import plotly.graph_objs as go\nimport plotly.plotly as py\nfrom plotly.tools import FigureFactory as FF\nimport matplotlib.pyplot as plt\n\n\ndef plot(x_data, y_data):\n # x_data = iteration_numbers\n ... | python | chosen |
[
{
"from": "human",
"value": "Add missing migration from the switch to jsonfield\n"
},
{
"from": "gpt",
"value": "# -*- coding: utf-8 -*-\n# Generated by Django 1.9.1 on 2016-01-11 02:08\nfrom __future__ import unicode_literals\n\nfrom django.db import migrations\nimport jsonfield.fields\n\n\ncla... | python | chosen |
[
{
"from": "human",
"value": "Add queueing server to handle multiple processes\n"
},
{
"from": "gpt",
"value": "#!/usr/bin/env python\n\"\"\"\n qserver\n \n This module will use a queuing server to execute a number of tasks\n across multiple threads.\n \n Example\n -------\n \n tasks = (... | python | chosen |
[
{
"from": "system",
"value": "[PY3] Use six for easy version info.\n"
},
{
"from": "human",
"value": "import sys\nif sys.version_info.major < 3:\n import unittest2 as unittest\nelse:\n import unittest\n"
},
{
"from": "gpt",
"value": "from evelink.thirdparty.six import PY2\nif P... | python | chosen |
[
{
"from": "human",
"value": "Add migration for logging models\n"
},
{
"from": "gpt",
"value": "# -*- coding: utf-8 -*-\n# Generated by Django 1.10.6 on 2017-04-04 20:05\nfrom __future__ import unicode_literals\n\nfrom django.db import migrations, models\nimport django.db.models.deletion\n\n\ncla... | python | chosen |
[
{
"from": "human",
"value": "Add tests regarding the dyadic and triadic distributions from MDBSI.\n"
},
{
"from": "gpt",
"value": "\"\"\"\nTests for the MDBSI distributions.\n\"\"\"\n\nimport pytest\n\nfrom dit.example_dists.mdbsi import dyadic, triadic\nfrom dit.multivariate import (\n entro... | python | chosen |
[
{
"from": "human",
"value": "scripts: Add diffsettings --all for Django<=1.5\n"
},
{
"from": "gpt",
"value": "#!/usr/bin/env python\n# Based on Django 1.5 diffsettings\n# https://github.com/django/django/blob/1.5/django/core/management/commands/diffsettings.py\nimport sys\n\n\ndef module_to_dict... | python | chosen |
[
{
"from": "human",
"value": "Add basic snapshot export test\n"
},
{
"from": "gpt",
"value": "# Copyright (C) 2017 Google Inc.\n# Licensed under http://www.apache.org/licenses/LICENSE-2.0 <see LICENSE file>\n\n\"\"\"Tests for snapshot export.\"\"\"\n\nfrom integration.ggrc import TestCase\n\n\ncl... | python | chosen |
[
{
"from": "human",
"value": "Add a snapshot test for Simon Layton\n\nSummary: This is mainly for the OSS side checking.\n\nReviewed By: dzhulgakov\n\nDifferential Revision: D4238349\n\nfbshipit-source-id: 061da3f721341c4a1249e1cc6c8c842fc505860f\n"
},
{
"from": "gpt",
"value": "from __future__ i... | python | chosen |
[
{
"from": "human",
"value": "Add tests for non-DBS data discovery.\n"
},
{
"from": "gpt",
"value": "# vim: foldmethod=marker\nfrom lobster.cmssw import dataset\nfrom lobster import fs, se\nimport os\nimport shutil\nimport subprocess\nimport tempfile\nimport unittest\n\nclass TestSE(unittest.Test... | python | chosen |
[
{
"from": "human",
"value": "Use pt-table-checksum to check for galera consistency\n"
},
{
"from": "gpt",
"value": "import optparse\nimport subprocess\n\n\ndef table_checksum(user, password, host):\n args = ['/usr/bin/pt-table-checksum', '-u', user, '-p', password]\n if host:\n args... | python | chosen |
[
{
"from": "human",
"value": "Make SOFIA TSV for ontology mapping\n"
},
{
"from": "gpt",
"value": "import sys\nimport json\n\n\ndef make_file(ont_json_file, fname):\n with open(ont_json_file, 'r') as fh:\n ont_json = json.load(fh)\n rows = []\n for top_key, entries in ont_json.ite... | python | chosen |
[
{
"from": "human",
"value": "Add test file for beeper logic\n"
},
{
"from": "gpt",
"value": "from unittest import mock\n\nfrom geometry_msgs.msg import PoseStamped\nimport rospy\nfrom beeper import Beeper\n\n\nclass TestBeeper(object):\n def setup(self):\n rospy.init_node(\"beeper_test... | python | chosen |
[
{
"from": "human",
"value": "Add script to run tests.\n"
},
{
"from": "gpt",
"value": "#!/usr/bin/env python\n\n\"\"\"Build the documentation, and run the JavaScript tests.\"\"\"\n\nimport sphinx.cmdline\n\nimport os\nimport sys\n\n# Build the documentation for vcwebedit.\nsource_dir = os.path.j... | python | chosen |
[
{
"from": "human",
"value": "Add Spectra class for plotting data from RealTime objects\n"
},
{
"from": "gpt",
"value": "import sys\nimport numpy as np\nfrom realtime import *\n\nclass Spectra(object):\n \"\"\"Return a spectra object that can plot the total absorption spectrum or\n circular... | python | chosen |
[
{
"from": "human",
"value": "Store perfectly working parser for one of the subtitle formats.\n"
},
{
"from": "gpt",
"value": "# the words \"subtitles\" and \"captions\" are used interchangeably\n\nimport re\n\ndef getVtt(fname):\n with open(fname) as f:\n content = f.readlines()\n c... | python | chosen |
[
{
"from": "human",
"value": "Add test for the \"tile init\" command.\n"
},
{
"from": "gpt",
"value": "# tile-generator\n#\n# Copyright (c) 2015-Present Pivotal Software, Inc. All Rights Reserved.\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may not use this file... | python | chosen |
[
{
"from": "human",
"value": "Add migration for last_action_date field change\n"
},
{
"from": "gpt",
"value": "# Generated by Django 2.2.16 on 2020-09-15 15:27\n\nfrom django.db import migrations, models\n\n\nclass Migration(migrations.Migration):\n\n dependencies = [\n ('councilmatic_c... | python | chosen |
[
{
"from": "human",
"value": "Add some mine alias functions\n"
},
{
"from": "gpt",
"value": "def psf_internal(cidr):\n return __salt__[\"ip_picker.ip_addrs\"](cidr=cidr)\n\n\ndef pypi_internal(cidr):\n return __salt__[\"ip_picker.ip_addrs\"](cidr=cidr)\n"
}
] | python | chosen |
[
{
"from": "human",
"value": "Add script for batchwise GitHub follow.\n"
},
{
"from": "gpt",
"value": "#!/usr/bin/env python\nfrom __future__ import absolute_import, print_function\n\nimport getpass\n\nimport requests\nfrom requests.auth import HTTPBasicAuth\n\nfrom hs_oauth import get_access_tok... | python | chosen |
[
{
"from": "human",
"value": "Write a procedure that converts an American number into the equivalent Mandarin.\n"
},
{
"from": "gpt",
"value": "# Problem 3\n# 10.0 points possible (graded)\n# Numbers in Mandarin follow 3 simple rules:\n\n# There are words for each of the digits from 0 to 10.\n# F... | python | chosen |
[
{
"from": "human",
"value": "Write scraper script for Religiousforums forum\n"
},
{
"from": "gpt",
"value": "#!/usr/bin/env python\n\nimport argparse\nimport os\nimport os.path\n\nfrom bs4 import BeautifulSoup\nimport requests\n\n\ndef post_filter(tag):\n if tag.name != 'blockquote':\n ... | python | chosen |
[
{
"from": "human",
"value": "Add a MixIn that makes it simpler to instantiate a deform\n\nThis adds a very simple MixIn that makes it easier to instantiate a form\nalong wth providing the right values to the various moving pieces, such\nas the schema, the bindings and the form itself. Less boiler plate to\n... | python | chosen |
[
{
"from": "human",
"value": "Create command to calculate recommendation's accuracy\n"
},
{
"from": "gpt",
"value": "from django.core.management import BaseCommand\n\nfrom crawler.models import *\n\n\nclass Command(BaseCommand):\n help = 'Calculate recommendation accuracy per user'\n\n def ... | python | chosen |
[
{
"from": "human",
"value": "Add solution for problem 21\n"
},
{
"from": "gpt",
"value": "#!/usr/bin/python\n\n\"\"\"\nFirst attempt to resolve was really brute force and slow,\nthis is a better solution, see problem page for explanation\n\"\"\"\n\nfrom math import floor, sqrt\n\nLIMIT = 10000\n... | python | chosen |
[
{
"from": "human",
"value": "Add solution for problem 35\n"
},
{
"from": "gpt",
"value": "#!/usr/bin/python\n\nfrom math import sqrt, ceil, floor, log10, pow\n\nLIMIT = 1000000\n\ndef decimalShift(x):\n dec = x % 10;\n power = floor(log10(x))\n x //= 10;\n x += dec * int(pow(10, powe... | python | chosen |
[
{
"from": "human",
"value": "Add complimation test for OMF\n"
},
{
"from": "gpt",
"value": "import unittest\nimport shutil\nimport tempfile\nimport os\nimport numpy as np\n\n# VTK imports:\nfrom vtk.util import numpy_support as nps\n\nfrom .. import _helpers\n# Functionality to test:\nfrom .read... | python | chosen |
[
{
"from": "human",
"value": "Add ability to easily whitelist users.\n"
},
{
"from": "gpt",
"value": "from django.core.management.base import BaseCommand\nfrom django.contrib.auth.models import User\n\nfrom core.models import UserProfile\nfrom projects import tasks\nfrom projects.models import Pr... | python | chosen |
[
{
"from": "human",
"value": "Add a simple and hackish plane scaling test.\n\nSigned-off-by: Tomi Valkeinen <e1ca4dbb8be1acaf20734fecd2da10ed1d46a9bb@ti.com>\n"
},
{
"from": "gpt",
"value": "#!/usr/bin/python3\n\nimport pykms\nimport time\nimport random\n\ncard = pykms.Card()\nres = pykms.Resourc... | python | chosen |
[
{
"from": "human",
"value": "Add some tests for letting staff users see original speaker names\n"
},
{
"from": "gpt",
"value": "from django.contrib.auth.models import User\nfrom django_webtest import WebTest\n\nfrom pombola.core import models\nfrom ..models import Entry, Sitting\n\nclass TestSit... | python | chosen |
[
{
"from": "human",
"value": "Add missing migration for MPTT update.\n"
},
{
"from": "gpt",
"value": "# -*- coding: utf-8 -*-\nfrom __future__ import unicode_literals\n\nfrom django.db import models, migrations\nimport polymorphic_tree.models\n\n\nclass Migration(migrations.Migration):\n\n dep... | python | chosen |
[
{
"from": "human",
"value": "Add a script for spotting doubly-minted identifiers\n"
},
{
"from": "gpt",
"value": "#!/usr/bin/env python3\n# -*- encoding: utf-8 -*-\n\"\"\"\nThis scripts looks for duplicate identifiers in the \"Identifiers\" table.\n\nThe caller passes the name of one of the sour... | python | chosen |
[
{
"from": "human",
"value": "Add code to send informal emails to the teams.\n"
},
{
"from": "gpt",
"value": "from contextlib import contextmanager\nimport os\nimport smtplib\nimport database as db\n\nfrom email.mime.text import MIMEText\n\nfrom jinja2 import Template\nfrom database.model import ... | python | chosen |
[
{
"from": "human",
"value": "tests/api: Add tests for \"GET /airport/:id\"\n"
},
{
"from": "gpt",
"value": "# coding=utf-8\nfrom tests.data import airports\n\n\ndef test_read_missing(db_session, client):\n res = client.get('/airports/1')\n assert res.status_code == 404\n assert res.json... | python | chosen |
[
{
"from": "human",
"value": "Add flask server for evaluating expressions\n"
},
{
"from": "gpt",
"value": "from sympy.abc import *\n\nfrom flask import Flask, request\napp = Flask(__name__)\n\n@app.route('/code', methods=['GET', 'POST'])\ndef code():\n return str(eval(request.json['code']))\n\... | python | chosen |
[
{
"from": "human",
"value": "subdomains: Write some tests for get_subdomain.\n\nThis logic is a bit subtle, and we're about to make changes to it.\nSo let's have some tests.\n"
},
{
"from": "gpt",
"value": "\nimport mock\nfrom typing import Any, List\n\nfrom django.test import TestCase, override... | python | chosen |
[
{
"from": "human",
"value": "Add first attempt to pull information out of aqhbci\n"
},
{
"from": "gpt",
"value": "from subprocess import check_output\nimport sys\n\n\ndef list_accounts():\n stdout = check_output(['aqhbci-tool4', 'listaccounts'])\n\n account_list = []\n for account_row i... | python | chosen |
[
{
"from": "human",
"value": "Add script for fixing duplicate citations.\n"
},
{
"from": "gpt",
"value": "for citation in Citation.objects.all().order_by('pk'):\n citation.ignored_due_to_duplicate = False\n citation.save()\n citation.save_and_check_for_duplicates()\n"
}
] | python | chosen |
[
{
"from": "human",
"value": "Add 03-task sample test file.\n"
},
{
"from": "gpt",
"value": "import datetime\nimport unittest\n\nimport solution\n\n\nclass TestSocialGraph(unittest.TestCase):\n def setUp(self):\n self.terry = solution.User(\"Terry Gilliam\")\n self.eric = solutio... | python | chosen |
[
{
"from": "human",
"value": "Change verbose name for some news models fields\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 ... | python | chosen |
[
{
"from": "human",
"value": "Add a test for over-riding author info\n"
},
{
"from": "gpt",
"value": "#!/usr/bin/env python\nfrom opentreetesting import test_http_json_method, config\nimport datetime\nimport codecs\nimport json\nimport sys\nimport os\n\nDOMAIN = config('host', 'apihost')\nSUBMIT_... | python | chosen |
[
{
"from": "human",
"value": "Add a test case to test loading config from an environment variable.\n"
},
{
"from": "gpt",
"value": "# -*- coding: utf-8 -*-\\\n'''\n unit.config_test\n ~~~~~~~~~~~~~~~~\n\n Configuration related unit testing\n\n :codeauthor: :email:`Pedro Algarvio (pedr... | python | chosen |
[
{
"from": "human",
"value": "Read and regex match the log lines\n"
},
{
"from": "gpt",
"value": "#!/usr/local/bin/python3.6\n\n# read nginx access log\n# parse and get the ip addresses and times\n# match ip addresses to geoip\n# possibly ignore bots\n\nimport re\n\n\ndef get_log_lines(path):\n ... | python | chosen |
[
{
"from": "human",
"value": "[build-script] Introduce infrastructure for auto-prefixing stage2 options.\n\nThis will let me introduce a stage generic swift implementation that adds a\npostfix '_stage2' to certain stage specific options. This ensures we can have a\nsingle swift build-script product implement... | python | chosen |
[
{
"from": "human",
"value": "Add an openbsd service module.\n"
},
{
"from": "gpt",
"value": "'''\nThe service module for OpenBSD\n'''\n\nimport os\n\n\n# XXX enable/disable support would be nice\n\n\ndef __virtual__():\n '''\n Only work on OpenBSD\n '''\n if __grains__['os'] == 'Open... | python | chosen |
[
{
"from": "human",
"value": "Add primitives for pdf parsing\n"
},
{
"from": "gpt",
"value": "import inspect\n\nfrom enum import IntEnum\nfrom pdfquery import PDFQuery\n\n\nclass DocFieldType(IntEnum):\n NUMBER = 1\n TEXT = 2\n CUSTOM = 3 # TODO: Forget this and have 'type' take a calla... | python | chosen |
[
{
"from": "human",
"value": "Add general filter test file\n"
},
{
"from": "gpt",
"value": "import unittest\nimport vapoursynth as vs\n\nclass FilterTestSequence(unittest.TestCase):\n\n def setUp(self):\n self.core = vs.get_core()\n self.Transpose = self.core.std.Transpose\n ... | 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\nimport logbook\nim... | python | chosen |
[
{
"from": "human",
"value": "Create script to time compass reads and db writes\n"
},
{
"from": "gpt",
"value": "#!/usr/bin/env python3\n\nfrom sense_hat import SenseHat\nfrom pymongo import MongoClient\n\nsense = SenseHat()\nclient = MongoClient(\"mongodb://192.168.0.128:27017\")\ndb = client.g2... | python | chosen |
[
{
"from": "human",
"value": "Add decorator that will catch and retry on StaleElementReferenceException\n"
},
{
"from": "gpt",
"value": "from selenium.common.exceptions import TimeoutException, StaleElementReferenceException\n\n\ndef retry_on_stale_element_exception(func):\n def wrapped(*args,... | python | chosen |
[
{
"from": "human",
"value": "Add tests for optional arguments on Event\n"
},
{
"from": "gpt",
"value": "from conference_scheduler.resources import Event\n\n\ndef test_can_construct_event():\n e = Event(\n name='example',\n duration=60,\n demand=100,\n tags=['beginn... | python | chosen |
[
{
"from": "human",
"value": "Add a command to record the current version of every person\n"
},
{
"from": "gpt",
"value": "from datetime import datetime\nfrom random import randint\nimport sys\n\nfrom django.core.management.base import BaseCommand\nfrom django.db import transaction\n\nfrom candid... | python | chosen |
[
{
"from": "system",
"value": "Fix import for 1.6 version.\n"
},
{
"from": "human",
"value": "from django.conf.urls.defaults import url, patterns\n\nfrom ajaximage.views import ajaximage\nfrom ajaximage.forms import FileForm\n\n\nurlpatterns = patterns('',\n url('^upload/(?P<upload_to>.*)/(?P<... | python | chosen |
[
{
"from": "human",
"value": "Refactor - Moved Printer classes to seperate file\n"
},
{
"from": "gpt",
"value": "#!/usr/bin/env/python3\n\n\nclass Printer:\n \"\"\"\n Base class for the cheatsheet printers. Takes care of the actuall printing.\n\n Args:\n Takes a configparser objects t... | python | chosen |
[
{
"from": "human",
"value": "Add simple test for a custom finder\n"
},
{
"from": "gpt",
"value": "import random\nimport time\n\nfrom django.test import TestCase\n\nfrom graphite.intervals import Interval, IntervalSet\nfrom graphite.node import LeafNode, BranchNode\nfrom graphite.storage import S... | python | chosen |
[
{
"from": "human",
"value": "Add data and dataset collection.\n"
},
{
"from": "gpt",
"value": "#!/usr/bin/env python\n# -*- coding: utf-8 -*-\n\nfrom collections import namedtuple\n\n\nData = namedtuple('Data', ['X', 'Y', 'y', ])\n\nDataset = namedtuple('Dataset', ['unlabel', 'train', 'test', ])... | python | chosen |
[
{
"from": "system",
"value": "Use new AuthMethod configuration for Heroku"
},
{
"from": "human",
"value": "#!/usr/bin/env python\nfrom evesrp import create_app\nfrom evesrp.killmail import CRESTMail, ShipURLMixin\nimport evesrp.auth.testauth\nfrom os import environ as env\nfrom binascii import u... | python | chosen |
[
{
"from": "system",
"value": "Move away from using the with statement for 2.4 support\n"
},
{
"from": "human",
"value": "# coding=utf-8\n\nimport logging\nimport threading\nimport traceback\n\n\nclass Handler(object):\n \"\"\"\n Handlers process metrics that are collected by Collectors.\n ... | python | chosen |
[
{
"from": "human",
"value": "Add detection of left side of face\n"
},
{
"from": "gpt",
"value": "#scan through each row\n#when you hit a high intensity pixel store x \n#when you hit a low intensity pixel for more than like 10 pixels set xfinal\n#scan each row and store all of the size values in ... | python | chosen |
[
{
"from": "human",
"value": "Add solution for problem 23, it's quite fast\n"
},
{
"from": "gpt",
"value": "#!/usr/bin/python\n\nfrom math import floor, sqrt\n\nLIMIT = 28134\n\n\ndef isAbundant(n):\n max_t = floor(sqrt(n)) + 1\n sum_d = 1\n for i in range(2, max_t):\n if n % i ==... | python | chosen |
[
{
"from": "human",
"value": "Add tests for the pixelset list view\n"
},
{
"from": "gpt",
"value": "from django.core.urlresolvers import reverse\n\nfrom apps.core.factories import PIXELER_PASSWORD, PixelerFactory\nfrom apps.core.tests import CoreFixturesTestCase\nfrom apps.core.management.command... | python | chosen |
[
{
"from": "human",
"value": "Add context manager for temp dir.\n"
},
{
"from": "gpt",
"value": "\"\"\"Helpers for working with paths an similar.\n\"\"\"\n\nimport os\n\n\nclass TempDir(object):\n \"\"\"Switch to a temporary directory and back.\n\n This is a context manager.\n\n usage:\n... | python | chosen |
[
{
"from": "human",
"value": "Add the classic missing file.\n"
},
{
"from": "gpt",
"value": "def op_cmp(op1, op2):\n \"\"\"\n Compare an operation by active and then opid.\n \"\"\"\n if op1['active'] != op2['active']:\n return -1 if op1['active'] else 1\n\n return cmp(op1['o... | python | chosen |
[
{
"from": "human",
"value": "Add tests for formatter yaml\n"
},
{
"from": "gpt",
"value": "import unittest, argparse\nfrom echolalia.formatter.yamler import Formatter\n\nclass YamlerTestCase(unittest.TestCase):\n\n def setUp(self):\n self.parser = argparse.ArgumentParser()\n self.data = [... | python | chosen |
[
{
"from": "human",
"value": "Add migration to convert GA timezone to UTC\n\nWe are ignoring the timezone from GA requests so previous data needs to\nbe converted to account for this.\n\nSee https://www.pivotaltracker.com/story/show/62779118 for details.\n"
},
{
"from": "gpt",
"value": "\"\"\"\nC... | python | chosen |
[
{
"from": "human",
"value": "Add delete all jobs script\n"
},
{
"from": "gpt",
"value": "#!/usr/bin/env python\n############################################################################\n# #\n# Copyright 2014 Prelert Ltd... | python | chosen |
[
{
"from": "human",
"value": "Create an example script that opens executable in subprocess and evaluates\n"
},
{
"from": "gpt",
"value": "import argparse\nimport os\nfrom subprocess import PIPE, Popen\n\n# insert your client_token into sigopt_creds.py\n# otherwise you'll see \"This endpoint requi... | python | chosen |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.