conversations
listlengths
2
3
source
stringclasses
1 value
stack
stringclasses
1 value
[ { "from": "system", "value": "Add url mapping for EntryDetailAPIView\n" }, { "from": "human", "value": "# -*- coding: utf-8 -*-\n#\n# (c) 2014 Bjoern Ricks <bjoern.ricks@gmail.com>\n#\n# See LICENSE comming with the source of 'trex' for details.\n#\n\nfrom django.conf.urls import patterns, inclu...
python
chosen
[ { "from": "system", "value": "Set is_found in AppleFrameworks constructor\n\nSet is_found in AppleFrameworks constructor, rather than overriding the\nfound() method, as other superclass methods may access is_found.\n" }, { "from": "human", "value": "# Copyright 2013-2017 The Meson development te...
python
chosen
[ { "from": "system", "value": "Add new approach on taglist get_queryset\n" }, { "from": "human", "value": "# -*- encoding: utf-8 -*-\nfrom django.utils import timezone\nfrom django.contrib.sites.models import get_current_site\n\nfrom opps.views.generic.list import ListView\nfrom opps.containers.m...
python
chosen
[ { "from": "system", "value": "Remove globus interface from mcapi - now in its own server\n" }, { "from": "human", "value": "#!/usr/bin/env python\n\nfrom mcapi.mcapp import app, mcdb_connect\nfrom mcapi import utils, access\nfrom mcapi import objects, cache\nfrom mcapi.user import account, userg...
python
chosen
[ { "from": "system", "value": "Allow images in limited markup for descriptions\n" }, { "from": "human", "value": "from jingo import register\nimport jinja2\n\n\n# TODO: Allow configurable whitelists\nALLOWED_TAGS = [\n 'a', 'abbr', 'br', 'acronym', 'b', 'blockquote', 'code', 'em', 'i', 'li',\n...
python
chosen
[ { "from": "system", "value": "Add warning to widget namespace import.\n" }, { "from": "human", "value": "from .widget import Widget, DOMWidget, CallbackDispatcher, register\n\nfrom .widget_bool import Checkbox, ToggleButton\nfrom .widget_button import Button\nfrom .widget_box import Box, Popup, ...
python
chosen
[ { "from": "system", "value": "Fix typo in 8ball response\n" }, { "from": "human", "value": "import random\nfrom plugin import CommandPlugin, PluginException\n\n\nclass Ball8(CommandPlugin):\n \"\"\"\n 8ball command (by javipepe :))\n \"\"\"\n\n def __init__(self, bot):\n Comma...
python
chosen
[ { "from": "system", "value": "Handle no openid attribute on request in openid context processor\n" }, { "from": "human", "value": "\nfrom account.models import Account, AnonymousAccount\n\ndef openid(request):\n return {'openid': request.openid}\n\ndef account(request):\n if request.user.i...
python
chosen
[ { "from": "system", "value": "Fix name injection test for the new Drudge update\n" }, { "from": "human", "value": "\"\"\"Test for the name inject utility.\"\"\"\n\nfrom drudge import Drudge\n\n\ndef test_drudge_injects_names():\n \"\"\"Test the name injection method of drudge.\"\"\"\n\n dr...
python
chosen
[ { "from": "system", "value": "[hints] Check url safety before redirecting. Safety first!\n" }, { "from": "human", "value": "from zenaida.contrib.hints.models import Dismissed\nfrom zenaida.contrib.hints.forms import DismissHintForm\n\nfrom django.http import (HttpResponse, HttpResponseNotAllowed...
python
chosen
[ { "from": "system", "value": "Revert \"Python2/3 Reverse Compat functionality, also 'return' if EOFError\"\n\nThis reverts commit f604590ca7a704ef941db5342bae3cef5c60cf2e.\n" }, { "from": "human", "value": "# queue_timings.py\n# Analysis script for bodyfetcher queue timings. Call from the comman...
python
chosen
[ { "from": "system", "value": "Fix episode count increment bug\n" }, { "from": "human", "value": "import abc\nimport six\n\n\n@six.add_metaclass(abc.ABCMeta)\nclass Learner(object):\n\n def __init__(self, env, n_episodes=1000, verbose=True):\n self.env = env\n self.n_episodes = n...
python
chosen
[ { "from": "system", "value": "Update to Script, Fixed malware domain file name\n\nFixed malware domains file name to accurately represent the file opened. (Better than text.txt)" }, { "from": "human", "value": "#!/usr/bin/python\n#SRT411 Assignment 2 - Part 2\n#Cymon API Interaction\n#Written by...
python
chosen
[ { "from": "system", "value": "Add name to EnumType in test since pgsql needs it.\n" }, { "from": "human", "value": "import enum\n\nfrom sqlalchemy.schema import Column\nfrom sqlalchemy.types import Integer\n\nfrom cliche.sqltypes import EnumType\nfrom cliche.orm import Base\n\n\nclass Color(enum...
python
chosen
[ { "from": "system", "value": "Comment out the bitcoin PPA code.\n\nThe bitcoin PPA is no longer maintained/supported.\n" }, { "from": "human", "value": "from pyinfra import host\nfrom pyinfra.modules import apt\n\nSUDO = True\n\ncode_name = host.fact.linux_distribution['release_meta'].get('DISTR...
python
chosen
[ { "from": "system", "value": "Add placeholder for removing customer from saltedge\n" }, { "from": "human", "value": "from django.db import models\nfrom django.contrib.auth.models import AbstractUser\nfrom django.conf import settings\nfrom django.db.models.signals import post_save\nfrom saltedge....
python
chosen
[ { "from": "system", "value": "Fix title parser to fix certain missing laws\n" }, { "from": "human", "value": "# -*- coding: utf-8 -*\nimport re\n\n\ndef normalize_correction_title_dashes(raw_title):\n \"\"\"returns s with normalized spaces before and after the dash\"\"\"\n if not raw_title...
python
chosen
[ { "from": "system", "value": "Rename locust to be consistent with other entities\n" }, { "from": "human", "value": "from locust import HttpLocust, TaskSet, task\n\nclass HttpPingTasks(TaskSet):\n @task\n def ping(self):\n self.client.get(\"/\")\n\nclass SayHelloLocust(HttpLocust):\n...
python
chosen
[ { "from": "system", "value": "Hide text input placeholder when onfocus\n" }, { "from": "human", "value": "import django_countries\n\nfrom django import forms\nfrom django_countries.fields import LazyTypedChoiceField\n\n\nclass SearchForm(forms.Form):\n title = forms.CharField(label='', widget...
python
chosen
[ { "from": "system", "value": "Fix Python 2 test failure\n" }, { "from": "human", "value": "'''Test issue that arises when too many labels are added to NER model.'''\nimport random\nfrom ...lang.en import English\n\ndef train_model(train_data, entity_types):\n nlp = English(pipeline=[])\n\n ...
python
chosen
[ { "from": "system", "value": "Change url pattern from /e/ to /entry/\n" }, { "from": "human", "value": "from django.conf.urls.defaults import *\nfrom django.conf import settings\n\nfrom django.contrib import admin\nadmin.autodiscover()\n\nurlpatterns = patterns('',\n (r'^\\+media/(?P<path>.*)...
python
chosen
[ { "from": "system", "value": "Add example to code doc\n" }, { "from": "human", "value": "import requests\nimport json\n\nclass MatrixClient:\n\n ONE_TO_MANY_URL = 'https://matrix.mapzen.com/one_to_many'\n\n def __init__(self, matrix_key):\n self._matrix_key = matrix_key\n\n \"\"\...
python
chosen
[ { "from": "system", "value": "Change variable name to fahrenheit\n" }, { "from": "human", "value": "#!/usr/bin/env python\n\nF = input(\"Gimme Fahrenheit: \")\n\nprint (F-32) * 5 / 9\nprint (F-32) / 1.8000\n" }, { "from": "gpt", "value": "#!/usr/bin/env python\n\nfahrenheit = input(\...
python
chosen
[ { "from": "system", "value": "Use HTTPS instead of HTTP since cache does redirect anyways\n" }, { "from": "human", "value": "# -*- encoding: utf-8 -*-\n\nfrom django.conf import settings\nfrom papers.errors import MetadataSourceException\nfrom papers.utils import sanitize_html\n\nimport requests...
python
chosen
[ { "from": "system", "value": "Set max version of iPython required\n" }, { "from": "human", "value": "from distutils.core import setup\n\nsetup(name=\"zutil\",\n version='0.1.2',\n description=\"Utilities used for generating zCFD control dictionaries\",\n author=\"Zenotech\",\n ...
python
chosen
[ { "from": "system", "value": "Set a minimum DRF version for the next release\n" }, { "from": "human", "value": "#!/usr/bin/env python\nimport os\nfrom setuptools import setup, find_packages\n\ndef get_readme():\n return open(os.path.join(os.path.dirname(__file__), 'README.rst')).read()\n\nset...
python
chosen
[ { "from": "system", "value": "Update author and email in package metadata\n" }, { "from": "human", "value": "import sys\nfrom setuptools import find_packages, setup\n\ntests_require = [\n 'coverage>=4.0',\n 'pytest-isort',\n 'pytest-cache>=1.0',\n 'flake8<3.0.0',\n 'pytest-flake8>...
python
chosen
[ { "from": "system", "value": "Fix the keywords, url, and description.\n" }, { "from": "human", "value": "\n#! /usr/bin/env python\nimport os\nfrom setuptools import setup, find_packages\n\n# with open(os.path.join(os.path.dirname(__file__), 'README.md')) as readme:\n# README = readme.read()\...
python
chosen
[ { "from": "system", "value": "Set zip_safe=False to make TW2 happy\n" }, { "from": "human", "value": "from setuptools import setup, find_packages\nimport os\n\nversion = '0.6.3'\nhere = os.path.abspath(os.path.dirname(__file__))\ntry:\n README = open(os.path.join(here, 'README.txt')).read()\n...
python
chosen
[ { "from": "system", "value": "Remove pyobjc-framework-Quartz dependency as it seems to be unnecessary\n\ncloses #11\n" }, { "from": "human", "value": "# -*- coding: utf-8 -*-\nimport sys\nfrom setuptools import setup\n\nwith open('README.rst', 'rb') as f:\n long_desc = f.read().decode('utf-8'...
python
chosen
[ { "from": "system", "value": "Add __all__ to main module\n" }, { "from": "human", "value": "__author__ = 'Evan Cordell'\n\n__version__ = \"0.5.1\"\n__version_info__ = tuple(__version__.split('.'))\n__short_version__ = __version__\n\nfrom .macaroon import Macaroon\nfrom .caveat import Caveat\nfro...
python
chosen
[ { "from": "system", "value": "Add Python 3 as dependency\n" }, { "from": "human", "value": "# -*- coding: utf-8 -*-\nfrom setuptools import setup, find_packages\n\ntry:\n long_description = open(\"README.md\").read()\nexcept IOError:\n long_description = \"\"\n\nsetup(\n name=\"vania\",...
python
chosen
[ { "from": "system", "value": "Add migrations to package data\n" }, { "from": "human", "value": "#!/usr/bin/env python\n\nfrom setuptools import setup\n\nfrom fandjango import __version__\n\nsetup(\n name = 'fandjango',\n version = __version__,\n description = \"Fandjango makes it stupid...
python
chosen
[ { "from": "system", "value": "Use threading instead of multiprocessing.\n" }, { "from": "human", "value": "# -*- coding: utf-8\n\nfrom multiprocessing import Queue, Process, Event\n\n\nclass Timer(Process):\n def __init__(self, interval, function, args=[], kwargs={}):\n super(Timer, se...
python
chosen
[ { "from": "system", "value": "Increase version number for Python 3.9 support\n" }, { "from": "human", "value": "#!/usr/bin/env python\n# -*- coding: utf-8 -*-\nfrom setuptools import find_packages, setup\n\nwith open(\"README.md\") as readme_file:\n readme = readme_file.read()\n\nrequirements...
python
chosen
[ { "from": "system", "value": "Add PY quick start examples\n" }, { "from": "human", "value": "#!/Applications/anaconda/envs/Python3/bin\n\ndef main():\n x = input(\"Enter a number: \")\n print(\"Your number is {}\".format(x))\n\n\nif __name__ == '__main__':\n main()\n" }, { "from...
python
chosen
[ { "from": "system", "value": "Add Django < 1.4 requirements\n" }, { "from": "human", "value": "from distutils.core import setup\nfrom setuptools import find_packages\nimport os\nimport sys\n\ndef read(fname):\n return open(os.path.join(os.path.dirname(__file__), fname)).read()\n\ndef find_pac...
python
chosen
[ { "from": "system", "value": "Update mock requirement from <2.1,>=2.0 to >=2.0,<3.1\n\nUpdates the requirements on [mock](https://github.com/testing-cabal/mock) to permit the latest version.\n- [Release notes](https://github.com/testing-cabal/mock/releases)\n- [Changelog](https://github.com/testing-cabal/mo...
python
chosen
[ { "from": "system", "value": "Read in README.md as long description" }, { "from": "human", "value": "# Copyright 2019 The resource-policy-evaluation-library Authors. All rights reserved.\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may not use this file except i...
python
chosen
[ { "from": "system", "value": "Add cappy to dependency list\n" }, { "from": "human", "value": "###############################################################################\n# Copyright 2015-2016 University of Florida. All rights reserved.\n# This file is part of UF CTS-IT's NACCulator project....
python
chosen
[ { "from": "system", "value": "Downgrade to v0.4.4 of membersuite-api-client\n" }, { "from": "human", "value": "#!/usr/bin/env python\nfrom setuptools import setup\nimport os\n\n\n# Utility function to read README file\ndef read(fname):\n return open(os.path.join(os.path.dirname(__file__), fna...
python
chosen
[ { "from": "system", "value": "Improve dependencies and add entry_points.\n" }, { "from": "human", "value": "import os\nfrom setuptools import setup\n\nbase = os.path.dirname(__file__)\n\nmdata = {}\nwith open(os.path.join(base, 'uniplot', '__about__.py')) as f:\n exec(f.read(), mdata)\n\nsetu...
python
chosen
[ { "from": "system", "value": "Delete `requires` and `wxPython` dependency\n\n`wxPython` is not easily installable via pip on all Linux distributions without explicitly providing the path to the wheel, yet.\r\n\r\n`requires` is obsolete, because of the use of `install_requires`" }, { "from": "human",...
python
chosen
[ { "from": "system", "value": "Update of version information in preparation for release\n" }, { "from": "human", "value": "from setuptools import setup\n\n\nsetup(\n name=\"ticket_auth\",\n version=\"0.1.0\",\n packages=['ticket_auth'],\n author='Gnarly Chicken',\n author_email='gn...
python
chosen
[ { "from": "system", "value": "Read requirements from the .txt file\n" }, { "from": "human", "value": "#! /usr/bin/env python\nfrom setuptools import setup, find_packages\nfrom setuptools.command.test import test as TestCommand\nimport os\nimport sys\n\nos.environ.setdefault('DJANGO_SETTINGS_MODU...
python
chosen
[ { "from": "system", "value": "Update requests requirement from <2.22,>=2.4.2 to >=2.4.2,<2.23\n\nUpdates the requirements on [requests](https://github.com/requests/requests) to permit the latest version.\n- [Release notes](https://github.com/requests/requests/releases)\n- [Changelog](https://github.com/kenn...
python
chosen
[ { "from": "system", "value": "Use relative path in for LICENSE\n" }, { "from": "human", "value": "# -*- coding: utf-8 -*-\n\nfrom setuptools import setup, find_packages\n\nsetup(\n name='orges',\n version='0.0.1',\n description='OrgES Package - Organic Computing for Evolution Strategies...
python
chosen
[ { "from": "system", "value": "Update pip package. Added proper requests dependency\n" }, { "from": "human", "value": "from distutils.core import setup\n\nsetup(\n name='gapi',\n version='0.5.0',\n author='Scott Hendrickson, Josh Montague',\n author_email='scott@drskippy.net',\n pa...
python
chosen
[ { "from": "system", "value": "Add requests module to installation requirements\n" }, { "from": "human", "value": "from setuptools import setup, find_packages\n\nsetup(\n name = 'ckanext-archiver',\n version = '0.1',\n packages = find_packages(),\n install_requires = [\n 'celer...
python
chosen
[ { "from": "system", "value": "Update license classifier to MIT\n" }, { "from": "human", "value": "from os import path, pardir, chdir\nfrom setuptools import setup, find_packages\n\nREADME = open(path.join(path.dirname(__file__), 'README.rst')).read()\n\n# allow setup.py to be run from any path\n...
python
chosen
[ { "from": "system", "value": "Fix pip installation failure involving README.md\n\nTwo bugs with \"easy\" fixes:\n\n- README.md was not being included in the source distribution. I'm not\n sure what I did to fix it, since the distutils/setuptools/distribute\n docs are quite incomplete and convoluted on so...
python
chosen
[ { "from": "system", "value": "Use absolute path for reading description from file (thanks @hodgestar)\n" }, { "from": "human", "value": "from setuptools import setup, find_packages\n\n\ndef listify(filename):\n return filter(None, open(filename, 'r').readlines())\n\nsetup(\n name=\"python-...
python
chosen
[ { "from": "system", "value": "Delete organization field API issues\n\nChanged the database field to unlimited sized field which is TextField in the case of django=1.8. fixed the delete api checks and randomized the key for attributes.\n\n[YONK-1151]\n" }, { "from": "human", "value": "#!/usr/bin/...
python
chosen
[ { "from": "system", "value": "Add support for brotli content encoding and alias for none\n" }, { "from": "human", "value": "from setuptools import setup\n\n\nsetup(\n name='icapservice',\n version='0.1.1',\n description='ICAP service library for Python',\n author='Giles Brown',\n ...
python
chosen
[ { "from": "system", "value": "Move back to 0.9.0 for prod PyPi upload\n" }, { "from": "human", "value": "import os\n\nfrom setuptools import setup\n\nsetup(\n name='algorithmia',\n version='0.9.2',\n description='Algorithmia Python Client',\n long_description='Algorithmia Python Clie...
python
chosen
[ { "from": "system", "value": "Add cython version to install_requires\n" }, { "from": "human", "value": "from distutils.core import setup\nfrom distutils.extension import Extension\nfrom Cython.Build import cythonize\n\nsetup(\n name='cygroonga',\n version='0.1.0',\n ext_modules=cythoniz...
python
chosen
[ { "from": "system", "value": "Use actual version numbers for dependencies" }, { "from": "human", "value": "from setuptools import setup, find_packages\n\nimport board\n\nsetup(\n name='django-board',\n version=board.__version__,\n description='A Django app for managing an organisation\\...
python
chosen
[ { "from": "system", "value": "Add importance weighting and monte carlo feature\n" }, { "from": "human", "value": "import tensorflow as tf\n\ndef GaussianSample(mean, var, scope):\n with tf.name_scope(scope):\n return tf.random_normal(tf.shape(mean), mean, tf.sqrt(var))\n" }, { ...
python
chosen
[ { "from": "system", "value": "Set up console email backend in debug mode\n" }, { "from": "human", "value": "from .default import * # NOQA\n\n#\n# Django Development\n# ..........................\n\nDEBUG = True\nTEMPLATE_DEBUG = True\n\nSOUTH_TESTS_MIGRATE = False # Tested at settings.tests\n\...
python
chosen
[ { "from": "system", "value": "Add connect and disconnect methods\n" }, { "from": "human", "value": "import socks\nimport socket\n\n\nclass Tor(object):\n \"\"\"Tor class for socks proxy and controller\"\"\"\n def __init__(self, socks_port=9050):\n self.socks_port = socks_port\n ...
python
chosen
[ { "from": "human", "value": "Add basic tests for quick sort\n" }, { "from": "gpt", "value": "from random import shuffle\nimport pytest\n\nfrom quick_sort import quick_srt\n\n\ndef test_quick_srt():\n expected = range(20)\n actual = expected[:]\n shuffle(actual)\n quick_srt(actual)\n ...
python
chosen
[ { "from": "system", "value": "Make the package import both variants\n\nFavouring the C variant where it successfully imports. This commit also\nhandles generating the encoding dictionaries for the C variant from\nthose defined for the Python variant (this is much simpler than doing\nthis in C).\n" }, { ...
python
chosen
[ { "from": "system", "value": "Enable all rules in pythonic_rules\n\nHas been disabled to avoid errors until the new design was nos finished.\n" }, { "from": "human", "value": "#!/usr/bin/python\n\nfrom config import INTERFACES\nfrom built_in_classes import RootHTBClass\nfrom .upload import Inter...
python
chosen
[ { "from": "system", "value": "Mark all mobile streams as inactive when the program starts.\n" }, { "from": "human", "value": "\"\"\" TCP Server for mobile streaming\n\"\"\"\n\ntry:\n import SocketServer as socketserver\nexcept ImportError:\n import socketserver\n\n\nfrom dss.tools import t...
python
chosen
[ { "from": "system", "value": "Fix tests since we changed imports.\n" }, { "from": "human", "value": "from django.test import TestCase\n\nfrom .models import AwareModel, NaiveModel\nfrom ..templatetags.boardinghouse import *\n\nclass TestTemplateTags(TestCase):\n def test_is_schema_aware_filte...
python
chosen
[ { "from": "system", "value": "Switch to using InteractiveInterpreter object instead of eval\n" }, { "from": "human", "value": "import sys\nimport code\n\nfrom diesel import Application, Pipe, until\n\nDEFAULT_PROMPT = '>>> '\n\ndef readcb():\n print 'Diesel Console'\n cmd = ''\n prompt ...
python
chosen
[ { "from": "system", "value": "Fix initialization ofr sorting parameters\n" }, { "from": "human", "value": "from drf_multiple_model.mixins import FlatMultipleModelMixin, ObjectMultipleModelMixin\n\nfrom rest_framework.generics import GenericAPIView\n\n\nclass FlatMultipleModelAPIView(FlatMultiple...
python
chosen
[ { "from": "system", "value": "Hide Django admin URLs from the workbench\n\nDjango admin shouldn't be used by default with Shuup. Enabling\nthis would require some attention towards Django filer in multi\nshop situations.\n" }, { "from": "human", "value": "# This file is part of Shuup.\n#\n# Copy...
python
chosen
[ { "from": "system", "value": "Remove an old debug comment\n" }, { "from": "human", "value": "from currencies.models import Currency\n\n\ndef currencies(request):\n currencies = Currency.objects.all()\n\n if not request.session.get('currency'):\n #request.session['currency'] = Curren...
python
chosen
[ { "from": "system", "value": "Fix status field in OAI-PMH\n" }, { "from": "human", "value": "from rest_framework import serializers\n\nfrom daiquiri.core.serializers import JSONListField, JSONDictField\n\n\nclass DublincoreSerializer(serializers.Serializer):\n\n identifier = serializers.ReadO...
python
chosen
[ { "from": "system", "value": "Add TIME_STR_IDEALIZED to string labels\n" }, { "from": "human", "value": "\"\"\"aospy: management, analysis, and plotting of gridded climate data.\"\"\"\nfrom .__config__ import (user_path, LAT_STR, LON_STR, PFULL_STR, PHALF_STR,\n PLEVEL_ST...
python
chosen
[ { "from": "system", "value": "Add full image url to Station serializer\n" }, { "from": "human", "value": "from rest_framework import serializers\n\nfrom base.models import (Antenna, Data, Observation, Satellite, Station,\n Transponder)\n\n\nclass AntennaSerializer(seriali...
python
chosen
[ { "from": "system", "value": "Change pattern tuple to list\n" }, { "from": "human", "value": "from django.conf.urls import patterns, include, url\nfrom django.contrib import admin\n\nurlpatterns = patterns('',\n url(r'^', include('statuses.urls')),\n url(r'^admin/', include(admin.site.urls...
python
chosen
[ { "from": "system", "value": "Move http object as based object\n" }, { "from": "human", "value": "import httplib2\nfrom apiclient.discovery import build\nfrom oauth2client.client import AccessTokenCredentials, AccessTokenCredentialsError\nfrom SnsManager.SnsBase import SnsBase\nfrom SnsManager i...
python
chosen
[ { "from": "system", "value": "Add a signal handler to handle SIGINTs\n\nFixes #135\n" }, { "from": "human", "value": "import os\n\nfrom gi.repository import GObject\n\nfrom photoshell.config import Config\nfrom photoshell.library import Library\nfrom photoshell.views.slideshow import Slideshow\n...
python
chosen
[ { "from": "system", "value": "Use env variable for account id in tests.\n" }, { "from": "human", "value": "import os\nfrom unittest import TestCase\n\nfrom dnsimple2.client import DNSimple\nfrom dnsimple2.resources import (\n AccountResource,\n DomainResource\n)\nfrom dnsimple2.tests.utils...
python
chosen
[ { "from": "system", "value": "Add faceting test to Group index\n" }, { "from": "human", "value": "from algoliasearch_django import AlgoliaIndex\n\n\nclass ChartIndex(AlgoliaIndex):\n fields = [\n 'title',\n 'arrangers'\n ]\n settings = {\n 'searchableAttributes': [\...
python
chosen
[ { "from": "system", "value": "Add a way to have the loop quit after current invocation has been processed.\n" }, { "from": "human", "value": "# Copyright 2011 Seppo Yli-Olli\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may not use this file except in complian...
python
chosen
[ { "from": "system", "value": "Add missing _configure to OracleDbContainer\n\nAdditionally, fix Oracle example.\n" }, { "from": "human", "value": "from testcontainers.core.generic import DbContainer\n\n\nclass OracleDbContainer(DbContainer):\n \"\"\"\n Oracle database container.\n\n Exam...
python
chosen
[ { "from": "system", "value": "Fix tests to run with django 1.7\n" }, { "from": "human", "value": "# -*- coding: utf-8 -*-\n\nimport os, sys\nos.environ.setdefault(\"DJANGO_SETTINGS_MODULE\", \"settings\")\n\nfrom django.core.management import call_command\n\nif __name__ == \"__main__\":\n arg...
python
chosen
[ { "from": "system", "value": "Add celery task failure sentry tracking" }, { "from": "human", "value": "from django.conf import settings\nfrom django.utils import translation\n\nfrom celery.task import task\nfrom haystack import site\n\n@task\ndef delayed_update(instance_pk, model):\n \"\"\" O...
python
chosen
[ { "from": "system", "value": "Fix a bug and log to the console\n\nFix a bug where a command is called without any arguments, so no indices will be out-of-range\nLog to the console whenever someone calls a command\n" }, { "from": "human", "value": "commands = {}\n\ndef add_cmd(name, alias=None, o...
python
chosen
[ { "from": "system", "value": "Add ability to set insttoken\n" }, { "from": "human", "value": "import requests\n\n\nclass myElsClient:\n \"\"\"A class that implements a Python interface to api.elsevier.com\"\"\"\n\n # local variables\n __base_url = \"http://api.elsevier.com/\"\n \n ...
python
chosen
[ { "from": "system", "value": "Include contributor in track feed\n" }, { "from": "human", "value": "from django.conf.urls.defaults import url\n\nfrom tastypie.resources import ModelResource\nfrom tastypie.constants import ALL\nfrom jmbo.api import ModelBaseResource\n\nfrom music.models import Tra...
python
chosen
[ { "from": "system", "value": "Disable annoying syncdb info for volatile db\n" }, { "from": "human", "value": "from .util import import_module\n\nimport logging\n\n\ndef init():\n \"\"\"\n Initialize nazs environment, setup logging, processes and all\n needed stuff for running nazs\n ...
python
chosen
[ { "from": "system", "value": "Add tests for task types for assets routes\n\nAdd a test to ensure that a 404 is returned when the give id is wrong.\n" }, { "from": "human", "value": "from test.base import ApiDBTestCase\n\n\nclass AssetTaskTypesTestCase(ApiDBTestCase):\n\n def setUp(self):\n ...
python
chosen
[ { "from": "human", "value": "Test harness for all working end points\n" }, { "from": "gpt", "value": "import EmpireAPIWrapper\n\napi = EmpireAPIWrapper.empireAPI('10.15.20.157', uname='empireadmin', passwd='Password123!')\n# api = EmpireAPIWrapper.empireAPI('10.15.20.157', token='2zqb4bgvoq1jhe9...
python
chosen
[ { "from": "system", "value": "Fix mysql connect string to be pymysql compatible\n" }, { "from": "human", "value": "#!/usr/bin/env python\n# -*- coding: utf-8 -*-\n\nimport os\n\n# Flask\nSECRET_KEY = os.urandom(32)\n\n# SQLAlchemy (DB)\nSQLALCHEMY_DATABASE_URI = 'mysql://localhost/downstream'\n\...
python
chosen
[ { "from": "system", "value": "Add a simple test for the checksum routine.\n" }, { "from": "human", "value": "import unittest\n\nfrom zttf.utils import fixed_version, binary_search_parameters\n\n\nclass TestUtils(unittest.TestCase):\n def test_fixed_version(self):\n cases = [\n ...
python
chosen
[ { "from": "system", "value": "Fix router's interface listing view\n\nTo get all the ports for a router Horizon uses port_list\nfiltering by the device_id value which in vanilla openstack\nis the quantum router_id, but we use the akanda_id as value for\nthat field so the listing doesn't work for us. Lets re...
python
chosen
[ { "from": "system", "value": "Add test for concat template tag\n" }, { "from": "human", "value": "from django.test import TestCase\n\nfrom ..templatetags import explorer\n\n\nclass HighlightTestCase(TestCase):\n\n def test_highlight_returns_text_when_empty_word(self):\n\n expected = 'f...
python
chosen
[ { "from": "system", "value": "Fix a bug with an empty database\n\ngit-svn-id: 54fea250f97f2a4e12c6f7a610b8f07cb4c107b4@138 439a9e5f-3f3e-0410-bc46-71226ad0111b\n" }, { "from": "human", "value": "from pages.models import Page, Language, Content\nfrom pages.utils import auto_render\nfrom django.co...
python
chosen
[ { "from": "system", "value": "Raise read-only filesystem when the user wants to chmod in /history.\n" }, { "from": "human", "value": "import os\nfrom errno import EROFS\n\nfrom fuse import FuseOSError\n\nfrom gitfs import FuseMethodNotImplemented\n\nfrom .view import View\n\n\nclass ReadOnlyView...
python
chosen
[ { "from": "system", "value": "Fix bug where dummy_thread was always imported\n\nThe code always import the dummy_thread module even on platforms where the real thread module is available. This caused bugs in other packages that use this import style:\r\n\r\ntry:\r\n from _thread import interrupt_main # ...
python
chosen
[ { "from": "system", "value": "Set message attribute on InvalidValidationResponse error class.\n" }, { "from": "human", "value": "__all___ = [\n 'YubicoError',\n 'StatusCodeError',\n 'InvalidClientIdError',\n 'InvalidValidationResponse',\n 'SignatureVerificationError'\n]\n\n\nclass...
python
chosen
[ { "from": "system", "value": "Add functions for NICK and USER sending. Override sendMessage for debugging.\n" }, { "from": "human", "value": "from twisted.words.protocols import irc\n\n\nclass HeufyBotConnection(irc.IRC):\n def __init__(self, protocol):\n self.protocol = protocol\n ...
python
chosen
[ { "from": "system", "value": "Replace the use of the list for a set to emphasize the semantics.\n" }, { "from": "human", "value": "\"\"\"\n banana.maya.MFileIO\n ~~~~~~~~~~~~~~~~~~~\n \n Monkey patching of the `~maya.OpenMaya.MFileIO` class.\n \n :copyright: Copyright 2014 by C...
python
chosen
[ { "from": "system", "value": "Fix for-if in \"arg\" function\n" }, { "from": "human", "value": "#!/usr/bin/env python\nimport socket\nimport sys\n\n\ndef host(name):\n \"\"\"Check if host name is equal to the given name\"\"\"\n return socket.gethostname() == name\n\ndef arg(name, expected_...
python
chosen
[ { "from": "system", "value": "Improve the Log module, add console handler\n\nThis commit will improve the logging levels, user now can set the\nverbose level by typing \"-v\" option.\nif user wants the logs into the console, he should type \"--console\" option.\n" }, { "from": "human", "value": ...
python
chosen
[ { "from": "system", "value": "Append services string only if not blank\n" }, { "from": "human", "value": "#!/usr/bin/env python\n\"\"\"\nDeploy builds to a Rancher orchestrated stack using rancher-compose\n\"\"\"\nimport os\n\nimport drone\nimport subprocess\n\n\ndef main():\n \"\"\"The main ...
python
chosen