conversations
listlengths
2
3
source
stringclasses
1 value
stack
stringclasses
1 value
[ { "from": "system", "value": "STY: Switch to relative imports and fix pep-8\n" }, { "from": "human", "value": "\"\"\"\nDatasets module\n\"\"\"\n#__all__ = filter(lambda s:not s.startswith('_'),dir())\nimport anes96, cancer, committee, ccard, copper, cpunish, elnino, grunfeld, longley, \\\n ...
python
chosen
[ { "from": "system", "value": "Remove extra newlines added during editing\n" }, { "from": "human", "value": "from cs251tk.student import remove\nfrom cs251tk.student import clone_student\nfrom cs251tk.student import stash\nfrom cs251tk.student import pull\nfrom cs251tk.student import checkout_dat...
python
chosen
[ { "from": "system", "value": "Define Progress as a Class and add more comments\n" }, { "from": "human", "value": "from abc import abstractmethod\nfrom collections import namedtuple\n\nfrom django.core.management.base import BaseCommand\nfrom django.core.management.base import CommandError\n\nPro...
python
chosen
[ { "from": "system", "value": "Enable real-time celery-based search index\n" }, { "from": "human", "value": "HAYSTACK_DEFAULT_OPERATOR = 'AND'\nHAYSTACK_SEARCH_RESULTS_PER_PAGE = 70\nHAYSTACK_CONNECTIONS = {\n 'default': {\n 'ENGINE': 'haystack.backends.elasticsearch_backend.Elasticsear...
python
chosen
[ { "from": "system", "value": "Implement a custom fixture for the plugin\n" }, { "from": "human", "value": "# -*- coding: utf-8 -*-\n\nimport pytest\n\n\ndef pytest_addoption(parser):\n group = parser.getgroup('{{cookiecutter.plugin_name}}')\n group.addoption(\n '--foo',\n act...
python
chosen
[ { "from": "system", "value": "Add project details to codebase\n" }, { "from": "human", "value": "import logging\n\n\nclass AugmentFilter(logging.Filter):\n\n def __init__(self, name='', args=None):\n super(AugmentFilter, self).__init__(name)\n self._args = args\n\n def filter...
python
chosen
[ { "from": "system", "value": "Update unittests for Task 4\n" }, { "from": "human", "value": "__author__ = 'Nino Bašić <nino.basic@fmf.uni-lj.si>'\n\nimport unittest\nfrom jadrolinija import KolonaVozil\n\n\nclass KolonaVozilTest(unittest.TestCase):\n\n def test_init(self):\n kv = Kolon...
python
chosen
[ { "from": "system", "value": "Exclude from coverage the code pathways that are specific to Python 2.\n" }, { "from": "human", "value": "import sys\nfrom types import MethodType\n\n# True if we are running on Python 3.\nPY3 = sys.version_info[0] == 3\n\n\nif PY3:\n string_types = (str,)\nelse:...
python
chosen
[ { "from": "system", "value": "Test execution: Remove unneeded variable\n" }, { "from": "human", "value": "#! /bin/python3\n\n\"\"\"\nThis program is free software: you can redistribute it and/or modify\nit under the terms of the GNU General Public License as published by\nthe Free Software Found...
python
chosen
[ { "from": "system", "value": "Switch from ORM to Core\n" }, { "from": "human", "value": "from sqlalchemy.ext.declarative import declarative_base\nfrom sqlalchemy import create_engine\n\nengine = create_engine('postgresql://wn:wn@localhost:5432/wndb')\n\nBase = declarative_base()\n\nfrom sqlalche...
python
chosen
[ { "from": "system", "value": "Fix newline at the end of file.\n" }, { "from": "human", "value": "# -*- coding: utf-8 -*-\n\n\nfrom os import path\n\nfrom flask import Flask\n\n\nPACKAGE_DIR = path.dirname(path.realpath(__file__))\nROOT_DIR = path.realpath(path.join(PACKAGE_DIR, '..'))\n\nROOT_UR...
python
chosen
[ { "from": "system", "value": "Use http instead of https\n" }, { "from": "human", "value": "# Copyright 2014-2019 Rumma & Ko Ltd\n# License: BSD (see file COPYING for details)\n\n\"\"\"\nAdds functionality for generating printable documents using\nLibreOffice and the `appy.pod <http://appyframewo...
python
chosen
[ { "from": "system", "value": "Revert \"Bump dev version to 0.3.0-dev.1\"\n\nThis reverts commit facc1caaca87e680321be0654882d6c5570bc2ad.\n" }, { "from": "human", "value": "# mpf-monitor\n__version__ = '0.3.0-dev.1'\n__short_version__ = '0.3'\n__bcp_version__ = '1.1'\n__config_version__ = '4'\n_...
python
chosen
[ { "from": "system", "value": "Remove index and check filename\n" }, { "from": "human", "value": "#!/usr/bin/env python\n\n\"\"\"Convert a CSV table into a latex tabular using pandas.\"\"\"\nimport argparse\nimport pandas as pd\n\n\ndef convert(filename, transpose=False):\n \"\"\"convert csv t...
python
chosen
[ { "from": "system", "value": "Return 400 for inexistant accounts\n" }, { "from": "human", "value": "import logging\n\nfrom django.conf import settings\nfrom django.http import HttpResponse\nfrom django.views.decorators.csrf import csrf_exempt\n\nfrom .models import Notification, Account\n\nlogge...
python
chosen
[ { "from": "system", "value": "Make jumping between changes loop back around\n" }, { "from": "human", "value": "import sublime\nimport sublime_plugin\ntry:\n from GitGutter.view_collection import ViewCollection\nexcept ImportError:\n from view_collection import ViewCollection\n\nclass GitGu...
python
chosen
[ { "from": "system", "value": "Simplify test of rsqrt function.\n" }, { "from": "human", "value": "import unittest\n\nimport numpy\n\nimport chainer.functions as F\nfrom chainer import testing\n\n\ndef make_data(dtype, shape):\n x = numpy.random.uniform(0.1, 5, shape).astype(dtype)\n gy = n...
python
chosen
[ { "from": "system", "value": "test: Split IAM template tests with paramtrize\n\nSee also: #208\n" }, { "from": "human", "value": "\"\"\"Test IAM Policy templates are valid JSON.\"\"\"\nimport jinja2\n\nfrom foremast.iam.construct_policy import render_policy_template\nfrom foremast.utils.template...
python
chosen
[ { "from": "system", "value": "Tweak olfactory input stimulus to produce more interesting output.\n" }, { "from": "human", "value": "#!/usr/bin/env python\n\n\"\"\"\nGenerate sample olfactory model stimulus.\n\"\"\"\n\nimport numpy as np\nimport h5py\n\nosn_num = 1375\n\ndt = 1e-4 # time step\nOt...
python
chosen
[ { "from": "system", "value": "Add another check for a failed googleapiclient upgrade.\n\nThis adds one more check for a failed 1.2 -> 1.3 upgrade, specifically in the\n`apiclient` import (which was the only import available in 1.2). Even combined\nwith the check in setup.py, this won't catch everything, but...
python
chosen
[ { "from": "system", "value": "Update for fixing odd Japanese\n\nSelenium is \"セレニウム\" in Japanese. (Most people don't write Selenium in Japanese, by the way)" }, { "from": "human", "value": "# Japanese Language Test - Python 3 Only!\nfrom seleniumbase.translate.japanese import セレンテストケース # noqa\...
python
chosen
[ { "from": "human", "value": "Add a logger for dbmigrator that writes to stdout\n\nFor example in a migration file\n20160128111115_mimetype_removal_from_module_files.py:\n\n```\nfrom dbmigrator import logger\n\nlogger.info('message from migration')\n```\n\nYou will see this when you run the migration:\n\n```...
python
chosen
[ { "from": "system", "value": "Add smoketest for convering CoverageDataset to str.\n" }, { "from": "human", "value": "# Copyright (c) 2016 Unidata.\n# Distributed under the terms of the MIT License.\n# SPDX-License-Identifier: MIT\nimport warnings\n\nfrom siphon.testing import get_recorder\nfrom ...
python
chosen
[ { "from": "system", "value": "Add simplejson as requirement for python 2.5\n" }, { "from": "human", "value": "\"\"\"\nFlask-MongoKit\n--------------\n\nFlask-MongoKit simplifies to use MongoKit, a powerful MongoDB ORM in Flask \napplications.\n\nLinks\n`````\n\n* `documentation <http://pack...
python
chosen
[ { "from": "system", "value": "Update to version 0.2.0 (according with semantic versioning)\n" }, { "from": "human", "value": "from setuptools import setup, find_packages\nsetup(name='diaspy',\n version='0.1.0',\n author='Moritz Kiefer',\n author_email='moritz.kiefer@gmail.com',\n ...
python
chosen
[ { "from": "system", "value": "Add a commit failed test\n" }, { "from": "human", "value": "import safe\n\n\ndef test_simple_exception():\n class MockReponse(object):\n def json(self):\n return {'status': False,\n 'method': 'synchronize',\n ...
python
chosen
[ { "from": "system", "value": "Add Framework::Pytest to list of classifiers\n" }, { "from": "human", "value": "from setuptools import setup\n\n\nsetup(\n name=\"pytest-cpp\",\n version='0.4',\n packages=['pytest_cpp'],\n entry_points={\n 'pytest11': ['cpp = pytest_cpp.plugin'],...
python
chosen
[ { "from": "system", "value": "Use io.open with encoding='utf-8' and flake8 compliance\n" }, { "from": "human", "value": "import os, io\nfrom setuptools import setup, find_packages\n\nlong_description = (\n io.open('README.rst', encoding='utf-8').read()\n + '\\n' +\n io.open('CHANGES.txt...
python
chosen
[ { "from": "system", "value": "Add add_remote to pygit2 implementation\n" }, { "from": "human", "value": "from __future__ import absolute_import\n\nimport pygit2\n\nfrom .base_git import NoSuchRemote\nfrom .plain_git import PlainGit\n\n\nclass Pygit2Git(PlainGit):\n @staticmethod\n def is_o...
python
chosen
[ { "from": "system", "value": "Add DAG & non-DAG adjacency dicts\n" }, { "from": "human", "value": "from __future__ import absolute_import\nfrom __future__ import print_function\nfrom __future__ import division\n\n\ndef _previsit():\n pass\n\ndef _postvisit():\n pass\n\ndef _dfs_explore():\...
python
chosen
[ { "from": "system", "value": "Handle dask TimeoutError exception in tests\n" }, { "from": "human", "value": "\n# pylint: disable=wildcard-import, missing-docstring, protected-access\n# pylint: disable=attribute-defined-outside-init, invalid-name, no-self-use\n# pylint: disable=wrong-import-order...
python
chosen
[ { "from": "system", "value": "Add Python 3.2 trove classifier\n" }, { "from": "human", "value": "from setuptools import setup\n\nsetup(name='covenant',\n version='0.1.0',\n description='Code contracts for Python 3',\n author='Kamil Kisiel',\n author_email='kamil@kamilkisiel.n...
python
chosen
[ { "from": "system", "value": "Patch 0.2.1 to remove print\n" }, { "from": "human", "value": "from setuptools import setup\n\n\nsetup(\n name='icapservice',\n version='0.2.0',\n description='ICAP service library for Python',\n author='Giles Brown',\n author_email='giles_brown@hotma...
python
chosen
[ { "from": "system", "value": "Set classifier for Python 3.2\n\nFor #6\n" }, { "from": "human", "value": "from setuptools import setup\n\nwith open('README.md') as file:\n # Try my best to have at least the intro in Markdown/reST.\n long_description = file.read().partition('<!-- END long_de...
python
chosen
[ { "from": "system", "value": "Add \"Python 2\" classifier since it works (according to Travis CI).\n" }, { "from": "human", "value": "#!/usr/bin/env python\nfrom setuptools import setup\n\nsetup(\n name='rinse',\n version='0.1.2',\n description='Python3 SOAP client built with lxml and r...
python
chosen
[ { "from": "system", "value": "Add missing package name and bump version\n" }, { "from": "human", "value": "from setuptools import setup\n\ndef readme():\n with open('README.rst') as f:\n return f.read()\n\nsetup(name='housecanary',\n version='0.5',\n description='Client Wrapp...
python
chosen
[ { "from": "system", "value": "Update `djangorestframework` from 2.4.3 to 2.4.4\n" }, { "from": "human", "value": "from setuptools import find_packages, setup\n\n\nversion = '6.0.0'\n\n\ninstall_requires = (\n 'djangorestframework>=2.4.3,<3',\n 'incuna_mail>=2.0.0,<3',\n)\n\nextras_require ...
python
chosen
[ { "from": "system", "value": "Add missing 'boltons' package & clean up\n" }, { "from": "human", "value": "#!/usr/bin/env python\n\nimport os\nimport sys\n\nfrom setuptools import setup\n\nreadme = open('README.rst').read()\ndoclink = \"\"\"\nDocumentation\n-------------\n\nThe full documentation...
python
chosen
[ { "from": "system", "value": "Use io.open with encoding='utf-8' and flake8 compliance\n" }, { "from": "human", "value": "import os, io\nfrom setuptools import setup, find_packages\n\nlong_description = (\n io.open('README.rst', encoding='utf-8').read()\n + '\\n' +\n io.open('CHANGES.txt...
python
chosen
[ { "from": "system", "value": "Simplify description and MANIFEST.in suits me fine.\n" }, { "from": "human", "value": "from setuptools import setup, find_packages\n\n\nsetup(name='django-forge',\n version=__import__('forge').__version__,\n author='Justin Bronn',\n author_email='jbro...
python
chosen
[ { "from": "system", "value": "Fix homepage url to point to the correct repo" }, { "from": "human", "value": "#!/usr/bin/env python\nfrom setuptools import find_packages, setup\n\nsetup(\n name='Flask-uWSGI-WebSocket',\n version='0.6.1',\n url='https://github.com/zeekay/flask_uwsgi_webso...
python
chosen
[ { "from": "system", "value": "Add 'Python :: 3 :: Only' classifier\n" }, { "from": "human", "value": "from setuptools import setup\n\nfrom rohrpost import __version__\n\n\ndef read(filepath):\n with open(filepath, \"r\", encoding=\"utf-8\") as f:\n return f.read()\n\n\nsetup(\n name...
python
chosen
[ { "from": "system", "value": "Increase flexibility of upload sample\n" }, { "from": "human", "value": "#!/usr/bin/python\n# -*- coding: utf-8 -*-\nfrom setuptools import setup\n\nsetup(\n name='pymisp',\n version='1.1.2',\n author='Raphaël Vinot',\n author_email='raphael.vinot@circl....
python
chosen
[ { "from": "system", "value": "Set API key directly in test runner\n" }, { "from": "human", "value": "\"\"\"\nCopyright (c) 2010-2013, Anthony Garcia <anthony@lagg.me>\nDistributed under the ISC License (see LICENSE)\n\"\"\"\n\nfrom distutils.core import setup, Command\nfrom distutils.errors impo...
python
chosen
[ { "from": "system", "value": "Add south as a dependency.\n" }, { "from": "human", "value": "#\n# Copyright 2013 Cisco Systems\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 obtain a co...
python
chosen
[ { "from": "system", "value": "Add requests as installation dependency." }, { "from": "human", "value": "# -*- coding: utf-8 -*-\n\nfrom distutils.core import setup\nsetup(\n name='nutshell',\n packages=['nutshell'],\n version='0.1.1',\n description='A minimal python library to access...
python
chosen
[ { "from": "system", "value": "Include Package Data was missing.\n" }, { "from": "human", "value": "import os\nfrom setuptools import setup, find_packages\n\ndef read(fname):\n return open(os.path.join(os.path.dirname(__file__), fname)).read()\n\nsetup(\n name = 'django-helpline-faq',\n ...
python
chosen
[ { "from": "system", "value": "Add upper limit of pandas\n" }, { "from": "human", "value": "import os\nfrom setuptools import setup\n\n\ndef read(fname):\n return open(os.path.join(os.path.dirname(__file__), fname)).read()\n\n\nsetup(name='windpowerlib',\n version='0.1.2dev',\n descr...
python
chosen
[ { "from": "system", "value": "Update dependencies and bump patch version\n\nbudgetdatapackage was missing from the dependencies and has now\nbeen added.\n" }, { "from": "human", "value": "from setuptools import setup, find_packages\nimport sys, os\n\nversion = '0.1.0'\n\ndescription = \"CKAN ext...
python
chosen
[ { "from": "system", "value": "Add tests requirements, fix console scripts definitions\n" }, { "from": "human", "value": "from setuptools import find_packages, setup\n\nsetup(\n name='ngx-task',\n version='0.1',\n description='Testimonial for candidates to show up their code-foo',\n a...
python
chosen
[ { "from": "system", "value": "DOC: Change rtfd -> readthedocs in package description\n" }, { "from": "human", "value": "from setuptools import setup\n\n# \"import\" __version__\nfor line in open('nbsphinx.py'):\n if line.startswith('__version__'):\n exec(line)\n break\n\nsetup(\...
python
chosen
[ { "from": "system", "value": "Put in some version requirements.\n" }, { "from": "human", "value": "import os\nfrom setuptools import setup, find_packages\n\nsetup(name='morepath',\n version = '0.1dev',\n description=\"A micro web-framework with superpowers\",\n author=\"Martijn Fa...
python
chosen
[ { "from": "system", "value": "Add jianfan to python package installation\n" }, { "from": "human", "value": "from setuptools import setup\nfrom distutils.core import Command\nimport os\nimport sys\n\n\nclass TestCommand(Command):\n description = \"Run tests\"\n user_options = []\n\n def ...
python
chosen
[ { "from": "system", "value": "Disable strict C90 flag that appears to be accidentally being used by distutils\n" }, { "from": "human", "value": "#!/usr/local/bin/python3\n\nfrom distutils.core import setup, Extension\n\nsetup(\n name = 'lazy',\n version = '1.0',\n description = 'Lazy',\...
python
chosen
[ { "from": "system", "value": "Set changelog_file for invocations release task, which now dry-runs ok\n" }, { "from": "human", "value": "from invoke import Collection\nfrom invocations import docs\nfrom invocations.checks import blacken\nfrom invocations.packaging import release\nfrom invocations...
python
chosen
[ { "from": "system", "value": "Create lazy launcher in setUp.\n" }, { "from": "human", "value": "import unittest\n\nfrom gtlaunch import Launcher\n\n\nclass MockOptions(object):\n def __init__(self):\n self.verbose = False\n self.config = ''\n self.project = ''\n\n\nclass ...
python
chosen
[ { "from": "system", "value": "Modify receiver to prevent using in future\n" }, { "from": "human", "value": "from lexos.receivers.base_receiver import BaseReceiver\n\n\nclass StatsReceiver(BaseReceiver):\n def __init__(self):\n \"\"\"So far there is no frontend option for statistics ana...
python
chosen
[ { "from": "system", "value": "Add params in BaseContext abtract methods\n" }, { "from": "human", "value": "from abc import ABCMeta, abstractmethod\n\n\nclass BaseContext():\n __metaclass__ = ABCMeta\n\n @abstractmethod\n def download(self):\n pass\n\n @abstractmethod\n def ...
python
chosen
[ { "from": "system", "value": "[FIX] Check if quants are moved and pass moves to done to avoid duplication\n" }, { "from": "human", "value": "# -*- coding: utf-8 -*-\n# See README file for full copyright and licensing details.\n\nfrom openerp import models, api\n\n\nclass PosPicking(models.Model)...
python
chosen
[ { "from": "system", "value": "[REV] document_page_project: Revert to Beta as document_page is Beta\n" }, { "from": "human", "value": "# Copyright 2019 ForgeFlow S.L. (https://www.forgeflow.com) - Lois Rilo\n# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html).\n\n{\n \"name\":...
python
chosen
[ { "from": "system", "value": "Move ok response creation to pytest fixture\n" }, { "from": "human", "value": "\nimport os\nimport pytest\nimport requests\nfrom cisco_olt_http import operations\nfrom cisco_olt_http.client import Client\n\n\n@pytest.fixture\ndef data_dir():\n return os.path.absp...
python
chosen
[ { "from": "system", "value": "Remove disallowed fields before resaving on migrations.\n\n- TODO: fix this properly.\n" }, { "from": "human", "value": "\"\"\"\nAdd _week_start_at field to all documents in all collections\n\"\"\"\nfrom backdrop.core.bucket import utc\nfrom backdrop.core.records im...
python
chosen
[ { "from": "system", "value": "Hide ctypes import error until Plot() is called.\n" }, { "from": "human", "value": "\n__version__ = \"0.5.0\"\n\nfrom sympy.core import *\n\nfrom series import *\nfrom simplify import *\nfrom solvers import *\nfrom matrices import *\nfrom geometry import *\nfrom pol...
python
chosen
[ { "from": "system", "value": "Add unit test for expand_axis_label\n" }, { "from": "human", "value": "import pickle\nfrom six.moves import range\n\nfrom fuel.utils import do_not_pickle_attributes\n\n\n@do_not_pickle_attributes(\"non_pickable\", \"bulky_attr\")\nclass TestClass(object):\n def _...
python
chosen
[ { "from": "system", "value": "Add more tests for the vault commandhelper\n" }, { "from": "human", "value": "#!/usr/bin/env python\n# -*- coding: utf-8 -*-\n\nimport unittest\n\nclass VaultShellTests(unittest.TestCase):\n def test_basic(self):\n print \"test basic. Pass\"\n" }, { ...
python
chosen
[ { "from": "system", "value": "Write to bouncer config file\n" }, { "from": "human", "value": "#!/usr/bin/env python\n\nimport sys\nimport yaml\n\ndef read_parts_from_stdin():\n data = sys.stdin.read()\n parts_string = data.split(\"----\")\n parts_parsed = []\n for part in parts_strin...
python
chosen
[ { "from": "system", "value": "Add functions to add shapes and iterate over each shape to render.\n" }, { "from": "human", "value": "#Imports\nimport pygame\nfrom pygame.locals import *\n\nfrom OpenGL.GL import *\nfrom OpenGL.GLU import *\n\nfrom shapes import Shape, Cube\n\n#Create a game class\...
python
chosen
[ { "from": "system", "value": "Fix that crazy error that would cause enless looping...\n" }, { "from": "human", "value": "#i = 0\n#numbers = []\n\n#while i < 6:\n# print \"At the top i is %d\" % i\n# numbers.append(i)\n#\n# i += 1\n# print \"Numbers now: \", numbers\n# print \"At t...
python
chosen
[ { "from": "system", "value": "Update script to start, stop and status by name.\n" }, { "from": "human", "value": "# list_aws_hosts.py\n# list all active ec2 hosts\n\nfrom boto import ec2 \nimport pw\n\ncreds = pw.stream['aws']\n\nec2conn = ec2.connection.EC2Connection(creds['id'], creds['key'] )...
python
chosen
[ { "from": "system", "value": "Add missing attributes in TPSProcessor.\n\nSigned-off-by: shanks <4508bc7244505cbe28c7ec6ff0c99c8246ca3de6@redhat.com>\n" }, { "from": "human", "value": "# Copyright (C) 2017 Red Hat, Inc.\n#\n# fedmsg_meta_umb is free software; you can redistribute it and/or\n# mod...
python
chosen
[ { "from": "system", "value": "Fix doc test failure parsing\n" }, { "from": "human", "value": "def parseFailDetails(failDetails):\n \"\"\" Parse the line number of the doctest failure\"\"\"\n import re\n failDetails = failDetails.split(',')\n lineNo = -1\n if len(failDetails) == 3:...
python
chosen
[ { "from": "system", "value": "Use django 1.10 patterns style" }, { "from": "human", "value": "from django.conf.urls import patterns\n\n# Uncomment the next two lines to enable the admin:\n# from django.contrib import admin\n# admin.autodiscover()\n\nurlpatterns = patterns('',\n # Example:\n ...
python
chosen
[ { "from": "system", "value": "Fix type of EventIndex fields\n" }, { "from": "human", "value": "from haystack import indexes\nfrom .models import Event, Place, PublicationStatus\nfrom django.utils.html import strip_tags\n\n\nclass EventIndex(indexes.SearchIndex, indexes.Indexable):\n text = in...
python
chosen
[ { "from": "system", "value": "Change location of default settings in WSGI\n" }, { "from": "human", "value": "\"\"\"\nWSGI config for workout_manager project.\n\nThis module contains the WSGI application used by Django's development server\nand any production WSGI deployments. It should expose a ...
python
chosen
[ { "from": "system", "value": "Fix every single async task was broken\n" }, { "from": "human", "value": "from celery.task import task\n\nfrom . import models\nfrom . import send_backends\n\n\n@task\ndef send_daily_email_blasts(blast_pk):\n blast = models.DailyEmailBlast.objects.get(pk=blast_pk...
python
chosen
[ { "from": "system", "value": "ENH: Allow directory of files to be indexed\n\nIn the Data directory, there may be sub-directories of files that need to\nbe kept separate, but all of them need to be indexed.\n" }, { "from": "human", "value": "#!/usr/bin/env python\n\n\"\"\"Script to read data file...
python
chosen
[ { "from": "system", "value": "Allow \"jupyter nbextension install/enable --py jupytext\"\n" }, { "from": "human", "value": "\"\"\"Read and write Jupyter notebooks as text files\"\"\"\n\nfrom .jupytext import readf, writef, writes, reads\nfrom .formats import NOTEBOOK_EXTENSIONS, guess_format, ge...
python
chosen
[ { "from": "system", "value": "Use format=5 in YT search to prevent \"embedding disabled\"\n" }, { "from": "human", "value": "from gdata.youtube.service import YouTubeService, YouTubeVideoQuery\nfrom django.utils.encoding import smart_str\nimport re\n\nclass YoutubeMusic:\n def __init__(self):...
python
chosen
[ { "from": "system", "value": "Replace get_base_dir and set_base_dir with more abstract methods get and set\n" }, { "from": "human", "value": "import os\nimport ConfigParser as configparser\n\nclass Config(object):\n def __init__(self):\n self.config = configparser.RawConfigParser()\n ...
python
chosen
[ { "from": "system", "value": "Fix get value more safe\n" }, { "from": "human", "value": "from pymemcache.client.hash import HashClient\n\n\nclass Client(HashClient):\n def get_many(self, keys, gets=False, *args, **kwargs):\n # pymemcache's HashClient may returns {'key': False}\n ...
python
chosen
[ { "from": "system", "value": "Add assignment tag util for rendering chunks to tpl context\n" }, { "from": "human", "value": "import os\n\nfrom django import template\nregister = template.Library()\n\n@register.filter\ndef is_parent_of(page1, page2):\n \"\"\"\n Determines whether a given pa...
python
chosen
[ { "from": "system", "value": "Handle using the input function in python 2 for getting username for examples\n\nPreviously this used the builtin input function to get the username. In\npython 3 this is fine, but if python 2 this is equivalent to\n\neval(raw_input(prompt))\n\nand thus tried to evaluate the u...
python
chosen
[ { "from": "system", "value": "Convert numpy int to native int for JSON serialization\n" }, { "from": "human", "value": "from analyses.mimp import glycosylation_sub_types, run_mimp\nfrom helpers.plots import stacked_bar_plot\n\nfrom ..store import counter\n\n\n@counter\n@stacked_bar_plot\ndef gai...
python
chosen
[ { "from": "system", "value": "Fix Runtime warnings on async tests\n" }, { "from": "human", "value": "import pytest\n\nfrom ratelimiter import RateLimiter\n\n@pytest.mark.asyncio\nasync def test_alock():\n rl = RateLimiter(max_calls=10, period=0.01)\n\n assert rl._alock is None\n\n async...
python
chosen
[ { "from": "system", "value": "Add query_entities to functions module import\n" }, { "from": "human", "value": "from .defer_except import defer_except\nfrom .mock import create_mock_engine, mock_engine\nfrom .render import render_expression, render_statement\nfrom .sort_query import sort_query, Q...
python
chosen
[ { "from": "system", "value": "Remove debug task from Celery\n" }, { "from": "human", "value": "from __future__ import absolute_import\n\nimport os\nfrom celery import Celery\nfrom django.conf import settings\n\n# set the default Django settings module for the 'celery' program.\nos.environ.setdef...
python
chosen
[ { "from": "system", "value": "Tag commit for v0.0.8-master generated by gitmake.py\n" }, { "from": "human", "value": "major = 0\nminor=0\npatch=0\nbranch=\"dev\"\ntimestamp=1376412824.91" }, { "from": "gpt", "value": "major = 0\nminor=0\npatch=8\nbranch=\"master\"\ntimestamp=13764128...
python
chosen
[ { "from": "system", "value": "Remove url inlude for Django 2.0\n" }, { "from": "human", "value": "from django.conf.urls import include, url\nfrom django.contrib import admin\nfrom example_app.views import ChatterBotAppView, ChatterBotApiView\n\n\nurlpatterns = [\n url(r'^$', ChatterBotAppView...
python
chosen
[ { "from": "system", "value": "Fix up bad last commit\n" }, { "from": "human", "value": "def parse_app_page(response):\n # Should always be able to grab a title\n title = response.xpath('//div[@class = \"panel panel-default panel-gameinfo\"]/div[@class = \"panel-heading\"]/text()').extract(...
python
chosen
[ { "from": "system", "value": "Remove unused custom functions `local_tz_to_utc`, `utc_to_local_tz`\n" }, { "from": "human", "value": "\"\"\"\nbyceps.util.datetime.timezone\n~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\n\nTimezone helpers\n\n:Copyright: 2006-2021 Jochen Kupperschmidt\n:License: Revised BSD (see ...
python
chosen
[ { "from": "system", "value": "Rework imports and ignore known mypy issues\n" }, { "from": "human", "value": "# Copyright 2018 Donald Stufft and individual contributors\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may not use this file except in compliance with t...
python
chosen
[ { "from": "system", "value": "Fix for pypy compatibility: must super's __init__\n" }, { "from": "human", "value": "\"\"\"\nShared exception.\n\"\"\"\n\n\nclass BadRequestError(Exception):\n pass\n\n\nclass ConflictError(Exception):\n pass\n\n\nclass NotFoundError(Exception):\n\n def __i...
python
chosen
[ { "from": "system", "value": "Include the entire existing environment for integration tests subprocesses\n" }, { "from": "human", "value": "import multiprocessing\nimport os\nfrom pathlib import PurePath\nimport subprocess\nimport sys\nimport tempfile\nfrom textwrap import dedent\nimport unittes...
python
chosen
[ { "from": "system", "value": "Add option to visualize data in reverse\n" }, { "from": "human", "value": "from __future__ import division\n\nimport argparse\nimport cv2\nimport h5py\nimport util\n\ndef main():\n parser = argparse.ArgumentParser()\n parser.add_argument('hdf5_fname', type=str...
python
chosen
[ { "from": "system", "value": "Put import back on top\n" }, { "from": "human", "value": "from dateutil.relativedelta import relativedelta\nfrom django.utils import timezone\n\n\nclass UserDeletionManagerMixin:\n def users_to_notify(self):\n \"\"\"Finds all users who have been inactive a...
python
chosen
[ { "from": "system", "value": "Add sleep after nickserv identify\n" }, { "from": "human", "value": "from motobot import hook\nfrom time import sleep\n\n\n@hook('PING')\ndef handle_ping(bot, context, message):\n \"\"\" Handle the server's pings. \"\"\"\n bot.send('PONG :' + message.params[-1...
python
chosen
[ { "from": "system", "value": "Fix to use get_serializer_class method instead of serializer_class\n" }, { "from": "human", "value": "class NestedViewSetMixin(object):\n def get_queryset(self):\n \"\"\"\n Filter the `QuerySet` based on its parents as defined in the\n `seria...
python
chosen
[ { "from": "system", "value": "Allow for non-ascii characters in password_hash\n" }, { "from": "human", "value": "from __future__ import absolute_import, division, print_function, with_statement, unicode_literals\n\nimport os\nimport binascii\nimport hashlib\nimport oz.app\n\nfrom .middleware imp...
python
chosen
[ { "from": "system", "value": "Include analysis detail view URL in message\n" }, { "from": "human", "value": "from django.contrib import messages\nfrom django.contrib.auth import get_user_model\n\nfrom django.contrib.auth.mixins import LoginRequiredMixin\nfrom django.utils.translation import uget...
python
chosen
[ { "from": "system", "value": "Add another proxy server example string\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 comman...
python
chosen