conversations listlengths 2 3 | source stringclasses 1
value | stack stringclasses 1
value |
|---|---|---|
[
{
"from": "system",
"value": "Add docstring to the `pair_symbols` method\n"
},
{
"from": "human",
"value": "class MarkovChain:\n \"\"\"\n Entity which contains a chunk of text and a Markov chain generated from it.\n \"\"\"\n def __init__(self, text):\n self.text = text\n\n ... | python | chosen |
[
{
"from": "system",
"value": "Use iterator in resultset data migration\n"
},
{
"from": "human",
"value": "# Generated by Django 2.2.18 on 2021-05-13 11:27\n\nfrom django.db import migrations\n\n\ndef update_versions(versions, current_key, new_key):\n for version in versions:\n for resu... | python | chosen |
[
{
"from": "system",
"value": "Use example.com for API URL."
},
{
"from": "human",
"value": "dbdir = \"/usr/local/finance/db\"\nimgdir = \"/usr/local/finance/img\"\napiurl = \"https://sixpak.org/finance/api.py\"\nsessiondir = \"/usr/local/finance/session\"\nsessiontimeout = (60*15) # 15 minutes\n... | python | chosen |
[
{
"from": "system",
"value": "Fix crash\nwhen Ubuntu 16.04 x64 Python 2.7.12 (default, Nov 19 2016, 06:48:10) sys.platform return 'linux2'\n"
},
{
"from": "human",
"value": "\nimport os\nimport sys\n\nconfig = {\n 'win32': {\n 'detector': 'seeta_fd_lib.dll',\n 'aligner': 'seeta_... | python | chosen |
[
{
"from": "system",
"value": "Add py.test plugin which prints out test names as they are collected\n"
},
{
"from": "human",
"value": "# -*- coding: utf-8 -*-\n#\n# Copyright © 2017 Spyder Project Contributors\n# Licensed under the terms of the MIT License\n# (see LICENSE.txt for details)\n\"\"\"... | python | chosen |
[
{
"from": "system",
"value": "Add Filter option for order amd order group\n"
},
{
"from": "human",
"value": "from django.contrib import admin\nfrom digikey.models import Components, Orders, Order_Details, Groups\n\nclass ComponentInline(admin.TabularInline):\n model = Order_Details\n extra... | python | chosen |
[
{
"from": "system",
"value": "Redefine sort function to a generic one. Some overhead but can use for\nany property"
},
{
"from": "human",
"value": "\n\ndef sort_by_popularity(items):\n return sorted(items, key=lambda product: product.popularity, reverse=True)\n"
},
{
"from": "gpt",
... | python | chosen |
[
{
"from": "system",
"value": "Add blank lines the PEP0008 check missed so much\n"
},
{
"from": "human",
"value": "# -*- coding: utf-8 -*-\n# http://stackoverflow.com/a/8866661\ndef are_equal(a, b):\n unmatched = list(b)\n for element in a:\n try:\n unmatched.remove(elemen... | python | chosen |
[
{
"from": "system",
"value": "Fix pretty duration for null value\n"
},
{
"from": "human",
"value": "from datetime import datetime, timedelta\n\nfrom django import template\nfrom django.conf import settings\nfrom django.utils.translation import ugettext_lazy as _\n\n\nregister = template.Library(... | python | chosen |
[
{
"from": "system",
"value": "DOC: Add source of pickle hack\n"
},
{
"from": "human",
"value": "#first import dill, which populates itself into pickle's dispatch\nimport dill\nimport pickle\n# save the MethodDescriptorType from dill\nMethodDescriptorType = type(type.__dict__['mro'])\nif pickle._... | python | chosen |
[
{
"from": "system",
"value": "Remove non-ascii-chars in BBP name\n"
},
{
"from": "human",
"value": "\"\"\"Compute pi.\"\"\"\nfrom decimal import Decimal, getcontext\nimport argparse\nimport itertools\n\n\nclass ComputePi:\n \"\"\"Compute pi to a specific precision using multiple algorithms.\"... | python | chosen |
[
{
"from": "system",
"value": "Make test_shim_warning not fail on unrelated warnings\n"
},
{
"from": "human",
"value": "import sys\nimport warnings\n\nfrom IPython.utils.shimmodule import ShimWarning\n\n\ndef test_shim_warning():\n sys.modules.pop('IPython.config', None)\n with warnings.cat... | python | chosen |
[
{
"from": "system",
"value": "Revert \"remove dog and cat commands( see random.cat/help.html for some background on this)\"\n\nThis reverts commit 2195ec2a3eea800201dc177fa674b39a440d4ac2.\n"
},
{
"from": "human",
"value": "import logging\nimport re\n\nfrom ..tools import Cog\nfrom ..tools impor... | python | chosen |
[
{
"from": "system",
"value": "Raise system code on exit from `python -m detox`"
},
{
"from": "human",
"value": "import sys\nimport py\nimport detox\nfrom detox.proc import Detox\n\ndef parse(args):\n from tox.session import prepare\n return prepare(args)\n\ndef main(args=None):\n if arg... | python | chosen |
[
{
"from": "system",
"value": "Adjust maximum block size for lzo\n"
},
{
"from": "human",
"value": "import sys\nimport os\n\np1, p2 = sys.version_info[:2]\n\ncurpath = os.path.abspath( sys.argv[0] )\nif os.path.islink(curpath):\n curpath = os.readlink(curpath)\ncurrentdir = os.path.dirname( cu... | python | chosen |
[
{
"from": "system",
"value": "Add PointerEvents repo to master.client.polymer.\n\nR=hinoka@google.com\nBUG=chromium:237914\n\nReview URL: https://codereview.chromium.org/15783003\n\ngit-svn-id: 239fca9b83025a0b6f823aeeca02ba5be3d9fd76@201643 0039d316-1c4b-4281-b951-d872f2087c98\n"
},
{
"from": "huma... | python | chosen |
[
{
"from": "system",
"value": "Call into plugins from do_everything()\n"
},
{
"from": "human",
"value": "# Copyright 2013 John Reese\n# Licensed under the MIT license\n\nVERSION = '0.1.0'\n\nfrom collections import Counter, OrderedDict\n\nfrom .ent import Message\nfrom .log import logger\nfrom .p... | python | chosen |
[
{
"from": "system",
"value": "Change users route name to dukedsuser\n"
},
{
"from": "human",
"value": "from django.conf.urls import url, include\nfrom rest_framework import routers\nfrom handover_api import views\n\nrouter = routers.DefaultRouter()\nrouter.register(r'handovers', views.HandoverVi... | python | chosen |
[
{
"from": "system",
"value": "Add newline to end of file\n"
},
{
"from": "human",
"value": "'''A utility module to import all boilerplate Swaggery keywords into a module.\n\nUsage:\n\n from swaggery.keywords import *\n'''\nfrom .api import Api, Resource, operations\nfrom .utils import Ptypes\... | python | chosen |
[
{
"from": "system",
"value": "Fix another misleading log message\n"
},
{
"from": "human",
"value": "import groundstation.proto.channel_list_pb2\n\nfrom groundstation import logger\nlog = logger.getLogger(__name__)\n\n\ndef handle_listallchannels(self):\n log.info(\"Handling LISTALLCHANNELS\")... | python | chosen |
[
{
"from": "system",
"value": "Change the DT call, now the coding is working\n"
},
{
"from": "human",
"value": "import RPi.GPIO as GPIO\nimport time\n\n\nclass WeightSensor:\n \"\"\" Class that get the weight from a HX711\n this module is based on the HX711 datasheet\n\n Not test yet\n ... | python | chosen |
[
{
"from": "system",
"value": "Add an integration test that deliberately fails\n"
},
{
"from": "human",
"value": "integration_test = True\nname = 'HelloWorldTest'\npackage = 'helloworld'\n\ncan_crash = True\ncan_shutdown = True\n"
},
{
"from": "gpt",
"value": "integration_test = True\... | python | chosen |
[
{
"from": "system",
"value": "Remove usage from debug toolbar\n"
},
{
"from": "human",
"value": "from django.conf import settings\nfrom django.conf.urls import include, url # noqa\nfrom django.contrib import admin\nfrom django.views.generic import TemplateView\n\nimport django_js_reverse.views\... | python | chosen |
[
{
"from": "system",
"value": "Revert \"Revert \"corrected database settings merge again\"\"\n\nThis reverts commit e7766ce068eabea30c81ba699c77ed2fe488d69d.\n"
},
{
"from": "human",
"value": "from yacs.settings.base import settings\n\n__all__ = ['settings']\n\nwith settings as s:\n s.DEBUG = ... | python | chosen |
[
{
"from": "human",
"value": "Add a function to identify the boundary of a preclipped cell\n"
},
{
"from": "gpt",
"value": "import numpy as np\nimport scipy as sp\n\ndef cell_boundary_mask(image):\n\t\"\"\"\n\tIdentifies the clipping boundary of a cell image.\n\tReturns this as a mask, where True... | python | chosen |
[
{
"from": "system",
"value": "Allow editing amount field in expensenote\n"
},
{
"from": "human",
"value": "from django.contrib import admin\n\nfrom expense.models import ExpenseNote\n\n\nclass ExpenseNoteAdmin(admin.ModelAdmin):\n list_display = ['date', 'save_in_ledger', 'details', 'contact'... | python | chosen |
[
{
"from": "system",
"value": "Fix test, for real? :-)\n"
},
{
"from": "human",
"value": "# Copyright 2022 Google LLC\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may not use this file except in compliance with the License.\n# You may obtain a copy of the License... | python | chosen |
[
{
"from": "system",
"value": "Set default value for json.dumps\n\nUse default value when type cannot be serialized.\n"
},
{
"from": "human",
"value": "import json\nimport logging\nimport platform\n\nfrom django.core.serializers.json import DjangoJSONEncoder\nfrom django.http import UnreadablePos... | python | chosen |
[
{
"from": "system",
"value": "Make owner visible to superusers\n"
},
{
"from": "human",
"value": "from django.contrib import admin\n\nfrom .models import FileUpload\n\n\nclass FileUploadAdmin(admin.ModelAdmin):\n readonly_fields = ['owner']\n\n def get_fields(self, request, obj=None):\n ... | python | chosen |
[
{
"from": "system",
"value": "Add EDITOR variable in urlaccesschecker\n\nThis variable required by cmd2 library to work.\nWithout - it fails on bootstrap with traceback:\n\nFile \"/usr/lib/python2.6/site-packages/cmd2.py\", line 424, in Cmd\nif subprocess.Popen(['which', editor])\n\nChange-Id: I061f88b65d7b... | python | chosen |
[
{
"from": "system",
"value": "Add separate left and right eye data generation\n"
},
{
"from": "human",
"value": "#!/usr/bin/env python\n\nimport random\nfrom nott_params import *\n\nnum_samples = int(gridDim[0] * gridDim[1] * 10)\n\ndef generate_data(numx, numy):\n data = ['0' for i in range(... | python | chosen |
[
{
"from": "system",
"value": "Add some tests for the config module\n"
},
{
"from": "human",
"value": "### Going to fill this out in a subsequent PR\n"
},
{
"from": "gpt",
"value": "import os\nimport tempfile\n\nfrom unittest import TestCase\n\nfrom dusty import constants, config\n\nc... | python | chosen |
[
{
"from": "system",
"value": "Fix tests when yarn is not available\n"
},
{
"from": "human",
"value": "from unittest import TestCase\n\nfrom ddt import ddt, data\nfrom aioresponses.compat import (\n _vanilla_merge_url_params, _yarl_merge_url_params\n)\n\n\n@ddt\nclass CompatTestCase(TestCase):... | python | chosen |
[
{
"from": "system",
"value": "Fix typo in upgrade script\n\ngit-svn-id: eda3d06fcef731589ace1b284159cead3416df9b@1647 af82e41b-90c4-0310-8c96-b1721e28e2e2\n"
},
{
"from": "human",
"value": "import os.path\nimport shutil\n\nsql = \"\"\"\n-- Remove empty values from the milestone list\nDELETE FROM... | python | chosen |
[
{
"from": "system",
"value": "[Tests] Test trivia answer with wrong encoding\n\n"
},
{
"from": "human",
"value": "\nimport unittest\n\nfrom units.trivia import check_answer\n\n\nclass TestCheckAnswer(unittest.TestCase):\n\n def test_correct_answer(self):\n self.assertTrue(check_answer(... | python | chosen |
[
{
"from": "system",
"value": "Mark as 1.6.8 dev (build 95)\n"
},
{
"from": "human",
"value": "version = '1.6.7'\nrevision = ''\nmilestone = 'Yoitsu'\nrelease_number = '94'\nprojectURL = 'https://syncplay.pl/'\n"
},
{
"from": "gpt",
"value": "version = '1.6.8'\nrevision = ' developmen... | python | chosen |
[
{
"from": "system",
"value": "Add JobItemLoader and DataScienceJobsItemLoader class.\n"
},
{
"from": "human",
"value": "# -*- coding: utf-8 -*-\n\n# Define here the models for your scraped items\n#\n# See documentation in:\n# http://doc.scrapy.org/en/latest/topics/items.html\n\n\nfrom scrapy im... | python | chosen |
[
{
"from": "system",
"value": "Add distinction between claimed and unclaimed\n"
},
{
"from": "human",
"value": "#\n# Description:\n# This is the main of the poolWatcher\n#\n# Arguments: (eventually)\n# $1 = poll period (in seconds)\n# $2 = advertize rate (every $2 loops)\n# $3 = glidein s... | python | chosen |
[
{
"from": "system",
"value": "Increment version number to 0.17.4\n"
},
{
"from": "human",
"value": "\"\"\"Configuration for Django system.\"\"\"\n\n__version__ = \"0.17.3\"\n__version_info__ = tuple(\n [\n int(num) if num.isdigit() else num\n for num in __version__.replace(\"-\"... | python | chosen |
[
{
"from": "system",
"value": "Use to_playlist in the playlist provider\n"
},
{
"from": "human",
"value": "from __future__ import unicode_literals\n\nimport logging\n\nfrom mopidy import backend, models\n\nimport spotify\n\nfrom mopidy_spotify import translator\n\n\nlogger = logging.getLogger(__n... | python | chosen |
[
{
"from": "system",
"value": "Add test for frog csv format\n"
},
{
"from": "human",
"value": "import csv\nfrom io import StringIO\nimport logging\nfrom nose.tools import assert_equal\nfrom unittest import SkipTest\nfrom nlpipe.modules.frog import FrogLemmatizer\nfrom tests.tools import check_sta... | python | chosen |
[
{
"from": "system",
"value": "Use sqlalchemy BigInteger instead of mysql BIGINT\n"
},
{
"from": "human",
"value": "from sqlalchemy import Column, Integer, String, Text, ForeignKey\nfrom sqlalchemy.dialects.mysql import BIGINT\nfrom sqlalchemy.orm import relationship\nfrom bookmarks.database impo... | python | chosen |
[
{
"from": "system",
"value": "Set database name to fluxdb\n"
},
{
"from": "human",
"value": "\"\"\"Configuration constants.\"\"\"\nimport os\n\nPACKAGEDIR = os.path.dirname(os.path.abspath(__file__))\n\nHOSTNAME = os.uname()[1]\nif HOSTNAME == 'ec.geert.io' or HOSTNAME == 'imo.geert.io' or HOSTN... | python | chosen |
[
{
"from": "system",
"value": "Add depot_tools to PYTHONPATH for pylint\n\nOtherwise, pylint will fail on trybot.\n"
},
{
"from": "human",
"value": "#!/usr/bin/env python\n\n''' This script provides utils for python scripts in cameo.\n'''\n\nimport os\nimport sys\nimport subprocess\n\ndef TryAddD... | python | chosen |
[
{
"from": "system",
"value": "Use numatune but use mode preferred\n"
},
{
"from": "human",
"value": "import glob\nimport subprocess\nfrom .read import read\n\nclass Virsh:\n \"\"\"Class can be used to execute virsh commands for a given domain\"\"\"\n domain = \"\"\n\n def __init__(self,... | python | chosen |
[
{
"from": "system",
"value": "Test case when there's no riemann config\n"
},
{
"from": "human",
"value": "from pytest import fixture\n\nfrom oshino.config import Config, RiemannConfig\n\n\n@fixture\ndef base_config():\n return Config({\"riemann\": {\"host\": \"localhost\",\n ... | python | chosen |
[
{
"from": "system",
"value": "Set commenter to logged in user, not ticket requestor\n"
},
{
"from": "human",
"value": "from django.shortcuts import get_object_or_404, render, redirect\nfrom django.views.decorators.http import require_POST\n\nfrom ticketus.core.models import *\nfrom ticketus.core... | python | chosen |
[
{
"from": "system",
"value": "[Scripts] Convert coroutine executor to OOP\n"
},
{
"from": "human",
"value": "\n# -*- coding: ascii -*-\n\n# A generator-based coroutine framework.\n\nimport select\n\ndef run(routines):\n while routines:\n for r in routines:\n try:\n ... | python | chosen |
[
{
"from": "system",
"value": "Revert \"Add exception to be thrown by select()\"\n\nThis reverts commit 1009bd3b5e5941aff2f7b3852494ee19f085dcce.\n"
},
{
"from": "human",
"value": "class McDatabaseHandlerException(Exception):\n \"\"\"Database handler exception.\"\"\"\n pass\n\n\nclass McCon... | python | chosen |
[
{
"from": "system",
"value": "Add conf arg to check function"
},
{
"from": "human",
"value": "# 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://mozilla.org/MPL/2.0/.\n... | python | chosen |
[
{
"from": "human",
"value": "Create a comparison matrix for 2 1-D bool arrays\n\nSimply count the number of combinations of true and false between the\ntwo 1-D arrays and sum them together. The result is then stacked into a\n2-D array where the indices match the particular combination of true and\nfalse see... | python | chosen |
[
{
"from": "system",
"value": "Fix race condition during `mimetypes` initialization.\n\nInitial patch from Steven R. Loomis.\nCloses #8629.\n\n\ngit-svn-id: f68c6b3b1dcd5d00a2560c384475aaef3bc99487@9740 af82e41b-90c4-0310-8c96-b1721e28e2e2\n"
},
{
"from": "human",
"value": "# With mod_python we'l... | python | chosen |
[
{
"from": "system",
"value": "Add 'All' option to lists\n"
},
{
"from": "human",
"value": "from pymongo import MongoClient\n\n\ndef main():\n client = MongoClient()\n db = client.cityhotspots\n db.drop_collection('dineroptions')\n diners_collection = db.diners\n\n doc = {}\n di... | python | chosen |
[
{
"from": "system",
"value": "Change endpoint to show cases\n"
},
{
"from": "human",
"value": "import requests\nimport logging\nfrom flask import current_app\nfrom requests.auth import HTTPBasicAuth\n\n\nlogging.basicConfig(level=logging.INFO)\nlogger = logging.getLogger(__name__)\nlogger.addHan... | python | chosen |
[
{
"from": "system",
"value": "Move various useful constants to this file\n"
},
{
"from": "human",
"value": "# The default stack user name and password...\n#\n# Someday make this better?\nDEF_USER, DEF_PW = ('stack', 'stack')\n"
},
{
"from": "gpt",
"value": "from builder.roles import ... | python | chosen |
[
{
"from": "system",
"value": "MP3: Replace hardcoded names with tracklist\n"
},
{
"from": "human",
"value": "#!/usr/bin/python3\n\nimport ID3\nimport os\nimport sys\n\nmp3_extension = \".mp3\"\nnames = [\"final_name_1\", \"final_name_2\", \"final_name_3\"]\n\nfiles_all = os.listdir('.')\nfiles =... | python | chosen |
[
{
"from": "system",
"value": "Remove unnecessary model docstrings, add repr.\n"
},
{
"from": "human",
"value": "\"\"\"Entity, Component, and System classes.\"\"\"\n\nfrom __future__ import print_function\nfrom abc import ABCMeta, abstractmethod\n\n\nclass Entity(object):\n \"\"\"Encapsulation... | python | chosen |
[
{
"from": "human",
"value": "Create test.setup() to tear down the database before starting tests.\n"
},
{
"from": "gpt",
"value": "\"\"\"\nMongoAlchemy tests package.\n\nThere's a bunch of tests here, man.\n\n\"\"\"\n\nfrom util import get_session\n\n\ndef setup():\n \"\"\"\n Destroy the w... | python | chosen |
[
{
"from": "system",
"value": "Fix problem when not accepting any suggestions.\n"
},
{
"from": "human",
"value": "from helpers.match_manipulator import MatchManipulator\nfrom models.match import Match\n\nclass MatchSuggestionAccepter(object):\n \"\"\"\n Handle accepting Match suggestions.\n... | python | chosen |
[
{
"from": "system",
"value": "Add an access from graph\n"
},
{
"from": "human",
"value": "from tensormate.graph.base import *\nfrom tensormate.graph.data_pipeline import *\n"
},
{
"from": "gpt",
"value": "from tensormate.graph.base import *\nfrom tensormate.graph.data_pipeline import... | python | chosen |
[
{
"from": "system",
"value": "Resolve symbolic links for filename in Sublime view - without this all files available through symlinks are considered as new to git\n"
},
{
"from": "human",
"value": "import os\n\ndef git_file_path(view, git_path):\n if not git_path:\n return False\n full_file... | python | chosen |
[
{
"from": "system",
"value": "Increase default MonteCarlo n_sims from 100 to 1000\n"
},
{
"from": "human",
"value": "import random\nfrom collections import defaultdict, Counter\nfrom . import Player\nfrom ..util import utility\n\n\nclass MonteCarlo(Player):\n\n name = 'MonteCarlo'\n\n def ... | python | chosen |
[
{
"from": "system",
"value": "Use output name from input name\n"
},
{
"from": "human",
"value": "import argparse\nimport os\nimport fiona\nfrom shapely.geometry import Polygon, mapping\n\n\ndef remove_file(file_name):\n try:\n os.remove(file_name)\n except OSError:\n pass\n\n... | python | chosen |
[
{
"from": "system",
"value": "Fix a few Sphinx typos\n\n* `.. note:` -> `.. note::` to prevent the `note` from being interpreted as a comment, which wouldn't show up when the docs are rendered.\r\n* Double backticks for the code bits.\r\n* Correct typo (\"atribute\" -> \"attribute\").\r\n* Sphinx doesn't li... | python | chosen |
[
{
"from": "system",
"value": "Fix deprecation warning when running tests with Django 1.3.\n"
},
{
"from": "human",
"value": "import os\n\nDEBUG = True\n\nDATABASE_ENGINE = 'sqlite3'\nDATABASE_NAME = os.path.join(os.path.dirname(__file__), 'test.db')\n\nROOT_URLCONF = 'testproject.urls'\n\nTEMPLA... | python | chosen |
[
{
"from": "system",
"value": "Use the same Redis DB as census-api to make stats collection easier\n"
},
{
"from": "human",
"value": "from censusreporter.config.base.settings import *\nimport os\n\nDEBUG = False\nROOT_URLCONF = 'censusreporter.config.prod.urls'\nWSGI_APPLICATION = \"censusreporte... | python | chosen |
[
{
"from": "system",
"value": "Support recursive import of CSV and TSV files as well as TXT ones.\n"
},
{
"from": "human",
"value": "import os\nimport glob\n\nfrom irco import parser, tabular\n\n\ndef get_file_list(sources):\n for source in sources:\n if os.path.isdir(source):\n ... | python | chosen |
[
{
"from": "system",
"value": "Change DJANGO_ELECT_USER_MODEL to default to AUTH_USER_MODEL\n"
},
{
"from": "human",
"value": "from django.conf import settings\n\n\n\"\"\"\nA string that corresponds to the path to the model that should be used for\nthe Election.allowed_voters and Vote.account for... | python | chosen |
[
{
"from": "system",
"value": "Add more info to test_ais docstring\n"
},
{
"from": "human",
"value": "\"\"\"\nTest dbm_metrics script\n\"\"\"\nfrom pylearn2.scripts.dbm import dbm_metrics\nfrom pylearn2.datasets.mnist import MNIST\n\n\ndef test_ais():\n \"\"\"\n Test ais computation\n \"... | python | chosen |
[
{
"from": "system",
"value": "Change style of setting records_class default\n"
},
{
"from": "human",
"value": "from __future__ import unicode_literals\n\n__version__ = '1.5.1'\n\n\ndef register(\n model, app=None, manager_name='history', records_class=None,\n **records_config):\n ... | python | chosen |
[
{
"from": "system",
"value": "Fix in groups.py for get_custom_views function.\n"
},
{
"from": "human",
"value": "#!/usr/bin/python3\n\n'''Copyright 2015 Hewlett Packard Enterprise Development LP\n\nLicensed under the Apache License, Version 2.0 (the “License”); you may not use this file except i... | python | chosen |
[
{
"from": "system",
"value": "Use square brackets instead of angle brackets in messages, as the latter are getting stripped out\n"
},
{
"from": "human",
"value": "import os\nimport json\nimport requests\n\nfrom django.http import HttpResponse\nfrom django.views.decorators.csrf import csrf_exempt... | python | chosen |
[
{
"from": "system",
"value": "Use Exception instead of StandardError\n\nPython 3 doesn't have StandardError...\n"
},
{
"from": "human",
"value": "class ControllerError(StandardError): pass\nclass InterpreterError(StandardError): pass\n"
},
{
"from": "gpt",
"value": "class CytoplasmEr... | python | chosen |
[
{
"from": "system",
"value": "Fix naming of 'this' reference\n"
},
{
"from": "human",
"value": "\nfrom .base import SimSootValue\nfrom .local import SimSootValue_Local\n\nclass SimSootValue_ThisRef(SimSootValue):\n\n __slots__ = [ 'id', 'type', 'heap_alloc_id' ]\n\n def __init__(self, heap... | python | chosen |
[
{
"from": "system",
"value": "Fix an issue when unit tests always return 0 status.\n"
},
{
"from": "human",
"value": "import unittest\n\nif __name__ == '__main__':\n all_tests = unittest.TestLoader().discover('./', pattern='*_tests.py')\n unittest.TextTestRunner().run(all_tests)\n"
},
... | python | chosen |
[
{
"from": "system",
"value": "Update tests to find source path\n"
},
{
"from": "human",
"value": "import datetime\nimport odin.datetimeutil\n\nARE_YOU_EXPERIENCED = datetime.date(1967, 5, 12)\nMWT = odin.datetimeutil.FixedTimezone(-6, 'Mountain War Time')\nBOOM = datetime.datetime(1945, 7, 16, 5... | python | chosen |
[
{
"from": "system",
"value": "Drop a special case for Django <1.10\n"
},
{
"from": "human",
"value": "from django import VERSION\n\nDEBUG = True\nUSE_TZ = True\n\n# SECURITY WARNING: keep the secret key used in production secret!\nSECRET_KEY = \"something-not-secret\"\n\nDATABASES = {\n \"def... | python | chosen |
[
{
"from": "system",
"value": "Add test for inputting package URL\n"
},
{
"from": "human",
"value": "# -*- coding: utf-8 -*-\nfrom __future__ import unicode_literals\nimport mock\nimport pytest\n\nimport pypi_cli as pypi\n\n@pytest.mark.usefixtures('mock_api')\nclass TestStat:\n\n def test_mis... | python | chosen |
[
{
"from": "system",
"value": "Set display.width based on terminal size\n"
},
{
"from": "human",
"value": "\"\"\"\nCompare multiple similar dictionary data in JSON/YAML/Pickle files.\n\"\"\"\n\nfrom __future__ import print_function\n\nimport sys\n\n\ndef dictsdiff_cli(files):\n import pandas\n... | python | chosen |
[
{
"from": "system",
"value": "Check if the index is available before calling the query.\n"
},
{
"from": "human",
"value": "from util import hook\nfrom elasticutils import S\n\n\n@hook.command\n@hook.command('sf')\ndef symfony(inp):\n search = S().indexes('doc-index').doctypes('doc-section-typ... | python | chosen |
[
{
"from": "system",
"value": "Add fake connection class, PEP8 changes\n\nAlso had a bad assert in there\n"
},
{
"from": "human",
"value": "import pytest\n\ndef test_get_connection():\n assert False\n\ndef test_verify_hostname_with_valid_hostname():\n assert False\n\ndef test_verify_hostnam... | python | chosen |
[
{
"from": "system",
"value": "Add SECRET_KEY to Travis CI settings\n\n``settings.SECRET_KEY`` is required in Django 1.5\n\nAddresses #660\n"
},
{
"from": "human",
"value": "from defaults import *\n\nDEBUG=False\n\nDATABASES = {\n 'default': {\n #'ENGINE': 'django.db.backends.postgresql... | python | chosen |
[
{
"from": "system",
"value": "Make prcheck pass without needing cond deps\n"
},
{
"from": "human",
"value": "import threading # noqa\n\nfrom typing import Callable, Optional # noqa\nimport watchdog.observers\nfrom watchdog.events import FileSystemEventHandler\nfrom watchdog.events import FileS... | python | chosen |
[
{
"from": "system",
"value": "Disable flake8 warning on `__version__` import\n"
},
{
"from": "human",
"value": "from trakt.core.errors import ERRORS\nfrom trakt.core.exceptions import RequestError, ClientError, ServerError\nfrom trakt.client import TraktClient\nfrom trakt.helpers import has_attr... | python | chosen |
[
{
"from": "system",
"value": "Remove static file serving (using django-staticfiles instead is recommended)\n"
},
{
"from": "human",
"value": "import os\nfrom django.conf.urls.defaults import patterns, url\nimport kanboard\n\nurlpatterns = patterns('kanboard.views',\n url(r'^board/(?P<board_slu... | python | chosen |
[
{
"from": "system",
"value": "Use bootstrap utility to retrieve the configuration name from the environment.\n"
},
{
"from": "human",
"value": "#!/usr/bin/env python\n# -*- coding: utf-8 -*-\n\n\"\"\"Run a worker for the job queue.\"\"\"\n\nimport os\nimport sys\n\nfrom redis import StrictRedis\... | python | chosen |
[
{
"from": "system",
"value": "Remove uniqueness constraints on Workflow and TaskGroup\n\n* Titles need not be unique anymore\n"
},
{
"from": "human",
"value": "\n\"\"\"Remove prohibitive foreign key constraints\n\nRevision ID: 32221e9f330c\nRevises: 235b7b9989be\nCreate Date: 2014-08-04 20:34:36... | python | chosen |
[
{
"from": "system",
"value": "Add eager-loaded links for Section\n"
},
{
"from": "human",
"value": "\n# Copyright (C) 2013 Google Inc., authors, and contributors <see AUTHORS file>\n# Licensed under http://www.apache.org/licenses/LICENSE-2.0 <see LICENSE file>\n# Created By:\n# Maintained By:\n\... | python | chosen |
[
{
"from": "system",
"value": "Include an event with the response log message\n\nThis is now required by structlog\n"
},
{
"from": "human",
"value": "\"\"\"Logging helpers and utilities.\"\"\"\n\nimport uuid\nfrom functools import wraps\nfrom timeit import default_timer as timer\nfrom typing impo... | python | chosen |
[
{
"from": "system",
"value": "Add box.text namespace. Also switch to oss@box.com for email addr.\n\nFixes #7\n"
},
{
"from": "human",
"value": "# -*- coding: utf-8 -*-\n\nfrom __future__ import unicode_literals\nfrom setuptools import setup, find_packages\nfrom os.path import dirname, join\n\n\n... | python | chosen |
[
{
"from": "system",
"value": "Make sure only Mac computers use the MacOSXTTS io adapter\n"
},
{
"from": "human",
"value": "from chatterbot.adapters.io import IOAdapter\nfrom chatterbot.utils.read_input import input_function\n\nimport os\nimport platform\nimport subprocess\n\n\nclass MacOSXTTS(IO... | python | chosen |
[
{
"from": "system",
"value": "Install stuff from /addon, too."
},
{
"from": "human",
"value": "#!/usr/bin/env python3\nfrom distutils.core import setup\n\nsetup(\n name='dg',\n version='HEAD',\n description='A programming language for the CPython VM',\n author='pyos',\n author_ema... | python | chosen |
[
{
"from": "system",
"value": "Change is the Law of Life (6)\n"
},
{
"from": "human",
"value": "from setuptools import setup, find_packages\n\nsetup(name='syse',\n version='1.0',\n description='A syntactic sentence extraction program.',\n url='https://github.com/NathanWycoff/SySE',\n ... | python | chosen |
[
{
"from": "system",
"value": "Fix regex for registration url\n"
},
{
"from": "human",
"value": "from project.api.views import ChannelViewSet, MessageViewSet, UserViewSet\nfrom django.conf.urls import url, include\nfrom rest_framework.authtoken import views\nfrom rest_framework.routers import Def... | python | chosen |
[
{
"from": "system",
"value": "Use generic to prepare the json output so that non-structured custom types can be added\n"
},
{
"from": "human",
"value": "import base64\n\nfrom wsme.rest import RestProtocol\nfrom wsme.controller import register_protocol\nimport wsme.types\n\ntry:\n import simpl... | python | chosen |
[
{
"from": "system",
"value": "Remove upper bound for packages\n\noedialect requires sqlalchemy >= 1.2.0 which would make it incompatible with ego.io for no reason"
},
{
"from": "human",
"value": "#! /usr/bin/env python\n# coding: utf-8\n\nfrom setuptools import find_packages, setup\n\nsetup(name... | python | chosen |
[
{
"from": "system",
"value": "Update module version and tag as v0.4\n"
},
{
"from": "human",
"value": "#!/usr/bin/env python\n\n\nfrom distutils.core import setup, Extension\n\n\nsetup(\n name='mapcode',\n ext_modules=[Extension('mapcode',\n sources=['mapcodemodul... | python | chosen |
[
{
"from": "system",
"value": "Copy paste error leading to static and template folders not being properly installed along side the package\n"
},
{
"from": "human",
"value": "# coding=utf-8\nimport setuptools\n\ndef package_data_dirs(source, sub_folders):\n\timport os\n\tdirs = []\n\n\tfor d in su... | python | chosen |
[
{
"from": "system",
"value": "Modify the logging configuration in Python Example\n"
},
{
"from": "human",
"value": "#!/usr/bin/python\n# encoding: utf8\nfrom __future__ import absolute_import, print_function, unicode_literals\n\nimport eventlet\n\nfrom oslo_config import cfg\nfrom oslo_log impor... | python | chosen |
[
{
"from": "system",
"value": "Remove DROP INDEX from fix_fee_product_index\n"
},
{
"from": "human",
"value": "# -*- coding: utf-8 -*-\n# Generated by Django 1.11.22 on 2019-10-31 16:33\nfrom __future__ import unicode_literals\n\nfrom django.db import migrations, OperationalError, ProgrammingErro... | python | chosen |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.