conversations listlengths 2 3 | source stringclasses 1
value | stack stringclasses 1
value |
|---|---|---|
[
{
"from": "system",
"value": "Fix bug where n is the square of a prime\n"
},
{
"from": "human",
"value": "def sieve(n):\n if n < 2:\n return []\n not_prime = set()\n prime = [2]\n for i in range(3, n+1, 2):\n if i not in not_prime:\n prime.append(i)\n ... | python | chosen |
[
{
"from": "system",
"value": "Improve message posted to slack\n"
},
{
"from": "human",
"value": "#!/usr/bin/env python\nimport pika\nimport json\nimport requests\nimport os\n\nRABBIT_MQ_SERVER = os.environ[\"RABBIT_MQ_SERVER\"]\nRABBIT_MQ_USER = os.environ[\"RABBIT_MQ_USER\"]\nRABBIT_MQ_PWD = os... | python | chosen |
[
{
"from": "system",
"value": "Enh: Declare the is_in_defined_group function, even if it is an alias of the is_in_group\n"
},
{
"from": "human",
"value": "from opsbro.evaluater import export_evaluater_function\nfrom opsbro.gossip import gossiper\n\nFUNCTION_GROUP = 'gossip'\n\n\n@export_evaluater... | python | chosen |
[
{
"from": "system",
"value": "Handle the case where OSError is not because file does not exist\n"
},
{
"from": "human",
"value": "# Copyright 2015 Amazon.com, Inc. or its affiliates. All Rights Reserved.\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\"). You\n# may not use t... | python | chosen |
[
{
"from": "system",
"value": "Handle sigterm as well as sigint.\n"
},
{
"from": "human",
"value": "import signal\nimport sys\nfrom threading import Event\n\ndef GetInterruptEvent():\n e = Event()\n\n def signal_handler(signal, frame):\n print('You pressed Ctrl+C!')\n e.set()\... | python | chosen |
[
{
"from": "system",
"value": "Split delay configuration into default_delay and specific_delays"
},
{
"from": "human",
"value": "\r\nimport threading\r\nimport collections\r\nimport itertools\r\nimport time\r\n\r\nimport zephyr\r\n\r\nclass DelayedRealTimeStream(threading.Thread):\r\n def __in... | python | chosen |
[
{
"from": "system",
"value": "Add a test for izip\n\nMake sure that it generates an iterator on both Python 2 and Python 3.\nAlso check that it can be converted to a `list`.\n"
},
{
"from": "human",
"value": "#!/usr/bin/env python\n# -*- coding: utf-8 -*-\n\n\nfrom __future__ import absolute_imp... | python | chosen |
[
{
"from": "system",
"value": "Add command to send messages via GCM\n"
},
{
"from": "human",
"value": "import json\nimport requests\nfrom Suchary.local_settings import GCM_API_KEY\nfrom api.models import Device\n\nURL = 'https://android.googleapis.com/gcm/send'\nHEADER = {'Authorization': 'key=' ... | python | chosen |
[
{
"from": "system",
"value": "Drop use of namespaced oslo.i18n\n\nRelated-blueprint: drop-namespace-packages\n\nChange-Id: Ic8247cb896ba6337932d7a74618debd698584fa0\n"
},
{
"from": "human",
"value": "# Copyright 2014 Mirantis Inc.\n#\n# All Rights Reserved.\n#\n# Licensed under the Apache Lic... | python | chosen |
[
{
"from": "system",
"value": "Clear db if not empty\n"
},
{
"from": "human",
"value": "\"\"\"\nCommon set of functionality for picoAPI testing.\nFixtures defined within this file are available to all\nother testing modules.\n\"\"\"\n\nimport pytest\nimport api.common\nfrom pymongo import MongoCl... | python | chosen |
[
{
"from": "system",
"value": "Allow team num players column to be ordered\n"
},
{
"from": "human",
"value": "from django.contrib import admin\n\nfrom .models import Team\nfrom nucleus.admin import TeamMemberInline\n\n\nclass TeamAdmin(admin.ModelAdmin):\n inlines = (TeamMemberInline, )\n r... | python | chosen |
[
{
"from": "system",
"value": "Fix Command compatibility with Django>= 1.8\n"
},
{
"from": "human",
"value": "from django.core.management.base import BaseCommand\n\nfrom dynamic_fixtures.fixtures.runner import LoadFixtureRunner\n\n\nclass Command(BaseCommand):\n\n help_text = 'Load fixtures wh... | python | chosen |
[
{
"from": "system",
"value": "Rename User model to AppUser\n"
},
{
"from": "human",
"value": "from datetime import datetime, timedelta\n\nfrom app import db, bcrypt\nfrom app.utils.misc import make_code\n\n\ndef expiration_date():\n return datetime.now() + timedelta(days=1)\n\n\nclass User(db... | python | chosen |
[
{
"from": "system",
"value": "Fix that Jinja2 templating is initiated when not needed\n"
},
{
"from": "human",
"value": "import os.path as path\n\nimport jinja2\n\nimport helpers\n\n\nlogger = helpers.get_logger(__name__)\n\n\nconf = helpers.get_conf()\n\n\ndef jinja2_templating(context):\n p... | python | chosen |
[
{
"from": "system",
"value": "Add identifier property to mixin.\n"
},
{
"from": "human",
"value": "# -*- coding: utf-8 -*-\nfrom .models import Translation\nfrom .utils import get_cache_key\n\n\nclass LinguistMixin(object):\n\n def clear_translations_cache(self):\n self._linguist.clear... | python | chosen |
[
{
"from": "system",
"value": "Fix problem where Provider DoesNotExist.\n\n* Occurs on provider and providerlist endpoints.\n* Came to attention as a side effect of fixing ATMO-176.\n* Similar changes need to be made all over atmosphere. I'll\n create a ticket.\n\n\tmodified: api/provider.py\n"
},
{
... | python | chosen |
[
{
"from": "system",
"value": "Check the length of the screencap before indexing into it\n"
},
{
"from": "human",
"value": "import logging\nimport re\nimport time\n\n\nclass TransportAsync:\n async def transport(self, connection):\n cmd = \"host:transport:{}\".format(self.serial)\n ... | python | chosen |
[
{
"from": "system",
"value": "Disable GAE mini profiler by default\n"
},
{
"from": "human",
"value": "import logging\n\ndef appstats_should_record(env):\n from gae_mini_profiler.config import should_profile\n if should_profile():\n return True\n\ndef gae_mini_profiler_should_profile_produ... | python | chosen |
[
{
"from": "system",
"value": "Replace string \"view\" argument to url() function with callable.\n\nSupport for string \"view\" arguments to url() function no longer available starting with Django 1.10.\n\nCf. https://docs.djangoproject.com/en/2.1/releases/1.10/#features-removed-in-1-10\n"
},
{
"from... | python | chosen |
[
{
"from": "system",
"value": "Change output format of python load tester.\n"
},
{
"from": "human",
"value": "import time\n\nfrom all_spark_cube_client import CubeClient\nfrom colors import *\n\nHOST='cube.ac'\nPORT=12345\n\n\ndef main():\n buffer = [orange for x in range(4096)]\n client = ... | python | chosen |
[
{
"from": "system",
"value": "Add index to the message_id column\n"
},
{
"from": "human",
"value": "import sqlite3\n\ndef init(conn):\n c = conn.cursor()\n c.execute(\n '''CREATE TABLE IF NOT EXISTS email_log (\n `id` INTEGER PRIMARY KEY AUTOINCREMENT,\n `timestamp` TIMESTAM... | python | chosen |
[
{
"from": "system",
"value": "Test that various exceptions are correctly converted\n"
},
{
"from": "human",
"value": "#!/usr/bin/python\n# -*- coding: utf-8 -*-\n\"\"\"\nUnit tests for pyes. These require an es server with thrift plugin running on the default port (localhost:9500).\n\"\"\"\nimp... | python | chosen |
[
{
"from": "system",
"value": "Fix a bug in the mesh optimizer.\n"
},
{
"from": "human",
"value": "# -*- coding: utf-8 -*-\n\nimport re\nimport uuid\nimport itertools as it\n\nfrom abc import ABCMeta, abstractmethod\n\nimport numpy as np\n\n\nclass BaseReader(object):\n __metaclass__ = ABCMeta... | python | chosen |
[
{
"from": "system",
"value": "Raise error if no match.\n"
},
{
"from": "human",
"value": "\"\"\"Pipeline utility functions.\"\"\"\n\nimport re\n\n_SSS_REGEX = '(\\w+\\d{2})/(session\\d{2})/(series\\d{3})'\n\"\"\"The subject/session/series regexp pattern.\"\"\"\n\ndef match_session_hierarchy(path... | python | chosen |
[
{
"from": "system",
"value": "Add daystate_dict function to serialize daystates to dictionaries\n"
},
{
"from": "human",
"value": "# Copyright (c) 2016 Luke San Antonio Bialecki\n# All rights reserved.\n\nfrom functools import wraps\nfrom flask_jwt_extended import utils\nfrom flask_jwt_extended.... | python | chosen |
[
{
"from": "system",
"value": "Make autoscaler run every 5 minutes.\n"
},
{
"from": "human",
"value": "import logging\nfrom celery import Celery\nfrom celery.schedules import crontab\nfrom celery.task import periodic_task\nfrom celery.utils.log import get_task_logger\n\nfrom autoscaler.autoscaler... | python | chosen |
[
{
"from": "system",
"value": "Add proper authentication for db (without actual key).\n"
},
{
"from": "human",
"value": "# [START app]\nimport logging\n\nfrom firebase import firebase\nfrom flask import Flask, jsonify, request\nimport flask_cors\nfrom google.appengine.ext import ndb\nimport googl... | python | chosen |
[
{
"from": "system",
"value": "Fix 'ModuleNotFoundError: No module named amplpython'\n"
},
{
"from": "human",
"value": "# -*- coding: utf-8 -*-\nfrom __future__ import absolute_import\n\nimport os\nimport ctypes\nimport platform\n\nif platform.system() == 'Windows':\n lib32 = os.path.join(os.p... | python | chosen |
[
{
"from": "system",
"value": "Fix url shortening for small domains\n"
},
{
"from": "human",
"value": "import os\nimport time\nimport json\nimport requests\n\n\ndef get_timezone(lat, long):\n response = requests.get('https://maps.googleapis.com/maps/api/timezone/json', params={\n 'locat... | python | chosen |
[
{
"from": "system",
"value": "Fix a broken export test\n\n\nFormer-commit-id: fea471180d544a95f3d0adf87a7a46f51c067324 [formerly 4b369edfcb5782a2461742547f5b6af3bab4f759] [formerly 4b369edfcb5782a2461742547f5b6af3bab4f759 [formerly e37e964bf9d2819c0234303d31ed2839c317be04]]\nFormer-commit-id: 5b8a20fa99eab2... | python | chosen |
[
{
"from": "system",
"value": "Install pygettext (once the scriptsinstall target is working again).\n"
},
{
"from": "human",
"value": "from distutils.core import setup\n\nif __name__ == '__main__':\n setup(\n scripts=[\n 'byteyears.py',\n 'checkpyc.py',\n 'copytime.py... | python | chosen |
[
{
"from": "system",
"value": "Use a separate lock per ivorn database\n"
},
{
"from": "human",
"value": "# VOEvent receiver.\n# John Swinbank, <swinbank@transientskp.org>, 2011-12.\n\n# Python standard library\nimport os\nimport anydbm\nimport datetime\nfrom contextlib import closing\nfrom thread... | python | chosen |
[
{
"from": "system",
"value": "Fix django 1.9 warning and drop support django < 1.7\n\nFixes a warning that happens when running with Django 1.9:\nRemovedInDjango110Warning: django.conf.urls.patterns() is deprecated and will be removed in Django 1.10. Update your urlpatterns to be a list of django.conf.urls.... | python | chosen |
[
{
"from": "system",
"value": "Add Searchable Mixin for API\n"
},
{
"from": "human",
"value": "# -*- coding: utf-8 -*-\n# This file is part of Shuup.\n#\n# Copyright (c) 2012-2017, Shoop Commerce Ltd. All rights reserved.\n#\n# This source code is licensed under the OSL-3.0 license found in the\n... | python | chosen |
[
{
"from": "system",
"value": "Fix halton sequence generator for Python 3\n"
},
{
"from": "human",
"value": "from itertools import islice\nimport unittest\nfrom shapely.geometry import Point\nfrom shapely.ops import unary_union\n\ndef halton(base):\n \"\"\"Returns an iterator over an infinite ... | python | chosen |
[
{
"from": "system",
"value": "Add spaces to increase readability.\n\n\"OSF-4419\"\n"
},
{
"from": "human",
"value": "\nfrom rest_framework import status\nfrom rest_framework.exceptions import APIException\n\n\ndef json_api_exception_handler(exc, context):\n \"\"\" Custom exception handler tha... | python | chosen |
[
{
"from": "system",
"value": "Allow confrontations to be passed to ilamb-run\n"
},
{
"from": "human",
"value": "\"\"\"Reads and parses a configuration file for the ILAMB BMI.\"\"\"\n\nfrom os.path import join\nimport yaml\n\n\nilamb_root_key = 'ilamb_root'\nmodel_root_key = 'model_root'\nmodels_... | python | chosen |
[
{
"from": "system",
"value": "Revert \"Added solutions for lesson 4\"\n\nThis reverts commit 58d049c78b16ec5b61f9681b605dc4e937ea7e3e.\n"
},
{
"from": "human",
"value": "import datetime\nimport math\n\nfrom core import test_helper\n\n\n# Question 1\n# ----------\n# Using the datetime module retu... | python | chosen |
[
{
"from": "system",
"value": "Update license_name to point to AGPLv3+\n"
},
{
"from": "human",
"value": "# Shared project info\n\nname = 'telegram-bot-framework'\n\ndescription = 'Python Telegram bot API framework'\n\nsource_url = 'https://github.com/alvarogzp/telegram-bot-framework'\n\nauthor_n... | python | chosen |
[
{
"from": "system",
"value": "Fix division by zero error when calculating tax rate on migration.\n"
},
{
"from": "human",
"value": "# Generated by Django 3.1.6 on 2021-02-20 15:24\n\nfrom django.db import migrations\nfrom django.db.models import F\n\n\ndef calculate_taxrate(apps, schema_editor):... | python | chosen |
[
{
"from": "system",
"value": "Fix code style issues with Black\n"
},
{
"from": "human",
"value": "# -*- coding: utf-8 -*-\nimport os\n\nfrom scout.demo import cnv_report_path\nfrom scout.commands import cli\n\n\ndef test_load_cnv_report(mock_app, case_obj):\n \"\"\"Testing the load delivery r... | python | chosen |
[
{
"from": "system",
"value": "Ch03: Add options to Post model fields. [skip ci]\n"
},
{
"from": "human",
"value": "from django.db import models\n\nfrom organizer.models import Startup, Tag\n\n\n# Model Field Reference\n# https://docs.djangoproject.com/en/1.8/ref/models/fields/\n\n\nclass Post(mo... | python | chosen |
[
{
"from": "system",
"value": "Raise configuration error if django.contrib.contenttypes comes after djangae.contrib.contenttypes\n"
},
{
"from": "human",
"value": "from django.apps import AppConfig\nfrom django.utils.translation import ugettext_lazy as _\nfrom django.core.exceptions import Improp... | python | chosen |
[
{
"from": "system",
"value": "Make get_app_models only import models from the specified module, and not imported ones\n"
},
{
"from": "human",
"value": "import importlib\n\n\ndef resolve_func(func_string):\n module_name, func_name = func_string.rsplit(\".\", 1)\n module = importlib.import_... | python | chosen |
[
{
"from": "system",
"value": "Handle buffering and Python 3 \"yield from\" optimization.\n"
},
{
"from": "human",
"value": "# encoding: utf-8\n\nfrom ..util import pypy, ensure_buffer\n\nPREFIX = '_buffer.extend(' if pypy else '__w(' \n\n\nclass Use(object):\n\t\"\"\"Consume the result of callin... | python | chosen |
[
{
"from": "system",
"value": "Add test, which fails, of the gammatone filtering.\n"
},
{
"from": "human",
"value": "from __future__ import division, print_function\nimport pytest\nimport numpy as np\nfrom pambox import auditory as aud\nimport scipy.io as sio\nfrom numpy.testing import assert_all... | python | chosen |
[
{
"from": "system",
"value": "Fix critical stupid copypaste error\n"
},
{
"from": "human",
"value": "from django.db import models\nfrom django.core.exceptions import ValidationError\n\n\nclass OrderedModel(models.Model):\n order = models.PositiveIntegerField(blank=True, unique=True)\n\n class ... | python | chosen |
[
{
"from": "system",
"value": "Update 11_condor_cron to use OkSkip functionality\n\ngit-svn-id: 884a03e47e2adb735d896e55bb5ad6bc3421ba19@16523 4e558342-562e-0410-864c-e07659590f8c\n"
},
{
"from": "human",
"value": "import os\nimport osgtest.library.core as core\nimport unittest\n\nclass TestStart... | python | chosen |
[
{
"from": "system",
"value": "Fix py/capnp build for python 3.7\n"
},
{
"from": "human",
"value": "from setuptools import setup\nfrom setuptools.extension import Extension\n\nimport buildtools\n\n\n# You might also need to set PKG_CONFIG_PATH=/path/to/lib/pkgconfig if\n# your capnp is installed ... | python | chosen |
[
{
"from": "system",
"value": "Document finder tests better and use better terminology (the thing that\ncollects found objects isn't a finder, it's a collector)\n"
},
{
"from": "human",
"value": "import unittest\n\nfrom testdoc.finder import find_tests\n\n\nclass MockFinder(object):\n def __in... | python | chosen |
[
{
"from": "system",
"value": "Add test configuration vars: STOMP_HOST + STOMP_PORT\n"
},
{
"from": "human",
"value": "import os\n\nfrom carrot.connection import BrokerConnection\n\n\nAMQP_HOST = os.environ.get('AMQP_HOST', \"localhost\")\nAMQP_PORT = os.environ.get('AMQP_PORT', 5672)\nAMQP_VHOST... | python | chosen |
[
{
"from": "system",
"value": "Use string as node title instead of wikicode"
},
{
"from": "human",
"value": "from artgraph.plugins.plugin import Plugin\n\nclass InfoboxPlugin(Plugin):\n def __init__(self, node):\n self._node = node\n \n def get_nodes(self):\n from artgr... | python | chosen |
[
{
"from": "system",
"value": "Add id parameter to URL\n"
},
{
"from": "human",
"value": "from django.conf.urls import url\n\nfrom . import views\n\nurlpatterns = [\n url(r'^$', views.index, name='index'),\n url(r'^location$',views.location, name='location'),\n]\n"
},
{
"from": "gpt... | python | chosen |
[
{
"from": "system",
"value": "Remove shell requirement to avoid escaping\n"
},
{
"from": "human",
"value": "import sublime_plugin\n\nfrom ..libs.global_vars import *\nfrom ..libs import cli\n\n\nclass TypescriptBuildCommand(sublime_plugin.WindowCommand):\n def run(self):\n if get_node_... | python | chosen |
[
{
"from": "system",
"value": "Make interface name optional and remove unicode prefixes\n\n"
},
{
"from": "human",
"value": "from wtforms.validators import DataRequired, Optional\n\nfrom web.blueprints.facilities.forms import SelectRoomForm\nfrom web.form.fields.core import TextField, QuerySelect... | python | chosen |
[
{
"from": "system",
"value": "Put Flask in debug mode\n"
},
{
"from": "human",
"value": "from flask import Flask\nimport experiments\nimport db\n\napp = Flask(__name__)\n\nsession = db.init_db(drop_all=True)\n\n\n@app.route('/')\ndef index():\n return 'Index page'\n\n\n@app.route('/demo2')\nd... | python | chosen |
[
{
"from": "system",
"value": "Break a test to see if Travis picks it up\n"
},
{
"from": "human",
"value": "import steel\nimport unittest\n\n\nclass BytesTests(unittest.TestCase):\n def test_encode(self):\n field = steel.Bytes(size=3)\n self.assertEqual(field.encode(b'abc'), b'ab... | python | chosen |
[
{
"from": "system",
"value": "Revert \"corrected database settings merge again\"\n\nThis reverts commit 8d04d1c731aaed33c586993002f5e713c3fa1408.\n"
},
{
"from": "human",
"value": "from yacs.settings.base import settings\n\n__all__ = ['settings']\n\nwith settings as s:\n s.DEBUG = True\n\n ... | python | chosen |
[
{
"from": "system",
"value": "Remove prin on save_model PublishableAdmin\n"
},
{
"from": "human",
"value": "#!/usr/bin/env python\n# -*- coding: utf-8 -*-\nfrom django.contrib import admin\nfrom django.utils import timezone\nfrom django.conf import settings\nfrom django.contrib.sites.models impo... | python | chosen |
[
{
"from": "system",
"value": "Add new module, get template path\nreturn absolut file path\n"
},
{
"from": "human",
"value": "# coding: utf-8\n\nfrom django.db.models import get_models, get_app\n\n\ndef get_app_model(appname, suffix=\"\"):\n app_label = appname.split('.')[-1]\n models = [mo... | python | chosen |
[
{
"from": "system",
"value": "Add basic auth create and parse utils.\n"
},
{
"from": "human",
"value": "# Author: Braedy Kuzma\nfrom rest_framework import authentication\nfrom rest_framework import exceptions\nfrom ipware.ip import get_ip\n\nfrom .models import RemoteNode\n\nclass nodeToNodeBasi... | python | chosen |
[
{
"from": "system",
"value": "Test of optimized output functions runs automatically.\n\n"
},
{
"from": "human",
"value": "\"\"\"\nUnit tests for Topographica\n\n$Id$\n\"\"\"\n__version__='$Revision$'\n\n### JABALERT!\n###\n### Should change this to be like topo/patterns/__init__.py, i.e.\n### to... | python | chosen |
[
{
"from": "system",
"value": "Use a relative import to get the read module\n"
},
{
"from": "human",
"value": "#! /usr/bin/env python\n#\n# Dakota utility programs for converting output.\n#\n# Mark Piper (mark.piper@colorado.edu)\n\nimport shutil\nfrom subprocess import check_call, CalledProcessE... | python | chosen |
[
{
"from": "system",
"value": "Add slash after email detail url for ADD_SLASHES https fail\n"
},
{
"from": "human",
"value": "from django.conf.urls import patterns, include, url\nfrom django.contrib import admin\n\n\nurlpatterns = patterns('',\n url(r'^$', 'contactmps.views.home', name='home')... | python | chosen |
[
{
"from": "system",
"value": "Rebase most recent alembic change onto HEAD\n"
},
{
"from": "human",
"value": "\"\"\"add account_pattern\n\nRevision ID: fb8d553a7268\nRevises: 28e56bf6f62c\nCreate Date: 2021-04-26 22:16:41.772282\n\n\"\"\"\nfrom alembic import op\nimport sqlalchemy as sa\nimport p... | python | chosen |
[
{
"from": "system",
"value": "Add read-only attribute style access to PdfDict elements with object parsing.\n"
},
{
"from": "human",
"value": "from .common import PdfType\n\nclass PdfArray(PdfType, list):\n def __init__(self, *args, **kwargs):\n PdfType.__init__(self)\n list.__i... | python | chosen |
[
{
"from": "system",
"value": "Edit host from 127.0.0.1 -> 0.0.0.0\n"
},
{
"from": "human",
"value": "from dogbot.bot import bot\nfrom dogbot.web import app\nfrom mongoengine import connect\nfrom config import config\nimport getopt\nimport sys\nimport threading\nfrom importlib import reload\nrelo... | python | chosen |
[
{
"from": "system",
"value": "Add docstring and imports to package.\n"
},
{
"from": "human",
"value": "__version__ = '0.12.4'\n"
},
{
"from": "gpt",
"value": "\"\"\"An API library with Python bindings for Exosite One Platform APIs.\"\"\"\n\n__version__ = '0.12.4'\n\nfrom .onep import... | python | chosen |
[
{
"from": "system",
"value": "Load legacy visa_library taking user settings into account\n\nSee #7\n"
},
{
"from": "human",
"value": "# -*- coding: utf-8 -*-\n\"\"\"\n pyvisa\n ~~~~~~\n\n Python wrapper of National Instrument (NI) Virtual Instruments Software\n Architecture library (... | python | chosen |
[
{
"from": "system",
"value": "Move to next version number.\n"
},
{
"from": "human",
"value": "\"\"\" pywind module.\n\n For more information visit https://github.com/zathras777/pywind\n\n\"\"\"\n__version__ = '1.0.3'\n"
},
{
"from": "gpt",
"value": "\"\"\" pywind module.\n\n For more... | python | chosen |
[
{
"from": "system",
"value": "Add slug variable to pass in the URL"
},
{
"from": "human",
"value": "from django.views.generic import ListView, DetailView\n\nfrom .models import Post\n\n\nclass PostListView(ListView):\n context_object_name = 'posts'\n model = Post\n template_name = 'herm... | python | chosen |
[
{
"from": "system",
"value": "Add /supplier prefix to main blueprint and static URLs\n"
},
{
"from": "human",
"value": "from flask import Flask\nfrom flask.ext.bootstrap import Bootstrap\nfrom config import config\n\n\nbootstrap = Bootstrap()\n\n\ndef create_app(config_name):\n\n application ... | python | chosen |
[
{
"from": "system",
"value": "Add TransportError to top-level package\n"
},
{
"from": "human",
"value": "from .core import Shotgun, ShotgunError\n\n# For API compatibility\nFault = ShotgunError\n"
},
{
"from": "gpt",
"value": "from .core import Shotgun, ShotgunError, TransportError\n... | python | chosen |
[
{
"from": "system",
"value": "Update vigenereDicitonaryHacker: simplified comparison with None\n"
},
{
"from": "human",
"value": "# Vigenère Cipher Dictionary Hacker\n# https://www.nostarch.com/crackingcodes/ (BSD Licensed)\n\nimport detectEnglish, vigenereCipher, pyperclip\n\n\ndef main():\n ... | python | chosen |
[
{
"from": "system",
"value": "Make ghostscript handle PDF/A colorspace correctly\n\nPreviously, if you tried to verify files generated by pdf_to_pdfa in a\nverifier (like https://tools.pdfforge.org/validate-pdfa), you would get\nerrors relating to the lack of OutputIntent (6.2.3). The info in\nhttps://stack... | python | chosen |
[
{
"from": "system",
"value": "Add transformations property to projects.\n"
},
{
"from": "human",
"value": "\"\"\"\nProject\n\n:Authors:\n\tBerend Klein Haneveld\n\"\"\"\n\n\nclass Project(object):\n\t\"\"\"\n\tProject holds the basic information of a project for RegistrationShop\n\t\"\"\"\n\n\td... | python | chosen |
[
{
"from": "system",
"value": "Make the Python bindings testsuite be able to find the needed shared libraries\non Cygwin. Needed to compensate for Windows' complete lack of library RPATHs.\n\n* subversion/bindings/swig/python/tests/run_all.py: On Cygwin, manipulate $PATH\n so that the relevant shared libr... | python | chosen |
[
{
"from": "system",
"value": "Handle temporary errors returned from SGE qstat\n"
},
{
"from": "human",
"value": "\"\"\"Commandline interaction with SGE cluster schedulers.\n\"\"\"\nimport re\nimport subprocess\n\n_jobid_pat = re.compile('Your job (?P<jobid>\\d+) \\(\"')\n\ndef submit_job(schedul... | python | chosen |
[
{
"from": "system",
"value": "Save svg files, eps are not used anymore because they don't hand transparency.\n"
},
{
"from": "human",
"value": "#!/usr/bin/python\n\nimport os\nimport sys\n\ndef save_na_results(folder_path=None):\n \"\"\"Move the results of a Neighborhood Algorithm run to a fo... | python | chosen |
[
{
"from": "system",
"value": "Write directly to standard out instead of 'print'\n"
},
{
"from": "human",
"value": "class Instruction:\n def __init__(self,prev):\n self.prev = prev\n if prev:\n self.prev.next = self\n self.partner = None\n self.next = None\n def execute(self, n... | python | chosen |
[
{
"from": "system",
"value": "Allow calls to 'weigh' to run forever when 'max_attempts' is set to 'inf'.\n"
},
{
"from": "human",
"value": "# -*- coding: utf-8 -*-\nimport openerp\nfrom ..helpers.usbscale.scale import Scale\nfrom ..helpers.usbscale.scale_manager import ScaleManager\nfrom ..helpe... | python | chosen |
[
{
"from": "system",
"value": "Upgrade to 2.0.0 (big refactoring done, tests TODO)\n"
},
{
"from": "human",
"value": "\"\"\"\nPySkCode, Python implementation of a full-featured BBCode syntax parser library.\n\"\"\"\n\n# Package information\n__author__ = \"Fabien Batteix (@skywodd)\"\n__copyright_... | python | chosen |
[
{
"from": "system",
"value": "Use search.rnacentral.org as the sequence search endpoint"
},
{
"from": "human",
"value": "\"\"\"\nCopyright [2009-2019] EMBL-European Bioinformatics Institute\nLicensed under the Apache License, Version 2.0 (the \"License\");\nyou may not use this file except in co... | python | chosen |
[
{
"from": "system",
"value": "Fix @jsocol's nit; less verbose boolean assignment\n"
},
{
"from": "human",
"value": "from django.db.models import Count\n\nimport commonware.log\nimport cronjobs\n\nfrom groups.models import AUTO_COMPLETE_COUNT, Group\n\n\nlog = commonware.log.getLogger('m.cron')\n... | python | chosen |
[
{
"from": "system",
"value": "Add test for merge sort\n"
},
{
"from": "human",
"value": "def merge(left, right):\r\n \"\"\"Merge sort merging function.\"\"\"\r\n\r\n left_index, right_index = 0, 0\r\n result = []\r\n while left_index < len(left) and right_index < len(right):\r\n ... | python | chosen |
[
{
"from": "system",
"value": "Add test for detection of deleted files on launch\n"
},
{
"from": "human",
"value": "import pytest\n\nfrom tests.utils.targetdriver import TargetDriver, if_feature\nfrom tests.utils.testdriver import TestDriver\n\n\ndef get_services():\n return TargetDriver('rep1... | python | chosen |
[
{
"from": "system",
"value": "Update branch to version 2.1.0 beta\n"
},
{
"from": "human",
"value": "__version_info__ = {\n 'major': 2,\n 'minor': 0,\n 'micro': 25,\n 'releaselevel': 'beta',\n 'serial': 1\n}\n\ndef get_version(short=False):\n assert __version_info__['releaselev... | python | chosen |
[
{
"from": "system",
"value": "Add links to easy check-in in sadmin\n"
},
{
"from": "human",
"value": "from django.conf.urls import *\n\nimport views\n\nurlpatterns = patterns('',\n url(r'^(?P<event_id>[0-9]+)/$', views.checkin),\n)\n"
},
{
"from": "gpt",
"value": "from django.conf... | python | chosen |
[
{
"from": "system",
"value": "Change purge quarantine to deal with cloudstack databases\n"
},
{
"from": "human",
"value": "from logical.models import Database\n\nfrom dbaas.celery import app\nfrom util.decorators import only_one\n\n\n@app.task\n@only_one(key=\"purgequarantinekey\", timeout=20)\n... | python | chosen |
[
{
"from": "system",
"value": "Add --upgrade to pip install in Fabfile\n"
},
{
"from": "human",
"value": "from fabric import task\n\nCODE_DIR = '~/django-projects/test-osale/foodbank-campaign/src'\n\n# for FreeBSD compatibility\nSHELL = '/bin/sh -c'\n\n@task\ndef deploy(c):\n c.shell = SHELL\n... | python | chosen |
[
{
"from": "system",
"value": "Refactor the code: add error handling of invalid or empty parameters, improve output format.\n"
},
{
"from": "human",
"value": "# -*- coding: utf-8 -*-\nfrom __future__ import print_function\n\nimport json\nimport sys\nfrom ConfigParser import NoOptionError\n\nimpor... | python | chosen |
[
{
"from": "system",
"value": "Remove a bit of django boilerplate\n"
},
{
"from": "human",
"value": "\"\"\"\nThis file demonstrates writing tests using the unittest module. These will pass\nwhen you run \"manage.py test\".\n\nReplace this with more appropriate tests for your application.\n\"\"\"\... | python | chosen |
[
{
"from": "system",
"value": "Remove newlines from exported url_data\n"
},
{
"from": "human",
"value": "import codecs\nimport json\n\nfrom tools.cipher import salted_digest\n\n\nDATA_ENCODING = \"utf-8\"\nTRANSPORT_ENCODING = \"base64\"\nDUMMY_ENCODING = \"ascii\"\n\nDATA_DIGEST_SEPARATOR = \"-\... | python | chosen |
[
{
"from": "system",
"value": "Add headers in proxy server response\n"
},
{
"from": "human",
"value": "# -*- coding: utf-8 -*-\n'''Test using a proxy.'''\n\n# External imports\nimport multiprocessing\nimport pytest\n\nfrom six.moves import socketserver, SimpleHTTPServer\nfrom six.moves.urllib.req... | python | chosen |
[
{
"from": "human",
"value": "Test of the constant variable.\n"
},
{
"from": "gpt",
"value": "import unittest\nfrom mep.genetics.gene import VariableGene\nimport numpy as np\n\n\nclass TestVariableGene(unittest.TestCase):\n \"\"\"\n Tests for the variable gene.\n \"\"\"\n\n def test_b... | python | chosen |
[
{
"from": "system",
"value": "Reword Test Names for Clarity\n\nI didn't like how the test names were sounding. Hopefully this is\nbetter.\n"
},
{
"from": "human",
"value": "\"\"\"Test the DigitalOcean backed ACME DNS Authentication Class.\"\"\"\n\nfrom acmednsauth.authenticate import Authenticat... | python | chosen |
[
{
"from": "system",
"value": "Include answer count in stored data.\n"
},
{
"from": "human",
"value": "\ndef import_question(posts, namespaces, upsert, id, title, body, tags, last_activity_date, last_updated_date, score, answers, has_accepted_answer):\n namespaces_for_post = {}\n for name, ... | python | chosen |
[
{
"from": "system",
"value": "Fix pre-commit for slicing method.\n"
},
{
"from": "human",
"value": "#!/usr/bin/env python\n# -*- coding: utf-8 -*-\n\n# (c) 2015-2018, ETH Zurich, Institut fuer Theoretische Physik\n# Author: Dominik Gresch <greschd@gmx.ch>\n\nimport pytest\nimport numpy as np\n\n... | python | chosen |
[
{
"from": "system",
"value": "Set base_url for dev version of lab"
},
{
"from": "human",
"value": "c.ServerProxy.servers = {\n 'lab-dev': {\n 'command': [\n 'jupyter',\n 'lab',\n '--no-browser',\n '--dev-mode',\n '--port={port}',\n... | python | chosen |
[
{
"from": "system",
"value": "Check Verison of Python Interpreter\n"
},
{
"from": "human",
"value": "\"\"\"\n pyMonitor first Version\n\n Written By :Ahmed Alkabir\n\"\"\"\n\n#!/usr/bin/python3\n\nimport main_ui as Ui\nimport sys\n\n# Main Thread of Program\ndef main():\n app = Ui.QtWid... | python | chosen |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.