conversations
listlengths
2
3
source
stringclasses
1 value
stack
stringclasses
1 value
[ { "from": "system", "value": "Convert to float then to text.\n" }, { "from": "human", "value": "# -*- coding: utf-8 -*-\nfrom __future__ import absolute_import, unicode_literals, division\nimport six\nfrom .attribute import Attribute\nimport decimal\n\n\nclass DecimalAttribute(Attribute):\n\n ...
python
chosen
[ { "from": "system", "value": "Sort keys changed, update test.\n" }, { "from": "human", "value": "assert_has_feature(\n 15, 5467, 12531, 'landuse',\n { 'kind': 'winter_sports',\n 'sort_key': 27 })\n" }, { "from": "gpt", "value": "assert_has_feature(\n 15, 5467, 12531, 'l...
python
chosen
[ { "from": "system", "value": "Remove DeprecationWarning superclass for AstropyDeprecationWarning\n\nwe do this because in py2.7, DeprecationWarning and subclasses are hidden by default, but we want astropy's deprecations to get shown by default\n" }, { "from": "human", "value": "# Licensed under...
python
chosen
[ { "from": "system", "value": "Bump for the python library version\n" }, { "from": "human", "value": "\"\"\"\nCartoDB Services Python Library\n\nSee:\nhttps://github.com/CartoDB/geocoder-api\n\"\"\"\n\nfrom setuptools import setup, find_packages\n\nsetup(\n name='cartodb_services',\n\n vers...
python
chosen
[ { "from": "system", "value": "Fix logging format settings example\n" }, { "from": "human", "value": "\"\"\"\nExample settings module.\n\nThis should be copied as `settings.py` and the values modified there.\n\nThat file is ignored by the repo, since it will contain environment\nspecific and sens...
python
chosen
[ { "from": "system", "value": "Fix access to checkout API.\n\nPrevent access to checkout API urls when checkout is not activated by\nnot creating urlpatterns.\n" }, { "from": "human", "value": "from django.conf.urls import url, patterns\nfrom .api import AJAX_FUNCTIONS\n\n__author__ = 'jyrkila'\n...
python
chosen
[ { "from": "system", "value": "Update plugin_template to Python 3-only standards\n" }, { "from": "human", "value": "from django.db import models\nfrom django.utils.six import python_2_unicode_compatible\nfrom django.utils.translation import ugettext_lazy as _\n\nfrom fluent_contents.models import...
python
chosen
[ { "from": "system", "value": "Test for submitting and viewing questions.\n" }, { "from": "human", "value": "from selenium import webdriver\nimport unittest\nfrom django.test import TestCase\nfrom functional_tests import SERVER_URL\n\n\nclass AskQuestion(TestCase):\n \"\"\"Users can ask questi...
python
chosen
[ { "from": "system", "value": "Bump version: 0.0.2 -> 0.0.3\n\n[ci skip]\n" }, { "from": "human", "value": "from conans import ConanFile\nfrom conans.tools import download, unzip\nimport os\n\nVERSION = \"0.0.2\"\n\n\nclass SanitizeTargetCMakeConan(ConanFile):\n name = \"sanitize-target-cmake\...
python
chosen
[ { "from": "system", "value": "Remove import of all Class app\n" }, { "from": "human", "value": "#!/usr/bin/env python\n# -*- codinf: utf-8 -*-\n\n\"\"\"\n Alignak App\n\n This module is an Alignak App Indicator\n\"\"\"\n\n# Specific Application\nfrom alignak_app import alignak_data, applic...
python
chosen
[ { "from": "system", "value": "Set the hostname when it localhost\n" }, { "from": "human", "value": "import os\nimport getpass\n\nfrom urlparse import urlparse\n\nimport keyring\n\nfrom vr.common.models import Velociraptor\n\n\ndef auth_domain(url):\n hostname = urlparse(url).hostname\n _, ...
python
chosen
[ { "from": "system", "value": "Remove tearDown not used method\n" }, { "from": "human", "value": "from mockito import *\nimport unittest\n\nfrom source.server import *\nfrom source.exception import *\nfrom source.commands.system import *\n\nclass ServerTestCase(unittest.TestCase):\n\n def create...
python
chosen
[ { "from": "system", "value": "api/clubs/list/test: Use `pytest-voluptuous` to simplify JSON compare code\n" }, { "from": "human", "value": "from tests.data import add_fixtures, clubs\n\n\ndef test_list_all(db_session, client):\n sfn = clubs.sfn()\n lva = clubs.lva()\n add_fixtures(db_se...
python
chosen
[ { "from": "system", "value": "Revert \"Re-activate code coverage test.\"\n\nThis reverts commit 9a5d5122139aedddbbcea169525e924269f6c20a.\n" }, { "from": "human", "value": "# coding=utf-8\n#\n# This Source Code Form is subject to the terms of the Mozilla Public\n# License, v. 2.0. If a copy of t...
python
chosen
[ { "from": "system", "value": "Add minimal working version for HistoryView (to be refactored).\n" }, { "from": "human", "value": "from .view import View\n\n\nclass HistoryView(View):\n pass\n" }, { "from": "gpt", "value": "from datetime import datetime\nfrom errno import ENOENT\nfr...
python
chosen
[ { "from": "system", "value": "Change URL of about page -> /about.html\n\nSince we can't control the web server serving this at GitHub Pages, we\ncan't setup proper URL rewriting to get rid of the extension. Ugly, but\nkeeps us from moving back to self-hosted site.\n" }, { "from": "human", "value...
python
chosen
[ { "from": "system", "value": "Add pprint to default python includes\n" }, { "from": "human", "value": "import os,sys,re\nfrom time import sleep\nhome = os.path.expanduser('~')\nif (sys.version_info > (3, 0)):\n # Python 3 code in this block\n exec(open(home+'/homedir/scripts/hexecho.py').read(...
python
chosen
[ { "from": "system", "value": "Use os.path instead of pathlib\n" }, { "from": "human", "value": "import sys\nimport logging\nimport pathlib\n\nfrom PyQt5.QtWidgets import QApplication\nfrom PyQt5.QtGui import QIcon\n\nfrom deen.widgets.core import Deen\n\nICON = str(pathlib.PurePath(__file__).par...
python
chosen
[ { "from": "system", "value": "Fix classmethods on utility class\n" }, { "from": "human", "value": "# -*- coding: utf-8 -*-\n\n\nclass Utilities(object):\n def get_session_string(self, original_session_string):\n session_attributes = original_session_string.split(' ')\n return se...
python
chosen
[ { "from": "system", "value": "Remove meta from source class (belongs to issue not source)\n" }, { "from": "human", "value": "from mythril.solidity.soliditycontract import SolidityContract\nfrom mythril.ethereum.evmcontract import EVMContract\n\n\nclass Source:\n def __init__(\n self, s...
python
chosen
[ { "from": "system", "value": "Fix the array API unique() function\n" }, { "from": "human", "value": "from __future__ import annotations\n\nfrom ._array_object import Array\n\nfrom typing import Tuple, Union\n\nimport numpy as np\n\ndef unique(x: Array, /, *, return_counts: bool = False, return_i...
python
chosen
[ { "from": "system", "value": "Support for Web3 4.0beta: HTTPProvider\n\nIn Web3 3.16 the class is called RPCProvider, but in the\nupcoming 4.0 series it's replaced with HTTPProvider.\n\nThis commit ensures both versions are supported in this regard.\n" }, { "from": "human", "value": "from django...
python
chosen
[ { "from": "system", "value": "Use absolute paths for dependencies\n" }, { "from": "human", "value": "from __future__ import (unicode_literals, division,\n absolute_import, print_function)\n\n\nfrom reggae.build import Build, DefaultOptions\nfrom inspect import getmembers\n...
python
chosen
[ { "from": "system", "value": "Delete cookie on reset inline mode\n" }, { "from": "human", "value": "from .. import inline_translations as _\nfrom django.conf import settings\n\nclass InlineTranslationsMiddleware(object):\n \"\"\" Turn off/on inline tranlations with cookie \"\"\"\n def proc...
python
chosen
[ { "from": "system", "value": "Add unittest skip for CI\n" }, { "from": "human", "value": "# -*- coding: utf-8 -*-\nimport os\nimport unittest\n\nfrom dotenv import load_dotenv\n\nfrom auth0plus.oauth import get_token\n\n\nload_dotenv('.env')\n\n\nclass TestGetAToken(unittest.TestCase):\n def ...
python
chosen
[ { "from": "system", "value": "admin_base: Fix default refirect when url is /control/\n" }, { "from": "human", "value": "# -*- coding: utf-8 -*-\n\nfrom django.http import HttpResponseRedirect\nfrom django.contrib.auth.decorators import login_required\n\n@login_required(login_url='/control/auth/l...
python
chosen
[ { "from": "system", "value": "Test for parsing argument parameters\n" }, { "from": "human", "value": "import unittest\nfrom hamcrest import *\nfrom lib.params import parse_args\n\n\nclass test_arguments_parsing(unittest.TestCase):\n\n def test_default_secret_and_token_to_data_dir(self):\n ...
python
chosen
[ { "from": "system", "value": "Add more libraries that are used at runtime\n" }, { "from": "human", "value": "from distutils.core import setup\n\nsetup(name=\"stellar-magnate\",\n version=\"0.1\",\n description=\"A space-themed commodity trading game\",\n long_description=\"\...
python
chosen
[ { "from": "system", "value": "Fix starting inet client when should use unix socket instead.\nFix port to be int.\n\n\ngit-svn-id: ffaf500d3baede20d2f41eac1d275ef07405e077@1240 a8f5125c-1e01-0410-8897-facf34644b8e\n" }, { "from": "human", "value": "import os\nimport logging\nfrom socket import ge...
python
chosen
[ { "from": "system", "value": "Use binary mode for all gzip files we open.\n" }, { "from": "human", "value": "\nimport sys, os\nimport gzip, tempfile\n\nfilename = tempfile.mktemp()\n\ndata1 = \"\"\" int length=DEFAULTALLOC, err = Z_OK;\n PyObject *RetVal;\n int flushmode = Z_FINISH;\n unsign...
python
chosen
[ { "from": "system", "value": "Use os.path.join() to join paths\n" }, { "from": "human", "value": "\nimport numpy as np\nimport pickle\nimport os\nimport sys\nimport ws.bad as bad\n\nmydir = os.path.abspath(os.path.dirname(__file__))\n\nprint(mydir)\n\nlookupmatrix = pickle.load(open( \\\n ...
python
chosen
[ { "from": "system", "value": "Change imports in dataone test and add test for resource map parsing\n" }, { "from": "human", "value": "\"\"\"test_dataone.py\n\nTest the DataOne utility library.\n\"\"\"\n\nfrom d1lod.dataone import extractIdentifierFromFullURL as extract\n\ndef test_extracting_ide...
python
chosen
[ { "from": "system", "value": "Use GH pages for IETF spec repo link\n" }, { "from": "human", "value": "\"\"\"ACME protocol implementation.\n\nThis module is an implementation of the `ACME protocol`_. Latest\nsupported version: `draft-ietf-acme-01`_.\n\n.. _`ACME protocol`: https://github.com/ietf...
python
chosen
[ { "from": "system", "value": "Use constant time string comparison for password checking\n" }, { "from": "human", "value": "import bcrypt\n\nfrom sqlalchemy.schema import Column\nfrom sqlalchemy.types import Integer, String\nfrom sqlalchemy.ext.declarative import declarative_base\n\n__all__ = ['B...
python
chosen
[ { "from": "system", "value": "Change component name to 'ILAMB'\n\nThis currently conflicts with the component name for the NCL\nversion of ILAMB; however, I'll change its name to 'ILAMBv1'.\nThe current version of ILAMB should take the correct name.\n" }, { "from": "human", "value": "#! /usr/bin...
python
chosen
[ { "from": "system", "value": "Add get param as int\n" }, { "from": "human", "value": "__author__ = 'brock'\n\n\"\"\"\nTaken from: https://gist.github.com/1094140\n\"\"\"\n\nfrom functools import wraps\nfrom flask import request, current_app\n\n\ndef jsonp(func):\n \"\"\"Wraps JSONified outpu...
python
chosen
[ { "from": "system", "value": "Expand class name routing target\n" }, { "from": "human", "value": "# coding: utf-8\n\nfrom .all_changes import AllChanges\nfrom .show_change import ShowChange\nfrom .changes_for_date import ChangesForDate\nfrom .changes_for_class import ChangesForClass\n\nall_route...
python
chosen
[ { "from": "system", "value": "Fix bug in user pass code\n\nThe functions to query user and org passes return non-verified passes when\nverified=None, which was not intended.\n" }, { "from": "human", "value": "# Copyright (c) 2016 Luke San Antonio Bialecki\n# All rights reserved.\n\nfrom sqlalche...
python
chosen
[ { "from": "system", "value": "Use KSC auth's register_conf_options instead of oslo.cfg import\n\nA newer keystoneclient is not happy with simply using oslo_config to\nimport the config group. Instead, use register_conf_options()\nfrom keystoneclient.auth.\n\nChange-Id: I798dad7ad5bd90362e1fa10c2eecb3e1d5ba...
python
chosen
[ { "from": "system", "value": "Raise exception if the image file extension is unknown\n" }, { "from": "human", "value": "import os\nimport requests\n\nclass Cache:\n extensions = [\"gif\", \"jpeg\", \"jpg\", \"png\"]\n\n def __init__(self, directory):\n self.directory = directory\n ...
python
chosen
[ { "from": "system", "value": "Add a docstring to image_bytes\n" }, { "from": "human", "value": "from __future__ import print_function, division, absolute_import\n\nimport sys\nimport os\nimport base64\n\n# See https://iterm2.com/images.html\nIMAGE_CODE = '\\033]1337;File={file};inline={inline};s...
python
chosen
[ { "from": "system", "value": "Fix bug with author permission check\n" }, { "from": "human", "value": "from django.conf.urls import patterns\nfrom django.conf.urls import url\nfrom django.views.generic.base import RedirectView\nfrom django.core.urlresolvers import reverse_lazy\nfrom django.contri...
python
chosen
[ { "from": "system", "value": "Add create sub grid method\n" }, { "from": "human", "value": "# Implement an algorithm that will check whether a given grid of numbers represents a valid Sudoku puzzle\n\ndef check_rows(grid):\n\ti = 0\n\twhile i < len(grid):\n\t\tj = 0\n\t\tref_check = {}\n\t\twhil...
python
chosen
[ { "from": "system", "value": "Read the config file only from /etc/autocloud/autocloud.cfg file.\n" }, { "from": "human", "value": "# -*- coding: utf-8 -*-\n\nimport ConfigParser\nimport os\n\nPROJECT_ROOT = os.path.abspath(os.path.dirname(__name__))\n\nconfig = ConfigParser.RawConfigParser()\nna...
python
chosen
[ { "from": "system", "value": "Improve vector property error message\n" }, { "from": "human", "value": "from __future__ import absolute_import\nfrom __future__ import division\nfrom __future__ import print_function\nfrom __future__ import unicode_literals\n\nimport six\n\nfrom .base import Proper...
python
chosen
[ { "from": "system", "value": "Refactor examples generation to Python 3\n" }, { "from": "human", "value": "from __future__ import print_function\nimport subprocess\n\n\n# Compile examples and export them as images\n#\n# Dependencies:\n# * LaTeX distribution (MiKTeX or TeXLive)\n# * ImageMagick\n#...
python
chosen
[ { "from": "system", "value": "Revert \"Skip an x-failed test due to an unexpected assert\"\n\nThis reverts commit b04c3edb7a8bcb5265a1ea4265714dcb8d1b185a.\n" }, { "from": "human", "value": "# TestSwiftFoundationValueTypes.py\n#\n# This source file is part of the Swift.org open source project\n#...
python
chosen
[ { "from": "system", "value": "Restructure decisiontree task to use more modern celery patterns and use a soft requirement on using the threadless router.\n" }, { "from": "human", "value": "from threadless_router.router import Router\n\nfrom decisiontree.models import Session\n\nfrom celery.task ...
python
chosen
[ { "from": "system", "value": "Add filter for getting user subs:\n" }, { "from": "human", "value": "from tastypie import fields\nfrom tastypie.resources import ModelResource\nfrom tastypie.authentication import ApiKeyAuthentication\nfrom tastypie.authorization import Authorization\nfrom subscript...
python
chosen
[ { "from": "system", "value": "Add comment and reformat code\n" }, { "from": "human", "value": "from django.test import TestCase\nfrom django.http import HttpResponse\nfrom django.contrib.admin.sites import AdminSite\nfrom django.contrib.auth.models import User\nfrom billjobs.admin import UserAdm...
python
chosen
[ { "from": "system", "value": "Fix error during merge commit\n" }, { "from": "human", "value": "from django.conf import settings\nfrom django.utils.module_loading import import_string\n\n\ndef select_for(data_type):\n \"\"\"The storage class for each datatype is defined in a settings file. Thi...
python
chosen
[ { "from": "system", "value": "Add more OData parameter format escapes\n" }, { "from": "human", "value": "from requests.compat import basestring\n\n\nclass ODataPathParser(object):\n @staticmethod\n def parse_path_string(string):\n pass\n\n @staticmethod\n def from_method(metho...
python
chosen
[ { "from": "system", "value": "Allow ls to pass arguments\n" }, { "from": "human", "value": "from cmd2 import Cmd, options, make_option\nimport h5_wrapper\nimport sys\nimport os\n\nclass CmdApp(Cmd):\n\n def do_ls(self, args, opts=None):\n for g in self.explorer.list_groups():\n ...
python
chosen
[ { "from": "system", "value": "Test the --nocram command line option\n" }, { "from": "human", "value": "import pytest_cram\n\npytest_plugins = \"pytester\"\n\n\ndef test_version():\n assert pytest_cram.__version__\n\n\ndef test_cramignore(testdir):\n testdir.makeini(\"\"\"\n [pytest]...
python
chosen
[ { "from": "system", "value": "Convert *_INTERVAL variables to int\n\nALERT_INTERVAL and NOTIFICATION_INTERVAL are now converted to\nnumbers. This allows user-defined ALERT_INTERVAL and\nNOTIFICATION_INTERVAL env variables to work without throwing\nTypeErrors:\n\n return self.run(*args, **kwargs)\n File ...
python
chosen
[ { "from": "system", "value": "Increment version because bad release\n" }, { "from": "human", "value": "version_info = (0, 5, 1)\nversion = '.'.join(map(str, version_info))\n" }, { "from": "gpt", "value": "version_info = (0, 5, 2)\nversion = '.'.join(map(str, version_info))\n" } ]
python
chosen
[ { "from": "system", "value": "Fix relying on pyinfra generator unroll\n" }, { "from": "human", "value": "# pyinfra\n# File: pyinfra/modules/pip.py\n# Desc: manage virtualenvs\n\n'''\nManage Python virtual environments\n'''\n\nfrom __future__ import unicode_literals\n\nfrom pyinfra.api import ope...
python
chosen
[ { "from": "system", "value": "Fix media handling in demo application.\n" }, { "from": "human", "value": "from __future__ import absolute_import\n\nimport django\nfrom django.conf import settings\nfrom django.conf.urls import include, url\nfrom django.conf.urls.static import static\nfrom django.c...
python
chosen
[ { "from": "system", "value": "Set default language for model/form translation strings. Have to changed for English installation!\n(Template strings are translated automatically by selected browser language)\n" }, { "from": "human", "value": "#!/usr/bin/env python\n# -*- coding: utf-8 -*-\n\"\"\"...
python
chosen
[ { "from": "system", "value": "Add a test group key\n" }, { "from": "human", "value": "TEST_TOKEN = 'azGDORePK8gMaC0QOYAMyEEuzJnyUi'\nTEST_USER = 'uQiRzpo4DXghDmr9QzzfQu27cmVRsG'\nTEST_GROUP = ''\nTEST_BAD_USER = '1234'\nTEST_DEVICES = ['droid2', 'iPhone']\nTEST_TITLE = 'Backup finished - SQL1'\n...
python
chosen
[ { "from": "system", "value": "Remove an unused variable from TestTests.\n" }, { "from": "human", "value": "\"\"\"\n Tests for the :mod:`retdec.test` module.\n\n :copyright: © 2015 by Petr Zemek <s3rvac@gmail.com> and contributors\n :license: MIT, see the ``LICENSE`` file for more detail...
python
chosen
[ { "from": "system", "value": "Check if project exists inside ProjectConverter.\n" }, { "from": "human", "value": "import json\n\nfrom werkzeug.routing import BaseConverter\nfrom flask import render_template, request, abort\nimport requests\n\nfrom ide import app\nfrom ide.projects import get_all...
python
chosen
[ { "from": "system", "value": "Add test for notify dataset/delete\n" }, { "from": "human", "value": "from mock import patch\n\nimport unittest\n\nimport ckan.model as model\nfrom ckan.model.domain_object import DomainObjectOperation\n\nfrom ckanext.syndicate.plugin import SyndicatePlugin\n\n\ncla...
python
chosen
[ { "from": "system", "value": "Fix zero-length field error when building docs in Python 2.6\n" }, { "from": "human", "value": "import os\n\nimport libtaxii\n\nproject = u'libtaxii'\ncopyright = u'2014, The MITRE Corporation'\nversion = libtaxii.__version__\nrelease = version\n\nextensions = [\n ...
python
chosen
[ { "from": "system", "value": "Fix ObjectType name and description attributes\n" }, { "from": "human", "value": "from collections import OrderedDict\n\nfrom graphql.type.definition import GraphQLObjectType\nfrom marshmallow import Schema, SchemaOpts\n\nfrom polygraph.utils.trim_docstring import t...
python
chosen
[ { "from": "system", "value": "Remove unused select_related, defer the loading of shape for speed\n" }, { "from": "human", "value": "# -*- coding: utf-8 -*-\nfrom __future__ import absolute_import, unicode_literals\n\nfrom django.views.generic import DetailView, ListView\n\nfrom .models import Di...
python
chosen
[ { "from": "system", "value": "Add basic unit test for shade.openstack_cloud\n\nJust getting basic minimal surface area unit tests to help when making\nchanges. This exposed some python3 incompatibilities in\nos-client-config, which is why the change Depends on\nIa78bd8edd17c7d2360ad958b3de734503d400774.\n\n...
python
chosen
[ { "from": "system", "value": "Update expected http status code in test\n" }, { "from": "human", "value": "from .initial_data import users\nfrom yunity.utils.tests.comparison import DeepMatcher\n\nresponse = {\n \"http_status\": 201,\n \"response\": {\n \"participants\": [users[0]...
python
chosen
[ { "from": "system", "value": "Add verbose name to Conf model.\n" }, { "from": "human", "value": "# -*- coding: utf-8 -*-\nfrom __future__ import unicode_literals\n\nfrom django.contrib.auth import get_user_model\nfrom django.db import models\nfrom django.db.models.signals import post_save\nfrom ...
python
chosen
[ { "from": "system", "value": "Change old style class defined to new style class definition\n" }, { "from": "human", "value": "# encoding: utf-8\n\n\"\"\"\n.. codeauthor:: Tsuyoshi Hombashi <gogogo.vm@gmail.com>\n\"\"\"\n\nfrom __future__ import unicode_literals\n\n\nclass Align:\n\n class __A...
python
chosen
[ { "from": "system", "value": "Handle IOError in run_once mode so paging works\n\nSigned-off-by: Raul Gutierrez S <f25f6873bbbde69f1fe653b3e6bd40d543b8d0e0@itevenworks.net>\n" }, { "from": "human", "value": "from __future__ import print_function\n\nimport argparse\nimport logging\nimport sys\n\n\...
python
chosen
[ { "from": "system", "value": "Add id to json content types\n\nTests will probably fail!" }, { "from": "human", "value": "from feincms.content.medialibrary.models import MediaFileContent\nfrom feincms.content.richtext.models import RichTextContent\nfrom feincms.content.section.models import Secti...
python
chosen
[ { "from": "system", "value": "Revert NamedEntityFilth name because it was a bad idea\n" }, { "from": "human", "value": "from .base import Filth\n\n\nclass NamedEntityFilth(Filth):\n \"\"\"\n Named entity filth. Upon initialisation provide a label for named entity (e.g. name, org)\n \"\"...
python
chosen
[ { "from": "system", "value": "Change comparison parameter in example\n" }, { "from": "human", "value": "import pprint\nimport maec.bindings.maec_bundle as maec_bundle_binding\nfrom maec.bundle.bundle import Bundle\n# Matching properties dictionary\nmatch_on_dictionary = {'FileObjectType': ['file...
python
chosen
[ { "from": "system", "value": "Remove reference to deprecated \"patterns\" function.\n\nThis function is no longer available starting with Django 1.10.\n\nCf. https://docs.djangoproject.com/en/2.1/releases/1.10/#features-removed-in-1-10\n" }, { "from": "human", "value": "from django.conf.urls imp...
python
chosen
[ { "from": "system", "value": "Fix minor bug in length comparison.\n" }, { "from": "human", "value": "#!/usr/bin/env python\n\nfrom __future__ import absolute_import, print_function\n\n# Standard library\nfrom os import walk\nfrom os.path import exists, isdir, join\n\n# Local library\nfrom .util ...
python
chosen
[ { "from": "system", "value": "Revert \"Possible fix for docs not rendering auto\"\n\nThis reverts commit 88c3fd3c4b23b12f4b68d3f5a13279870486d4b2.\n" }, { "from": "human", "value": "\"\"\"\nWTForms Extended Widgets\n########################\n\nThis package aims to one day eventually contain adva...
python
chosen
[ { "from": "system", "value": "Remove redis cache stats url.\n" }, { "from": "human", "value": "# -*- coding: utf-8 -*-\n\nfrom django.conf.urls.defaults import patterns, include, url\nfrom django.contrib.staticfiles.urls import staticfiles_urlpatterns\nfrom django.conf import settings\n\nurlpatt...
python
chosen
[ { "from": "system", "value": "Use subprocess isntead of popen to get Jython working too\n" }, { "from": "human", "value": "import os\nimport sys\n\n\nclass LoginLibrary:\n\n def __init__(self):\n self._sut_path = os.path.join(os.path.dirname(__file__),\n ...
python
chosen
[ { "from": "system", "value": "Modify a log message template\n" }, { "from": "human", "value": "# encoding: utf-8\n\n\"\"\"\n.. codeauthor:: Tsuyoshi Hombashi <tsuyoshi.hombashi@gmail.com>\n\"\"\"\n\nfrom __future__ import absolute_import, unicode_literals\n\n\nPROGRAM_NAME = \"sqlitebiter\"\nMAX...
python
chosen
[ { "from": "system", "value": "Fix the codes in the tests\n" }, { "from": "human", "value": "import unittest\nimport sys\ntry:\n from StringIO import StringIO\nexcept ImportError:\n from io import StringIO # NOQA\n\nfrom flake8.mccabe import get_code_complexity\n\n\n_GLOBAL = \"\"\"\\\n...
python
chosen
[ { "from": "system", "value": "Fix location factory field name\n" }, { "from": "human", "value": "# coding: utf-8\n\nimport factory\nimport random\n\nfrom .models import Location, Region\n\n\nclass RegionFactory(factory.Factory):\n FACTORY_FOR = Region\n\n name = factory.Sequence(lambda n: ...
python
chosen
[ { "from": "system", "value": "Switch rst2html to HTML5 builder\n\nThis gives a prettier output and every browser in widespread usage has\nsupported it for years. The license, which was previously missing, is\nadded.\n\nSigned-off-by: Stephen Finucane <06fa905d7f2aaced6dc72e9511c71a2a51e8aead@that.guru>\n" ...
python
chosen
[ { "from": "system", "value": "Allow \"Home\" to be active menu item\n" }, { "from": "human", "value": "from ..models import Block\nfrom django.template import Library\n\nregister = Library()\n\n@register.simple_tag\ndef show_block(name):\n try:\n return Block.objects.get(name=name).con...
python
chosen
[ { "from": "system", "value": "Fix reference to model name\n" }, { "from": "human", "value": "#\n# Copyright (c) 2010 rPath, Inc.\n#\n# All Rights Reserved\n#\n\nfrom django.http import HttpResponse\nfrom django_restapi import resource\n\nfrom mint.django_rest.deco import requires\nfrom mint.djan...
python
chosen
[ { "from": "system", "value": "Fix TempestPlugin to fix gate failure\n\nCurrently, tempest plugin for FWaaS is failing due to a wrong\nfunction signature. This patch fixes the function.\n\nReference:\nhttp://logs.openstack.org/75/247375/5/check/gate-congress-dsvm-api/1c5ed1f/logs/tempest.txt.gz?level=ERROR\n...
python
chosen
[ { "from": "system", "value": "Add quick comment to explain test_runner.py\n" }, { "from": "human", "value": "# Monary - Copyright 2011-2013 David J. C. Beach\n# Please see the included LICENSE.TXT and NOTICE.TXT for licensing information.\n\nimport os\nfrom os import listdir\nfrom os.path import...
python
chosen
[ { "from": "system", "value": "Add comment to clarify the pipeline settings." }, { "from": "human", "value": "from .base import *\nfrom .pipeline import *\n\n\n# Debug Settings\nDEBUG = True\n\nTEMPLATE_DEBUG = True\n\nSTATIC_ROOT = os.path.join(BASE_DIR, 'static_final')\n\n# TMP Dir for Chorople...
python
chosen
[ { "from": "system", "value": "Add Unit-Tests Around Issue and Severity Creation and Association\n" }, { "from": "human", "value": "\nfrom machete.issues.models import Issue\n\nimport unittest\nclass CreateTest(unittest.TestCase):\n pass\n\n\n" }, { "from": "gpt", "value": "from ma...
python
chosen
[ { "from": "system", "value": "Add message type field for api serializer\n" }, { "from": "human", "value": "# -*- coding: utf-8 -*-\n\nfrom rest_framework import serializers\n\nfrom message.models import Message\n\n\nclass MessageSerializer(serializers.ModelSerializer):\n class Meta:\n ...
python
chosen
[ { "from": "system", "value": "Remove only those files that were stored 5 minutes ago.\n\n[https://cloudbolt.atlassian.net/browse/DEV-12629]\n" }, { "from": "human", "value": "\"\"\"\r\nThis action removes all the zip files from CloudBolt /tmp/systemd-private* directory.\r\n\"\"\"\r\nfrom common....
python
chosen
[ { "from": "system", "value": "Fix issue where last email was truncated\n" }, { "from": "human", "value": "# General utility library\nfrom re import match\nimport inspect\nimport sys\nimport ctypes\nimport logging\n\nlogger = logging.getLogger(__name__)\n\n\ndef comma_sep_list(lst):\n \"\"\"Se...
python
chosen
[ { "from": "system", "value": "Fix counter to ignore quoted lines\n" }, { "from": "human", "value": "import re\nfrom fileanalyzer import FileAnalyzer\n\n\nclass PythonAnalyzer(FileAnalyzer):\n def get_class_count(self, content):\n return len(\n re.findall(\"[^\\\"](class +[a-...
python
chosen
[ { "from": "system", "value": "Fix response status code transmission in the TG1 adapter\n\n--HG--\nextra : rebase_source : 99de2b9beb0ebb61fcd87291faede89e150454fe\n" }, { "from": "human", "value": "import cherrypy\nimport webob\nfrom turbogears import expose\n\n\nclass Controller(object):\n\n ...
python
chosen
[ { "from": "system", "value": "Add stubby test for getting a contact.\n" }, { "from": "human", "value": "\"\"\"\nTests for riak contacts backend and collection.\n\"\"\"\n\nfrom twisted.trial.unittest import TestCase\nfrom zope.interface.verify import verifyObject\n\nfrom go_api.collections import...
python
chosen
[ { "from": "system", "value": "Fix redis initialization in tests\n" }, { "from": "human", "value": "# -*- coding: utf-8 -*-\n\nfrom flask import Flask\nfrom flask_split import split\nfrom redis import Redis\n\n\nclass TestCase(object):\n def setup_method(self, method):\n self.redis = Re...
python
chosen
[ { "from": "system", "value": "Add .names to Argument API\n" }, { "from": "human", "value": "from spec import Spec, eq_, skip, ok_, raises\n\nfrom invoke.parser import Argument\n\n\nclass Argument_(Spec):\n def may_take_names_list(self):\n names = ('--foo', '-f')\n a = Argument(n...
python
chosen
[ { "from": "system", "value": "Exclude asyncio tests from 3.4\n" }, { "from": "human", "value": "collect_ignore = []\n\ntry:\n import asyncio\nexcept ImportError:\n collect_ignore.append('test_asyncio.py')\n" }, { "from": "gpt", "value": "from sys import version_info as v\n\ncol...
python
chosen
[ { "from": "system", "value": "Add tests for function smoothing\n" }, { "from": "human", "value": "#!/usr/bin/python\n\nimport unittest\nimport numpy as np\nfrom corfunc import porod, guinier, fitguinier\n\n\nclass TestStringMethods(unittest.TestCase):\n def test_porod(self):\n self.ass...
python
chosen
[ { "from": "system", "value": "Add a parametrized test for valid timezones\n" }, { "from": "human", "value": "# -*- coding: utf-8 -*-\n\nfrom freezegun import freeze_time\nfrom jinja2 import Environment, exceptions\nimport pytest\n\n\n@pytest.fixture(scope='session')\ndef environment():\n retu...
python
chosen