conversations
listlengths
2
3
source
stringclasses
1 value
stack
stringclasses
1 value
[ { "from": "system", "value": "Add required SECRET_KEY to test app\n" }, { "from": "human", "value": "import os\n\nINSTALLED_APPS = [\n 'django.contrib.admin',\n 'django.contrib.auth',\n 'django.contrib.contenttypes',\n 'django.contrib.sessions',\n 'django.contrib.sites',\n\n 'i...
python
chosen
[ { "from": "system", "value": "Fix bdist_rpm for path names containing spaces.\n\ngit-svn-id: 77a43f9646713b91fea7788fad5dfbf67e151ece@2013 94b884b6-d6fd-0310-90d3-974f1d3f35e1\n" }, { "from": "human", "value": "\nfrom distutils.command.install import *\nfrom distutils.command.install import inst...
python
chosen
[ { "from": "system", "value": "Fix deploy CLI arg parsing\n" }, { "from": "human", "value": "#! /usr/bin/python\n\n# Copyright 2014 Google Inc. All Rights Reserved.\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may not use this file except in compliance with the L...
python
chosen
[ { "from": "system", "value": "Abort early with removed if nothing needs to be done\n" }, { "from": "human", "value": "from emaillist.models import EmailExclusion\nfrom django.shortcuts import render_to_response\n\ndef remove_email(request, email):\n if email[-1] == '/':\n email = email...
python
chosen
[ { "from": "system", "value": "Implement a test for an ini option\n" }, { "from": "human", "value": "# -*- coding: utf-8 -*-\n\ndef test_bar_fixture(testdir):\n \"\"\"Make sure that pytest accepts our fixture.\"\"\"\n\n # create a temporary pytest test module\n testdir.makepyfile(\"\"\"\...
python
chosen
[ { "from": "system", "value": "Fix typo in documentation for Classification\n" }, { "from": "human", "value": "from __future__ import absolute_import, division, print_function\n\nfrom panoptes_client.panoptes import LinkResolver, PanoptesObject\n\n\nclass Classification(PanoptesObject):\n _api...
python
chosen
[ { "from": "system", "value": "[IMP] payment_redsys: Put real package on pypi\n" }, { "from": "human", "value": "# Copyright 2017 Tecnativa - Sergio Teruel\n# Copyright 2020 Tecnativa - João Marques\n\n{\n \"name\": \"Pasarela de pago Redsys\",\n \"category\": \"Payment Acquirer\",\n \"s...
python
chosen
[ { "from": "system", "value": "LK-271: Fix package resource validator for new packages\n" }, { "from": "human", "value": "from ckan.common import _\nimport ckan.lib.navl.dictization_functions as df\n\n\ndef lower_if_exists(s):\n return s.lower() if s else s\n\n\ndef upper_if_exists(s):\n re...
python
chosen
[ { "from": "system", "value": "Detach debugger from process after each test.\n" }, { "from": "human", "value": "\"\"\"Tests for scripts/print_view_controller_hierarchy.py.\"\"\"\nimport re\nimport unittest\n\nfrom test_utils import import_utils\nimport_utils.prepare_lldb_import_or_exit()\n\nimpor...
python
chosen
[ { "from": "system", "value": "Change the permission checks, provide distinct versions for Django 1.10+\n" }, { "from": "human", "value": "\"\"\"\nPossible functions for the ``PRIVATE_STORAGE_AUTH_FUNCTION`` setting.\n\"\"\"\n\n\ndef allow_authenticated(private_file):\n try:\n return pr...
python
chosen
[ { "from": "system", "value": "Reduce delay for waiting for server start betweeb tests\n" }, { "from": "human", "value": "# -*- coding: utf-8 -*-\n\"\"\"\n tests.conftest\n ~~~~~~~~~~~~~~~~~~~~~\n Fixtures for tests.\n\n :copyright: (c) 2017 Yoan Tournade.\n :license: MIT, see LICE...
python
chosen
[ { "from": "system", "value": "Allow to reduce Operations in 2.0 and 3.0.0 to App.op\n" }, { "from": "human", "value": "from __future__ import absolute_import\nfrom ..scan import Dispatcher\nfrom ..errs import SchemaError\nfrom ..spec.v3_0_0.objects import Operation\nfrom ..utils import scope_com...
python
chosen
[ { "from": "system", "value": "Add test for upload functionality\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 o...
python
chosen
[ { "from": "system", "value": "Switch back to 8 workers\n" }, { "from": "human", "value": "import os\nfrom urllib import parse\n\nDEBUG = False\n\n\nDATABASE_SA = os.environ.get('HEROKU_POSTGRESQL_CHARCOAL_URL')\nbits = parse.urlparse(DATABASE_SA)\n\nDATABASE = {\n 'user': bits.username,\n ...
python
chosen
[ { "from": "system", "value": "Put level in log message for xirvik.*\n" }, { "from": "human", "value": "from logging.handlers import SysLogHandler\nimport logging\nimport sys\n\nsyslogh = None\n\n\ndef cleanup():\n global syslogh\n\n if syslogh:\n syslogh.close()\n\n logging.shutd...
python
chosen
[ { "from": "system", "value": "Add documentation, tweak rate limit handling, remove unused function.\n" }, { "from": "human", "value": "import geocoder\nimport time\n\ndef lat_longs_from_geo_strings(lst):\n lats_lons = []\n for addr_str in lst:\n g = geocoder.google(addr_str)\n ...
python
chosen
[ { "from": "system", "value": "Upgrade YTS to API v2\n" }, { "from": "human", "value": "import cache\nimport network\nimport scraper\n\nYTS_URL = 'http://yts.re'\n\n################################################################################\ndef movie(movie_info):\n magnet_infos = []\n\n ...
python
chosen
[ { "from": "system", "value": "Fix text for repeated events.\n" }, { "from": "human", "value": "from django.db import models\n\nfrom mezzanine.core.models import Displayable, RichText\n\nclass RepeatType(models.Model):\n DAILY = 'daily'\n WEEKLY = 'weekly',\n MONTHLY = 'monthly'\n\n R...
python
chosen
[ { "from": "system", "value": "Use the right graph style path in the editor\n" }, { "from": "human", "value": "from logging import FileHandler\n\nfrom app import app\nfrom api import api\nfrom models import db\nimport os\nfrom flask import request \n\napp.config.from_pyfile('../server.cfg')\n\n@a...
python
chosen
[ { "from": "system", "value": "Store the temporary database permanently\n\nso it does not require db_create after resteing /tmp\n" }, { "from": "human", "value": "SQLALCHEMY_DATABASE_URI = 'sqlite:////tmp/test.db'\nSQLALCHEMY_TRACK_MODIFICATIONS = True\n# SQLALCHEMY_ECHO = False\nSECRET_KEY = '\\...
python
chosen
[ { "from": "system", "value": "Use git:// for tests instead.\n" }, { "from": "human", "value": "\nfrom __future__ import absolute_import\n\nimport contextlib\nimport os.path\nimport pytest\nimport sqlite3\n\nfrom git_code_debt.create_tables import create_schema\nfrom git_code_debt.create_tables i...
python
chosen
[ { "from": "system", "value": "Remove code that is not used\n\nFunction call not required so removed\n" }, { "from": "human", "value": "# We have to import the minecraft api module to do anything in the minecraft world\nfrom mcpi.minecraft import *\nfrom mcpi.block import *\nfrom blockData import...
python
chosen
[ { "from": "system", "value": "Add user back onto the comment inline for posts\n" }, { "from": "human", "value": "from django.contrib import admin\nfrom discussion.models import Comment, Discussion, Post\n\n\nclass CommentInline(admin.TabularInline):\n exclude = ('user',)\n extra = 1\n m...
python
chosen
[ { "from": "system", "value": "Fix a buggy url conf for heroku.\n" }, { "from": "human", "value": "from django.conf import settings\nfrom django.conf.urls.defaults import patterns, include, url\nfrom django.contrib import admin\nfrom django.contrib.staticfiles.urls import staticfiles_urlpatterns\...
python
chosen
[ { "from": "system", "value": "Handle tuple error formatting same as list\n" }, { "from": "human", "value": "\nfrom rest_framework import status\nfrom rest_framework.exceptions import APIException\n\n\ndef json_api_exception_handler(exc, context):\n \"\"\" Custom exception handler that returns...
python
chosen
[ { "from": "system", "value": "feat: Merge prior order_to_card_order with order id\n" }, { "from": "human", "value": "# importing modules/ libraries\nimport pandas as pd\nimport numpy as np\n\norders_prior_df = pd.read_csv('Data/orders_prior_sample.csv')\nprint('length of orders_prior_df:', len(o...
python
chosen
[ { "from": "system", "value": "Fix authenticated calls for APIs already in the DB\n" }, { "from": "human", "value": "from django.core.urlresolvers import reverse\nfrom django.http import HttpResponse, HttpResponseNotFound, HttpResponseServerError\nfrom django.views.generic import View\n\nfrom eve...
python
chosen
[ { "from": "system", "value": "Refresh the proxy example list\n" }, { "from": "human", "value": "\"\"\"\nProxy Server \"Phone Book\".\n\nSimplify running browser tests through a proxy server\nby adding your frequently-used proxies here.\n\nNow you can do something like this on the command line:\n...
python
chosen
[ { "from": "system", "value": "Read mail given a UID instead of mail_id\n" }, { "from": "human", "value": "# -*- coding: utf-8 -*-\n\n\n\"\"\"IMAP lib fetch helpers\"\"\"\n\n\nimport collections\nimport logging\nimport os\n\nfrom imap_cli import const\n\n\napp_name = os.path.splitext(os.path.base...
python
chosen
[ { "from": "system", "value": "Fix for inspecting app get data\n\nNeeded a binary string comparision\n" }, { "from": "human", "value": "\"\"\"Unit Testing for Index view.\"\"\"\nimport pytest\n\n\n@pytest.mark.usefixtures(\"session\", \"test_app\")\nclass TestIndex:\n \"\"\"Test the index page...
python
chosen
[ { "from": "system", "value": "Handle mailchimp error 214 (duplicate email) in signup worker\n\n(imported from commit cb34c153fc96bca7c8faed01d019aa2433fcf568)\n" }, { "from": "human", "value": "from __future__ import absolute_import\n\nfrom postmonkey import PostMonkey\nfrom django.core.manageme...
python
chosen
[ { "from": "system", "value": "Add documentation to the /v2/guids/<guid> endpoint\n" }, { "from": "human", "value": "from django import http\nfrom rest_framework.exceptions import NotFound\nfrom rest_framework import permissions as drf_permissions\n\nfrom framework.guid.model import Guid\nfrom fr...
python
chosen
[ { "from": "system", "value": "Update copyright date and fix my name\n" }, { "from": "human", "value": "# -*- coding: utf-8 -*-\n\n\"\"\"\nhaystack_panel\n~~~~~~~~~~~~~~\n\n:copyright: (c) 2012 by Chris Streeter.\n:license: See LICENSE for more details.\n\n\"\"\"\n\nimport pkg_resources\n\ntry:\n...
python
chosen
[ { "from": "system", "value": "Add a helper function to grab network names\n" }, { "from": "human", "value": "# Taken from txircd:\n# https://github.com/ElementalAlchemist/txircd/blob/8832098149b7c5f9b0708efe5c836c8160b0c7e6/txircd/utils.py#L9\ndef _enum(**enums):\n return type('Enum', (), enu...
python
chosen
[ { "from": "system", "value": "Update test to compare dictionaries, rather than json string\n" }, { "from": "human", "value": "from django.test import TestCase\n\nfrom studygroups.models import Course\nfrom .community_feedback import calculate_course_ratings\n\n\nclass TestCommunityFeedback(TestC...
python
chosen
[ { "from": "system", "value": "Delete FK before dropping instance_id column." }, { "from": "human", "value": "# vim: tabstop=4 shiftwidth=4 softtabstop=4\n\n# Copyright 2011 OpenStack LLC.\n# All Rights Reserved.\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\"); you may\n...
python
chosen
[ { "from": "system", "value": "Change use of quotation marks\n" }, { "from": "human", "value": "# Copyright (C) 2016 Google Inc., authors, and contributors <see AUTHORS file>\n# Licensed under http://www.apache.org/licenses/LICENSE-2.0 <see LICENSE file>\n# Created By: goodson@google.com\n# Maint...
python
chosen
[ { "from": "system", "value": "Put some useful stuff into CLI's locals\n" }, { "from": "human", "value": "#!/usr/bin/python\n\nfrom pox.core import core\nimport pox.openflow.openflow\nimport pox.topology.topology\nimport pox.openflow.of_01\nimport pox.dumb_l3_switch.dumb_l3_switch\n\n# Set defaul...
python
chosen
[ { "from": "system", "value": "Add warning for source directory import\n" }, { "from": "human", "value": "from .dataset import Dataset, Volume, Vertex, VolumeRGB, VertexRGB, Volume2D, Vertex2D\nfrom . import align, volume, quickflat, webgl, segment, options\nfrom .database import db\nfrom .utils ...
python
chosen
[ { "from": "system", "value": "Add testcase for correct fastText predict and compress calls\n" }, { "from": "human", "value": "import pandas\nimport unittest\n\nimport cocoscore.ml.fasttext_helpers as fth\n\n\nclass CVTest(unittest.TestCase):\n\n def test_train_call_parameters(self):\n ...
python
chosen
[ { "from": "system", "value": "Increase display size\nUse argument for filename\nMake a movie from images\n" }, { "from": "human", "value": "import h5py\nimport time\nfrom SimpleCV import Image\nrecordFilename = '20130727_17h34_simpleTrack'\nprint recordFilename + '.hdf5'\n#recordFile = h5py.File...
python
chosen
[ { "from": "system", "value": "Use differing cases after reading the log back... case is still insensitve.\n" }, { "from": "human", "value": "from ADIF_log import ADIF_log\nimport datetime\nimport os\n\n# Create a new log...\nlog = ADIF_log('Py-ADIF Example')\nentry = log.newEntry()\n\n# New entr...
python
chosen
[ { "from": "system", "value": "Expand user path when reading CDF\n" }, { "from": "human", "value": "import os\nfrom . import cdfread\nfrom . import cdfwrite\nfrom .epochs import CDFepoch as cdfepoch\n\n# This function determines if we are reading or writing a file\n\n\ndef CDF(path, cdf_spec=None...
python
chosen
[ { "from": "system", "value": "Change the ordering of celery global options\n" }, { "from": "human", "value": "import sys\n\nfrom celery.__main__ import main as celerymain\n\nfrom sea import create_app\nfrom sea.cli import jobm\n\n\ndef celery(argv, app):\n if argv[0] == \"inspect\":\n ...
python
chosen
[ { "from": "system", "value": "Add grade to list display for News Sites\n" }, { "from": "human", "value": "from wagtail.contrib.modeladmin.options import ModelAdmin, modeladmin_register\n\nfrom .models import Site\n\n\nclass SiteAdmin(ModelAdmin):\n model = Site\n menu_label = 'News Sites'\...
python
chosen
[ { "from": "system", "value": "Remove debug code commited by mistake\n" }, { "from": "human", "value": "# -*- coding: utf-8 -*-\n\nfrom __future__ import unicode_literals\n\nimport zipfile\n\nfrom django.views.generic import View\nfrom django.http import HttpResponse\nfrom django.core.files.base ...
python
chosen
[ { "from": "system", "value": "Make it as a subclass.\n\nas advised by termie make it as a subclass instead of patching the\nmethod.\n" }, { "from": "human", "value": "# vim: tabstop=4 shiftwidth=4 softtabstop=4\n\n\"\"\"Main entry point into the S3 Credentials service.\n\nTODO-DOCS\n\"\"\"\n\nim...
python
chosen
[ { "from": "system", "value": "[FIX] event_registration_analytic: Fix bug when in sales order lines there is a nonrecurring service.\n" }, { "from": "human", "value": "# -*- coding: utf-8 -*-\n# (c) 2016 Alfredo de la Fuente - AvanzOSC\n# License AGPL-3 - See http://www.gnu.org/licenses/agpl-3.0....
python
chosen
[ { "from": "system", "value": "Add some calibration default values.\n" }, { "from": "human", "value": "\"\"\"\nThis module is responsible for handling configuration and files related to it,\nincluding calibration parameters.\n\"\"\"\n\nimport configparser\nimport os\n\n\n\"\"\"\nDefault options\n...
python
chosen
[ { "from": "system", "value": "Fix the name of the COURSE_DISCOVERY_CFG variable to match what is configured in edx/configuration\n" }, { "from": "human", "value": "from os import environ\nimport yaml\n\nfrom edx_course_discovery.settings.base import *\nfrom edx_course_discovery.settings.utils im...
python
chosen
[ { "from": "system", "value": "Reduce test checkpoint period for faster tests\n" }, { "from": "human", "value": "import loom.benchmark\n\nDATASET = 'dd-100-100-0.5'\n\n\ndef test_shuffle():\n loom.benchmark.shuffle(DATASET, profile=None)\n\n\ndef test_infer():\n loom.benchmark.infer(DATASET...
python
chosen
[ { "from": "system", "value": "Correct module name in send_task\n" }, { "from": "human", "value": "from __future__ import absolute_import\n\nimport logging.config\nimport os\nimport sys\n\nfrom ddsc_incron.celery import celery\nfrom ddsc_incron.settings import LOGGING\n\n\ndef main():\n loggin...
python
chosen
[ { "from": "system", "value": "Update version 1.0.0.dev7 -> 0.6.0.dev\n" }, { "from": "human", "value": "__version__ = '1.0.0.dev7'\n__author__ = 'D-Wave Systems Inc.'\n__authoremail__ = 'acondello@dwavesys.com'\n__description__ = 'A shared API for binary quadratic model samplers.'\n" }, { ...
python
chosen
[ { "from": "system", "value": "Update release version to 0.7.2" }, { "from": "human", "value": "\"\"\"\nChatterBot is a machine learning, conversational dialog engine.\n\"\"\"\nfrom .chatterbot import ChatBot\n\n__version__ = '0.7.1'\n__author__ = 'Gunther Cox'\n__email__ = 'gunthercx@gmail.com'\...
python
chosen
[ { "from": "system", "value": "Fix realm_slug_field to follow a join back to the realm's slug field.\n" }, { "from": "human", "value": "from django.views.generic.list_detail import object_list, object_detail\nimport models\n\n\ndef _limit_articles(realm_object_id=None, realm_slug=None,\n ...
python
chosen
[ { "from": "system", "value": "Fix mistake loading GloVe vectors. GloVe vectors now loaded by default if present, as promised.\n" }, { "from": "human", "value": "import pathlib\n\nfrom .util import set_lang_class, get_lang_class\n\nfrom . import en\nfrom . import de\nfrom . import zh\n\n\ntry:\n ...
python
chosen
[ { "from": "system", "value": "Fix broken test in the most correct way possible ;)\n" }, { "from": "human", "value": "import tensorprob as tp\n\n\ndef make_normal():\n mu = tp.Scalar('mu')\n sigma = tp.Scalar('sigma', lower=0)\n distribution = tp.Normal(mu, sigma)\n return mu, sigma, ...
python
chosen
[ { "from": "system", "value": "Add a fuzzyAssertRaisesError helper for checking against HarpoonError\n" }, { "from": "human", "value": "import json\n\nclass AssertionsAssertionsMixin:\n def assertSortedEqual(self, one, two):\n \"\"\"Assert that the sorted of the two equal\"\"\"\n ...
python
chosen
[ { "from": "system", "value": "Test unitaire pour l'extraction des Tags\n" }, { "from": "human", "value": "from django.test import TestCase\n\n# Create your tests here.\n" }, { "from": "gpt", "value": "from django.test import TestCase\nfrom note.models import Page\n\n# Create your tes...
python
chosen
[ { "from": "system", "value": "Refactor ReusableMessageSender to be resilient against errors on first message api call, whose result is needed to get the message_id to edit further.\n\nAlso, an upper limit has been added to avoid errors because of too long messages.\n" }, { "from": "human", "valu...
python
chosen
[ { "from": "system", "value": "Handle exceptions in the is_checkbox filter\n" }, { "from": "human", "value": "from django import template\nfrom django.forms.widgets import CheckboxInput\n\n\nregister = template.Library()\n\n@register.inclusion_tag(\"_form_field.html\")\ndef smart_field_render(fie...
python
chosen
[ { "from": "system", "value": "Add tree constructors and LevelSetTree to the debacl namespace.\n" }, { "from": "human", "value": "\"\"\"\nDeBaCl is a Python library for estimation of density level set trees and\nnonparametric density-based clustering. Level set trees are based on the\nstatistical...
python
chosen
[ { "from": "system", "value": "Change file to run with python3\n" }, { "from": "human", "value": "#!/usr/bin/env python\n\nimport urllib\nimport json\nimport yaml\n\ncredentials = yaml.load(file(\"credentials.yml\", 'r'))\n\ndef main():\n data=json.loads(urllib.urlopen(\"http://api.giphy.com/v...
python
chosen
[ { "from": "system", "value": "Add num_tries to the feed update. If there are more than 10 tries, the requests must stop\n" }, { "from": "human", "value": "import json\nimport requests\nfrom time import sleep\n\nfrom django.http import HttpResponse\n\nfrom .models import NewsFeed\n\nHACKER_NEWS_A...
python
chosen
[ { "from": "system", "value": "Fix malformed data bugs in lookup_term()\n" }, { "from": "human", "value": "from merriam_webster.api import CollegiateDictionary, WordNotFoundException\nfrom translate.translate import translate_word\n\n\nDICTIONARY = CollegiateDictionary('d59bdd56-d417-42d7-906e-68...
python
chosen
[ { "from": "system", "value": "Update base directory setting for heroku\n" }, { "from": "human", "value": "from .base import *\n\nimport dj_database_url\n\nDEBUG = dotenv.get('DEBUG')\nALLOWED_HOSTS = ['*']\n\n# Honor the 'X-Forwarded-Proto' header for request.is_secure()\nSECURE_PROXY_SSL_HEADER...
python
chosen
[ { "from": "system", "value": "Fix history chain of DB migrations.\n" }, { "from": "human", "value": "\"\"\"alter table challenge\n\nRevision ID: 307a4fbe8a05\nRevises: d6b40a745e5\nCreate Date: 2017-04-19 14:39:20.255958\n\n\"\"\"\n\n# revision identifiers, used by Alembic.\nrevision = '307a4fbe...
python
chosen
[ { "from": "system", "value": "Remove useless and confusing code\n" }, { "from": "human", "value": "\"\"\"Get words from files in \"src/dictionary/\".\"\"\"\n\nimport os\n\ndef get_word_list(filepath):\n \"\"\"\n Get a list of words from a file.\n \n Input: file name\n Output: dict...
python
chosen
[ { "from": "system", "value": "Add not_ alias of is_not for better readability of negations\n\nExample:\r\n\r\n>> assert_that(alist, is_not(has_item(item)))\r\n\r\ncan be\r\n\r\n>>assert_that(alist, not_(has_item(item)))" }, { "from": "human", "value": "from __future__ import absolute_import\n\"\...
python
chosen
[ { "from": "system", "value": "Insert a user into a table\n" }, { "from": "human", "value": "\"\"\" Just the SQL Alchemy ORM tutorial \"\"\"\n\nimport sqlalchemy\nfrom sqlalchemy import create_engine\nfrom sqlalchemy.ext.declarative import declarative_base\nfrom sqlalchemy import Column, Integer,...
python
chosen
[ { "from": "system", "value": "Update error message with error warning" }, { "from": "human", "value": "import os.path\nimport os\nimport shutil\n\nfrom dbt.task.base import ProjectOnlyTask\nfrom dbt.logger import GLOBAL_LOGGER as logger\n\n\nclass CleanTask(ProjectOnlyTask):\n\n def __is_proj...
python
chosen
[ { "from": "system", "value": "Document behavior when item args are omitted.\n" }, { "from": "human", "value": "from __future__ import print_function\n\nimport argparse\nimport shcol\nimport sys\n\n__all__ = ['main']\n\ndef main(cmd_args):\n parser = argparse.ArgumentParser(\n descripti...
python
chosen
[ { "from": "system", "value": "Remove django-extensions from dev settings\n" }, { "from": "human", "value": "from .base import *\n\nDEBUG = True\n\n# TEMPLATES[1]['DEBUG'] = True\n\nDATABASES = {\n 'default': {\n # 'ENGINE': 'django.db.backends.sqlite3',\n # 'NAME': os.path.join(...
python
chosen
[ { "from": "system", "value": "Add docstring with usage instructions\n" }, { "from": "human", "value": "from django import template\nfrom utils.logger import get_logger\n\nlogger = get_logger(__name__)\n\nregister = template.Library()\n\n\nclass TraceNode(template.Node):\n\n def render(self, c...
python
chosen
[ { "from": "system", "value": "Revert \"Handle second service UUID better.\"\n\nRealized I actually made the url parsing worse, this isn't what we wanted.\n" }, { "from": "human", "value": "# Author: Braedy Kuzma\nfrom django.conf.urls import url\nfrom . import views\n\nurlpatterns = [\n url(r...
python
chosen
[ { "from": "system", "value": "Check for CNAME file when using gh-deploy\n\nIf a CNAME file exists in the gh-pages branch, we should read it and use that URL as the expected GitHub pages location. For branches without a CNAME file, we will try to determine the URL using the origin URL.\n" }, { "from...
python
chosen
[ { "from": "system", "value": "Add dividend pay date and ex-diviend date into yahoo daily quote\n" }, { "from": "human", "value": "import sys\nimport os\nimport datetime\n\nprint \"=====================\"\nprint str(datetime.datetime.now())+\": the daily job has started\"\nprint \"Current directo...
python
chosen
[ { "from": "system", "value": "Fix the Content-Type header of the json_response\n\nSeems I forgot to add the correct Content-Type header to the json_response\nutility. This has now been fixed.\n" }, { "from": "human", "value": "# -*- coding: utf-8 -*-\n\nimport json\n\nfrom django.http import Htt...
python
chosen
[ { "from": "system", "value": "Allow overwriting of config from envvar\n" }, { "from": "human", "value": "from flask import Flask\nfrom flask.ext.sqlalchemy import SQLAlchemy\n\n\napp = Flask(__name__)\napp.config.from_object('carson.default_settings')\n\ndb = SQLAlchemy(app)\n\nfrom . import api...
python
chosen
[ { "from": "system", "value": "Update copyright year to be continuous\n" }, { "from": "human", "value": "__title__ = 'cihai'\n__package_name__ = 'cihai'\n__version__ = '0.9.0a3'\n__description__ = 'Library for CJK (chinese, japanese, korean) language data.'\n__author__ = 'Tony Narlock'\n__email__...
python
chosen
[ { "from": "system", "value": "Make version format PEP 440 compatible\n" }, { "from": "human", "value": "import re\nimport sys\nfrom collections import namedtuple\n\nfrom .client import Elasticsearch\n\n__all__ = ('Elasticsearch',)\n\n\n__version__ = '0.1.0a'\n\nversion = __version__ + ' , Python...
python
chosen
[ { "from": "system", "value": "Add first simple title and parent test\n" }, { "from": "human", "value": "import pytest\n" }, { "from": "gpt", "value": "from PySide import QtGui\n\nimport qmenuview\n\n\ndef test_title(qtbot):\n title = 'Test title'\n qmenuview.MenuView(title)\n ...
python
chosen
[ { "from": "system", "value": "Add exception handling for FileExistsError\n" }, { "from": "human", "value": "import logging\nimport os\nimport shutil\n\nlogger = logging.getLogger('polyaxon.libs.paths')\n\n\ndef delete_path(path):\n if not os.path.exists(path):\n return\n try:\n ...
python
chosen
[ { "from": "system", "value": "Enable status filter in API\n" }, { "from": "human", "value": "import django_filters\n\nfrom ..models import Gift\n\n\nclass GiftFilter(django_filters.FilterSet):\n \"\"\"docstring for GiftFilter\"\"\"\n class Meta:\n model = Gift\n fields = ['re...
python
chosen
[ { "from": "system", "value": "Remove [thz.la] from file names.\n" }, { "from": "human", "value": "import requests\nimport bs4\nimport os\nimport urllib.request\nimport shutil\nimport re\n\n\ndistDir = 'F:\\\\utorrent\\\\WEST'\np = re.compile(r'(\\D+\\d+)\\w*(.\\w+)')\n\n\nfilenames = os.listdir(...
python
chosen
[ { "from": "system", "value": "Make test module for Copy runnable\n" }, { "from": "human", "value": "import unittest\n\nimport numpy\n\nimport chainer\nfrom chainer import functions\nfrom chainer import gradient_check\n\n\nclass Copy(unittest.TestCase):\n\n def setUp(self):\n self.x_dat...
python
chosen
[ { "from": "system", "value": "Include URL and response body on HTTP failure\n\nIt's quite awkward to diagnose exceptions caused by HTTP errors when you\ndon't have the URL and response body, so this should help.\n" }, { "from": "human", "value": "import datetime\nimport logging\nimport pytz\nimp...
python
chosen
[ { "from": "system", "value": "Delete timer_end in same migration as total_duration\n" }, { "from": "human", "value": "# -*- coding: utf-8 -*-\nfrom __future__ import unicode_literals\n\nfrom django.db import models, migrations\n\n\ndef set_total_duration_as_duration(apps, schema_editor):\n Mu...
python
chosen
[ { "from": "system", "value": "Create credentials with random keys, identifiers, and expiry a day in the future..\n" }, { "from": "human", "value": "from django.db import models\nfrom django.contrib.auth.models import User\n\nclass Credentials(models.Model):\n \"Keeps track of issued MAC credent...
python
chosen
[ { "from": "system", "value": "Add operation to update campaign.\n" }, { "from": "human", "value": "\"\"\"\nAPI MAPPING FOR Eloqua API V2\n\"\"\"\n\nmapping_table = {\n\n 'content_type': 'application/json',\n 'path_prefix': '/API/REST/2.0',\n\n # Campaigns\n 'get_campaign': {\n ...
python
chosen
[ { "from": "system", "value": "Switch to class based generic views.\n" }, { "from": "human", "value": "from django.conf import settings\nfrom django.conf.urls.defaults import patterns, url, include\nfrom django.views.generic.simple import redirect_to\n\nfrom sumo import views\n\n\nservices_patter...
python
chosen
[ { "from": "system", "value": "Handle error code METHOD_NOT_FOUND_CODE in InspectorServiceWorker.StopAllWorkers()\n\nDevTools method ServiceWorker.stopAllWorkers is supported from M63, so\ncalling this can return METHOD_NOT_FOUND_CODE error in previous browser.\nThis CL make InspectorServiceWorker.StopAllWor...
python
chosen
[ { "from": "system", "value": "Add method to find pictures.\n" }, { "from": "human", "value": "#!/usr/bin/env python\n\n\"\"\"Script to upload pictures to the gallery.\n\nThis script scans a local picture folder to determine which patients\nhave not yet been created in the gallery. It then create...
python
chosen
[ { "from": "system", "value": "Fix weight CSV export test\n" }, { "from": "human", "value": "# This file is part of wger Workout Manager.\n#\n# wger Workout Manager is free software: you can redistribute it and/or modify\n# it under the terms of the GNU Affero General Public License as published ...
python
chosen
[ { "from": "system", "value": "Fix typo causing error in imports.\n" }, { "from": "human", "value": "from __future__ import absolute_import\n\nfrom ._version import __version__\nfrom . import styles\nfrom . import examples\nfrom . import datasets\nfrom . import embed\nfrom .widgets import (Mesh,\...
python
chosen
[ { "from": "system", "value": "Revert \"Assign quality values when checking MIME types\"\n\nThis reverts commit b06842f3d5dea138f2962f91105926d889157773.\n" }, { "from": "human", "value": "from __future__ import unicode_literals\nfrom flask import Request\nfrom itertools import repeat, chain\n\n\...
python
chosen
[ { "from": "system", "value": "Fix to check HIP version\n" }, { "from": "human", "value": "from distutils import ccompiler\nfrom distutils import sysconfig\nimport unittest\n\nimport pytest\n\nfrom install import build\n\n\nclass TestCheckVersion(unittest.TestCase):\n\n def setUp(self):\n ...
python
chosen
[ { "from": "system", "value": "Add top-level 'SCOPE' alias for DNS.\n" }, { "from": "human", "value": "# Copyright 2015 Google Inc. All rights reserved.\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# Y...
python
chosen
[ { "from": "system", "value": "Allow _ in service and project ids\n\nWe use dash to nest projects (infra-internal), so it cannot be used for\nword separation (depot_tools).\n\nR=vadimsh@chromium.org\nBUG=\n\nReview URL: https://codereview.chromium.org/1185823003.\n" }, { "from": "human", "value":...
python
chosen
[ { "from": "system", "value": "task.tests: Fix reference to python binary\n\nIt was trying to use `python` as opposed to `python3`.\n\nSigned-off-by: Zack Cerza <d7cdf09fc0f0426e98c9978ee42da5d61fa54986@redhat.com>\n" }, { "from": "human", "value": "import logging\nimport pytest\n\nfrom io import...
python
chosen