conversations
listlengths
2
3
source
stringclasses
1 value
stack
stringclasses
1 value
[ { "from": "system", "value": "Add URL routing to app\n" }, { "from": "human", "value": "from django.conf.urls import patterns, include, url\n\nfrom django.contrib import admin\nadmin.autodiscover()\n\nurlpatterns = patterns('',\n # Examples:\n # url(r'^$', 'presentations.views.home', name=...
python
chosen
[ { "from": "system", "value": "Add resource paths to python launcher script (proxy)\n\n\nFormer-commit-id: 7d20874c43637f1236442333f60a88ec653f53f2" }, { "from": "human", "value": "#!/usr/bin/env python\n# -*- coding: utf-8 -*-\n\nimport alfanousDesktop.Gui\n\nalfanousDesktop.Gui.main()\n" }, ...
python
chosen
[ { "from": "system", "value": "Disable SSL/HTTPS (reverts to default values)\n\nNeeding to explicitly set something to it’s default value perhaps isn’t ideal." }, { "from": "human", "value": "import os\n\nfrom service.settings.production import *\n\nDEBUG = { 0: False, 1: True }[int(os.getenv('DE...
python
chosen
[ { "from": "human", "value": "Add a couple things for Bottle-like behavior.\n" }, { "from": "gpt", "value": "from functools import wraps\n\nfrom twisted.internet import reactor\nfrom twisted.web.server import Site\n\nfrom klein.decorators import expose\nfrom klein.resource import KleinResource\n\...
python
chosen
[ { "from": "system", "value": "Return sorted values for scores\n" }, { "from": "human", "value": "\"\"\"\nBlueprint implementing the API wrapper.\n\n:author: 2013, Pascal Hartig <phartig@weluse.de>\n:license: BSD\n\"\"\"\n\nimport json\nfrom flask import Blueprint, request, abort\nfrom .utils imp...
python
chosen
[ { "from": "system", "value": "Create fn for calculating exhaustion\n" }, { "from": "human", "value": "#!/usr/bin/python3\n\nfrom sys import stdin\n\n\ndef estimateConf(conf):\n \"\"\"Estimate configuration from a string.\"\"\"\n confElements = [int(x) for x in conf.split(sep=\" \")]\n d...
python
chosen
[ { "from": "system", "value": "Set default linger to 1 second\n" }, { "from": "human", "value": "import os\nimport Pyro4\nPyro4.config.SERIALIZERS_ACCEPTED.add('pickle')\nPyro4.config.SERIALIZERS_ACCEPTED.add('dill')\nPyro4.config.SERIALIZER = 'dill'\nPyro4.config.THREADPOOL_SIZE = 16\nPyro4.conf...
python
chosen
[ { "from": "system", "value": "Add test on check file if exist\n" }, { "from": "human", "value": "# -*- coding: utf-8 -*-\nfrom __future__ import unicode_literals\n\nimport pytest\n\nfrom .test_bot import TestBot\n\n\nclass TestBotSupport(TestBot):\n\n @pytest.mark.parametrize('url,result', [\...
python
chosen
[ { "from": "system", "value": "Add entity type column to actions\n" }, { "from": "human", "value": "from zou.app import db\nfrom zou.app.models.serializer import SerializerMixin\nfrom zou.app.models.base import BaseMixin\n\n\nclass CustomAction(db.Model, BaseMixin, SerializerMixin):\n name = d...
python
chosen
[ { "from": "system", "value": "Test sets instead of lists\n" }, { "from": "human", "value": "import os\nimport sys\nimport json\n\n\ndef main():\n prefix = os.environ['PREFIX']\n info_file = os.path.join(prefix, 'conda-meta',\n 'always_include_files_regex-0.1-0.j...
python
chosen
[ { "from": "system", "value": "Set Factory.noisy to False by default\n\ngit-svn-id: 81e381228600e5752b80483efd2b45b26c451ea2@3933 e27351fd-9f3e-4f54-a53b-843176b1656c\n" }, { "from": "human", "value": "from zope.interface import implements\nfrom twisted.plugin import IPlugin\nfrom twisted.applica...
python
chosen
[ { "from": "system", "value": "Tidy up the code, and don't make settings.SASS_BIN a requirement (default to 'sass')\n" }, { "from": "human", "value": "import os\nfrom commands import getstatusoutput\nfrom django import template\nfrom django.conf import settings\nfrom django.utils._os import safe_...
python
chosen
[ { "from": "system", "value": "Add a print with file where mistake is\n" }, { "from": "human", "value": "#!/usr/bin/python\n# -*- coding: utf-8 -*-\n\nfrom __future__ import print_function\nfrom xml.etree.ElementTree import ParseError\nimport xml.etree.ElementTree as ET\nimport glob\nimport sys\n...
python
chosen
[ { "from": "system", "value": "Add support for returning the uuids for a profile query\n\nin addition to the tokens. This allows us to link profile query results to the\nsurvey/push notification feature.\n" }, { "from": "human", "value": "# Standard imports\nimport json\nimport logging\nimport uu...
python
chosen
[ { "from": "system", "value": "Add helper for updating URL GET parameters.\n" }, { "from": "human", "value": "# coding: utf-8\nimport random\nfrom string import ascii_letters, digits\n\n\n# From http://tools.ietf.org/html/rfc6750#section-2.1\nBEARER_TOKEN_CHARSET = ascii_letters + digits + '-._~+...
python
chosen
[ { "from": "system", "value": "Use requests instead of httplib to do replay\n" }, { "from": "human", "value": "from __future__ import absolute_import\n\nimport socket\n\nfrom httplib import HTTPConnection, HTTPSConnection\nfrom urllib import urlencode\nfrom urlparse import urlparse\n\n\nclass Rep...
python
chosen
[ { "from": "system", "value": "Use two return statements and remove printing\n" }, { "from": "human", "value": "\"\"\"A module to demonstrate exceptions.\"\"\"\n\nimport sys\n\n\ndef convert(item):\n '''\n Convert to an integer.\n Args:\n item: some object\n\n Returns:\n ...
python
chosen
[ { "from": "system", "value": "Decrease user and group IDs from 1000 to 0.\n" }, { "from": "human", "value": "# Basic config for stuff that can be easily changed, but which is git-managed.\n# See also apikeys_sample.py for the configs which are _not_ git-managed.\napp_name = \"fore\"\nserver_doma...
python
chosen
[ { "from": "system", "value": "Remove string interpolation and sorting the collection." }, { "from": "human", "value": "# -*- coding: utf-8 -*-\nimport re\nfrom . import export\n\n@export\ndef fuzzyfinder(text, collection):\n \"\"\"\n Args:\n text (str): A partial string which is typ...
python
chosen
[ { "from": "system", "value": "Print head, remove code for proteus python class head (use codeobj)\n" }, { "from": "human", "value": "\"\"\"Generator for Proteus coefficient evaluator\"\"\"\n\nfrom .sfl_printer import SFLPrinter\nfrom ...code_tools import comment_code, indent_code, PythonCodePrin...
python
chosen
[ { "from": "system", "value": "Change import so it works\n" }, { "from": "human", "value": "\"\"\"A custom ILAMB confrontation for net ecosystem productivity (nep).\"\"\"\nimport os\nimport numpy as np\nfrom ILAMB.Confrontation import Confrontation\nfrom ILAMB.Variable import Variable\nimport ila...
python
chosen
[ { "from": "system", "value": "Add mixin to make the case-insensitive email auth backend more flexible\n" }, { "from": "human", "value": "from django.contrib.auth.backends import ModelBackend\n\n\nclass CaseInsensitiveEmailBackend(ModelBackend):\n \"\"\"\n This authentication backend assume...
python
chosen
[ { "from": "system", "value": "Add namespace to votes app URLs\n" }, { "from": "human", "value": "\"\"\"jay URL Configuration\n\nThe `urlpatterns` list routes URLs to views. For more information please see:\n https://docs.djangoproject.com/en/1.8/topics/http/urls/\nExamples:\nFunction views\n ...
python
chosen
[ { "from": "system", "value": "Move badge instance list beneath 'badges' url\n" }, { "from": "human", "value": "from __future__ import unicode_literals\nfrom django.conf.urls import patterns, url\nfrom . import views\nfrom django.contrib.admin.views.decorators import staff_member_required\n\n\nur...
python
chosen
[ { "from": "system", "value": "Clean up params and docstrings\n" }, { "from": "human", "value": "import json\nimport requests\nfrom celery.task import Task\nfrom django.conf import settings\n\n\nclass DeliverHook(Task):\n def run(self, target, payload, instance=None, hook=None, **kwargs):\n ...
python
chosen
[ { "from": "system", "value": "Fix textcat simple train example\n" }, { "from": "human", "value": "from __future__ import unicode_literals\nfrom ...language import Language\n\ndef test_simple_train():\n nlp = Language()\n\n nlp.add_pipe(nlp.create_pipe('textcat'))\n nlp.get_pipe('textcat...
python
chosen
[ { "from": "system", "value": "INDY-2066: Add new TAA transaction codes\n\nSigned-off-by: Sergey Khoroshavin <b770466c7a06c5fe47531d5f0e31684f1131354d@dsr-corporation.com>\n" }, { "from": "human", "value": "from enum import Enum\n\n\nclass Transactions(Enum):\n def __str__(self):\n retu...
python
chosen
[ { "from": "system", "value": "git: Put prod back on the list of branches to send notices about.\n\n(imported from commit e608d7050b4e68045b03341dc41e8654e45a3af3)\n" }, { "from": "human", "value": "# Humbug Inc's internal git plugin configuration.\n# The plugin and example config are under api/i...
python
chosen
[ { "from": "system", "value": "Add way to reset loggers\n\nlogging.basicConfig doesn't reset the current logging infrastructure, which\nwas messing up some tests that expected logs to be one place even though\nthey ended up in another\n" }, { "from": "human", "value": "import os\nimport threading...
python
chosen
[ { "from": "system", "value": "Allow indexing blank country field\n" }, { "from": "human", "value": "from haystack.indexes import SearchIndex, CharField, MultiValueField, BooleanField\nfrom haystack import site\nfrom .models import MuseumObject\n\n\nclass MuseumObjectIndex(SearchIndex):\n text...
python
chosen
[ { "from": "system", "value": "Add test for offline compression using django_compressor\n" }, { "from": "human", "value": "import os\nimport shutil\nimport tempfile\n\nfrom django.test import TestCase\nfrom django.core.management import call_command\nfrom django.test.utils import override_setting...
python
chosen
[ { "from": "system", "value": "Use from django.conf import settings\n" }, { "from": "human", "value": "from django.http import HttpResponseBadRequest, HttpResponseForbidden\nfrom django.views.decorators.csrf import csrf_exempt\nfrom incubator.settings import STATUS_SECRETS\n\n\ndef one_or_zero(ar...
python
chosen
[ { "from": "system", "value": "Allow passing Celery configuration under the project's config\n" }, { "from": "human", "value": "import os\n\nimport logbook\n\nfrom .base import SubsystemBase\n_logger = logbook.Logger(__name__)\n\n\nclass TasksSubsystem(SubsystemBase):\n\n NAME = 'tasks'\n\n\n ...
python
chosen
[ { "from": "system", "value": "Fix db deletion, take 2\n" }, { "from": "human", "value": "import os\nfrom uuid import uuid4\nfrom unittest import TestCase\nimport webtest\nfrom daybed.db import DatabaseConnection\n\n\nHERE = os.path.dirname(os.path.abspath(__file__))\n\n\nclass BaseWebTest(TestCa...
python
chosen
[ { "from": "system", "value": "Implement simple tests for the 'cookies' fixture\n" }, { "from": "human", "value": "# -*- coding: utf-8 -*-\n\n\ndef test_bar_fixture(testdir):\n \"\"\"Make sure that pytest accepts our fixture.\"\"\"\n\n # create a temporary pytest test module\n testdir.ma...
python
chosen
[ { "from": "system", "value": "Set value of 'owner' to the value of the ObjectId\n" }, { "from": "human", "value": "from . import app, mongo\nfrom alexandria.decorators import *\nfrom flask import request, jsonify, url_for, session\nfrom flask.ext.classy import FlaskView, route\nimport json\nfrom...
python
chosen
[ { "from": "system", "value": "Fix py3k relative import error\n" }, { "from": "human", "value": "#!/usr/bin/env python\n# -*- coding: utf-8 -*-\n\n\"\"\" __init__.py\n\nSeam\n====\n\nSeam is a simple layer between existing neuroimaging tools and your data.\n\nWhile it is opinionated in how to exe...
python
chosen
[ { "from": "system", "value": "Fix bugs for updating from tf 2.0b0 to rc0\n\nUpdating the dependency of tensorflow from 2.0.0b1 to 2.0.0rc0 is causing crashes in keras-tuner.\r\nNot sure the \"set\" operation is really useful, but it is causing the crash because it tries to hash a tensor with equality enable...
python
chosen
[ { "from": "system", "value": "Allow specifying depth of TOC headers and rewrites\n" }, { "from": "human", "value": "#!/usr/bin/env python\n\n# Copyright (C) 2010 John Reese\n# Licensed under the MIT license\n\nimport sys\nimport MarkdownPP\n\nif len(sys.argv) > 2:\n\tmdpp = open(sys.argv[1], \"r...
python
chosen
[ { "from": "system", "value": "Raise TypeError instead of returning\n" }, { "from": "human", "value": "#!/usr/bin/env python\n\n\nclass RequiresType(object):\n \"\"\"\n Checks that the first (or position given by the keyword argument 'position'\n argument to the function is an instance o...
python
chosen
[ { "from": "system", "value": "Change calendar JSON view url\n" }, { "from": "human", "value": "from django.conf.urls import patterns, url\nfrom swingtime import views\n\nurlpatterns = patterns('',\n url(\n r'^(?:calendar/)?$',\n views.CalendarView.as_view(),\n name='swing...
python
chosen
[ { "from": "system", "value": "Fix userfactory - set user flags\n" }, { "from": "human", "value": "# coding: utf-8\n\nimport factory\n\nfrom django.contrib.auth.models import User\n\n\nclass UserFactory(factory.Factory):\n FACTORY_FOR = User\n\n first_name = \"Boy\"\n last_name = \"Facto...
python
chosen
[ { "from": "system", "value": "Add live and expired framework pytest fixtures\n\nThis is a tiny attempt to move away from relying on database migrations\nto set up framework records for tests. Using migration framework records\nmeans we need to use actual (sometimes expired) frameworks to write tests\nties u...
python
chosen
[ { "from": "system", "value": "fix(): Add versioning to api routes\n" }, { "from": "human", "value": "from flask import Blueprint\n\nfrom unbound_legacy_api.utils.response import create_response\n\nstats_bp = Blueprint('stats', __name__, url_prefix='/stats')\n\n@stats_bp.route('/ping')\ndef ping(...
python
chosen
[ { "from": "system", "value": "Add integration test for user-args help\n" }, { "from": "human", "value": "from . import *\n\n\nclass TestUserArgs(IntegrationTest):\n def __init__(self, *args, **kwargs):\n IntegrationTest.__init__(\n self, os.path.join(examples_dir, '10_custom...
python
chosen
[ { "from": "system", "value": "Add a new option allowing client code to turn off parallelism\n" }, { "from": "human", "value": "import featureflow as ff\nfrom random_samples import ShuffledSamples\nfrom random_samples import InfiniteSampler\nfrom preprocess import PreprocessingPipeline\n\n\ndef l...
python
chosen
[ { "from": "system", "value": "Add support for calling commands by attr access\n" }, { "from": "human", "value": "from .hirlite import Rlite, HirliteError\nfrom .version import __version__\n\n__all__ = [\"Rlite\", \"HirliteError\", \"__version__\"]\n" }, { "from": "gpt", "value": "imp...
python
chosen
[ { "from": "system", "value": "Change mimetype kwarg to content_type.\n" }, { "from": "human", "value": "# Copyright (c) 2011-2013 Kunal Mehta. All rights reserved.\n# Use of this source code is governed by a BSD License found in README.md.\n\nfrom django.http import HttpResponse\nfrom django.sho...
python
chosen
[ { "from": "system", "value": "Add test for adding JSON-LD to guess_format()\n\nThis is a follow-on patch to:\ne778e9413510721c2fedaae56d4ff826df265c30\n\nTest was confirmed to pass by running this on the current `master`\nbranch, and confirmed to fail with e778e941 reverted.\n\n nosetests test/test_parse...
python
chosen
[ { "from": "system", "value": "Convert tags to a set on init and back to a list on writing.\n" }, { "from": "human", "value": "\"\"\"Provide the class IdxItem which represents an item in the index.\n\"\"\"\n\nimport hashlib\n\n\ndef _md5file(fname):\n \"\"\"Calculate the md5 hash for a file.\n...
python
chosen
[ { "from": "system", "value": "Add a List and Prop for better IFF compliance\n" }, { "from": "human", "value": "import collections\r\nimport io\r\n\r\nfrom steel.fields.numbers import BigEndian\r\nfrom steel import fields\r\nfrom steel.chunks import base\r\n\r\n__all__ = ['Chunk', 'ChunkList', 'F...
python
chosen
[ { "from": "system", "value": "Fix problems identified by broken test\n" }, { "from": "human", "value": "# Licensed to the Apache Software Foundation (ASF) under one\n# or more contributor license agreements. See the NOTICE file\n# distributed with this work for additional information\n# reg...
python
chosen
[ { "from": "system", "value": "Set up the relationship between bookmark and merchant\n" }, { "from": "human", "value": "from flask import current_app\nfrom .. import db, login_manager\n\nclass Bookmarks(db.Model):\n id = db.Column(db.Integer, primary_key=True)\n listing_id = db.Column(db.In...
python
chosen
[ { "from": "system", "value": "Update chem version to force new nltk requirement to be picked up\n" }, { "from": "human", "value": "from setuptools import setup\n\nsetup(\n name=\"chem\",\n version=\"0.1.1\",\n packages=[\"chem\"],\n install_requires=[\n \"pyparsing==2.0.7\",\n...
python
chosen
[ { "from": "system", "value": "Add total tests count to py unittest graph\n" }, { "from": "human", "value": "import re\nfrom django.template.loader import render_to_string\nfrom tasks.const import STATUS_SUCCESS, STATUS_FAILED\nfrom .base import library\n\n\n@library.register('py_unittest')\ndef ...
python
chosen
[ { "from": "system", "value": "Make generic more liberal although it doesn't match all valid keys\n" }, { "from": "human", "value": "import webapp2\nfrom freetalks import handler\n\napplication = webapp2.WSGIApplication([\n webapp2.Route(r'/', handler.general.Home, 'home'),\n webapp2.Route(...
python
chosen
[ { "from": "system", "value": "Test APL code should give credit to Wikipedia\n" }, { "from": "human", "value": "#!/usr/bin/env python\n# -*- coding: utf-8 -*-\n\nimport readability\nimport unittest\n\ngood_code = \"\"\"\ndef this_is_some_good_code(var):\n for i in range(10):\n print(i)\n\"\"\...
python
chosen
[ { "from": "system", "value": "herobrine: Include the missing project config\n\nNeed to include the project config prj_herobrine_npcx9.conf to\nthe build. It defines CONFIG_BOARD_HEROBRINE_NPCX9=y. The board\nspecific alternative component code (alt_dev_replacement.c)\nrequires this Kconfig option.\n\nBRANCH...
python
chosen
[ { "from": "system", "value": "Add BookAdmin options in test app\n" }, { "from": "human", "value": "from django.contrib import admin\n\nfrom import_export.admin import ImportExportMixin\n\nfrom .models import Book, Category, Author\n\n\nclass BookAdmin(ImportExportMixin, admin.ModelAdmin):\n p...
python
chosen
[ { "from": "system", "value": "Increase test coverage on crc32\n" }, { "from": "human", "value": "import hmac\nimport unittest\n\nfrom twoping import crc32\n\n\nclass TestCRC32(unittest.TestCase):\n def test_crc32(self):\n c = crc32.new()\n c.update(b\"Data to hash\")\n se...
python
chosen
[ { "from": "system", "value": "Disable autoflushing as introduced with Flask-SQLAlchemy 2.0.\n" }, { "from": "human", "value": "# -*- coding: utf-8 -*-\n\n\"\"\"\nbyceps.database\n~~~~~~~~~~~~~~~\n\nDatabase utilities.\n\n:Copyright: 2006-2014 Jochen Kupperschmidt\n\"\"\"\n\nimport uuid\n\nfrom f...
python
chosen
[ { "from": "system", "value": "Fix script to save output to script’s directory.\n" }, { "from": "human", "value": "#!/usr/bin/env python3\n\nfrom os import scandir\nfrom sys import argv\nfrom platform import uname\nfrom pathlib import Path\n\n\nfilename_template = \"\"\"\n# ----------------------...
python
chosen
[ { "from": "system", "value": "Add typing information to Meta.\n" }, { "from": "human", "value": "import collections\n\n\nclass Meta(collections.OrderedDict):\n def __init__(self, *args, **kwargs):\n self._smallest = float('inf')\n self._largest = 0\n self._ordered = True\n super(Met...
python
chosen
[ { "from": "system", "value": "Update expert database list in the footer\n" }, { "from": "human", "value": "\"\"\"\nCopyright [2009-2014] EMBL-European Bioinformatics Institute\nLicensed under the Apache License, Version 2.0 (the \"License\");\nyou may not use this file except in compliance with ...
python
chosen
[ { "from": "system", "value": "Update expected test result for test_repo_exists now that check_repo_exists returns whether the repo is private or not\n" }, { "from": "human", "value": "from ..local import check_repo_exists\n\nfrom pytest import raises\n\ndef test_bad_user():\n with raises(Runt...
python
chosen
[ { "from": "system", "value": "Use md5.copy() to be more efficient.\n\nThe hash.copy() documentation says this is more efficient given a common\ninitial substring.\n" }, { "from": "human", "value": "#!/usr/bin/env python\n\nimport hashlib\n\nprefix = ''\nnumber = 1\n\nwith open('../inputs/04.txt'...
python
chosen
[ { "from": "system", "value": "Remove contenttypes from INSTALLED_APPS for testing; no longer needed.\n" }, { "from": "human", "value": "#!/usr/bin/env python\n\nimport os, sys\n\nfrom django.conf import settings\nimport django\n\n\nDEFAULT_SETTINGS = dict(\n INSTALLED_APPS=(\n 'django....
python
chosen
[ { "from": "system", "value": "Add a corrected spectral regridding function that smooths before interpolating to a new spectral axis\n" }, { "from": "human", "value": "# Licensed under an MIT open source license - see LICENSE\n\n\nimport numpy as np\n\n\ndef change_slice_thickness(cube, slice_thi...
python
chosen
[ { "from": "system", "value": "Add test response to frequency\n" }, { "from": "human", "value": "from braces.views import CsrfExemptMixin\n\nfrom django.core.mail import send_mail\nfrom django.http import HttpResponse\nfrom django.views.generic import TemplateView, View\n\nfrom clowder_server.mod...
python
chosen
[ { "from": "system", "value": "Fix object name in Django Admin\n\nhttp://stackoverflow.com/questions/9336463/django-xxxxxx-object-display-customization-in-admin-action-sidebar\n" }, { "from": "human", "value": "from django.db import models\n\n\nclass Client(models.Model):\n client_name = model...
python
chosen
[ { "from": "system", "value": "Update package imports for module name change.\n" }, { "from": "human", "value": "# Copyright (c) 2013 Leif Johnson <leif@leifjohnson.net>\n#\n# Permission is hereby granted, free of charge, to any person obtaining a copy\n# of this software and associated documenta...
python
chosen
[ { "from": "system", "value": "Handle situation where only a root full_slug is passed.\n\ni.e. \"section/\" would break the rsplit(). If there is no slug, we can safely raise a DoesNotExist.\n" }, { "from": "human", "value": "from django.db import models\n\n\nclass SectionSlugManager(models.Manag...
python
chosen
[ { "from": "system", "value": "Allow all hosts to support Dokku's healthcheck\n" }, { "from": "human", "value": "from censusreporter.config.base.settings import *\nimport os\n\nDEBUG = False\nROOT_URLCONF = 'censusreporter.config.prod.urls'\nWSGI_APPLICATION = \"censusreporter.config.prod.wsgi.ap...
python
chosen
[ { "from": "system", "value": "Call to stop the reactor now uses the correct convention when closing from a thread other than the main reactor thread.\n\nFixes Issue 5.\n\ngit-svn-id: a0251d2471cc357dbf602d275638891bc89eba80@9 4515f058-c067-11dd-9cb5-179210ed59e1\n" }, { "from": "human", "value":...
python
chosen
[ { "from": "system", "value": "Add test for GRB validator\n" }, { "from": "human", "value": "from .common import random_str\n\n\ndef test_cannot_update_global_role(admin_mc, remove_resource):\n \"\"\"Asserts that globalRoleId field cannot be changed\"\"\"\n admin_client = admin_mc.client\n\...
python
chosen
[ { "from": "system", "value": "Use static method instead of classmethod\n" }, { "from": "human", "value": "# -*- encoding: utf-8 -*-\n\nimport logging\nimport yaml\nfrom collections import namedtuple\n\nlog = logging.getLogger(__name__)\n\n\ndef load(filename):\n with open(filename) as fp:\n ...
python
chosen
[ { "from": "system", "value": "Remove a non-used module importing\n" }, { "from": "human", "value": "from django.contrib import admin\nfrom django.db import models\nfrom django_summernote.widgets import SummernoteWidget, SummernoteInplaceWidget\nfrom django_summernote.models import Attachment\nfr...
python
chosen
[ { "from": "system", "value": "Fix Cannot delete invoice(s) that are already opened or paid\n" }, { "from": "human", "value": "#!/usr/bin/env python\r\n# -*- coding: utf-8 -*-\r\nfrom ooop import OOOP\r\nimport configdb\r\n\r\nO = OOOP(**configdb.ooop)\r\n\r\nimp_obj = O.GiscedataFacturacioImport...
python
chosen
[ { "from": "system", "value": "Store task_id for update, install, and upgrade processes in the database.\n" }, { "from": "human", "value": "from django.db import models\nfrom django.contrib.auth.models import User\nfrom django.conf import settings\nfrom django.db.models.signals import post_save\n...
python
chosen
[ { "from": "system", "value": "Add reception of GPS_RAW_INT messages as demo\n" }, { "from": "human", "value": "#!/usr/bin/env python\n\n'''\ntest mavlink messages\nDo not forget to precise the baudrate (default 115200)\n'''\n\nimport sys, struct, time, os\nfrom curses import ascii\n\nfrom pymavl...
python
chosen
[ { "from": "system", "value": "Add tests for (nottx)riak manager.\n" }, { "from": "human", "value": "\"\"\"Tests for vumi.persist.riak_manager.\"\"\"\n\nfrom twisted.trial.unittest import TestCase\n\nfrom vumi.persist.riak_manager import RiakManager\n\n\nclass TestRiakManager(TestCase):\n pass...
python
chosen
[ { "from": "system", "value": "Change system return exit on failed tests\n" }, { "from": "human", "value": "import os\nfrom app import create_app, db\nfrom flask.ext.script import Manager, Shell, Server\nfrom flask.ext.migrate import Migrate, MigrateCommand\n\napp = create_app(os.getenv('FLASK_CO...
python
chosen
[ { "from": "system", "value": "Handle PyQt 5.3 raising RuntimeError on incompatible orangeqt import\n" }, { "from": "human", "value": "\"\"\"\n\n*************************\nPlot classes and tools for use in Orange widgets\n*************************\n\nThe main class of this module is :obj:`.OWPlot...
python
chosen
[ { "from": "system", "value": "Remove unused left over parameter\n" }, { "from": "human", "value": "#!/usr/bin/env python3\n\nimport json\nimport sys\nimport time\nfrom urllib.request import urlopen\n\nSTATS_URL = \"http://localhost:18001/stats\"\nMAXIMUM_TIME_SECONDS = 2 * 60\nSLEEPING_INTERVAL_...
python
chosen
[ { "from": "system", "value": "Use print() function in both Python 2 and Python 3\n\nDiscovered via: __flake8 . --count --select=E9,F63,F72,F82 --show-source --statistics__\r\n\r\nLegacy __print__ statements are syntax errors in Python 3 but __print()__ function works as expected in both Python 2 and Python ...
python
chosen
[ { "from": "system", "value": "Switch command runner to using db\n" }, { "from": "human", "value": "import configparser\nimport sys\nimport os\n\nparser = configparser.ConfigParser()\nparser.read(\"../halite.ini\")\nWORKERS = dict(parser.items(\"workerIPs\"))\n\ncommand = sys.argv[1]\nprint(comma...
python
chosen
[ { "from": "system", "value": "Switch to head requests rather than get requests.\n" }, { "from": "human", "value": "#!/usr/bin/env python\n\nfrom __future__ import division\nimport requests\nimport json\nimport sys\nfrom requests.exceptions import SSLError, InvalidSchema, ConnectionError\n\ndef g...
python
chosen
[ { "from": "system", "value": "Fix str method for custom User model.\n" }, { "from": "human", "value": "from django.db import models\nfrom django.contrib.auth.models import AbstractUser\nfrom django.utils.encoding import python_2_unicode_compatible\n\n\n@python_2_unicode_compatible\nclass User(Ab...
python
chosen
[ { "from": "system", "value": "Change http url to https\n" }, { "from": "human", "value": "import dateutil.parser\nimport datetime\nimport humanize\n\nstatus_view =\"\"\"\\\n=== Bashhub Status\nhttp://bashhub.com/u/{0}\nTotal Commands: {1}\nTotal Sessions: {2}\nTotal Systems: {3}\n===\nSession P...
python
chosen
[ { "from": "system", "value": "Test things first you big dummy\n" }, { "from": "human", "value": "import math\nfrom django.shortcuts import render\nfrom django.template import RequestContext\nfrom django.http import HttpResponseRedirect\nfrom orders.models import Order\n\ndef index(request, x, y)...
python
chosen
[ { "from": "system", "value": "Set --build instead of --target.\n" }, { "from": "human", "value": "GitHubTarballPackage ('mono', 'llvm', '3.0', '292aa8712c3120b03f9aa1d201b2e7949adf35c3',\n\tconfigure = './configure --prefix=\"%{prefix}\" --enable-optimized --enable-targets=\"x86 x86_64\" --targe...
python
chosen
[ { "from": "system", "value": "UNIT_TEST: Add ability to run unit test script from anywhere\n" }, { "from": "human", "value": "#!/usr/bin/env python\n\nimport serial\nimport os\n\n# Make and flash the unit test\nFILE_LOCATION = os.path.dirname(os.path.abspath(__file__))\nos.system(\"cd \" + FILE...
python
chosen
[ { "from": "system", "value": "Use unittest2 for Python < 2.7.\n" }, { "from": "human", "value": "import unittest\nimport sys\nimport appdirs\n\nif sys.version_info[0] < 3:\n STRING_TYPE = basestring\nelse:\n STRING_TYPE = str\n\n\nclass Test_AppDir(unittest.TestCase):\n def test_metadat...
python
chosen
[ { "from": "system", "value": "Update title of 'Wumo' crawlers, part two\n" }, { "from": "human", "value": "from comics.aggregator.crawler import CrawlerBase, CrawlerImage\nfrom comics.core.comic_data import ComicDataBase\n\n\nclass ComicData(ComicDataBase):\n name = 'Wulffmorgenthaler (vg.no)...
python
chosen
[ { "from": "system", "value": "Enable service-interface and vf-binding extensions by default in\ncontrail based provisioning.\n\nChange-Id: I5916f41cdf12ad54e74c0f76de244ed60f57aea5\nPartial-Bug: 1556336\n" }, { "from": "human", "value": "import string\n\ntemplate = string.Template(\"\"\"\n[APISE...
python
chosen
[ { "from": "system", "value": "Test - add linker script for tools project\n" }, { "from": "human", "value": "project_1_yaml = {\n 'common': {\n 'sources': ['sources/main.cpp'],\n 'includes': ['includes/header1.h'],\n 'target': ['mbed-lpc1768']\n }\n}\n\nprojects_1_yaml ...
python
chosen
[ { "from": "system", "value": "Increase version to 0.9.2 for release\n" }, { "from": "human", "value": "__version__ = '0.9.1'\n\nfrom dicomweb_client.api import DICOMwebClient\n" }, { "from": "gpt", "value": "__version__ = '0.9.2'\n\nfrom dicomweb_client.api import DICOMwebClient\n" ...
python
chosen
[ { "from": "system", "value": "Fix to make sure we dont get errors in gevent socket write call when we are writing the policy file back\n\nConflicts:\n\n\tsocketio/policyserver.py\n" }, { "from": "human", "value": "from gevent.server import StreamServer\n\n__all__ = ['FlashPolicyServer']\n\n\ncla...
python
chosen
[ { "from": "system", "value": "Use strings instead of tuples as keys in SessionKeyValueStore\n\nSome Django packages expect only strings as keys in the user session,\nand it is also a recommended practice in the Django manual.\n" }, { "from": "human", "value": "\"\"\"\nAn :class:`~xblock.runtime....
python
chosen
[ { "from": "system", "value": "Revert \"Made BaseInput inherit from forms.Field so inputs can be used in layouts. Added a SubmitButtonWidget.\"\n\nThis reverts commit aa571b2e1fd177491895cc263b192467431b90c2.\n" }, { "from": "human", "value": "from django import forms\nfrom django.forms.widgets i...
python
chosen