conversations
listlengths
2
3
source
stringclasses
1 value
stack
stringclasses
1 value
[ { "from": "system", "value": "fix: Fix not closed file warning\n" }, { "from": "human", "value": "\"\"\"\nTwo things are wrong with Django's default `SECRET_KEY` system:\n\n1. It is not random but pseudo-random\n2. It saves and displays the SECRET_KEY in `settings.py`\n\nThis snippet\n1. uses `S...
python
chosen
[ { "from": "system", "value": "Increment version. As the api has changed Major version number update\n" }, { "from": "human", "value": "#!/usr/bin/env python\nimport os\nfrom setuptools import setup\n\n\ndef read(fname):\n with open(os.path.join(os.path.abspath(os.path.dirname(__file__)), fnam...
python
chosen
[ { "from": "system", "value": "Add dependency and correct name\n" }, { "from": "human", "value": "#!/usr/bin/env python3\nimport os\n\nfrom setuptools import setup, find_packages\n\n\nfrom vtimshow import defaults\n\ndef read(fname):\n \"\"\"\n Utility function to read a file.\n \"\"\"\n...
python
chosen
[ { "from": "system", "value": "Increment version - go ahead and call it 1.0, even." }, { "from": "human", "value": "#!/usr/bin/env python\n# -*- coding: utf-8 -*-\nfrom setuptools import setup, find_packages\n\nsetup(\n name='geodjango-timezones',\n version='0.1',\n description='Models t...
python
chosen
[ { "from": "system", "value": "Add a main guard for testing\n" }, { "from": "human", "value": "\"\"\"\n Pick a word from /usr/share/dict/words\n\"\"\"\n\nimport subprocess\nfrom sys import exit\nimport random\n\ndef choose(difficulty):\n (min, max) = difficulty\n cmd = \"/usr/bin/grep -E...
python
chosen
[ { "from": "system", "value": "Add explicit parsing rule for cast operations\n" }, { "from": "human", "value": "from thinglang.lexer.values.identifier import Identifier\nfrom thinglang.parser.values.access import Access\nfrom thinglang.parser.values.method_call import MethodCall\n\n\nclass CastOp...
python
chosen
[ { "from": "system", "value": "Add more tags to ffconfig fuzzer (currently disabled)\n\nSigned-off-by: Clifford Wolf <b28e7ff75903c06de987a1eb75ea100a79c89e3a@clifford.at>\nSigned-off-by: Tim 'mithro' Ansell <57310ee00039176189a7bd7b876cda4d0d2a19aa@mithis.com>\n\n" }, { "from": "human", "value":...
python
chosen
[ { "from": "system", "value": "tests: Improve the settings files testing fixture\n\nLet's order these files, as it makes it nicer in the pytest output.\n\nIn addition, we can filter out the __init__.py file, since it is\ncompletely empty.\n" }, { "from": "human", "value": "import glob\nimport os\...
python
chosen
[ { "from": "system", "value": "Revert \"update Guam to not show at zoom 2\"\n\nThis reverts commit b12f1560f6b6284c9d26dab96a6c09eac1942424.\n" }, { "from": "human", "value": "# -*- encoding: utf-8 -*-\nfrom . import FixtureTest\n\n\nclass LowZoomPlacesTest(FixtureTest):\n\n def test_zoom_1(se...
python
chosen
[ { "from": "system", "value": "Include display metadata in mime bundle\n" }, { "from": "human", "value": "from IPython.display import display, JSON\nimport json\n\n\n# Running `npm run build` will create static resources in the static\n# directory of this Python package (and create that directory...
python
chosen
[ { "from": "system", "value": "Change number of news on frontpage\n" }, { "from": "human", "value": "from django.shortcuts import render\nfrom news.models import Article, Event\nfrom door.models import DoorStatus\nfrom datetime import datetime\nfrom itertools import chain\n\n\ndef index(request):...
python
chosen
[ { "from": "system", "value": "Handle case when YAML is empty.\n" }, { "from": "human", "value": "\"\"\"\n ydf/templating\n ~~~~~~~~~~~~~~\n\n Contains functions to be exported into the Jinja2 environment and accessible from templates.\n\"\"\"\n\nimport jinja2\nimport os\n\nfrom ydf impo...
python
chosen
[ { "from": "system", "value": "Add tilde to urljoin safe characters\n\nThis is not necessary for Python 3.7, but still affects older\nPython versions.\n" }, { "from": "human", "value": "import re\nfrom urllib.parse import urljoin, quote\n\nfrom werkzeug import Request\n\n_url_scheme_re = re.compi...
python
chosen
[ { "from": "system", "value": "Fix for tests failing because of persisted database file for the next build\n" }, { "from": "human", "value": "from sqlalchemy_wrapper import SQLAlchemy\n\ndb = SQLAlchemy(uri='sqlite:///intermediate_data.db')\n\n\nclass BlogPostModel(db.Model):\n __tablename__ =...
python
chosen
[ { "from": "system", "value": "Increase SG last sync for more overlap\n" }, { "from": "human", "value": "import graphene\nimport arrow\nfrom django.db.models import Q\n\nfrom falmer.schema.schema import DjangoConnectionField\nfrom falmer.studentgroups.types import StudentGroup\nfrom . import type...
python
chosen
[ { "from": "system", "value": "Update how the document download test calls document-download-api\n\ndocument-download-api now accepts json content - it was still possible\nto send files while we switched over, but we now want to only support\njson. This is the only place where we weren't already sending json...
python
chosen
[ { "from": "human", "value": "Add test for non-parametric width\n" }, { "from": "gpt", "value": "\nfrom fil_finder.width import nonparam_width\n\nimport numpy as np\nimport numpy.testing as npt\n\n\ndef test_nonparam():\n\n pts = np.linspace(0, 10, 100)\n\n profile = 2.0*np.exp(-pts**2 / (2...
python
chosen
[ { "from": "system", "value": "Fix new lines in definition of UD module\n" }, { "from": "human", "value": "\"\"\"Looks up a term from urban dictionary\n@package ppbot\n\n@syntax ud <word>\n\n\"\"\"\nimport requests\nimport json\n\nfrom modules import *\n\nclass Urbandictionary(Module):\n\n def...
python
chosen
[ { "from": "system", "value": "Remove merges from the log.\n" }, { "from": "human", "value": "#! /usr/bin/env python\n\nimport argparse\nimport csv\n\nimport git\n\n\nif __name__ == '__main__':\n parser = argparse.ArgumentParser(description='Extract git history information.')\n parser.add_a...
python
chosen
[ { "from": "system", "value": "Fix tests for Django 1.7 by calling the new setup and explicitly including MIDDLEWARE_CLASSES.\n" }, { "from": "human", "value": "#!/usr/bin/env python\nimport sys\n\nimport django\nfrom django.conf import settings\n\n\nif not settings.configured:\n settings.conf...
python
chosen
[ { "from": "system", "value": "Add filters to Org model\n" }, { "from": "human", "value": "from django.contrib import admin\nfrom mrbelvedereci.cumulusci.models import Org\nfrom mrbelvedereci.cumulusci.models import Service\n\nclass OrgAdmin(admin.ModelAdmin):\n list_display = ('name','repo','...
python
chosen
[ { "from": "system", "value": "Fix network service provider functional test\n\nSDK refactor broken network service provider\nfunctional test, tested this command works,\nbut there is a error in the funtional test,\nso fix it.\n\nChange-Id: I783c58cedd39a05b665e47709b2b5321871e558b\nCloses-Bug: 1653138\n" }...
python
chosen
[ { "from": "system", "value": "Make sure QuerySet.delete() operation does not bypass protection\n\nThis fixes #1\n" }, { "from": "human", "value": "from django.db import models\n\n\nclass LogicalDeletedManager(models.Manager):\n \"\"\"\n A manager that serves as the default manager for `log...
python
chosen
[ { "from": "system", "value": "[utils] Add a function to clean dict keys\n\nRemove None values.\n" }, { "from": "human", "value": "from flask_restful import reqparse\nfrom flask import request\n\n\nclass ArgsMixin(object):\n \"\"\"\n Helpers to retrieve parameters from GET or POST queries.\...
python
chosen
[ { "from": "system", "value": "Put ExcelWriter in pandas namespace\n" }, { "from": "human", "value": "# pylint: disable-msg=W0614,W0401,W0611,W0622\n\n__docformat__ = 'restructuredtext'\n\nfrom datetime import datetime\n\nimport numpy as np\n\ntry:\n import pandas._tseries as lib\nexcept Excep...
python
chosen
[ { "from": "system", "value": "Delete extra import. Prepare for PR.\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 .generic ...
python
chosen
[ { "from": "system", "value": "Tag commit for v0.0.13-master generated by gitmake.py\n" }, { "from": "human", "value": "major = 0\nminor=0\npatch=0\nbranch=\"dev\"\ntimestamp=1376506569.35" }, { "from": "gpt", "value": "major = 0\nminor=0\npatch=13\nbranch=\"master\"\ntimestamp=137650...
python
chosen
[ { "from": "system", "value": "Implement proper scale tool handles\n" }, { "from": "human", "value": "from UM.Scene.ToolHandle import ToolHandle\n\nclass ScaleToolHandle(ToolHandle):\n def __init__(self, parent = None):\n super().__init__(parent)\n\n md = self.getMeshData()\n\n ...
python
chosen
[ { "from": "system", "value": "Solve Largest Palindrome Product for range of n is [1,6]\n" }, { "from": "human", "value": "# Find the largest palindrome made from the product of two n-digit numbers.\n\n# Since the result could be very large, you should return the largest palindrome mod 1337.\n\n#...
python
chosen
[ { "from": "system", "value": "Fix import error for program page test\n" }, { "from": "human", "value": "from lib.constants.test import create_new_program\nfrom lib import base, page\n\n\nclass TestProgramPage(base.Test):\n def create_private_program_test(self):\n dashboard = page.dashb...
python
chosen
[ { "from": "system", "value": "Check N-D with N>2 raises in utils\n\nPermit 1-D and 2-D arrays to be handled by internal utilities.\n" }, { "from": "human", "value": "#!/usr/bin/env python\n# -*- coding: utf-8 -*-\n\n\nfrom __future__ import absolute_import\n\nimport pytest\n\nimport numpy as np\...
python
chosen
[ { "from": "system", "value": "Fix deprecated view method passing.\n" }, { "from": "human", "value": "#!/usr/bin/env python\n# -*- coding: utf-8 -*-\n\nfrom django.conf import settings\nfrom django.conf.urls import include, url\nfrom django.contrib import admin\n\n\nurlpatterns = [\n url(\n ...
python
chosen
[ { "from": "system", "value": "Support use real ip and host name for service\n" }, { "from": "human", "value": "#!/usr/bin/python\n\nimport socket\nimport time\n\nfrom zeroconf import *\n\ndef main():\n print \"Register SSH service ...\"\n\n service_type = \"_ssh._tcp.local.\"\n info = S...
python
chosen
[ { "from": "system", "value": "Add search functionality for runs\n\nAdd search functionality for runs. Runs are searched using MongoDB's\nfull text search capabilities. Note that this requires a text index on\nthe collection (command used to create the text index:\ndb.recipies.createIndex({ \"$**\": \"text\"...
python
chosen
[ { "from": "system", "value": "Remove languages from default import to stop hard requirement on Mako\n" }, { "from": "human", "value": "\"\"\"\nIgnition is a numerical code generator.\n\nSee README in top level for more details\n\"\"\"\n\n__version__ = \"0.0.1-git\"\n\ndef __ignition_debug():\n ...
python
chosen
[ { "from": "system", "value": "Use a class to store row data, and allow lookup via index or header cell value.\n" }, { "from": "human", "value": "from parser import TableParser\n\nclass Tabler:\n def __init__(self, html):\n self._html = html\n self.header = []\n self.body ...
python
chosen
[ { "from": "system", "value": "Add shebang and make file executable\n" }, { "from": "human", "value": "import argparse\nimport binascii\nimport datetime\nimport gzip\nimport json\n\nimport magic\nimport os\nimport pymongo\nimport sys\n\n\ndef read_gzip(filename):\n with gzip.open(filename) as ...
python
chosen
[ { "from": "system", "value": "Add comments for file start/end\n" }, { "from": "human", "value": "#!/usr/bin/env python\n\nimport sys\nimport os.path\nimport re\n\nINCLUDE_PATTERN = re.compile(r'^\\s*#include \"([\\w.]+)\"')\n\nseen_files = set()\n\ndef add_file(filename):\n basename = os.path.b...
python
chosen
[ { "from": "human", "value": "Test suite for CJSON writer\n" }, { "from": "gpt", "value": "# This file is part of cclib (http://cclib.github.io), a library for parsing\n# and interpreting the results of computational chemistry packages.\n#\n# Copyright (C) 2015-2016, the cclib development team\n#...
python
chosen
[ { "from": "system", "value": "Add logging to helper method.\n" }, { "from": "human", "value": "\"\"\"Helper method for getting artifactory information.\"\"\"\nfrom .artifactory import Artifactory\n\n\ndef get_artifactory_info(repo_name=None, repo_type='local'):\n \"\"\"Get storage info from A...
python
chosen
[ { "from": "system", "value": "Revert \"Skip install labels test for now\"\n\nThis reverts commit 3016324f9eb84989bcdefa2d3dfe1f766f4ab7e6.\n" }, { "from": "human", "value": "import unittest\n\nfrom neomodel import config, StructuredNode, StringProperty, install_all_labels\nfrom neomodel.core imp...
python
chosen
[ { "from": "system", "value": "Fix acceptance tests: for for button to be visible\n" }, { "from": "human", "value": "\"\"\"Shared acceptance test functions.\"\"\"\n\nfrom time import sleep\n\n\ndef wait(condition, step=0.1, max_steps=10):\n \"\"\"Wait for a condition to become true.\"\"\"\n ...
python
chosen
[ { "from": "system", "value": "Fix kwargs usage to work with other auth backends.\n" }, { "from": "human", "value": "\nfrom django.contrib.auth.backends import ModelBackend\nfrom django.contrib.auth.models import User\nfrom django.contrib.auth.tokens import default_token_generator\nfrom django.db...
python
chosen
[ { "from": "system", "value": "Remove temparary HDF5 cache workaround.\n" }, { "from": "human", "value": "# -*- coding: utf-8 -*-\n\n\"\"\"\n@author: Aaron Ponti\n\"\"\"\n\nimport os\nimport logging\nimport re\n\nfrom ch.systemsx.cisd.openbis.common.hdf5 import HDF5Container\n\nfrom Processor imp...
python
chosen
[ { "from": "system", "value": "Change label and add Sura name to Ayah Serlialzer\n" }, { "from": "human", "value": "from rest_framework import serializers\n\nfrom .models import Sura, Ayah\n\n\nclass SuraSerializer(serializers.ModelSerializer):\n\n class Meta:\n model = Sura\n fi...
python
chosen
[ { "from": "system", "value": "Swap db and rds set up\n" }, { "from": "human", "value": "#!/usr/bin/env python\n# a script to delete an rds instance\n\n# import the sys and boto3 libraries\nimport sys\nimport boto3\n\n# create an rds client\nrds = boto3.client('rds')\n\n# use the first argument t...
python
chosen
[ { "from": "system", "value": "Replace deprecated CsrfProtect with CSRFProtect\n" }, { "from": "human", "value": "\"\"\"Enable third party extensions.\"\"\"\n\nfrom flask_migrate import Migrate\nfrom flask_sqlalchemy import SQLAlchemy\nfrom flask_socketio import SocketIO\nfrom flask_wtf import Cs...
python
chosen
[ { "from": "system", "value": "Add test to confirm more reasonable residual std on one obsid/slot\n" }, { "from": "human", "value": "import tempfile\nimport os\n\nfrom .. import guide_stats\n\n\ndef test_calc_stats():\n guide_stats.calc_stats(17210)\n\n\ndef test_make_gui_stats():\n \"\"\"\...
python
chosen
[ { "from": "system", "value": "Implement language-specific aspects of indexing\n" }, { "from": "human", "value": "from aldryn_search.utils import get_index_base\n\nfrom .models import Service\n\n\nclass ServiceIndex(get_index_base()):\n haystack_use_for_indexing = True\n index_title = True\...
python
chosen
[ { "from": "system", "value": "[TST] Resolve RuntimeError: Invalid DISPLAY variable\n" }, { "from": "human", "value": "# -*- coding: utf-8 -*-\n\"\"\"\nCreated on Mon Dec 30 02:37:25 2013\n\n@author: Jan\n\"\"\"\n\nimport unittest\n\n\nclass PlotStyleTest(unittest.TestCase):\n def test_default...
python
chosen
[ { "from": "system", "value": "Fix plugin not taking into account opening of unsaved buffers and some refactoring\n" }, { "from": "human", "value": "import sublime_plugin\nfrom editorconfig import get_properties, EditorConfigError\n\n\nLINE_ENDINGS = {\n\t'lf': 'Unix',\n\t'crlf': 'Windows',\n\t'c...
python
chosen
[ { "from": "system", "value": "Standardize lcmaps cleanup class name\n\ngit-svn-id: 884a03e47e2adb735d896e55bb5ad6bc3421ba19@21921 4e558342-562e-0410-864c-e07659590f8c\n" }, { "from": "human", "value": "import unittest\n\nimport osgtest.library.core as core\nimport osgtest.library.files as files\...
python
chosen
[ { "from": "system", "value": "Convert ValueError -> ValidationError in ValuesListField\n" }, { "from": "human", "value": "import six\n\nfrom .base import MultiSelectField\n\n\nclass ValuesListField(MultiSelectField):\n\n field_type = 'Core.Models.Fields.ValuesListField, Core'\n supported_t...
python
chosen
[ { "from": "human", "value": "Add simple test for utils\n" }, { "from": "gpt", "value": "from functools import partial\nfrom smarty.utils import get_data_filename\nfrom unittest import TestCase\n\nimport smarty\n\nclass TestUtils(TestCase):\n def test_read_molecules(self):\n molecules =...
python
chosen
[ { "from": "system", "value": "Use get_queryset method by default\n\nAdds handler for get_query_set where the former method is not available\nin the base manager class.\n\nCloses gh-48\n" }, { "from": "human", "value": "from django.db import models\n\n\nclass OrgManager(models.Manager):\n\n de...
python
chosen
[ { "from": "system", "value": "Change Python 3.x imports to relative.\n" }, { "from": "human", "value": "\"\"\"\nConsistent Overhead Byte Stuffing (COBS) encoding and decoding.\n\nFunctions are provided for encoding and decoding according to\nthe basic COBS method.\n\nThe COBS variant \"Zero Pair...
python
chosen
[ { "from": "system", "value": "Save bill fixtures to test recorded values\n" }, { "from": "human", "value": "from django.test import TestCase, Client\nfrom django.contrib.auth.models import User\nfrom billjobs.models import Bill, Service\nfrom billjobs.settings import BILLJOBS_BILL_ISSUER\n\nclas...
python
chosen
[ { "from": "system", "value": "Fix recipe filter return statement\n" }, { "from": "human", "value": "\"\"\"Dashboard template filters\"\"\"\nfrom django import template\nimport littlechef\n\nfrom kitchen.settings import REPO\n\nregister = template.Library()\n\n\n@register.filter(name='get_role_li...
python
chosen
[ { "from": "system", "value": "Stop truncating the DB for dev/demo pushes.\n" }, { "from": "human", "value": "import logging\n\nfrom commander.deploy import task\n\nfrom deploy_base import * # noqa\n\n\nlog = logging.getLogger(__name__)\nbase_update_assets = update_assets\nbase_database = databa...
python
chosen
[ { "from": "system", "value": "Sort plg: fix caret pos after 'delete empty lines'\n" }, { "from": "human", "value": "import os\nfrom cudatext import *\n\ndef get_ini_fn():\n return os.path.join(app_path(APP_DIR_SETTINGS), 'cuda_sort.ini')\n\ndef ed_set_text_all(lines):\n ed.set_text_all('\\...
python
chosen
[ { "from": "system", "value": "Use the right catalog for RemovableDriveOutputDevice\n" }, { "from": "human", "value": "# Copyright (c) 2015 Ultimaker B.V.\n# Uranium is released under the terms of the AGPLv3 or higher.\n\nimport platform\n\nfrom UM.i18n import i18nCatalog\ncatalog = i18nCatalog(\...
python
chosen
[ { "from": "system", "value": "Test that piv read-object preserves ANSI escape codes\n\nObjects written might (accidentally?) contain such codes, so they\nshould be preserved when read back out. For example, there's a 281 in\n10^12 chance that any six random bytes happen to make the escape code for\nred text...
python
chosen
[ { "from": "system", "value": "ADD a new fixture (GridDomain instance)\n" }, { "from": "human", "value": "import pytest\n\nimport sys, os\n\nmyPath = os.path.dirname(os.path.abspath(__file__))\nsys.path.append(myPath + \"/../src/\")\nfrom app import create_app\nfrom main.core.database import db\n...
python
chosen
[ { "from": "system", "value": "Fix test failures on py3.\n" }, { "from": "human", "value": "# vim: set ts=4 sw=4 et: coding=UTF-8\n\nimport string\n\nfrom rpmsection import Section\n\n\nclass RpmInstall(Section):\n '''\n Remove commands that wipe out the build root.\n Replace %ma...
python
chosen
[ { "from": "system", "value": "Put SMS answer job in very high priority\n" }, { "from": "human", "value": "# -*- coding: utf-8 -*-\n##############################################################################\n#\n# Copyright (C) 2018 Compassion CH (http://www.compassion.ch)\n# Releasing c...
python
chosen
[ { "from": "system", "value": "Remove constant and function that list all existing image types\n\nThis allows having additional image types for (temporarily) internal\npurposes without accidentally exposing them.\n" }, { "from": "human", "value": "\"\"\"\nbyceps.services.image.service\n~~~~~~~~~~...
python
chosen
[ { "from": "system", "value": "Add back the /metrics endpoint\n" }, { "from": "human", "value": "from notebook.utils import url_path_join\nfrom tornado import ioloop\n\nfrom nbresuse.api import ApiHandler\nfrom nbresuse.config import ResourceUseDisplay\nfrom nbresuse.metrics import PSUtilMetricsL...
python
chosen
[ { "from": "system", "value": "Remove form generator from the view.\n" }, { "from": "human", "value": "# -*- coding: utf-8 -*-\n\nfrom django import forms\nfrom django.template import Context, loader\nfrom django.http import HttpResponse\n\nfrom epiweb.apps.survey import utils\nfrom epiweb.apps.s...
python
chosen
[ { "from": "system", "value": "Increment patch version to 0.8.8\n" }, { "from": "human", "value": "\"\"\"yolk.\n\nAuthor: Rob Cakebread <cakebread at gmail>\n\nLicense : BSD\n\n\"\"\"\n\n__version__ = '0.8.7'\n" }, { "from": "gpt", "value": "\"\"\"yolk.\n\nAuthor: Rob Cakebread <cake...
python
chosen
[ { "from": "system", "value": "docs: Fix type used in C++ example.\n" }, { "from": "human", "value": "# distutils: language=c++\n\nimport cython\nfrom cython.cimports.libcpp.vector import vector\n\ndef primes(nb_primes: cython.uint):\n i: cython.int\n p: vector[cython.int]\n p.reserve(nb...
python
chosen
[ { "from": "system", "value": "Edit migration so it depends on 0008_auto_20160415_1854\n\nEnsure the migrations will apply correctly without conflcit once merged\nMerging this branch is now blocked on PR #239\n" }, { "from": "human", "value": "# -*- coding: utf-8 -*-\nfrom __future__ import unico...
python
chosen
[ { "from": "system", "value": "Remove local use of client, instead rely on imported library\n" }, { "from": "human", "value": "# Lidar Project Distance Subsystem\n\nimport serial\nimport socket\nimport time\n\narduino_dist = serial.Serial('/dev/ttyUSB0',9600)\n\ndef get_distance():\n\tdistance = ...
python
chosen
[ { "from": "system", "value": "Support when run_info is not specified\n\nThat is the case when starting a build (not running a step)\n" }, { "from": "human", "value": "#!/usr/bin/env python\n#\n# Syntax: ./run_job <session-id>\n#\n# It should be run with the current working directory set properly...
python
chosen
[ { "from": "system", "value": "ENH: Add very basic tests for codata and constants.\n\ngit-svn-id: 003f22d385e25de9cff933a5ea4efd77cb5e7b28@6563 d6536bca-fef9-0310-8506-e4c0a848fbcf\n" }, { "from": "human", "value": "\nimport warnings\n\nfrom scipy.constants import find\nfrom numpy.testing import ...
python
chosen
[ { "from": "system", "value": "Add ability to set test ini via env variable\n" }, { "from": "human", "value": "import ConfigParser\nimport os\nimport unittest\nfrom pyramid.config import Configurator\nfrom pyramid import testing\n\nglobal_config = {}\n\nini = ConfigParser.ConfigParser()\nini.read...
python
chosen
[ { "from": "system", "value": "Save the session on SaveSession\n" }, { "from": "human", "value": "import sublime\r\nimport sublime_plugin\r\n\r\nfrom .modules import messages\r\nfrom .modules import settings\r\n\r\n\r\nclass SaveSession(sublime_plugin.ApplicationCommand):\r\n def run(self):\r\...
python
chosen
[ { "from": "system", "value": "Update indentation as per style guide\n" }, { "from": "human", "value": "import unittest2\n\nfrom mlabns.util import distance\n\nclass DistanceTestCase(unittest2.TestCase):\n\n def testValidSmallDistance(self):\n dist = distance.distance(0, 0, 10, 10)\n self....
python
chosen
[ { "from": "system", "value": "htrun: Fix package name passed to setuptools\n\nWe passed the package name `greentea` to setuptools to discover the\ncurrent package version. This failed because the package name is\nactually `mbed-greentea`.\n" }, { "from": "human", "value": "#\n# Copyright (c) 202...
python
chosen
[ { "from": "system", "value": "Work around `AttributeError: 'module' object has no attribute 'BufferedIOBase'` on Python 2.7+, Windows" }, { "from": "human", "value": "\"\"\"Image Processing SciKit (Toolbox for SciPy)\"\"\"\n\n\nimport os.path as _osp\n\ndata_dir = _osp.abspath(_osp.join(_osp.dir...
python
chosen
[ { "from": "system", "value": "Add sleep during tests to prevent race\n" }, { "from": "human", "value": "import sys\nimport unittest\nimport tempfile\nimport pathlib\nimport os\nimport os.path\n\nfrom unittest.mock import patch\n\nimport monitor\n\n\nclass TestMonitor(unittest.TestCase):\n def...
python
chosen
[ { "from": "system", "value": "Update Input object to support direct output during get_line operations\n" }, { "from": "human", "value": "class ThingObjectBase(object):\n\n def __getitem__(self, item):\n return getattr(self, item)\n\n def __contains__(self, item):\n return has...
python
chosen
[ { "from": "system", "value": "Use correct m2m join table name in LatestCommentsFeed\n\n\ngit-svn-id: 554f83ef17aa7291f84efa897c1acfc5d0035373@9089 bcc190cf-cafb-0310-a4f2-bffc1f526a37\n" }, { "from": "human", "value": "from django.conf import settings\nfrom django.contrib.syndication.feeds impor...
python
chosen
[ { "from": "system", "value": "Add ignored test for recordaction validation\n" }, { "from": "human", "value": "# -*- coding: utf-8 -*-\nfrom pyxform.tests_v1.pyxform_test_case import PyxformTestCase\n\n\nclass AuditTest(PyxformTestCase):\n def test_background_audio(self):\n self.assertP...
python
chosen
[ { "from": "system", "value": "Use a generator instead of append\n" }, { "from": "human", "value": "from django.conf import settings\nfrom django.core.mail import send_mass_mail\nfrom django.template.loader import render_to_string\nfrom django.utils.translation import ugettext_lazy as _\nfrom pig...
python
chosen
[ { "from": "system", "value": "Change something so tests are not skipped\n" }, { "from": "human", "value": "\"\"\"Execute exactly this copy of pip, within a different environment.\n\nThis file is named as it is, to ensure that this module can't be imported via\nan import statement.\n\"\"\"\n\nimp...
python
chosen
[ { "from": "system", "value": "Modify tests for the BrowserTestCase class so they don't hang\n" }, { "from": "human", "value": "from unittest import TestCase\n\nfrom keteparaha.browser import BrowserTestCase\n\n\nclass BrowserTestCaseTest(TestCase):\n\n class SubClassed(BrowserTestCase):\n\n ...
python
chosen
[ { "from": "system", "value": "Adjust test to use different module as socket imported by coverage tools.\n" }, { "from": "human", "value": "from __future__ import print_function\n\nimport unittest\n\nimport wrapt\n\nclass TestPostImportHooks(unittest.TestCase):\n\n def test_simple(self):\n ...
python
chosen
[ { "from": "system", "value": "Save cal images from clean-analysis\n" }, { "from": "human", "value": "# Remove all analysis output files.\n#\n# Author James Dempsey\n# Date 6 Aug 2016\n\nimport sys\nimport os\nimport shutil\n\n# ### Script starts here ###\n\n# Read day parameter\nif len(sys.argv)...
python
chosen
[ { "from": "system", "value": "Add InviteAdminForm with email_address and role fields\n" }, { "from": "human", "value": "from flask.ext.wtf import Form\nfrom wtforms import validators\n\nfrom dmutils.forms import StripWhitespaceStringField\n\nfrom .. import data_api_client\n\n\nclass AdminEmailAd...
python
chosen
[ { "from": "system", "value": "Add ffn.training.models and switch to Pillow.\n\nIt is still easier to use this repo via git clone rather than pip\ninstall, e.g. from Colab. But this seemed worth updating anyway.\n" }, { "from": "human", "value": "#!/usr/bin/env python\n\nfrom distutils.core impor...
python
chosen
[ { "from": "system", "value": "Increment version for new migrations..\n" }, { "from": "human", "value": "\"\"\"Setup file for easy installation\"\"\"\nimport os\n\nfrom setuptools import setup, find_packages\n\nfrom tests import test_cmd\n\n\nROOT = os.path.dirname(__file__)\n\n\nsetup(\n name...
python
chosen
[ { "from": "system", "value": "Add bottle as a requirement for this package." }, { "from": "human", "value": "import os\n\nfrom setuptools import setup\n\ndef long_description():\n os.system('pandoc --from=markdown --to=rst --output=README.rst README.md')\n readme_fn = os.path.join(os.path.dirn...
python
chosen
[ { "from": "system", "value": "Revert \"Update mbutil to 0.2.0\"\n\nThis reverts commit c3834af13fb14d0961e7e8ce29c3bbbe91ebb5ce.\n" }, { "from": "human", "value": "from setuptools import setup, find_packages\nimport sys\n\nimport mbtoolbox\n\nwith open('mbtoolbox/__init__.py') as f:\n for lin...
python
chosen
[ { "from": "system", "value": "Update package url to github.com/Nexmo/nexmo-python\n" }, { "from": "human", "value": "from setuptools import setup\n\n\nsetup(name='nexmo',\n version='1.0.3',\n description='Python client for the Nexmo API',\n long_description='Python client for the Nexmo API',\...
python
chosen
[ { "from": "system", "value": "Include new data directory as package data\n" }, { "from": "human", "value": "#! /usr/bin/env python\nfrom ez_setup import use_setuptools\nuse_setuptools()\nfrom setuptools import setup, find_packages\n\n\nsetup(name='permamodel',\n version='0.1.0',\n auth...
python
chosen
[ { "from": "system", "value": "Move from py3-protobufers to official version\n\nThe offical version of protobuf supports python 3 as of version 2.6, whats more\nit supports version 3.5 which the py3-protobuffers version doesn't seem to (see\nIssue #4). The py3-protobuffers module is also no longer maintained...
python
chosen
[ { "from": "system", "value": "Set Bambou package version to 0.0.2\n" }, { "from": "human", "value": "from setuptools import setup\n\nsetup(\n name='bambou',\n version='0.0.1',\n url='http://www.nuagenetworks.net/',\n author='Christophe Serafin',\n author_email='christophe.serafin...
python
chosen
[ { "from": "system", "value": "Use pypandoc to convert README.md to RST for long_description\n" }, { "from": "human", "value": "from setuptools import setup, find_packages\n\n\nsetup(\n name='rq-retry-scheduler',\n version='0.1.0b1',\n url='https://github.com/mikemill/rq_retry_scheduler'...
python
chosen
[ { "from": "system", "value": "Rename pypi package and change author\n" }, { "from": "human", "value": "from setuptools import setup, find_packages\nfrom plotbitrate import __version__\n\nwith open(\"README.md\", \"r\") as fh:\n long_description = fh.read() \n\nsetup(\n name='rezun-plotb...
python
chosen
[ { "from": "system", "value": "Use helper method to read files\n" }, { "from": "human", "value": "import re\n\nfrom setuptools import setup\n\ninit_contents = open('random_object_id/__init__.py').read()\nversion = re.search('\"([0-9\\.]+)\"', init_contents).group(1)\n\nwith open('README.rst', 'rb...
python
chosen