conversations listlengths 2 3 | source stringclasses 1
value | stack stringclasses 1
value |
|---|---|---|
[
{
"from": "system",
"value": "Use alternate import for RTD.\n"
},
{
"from": "human",
"value": "import os\nimport sys\nimport qirest\n\nextensions = ['sphinx.ext.autodoc', 'sphinx.ext.intersphinx', 'sphinx.ext.todo']\nautoclass_content = \"both\"\nautodoc_default_flags= ['members', 'show-inherita... | python | chosen |
[
{
"from": "system",
"value": "Remove spaces from hash tag links\n"
},
{
"from": "human",
"value": "from django import template\nfrom django.contrib.auth.models import User\nfrom django.utils.safestring import mark_safe\nimport re\nimport urllib\n\nregister = template.Library()\n\nusername_re = r... | python | chosen |
[
{
"from": "system",
"value": "Add the checkRecaptcha( req, secret, simple=True ) function\n"
},
{
"from": "human",
"value": "#-*- coding: utf-8 -*-\n\ndef getClientIP( req ):\n\t'''\n\tGet the client ip address\n\t'''\n\txForwardedFor=req.META.get('HTTP_X_FORWARDED_FOR')\n\tif xForwardedFor:\n\t... | python | chosen |
[
{
"from": "system",
"value": "Change problem description so it actually makes sense\n"
},
{
"from": "human",
"value": "# euler 009\n\n# A Pythagorean triplet is a set of three natural numbers, a < b < c, for which,\n# a^2 + b^2 = c^2\n#\n# For example, 32 + 42 = 9 + 16 = 25 = 52.\n# \n# There ex... | python | chosen |
[
{
"from": "system",
"value": "Add API client to global envar\n"
},
{
"from": "human",
"value": "# -*- coding: utf8 -*-\n\"\"\"Jinja globals module for pybossa-discourse.\"\"\"\n\nfrom flask import Markup, request\nfrom . import discourse_client\n\n\nclass DiscourseGlobals(object):\n \"\"\"A c... | python | chosen |
[
{
"from": "system",
"value": "Disable front-end testing on Travis\n\nTravis has dificulty running the front-end tests.\nFor now we'll disable them.\n"
},
{
"from": "human",
"value": "\n# SECRET_KEY and DATABASES needs to be defined before the base settings is imported.\nSECRET_KEY = 'hbqnTEq+m7T... | python | chosen |
[
{
"from": "system",
"value": "Write the first view - news feed.\n"
},
{
"from": "human",
"value": "from django.shortcuts import render\n\n# Create your views here.\n"
},
{
"from": "gpt",
"value": "from django.shortcuts import render\n\nfrom fb.models import UserPost\n\n\ndef index(re... | python | chosen |
[
{
"from": "system",
"value": "Test if rotor encodes with different offset properly\n"
},
{
"from": "human",
"value": "import unittest\n\nfrom enigma import Enigma, Steckerbrett, Umkehrwalze, Walzen\n\n\nclass RotorTestCase(unittest.TestCase):\n def test_rotor_encoding(self):\n rotor = ... | python | chosen |
[
{
"from": "system",
"value": "Fix project name in urlconf\n"
},
{
"from": "human",
"value": "import watson\nfrom cms.apps.pages.models import ContentBase\nfrom cms.models import HtmlField, SearchMetaBase\nfrom django.db import models\n\n\nclass Careers(ContentBase):\n\n # The heading that the... | python | chosen |
[
{
"from": "system",
"value": "Use itertools.repeat over slower alternatives."
},
{
"from": "human",
"value": "from itertools import dropwhile, count, cycle\nimport random\n\n\ndef geometric(p):\n return (next(dropwhile(lambda _: random.randint(1, int(1. / p)) == 1, count())) for _ in cycle([1... | python | chosen |
[
{
"from": "system",
"value": "Remove dependency from remotecv worker on queued detector\n"
},
{
"from": "human",
"value": "from remotecv import pyres_tasks\nfrom remotecv.unique_queue import UniqueQueue\n\nfrom thumbor.detectors import BaseDetector\n\nclass QueuedDetector(BaseDetector):\n que... | python | chosen |
[
{
"from": "system",
"value": "Add a name to the index URL\n"
},
{
"from": "human",
"value": "from django.conf.urls.defaults import *\n\n# Uncomment the next two lines to enable the admin:\nfrom django.contrib import admin\nfrom django.views.generic.simple import direct_to_template\nadmin.autodis... | python | chosen |
[
{
"from": "system",
"value": "Add randcolor function to uitl\n"
},
{
"from": "human",
"value": "\ndef product(nums):\n r = 1\n for n in nums:\n r *= n\n return r\n\ndef choose(n, k):\n if 0 <= k <= n:\n ntok = 1\n ktok = 1\n for t in range(1, min(k, n - k)... | python | chosen |
[
{
"from": "system",
"value": "Move admin authentication into before_request handler\n"
},
{
"from": "human",
"value": "from flask import Blueprint, render_template\nfrom flask_security import login_required\n\nadmin = Blueprint('admin', __name__)\n\n\n@admin.route('/')\n@admin.route('/index')\n@... | python | chosen |
[
{
"from": "system",
"value": "Add docstring to explain the code\n"
},
{
"from": "human",
"value": "from dal import autocomplete\nfrom django import forms\n\n\nclass BikeModelForm(forms.ModelForm):\n def __init__(self, *args, **kw):\n super(BikeModelForm, self).__init__(*args, **kw)\n ... | python | chosen |
[
{
"from": "system",
"value": "Change some of the relative imports, which fail in doctests, to absolute imports.\n"
},
{
"from": "human",
"value": "\"\"\"\nThe Arcade Library\n\nA Python simple, easy to use module for creating 2D games.\n\"\"\"\nimport arcade.key\nimport arcade.color\n\nfrom .ver... | python | chosen |
[
{
"from": "system",
"value": "[FIX] portal_sale_distributor: Adjust to avoid bugs with other values in context\n\ncloses ingadhoc/sale#493\n\nX-original-commit: 441d30af0c3fa8cbbe129893107436ea69cca740\nSigned-off-by: Juan José Scarafía <1d1652a8631a1f5a0ea40ef8dcad76f737ce6379@adhoc.com.ar>\n"
},
{
... | python | chosen |
[
{
"from": "system",
"value": "Disable accelerate_simd test for now.\n"
},
{
"from": "human",
"value": "# TestAccelerateSIMD.py\n#\n# This source file is part of the Swift.org open source project\n#\n# Copyright (c) 2014 - 2018 Apple Inc. and the Swift project authors\n# Licensed under Apache Lic... | python | chosen |
[
{
"from": "system",
"value": "Change broken course_modes migration to not touch the database.\n\nChanging a field name in the way that we did (updating the Python\nvariable name and switching it to point to the old DB column) confuses\nDjango's migration autodetector. No DB changes are actually necessary,\n... | python | chosen |
[
{
"from": "system",
"value": "Add possibility to debug csv streamer views.\n"
},
{
"from": "human",
"value": "# -*- coding: utf-8 -*-\nimport functools\nimport io\nfrom urllib.parse import quote\n\n\nfrom django.http import StreamingHttpResponse\n\n\ndef strip_generator(fn):\n @functools.wrap... | python | chosen |
[
{
"from": "system",
"value": "Add update interval constant. Add detail to constructor.\n"
},
{
"from": "human",
"value": "#!/usr/bin/env python\n#\n# Copyright 2012 Jim Lawton. All Rights Reserved.\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may not use this fi... | python | chosen |
[
{
"from": "system",
"value": "Add statistics about general speaking\n"
},
{
"from": "human",
"value": "import operator\n\nclass Plugin:\n def __call__(self, bot):\n bot.on_hear(r\"(lol|:D|:P)\", self.on_hear)\n bot.on_respond(r\"stats\", self.on_respond)\n bot.on_help(\"s... | python | chosen |
[
{
"from": "system",
"value": "Add some spaces to get_list_as_english\n"
},
{
"from": "human",
"value": "def get_readable_list(passed_list, sep=', '):\n\toutput = \"\"\n\tfor i, item in enumerate(passed_list):\n\t\tif len(passed_list) is 1:\n\t\t\toutput += str(item)\n\n\t\telse:\n\t\t\tif i is n... | python | chosen |
[
{
"from": "system",
"value": "Fix bug to actually find the sdk\n"
},
{
"from": "human",
"value": "import sh, os\nfrom PblCommand import PblCommand\n\nclass PblBuildCommand(PblCommand):\n name = 'build'\n help = 'Build your Pebble project'\n\n def configure_subparser(self, parser):\n parser... | python | chosen |
[
{
"from": "system",
"value": "Move on if email exists\n"
},
{
"from": "human",
"value": "from __future__ import unicode_literals\n\nimport csv\n\nfrom django.core.management.base import BaseCommand\n\nfrom candidatebot.helpers import CandidateBot\nfrom popolo.models import Person\n\n\nclass Comm... | python | chosen |
[
{
"from": "system",
"value": "Check environment variables before the tests are started\n"
},
{
"from": "human",
"value": "def main():\n pass\n\n\nif __name__ == \"__main__\":\n # execute only if run as a script\n main()\n"
},
{
"from": "gpt",
"value": "import json\nimport ti... | python | chosen |
[
{
"from": "system",
"value": "Use feeds instead of rss\n"
},
{
"from": "human",
"value": "from django.conf.urls import patterns, url\n\nfrom sitecontent import views\n\n\nurlpatterns = patterns('',\n url(\"^rss/(?P<format>.*)$\",\n \"sitecontent.views.blog_post_feed_richtext_filters\",... | python | chosen |
[
{
"from": "system",
"value": "Use version gathering logic from hydrachain\n"
},
{
"from": "human",
"value": "# -*- coding: utf-8 -*-\n# ############# version ##################\nfrom pkg_resources import get_distribution, DistributionNotFound\nimport os.path\nimport subprocess\ntry:\n _dist =... | python | chosen |
[
{
"from": "system",
"value": "fix: Test Case for accounting dimension\n"
},
{
"from": "human",
"value": "# -*- coding: utf-8 -*-\n# Copyright (c) 2019, Frappe Technologies Pvt. Ltd. and Contributors\n# See license.txt\nfrom __future__ import unicode_literals\n\n# import frappe\nimport unittest\n... | python | chosen |
[
{
"from": "system",
"value": "Move import to top level to avoid import fail after fist time on sys.modules hack\n"
},
{
"from": "human",
"value": "from pyspark.sql.functions import udf\nfrom pyspark.sql.types import *\nfrom pyspark.sql import DataFrame\nimport sys\nimport sparknlp\n\n\ndef map_a... | python | chosen |
[
{
"from": "system",
"value": "Add test for non-member access\n"
},
{
"from": "human",
"value": "from __future__ import absolute_import\n\nfrom django.core.urlresolvers import reverse\n\nfrom sentry.testutils import TestCase, PermissionTestCase\n\n\nclass OrganizationHomePermissionTest(Permission... | python | chosen |
[
{
"from": "system",
"value": "Add specific colors for heights\n"
},
{
"from": "human",
"value": "#!/usr/bin/env python\nfrom rgbmatrix import RGBMatrix\nfrom random import randint\nimport numpy\nimport math\nimport time\n\nrows = 16\nchains = 1\nparallel = 1\nledMatrix = RGBMatrix(rows, chains, ... | python | chosen |
[
{
"from": "system",
"value": "Add missing ensure_str for PY2\n"
},
{
"from": "human",
"value": "# -*- coding: utf-8 -*-\n\nimport sys\n\nPY2 = sys.version_info[0] == 2\nPY3 = sys.version_info[0] == 3\ndefault_encoding = \"UTF-8\"\n\ndef with_metaclass(meta, *bases):\n class metaclass(meta):\n... | python | chosen |
[
{
"from": "system",
"value": "Update the test model definitions.\n"
},
{
"from": "human",
"value": "from django.db import models\n\nfrom ..base import ModelLookup\nfrom ..registry import registry\n\n\nclass Thing(models.Model):\n name = models.CharField(max_length=100)\n description = mode... | python | chosen |
[
{
"from": "system",
"value": "Implement a test if read_user_choice raises on invalid options\n"
},
{
"from": "human",
"value": "# -*- coding: utf-8 -*-\n\nimport click\nimport pytest\n\nfrom cookiecutter.compat import read_user_choice\n\nOPTIONS = ['hello', 'world', 'foo', 'bar']\n\n\nEXPECTED_P... | python | chosen |
[
{
"from": "system",
"value": "Revert wsgi keep alive as well\n\nit's one of the last remaining items different between our known good state and current wild cpu usage"
},
{
"from": "human",
"value": "# see http://docs.gunicorn.org/en/latest/configure.html#configuration-file\n\nfrom os import get... | python | chosen |
[
{
"from": "system",
"value": "Add auth protocol for keystone connection in vnc_api\n"
},
{
"from": "human",
"value": "import string\n\ntemplate = string.Template(\"\"\"\n[global]\n;WEB_SERVER = 127.0.0.1\n;WEB_PORT = 9696 ; connection through quantum plugin\n\nWEB_SERVER = 127.0.0.1\nWEB_PORT =... | python | chosen |
[
{
"from": "system",
"value": "Add the new cluster validity methods in the module.\n"
},
{
"from": "human",
"value": "# -*- coding: utf-8 -*-\n\"\"\"\n\n\n\"\"\"\n# Author: Avraam Marimpis <avraam.marimpis@gmail.com>\n\nfrom .ng import NeuralGas\nfrom .mng import MergeNeuralGas\nfrom .rng import ... | python | chosen |
[
{
"from": "system",
"value": "Fix newlines to match formatting in the rest of project.\n"
},
{
"from": "human",
"value": "import re\n\n\n\ndef register_filters():\n\t\"\"\"Register a function with decorator\"\"\"\n\tregistry = {}\n\tdef registrar(func):\n\t\tregistry[func.__name__] = func\n\t\tr... | python | chosen |
[
{
"from": "system",
"value": "Delete excess code in the latest test scenario.\n"
},
{
"from": "human",
"value": "import unittest\nimport os\nimport re\n\nos.sys.path.insert(0, os.path.dirname(os.path.dirname(os.path.abspath(__file__))))\n\nimport parsePoaXml\nimport generatePoaXml\n\n# Import te... | python | chosen |
[
{
"from": "system",
"value": "Remove redundant case property check\n"
},
{
"from": "human",
"value": "from casexml.apps.case.util import get_datetime_case_property_changed\nfrom custom.enikshay.const import (\n ENROLLED_IN_PRIVATE,\n REAL_DATASET_PROPERTY_VALUE,\n)\n\n\nclass PrivateNiksha... | python | chosen |
[
{
"from": "system",
"value": "Include command: All arguments lowercase. Require file, default to empty\nmacros"
},
{
"from": "human",
"value": "'''\nCreated on Mar 8,2015\n\n@author: qiuyx\n'''\nfrom scan.commands.command import Command\nimport xml.etree.ElementTree as ET\n\nclass Include(Comman... | python | chosen |
[
{
"from": "system",
"value": "Add last modified to search index\n"
},
{
"from": "human",
"value": "from haystack import indexes\nfrom celery_haystack.indexes import CelerySearchIndex\n\nfrom popolo.models import Person\n\n\nclass PersonIndex(CelerySearchIndex, indexes.Indexable):\n # FIXME: t... | python | chosen |
[
{
"from": "system",
"value": "Break list declaration in multiple lines\n"
},
{
"from": "human",
"value": "# -*- coding: utf-8 -*-\nfrom chatterbot import ChatBot\n\n\nbot = ChatBot(\n \"Unit Converter\",\n logic_adapters=[\n \"chatterbot.logic.UnitConversion\",\n ],\n input_ad... | python | chosen |
[
{
"from": "system",
"value": "Check forerror codes from temba connection issues\n"
},
{
"from": "human",
"value": "from django.utils.translation import ugettext_lazy as _\nfrom django.http import HttpResponseBadRequest\n\nfrom temba_client.base import TembaAPIError\n\n\nclass HandleTembaAPIError... | python | chosen |
[
{
"from": "system",
"value": "Print command in failure case\n"
},
{
"from": "human",
"value": "# A romanesco script to convert a slide to a TIFF using vips.\nimport subprocess\nimport os\n\nout_path = os.path.join(_tempdir, out_filename)\n\nconvert_command = (\n 'vips',\n 'tiffsave',\n ... | python | chosen |
[
{
"from": "system",
"value": "Add hash and eq methods\n"
},
{
"from": "human",
"value": "\"\"\"\n\nFile: abstract_constraint.py\n\nPurpose: Define a constraint, in an abstract sense, related to a number of actors.\n\n\"\"\"\nfrom abc import ABCMeta, abstractmethod\n\n\nclass AbstractConstraint(o... | python | chosen |
[
{
"from": "system",
"value": "Python: Create PyPI Release for 1.9.5.0.\n\n\n\nRevision created by MOE tool push_codebase.\nMOE_MIGRATION=7043\n"
},
{
"from": "human",
"value": "#!/usr/bin/env python\n\"\"\"Setup specs for packaging, distributing, and installing MR lib.\"\"\"\n\nimport distribute... | python | chosen |
[
{
"from": "system",
"value": "Remove /u/ from username path\n"
},
{
"from": "human",
"value": "import dateutil.parser\nimport datetime\nimport humanize\n\nstatus_view = \"\"\"\\\n=== Bashhub Status\nhttps://bashhub.com/u/{0}\nTotal Commands: {1}\nTotal Sessions: {2}\nTotal Systems: {3}\n===\nSe... | python | chosen |
[
{
"from": "system",
"value": "Include intake.cat. YAML is easier than entry_points.\n"
},
{
"from": "human",
"value": "# Import intake to run driver discovery first and avoid circular import issues.\nimport intake\ndel intake\n\nimport warnings\nimport logging\n\n\nlogger = logging.getLogger(__n... | python | chosen |
[
{
"from": "system",
"value": "Change download survey data display verb to 'Send CSV via e-mail'.\n"
},
{
"from": "human",
"value": "from go.vumitools.conversation.definition import (\n ConversationDefinitionBase, ConversationAction)\nfrom go.apps.surveys.tasks import export_vxpolls_data\n\n\n... | python | chosen |
[
{
"from": "system",
"value": "Fix the Redis client connection to actually work\n\nIt previously lied.\n"
},
{
"from": "human",
"value": "import txredisapi as redis\nfrom twisted.internet import defer, reactor\nimport config\n\nconnection = None\n\n@defer.inlineCallbacks\ndef run_redis_client(on_... | python | chosen |
[
{
"from": "system",
"value": "Fix for Friendly tips when Missing SOCIAL_AUTH_ALLOWED_REDIRECT_URIS\n\ni forget add SOCIAL_AUTH_ALLOWED_REDIRECT_URIS to my config\r\n\r\nit return 400 error, i don't know why , i pay more time find the issues\r\n\r\nso i add Friendly tips\r\n\r\n-- sorry , my english is no... | python | chosen |
[
{
"from": "system",
"value": "Make exception message builder a nicer function\n\nIt is used by clients in other modules."
},
{
"from": "human",
"value": "\"\"\"\n\nVery basic implementation of an event loop\n==========================================\n\nThe eventloop is a singleton to schedule a... | python | chosen |
[
{
"from": "system",
"value": "Allow admin creation after initial setup\n"
},
{
"from": "human",
"value": "from freeposte import manager, db\nfrom freeposte.admin import models\nfrom passlib import hash\n\n\n@manager.command\ndef flushdb():\n \"\"\" Flush the database\n \"\"\"\n db.drop_... | python | chosen |
[
{
"from": "system",
"value": "Tests(blob): Use byte string for test\n"
},
{
"from": "human",
"value": "import pytest\nfrom sqlobject import BLOBCol, SQLObject\nfrom sqlobject.compat import PY2\nfrom sqlobject.tests.dbtest import setupClass, supports\n\n\n########################################\... | python | chosen |
[
{
"from": "system",
"value": "Fix plugin test by running scripts as user deploy\n"
},
{
"from": "human",
"value": "from fabric.api import *\nimport os\nimport re\n\n__all__ = []\n\n@task\ndef test(plugin_path):\n \"\"\"\n Symbolically link a host file that contains a redcap plugin into the... | python | chosen |
[
{
"from": "system",
"value": "Make all API resource collection endpoints plural\n\n/api/job/ -> /api/jobs/\n/api/metric/ -> /api/metrics/\n\nIt's a standard convention in RESTful APIs to make endpoints for\ncollections plural.\n"
},
{
"from": "human",
"value": "from django.conf.urls import inclu... | python | chosen |
[
{
"from": "system",
"value": "Add redirect to cardbox if root url is accessed\n"
},
{
"from": "human",
"value": "from django.conf.urls import patterns, include, url\n\n# Uncomment the next two lines to enable the admin:\nfrom django.contrib import admin\nadmin.autodiscover()\n\nurlpatterns = pat... | python | chosen |
[
{
"from": "system",
"value": "Update unit test for ad8bcd8\n"
},
{
"from": "human",
"value": "# -*- coding: utf-8 -*-\nimport unittest\nfrom gtts.tokenizer.pre_processors import tone_marks, end_of_line, abbreviations, word_sub\n\n\nclass TestPreProcessors(unittest.TestCase):\n def test_tone_m... | python | chosen |
[
{
"from": "system",
"value": "Update push_pull example to work with latest changes\n"
},
{
"from": "human",
"value": "from functions import print_message\nfrom osbrain.core import Proxy\n\n\npusher = Proxy('Pusher')\npuller = Proxy('Puller')\n\naddr = pusher.bind('push')\npuller.connect(addr, pr... | python | chosen |
[
{
"from": "system",
"value": "Fix typo in log message"
},
{
"from": "human",
"value": "# -*- coding: utf-8 -*-\n\nfrom pelican import signals\nfrom subprocess import call\nimport logging\nimport os\n\nlogger = logging.getLogger(__name__)\n\n# Display command output on DEBUG and TRACE\nSHOW_OUTPU... | python | chosen |
[
{
"from": "system",
"value": "Fix appending slash in example project\n"
},
{
"from": "human",
"value": "from django.conf.urls import patterns, url\n\nfrom .views import PostListView, PostDetailView\n\nurlpatterns = patterns('',\n url(r'(?P<pk>\\d+)/$', PostDetailView.as_view(), name='detail')... | python | chosen |
[
{
"from": "system",
"value": "Update compiler_error; fixed typo line 30"
},
{
"from": "human",
"value": "#!/usr/bin/python\n# Copyright 2017 Joshua Charles Campbell\n#\n# This file is part of UnnaturalCode.\n# \n# UnnaturalCode is free software: you can redistribute it and/or modify\... | python | chosen |
[
{
"from": "system",
"value": "Fix case migrations for MySQL\n"
},
{
"from": "human",
"value": "# -*- coding: utf-8 -*-\nfrom __future__ import unicode_literals\n\nfrom django.db import migrations, models\nfrom django.db.models import Count\n\n\ndef delete_empty(apps, schema_editor):\n # We ge... | python | chosen |
[
{
"from": "system",
"value": "Add status and exam in test Biopsy\n"
},
{
"from": "human",
"value": "# -*- coding: utf-8 -*-\nfrom django.test import TestCase\nfrom django.db import models\nfrom biopsy.models import Biopsy\n\nclass BiopsyTest(TestCase):\n\n\tdef biopy_test(self):\n\t\tbiopsy = Bi... | python | chosen |
[
{
"from": "system",
"value": "Add int hook to Python3\n\nFixes #120\n"
},
{
"from": "human",
"value": "#!/usr/bin/env python\n# -*- coding: utf-8 -*-\n\"\"\"\nThis hook is necessary for compatibility with Python2.7 versions of GDB\nsince they cannot directly cast to integer a gdb.Value object th... | python | chosen |
[
{
"from": "system",
"value": "Fix typo in field name\n"
},
{
"from": "human",
"value": "import twitter\nfrom django.core.management.base import BaseCommand\nfrom django.conf import settings\n\nfrom core.models import Tweet\n\nclass Command(BaseCommand):\n help = \"Send out tweets.\"\n\n de... | python | chosen |
[
{
"from": "system",
"value": "Update to reflect not having trailing slashes\n"
},
{
"from": "human",
"value": "\"\"\"Routes configuration\n\nThe more specific and detailed routes should be defined first so they\nmay take precedent over the more generic routes. For more information\nrefer to the ... | python | chosen |
[
{
"from": "system",
"value": "Update script to include empty user agent\n"
},
{
"from": "human",
"value": "#!/usr/bin/env python3\n\nfrom sphinx.ext.intersphinx import fetch_inventory\n\nURL = \"https://docs.python.org/{}/objects.inv\"\nPATH = \"isort/stdlibs/py{}.py\"\nVERSIONS = [(\"2\", \"7\"... | python | chosen |
[
{
"from": "system",
"value": "Make sure we add the user to the site as well\n"
},
{
"from": "human",
"value": "import os\nimport sys\nimport transaction\n\nfrom sqlalchemy import engine_from_config\n\nfrom pyramid.paster import (\n get_appsettings,\n setup_logging,\n )\n\nfrom pyramid.s... | python | chosen |
[
{
"from": "system",
"value": "Add `publication_year` to return data\n"
},
{
"from": "human",
"value": "#!/usr/bin/env python\n\nimport re\nfrom xml.parsers.expat import ExpatError\n\nimport requests\nimport xmltodict\n\nfrom settings import goodreads_api_key\n\n\ndef get_goodreads_ids(comment_ms... | python | chosen |
[
{
"from": "system",
"value": "Update GR API to handle Expat Error\n"
},
{
"from": "human",
"value": "#!/usr/bin/env python\n\nimport re\n\nimport requests\nimport xmltodict\n\nfrom settings import goodreads_api_key\n\n\ndef get_goodreads_ids(comment_msg):\n # receives goodreads url\n # ret... | python | chosen |
[
{
"from": "system",
"value": "Clean up test case: not finished yet though"
},
{
"from": "human",
"value": "from boost.python import streambuf\nfrom dxtbx import read_uint16\nf = open('/Users/graeme/data/demo/insulin_1_001.img', 'rb')\nhdr = f.read(512)\nl = read_uint16(streambuf(f), 2304 * 2304)... | python | chosen |
[
{
"from": "system",
"value": "Add benchmark test for the speed of reading a LAS file\n\nTo run it you need to have `pytest-benchmark` installed, and\nrun the tests using:\n\n```\n$ pytest lasio/tests/tests_speed.py\n```\n\nTo compare two branches, you need to run and store the benchmark from the first branc... | python | chosen |
[
{
"from": "system",
"value": "Remove whitespace at end of file\n"
},
{
"from": "human",
"value": "from rest_framework import serializers\nfrom dwitter.models import Dweet, Comment\nfrom django.contrib.auth.models import User\n\nclass UserSerializer(serializers.ModelSerializer):\n class Meta:\n ... | python | chosen |
[
{
"from": "system",
"value": "Add models to Admin Panel\n"
},
{
"from": "human",
"value": "from django.contrib import admin\n\n# Register your models here.\n"
},
{
"from": "gpt",
"value": "from django.contrib import admin\nfrom game.models import *\n\nclass LocationAdmin(admin.ModelA... | python | chosen |
[
{
"from": "system",
"value": "Test drafts visible for staff users only.\n"
},
{
"from": "human",
"value": "from __future__ import unicode_literals\n\nfrom djet.testcases import ViewTestCase\n\nfrom pgallery.views import TaggedPhotoListView\n\n\nclass TaggedPhotoListViewTestCase(ViewTestCase):\n ... | python | chosen |
[
{
"from": "system",
"value": "Raise NotImplementedError if pandas is not installed\n"
},
{
"from": "human",
"value": "\"\"\" Tablib - DataFrame Support.\n\"\"\"\n\n\nimport sys\n\n\nif sys.version_info[0] > 2:\n from io import BytesIO\nelse:\n from cStringIO import StringIO as BytesIO\n\nf... | python | chosen |
[
{
"from": "system",
"value": "Build a query string with params in a dictionary and append it to the URL. Makes the code readale. Remove commented code\n"
},
{
"from": "human",
"value": "from machine import Pin\nfrom ds18x20 import DS18X20\nimport onewire\nimport time\nimport machine\nimport ujso... | python | chosen |
[
{
"from": "system",
"value": "Update to use the spec command in the latest armstrong.dev\n"
},
{
"from": "human",
"value": "from armstrong.dev.tasks import *\nfrom d51.django.virtualenv.base import VirtualEnvironment\nfrom fabric.api import task\n\n\nsettings = {\n 'DEBUG': True,\n 'INSTAL... | python | chosen |
[
{
"from": "system",
"value": "Add missing Fields according to mockup, Add markdownfield\n"
},
{
"from": "human",
"value": "from django.db import models\n\n# Create your models here.\n\nclass Tutorial(models.Model):\n title = models.TextField()\n html = models.TextField()\n markdown = mo... | python | chosen |
[
{
"from": "system",
"value": "Increment version to force build/coveralls\n"
},
{
"from": "human",
"value": "# -*- coding: utf-8 -*-\n#\n# Author: Taylor Smith <taylor.smith@alkaline-ml.com>\n#\n# The SMRT module\n\nimport sys\nimport os\n\n__version__ = '0.1'\n\ntry:\n # this var is injected ... | python | chosen |
[
{
"from": "system",
"value": "Stop inserting the CSRF token into the main app page\n"
},
{
"from": "human",
"value": "from django.shortcuts import render\nfrom django.views.decorators.csrf import ensure_csrf_cookie\n\n\n@ensure_csrf_cookie\ndef app(request):\n return render(request, 'html.htm... | python | chosen |
[
{
"from": "system",
"value": "Support using a module as a call back if it has an function attribute by the same name.\n"
},
{
"from": "human",
"value": "import traceback\n\nclass NurlyResult():\n def __init__(self, code='200 OK', head=None, body=''):\n self.head = {} if type(head) != d... | python | chosen |
[
{
"from": "system",
"value": "Convert port list to dict\n"
},
{
"from": "human",
"value": "import docker\n\nfrom etcdocker import util\n\n\nclass Container:\n def __init__(self, name, params):\n self.name = name\n self.params = params\n\n def set_or_create_param(self, key, va... | python | chosen |
[
{
"from": "system",
"value": "Document calling with __file__ as starting env path\n"
},
{
"from": "human",
"value": "# -*- coding: utf-8 -*-\n# MIT Licensed, Copyright (c) 2016 Ryan Scott Brown <sb@ryansb.com>\n\nfrom dotenv import load_dotenv, get_key, set_key, unset_key\n\ndef load_envs(path):... | python | chosen |
[
{
"from": "system",
"value": "Fix Py.Test unittests fail on new cookie\n\nFixes #1674"
},
{
"from": "human",
"value": "from django.urls import path\n\nfrom . import views\n\napp_name = \"users\"\nurlpatterns = [\n path(\"\", view=views.UserListView.as_view(), name=\"list\"),\n path(\"~redi... | python | chosen |
[
{
"from": "system",
"value": "Fix a bug in the WSGI entrypoint.\n"
},
{
"from": "human",
"value": "from pecan.deploy import deploy\napp = deploy('/opt/web/draughtcraft/src/production.py')\n\nfrom paste.exceptions.errormiddleware import ErrorMiddleware\napp = ErrorMiddleware(\n app,\n error... | python | chosen |
[
{
"from": "system",
"value": "Sort HTTP Tester Message model by id so they'll naturally be displayed in the order they were added.\nBranch: feature/httptester-update\n"
},
{
"from": "human",
"value": "#!/usr/bin/env python\n# vim: ai ts=4 sts=4 et sw=4\n\nfrom django.db import models\n\n\nDIRECT... | python | chosen |
[
{
"from": "system",
"value": "Add info about csv fields\n"
},
{
"from": "human",
"value": "# csv2map.py -- Convert .csv into a .map format\n# Description of MAP format: http://pngu.mgh.harvard.edu/~purcell/plink/data.shtml#map\n#\n# jean-daniel.granet@mines-paristech.fr\n\nimport sys\nimport a... | python | chosen |
[
{
"from": "system",
"value": "Set default to sqlite memory\n"
},
{
"from": "human",
"value": "from flask import Flask\nfrom flask_sqlalchemy import SQLAlchemy\n\nfrom os import getenv\n\n\napp = Flask(__name__)\napp.config['SQLALCHEMY_DATABASE_URI'] = getenv('DATABASE_URL',\n ... | python | chosen |
[
{
"from": "human",
"value": "Add proper formatting of logs in app init\n"
},
{
"from": "gpt",
"value": "import logging\n\nlogging.basicConfig(\n format='%(asctime)s %(levelname)-8s %(message)s',\n level=logging.INFO,\n datefmt='%Y-%m-%d %H:%M:%S')\n"
}
] | python | chosen |
[
{
"from": "system",
"value": "Make sure we're comparing integers in positive_integer\n"
},
{
"from": "human",
"value": "# Copyright (c) 2012-2013, Mark Peek <mark@peek.org>\n# All rights reserved.\n#\n# See LICENSE file for full license.\n\n\ndef boolean(x):\n if x in [True, 1, '1', 'true', '... | python | chosen |
[
{
"from": "system",
"value": "Change the name of the function\n"
},
{
"from": "human",
"value": "#!/usr/bin/env python\n\n\ndef find_points(prices, window):\n pivot = None\n next_pivot = None\n profit = 0\n\n for i, price in enumerate(prices):\n if pivot is None or price < pri... | python | chosen |
[
{
"from": "system",
"value": "Change null model name to ambivalent\n"
},
{
"from": "human",
"value": "\"\"\"\nNames of the modalities\n\"\"\"\n\n# Set constants of the names of the models so they can always be referenced\n# as variables rather than strings\n\n# Most of the density is at 0\nNEAR_... | python | chosen |
[
{
"from": "system",
"value": "Change faq processor to bulk index\n"
},
{
"from": "human",
"value": "import sys\nimport json\nimport os.path\nimport requests\n\n\ndef posts_at_url(url):\n\n current_page = 1\n max_page = sys.maxint\n\n while current_page <= max_page:\n url = os.pat... | python | chosen |
[
{
"from": "system",
"value": "Use keyword arguments to avoid accidentally setting timeout\n"
},
{
"from": "human",
"value": "import unittest\nimport bmemcached\nimport bz2\n\nclass MemcachedTests(unittest.TestCase):\n def setUp(self):\n self.server = '127.0.0.1:11211'\n self.cli... | python | chosen |
[
{
"from": "system",
"value": "Add failing test for set position method\n"
},
{
"from": "human",
"value": "\nfrom unittest import TestCase\nfrom rover import Rover\n\nclass TestRover(TestCase):\n\n def setUp(self):\n self.rover = Rover()\n\n def test_rover_compass(self):\n ass... | python | chosen |
[
{
"from": "system",
"value": "Improve Django field conversion real-life tests\n"
},
{
"from": "human",
"value": "from __future__ import absolute_import\n\nfrom django.db import models\n\n\nclass Pet(models.Model):\n name = models.CharField(max_length=30)\n\n\nclass Film(models.Model):\n re... | python | chosen |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.