conversations
listlengths
2
3
source
stringclasses
1 value
stack
stringclasses
1 value
[ { "from": "system", "value": "Add smarts to cope with slug clashes with other places with the same names.\n" }, { "from": "human", "value": "# This script will copy areas from mapit to core.places, including creating the\n# place kind if required.\n\n\n# import re\n# import sys\nfrom django.core...
python
chosen
[ { "from": "human", "value": "Add failing specs for current/future class names." }, { "from": "gpt", "value": "from unittest import TestCase\n\nimport plotly.graph_objs as go\nimport plotly.graph_reference as gr\n\nOLD_CLASS_NAMES = ['AngularAxis', 'Annotation', 'Annotations', 'Area',\n ...
python
chosen
[ { "from": "human", "value": "Test that daily westminster pages load\n" }, { "from": "gpt", "value": "import datetime as dt\n\nfrom flask_application import app\n\n\ndef test_daily_westminster_pages_exist():\n start_date = dt.date(2015, 01, 01)\n\n with app.test_client() as c:\n for ...
python
chosen
[ { "from": "human", "value": "Add a bot message to display TeamCity test results\n\n* Make modin-bot update the comment instead of creating a new one\n* Also only run the comment bot when a PR is being evaluated\n\nSigned-off-by: Devin Petersohn <9526cbaf745870a4c947dfa2bd5208403b463ac3@gmail.com>\n" }, ...
python
chosen
[ { "from": "system", "value": "Change docstring for NamedEntity filth\n" }, { "from": "human", "value": "from .base import Filth\n\n\nclass NamedEntityFilth(Filth):\n \"\"\"\n Named entity filth. Upon initialisation provide a label for named entity (e.g. name, org)\n \"\"\"\n type = '...
python
chosen
[ { "from": "human", "value": "Add script for train/test split\n" }, { "from": "gpt", "value": "import os\nimport shutil\nimport argparse\nimport random\nrandom.seed(47297)\n\n\nparser = argparse.ArgumentParser(description='Split data into train and test sets.')\nparser.add_argument('subjects_root...
python
chosen
[ { "from": "human", "value": "Add script to find forms missing in ES\n" }, { "from": "gpt", "value": "from __future__ import absolute_import\nfrom __future__ import division\nfrom __future__ import unicode_literals\n\nfrom __future__ import print_function\nfrom datetime import datetime\nfrom djan...
python
chosen
[ { "from": "human", "value": "Add testing code for memory leak.\n" }, { "from": "gpt", "value": "from __future__ import print_function\n\nimport argparse\n\nimport numpy as np\nimport torch\nfrom torch.autograd import Variable\nfrom torch.optim import Adam\nfrom torch.utils.data import DataLoader...
python
chosen
[ { "from": "human", "value": "Add new example plot for `match_template`.\n" }, { "from": "gpt", "value": "\"\"\"\n=================\nTemplate Matching\n=================\n\nIn this example, we use template matching to identify the occurrence of an\nimage patch (in this case, a sub-image centered ...
python
chosen
[ { "from": "human", "value": "Add harvesting blog data example\n" }, { "from": "gpt", "value": "import os\nimport sys\nimport json\nimport feedparser\nfrom bs4 import BeautifulSoup\n\nFEED_URL = 'http://g1.globo.com/dynamo/rss2.xml'\n\ndef cleanHtml(html):\n return BeautifulSoup(html, 'lxml')....
python
chosen
[ { "from": "human", "value": "Add directory for CYK tests\n" }, { "from": "gpt", "value": "#!/usr/bin/env python\n\"\"\"\n:Author Patrik Valkovic\n:Created 31.08.2017 14:50\n:Licence GNUv3\nPart of pyparsers\n\n\"\"\"" } ]
python
chosen
[ { "from": "human", "value": "Add some tests for monitor class\n" }, { "from": "gpt", "value": "import unittest\nimport Monitors.monitor\n\n\nclass TestMonitor(unittest.TestCase):\n\n safe_config = {'partition': '/', 'limit': '10G'}\n\n one_KB = 1024\n one_MB = one_KB * 1024\n one_GB ...
python
chosen
[ { "from": "human", "value": "Solve C Mais ou Menos? in python\n" }, { "from": "gpt", "value": "import sys\n\nMIN_VITAMIN_C = 110\nMAX_VITAMIN_C = 130\n\nvitamin_c_catalogue = {\n 'suco de laranja': 120,\n 'morango fresco': 85,\n 'mamao': 85,\n 'goiaba vermelha': 70,\n 'manga': 56,...
python
chosen
[ { "from": "human", "value": "Add the enemy file and start it up.\n" }, { "from": "gpt", "value": "import pygame\n\nclass Enemy(pygame.sprite.Sprite):\n\n def __init__(self, x, y):\n super().__init__()\n self.image = pygame.image.load(\"images/enemy.png\").convert_alpha()\n ...
python
chosen
[ { "from": "human", "value": "Add a test to demonstrate issue with django 1.11\n\nIf model with state field has other fields that access their field value\nvia a property or a Virtal Field, then creation of instances will fail.\n" }, { "from": "gpt", "value": "try:\n from django.contrib.conten...
python
chosen
[ { "from": "human", "value": "Update imports for new functions\n" }, { "from": "gpt", "value": "# Licensed under a 3-clause BSD style license - see LICENSE.rst\n\"\"\"\nImage processing utilities for Astropy.\n\"\"\"\n\n# Affiliated packages may add whatever they like to this file, but\n# should ...
python
chosen
[ { "from": "human", "value": "Mask computation utilities (from nipy).\n" }, { "from": "gpt", "value": "import numpy as np\nfrom scipy import ndimage\n\n\n###############################################################################\n# Operating on connect component\n############################...
python
chosen
[ { "from": "human", "value": "Add unit tests for recent bugfix and move operation\n" }, { "from": "gpt", "value": "#!/usr/bin/env python\n# -*- coding: utf-8 -*-\n\nimport os\nimport shutil\nimport tempfile\nimport unittest\n\nfrom dotfiles import core\n\n\ndef touch(fname, times=None):\n with...
python
chosen
[ { "from": "human", "value": "Add tests and fixtures for the Organizations API wrapper\n" }, { "from": "gpt", "value": "# -*- coding: utf-8 -*-\n\n\"\"\"pytest Licenses functions, fixtures and tests.\"\"\"\n\n\nimport pytest\n\nimport ciscosparkapi\n\n\n# Helper Functions\n\ndef list_organization...
python
chosen
[ { "from": "human", "value": "Add migration code for updating lease status\n\nLease status was None before the status module was introduced.\nThis patch is for updating the None status.\n\nPartially Implements: blueprint state-machine\nChange-Id: I64cc07737d5c1c83a4f91d485a21c9a459305b9a\n" }, { "fro...
python
chosen
[ { "from": "human", "value": "Add example usage of the JsonTestResponse.\n" }, { "from": "gpt", "value": "import unittest\nfrom flask import Flask\nfrom flask_json import json_response, FlaskJSON, JsonTestResponse\n\n\ndef our_app():\n app = Flask(__name__)\n app.test_value = 0\n FlaskJS...
python
chosen
[ { "from": "human", "value": "Add initial version of identification algorithm\n" }, { "from": "gpt", "value": "import os.path as path\nimport re\n\nimport Levenshtein\n\nfrom .sanitize import sanitize\nfrom .tmdb import search\n\n\ndef _gather(filename, directory=None, titles={}):\n # Sanitize...
python
chosen
[ { "from": "human", "value": "Add simple CSV exporter to examples.\n" }, { "from": "gpt", "value": "#!/usr/bin/env python3\n# -*- coding: utf-8 -*-\n\nimport csv\nfrom io import StringIO\nfrom collections import OrderedDict\n\nfrom tcflib.service import ExportingWorker, run_as_cli\n\n\nclass CSVE...
python
chosen
[ { "from": "human", "value": "Add tests for the `dirty_untar` rule\n" }, { "from": "gpt", "value": "import os\nimport pytest\nimport tarfile\nfrom thefuck.rules.dirty_untar import match, get_new_command, side_effect\nfrom tests.utils import Command\n\n\n@pytest.fixture\ndef tar_error(tmpdir):\n ...
python
chosen
[ { "from": "human", "value": "Fix versions of protected/unprotected documents\n" }, { "from": "gpt", "value": "\"\"\"Fix protected docs versions\n\nRevision ID: 077ddf78a1f3\nRevises: 9739938498a8\nCreate Date: 2017-10-30 12:05:51.679435\n\n\"\"\"\nfrom alembic import op\nimport sqlalchemy as sa\...
python
chosen
[ { "from": "human", "value": "lib: Add a script for generating jamo character table\n" }, { "from": "gpt", "value": "#!/usr/bin/python3\n\n# Input: https://www.unicode.org/Public/UNIDATA/Jamo.txt\n\nimport io\nimport re\n\nclass Builder(object):\n def __init__(self):\n pass\n\n def r...
python
chosen
[ { "from": "human", "value": "Add dump script for all hiddens\n" }, { "from": "gpt", "value": "from __future__ import division\nfrom __future__ import print_function\nfrom __future__ import absolute_import\n\nimport os\nimport subprocess\n\nif __name__ == \"__main__\":\n for hiddens_dim in [51...
python
chosen
[ { "from": "human", "value": "Add test that detects censorship in HTTP pages based on HTTP body length\n" }, { "from": "gpt", "value": "# -*- encoding: utf-8 -*-\n#\n# :authors: Arturo Filastò\n# :licence: see LICENSE\n\nfrom twisted.internet import defer\nfrom twisted.python import usage\nfrom o...
python
chosen
[ { "from": "human", "value": "Set maximal word length limit\n" }, { "from": "gpt", "value": "#!/usr/bin/env python\n\"\"\"\nModule which produces readble name from 256-bit of random data\n(i.e. sha-256 hash)\n\n\n\"\"\"\nMAXWORDLEN=12\n#\n# Modules which contain problablity dictionaries\n# genera...
python
chosen
[ { "from": "human", "value": "Add tests for the authorize_user function\n" }, { "from": "gpt", "value": "from pyramid.httpexceptions import HTTPBadRequest, HTTPUnauthorized\n\nfrom yithlibraryserver import testing\nfrom yithlibraryserver.security import authorize_user\n\n\nclass AuthorizationTest...
python
chosen
[ { "from": "human", "value": "Create python script to scroll error messages\n" }, { "from": "gpt", "value": "from sense_hat import SenseHat\nimport sys\n\nsense = SenseHat()\nsense.show_message(sys.stdin.read(), scroll_speed=.08, text_colour=[255, 0, 0])\n" } ]
python
chosen
[ { "from": "human", "value": "Add pen which draws to TrueType glyphs.\n" }, { "from": "gpt", "value": "from __future__ import print_function, division, absolute_import\nfrom array import array\n\nfrom fontTools.misc.py23 import *\nfrom fontTools.pens.basePen import AbstractPen\nfrom fontTools.ttL...
python
chosen
[ { "from": "human", "value": "Add test for total property\n" }, { "from": "gpt", "value": "from .models import Order\n\n\ndef test_total_property():\n order = Order(total_net=20, total_tax=5)\n assert order.total.gross == 25\n assert order.total.tax == 5\n assert order.total.net == 20...
python
chosen
[ { "from": "human", "value": "Add unit test for volume limits client\n\nThis patch adds unit test for volume v2 limits client.\n\nPartially Implements: blueprint tempest-lib-missing-test-coverage\n\nChange-Id: I08a982758fcdd364e1790e1049d0022f04e4bcc7\n" }, { "from": "gpt", "value": "# Copyright ...
python
chosen
[ { "from": "human", "value": "Create class to interpolate values between indexes\n" }, { "from": "gpt", "value": "class Interpolator:\n def __init__(self):\n self.data = []\n\n def addIndexValue(self, index, value):\n self.data.append((index, value))\n\n def valueAtIndex(se...
python
chosen
[ { "from": "human", "value": "Convert GML to EWKT, via PostGIS\n" }, { "from": "gpt", "value": "from django.db import connection\n\ndef gml_to_ewkt(gml_string, force_2D=False):\n cursor = connection.cursor()\n if force_2D:\n sql = 'SELECT ST_AsEWKT(ST_Force_2D(ST_GeomFromGML(%s)))'\n...
python
chosen
[ { "from": "human", "value": "Add unit tests for the methods in util\n" }, { "from": "gpt", "value": "from lib import util\n\n\ndef test_cachedproperty():\n class Target:\n def __init__(self):\n self.call_count = 0\n\n @util.cachedproperty\n def prop(self):\n ...
python
chosen
[ { "from": "human", "value": "Add simple distutils script for modules\n" }, { "from": "gpt", "value": "from distutils.core import setup\n\nsetup(name='dimreducer',\n version='1.0',\n description='Dimension reduction methods',\n py_modules=['dimreducer'],\n )\n\nsetup(name='mult...
python
chosen
[ { "from": "human", "value": "Add generic serializer tool for plugins to use\n" }, { "from": "gpt", "value": "#\n# Copyright (c) rPath, Inc.\n#\n# This program is free software: you can redistribute it and/or modify\n# it under the terms of the GNU General Public License as published by\n# the Fr...
python
chosen
[ { "from": "human", "value": "Add missing file on last merge\n" }, { "from": "gpt", "value": "import logging\nimport datetime\n\nfrom sqlalchemy import (\n Column, Unicode, DateTime, Boolean, ForeignKey)\nfrom sqlalchemy.orm import relationship\n\nfrom goodtablesio.models.base import Base, Bas...
python
chosen
[ { "from": "human", "value": "Support rudimentary translation service from IIT Bombay\nvia web API.\n\nme: கவிதை மிக அழகாக இருக்கிறது\nit: கவிதை of the most beautiful\n\nme: good morning\nit: நல்ல காலை\n\nme: world is not flat\nit: உலக சமதளமான கிடைக்கிறது.\n" }, { "from": "gpt", "value": "# * cod...
python
chosen
[ { "from": "human", "value": "Set calculation type of all indicators to Number\n" }, { "from": "gpt", "value": "# -*- coding: utf-8 -*-\n# Generated by Django 1.11.3 on 2018-07-04 09:56\nfrom __future__ import unicode_literals\n\nfrom django.db import migrations\nfrom ..models import Indicator\n\...
python
chosen
[ { "from": "human", "value": "Add python version of the post-receive hook\n" }, { "from": "gpt", "value": "import re\nimport os\nimport sys\nimport os\nimport json\nfrom subprocess import Popen, PIPE\nfrom httplib2 import Http\n\npostURL = \"http://localhost:2069/json\"\n\npwd = os.getcwd()\nif l...
python
chosen
[ { "from": "human", "value": "Add some tests for the tokens\n" }, { "from": "gpt", "value": "from flask import current_app\nfrom itsdangerous import TimedJSONWebSignatureSerializer\nfrom flaskbb.utils.tokens import make_token, get_token_status\n\n\ndef test_make_token(user):\n token = make_tok...
python
chosen
[ { "from": "human", "value": "Put split and merge in own module too\n" }, { "from": "gpt", "value": "from app.drivers.basedrivers import PycolatorDriver\nfrom app.preparation import pycolator as preparation\nfrom app.readers import pycolator as readers\n\n\nclass SplitDriver(PycolatorDriver):\n ...
python
chosen
[ { "from": "human", "value": "Add common migration (unrelated to branch)\n" }, { "from": "gpt", "value": "# Generated by Django 2.2.12 on 2020-05-29 05:14\n\nfrom django.db import migrations, models\n\n\nclass Migration(migrations.Migration):\n\n dependencies = [\n ('common', '0009_uplo...
python
chosen
[ { "from": "human", "value": "Add a python version for the phonebook benchmark\n\nSwift SVN r17601\n" }, { "from": "gpt", "value": "\nwords=[\n u\"James\", u\"John\", u\"Robert\", u\"Michael\", u\"William\", u\"David\", u\"Richard\", u\"Joseph\",\n u\"Charles\", u\"Thomas\", u\"Christopher\", u\"...
python
chosen
[ { "from": "human", "value": "Test Basic.Publish -> Basic.Get message passing\n" }, { "from": "gpt", "value": "#!/usr/bin/env python\n\"\"\"\nSend a message and confirm you can retrieve it with Basic.Get\nTest Steps:\n\n1) Connect to broker - start_test\n2) Open Channel - on_connected\...
python
chosen
[ { "from": "human", "value": "Add migration to add column for proposal image filename\n" }, { "from": "gpt", "value": "\"\"\"add proposal image\n\nRevision ID: 320f4eb0698b\nRevises: 26ef95fc6f2c\nCreate Date: 2015-03-31 15:55:20.062624\n\n\"\"\"\n\n# revision identifiers, used by Alembic.\nrevis...
python
chosen
[ { "from": "human", "value": "Add a script to find parties with multiple emblems (logos) from the EC\n\nThis was useful at some point, apparently!\n" }, { "from": "gpt", "value": "from django.core.management.base import BaseCommand\n\nfrom candidates.popit import create_popit_api_object, popit_un...
python
chosen
[ { "from": "human", "value": "Add basic test for navigator\n" }, { "from": "gpt", "value": "#!/usr/bin/env python\nimport unittest\nimport mock\nfrom autobot.msg import detected_object\nfrom navigator import *\n\n\ndef fake_stopCar():\n return True\n\n\ndef fake_srvTogglePathFinder(state):\n ...
python
chosen
[ { "from": "human", "value": "Add unittest for select_taxa that runs main and selects a single genome" }, { "from": "gpt", "value": "import logging\nimport os\nimport tempfile\nimport unittest\n\nimport select_taxa\n\n\nclass Test(unittest.TestCase):\n\n def setUp(self):\n self.longMess...
python
chosen
[ { "from": "human", "value": "Add a new regression testing module\n\nThat module should hold all tests used when reproducing (and fixing) an\nissue.\n" }, { "from": "gpt", "value": "# Copyright: See the LICENSE file.\n\n\n\"\"\"Regression tests related to issues found with the project\"\"\"\n\nim...
python
chosen
[ { "from": "human", "value": "Add a script to convert hex formatted key to token using random partitioner\n" }, { "from": "gpt", "value": "#!/usr/bin/env python\n# -*- coding: utf-8 -*-\n# Licensed to the Apache Software Foundation (ASF) under one\n# or more contributor license agreements. See t...
python
chosen
[ { "from": "human", "value": "Add some useful activation functions.\n" }, { "from": "gpt", "value": "import theano\nimport theano.tensor as T\n\n\"\"\"\nA set of activation functions for Neural Network layers.\nThey're in the form of class so we can take advantage of constructor\nto set initial v...
python
chosen
[ { "from": "human", "value": "Add some end-to-end functional tests\n\nSince running these tests is not part of the automated tests,\nand since the test runner picks up any file that has a name\ncontaining \"test\" I have to be clever and call it \"exam.py.\"\n" }, { "from": "gpt", "value": "impor...
python
chosen
[ { "from": "human", "value": "Add delete old sessions command\n" }, { "from": "gpt", "value": "from datetime import datetime\n\nfrom django.core.management.base import BaseCommand\nfrom django.contrib.sessions.models import Session\n\n\"\"\"\n>>> def clean(count):\n... for idx, s in enumerate(S...
python
chosen
[ { "from": "human", "value": "Add a script for dqn continuous task demo\n" }, { "from": "gpt", "value": "import argparse\n\nimport chainer\nfrom chainer import serializers\nimport gym\nimport numpy as np\n\nimport random_seed\nimport env_modifiers\nimport q_function\n\n\ndef eval_single_run(env, ...
python
chosen
[ { "from": "human", "value": "Test if repository manager if retrieving a repository when we lookup after one\n" }, { "from": "gpt", "value": "from unittest import TestCase\n\nfrom mock import MagicMock, patch\nfrom nose.tools import eq_\n\nfrom pyolite.managers.repository import RepositoryManager...
python
chosen
[ { "from": "human", "value": "[PyROOT] Add unittest for string_view conversion\n" }, { "from": "gpt", "value": "import unittest\nimport ROOT\n\ncppcode = \"\"\"\nvoid stringViewConv(std::string_view) {};\n\"\"\"\n\nclass ListInitialization(unittest.TestCase):\n @classmethod\n def setUpClass...
python
chosen
[ { "from": "human", "value": "Add a command for creating rsa key.\n" }, { "from": "gpt", "value": "from Crypto.PublicKey import RSA\n\nfrom django.conf import settings\nfrom django.core.management.base import BaseCommand, CommandError\n\n\nclass Command(BaseCommand):\n help = 'Randomly generat...
python
chosen
[ { "from": "human", "value": "Data: Add script to delete tables.\n" }, { "from": "gpt", "value": "from django.db.models.base import ModelBase\n\nfrom quiz.models import Quiz, ShortAnswer, Choice, QuizAttempt\nfrom codequiz.models import CodeQuiz, CodeQuizAttempt\n\nfrom concept.models import Conc...
python
chosen
[ { "from": "human", "value": "Create command for Data Log Report fixtures\n" }, { "from": "gpt", "value": "from django.core.management.base import BaseCommand\nfrom django.core import serializers\n\nfrom data_log import models\nimport json\n\n\nclass Command(BaseCommand):\n help = 'Create Data...
python
chosen
[ { "from": "human", "value": "Add dead letter SQS queue example\n" }, { "from": "gpt", "value": "# Copyright 2010-2016 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...
python
chosen
[ { "from": "system", "value": "Make migrations in project_template home app reversible\n" }, { "from": "human", "value": "# -*- coding: utf-8 -*-\nfrom __future__ import unicode_literals\n\nfrom django.db import migrations\n\n\ndef create_homepage(apps, schema_editor):\n # Get models\n Cont...
python
chosen
[ { "from": "human", "value": "Add tests for template tags\n" }, { "from": "gpt", "value": "import os\nimport mock\n\nfrom django.test import TestCase\n\nfrom djlotrek.templatetags.djlotrek_tags import absolute_url\n\nfrom django.test import RequestFactory\n\n\nclass TemplateTagsTestCase(TestCase)...
python
chosen
[ { "from": "human", "value": "Add eventlet backdoor to facilitate troubleshooting.\n\nThis provides a FLAG to turn on Eventlet's builtin backdoor server which\nallows you to connect over telnet and receive a Python prompt (which is\nimmensely helpful for debugging running systems).\n\nFixes bug 1000366\n\nCh...
python
chosen
[ { "from": "system", "value": "Fix getting money from arcade games.\n" }, { "from": "human", "value": "from saylua.wrappers import api_login_required\nfrom flask import g, request\nfrom models.db import Game, GameLog\n\nfrom saylua.utils import int_or_none\n\nimport json\n\n\n# Send a score to th...
python
chosen
[ { "from": "human", "value": "Add day 3 part 2.\n" }, { "from": "gpt", "value": "\"\"\"This module checks how many valid triangles are in the input data.\"\"\"\n\n\ndef main():\n \"\"\"Run main function.\"\"\"\n with open('data/day3data.txt', 'r') as f:\n input = f.readlines()\n\n ...
python
chosen
[ { "from": "human", "value": "Add lammps wrapper tests with cuds\n" }, { "from": "gpt", "value": "\"\"\"Tests for running lammps using CUDS and Simulation classes.\"\"\"\nimport unittest\n\nfrom simphony.core.cuba import CUBA\nfrom simphony import CUDS, Simulation\nfrom simphony.engine import Eng...
python
chosen
[ { "from": "human", "value": "Add a brutal script for removing concepts in bulk while testing\n" }, { "from": "gpt", "value": "# An entirely untested script to delete all the concepts in the\n# CATMAID database for a particular project.\n\n# Mark Longair 2010\n\nimport os\n\nfrom jarray import ar...
python
chosen
[ { "from": "human", "value": "Test for the PaladinSpellSchema values\n\n" }, { "from": "gpt", "value": "import unittest\n\nfrom tests.delete_test_db import delete_test_db # module that deletes the DB :)\nimport database.main\nfrom tests.create_test_db import engine, session, Base\n\n\ndatabase.m...
python
chosen
[ { "from": "human", "value": "Test that an error in pre_gen_project aborts generation\n" }, { "from": "gpt", "value": "# -*- coding: utf-8 -*-\n\nimport pytest\n\nfrom cookiecutter import generate\nfrom cookiecutter import exceptions\n\n\n@pytest.mark.usefixtures('clean_system')\ndef test_pre_gen...
python
chosen
[ { "from": "human", "value": "Add basic test for document quickcaching\n" }, { "from": "gpt", "value": "from copy import deepcopy\nfrom mock import patch, MagicMock\nfrom django.test import SimpleTestCase\nfrom dimagi.ext import couchdbkit as couch\nfrom corehq.apps.cachehq.mixins import CachedCo...
python
chosen
[ { "from": "human", "value": "Add missing migration from 096092b.\n" }, { "from": "gpt", "value": "# Generated by Django 2.0.5 on 2018-07-15 14:16\n\nimport datetime\nfrom django.db import migrations, models\n\n\nclass Migration(migrations.Migration):\n\n dependencies = [\n ('babybuddy'...
python
chosen
[ { "from": "human", "value": "Add ex4.4: tornado multiple requests with asyncio integration\n" }, { "from": "gpt", "value": "from tornado.platform.asyncio import AsyncIOMainLoop, to_asyncio_future\nfrom tornado.httpclient import AsyncHTTPClient\nimport asyncio\nimport time\n\n\nURL = 'http://127....
python
chosen
[ { "from": "human", "value": "Add initial script to print rosbag files\n" }, { "from": "gpt", "value": "#!/usr/bin/env python\n# -*- coding: utf-8 -*-\n\"\"\"Convert a rosbag file to legacy lidar binary format.\n\"\"\"\n\n\"\"\"LIDAR datatype format is:\n (\n timestamp (long),\n ...
python
chosen
[ { "from": "human", "value": "Migrate to latest version of db.\n" }, { "from": "gpt", "value": "\"\"\"empty message\n\nRevision ID: 1003fd6fc47\nRevises: 1a54c4cacbe\nCreate Date: 2015-03-24 13:33:50.898511\n\n\"\"\"\n\n# revision identifiers, used by Alembic.\nrevision = '1003fd6fc47'\ndown_revi...
python
chosen
[ { "from": "human", "value": "Add command to turn on locations flag\n" }, { "from": "gpt", "value": "from django.core.management.base import BaseCommand\nfrom corehq.apps.domain.models import Domain\nfrom corehq.feature_previews import LOCATIONS\nfrom corehq.toggles import NAMESPACE_DOMAIN\nfrom ...
python
chosen
[ { "from": "human", "value": "Add more index on contact activities\n" }, { "from": "gpt", "value": "# Generated by Django 3.2.6 on 2021-10-13 12:37\n\nfrom django.db import migrations\n\n# language=SQL\nINDEX_SQL_CONTACTACTIVITY_ORG_DATE_SCHEME_NOT_NULL = \"\"\"\nCREATE INDEX IF NOT EXISTS stats_...
python
chosen
[ { "from": "human", "value": "Read the american physics society graph " }, { "from": "gpt", "value": "import numpy \ntry: \n ctypes.cdll.LoadLibrary(\"/usr/local/lib/libigraph.so\")\nexcept: \n pass \nimport igraph \nfrom apgl.util.PathDefaults import PathDefaults \nfrom exp.util.IdIndexer...
python
chosen
[ { "from": "human", "value": "Add migration for db changes\n" }, { "from": "gpt", "value": "# -*- coding: utf-8 -*-\n# Generated by Django 1.11.2 on 2017-08-05 01:07\nfrom __future__ import unicode_literals\n\nfrom django.db import migrations, models\nimport django.db.models.deletion\n\n\nclass M...
python
chosen
[ { "from": "human", "value": "Add GMN DB migration to current\n" }, { "from": "gpt", "value": "# Generated by Django 2.2 on 2019-04-18 20:12\n\nfrom django.db import migrations\n\n\nclass Migration(migrations.Migration):\n\n dependencies = [\n ('app', '0018_auto_20180901_0115'),\n ]\...
python
chosen
[ { "from": "human", "value": "Add a test file which was missing from a recent branch\n" }, { "from": "gpt", "value": "from django.db import models\nfrom djangae.test import TestCase\n\nfrom djangae.contrib import sleuth\n\n\nclass MetaQueryTestModel(models.Model):\n field1 = models.CharField(m...
python
chosen
[ { "from": "human", "value": "Integrate notification app in settings and add basic structure of files\n" }, { "from": "gpt", "value": "from django.conf.urls import url\nfrom link.views import LinkView, LinkReactionView, LinkCommentView\n\n\nurlpatterns = [\n url(r'^$', LinkView.new, name='link...
python
chosen
[ { "from": "human", "value": "Add tests for Generalized Procrustes Analysis (GPA)\n" }, { "from": "gpt", "value": "import unittest\n\nimport numpy as np\nfrom sklearn import datasets\nfrom sklearn import decomposition\nfrom sklearn.utils import estimator_checks\n\nimport prince\n\n\nclass TestGPA...
python
chosen
[ { "from": "human", "value": "Add a test-case for lit xunit output\n\ngit-svn-id: 0ff597fd157e6f4fc38580e8d64ab130330d2411@223307 91177308-0d34-0410-b5e6-96231b3b80d8\n" }, { "from": "gpt", "value": "# Check xunit output\n# RUN: %{lit} --xunit-xml-output %t.xunit.xml %{inputs}/test-data\n# RUN: F...
python
chosen
[ { "from": "human", "value": "Add script to delete spam users.\n" }, { "from": "gpt", "value": "# -*- coding: utf-8 -*-\n\"\"\" Delete users creating by spambots.\n\n\"\"\"\n\nimport logging as log\nfrom optparse import make_option\nfrom django.core.management.base import BaseCommand, CommandErro...
python
chosen
[ { "from": "human", "value": "[SDK-165] Create Virgil highlevel api implementation\n" }, { "from": "gpt", "value": "# Copyright (C) 2016 Virgil Security Inc.\n#\n# Lead Maintainer: Virgil Security Inc. <support@virgilsecurity.com>\n#\n# All rights reserved.\n#\n# Redistribution and use in source ...
python
chosen
[ { "from": "human", "value": "Add SSDP unit test case (init)\n" }, { "from": "gpt", "value": "# -*- coding: utf-8 -*-\n'''\n :codeauthor: :email:`Bo Maryniuk <bo@suse.de>`\n'''\n\nfrom __future__ import absolute_import, print_function, unicode_literals\nfrom tests.support.unit import TestCase,...
python
chosen
[ { "from": "human", "value": "Add api call for Premier League standings\n\nAlso add function to print standings in tablular form using tabulate.\n" }, { "from": "gpt", "value": "import json\nimport requests\nfrom tabulate import tabulate\n\nBASE_URL = \"http://api.football-data.org/alpha/\"\nsocc...
python
chosen
[ { "from": "human", "value": "Exit routine for a controlled exit from ample\n" }, { "from": "gpt", "value": "'''\nCreated on Mar 18, 2015\n\n@author: jmht\n'''\n\nimport logging\nimport sys\nimport traceback\n\n# external imports\ntry: import pyrvapi\nexcept: pyrvapi=None\n\ndef exit(msg):\n l...
python
chosen
[ { "from": "human", "value": "Integrate densities to check normalization\n" }, { "from": "gpt", "value": "import argparse\nimport numpy as np\nimport h5py\n\nif __name__ == '__main__':\n\n parser = argparse.ArgumentParser(description='Integrate probability ' +\n ...
python
chosen
[ { "from": "human", "value": "[typeahead_search] Add a Trie for storage of data string tokens.\n" }, { "from": "gpt", "value": "\"\"\"A Trie (prefix tree) class for use in typeahead search.\n\nEvery node in the TypeaheadSearchTrie is another TypeaheadSearchTrie instance.\n\"\"\"\n\nfrom weakref i...
python
chosen
[ { "from": "human", "value": "Split lowpass filtering into another script.\n" }, { "from": "gpt", "value": "#!/usr/bin/env python\n\nfrom __future__ import division\n\nimport climate\nimport lmj.cubes\nimport pandas as pd\nimport scipy.signal\n\nlogging = climate.get_logger('lowpass')\n\ndef lowp...
python
chosen
[ { "from": "human", "value": "Make `publication_date` column not nullable.\n\nBEFORE: It was nullable (an artifact of us having added it after the\ntable was initially created and populated).\n\nAFTER: It is not nullable (because we just ran a script to populate the\nnew column).\n" }, { "from": "gpt...
python
chosen
[ { "from": "human", "value": "Add functionality to load and test a saved model\n" }, { "from": "gpt", "value": "# import os\nimport sys\nimport tensorflow as tf\n# sys.path.append(os.path.abspath(os.path.dirname(__file__) + '/' + '../..'))\n\nfrom Models.low_level_sharing_four_hidden import LowLe...
python
chosen
[ { "from": "human", "value": "Add first implementation of virtual ontology\n" }, { "from": "gpt", "value": "import requests\nfrom .ontology_graph import IndraOntology\n\n\nclass VirtualOntology(IndraOntology):\n def __init__(self, url, ontology='bio'):\n super().__init__()\n self...
python
chosen
[ { "from": "human", "value": "Add catapult presubmit with list of trybots.\n\nThis should make 'git cl try' work correctly\n\nReview URL: https://codereview.chromium.org/1162013002\n" }, { "from": "gpt", "value": "# Copyright (c) 2015 The Chromium Authors. All rights reserved.\n# Use of this sour...
python
chosen
[ { "from": "human", "value": "Test implementation of convex hull\n" }, { "from": "gpt", "value": "import math\n\nclass Vector:\n def __init__(self, x, y):\n self.x = x\n self.y = y\n \n # add theta, so we can sort by it later\n self.theta = math.atan2(y, x)\n...
python
chosen