conversations
listlengths
2
3
source
stringclasses
1 value
stack
stringclasses
1 value
[ { "from": "system", "value": "Tweak the help text for the new tooltip attribute." }, { "from": "human", "value": "# Copyright (c) Jupyter Development Team.\n# Distributed under the terms of the Modified BSD License.\n\n\"\"\"Contains the DOMWidget class\"\"\"\n\nfrom traitlets import Unicode\nfr...
python
chosen
[ { "from": "system", "value": "Fix gomp library dynamic loading issues\n\n* bug introduce from commit : 4a4676258bfd47a7fbefc51644eb58ffc60ab6ad\n" }, { "from": "human", "value": "'''\nOpenMP wrapper using a (user provided) libgomp dynamically loaded library\n'''\n\nimport sys\nimport glob\nimpor...
python
chosen
[ { "from": "system", "value": "Fix to typing of loop variables\n" }, { "from": "human", "value": "\nimportant: Set[str] = {\"Albert Einstein\" , \"Alan Turing\"}\ntexts: Dict[str, str] = input() # {\"<author >\" : \"<t e x t >\"}\n\nfreqdict: Dict[str, int] = {} # defaultdict(int) err: int r...
python
chosen
[ { "from": "system", "value": "Test commit push and pull\n" }, { "from": "human", "value": "# To change this license header, choose License Headers in Project Properties.\n# To change this template file, choose Tools | Templates\n# and open the template in the editor.\n\nif __name__ == \"__main__...
python
chosen
[ { "from": "system", "value": "Add hipster full-stop to the front-page\n" }, { "from": "human", "value": "SITE_NAME = 'Porick'\nWELCOME_TEXT = '''Porick is yet another IRC Quotes web application, designed to replace <i>Chirpy!</i>'''\nHOMEPAGE_BUTTON_TEXT = 'Start browsing'\nQUOTES_PER_PAGE = 10\...
python
chosen
[ { "from": "system", "value": "Switch authenticator to migrate back to Django style passwords\n" }, { "from": "human", "value": "from django.contrib.auth.backends import ModelBackend\nfrom django.contrib.auth.models import User\nfrom hashlib import sha1\n\n\nclass SimpleHashModelBackend(ModelBack...
python
chosen
[ { "from": "system", "value": "Use hardcoded path for ISB-CGC-Common\n" }, { "from": "human", "value": "import os\nimport sys\n\nfrom google.appengine.ext import vendor\n# Add any libraries installed in the \"lib\" folder.\nvendor.add('lib')\n\nBASE_DIR = os.path.abspath(os.path.jo...
python
chosen
[ { "from": "system", "value": "FEAT: Add custom FC layer module\n" }, { "from": "human", "value": "import torch\nfrom torch.autograd import Variable\nimport torch.nn as nn\nimport torch.nn.functional as F\n\n################################################################################\n# ...
python
chosen
[ { "from": "system", "value": "Change unicode test, to test decoding and encoding is done correctly.\n" }, { "from": "human", "value": "# -*- coding: utf-8 -*-\nimport subprocess\nimport pytest\n\n\ndef test_basic(string=\"This is a test.\"):\n \"\"\"Test function to test echo server and clien...
python
chosen
[ { "from": "system", "value": "Add filter_horizontal to backdrop user admin\n\n- Provides a much more usable interface to filter and add data_sets for backdrop admin users\n" }, { "from": "human", "value": "from __future__ import unicode_literals\nfrom django.contrib import admin\nfrom django.db ...
python
chosen
[ { "from": "system", "value": "Fix signature of `BaseSerializer.dump` to remove `encoding` argument\n" }, { "from": "human", "value": "import abc\nimport io\nimport typing\nfrom typing import BinaryIO, ClassVar\n\nfrom ..ontology import Ontology\n\n\nclass BaseSerializer(abc.ABC):\n\n format: ...
python
chosen
[ { "from": "system", "value": "Make speaker population code use get_or_create instead of exception\n" }, { "from": "human", "value": "from django.core.management.base import NoArgsCommand\nimport pprint\nfrom popit import PopIt\nfrom speeches.models import Speaker\n\nclass Command(NoArgsCommand):...
python
chosen
[ { "from": "system", "value": "Add new get_ starcheck methods to exported/init methods\n" }, { "from": "human", "value": "# Licensed under a 3-clause BSD style license - see LICENSE.rst\nfrom .starcheck import get_starcheck_catalog, get_starcheck_catalog_at_date, get_mp_dir, get_monitor_windows\n...
python
chosen
[ { "from": "system", "value": "Add setUp and tearDown to test file\n" }, { "from": "human", "value": "import unittest\nfrom src.dojo import Dojo\n\n\"\"\"\nCall \"python -m tests.example\" while being in parent directory to run tests in this file.\n\"\"\"\n\n\nclass ExampleTest(unittest.TestCase)...
python
chosen
[ { "from": "system", "value": "Exclude htdocs, because that just takes way too long to scan.\n\n\n\n" }, { "from": "human", "value": "#!/usr/bin/env python\n#\n# Utility script to run pyflakes with the modules we care about and\n# exclude errors we know to be fine.\n\nimport os\nimport subprocess...
python
chosen
[ { "from": "system", "value": "Change version number to next major stable\n\nMaster branch is used as a development branch, so the version number should point to the next major stable version." }, { "from": "human", "value": "from ._classicalregister import ClassicalRegister\r\nfrom ._quantumregi...
python
chosen
[ { "from": "system", "value": "Fix incorrect import for FxOS nav tests.\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...
python
chosen
[ { "from": "system", "value": "Scale back threading, beacause Rasp Pi doesn't have enough threads\n" }, { "from": "human", "value": "from igc.util import cache, util\nutil.setupLog()\nfrom flask import Flask\nfrom flask import send_from_directory\nfrom flask_cors import CORS\n\nfrom igc.controlle...
python
chosen
[ { "from": "system", "value": "Remove option for non-thunk SQS initialization\n" }, { "from": "human", "value": "from .base import BackendFactory, Backend\nfrom ..queue.sqs import SQSQueue\n\nclass SQSBackendFactory(BackendFactory):\n def __init__(self, sqs_connection_or_thunk, visibility_time...
python
chosen
[ { "from": "system", "value": "Enable contrib.gis for test runs so templates are found\n" }, { "from": "human", "value": "#!/usr/bin/env python\nimport os\nimport sys\n\nfrom django.conf import settings\nimport django\n\nDEFAULT_SETTINGS = {\n 'INSTALLED_APPS': (\n 'spillway',\n ...
python
chosen
[ { "from": "system", "value": "Correct node variable name and validate results\n" }, { "from": "human", "value": "import requests\nfrom orionsdk import SwisClient\nfrom datetime import datetime, timedelta\n\n\ndef main():\n hostname = 'localhost'\n username = 'admin'\n password = ''\n\n ...
python
chosen
[ { "from": "system", "value": "Make the dummy limit function always return nothing.\n" }, { "from": "human", "value": "import random\n\nfrom cachebe import CacheBackend\n\n\nclass DummyBackend(CacheBackend):\n \"\"\"\n A dummy rate-limiting backend that disables rate-limiting,\n for test...
python
chosen
[ { "from": "system", "value": "Add DABUG config value to production config\n" }, { "from": "human", "value": "import os\n\nSQLALCHEMY_DATABASE_URI = os.environ.get('OPENSHIFT_POSTGRESQL_DB_URL')\n\n# directory to store runtime data, write access required\nDATA_DIR = os.environ.get('OPENSHIFT_DATA...
python
chosen
[ { "from": "system", "value": "Fix missing extension in course view file\n" }, { "from": "human", "value": "# -*- coding: utf-8 -*-\n{\n 'name': \"Open Academy\",\n\n 'summary': \"\"\"Manage trainings\"\"\",\n\n 'description': \"\"\"\n Open Academy module for managing trainings:\n...
python
chosen
[ { "from": "system", "value": "sdk: Add empty export method to decorator base\n\nDecorators for resources and collections extend a common base class, for\nexample:\n\n class VMSnapshotDisks(Base)\n\nThe resource decorators also extend the corresponding parameter class:\n\n class VMSnapshotDisk(params.Disk,...
python
chosen
[ { "from": "system", "value": "Read doc version number from _metadata.py\n" }, { "from": "human", "value": "\ndef _getvar(var, path, default=None):\n with open(path) as f:\n for line in f:\n if var in line:\n g = {}\n l = {}\n exec...
python
chosen
[ { "from": "system", "value": "Move Flickr over to its newly-secured API domain\n" }, { "from": "human", "value": "import foauth.providers\n\n\nclass Flickr(foauth.providers.OAuth1):\n # General info about the provider\n provider_url = 'http://www.flickr.com/'\n docs_url = 'http://www.fl...
python
chosen
[ { "from": "system", "value": "Read the script name if the proxy passes it\n" }, { "from": "human", "value": "\"\"\"\nWSGI config for projects project.\n\nIt exposes the WSGI callable as a module-level variable named ``application``.\n\nFor more information on this file, see\nhttps://docs.djangop...
python
chosen
[ { "from": "system", "value": "Fix bug; no generate_responses method in RemoteCallerMod\n" }, { "from": "human", "value": "#! /usr/bin/env python\n# coding:utf-8\n\n\nimport requests\nimport logging\nfrom kovot.response import Response\n\n\nclass RemoteCallerMod:\n def __init__(self, server, p...
python
chosen
[ { "from": "system", "value": "Increase the unit test coverage for the binary search tree\n" }, { "from": "human", "value": "import unittest\n\nfrom pyalgs.data_structures.commons.binary_search_tree import BinarySearchTree\n\n\nclass BinarySearchTreeUnitTest(unittest.TestCase):\n def test_bina...
python
chosen
[ { "from": "system", "value": "Put contrib and db into global API.\n" }, { "from": "human", "value": "\"\"\"\nsignac aids in the management, access and analysis of large-scale\ncomputational investigations.\n\nThe framework provides a simple data model, which helps to organize\ndata production an...
python
chosen
[ { "from": "system", "value": "Add function to read in plaid + account credentials into one structure.\n" }, { "from": "human", "value": "\"\"\"Transaction Downloader.\n\nUsage:\n transaction-downloader auth --account=<account-name>\n transaction-downloader -h | --help\n transaction-downloader...
python
chosen
[ { "from": "system", "value": "Add helper function to create a list of namedtuples useful for testing and debugging\n" }, { "from": "human", "value": "from collections import namedtuple\n\n__all__ = ['identity', 'print_generated_sequence']\n\n\ndef identity(x):\n \"\"\"\n Helper function wh...
python
chosen
[ { "from": "system", "value": "Use http for proxy test\n" }, { "from": "human", "value": "from common_fixtures import * # NOQA\n\nimport requests\n\n\ndef test_proxy(client, admin_user_client):\n domain = 'releases.rancher.com'\n s = admin_user_client.by_id_setting('api.proxy.whitelist')\n...
python
chosen
[ { "from": "system", "value": "Update example to switch between light and dark themes" }, { "from": "human", "value": "import sys\nfrom os.path import join, dirname, abspath\n\nfrom qtpy import uic\nfrom qtpy.QtCore import Slot\nfrom qtpy.QtWidgets import QApplication, QMainWindow, QMessageBox\n\...
python
chosen
[ { "from": "system", "value": "Fix AppVeyor build or break it in a different way\n" }, { "from": "human", "value": "from .checks import (check_quantity,\n check_relativistic,\n _check_quantity,\n _check_relativistic)\n\nfrom .exceptions ...
python
chosen
[ { "from": "system", "value": "Set logging level higher so we don't spam tests with debug messages\n" }, { "from": "human", "value": "\"\"\"\nTests of neo.rawio.examplerawio\n\nNote for dev:\nif you write a new RawIO class your need to put some file\nto be tested at g-node portal, Ask neuralensem...
python
chosen
[ { "from": "system", "value": "fix: Set default value as empty string\n" }, { "from": "human", "value": "import frappe\n\nclass WebPage(object):\n\tdef __init__(self, path=None, http_status_code=None):\n\t\tself.headers = None\n\t\tself.http_status_code = http_status_code or 200\n\t\tif not path:...
python
chosen
[ { "from": "system", "value": "Add message if transformer_hash already exists\n" }, { "from": "human", "value": "from django.core.management.base import BaseCommand\nfrom optparse import make_option\n\nfrom ...utils import transformer\n\n\nclass Command(BaseCommand):\n option_list = BaseComman...
python
chosen
[ { "from": "system", "value": "Use a different index for different tenants\n" }, { "from": "human", "value": "from django_elasticsearch_dsl import DocType, Index\nfrom bluebottle.projects.models import Project\n\n# The name of your index\nproject = Index('projects')\n# See Elasticsearch Indices ...
python
chosen
[ { "from": "system", "value": "Refactor importer slightly to avoid creation problems\n" }, { "from": "human", "value": "import requests\nimport csv\nfrom models import Planet, SolarSystem\nfrom django.core.exceptions import ValidationError\n\nclass ExoplanetsImporter:\n @staticmethod\n def ...
python
chosen
[ { "from": "system", "value": "Fix unicode fail in search indexing.\n" }, { "from": "human", "value": "import datetime\nimport os\nfrom haystack.indexes import *\nfrom haystack import site\nfrom projects.models import File, ImportedFile\nfrom projects import constants\n\nclass FileIndex(SearchInd...
python
chosen
[ { "from": "system", "value": "Add a custom exception (SlackMissingAPI)\n\nThis exception is raised when a SlackObject is created without\nany way to get an API.\n\nRemove custom implementation for exceptions. There is no reason strong\nenough for this.\n" }, { "from": "human", "value": "class Sl...
python
chosen
[ { "from": "system", "value": "Add /project/<id>/iterations route for the hell of it(I think it makes more sense)\n" }, { "from": "human", "value": "from django.conf.urls.defaults import patterns, url\n\n\nurlpatterns = patterns('snakeplan.projects.views',\n (r'^$', 'projects.index'),\n (r'...
python
chosen
[ { "from": "system", "value": "Change limit in lxlcrawler sao example script\n" }, { "from": "human", "value": "#!/usr/bin/env python3\nimport lxlcrawler\n\nstart_url = \"https://id.kb.se/find?q=*&limit=200&inScheme.@id=https://id.kb.se/term/sao\"\n\nfor i, item in enumerate(lxlcrawler.crawl(star...
python
chosen
[ { "from": "system", "value": "Write to png file in binary mode" }, { "from": "human", "value": "import os\nimport base64\nimport tempfile\nimport subprocess\n\n\ndef convert_to_pdf(post):\n path = tempfile.mkdtemp()\n pagenr = 1\n while True:\n data = post.get('page_%s' % pagenr)...
python
chosen
[ { "from": "system", "value": "Change to over=EXCVIEW to make response status work correctly\n" }, { "from": "human", "value": "from pyramid.tweens import MAIN\n\n\ndef includeme(config): # pragma: no cover\n \"\"\"\n :type config: :class:`pyramid.config.Configurator`\n \"\"\"\n conf...
python
chosen
[ { "from": "system", "value": "Add room redirect clause to Landing\n" }, { "from": "human", "value": "from tornado import template\nfrom tornado.web import authenticated\n\nfrom cutthroat.handlers import ViewHandler\n\n\nclass SignIn(ViewHandler):\n\n \"\"\"SignIn\"\"\"\n\n def get(self):\n...
python
chosen
[ { "from": "system", "value": "Fix a la url del callejero CABA\n" }, { "from": "human", "value": "# coding: UTF-8\nfrom __future__ import absolute_import\n\ndefault_settings = {\n 'callejero_amba_server': 'http://servicios.usig.buenosaires.gob.ar/callejero-amba/',\n 'callejero_caba_server':...
python
chosen
[ { "from": "system", "value": "Create new method object generate\nget riak bucket and generate tuple or list\n" }, { "from": "human", "value": "#!/usr/bin/env python\n# -*- coding: utf-8 -*-\nimport riak\n\nfrom wtforms.fields import TextField, TextAreaField, SelectField\nfrom wtforms.validators ...
python
chosen
[ { "from": "system", "value": "Add prev. and next email to context only if exist original (current)\n" }, { "from": "human", "value": "# -*- coding: utf-8 -*-\nfrom __future__ import unicode_literals\n\nfrom django.contrib import admin\n\nfrom models import Email, Resolution\n\n\nclass Resolution...
python
chosen
[ { "from": "system", "value": "Add test for nonexisting file extensions.\n" }, { "from": "human", "value": "import unittest\n\nimport i18n\n\nclass TestFileLoader(unittest.TestCase):\n def test_dummy(self):\n self.assertTrue(hasattr(i18n, 'resource_loader'))\n\nsuite = unittest.TestLoad...
python
chosen
[ { "from": "system", "value": "Add - Test for setting ROOT\n" }, { "from": "human", "value": "from survey.tests import BaseTest\nfrom django.test import override_settings\nfrom django.conf import settings\nfrom django.test import tag\nfrom survey import set_default_settings\n\n\n@tag(\"set\")\n@o...
python
chosen
[ { "from": "system", "value": "Add query param to event list\n" }, { "from": "human", "value": "from __future__ import absolute_import\n\nfrom sentry.api.base import DocSection\nfrom sentry.api.bases import GroupEndpoint\nfrom sentry.api.serializers import serialize\nfrom sentry.api.paginator imp...
python
chosen
[ { "from": "system", "value": "Clean up the logging ofr PAWS\n" }, { "from": "human", "value": "from tornado.websocket import WebSocketHandler\nfrom zmq.eventloop.zmqstream import ZMQStream\n\nfrom pocs.utils.logger import get_logger\n\nclients = []\n\n\nclass PanWebSocket(WebSocketHandler):\n ...
python
chosen
[ { "from": "system", "value": "Set unique together on news article." }, { "from": "human", "value": "\"\"\"Models used by the news publication application.\"\"\"\n\n\nfrom django.db import models\n\nfrom cms.apps.pages.models import Page, PageBase, PageField, HtmlField\nfrom cms.apps.news.content...
python
chosen
[ { "from": "system", "value": "Add more info to TabDelegate example\n\nProvide details on how to limit a tab delegate to a specific resource handler.\n" }, { "from": "human", "value": "from django.shortcuts import render\n\nfrom extensions.views import admin_extension, tab_extension, \\\n TabE...
python
chosen
[ { "from": "system", "value": "Remove repo URL prefix of git+\n" }, { "from": "human", "value": "import os, yaml\nfrom nucleator.cli import properties\n\n# Read sources.yml\n# find the src= for name: siteconfig\n# TODO handle version?\nimport yaml\n\nsources = os.path.join(properties.NUCLEATOR_...
python
chosen
[ { "from": "system", "value": "Document info for performing lookups on date fields\n" }, { "from": "human", "value": "\"\"\"Models for the days app.\"\"\"\nfrom django.db import models\n\n\nclass Event(models.Model):\n \"\"\"Representation of a notable historical event.\"\"\"\n date = model...
python
chosen
[ { "from": "system", "value": "Add databaseinfra get engine name\n" }, { "from": "human", "value": "# -*- coding: utf-8 -*-\n\n\nclass DatabaseAsAServiceApi(object):\n def __init__(self, databaseinfra):\n self.databaseinfra = databaseinfra\n self.driver = self.get_databaseinfra_d...
python
chosen
[ { "from": "system", "value": "Allow operating in an environment with a detached HEAD.\n" }, { "from": "human", "value": "from .indexes import messages\nimport git\n\n\nclass Error(Exception):\n pass\n\n\nclass NoGitHeadError(Error, ValueError):\n pass\n\n\ndef create_commit_message(repo):\n m...
python
chosen
[ { "from": "system", "value": "Fix exception handling in integrity decorator\n" }, { "from": "human", "value": "import functools\nimport logging\n\nfrom weblib.error import ResponseNotValid\n\n\ndef integrity(integrity_func, integrity_errors=(ResponseNotValid,),\n ignore_errors=()):\...
python
chosen
[ { "from": "system", "value": "Connect to the \"elasticsearch\" host by default\n" }, { "from": "human", "value": "#!/usr/bin/env python\n# encoding: utf-8\nimport socket\nfrom os import environ as env\nfrom tornado.netutil import Resolver\nfrom tornado import gen\nfrom tornado.httpclient import ...
python
chosen
[ { "from": "system", "value": "Add FindValue() and WatchValue() fuzz calls to the mix.\n\n\ngit-svn-id: b33bab8abb5b18c12ee100cd7761ab452d00b2b0@140439 91177308-0d34-0410-b5e6-96231b3b80d8\n" }, { "from": "human", "value": "\"\"\"\nFuzz tests an object after the default construction to make sure ...
python
chosen
[ { "from": "system", "value": "Use secure gravatar and fix gravatar image size\n\nFixes #106\nFixes #112\n" }, { "from": "human", "value": "\"\"\"\ngravatar_url from https://en.gravatar.com/site/implement/images/django/\n\"\"\"\nfrom django import template\nfrom django.conf import settings\n\nimp...
python
chosen
[ { "from": "system", "value": "Add a couple more tests\n" }, { "from": "human", "value": "import jsonsempai\n\nimport os\nimport shutil\nimport sys\nimport tempfile\n\nTEST_FILE = '''{\n\"three\": 3\n}'''\n\n\nclass TestSempai(object):\n\n def setup(self):\n self.direc = tempfile.mkdtem...
python
chosen
[ { "from": "system", "value": "Fix test path to file dir to be able to load classifier data\n" }, { "from": "human", "value": "from unittest import TestCase\nimport numpy as np\nfrom construe.knowledge.abstraction_patterns.segmentation.pwave import _CLASSIFIERS as classifier\n\n\nclass TestClassi...
python
chosen
[ { "from": "system", "value": "[FIX] website_sale_coupon: Allow public users to use coupons on website\n" }, { "from": "human", "value": "# -*- coding: utf-8 -*-\nfrom odoo import http\nfrom odoo.http import request\n\nclass Website_coupon(http.Controller):\n\n @http.route(['/shop/apply_coupon...
python
chosen
[ { "from": "system", "value": "Add tests for eidos found_by annotation\n" }, { "from": "human", "value": "import os\nfrom indra.sources import eidos\nfrom indra.statements import Influence\n\n\npath_this = os.path.dirname(os.path.abspath(__file__))\ntest_json = os.path.join(path_this, 'eidos_test...
python
chosen
[ { "from": "system", "value": "Remove reverse DNS validation for Kobo worker\n" }, { "from": "human", "value": "# -*- coding: utf-8 -*-\n\n\nimport socket\n\nfrom django.core.exceptions import PermissionDenied, SuspiciousOperation\nfrom kobo.decorators import decorator_with_args\nfrom kobo.django...
python
chosen
[ { "from": "system", "value": "Write expense number on account move\n" }, { "from": "human", "value": "# -*- encoding: utf-8 -*-\n##############################################################################\n# For copyright and license notices, see __openerp__.py file in root directory\n#######...
python
chosen
[ { "from": "system", "value": "Add fib.elf to integration tests.\n" }, { "from": "human", "value": "from epiphany.sim import Epiphany\n\nimport os.path\nimport pytest\n\nelf_dir = os.path.join('epiphany', 'test', 'c')\n\n\n@pytest.mark.parametrize(\"elf_file,expected\", [('nothing.elf', 176),\n...
python
chosen
[ { "from": "system", "value": "Clean up import in CaseFactory\n" }, { "from": "human", "value": "from feder.cases import models\nfrom feder.institutions.factories import InstitutionFactory\nfrom feder.monitorings.factories import MonitoringFactory\nimport factory\nfrom feder.users.factories impor...
python
chosen
[ { "from": "system", "value": "Update test to use new version location\n" }, { "from": "human", "value": "from citrination_client.base import BaseClient\nfrom citrination_client.base.errors import CitrinationClientError\n\ndef test_none_api_key():\n \"\"\"\n Ensures that an error is thrown if a...
python
chosen
[ { "from": "system", "value": "Remove the topic and time from the pandas index so they are included in the json output again.\n" }, { "from": "human", "value": "\"\"\"Serializers for the use with rest-pandas\"\"\"\n\nfrom rest_framework import serializers\n\nfrom .models import MQTTMessage\n\nimp...
python
chosen
[ { "from": "system", "value": "Fix logging compatibility with the latest Channels\n" }, { "from": "human", "value": "#!/usr/bin/env python\nimport channels.log\nimport logging\nimport os\nimport sys\n\nPROJECT_ROOT = os.path.dirname(os.path.abspath(os.path.dirname(__file__)))\nsys.path.insert(0, ...
python
chosen
[ { "from": "system", "value": "Add views for testing 404 and 500 templates\n" }, { "from": "human", "value": "from django.conf.urls import include, url\nfrom django.conf.urls.static import static\nfrom django.conf import settings\nfrom django.contrib import admin\n\nfrom wagtail.wagtailadmin impo...
python
chosen
[ { "from": "system", "value": "Add comments & space lines\n" }, { "from": "human", "value": "\"\"\"Leetcode 7. Reverse Integer\nEasy\n\nURL: https://leetcode.com/problems/reverse-integer/description/\n\nReverse digits of an integer.\n\nExample1: x = 123, return 321\nExample2: x = -123, return -32...
python
chosen
[ { "from": "system", "value": "FIX password reset method that was not resetting the password\n" }, { "from": "human", "value": "# -*- coding: utf-8 -*-\n# Part of Odoo. See LICENSE file for full copyright and licensing details.\n\nimport logging\nfrom odoo import api, models\n\n_logger = logging....
python
chosen
[ { "from": "system", "value": "Add desc and orderby to repo\n" }, { "from": "human", "value": "# -*- coding: utf8 -*-\n# This file is part of PYBOSSA.\n#\n# Copyright (C) 2015 Scifabric LTD.\n#\n# PYBOSSA is free software: you can redistribute it and/or modify\n# it under the terms of the GNU Aff...
python
chosen
[ { "from": "system", "value": "Remove future-restriction on list_events tag\n" }, { "from": "human", "value": "import datetime\n\nfrom django import template\n\nfrom .. import models\n\n\nregister = template.Library()\n\n\n@register.inclusion_tag('events/tags/list_events.html')\ndef list_events(n...
python
chosen
[ { "from": "system", "value": "Update migrations — `verbose_name` for `redirect_delay` fields\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 dependen...
python
chosen
[ { "from": "system", "value": "FIX works with py3 binary data and string data\n" }, { "from": "human", "value": "from lxml.objectify import fromstring\nimport binascii\nimport zlib\n\n\ndef is_gziped(content):\n return binascii.hexlify(content[:2].encode('utf-8')) == b'1f8b'\n\n\nclass BaseMes...
python
chosen
[ { "from": "system", "value": "Check duplicates > 1 instead of > 2" }, { "from": "human", "value": "import frappe\n\ndef execute():\n keys_encountered = set()\n #if current = 0, simply delete the key as it'll be recreated on first entry\n frappe.db.sql('delete from `tabSeries` where curr...
python
chosen
[ { "from": "system", "value": "Fix estimator loop, consider rest plugins as well.\n" }, { "from": "human", "value": "import logging\nfrom flexget.plugin import get_plugins_by_group, register_plugin\n\nlog = logging.getLogger('est_released')\n\n\nclass EstimateRelease(object):\n\n \"\"\"\n F...
python
chosen
[ { "from": "system", "value": "Fix the error code for IAMNotFoundException to NoSuchEntity used by AWS.\n" }, { "from": "human", "value": "from __future__ import unicode_literals\nfrom moto.core.exceptions import RESTError\n\n\nclass IAMNotFoundException(RESTError):\n code = 404\n\n def __i...
python
chosen
[ { "from": "system", "value": "Add module declaration for karenina\n" }, { "from": "human", "value": "from karenina import modules\n\n\nclass Admin(modules.InstallableModule):\n icon = \"mdi-action-settings-applications\"\n order = 1000\n\n @property\n def label(self):\n return...
python
chosen
[ { "from": "system", "value": "Remove leftover line in solution for 01_keras\n" }, { "from": "human", "value": "model = Sequential()\nmodel.add(Dense(hidden_dim, input_dim=input_dim,\n activation=\"tanh\"))\nmodel.add(Dense(output_dim, activation=\"softmax\"))\nmodel.add(Activation...
python
chosen
[ { "from": "system", "value": "Delete tags for deleted items\n" }, { "from": "human", "value": "from django.db import models\n\n# Create your models here.\n" }, { "from": "gpt", "value": "from django.contrib.contenttypes.models import ContentType\nfrom django.db.models import signals\...
python
chosen
[ { "from": "system", "value": "Add restart mechanism for Hokuyo, update logging mechanism\n" }, { "from": "human", "value": "import serial\nimport sys\nimport os\n\nfrom amber.hokuyo.hokuyo_common import HokuyoController\n\nfrom amber.tools import serial_port, config\n\n\n__author__ = 'paoolo'\n\...
python
chosen
[ { "from": "system", "value": "Work on older Python without assertIn method.\n" }, { "from": "human", "value": "#!/usr/bin/env python\n# vim: set ts=4 sw=4 et sts=4 ai:\n#\n# Test some basic functionality.\n#\n\nimport unittest\nimport os\nimport sys\nsys.path.append('..')\n\n\nclass TestQBasic(u...
python
chosen
[ { "from": "system", "value": "Remove whitespace from blank line" }, { "from": "human", "value": "#!/usr/bin/env python\nimport os\nimport sys\n\nif __name__ == \"__main__\":\n \n from mezzanine.utils.conf import real_project_name\n\n settings_module = \"%s.settings\" % real_project_name...
python
chosen
[ { "from": "system", "value": "Change `ExtraInfo` to user fields, add search\n\n`Register_cme/extrainfo` in Django Admin was previously displaying users\nas `ExtraInfo` objects which admins had to click on individually to see\neach user's information. Each user is now displayed with fields:\nusername, email,...
python
chosen
[ { "from": "system", "value": "Add control over psycopg2's version (need to be bigger or equal than 2.5.4)\n" }, { "from": "human", "value": "# -*- coding: utf-8 -*-\nfrom __future__ import unicode_literals\n\nfrom django.db import connection\n\nPOSTGRES_FLAG = False\nif str(connection.vendor) ==...
python
chosen
[ { "from": "system", "value": "Fix for template reloading issues in newer version of flask\n" }, { "from": "human", "value": "\"\"\"Launch.\"\"\"\nfrom dnstwister import app\napp.run(debug=True)\n" }, { "from": "gpt", "value": "\"\"\"Launch.\"\"\"\nfrom dnstwister import app\n\n# At l...
python
chosen
[ { "from": "system", "value": "Add unit testing. Initial version\n" }, { "from": "human", "value": "from django.test import TestCase\n\n# Create your tests here.\n" }, { "from": "gpt", "value": "from datetime import datetime, timedelta\nfrom django.contrib.auth.models import User\nfro...
python
chosen
[ { "from": "system", "value": "Support both celery _send task and non-celery _send method\n" }, { "from": "human", "value": "import logging\n\nfrom promgen.models import Sender\n\nlogger = logging.getLogger(__name__)\n\n\nclass SenderBase(object):\n def send(self, data):\n sent = 0\n ...
python
chosen
[ { "from": "system", "value": "Add dollar sign to fares, sort by fare type\n" }, { "from": "human", "value": "\nimport tornado.web\nimport ipy_table\nfrom transperth.location import Location\n\n\nclass BaseRequestHandler(tornado.web.RequestHandler):\n @property\n def args(self):\n ar...
python
chosen
[ { "from": "system", "value": "Allow to reverse LVFVerb migration\n" }, { "from": "human", "value": "# -*- coding: utf-8 -*-\nfrom __future__ import unicode_literals\n\nimport json\nfrom os.path import join\n\nfrom django.db import models, migrations\nfrom django.conf import settings\n\nfrom load...
python
chosen
[ { "from": "system", "value": "Exit non-zero if unit tests failed\n" }, { "from": "human", "value": "#!/bin/env python\n\"\"\"Run HTCondor-CE unit tests\"\"\"\n\nimport glob\nimport unittest\n\nTESTS = [test.strip('.py') for test in glob.glob('test*.py')]\nSUITE = unittest.TestLoader().loadTestsF...
python
chosen