conversations
listlengths
2
3
source
stringclasses
1 value
stack
stringclasses
1 value
[ { "from": "system", "value": "Fix bug in file path.\n\n\nFormer-commit-id: a1e1f0661331f5bf8faa81210eae2cad0c2ad7b3" }, { "from": "human", "value": "import os\nimport sh\nfrom sh import docker\n\n\ndef setup_package():\n \"\"\"\n Sets up docker images and host containers for running the ST...
python
chosen
[ { "from": "system", "value": "Check for duplicate instruction handlers\n" }, { "from": "human", "value": "from importlib import import_module\n\n_modules = ['branching', 'data_processing']\n\nclass Execute(object):\n def __init__(self, registers, process_mode, memory):\n self.instructi...
python
chosen
[ { "from": "system", "value": "Store session cookies as a dictionary\n" }, { "from": "human", "value": "#!/usr/bin/env python\n'''PyLibChorus -- Python Chorus API Library'''\n\nimport logging\nfrom pylibchorus.chorus_api import login\nfrom pylibchorus.chorus_api import logout\nfrom pylibchorus.ch...
python
chosen
[ { "from": "system", "value": "Include statistics usage in existing tests.\n" }, { "from": "human", "value": "import os\nfrom neat.population import Population\nfrom neat.config import Config\n\n\ndef test_minimal():\n # sample fitness function\n def eval_fitness(population):\n for i...
python
chosen
[ { "from": "system", "value": "Fix Nano (m() stuff and add nick name\n" }, { "from": "human", "value": "import weechat\nfrom yapbl import PushBullet\n\napikey = \"\"\n\np = PushBullet(apikey)\n\nweechat.register(\"pushbullet\", \"kekskurse\", \"1.0\", \"GPL3\", \"Test \nSkript\", \"\", \"\")\nwee...
python
chosen
[ { "from": "system", "value": "Fix incorrectly captured value in closure in KeyAssignedListView example.\n" }, { "from": "human", "value": "from clubsandwich.director import DirectorLoop\nfrom clubsandwich.ui import UIScene, WindowView, KeyAssignedListView, ButtonView\n\n\nclass BasicScene(UIScen...
python
chosen
[ { "from": "system", "value": "Allow passing extra data to sentry\n" }, { "from": "human", "value": "#!/usr/bin/env python\n# encoding: utf-8\n\nimport logging\n\nfrom raven.contrib.flask import Sentry\n\nfrom framework.sessions import get_session\n\nfrom website import settings\n\nlogger = loggi...
python
chosen
[ { "from": "system", "value": "Add 1 level depth and also categories fields to employee serializer\n" }, { "from": "human", "value": "from .models import Employee\nfrom rest_framework import serializers\n\n\nclass EmployeeSerializer(serializers.ModelSerializer):\n class Meta:\n model = ...
python
chosen
[ { "from": "system", "value": "Modify an error handling when a command not specified for Which\n" }, { "from": "human", "value": "\"\"\"\n.. codeauthor:: Tsuyoshi Hombashi <tsuyoshi.hombashi@gmail.com>\n\"\"\"\n\n\nimport errno\nimport shutil\nfrom typing import Optional\n\nfrom .error import Com...
python
chosen
[ { "from": "system", "value": "Add nose tests to validate Exception raising.\n" }, { "from": "human", "value": "import unittest\nfrom polycircles import polycircles\nfrom nose.tools import raises\n\nclass TestExceptions(unittest.TestCase):\n\n @raises(ValueError)\n def test_less_than_3_vert...
python
chosen
[ { "from": "system", "value": "Update all related list locators\n" }, { "from": "human", "value": "from cumulusci.robotframework import locators_49\nimport copy\n\nlex_locators = copy.deepcopy(locators_49.lex_locators)\n\nlex_locators[\"object\"][\n \"button\"\n] = \"//div[contains(@class, 'sl...
python
chosen
[ { "from": "system", "value": "tests: Make io test cleanup after itself by removing 'testfile'.\n" }, { "from": "human", "value": "import sys\ntry:\n import _os as os\nexcept ImportError:\n import os\n\nif not hasattr(os, \"unlink\"):\n print(\"SKIP\")\n sys.exit()\n\ntry:\n os.unl...
python
chosen
[ { "from": "system", "value": "Adjust test file to match new env config options\n" }, { "from": "human", "value": "import bookmarks\nimport unittest\n\n\nclass FlaskrTestCase(unittest.TestCase):\n def setUp(self):\n bookmarks.app.config['DATABASE_NAME'] = bookmarks.app.config['TEST_DATA...
python
chosen
[ { "from": "system", "value": "Improve example, start pystray in main thread and webview in new process\n" }, { "from": "human", "value": "from PIL import Image\nfrom pystray import Icon, Menu, MenuItem\nimport webview\nimport sys\n\nif sys.platform == 'darwin':\n raise NotImplementedError('Th...
python
chosen
[ { "from": "system", "value": "Set refresh rate to 10 seconds" }, { "from": "human", "value": "from flask import Blueprint, render_template\nfrom flask_api.decorators import set_renderers\nfrom flask_api.renderers import HTMLRenderer\n\nfrom ._common import route, get_tid\n\n\nblueprint = Bluepri...
python
chosen
[ { "from": "system", "value": "ZON-3178: Update test, the article now starts with a default value for `template` (belongs to commit:95a001d)\n" }, { "from": "human", "value": "# coding: utf8\nimport zeit.content.article.edit.browser.testing\n\n\nclass ArticleTemplateTest(\n zeit.content.ar...
python
chosen
[ { "from": "system", "value": "Add a nice background color\n" }, { "from": "human", "value": "# Include the directory where cvui is so we can load it\nimport sys\nsys.path.append('../../../')\n\nimport numpy as np\nimport cv2\nimport cvui\n\ncvui.random_number_generator(1, 2)\n\n # Create a black...
python
chosen
[ { "from": "system", "value": "Add documentation on every entity" }, { "from": "human", "value": "# -*- coding: utf-8 -*-\n\n# This file defines the entities needed by our legislation.\n\nfrom openfisca_core.entities import build_entity\n\nHousehold = build_entity(\n key = \"household\",\n ...
python
chosen
[ { "from": "system", "value": "Make optional argument use an immutable set for the default value\nin no-commit-to-branch. Make other sets immutable to satisfy type-checking\nand be consistent\n" }, { "from": "human", "value": "from __future__ import print_function\n\nimport argparse\nimport re\nf...
python
chosen
[ { "from": "system", "value": "Add rate-limit test case for internal messages.\n" }, { "from": "human", "value": "from disco.test import DiscoJobTestFixture, DiscoTestCase\nfrom disco.error import JobError\n\nclass RateLimitTestCase(DiscoJobTestFixture, DiscoTestCase):\n inputs = [1]\n\n de...
python
chosen
[ { "from": "system", "value": "Enable occ cloud region for example\n\nChange-Id: I4f6fb7840b684e024ceca37bc5b7e2c858574665\n" }, { "from": "human", "value": "# Licensed under the Apache License, Version 2.0 (the \"License\"); you may\n# not use this file except in compliance with the License. You...
python
chosen
[ { "from": "system", "value": "Exclude version file from test coverage\n" }, { "from": "human", "value": "# Copyright 2017 Joachim van der Herten\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 ...
python
chosen
[ { "from": "system", "value": "Fix event wizard cache keys\n" }, { "from": "human", "value": "import os\n\nfrom google.appengine.ext.webapp import template\nfrom base_controller import CacheableHandler\n\n\nclass EventWizardHandler(CacheableHandler):\n CACHE_VERSION = 1\n CACHE_KEY_FORMAT =...
python
chosen
[ { "from": "system", "value": "Use newline='' to avoid automatic newline translation\n" }, { "from": "human", "value": "from __future__ import absolute_import\nfrom __future__ import unicode_literals\n\nimport contextlib\nimport io\nimport os.path\n\n\nTESTING_DIR = os.path.abspath(os.path.dirnam...
python
chosen
[ { "from": "system", "value": "Use \"{id}:{secret}\" as caching key\n" }, { "from": "human", "value": "#!/usr/local/bin/python\n# -*- coding: utf-8 -*-\n\nimport googlemaps\nimport base64\nfrom exceptions import InvalidGoogleCredentials\n\nclass GoogleMapsClientFactory():\n clients = {}\n\n ...
python
chosen
[ { "from": "system", "value": "Tweak some example fixture ids\n" }, { "from": "human", "value": "# test set for plugin testing\n# from IPython import embed\nimport pytest\n\nclass Dut(object):\n 'fake a device under test'\n\n _allowed = ('a', 'b', 'c')\n\n def __init__(self, mode=None):\...
python
chosen
[ { "from": "system", "value": "Add system checks for Trek form\n" }, { "from": "human", "value": "from django.apps import AppConfig\nfrom django.utils.translation import gettext_lazy as _\n\n\nclass TrekkingConfig(AppConfig):\n name = 'geotrek.trekking'\n verbose_name = _(\"Trekking\")\n" ...
python
chosen
[ { "from": "system", "value": "Fix incorrect protocol being using when behin reverse proxy\n" }, { "from": "human", "value": "from flask import redirect, url_for\nfrom portal import app\n\n@app.route('/', methods=['GET'])\ndef index():\n\treturn redirect(url_for('practices_index'))\n" }, { ...
python
chosen
[ { "from": "system", "value": "Test that DeployOptions sets two options\n" }, { "from": "human", "value": "# Copyright Hybrid Logic Ltd. See LICENSE file for details.\n\n\"\"\"\nUnit tests for the implementation ``flocker-deploy``.\n\"\"\"\n\nfrom twisted.trial.unittest import TestCase, Synchron...
python
chosen
[ { "from": "system", "value": "Make exceptions available at top-level netdumplings module\n" }, { "from": "human", "value": "from .dumpling import Dumpling, DumplingDriver\nfrom .dumplingchef import DumplingChef\nfrom .dumplingeater import DumplingEater\nfrom .dumplinghub import DumplingHub\nfrom...
python
chosen
[ { "from": "system", "value": "Allow other characters in placeholder name\n" }, { "from": "human", "value": "from django.template import loader, Context, TemplateDoesNotExist\nfrom django.template.loader_tags import ExtendsNode\nfrom cms.utils import get_template_from_request\nimport re\n\n# must...
python
chosen
[ { "from": "system", "value": "Add user manager to pass token tests\n" }, { "from": "human", "value": "from django.db import models\nfrom django.contrib.auth.models import AbstractBaseUser, PermissionsMixin\n\n\nclass User(AbstractBaseUser, PermissionsMixin):\n email = models.EmailField(unique...
python
chosen
[ { "from": "system", "value": "Add `get_enketo_survey_links` to mock backend\n" }, { "from": "human", "value": "#!/usr/bin/python\n# -*- coding: utf-8 -*-\n\nfrom base_backend import BaseDeploymentBackend\n\n\nclass MockDeploymentBackend(BaseDeploymentBackend):\n '''\n only used for unit te...
python
chosen
[ { "from": "system", "value": "Clean results task Health Check" }, { "from": "human", "value": "from django.conf import settings\n\nfrom health_check.backends import BaseHealthCheckBackend\nfrom health_check.exceptions import (\n ServiceReturnedUnexpectedResult, ServiceUnavailable\n)\n\nfrom ....
python
chosen
[ { "from": "system", "value": "Change doc setting for development." }, { "from": "human", "value": "\"\"\"\nFunctions that return external URLs, for example for the Vesper documentation.\n\"\"\"\n\n\nimport vesper.version as vesper_version\n\n\n_USE_LATEST_DOCUMENTATION_VERSION = False\n\"\"\"Set...
python
chosen
[ { "from": "system", "value": "[FIX] l10n_br_coa_generic: Use admin user to create COA\n" }, { "from": "human", "value": "# Copyright (C) 2020 - Gabriel Cardoso de Faria <gabriel.cardoso@kmee.com.br>\n# License AGPL-3 - See http://www.gnu.org/licenses/agpl-3.0.html\n\nfrom odoo import api, tools,...
python
chosen
[ { "from": "system", "value": "Rename AsyncSignal to CoroutineSignal for clarity of purpose\n" }, { "from": "human", "value": "from inspect import signature\n\nimport asyncio\n\nclass Signal(object):\n def __init__(self, parameters):\n self._parameters = frozenset(parameters)\n s...
python
chosen
[ { "from": "system", "value": "Increase max depth to 6\n\nAt 2, it only has enough depth to log in.\n" }, { "from": "human", "value": "# -*- coding: utf-8 -*-\n\"\"\"\nScrapy settings for a11y project\n\nFor simplicity, this file contains only settings considered important or\ncommonly used. You ...
python
chosen
[ { "from": "system", "value": "Add an error check to static copying\n" }, { "from": "human", "value": "from django.core.management.base import NoArgsCommand\nimport os\nimport shutil\n\nclass Command(NoArgsCommand):\n help = \"Copy the satchmo static directory and files to the local project.\"...
python
chosen
[ { "from": "system", "value": "Fix RemovedInDjango40Warning: The providing_args argument is deprecated. As it is purely documentational, it has no replacement\n" }, { "from": "human", "value": "import django.dispatch\n\nsaved_file = django.dispatch.Signal(providing_args=['fieldfile'])\n\"\"\"\nA ...
python
chosen
[ { "from": "system", "value": "Scale image only if necessary to avoid compression artefacts\n" }, { "from": "human", "value": "def crop_corners(image, box=None, **kwargs):\n \"\"\"\n Crop corners to the selection defined by image_cropping\n \"\"\"\n\n if box:\n values = [int(x)...
python
chosen
[ { "from": "system", "value": "Add integration test for Address model\n" }, { "from": "human", "value": "\"\"\"Unit test the farms models.\"\"\"\n\nfrom farms.factories import AddressFactory\n\nfrom mock import MagicMock\n\n\ndef test_address_factory_generates_valid_addresses_sort_of(mocker):\n ...
python
chosen
[ { "from": "system", "value": "Update test case for current state\n" }, { "from": "human", "value": "# encoding: utf-8\n\nfrom knesset.browser_test_case import BrowserTestCase, on_platforms\n\n# All browser test cases must inherit from BrowserTestCase which initializes the selenium framework\n# a...
python
chosen
[ { "from": "system", "value": "Add in dependency for flask cors" }, { "from": "human", "value": "from setuptools import find_packages, setup\n\nsetup(name=\"umaineapi_pinchangeserver\",\n version = \"0.1\",\n description = \"A service for connecting to myHousing using a Maine ID and \",...
python
chosen
[ { "from": "system", "value": "Fix the delay for subscription and unsubscription retry\n" }, { "from": "human", "value": "from celery.task import task\n\n\n@task\ndef subscribe(email, newsletter_list, lang=None, user=None):\n from courriers.backends import get_backend\n\n backend = get_back...
python
chosen
[ { "from": "system", "value": "Test how cut_by_number handles whitespace\n" }, { "from": "human", "value": "from lexos.processors.prepare.cutter import split_keep_whitespace, \\\n count_words, cut_by_number\n\n\nclass TestCutByNumbers:\n def test_split_keep_whitespace(self):\n assert...
python
chosen
[ { "from": "system", "value": "Add check for cookiecutter version - at least 1.3.0 is required now\n" }, { "from": "human", "value": "repo_name = '{{ cookiecutter.repo_name }}'\nassert_msg = 'Repo name should be valid Python identifier!'\n\nif hasattr(repo_name, 'isidentifier'):\n assert repo_...
python
chosen
[ { "from": "system", "value": "Make sure _set_lxd_dir_env is always called in monitor loop\n\nSigned-off-by: Adam Stokes <49c255c1d074742f60d19fdba5e2aa5a34add567@users.noreply.github.com>\n" }, { "from": "human", "value": "import asyncio\n\nfrom juju.utils import run_with_interrupt\n\nfrom conju...
python
chosen
[ { "from": "system", "value": "Define repr for Article model\n" }, { "from": "human", "value": "from sqlalchemy import Column, Integer, String, DateTime\nfrom sqlalchemy import create_engine\nfrom sqlalchemy.ext.declarative import declarative_base\nfrom sqlalchemy.orm import sessionmaker\n\nBase ...
python
chosen
[ { "from": "system", "value": "Add more complete flask.Response object as return object\n\nAlso, selects a couple of specific headers to pass along to Requests. To improve in the future :)" }, { "from": "human", "value": "from flask import Flask, request\nimport requests\napp = Flask(__name__)\nA...
python
chosen
[ { "from": "system", "value": "Use variable instead of concatenating string directly" }, { "from": "human", "value": "#!/usr/bin/python\nimport glob\nimport os\nimport subprocess\nimport sys\n\nfiles = sys.argv[1:] if len(sys.argv) > 1 else glob.glob('*')\nfor file in files:\n if os.path.isfil...
python
chosen
[ { "from": "system", "value": "Set up the basic parameters\n" }, { "from": "human", "value": "# Program by Ankur Gupta\n# www.github.com/agupta231\n# Jan 2017\n#\n#\n# Permission is hereby granted, free of charge, to any person obtaining a copy\n# of this software and associated documentation fil...
python
chosen
[ { "from": "system", "value": "Change sybase skip test to check for more restrictive vv creds\n\nThis should let the report-writing test that uses the axafvv query\nrun as jeanconn user, but skip for other users.\n" }, { "from": "human", "value": "# Licensed under a 3-clause BSD style license - s...
python
chosen
[ { "from": "system", "value": "Add docstrings to AssetHandler class\n" }, { "from": "human", "value": "from functools import wraps\n\n\nclass BaseAssetHandler(object):\n\n def __call__(self, asset):\n raise NotImplementedError\n\n @classmethod\n def as_handler(cls, **initkwargs):\...
python
chosen
[ { "from": "system", "value": "Extend samples table with new columns when amending.\n\nThis allows you to add phenotype fields to your samples after\nyou have already created the database.\n" }, { "from": "human", "value": "import GeminiQuery\nfrom gemini_subjects import get_subjects\nfrom ped im...
python
chosen
[ { "from": "system", "value": "Load current User model for customer email migration.\n" }, { "from": "human", "value": "# -*- coding: utf-8 -*-\n# Generated by Django 1.10.7 on 2017-04-13 17:57\nfrom __future__ import unicode_literals\n\nfrom django.db import migrations\n\n\ndef forwards_func(app...
python
chosen
[ { "from": "system", "value": "Remove debugging statement from CheckPermSetLicenses\n" }, { "from": "human", "value": "import json\nfrom cumulusci.tasks.salesforce import BaseSalesforceApiTask\n\n\nclass CheckPermSetLicenses(BaseSalesforceApiTask):\n task_options = {\n \"permission_sets...
python
chosen
[ { "from": "system", "value": "Add a load yaml helper\n" }, { "from": "human", "value": "import sys\nimport yaml\nimport click\n\n\ndef dump_yaml(obj):\n return yaml.dump(obj, default_flow_style=False)\n\n\ndef edit_yaml(content='', footer=''):\n MARKER = '# Everything below is ignored\\n\\...
python
chosen
[ { "from": "system", "value": "Change Parked state to something silly\n" }, { "from": "human", "value": "from . import PanState\n\n\"\"\" Parked State\n\nThe Parked state occurs in the following conditions:\n * Daytime\n * Bad Weather\n * System error\n\nAs such, the state needs to check...
python
chosen
[ { "from": "system", "value": "Update default value for backtesting clock\n" }, { "from": "human", "value": "import decimal\nfrom datetime import datetime\n\nimport click\n\nfrom .controller import Controller, SimulatedClock\nfrom .broker import OandaBacktestBroker\nfrom .instruments import Instr...
python
chosen
[ { "from": "system", "value": "ENH: Add lsmr to isolve module.\n" }, { "from": "human", "value": "\"Iterative Solvers for Sparse Linear Systems\"\n\n#from info import __doc__\nfrom iterative import *\nfrom minres import minres\nfrom lgmres import lgmres\nfrom lsqr import lsqr\n\n__all__ = filter(...
python
chosen
[ { "from": "human", "value": "Add test of export service\n" }, { "from": "gpt", "value": "from django.test import TestCase\nfrom django.contrib.auth.models import User\n\nfrom datastore import models, services\n\nclass ExportServiceTestCase(TestCase):\n\n def setUp(self):\n user = User....
python
chosen
[ { "from": "system", "value": "Revert \"Revert \"Adding ip interface facts\"\"\n" }, { "from": "human", "value": "#!/usr/bin/env python\n'''\nAutomatron: Fact Finder\n\nIdentify facts about a specified host\n\n * Hostname\n\n'''\n\n\nimport os\nimport json\n\n# pylint: disable=C0103\nsystem_info...
python
chosen
[ { "from": "system", "value": "Make sure powerline class knows that it will use UTF-8\n" }, { "from": "human", "value": "#!/usr/bin/env python\n# vim:fileencoding=utf-8:noet\nfrom __future__ import (unicode_literals, division, absolute_import, print_function)\n\nimport sys\nimport time\n\nfrom th...
python
chosen
[ { "from": "system", "value": "Add filter in design docs\n" }, { "from": "human", "value": "from ocds.storage.helpers import CouchView\n\n\nclass AllDocs(CouchView):\n\n design = 'docs'\n\n @staticmethod\n def map(doc):\n yield (doc['tenderID'], doc)\n\n\nclass DateView(CouchView)...
python
chosen
[ { "from": "system", "value": "Set up weather station to receive updates\n" }, { "from": "human", "value": "import datetime\nimport zmq\n\nfrom . import monitor\nfrom panoptes.utils import logger, config, messaging, threads\n\n\n@logger.has_logger\n@config.has_config\nclass WeatherStation(monitor...
python
chosen
[ { "from": "system", "value": "Handle both event instanciation from object and from serialized events\n" }, { "from": "human", "value": "from libs.services import Service\n\n\nclass EventService(Service):\n __all__ = ('record', 'setup')\n\n event_manager = None\n\n def can_handle(self, e...
python
chosen
[ { "from": "system", "value": "Add description where student should add logic\n" }, { "from": "human", "value": "#!/bin/python\n\n\ndef is_prime(integer):\n \"\"\"Determines weather integer is prime, returns a boolean value\"\"\"\n for i in range(2, integer):\n if integer % i == 0:\n...
python
chosen
[ { "from": "system", "value": "Sort room table by room name by default\n" }, { "from": "human", "value": "from web.blueprints.helpers.table import BootstrapTable, Column\n\n\nclass SiteTable(BootstrapTable):\n def __init__(self, *a, **kw):\n super().__init__(*a, columns=[\n C...
python
chosen
[ { "from": "system", "value": "Move import of Django's get_version into django-registration's get_version, to avoid dependency-order problems.\n" }, { "from": "human", "value": "from django.utils.version import get_version as django_get_version\n\n\nVERSION = (0, 9, 0, 'beta', 1)\n\n\ndef get_ver...
python
chosen
[ { "from": "system", "value": "Fix grammar in login error message\n" }, { "from": "human", "value": "from django.contrib.auth import authenticate\nfrom django.utils.translation import ugettext_lazy as _\n\nfrom rest_framework import serializers\n\n\nclass AuthTokenSerializer(serializers.Serialize...
python
chosen
[ { "from": "system", "value": "feat: Modify script which split your region in smaller sample\n" }, { "from": "human", "value": "#!/usr/bin/env python\n# -*- coding: utf-8 -*-\n\nimport xml.etree.ElementTree as ET # Use cElementTree or lxml if too slow\nimport os\n\nOSM_FILE = \"san-francisco-bay...
python
chosen
[ { "from": "system", "value": "Update library magic to be recursive\n" }, { "from": "human", "value": "import sys\nimport subprocess\nimport shutil\n\nexecutable = sys.argv[1]\nexecfolder = sys.argv[1].rsplit(\"/\",1)[0]\nlibdir = execfolder+\"/lib\"\notool_cmd = [\"otool\", \"-L\",executable]\n\...
python
chosen
[ { "from": "system", "value": "Add allow field to form\n" }, { "from": "human", "value": "from django import forms\n\n\nclass AllowForm(forms.Form):\n redirect_uri = forms.URLField(widget=forms.HiddenInput())\n scopes = forms.CharField(required=False, widget=forms.HiddenInput())\n client...
python
chosen
[ { "from": "system", "value": "Add db index on field tag name\n" }, { "from": "human", "value": "# -*- coding: utf-8 -*-\nfrom django.db import models\nfrom django.utils.translation import ugettext_lazy as _\nfrom django.template.defaultfilters import slugify\n\nfrom opps.core.models import Date,...
python
chosen
[ { "from": "system", "value": "lisa: Remove Python < 3.6 version check\n\nSince Python >= 3.6 is now mandatory, remove the check and the warning.\n" }, { "from": "human", "value": "#! /usr/bin/env python3\n\nimport warnings\nimport os\nimport sys\n\n\nfrom lisa.version import __version__\n\n# Rai...
python
chosen
[ { "from": "system", "value": "Remove py2 Ska.DBI assert in report test\n" }, { "from": "human", "value": "# Licensed under a 3-clause BSD style license - see LICENSE.rst\nimport tempfile\nimport os\nimport shutil\nimport pytest\n\nfrom .. import report\n\ntry:\n import Ska.DBI\n with Ska.D...
python
chosen
[ { "from": "system", "value": "Fix output of permissions import script\n" }, { "from": "human", "value": "#!/usr/bin/env python\n\n\"\"\"Import permissions, roles, and their relations from a TOML file.\n\n:Copyright: 2006-2021 Jochen Kupperschmidt\n:License: Revised BSD (see `LICENSE` file for de...
python
chosen
[ { "from": "system", "value": "Improve description about the api\n" }, { "from": "human", "value": "class Temperature(object):\n '''Temperature facade.\n Temperature sensor is used to measure the ambient room temperature in degrees Celsius\n With method `enable` you can turn on temperatu...
python
chosen
[ { "from": "system", "value": "Enable SSL verify for prod\n" }, { "from": "human", "value": "import os\nimport logging\n\nENV = os.getenv('PYTHONENV', 'prod')\n\nLOG_LEVEL = logging.DEBUG\nLOG_FORMAT = '%(asctime)s - %(levelname)s - %(message)s'\n\nHOST = 'localhost'\nPORT = 8080\n\nSSL_VERIFY = ...
python
chosen
[ { "from": "system", "value": "Fix a typo in the variable name\n" }, { "from": "human", "value": "from flaskext.login import current_user\n\n\ndef create(app=None):\n if current_user.is_authenticated():\n if current_user.admin is True:\n return True\n else:\n ...
python
chosen
[ { "from": "system", "value": "Add docstring to Button.time_held() method\n" }, { "from": "human", "value": "import time\n\n\nclass Button(object):\n \"\"\"Class representing keyboard keys.\"\"\"\n def __init__(self, game, number):\n self.game = game\n\n self.number = number\n...
python
chosen
[ { "from": "system", "value": "Put test stuff inside `if __name__ == '__main__'`\n" }, { "from": "human", "value": "import re\n\n_ansi_re = re.compile('\\033\\[((?:\\d|;)*)([a-zA-Z])')\n\n\ndef strip_ansi(value):\n return _ansi_re.sub('', value)\n\n\ndef len_exclude_ansi(value):\n return le...
python
chosen
[ { "from": "system", "value": "Revert \"Added a post view\"\n\nThis reverts commit b1063480e7b2e1128c457e9e65c52f742109d90d.\n" }, { "from": "human", "value": "from django.conf.urls import patterns, include, url\nfrom django.contrib import admin\nfrom django.conf import settings\n#from . import v...
python
chosen
[ { "from": "system", "value": "Update cached_function wrapper to set qualname instead of name\n" }, { "from": "human", "value": "# Various utility functions\nimport os\n\n\nSHOULD_CACHE = os.environ.get('ENV', 'development') == 'production'\n\n\ndef cached_function(func):\n data = {}\n\n de...
python
chosen
[ { "from": "system", "value": "Add and update tests for video renderer\n" }, { "from": "human", "value": "import pytest\n\nfrom mfr.core.provider import ProviderMetadata\n\nfrom mfr.extensions.video import VideoRenderer\n\n\n@pytest.fixture\ndef metadata():\n return ProviderMetadata('test', '....
python
chosen
[ { "from": "system", "value": "XDC: Add verbosity on JSON compare fail\n\nSigned-off-by: Tomasz Michalak <a2fdaa543b4cc5e3d6cd8672ec412c0eb393b86e@antmicro.com>\n" }, { "from": "human", "value": "#!/usr/bin/env python3\n\"\"\"\n\nThis script extracts the top module cells and their corresponding p...
python
chosen
[ { "from": "system", "value": "Fix site when logged in\n" }, { "from": "human", "value": "\nfrom extensions.models import ExtensionVersion\n\ndef n_unreviewed_extensions(request):\n if not request.user.has_perm(\"review.can-review-extensions\"):\n return dict()\n\n return dict(n_unre...
python
chosen
[ { "from": "system", "value": "Fix fatal error in data processing.\n\nThe wrong identifier was being used as the key to tell whether a propagandist\nhad been seen before in the dataset, leading to a completely, and incorrectly\ndisconnected graph.\n" }, { "from": "human", "value": "import bson.js...
python
chosen
[ { "from": "system", "value": "Use the correct variable for the test\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": "Raise explicit exception on no type match\n" }, { "from": "human", "value": "import datetime\nfrom dateutil import parser\nimport six\n\n\ndef normalize_time(t):\n try:\n if isinstance(t, datetime.datetime):\n return t\n elif isinstance(t...
python
chosen
[ { "from": "system", "value": "Remove random bit of code\n\nI have no idea what that is doing there. It is not called from\nwhat I can tell, and the tests work without it. And it makes no\nsense whatsoever, create a message each time you retrieve the\nconversation info??!?!?!\n" }, { "from": "human",...
python
chosen
[ { "from": "system", "value": "Fix args and return of CounterController functions\n\nEven though they're not used, functions to be wrapped by Methods have to\ntake arguments and return something (at least an empty dict).\n" }, { "from": "human", "value": "from malcolm.core.controller import Contr...
python
chosen
[ { "from": "system", "value": "Add url enter delete element on riak\n" }, { "from": "human", "value": "#!/usr/bin/env python\n# -*- coding: utf-8 -*-\nfrom .views import CubeHandler, ConnectionHandler\nfrom .views import ElementHandler, DashboardHandler, APIElementCubeHandler\n\n\nINCLUDE_URLS = ...
python
chosen
[ { "from": "system", "value": "Add autocommit to 1 to avoid select cache ¿WTF?\n" }, { "from": "human", "value": "import MySQLdb\n\nclass database(object):\n def __init__(self):\n config = {}\n execfile(\"config.py\",config)\n self.db = MySQLdb.connect(config[\"host\"],config[\"user\"],...
python
chosen
[ { "from": "system", "value": "Allow to reverse the order of the CSV for a proper reading\n" }, { "from": "human", "value": "import csv\n\nfrom money.models import Movement\n\n\ndef parse_csv(raw_csv, parser, header_lines=0):\n\treader = csv.reader(raw_csv, delimiter=',', quotechar='\"')\n\trows ...
python
chosen
[ { "from": "system", "value": "Add other needed method stubs\n" }, { "from": "human", "value": "import pandas\n\ndef load_excel(filepath):\n \"\"\"\n Returns a Pandas datafile that contains the contents of a Microsoft Excel\n Spreadsheet\n\n Params:\n filepath - A string contai...
python
chosen
[ { "from": "system", "value": "Update function name used in the streamtester\n" }, { "from": "human", "value": "\"\"\"\nThis file defines a general method for evaluating ftfy using data that arrives\nin a stream. A concrete implementation of it is found in `twitter_tester.py`.\n\"\"\"\nfrom __fut...
python
chosen
[ { "from": "system", "value": "Configure max build age on the monitoring side\n" }, { "from": "human", "value": "import datetime\nfrom urlparse import urljoin\nimport requests\n\n# project\nfrom checks import AgentCheck\n\nclass Veneur(AgentCheck):\n\n VERSION_METRIC_NAME = 'veneur.deployed_ve...
python
chosen
[ { "from": "system", "value": "Add id of node generating the supervisor event\n" }, { "from": "human", "value": "#!/usr/bin/env python\n\nimport json\nimport sys\n\nfrom utils import serf_event\n\n\ndef write_stdout(s):\n sys.stdout.write(s)\n sys.stdout.flush()\n\ndef write_stderr(s):\n ...
python
chosen