conversations listlengths 2 3 | source stringclasses 1
value | stack stringclasses 1
value |
|---|---|---|
[
{
"from": "system",
"value": "Expand the sentence segmentation tests a little()\n"
},
{
"from": "human",
"value": "#\n\nimport pytest\nfrom sdsc import sentencesegmenter\n\n\n@pytest.mark.parametrize(\"sentence,expected\",\n(\n # 1\n (\"This is a simple ##@command-2## sentence. This one too.... | python | chosen |
[
{
"from": "system",
"value": "Add description and template to MonitoringFactory\n"
},
{
"from": "human",
"value": "from .models import Monitoring\nfrom feder.users.factories import UserFactory\nimport factory\n\n\nclass MonitoringFactory(factory.django.DjangoModelFactory):\n name = factory.Se... | python | chosen |
[
{
"from": "system",
"value": "Clarify documentation for get_versions and get_latest_version_number.\n"
},
{
"from": "human",
"value": "from website.addons.osffiles.exceptions import FileNotFoundError\n\n\ndef get_versions(filename, node):\n \"\"\"Return file versions for a :class:`NodeFile`.\... | python | chosen |
[
{
"from": "system",
"value": "Fix bug in BitBucket's SSH url\n"
},
{
"from": "human",
"value": "# Imports\nfrom .base import BasePlatform\n\nclass BitbucketPlatform(BasePlatform):\n PATTERNS = {\n 'https': r'https://(?P<_user>.+)@(?P<domain>.+)/(?P<owner>.+)/(?P<repo>.+).git',\n ... | python | chosen |
[
{
"from": "system",
"value": "Fix for annoying pypar directory change\n"
},
{
"from": "human",
"value": "_VERSION = 'CVS'\n_TEMP_DIR = '.SloppyCell'\n\nimport logging\nlogging.basicConfig()\nlogger = logging.getLogger('__init__')\n\n# Check for debugging option. I tried using optparse for this, ... | python | chosen |
[
{
"from": "system",
"value": "Add URL rule to set Gravatar for current user\n"
},
{
"from": "human",
"value": "# -*- coding: utf8 -*-\n\nimport default_settings\nfrom flask.ext.plugins import Plugin\nfrom flask import current_app as app\nfrom pybossa_gravatar.gravatar import Gravatar\nfrom pybos... | python | chosen |
[
{
"from": "system",
"value": "Make sure correct type is excluded\n"
},
{
"from": "human",
"value": "from collections import OrderedDict\n\n\ndef form_questions(form):\n d = OrderedDict()\n children = form['children']\n for child in children:\n if 'pathstr' in child and 'control' ... | python | chosen |
[
{
"from": "system",
"value": "Support for page-detail url added.\n"
},
{
"from": "human",
"value": "from flask_wiki.backend.backend import api\nfrom flask_wiki.backend.views import PageView\n\napi.add_resource(PageView, '/pages-list', endpoint='pages-list')"
},
{
"from": "gpt",
"valu... | python | chosen |
[
{
"from": "system",
"value": "Send Cloudtrail logging disabled alert to MOC\n"
},
{
"from": "human",
"value": "#!/usr/bin/env python\n\n# This Source Code Form is subject to the terms of the Mozilla Public\n# License, v. 2.0. If a copy of the MPL was not distributed with this\n# file, You can ob... | python | chosen |
[
{
"from": "human",
"value": "Add Jaro-Winkler distance based on py_stringmatching\n"
},
{
"from": "gpt",
"value": "import py_stringmatching\nfrom itertools import combinations\nfrom time import time\n\njw = py_stringmatching.JaroWinkler()\nstart = time()\nlog_file = '/home/hs32832011/Git/labeled... | python | chosen |
[
{
"from": "system",
"value": "Use test sources as the default in configuration (and improve warning message, when falling back to)\n"
},
{
"from": "human",
"value": "import logging\n\nfrom lib.config import Config\nfrom lib.sources.decklinkavsource import DeckLinkAVSource\nfrom lib.sources.imgvs... | python | chosen |
[
{
"from": "system",
"value": "Add helper method to load templates from disk.\n"
},
{
"from": "human",
"value": "# :coding: utf-8\n# :copyright: Copyright (c) 2013 Martin Pengelly-Phillips\n# :license: See LICENSE.txt.\n\nfrom .template import Template\n\n"
},
{
"from": "gpt",
"value"... | python | chosen |
[
{
"from": "human",
"value": "Resolve Combination Sum III with recursion\n"
},
{
"from": "gpt",
"value": "class Solution(object):\n def combinationSum3(self, k, n):\n \"\"\"\n :type k: int\n :type n: int\n :rtype: List[List[int]]\n \"\"\"\n\n # Use rec... | python | chosen |
[
{
"from": "system",
"value": "Add a hack so weird chars don't cause issues\n\nIn DebugHTTPInternalServerError.__init__.\n\nShould probably figure out the underlying cause.\nOr don't inherit from HTTPInternalServerError.\n"
},
{
"from": "human",
"value": "import datetime\nimport html\n\nfrom webo... | python | chosen |
[
{
"from": "system",
"value": "Fix the grefs route in the airship server\n"
},
{
"from": "human",
"value": "import os\nimport json\n\nfrom flask import Flask, render_template\n\n\ndef channels_json(station, escaped=False):\n channels = [{\"name\": channel} for channel in station.channels()]\n ... | python | chosen |
[
{
"from": "system",
"value": "Use the signature (cache) directory specified in .fuzzmanagerconf\n"
},
{
"from": "human",
"value": "import os\nimport sys\nimport subprocesses\n\nTHIS_SCRIPT_DIRECTORY = os.path.dirname(os.path.abspath(__file__))\n\nfuzzManagerPath = os.path.abspath(os.path.join(TH... | python | chosen |
[
{
"from": "system",
"value": "Use p4 cli instead of p4 api\n"
},
{
"from": "human",
"value": "#!/usr/bin/env python3\n\"\"\"Script to automate logging into Perforce.\n\nUse P4API to log in to the server.\n\n\"\"\"\n\nimport P4\n\n\ndef main():\n \"\"\"Log in to the Perforce server.\"\"\"\n ... | python | chosen |
[
{
"from": "system",
"value": "Replace `tmpdir` with `tmp_path` in `samp` tests\n"
},
{
"from": "human",
"value": "from astropy.samp import conf\nfrom astropy.samp.hub import SAMPHubServer\nfrom astropy.samp.hub_proxy import SAMPHubProxy\n\n\ndef setup_module(module):\n conf.use_internet = Fal... | python | chosen |
[
{
"from": "system",
"value": "Make perfect simulator print data after each upload\n"
},
{
"from": "human",
"value": "#!/usr/bin/env python3\nimport timer\nimport sys\nimport utils\n\n\ndef simulate():\n # A set of files already in the storage\n seen = set()\n\n # The size of the all upl... | python | chosen |
[
{
"from": "system",
"value": "Update first round test, create huffman based on knownalphabet\n"
},
{
"from": "human",
"value": "from mock import patch\n\nfrom breach.tests.base import RuptureTestCase\nfrom breach.strategy import Strategy\n\n\nclass StrategyTestCase(RuptureTestCase):\n @patch(... | python | chosen |
[
{
"from": "system",
"value": "Implement Wires helper method get_nth_wire_position\n"
},
{
"from": "human",
"value": "from enum import Enum\n\nfrom .AbstractModule import AbstractModule, ModuleState\n\n\nclass WireColors(Enum):\n MISSING = 'missing'\n BLACK = 'black'\n RED = 'red'\n W... | python | chosen |
[
{
"from": "system",
"value": "Tidy test - reuse timestamp\n"
},
{
"from": "human",
"value": "from immobilus import immobilus\nfrom immobilus.logic import _datetime_to_utc_timestamp\n\nfrom datetime import datetime\nfrom time import time\n\n\ndef test_time_function():\n\n dt = datetime(1970, 1... | python | chosen |
[
{
"from": "system",
"value": "Add SqliteCache for html raw data. Add QueueUrls for list urls."
},
{
"from": "human",
"value": "'''\r\nCreated on 2 сент. 2016 г.\r\n\r\n@author: garet\r\n'''\r\n\r\n\r\nclass BaseSpider():\r\n \r\n def __init__(self):\r\n pass\r\n\r\n def AddUrls(s... | python | chosen |
[
{
"from": "system",
"value": "Set development version number to v0.3.0.dev0\n"
},
{
"from": "human",
"value": "# -*- coding: utf-8 -*-\n# -----------------------------------------------------------------------------\n# Copyright (c) Spyder Project Contributors\n#\n# Licensed under the terms of t... | python | chosen |
[
{
"from": "system",
"value": "Set default AUTOGEN_TEST to 0\n"
},
{
"from": "human",
"value": "INPUT_DECL_PATHS = [\n \"../../target/device/libio/export\"\n# \"../../../pia-sdk-repo/iolib/arduino/arduiPIA.h\"\n]\n\nAUTOGEN_TEST = 1\n\nif AUTOGEN_TEST == 1:\n INPUT_DECL_PATHS = [\n \"./t... | python | chosen |
[
{
"from": "system",
"value": "Format code with pep8 and add timeout to requests\n"
},
{
"from": "human",
"value": "#!/usr/bin/env python\n\nimport sys\nimport json\nimport requests\nimport hashlib\n\n\ndef hashToNumber(txhash,total):\n result = long(txhash, 16) % total \n return result \n\ndef... | python | chosen |
[
{
"from": "system",
"value": "Add the function (not class) to actions as is now required\n"
},
{
"from": "human",
"value": "from twisted.words.protocols import irc\nfrom txircd.modbase import Command, Module\n\nclass PassCommand(Command, Module):\n\tdef onUse(self, user, params):\n\t\tif user.re... | python | chosen |
[
{
"from": "system",
"value": "Change Template() to Template.init() in init function\n"
},
{
"from": "human",
"value": "#!/usr/bin/env python3.5\nimport os,time,asyncio,json\nfrom datetime import datetime\nfrom aiohttp import web\nimport logging;logging.basicConfig(level=logging.INFO)\nfrom ... | python | chosen |
[
{
"from": "system",
"value": "Use 3.2.x reference images for developer version of Matplotlib"
},
{
"from": "human",
"value": "import matplotlib\nfrom matplotlib import pyplot as plt\n\nfrom astropy.utils.decorators import wraps\n\nMPL_VERSION = matplotlib.__version__\n\nROOT = \"http://{server}/... | python | chosen |
[
{
"from": "system",
"value": "Fix bug in scrub_output where response was creating set, not dict\n"
},
{
"from": "human",
"value": "DEFAULT_CONFIG = {\n \"protocol\": \"json\",\n \"timeout\": 2,\n \"strict\": True\n}\n\n\ndef scrub_output(context, whitelist, strict=True):\n r = contex... | python | chosen |
[
{
"from": "system",
"value": "Use memcache to rate-limit outgoing emails.\n"
},
{
"from": "human",
"value": "#!/usr/bin/env python\n#\n# Copyright 2010 Eric Entzel <eric@ubermac.net>\n#\n\nfrom google.appengine.api import mail\nfrom google.appengine.ext.webapp import template\nimport os\n\n\nfro... | python | chosen |
[
{
"from": "system",
"value": "Fix device activation remove exception.\n"
},
{
"from": "human",
"value": "\nfrom moa.base import MoaBase\n\n\nclass Device(MoaBase):\n ''' By default, the device does not support multi-threading.\n '''\n\n _activated_set = None\n\n def __init__(self, **... | python | chosen |
[
{
"from": "system",
"value": "Add code framework of gvnfm-driver\n\nChange-Id: Ibb0dd98a73860f538599328b718040df5f3f7007\nIssue-Id: NFVO-132\nSigned-off-by: fujinhua <302f4934d283b6f50163b4a7fd9b6c869e0ad64e@zte.com.cn>\n"
},
{
"from": "human",
"value": "# Copyright 2017 ZTE Corporation.\n#\n# L... | python | chosen |
[
{
"from": "system",
"value": "Update the USER command to take advantage of core capabilities as well\n"
},
{
"from": "human",
"value": "from twisted.words.protocols import irc\nfrom txircd.modbase import Command\n\nclass UserCommand(Command):\n\tdef onUse(self, user, params):\n\t\tif user.regist... | python | chosen |
[
{
"from": "system",
"value": "Fix date in DB migration\n"
},
{
"from": "human",
"value": "# Copyright 2017 Cisco, Inc.\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\"); you may\n# not use this file except in compliance with the License. You may obtain\n# a copy of ... | python | chosen |
[
{
"from": "system",
"value": "Update class name to camelcase pattern.\n"
},
{
"from": "human",
"value": "class uploadfile():\n\n def __init__(self, name, type=None, size=None, not_allowed_msg=''):\n self.name = name\n self.type = type\n self.size = size\n self.not_... | python | chosen |
[
{
"from": "system",
"value": "[IMP] Synchronize Picking Type and Warehouse\n\n[IMP] User write()\n"
},
{
"from": "human",
"value": "# Copyright 2019 Open Source Integrators\n# License LGPL-3.0 or later (https://www.gnu.org/licenses/lgpl.html).\n\nfrom odoo import api, fields, models\n\n\nclass S... | python | chosen |
[
{
"from": "system",
"value": "[Disk] Fix flake8 issues and ignore unused\n"
},
{
"from": "human",
"value": "# (C) Datadog, Inc. 2018\n# All rights reserved\n# Licensed under a 3-clause BSD style license (see LICENSE)\nfrom .__about__ import __version__\nfrom .disk import Disk\n\nall = [\n '__ve... | python | chosen |
[
{
"from": "system",
"value": "Test for method argument calls\n"
},
{
"from": "human",
"value": "from thinglang.runner import run\n\n\ndef test_function_calls():\n assert run(\"\"\"\nthing Program\n does start\n number n = 1\n number m = 2\n Output.write(\"before n=\", ... | python | chosen |
[
{
"from": "system",
"value": "[user] Use the Model constructor to generate a default value\n"
},
{
"from": "human",
"value": "import hashlib\nimport random\nimport string\n\nfrom ext.aboard.model import *\n\ndef set_value(token):\n \"\"\"Randomly create and return a value.\"\"\"\n value = ... | python | chosen |
[
{
"from": "system",
"value": "Fix loading a whole tile into memory.\n"
},
{
"from": "human",
"value": "from Datasource import Datasource\nimport numpy as np\nimport h5py\n\nclass HDF5(Datasource):\n pass\n @classmethod\n def load_tile(ds, query):\n Sk,Sj,Si = query.all_scales\n ... | python | chosen |
[
{
"from": "system",
"value": "Reduce code duplication in isim test\n"
},
{
"from": "human",
"value": "import pytest\n\ndef test_isim():\n import os\n import shutil\n import tempfile\n import yaml\n from fusesoc.edatools import get_edatool\n from edalize_common import compare_fi... | python | chosen |
[
{
"from": "system",
"value": "Clean up mocking done by udev tests when finished.\n"
},
{
"from": "human",
"value": "#!/usr/bin/python\n\nimport unittest\nimport mock\n\nclass UdevTest(unittest.TestCase):\n\n def setUp(self):\n import blivet.udev\n blivet.udev.os = mock.Mock()\n ... | python | chosen |
[
{
"from": "system",
"value": "Include typeof check in JSONP callback response.\n\nThis is more robust, and helps against attacks such as Rosetta Flash:\nhttps://miki.it/blog/2014/7/8/abusing-jsonp-with-rosetta-flash/\n"
},
{
"from": "human",
"value": "import re\n\nfrom .view_error import *\n\ncl... | python | chosen |
[
{
"from": "system",
"value": "Add link to SO question\n"
},
{
"from": "human",
"value": "# IPython log file\nimport numpy as np\nfrom scipy import sparse\nfrom skimage import graph\nfrom skimage.graph import _mcp\n\n\nimage = np.array([[1, 1, 2, 2], [2, 1, 1, 3], [3, 2, 1, 2], [2, 2, 2, 1]])\nmc... | python | chosen |
[
{
"from": "system",
"value": "Add field for test result return\n"
},
{
"from": "human",
"value": "__author__ = 'sharvey'\n\nfrom classifiers import Classifier\nfrom corpus.mysql.reddit import RedditMySQLCorpus\nfrom ppm import Trie\n\n\nclass RedditPPM(Classifier):\n corpus = None\n trie =... | python | chosen |
[
{
"from": "system",
"value": "Remove spaces at the end of lines.\n"
},
{
"from": "human",
"value": "# -*- coding: utf-8 -*-\n# Copyright (C) 2009-2010, Luis Pedro Coelho <lpc@cmu.edu>\n# vim: set ts=4 sts=4 sw=4 expandtab smartindent:\n# \n# Permission is hereby granted, free of charge, to any p... | python | chosen |
[
{
"from": "system",
"value": "Fix issues with importing the Login form\n\nThe Login form lives in openstack_auth.forms and should be directly\nimported from that file.\n\nChange-Id: I42808530024bebb01604adbf4828769812856bf3\nCloses-Bug: #1332149\n(cherry picked from commit 345ccc9d503e6e55fe46d7813958c0081c... | python | chosen |
[
{
"from": "system",
"value": "TMS-227: Support sequences with value_type other than combination\n"
},
{
"from": "human",
"value": "import zc.form.field\nimport zope.schema.interfaces\n\n\nclass DynamicCombination(zc.form.field.Combination):\n\n def __init__(self, type_field, type_interface, *... | python | chosen |
[
{
"from": "system",
"value": "Use dimension as a constant, so we keep same interface for all backends; also returns full path to the place where image was saved\n"
},
{
"from": "human",
"value": "import os\n\nfrom sorl.thumbnail import get_thumbnail\n\nfrom ajaxuploader.backends.local import Loc... | python | chosen |
[
{
"from": "system",
"value": "Change the label of \"website_membership_published\" into \"Visible Contact Info On The Website\"\n"
},
{
"from": "human",
"value": "# -*- coding: utf-8 -*-\n# © 2016 Michael Viriyananda\n# License AGPL-3.0 or later (http://www.gnu.org/licenses/agp\n\nfrom openerp i... | python | chosen |
[
{
"from": "system",
"value": "Add missing `svn:eol-style : native` prop, which prevented making clean patches against the early 0.9b1 archives (now both the .zip and the .tar.gz have CRLFs for this file)\n\ngit-svn-id: f68c6b3b1dcd5d00a2560c384475aaef3bc99487@2214 af82e41b-90c4-0310-8c96-b1721e28e2e2\n"
}... | python | chosen |
[
{
"from": "system",
"value": "Add bigger response payload option of 512B\n"
},
{
"from": "human",
"value": "#!/usr/bin/env python\nfrom flask import Flask\napp = Flask(__name__)\n\n@app.route(\"/ping\")\ndef hello():\n return \"pong\"\n\nif __name__ == \"__main__\":\n app.run()"
},
{
... | python | chosen |
[
{
"from": "system",
"value": "Add comments and more gitignore\n"
},
{
"from": "human",
"value": "\"\"\"\nEntry point for running the sqmpy application standalone\n\"\"\"\nimport os\nfrom gevent import monkey\nmonkey.patch_all()\nfrom sqmpy.factory import create_app\n\n# This line added to suppor... | python | chosen |
[
{
"from": "system",
"value": "Fix typo in ssh test\n"
},
{
"from": "human",
"value": "#!/usr/bin/env python\n# -*- coding: utf8 -*-\n\nfrom app.protocols import ssh\n\ndef ssh_parameters_test():\n ss = ssh(hostname = '127.0.0.1', port = 22, username='user', password='password')\n assert(ss... | python | chosen |
[
{
"from": "system",
"value": "Send a signal after creation of composite field.\n"
},
{
"from": "human",
"value": "from django.db.migrations.operations.base import Operation\nfrom django.db import connection\n\nfrom psycopg2.extras import register_composite\n\nclass LoadSQLFromScript(Operation):\... | python | chosen |
[
{
"from": "system",
"value": "Use a constant for the 'HASHBROWN_SWITCH_DEFAULTS' settings key so it is easier to re-use.\n"
},
{
"from": "human",
"value": "from django.conf import settings\nfrom .models import Switch\n\n\ndef is_active(label, user=None):\n defaults = getattr(settings, 'HASHBR... | python | chosen |
[
{
"from": "system",
"value": "Update and add more commands."
},
{
"from": "human",
"value": "from cloudbot import hook\n\n\n@hook.command(\"bbmstaff\")\ndef bbmStaff(text, message, chan):\n if chan in (\"#bbm-bots\", \"#bbm-dev\", \"#bbm-packs\", \"#builtbrokenmodding\", \"#builtbroken\"):\n ... | python | chosen |
[
{
"from": "system",
"value": "Fix update permission on user\n\nOnly run it when user is created, not when it they are saved\n"
},
{
"from": "human",
"value": "# -*- coding: utf8 -*-\nfrom django.contrib.auth.models import AbstractUser\nfrom django.utils.functional import cached_property\nfrom so... | python | chosen |
[
{
"from": "system",
"value": "Change cmd line args to reflect change to CASA\n"
},
{
"from": "human",
"value": "\n'''\nUpdate EVLA pipeline variables to the current system.\n'''\n\n\ndef update_paths(pipe_dict, ms_path, pipepath):\n\n pipe_dict['ms_active'] = ms_path\n pipe_dict['SDM_name'... | python | chosen |
[
{
"from": "system",
"value": "Convert settings.INSTALLED_APPS to list before concatenating django.\n\nAccording to the Django documentation settings.INSTALLED_APPS is a\ntuple. To go for sure that only list + list are concatenated,\nsettings.INSTALLED_APPS is converted to list type before adding\n['django']... | python | chosen |
[
{
"from": "system",
"value": "Add return False to be sure all works as expected\n"
},
{
"from": "human",
"value": "# see https://gist.github.com/malthe/704910\nimport imp\nimport sys\n\n\ndef create_modules(module_path):\n path = \"\"\n module = None\n for element in module_path.split('... | python | chosen |
[
{
"from": "system",
"value": "Save .travis.yml into build properties\n"
},
{
"from": "human",
"value": "from buildbot.process import buildstep\nfrom buildbot.process.buildstep import SUCCESS, FAILURE, EXCEPTION\nfrom buildbot.process.properties import Properties\nfrom twisted.internet import def... | python | chosen |
[
{
"from": "system",
"value": "Swap print for logging statement\n"
},
{
"from": "human",
"value": "from __future__ import absolute_import, unicode_literals\nimport os\nfrom celery import Celery\n\n# set the default Django settings module for the 'celery' program.\nos.environ.setdefault('DJANGO_SE... | python | chosen |
[
{
"from": "system",
"value": "Disable dummy Packet test temporarily\n"
},
{
"from": "human",
"value": "# coding: utf-8\n# This Source Code Form is subject to the terms of the Mozilla Public\n# License, v. 2.0. If a copy of the MPL was not distributed with this\n# file, You can obtain one at http... | python | chosen |
[
{
"from": "system",
"value": "Refactor reduce to handle edge-case streams of length 0 and 1.\n"
},
{
"from": "human",
"value": "import mr_streams as ms\nimport unittest\n\n# :::: auxilary functions ::::\ndef sum_reduction(x,y):\n return x + y\n\nclass TestMisc(unittest.TestCase):\n\n def t... | python | chosen |
[
{
"from": "system",
"value": "Revert \"tolerate missing edge data\"\n\nThis reverts commit 93f1f6b24b7e8e61dbbfebe500048db752bc9fed.\n"
},
{
"from": "human",
"value": "from romanesco.format import dict_to_vtkarrays, dict_to_vtkrow\nimport vtk\n\nvtk_builder = vtk.vtkMutableDirectedGraph()\nnode_... | python | chosen |
[
{
"from": "system",
"value": "Add USD to supported currencies in Paymill backend\n\nUSD was not listed as a supported currency in the init file. This was causing 403 Forbidden errors which were hard to debug, because the Paymill backend simply didn't show up in the payment form and the only error was about ... | python | chosen |
[
{
"from": "human",
"value": "Add versioning information to eve_api\n"
},
{
"from": "gpt",
"value": "VERSION = (0, 1)\n\n# Dynamically calculate the version based on VERSION tuple\nif len(VERSION)>2 and VERSION[2] is not None:\n str_version = \"%d.%d_%s\" % VERSION[:3]\nelse:\n str_version ... | python | chosen |
[
{
"from": "system",
"value": "Remove the (dodgy) function to convert from an image to data.\n"
},
{
"from": "human",
"value": "\"\"\"\nThe FVCOM Python toolbox (PyFvcom)\n\n\"\"\"\n\n__version__ = '1.2'\n__author__ = 'Pierre Cazenave'\n__credits__ = ['Pierre Cazenave']\n__license__ = 'MIT'\n__ma... | python | chosen |
[
{
"from": "system",
"value": "Unify and simplify for tests.\n"
},
{
"from": "human",
"value": "# -*- coding: utf-8 -*-\n\nimport warnings\n\nfrom .settings import * # noqa: F403,F401\n\n# Handle system warning as log messages\nwarnings.simplefilter(\"once\")\n\nfor handler in LOGGING.get(\"hand... | python | chosen |
[
{
"from": "system",
"value": "Return \"id\" key to front instead of \"id_\".\n"
},
{
"from": "human",
"value": "from sqlalchemy.ext.declarative import declared_attr\nfrom blog.lib.database import db\n\n\nclass ModelMixin(object):\n \"\"\"A base mixin for all models.\"\"\"\n\n @declared_att... | python | chosen |
[
{
"from": "system",
"value": "Add comment to justify separate JSON file existence\n"
},
{
"from": "human",
"value": "import tornado.ioloop\nimport tornado.web\nimport requests\n\nhost = 'localhost'\nwaybackPort = '8080'\narchiveConfigFile = '/Applications/WAIL.app/config/archive.json'\n\nclass M... | python | chosen |
[
{
"from": "system",
"value": "Print the Format class used"
},
{
"from": "human",
"value": "def print_header():\n import sys\n from dxtbx.format.Registry import Registry\n \n # this will do the lookup for every frame - this is strictly not needed\n # if all frames are from the same... | python | chosen |
[
{
"from": "system",
"value": "Fix lru_cache import as memoize\n\nThanks to @jcomeauictx for the heads up\n"
},
{
"from": "human",
"value": "import sys\ntry:\n basestring\nexcept:\n basestring = str # Python3\n\nPY2 = sys.version_info[0] == 2\nif not PY2:\n text_type = str\n binary_t... | python | chosen |
[
{
"from": "system",
"value": "Fix a bug with uppercase links\n"
},
{
"from": "human",
"value": "from lxml.html import fromstring as lxml_from_string\nfrom unidecode import unidecode\n\n\nUNSUBSCRIBE_MARKERS = [\n\n # English\n \"unsub\", \"blacklist\", \"opt-out\", \"opt out\",\n\n # French\n... | python | chosen |
[
{
"from": "system",
"value": "feat: Support `Path` type for `project_root_path`\n\nDjango has switched to using pathlib.Path in startproject. This adds support for these in the project root path config option.\n"
},
{
"from": "human",
"value": "import os\nimport pickle\n\n\nclass Cache(dict):\n ... | python | chosen |
[
{
"from": "system",
"value": "Use new dmutils init_manager to set up reload on schema changes\n"
},
{
"from": "human",
"value": "#!/usr/bin/env python\n\nfrom __future__ import print_function\n\nimport os\n\nfrom flask.ext.script import Manager, Server\nfrom flask.ext.migrate import Migrate, Mig... | python | chosen |
[
{
"from": "system",
"value": "Allow POST request to work_completed view\n"
},
{
"from": "human",
"value": "from django.shortcuts import render\nfrom django.http import HttpResponse\n\ndef get_work(request):\n return HttpResponse('Not implemented')\n\ndef work_completed(request):\n return H... | python | chosen |
[
{
"from": "system",
"value": "Put the web.header function in a try/except block\n"
},
{
"from": "human",
"value": "from ..helpers import get_allowed\n\nimport subprocess\nimport web\n\nclass ShutdownMachineR:\n \"\"\"\n This endpoint is for shutting down a running machine.\n \"\"\"\n ... | python | chosen |
[
{
"from": "system",
"value": "Update what a transaction is\n"
},
{
"from": "human",
"value": "from peewee import *\n\ndb = SqliteDatabase('emails.db')\n\n\nclass Transaction(Model):\n cost = FloatField()\n address = CharField()\n tempPass = CharField()\n domain = CharField(index=True... | python | chosen |
[
{
"from": "system",
"value": "Change the return type to boolean"
},
{
"from": "human",
"value": "'''\nprime_test(n) returns a True if n is a prime number else it returns False\n'''\n\n\ndef prime_test(n):\n if n <= 1:\n return False\n if n==2 or n==3:\n return True\n if n%... | python | chosen |
[
{
"from": "system",
"value": "Correct an AttributeError and a potential IndexErr\n"
},
{
"from": "human",
"value": "# -*- coding: utf-8 -*-\n\"\"\"\nutils.py\n~~~~~~~~\n\nDefines utility functions used by UPnPy.\n\"\"\"\n\n\ndef camelcase_to_underscore(text):\n \"\"\"\n Convert a camelCase... | python | chosen |
[
{
"from": "system",
"value": "Change yield from to return to be compatible with python 3.2\n"
},
{
"from": "human",
"value": "from bot.api.telegram import TelegramBotApi\nfrom bot.storage import State\n\n\nclass Api:\n def __init__(self, telegram_api: TelegramBotApi, state: State):\n s... | python | chosen |
[
{
"from": "system",
"value": "Raise an exception when it's an undocumented opcode.\n"
},
{
"from": "human",
"value": "from sqlite3 import Connection, Row\n\n\nclass Decoder:\n def __init__(self):\n self.conn = Connection('nes.sqlite')\n self.conn.row_factory = Row\n\n def __d... | python | chosen |
[
{
"from": "system",
"value": "Remove duplicated JSON encoding for error messages\n"
},
{
"from": "human",
"value": "import json\n\nfrom django.conf import settings\nfrom django.views.decorators.http import require_http_methods\nfrom django.http import HttpResponse\n\nfrom healthcheck.healthcheck... | python | chosen |
[
{
"from": "system",
"value": "Prepare a second release candidate for 0.0.15\n"
},
{
"from": "human",
"value": "# -*- coding: utf-8 -*-\n\n# Licensed to the Apache Software Foundation (ASF) under one\n# or more contributor license agreements. See the NOTICE file\n# distributed with this work for... | python | chosen |
[
{
"from": "system",
"value": "Remove debug mode on flask\n"
},
{
"from": "human",
"value": "from canis import siriusxm, spotify, oauth\n\ndef main():\n try:\n current = siriusxm.get_currently_playing('siriusxmu')\n spotify_id = spotify.id_for_song(current)\n print(current... | python | chosen |
[
{
"from": "system",
"value": "Use several strategies for performance\n"
},
{
"from": "human",
"value": "#!/usr/bin/env python3\n\nfrom contextlib import contextmanager\nimport time\n\nfrom main import has_subset_sum_zero\n\nclass Duration:\n def __init__(self, elapsed=None):\n self.ela... | python | chosen |
[
{
"from": "system",
"value": "Put astropy.io.votable.writeto in the top-level namespace\n"
},
{
"from": "human",
"value": "# Licensed under a 3-clause BSD style license - see LICENSE.rst\n\"\"\"\nThis package reads and writes data formats used by the Virtual\nObservatory (VO) initiative, particu... | python | chosen |
[
{
"from": "system",
"value": "Use upper case variable for global vars\n"
},
{
"from": "human",
"value": "#! /usr/bin/env python\n# coding:utf-8\n\nfrom os import path\n\n\n# the number of loop for train IBM Model 2\nloop_count = 10\nphrase_model_file = path.join(\n path.abspath(path.dirname(_... | python | chosen |
[
{
"from": "system",
"value": "Add S3 command for performing backup data\n"
},
{
"from": "human",
"value": "from fabric.api import (\n cd,\n env,\n put,\n run,\n sudo,\n task\n)\n\n\nPRODUCTION_IP = '54.154.235.243'\nPROJECT_DIRECTORY = '/home/ubuntu/ztm/'\nCOMPOSE_FILE = 'compo... | python | chosen |
[
{
"from": "system",
"value": "Add function to check for goal state.\n"
},
{
"from": "human",
"value": "\"\"\"\nVarious utilities\n\"\"\"\nimport pprint\n\ndef load_state(path):\n \"\"\"\n Load an n-puzzle state from a file into an array and return it.\n \"\"\"\n result = []\n with... | python | chosen |
[
{
"from": "system",
"value": "Remove VAT number from supplier constants\n"
},
{
"from": "human",
"value": "# Here we define a set of hardcoded keys that we use when denormalizing data from Supplier/ContactInformation tables\n# into the SupplierFramework.declaration field. These are used only by ... | python | chosen |
[
{
"from": "system",
"value": "Fix the docstring for FixedString\n"
},
{
"from": "human",
"value": "import codecs\r\nfrom steel.fields import Field\r\nfrom steel.fields.mixin import Fixed\r\n\r\n__all__ = ['Bytes', 'String', 'FixedBytes', 'FixedString']\r\n\r\n\r\nclass Bytes(Field):\r\n \"A s... | python | chosen |
[
{
"from": "system",
"value": "Change default format to ics instead of ical\n"
},
{
"from": "human",
"value": "from rest_framework import renderers\nfrom icalendar import Calendar, Event\n\n\nclass ICalRenderer(renderers.BaseRenderer):\n media_type = 'text/calendar'\n format = 'ical'\n\n ... | python | chosen |
[
{
"from": "system",
"value": "Fix the issue that get_or_create returns a tuple instead of one object.\n"
},
{
"from": "human",
"value": "import os\nfrom optparse import make_option\n\nfrom django.core.management import BaseCommand\n\nfrom djangoautoconf.cmd_handler_base.msg_process_cmd_base impo... | python | chosen |
[
{
"from": "system",
"value": "Support debian based distributives in tests"
},
{
"from": "human",
"value": "#!/usr/bin/env python\n\nfrom os import getuid, geteuid, getgid, getegid\nfrom sys import argv\nfrom time import sleep\n\nfrom daemonize import Daemonize\n\npid = argv[1]\nlog = argv[2]\n\n... | python | chosen |
[
{
"from": "system",
"value": "Make sure that uploaded files are zipfiles\n"
},
{
"from": "human",
"value": "from django.core.management.base import BaseCommand\n\nfrom games import models, bundle\n\n\ndef package_love(stdout, game, release):\n if release.get_asset('love') is not None:\n ... | python | chosen |
[
{
"from": "system",
"value": "Use django helper to validate manager and plugins paths\n"
},
{
"from": "human",
"value": "import importlib\nfrom typing import List\n\nfrom django.conf import settings\nfrom django.core.checks import Error, register\n\n\n@register()\ndef check_extensions(app_config... | python | chosen |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.