conversations
listlengths
2
3
source
stringclasses
1 value
stack
stringclasses
1 value
[ { "from": "system", "value": "Add some extra View tests\n" }, { "from": "human", "value": "\"\"\"\nUnittests for opal.views\n\"\"\"\nfrom django.test import TestCase\n\nfrom opal import views\n\nclass ColumnContextTestCase(TestCase):\n pass\n" }, { "from": "gpt", "value": "\"\"\"\...
python
chosen
[ { "from": "system", "value": "Add pointer to WTForms-SQLAlchemy in Deprecation\n\nCloses #221\n" }, { "from": "human", "value": "import warnings\n\nwarnings.warn(\n 'wtforms.ext.sqlalchemy is deprecated, and will be removed in WTForms 3.0. '\n 'Instead transition to the excellent WTForms-A...
python
chosen
[ { "from": "system", "value": "Fix file opening and make tests pass.\n" }, { "from": "human", "value": "#!/usr/bin/env python\n# -*- coding: utf-8 -*-\n\ndef get_starting_chunk(filename):\n with(filename, 'r') as f:\n chunk = open(filename).read(1024)\n return chunk\n\n\ndef is_b...
python
chosen
[ { "from": "system", "value": "[ref] Use a new asynchronous file reader helper\n" }, { "from": "human", "value": "from threading import Thread\nfrom Queue import Queue, Empty\n\n\n# Read from a stream ---------------------------------------------------\n\nclass NonBlockingStreamReader:\n \"\"\...
python
chosen
[ { "from": "system", "value": "Fix typo in AWXDjangoStrategy constructor\n\nSigned-off-by: Matvey Kruglov <a9c5c297e6de9a9c1390d88b6df170967c0ffb3a@gmail.com>\n" }, { "from": "human", "value": "# Copyright (c) 2017 Ansible, Inc.\n# All Rights Reserved.\n\nfrom social.strategies.django_strategy im...
python
chosen
[ { "from": "system", "value": "Fix regression on Windows XP in determining data root\n" }, { "from": "human", "value": "import os\nimport sys\n\n# While we support Python 2.4, use a convoluted technique to import\n# platform from the stdlib.\n# With Python 2.5 or later, just do \"from __future__...
python
chosen
[ { "from": "system", "value": "Fix RemovedInDjango40Warning from Signal arguments\n\nFix to removove the following warning I've started to see when running unittest in my django project.\n\n\"\"\"/<path to venv/lib/python3.7/site-packages/django_registration/signals.py:13: RemovedInDjango40Warning:\nThe prov...
python
chosen
[ { "from": "system", "value": "Add usage message if instruction not recognized\n" }, { "from": "human", "value": "\"\"\"calc.py: A simple Python calculator.\"\"\"\n\nimport sys\n\ndef add_all(nums):\n return sum(nums)\n\ndef multiply_all(nums):\n return reduce(lambda a, b: a * b, nums)\n\n\...
python
chosen
[ { "from": "system", "value": "Allow deep attribute access in dynamic loading utility.\n\nSummary:\nThis will help for parameterizing access to methods of singleton\nobjects, such as the `msgpack` codec:\n\n >>> from pgshovel.utilities import load\n >>> load('pgshovel.contrib.msgpack:codec.decode')\n ...
python
chosen
[ { "from": "system", "value": "Test that HierarchyADOs and HierarchyADOsState are part of the HEOM api.\n" }, { "from": "human", "value": "\"\"\"\nTests for qutip.nonmarkov.heom.\n\"\"\"\n\nfrom qutip.nonmarkov.heom import (\n BathExponent,\n Bath,\n BosonicBath,\n DrudeLorentzBath,\n...
python
chosen
[ { "from": "system", "value": "Handle the user id coming in via a header.\n" }, { "from": "human", "value": "# (c) Crown Owned Copyright, 2016. Dstl.\n\nfrom django.core.urlresolvers import reverse\nfrom django.shortcuts import redirect\nfrom django.views.generic.base import View\n\n\nclass Home(...
python
chosen
[ { "from": "system", "value": "Fix ongov customs settings formatting.\n" }, { "from": "human", "value": "'''\nEnclose property names in double quotes in order to JSON serialize the contents in the API\n'''\nCUSTOMIZATIONS = {\n \"serializers\":\n {\n \"Location\":\...
python
chosen
[ { "from": "system", "value": "Update manager for Person requirement\n" }, { "from": "human", "value": "# Django\nfrom django.contrib.auth.models import BaseUserManager\n\n\nclass UserManager(BaseUserManager):\n\n def create_user(self, email, password='', **kwargs):\n user = self.model(...
python
chosen
[ { "from": "system", "value": "Correct error where && was used instead of and\n" }, { "from": "human", "value": "from argparse import ArgumentParser\nfrom matplotlib import pyplot as plt\nfrom graph import Greengraph\n\n\ndef process():\n parser = ArgumentParser(\n description=\"Produce...
python
chosen
[ { "from": "system", "value": "Add MispTransportError in package import\n" }, { "from": "human", "value": "from .misp import MispTag, MispEvent, MispServer, MispAttribute, MispShadowAttribute\n" }, { "from": "gpt", "value": "from .misp import MispTag, MispEvent, MispServer, MispAttrib...
python
chosen
[ { "from": "system", "value": "Print sum. Print description only if it exists.\n" }, { "from": "human", "value": "#!/usr/bin/env python\n\n# Print information columns of number values.\n\nimport sys\nimport numpy as np\n\nfrom dwi import asciifile\n\nfor filename in sys.argv[1:]:\n af = asciif...
python
chosen
[ { "from": "system", "value": "Add item_set to collections response\n" }, { "from": "human", "value": "from rest_framework import serializers\nfrom rest_framework_json_api.views import ModelViewSet\n\nfrom .models import Collection, Item\n\n\nclass ItemSerializer(serializers.ModelSerializer):\n ...
python
chosen
[ { "from": "system", "value": "Add a version per default\n" }, { "from": "human", "value": "import json\nimport dns.resolver\n\nmispattributes = {'input':['hostname', 'domain'], 'output':['ip-src', 'ip-dst']}\n\ndef handler(q=False):\n if q is False:\n return False\n request = json.l...
python
chosen
[ { "from": "system", "value": "Change label output to int32 for compatibility with some viewers\n" }, { "from": "human", "value": "# -*- coding: utf-8 -*-\nfrom __future__ import absolute_import, print_function\n\nimport tensorflow as tf\n\nfrom niftynet.utilities.util_common import look_up_opera...
python
chosen
[ { "from": "system", "value": "Revert \"Try fixing circular import\"\n\nThis reverts commit 1a23578be15c06c8d8688bcceffac4af2e980c95.\n" }, { "from": "human", "value": "from stable_baselines.a2c import A2C\nfrom stable_baselines.acer import ACER\nfrom stable_baselines.acktr import ACKTR\n# from s...
python
chosen
[ { "from": "system", "value": "Make deprecation warning in doc string bold\n" }, { "from": "human", "value": "import warnings\nimport functools\n\n\n__all__ = ['deprecated']\n\n\nclass deprecated(object):\n \"\"\"Decorator to mark deprecated functions with warning.\n\n Adapted from <http://...
python
chosen
[ { "from": "system", "value": "Remove warning messages for tifffile.py\n" }, { "from": "human", "value": "\"\"\"`sktracker.io` module is designed to easly and quickly open Tiff files and\nto be able to parse and import any kind of metadata.\n\nFinally, an OME module is provided to read and write ...
python
chosen
[ { "from": "system", "value": "Revert \"Added implementation of selection sort\"\n\nThis reverts commit acf509f392d536c61c0dbed3a07ed24849b00928.\n" }, { "from": "human", "value": "def insertion_sort(seq):\n for i in range(1, len(l)):\n for j in range(i, 0, -1):\n if l[j - 1]...
python
chosen
[ { "from": "system", "value": "Fix running the module directly\n\nAfter rearranging the package structure, running the rivescript module\ndirectly stopped working due to relative import errors. Fix it so that\nit can be run directly while still working when imported as normal.\n" }, { "from": "human"...
python
chosen
[ { "from": "system", "value": "Fix 'float is required' when key has no exp date\n\nNo expiration date was defaulting to \"\", which was throwing an error\nwhen creating the expire date timestamp.\n" }, { "from": "human", "value": "from django.conf import settings\nfrom django.utils import timezon...
python
chosen
[ { "from": "system", "value": "Use a custom 404 handler to avoid using the default template loader.\n" }, { "from": "human", "value": "from django.conf.urls import patterns, include, url\n\n# Uncomment the next two lines to enable the admin:\n# from django.contrib import admin\n# admin.autodiscov...
python
chosen
[ { "from": "system", "value": "Add model Sync to repo.\n" }, { "from": "human", "value": "from peewee import SqliteDatabase, OperationalError\n\n\n__all__ = [\n 'BaseDatabase',\n ]\n\n\nclass BaseDatabase:\n \"\"\"The base database class to be used with Peewee.\n \"\"\"\n def __ini...
python
chosen
[ { "from": "system", "value": "Change url config for slugs\n" }, { "from": "human", "value": "from django.conf.urls import url, include\nfrom conferences import views\n\nurlpatterns = [\n url(r'^$', views.ConferenceList.as_view(), name='list'),\n url(r'^(?P<pk>[0-9]+)/$', views.ConferenceDe...
python
chosen
[ { "from": "system", "value": "Add util module for DB testing\n" }, { "from": "human", "value": "__version__ = '0.4-alpha'\n__author__ = 'Dan Persons <dpersonsdev@gmail.com>'\n__license__ = 'MIT License'\n__github__ = 'https://github.com/dogoncouch/siemstress'\n__all__ = ['parsecore', 'querycore'...
python
chosen
[ { "from": "system", "value": "Use find_packages so we actually install everything..\n" }, { "from": "human", "value": "#!/usr/bin/env python\n\nimport os\nimport setuptools\n\nNAME = 'takeyourmeds'\n\nDATA = (\n 'static',\n 'templates',\n)\n\ndef find_data(dirs):\n result = []\n for ...
python
chosen
[ { "from": "system", "value": "Add argparse as a dependency to setyp.py\n\nNeeded for python 2.6\n\nChange-Id: I87df47c7b814024b1ec91d227f45762711de03c0\n" }, { "from": "human", "value": "\"\"\"\nsetup.py\n\n\"\"\"\n__author__ = 'Gavin M. Roy'\n__email__ = 'gmr@myyearbook.com'\n__since__ = '2011-...
python
chosen
[ { "from": "system", "value": "Add mock to test extras\n" }, { "from": "human", "value": "from setuptools import setup, find_packages\n\n\n# Parse the version from the mapbox module.\nwith open('mapboxcli/__init__.py') as f:\n for line in f:\n if line.find(\"__version__\") >= 0:\n ...
python
chosen
[ { "from": "system", "value": "Upgrade versions of test tools\n" }, { "from": "human", "value": "from setuptools import setup, find_packages\nimport simple_virtuoso_migrate\n\n\nsetup(\n name = \"simple-virtuoso-migrate\",\n version = simple_virtuoso_migrate.SIMPLE_VIRTUOSO_MIGRATE_VERSION,...
python
chosen
[ { "from": "system", "value": "Add _GNU_SOURCE definition to ext_module\n" }, { "from": "human", "value": "'''\n(c) 2014 Farsight Security Inc.\n(c) 2010 Victor Ng\n\nReleased under the MIT license. See license.txt.\n'''\n\nfrom setuptools import setup\nfrom setuptools.extension import Extension...
python
chosen
[ { "from": "system", "value": "Add keywords and update package name\n" }, { "from": "human", "value": "#!/usr/bin/env python\n# -*- coding: utf-8 -*-\n#\n# License: MIT\n# vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4:\n\n\"\"\"\ndjango twitter bootstrap form setup script\n\"\"\"\n\n__a...
python
chosen
[ { "from": "system", "value": "Exclude tests and include sql files in cnx-authoring package\n\nRemove include_package_data=True as it looks for MANIFEST.in instead of\nusing the package_data that we specified in setup.py.\n\nTested by running:\n```bash\nrm -rf cnx_authoring.egg-info dist\npython setup.py sdi...
python
chosen
[ { "from": "system", "value": "Fix for deprecation of `request.QUERY_PARAMS` in DRF 3.2`\n" }, { "from": "human", "value": "\"\"\"\nClass Mixins.\n\"\"\"\n\nclass MultipleIDMixin(object):\n \"\"\"\n Override get_queryset for multiple id support\n \"\"\"\n def get_queryset(self):\n ...
python
chosen
[ { "from": "system", "value": "Mark this project as using the MIT License.\n" }, { "from": "human", "value": "\ntry:\n from setuptools import setup\nexcept ImportError:\n from distutils.core import setup\n \nVersion = \"0.01\"\n\nsetup(name = \"coverage-reporter\",\n version = Versi...
python
chosen
[ { "from": "system", "value": "Change URL from ScraperWiki > source" }, { "from": "human", "value": "from distutils.core import setup\nsetup(name='dshelpers',\n version='1.1.0',\n description=\"Provides some helpers functions used by the ScraperWiki Data Services team.\",\n long_de...
python
chosen
[ { "from": "system", "value": "Configure project_one as a script.\n\nThis automatically runs main() when typing 'project_one' in the command line (after installing)." }, { "from": "human", "value": "from setuptools import setup, find_packages\n\nsetup(\n name = 'slf-project-one',\n version ...
python
chosen
[ { "from": "system", "value": "Increment version to 0.4.0 for release\n" }, { "from": "human", "value": "from setuptools import setup\n\nversion = \"0.3.1\"\n\nsetup(\n name=\"arxiv\",\n version=version,\n packages=[\"arxiv\"],\n\n # dependencies\n install_requires=[\n 'feed...
python
chosen
[ { "from": "system", "value": "Update the proxy server examples\n" }, { "from": "human", "value": "\"\"\"\nProxy Server \"Phone Book\".\n\nSimplify running browser tests through a proxy server\nby adding your frequently-used proxies here.\n\nNow you can do something like this on the command line:...
python
chosen
[ { "from": "system", "value": "Upgrade lxml package from 4.3.0 -> 4.3.4\n" }, { "from": "human", "value": "import os\nimport sys\n\nfrom setuptools import setup, find_packages\n\nos.chdir(os.path.dirname(sys.argv[0]) or \".\")\n\nimport libsongtext\nversion = '%s.%s.%s' % libsongtext.__version__\...
python
chosen
[ { "from": "system", "value": "Add future to install requirements.\n" }, { "from": "human", "value": "# -*- coding: utf-8 -*-\nfrom setuptools import setup, find_packages\nfrom codecs import open\nfrom os import path\nimport pubcode\n\nhere = path.abspath(path.dirname(__file__))\n\nwith open(path...
python
chosen
[ { "from": "system", "value": "Change dev status to beta, not pre-alpha\n\nThere's no RC classifier, so beta looks like the closest\none we can use.\n" }, { "from": "human", "value": "#!/usr/bin/env python\nfrom setuptools import setup, find_packages\n\n\nwith open('README.rst') as readme_file:\n...
python
chosen
[ { "from": "system", "value": "Update feature version to 0.1.0\n" }, { "from": "human", "value": "#!/usr/bin/env python\n# -*- coding: utf-8 -*-\n\n\"\"\"The setup script.\"\"\"\n\nfrom setuptools import setup, find_packages\n\nwith open('README.rst') as readme_file:\n readme = readme_file.rea...
python
chosen
[ { "from": "system", "value": "Fix implicit dependency on pypandoc\n" }, { "from": "human", "value": "from setuptools import setup, find_packages\nimport os\nfrom osuapi import __version__ as version, __title__ as name, __author__ as author, __license__ as license\nimport pypandoc\n\n\ndef read(f...
python
chosen
[ { "from": "system", "value": "Add coverage as optional dev requirement.\n" }, { "from": "human", "value": "import os\n\nfrom setuptools import setup\n\n\ndef get_version():\n \"\"\"\n Get the version from version module without importing more than\n necessary.\n \"\"\"\n version_m...
python
chosen
[ { "from": "system", "value": "Add 'dicom' package to the requirements\n" }, { "from": "human", "value": "import sys\n\n# Make sure we are running python3.5+\nif 10 * sys.version_info[0] + sys.version_info[1] < 35:\n sys.exit(\"Sorry, only Python 3.5+ is supported.\")\n\nfrom setuptools impor...
python
chosen
[ { "from": "system", "value": "Save one block to storage\n" }, { "from": "human", "value": "\nfrom pecan import conf\n\nimport os\n\nclass DiskStorageDriver(object):\n \"\"\"A driver for storing blocks onto local disk\n\n IMPORTANT: This driver should not be considered\n secure and there...
python
chosen
[ { "from": "system", "value": "Package name changed due to collision on PyPi\n" }, { "from": "human", "value": "import os\n\nfrom setuptools import setup\n\nhere = os.path.abspath(os.path.dirname(__file__))\n\nwith open(os.path.join(here, 'README.rst')) as f:\n README = f.read()\n \nrequire...
python
chosen
[ { "from": "system", "value": "Remove include clause from find_packages\n\nIt's not supported on older versions of pip" }, { "from": "human", "value": "from setuptools import find_packages, setup\n\n\nsetup(\n name='tchannel',\n version='0.10.1.dev0',\n author='Abhinav Gupta, Aiden Scand...
python
chosen
[ { "from": "system", "value": "Add Xception to keras cache\n" }, { "from": "human", "value": "from keras.applications.resnet50 import ResNet50\nfrom keras.applications.vgg16 import VGG16\nfrom keras.applications.vgg19 import VGG19\nfrom keras.applications.inception_v3 import InceptionV3\n\nresnet...
python
chosen
[ { "from": "system", "value": "Move up to be a beta.\n" }, { "from": "human", "value": "from setuptools import setup, find_packages\nsetup(\n name='wagtailcodeblock',\n version=\"0.4.0\",\n description='Wagtail Code Block provides PrismJS syntax highlighting in Wagtail.',\n long_descr...
python
chosen
[ { "from": "system", "value": "Update buildbot packages to >= 1.5.0.\n" }, { "from": "human", "value": "from setuptools import setup, find_packages\n\nsetup(\n name='autobuilder',\n version='1.0.3',\n packages=find_packages(),\n license='MIT',\n author='Matt Madison',\n author_e...
python
chosen
[ { "from": "system", "value": "Install the management command too when installing as a distribution\n" }, { "from": "human", "value": "from distutils.core import setup\n\n\nsetup(\n name='django-emailuser',\n version='1.0',\n description='simple User model identified by email address',\n...
python
chosen
[ { "from": "system", "value": "Use a single database for all air quality measurements\n" }, { "from": "human", "value": "# coding=utf-8\n\nfrom local_settings import *\nfrom utils import SensorConsumerBase\nimport redis\nimport datetime\nimport sys\n\nclass Bathroom(SensorConsumerBase):\n def ...
python
chosen
[ { "from": "system", "value": "Set start variable in init function\n" }, { "from": "human", "value": "#!/usr/bin/env python\n# encoding: utf-8\n\nfrom __future__ import division, print_function\nfrom time import time\n\n\nclass Timer(object):\n\n \"\"\" Simple timing object.\n\n Usage:\n ...
python
chosen
[ { "from": "system", "value": "Add test for passing paths with variables to create_urlspec_regex.\n" }, { "from": "human", "value": "from unittest import TestCase\n\nfrom go_store_service.api_handler import (\n ApiApplication, create_urlspec_regex, CollectionHandler,\n ElementHandler)\n\n\n...
python
chosen
[ { "from": "system", "value": "Fix for python2/3 compatibility issue with urllib\n" }, { "from": "human", "value": "\"\"\"\nAuthor(s): Matthew Loper\n\nSee LICENCE.txt for licensing and contact information.\n\"\"\"\n__all__ = ['mstack', 'wget']\n\ndef mstack(vs, fs):\n import chumpy as ch\n ...
python
chosen
[ { "from": "system", "value": "Use flask redirects for random perspective and latest round\n" }, { "from": "human", "value": "import flask\n\nfrom handlers import app\nimport db.query as q\n\n@app.route('/')\ndef index():\n return app.send_static_file('index.html')\n\n@app.route('/api/perspectiv...
python
chosen
[ { "from": "system", "value": "Correct the usage of decorator.decorator\n\nCorrect the usage of decorator.decorator as described in [1].\n\n[1]http://pythonhosted.org/decorator/documentation.html#decorator-decorator\n\nChange-Id: Ia71b751f364e09541faecf6a43f252e0b856558e\nCloses-Bug: #1483464\n" }, { ...
python
chosen
[ { "from": "system", "value": "Add posibility to add extra information to occurence.\n" }, { "from": "human", "value": "from django.db import models\nfrom django.utils.translation import ugettext_lazy as _\n\nfrom mezzanine.core.models import Displayable, RichText\n\nclass Event(Displayable, Rich...
python
chosen
[ { "from": "system", "value": "Fix small problem with properties\n" }, { "from": "human", "value": "'''\nCreated on 02/02/2014\n\n@author: Miguel Otero\n'''\n\nclass MeasurementUnit(object):\n '''\n classdocs\n '''\n\n RANK = \"rank\"\n INDEX = \"index\"\n UNITS = \"units\"\n ...
python
chosen
[ { "from": "system", "value": "Add check for libDex.so file in dex dir.\n" }, { "from": "human", "value": "from setuptools import setup, find_packages\n\nsetup(\n name='dex',\n version='0.0.1',\n description='A research language for typed, functional array processing',\n license='BSD',\n aut...
python
chosen
[ { "from": "system", "value": "Update signals for latest django\n\ngit-svn-id: 80df2eab91b5a6f595a6fdab3c86ff0105eb9aae@1867 2d143e24-0a30-0410-89d7-a2e95868dc81\n" }, { "from": "human", "value": "\"\"\"\nCopied over from django.contrib.auth.management\n\"\"\"\nfrom django.dispatch import dispatc...
python
chosen
[ { "from": "system", "value": "[1.5.x] Correct final element of version tuple.\n" }, { "from": "human", "value": "VERSION = (1, 5, 0, 'final', 2)\n\ndef get_version(*args, **kwargs):\n # Don't litter django/__init__.py with all the get_version stuff.\n # Only import if it's actually called....
python
chosen
[ { "from": "system", "value": "Remove commented out method call.\n" }, { "from": "human", "value": "# -*- coding: utf-8 -*-\nfrom .base_match import BaseMatchAdapter\nfrom fuzzywuzzy import fuzz\n\n\nclass ClosestMatchAdapter(BaseMatchAdapter):\n \"\"\"\n The ClosestMatchAdapter creates a r...
python
chosen
[ { "from": "system", "value": "Use raw request making in query test\n" }, { "from": "human", "value": "\"\"\"\nTests for the mock of the query endpoint.\n\nhttps://library.vuforia.com/articles/Solution/How-To-Perform-an-Image-Recognition-Query.\n\"\"\"\n\nimport pytest\nimport requests\n\nfrom te...
python
chosen
[ { "from": "system", "value": "Increase rest client pool size to 100\n" }, { "from": "human", "value": "from .base_settings import *\nimport os\n\nINSTALLED_APPS += [\n 'data_aggregator.apps.DataAggregatorConfig',\n 'webpack_loader',\n]\n\nif os.getenv('ENV') == 'localdev':\n DEBUG = Tru...
python
chosen
[ { "from": "system", "value": "Allow descendents of BaseImageStep to override source Image.\n" }, { "from": "human", "value": "from typing import Any, NamedTuple, Optional\n\nimport numpy as np\n\nfrom data.image import image\nfrom puzzle.steps import step\n\n\nclass ImageChangeEvent(NamedTuple):...
python
chosen
[ { "from": "system", "value": "Make 'from abelfunctions import *' work.\n" }, { "from": "human", "value": "\"\"\"\nabelfunctions is a Python library for computing with Abelian functions,\nalgebraic curves, and solving integrable Partial Differential Equations.\n\nThe code is available as a git re...
python
chosen
[ { "from": "system", "value": "Test that pages and posts are filled.\n" }, { "from": "human", "value": "# -*- coding: utf-8 -*-\n\"\"\"\nTesting the wordpress import.\n\nIt will do create a new site with the import_wordpress command\nand use that newly created site to make a build.\n\"\"\"\n\nimp...
python
chosen
[ { "from": "system", "value": "Add congress to service_available group\n\nAdd congress to service_available group. used in tempest plugin\nto check if service is available or not\n\nChange-Id: Ia3edbb545819d76a6563ee50c2dcdad6013f90e9\n" }, { "from": "human", "value": "# Copyright 2015 Intel Corp...
python
chosen
[ { "from": "system", "value": "Change master version information to 0.5.99 (git master)\n\nTodo: We should probably add the smarts to EForge to grab the git\nrevision for master, at least if Dulwich is installed :-)\n" }, { "from": "human", "value": "# -*- coding: utf-8 -*-\n# EForge project mana...
python
chosen
[ { "from": "system", "value": "Update get build path script for conda-build 2.0\n\nIn conda-build 2.0 the config API changed.\n" }, { "from": "human", "value": "import sys\nimport os\nimport yaml\nimport jinja2\nimport glob\nfrom conda_build.config import config\nfrom conda_build.metadata import ...
python
chosen
[ { "from": "system", "value": "Add url namespaces and app_names to apiv1\n" }, { "from": "human", "value": "\"\"\"\nCopyright [2009-2014] EMBL-European Bioinformatics Institute\nLicensed under the Apache License, Version 2.0 (the \"License\");\nyou may not use this file except in compliance with ...
python
chosen
[ { "from": "system", "value": "Reduce normal request timeout to 5 minutes\n" }, { "from": "human", "value": "\n\nPASSWORD_PLACEHOLDER = '*' * 16\n\n# If any remote service does not respond within 10 minutes, time out\nREQUEST_TIMEOUT = 600\n\nALGO_AES = 'aes'\n\nDATA_TYPE_UNKNOWN = None\n\nCOMMCA...
python
chosen
[ { "from": "system", "value": "Fix recursive bug in totuple. Not sure how it got there.\n\n(cherry picked from commit ae1f7beb5188eaf09fc3f7efc1061a15a12aecf2)\n" }, { "from": "human", "value": "import nengo\n\nfrom . import fixpoint as fp\n\n\ndef totuple(a):\n \"\"\"Convert any object (e.g....
python
chosen
[ { "from": "system", "value": "Update client init, use configuration to set default `auth` and `url`\n" }, { "from": "human", "value": "from demands import HTTPServiceClient\n\nfrom yolapy.resources import campaign, partner, site, subscription, user\n\n\nclass Yola(\n HTTPServiceClient, ca...
python
chosen
[ { "from": "system", "value": "Add question desciption for valid parentheses\n" }, { "from": "human", "value": "\n\ndef isValid( s):\n if not s:\n return False\n stack = []\n map = {'(':')', '[':']', '{':'}'}\n for c in s:\n if c in map.keys():\n stack.append(...
python
chosen
[ { "from": "system", "value": "Update magic links for dweet and user links\n" }, { "from": "human", "value": "import re\nfrom django import template\n\nregister = template.Library()\n\n\ndef to_link(m):\n text = m.group('text')\n dweet_id = m.group('dweet_id')\n username = m.group('usern...
python
chosen
[ { "from": "system", "value": "Create unit test base class\n" }, { "from": "human", "value": "# -*- coding: utf-8 -*-\n\"\"\"\n pyfire.tests\n ~~~~~~~~~~~~\n\n All unittests live here\n\n :copyright: (c) 2011 by the pyfire Team, see AUTHORS for more details.\n :license: BSD, see LI...
python
chosen
[ { "from": "system", "value": "Add convenience methods for creating/deleting all tables, for bootstrapping/testing use\n\nSigned-off-by: Joonas Bergius <9be13466ab086d7a8db93edb14ffb6760790b15e@gmail.com>\n" }, { "from": "human", "value": "from __future__ import unicode_literals\nimport os\nimpor...
python
chosen
[ { "from": "system", "value": "Handle empty quota in translate_quota\n" }, { "from": "human", "value": "\"\"\"\nsentry.quotas.base\n~~~~~~~~~~~~~~~~~~\n\n:copyright: (c) 2010-2013 by the Sentry Team, see AUTHORS for more details.\n:license: BSD, see LICENSE for more details.\n\"\"\"\nfrom __futur...
python
chosen
[ { "from": "system", "value": "Call init_notebook_mode only if inside IPython\n" }, { "from": "human", "value": "import plotly.offline as py_offline\n\n### Offline Mode\t\n\ndef go_offline(connected=False):\n\ttry:\n\t\tpy_offline.init_notebook_mode(connected)\n\texcept TypeError:\n\t\t#For older...
python
chosen
[ { "from": "system", "value": "[Win] Fix running node from python.\n\nThere is a mysterious \"WindowsError [error 5] Access is denied\" error is\nthe \"executable\" is not specified under Windows.\n" }, { "from": "human", "value": "#!/usr/bin/env python\n\nimport os\nimport subprocess\nimport sys...
python
chosen
[ { "from": "system", "value": "Change instaflights name in flights_to tests\n" }, { "from": "human", "value": "import unittest\nimport datetime\nimport json\nimport sys\n\nsys.path.append('..')\nimport sabre_dev_studio\nimport sabre_dev_studio.sabre_exceptions as sabre_exceptions\n\n'''\nrequires...
python
chosen
[ { "from": "system", "value": "Add a comment with a TODO\n" }, { "from": "human", "value": "import re\n\n__all__ = [\"recursively_remove_ltac\"]\n\nLTAC_REG = re.compile(r'^\\s*(?:Local\\s+|Global\\s+)?Ltac\\s+([^\\s]+)', re.MULTILINE)\n\ndef recursively_remove_ltac(statements, exclude_n=3):\n ...
python
chosen
[ { "from": "system", "value": "Print the time of checking status at github.\n" }, { "from": "human", "value": "import argparse\nimport json\nimport os\nimport time\n\nimport requests\nfrom tardis import __githash__ as tardis_githash\n\n\nparser = argparse.ArgumentParser(description=\"Run slow int...
python
chosen
[ { "from": "system", "value": "Add comments to Perfect Game solution\n" }, { "from": "human", "value": "#!/usr/bin/env python\n\nimport sys\n\nif len(sys.argv) < 2:\n sys.exit('Usage: %s file.in' % sys.argv[0])\n \nfile = open(sys.argv[1], 'r')\nT = int(file.readline())\nfor i in xrange(1, T+1)...
python
chosen
[ { "from": "system", "value": "Increase cache tile duration from 6 hours to 1 week\n" }, { "from": "human", "value": "import logging\nfrom time import time\n\nfrom pylons import tmpl_context as c\n\nfrom adhocracy import config\nfrom adhocracy.lib.cache import memoize\n\nlog = logging.getLogger(_...
python
chosen
[ { "from": "system", "value": "Split Energy and Environment, change Civil Liberties to Social Justice\n" }, { "from": "human", "value": "from django.core.management.base import BaseCommand\n\nfrom topics.models import Topic\n\n\nclass Command(BaseCommand):\n help = u'Bootstrap the topic lists ...
python
chosen
[ { "from": "system", "value": "Fix bug in 'multiply' support\n" }, { "from": "human", "value": "import sys\n\ndef add_all(nums):\n\treturn sum(nums)\n\ndef multiply_all(nums):\n\treturn reduce(lambda a, b: a * b, nums)\n\nif __name__== '__main__':\n\tcommand = sys.argv[1]\n\tnums = map(float, sys...
python
chosen
[ { "from": "system", "value": "Fix timestamp comparison on ciresources\n" }, { "from": "human", "value": "import MySQLdb\nfrom datetime import datetime, timedelta\n\ndb = MySQLdb.connect(host=\"10.0.196.2\",\n user=\"ciuser\",\n passwd=\"secret\",\n ...
python
chosen
[ { "from": "system", "value": "Comment out the pyserial TestIsCorrectVariant test.\n" }, { "from": "human", "value": "from __future__ import (absolute_import, print_function, unicode_literals)\nimport os\nimport sys\nlib_path = os.path.abspath('../')\nsys.path.append(lib_path)\n\nimport io\nimpor...
python
chosen
[ { "from": "system", "value": "Revert the removal of an unused import (in [14175]) that was referenced in documentation. Thanks for noticing, clong.\n\ngit-svn-id: 4f9f921b081c523744c7bf24d959a0db39629563@14359 bcc190cf-cafb-0310-a4f2-bffc1f526a37\n" }, { "from": "human", "value": "from django.co...
python
chosen
[ { "from": "system", "value": "Add debugging CLI hook for email sending\n" }, { "from": "human", "value": "from typing import Tuple\n\nfrom opwen_email_server import azure_constants as constants\nfrom opwen_email_server import config\nfrom opwen_email_server.services.queue import AzureQueue\nfrom...
python
chosen
[ { "from": "system", "value": "Remove script crash when no sonos is found\n" }, { "from": "human", "value": "#!/usr/bin/env python3\n#\n# By Henrik Lilleengen (mail@ithenrik.com)\n#\n# Released under the MIT License: https://opensource.org/licenses/MIT\n\nimport soco, sys\n\nspeakers = list(soco....
python
chosen
[ { "from": "system", "value": "Remove an unnecessary method override\n" }, { "from": "human", "value": "from __future__ import unicode_literals\n\nfrom django_webtest import WebTest\n\nfrom .uk_examples import UK2015ExamplesMixin\n\n\nclass TestPostsView(UK2015ExamplesMixin, WebTest):\n\n def ...
python
chosen