conversations
listlengths
2
3
source
stringclasses
1 value
stack
stringclasses
1 value
[ { "from": "system", "value": "Set app host to 0.0.0.0\n" }, { "from": "human", "value": "import os\nfrom horus.apps import create_app\n\n\nconfig_file = os.path.join(os.path.dirname(os.path.realpath(__file__))\n , 'config.py')\napp = create_app(config_file)\n\n\nif __na...
python
chosen
[ { "from": "system", "value": "Change to get a dict with the relay instances\n" }, { "from": "human", "value": "from flask import Flask, jsonify\n\nserver = Flask(__name__)\n\n\ndef get_relays(relays):\n return jsonify({\"relays\": relays}), 200\n\n\ndef get_relay(relays, relay_name):\n cod...
python
chosen
[ { "from": "system", "value": "Add load config function to Sheldon class\n" }, { "from": "human", "value": "# -*- coding: utf-8 -*-\n\n\"\"\"\n@author: Seva Zhidkov\n@contact: zhidkovseva@gmail.com\n@license: The MIT license\n\nCopyright (C) 2015\n\"\"\"\n\nfrom sheldon.adapter import *\nfrom she...
python
chosen
[ { "from": "system", "value": "Set the default URL to point to index.html.\n" }, { "from": "human", "value": "from django.conf.urls import patterns, include, url\nfrom django.contrib import admin\n\n# See: https://docs.djangoproject.com/en/dev/ref/contrib/admin/#hooking-adminsite-instances-into-y...
python
chosen
[ { "from": "system", "value": "Update conditional else branch tests\n" }, { "from": "human", "value": "import pytest\n\nfrom thinglang.runner import run\n\n\ndef test_simple_conditionals():\n assert run(\"\"\"\nthing Program\n does start\n if \"dog\" eq \"dog\"\n Output.wr...
python
chosen
[ { "from": "system", "value": "playback: Use translate_uri() instead of change_track()\n" }, { "from": "human", "value": "from __future__ import unicode_literals\n\nimport logging\n\nfrom mopidy import backend\n\nimport pykka\n\nfrom .client import BeetsRemoteClient\nfrom .library import BeetsLib...
python
chosen
[ { "from": "system", "value": "Set Textarea width and height\n" }, { "from": "human", "value": "from django import forms\nfrom django.conf import settings\nfrom django.forms import ModelForm\nfrom ansible.models import Playbook\n\nclass AnsibleForm1(ModelForm):\n class Meta:\n model = P...
python
chosen
[ { "from": "system", "value": "Remove intersphinx extension from documentation.\n" }, { "from": "human", "value": "import os\n\nimport maec\n\nproject = u'python-maec'\ncopyright = u'2014, The MITRE Corporation'\nversion = maec.__version__\nrelease = version\n\nextensions = [\n 'sphinx.ext.aut...
python
chosen
[ { "from": "system", "value": "Add colored time in output\n" }, { "from": "human", "value": "# This Source Code Form is subject to the terms of the Mozilla Public\n# License, v. 2.0. If a copy of the MPL was not distributed with this\n# file, You can obtain one at http://mozilla.org/MPL/2.0/.\n\n...
python
chosen
[ { "from": "system", "value": "Fix a few syntax errors\n" }, { "from": "human", "value": "import ConfigParser\nimport os\n\ndef class ConfigDlstats(object):\n \"\"\"Cross platform configuration file handler.\n\n This class manages dlstats configuration files, providing\n easy access to t...
python
chosen
[ { "from": "system", "value": "Make the one-step backend a little more robust with custom users.\n" }, { "from": "human", "value": "\"\"\"\nA one-step (user signs up and is immediately active and logged in)\nworkflow.\n\n\"\"\"\n\nfrom django.contrib.auth import authenticate, get_user_model, logi...
python
chosen
[ { "from": "system", "value": "Make templates to return relative path\n" }, { "from": "human", "value": "import typing\n\nfrom jinja2 import Undefined, contextfunction, escape\nfrom starlette.templating import Jinja2Templates\n\n\ndef render_ql_nickname(nickname):\n nickname = str(escape(nickn...
python
chosen
[ { "from": "system", "value": "Bump dev version to 1.6 after releasing 1.5\n" }, { "from": "human", "value": "__version_info__ = (1, 5, 1, None)\n\n\n# Dot-connect all but the last. Last is dash-connected if not None.\n__version__ = '.'.join([str(i) for i in __version_info__[:-1]])\nif __version_...
python
chosen
[ { "from": "system", "value": "Fix template name on entry home page (/) on detail page\n" }, { "from": "human", "value": "#!/usr/bin/env python\n# -*- coding: utf-8 -*-\n\nfrom django.views.generic.detail import DetailView\nfrom django.views.generic.list import ListView\n\nfrom opps.article.model...
python
chosen
[ { "from": "system", "value": "Delete using deprecated fnc in test\n" }, { "from": "human", "value": "# -*- coding: utf-8 -*-\nimport codecs\nimport os\n\nimport grab\n\nfrom src import htmltoreadable as hr\n\n\ndef test():\n g = grab.Grab()\n g.go('http://habrahabr.ru/post/266293/')\n r...
python
chosen
[ { "from": "system", "value": "Update exmple for node position in new RGG interface.\n" }, { "from": "human", "value": "import networkx as nx\nimport matplotlib.pyplot as plt\n\nG=nx.random_geometric_graph(200,0.125)\npos=G.pos # position is stored as member data for random_geometric_graph\n\n# f...
python
chosen
[ { "from": "system", "value": "Handle inplace generation of __config__.\n" }, { "from": "human", "value": "#!/usr/bin/env python\n\ndef configuration(parent_package='',top_path=None):\n from numpy.distutils.misc_util import Configuration\n config = Configuration('numpy',parent_package,top_p...
python
chosen
[ { "from": "system", "value": "Set parallel to 1000 because supervisor + ulimit = fail\n" }, { "from": "human", "value": "# Source Server Stats\n# File: sourcestats/settings.py\n# Desc: settings for the Flask server\n\nDEBUG = True\n\n# Number of servers to collect from in parallel\nPARALLEL = 40...
python
chosen
[ { "from": "system", "value": "Add OCA as author of OCA addons\n\nIn order to get visibility on https://www.odoo.com/apps the OCA board has\ndecided to add the OCA as author of all the addons maintained as part of the\nassociation.\n" }, { "from": "human", "value": "# -*- coding: utf-8 -*-\n#####...
python
chosen
[ { "from": "system", "value": "Add test if compile() raises an CompilationError\n" }, { "from": "human", "value": "\"\"\"\nTest the high-level compile function\n\n\"\"\"\nimport unittest\n\nfrom six import StringIO\n\nfrom lesscpy import compile\n\n\nclass TestCompileFunction(unittest.TestCase):\...
python
chosen
[ { "from": "system", "value": "Update the docstring for the mapper to reflect what it does correctly.\n" }, { "from": "human", "value": "# Copyright 2013 the Melange authors.\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may not use this file except in compliance ...
python
chosen
[ { "from": "system", "value": "Add a requires on python-six 1.4.0 ( for add_metaclass )\n\nThis also mean that this doesn't run on RHEL 7 as of today.\n" }, { "from": "human", "value": "#!/usr/bin/env python\n\nimport sys\n\nfrom ansible import __version__\ntry:\n from setuptools import setup,...
python
chosen
[ { "from": "system", "value": "Add log filename to sample settings for tests.\n" }, { "from": "human", "value": "SECRET_KEY = 'Set the secret_key to something unique and secret.'\nCLIENT_ID = 'xxxxxxx'\nCLIENT_SECRET = 'yyyyyyyyyyyyyyyyyy'\n" }, { "from": "gpt", "value": "SECRET_KEY =...
python
chosen
[ { "from": "system", "value": "Add some more proper noun tests\n\nFixes #35.\n" }, { "from": "human", "value": "\nfrom jargonprofiler.util import tag_proper_nouns\nfrom jargonprofiler.munroe import munroe_score\n\n\ndef test_proper_noun_in_sentance():\n assert tag_proper_nouns(\"My name is Eil...
python
chosen
[ { "from": "system", "value": "Change variable name 'buffer' -> 'buffer_' to avoid conflict with python keyword\n" }, { "from": "human", "value": "from abc import ABCMeta, abstractmethod\n\nclass Searcher(object):\n\t__metaclass__ = ABCMeta\n\n\nclass IndexSearcher(Searcher):\n\tpass\n\nclass Dat...
python
chosen
[ { "from": "system", "value": "Add usage section to docstring for string_replace\n" }, { "from": "human", "value": "# -*- coding: utf-8 -*-\n\nimport re\n\n\ndef string_replace(text, key_dict):\n \"\"\"\n A function to convert text in a string to another string if\n it matches any of the...
python
chosen
[ { "from": "system", "value": "Add arg parser to balancing script\n" }, { "from": "human", "value": "#!/usr/bin/env python\nfrom __future__ import division, print_function\nfrom multiprocessing import Pool\n\nimport numpy as np\nimport h5py\n\nimport cooler\nimport cooler.ice\n\nN_CPUS = 5\n\nif ...
python
chosen
[ { "from": "system", "value": "Add logger for junebug backend\n" }, { "from": "human", "value": "from __future__ import unicode_literals\nimport os\n\n# import our default settings\nfrom settings_production import * # noqa\n\nPODS[0]['contact_id_fieldname'] = os.environ.get( # noqa: F405\n '...
python
chosen
[ { "from": "system", "value": "Use local import for local files." }, { "from": "human", "value": "from django.conf.urls import url\nfrom django.conf import settings\n\nfrom views import serve_private_file\n\nurlpatterns = [\n url(r'^{0}(?P<path>.*)$'.format(settings.PRIVATE_MEDIA_URL.lstrip('/...
python
chosen
[ { "from": "system", "value": "Fix jinja loader on Py3\n" }, { "from": "human", "value": "\"\"\"Genshi template loader that supports dotted names.\"\"\"\n\nfrom os.path import exists, getmtime\n\nfrom jinja2.exceptions import TemplateNotFound\nfrom jinja2.loaders import FileSystemLoader\n\nfrom t...
python
chosen
[ { "from": "system", "value": "Add Game.process_input use to example code\n" }, { "from": "human", "value": "from vengeance.game import Direction\nfrom vengeance.game import Game\nfrom vengeance.game import Location\n\ngo_up = Direction('up')\ngo_down = Direction('down')\ngo_up.opposite = go_down...
python
chosen
[ { "from": "system", "value": "Implement selecting template by quick panel\n" }, { "from": "human", "value": "import sublime\nimport sublime_plugin\n\n\nclass ProjectTemplateCommand(sublime_plugin.WindowCommand):\n\n SETTINGS_FILE_NAME = 'ProjectTemplate.sublime-settings'\n TEMPLATES_KEY = ...
python
chosen
[ { "from": "system", "value": "Correct location of bracket so that grouping by beta loops is done correctly.\n" }, { "from": "human", "value": "'''Utility procedures for manipulating HANDE data.'''\n\nimport numpy as np\n\ndef groupby_beta_loops(data):\n '''Group a HANDE DMQMC data table by be...
python
chosen
[ { "from": "system", "value": "Add 'session-list' to constants list.\n" }, { "from": "human", "value": "from django.core.urlresolvers import reverse\nfrom django.shortcuts import redirect\nfrom kolibri.auth.models import DeviceOwner\n\n\nALLOWED_PATH_LIST = [\n \"facility-list\",\n \"device...
python
chosen
[ { "from": "system", "value": "Add the tests app to the INSTALLED_APPS.\n" }, { "from": "human", "value": "SECRET_KEY = 'p&grn73^$c!ae=o)igek_rn2t#(_sb9g1kqwxcpv16-ie__1=1'\n\nDEBUG = True\n\nTEMPLATE_DEBUG = True\n\nINSTALLED_APPS = (\n 'django.contrib.admin',\n 'django.contrib.auth',\n ...
python
chosen
[ { "from": "system", "value": "Add function to enqueue e-mails to be sent asynchronously rather than blocking/sending synchronously\n" }, { "from": "human", "value": "\"\"\"\nbyceps.services.email.service\n~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\n\n:Copyright: 2006-2017 Jochen Kupperschmidt\n:License: Modi...
python
chosen
[ { "from": "system", "value": "Add python script for IPs discovery\n" }, { "from": "human", "value": "#!/usr/bin/python\n#\n# Get private IPv4s for a given instance name.\n#\nimport boto\nimport boto.ec2\nimport getopt\nimport sys\n\n\n#\n# Get the profile\n#\ndef connect(region):\n profile = ...
python
chosen
[ { "from": "system", "value": "Add product field to ReviewForm\n" }, { "from": "human", "value": "from django import forms\n\nfrom .models import Review\n\n\nclass ReviewForm(forms.models.ModelForm):\n name = forms.CharField(\n max_length=30,\n widget=forms.TextInput(\n ...
python
chosen
[ { "from": "system", "value": "Kill an Unused import - thanks to @landscapeio\n" }, { "from": "human", "value": "\"\"\"\nStandalone test runner for wardrounds plugin\n\"\"\"\nimport os\nimport sys\nfrom opal.core import application\n\nclass Application(application.OpalApplication):\n pass\n\nf...
python
chosen
[ { "from": "system", "value": "Fix syntax of previous commit\n" }, { "from": "human", "value": "from setuptools import setup\n\nsetup(\n name=\"chem\",\n version=\"0.1.1\",\n packages=[\"chem\"],\n install_requires=[\n \"pyparsing==2.0.1\",\n \"numpy==1.6.2\",\n \...
python
chosen
[ { "from": "system", "value": "Return sheets, not header, data\n" }, { "from": "human", "value": "\"\"\" This library works for some ods files but not others. Because it doesn't\nwork consistently, we have disabled this for the moment.\"\"\"\n\nimport ezodf\nfrom ..utilities import data_populatio...
python
chosen
[ { "from": "system", "value": "Use protoc for file output\n" }, { "from": "human", "value": "#!/usr/bin/env python\n\nimport plugin_pb2\n\nfrom jinja2 import Template\nfrom pkg_resources import resource_string\n\nimport os.path\nimport sys\nimport tempfile\n\n\ndef main():\n log = sys.stderr\n\n...
python
chosen
[ { "from": "system", "value": "Update relative path with respect to __file__\n" }, { "from": "human", "value": "import argparse, shutil, os\nimport ue4util\ndef install_plugin(project_file, plugin_folder):\n project_folder = os.path.dirname(project_file)\n install_folder = os.path.join(proj...
python
chosen
[ { "from": "system", "value": "Revert \"Update timeout to 10 seconds\"\n\nThis reverts commit e7cb98a1006d292a96670a11c807d0bbf9075ebd.\n" }, { "from": "human", "value": "from collections import OrderedDict\n\nACTORS = list('NRAIOVF')\n\nFILE_COMMANDS = ['copy', 'compare']\n\nVERBOSITY = OrderedD...
python
chosen
[ { "from": "system", "value": "Improve performance of db import utility\n" }, { "from": "human", "value": "from django.core.management.base import BaseCommand\n\n\nclass Command(BaseCommand):\n args = ''\n help = ('Load house sales data from a CSV and save it into DB')\n\n def handle(sel...
python
chosen
[ { "from": "system", "value": "Add tests for different types of phred offsets\n" }, { "from": "human", "value": "#!/usr/bin/env python\n\nimport numpy as np\nfrom unittest import TestCase, main\nfrom skbio.format.sequences.fastq import (format_fastq_record,\n ...
python
chosen
[ { "from": "system", "value": "Fix syntax for Python 2.6 - no set literals.\n" }, { "from": "human", "value": "\"\"\"Utilities for working with Python source files.\n\nExposes various functions from recent Python standard libraries, along with\nequivalents for older Python versions.\n\"\"\"\nimpo...
python
chosen
[ { "from": "system", "value": "Update test for changed filename\n" }, { "from": "human", "value": "from __future__ import absolute_import, print_function\n\nfrom ..pyautoupdate.launcher import Launcher\nfrom .pytest_skipif import needinternet\nfrom .pytest_makevers import fixture_update_dir, crea...
python
chosen
[ { "from": "system", "value": "mandrill: Fix hardcoded check for settings.VOYAGER.\n\nSince this delayed sending feature is the only thing\nsettings.MANDRILL_API_KEY is used for, it seems reasonable for that to\nbe the gate as to whether we actually use Mandrill.\n" }, { "from": "human", "value":...
python
chosen
[ { "from": "system", "value": "Fix merge conflict and also check for equal eval loss\n" }, { "from": "human", "value": "import unittest\nimport time\nimport pandas as pd\nfrom bert_trainer import BERTTrainer\nfrom utils import *\n\nclass TestBERT(unittest.TestCase):\n\n def test_init(self):\n ...
python
chosen
[ { "from": "system", "value": "Set CF_STACK environment variable in compile tests\n" }, { "from": "human", "value": "import os\nfrom build_pack_utils import BuildPack\nfrom common.integration import DirectoryHelper\nfrom common.integration import OptionsHelper\n\n\nclass BaseCompileApp(object):\n...
python
chosen
[ { "from": "system", "value": "Fix help docstring and glob parsing\n" }, { "from": "human", "value": "#!/usr/bin/env python\nimport argparse\nimport glob\n\nfrom pytrthree import TRTHIterator\nfrom corintick import Corintick, ValidationError\n\n\ndef main(args):\n db = Corintick(args.config)\n...
python
chosen
[ { "from": "system", "value": "Handle RequestLimitExceeded the same way as Throttling response\n" }, { "from": "human", "value": "import time\nimport logging\n\nfrom botocore.exceptions import ClientError\n\nfrom zmon_aws_agent import __version__\n\n\nMAX_RETRIES = 10\nTIME_OUT = 0.5\n\nlogger = ...
python
chosen
[ { "from": "system", "value": "Add XOR approach for finding missing element\n\nAdd approach for finding the missing element in the second list by performing a series of XOR operations." }, { "from": "human", "value": "import collections\r\n\r\n# Problem:\r\n# Consider an array of non-negative int...
python
chosen
[ { "from": "system", "value": "Print real and fitted coeffs\n" }, { "from": "human", "value": "#!/usr/bin/env python\n\nfrom __future__ import division\n\nimport numpy as np\nfrom matplotlib import pyplot as plt\n\n\n\ndef main():\n koeffs = [.3, 1.2, .1, 7]\n p = np.poly1d(koeffs)\n x =...
python
chosen
[ { "from": "system", "value": "Set up database according to environment\n" }, { "from": "human", "value": "import peewee\n\ndb = peewee.PostgresqlDatabase('ivle_bot_test', user='postgres')\n\nclass IBModel(peewee.Model):\n class Meta:\n database = db\n\nclass User(IBModel):\n user_id...
python
chosen
[ { "from": "system", "value": "Revise top-level parse function to return ASTNode\n\n" }, { "from": "human", "value": "from .languages import SPPF, make_sppf\nfrom .linguify_grammar import linguify_grammar_file\n\nfrom viper.lexer import Lexeme\n\nfrom os.path import join, dirname\nfrom typing imp...
python
chosen
[ { "from": "system", "value": "Make repository source optional in cli\n" }, { "from": "human", "value": "import argparse\nimport sys\n\nfrom .generator import Generator\nfrom .repository import Repository\n\n\ndef run(args=sys.argv[1:]):\n parser = argparse.ArgumentParser()\n parser.add_arg...
python
chosen
[ { "from": "system", "value": "Add subparser for run analytics commands\n" }, { "from": "human", "value": "import argparse\n\nparser = argparse.ArgumentParser(prog='moocx', description='EdX MOOC Data Anaylysis')\nparser.add_argument('-v', '--version', action='version', version='0.1.0')\n\nsubpars...
python
chosen
[ { "from": "system", "value": "Fix formatting and remove unused imports\n" }, { "from": "human", "value": "# coding: utf8\nfrom __future__ import unicode_literals, print_function\n\nfrom os import path\nfrom ..language import Language\nfrom ..lemmatizer import Lemmatizer\nfrom ..vocab import Voca...
python
chosen
[ { "from": "system", "value": "Make subsequent runs only update resources\n" }, { "from": "human", "value": "#!/usr/bin/python\n# -*- coding: utf-8 -*-\nimport os\n\nfrom collector.acled_africa import generate_urls\nfrom collector.parser import parse\nfrom collector.register import create_dataset...
python
chosen
[ { "from": "system", "value": "Use less ridiculous value of ydigmax specified via plsyax. This works\nwell (i.e., gives non-exponential notation for the Y axis) with the\nrecent pldprec change in pldtik.c which removes the ceiling on digfix and\nsimply sets it to digmax.\n\nsvn path=/trunk/; revision=10608\...
python
chosen
[ { "from": "system", "value": "Use patch.object for python 2 compat\n" }, { "from": "human", "value": "from os.path import join\nimport sublime\nimport sys\nfrom unittest import TestCase\nfrom unittest.mock import patch\n\nversion = sublime.version()\n\ntry:\n from libsass import pathutils\nex...
python
chosen
[ { "from": "system", "value": "Make argument params of list methods consistent\n\nThe argument type \"params\" is not consistent between list methods of\ncompute service clients. This patch makes them consistent.\n\nPartially implements blueprint consistent-service-method-names\n\nChange-Id: I9c7c3034b5273de...
python
chosen
[ { "from": "system", "value": "Handle serial values on temporary table creation\n\nDo not copy serial columns because they will be generated automatically\nif and only they are omitted from the insert().select_from().\n" }, { "from": "human", "value": "\"\"\"\nCopy a table.\n\n\"\"\"\nfrom sqlalc...
python
chosen
[ { "from": "human", "value": "Complete day 2 part 2\n" }, { "from": "gpt", "value": "import re\n\n\n# box_list will contain tuples in the format: (length, width, height)\nbox_list = []\n\nregex = re.compile(r'^(\\d+)x(\\d+)x(\\d+)$')\n\nwith open('day-2-input.txt', 'r') as f:\n for line in f:\...
python
chosen
[ { "from": "system", "value": "Fix progress bar to be 80-col-friendly.\n" }, { "from": "human", "value": "from termcolor import colored\n\ndef section(msg):\n print(colored(\"\\n::\", \"blue\", attrs=[\"bold\"]), colored(msg, attrs=[\"bold\"]))\ndef task(msg):\n print(colored(\"==>\", \"gre...
python
chosen
[ { "from": "system", "value": "Use RunPython operation to perform data migration.\n" }, { "from": "human", "value": "# -*- coding: utf-8 -*-\nfrom __future__ import unicode_literals\n\nfrom django.db import models, migrations\n\n\nclass Migration(migrations.Migration):\n\n dependencies = [\n ...
python
chosen
[ { "from": "system", "value": "Update get_time to use a circuit breaker.\n" }, { "from": "human", "value": "\"\"\" app.py \"\"\"\n\nfrom flask import Flask, render_template\nimport requests\n\n\napp = Flask(__name__)\n\n\ndef get_time():\n try:\n response = requests.get('http://localhos...
python
chosen
[ { "from": "system", "value": "Add proxy fix as in lr this will run with reverse proxy\n" }, { "from": "human", "value": "import os\nimport logging\nfrom flask import Flask\nfrom flask.ext.basicauth import BasicAuth\nfrom flask.ext.sqlalchemy import SQLAlchemy\n\napp = Flask(__name__)\n\napp.conf...
python
chosen
[ { "from": "system", "value": "Add a getter for a Decorator's Scene Node\n" }, { "from": "human", "value": "# Copyright (c) 2015 Ultimaker B.V.\n# Uranium is released under the terms of the AGPLv3 or higher.\n\nclass SceneNodeDecorator():\n def __init__(self):\n super().__init__()\n ...
python
chosen
[ { "from": "system", "value": "Fix order fields in signup form\n" }, { "from": "human", "value": "from django import forms\n\nimport account.forms\n\n\nclass SignupForm(account.forms.SignupForm):\n\n first_name = forms.CharField()\n last_name = forms.CharField()\n email_confirm = forms.E...
python
chosen
[ { "from": "system", "value": "Fix fastapi example flake8 error\n" }, { "from": "human", "value": "\"\"\"Endpoints module.\"\"\"\n\nfrom dependency_injector.wiring import Provide\n\nfrom .containers import Container\n\n\nasync def index(\n query: str = Provide[Container.config.default.quer...
python
chosen
[ { "from": "system", "value": "Add in-memory geohash cache for reverse geocoding.\n" }, { "from": "human", "value": "import geopy\n\nfrom rate_limiter import RateLimiter\n\n\nclass Geocoder(object):\n def __init__(self, api_key=None, client_id=None, secret_key=None):\n if api_key:\n ...
python
chosen
[ { "from": "system", "value": "[AC-9046] Add another constraint for the url\n" }, { "from": "human", "value": "# Generated by Django 2.2.10 on 2021-11-05 12:29\n\nfrom django.db import migrations\nfrom django.db.models.query_utils import Q\n\n\ndef update_url_to_community(apps, schema_editor):\n ...
python
chosen
[ { "from": "system", "value": "Update Dev back to v0.18.0b\n" }, { "from": "human", "value": "# This is the only location where the version will be written and changed.\n# Based on https://packaging.python.org/single_source_version/\n__version__ = '0.17.1'\n" }, { "from": "gpt", "valu...
python
chosen
[ { "from": "system", "value": "Fix validity assertion and add another.\n" }, { "from": "human", "value": "\nimport logging\nimport sys\n\nfrom shapely.geometry import mapping, shape\n\nfrom fiona import collection\n\n\nlogging.basicConfig(stream=sys.stderr, level=logging.INFO)\n\nwith collection(...
python
chosen
[ { "from": "system", "value": "Fix error in Request ID regex \n\nFix error in Request ID regex that breaks correct WAF identification.\r\nChanged 15 to 35, because 15 symbols between date and 'pre>' is not enough for this signature.\r\n\r\nSample of WAF block response:\r\n<h1>Forbidden</h1><pre>Request ID: 2...
python
chosen
[ { "from": "system", "value": "Install github verison of boto in aws cookbook (for now)\n" }, { "from": "human", "value": "\nimport os\nfrom kokki import *\n\n# Package(\"python-boto\")\nExecute(\"pip install git+http://github.com/boto/boto.git#egg=boto\",\n not_if = 'python -c \"import boto\"...
python
chosen
[ { "from": "system", "value": "Add import for test discovery prior to Django 1.6\n" }, { "from": "human", "value": "from .test_backends import AuthBackendTestCase\nfrom .test_clients import OAuthClientTestCase, OAuth2ClientTestCase\nfrom .test_context_processors import AvailableProvidersTestCase\...
python
chosen
[ { "from": "system", "value": "Refactor formatting of save name.\n" }, { "from": "human", "value": "import os\nimport matplotlib.pyplot as plt\n\n\ndef save_all_figs(directory='./', fmt=None, default_name='untitled%i'):\n \"\"\"Save all open figures.\n\n Each figure is saved with the title ...
python
chosen
[ { "from": "system", "value": "Fix virtual-stb intermittant test-failure on Travis\n\ntest_that_virtual_stb_configures_stb_tester_for_testing_virtual_stbs fails\nintermittently on Travis because sometimes chrome takes longer than 10s to\nstart-up. This causes the test to fail with:\n\n> MatchTimeout: Didn't...
python
chosen
[ { "from": "system", "value": "Make dev server visible across internal network\n" }, { "from": "human", "value": "#!venv/bin/python\nfrom app import app\nif __name__ == '__main__':\n app.run()\n" }, { "from": "gpt", "value": "#!venv/bin/python\nfrom app import app\nif __name__ == '...
python
chosen
[ { "from": "system", "value": "Fix exception on dates older then 1970\n" }, { "from": "human", "value": "import time\nfrom rest_framework import serializers\n\n\nclass TimeStampField(serializers.Field):\n def to_internal_value(self, data):\n pass\n\n def to_representation(self, value...
python
chosen
[ { "from": "system", "value": "Add ability to define abstract options classes\n\nOnly actual options should be added to the options dict of OptionMeta. This\npatch adds a abstract kwarg to the OptionMeta class, that allows declare, if an\noption is abstract and should therefore not be added.\n" }, { ...
python
chosen
[ { "from": "system", "value": "Fix use of Context for dj1.11\n" }, { "from": "human", "value": "import copy\nimport os\n\nfrom django.conf import settings\nfrom django.template import Context\nfrom django.test import override_settings\n\n\nHERE = os.path.dirname(__file__)\n\n\ndef template_path(p...
python
chosen
[ { "from": "system", "value": "Use a bit better regex for XML error workaround, actually failable compile\n" }, { "from": "human", "value": "import xml.etree.ElementTree as ET\nfrom os import path\n\nfrom tmc.exercise_tests.basetest import BaseTest, TestResult\n\n\nclass CheckTest(BaseTest):\n\n ...
python
chosen
[ { "from": "system", "value": "Mark master branch as 2.0.0 development branch" }, { "from": "human", "value": "# This file is protected via CODEOWNERS\n__version__ = \"1.26.0.dev0\"\n" }, { "from": "gpt", "value": "# This file is protected via CODEOWNERS\n__version__ = \"2.0.0.dev0\"\...
python
chosen
[ { "from": "system", "value": "Add main_image to BlogPost API response.\n" }, { "from": "human", "value": "from apps.bluebottle_utils.serializers import SorlImageField, SlugHyperlinkedIdentityField\nfrom django.contrib.auth.models import User\nfrom fluent_contents.rendering import render_placehol...
python
chosen
[ { "from": "system", "value": "Store more pings per transaction\n" }, { "from": "human", "value": "import datetime\n\nfrom django.core.management.base import BaseCommand, CommandError\n\nfrom clowder_account.models import Company\nfrom clowder_server.emailer import send_alert\nfrom clowder_server...
python
chosen
[ { "from": "system", "value": "Add fix for non pages like search.\n" }, { "from": "human", "value": "from django import template\nfrom django.db.models import ObjectDoesNotExist\n\nfrom jobs.models import JobPostingListPage\n\nregister = template.Library()\n\n\n@register.simple_tag(takes_context=...
python
chosen
[ { "from": "system", "value": "Update DAX per 2021-06-24 changes\n" }, { "from": "human", "value": "# Copyright (c) 2012-2017, Mark Peek <mark@peek.org>\n# All rights reserved.\n#\n# See LICENSE file for full license.\n\nfrom . import AWSObject, AWSProperty\nfrom .validators import boolean\n\n\nc...
python
chosen
[ { "from": "system", "value": "Return name instead of unicode in autocomplete API\n" }, { "from": "human", "value": "import json\n\nfrom django.http import HttpResponse\nfrom django.views.generic import View\nfrom django.views.generic.detail import SingleObjectMixin\n\nfrom tx_highered.models imp...
python
chosen
[ { "from": "system", "value": "Modify super class of InvalidDataError\n" }, { "from": "human", "value": "# encoding: utf-8\n\n\"\"\"\n.. codeauthor:: Tsuyoshi Hombashi <gogogo.vm@gmail.com>\n\"\"\"\n\nfrom __future__ import absolute_import\n\n\nclass ValidationError(Exception):\n \"\"\"\n R...
python
chosen
[ { "from": "system", "value": "Add test for subpoint() longitude correctness\n" }, { "from": "human", "value": "from numpy import abs\n\nfrom skyfield.api import load\nfrom skyfield.toposlib import Topos\n\nangle = (15, 25, 35, 45)\n\ndef ts():\n yield load.timescale()\n\ndef test_beneath(ts, ...
python
chosen
[ { "from": "system", "value": "Test does start a mongo instance.\n" }, { "from": "human", "value": "import unittest\nimport logging\nlogging.basicConfig()\nlogger = logging.getLogger()\n\nfrom checks.db.mongo import MongoDb\n\nclass TestMongo(unittest.TestCase):\n def setUp(self):\n sel...
python
chosen
[ { "from": "system", "value": "Add a column in the search index for the list of projects.\n" }, { "from": "human", "value": "import datetime\nfrom haystack import indexes\nfrom haystack import site\nimport mysite.profile.models\nfrom django.db.models import Q\n\nclass PersonIndex(indexes.SearchIn...
python
chosen
[ { "from": "system", "value": "Add import links for MultiHeadedAttention and prepare_self_attention\n" }, { "from": "human", "value": "# coding: utf8\nfrom __future__ import unicode_literals\n\nfrom .neural._classes.convolution import ExtractWindow # noqa: F401\nfrom .neural._classes.attention i...
python
chosen
[ { "from": "system", "value": "Print out ENVys with newlines for envy list\n" }, { "from": "human", "value": "from cloudenvy.envy import Envy\n\n\nclass EnvyList(object):\n \"\"\"List all ENVys in context of your current project\"\"\"\n\n def __init__(self, argparser):\n self._build_...
python
chosen
[ { "from": "system", "value": "Add search fields to stock models\n" }, { "from": "human", "value": "from django.contrib import admin\nfrom .models import *\n\nclass StockReportAdmin(admin.ModelAdmin):\n model = StockReport\n list_display = ['date', 'type', 'form_id']\n list_filter = ['da...
python
chosen