conversations listlengths 2 3 | source stringclasses 1
value | stack stringclasses 1
value |
|---|---|---|
[
{
"from": "system",
"value": "Use microseconds in event sort string.\n\nThis helps javascript sorting even when two events happen\nin the same second.\n"
},
{
"from": "human",
"value": "\n# Copyright 2016 Battelle Energy Alliance, LLC\n#\n# Licensed under the Apache License, Version 2.0 (the \"L... | python | chosen |
[
{
"from": "system",
"value": "Update config file with updated project name\n"
},
{
"from": "human",
"value": "from flask.ext.script import Manager\nfrom flask.ext.alembic import ManageMigrations\nimport os\n\nfrom starter import app, db\nfrom starter.users.models import user_datastore\n\n\nmanag... | python | chosen |
[
{
"from": "system",
"value": "Fix izip import for python3\n"
},
{
"from": "human",
"value": "# -*- coding: utf-8 -*-\n\"\"\"\nmolvs.utils\n~~~~~~~~~~~\n\nThis module contains miscellaneous utility functions.\n\n:copyright: Copyright 2014 by Matt Swain.\n:license: MIT, see LICENSE file for more d... | python | chosen |
[
{
"from": "system",
"value": "Fix false-negative test caused by using fallbacked assertNotRegex\n"
},
{
"from": "human",
"value": "import unittest\nfrom pathlib import Path\nimport subprocess\n\n\nclass TestVintDoNotDiedWhenLintingVital(unittest.TestCase):\n def assertVintStillAlive(self, cmd... | python | chosen |
[
{
"from": "system",
"value": "Fix url attribute on share serializer :)"
},
{
"from": "human",
"value": "from bioshareX.models import ShareLog, Share, Tag, ShareStats\nfrom rest_framework import serializers\nfrom django.contrib.auth.models import User\nfrom django.core.urlresolvers import reverse... | python | chosen |
[
{
"from": "system",
"value": "Use log level info for HTTP statuses 500, 502, 503, 504.\n\nThese status codes are usually induced by overloaded sites, updates, short\ndowntimes, etc. and are not that relevant.\n"
},
{
"from": "human",
"value": "import logging\n\nfrom scrapy.spidermiddlewares.http... | python | chosen |
[
{
"from": "system",
"value": "Update to match changes in ob-airtable\n"
},
{
"from": "human",
"value": "import os\n\nfrom luigi import Parameter\nfrom ob_airtable import get_record_by_name, get_record\n\nAIRTABLE_EXPT_TABLE = 'Genomics%20Expt'\nAIRTABLE_SAMPLE_TABLE = 'Genomics%20Sample'\n\nS3_B... | python | chosen |
[
{
"from": "system",
"value": "Fix object serialization and deserialization in Redis Manager module.\n"
},
{
"from": "human",
"value": "import redis\nimport pickle\n\nfrom .idatabasemanager import IDatabaseManager\n\nclass RedisManager(IDatabaseManager):\n KEY_MESSAGE_QUEUE = 'message_queue'\n... | python | chosen |
[
{
"from": "system",
"value": "Disable CSRF in testing and development mode\n"
},
{
"from": "human",
"value": "import os\nbasedir = os.path.abspath(os.path.dirname(__file__))\n\nclass Config:\n SECRET_KEY = 'secret'\n\n\n\nclass DevelopmentConfig(Config):\n DEBUG = True\n\nclass ProductionC... | python | chosen |
[
{
"from": "system",
"value": "Fix slack 'invalid attachments' error message\n"
},
{
"from": "human",
"value": "from functools import wraps\n\nfrom celery import shared_task\nfrom django.conf import settings\nfrom integrations import slack\n\n\ndef switchable_task(func):\n @wraps(func)\n de... | python | chosen |
[
{
"from": "system",
"value": "Add create test file dir to setUp and tearDown\n\nMay need to revisit and identify best place to put such a directory.\n"
},
{
"from": "human",
"value": "import unittest\nimport boto\nfrom bucketeer import commit\n\nclass BuckeeterTest(unittest.TestCase):\n\n globa... | python | chosen |
[
{
"from": "human",
"value": "Add a simple app initialization function since paster shell is busted\n"
},
{
"from": "gpt",
"value": "import os.path\nimport pylons\nfrom paste.deploy import appconfig\n\n\ndef easy_app_init(ini_path):\n ini_path = os.path.abspath(ini_path)\n assert os.path.ex... | python | chosen |
[
{
"from": "system",
"value": "Fix typo and run everywhere."
},
{
"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 License v2.0 w... | python | chosen |
[
{
"from": "system",
"value": "Add default parameter and default config\n"
},
{
"from": "human",
"value": "import argparse\nimport os\nfrom doorman import Doorman\n\nparser = argparse.ArgumentParser(description='Doorman keeps your secret things')\nparser.add_argument('-s', '--secret', action=\"st... | python | chosen |
[
{
"from": "system",
"value": "Add check to ensure that we're in the same OS thread\n"
},
{
"from": "human",
"value": "import guv\n\nguv.monkey_patch()\n\nfrom guv import gyield, sleep\nimport threading\nimport greenlet\n\ngreenlet_ids = {}\n\n\ndef debug(i):\n print('{} greenlet_ids: {}'.form... | python | chosen |
[
{
"from": "system",
"value": "Add clean method for batch submission form.\n"
},
{
"from": "human",
"value": "from django import forms\n\nclass BatchMoonScanForm(forms.Form):\n data = forms.CharField(\n widget=forms.Textarea(attrs={'class':'form-control monospace'}),\n )\n"
},
{
... | python | chosen |
[
{
"from": "system",
"value": "Add __unicode__ methods to model\n"
},
{
"from": "human",
"value": "from django.db import models\n\nclass FandomHierarchy(models.Model):\n\tname = models.CharField(max_length=100)\n\tparent = models.ForeignKey('self')\n\t\nclass Image(models.Model):\n\tpixel_width =... | python | chosen |
[
{
"from": "system",
"value": "Fix running the example project with Django 1.5\n"
},
{
"from": "human",
"value": "from django.conf.urls.defaults import patterns, include, url\nfrom django.contrib import admin\nadmin.autodiscover()\n\nurlpatterns = patterns('',\n url(r'^admin/doc/', include('dj... | python | chosen |
[
{
"from": "system",
"value": "Convert to unicode for printing.\n"
},
{
"from": "human",
"value": "# Comet VOEvent Broker.\n# Example event handler: print an event.\n\nimport lxml.etree as ElementTree\nfrom zope.interface import implementer\nfrom twisted.plugin import IPlugin\nfrom comet.icomet i... | python | chosen |
[
{
"from": "system",
"value": "Add common __version__, same as VERSION\n"
},
{
"from": "human",
"value": "VERSION = (0,5,1)\n\nfrom humanize.time import *\nfrom humanize.number import *\nfrom humanize.filesize import *\nfrom humanize.i18n import activate, deactivate\n\n__all__ = ['VERSION', 'natu... | python | chosen |
[
{
"from": "system",
"value": "Add support subscriptions for parity with SSA portal\n\nThese includes:\n* customer password\n* subscription and packages\n* orders\n* import from timescout\n"
},
{
"from": "human",
"value": "from django.contrib import admin\n\nfrom timed.projects.admin import Proje... | python | chosen |
[
{
"from": "system",
"value": "Add test for size parameter of long_to_base64.\n"
},
{
"from": "human",
"value": "\nfrom datetime import timedelta\n\nfrom jose import utils\n\n\nclass TestUtils:\n\n def test_total_seconds(self):\n td = timedelta(seconds=5)\n\n assert utils.timedel... | python | chosen |
[
{
"from": "system",
"value": "Handle decompression bomb errors as well as warnings.\n"
},
{
"from": "human",
"value": "try:\n from cStringIO import StringIO\nexcept ImportError:\n from StringIO import StringIO\nfrom PIL import Image\nfrom PIL.Image import DecompressionBombWarning\n\nfrom i... | python | chosen |
[
{
"from": "system",
"value": "Remove unused permission from db\n"
},
{
"from": "human",
"value": "# Generated by Django 3.0.5 on 2020-04-15 09:43\n\nfrom django.db import migrations\n\n\ndef change_extension_permission_to_plugin_permission(apps, schema_editor):\n permission = apps.get_model(\... | python | chosen |
[
{
"from": "system",
"value": "Change versioning to be PEP compatible\n"
},
{
"from": "human",
"value": "__author__ = 'Abraham Othman'\n__copyright__ = 'Copyright 2014, Abraham Othman'\n\n__version__ = '1.0'\n__maintainer__ = 'Abraham Othman'\n__email__ = 'aothman@cs.cmu.edu'\n\nfrom .engine impo... | python | chosen |
[
{
"from": "system",
"value": "Add show_result view that extracts data from the database for the file, and sends it on to the result.html template\n"
},
{
"from": "human",
"value": "# Create your views here.\n"
},
{
"from": "gpt",
"value": "# Create your views here.\nfrom django.short... | python | chosen |
[
{
"from": "system",
"value": "Add XPath query to extract dataset name\n"
},
{
"from": "human",
"value": "from scrapy.contrib.spiders import CrawlSpider, Rule\nfrom scrapy.contrib.linkextractors.sgml import SgmlLinkExtractor\nfrom scrapy.selector import Selector\nfrom dataset import DatasetItem\n... | python | chosen |
[
{
"from": "system",
"value": "Add django-zero-downtime-migrations Postgres DB engine\n\nFrom the repo: \nhttps://github.com/tbicr/django-pg-zero-downtime-migrations"
},
{
"from": "human",
"value": "# -*- coding: utf-8 -*-\nimport os\n\nfrom django.conf import settings\n\nBASE_DIR = os.path.dirna... | python | chosen |
[
{
"from": "system",
"value": "Add scrape flag and pop html from output\n"
},
{
"from": "human",
"value": "import csv\nfrom argparse import ArgumentParser\nfrom json import dumps\n\nfrom pycargr.model import to_dict\nfrom pycargr.parser import parse_car_page\n\nparser = ArgumentParser()\nparser.a... | python | chosen |
[
{
"from": "system",
"value": "[FIX] Shell: Use args as one parameter\n\nChange-Id: If96eb33fb24e0e9c23e4bf9f20a65a48da5fc159\n"
},
{
"from": "human",
"value": "#!/usr/bin/python\n# -*- coding: utf-8 -*-\n\"\"\"\nSpawns an interactive Python shell.\n\nUsage:\n python pwb.py shell [args]\n\nIf ... | python | chosen |
[
{
"from": "system",
"value": "Set up for v0.26.0 release\n"
},
{
"from": "human",
"value": "\"\"\"SoCo (Sonos Controller) is a simple library to control Sonos speakers.\"\"\"\n\n# There is no need for all strings here to be unicode, and Py2 cannot import\n# modules with unicode names so do not u... | python | chosen |
[
{
"from": "system",
"value": "Use proper flag for single file error reporting\n\n\"inputs-only\" was changed to \"no-recursion\" before getting merged\n"
},
{
"from": "human",
"value": "#\n# linter.py\n# Linter for SublimeLinter3, a code checking framework for Sublime Text 3\n#\n# Written by Pat... | python | chosen |
[
{
"from": "system",
"value": "Fix QuickFind: stop relying on keys being integers\n"
},
{
"from": "human",
"value": "class UnionFind:\n def __init__(self, it=None):\n self.uf = {} if it is None else {i : i for i in it}\n\n self.count = len(self.uf)\n\n def __iter__(self):\n ... | python | chosen |
[
{
"from": "system",
"value": "Improve test coverage of artefact module\n"
},
{
"from": "human",
"value": "import pytest\nfrom plumbium import artefacts\n\n\ndef test_NiiGzImage_basename():\n img = artefacts.NiiGzImage('foo.nii.gz')\n assert img.basename == 'foo'\n\n\ndef test_NiiGzImage_ba... | python | chosen |
[
{
"from": "system",
"value": "Add unpacking of uint32 at an offset\n"
},
{
"from": "human",
"value": "from struct import unpack\n\n\ndef read_uint32(fileobj):\n return unpack(\"I\", fileobj.read(4))[0]\n\n# read int as a big endian number\ndef read_uint32_BE(fileobj):\n return unpack(\">I\... | python | chosen |
[
{
"from": "system",
"value": "Make view to handle saving and displaying of preferences form\n"
},
{
"from": "human",
"value": "from django.shortcuts import render\nfrom django.views.generic.edit import FormView\n\nfrom registration.forms import RegistrationFormUniqueEmail\nfrom registration.back... | python | chosen |
[
{
"from": "system",
"value": "Load articles/snippets as binary strings\n"
},
{
"from": "human",
"value": "# -*- coding: utf8 -*-\n\nfrom __future__ import absolute_import\nfrom __future__ import division, print_function, unicode_literals\n\nfrom os.path import abspath, dirname, join\n\n\nTEST_DI... | python | chosen |
[
{
"from": "system",
"value": "Add permission to edit user\n"
},
{
"from": "human",
"value": "from rest_framework import generics\nfrom django.contrib.auth.models import User\nfrom users.serializers import UserSerializer\n\n\nclass UserList(generics.ListCreateAPIView):\n queryset = User.object... | python | chosen |
[
{
"from": "system",
"value": "Check for dev version of zmq per @minrk's request"
},
{
"from": "human",
"value": "#-----------------------------------------------------------------------------\n# Copyright (C) 2010 The IPython Development Team\n#\n# Distributed under the terms of the BSD Licen... | python | chosen |
[
{
"from": "system",
"value": "Move after scaling during decomposition.\n"
},
{
"from": "human",
"value": "def decomposeGlyph(glyph):\n \"\"\"Moves the components of a glyph to its outline.\"\"\"\n\n font = glyph.getParent()\n for component in glyph.components:\n componentGlyph = ... | python | chosen |
[
{
"from": "system",
"value": "Send PM to querying user (i think? bad docs.)\n"
},
{
"from": "human",
"value": "import pre\n\nimport supybot.log as log\nimport supybot.conf as conf\nimport supybot.utils as utils\nimport supybot.world as world\nimport supybot.ircdb as ircdb\nfrom supybot.commands ... | python | chosen |
[
{
"from": "system",
"value": "Remove fixes for sublime text backwards compatibility\n\nI'm not working around sublime text issues anymore.\n"
},
{
"from": "human",
"value": "import os\nimport sublime\n\ndef plugin_loaded():\n\n disable_native_php_package_completions()\n\ndef disable_native_ph... | python | chosen |
[
{
"from": "system",
"value": "Change suggested RMG_workingDirectory path due to qm package move\n"
},
{
"from": "human",
"value": "import os\nif not os.environ.get(\"RMG_workingDirectory\"):\n import os.path\n message = \"Please set your RMG_workingDirectory environment variable.\\n\" +\\\... | python | chosen |
[
{
"from": "system",
"value": "Add missing parens that was causing an error\n"
},
{
"from": "human",
"value": "import os\n\ndef shell():\n '''\n Return the default shell to use on this system\n '''\n # Provides:\n # shell\n return {'shell': os.environ.get('SHELL', '/bin/sh'}\n... | python | chosen |
[
{
"from": "system",
"value": "Add ID support for subscription/ URLs.\n"
},
{
"from": "human",
"value": "# Copyright (C) 2014 Linaro Ltd.\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# published by th... | python | chosen |
[
{
"from": "system",
"value": "Update to new URL dispatcher syntax\n"
},
{
"from": "human",
"value": "# Django\n# Third-Party\nfrom rest_framework.documentation import include_docs_urls\nfrom rest_framework.schemas import get_schema_view\n\nfrom django.conf import settings\nfrom django.conf.urls ... | python | chosen |
[
{
"from": "system",
"value": "Test on clarifai is working and returns the tags\n"
},
{
"from": "human",
"value": "from clarifai.rest import ClarifaiApp\n\nclass Clarifai():\n \n def __init__(self, api_id, api_secret):\n self.api_id = api_id\n self.api_secret = api_secret\n\n ... | python | chosen |
[
{
"from": "human",
"value": "Add first batch of team endpoints\n"
},
{
"from": "gpt",
"value": "from src.endpoints.base import Base\n\n\nclass Teams(Base):\n\tendpoint = '/teams'\n\n\tdef create_team(self, options=None):\n\t\treturn self.client.post(\n\t\t\tself.endpoint,\n\t\t\toptions\n\t\t)\n... | python | chosen |
[
{
"from": "system",
"value": "Add multiple choice of practices to Site form\n"
},
{
"from": "human",
"value": "from crispy_forms.layout import Div\nfrom geotrek.common.forms import CommonForm\nfrom geotrek.outdoor.models import Site\n\n\nclass SiteForm(CommonForm):\n geomfields = ['geom']\n\n... | python | chosen |
[
{
"from": "system",
"value": "Check for test subreddits case insensitively.\n"
},
{
"from": "human",
"value": "from urllib import quote\n\nfrom pylons import c, g\n\nfrom r2.lib.pages import Ads as BaseAds\n\n\nclass Ads(BaseAds):\n def __init__(self):\n BaseAds.__init__(self)\n ... | python | chosen |
[
{
"from": "system",
"value": "Use += to modify __all__, to appease flake8\n"
},
{
"from": "human",
"value": "#!/usr/bin/env python\n\n__all__ = []\n\ntry:\n from silk.webdoc import css, html, node\n __all__.extend(('css', 'html', 'node'))\nexcept ImportError:\n pass\n\ntry:\n from si... | python | chosen |
[
{
"from": "system",
"value": "Allow any options to be passed through test function\n"
},
{
"from": "human",
"value": "\"\"\"Testing support (tools to test IPython itself).\n\"\"\"\n\n#-----------------------------------------------------------------------------\n# Copyright (C) 2009-2011 The I... | python | chosen |
[
{
"from": "system",
"value": "Clear $LANGUAGE before running tests\n"
},
{
"from": "human",
"value": "#!/usr/bin/env python\nimport unittest, os, sys\ntry:\n\timport coverage\n\tcoverage.erase()\n\tcoverage.start()\nexcept ImportError:\n\tcoverage = None\n\nmy_dir = os.path.dirname(sys.argv[0])\... | python | chosen |
[
{
"from": "system",
"value": "Test server existence via a socket connection\n"
},
{
"from": "human",
"value": "import bottle\nimport threading\nimport time as _time\n\ndef start_bottle_server(app, port, **kwargs):\n server_thread = ServerThread(app, port, kwargs)\n server_thread.daemon = T... | python | chosen |
[
{
"from": "system",
"value": "Fix HTTPServer imports with Python 3\n"
},
{
"from": "human",
"value": "#!/usr/bin/env python\n\nimport os\nimport webbrowser\nimport BaseHTTPServer\nfrom SimpleHTTPServer import SimpleHTTPRequestHandler\n\n__all__ = ['run_server']\n\n\ndef run_server(port=8000,scen... | python | chosen |
[
{
"from": "system",
"value": "Use __file__ for static and templates\n"
},
{
"from": "human",
"value": "#!/usr/bin/env python\n# -*- coding: utf-8 -*-\n# Copyright (C) 2011 by Florian Mounier, Kozea\n# This file is part of pystil, licensed under a 3-clause BSD license.\n\"\"\"\npystil - An elegan... | python | chosen |
[
{
"from": "system",
"value": "Use the correct env variable name\n"
},
{
"from": "human",
"value": "# -*- coding: utf-8 -*-\nimport os\nfrom tweepy import Stream\nfrom tweepy import OAuthHandler\nfrom tweepy import API\nfrom tweepy.streaming import StreamListener\nfrom listener import Listener\n\... | python | chosen |
[
{
"from": "system",
"value": "Fix the test method names :)\n"
},
{
"from": "human",
"value": "import pytest\n\nfrom spec2scl.transformers.R import RTransformer\n\nfrom transformer_test_case import TransformerTestCase\n\nclass TestRTransformer(TransformerTestCase):\n def setup_method(self, met... | python | chosen |
[
{
"from": "system",
"value": "Add more robust test harvester harvest method with mocking\n"
},
{
"from": "human",
"value": "from __future__ import unicode_literals\n\nfrom scrapi.base import OAIHarvester\nfrom scrapi.linter import RawDocument\n\nfrom .utils import TEST_OAI_DOC\n\n\nclass TestHar... | python | chosen |
[
{
"from": "system",
"value": "Increase delta to reduce chance of random failure\n\nExact chance of failure is more trouble to calculate than I care to go\nto, but the the old chance of failure was likely somewhere in the 1-10%\nrange. The purpose of the test is to detect meaningful non-uniformity,\nso false... | python | chosen |
[
{
"from": "system",
"value": "Change function-based generic view to class-based.\n\nAs per their deprecation policy, Django 1.5 removed function-based\ngeneric views.\n"
},
{
"from": "human",
"value": "# encoding: utf-8\n\"\"\"\nURL conf for django-sphinxdoc.\n\n\"\"\"\nfrom django.conf.urls.def... | python | chosen |
[
{
"from": "system",
"value": "Change colors because of contrast problems.\n"
},
{
"from": "human",
"value": "import turtle\nimport random\nfrom time import sleep\n\nturtle1 = turtle.Turtle()\n\nwn = turtle.Screen()\nwn.bgcolor(\"lightgreen\")\ncolors = (\"blue\",\"red\",\"green\",\"pink\",\"gray... | python | chosen |
[
{
"from": "system",
"value": "Exit with correct error code after tests\n\nSigned-off-by: Jonas Kalderstam <35a2c6fae61f8077aab61faa4019722abf05093c@kalderstam.se>\n"
},
{
"from": "human",
"value": "import pytest\n\n\nif __name__ == '__main__':\n pytest.main(\"--pyargs lifelines.tests\")\n"
... | python | chosen |
[
{
"from": "system",
"value": "Clean rc from unit tests\n\nMagnum have removed the k8s rc apis, but have not removed it from\npolicy.json. The patch (https://review.openstack.org/#/c/384064/)\nremove rc from etc/magnum/policy.json.\n\nAnd we should remove rc from tests/fake_policy.py.\n\nChange-Id: Ia98e1637... | python | chosen |
[
{
"from": "system",
"value": "Add a get_service convenience method.\n"
},
{
"from": "human",
"value": "\"\"\"\nModules that provide services. They are implemented as\nFlask extensions (see: http://flask.pocoo.org/docs/extensiondev/ )\n\n\"\"\"\n\n__all__ = ['Service', 'ServiceState',\n ... | python | chosen |
[
{
"from": "system",
"value": "Expand the IGB Middleware to map headers into the request object\n"
},
{
"from": "human",
"value": "\nclass IGBMiddleware(object):\n \"\"\"\n Middleware to detect the EVE IGB\n \"\"\"\n\n def process_request(self, request):\n\n request.is_igb = Fa... | python | chosen |
[
{
"from": "system",
"value": "Fix migration to avoid unicode errors\n\nIf the app has a name that's not ASCII, you'd get an encoding error."
},
{
"from": "human",
"value": "from amo.utils import chunked\n\nfrom mkt.developers.tasks import generate_image_assets\nfrom mkt.webapps.models import Web... | python | chosen |
[
{
"from": "system",
"value": "Fix custom decoder on Python 3\n"
},
{
"from": "human",
"value": "# -*- coding: utf-8 -*-\nfrom datetime import datetime\nfrom time import mktime\nimport json\n\n\nclass DJSONEncoder(json.JSONEncoder):\n def default(self, obj):\n if isinstance(obj, datetim... | python | chosen |
[
{
"from": "system",
"value": "Fix error determining current version in other working directories.\n"
},
{
"from": "human",
"value": "from __future__ import absolute_import\n__author__ = 'katharine'\n\nimport os\nimport subprocess\n\nfrom pebble_tool.exceptions import MissingSDK\nfrom pebble_tool... | python | chosen |
[
{
"from": "system",
"value": "Add logging to file on side of logging to stdout\n"
},
{
"from": "human",
"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"
},
{
"from": "gpt"... | python | chosen |
[
{
"from": "system",
"value": "Stop using `exposed` prefix for remote attributes, per rpyc v4\n"
},
{
"from": "human",
"value": "import sys\nimport rpyc\nfrom rpyc.utils.server import OneShotServer\n\n\nclass GhcompService(rpyc.ClassicService):\n def on_connect(self, conn):\n print('Inc... | python | chosen |
[
{
"from": "system",
"value": "Hide variable till something actually uses it\n"
},
{
"from": "human",
"value": "\"\"\"Script to act as a template\"\"\"\n\nimport os\nimport sys\n\n\ndef main(args):\n return os.EX_OK\n\n\nif __name__ == '__main__':\n sys.exit(main(sys.argv[1:]))\n"
},
{
... | python | chosen |
[
{
"from": "system",
"value": "Update the comments for master\n"
},
{
"from": "human",
"value": "from flask import Flask\napp = Flask(__name__)\n\n\nfrom pymongo import MongoClient\n\nconnection = MongoClient()\n\n\n@app.route(\"/\")\ndef hello():\n\t\n return connection.essa.users.find({}... | python | chosen |
[
{
"from": "system",
"value": "Add more text in jumbotron\n"
},
{
"from": "human",
"value": "from django.shortcuts import render, get_object_or_404, HttpResponseRedirect, HttpResponse\nfrom myblog.models import Article\nfrom django.views.decorators.csrf import csrf_exempt\nfrom django.utils impor... | python | chosen |
[
{
"from": "system",
"value": "Add reminder to myself to to importlib fallback.\n"
},
{
"from": "human",
"value": "from django.conf import settings\nfrom django.core.exceptions import ImproperlyConfigured\nfrom django.utils.importlib import import_module\n\ndef get_backend():\n \"\"\"\n Ret... | python | chosen |
[
{
"from": "system",
"value": "Break pydocstyle to check Travis\n"
},
{
"from": "human",
"value": "\"\"\"Views for the general application.\"\"\"\n\nfrom django.views.generic import TemplateView\nfrom django.http import HttpResponse\n\n\nclass GeneralIndexView(TemplateView):\n \"\"\"View for t... | python | chosen |
[
{
"from": "system",
"value": "Fix name of config field\n"
},
{
"from": "human",
"value": "\"\"\"Training LeNet on MNIST data.\"\"\"\n\nimport athenet\nfrom athenet.data_loader import MNISTDataLoader\n\n\nnetwork = athenet.models.lenet(trained=False)\nnetwork.data_loader = MNISTDataLoader()\n\nco... | python | chosen |
[
{
"from": "system",
"value": "Check for ioflo-flavored OrderedDicts as well when outputting YAML\n"
},
{
"from": "human",
"value": "# -*- coding: utf-8 -*-\n'''\n salt.utils.yamldumper\n ~~~~~~~~~~~~~~~~~~~~~\n\n'''\n# pylint: disable=W0232\n# class has no __init__ method\n\nfrom _... | python | chosen |
[
{
"from": "system",
"value": "Add version. Note this will cause the file to be modified in your\nworking copy. This change is gitignored"
},
{
"from": "human",
"value": "#!/usr/bin/env python2\n\n# Licensed under the Apache License, Version 2.0 (the \"License\"); you may\n# not use this file exc... | python | chosen |
[
{
"from": "system",
"value": "Make the example code compatible with Python3\n"
},
{
"from": "human",
"value": "#!/bin/python\n\n# installation:\n# pip install pytz pyuploadcare~=2.1.0\n\nimport pytz\nfrom datetime import timedelta, datetime\nimport time\nfrom pyuploadcare import conf\nfrom pyupl... | python | chosen |
[
{
"from": "system",
"value": "Make the technique even more generic\n\n--HG--\nbranch : feature/issue-229\n"
},
{
"from": "human",
"value": "\"\"\"\nHandle loading six package from system or from the bundled copy\n\"\"\"\n\nimport imp\n\n\n_SIX_SEARCH_PATH = ['setuptools._vendor.six', 'six']\n\n\... | python | chosen |
[
{
"from": "system",
"value": "Make it clear this compat module provides no public members\n"
},
{
"from": "human",
"value": "try:\n # Python >=3.2\n from tempfile import TemporaryDirectory\nexcept ImportError:\n import shutil\n import tempfile\n\n class TemporaryDirectory(object):... | python | chosen |
[
{
"from": "system",
"value": "Set URL submission score cutoff to 4.\n"
},
{
"from": "human",
"value": "#encoding:utf-8\n\nfrom urllib.parse import urlparse\n\nfrom utils import get_url\n\n\nt_channel = '@ya_metro'\nsubreddit = 'Subways'\n\n\ndef send_post(submission, r2t):\n what, url, ext = ... | python | chosen |
[
{
"from": "system",
"value": "Make Shopify product fields readonly\n"
},
{
"from": "human",
"value": "from django.contrib import admin\n\nfrom .models import Product\n\n\nclass ProductAdmin(admin.ModelAdmin):\n list_display = ('description', 'product_type', 'account_number')\n ordering = (... | python | chosen |
[
{
"from": "system",
"value": "Use class decorator instead of floating statement to register WhitelistedUsernameAdmin class.\n"
},
{
"from": "human",
"value": "from django.contrib import admin\n\nfrom .models import WhitelistedUsername\n\n\nclass WhitelistedUsernameAdmin(admin.ModelAdmin):\n p... | python | chosen |
[
{
"from": "system",
"value": "Remove input from fab test\n"
},
{
"from": "human",
"value": "from fabric.api import *\nfrom fabric.colors import *\n\nenv.colorize_errors = True\nenv.hosts = ['sanaprotocolbuilder.me']\nenv.user = 'root'\nenv.virtualenv = 'source /usr/loca... | python | chosen |
[
{
"from": "system",
"value": "Change to imports for 2-3 compatibility\n"
},
{
"from": "human",
"value": "__version__ = '0.0.2'\r\n\r\nfrom daymetpy import daymet_timeseries\r\n\r\n__all__ = [\"daymet_timeseries\"]"
},
{
"from": "gpt",
"value": "__version__ = '0.0.2'\r\n\r\ntry:\r\n ... | python | chosen |
[
{
"from": "system",
"value": "Fix bling() and add in info function to report target & sender.\n"
},
{
"from": "human",
"value": "import pyrc\nimport pyrc.utils.hooks as hooks\n\nclass GangstaBot(pyrc.Bot):\n @hooks.command()\n def bling(self, target, sender):\n \"will print yo\"\n if tar... | python | chosen |
[
{
"from": "system",
"value": "Enable quick deploys in fabric\n"
},
{
"from": "human",
"value": "import os\nfrom fabric.api import *\n\nLOCAL_ROOT = os.path.dirname(os.path.realpath(__file__))\nLOCAL_VIRTUALENV = '~/.virtualenv/tomo'\nTOMO_HOST = 'www.projekt-tomo.si'\n\nenv.hosts = [TOMO_HOST]\n... | python | chosen |
[
{
"from": "system",
"value": "Add reference tree loader to imports.\n"
},
{
"from": "human",
"value": "# vytree.__init__: package init file.\n#\n# Copyright (C) 2014 VyOS Development Group <maintainers@vyos.net>\n#\n# This library is free software; you can redistribute it and/or\n# m... | python | chosen |
[
{
"from": "system",
"value": "Fix syntax for python 2.6\n"
},
{
"from": "human",
"value": "from . import TestCase\n\nfrom llvmlite import binding as llvm\nfrom llvmlite.binding import dylib\nimport platform\nfrom ctypes.util import find_library\nimport unittest\n\n@unittest.skipUnless(platform.s... | python | chosen |
[
{
"from": "system",
"value": "Add fetching live scores feature\n"
},
{
"from": "human",
"value": "\n\nimport requests\nfrom bs4 import BeautifulSoup\n\nCRICINFO_RSS_URL = 'http://static.cricinfo.com/rss/livescores.xml'\n\n# Fetching matches\ndef get_matches():\n\tr = requests.get(CRICINFO_RSS_UR... | python | chosen |
[
{
"from": "system",
"value": "Add missing close parenthesis on track dict\n"
},
{
"from": "human",
"value": "__author__ = 'dcl9'\nfrom render import render_template\nimport argparse\nimport yaml\n\n\ndef generate_track_dict(metadata):\n d = dict()\n d['track_name'] = '{}_{}({})'.format(met... | python | chosen |
[
{
"from": "system",
"value": "Add the program name to starting py\n"
},
{
"from": "human",
"value": "#!/usr/bin/env python3\n\n# from __future__ import print_function #(if python2)\n\nimport sys\n\n\ndef eprint(*args, **kwargs):\n \"\"\" Just like the print function, but on stderr\n \"\"\"... | python | chosen |
[
{
"from": "system",
"value": "Send \"no such channel\" message on NAMES with a nonexistent channel\n"
},
{
"from": "human",
"value": "from twisted.words.protocols import irc\nfrom txircd.modbase import Command\n\nclass NamesCommand(Command):\n\tdef onUse(self, user, data):\n\t\tfor chan in data[... | python | chosen |
[
{
"from": "system",
"value": "Add the choose test and take test to URLs"
},
{
"from": "human",
"value": "from django.conf.urls import patterns, url\n\nfrom examsys import views\n\nurlpatterns = patterns('',\n\t\t# (r'^$', lambda r: HttpResponseRedirect('examsys/'))\n url(r'^$', views.index, n... | python | chosen |
[
{
"from": "system",
"value": "fix: Rename parameter to more appropriate name\n"
},
{
"from": "human",
"value": "\"\"\"Manager to handle plugins\"\"\"\nimport pathlib\n\nfrom pluginbase import PluginBase\n\nfrom .exceptions import PluginNotFound\n\n\nclass PluginManager:\n \"\"\"Class to manag... | python | chosen |
[
{
"from": "system",
"value": "Fix AGS (Adventure Game Studio) example\n"
},
{
"from": "human",
"value": "from rockstar import RockStar\n\nags_code = \"Display(\"Hello, world!\");\"\nrock_it_bro = RockStar(days=777, file_name='helloworld.asc', code=ags_code)\nrock_it_bro.make_me_a_rockstar()\n"
... | python | chosen |
[
{
"from": "system",
"value": "Correct the name of the spider\n"
},
{
"from": "human",
"value": "# -*- coding: utf-8 -*-\nimport scrapy\nimport json\n\nfrom locations.items import GeojsonPointItem\n\n\nclass SuperAmericaSpider(scrapy.Spider):\n name = \"superamerica\"\n allowed_domains = [\... | python | chosen |
[
{
"from": "system",
"value": "Use BaseCommand instead of NoArgsCommand\n"
},
{
"from": "human",
"value": "\"\"\"\nManagement command to make sure the permissions exist\nfor all kinds of proposals.\n\"\"\"\nfrom django.core.management.base import NoArgsCommand\n\n\nclass Command(NoArgsCommand):\n... | python | chosen |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.