conversations listlengths 2 3 | source stringclasses 1
value | stack stringclasses 1
value |
|---|---|---|
[
{
"from": "system",
"value": "Fix failure on Django < 1.4.5\n"
},
{
"from": "human",
"value": "# -*- coding: utf-8 -*-\nfrom __future__ import unicode_literals\n\n\ntry:\n # Django >= 1.4.5\n from django.utils.encoding import force_bytes, force_text, smart_text # NOQA\n from django.uti... | python | chosen |
[
{
"from": "system",
"value": "Order book pages by page number.\n"
},
{
"from": "human",
"value": "from rest_framework import viewsets\n\nfrom books.models import BookPage\nfrom books.serializers import BookPageSerializer\n\n\nclass BookPageViewSet(viewsets.ModelViewSet):\n \"\"\"\n API end... | python | chosen |
[
{
"from": "system",
"value": "Add OK reaction to reload command\n\n"
},
{
"from": "human",
"value": "import discord\nfrom discord.ext import commands\n\n\nclass Owner:\n \"\"\"Admin-only commands that make the bot dynamic.\"\"\"\n\n def __init__(self, bot):\n self.bot = bot\n\n @... | python | chosen |
[
{
"from": "system",
"value": "Use better type definitions for the array API custom types\n"
},
{
"from": "human",
"value": "\"\"\"\nThis file defines the types for type annotations.\n\nThese names aren't part of the module namespace, but they are used in the\nannotations in the function signatur... | python | chosen |
[
{
"from": "system",
"value": "Add a new test to test all chars that are getting replaced\n"
},
{
"from": "human",
"value": "from rdflib import *\nimport unittest\n\nclass test_normalisedString(unittest.TestCase):\n def test1(self):\n lit2 = Literal(\"\\two\\nw\", datatype=XSD.normalize... | python | chosen |
[
{
"from": "system",
"value": "Rebuild index and test variety of queries\n"
},
{
"from": "human",
"value": "from django.test import TestCase\nfrom django.test import Client\nfrom noveltorpedo.models import *\nimport unittest\nfrom django.utils import timezone\n\nclient = Client()\n\n\nclass Searc... | python | chosen |
[
{
"from": "system",
"value": "Update module level description of moderngl\n"
},
{
"from": "human",
"value": "'''\n ModernGL: PyOpenGL alternative\n'''\n\nfrom .error import *\nfrom .buffer import *\nfrom .compute_shader import *\nfrom .conditional_render import *\nfrom .context import *\nfrom... | python | chosen |
[
{
"from": "system",
"value": "Update the default value for the placeholder\n\nIf I decide to start matching on headers this will be necessary\n"
},
{
"from": "human",
"value": "import betamax\nimport os\n\nwith betamax.Betamax.configure() as config:\n config.cassette_library_dir = 'tests/cass... | python | chosen |
[
{
"from": "system",
"value": "Add in unit tests for validate.py\n"
},
{
"from": "human",
"value": "import pytest\nimport mock\nimport synapseclient\nfrom genie import validate\ncenter = \"SAGE\"\nsyn = mock.create_autospec(synapseclient.Synapse)\n\n\n@pytest.fixture(params=[\n # tuple with (i... | python | chosen |
[
{
"from": "system",
"value": "Fix args to list. Args is a tuple, list takes a tuple"
},
{
"from": "human",
"value": "#!/usr/bin/env python\n\nfrom genes.posix.traits import only_posix\nfrom genes.process.commands import run\n\n\n@only_posix()\ndef chgrp(path, group):\n run(['chgrp', group, pa... | python | chosen |
[
{
"from": "system",
"value": "Add caching of OsaMixer volume\n\nIf volume is just managed through Mopidy it is always correct. If another\napplication changes the volume, Mopidy will be correct within 30 seconds.\n"
},
{
"from": "human",
"value": "from subprocess import Popen, PIPE\n\nfrom mopid... | python | chosen |
[
{
"from": "system",
"value": "Fix file handlers being left open for fixtures\n"
},
{
"from": "human",
"value": "import os\n\n\ndef fixture_response(path):\n return open(os.path.join(\n os.path.dirname(__file__),\n 'fixtures',\n path)).read()\n"
},
{
"from": "gpt",... | python | chosen |
[
{
"from": "system",
"value": "tests: Add small testcase for 3-arg slices.\n"
},
{
"from": "human",
"value": "x = list(range(10))\nprint(x[::-1])\nprint(x[::2])\nprint(x[::-2])\n"
},
{
"from": "gpt",
"value": "x = list(range(10))\nprint(x[::-1])\nprint(x[::2])\nprint(x[::-2])\n\nx = l... | python | chosen |
[
{
"from": "system",
"value": "Make naming consistent with our standard (camelcase always, even with acronymn)\n"
},
{
"from": "human",
"value": "import os\r\nimport unittest\r\nimport numpy\r\nimport arcpy\r\n\r\nfrom utils import *\r\n# import our constants;\r\n# configure test data\r\n# XXX: u... | python | chosen |
[
{
"from": "system",
"value": "Update tests for vectors for the new protocol\n\nNow the tests for vectors are updated for the new non backward\ncompatible change for the concepts of label and base.\n"
},
{
"from": "human",
"value": "\"\"\"Tests for vectors.\"\"\"\n\nfrom sympy import sympify\n\nf... | python | chosen |
[
{
"from": "system",
"value": "Add markdownx url, Add add-tutrorial url\n"
},
{
"from": "human",
"value": "from django.conf.urls import include, url\n\nfrom tutorials import views\n\nurlpatterns = [\n url(r'^$', views.ListTutorials.as_view()),\n url(r'^(?P<tutorial_id>[\\w\\-]+)/$', views.T... | python | chosen |
[
{
"from": "system",
"value": "Remove host and port attributes from Neo4j\n"
},
{
"from": "human",
"value": "import requests\nfrom py2neo import Graph, authenticate\n\n\nclass Neo4j:\n\n def __init__(self, host, port, username=None, password=None):\n self.host = host\n self.port ... | python | chosen |
[
{
"from": "system",
"value": "Change Celery task to shared task\n"
},
{
"from": "human",
"value": "from django.core.management import call_command\n\nfrom celery import task\n\n\n@task\ndef syncldap():\n \"\"\"\n Call the appropriate management command to synchronize the LDAP users\n wi... | python | chosen |
[
{
"from": "system",
"value": "Add functions to scrape whois data and fix the e-mails in it\n\n- Add function scrape_whois which scrapes the raw whois information for a given domain from http://www.whois.com/whois.\n- Add function fix_emails. http://www.whois.com hides the username-part of the contact e-mail... | python | chosen |
[
{
"from": "system",
"value": "Stop using `flask.ext.*` in tests.\n"
},
{
"from": "human",
"value": "import unittest\nimport sys\nfrom six import PY3\nif PY3:\n from urllib.parse import urlsplit, parse_qsl\nelse:\n from urlparse import urlsplit, parse_qsl\n\nimport werkzeug as wz\n\nfrom fl... | python | chosen |
[
{
"from": "system",
"value": "Remove fixture teardown since nothing should be saved (tmpdir)\n"
},
{
"from": "human",
"value": "import string\n\nimport pytest\n\n@pytest.fixture\ndef identity_fixures():\n l = []\n for i, c in enumerate(string.ascii_uppercase):\n l.append(dict(\n ... | python | chosen |
[
{
"from": "system",
"value": "Add flexible routing, maybe change to stricter hardcoded ones?\n"
},
{
"from": "human",
"value": "\"\"\"\n vcfexplorer.frontend.views\n\n VCF Explorer frontend views\n\"\"\"\n\nfrom flask import send_file\n\nfrom . import bp\n\n@bp.route('/', defaults={'path':... | python | chosen |
[
{
"from": "system",
"value": "Stop using deprecated 'message' attribute in Exception\n\nThe 'message' attribute has been deprecated and removed\nfrom Python3.\nFor more details, please check:\nhttps://www.python.org/dev/peps/pep-0352/\n\nChange-Id: Id952e4f59a911df7ccc1d64e7a8a2d5e9ee353dd\n"
},
{
"... | python | chosen |
[
{
"from": "system",
"value": "Use the new template path\n"
},
{
"from": "human",
"value": "import logging\nlogger = logging.getLogger(__name__)\n\nfrom django.http import Http404\nfrom django.views.generic import TemplateView\n\nimport settings\n\n\nclass VerificationView(TemplateView):\n \"\... | python | chosen |
[
{
"from": "system",
"value": "Fix the annoying \"/home/1flow/.virtualenvs/1flow/local/lib/python2.7/site-packages/django/conf/urls/defaults.py:3: DeprecationWarning: django.conf.urls.defaults is deprecated; use django.conf.urls instead DeprecationWarning)\". We do not use it in our code at all, and external... | python | chosen |
[
{
"from": "system",
"value": "Add a simple memoize function\n"
},
{
"from": "human",
"value": "def pipe(*functions):\n def closure(x):\n for fn in functions:\n if not out:\n out = fn(x)\n else:\n out = fn(out)\n return out\n\n ... | python | chosen |
[
{
"from": "system",
"value": "Multiply now handles lists correctly\n"
},
{
"from": "human",
"value": "#!/usr/bin/env python\n\nfrom nodes import Node\n\nclass Multiply(Node):\n char = \"*\"\n args = 2\n results = 1\n \n @Node.test_func([4,5], [20])\n def func(self, a,b):\n ... | python | chosen |
[
{
"from": "system",
"value": "Set required_sortable to True for logical operations\n"
},
{
"from": "human",
"value": "from cupy import core\n\nlogical_and = core.create_comparison(\n 'logical_and', '&&',\n '''Computes the logical AND of two arrays.\n\n .. seealso:: :data:`numpy.logical_... | python | chosen |
[
{
"from": "system",
"value": "Make sure API payload is well-formed JSON\n"
},
{
"from": "human",
"value": "''' commands for the manager cli '''\n\nfrom uuid import uuid4\n\nimport requests\n\n\ndef command_puzzleboard_consume(**kwargs):\n url = kwargs['--consume-url']\n name = kwargs['--na... | python | chosen |
[
{
"from": "system",
"value": "Make working with JSONDataDescriptor easier\n"
},
{
"from": "human",
"value": "from decimal import Decimal\nimport simplejson\n\nfrom django.core.serializers.json import DjangoJSONEncoder\n\n\ntry:\n simplejson.dumps([42], use_decimal=True)\nexcept TypeError:\n ... | python | chosen |
[
{
"from": "system",
"value": "Fix SQL query to use indexes in the page table"
},
{
"from": "human",
"value": "import MySQLdb\nimport mwparserfromhell\n\nclass Plugin():\n\n def get_wikicode(self, title):\n # TODO Make this a conf\n db = MySQLdb.connect(host=\"localhost\", user=\... | python | chosen |
[
{
"from": "system",
"value": "[IMP] Add constraint, tax name must be unique for each company and sales channel\n"
},
{
"from": "human",
"value": "# -*- coding: utf-8 -*-\n##############################################################################\n#\n# Sales Channels\n# Copyright (C) 20... | python | chosen |
[
{
"from": "system",
"value": "Fix LoginForm to be conformant to builtin AuthenticationForm\n"
},
{
"from": "human",
"value": "from django import forms\n\n\nclass LoginForm(forms.Form):\n email = forms.EmailField(widget=forms.EmailInput(attrs={'placeholder': 'Email',\n ... | python | chosen |
[
{
"from": "system",
"value": "Put back an import that my IDE incorrectly flagged as unused\n"
},
{
"from": "human",
"value": "# -*- coding: utf-8 -*-\n\"\"\"\n\nCreated on Fri Mar 30 18:27:25 2012\nAuthor: Josef Perktold\n\"\"\"\n\nfrom statsmodels.sandbox.stats.multicomp import MultiComparison\... | python | chosen |
[
{
"from": "system",
"value": "Change method order to match filters\n"
},
{
"from": "human",
"value": "import datetime\nfrom tenyksservice import TenyksService, run_service\nfrom ddate.base import DDate\n\nclass DiscordianDate(TenyksService):\n direct_only = True\n irc_message_filters = {\n... | python | chosen |
[
{
"from": "system",
"value": "Use the correct user ID to show the user from the profiles view. Fixes %61.\n"
},
{
"from": "human",
"value": "from signbank.registration.models import *\nfrom django.contrib import admin\nfrom django.core.urlresolvers import reverse\n\nclass UserProfileAdmin(admin.... | python | chosen |
[
{
"from": "system",
"value": "Add support for GITDIR envar\n"
},
{
"from": "human",
"value": "import pathlib\n\nGITDIR = pathlib.Path('/opt/git') #TODO check permissions\n"
},
{
"from": "gpt",
"value": "import pathlib\n\nGITDIR = pathlib.Path(os.environ.get('GITDIR', '/opt/git')) #TO... | python | chosen |
[
{
"from": "system",
"value": "ikiwiki: Allow only alphanumerics in wiki/blog name\n"
},
{
"from": "human",
"value": "#\n# This file is part of Plinth.\n#\n# This program is free software: you can redistribute it and/or modify\n# it under the terms of the GNU Affero General Public License as\n# p... | python | chosen |
[
{
"from": "system",
"value": "Add epoch conversion to timestamp"
},
{
"from": "human",
"value": "from django.contrib.auth.models import User, Group\nfrom rest_framework import serializers\n\nclass UserSerializer(serializers.HyperlinkedModelSerializer):\n class Meta:\n model = User\n ... | python | chosen |
[
{
"from": "system",
"value": "Add util functions for pickling and unpickling multiprocessing.Connection\n"
},
{
"from": "human",
"value": "import logging\n\nfrom mopidy import settings as raw_settings\n\nlogger = logging.getLogger('mopidy')\n\ndef get_version():\n return u'0.1.dev'\n\ndef get... | python | chosen |
[
{
"from": "system",
"value": "Handle only clinical, no genomic, submission\n"
},
{
"from": "human",
"value": "import json\nimport requests\nimport argparse\n\nparser = argparse.ArgumentParser(\n description=\"Upload submission from submit.cancergenetrust.org\")\nparser.add_argument('file', na... | python | chosen |
[
{
"from": "system",
"value": "Fix copy and paste error\n"
},
{
"from": "human",
"value": "\"\"\"Validate a GTFS file.\"\"\"\nimport argparse\nimport json\n\nimport feed\nimport validation\n\nif __name__ == \"__main__\":\n parser = argparse.ArgumentParser(description='GTFS Info and JSON export')... | python | chosen |
[
{
"from": "system",
"value": "Check that we are creating Test Classes\n"
},
{
"from": "human",
"value": "from fixture import GeneratorTest\nfrom google.appengine.ext import testbed, ndb\n\n\nclass GeneratorTest(GeneratorTest):\n\n def testLotsaModelsGenerated(self):\n for klass in self... | python | chosen |
[
{
"from": "system",
"value": "Update default Python demo app to reflect actual Python version\n"
},
{
"from": "human",
"value": "def application(env, start_response):\n start_response('200 OK', [('Content-Type', 'text/html')])\n return [b\"Hello World from a default Nginx uWSGI Python 3.6 ... | python | chosen |
[
{
"from": "system",
"value": "Allow passing seed directly to helper function\n"
},
{
"from": "human",
"value": "def print_generated_sequence(g, num, *, sep=\", \"):\n \"\"\"\n Helper function which prints a sequence of `num` items\n produced by the random generator `g`.\n \"\"\"\n\n ... | python | chosen |
[
{
"from": "system",
"value": "Add temporary check to block production resolve\n"
},
{
"from": "human",
"value": "from datetime import datetime\nfrom flask import Flask\n\nimport plenario.tasks as tasks\n\n\ndef create_worker():\n\n app = Flask(__name__)\n app.config.from_object('plenario.s... | python | chosen |
[
{
"from": "system",
"value": "Use mkdir instead of makedirs because we don't need parent directories made\n"
},
{
"from": "human",
"value": "from os import makedirs\nfrom os.path import abspath, dirname, exists, join\nfrom shutil import rmtree\n\nfrom tvrenamr.config import Config\nfrom tvrenamr... | python | chosen |
[
{
"from": "system",
"value": "Allow searching campgrounds by name for convenience.\n"
},
{
"from": "human",
"value": "from django.contrib.gis import admin\nfrom uscampgrounds.models import *\n\nclass CampgroundAdmin(admin.OSMGeoAdmin):\n list_display = ('name', 'campground_code', 'campground_... | python | chosen |
[
{
"from": "system",
"value": "Fix typo in Bing images.\n"
},
{
"from": "human",
"value": "from aiohttp import BasicAuth\nfrom plumeria import config\nfrom plumeria.command import commands, CommandError\nfrom plumeria.message import Response\nfrom plumeria.util import http\nfrom plumeria.util.rat... | python | chosen |
[
{
"from": "system",
"value": "Update script to show which file it is loading.\n"
},
{
"from": "human",
"value": "#!/usr/bin/env python\n\nimport json\nimport rethinkdb as r\nimport sys\nimport optparse\n\nif __name__ == \"__main__\":\n parser = optparse.OptionParser()\n parser.add_option(\... | python | chosen |
[
{
"from": "system",
"value": "Nick: Add semi-working size() function v1\n"
},
{
"from": "human",
"value": "#!/usr/bin/env python\nfrom __future__ import print_function\n\n\nclass Node(object):\n\n def __init__(self, value):\n self._val = value\n self._next = None\n\n @propert... | python | chosen |
[
{
"from": "system",
"value": "Sort by kq too when returning peer review assignments\n"
},
{
"from": "human",
"value": "# Copyright 2013 Rooter Analysis S.L.\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.... | python | chosen |
[
{
"from": "system",
"value": "Increase request timeout for dataverse\n\nDataverse responses are slow at the moment, so we need to\ngive them more time\n"
},
{
"from": "human",
"value": "DEFAULT_HOSTS = [\n 'dataverse.harvard.edu', # Harvard PRODUCTION server\n 'dataverse.lib.vir... | python | chosen |
[
{
"from": "system",
"value": "Fix earlier folly (commented and useless code)\n"
},
{
"from": "human",
"value": "from django.utils.decorators import classonlymethod\nfrom django.views.decorators.csrf import csrf_exempt\nfrom rest_framework import serializers, viewsets\n\n\nNestedAVFields = ['id',... | python | chosen |
[
{
"from": "system",
"value": "Add a secrets file in rnac notify\n\nNextflow doesn't propagate environment variables from the profile into \nthe event handler closures. This is the simplest workaround for that. \nsecrets.py should be on the cluster and symlinked into \nrnacentral_pipeline\n"
},
{
"fr... | python | chosen |
[
{
"from": "system",
"value": "Check arguments are preserved in git_push\n"
},
{
"from": "human",
"value": "import pytest\nfrom thefuck.rules.git_push import match, get_new_command\nfrom tests.utils import Command\n\n\n@pytest.fixture\ndef stderr():\n return '''fatal: The current branch master... | python | chosen |
[
{
"from": "system",
"value": "Add exception catch in gen_auth_token and add better logging messages\n"
},
{
"from": "human",
"value": "from itsdangerous import TimedJSONWebSignatureSerializer as Serializer\nfrom flask import request as flask_request\nfrom flask import abort\n\nimport logging\nim... | python | chosen |
[
{
"from": "system",
"value": "Add test for french tokenizer\n"
},
{
"from": "human",
"value": "# encoding: utf8\nfrom __future__ import unicode_literals\nfrom ...fr import French\n\ndef test_load_french():\n nlp = French()\n doc = nlp(u'Parlez-vous français?')\n"
},
{
"from": "gpt"... | python | chosen |
[
{
"from": "system",
"value": "Remove all-gap columns after removing rows of the alignment\n"
},
{
"from": "human",
"value": "#!/usr/bin/env python2.3\n\n\"\"\"\nRead a maf file from stdin and write out a new maf with only blocks having all\nof the required in species, after dropping any other sp... | python | chosen |
[
{
"from": "system",
"value": "Deal with request's urllib3 being annoying about 'strict'\n\nThese changes are required to get tests to pass in python3.4 (and\npresumably others).\n\nThis is entirely code from @sashahart, who had done the work earlier\nto deal with with some Debian related issues uncovered by... | python | chosen |
[
{
"from": "system",
"value": "Reduce changelog excerpt for webpage and pdf\n"
},
{
"from": "human",
"value": "# remove section numbers for subheadings\n# Based on Wagner Macedo's filter.py posted at\n# https://groups.google.com/forum/#!msg/pandoc-discuss/RUC-tuu_qf0/h-H3RRVt1coJ\nimport pandocfi... | python | chosen |
[
{
"from": "system",
"value": "Use distributed flag for xfail test\n"
},
{
"from": "human",
"value": "import qnd\nimport tensorflow as tf\n\n\ndef model_fn(x, y):\n return (y,\n 0.0,\n tf.contrib.framework.get_or_create_global_step().assign_add())\n\n\ndef input_fn(q):\n ... | python | chosen |
[
{
"from": "system",
"value": "Make sure that the registration serialiser doesn't require the signup date.\n\nSigned-off-by: Michael Willmott <4063ad43ea4e0ae77bf35022808393a246bdfa61@gmail.com>\n"
},
{
"from": "human",
"value": "import requests\nfrom django.conf import settings\nfrom rest_framew... | python | chosen |
[
{
"from": "system",
"value": "Allow plugins to register URLs\n"
},
{
"from": "human",
"value": "from django.conf.urls import include, url\nfrom django.contrib import admin\nfrom django.conf import settings\n\nimport pretix.control.urls\nimport pretix.presale.urls\n\n\nurlpatterns = [\n url(r'... | python | chosen |
[
{
"from": "system",
"value": "Rename photo endpoint to submission\n"
},
{
"from": "human",
"value": "\"\"\".. Ignore pydocstyle D400.\n\n=============\nCore API URLs\n=============\n\nThe ``routList`` is ment to be included in ``urlpatterns`` with the\nfollowing code:\n\n.. code-block:: python\n... | python | chosen |
[
{
"from": "system",
"value": "Clean up debug printing further\n"
},
{
"from": "human",
"value": "import os, sys\nfrom glob import glob\nimport GlobalVars\n\ndef LoadFunction(path, loadAs=''):\n loadType = 'l'\n name = path\n src = __import__('Functions.' + name, globals(), locals(), [])... | python | chosen |
[
{
"from": "system",
"value": "Add some failsafes to strtobool\n"
},
{
"from": "human",
"value": "def strtobool(x):\r\n return x.lower() in (\"true\", \"yes\", \"1\", \"y\")"
},
{
"from": "gpt",
"value": "def strtobool(x):\r\n try:\r\n b = x.lower() in (\"true\", \"yes\",... | python | chosen |
[
{
"from": "system",
"value": "Use LooseVersion to compare version numbers\n"
},
{
"from": "human",
"value": "import numpy as np\nfrom numpy.testing import assert_allclose\nimport pytest\n\nfrom astropy.io import fits\n\nfrom ..pvextractor import extract_pv_slice\nfrom ..geometry.path import Path... | python | chosen |
[
{
"from": "system",
"value": "Add a model property to tell if credentials have expired\n"
},
{
"from": "human",
"value": "from django.db import models\nfrom django.contrib.auth.models import User\nimport datetime\n\ndef default_expiry_time():\n return datetime.datetime.now() + datetime.timedelt... | python | chosen |
[
{
"from": "system",
"value": "Allow linebreaks textareas (should be valid in XML)\n"
},
{
"from": "human",
"value": "import unicodedata\n\nfrom django.forms import fields\n\n\nclass XMLCompatCharField(fields.CharField):\n \"\"\"\n Strip 'control characters', as XML 1.0 does not allow them ... | python | chosen |
[
{
"from": "system",
"value": "Make sure results make sense\n"
},
{
"from": "human",
"value": "import numpy as np \nimport milk.unsupervised\n\ndef test_kmeans():\n features = np.r_[np.random.rand(20,3)-.5,.5+np.random.rand(20,3)]\n centroids, _ = milk.unsupervised.kmeans(features,2)\n p... | python | chosen |
[
{
"from": "system",
"value": "Add a hack to auto-inject new deps\n"
},
{
"from": "human",
"value": "from urllib.parse import urljoin\nfrom urllib.request import urlopen\nfrom urllib.error import URLError\n\nimport sys\n\nGITHUB_USERS = [('Polymer', '0.5.2')]\n\ndef resolve_missing_user(user, bra... | python | chosen |
[
{
"from": "system",
"value": "Define initial schema for user and email notifications\n"
},
{
"from": "human",
"value": "from django.db import models\n\n# Create your models here.\n"
},
{
"from": "gpt",
"value": "from django.db import models\nfrom django.contrib.auth.models import Use... | python | chosen |
[
{
"from": "system",
"value": "Improve varname for missing config\n"
},
{
"from": "human",
"value": "\"\"\"Configuration.\n\nYolapy.configuration provides a key-value store used by the Yola client.\n\nData is stored here in the module, benefits include:\n\n * Configuration is decoupled from appli... | python | chosen |
[
{
"from": "system",
"value": "Add ContentKeywordRouter to vumi.dispatchers API.\n"
},
{
"from": "human",
"value": "\"\"\"The vumi.dispatchers API.\"\"\"\n\n__all__ = [\"BaseDispatchWorker\", \"BaseDispatchRouter\", \"SimpleDispatchRouter\",\n \"TransportToTransportRouter\", \"ToAddrRou... | python | chosen |
[
{
"from": "system",
"value": "Add Unit test for new contributors of issues\n\nSigned-off-by: Bingwen Ma <27def536c643ce1f88ca2c07ff6169767bd9a90f@gmail.com>\n"
},
{
"from": "human",
"value": "import os\nimport pytest\n\n@pytest.fixture(scope=\"module\")\ndef augur_db():\n import augur\n au... | python | chosen |
[
{
"from": "system",
"value": "Convert rows to list in EVL CEG parser\n\nIt needs to access cells directly\n"
},
{
"from": "human",
"value": "from datetime import datetime\nimport itertools\nfrom tests.support.test_helpers import d_tz\n\n\ndef ceg_volumes(rows):\n def ceg_keys(rows):\n ... | python | chosen |
[
{
"from": "system",
"value": "Test custom root path redirect\n"
},
{
"from": "human",
"value": "\"\"\"\n:Copyright: 2006-2021 Jochen Kupperschmidt\n:License: Revised BSD (see `LICENSE` file for details)\n\"\"\"\n\nimport pytest\n\nfrom tests.helpers import http_client\n\n\ndef test_homepage(site... | python | chosen |
[
{
"from": "system",
"value": "Put language modal in alphabetical order LMS-2302\n"
},
{
"from": "human",
"value": "\"\"\"\nModels for the dark-launching languages\n\"\"\"\nfrom django.db import models\n\nfrom config_models.models import ConfigurationModel\n\n\nclass DarkLangConfig(ConfigurationM... | python | chosen |
[
{
"from": "system",
"value": "Fix unexpected success on sum(bytearray())\n"
},
{
"from": "human",
"value": "from .. utils import TranspileTestCase, BuiltinFunctionTestCase\n\n\nclass SumTests(TranspileTestCase):\n def test_sum_list(self):\n self.assertCodeExecution(\"\"\"\n ... | python | chosen |
[
{
"from": "system",
"value": "Print more helpful messages when tests fail\n"
},
{
"from": "human",
"value": "#!/usr/bin/env python\n# -*- encoding: utf-8 -*-\n\n'Test the functions in the instrumentdb module.'\n\nimport os.path\nimport unittest as ut\n\nimport stripeline.instrumentdb as idb\n\nc... | python | chosen |
[
{
"from": "system",
"value": "Move MonteCarlo move to choose_move\n"
},
{
"from": "human",
"value": "import random\nfrom collections import defaultdict, Counter\nfrom . import Player\nfrom ..util import utility\n\n\nclass MonteCarlo(Player):\n\n name = 'MonteCarlo'\n\n def __init__(self, n... | python | chosen |
[
{
"from": "system",
"value": "[1.6.x] Update version number for security release.\n"
},
{
"from": "human",
"value": "VERSION = (1, 6, 6, 'alpha', 0)\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 cal... | python | chosen |
[
{
"from": "system",
"value": "Swap order of clean calls\n"
},
{
"from": "human",
"value": "from django import forms\nfrom django.forms.fields import IntegerField, CharField\n\nimport evelink.account\n\n\nclass AddAPIForm(forms.Form):\n key_id = IntegerField()\n v_code = CharField(max_lengt... | python | chosen |
[
{
"from": "system",
"value": "Add printing value for any key from model.npz\n"
},
{
"from": "human",
"value": "#!/usr/bin/env python3\n\nimport sys\nimport argparse\nimport numpy as np\nimport yaml\n\n\nDESC = \"Prints version and model type from model.npz file.\"\nS2S_SPECIAL_NODE = \"special:m... | python | chosen |
[
{
"from": "system",
"value": "Add oanda environment selector from runtime environments.\n"
},
{
"from": "human",
"value": "# -*- encoding:utf8 -*-\n\nimport os\nfrom model.oandapy import oandapy\n\n\nclass OrderBook(object):\n\n def get_latest_orderbook(self, instrument, period, history):\n ... | python | chosen |
[
{
"from": "system",
"value": "Print the percentage from the task-usage-index script\n"
},
{
"from": "human",
"value": "#!/usr/bin/env python3\n\nimport os, sys\nsys.path.append(os.path.join(os.path.dirname(__file__), '..', 'lib'))\n\nimport glob, json\nimport numpy as np\n\nimport task_usage\n\n... | python | chosen |
[
{
"from": "system",
"value": "[gardening][build-script] Fix typo XCRun -> xcrun"
},
{
"from": "human",
"value": "# test_xcrun.py - Unit tests for swift_build_support.xcrun -*- python -*-\n#\n# This source file is part of the Swift.org open source project\n#\n# Copyright (c) 2014 - 2016 Apple Inc... | python | chosen |
[
{
"from": "system",
"value": "Change MentionType to use fixed enum values.\n"
},
{
"from": "human",
"value": "#\n# mention.py\n#\n# statbot - Store Discord records for later analysis\n# Copyright (c) 2017 Ammon Smith\n#\n# statbot is available free of charge under the terms of the MIT\n# License... | python | chosen |
[
{
"from": "system",
"value": "Add abstract method exceptions to make Animation inheritance easier\n"
},
{
"from": "human",
"value": "# TBD: Some animations mutate a pattern: shift it, fade it, etc.\n# Not all animations need a pattern\n# I need a rainbow pattern for fun\n\n# TBD: How do you do r... | python | chosen |
[
{
"from": "system",
"value": "Set gunicorn workers to 4\n"
},
{
"from": "human",
"value": "bind = ':5000'\nworkers = 2\nerrorlog = '/var/log/hgprofiler_gunicorn_error.log'\nloglevel = 'info'\naccesslog = '/var/log/hgprofiler_gunicorn_access.log'\n"
},
{
"from": "gpt",
"value": "bind ... | python | chosen |
[
{
"from": "system",
"value": "Add login required for profile edit\n"
},
{
"from": "human",
"value": "from django.conf.urls.defaults import *\nfrom django.contrib.auth.decorators import login_required\nfrom profiles.views import (ProfilesList,\n ProfileEdit,\n)\n\nurlpa... | python | chosen |
[
{
"from": "system",
"value": "Update the rate_limited decorator test\n"
},
{
"from": "human",
"value": "from seleniumbase import BaseCase\nfrom seleniumbase.common import decorators\n\n\nclass MyTestClass(BaseCase):\n\n @decorators.rate_limited(3.5) # The arg is max calls per second\n def... | python | chosen |
[
{
"from": "system",
"value": "Test blueprints for corner cases\n"
},
{
"from": "human",
"value": "# coding: utf-8\nimport os, sys\nsys.path.append(os.path.join(sys.path[0], '..'))\n\nfrom carlo import model, entity, generate\n\ndef test_minimal_model():\n m = model(entity('const', {'int': lam... | python | chosen |
[
{
"from": "system",
"value": "Add recentBuilds and stream to project index\n"
},
{
"from": "human",
"value": "from __future__ import absolute_import, division, unicode_literals\n\nfrom sqlalchemy.orm import joinedload\n\nfrom changes.api.base import APIView\nfrom changes.models import Project, B... | python | chosen |
[
{
"from": "system",
"value": "Allow Blob to be accessed with __getitem__\n"
},
{
"from": "human",
"value": "import json\nimport hashlib\n\nfrom wdim import orm\nfrom wdim.orm import fields\nfrom wdim.orm import exceptions\n\n\nclass Blob(orm.Storable):\n\n HASH_METHOD = 'sha256'\n\n _id = ... | python | chosen |
[
{
"from": "system",
"value": "Test correct heading returned in search results\n"
},
{
"from": "human",
"value": "from django.test import TestCase\nfrom compass.models import (Category,\n Book)\n\n\nclass CategoryTestCase(TestCase):\n def test_can_add_category(self,)... | python | chosen |
[
{
"from": "system",
"value": "Make StripeResponse a new-style class\n"
},
{
"from": "human",
"value": "from __future__ import absolute_import, division, print_function\n\nimport json\n\n\nclass StripeResponse:\n\n def __init__(self, body, code, headers):\n self.body = body\n sel... | python | chosen |
[
{
"from": "system",
"value": "Undo the webtest import... it's causing runtime failiure and unittests are\ncurrently broken anyway.\n"
},
{
"from": "human",
"value": "# Copyright 2008 Red Hat, Inc.\n# This file is part of python-fedora\n# \n# python-fedora is free software; you can redistribute i... | python | chosen |
[
{
"from": "system",
"value": "Use splitlines instead of split on new line.\n"
},
{
"from": "human",
"value": "import re\n\nLATEX_ERR_RE = re.compile(r'(?P<filename>[^:]+):(?P<line>[0-9]*):'\n r'\\s*(?P<error>.*)')\n\n\ndef parse_log(log, context_size=3):\n lines = log... | python | chosen |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.