conversations
listlengths
2
3
source
stringclasses
1 value
stack
stringclasses
1 value
[ { "from": "system", "value": "Use service in script to promote a user to organizer\n" }, { "from": "human", "value": "#!/usr/bin/env python\n# -*- coding: utf-8 -*-\n\n\"\"\"Promote a user to organizer status.\n\n:Copyright: 2006-2016 Jochen Kupperschmidt\n:License: Modified BSD, see LICENSE for...
python
chosen
[ { "from": "system", "value": "Allow set scroll timeout param\n" }, { "from": "human", "value": "from rest_framework import pagination\nfrom amcat.tools import amcates\n\nfrom rest_framework.response import Response\nfrom django.core.urlresolvers import reverse\nfrom rest_framework.utils.urls imp...
python
chosen
[ { "from": "system", "value": "Make the command log more detailed\n" }, { "from": "human", "value": "import logging\n\n\nclass CommandLog:\n \"\"\"A simple cog to log commands executed.\"\"\"\n def __init__(self):\n self.log = logging.getLogger('liara.command_log')\n\n async def o...
python
chosen
[ { "from": "system", "value": "Fix test case for tools.path\n" }, { "from": "human", "value": "# -*- coding: utf-8 -*-\n\nimport unittest\n\nfrom pythainlp.tools import (\n get_full_data_path,\n get_pythainlp_data_path,\n get_pythainlp_path,\n)\n\n\nclass TestToolsPackage(unittest.TestCa...
python
chosen
[ { "from": "system", "value": "Create reference to app in module\n" }, { "from": "human", "value": "try:\n import pygame\nexcept ImportError:\n print 'Failed to import pygame'\n print '-----------------------'\n print ''\n print 'tingbot-python requires pygame. Please download and ...
python
chosen
[ { "from": "system", "value": "Support currency digits and currency suffix.\n" }, { "from": "human", "value": "from decimal import Decimal as D\nfrom decimal import InvalidOperation\n\nfrom babel.numbers import format_currency\nfrom django import template\nfrom django.conf import settings\nfrom d...
python
chosen
[ { "from": "system", "value": "Print message for pull success.\n" }, { "from": "human", "value": "import os\nimport traceback\n\nfrom django.utils import timezone\n\nfrom django_git.management.commands.git_pull_utils.git_folder_enum import enum_git_repo\nfrom django_git.management.commands.git_pu...
python
chosen
[ { "from": "system", "value": "Add tests for Wit STT\n" }, { "from": "human", "value": "from pyspeech import best_speech_result\nimport unittest\nfrom pyaudio import PyAudio\nimport Queue\n\nclass PyspeechTest(unittest.TestCase):\n def setUp(self):\n self.p = PyAudio()\n\n def test_google_st...
python
chosen
[ { "from": "system", "value": "Print where we're running at\n" }, { "from": "human", "value": "#!/usr/bin/env python\n\nfrom irc import irc\nfrom xmlrpc.server import AsyncXMLRPCServer\n\n\nif __name__ == '__main__':\n server = AsyncXMLRPCServer(('localhost', 8000), allow_none=True)\n serve...
python
chosen
[ { "from": "system", "value": "Add actions to make reminders active or inactive\n" }, { "from": "human", "value": "from django.contrib import admin\n\nfrom epiweb.apps.reminder.models import Reminder\n\nclass ReminderAdmin(admin.ModelAdmin):\n list_display = ('user', 'wday', 'active', \n ...
python
chosen
[ { "from": "system", "value": "Remove spurious print statement that made the plugin incompatible with python 3.\n" }, { "from": "human", "value": "import re\r\n\r\nfrom livestreamer.plugin import Plugin\r\nfrom livestreamer.plugin.api import http, validate\r\nfrom livestreamer.stream import HDSSt...
python
chosen
[ { "from": "system", "value": "Use ABN as Australian VAT number\n\nSee https://www.ato.gov.au/Business/GST/Tax-invoices/\n\nCloses https://github.com/arthurdejong/python-stdnum/pull/246\n" }, { "from": "human", "value": "# __init__.py - collection of Australian numbers\n# coding: utf-8\n#\n# Copy...
python
chosen
[ { "from": "system", "value": "Add missing vat alias for Costa Rica\n" }, { "from": "human", "value": "# __init__.py - collection of Costa Rican numbers\n# coding: utf-8\n#\n# Copyright (C) 2019 Leandro Regueiro\n#\n# This library is free software; you can redistribute it and/or\n# modify it unde...
python
chosen
[ { "from": "system", "value": "Make the docstring match the github description" }, { "from": "human", "value": "\"\"\"adder is an amazing module which adds things\"\"\"\n\ndef add(first, second):\n \"\"\"The power of add is that it adds its arguments\"\"\"\n return first + second\n" }, ...
python
chosen
[ { "from": "system", "value": "Automate Transfers: Change default metadata added\n" }, { "from": "human", "value": "#!/usr/bin/env python2\n\nimport json\nimport os\nimport sys\n\ndef main(transfer_path):\n basename = os.path.basename(transfer_path)\n try:\n _, dc_id, _ = basename.sp...
python
chosen
[ { "from": "system", "value": "Fix compatibility with latest stable glue version" }, { "from": "human", "value": "import operator\nimport numpy as np\nfrom glue.qt import get_qapp\nfrom glue.core.data import Data\nfrom glue.core.data_collection import DataCollection\nfrom glue.app.qt.application ...
python
chosen
[ { "from": "system", "value": "Update problem 67 to be legible\n" }, { "from": "human", "value": "# Project Euler Problem 67\r\n# Created on: 2012-06-18\r\n# Created by: William McDonald\r\n\r\ndef importTri():\r\n t = []\r\n f = open(\"problem67.txt\")\r\n for line in f:\r\n t.ap...
python
chosen
[ { "from": "system", "value": "Format the message string after translating, not before\n\nThis makes sure we use the right translated string.\n\nContributes to Ultimaker/Cura#57\n" }, { "from": "human", "value": "# Copyright (c) 2015 Ultimaker B.V.\n# Uranium is released under the terms of the AG...
python
chosen
[ { "from": "system", "value": "Clean up script to make refunds\n\nTested against httpbin.org\n" }, { "from": "human", "value": "#!/usr/bin/env python -u\nfrom __future__ import absolute_import, division, print_function, unicode_literals\n\nimport csv, os, requests\n\nurl = 'https://api.balancedpa...
python
chosen
[ { "from": "system", "value": "Clear context for celery tasks\n" }, { "from": "human", "value": "\"\"\"\nsentry.tasks.base\n~~~~~~~~~~~~~~~~~\n\n:copyright: (c) 2010-2014 by the Sentry Team, see AUTHORS for more details.\n:license: BSD, see LICENSE for more details.\n\"\"\"\nfrom __future__ impor...
python
chosen
[ { "from": "system", "value": "Fix for lack of file.\n\nSigned-off-by: Maciej Szankin <33c1fdf481c8e628d4c6db7ea8dc77f49f2fa5d7@szankin.pl>\n" }, { "from": "human", "value": "from models import Base, engine, MetricType\nfrom sqlalchemy.orm import Session\nimport uuid\nimport os\n\n# Create all ta...
python
chosen
[ { "from": "system", "value": "Set up git push script. ;)\n" }, { "from": "human", "value": "import os\n\nos.system(\"git add *\")\nos.system(\"git commit -m 'first commit'\")\nos.system(\"git push origin master\")\n" }, { "from": "gpt", "value": "import os\n\nprint \"Enter commit mes...
python
chosen
[ { "from": "system", "value": "Add docstring to WSGI example\n" }, { "from": "human", "value": "import guv\n\nguv.monkey_patch()\nimport guv.wsgi\nimport logger\n\nlogger.configure()\n\n\ndef app(environ, start_response):\n status = '200 OK'\n output = [b'Hello World!']\n content_length ...
python
chosen
[ { "from": "system", "value": "Update month names of year\n" }, { "from": "human", "value": "#!/usr/bin/env python\n\nimport datetime\n\nfrom nodes import Node\n\n\nclass Delta(Node):\n char = \"$\"\n args = 1\n results = 1\n \n @Node.test_func([[1, 2, 3, 5]], [[1, 1, 2]])\n def...
python
chosen
[ { "from": "system", "value": "Fix API access control headers\n" }, { "from": "human", "value": "class AddResponseHeader:\n def process_response(self, req, resp, resource):\n resp.set_header('Access-Control-Allow-Origin', 'http://localhost:8000')\n\ncomponents = [AddResponseHeader()]\n"...
python
chosen
[ { "from": "system", "value": "Improve the file id hash\n" }, { "from": "human", "value": "from os.path import join\nfrom os import makedirs\nfrom django.conf import settings\n\n\ndef make_file_id(file_data):\n return str(abs(hash(file_data)))\n\n\ndef get_file_location(file_name, file_id):\n ...
python
chosen
[ { "from": "system", "value": "Refactor filter out none to method\n" }, { "from": "human", "value": "import string\nimport math\nimport itertools\n\n\nclass CryptoSquare:\n\n @classmethod\n def encode(cls, msg):\n if len(cls.normalize(msg)) == 0:\n return ''\n retur...
python
chosen
[ { "from": "system", "value": "Test that repeated read/write-object cycles do not change the data\n" }, { "from": "human", "value": "import unittest\n\nfrom ..framework import cli_test_suite\nfrom .util import DEFAULT_MANAGEMENT_KEY\n\n\n@cli_test_suite\ndef additional_tests(ykman_cli):\n clas...
python
chosen
[ { "from": "system", "value": "Update KMS per 2021-06-17 changes\n" }, { "from": "human", "value": "# Copyright (c) 2012-2013, Mark Peek <mark@peek.org>\n# All rights reserved.\n#\n# See LICENSE file for full license.\n\nfrom . import AWSObject, Tags\nfrom .compat import policytypes\nfrom .valida...
python
chosen
[ { "from": "system", "value": "Set a development build version.\n" }, { "from": "human", "value": "# Copyright (c) 2014 Yubico AB\n# All rights reserved.\n#\n# Redistribution and use in source and binary forms, with or\n# without modification, are permitted provided that the following\n# co...
python
chosen
[ { "from": "system", "value": "Add missing dev config variable\n" }, { "from": "human", "value": "# coding: utf-8\nfrom __future__ import unicode_literals, division, absolute_import, print_function\n\nimport os\n\n\npackage_name = \"ocspbuilder\"\n\nother_packages = []\n\nrequires_oscrypto = True...
python
chosen
[ { "from": "system", "value": "Reduce pgsql socket pool and number of workers to match 2000 maximum connections\n" }, { "from": "human", "value": "import multiprocessing\nimport os\n\n_is_travis = os.environ.get('TRAVIS') == 'true'\n\nworkers = multiprocessing.cpu_count() * 3\nif _is_travis:\n ...
python
chosen
[ { "from": "system", "value": "Make subpage_urls a property on RoutablePageTest\n" }, { "from": "human", "value": "from django.db import models\nfrom django.http import HttpResponse\nfrom django.conf.urls import url\n\nfrom wagtail.contrib.wagtailroutablepage.models import RoutablePage\n\n\ndef r...
python
chosen
[ { "from": "system", "value": "Add 'position' to unique_together constraint, to account for members who serve in both houses during a Congress (h/t @derekwillis)\n" }, { "from": "human", "value": "from django.db import models\n\nclass Legislator(models.Model):\n \"\"\"Model representing a legi...
python
chosen
[ { "from": "system", "value": "Allow users to choose lhs sampling criteria\n" }, { "from": "human", "value": "import numpy as np\n\nfrom ..core.errors import InvalidConfigError\n\nfrom .base import ExperimentDesign\nfrom .random_design import RandomDesign\n\nclass LatinDesign(ExperimentDesign):\n...
python
chosen
[ { "from": "system", "value": "Remove reliance on queryset based geocoding method\n" }, { "from": "human", "value": "from django.utils.translation import ugettext_lazy as _\nfrom django.contrib.admin import SimpleListFilter\n\n\nclass GeocodedFilter(SimpleListFilter):\n \"\"\"\n Admin list ...
python
chosen
[ { "from": "system", "value": "Add missing method to interface" }, { "from": "human", "value": "from nevow.compy import Interface\n\n\nclass IType(Interface):\n def validate(self, value):\n pass\n\n \nclass IStructure(Interface):\n pass\n \n \nclass IWidget(Interface):\n...
python
chosen
[ { "from": "system", "value": "Test validator can now be used as a module\n" }, { "from": "human", "value": "#! /usr/bin/python\nimport jsonschema\nimport json\nimport sys\nimport os\nimport glob\n\nvm_schema = json.loads(open(\"vm.schema.json\").read());\n\ndef validate_vm_spec(filename):\n # L...
python
chosen
[ { "from": "system", "value": "Fix check for _draft key in request object\n" }, { "from": "human", "value": "from django.contrib.auth.models import User\nfrom django import forms\n\nfrom models import ProjectDetail\n\nclass ProjectDetailForm(forms.ModelForm):\n class Meta:\n model = Pro...
python
chosen
[ { "from": "system", "value": "Cover the line that handles the pip<=1.5.2 error case.\n" }, { "from": "human", "value": "# coding=utf-8\n\nimport os.path as path\nimport unittest\n\nfrom devpi_builder import wheeler\n\n\nclass WheelTest(unittest.TestCase):\n def test_build(self):\n with...
python
chosen
[ { "from": "system", "value": "Make sure we close the socket\n" }, { "from": "human", "value": "import socket\nfrom hiss.handler.gntp.message import Response\n\nclass GNTPHandler():\n def register(self, notifier, target, **kwargs):\n pass\n\n def notify(self, notification, target):\n...
python
chosen
[ { "from": "system", "value": "Remove excessive parenthesis + add docstrings to module, class, and all public methods\n" }, { "from": "human", "value": "from server_configuration import *\nfrom s3_configuration import *\n\n\nclass Configuration():\n\n def __init__(self):\n self.stage = ...
python
chosen
[ { "from": "system", "value": "Remove unused social auth keys\n" }, { "from": "human", "value": "# Freesound keys for download script\n# Get credentials at http://www.freesound.org/apiv2/apply\n# Set callback url to https://www.freesound.org/home/app_permissions/permission_granted/\nFS_CLIENT_ID ...
python
chosen
[ { "from": "system", "value": "Remove output when restarting apache after module enable\n" }, { "from": "human", "value": "import os\n\nimport yaml\n\n\ndef load_modules(data):\n result = yaml.load(data)\n if result:\n apache = result.get('apache', {})\n if apache:\n ...
python
chosen
[ { "from": "system", "value": "Use a shorter timeout, to ensure that this fails more often\n" }, { "from": "human", "value": "import pytest\n\n\n@pytest.mark.network\ndef test_timeout(script):\n result = script.pip(\n \"--timeout\",\n \"0.001\",\n \"install\",\n \"-...
python
chosen
[ { "from": "system", "value": "Add source links for tweets\n" }, { "from": "human", "value": "# coding=utf-8\n# picdescbot: a tiny twitter/tumblr bot that tweets random pictures from wikipedia and their descriptions\n# this file implements twitter-related functionality\n# Copyright (C) 2016 Elad ...
python
chosen
[ { "from": "system", "value": "Create initial counts outside the test class\n" }, { "from": "human", "value": "import unittest\n\nfrom django.test import TestCase\n\nfrom candidates.tests.test_create_person import mock_create_person\n\nfrom .models import CachedCount\n\nclass CachedCountTechCase(...
python
chosen
[ { "from": "system", "value": "Check for error if use_3D and non-interactive\n" }, { "from": "human", "value": "import pytest\nfrom matplotlib import pyplot as plt\n\nfrom poliastro.plotting import OrbitPlotter2D, OrbitPlotter3D\nfrom poliastro.plotting.misc import plot_solar_system\n\n\n@pytest....
python
chosen
[ { "from": "system", "value": "Make documentation more explicit for WTForms deprecation.\n" }, { "from": "human", "value": "import warnings\nfrom wtforms import form\nfrom wtforms.ext.i18n.utils import get_translations\n\ntranslations_cache = {}\n\n\nclass Form(form.Form):\n \"\"\"\n Base f...
python
chosen
[ { "from": "system", "value": "Fix Racket on FreeBSD after openat changes\n\n@quantum5 this feels iffy, but I think it's (marginally) better than allowing all .racket folders to be read\n" }, { "from": "human", "value": "from dmoj.executors.base_executor import CompiledExecutor\nfrom dmoj.executo...
python
chosen
[ { "from": "system", "value": "Add Ordering and PaginationMixin on Listview\n" }, { "from": "human", "value": "from django.views.generic import DetailView\nfrom django.views.generic import ListView\nfrom django.shortcuts import redirect, render\n\nfrom .forms import PresentationCreateForm\nfrom ....
python
chosen
[ { "from": "system", "value": "Update dsub version to 0.3.1\n\nPiperOrigin-RevId: 243828346\n" }, { "from": "human", "value": "# Copyright 2017 Google Inc. All Rights Reserved.\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may not use this file except in complianc...
python
chosen
[ { "from": "system", "value": "Remove logging setup from example.\n" }, { "from": "human", "value": "import condor\n\ndef square(x):\n return x**2\n\ndef main():\n jobs = [(square, [x]) for x in range(16)]\n\n def finished(task, result):\n print task.args, result\n\n condor.do(...
python
chosen
[ { "from": "system", "value": "Add README to test suite\n" }, { "from": "human", "value": "#This file is part of python-sql. The COPYRIGHT file at the top level of\n#this repository contains the full copyright notices and license terms.\nimport sys\nimport os\nimport unittest\nimport doctest\n\n...
python
chosen
[ { "from": "system", "value": "Change 'read-write' scope to 'read+write'.\n" }, { "from": "human", "value": "from datetime import timedelta\nfrom django.conf import settings\n\nCONFIDENTIAL = 0\nPUBLIC = 1\n\nCLIENT_TYPES = (\n (CONFIDENTIAL, \"Confidential (Web applications)\"),\n (PUBLIC,...
python
chosen
[ { "from": "system", "value": "Replace inner function with lambda in FeedParser.has_tag()\n" }, { "from": "human", "value": "from __future__ import absolute_import\n\nimport datetime as dt\nimport feedparser\nfrom types import StringTypes\n\nfrom comics.aggregator.lxmlparser import LxmlParser\n\n...
python
chosen
[ { "from": "system", "value": "Fix CommandUsageMessage to allow backward compatibility with already existing raw Markdown formatted text\n" }, { "from": "human", "value": "from bot.action.util.textformat import FormattedText\n\n\nclass CommandUsageMessage:\n @classmethod\n def get_formatted...
python
chosen
[ { "from": "system", "value": "Determine glowscript version from file name\n" }, { "from": "human", "value": "from __future__ import print_function\n\nimport os\nimport re\n\n\ndef glowscript_version():\n \"\"\"\n Extract the Glowscript version from the javascript in the data directory.\n ...
python
chosen
[ { "from": "system", "value": "Modify to fit with PEP8 standard\n" }, { "from": "human", "value": "from flask_wtf import FlaskForm\nfrom wtforms import StringField, IntegerField, DecimalField\nfrom wtforms.validators import DataRequired\nfrom app.models import User\n\nclass EditForm(FlaskForm):\n...
python
chosen
[ { "from": "system", "value": "Change theme to sandstone (bootswatch)\n" }, { "from": "human", "value": "import os\n\nfrom flask import Flask\nfrom flask.ext.assets import Bundle, Environment\n\napp = Flask(__name__)\n\n# Load the app config\napp.config.from_object(\"config.Config\")\n\nassets = ...
python
chosen
[ { "from": "system", "value": "Fix out of bounds symbol generation\n" }, { "from": "human", "value": "from random import randint\nfrom types import GeneratorType\nfrom nekrobox.docdecs import params\nfrom six.moves import range\n\n\n@params(origin=(int, \"Final origin symbol, if None then random\...
python
chosen
[ { "from": "system", "value": "Add tests for the Field class.\n" }, { "from": "human", "value": "# -*- coding: utf-8 -*-\n\n\"\"\"Tests for vumi.persist.fields.\"\"\"\n\nfrom twisted.trial.unittest import TestCase\n\nfrom vumi.persist.fields import Field, ValidationError, Integer, Unicode\n\n\ncl...
python
chosen
[ { "from": "system", "value": "Add solution for problem 19\n\nCounting Sundays\n" }, { "from": "human", "value": "\"\"\"Counting Sundays\n\nYou are given the following information, but you may prefer to do some research for yourself.\n\n- 1 Jan 1900 was a Monday.\n- Thirty days has September,\n ...
python
chosen
[ { "from": "system", "value": "Fix TypeError: _set_bank_data() takes at least 7 arguments (7 given)\n" }, { "from": "human", "value": "# -*- coding: utf-8 -*-\n##############################################################################\n#\n# Author: Guewen Baconnier\n# Copyright 2014 Cam...
python
chosen
[ { "from": "system", "value": "Use `x_path.exists()` instead of `Path.exists(x)`." }, { "from": "human", "value": "from pathlib import Path\n\nfrom configparser import ConfigParser\n\nimport pyshark\n\n\nfp_config_path = Path.cwd() / 'config.ini' # get config from the current directory\npyshark_...
python
chosen
[ { "from": "system", "value": "Add a failure expectation to win memory.css3d test.\n\nIn tile manager we seem to reach the memory limit early (with the\npending tree). However, when we activate our memory gets released\nand we start filling it up again with the now active tree tiles.\n\nThe windows bot seems...
python
chosen
[ { "from": "system", "value": "Allow to use `url` defined as env variable.\n" }, { "from": "human", "value": "# shut up useless SA warning:\nimport warnings\nwarnings.filterwarnings(\n 'ignore', 'Unicode type received non-unicode bind param value.')\n\nfrom dataset.persistence.database import ...
python
chosen
[ { "from": "system", "value": "Fix comment format and input var name.\n" }, { "from": "human", "value": "import numpy as np\n\n\ndef histeq(im, num_bins=256):\n \"\"\"\n Performs an histogram equalization on ``img``.\n This was taken from:\n http://www.janeriksolem.net/2009/06/histogr...
python
chosen
[ { "from": "system", "value": "Add mesonet readers to top level namespace.\n\ngit-svn-id: acf0ef94bfce630b1a882387fc03ab8593ec6522@150 150532fb-1d5b-0410-a8ab-efec50f980d4\n" }, { "from": "human", "value": "import bl\nimport readers\nimport vis\nimport tools\nimport constants\nfrom calc import *\...
python
chosen
[ { "from": "system", "value": "Update MPL version requirement for `widgets`.\n" }, { "from": "human", "value": "import matplotlib.widgets as mwidgets\n\nif not hasattr(mwidgets, 'AxesWidget'):\n branch = \"<https://github.com/tonysyu/matplotlib/tree/base-widget>\"\n msg = \"mpltools.widgets...
python
chosen
[ { "from": "system", "value": "Solve chess board cell color problem\n" }, { "from": "human", "value": "#!/usr/local/bin/python\n# Code Fights Chess Board Cell Color Problem\n\n\ndef chessBoardCellColor(cell1, cell2):\n pass\n\n\ndef main():\n tests = [\n [\"A1\", \"C3\", True],\n ...
python
chosen
[ { "from": "system", "value": "Remove usage of `monetary` keyword argument again as it is not available on Python 3.6\n" }, { "from": "human", "value": "\"\"\"\nbyceps.util.money\n~~~~~~~~~~~~~~~~~\n\nHandle monetary amounts.\n\n:Copyright: 2006-2019 Jochen Kupperschmidt\n:License: Modified BSD, ...
python
chosen
[ { "from": "system", "value": "Add replace method to Arithmetic operation\n" }, { "from": "human", "value": "from thinglang.common import ObtainableValue\nfrom thinglang.parser.tokens import BaseToken\n\n\nclass ArithmeticOperation(BaseToken, ObtainableValue):\n OPERATIONS = {\n \"+\": ...
python
chosen
[ { "from": "system", "value": "Remove importlib dependency, add django's own importlib\n" }, { "from": "human", "value": "from django.conf import settings\nimport importlib\nfrom .base import BaseStaticSiteRenderer\nfrom .disk import DiskStaticSiteRenderer\nfrom .appengine import GAEStaticSiteRen...
python
chosen
[ { "from": "system", "value": "Use the Team Cymru whois server by default, make it easier to use complex commands, and optionally insert a new line before the output.\n" }, { "from": "human", "value": "import subprocess\nimport string\n\nclass Plugin:\n def __init__(self, command, allowedChars...
python
chosen
[ { "from": "system", "value": "Make heartbeat url wait for courses to be loaded\n" }, { "from": "human", "value": "import json\nfrom datetime import datetime\nfrom django.http import HttpResponse\n\n\ndef heartbeat(request):\n \"\"\"\n Simple view that a loadbalancer can check to verify tha...
python
chosen
[ { "from": "system", "value": "Improve stacktrace print for traceback.\n" }, { "from": "human", "value": "#!/usr/bin/python3\n\nfrom pprint import pprint\nimport json\nimport sys\n\nif __name__ == '__main__':\n if len(sys.argv) >= 2:\n path = sys.argv[1].split('.')\n else:\n p...
python
chosen
[ { "from": "system", "value": "Enable Odoo blog for UCW\n" }, { "from": "human", "value": "# -*- coding: utf-8 -*-\n{\n 'name': \"Bestja: UCW\",\n 'summary': \"Installation configuration for UCW\",\n 'description': \"Installation configuration for Uniwersyteckie Centrum Wolontariatu\",\n...
python
chosen
[ { "from": "system", "value": "Fix for get_upcoming_events tag using the wrong filter\n" }, { "from": "human", "value": "from django import template\nfrom .. import get_special_events_model\nimport datetime\n\nregister = template.Library()\n\n\n@register.assignment_tag\ndef get_upcoming_events(li...
python
chosen
[ { "from": "system", "value": "Add support for providing command string\n\nUser can provide a command string in a 'command' key -- e.g.:\n\n setup(\n ...\n setup_requires='setuptools_extversion',\n extversion={\n 'command': 'git describe --tags --dirty',\n }\n ...
python
chosen
[ { "from": "system", "value": "Add location, email, username and last_login to user serializer\n" }, { "from": "human", "value": "from rest_framework import serializers\nfrom .models import User\n\n\n\nclass UserSerializer(serializers.ModelSerializer):\n \"\"\" Usage:\n from rest_framew...
python
chosen
[ { "from": "system", "value": "Add operation to activate campaign.\n" }, { "from": "human", "value": "\"\"\"\nAPI MAPPING FOR Eloqua API V2\n\"\"\"\n\nmapping_table = {\n\n 'content_type': 'application/json',\n 'path_prefix': '/API/REST/2.0',\n\n # Campaigns\n 'get_campaign': {\n ...
python
chosen
[ { "from": "system", "value": "Remove un-needed dynamic dependency to zlib\n\nDiscovered in issue #25\n" }, { "from": "human", "value": "#!/usr/bin/python2.7\nfrom distutils.core import setup, Extension\nfrom sys import platform\n\nfrom setup_config import NASSL_SETUP, NASSL_EXT_SETUP\nfrom build...
python
chosen
[ { "from": "system", "value": "REL: Update master branch version to 0.1.2.dev1\n" }, { "from": "human", "value": "# Copyright (c) 2014, Warren Weckesser\n# All rights reserved.\n# See the LICENSE file for license information.\n\nfrom numpy.testing import Tester as _Tester\n\nfrom ._odeintw import...
python
chosen
[ { "from": "system", "value": "Remove strings with r'\\use...' getting interp as Unicode!\n" }, { "from": "human", "value": "from __future__ import absolute_import, print_function, unicode_literals\nfrom builtins import dict, str\nimport matplotlib\n\nfontsize=7\n\ndef set_fig_params():\n matp...
python
chosen
[ { "from": "system", "value": "Remove Heroku createsuperuser command. Migrate now creates a default user.\n" }, { "from": "human", "value": "from django.core.management.base import BaseCommand\nfrom django.contrib.auth.models import User\nfrom django.core.management import call_command\n\n\nclass...
python
chosen
[ { "from": "system", "value": "Switch luci-py tests to use gcloud SDK.\n\nR=maruel@chromium.org, iannucci@chromium.org\nBUG=835919\n\nChange-Id: Iaf7f361343dfebfc7fd603b8b996ad9fa5412f52\nReviewed-on: https://chromium-review.googlesource.com/c/infra/luci/luci-py/+/1684451\nReviewed-by: Andrii Shyshkalov <a30...
python
chosen
[ { "from": "system", "value": "Fix compressed feeds in python3\n" }, { "from": "human", "value": "import gzip\nimport csv\n\nfrom django.core.files.storage import default_storage\n\n\ndef update_feed(feed):\n with default_storage.open(feed.file_path, 'w') as output_file:\n if feed.compr...
python
chosen
[ { "from": "system", "value": "Remove deprecated applications adapter code\n" }, { "from": "human", "value": "from __future__ import absolute_import\nfrom __future__ import division\nfrom __future__ import print_function\n\nfrom .. import backend\nfrom .. import layers\nfrom .. import models\nfro...
python
chosen
[ { "from": "system", "value": "Move flask-restful api defs before init_app, since it doesn't work\notherwise with new version of flask-restful\n" }, { "from": "human", "value": "from flask import Flask\n\nfrom raven.contrib.flask import Sentry\nfrom flask_debugtoolbar import DebugToolbarExtension...
python
chosen
[ { "from": "system", "value": "Revert \"Revert \"keep servers running for fun and profit\"\"\n\nThis reverts commit cc7253020251bc96d7d7f22a991b094a60bbc104.\n" }, { "from": "human", "value": "\nimport sys\nimport time\nimport subprocess\n\ndef main(baseCommand, startingPort, count):\n\tprocs = [...
python
chosen
[ { "from": "system", "value": "Fix tests for Django trunk\n" }, { "from": "human", "value": "import os\n\nimport django\nfrom django.conf import settings\n\n\nif not settings.configured:\n settings_dict = dict(\n INSTALLED_APPS=[\n 'django.contrib.contenttypes',\n ...
python
chosen
[ { "from": "system", "value": "Test that filename string can be used with save_image\n" }, { "from": "human", "value": "from io import UnsupportedOperation\nfrom pilkit.exceptions import UnknownFormat, UnknownExtension\nfrom pilkit.utils import extension_to_format, format_to_extension, FileWrappe...
python
chosen
[ { "from": "system", "value": "Set location of source code to version tag.\n" }, { "from": "human", "value": "\n'''\nMAP Client Plugin\n'''\n\n__version__ = '0.1.0'\n__author__ = 'Hugh Sorby'\n__stepname__ = 'Heart Surface'\n__location__ = 'https://github.com/mapclient-plugins/heartsurfacesegment...
python
chosen
[ { "from": "system", "value": "Change module import to squash a code smell\n" }, { "from": "human", "value": "#from requests import get\nfrom heliotron.bridge import Bridge\nfrom heliotron.light import Light\nimport heliotron.presets\n\n__all__ = ['Bridge', 'Light', 'presets']\n" }, { "fr...
python
chosen
[ { "from": "system", "value": "Fix twitter url helper test.\n" }, { "from": "human", "value": "from django.test import TestCase\n\nfrom nose.tools import ok_\n\nfrom mrburns.main import views\n\n\nclass TestViewHelpers(TestCase):\n def test_twitter_share_url_fn(self):\n \"\"\"Should ret...
python
chosen
[ { "from": "system", "value": "var-space-rule: Fix nested JSON obj false positive\n\nWhen using compact form nested JSON object within a\nJinja2 context as shown in the following example:\n set_fact:\"{{ {'test': {'subtest': variable}} }}\"\n\n'variable}}' will raise a false positive [206] error.\n\nThis co...
python
chosen
[ { "from": "system", "value": "Allow specification of multiple subpath_segments\n" }, { "from": "human", "value": "from pyramid.security import has_permission\n\n\ndef includeme(config):\n config.add_view_predicate('subpath_segments', SubpathSegmentsPredicate)\n config.add_view_predicate('a...
python
chosen
[ { "from": "system", "value": "Update description for game types\n" }, { "from": "human", "value": "# -*- coding: utf-8 -*-\n\nTENHOU_HOST = '133.242.10.78'\nTENHOU_PORT = 10080\n\nUSER_ID = 'NoName'\n\nLOBBY = '0'\nWAITING_GAME_TIMEOUT_MINUTES = 10\n\n# in tournament mode bot is not trying to se...
python
chosen
[ { "from": "system", "value": "Fix memebership table creation migration\n" }, { "from": "human", "value": "\"\"\"Add organizations-users association table\n\nRevision ID: 4fdf1059c4ba\nRevises: 393a48ab5fc7\nCreate Date: 2012-09-02 12:37:11.785052\n\"\"\"\n\n# revision identifiers, used by Alembi...
python
chosen