conversations
listlengths
2
3
source
stringclasses
1 value
stack
stringclasses
1 value
[ { "from": "system", "value": "Fix detection of Zookeeper in monasca-setup\n\nThe Zookeeper detection plugin was looking for zookeeper in the process\ncommand-line. This was producing false positives in the detection\nprocess because storm uses the zookeeper library and it shows up\nthe command-line for sto...
python
chosen
[ { "from": "system", "value": "Add pytest mark database setup for test\n" }, { "from": "human", "value": "import os\nos.environ.setdefault(\"DJANGO_SETTINGS_MODULE\", \"api.api.settings\")\n\nimport django\nfrom django.test import TestCase\nfrom rest_framework.test import APIRequestFactory\n\nfro...
python
chosen
[ { "from": "system", "value": "Clear existing tags before updating\n" }, { "from": "human", "value": "from django.contrib.auth.models import User\n\nfrom nightreads.posts.models import Tag\nfrom .models import UserTag\n\n\ndef update_user_tags(user, tags):\n tags_objs = Tag.objects.filter(name...
python
chosen
[ { "from": "system", "value": "Prepend http to urls in user history\n" }, { "from": "human", "value": "import os.path\nimport json\nimport urlparse\n\nACCEPTED_FILETYPES = [\n 'json',\n # 'csv'\n]\n\nclass HistoryParser():\n def __init__(self, path):\n if not os.path.isfil...
python
chosen
[ { "from": "system", "value": "Add default values for config\n" }, { "from": "human", "value": "import os\nimport shutil\nimport configparser\n\nfrom .equipment import Equipment\nfrom .observations import Observation\nfrom .place import Place\nfrom .weather import Weather\nfrom .notify import Not...
python
chosen
[ { "from": "system", "value": "Update count fields on RawDataVersionAdmin\n" }, { "from": "human", "value": "#!/usr/bin/env python\n# -*- coding: utf-8 -*-\n\"\"\"\nCustom administration panels for tracking models.\n\"\"\"\nfrom __future__ import unicode_literals\nfrom django.contrib import admin...
python
chosen
[ { "from": "system", "value": "Fix handling of empty file" }, { "from": "human", "value": "import os\nimport uuid\n\nfrom mischief.actors.pipe import get_local_ip\nimport yaml\n\n\ndef read_serfnode_yml():\n with open('/serfnode.yml') as input:\n conf = yaml.load(input) or {}\n r...
python
chosen
[ { "from": "system", "value": "Remove scope attribute from Constant\n" }, { "from": "human", "value": "# -*- coding: utf-8 -*-\n\n# Copyright 2013 Universidad Politécnica de Madrid\n\n# This file is part of Wirecloud.\n\n# Wirecloud is free software: you can redistribute it and/or modify\n# it un...
python
chosen
[ { "from": "system", "value": "Add a system test to check for expected broken accounts\n\nSummary:\nThis is the system test for D765 and finishes up the sync engine side\nof T495 - checking for All Mail folder and failing gracefully if it's\nabsent.\n\nThis test specifically adds another check in `test_auth`...
python
chosen
[ { "from": "system", "value": "BUmp version number to 0.12.1\n" }, { "from": "human", "value": "from __future__ import absolute_import, division, print_function\n\nfrom .backends import *\nfrom .buckets import *\nfrom .config import *\nfrom .exceptions import *\nfrom .keymakers import *\nfrom .lo...
python
chosen
[ { "from": "system", "value": "Use integral derivative decorator for test\n" }, { "from": "human", "value": "from addons import *\nfrom utils import *\n\n\ntdir = 'Response-Theory'\n\n\ndef test_beta(workspace):\n exe_py(workspace, tdir, 'Self-Consistent-Field/beta')\n\n\ndef test_CPHF(workspa...
python
chosen
[ { "from": "system", "value": "Make version format PEP 440 compatible\n" }, { "from": "human", "value": "import re\nimport sys\nfrom collections import namedtuple\n\nfrom .connection import connect, Connection, TIMEOUT as DEFAULT_TIMEOUT\nfrom .cursor import Cursor\nfrom .pool import create_pool,...
python
chosen
[ { "from": "system", "value": "Allow Flask to get port from heroku environment\n" }, { "from": "human", "value": "#!/usr/bin/env python\n\n\"\"\"\nBootstrap and serve your application. This file also serves to not make your\napplication completely reliant upon DotCloud's hosting service.\n\nIf yo...
python
chosen
[ { "from": "system", "value": "Make upstart an optional install\n" }, { "from": "human", "value": "#!/usr/bin/env python\nimport subprocess\n\n\ndef main():\n subprocess.call([\"apt-get\", \"update\"])\n subprocess.call([\"apt-get\", \"-y\", \"upgrade\"])\n subprocess.call([\"apt-get\", ...
python
chosen
[ { "from": "system", "value": "Fix compile error of recipe \"android\" for non-sdl bootstrap build\n" }, { "from": "human", "value": "from distutils.core import setup, Extension\nimport os\n\nlibrary_dirs = ['libs/' + os.environ['ARCH']]\nlib_dict = {\n 'pygame': ['sdl'],\n 'sdl2': ['SDL2',...
python
chosen
[ { "from": "system", "value": "Enforce string before wrapping in quotation marks\n" }, { "from": "human", "value": "class ChartComponent(object):\n\n def __init__(self):\n\n self.config = {}\n\n def __string_wrap__(self, string_to_wrap):\n\n return \"'\" + string_to_wrap + \"'...
python
chosen
[ { "from": "system", "value": "Use time object for model test\n" }, { "from": "human", "value": "from django.test import TestCase\nfrom django.db import IntegrityError\n\nfrom app.timetables.models import Weekday, Meal\n\n\nclass WeekdayTest(TestCase):\n \"\"\"Tests the Weekday model.\"\"\"\n\...
python
chosen
[ { "from": "system", "value": "Initialize values using a gaussian distribution with mean = 0 and std = 0.3\n" }, { "from": "human", "value": "import random\n\n\nclass TabularF(dict):\n '''\n Tabular representation for any of the two types of value functions:\n\n 1. state value function (...
python
chosen
[ { "from": "system", "value": "Move CMS admin panel to /cms.\n" }, { "from": "human", "value": "from __future__ import absolute_import, unicode_literals\n\nfrom django.conf import settings\nfrom django.conf.urls import include, url\nfrom django.contrib import admin\n\nfrom wagtail.wagtailadmin im...
python
chosen
[ { "from": "system", "value": "Include multiple milestones and open issues in contributor list [ci skip]\n" }, { "from": "human", "value": "#!/usr/bin/env python\n\"\"\"Print a list of contributors for a particular milestone.\n\nUsage:\n\n python tools/contributor_list.py MILESTONE\n\n\"\"\"\n...
python
chosen
[ { "from": "system", "value": "Store merkle roots for 10 minutes\n" }, { "from": "human", "value": "#Copyright (C) 2011,2012 Colin Rice\n#This software is licensed under an included MIT license.\n#See the file entitled LICENSE\n#If you were not provided with a copy of the license please contact: ...
python
chosen
[ { "from": "system", "value": "Make image required on Job submit form.\n" }, { "from": "human", "value": "from datetimewidget.widgets import DateTimeWidget\nfrom django.forms import ModelForm\nfrom form_utils.widgets import ImageWidget\n\nfrom ..models import Job\n\njob_field_labels = {\n 'ima...
python
chosen
[ { "from": "system", "value": "Add TRACE level to Pegasus logging\n" }, { "from": "human", "value": "# Copyright 2009 University Of Southern California\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may not use this file except in compliance with the License.\n#...
python
chosen
[ { "from": "system", "value": "Include new airport_ui preference in serializer for view\n" }, { "from": "human", "value": "from django.contrib.auth.models import User\nfrom rest_framework import serializers\n\nfrom api.models import UserPreferences\n\n\nclass UserPreferencesSummarySerializer(seri...
python
chosen
[ { "from": "system", "value": "Make it more clear how password is generated\n" }, { "from": "human", "value": "import string\nimport random\nimport argparse\n\n\ndef passgen(length=12):\n \"\"\"Generate a strong password with *length* characters\"\"\"\n pool = string.ascii_uppercase + strin...
python
chosen
[ { "from": "system", "value": "Refactor RegisterView as subclass of LoginView\n\nThey share much of the work, they should share the code as well\n" }, { "from": "human", "value": "from django.shortcuts import render\nfrom django.views.generic.edit import FormView\n\n\nfrom . import forms\n\n# Cre...
python
chosen
[ { "from": "system", "value": "Fix hashbang, add future import.\n" }, { "from": "human", "value": "#!/usr/bin/python\n\n\"\"\"\nExample of an Eliot action context spanning multiple threads.\n\"\"\"\n\nfrom threading import Thread\nfrom sys import stdout\n\nfrom eliot import to_file, preserve_cont...
python
chosen
[ { "from": "system", "value": "Make 'name' and 'index' columns non-nullable for IndexFile model\n" }, { "from": "human", "value": "import enum\nfrom sqlalchemy import Column, Integer, String, Enum\n\nfrom virtool.pg.utils import Base, SQLEnum\n\n\nclass IndexType(str, SQLEnum):\n \"\"\"\n E...
python
chosen
[ { "from": "system", "value": "Fix mirror_channel widget on OPPS_MIRROR_CHANNEL false\n" }, { "from": "human", "value": "#!/usr/bin/env python\n# -*- coding: utf-8 -*-\nfrom django import forms\nfrom django.conf import settings\n\nfrom opps.db.models.fields.jsonf import JSONFormField\nfrom opps.f...
python
chosen
[ { "from": "system", "value": "Add more conversation into the mix.\n" }, { "from": "human", "value": "from flask import Flask, request, redirect\nimport twilio.twiml\n\napp = Flask(__name__)\n\n\n@app.route(\"/\", methods=['GET', 'POST'])\ndef hello():\n \"\"\" Respond to incoming calls with a...
python
chosen
[ { "from": "system", "value": "Switch over to run_test_cases.py, take 2.\n\nInstead of doing a \"Revert r168479 'Revert r168478'\", it's using a simpler version based on renaming sharding_supervisor first.\n\nTry to enable run_test_cases.py again.\n\nR=phajdan.jr@chromium.org\nBUG=164886\n\nReview URL: https...
python
chosen
[ { "from": "system", "value": "Use tiny serializer for source group\n" }, { "from": "human", "value": "from radar_api.serializers.groups import GroupReferenceField\nfrom radar_api.serializers.source_types import SourceTypeReferenceField\n\n\nclass SourceGroupSerializerMixin(object):\n source_g...
python
chosen
[ { "from": "system", "value": "Add function to fetch devices from the DDB\n" }, { "from": "human", "value": "from ognskylines.dbutils import session\nfrom ognskylines.model import Device\nfrom ogn.utils import get_ddb, get_trackable\n\n\nfrom manager import Manager\nmanager = Manager()\n\n\n@mana...
python
chosen
[ { "from": "system", "value": "Remove examples dep from nose\n" }, { "from": "human", "value": "\"\"\"\nswat-s1 tests.\n\"\"\"\n\n# from mininet.cli import CLI\nfrom mininet.net import Mininet\n\nfrom nose.plugins.skip import SkipTest\n\nfrom utils import STATE, RWT_INIT_LEVEL\nfrom utils import ...
python
chosen
[ { "from": "system", "value": "Use the Collection.collected_types through table to bulk add preprints as a valid collected_type for existing collections.\n\n- Use the Collection - collected_types through table to remove preprints from collected_types.\n" }, { "from": "human", "value": "# -*- codi...
python
chosen
[ { "from": "system", "value": "Update to include actions in Create" }, { "from": "human", "value": "# Download the helper library from https://www.twilio.com/docs/python/install\nfrom twilio.rest import Client\n\n# Your Account Sid and Auth Token from twilio.com/console\naccount_sid = 'ACXXXXXXXX...
python
chosen
[ { "from": "system", "value": "Call get_section from get_object for backwards compatibility" }, { "from": "human", "value": "from django.core.urlresolvers import reverse\nfrom django.views.generic import DetailView\nfrom django.contrib.syndication.views import Feed\nfrom django.shortcuts import g...
python
chosen
[ { "from": "system", "value": "Make filter_by_district more strict - don't show anything to unconfigured users\n" }, { "from": "human", "value": "from __future__ import unicode_literals\n\nfrom django.db import models\nfrom django.utils.translation import ugettext_lazy as _\nfrom django.contrib.a...
python
chosen
[ { "from": "system", "value": "Add test_videos to the main test suite\n" }, { "from": "human", "value": "# -*- coding: utf-8 -*-\n# Copyright 2011-2012 Antoine Bertin <diaoulael@gmail.com>\n#\n# This file is part of subliminal.\n#\n# subliminal is free software; you can redistribute it and/or mod...
python
chosen
[ { "from": "system", "value": "Use patchers for overriding data/cache directories\n" }, { "from": "human", "value": "# tests.__init__\n\nimport os\nimport os.path\nimport shutil\nimport tempfile\nimport yvs.shared as yvs\n\n\ntemp_dir = tempfile.gettempdir()\nyvs.LOCAL_DATA_DIR_PATH = os.path.joi...
python
chosen
[ { "from": "system", "value": "Add name and dimensions attributes to MockVariable class\n" }, { "from": "human", "value": "from netCDF4 import Dataset\nimport tempfile\n\nclass MockNetCDF(Dataset):\n \"\"\"\n Wrapper object around NetCDF Dataset to write data only to memory.\n \"\"\"\n\n...
python
chosen
[ { "from": "system", "value": "Use the new get_adapter api\n" }, { "from": "human", "value": "\"\"\"\n\"\"\"\n\nfrom django.contrib.auth import models\n\nimport pyamf.adapters\n\n\nmodels.User.__amf__ = {\n 'exclude': ('message_set', 'password'),\n 'readonly': ('username',)\n}\n\n# ensure t...
python
chosen
[ { "from": "system", "value": "fix: Reduce sample size for faster processing\n" }, { "from": "human", "value": "# importing modules/ libraries\nimport pandas as pd\nimport random\nimport numpy as np\n\n# create a sample of prior orders\norders_df = pd.read_csv(\"Data/orders.csv\")\ns = round(3214...
python
chosen
[ { "from": "system", "value": "Add protocol to hosts for CORS\n" }, { "from": "human", "value": "import boto3\nfrom django.conf import settings\nfrom django.core.management.base import BaseCommand\n\n\nclass Command(BaseCommand):\n help = 'Set CORS rules on the Notice and Comment attachment bu...
python
chosen
[ { "from": "system", "value": "Put JokeService in the right place alphabetically\n" }, { "from": "human", "value": "from pal.services.bonapp_service import BonAppService\nfrom pal.services.dictionary_service import DictionaryService\nfrom pal.services.directory_service import DirectoryService\nfr...
python
chosen
[ { "from": "system", "value": "Switch to pytest fixture and generate artifact for circle ci\n" }, { "from": "human", "value": "import json\n\nfrom sforparser.apd import scraper\n\nINPUT_FILE = 'data/apd/input.txt'\n\n\ndef test_output_strips_email_spaces():\n json_str = scraper(open(INPUT_FILE...
python
chosen
[ { "from": "system", "value": "Remove the exception handling code for getting the success url\n" }, { "from": "human", "value": "from django.conf import settings\nfrom django.contrib.auth.decorators import login_required\nfrom django.contrib.sites.models import Site\nfrom django.core.urlresolvers...
python
chosen
[ { "from": "system", "value": "Fix bug with account additions using old Entity API\n" }, { "from": "human", "value": "#!/usr/bin/python\nfrom awsom.entity import Entity, Factory\nfrom awsom.config import AccountEntity, config\n\nclass ModelRootFactory(Factory):\n def __init__(self, entity):\n ...
python
chosen
[ { "from": "system", "value": "Fix frequency and phase offset\n" }, { "from": "human", "value": "import numpy as np\nimport matplotlib.pyplot as plt\n\ndef takeFFT(data):\n data = data / np.linalg.norm(data)\n data_squared = np.square(data)\n fft_out = np.fft.fft(data_squared)\n fft_s...
python
chosen
[ { "from": "system", "value": "Return the SQL we've just tried to run\n" }, { "from": "human", "value": "\"\"\"\n APIs exposed by pubsubpull.\n\"\"\"\nfrom __future__ import absolute_import\n\nfrom async.api import schedule\nfrom django.db import connection\n\nfrom pubsubpull import _join_with...
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": "human", "value": "Allow importing major classes directly from productmd\n\nThis should simplify things for most users: just import productmd module\nand Compose (the one for metadata loading), Rpms and Images classes are\ndirectly available as well as ComposeInfo, DiscInfo and TreeInfo.\n" }, ...
python
chosen
[ { "from": "system", "value": "Fix devenv call in unittesting script.\n" }, { "from": "human", "value": "#!/usr/bin/python\n\nimport sys\nimport os\n\nif sys.platform == 'win32':\n os.system ( 'devenv /build libSequantoAutomation.sln' )\nelse:\n os.system ( 'make' )\n" }, { "from": ...
python
chosen
[ { "from": "system", "value": "Copy run section from Heroku example\n" }, { "from": "human", "value": "from fickle import API\n\nfrom fickle.classifier import GenericSVMClassifier\nbackend = GenericSVMClassifier()\n\napp = API(__name__, backend)\napp.run(debug = True)\n" }, { "from": "gpt...
python
chosen
[ { "from": "system", "value": "Modify allowable domain to restrict crawling\n" }, { "from": "human", "value": "from scrapy.contrib.spiders import CrawlSpider, Rule\nfrom scrapy.contrib.linkextractors.sgml import SgmlLinkExtractor\nfrom scrapy.selector import Selector\n\nclass DatasetSpider(CrawlS...
python
chosen
[ { "from": "system", "value": "Add ability to set debug on heroku staging server\n" }, { "from": "human", "value": "import os\n\nfrom flask import Flask\nfrom flask.ext.sqlalchemy import SQLAlchemy\n\napp = Flask(__name__)\n\n# Running on heroku\nif 'HEROKU' in os.environ:\n from example_confi...
python
chosen
[ { "from": "system", "value": "Fix typo in import and bump to 0.3.1\n" }, { "from": "human", "value": "from django.conf.urls.defaults import patterns, include, url\nfrom django.view.generic import TemplateView\n\n# ADMIN_BASE is the base URL for your Armstrong admin. It is highly\n# recommended ...
python
chosen
[ { "from": "system", "value": "Remove call to p-config, as it is handled in p-python-wrapper\n" }, { "from": "human", "value": "#!/usr/bin/env python3\nimport sys\nimport os\nimport subprocess\n\n# Use pegasus-config to find our lib path\nbin_dir = os.path.normpath(os.path.join(os.path.dirname(sy...
python
chosen
[ { "from": "system", "value": "Make pushmanager.testing more explicit in imports\n" }, { "from": "human", "value": "#!/usr/bin/env python\n\nimport testify\n\n# don't want all of testify's modules, just its goodies\nfrom testify.__init__ import *\n\nfrom mocksettings import MockedSettings\nfrom t...
python
chosen
[ { "from": "system", "value": "Make dart master pull stable from 1.7\n\nReview URL: https://codereview.chromium.org/638823002\n\ngit-svn-id: 239fca9b83025a0b6f823aeeca02ba5be3d9fd76@292365 0039d316-1c4b-4281-b951-d872f2087c98\n" }, { "from": "human", "value": "# Copyright 2013 The Chromium Author...
python
chosen
[ { "from": "system", "value": "Create new Class MainHandler with the template values with the variable block and made it into index.html\n" }, { "from": "human", "value": "# Import blockmodels file\nimport BlockModels\nimport webapp2, jinja2, os\nfrom datetime import *\n\njinja_environment = jinj...
python
chosen
[ { "from": "system", "value": "Split import into 2 lines to make flake8 happy\n" }, { "from": "human", "value": "# -*- coding: utf-8 -*-\nfrom py_zipkin.zipkin import create_http_headers_for_new_span \\\n as create_headers_for_new_span # pragma: no cover\n" }, { "from": "gpt", "...
python
chosen
[ { "from": "system", "value": "Fix version number to check for mizani\n\nand not plotnine. Copypaste error!\n" }, { "from": "human", "value": "from importlib.metadata import version, PackageNotFoundError\n\n\ntry:\n __version__ = version('plotnine')\nexcept PackageNotFoundError:\n # package...
python
chosen
[ { "from": "system", "value": "Use items() instead of iteritems() for Python 2 and 3 compatibility\n" }, { "from": "human", "value": "import bleach\n\nfrom django import template\nfrom django.conf import settings\nfrom django.utils.safestring import mark_safe\n\nregister = template.Library()\n\n\...
python
chosen
[ { "from": "system", "value": "Change SPEEDINFO_CACHED_RESPONSE_ATTR_NAME default value to `_is_cached`\n" }, { "from": "human", "value": "# coding: utf-8\n\nfrom django.conf import settings\n\nDEFAULTS = {\n \"SPEEDINFO_TESTS\": False,\n \"SPEEDINFO_CACHED_RESPONSE_ATTR_NAME\": \"is_cached...
python
chosen
[ { "from": "system", "value": "Test commit on new branch, change to username and email.\n" }, { "from": "human", "value": "# -*- coding: utf-8 -*-\n\"\"\"\nCreated on Thu Jul 21 13:53:47 2016\n\n@author: mela\n\"\"\"\n\n" }, { "from": "gpt", "value": "# -*- coding: utf-8 -*-\n\"\"\"\n...
python
chosen
[ { "from": "system", "value": "Correct name for the shopping search api\n" }, { "from": "human", "value": "#!/usr/bin/python2.4\n# -*- coding: utf-8 -*-\n#\n# Copyright 2010 Google Inc. All Rights Reserved.\n\n\"\"\"Simple command-line example for The Google Shopping API.\n\nCommand-line applicat...
python
chosen
[ { "from": "system", "value": "Use fileinput instead of sed.\n" }, { "from": "human", "value": "from __future__ import print_function\n\nimport argparse\nimport sys\nfrom plumbum import local\n\nfrom pre_commit_hooks.util import entry\n\n\n@entry\ndef fix_trailing_whitespace(argv):\n parser = ...
python
chosen
[ { "from": "system", "value": "Use setting file on /etc\n" }, { "from": "human", "value": "#!/usr/bin/env python\n\nimport twitter\n\nclass Twitter:\n\n def __init__(self):\n consumer_key = \"WXfZoJi7i8TFmrGOK5Y7dVHon\"\n consumer_secret = \"EE46ezCkgKwy8GaKOFFCuMMoZbwDprnEXjhVMn...
python
chosen
[ { "from": "system", "value": "Change upgrade step to not use rev link.\n" }, { "from": "human", "value": "from contentbase import (\n ROOT,\n upgrade_step,\n)\n\n@upgrade_step('bismark_quality_metric', '1', '2')\ndef bismark_quality_metric_1_2(value, system):\n # http://redmine.encodedc...
python
chosen
[ { "from": "system", "value": "Add more variables and bug fixes\n" }, { "from": "human", "value": "__author__ = 'mcsquaredjr'\n\nimport os\nimport socket\n\nnode_file = os.environ[\"NODES\"]\ncad_file = os.environ[\"CAD\"]\nprocs_per_nod = os.environ[\"PROCS_PER_NODE\"]\nitemcount = os.environ[\"...
python
chosen
[ { "from": "system", "value": "Fix is_available method in django; proper exception handling for use checking.\n" }, { "from": "human", "value": "# -*- coding: utf-8 -*-\nfrom __future__ import print_function, unicode_literals, division\n\n\n__all__ = [\n]\n\n\ndef is_available(*capacities):\n ...
python
chosen
[ { "from": "system", "value": "Make sure we use Python 3 here\n" }, { "from": "human", "value": "#!/usr/bin/env python\n# -*- encoding: utf-8\n\"\"\"\nUsage: run_travis_lambdas.py (test|publish)\n\"\"\"\n\nimport os\nimport subprocess\nimport sys\n\n\nif __name__ == '__main__':\n try:\n ...
python
chosen
[ { "from": "system", "value": "Update openmm test script to check appropriate version numbers for beta\n" }, { "from": "human", "value": "#!/usr/bin/env python\n\nfrom simtk import openmm\n\n# Check major version number\nassert openmm.Platform.getOpenMMVersion() == '7.0', \"openmm.Platform.getOpe...
python
chosen
[ { "from": "system", "value": "Update \"Sequential Art\" 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 = \"Sequential Art\"\n ...
python
chosen
[ { "from": "system", "value": "Add path parameter to notebook_init()\n" }, { "from": "human", "value": "# Author: Álvaro Parafita (parafita.alvaro@gmail.com)\n\n\"\"\"\n Utilities for Jupyter Notebooks\n\"\"\"\n\n# Add parent folder to path and change dir to it\n# so that we can access easily ...
python
chosen
[ { "from": "system", "value": "Join lines without newline and remove trailing newline\n" }, { "from": "human", "value": "from .core import *\n\nimport sys\n\ndef main():\n \"\"\" Entry point for cli. \"\"\"\n if sys.argv[1:]: # called with input arguments\n copy(' '.join(sys.argv[1:...
python
chosen
[ { "from": "system", "value": "Allow autocomplete on non-persisted swift files\n" }, { "from": "human", "value": "from .dependencies import dependencies\ndependencies.load()\n\nimport sublime, sublime_plugin\nfrom sublime import Region\nimport subl_source_kitten\n\n# Sublime Text will will call `...
python
chosen
[ { "from": "system", "value": "Update 'search_term' functon. Add 'match_phrase' function.\n" }, { "from": "human", "value": "from django.shortcuts import render\nfrom elasticsearch import Elasticsearch\nfrom django.http import HttpResponse\n\ndef search(request):\n if request.method == 'GET':\...
python
chosen
[ { "from": "system", "value": "Fix CD fail lambda python\n" }, { "from": "human", "value": "# Invoked by: CloudWatch Events\n# Returns: Error or status message\n#\n# Triggered periodically to check if the CD CodePipeline has failed, and\n# publishes a notification\n\nimport boto3\nimport tracebac...
python
chosen
[ { "from": "system", "value": "Fix typo in named group regex\n" }, { "from": "human", "value": "from django.conf.urls import url\nfrom .views import Dashboard\n\n\nclass Router(object):\n def __init__(self):\n self.registry = []\n\n def register(self, widget, basename, **parameters):...
python
chosen
[ { "from": "system", "value": "Make anyone importing DIALS aware of !2.7 support\n\nWarning is only shown on first import, and can be silenced in Python 2.7 with\n\nimport warnings\nwith warnings.catch_warnings():\n warnings.simplefilter(\"ignore\")\n import dials\n\ncf. #1175\n" }, { "from": "...
python
chosen
[ { "from": "system", "value": "Update to be about Django, not 2010-era Pinax." }, { "from": "human", "value": "# -*- coding: utf-8 -*-\n\n__about__ = \"\"\"\nThis project comes with the bare minimum set of applications and templates\nto get you started. It includes no extra tabs, only the profile...
python
chosen
[ { "from": "system", "value": "Fix debugger start up issue + Add python3 print syntax\n" }, { "from": "human", "value": "import os\nfrom flask import Flask, render_template, url_for\napp = Flask(__name__)\n\n@app.route('/')\ndef homepage():\n\tviewer = 'clinician'\n\tdescription = 'This is the cl...
python
chosen
[ { "from": "system", "value": "Remove runpython to create subparers in 0028\n" }, { "from": "human", "value": "# -*- coding: utf-8 -*-\n# Generated by Django 1.9.4 on 2017-04-25 09:25\nfrom __future__ import unicode_literals\n\nfrom django.db import migrations, models\nimport django.db.models.del...
python
chosen
[ { "from": "system", "value": "Move page cleaning logic to the form.\n\n--HG--\nbranch : result-refactor\n" }, { "from": "human", "value": "from django import forms\nfrom django.conf import settings\n\n\n__all__ = ('BaseLookupForm', )\n\n\nclass BaseLookupForm(forms.Form):\n term = forms.CharF...
python
chosen
[ { "from": "system", "value": "Add possibility to lemmatize a folder or a file\n" }, { "from": "human", "value": "import os\nimport sys\nimport re\nimport subprocess\n\ndef lemmatize( text ):\n\n text = text.encode('utf8')\n text = re.sub( '[\\.,?!:;]' , '' , text )\n\n out = subprocess....
python
chosen
[ { "from": "system", "value": "[Python] Complete 'About Triangle Project' koans\n" }, { "from": "human", "value": "#!/usr/bin/env python\n# -*- coding: utf-8 -*-\n\n# Triangle Project Code.\n\n# Triangle analyzes the lengths of the sides of a triangle\n# (represented by a, b and c) and returns th...
python
chosen
[ { "from": "system", "value": "Remove domain design doc from irrelevant couch dbs\n\nIt used to contain views that were relevant to users, fixtures, and meta dbs,\nbut these have since been removed. Currently all views in the domain design doc\nemit absolutely nothing in those domains\n" }, { "from":...
python
chosen
[ { "from": "system", "value": "docs: Fix simple typo, convertable -> convertible\n\nThere is a small typo in django_enumfield/tests/test_validators.py.\n\nShould read `convertible` rather than `convertable`.\n" }, { "from": "human", "value": "import unittest\n\nfrom django.db import models\n\nfro...
python
chosen
[ { "from": "system", "value": "Check an extra possible data dir when installing in a venv\n\nWhen installing spec-cleaner in a virtual env, the data files\n(i.e. \"excludes-bracketing.txt\") are available in a different\ndirectory. Also check this directory.\n\nFixes #128\n" }, { "from": "human", ...
python
chosen
[ { "from": "system", "value": "Change the console log level back to WARN\n" }, { "from": "human", "value": "import os\nimport re\n\nimport sublime\nfrom .logger import *\n\n\n# get the directory path to this file; \nLIBS_DIR = os.path.dirname(os.path.abspath(__file__))\nPLUGIN_DIR = os.path.dirna...
python
chosen
[ { "from": "system", "value": "Make a default empty users list\n" }, { "from": "human", "value": "#-*- coding:utf-8 -*-\n\nfrom __future__ import division\nfrom __future__ import absolute_import\nfrom __future__ import with_statement\nfrom __future__ import print_function\nfrom __future__ import ...
python
chosen
[ { "from": "system", "value": "Verify additional steps in damping problem\n\nr4199\n" }, { "from": "human", "value": "import tools\n\ndef testdirichlet(dofs=0, np=0, n_threads=0):\n tools.executeAppAndDiff(__file__,'constant_damper_test.i',['out.e'], dofs, np, n_threads)\n" }, { "from": ...
python
chosen
[ { "from": "system", "value": "Increment version number to 0.14.1\n" }, { "from": "human", "value": "\"\"\"Configuration for Django system.\"\"\"\n\n__version__ = \"0.14.0\"\n__version_info__ = tuple(\n [\n int(num) if num.isdigit() else num\n for num in __version__.replace(\"-\"...
python
chosen
[ { "from": "system", "value": "Fix user name url pattern\n" }, { "from": "human", "value": "from django.conf.urls import include, url\nfrom django.contrib import admin\n\nfrom . import views\n\nurlpatterns = [\n url(r'^$', views.ViewView.as_view(), name='profile_own_view'),\n url(r'^edit/',...
python
chosen
[ { "from": "system", "value": "Add save buttons to viewer example.\n" }, { "from": "human", "value": "from skimage import data\nfrom skimage.filter import canny\n\nfrom skimage.viewer import ImageViewer\nfrom skimage.viewer.widgets import Slider\nfrom skimage.viewer.plugins.overlayplugin import O...
python
chosen
[ { "from": "system", "value": "Move import at the top of module.\n\ngit-svn-id: 77a43f9646713b91fea7788fad5dfbf67e151ece@7278 94b884b6-d6fd-0310-90d3-974f1d3f35e1\n" }, { "from": "human", "value": "import os\nfrom distutils.core import Command\nfrom numpy.distutils.misc_util import get_cmd\n\ncla...
python
chosen
[ { "from": "system", "value": "Add test for empty content string on query\n" }, { "from": "human", "value": "#!/usr/bin/env python\nimport unittest\n\n# This line is important so flake8 must ignore this one\nfrom app import views # flake8: noqa\nfrom app import mulungwishi_app\n\n\nclass URLTest(...
python
chosen
[ { "from": "system", "value": "Remove halign and valign on image_obj\n" }, { "from": "human", "value": "#!/usr/bin/env python\n# -*- coding: utf-8 -*-\nfrom django import template\nfrom ..generate import image_url as url\n\n\nregister = template.Library()\n\n\n@register.simple_tag\ndef image_url(...
python
chosen