conversations
listlengths
2
3
source
stringclasses
1 value
stack
stringclasses
1 value
[ { "from": "system", "value": "Use in-memory sqlite db for testing.\n" }, { "from": "human", "value": "\"\"\"\nSettings for the test suite\n\"\"\"\n\nfrom .base import *\n" }, { "from": "gpt", "value": "\"\"\"\nSettings for the test suite\n\"\"\"\n\nfrom .base import *\n\nDATABASES = ...
python
chosen
[ { "from": "system", "value": "Fix test for connection made\n" }, { "from": "human", "value": "#!/usr/bin/env python3\n# -*- coding: utf-8 -*-\n\n\"\"\"\ntest_onebot_execute\n----------------------------------\n\nTests for Execute plugin\n\"\"\"\n\nfrom irc3.testing import BotTestCase\n\n\nclass ...
python
chosen
[ { "from": "system", "value": "Fix a broken example script.\n\n* check-modified.py (FORCE_COMPARISON): New variable.\n\n (run): Add FORCE_COMPARISON arg to call to svn_wc_text_modified_p.\n\n\ngit-svn-id: f8a4e5e023278da1e04e203c7fe051e3c4285d88@850428 13f79535-47bb-0310-9956-ffa450edef68\n" }, { "f...
python
chosen
[ { "from": "system", "value": "Make default color not required\n" }, { "from": "human", "value": "from rest_framework import serializers\n\n\nclass Tag(object):\n def __init__(self, name, related_tags, equivalent_names):\n self.name = name\n self.related_tags = related_tags\n ...
python
chosen
[ { "from": "system", "value": "Enforce that our Including Hyperlink includes\n" }, { "from": "human", "value": "\nfrom marshmallow_jsonapi.fields import HyperlinkRelated\nfrom marshmallow_jsonapi.utils import get_value_or_raise\n\n\nclass IncludingHyperlinkRelated(HyperlinkRelated):\n\n def __...
python
chosen
[ { "from": "system", "value": "Remove the check for existence of project since mapreduce API guarantees that.\n\nAlso remove unused imports.\n" }, { "from": "human", "value": "#!/usr/bin/python2.5\n#\n# Copyright 2011 the Melange authors.\n#\n# Licensed under the Apache License, Version 2.0 (the ...
python
chosen
[ { "from": "system", "value": "Add missing return value type hint" }, { "from": "human", "value": "from typing import Any, Callable, Dict, Iterable, Optional, Type\n\nfrom django.core.files.uploadedfile import UploadedFile as DjangoUploadedFile\nfrom pydantic.fields import ModelField\n\n__all__ =...
python
chosen
[ { "from": "system", "value": "Add hook to load CSS\n" }, { "from": "human", "value": "from django.utils.html import format_html\nfrom django.contrib.staticfiles.templatetags.staticfiles import static\nfrom wagtail.wagtailcore import hooks\n\n\n@hooks.register('insert_editor_js')\ndef draftail_ed...
python
chosen
[ { "from": "system", "value": "Add better docstring to simple_discovery\n" }, { "from": "human", "value": "try:\n from urllib import urlretrieve\nexcept ImportError:\n from urllib.request import urlretrieve\n\ntry:\n from urlparse import urlparse\nexcept ImportError:\n from urllib.par...
python
chosen
[ { "from": "system", "value": "Add modes and utils submodules\n" }, { "from": "human", "value": "# used for setup.py\nname = \"ceviche\"\n\n__version__ = '0.0.1'\n\nfrom .fdtd import fdtd\nfrom .fdfd import fdfd_ez, fdfd_hz, fdfd_ez_nl\nfrom .jacobians import jacobian\n\nfrom . import viz\n" },...
python
chosen
[ { "from": "system", "value": "Fix int() error in datetime value\n" }, { "from": "human", "value": "from django import template\nimport datetime\n\nregister = template.Library()\n\n# Turn a datetime.timedelta into a string\n@register.filter(name='timedelta')\ndef timedelta(value):\n if not val...
python
chosen
[ { "from": "system", "value": "Change prod url to https\n" }, { "from": "human", "value": "import json\n\nMAINJS_PATH = 'js/common.js'\nMANIFEST_PATH = 'manifest.json'\nDEV_URL = 'http://localhost:8000'\nPROD_URL = 'http://eyebrowse.csail.mit.edu'\n\n\ndef rewriteBaseUrl():\n with open(MAINJS_PA...
python
chosen
[ { "from": "system", "value": "Remove assert from WagtailPagination.paginate_queryset method\n" }, { "from": "human", "value": "from collections import OrderedDict\n\nfrom django.conf import settings\nfrom rest_framework.pagination import BasePagination\nfrom rest_framework.response import Respon...
python
chosen
[ { "from": "system", "value": "Support Twiggy 0.2 and 0.4 APIs\n" }, { "from": "human", "value": "# vim:ts=4:sw=4:expandtab\n'''A simple logging module that supports various verbosity\nlevels and component-specific subloggers.\n'''\n\nimport sys\nimport time\nfrom twiggy import log as olog, add_e...
python
chosen
[ { "from": "system", "value": "Add TestMainPage using WebTest module\n" }, { "from": "human", "value": "import unittest\nimport requests\n\n\nclass SmokeTest(unittest.TestCase):\n def test_maths(self):\n self.assertEquals(6, 2 + 4)\n\n def test_home_page_is_about_todo_lists(self):\n ...
python
chosen
[ { "from": "system", "value": "Remove unused fopenmp compile args\n" }, { "from": "human", "value": "#!/usr/bin/env python\n\nimport os\n\nfrom skimage._build import cython\n\nbase_path = os.path.abspath(os.path.dirname(__file__))\n\n\ndef configuration(parent_package='', top_path=None):\n fro...
python
chosen
[ { "from": "system", "value": "Add required renderer argument to Widget.render() call\n\nmozilla/sumo-project#136\n" }, { "from": "human", "value": "# Based on http://djangosnippets.org/snippets/1580/\nfrom django import forms\n\n\nclass ImageWidget(forms.FileInput):\n \"\"\"\n A ImageField...
python
chosen
[ { "from": "system", "value": "Change url namespace underscore with -\n" }, { "from": "human", "value": "from django.conf.urls import patterns, url\n\n\nurlpatterns = patterns('projects.views',\n url(r'^add/$', 'add_project', name='add_project'),\n url(r'^edit/(?P<project_id>\\d+)/$', 'edit...
python
chosen
[ { "from": "system", "value": "Remove m2m fields from ctnr edit form\n" }, { "from": "human", "value": "from django import forms\n\nfrom cyder.base.constants import LEVELS\nfrom cyder.base.mixins import UsabilityFormMixin\nfrom cyder.core.ctnr.models import Ctnr\n\n\nclass CtnrForm(forms.ModelFor...
python
chosen
[ { "from": "system", "value": "Add test to reproduce overloaded Tor guard OSSEC alert\n\nA Tor log event indicating that a Tor guard in use is overloaded\ncurrently produces an OSSEC alert. While this alert is an\nexcellent candidate to be sent upstream to FPF for analysis,\nthere is no action that a SecureD...
python
chosen
[ { "from": "system", "value": "Migrate to a custom User class.\n\nStep1: reference the User class, using the AUTH_USER_MODEL setting.\n" }, { "from": "human", "value": "from django.db import models\nfrom django.contrib.auth.models import User\n\n# Create your models here.\n# Create your models he...
python
chosen
[ { "from": "system", "value": "Fix db migration merge conflicts\n" }, { "from": "human", "value": "\"\"\"empty message\n\nRevision ID: 0074_update_sms_rate\nRevises: 0072_add_dvla_orgs\nCreate Date: 2017-04-24 12:10:02.116278\n\n\"\"\"\n\nimport uuid\n\nrevision = '0074_update_sms_rate'\ndown_rev...
python
chosen
[ { "from": "system", "value": "Check for json() ValueError with requests when raising an ApiError in check_error()\n" }, { "from": "human", "value": "from requests import Response\r\n\r\n\r\ndef check_error(response: Response):\r\n \"\"\" Takes a requests package response object and checks the...
python
chosen
[ { "from": "system", "value": "Fix new name for scan tasks\n" }, { "from": "human", "value": "# Copyright (c) 2013-2016 Quarkslab.\n# This file is part of IRMA project.\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may not use this file except in compliance with t...
python
chosen
[ { "from": "system", "value": "Add test_is_coord_on_board() to assert the function returns True if the coordinate is on the board and False otherwise\n" }, { "from": "human", "value": "import engine\n\n\nVALID_COORDS = [(x, y) for x in xrange(97, 105) for y in xrange(49, 57)]\nINVALID_COORDS = [\...
python
chosen
[ { "from": "system", "value": "Add support for Python 3\n" }, { "from": "human", "value": "#!/usr/bin/env python\n# Original author : Jonathan Zempel, https://github.com/jzempel\n# Copied from https://gist.github.com/jzempel/4624227\n# Copied here for the purpose of adding it to PyPI\n\nfrom pkg_...
python
chosen
[ { "from": "system", "value": "Update Layer to use ResourceInfo support class\n" }, { "from": "human", "value": "from urllib2 import HTTPError\nfrom geoserver.support import atom_link, get_xml\nfrom geoserver.style import Style\nfrom geoserver.resource import FeatureType, Coverage\n\nclass Layer:...
python
chosen
[ { "from": "system", "value": "Add a unit test for deterministic ID, with unicode\n" }, { "from": "human", "value": "import datetime as dt\nimport json\n\nimport pytest\nimport pytz\n\nfrom stix2.base import STIXJSONEncoder\n\n\ndef test_encode_json_datetime():\n now = dt.datetime(2017, 3, 22,...
python
chosen
[ { "from": "system", "value": "Add more messages to commandline output\n" }, { "from": "human", "value": "import argparse\nimport logging\nimport Portal\nimport tqdm\n\nlogging.basicConfig(level=logging.INFO)\nlogger = logging.getLogger(__name__)\n\n\nif __name__ == '__main__':\n parser = argp...
python
chosen
[ { "from": "system", "value": "Fix for people without setuptools.\n" }, { "from": "human", "value": "__import__('pkg_resources').declare_namespace(__name__)\ntry:\n\timport modulefinder\n\tfor p in __path__:\n\t\tmodulefinder.AddPackagePath(__name__, p)\nexcept Exception, e:\n\timport warnings\n\...
python
chosen
[ { "from": "system", "value": "Modify crawler to save name of user who contributed an entry\n" }, { "from": "human", "value": "\n#6y7LtOjoNEfe72g62kZfwtFHMWkQ8XsZvcQ8xZDe\n\nimport praw\n\noutfile = open('temp.js', 'w')\n\ncredentials = open('credentials', 'r')\nclient_id = credentials.readline()...
python
chosen
[ { "from": "system", "value": "Update SERIAL_DEVICE to match the Raspberry Pi" }, { "from": "human", "value": "import serial\nimport time\n\n# Define Constants\nSERIAL_DEVICE = \"/dev/tty.usbmodem1421\"\n\n# Establish Connection\nser = serial.Serial(SERIAL_DEVICE, 9600)\ntime.sleep(2)\nprint(\"Co...
python
chosen
[ { "from": "system", "value": "Add empty line for PEP8\n" }, { "from": "human", "value": "from rest_framework import serializers, viewsets, filters\nimport django_filters\n\nfrom democracy.models import Label\nfrom democracy.pagination import DefaultLimitPagination\n\nclass LabelFilter(django_fil...
python
chosen
[ { "from": "system", "value": "Fix bug with collector losing last group of input\n\nThis means the script runner doesn't have to manually finalise the last\ninput, which was always a bit silly. In fact, the whole metaphor is\nrather silly. I should change it to be \"start new group\" instead.\n" }, { ...
python
chosen
[ { "from": "system", "value": "Drop existing products table before creation\n" }, { "from": "human", "value": "# Create a database\n\nimport sqlite3\nimport csv\nfrom datetime import datetime\nimport sys \nreload(sys) \nsys.setdefaultencoding('utf8')\n\nclass createDB():\n\n def readCSV(self...
python
chosen
[ { "from": "system", "value": "Add specific required-property to all arguments\n" }, { "from": "human", "value": "#!/usr/bin/env python\n# -*- coding: utf-8 -*-\n\nimport sys\nimport argparse\n\nfrom Parser import Parser\n\n\ndef main(argv):\n\n # Arguments:\n parser = argparse.ArgumentPars...
python
chosen
[ { "from": "system", "value": "LIKA-106: Add validation to api for missing required values\n" }, { "from": "human", "value": "from ckan.plugins import toolkit as tk\nimport model\nimport ckan.model as ckan_model\n\ndef service_permission_application_create(context, data_dict):\n tk.check_acces...
python
chosen
[ { "from": "system", "value": "Use imports from django_xworkflows instead of imports from xworkflows in tests\n\nSigned-off-by: Raphaël Barrois <8eb3b37a023209373fcd61a2fdc08256a14fb19c@polyconseil.fr>\n" }, { "from": "human", "value": "from django.db import models as djmodels\n\nimport xworkflow...
python
chosen
[ { "from": "system", "value": "Convert unit test to test all registered schemas instead of plugins directly.\n" }, { "from": "human", "value": "from __future__ import unicode_literals, division, absolute_import\n\nimport jsonschema\n\nfrom flexget import config_schema\nfrom flexget import plugin\...
python
chosen
[ { "from": "system", "value": "FIX visibility of forecast button\n\nDefault value for cutoff date is end date of previous fiscal year\n" }, { "from": "human", "value": "# Copyright 2016-2019 Akretion France\n# Copyright 2018-2019 Camptocamp\n# @author: Alexis de Lattre <alexis.delattre@akretion.c...
python
chosen
[ { "from": "system", "value": "Remove unecessary attribute from test" }, { "from": "human", "value": "from django.views.generic.edit import CreateView\n\nfrom templated_email.generic_views import TemplatedEmailFormViewMixin\nfrom tests.generic_views.models import Author\n\n\n# This view send a we...
python
chosen
[ { "from": "system", "value": "Test sending a fresh message\n" }, { "from": "human", "value": "import os\nfrom flask import Flask, request, redirect, session\nimport twilio.twiml\nfrom twilio.rest import TwilioRestClient\nfrom charity import Charity\n\nSECRET_KEY = os.environ['DONATION_SECRET_KEY...
python
chosen
[ { "from": "system", "value": "Add code to remove cached sub-modules on upgrade\n\nThis is untested because I'm too lazy to simulate a package updating\nsituation, but I generally believe it should work. It shouldn't break\nanything, at least.\n" }, { "from": "human", "value": "# Must be named \"...
python
chosen
[ { "from": "system", "value": "Make a better error message for ValidationError\n" }, { "from": "human", "value": "\"\"\"Usage: chronicler [-c CHRONICLE]\n\nThe Chronicler remembers…\n\nOptions:\n -c, --chronicle CHRONICLE chronicle file to use [default: chronicle.hjson]\n\n\"\"\"\nimport doc...
python
chosen
[ { "from": "system", "value": "Fix type hints of brand DTO image fields\n" }, { "from": "human", "value": "\"\"\"\nbyceps.services.brand.transfer.models\n~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\n\n:Copyright: 2006-2020 Jochen Kupperschmidt\n:License: Modified BSD, see LICENSE for details.\n\"\"\"\n...
python
chosen
[ { "from": "system", "value": "Bump version due to PyPI submit error caused by server outage.\n" }, { "from": "human", "value": "from setuptools import setup\n\nsetup(name='pagerduty_events_api',\n version='0.2.0',\n description='Python wrapper for Pagerduty Events API',\n url='htt...
python
chosen
[ { "from": "system", "value": "Remove six from dependency list.\n" }, { "from": "human", "value": "# -*- coding: utf-8 -*-\nimport sys\nfrom setuptools import setup\n\nwith open('README.rst', 'rb') as f:\n long_desc = f.read().decode('utf-8')\n\n# We have to be able to install on Linux to buil...
python
chosen
[ { "from": "system", "value": "Add dep on toolz 0.7.2 for imperative extra\n" }, { "from": "human", "value": "#!/usr/bin/env python\n\nfrom os.path import exists\nfrom setuptools import setup\nimport dask\n\nextras_require = {\n 'array': ['numpy', 'toolz >= 0.7.2'],\n 'bag': ['cloudpickle', 'to...
python
chosen
[ { "from": "system", "value": "Add back download url :/\n" }, { "from": "human", "value": "from setuptools import setup\n\n\nsetup(\n name='pyhunter',\n packages=['pyhunter'],\n version='0.1',\n description='An (unofficial) Python wrapper for the Hunter.io API',\n author='Quentin D...
python
chosen
[ { "from": "system", "value": "PRJ: Increase version 3.1.1 -> 3.1.2\n" }, { "from": "human", "value": "#!/usr/bin/env python\nfrom setuptools import setup, find_packages # This setup relies on setuptools since distutils is insufficient and badly hacked code\n\nversion = '3.1.1'\nauthor = 'David-...
python
chosen
[ { "from": "system", "value": "Allow users to run Step Stool as either `step-stool` or `stepstool`.\n" }, { "from": "human", "value": "from setuptools import setup\n\nrequires = ['Markdown', 'PyRSS2Gen', 'Pygments', 'PyYAML >= 3.10', 'typogrify']\npackages = ['step_stool']\nentry_points = {\n ...
python
chosen
[ { "from": "system", "value": "Add spaces around equal signs.\n" }, { "from": "human", "value": "#!/usr/bin/env python\n# -*- coding: utf-8 -*-\n\"\"\"\n setup.py\n Part of sirup project\n\n (c) 2017 Copyright Rezart Qelibari <rqelibari@users.noreply.github.com>\n\n Licensed under the...
python
chosen
[ { "from": "system", "value": "Raise UnicodeDecodeError exception after logging the exception\n" }, { "from": "human", "value": "\"\"\"Event tracker backend that saves events to a python logger.\"\"\"\n\nfrom __future__ import absolute_import\n\nimport logging\nimport json\n\nfrom django.conf imp...
python
chosen
[ { "from": "system", "value": "Add test helper for creating users\n" }, { "from": "human", "value": "import ujson\nimport unittest\nfrom sqlalchemy import Column, Integer, String, create_engine\nfrom sqlalchemy.orm import sessionmaker\nfrom sqlalchemy.ext.declarative import declarative_base\nfrom...
python
chosen
[ { "from": "system", "value": "Fix tests to now include the questions, which are now in the menu\n" }, { "from": "human", "value": "# -*- coding: utf-8 -*-\n\nfrom __future__ import unicode_literals\n\nfrom aldryn_faq.menu import FaqCategoryMenu\nfrom django.utils.translation import (\n get_la...
python
chosen
[ { "from": "system", "value": "SimpleTree: Include simple tree in regression package\n" }, { "from": "human", "value": "from .base_regression import (ModelRegression as Model,\n LearnerRegression as Learner,\n SklModelRegression as SklMode...
python
chosen
[ { "from": "system", "value": "Use importlib.import_module instead of __import__\n" }, { "from": "human", "value": "\"\"\"\n:py:mod:`pymco.utils`\n---------------------\npython-mcollective utils.\n\"\"\"\n\n\ndef import_class(import_path):\n \"\"\"Import a class based on given dotted import pa...
python
chosen
[ { "from": "system", "value": "Fix path and avi -> mpg.\n" }, { "from": "human", "value": "\nimport unittest\n\n\nclass AnimationTestCase(unittest.TestCase):\n\n def test_video_unload(self):\n # fix issue https://github.com/kivy/kivy/issues/2275\n # AttributeError: 'NoneType' obj...
python
chosen
[ { "from": "system", "value": "Add `clowder status` logic to Cement controller\n" }, { "from": "human", "value": "from cement.ext.ext_argparse import expose\n\nfrom clowder.cli.abstract_base_controller import AbstractBaseController\n\n\nclass StatusController(AbstractBaseController):\n class M...
python
chosen
[ { "from": "system", "value": "Convert atomno to int in case it is a different numpy dtype.\n" }, { "from": "human", "value": "\"\"\"\ncclib (http://cclib.sf.net) is (c) 2006, the cclib development team\nand licensed under the LGPL (http://www.gnu.org/copyleft/lgpl.html).\n\"\"\"\n\n__revision__ ...
python
chosen
[ { "from": "system", "value": "Add post process stage for stray mixin calls\n" }, { "from": "human", "value": "# -*- coding: utf8 -*-\n\"\"\"\n.. module:: lesscpy.plib.deferred\n :synopsis: Deferred mixin call.\n \n Copyright (c)\n See LICENSE for details.\n.. moduleauthor:: Jóhann T....
python
chosen
[ { "from": "system", "value": "Fix pylint error after iati.core -> iati\n" }, { "from": "human", "value": "\"\"\"A top-level namespace package for IATI.\"\"\"\n__import__('pkg_resources').declare_namespace(__name__)\n\nfrom .codelists import Code, Codelist # noqa: F401\nfrom .data import Dataset...
python
chosen
[ { "from": "system", "value": "Disable the effect of %%bohrium if bohrium cannot be imported.\n\nThe first time the user attempts to use %%bohrium a warning will be\nshown. From this point onwards all %%bohrium statements will have no\neffect silently.\n" }, { "from": "human", "value": "#########...
python
chosen
[ { "from": "system", "value": "Add function for plotting feature importances\n" }, { "from": "human", "value": "def get_feature_importances(model):\n\n try:\n return model.feature_importances_\n except:\n pass\n try:\n # Must be 1D for feature importance plot\n ...
python
chosen
[ { "from": "human", "value": "Load the external interface on package import\n\nSet __init__.py so that the useful classes are loaded when the package\nis loaded\n" }, { "from": "gpt", "value": "from .ignitiondelayexp import ExperimentalIgnitionDelay\nfrom .compare_to_sim import compare_to_sim\nfr...
python
chosen
[ { "from": "system", "value": "Write parameterized test for gen schema read function.\n" }, { "from": "human", "value": "# -*- coding: utf-8 -*-\n\"\"\"\nTest parsing genfiles and writing GenSchema to genfiles.\n\nCreated on Sun Jul 10 19:54:47 2016\n\n@author: Aaron Beckett\n\"\"\"\n\n\nimport p...
python
chosen
[ { "from": "system", "value": "Python: Add test we don't handle for `py/request-without-cert-validation`\n" }, { "from": "human", "value": "import requests\n\n#Simple cases\nrequests.get('https://semmle.com', verify=True) # GOOD\nrequests.get('https://semmle.com', verify=False) # BAD\nrequests.po...
python
chosen
[ { "from": "system", "value": "Make reverse migration for lot_type run\n" }, { "from": "human", "value": "# -*- coding: utf-8 -*-\n# Generated by Django 1.11.3 on 2017-07-18 02:15\nfrom __future__ import unicode_literals\n\nfrom django.db import models, migrations\n\nfrom lots.models import LotTy...
python
chosen
[ { "from": "system", "value": "[FIX] mrp_product_variants: Fix MTO configurator not filled\n" }, { "from": "human", "value": "# -*- coding: utf-8 -*-\n# © 2015 Oihane Crucelaegui - AvanzOSC\n# © 2016 Pedro M. Baeza <pedro.baeza@tecnativa.com>\n# License AGPL-3 - See http://www.gnu.org/licenses/ag...
python
chosen
[ { "from": "system", "value": "Enforce verify file on the log file and actually setup the log file logger.\n" }, { "from": "human", "value": "'''\nCLI entry-point for salt-api\n'''\n# Import salt libs\nfrom salt.utils.parsers import (\n ConfigDirMixIn,\n DaemonMixIn,\n LogLevelMixIn,\n ...
python
chosen
[ { "from": "system", "value": "Make the themes module available by default.\n" }, { "from": "human", "value": "#!/usr/bin/env python3\n\n__version__ = '0.1.0'\n\nfrom .widget import *\nfrom .root import *\nfrom .containers import *\nfrom .miscellaneous import *\nfrom . import drawing\n\n" }, ...
python
chosen
[ { "from": "system", "value": "Add EQ related links in offline bot message\n" }, { "from": "human", "value": "import asyncio\nimport os\n\nimport discord\nfrom discord.ext import commands\n\nimport SLA_bot.channelupdater as ChannelUpdater\nimport SLA_bot.config as cf\n\ncurr_dir = os.path.dirna...
python
chosen
[ { "from": "system", "value": "Remove debug printing from test case\n" }, { "from": "human", "value": "\r\nimport os\r\nfrom xml.etree import ElementTree\r\nfrom utils import with_app, pretty_print_xml\r\n\r\n\r\n#=============================================================================\r\n# ...
python
chosen
[ { "from": "system", "value": "Test the failure branch in BaseEntityJSONDecoder\n" }, { "from": "human", "value": "from test_provider_gtfs import provider\n\nfrom busbus.entity import BaseEntityJSONEncoder\n\nimport json\nimport pytest\n\n\n@pytest.fixture(scope='module')\ndef agency(provider):\n...
python
chosen
[ { "from": "system", "value": "Use shortcuts-nightly.json to resolve model shortcuts\n" }, { "from": "human", "value": "# inspired from:\n# https://python-packaging-user-guide.readthedocs.org/en/latest/single_source_version/\n# https://github.com/pypa/warehouse/blob/master/warehouse/__about__.py\...
python
chosen
[ { "from": "system", "value": "Add LabeledImageDataset to datasets module\n" }, { "from": "human", "value": "from chainer.datasets import cifar\nfrom chainer.datasets import dict_dataset\nfrom chainer.datasets import image_dataset\nfrom chainer.datasets import mnist\nfrom chainer.datasets import ...
python
chosen
[ { "from": "system", "value": "Fix 'ImportError: DLL load failed'\n" }, { "from": "human", "value": "# -*- coding: utf-8 -*-\nimport os\nimport sys\nimport ctypes\nimport platform\n\nif platform.system() == 'Windows':\n lib32 = os.path.join(os.path.dirname(__file__), 'lib32')\n lib64 = os.p...
python
chosen
[ { "from": "system", "value": "Revert \"Used relative import for water_supply fixture\"\n\nThis reverts commit 8615f9c9d8a254dc6a43229e0ec8fc68ebe12e08.\n" }, { "from": "human", "value": "#!/usr/bin/env python\n# -*- coding: utf-8 -*-\n\"\"\"Implements example simulation model which can be run fr...
python
chosen
[ { "from": "system", "value": "Fix yamldumper test for both py2/py3\n" }, { "from": "human", "value": "# -*- coding: utf-8 -*-\n'''\n Unit tests for salt.utils.yamldumper\n'''\n\n# Import python libs\nfrom __future__ import absolute_import, print_function, unicode_literals\n\n# Import Salt Lib...
python
chosen
[ { "from": "system", "value": "Update visible_to reference to visible_to_author\n" }, { "from": "human", "value": "from rest_framework import serializers\n\nfrom service.authors.serializers import SimpleAuthorSerializer\nfrom service.comments.serializers import CommentSerializer\nfrom social.app....
python
chosen
[ { "from": "system", "value": "Load source dataset and save transformed dataset\n" }, { "from": "human", "value": "from rsk_mind.datasource import CSVDatasource\n\ndatasource = CSVDatasource('in.csv')\ndataset = datasource.read()\ndataset.setTransformer(1)\ndataset.applyTransformations()\ndatasou...
python
chosen
[ { "from": "system", "value": "Revert \"separate default authentication from the DRF's one\"\n\nThis reverts commit 73aef41ffd2be2fbed11cf75f75393a80322bdcb.\n" }, { "from": "human", "value": "from datetime import timedelta\nfrom django.conf import settings\nfrom django.test.signals import settin...
python
chosen
[ { "from": "system", "value": "Add child_class on list filter PublishableAdmin\n" }, { "from": "human", "value": "#!/usr/bin/env python\n# -*- coding: utf-8 -*-\nfrom django.contrib import admin\nfrom django.utils import timezone\nfrom django.conf import settings\nfrom django.contrib.sites.models...
python
chosen
[ { "from": "system", "value": "Fix pycroft backend displaying wrong finance balance\n\n" }, { "from": "human", "value": "# -*- coding: utf-8 -*-\nfrom __future__ import annotations\nfrom typing import List, Optional\n\nfrom sipa.model.pycroft.unserialize import unserializer\n\n\n@unserializer\ncl...
python
chosen
[ { "from": "system", "value": "Add filters to the talk admin\n\n@logston is reviewing talks and wanted to see the talk duration. He also\nthought it would be useful to be able to filter by the duration and\nstatus of the talk.\n" }, { "from": "human", "value": "\"\"\"Admin for talk-related models...
python
chosen
[ { "from": "system", "value": "Change user_profile so picture can be null\n" }, { "from": "human", "value": "from django.db import models\nfrom django.contrib.auth.models import User\n\n\nclass UserProfile(models.Model):\n user = models.OneToOneField(User)\n description = models.TextField(max_l...
python
chosen
[ { "from": "system", "value": "Add following into user profile\n" }, { "from": "human", "value": "from django.db import models\nfrom django.contrib.auth.models import User\n\nclass UserProfile(models.Model):\n user = models.OneToOneField(User)\n description = models.TextField(max_length=3000)\n...
python
chosen
[ { "from": "system", "value": "Rename from select to map\n" }, { "from": "human", "value": "from six import add_metaclass\n\nfrom rx import Observable\nfrom rx.internal import ExtensionMethod\n\nclass AverageValue(object):\n def __init__(self, sum, count):\n self.sum = sum\n self...
python
chosen
[ { "from": "system", "value": "Remove broken workaround code for old mock.\n\nMock <= 1.0.1 was indeed broken on 3.4, but unittest.mock from 3.4 is\njust as (or more) broken. Mock is now fixed, so don't play games with\nthe global state of the import system.\n\nChange-Id: I5e04b773d33c63d5cf06ff60c321de70de4...
python
chosen
[ { "from": "system", "value": "Fix font test to use unicode font filename for proper loading to allow passing test on windows (and other os's).\n" }, { "from": "human", "value": "#-*- coding: utf-8 -*-\nimport unittest\n\n\nclass FontTestCase(unittest.TestCase):\n\n def setUp(self):\n i...
python
chosen
[ { "from": "system", "value": "Create and use a new base class.\n\nSince all handlers need to implement emit(), this is probably the best route\nforward.\n" }, { "from": "human", "value": "import logging\n\ntry:\n NullHandler = logging.NullHandler\nexcept AttributeError:\n class NullHandler...
python
chosen
[ { "from": "system", "value": "Add line-ends to terminal url regexps.\n\n- This ensures that parameters are not ignored if they do not match the\n regexp.\n\nConflicts:\n\tkirppu/app/urls.py\n" }, { "from": "human", "value": "from django.conf.urls import patterns, url\n\n__author__ = 'jyrkila'\n...
python
chosen
[ { "from": "system", "value": "Remove extra check of symlinks.\n" }, { "from": "human", "value": "import os\nimport io\nimport json\n\nfrom aiohttp import web\n\n\nclass Handler:\n def __init__(self, *, loop):\n self.loop = loop\n\n self.files = {}\n\n def lookup_files(self, p...
python
chosen
[ { "from": "system", "value": "Make DATADIR absolute path agnostic\n" }, { "from": "human", "value": "import os\n\nLOWAGE = 15\nUPAGE = 70\nMAXAGE = 120\n\nDATADIR = '/home/pieter/projects/factors/data'\nINFILE = 'lifedb.xls'\n\nXLSWB = os.path.join(DATADIR, INFILE)\n\nINSURANCE_IDS = ['OPLL', 'N...
python
chosen
[ { "from": "system", "value": "Remove AWS credential (IAM user have already been deleted from AWS)\n" }, { "from": "human", "value": "# AWS_ACCESS_KEY_ID - AWS access key.\n# AWS_SECRET_ACCESS_KEY - AWS secret key. Access and secret key variables override credentials stored in credential and conf...
python
chosen
[ { "from": "system", "value": "Add empty tests with descriptions.\n" }, { "from": "human", "value": "#!/usr/bin/env python\n# -*- coding: utf-8 -*-\n\nimport unittest\n\nfrom spam.preprocess import PreProcess\nfrom spam.common import params\n\n\nclass TestPreProcess(unittest.TestCase):\n \"\"\...
python
chosen
[ { "from": "system", "value": "Add dryrun command line argument\n" }, { "from": "human", "value": "import argparse\n\nparser = argparse.ArgumentParser(description='Migrate toilet codes')\nparser.add_argument(\n 'url', type=str,\n help='The base URL for the django toilet database')\nparser.a...
python
chosen
[ { "from": "system", "value": "Update astropy.time setup to allow using system sofa_c library\n" }, { "from": "human", "value": "import os\nfrom distutils.extension import Extension\n\nTIMEROOT = os.path.relpath(os.path.dirname(__file__))\n\n\ndef get_extensions():\n time_ext = Extension(\n ...
python
chosen
[ { "from": "system", "value": "Debug in prod for a moment\n" }, { "from": "human", "value": "from project.settings_common import *\n\nDEBUG = False\nTEMPLATE_DEBUG = DEBUG\n\n# CACHE\nfrom memcacheify import memcacheify\n\nCACHES = memcacheify()\n\nMIDDLEWARE_CLASSES += (\n 'django.middleware....
python
chosen
[ { "from": "system", "value": "Add indent in json to improve debugging\n" }, { "from": "human", "value": "import json\nfrom relay_api.core.relay import relay\nfrom relay_api.conf.config import relays\n\n\ndef init_relays():\n for r in relays:\n relays[r][\"object\"] = relay(relays[r][\"...
python
chosen