conversations
listlengths
2
3
source
stringclasses
1 value
stack
stringclasses
1 value
[ { "from": "system", "value": "Allow javerage to persist as the user if debug is on, otherwise use request.user - allows this to work behind pubcookie/other auth\n\n" }, { "from": "human", "value": "from django.http import HttpResponseRedirect, HttpResponse\nfrom django.shortcuts import get_objec...
python
chosen
[ { "from": "system", "value": "Fix server error in tag search for non-existing tag.\n" }, { "from": "human", "value": "# -*- coding: utf8 -*-\n\nfrom __future__ import unicode_literals\nfrom __future__ import absolute_import\n\nfrom django import template\nfrom django.db.models.loading import get...
python
chosen
[ { "from": "system", "value": "Use pathlib to read ext.conf\n" }, { "from": "human", "value": "import os\n\nfrom mopidy import config, exceptions, ext\n\n__version__ = \"1.2.2\"\n\n\nclass Extension(ext.Extension):\n\n dist_name = \"Mopidy-dLeyna\"\n ext_name = \"dleyna\"\n version = __v...
python
chosen
[ { "from": "system", "value": "Remove superfluous override of 'get_playlist'.\n" }, { "from": "human", "value": "import logging\nimport pandora\n\nlogger = logging.getLogger(__name__)\n\n\nclass MopidyPandoraAPIClient(pandora.APIClient):\n \"\"\"Pydora API Client for Mopidy-Pandora\n\n This...
python
chosen
[ { "from": "system", "value": "Fix a link in index_entity's docstring\n" }, { "from": "human", "value": "from . import querying\nfrom logging import getLogger\n\n\nlogger = getLogger(\"sir\")\n\n\ndef index_entity(solr_connection, query, search_entity):\n \"\"\"\n Indexes a single entity ty...
python
chosen
[ { "from": "system", "value": "TST: Make nb_tests for bayesian optional because PyMC3 is not a hard dependency\n" }, { "from": "human", "value": "#!/usr/bin/env python\n\"\"\"\nsimple example script for running notebooks and reporting exceptions.\nUsage: `checkipnb.py foo.ipynb [bar.ipynb [...]]`...
python
chosen
[ { "from": "system", "value": "Use a separate lock path\n" }, { "from": "human", "value": "from subprocess import getoutput\nfrom random import randrange\nfrom filelock import FileLock\n\nDICT_PATH = './dict.txt'\n\nOOPS_SEEK_TOO_FAR = 48\n\nDICT_LENGTH = 61973\n\n\n# don't run on OS X\ndef rando...
python
chosen
[ { "from": "system", "value": "Add local api_client dependency to playout\n" }, { "from": "human", "value": "import os\n\nfrom setuptools import setup\n\n# Change directory since setuptools uses relative paths\nos.chdir(os.path.dirname(os.path.realpath(__file__)))\n\nsetup(\n name=\"airtime-pl...
python
chosen
[ { "from": "system", "value": "Fix bug with ics url format with latest vobject version\n" }, { "from": "human", "value": "import logging\nimport caldav\nfrom dateutil.relativedelta import relativedelta\n\nlog = logging.getLogger(__file__)\n\n\ndef addToCal(url, date_from, date_end, summary):\n ...
python
chosen
[ { "from": "system", "value": "Add ~/.python to PYTHONPATH and import rc\n" }, { "from": "human", "value": "import vx\n\nimport math\nfrom sys import argv\n\n_tick_functions = []\ndef _register_tick_function(f, front=False):\n if front:\n _tick_functions.insert(0, f)\n else:\n ...
python
chosen
[ { "from": "system", "value": "Add failing tests for type equality\n" }, { "from": "human", "value": "from unittest import TestCase, skip\n\nfrom polygraph.exceptions import PolygraphValueError\nfrom polygraph.types.basic_type import Union\nfrom polygraph.types.scalar import Float, Int, String\n\...
python
chosen
[ { "from": "system", "value": "Add tests for parsing percentages\n" }, { "from": "human", "value": "#!/usr/bin/env python3\n\nimport pytest\nimport sys\n\n# This line allows the tests to run if you just naively run this script.\n# But the preferred way is to use run_tests.sh\nsys.path.insert(0,'....
python
chosen
[ { "from": "system", "value": "Add logging and increase timeout" }, { "from": "human", "value": "from multiprocessing import Process\nfrom time import sleep\nfrom socket import socket\n\nimport requests\n\nfrom django.core.management import call_command\nfrom django.core.management.commands.runse...
python
chosen
[ { "from": "system", "value": "Make HTTPExceptions return errors for /api calls\n\n" }, { "from": "human", "value": "from aiohttp import web\nfrom mako.template import Template\n\nfrom virtool.utils import get_static_hash\n\n\ntemplate_500 = Template(filename=\"virtool/templates/error_500.html\")...
python
chosen
[ { "from": "system", "value": "Update 2to3 output to use string substitution.\n" }, { "from": "human", "value": "def output(arg):\n print(\"MANUAL: arg=\", arg)\n\n\ndef main():\n for abc in range(10):\n import ipdb; ipdb.set_trace()\n output(abc)\n\n\n# code to test with nose...
python
chosen
[ { "from": "system", "value": "[Telemetry] Enable sandbox on OS X page cyclers\n\nThe sandbox is disabled when running the page cyclers because it interferes with collecting IO stats on some platforms.\n\nThe sandbox does not interfere with IO stat collection on OS X..\n\nBUG=361049\n\nReview URL: https://co...
python
chosen
[ { "from": "system", "value": "Switch from auto_now_add=True to default=now\n\nThis allows for optional direct setting of the timestamp, eg when loading fixtures." }, { "from": "human", "value": "from __future__ import unicode_literals\n\nfrom django.conf import settings\nfrom django.contrib.cont...
python
chosen
[ { "from": "system", "value": "Use from .. import (...) parens\n" }, { "from": "human", "value": "\"\"\"Distributed Task Queue\"\"\"\nfrom celery.distmeta import __version__, __author__, __contact__\nfrom celery.distmeta import __homepage__, __docformat__\nfrom celery.distmeta import VERSION, is_...
python
chosen
[ { "from": "system", "value": "Add connection string for connecting to virtool database in order to create a test database\n" }, { "from": "human", "value": "import pytest\n\nfrom sqlalchemy import text\nfrom sqlalchemy.exc import ProgrammingError\nfrom sqlalchemy.ext.asyncio import create_async_...
python
chosen
[ { "from": "system", "value": "Add documentation to the default view" }, { "from": "human", "value": "from django.http import Http404\nfrom django.shortcuts import get_object_or_404\nfrom django.contrib.sites.models import SITE_CACHE\n\nfrom pages import settings\nfrom pages.models import Page, C...
python
chosen
[ { "from": "system", "value": "Use testtools as test base class.\n\nOn the path to testr migration, we need to replace the unittest base classes\nwith testtools.\nReplace tearDown with addCleanup, addCleanup is more resilient than tearDown.\nThe fixtures library has excellent support for managing and cleanin...
python
chosen
[ { "from": "system", "value": "Replace non-ASCII character in comment\n" }, { "from": "human", "value": "from django.contrib.admin import ModelAdmin\nfrom django.core.exceptions import PermissionDenied\nfrom django.views.decorators.clickjacking import xframe_options_exempt\nfrom django.views.gene...
python
chosen
[ { "from": "system", "value": "Fix calling pathway commons client in biopax api\n" }, { "from": "human", "value": "import sys\n\nfrom processor import BiopaxProcessor\n\nfrom indra.java_vm import autoclass, JavaException\nfrom indra.biopax import pathway_commons_client as pcc\n\ndef process_pc_ne...
python
chosen
[ { "from": "system", "value": "Use list comprehension instead of lambda function\n" }, { "from": "human", "value": "try:\n import mpmath as mp\nexcept ImportError:\n pass\n\ntry:\n from sympy.abc import x # type: ignore[import]\nexcept ImportError:\n pass\n\n\ndef lagrange_inversion(...
python
chosen
[ { "from": "system", "value": "Fix renaming of jasy.asset.Manager2 to jasy.asset.Manager\n" }, { "from": "human", "value": "import konstrukteur.Konstrukteur\nimport jasy.asset.Manager2 as AssetManager\n\n@task\ndef build(regenerate = False):\n\t\"\"\"Generate source (development) version\"\"\"\n\...
python
chosen
[ { "from": "system", "value": "Fix Two Bugs for MidRand\n" }, { "from": "human", "value": "from random import shuffle\n\ndef midrand(sentence):\n words = sentence.split()\n newwords = [randomized(word) for word in words]\n newsentence = ' '.join(newwords)\n if sentence == newsentence:...
python
chosen
[ { "from": "system", "value": "Load mock module from mock package instead of unittest to support Python prior to 3.3\n" }, { "from": "human", "value": "from unittest.mock import call\n\n\ndef calls_from(list_args):\n return [call(*args) for args in list_args]\n" }, { "from": "gpt", ...
python
chosen
[ { "from": "system", "value": "Allow control of response type for failing permit check\n" }, { "from": "human", "value": "from __future__ import unicode_literals\n\n# Authentication and Authorisation\nfrom functools import wraps\n\nfrom . import http\n\n\ndef permit(test_func):\n '''Decorate a...
python
chosen
[ { "from": "system", "value": "Add missing properties to pass through to the proxied repository.\n" }, { "from": "human", "value": "# coding: utf-8\nfrom __future__ import (absolute_import, division, print_function,\n unicode_literals)\n\nfrom .base import BaseRepository\n\...
python
chosen
[ { "from": "system", "value": "Implement truncate() method for Manager and in_batches() method for QuerySet\n" }, { "from": "human", "value": "# -*- coding:utf-8 -*-\n\nfrom django import template\n\ntemplate.add_to_builtins('yepes.defaultfilters')\ntemplate.add_to_builtins('yepes.defaulttags')\n...
python
chosen
[ { "from": "system", "value": "Remove colorama and update the logger interface\n" }, { "from": "human", "value": "\"\"\"Main function\n\nCopyright (c) 2015 Francesco Montesano\nMIT Licence\n\"\"\"\n\nimport os\nimport sys\n\nimport colorama\n\nfrom dodocs.cmdline import parse\nfrom dodocs.logger ...
python
chosen
[ { "from": "system", "value": "Fix to unicode problem in 3.2\n" }, { "from": "human", "value": "import datetime, json\nfrom sqlalchemy import (\n Column,\n Integer,\n Text,\n DateTime,\n ForeignKey,\n )\n\nfrom sqlalchemy.ext.declarative import declarative_base\n\nfrom sqlalchem...
python
chosen
[ { "from": "system", "value": "Add test case for “/“ " }, { "from": "human", "value": "from farmfs.fs import normpath as _normalize\nfrom farmfs.fs import userPath2Path as up2p\nfrom farmfs.fs import Path\n\ndef test_normalize_abs():\n assert _normalize(\"/\") == \"/\"\n assert _normalize...
python
chosen
[ { "from": "system", "value": "Siggen: Tidy up basic siggen example\n" }, { "from": "human", "value": "from pymoku import Moku, ValueOutOfRangeException\nfrom pymoku.instruments import *\nimport time, logging\n\nimport matplotlib\nimport matplotlib.pyplot as plt\n\nlogging.basicConfig(format='%(a...
python
chosen
[ { "from": "system", "value": "Add alt_text field for Media\n\n" }, { "from": "human", "value": "# Tweepy\n# Copyright 2009-2021 Joshua Roesslein\n# See LICENSE for details.\n\nfrom tweepy.mixins import DataMapping\n\n\nclass Media(DataMapping):\n\n __slots__ = (\n \"data\", \"media_key...
python
chosen
[ { "from": "system", "value": "fix(macro): Delete the desks settings for macro\n" }, { "from": "human", "value": "# -*- coding: utf-8; -*-\n#\n# This file is part of Superdesk.\n#\n# Copyright 2013, 2014 Sourcefabric z.u. and contributors.\n#\n# For the full copyright and license information, ple...
python
chosen
[ { "from": "system", "value": "Use None instead of 'none' for qt backend\n" }, { "from": "human", "value": "import os\nimport warnings\n\nqt_api = os.environ.get('QT_API')\n\nif qt_api is None:\n try:\n import PySide\n qt_api = 'pyside'\n except ImportError:\n try:\n ...
python
chosen
[ { "from": "system", "value": "Remove the broken translations extension autodetection\n" }, { "from": "human", "value": "from django.contrib import admin\nfrom django.utils.translation import ugettext_lazy as _\n\nfrom elephantblog.models import Entry, EntryAdmin, Category, CategoryTranslation\n\...
python
chosen
[ { "from": "system", "value": "Remove the dependecy of QtGui from a test located in QtNetwork.\n" }, { "from": "human", "value": "import unittest\n\nfrom PySide.QtCore import *\nfrom PySide.QtNetwork import *\n\nfrom helper import UsesQApplication\nfrom httpd import TestServer\n\nclass testAuthe...
python
chosen
[ { "from": "system", "value": "Load app configs for Slacker\n" }, { "from": "human", "value": "\"\"\"\n flask_slacker\n ~~~~~~~~~~~~~\n\n A Flask extension for using Slacker.\n\n :copyright: (c) 2017 Matheus Rosa\n :license: MIT, see LICENSE for more details.\n\"\"\"\nfrom slacker ...
python
chosen
[ { "from": "system", "value": "Change widget to Bootstrap form" }, { "from": "human", "value": "from django import forms\nfrom django.core.urlresolvers import reverse\nfrom django.utils.safestring import mark_safe\n\n\nclass EmailInput(forms.TextInput):\n input_type = 'email'\n\n\nclass DateIn...
python
chosen
[ { "from": "system", "value": "Add restrictioins for who can edit the project and who cannot\n" }, { "from": "human", "value": "from django.contrib.auth.decorators import login_required\nfrom django.shortcuts import render\n\nfrom .models import Project\nfrom .forms import ProjectForm\n\n\n@login...
python
chosen
[ { "from": "system", "value": "Fix Share page permission migration\n" }, { "from": "human", "value": "# -*- coding: utf-8 -*-\nfrom __future__ import unicode_literals\n\nfrom django.db import migrations\n\n\ndef create_share_permissions(apps, schema_editor):\n ContentType = apps.get_model('con...
python
chosen
[ { "from": "system", "value": "Add `clowder stash` logic to Cement controller\n" }, { "from": "human", "value": "from cement.ext.ext_argparse import expose\n\nfrom clowder.cli.abstract_base_controller import AbstractBaseController\n\n\nclass StashController(AbstractBaseController):\n class Met...
python
chosen
[ { "from": "system", "value": "Add concat filter to fix issue with jquery-pjax\n\njquery-pjax makes use of IIFEs but does not terminate its last statement with a\nsemicolon, causing syntax errors after asset concatenation. See also:\nhttps://github.com/miracle2k/webassets/issues/100#issuecomment-388461033\n"...
python
chosen
[ { "from": "system", "value": "Change the golden output so that merely evaluating an existing persistent variable\ndoes not result in a newly created persistent variable. The old one is returned,\ninstead.\n\n\ngit-svn-id: b33bab8abb5b18c12ee100cd7761ab452d00b2b0@121775 91177308-0d34-0410-b5e6-96231b3b80d8\...
python
chosen
[ { "from": "system", "value": "Fix test to have less random result\n" }, { "from": "human", "value": "#from http://rosettacode.org/wiki/Average_loop_length#Python\n#pythran export analytical(int)\n#pythran export testing(int, int)\n#runas analytical(10)\n#runas testing(10, 100)\n\n#from __future_...
python
chosen
[ { "from": "system", "value": "Update function to get player stats using base_url\n" }, { "from": "human", "value": "import json\nimport csv\nimport requests\nimport secret\n\nbase_url = https://www.mysportsfeeds.com/api/feed/pull/nfl/2016-2017-regular/\n\n\ndef main():\n division_standings()\...
python
chosen
[ { "from": "system", "value": "Clean up core static context processor" }, { "from": "human", "value": "from django.conf import settings\n\ndef static(request):\n \"\"\"Provides a context variable that differentiates between the base\n JavaScript URL when in debug mode vs. not.\n \"\"\"\n...
python
chosen
[ { "from": "system", "value": "Switch pytest fixture to function scope\n\nStill use the class's get_data method for fixture data\n" }, { "from": "human", "value": "# coding: utf-8\n\nfrom __future__ import absolute_import, division, print_function, unicode_literals\n\nimport pytest\nimport rethin...
python
chosen
[ { "from": "system", "value": "Change output data structure to support faster rsync\n" }, { "from": "human", "value": "import numpy as np\nimport os\nimport glob\nimport mdtraj as md\nimport fahmunge\nimport pandas as pd\n\nprojects = pd.read_csv(\"./projects.csv\", index_col=0)\noutput_path = \"...
python
chosen
[ { "from": "system", "value": "Add encoding parameter to open jsonld\n" }, { "from": "human", "value": "__all__ = ['process_jsonld_file', 'process_jsonld']\n\nimport json\nimport logging\nfrom indra.sources.hume import processor\n\nlogger = logging.getLogger(__name__)\n\n\ndef process_jsonld_file...
python
chosen
[ { "from": "system", "value": "ENH: Add a tester to the scikit.\n" }, { "from": "human", "value": "\"\"\"\nMachine Learning module in python\n=================================\n\nscikits.learn is a Python module integrating classique machine\nlearning algorithms in the tightly-nit world of scient...
python
chosen
[ { "from": "system", "value": "Check for p = 0.00\n\n#149\n" }, { "from": "human", "value": "# -*- coding: utf-8 -*-\n\"\"\"Psychological and psychiatric terms to avoid.\n\n---\nlayout: post\nsource: Scott O. Lilienfeld, et al.\nsource_url: http://dx.doi.org/10.3389/fpsyg.2015.01100\ntitl...
python
chosen
[ { "from": "system", "value": "Add condition to check if experiment group exists before checking status\n" }, { "from": "human", "value": "import logging\n\nfrom db.models.experiment_groups import ExperimentGroup\n\n_logger = logging.getLogger('polyaxon.db')\n\n\ndef get_valid_experiment_group(ex...
python
chosen
[ { "from": "system", "value": "Simplify Settings code a little bit\n\n- Fixes error 500 on homepage with clean database\n" }, { "from": "human", "value": "from django.utils import timezone\n\nfrom settings.models import Setting\nfrom utils.dates import string_to_datetime\n\n\nclass Settings:\n ...
python
chosen
[ { "from": "system", "value": "Add save xml name argument to TRIPS API\n" }, { "from": "human", "value": "import sys\nimport trips_client\nfrom processor import TripsProcessor\n\n\ndef process_text(text):\n html = trips_client.send_query(text)\n xml = trips_client.get_xml(html)\n trips_c...
python
chosen
[ { "from": "system", "value": "Exclude most fields from User Profiles\n" }, { "from": "human", "value": "from django.forms import ModelForm\n\nfrom localflavor.gb.forms import GBPostcodeField\n\nfrom .models import Member\n\nclass MemberUpdateForm(ModelForm):\n class Meta:\n model = Mem...
python
chosen
[ { "from": "system", "value": "Add a helper to detect the architecture.\n" }, { "from": "human", "value": "from fabric.api import run, quiet\nfrom braid import succeeds, cacheInEnvironment\n\n@cacheInEnvironment\ndef distroName():\n \"\"\"\n Get the name of the distro.\n \"\"\"\n with...
python
chosen
[ { "from": "system", "value": "Remove transport from handler methods\n" }, { "from": "human", "value": "class BaseTransport(object):\n \"\"\"Base transport class.\"\"\"\n\n def __init__(self, name, data_format_class, data_format_options,\n handler_class, handler_options):\n ...
python
chosen
[ { "from": "system", "value": "Remove unecessary initialization from Route model\n" }, { "from": "human", "value": "from app import db\n\n\nclass Base(db.Model):\n\n __abstract__ = True\n\n id = db.Column(db.Integer, primary_key=True)\n created_at = db.Column(db.DateTime, default=db.func...
python
chosen
[ { "from": "system", "value": "Mark things to clean up later in global import" }, { "from": "human", "value": "from core.misc import get_scons_path, get_scons_build_dir, \\\n get_scons_configres_dir, get_scons_configres_filename\n\nfrom core.numpyenv import GetNumpyEnvironmen...
python
chosen
[ { "from": "system", "value": "Check email address is not already used.\n\nSigned-off-by: Chris Lamb <29e6d179a8d73471df7861382db6dd7e64138033@debian.org>\n" }, { "from": "human", "value": "from django import forms\nfrom django.contrib.auth.models import User\n\nfrom librement.profile.enums impor...
python
chosen
[ { "from": "system", "value": "Fix import errors on non-RPi platforms\n" }, { "from": "human", "value": "\"\"\"\nObject oriented wrapper around RPi.GPIO. Falls back to mock objects if RPi.GPIO\nis not found.\n\"\"\"\n\ntry:\n import RPi.GPIO\n from .raspberry_pi import *\nexcept RuntimeErro...
python
chosen
[ { "from": "system", "value": "Fix OSError not printing bug\n" }, { "from": "human", "value": "# Copyright (c) 2017 The Regents of the University of Michigan\n# All rights reserved.\n# This software is licensed under the BSD 3-Clause License.\nfrom ..core.errors import Error\n\n\nclass WorkspaceE...
python
chosen
[ { "from": "system", "value": "Change desustorage URL to desuarchive\n" }, { "from": "human", "value": "# 4chThreadArchiver\n# Copyright (C) 2016, Sebastian \"Chloride Cull\" Johansson\n# \n# This program is free software: you can redistribute it and/or modify\n# it under the terms of the GNU Aff...
python
chosen
[ { "from": "system", "value": "Add support for basic binary operations\n" }, { "from": "human", "value": "\noperators = {'+', '-', '*', '/', '(', ')'}\n\n\ndef parse_formula(text):\n\n tokens = []\n buffer = ''\n\n for c in text:\n if '0' <= c <= '9':\n buffer += c\n ...
python
chosen
[ { "from": "system", "value": "Use `glob` to find an appropriate serial ttry" }, { "from": "human", "value": "\nimport serial\nimport sonic\n\n\nsonic_pi = sonic.SonicPi()\nconnection = serial.Serial('/dev/tty.usbmodem1421', 115200)\n\nwhile True:\n line = connection.readline()\n command, a...
python
chosen
[ { "from": "system", "value": "Test updated to work with Python 2.6\n" }, { "from": "human", "value": "import unittest\nfrom porunga import get_manager\nfrom porunga.commands.test import PorungaTestCommand\n\n\nclass TestManager(unittest.TestCase):\n\n def test_manager_has_proper_commands(self...
python
chosen
[ { "from": "system", "value": "Add the new schema, now the $set modifier is used\n" }, { "from": "human", "value": "from eduid_am.exceptions import UserDoesNotExist\n\n\ndef attribute_fetcher(db, user_id):\n attributes = {}\n\n user = db.profiles.find_one({'_id': user_id})\n if user is N...
python
chosen
[ { "from": "system", "value": "Fix to work in python 3.\n" }, { "from": "human", "value": "\"\"\"Clone an entire GitHub organization.\"\"\"\n\nimport os.path\n\nimport click\nfrom git.repo.base import Repo\n\nfrom edx_repo_tools.auth import pass_github\n\n\n@click.command()\n@click.option(\n '...
python
chosen
[ { "from": "system", "value": "Make test work for Python 2.7\n" }, { "from": "human", "value": "import pytest\n\nfrom ...language import Language\n\ndef test_issue1380_empty_string():\n nlp = Language()\n doc = nlp('')\n assert len(doc) == 0\n\n@pytest.mark.models('en')\ndef test_issue13...
python
chosen
[ { "from": "system", "value": "Allow site_media/media to be served by staticfiles\n" }, { "from": "human", "value": "from django.conf import settings\nfrom django.conf.urls.defaults import *\nfrom django.views.generic.simple import direct_to_template\n\nfrom django.contrib import admin\nadmin.aut...
python
chosen
[ { "from": "system", "value": "Add todo to fix randomness\n" }, { "from": "human", "value": "from factory import fuzzy\n\nfrom users.tests.factories import UserFactory\n\n\nRANDOM_SEED = 1024\n\n\ndef create_profiles(num_profiles):\n fuzzy.reseed_random(RANDOM_SEED)\n return [user.profile\n...
python
chosen
[ { "from": "system", "value": "Add parse_files method to loop through a bunch of files\n" }, { "from": "human", "value": "# torque_accounting.py\n# Functions for working with Torque accounting files\n\ndef parse_line(line):\n event = line.split(';')\n job_name = event[2]\n event_type =...
python
chosen
[ { "from": "system", "value": "Print devices example - change out format\n" }, { "from": "human", "value": "# import PyOpenCL and Numpy. An OpenCL-enabled GPU is not required,\n# OpenCL kernels can be compiled on most CPUs thanks to the Intel SDK for OpenCL\n# or the AMD APP SDK.\nimport pyopencl...
python
chosen
[ { "from": "system", "value": "Change version number to 0.2.2.\n" }, { "from": "human", "value": "# -*- coding: utf-8 -*-\n\n# (c) 2017-2019, ETH Zurich, Institut fuer Theoretische Physik\n# Author: Dominik Gresch <greschd@gmx.ch>\n\"\"\"\nA tool for modifying, comparing and plotting electronic b...
python
chosen
[ { "from": "system", "value": "Fix benchmarks vs. changes in b1cc0a9aa5107\n" }, { "from": "human", "value": "try:\n from asv import step_detect\nexcept ImportError:\n pass\n\n\nclass Simple:\n def setup(self):\n self.y = ([1]*20 + [2]*30)*50\n\n def time_detect_regressions(sel...
python
chosen
[ { "from": "system", "value": "Fix for empty reference bug\n" }, { "from": "human", "value": "# -*- coding: utf-8 -*-\nfrom baluhn import generate as baluhn_generate, verify as baluhn_verify\nfrom django.conf import settings\n\n\ndef generate(reference, check_length=settings.INVAR_OCR_CHECK_LENGT...
python
chosen
[ { "from": "system", "value": "Revert \"Make App a context manager\"\n" }, { "from": "human", "value": "\"\"\"\n Python wrapper for libui.\n\n\"\"\"\n\nfrom . import libui\n\n\nclass App:\n\n def __init__(self):\n \"\"\"\n Creates a new pylibui app.\n\n \"\"\"\n opt...
python
chosen
[ { "from": "system", "value": "Call sys.exit when pkg-config fails\n" }, { "from": "human", "value": "#!/usr/bin/env python\n\nfrom setuptools import setup, Extension\nimport string\nimport sys\nimport os\n\nsys.path.append('./test')\n\nwith open(\"README.md\") as f:\n long_description = f.rea...
python
chosen
[ { "from": "system", "value": "Fix Jenkins tests when no user is set\n" }, { "from": "human", "value": "from os import environ as env\n\nfrom django.conf import settings\nimport requests\nfrom datetime import datetime\nfrom django.utils import timezone\nfrom celery.utils.log import get_task_logge...
python
chosen
[ { "from": "system", "value": "Define initializers before use them\n" }, { "from": "human", "value": "from Recorders import Recorder, PrintRecorder, FileRecorder\n\nfactory = dict([\n ('print', create_print_recorder),\n ('file', create_file_recorder)])\n\ndef create_recorder(config):\n r...
python
chosen
[ { "from": "system", "value": "Add tests for unset installation dirs\n" }, { "from": "human", "value": "from .common import BuiltinTest\n\nfrom bfg9000.builtins import default, install # noqa\nfrom bfg9000 import file_types\nfrom bfg9000.path import Path, Root\n\n\nclass TestInstall(BuiltinTest)...
python
chosen
[ { "from": "system", "value": "Add tests for source and min_zoom\n" }, { "from": "human", "value": "# https://www.openstreetmap.org/way/147689077\n# Apple Store, SF\nassert_has_feature(\n 15, 5242, 12664, 'pois',\n { 'id': 147689077, 'min_zoom': 15.68 })\n" }, { "from": "gpt", "...
python
chosen
[ { "from": "system", "value": "Correct set policy on bag.\n\nHad been missing create constraint.\n" }, { "from": "human", "value": "\nstore_contents = {}\nstore_structure = {}\n\nstore_contents['_default_errors'] = [\n 'src/_errors/index.recipe',\n ]\n\nstore_structure['recipes'] = ...
python
chosen
[ { "from": "system", "value": "Reduce log spam from diesel.\n" }, { "from": "human", "value": "import diesel\nfrom aspen.server import BaseEngine\nfrom diesel.protocols import wsgi\n\n\nclass Engine(BaseEngine):\n\n app = None # a diesel app instance\n\n def bind(self):\n self.app = ...
python
chosen
[ { "from": "system", "value": "Fix trust stores paths for py2exe builds\n" }, { "from": "human", "value": "#!/usr/bin/env python\n# C:\\Python27_32\\python.exe setup_py2exe.py py2exe\nfrom distutils.core import setup\nfrom glob import glob\n\nimport os\nimport py2exe\nfrom setup import SSLYZE_SET...
python
chosen
[ { "from": "system", "value": "Convert some skips to expected failures.\n" }, { "from": "human", "value": "import unittest\n\nfrom ..utils import TranspileTestCase\n\n\nclass SequenceTests(TranspileTestCase):\n def test_unpack_sequence(self):\n self.assertCodeExecution(\"\"\"\n ...
python
chosen
[ { "from": "system", "value": "Remove pytest flag for xfails\n" }, { "from": "human", "value": "import pytest\nfrom os.path import abspath, basename, dirname, join\nimport subprocess\nimport glob\nimport sys\n\n\ncwd = abspath(dirname(__file__))\nexamples_dir = join(cwd, \"..\", \"..\", \"example...
python
chosen
[ { "from": "system", "value": "Change 'language' to 'syntax', that is more precise terminology.\n" }, { "from": "human", "value": "#\n# linter.py\n# Linter for SublimeLinter3, a code checking framework for Sublime Text 3\n#\n# Written by Aparajita Fishman\n# Copyright (c) 2013 Aparajita Fishman\n...
python
chosen
[ { "from": "system", "value": "Refactor adding temp to permutations\n" }, { "from": "human", "value": "\"\"\"Leetcode 46. Permutations\nMedium\n\nURL: https://leetcode.com/problems/permutations/\n\nGiven a collection of distinct integers, return all possible permutations.\n\nExample:\nInput: [1,2...
python
chosen
[ { "from": "system", "value": "Address execve protection fault in Octave autoconfig\n\n`octave-cli` is what we really want\n" }, { "from": "human", "value": "from .base_executor import ScriptExecutor\n\n\nclass Executor(ScriptExecutor):\n ext = '.m'\n name = 'OCTAVE'\n command = 'octave'...
python
chosen
[ { "from": "system", "value": "Change to 20 records at a time instead of 50.\n\ngit-svn-id: 062a66634e56759c7c3cc44955c32d2ce0012d25@256 c02d1e6f-6a35-45f2-ab14-3b6f79a691ff\n" }, { "from": "human", "value": "from google.appengine.ext import db\n\ndef update_context_indexes(start_key = None):\n ...
python
chosen
[ { "from": "system", "value": "Kickass: Remove ? from show title when searching\n" }, { "from": "human", "value": "import cache\nimport network\nimport scraper\nimport urllib\n\nKICKASS_URL = 'http://kickass.so'\n\n################################################################################\n...
python
chosen
[ { "from": "system", "value": "Test extension's parameter access for a given period\n" }, { "from": "human", "value": "from __future__ import unicode_literals, print_function, division, absolute_import\nfrom nose.tools import raises\n\nfrom openfisca_core.parameters import ParameterNode\nfrom ope...
python
chosen
[ { "from": "system", "value": "Refactor API testing script to be consistent with Travis build\n\nSigned-off-by: Carter Landis <ffc486ac0b21a34cfd7d1170183ed86b0f1b04a2@gmail.com>\n" }, { "from": "human", "value": "import time\nimport subprocess\nimport pytest\nimport sys\n\nSOURCE = \"**\"\nif le...
python
chosen
[ { "from": "system", "value": "Correct get_uptime function. It didn't extract the uptime correctly. Now it does.\n" }, { "from": "human", "value": "#!/bin/python3\n\"\"\" This script contains functions to access various system's info.\n\n Author: Julien Delplanque\n\"\"\"\nimport subprocess\n\...
python
chosen
[ { "from": "system", "value": "Change binary benchmark to loop forever too\n" }, { "from": "human", "value": "import socket\nimport time\nimport random\nimport struct\n\nNUM = 1024 * 1024 * 4\nKEYS = [\"test\", \"foobar\", \"zipzap\"]\nVALS = [32, 100, 82, 101, 5, 6, 42, 73]\n\nBINARY_HEADER = st...
python
chosen
[ { "from": "system", "value": "[GitHub] Use correct URL for API\n" }, { "from": "human", "value": "import os\nimport urllib\nimport requests\n\n\nGITHUB_BASE_URI = os.environ.get('GITHUB_BASE_URI', 'https://github.com')\nGITHUB_API_BASE_URI = os.environ.get('GITHUB_API_BASE_URI', 'https://api.git...
python
chosen