conversations listlengths 2 3 | source stringclasses 1
value | stack stringclasses 1
value |
|---|---|---|
[
{
"from": "human",
"value": "Add a helper script to generate a changelog from git log\n"
},
{
"from": "gpt",
"value": "# Writes a changelog in trac WikiFormatting based on a git log\nfrom __future__ import unicode_literals, division, absolute_import\n\nimport codecs\nfrom itertools import ifilte... | python | chosen |
[
{
"from": "human",
"value": "[py] Allow driver fixtures to be used in Chrome only tests\n"
},
{
"from": "gpt",
"value": "# Licensed to the Software Freedom Conservancy (SFC) under one\n# or more contributor license agreements. See the NOTICE file\n# distributed with this work for additional inf... | python | chosen |
[
{
"from": "human",
"value": "Add a snippet (Python OpenCV).\n"
},
{
"from": "gpt",
"value": "#!/usr/bin/env python\n# -*- coding: utf-8 -*-\n\n# Copyright (c) 2015 Jérémie DECOCK (http://www.jdhp.org)\n\n\"\"\"\nOpenCV - Display image: display an image given in arguments\n\nRequired: opencv libr... | python | chosen |
[
{
"from": "human",
"value": "Add custom time picker control\n"
},
{
"from": "gpt",
"value": "\"\"\"Custom time picker that allows us control of the control's color.\"\"\"\nfrom wx.lib.masked import TimeCtrl\nfrom ... util import rgba\nimport wx\n\n\nclass TimePickerCtrl(TimeCtrl):\n \"\"\"Tim... | python | chosen |
[
{
"from": "human",
"value": "Add Kivy version of live audio stream\n"
},
{
"from": "gpt",
"value": "'''\nkivy requires some library installation\n'''\n\n\nimport matplotlib\nmatplotlib.use('module://kivy.garden.matplotlib.backend_kivy')\n\nimport matplotlib.pyplot as plt\nimport kivy\nkivy.requi... | python | chosen |
[
{
"from": "human",
"value": "Add a single-line code golf example\n"
},
{
"from": "gpt",
"value": "print (reduce(lambda string, tup: string + tup[0] + ' - ' + str(tup[1]) + '\\n', sorted( filter(lambda tup: tup[0] not in open('../stop_words.txt').read().lower().split(','), reduce(lambda word_dic... | python | chosen |
[
{
"from": "human",
"value": "Implement a test the RepositoryNotFound exception\n"
},
{
"from": "gpt",
"value": "# -*- coding: utf-8 -*-\n\nimport pytest\n\nfrom cookiecutter import main, exceptions\n\n\ndef test_should_raise_error_if_repo_does_not_exist():\n with pytest.raises(exceptions.Repo... | python | chosen |
[
{
"from": "human",
"value": "Add a simple signal-based Python callstack sampler for debugging\n"
},
{
"from": "gpt",
"value": "\"\"\"A simple Python callstack sampler.\"\"\"\n\nimport contextlib\nimport datetime\nimport signal\nimport traceback\n\n\nclass CallstackSampler(object):\n \"\"\"A sim... | python | chosen |
[
{
"from": "human",
"value": "Add tests for improved exception messages\n"
},
{
"from": "gpt",
"value": "from io import BytesIO\nfrom unittest import TestCase\n\nimport bigjson\n\n\nMISSING_OPEN_QUOTE_JSON_FILE = b\"\"\"\n{\n \"object\": {\n \"x\": y\"\n }\n}\n\"\"\"\n\nCORRUPT_BACKS... | python | chosen |
[
{
"from": "human",
"value": "Add a command to populate test data.\n"
},
{
"from": "gpt",
"value": "from django.core.management.base import BaseCommand\n\nfrom contacts.models import Book, Contact, ContactField\n\nclass Command(BaseCommand):\n\n def handle(self, *args, **kwargs):\n book... | python | chosen |
[
{
"from": "human",
"value": "Add test for repeated permanent keys on a Server class instance\n"
},
{
"from": "gpt",
"value": "\"\"\"\nThe tests provided in this module make sure that the server\ninstance behaves as expected.\n\"\"\"\n\nimport pytest\n\nfrom saltyrtc import server\n\n\nclass Test... | python | chosen |
[
{
"from": "human",
"value": "Add an example to compare Gamma and Spline\n"
},
{
"from": "gpt",
"value": "\"\"\"\nThis test file is meant for developing purposes. Providing an easy method to\ntest the functioning of Pastas during development.\n\n\"\"\"\nimport pandas as pd\n\nimport pastas as ps\... | python | chosen |
[
{
"from": "human",
"value": "Add py solution for 372. Super Pow\n\n372. Super Pow: https://leetcode.com/problems/super-pow/\n"
},
{
"from": "gpt",
"value": "class Solution(object):\n def superPow(self, a, b):\n \"\"\"\n :type a: int\n :type b: List[int]\n :rtype: i... | python | chosen |
[
{
"from": "human",
"value": "Remove delete permission for Program resources from the ProgramEditor\nrole.\n"
},
{
"from": "gpt",
"value": "\n\"\"\"Remove delete program permission from ProgramEditor.\n\nRevision ID: 1f865f61312\nRevises: eab1d38baee\nCreate Date: 2013-12-06 19:26:11.875923\n\n\"... | python | chosen |
[
{
"from": "human",
"value": "Add script to fetch licenses\n"
},
{
"from": "gpt",
"value": "#!/usr/bin/python\nimport requests\nimport json\nimport ast\n\ndef parse_dataset_metadata(dataset):\n if 'rights' in dataset.keys():\n\trights = dataset['rights']\n else:\n\trights = 'not supplied'\n... | python | chosen |
[
{
"from": "human",
"value": "Add call empty contract python test\n"
},
{
"from": "gpt",
"value": "#!/usr/bin/env python3\n# Copyright (c) 2015-2016 The Bitcoin Core developers\n# Distributed under the MIT software license, see the accompanying\n# file COPYING or http://www.opensource.org/license... | python | chosen |
[
{
"from": "human",
"value": "Complete alg: tower of hanoi\n"
},
{
"from": "gpt",
"value": "\"\"\"The tower of Hanoi.\"\"\"\nfrom __future__ import print_function\n\ndef move_towers(height, from_pole, to_pole, with_pole):\n move_towers(height - 1, from_pole, with_pole, to_pole)\n move_disk(... | python | chosen |
[
{
"from": "human",
"value": "chore: Add test file for affect_ai class\n"
},
{
"from": "gpt",
"value": "import affect_ai\n\n# Test that an affect_AI object gets created correctly\n# Test that an affect_AI object can be trained, and builds vocabulary correctly\n# Test that an affect_AI object corr... | python | chosen |
[
{
"from": "human",
"value": "Check if two strings are isomorphic\n"
},
{
"from": "gpt",
"value": "#!/usr/bin/python\n\ndef check_isomorphic(s1, s2) :\n d = dict()\n if len(s1) != len(s2) :\n return False\n for i in range(0, len(s1)) :\n if s1[i] in d :\n if d[s1[i]] != s2[i] :\n return ... | python | chosen |
[
{
"from": "human",
"value": "Add custom validator for matching db fields\n"
},
{
"from": "gpt",
"value": "from wtforms.validators import ValidationError\n\n\ndef db_match(model, message, *args, **kwargs):\n fields = kwargs.pop('match_fields', None)\n result = model.query.filter_by(*args, *... | python | chosen |
[
{
"from": "human",
"value": "Add script to generate wiki command documentation\n\nAdds ddsc/generatedocs.py to generate the wiki command list.\nWhen command line argument changes are made this script will\ngenerate markdown that should be added to the wiki on the\n[All-Commands](https://github.com/Duke-GCB/... | python | chosen |
[
{
"from": "human",
"value": "feat(translation): Add nb-NO to bb-NO macro(Created by Karel)\n"
},
{
"from": "gpt",
"value": "\"\"\"\r\n nb-NO to nn-NO Metadata Macro will perform the following changes to current content item:\r\n - change the byline to \"(NPK-NTB)\"\r\n - change the body... | python | chosen |
[
{
"from": "human",
"value": "Add saved database queries for exploring database contents\n"
},
{
"from": "gpt",
"value": "\"\"\"This module contains utility functions to print reports of the\ndatabase contents.\n\nThe need is to find examples of extreme or pathological content\nwith either long f... | python | chosen |
[
{
"from": "human",
"value": "Test for adding products to the quote list\n"
},
{
"from": "gpt",
"value": "import time\nimport unittest\nfrom selenium import webdriver\nfrom selenium.webdriver.common.by import By\n\n\nclass TestAddproduct(unittest.TestCase):\n def setUp(self):\n self.dri... | python | chosen |
[
{
"from": "human",
"value": "Add publicbody migration for on_delete"
},
{
"from": "gpt",
"value": "# -*- coding: utf-8 -*-\n# Generated by Django 1.10.1 on 2016-11-30 00:28\nfrom __future__ import unicode_literals\n\nfrom django.conf import settings\nfrom django.db import migrations, models\nimp... | python | chosen |
[
{
"from": "human",
"value": "Add migration file for metadata descriptor\n"
},
{
"from": "gpt",
"value": "\"\"\"empty message\n\nRevision ID: a65bdadbae2f\nRevises: e1ef93f40d3d\nCreate Date: 2019-01-15 12:19:59.813805\n\n\"\"\"\nfrom alembic import op\nimport sqlalchemy as sa\nimport sqlalchemy_... | python | chosen |
[
{
"from": "human",
"value": "Add tests for the lexer.\n\nSigned-off-by: Raphaël Barrois <8eb3b37a023209373fcd61a2fdc08256a14fb19c@polytechnique.org>\n"
},
{
"from": "gpt",
"value": "#!/usr/bin/env python\n# -*- coding: utf-8 -*-\n# Copyright (c) 2010-2012 Raphaël Barrois\n\n\"\"\"Tests for token... | python | chosen |
[
{
"from": "human",
"value": "Patch sympy to return COBRA compatible expressions on str\n"
},
{
"from": "gpt",
"value": "# Copyright 2015 Novo Nordisk Foundation Center for Biosustainability, DTU.\n\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may not use this file ... | python | chosen |
[
{
"from": "human",
"value": "Add test for dynamic options from server\n"
},
{
"from": "gpt",
"value": "import dash\nfrom dash.dependencies import Input, Output, State\nfrom dash.exceptions import PreventUpdate\nimport dash.testing.wait as wait\nimport dash_core_components as dcc\n\n\ndef test_dd... | python | chosen |
[
{
"from": "human",
"value": "notify: Include migration for notify_by_mail. ...\n\nRequired for commit 651c0f984f7c75 or later to work.\n"
},
{
"from": "gpt",
"value": "from sqlalchemy import *\nfrom migrate import *\nfrom raggregate.guid_recipe import GUID\n\n\ndef upgrade(migrate_engine):\n ... | python | chosen |
[
{
"from": "human",
"value": "Move code to the root of the main module.\n"
},
{
"from": "gpt",
"value": "class ViewBase(object):\n \"\"\"\n Base class for all views and nodes.\n \"\"\"\n\n # database session\n _session = None\n # the scope is the dict sent to the template engine... | python | chosen |
[
{
"from": "human",
"value": "Add empty property to property verification folder.\n"
},
{
"from": "gpt",
"value": "\n\nfrom core.himesis import Himesis, HimesisPreConditionPatternLHS\n\nclass HEmpty_IsolatedConnectedLHS(HimesisPreConditionPatternLHS):\n def __init__(self):\n \"\"\"\n ... | python | chosen |
[
{
"from": "human",
"value": "Test for multithreading with twisted framework\n"
},
{
"from": "gpt",
"value": "\"\"\"\nThis file implements testing ing langcodes module for multithreaded env\n\nProblem is still there if you try to acccess that module from multiple places at once\n\"\"\"\nimport th... | python | chosen |
[
{
"from": "human",
"value": "Reduce versions to easier requirements.txt style\n\nGiven an `aRchive_output_path/PACKAGE_versions_full.txt` file, this\nreduces it into the component\n`aRchive_output_path/PACKAGE_VERSION_dependencies.txt` files, each which\nlook like:\n\n Biobase 2.26.0 Biobase_2.26.0_depe... | python | chosen |
[
{
"from": "system",
"value": "Load wsgi apps after reading the configuration.\n"
},
{
"from": "human",
"value": "# -*- coding: utf-8 -\n#\n# This file is part of gunicorn released under the MIT license. \n# See the NOTICE for more information.\n\nimport os\nimport sys\nimport traceback\n\nfrom g... | python | chosen |
[
{
"from": "human",
"value": "Create test scaffold for command functions\n\n"
},
{
"from": "gpt",
"value": "from django.test import TestCase\n\nfrom molo.core.tests.base import MoloTestCaseMixin\nfrom molo.core.management.commands.move_page_links_to_recomended_articles import convert_articles # ... | python | chosen |
[
{
"from": "human",
"value": "Reset script for incorrectly-extracted PDFs.\n"
},
{
"from": "gpt",
"value": "GEVENT = False\n\nfrom regs_models import Doc\nimport json\nimport itertools\n\ndef split_seq(iterable, size):\n it = iter(iterable)\n item = list(itertools.islice(it, size))\n whi... | python | chosen |
[
{
"from": "human",
"value": "Add script to add missing system tags\n"
},
{
"from": "gpt",
"value": "# -*- coding: utf-8 -*-\n\"\"\"Add system tags that weren't added during the Toku->Postgres migration.\nPass a path to a JSON file that has node IDs as keys and lists of system tag names\nas value... | python | chosen |
[
{
"from": "human",
"value": "Set up with mongo: working\n"
},
{
"from": "gpt",
"value": "from flask import Flask\nfrom flask.ext.pymongo import PyMongo\nfrom bson.json_util import dumps\n\napp = Flask('test')\nmongo = PyMongo(app)\n\n@app.route('/')\ndef home_page():\n\ttest = mongo.db.events.fi... | python | chosen |
[
{
"from": "human",
"value": "Fix watcher audit list command\n\nThis patch set adds data migration version that fills noname audits\nwith name like strategy.name + '-' + audit.created_at.\n\nCloses-Bug: #1738758\nChange-Id: I1d65b3110166e9f64ce5b80a34672d24d629807d\n"
},
{
"from": "gpt",
"value":... | python | chosen |
[
{
"from": "human",
"value": "tests: Add test for dict delete. It fails.\n"
},
{
"from": "gpt",
"value": "for i in range(100):\n d = dict()\n for j in range(100):\n d[j] = j\n del d[i]\n for j in range(100):\n if j not in d:\n print(j, 'not in d')\n"
}
] | python | chosen |
[
{
"from": "human",
"value": "Add test to define how new exceptions module should work\n"
},
{
"from": "gpt",
"value": "\"\"\"tests/test_exceptions.py.\n\nTests to ensure custom exceptions work and are formatted as expected\n\nCopyright (C) 2015 Timothy Edmund Crosley\n\nPermission is hereby gran... | python | chosen |
[
{
"from": "human",
"value": "Add calculate AUC value of PR curve by sklearn\n"
},
{
"from": "gpt",
"value": "#!/usr/local/bin/python3\n# -*- coding: utf-8 -*-\n'''使用real.csv和result.csv表格数据,计算PR曲线的AUC值'''\nimport sys\nimport pandas\nfrom pandas import DataFrame\nfrom sklearn.metrics import auc, p... | python | chosen |
[
{
"from": "human",
"value": "Add script to check party/speeches data\n\nAdded a quick and dirty script to determine additional corpus statistics,\nsuch as\n- party names\n- number of speeches found\n- number of speeches without party\n- number of speeches per party\n\nbecause it seems that the folia data is... | python | chosen |
[
{
"from": "human",
"value": "Add util to find config options\n"
},
{
"from": "gpt",
"value": "#!/usr/bin/env python\n# -*- encoding: utf-8 -*-\n# Small script to find variables that can be declared in config...\nimport os\nimport re\nfrom pprint import pprint\n\nget_rg = re.compile(r'[^\\.](conf... | python | chosen |
[
{
"from": "human",
"value": "Add function for plotting fit vs step\n\nA simple function to plot the fitness function vs. iteration from the\nlogfile generated by MSIBI.optimize().\nThis may belong in a different location, but putting it here for now.\n"
},
{
"from": "gpt",
"value": "import os.pa... | python | chosen |
[
{
"from": "human",
"value": "Add pirate-enabled version of the hook\n"
},
{
"from": "gpt",
"value": "#!/usr/bin/python\n\nimport sys\nimport os\nfrom tasklib.task import Task, TaskWarrior\n\ntime_attributes = ('wait', 'until', 'scheduled')\n\ndef is_new_local_recurrence_child_task(task):\n # ... | python | chosen |
[
{
"from": "human",
"value": "Add a test to check if an optical mouse can be used as a course sensor\n"
},
{
"from": "gpt",
"value": "from pymouse import PyMouse\nimport time\n# This script demonstrates the possibility to use a mouse as an unbound sensor.\n# To do that the cursor position is brou... | python | chosen |
[
{
"from": "human",
"value": "Add Insertion Sort for float numbers\n\nI am planning to implement all sorting techniques I learn in this script\nAlso I will try to incoporate time comparison at a later stage.\n\nSigned-off-by: Aditya Prasad <5c5d1de3672d25c1ad997cc5b3c40a32c347e962@gmail.com>\n"
},
{
... | python | chosen |
[
{
"from": "human",
"value": "Add script for getting rid of too wide NPs\n"
},
{
"from": "gpt",
"value": "#!/usr/bin/env python3\n\nimport sys\nfrom nltk.tree import Tree\n\ndef sort_nps():\n with open(sys.argv[1]) as np_doc:\n for line in np_doc:\n t = Tree.fromstring(line)\... | python | chosen |
[
{
"from": "human",
"value": "Add management command to run the checks\n"
},
{
"from": "gpt",
"value": "# -*- coding: utf-8 -*-\nfrom django.core.management.base import BaseCommand, CommandError\nfrom velkoja.nordeachecker import NordeaOverdueInvoicesHandler\n\n\nclass Command(BaseCommand):\n ... | python | chosen |
[
{
"from": "human",
"value": "Add conf file for BabyLab KoomBook\n"
},
{
"from": "gpt",
"value": "# -*- coding: utf-8 -*-\n\"\"\"KoomBook conf\"\"\"\nfrom .kb import * # noqa\nfrom django.utils.translation import ugettext_lazy as _\n\nLANGUAGE_CODE = 'fr'\nIDEASCUBE_NAME = 'BabyLab'\nHOME_CARDS ... | python | chosen |
[
{
"from": "human",
"value": "Rename pre-pull and move to scripts/.\n"
},
{
"from": "gpt",
"value": "#!/usr/bin/python\n\nimport argparse\nimport os\nimport sys\nimport string\nimport subprocess\n\nimport escapism\n\nsafe_chars = set(string.ascii_lowercase + string.digits)\nrepo = 'https://github... | python | chosen |
[
{
"from": "human",
"value": "PUBDEV-2979: Add extra Python test for mean-per-class error.\n"
},
{
"from": "gpt",
"value": "import sys\nsys.path.insert(1,\"../../\")\nimport h2o\nfrom tests import pyunit_utils\nfrom h2o.estimators.gbm import H2OGradientBoostingEstimator\n\n\ndef pyunit_mean_per_c... | python | chosen |
[
{
"from": "human",
"value": "Add missing TestSuite ON DELETE UPDATE constraints\n"
},
{
"from": "gpt",
"value": "\"\"\"Set ON DELETE CASCADE on TestSuite.*\n\nRevision ID: 4d5d239d53b4\nRevises: 501983249c94\nCreate Date: 2013-12-23 16:14:08.812850\n\n\"\"\"\n\n# revision identifiers, used by Al... | python | chosen |
[
{
"from": "human",
"value": "Add migration to drop Trackman tables\n"
},
{
"from": "gpt",
"value": "\"\"\"Drop Trackman tables\n\nRevision ID: 5981b26ae993\nRevises: 804fb3dc434f\nCreate Date: 2018-05-19 23:57:42.897891\n\n\"\"\"\n\n# revision identifiers, used by Alembic.\nrevision = '5981b26ae... | python | chosen |
[
{
"from": "human",
"value": "Add test file for COPY client\n"
},
{
"from": "gpt",
"value": "import os\nimport pytest\nimport time\n\nfrom carto.exceptions import CartoException\nfrom carto.sql import SQLClient, BatchSQLClient, CopySQLClient\n\n\nSETUP_QUERIES = [\n 'DROP TABLE IF EXISTS carto... | python | chosen |
[
{
"from": "human",
"value": "Test the SecFiling10Q for an ALEX 10-q filing.\n"
},
{
"from": "gpt",
"value": "from __future__ import print_function\nimport pandas as pd\nfrom bs4 import BeautifulSoup as BSoup\n\nfrom SecFiling10Q import SecFiling10Q\n\ndef areEqual(expect, val, eps = 0.01):\n ... | python | chosen |
[
{
"from": "human",
"value": "Add two new letter logos\n"
},
{
"from": "gpt",
"value": "\"\"\"empty message\n\nRevision ID: 0225_another_letter_org\nRevises: 0224_returned_letter_status\n\n\"\"\"\n\n# revision identifiers, used by Alembic.\nrevision = '0225_another_letter_org'\ndown_revision = '0... | python | chosen |
[
{
"from": "human",
"value": "Add initial test for base block elements\n"
},
{
"from": "gpt",
"value": "\"\"\"tests/test_base.py.\n\nTests the base blox to ensure they provide solid functionality for a Python dom representation\nCopyright (C) 2015 Timothy Edmund Crosley\n\nPermission is hereby gr... | python | chosen |
[
{
"from": "human",
"value": "Add testing of behavior when syscall fails\n"
},
{
"from": "gpt",
"value": "#!/usr/bin/env python\n\nfrom butter import eventfd, _eventfd\nfrom pytest import raises\nimport pytest\nimport errno\n\n@pytest.mark.parametrize('path,module,func,errno,exception', [\n ... | python | chosen |
[
{
"from": "human",
"value": "Add export data into apache folder script\n"
},
{
"from": "gpt",
"value": "#python mk_json_quert.py & excute it in backgroud\n# excute ES query and export it to apache directory for data visulization\nimport datetime\nfrom elasticsearch import Elasticsearch\nfrom ela... | python | chosen |
[
{
"from": "human",
"value": "Create container, build the spurce and run ardurover\n"
},
{
"from": "gpt",
"value": "import docker\nimport dronekit\n\n# connect to the Docker daemon\nclient = docker.client.from_env()\nprint(\"AAA\")\n\n# provision a container from an ArduPilot image\nimage_name = ... | python | chosen |
[
{
"from": "human",
"value": "ADD initial environment unit tests\n"
},
{
"from": "gpt",
"value": "from src.main.core.database import *\nfrom src.main.core.database.environment.environment import Environment\nfrom src.main.core.database.environment.user_environment import UserEnvironment\nfrom src... | python | chosen |
[
{
"from": "human",
"value": "Add a sinus utilities for the servo module.\n"
},
{
"from": "gpt",
"value": "from __future__ import division\n\nfrom threading import Thread\nfrom time import time, sleep\nfrom math import sin, pi\n\n\nclass Sinus(object):\n update_frequency = 25.0\n\n def __in... | python | chosen |
[
{
"from": "human",
"value": "Complete day 1 part 2\n"
},
{
"from": "gpt",
"value": "with open('day-1-input.txt', 'r') as f:\n puzzle_input = f.read()\n\n\ncurrent_floor = 0\ncurrent_position = 0\n\nfor paren in puzzle_input:\n current_position += 1\n\n if paren == '(':\n current_... | python | chosen |
[
{
"from": "human",
"value": "Add missing migration for unit tests\n"
},
{
"from": "gpt",
"value": "# -*- coding: utf-8 -*-\nfrom __future__ import unicode_literals\n\nfrom django.db import migrations, models\nimport shuup.utils.properties\nimport shuup.core.fields\n\n\nclass Migration(migrations... | python | chosen |
[
{
"from": "human",
"value": "Add per channel K conversion function\n"
},
{
"from": "gpt",
"value": "\nfrom spectral_cube import SpectralCube, VaryingResolutionSpectralCube\nfrom astropy.io import fits\nimport astropy.units as u\nimport os\n\nfrom .io_utils import create_huge_fits\nfrom .progress... | python | chosen |
[
{
"from": "human",
"value": "Move clippped_loss into a separate file\n"
},
{
"from": "gpt",
"value": "from chainer import functions as F\n\ndef clipped_loss(x, t):\n diff = x - t\n abs_loss = abs(diff)\n squared_loss = diff ** 2\n abs_loss = F.expand_dims(abs_loss, 1)\n squared_lo... | python | chosen |
[
{
"from": "human",
"value": "Add pythons script to make charts.\n"
},
{
"from": "gpt",
"value": "#!/usr/bin/python3\n\nimport sys\nimport os\nimport subprocess\n\nif len(sys.argv) < 3:\n\tprint(\"Provide reference image and output file.\")\n\texit(1)\n\nreference = sys.argv[1]\noutput = sys.argv... | python | chosen |
[
{
"from": "human",
"value": "Add initial aperture descriptor classes\n"
},
{
"from": "gpt",
"value": "# Licensed under a 3-clause BSD style license - see LICENSE.rst\n\"\"\"\nDescriptor class(es) for aperture attribute validation.\n\"\"\"\n\nimport weakref\n\nfrom astropy.coordinates import SkyC... | python | chosen |
[
{
"from": "system",
"value": "Add column default for User.name column\n"
},
{
"from": "human",
"value": "\"\"\"Add User.name column\n\nRevision ID: ad456cec28f4\nRevises: d767d9266a19\nCreate Date: 2016-11-21 03:03:08.967762\n\n\"\"\"\n\n# revision identifiers, used by Alembic.\nrevision = 'ad45... | python | chosen |
[
{
"from": "human",
"value": "[AC-9265] Merge remote-tracking branch 'origin' into AC-9265\n"
},
{
"from": "gpt",
"value": "# Generated by Django 2.2.24 on 2021-11-29 12:36\n\nfrom django.db import migrations\n\n\ndef update_judging_commitment_view_url(apps, schema_editor):\n NavTreeItem = app... | python | chosen |
[
{
"from": "human",
"value": "Add component for converting between numpy types\n"
},
{
"from": "gpt",
"value": "import Axon\n\nclass TypeConverter(Axon.Component.component):\n type = None\n def main(self):\n while 1:\n if self.dataReady(\"inbox\"):\n data = ... | python | chosen |
[
{
"from": "human",
"value": "Implement new microscope type for nikon NISElements\n"
},
{
"from": "gpt",
"value": "'''Implementation of classes for reading microscope image and metadata files\nprovided in a format specific to microscopes equipped\nwith\n`Nikon NISElements <https://www.nikoninstru... | python | chosen |
[
{
"from": "human",
"value": "Add the user interface for string/password obfuscation\n"
},
{
"from": "gpt",
"value": "\"\"\"\nObfuscates a string/password into a string that can be decrypted later on.\n\nUsage:\npython obfuscate.py\nThen enter the password.\nThe result is an encrypted password.\n... | python | chosen |
[
{
"from": "human",
"value": "Add outline parent class for defining experiments\n"
},
{
"from": "gpt",
"value": "class Experiment(object):\n def __init__(self, epochs=1):\n self.epochs = epochs\n\n def get_epochs(self):\n return self.epochs\n\n def train(self):\n rai... | python | chosen |
[
{
"from": "human",
"value": "Add test for basic functionality\n"
},
{
"from": "gpt",
"value": "import textwrap\nimport sys\nimport subprocess\n\n\ndef test_pkg_imported(tmpdir):\n\t\"\"\"\n\tCreate a script that loads cython and ensure it runs.\n\t\"\"\"\n\tbody = textwrap.dedent(\"\"\"\n\t\timp... | python | chosen |
[
{
"from": "human",
"value": "Test that backend actually sends the events\n"
},
{
"from": "gpt",
"value": "import threading\nimport unittest\n\nfrom pykka.actor import ThreadingActor\nfrom pykka.registry import ActorRegistry\n\nfrom mopidy.backends.dummy import DummyBackend\nfrom mopidy.listeners... | python | chosen |
[
{
"from": "human",
"value": "Write multithreaded script to get all weather for existing incidents in the database\n"
},
{
"from": "gpt",
"value": "from mapApp.models import Incident, Weather\nfrom mapApp.utils.weather import get_weather\nimport threading\nimport time\n\nmaxconnections = 5\nsemap... | python | chosen |
[
{
"from": "human",
"value": "Add task to upload a dir to S3\n"
},
{
"from": "gpt",
"value": "import os\n\nimport boto\nfrom boto.utils import compute_md5\nfrom fabric.decorators import task\nfrom fabric.utils import puts\n\n\ndef upload_file(bucket, key_name, file_path, policy='public-read'):\n ... | python | chosen |
[
{
"from": "system",
"value": "Fix the devserver default address setting name."
},
{
"from": "human",
"value": "#\n# Include your development machines hostnames here.\n#\n# NOTE: this is not strictly needed, as Django doesn't enforce\n# the check if DEBUG==True. But Just in case you wanted to dis... | python | chosen |
[
{
"from": "human",
"value": "Add a small too to update qibuild.cmake inside git repos\n"
},
{
"from": "gpt",
"value": "## Copyright (C) 2011 Aldebaran Robotics\n\n# Update all the qibuild.cmake files in a git repo\n# (this will be done automatically by `qibuild configure`,\n# but this tool can s... | python | chosen |
[
{
"from": "system",
"value": "Make mail working on my dev machine."
},
{
"from": "human",
"value": "# -*- coding: utf-8 -*-\n# Settings for 1flow.net (local development)\n\nimport os\nfrom sparks.django.settings import include_snippets\n\ninclude_snippets(\n os.path.dirname(__file__), (\n ... | python | chosen |
[
{
"from": "human",
"value": "Change version terp and move migration folder\n"
},
{
"from": "gpt",
"value": "# coding=utf-8\nfrom oopgrade import oopgrade\nimport netsvc\n\n\ndef up(cursor, installed_version):\n logger= netsvc.Logger()\n print \"somenergia-generationkwh_0.0.1.1: Hem entrat ... | python | chosen |
[
{
"from": "system",
"value": "Fix time calculation for TryLater in PeriodicTasks\n"
},
{
"from": "human",
"value": "from ..vtask import VTask, TryLater\nimport time\nfrom ..sparts import option, counter, samples, SampleType\nfrom threading import Event\n\n\nclass PeriodicTask(VTask):\n INTERV... | python | chosen |
[
{
"from": "human",
"value": "Add script to convert the archives index\n\nThe Archives provided us with an index mapping a place\nto a range of identifier. This needs some work to be useful.\n"
},
{
"from": "gpt",
"value": "# -*- coding: utf-8 -*-\n\n\"\"\"Converting the index from the Archives i... | python | chosen |
[
{
"from": "human",
"value": "Add worker celery reload command prototype\n"
},
{
"from": "gpt",
"value": "import shlex\nimport subprocess\n\nfrom django.core.management.base import BaseCommand\nfrom django.utils import autoreload\n\n# thanks to https://medium.com/aubergine-solutions/auto-reload-d... | python | chosen |
[
{
"from": "human",
"value": "Add script for PCA compressing jacobian arrays.\n"
},
{
"from": "gpt",
"value": "import climate\nimport logging\nimport numpy as np\nimport os\n\nfrom sklearn.decomposition import PCA\n\n\ndef compress(source, k='mle', key='jac'):\n filenames = sorted(fn for fn in... | python | chosen |
[
{
"from": "human",
"value": "Add new patch type that allows for multiple wrappers\n\nPatchSimple allows for exactly one wrapper for input and output functions\nrespectively. For xarray output function save_mfdataset, the default wrapper\nwhich logs argument 0 does not work, because it should be argument 1\n... | python | chosen |
[
{
"from": "human",
"value": "Add tooling to get all of edx's web services.\n"
},
{
"from": "gpt",
"value": "import github\nfrom get_repos import *\n\n\nwebservices = []\n\nfor repo in expanded_repos_list(orgs):\n try:\n metadata = get_remote_yaml(repo, 'openedx.yaml')\n except githu... | python | chosen |
[
{
"from": "human",
"value": "Add python wrapper around fftpack dct.\n"
},
{
"from": "gpt",
"value": "\"\"\"\nReal spectrum tranforms (DCT, DST, MDCT)\n\"\"\"\n\n__all__ = ['dct1', 'dct2']\n\nimport numpy as np\nfrom scipy.fftpack import _fftpack\n\nimport atexit\natexit.register(_fftpack.destroy... | python | chosen |
[
{
"from": "human",
"value": "Implement management command to switch backend server in JIRA Service Desk plugin.\n"
},
{
"from": "gpt",
"value": "from django.core.management.base import BaseCommand\n\nfrom waldur_mastermind.support import backend as support_backend\n\nfrom ... import models\n\n\n... | python | chosen |
[
{
"from": "human",
"value": "Add a sample script for searching subnets in a CIDR\n\nSee request in community:\n\nhttps://community.infoblox.com/t5/Network-Change-Configuration/Anyone-ha\nve-an-Example-NetMRI-REST-call-using-filters-in-Python/m-p/5021#M1430\n"
},
{
"from": "gpt",
"value": "#!/usr... | python | chosen |
[
{
"from": "human",
"value": "Add a command to start the WebUI using oq\n\nThe django development server is started in foreground\non localhost:8800. Meant to be used with multi_user = false\nbut works also if true.\n\n\nFormer-commit-id: bbfc5549fb632d535ed1934e0d2bd1226ccd4507"
},
{
"from": "gpt",
... | python | chosen |
[
{
"from": "human",
"value": "Implement simple unit tests for loading data at startup\n"
},
{
"from": "gpt",
"value": "import unittest\nimport sys\nsys.path.append('soccer')\nimport leagueproperties\nimport leagueids\nimport main\n\nclass TestLoadData(unittest.TestCase):\n\n TEAMS_INFO_FILENAM... | python | chosen |
[
{
"from": "human",
"value": "Refactor factory testing even more\n"
},
{
"from": "gpt",
"value": "import pytest\n\n\ndef test_factory(factory):\n try:\n factory()\n except Exception as e:\n pytest.fail(\n f\"Failed factory initialization for {str(factory)} with exce... | python | chosen |
[
{
"from": "human",
"value": "Add Module for Displaying Flags in Tkinter Window\n"
},
{
"from": "gpt",
"value": "import Tkinter\nimport flaggen\n\nclass FlagFrame(Tkinter.Frame):\n def __init__(self, master, flag, *args, **kwargs):\n Tkinter.Frame.__init__(self, master, *args, **kwargs)... | python | chosen |
[
{
"from": "human",
"value": "Add migration to remove empty actionsets\n"
},
{
"from": "gpt",
"value": "# -*- coding: utf-8 -*-\nfrom __future__ import unicode_literals\n\nfrom django.db import migrations, models\nfrom django.db.models import Q\nimport json\n\n\ndef fix_empty_starts(apps, schema)... | python | chosen |
[
{
"from": "human",
"value": "Add tests for RGW daemon naming\n\nSigned-off-by: Travis Rhoden <e5e44d6dbac12e32e01c3bb8b67940d8b42e225b@redhat.com>\n"
},
{
"from": "gpt",
"value": "import pytest\nimport subprocess\n\nimport ceph_deploy.rgw as rgw\n\n\ndef test_help(tmpdir, cli):\n with cli(\n ... | python | chosen |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.