conversations
listlengths
2
3
source
stringclasses
1 value
stack
stringclasses
1 value
[ { "from": "system", "value": "Fix database upgrade from a new database\n\nThis fixes the problem where running \"mistral-db-manage upgrade heads\" on a\nnew database result in error with workflow_input_hash index does not exist.\n\nChange-Id: I560b2b78d11cd3fd4ae9c8606e4336e87b22ef27\nCloses-Bug: #1519929\n...
python
chosen
[ { "from": "system", "value": "Update package description so it displays correctly on PyPI.\n\nThe description was wrapping, so it appeared with a single '(' character\non PyPI. I've updated it so that it's now all on a single line.\n" }, { "from": "human", "value": "\"\"\"An inbound email handle...
python
chosen
[ { "from": "human", "value": "Add Bisnode Rating Report model\n" }, { "from": "gpt", "value": "from django.db import models\n\nfrom .constants import COMPANY_RATING_REPORT\n\nfrom .bisnode import get_bisnode_company_report\n\n\nclass BisnodeRatingReport(models.Model):\n organization_number = m...
python
chosen
[ { "from": "system", "value": "Clean up the blist namespace.\n" }, { "from": "human", "value": "from blist._blist import *\nimport collections\nif hasattr(collections, 'MutableSet'): # Only supported in Python 2.6+\n from blist._sortedlist import sortedlist, sortedset, weaksortedlist, weaksort...
python
chosen
[ { "from": "system", "value": "Check for job in main loop\n" }, { "from": "human", "value": "#!/usr/bin/env python\n\nimport sys\nimport time\nimport picamera\nimport settings\nfrom settings import IMAGE, SNAP\nimport uploader\n\n\ndef main():\n with picamera.PiCamera() as camera:\n cam...
python
chosen
[ { "from": "system", "value": "Fix newline handling in autoreload test\n" }, { "from": "human", "value": "from __future__ import absolute_import, division, print_function\nimport os\nimport subprocess\nfrom subprocess import Popen\nimport sys\nfrom tempfile import mkdtemp\n\nfrom tornado.test.uti...
python
chosen
[ { "from": "human", "value": "Add test for `Cycle` maker.\n" }, { "from": "gpt", "value": "from mongoframes.factory import makers\nfrom mongoframes.factory.makers import selections as selection_makers\n\nfrom tests.fixtures import *\n\n\ndef test_cycle():\n \"\"\"\n `Cycle` makers should re...
python
chosen
[ { "from": "system", "value": "Remove unused filename parameter from card image filename function\n" }, { "from": "human", "value": "from __future__ import unicode_literals\n\nfrom django.contrib.auth.models import User\nfrom django.db import models\nfrom django.utils.encoding import python_2_uni...
python
chosen
[ { "from": "system", "value": "Fix DeprecationWarning in Django 1.5\n" }, { "from": "human", "value": "try:\n from django.conf.urls.defaults import patterns, url\nexcept ImportError:\n from django.conf.urls import patterns, url\n\n\nurlpatterns = patterns('',\n url(r'^server-data\\.js$',...
python
chosen
[ { "from": "system", "value": "Add MiddlewareMixin for Django 1.10 middleware compatibility\n" }, { "from": "human", "value": "from debugtools.utils.xview import track_view_name, get_used_view_name, get_used_template\n\n\nclass XViewMiddleware(object):\n \"\"\"\n Adds an X-View header to re...
python
chosen
[ { "from": "system", "value": "Add support for Python 3" }, { "from": "human", "value": "#!/usr/bin/env python\n#\n# Wrapper for mpy-cross.py.\n#\n\nfrom __future__ import print_function\n\nimport sys\nimport os\nimport subprocess\n\n\ndef main():\n command = sys.argv[3:]\n env = dict(os.en...
python
chosen
[ { "from": "system", "value": "Replace \"pass\" with \"self.fail()\" in tests\n\nIn this way, tests that haven't been written will run noisily instead of\nsilently, encouraging completion of writing tests.\n" }, { "from": "human", "value": "# -*- coding: utf-8 -*-\nimport unittest\nimport pathlib...
python
chosen
[ { "from": "system", "value": "Clean up docs on extension protocols.\n" }, { "from": "human", "value": "\"\"\"Utility code for the objectrocket package.\"\"\"\nimport types\n\n\ndef register_extension_class(ext, base, *args, **kwargs):\n \"\"\"Instantiate the given extension class and register...
python
chosen
[ { "from": "system", "value": "Move REPLWrapper and u() function to pkg level\n" }, { "from": "human", "value": "from ._metakernel import MetaKernel\nfrom . import pexpect\nfrom . import replwrap\nfrom .process_metakernel import ProcessMetaKernel\nfrom .magic import Magic, option\nfrom .parser im...
python
chosen
[ { "from": "system", "value": "Check if the git repo already exists before cloning it again\n" }, { "from": "human", "value": "\nfrom subprocess import check_call\nimport urllib\nimport json\nimport os\nimport os.path\n\n\ndef install():\n if not (os.path.isfile('.bowerrc') and os.path.isfile(...
python
chosen
[ { "from": "system", "value": "Use os.path.join to build prod\n" }, { "from": "human", "value": "#!/usr/bin/env python\n\n# create a single jsonl file from individual register entries\n\nimport sys\nimport os\nfrom openregister import Item\nfrom openregister.representations.jsonl import Writer\n\...
python
chosen
[ { "from": "system", "value": "Improve http check to allow https as well\n\nWe switch from 'startswith' to a regex check which allows both as we\ntested with https facebook urls and it failed to handle them properly.\n" }, { "from": "human", "value": "# -*- coding: utf-8 -*-\n\n# © Copyright 2009...
python
chosen
[ { "from": "system", "value": "Make cached_function not overwrite signature of wrapped function\n" }, { "from": "human", "value": "# Various utility functions\nimport os\nfrom typing import Any, Callable\n\n\nSHOULD_CACHE = os.environ.get('ENV', 'development') == 'production'\n\n\ndef cached_func...
python
chosen
[ { "from": "system", "value": "Remove import of n/a benchmark module.\n\ngit-svn-id: 8b0eea19d26e20ec80f5c0ea247ec202fbcc1090@75 5646265b-94b7-0310-9681-9501d24b2df7\n" }, { "from": "human", "value": "import warnings\n\nfrom dtml import tal, metal, tales, context\n\nfrom sheared.python import io\...
python
chosen
[ { "from": "system", "value": "Make this code actually do something!\n" }, { "from": "human", "value": "from __future__ import print_function\nfrom fontTools import ttLib\nfrom multiprocessing import Pool\n\nfrom .fontcrunch import optimize_glyph, plot_glyph\n\ndef _optimize(args):\n font, nam...
python
chosen
[ { "from": "system", "value": "Move master version to 0.1.1.\n" }, { "from": "human", "value": "#!/usr/bin/env python3\n# -*- coding: utf-8 -*-\n#\n# Copyright 2017 Kaede Hoshikawa\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may not use this file except in...
python
chosen
[ { "from": "system", "value": "Add initial check for arg webhook_url\n" }, { "from": "human", "value": "import time\nimport requests\n\n\nclass SlackNotificationError(Exception):\n pass\n\n\ndef send_slack_message(message, webhook_url, pretext=None, title=None):\n \"\"\" Send slack message ...
python
chosen
[ { "from": "system", "value": "Change to script and add significant documentation\n" }, { "from": "human", "value": "from patch_headers import patch_headers, add_object_info\nimport sys\n\nfor currentDir in sys.argv[1:]:\n print \"working on directory: %s\" % currentDir\n patch_headers(curr...
python
chosen
[ { "from": "system", "value": "Fix task path for cleanup" }, { "from": "human", "value": "import os\nfrom datetime import timedelta\n\nBROKER_URL = os.environ['CELERY_BROKER_URL']\nCELERY_IMPORTS = ('cabot.cabotapp.tasks', )\nCELERYBEAT_SCHEDULER = \"djcelery.schedulers.DatabaseScheduler\"\nCELER...
python
chosen
[ { "from": "system", "value": "Enable asyncio debugging if settings.DEBUG is True\n" }, { "from": "human", "value": "from django.core.management.base import BaseCommand\n\nimport importlib\nimport asyncio\n\n\nclass Command(BaseCommand):\n\n def handle(self, *args, **options):\n loop = ...
python
chosen
[ { "from": "system", "value": "Store tool's name when parsing container\n" }, { "from": "human", "value": "\n\ndef imprint_container(tool,\n name,\n namespace,\n context,\n loader=None):\n \"\"\"Imprint a Loade...
python
chosen
[ { "from": "system", "value": "Use existing `admin_app` fixture for admin tests\n" }, { "from": "human", "value": "\"\"\"\n:Copyright: 2006-2020 Jochen Kupperschmidt\n:License: Modified BSD, see LICENSE for details.\n\nFixtures specific to admin blueprints\n\"\"\"\n\nimport pytest\n\nfrom tests.b...
python
chosen
[ { "from": "system", "value": "Create user name on Admin form create\n" }, { "from": "human", "value": "# Django\nfrom django import forms\n\n# Local\nfrom .models import User\n\n\nclass UserCreationForm(forms.ModelForm):\n\n class Meta:\n model = User\n fields = '__all__'\n\n ...
python
chosen
[ { "from": "system", "value": "Make definition of conditional on NumPy being installed; update skip message to match that used elsewhere\n" }, { "from": "human", "value": "#------------------------------------------------------------------------------\n# Copyright (c) 2005, Enthought, Inc.\n# Al...
python
chosen
[ { "from": "system", "value": "Add 'host_node' and 'host_cluster' properties to container profile\n\nAdd 'host_node' and 'host_cluster' properties to container profile,\nin a container profile, either 'host_node' or 'host_cluster' will\nbe assigned a value for a container node creation or a container\ncluste...
python
chosen
[ { "from": "system", "value": "Allow default values in field()\n" }, { "from": "human", "value": "def field(f, cast=None):\n\tdef _inner(self):\n\t\tret = self._obj[f]\n\t\tif cast:\n\t\t\tret = cast(ret)\n\t\treturn ret\n\treturn property(_inner)\n\n\nclass Object:\n\tdef __init__(self, data=Non...
python
chosen
[ { "from": "system", "value": "Make settings test respect ES_INDEX_PREFIX.\n" }, { "from": "human", "value": "# The test system uses this to override settings in settings.py and\n# settings_local.py with settings appropriate for testing.\n\n# Make sure Celery is EAGER.\nCELERY_ALWAYS_EAGER = True...
python
chosen
[ { "from": "system", "value": "Return active dir for use by clients.\n" }, { "from": "human", "value": "\"\"\"\nHelper functions for pushing content to a staging directory, moving the old directory aside, and moving the staging directory into place.\n\"\"\"\nfrom fabric.api import env\nfrom fabri...
python
chosen
[ { "from": "system", "value": "Fix json loading, fix capital checker\n" }, { "from": "human", "value": "\"\"\"Handle incoming spam messages.\"\"\"\n\nfrom ..handler import Handler\n\nimport logging\nimport json\n\nclass SpamHandler(Handler):\n \"\"\"Spam handler.\"\"\"\n\n MAX_SCORE = 16\n ...
python
chosen
[ { "from": "system", "value": "Fix PasswordRecovery test case name\n" }, { "from": "human", "value": "from django.test import TestCase\n\nfrom ovp_users.recover_password import RecoveryTokenFilter\nfrom ovp_users.recover_password import RecoverPasswordFilter\n\ndef test_filter(c):\n obj = c()\n ...
python
chosen
[ { "from": "system", "value": "Add some more endpoints to the flask example\n" }, { "from": "human", "value": "from pyinstrument import Profiler\n\ntry:\n from flask import Flask, g, make_response, request\nexcept ImportError:\n print('This example requires Flask.')\n print('Install usin...
python
chosen
[ { "from": "system", "value": "Create SiteMeta for default site\n" }, { "from": "human", "value": "\"\"\"\nBusiness logic in this app is implemented using a CQRS style. Commands should\nbe implemented as functions here. Queries should be implemented as methods on\nDjango model managers. Commands ...
python
chosen
[ { "from": "system", "value": "Update print_gcide example to work with latest api changes.\n" }, { "from": "human", "value": "import os\nimport sys\nlib_path = os.path.abspath('../')\nsys.path.append(lib_path)\n\nimport s3g\nimport serial\nimport optparse\n\nparser = optparse.OptionParser()\npars...
python
chosen
[ { "from": "system", "value": "Make itk and pyfftw extra requirements\n\nNeither are needed by the core pipeline, some operators use them. Fixes\nissue #2040.\n\nSigned-off-by: Marcus D. Hanwell <cf7042e2e8eee958b5bcde1ae2cbefef82efc184@kitware.com>\n" }, { "from": "human", "value": "from setupto...
python
chosen
[ { "from": "system", "value": "Remove magic for loading templates from module names\n" }, { "from": "human", "value": "\"\"\"Python script Exporter class\"\"\"\n\n#-----------------------------------------------------------------------------\n# Copyright (c) 2013, the IPython Development Team.\n#...
python
chosen
[ { "from": "system", "value": "Update the schema a bit and add the geo manager\n" }, { "from": "human", "value": "from django.contrib.gis.db import models\n\n\nclass Hospital(models.Model):\n file_nbr = models.CharField(max_length=20)\n license_number = models.CharField(max_length=20)\n ...
python
chosen
[ { "from": "system", "value": "Test whether uploaded CSV has correct mime type.\n\nAdd cleaning method to CsvUploadForm to ensure that uploaded file has\neither the mime type for a CSV file or no mime type. Return error if\nuser uploads a different mime type.\n" }, { "from": "human", "value": "fr...
python
chosen
[ { "from": "system", "value": "Fix example uploadr - wrong FieldList import\n" }, { "from": "human", "value": "from flask import Flask, render_template\nfrom flask_wtf import Form\nfrom flask_wtf.file import FileField, FieldList\n\n\nclass FileUploadForm(Form):\n uploads = FieldList(FileField(...
python
chosen
[ { "from": "system", "value": "Sort countries before generating combinations.\n" }, { "from": "human", "value": "import sys\nimport itertools\nimport collections\n\nimport networkx as nx\n\n\nfrom irco import logging\n\nlog = logging.get_logger()\n\n\ndef get_countries(publication):\n publicat...
python
chosen
[ { "from": "system", "value": "normalize_namreply_params: Fix typo in function call\n" }, { "from": "human", "value": "\"\"\"\nHandles ambiguities of RFCs.\n\"\"\"\n\n\ndef normalize_namreply_params(params):\n # So… RFC 2812 says:\n # \"( \"=\" / \"*\" / \"@\" ) <channel>\n # ...
python
chosen
[ { "from": "system", "value": "Fix test to reflect changes to welcome email\n" }, { "from": "human", "value": "import time\nfrom ..utils.log import log, INFO, ERROR, PASS\nfrom ..utils.i_selenium import assert_tab, image_div\nfrom ..tests import TestWithDependency\n\n__all__ = [\"welcome_email\"]...
python
chosen
[ { "from": "system", "value": "Use Mosab's site to get the status\n" }, { "from": "human", "value": "import urllib, datetime, os\n\ndef fetch():\n url = 'http://loadmeter.egyptera.org/ClockToolTip.aspx'\n output = datetime.datetime.now().strftime('egyptera.%Y-%m-%d-%H-%M-%S.html')\n outp...
python
chosen
[ { "from": "system", "value": "Add completed field to review\n" }, { "from": "human", "value": "from django.db import models\nfrom django.contrib.auth.models import User\n\n\nclass Review(models.Model):\n user = models.ForeignKey(User, default=None)\n title = models.CharField(max_length=128...
python
chosen
[ { "from": "system", "value": "Use right test case for py 2.6\n" }, { "from": "human", "value": "import sys\n\n\nif sys.version_info < (2, 7):\n from tests import TestCase # NOQA\nelse:\n from unittest import TestCase # NOQA\n" }, { "from": "gpt", "value": "import sys\n\n\nif ...
python
chosen
[ { "from": "system", "value": "Fix running unit tests through the old test runner.\n\nThe old test runner (currently used in CI) had a regression when moving\nto pytest. It failed to convert the first argument (the database name to\nrun everything against) to the new `pytest --db=` argument.\n\nThis change a...
python
chosen
[ { "from": "system", "value": "Add back in geolocate url name.\n" }, { "from": "human", "value": "from django.conf.urls.defaults import patterns, url, include\nfrom django.views.generic.simple import direct_to_template\nimport django.views.static\nimport settings\nimport views\n\n# Uncomment th...
python
chosen
[ { "from": "system", "value": "Remove \"utility.hmac.hmac_creation\" which causes circular imports\n\nHacky but re-implement `hmac_creation` as `create_hmac`\n" }, { "from": "human", "value": "\"\"\"This module contains gn2 decorators\"\"\"\nfrom flask import g\nfrom typing import Dict\nfrom func...
python
chosen
[ { "from": "system", "value": "Fix migration that fails on postgres\n" }, { "from": "human", "value": "# -*- coding: utf-8 -*-\nfrom __future__ import unicode_literals\n\nfrom django.db import models, migrations\n\n\nclass Migration(migrations.Migration):\n\n dependencies = [\n ('studyg...
python
chosen
[ { "from": "system", "value": "Set default config values to none so user is forced to set them.\n\nAlso document fields in the default config\n" }, { "from": "human", "value": "class DefaultConfig():\n secret_key = \"LONG_AND_RANDOM\"\n tmdb_api_key = \"THEMOVIEDB.ORG_API_KEY\"\n" }, { ...
python
chosen
[ { "from": "system", "value": "Convert remaining use of neutronclient.i18n to _i18n\n\nChange-Id: I77f168af92ae51ce16bed4988bbcaf7c18557727\nRelated-Bug: 1519493\n" }, { "from": "human", "value": "# Licensed under the Apache License, Version 2.0 (the \"License\"); you may\n# not use this file exc...
python
chosen
[ { "from": "system", "value": "Fix interop issues with pytest-instafail\n" }, { "from": "human", "value": "# -*- coding: utf-8 -*-\ndef pytest_runtest_logreport(report):\n \"\"\"Overwrite report by removing any captured stderr.\"\"\"\n # print(\"PLUGIN SAYS -> report -> {0}\".format(report)...
python
chosen
[ { "from": "system", "value": "Test everything with stress test.\n\n" }, { "from": "human", "value": "#!/usr/bin/env python\n\n# Copyright 2007 Albert Strasheim <fullung@gmail.com>\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may not use this file except in compl...
python
chosen
[ { "from": "system", "value": "Use /join instead of /accept invite.\n" }, { "from": "human", "value": "from plumeria.command import commands, CommandError\nfrom plumeria.message.lists import build_list\nfrom plumeria.perms import owners_only\nfrom plumeria.transport import transports\n\n\n@comman...
python
chosen
[ { "from": "system", "value": "Remove unused import in tests\n" }, { "from": "human", "value": "# -*- coding: utf-8 -*-\n\nfrom hijack.tests.test_hijack import BaseHijackTests\nfrom hijack.tests.utils import SettingsOverride\n\nfrom hijack_admin import settings as hijack_admin_settings\nfrom hija...
python
chosen
[ { "from": "system", "value": "Tag commit for v0.0.20-master generated by gitmake.py\n" }, { "from": "human", "value": "major = 0\nminor=0\npatch=19\nbranch=\"master\"\ntimestamp=1376526199.16" }, { "from": "gpt", "value": "major = 0\nminor=0\npatch=20\nbranch=\"master\"\ntimestamp=13...
python
chosen
[ { "from": "system", "value": "FIX: Raise Exception instead of plain string\n" }, { "from": "human", "value": "import ConfigParser\nConfig = ConfigParser.ConfigParser()\n\nimport os\nprint os.getcwd()\ntry:\n Config.read('/opt/monstr/current.cfg')\nexcept Exception as e:\n print 'WARNING! C...
python
chosen
[ { "from": "system", "value": "Use alt naming convention instead\n" }, { "from": "human", "value": "from django.test import TestCase\nfrom django.conf import settings\nfrom django.contrib.staticfiles.testing import StaticLiveServerTestCase\n\nfrom selenium import webdriver\nfrom selenium.webdrive...
python
chosen
[ { "from": "system", "value": "Add **kwargs to ActionViewmixin.post() handler\n\nDetails: #359\n" }, { "from": "human", "value": "from django.contrib.auth import user_logged_in, user_logged_out, login, logout\nfrom django.utils.encoding import force_bytes, force_text\nfrom django.utils.http impor...
python
chosen
[ { "from": "system", "value": "Fix bug when trying to convert transaction code to int\n" }, { "from": "human", "value": "import logging\nlogger = logging.getLogger('djpg')\n\nfrom django.dispatch import Signal\nfrom .codes import codes\n\nnotification_received = Signal(providing_args=['notificati...
python
chosen
[ { "from": "system", "value": "Use valid fromlist parameter when calling __import__\n\nThis was working before, but it wasn't what I had intended to write. It doesn't really matter what is passed in here as long as it isn't an empty list.\n" }, { "from": "human", "value": "# import_string was app...
python
chosen
[ { "from": "system", "value": "fix: Return the message status to the message broker\n" }, { "from": "human", "value": "from django.conf import settings\n\nfrom app.schedule.celery import celery_app\nfrom app.schedule.libs.sms import DeviceNotFoundError\n\n\n@celery_app.task(bind=True)\ndef send_m...
python
chosen
[ { "from": "system", "value": "Add test for filepath with non-ascii-chars" }, { "from": "human", "value": "import os\nimport unittest\nimport netCDF4\n\nclass test_filepath(unittest.TestCase):\n\n def setUp(self):\n self.netcdf_file = os.path.join(os.getcwd(), \"netcdf_dummy_file.nc\")\...
python
chosen
[ { "from": "system", "value": "Add insert_into_file to skeleton module" }, { "from": "human", "value": "\"\"\"\nBasic Template system for project skeleton.\n\nskeleton is similar to the template part of PasteScript but \nwithout any dependencies; it should also be compatible with Python 3.\n\nHow...
python
chosen
[ { "from": "system", "value": "Fix params handling in {{s}}.\n" }, { "from": "human", "value": "#-*- encoding: utf-8 -*-\n\nimport base\n\ndef handle_date(template):\n year = None\n if len(template.params) >= 3:\n try:\n year = int(unicode(template.params[2]))\n exc...
python
chosen
[ { "from": "system", "value": "Add not implemeted get cluster\n" }, { "from": "human", "value": "from tests.types import string\n\n\ndef test_get(test):\n\n def handle_connect(handler):\n info = handler.api.get_info()\n assert isinstance(info['api_version'], string)\n asse...
python
chosen
[ { "from": "system", "value": "Update pubtator test given new pubtator output\n" }, { "from": "human", "value": "\nimport kindred\n\ndef test_pubtator():\n\tdata = kindred.pubtator.load([19894120,19894121])\n\n\tassert isinstance(data,list)\n\tfor d in data:\n\t\tassert isinstance(d,kindred.Relat...
python
chosen
[ { "from": "system", "value": "Add instructions to regenerate Python proto wrappers.\n" }, { "from": "human", "value": "#\n# Licensed to the Apache Software Foundation (ASF) under one or more\n# contributor license agreements. See the NOTICE file distributed with\n# this work for additional info...
python
chosen
[ { "from": "system", "value": "Add test to test if os_family grain is provided.\n\nCorey Quinn reported a issue where __grains__['os_family'] returned a\nKeyError. This commits adds a check to the grains module test to ensure\nos_family is present.\n" }, { "from": "human", "value": "'''\nTest the...
python
chosen
[ { "from": "system", "value": "DOC: Fix X -> x in cubic_rectification\n" }, { "from": "human", "value": "\"\"\"\nModule provides a simple cubic_rectification function.\n\"\"\"\n\nimport numpy as np\n\n\ndef cubic_rectification(x):\n \"\"\"\n Rectified cube of an array.\n\n Parameters\n ...
python
chosen
[ { "from": "system", "value": "Fix typo in exception docstring" }, { "from": "human", "value": "class FlowRuntimeError(Exception):\n \"\"\"Unrecovable flow runtime error.\"\"\"\n\n\nclass FlowLockFailed(Exception):\n \"\"\"Flow lock failed.\"\"\"\n" }, { "from": "gpt", "value": ...
python
chosen
[ { "from": "system", "value": "Fix test case for class Person\n" }, { "from": "human", "value": "import unittest\nfrom classes.person import Person\n\n\nclass PersonClassTest(unittest.TestCase):\n def test_full_name_only_returns_strings(self):\n with self.assertRaises(ValueError, msg='O...
python
chosen
[ { "from": "system", "value": "Drop support for reacct_representation property\n" }, { "from": "human", "value": "# -*- coding: utf-8 -*-\nfrom __future__ import unicode_literals\n\nfrom django.core.serializers.json import DjangoJSONEncoder\nfrom django_react_templatetags.mixins import Representa...
python
chosen
[ { "from": "system", "value": "Clean up form in CaseForm\n" }, { "from": "human", "value": "# -*- coding: utf-8 -*-\nfrom atom.ext.crispy_forms.forms import SingleButtonMixin\nfrom braces.forms import UserKwargModelFormMixin\nfrom django import forms\n\nfrom .models import Case\n\n\nclass CaseFor...
python
chosen
[ { "from": "system", "value": "Revert splitting of model as its adding to much complexitiy for the timebeing to later logics\nIIt's just not adding enought value for having a more complicated implementation.\n" }, { "from": "human", "value": "from django.db import models\n\nclass Contact(models.M...
python
chosen
[ { "from": "system", "value": "Add initial url to question\n" }, { "from": "human", "value": "\"\"\"golingo 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": "Remove delay from loop for testing\n" }, { "from": "human", "value": "import capture\nfrom picamera import PiCamera\nimport time\nimport delay\n\n\ndef image_cap_loop(camera, status=None):\n \"\"\"Set image parameters, capture image, set wait time, repeat\"\"\"\n...
python
chosen
[ { "from": "system", "value": "Update gunicorn config with docs\n" }, { "from": "human", "value": "\"\"\"\nThis file contains gunicorn settings.\nTo run sqmpy with gunicorn run the following command:\n\n gunicorn -c gunicorn_cfg.py run:app\n\nIn order to daemonize gunicorn add -D flag:\n\n ...
python
chosen
[ { "from": "system", "value": "Remove a useless function call\n" }, { "from": "human", "value": "# Copyright 2013 Donald Stufft\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may not use this file except in compliance with the License.\n# You may obtain a copy of t...
python
chosen
[ { "from": "system", "value": "Update pythonaction sample for simpler run.\n" }, { "from": "human", "value": "import math\n\n\nclass PrimeChecker(object):\n\n def run(self, **kwargs):\n return self._is_prime(**kwargs)\n\n def _is_prime(self, value=0):\n if math.floor(value) !=...
python
chosen
[ { "from": "system", "value": "Allow VendDateTimeField to accept null dates (if required is set to False)\n" }, { "from": "human", "value": "import re\n\nfrom django import forms\nfrom django.utils.dateparse import parse_datetime\nfrom django.core.exceptions import ValidationError\n\ndef valid_da...
python
chosen
[ { "from": "system", "value": "Set pool_recycle to deal with MySQL closing idle connections.\n\nSee http://docs.sqlalchemy.org/en/latest/dialects/mysql.html#connection-timeouts\n\nCherry-picking this onto master so it definitely gets deployed.\n" }, { "from": "human", "value": "from sqlalchemy im...
python
chosen
[ { "from": "system", "value": "Add the ability for individual objects to define how they would like there data to be outputed for json\n" }, { "from": "human", "value": "import json as json_converter\nfrom datetime import date, datetime\n\nfrom hug.format import content_type\n\n\ndef _json_conver...
python
chosen
[ { "from": "system", "value": "Use SkipTest that works on Py2.6\n" }, { "from": "human", "value": "import os\nimport unittest\nimport time\nimport uuid\n\nfrom kazoo.client import KazooClient, KazooState\n\n# if this env variable is set, ZK client integration tests are run\n# against the specifie...
python
chosen
[ { "from": "system", "value": "Mark final for 0.2 release\n\n" }, { "from": "human", "value": "# Copyright (C) 2010, 2011 Linaro Limited\n#\n# Author: Zygmunt Krynicki <zygmunt.krynicki@linaro.org>\n#\n# This file is part of LAVA Server.\n#\n# LAVA Server is free software: you can redistribute it...
python
chosen
[ { "from": "system", "value": "Check for and use system proxies for downloading files\n\nIn some cases when the user is using a proxy urlib.urlopen() will fail to successfully open https files. This prevents the retriever from accessing the scripts stored on GitHub and causes the installation to fail (see #2...
python
chosen
[ { "from": "system", "value": "Test if lecturer is logged in upon login-request\n" }, { "from": "human", "value": "\nfrom django.test import Client, TestCase\n\n\nc = Client()\n\n\nclass WebsiteStabilityTestCase(TestCase):\n def test_availability(self):\n self.assertEqual(c.get('/lectur...
python
chosen
[ { "from": "system", "value": "Remove name, url and email from comment form\n" }, { "from": "human", "value": "from django.shortcuts import render_to_response, get_object_or_404\nfrom django.template import RequestContext\nfrom django.contrib.auth.decorators import login_required\nfrom django.uti...
python
chosen
[ { "from": "system", "value": "Add a helpful message if no command given\n" }, { "from": "human", "value": "import sys\n\ncommands = {}\nargs = []\nkwargs = {}\n\n\ndef EXIT(msg, code=1):\n print(msg)\n sys.exit(code)\n\ndef command(fn):\n commands[fn.__name__] = fn\n return fn\n\n\nd...
python
chosen
[ { "from": "system", "value": "Add error message if User does not enter email address\n" }, { "from": "human", "value": "import sys\nfrom Bio import Entrez\nfrom Bio import SeqIO\nEntrez.email = \"davidsshin@lbl.gov\"\n\ninfilename = sys.argv[1]\noutfilename = sys.argv[2]\n\nwith open(infilename)...
python
chosen
[ { "from": "system", "value": "Add case for when there are no node backrefs on logs. Again, this whole method will change when eliminating backrefs from nodelogs is merged.\n" }, { "from": "human", "value": "# -*- coding: utf-8 -*-\nfrom rest_framework import permissions\n\nfrom website.models i...
python
chosen
[ { "from": "system", "value": "Add logging to before_first_request decorator\n" }, { "from": "human", "value": "from flask import Flask\nfrom flask_restful import Api\n\n\napp = Flask(__name__)\napi = Api(app)\n\ndebug = True\n\n\n@app.before_first_request\ndef before_first_request():\n pass\n...
python
chosen
[ { "from": "system", "value": "Add get path for remote snapshot\n" }, { "from": "human", "value": "from constants import *\nfrom core_snapshot import CoreSnapshot\nimport logging\n\nlogger = logging.getLogger(APP_NAME)\n\nclass RemoteSnapshot(CoreSnapshot):\n def _get_path(self):\n retu...
python
chosen
[ { "from": "system", "value": "interface.subprocess: Add docs to backtics function\n" }, { "from": "human", "value": "import subprocess\n\n# --- replacing shell backticks ---\n# https://docs.python.org/2/library/subprocess.html#replacing-bin-sh-shell-backquote\n# output=`mycmd myarg`\n# outpu...
python
chosen
[ { "from": "system", "value": "Add a test for getting an empty bucket\n" }, { "from": "human", "value": "import pytest\n\nfrom jacquard.buckets.constants import NUM_BUCKETS\n\n\n@pytest.mark.parametrize('divisor', (\n 2,\n 3,\n 4,\n 5,\n 6,\n 10,\n 100,\n))\ndef test_divisibl...
python
chosen
[ { "from": "system", "value": "Fix Namespace for cmd line args\n" }, { "from": "human", "value": "try:\n import argparse\nexcept ImportError:\n argparse = None\nimport sys\n \nimport core\n\n\ndef main():\n if argparse:\n args = get_parser().parse_args(sys.argv[1:])\n la...
python
chosen