conversations listlengths 2 3 | source stringclasses 1
value | stack stringclasses 1
value |
|---|---|---|
[
{
"from": "system",
"value": "Make socketio server url a global context variable in Django\n"
},
{
"from": "human",
"value": "from django.conf import settings\n\ndef globals(request):\n context = {\n 'app_title': 'Civil Legal Advice',\n 'proposition_title': 'Civil Legal Advice',\n 'pha... | python | chosen |
[
{
"from": "system",
"value": "[R] Add empty line after imports\n"
},
{
"from": "human",
"value": "#!/usr/bin/env python3\n\"\"\"\nFollow the white house rabbit\n\nThis fetches tweets from an user and prints\nthe full json output from the api.\n\"\"\"\n\nimport os\nimport sys\nimport json\nfrom t... | python | chosen |
[
{
"from": "system",
"value": "Fix the number of cache calls expected in a test.\n"
},
{
"from": "human",
"value": "# coding: utf-8\n\nfrom __future__ import absolute_import, unicode_literals\n\nimport django\nfrom django.core import cache\nfrom django.utils.unittest import skipIf\n\nfrom ..base ... | python | chosen |
[
{
"from": "system",
"value": "Fix handling of separator characters by Python modules\n\nCurrently the Python modules do not tolerate more than one equal\nsign (\"=\") in each line of the config file. However REs with\nlook-ahead functionality require this character. Introduce new\nRE-based line-splitting me... | python | chosen |
[
{
"from": "system",
"value": "Expand test to cover variables.\n"
},
{
"from": "human",
"value": "from webtest import TestApp as Client\nfrom wsgi_graphql import wsgi_graphql\n\nfrom graphql.core.type import (\n GraphQLEnumType,\n GraphQLEnumValue,\n GraphQLInterfaceType,\n GraphQLObj... | python | chosen |
[
{
"from": "system",
"value": "Define a custom related_name in UserSettings->User relation\n"
},
{
"from": "human",
"value": "# -*- coding: utf-8 -*-\nfrom django.contrib.auth.models import User\nfrom django.db import models\nfrom django.utils.translation import ugettext_lazy as _\nfrom django.co... | python | chosen |
[
{
"from": "system",
"value": "Improve error on invalid JSON response content\n\nwith @NerdyProjects\n"
},
{
"from": "human",
"value": "from importlib import import_module\nfrom json import dumps as dump_json\nfrom json import loads as load_json\n\n\ndef json_stringify(data):\n return dump_jso... | python | chosen |
[
{
"from": "system",
"value": "Load env-vars from a .env file\n"
},
{
"from": "human",
"value": "from __future__ import unicode_literals, absolute_import\n\nimport os\nfrom identity import app\n\nif __name__ == '__main__':\n port = int(os.environ.get('PORT', 5000))\n app.run(host='0.0.0.0',... | python | chosen |
[
{
"from": "system",
"value": "Add functions to insert and clear data\n"
},
{
"from": "human",
"value": "# File: circular_buffer.py\n# Purpose: A data structure that uses a single, fixed-size buffer\n# as if it were connected end-to-end.\n# Programmer: Amal Shehu\n# Cour... | python | chosen |
[
{
"from": "system",
"value": "Read securities from conf file"
},
{
"from": "human",
"value": "import requests\nfrom bs4 import BeautifulSoup \n\nURL = 'https://finance.yahoo.com/quote/'\nsecurities = ['bgcp', 'cvx', 'f', 'ge', 'intc', 'lumn', 'src', 't']\n\nfor security in securities:\n query ... | python | chosen |
[
{
"from": "system",
"value": "Support separate folders for raw observations and raw counts\n"
},
{
"from": "human",
"value": "from pathlib import Path\nimport json\nimport inspect\nimport sys\n\nimport PyFloraBook\n\n\nOBSERVATIONS_FOLDER = \"observation_data\"\nRAW_DATA_FOLDER = \"raw\"\n\n\nde... | python | chosen |
[
{
"from": "system",
"value": "Use PlanRepository as the object for permission check instead of Build\n"
},
{
"from": "human",
"value": "from django.core.exceptions import PermissionDenied\nfrom django.shortcuts import get_object_or_404\nfrom metaci.build.models import Build\nfrom metaci.build.mo... | python | chosen |
[
{
"from": "system",
"value": "Support introspection hack for IPython\n"
},
{
"from": "human",
"value": "import functools\nimport inspect\n\ndef wraps(wrapped):\n \"\"\" a convenience function on top of functools.wraps:\n\n - adds the original function to the wrapped function as __wrapped__... | python | chosen |
[
{
"from": "system",
"value": "Fix crash in development mode with python 3\n"
},
{
"from": "human",
"value": "# -*- coding: utf-8 -*-\n\n\"\"\"DMARC related tools for Modoboa.\"\"\"\n\nfrom __future__ import unicode_literals\n\nfrom pkg_resources import get_distribution, DistributionNotFound\n\n\... | python | chosen |
[
{
"from": "system",
"value": "Rename oracle command line names for consistency and prefixfreeness.\n"
},
{
"from": "human",
"value": "import chord, dhash, oracle, totalrecall\n\n# For automatic use by availsim\nknown_types = {\n 'chord': chord,\n 'dhash': dhash.dhash,\n 'fragments': dha... | python | chosen |
[
{
"from": "system",
"value": "Change the metadata object from a Magic_Anything to a straight dict\n\nLose the magic! Lose the magic! (That is *so* not what Anna said.)\n"
},
{
"from": "human",
"value": "import apikeys\nimport psycopg2\nimport utils\n\n_conn = psycopg2.connect(apikeys.db_connect_... | python | chosen |
[
{
"from": "system",
"value": "Replace print statement with `warnings.warn`.\n\nAlso so that it doesn't need to be converted for Python3 compat.\n"
},
{
"from": "human",
"value": "#!/usr/bin/python\nimport optparse\nimport sys\n# Install the Python unittest2 package before you run this script.\ni... | python | chosen |
[
{
"from": "system",
"value": "Simplify Installer revision API views\n"
},
{
"from": "human",
"value": "from __future__ import absolute_import\n\nfrom rest_framework import generics\nfrom reversion.models import Version\n\nfrom common.permissions import IsAdminOrReadOnly\nfrom games import models... | python | chosen |
[
{
"from": "system",
"value": "Fix appstore json parsing process.\n"
},
{
"from": "human",
"value": "import asyncio\nimport json\nfrom helper.filter import remove_emoji\nfrom helper.lang import find_out_language\nfrom lxml import etree\nfrom datetime import datetime\nfrom helper.http_client impor... | python | chosen |
[
{
"from": "system",
"value": "Add placeholder values for trello items in tests\n"
},
{
"from": "human",
"value": "from .base import * # noqa\n\nDATABASES = {\n 'default': {\n 'ENGINE': 'django.contrib.gis.db.backends.postgis',\n 'NAME': 'dc_website_test',\n 'USER': 'post... | python | chosen |
[
{
"from": "system",
"value": "Update to support config files that are passed to it.\n"
},
{
"from": "human",
"value": "from imhotep.tools import Tool\nfrom collections import defaultdict\nimport json\nimport os\n\n\nclass RubyLintLinter(Tool):\n\n def invoke(self, dirname, filenames=set()):\n... | python | chosen |
[
{
"from": "system",
"value": "Update desk form and add update form as well\n"
},
{
"from": "human",
"value": "from __future__ import absolute_import\n\nfrom django import forms\nfrom django.contrib.auth.forms import UserCreationForm\nfrom django.contrib.admin.widgets import FilteredSelectMultipl... | python | chosen |
[
{
"from": "system",
"value": "fix: Add PyLintHandler to artifact manager\n"
},
{
"from": "human",
"value": "from __future__ import absolute_import, print_function\n\nfrom .manager import Manager\nfrom .checkstyle import CheckstyleHandler\nfrom .coverage import CoverageHandler\nfrom .pycodestyle ... | python | chosen |
[
{
"from": "system",
"value": "Fix Event class instance variables\n"
},
{
"from": "human",
"value": "class Event:\n source = None\n event = None\n data = None\n\n def __init__(self, source, event, data=None):\n self.source = source\n self.event = event\n self.data... | python | chosen |
[
{
"from": "system",
"value": "Improve smoke test coverage for the logger.\n"
},
{
"from": "human",
"value": "\"\"\"\nTest the logger module.\n\"\"\"\n\n# Author: Gael Varoquaux <gael dot varoquaux at normalesup dot org> \n# Copyright (c) 2009 Gael Varoquaux\n# License: BSD Style, 3 clauses.\n\ni... | python | chosen |
[
{
"from": "system",
"value": "Test that missing optional outputs aren't created"
},
{
"from": "human",
"value": "# TOOL test-data-in-out.py: \"Test data input and output in Python\" (Data input output test.) \n# INPUT input TYPE GENERIC\n# OUTPUT output\n\nimport shutil\n\nshutil.copyfile('input... | python | chosen |
[
{
"from": "system",
"value": "Fix for done action bug\n"
},
{
"from": "human",
"value": "# coding=utf8\n\n# Local modules\nfrom common import debug\nfrom common.action import action_classes\nfrom common.telegram import telegram_utils\n\nfrom dailydevo import desiringgod_utils\nfrom user import u... | python | chosen |
[
{
"from": "system",
"value": "Add bg option in batik rasterizer\n"
},
{
"from": "human",
"value": "# -*- coding: utf-8 -*-\n\"\"\"\nChromium-based rasterizer module.\n\nPrerequisite:\n\n sudo apt-get install -y chromedriver chromium\n\n\"\"\"\nfrom __future__ import absolute_import, unicode_l... | python | chosen |
[
{
"from": "system",
"value": "Fix 401 error for requests that require authentication\n\n"
},
{
"from": "human",
"value": "import base64\n\nfrom .models import Device\n\nclass BasicAuthRemote(object):\n def __init__(self, get_response):\n self.get_response = get_response\n\n def get_... | python | chosen |
[
{
"from": "system",
"value": "Use the new xapi.storage package hierarchy\n\nSigned-off-by: David Scott <63c9eb0ea83039690fefa11afe17873ba8278a56@eu.citrix.com>\n"
},
{
"from": "human",
"value": "#!/usr/bin/env python\n\nimport os\nimport sys\nimport xapi\nimport xapi.plugin\nfrom xapi.storage.da... | python | chosen |
[
{
"from": "system",
"value": "Declare MIT license and support for Python 2 and 3"
},
{
"from": "human",
"value": "import os\nfrom setuptools import setup, find_packages\n\nwith open(os.path.join(os.path.dirname(__file__), 'README.txt')) as f:\n long_description = f.read()\n\nsetup(\n name=... | python | chosen |
[
{
"from": "system",
"value": "Fix copyright year, it should start from 2016 :(\n"
},
{
"from": "human",
"value": "# -*- coding: utf-8 -*-\n\nfrom PyQt4.QtGui import QDialog, qApp\nfrom ui.aboutdialog import Ui_AboutDialog\nfrom common import dataDirPath\nfrom version import VERSION\n\n\nclass Ab... | python | chosen |
[
{
"from": "system",
"value": "Save results of perspective jsd calculation to file\n"
},
{
"from": "human",
"value": "import logging\nimport argparse\n\nfrom utils.experiment import load_config, get_corpus\nfrom utils.controversialissues import perspective_jsd_matrix\n\nlogging.basicConfig(format... | python | chosen |
[
{
"from": "system",
"value": "Remove tmp file after conversion\n"
},
{
"from": "human",
"value": "'''\nHTMLify: Convert any fileformat supported by pandoc to HTML5\n'''\n\nimport pypandoc\n\n\ndef get_html(doc_file):\n '''Uses pypandoc to convert uploaded file to HTML5'''\n\n tmp_loc = '/t... | python | chosen |
[
{
"from": "system",
"value": "Use the libYAML version of yaml if it's available\n"
},
{
"from": "human",
"value": "import os\nimport yaml\nfrom .cassette import Cassette\n\n\ndef load_cassette(cassette_path):\n try:\n pc = yaml.load(open(cassette_path))\n cassette = Cassette(pc)... | python | chosen |
[
{
"from": "system",
"value": "Verify overflow in words array into the learn module\n"
},
{
"from": "human",
"value": "import sys\nimport os\nsys.path.append(os.path.dirname(__file__) + \"/../../\")\n\nfrom state import state\nfrom state.stateEnum import StateEnum\nfrom helpers import configHelpe... | python | chosen |
[
{
"from": "system",
"value": "Make cron job logs readonly for non-superuser\n"
},
{
"from": "human",
"value": "from django.contrib import admin\n\nfrom django_cron.models import CronJobLog\n\n\nclass CronJobLogAdmin(admin.ModelAdmin):\n class Meta:\n model = CronJobLog\n \n search_... | python | chosen |
[
{
"from": "system",
"value": "Add is_encrypted() to abstract methods\n"
},
{
"from": "human",
"value": "import abc\n\n# For 2 and 3 compatibility\n# https://stackoverflow.com/questions/35673474/\nABC = abc.ABCMeta('ABC', (object,), {'__slots__': ()})\n\n\nclass BaseOfficeFile(ABC):\n def __in... | python | chosen |
[
{
"from": "system",
"value": "Increase aruba delay post login\n"
},
{
"from": "human",
"value": "\"\"\"Aruba OS support\"\"\"\nfrom netmiko.cisco_base_connection import CiscoSSHConnection\n\n\nclass ArubaSSH(CiscoSSHConnection):\n \"\"\"Aruba OS support\"\"\"\n def session_preparation(self... | python | chosen |
[
{
"from": "system",
"value": "Extend dr dump to interpret headers for human-readability\n"
},
{
"from": "human",
"value": "\nimport msgpack\nimport pprint\nfrom drcli.api import App\nfrom drcli.appargs import ISTREAM_AP, OSTREAM_AP\n\n\nclass DumpApp(App):\n \"\"\"\n Debug: unpack the stream a... | python | chosen |
[
{
"from": "system",
"value": "Use explicit registration in examples\n"
},
{
"from": "human",
"value": "#!/usr/bin/env python\n\n\"\"\"Directory Watch Example\n\nThis example demonstrates the inotify I/O Component ``Notify`` which can\nbe used for real-time monitoring of file system events. The e... | python | chosen |
[
{
"from": "system",
"value": "Use strings instead of numerals for \"0\" in rules\n"
},
{
"from": "human",
"value": "#!/usr/bin/env Python\n# -*- coding: utf-8 -*-\n\nfrom __future__ import (print_function, unicode_literals, absolute_import)\n\nimport glob\nimport re\nimport io\n\nimport unicodec... | python | chosen |
[
{
"from": "system",
"value": "Clean content types table and don't load tags when running loaddata\n"
},
{
"from": "human",
"value": "from django.apps import AppConfig\nfrom django.conf import settings\nfrom common.helpers.db import db_is_initialized\n\n\nclass CommonConfig(AppConfig):\n name ... | python | chosen |
[
{
"from": "system",
"value": "Use importlib.metadata for version retrieval\n"
},
{
"from": "human",
"value": "import typing as tp\nimport pkg_resources\n\ntry:\n __version__ = pkg_resources.require('python-dispatch-sphinx')[0].version\nexcept: # pragma: no cover\n __version__ = 'unknown'\n... | python | chosen |
[
{
"from": "system",
"value": "Update the version so we can do another release once this is all done.\n"
},
{
"from": "human",
"value": "\"\"\"\nedx-organizations app initialization module\n\"\"\"\n__version__ = '2.0.1' # pragma: no cover\n"
},
{
"from": "gpt",
"value": "\"\"\"\nedx-... | python | chosen |
[
{
"from": "system",
"value": "Add a couple more pieces of info to app config.\n"
},
{
"from": "human",
"value": "# -*- coding: utf-8 -*-\n\n\"\"\"\nPackage containing the main opalescence application logic.\n\"\"\"\n\n__author__ = \"\"\"Brian Houston Morrow\"\"\"\n__email__ = \"bhm@brianmorrow.n... | python | chosen |
[
{
"from": "system",
"value": "Add a reminder to remove Route.interface field\n\nNova never sets the Route.interface value to anything but\nNone which fails with an error:\n\n\"ValueError: Fieldinterface' cannot be None\"\n\nThis looks like a carry-over from the nova.network.model.Route\nclass which has an i... | python | chosen |
[
{
"from": "system",
"value": "Handle cases where memory key is not present\n"
},
{
"from": "human",
"value": "\"\"\"Plugin that adds guest memory usage in GB\"\"\"\nMIN_HOST_MEM = 1000000 # kB\n\n\ndef inject(node):\n \"\"\"Adds guest RAM usage data to the host\"\"\"\n node.setdefault('ki... | python | chosen |
[
{
"from": "system",
"value": "Add difference and up range\n"
},
{
"from": "human",
"value": "import time\nimport HTU21DF\n\n\n\ndef median(x):\n m,r= divmod(len(x),2)\n if r:\n return sorted(x)[m]\n return sum(sorted(x)[m-1:m+1])/2\n\ndef average(x):\n return sum(x)/len(x)\n\n\ntempList =... | python | chosen |
[
{
"from": "system",
"value": "Set fill value of GALAH RA and Dec explicitly\n"
},
{
"from": "human",
"value": "import os, os.path\nimport astropy.io.ascii\nfrom gaia_tools.load import path, download\ndef galah(dr=1):\n filePath, ReadMePath= path.galahPath(dr=dr)\n if not os.path.exists(fil... | python | chosen |
[
{
"from": "system",
"value": "Include id and url in models\n"
},
{
"from": "human",
"value": "from handover_api.models import Handover, Draft, User\nfrom rest_framework import serializers\n\n\nclass HandoverSerializer(serializers.HyperlinkedModelSerializer):\n class Meta:\n model = Han... | python | chosen |
[
{
"from": "system",
"value": "Add test purported to capture the failure, but it still passes.\n"
},
{
"from": "human",
"value": "from ._compat import Protocol\nfrom typing import Any, Dict, Iterator, List, TypeVar, Union\n\n\n_T = TypeVar(\"_T\")\n\n\nclass PackageMetadata(Protocol):\n def __... | python | chosen |
[
{
"from": "system",
"value": "Improve cprint to use __str__ method if available\n"
},
{
"from": "human",
"value": "from __future__ import print_function\n\nimport sys\nimport string\n\nfrom colors import *\n\n\ndef is_posix_filename(name, extra_chars=\"\"):\n CHARS = string.letters + string.d... | python | chosen |
[
{
"from": "system",
"value": "Add time to imported modules.\n"
},
{
"from": "human",
"value": "import capture\nfrom picamera import PiCamera\n\n\ndef image_cap_loop(camera):\n \"\"\"Set image parameters, capture image, set wait time, repeat\"\"\"\n\n images = 18\n status = None\n res... | python | chosen |
[
{
"from": "system",
"value": "Use the standard scenario for demo data\n"
},
{
"from": "human",
"value": "from django.core.management.base import BaseCommand\n\nfrom login.tests.model_maker import make_superuser\nfrom login.tests.model_maker import make_user\n\n\nclass Command(BaseCommand):\n\n ... | python | chosen |
[
{
"from": "system",
"value": "Add timezone to example to keep Broker happy.\n"
},
{
"from": "human",
"value": "from metadatastore.mds import MDSRO\nfrom portable_mds.mongoquery.mds import MDS\n\n\nsource_config = {'host': 'localhost',\n 'port': 27017,\n 'database'... | python | chosen |
[
{
"from": "system",
"value": "Add convenience method on test case.\n"
},
{
"from": "human",
"value": "\"\"\"Base stuff for testing.\n\"\"\"\n\nimport subprocess\nassert not 'twill' in subprocess.__file__\n\nfrom flask.ext.testing import TestCase\n\nfrom abilian.application import Application\nfr... | python | chosen |
[
{
"from": "system",
"value": "Add end date to the config.\n"
},
{
"from": "human",
"value": "# The secret key is used for signing the session and creating the csrf hmacs\nSECRET_KEY = \"gocu5eYoosh8oocoozeeG9queeghae7ushahp9ufaighoo5gex1vulaexohtepha\"\n\n# this is the dbapi connection string fo... | python | chosen |
[
{
"from": "system",
"value": "Revert \"oups this the 17.6 version\"\n\nThis reverts commit bb71bc841f7422333324b95c988ba0677779304d.\n"
},
{
"from": "human",
"value": "# -*- coding: utf-8 -\n#\n# This file is part of gunicorn released under the MIT license.\n# See the NOTICE for more information... | python | chosen |
[
{
"from": "system",
"value": "Move the Akanda Networking panel in the new Manage Network section\n\nIn the Grizzly version of Horizon the navigation tree on the left\nis been split in two section, this fix move the Akanda Networking\npanel from the Manage Compute sections to the newly created\nManage Networ... | python | chosen |
[
{
"from": "system",
"value": "Remove decode from block branches check\n\nIt’s now done by `bash()`.\n"
},
{
"from": "human",
"value": "# # # # # # # # # # # # # #\n# CAPTAINHOOK IDENTIFIER #\n# # # # # # # # # # # # # #\nimport argparse\n\nfrom .utils import bash\n\nCHECK_NAME = 'block_branch'\... | python | chosen |
[
{
"from": "system",
"value": "Support game engines with numbers in name.\n"
},
{
"from": "human",
"value": "from django.conf.urls import url\nfrom . import views\n\nurlpatterns = [\n url(r'^$', views.front_page, name='front_page'),\n url(r'^engine/(?P<name>[ a-zA-Z]+)/$', views.engine_play... | python | chosen |
[
{
"from": "system",
"value": "Make bash setup script actually work\n\nFixes call to exec and labels PS1 work as non working (over-ridden by\nbashrc).\n"
},
{
"from": "human",
"value": "#! /usr/bin/env python\n\n# Author: Joseph Lisee <jlisee@gmail.com>\n\nimport os\nimport sys\n\n# Get the curre... | python | chosen |
[
{
"from": "system",
"value": "Remove the admin url mapping\n"
},
{
"from": "human",
"value": "# -*- coding: utf-8 -*-\n#\n# (c) 2014 Bjoern Ricks <bjoern.ricks@gmail.com>\n#\n# See LICENSE comming with the source of 'trex' for details.\n#\n\nfrom django.conf.urls import patterns, include, url\nf... | python | chosen |
[
{
"from": "system",
"value": "Fix failing test and refact to TestCase."
},
{
"from": "human",
"value": "\"\"\"\ntest_meta:\n==========\n\nA module intended for use with Nose.\n\n\"\"\"\n\nfrom nose.tools import raises\nfrom nose import with_setup\n\nimport random\nimport string\nimport requests\... | python | chosen |
[
{
"from": "system",
"value": "Add code to create needed uno services\n"
},
{
"from": "human",
"value": "\"\"\"\nExample usage of UNO, graphic objects and networking in LO extension\n\"\"\"\n\nimport unohelper\nfrom com.sun.star.task import XJobExecutor\n\nclass ImageExample(unohelper.Base, XJobE... | python | chosen |
[
{
"from": "system",
"value": "Fix a typo on error message\n"
},
{
"from": "human",
"value": "import requests\nimport os\nfrom .endpoints import *\n\n\nclass UnauthorizedToken(Exception):\n pass\n\n\nclass ReviewsAPI:\n\n def __init__(self):\n token = os.environ['UDACITY_AUTH_TOKEN']... | python | chosen |
[
{
"from": "system",
"value": "Split tests for different functionality\n"
},
{
"from": "human",
"value": "import pytest\nimport textwrap\n\n\n@pytest.fixture\ndef warnings_demo(tmpdir):\n demo = tmpdir.joinpath('warnings_demo.py')\n demo.write_text(textwrap.dedent('''\n from logging ... | python | chosen |
[
{
"from": "system",
"value": "Change from array to dictionary for general insight calculators\n"
},
{
"from": "human",
"value": "\nfrom functools import reduce\nfrom ..models import User, Text, Insight, Comment, GeneralInsight\n\nclass general_insight_calculator:\n name = None\n calc = lam... | python | chosen |
[
{
"from": "system",
"value": "Remove superfluous parens; catch timeout\n"
},
{
"from": "human",
"value": "#!/usr/bin/env python\n\"\"\"Collection of module netural utility functions\"\"\"\n\nfrom sys import stderr\nfrom ssl import SSLError\ntry:\n from urllib.request import urlopen, HTTPError... | python | chosen |
[
{
"from": "system",
"value": "Add dependency check test for CEM\n"
},
{
"from": "human",
"value": "#! /usr/bin/python\n\nfrom check_dependencies import CheckDependencies\n\ndef test_default():\n CheckDependencies(None)\n\ndef test_hydrotrend():\n CheckDependencies(\"hydrotrend\")\n"
},
... | python | chosen |
[
{
"from": "system",
"value": "Exclude secondary cython outputs from pyi spec\n"
},
{
"from": "human",
"value": "\"\"\"\n hook-mcedit2.py\n Hook for pyinstaller to collect MCEdit's data files\n\"\"\"\nfrom __future__ import absolute_import, division, print_function#, unicode_literals\nimpor... | python | chosen |
[
{
"from": "system",
"value": "Remove false assertion from test\n"
},
{
"from": "human",
"value": "from tests import PMGLiveServerTestCase\nfrom tests.fixtures import dbfixture, CallForCommentData\nimport urllib.request, urllib.error, urllib.parse\n\n\nclass TestCallsForCommentsPage(PMGLiveServer... | python | chosen |
[
{
"from": "system",
"value": "Test for DB_URL being present in environment.\n"
},
{
"from": "human",
"value": "import os\n\nfrom sqlalchemy.ext.automap import automap_base\nfrom sqlalchemy.orm import sessionmaker\nfrom sqlalchemy import create_engine\nfrom sqlalchemy.orm.scoping import scoped_se... | python | chosen |
[
{
"from": "system",
"value": "Make sure that only zero amount orders are modified.\n\nNote really necessary, since we don't have real bank orders,\nbut better safe than sorry.\n"
},
{
"from": "human",
"value": "# -*- coding: UTF-8 -*-\n\nfrom __future__ import print_function\nfrom django.core.ma... | python | chosen |
[
{
"from": "system",
"value": "Fix comment bug caught by latest black\n\nThere were four open quotes instead of the intended three.\n"
},
{
"from": "human",
"value": "\"\"\"Custom exceptions.\"\"\"\n\n__all__ = [\n \"ValidationError\",\n \"Route53Error\",\n \"S3Error\",\n \"FastlyErro... | python | chosen |
[
{
"from": "system",
"value": "Make database preseeding sensitive to custom build options.\n"
},
{
"from": "human",
"value": "import os\nimport shutil\nimport tempfile\n\ntemphome = tempfile.mkdtemp()\nos.environ[\"KOLIBRI_HOME\"] = temphome\n\nfrom kolibri.main import initialize # noqa E402\nfr... | python | chosen |
[
{
"from": "system",
"value": "Bump version number for Python 3.2-matching release\n"
},
{
"from": "human",
"value": "#!/usr/bin/env python\n\nfrom distutils.core import setup\n\nsetup(name='futures',\n version='1.0',\n description='Java-style futures implementation in Python 2.x',\n ... | python | chosen |
[
{
"from": "system",
"value": "Allow constraint getter to take parameter dict\n"
},
{
"from": "human",
"value": "from __future__ import absolute_import\nimport theano\nimport theano.tensor as T\nimport numpy as np\n\nclass Constraint(object):\n def __call__(self, p):\n return p\n\n d... | python | chosen |
[
{
"from": "system",
"value": "Remove code that depends on a current model state.\n"
},
{
"from": "human",
"value": "# -*- coding: utf-8 -*-\nimport datetime\nfrom south.db import db\nfrom south.v2 import DataMigration\nfrom django.db import models\n\nclass Migration(DataMigration):\n\n def fo... | python | chosen |
[
{
"from": "system",
"value": "Add support for new slot types\n"
},
{
"from": "human",
"value": "'''These are the only serializer fields support by the Alexa skills kit'''\nfrom rest_framework.serializers import CharField, IntegerField, DateField, TimeField, DurationField, ChoiceField # flake8: n... | python | chosen |
[
{
"from": "system",
"value": "Add a missing test description\n"
},
{
"from": "human",
"value": "from django.core.exceptions import ValidationError\nfrom django.test import TestCase\nimport djohno\nfrom djohno.utils import (\n is_pretty_from_address,\n get_app_versions\n)\n\n\nclass DjohnoU... | python | chosen |
[
{
"from": "system",
"value": "Add db() to initialize a table and drop when finished\n"
},
{
"from": "human",
"value": "# -*- coding: utf-8 -*-\nfrom contextlib import closing\nimport pytest\n\nfrom journal import app\nfrom journal import connect_db\nfrom journal import get_database_connection\nf... | python | chosen |
[
{
"from": "system",
"value": "Edit the parameters. Not fix yet\n"
},
{
"from": "human",
"value": "from random import choice\nfrom pygraphc.evaluation.InternalEvaluation import InternalEvaluation\n\n\nclass SimulatedAnnealing(object):\n def __init__(self, method, tmin, tmax, parameter, energy_... | python | chosen |
[
{
"from": "system",
"value": "Add python3 support to stop Steve whinging\n"
},
{
"from": "human",
"value": "#!/usr/bin/env python2\nfrom SimpleHTTPServer import SimpleHTTPRequestHandler\nimport BaseHTTPServer\n\nclass CORSRequestHandler( SimpleHTTPRequestHandler ):\n def end_headers( self ):\... | python | chosen |
[
{
"from": "system",
"value": "Add provider information to App\n"
},
{
"from": "human",
"value": "from __future__ import absolute_import\n\nfrom ds.models import App\n\nfrom .base import Serializer\nfrom .manager import add\n\n\n@add(App)\nclass AppSerializer(Serializer):\n def serialize(self,... | python | chosen |
[
{
"from": "system",
"value": "Use raw strings for regexes.\n"
},
{
"from": "human",
"value": "import re\n\nclass Phage:\n supported_databases = {\n # European Nucleotide Archive phage database\n \"ENA\": \"^gi\\|[0-9]+\\|ref\\|([^\\|]+)\\|\\ ([^,]+)[^$]*$\",\n\n # National Center for B... | python | chosen |
[
{
"from": "system",
"value": "Allow empty commit messages if explictly specified.\n"
},
{
"from": "human",
"value": "from types import SimpleNamespace\n\n\nclass ChangeTemplate(SimpleNamespace):\n # orig_hash\n do_commit = True\n msg = None\n datetime = None\n author = None\n\n\nc... | python | chosen |
[
{
"from": "system",
"value": "Simplify the first migration, we will do execute statements later\n"
},
{
"from": "human",
"value": "\"\"\"\n\nRevision ID: 0313_email_access_validated_at\nRevises: 0312_populate_returned_letters\nCreate Date: 2020-01-28 18:03:22.237386\n\n\"\"\"\nfrom alembic impor... | python | chosen |
[
{
"from": "system",
"value": "Use spaces instead of tabs\n"
},
{
"from": "human",
"value": "\"\"\"\nCopyright [2009-2014] EMBL-European Bioinformatics Institute\nLicensed under the Apache License, Version 2.0 (the \"License\");\nyou may not use this file except in compliance with the License.\nY... | python | chosen |
[
{
"from": "system",
"value": "Convert place to integer, for list index"
},
{
"from": "human",
"value": "def median(numbers):\n \"\"\"Return the median of a list of numbers.\"\"\"\n length = len(numbers)\n numbers.sort()\n \n if length % 2 == 0:\n place = length / 2\n ... | python | chosen |
[
{
"from": "system",
"value": "Set the bar low on staging\n"
},
{
"from": "human",
"value": "from .base import *\nimport os\n\nSECRET_KEY = os.environ['SECRET_KEY']\n\nDEBUG = True\n\nLOG_DIRECTORY = '/home/wgbh/logs'\n\nSTATIC_ROOT = '/home/wgbh/webroot/static'\n\nALLOWED_HOSTS = [\n 'mlagame... | python | chosen |
[
{
"from": "system",
"value": "Allow data property to not be use\n"
},
{
"from": "human",
"value": "\nfrom astropy.io import fits\nimport numpy as np\n\nfrom ..io import input_data\n\n\nclass BaseStatisticMixIn(object):\n \"\"\"\n Common properties to all statistics\n \"\"\"\n\n # Dis... | python | chosen |
[
{
"from": "human",
"value": "Add meta info in oauthlib module\n"
},
{
"from": "gpt",
"value": "\"\"\"\n oauthlib\n ~~~~~~~~\n\n A generic, spec-compliant, thorough implementation of the OAuth\n request-signing logic.\n\n :copyright: (c) 2011 by Idan Gazit.\n :license: BSD, see ... | python | chosen |
[
{
"from": "system",
"value": "Fix Json error for Python3 compatibility\n"
},
{
"from": "human",
"value": "#!/usr/bin/env python\n# -*- coding: utf-8 -*-\n\nimport pprint\nimport json\n\nclass View(object):\n\n def service_list(self, service_list):\n print('service LIST:')\n for ... | python | chosen |
[
{
"from": "system",
"value": "Fix typo from making Ignores.read an instance method\n"
},
{
"from": "human",
"value": "import os\nfrom fnmatch import fnmatchcase\nimport click\n\n\nclass Ignores(object):\n def __init__(self, default_patterns=[]):\n self.patterns = default_patterns\n\n ... | python | chosen |
[
{
"from": "system",
"value": "Tweak ConfigContext manager to allow for objects with a regionless site\n"
},
{
"from": "human",
"value": "from __future__ import unicode_literals\n\nfrom django.db.models import Q, QuerySet\n\n\nclass ConfigContextQuerySet(QuerySet):\n\n def get_for_object(self,... | python | chosen |
[
{
"from": "system",
"value": "Fix broken ConfigParser import for Python3\n"
},
{
"from": "human",
"value": "\"\"\"EditorConfig exception classes\n\nLicensed under PSF License (see LICENSE.txt file).\n\n\"\"\"\n\n\nclass EditorConfigError(Exception):\n \"\"\"Parent class of all exceptions rais... | python | chosen |
[
{
"from": "system",
"value": "Resolve circular reference during import\n"
},
{
"from": "human",
"value": "import algebra\nimport boolean\n\nclass Rule:\n \"\"\"\nArgument is an expression tree\nReturns a possibly modified expression tree\n\"\"\"\n def __call__(self, expr):\n return self.fir... | python | chosen |
[
{
"from": "system",
"value": "Add import and constant in adapter\n"
},
{
"from": "human",
"value": "# -*- coding: utf-8 -*-\nfrom openprocurement.tender.core.adapters import TenderConfigurator\nfrom openprocurement.tender.limited.models import (\n ReportingTender, NegotiationTender, Negotiati... | python | chosen |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.