conversations
listlengths
2
3
source
stringclasses
1 value
stack
stringclasses
1 value
[ { "from": "system", "value": "Bump version to push homepage fix and readme comments\n" }, { "from": "human", "value": "from distutils.core import setup\n\nsetup(name='sspps',\n version='0.1.1',\n description='Super Simple Python Plugin Sytem',\n author='Gregory Haynes',\n author_emai...
python
chosen
[ { "from": "system", "value": "Add logbook 0.6.0 as a dependency\n" }, { "from": "human", "value": "#!/usr/bin/env python2\n\nimport os\nimport sys\n\ntry:\n from setuptools import setup\nexcept ImportError:\n from distutils.core import setup\n\nif sys.argv[-1] == 'publish':\n os.system(...
python
chosen
[ { "from": "system", "value": "Split __init__.py into separate files.\n" }, { "from": "human", "value": "import os\nfrom setuptools import setup\n\nsetup(\n name = \"prometheus_client\",\n version = \"0.0.9\",\n author = \"Brian Brazil\",\n author_email = \"brian.brazil@gmail.com\",\n...
python
chosen
[ { "from": "system", "value": "Remove old method of adding datafiles.\n" }, { "from": "human", "value": "#!/usr/bin/env python\n# -*- coding: utf8 -*-\n\nfrom setuptools import setup\n\nsetup(name='pynxc',\n version='0.1.7',\n description='A Python to NXC Converter for programming '\n ...
python
chosen
[ { "from": "system", "value": "Add a Python 3 classifier recommended by community\n" }, { "from": "human", "value": "#\n# This is the regobj setuptools script.\n# Originally developed by Ryan Kelly, 2009.\n#\n# This script is placed in the public domain.\n#\n\nfrom distutils.core import setup\...
python
chosen
[ { "from": "system", "value": "Change trove classifier; 'BSD' was invalid\n\nList of available is here:\n\n https://pypi.python.org/pypi?:action=list_classifiers\n" }, { "from": "human", "value": "#!/usr/bin/env python\nfrom distribute_setup import use_setuptools\nuse_setuptools()\n\nfrom setupt...
python
chosen
[ { "from": "system", "value": "Remove beautifulsoup4 and lxml as dependencies.\n" }, { "from": "human", "value": "from setuptools import setup\n\nsetup(\n name='gethazel',\n version='0.1.0',\n description='A balanced life is a good life.',\n author='Reilly Tucker Siemens',\n author...
python
chosen
[ { "from": "system", "value": "Add a dependency that got dropped.\n" }, { "from": "human", "value": "\"\"\"Setup data for aib2ofx.\"\"\"\n\nfrom setuptools import setup\n\nsetup(\n name='aib2ofx',\n description='Download data from aib.ie in OFX format',\n version='0.6',\n author='Jaku...
python
chosen
[ { "from": "system", "value": "Add view to show log of a channel on a day\n" }, { "from": "human", "value": "from django.http import HttpResponse\n\ndef index(request):\n return HttpResponse('index')\n\ndef channel(request, name):\n return HttpResponse('channel: %s' % name)\n\ndef show(requ...
python
chosen
[ { "from": "system", "value": "Upgrade VERSION to 0.12.9 final" }, { "from": "human", "value": "\"\"\"\nCAUTION! Keep everything here at at minimum. Do not import stuff.\nThis module is imported in setup.py, so you cannot for instance\nimport a dependency.\n\"\"\"\nfrom __future__ import absolute...
python
chosen
[ { "from": "system", "value": "[vacation-gardening] Change method _compute_runtime_use_sanitizer => property _runtime_sanitizer_flags. NFC.\n" }, { "from": "human", "value": "# swift_build_support/products/swift.py -------------------------*- python -*-\n#\n# This source file is part of the Swift...
python
chosen
[ { "from": "system", "value": "Check existence of the user with appropriate email address\n" }, { "from": "human", "value": "from django.core.management.base import BaseCommand\n\nfrom utils.create_random_data import create_items, create_users, create_orders\n\nfrom saleor.userprofile.models impo...
python
chosen
[ { "from": "system", "value": "Bump version 0.20.0rc8 --> 0.20.0rc9\n\nSigned-off-by: Jack Robison <40884020c67726395ea162083a125620dc32cdab@lbry.io>\n" }, { "from": "human", "value": "import logging\n\n__version__ = \"0.20.0rc8\"\nversion = tuple(__version__.split('.'))\n\nlogging.getLogger(__na...
python
chosen
[ { "from": "system", "value": "Fix problems using Lexicons in deepcopy'd objects.\n\nSaid problems actually only manifest as 'ignored'\nRuntimeErrors, but those are really annoying and hard\nto hide. This seems to be the right fix.\n" }, { "from": "human", "value": "from attribute_dict import Att...
python
chosen
[ { "from": "system", "value": "Modify networking resource driver interface according to the latest networking standard\n" }, { "from": "human", "value": "from abc import ABCMeta\nfrom abc import abstractmethod\n\n\nclass NetworkingResourceDriverInterface(object):\n __metaclass__ = ABCMeta\n\n ...
python
chosen
[ { "from": "system", "value": "Set a JWT signature algorithm for the Globus backend to RS512\n" }, { "from": "human", "value": "\"\"\"\nGlobus Auth OpenID Connect backend, docs at:\n https://docs.globus.org/api/auth\n http://globus-integration-examples.readthedocs.io\n\"\"\"\n\nfrom social_...
python
chosen
[ { "from": "system", "value": "Revert the latest changes due to CI build failure\n" }, { "from": "human", "value": "from ..constants import FORMAT_CHECKS\nfrom ..post import HEADER_OPTIONAL_FIELD_TYPES, HEADER_REQUIRED_FIELD_TYPES\nfrom ..postprocessor import KnowledgePostProcessor\n\n\nclass For...
python
chosen
[ { "from": "system", "value": "Drop python2-era manual encode dance\n" }, { "from": "human", "value": "import sys\nimport csv\n\nfrom django.core.management.base import BaseCommand\n\nfrom django.contrib.auth import get_user_model\nfrom wafer.talks.models import Talk, ACCEPTED, PROVISIONAL\n\n\nc...
python
chosen
[ { "from": "system", "value": "Fix a premature import when patching SQLite compatibility.\n\nWe provide a compatibility patch that fixes certain versions of SQLite\nwith Django prior to 2.1.5.\n\nThis patch made the assumption that it could import the Django SQLite\nbackend at the module level, since SQLite ...
python
chosen
[ { "from": "system", "value": "Add FIXME in product import in producer module\n" }, { "from": "human", "value": "from datetime import datetime\n\nfrom django.db import models\nfrom django.db.models import Sum, signals\nfrom django.utils.translation import ugettext_lazy as _\n\nfrom plata.product....
python
chosen
[ { "from": "system", "value": "Rename isAlive method to is_alive\n\nPython 3.9 compatibility fix\n" }, { "from": "human", "value": "import threading\n\nfrom . import pypofetch\n\n\ndef __timeout(func, timeout_duration, default, args, kwargs):\n class InterruptableThread(threading.Thread):\n ...
python
chosen
[ { "from": "system", "value": "Change from hg to git.\n" }, { "from": "human", "value": "import functools\nimport subprocess\nimport django\nimport platform\nfrom django.conf import settings\nfrom django.contrib.sites.models import get_current_site\n\n\ndef system_info(request):\n return {\n ...
python
chosen
[ { "from": "system", "value": "Disable init view for now, add extra url for specific quotes page\n" }, { "from": "human", "value": "from django.conf.urls.defaults import patterns, include, url\n\nurlpatterns = patterns('',\n # Examples:\n # url(r'^$', 'qi.views.home', name='home'),\n # u...
python
chosen
[ { "from": "system", "value": "Update 1.0 release with latest version of pid sequence migration\n" }, { "from": "human", "value": "# -*- coding: utf-8 -*-\nfrom __future__ import unicode_literals\n\nfrom django.db import migrations, models\nfrom pidman.pid.noid import decode_noid\nfrom pidman.pid...
python
chosen
[ { "from": "system", "value": "Tweak migration to apply quickly\n" }, { "from": "human", "value": "# -*- coding: utf-8 -*-\nfrom __future__ import unicode_literals\n\nfrom django.db import migrations, models\n\n\nclass Migration(migrations.Migration):\n\n dependencies = [\n ('msgs', '00...
python
chosen
[ { "from": "system", "value": "Improve content listing plugin's admin form\n\n- show natural key of content types in select field to disambiguate\n the SELECT field listing in the admin\n- add `filter_content_types` method to form to simplify filtering the\n selectable content types in derived plugins.\n" ...
python
chosen
[ { "from": "system", "value": "Remove unnecessary and problematic parent class from SuccessMessageMixin\n\nrefs #16319, thanks to bmispelon for the catch" }, { "from": "human", "value": "from django.views.generic.edit import FormMixin\nfrom django.contrib import messages\n\n\nclass SuccessMessage...
python
chosen
[ { "from": "system", "value": "Revert \"Trade memory for time.\"\n\nThis reverts commit f4c13756eef0dc6b7231e37d5f5d9029dea1fb62.\n" }, { "from": "human", "value": "\"\"\"\nDerive a list of impossible differentials.\n\"\"\"\n\nimport ast\nimport sys\n\ndef parse(line):\n return ast.literal_eva...
python
chosen
[ { "from": "system", "value": "blog/en-2014-03-23: Use '!=' instead of '>' when checking for mtime changes.\n\nThe use of '!=' ensures that the reloading works even when the new mtime is\nlower than the current mtime (e.g. when we use a backed-up version of a file).\n\nThanks to Ronald for pointing this out\...
python
chosen
[ { "from": "system", "value": "Allow chaining of Product's custom querysets\n\nThis aligns the implementation of Oscar specific QuerySet Methods with\nthe implementation in current django core[1].\nWhile this is not DRY, it does deliver on chainability and can be seen\nas preparation to take advantage of the...
python
chosen
[ { "from": "system", "value": "Add test for comment api\n" }, { "from": "human", "value": "import unittest\nfrom mock import Mock\nimport sys\nimport os\n\nfrom pytrac import Ticket\n\n\nclass TestTicket(unittest.TestCase):\n\n def setUp(self):\n server = Mock()\n self.ticket = T...
python
chosen
[ { "from": "system", "value": "Add new field to Processor\n" }, { "from": "human", "value": "from waldur_mastermind.marketplace import processors\nfrom waldur_rancher import views as rancher_views\n\n\nclass RancherCreateProcessor(processors.BaseCreateResourceProcessor):\n viewset = rancher_vi...
python
chosen
[ { "from": "system", "value": "Move docstring to appropriately placed comment\n" }, { "from": "human", "value": "import textwrap\n\n\ndef test_environ(script, tmpdir):\n \"\"\"$PYTHONWARNINGS was added in python2.7\"\"\"\n demo = tmpdir.joinpath('warnings_demo.py')\n demo.write_text(text...
python
chosen
[ { "from": "system", "value": "Fix zero_out test for 2.0\n" }, { "from": "human", "value": "# Copyright 2018 The Sonnet Authors. All Rights Reserved.\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may not use this file except in compliance with the License.\n# You ...
python
chosen
[ { "from": "system", "value": "Fix auth API usage (this is why we wait for CI)\n" }, { "from": "human", "value": "import json\n\nfrom zeus import auth\nfrom zeus.api import client\nfrom zeus.exceptions import ApiError\nfrom zeus.models import Email, Identity\n\nfrom .base import Resource\nfrom .....
python
chosen
[ { "from": "system", "value": "Use True instead of 1\n" }, { "from": "human", "value": "import urwid\n\nclass SelectableText(urwid.Text):\n def selectable(self):\n return 1\n\n def keypress(self, size, key):\n return key\n" }, { "from": "gpt", "value": "import urwi...
python
chosen
[ { "from": "system", "value": "Fix query extractor UTF-8 handling" }, { "from": "human", "value": "#!/usr/bin/env python\n\"\"\"\nScript to extract and then generate random queries for fuzzy searching.\n\nUsage:\n ./extract-random-queries.py <infile> <outfile>\n\"\"\"\n\nimport os\nfrom random...
python
chosen
[ { "from": "system", "value": "Add comment for full url with non guest user\n" }, { "from": "human", "value": "# coding=utf-8\n\n#\n# Must be called in roche root dir\n#\n\nimport os\n\n\nfrom os import walk\nfrom eulexistdb.db import ExistDB\n\n#\n# Timeout higher?\n#\nxmldb = ExistDB('http://54...
python
chosen
[ { "from": "system", "value": "Remove data migration from migration file\n" }, { "from": "human", "value": "# -*- coding: utf-8 -*-\n# Generated by Django 1.11.23 on 2019-09-06 20:08\nfrom __future__ import unicode_literals\n\nfrom django.db import migrations\n\nfrom corehq.apps.es.aggregations i...
python
chosen
[ { "from": "system", "value": "Add mode switch to res.company\n" }, { "from": "human", "value": "# -*- coding: utf-8 -*-\n\n##############################################################################\n#\n# Set minimum order on suppliers\n# Copyright (C) 2016 OpusVL (<http://opusvl.com/>)\n#\n#...
python
chosen
[ { "from": "system", "value": "Comment on the create index revision\n" }, { "from": "human", "value": "def up(cursor, context):\n cursor.execute(\"CREATE INDEX ON \\\"user\\\"(points)\")\n" }, { "from": "gpt", "value": "def up(cursor, context):\n # the index on user(points) cach...
python
chosen
[ { "from": "system", "value": "Disable mongo server for now\n" }, { "from": "human", "value": "#!/usr/bin/python\n\n# imports\nfrom pprint import pprint\nimport urllib2\nimport socket\nimport sys\n#import re\nfrom bs4 import BeautifulSoup\nfrom pymongo import MongoClient\n\n# read the html conten...
python
chosen
[ { "from": "system", "value": "Change the subject url from /quip/subjects to /quip/subject.\n" }, { "from": "human", "value": "#!/usr/bin/env python\nimport importlib\nimport mongoengine\nfrom eve import Eve\nfrom eve_mongoengine import EveMongoengine\nfrom qiprofile_rest import models\n\n# The a...
python
chosen
[ { "from": "system", "value": "Update pid sequence so it will work even if sequence already exists\n" }, { "from": "human", "value": "# -*- coding: utf-8 -*-\nfrom __future__ import unicode_literals\n\nfrom django.db import migrations, models\nfrom pidman.pid.noid import decode_noid\nfrom pidman....
python
chosen
[ { "from": "system", "value": "Remove call to run management commands that we didn't use during migration\n" }, { "from": "human", "value": "# -*- coding: utf-8 -*-\n# Generated by Django 1.11.28 on 2020-10-26 18:43\nfrom __future__ import unicode_literals\n\nfrom django.db import migrations, mod...
python
chosen
[ { "from": "system", "value": "Add header id extension for github preferences\n" }, { "from": "human", "value": "import re\n\nfrom bs4 import BeautifulSoup\nfrom django import template\nfrom django.template.defaultfilters import stringfilter\nfrom markdown import markdown as md\n\nregister = temp...
python
chosen
[ { "from": "system", "value": "Add option to overwrite existing thumbnails.\n" }, { "from": "human", "value": "from django.core.management.base import BaseCommand\n\nfrom gallery import models\nfrom gallery.tasks import create_thumbnail\n\n\nclass Command(BaseCommand):\n help = 'Generates thum...
python
chosen
[ { "from": "system", "value": "Remove hardcoded name of TestCase.\n" }, { "from": "human", "value": "#!/usr/bin/env python\n# -*- coding: utf-8 -*-\n\n\"\"\"\ntest_{{ project.repo_name }}\n------------\n\nTests for `{{ project.repo_name }}` module.\n\"\"\"\n\nimport os\nimport shutil\nimport unit...
python
chosen
[ { "from": "system", "value": "Update bioguide importer to scrape data from bioguide.congress.gov\n" }, { "from": "human", "value": "import csv\nimport sys\n\nfrom django.core.management.base import BaseCommand, CommandError\n\nfrom bioguide.models import Legislator\n\nimport name_tools\n\nclass ...
python
chosen
[ { "from": "system", "value": "Print full URL for admin edit link\n" }, { "from": "human", "value": "from django.core.management.base import NoArgsCommand\nfrom django.core.urlresolvers import reverse\n\nimport requests\n\nfrom deflect.models import ShortURL\n\n\nclass Command(NoArgsCommand):\n ...
python
chosen
[ { "from": "system", "value": "Fix RTD build for missing Django dependency.\n" }, { "from": "human", "value": "import django\n\n__version__ = \"2.4.0\"\n\nif django.VERSION < (3, 2):\n default_app_config = \"channels.apps.ChannelsConfig\"\nDEFAULT_CHANNEL_LAYER = \"default\"\n" }, { "f...
python
chosen
[ { "from": "system", "value": "Add simple endpoint for form submission\n" }, { "from": "human", "value": "import flask\nimport config\n\napp = flask.Flask(__name__)\n\n\n@app.route('/')\ndef index():\n return flask.render_template('dashboard.html')\n\n\n@app.route('/new')\ndef new():\n retu...
python
chosen
[ { "from": "system", "value": "Add scrub_row() to pre-process all fields in incoming csv row\n" }, { "from": "human", "value": "import csv\nimport re\n\n\ndef read_csv(path):\n with open(path, 'rU') as data:\n reader = csv.DictReader(data)\n for row in reader:\n yield ...
python
chosen
[ { "from": "system", "value": "Add functional test to test the home page\n" }, { "from": "human", "value": "import unittest\nfrom selenium import webdriver\n\nclass HomePageRecipeTests(unittest.TestCase):\n def setUp(self):\n self.browser = webdriver.Firefox()\n\n def tearDown(self):...
python
chosen
[ { "from": "system", "value": "Use kwargs to fix Plugin2 BS configure ordering\n" }, { "from": "human", "value": "from __future__ import absolute_import\n\nfrom django.core.urlresolvers import reverse\nfrom django.http import HttpResponse\n\nfrom sentry.plugins import plugins\nfrom sentry.web.fro...
python
chosen
[ { "from": "system", "value": "Remove has_key to ensure python3 compatibility\n" }, { "from": "human", "value": "import json\n\nclass StringReprJSONEncoder(json.JSONEncoder):\n def default(self, o):\n try:\n return repr(o)\n except:\n return '[unserializable...
python
chosen
[ { "from": "system", "value": "[REF] openacademy: Add domain or and ilike\n" }, { "from": "human", "value": "from openerp import fields, models\n\n\nclass Session(models.Model):\n _name = 'openacademy.session'\n\n name = fields.Char(required=True)\n start_date = fields.Date()\n durati...
python
chosen
[ { "from": "system", "value": "Reformat code to PEP-8 standards\n" }, { "from": "human", "value": "#\n# Copyright 2014-2015 Boundary, Inc.\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may not use this file except in compliance with the License.\n# You may obtain ...
python
chosen
[ { "from": "system", "value": "Add beginning and end args to GetGames\n" }, { "from": "human", "value": "\nimport logging\n\nfrom version import __version__\n\nlogger = logging.getLogger(__name__)\nlogger.debug('Loading %s ver %s' % (__name__, __version__))\n\n\n# Actions represents the available...
python
chosen
[ { "from": "system", "value": "Use OS-agnostic path joining operations\n" }, { "from": "human", "value": "import yaml\nimport os, os.path\nloc = os.path.dirname(os.path.abspath(__file__))\n\nhosts = yaml.load(open(loc+'/hosts.yml'))\nprojects = yaml.load(open(loc+'/projects.yml'))\nallocations = ...
python
chosen
[ { "from": "system", "value": "Move configuration details to docs\n" }, { "from": "human", "value": "\"\"\"\nhomeassistant.components.device_tracker.owntracks\n~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\n\nOwnTracks platform for the device tracker.\n\ndevice_tracker:\n platform: owntracks...
python
chosen
[ { "from": "system", "value": "Add a note explaining salt/ext\n" }, { "from": "human", "value": "# coding: utf-8 -*-\n" }, { "from": "gpt", "value": "# coding: utf-8 -*-\n'''\nThis directory contains external modules shipping with Salt. They are governed\nunder their respective licens...
python
chosen
[ { "from": "system", "value": "Move over tweaks to munge-phdr script from chromium repo\n\nSome cosmetic changes were made on the chromium side since we copied it.\nCatch up to those, still preparing to remove the chromium copy ASAP.\n\nBUG= none\nTEST= trybots\n\nR=bradchen@google.com\n\nReview URL: http://...
python
chosen
[ { "from": "system", "value": "Use C ordering for npy format\n\nThis appears to save and and load files correctly, but when\nloading, it prints this message:\n\nWarning, array does not have Fortran order,\nmaking deep copy and fixing...\n...done.\n\nI'm looking into this...\n\nSigned-off-by: Patrick Avery <7...
python
chosen
[ { "from": "system", "value": "Change direct_to_template view to TemplateView.as_view()\n\nRequired for Django 1.5 compatibility during tests\n" }, { "from": "human", "value": "from django.conf.urls.defaults import patterns, url\n\nurlpatterns = patterns('django.views.generic.simple',\n url(r'...
python
chosen
[ { "from": "system", "value": "Update schoalrsbank to grab second description if there are two\n" }, { "from": "human", "value": "\"\"\"\nHarvester for Scholars Bank University of Oregon for the SHARE project\n\nExample API call: http://scholarsbank.uoregon.edu/oai/request?verb=ListRecords&metada...
python
chosen
[ { "from": "system", "value": "Add active column to person csv export\n" }, { "from": "human", "value": "from zou.app.blueprints.export.csv.base import BaseCsvExport\n\nfrom zou.app.models.person import Person\n\n\nclass PersonsCsvExport(BaseCsvExport):\n def __init__(self):\n BaseCsvEx...
python
chosen
[ { "from": "system", "value": "Disable the Object Storage tests in Waterford\n" }, { "from": "human", "value": "# -*- coding: utf-8 -*-\n\n# Copyright 2015 Telefónica Investigación y Desarrollo, S.A.U\n#\n# This file is part of FIWARE project.\n#\n# Licensed under the Apache License, Version 2.0 ...
python
chosen
[ { "from": "system", "value": "[AC-6976] Remove physical_address from factory, not sure why this helps\n" }, { "from": "human", "value": "# MIT License\n# Copyright (c) 2017 MassChallenge, Inc.\n\nfrom __future__ import unicode_literals\n\nimport swapper\nfrom factory import (\n DjangoModelFac...
python
chosen
[ { "from": "system", "value": "Add final version of exercise 4.1.\n" }, { "from": "human", "value": "# 4-1. Pizzas\n\nfavorite_pizzas = [\"Columpus\", \"Marco Polo\", \"Amerikana\"]\n\nfor pizza in favorite_pizzas:\n\tprint(\"I like \" + pizza + \" pizza.\")\n" }, { "from": "gpt", "va...
python
chosen
[ { "from": "system", "value": "Update preprocessor testdata to use grow.Preprocessor.\n" }, { "from": "human", "value": "from grow import Preprocessor\nfrom protorpc import messages\n\n\nclass CustomPreprocessor(Preprocessor):\n KIND = 'custom_preprocessor'\n\n class Config(messages.Message...
python
chosen
[ { "from": "system", "value": "Fix gate for neutron-lib v2.14\n\nA patch [1] that updates upper-constraints.txt for neutron-lib 2.14 fails\nto pass check pipeline.\n\nDue to development sequence it's necessary to append a new rule type\nto VALID_RULE_TYPES in Neutron first, and then move it to neutron-lib.\n...
python
chosen
[ { "from": "system", "value": "Add Preview to list of possible MSVC versions.\n\nNeeded to test a Preview version of MSVC and adding it to the list here\nmakes it a bit easier and the list more complete.\n\nChange-Id: I419636722303816f0cd961408229fcef0773e8e0\nReviewed-on: https://skia-review.googlesource.co...
python
chosen
[ { "from": "system", "value": "Use '\"' for string delimeter\n" }, { "from": "human", "value": "import logging.config\n\nfrom flask import Flask\nfrom flask_sqlalchemy import SQLAlchemy\nfrom flask_migrate import Migrate\nfrom flask_mail import Mail\nfrom flask_user import UserManager, SQLAlchemy...
python
chosen
[ { "from": "system", "value": "Change start-weblogic-server using jdk as default.\n\nCode reviewed by Edwin Tang\n\n\nFormer-commit-id: 6e2cbb2da770d73e12dfae7d36fd6f1ef00c4ed7" }, { "from": "human", "value": "############################################################################ \n# Gener...
python
chosen
[ { "from": "system", "value": "Remove var declaration from abstract base class\n" }, { "from": "human", "value": "#!/usr/bin/env python\n#\n# VM Backup extension\n#\n# Copyright 2015 Microsoft Corporation\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may not use t...
python
chosen
[ { "from": "system", "value": "Fix server error when login with u2f\n" }, { "from": "human", "value": "#!/usr/bin/env python3\n# -*- coding: utf-8 -*-\n\nimport json\nfrom u2flib_server.u2f import (begin_registration,\n begin_authentication,\n ...
python
chosen
[ { "from": "system", "value": "Test both branches of pylibsodium_salsa choice\n" }, { "from": "human", "value": "\nimport platform\nimport sys\n\nplatform.python_implementation = lambda:'PyPy'\n\ndef unimport():\n del sys.modules['pylibscrypt']\n sys.modules.pop('pylibscrypt.common', None)\...
python
chosen
[ { "from": "system", "value": "Write out request times to a csv of output_dir is specified\n" }, { "from": "human", "value": "import time\nimport logging\n\nfrom base import Plugin\n\nLOG = logging.getLogger('crawler')\n\nclass Time(Plugin):\n \"\"\"\n Follow the time it takes to run reques...
python
chosen
[ { "from": "system", "value": "Add licence header to migration\n" }, { "from": "human", "value": "\n\"\"\"Comment assignee type\n\nRevision ID: 504f541411a5\nRevises: 18cbdd3a7fd9\nCreate Date: 2015-12-04 13:57:07.047217\n\n\"\"\"\n\n# revision identifiers, used by Alembic.\nrevision = '504f54141...
python
chosen
[ { "from": "system", "value": "Update ward names even if just the slug would have changed\n" }, { "from": "human", "value": "import re\n\nfrom django.core.management.base import NoArgsCommand, CommandError\n\nfrom django.template.defaultfilters import slugify\n\nfrom optparse import make_option\n...
python
chosen
[ { "from": "system", "value": "Simplify data migration and make it safe to rerun\n" }, { "from": "human", "value": "# -*- coding: utf-8 -*-\nfrom __future__ import unicode_literals\n\nfrom django.db import migrations\nfrom django.db.models import Q\n\n\ndef migrate_contact_for_research_via_field_...
python
chosen
[ { "from": "system", "value": "Refactor Launchpad handler to use BaseHandler.\n" }, { "from": "human", "value": "import os\n\nfrom django.conf import settings\n\nfrom launchpadlib.launchpad import Launchpad\n\n\ndef pull(package):\n \n cachedir = getattr(settings, 'LAUNCHPAD_CACHE_DIR', os....
python
chosen
[ { "from": "system", "value": "Set don't use station coords for geocoding\n" }, { "from": "human", "value": "from data_importers.management.commands import BaseDemocracyCountsCsvImporter\n\n\nclass Command(BaseDemocracyCountsCsvImporter):\n council_id = \"HLD\"\n addresses_name = (\n ...
python
chosen
[ { "from": "system", "value": "Remove monitoring only after database quarantine\n" }, { "from": "human", "value": "from dbaas_cloudstack.provider import CloudStackProvider\nfrom pre_provisioned.pre_provisioned_provider import PreProvisionedProvider\nfrom integrations.monitoring.manager import Mo...
python
chosen
[ { "from": "system", "value": "Disable date_hierarchy for now since it requires tzinfo in MySQL\n" }, { "from": "human", "value": "# -*- coding: utf-8 -*-\nfrom django.contrib import admin\nfrom .models import Announcement\n\nclass AnnouncementAdmin(admin.ModelAdmin):\n search_fields = ('messa...
python
chosen
[ { "from": "system", "value": "Fix init method, self.rows and capital booleans.\n" }, { "from": "human", "value": "import numpy\n\n\"\"\"\nBoard represents a four in a row game board.\n\nAuthor: Isaac Arvestad\n\"\"\"\nclass Board:\n \"\"\"\n Initializes the game with a certain number of ro...
python
chosen
[ { "from": "system", "value": "Use the subprocess module to start processes with pipes.\nThis seems to fix the lack of output on Windows.\n" }, { "from": "human", "value": "import os, time\n\ndef main():\n srvcmd = '%s --dbname \"%s\" --dbinit \"include sql;\"' % (os.getenv('MSERVER'),os.geten...
python
chosen
[ { "from": "system", "value": "Tweak to remove dependency on new Cannon\n" }, { "from": "human", "value": "#!/usr/bin/env python2.7\n# -*- coding: utf-8 -*-\n\nimport logging\nfrom numpy import RankWarning\nfrom warnings import simplefilter\n\nfrom .cannon_instance import \\\n CannonInstance, ...
python
chosen
[ { "from": "system", "value": "Allow kargs in resource factory\n" }, { "from": "human", "value": "from .base import ResourceBase # noqa F401\nfrom .bucket import Bucket # noqa F401\nfrom .sql import SQLInstance # noqa F401\nfrom .bigquery import BQDataset # noqa F401\n\n\nclass Resou...
python
chosen
[ { "from": "system", "value": "Fix for testing error pages\n\ncalling url_available(url='http://doesnotexist.com', expected_code=404) # raise exception" }, { "from": "human", "value": "# coding: utf-8\nfrom __future__ import unicode_literals\n\nfrom django.utils.six.moves.urllib.request import ur...
python
chosen
[ { "from": "system", "value": "Add Google Webmaster verification handler.\n" }, { "from": "human", "value": "import webapp2\n\nclass MainPage(webapp2.RequestHandler):\n def get(self):\n self.response.write(file('index.html').read())\n\napplication = webapp2.WSGIApplication([\n ('/', ...
python
chosen
[ { "from": "system", "value": "Correct call of second parse method\n" }, { "from": "human", "value": "import scrapy\n\nclass Bonn2011Spider(scrapy.Spider):\n name = \"bonn2011\"\n start_urls = ['http://bonn-packts-an-2011.de/www.bonn-packts-an.de/dito/forumc0d2.html']\n\n def parse(self,...
python
chosen
[ { "from": "system", "value": "Use connection.close to close database connections.\n" }, { "from": "human", "value": "import thread\n\nimport time\nfrom django.db import close_old_connections\n\n\nclass DatabaseConnectionMaintainer(object):\n DB_TIMEOUT_SECONDS = 60*60\n\n def __init__(self...
python
chosen
[ { "from": "system", "value": "Revert \"FilerFilePlugin.icon_src is also obsolete\"\n\nThis reverts commit 6f9609a350fcac101eb28c08f8499f11d753f292.\n" }, { "from": "human", "value": "from cms.plugin_base import CMSPluginBase\nfrom cms.plugin_pool import plugin_pool\nfrom django.utils.translation...
python
chosen
[ { "from": "system", "value": "Fix to migration dependency issue because of missing a migration in the api-extensions branch. Removed duplicate change and changed the dependency.\n" }, { "from": "human", "value": "# -*- coding: utf-8 -*-\n# Generated by Django 1.11.6 on 2018-05-30 20:53\nfrom __...
python
chosen
[ { "from": "system", "value": "Test that @cached_property really caches\n" }, { "from": "human", "value": "import sys\nfrom funcy.objects import *\n\n\n### @cached_property\n\ndef test_set_cached_property():\n class A(object):\n @cached_property\n def prop(self):\n ret...
python
chosen
[ { "from": "system", "value": "Update: Add relevant notes and documentation to addInfoToCSVReport.py\n" }, { "from": "human", "value": "#!/usr/bin/env python3\n\nfrom csv import reader\nfrom sys import stdin\n\nfrom xmlrpc.client import ServerProxy\nfrom ssl import create_default_context, Purpos...
python
chosen
[ { "from": "system", "value": "Load external firebird or sybase dialect if available\n\nFixes: #5318\n\nExtension of I1660abb11c02656fbf388f2f9c4257075111be58\n\nChange-Id: I32b678430497327f9b08f821bd345a2557e34b1f\n" }, { "from": "human", "value": "# dialects/__init__.py\n# Copyright (C) 2005-20...
python
chosen
[ { "from": "system", "value": "Remove unnecessary verify.\nWe should let user run the verification instead of doing it in linkage.\n" }, { "from": "human", "value": "from __future__ import print_function, absolute_import\nfrom ctypes import c_int, c_char_p, POINTER\nfrom . import ffi\n\n\ndef lin...
python
chosen