conversations listlengths 2 3 | source stringclasses 1
value | stack stringclasses 1
value |
|---|---|---|
[
{
"from": "human",
"value": "Add some ugly code to make pretty and more efficient\n"
},
{
"from": "gpt",
"value": "def pretty_function(string_to_count):\n raise NotImplementedError()\n\n\ndef Ugly_Function(string_to_count):\n Cpy_Of_String = str(string_to_count)\n Result = {}#hol... | python | chosen |
[
{
"from": "human",
"value": "Add user admin script with list function\n"
},
{
"from": "gpt",
"value": "#!/usr/bin/python\nimport argparse\nimport datetime\nimport json\nimport sys\nimport requests\n\ndef listusers(server):\n try:\n url = 'http://' + server + '/nhlplayoffs/api/v2.0/play... | python | chosen |
[
{
"from": "human",
"value": "PM-86: Add simple script to upload hg pack files to a device\n"
},
{
"from": "gpt",
"value": "#!/usr/bin/env python\n\nfrom pymoku import Moku\nimport sys, logging\n\nlogging.basicConfig(format='%(asctime)s:%(name)s:%(levelname)s::%(message)s')\nlog = logging.getLogg... | python | chosen |
[
{
"from": "human",
"value": "Add unit test for KCIS (defined in pbc/ci/kcis_rhf.py)\n"
},
{
"from": "gpt",
"value": "import pyscf.pbc.cc.test.make_test_cell as make_test_cell\nfrom pyscf.pbc import gto, scf, ci\nfrom pyscf.pbc.ci import KCIS\nimport unittest\n\ncell = make_test_cell.test_cell_n3... | python | chosen |
[
{
"from": "human",
"value": "Create initial vector variance helpers file\n"
},
{
"from": "gpt",
"value": "import math\n\ndef listVariance(base, new):\n for i in new:\n if i in base:\n return 0\n return 1\n\ndef valueVariance(base, new):\n return math.fabs(base-new)\n\n... | python | chosen |
[
{
"from": "human",
"value": "Add merge heads needed migration\n"
},
{
"from": "gpt",
"value": "\"\"\"empty message\n\nRevision ID: c3d394d9dfd1\nRevises: ('3c81fc76164c', 'c19bff0f70ab')\nCreate Date: 2021-01-06 12:53:14.809274\n\n\"\"\"\nfrom alembic import op\nimport sqlalchemy as sa\n\n\n# re... | python | chosen |
[
{
"from": "human",
"value": "Add unit tests for i18n.\n"
},
{
"from": "gpt",
"value": "# -*- coding: utf8 -*-\n###\n# Copyright (c) 2012, Valentin Lorentz\n# All rights reserved.\n#\n# Redistribution and use in source and binary forms, with or without\n# modification, are permitted provided that... | python | chosen |
[
{
"from": "human",
"value": "Add base class for cogs using ESIpy\n"
},
{
"from": "gpt",
"value": "import esipy\nfrom discord.ext import commands\nimport time\n\nESI_SWAGGER_JSON = 'https://esi.evetech.net/latest/swagger.json'\nESI_APP: esipy.App = None\nESI_CLIENT: esipy.EsiClient = None\n\n\nde... | python | chosen |
[
{
"from": "human",
"value": "Add a timeout wrapper play\n"
},
{
"from": "gpt",
"value": "import composite_behavior\nimport behavior\nimport constants\nimport robocup\nimport time\nimport main\nimport enum\nimport logging\n\nclass TimeoutBehavior(composite_behavior.CompositeBehavior):\n\n\n cl... | python | chosen |
[
{
"from": "human",
"value": "Make migration for Teacher model after add nationlaity field to it\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 depende... | python | chosen |
[
{
"from": "human",
"value": "Add data extraction from dhis\n"
},
{
"from": "gpt",
"value": "import pandas as pd\nfrom blsqpy.postgres_hook import PostgresHook\nfrom blsqpy.dhis2 import Dhis2\n\npgHook = PostgresHook('local_pdss')\ndhis = Dhis2(pgHook)\ndhis.build_de_cc_table()\n\ndhis.get_data\n... | python | chosen |
[
{
"from": "human",
"value": "Add module index for libport instrumentation for GDB.\n\n\t* share/gdb/python/libport/__init__.py: New.\n"
},
{
"from": "gpt",
"value": "# Copyright (C) 2011, Gostai S.A.S.\n#\n# This software is provided \"as is\" without warranty of any kind,\n# either expressed or... | python | chosen |
[
{
"from": "system",
"value": "Reorder python import test to use gnu dbm imports instead of generic dbm\n"
},
{
"from": "human",
"value": "import curses\nimport dbm\nimport readline\n\nimport bz2\nassert(bz2.decompress(bz2.compress(b'IT WORKS IT WORKS IT WORKS')) == b'IT WORKS IT WORKS IT WORKS')... | python | chosen |
[
{
"from": "human",
"value": "Create initial script for gathering AIN value from CLI.\n"
},
{
"from": "gpt",
"value": "import digihw\nimport sarcli\nfrom time import sleep\n\nGPIO_CLI = 'gpio ain'\n\n\ndef cli(cmd):\n s = sarcli.open()\n s.write(cmd)\n resp = s.read()\n s.close()\n ... | python | chosen |
[
{
"from": "human",
"value": "Add script for preprocess of Universal bilingual dictionary database\n"
},
{
"from": "gpt",
"value": "import itertools\nimport codecs\n\nd=[]\nfor entry in a.findall(\"ar\"):\n \n foo = [x.text.split(\";\") for x in entry if x.text]\n if len(foo) == 2:\n ... | python | chosen |
[
{
"from": "human",
"value": "Add kernel construction based on kernels\n"
},
{
"from": "gpt",
"value": "\"Functions to create kernels from already existing kernels.\"\n\nimport numpy as np\n\n\ndef normalize(kernel, *args, **kwargs):\n \"\"\"Return the normalized version.\n\n This correspon... | python | chosen |
[
{
"from": "human",
"value": "Add tool to generate timeline data\n"
},
{
"from": "gpt",
"value": "#!/usr/bin/python2\n\nimport json\nimport subprocess\nimport time\nimport calendar\nimport dateutil.parser\nimport datetime\n\nruns = json.load(open(\"list.json\",\"r\"))\n\nnum_master = 0\n\npsnr = ... | python | chosen |
[
{
"from": "human",
"value": "Copy the RSP2 FTP settings from one INI file into another\n"
},
{
"from": "gpt",
"value": "#C:\\Users\\smst\\AppData\\Local\\Radio Server Player 2>\r\n#for /d %f in (profiles\\*) do \\code\\rsab\\nowplaying\\copy_ftp.py setup.ini \"%f\\setup.ini\"\r\n\r\nstart_time =... | python | chosen |
[
{
"from": "human",
"value": "Add a new Python implementation about de Boor recurrence to draw\nBSplines curves, this commit contains the initial work on a module\nwhich contains knot partition extension utilities.\n"
},
{
"from": "gpt",
"value": "\n\nimport numpy as np\n\ndef extend_knots_vector... | python | chosen |
[
{
"from": "human",
"value": "Add test to catch bug in compare_to_groundtruth\n"
},
{
"from": "gpt",
"value": "# py-motmetrics - Metrics for multiple object tracker (MOT) benchmarking.\n# https://github.com/cheind/py-motmetrics/\n#\n# MIT License\n# Copyright (c) 2017-2020 Christoph Heindl, Jack ... | python | chosen |
[
{
"from": "human",
"value": "Add an unencrypted file based backend.\n"
},
{
"from": "gpt",
"value": "import os\nimport codecs\n\nimport keyring.util.platform\nfrom keyring.py27compat import configparser\nfrom keyring.backends.file import BaseKeyring\nfrom keyring.core import load_keyring\nfrom k... | python | chosen |
[
{
"from": "human",
"value": "Add migration for updates to workup (smallintegerfield -> charfield to fix vitals thing).\n"
},
{
"from": "gpt",
"value": "# -*- coding: utf-8 -*-\nfrom __future__ import unicode_literals\n\nfrom django.db import migrations, models\nimport workup.validators\n\n\nclas... | python | chosen |
[
{
"from": "human",
"value": "Add script for transforming trec topic files to lucene4ir topic files.\n"
},
{
"from": "gpt",
"value": "\"\"\"\nTransform janky trec topics into lucene4ir topics.\n\"\"\"\n\nimport argparse\n\nimport sys\n\n\ndef transform(data: str) -> str:\n \"\"\"\n\n :param... | python | chosen |
[
{
"from": "human",
"value": "Add script to fix funding source\n"
},
{
"from": "gpt",
"value": "import pandas as pd\n\nfrom django.core.management.base import BaseCommand\n\nfrom lowfat.models import Fund, Expense\n\nclass Command(BaseCommand):\n help = \"Fix funding source\"\n\n def add_ar... | python | chosen |
[
{
"from": "human",
"value": "Add script to validate incoming tweet IDs\n"
},
{
"from": "gpt",
"value": "#!/usr/bin/env python\nimport json\nimport sys\n\ncount = 0\nmismatches = 0\n\n# Validate incoming twitter object id, id_str match and are expected types\n# stdin is JSONL tweet objects (one f... | python | chosen |
[
{
"from": "human",
"value": "Add tests for config dict merging\n"
},
{
"from": "gpt",
"value": "import unittest\n\n\nclass TestConfigMerge(unittest.TestCase):\n\n def _call_fut(self, destcfg, srccfg):\n from tilequeue.config import merge_cfg\n return merge_cfg(destcfg, srccfg)\n... | python | chosen |
[
{
"from": "human",
"value": "tests/basics: Add test for super() when self is closed over.\n"
},
{
"from": "gpt",
"value": "# test that no-arg super() works when self is closed over\n\nclass A:\n def __init__(self):\n self.val = 4\n def foo(self):\n # we access a member of sel... | python | chosen |
[
{
"from": "human",
"value": "Add tests for ``get_reader`` func\n"
},
{
"from": "gpt",
"value": "from catsup.reader import get_reader, markdown_reader, txt_reader\n\n\ndef test_reader_choser():\n assert get_reader(\"md\") == markdown_reader\n assert get_reader(\"markdown\") == markdown_read... | python | chosen |
[
{
"from": "human",
"value": "Add the most excellent web server ever conceived.\n\nUse PROFOUND_PORT and PROFOUND_NAME to control the service port\nand \"name\", respectively. It has sane defaults for each.\n"
},
{
"from": "gpt",
"value": "#!/usr/bin/env python\n\n# What an incredibly stupid app... | python | chosen |
[
{
"from": "system",
"value": "Modify login page test to use selectors defined in the module constants.\n"
},
{
"from": "human",
"value": "from src.lib.page.login import LoginPage\nfrom src.lib.base import BaseTest\n\n\nclass TestLoginPage(BaseTest):\n def test_login_as_admin(self):\n l... | python | chosen |
[
{
"from": "human",
"value": "Add support for MySQL-Connector python driver.\n"
},
{
"from": "gpt",
"value": "try:\n import mysql.connector as mysql_connector\nexcept ImportError:\n mysql_connector = None\n\nfrom peewee import ImproperlyConfigured\nfrom peewee import MySQLDatabase\n\n\nclas... | python | chosen |
[
{
"from": "human",
"value": "Add solutions and demo scripts\n"
},
{
"from": "gpt",
"value": "\"\"\"\nDecorators\n\"\"\"\n\n# 1 Decorators##################################################################\n# Have a look at the warnings examples in warnings.py. How would you\n# go about writing a ... | python | chosen |
[
{
"from": "system",
"value": "Fix pep8 in mysql test\n\nSigned-off-by: Brandon Myers <9cda508be11a1ae7ceef912b85c196946f0ec5f3@mozilla.com>\n"
},
{
"from": "human",
"value": "from tests.scoring_engine.engine.checks.check_test import CheckTest\n\n\nclass TestMYSQLCheck(CheckTest):\n check_name... | python | chosen |
[
{
"from": "human",
"value": "Add test for hardcoded user model in migrations\n\nNew migrations need to be manually updated to correctly deal with custom\nuser models. This test fails if this isn't done.\n"
},
{
"from": "gpt",
"value": "# -*- coding: utf-8 -*-\n\nimport os\n\nfrom django.test imp... | python | chosen |
[
{
"from": "human",
"value": "Add function to calculate gain/read noise given a directory.\n"
},
{
"from": "gpt",
"value": "from triage_fits_files import ImageFileCollection\nfrom ccd_characterization import ccd_gain, ccd_read_noise\nfrom numpy import array\nfrom astropysics import ccd\n\ndef as... | python | chosen |
[
{
"from": "human",
"value": "Add script to fix gpt mounting issue with ubuntu.\n"
},
{
"from": "gpt",
"value": "#!/usr/bin/env python\n#\n# Copyright 2014 Microsoft Corporation\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may not use this file except in complian... | python | chosen |
[
{
"from": "human",
"value": "Add some unit tests for approximate fractions.\n"
},
{
"from": "gpt",
"value": "from __future__ import division\n\nfrom nose.tools import *\n\nfrom fractions import Fraction\nfrom ..fraction import *\n\ndef test_fraction():\n \"\"\"Smoke tests to convert float to ... | python | chosen |
[
{
"from": "human",
"value": "Add script to convert agenda to markdown\n"
},
{
"from": "gpt",
"value": "#!/usr/bin/env python3.8\n\nimport sys\nimport yaml\n\ndef print_votes(votes):\n if votes:\n for v in votes:\n print(\"\"\"* [#{num}](https://github.com/mpi-forum/mpi-issue... | python | chosen |
[
{
"from": "system",
"value": "Add alternative solution for 'Reverse words in string III'\n"
},
{
"from": "human",
"value": "# Time: O(n)\n# Space: O(1)\n\n# Given a string, you need to reverse the order of characters in each word within a sentence\n# while still preserving whitespace and initia... | python | chosen |
[
{
"from": "human",
"value": "Add script to generate the \"loading\" animation\n"
},
{
"from": "gpt",
"value": "#!/usr/bin/env python3\n\n\"\"\" Generate a \"loading\" or \"waiting\" animated gif. \"\"\"\n\nimport math\n\nimport PIL.Image\nimport PIL.ImageDraw\n\nSIZE = 16\nTOTAL_DOTS = 8\nVISUAL... | python | chosen |
[
{
"from": "human",
"value": "Add basic ML framework- does not work though\n"
},
{
"from": "gpt",
"value": "#!/usr/bin/env python\n# rgb2_color_k_nearest.py\n# by wilsonmar@gmail.com, ayush.original@gmail.com, paarth.n@gmail.com\n# This is not the complete/correct approach. This is just the frame... | python | chosen |
[
{
"from": "human",
"value": "Add base setup file for generating packages\n\n--HG--\nextra : convert_revision : svn%3Aacbfec75-9323-0410-a652-858a13e371e0/trunk%40527\n"
},
{
"from": "gpt",
"value": "from distutils.core import setup\n\nlong_description=\"\"\"HTML parser designed to follow the WHA... | python | chosen |
[
{
"from": "human",
"value": "Add python script to diplay webcam video stream\n"
},
{
"from": "gpt",
"value": "import cv2\n\ncv2.namedWindow(\"preview\")\n\nvc = cv2.VideoCapture(0)\n\nif vc.isOpened(): # try to get the first frame\n rval, frame = vc.read()\nelse:\n rval = False\n\nwhile rv... | python | chosen |
[
{
"from": "human",
"value": "Implement a class to feed minibatches for N-pair-mc training\n"
},
{
"from": "gpt",
"value": "# -*- coding: utf-8 -*-\n\"\"\"\nCreated on Tue Jan 10 00:15:50 2017\n\n@author: sakurai\n\"\"\"\n\nimport numpy as np\nfrom sklearn.preprocessing import LabelEncoder\n\nfro... | python | chosen |
[
{
"from": "human",
"value": "Solve Code Fights doodled password problem\n"
},
{
"from": "gpt",
"value": "#!/usr/local/bin/python\n# Code Fights Alphabetic Shift Problem\n\nfrom collections import deque\n\n\ndef doodledPassword(digits):\n n = len(digits)\n res = [deque(digits) for _ in rang... | python | chosen |
[
{
"from": "human",
"value": "Add tests for categories in cache\n"
},
{
"from": "gpt",
"value": "# -*- coding: utf8 -*-\n# This file is part of PyBossa.\n#\n# Copyright (C) 2015 SF Isle of Man Limited\n#\n# PyBossa is free software: you can redistribute it and/or modify\n# it under the terms of t... | python | chosen |
[
{
"from": "human",
"value": "Add draft of linter script to check locale format consistency\n"
},
{
"from": "gpt",
"value": "import re\nimport json\nimport glob\n\nlocale_folder = \"../locales/\"\nlocale_files = glob.glob(locale_folder + \"*.json\")\nlocale_files = [filename.split(\"/\")[-1] for ... | python | chosen |
[
{
"from": "human",
"value": "Add tests for registration view\n"
},
{
"from": "gpt",
"value": "from django.test import TestCase\nfrom django.core.urlresolvers import reverse\n\nfrom ..models import PendingUser\n\n\nclass RegisterViewTestCase(TestCase):\n def test_view_loads(self):\n res... | python | chosen |
[
{
"from": "system",
"value": "Use the correct location of view_counter in test\n"
},
{
"from": "human",
"value": "\"\"\" Simple test for the view counter that verifies that it is updating properly \"\"\"\n\nfrom collections import namedtuple\n\nfrom mock import Mock\n\nfrom xblock.runtime import... | python | chosen |
[
{
"from": "human",
"value": "Move test to it's own file\n\nThe `from_json` method being tested has moved from the api client to the model,\nso I've moved the test to reflect the change.\n"
},
{
"from": "gpt",
"value": "from app import create_app, ApiClient\nfrom .flask_api_client.test_api_client... | python | chosen |
[
{
"from": "human",
"value": "Add script select class images from video protocols.\n"
},
{
"from": "gpt",
"value": "#!/usr/bin/env python\n\nimport sys\nimport os.path as osp\nimport os\nimport argparse\nthis_dir = osp.dirname(__file__)\nsys.path.insert(0, osp.join(this_dir, '../../external/'))\n... | python | chosen |
[
{
"from": "human",
"value": "Add a test for object mask.\n"
},
{
"from": "gpt",
"value": "from unrealcv import client\nimport re\n\nclass Color(object):\n ''' A utility class to parse color value '''\n regexp = re.compile('\\(R=(.*),G=(.*),B=(.*),A=(.*)\\)')\n def __init__(self, color_s... | python | chosen |
[
{
"from": "system",
"value": "Add decorator to declare function deprecated\n"
},
{
"from": "human",
"value": "# Copyright 2020 Ternaris.\n# SPDX-License-Identifier: AGPL-3.0-only\n\nimport warnings\nfrom dataclasses import dataclass\nfrom typing import Any\n\n\n@dataclass\nclass Info:\n modu... | python | chosen |
[
{
"from": "human",
"value": "Add a script to smooth gt tracks.\n"
},
{
"from": "gpt",
"value": "#!/usr/bin/env python\n\nimport sys\nimport os.path as osp\nthis_dir = osp.dirname(__file__)\nsys.path.insert(0, osp.join(this_dir, '../../external/'))\nfrom vdetlib.utils.protocol import proto_load, ... | python | chosen |
[
{
"from": "human",
"value": "Create Symbol, List, Boolean, Nil and Atom types.\n"
},
{
"from": "gpt",
"value": "class Symbol(str):\n pass\n\n\n# lists\nclass List(list):\n def __add__(self, rhs):\n return List(list.__add__(self, rhs))\n\n def __getitem__(self, i):\n if typ... | python | chosen |
[
{
"from": "human",
"value": "Move code from old repo.\n"
},
{
"from": "gpt",
"value": "#!/usr/bin/env python\n\"\"\"Simple library for posting to Rocket.Chat via webhooks a.k.a. integrations.\"\"\"\n\nimport json\nimport httplib\nimport urllib\n\n\nclass WebhookError(Exception):\n def __init_... | python | chosen |
[
{
"from": "human",
"value": "Add alembic migration script for dark theme\n"
},
{
"from": "gpt",
"value": "\"\"\"Add dark_theme entry\n\nRevision ID: 3b85eb7c4d7\nRevises: 3d4136d1ae1\nCreate Date: 2015-08-06 03:34:32.888608\n\n\"\"\"\n\n# revision identifiers, used by Alembic.\nrevision = '3b85e... | python | chosen |
[
{
"from": "human",
"value": "Add tests for Traversable on pathlib and zipfile Path objects.\n"
},
{
"from": "gpt",
"value": "import io\nimport zipfile\nimport unittest\n\nfrom importlib_resources._compat import ZipPath, Path\nfrom importlib_resources.abc import Traversable\n\n\nclass Traversable... | python | chosen |
[
{
"from": "human",
"value": "Add initial tests of subclassing components\n"
},
{
"from": "gpt",
"value": "# -*- coding: utf-8 -*-\n# Licensed under a 3-clause BSD style license - see LICENSE.rst\n\n# TEST_UNICODE_LITERALS\n\nfrom ... import table\n\n\nclass MyRow(table.Row):\n def __str__(sel... | python | chosen |
[
{
"from": "human",
"value": "Add some tests for the Task model\n"
},
{
"from": "gpt",
"value": "from mongoengine import ValidationError\nfrom nose.tools import raises\n\nfrom app.task import Priority, Task\n\ndef test_Set_Title_String():\n task = Task()\n\n task.title = \"Hello\"\n asse... | python | chosen |
[
{
"from": "human",
"value": "Add function to retrieve CIViC Drug / Disease information\n"
},
{
"from": "gpt",
"value": "import requests\nimport progressbar\nimport pandas as pd\n\nbar = progressbar.ProgressBar()\n\n\ndef create_civic_drug_disease_dataframe():\n payload = {'count': 999} # Onl... | python | chosen |
[
{
"from": "human",
"value": "Add dummy module of Task class\n"
},
{
"from": "gpt",
"value": "#!/usr/bin/python3\n\n\nfrom enum import Enum\n\n\nclass State(Enum):\n inactive = 1\n active = 2\n running = 3\n paused = 4\n aborted = 5\n failed = 6\n frozen = 7\n\n\nclass Task(o... | python | chosen |
[
{
"from": "human",
"value": "Add action for creating new request data\n"
},
{
"from": "gpt",
"value": "from ckan.plugins import toolkit\nfrom ckan.logic import check_access\nimport ckan.lib.navl.dictization_functions as df\n\nfrom ckanext.requestdata.logic import schema\nfrom ckanext.requestdata... | python | chosen |
[
{
"from": "human",
"value": "Migrate certain deals to set status new business\n"
},
{
"from": "gpt",
"value": "# -*- coding: utf-8 -*-\nfrom __future__ import unicode_literals\n\nfrom django.db import models, migrations\nfrom django.db.models import Count\n\n\ndef set_correct_status(apps, schema... | python | chosen |
[
{
"from": "human",
"value": "Solve Code Fights codefighter attribute problem\n"
},
{
"from": "gpt",
"value": "#!/usr/local/bin/python\n# Code Fights Codefighter Attribute Problem\n\n\nclass CodeFighter(object):\n def __init__(self, username, _id, xp, name):\n self.username = username\n... | python | chosen |
[
{
"from": "human",
"value": "Add migration for VPC module update\n"
},
{
"from": "gpt",
"value": "from pentagon import migration\nfrom pentagon.migration import *\nfrom pentagon.component import core, inventory\nfrom pentagon.helpers import merge_dict\n\nimport re\n\n\nclass Migration(migration.... | python | chosen |
[
{
"from": "human",
"value": "Add batch script for kanji animations\n"
},
{
"from": "gpt",
"value": "#!/usr/bin/env python2\n\nimport os\nimport progressbar\n\nsvgs = filter(lambda f: f.endswith(\".svg\"), os.listdir(\".\"))\n\nbar = progressbar.ProgressBar()\n\nfor svg in bar(svgs):\n os.syst... | python | chosen |
[
{
"from": "human",
"value": "Add function to read 3d direct access Fortran binary files into NumPy arrays.\n"
},
{
"from": "gpt",
"value": "#!/usr/bin/python\n#Author: Scott T. Salesky\n#Created: 12.6.2014\n#Purpose: Collection of functions, routines to use \n#Python for scientific work\n#------... | python | chosen |
[
{
"from": "system",
"value": "Add a safety net for recursive logging\n"
},
{
"from": "human",
"value": "import logging\n\nclass SentryHandler(logging.Handler):\n def emit(self, record):\n from sentry.client.models import get_client\n\n get_client().create_from_record(record)"
... | python | chosen |
[
{
"from": "human",
"value": "Add server for embedding transformation\n"
},
{
"from": "gpt",
"value": "from flask import Flask\nfrom flask import request, abort, jsonify\nimport numpy as np\nimport gensim\nimport re\nimport string\n\napp = Flask(__name__)\n\nmodel = None\nmaxSeqLength = 70\nnumFe... | python | chosen |
[
{
"from": "human",
"value": "Add a bunch of simple tests\n"
},
{
"from": "gpt",
"value": "# test_wendy.py: some basic tests\nimport numpy\nimport wendy\ndef test_energy_conservation():\n # Test that energy is conserved for a simple problem\n x= numpy.array([-1.1,0.1,1.3])\n v= numpy.arr... | python | chosen |
[
{
"from": "system",
"value": "Fix the platform check for windows.\n"
},
{
"from": "human",
"value": "import sys\n\nclass OSUtil():\n def __init__(self):\n pass\n\n def platform(self):\n platform = sys.platform # Map from python platform name to ue4 platform name\n name... | python | chosen |
[
{
"from": "human",
"value": "Add routing table class based on pandas.DataFrame.\n"
},
{
"from": "gpt",
"value": "import pandas\n\nclass DynamicTable(object):\n \"\"\"\n Dynamically sized table.\n \"\"\"\n\n def __init__(self, *args, **kwargs):\n self._data = pandas.DataFrame(*... | python | chosen |
[
{
"from": "human",
"value": "tests: Add test for hash of user defined class.\n"
},
{
"from": "gpt",
"value": "# test builtin hash function\n\nclass A:\n def __hash__(self):\n return 123\n def __repr__(self):\n return \"a instance\"\n\nprint(hash(A()))\nprint({A():1})\n"
}
] | python | chosen |
[
{
"from": "human",
"value": "Add tests of fields in serializers\n"
},
{
"from": "gpt",
"value": "#!/usr/bin/env python\n# -*- coding: utf-8 -*-\n\n\n\"\"\"\ntest_in_serializers\n-------------------\n\nTests of the fields cooperation in the serializer interfaces for serialization, de-serializatio... | python | chosen |
[
{
"from": "human",
"value": "Add script to load data from scraper manifest.\n"
},
{
"from": "gpt",
"value": "import argparse\nimport json\nimport os\n\nimport mcbench.client\n\n\ndef parse_args():\n parser = argparse.ArgumentParser(\n description='load benchmarks into McBench redis ins... | python | chosen |
[
{
"from": "human",
"value": "Create test case for MTI Plugins\n"
},
{
"from": "gpt",
"value": "# -*- coding: utf-8 -*-\n\nfrom django.conf import settings\n\nfrom cms.models import Page\nfrom cms.models.pluginmodel import CMSPlugin\nfrom cms.test_utils.util.context_managers import SettingsOverri... | python | chosen |
[
{
"from": "human",
"value": "Add script to normalize spelling\n\nAdded a script that takes as input a training and test set containing\nsentences with words separated by spaces, normalizes the spelling using\nthe hist2modern dictionary and writes files containing the spelling\nnormalized train and test set.... | python | chosen |
[
{
"from": "human",
"value": "Add test for checking if tesseract binary is available\n"
},
{
"from": "gpt",
"value": "#!/usr/bin/env python\n# -*- coding: utf-8 -*-\n\nimport shutil\nimport unittest\n\n\nclass TestScanimage(unittest.TestCase):\n\n \"\"\"\n TODO: Docstring\n\n \"\"\"\n\n ... | python | chosen |
[
{
"from": "human",
"value": "Add tests for new shortcuts.\n"
},
{
"from": "gpt",
"value": "from nose.tools import *\n\nfrom lctools.shortcuts import get_node_or_fail\n\nclass TestShortCuts(object):\n\n def setup(self):\n class MyNode(object):\n\n def __init__(self, id):\n ... | python | chosen |
[
{
"from": "human",
"value": "Add demo script to send SMS message from command_line\n"
},
{
"from": "gpt",
"value": "\"\"\"\nBasic demo of summit-python that sends a simple SMS message from the\ncommand-line.\n\"\"\"\n\nimport argparse\n\nfrom summit.rest import SummitRestClient\n\n\ndef main():\... | python | chosen |
[
{
"from": "human",
"value": "Create separate bbn ontology retriever.\n"
},
{
"from": "gpt",
"value": "import yaml\nimport requests\nfrom os.path import join, dirname, abspath\nfrom rdflib import Graph, Namespace, Literal\n\nbb_ont_url = ('https://raw.githubusercontent.com/BBN-E/Hume/master/resou... | python | chosen |
[
{
"from": "human",
"value": "Add file for nonterms iteration tests\n"
},
{
"from": "gpt",
"value": "#!/usr/bin/env python\n\"\"\"\n:Author Patrik Valkovic\n:Created 23.06.2017 16:39\n:Licence GNUv3\nPart of grammpy\n\n\"\"\"\nfrom unittest import TestCase, main\nfrom grammpy import Grammar\nfrom... | python | chosen |
[
{
"from": "human",
"value": "Add a simple class to work with canvas tools.\n"
},
{
"from": "gpt",
"value": "from reportlab.lib.enums import TA_JUSTIFY\nfrom reportlab.lib.pagesizes import letter\nfrom reportlab.platypus import SimpleDocTemplate, Paragraph, Spacer, Image\nfrom reportlab.lib.style... | python | chosen |
[
{
"from": "human",
"value": "Add test for the optimizer.\n"
},
{
"from": "gpt",
"value": "\"\"\"\nLearning tests.\n\"\"\"\n\n# pylint: disable=no-member\n# pylint: disable=missing-docstring\n\n# future imports\nfrom __future__ import division\nfrom __future__ import absolute_import\nfrom __futur... | python | chosen |
[
{
"from": "human",
"value": "TST: Add test for multi-step append"
},
{
"from": "gpt",
"value": "r\"\"\"\nTests for forecasting-related features not tested elsewhere\n\"\"\"\n\nimport numpy as np\nimport pandas as pd\n\nimport pytest\nfrom numpy.testing import assert_, assert_equal, assert_allclo... | python | chosen |
[
{
"from": "human",
"value": "Add l10n test for Hollywood neighbourhood\n"
},
{
"from": "gpt",
"value": "# Hollywood (wof neighbourhood)\n# https://whosonfirst.mapzen.com/data/858/260/37/85826037.geojson\nassert_has_feature(\n 16, 11227, 26157, 'places',\n { 'id': 85826037, 'kind': 'neighbo... | python | chosen |
[
{
"from": "human",
"value": "migrations: Adjust stats size for tsvector to 10k, from 100.\n\nPostgreSQL's `default_statistics_target` is used to track how many\n\"most common values\" (\"MCVs\") for a column when performing an\n`ANALYZE`. For `tsvector` columns, the number of values is actually\n10x this n... | python | chosen |
[
{
"from": "human",
"value": "Create old migrations that were not done before\n"
},
{
"from": "gpt",
"value": "# Generated by Django 3.0.7 on 2020-06-09 07:48\n\nfrom django.db import migrations, models\n\n\nclass Migration(migrations.Migration):\n\n dependencies = [(\"survey\", \"0012_add_dis... | python | chosen |
[
{
"from": "human",
"value": "Convert between optical and radio velocities.\n"
},
{
"from": "gpt",
"value": "\nfrom astropy import units as u\nimport numpy as np\n\n\ndef optical_to_radio(vel, freq, rest):\n\n return freq * vel / rest\n\n\ndef radio_to_optical(vel, freq, rest):\n\n return r... | python | chosen |
[
{
"from": "human",
"value": "Add top script to generate binaries from scratch.\n\ngit-svn-id: 77a43f9646713b91fea7788fad5dfbf67e151ece@5553 94b884b6-d6fd-0310-90d3-974f1d3f35e1\n"
},
{
"from": "gpt",
"value": "import subprocess\r\nimport os\r\n\r\nPYVER = \"2.5\"\r\n\r\n# Bootstrap\r\nsubprocess... | python | chosen |
[
{
"from": "human",
"value": "Create a animated figure from a series of data\n"
},
{
"from": "gpt",
"value": "import numpy as np\nimport matplotlib.pyplot as plt\nimport matplotlib.animation as anim\nfrom mpl_toolkits.mplot3d import Axes3D\nimport sys\n\nimport numpy.ma as ma\n\n\ni=0\nfuz = 1;\n... | python | chosen |
[
{
"from": "human",
"value": "Add simple test for build details\n"
},
{
"from": "gpt",
"value": "from datetime import datetime\n\nfrom changes.constants import Status\nfrom changes.testutils import APITestCase\n\n\nclass BuildDetailsTest(APITestCase):\n def test_simple(self):\n previous... | python | chosen |
[
{
"from": "human",
"value": "Add method to find time taken\n"
},
{
"from": "gpt",
"value": "\"\"\"Handle datetime for pysyte's types\"\"\"\nimport datetime\nepoch = datetime.datetime.fromtimestamp(0)\n\n\ndef taken(diff, days=True):\n seconds = diff.seconds * 1_000 + diff.microseconds\n if... | python | chosen |
[
{
"from": "human",
"value": "Add distribution script for standalone collector\n\ngit-svn-id: 0429bb2eb6f71f8cd87fe9410a915008a087abca@34 efcc4bdc-162a-0410-a8af-5b4b46c5376d\n"
},
{
"from": "gpt",
"value": "#!/usr/bin/python\nimport os\nimport shutil\nimport glob\n\ndistPath = \"./dist/standalon... | python | chosen |
[
{
"from": "human",
"value": "Add a unit test for CDN-downloads\n"
},
{
"from": "gpt",
"value": "import unittest\nimport os\nfrom io import BytesIO\nfrom random import randint\nfrom hashlib import sha256\nfrom telethon import TelegramClient\n\n# Fill in your api_id and api_hash when running the t... | python | chosen |
[
{
"from": "human",
"value": "Add diagnostic comparing aviationweather.gov to IEM "
},
{
"from": "gpt",
"value": "\"\"\"\n Compare our PIREPs data against what is at aviation wx JSON service\n\"\"\"\nimport json\nimport urllib2\nimport datetime\nimport psycopg2\n\npgconn = psycopg2.connect(datab... | python | chosen |
[
{
"from": "human",
"value": "Add a simple accept loop for clients\n"
},
{
"from": "gpt",
"value": "\"\"\"\n\nA simple chat server using TCP/IP and the publisher-subscriber pattern.\n\n@author Steven Briggs\n@version 2015.05.25\n\n\"\"\"\n\nimport sys\nimport argparse\nimport socket\n\nDEFAULT_PO... | python | chosen |
[
{
"from": "human",
"value": "Add a test case for ORM\n"
},
{
"from": "gpt",
"value": "# encoding: utf-8\n\nfrom __future__ import print_function, unicode_literals\n\nimport sys\n\nimport pytest\nfrom simplesqlite import connect_memdb\nfrom simplesqlite.model import Blob, Integer, Model, Real, Te... | python | chosen |
[
{
"from": "human",
"value": "Add tests for IVR menu\n"
},
{
"from": "gpt",
"value": "'''\n\tTest menu creation\n'''\n\nimport unittest\nfrom wirecurly.configuration import menu\nfrom nose import tools\n\n\nclass testMenuCreation(unittest.TestCase):\n\t'''\n\t\tTest menu creation\n\t'''\n\n\tdef ... | python | chosen |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.