conversations listlengths 2 3 | source stringclasses 1
value | stack stringclasses 1
value |
|---|---|---|
[
{
"from": "system",
"value": "Remove old entries (~2 months, keep 100000 entries)\n"
},
{
"from": "human",
"value": "import redis\nimport json\nimport time\n\nclass DHTStorage():\n\tdef __init__(self, key):\n\t\tself.redis = redis.StrictRedis(host='localhost', port=6379, db=0)\n\t\tself.key = ke... | python | chosen |
[
{
"from": "system",
"value": "Use Noise in Burgers demo\n"
},
{
"from": "human",
"value": "from phi.flow import *\n\ndomain = Domain([64, 64], boundaries=PERIODIC)\nworld.add(BurgersVelocity(domain, velocity=lambda s: math.randfreq(s) * 2), physics=Burgers())\n\nshow(App('Burgers Equation in %dD... | python | chosen |
[
{
"from": "system",
"value": "Fix annotation: The default value should be a string\n"
},
{
"from": "human",
"value": "\"\"\" File Upload backends. \"\"\"\n\n\nfrom django.conf import settings\n\nfrom . import django_storage, filesystem, s3, swift\n\n\ndef get_backend():\n # .. setting_name: O... | python | chosen |
[
{
"from": "system",
"value": "Revert \"[TEST] refactor test to get it passing on Travis CI\"\n\nThis reverts commit b92684d252e92a75115ce8617a15c107b5a34b09.\n"
},
{
"from": "human",
"value": "from unittest import TestCase\n\nimport create_minimal_image\nfrom create_minimal_image import main\n\n... | python | chosen |
[
{
"from": "system",
"value": "Revert \"length filter script now adds provided suffix to contig names\"\n\nThis reverts commit 4d3985f667465eb5564de4fada8820e23607a58b.\n"
},
{
"from": "human",
"value": "#!/usr/bin/env python\nimport sys\nfrom Bio import SeqIO\nfrom Bio.SeqRecord import SeqRecord... | python | chosen |
[
{
"from": "system",
"value": "Use environment variable for connection_string driver parameter\n"
},
{
"from": "human",
"value": "DRIVER = 'devops.driver.libvirt.libvirt_driver'\nDRIVER_PARAMETERS = {\n 'connection_string': 'qemu:///system',\n }\n\nINSTALLED_APPS = ['devops']\n\nDAT... | python | chosen |
[
{
"from": "system",
"value": "Fix base form source to use correct class name\n"
},
{
"from": "human",
"value": "\"\"\"The main form for the application\"\"\"\n\nfrom PythonCard import model\n\n# Allow importing of our custom controls\nimport PythonCard.resource\nPythonCard.resource.APP_COMPONENT... | python | chosen |
[
{
"from": "system",
"value": "Add a couple of tests for the formatting pieces\n"
},
{
"from": "human",
"value": "#!/usr/bin/env python\n# -*- encoding: utf-8\n\nimport pytest\nimport requests\n\n\n@pytest.mark.parametrize('path', [\n # Check pagination is working correctly\n '/page/2/', '/... | python | chosen |
[
{
"from": "system",
"value": "Fix PEP8 white spacing (space after comma)\n"
},
{
"from": "human",
"value": "from slackclient._user import User\nfrom slackclient._server import Server, SlackLoginError\nfrom slackclient._channel import Channel\nimport json\nimport pytest\n\n\n@pytest.fixture\ndef ... | python | chosen |
[
{
"from": "system",
"value": "Update option example to highlight samples as well\n\nAnd overriding samples\n"
},
{
"from": "human",
"value": "from sparts.tasks.periodic import PeriodicTask\nfrom sparts.vservice import VService\nfrom sparts.sparts import option\nimport socket\n\nclass HostCheckTa... | python | chosen |
[
{
"from": "system",
"value": "Remove print of terminal output for debugging\n"
},
{
"from": "human",
"value": "#!/usr/bin/python3\n\nimport pyqrcode # sudo pip install pyqrcode\n\ndef getQRArray(text, errorCorrection):\n\t\"\"\" Takes in text and errorCorrection (letter), returns 2D array of the... | python | chosen |
[
{
"from": "system",
"value": "Fix the accurate file to prevent import errors\n\nChange-Id: I0e4d246518bbdd9745d61a06d6960b89cf9ed611\n"
},
{
"from": "human",
"value": "#!/usr/bin/env python\n# Copyright 2014 - Rackspace Hosting\n#\n# Licensed under the Apache License, Version 2.0 (the \"Licen... | python | chosen |
[
{
"from": "system",
"value": "Add final newline to make pylint happy\n"
},
{
"from": "human",
"value": "from activate import deactivate\n\"\"\"\nScript to deactivate LUFA for Arduino.\nMore info can be found in the activate.py script.\n\"\"\"\n\nif __name__ == '__main__':\n deactivate()"
},... | python | chosen |
[
{
"from": "system",
"value": "Switch student model to unicode\n"
},
{
"from": "human",
"value": "from django.contrib.auth.models import User\nfrom django.db import models\n\nclass UserProfile(models.Model):\n user = models.ForeignKey(User, unique = True)\n dionysos_username = models.CharFi... | python | chosen |
[
{
"from": "system",
"value": "Make TextField also work with a QLabel view, which doesn't allow editing.\n"
},
{
"from": "human",
"value": "# Created On: 2012/01/23\n# Copyright 2011 Hardcoded Software (http://www.hardcoded.net)\n# \n# This software is licensed under the \"BSD\" License as descri... | python | chosen |
[
{
"from": "system",
"value": "Tidy and simplify generator code\n"
},
{
"from": "human",
"value": "def flatten(lst):\n \"\"\"Completely flatten an arbitrarily-deep list\"\"\"\n return [*_flatten(lst)]\n\n\ndef _flatten(lst):\n \"\"\"Generator for flattening arbitrarily-deep lists\"\"\"\n... | python | chosen |
[
{
"from": "system",
"value": "Use a separate method to get all peers of a torrent\n"
},
{
"from": "human",
"value": "from urlparse import urlparse\n\nfrom torrent import Torrent\nfrom trackers.udp import UDPTracker\n\n\nclass Client(object):\n __TORRENTS = {}\n\n @property\n def torrents(self... | python | chosen |
[
{
"from": "system",
"value": "Update test scan to work for new model\n"
},
{
"from": "human",
"value": "#!/usr/bin/env python\n# coding=utf-8\n\ntry:\n import unittest.mock as mock\nexcept ImportError:\n import mock\nimport unittest\ntry: \n from StringIO import StringIO\nexcept ImportE... | python | chosen |
[
{
"from": "system",
"value": "Customize admin site title and header\n"
},
{
"from": "human",
"value": "from django.conf import settings\nfrom django.conf.urls import include, url\nfrom django.contrib import admin\nfrom django.http import HttpResponse\n\nfrom watchman import views as watchman_vie... | python | chosen |
[
{
"from": "system",
"value": "Include tests for file loading helpers\n"
},
{
"from": "human",
"value": "import unittest\n\nfrom engine import file_loader\n\n\nclass FileLoaderTest(unittest.TestCase):\n def test_load_units(self):\n dicts = file_loader.read_and_parse_json('units')\n ... | python | chosen |
[
{
"from": "system",
"value": "Allow make_zipfile() to clobber the destination file\n"
},
{
"from": "human",
"value": "#\n# The OpenDiamond Platform for Interactive Search\n# Version 5\n#\n# Copyright (c) 2011 Carnegie Mellon University\n# All rights reserved.\n#\n# This software is distribu... | python | chosen |
[
{
"from": "system",
"value": "Use cycle instead of counting an index ourselves\n"
},
{
"from": "human",
"value": "from itertools import cycle\nfrom psycopg2.extras import register_hstore, register_json\nimport psycopg2\nimport threading\nimport ujson\n\n\nclass DBAffinityConnectionsNoLimit(objec... | python | chosen |
[
{
"from": "system",
"value": "tests/periph_rtt: Correct the test script syntax\n\nPreviously the test was failing due to apparently incorrect Python syntax in\nthe testrunner script. This fix corrects this and the test now passes.\n"
},
{
"from": "human",
"value": "#!/usr/bin/env python3\n\n# Co... | python | chosen |
[
{
"from": "system",
"value": "Set index main view to return post ordered by updated and title field\n"
},
{
"from": "human",
"value": "from flask import render_template\nfrom flask_classy import FlaskView\nfrom ..models import PostModel\n\n\nclass Main(FlaskView):\n \"\"\" Main page view. \"\... | python | chosen |
[
{
"from": "system",
"value": "Add more tests to be written\n"
},
{
"from": "human",
"value": "import pytest\n\n# Successful retrieval\n# Accurate retrieval\n# Comprehensive retrieval of sub-resources\n\n\n@pytest.mark.skip(reason='not implemented')\ndef test_retrieveWARCRecord_fromIPFSHash():\n ... | python | chosen |
[
{
"from": "system",
"value": "Make it clearer that we are rejecting the submission.\n"
},
{
"from": "human",
"value": "from django.conf import settings\nfrom django.http import HttpResponse, HttpResponseBadRequest\nfrom django.views.decorators.csrf import csrf_exempt\nfrom django.views.decorator... | python | chosen |
[
{
"from": "system",
"value": "Speed up unit tests when Sphinx DB is configured\n"
},
{
"from": "human",
"value": "from django.db.backends.mysql.base import DatabaseWrapper as MySQLDatabaseWrapper\nfrom django.db.backends.mysql.base import DatabaseOperations as MySQLDatabaseOperations\nfrom djang... | python | chosen |
[
{
"from": "system",
"value": "Add admi to add Applications to the Pages.\n\nhttps://github.com/madewithbytes/us_ignite/issues/79\n\nThe applications can be added to a page and ordered\nin the admin.\n"
},
{
"from": "human",
"value": "from django.contrib import admin\n\nfrom us_ignite.apps.models... | python | chosen |
[
{
"from": "system",
"value": "Add check for supported Python versions\n\nNot all Python versions are supported by this package, because the import\nmechanism changes in the different Python versions.\nIf an unsupported Python version is used, an ImportError is raised.\n"
},
{
"from": "human",
"v... | python | chosen |
[
{
"from": "system",
"value": "Fix errors cause by key error in sys.modules and wrong type error by uFid.\n"
},
{
"from": "human",
"value": "import importlib\nimport importlib.machinery\n\nimport sys\n\nfrom module import Module\nimport json\n\n\ndef message_to_function(raw_message):\n \"\"\"\... | python | chosen |
[
{
"from": "system",
"value": "Simplify formulation and change from print() to assert()\n"
},
{
"from": "human",
"value": "#!/usr/bin/env python\n# -*- coding: utf-8 -*-\n\"\"\"Exercise 4.1 from Kane 1985\"\"\"\n\nfrom sympy.physics.mechanics import dot, dynamicsymbols, MechanicsStrPrinter\nfrom ... | python | chosen |
[
{
"from": "system",
"value": "Migrate docker to new debian semantics\n"
},
{
"from": "human",
"value": "from genes.apt import commands as apt\nfrom genes.brew import commands as brew\nfrom genes import debian\nfrom genes.debian.traits import is_debian\nfrom genes.ubuntu.traits import is_ubuntu\n... | python | chosen |
[
{
"from": "system",
"value": "Add support for generic pages\n"
},
{
"from": "human",
"value": "import requests\n\nfrom bs4 import BeautifulSoup\n\n\ndef parse_html(html, **kwargs):\n parsed_html = BeautifulSoup(html, 'lxml')\n\n headline = parsed_html.body.find('h1')\n paragraph = None\... | python | chosen |
[
{
"from": "system",
"value": "Remove extraneous vim editor configuration comments\n\nChange-Id: I173c838765efd527b3bc652d9b8c32ac89c756b6\nPartial-Bug: #1229324\n"
},
{
"from": "human",
"value": "# vim: tabstop=4 shiftwidth=4 softtabstop=4\n\n# Licensed under the Apache License, Version 2.0 (... | python | chosen |
[
{
"from": "system",
"value": "Build out init function of hash table class\n"
},
{
"from": "human",
"value": "#!/usr/bin/env python\n\n'''Implementation of a simple hash table.\nThe table has `hash`, `get` and `set` methods.\nThe hash function uses a very basic hash algorithm to insert the value ... | python | chosen |
[
{
"from": "system",
"value": "Remove manager repr (user should not need to view contents)\n"
},
{
"from": "human",
"value": "import weakref\nimport sunpy\n\nclass MapManager(weakref.WeakSet):\n \"\"\"Weak referenced set of maps created using functions decorated by manage_maps.\"\"\"\n\n de... | python | chosen |
[
{
"from": "system",
"value": "Update timedelta_months docstring to be accurate\n"
},
{
"from": "human",
"value": "import datetime\n\n\ndef timedelta_months(months, compare_date=None):\n \"\"\"\n Return a JSON response.\n\n :param months: Amount of months to offset\n :type months: int... | python | chosen |
[
{
"from": "system",
"value": "Change attributes order on constructor\n"
},
{
"from": "human",
"value": "from infosystem.database import db\nfrom infosystem.common.subsystem import entity\n\n\nclass Domain(entity.Entity, db.Model):\n\n attributes = ['name', 'parent_id']\n attributes += enti... | python | chosen |
[
{
"from": "system",
"value": "Add country field to release serializer.\n"
},
{
"from": "human",
"value": "from rest_framework import serializers\nfrom .models import Release, Track, Comment\n\n\nclass CommentSerializer(serializers.ModelSerializer):\n class Meta:\n model = Comment\n ... | python | chosen |
[
{
"from": "system",
"value": "Add HStore extension to initial migration.\n"
},
{
"from": "human",
"value": "# -*- coding: utf-8 -*-\n# Generated by Django 1.9.5 on 2016-04-10 14:33\nfrom __future__ import unicode_literals\n\nfrom django.db import migrations\n\n\nclass Migration(migrations.Migrat... | python | chosen |
[
{
"from": "system",
"value": "Add `@dca.dataclass_array` decorator to customize dca params. Change default values\n\nPiperOrigin-RevId: 475563717\n"
},
{
"from": "human",
"value": "# Copyright 2022 The visu3d Authors.\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you... | python | chosen |
[
{
"from": "system",
"value": "Rewrite httputil test module via pytest\n"
},
{
"from": "human",
"value": "\"\"\"Tests for cherrypy/lib/httputil.py.\"\"\"\n\nimport unittest\nfrom cherrypy.lib import httputil\n\n\nclass UtilityTests(unittest.TestCase):\n\n def test_urljoin(self):\n # Tes... | python | chosen |
[
{
"from": "system",
"value": "Allow env vars for RUN_DISTUTILS\n\nAllow use of env vars RUN_DISTUTILS, RUN_DISTUTILOPTS as defaults.\n\nWith this, on macos, macports doesn't need to be in PATH to build FAHControl. One just needs\n\nexport RUN_DISTUTILS=\"/opt/local/bin/python\"\n\nor the equivalent in dockb... | python | chosen |
[
{
"from": "system",
"value": "Return error instead of if/else\n"
},
{
"from": "human",
"value": "#!/usr/bin/env python\n\nfrom termcolor import colored\nfrom appscript import *\nfrom track import Track\n\n\ndef main():\n print(get_song())\n\n\ndef get_song():\n itunes_open = bool(app('Syst... | python | chosen |
[
{
"from": "system",
"value": "Use assertEqual instead of assertEquals\n"
},
{
"from": "human",
"value": "import unittest\nfrom anser import Anser, Client\n\n\nclass BasicAnserTest(unittest.TestCase):\n\n def test_creation(self):\n server = Anser(__file__)\n self.assertEquals(ser... | python | chosen |
[
{
"from": "system",
"value": "Add enum field for vSphere backend\n\nReview-Url: https://codereview.chromium.org/1997903002\n"
},
{
"from": "human",
"value": "# Copyright 2015 The LUCI Authors. All rights reserved.\n# Use of this source code is governed by the Apache v2.0 license that can be\n# f... | python | chosen |
[
{
"from": "system",
"value": "Add help_text and required=False to the PIN field\n"
},
{
"from": "human",
"value": "from django import forms\n\n\nclass IndexForm(forms.Form):\n usos_auth_pin = forms.IntegerField(label='USOS Authorization PIN')\n id_list = forms.CharField(\n widget=fo... | python | chosen |
[
{
"from": "system",
"value": "Add tests for active_class templatetag\n"
},
{
"from": "human",
"value": "\nfrom django.test import TestCase\n\nfrom ..templatetags.breadcrumbs import breadcrumbs\n\nclass BreadcrumbTest(TestCase):\n\n\n def test_breadcrumbs(self):\n \"\"\"Check that the b... | python | chosen |
[
{
"from": "system",
"value": "Fix 'path' function: use main's file as project root\n"
},
{
"from": "human",
"value": "import os\n\n\ndef setting(name):\n return name.upper()\n\ndef path(subpath):\n project_root = os.path.dirname(os.path.realpath(__file__))\n return os.path.join(project_... | python | chosen |
[
{
"from": "system",
"value": "Fix incorrect models field name for MailgunLog\n"
},
{
"from": "human",
"value": "from django.db import models\n\nclass MailgunLog(models.Model):\n log_hash = models.CharField(max_length=64, unique=True)\n data = models.TextField()\n timestamp = models.Date... | python | chosen |
[
{
"from": "system",
"value": "Clean up old test, pass all tests\n"
},
{
"from": "human",
"value": "# -*- coding: utf-8 -*-\n\n\"\"\"\nPostpasses over the LLVM IR.\nThe signature of each postpass is postpass(env, ee, lmod, lfunc) -> lfunc\n\"\"\"\n\nfrom __future__ import print_function, division... | python | chosen |
[
{
"from": "system",
"value": "Update error output for app not open/song not playing\n"
},
{
"from": "human",
"value": "#!/usr/bin/env python\n\nfrom termcolor import colored\nfrom appscript import *\nfrom track import Track\n\n\ndef main():\n print(get_song())\n\n\ndef get_song():\n itunes... | python | chosen |
[
{
"from": "system",
"value": "Remove comment from zabbix integration\n"
},
{
"from": "human",
"value": "from dbaas_dbmonitor.provider import DBMonitorProvider\nfrom dbaas_zabbix.provider import ZabbixProvider\nimport logging\n\nLOG = logging.getLogger(__name__)\n\nclass MonitoringManager():\n ... | python | chosen |
[
{
"from": "system",
"value": "Ch03: Declare Meta class in Tag model. [skip ci]\n"
},
{
"from": "human",
"value": "from django.db import models\n\n\n# Model Field Reference\n# https://docs.djangoproject.com/en/1.8/ref/models/fields/\n\n\nclass Tag(models.Model):\n name = models.CharField(\n ... | python | chosen |
[
{
"from": "system",
"value": "Fix default price list item synchronization for OpenStack flavor [SENTRY-2030]\nPreviously invalid resource content type has been used.\n"
},
{
"from": "human",
"value": "from django.contrib.contenttypes.models import ContentType\n\nfrom waldur_core.cost_tracking im... | python | chosen |
[
{
"from": "system",
"value": "Rename the 'contain' TestCase to TestContain\n"
},
{
"from": "human",
"value": "import unittest\nfrom robber import expect\nfrom robber.matchers.contain import Contain\n\nclass TestAbove(unittest.TestCase):\n def test_matches(self):\n expect(Contain({'key'... | python | chosen |
[
{
"from": "system",
"value": "Add global level vars for other packages"
},
{
"from": "human",
"value": "from functools import wraps\nimport platform\n\n\ndef is_debian(versions=None, distro_name='Debian'):\n operating_system = platform.system()\n distribution, version, codename = platform.... | python | chosen |
[
{
"from": "system",
"value": "Fix mistake in search index update check\n"
},
{
"from": "human",
"value": "from haystack import indexes\n\nfrom celery_haystack.indexes import CelerySearchIndex\n\nfrom .models import FoiRequest\n\n\nclass FoiRequestIndex(CelerySearchIndex, indexes.Indexable):\n ... | python | chosen |
[
{
"from": "system",
"value": "Add test for file iteration\n"
},
{
"from": "human",
"value": "# -*- coding: utf-8 -*-\n\"\"\"\nformat-sql\n\nCopyright (c) 2014, Friedrich Paetzke (paetzke@fastmail.fm)\nAll rights reserved.\n\n\"\"\"\nimport os\n\nfrom format_sql.file_handling import format_file, ... | python | chosen |
[
{
"from": "system",
"value": "Add tests for curried merge\n"
},
{
"from": "human",
"value": "import toolz\nimport toolz.curried\nfrom toolz.curried import take, first, second, sorted, merge_with, reduce\nfrom operator import add\n\n\ndef test_take():\n assert list(take(2)([1, 2, 3])) == [1, 2... | python | chosen |
[
{
"from": "system",
"value": "Return the actual return code\n"
},
{
"from": "human",
"value": "\nfrom plumbum import local\nimport subprocess\n\nPY_ENV = 'py_env'\n\n\ndef install_environment():\n assert local.path('setup.py').exists()\n # Return immediately if we already have a virtualenv... | python | chosen |
[
{
"from": "system",
"value": "Mark this test as a known failure to return the bots to blue\n"
},
{
"from": "human",
"value": "# TestREPLPOReplType.py\n#\n# This source file is part of the Swift.org open source project\n#\n# Copyright (c) 2014 - 2015 Apple Inc. and the Swift project authors\n# Li... | python | chosen |
[
{
"from": "system",
"value": "Save malts for future reference\n"
},
{
"from": "human",
"value": "import json\nimport time\nimport jsonschema\nfrom pkg_resources import resource_string\nfrom flask import request, jsonify\nfrom brew import app, controller, machine, mongo\n\n\n@app.route('/api/reci... | python | chosen |
[
{
"from": "system",
"value": "Test runner uses current python"
},
{
"from": "human",
"value": "\r\nimport os\r\n\r\nPROJECT_DIR = os.path.abspath(os.path.dirname( __file__ ))\r\nSRC_DIR = os.path.join(PROJECT_DIR, \"src\")\r\nTEST_DIR = os.path.join(PROJECT_DIR, \"test\")\r\n\r\ndef runtestdir(s... | python | chosen |
[
{
"from": "system",
"value": "Add space between import and class declaration\n\nAll heil PEP.\n"
},
{
"from": "human",
"value": "from pygame.mixer import Sound\n\nclass SelectStateSFX(object):\n \"\"\"Plays sound effects that are used by both the Character Select\n State and the Stage Sele... | python | chosen |
[
{
"from": "system",
"value": "Add registration to cost tracking\n"
},
{
"from": "human",
"value": "from django.apps import AppConfig\n\n\nclass OracleConfig(AppConfig):\n name = 'nodeconductor_paas_oracle'\n verbose_name = 'Oracle'\n service_name = 'Oracle'\n\n def ready(self):\n ... | python | chosen |
[
{
"from": "system",
"value": "Fix a silly typo in the login popup form\n\nI have no idea why Django was OK with this...\n"
},
{
"from": "human",
"value": "\nfrom auth import forms\n\ndef login_form(request):\n if request.user.is_authenticated():\n return dict()\n\n return dict(login... | python | chosen |
[
{
"from": "system",
"value": "Add tests for all methods\n"
},
{
"from": "human",
"value": "import unittest\n\nfrom csv_ical import convert\n\n\nclass TestConvert(unittest.TestCase):\n def setUp(self):\n self.convert = convert.Convert()\n\n def test_generate_configs(self):\n s... | python | chosen |
[
{
"from": "system",
"value": "Allow line breaks in changelog.\n"
},
{
"from": "human",
"value": "#! /usr/bin/env python3\n\nimport re\nimport sys\n\n_, VERSION, CHANGELOG, LIST = sys.argv\nHEADER_REGEX = fr\"# {VERSION} \\(\\d\\d\\d\\d-\\d\\d-\\d\\d\\)\\n\"\n\nnotes_list = []\n\n\ndef add_to_rel... | python | chosen |
[
{
"from": "system",
"value": "Move redundant check to first point of contact\n"
},
{
"from": "human",
"value": "import random\n\n\ndef sort(items):\n if items is None:\n raise TypeError(\"Collection cannot be of type None\")\n\n if len(items) < 2:\n return items\n\n pivot ... | python | chosen |
[
{
"from": "system",
"value": "Remove result checking in http_stats_submit, as submit_match raises exception on fail\n"
},
{
"from": "human",
"value": "# -*- coding: utf-8 -*-\n\nfrom starlette.exceptions import HTTPException\nfrom starlette.requests import Request\nfrom starlette.responses impor... | python | chosen |
[
{
"from": "system",
"value": "[Python] Complete 'About Lists Assignments' koans\n"
},
{
"from": "human",
"value": "#!/usr/bin/env python\n# -*- coding: utf-8 -*-\n\n#\n# Based on AboutArrayAssignments in the Ruby Koans\n#\n\nfrom runner.koan import *\n\nclass AboutListAssignments(Koan):\n def... | python | chosen |
[
{
"from": "system",
"value": "Add support for ... (`Ellipsis`).\n\nNote that it is still considered an operator, so stuff like `a ... b` means \"call ... with a and b\".\n"
},
{
"from": "human",
"value": "import builtins\nimport operator\nimport functools\nimport importlib\n\n# Choose a function... | python | chosen |
[
{
"from": "system",
"value": "Add an exception based version\n"
},
{
"from": "human",
"value": "DNA = {\"A\", \"C\", \"T\", \"G\"}\n\nTRANS = {\"G\": \"C\", \"C\":\"G\", \"T\":\"A\", \"A\":\"U\"}\n\n\ndef to_rna(dna):\n # Check validity - `difference` returns elements in dna not in DNA\n i... | python | chosen |
[
{
"from": "system",
"value": "Make login a utility so it can be re-used elsewhere.\n\nSigned-off-by: Chris Lamb <711c73f64afdce07b7e38039a96d2224209e9a6c@playfire.com>\n"
},
{
"from": "human",
"value": "import urllib\nimport urlparse\n\nfrom . import app_settings\n\ndef strip_token(url):\n bi... | python | chosen |
[
{
"from": "system",
"value": "Revert changes: freezegun has been updated.\n"
},
{
"from": "human",
"value": "import datetime\nfrom decimal import Decimal\n\nfrom django.core.serializers.json import DjangoJSONEncoder\n\nDATETIME = (datetime.datetime,)\nDATE = (datetime.date,)\nTIME = (datetime.ti... | python | chosen |
[
{
"from": "system",
"value": "Add exception handling in twitter view\n"
},
{
"from": "human",
"value": "from flask import Blueprint, request, render_template\nfrom ..load import processing_results, api\nimport string\nimport tweepy\n\n\ntwitter_mod = Blueprint('twitter', __name__, template_folde... | python | chosen |
[
{
"from": "system",
"value": "Add functions for retrieving a list of dynamically registered runners.\n\nThose functions match same functions exposed by the auth backend loading\nfunctionality.\n"
},
{
"from": "human",
"value": "# Licensed to the StackStorm, Inc ('StackStorm') under one or more\n... | python | chosen |
[
{
"from": "system",
"value": "Remove type annotation from `VERSION` as setuptools can't handle it\n"
},
{
"from": "human",
"value": "\"\"\"\nDBB Ranking Parser\n~~~~~~~~~~~~~~~~~~\n\nExtract league rankings from the DBB (Deutscher Basketball Bund e.V.)\nwebsite.\n\nThe resulting data is structur... | python | chosen |
[
{
"from": "system",
"value": "Revert year range end back to 2015 (2016 is not over)\n"
},
{
"from": "human",
"value": "#!/usr/bin/env python\n\nimport csv\nimport sys\n\nimport figs\n\ndef load_counts(filename):\n counts = {}\n with open(filename) as stream:\n stream.readline()\n ... | python | chosen |
[
{
"from": "system",
"value": "Clean up the Bellman benchmarking code.\n"
},
{
"from": "human",
"value": "\"\"\"\n@author: Bryan Silverthorn <bcs@cargo-cult.org>\n\"\"\"\n\nif __name__ == \"__main__\":\n from borg.tools.bench_bellman import main\n\n raise SystemExit(main())\n\ndef main():\n... | python | chosen |
[
{
"from": "system",
"value": "Test the an empty document results in a test failure.\n"
},
{
"from": "human",
"value": "import os\nfrom unittest import TestCase\nfrom servequnit.factory import ServerFactory\nfrom servequnit.tester import QunitSeleniumTester, TestFailedError\n\nclass QunitSelenium... | python | chosen |
[
{
"from": "system",
"value": "test: Use generator for IAM template names\n\nSee also: #208\n"
},
{
"from": "human",
"value": "\"\"\"Test IAM Policy templates are valid JSON.\"\"\"\nimport jinja2\n\nfrom foremast.iam.construct_policy import render_policy_template\nfrom foremast.utils.templates im... | python | chosen |
[
{
"from": "system",
"value": "Fix to remove DeprecationWarning message from test log\n"
},
{
"from": "human",
"value": "# -*- coding: ISO-8859-1 -*-\n#-----------------------------------------------------------------------------\n# Copyright (c) 2014, HFTools Development Team.\n#\n# Distributed ... | python | chosen |
[
{
"from": "system",
"value": "Add vltstd to include path\n"
},
{
"from": "human",
"value": "from distutils.core import setup\nfrom distutils.extension import Extension\n\nfrom os import system\n\nsetup(name='vsimj1a',\n ext_modules=[ \n Extension('vsimj1a',\n ['vsim.cpp'],\n ... | python | chosen |
[
{
"from": "system",
"value": "Tweak raw text parameter name\n"
},
{
"from": "human",
"value": "from __future__ import unicode_literals\n\nimport os\ntry:\n from io import StringIO\nexcept ImportError: # pragma: no cover\n from StringIO import StringIO\nfrom rock.exceptions import ConfigEr... | python | chosen |
[
{
"from": "system",
"value": "Make date imports more flexible\n\nNow ut works with `YYYY-MM-DD HH:MM:SS` and with `YYYY-MM-DDTHH:MM:SS`.\n"
},
{
"from": "human",
"value": "from datetime import date\n\nfrom rows import fields\n\n\nclass IntegerField(fields.IntegerField):\n\n @classmethod\n ... | python | chosen |
[
{
"from": "system",
"value": "Set noqa to silence flake8.\n"
},
{
"from": "human",
"value": "# Copyright (c) 2015 Ansible, Inc.\n# All Rights Reserved\n\nimport sys\n\nfrom django.core.management.base import BaseCommand\n\nfrom awx.main.task_engine import TaskSerializer\n\n\nclass Command(BaseCo... | python | chosen |
[
{
"from": "system",
"value": "Add NFD_NFC to unicode normalization comparison.\n"
},
{
"from": "human",
"value": "# -*- coding: utf-8 -*-\nimport unicodedata\n\n\ndef shortest_normalization_form():\n \"\"\"\n Find unicode normalization that generates shortest utf8 encoded text.\n\n Resu... | python | chosen |
[
{
"from": "system",
"value": "Fix order on opps menu\n"
},
{
"from": "human",
"value": "# -*- coding: utf-8 -*-\nfrom django.utils import timezone\nfrom django.conf import settings\nfrom django.contrib.sites.models import get_current_site\n\nfrom .models import Channel\n\n\ndef channel_context(r... | python | chosen |
[
{
"from": "system",
"value": "Update server endpoint from dev to production\n"
},
{
"from": "human",
"value": "URL = \"https://api.dev.verigator.com\"\n\nCREATE_SERVICE = \"v1/service/service\"\nGET_SERVICE = \"v1/service/service/{}\"\nDELETE_SERVICE = \"v1/service/service/{}\"\nGET_USERS = \"v1... | python | chosen |
[
{
"from": "system",
"value": "Add test-runner option to run zpop* tests.\n"
},
{
"from": "human",
"value": "#!/usr/bin/env python\n\nimport optparse\nimport sys\nimport unittest\n\nfrom walrus import tests\n\ndef runtests(verbose=False, failfast=False, names=None):\n if names:\n suite ... | python | chosen |
[
{
"from": "system",
"value": "Fix Thompson to pay attention to the RNG.\n"
},
{
"from": "human",
"value": "\"\"\"\nAcquisition functions based on (GP) UCB.\n\"\"\"\n\n# future imports\nfrom __future__ import division\nfrom __future__ import absolute_import\nfrom __future__ import print_function\... | python | chosen |
[
{
"from": "system",
"value": "tests/basics: Expand test cases for equality of subclasses.\n"
},
{
"from": "human",
"value": "class Base1:\n def __init__(self, *args):\n print(\"Base1.__init__\", args)\n\nclass Ctuple1(Base1, tuple):\n pass\n\na = Ctuple1()\nprint(len(a))\na = Ctuple... | python | chosen |
[
{
"from": "system",
"value": "Add 'server-url' command line argument\n\nIts value is passed to the server_url parameter of the Launcher class.\n"
},
{
"from": "human",
"value": "\"\"\"Launch a WMT simulation using `bash` or `qsub`.\"\"\"\n\nfrom __future__ import print_function\nimport sys\nimpo... | python | chosen |
[
{
"from": "system",
"value": "Fix crash when URL is provided.\n"
},
{
"from": "human",
"value": "import argparse, json, os.path\nimport jinja2, requests\n\n\ndef main():\n parser = argparse.ArgumentParser()\n\n parser.add_argument(\n \"-i\", \"--input\",\n default=\"swagger.j... | python | chosen |
[
{
"from": "system",
"value": "Increment version number to 0.3\n"
},
{
"from": "human",
"value": "# -*- coding: utf-8 -*-\n\n__version__ = (0, 2, 0, 'final', 0)\n"
},
{
"from": "gpt",
"value": "# -*- coding: utf-8 -*-\n\n__version__ = (0, 3, 0, 'final', 0)\n"
}
] | python | chosen |
[
{
"from": "system",
"value": "Increase size of category field.\n"
},
{
"from": "human",
"value": "from django.db import models\n\n\nclass Position(models.Model):\n job_id = models.CharField(max_length=25, unique=True)\n title = models.CharField(max_length=100)\n requisition_id = models.... | python | chosen |
[
{
"from": "system",
"value": "Fix travis error with SQLITE_LIMIT_VARIABLE_NUMBER\n"
},
{
"from": "human",
"value": "import sqlite3\n\n\ndef max_sql_variables():\n \"\"\"Get the maximum number of arguments allowed in a query by the current\n sqlite3 implementation.\n\n Returns:\n ... | python | chosen |
[
{
"from": "system",
"value": "Use multi arg option too\n"
},
{
"from": "human",
"value": "import os\n\nfrom django.core.management.base import BaseCommand\nfrom django.conf import settings\n\nclass Command(BaseCommand):\n args = ''\n help = \"Set all permissions in the uploads directory fo... | python | chosen |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.