conversations
listlengths
2
3
source
stringclasses
1 value
stack
stringclasses
1 value
[ { "from": "system", "value": "UPD: Enable livereload on dev by default\n" }, { "from": "human", "value": "import logging\n\nENV = 'development'\nAPP_DEBUG = False # Avoid using this in debug mode \n\n# CORS configuration\nCORS_HEADERS = 'Content-Type'\nCORS_ORIGINS = '*'\n\nKEYSPACE = \"annotato...
python
chosen
[ { "from": "system", "value": "Add a comment about the source of the hack\n" }, { "from": "human", "value": "from django.apps import AppConfig\nimport valuenetwork.api.types as types\n\nclass ApiTypesAppConfig(AppConfig):\n name = 'valuenetwork.api.types'\n verbose_name = \"ApiTypes\"\n\n ...
python
chosen
[ { "from": "system", "value": "Add Subject.hierarchy to djangosf model\n" }, { "from": "human", "value": "# -*- coding: utf-8 -*-\nfrom django.db import models\n\nfrom website.util import api_v2_url\n\nfrom osf.models.base import BaseModel, ObjectIDMixin\n\n\nclass Subject(ObjectIDMixin, BaseMode...
python
chosen
[ { "from": "system", "value": "Fix provider oauth2 warning by import provider before oauth2 as described in the manual\n" }, { "from": "human", "value": "INSTALLED_APPS += (\n 'simplemenu',\n 'webmanager',\n 'bootstrapform',\n 'userenabootstrap',\n 'userena',\n # 'social_auth',\...
python
chosen
[ { "from": "system", "value": "Add patch_json method to our test Client\n" }, { "from": "human", "value": "import json\n\nimport django.test\n\nfrom .user import UserMixin\n\n\nclass Client(django.test.Client):\n\n def patch_json(self, path, data=None, **kwargs):\n return self.patch(pat...
python
chosen
[ { "from": "system", "value": "Make all project fields searchable.\n" }, { "from": "human", "value": "import biosensorsdb.models\nfrom django.contrib import admin\n\nclass ProjectAdmin(admin.ModelAdmin):\n search_fields = ['team__name', 'year', 'title', 'abstract', 'inputs__name', 'outputs__name...
python
chosen
[ { "from": "system", "value": "Set debug settings to True for the sake of Pipeline.\n\ngit-svn-id: d73fdb991549f9d1a0affa567d55bb0fdbd453f3@8052 f04a3889-0f81-4131-97fb-bc517d1f583d\n" }, { "from": "human", "value": "from .base import *\n\nDEBUG = False\nTEMPLATE_DEBUG = False\n\nINSTALLED_APPS +...
python
chosen
[ { "from": "system", "value": "Make sure the munin dir exists and is owned by the right user\n" }, { "from": "human", "value": "\nfrom kokki import *\n\nPackage(\"munin\")\n\nFile(\"/etc/munin/munin.conf\",\n owner = \"root\",\n group = \"root\",\n mode = 0644,\n content = Template(\"...
python
chosen
[ { "from": "system", "value": "Update view to grab subjects and locations\n" }, { "from": "human", "value": "from django.shortcuts import render\nfrom django.db import transaction\n# from django.views.generic import TemplateView\n\nfrom tot.utils import get_current_people\n\nfrom registration.for...
python
chosen
[ { "from": "system", "value": "Make the system paths more configurable\n\nconfigs/test/SysPaths.py:\n Make the paths more configurable\n" }, { "from": "human", "value": "from m5 import *\n\nimport os.path\nimport sys\n\n# Edit the following list to include the possible paths to the binary\n# a...
python
chosen
[ { "from": "system", "value": "Add BotteryException base class from which ImproperlyConfigured derives.\n\nFixes #40\n" }, { "from": "human", "value": "\"\"\"Exception classes for Bottery\"\"\"\n\n\nclass ImproperlyConfigured(Exception):\n \"\"\"Bottery is somehow improperly configured\"\"\"\n...
python
chosen
[ { "from": "system", "value": "tests: Fix error in test_preprocessor_cur (xrange -> range)\n" }, { "from": "human", "value": "import unittest\n\nfrom Orange.data import Table\nfrom Orange.preprocess import ProjectCUR\n\n\nclass TestCURProjector(unittest.TestCase):\n def test_project_cur_defaul...
python
chosen
[ { "from": "system", "value": "Add test for RatingAdmin colored_name" }, { "from": "human", "value": "from mock import Mock\n\nfrom ..admin import SubIndicatorAdmin\nfrom ..models import SubIndicator\n\n\ndef test_sub_indicator_admin_rsult_returns_indicator_result():\n sub_indicator = Mock(ind...
python
chosen
[ { "from": "system", "value": "Use strategy.backend.name instead of strategy.backend_name" }, { "from": "human", "value": "from django.conf import settings\nfrom django.core.mail import send_mail\nfrom django.core.urlresolvers import reverse\n\n\ndef send_validation(strategy, code):\n url = re...
python
chosen
[ { "from": "system", "value": "Update new open() function docs (and fix bug)\n" }, { "from": "human", "value": "class open(object):\n \"\"\"Wrapper providing key part of Python 3 open() interface.\n\n From IPython's py3compat.py module. License: BSD.\n \"\"\"\n def __init__(self, fnam...
python
chosen
[ { "from": "system", "value": "doc: Add basic doc to Neural entities\n" }, { "from": "human", "value": "from Entity import *\n\nclass NeuralEntity(Entity):\n def __init__(self, nsfile, eid, info):\n super(NeuralEntity,self).__init__(eid, nsfile, info)\n\n @property\n def probe_inf...
python
chosen
[ { "from": "system", "value": "Remove code prototype code where the settings variables were being modified, this code works in single threaded servers but might not work on multithreaded servers.\n" }, { "from": "human", "value": "from django.conf import settings\n\nfrom crits.config.config impor...
python
chosen
[ { "from": "system", "value": "Add ssa2, zp to baseline\n" }, { "from": "human", "value": "# vim: sw=4 ts=4 sts expandtab smarttab\n# HXN step-scan configuration\n\nimport hxntools.scans\nfrom bluesky.global_state import get_gs\n\ngs = get_gs()\n\nhxntools.scans.setup()\nct = hxntools.scans.count...
python
chosen
[ { "from": "system", "value": "Add missing dependency to clowder_test\n" }, { "from": "human", "value": "\"\"\"\nSetup file for clowder test runner\n\"\"\"\n\nfrom setuptools import setup\n\n# Written according to the docs at\n# https://packaging.python.org/en/latest/distributing.html\n\nsetup(\n...
python
chosen
[ { "from": "system", "value": "Fix for Spider Bot Defense\n\nUpdated user-agent to defeat a known defense against Python urllib-based http Spider Bot requests." }, { "from": "human", "value": "from urllib.request import Request, urlopen\nimport json\n\nreq = Request('http://jsonplaceholder.typico...
python
chosen
[ { "from": "system", "value": "Disable pylint warning for xrange.\n\nPylint complains that xrange is an undefined variable when its run under\nPython 3. This is true, which is why the offending line is wrapped with\nan 'if PY3' clause.\n" }, { "from": "human", "value": "\"\"\"\nPython 2 / 3 compa...
python
chosen
[ { "from": "system", "value": "Rename orcomm pkg to app\n" }, { "from": "human", "value": "import os\nimport uuid\n\nfrom infosystem.common import authorization\nfrom infosystem import database\nfrom flask import Flask\nfrom infosystem import system as system_module\n\nfrom orcomm import init_dat...
python
chosen
[ { "from": "system", "value": "Read binary data file location from commandline\n" }, { "from": "human", "value": "import numpy as np\nimport matplotlib.pyplot as plt\nfrom mpl_toolkits.mplot3d import Axes3D\n\ndef loadCudaStream(name):\n \"\"\"\n reads the file specified by name into a nump...
python
chosen
[ { "from": "system", "value": "Handle removal of IS_PY3 from numba\n\nCloses #133" }, { "from": "human", "value": "# Copyright (c) 2017, Michael Boyle\n# See LICENSE file for details: <https://github.com/moble/quaternion/blob/master/LICENSE>\n\nfrom __future__ import division, print_function, abs...
python
chosen
[ { "from": "system", "value": "Allow int(msg) and float(msg) calls\n" }, { "from": "human", "value": "# The main message class that the AuthChannel operate on\nclass AuthenticatedMessage(object):\n\n def __init__(self, sender, msg, session=None):\n self.sender = sender\n self.msg...
python
chosen
[ { "from": "system", "value": "Fix typos in PDFium fetch config.\n\n- The extra comma at the end of the url string unintentionally turns\n the url into a list.\n- The project name should be \"pdfium\".\n\nChange-Id: I8944d59d06751716c512030145d29aac10cf13fd\nReviewed-on: https://chromium-review.googlesource...
python
chosen
[ { "from": "system", "value": "Remove invalid keyword from parameters dictionary\n\n" }, { "from": "human", "value": "import os\nfrom threading import Thread\n\nfrom werkzeug._reloader import ReloaderLoop\n\n\nclass Watcher(Thread, ReloaderLoop):\n\n def __init__(self, paths, static, tasks, in...
python
chosen
[ { "from": "system", "value": "Fix up a typo in utilities\n" }, { "from": "human", "value": "class ConfigItem(object):\n \"\"\"The configuration item which may be bound with a instance.\n\n :param name: the property name.\n :param namespace: optional. the name of the attribute which cont...
python
chosen
[ { "from": "system", "value": "Use display name instead of full name\n" }, { "from": "human", "value": "from __future__ import absolute_import\n\nfrom sentry.api.serializers import Serializer, register\nfrom sentry.models import User\nfrom sentry.utils.avatar import get_gravatar_url\n\n\n@registe...
python
chosen
[ { "from": "system", "value": "Package metadata should have ASL2 as license\n" }, { "from": "human", "value": "#! /usr/bin/env python\n# Licensed to Cloudera, Inc. under one\n# or more contributor license agreements. See the NOTICE file\n# distributed with this work for additional information\n#...
python
chosen
[ { "from": "system", "value": "Add version information to package\n" }, { "from": "human", "value": "#!/usr/bin/python\n# -*- coding: utf-8 -*-\n\"\"\"\nThis package implements community detection.\n\nPackage name is community but refer to python-louvain on pypi\n\"\"\"\n\nfrom .community_louvain...
python
chosen
[ { "from": "system", "value": "FIX - path of .cfg file corrected\n" }, { "from": "human", "value": "\"\"\"\nAuthor: Ashish Gaikwad <ash.gkwd@gmail.com>\nCopyright (c) 2015 Ashish Gaikwad\n\nDescription: This script will post a message on your slack channel\nPlease configure your `/etc/brainy-beat...
python
chosen
[ { "from": "system", "value": "Add function for broken and groundwork for other objectives\n" }, { "from": "human", "value": "#!/usr/bin/env python\nfrom __future__ import print_function\nfrom __future__ import unicode_literals\n\n\ndef safe_input(prompt):\n \"\"\"Return user input after catch...
python
chosen
[ { "from": "system", "value": "Add mapper decorator to DmesgLineList mapper\n\n* Add @mapper decorator to the DmesgLineList shared mapper to allow use\n directly by plugins.\n" }, { "from": "human", "value": "from .. import LogFileOutput, mapper\n\n\nclass DmesgLineList(LogFileOutput):\n def ...
python
chosen
[ { "from": "system", "value": "Add blank line to fix linting error\n" }, { "from": "human", "value": "\"\"\"A module to prove a way of locating and loading test resource files.\n\nThis is akin to the `iati.resources` module, but deals with test data.\n\n\"\"\"\nimport iati.resources\n\ndef load_a...
python
chosen
[ { "from": "system", "value": "Add documentation, tests, fix corr\n" }, { "from": "human", "value": "\nimport numpy as np\n\n\ndef _check_stc(stc1, stc2):\n # XXX What should we check? that the data is having the same size?\n if stc1.data.shape != stc2.data.shape:\n raise ValueError(...
python
chosen
[ { "from": "system", "value": "Check for token file before installing\n" }, { "from": "human", "value": "import os\n\n\nprint(\"Example Pi Box path: /home/username/my-pi-box\")\npi_box_directory = raw_input(\"Pi Box path: \")\n\nif not os.path.isdir(pi_box_directory):\n\tos.makedirs(pi_box_direct...
python
chosen
[ { "from": "system", "value": "Remove use of generator completely\n" }, { "from": "human", "value": "from threading import Timer\nfrom . import track\n\n_listeners = []\n\nclass TrackChecker():\n\tdef __init__(self, interval = 5):\n\t\tself.listeners = []\n\t\tself.CHECK_INTERVAL = interval\n\t\t...
python
chosen
[ { "from": "system", "value": "Add a long type backfill for PY3 compat\n\nPY3 combined the long and int types which makes some compiler\noperations difficult. Adding a backfill to help with PY2/PY3\ncompat.\n\nSigned-off-by: Kevin Conway <3473c1f185ca03eadc40ad288d84425b54fd7d57@gmail.com>\n" }, { "f...
python
chosen
[ { "from": "system", "value": "Add test for oldstyle class handling\n" }, { "from": "human", "value": "\"\"\"\nTest that if foreign code provides a class that conforms to\nBidirectionalMapping's interface, it is automatically a subclass.\n\"\"\"\nfrom bidict import BidirectionalMapping\n\n\nclass...
python
chosen
[ { "from": "system", "value": "Reorganize python-imports to include \"curses\"\n" }, { "from": "human", "value": "import zlib\nimport bz2\n\nassert(zlib.decompress(zlib.compress(b'IT WORKS IT WORKS IT WORKS')) == b'IT WORKS IT WORKS IT WORKS')\nassert(bz2.decompress(bz2.compress(b'IT WORKS IT WOR...
python
chosen
[ { "from": "system", "value": "Fix wrong pdb parser invocation\n" }, { "from": "human", "value": "from peptide import PeptideBuilder\nimport Bio.PDB\n\n\ndef write_pdb(aa_sequence, fragment_angles, gap_length, filepath):\n \"\"\"\n Generate pdb file with results\n\n :param aa_sequence: A...
python
chosen
[ { "from": "system", "value": "Rename path parameter in contrib.cms.BundleCMSSW.\n" }, { "from": "human", "value": "# -*- coding: utf-8 -*-\n\n\"\"\"\nCMS-related tasks.\nhttps://home.cern/about/experiments/cms\n\"\"\"\n\n\n__all__ = [\"BundleCMSSW\"]\n\n\nimport os\n\nimport luigi\n\n\nfrom law ...
python
chosen
[ { "from": "system", "value": "Revert log level setup to WARN\n" }, { "from": "human", "value": "# -*- coding: utf-8 -*-\nimport logging\n\nimport praw\n\nfrom settings import Config\nfrom .database import create_db_session\n\n\nlogging.basicConfig(level=\"INFO\")\nlogger = logging.getLogger(__na...
python
chosen
[ { "from": "system", "value": "Rewrite monitortests. Add tests for update_image\n" }, { "from": "human", "value": "#!/usr/bin/python\n\nimport unittest\nimport monitor\n\nclass TestMonitor(unittest.TestCase):\n\n\tdef test_attr(self):\n\t\tmon = monitor.Monitor()\n\t\tassert mon.pvprefix == \"MON...
python
chosen
[ { "from": "system", "value": "Add support for returning search results as JSON.\n" }, { "from": "human", "value": "from django.shortcuts import render\nfrom django.core.paginator import Paginator, EmptyPage, PageNotAnInteger\n\nfrom wagtail.wagtailcore.models import Page\nfrom wagtail.wagtailsea...
python
chosen
[ { "from": "system", "value": "Make script log file names more consistent\n\n...by stripping c's of filenames, so that we get\nscript_name.py-timestamp rather than script_name.pyc-timestamp\n" }, { "from": "human", "value": "# -*- coding: utf-8 -*-\n\nimport os\nimport logging\nimport datetime\n\...
python
chosen
[ { "from": "system", "value": "Implement method to show contents of the list.\n" }, { "from": "human", "value": "shopping_list = []\n\ndef show_help():\n print(\"What should we pick up at the store?\")\n print(\"Enter DONE to stop. Enter HELP for this help. Enter SHOW to see your current list.\...
python
chosen
[ { "from": "system", "value": "Add credit property to member REST API response\n" }, { "from": "human", "value": "from rest_framework import viewsets, serializers\nfrom .models import MemberType, Member, MembershipApplicationTag, MembershipApplication\n\nclass MemberTypeSerializer(serializers.Hyp...
python
chosen
[ { "from": "system", "value": "Use asyncio in plain python example.\n" }, { "from": "human", "value": "#!/usr/bin/python3\n\ndef make_a_file(i):\n f = \"out_python/{:05d}\".format(i)\n try:\n with open(f, \"w\") as fp:\n fp.write(\"hello\")\n # print(\"wrote\", f)\n...
python
chosen
[ { "from": "system", "value": "Deploy smart contracts v0.0.6 to Ropsten" }, { "from": "human", "value": "# -*- coding: utf-8 -*-\n\nUINT64_MAX = 2 ** 64 - 1\nUINT64_MIN = 0\n\nINT64_MAX = 2 ** 63 - 1\nINT64_MIN = -(2 ** 63)\n\nUINT256_MAX = 2 ** 256 - 1\n\n# Deployed to Ropsten revival on 2017-08...
python
chosen
[ { "from": "system", "value": "Test will fail, will jenkins run?\n" }, { "from": "human", "value": "from django.test import TestCase\n\nfrom rest_framework.test import APIClient\n\nfrom movies.test import factories\n\n\nclass MovieViewSetTestCase(TestCase):\n def setUp(self):\n self.api...
python
chosen
[ { "from": "system", "value": "Use correct test data path\n" }, { "from": "human", "value": "\"\"\"\nTests of neo.rawio.examplerawio\n\nNote for dev:\nif you write a new RawIO class your need to put some file\nto be tested at g-node portal, Ask neuralensemble list for that.\nThe file need to be s...
python
chosen
[ { "from": "system", "value": "Change coref to external call\n" }, { "from": "human", "value": "\"\"\"\nWrapper around antske/coref_draft.\nInput should be NAF files parsed by alpino (e.g. alpinonerc)\n\"\"\"\n\nfrom KafNafParserPy import KafNafParser\nfrom multisieve_coreference import process_c...
python
chosen
[ { "from": "system", "value": "Add OCA as author of OCA addons\n\nIn order to get visibility on https://www.odoo.com/apps the OCA board has\ndecided to add the OCA as author of all the addons maintained as part of the\nassociation.\n" }, { "from": "human", "value": "# -*- coding: utf-8 -*-\n#####...
python
chosen
[ { "from": "system", "value": "Call Resource constructor from Validator, fixing a Girder warning\n" }, { "from": "human", "value": "from girder.api import access\nfrom girder.api.rest import Resource\nfrom girder.api.describe import Description\n\n\nclass Validator(Resource):\n def __init__(se...
python
chosen
[ { "from": "system", "value": "Add specifications for Bitcoin mainnet and testnet" }, { "from": "human", "value": "from collections import namedtuple\n\nNetwork = namedtuple('Network', [\n 'network_name',\n 'network_shortname',\n 'pubkeyhash',\n 'wif_prefix',\n 'scripthash',\n '...
python
chosen
[ { "from": "system", "value": "Use communicate so process out does not deadlock\n" }, { "from": "human", "value": "from celery import task\nimport os\nimport sys\nimport subprocess\n\n@task()\ndef build(build, giturl, branch):\n # Use subprocess to execute a build, update the db with results\n...
python
chosen
[ { "from": "system", "value": "Fix typo in project name\n" }, { "from": "human", "value": "from django import template\nfrom django.template.loader import render_to_string\nfrom django.utils.text import capfirst\n\nfrom django_modelview import generic\n\nregister = template.Library()\n\n\n@regist...
python
chosen
[ { "from": "system", "value": "Update the models for Auth and User.\n" }, { "from": "human", "value": "from django.shortcuts import render\n\n# Create your views here.\n" }, { "from": "gpt", "value": "from django.shortcuts import render\nfrom django.contrib.auth import login, logout\n...
python
chosen
[ { "from": "system", "value": "Remove duplicate code for alternative function\n" }, { "from": "human", "value": "import warnings\nimport functools\n\n\n__all__ = ['deprecated']\n\n\nclass deprecated(object):\n '''Decorator to mark deprecated functions with warning.\n\n Adapted from <http://...
python
chosen
[ { "from": "system", "value": "Remove the no-JS version from the app\n\nI haven't looked into it for a long while.\n" }, { "from": "human", "value": "from flask import Flask, g\nfrom .main.views import main\nfrom .nojs.views import nojs\nfrom sqlalchemy import create_engine\nfrom smoke_signal.dat...
python
chosen
[ { "from": "system", "value": "Terminate instances is not proper tag\n" }, { "from": "human", "value": "s program terminate instances if proper tag is not used\n\n\"\"\"\n\nimport time\nimport boto3\n\nstart_time = time.time()\nec2 = boto3.resource('ec2')\nec2_client = boto3.client('ec2')\ntag_d...
python
chosen
[ { "from": "system", "value": "Add name for url config of `ActivateView`\n" }, { "from": "human", "value": "from django.conf.urls import url\nfrom django.contrib.auth import views as auth_views\n\nfrom .views import (SignupView, UserProfileUpdateView, DrawNamesView,\n UserProfi...
python
chosen
[ { "from": "system", "value": "Add Environment Profile to Admin view\n" }, { "from": "human", "value": "from django.contrib import admin\nfrom installer_config.models import Package, TerminalPrompt, EnvironmentProfile\n\n\nclass PackageAdmin(admin.ModelAdmin):\n model = Package\n list_displ...
python
chosen
[ { "from": "system", "value": "Rename `get_user` to `get_or_create_user` and add a new `get_user`\n" }, { "from": "human", "value": "from django.contrib.auth.models import User\n\nfrom nightreads.posts.models import Tag\nfrom .models import (Subscription, SubscriptionActivation,\n ...
python
chosen
[ { "from": "system", "value": "Add test case to holland.lib.lvm for parsing snapshot-size without units\n" }, { "from": "human", "value": "import os\nimport signal\nfrom nose.tools import *\nfrom holland.lib.lvm.util import *\n\ndef test_format_bytes():\n assert_equals(format_bytes(1024), '1.0...
python
chosen
[ { "from": "system", "value": "Print and return the correct data\n" }, { "from": "human", "value": "'''\nExecute overstate functions\n'''\n\n# Import Salt libs\nimport salt.overstate\nimport salt.output\n\ndef over(env='base', os_fn=None):\n '''\n Execute an overstate sequence to orchestrat...
python
chosen
[ { "from": "system", "value": "Use get parameter in token auth (nc-544)\n" }, { "from": "human", "value": "from __future__ import unicode_literals\n\nimport nodeconductor.logging.middleware\n\nimport rest_framework.authentication\n\n\ndef user_capturing_auth(auth):\n class CapturingAuthenticat...
python
chosen
[ { "from": "system", "value": "Add some more acts as list tests.\n" }, { "from": "human", "value": "import unittest2\n\nfrom querylist import QueryList\n\nclass QueryListActsAsList(unittest2.TestCase):\n \"\"\"QueryList should behave as lists behave\"\"\"\n def setUp(self):\n self.sr...
python
chosen
[ { "from": "system", "value": "Add bool cast to appease ST3\n" }, { "from": "human", "value": "import sublime, sublime_plugin\nfrom os.path import relpath\n\nclass CopyRelativePathCommand(sublime_plugin.TextCommand):\n def run(self, edit):\n filename = self.view.file_name()\n if ...
python
chosen
[ { "from": "system", "value": "Add new InstitutionSummary to run_keen_summarries harness\n" }, { "from": "human", "value": "from framework.celery_tasks import app as celery_app\nfrom scripts.analytics.user_summary import UserSummary\nfrom scripts.analytics.node_summary import NodeSummary\nfrom sc...
python
chosen
[ { "from": "system", "value": "Make InvalidHostnameError a subclass of InvalidHostError\n" }, { "from": "human", "value": "# -*- coding: utf-8 -*-\n\nclass SpamListsError(Exception):\n '''There was an error during testing a url or host'''\n \nclass UnknownCodeError(SpamListsError, KeyError)...
python
chosen
[ { "from": "system", "value": "Add __all__ to draw package\n" }, { "from": "human", "value": "from ._draw import line, polygon, ellipse, ellipse_perimeter, \\\n circle, circle_perimeter, set_color, bresenham\n" }, { "from": "gpt", "value": "from ._draw import line, p...
python
chosen
[ { "from": "system", "value": "Work with plain SQL files\n" }, { "from": "human", "value": "import sys\nimport sqlparse\nfrom .checks import has_cross_join\n\n\ndef parse_file(filename):\n import json\n with open(filename, 'r') as fh:\n return json.load(fh)\n\n\nCHECKS = (\n (has_...
python
chosen
[ { "from": "system", "value": "Fix URLs returned by the API, make sure we have the traling slash\n" }, { "from": "human", "value": "from django.conf.urls import include, url\nfrom django.contrib import admin\nfrom rest_framework.routers import DefaultRouter\nfrom . import views\n\nadmin.site.site...
python
chosen
[ { "from": "system", "value": "Remove todo on lissu php ajax call. It returns and empty array in case of problems\n" }, { "from": "human", "value": "\nsites_to_check = [\n {\n \"name\": \"Lissu Monitor\",\n \"url\": \"http://lissu.tampere.fi/monitor.php?stop=0014\",\n \"ac...
python
chosen
[ { "from": "system", "value": "Refactor rename to cost matrx\n" }, { "from": "human", "value": "from distutils.core import setup\nfrom Cython.Build import cythonize\n\next_options = {\"compiler_directives\": {\"profile\": True}, \"annotate\": True}\n\nsetup(\n name='Weighted-Levenshtein',\n ...
python
chosen
[ { "from": "system", "value": "Allow redirecting dock's logs to a given handler only\n" }, { "from": "human", "value": "\"\"\"\nCopyright (c) 2015 Red Hat, Inc\nAll rights reserved.\n\nThis software may be modified and distributed under the terms\nof the BSD license. See the LICENSE file for deta...
python
chosen
[ { "from": "system", "value": "Add handlers for the index/search subcommands\n" }, { "from": "human", "value": "# -*- coding: utf-8 -*-\n\"\"\"Elastic Search Index & Search.\"\"\"\n\nimport argparse\nimport os\n\n\ndef main():\n \"\"\"Entry point for the esis.py script.\"\"\"\n args = parse...
python
chosen
[ { "from": "system", "value": "Use include() instead of appending urlpatterns.\n" }, { "from": "human", "value": "from django.conf.urls.defaults import *\nfrom django.contrib import admin\n\nfrom codereview.urls import urlpatterns\n\nadmin.autodiscover()\n\nurlpatterns += patterns('',\n (r...
python
chosen
[ { "from": "system", "value": "Load the version from the package metadata rather than trying to maintain it in a third place.\n" }, { "from": "human", "value": "# -*- coding: utf-8 -*-\nfrom .events import Event\n\n__author__ = 'YouGov, plc'\n__email__ = 'dev@yougov.com'\n__version__ = '0.3.0'\n\...
python
chosen
[ { "from": "system", "value": "Fix tests to work when GOOGLE_ANALYTICS_KEY is not set.\n" }, { "from": "human", "value": "import unittest\n\nclass TestRecaptchaTags(unittest.TestCase):\n\n def test_recaptcha_html(self):\n from fixcity.bmabr.templatetags import recaptcha_tags\n fr...
python
chosen
[ { "from": "system", "value": "Use new line style for Generalization item\n" }, { "from": "human", "value": "\"\"\"\nGeneralization --\n\"\"\"\n\nfrom gi.repository import GObject\n\nfrom gaphor import UML\nfrom gaphor.diagram.diagramline import DiagramLine\n\n\nclass GeneralizationItem(DiagramLi...
python
chosen
[ { "from": "system", "value": "Support Google Apps drive urls\n" }, { "from": "human", "value": "import re\n\n__author__ = 'tigge'\n\nfrom wand.image import Image\n\n\ndef fix_image(filename, max_width):\n with Image(filename=filename) as img:\n img.auto_orient()\n if img.width >...
python
chosen
[ { "from": "system", "value": "Implement Ravaging Ghoul, Bloodhoof Brave, N'Zoth's First Mate\n" }, { "from": "human", "value": "from ..utils import *\n\n\n##\n# Minions\n\n\n##\n# Spells\n\nclass OG_276:\n\t\"Blood Warriors\"\n\tplay = Give(CONTROLLER, Copy(FRIENDLY_MINIONS + DAMAGED))\n\n\nclas...
python
chosen
[ { "from": "system", "value": "Fix url regex that allowed illegal url\n\nOld url pattern allowed /id/ (without a number), which resulted in a\n500 (and an email). And lately google spiders seems to do this daily.\n" }, { "from": "human", "value": "from django.conf.urls import url\nfrom . import ...
python
chosen
[ { "from": "system", "value": "OTHER: Make resolving of git commit id use git-rev-parse.\n" }, { "from": "human", "value": "import os\nimport sha\n\ndef gitsha(path):\n h = sha.sha()\n data = file(path).read()\n h.update(\"blob %d\\0\" % len(data))\n h.update(data)\n return h.hexdi...
python
chosen
[ { "from": "system", "value": "Update test to work with new monitors.\n" }, { "from": "human", "value": "import theanets\n\nimport util\n\n\nclass TestTrainer(util.MNIST):\n def setUp(self):\n super(TestTrainer, self).setUp()\n self.exp = theanets.Experiment(\n theanet...
python
chosen
[ { "from": "system", "value": "Add configurable ok status code for Response\n\nWhen scheduling a pipeline the successful code is 202, so tihis needs\nto be configurable.\n" }, { "from": "human", "value": "import json\n\n\nclass Response(object):\n def __init__(self, status_code, body, headers=...
python
chosen
[ { "from": "system", "value": "Use supermodel/zope.schema for Todo field definition\n" }, { "from": "human", "value": "# -*- encoding: utf-8 -*-\nfrom aiohttp.web import Response\nfrom zope.interface import Attribute\nfrom zope.interface import Interface\n\n\nclass ITodo(Interface):\n title = ...
python
chosen
[ { "from": "system", "value": "Update variable name for RGB line profile\n" }, { "from": "human", "value": "from skimage import data\nfrom skimage.viewer import ImageViewer\nfrom skimage.viewer.plugins.lineprofile import LineProfile\n\n\nimage = data.chelsea()\nviewer = ImageViewer(image)\nviewer...
python
chosen
[ { "from": "system", "value": "Fix given path order for Google App Engine\n" }, { "from": "human", "value": "import os\nimport hashlib\nfrom datetime import datetime\n\nVCS_NAMES = ['.svn', '.git', '.bzr', '.hg']\nIGNORED_EXTENSIONS = ['.swp', '.tmp', '.pyc', '.pyo']\n\n\ndef list_directory(path,...
python
chosen
[ { "from": "system", "value": "Revert \"fixed the issue of a client throwing exception - log to stderr and return gracefully\"\n\nThis reverts commit 4cecd6558ec9457d0c3e933023a8a1f77714eee5.\n" }, { "from": "human", "value": "import logging\nimport sys\n\nclass SentryHandler(logging.Handler):\n ...
python
chosen
[ { "from": "system", "value": "Use pytest fixture to deal with compilation\n" }, { "from": "human", "value": "import os\nimport mylib\nos.system('make all')\n\n\ndef test_squared():\n assert 16. == mylib.squared(4) \n\n\ndef test_myfunction():\n assert 16. == mylib.myfunction(mylib.squared,...
python
chosen
[ { "from": "system", "value": "Add landmine after change to messages.h\n\nBUG=N\nLOG=N\nTBR=machenbach@chromium.org\n\nReview URL: https://codereview.chromium.org/1174523004\n\nCr-Commit-Position: 972c6d2dc6dd5efdad1377c0d224e03eb8f276f7@{#28875}\n" }, { "from": "human", "value": "#!/usr/bin/env ...
python
chosen
[ { "from": "system", "value": "Add alias cclib.ccopen for easy access\n" }, { "from": "human", "value": "# -*- coding: utf-8 -*-\n#\n# Copyright (c) 2016, the cclib development team\n#\n# This file is part of cclib (http://cclib.github.io) and is distributed under\n# the terms of the BSD 3-Clause...
python
chosen
[ { "from": "system", "value": "Remove extra iolib fron init.py\n" }, { "from": "human", "value": "# Copyright (c) 2018 The Bitcoin Unlimited developers\n# Distributed under the MIT software license, see the accompanying\n# file COPYING or http://www.opensource.org/licenses/mit-license.php.\n\nfro...
python
chosen
[ { "from": "system", "value": "Add dijkstras algorithm and depth first search in python\n" }, { "from": "human", "value": "class Solution:\n def bubbleSortOptimized(self, nums: List[int]) -> None:\n if len(nums) == 1:\n return nums\n else:\n swapped = False\...
python
chosen
[ { "from": "system", "value": "Fix test helper once and for all\n" }, { "from": "human", "value": "import github3\n\nfrom .helper import IntegrationHelper\n\n\ndef find(func, iterable):\n return next(filter(func, iterable))\n\n\nclass TestDeployment(IntegrationHelper):\n def test_create_sta...
python
chosen