conversations listlengths 2 3 | source stringclasses 1
value | stack stringclasses 1
value |
|---|---|---|
[
{
"from": "system",
"value": "Fix up statsd work to support python 2.6\n\nFormat specifiers must include field specifier\n"
},
{
"from": "human",
"value": "# -*- coding: utf-8 -*-\nfrom __future__ import absolute_import\n\nimport logging\nfrom functools import wraps\nfrom django_statsd.clients i... | python | chosen |
[
{
"from": "system",
"value": "Use integer distances to avoid so many events.\n"
},
{
"from": "human",
"value": "import threading\nimport time\n\nclass SensorThread(object):\n\n def __init__(self, notify, delay=0):\n self.notify = notify\n self.delay = delay\n self.interva... | python | chosen |
[
{
"from": "system",
"value": "Support iterating over the different bases\n\nAnd fix the encoding issue that suddenly became obvious.\n"
},
{
"from": "human",
"value": "from __future__ import unicode_literals\n\nimport os\nfrom datetime import datetime\n\nfrom dateutil.relativedelta import relati... | python | chosen |
[
{
"from": "system",
"value": "Add test for constructor of pgbackup for pg_data is set correctly.\n"
},
{
"from": "human",
"value": "# coding: utf-8\n\"\"\"\nUnit tests for essential functions in postgresql backup.\n\"\"\"\nfrom unittest.mock import MagicMock, mock_open, patch\nimport pytest\nimp... | python | chosen |
[
{
"from": "system",
"value": "Add comment about browsers not liking application/json.\n"
},
{
"from": "human",
"value": "from fileupload.models import Picture\nfrom django.views.generic import CreateView, DeleteView\n\nfrom django.http import HttpResponse\nfrom django.utils import simplejson\nfr... | python | chosen |
[
{
"from": "system",
"value": "Rework a little bit the top level module of the application\n\nStart working on the logging\nAdd couple of utility functions (as is_authenticated)\nFix case of the APP variable, to be pep8\nMake the application working behind a reverse proxy\nMake the application use the FAS pl... | python | chosen |
[
{
"from": "system",
"value": "Use file patterns compiled to regular expressions to match hidden files.\n"
},
{
"from": "human",
"value": "class DirTreeFilter(object):\n def __init__(self, show_hidden=False, show_files=True, show_dirs=True):\n self.show_hidden = show_hidden\n sel... | python | chosen |
[
{
"from": "system",
"value": "Implement main section of blo package.\n"
},
{
"from": "human",
"value": "# -*- coding: utf-8 -*-\nimport configparser\nimport optparse\nfrom blo import Blo\n\nif __name__ == '__main__':\n parser = optparse.OptionParser(\"usage: %prog [option] markdown_file.md\")... | python | chosen |
[
{
"from": "system",
"value": "Allow \"-\" chars in the resync view\n"
},
{
"from": "human",
"value": "# Amara, universalsubtitles.org\n#\n# Copyright (C) 2013 Participatory Culture Foundation\n#\n# This program is free software: you can redistribute it and/or modify\n# it under the terms of the ... | python | chosen |
[
{
"from": "system",
"value": "FIX sample data load for Windows\n"
},
{
"from": "human",
"value": "import cPickle\nfrom os.path import dirname\nfrom os.path import join\n\nimport numpy as np\n\n\ndef load_letters():\n \"\"\"Load the OCR letters dataset.\n\n This is a chain classification ta... | python | chosen |
[
{
"from": "system",
"value": "Change label text of 'private' Field\n"
},
{
"from": "human",
"value": "from flask_wtf import Form\nfrom wtforms import TextAreaField, StringField, SelectField, BooleanField\nfrom wtforms.validators import InputRequired, Optional, Length\n\nclass PostForm(Form):\n ... | python | chosen |
[
{
"from": "system",
"value": "Move crispy helper to '.form' property\n"
},
{
"from": "human",
"value": "\nfrom __future__ import absolute_import\nfrom copy import deepcopy\n\nfrom django.db import models\nfrom django import forms\nfrom django.utils.translation import ugettext_lazy as _\n\nfrom d... | python | chosen |
[
{
"from": "system",
"value": "Fix to include mandatory name attribute"
},
{
"from": "human",
"value": "\nfrom django.apps import AppConfig\n\nfrom django.utils.module_loading import autodiscover_modules\n\n\nclass NapConfig(AppConfig):\n '''App Config that performs auto-discover on ready.'''\... | python | chosen |
[
{
"from": "system",
"value": "Deal with comma-separated tags lists HNGH\n"
},
{
"from": "human",
"value": "import logging\n\nfrom pylons import request, response, session, tmpl_context as c, url\nfrom pylons.controllers.util import abort, redirect\n\nimport porick.lib.helpers as h\nfrom porick.l... | python | chosen |
[
{
"from": "system",
"value": "Tweak demo to show multiple faces in one window instead of separate windows\n"
},
{
"from": "human",
"value": "from PIL import Image, ImageDraw\nimport face_recognition\n\n# Load the jpg file into a numpy array\nimage = face_recognition.load_image_file(\"biden.jpg\"... | python | chosen |
[
{
"from": "system",
"value": "Correct wrong inheritance on sponsorship_typo3 child_depart wizard.\n"
},
{
"from": "human",
"value": "# -*- encoding: utf-8 -*-\r\n##############################################################################\r\n#\r\n# Copyright (C) 2014 Compassion CH (http://w... | python | chosen |
[
{
"from": "system",
"value": "Add __main__ program for running on files\n"
},
{
"from": "human",
"value": "import gate\n\n\nclass EventAttributionUnit:\n \"\"\"event, attribution must be gate.Annotation objects\n \"\"\"\n def __init__(self, event, attribution):\n self._event = ev... | python | chosen |
[
{
"from": "system",
"value": "Add minimal docstring for decorator\n"
},
{
"from": "human",
"value": "pipeline_functions = {}\n\n\ndef register_pipeline(function):\n if function.__name__ in pipeline_functions:\n raise ExistingFunctionError(\n '%s is already registered with %s... | python | chosen |
[
{
"from": "system",
"value": "Use default dictionary when no arg passed\n"
},
{
"from": "human",
"value": "#!/usr/bin/python\nimport sys\nimport json\n\n# Count average speeds for links\n\ndef main(locationdata_dictionary_file):\n\n locationdata = {}\n with open(locationdata_dictionary_fil... | python | chosen |
[
{
"from": "system",
"value": "Add default to movement date\n"
},
{
"from": "human",
"value": "from __future__ import unicode_literals\n\nfrom django.conf import settings\nfrom django.db import models\nfrom django.utils.encoding import python_2_unicode_compatible\nfrom django.utils.translation im... | python | chosen |
[
{
"from": "system",
"value": "Check date of scan is not in future\n"
},
{
"from": "human",
"value": "from radar.validation.data_sources import DataSourceValidationMixin\nfrom radar.validation.core import Field, Validation\nfrom radar.validation.meta import MetaValidationMixin\nfrom radar.validat... | python | chosen |
[
{
"from": "system",
"value": "Add xml header and post data as stream-like object just to be sure\n"
},
{
"from": "human",
"value": "# coding=utf-8\n\nfrom __future__ import unicode_literals\n\n\nfrom .marc import Record\nfrom .util import etree, parse_xml, show_diff\n\n\nclass Bib(object):\n ... | python | chosen |
[
{
"from": "system",
"value": ":sparkles: Update tutorial renamer to exclude files\n"
},
{
"from": "human",
"value": "#%%\nfrom pathlib import Path, PurePath\nfrom string import digits\n\ndirectory = Path(\"./docs/tutorial/src\")\ndirs = sorted([Path(f) for f in directory.iterdir()])\nd: PurePath... | python | chosen |
[
{
"from": "system",
"value": "Fix wrong import after module renaming\n"
},
{
"from": "human",
"value": "# -*- coding: utf-8 -*-\nfrom . import test_purchase_order_line_invoice_wizard\n"
},
{
"from": "gpt",
"value": "# -*- coding: utf-8 -*-\nfrom . import test_purchase_order_line_invo... | python | chosen |
[
{
"from": "system",
"value": "Add online prediction example for TF\n\nChange-Id: I508aaca04576b3bda500fae3350351ef7b251747\n"
},
{
"from": "human",
"value": "# python3\n# Copyright 2020 Google Inc. All Rights Reserved.\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# yo... | python | chosen |
[
{
"from": "system",
"value": "Revert \"Update example workflow to show you can use classes\"\n\nThis reverts commit dbce79102efa8fee233af95939f1ff0b9d060b00.\n"
},
{
"from": "human",
"value": "import time\n\nfrom simpleflow import (\n activity,\n Workflow,\n futures,\n)\n\n\n@activity.w... | python | chosen |
[
{
"from": "system",
"value": "Add encoding to the documentation file.\n"
},
{
"from": "human",
"value": "import markdown\nimport os\nfrom flask import render_template, url_for, redirect, Markup\nfrom app.main import main\nfrom flask_login import login_required\n\nfrom flask.ext.login import curr... | python | chosen |
[
{
"from": "system",
"value": "Modify to handle ARtool output\n"
},
{
"from": "human",
"value": "import os, sys\nfrom operator import itemgetter\n\ndef errorExit(msg):\n sys.stderr.write(msg)\n sys.exit(1)\n\ndef main():\n # Verify arguments\n if len(sys.argv) != 2: \n errorExi... | python | chosen |
[
{
"from": "system",
"value": "Add app_name to url module\n"
},
{
"from": "human",
"value": "from django.urls import path\nfrom .views import LTILaunchView, LTIToolConfigView, logout_view, logged_out_view\n\nurlpatterns = [\n path('', LTILaunchView.as_view(), name='index'),\n path('launch',... | python | chosen |
[
{
"from": "system",
"value": "Add a balance (equity) account\n"
},
{
"from": "human",
"value": "# -*- coding: utf-8 -*-\n# Generated by Django 1.11.3 on 2017-07-18 03:55\nfrom __future__ import unicode_literals\n\nfrom django.db import migrations, connection\n\n\ndef load_data(apps, schema_edito... | python | chosen |
[
{
"from": "system",
"value": "Add googleapis_auth to dart package waterfall\n\nReview URL: https://codereview.chromium.org/574283003\n\ngit-svn-id: 239fca9b83025a0b6f823aeeca02ba5be3d9fd76@291992 0039d316-1c4b-4281-b951-d872f2087c98\n"
},
{
"from": "human",
"value": "# Copyright 2014 The Chromiu... | python | chosen |
[
{
"from": "system",
"value": "Add helpful text to template error"
},
{
"from": "human",
"value": "from django import template\nfrom django.template.defaultfilters import stringfilter\nfrom django.template.base import TemplateSyntaxError\nimport hashlib\nfrom django_hash_filter.templatetags impor... | python | chosen |
[
{
"from": "system",
"value": "Change get_work to response with work JSON\n"
},
{
"from": "human",
"value": "from django.http import HttpResponse\nfrom django.views.decorators.csrf import csrf_exempt\n\n\ndef get_work(request):\n return HttpResponse('Not implemented')\n\n\n@csrf_exempt\ndef wo... | python | chosen |
[
{
"from": "system",
"value": "Add docstring to Schedule model\n"
},
{
"from": "human",
"value": "from django.db import models\nfrom django.utils.translation import ugettext_lazy as _\n\n\nclass Schedule(models.Model):\n minute = models.CharField(_('minute'), max_length=64, default='*')\n h... | python | chosen |
[
{
"from": "system",
"value": "Add type hint for run_in_threadpool return type\n"
},
{
"from": "human",
"value": "import asyncio\nimport functools\nimport typing\nfrom typing import Any, AsyncGenerator, Iterator\n\ntry:\n import contextvars # Python 3.7+ only.\nexcept ImportError: # pragma: ... | python | chosen |
[
{
"from": "system",
"value": "Add to_struct to attribute table\n"
},
{
"from": "human",
"value": "# -*- coding: utf-8 -*-\n\n\"\"\"\nExtension attribute table type. Supports ordered (struct) fields, or\nunordered (hash-based) fields.\n\"\"\"\n\nfrom numba.typesystem import *\nfrom numba.typesyst... | python | chosen |
[
{
"from": "system",
"value": "Add a few useful utility methods to TaskWindowLayout.\n"
},
{
"from": "human",
"value": "# Enthought library imports.\nfrom enthought.traits.api import Dict, HasStrictTraits, Instance, List, Str, \\\n Tuple\n\n# Local imports.\nfrom task_layout import TaskLayout... | python | chosen |
[
{
"from": "system",
"value": "Fix bug '__init__' showing in list of cities\n"
},
{
"from": "human",
"value": "def file_is_allowed(file):\n return file.endswith(\".py\") and \"__init__\" not in file.title() and \"Sample_City\" not in file.title()\n"
},
{
"from": "gpt",
"value": "de... | python | chosen |
[
{
"from": "system",
"value": "Check on the EOL chars in ,cover gold files.\n"
},
{
"from": "human",
"value": "# Check files for incorrect newlines\n\nimport fnmatch, os\n\ndef check_file(fname):\n for n, line in enumerate(open(fname, \"rb\")):\n if \"\\r\" in line:\n print \... | python | chosen |
[
{
"from": "system",
"value": "Remove REQUIRED, OPTIONAL, DISABLED from default exports\n\nPrevent polluting the callers namespace with generically named constants.\n"
},
{
"from": "human",
"value": "\"\"\"\nrequests Kerberos/GSSAPI authentication library\n~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~... | python | chosen |
[
{
"from": "system",
"value": "Add scope_types to token revocation policies\n\nThis doesn't seem useful since the API will return an empty list\nregardless because PKI support has been removed.\n\nMore or less doing this for consistency.\n\nChange-Id: Iaa2925119fa6c9e2324546ed44aa54bac51dba05\n"
},
{
... | python | chosen |
[
{
"from": "system",
"value": "docs: Update docstring to include config file name\n"
},
{
"from": "human",
"value": "\"\"\"Load base config and export package constants.\"\"\"\nimport logging\nfrom configparser import ConfigParser\nfrom os.path import expanduser\n\nLOG = logging.getLogger(__name_... | python | chosen |
[
{
"from": "system",
"value": "Make whitespace and numparse configurable.\n"
},
{
"from": "human",
"value": "from cli_helpers.packages import tabulate\nfrom .preprocessors import bytes_to_string, align_decimals\n\ntabulate.PRESERVE_WHITESPACE = True\n\nsupported_markup_formats = ('mediawiki', 'ht... | python | chosen |
[
{
"from": "system",
"value": "Use SecureTemporaryFile for Source Interface requests\n"
},
{
"from": "human",
"value": "from flask import wrappers\nfrom tempfile import NamedTemporaryFile\nfrom io import BytesIO\n\nclass RequestThatSecuresFileUploads(wrappers.Request):\n\n def _secure_file_str... | python | chosen |
[
{
"from": "system",
"value": "Update test file paths for common to point to compressed versions.\n"
},
{
"from": "human",
"value": "from unittest.mock import Mock, patch\nfrom django.test import TestCase\nfrom data_refinery_common import microarray\n\nCEL_FILE_HUMAN = \"test-files/C30057.CEL\"\n... | python | chosen |
[
{
"from": "system",
"value": "Address Django warnings on url pattern regex\n"
},
{
"from": "human",
"value": "\"\"\"\nURL path mapping for our Django app.\n\"\"\"\nfrom django.conf.urls import url\n\nfrom . import views\nfrom .settings import URL_MAX_WORDS\n\nurlpatterns = [\n url(r'^/*$', vi... | python | chosen |
[
{
"from": "system",
"value": "Rename new sequence search url\n"
},
{
"from": "human",
"value": "\"\"\"\nCopyright [2009-2014] EMBL-European Bioinformatics Institute\nLicensed under the Apache License, Version 2.0 (the \"License\");\nyou may not use this file except in compliance with the License... | python | chosen |
[
{
"from": "system",
"value": "Allow shape output on /boundary/ queries\n"
},
{
"from": "human",
"value": "from django.conf.urls.defaults import patterns, include, url\n\nfrom boundaryservice.views import *\n\nurlpatterns = patterns('',\n url(r'^boundary-set/$', BoundarySetListView.as_view(), ... | python | chosen |
[
{
"from": "system",
"value": "Use pathlib to read ext.conf\n"
},
{
"from": "human",
"value": "import os\n\nfrom mopidy import config, ext\n\n__version__ = \"1.2.1\"\n\n\nclass Extension(ext.Extension):\n\n dist_name = \"Mopidy-Scrobbler\"\n ext_name = \"scrobbler\"\n version = __version... | python | chosen |
[
{
"from": "system",
"value": "Fix up example with corrected path\n\n"
},
{
"from": "human",
"value": "import sys\r\n\r\nfrom SALib.analyze import delta\r\nfrom SALib.util import read_param_file\r\nimport numpy as np\r\n\r\n\r\nsys.path.append('../..')\r\n\r\n\r\n# Read the parameter range file a... | python | chosen |
[
{
"from": "system",
"value": "Fix save for empty tags\n"
},
{
"from": "human",
"value": "from django import forms\nfrom django.db.models.functions import Lower\n\nfrom . import models\n\n\nclass TagGroup(forms.ModelForm):\n class Meta:\n model = models.Tagged\n fields = []\n\n ... | python | chosen |
[
{
"from": "system",
"value": "Raise our own ImportError if all fails. Looks better than to complain about\ndjango when that happens\n"
},
{
"from": "human",
"value": "\"\"\"\nGet the best JSON encoder/decoder available on this system.\n\"\"\"\n\n__version__ = \"0.1\"\n__author__ = \"Rune Halvors... | python | chosen |
[
{
"from": "system",
"value": "Add files writer to solution app\n"
},
{
"from": "human",
"value": "from IPython.config.loader import Config\nfrom IPython.config.application import catch_config_error\nfrom IPython.utils.traitlets import Unicode\nfrom nbgrader.apps.customnbconvertapp import CustomN... | python | chosen |
[
{
"from": "system",
"value": "Add simple test case to test plug-in discovery\n\nThis just tests if can_read is callable for now, but at least the plug-in discovery in tests works. It doesn't work beautifully, but we can work from here.\n"
},
{
"from": "human",
"value": "#!/usr/bin/env python\n#-... | python | chosen |
[
{
"from": "system",
"value": "Remove extra double quote from docstring\n\nThe extra \" was visible on\n\n http://docs.openstack.org/developer/python-swiftclient/swiftclient.html\n\nChange-Id: I7d61c8259a4f13464c11ae7e3fa28eb3a58e4baa\n"
},
{
"from": "human",
"value": "# -*- encoding: utf-8 -*-\... | python | chosen |
[
{
"from": "system",
"value": "Allow widget overwriting on form field\n"
},
{
"from": "human",
"value": "from django import forms\nfrom django.db import models\n\nfrom .widgets import MarkdownTextarea\n\n\nclass MarkdownFormField(forms.fields.CharField):\n def __init__(self, *args, **kwargs):\... | python | chosen |
[
{
"from": "system",
"value": "Fix wrong config includes in kit package\n"
},
{
"from": "human",
"value": "\"\"\"Adhocracy extension.\"\"\"\nfrom pyramid.config import Configurator\n\nfrom adhocracy_core import root_factory\n\n\ndef includeme(config):\n \"\"\"Setup adhocracy extension.\n\n ... | python | chosen |
[
{
"from": "system",
"value": "Fix a Python lint error\n"
},
{
"from": "human",
"value": "# -*- encoding: utf-8\n\nimport pytest\n\nfrom reindex_shard_config import create_reindex_shard\n\n\n@pytest.mark.parametrize(\n 'source_name, source_id, expected_reindex_shard', [\n ('sierra', 'b00000... | python | chosen |
[
{
"from": "system",
"value": "Add method to escape special chars in Solr queries\n"
},
{
"from": "human",
"value": "from mysolr import Solr\n\nfrom magpie.settings import settings\n\n\n_solr = None\n\n\ndef open_solr_connection(core_name):\n global _solr\n if not _solr:\n url = '{}/... | python | chosen |
[
{
"from": "system",
"value": "Add handling of not present file.\n\nSigned-off-by: Matej Dujava <03ce64f61b3ea1fda633fb2a103b989e3272d16b@gmail.com>\n"
},
{
"from": "human",
"value": "import pickle\n\n\nclass PersonDb(object):\n def __init__(self, dbName, autoload = True):\n self.dbName... | python | chosen |
[
{
"from": "system",
"value": "Add a class to JSON encode a page object containing Haystack search results. Note: this is a stopgap measure and quite inefficient, since Haystack turns the Solr data into objects and this turns it back into JSON, but at least it's not specific to a search engine backend.\n"
... | python | chosen |
[
{
"from": "system",
"value": "objint_longlong: Add regression test for improper inplace op implementation.\n"
},
{
"from": "human",
"value": "# This tests long ints for 32-bit machine\n\na = 0x1ffffffff\nb = 0x100000000\nprint(a)\nprint(b)\nprint(a + b)\nprint(a - b)\nprint(b - a)\n# overflows l... | python | chosen |
[
{
"from": "system",
"value": "Make loop stopable, some fixes.\n"
},
{
"from": "human",
"value": "import time\n\n\nclass Application(object):\n def __init__(self, startup_args={}):\n self._state = None\n self._states = {}\n self._mspf = None # ms per frame\n\n @property... | python | chosen |
[
{
"from": "system",
"value": "DEBUG = True for the Testing env\n"
},
{
"from": "human",
"value": "# pylint: disable=C1001\nclass Config():\n CELERY_BROKER_URL = ''\n SQLALCHEMY_ECHO = False\n SECRET_KEY = ''\n TESTING = False\n DEBUG = False\n\n\nclass ConfigDevelopment(Config):\n... | python | chosen |
[
{
"from": "system",
"value": "Fix trn to phn script\n"
},
{
"from": "human",
"value": "#!/usr/bin/env python3\nimport os\n\nimport sys\n\ndef main(trn_file, phn_dir):\n phone_map = {v[0]: v[1].strip() for v in (l.split(None, 1) for l in open('data/phone_map', encoding='utf-8'))}\n\n for li... | python | chosen |
[
{
"from": "system",
"value": "Add test for extraction of dates from ObjectIds.\n"
},
{
"from": "human",
"value": "# encoding: utf-8\n\nfrom __future__ import unicode_literals\n\nfrom common import FieldExam\nfrom marrow.mongo.field import Date\n\n\nclass TestDateField(FieldExam):\n\t__field__ = ... | python | chosen |
[
{
"from": "system",
"value": "Hide pagewidgets away for now\n"
},
{
"from": "human",
"value": "from django.contrib import admin\nfrom samklang_pages.models import Page, PageWidget\nfrom samklang_pages.forms import PageForm\n\nclass PageWidgetInline(admin.TabularInline):\n model = PageWidget\n... | python | chosen |
[
{
"from": "system",
"value": "Set char primary key. Generate ID.\n"
},
{
"from": "human",
"value": "\nfrom django.conf import settings\nfrom django.db import models\nfrom django.utils import timezone\nfrom django.utils.translation import ugettext_lazy as _\n\nclass ModifiableModel(models.Model):... | python | chosen |
[
{
"from": "system",
"value": "Fix number of skipped tests when running pytest.\n"
},
{
"from": "human",
"value": "import os\nimport os.path\n\nfrom scripttest import TestFileEnvironment\n\n\ndef test_persists_data():\n env = TestFileEnvironment()\n # FIXME path to fridge script should be d... | python | chosen |
[
{
"from": "system",
"value": "Read the configuration file upon import\n"
},
{
"from": "human",
"value": "from vod_metadata.md5_checksum import *\nfrom vod_metadata.media_info import *\nfrom vod_metadata.parse_config import *\nfrom vod_metadata.VodPackage import *\n\n(extensions,\n MediaInfo_path... | python | chosen |
[
{
"from": "system",
"value": "[Telemetry] Remove custom destructor from AppBackend\n\nClosing the backend in the destructor is\n1) Redundant since the backend is being closed from Browser.close()\n2) Dangerous since it can happen at any moment due to garbage collection\nand cause deadlocks in tracing code (... | python | chosen |
[
{
"from": "system",
"value": "Update command line usage with scenario\n"
},
{
"from": "human",
"value": "import sys\n\nfrom scenario import run_scenario\n\ndef main(args=None):\n\n if args is None:\n args = sys.argv[1:]\n \n assert len(args) == 2, 'Usage: python -m foo <executabl... | python | chosen |
[
{
"from": "system",
"value": "Test of github push from Eclipse.\n"
},
{
"from": "human",
"value": "\"\"\"\nAcquisitionRecord: database interface class.\n\nThese classes provide an interface between the database and the top-level\ningest algorithm (AbstractIngester and its subclasses). They also ... | python | chosen |
[
{
"from": "system",
"value": "Fix minor typo in DownloaderHandlers comment\n"
},
{
"from": "human",
"value": "\"\"\"Download handlers for different schemes\"\"\"\n\nfrom twisted.internet import defer\nfrom scrapy.exceptions import NotSupported, NotConfigured\nfrom scrapy.utils.httpobj import url... | python | chosen |
[
{
"from": "system",
"value": "Fix test incompatibility with Python 3 versions\n\nReplaced 'print' instruction with call of a 'six' package's\nimplementation compatible with Python 2 as well as Python 3.\n"
},
{
"from": "human",
"value": "from docxtpl import DocxTemplate, RichText\nfrom jinja2.ex... | python | chosen |
[
{
"from": "system",
"value": "tests: Convert extension tests to pytest syntax\n"
},
{
"from": "human",
"value": "import unittest\n\nimport mock\n\nfrom mopidy_spotify import Extension, backend as backend_lib\n\n\nclass ExtensionTest(unittest.TestCase):\n\n def test_get_default_config(self):\n... | python | chosen |
[
{
"from": "system",
"value": "Add quiet mode support for Retry\n"
},
{
"from": "human",
"value": "import time\nfrom random import uniform\nfrom typing import Callable, Optional\n\n\nclass Retry:\n def __init__(self, total: int = 3, backoff_factor: float = 0.2, jitter: float = 0.2) -> None:\n ... | python | chosen |
[
{
"from": "system",
"value": "Add get dice roll function\n"
},
{
"from": "human",
"value": "import random\nclass Die(object):\n def __init__(self, sides = 6):\n self.sides = sides\n self.held = False\n self.die_face = 1\n def change_held(self, held):\n self.held... | python | chosen |
[
{
"from": "system",
"value": "Remove version check in favor of import error check\n"
},
{
"from": "human",
"value": "# coding=utf-8\nimport six\nimport django\nfrom django.db import models\n\ntry:\n from django.urls import reverse\nexcept ImportError:\n from django.core.urlresolvers import... | python | chosen |
[
{
"from": "system",
"value": "Call global name in getservicesoffline function"
},
{
"from": "human",
"value": "import os\nimport json\nimport ast\nfrom functions import quit\nfrom encryption import encrypt, decrypt\n\nglobal name\nglobal key\ndef setOfflineUsername(_name, _key):\n global name... | python | chosen |
[
{
"from": "system",
"value": "Print statements added for profiling\n"
},
{
"from": "human",
"value": "#!/usr/bin/env python\n\"\"\"\nCreated on Fri Mar 14 15:25:36 2014\n\n@author: ibackus\n\"\"\"\n\nimport matplotlib.pyplot as plt\nimport numpy as np\nimport datetime\nimport sys\n\nif len(sys.a... | python | chosen |
[
{
"from": "system",
"value": "Make sure that the county is in the right state even.\n\n"
},
{
"from": "human",
"value": "\nfrom pyIEM import iemdb\nimport re\ni = iemdb.iemdb()\nmydb = i[\"mesosite\"]\n\nrs = mydb.query(\"select s.id, c.name from stations s, counties c WHERE \\\n s.geom && c.th... | python | chosen |
[
{
"from": "system",
"value": "Add test case setUp to generate fake patient info\n"
},
{
"from": "human",
"value": "#!/usr/bin/env python\n# -*- coding: utf-8 -*-\n\n\"\"\"\ntest_ehrcorral\n----------------------------------\n\nTests for `ehrcorral` module.\n\"\"\"\n\nimport unittest\n\nfrom ehrc... | python | chosen |
[
{
"from": "system",
"value": "Redefine function __lt__ and define a function to set link with others.\n"
},
{
"from": "human",
"value": "class Box:\n def __init__(self, length, width, height):\n self.length = length\n self.width = width\n self.height = height\n sel... | python | chosen |
[
{
"from": "system",
"value": "Remove unused json import in api wrapper\n"
},
{
"from": "human",
"value": "import json\nimport os\n\nimport requests\n\n\nclass APIWrapper(object):\n\n def __init__(self, base_url=None, auth_token=None):\n\n if base_url:\n self.base_url = base_... | python | chosen |
[
{
"from": "system",
"value": "Send repo id in get param\n"
},
{
"from": "human",
"value": "from flask import Flask\nimport subprocess\nfrom config import repos\n\napp = Flask(__name__)\n\n@app.route(\"/\", methods=['GET'])\ndef hello():\n current_repo = repos.get('key')\n remote_name = cur... | python | chosen |
[
{
"from": "system",
"value": "Support IPv6 in random ip\n"
},
{
"from": "human",
"value": "#!/usr/bin/env python\n# -*- coding: utf-8 -*-\n\nfrom random import randint\n\nfrom flask import Flask, request, render_template, url_for, redirect\nfrom pyhipku import encode\n\n\napp = Flask(__name__)\n... | python | chosen |
[
{
"from": "system",
"value": "Add link to foaas profile\n"
},
{
"from": "human",
"value": "#! /usr/bin/env python\n\nfrom time import gmtime, strftime\nfrom foaas import foaas\nfrom diaspy_client import Client\n\nimport re\nimport urllib2\n\nclient = Client()\nnotify = client.notifications()\nfo... | python | chosen |
[
{
"from": "system",
"value": "Debug any incoming POST request.\n"
},
{
"from": "human",
"value": "import tornado.httpserver\nimport tornado.ioloop\nimport tornado.web\n\nfrom tornado.options import define, options\n\nfrom settings import *\n\n\nclass MainHandler(tornado.web.RequestHandler):\n ... | python | chosen |
[
{
"from": "system",
"value": "Add API versioning at the url\n\nhttps://github.com/AudioCommons/ac-mediator/issues/13\n"
},
{
"from": "human",
"value": "from django.conf.urls import include, url\nfrom api import views\n\nurlpatterns = [\n url(r'^services/$', views.services, name='api-services'... | python | chosen |
[
{
"from": "system",
"value": "Test vector, passes matrix and vector input.\n"
},
{
"from": "human",
"value": "#pylint: disable=W0104,W0108\nimport pytest\nimport pyop\n\nimport numpy as np\n\n\n#######################################################################\n# ... | python | chosen |
[
{
"from": "system",
"value": "Update test to match last changes in the API\n"
},
{
"from": "human",
"value": "# -*- coding: utf-8 -*-\nfrom __future__ import absolute_import, division, print_function, unicode_literals\n\nfrom mock import Mock\nfrom nose.tools import eq_\n\nfrom cg.context import... | python | chosen |
[
{
"from": "system",
"value": "Add test for fetching local package sources\n"
},
{
"from": "human",
"value": "import os\nimport subprocess\n\nfrom nose.tools import istest, assert_equal\n\nfrom whack.sources import PackageSourceFetcher\nfrom whack.tempdir import create_temporary_dir\nfrom whack.f... | python | chosen |
[
{
"from": "system",
"value": "Test the doc comments in the expressions module.\n"
},
{
"from": "human",
"value": "'''Search all our doc comments for \"Example\" blocks and try executing them.'''\nimport re\nimport sourcer\n\n\ndef run_examples(package):\n pattern = re.compile(r'''\n (\... | python | chosen |
[
{
"from": "system",
"value": "Add test for invalid 'convention' in hamilton method\n"
},
{
"from": "human",
"value": "#!/usr/bin/env python\n# -*- coding: utf-8 -*-\n\"\"\"Tests for the Hamiltonian method.\"\"\"\n\nimport pytest\nfrom numpy.testing import assert_allclose\n\nfrom parameters impor... | python | chosen |
[
{
"from": "system",
"value": "TST: Use matplotlib image_comparison to actually compare plot output\n"
},
{
"from": "human",
"value": "from contextlib import contextmanager\nimport os\nimport tempfile\nimport unittest\n\nfrom matplotlib.pyplot import Artist, savefig\nfrom shapely.geometry import ... | python | chosen |
[
{
"from": "system",
"value": "Upgrade to OpenSSL 1.0.1g to avoid heartbleed bug\n"
},
{
"from": "human",
"value": "import winbrew\n\nclass Openssl(winbrew.Formula):\n url = 'http://www.openssl.org/source/openssl-1.0.1f.tar.gz'\n homepage = 'http://www.openssl.org'\n sha1 = ''\n build... | python | chosen |
[
{
"from": "system",
"value": "Remove unused ability to use custom newrelic.ini\n"
},
{
"from": "human",
"value": "# flake8: noqa\n# newrelic import & initialization must come first\n# https://docs.newrelic.com/docs/agents/python-agent/installation/python-agent-advanced-integration#manual-integra... | python | chosen |
[
{
"from": "system",
"value": "Mark compatibility table test as slow (temporary)\n\nPrevent Travis from running test test until models repo is published\n"
},
{
"from": "human",
"value": "# coding: utf-8\nfrom __future__ import unicode_literals\n\nfrom ..download import download, get_compatibilit... | python | chosen |
[
{
"from": "system",
"value": "Add a test for get_available_markups() function\n"
},
{
"from": "human",
"value": "# This file is part of python-markups test suite\n# License: BSD\n# Copyright: (C) Dmitry Shachnev, 2012-2015\n\nimport markups\nimport unittest\n\nclass APITest(unittest.TestCase):\n... | python | chosen |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.