conversations listlengths 2 3 | source stringclasses 1
value | stack stringclasses 1
value |
|---|---|---|
[
{
"from": "system",
"value": "Update the PyPI version to 0.2.13\n"
},
{
"from": "human",
"value": "# -*- coding: utf-8 -*-\nimport os\nfrom setuptools import setup\n\ndef read(fname):\n try:\n return open(os.path.join(os.path.dirname(__file__), fname)).read()\n except:\n retu... | python | chosen |
[
{
"from": "human",
"value": "Make it a package for better dependency resolution.\n"
},
{
"from": "gpt",
"value": "# -*- coding: utf-8 -*-\nfrom setuptools import setup, find_packages\n\n\ninstall_requires = (\n )\ndescription = \"An archive population utility.\"\n\n\nsetup(\n name='cnx-arc... | python | chosen |
[
{
"from": "human",
"value": "Add missing migration for verbose_name changes in the jobs app.\n\nRefs #641.\n"
},
{
"from": "gpt",
"value": "# -*- coding: utf-8 -*-\nfrom __future__ import unicode_literals\n\nfrom django.db import models, migrations\nimport markupfield.fields\n\n\nclass Migration... | python | chosen |
[
{
"from": "human",
"value": "Update db models and migrations to comply with tests\n\nUpdate test cases to include more scenarios. This required changes in the\ndb models and collector code.\n\nDelete old migrations and start with a single, new migration.\n\nSigned-off-by: Christoph Kassen <21a19229d09eaaba5... | python | chosen |
[
{
"from": "human",
"value": "Create simple script to get first page of friends list.\n"
},
{
"from": "gpt",
"value": "import facebook\n\nfrom getpass import getpass\n\ntoken = getpass('User Access Token: ')\n\ngraph = facebook.GraphAPI(token)\nfriends = graph.get_connections(\"me\", \"friends\")... | python | chosen |
[
{
"from": "human",
"value": "[dif/util] Add a script for instantiating dif_template.tpl.h\n\nSigned-off-by: Miguel Young de la Sota <71b8e7f4945fd97b98544cf897992af89646547a@google.com>\n"
},
{
"from": "gpt",
"value": "#!/usr/bin/env python3\n# Copyright lowRISC contributors.\n# Licensed under t... | python | chosen |
[
{
"from": "human",
"value": "Add script to convert from sa-extract's unnamed format to cdec's more readable named format\n"
},
{
"from": "gpt",
"value": "#!/usr/bin/env python\nimport sys\n\nfeatNames = [ line.strip() for line in open(sys.argv[1]) if not line.startswith('#') ]\n\nfor line in sys... | python | chosen |
[
{
"from": "human",
"value": "Split DeVosSolarcell class into its own file\n"
},
{
"from": "gpt",
"value": "# -*- coding: utf-8 -*-\n\nimport numpy as np\nfrom astropy import constants, units\nfrom sympy.mpmath import polylog\nfrom physicalproperty import PhysicalProperty, find_PhysicalProperty\n... | python | chosen |
[
{
"from": "human",
"value": "Add more general extraction tests\n"
},
{
"from": "gpt",
"value": "# -*- coding: utf-8 -*-\n\"\"\"\ntest_extract\n~~~~~~~~~~~~\n\nTest data extraction on small document examples.\n\n:copyright: Copyright 2016 by Matt Swain.\n:license: MIT, see LICENSE file for more d... | python | chosen |
[
{
"from": "human",
"value": "Add validation for known h2 services\n"
},
{
"from": "gpt",
"value": "# Copyright 2018 Amazon.com, Inc. or its affiliates. All Rights Reserved.\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\"). You\n# may not use this file except in compliance w... | python | chosen |
[
{
"from": "human",
"value": "Add a new test for the state manager\n"
},
{
"from": "gpt",
"value": "# Copyright (c) 2016, Daniele Venzano\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may not use this file except in compliance with the License.\n# You may obtain a... | python | chosen |
[
{
"from": "human",
"value": "Define Source and Sink classes\n"
},
{
"from": "gpt",
"value": "from os import path\n\n\nclass Source:\n \"\"\"\n Data source context manager and reader.\n \"\"\"\n\n def __init__(self, source):\n self.source = source\n self.fd = None\n\n ... | python | chosen |
[
{
"from": "human",
"value": "Add first version of test w/responses\n"
},
{
"from": "gpt",
"value": "from expects import expect, equal\nfrom primestg.report import Report\nimport responses\nimport requests\nfrom primestg.service import Service\nfrom zeep.transports import Transport\n\nwith descri... | python | chosen |
[
{
"from": "human",
"value": "Add a bug query example\n"
},
{
"from": "gpt",
"value": "#!/usr/bin/env python\n\nimport bugsy\nfrom pdb import set_trace as bp\n\n# This example demonstrates querying bugs with an API key for product \"Foo\"\n\nbugzilla = bugsy.Bugsy(username='REDACTED', api_key='RE... | python | chosen |
[
{
"from": "human",
"value": "Add script to send updated projects to Datacite.\n\n[PLAT-1273]\n"
},
{
"from": "gpt",
"value": "\"\"\"\nScript to send updates to Datacite for projects that were updated\nwhile the DISABLE_DATACITE_DOIS switch was active.\n\nStart date:\n Dec 14, 2018 @ 10:09 PM ... | python | chosen |
[
{
"from": "human",
"value": "Add solution for 112 Path Sum.\n"
},
{
"from": "gpt",
"value": "# Definition for a binary tree node.\n# class TreeNode(object):\n# def __init__(self, x):\n# self.val = x\n# self.left = None\n# self.right = None\n\nclass Solution(object):\n... | python | chosen |
[
{
"from": "human",
"value": "Add a test for Python 3.3 bdist_egg issue\n\n--HG--\nbranch : distribute\nextra : rebase_source : e83ee69c3b15e4a75780811a7bb3612b8f7f54d1\n"
},
{
"from": "gpt",
"value": "import sys\nimport os\nimport tempfile\nimport unittest\nimport shutil\nimport copy\n\nCURDIR =... | python | chosen |
[
{
"from": "human",
"value": "Add script for adding LIWC entities to FoLiA XML file\n\nAdded a script that checks whether a word in the FoLiA file also occurs\nin the historic LIWC dictionary. If it does, and the word has certain\ncategories (at this time the script checks for posemo and negemo\nwords), an e... | python | chosen |
[
{
"from": "human",
"value": "Add benchmark script for pencode.pencode()\n\nBaseline on a MBP A1389, i7-4750HQ CPU @ 2.00GHz, Ubuntu 17.10 x64,\nPython 2.7.14, kernel 4.13.0-36-generic\n\npencode: Mean +- std dev: 95.8 ms +- 1.2 ms\n"
},
{
"from": "gpt",
"value": "#!/usr/bin/env python\n\nimport ... | python | chosen |
[
{
"from": "human",
"value": "Add solution to lintcode question 004\n"
},
{
"from": "gpt",
"value": "class Solution:\n \"\"\"\n @param {int} n an integer.\n @return {int} the nth prime number as description.\n \"\"\"\n def nthUglyNumber(self, n):\n # write your code here\n ... | python | chosen |
[
{
"from": "human",
"value": "Add py solution for 413. Arithmetic Slices\n\n413. Arithmetic Slices: https://leetcode.com/problems/arithmetic-slices/\n"
},
{
"from": "gpt",
"value": "class Solution(object):\n def numberOfArithmeticSlices(self, A):\n \"\"\"\n :type A: List[int]\n ... | python | chosen |
[
{
"from": "human",
"value": "Add a script to fix mixcased backrefs and params\n"
},
{
"from": "gpt",
"value": "import sys\n\nfrom framework.mongo import database as db\nfrom framework.transactions.context import TokuTransaction\n\nfrom website.app import init_app\n\n\ndef lowercase_nids():\n ... | python | chosen |
[
{
"from": "human",
"value": "Add storage to document image fields"
},
{
"from": "gpt",
"value": "# -*- coding: utf-8 -*-\n# Generated by Django 1.11.12 on 2018-05-21 23:14\nfrom __future__ import unicode_literals\n\nfrom django.db import migrations, models\nimport froide.document.models\nimport ... | python | chosen |
[
{
"from": "human",
"value": "Add test for category class\n"
},
{
"from": "gpt",
"value": "#!/usr/bin/python3\n# -*- coding: utf-8 -*-\n#\n# Copyright 2015 Pascual Martinez-Gomez\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may not use this file except in comp... | python | chosen |
[
{
"from": "human",
"value": "Extend test for processing words of tweets.\n"
},
{
"from": "gpt",
"value": "# -*- coding: utf-8 -*-\nfrom string import punctuation\n\nfrom test import _writeJSON, _readJSON\n\ntweetData = _readJSON('var/tweet_test.json')\n\n# Punctuation to be removed.\nmySymbols =... | python | chosen |
[
{
"from": "human",
"value": "Add a script to sync FS files to Swift\n\nChange-Id: I7a475177dd008040582943f7924a3f26df1df638\n"
},
{
"from": "gpt",
"value": "#!/usr/bin/env python\n\nimport os\nimport io\nimport tqdm\nfrom dci import dci_config\nfrom dci.db import models\nfrom sqlalchemy import s... | python | chosen |
[
{
"from": "human",
"value": "Add custom card model form for edit and create\n"
},
{
"from": "gpt",
"value": "from django.forms import Textarea, ModelForm\nfrom card_model import Card\n\n\nclass CardForm(ModelForm):\n \"\"\"The basic form for updating or editing cards\"\"\"\n\n class Meta:\... | python | chosen |
[
{
"from": "human",
"value": "Add docket namer for SEC/CFTC.\n"
},
{
"from": "gpt",
"value": "GEVENT = False\n\nfrom regs_models import *\nimport datetime\n\ndef run():\n for docket in Docket.objects(source=\"sec_cftc\", scraped=\"no\"):\n now = datetime.datetime.now()\n if not d... | python | chosen |
[
{
"from": "human",
"value": "Add utility for quickly loading the synonym file\n"
},
{
"from": "gpt",
"value": "import requests\n\nfrom codecs import open\nfrom requests.exceptions import MissingSchema, InvalidSchema, InvalidURL\n\nfrom .parser import SynParser\n\ndef load_synonyms(path):\n try:... | python | chosen |
[
{
"from": "human",
"value": "Add an example python code for loading the resulting data\n"
},
{
"from": "gpt",
"value": "\n# coding: utf-8\n\n# In[ ]:\n\nimport numpy as np\nimport pandas as pd\nimport matplotlib.pyplot as plt\n#import sys #(just for version number)\n#import matplotlib #(j... | python | chosen |
[
{
"from": "human",
"value": "Add prestoprime specific settings file.\n"
},
{
"from": "gpt",
"value": "# Do PrestoPRIME setup\nPRESTOPRIME = True\nDEFAULT_DELIVERY_SUCCESS_CONSTANT_MIN = 15.0\nDEFAULT_DELIVERY_SUCCESS_MULTIPLIER_GB = 1.0\nDELIVERY_SUCCESS_METRIC = \"http://mserve/deliverySuccess\... | python | chosen |
[
{
"from": "human",
"value": "Add tests for Row class\n"
},
{
"from": "gpt",
"value": "# coding: utf-8\n\"\"\" Tests for pypel.cli.\n\nTHIS SOFTWARE IS UNDER BSD LICENSE.\nCopyright (c) 2012-2015 Daniele Tricoli <eriol@mornie.org>\n\nRead LICENSE for more informations.\n\"\"\"\n\nimport unittest\... | python | chosen |
[
{
"from": "human",
"value": "Test fields property is a set\n"
},
{
"from": "gpt",
"value": "from thingstance import Thing\n\n\ndef test_tags_are_a_set():\n thing = Thing(fields={'latitude', 'longitude'})\n assert thing.fields == {'latitude', 'longitude'}\n\n thing = Thing(fields={'latit... | python | chosen |
[
{
"from": "human",
"value": "Add custom exception handler for API.\n"
},
{
"from": "gpt",
"value": "from django.http import HttpResponse\nfrom rest_framework.views import exception_handler\nfrom rest_framework.renderers import JSONRenderer\n\n# Initially taken from\n# http://www.django-rest-fram... | python | chosen |
[
{
"from": "human",
"value": "Add a sample on WebMap Serialization\n"
},
{
"from": "gpt",
"value": "\"\"\"\r\n create a webmap from code, \r\n add a dynamic layer, with dynamiclayer option for changing the symbols\r\n\r\n\"\"\"\r\n\r\n\r\nimport arcrest\r\nimport arcrest.webmap\r\nimport ar... | python | chosen |
[
{
"from": "human",
"value": "Add support for python -m.\n"
},
{
"from": "gpt",
"value": "from .ofp_app import ofp_run\nimport importlib\nimport argparse\nimport sys\n\ndef main():\n args = parse_args()\n for module in args.modules:\n import_module(module)\n ofp_run()\n\n\ndef par... | python | chosen |
[
{
"from": "system",
"value": "Change the default no of users from 9"
},
{
"from": "human",
"value": "# created by Chirath R, chirath.02@gmail.com\nfrom django.conf.urls import url\nfrom django.contrib.auth.decorators import login_required\nfrom django.views.generic import TemplateView\nfrom regi... | python | chosen |
[
{
"from": "human",
"value": "Test sql content manager. Refs gh-168\n"
},
{
"from": "gpt",
"value": "# coding=utf-8\n\nimport sys\nimport struct\nimport unittest\nimport time\nfrom test_000_config import TestConfig\nfrom test_020_connection import TestConnection\n\nfrom gi.repository import Midga... | python | chosen |
[
{
"from": "system",
"value": "Remove keyword argument and allow generic argument passing.\n"
},
{
"from": "human",
"value": "from django.forms.widgets import Select\n\n\nclass LayoutSelector(Select):\n \"\"\"\n Modified `Select` class to select the original value.\n\n This was adapted f... | python | chosen |
[
{
"from": "human",
"value": "Add abstract base class for dynamic items\n"
},
{
"from": "gpt",
"value": "import abc\nimport logbook\nimport jsonschema\n\nfrom piper.utils import DotDict\n\n\nclass DynamicItem(object):\n \"\"\"\n Dynamic base class that defines things all Piper classes need.... | python | chosen |
[
{
"from": "human",
"value": "Add script for creating shortcuts in linux\n"
},
{
"from": "gpt",
"value": "#!/usr/bin/env python3\nimport sys\nimport os\nimport os.path as op\n\ntry:\n import picasso\nexcept ImportError:\n print(\"This script must be run within an environment \"\n \"in wh... | python | chosen |
[
{
"from": "human",
"value": "Add script to generate refresh_token\n\nhttps://github.com/Imgur/imgurpython/blob/master/examples/auth.py\n"
},
{
"from": "gpt",
"value": "#!/usr/bin/env python3\n\nfrom imgurpython import ImgurClient\n\nimport config\n\nCONFIG_FILE = \"config.yaml\"\n\n\ndef authent... | python | chosen |
[
{
"from": "human",
"value": "Add example script that dumps a wikipedia category\n"
},
{
"from": "gpt",
"value": "\"\"\"dump_category.py - utility script for mps_edits.\"\"\"\n\nimport sys\nimport json\nimport getopt\nimport urllib\nimport urllib2\n\nclass ArticleFetchError(Exception):\n pass\... | python | chosen |
[
{
"from": "human",
"value": "Add migration for HX channel type\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 ('channels', '... | python | chosen |
[
{
"from": "human",
"value": "Move the file to correct path\n"
},
{
"from": "gpt",
"value": "from urllib2 import Request, urlopen, URLError\r\nfrom datetime import time\r\nfrom datetime import date\r\nimport datetime\r\nimport time\r\nimport sys\r\nimport os\r\n\r\n\r\n# Using request and urlopen... | python | chosen |
[
{
"from": "human",
"value": "Add a visitor for determining free variables\n"
},
{
"from": "gpt",
"value": "#!/usr/bin/python\n# -*- coding: UTF-8 -*-\n\n\"\"\"\nvisitors.py\n\n@author ejnp\n\"\"\"\n\nimport ast\nimport lambda_calculus_ast\n\n\nclass FreeVariables(ast.NodeVisitor):\n \"\"\"Vis... | python | chosen |
[
{
"from": "human",
"value": "Add pretty print json output\n"
},
{
"from": "gpt",
"value": "#!/bin/env python3\nimport json\nimport pprint\nimport sys\njson_string = \"\"\nfor line in sys.stdin.readlines():\n json_string = \"{}{}\".format(json_string, line.strip())\nitem = json.loads(json_stri... | python | chosen |
[
{
"from": "human",
"value": "Add api preferences for rpxnow\n"
},
{
"from": "gpt",
"value": "#!/usr/bin/env python\n# -*- coding: utf-8 -*-\n\nimport configuration\n\nRPX_REALM = 'mils-alumni-secure'\nrpxnow = {\n 'api_auth_url': 'https://rpxnow.com/api/v2/auth_info',\n 'api_key': 'b771106... | python | chosen |
[
{
"from": "system",
"value": "Fix import error for custom Field validation\n"
},
{
"from": "human",
"value": "\"\"\"This module provides SQL Server specific fields for Django models.\"\"\"\r\nfrom django.db.models import AutoField, ForeignKey, IntegerField\r\n\r\nclass BigAutoField(AutoField):\r... | python | chosen |
[
{
"from": "system",
"value": "Add `camel_to_snake()` and `snake_case_keys()` to praw.util\n"
},
{
"from": "human",
"value": "\"\"\"Package imports for utilities.\"\"\"\n\n__all__ = (\"cache\",)\n"
},
{
"from": "gpt",
"value": "\"\"\"Package imports for utilities.\"\"\"\n\nimport re\n... | python | chosen |
[
{
"from": "human",
"value": "Add minimalistic UPnP NAT punching\n\nThis is not in use yet.\n"
},
{
"from": "gpt",
"value": "import miniupnpc\nfrom ethereum import slogging\n\nMAX_PORT = 65535\nRAIDEN_IDENTIFICATOR = \"raiden-network udp service\"\n\nlog = slogging.getLogger(__name__)\n\n\ndef co... | python | chosen |
[
{
"from": "human",
"value": "Add a base class for OpenStack and Amazon.\n"
},
{
"from": "gpt",
"value": "from abc import ABCMeta, abstractmethod\n\n\nclass Cloud(object):\n __metaclass__ = ABCMeta\n\n def __init__(self):\n self.driver = None\n self.activeNode = None\n\n @a... | python | chosen |
[
{
"from": "human",
"value": "Move login test to a file by itself.\n"
},
{
"from": "gpt",
"value": "# -*- coding: utf-8 -*-\nfrom selenium import webdriver\nfrom selenium.common.exceptions import NoSuchElementException\nimport unittest\n\n\nclass Login(unittest.TestCase):\n def setUp(self):\n ... | python | chosen |
[
{
"from": "human",
"value": "Add 3rd week assignment of SC\n"
},
{
"from": "gpt",
"value": "\n# input_data = \"\"\"\n# 10101111\n# 01111101\n# 11001110\n# 00000010\n# 2\n# 3 -1\n# 1 1\n# \"\"\"\n# matrix_data = input_data.strip().split(\"\\n\")[:4]\n#\n# n_direction_data = input_data.strip().spl... | python | chosen |
[
{
"from": "human",
"value": "Print sum of same data types on a different line\n"
},
{
"from": "gpt",
"value": "i=10\nd=2.5\ns=\"HackerRank\"\n# Declare second integer, double, and String variables.\nii=int(raw_input())\ndd=float(raw_input())\nss=raw_input()\n# Read and save an integer, double, a... | python | chosen |
[
{
"from": "human",
"value": "Add py solution for 474. Ones and Zeroes\n\n474. Ones and Zeroes: https://leetcode.com/problems/ones-and-zeroes/\n"
},
{
"from": "gpt",
"value": "from collections import Counter\nclass Solution(object):\n def findMaxForm(self, strs, m, n):\n \"\"\"\n ... | python | chosen |
[
{
"from": "human",
"value": "Add a test for testing methods that save screenshots\n"
},
{
"from": "gpt",
"value": "import os\r\nfrom seleniumbase import BaseCase\r\n\r\n\r\nclass ScreenshotTests(BaseCase):\r\n\r\n def test_save_screenshot(self):\r\n self.open(\"https://seleniumbase.io/... | python | chosen |
[
{
"from": "human",
"value": "Add small web backend serving static index.html and being api for getting torrent download info\n"
},
{
"from": "gpt",
"value": "#!./bin/python3\nfrom functools import wraps\nfrom rpc import RTorrentXMLRPCClient\nimport os\nfrom flask import Flask, g, json, request\n... | python | chosen |
[
{
"from": "human",
"value": "Add a test for priority levels\n"
},
{
"from": "gpt",
"value": "#!/usr/bin/env python\n# -*- coding: utf-8 -*-\n# Simple test to send each priority level\nimport unittest\nimport logging\nlogging.basicConfig(level=logging.WARNING)\nfrom gntp.notifier import GrowlNoti... | python | chosen |
[
{
"from": "human",
"value": "Add a new utility for easily making arbitrary hub GET calls\n\nUseful for exploring for undocumented endpoints without having to deal\nwith authentication, hub ip and so on.\n"
},
{
"from": "gpt",
"value": "#!/usr/bin/env python3\nfrom cozify import hub, hub_api\nimp... | python | chosen |
[
{
"from": "human",
"value": "Add mecab related utility function\n"
},
{
"from": "gpt",
"value": "import operator\n\nclass WordInfo(object):\n def __init__(self):\n dictionary_form = \"\"\n word_class = \"\" \n spelling = \"\"\n value = \"\"\n f... | python | chosen |
[
{
"from": "human",
"value": "Test that Widget does not produce any view output\n"
},
{
"from": "gpt",
"value": "# Copyright (c) Jupyter Development Team.\n# Distributed under the terms of the Modified BSD License.\n\n\"\"\"Test Widget.\"\"\"\n\nfrom IPython.utils.capture import capture_output\nf... | python | chosen |
[
{
"from": "system",
"value": "Fix the django debug toolbar not appearing and the user echo thing slowing my loadings in development.\n"
},
{
"from": "human",
"value": "# Debug-toolbar related\n\nINSTALLED_APPS += ('debug_toolbar', )\n\nMIDDLEWARE_CLASSES += ('debug_toolbar.middleware.DebugToolba... | python | chosen |
[
{
"from": "human",
"value": "Add view class for the sessions module\n"
},
{
"from": "gpt",
"value": "# This file is part of Indico.\n# Copyright (C) 2002 - 2015 European Organization for Nuclear Research (CERN).\n#\n# Indico is free software; you can redistribute it and/or\n# modify it under the... | python | chosen |
[
{
"from": "human",
"value": "Make a plot as function of time for some datasets.\n"
},
{
"from": "gpt",
"value": "import numpy as np\nimport matplotlib.pyplot as plt\nimport matplotlib\nfrom mpl_toolkits.mplot3d import Axes3D\nimport sys\n\nimport numpy.ma as ma\n\nfuz = 1/4.;\nif (len(sys.argv) ... | python | chosen |
[
{
"from": "human",
"value": "Add outline for catalog readers\n"
},
{
"from": "gpt",
"value": "class CatalogReader(object):\n \"\"\"\n Basic \"interface\" to the ODM catalog readers.\n Resembles the structure of CKAN harvesters, for later CKAN imports.\n \"\"\"\n\n def info(self):\... | python | chosen |
[
{
"from": "human",
"value": "Add author remapping script to merge different datasets\n"
},
{
"from": "gpt",
"value": "#!/usr/bin/python3\n\nimport sys\nimport json\n\nif len(sys.argv) < 4:\n print(\"Usage: ./remap_authors.py <input_journal> <old_authors.json> <new_authors.json>\")\n print(... | python | chosen |
[
{
"from": "human",
"value": "Add raw embryo interpolation code\n"
},
{
"from": "gpt",
"value": "# IPython log file\n\n\nimage = np.zeros((2048, 2048), dtype=float)\nimage[0, 0] = 1\nnp.percentile(image, [0.1, 99.9])\nget_ipython().run_line_magic('pinfo', 'np.percentile')\nnp.stack([np.zeros((3, ... | python | chosen |
[
{
"from": "human",
"value": "Add a low-level socket client\n"
},
{
"from": "gpt",
"value": "\"\"\"\nLow-level socket client.\n\"\"\"\nimport socket\nfrom typing import Any\n\nfrom ..client import Client\nfrom ..response import Response\n\n\nclass SocketClient(Client):\n \"\"\"\n Args:\n ... | python | chosen |
[
{
"from": "human",
"value": "Add simple integration test for model serialization\n\nThis test creates a new metamodel in memory (by code), create an\ninstance of the metamodel, serialize the instance model as XMI, then\nre-read it again from another resource.\n"
},
{
"from": "gpt",
"value": "imp... | python | chosen |
[
{
"from": "human",
"value": "Add a migration for fixing bad dates\n\nThis migration is for the case that some bad dates were imported before\nthe propper date validation was added.\n"
},
{
"from": "gpt",
"value": "# Copyright (C) 2015 Google Inc., authors, and contributors <see AUTHORS file>\n# ... | python | chosen |
[
{
"from": "human",
"value": "Split off masking utility functions\n"
},
{
"from": "gpt",
"value": "\nimport skimage.morphology as mo\nimport scipy.ndimage as nd\nimport warnings\n\ntry:\n import cv2\n CV2_FLAG = True\nexcept ImportError:\n warnings.warn(\"Cannot import cv2. Computing wit... | python | chosen |
[
{
"from": "human",
"value": "Add thread implementation to watch files\n"
},
{
"from": "gpt",
"value": "from threading import Thread\nfrom werkzeug._reloader import ReloaderLoop\n\nclass Watcher(Thread, ReloaderLoop):\n\n def __init__(self, dirname, interval=1, static, tasks, *args, **kwargs):... | python | chosen |
[
{
"from": "human",
"value": "Add main for messaging server.\n"
},
{
"from": "gpt",
"value": "import os\nimport json\n\nfrom .core.logger import configure_logging\nfrom .core.messaging import MessageServer\n\n\ndef get_password():\n if \"REDIS_PASSWD\" in os.environ:\n return os.environ... | python | chosen |
[
{
"from": "human",
"value": "Test updated for change to assign_to_workflow_receive_sample.py in last commit.\n"
},
{
"from": "gpt",
"value": "#!/usr/bin/env python\nfrom EPPs.common import StepEPP, step_argparser\n\nclass GenerateHamiltonInputUPL(StepEPP):\n \"\"\"\"Generate a CSV containing ... | python | chosen |
[
{
"from": "human",
"value": "Add min block wall algorithm.\n"
},
{
"from": "gpt",
"value": "from collections import deque\n\ndef solution(H):\n levels = deque()\n blocks = 0\n for i in xrange(len(H)):\n print H[i]\n while len(levels) > 0 and levels[-1] > H[i]:\n ... | python | chosen |
[
{
"from": "human",
"value": "Add mnist 8by8 classifier with scikit dataset\n"
},
{
"from": "gpt",
"value": "from __future__ import print_function\nimport time\nimport numpy as np\nfrom sklearn.cross_validation import train_test_split\nfrom sklearn.datasets import load_digits\nfrom sklearn.metric... | python | chosen |
[
{
"from": "human",
"value": "Remove expired files from database and storage."
},
{
"from": "gpt",
"value": "#!/usr/bin/env python\n\n# Standard Library\nimport os\nimport sqlite3\nimport ConfigParser as configparser\nfrom datetime import datetime\n\n# Third party\nfrom dateutil.relativedelta imp... | python | chosen |
[
{
"from": "human",
"value": "Add simple uuid generator based on length and ASCII chars\n"
},
{
"from": "gpt",
"value": "#! /usr/bin/env python\n# -*- coding: utf-8 -*-\n# >>\n# gevent-tasks, 2017\n# <<\n\nimport random\nimport string\n\nch_choices = string.ascii_letters + string.digits\n\n\n... | python | chosen |
[
{
"from": "human",
"value": "Add tests for explorer views mixins\n"
},
{
"from": "gpt",
"value": "import pytest\n\nfrom django.test import TestCase\n\nfrom apps.explorer.views.mixins import DataTableMixin, SubsetSelectionMixin\n\n\nclass DataTableMixinTestCase(TestCase):\n\n def test_get_omic... | python | chosen |
[
{
"from": "human",
"value": "Add an example how to write to the LED matrix from another thread\n"
},
{
"from": "gpt",
"value": "from threading import Thread\nfrom time import sleep\n\nfrom nuimo import Controller, ControllerManager, ControllerListener, LedMatrix\n\n\nMAC_ADDRESS = \"c4:d7:54:71:... | python | chosen |
[
{
"from": "human",
"value": "Add py solution for 507. Perfect Number\n\n507. Perfect Number: https://leetcode.com/problems/perfect-number/\n"
},
{
"from": "gpt",
"value": "class Solution(object):\n def checkPerfectNumber(self, num):\n \"\"\"\n :type num: int\n :rtype: boo... | python | chosen |
[
{
"from": "human",
"value": "Add problem Game Of Life\n"
},
{
"from": "gpt",
"value": "# https://leetcode.com/problems/game-of-life/\n\nclass Solution(object):\n def gameOfLife(self, board):\n \"\"\"\n :type board: List[List[int]]\n :rtype: void Do not return anything, mo... | python | chosen |
[
{
"from": "human",
"value": "Add realization of adapter class\n"
},
{
"from": "gpt",
"value": "# -*- coding: utf-8 -*-\n\n\"\"\"\nDeclaration of classes needed for bot working:\nAdapter class, Plugin class\n\n@author: Lises team\n@contact: zhidkovseva@gmail.com\n@license: The MIT license\n\nCopy... | python | chosen |
[
{
"from": "human",
"value": "Add an exception-raising-on-http-error urlopen function\n"
},
{
"from": "gpt",
"value": "import urllib as _urllib\n\nclass HTTPError(IOError):\n def __init__(self, code, msg, headers):\n IOError.__init__(self, 'HTTP error', code, msg, headers)\n def __st... | python | chosen |
[
{
"from": "human",
"value": "Add script for extracting pmids out of pubmed data.\n"
},
{
"from": "gpt",
"value": "\"\"\"\nExtract a set of doc ids from the pubmed xml files.\n\"\"\"\nimport argparse\nimport glob\nimport gzip\nimport multiprocessing\nimport os\nfrom functools import partial\nfrom... | python | chosen |
[
{
"from": "human",
"value": "Add test for INT vs LONG conversion on Py2\n\nint and long are the same on py3, but we do care about the conversion from Python too which in case INT is >=2**31 then Java might have problem with that and it could cause issues for the users\n"
},
{
"from": "gpt",
"val... | python | chosen |
[
{
"from": "human",
"value": "Add simple test case for cpu compound registers\n"
},
{
"from": "gpt",
"value": "from nose.tools import eq_, ok_\n\nfrom snoboy import cpu\n\ndef test_BC():\n\tcpu.registers.DE = 0xB060\n\tcpu.registers.BC = 0xC005\n\teq_(cpu.registers.BC, 0xC005)\n\teq_(cpu.register... | python | chosen |
[
{
"from": "human",
"value": "Add script to only predict if above confidence threshold.\n"
},
{
"from": "gpt",
"value": "import numpy as np\nimport tensorflow.contrib.keras as keras\n\nPWD = 'products'\nMODEL = \"{}/model.h5\".format(PWD)\nTHRESHOLD = 0.75\n\n# Load model.\nmodel = kera... | python | chosen |
[
{
"from": "system",
"value": "Use relative import to allow vendoring\n"
},
{
"from": "human",
"value": "# Copyright 2014 Donald Stufft\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may not use this file except in compliance with the License.\n# You may obtain a c... | python | chosen |
[
{
"from": "human",
"value": "Add initial version Careers and Enterprise Oauth2 backend.\n"
},
{
"from": "gpt",
"value": "from django.conf import settings\nfrom social_core.backends.oauth import BaseOAuth2\nimport logging\nimport re\n\nlog = logging.getLogger(__name__)\n\n\nclass CareersAndEnterp... | python | chosen |
[
{
"from": "human",
"value": "Add hw 1 problem 1 solution\n"
},
{
"from": "gpt",
"value": "\"\"\"Problem 1: Break math\nBreak math using a computer. To be a bit more specific, demonstrate a\nnumerical calculation using the computer language of your choice where\nthe answer is demonstrably wrong. ... | python | chosen |
[
{
"from": "human",
"value": "Add .py file to repo.\n"
},
{
"from": "gpt",
"value": "def draw_constant(res=10):\n \"\"\"Re-draws a Read node using Constant nodes as pixels.\"\"\"\n # Checks that the user has selected a Read node.\n\n try:\n if nuke.selectedNode().Class() != \"Read... | python | chosen |
[
{
"from": "human",
"value": "Add header pass through tests\n"
},
{
"from": "gpt",
"value": "from django.test.client import RequestFactory\nfrom mock import Mock\nfrom unittest2 import TestCase\n\nfrom helpers import RequestPatchMixin\nfrom test_views import TestProxy\n\n\nclass HttpProxyHeaderPa... | python | chosen |
[
{
"from": "human",
"value": "Add script to guess text encoding\n"
},
{
"from": "gpt",
"value": "#!/usr/bin/env python\n\n\nimport sys\n\n\n# common characters in GB\ngb_cc = frozenset([\nb\"\\xce\\xd2\", # 我\nb\"\\xb5\\xc4\", # 的\nb\"\\xc4\\xe3\", # 你\nb\"\\xca\\xc7\", # 是\nb\"\\xb2\\xbb\", # 不\... | python | chosen |
[
{
"from": "human",
"value": "Add test for fields variables lookup\n"
},
{
"from": "gpt",
"value": "\"\"\"Test cases for variable fields\n\"\"\"\nimport unittest\n\nfrom lighty.templates import Template\n\n\nclass VariableFieldTestCase(unittest.TestCase):\n \"\"\"Test case for block template t... | python | chosen |
[
{
"from": "human",
"value": "Add a management command to check legacy preference\n"
},
{
"from": "gpt",
"value": "#!/usr/bin/python\n\"\"\"\nTest all the links in the CSV for non-200 status codes (after redirects).\n\"\"\"\n\nimport sys\nfrom django.core.management.base import BaseCommand, Comma... | python | chosen |
[
{
"from": "human",
"value": "Add tests for context decorators\n"
},
{
"from": "gpt",
"value": "from unittest import TestCase, mock\n\nfrom mycroft.skills.context import adds_context, removes_context\n\"\"\"\nTests for the adapt context decorators.\n\"\"\"\n\n\nclass ContextSkillMock(mock.Mock):\... | python | chosen |
[
{
"from": "human",
"value": "Add util script to generate item names.\n"
},
{
"from": "gpt",
"value": "'''Script to help generate item names.'''\n\n\ndef int_to_str(num, alphabet):\n '''Convert integer to string.'''\n # http://stackoverflow.com/a/1119769/1524507\n if (num == 0):\n ... | python | chosen |
[
{
"from": "human",
"value": "Add missing migration in sandbox\n"
},
{
"from": "gpt",
"value": "# -*- coding: utf-8 -*-\n# Generated by Django 1.10.5 on 2017-05-02 15:33\nfrom __future__ import unicode_literals\n\nfrom django.db import migrations, models\n\n\nclass Migration(migrations.Migration)... | python | chosen |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.