conversations listlengths 2 3 | source stringclasses 1
value | stack stringclasses 1
value |
|---|---|---|
[
{
"from": "system",
"value": "Throw 500 error on multiple account in LocaleMiddleware so we can fix them.\n"
},
{
"from": "human",
"value": "from django.utils.cache import patch_vary_headers\nfrom django.utils import translation\nfrom account.models import Account\n\nclass LocaleMiddleware(objec... | python | chosen |
[
{
"from": "system",
"value": "Store sessions in cache + database\n"
},
{
"from": "human",
"value": "import os\nfrom base import * # noqa\n\nDEBUG = False\nMEDIA_URL = '//lutris.net/media/'\nFILES_ROOT = '/srv/files'\n\nALLOWED_HOSTS = ['.lutris.net', '.lutris.net.', ]\n\nDATABASES = {\n 'def... | python | chosen |
[
{
"from": "system",
"value": "Replace swith statement with a mapping\n\nOfficial Python documentation explains [1], that switch statement can be\nreplaced by `if .. elif .. else` or by a mapping.\n\nIn first example with varying condtitions `if .. elif .. else` was used, and in\nthis example a mapping is mu... | python | chosen |
[
{
"from": "system",
"value": "Update expanded tests to match mysql style.\n"
},
{
"from": "human",
"value": "from mycli.packages.expanded import expanded_table\n\ndef test_expanded_table_renders():\n input = [(\"hello\", 123), (\"world\", 456)]\n\n expected = \"\"\"-[ RECORD 0 ]\nname | he... | python | chosen |
[
{
"from": "system",
"value": "Convert 'comports' to a list before getting its length (the value may be\na generator).\n"
},
{
"from": "human",
"value": "from __future__ import (absolute_import, print_function, unicode_literals)\nimport os\nimport sys\nlib_path = os.path.abspath('../')\nsys.path.... | python | chosen |
[
{
"from": "system",
"value": "Add init method to class Room\n"
},
{
"from": "human",
"value": "class Room(object):\n \"\"\" This class is responsible for managing the people in a room \"\"\"\n\n\n"
},
{
"from": "gpt",
"value": "class Room(object):\n \"\"\" This class is respons... | python | chosen |
[
{
"from": "system",
"value": "Change type comparisions with isinstance\n"
},
{
"from": "human",
"value": "from django import forms\n\ndef parsleyfy(klass):\n class ParsleyClass(klass):\n def __init__(self, *args, **kwargs):\n super(ParsleyClass, self).__init__(*args, **kwarg... | python | chosen |
[
{
"from": "system",
"value": "Change job_count var name to total_job_count\n"
},
{
"from": "human",
"value": "from django.views.generic.list import ListView\nfrom edxmako.shortcuts import render_to_response\n\nfrom .models import Job\n\n\nclass JobsListView(ListView):\n\n model = Job\n con... | python | chosen |
[
{
"from": "system",
"value": "Switch CSRF token from per-request to per-session\n\nThis patch switches the CSRF token handling from per-request to\nper-session. The per-request behavior was overly aggressive, and it\nrestricted parallel browsing (e.g. multiple open browser tabs).\n"
},
{
"from": "hu... | python | chosen |
[
{
"from": "system",
"value": "Increase timeout on RC sensor readings\n"
},
{
"from": "human",
"value": "#!/usr/bin/env python\n\nimport pexpect\nimport os\nimport re\n\npath = os.path.dirname(__file__)\n\nclass RcSensor(object):\n\n def __init__(self, gpio, cycles=200, discharge_delay=10):\n ... | python | chosen |
[
{
"from": "system",
"value": "fix: Use new relative import within directory\n\nSee also: PSOBAT-1197\n"
},
{
"from": "human",
"value": "\"\"\"Generate base64 encoded User Data.\"\"\"\nimport base64\n\nfrom ..utils import get_template\n\n\ndef generate_encoded_user_data(env='dev',\n ... | python | chosen |
[
{
"from": "system",
"value": "Order of import matters for disambiguation, but this should be fixed later to avoid this.\n"
},
{
"from": "human",
"value": "from .helpers import *\nfrom .gridded import *\nfrom .pandas import *\nfrom .excel import *\nfrom .image import *\nfrom .dendrogram import *\... | python | chosen |
[
{
"from": "system",
"value": "Test Endpoint.endpoints has all endpoints\n"
},
{
"from": "human",
"value": "from noopy.endpoint import methods\nfrom noopy.endpoint.decorators import endpoint\n\n\n@endpoint('/foo', methods.GET)\ndef sample_view(event, context):\n pass\n\n\ndef test_resources_ad... | python | chosen |
[
{
"from": "system",
"value": "Set up the database once for all unittests\n\nResolves an error with a static pointer to a dead database and speeds up tests\n"
},
{
"from": "human",
"value": "from random import randint\n\nimport pytest\n\nimport dataactcore.config\nfrom dataactcore.scripts.databas... | python | chosen |
[
{
"from": "system",
"value": "Add doc synopsis for the app factory.\n"
},
{
"from": "human",
"value": "\"\"\"\n.. module:: app_factory\n :platform: linux\n :synopsis: \n\n.. moduleauthor:: Paul Fanelli <paul.fanelli@gmail.com>\n\n.. modulecreated:: 6/27/15\n\n\"\"\"\nfrom zope.interface impo... | python | chosen |
[
{
"from": "system",
"value": "Fix bug which caused put_object in LocalSyncClient to fail on create\n"
},
{
"from": "human",
"value": "# -*- coding: utf-8 -*-\n\nimport os\n\n\nclass LocalSyncClient(object):\n def __init__(self, local_dir):\n self.local_dir = local_dir\n\n def get_ob... | python | chosen |
[
{
"from": "system",
"value": "Use an environment variable as config file\n"
},
{
"from": "human",
"value": "\"\"\"Declare the Koztumize application using Pynuts.\"\"\"\n\nimport ldap\nfrom pynuts import Pynuts\n\n\nclass Koztumize(Pynuts):\n \"\"\"The class which open the ldap.\"\"\"\n @pr... | python | chosen |
[
{
"from": "system",
"value": "Use matlab.exe instead of matlab in Windows"
},
{
"from": "human",
"value": "# --------------------------------------------------------\n# Fast R-CNN\n# Copyright (c) 2015 Microsoft\n# Licensed under The MIT License [see LICENSE for details]\n# Written by Ross Girsh... | python | chosen |
[
{
"from": "system",
"value": "Change 0.9.2 to 0.1.2 (Kind of silly to have 0.9 just 3 weeks after starting...)\n"
},
{
"from": "human",
"value": "# -*- coding: utf-8 -*-\nimport platform\nname = \"Fourth Evaz\"\nversion = (0, 9, 2)\nsource = \"https://github.com/shacknetisp/fourthevaz\"\n\n\ndef... | python | chosen |
[
{
"from": "system",
"value": "Add encoding hint (and which python version is required).\n"
},
{
"from": "human",
"value": "from behave import given, then, step\nfrom behave.api.async_step import use_or_create_async_context, AsyncContext\nfrom hamcrest import assert_that, equal_to, empty\nimport ... | python | chosen |
[
{
"from": "system",
"value": "Add `json_fields` parameter to set_up_logging\n\nThis will allow the main function to add extra fields to JSON log\nmessages, for example to pass through command-line arguments.\n\nSee https://www.pivotaltracker.com/story/show/70748012\n"
},
{
"from": "human",
"valu... | python | chosen |
[
{
"from": "system",
"value": "Remove Python 2.6 compatibility code."
},
{
"from": "human",
"value": "\"\"\"\n oauthlib\n ~~~~~~~~\n\n A generic, spec-compliant, thorough implementation of the OAuth\n request-signing logic.\n\n :copyright: (c) 2011 by Idan Gazit.\n :license: BSD... | python | chosen |
[
{
"from": "system",
"value": "Add depends in our addon\n"
},
{
"from": "human",
"value": "# -*- coding: utf-8 -*-\n##############################################################################\n#\n# OpenERP, Open Source Management Solution\n# Copyright (C) 2004-2010 Tiny SPRL (<http://tin... | python | chosen |
[
{
"from": "system",
"value": "Remove no-cover from __str__ method\n"
},
{
"from": "human",
"value": "from canvas_object import CanvasObject\nfrom util import combine_kwargs\n\n\nclass Assignment(CanvasObject):\n\n def __str__(self): # pragma: no cover\n return \"{} ({})\".format(self.... | python | chosen |
[
{
"from": "system",
"value": "Fix repository import test for Python < 3.6\n\nCheck for broader range of exceptions.\n"
},
{
"from": "human",
"value": "#!/usr/bin/env python3\n# -*- coding: utf-8 -*-\n#\n# Copyright (c) 2017, Fabian Greif\n# All Rights Reserved.\n#\n# The file is part of the lbui... | python | chosen |
[
{
"from": "system",
"value": "Make camera interaction more sensitive\n\n(refs #12095)\n"
},
{
"from": "human",
"value": "#pylint: disable=missing-docstring\n#* This file is part of the MOOSE framework\n#* https://www.mooseframework.org\n#*\n#* All rights reserved, see COPYRIGHT for full restrict... | python | chosen |
[
{
"from": "system",
"value": "Fix bug where lessons are duplicated across age groups.\n"
},
{
"from": "human",
"value": "\"\"\"Return ordered groups of lessons.\"\"\"\n\nfrom collections import OrderedDict\nfrom topics.models import (\n AgeGroup,\n LessonNumber,\n)\n\n\ndef group_lessons_b... | python | chosen |
[
{
"from": "system",
"value": "Fix a minor typo in the EndpointNotDefined exception\n"
},
{
"from": "human",
"value": "#!/usr/bin/env python\n# -*- coding: utf-8 -*-\n\nimport pyrax\nfrom pyrax.base_identity import BaseAuth\nimport pyrax.exceptions as exc\n\n\nclass KeystoneIdentity(BaseAuth):\n ... | python | chosen |
[
{
"from": "system",
"value": "Remove import from testing packages"
},
{
"from": "human",
"value": "'''\nCreated on Sep 24, 2016\n\n@author: rtorres\n'''\nfrom flaskiwsapp.database import SurrogatePK, Model, db, reference_col, relationship, Column\nfrom sqlalchemy.dialects.postgresql.base import ... | python | chosen |
[
{
"from": "system",
"value": "Add logging to python webserver"
},
{
"from": "human",
"value": "import os\nimport pgdb\n\nfrom flask import Flask\n\napp = Flask(__name__)\n\n@app.route('/')\ndef hello():\n conn = pgdb.connect( host='pg', user='postgres', password='testnet', database='testnet' ... | python | chosen |
[
{
"from": "system",
"value": "Change suffix for locator to 'loc'\n"
},
{
"from": "human",
"value": "\"\"\"Kraken - base config module.\n\nClasses:\nBaseConfig -- Base config object used to configure builders.\n\n\"\"\"\n\n\nclass BaseConfig(object):\n \"\"\"Base Configuration for Kraken build... | python | chosen |
[
{
"from": "system",
"value": "Use sets to define allowed regions for plugins\n"
},
{
"from": "human",
"value": "from django import forms\nfrom django.contrib import admin\nfrom django.db import models\n\nfrom content_editor.admin import ContentEditor, ContentEditorInline\n\nfrom .models import A... | python | chosen |
[
{
"from": "system",
"value": "Add tests for new caffeine_oauth2.models code\n"
},
{
"from": "human",
"value": "from __future__ import unicode_literals\n\nfrom django.test import TestCase\n\nfrom caffeine_oauth2.models import CoffeestatsApplication\n\n\nclass CoffeestatsApplicationTest(TestCase):... | python | chosen |
[
{
"from": "system",
"value": "Use a mixin for get-/setProps\n"
},
{
"from": "human",
"value": "from u2flib_server.jsapi import (JSONDict, RegisterRequest, RegisterResponse,\n SignRequest, SignResponse)\n\n__all__ = [\n 'RegisterRequestData',\n 'RegisterRespo... | python | chosen |
[
{
"from": "system",
"value": "Make can_edit available in the helper\n"
},
{
"from": "human",
"value": "import babel.core\n\nfrom adhocracy.lib import cache\nfrom adhocracy.lib.helpers import url as _url\n\n\n@cache.memoize('staticpage_url')\ndef url(staticpage, **kwargs):\n pid = staticpage.k... | python | chosen |
[
{
"from": "system",
"value": "Use os.join for testing on multiple platforms.\n"
},
{
"from": "human",
"value": "#!/usr/bin/env python\n\nimport subprocess\n\nNOTEBOOKS_DIR = 'notebooks'\nSKIP_NOTEBOOKS = ['Bonus/What to do when things go wrong.ipynb']\n\n\ndef run_notebook(notebook):\n args =... | python | chosen |
[
{
"from": "system",
"value": "Insert explicit cast to malloc implementation\n"
},
{
"from": "human",
"value": "# -*- coding: utf-8 -*-\nfrom __future__ import print_function, division, absolute_import\n\nimport math\nimport unittest\n\nfrom numba2 import jit, types, int32, float64, Type\nfrom nu... | python | chosen |
[
{
"from": "system",
"value": "Configure debug_toolbar to not fail.\n"
},
{
"from": "human",
"value": "from django.conf.urls import patterns, include, url\nfrom django.conf import settings\n\n# Uncomment the next two lines to enable the admin:\nfrom django.contrib import admin\n\nadmin.autodiscov... | python | chosen |
[
{
"from": "system",
"value": "Append hostname to messages file. This supports a use-case where portions of\nthe processing could happen on various hosts.\n"
},
{
"from": "human",
"value": "# logger module\n\nfrom datetime import datetime\nimport os\n\nlogfile = None\nlogbuf = []\n\ndef init(ana... | python | chosen |
[
{
"from": "system",
"value": "Remove tenant req from task query\n"
},
{
"from": "human",
"value": "from uuid import UUID\n\nfrom zeus import auth\nfrom zeus.config import celery\nfrom zeus.constants import Result, Status\nfrom zeus.models import Build\nfrom zeus.notifications import email\n\n\n@... | python | chosen |
[
{
"from": "system",
"value": "Add test to ensure that style map lines beginning with hash are ignored\n"
},
{
"from": "human",
"value": "from nose.tools import istest, assert_equal\n\nfrom mammoth import style_reader\nfrom mammoth.options import read_options, _default_style_map\n\n\n@istest\ndef... | python | chosen |
[
{
"from": "system",
"value": "Make unload test assertion explicit"
},
{
"from": "human",
"value": "from IPython import get_ipython\nfrom IPython.testing import tools as tt\nfrom IPython.terminal.interactiveshell import TerminalInteractiveShell\n\n\ndef test_full_cycle():\n shell = TerminalInt... | python | chosen |
[
{
"from": "system",
"value": "Add list to expectation in test\n"
},
{
"from": "human",
"value": "# -*- coding: utf-8 -*-\n\nimport codecs\nimport pytest\n\nfrom poyo import parse_string\n\n\n@pytest.fixture\ndef string_data():\n with codecs.open('tests/foobar.yml', encoding='utf-8') as ymlfil... | python | chosen |
[
{
"from": "system",
"value": "Add ability to exclude trunks by passing % before it\n\nFor example, ./run_nose -v %FilmTitles %BookTitles\n"
},
{
"from": "human",
"value": "import functools\nimport sys\nimport nose\nfrom preparation.resources.Resource import trunks_registered, applied_modifiers, ... | python | chosen |
[
{
"from": "system",
"value": "[DEL] Remove required property on some fields\n"
},
{
"from": "human",
"value": "# -*- coding: utf-8 -*-\n\nfrom odoo import fields, models\n\n\nclass Employee(models.Model):\n\n _name = 'tmc.hr.employee'\n _order = 'name'\n\n name = fields.Char()\n\n in... | python | chosen |
[
{
"from": "system",
"value": "Enable registering commands in a module\n\n* Looks for a key \"commands\" with a value of True to import the\n module named warehouse.MODULE.commands to trigger command\n registration\n"
},
{
"from": "human",
"value": "from __future__ import absolute_import\nfrom ... | python | chosen |
[
{
"from": "system",
"value": "Add a language argument to get abi for intel tools.\n"
},
{
"from": "human",
"value": "# INPUTS:\n# ICC_ABI: x86, amd64\n\n_ARG2ABI = {'x86': 'ia32', 'amd64': 'em64t', 'default': 'ia32'}\n\ndef get_abi(env):\n try:\n abi = env['ICC_ABI']\n except KeyE... | python | chosen |
[
{
"from": "system",
"value": "Use NovaVMPort type; otherwise the agent will believe it is a\nUse NovaVMPort as type; otherwise the agent will believe it is dealing with\na service-instance and will not send a VM registration.\n"
},
{
"from": "human",
"value": "\nfrom contrail_vrouter_api.vrouter... | python | chosen |
[
{
"from": "human",
"value": "Add a hack to work around a problem with South and permissions\n"
},
{
"from": "gpt",
"value": "# Apparently South has some problems with upgrading permissions. The\n# following piece of code hooks into the migrations and recreates the\n# permissions. See also\n# htt... | python | chosen |
[
{
"from": "system",
"value": "Refactor migration script to handle case where Postgres is being used but psycopg2 isn't installed\n"
},
{
"from": "human",
"value": "from __future__ import unicode_literals\n\nfrom django import VERSION\nfrom django.db import migrations, models\nif VERSION >= (1, 8... | python | chosen |
[
{
"from": "system",
"value": "Delete an extra blank line\n"
},
{
"from": "human",
"value": "import tensorflow as tf\n\nfrom ..font import font2char\nfrom ..util import static_rank, funcname_scope\nfrom .ar2word2sent2doc import ar2word2sent2doc\n\n\n\n@funcname_scope\ndef font2char2word2sent2doc(... | python | chosen |
[
{
"from": "system",
"value": "Remove wrong serializer field (nc-553)\n"
},
{
"from": "human",
"value": "from rest_framework import serializers\n\nfrom nodeconductor.core.serializers import GenericRelatedField\nfrom nodeconductor.core.fields import MappedChoiceField, JsonField\nfrom nodeconductor... | python | chosen |
[
{
"from": "system",
"value": "Fix ecb-1 to assert flag length\n"
},
{
"from": "human",
"value": "import string\n\nfrom hacksport.problem import ProtectedFile, Remote\n\n\nclass Problem(Remote):\n program_name = \"ecb.py\"\n files = [ProtectedFile(\"flag\"), ProtectedFile(\"key\")]\n\n d... | python | chosen |
[
{
"from": "system",
"value": "Solve pythagorean_triple - reference solution\n"
},
{
"from": "human",
"value": "def triplets_with_sum(n):\n pass\n"
},
{
"from": "gpt",
"value": "from math import ceil, gcd, sqrt\n\n\ndef triplets_in_range(range_start, range_end):\n for limit in r... | python | chosen |
[
{
"from": "system",
"value": "Update Main.py to work with definitions.py\n\nfunctions are loaded from definitions.py and the database can be created without modifying functions"
},
{
"from": "human",
"value": "import tweepy\nimport app_config\n\n# Twitter API configuration\nconsumer_key = app_co... | python | chosen |
[
{
"from": "system",
"value": "Add at least a minimal exception handling (missing subcommand).\n"
},
{
"from": "human",
"value": "#!/usr/bin/python\n\nimport sys\nimport subprocess\n\ncmd = sys.argv[1]\nnew_args = sys.argv[2:] or []\nsubprocess.call([\"pitz-%s\" % cmd] + new_args)\n"
},
{
... | python | chosen |
[
{
"from": "system",
"value": "Make test stricter to be safe.\n"
},
{
"from": "human",
"value": "import copy\n\nimport pytest\n\nfrom ..core import Document, NotMutable\n\n\ndef test_immutable():\n d = Document({'a': 1})\n with pytest.raises(NotMutable):\n # Update existing key\n ... | python | chosen |
[
{
"from": "system",
"value": "Patch device types to be marked as ALPHA and BETA\n"
},
{
"from": "human",
"value": "import sys\n\nfrom ..base_request import BaseRequest\nfrom ..settings import Settings\n\n\nclass Config(object):\n \"\"\"\n This class implements configuration model for Resin... | python | chosen |
[
{
"from": "system",
"value": "Add more thorough intern test\n"
},
{
"from": "human",
"value": "from .. import intern\n\ndef test_global_interning():\n try:\n intern.global_intern(\"hello\")\n except AssertionError as e:\n pass\n else:\n raise Exception(\"Expects com... | python | chosen |
[
{
"from": "system",
"value": "Add more 2 indexes to cache to improve invalidation speed\n"
},
{
"from": "human",
"value": "\"\"\"\nSetup for the API\n\"\"\"\n\nimport api\n\nlog = api.logger.use(__name__)\n\n\ndef index_mongo():\n \"\"\"\n Ensure the mongo collections are indexed.\n \"\... | python | chosen |
[
{
"from": "system",
"value": "Set minimal example to 'default' kineticsFamilies.\n"
},
{
"from": "human",
"value": "# Data sources\ndatabase(\n thermoLibraries = ['primaryThermoLibrary'],\n reactionLibraries = [],\n seedMechanisms = [],\n kineticsDepositories = ['training'],\n kin... | python | chosen |
[
{
"from": "system",
"value": "Check for exit code > 0 instead of existence of stderr\n\nI'm about to make messages appear in the Sublime plugin. In order to do\nthat, I need a channel to post them that won't mess up the end results\nbeing posted to stdout.\n"
},
{
"from": "human",
"value": "impo... | python | chosen |
[
{
"from": "system",
"value": "Upgrade libchromiumcontent to fix chromiumviews.\n"
},
{
"from": "human",
"value": "#!/usr/bin/env python\n\nimport platform\nimport sys\n\nNODE_VERSION = 'v0.11.13'\nBASE_URL = 'https://gh-contractor-zcbenz.s3.amazonaws.com/libchromiumcontent'\nLIBCHROMIUMCONTENT_C... | python | chosen |
[
{
"from": "system",
"value": "Change import statement for external library yaml"
},
{
"from": "human",
"value": "import pathlib\nimport socket\n\nimport pyflare\nimport yaml\n\n\ns = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)\ns.connect(('8.8.8.8', 53))\nmyip = s.getsockname()[0]\ns.close(... | python | chosen |
[
{
"from": "system",
"value": "Fix encoding in reply footer\n"
},
{
"from": "human",
"value": "from textwrap import TextWrapper\n\nBODY_FOOTER_SEPERATOR = \"\\n\\n--\\n\"\n\ndef email_wrapper(text):\n wrapper = TextWrapper()\n wrapper.subsequent_indent = '> '\n wrapper.initial_indent = '... | python | chosen |
[
{
"from": "system",
"value": "Use raw string for secure_password\n"
},
{
"from": "human",
"value": "\n# -*- coding: utf-8 -*-\n'''\nUse pycrypto to generate random passwords on the fly.\n'''\n\n# Import python libraries\nimport Crypto.Random\nimport crypt\nimport re\n\n\ndef secure_password(leng... | python | chosen |
[
{
"from": "system",
"value": "Make kafka client a field in Reader\n"
},
{
"from": "human",
"value": "# -*- coding: utf-8 -*-\n\nimport logging\nimport time\nfrom kafka.client import KafkaClient\nfrom kafka.consumer import SimpleConsumer\n\nclass KafkaReader(object):\n\n def __init__(self, hos... | python | chosen |
[
{
"from": "system",
"value": "Complete level traversal last sol\n"
},
{
"from": "human",
"value": "\"\"\"Leetcode 199. Binary Tree Right Side View\nMedium\n\nURL: https://leetcode.com/problems/binary-tree-right-side-view/\n\nGiven a binary tree, imagine yourself standing on the right side of it,... | python | chosen |
[
{
"from": "system",
"value": "Use request_id forwarded by neutron plugin\n\nChange-Id: Id395e1bd225c99aafad57eaa48ae3ae3897e249d\nCloses-Bug: #1723193\n"
},
{
"from": "human",
"value": "import gevent\nimport bottle\nimport uuid\n\nclass NeutronApiContext(object):\n def __init__(self, request=... | python | chosen |
[
{
"from": "system",
"value": "Fix logging directory njot existing\n"
},
{
"from": "human",
"value": "import sys\nimport os\nimport logging\n\nlogging.basicConfig(filename=os.path.expanduser(\"~/.chatserver/chat.log\"), level=logging.DEBUG)\n\nfrom app import app, db, main, socketio\ndb.create_al... | python | chosen |
[
{
"from": "system",
"value": "Create the transfer model of accounts\n"
},
{
"from": "human",
"value": "from django.db import models\n\n\nclass Currency(models.Model):\n name = models.CharField(max_length=25)\n contraction = models.CarField(max_length=5)\n def __str__(self):\n ret... | python | chosen |
[
{
"from": "system",
"value": "Add stream verification for binary format writers\n"
},
{
"from": "human",
"value": "# encoding: utf-8\n\nimport abc\n\nimport six\n\nfrom .._table_writer import AbstractTableWriter\n\n\n@six.add_metaclass(abc.ABCMeta)\nclass BinaryWriterInterface(object):\n @abc... | python | chosen |
[
{
"from": "system",
"value": "Use rowstride directly from GdkPixbuf in enhance\n\nThe custom calculation of rowstride failed for images with weird\ndimensions and completely broke enhance.\n\nfixes #51\n"
},
{
"from": "human",
"value": "# vim: ft=python fileencoding=utf-8 sw=4 et sts=4\n\"\"\"Wr... | python | chosen |
[
{
"from": "system",
"value": "Change gunicorn websocket listening port\n"
},
{
"from": "human",
"value": "# gunicorn config file for dermshare-ws.py\n\nbind = '0.0.0.0:8025'\n# Only one worker, since connections need to share state\nworkers = 1\nworker_class = 'geventwebsocket.gunicorn.workers.G... | python | chosen |
[
{
"from": "system",
"value": "Add site log received SNS topic\n"
},
{
"from": "human",
"value": "from amazonia.classes.sns import SNS\n\nfrom troposphere import Ref, Join, cloudwatch\nfrom troposphere.sns import Topic, Subscription\n\ndef user_registration_topic(emails):\n return topic(\"User... | python | chosen |
[
{
"from": "system",
"value": "Support and rollup a release\n"
},
{
"from": "human",
"value": "# -*- coding: utf-8 -*-\n\nfrom __future__ import unicode_literals\n\n__name__ = 'app_metrics'\n__author__ = 'Pivotal Energy Solutions'\n__version_info__ = (1, 0, 0)\n__version__ = '.'.join(map(str, __v... | python | chosen |
[
{
"from": "system",
"value": "Add test for invalid MESH ID\n"
},
{
"from": "human",
"value": "from indra.databases import mesh_client\n\ndef test_mesh_id_lookup():\n mesh_id = 'D003094'\n mesh_name = mesh_client.get_mesh_name(mesh_id)\n assert mesh_name == 'Collagen'\n"
},
{
"fr... | python | chosen |
[
{
"from": "system",
"value": "Adjust fixture usage in context tests\n"
},
{
"from": "human",
"value": "import pytest\n\nfrom cardinal.context import Context\nfrom cardinal.errors import IllegalSessionUse\n\n\n@pytest.fixture\ndef base_ctor(mocker):\n return mocker.patch('cardinal.context.comm... | python | chosen |
[
{
"from": "system",
"value": "Add `revoke` method to Screenboard\n\n- This method allow to revoke the public access of a shared\nscreenboard\n"
},
{
"from": "human",
"value": "from datadog.api.base import GetableAPIResource, CreateableAPIResource, \\\n UpdatableAPIResource, DeletableAPIResour... | python | chosen |
[
{
"from": "system",
"value": "Use json instead of simplejson\n\nSigned-off-by: Jan Dvořák <86df5a4870880bf501c926309e3bcfbe57789f3f@mordae.eu>\n"
},
{
"from": "human",
"value": "#!/usr/bin/python3 -tt\n# -*- coding: utf-8 -*-\n\n__all__ = ['KeaAgent']\n\nfrom os import system\nfrom twisted.pytho... | python | chosen |
[
{
"from": "system",
"value": "Add form for user creation\n"
},
{
"from": "human",
"value": "# -*- coding: utf-8 -*-\nfrom __future__ import unicode_literals\n\nfrom django.contrib import admin\nfrom .models import User\n\n# Register your models here.\nadmin.site.register(User)\n"
},
{
"f... | python | chosen |
[
{
"from": "system",
"value": "Add error messages to the asserts\n"
},
{
"from": "human",
"value": "import os\nimport sys\nimport json\n\n\ndef main():\n prefix = os.environ['PREFIX']\n info_file = os.path.join(prefix, 'conda-meta',\n 'always_include_files_regex-... | python | chosen |
[
{
"from": "system",
"value": "Update unit test to use escaped ampersands in comparision.\n"
},
{
"from": "human",
"value": "import datetime\n\nfrom django.test import TestCase\n\nfrom schedule.templatetags.scheduletags import querystring_for_date\n\nclass TestTemplateTags(TestCase):\n \n d... | python | chosen |
[
{
"from": "system",
"value": "Prepare for tagging release 0.1: Add comments to LibCharm.IO\n"
},
{
"from": "human",
"value": "try:\n from Bio import SeqIO\n from Bio.Alphabet import IUPAC\nexcept ImportError as e:\n print('ERROR: {}'.format(e.msg))\n exit(1)\n\ndef load_file(filename... | python | chosen |
[
{
"from": "system",
"value": "Use timer class instead of weird list\n"
},
{
"from": "human",
"value": "from contextlib import contextmanager\nfrom time import time\nimport numpy as np\nfrom skan.vendored import thresholding as th\n\n\n@contextmanager\ndef timer():\n result = [0.]\n t = tim... | python | chosen |
[
{
"from": "system",
"value": "Test creating container stack with fixture\n\nThe fixture will automatically generate a unique ID.\n\nContributes to issue CURA-1278.\n"
},
{
"from": "human",
"value": "# Copyright (c) 2016 Ultimaker B.V.\n# Uranium is released under the terms of the AGPLv3 or highe... | python | chosen |
[
{
"from": "system",
"value": "Use the correct status code in the redirect handler\n"
},
{
"from": "human",
"value": "\"\"\"www URL handlers\"\"\"\n\nimport os\nimport template\nimport webapp2\n\ndef redirect(url):\n \"\"\"Create a request handler to redirect to the given URL.\n\n Args:\n ... | python | chosen |
[
{
"from": "system",
"value": "Revert \"Make subpage_urls a property on RoutablePageTest\"\n\nThis reverts commit d80a92cfe45907b9f91fd212a3b06fa0b2321364.\n"
},
{
"from": "human",
"value": "from django.http import HttpResponse\nfrom django.conf.urls import url\n\nfrom wagtail.contrib.wagtailrout... | python | chosen |
[
{
"from": "system",
"value": "Support \"encoding = None\" argument"
},
{
"from": "human",
"value": "#!/usr/bin/env python\n#encoding:utf-8\n#author:dbr/Ben\n#project:tvnamer\n#repository:http://github.com/dbr/tvnamer\n#license:Creative Commons GNU GPL v2\n# http://creativecommons.org/licenses/GP... | python | chosen |
[
{
"from": "system",
"value": "Make the usermode +i check for WHO slightly neater.\n"
},
{
"from": "human",
"value": "from txircd.modbase import Mode\n\nclass InvisibleMode(Mode):\n def namesListEntry(self, recipient, channel, user, representation):\n if channel.name not in recipient.ch... | python | chosen |
[
{
"from": "system",
"value": "Support fallback-mode as an experimental feature\n"
},
{
"from": "human",
"value": "# Attributes and Methods for fallback_mode\n# Auto-execute numpy method when corresponding cupy method is not found\n\n# \"NOQA\" to suppress flake8 warning\nfrom cupyx.fallback_mode... | python | chosen |
[
{
"from": "system",
"value": "TODOs: Delete some TODOs of little value.\n"
},
{
"from": "human",
"value": "import collections\n\nfrom data import warehouse\nfrom puzzle.heuristics import analyze_word\nfrom puzzle.problems import problem\n\n\nclass AnagramProblem(problem.Problem):\n\n @staticmet... | python | chosen |
[
{
"from": "system",
"value": "Modify the infinite loop function\n\nDon't use `while True` b/c BooleanReplacer breaks this function's\ntest. This is a bit ugly but until Issue #97 is fixed there is\nno other way around it.\n"
},
{
"from": "human",
"value": "# A set of function which exercise spec... | python | chosen |
[
{
"from": "system",
"value": "REF: Use import * since __all__ is defined.\n"
},
{
"from": "human",
"value": "from .ar_model import AR\nfrom .arima_model import ARMA, ARIMA\nimport vector_ar as var\nfrom .vector_ar.var_model import VAR\nfrom .vector_ar.svar_model import SVAR\nfrom .vector_ar.dyna... | python | chosen |
[
{
"from": "system",
"value": "Allow staff access to Publisher APIs\n\nA few Publisher APIs were marked as only allowing publisher users.\nWe should also let staff in.\n\nDISCO-1365\n"
},
{
"from": "human",
"value": "from rest_framework.permissions import BasePermission\n\nfrom course_discovery.a... | python | chosen |
[
{
"from": "system",
"value": "Add description to selectiongrid items\n"
},
{
"from": "human",
"value": "from wagtail.core import blocks\nfrom wagtail.core.fields import StreamField\nfrom wagtail.admin.edit_handlers import TabbedInterface, StreamFieldPanel, ObjectList\n\nfrom falmer.content.block... | python | chosen |
[
{
"from": "system",
"value": "Fix method name in example"
},
{
"from": "human",
"value": "import argparse\nimport pandas as pd\n\nfrom influxdb import DataFrameClient\n\n\ndef main(host='localhost', port=8086):\n user = 'root'\n password = 'root'\n dbname = 'example'\n\n client = Dat... | python | chosen |
[
{
"from": "system",
"value": "Disable dunder evaluation in debuging tool.\n"
},
{
"from": "human",
"value": "\"\"\"Function for Debuging.\"\"\"\nimport inspect\n\n\ndef pv(name):\n # type: (str) -> str\n \"\"\"Analysis an expresion 'expresion : evaulation'.\n\n Used to help debuging val... | python | chosen |
[
{
"from": "system",
"value": "Make first field test work\n"
},
{
"from": "human",
"value": "\nfrom django.template.loader import get_template\nfrom django.test import SimpleTestCase\n\nfrom .utils import TemplateTestMixin\n\n\nclass TestFieldTag(TemplateTestMixin, SimpleTestCase):\n TEMPLATES... | python | chosen |
[
{
"from": "system",
"value": "Use default settings in case of file read errors\n"
},
{
"from": "human",
"value": "\"\"\"This module provides functions for saving to and loading data from\nthe settings XML file.\n\nAttributes:\n SETTINGS_PATH (String): The file path for the settings file.\n ... | python | chosen |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.