conversations
listlengths
2
3
source
stringclasses
1 value
stack
stringclasses
1 value
[ { "from": "system", "value": "Change formatting of response, add URL\n" }, { "from": "human", "value": "from plugins.util import command, get_url\nimport json\nimport re\n\nSPOTIFY_URI_REGEX = r\"(?<=spotify:)(?:track|album|artist):[a-zA-Z0-9]{22}\"\nENDPOINT = \"https://api.spotify.com/v1/{0}s/...
python
chosen
[ { "from": "system", "value": "Make webhook exempt from CSRF protection\n\nSoon, we will add JWT verification, to replace it.\n" }, { "from": "human", "value": "from django.http import HttpResponse, HttpResponseBadRequest\nfrom django.views.decorators.http import require_POST\nimport json\n\ndef ...
python
chosen
[ { "from": "system", "value": "Add platform dependent time import for best resolution.\n" }, { "from": "human", "value": "import collections\n\n\ndef is_callable(o):\n return isinstance(o, collections.Callable)\n" }, { "from": "gpt", "value": "import collections\nimport sys\n\nif s...
python
chosen
[ { "from": "system", "value": "Fix check_mail helpers extracted from a class\n" }, { "from": "human", "value": "\"\"\"\nhelpers functions for various aspect of eue-ng project\n\"\"\"\n\n\ndef check_mail(self, email):\n \"\"\"\n Verify that the provided email is valid\n \"\"\"\n\n rege...
python
chosen
[ { "from": "system", "value": "Use markitup widget in talk form\n" }, { "from": "human", "value": "from django import forms\nfrom django.core.urlresolvers import reverse\nfrom django.utils.translation import ugettext as _\n\nfrom crispy_forms.bootstrap import FormActions\nfrom crispy_forms.helper...
python
chosen
[ { "from": "system", "value": "Set correct current working version" }, { "from": "human", "value": "#!/usr/bin/env python\n# -*- coding: utf-8 -*-\n\n\"\"\"\njournal\nCopyright (c) 2011 Matt Behrens <askedrelic@gmail.com>\nhttp://asktherelic.com\n\nA CLI tool to help with keeping a datetime organ...
python
chosen
[ { "from": "system", "value": "ListCommand: Remove __init__ method, not needed.\n" }, { "from": "human", "value": "#!/usr/bin/env python\n# -*- coding: utf-8 -*-\n\nfrom optparse import make_option\nfrom optparse import OptionParser\nfrom scaffolder.core.commands import BaseCommand\nfrom scaffold...
python
chosen
[ { "from": "system", "value": "Remove OperationalError and ProgrammingError imports\n" }, { "from": "human", "value": "# -*- coding: utf-8 -*-\n# Generated by Django 1.11.22 on 2019-10-31 16:33\nfrom __future__ import unicode_literals\n\nfrom django.db import migrations, OperationalError, Program...
python
chosen
[ { "from": "system", "value": "Fix minor typo in doc string in test support mopule\n\nSigned-off-by: Christopher Arndt <711c73f64afdce07b7e38039a96d2224209e9a6c@chrisarndt.de>\n" }, { "from": "human", "value": "\"\"\"Sets up network on MicroPython board with Wiznet 5500 ethernet adapter attached ...
python
chosen
[ { "from": "system", "value": "Add variable lines and columns\n" }, { "from": "human", "value": "import sys\nfrom random import randint\n\nf = open('input', 'w')\n\nif (len(sys.argv) < 2):\n print('python3 generate_input.py <n>')\n sys.exit()\n\nn = int(sys.argv[1])\n\nf.write(str(n)+'\\n')...
python
chosen
[ { "from": "system", "value": "Bump version 0.17.2rc11 --> 0.18.0rc1\n\nSigned-off-by: Jack Robison <40884020c67726395ea162083a125620dc32cdab@lbry.io>\n" }, { "from": "human", "value": "import logging\n\n__version__ = \"0.17.2rc11\"\nversion = tuple(__version__.split('.'))\n\nlogging.getLogger(__...
python
chosen
[ { "from": "system", "value": "Update score lookup to not load dataset file" }, { "from": "human", "value": "import json\n\n\"\"\" Input: the path of the dataset file, a list of song and line indices\n Output: List of tuples of words with highest tf-idf scores\n Given a list of song-line tu...
python
chosen
[ { "from": "system", "value": "Remove import logging. This file is now identical to the branch point.\n" }, { "from": "human", "value": "# Copyright 2009-2010 by Ka-Ping Yee\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may not use this file except in compliance w...
python
chosen
[ { "from": "system", "value": "Change wording for voucher form test\n\nI was confused by what the test does, and had to ask @codeinthehole to\nexplain. Hopefully made it's intention a bit clearer now.\n" }, { "from": "human", "value": "from django import test\n\nfrom oscar.apps.dashboard.vouchers...
python
chosen
[ { "from": "system", "value": "Add whitespace between title and text for search index.\n" }, { "from": "human", "value": "import re\n\nfrom django.test.client import RequestFactory\nfrom django.template import RequestContext\n\nfrom haystack import indexes\n\nfrom cms import models as cmsmodels\n...
python
chosen
[ { "from": "system", "value": "Change version number to 0.3.0.1\n" }, { "from": "human", "value": "__version__ = '0.3.0a'\n\n# This list defines all the modules that will be loaded if a user invokes\n# from climLab import *\n\n# totally out of date!\n\n#__all__ = [\"constants\", \"thermo\", \"...
python
chosen
[ { "from": "system", "value": "Remove obsolete load_rules definition, FLTD-196\n" }, { "from": "human", "value": "#!/usr/bin/python\n# -*- coding: utf-8 -*-\n\"\"\"Plugin utilities\"\"\"\n\nfrom domains import NavigatorDomain, navigator_domains, node, nodes\nfrom dataimport import Converter, crea...
python
chosen
[ { "from": "system", "value": "Make naming the destination file work\n" }, { "from": "human", "value": "'''\nMinion side functions for salt-ftp\n'''\nimport os\n\ndef recv(files, dest):\n '''\n Used with salt-ftp, pass the files dict, and the destination\n '''\n if not os.path.isdir(d...
python
chosen
[ { "from": "system", "value": "Enable versioning during unit tests\n" }, { "from": "human", "value": "import sys\nimport os\n\nsys.path.insert(0, os.curdir)\n\n\nimport unittest\n\nimport clusto\n\nimport ConfigParser\n\nDB='sqlite:///:memory:'\nECHO=False\n\nclass ClustoTestResult(unittest.TestR...
python
chosen
[ { "from": "system", "value": "Update for pydocstyle 2.0.0 compatibility\n\nFix klen/pylama#96\n\nAdding the newer ignore_decorators argument. Thanks to @not-raspberry for the tip!\n" }, { "from": "human", "value": "\"\"\"pydocstyle support.\"\"\"\n\nfrom pydocstyle import PEP257Checker\n\nfrom p...
python
chosen
[ { "from": "system", "value": "test(auth): Fix tests for new header\n" }, { "from": "human", "value": "import pytest\n\nfrom zeus import factories\nfrom zeus.auth import AuthenticationFailed\nfrom zeus.api.authentication import ApiTokenAuthentication\n\n\ndef test_no_header(app):\n with app.te...
python
chosen
[ { "from": "system", "value": "Fix bug with document merger\n" }, { "from": "human", "value": "from ofxclient.client import Client\nfrom StringIO import StringIO\n\n\ndef combined_download(accounts, days=60):\n \"\"\"Download OFX files and combine them into one\n\n It expects an 'accounts' ...
python
chosen
[ { "from": "system", "value": "Allow level param in Django SentryHandler.__init__\n\nFor consistency with superclass and with logging.Handler\n" }, { "from": "human", "value": "\"\"\"\nraven.contrib.django.handlers\n~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\n\n:copyright: (c) 2010-2012 by the Sentry Team, se...
python
chosen
[ { "from": "system", "value": "Fix south introspection rule for custom AssetField\n" }, { "from": "human", "value": "from django.db.models.fields.related import ForeignKey\n\nfrom .forms import AssetField\n\n\nclass AssetKey(ForeignKey):\n\n def formfield(self, **kwargs):\n kwargs['form...
python
chosen
[ { "from": "system", "value": "Update Flame Leviathan to use draw script\n" }, { "from": "human", "value": "from ..utils import *\n\n\n##\n# Minions\n\n# Snowchugger\nclass GVG_002:\n\tevents = Damage().on(\n\t\tlambda self, target, amount, source: source is self and Freeze(target)\n\t)\n\n\n# Go...
python
chosen
[ { "from": "system", "value": "Update the reporter interface to even track the total runtime\n\nPiperOrigin-RevId: 160982468\n" }, { "from": "human", "value": "\"\"\"An interface to report the status of emulator launches.\"\"\"\n\nfrom __future__ import absolute_import\nfrom __future__ import div...
python
chosen
[ { "from": "system", "value": "Add more data to the api\n" }, { "from": "human", "value": "from rest_framework import serializers\n\nfrom frigg.projects.models import Project\n\nfrom .models import Build, BuildResult\n\n\nclass ProjectInlineSerializer(serializers.ModelSerializer):\n\n class Me...
python
chosen
[ { "from": "system", "value": "Use compat basestring for id validation\n" }, { "from": "human", "value": "from marshmallow import fields, ValidationError\n\nfrom .exceptions import IncorrectTypeError\n\n__all__ = ('StubObject',)\n\n# ---------------------------------------------------------------...
python
chosen
[ { "from": "system", "value": "Add new added test cases to travis.\n" }, { "from": "human", "value": "# -*- coding: utf-8 -*-\n'''module for unit test and task for CI'''\nimport sys\nimport unittest\n\nfrom yatest import testpost, testpage, testutility, testconfig\n\nif __name__ == '__main__':\n ...
python
chosen
[ { "from": "system", "value": "Fix server not being created properly.\n" }, { "from": "human", "value": "\"\"\"\nAsphalt framework mixin for Kyokai.\n\"\"\"\nimport logging\n\nimport asyncio\nfrom functools import partial\nfrom typing import Union\n\nfrom asphalt.core import Component, resolve_re...
python
chosen
[ { "from": "system", "value": "Fix potential bug in build dependencies script. If you gave it ' use module,only: ...' before it would not work.\n" }, { "from": "human", "value": "#!/usr/bin/env python\n\nimport glob\n\ndependencies = {}\n\nfor src in glob.iglob('*.F90'):\n module = src.strip('...
python
chosen
[ { "from": "system", "value": "Add a class for a known error that prevents implementation.\n\nSigned-off-by: mulhern <7b51bcf507bcd7afb72bf8663752c0ddbeb517f6@redhat.com>\n" }, { "from": "human", "value": "\"\"\"\nError heirarchy for stratis cli.\n\"\"\"\n\nclass StratisCliError(Exception):\n ...
python
chosen
[ { "from": "system", "value": "Refactor Chip8 to use a Memory instance." }, { "from": "human", "value": "\n\nclass Memory(object):\n def __init__(self):\n self._stream = [0x00] * 4096\n\n def __len__(self):\n return len(self._stream)\n\n def read_byte(self, address):\n ...
python
chosen
[ { "from": "system", "value": "Add basic test for example Pynini FST.\n" }, { "from": "human", "value": "import unittest\n\nclass TestStringMethods(unittest.TestCase):\n\n def test_upper(self):\n self.assertEqual('foo'.upper(), 'FOO')\n\nif __name__ == '__main__':\n unittest.main()\n...
python
chosen
[ { "from": "system", "value": "Comment out yuglify search path" }, { "from": "human", "value": "from .project import *\nimport os\n\nALLOWED_HOSTS = ['*']\n\nDATABASES = {\n 'default': {\n 'ENGINE': 'django.contrib.gis.db.backends.postgis',\n 'NAME': 'gis',\n 'USER': os.en...
python
chosen
[ { "from": "system", "value": "Add a hook for nova.cmd.spicehtml5proxy\n\nThe cmd/ folders are excluded from the autohelp imports to avoid ending\nup with a bunch of CLI options. nova/cmd/spicehtml5proxy.py holds real\nconfiguration options and needs to be imported.\n\nChange-Id: Ic0f8066332a45cae253ad3e03f4...
python
chosen
[ { "from": "system", "value": "Make compatible with python 2.4\n \nhashlib was added in python 2.5, but just using the md5() method so fall back\nto md5.md5() if we can't import hashlib\n" }, { "from": "human", "value": "import hashlib\nimport bisect\n\n\nserverRing = None\n\n\nclass ConsistentH...
python
chosen
[ { "from": "system", "value": "Remove repetition for secret key setting\n" }, { "from": "human", "value": "import os\r\n\r\n\r\nBASEDIR = os.path.abspath(os.path.dirname(__file__))\r\nSECRET_KEY = 'secret'\r\n\r\nclass Config(object):\r\n DEBUG = False\r\n TESTING = False\r\n SECRET_KEY ...
python
chosen
[ { "from": "system", "value": "Add links list to response serializer\n" }, { "from": "human", "value": "from rest_framework import serializers\n\nfrom folder.models import Folder\nfrom link.serializers import LinkSerializer\n\n\nclass FolderSerializer(serializers.ModelSerializer):\n\n class Me...
python
chosen
[ { "from": "system", "value": "Create an example firewall rule push with the antivirus enablement.\n" }, { "from": "human", "value": "#!env python\n#License upload using FORTIOSAPI from Github\n\nimport sys\nfrom fortiosapi import FortiOSAPI\nimport json\n\ndef main():\n\n # Parse for command ...
python
chosen
[ { "from": "system", "value": "Fix invalid templatetag function register.\n" }, { "from": "human", "value": "# -*- coding: utf-8 -*-\n\nfrom .. import utils\n\ntry:\n from django_jinja.base import Library\n jinja_register = Library()\n jinja_register.global_function(\"sites_resolve\", ut...
python
chosen
[ { "from": "system", "value": "Add a test for PowersOf.\n" }, { "from": "human", "value": "#!/usr/bin/env python\nimport django_prometheus\nimport unittest\n\n\n# TODO(korfuri): Add real tests. For now, this is just a placeholder\n# to set up a testing system.\nclass DjangoPrometheusTest(unittest...
python
chosen
[ { "from": "system", "value": "Use the correct option name\n" }, { "from": "human", "value": "from mercury.common.configuration import MercuryConfiguration\n\nDEFAULT_CONFIG_FILE = 'mercury-inventory.yaml'\n\n\ndef parse_options():\n configuration = MercuryConfiguration(\n 'mercury-inve...
python
chosen
[ { "from": "system", "value": "Make residual connections work for list-valued inputs\n" }, { "from": "human", "value": "from .model import Model\nfrom ...api import layerize\nfrom .affine import Affine\n\n\nclass Residual(Model):\n def __init__(self, layer):\n Model.__init__(self)\n ...
python
chosen
[ { "from": "system", "value": "Add constructing homer command to module level functions\n" }, { "from": "human", "value": "# -*- coding: utf-8 -*-\n\n__author__ = 'Olga Botvinnik'\n__email__ = 'olga.botvinnik@gmail.com'\n__version__ = '0.1.0'\n\nfrom .pyhomer import ForegroundBackgroundPair" },...
python
chosen
[ { "from": "system", "value": "Fix: Use Manager to annotate vote count\n" }, { "from": "human", "value": "import json\n\nfrom django import template\nfrom django.utils.html import format_html\nfrom rest_framework.renderers import JSONRenderer\n\nfrom .. import serializers\n\nregister = template.L...
python
chosen
[ { "from": "system", "value": "Add render_comment_list / render_comment_form stub tags for Django\n" }, { "from": "human", "value": "\"\"\"\nA simple wrapper library, that makes sure that the template\n``fluent_blogs/entry_detail/comments.html`` can still be rendered\nwhen ``django.contrib.commen...
python
chosen
[ { "from": "system", "value": "Add todo in the test_update_jitsi_timeout so it's easier to find in the future\n" }, { "from": "human", "value": "import pytest\n\n\n@pytest.mark.skip(\n reason=\"Broken in 5.0. https://github.com/RocketChat/Rocket.Chat/issues/26520\"\n)\ndef test_update_jitsi_ti...
python
chosen
[ { "from": "system", "value": "Fix for when the event gets deleted before the recurring event or recurring event exclusion\n" }, { "from": "human", "value": "from django.db.models.signals import post_save, post_delete\nfrom .models import RecurringEvent, RecurringEventExclusion\n\n\ndef update_ev...
python
chosen
[ { "from": "system", "value": "Insert automatically flatpage default site\n" }, { "from": "human", "value": "# -*- coding: utf-8 -*-\nfrom django.contrib import admin\nfrom django.contrib.flatpages.models import FlatPage\nfrom django.contrib.flatpages.admin import FlatPageAdmin as StockFlatPageAd...
python
chosen
[ { "from": "system", "value": "Put the endpoint at /launch_taskflow/launch\n\nPut it here instead of under \"queues\"\n\nSigned-off-by: Patrick Avery <743342299f279e7a8c3ff5eb40671fce3e95f13a@kitware.com>\n" }, { "from": "human", "value": "from .configuration import Configuration\nfrom girder.uti...
python
chosen
[ { "from": "system", "value": "Undo & redo of add SceneNode now correctly set the previous selection state.\n\nCURA-640\n" }, { "from": "human", "value": "# Copyright (c) 2015 Ultimaker B.V.\n# Uranium is released under the terms of the AGPLv3 or higher.\n\nfrom . import Operation\n\nfrom UM.Scen...
python
chosen
[ { "from": "system", "value": "Fix python3 ctypes str usage\n\nIn python3, the string is likely to be unicode and incompatible\nwith the libc function. If it isn't bytes, force it to be bytes.\n" }, { "from": "human", "value": "from ctypes import *\nfrom ctypes.util import find_library\nimport g...
python
chosen
[ { "from": "system", "value": "Undo premature fix for dependency\n" }, { "from": "human", "value": "# -*- coding: utf-8 -*-\nfrom __future__ import unicode_literals\n\n\"\"\"\nGoogle OpenID auth has been turned off, so any associations that\nusers had to their Google accounts via Google OpenID ar...
python
chosen
[ { "from": "system", "value": "Change deprecated options_list to add_arguments\n" }, { "from": "human", "value": "from django.core.management.base import BaseCommand\nfrom recommends.tasks import recommends_precompute\n\nfrom datetime import datetime\nimport dateutil.relativedelta\nfrom optparse ...
python
chosen
[ { "from": "system", "value": "Revert \"temp stop twitter scraping\"\n\nThis reverts commit 21db824f3b2a544fa38547bb1fd6c6271f861354.\n" }, { "from": "human", "value": "import os\nimport sys\nfrom .new_news_check import is_new_flash_news\nfrom .news_flash_crawl import news_flash_crawl\nfrom ..mda...
python
chosen
[ { "from": "system", "value": "Add test for creation of multiple rooms\n" }, { "from": "human", "value": "import unittest\nfrom src.dojo import Dojo\n\n\nclass TestCreateRoom (unittest.TestCase):\n def test_create_room_successfully(self):\n my_class_instance = Dojo()\n initial_ro...
python
chosen
[ { "from": "system", "value": "Fix call to super for py2.7\n" }, { "from": "human", "value": "from django.views.debug import SafeExceptionReporterFilter\nfrom raven.contrib.django.client import DjangoClient\n\n\nclass SensitiveDjangoClient(DjangoClient):\n \"\"\"\n Hide sensitive request da...
python
chosen
[ { "from": "system", "value": "Use equal matcher for remaining keys\n" }, { "from": "human", "value": "from __future__ import absolute_import\nfrom __future__ import division\nfrom __future__ import unicode_literals\n\nfrom testtools import matchers\nfrom spreadflow_core.test.matchers import Matc...
python
chosen
[ { "from": "system", "value": "Change function name to be more accurate\n" }, { "from": "human", "value": "import os\nimport sys\nsys.path.insert(0, os.path.dirname(os.path.dirname(os.path.abspath(__file__))))\n\nimport re\n\n\ndef simple_prettifier(scraped_data):\n \"\"\"Return more presentab...
python
chosen
[ { "from": "system", "value": "Handle when an OpenSSL error doesn't contain a reason\n\n(Or any other field)\n\nYou can reproduce the error by running:\n\n```\ntreq.get('https://nile.ghdonline.org')\n```\n\nfrom within a twisted program (and doing the approrpiate deferred stuff).\n\nI'm unsure how to craft a...
python
chosen
[ { "from": "system", "value": "Update to 1.8 way of getting model name.\n" }, { "from": "human", "value": "from django.core.urlresolvers import reverse\nfrom generic.admin.mixins import ThumbnailAdminMixin\nimport settings\n\ndef admin_link(obj):\n return \"<a href='%s'>%s</a>\" % (admin_url(o...
python
chosen
[ { "from": "system", "value": "Use SiteFeed to get a category listing\n" }, { "from": "human", "value": "# encoding: utf-8\n\"\"\"\nList categories and their IDs in a Discourse forum.\n\"\"\"\n\nimport os\nfrom argparse import ArgumentParser\nfrom urllib.parse import urljoin\nimport requests\n\n\...
python
chosen
[ { "from": "system", "value": "Remove integer ID in Telemetry model\n" }, { "from": "human", "value": "from tsserver import db\nfrom tsserver.dtutils import datetime_to_str\n\n\nclass Telemetry(db.Model):\n \"\"\"\n All the data that is going to be obtained in regular time intervals\n (e...
python
chosen
[ { "from": "system", "value": "Use proper content-type for all files\n" }, { "from": "human", "value": "import logging\nlogger = logging.getLogger(__name__)\n\nfrom django.http import Http404\nfrom django.views.generic import TemplateView\n\nimport settings\n\n\nclass VerificationView(TemplateVie...
python
chosen
[ { "from": "system", "value": "Set new file to read-only\n\nSince the new file does not prompt about file changes when closed, if\nthe user were to edit the new file and close without saving, their\nchanges would be lost forever. By setting the new file to be read-only,\nthe user will not be able to make cha...
python
chosen
[ { "from": "system", "value": "Update PM version to 1.4.5\n" }, { "from": "human", "value": "'''\n### Polemarch is ansible based service for orchestration infrastructure.\n\n* [Documentation](http://polemarch.readthedocs.io/)\n* [Issue Tracker](https://gitlab.com/vstconsulting/polemarch/issues)\n...
python
chosen
[ { "from": "system", "value": "Put the type unwrapping into a separat method\n" }, { "from": "human", "value": "from topaz.objects.objectobject import W_Object\nfrom topaz.module import ClassDef\nfrom topaz.modules.ffi.type import W_TypeObject\nfrom topaz.error import RubyError\nfrom topaz.coerce...
python
chosen
[ { "from": "system", "value": "Rename TranslationInline to TranslationStackedInline, add TranslationTabularInline.\n" }, { "from": "human", "value": "from django.contrib import admin\n\nfrom .forms import TranslationFormSet\nfrom . import settings\n\n\nclass TranslationInline(admin.StackedInline)...
python
chosen
[ { "from": "system", "value": "Fix changed CommonMark syntax (?)\n" }, { "from": "human", "value": "from django.utils.safestring import mark_safe\nimport CommonMark\n\n\n# Convert a markdown string into HTML5, and prevent Django from escaping it\ndef mdToHTML(value):\n\tparser = CommonMark.DocPar...
python
chosen
[ { "from": "system", "value": "Use os.sep for splitting directories\n\nSigned-off-by: Seth Buntin <7fa3258757ee476d85f026594ec3f1563305da2c@gmail.com>" }, { "from": "human", "value": "import os\nfrom git import *\n\nfrom django.conf import settings\n\ndef get_repos():\n repos = [get_repo(dir) ...
python
chosen
[ { "from": "system", "value": "Add some state related methods to Game\n" }, { "from": "human", "value": "import datetime\n\nimport map_loader\n\n\nclass Game(object):\n def __init__(self, name=name, players=players, map=None):\n \"\"\" Initialize a new game. \"\"\"\n\n self.name ...
python
chosen
[ { "from": "system", "value": "Implement NotNonterminalEception __init__ method and pass object\n" }, { "from": "human", "value": "#!/usr/bin/env python\r\n\"\"\"\r\n:Author Patrik Valkovic\r\n:Created 23.06.2017 16:39\r\n:Licence GNUv3\r\nPart of grammpy\r\n\r\n\"\"\"\r\n\r\nfrom .GrammpyExcepti...
python
chosen
[ { "from": "system", "value": "Adjust test for new functionality.\n" }, { "from": "human", "value": "from django.test import TestCase\n\nfrom django_tablib import ModelDataset, Field\n\nfrom .models import TestModel\n\n\nclass DjangoTablibTestCase(TestCase):\n def setUp(self):\n TestMod...
python
chosen
[ { "from": "system", "value": "Add another blank line to fix flake8 check\n" }, { "from": "human", "value": "# -*- coding: utf-8 -*-\n\nimport locale\nimport codecs\nimport pytest\n\nfrom cookiecutter.compat import PY3\n\n@pytest.mark.skipif(not PY3, reason='Only necessary on Python3')\ndef test_...
python
chosen
[ { "from": "system", "value": "Move model init into pytest fixture to avoid loading model and downloading graph just by importing the test module\n" }, { "from": "human", "value": "from __future__ import absolute_import, division, print_function\n\nimport pytest\n\nimport tensorflow as tf\nfrom l...
python
chosen
[ { "from": "system", "value": "Configure Celery correctly in smoketest\n" }, { "from": "human", "value": "import unittest\n\nfrom celery import Celery\nfrom django.conf import settings\nfrom django.db import connection\n\n\nclass SmokeTests(unittest.TestCase):\n\n def setUp(self):\n pas...
python
chosen
[ { "from": "system", "value": "Tag to get all categories\n" }, { "from": "human", "value": "from django import template\nfrom blanc_basic_events.events.models import Event\n\nregister = template.Library()\n\n\n@register.assignment_tag\ndef get_events():\n return Event.objects.all().prefetch_re...
python
chosen
[ { "from": "system", "value": "Make SessionKeyValueStore variable names clearer\n" }, { "from": "human", "value": "from xblock.runtime import KeyValueStore, InvalidScopeError\n\n\nclass SessionKeyValueStore(KeyValueStore):\n def __init__(self, request, model_data):\n self._model_data = ...
python
chosen
[ { "from": "system", "value": "Extend patchup for builtin excel dialect\n" }, { "from": "human", "value": "#!/usr/bin/env python\n# -*- coding: utf-8 -*-\n\"\"\"\n openslides.utils.csv_ext\n ~~~~~~~~~~~~~~~~~~~~~~~~\n\n Additional dialect definitions for pythons CSV module.\n\n :copyr...
python
chosen
[ { "from": "system", "value": "Fix test failures comparing with \"Bitcoin\".\n" }, { "from": "human", "value": "#! /usr/bin/python3\nimport pprint\nimport tempfile\nfrom counterpartylib.test import conftest # this is require near the top to do setup of the test suite\nfrom counterpartylib.test.f...
python
chosen
[ { "from": "system", "value": "Update Expert Databases columns in the footer\n" }, { "from": "human", "value": "\"\"\"\nCopyright [2009-2015] EMBL-European Bioinformatics Institute\nLicensed under the Apache License, Version 2.0 (the \"License\");\nyou may not use this file except in compliance w...
python
chosen
[ { "from": "system", "value": "Add a comment / clarfification.\n" }, { "from": "human", "value": "# Licensed to the StackStorm, Inc ('StackStorm') under one or more\n# contributor license agreements. See the NOTICE file distributed with\n# this work for additional information regarding copyright...
python
chosen
[ { "from": "system", "value": "Update for luacheck >= 0.11.0\n\n* Remove 'channel' from default ignore list.\n* Remove SublimeLinter inline options, use luacheck inline options.\n* Use `--ranges` to highlight tokens correctly.\n* Use `--codes` to distinguish warnings from errors.\n* Use `--filename` to apply...
python
chosen
[ { "from": "system", "value": "Fix whitespace in docs in ping_several_hosts\n" }, { "from": "human", "value": "from platform import system as system_name\nfrom os import system as system_call\n\n\ndef ping_several_hosts(hosts_list):\n \"\"\" Ping all hosts in hosts_list and return dict with st...
python
chosen
[ { "from": "system", "value": "Make a test more secure\n\nChoose a random filename to avoid overwriting a file.\n" }, { "from": "human", "value": "from regr_test import run\n\nfrom subprocess import check_output\nimport os\n\n\ndef test_source():\n script = 'test_env.sh'\n var_name, var_val...
python
chosen
[ { "from": "system", "value": "Set permenent to True in utils.signin_user method.\n" }, { "from": "human", "value": "# coding: utf-8\nfrom flask import session\nfrom ..models import User\n\n\ndef signin_user(user, permenent):\n \"\"\"Sign in user\"\"\"\n session.permanent = permenent\n s...
python
chosen
[ { "from": "system", "value": "Create a view and start it\n" }, { "from": "human", "value": "#! /usr/bin/env python\n\nimport dbus\nfrom dbus.mainloop.glib import DBusGMainLoop\n\nDBusGMainLoop(set_as_default=True)\n\nbus = dbus.SessionBus()\nbus.start_service_by_name(\"com.intel.Mojito\")\n\nmoj...
python
chosen
[ { "from": "system", "value": "Add exception for empty db search return\n" }, { "from": "human", "value": "\"\"\" Errors generated by this module\n\"\"\"\n\n\nclass ConfigException(Exception):\n pass\n\n\nclass FillValueException(Exception):\n \"\"\" All of a tile is \"fill\" values\n \"...
python
chosen
[ { "from": "system", "value": "cqlsh: Add extension handler for \"scylla_encryption_options\"\n\nRefs #731\n\nScylla encryption options are not stored with \"normal\" options.\nBecause these are 100% intertwined with drivers, and adding\nstuff there breaks things.\n\nInstead they are extensions. The python d...
python
chosen
[ { "from": "system", "value": "Swap hitzer inverse test to use np.testing\n\n" }, { "from": "human", "value": "import numpy as np\nimport pytest\n\nimport clifford as cf\n\n\nclass TestClosedForm:\n\n @pytest.mark.parametrize('p, q', [\n (p, total_dims - p)\n for total_dims in [1...
python
chosen
[ { "from": "system", "value": "Update pi-montecarlo example to use `sum` again.\n" }, { "from": "human", "value": "# encoding: utf-8\n# ---------------------------------------------------------------------------\n# Copyright (C) 2008-2014, IPython Development Team and Enthought, Inc.\n# Distrib...
python
chosen
[ { "from": "system", "value": "Add support for a --builtin argument to importlib.test to trigger running\nimport-specific tests with __import__ instead of importlib.\n" }, { "from": "human", "value": "import os.path\nfrom test.support import run_unittest\nimport unittest\n\n\ndef test_main():\n ...
python
chosen
[ { "from": "system", "value": "Set the frame id to what aderk expects.\n\n(See a corresponding change to ads.html in reddit)\n" }, { "from": "human", "value": "from pylons import c, g\n\nfrom r2.lib.pages import Ads as BaseAds\n\n\nclass Ads(BaseAds):\n def __init__(self):\n BaseAds.__i...
python
chosen
[ { "from": "system", "value": "Fix an intermittent axiom test failure that occurs only in certain environments.\n\nFixes #2857\n\nAuthor: glyph\n\nReviewer: exarkun, mithrandi\n\nThis change fixes `axiom.test.historic.test_processor1to2.ProcessorUpgradeTest.test_pollingRemoval` to wait until its processor ha...
python
chosen
[ { "from": "system", "value": "Create home and accounts stub view\n\nSigned-off-by: Bas Westerbaan <1d31d94f30d40df7951505d1034e1e923d02ec49@westerbaan.name>\n" }, { "from": "human", "value": "from django.http import HttpResponse\n\ndef home(request):\n\treturn HttpResponse(\"Hi\")\n" }, { ...
python
chosen
[ { "from": "system", "value": "Add serialization sentintels for import table\n" }, { "from": "human", "value": "from thinglang.compiler.opcodes import MEMBERS, METHODS, FRAME_SIZE, ARGUMENTS\nfrom thinglang.compiler.opcodes import Opcode\n\n\nclass SentinelThingDefinition(Opcode):\n \"\"\"\n ...
python
chosen
[ { "from": "system", "value": "Fix error when saving the claim to the wallet.\n" }, { "from": "human", "value": "import json\nimport logging\n\nclass ClaimParser(object):\n \"\"\"\n Parses a generic claim.\n \"\"\"\n def __init__(self, claim: str) -> None:\n self.__logger = loggi...
python
chosen
[ { "from": "system", "value": "Add ordering to Extension model\n" }, { "from": "human", "value": "from django.db import models\nfrom django.template.loader import render_to_string\n\nfrom normandy.recipes.models import Recipe\n\n\nclass Extension(models.Model):\n name = models.CharField(max_le...
python
chosen
[ { "from": "system", "value": "Set minify to False as well as sometimes setting it to True.\n" }, { "from": "human", "value": "from functools import wraps\n\nfrom flask import current_app, request\n\n\ndef minifiable(f):\n @wraps(f)\n def wrapped_f(*args, **kwargs):\n format_ = reque...
python
chosen