conversations
listlengths
2
3
source
stringclasses
1 value
stack
stringclasses
1 value
[ { "from": "system", "value": "Raise exception if we don't know how to handle users operating system" }, { "from": "human", "value": "import os, platform\n# I intend to hide the Operating Specific details of opening a folder\n# here in this module.\n#\n# On Mac OS X you do this with \"open\"\n#...
python
chosen
[ { "from": "system", "value": "Check for the isatty property on sys.stdout.\n\nPreviously we were checking to see if it was of type \"file\", but\nthe type changed between python 2 and 3. Really, all we want\nto do is check if it is a tty and if we can't be sure of that,\ndon't enable utf8 output.\n" }, ...
python
chosen
[ { "from": "system", "value": "Support for size of gravatar image\n\nAdded support for the size (s) argument in the Gravatar API" }, { "from": "human", "value": "# -*- coding: utf-8 -*-\n\nimport hashlib\n\n\nclass BaseX(object):\n @classmethod\n def retrieve_one_by(cls, name, value):\n cls_...
python
chosen
[ { "from": "system", "value": "Set charged_at when confirming a bank transfer\n" }, { "from": "human", "value": "from django import http\nfrom django.conf.urls import url\nfrom django.shortcuts import get_object_or_404\nfrom django.template.loader import render_to_string\nfrom django.utils.transl...
python
chosen
[ { "from": "system", "value": "Add proper `__dir__` reporting, fix bug in AttributeError\n" }, { "from": "human", "value": "__author__ = 'stuart'\n\n\nclass JoinedObject(object):\n def __init__(self, left, right):\n self.left = left\n self.right = right\n\n def __getattr__(sel...
python
chosen
[ { "from": "system", "value": "Fix S3 URL Regex to allow slashes in key names.\n" }, { "from": "human", "value": "from .responses import S3ResponseInstance\n\nurl_bases = [\n \"https?://(?P<bucket_name>[a-zA-Z0-9\\-_.]*)\\.?s3.amazonaws.com\"\n]\n\nurl_paths = {\n '{0}/$': S3ResponseInstanc...
python
chosen
[ { "from": "system", "value": "Remove stray non-ASCII character in docstring\n" }, { "from": "human", "value": "from soccermetrics.rest.resources import Resource\n\nclass Personnel(Resource):\n \"\"\"\n Represents a Personnel REST resource (/personnel/<resource> endpoint).\n\n The Person...
python
chosen
[ { "from": "system", "value": "Make numba fake import robust\n" }, { "from": "human", "value": "from poliastro import jit\n\n\ndef _fake_numba_import():\n # Black magic, beware\n # https://stackoverflow.com/a/2484402/554319\n import sys\n\n class FakeImportFailure:\n def __init...
python
chosen
[ { "from": "system", "value": "Drop duplicated VariantImages before migration to unique together\n" }, { "from": "human", "value": "# Generated by Django 3.1 on 2020-09-04 12:51\n\nfrom django.db import migrations\n\n\nclass Migration(migrations.Migration):\n\n dependencies = [\n (\"pro...
python
chosen
[ { "from": "system", "value": "Fix install with Django 1.5.\n" }, { "from": "human", "value": "try:\n from json_field.fields import JSONField\nexcept ImportError:\n pass # fails when imported by setup.py, no worries\n\n__version__ = '0.4.2'\n" }, { "from": "gpt", "value": "from ...
python
chosen
[ { "from": "system", "value": "Remove extraneous logging and bad param\n" }, { "from": "human", "value": "import requests\nimport urllib\nimport urlparse\n\nfrom st2actions.runners.pythonrunner import Action\n\nclass ActiveCampaignAction(Action):\n\n \n def run(self, **kwargs):\n if ...
python
chosen
[ { "from": "system", "value": "Remove versioning from URL scheme\n" }, { "from": "human", "value": "\"\"\"uclapi URL Configuration\n\nThe `urlpatterns` list routes URLs to views. For more information please see:\n https://docs.djangoproject.com/en/1.10/topics/http/urls/\nExamples:\nFunction vi...
python
chosen
[ { "from": "system", "value": "Update the Portuguese example test\n" }, { "from": "human", "value": "# Portuguese Language Test\nfrom seleniumbase.translate.portuguese import CasoDeTeste\n\n\nclass MinhaClasseDeTeste(CasoDeTeste):\n def test_exemplo_1(self):\n self.abrir(\"https://pt.wi...
python
chosen
[ { "from": "system", "value": "Set static path for the Flask app\n" }, { "from": "human", "value": "import os\nfrom flask import Flask\nfrom flask.ext.bootstrap import Bootstrap\nfrom config import config\nfrom datetime import timedelta\nfrom .main import main as main_blueprint\nfrom .main.helper...
python
chosen
[ { "from": "system", "value": "Fix scotch operator contact import\n" }, { "from": "human", "value": "\"\"\"\nUsage:\n\n ./manage.py import_scotch_operator_contacts < NOC_DB.csv\n\"\"\"\n\nimport requests\nfrom ..import_from_csv import ImportFromCSVCommand\nfrom ...models import Operator\n\n\nc...
python
chosen
[ { "from": "system", "value": "BUG-633: Rewrite test to how IReference actually works\n" }, { "from": "human", "value": "import zeit.cms.content.interfaces\nimport zeit.content.article.edit.volume\nimport zeit.content.volume.testing\nimport zope.component\n\n\nclass VolumeReferenceTest(zeit.conte...
python
chosen
[ { "from": "system", "value": "Make the classpath relative, not absolute and add some steps.\n" }, { "from": "human", "value": "import pava\n\n\n# Tell pava where it can find Java user-defined classes\npava.set_classpath(['c:/Users/laffr/PycharmProjects/pava/pava'])\n\ntry:\n import java\n ...
python
chosen
[ { "from": "system", "value": "Update TEMPLATE_DEBUG to Django 1.8 version" }, { "from": "human", "value": "from .base import *\n\n\n# SECURITY WARNING: don't run with debug turned on in production!\nDEBUG = True\nTEMPLATE_DEBUG = True\n\n# SECURITY WARNING: keep the secret key used in production...
python
chosen
[ { "from": "system", "value": "Include LengthValidator in list of exporeted objects\n\nSigned-off-by: Branko Vukelic <26059cc39872530f89fec69552bb1050e1cc2caa@outernet.is>\n" }, { "from": "human", "value": "\"\"\"\n.. module:: bottle_utils.form\n :synopsis: Form processing and validation librar...
python
chosen
[ { "from": "system", "value": "Add `invalid_token` error to `WWW-Authenticate` header if API token is suspended\n" }, { "from": "human", "value": "\"\"\"\nbyceps.blueprints.api.decorators\n~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\n\n:Copyright: 2006-2021 Jochen Kupperschmidt\n:License: Revised BSD (see `...
python
chosen
[ { "from": "system", "value": "Include a first model, Job\n" }, { "from": "human", "value": "from django.db import models\n\n# Create your models here.\n" }, { "from": "gpt", "value": "\"\"\"\nModule bdp_fe.jobconf.models\n\nCreate your models here.\n\"\"\"\n\nfrom django.db import mo...
python
chosen
[ { "from": "system", "value": "Add graphviz file output argument\n" }, { "from": "human", "value": "import ast\n\nimport click\n\nfrom parsing.parser import FileVisitor\n\n\n@click.command()\n@click.argument('code', type=click.File('rb'))\n@click.option('--printed', default=False, is_flag=True, h...
python
chosen
[ { "from": "system", "value": "Remove a user's statuses in all channels when they logout\n" }, { "from": "human", "value": "from twisted.plugin import IPlugin\nfrom txircd.module_interface import IModuleData, ModuleData\nfrom txircd.utils import ircLower\nfrom zope.interface import implements\n\n...
python
chosen
[ { "from": "system", "value": "Add test for incompatible masters\n" }, { "from": "human", "value": "from __future__ import print_function, division, absolute_import\n\nimport glob\nimport pytest\n\nfrom psautohint.autohint import ACOptions, hintFiles\n\nfrom .differ import main as differ\nfrom . ...
python
chosen
[ { "from": "system", "value": "Fix Spotify api object creation\n" }, { "from": "human", "value": "from flask_login import UserMixin\nimport spotify\nimport spotipy\nimport db_utils\nimport application as app\n\n\nclass User(UserMixin):\n ''' User class for Flask-Login '''\n def __init__(sel...
python
chosen
[ { "from": "system", "value": "Remove ref to deprecated \"message\" property of BaseException\n" }, { "from": "human", "value": "__author__ = 'abdul'\n\n\n###############################################################################\n# Mongoctl Exception class\n#################################...
python
chosen
[ { "from": "system", "value": "Add /movies/<year> endpoint for dynamoDB\n" }, { "from": "human", "value": "from flask import Flask\napplication = Flask(__name__)\n\n\n@application.route('/')\ndef hello_world():\n\n return 'Please use /api to use the DataNorth API.'\n\n@application.route('/api'...
python
chosen
[ { "from": "system", "value": "Return failure on pop() from an empty queue" }, { "from": "human", "value": "# Topic server\n\nimport time\nimport flask\n\n\napp = flask.Flask(__name__)\ndata = []\nsessions = {} # session ID -> current index # FIXME No cleanup!\n\n\n@app.route(\"/simple/newsessi...
python
chosen
[ { "from": "system", "value": "Make DotDict dict methods return those objects\n" }, { "from": "human", "value": "class DotDict(object):\n \"\"\"\n Immutable dict-like objects accessible by dot notation\n\n Used because the amount of configuration access is very high and just using\n d...
python
chosen
[ { "from": "system", "value": "Handle HTTP errors without content graceful\n\nHTTP errors like 503 do not have a content set by Marathon. Try to use\nthe response reason string as an alternative error message.\n" }, { "from": "human", "value": "class MarathonError(Exception):\n pass\n\n\nclass...
python
chosen
[ { "from": "system", "value": "Fix update_permission command for legacy content types\n" }, { "from": "human", "value": "import logging\n\nfrom django.conf import settings\nfrom django.utils.importlib import import_module\nfrom django.db.models import get_apps\nfrom django.contrib.auth.management...
python
chosen
[ { "from": "system", "value": "Refactor parse args db options\n" }, { "from": "human", "value": "import os\nimport argparse\n\n\ndef default_db():\n return os.path.join(os.path.expanduser(\"~\"), \"~/.pysswords\")\n\n\ndef parse_args(args):\n parser = argparse.ArgumentParser(prog=\"Pyssword...
python
chosen
[ { "from": "system", "value": "Clarify usage in docstring [ci skip]\n" }, { "from": "human", "value": "from .permissions import is_location_safe, location_restricted_response\n\n\nclass LocationAccessMiddleware(object):\n \"\"\"\n Many large projects want to restrict data access by location...
python
chosen
[ { "from": "system", "value": "Read perms off the ACL object properly\n" }, { "from": "human", "value": "import unittest\n\nfrom nose.tools import eq_\nimport zookeeper\n\n\nclass TestACL(unittest.TestCase):\n def _makeOne(self, *args, **kwargs):\n from kazoo.security import make_acl\n ...
python
chosen
[ { "from": "system", "value": "Change Revenu model column types for 'code' column and 'description' for MySQL\n" }, { "from": "human", "value": "# -*- coding: utf-8 -*-\n\nfrom sqlalchemy import Column, types\n\nfrom ..extensions import db\n\n\nclass Revenue(db.Model):\n\n __tablename__ = 'rev...
python
chosen
[ { "from": "system", "value": "Add splash page to sitemap\n" }, { "from": "human", "value": "from common.helpers.constants import FrontEndSection\nfrom django.conf import settings\nfrom django.contrib.sitemaps import Sitemap\nfrom .models import Project\nfrom datetime import date\n\n\nclass Secti...
python
chosen
[ { "from": "system", "value": "Fix for bad merge decision\n" }, { "from": "human", "value": "\"\"\"\n\n@author: JD Chodera\n@author: JH Prinz\n\"\"\"\n\nfrom openpathsampling.engines import BaseSnapshot, SnapshotFactory\nimport openpathsampling.engines.features as feats\nfrom . import features as...
python
chosen
[ { "from": "system", "value": "Use keyword based `format` to maintain 2.6 compatibility\n" }, { "from": "human", "value": "from six import string_types\n\nfrom django.db.models import signals\n\nfrom .invalidation import invalidate_paths\n\n\ndef register(model):\n register_instance_function_a...
python
chosen
[ { "from": "system", "value": "Send update notification to server\n" }, { "from": "human", "value": "import sublime\nimport sublime_plugin\nimport re\n\nclass LevureAppNotify(sublime_plugin.EventListener):\n def on_post_save(self, view):\n # 1. Get script only stack name. line 1: script...
python
chosen
[ { "from": "system", "value": "Make sure to set MySQL charset.\n" }, { "from": "human", "value": "import aiomysql\n\nfrom .. import config\nfrom ..event import bus\nfrom .migration import MigrationManager\n\nhost = config.create(\"storage\", \"host\", fallback=\"localhost\", comment=\"The databas...
python
chosen
[ { "from": "system", "value": "Allow setting email when creating a staff account.\n\nOtherwise makes it hard to start using HomePort as it requires email validation.\n" }, { "from": "human", "value": "from django.contrib.auth import get_user_model\nfrom django.core.management.base import BaseComm...
python
chosen
[ { "from": "system", "value": "Check if Google Maps is enabled when trying to get the client\n" }, { "from": "human", "value": "# -*- coding: utf-8 -*-\n# Copyright (c) 2017, Frappe Technologies and contributors\n# For license information, please see license.txt\n\nfrom __future__ import unicode_...
python
chosen
[ { "from": "system", "value": "Bump version number and tag release\n" }, { "from": "human", "value": "# The MIT License\n#\n# Copyright (c) 2008 Bob Farrell\n#\n# Permission is hereby granted, free of charge, to any person obtaining a copy\n# of this software and associated documentation files (t...
python
chosen
[ { "from": "system", "value": "Rename SLURM invoices application for better Django dashoard menu item.\n" }, { "from": "human", "value": "from django.apps import AppConfig\nfrom django.db.models import signals\n\n\nclass SlurmInvoicesConfig(AppConfig):\n name = 'nodeconductor_assembly_waldur.s...
python
chosen
[ { "from": "system", "value": "Fix test signature value type for task\n" }, { "from": "human", "value": "#!/usr/bin/env python3\n\n# Copyright 2014-2018 PUNCH Cyber Analytics Group\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 ENABLE_VARNISH setting to travis settings\n" }, { "from": "human", "value": "# -*- coding: utf-8 -*-\n'''Example settings/local.py file.\nThese settings override what's in website/settings/defaults.py\n\nNOTE: local.py will not be added to source control.\n'''\n...
python
chosen
[ { "from": "system", "value": "[FIX] stock_cancel: Set as not installable because it's broken\n" }, { "from": "human", "value": "# -*- coding: utf-8 -*-\n##############################################################################\n#\n# OpenERP, Open Source Management Solution\n# Copyrigh...
python
chosen
[ { "from": "system", "value": "Move disconnect decision into Connection.handle\n" }, { "from": "human", "value": "import asyncio\n\nfrom .message import Message\n\n\nclass Connection:\n \"\"\"\n Communicates with an IRC network.\n\n Incoming data is transformed into Message objects, and ...
python
chosen
[ { "from": "system", "value": "Fix migration for new tenants\n" }, { "from": "human", "value": "# -*- coding: utf-8 -*-\n# Generated by Django 1.11.15 on 2020-02-12 09:25\nfrom __future__ import unicode_literals\n\nfrom django.db import migrations, connection\n\nfrom bluebottle.clients import pro...
python
chosen
[ { "from": "system", "value": "Remove default cedes pointless search\n" }, { "from": "human", "value": "import zmq\n\nclass QueryIdent:\n\n def __init__(self):\n self._ctx = zmq.Context()\n self._socket = self._ctx.socket(zmq.REQ)\n \n # Point to OpenBazaar Identity...
python
chosen
[ { "from": "system", "value": "Add status endpoint to admin server\n" }, { "from": "human", "value": "# -*- coding: utf-8 -*-\nfrom __future__ import unicode_literals\n\nfrom django.conf import settings\nfrom django.conf.urls import patterns, include, url\nfrom django.conf.urls.static import stat...
python
chosen
[ { "from": "system", "value": "Use reverse to implement get_absolute_url.\n" }, { "from": "human", "value": "from django.db import models\n\nTALK_STATUS_CHOICES = (\n ('S', 'Submitted'),\n ('A', 'Approved'),\n ('R', 'Rejected'),\n ('C', 'Confirmed'),\n)\n\n\nclass Talk(models.Model):\...
python
chosen
[ { "from": "system", "value": "Use PExpect to change the logging buffer size (logging buffered <size>) on pynet-rtr2. Verify this change by examining the output of 'show run'.\n" }, { "from": "human", "value": "from getpass import getpass\nimport time\nfrom netmiko import ConnectHandler\n\npasswo...
python
chosen
[ { "from": "system", "value": "[py_controller_client] Add a simple Python action client\n" }, { "from": "human", "value": "#! /usr/bin/env python\n\nimport rospy\nimport actionlib\nimport cpp_controller_msgs.msg\n\ndef waypoint_client():\n pass\n\n\nif __name__ == '__main__':\n try:\n ...
python
chosen
[ { "from": "system", "value": "Fix detecting css output folder in different jasy versions\n" }, { "from": "human", "value": "# Little helper to allow python modules in current jasylibrarys path\nimport sys, os.path, inspect\nfilename = inspect.getframeinfo(inspect.currentframe()).filename\npath =...
python
chosen
[ { "from": "system", "value": "Fix issues with loading from dict\n" }, { "from": "human", "value": "# Copyright (c) 2010 John Reese\n# Licensed under the MIT license\n\nimport yaml\n\nfrom combine import CombineError\n\nMANIFEST_FORMAT = 1\n\nclass Manifest:\n\n def __init__(self):\n se...
python
chosen
[ { "from": "system", "value": "Use proper ModelAdmin for blog entry" }, { "from": "human", "value": "from __future__ import absolute_import\n\nfrom django.contrib import admin\n\nfrom .models import Entry\n\nadmin.site.register(Entry,\n list_display = ('headline', 'pub_date', 'is_active', 'is_...
python
chosen
[ { "from": "system", "value": "Fix latent bug in proxied XMLRPC that broke adding 5.8.x rUS (RBL-7945)\n" }, { "from": "human", "value": "#\n# Copyright (c) 2005-2009 rPath, Inc.\n#\n# All rights reserved\n#\n\nimport urllib\nfrom conary.repository import transport\n\nclass ProxiedTransport(trans...
python
chosen
[ { "from": "system", "value": "Fix wrong path to flood data to push.\n" }, { "from": "human", "value": "# coding=utf-8\nimport os\nimport shutil\nfrom tempfile import mkdtemp\n\nfrom django.core.management.base import BaseCommand\n\nfrom realtime.tasks.test.test_realtime_tasks import flood_layer_...
python
chosen
[ { "from": "system", "value": "Use page_published signal for cache invalidation instead of post_save\n" }, { "from": "human", "value": "from django.db import models\nfrom django.db.models.signals import post_save, post_delete\n\nfrom wagtail.wagtailcore.models import Page\n\nfrom wagtail.contrib....
python
chosen
[ { "from": "system", "value": "Fix channel number in the comment" }, { "from": "human", "value": "from time import time, sleep\nfrom subprocess import call\nfrom argparse import ArgumentParser\nfrom atexit import register\n\nfrom pyadtn.aDTN import aDTN\nfrom pyadtn.utils import info, debug\n\nEX...
python
chosen
[ { "from": "system", "value": "Fix the Hypothesis test to work with new API.\n\nThe Hypothesis API has since moved on from the last time we pushed\na change. Fix the test suite to work with the new API.\n" }, { "from": "human", "value": "import pytest\n\nfrom aead import AEAD\n\n\nhypothesis = py...
python
chosen
[ { "from": "system", "value": "[cast3p] Change user and password used for Cast hardware devices\n\nChange-Id: Id636d40afea79d08ce9af952438d5396add505e3\nReviewed-on: https://chromium-review.googlesource.com/c/catapult/+/3602946\nCommit-Queue: Chong Gu <2b40eb872a3eb33d1a32a10811f471f8a41ba08b@google.com>\nAu...
python
chosen
[ { "from": "system", "value": "Disable SELinux before OS disk encryption\n" }, { "from": "human", "value": "#!/usr/bin/env python\n#\n# VM Backup extension\n#\n# Copyright 2015 Microsoft Corporation\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may not use this fi...
python
chosen
[ { "from": "system", "value": "Use spaces instead of tabs\n" }, { "from": "human", "value": "\nfrom terroroftinytown.services.base import BaseService\nfrom terroroftinytown.services.status import URLStatus\nimport re\n\nclass GooglService(BaseService):\n\tdef process_response(self, response):\n\t...
python
chosen
[ { "from": "system", "value": "Order groups by id when copying\n" }, { "from": "human", "value": "# -*- coding: utf-8 -*-\n# Generated by Django 1.10.1 on 2016-09-22 09:08\nfrom __future__ import unicode_literals\n\nfrom django.db import migrations\n\n\ndef copy_groups(apps, schema_editor):\n ...
python
chosen
[ { "from": "system", "value": "Test json file with api key is in API service class\n" }, { "from": "human", "value": "import pytest\n\nfrom bcbio.distributed import objectstore\nfrom bcbio.distributed.objectstore import GoogleDrive\n\n\n@pytest.fixture\ndef mock_api(mocker):\n mocker.patch('bc...
python
chosen
[ { "from": "system", "value": "Introduce set_of (similar to list_of validator)\n" }, { "from": "human", "value": "# Licenced under the txaws licence available at /LICENSE in the txaws source.\n\n\"\"\"\nattrs validators for internal use.\n\"\"\"\n\nimport attr\nfrom attr import validators\n\n\nde...
python
chosen
[ { "from": "system", "value": "Use the source version as a doc version\n" }, { "from": "human", "value": "# -*- coding: utf-8 -*-\nimport os\nimport sys\nimport sphinx_rtd_theme\nsys.path.insert(0, os.path.join(os.path.dirname(__file__), '..', 'src'))\nimport sphinxcontrib; reload(sphinxcontrib)\...
python
chosen
[ { "from": "system", "value": "Add Print Statement For Easier Debugging\n" }, { "from": "human", "value": "# Copyright 2015, Google, Inc.\n# Licensed under the Apache License, Version 2.0 (the \"License\"); you may not use\n# this file except in compliance with the License. You may obtain a copy ...
python
chosen
[ { "from": "system", "value": "Fix name: should be TestRuledXmlOrder, not TestRuledXmlForeach.\n" }, { "from": "human", "value": "#!/usr/bin/env python3\n\nimport io\nimport unittest\n\nimport ruledxml\n\nfrom . import utils\n\n\nclass TestRuledXmlForeach(unittest.TestCase):\n def test_030(sel...
python
chosen
[ { "from": "system", "value": "Fix mode +n specification so that it actually fires ever\n" }, { "from": "human", "value": "from twisted.plugin import IPlugin\nfrom twisted.words.protocols import irc\nfrom txircd.module_interface import IMode, IModuleData, Mode, ModuleData\nfrom txircd.utils impor...
python
chosen
[ { "from": "system", "value": "tests.features: Fix OS X test skip.\n" }, { "from": "human", "value": "from __future__ import print_function\nimport sys\nimport subprocess\nimport os\n\n@given('a system executable {exe}')\ndef step_impl(context, exe):\n binary = None\n if sys.platform.starts...
python
chosen
[ { "from": "system", "value": "Update auto-registration to work while running the tests.\n" }, { "from": "human", "value": "try:\n from django.apps import AppConfig\nexcept ImportError:\n AppConfig = object\n\n\nclass SelectableConfig(AppConfig):\n \"\"\"App configuration for django-sele...
python
chosen
[ { "from": "system", "value": "Fix is_site_root when no page\n" }, { "from": "human", "value": "import jinja2\n\nfrom django.conf import settings\nfrom django_jinja import library\nfrom jinja2.ext import Extension\nfrom wagtail.wagtailcore.models import Page\nfrom wagtail.contrib.wagtailroutablep...
python
chosen
[ { "from": "system", "value": "Make use of auto generated table classes.\n" }, { "from": "human", "value": "from cruditor.contrib.collection import CollectionViewMixin\nfrom cruditor.views import CruditorAddView, CruditorChangeView, CruditorDeleteView, CruditorListView\nfrom django.urls import re...
python
chosen
[ { "from": "system", "value": "Move expected test failure to TestCase class.\n" }, { "from": "human", "value": "\"\"\"Django DDP Accounts test suite.\"\"\"\nfrom __future__ import unicode_literals\n\nimport sys\nfrom dddp import tests\n\n\nclass AccountsTestCase(tests.DDPServerTestCase):\n\n #...
python
chosen
[ { "from": "system", "value": "Use `in` rather than `has_key`\n" }, { "from": "human", "value": "import json\n\nfrom django import template\nfrom django.utils.safestring import mark_safe\n\nfrom ..menu_helpers import get_vue_js_router\n\nregister = template.Library()\n\n\n@register.simple_tag(tak...
python
chosen
[ { "from": "system", "value": "Apply client authorization fix from wiki\n\n\ngit-svn-id: f3978d5834b2aa37aa734927aace4f0b92cf88c5@2985 2dde4cc4-cf3c-0410-b1a3-a9b8ff274da5\n" }, { "from": "human", "value": "import base64\n\nfrom pyamf.remoting.client import RemotingService\n\ngw = RemotingService...
python
chosen
[ { "from": "system", "value": "Fix import, use fileinput.iput as context, and fix its argument\n" }, { "from": "human", "value": "#! /usr/bin/env python3\n\"\"\" Helper functions to make our life easier.\n\nOriginally obtained from the 'pharm' repository, but modified.\n\"\"\"\n\nimport fileinput...
python
chosen
[ { "from": "system", "value": "Fix up migration to have only one PK\n" }, { "from": "human", "value": "# -*- coding: utf-8 -*-\r\n# Generated by Django 1.10.5 on 2017-03-27 13:23\r\nfrom __future__ import unicode_literals\r\n\r\nfrom django.db import migrations, models\r\n\r\n\r\nclass Migration(...
python
chosen
[ { "from": "system", "value": "Update SqliteStorageDataSource to receive the SqliteSession already built, so that clients can have more control over its construction\n" }, { "from": "human", "value": "from sqlite_framework.log.logger import SqliteLogger\nfrom sqlite_framework.session.session impo...
python
chosen
[ { "from": "system", "value": "Drop wrap content starting with text/html\n\nNew versions of Django give HTML responses with the content type\n'text/html; charset: utf-8'. We don't want to wrap that, so only check\nfor a start of text/html.\n" }, { "from": "human", "value": "from django.http impor...
python
chosen
[ { "from": "system", "value": "Fix generic extractor being always selected\n\nTurns out our extractor was being inserted *after* the GenericIE.\nNow we are inserting our RdioIE right above GenericIE.\n" }, { "from": "human", "value": "import click\nimport youtube_dl\n\nfrom .config import storage...
python
chosen
[ { "from": "system", "value": "Add retry for socket error\n" }, { "from": "human", "value": "from celery.result import ResultBase, AsyncResult, GroupResult\nimport deployer\nfrom deployer.tasks.exceptions import TaskExecutionException\n\n__author__ = 'sukrit'\n\n\ndef check_or_raise_task_exceptio...
python
chosen
[ { "from": "system", "value": "Change name of module community_blog\n\nChangement de nom" }, { "from": "human", "value": "# -*- coding: utf-8 -*-\n##############################################################################\n#\n# Author: Yannick Buron\n# Copyright 2013 Yannick Buron\n#\n#...
python
chosen
[ { "from": "system", "value": "Trim trailing whitespace with BasicFormatter\n" }, { "from": "human", "value": "import abc\nimport re\n\nclass Formatter:\n @abc.abstractmethod\n def format(self, query):\n ''' Should return a human-readable version of the query string\n '''\n ...
python
chosen
[ { "from": "system", "value": "Fix check menu files agreement test\n" }, { "from": "human", "value": "import magic\nimport os.path as op\n\nfrom checker.base import BakeryTestCase as TestCase, tags\nfrom checker.metadata import Metadata\n\n\nclass CheckFontsMenuAgreements(TestCase):\n\n path =...
python
chosen
[ { "from": "system", "value": "Fix the seed for RF test.\n" }, { "from": "human", "value": "import sys\nsys.path.insert(1, \"../../../\")\nimport h2o\n\ndef vi_toy_test(ip,port):\n # Connect to h2o\n h2o.init(ip,port)\n\n toy_data = h2o.import_frame(path=h2o.locate(\"smalldata/gbm_test/t...
python
chosen
[ { "from": "system", "value": "Check if action returns disposable\n" }, { "from": "human", "value": "from rx.disposables import SingleAssignmentDisposable\n\n\ndef default_sub_comparer(x, y):\n return 0 if x == y else 1 if x > y else -1\n\n\nclass ScheduledItem(object):\n def __init__(self,...
python
chosen
[ { "from": "system", "value": "Add noqa to conditional import\n" }, { "from": "human", "value": "# -*- coding: utf-8 -*-\n\n\ndef has_no_django():\n try:\n import django\n return False\n except ImportError:\n return True\n" }, { "from": "gpt", "value": "# -*...
python
chosen
[ { "from": "system", "value": "Fix exception when running install-task\n" }, { "from": "human", "value": "from base import BaseMethod\nfrom fabric.api import *\nfrom lib.utils import SSHTunnel, RemoteSSHTunnel\nfrom fabric.colors import green, red\nfrom lib import configuration\nimport copy\n\ncl...
python
chosen
[ { "from": "system", "value": "Add name to Departure resource\n" }, { "from": "human", "value": "from __future__ import unicode_literals\n\nfrom ...models import Address, AddOn, DepartureRoom, PP2aPrice\n\nfrom ..base import Product\nfrom .tour_dossier import TourDossier\nfrom .departure_componen...
python
chosen
[ { "from": "system", "value": "Update doc and add one call\n" }, { "from": "human", "value": "import detectLang\nimport graph\n\n# ====================================================================================================\n# La detection est rapide car toute les perplexites sont stockée...
python
chosen
[ { "from": "system", "value": "Remove existing JARs before building new ones\n" }, { "from": "human", "value": "#!/usr/bin/env python\n\nimport os\nimport shutil\nfrom glob import glob\nfrom subprocess import call, check_output\n\nOUTPUT_DIR_NAME = 'jars'\n\n\ndef call_unsafe(*args, **kwargs):\n ...
python
chosen
[ { "from": "system", "value": "Refactor try-catch block by limiting code in the try block\n\nAlways good to know which line will raise an exception and limit the try block to that statement\n" }, { "from": "human", "value": "from wagtail.wagtailimages.models import get_image_model\nfrom wagtail.w...
python
chosen
[ { "from": "system", "value": "Change class Baro to use timedelta_to_string, some fixes\n" }, { "from": "human", "value": "from datetime import datetime\n\n\nclass Baro:\n \"\"\"This class represents a Baro item and is initialized with\n data in JSON format\n\n \"\"\"\n\n def __init__...
python
chosen
[ { "from": "system", "value": "Fix Bugs in module when using -O option\n" }, { "from": "human", "value": "#--coding:utf-8--\n#Platform\n\nclass BasePrompt(object):\n pass\n\nclass ErrPrompt(BasePrompt):\n \"\"\"\n Define some of Err Prompts\n Usually print to sys.stderr\n \"\"\"\n ...
python
chosen
[ { "from": "system", "value": "convnet: Fix DNN test to be compatible with OpenCV 3.3.\n\nOpenCV DNN module API changed with OpenCV 3.3. Fix the tests to use the\nnew API.\n\nSigned-off-by: Ismo Puustinen <75dda586a9213f0e0695eb79120c94222bb30e60@intel.com>\n" }, { "from": "human", "value": "#!/u...
python
chosen
[ { "from": "system", "value": "Fix function test to work on both Py 2 + 3\n" }, { "from": "human", "value": "import instana.http_propagator as ihp\nimport opentracing as ot\nfrom instana import tracer, options, util\nfrom nose.tools import assert_equals\nimport inspect\n\n\ndef test_basics():\n ...
python
chosen