conversations
listlengths
2
3
source
stringclasses
1 value
stack
stringclasses
1 value
[ { "from": "system", "value": "Use Convert() to simplify code\n" }, { "from": "human", "value": "# This Python file uses the following encoding: utf-8\ndef main():\n try:\n fileName = \"MengZi_Traditional.md\"\n filePath = \"../../source/\" + fileName\n content = None\n ...
python
chosen
[ { "from": "system", "value": "Fix not nullable field for lr-uprns to be nullable\n" }, { "from": "human", "value": "\"\"\"Create lr_uprn column with a GIN index\n\nRevision ID: 45a35ac9bfe\nRevises: 2bbd8de7dcb\nCreate Date: 2015-09-22 10:36:04.307515\n\n\"\"\"\n\n# revision identifiers, used by...
python
chosen
[ { "from": "system", "value": "Include migration for current runnning onboarding processes\n" }, { "from": "human", "value": "from openupgradelib import openupgrade\n\n\ndef migrate(cr, installed_version):\n if not installed_version:\n return\n\n # Update data\n openupgrade.load_x...
python
chosen
[ { "from": "system", "value": "Add one bigger size to arithmetic benchmark\n" }, { "from": "human", "value": "import numpy as np\n\nfrom dynd import nd, ndt\n\nfrom benchrun import Benchmark, clock\n\nclass ArithemticBenchmark(Benchmark):\n parameters = ('size',)\n size = [100000, 10000000]\n\n...
python
chosen
[ { "from": "system", "value": "Remove superfluous variable ('disabled' is a concept of zeit.intrafind and doesn't belong here)\n" }, { "from": "human", "value": "# Copyright (c) 2011 gocept gmbh & co. kg\n# See also LICENSE.txt\n\nimport mock\nimport zeit.cms.tagging.tag\n\n\nclass TaggingHelper(...
python
chosen
[ { "from": "system", "value": "Add step to check instances status\n" }, { "from": "human", "value": "# -*- coding: utf-8 -*-\nimport logging\nfrom util import full_stack\nfrom workflow.steps.util.base import BaseStep\nfrom workflow.exceptions.error_codes import DBAAS_0020\n\nLOG = logging.getLogg...
python
chosen
[ { "from": "system", "value": "Use Dash's new CamelCase convention to lookup words that contain whitespace\n\n- Example: converting \"create table\" into \"createTable\" will lookup \"CREATE TABLE\"\n" }, { "from": "human", "value": "import sublime\nimport sublime_plugin\nimport os\nimport subpro...
python
chosen
[ { "from": "system", "value": "Add a stub return to ensure the project builds.\n" }, { "from": "human", "value": "# Create your views here.\n\nfrom django.template import RequestContext\nfrom django.shortcuts import render_to_response\nfrom django.utils import simplejson\nfrom django.http import ...
python
chosen
[ { "from": "system", "value": "Add LegalRepresentativeProofOfIdentity to legal user" }, { "from": "human", "value": "from mangopaysdk.entities.entitybase import EntityBase\nfrom mangopaysdk.entities.user import User\nfrom mangopaysdk.tools.enums import PersonType\nfrom mangopaysdk.tools.enums imp...
python
chosen
[ { "from": "system", "value": "Fix broken (doc) test looking for the removed README.txt\n" }, { "from": "human", "value": "import os\nimport doctest\nimport unittest\n\n\nDOCTEST_FILES = []\n\nfor root, dirs, files in os.walk(\".\"):\n if \".hg%s\" % os.path.sep not in root:\n for f in ...
python
chosen
[ { "from": "system", "value": "Add links to source code in documentation\n" }, { "from": "human", "value": "#!/usr/bin/env python3\n# -*- coding: utf-8 -*-\n#\n\n# If extensions (or modules to document with autodoc) are in another directory,\n# add these directories to sys.path here. If the direc...
python
chosen
[ { "from": "system", "value": "Use byte strings for Python example.\n" }, { "from": "human", "value": "import ctypes\n\nstringtools = ctypes.CDLL(\"../target/libstringtools-261cf0fc14ce408c.so\")\nprint(stringtools.count_substrings(\"banana\", \"na\"))\n" }, { "from": "gpt", "value": ...
python
chosen
[ { "from": "system", "value": "Add param for turning on date formating.\n" }, { "from": "human", "value": "import logging\nfrom django.http import HttpResponse\nfrom django.utils import simplejson as json\nfrom myuw_mobile.views.rest_dispatch import RESTDispatch, data_not_found\nfrom myuw_mobile....
python
chosen
[ { "from": "system", "value": "Change app name to Ninhursag.\n" }, { "from": "human", "value": "#!/usr/bin/env python\n# -*- coding: utf-8 -*-\n#\n# Flask application default config:\n# http://flask.pocoo.org/docs/config/#configuring-from-files\n# https://github.com/mbr/flask-appconfig\n\n\nproje...
python
chosen
[ { "from": "system", "value": "Set local threads to true for peewee\n" }, { "from": "human", "value": "import ConfigParser\n\nfrom peewee import *\n\nconfig = ConfigParser.RawConfigParser()\nconfig.read('server.conf')\n\ndatabase = SqliteDatabase('gallery.db')\n\nfrom collection import Collection...
python
chosen
[ { "from": "system", "value": "Check SHAP Model call type\n" }, { "from": "human", "value": "import numpy as np\nfrom .._serializable import Serializable, Serializer, Deserializer\n\n\nclass Model(Serializable):\n \"\"\" This is the superclass of all models.\n \"\"\"\n\n def __init__(sel...
python
chosen
[ { "from": "system", "value": "Switch toml to json script to python 3\n" }, { "from": "human", "value": "#!/usr/bin/env python\n# Takes in toml, dumps it out as json\n# Run pip install toml to install the toml module\nimport json\nimport sys\nimport toml\n\nfh = open(sys.argv[1])\ntry:\n data ...
python
chosen
[ { "from": "system", "value": "Fix the import of MigrationExecutor to be lazy.\n\nMigrationExecutor checks at import time whether apps are all\nloaded. This doesn't work as they are usually not if your app is\nimported by adding it to INSTALLED_APPS. Importing the MigrationExecutor\nlocally solves this probl...
python
chosen
[ { "from": "system", "value": "Add hashtag for currency name and symbol " }, { "from": "human", "value": "# coding: utf-8\nimport os\nimport time\n\nfrom twython import Twython\nimport requests\n\n\nAPP_KEY = os.environ.get('APP_KEY')\nAPP_SECRET = os.environ.get('APP_SECRET')\nOAUTH_TOKEN = os.e...
python
chosen
[ { "from": "system", "value": "Move configuration variables to constants.\n" }, { "from": "human", "value": "from urlparse import urlparse\nimport logging\nimport os\n\nfrom flask import Flask\nimport pymongo\n\napp = Flask(__name__)\n_logger = logging.getLogger(__name__)\ndb = None\n\ndef get_co...
python
chosen
[ { "from": "system", "value": "Change linac mode pv to fake pvs\n" }, { "from": "human", "value": "\nfrom . import families as _families\n\n\ndef get_record_names(subsystem=None):\n \"\"\"Return a dictionary of record names for given subsystem\n each entry is another dictionary of model fam...
python
chosen
[ { "from": "system", "value": "Refactor test to implement 87ceac3 changes\n" }, { "from": "human", "value": "from expert_tourist.utils import gmaps_url_to_coords\nfrom tests.tests import BaseTestConfig\n\nclass TestUtils(BaseTestConfig):\n def test_url_to_coords(self):\n url = 'http://m...
python
chosen
[ { "from": "system", "value": "Make test_get_application_access_token_raises_error compatible with Python < 2.7\n" }, { "from": "human", "value": "\"\"\"Tests for the ``utils`` module.\"\"\"\n\nfrom mock import patch, Mock as mock\nfrom nose.tools import *\n\nfrom facepy import *\n\npatch = patch...
python
chosen
[ { "from": "system", "value": "Use flush and fsync to ensure data is written to disk\n" }, { "from": "human", "value": "\"\"\"Main Module of PDF Splitter\"\"\"\nimport argparse\n\nfrom PyPDF2 import PdfFileWriter\n\nfrom Util import all_pdf_files_in_directory, split_on_condition, concat_pdf_pages...
python
chosen
[ { "from": "system", "value": "Fix : cov list is fetch in one queries (before it was fetched twice)\n" }, { "from": "human", "value": "from django import template\nfrom ..models import Covoiturage\nfrom django.utils import timezone\n\nregister = template.Library()\n\n@register.inclusion_tag('cov/...
python
chosen
[ { "from": "system", "value": "Allow embedding of Google Docs by URL\n" }, { "from": "human", "value": "import re\nfrom exceptions import UrlNotMatched\n\nclass EmbedableResource(object):\n resource_providers = []\n\n @classmethod\n def register(cls, provider_cls):\n cls.resource_...
python
chosen
[ { "from": "system", "value": "Read variable data for qf_bv\n" }, { "from": "human", "value": "from config import *\n\nclass QFBV:\n\tdef preamble(self):\n\t\tprint \"(set-logic QF_BV)\"\n\n\t\tprint \"\"\n\n\t\t# Enumerate all the variables, for each match round.\n\t\tfor i in range(NUMROUNDS):\...
python
chosen
[ { "from": "system", "value": "Add pandas to generate csv.\n" }, { "from": "human", "value": "#!/usr/bin/env python\n# -*- coding: utf-8 -*-\n\nfrom sklearn.cross_validation import train_test_split\n\nfrom spam.common import DATASET_META\nfrom spam.common.utils import get_file_path_list\nfrom spa...
python
chosen
[ { "from": "system", "value": "Remove key while opening a door\n" }, { "from": "human", "value": "from onirim.card._base import ColorCard\nfrom onirim.card._location import LocationKind\n\n\ndef _openable(door_card, card):\n \"\"\"Check if the door can be opened by another card.\"\"\"\n ret...
python
chosen
[ { "from": "system", "value": "Remove uneccesary dict definition, clarify doc string\n" }, { "from": "human", "value": "from collections import OrderedDict\n\nfrom loggable import Loggable\nfrom malcolm.core.attributemeta import AttributeMeta\n\n\nclass MapMeta(Loggable):\n \"\"\"A meta object...
python
chosen
[ { "from": "system", "value": "Put environment name into environment.\n" }, { "from": "human", "value": "\"\"\"\nSupport for multiple environments based on python configuration files.\n\"\"\"\n\nfrom __future__ import print_function, absolute_import\n\nimport os\n\nfrom twisted.python.filepath im...
python
chosen
[ { "from": "system", "value": "Use `self.stdout.write` instead of `print`\n" }, { "from": "human", "value": "from __future__ import absolute_import\n\nimport json\nfrom optparse import make_option\n\nfrom django.core.management.base import BaseCommand, CommandError\n\nfrom watchman.utils import g...
python
chosen
[ { "from": "system", "value": "Add the GenericHandler to the init file\n" }, { "from": "human", "value": "# include github, bitbucket, google here for backward-compatibility\n# don't add new oauthenticators here.\nfrom .oauth2 import *\nfrom .github import *\nfrom .bitbucket import *\nfrom .googl...
python
chosen
[ { "from": "system", "value": "Print registration code in WSGI app.\n\nOtherwise, how will we know what it is?\n" }, { "from": "human", "value": "# Copyright 2017 Jonathan Anderson\n#\n# Redistribution and use in source and binary forms, with or without\n# modification, are permitted provided tha...
python
chosen
[ { "from": "system", "value": "Remove the Membership special case. We want everything correlated.\n" }, { "from": "human", "value": "# -*- coding: utf-8 -*-\nfrom datetime import date\n\nfrom django.contrib.contenttypes.models import ContentType\nfrom django.db import models\n\n\nclass Correlatio...
python
chosen
[ { "from": "system", "value": "Use GetFileOrFolder for the dialog.\n\ngit-svn-id: 68c5a305180a392494b23cb56ff711ec9d5bf0e2@493 b5fa9d6c-a76f-4ffd-b3cb-f825fc41095c\n" }, { "from": "human", "value": "#FLM: Import .ufo File into FontLab\n\nfrom robofab.world import NewFont\nfrom robofab.interface.a...
python
chosen
[ { "from": "system", "value": "Add hack for broken timezone support in dayone\n" }, { "from": "human", "value": "\"\"\"Common services code\"\"\"\n\nAVAILABLE_SERVICES = ['habit_list', 'idonethis', 'nikeplus']\n\n\ndef get_service_module(service_name):\n \"\"\"Import given service from dayonet...
python
chosen
[ { "from": "system", "value": "[schedule] Allow schedule edition by supervisors\n" }, { "from": "human", "value": "from zou.app.models.schedule_item import ScheduleItem\n\nfrom .base import BaseModelResource, BaseModelsResource\n\n\nclass ScheduleItemsResource(BaseModelsResource):\n def __init...
python
chosen
[ { "from": "system", "value": "Add the Boost DLL directory to the search path as well\n" }, { "from": "human", "value": "import os\nif hasattr(os, 'add_dll_directory'):\n os.add_dll_directory(\"$<TARGET_FILE_DIR:sch-core::sch-core>\")\n\nfrom . sch import *\n" }, { "from": "gpt", "...
python
chosen
[ { "from": "system", "value": "Fix llvm so it doesn't corrupt the env when configuring itself\n" }, { "from": "human", "value": "GitHubTarballPackage ('mono', 'llvm', '2.10', '943edbc1a93df204d687d82d34d2b2bdf9978f4e',\n\tconfigure = 'CFLAGS=\"-m32\" CPPFLAGS=\"-m32\" CXXFLAGS=\"-m32\" LDFLAGS=\"...
python
chosen
[ { "from": "system", "value": "Fix version tuple for 9.1 [ci skip]\n" }, { "from": "human", "value": "\"\"\"\nCLE is an extensible binary loader. Its main goal is to take an executable program and any libraries it depends on and\nproduce an address space where that program is loaded and ready to ...
python
chosen
[ { "from": "system", "value": "Include loader tests in test suite\n" }, { "from": "human", "value": "# -*- coding: utf-8 -*-\n#\n# Copyright (C) 2007 Christopher Lenz\n# All rights reserved.\n#\n# This software is licensed as described in the file COPYING, which\n# you should have received as par...
python
chosen
[ { "from": "system", "value": "Add mode for changing what file it is, and fix a bug where a line without an equals wouldn't work\n" }, { "from": "human", "value": "class ConfigReader():\n\tdef __init__(self):\n\t\tself.keys={}\n\t\t\n\t#Read Keys from file\n\tdef readKeys(self):\n\t\tkeysFile=ope...
python
chosen
[ { "from": "system", "value": "Improve performance by prefetching where needed\n" }, { "from": "human", "value": "from django.shortcuts import render\nfrom common.models.Furniture import Furniture\nfrom common.models.Plan import Plan\n\ndef overlay(request, floor=1):\n edit_rooms = False\n\n ...
python
chosen
[ { "from": "system", "value": "Add test of kernel switch.\n" }, { "from": "human", "value": "# Test that sos kernel is installed\n\nimport jupyter_client\n\ntry:\n jupyter_client.kernelspec.get_kernel_spec('sos')\nexcept jupyter_client.kernelspec.NoSuchKernel:\n print('sos kernel was not in...
python
chosen
[ { "from": "system", "value": "Set version for 2.0.2 release\n" }, { "from": "human", "value": "# inspired from:\n# https://python-packaging-user-guide.readthedocs.org/en/latest/single_source_version/\n# https://github.com/pypa/warehouse/blob/master/warehouse/__about__.py\n\n__title__ = 'spacy'\n...
python
chosen
[ { "from": "system", "value": "Fix PEP8 issues in openspending/ui/validation.\n" }, { "from": "human", "value": "from urlparse import urlparse\n\nfrom openspending.validation.model.common import mapping\nfrom openspending.validation.model.common import key\nfrom openspending.validation.model.pred...
python
chosen
[ { "from": "system", "value": "Update dsub version to 0.3.0\n\nPiperOrigin-RevId: 241766455\n" }, { "from": "human", "value": "# Copyright 2017 Google Inc. All Rights Reserved.\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may not use this file except in complianc...
python
chosen
[ { "from": "system", "value": "Set Article.author to a Person instance (if it exists for current user)\n" }, { "from": "human", "value": "from django.contrib import admin\n\nfrom aldryn_apphooks_config.admin import BaseAppHookConfig\nfrom cms.admin.placeholderadmin import PlaceholderAdmin, Fronte...
python
chosen
[ { "from": "system", "value": "Add scope kwarg to Classification.where()\n" }, { "from": "human", "value": "from panoptes_client.panoptes import LinkResolver, PanoptesObject\n\nclass Classification(PanoptesObject):\n _api_slug = 'classifications'\n _link_slug = 'classification'\n _edit_a...
python
chosen
[ { "from": "system", "value": "Fix evolution threshold for dpt 77\n\nThe threshold HIGH_SCORE_COMPANIES_DIFF_MAX which is the max percentage\nof difference between number of companies in lbb from one importer cycle\nto another was set to 70, and it reached 73 for the department 77. This\nthreshold has now be...
python
chosen
[ { "from": "system", "value": "Add initial support for win32 fortran compiler support.\n" }, { "from": "human", "value": "import sys\nimport warnings\n\nfrom SCons.Util import \\\n WhereIs\nfrom SCons.Tool.ifort import \\\n generate as old_generate\n\ndef generate_linux(env):\n i...
python
chosen
[ { "from": "system", "value": "Handle empty cells in the spreadsheet\n" }, { "from": "human", "value": "# -*- coding: utf-8 -*-\nimport string\n\n\ndef sanitise_string(messy_str):\n \"\"\"Whitelist characters in a string\"\"\"\n valid_chars = ' {0}{1}'.format(string.ascii_letters, string.di...
python
chosen
[ { "from": "system", "value": "Adjust OSF Storage default region names" }, { "from": "human", "value": "# encoding: utf-8\nimport importlib\nimport os\nimport logging\nfrom website import settings\n\n\nlogger = logging.getLogger(__name__)\n\nDEFAULT_REGION_NAME = 'N. Virginia'\nDEFAULT_REGION_ID ...
python
chosen
[ { "from": "system", "value": "Remove unnecessary code for print debug\n" }, { "from": "human", "value": "\"\"\"\"Test adapter specific config options.\"\"\"\nfrom pprint import pprint\n\nfrom test.integration.base import DBTIntegrationTest, use_profile\nimport textwrap\nimport yaml\n\n\nclass Te...
python
chosen
[ { "from": "system", "value": "Fix 404 when no path in URL\n" }, { "from": "human", "value": "from django.conf import settings\nfrom django.conf.urls import patterns, include, url\nfrom django.conf.urls.static import static\n\n\nclass FakeTenant(object):\n is_main = lambda self: False\n is...
python
chosen
[ { "from": "system", "value": "Change marker as an example.\n" }, { "from": "human", "value": "# -*- coding: utf-8 -*-\n\n\"\"\"Plot to demonstrate the qualitative2 colormap.\n\"\"\"\n\nimport numpy as np\nimport matplotlib.pyplot as plt\n\nfrom typhon.plots import (figsize, mpl_colors)\n\n\nfig,...
python
chosen
[ { "from": "system", "value": "Update vigenereDicitonaryHacker: fixed PEP8 spacing\n" }, { "from": "human", "value": "# Vigenère Cipher Dictionary Hacker\n# https://www.nostarch.com/crackingcodes/ (BSD Licensed)\n\nimport detectEnglish, vigenereCipher, pyperclip\n\ndef main():\n ciphertext = \...
python
chosen
[ { "from": "system", "value": "Fix AttributeError on ListedColormap from_list method\n" }, { "from": "human", "value": "import matplotlib.cm as cm\nimport matplotlib.colors as clr\nimport matplotlib.pyplot as plt\n\nfrom ..palettes import SEABORN\n\n\ndef create_discrete_cmap(n):\n \"\"\"Creat...
python
chosen
[ { "from": "system", "value": "Change how the wrappers work for builtin functions so that docs get forwarded correctly\n" }, { "from": "human", "value": "import functools\nfrom six import iteritems\n\n_all_builtins = {}\n\n\nclass _Binder(object):\n def __init__(self, args, fn):\n self....
python
chosen
[ { "from": "system", "value": "Add song display to root page\n" }, { "from": "human", "value": "import flask\nfrom . import track\n\napp = flask.Flask(__name__)\n\n@app.route(\"/\")\ndef root():\n\treturn \"{} by {} - {}\"\n" }, { "from": "gpt", "value": "import flask\nfrom . import t...
python
chosen
[ { "from": "system", "value": "Add dump presets and utils\n" }, { "from": "human", "value": "import mido\n\n\ndef open_output():\n return open_steinberg_output()\n\n\ndef get_steinberg_device_name():\n output_names = [n for n in mido.get_output_names() if 'steinberg' in n.lower()]\n if l...
python
chosen
[ { "from": "system", "value": "l10n_br_nfse: Update python lib erpbrasil.assinatura version 1.4.0\n" }, { "from": "human", "value": "# Copyright 2019 KMEE INFORMATICA LTDA\n# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).\n\n{\n \"name\": \"NFS-e\",\n \"summary\": \"\"\"\n ...
python
chosen
[ { "from": "system", "value": "Support of static pages inside of a directory\n" }, { "from": "human", "value": "# -*- coding: utf-8 -*-\n\"\"\"\n flask-rst.modules.staticfiles\n ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\n\n :copyright: (c) 2011 by Christoph Heer.\n :license: BSD, see LICENSE for ...
python
chosen
[ { "from": "system", "value": "Use the json module from stdlib (Python 2.6+) as fallback\n" }, { "from": "human", "value": "import simplejson\n\njson_encode = lambda data: simplejson.dumps(data, separators=(',', ':'))\njson_decode = lambda data: simplejson.loads(data)\nJSONDecodeError = ValueErro...
python
chosen
[ { "from": "system", "value": "Update user creation method in register serializer.\n" }, { "from": "human", "value": "from rest_framework import serializers\nfrom django.core import exceptions\nfrom django.contrib.auth import password_validation\n\nfrom user.models import User\n\n\nclass CaptchaS...
python
chosen
[ { "from": "system", "value": "Add test admin to retrieve a user detail\n" }, { "from": "human", "value": "from django.test import TestCase\nfrom django.contrib.auth.models import User\nfrom rest_framework import status\nfrom rest_framework.test import APIClient, APIRequestFactory, \\\n fo...
python
chosen
[ { "from": "system", "value": "Make `AgencyChain.agencies` a \"resource collection\" field\n\nWe can now get a `Query` when accessing the `agencies` attribute on an\n`AgencyChain` instead of a dict with an URI to the agencies list.\n" }, { "from": "human", "value": "# Python 2 and 3\nfrom __futur...
python
chosen
[ { "from": "system", "value": "Fix the GNU diff error to not mention Subversion.\n\nThe GNU diff error was specifically saying Subversion was required,\nwhich didn't make sense when other SCMClients triggered the check.\nInstead, make the error more generic.\n" }, { "from": "human", "value": "imp...
python
chosen
[ { "from": "system", "value": "Move variables to class variables so that we have to duplicate less for child classes\n" }, { "from": "human", "value": "import unittest\nfrom gntp.config import GrowlNotifier\n\n\nclass GNTPTestCase(unittest.TestCase):\n\tdef setUp(self):\n\t\tself.growl = GrowlNot...
python
chosen
[ { "from": "system", "value": "Fix bugs and style issues.\n\nFix __getitem__, improve documentation, partially implement __init__.\nThis got rid of some of pylint's complaints.\n" }, { "from": "human", "value": "\nclass Constellation(object):\n \"\"\"Manage and analyze data from multiple pysat...
python
chosen
[ { "from": "system", "value": "Add display for running states\n" }, { "from": "human", "value": "import os\nfrom TextFileReader import *\n\ndef main():\n # get the base directory\n base_directory = os.getcwd()\n\n # counter for percentage print\n stage_counter = 0\n total_stage = l...
python
chosen
[ { "from": "system", "value": "Debug version to check codeship.\n\n--HG--\nbranch : schema-templates/fix-codeship-issue\n" }, { "from": "human", "value": "from django.apps import AppConfig\nfrom django.db import models\nfrom django.dispatch import receiver\n\nfrom boardinghouse.schema import acti...
python
chosen
[ { "from": "system", "value": "Use logging instead of print logs.\n" }, { "from": "human", "value": "class Prioritize(object):\n '''\n Class which convert dependency relationship to priority level\n '''\n def __init__(self):\n self._priorityLevel = {}\n\n def getPrioritizeLe...
python
chosen
[ { "from": "system", "value": "Add back the EC2 metadata-based private IP fetch for ALLOWED_HOSTS\n" }, { "from": "human", "value": "from config.base.settings import *\n\nDEBUG = False\nTEMPLATE_DEBUG = DEBUG\nROOT_URLCONF = 'config.prod.urls'\nWSGI_APPLICATION = \"config.prod.wsgi.application\"\...
python
chosen
[ { "from": "system", "value": "Fix up import problem with dj-database-url\n" }, { "from": "human", "value": "import os\nfrom os.path import abspath, basename, dirname, join, normpath\nfrom sys import path\n\nfrom .settings import *\n\nDEBUG = True \n\nPROJECT_ROOT = os.path.dirname(os.path.abspat...
python
chosen
[ { "from": "system", "value": "Remove skip of test_get_cluster function for websocket transport\n" }, { "from": "human", "value": "from tests import string\n\n\ndef test_get(test):\n\n def handle_connect(handler):\n info = handler.api.get_info()\n assert isinstance(info['api_vers...
python
chosen
[ { "from": "system", "value": "Clean up validator package imports" }, { "from": "human", "value": "from __future__ import absolute_import\n\nfrom . import io_validator\nfrom . import index_column_validator\n\n" }, { "from": "gpt", "value": "from __future__ import absolute_import\n\nfr...
python
chosen
[ { "from": "system", "value": "Allow both instance and model classes in Media.objects.for_model()\n" }, { "from": "human", "value": "from django.db import models\n\nfrom django.contrib.contenttypes.models import ContentType\n\n\nclass MediaAssociationManager(models.Manager):\n \n def for_mo...
python
chosen
[ { "from": "system", "value": "Allow cross-origin headers on dev builds\n" }, { "from": "human", "value": "import os\n\nfrom flask import Flask\nfrom flask_sqlalchemy import SQLAlchemy\nfrom flask_migrate import Migrate\nfrom flask_mail import Mail\nfrom flask_login import LoginManager\nfrom raut...
python
chosen
[ { "from": "system", "value": "Correct the darklang migration, since many darklang configs can exist.\n" }, { "from": "human", "value": "# -*- coding: utf-8 -*-\nfrom __future__ import unicode_literals\n\n# Converted from the original South migration 0002_enable_on_install.py\n#\nfrom django.db i...
python
chosen
[ { "from": "system", "value": "Call dartium_tools/buildbot_annotated_steps.py directly, there is no need for moving this as part of the dartium patching process.\n\nAdditionally, start calling a new script for release builds (there are none yet, but this is what will be used to build the sdk and editor)\n\nT...
python
chosen
[ { "from": "system", "value": "Use sysconfig to find the include directory.\n" }, { "from": "human", "value": "from __future__ import unicode_literals, print_function\n\nimport os\nimport argparse\nimport sys\nimport shutil\n\ndef main():\n ap = argparse.ArgumentParser()\n ap.add_argument(\...
python
chosen
[ { "from": "system", "value": "Reorganize tests in a class\n" }, { "from": "human", "value": "import requests\nimport time\nimport multiprocessing\n\nfrom examples import minimal\n\n\ndef test_minimal():\n port = minimal.app.get_port()\n p = multiprocessing.Process(\n target=minimal....
python
chosen
[ { "from": "system", "value": "Stop using ord with ints\n" }, { "from": "human", "value": "\"\"\"\nTest mujoco viewer.\n\"\"\"\nimport unittest\n\nfrom mujoco_py import mjviewer, mjcore\n\n\nclass MjLibTest(unittest.TestCase):\n xml_path = 'tests/models/cartpole.xml'\n\n def setUp(self):\n ...
python
chosen
[ { "from": "system", "value": "Add warning if OBSCURE_URL env var is not set\n" }, { "from": "human", "value": "import os\nfrom django.conf.urls import url\nfrom . import views\n\nOBSCURE_URL = r'^{}$'.format(os.environ.get('OBSCURE_URL', 'this_should_be_in_env_var'))\n\nurlpatterns = [\n url(...
python
chosen
[ { "from": "system", "value": "Send episode_done=True from local human agent\n" }, { "from": "human", "value": "# Copyright (c) 2017-present, Facebook, Inc.\n# All rights reserved.\n# This source code is licensed under the BSD-style license found in the\n# LICENSE file in the root directory of th...
python
chosen
[ { "from": "system", "value": "Move seq size to const\n" }, { "from": "human", "value": "import os\nfrom os.path import join, dirname, abspath\nfrom dotenv import load_dotenv\n\n\nclass Config:\n loaded = False\n\n @staticmethod\n def load(file_name='../config/.env'):\n load_doten...
python
chosen
[ { "from": "system", "value": "Clarify Address usage in send example \n\nImproved the script to explain the recipient address a little better.\r\nChanged the address concat to a reference to a specific kind of Iota address. \r\nThis is loosely inspired by the JAVA sen transaction test case." }, { "...
python
chosen
[ { "from": "system", "value": "Use table instead of separate lines\n" }, { "from": "human", "value": "import string\nimport textwrap\nfrom plugins import BasePlugin\n\n__author__ = 'peter'\n\n\nclass BasicInfoPlugin(BasePlugin):\n name = 'BasicInfoPlugin'\n short_description = 'Basic info:'...
python
chosen
[ { "from": "system", "value": "Allow connecting to unknown hosts but warn\n" }, { "from": "human", "value": "from __future__ import print_function\n\nimport select\n\nimport paramiko\n\n\nclass GerritEvents(object):\n\n def __init__(self, userid, host, key=None):\n self.userid = userid\...
python
chosen
[ { "from": "system", "value": "Change job class name from add_host to create_subtraction\n\n" }, { "from": "human", "value": "import virtool.subtraction\nimport virtool.virus_index\nimport virtool.sample_create\nimport virtool.job_analysis\nimport virtool.job_dummy\n\n\n#: A dict containing :clas...
python
chosen
[ { "from": "system", "value": "Remove trailing space after object type.\n" }, { "from": "human", "value": "from mako.template import Template\n\nclass OraccObject(object):\n \n template = Template(r\"\"\"@${objecttype} \n% for child in children:\n${child.serialize()}\n% endfor\"\"\", output...
python
chosen
[ { "from": "system", "value": "VC/Vidyo: Fix \"make me room owner\"\n" }, { "from": "human", "value": "# This file is part of Indico.\n# Copyright (C) 2002 - 2016 European Organization for Nuclear Research (CERN).\n#\n# Indico is free software; you can redistribute it and/or\n# modify it under th...
python
chosen
[ { "from": "system", "value": "Implement test to make sure cookiecutter main is called\n" }, { "from": "human", "value": "# -*- coding: utf-8 -*-\n\n\"\"\"\ntest_cookiecutter_invocation\n----------------------------\n\nTests to make sure that cookiecutter can be called from the cli without\nusing...
python
chosen
[ { "from": "system", "value": "Use a function instead of a lambda expression.\n" }, { "from": "human", "value": "#!/usr/bin/env python\n\nfrom os.path import exists, splitext\nfrom random import randint\n\n\n_depth = lambda x, y, z=1: z\n\n_invert_dict = lambda d: dict((v, k) for k, v in list(d.i...
python
chosen
[ { "from": "system", "value": "Fix using mock in production [WAL-2530]\n" }, { "from": "human", "value": "import mock\n\nBookingCreateProcessor = mock.MagicMock()\nBookingDeleteProcessor = mock.MagicMock()\n" }, { "from": "gpt", "value": "from waldur_mastermind.marketplace import proc...
python
chosen
[ { "from": "system", "value": "Fix compatibility issues with \"input()\" in python2\n\noverride input with raw_input if in python2" }, { "from": "human", "value": "\"\"\"Interactive Labeler\n\nThis module includes an InteractiveLabeler.\n\"\"\"\nimport matplotlib.pyplot as plt\n\nfrom libact.base...
python
chosen
[ { "from": "system", "value": "Switch settings used to just settings/base.py\n" }, { "from": "human", "value": "#!/usr/bin/env python\nimport os\nimport sys\n\nif __name__ == \"__main__\":\n if socket.gethostname() == 'blog':\n os.environ.setdefault(\"DJANGO_SETTINGS_MODULE\", \"setting...
python
chosen
[ { "from": "system", "value": "Update launcher for new features\n" }, { "from": "human", "value": "#!/usr/bin/python\n\"\"\"\nCyril Robin -- LAAS-CNRS -- 2014\n\nTODO Descriptif\n\"\"\"\n\nfrom mission import *\nfrom constant import *\n\nfrom sys import argv, exit\nfrom timer import Timer\n\n\nif...
python
chosen