conversations listlengths 2 3 | source stringclasses 1 value | stack stringclasses 1 value |
|---|---|---|
[
{
"from": "system",
"value": "Add whitespace around + (pep8 E225/E226)\n"
},
{
"from": "human",
"value": "from django.test import TestCase\n\n# Create your tests here.\n\n\nclass SanityTest(TestCase):\n def test_one_plus_one_equals_two(self):\n self.assertEqual(1+1, 2)\n"
},
{
... | python | chosen |
[
{
"from": "system",
"value": "Refactor S3 interactions for reusability\n"
},
{
"from": "human",
"value": "from IPython.display import Image\n\nimport boto\n\ndef s3img(uri):\n if uri.startswith('s3://'):\n uri = uri[5:]\n\n bucket_name, key_name = uri.split('/', 1)\n\n conn = bot... | python | chosen |
[
{
"from": "system",
"value": "Fix typo in sanity test description\n\nChange-Id: Icd575b8ed62c340c57857ff6576f65557434f3e0\nSigned-off-by: juraj.linkes <cc98fdfd74a97bdc42df592c19d962e48c451a95@pantheon.tech>\n"
},
{
"from": "human",
"value": "#!/usr/bin/env python\n\nfrom __future__ import print... | python | chosen |
[
{
"from": "system",
"value": "Add leftover import due to disfunctional testing\n"
},
{
"from": "human",
"value": "\"\"\"\nThe ``foreign`` Devito backend is meant to be used by codes that don't\nrun Python natively. This backend is only capable of generating and compiling\nkernels; however, kerne... | python | chosen |
[
{
"from": "system",
"value": "Test for unconditional else branches\n"
},
{
"from": "human",
"value": "import pytest\n\nfrom thinglang.runner import run\n\n\ndef test_simple_conditionals():\n assert run(\"\"\"\nthing Program\n does start\n if \"dog\" eq \"dog\"\n Output.wr... | python | chosen |
[
{
"from": "system",
"value": "Fix python 3.5 test switching.\n"
},
{
"from": "human",
"value": "\"\"\"\r\nFor tests that require python 3 only syntax.\r\n\"\"\"\r\nimport six\r\n\r\nif six.PY2:\r\n # don't import this package on python2\r\n def load_tests(loader, standard_tests, pattern):\... | python | chosen |
[
{
"from": "system",
"value": "Add add method to BaseCurrentPlaylistController\n"
},
{
"from": "human",
"value": "import logging\nimport time\n\nfrom mopidy.exceptions import MpdNotImplemented\nfrom mopidy.models import Playlist\n\nlogger = logging.getLogger('backends.base')\n\nclass BaseBackend(... | python | chosen |
[
{
"from": "system",
"value": "Add test for info when db error\n"
},
{
"from": "human",
"value": "import pytest\n\nfrom flask import json, url_for\n\n\nclass WhenAccessingSiteInfo(object):\n\n def it_shows_info(self, client, db):\n response = client.get(\n url_for('.get_info'... | python | chosen |
[
{
"from": "system",
"value": "Add test for meddling middleware\n"
},
{
"from": "human",
"value": "# -*- coding: utf-8 -*-\nfrom StringIO import StringIO\nfrom django.conf import settings\nfrom django.core.management import call_command\nfrom django.template.base import TemplateDoesNotExist\nfrom... | python | chosen |
[
{
"from": "system",
"value": "Print license on each import\n"
},
{
"from": "human",
"value": "__version__ = '17.07' # Date based versioning\n# See: https://packaging.python.org/tutorials/distributing-packages/#date-based-versioning\n"
},
{
"from": "gpt",
"value": "\"\"\"\n Copyri... | python | chosen |
[
{
"from": "system",
"value": "Update StatMoments tests (passing); empty tests to be filled in when the testing data is updated\n"
},
{
"from": "human",
"value": "# Licensed under an MIT open source license - see LICENSE\n\n\n'''\nTest functions for Kurtosis\n'''\n\nfrom unittest import TestCase\... | python | chosen |
[
{
"from": "system",
"value": "Test all rules but refnames.\n"
},
{
"from": "human",
"value": "#!/usr/bin/env python\n# -*- coding: utf-8 -*-\n\n\"\"\" Check the rules\n\"\"\"\n\nimport os\nimport pkg_resources\nimport json\nimport re\nimport seabird\n\n\ndef test_load_available_rules():\n \"\... | python | chosen |
[
{
"from": "system",
"value": "Return python eval instead of printing it\n"
},
{
"from": "human",
"value": "from __future__ import print_function\n\nfrom jupyter_kernel import MagicKernel\n\n\nclass EvalKernel(MagicKernel):\n implementation = 'Eval'\n implementation_version = '1.0'\n lan... | python | chosen |
[
{
"from": "system",
"value": "Add tests and fixtures for the Licenses API wrapper\n"
},
{
"from": "human",
"value": "#!/usr/bin/env python\n# -*- coding: utf-8 -*-\n"
},
{
"from": "gpt",
"value": "# -*- coding: utf-8 -*-\n\n\"\"\"pytest Licenses API wrapper tests and fixtures.\"\"\"\... | python | chosen |
[
{
"from": "system",
"value": "feature/oop-api-refactoring: Fix placeholders in template string\n"
},
{
"from": "human",
"value": "# -*- coding: utf-8 -*-\n\nfrom sklearn_porter.language.LanguageABC import LanguageABC\n\n\nclass Ruby(LanguageABC):\n KEY = 'ruby'\n LABEL = 'Ruby'\n\n DEPE... | python | chosen |
[
{
"from": "system",
"value": "Remove test of built-in \"NotImplementedError\" exception.\n"
},
{
"from": "human",
"value": "import unittest\nfrom pymodbus3.exceptions import *\n\n\nclass SimpleExceptionsTest(unittest.TestCase):\n \"\"\"\n This is the unittest for the pymodbus3.exceptions m... | python | chosen |
[
{
"from": "system",
"value": "Fix version string so that we can install with pip/setuptools\n"
},
{
"from": "human",
"value": "\"\"\"Schemas for structured data.\"\"\"\nfrom flatland.exc import AdaptationError\nfrom flatland.schema import Array, Boolean, Compound, Constrained, Container,\\\n ... | python | chosen |
[
{
"from": "system",
"value": "Add job id and enable/disabled status if the job already exists\n"
},
{
"from": "human",
"value": "from django.utils import timezone\nfrom django.core.management.base import BaseCommand, CommandError\nfrom scheduler.models import RepeatableJob\n\nclass Command(BaseC... | python | chosen |
[
{
"from": "system",
"value": "Fix migrating CPE field from string to ID\n\nJIRA: PDC-2228\n"
},
{
"from": "human",
"value": "# -*- coding: utf-8 -*-\nfrom __future__ import unicode_literals\n\nfrom django.db import migrations, models\n\n\nclass Migration(migrations.Migration):\n\n dependencie... | python | chosen |
[
{
"from": "system",
"value": "Move Session to Sport as an inline.\n"
},
{
"from": "human",
"value": "from django.contrib import admin\nfrom .models import (Sport, Match, Session, CancelledSession)\n\n@admin.register(Sport)\nclass SportAdmin(admin.ModelAdmin):\n prepopulated_fields = {'slug': ... | python | chosen |
[
{
"from": "system",
"value": "Test extension with mock registry\n"
},
{
"from": "human",
"value": "import unittest\n\nfrom mopidy_spotify import Extension, backend as backend_lib\n\n\nclass ExtensionTest(unittest.TestCase):\n\n def test_get_default_config(self):\n ext = Extension()\n\n... | python | chosen |
[
{
"from": "system",
"value": "Clarify intent and fail fast\n"
},
{
"from": "human",
"value": "#!/usr/bin/env python\n\nimport cleanup_marathon_orphaned_images\n\n\n# These should be left running\nmesos_deployed_old = {\n 'Names': ['/mesos-deployed-old', ],\n}\nmesos_undeployed_young = {\n ... | python | chosen |
[
{
"from": "system",
"value": "Create intermidate dirs if they do not exist when moving files\n"
},
{
"from": "human",
"value": "\"\"\"\n Script to move corrupt images to 'dirty' directory\n \n Reads list of images to move. Does not verify that images are corrupt - \n Simply moves to ... | python | chosen |
[
{
"from": "system",
"value": "Use a package in base Python distro for test\n\nI was too ambitious -- pymt_hydrotrend isn't a default on Windows.\nUsing os.getcwd() should be less fragile.\n"
},
{
"from": "human",
"value": "from bmi_tester.bmipytest import load_component\n\n\nentry_point = 'pymt_... | python | chosen |
[
{
"from": "system",
"value": "Add tests based off of the corpus.\n"
},
{
"from": "human",
"value": "#!/usr/bin/env python\n# -*- coding: utf-8 -*-\n\n\"\"\"\ntest_spicedham\n----------------------------------\n\nTests for `spicedham` module.\n\"\"\"\n\nimport unittest\n\nfrom spicedham import sp... | python | chosen |
[
{
"from": "system",
"value": "Use a more standard variable name for the class argument.\n"
},
{
"from": "human",
"value": "from springfield import Entity\n\n\ndef entity_from_mongo(kls, values):\n \"\"\"\n Construct an Entity of type `kls` from a Mongo document.\n \"\"\"\n entity = k... | python | chosen |
[
{
"from": "system",
"value": "Add '/admin' url_prefix to main blueprint\n\nAlso attaches the authentication check to main blueprint instead of\nthe app itself. This means we can use other blueprints for status\nand internal use that don't require authentication.\n\nOne important note: before_request must be... | python | chosen |
[
{
"from": "system",
"value": "Add a standard API reply interface\n"
},
{
"from": "human",
"value": "from flask import jsonify, request\nfrom ..main import app\n\n\n@app.route('/api/ip')\ndef api_ip():\n return jsonify({'Success': True, 'ipAddress': get_client_ip()})\n\n\ndef get_client_ip():\... | python | chosen |
[
{
"from": "system",
"value": "Use configobj for config handling\n"
},
{
"from": "human",
"value": "#!/srv/python/venv/bin/ipython -i\nimport bqueryd\nimport os\nimport sys\nimport logging\nimport ConfigParser\n\nconfig = ConfigParser.RawConfigParser()\nconfig.read(['/etc/bqueryd.cfg', os.path.ex... | python | chosen |
[
{
"from": "system",
"value": "Simplify and improve -v/-q handling.\n"
},
{
"from": "human",
"value": "\"\"\"Alternate way of running the unittests, for Python 2.5 or Windows.\"\"\"\n\n__author__ = 'Beech Horn'\n\nimport sys\nimport unittest\n\n\ndef suite():\n mods = ['context', 'eventloop', 'k... | python | chosen |
[
{
"from": "system",
"value": "Support Django 1.7 in test runner.\n"
},
{
"from": "human",
"value": "#!/usr/bin/env python\n\nfrom os.path import dirname, abspath\nimport sys\n\nfrom django.conf import settings\n\nif not settings.configured:\n from django import VERSION\n settings_dict = di... | python | chosen |
[
{
"from": "system",
"value": "FIX: Fix broken python 3 compatibility caused by unicode and bytes.\n"
},
{
"from": "human",
"value": "# -*- encoding: utf-8 -*-\n\"\"\"\n tests.stonemason.service.tileserver.test_tileserver\n ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\n\n Test int... | python | chosen |
[
{
"from": "system",
"value": "Add parser to basic resource\n"
},
{
"from": "human",
"value": "from flask.ext.restful import Resource, marshal\n\n\nclass BasicResource(Resource):\n\n def __init__(self):\n super(BasicResource, self).__init__()\n\n def response(self, data, code):\n ... | python | chosen |
[
{
"from": "system",
"value": "Set dsub version to 0.1.2-dev.\n\nPiperOrigin-RevId: 172923102\n"
},
{
"from": "human",
"value": "# Copyright 2017 Google Inc. All Rights Reserved.\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may not use this file except in complia... | python | chosen |
[
{
"from": "system",
"value": "Fix test for checking resource PDF generation\n"
},
{
"from": "human",
"value": "\"\"\"Tests for resource generation.\"\"\"\n\nimport os\nimport re\nfrom django.core import management\nfrom tests.BaseTestWithDB import BaseTestWithDB\nfrom resources.models import Res... | python | chosen |
[
{
"from": "system",
"value": "Fix typing and accept iterable instead of list\n"
},
{
"from": "human",
"value": "import rx\nfrom rx import operators as ops\nfrom rx.core import Observable\n\n\n\ndef _merge(*args) -> Observable:\n \"\"\"Merges all the observable sequences into a single observab... | python | chosen |
[
{
"from": "system",
"value": "Change julian date to be a property.\n"
},
{
"from": "human",
"value": "import datetime\nimport numpy as np\n\nclass Epoch(datetime.datetime):\n\tdef get_jd(self, epoch=2000):\n\t\tjd = (367.0 * self.year\n\t\t\t - np.floor( (7 * (self.year + np.floor( (self.month +... | python | chosen |
[
{
"from": "system",
"value": "Make it work properly with every number"
},
{
"from": "human",
"value": "import sys\nimport time\n\nindex = 0\nfor url_dict in range(100):\n time.sleep(0.1)\n index += 1\n\n percentual = \"%.2f%%\" % index\n sys.stdout.write('\\r[{0}{1}] {2}'.format('#' ... | python | chosen |
[
{
"from": "system",
"value": "Change version to 0.1 for the pull request\n"
},
{
"from": "human",
"value": "from distutils.core import setup\n\nlong_description = open(\"README.rst\").read()\nlong_description += \"\\n.. code-block:: python\\n\\n \"\nlong_description += \"\\n \".join(open(\... | python | chosen |
[
{
"from": "system",
"value": "Hide ember.js output from Travis.ci tests.\n"
},
{
"from": "human",
"value": "import os\nimport subprocess\nimport sys\nimport threading\nimport time\n\nfrom .run import Command as RunserverCommand\n\n\nclass Command(RunserverCommand):\n def run_tests(self):\n ... | python | chosen |
[
{
"from": "system",
"value": "Change tryserver.chromium.perf to watch chrome-try/try-perf\n\nso that perf bisect tryjobs are isolated to their own repo to avoid\ncross contamination.\n\nBUG=416009\n\nReview URL: https://codereview.chromium.org/588353002\n\ngit-svn-id: 239fca9b83025a0b6f823aeeca02ba5be3d9fd7... | python | chosen |
[
{
"from": "system",
"value": "Add some tests to make sure we can parse RSS feeds\n"
},
{
"from": "human",
"value": "from unittest import TestCase\n\nfrom ..parser import get_all_entries\nfrom .utils import get_test_rss_path\n\n\nclass BlogParserTest(TestCase):\n\n def setUp(self):\n se... | python | chosen |
[
{
"from": "system",
"value": "Tweak login required and auth settings to work with C3\n"
},
{
"from": "human",
"value": "# __BEGIN_LICENSE__\n# Copyright (C) 2008-2010 United States Government as represented by\n# the Administrator of the National Aeronautics and Space Administration.\n# All Righ... | python | chosen |
[
{
"from": "system",
"value": "Change TimeStampType to not accept negative values\n\nThis is to work around a Python bug (http://bugs.python.org/issue1777412)\n"
},
{
"from": "human",
"value": "from __future__ import absolute_import\n\nimport datetime\nfrom time import mktime\n\ntry:\n from da... | python | chosen |
[
{
"from": "system",
"value": "Fix error on Python 3\n"
},
{
"from": "human",
"value": "from ..target import Target\nimport hashlib\nimport dill\nimport joblib\n\nclass PyTarget(Target):\n def __init__(self, name, obj=None):\n self._name = name\n self._obj = obj\n super(Py... | python | chosen |
[
{
"from": "system",
"value": "Introduce dummy ManyToManyField with attrs metadata\n"
},
{
"from": "human",
"value": "from attr import ib, Factory\n\n\ndef Field(*args, **kwargs):\n default = kwargs.get('default')\n if callable(default):\n kwargs.pop('default')\n return ib(*ar... | python | chosen |
[
{
"from": "system",
"value": "Fix typo in class name."
},
{
"from": "human",
"value": "\"\"\"\nsentry.plugins.sentry_urls.models\n~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\n\n:copyright: (c) 2010-2012 by the Sentry Team, see AUTHORS for more details.\n:license: BSD, see LICENSE for more details.\n\"\"\"... | python | chosen |
[
{
"from": "system",
"value": "Fix JWTAuthentication active user check\n"
},
{
"from": "human",
"value": "from django.conf import settings\nfrom rest_framework import exceptions\nfrom rest_framework_jwt.authentication import JSONWebTokenAuthentication\nfrom rest_framework_jwt.settings import api_... | python | chosen |
[
{
"from": "system",
"value": "Drop trailing arg list comma to support Python 3.5\n"
},
{
"from": "human",
"value": "\"\"\"Version tools set.\"\"\"\n\nimport os\n\nfrom setuptools_scm import get_version\n\n\ndef get_version_from_scm_tag(\n *,\n root='.',\n relative_to=None,\n... | python | chosen |
[
{
"from": "system",
"value": "[f] Use `actual` in string format\n"
},
{
"from": "human",
"value": "from robber import expect\nfrom robber.matchers.base import Base\n\n\nclass Called(Base):\n \"\"\"\n expect(function).to.be.called()\n \"\"\"\n\n def matches(self):\n try:\n ... | python | chosen |
[
{
"from": "system",
"value": "Remove non-standard attribute in test user.\n"
},
{
"from": "human",
"value": "\"\"\"\nA static dictionary with SAML testusers that can be used as response.\n\"\"\"\nUSERS = {\n \"testuser1\": {\n \"sn\": [\"Testsson 1\"],\n \"givenName\": [\"Test 1... | python | chosen |
[
{
"from": "system",
"value": "Remove the job id in the test to have conssitent name that does not change\n"
},
{
"from": "human",
"value": "from os import environ\n\nJOB_ID = environ.get(\"TRAVIS_JOB_ID\", \"loc\")\nENTITY_MAX_LEN = 36\nBASE_NAME_MAX_LEN = ENTITY_MAX_LEN - 3 - 3 - 2\n\ncounters ... | python | chosen |
[
{
"from": "system",
"value": "Add 'enabled' argument to FieldEnabled to test negative values"
},
{
"from": "human",
"value": "# -*- coding: utf-8 -*-\n\n## \\package globals.fieldtests\n\n# MIT licensing\n# See: LICENSE.txt\n\n\nimport wx\n\n\n## Tests if a wx control/instance is enabled\n# \n#... | python | chosen |
[
{
"from": "system",
"value": "Add timeout to all tests\n"
},
{
"from": "human",
"value": "# -*- coding: utf-8 -*-\n#\n# Copyright © Spyder Project Contributors\n# Licensed under the terms of the MIT License\n#\n\n\"\"\"\nFile for running tests programmatically.\n\"\"\"\n\n# Third party imports\n... | python | chosen |
[
{
"from": "system",
"value": "Add \"loop until fail\" option to test runner (--loop)\n"
},
{
"from": "human",
"value": "#!/usr/bin/env python\n# -*- coding: utf-8 -*-\nfrom __future__ import print_function, division, absolute_import\n\nimport sys\nimport numba\n\nsys.exit(0 if numba.test(sys.arg... | python | chosen |
[
{
"from": "system",
"value": "Split up tests and fixed misspelling.\n"
},
{
"from": "human",
"value": "# -*- coding: utf-8 -*-\n\nimport pytest\n\nimport os\nimport todolist\nimport tempfile\n\nimport manage\n\n@pytest.fixture\ndef client(request):\n db_fd, todolist.app.config['DATABASE'] = t... | python | chosen |
[
{
"from": "system",
"value": "Test modified to check for exception in lack of ffmpeg in travis\n"
},
{
"from": "human",
"value": "#ToDo : Write tests for application interface\nimport pytest\nimport os\nfrom PyQt4.QtGui import *\nfrom PyQt4.QtCore import *\nfrom mp3wav.application import Mp3WavA... | python | chosen |
[
{
"from": "system",
"value": "Add overridden behaviour to testapp.\n"
},
{
"from": "human",
"value": "from django.db import models\nfrom binder.models import BinderModel\n\n# From the api docs: an animal with a name. We don't use the\n# CaseInsensitiveCharField because it's so much simpler to u... | python | chosen |
[
{
"from": "system",
"value": "Handle optional value in step.data\n"
},
{
"from": "human",
"value": "import json\n\nfrom changes.api.serializer import Serializer, register\nfrom changes.models import Plan, Step\n\n\n@register(Plan)\nclass PlanSerializer(Serializer):\n def serialize(self, insta... | python | chosen |
[
{
"from": "system",
"value": "Fix typo and move missing import into edit view\n"
},
{
"from": "human",
"value": "from django.shortcuts import render_to_response\nfrom django.contrib.auth.decorators import login_required\nfrom django.template.context import RequestContext\n#from google.appengine.... | python | chosen |
[
{
"from": "system",
"value": "Set default property screen 256 colors.\n"
},
{
"from": "human",
"value": "# -*- coding: utf-8 -*-\n\nimport urwid\n\ndef run_tag(tag, *args, **kwargs):\n loop = urwid.MainLoop(tag, *args, **kwargs)\n loop.run()\n\ndef quit_app():\n raise urwid.ExitMainLoop... | python | chosen |
[
{
"from": "system",
"value": "Handle args in the review helper.\n"
},
{
"from": "human",
"value": "#!/usr/bin/python\n\nimport json\n\nimport utils\n\n\ndef component_reviews(component, reviewer=None):\n cmd = ('ssh review.openstack.org gerrit query --format json '\n '--current-patc... | python | chosen |
[
{
"from": "system",
"value": "Sort cases by opened_on, not modified_on\n\nAddresses\nhttps://github.com/dimagi/commcare-hq/pull/10187/files#r51863935\n"
},
{
"from": "human",
"value": "from corehq.apps.es import CaseES\nfrom corehq.apps.es import FormES\n\n\ndef get_form_export_base_query(domain... | python | chosen |
[
{
"from": "system",
"value": "test: Update Provider Health Check sanity\n\nSee also: PSOBAT-2465\n"
},
{
"from": "human",
"value": "\"\"\"Test Provider Health Check setting.\"\"\"\nfrom foremast.pipeline.construct_pipeline_block import check_provider_healthcheck\n\nTEST_SETTINGS = {'app': {'eure... | python | chosen |
[
{
"from": "system",
"value": "Swap equality checks for `in`\n"
},
{
"from": "human",
"value": "from __future__ import absolute_import\n\nimport json\nfrom optparse import make_option\n\nfrom django.core.management.base import BaseCommand, CommandError\n\nfrom watchman.utils import get_checks\n\n... | python | chosen |
[
{
"from": "system",
"value": "Support seminars in addition to lectures and labs\n"
},
{
"from": "human",
"value": "from bs4 import BeautifulSoup\n\n\ndef extract_blocks(page):\n soup = BeautifulSoup(page)\n table_rows = soup.find_all('tr')\n blocks = []\n for i, row in enumerate(tabl... | python | chosen |
[
{
"from": "system",
"value": "Raise error if conditions attribute unimplemented.\n"
},
{
"from": "human",
"value": "from PyOpenWorm import *\n\n\nclass Experiment(DataObject):\n \"\"\"\n Generic class for storing information about experiments\n\n Should be overridden by specific types o... | python | chosen |
[
{
"from": "system",
"value": "Fix contact form - send to recipient, not managers\n"
},
{
"from": "human",
"value": "from django import forms\nfrom django.core.mail import mail_managers\nfrom django.utils.translation import ugettext as _\nfrom django.core.urlresolvers import reverse\nfrom crispy_... | python | chosen |
[
{
"from": "system",
"value": "Allow to specify output of a chain in the Graph class.\n"
},
{
"from": "human",
"value": "from bonobo.constants import BEGIN\n\n\nclass Graph:\n \"\"\"\n Represents a coherent directed acyclic graph of components.\n \"\"\"\n\n def __init__(self, *chain):... | python | chosen |
[
{
"from": "system",
"value": "doc: Update Neural Entity (now complete)\n"
},
{
"from": "human",
"value": "from Entity import *\n\nclass NeuralEntity(Entity):\n \"\"\"Entity the represents timestamps of action potentials, i.e. spike times.\n Cutouts of the waveforms corresponding to spike d... | python | chosen |
[
{
"from": "system",
"value": "Allow variables at root level for yaml definitions.\n\ngit-svn-id: ad91b9aa7ba7638d69f912c9f5d012e3326e9f74@1062 3942dd89-8c5d-46d7-aeed-044bccf3e60c\n"
},
{
"from": "human",
"value": "import logging\nfrom flexget.manager import Session\nfrom flexget.plugin import *... | python | chosen |
[
{
"from": "system",
"value": "Improve comment in setup module\n"
},
{
"from": "human",
"value": "from pathlib import Path\n\nSETTINGS_PATH = 'conf/settings.py'\nPARTIALS_PATH = 'conf/partials.txt'\nHOME_DIR = 'HOME'\n\n\ndef load_config(path=SETTINGS_PATH):\n settings = eval(open(path).read()... | python | chosen |
[
{
"from": "system",
"value": "Change logging to use print because of logger configuration error\n"
},
{
"from": "human",
"value": "# -*- coding: utf-8 -*-\nimport ConfigParser\nimport logging\n\nclass PropertiesParser(object):\n\n \"\"\"Parse a java like properties file\n\n Parser wrapping... | python | chosen |
[
{
"from": "system",
"value": "Correct the 'reference' format transform method\n\nCurrently, the 'reference' format transform method will traversal the\nmetrics list and reconstruct every item of the list to add tenant_id and\nregion info, but new transformed metrics list will use the reference\nof the local... | python | chosen |
[
{
"from": "system",
"value": "Change command option format.\n- proxy_mode into proxy-mode\n- viewer_type into viewer-mode\n"
},
{
"from": "human",
"value": "import argparse\nfrom microproxy import proxy\nfrom microproxy.viewer import log as log_viewer\n\n\ndef proxy_handler(args):\n proxy... | python | chosen |
[
{
"from": "system",
"value": "Put port back to 5000. Missed change from integration testing...\n"
},
{
"from": "human",
"value": "__author__ = 'Chad Peterson'\n__email__ = 'chapeter@cisco.com'\n\nfrom CHROnIC_Portal import app\n\n\napp.secret_key = '1234'\napp.run(host='0.0.0.0', port=5001, debu... | python | chosen |
[
{
"from": "system",
"value": "[IMP] account_invoice_comment_template: Move comment_template_id field to the Invoicing tab\n\n[IMP] account_invoice_comment_template: rename partner field name from comment_template_id to invoice_comment_template_id\n\n[IMP] account_invoice_comment_template: Make partner field... | python | chosen |
[
{
"from": "human",
"value": "Add solution for `Valid Braces`\n"
},
{
"from": "gpt",
"value": "# Valid Braces\n# http://www.codewars.com/kata/5277c8a221e209d3f6000b56/train/python\n\n\nimport unittest\n\n\ndef valid_braces(string: str) -> bool:\n stack = []\n\n braces = {')': '(', '}': '{',... | python | chosen |
[
{
"from": "system",
"value": "Tweak console output on startup\n"
},
{
"from": "human",
"value": "__author__ = 'Matt Stibbs'\n__version__ = '1.26.04'\ntarget_schema_version = '1.25.00'\n\nfrom flask import Flask\napp = Flask(__name__)\n\n\ndef startup():\n import blockbuster.bb_dbconnector_fac... | python | chosen |
[
{
"from": "system",
"value": "Implement Toshley, Mekgineer Thermaplugg and Gazlowe\n"
},
{
"from": "human",
"value": "from ..utils import *\n\n\n##\n# Minions\n\n# Dr. Boom\nclass GVG_110:\n\taction = [Summon(CONTROLLER, \"GVG_110t\") * 2]\n\n# Boom Bot\nclass GVG_110t:\n\tdef deathrattle(self):... | python | chosen |
[
{
"from": "system",
"value": "Increase the number of backill_meta_created iterations\n"
},
{
"from": "human",
"value": "#!/usr/bin/env python\n\n# Copyright (C) 2019 Lukas Lalinsky\n# Distributed under the MIT license, see the LICENSE file for details.\n\nimport logging\n\nlogger = logging.getLo... | python | chosen |
[
{
"from": "system",
"value": "Add functions to read/write to a record file\n"
},
{
"from": "human",
"value": "\"\"\"Where player runs the game\"\"\"\n\nimport random\nimport time\n\nimport board\nimport conversion\nimport games\n\nif __name__ == '__main__':\n NUMBER_OF_TRIALS = 1\n for i i... | python | chosen |
[
{
"from": "system",
"value": "Update TAS versions we test against\n"
},
{
"from": "human",
"value": "#!/usr/bin/env python\n\nimport os\nfrom jinja2 import Template\n\nclusters = ['2_7_lts', '2_9', '2_10', '2_11_lts2']\n# Commenting out this as we only have one example and it breaks\ntiles = [] ... | python | chosen |
[
{
"from": "system",
"value": "Allow specifying what exit code to use when emulating process exit\n"
},
{
"from": "human",
"value": "from twisted.internet._baseprocess import BaseProcess\nfrom carnifex.inductor import ProcessInductor\nfrom twisted.internet.error import ProcessTerminated, ProcessD... | python | chosen |
[
{
"from": "system",
"value": "Remove mixer section from synth code to reflect the components directly calling pygame mixer methods.\n"
},
{
"from": "human",
"value": "import Axon\nfrom Kamaelia.Apps.Jam.Audio.Polyphony import Polyphoniser\nfrom Kamaelia.Apps.Jam.Audio.Mixer import MonoMixer\n\nc... | python | chosen |
[
{
"from": "system",
"value": "Improve jinja filter date converter\n\nThe filter now can convert date which are strings and not datetime objects.\n"
},
{
"from": "human",
"value": "# -*- coding: utf-8 -*-\nfrom cineapp import app\n\n@app.template_filter()\ndef minutes_to_human_duration(minutes_du... | python | chosen |
[
{
"from": "system",
"value": "Update \"Ctrl+Alt+Del\" after site change\n"
},
{
"from": "human",
"value": "from comics.aggregator.crawler import CrawlerBase, CrawlerImage\nfrom comics.core.comic_data import ComicDataBase\n\n\nclass ComicData(ComicDataBase):\n name = \"Ctrl+Alt+Del\"\n lang... | python | chosen |
[
{
"from": "system",
"value": "Check if Onboarding exists before creating.\n"
},
{
"from": "human",
"value": "# -*- coding: utf-8 -*-\nfrom __future__ import unicode_literals\n\nfrom django.db import migrations, models\n\n\ndef forwards(apps, schema_editor):\n \"\"\"Create Onboarding group.\"\... | python | chosen |
[
{
"from": "system",
"value": "Fix login error for new accounts where a profile doesn't exist\n"
},
{
"from": "human",
"value": "from django.db import models\nfrom django.db.models import signals\nfrom django.contrib.auth.models import User\nfrom course.models import Term\n\nclass Profile(models.... | python | chosen |
[
{
"from": "system",
"value": "Add case sensitivity to field and clarify analyzer.\n"
},
{
"from": "human",
"value": "from elasticsearch_dsl import String, Nested, Boolean, DocType, tokenizer, analyzer\n\n\n# Required for case sensitivity\nmetadata_analyzer = analyzer(\"metadata_analyzer\", token... | python | chosen |
[
{
"from": "system",
"value": "Add django pytest mark to process raw test\n"
},
{
"from": "human",
"value": "import pytest\n\nimport os\nos.environ.setdefault(\"DJANGO_SETTINGS_MODULE\", \"api.api.settings\")\n\nfrom . import utils\nfrom scrapi.linter.document import NormalizedDocument, RawDocume... | python | chosen |
[
{
"from": "system",
"value": "Fix backend home page url generator\n"
},
{
"from": "human",
"value": "import json\nimport os\nimport re\nfrom django.urls import re_path\nfrom civictechprojects import views\n\n\ndef url_generator_from_pattern(pattern):\n return re.sub(\"\\\\(.+\\\\)\", \"{id}\"... | python | chosen |
[
{
"from": "system",
"value": "Clean up internal hacking util\n"
},
{
"from": "human",
"value": "import sys\nsys.path.insert(0, '../..')\n\nfrom pycparser import c_parser, c_ast, parse_file\n\n\nif __name__ == \"__main__\":\n #ast = parse_file('zc_pp.c', use_cpp=True, cpp_path=\"../cpp.exe\")\... | python | chosen |
[
{
"from": "system",
"value": "Add error message to BadRequest signup response for invalid method\n"
},
{
"from": "human",
"value": "from django.http import JsonResponse, HttpResponse, HttpResponseBadRequest\nfrom django.views.decorators.csrf import csrf_exempt\nimport json\nfrom helpers import g... | python | chosen |
[
{
"from": "system",
"value": "Fix parsing data from request\n\nThe object passed to the parser method is not a real IOBase stream. It may only\nbe a Request object which has read, etc. methods. Therefore the real data must\nbe encapsulated in a BytesIO stream before changing the content type.\n"
},
{
... | python | chosen |
[
{
"from": "system",
"value": "Make avg() work with iterators\n"
},
{
"from": "human",
"value": "import json\n\ndef avg(iterable):\n return sum(iterable) / len(iterable)\n\ndef nice_json_dump(data, filepath):\n with open(filepath, 'w') as f:\n json.dump(data, f, sort_keys=True, inden... | python | chosen |
[
{
"from": "system",
"value": "Modify index url and static folders\n"
},
{
"from": "human",
"value": "from django.conf.urls import patterns, include, url\n\nfrom django.contrib import admin\nadmin.autodiscover()\n\nurlpatterns = patterns('',\n # Examples:\n # url(r'^$', 'auwsssp.views.home... | python | chosen |
[
{
"from": "system",
"value": "Fix url that was wrongly converted to django3.\n"
},
{
"from": "human",
"value": "from django.urls import path\n\nfrom django_cradmin import viewhelpers\n\nfrom .views import overview\n\nurlpatterns = [\n path('simple/<str:mockname>',\n viewhelpers.uimock... | python | chosen |
[
{
"from": "system",
"value": "Use reverse function in tests\n"
},
{
"from": "human",
"value": "from django.core.urlresolvers import reverse\nimport pytest\n\nfrom saleor.userprofile.impersonate import can_impersonate\nfrom saleor.userprofile.models import User\n\ndef test_staff_with_permission_c... | python | chosen |
[
{
"from": "system",
"value": "Add auto branch checkout functionality\n"
},
{
"from": "human",
"value": "#!/usr/bin/env python\n# -*- coding: utf-8 -*-\n\nimport subprocess\nfrom ..utils import DEVNULL, change_working_directory\nfrom .base import DOWNLOAD_CONTAINER\n\n\ndef download(source_info):... | python | chosen |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.