conversations
listlengths
2
3
source
stringclasses
1 value
stack
stringclasses
1 value
[ { "from": "system", "value": "Determine response time for messages\n" }, { "from": "human", "value": "# XML Parsing\nimport xml.etree.ElementTree as ET\n\n# HTML output\nimport dominate as dom\nfrom dominate.tags import *\n\n# Interact with user machine\nimport datetime\nfrom sys import argv\nim...
python
chosen
[ { "from": "system", "value": "Update example syntax to python3\n" }, { "from": "human", "value": "from __future__ import print_function\n\nfrom transloadit.client import Transloadit\n\ntl = Transloadit('TRANSLOADIT_KEY', 'TRANSLOADIT_SECRET')\nass = tl.new_assembly()\nass.add_file(open('fixtures...
python
chosen
[ { "from": "system", "value": "Disable braekpad automatic registration while we figure out stuff\n\nReview URL: http://codereview.chromium.org/462022\n\ngit-svn-id: bd64dd6fa6f3f0ed0c0666d1018379882b742947@33686 4ff67af0-8c30-449e-8e8b-ad334ec8d88c\n" }, { "from": "human", "value": "# Copyright (...
python
chosen
[ { "from": "system", "value": "Add links to fixture and casedb specs\n" }, { "from": "human", "value": "from casexml.apps.case.xml.generator import safe_element\nfrom casexml.apps.phone.xml import get_casedb_element\n\n\nclass CaseDBFixture(object):\n \"\"\"Used to provide a casedb-like struct...
python
chosen
[ { "from": "system", "value": "Add a method for getting a list of releases to fetch\n" }, { "from": "human", "value": "from __future__ import absolute_import\nfrom __future__ import division\n\n\nfrom xmlrpc2 import client as xmlrpc2\n\n\nclass BaseProcessor(object):\n\n def __init__(self, ind...
python
chosen
[ { "from": "system", "value": "Return 'user' role as default value\n" }, { "from": "human", "value": "import django_openstack.urls\n\n\nclass Roles:\n USER = 'user'\n PROJECT_ADMIN = 'projadmin'\n SOFTWARE_ADMIN = 'softadmin'\n HARDWARE_ADMIN = 'hardadmin'\n ALL_ROLES = (HARDWARE_A...
python
chosen
[ { "from": "system", "value": "Fix the import for Wordpress\n" }, { "from": "human", "value": "import json\n\nimport foauth\n\n\nclass Wordpress(foauth.providers.OAuth2):\n # General info about the provider\n provider_url = 'https://www.wordpress.com/'\n favicon_url = 'http://s2.wp.com/i...
python
chosen
[ { "from": "system", "value": "Handle filenames with path prefixes in git commit logs\n" }, { "from": "human", "value": "import redis\nimport json\nfrom django.conf import settings\nimport iconclass\nimport requests\nimport time\n\ndef handle_githubpushes():\n redis_c = redis.StrictRedis()\n ...
python
chosen
[ { "from": "system", "value": "Document the AppFactory, add the doc headers.\n" }, { "from": "human", "value": "\"\"\"\n.. module:: app_factory\n :platform: linux\n :synopsis: \n\n.. moduleauthor:: Paul Fanelli <paul.fanelli@gmail.com>\n\n.. modulecreated:: 6/27/15\n\n\"\"\"\nfrom zope.interf...
python
chosen
[ { "from": "system", "value": "Make Internet connection check a little faster\n\nTesting whether Internet connect is available only cares about if the\nremote server is able to response something, but not the concrete\ncontent returned. So, when remote server responses 301, it's enough, no\nneed to wait for ...
python
chosen
[ { "from": "system", "value": "Add function to determine metadata length\n" }, { "from": "human", "value": "import javabridge as jv\nimport bioformats as bf\n\ndef start(max_heap_size='8G'):\n \"\"\"Start the Java Virtual Machine, enabling bioformats IO.\n\n Parameters\n ----------\n ...
python
chosen
[ { "from": "system", "value": "Clean up cookie lookup in TTRAuth\n" }, { "from": "human", "value": "from requests.auth import AuthBase\nimport requests\nimport json\nfrom exceptions import raise_on_error\n\n\nclass TTRAuth(AuthBase):\n def __init__(self, user, password):\n self.user = u...
python
chosen
[ { "from": "system", "value": "Make the script check all the site package directories\n" }, { "from": "human", "value": "import os\nfrom distutils import sysconfig\n\n# Check to see if the previous version was installed and clean up\n# installed-files.txt\nprune = ['var/', 'var/run/', 'var/log/']...
python
chosen
[ { "from": "system", "value": "Fix formatted_raw_ostream ownership error with the underlying stream.\n" }, { "from": "human", "value": "from binding import *\nfrom ..namespace import llvm\nfrom raw_ostream import raw_ostream\n\n@llvm.Class(raw_ostream)\nclass formatted_raw_ostream:\n _include_...
python
chosen
[ { "from": "system", "value": "Fix missing next in context.\n" }, { "from": "human", "value": "# -#- coding: utf-8 -#-\n\nfrom django.db import models\nfrom django.utils.translation import ugettext_lazy as _\n\nfrom leonardo.module.web.models import Widget\n\n\nLOGIN_TYPE_CHOICES = (\n (1, _(\...
python
chosen
[ { "from": "system", "value": "Make SGML less chatty in normal operation\n" }, { "from": "human", "value": "import logging\nimport os\n\nimport chryso.connection\nimport sepiida.config\nimport sepiida.log\n\nimport vanth.config\nimport vanth.server\nimport vanth.tables\n\nLOGGER = logging.getLogg...
python
chosen
[ { "from": "system", "value": "Add items per page as a preference to the forumm user model\n" }, { "from": "human", "value": "from django.contrib.auth.models import AbstractUser, Group\nfrom django.db import models\n\n\nclass ForumUser(AbstractUser):\n def __unicode__(self):\n return '%...
python
chosen
[ { "from": "system", "value": "Test recommendation via article class\n" }, { "from": "human", "value": "#!/usr/bin/env python\n# -*- coding: utf-8 -*-\nfrom django.test import TestCase\n\nfrom opps.articles.models import Article, Post\n\n\nclass ArticleModelTest(TestCase):\n\n fixtures = ['tes...
python
chosen
[ { "from": "system", "value": "Add field mirror_site at exclude on LoggingAdmin\n" }, { "from": "human", "value": "#!/usr/bin/env python\n# -*- coding: utf-8 -*-\nfrom django.contrib import admin\n\nfrom .models import Logging\n\n\nclass LoggingAdmin(admin.ModelAdmin):\n model = Logging\n r...
python
chosen
[ { "from": "system", "value": "Revert \"Adds item title to list editable\"\n\nThis reverts commit e69869d4945cd72245e9243b3ec3131145ba27c2.\n" }, { "from": "human", "value": "from django.contrib import admin\nfrom .models import Item\nfrom tasks.models import Task\n\nclass TaskInline(admin.Tabula...
python
chosen
[ { "from": "system", "value": "Make this work for non-ASCII chars as well.\n" }, { "from": "human", "value": "#! /usr/bin/env python\n\nimport sys\nimport json\n\nfor filepath in sys.argv[1:]:\n with open(filepath) as f:\n try:\n oyster = json.load(f)\n except ValueErr...
python
chosen
[ { "from": "system", "value": "Truncate the file before writing more data.\n" }, { "from": "human", "value": "#! /usr/bin/env python3\n\nimport sys\nimport json\nimport argparse\n\ndef format_json(fp):\n try:\n data = json.load(fp)\n except ValueError:\n sys.stderr.write(\"In ...
python
chosen
[ { "from": "system", "value": "Fix parent synonym for Location model\n" }, { "from": "human", "value": "# -*- coding: utf-8 -*-\n\nfrom . import db, BaseScopedNameMixin\nfrom flask import url_for\nfrom .board import Board\n\n__all__ = ['Location']\n\n\nclass Location(BaseScopedNameMixin, db.Model...
python
chosen
[ { "from": "system", "value": "Add implementation of gmpe Pezeshk et al 2011 for ENA\n" }, { "from": "human", "value": "# The Hazard Library\n# Copyright (C) 2013 GEM Foundation\n#\n# This program is free software: you can redistribute it and/or modify\n# it under the terms of the GNU Affero Gene...
python
chosen
[ { "from": "system", "value": "Fix comparison with NULL bug\n" }, { "from": "human", "value": "\"\"\"set suppliers active flag NOT NULLABLE\n\nEnsure that all suppliers are either active or inactive.\n\nRevision ID: 1340\nRevises: 1330\nCreate Date: 2019-06-26 11:53:56.085586\n\n\"\"\"\nfrom alem...
python
chosen
[ { "from": "system", "value": "Test add_order and order details with existing order_id url\n" }, { "from": "human", "value": "from django.test import TestCase, Client\n\nc = Client()\nresponse = c.get('/officelunchorder/')\nresponse.status_code # 200\nresponse.content\nresponse = c.post('/officel...
python
chosen
[ { "from": "system", "value": "Put Image and Entity into __all__\n" }, { "from": "human", "value": "# imports for Pyrge package\n__all__ = ['effects',\n 'emitter',\n 'entity',\n 'gameloop',\n 'mixin',\n 'music',\n 'point',\n 'q...
python
chosen
[ { "from": "system", "value": "Test public body showing, json view and csv export" }, { "from": "human", "value": "\"\"\"\nThis file demonstrates writing tests using the unittest module. These will pass\nwhen you run \"manage.py test\".\n\nReplace this with more appropriate tests for your applica...
python
chosen
[ { "from": "system", "value": "Use [a-z]* pattern to match project ids\n" }, { "from": "human", "value": "import os\nimport kalamar.site\nfrom kalamar.access_point.cache import Cache\nfrom kalamar.access_point.xml.rest import Rest, RestProperty, TITLE\nfrom kalamar.access_point.filesystem import ...
python
chosen
[ { "from": "system", "value": "USe payout amount to calculate total\n" }, { "from": "human", "value": "from babel.numbers import get_currency_name, get_currency_symbol\nfrom bluebottle.utils.exchange_rates import convert\nfrom django.db.models import Sum\nfrom djmoney.money import Money\n\nfrom b...
python
chosen
[ { "from": "system", "value": "Handle UTF errors with invalid bytes.\n" }, { "from": "human", "value": "import logging\nimport requests\n\n\ndef scrape(url, extractor):\n \"\"\"\n Function to request and parse a given URL. Returns only the \"relevant\"\n text.\n\n Parameters\n ----...
python
chosen
[ { "from": "system", "value": "Add proper root selector to gcl2json\n" }, { "from": "human", "value": "import argparse\nimport json\nimport sys\n\nimport gcl\nfrom gcl import query\nfrom gcl import util\n\n\ndef main(argv=None, stdin=None):\n parser = argparse.ArgumentParser(description='Convert...
python
chosen
[ { "from": "system", "value": "Make test_multi_keyframe demonstrate what it's supposed to\n\nI was testing a cache that wasn't behaving correctly for\nunrelated reasons.\n" }, { "from": "human", "value": "import os\nimport shutil\n\nimport pytest\n\nfrom LiSE.engine import Engine\nfrom LiSE.examp...
python
chosen
[ { "from": "system", "value": "Fix error: __str__ returned non-string (type NoneType)\n" }, { "from": "human", "value": "from django.db import models\n\nclass Position(models.Model):\n\n class Meta:\n verbose_name = \"Position\"\n verbose_name_plural = \"Positions\"\n\n title ...
python
chosen
[ { "from": "system", "value": "Add logging permissions needed by aws-for-fluent-bit" }, { "from": "human", "value": "from troposphere import Join, iam, logs\n\nfrom .common import arn_prefix\nfrom .template import template\n\ncontainer_log_group = logs.LogGroup(\n \"ContainerLogs\",\n templ...
python
chosen
[ { "from": "system", "value": "Attach an `InternetGateway` to the `VPC`\n" }, { "from": "human", "value": "from troposphere.ec2 import (\n VPC,\n)\n\nfrom .template import template\n\n\nvpc = VPC(\n \"Vpc\",\n template=template,\n CidrBlock=\"10.0.0.0/16\",\n)\n" }, { "from": ...
python
chosen
[ { "from": "system", "value": "Switch master.chromium.lkgr to poll the chromium-status app.\n\nUsing a PBChangeSource is silly, opaque, and potentially dangerous. We already\nhave a URLPoller for exactly this use-case (already in use by chromium.endure)\nso let's use it here too. This also has the advantage ...
python
chosen
[ { "from": "system", "value": "Add a wider margin of accuracy\n" }, { "from": "human", "value": "PI = 3.141592654\n\nSAMPLE_TIME = 5\nFRAMES_PER_SEC = 30\nSEC_PER_MIN = 60\n\nRATE_RANGE = (95, 125) # 100 - 120 BPM (plus some error in measurement)\nDEPTH_RANGE = (2, 5) # At least 2 in (plus some...
python
chosen
[ { "from": "system", "value": "chore: Add docstring to plugin manager\n" }, { "from": "human", "value": "from pluginbase import PluginBase\n\n\nclass PluginManager:\n def __init__(self, paths, provider):\n self.paths = [paths]\n self.provider = provider\n\n plugin_base = P...
python
chosen
[ { "from": "system", "value": "Add Mapping methods to ObjectDictionary\n" }, { "from": "human", "value": "import collections\n\nclass ObjectDictionary(collections.Mapping):\n\n def __init__(self):\n self.names = {}\n self.ids = {}\n @classmethod\n def initialize(edsPath):\n...
python
chosen
[ { "from": "system", "value": "Use absolute path when loading config.\n" }, { "from": "human", "value": "\"\"\"\n Entry point and the only view we have.\n\"\"\"\n\nfrom .article_utils import get_articles\n\nfrom flask import Flask, render_template\nfrom os import path\n\napp = Flask(__name__)\...
python
chosen
[ { "from": "system", "value": "Fix problem of robots going wrong ways with Kalman (problem was really bad R_var_angle=>too big!)\n" }, { "from": "human", "value": "# -*- coding: utf-8 -*-\n\"\"\"\nGeneral options during execution\n\"\"\"\n\n#Position Log filename. Use None to disable.\nposition_l...
python
chosen
[ { "from": "system", "value": "Enhancement: Increment RSA key size to 2048.\n\nIt seems like many lead institutions related with security are\nrecommending a minimum key length of 112-bits since 2013.\nIn order to achieve that, a RSA key size of 2048 (or more) is required.\n" }, { "from": "human", ...
python
chosen
[ { "from": "system", "value": "Fix Item Model to have max_digits and decimal_places\n" }, { "from": "human", "value": "from django.db import models\n\n\n# Create your models here.\n\nclass Item(models.Model):\n \"\"\"\n Fields-\n 1. id = models.AutoField(primary_key=True) is created by d...
python
chosen
[ { "from": "system", "value": "Fix title casing for verbose app name.\n" }, { "from": "human", "value": "from django.apps import AppConfig\n\n\nclass QrCodeConfig(AppConfig):\n name = 'qr_code'\n verbose_name = 'Django QR code'\n" }, { "from": "gpt", "value": "from django.apps i...
python
chosen
[ { "from": "system", "value": "Add post_migrate receiver to create permissions\n\nThis should automatically create permissions for new models we add with\nSouth migrations.\n" }, { "from": "human", "value": "class ProgrammingError(Exception):\n \"\"\"Somebody made a mistake in the code.\"\"\"\...
python
chosen
[ { "from": "system", "value": "Add a little more functionality to EntryAdmin\n" }, { "from": "human", "value": "from django.contrib import admin\nfrom ledger.models import Account, Entry\n\n\nclass EntryAdmin(admin.ModelAdmin):\n list_display = ['date', 'amount', 'details', 'debit_account', 'c...
python
chosen
[ { "from": "system", "value": "Remove FieldConstraint class (not used)\n" }, { "from": "human", "value": "class FieldType:\n \"\"\" Acts as an enum for field types \"\"\"\n INTEGER = \"INTEGER\"\n TEXT = \"TEXT\"\n\nclass FieldConstraint:\n \"\"\" Acts a an enum for field constraints ...
python
chosen
[ { "from": "system", "value": "Update `get_partners` assignment tag to reduce the number of queries\n\nMaintains the same interface so no other changes should be required" }, { "from": "human", "value": "from django import template\nfrom partner_feeds.models import Partner\nregister = template.Li...
python
chosen
[ { "from": "system", "value": "Add missing import for HttpResponse\n" }, { "from": "human", "value": "from django.conf import settings\nfrom django.conf.urls.defaults import patterns, include\nfrom django.contrib.staticfiles.urls import staticfiles_urlpatterns\n\nfrom funfactory.monkeypatches imp...
python
chosen
[ { "from": "system", "value": "Fix for function signature change in 0.4.0 in fetch_access_token\n" }, { "from": "human", "value": "\"\"\"\nLswApi auth plugin for HTTPie.\n\"\"\"\nfrom json import loads, dumps\nfrom time import time\nfrom os import path\nfrom lswapi import __auth_token_url__, __to...
python
chosen
[ { "from": "system", "value": "Add the consumer name to the extra values\n" }, { "from": "human", "value": "\"\"\"\nLogging Related Things\n\n\"\"\"\nimport logging\n\n\nclass CorrelationFilter(logging.Formatter):\n \"\"\"Filter records that have a correlation_id\"\"\"\n def __init__(self, ...
python
chosen
[ { "from": "system", "value": "Build UE4 projects by name rather than by full path.\n" }, { "from": "human", "value": "# -*- coding: utf-8 -*-\n\n#-------------------------------------------------------------------------------\nimport socket\nimport random\nimport string\nimport time\nimport cont...
python
chosen
[ { "from": "system", "value": "Add notice on page reload\n" }, { "from": "human", "value": "#!/bin/env python\nfrom selenium import webdriver\nfrom selenium.common.exceptions import StaleElementReferenceException\nfrom time import sleep\nfrom getpass import getpass\n\n\nif __name__ == '__main__':...
python
chosen
[ { "from": "system", "value": "Allow adjusting of RoomHistoryEntry attributes in UserFactory\n\n" }, { "from": "human", "value": "# -*- coding: utf-8 -*-\n# Copyright (c) 2016 The Pycroft Authors. See the AUTHORS file.\n# This file is part of the Pycroft project and licensed under the terms of\n#...
python
chosen
[ { "from": "system", "value": "Add tests for NumPy _implementation usage\n" }, { "from": "human", "value": "import unittest\n\nimport numpy\nimport six\n\nimport cupy\nfrom cupy import testing\n\n\n@testing.gpu\nclass TestArrayFunction(unittest.TestCase):\n\n @testing.with_requires('numpy>=1.1...
python
chosen
[ { "from": "system", "value": "Add a comment saying why the WebRTC ref page set was disabled.\n\nBUG=523517\nCQ_EXTRA_TRYBOTS=tryserver.chromium.perf:linux_perf_bisect;tryserver.chromium.perf:mac_perf_bisect;tryserver.chromium.perf:win_perf_bisect;tryserver.chromium.perf:android_nexus5_perf_bisect\n\nReview ...
python
chosen
[ { "from": "system", "value": "Add ytid to the ChannelAdmin.\n" }, { "from": "human", "value": "from django.contrib import admin\n\nfrom .models import Channel, Thumbnail, Video\n\n\nclass VideoInline(admin.StackedInline):\n extra = 1\n model = Video\n\n\nclass ThumbnailInline(admin.Tabular...
python
chosen
[ { "from": "system", "value": "Add trivial test for the view to send an email\n" }, { "from": "human", "value": "\"\"\"accounts app unittests for views\n\n\"\"\"\nfrom django.test import TestCase\nfrom django.urls import reverse\n\n\nclass WelcomePageTest(TestCase):\n \"\"\"Tests relating to t...
python
chosen
[ { "from": "system", "value": "Unify errors and failures in API\n" }, { "from": "human", "value": "from sentinels import NOTHING\n\n\nclass ErrorContainer(object):\n\n def add_error(self, exception, exception_type, traceback, timestamp=NOTHING):\n return self.client.api.call_function('a...
python
chosen
[ { "from": "system", "value": "Make uuid on procedures unique\n" }, { "from": "human", "value": "from django.db import models\nfrom django.contrib.auth.models import User\n\nclass Procedure(models.Model):\n title = models.CharField(max_length=50)\n author = models.CharField(max_length=50)\n...
python
chosen
[ { "from": "system", "value": "Add simple test for operation get_data\n" }, { "from": "human", "value": "\nfrom cisco_olt_http import operations\n" }, { "from": "gpt", "value": "\nfrom cisco_olt_http import operations\nfrom cisco_olt_http.client import Client\n\n\ndef test_get_data():...
python
chosen
[ { "from": "system", "value": "Fix widget registry exception handling code\n" }, { "from": "human", "value": "__all__ = ('register_widget',)\nfrom django.utils.translation import ugettext as _\n\nclass WidgetAlreadyRegistered(Exception):\n \"\"\"\n An attempt was made to register a widget f...
python
chosen
[ { "from": "system", "value": "Fix bug; os.remove cannot remove directories\n" }, { "from": "human", "value": "# -*- coding: utf-8 -*-\nimport os\nfrom hycc.util import hycc_main\n\n\ndef clean():\n for path in os.listdir(\"tests/resources\"):\n if path not in [\"hello.hy\", \"__init__....
python
chosen
[ { "from": "system", "value": "Add index route to test application\n\nThis endpoint uses to start :class:`LiveServer` instance with minimum\nwaiting timeout.\n" }, { "from": "human", "value": "#!/usr/bin/env python\n# -*- coding: utf-8 -*-\nimport pytest\n\nfrom flask import Flask, jsonify\n\n\n@...
python
chosen
[ { "from": "system", "value": "Load resources by absolute path not relative\n" }, { "from": "human", "value": "#!/usr/bin/env python\n# -*- coding: utf-8 -*-\nfrom abstract import Abstract\nfrom json import Json\nfrom msgpack import MsgPack\n\n__all__ = ['Abstract', 'Json', 'MsgPack']\n" }, {...
python
chosen
[ { "from": "system", "value": "Print statements updated to be compatible with Python 3.\n" }, { "from": "human", "value": "from channels.generic.websockets import WebsocketConsumer, JsonWebsocketConsumer\nfrom .jsonrpcwebsocketconsumer import JsonRpcWebsocketConsumer\n\nclass MyJsonRpcWebsocketCo...
python
chosen
[ { "from": "system", "value": "Fix TestImport.py to work with Python 3.5.\n\nDifferential Revision: http://reviews.llvm.org/D16431\n\ngit-svn-id: 4c4cc70b1ef44ba2b7963015e681894188cea27e@258448 91177308-0d34-0410-b5e6-96231b3b80d8\n" }, { "from": "human", "value": "import TPunitA\nimport TPunitB\...
python
chosen
[ { "from": "system", "value": "Remove explicit inheritance from object\n" }, { "from": "human", "value": "\"\"\"\nHook wrapper \"result\" utilities.\n\"\"\"\nimport sys\n\n\ndef _raise_wrapfail(wrap_controller, msg):\n co = wrap_controller.gi_code\n raise RuntimeError(\n \"wrap_contr...
python
chosen
[ { "from": "system", "value": "Increase fraction of non-dropout frames required.\n" }, { "from": "human", "value": "#!/usr/bin/env python\n\nimport climate\nimport collections\nimport joblib\n\nimport database\n\n\ndef count(trial):\n trial.load()\n trial.reindex(100)\n trial.mask_dropou...
python
chosen
[ { "from": "system", "value": "Revert \"sudo is required to run which <gem-exec> on arch.\"\n\nThis reverts commit 15162c58c27bc84f1c7fc0326f782bd693ca4d7e.\n" }, { "from": "human", "value": "from fabric.api import env, run, sudo, settings, hide\n\n# Default system user\nenv.user = 'ubuntu'\n\n# ...
python
chosen
[ { "from": "system", "value": "FIX: Remove outdated function from list.\n" }, { "from": "human", "value": "\"\"\"\nThis module defines styles redefine matplotlib rc parameters. In addition, you\ncan override pre-defined styles with \"mplstyle\" files in the current\ndirectory and your home direct...
python
chosen
[ { "from": "system", "value": "Set STATIC_URL from an env var if available.\n" }, { "from": "human", "value": "import os\nimport socket\n\nfrom .base import * # noqa\n\n\nSERVER_ENV = os.getenv('DJANGO_SERVER_ENV')\nSECRET_KEY = os.getenv('SECRET_KEY')\nDEBUG = TEMPLATE_DEBUG = False\nALLOWED_HO...
python
chosen
[ { "from": "system", "value": "Work around for dump setting issue.\n" }, { "from": "human", "value": "import os\n\nfrom django.core.management import BaseCommand\nfrom django.conf import settings\n\n\ndef dump_attrs(obj_instance):\n for attr in dir(obj_instance):\n if attr != attr.upper...
python
chosen
[ { "from": "system", "value": "Add trait's wines to serializer.\n" }, { "from": "human", "value": "from django.contrib.auth.models import User\nfrom rest_framework import serializers\nfrom .models import Note, Trait, Wine, Winery\n\n\nclass WinerySerializer(serializers.ModelSerializer):\n wine...
python
chosen
[ { "from": "system", "value": "PI-27: Disable debug_toolbar from catching http redirects...pretty annoying\n" }, { "from": "human", "value": "# Grab the base settings\nfrom .base import *\n\n# Override at will!\n\n# Hosts/domain names that are valid for this site; required if DEBUG is False\n# Se...
python
chosen
[ { "from": "system", "value": "Update regex to allow spaces\n" }, { "from": "human", "value": "import re\nfrom fileanalyzer import FileAnalyzer\n\n\nclass PythonAnalyzer(FileAnalyzer):\n\n def get_class_count(self, content):\n return len(\n re.findall(\"class [a-zA-Z0-9_]+\\(...
python
chosen
[ { "from": "system", "value": "Fix a bug in cleanup\n" }, { "from": "human", "value": "import urllib.request\nimport ssl\nimport http.cookiejar\n\n#TODO: give an indicator of success\n#TODO: handle errors a bit better.\n\ndef do_pair(ip, pin, **_args):\n\t# IF YOU DON'T DO THIS OVER HTTPS YOU WIL...
python
chosen
[ { "from": "system", "value": "Use simulated data for test\n" }, { "from": "human", "value": "import pickle\nfrom ogusa import txfunc\n\ndef test_cps_data():\n with open(\"../../regression/cps_test_replace_outliers.pkl\", 'rb') as p:\n param_arr = pickle.load(p)\n sse_big_mat = p...
python
chosen
[ { "from": "system", "value": "Rename is_connected method to connected\n" }, { "from": "human", "value": "import uuid\n\n\nclass BaseTransport(object):\n \"\"\"Base transport class.\"\"\"\n\n REQUEST_ID_KEY = 'requestId'\n REQUEST_ACTION_KEY = 'action'\n\n def __init__(self, data_form...
python
chosen
[ { "from": "system", "value": "Use None rather than -1 for Pandas\n" }, { "from": "human", "value": "import json\n\nfrom django.db import models\nfrom model_utils.models import TimeStampedModel\n\n\nclass ParsedSOPN(TimeStampedModel):\n \"\"\"\n A model for storing the parsed data out of a ...
python
chosen
[ { "from": "system", "value": "Use get_include instead of get_numpy_include.\n\n\ngit-svn-id: 77a43f9646713b91fea7788fad5dfbf67e151ece@3525 94b884b6-d6fd-0310-90d3-974f1d3f35e1\n" }, { "from": "human", "value": "#!/usr/bin/env python\n\"\"\"Install file for example on how to use Pyrex with Numpy....
python
chosen
[ { "from": "system", "value": "Fix the service name for the LineCounter\n" }, { "from": "human", "value": "#!/usr/bin/env python\n\nfrom flask import Flask\nfrom flask_restplus import Resource, Api, reqparse\nfrom werkzeug.datastructures import FileStorage\nfrom time import sleep\nfrom random imp...
python
chosen
[ { "from": "system", "value": "Remove ending '.' in hostname. (for those fucking libs that knows nothing about RFC)\n" }, { "from": "human", "value": "import dns.resolver\nimport dns.query\nfrom dns.exception import DNSException\n\n\n# Resolve service from mesos-dns SRV record\n# return dict {\"s...
python
chosen
[ { "from": "system", "value": "Change install directory - now /usr/local/bin\n" }, { "from": "human", "value": "\"\"\"\nMassOpenCloud / Hardware Isolation Layer (HIL)\n\nSlurm / HIL Control Settings\n\nMay 2017, Tim Donahue\ttpd001@gmail.com\n\"\"\"\n\nDEBUG = True\n\nSLURM_INSTALL_DIR = '/usr/bi...
python
chosen
[ { "from": "system", "value": "Refactor main as a separate function\n" }, { "from": "human", "value": "\"\"\"Main Module of PDF Splitter\"\"\"\nimport argparse\nimport os\n\nfrom PyPDF2 import PdfFileWriter\n\nfrom Util import all_pdf_files_in_directory, split_on_condition, concat_pdf_pages\n\npa...
python
chosen
[ { "from": "system", "value": "Change CL to require a non-blank query\n" }, { "from": "human", "value": "#!/usr/bin/env python\n\nimport search\nimport tmap\n\nif __name__ == \"__main__\":\n from pprint import pprint as pp\n import sys\n\n to_dict = lambda r: r.to_dict()\n\n h = searc...
python
chosen
[ { "from": "system", "value": "Fix issue with duplicate output\n" }, { "from": "human", "value": "# Copyright 2013 John Reese\n# Licensed under the MIT license\n\nimport logging\n\nlogging.addLevelName(logging.DEBUG, 'DBG')\nlogging.addLevelName(logging.INFO, 'INF')\nlogging.addLevelName(logging....
python
chosen
[ { "from": "system", "value": "Raise error specific to address checksum failure\n\nBecause is_address() also checks for a valid checksum, the old code showed a generic \"not an address\" error if the checksum failed." }, { "from": "human", "value": "from eth_utils import (\n is_address,\n i...
python
chosen
[ { "from": "system", "value": "Change syntax to drop support\n" }, { "from": "human", "value": "from datetime import datetime\n\nfrom django.conf import settings\nfrom django.contrib.contenttypes.fields import GenericForeignKey\nfrom django.contrib.contenttypes.models import ContentType\nfrom dja...
python
chosen
[ { "from": "system", "value": "Allow error email to still be sent if DB is down\n\nWe were seeing errors in the logs where the database was inaccessible,\nbut the errors were not being emailed out because the handler makes a DB query.\n" }, { "from": "human", "value": "from logging.handlers impor...
python
chosen
[ { "from": "system", "value": "Set some fields as tranlate\n" }, { "from": "human", "value": "# -*- encoding: utf-8 -*-\n##############################################################################\n# For copyright and license notices, see __openerp__.py file in root directory\n################...
python
chosen
[ { "from": "system", "value": "Set registration open by default\n" }, { "from": "human", "value": "from firecares.settings.base import * # noqa\n\nINSTALLED_APPS += ('debug_toolbar', 'fixture_magic', 'django_extensions') # noqa\n\nMIDDLEWARE_CLASSES += ('debug_toolbar.middleware.DebugToolbarMid...
python
chosen
[ { "from": "system", "value": "Maintain same rate throughout pur cycle: in global defaults, by default set true\n" }, { "from": "human", "value": "def execute():\n\timport webnotes\n\tgd = webnotes.model.code.get_obj('Global Defaults')\n\tgd.doc.maintain_same_rate = 1\n\tgd.doc.save()\n\tgd.on_up...
python
chosen
[ { "from": "system", "value": "Remove install dependency of pytest from python wrapper\n\nSigned-off-by: Daniel Bluhm <6df8625bb799b640110458f819853f591a9910cb@sovrin.org>\n" }, { "from": "human", "value": "from distutils.core import setup\nimport os\n\nPKG_VERSION = os.environ.get('PACKAGE_VERSI...
python
chosen
[ { "from": "system", "value": "Fix import path of add_to_builtins" }, { "from": "human", "value": "\n# This app doesn't contain any models, but as its template tags need to\n# be added to built-ins at start-up time, this is a good place to do it.\n\nfrom django.template.loader import add_to_built...
python
chosen
[ { "from": "system", "value": "Add funcs to prepare pipeline execution\n" }, { "from": "human", "value": "\"\"\" Functions for handling the execution of a pipeline graph\n\"\"\"\nfrom toolz.curried import curry\n" }, { "from": "gpt", "value": "\"\"\" Functions for handling the executi...
python
chosen
[ { "from": "system", "value": "Handle queued tasks when working outside request context.\n" }, { "from": "human", "value": "# -*- coding: utf-8 -*-\n\nimport logging\n\nfrom flask import g\nfrom celery import group\n\nfrom website import settings\n\n\nlogger = logging.getLogger(__name__)\n\n\ndef...
python
chosen
[ { "from": "system", "value": "Address review comment: Better documentation.\n" }, { "from": "human", "value": "# Copyright Hybrid Logic Ltd. See LICENSE file for details.\n\n\"\"\"\nThis module defines the Eliot log events emitted by the API implementation.\n\"\"\"\n\n__all__ = [\n \"JSON_RE...
python
chosen
[ { "from": "system", "value": "Remove original implementation of TestAbbreviationExpansion\n" }, { "from": "human", "value": "#!/usr/bin/env python\n# -*- coding: utf-8 -*-\n\n\"\"\"\ntest_main\n---------\n\nTests for `cookiecutter.main` module.\n\"\"\"\n\nimport logging\nimport unittest\n\nfrom ...
python
chosen