conversations
listlengths
2
3
source
stringclasses
1 value
stack
stringclasses
1 value
[ { "from": "system", "value": "Fix an issue with the email notifier\n\nIncorrect body format assumptions in the email notifier\n" }, { "from": "human", "value": "# Copyright (c) 2016 Ansible, Inc.\n# All Rights Reserved.\n\nimport pprint\n\nfrom django.utils.encoding import smart_text\nfrom djang...
python
chosen
[ { "from": "system", "value": "Fix deprecration warnings for pytest\n" }, { "from": "human", "value": "import pytest\n\nfrom snakeeyes.app import create_app\n\n\n@pytest.yield_fixture(scope='session')\ndef app():\n \"\"\"\n Setup our flask test app, this only gets executed once.\n\n :ret...
python
chosen
[ { "from": "system", "value": "Add permission check for TEDx\n" }, { "from": "human", "value": "from django.core.urlresolvers import reverse\nfrom django.http import HttpResponseRedirect\nfrom django.shortcuts import render\nfrom .forms import RegistrationForm\nfrom .models import Registration\ni...
python
chosen
[ { "from": "system", "value": "Update docs to version v0.16.0\n" }, { "from": "human", "value": "__version__ = \"0.15.0-dev\"\n__libnetwork_plugin_version__ = \"v0.7.0-dev\"\n__libcalico_version__ = \"v0.10.0-dev\"\n__felix_version__ = \"1.3.0a6-dev\"\n" }, { "from": "gpt", "value": "...
python
chosen
[ { "from": "system", "value": "Load metadata path from current directory\n" }, { "from": "human", "value": "import os\nimport dash as _dash\nimport sys as _sys\n\ncurrent_path = os.path.dirname(os.path.abspath(__file__))\n\n_dash.development.component_loader.load_components(\n os.path.join(cur...
python
chosen
[ { "from": "system", "value": "Fix __COPYRIGHT__ and __REVISION__ in new Darwin module.\n" }, { "from": "human", "value": "\"\"\"engine.SCons.Platform.darwin\n\nPlatform-specific initialization for Mac OS X systems.\n\nThere normally shouldn't be any need to import this module directly. It\nwill...
python
chosen
[ { "from": "system", "value": "[TwitchIO] Use f-string for define command\n\n" }, { "from": "human", "value": "\nfrom twitchio.ext import commands\n\n@commands.cog()\nclass Words:\n\t\n\tdef __init__(self, bot):\n\t\tself.bot = bot\n\t\n\t@commands.command()\n\tasync def audiodefine(self, ctx, wo...
python
chosen
[ { "from": "system", "value": "Fix example to be Python3 compatible, use format()\n\nBoth print() and format() are compatible from 2.6. Also, format() is much nicer to use for internationalization since you can define the location of your substitutions. It works similarly to Java and .net's format() as well....
python
chosen
[ { "from": "system", "value": "Improve ctrl-c handling. Fix the clear-display line.\n" }, { "from": "human", "value": "#!/usr/bin/env python\n\n\"\"\"Display stock quotes on LEDs.\"\"\"\n\nimport RPi.GPIO as GPIO\nfrom seven_segment import print_leds\nfrom ystockquote import get_price, get_change...
python
chosen
[ { "from": "system", "value": "Update required version of guardian in example project\n" }, { "from": "human", "value": "#!/usr/bin/env python\nimport django\nimport os\nimport sys\n\nif django.VERSION < (1, 5):\n sys.stderr.write(\"ERROR: guardian's example project must be run with \"\n ...
python
chosen
[ { "from": "system", "value": "Update projection experiment for HDiv functions\n" }, { "from": "human", "value": "from __future__ import absolute_import, print_function, division\n\nfrom firedrake import *\n\nmesh = UnitSquareMesh(2, 2)\nRT = FiniteElement(\"RT\", triangle, 1)\nV = FunctionSpace(...
python
chosen
[ { "from": "system", "value": "Use RMS for better filtering" }, { "from": "human", "value": "\"\"\"\nTest obtaining peak audio values with PyAV:\ntime python pyav_audio_vol.py ~/Videos/sample.mp4\n\nReference:\nhttps://ffmpeg.org/doxygen/trunk/group__lavu__sampfmts.html\n\"\"\"\n\n\nimport sys\ni...
python
chosen
[ { "from": "system", "value": "Add exitcode and segv check for timing util\n" }, { "from": "human", "value": "#!/usr/bin/python\n#\n# Small helper for perftest runs.\n#\n\nimport os\nimport sys\nimport subprocess\n\ndef main():\n\tcount = int(sys.argv[1])\n\n\ttime_min = None\n\tfor i in xrange(...
python
chosen
[ { "from": "system", "value": "chore(Jobs): Allow migration to run on Postgres\n" }, { "from": "human", "value": "# Generated by Django 3.0.8 on 2020-07-23 02:19\n\nfrom django.db import migrations, models\n\n\nclass Migration(migrations.Migration):\n\n dependencies = [\n ('jobs', '0002...
python
chosen
[ { "from": "system", "value": "Update URLs file to match layout of other URLs files\n" }, { "from": "human", "value": "\"\"\"URL routing for the general application.\"\"\"\n\nfrom django.conf.urls import url\n\nfrom . import views\n\nurlpatterns = [\n url(r\"^$\", views.GeneralIndexView.as_vie...
python
chosen
[ { "from": "system", "value": "Update installer autocreate for games with no icon\n" }, { "from": "human", "value": "import json\nfrom django.core.management.base import BaseCommand\nfrom games import models\nfrom accounts.models import User\n\n\nclass Command(BaseCommand):\n def handle(self, ...
python
chosen
[ { "from": "human", "value": "Allow 'Collection' & 'Q' to be imported from pkg\n" }, { "from": "gpt", "value": "\"\"\"\n lookupy\n ~~~~~~~\n\n Lookupy is a Python library that provides a Django QuerySet like\n interface to query (select and filter) data (list of dicts)\n\n\"\"\"\n\nfrom ....
python
chosen
[ { "from": "system", "value": "Use embedded enum in alembic revision\n\nUnlikely to matter here but like this it will work correctly even in a\nfuture where someone may add new sources to the original enum (in that\ncase this particular revision should not add those newer ones, which\nwould be the case when ...
python
chosen
[ { "from": "system", "value": "Fix the fspath interface and div docstring.\n" }, { "from": "human", "value": "from zope.interface import Interface\n\nfrom filesystems import _PY3\n\n\nclass Path(Interface):\n def __str__():\n \"\"\"\n Render the path as a string.\n \"\"\"\...
python
chosen
[ { "from": "system", "value": "Revert \"Dodan razširjeni Evklidov algoritem\"\n\nThis reverts commit d64e1391b49aca2cdf04d5b136d902bb7331a3f6.\n" }, { "from": "human", "value": "# -*- coding: utf-8 -*-\n# Algoritmi z drugih vaj\n\ndef euclid(m, n):\n \"\"\"Evklidov algoritem\"\"\"\n while n...
python
chosen
[ { "from": "system", "value": "Reduce warning time to 5s\n" }, { "from": "human", "value": "import logging\nimport time\nfrom functools import wraps\n\nfrom . import compat\n\ncompat.patch() # monkey-patch time.perf_counter\n\nlog = logging.getLogger('amqpy')\n\n\ndef synchronized(lock_name):\n ...
python
chosen
[ { "from": "system", "value": "Change iteritems() to items() for future compatibility\n" }, { "from": "human", "value": "# pylint: disable=wildcard-import,unused-wildcard-import,missing-docstring\n\nfrom __future__ import absolute_import\n\nfrom unittest import TestCase\n\nfrom nose.tools import ...
python
chosen
[ { "from": "system", "value": "Make get_object pull appropriate fields\n\nTemporarily set up dynamo to work internally\n" }, { "from": "human", "value": "import boto3\n\ndef get_table(name):\n dynamo = boto3.resource('dynamo')\n return dynamo.Table(name)\n\ndef get_object(reference):\n t...
python
chosen
[ { "from": "system", "value": "Work only with 2 colunms" }, { "from": "human", "value": "#import sublime\nimport sublime_plugin\n\n\nclass laynger(sublime_plugin.TextCommand):\n def run(self, edit, opt='center'):\n window = self.view.window()\n\n layout = window.get_layout()\n\n ...
python
chosen
[ { "from": "system", "value": "Split command line tests into individuals\n" }, { "from": "human", "value": "import sys\n\nfrom px import px\nfrom unittest.mock import patch\n\ndef test_main():\n args = ['px', '--install']\n with patch(\"px.px.install\") as install_mock:\n px._main(ar...
python
chosen
[ { "from": "system", "value": "Remove docs for non-existing function parameters\n" }, { "from": "human", "value": "from datetime import datetime\n\nDT_FORMAT = \"%Y-%m-%dT%H:%M:%S.%f\"\n\n\ndef get_timestamp():\n \"\"\"\n Serialize actual datetime provided as simplified ISO 8601 (without ti...
python
chosen
[ { "from": "system", "value": "Remove noob fab method :-)\n" }, { "from": "human", "value": "# -*- coding: UTF-8 -*-\nfrom fabric.api import *\n\n#def dev()\n#def prod()\n\n#def setup_host()\n\ndef hello():\n print(\"Hello world!\")\n \ndef clean_db():\n local(\"rm -rf database/fst_demo....
python
chosen
[ { "from": "system", "value": "Debug prints should show something.\n" }, { "from": "human", "value": "import time\nfrom datetime import datetime\nfrom django.core.management import setup_environ\nfrom sendinel import settings\nsetup_environ(settings)\n\nfrom sendinel.backend.models import Schedul...
python
chosen
[ { "from": "system", "value": "Allow to set render samples\n" }, { "from": "human", "value": "import bpy\n\n\nclass Scene:\n \"\"\"Scene object\"\"\"\n def __init__(self, filepath, render_engine='CYCLES'):\n self.filepath = filepath\n self.render_engine = 'CYCLES'\n\n def s...
python
chosen
[ { "from": "system", "value": "Set download_url to pypi directory." }, { "from": "human", "value": "#!/usr/bin/env python\n\nfrom ez_setup import use_setuptools\nuse_setuptools()\n\nimport os\nfrom setuptools import setup, find_packages\n\nhere = os.path.dirname(__file__)\n\nversion_file = os.pat...
python
chosen
[ { "from": "system", "value": "Prepare for the next development cycle\n" }, { "from": "human", "value": "from setuptools import setup, find_packages\nimport sys, os\n\nversion = '0.1.0'\n\nsetup(name='mytardisbf',\n version=version,\n description=\"Bioformats App for MyTardis\",\n ...
python
chosen
[ { "from": "system", "value": "Embed required non python files in packaging : html and js files for report\n" }, { "from": "human", "value": "#!/usr/bin/env python\n\"\"\"Tuttle\"\"\"\n\nimport sys\nfrom tuttle import __version__\ntry:\n from setuptools import setup, find_packages\nexcept Impo...
python
chosen
[ { "from": "system", "value": "Use io.open with encoding='utf-8' and flake8 compliance\n" }, { "from": "human", "value": "from setuptools import setup, find_packages\n\nlong_description = (\n open('README.rst').read()\n + '\\n' +\n open('CHANGES.txt').read())\n\ntests_require = [\n 'p...
python
chosen
[ { "from": "system", "value": "Tag error, rolling to 0.7.2\n" }, { "from": "human", "value": "\"\"\"setup.py file.\"\"\"\nimport uuid\n\nfrom setuptools import setup\nfrom pip.req import parse_requirements\n\n\ninstall_reqs = parse_requirements('requirements.txt', session=uuid.uuid1())\nreqs = [s...
python
chosen
[ { "from": "system", "value": "Update minor version for end of 2016 leapsec\n" }, { "from": "human", "value": "from setuptools import setup, Extension\n\nimport os\nfrom Cython.Build import cythonize\n\nif (os.name == \"nt\"):\n compile_args = ['/EHs', '/D_CRT_SECURE_NO_DEPRECATE']\nelse:\n ...
python
chosen
[ { "from": "system", "value": "Use find_packages() instead of manually specifying package name, so that subpackages get included\n" }, { "from": "human", "value": "from setuptools import setup\n\n\nsetup(name=\"manhattan\",\n version='0.2',\n description='Robust Server-Side Analytics',\...
python
chosen
[ { "from": "system", "value": "Declare egg to not be zip-safe\n\nIf the egg is installed zipped, `python manage.py collectstatic` will fail to find the resources under `static`." }, { "from": "human", "value": "from os import path\nfrom setuptools import setup\nfrom subprocess import check_call\n...
python
chosen
[ { "from": "system", "value": "Fix exception handling to extend colander.Invalid\n" }, { "from": "human", "value": "from setuptools import setup\n\n\nsetup(\n name='Py-Authorize',\n version='1.0.1.2',\n author='Vincent Catalano',\n author_email='vincent@vincentcatlano.com',\n url='...
python
chosen
[ { "from": "system", "value": "Bump vers for square Aramaic Unicode\n\n#975 from @D-K-E" }, { "from": "human", "value": "\"\"\"Config for PyPI.\"\"\"\n\nfrom setuptools import find_packages\nfrom setuptools import setup\n\n\nsetup(\n author='Kyle P. Johnson',\n author_email='kyle@kyle-p-joh...
python
chosen
[ { "from": "system", "value": "Update couchdb-python dependency version to 0.5 in anticipation of its release.\n\n\ngit-svn-id: fdb8975c015a424b33c0997a6b0d758f3a24819f@9 bfab2ddc-a81c-11dd-9a07-0f3041a8e97c\n" }, { "from": "human", "value": "#!/usr/bin/env python\n# -*- coding: utf-8 -*-\n#\n# C...
python
chosen
[ { "from": "system", "value": "Add trove classifiers for language support\n" }, { "from": "human", "value": "from distutils.core import setup\n\nsetup(\n name = 'pycolors2',\n py_modules = ['colors',],\n version = '0.0.3',\n author = 'Chris Gilmer',\n author_email = 'chris.gilmer@g...
python
chosen
[ { "from": "system", "value": "Downgrade mock library for travis compatability.\n" }, { "from": "human", "value": "#!/usr/bin/env python\n\nfrom setuptools import setup, find_packages\n\n__version__ = \"1.0\"\n\nsetup(\n name=\"awsenv\",\n version=__version__,\n description=\"Opinionated...
python
chosen
[ { "from": "system", "value": "Rename package from dcp to dcp-client\n" }, { "from": "human", "value": "from setuptools import setup\n\nsetup(\n name='dcp',\n version='0.3',\n description='Basic DCP client',\n author='Couchbase',\n author_email='mike@couchbase.com',\n packages=[...
python
chosen
[ { "from": "system", "value": "Package name for psycopg2 has been changed\n" }, { "from": "human", "value": "#! /usr/bin/env python3\nfrom setuptools import setup\nfrom dictorm.dictorm import __version__, __doc__ as ddoc\n\nconfig = {\n 'name':'dictorm',\n 'version':str(__version__),\n '...
python
chosen
[ { "from": "system", "value": "Update osa_differ minimum version to 0.3.8\n\nIn order to support the use of PR refspecs, we\nneed to use 0.3.8 and above.\n" }, { "from": "human", "value": "#!/usr/bin/env python\n#\n# Copyright 2014 Major Hayden\n#\n# Licensed under the Apache License, Version 2...
python
chosen
[ { "from": "system", "value": "Include luhn package update version 1.0.1" }, { "from": "human", "value": "\nfrom setuptools import setup, find_packages\nfrom codecs import open\nfrom os import path\n\nhere = path.abspath(path.dirname(__file__))\n\n# Luhn Algorithm Validator -- long description\nw...
python
chosen
[ { "from": "system", "value": "Include static assets in pakage_data" }, { "from": "human", "value": "from setuptools import setup, find_packages\n\nsetup(\n name='django-treemenus',\n version='0.8.8-pre',\n description='Tree-structured menuing application for Django.',\n author='Julie...
python
chosen
[ { "from": "system", "value": "Create 2.3 release with recent PR merges\n" }, { "from": "human", "value": "import os\nfrom setuptools import setup, find_packages\n\nwith open(os.path.join(os.path.dirname(__file__), 'README.rst')) as readme:\n README = readme.read()\n\n# allow setup.py to be ru...
python
chosen
[ { "from": "system", "value": "Fix broken unit test command.\n" }, { "from": "human", "value": "#!/usr/bin/env python\n\nfrom distutils.core import setup, Command\nfrom distutils.extension import Extension\nimport os\nimport numpy as np\nfrom Cython.Distutils import build_ext\n\n\nos.environ['TES...
python
chosen
[ { "from": "system", "value": "Add SSL to cx-freeze packages\n\n" }, { "from": "human", "value": "import importlib\nfrom cx_Freeze import setup, Executable\n\nbackend_path = importlib.import_module(\"bcrypt\").__path__[0]\n\nbackend_path = backend_path.replace(\"bcrypt\", \".libs_cffi_backend\")\...
python
chosen
[ { "from": "system", "value": "Add Python 3.4 and 3.5 to classifiers\n" }, { "from": "human", "value": "from setuptools import setup\n\nsetup(\n name='tldr',\n version=\"0.1.3\",\n author='Felix Yan',\n author_email='felixonmars@gmail.com',\n url='https://github.com/felixonmars/tld...
python
chosen
[ { "from": "system", "value": "Resolve python3 error, version++ for release\n" }, { "from": "human", "value": "from setuptools import setup\n\nsetup(\n\tname=\"arxiv\",\n\tversion=\"0.2.1\",\n\tpackages=[\"arxiv\"],\n\n\t# dependencies\n\tinstall_requires=[\n\t\t'feedparser',\n\t\t'requests',\n\t...
python
chosen
[ { "from": "system", "value": "Add the description in the PyPI package\n" }, { "from": "human", "value": "#!/usr/bin/env python\nimport sys\n\nfrom setuptools import setup, find_packages\n\nimport kamboo\n\n\nrequires = ['boto3']\n\nif sys.version_info[:2] == (2, 6):\n # For python2.6 we have ...
python
chosen
[ { "from": "system", "value": "Use the custom fork of github.com/eallik/txzmq as the dependency instead of the original one at github.com/smira/txzmq\n" }, { "from": "human", "value": "from setuptools import setup, find_packages\n\nsetup(\n name=\"spinoff\",\n version=\"0.3dev\",\n packa...
python
chosen
[ { "from": "system", "value": "Move the main items into a function\n" }, { "from": "human", "value": "#!/usr/bin/env python\n\nimport requests\nimport calendar\nfrom datetime import datetime, timedelta\nfrom settings import _token, _domain, _user, _time, _pretty\n\n\nif __name__ == '__main__':\n ...
python
chosen
[ { "from": "system", "value": "Fix test if server started in xrootd cleanup code\n\ngit-svn-id: 884a03e47e2adb735d896e55bb5ad6bc3421ba19@17920 4e558342-562e-0410-864c-e07659590f8c\n" }, { "from": "human", "value": "import os\nimport osgtest.library.core as core\nimport osgtest.library.files as fi...
python
chosen
[ { "from": "system", "value": "Add test against Pusa coefficients (skipped for now, as they don't pass)\n" }, { "from": "human", "value": "import pytest\n\nslow = pytest.mark.skipif(\n not pytest.config.getoption(\"--runslow\"),\n reason=\"need --runslow option to run\"\n)\n\nTOTAL_DEGREES ...
python
chosen
[ { "from": "system", "value": "Enable hflip for capture and preview\n" }, { "from": "human", "value": "import io\n# import time\nimport picamera\nfrom . import config\n\nclass Camera:\n def __init__(self):\n self.camera = picamera.PiCamera(resolution=config.CAPTURE_RESOLUTION)\n ...
python
chosen
[ { "from": "system", "value": "Check if there is an project key on workflow_dict\n" }, { "from": "human", "value": "# -*- coding: utf-8 -*-\nimport logging\nfrom base import BaseStep\nfrom logical.models import Database\n\n\nLOG = logging.getLogger(__name__)\n\n\nclass BuildDatabase(BaseStep):\n\...
python
chosen
[ { "from": "system", "value": "Use new invocations pytest helper\n" }, { "from": "human", "value": "from invoke import task, Collection\nfrom invocations.packaging import release\n\n\n# TODO: once this stuff is stable and I start switching my other projects to be\n# pytest-oriented, move this int...
python
chosen
[ { "from": "system", "value": "Remove unused import of \"os\"\n" }, { "from": "human", "value": "\"\"\"Linux-specific code\"\"\"\n\nimport os\n\nfrom pysyte.types import paths\n\n\ndef xdg_home():\n \"\"\"path to $XDG_CONFIG_HOME\n\n >>> assert xdg_home() == os.path.expanduser('~/.config')\...
python
chosen
[ { "from": "system", "value": "Fix error in calculation on lorentz factor\n" }, { "from": "human", "value": "# -*- coding: utf-8 -*-\r\nfrom __future__ import division\r\n\r\nimport math\r\n\r\n\r\nclass LorentzFactor(object):\r\n SPEED_OF_LIGHT = 299792458\r\n\r\n @staticmethod\r\n def ...
python
chosen
[ { "from": "system", "value": "Add warning for mismatched image size and scale" }, { "from": "human", "value": "import data\nimport argparse\nfrom model import EDSR\nparser = argparse.ArgumentParser()\nparser.add_argument(\"--dataset\",default=\"data/General-100\")\nparser.add_argument(\"--imgsiz...
python
chosen
[ { "from": "system", "value": "Revert \"[HACK TEST] Rename package for now and try with a registered account for testpypi\"\n\nThis reverts commit 3cc3b07dcbe7faac91cf42b40c7ebd4375c4f93d.\n" }, { "from": "human", "value": "# Copyright 2015 datawire. All rights reserved.\n#\n# Licensed under the ...
python
chosen
[ { "from": "system", "value": "Change registration email sender to Phuxivator\n" }, { "from": "human", "value": "from django.core.mail import send_mail\n\n\n# TODO: check whether this should be sent from Phuxivator\ndef mailApplicantSubmission(context, sender='infochef@tf.fi'):\n name = contex...
python
chosen
[ { "from": "system", "value": "Increase Pypi version. New package uploaded to Pypi already.\n\nPiperOrigin-RevId: 435120795\nChange-Id: Idaed3713248afaeefad2eac345d6cd4d6b37bef9\n" }, { "from": "human", "value": "# Copyright 2022 Google LLC.\n#\n# Licensed under the Apache License, Version 2.0 (t...
python
chosen
[ { "from": "system", "value": "Extend funcname_scope so that it accepts funcnames\n" }, { "from": "human", "value": "import functools\nimport numpy\nimport tensorflow as tf\n\n\n\ndef static_shape(tensor):\n return tf.convert_to_tensor(tensor).get_shape().as_list()\n\n\ndef static_rank(tensor):\...
python
chosen
[ { "from": "system", "value": "Rename API method into question_set_list\n" }, { "from": "human", "value": "from django.conf.urls import url\nfrom . import views\n\nurlpatterns = [\n url(r'^question_set/', views.http_list_question_sets),\n url(r'^answer_set/', views.http_create_answer_set),\...
python
chosen
[ { "from": "system", "value": "Allow a function to be called whenever a candidate blob is found during\nimage\nprocessing\n" }, { "from": "human", "value": "from SimpleCV import *\nimport numpy\nimport cv2\n\n\ndef process_image(obj, img, config):\n \"\"\"\n :param obj: Object we're trackin...
python
chosen
[ { "from": "system", "value": "Add command line arguments for program\n" }, { "from": "human", "value": "import argparse\nimport logging\n\nlogging.basicConfig(level=logging.INFO)\nlogger = logging.getLogger(__name__)\n\n\nif __name__ == '__main__':\n parser = argparse.ArgumentParser(prog=\"BT...
python
chosen
[ { "from": "system", "value": "Delete unused import of NOT_READY_YET\n" }, { "from": "human", "value": "# -*- coding: utf-8 -*-\n# Copyright 2015 OpenMarket Ltd\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may not use this file except in compliance with the Licen...
python
chosen
[ { "from": "system", "value": "Add support for multiple return `Packet`s from `Handler`s\n" }, { "from": "human", "value": "\"\"\"Handle handlers.\"\"\"\n\nimport logging\n\n\nclass Handlers(object):\n \"\"\"Handlers.\"\"\"\n\n def __init__(self, *handlers):\n self.logger = logging.g...
python
chosen
[ { "from": "system", "value": "Clean up directory parsing code\n" }, { "from": "human", "value": "#!/usr/bin/env python\n\"\"\"\nContains helper functions common to all paasta commands or the client\n\"\"\"\n\n\nimport glob\nimport os\n\n# List of commands the paasta client can execute\nCMDS = No...
python
chosen
[ { "from": "system", "value": "Fix bug with negative counts\n" }, { "from": "human", "value": "#!/bin/python3\n\nimport math\nimport os\nimport random\nimport re\nimport sys\nfrom collections import Counter\n\n# Complete the freqQuery function below.\ndef freqQuery(queries):\n output = []\n occ...
python
chosen
[ { "from": "system", "value": "Update `urlpatterns` for 4.0 removal of `django.conf.urls.url()`\n" }, { "from": "human", "value": "import sys\n\nfrom django.conf import settings\nfrom django.conf.urls import url\nfrom django.core.management import execute_from_command_line\nfrom django.http impor...
python
chosen
[ { "from": "system", "value": "Make the decorator actually work again.\n" }, { "from": "human", "value": "from functools import wraps\n\nfrom django.http import Http404\nfrom django.utils.decorators import available_attrs\n\nfrom waffle import is_active\n\n\ndef waffle(flag_name):\n def decora...
python
chosen
[ { "from": "system", "value": "Add test for custom base URL\n" }, { "from": "human", "value": "\"\"\"\nTests for helper function for adding a target to a Vuforia database.\n\"\"\"\n\nimport io\n\nfrom vws import VWS\n\n\nclass TestSuccess:\n \"\"\"\n Tests for successfully adding a target.\...
python
chosen
[ { "from": "system", "value": "Include binaries when importing (for Windows).\n" }, { "from": "human", "value": "from conans import ConanFile, CMake, tools\n\n\nclass VarconfConan(ConanFile):\n name = \"varconf\"\n version = \"1.0.3\"\n license = \"GPL-2.0+\"\n author = \"Erik Ogenvik...
python
chosen
[ { "from": "system", "value": "Validate Model function to allow permission\n" }, { "from": "human", "value": "from collections import defaultdict\nfrom .utils import get_value_from_accessor\n\nclass RoleBehaviour(object):\n ids = []\n object_accessors = {}\n\n def __init__(self, user, re...
python
chosen
[ { "from": "system", "value": "Add handling for building scikit-umfpack on the Mac, which doesn't have the librt file added to the umfpack dependencies.\n" }, { "from": "human", "value": "#!/usr/bin/env python\n# 05.12.2005, c\nfrom __future__ import division, print_function, absolute_import\n\nd...
python
chosen
[ { "from": "system", "value": "Add documentation on one assertion, convert RE's to raw strings.\n" }, { "from": "human", "value": "suppressions = [\n [ \".*/multiarray/mapping\\.\", \"PyArray_MapIterReset\" ],\n\n # PyArray_Std trivially forwards to and appears to be superceded by\n # __...
python
chosen
[ { "from": "system", "value": "Add a shim for python 2.4 compatability with hashlib\n\n--HG--\nextra : rebase_source : 5f573e600aadbe9c95561ee28c05cee02c7db559\n" }, { "from": "human", "value": "\"\"\"\nForward-compatibility support for Python 2.4 and earlier\n\"\"\"\n\n# from jaraco.compat 1.2\n...
python
chosen
[ { "from": "system", "value": "Change to make BEM solution from mne-C\n" }, { "from": "human", "value": "from __future__ import print_function\nimport mne\n\nfrom my_settings import * \n\nsubject = sys.argv[1]\n\n# make source space\nsrc = mne.setup_source_space(subject, spacing='oct6',\n ...
python
chosen
[ { "from": "system", "value": "Make scorer accept instances of model and desc. gen.\n" }, { "from": "human", "value": "import numpy as np\nfrom sklearn.cross_validation import cross_val_score\nfrom sklearn.externals import joblib as pickle\n\nclass scorer(object):\n def __init__(self, model, d...
python
chosen
[ { "from": "system", "value": "Bump version number to 1.4.1\n" }, { "from": "human", "value": "# Copyright 2014 Google Inc. All Rights Reserved.\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may not use this file except in compliance with the License.\n# You may o...
python
chosen
[ { "from": "system", "value": "Define logging level with a numeric value." }, { "from": "human", "value": "# -*- coding: utf-8 -*-\n\nimport logging\n\n\nclass Production(object):\n DEBUG = False\n TESTING = False\n SECRET_KEY = '##CHANGEME##'\n SQLALCHEMY_DATABASE_URI = 'postgresql:/...
python
chosen
[ { "from": "system", "value": "Fix RssItem when each scraped item is instance of RssItem\n" }, { "from": "human", "value": "# -*- coding: utf-8 -*-\n\nimport scrapy\nfrom scrapy.item import BaseItem\nfrom scrapy_rss.elements import *\nfrom scrapy_rss import meta\nimport six\n\n\n@six.add_metaclas...
python
chosen
[ { "from": "human", "value": "Enable all auth algorithms that might be emitted by the alice.\n" }, { "from": "gpt", "value": "from lib.test_config import AUTH_CREDS as AUTH_CREDS_orig\n\nclass AUTH_CREDS(AUTH_CREDS_orig):\n enalgs = ('SHA-256-sess', 'SHA-256', 'MD5-sess', 'MD5', None)\n rea...
python
chosen
[ { "from": "system", "value": "Add utility to save/load parameters, i.e. models.\n\nAlso adds a utility to compute the number of parameters, because that's\nalways interesting and often reported in papers.\n" }, { "from": "human", "value": "import theano as _th\nimport numpy as _np\n\n\ndef creat...
python
chosen
[ { "from": "system", "value": "Add flask.g and connection/teardown operators.\n" }, { "from": "human", "value": "# -*- coding: utf-8 -*-\nfrom flask import Flask\nimport os\nimport psycopg2\nfrom contextlib import closing\n\nDB_SCHEMA = \"\"\"\nDROP TABLE IF EXISTS entries;\nCREATE TABLE entries ...
python
chosen
[ { "from": "system", "value": "Fix for flake8 checks on new test file.\n" }, { "from": "human", "value": "from nose.tools import assert_equal, assert_true, assert_false, assert_raises\nfrom vispy.testing import assert_in, run_tests_if_main\n\nfrom vispy.app import set_interactive\nfrom vispy.ext....
python
chosen
[ { "from": "system", "value": "Apply linesman profiler to the wsgi app\n\nI fully expect this commit to be backed out when we get the profiling\nstuff sorted out, but thankfully, this profiler can be disabled for a\nlive site.\n\ncheck out http://<site>/__profiler__ after installing linesman, and\nrunning th...
python
chosen
[ { "from": "system", "value": "Test boolean list serialization in Turtle\n" }, { "from": "human", "value": "import rdflib\nfrom rdflib.py3compat import b\n\ndef testTurtleFinalDot(): \n \"\"\"\n https://github.com/RDFLib/rdflib/issues/282\n \"\"\"\n\n g = rdflib.Graph()\n u = rdfli...
python
chosen
[ { "from": "system", "value": "Call wraps on the restoring_chdir decorator." }, { "from": "human", "value": "import os\n\n\ndef restoring_chdir(fn):\n def decorator(*args, **kw):\n try:\n path = os.getcwd()\n return fn(*args, **kw)\n finally:\n os...
python
chosen
[ { "from": "system", "value": "Add SQL imports to python\n\n" }, { "from": "human", "value": "from flask import Flask\r\nimport yaml\r\n\r\napp = Flask(__name__)\r\n\r\n\r\n@app.route(\"/\")\r\ndef hello():\r\n return \"Hello World!\"\r\n\r\n\r\nif __name__ == '__main__':\r\n # read and ret...
python
chosen
[ { "from": "system", "value": "Update jinja example to recommended syntax" }, { "from": "human", "value": "\"\"\"\nOn-demand logging\n=================\n\n.. versionadded:: 2017.7.0\n\nThe sole purpose of this module is logging messages in the (proxy) minion.\nIt comes very handy when debugging c...
python
chosen
[ { "from": "system", "value": "Change base model string representation\n" }, { "from": "human", "value": "# -*- coding: UTF-8 -*-\nfrom tests.base import ApiDBTestCase\n\n\nclass BaseModelTestCase(ApiDBTestCase):\n\n def test_repr(self):\n self.generate_fixture_project_status()\n ...
python
chosen
[ { "from": "system", "value": "Remove superfluous import of shinken.objects in shinken/_init__.py.\n\nEvery script or test-case importing shinken has all the objects loaded,\neven if they are not required by the script or test-case at all.\n\nAlso see <http://sourceforge.net/mailarchive/message.php?msg_id=29...
python
chosen
[ { "from": "system", "value": "Check if user can edit project roster\n" }, { "from": "human", "value": "from django.shortcuts import render_to_response, get_object_or_404\nfrom django.http import HttpResponseRedirect\nfrom django.template import RequestContext\nfrom django.contrib.auth.models imp...
python
chosen
[ { "from": "system", "value": "Use a list comprehension and set() to make the active_users query simpler and faster.\n" }, { "from": "human", "value": "from datetime import timedelta, datetime\nfrom django.db import models\nfrom django.contrib.auth.models import User\n\nclass RequestManager(model...
python
chosen