conversations
listlengths
2
3
source
stringclasses
1 value
stack
stringclasses
1 value
[ { "from": "system", "value": "Change merge_and_count to accept 2 array arguments\n" }, { "from": "human", "value": "from random import randint\nimport sys\n\ndef sort_and_count(arr):\n\tn = len(arr)\n\n\tif n == 1:\n\t\treturn 0\n\n\telse:\n\t\tfirst_half = arr[:n/2]\n\t\tsecond_half = arr[n/2:]...
python
chosen
[ { "from": "system", "value": "Use symlinks to avoid weird behavior from removing the CWD while we're in it" }, { "from": "human", "value": "import os\nimport shutil\n\ndef main():\n cwd = os.getcwd()\n if not cwd.endswith(os.path.join('FRENSIE', 'scripts')):\n print 'This script mus...
python
chosen
[ { "from": "system", "value": "Fix return codes for check recipient\n" }, { "from": "human", "value": "#!/usr/bin/env python\n# -*- encoding: utf-8 -*-\n# check_recipient_access.py\n# Copyright (C) 2013 LEAP\n#\n# This program is free software: you can redistribute it and/or modify\n# it under th...
python
chosen
[ { "from": "system", "value": "Remove unnecesssary comments of old function signatures\n" }, { "from": "human", "value": "class SpacyWordTokenizer():\n \"\"\"\n A Tokenizer splits strings into word tokens.\n \"\"\"\n def __init__(self):\n # Import is here it's slow, and can be ...
python
chosen
[ { "from": "system", "value": "Add extremely basic template for command modules\n" }, { "from": "human", "value": "#!/usr/bin/env python3\n\nfrom src.TwircBot import TwircBot\nimport sys\n\ntry:\n bot = TwircBot(sys.argv[1])\nexcept IndexError:\n bot = TwircBot()\n\nbot.print_config()\nbot....
python
chosen
[ { "from": "system", "value": "Set up sample project to throw web exceptions (for request oject)\n" }, { "from": "human", "value": "import sys, os\nimport traceback\nfrom provider import raygunprovider\n\ndef handle_exception(exc_type, exc_value, exc_traceback): \n cl = raygunprovider.Raygu...
python
chosen
[ { "from": "system", "value": "Add a method to get the idle time. Also data are directly readed in /proc/uptime.\n" }, { "from": "human", "value": "#!/bin/python3\n\"\"\" This script contains functions to access various system's info.\n\n Author: Julien Delplanque\n\"\"\"\nimport subprocess\n\...
python
chosen
[ { "from": "system", "value": "Add a stub for fts_updates\n\nChange-Id: Ieb48f98a0072dcd27de0b50027ff6c5f3ecc1513\nReviewed-on: http://review.couchbase.org/70413\nTested-by: buildbot <80754af91bfb6d1073585b046fe0a474ce868509@couchbase.com>\nReviewed-by: Pavel Paulau <dd88eded64e90046a680e3a6c0828ceb8fe8a0e7@...
python
chosen
[ { "from": "system", "value": "Change default SERVER_NAME to localhost:5000\n\nThis is to make it work more out of the box, without the need to edit /etc/hosts" }, { "from": "human", "value": "#!/usr/bin/env python\n# -*- coding: utf-8 -*-\n#\n# Flask application default config:\n# http://flask.p...
python
chosen
[ { "from": "system", "value": "Include the official nydus release\n" }, { "from": "human", "value": "#!/usr/bin/python\n\nfrom setuptools import setup, find_packages\n\ntests_require=[\n 'nose',\n 'mock',\n]\n\nsetup(\n name=\"sunspear\",\n license='Apache License 2.0',\n version=\...
python
chosen
[ { "from": "system", "value": "Fix NR deploy notification bug\n" }, { "from": "human", "value": "\"\"\"\nManagement command to enable New Relic notification of deployments\n\n.. moduleauthor:: Infoxchange Development Team <development@infoxchange.net.au>\n\n\"\"\"\n\nimport os\nfrom subprocess im...
python
chosen
[ { "from": "system", "value": "Fix python object searilization problem in yaml\n" }, { "from": "human", "value": "import io\nimport glob\nimport yaml\nimport logging\nimport os\n\nfrom uuid import uuid4\n\nfrom jinja2 import Template\n\nlogger = logging.getLogger(__name__)\n\n\ndef create_dir(dir...
python
chosen
[ { "from": "system", "value": "Add teardown specific to the former TestCase class\n" }, { "from": "human", "value": "#!/usr/bin/env python\n# -*- coding: utf-8 -*-\n\n\"\"\"\ntest_generate_files\n-------------------\n\nTest formerly known from a unittest residing in test_generate.py named\nTestGe...
python
chosen
[ { "from": "system", "value": "Rename sys modules access to web module\n" }, { "from": "human", "value": "\"\"\"This module is for testing the online checker.\"\"\"\n\n\nimport sys\n\nfrom unittest import TestCase\n\nONLINE_CHECKER = sys.modules[\"Rainmeter.http.online_checker\"]\n\n\nclass TestR...
python
chosen
[ { "from": "system", "value": "Call 'lower()' on the input\n" }, { "from": "human", "value": "\"\"\"\n instabot example\n\n Whitelist generator: generates a list of users which\n will not be unfollowed.\n\"\"\"\n\nimport sys\nimport os\nimport random\n\nsys.path.append(os.path.join(sys.p...
python
chosen
[ { "from": "system", "value": "tests: Fix missing mock and rename variable\n" }, { "from": "human", "value": "\"\"\"Test default Security Groups.\"\"\"\nfrom unittest import mock\n\nfrom foremast.securitygroup.create_securitygroup import SpinnakerSecurityGroup\n\n\n@mock.patch('foremast.securityg...
python
chosen
[ { "from": "system", "value": "Fix 2to3 fixers to work with Python 3.\n" }, { "from": "human", "value": "# Based on fix_intern.py. Original copyright:\n# Copyright 2006 Georg Brandl.\n# Licensed to PSF under a Contributor Agreement.\n\n\"\"\"Fixer for intern().\n\nintern(s) -> sys.intern(s)\"\"\"...
python
chosen
[ { "from": "system", "value": "Sort dimensins to reduce code\n" }, { "from": "human", "value": "class TriangleError(Exception):\n pass\n\n\nclass Triangle(object):\n def __init__(self, *dims):\n if not self.is_valid(dims):\n raise TriangleError(\"Invalid dimensions: {}\".f...
python
chosen
[ { "from": "system", "value": "Order agonistic options to control vacuum gripper\n" }, { "from": "human", "value": "#!/usr/bin/env python\n\nfrom __future__ import absolute_import\nfrom __future__ import division\nfrom __future__ import print_function\n\nimport argparse\n\nimport rospy\nfrom std_...
python
chosen
[ { "from": "system", "value": "Increase log verbosity on exception\n" }, { "from": "human", "value": "from bs4 import BeautifulSoup\nimport logging\n\nfrom jetcomcrawl import browser\nimport jetcomcrawl.libs.queue\n\n\nclass Worker(object):\n def __init__(self):\n self.queue_categories ...
python
chosen
[ { "from": "system", "value": "Use new API correctly, v2...\n" }, { "from": "human", "value": "#!/usr/bin/python3\n'''\nRun simulations with parameter samples.\n'''\n\nimport model\n\n\ncountries = model.datasheet.get_country_list()\n# Move these to the front.\ncountries_to_plot = ['United States...
python
chosen
[ { "from": "system", "value": "Use the id of the channel and unquote all of the text first.\n" }, { "from": "human", "value": "from flask import Flask, request\nimport requests\nfrom urllib import unquote\n\napp = Flask(__name__)\n\n@app.route(\"/\")\ndef meme():\n domain = request.args[\"team...
python
chosen
[ { "from": "system", "value": "Implement Big Banana, Deviate Banana, Rotten Banana\n" }, { "from": "human", "value": "\"\"\"\nGAME set and other special cards\n\"\"\"\nfrom ..utils import *\n\n\n# The Coin\nclass GAME_005:\n\tplay = ManaThisTurn(CONTROLLER, 1)\n" }, { "from": "gpt", "...
python
chosen
[ { "from": "system", "value": "Allow a default value to be specified when fetching a field value\n" }, { "from": "human", "value": "# Copyright 2019 Google LLC\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may not use this file except in compliance with the Licens...
python
chosen
[ { "from": "system", "value": "Test for no pairs from one particle\n" }, { "from": "human", "value": "from dimuon import find_pairs\n\ndef test_find_pairs():\n particles = None\n pairs = find_pairs(particles)\n\ndef test_no_particles():\n particles = []\n pairs = find_pairs(particles)...
python
chosen
[ { "from": "system", "value": "Add a --target argument and make trailling arguments context dependant\n" }, { "from": "human", "value": "#!/usr/bin/env python2\n# -*- coding: UTF-8 -*-\n\nfrom __future__ import print_function\nfrom __future__ import unicode_literals\n\nimport argparse\n\n\nDEFAUL...
python
chosen
[ { "from": "system", "value": "Fix intermittent failures of test_guard_http_exception\n\nSigned-off-by: Ryan Lerch <e809e25f3c554b2b195ccd768cd9a485288f896f@redhat.com>\n" }, { "from": "human", "value": "import pytest\n\nfrom fmn.rules.cache import cache\n\n\n@pytest.fixture(autouse=True, scope=\...
python
chosen
[ { "from": "system", "value": "Fix version list validation check.\n\n[#152092418]\n" }, { "from": "human", "value": "import subprocess\n\nfrom command import Command\nfrom . import ListVersionsCommand\n\nfrom ..git_tools import git_base_command\n\nclass UpdateSoftwareComman...
python
chosen
[ { "from": "system", "value": "Use simple test functions and remove too special tests\n" }, { "from": "human", "value": "# -*- coding: utf-8 -*-\nimport unittest\nfrom random import randrange\n\nimport short_url\n\n\nclass TestShortUrl(unittest.TestCase):\n\n def test_one(self):\n url =...
python
chosen
[ { "from": "system", "value": "Add test for output that doesn't end in a newline\n" }, { "from": "human", "value": "import functools\nimport os\n\nfrom nose.tools import istest, assert_equal\n\nimport spur\n\ndef test(func):\n @functools.wraps(func)\n def run_test():\n for shell in _...
python
chosen
[ { "from": "system", "value": "Fix serialization of form errors" }, { "from": "human", "value": "import json\n\nfrom django.db import models\n\n\nclass DjangoJSONEncoder(json.JSONEncoder):\n def default(self, obj):\n if isinstance(obj, models.Model) and hasattr(obj, 'as_data'):\n ...
python
chosen
[ { "from": "system", "value": "Fix test on python 3.3\n" }, { "from": "human", "value": "# -*- coding: utf-8 -*-\nfrom __future__ import unicode_literals, absolute_import\n\nfrom django.test import TestCase\n\nfrom tags.models import Tag\n\nfrom .models import Food\n\n\nclass TestFoodModel(TestCa...
python
chosen
[ { "from": "system", "value": "Update pipeline_settings to support Python 3\n" }, { "from": "human", "value": "import contextlib\nimport os\n\nfrom pipeline.conf import settings\n\n\ndef _(path):\n # Make sure the path contains only the correct separator\n return path.replace('/', os.sep).r...
python
chosen
[ { "from": "system", "value": "Split the Python specific version exludes between 2.7/3.4 specific syntax.\n" }, { "from": "human", "value": "from compileall import compile_dir\nfrom distutils.sysconfig import get_python_lib\nimport os\nimport os.path\nimport sys\n\nEXCLUDES = [\n 'gunicorn/wor...
python
chosen
[ { "from": "system", "value": "Upgrade players DB; show progress\n" }, { "from": "human", "value": "#!/usr/bin/python\n\nimport games_mgr as gm_m\nimport openings_book as ol_m\nimport player as p_m\nfrom defines import *\n\nimport pdb\n\nif __name__ == \"__main__\":\n gm = gm_m.GamesMgr()\n ...
python
chosen
[ { "from": "system", "value": "Allow creation of multiple example data files for Inter Python\n\nGeneralizes the script for creating data files to allow for the\neasy generation of larger numbers of data files.\n" }, { "from": "human", "value": "\"\"\"Create the data for the Software Carpentry In...
python
chosen
[ { "from": "human", "value": "Add tests for init and push\n" }, { "from": "gpt", "value": "import pytest\nfrom stack import Element\nfrom stack import Stack\n\n\ndef test_element_init():\n n = Element()\n assert n.val is None\n assert n.next is None\n n = Element(3)\n assert n.val ...
python
chosen
[ { "from": "system", "value": "Use TestCase from Django\nSet STATIC_URL\n" }, { "from": "human", "value": "\nfrom unittest import TestCase\nfrom django.test.utils import setup_test_template_loader, override_settings\nfrom django.template import Context\nfrom django.template.loader import get_temp...
python
chosen
[ { "from": "system", "value": "Use inspect.getdoc() instead of plain __doc__ \n\n" }, { "from": "human", "value": "\"\"\"\nInterface for all launch-control-tool commands\n\"\"\"\nfrom launch_control.utils.registry import RegistryBase\n\nclass Command(RegistryBase):\n \"\"\"\n Base class for...
python
chosen
[ { "from": "system", "value": "Add -Wno-writable-strings to clean up output\n" }, { "from": "human", "value": "#!/usr/bin/env python\nfrom os import listdir\nimport re\n\n#reads in old makefile from folder\n#parses for compiler arguments \n#creates cmake lists file with parsed arguments as parent...
python
chosen
[ { "from": "system", "value": "Disable checking of Front-end IPs\n" }, { "from": "human", "value": "preload_app = True\nworker_class = \"gunicorn.workers.gthread.ThreadWorker\"\n" }, { "from": "gpt", "value": "forwarded_allow_ips = '*'\npreload_app = True\nworker_class = \"gunicorn.wo...
python
chosen
[ { "from": "system", "value": "Change hashing for ParticleFilter python class\n" }, { "from": "human", "value": "import hoomd._hoomd as _hoomd\n\n\nclass ParticleFilterID:\n\n def __init__(self, *args, **kwargs):\n args_str = ''.join([str(arg) for arg in args])\n kwargs_str = ''....
python
chosen
[ { "from": "system", "value": "Drop db before each test\n" }, { "from": "human", "value": "import unittest\nimport os\n\nos.environ['OGN_CONFIG_MODULE'] = 'config/test.py'\n\nfrom ogn_python import db # noqa: E402\n\n\nclass TestBaseDB(unittest.TestCase):\n @classmethod\n def setUpClass(c...
python
chosen
[ { "from": "system", "value": "Use mozillians_username for unicode representation.\n" }, { "from": "human", "value": "from django.contrib.auth.models import AbstractUser\nfrom django.db.models import fields\n\n\nclass User(AbstractUser):\n mozillians_url = fields.URLField()\n mozillians_use...
python
chosen
[ { "from": "system", "value": "Fix bug when inserting user.\n\nScheme of table: User has changed.\n" }, { "from": "human", "value": "#!/usr/bin/python\n\nfrom MySQLdb import Error\nfrom util import connect_db, dump_response_and_exit\n\nimport cgi\nimport hashlib\nimport json\nimport re\nimport sy...
python
chosen
[ { "from": "system", "value": "Include env.system_install PATH as part of version checking to work with installed software not on the global PATH. Thanks to James Cuff\n" }, { "from": "human", "value": "\"\"\"Tool specific version checking to identify out of date dependencies.\n\nThis provides in...
python
chosen
[ { "from": "system", "value": "Use Moose for Perl 5\n" }, { "from": "human", "value": "\"\"\"\\\nPerl code emitter for C'Dent\n\"\"\"\n\nfrom __future__ import absolute_import\n\nfrom cdent.emitter import Emitter as Base\n\nclass Emitter(Base):\n LANGUAGE_ID = 'pm'\n\n def emit_includecdent...
python
chosen
[ { "from": "system", "value": "Support None arguments in chainerx.clip and chainerx.ndarray.clip\n" }, { "from": "human", "value": "import chainerx\n\n\n# TODO(sonots): Implement in C++\ndef clip(a, a_min, a_max):\n \"\"\"Clips the values of an array to a given interval.\n\n Given an interv...
python
chosen
[ { "from": "system", "value": "Update from deprecated features of urlpatterns.\n" }, { "from": "human", "value": "from __future__ import unicode_literals\n\nfrom django.conf.urls import *\n\nurlpatterns = patterns('',\n\n # filebrowser urls\n url(r'^browse/$', 'filebrowser_safe.views.browse...
python
chosen
[ { "from": "system", "value": "Use logging variable instead of hard coded string to set logging level.\n" }, { "from": "human", "value": "#\n# Copyright (c) 2014 ThoughtWorks, Inc.\n#\n# Pixelated is free software: you can redistribute it and/or modify\n# it under the terms of the GNU Affero Gene...
python
chosen
[ { "from": "system", "value": "Add PYTEST_MD_REPORT_COLOR environment variable setting\n" }, { "from": "human", "value": "#!/usr/bin/env python3\n\n\"\"\"\nUnit tests at Windows environments required to invoke from py module,\nbecause of multiprocessing:\nhttps://py.rtfd.io/en/latest/faq.html?hig...
python
chosen
[ { "from": "system", "value": "Remove leftover from deleted examples\n" }, { "from": "human", "value": "from nose.tools import *\nfrom openpassword import EncryptionKey\nfrom openpassword import Keychain\nfrom openpassword.exceptions import InvalidPasswordException\n\nimport fudge\nimport time\n\...
python
chosen
[ { "from": "system", "value": "Add the about page to url.py\n" }, { "from": "human", "value": "from django.conf.urls import patterns, url\nfrom django.views.generic import TemplateView\n\nfrom studentvoice import views\n\nurlpatterns = patterns('',\n url(r'^$', views.home, name='home'),\n u...
python
chosen
[ { "from": "system", "value": "Fix preview still being slightly different.\n" }, { "from": "human", "value": "from django.urls import path\n\nfrom . import views\n\napp_name = \"utilities\"\n\nurlpatterns = [\n path('md_preview/', views.MarkdownPreview.as_view(), name='preview'),\n path('md...
python
chosen
[ { "from": "system", "value": "Update default CONDA_NPY to 18\n" }, { "from": "human", "value": "from __future__ import print_function, division, absolute_import\n\nimport os\nimport sys\nfrom os.path import abspath, expanduser, join\n\nimport conda.config as cc\n\n\nCONDA_PY = int(os.getenv('CON...
python
chosen
[ { "from": "system", "value": "Add search method for python linked list implementation\n" }, { "from": "human", "value": "# LINKED LIST\n\n# define constructor\nclass Node(object):\n\tdef __init__(self, data):\n\t\tself.data = data\n\t\tself.next = None\n\nclass LinkedList(object):\n\tdef __init_...
python
chosen
[ { "from": "system", "value": "Handle error in get diff stats\n" }, { "from": "human", "value": "from __future__ import absolute_import\nfrom __future__ import print_function\nfrom __future__ import unicode_literals\n\nfrom operator import attrgetter\n\nfrom django.core.management.base import Bas...
python
chosen
[ { "from": "system", "value": "Fix to work correctly if we are already in the directory of the lcad file.\n" }, { "from": "human", "value": "#!/usr/bin/env python\n\"\"\"\n.. module:: lcad_to_ldraw\n :synopsis: Generates a ldraw format file from a lcad model.\n\n.. moduleauthor:: Hazen Babcock\...
python
chosen
[ { "from": "system", "value": "Fix a typo in the example.\n" }, { "from": "human", "value": "from pprint import pprint\n\nfrom libcloud.compute.types import Provider\nfrom libcloud.compute.providers import get_driver\n\nPROXY_URL = 'http://<proxy hostname>:<proxy port>'\n\ncls = get_driver(Provid...
python
chosen
[ { "from": "system", "value": "Reduce picture loop to 15 pictures\n" }, { "from": "human", "value": "import picamera as p\nimport os\nimport time\n\nos.chdir('/home/pi/Desktop')\n\ncam = p.PiCamera()\ncam.resolution = (320,240)\ncam.hflip = True\ncam.vflip = True\n\nx = 0\n\nwhile x < 50:\n\tos.u...
python
chosen
[ { "from": "system", "value": "Make plugin loader more robust\n" }, { "from": "human", "value": "class PluginLoader:\n\n def load(self, directory):\n ret = []\n\n for plugin in directory.children:\n plugin_file = plugin.find(name=plugin.name, type='py')\n \n ...
python
chosen
[ { "from": "system", "value": "Add many todos and basic version download\n" }, { "from": "human", "value": "import sys\n\ndef main():\n if \"-install\" in sys.argv:\n print(\"Installing everything\")\n elif \"-installapi\" in sys.argv:\n print(\"Installing API backend only\")\...
python
chosen
[ { "from": "system", "value": "Clean up sitemap URL handling.\n" }, { "from": "human", "value": "\nfrom django.contrib.sitemaps import Sitemap\nfrom django.db.models import get_models\n\nfrom mezzanine.core.models import Displayable\n\n\nclass DisplayableSitemap(Sitemap):\n \"\"\"\n Sitemap...
python
chosen
[ { "from": "system", "value": "Add BTC to possible currencies\n" }, { "from": "human", "value": "# -*- coding: utf-8 -*-\n# Copyright 2017 GIG Technology NV\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may not use this file except in compliance with the License.\...
python
chosen
[ { "from": "system", "value": "Test that deprecation exceptions are working differently, after\nsuggestion by @embray\n" }, { "from": "human", "value": "# Licensed under a 3-clause BSD style license - see LICENSE.rst\nfrom __future__ import (absolute_import, division, print_function,\n ...
python
chosen
[ { "from": "system", "value": "Include status information in abuse.ch's Feodo C&C feed\n" }, { "from": "human", "value": "\"\"\"\nabuse.ch Feodo RSS feed bot.\n\nMaintainer: AbuseSA team <contact@abusesa.com>\n\"\"\"\n\nfrom abusehelper.core import bot\n\nfrom . import host_or_ip, split_descripti...
python
chosen
[ { "from": "system", "value": "Add some tests for the URL resolver\n" }, { "from": "human", "value": "#!/usr/bin/env python\n# -*- encoding: utf-8\n\"\"\"\nThese are tests of the external behaviour -- feature tests, if you like.\nThey run the compiled binaries, and make assertions about the retur...
python
chosen
[ { "from": "system", "value": "Use ValueError for wrong input in 5\n" }, { "from": "human", "value": "from math import gcd\n\n\ndef solve(number: int=20) -> str:\n if number <= 0:\n raise TypeError\n\n lcd = 1\n\n for i in range(1, number + 1):\n lcd = (lcd * i) // gcd(lcd,...
python
chosen
[ { "from": "system", "value": "Add utility function to write pvs to file\n" }, { "from": "human", "value": "# Function to return a list of pvs from a given file\n\nimport pkg_resources\npkg_resources.require('aphla')\nimport aphla as ap\n\ndef get_pv_names(mode):\n ''' Given a certain ring mod...
python
chosen
[ { "from": "system", "value": "Allow worker to use APP_SETTINGS_YAML correctly.\n" }, { "from": "human", "value": "import os\n\nfrom functools import partial\n\nimport click\n\nfrom flask import Flask\n\nfrom dadd import server\n\napp = Flask(__name__)\napp.config.from_object('dadd.worker.setting...
python
chosen
[ { "from": "system", "value": "Add util for generating named image file\n" }, { "from": "human", "value": "import os\n\nfrom django.core.files.base import ContentFile\n\nfrom imagekit.lib import Image, StringIO\nfrom .models import Photo\nimport pickle\n\n\ndef get_image_file():\n \"\"\"\n ...
python
chosen
[ { "from": "system", "value": "Add second author for testing purposes\n" }, { "from": "human", "value": "from elsapy import *\n\nconFile = open(\"config.json\")\n\nconfig = json.load(conFile)\n\nmyCl = elsClient(config['apikey'])\n\nmyAuth = elsAuthor('http://api.elsevier.com/content/author/AUTHO...
python
chosen
[ { "from": "system", "value": "Add `public` keyword to render_organizer_list\n" }, { "from": "human", "value": "\"\"\"\nTemplate tags for the organize app, loosely based on django.contrib.comments.\n\n\"\"\"\nfrom django import template\n\nfrom livinglots import get_organizer_model\nfrom livinglo...
python
chosen
[ { "from": "system", "value": "Add child(); TODO: test this\n" }, { "from": "human", "value": "\nclass DataModelAdapter(object) :\n\n def __init__(self, data) :\n self._data = data\n self._children = set()\n self._parent = None\n pass\n\n def numChildren(self) :\...
python
chosen
[ { "from": "system", "value": "Exclude the play script test case from the default test suite.\n" }, { "from": "human", "value": "#!/usr/bin/env python\n#\n# Copyright 2011, Toru Maesaka\n#\n# Redistribution and use of this source code is licensed under\n# the BSD license. See COPYING file for lic...
python
chosen
[ { "from": "system", "value": "Remove trans app label on opps init\n" }, { "from": "human", "value": "#!/usr/bin/env python\n# -*- coding: utf-8 -*-\nimport pkg_resources\n\npkg_resources.declare_namespace(__name__)\ntrans_app_label = _('Opps')\n\nVERSION = (0, 1, 4)\n\n__version__ = \".\".join(m...
python
chosen
[ { "from": "system", "value": "Support creating Hive tables with partitioned data.\n\nPiperOrigin-RevId: 335539022\n" }, { "from": "human", "value": "# Lint as: python2, python3\n\"\"\"A PySpark driver that creates Spark tables for Spark SQL benchmark.\n\nIt takes an HCFS directory and a list of ...
python
chosen
[ { "from": "system", "value": "Make inbetween tag releases 'dev', not 'post'.\n" }, { "from": "human", "value": "#!/usr/bin/env python\n# Source: https://github.com/Changaco/version.py\n\nfrom os.path import dirname, isdir, join\nimport re\nfrom subprocess import CalledProcessError, check_output\...
python
chosen
[ { "from": "system", "value": "Switch to using base64 builtin decoder for simplicity.\n" }, { "from": "human", "value": "from matasano.util.converters import base64_to_bytes\nfrom Crypto.Cipher import AES\nimport base64\n\nif __name__ == \"__main__\":\n\n chal_file = open(\"matasano/data/c7.tx...
python
chosen
[ { "from": "system", "value": "Fix mdk runtime to encode/decode file contents\n" }, { "from": "human", "value": "import os\nimport tempfile\n\n\"\"\"\nTODO: This is all semi-broken since in Python quark.String is not Unicode\nall the time.\n\"\"\"\n\n__all__ = [\"_mdk_mktempdir\", \"_mdk_writefil...
python
chosen
[ { "from": "system", "value": "Change datetime property to date\n" }, { "from": "human", "value": "# coding: utf-8\n\nfrom __future__ import absolute_import\n\nfrom google.appengine.ext import ndb\n\nfrom api import fields\nimport config\nimport model\nimport util\n\nclass Pay(model.Base):\n nam...
python
chosen
[ { "from": "system", "value": "Revert \"fixed rendering of Sass and Coffee\"\n\nThis reverts commit b21834c9d439603f666d17aea338934bae063ef4.\n" }, { "from": "human", "value": "from os.path import join, splitext, basename\nfrom bricks.staticfiles import StaticCss, StaticJs, StaticFile\n\nclass _B...
python
chosen
[ { "from": "system", "value": "Add a representation of GraphView object\n" }, { "from": "human", "value": "from octopus.dispatcher.model import TaskNode, FolderNode, TaskGroup\nfrom octopus.dispatcher import rules\nimport logging\n\n\nlogger = logging.getLogger(\"dispatcher\")\n\n\nclass RuleErro...
python
chosen
[ { "from": "system", "value": "Add load and unload commands.\n" }, { "from": "human", "value": "import inspect\nimport traceback\n\nfrom curious import commands\nfrom curious.commands.context import Context\nfrom curious.commands.plugin import Plugin\n\n\nclass Owner(Plugin):\n \"\"\"\n Own...
python
chosen
[ { "from": "system", "value": "Fix a small rebase error, my bad.\n" }, { "from": "human", "value": "# -*- coding: utf-8 -*-\nfrom __future__ import absolute_import, print_function, unicode_literals, division\n\nfrom sc2reader.engine.plugins.apm import APMTracker\nfrom sc2reader.engine.plugins.sel...
python
chosen
[ { "from": "system", "value": "Update name of institution search URL route\n" }, { "from": "human", "value": "from django.conf.urls import url\n\nfrom api.search import views\n\nurlpatterns = [\n url(r'^$', views.Search.as_view(), name=views.Search.view_name),\n url(r'^components/$', views....
python
chosen
[ { "from": "system", "value": "Rewrite to avoid capitalization issues\n" }, { "from": "human", "value": "import binascii\nimport os\n\nimport pytest\n\nfrom cryptography.bindings import _ALL_APIS\nfrom cryptography.primitives.block import BlockCipher\n\n\ndef generate_encrypt_test(param_loader, p...
python
chosen
[ { "from": "system", "value": "Test iter_zones instead of get_zones\n" }, { "from": "human", "value": "import os\nfrom unittest import TestCase\n\nfrom yoconfigurator.base import read_config\nfrom yoconfig import configure_services\n\nfrom pycloudflare.services import CloudFlareService\n\napp_dir...
python
chosen
[ { "from": "system", "value": "Replace abort() with fail() again\n" }, { "from": "human", "value": "\n# EXTRACT NODE INFO PY\n\nimport argparse, os, pickle, sys\n\nfrom Node import Node\nfrom utils import abort\n\nparser = argparse.ArgumentParser(description='Parse all log files')\nparser.add_arg...
python
chosen
[ { "from": "system", "value": "Install in correct virtual environment in test server\n" }, { "from": "human", "value": "# -*- coding: utf-8 -*-\n\n# http://docs.fabfile.org/en/1.5/tutorial.html\n\nfrom fabric.api import *\nfrom fabric.network import ssh\n\nproject = \"gastosabertos\"\n\nenv.user ...
python
chosen
[ { "from": "system", "value": "Save LVF before LADL in CSV to be similar to website\n" }, { "from": "human", "value": "import csv\nfrom os import path\nfrom distutils.version import LooseVersion\n\n\nfrom django.core.management.base import BaseCommand\nfrom django.conf import settings\n\nfrom syn...
python
chosen
[ { "from": "system", "value": "Add setUp and tearDown of a test bucket\n" }, { "from": "human", "value": "import unittest\nfrom bucketeer import commit\n\nclass BuckeeterTest(unittest.TestCase):\n\n def setUp(self):\n # 1 bucket with 1 file\n return\n \n def tearDown(self):\n # Remo...
python
chosen
[ { "from": "system", "value": "Make email and name order fit to the default django settings file\n" }, { "from": "human", "value": "\nfrom django import forms\nfrom django.conf import settings\nfrom django.template import loader\nfrom django.core.mail import send_mail\n\nclass BaseEmailFormMixin(...
python
chosen
[ { "from": "system", "value": "Drop inline omex if it fails.\n" }, { "from": "human", "value": "\nfrom __future__ import absolute_import\n\n# converts Antimony to/from SBML\nfrom .convert_antimony import antimonyConverter\n\nfrom .convert_omex import inlineOmexImporter, OmexFormatDetector\n\ntry:...
python
chosen
[ { "from": "system", "value": "Add unit test for CanteraCondition that tests that the repr() function works\n" }, { "from": "human", "value": "import unittest\nimport os\nimport numpy\nfrom rmgpy.tools.canteraModel import *\n\nclass CanteraTest(unittest.TestCase):\n\n def testIgnitionDelay(sel...
python
chosen
[ { "from": "system", "value": "Update python driver version to 1.4.0-1\n" }, { "from": "human", "value": "# Copyright 2010-2012 RethinkDB, all rights reserved.\nfrom setuptools import setup\n\nsetup(name=\"rethinkdb\"\n ,version=\"1.4.0-0\"\n ,description=\"This package provides the Pytho...
python
chosen
[ { "from": "system", "value": "Update RLDS to 0.1.5 (already uploaded to Pypi)\n\nPiperOrigin-RevId: 467605984\nChange-Id: I421e884c38da5be935e085d5419642b8decf5373\n" }, { "from": "human", "value": "# Copyright 2022 Google LLC.\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\...
python
chosen
[ { "from": "system", "value": "Use stronger password in reset password test\n" }, { "from": "human", "value": "import pytest\n\nfrom radar.validation.reset_password import ResetPasswordValidation\nfrom radar.validation.core import ValidationError\nfrom radar.tests.validation.helpers import valida...
python
chosen
[ { "from": "system", "value": "Allow conversion from Julian to ProlepticGregorian, also comparison of dates.\n" }, { "from": "human", "value": "from datetime import date\n\nclass DateWithCalendar(object):\n def __init__(self, calendar_class, date):\n self.calendar = calendar_class\n ...
python
chosen
[ { "from": "system", "value": "Add plugin count ip using mongo aggregation framework\n" }, { "from": "human", "value": "#!/usr/bin/env python\n# -*- coding:utf-8 -*-\n\nimport sys\nsys.path.insert(0, \"..\")\n\nfrom libs.manager import Plugin\n\nclass CountIPNew(Plugin):\n\n def __init__(self,...
python
chosen