conversations listlengths 2 3 | source stringclasses 1
value | stack stringclasses 1
value |
|---|---|---|
[
{
"from": "system",
"value": "Print video title in quotes\n"
},
{
"from": "human",
"value": "#!/usr/bin/env python\n\nimport data\n\n\ns = data.Session()\nfor video in s.query(data.Video):\n print u'+++ Downloading {} +++'.format(video.title)\n video.download()\ndel s\n"
},
{
"from... | python | chosen |
[
{
"from": "system",
"value": "Use -Werror for code examples\n"
},
{
"from": "human",
"value": "#!/usr/bin/env python\n\nimport glob\nimport os\nimport platform\nimport subprocess\nimport sys\n\ncx_path = sys.argv[1] if len(sys.argv) > 1 else \"cx\"\n\nos.chdir(os.path.dirname(__file__))\n\nfor f... | python | chosen |
[
{
"from": "system",
"value": "Reduce queries on all pages by using select_related in the get_tabs template tag.\n"
},
{
"from": "human",
"value": "from django import template\n\nfrom homepage.models import Tab\n\nregister = template.Library()\n\n@register.tag(name=\"get_tabs\")\ndef get_tabs(par... | python | chosen |
[
{
"from": "human",
"value": "Add Error class as base for error codes\n\nAdd docstrings to error class\n"
},
{
"from": "gpt",
"value": "from collections import namedtuple\n\n\nclass Error(namedtuple('Error', ['file', 'line_number', 'code', 'message'])):\n \"\"\"Error class creates error codes ... | python | chosen |
[
{
"from": "system",
"value": "Make bundle view accessible to anyone\n"
},
{
"from": "human",
"value": "from django.views.generic import DetailView, ListView\n\nfrom rest_framework import filters, generics, permissions\nfrom rest_framework.response import Response\n\nfrom . import models, seriali... | python | chosen |
[
{
"from": "system",
"value": "Enable Shapely speedups when available.\n\nhttp://toblerity.org/shapely/manual.html#performance\n"
},
{
"from": "human",
"value": "from . import encoder\nfrom . import decoder\n\n\ndef decode(tile, y_coord_down=False):\n vector_tile = decoder.TileData()\n mess... | python | chosen |
[
{
"from": "system",
"value": "Add class docstring to Social\n"
},
{
"from": "human",
"value": "from .base import AuthenticationBase\n\n\nclass Social(AuthenticationBase):\n\n def __init__(self, domain):\n self.domain = domain\n\n def login(self, client_id, access_token, connection):... | python | chosen |
[
{
"from": "system",
"value": "Change to rpio and add clean\n"
},
{
"from": "human",
"value": "import configparser\nimport time\nimport RPIO as GPIO\n\nfrom client import MumbleClient\n\nclass InterCom:\n\n def __init__(self):\n config = configparser.ConfigParser()\n config.read(... | python | chosen |
[
{
"from": "system",
"value": "[RUN_TESTS] Move all imports to top-of-module, don't hide cleanup output.\n"
},
{
"from": "human",
"value": "#!/usr/bin/env python3\n\"\"\"Run tests under a consistent environment...\n\nWhether run from the terminal, in CI or from the editor this file makes sure\nth... | python | chosen |
[
{
"from": "system",
"value": "Add logging to keyword data migration\n"
},
{
"from": "human",
"value": "# -*- coding: utf-8 -*-\n# Generated by Django 1.9.11 on 2016-12-02 15:46\nfrom __future__ import unicode_literals\n\nfrom django.db import migrations, models\n\n\ndef forward(apps, schema_edit... | python | chosen |
[
{
"from": "system",
"value": "Improve WSGI file for apache deployment/database configuration management\n"
},
{
"from": "human",
"value": "\"\"\"\nWSGI config for cellcounter project.\n\nThis module contains the WSGI application used by Django's development server\nand any production WSGI deploy... | python | chosen |
[
{
"from": "system",
"value": "Add option to get temppath from properties file\n"
},
{
"from": "human",
"value": "######\n# Set the Version Stamp to actual time and date\n#\n# Author: Christoph Stoettner\n# Mail: christoph.stoettner@stoeps.de\n# Documentation: http://scripting... | python | chosen |
[
{
"from": "system",
"value": "Remove force_load which was added in later versions.\n"
},
{
"from": "human",
"value": "from __future__ import unicode_literals\n\nfrom django.core.management.base import NoArgsCommand, CommandError\n\nfrom allaccess.models import Provider \n\n\nclass Command(NoArgs... | python | chosen |
[
{
"from": "system",
"value": "Add argument option for --interactive.\n"
},
{
"from": "human",
"value": "#!/usr/bin/env python\n\nimport sys\nimport argparse\nfrom akaudit.audit import Auditer\n\ndef main(argv = sys.argv, log = sys.stderr):\n\tparser = argparse.ArgumentParser(description='Audit w... | python | chosen |
[
{
"from": "system",
"value": "Change high calorie threshold to 300\n"
},
{
"from": "human",
"value": "\"\"\"This is the top-level amaranth module init file.\n\nThe only current use of this class is to define common constants.\n\"\"\"\n\nLOW_CALORIE_THRESHOLD = 100\nHIGH_CALORIE_THRESHOLD = 500\n... | python | chosen |
[
{
"from": "system",
"value": "Implement Piloted Sky Golem, Junkbot and Enhance-o Mechano\n"
},
{
"from": "human",
"value": "from ..utils import *\n\n\n##\n# Minions\n\n# Hobgoblin\nclass GVG_104:\n\tdef OWN_CARD_PLAYED(self, card):\n\t\tif card.type == CardType.MINION and card.atk == 1:\n\t\t\tr... | python | chosen |
[
{
"from": "system",
"value": "Add warning on running repository's tests with pytest-testdox installed\n\nFix #13\n"
},
{
"from": "human",
"value": "# -*- coding: utf-8 -*-\npytest_plugins = 'pytester'\n"
},
{
"from": "gpt",
"value": "# -*- coding: utf-8 -*-\nimport os\nimport warning... | python | chosen |
[
{
"from": "system",
"value": "Make test runner work with blank mysql password\n"
},
{
"from": "human",
"value": "import os\nimport os.path\nimport configparser\nimport shutil\nimport subprocess\n\n# Setup\nprint(\"Setting up...\")\nif os.path.isfile(\"../halite.ini\"):\n shutil.copyfile(\"../... | python | chosen |
[
{
"from": "system",
"value": "Add base directory capability to empy engine.\n"
},
{
"from": "human",
"value": "#!/usr/bin/env python\n\"\"\"Provide the empy templating engine.\"\"\"\n\nfrom __future__ import print_function\n\n\nimport em\n\nfrom . import Engine\n\n\nclass EmpyEngine(Engine):\n\n... | python | chosen |
[
{
"from": "system",
"value": "Allow searching by name in AuthorAdmin\n"
},
{
"from": "human",
"value": "from django.contrib import admin\n\nfrom .models import Author, Book, Note, Tag, Section\n\n\n@admin.register(Author)\nclass AuthorAdmin(admin.ModelAdmin):\n list_display = ['name', 'goodre... | python | chosen |
[
{
"from": "system",
"value": "Add utilities for computing metrics\n"
},
{
"from": "human",
"value": "def overlapping(interval_a, interval_b):\n al, ah = interval_a\n bl, bh = interval_b\n\n if al > ah:\n raise ValueError(\"Interval A bounds are inverted\")\n\n if bl > bh:\n ... | python | chosen |
[
{
"from": "system",
"value": "Use command-line argument to specify data."
},
{
"from": "human",
"value": "# System imports first\nimport sys\n\n# Module (local) imports\nfrom import_data import import_data\nfrom process import process_data, normalize, rotate_data\nfrom output import plot_data\n\... | python | chosen |
[
{
"from": "system",
"value": "Make helper functions full `@deploy`s so they support global pyinfra kwargs.\n"
},
{
"from": "human",
"value": "from .configure import configure_kubeconfig, configure_kubernetes_component\nfrom .install import install_kubernetes\n\n\ndef deploy_kubernetes_master(etc... | python | chosen |
[
{
"from": "system",
"value": "Test suite should pass even if example dependencies are not present\n"
},
{
"from": "human",
"value": "import glob\nfrom libmproxy import utils, script\nfrom libmproxy.proxy import config\nimport tservers\n\ndef test_load_scripts():\n example_dir = utils.Data(\"l... | python | chosen |
[
{
"from": "system",
"value": "Revert commit of local changes\n"
},
{
"from": "human",
"value": "# -*- coding: utf-8 -*-\nimport sys\n\nif any([arg in {'discover', 'setup.py', 'test'} for arg in sys.argv]):\n test_examples = True\n test_all_examples = False\n show_plots = False\nelif any... | python | chosen |
[
{
"from": "system",
"value": "Rename visualize to viz in CDF\n"
},
{
"from": "human",
"value": "from geopandas import GeoDataFrame\n\nfrom ..utils.geom_utils import generate_index, generate_geometry\n\n\nclass CartoDataFrame(GeoDataFrame):\n\n def __init__(self, *args, **kwargs):\n sup... | python | chosen |
[
{
"from": "human",
"value": "Work around leak in older pygobject\n\nWith older pygobject, any use of the default getter/setters\ngenerated by gobject.property() would leak. If we detect this\nis the case, monkey patch in the fixed version of the default\ngetters/setters.\n(See https://bugzilla.gnome.org/sh... | python | chosen |
[
{
"from": "system",
"value": "Add a few exception strings\n"
},
{
"from": "human",
"value": "from client.sources.common import importing\nfrom client.sources.doctest import models\nimport logging\nimport os\n\nlog = logging.getLogger(__name__)\n\ndef load(file, name, args):\n \"\"\"Loads doct... | python | chosen |
[
{
"from": "system",
"value": "[LEGAL] Use global LICENSE/COPYRIGHT files, remove boilerplate text\n\n- Preserved explicit 3rd-party copyright notices\n- Explicit boilerplate should not be necessary - copyright law applies\n automatically in all countries thanks to Berne Convention + WTO rules,\n and a ref... | python | chosen |
[
{
"from": "system",
"value": "Complete preorder recur sol w/ time/space complexity\n"
},
{
"from": "human",
"value": "\"\"\"Leetcode 222. Count Complete Tree Nodes\nMedium\n\nURL: https://leetcode.com/problems/count-complete-tree-nodes/\n\nGiven a complete binary tree, count the number of nodes.... | python | chosen |
[
{
"from": "system",
"value": "Use dict as a context object for Django 1.11 compatibility\n\nDjango’s template rendering in 1.11 needs a dictionary as the context\ninstead of the object Context, otherwise the following error is raised:\ncontext must be a dict rather than Context.\n"
},
{
"from": "hum... | python | chosen |
[
{
"from": "system",
"value": "Use importlib.import_module instead of built-in __import__.\n"
},
{
"from": "human",
"value": "# -*- coding: utf-8 -*-\n\"\"\"__init__.py: Language-dependent features.\n\"\"\"\n\nmodule_cache = {}\n\ndef get_language(lang_code):\n \"\"\"Return module with languag... | python | chosen |
[
{
"from": "system",
"value": "Fix a bug in redis queue\n"
},
{
"from": "human",
"value": "# -*- coding: utf-8 -*-\n\nimport redis\n\nclass RedisQueue(object):\n \"\"\"Simple Queue with Redis Backend\"\"\"\n def __init__(self, name, namespace='queue', **redis_kwargs):\n \"\"\"The def... | python | chosen |
[
{
"from": "system",
"value": "Include classes in package definition\n"
},
{
"from": "human",
"value": "\"\"\"BMI Live clinic\"\"\"\nimport os\n\n\npkg_directory = os.path.dirname(__file__)\ndata_directory = os.path.join(pkg_directory, 'data')\n"
},
{
"from": "gpt",
"value": "\"\"\"BM... | python | chosen |
[
{
"from": "system",
"value": "Add fields to working file model\n\n* Software\n* List of output files generated\n* Path used to store the working file\n"
},
{
"from": "human",
"value": "from sqlalchemy_utils import UUIDType\n\nfrom zou.app import db\nfrom zou.app.models.serializer import Serializ... | python | chosen |
[
{
"from": "system",
"value": "Fix remaining include_dirs that imported numpy ('numpy' gets replaced at build-time). This is necessary for egg_info to work."
},
{
"from": "human",
"value": "import os\nimport numpy\nfrom distutils.extension import Extension\n\nTIMEROOT = os.path.relpath(os.path.di... | python | chosen |
[
{
"from": "system",
"value": "Add a get prepared date method\n\nChild pages won't necessarily have a prepared date and it makes sense to\nuse the parent date to avoid repetition.\n"
},
{
"from": "human",
"value": "from django.db import models\n\ndef register(cls, admin_cls):\n cls.add_to_clas... | python | chosen |
[
{
"from": "system",
"value": "views: Use url_for for base redirection\n"
},
{
"from": "human",
"value": "from flask import redirect\n\nfrom skylines import app\n\nimport skylines.views.i18n\nimport skylines.views.login\nimport skylines.views.search\n\nfrom skylines.views.about import about_bluep... | python | chosen |
[
{
"from": "system",
"value": "Replace list with tuple in start new thread\n"
},
{
"from": "human",
"value": "from django.conf.urls import patterns, include, url\n\nimport stadtgedaechtnis_backend.admin\nimport settings\nfrom thread import start_new_thread\n\njs_info_dict = {\n 'packages': ('s... | python | chosen |
[
{
"from": "system",
"value": "Patch update_contenttypes so that it's less likely to fail due to eventual consistency\n"
},
{
"from": "human",
"value": "from django.db import models\n\nclass CounterShard(models.Model):\n count = models.PositiveIntegerField()\n"
},
{
"from": "gpt",
... | python | chosen |
[
{
"from": "system",
"value": "Fix another failing unit test (from metrics work).\n"
},
{
"from": "human",
"value": "from os.path import exists, join\nimport shutil\nimport tempfile\nimport time\n\nfrom lwr.managers.queued import QueueManager\nfrom lwr.managers.stateful import StatefulManagerProx... | python | chosen |
[
{
"from": "system",
"value": "Add missing names to module namespace.\n"
},
{
"from": "human",
"value": "from .Averager import Averager\nfrom .Config import Config\nfrom .RateTicker import RateTicker\nfrom .Ring import Ring\nfrom .SortedList import SortedList\nfrom .String import string2time, tim... | python | chosen |
[
{
"from": "system",
"value": "Add some basic error handling in case the executables don't exist\n"
},
{
"from": "human",
"value": "#pylint: disable=C0111,R0903\n\n\"\"\"Enable/disable automatic screen locking.\n\nRequires the following executables:\n * xdg-screensaver\n * notify-send\n\"\"... | python | chosen |
[
{
"from": "system",
"value": "[Order] Order 2: Login system by https\n"
},
{
"from": "human",
"value": "import json\nimport requests\n\n\"\"\" Order 2: Login system by https\n\n```\ncurl -k https://192.168.105.88/axapi/v3/auth -H \"Content-type:application/json\" -d '{\n \"credentials\": {\n ... | python | chosen |
[
{
"from": "system",
"value": "Replace broken babel documentation link\n\nAccording to Babel's PyPI package page, http://babel.pocoo.org/docs/ is\nthe official documentation website.\n"
},
{
"from": "human",
"value": "from decimal import Decimal as D, InvalidOperation\n\nfrom django import templa... | python | chosen |
[
{
"from": "system",
"value": "Handle case when char is mapped to empty (removed) and table is inverted\n"
},
{
"from": "human",
"value": "class Transliterator(object):\n\n def __init__(self, mapping, invert=False):\n self.mapping = [\n (v, k) if invert else (k, v)\n ... | python | chosen |
[
{
"from": "system",
"value": "Update for python 3 and new idx design\n\nidx no longer writes to files, it only processes bytes\n"
},
{
"from": "human",
"value": "from .. import idx\nimport os\n\ndef test__find_depth():\n yield check__find_depth, 9, 0\n yield check__find_depth, [1, 2], 1\n ... | python | chosen |
[
{
"from": "system",
"value": "Update dsub version to 0.3.10\n\nPiperOrigin-RevId: 324884094\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 complian... | python | chosen |
[
{
"from": "system",
"value": "Switch from generic TemplateView to new StatusView\n"
},
{
"from": "human",
"value": "from django.conf.urls import patterns, include, url\nfrom django.views.generic import TemplateView\n\nurlpatterns = patterns('',\n # Examples:\n # url(r'^$', 'fbxnano.views.h... | python | chosen |
[
{
"from": "system",
"value": "Add maxlength to taskid schema\n"
},
{
"from": "human",
"value": "from .factory import FactoryTask\nfrom .report import ReportTask\nfrom .sleep import SleepTask\n\n\n# Generic schema to reference a task ID\nTASKID_SCHEMA = {\n 'type': 'string',\n 'description'... | python | chosen |
[
{
"from": "system",
"value": "Fix trailing newline getting dropped\n\nSigned-off-by: Gilles Peskine <f805f64266d288fc5467baa7be6cd0ff366f477b@arm.com>\n"
},
{
"from": "human",
"value": "#!/usr/bin/env python3\n\nimport sys\nimport json\nimport os\nimport jinja2\n\ndef render(tpl_path):\n path... | python | chosen |
[
{
"from": "system",
"value": "Clean up test for version number\n\nA new function is implemented to cleanly extract the version field from the\nREADME.rst field list.\n"
},
{
"from": "human",
"value": "class TestVersion:\n def test_version_is_consistent(self):\n from .. import VERSION\n... | python | chosen |
[
{
"from": "system",
"value": "Add date_registered to node serializer\n\n[#OSF-7230]\n"
},
{
"from": "human",
"value": "import json\n\nfrom website.util.permissions import reduce_permissions\n\nfrom admin.users.serializers import serialize_simple_node\n\n\ndef serialize_node(node):\n embargo =... | python | chosen |
[
{
"from": "system",
"value": "Add support for flake8 3.0\n"
},
{
"from": "human",
"value": "# coding: utf-8\nfrom __future__ import unicode_literals, division, absolute_import, print_function\n\nimport os\n\nfrom flake8.engine import get_style_guide\n\n\ncur_dir = os.path.dirname(__file__)\nconf... | python | chosen |
[
{
"from": "system",
"value": "Add link to defined colors to example theme\n"
},
{
"from": "human",
"value": "# Supported 16 color values:\n# 'h0' (color number 0) through 'h15' (color number 15)\n# or\n# 'default' (use the terminal's default foreground),\n# 'black', 'dark red', 'dark gr... | python | chosen |
[
{
"from": "system",
"value": "BUGFIX: Index route should only match on '/'\n"
},
{
"from": "human",
"value": "from django.conf.urls import url, include\nfrom django.views.generic import TemplateView\nfrom rest_framework import routers\n\nfrom .views import FeatureRequestViewSet, ClientViewSet, P... | python | chosen |
[
{
"from": "system",
"value": "Adjust the module __version__ to match the version advertised in PyPI.\n\n--HG--\nbranch : intellectronica/adjust-the-module-__version__-to-match-t-1371450045566\n"
},
{
"from": "human",
"value": "# Copyright 2013 Getlogic BV, Sardar Yumatov\n#\n# Licensed under the... | python | chosen |
[
{
"from": "system",
"value": "Fix the typos, fix the build.\n"
},
{
"from": "human",
"value": "\nclass Fsharp31Package(GitHubTarballPackage):\n\tdef __init__(self):\n\t\tGitHubTarballPackage.__init__(self,\n\t\t\t'fsharp', 'fsharp',\n\t\t\t'3.1.1.31',\n\t\t\t'1f79c0455fb8b5ec816985f922413894ce19... | python | chosen |
[
{
"from": "system",
"value": "Return empty dictionary instead of None\n"
},
{
"from": "human",
"value": "\"\"\"Workflow execution engines.\"\"\"\nfrom resolwe.flow.engine import BaseEngine\n\n\nclass BaseExecutionEngine(BaseEngine):\n \"\"\"A workflow execution engine.\"\"\"\n\n def evalua... | python | chosen |
[
{
"from": "system",
"value": "Remove copy-pasted code, add helper for making legacy reference number for payments\n"
},
{
"from": "human",
"value": "# -*- coding: utf-8 -*-\nimport environ\nenv = environ.Env()\nHOLVI_CNC = False\n\ndef get_holvi_singleton():\n global HOLVI_CNC\n if HOLVI_C... | python | chosen |
[
{
"from": "system",
"value": "Update header_decode to handle bare and non-bare quoted-printable chars\n\nSigned-off-by: Chris Lamb <711c73f64afdce07b7e38039a96d2224209e9a6c@chris-lamb.co.uk>\n"
},
{
"from": "human",
"value": "# -*- coding: utf-8 -*-\n\nimport email.quoprimime\n\ndef quoted_print... | python | chosen |
[
{
"from": "system",
"value": "Add link states to polymer_states\n"
},
{
"from": "human",
"value": "# This Source Code Form is subject to the terms of the Mozilla Public\n# License, v. 2.0. If a copy of the MPL was not distributed with this\n# file, You can obtain one at http://mozilla.org/MPL... | python | chosen |
[
{
"from": "system",
"value": "DOC: Modify generator example to use single calculation transform\n"
},
{
"from": "human",
"value": "\"\"\"\nLine Chart with Sequence Generator\n----------------------------------\nThis examples shows how to create multiple lines using the sequence generator.\n\"\"\... | python | chosen |
[
{
"from": "system",
"value": "Resolve config from envvar relative to cwd\n"
},
{
"from": "human",
"value": "from flask import Flask\nfrom flask.ext.sqlalchemy import SQLAlchemy\nfrom logging import getLogger\nimport os\nimport pwm\n\ndb = SQLAlchemy()\n_logger = getLogger('pwm_server')\n\nclass ... | python | chosen |
[
{
"from": "system",
"value": "Add test for late-binding views\n"
},
{
"from": "human",
"value": "from sqlalchemy import MetaData, Table, inspect\nfrom sqlalchemy.schema import CreateTable\n\nfrom rs_sqla_test_utils.utils import clean, compile_query\n\n\ndef table_to_ddl(engine, table):\n retu... | python | chosen |
[
{
"from": "system",
"value": "Allow to import subclasses of layers\n\nSummary:\nWe want it to be able to register children of layers who\nare not direct children of ModelLayer.\nThis requires us to find subclasses of ModelLayer recursively.\n\nReviewed By: kittipatv, kennyhorror\n\nDifferential Revision: D5... | python | chosen |
[
{
"from": "system",
"value": "Write test for container containment.\n"
},
{
"from": "human",
"value": "from unittest import TestCase\n\nfrom basics import BaseCharacter\nfrom basics import BaseAttachment\n\n\nclass ModuleTest(TestCase):\n\n def test_character_attach_attachment(self):\n ... | python | chosen |
[
{
"from": "system",
"value": "Use base64 module to convert between bytes and base16 string\n"
},
{
"from": "human",
"value": "# coding: utf-8\n\nimport flynn.decoder\nimport flynn.encoder\n\ndef dump(obj, fp):\n\treturn flynn.encoder.encode(fp, obj)\n\ndef dumps(obj):\n\treturn flynn.encoder.enc... | python | chosen |
[
{
"from": "system",
"value": "[AC-5291] Add Notes and Internal Fields\n"
},
{
"from": "human",
"value": "# MIT License\n# Copyright (c) 2017 MassChallenge, Inc.\n\nfrom impact.models import RefundCode\nfrom impact.v1.helpers.model_helper import(\n INTEGER_ARRAY_FIELD,\n INTEGER_FIELD,\n ... | python | chosen |
[
{
"from": "system",
"value": "Exclude dark-colored theme from stylesheet gallery.\n"
},
{
"from": "human",
"value": "# -*- coding: utf-8 -*-\n\"\"\"Generate a gallery to compare all available typhon styles.\n\"\"\"\nimport numpy as np\nimport matplotlib.pyplot as plt\nfrom typhon.plots import st... | python | chosen |
[
{
"from": "system",
"value": "4: Create script to save documentation to a file \n\nTask-Url: http://github.com/stoeps13/ibmcnx2/issues/issue/4"
},
{
"from": "human",
"value": "######\n# Check ExId (GUID) by Email through JDBC\n#\n# Author: Christoph Stoettner\n# Mail: christop... | python | chosen |
[
{
"from": "system",
"value": "Improve prefetch speed in predict listing pages\n"
},
{
"from": "human",
"value": "\"\"\"\nBasic view mixins for predict views\n\"\"\"\n\nfrom django.utils.decorators import method_decorator\nfrom django.contrib.auth.decorators import login_required\n\nfrom .models ... | python | chosen |
[
{
"from": "system",
"value": "Use select_related in user profile detail view\n"
},
{
"from": "human",
"value": "from django.views.generic import DetailView, UpdateView\nfrom django.contrib.auth.views import redirect_to_login\nfrom django.core.urlresolvers import reverse\nfrom django.shortcuts im... | python | chosen |
[
{
"from": "system",
"value": "Add enabled to top-level instrument class.\n"
},
{
"from": "human",
"value": "from traits.api import HasTraits\n\nimport json\n\nclass Instrument(HasTraits):\n\t\"\"\"\n\tMain super-class for all instruments.\n\t\"\"\"\n\n\tdef get_settings(self):\n\t\treturn self._... | python | chosen |
[
{
"from": "system",
"value": "Insert look-around helpers into ipdb context\n\nThese are `ast` and `to_source`.\n"
},
{
"from": "human",
"value": "#!/usr/bin/env python\nimport sys\n\nfrom funcy import split, map\n\nfrom .analysis import global_usage, local_usage, FileSet\n\n\ndef main():\n co... | python | chosen |
[
{
"from": "system",
"value": "Add build and write function to make it easy to subclass Generate and overwrite build step\n"
},
{
"from": "human",
"value": "# -*- coding: utf-8 -*-\nimport os\nimport shutil\n\nfrom logya.core import Logya\nfrom logya.fs import copytree\nfrom logya.writer import D... | python | chosen |
[
{
"from": "system",
"value": "Move import statements to the top."
},
{
"from": "human",
"value": "# -*- coding: utf-8 -*-\n\nfrom flask import Flask, render_template, g\nfrom flask.ext.appconfig import AppConfig\n\n\ndef create_app(configfile=None):\n app = Flask('massa')\n AppConfig(app, ... | python | chosen |
[
{
"from": "system",
"value": "Make parser and renderer available at package root\n"
},
{
"from": "human",
"value": "# -*- coding: utf-8 -*-\nfrom distutils import version\n\n__version__ = '0.2.0'\nversion_info = version.StrictVersion(__version__).version\n"
},
{
"from": "gpt",
"value... | python | chosen |
[
{
"from": "system",
"value": "Tweak media_type -> accepted_media_type. Need to document, but marginally less confusing\n"
},
{
"from": "human",
"value": "from django.core.handlers.wsgi import STATUS_CODE_TEXT\nfrom django.template.response import SimpleTemplateResponse\n\n\nclass Response(Simpl... | python | chosen |
[
{
"from": "system",
"value": "Remove hook that snuck in\n"
},
{
"from": "human",
"value": "from groundstation import logger\nlog = logger.getLogger(__name__)\n\n\ndef handle_describeobjects(self):\n if not self.payload:\n log.info(\"station %s sent empty DESCRIVEOBJECTS payload - new d... | python | chosen |
[
{
"from": "system",
"value": "Make trailing slash optional in API oauth URL patterns\n\nhttps://github.com/AudioCommons/ac-mediator/issues/19\n"
},
{
"from": "human",
"value": "from django.conf.urls import url\nfrom oauth2_provider import views\n\nurlpatterns = (\n url(r'^authorize/$', views.... | python | chosen |
[
{
"from": "system",
"value": "Clean up problem 1 solution a bit.\n"
},
{
"from": "human",
"value": "# Project Euler - Problem 1\nsum = 0\nfor i in xrange(1, 1001):\n if i % 3 == 0 or i % 5 == 0:\n sum = sum + i\n\nprint \"The sum is: {}\".format(sum)\n"
},
{
"from": "gpt",
... | python | chosen |
[
{
"from": "system",
"value": "Fix another import in test\n"
},
{
"from": "human",
"value": "from __future__ import print_function\n\nfrom metatlas.mzml_loader import mzml_to_hdf, get_test_data\nfrom metatlas.h5_query import get_XICof, get_data\n\n\ndef rmse(target, predictions):\n target = ta... | python | chosen |
[
{
"from": "system",
"value": "Allow import in case of missing notebook package"
},
{
"from": "human",
"value": "\"\"\"R markdown notebook format for Jupyter\n\nUse this module to read or write Jupyter notebooks as Rmd documents (methods 'read', 'reads', 'write', 'writes')\n\nUse the 'pre_save_ho... | python | chosen |
[
{
"from": "system",
"value": "Make sure heroku is in accepted hosts\n"
},
{
"from": "human",
"value": "from logtacts.settings import *\nimport dj_database_url\n\nDEBUG = False\nTEMPLATE_DEBUG = DEBUG\n\nDATABASES['default'] = dj_database_url.parse(get_env_variable('LOGTACTS_DB_URL'))\n\nSECRET_K... | python | chosen |
[
{
"from": "system",
"value": "[doc] Enable intersphinx and add mapping for py2.7 + numpy\n"
},
{
"from": "human",
"value": "# Copyright (c) 2014, German Neuroinformatics Node (G-Node)\n#\n# All rights reserved.\n#\n# Redistribution and use in source and binary forms, with or without\n# modificat... | python | chosen |
[
{
"from": "system",
"value": "Update logging facility. Don't overide root logger with basicConfig.\n"
},
{
"from": "human",
"value": "import sys\nimport logging\n\n# NOTE: Be sure to keep the logging level commented out before commiting. See:\n# https://github.com/numba/numba/issues/31\n# A ... | python | chosen |
[
{
"from": "system",
"value": "Put in date = self.request.get(date) in order to call the date from the HTML.\n"
},
{
"from": "human",
"value": "# request handler for editing page (/edit) goes here\n# assume admin login has already been handled\n\nimport cgi\nfrom google.appengine.api import users... | python | chosen |
[
{
"from": "system",
"value": "Write bytes object to mmap instead of string\n\nThis fixes compatibility with python3"
},
{
"from": "human",
"value": "from .format import DrmFormat\nfrom .framebuffer import DrmFramebuffer\nfrom .buffer import DrmDumbBuffer\n\n\nclass DrmImageFramebuffer(DrmFramebu... | python | chosen |
[
{
"from": "system",
"value": "Set parameters of serial class to match with kilt\n"
},
{
"from": "human",
"value": "#!/usr/bin/python\nimport time\nimport serial\n\n# configure the serial connections (the parameters differs on the\n# device you are connecting to)\n\nclass Bumper(object):\n\n d... | python | chosen |
[
{
"from": "system",
"value": "Reset range to be required in dynamic intr form\n"
},
{
"from": "human",
"value": "from django import forms\nfrom cyder.cydhcp.interface.dynamic_intr.models import (DynamicInterface,\n DynamicIntrKeyValue)\nfrom... | python | chosen |
[
{
"from": "system",
"value": "DM-12174: Manage Content Loader as Herd/DM tool\n- Lower log size cap\n"
},
{
"from": "human",
"value": "\"\"\"\n Copyright 2015 herd contributors\n\n Licensed under the Apache License, Version 2.0 (the \"License\");\n you may not use this file except in complian... | python | chosen |
[
{
"from": "system",
"value": "Move external git folder integration tests to a separate class\n"
},
{
"from": "human",
"value": "import unittest\nimport util\nfrom git_wrapper import GitWrapper\n\nclass GitWrapperIntegrationTest(util.RepoTestCase):\n def test_paths(self):\n self.open_ta... | python | chosen |
[
{
"from": "system",
"value": "Add soup extraction of links in results page\n"
},
{
"from": "human",
"value": "\ndef main():\n print('Hello, World.')\n\nif __name__ == '__main__':\n main()\n\n"
},
{
"from": "gpt",
"value": "from bs4 import BeautifulSoup\nimport requests\n\ndef g... | python | chosen |
[
{
"from": "system",
"value": "Use exception handling with decorator\n"
},
{
"from": "human",
"value": "'''\n'''\nimport functools\nimport operator\nfrom .. import monads\n\n\ndef view(func, **constraints):\n '''Functions that decorates a view. This function can also checks the\n argument v... | python | chosen |
[
{
"from": "system",
"value": "Use headless chrome for functional test\n"
},
{
"from": "human",
"value": "from selenium import webdriver\n\nfrom django.contrib.staticfiles.testing import StaticLiveServerTestCase\nfrom django.core.cache import cache\n\n\nclass BrowserTest(StaticLiveServerTestCase)... | python | chosen |
[
{
"from": "system",
"value": "tests: Extend client:users tests to renaming and synchronization.\n"
},
{
"from": "human",
"value": "import pydle\nfrom .fixtures import with_client\nfrom .mocks import Mock\n\n\n@with_client()\ndef test_user_creation(server, client):\n client._create_user('WiZ')... | python | chosen |
[
{
"from": "system",
"value": "Check if putting/getting was actually successful.\n"
},
{
"from": "human",
"value": "#!/usr/bin/env python\n# coding=utf8\n\ntry:\n from cStringIO import StringIO\nexcept ImportError:\n from StringIO import StringIO\n\nfrom .. import KeyValueStore\n\n\nclass M... | python | chosen |
[
{
"from": "system",
"value": "Fix PowersOf to return `count` items, not \"numbers up to base**count\".\n"
},
{
"from": "human",
"value": "import time\nfrom prometheus_client import _INF\n\n# TODO(korfuri): if python>3.3, use perf_counter() or monotonic().\n\n\ndef Time():\n \"\"\"Returns some... | python | chosen |
[
{
"from": "system",
"value": "Use PEP 440 compatible local version identifier\n"
},
{
"from": "human",
"value": "\"\"\"Remote control Samsung televisions via TCP/IP connection\"\"\"\n\nfrom .remote import Remote\n\n__title__ = \"samsungctl\"\n__version__ = \"0.6.0-git\"\n__url__ ... | python | chosen |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.