conversations listlengths 2 3 | source stringclasses 1
value | stack stringclasses 1
value |
|---|---|---|
[
{
"from": "system",
"value": "Remove all use of python-future package due to a bug which prevents the IPython notebook interrupt the program\n"
},
{
"from": "human",
"value": "try:\n from future_builtins import *\nexcept ImportError:\n pass\n\ntry:\n input = raw_input\n range = xrang... | python | chosen |
[
{
"from": "system",
"value": "Make color easier to read\n"
},
{
"from": "human",
"value": "import pygame\n\n\nclass Graphic:\n car_color = (255, 50, 50)\n car_width = 3\n road_color = (255, 255, 255)\n road_width = 6\n draw_methods = {\n 'Car': 'draw_car',\n 'Road': ... | python | chosen |
[
{
"from": "system",
"value": "Setup.py: Use zip_safe = false to make sure that python module is extracted and later the settingsFile can be changed\n"
},
{
"from": "human",
"value": "#!/usr/bin/env python3\n\nfrom setuptools import setup, find_packages\n\ninstall_requires = (\n 'html2text',\n... | python | chosen |
[
{
"from": "system",
"value": "Add support for Series I.\n"
},
{
"from": "human",
"value": "#!/usr/bin/python\n\nimport re\nimport sys\n\nfrom bs4 import BeautifulSoup\nfrom urllib.request import urlopen\n\nSCP_SERIES_REGEX = re.compile(r'/scp-[0-9]{3,4}')\n\ndef count_slots(url):\n with urlop... | python | chosen |
[
{
"from": "system",
"value": "Debug sending data w/ boto.\n"
},
{
"from": "human",
"value": "import sys\nimport boto\nimport boto.s3\n\n# AWS ACCESS DETAILS\nAWS_ACCESS_KEY_ID = ''\nAWS_SECRET_ACCESS_KEY = ''\n\n# a bucket per author maybe\nbucket_name = 'boto-demo-1421108796'\nconn = boto.conne... | python | chosen |
[
{
"from": "system",
"value": "Add typecheck for Reshape function\n"
},
{
"from": "human",
"value": "from chainer import function\n\n\nclass Reshape(function.Function):\n\n \"\"\"Reshapes an input array without copy.\"\"\"\n\n def __init__(self, shape):\n self.shape = shape\n\n de... | python | chosen |
[
{
"from": "system",
"value": "Add 'user' and 'identity' attributes to the ImageVersion Details Serializer\n"
},
{
"from": "human",
"value": "from core.models import ApplicationVersion as ImageVersion\nfrom rest_framework import serializers\nfrom api.v2.serializers.summaries import LicenseSeriali... | python | chosen |
[
{
"from": "system",
"value": "Add test for multiple resources\n"
},
{
"from": "human",
"value": "import json\n\nfrom fixtures import PostSerializer\n\n\ndef test_single(post):\n data = PostSerializer().to_json(post)\n\n assert json.loads(data) == {'posts': [{'id': 1, 'title': 'My title'}]}... | python | chosen |
[
{
"from": "system",
"value": "Add PEP8 whitespace around Enums\n"
},
{
"from": "human",
"value": "class PythonWriter:\n def __init__(self, constants):\n self.constants = constants\n\n def write(self, out):\n out.write(\"# This file was generated by generate_constants.\\n\\n\"... | python | chosen |
[
{
"from": "system",
"value": "Add timing for python implementation of problem 4\n"
},
{
"from": "human",
"value": "def is_palindrome_number(n): return n == n[::-1]\nlargest_number = 0\nfor x in xrange(100, 999):\n for y in xrange(100, 999):\n v = x * y\n if v > largest_number:\n... | python | chosen |
[
{
"from": "system",
"value": "Add a public subnet that holds a `NAT` gateway\n"
},
{
"from": "human",
"value": "from troposphere import (\n Ref,\n)\n\nfrom troposphere.ec2 import (\n InternetGateway,\n Route,\n RouteTable,\n VPC,\n VPCGatewayAttachment,\n)\n\nfrom .template imp... | python | chosen |
[
{
"from": "system",
"value": "Split isexecutable into its own function\n"
},
{
"from": "human",
"value": "import StringIO\nimport os\nfrom rock.exceptions import ConfigError\n\n\nROCK_SHELL = os.environ.get('ROCK_SHELL', '/bin/bash -l -c').split()\n\n\nclass Shell(object):\n\n def __init__(se... | python | chosen |
[
{
"from": "system",
"value": "Fix : Range of len(1) have to be a tuple of tuples\n"
},
{
"from": "human",
"value": "import msgpack\nimport logging\n\nfrom .constants import FAILURE_STATUS\n\n\nclass MessageFormatError(Exception):\n pass\n\n\nclass Request(object):\n \"\"\"Handler objects f... | python | chosen |
[
{
"from": "system",
"value": "Fix stupid nltk data download thing\n"
},
{
"from": "human",
"value": "# Gevent needed for sockets\nfrom gevent import monkey\nmonkey.patch_all()\n\n# Imports\nimport os\nfrom flask import Flask, render_template\nfrom flask_socketio import SocketIO\nimport boto3\n\n... | python | chosen |
[
{
"from": "system",
"value": "Add login url for testing.\n"
},
{
"from": "human",
"value": "from django.conf.urls import patterns, include, url\n\nurlpatterns = patterns(\n '',\n url(r'^user-map/', include('user_map.urls', namespace='user_map'))\n)\n"
},
{
"from": "gpt",
"value... | python | chosen |
[
{
"from": "system",
"value": "Remove numbers from the word to check for.\n"
},
{
"from": "human",
"value": "from __future__ import unicode_literals\n\nimport re\n\nfrom collections import Counter\n\n\ndef check_for_flag_words(message, words_array):\n cnt = Counter()\n delims = '!\"#$%&()*+... | python | chosen |
[
{
"from": "system",
"value": "Make the ledger type selector work\n"
},
{
"from": "human",
"value": "def compare_ledger_types(account, data, orm):\n # TODO alternate_ledger\n return True\n\n account_ledgers = [ledger.id for ledger in account.ledger_types]\n selected_ledger = int(data[... | python | chosen |
[
{
"from": "system",
"value": "Use environment variable to detect Windows systems.\n"
},
{
"from": "human",
"value": "# -*- coding: utf-8 -*-\n# Copyright (c) 2013-2015, Sebastian Linke\n\n# Released under the Simplified BSD license\n# (see LICENSE file for details).\n\n\"\"\"\nConstants that are... | python | chosen |
[
{
"from": "system",
"value": "Add try/except block around lookup in lookup_wallet_name function\n"
},
{
"from": "human",
"value": "__author__ = 'mdavid'\n\nimport json\nimport re\nimport requests\n\nfrom blockexplorer.settings import WNS_URL_BASE\n\nWALLET_NAME_RE = re.compile('^([0-9a-z][0-9a-z... | python | chosen |
[
{
"from": "system",
"value": "Clean up File edit view\n"
},
{
"from": "human",
"value": "from __future__ import unicode_literals\n\nfrom mongoengine import *\n\nfrom core.observables import Observable\nfrom core.observables import Hash\n\n\nclass File(Observable):\n\n value = StringField(verb... | python | chosen |
[
{
"from": "system",
"value": "Increase permessable interval to +- 5 min\n"
},
{
"from": "human",
"value": "# допустимое отклонение от начала часа для фиксации замера\nPERMISSIBLE_PREC = 3\n"
},
{
"from": "gpt",
"value": "# допустимое отклонение от начала часа для фиксации замера\nPER... | python | chosen |
[
{
"from": "system",
"value": "Revert \"Don't complain about \\r when core.autocrlf is on in Git\"\n\nThis reverts commit 828afaa2fa4cc9e3e53bda0ae3073abfcfa151ca.\n"
},
{
"from": "human",
"value": "#!/usr/bin/python\n\nimport sys, fileinput, subprocess\n\nerr=0\ncols=78\n\ntry:\n result=subpr... | python | chosen |
[
{
"from": "system",
"value": "Create GEM filter to get BBM App ID\n\n"
},
{
"from": "human",
"value": "from django.template import Library\nfrom django.conf import settings\n\nregister = Library()\n\n\n@register.simple_tag()\ndef get_site_static_prefix():\n return settings.SITE_STATIC_PREFIX\... | python | chosen |
[
{
"from": "system",
"value": "Use ModuleNotFoundError instead of ImportError\n"
},
{
"from": "human",
"value": "#!/usr/bin/env python3\n\n# tsuserver3, an Attorney Online server\n#\n# Copyright (C) 2016 argoneus <argoneuscze@gmail.com>\n#\n# This program is free software: you can redistribute it... | python | chosen |
[
{
"from": "system",
"value": "Make tests compatible with python 2.5 and 2.6.\n"
},
{
"from": "human",
"value": "import unittest\n\nfrom flask import Flask\nfrom flaskext.seasurf import SeaSurf\n\n\nclass SeaSurfTestCase(unittest.TestCase):\n \n def setUp(self):\n app = Flask(__name_... | python | chosen |
[
{
"from": "system",
"value": "Fix the rendering of language instance docstrings\n"
},
{
"from": "human",
"value": "# This file is part of rinohtype, the Python document preparation system.\n#\n# Copyright (c) Brecht Machiels.\n#\n# Use of this source code is subject to the terms of the GNU Affer... | python | chosen |
[
{
"from": "system",
"value": "Add validate_email and verify_token methods\nMethods to be used to:\n\t- check that a valid email is provided\n\t- check the token authenticity\n"
},
{
"from": "human",
"value": "from re import search\nfrom flask import g\nfrom flask_restplus import abort\nfrom flas... | python | chosen |
[
{
"from": "system",
"value": "Add verbose error for a meddling middleware\n"
},
{
"from": "human",
"value": "# -*- coding: utf-8 -*-\nfrom contextlib import contextmanager\nfrom django.conf import settings\ntry:\n from django.conf.urls.defaults import patterns, url, include\nexcept ImportErro... | python | chosen |
[
{
"from": "system",
"value": "Use sys.executable to run Python, as suggested by Neal Norwitz.\n"
},
{
"from": "human",
"value": "# Test the atexit module.\nfrom test_support import TESTFN, vereq\nimport atexit\nimport os\n\ninput = \"\"\"\\\nimport atexit\n\ndef handler1():\n print \"handler1... | python | chosen |
[
{
"from": "system",
"value": "Use `safe_load` function to load YAML\n\nIn our use case, we are *not* reading arbitrary input that could be\nmalicious. Still, because we know that what we're reading is made up of\nonly dictionaries and lists and not arbitrary Python objects, we might\nas well use the more re... | python | chosen |
[
{
"from": "system",
"value": "Raise StopAsyncIteration instead of StopAsyncIteration in aiter wrapper.\n"
},
{
"from": "human",
"value": "\"\"\"\nMiscellaneous utilities used throughout the library.\n\"\"\"\nimport collections.abc\n\n\nclass IterToAiter(collections.abc.Iterator, collections.abc.... | python | chosen |
[
{
"from": "system",
"value": "Improve status display for reports.\n"
},
{
"from": "human",
"value": "from pyramid.renderers import get_renderer\nfrom pyramid.view import view_config\n\nfrom . import get_report_info\nfrom . import list_employees\nfrom . import list_reports\n\ndef get_main_templat... | python | chosen |
[
{
"from": "system",
"value": "Add ContainerRegistry to the exposed classes of UM.Settings\n"
},
{
"from": "human",
"value": "# Copyright (c) 2016 Ultimaker B.V.\n# Uranium is released under the terms of the AGPLv3 or higher.\n\nfrom .SettingDefinition import SettingDefinition\n\nfrom .SettingIns... | python | chosen |
[
{
"from": "system",
"value": "Return keywords instead of summary\n"
},
{
"from": "human",
"value": "# Team nameSpace@HINT2017\n\n#\n# This script contains a function which takes a URL as input\n# and returns the content of the content in the webpage\n\n# 'newspaper' library is used here to extra... | python | chosen |
[
{
"from": "system",
"value": "Remove HTML table (our mail cannot send HTML)\n"
},
{
"from": "human",
"value": "# -*- encoding: utf-8 -*-\nimport logging\n\nfrom celery import shared_task\nfrom django.utils import timezone\n\nfrom invoice.models import InvoiceUser\nfrom mail.service import queue_... | python | chosen |
[
{
"from": "system",
"value": "Update json.loads line for python 3.5\n\nRunning the script inside a docker container with python 3.5 throws an \"TypeError: the JSON object must be str, not 'bytes'\".\r\n\r\nFixed it by decoding downloaded json to utf-8"
},
{
"from": "human",
"value": "#!/usr/bin/... | python | chosen |
[
{
"from": "system",
"value": "Allow for missing directories in $PATH\n"
},
{
"from": "human",
"value": "import os\n\n\nfrom pysyte.types.paths import path\n\n\ndef value(key):\n \"\"\"A value from the shell environment, defaults to empty string\n\n >>> value('SHELL') is not None\n True\... | python | chosen |
[
{
"from": "system",
"value": "Return graph object after ploting\n"
},
{
"from": "human",
"value": "# Internal modules #\nfrom plumbing.graphs import Graph\nfrom plumbing.autopaths import FilePath\n\n# Third party modules #\nfrom matplotlib import pyplot\n\n# Constants #\n__all__ = ['LengthDist']... | python | chosen |
[
{
"from": "system",
"value": "Create decorator for catching plugin errors\n"
},
{
"from": "human",
"value": "# -*- coding: utf-8 -*-\n\n\"\"\"\n@author: Lises team\n@contact: zhidkovseva@gmail.com\n@license: The MIT license\n\nCopyright (C) 2015\n\"\"\""
},
{
"from": "gpt",
"value": ... | python | chosen |
[
{
"from": "system",
"value": "Change so that we can use with any data\n"
},
{
"from": "human",
"value": "import training_data\nimport re\nimport math\n\nclass Classifier:\n\tdef classify(self,text,prior=0.5,c=10e-6):\n\t\t\"\"\" Remove a pontuacao do texto \"\"\"\n\t\twords = re.findall(r\"[\\w... | python | chosen |
[
{
"from": "system",
"value": "Add several useful MySQL functions\n\nFunctions useful for examining and manipulating MySQL databases:\n- execute() -- execute one or more MySQL statements (as a single string),\n optionally on a specific database. Returns the same thing as core.system()\n- check_execute() -- ... | python | chosen |
[
{
"from": "system",
"value": "Add application directory to export directory\n"
},
{
"from": "human",
"value": "#!/usr/bin/env python\nfrom app.views.export import write_all_measurements_csv\nimport tempfile\nimport os\n\nf = open(\"app/static/exports/AllMeasurements_inprogress.csv\", \"w\")\n\nt... | python | chosen |
[
{
"from": "system",
"value": "Add \"SNAPDIR\" and simple vim modeline\n"
},
{
"from": "human",
"value": "import snapcraft\n\nclass ShellPlugin(snapcraft.BasePlugin):\n\t@classmethod\n\tdef schema(cls):\n\t\tschema = super().schema()\n\n\t\tschema['required'] = []\n\n\t\tschema['properties']['she... | python | chosen |
[
{
"from": "system",
"value": "Fix typo in previous commit."
},
{
"from": "human",
"value": "#!/usr/bin/env python\n\nimport sys\nimport os.path\nimport site\n\ndef main():\n '''\\\n Check if the given prefix is included in sys.path for the given\n python version; if not find an alternat... | python | chosen |
[
{
"from": "system",
"value": "Load data from defaults if defaults has keys that data doesn't.\n"
},
{
"from": "human",
"value": "import json\nimport os\n\n\nclass DataStore(object):\n def __init__(self, storagePath=\"desertbot_data.json\"):\n self.storagePath = storagePath\n sel... | python | chosen |
[
{
"from": "system",
"value": "Create new satellite from spacetrack if satellite audio upload is for a nonexistent satellite\n"
},
{
"from": "human",
"value": "from django.contrib.auth.decorators import login_required\nfrom django.http import HttpResponseRedirect\nfrom django.shortcuts import ren... | python | chosen |
[
{
"from": "system",
"value": "Add destination directory to default arguments for scripts\n"
},
{
"from": "human",
"value": "\"\"\"A set of functions to standardize some options for python scripts.\"\"\"\n\n\ndef setup_parser_help(parser, additional_docs=None):\n \"\"\"\n Set formatting for... | python | chosen |
[
{
"from": "system",
"value": "Add methods to linked list.\n"
},
{
"from": "human",
"value": "class Node(object):\n def __init__(self, val, next=None):\n self.val = val\n self.next = next\n\n def __repr__(self):\n return '{val}'.format(val=self.val)\n\n\nclass LinkedLis... | python | chosen |
[
{
"from": "system",
"value": "Reorder preferred mimetypes to prefer HTML over JSON"
},
{
"from": "human",
"value": "from __future__ import unicode_literals\nfrom flask import Request\n\n\nclass AcceptRequest(Request):\n\n _json_mimetypes = ['application/json',]\n\n _html_mimetypes = ['text... | python | chosen |
[
{
"from": "system",
"value": "Send docs to development/ not latest/\n"
},
{
"from": "human",
"value": "import os\nimport shutil\n\nimport msmbuilder.version\n\nif msmbuilder.version.release:\n docversion = msmbuilder.version.short_version\nelse:\n docversion = 'latest'\n\nos.mkdir(\"doc/_d... | python | chosen |
[
{
"from": "system",
"value": "Update config name verify script to work with the .bat files.\n"
},
{
"from": "human",
"value": "#!/usr/bin/env python\n# -*- coding: utf-8 -*-\n\n\"\"\"Ensure filenames for test-*.bash scripts match the config name registered\ninside them.\n\"\"\"\n\nfrom __future_... | python | chosen |
[
{
"from": "system",
"value": "Add structure and first styles\n"
},
{
"from": "human",
"value": "# -*- encoding: utf-8 -*-\n#\n# Author: Massimo Menichinelli\n# Homepage: http://www.openp2pdesign.org\n# License: MIT\n#\n\nimport xlsxwriter\n\n# Create the file\nworkbook = xlsxwriter.Workbook('Fab... | python | chosen |
[
{
"from": "system",
"value": "Add modes to BatchNormalization, fix BN issues"
},
{
"from": "human",
"value": "from ..layers.core import Layer\nfrom ..utils.theano_utils import shared_zeros\nfrom .. import initializations\n\nclass BatchNormalization(Layer):\n '''\n Reference: \n ... | python | chosen |
[
{
"from": "system",
"value": "Disable logging for flask_cors by default\n"
},
{
"from": "human",
"value": "# -*- coding: utf-8 -*-\n\"\"\"\n flask_cors\n ~~~~\n Flask-CORS is a simple extension to Flask allowing you to support cross\n origin resource sharing (CORS) using a simple dec... | python | chosen |
[
{
"from": "system",
"value": "Add ERROR: keyword in error message return\n"
},
{
"from": "human",
"value": "from boltiot.urls import url\nimport requests\n\ndef request_from(url, *kwargs):\n try:\n response = str(requests.get(url.format(*kwargs)).text)\n return response\n exc... | python | chosen |
[
{
"from": "system",
"value": "Use a more liberal/naive approach to regex checking for an email\n\nThe problem with the old method is that it does not support\n- Internationalized TLDs, domains or users, such as .xn--4gbrim domains\n- Geographic TLDs, such as .europe\n- ICANN-era TLDs, such as .audio and .cl... | python | chosen |
[
{
"from": "system",
"value": "Test line numbers in lexer tests.\n"
},
{
"from": "human",
"value": "\nfrom cStringIO import StringIO\nfrom nose.tools import *\n\nfrom parse import EeyoreLexer\n\ndef _lex( string ):\n return list( EeyoreLexer.Lexer( StringIO( string ) ) )\n\ndef _assert_token( ... | python | chosen |
[
{
"from": "system",
"value": "Fix case in function names to be PEP8 compatible\n"
},
{
"from": "human",
"value": "\nimport logging\n\nfrom version import __version__\n\nlogger = logging.getLogger(__name__)\nlogger.debug('Loading %s ver %s' % (__name__, __version__))\n\n\n# Actions represents the... | python | chosen |
[
{
"from": "system",
"value": "Add missing vat alias for Japan\n"
},
{
"from": "human",
"value": "# __init__.py - collection of Japanese numbers\n# coding: utf-8\n#\n# Copyright (C) 2019 Alan Hettinger\n#\n# This library is free software; you can redistribute it and/or\n# modify it under the term... | python | chosen |
[
{
"from": "system",
"value": "Include fixed values as defaults\n\nI'm not a big fan of this approach, but it avoids a good bit of code duplication\n"
},
{
"from": "human",
"value": "from gettext import gettext as _\n\n\nclass Fixed:\n _(\"A mixin that ensures the presence of a predetermined v... | python | chosen |
[
{
"from": "system",
"value": "Rename column \"Hash\" to \"Commit\".\n"
},
{
"from": "human",
"value": "\nimport subprocess\nimport sys\n\nfrom githistorydata.csv import Csv\nfrom githistorydata.expand_commits import expand_authors, expand_lines\nfrom githistorydata.git import Git\nfrom githistor... | python | chosen |
[
{
"from": "system",
"value": "Implement the old Dagger Mastery\n"
},
{
"from": "human",
"value": "\"\"\"\nCards removed from the game\n\"\"\"\n\nfrom ..utils import *\n\n\n# Adrenaline Rush\nclass NEW1_006:\n\taction = drawCard\n\tcombo = drawCards(2)\n\n\n# Bolstered (Bloodsail Corsair)\nclass ... | python | chosen |
[
{
"from": "system",
"value": "Allow logging level to be selected through environment variable\n"
},
{
"from": "human",
"value": "#!/usr/bin/env python\n\nimport os\nfrom app import create_app\nfrom flask.ext.script import Manager, Server\nimport watchtower\nimport logging\n\n\napplication = crea... | python | chosen |
[
{
"from": "system",
"value": "Use https to gravatar url\n"
},
{
"from": "human",
"value": "from django.conf import settings\nfrom PIL import Image\n\nfrom appconf import AppConf\n\n\nclass AvatarConf(AppConf):\n DEFAULT_SIZE = 80\n RESIZE_METHOD = Image.ANTIALIAS\n STORAGE_DIR = 'avatar... | python | chosen |
[
{
"from": "system",
"value": "Fix bug with fan turning itself off\n\nThis would happen when the service was restarted. In the stopping code,\nI added a call to clean up.\n"
},
{
"from": "human",
"value": "import logging\n\nimport Adafruit_BBIO.GPIO as GPIO\nimport Adafruit_BBIO.UART as UART\nimp... | python | chosen |
[
{
"from": "system",
"value": "Step_5: Add fixtures to cattery tests\n\nAdd a fixture to remove initialisation of the cattery in every test.\n\nSigned-off-by: Meghan Halton <3ef2199560b9c9d063f7146fc0f2e3c408894741@gmail.com>\n"
},
{
"from": "human",
"value": "import pytest\n\nfrom catinabox impo... | python | chosen |
[
{
"from": "system",
"value": "Change comments to represents correct type\n"
},
{
"from": "human",
"value": "from os.path import expanduser\n\nfrom photofolder import Photofolder\nfrom folder import RealFolder\nfrom gphotocamera import Gphoto\nfrom main import Photobox\nfrom switch import Keyboar... | python | chosen |
[
{
"from": "system",
"value": "Raise an import error when import_string fails on get_buffer\n"
},
{
"from": "human",
"value": "\"\"\"\nsentry.app\n~~~~~~~~~~\n\n:copyright: (c) 2010-2012 by the Sentry Team, see AUTHORS for more details.\n:license: BSD, see LICENSE for more details.\n\"\"\"\n\nfro... | python | chosen |
[
{
"from": "system",
"value": "Add api end point /api-detail/\n"
},
{
"from": "human",
"value": "from rest_framework import routers, serializers, viewsets\nimport models\n\n# Serializers define the API representation.\nclass AttributeSerializer(serializers.ModelSerializer):\n class Meta:\n ... | python | chosen |
[
{
"from": "system",
"value": "Raise exception for unexpected status\n"
},
{
"from": "human",
"value": "import requests\n\nfrom isserviceup.services.models.service import Service, Status\n\n\nclass Heroku(Service):\n name = 'Heroku'\n status_url = 'https://status.heroku.com/'\n icon_url ... | python | chosen |
[
{
"from": "system",
"value": "Use bootstrap input styles to shrink quantity field width\n"
},
{
"from": "human",
"value": "# -*- coding: utf-8 -*-\nfrom django import forms\nfrom django.db.models import get_model\nfrom django.forms.models import inlineformset_factory, fields_for_model\n\nWishLis... | python | chosen |
[
{
"from": "system",
"value": "Test the equality of the contents and of the titles.\n"
},
{
"from": "human",
"value": "#! /usr/bin/env python\n#-*- coding: utf-8 -*-\n\nimport itertools\nimport utils\n\n\ndef compare_documents(feed):\n \"\"\"\n Compare a list of documents by pair.\n \"\"... | python | chosen |
[
{
"from": "human",
"value": "Work around Django bug in manage.py\n\nmanage.py is ignoring DJANGO_SETTINGS_MODULE, so this way we can run it without specifying the settings during development\n"
},
{
"from": "gpt",
"value": "# this is a hack to work around https://code.djangoproject.com/ticket/15... | python | chosen |
[
{
"from": "system",
"value": "Set author automatically for diary items\n"
},
{
"from": "human",
"value": "from django.contrib import admin\nfrom diary.models import DiaryItem, EventLocation, ImageItem\n\nclass DiaryAdmin(admin.ModelAdmin):\n list_display = ('title', 'start_date', 'start_time', ... | python | chosen |
[
{
"from": "system",
"value": "Make test compatible with Python 2.6.\n"
},
{
"from": "human",
"value": "#!/usr/bin/env python\n# -*- coding: UTF-8 -*-\n# (c) 2013 Mike Lewis\nimport logging; log = logging.getLogger(__name__)\n\nfrom . import BaseAuthenticatedEndpointTestCase, BaseUserlessEndpoint... | python | chosen |
[
{
"from": "system",
"value": "Add a function to symlink reference_page files into existance\n"
},
{
"from": "human",
"value": "\"\"\"\nFunctions for performing test setup/teardown etc.\n\"\"\"\n\nimport os\n\nMODELDIR = \"etc/defaultmodels\" \n\n\ndef symlink_model_fixtures():\n \"\"\"\n C... | python | chosen |
[
{
"from": "system",
"value": "Allow POST as well as GET\n"
},
{
"from": "human",
"value": "# -*- coding: utf-8 -*-\n\nfrom tasks import task1, task2\nimport flask\n\n\ndef index():\n return flask.render_template('index.html', title='index')\n\n\ndef app_factory():\n app = flask.Flask(impor... | python | chosen |
[
{
"from": "system",
"value": "Add folder set up to the ZODB on app creation.\n\n\n"
},
{
"from": "human",
"value": "from persistent.mapping import PersistentMapping\n\n\nclass Root(PersistentMapping):\n __parent__ = __name__ = None\n\n\ndef appmaker(zodb_root):\n if not 'app_root' in zodb_... | python | chosen |
[
{
"from": "system",
"value": "Test that BookSpecimenFactory also creates the related book\n"
},
{
"from": "human",
"value": "import pytest\n\nfrom .factories import BookFactory, BookSpecimenFactory\n\npytestmark = pytest.mark.django_db\n\n\ndef test_it_should_create_a_default_book_from_factory()... | python | chosen |
[
{
"from": "system",
"value": "Add dummy Let's Encrypt email\n"
},
{
"from": "human",
"value": "from .applications import get_application_domain, get_application_name\nfrom .machine import get_env_vars\nfrom .. import app\n\nfrom subprocess import Popen, STDOUT, PIPE\nfrom os import environ\nfrom... | python | chosen |
[
{
"from": "system",
"value": "Use namespaces logger in mendeley settings\n\nh/t Arpita for catching this\n\n[skip ci]\n"
},
{
"from": "human",
"value": "import logging\nfrom .defaults import * # noqa\n\ntry:\n from .local import * # noqa\nexcept ImportError as error:\n logging.warn('No l... | python | chosen |
[
{
"from": "system",
"value": "Fix unit test fixtures files\n"
},
{
"from": "human",
"value": "import shutil\nimport os\n\nfrom django.core.files.storage import default_storage\nfrom django.test import TestCase\n\nclass SampleFilesTestCase(TestCase):\n fixtures = ['sample']\n\n @classmethod... | python | chosen |
[
{
"from": "system",
"value": "Fix mock to import app from cli\n"
},
{
"from": "human",
"value": "import pytest\nfrom click.testing import CliRunner\n\nfrom cli import main\n\n\n@pytest.fixture\ndef runner():\n return CliRunner()\n\n\n@pytest.fixture(params=['fr', 'en', 'tlh'])\ndef lang(reque... | python | chosen |
[
{
"from": "system",
"value": "Add missing name to the AppConfig\n"
},
{
"from": "human",
"value": "\n\ntry:\n # Configure a generator if the user is using model_mommy\n\n from model_mommy import generators\n\n def gen_translatablecontent(max_length):\n from fluent.fields import T... | python | chosen |
[
{
"from": "system",
"value": "Add sdb support, and also properly return the default\n"
},
{
"from": "human",
"value": "# -*- coding: utf-8 -*-\n'''\nThis runner is designed to mirror the execution module config.py, but for\nmaster settings\n'''\nfrom __future__ import absolute_import\nfrom __fut... | python | chosen |
[
{
"from": "system",
"value": "Use entities.reverse() rather sorted(.., reverse=True)\n\nChange-Id: I33ee5b078e3d27a45bd159be0f0b241c20792f92\n"
},
{
"from": "human",
"value": "# Licensed under the Apache License, Version 2.0 (the \"License\"); you may\n# not use this file except in compliance wi... | python | chosen |
[
{
"from": "system",
"value": "scripts: Fix MySQL command executing (MySQL commit).\n"
},
{
"from": "human",
"value": "#!/usr/bin/env python\n# -*- coding: utf-8 -*-\n\n#==============================================================================\n# Script for creating MySQL user\n#============... | python | chosen |
[
{
"from": "system",
"value": "Add color to python prompt\n"
},
{
"from": "human",
"value": "import os,sys,re\nfrom time import sleep\nfrom pprint import pprint\nhome = os.path.expanduser('~')\nfrom math import log,ceil\ndef clog2(num):\n return int(ceil(log(num,2)))\nif (sys.version_info > (3, ... | python | chosen |
[
{
"from": "system",
"value": "Handle FileNotFound and Permission errors gracefully\n"
},
{
"from": "human",
"value": "\"\"\"\nLog file parsers provided by Sentry Logs\n\"\"\"\nimport tailer # same functionality as UNIX tail in python\n\nfrom ..helpers import send_message\n\n\nclass Parser(objec... | python | chosen |
[
{
"from": "system",
"value": "Add preliminary function to execute monte-carlo approximation.\n\nAdjust functions, remove some generality for speed. Implement monte-carlo\nfor the exercise case with initial config. No error calculation or\nexecution for varied N yet. Initial tests with N = 10^7 give a\nvalue... | python | chosen |
[
{
"from": "system",
"value": "Use SHA-256 as default hash\n"
},
{
"from": "human",
"value": "\"\"\"\nModule for standard hash algorithms, always returning the hash in hexadecimal\nstring format.\n\"\"\"\nimport hashlib\nfrom .formats import to_bytes\n\ndef md5(message):\n \"\"\"\n Returns ... | python | chosen |
[
{
"from": "system",
"value": "Fix issue with URL patterns adding parentheses around codes.\n"
},
{
"from": "human",
"value": "from django.urls import path\nfrom invite import views\n\napp_name = 'invite'\nurlpatterns = [\n path('', views.index, name='index'),\n path('invite/', views.invite... | python | chosen |
[
{
"from": "system",
"value": "Fix XML entities left from MathML.\n"
},
{
"from": "human",
"value": "# -*- coding: utf-8 -*-\nfrom __future__ import unicode_literals\n\nfrom lxml import etree\nimport six\nfrom librarian import get_resource\nfrom . import TreeEmbed, create_embed, downgrades_to\n\n... | python | chosen |
[
{
"from": "system",
"value": "Put basic info in one table\n"
},
{
"from": "human",
"value": "import string\nimport textwrap\n\nfrom veryprettytable import VeryPrettyTable\n\nfrom plugins import BasePlugin\n\n\n__author__ = 'peter'\n\n\nclass BasicInfoPlugin(BasePlugin):\n short_description = ... | python | chosen |
[
{
"from": "system",
"value": "Use latest build schema commit -> ref\n"
},
{
"from": "human",
"value": "from django.core.exceptions import ObjectDoesNotExist\n\nfrom db.models.repos import CodeReference\n\n\ndef get_internal_code_reference(instance, commit=None):\n project = instance.project\n... | python | chosen |
[
{
"from": "system",
"value": "Change test FTP server address\n"
},
{
"from": "human",
"value": "import pytest\n\nimport parsl\nfrom parsl.app.app import App\nfrom parsl.data_provider.files import File\nfrom parsl.tests.configs.local_threads import config\n\nparsl.clear()\nparsl.load(config)\n\n\... | python | chosen |
[
{
"from": "system",
"value": "Revert \"fix bug import six\"\n\nThis reverts commit a80c1d7c80d68f72d435dbb7ac5c48a6114716fb.\n"
},
{
"from": "human",
"value": "from __future__ import absolute_import,print_function\nfrom itertools import groupby\nimport PyICU\nimport six\n# ตัดคำภาษาไทย\ndef segm... | python | chosen |
[
{
"from": "system",
"value": "Replace mock Twitter channel with actual channel\n"
},
{
"from": "human",
"value": "from os import unlink\nfrom configobj import ConfigObj\nfrom tests.ch_mock import Twitter\n\ndef Dispatch(channels, msgFile):\n msgConfig = ConfigObj(msgFile)\n Topic = msgConf... | python | chosen |
[
{
"from": "system",
"value": "Add a separate endpoint for posting postcode lookups to\n"
},
{
"from": "human",
"value": "from django.conf.urls import patterns, include, url\n\nfrom django.contrib import admin\n\nfrom candidates.views import (ConstituencyPostcodeFinderView,\n ConstituencyDetai... | python | chosen |
[
{
"from": "system",
"value": "Add test for allow harmful protocols\n"
},
{
"from": "human",
"value": "import mistune\nfrom unittest import TestCase\n\nclass TestMiscCases(TestCase):\n def test_none(self):\n self.assertEqual(mistune.html(None), '')\n\n def test_before_parse_hooks(self):\n ... | python | chosen |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.