conversations
listlengths
2
3
source
stringclasses
1 value
stack
stringclasses
1 value
[ { "from": "system", "value": "Update to pass live server url as param to protractor\n" }, { "from": "human", "value": "# -*- coding: utf-8 -*-\n\nimport os\nimport subprocess\n\n\nclass ProtractorTestCaseMixin(object):\n protractor_conf = 'protractor.conf.js'\n suite = None\n specs = No...
python
chosen
[ { "from": "system", "value": "Fix missing import in contrib script added in [2630].\n\ngit-svn-id: eda3d06fcef731589ace1b284159cead3416df9b@2631 af82e41b-90c4-0310-8c96-b1721e28e2e2\n" }, { "from": "human", "value": "#!/usr/bin/env python\n# \n# This script completely migrates a <= 0.8.x Trac en...
python
chosen
[ { "from": "system", "value": "Enable the Appstats Interactive Playground.\n" }, { "from": "human", "value": "\"\"\"Configuration.\"\"\"\n\nimport logging\nimport os\nimport re\n\nfrom google.appengine.ext.appstats import recording\n\nlogging.info('Loading %s from %s', __name__, __file__)\n\n# Cu...
python
chosen
[ { "from": "system", "value": "Make test not depend on django-pipeline\n" }, { "from": "human", "value": "from django.core.urlresolvers import reverse\nfrom django.test import TestCase\n\n\nclass HTTPGetRootTestCase(TestCase):\n def setUp(self):\n pass\n\n def test_get_root_expect_ht...
python
chosen
[ { "from": "system", "value": "Make default output consistent with old version\n\nI flipped the hyphen around: should be 'anchorhub-out', accidentally was\n'out-anchorhub'\n" }, { "from": "human", "value": "\"\"\"\nDefaults for all settings used by AnchorHub\n\"\"\"\n\nWRAPPER = '{ }'\n\nINPUT = ...
python
chosen
[ { "from": "system", "value": "Update version number to 1.9\n" }, { "from": "human", "value": "\"\"\"\nA collection of Django extensions that add content-management facilities to Django projects.\n\nDeveloped by Dave Hall.\n\n<http://etianen.com/>\n\"\"\"\n\nVERSION = (1, 8, 5)\n" }, { "f...
python
chosen
[ { "from": "system", "value": "Use functools.partial for client action proxy.\n" }, { "from": "human", "value": "from automatron.backend.plugin import PluginManager\nfrom automatron.controller.controller import IAutomatronClientActions\nfrom automatron.core.controller import BaseController\n\n\nc...
python
chosen
[ { "from": "system", "value": "Make it look nicer, possibly micro seconds faster\n" }, { "from": "human", "value": "from django.views import generic\n\nfrom gallery.models import GalleryImage\nfrom gallery import queries\nfrom .models import Arc, Issue\n\n\nclass IndexView(generic.ListView):\n ...
python
chosen
[ { "from": "system", "value": "Set None instead of NoneType to SimEvent.sim_procedure to make pickle happy.\n" }, { "from": "human", "value": "import itertools\nevent_id_count = itertools.count()\n\nclass SimEvent(object):\n #def __init__(self, address=None, stmt_idx=None, message=None, except...
python
chosen
[ { "from": "system", "value": "acceptance: Add more comprehensive testing of `modify`\n" }, { "from": "human", "value": "import datetime\n\nfrom nose.tools import assert_raises\n\nfrom scalymongo import Document\nfrom scalymongo.errors import ModifyFailedError\nfrom tests.acceptance.base_acceptan...
python
chosen
[ { "from": "system", "value": "Fix Python3 unicode test error\n" }, { "from": "human", "value": "from ansiblelint import AnsibleLintRule\n\n\nclass NoFormattingInWhenRule(AnsibleLintRule):\n id = 'CINCH0001'\n shortdesc = 'No Jinja2 in when'\n description = '\"when\" lines should not inc...
python
chosen
[ { "from": "system", "value": "Add space on the RHS of geom_point test\n" }, { "from": "human", "value": "from __future__ import absolute_import, division, print_function\n\nimport pandas as pd\n\nfrom ggplotx import ggplot, aes, geom_point\n\n\ndef test_aesthetics():\n df = pd.DataFrame({\n ...
python
chosen
[ { "from": "system", "value": "Make loading config file safer\n" }, { "from": "human", "value": "import os\nimport logging\nimport yaml\nfrom pathlib import Path\n\n\nclass ConfigurationCore:\n\n config_from_file = None\n\n def __init__(self, config_path=None):\n try:\n if...
python
chosen
[ { "from": "system", "value": "Move preprocess tweet to utils, move loading wordlist to init\n" }, { "from": "human", "value": "from utils import preprocess_tweet\n\ndef check_existence_of_words(tweet, wordlist):\n \"\"\"\n Function for the slang or curse words and acronyms features\n :p...
python
chosen
[ { "from": "system", "value": "Ch04: Use template in homepage view.\n" }, { "from": "human", "value": "from django.http.response import HttpResponse\n\nfrom .models import Tag\n\n\ndef homepage(request):\n tag_list = Tag.objects.all()\n html_output = \"<html>\\n\"\n html_output += \"<hea...
python
chosen
[ { "from": "system", "value": "Switch to Python 3-friendly `function.__name__`\n" }, { "from": "human", "value": "# -*- coding: utf-8 -*-\nhooks = {\n 'newproject': [], # (site)\n 'generate': [], # (site, dir, extra_context)\n 'publish': [], # (site, s3)\n 'i...
python
chosen
[ { "from": "system", "value": "Fix manual path hack after relocate\n" }, { "from": "human", "value": "import sys\n\nsys.path.append('/home/blake/lazy/build/lib.linux-x86_64-3.4')\n" }, { "from": "gpt", "value": "import sys\n\nsys.path.append('/home/blake/b/build/lib.linux-x86_64-3.4')...
python
chosen
[ { "from": "system", "value": "tests/misc: Add test for line number printing with large bytecode chunk.\n" }, { "from": "human", "value": "try:\n import uio as io\nexcept ImportError:\n import io\nimport sys\nif hasattr(sys, 'print_exception'):\n print_exception = sys.print_exception\nel...
python
chosen
[ { "from": "system", "value": "Remove pylab from import statements\n" }, { "from": "human", "value": "import numpy as np\nimport pylab as pl\nimport sys\nimport timeit\nfrom pykalman import KalmanFilter\n\nN = int(sys.argv[1])\nrandom_state = np.random.RandomState(0)\ntransition_matrix = [[1, 0.0...
python
chosen
[ { "from": "system", "value": "Drop eventlet bundle back to released state. Will workaround the bug we fixed\nthere, in our own code.\n" }, { "from": "human", "value": "# The history of this repository has been rewritten to erase the vendor/ directory\n# Below is the md5sum and size of the file t...
python
chosen
[ { "from": "system", "value": "Documentation: Change wording from future to present tense\n" }, { "from": "human", "value": "# -*- coding: utf-8 -*-\n\n\nclass Object:\n \"\"\"Represents a generic Spectrum object\n \n Supported Operations:\n \n +-----------+------------------------...
python
chosen
[ { "from": "system", "value": "Add tests as data_dir to ndimage.segment\n" }, { "from": "human", "value": "\r\n#!/usr/bin/env python\r\n\r\ndef configuration(parent_package='',top_path=None):\r\n from numpy.distutils.misc_util import Configuration\r\n\r\n config = Configuration('segment', p...
python
chosen
[ { "from": "system", "value": "Test case 2 for table storypoint\n" }, { "from": "human", "value": "from django.test import TestCase\r\n\r\n# Create your tests here.\r\n\r\nfrom django.test import TestCase\r\nfrom models import Story\r\n\r\n\r\nclass StoryMethodTests(TestCase):\r\n\r\n def test...
python
chosen
[ { "from": "system", "value": "Python: Test false negative from review\n" }, { "from": "human", "value": "s = \"taintedString\"\n\nif s.startswith(\"tainted\"): # $checks=s $branch=true\n pass\n" }, { "from": "gpt", "value": "s = \"taintedString\"\n\nif s.startswith(\"tainted\"): ...
python
chosen
[ { "from": "system", "value": "Move csdms-plugin loading to plugin module.\n" }, { "from": "human", "value": "from __future__ import print_function\n\n__all__ = []\n\nimport os\nimport sys\nimport warnings\nimport importlib\nfrom glob import glob\n\nfrom .framework.bmi_bridge import bmi_factory\n...
python
chosen
[ { "from": "system", "value": "Fix script for loading topics into mongodb" }, { "from": "human", "value": "import os\nimport csv\nfrom pymongo import MongoClient\n\nprint('Parsing topics')\ntopics = {}\nwith open('topics.csv', 'rb') as csvfile:\n reader = csv.reader(csvfile)\n for line in r...
python
chosen
[ { "from": "system", "value": "Add sound definitions to resource manager\n" }, { "from": "human", "value": "# Manage resources here\n\nimport animation\n\nsounds = {}\nimages = {}\nanimations = {}\n\nloaded_resources = False\n\ndef load_resources():\n \"\"\"Fills the structure above with the r...
python
chosen
[ { "from": "human", "value": "Add the list of test modules to test quickly.\n\nWe can now start tests with:\n\n python -m unittest tests\n\nassuming the BNET_API_KEY is defined.\n" }, { "from": "gpt", "value": "from test_character import *\nfrom test_data import *\nfrom test_exceptions import ...
python
chosen
[ { "from": "system", "value": "Remove unneeded lru specific helper methods\n" }, { "from": "human", "value": "import functools\nimport logging\n\nimport redis\n\nimport config\n\n\n# Default options\n\nredis_opts = {\n 'host': 'localhost',\n 'port': 6379,\n 'db': 0,\n 'password': None...
python
chosen
[ { "from": "system", "value": "Fix TestSyntheticCapping for Python 3.\n\nIn Python 3, whitespace inconsistences are errors. This synthetic\nprovider had mixed tabs and spaces, as well as inconsistent\nindentation widths. This led to the file not being imported,\nand naturally the test failing. No function...
python
chosen
[ { "from": "system", "value": "Make the array API constants into dimension 0 arrays\n\nThe spec does not actually specify whether these should be dimension 0 arrays\nor Python floats (which they are in NumPy). However, making them dimension 0\narrays is cleaner, and ensures they also have all the methods and...
python
chosen
[ { "from": "system", "value": "kompomaatti: Add more test data; improve feedback on failing case\n" }, { "from": "human", "value": "from django.test import TestCase\nfrom Instanssi.kompomaatti.models import Entry\n\n\nVALID_YOUTUBE_URLS = [\n # must handle various protocols in the video URL\n ...
python
chosen
[ { "from": "system", "value": "[IMP] Improve warning \"Email sending not enabled\"" }, { "from": "human", "value": "# -*- encoding: utf-8 -*-\n##############################################################################\n#\n# OpenERP, Open Source Management Solution\n# Copyright (C) 2011 ...
python
chosen
[ { "from": "system", "value": "Fix flake8 error - relative import" }, { "from": "human", "value": "# Licensed under the Apache License, Version 2.0 (the \"License\"); you may\n# not use this file except in compliance with the License. You may obtain\n# a copy of the License at\n#\n# ...
python
chosen
[ { "from": "system", "value": "Add endpoints for all resources.\n" }, { "from": "human", "value": "import falcon\nfrom resources.waifu_message_resource import WaifuMessageResource\n\napi = falcon.API()\napi.add_route('/waifu/messages', WaifuMessageResource())\n" }, { "from": "gpt", "v...
python
chosen
[ { "from": "system", "value": "Remove redundant 'api' from URL\n" }, { "from": "human", "value": "from flask import Flask, request\nimport subprocess\nimport uuid\nimport os\nimport re\nimport json\n\napp = Flask(__name__)\n\n\n@app.route('/api/v1/', methods=[\"GET\"])\ndef lint():\n\n id = uu...
python
chosen
[ { "from": "system", "value": "Add twitter stuff to default config and allow easier merging of configs\n" }, { "from": "human", "value": "import os\nimport json\n\ndefault_conf = {\n 'reddit': {\n 'username': '',\n 'password': '',\n },\n 'twitter': {\n 'consumer_key'...
python
chosen
[ { "from": "system", "value": "Test script for generating metadata\n" }, { "from": "human", "value": "#!/usr/bin/env python\n# -*- coding: utf8 -*-\n__author__ = 'eric'\n\n\n'''\nNeed to create some test data\n'''\n" }, { "from": "gpt", "value": "#!/usr/bin/env python\n# -*- coding: u...
python
chosen
[ { "from": "system", "value": "Patch out DNS resolver in makeService tests.\n" }, { "from": "human", "value": "from vumi_http_proxy.servicemaker import Options, ProxyWorkerServiceMaker\nfrom vumi_http_proxy import http_proxy\nfrom twisted.trial import unittest\n\n\nclass TestOptions(unittest.Test...
python
chosen
[ { "from": "system", "value": "Make the paths not relative, so tests can be run from anywhere.\n" }, { "from": "human", "value": "# -*- coding: utf-8 -*-\n\nimport os, os.path\nimport sys\nimport unittest\n\nfrom macrotest import JSONSpecMacroTestCaseFactory\n\n\ndef JSONTestCaseLoader(tests_path...
python
chosen
[ { "from": "system", "value": "Make subscription handler less oauth dependant\n" }, { "from": "human", "value": "import json\nimport logging\n\nfrom google.appengine.api import oauth\nfrom google.appengine.ext import ndb\n\nfrom pulldb import users\nfrom pulldb.api.base import OauthHandler, JsonM...
python
chosen
[ { "from": "system", "value": "Move BaseMail from ovp-users to ovp-core\n" }, { "from": "human", "value": "from django.core.mail import EmailMultiAlternatives\nfrom django.template import Context, Template\nfrom django.template.loader import get_template\nfrom django.conf import settings\n\nimpor...
python
chosen
[ { "from": "system", "value": "Fix bug in showing form\n" }, { "from": "human", "value": "\"\"\"The ox_herd package provides a way for herding tests together (like oxen).\n\"\"\"\n\nVERSION = '0.6.10'\n" }, { "from": "gpt", "value": "\"\"\"The ox_herd package provides a way for herdin...
python
chosen
[ { "from": "system", "value": "Rename funciton to match corresponding HTTP request\n\n" }, { "from": "human", "value": "import requests\nimport yaml\n\n\ndef runLoop( config ):\n\t\"\"\"\n\tRuns indefinitely. On user input (card swipe), will gather the card number,\n\tsend it to the server config...
python
chosen
[ { "from": "system", "value": "Fix eclipse error message on mod_wsgi import\n\nSigned-off-by: Jonathan Dieter <ddc8e8b9809278692339ab749e05e6020a8d4c9a@lesbg.com>" }, { "from": "human", "value": "# lesson/main.py\n#\n# This file is part of LESSON. LESSON is free software: you can\n# redistribute...
python
chosen
[ { "from": "system", "value": "Remove mixer from the Backend API as it is independent\n" }, { "from": "human", "value": "import logging\n\nfrom .current_playlist import CurrentPlaylistController\nfrom .library import LibraryController, BaseLibraryProvider\nfrom .playback import PlaybackController...
python
chosen
[ { "from": "system", "value": "Allow to revert data migaration\n" }, { "from": "human", "value": "# -*- coding: utf-8 -*-\n# Generated by Django 1.10.3 on 2016-12-12 13:25\nfrom __future__ import unicode_literals\n\nfrom django.db import migrations\nfrom django.utils.text import slugify\n\n\ndef ...
python
chosen
[ { "from": "system", "value": "Add test of seeding PRNG\n" }, { "from": "human", "value": "#!/usr/bin/env python\n# -*- coding: utf-8 -*-\n\n\"\"\"Tests for `judicious` package.\"\"\"\n\nimport pytest\n\n\nimport judicious\n\n\n@pytest.fixture\ndef response():\n \"\"\"Sample pytest fixture.\n\...
python
chosen
[ { "from": "system", "value": "Add null handler as default for logging.\n" }, { "from": "human", "value": "from .robot import Robot\nfrom .modules import *\n" }, { "from": "gpt", "value": "import logging\n\nfrom .robot import Robot\nfrom .modules import *\n\n\nnh = logging.NullHandler...
python
chosen
[ { "from": "system", "value": "Make custom patch in package to test\n" }, { "from": "human", "value": "from os.path import join\nimport sublime\nimport sys\nfrom unittest import TestCase\n\nversion = sublime.version()\n\ntry:\n from libsass import pathutils\nexcept ImportError:\n from subli...
python
chosen
[ { "from": "system", "value": "Use the test client to check all templates for correctness\n" }, { "from": "human", "value": "from django.core.urlresolvers import resolve\nfrom django.http import HttpRequest\nfrom django.template.loader import render_to_string\nfrom django.test import TestCase\n\n...
python
chosen
[ { "from": "system", "value": "Skynet: Fix in collectd event notifier script.\n\nThis patch adds a fix to collectd event notifier script,\nby providing a value the \"severity\" field in the event\nthat it sends to salt-master event bus. with out that\nevent listener in the skyring server will fail to\nproces...
python
chosen
[ { "from": "system", "value": "pyecmd: Make fapi2 test conditional on fapi2 being built into ecmd\n" }, { "from": "human", "value": "from pyecmd import *\n\nwith Ecmd(fapi2=\"ver1\"):\n t = loopTargets(\"pu\", ECMD_SELECTED_TARGETS_LOOP)[0]\n data = t.getScom(0x1234)\n t.putScom(0x123...
python
chosen
[ { "from": "system", "value": "Make the digitalocean provisioner public\n" }, { "from": "human", "value": "# Copyright Hybrid Logic Ltd. See LICENSE file for details.\n\n\"\"\"\nProvisioning for acceptance tests.\n\"\"\"\n\nfrom ._common import PackageSource\nfrom ._install import provision\nfro...
python
chosen
[ { "from": "system", "value": "Check Django version instead of hasattr\n" }, { "from": "human", "value": "def get_related_model(rel):\n # In Django 1.7 and under, the related model is accessed by doing: rel.model\n # This was renamed in Django 1.8 to rel.related_model. rel.model now returns...
python
chosen
[ { "from": "system", "value": "Fix : delete command call badly formatted in handler\n" }, { "from": "human", "value": "#!/usr/bin/env python\n# -*- coding: utf-8 -*-\n\nclass Handler(object):\n def __init__(self, db):\n # Each handlers is formatted following\n # the pattern : [ c...
python
chosen
[ { "from": "system", "value": "Make import compatable with python3.5\n" }, { "from": "human", "value": "from fenced_code_plus import FencedCodePlusExtension\nfrom fenced_code_plus import makeExtension\n" }, { "from": "gpt", "value": "from __future__ import absolute_import\n\nfrom fenc...
python
chosen
[ { "from": "system", "value": "Add back some reasoning on the 900 number\n" }, { "from": "human", "value": "\"\"\"This may seem like a silly module right now, but we had to\nseparate this out so that deferrable.py and its sub-modules\ncould all import it without circular imports.\"\"\"\n\nMAXIMUM...
python
chosen
[ { "from": "system", "value": "Update user details API call\n" }, { "from": "human", "value": "from social.backends.oauth import BaseOAuth2\n\n\nclass HastexoOAuth2(BaseOAuth2):\n \"\"\"Hastexo OAuth2 authentication backend\"\"\"\n\n name = 'hastexo'\n AUTHORIZATION_URL = 'https://store....
python
chosen
[ { "from": "system", "value": "Add statirator.core for all commands except test\n" }, { "from": "human", "value": "import os\nimport sys\n\n\ndef main():\n # init is a special case, cause we want to add statirator.core to\n # INSTALLED_APPS, and have the command picked up. we'll handle it i...
python
chosen
[ { "from": "system", "value": "Clean up and document 'test_value' function.\n" }, { "from": "human", "value": "#Common utility methods\n\n#Test if a dictionary value is not None and has a length greater than 0\ndef test_value(value):\n if value.get('value') is not None:\n if value.get('...
python
chosen
[ { "from": "system", "value": "Use renamed frame template file\n" }, { "from": "human", "value": "from django.http import HttpResponseRedirect, HttpResponse, Http404\nfrom django.shortcuts import render_to_response\nfrom django.template import RequestContext\nfrom django.views.generic import View...
python
chosen
[ { "from": "system", "value": "Fix wrong call method in test (GH-179)\n\n" }, { "from": "human", "value": "\"\"\"\nShould emit:\nB009 - Line 17, 18, 19\nB010 - Line 28, 29, 30\n\"\"\"\n\n# Valid getattr usage\ngetattr(foo, bar)\ngetattr(foo, \"bar\", None)\ngetattr(foo, \"bar{foo}\".format(foo=\"...
python
chosen
[ { "from": "system", "value": "Test stubs for dataset creation\n" }, { "from": "human", "value": "\"\"\"A module containing tests for the library representation of IATI data.\"\"\"\nimport iati.core.data\n\n\nclass TestDatasets(object):\n \"\"\"A container for tests relating to Datasets\"\"\"\...
python
chosen
[ { "from": "system", "value": "Disable INFO messages and down when running test suite\n" }, { "from": "human", "value": "#!/usr/bin/env python\n# -*- coding: utf-8 -*-\n\nimport os\nimport sys\nimport nose\nimport logging\n\nlogging.disable(logging.DEBUG) # Disable debug logging when running the...
python
chosen
[ { "from": "system", "value": "Add a DICT_TYPES variable so we can do isinstance() checks against all the builtin dict-like objects\n" }, { "from": "human", "value": "try:\n from collections import OrderedDict\nexcept ImportError: \n from ordereddict import OrderedDict\n" }, { "f...
python
chosen
[ { "from": "system", "value": "Add a comment to make some sense of a regex\n" }, { "from": "human", "value": "\"\"\"A module containing components that describe the IATI Standard itself (rather than the parts it is made up of).\"\"\"\nimport re\nimport iati.constants\n\n\nclass Version(object):\n...
python
chosen
[ { "from": "system", "value": "Remove useless url from test urls\n" }, { "from": "human", "value": "# -*- coding: utf-8 -*-\nfrom django.conf.urls import include, url\nfrom django.contrib import admin\nfrom django.http.response import HttpResponse\n\n\nadmin.autodiscover()\n\n\ndef empty_view(req...
python
chosen
[ { "from": "system", "value": "Make files ending in makefile or Makefile.\n" }, { "from": "human", "value": "import wx.stc\n\nident = \"makefile\"\nname = \"Makefile\"\nextensions = [\"Makefile\", \"*.mk\"]\nlexer = wx.stc.STC_LEX_MAKEFILE\nindent = 8\nuse_tabs = True\n\nstylespecs = (\n (wx.s...
python
chosen
[ { "from": "system", "value": "Add more tests to YamlFile class\n" }, { "from": "human", "value": "import unittest\ntry:\n from unittest import mock\nexcept ImportError:\n import mock\n\nfrom conda_env import env\nfrom conda_env.specs.yaml_file import YamlFileSpec\n\n\nclass TestYAMLFile(un...
python
chosen
[ { "from": "system", "value": "Add decorator to check minimum required FastAPI version\n" }, { "from": "human", "value": "import logging\n\nlog = logging.getLogger(__name__)\n\n\nclass FastAPIVersionError(Exception):\n def __init__(self, version, reason=''):\n err_msg = f'FastAPI {versi...
python
chosen
[ { "from": "system", "value": "Disable impersonation logging during testing\n" }, { "from": "human", "value": "import sys\nimport django\nfrom django.conf import settings\n\n\nAPP_NAME = 'impersonate'\n\nsettings.configure(\n DEBUG=True,\n DATABASES={\n 'default': {\n 'ENG...
python
chosen
[ { "from": "system", "value": "Use get_config instead of CONFIG_DICT\n" }, { "from": "human", "value": "import logging\nimport requests\nfrom indra.config import CONFIG_DICT\n\n\nlogger = logging.getLogger(__name__)\n\n\ndart_uname = CONFIG_DICT['DART_WM_USERNAME']\ndart_pwd = CONFIG_DICT['DART_W...
python
chosen
[ { "from": "system", "value": "Add Python portability to model\n" }, { "from": "human", "value": "from django.db import models\n\n\nclass Todo(models.Model):\n \"\"\"\n Todo Model: name, description, created\n \"\"\"\n name = models.CharField(max_length=100, unique=True)\n descript...
python
chosen
[ { "from": "system", "value": "Switch redis to use the from_url method\n" }, { "from": "human", "value": "class BaseStore(object):\n\n def set(self, key, value):\n raise NotImplementedError\n\n def get(self, key):\n raise NotImplementedError\n\n\nclass InMemoryStore(BaseStore)...
python
chosen
[ { "from": "system", "value": "Check that user OR username is specified\n" }, { "from": "human", "value": "from wafer.talks.models import Talk, TalkType\nfrom wafer.tests.utils import create_user\n\n\ndef create_talk_type(name):\n \"\"\"Create a talk type\"\"\"\n return TalkType.objects.cre...
python
chosen
[ { "from": "system", "value": "Use SG slug for event filtering\n" }, { "from": "human", "value": "from django_filters import FilterSet, CharFilter, IsoDateTimeFilter, BooleanFilter, ModelChoiceFilter\n\nfrom falmer.events.models import Curator\nfrom . import models\n\n\nclass EventFilterSet(Filte...
python
chosen
[ { "from": "system", "value": "Include url message when fail to run urlparser\n" }, { "from": "human", "value": "from modules import *\n\nimport re\nimport urllib2\nimport traceback\ntry:\n import simplejson as json\nexcept ImportError:\n import json\n\nfrom unidecode import unidecode\n\nfr...
python
chosen
[ { "from": "system", "value": "Add tuncate method to BaseStorage class\n\nThis will provide an interface for supporting any new database, there by, making the code more robust.\n" }, { "from": "human", "value": "\n\nclass BaseStorage(object):\n \"\"\"docstring for BaseStorage\"\"\"\n def __...
python
chosen
[ { "from": "system", "value": "Fix version module import for Python 3\n" }, { "from": "human", "value": "import os\n\n__version__ = \"unknown\"\n\ntry:\n from version import get_git_version\n __version__ = get_git_version()\nexcept Exception as message:\n print(message)\n\n__author__ = \...
python
chosen
[ { "from": "system", "value": "Remove limit of 7 groups in homepage\n" }, { "from": "human", "value": "from ckan import model\nfrom ckan.plugins import toolkit\n\n\ndef _get_action(action, context_dict, data_dict):\n return toolkit.get_action(action)(context_dict, data_dict)\n\n\ndef get_group...
python
chosen
[ { "from": "system", "value": "Remove pointless default values from DefaultConfiguration\n" }, { "from": "human", "value": "from datetime import timedelta\n\nclass DefaultConfiguration:\n DEBUG = False\n\n MAIL_SERVER = \"localhost\"\n MAIL_PORT = 25\n MAIL_USER = None\n MAIL_PASSW...
python
chosen
[ { "from": "system", "value": "Fix <style> rendering under Transcrypt.\n\nThe hasattr test in renderCss() was failing when it shouldn't have.\nFixed by removal. Updated tests/client.py to create and append a style\nelement to detect problems related to Style() on the client side.\n" }, { "from": "hum...
python
chosen
[ { "from": "system", "value": "Include PK in user serializer\n" }, { "from": "human", "value": "from rest_framework import serializers\nfrom django.contrib.auth.models import User\n\n\nclass UserSerializer(serializers.HyperlinkedModelSerializer):\n \"\"\" Serializer for a User\n \"\"\"\n\n ...
python
chosen
[ { "from": "system", "value": "Add application id and static method for usage\n" }, { "from": "human", "value": "#!/usr/bin/env python\n# Copyright 2014-2015 Boundary, Inc.\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may not use this file except in compliance wi...
python
chosen
[ { "from": "system", "value": "Add multi-languages support for search\n" }, { "from": "human", "value": "from django.core.paginator import Paginator, EmptyPage, PageNotAnInteger\nfrom django.shortcuts import render\n\nfrom molo.core.models import ArticlePage\nfrom molo.commenting.models import Mo...
python
chosen
[ { "from": "system", "value": "Add None if kwargs can not get.\n" }, { "from": "human", "value": "# -*- coding: utf-8 -*-\n\"\"\"\n mackerel.host\n ~~~~~~~~~~~~~\n\n Mackerel client implemented by Pyton.\n\n Ported from `mackerel-client-ruby`.\n <https://github.com/mackerelio/macke...
python
chosen
[ { "from": "system", "value": "Add authentication handler for opening image.\n" }, { "from": "human", "value": "\"\"\"Python challenge solution #9:\nhttp://www.pythonchallenge.com/pc/return/good.html\"\"\"\n\n\ndef main():\n pass\n\n\nif __name__ == \"__main__\":\n main()\n" }, { "f...
python
chosen
[ { "from": "system", "value": "Update Template for Parser class\n" }, { "from": "human", "value": "\nimport ast\n\nfrom . import parse\n\n\nclass Template:\n def __init__(self, raw):\n self.raw = raw\n self.nodelist = parse.parse(raw)\n\n code = ast.Expression(\n ...
python
chosen
[ { "from": "system", "value": "Use the gallery_image method for required information\n" }, { "from": "human", "value": "from pyramid.view import view_config\n\nfrom pyramid.httpexceptions import (\n HTTPNotFound,\n)\n\n@view_config(route_name='page', renderer='templates/page.mako')\n@view_conf...
python
chosen
[ { "from": "system", "value": "Print when saving plot to file\n" }, { "from": "human", "value": "import plotly\n\ndef try_saving_plotly_figure(figure, filename):\n try:\n plotly.plotly.image.save_as(figure, filename)\n except plotly.exceptions.PlotlyError as e:\n if 'The respo...
python
chosen
[ { "from": "system", "value": "Add Wayland Backend.fake_click and Backend.get_all_windows methods\n\nThese work by eval-ing in the test Qtile instance. It might be nicer to\ninstead make these cmd_s on the `Core` if/when we expose cmd_ methods\nfrom the Core.\n" }, { "from": "human", "value": "im...
python
chosen
[ { "from": "system", "value": "Add tests for userprofile properties\n" }, { "from": "human", "value": "\"\"\"\nTests for opal.models.UserProfile\n\"\"\"\nfrom django.test import TestCase\n\nfrom django.contrib.auth.models import User\n\nfrom opal.models import UserProfile, Team\n\nclass UserProfi...
python
chosen
[ { "from": "system", "value": "Add deprecation notice for AuthType.EVENT_DATA\n" }, { "from": "human", "value": "class AuthType(object):\n \"\"\"\n An auth type defines what write privileges an authenticated agent has.\n \"\"\"\n EVENT_DATA = 0\n MATCH_VIDEO = 1\n EVENT_TEAMS = ...
python
chosen
[ { "from": "system", "value": "Improve handling of errors during mailing list subscription.\n\nhttps://github.com/madewithbytes/us_ignite/issues/209\n\nAny exception thrown by the mailchimp component will\nbe handled gracefully and logged.\n" }, { "from": "human", "value": "import hashlib\nimport...
python
chosen
[ { "from": "system", "value": "Enable SimLightRegisters and remove COPY_STATES for the performance test case.\n" }, { "from": "human", "value": "\n# Performance tests on concrete code execution without invoking Unicorn engine\n\nimport os\nimport time\nimport logging\n\nimport angr\n\n\ntest_loca...
python
chosen
[ { "from": "system", "value": "Fix proper parens merge conflict\n" }, { "from": "human", "value": "#!/usr/bin/env python\nfrom __future__ import unicode_literals\n\n\n<<<<<<< HEAD\ndef check_statement1(value):\n output = 0\n while output >= 0:\n for item in value:\n if ite...
python
chosen
[ { "from": "system", "value": "[python] Send api-key through HTTP cookie.\n" }, { "from": "human", "value": "\nimport urllib\n\n__version__ = '0.0~20090901.1'\n__user_agent__ = 'EpiDBClient v%s/python' % __version__\n\nclass EpiDBClientOpener(urllib.FancyURLopener):\n\tversion = __user_agent__\n\...
python
chosen
[ { "from": "system", "value": "Modify to average the L2 norm loss of output vectors\n" }, { "from": "human", "value": "from chainer import cuda\nfrom chainer.functions import matmul\nfrom chainer.functions import transpose\nfrom chainer.functions import softmax_cross_entropy\nfrom chainer.functio...
python
chosen
[ { "from": "system", "value": "Set up version 0.3.0 dev 1.\n" }, { "from": "human", "value": "\"\"\"\nNeuPy is the Artificial Neural Network library implemented in Python.\n\"\"\"\n\n\n__version__ = '0.2.1'\n" }, { "from": "gpt", "value": "\"\"\"\nNeuPy is the Artificial Neural Networ...
python
chosen