conversations listlengths 2 3 | source stringclasses 1
value | stack stringclasses 1
value |
|---|---|---|
[
{
"from": "system",
"value": "Fix test case for https redirects\n"
},
{
"from": "human",
"value": "from starlette.applications import Starlette\nfrom starlette.middleware.httpsredirect import HTTPSRedirectMiddleware\nfrom starlette.responses import PlainTextResponse\nfrom starlette.testclient im... | python | chosen |
[
{
"from": "system",
"value": "Add stub for inactive project test\n"
},
{
"from": "human",
"value": "\"\"\"\nTests for inactive projects.\n\"\"\"\n"
},
{
"from": "gpt",
"value": "\"\"\"\nTests for inactive projects.\n\"\"\"\n\nimport pytest\n\nfrom tests.utils import VuforiaServerCred... | python | chosen |
[
{
"from": "system",
"value": "shipit_code_coverage: Compress data sent to Coveralls using gzip\n"
},
{
"from": "human",
"value": "import requests\n\n\ndef upload(data):\n r = requests.post('https://coveralls.io/api/v1/jobs', files={\n 'json_file': data\n })\n\n try:\n prin... | python | chosen |
[
{
"from": "system",
"value": "Add a ruleset module TODO\n"
},
{
"from": "human",
"value": "\"\"\"A module containg a core representation of IATI Rulesets.\"\"\"\n\n\nclass Ruleset(object):\n \"\"\"Representation of a Ruleset as defined within the IATI SSOT.\"\"\"\n\n pass\n\n\nclass Rule(o... | python | chosen |
[
{
"from": "system",
"value": "Add errer handling for python code\n"
},
{
"from": "human",
"value": "#!/usr/bin/env python\n# coding UTF-8\n\nimport yaml\n\nimport rospy\nfrom goal_sender_msgs.srv import ApplyGoals\nfrom goal_sender_msgs.msg import GoalSequence\nfrom goal_sender_msgs.msg import W... | python | chosen |
[
{
"from": "system",
"value": "Update the bits package to use new imports\n"
},
{
"from": "human",
"value": "from steel.common import Remainder\r\nfrom steel.common.fields import *\r\n\r\nfrom steel.byte.base import *\r\nfrom steel.fields import *\r\n"
},
{
"from": "gpt",
"value": "fr... | python | chosen |
[
{
"from": "system",
"value": "Add support for imhotep to pass a list of filenames.\n"
},
{
"from": "human",
"value": "from imhotep.tools import Tool\nfrom collections import defaultdict\nimport re\n\n\nclass JSL(Tool):\n regex = re.compile(\n r'^(?P<type>[WE]) '\n r'(?P<filename... | python | chosen |
[
{
"from": "system",
"value": "Use '_' prefix instead of disabling pylint unused-argument lint\n\nIt is more precise to mark the unused parameters this way.\n\nSigned-off-by: mulhern <7b51bcf507bcd7afb72bf8663752c0ddbeb517f6@redhat.com>\n"
},
{
"from": "human",
"value": "# Copyright 2016 Red Hat,... | python | chosen |
[
{
"from": "system",
"value": "kompomaatti: Update tags to use new template subdirectory.\n"
},
{
"from": "human",
"value": "# -*- coding: utf-8 -*-\n\nfrom django import template\nfrom Instanssi.kompomaatti.models import Compo, Competition\n\nregister = template.Library()\n\n@register.inclusion_... | python | chosen |
[
{
"from": "system",
"value": "Test Affine init calls hooks correctly, and sets descriptors\n"
},
{
"from": "human",
"value": "# encoding: utf8\nfrom __future__ import unicode_literals\nimport pytest\nfrom flexmock import flexmock\nfrom hypothesis import given, strategies\nimport abc\n\nfrom ....... | python | chosen |
[
{
"from": "system",
"value": "Update script with latest fields\n"
},
{
"from": "human",
"value": "from collections import defaultdict\nimport json\nimport sys \n\nfrom base_edx import EdXConnection\nfrom generate_csv_report import CSV \n\ndb_name = sys.argv[1]\n\n# Change name of collection as r... | python | chosen |
[
{
"from": "system",
"value": "Remove replace urlpatterns with simple array, make compatible with Django 1.9\n"
},
{
"from": "human",
"value": "try:\n from django.conf.urls import patterns, url\nexcept ImportError:\n # Django < 1.4\n from django.conf.urls.defaults import patterns, url\n\... | python | chosen |
[
{
"from": "system",
"value": "Update Mobile Oxford views to reflect use of app framework in\nmolly.maps.\n"
},
{
"from": "human",
"value": "from django.conf.urls.defaults import *\nfrom django.conf import settings\nfrom django.contrib import admin\n\nfrom molly.conf import applications\n\nadmin.... | python | chosen |
[
{
"from": "system",
"value": "Update : protect cli quoted arguments while parsing\n"
},
{
"from": "human",
"value": "# -*- coding: utf-8 -*-\n\n# Copyright (c) 2012 theo crevon\n#\n# See the file LICENSE for copying permission.\n\nfrom clint.textui import puts, colored\n\nfrom elevator.utils.pat... | python | chosen |
[
{
"from": "system",
"value": "Add basic support for inspecting the body of SLDs\n"
},
{
"from": "human",
"value": "from geoserver.support import ResourceInfo, atom_link\n\nclass Style(ResourceInfo):\n def __init__(self,catalog, node):\n self.catalog = catalog\n self.name = node.find(\"nam... | python | chosen |
[
{
"from": "system",
"value": "Allow admin preview in minutes as well\n"
},
{
"from": "human",
"value": "from django.forms import ModelForm, Textarea, ChoiceField\nfrom django.utils.functional import lazy\n\nfrom .models import Meeting, Folder\n\nMD_INPUT = {\n 'class': 'markdown-input'\n}\n\n... | python | chosen |
[
{
"from": "system",
"value": "Save coverage data file to disk for Coveralls.\n"
},
{
"from": "human",
"value": "from coverage import coverage\n\ncov = coverage(source=('doubles',))\ncov.start()\n\nfrom doubles.pytest import pytest_runtest_call # noqa\n\n\ndef pytest_sessionfinish(session, exits... | python | chosen |
[
{
"from": "system",
"value": "Add choices_map and units_map global variables\n"
},
{
"from": "human",
"value": "def get_dtype(parameter_value):\n \"\"\"Get the TopoFlow data type of a parameter.\n\n Parameters\n ----------\n parameter_value : object\n An object, a scalar.\n\n ... | python | chosen |
[
{
"from": "system",
"value": "Use LocMemCache instead of real memcache\n"
},
{
"from": "human",
"value": "DATABASES = {'default':{\n 'NAME':':memory:',\n 'ENGINE':'django.db.backends.sqlite3'\n}}\n\n# install the bare minimum for\n# testing django-brake\nINSTALLED_APPS = (\n 'django.con... | python | chosen |
[
{
"from": "system",
"value": "Update head revision to 0.9.9\n"
},
{
"from": "human",
"value": "version='0.9.7'\n\nimport os\nsvn_version_file = os.path.join(os.path.dirname(__file__),\n 'core','__svn_version__.py')\nif os.path.isfile(svn_version_file):\n import ... | python | chosen |
[
{
"from": "system",
"value": "Disable warning for unused feature\n"
},
{
"from": "human",
"value": "# -*- coding: utf-8 -*-\n\nimport os\nimport unittest\nfrom flask import Flask\nfrom coaster.utils import buid\nfrom coaster.sqlalchemy import BaseMixin\nfrom nodular.db import db\n\n\nclass User(... | python | chosen |
[
{
"from": "system",
"value": "Fix login permissions for ticketing\n"
},
{
"from": "human",
"value": "from django.conf.urls.defaults import patterns, url\n\nfrom oscar.core.application import Application\n\nfrom ticketing import views\n\n\nclass TicketingApplication(Application):\n name = 'tic... | python | chosen |
[
{
"from": "system",
"value": "Make sure AuthenticationMiddleware is defined in settings\nduring tests.\n"
},
{
"from": "human",
"value": "import os\n\nROOT_URLCONF = 'tests.urls'\nINSTALLED_APPS = [\n 'django.contrib.auth',\n 'django.contrib.contenttypes',\n 'django.contrib.sessions',\n... | python | chosen |
[
{
"from": "system",
"value": "Add UTF8 compatibility switch for py2.\n"
},
{
"from": "human",
"value": "import unittest\n\nfrom s2f.Sanitize import (\n sanitize_prefix,\n sanitize_for_latex\n)\n\nclass TestSanitize(unittest.TestCase):\n \"\"\" Test case for the Sanitize module \"\"\"\n ... | python | chosen |
[
{
"from": "system",
"value": "Patch init import to allow for local dev of UMAP code\n"
},
{
"from": "human",
"value": "from .umap_ import UMAP\n\n# Workaround: https://github.com/numba/numba/issues/3341\nimport numba\n\nimport pkg_resources\n\n__version__ = pkg_resources.get_distribution(\"umap-... | python | chosen |
[
{
"from": "system",
"value": "Add additional tests for count_cycles\n"
},
{
"from": "human",
"value": "import unittest, rainflow\r\n\r\nclass TestRainflowCounting(unittest.TestCase):\r\n series = [0, -2, 1, -3, 5, -1, 3, -4, 4, -2, 0]\r\n cycles = [(3, 0.5), (4, 1.5), (6, 0.5), (8, 1.0), (... | python | chosen |
[
{
"from": "system",
"value": "Remove test setting that’s no longer necessary\n"
},
{
"from": "human",
"value": "DEBUG = True\nTEMPLATE_DEBUG = DEBUG\n\nSECRET_KEY = 'fake_secret'\n\nROOT_URLCONF = 'tests.test_urls'\n\nDATABASES = {\n 'default': {\n 'ENGINE': 'django.db.backends.sqlite3... | python | chosen |
[
{
"from": "system",
"value": "Fix whitespace issue in matrix assertion\n"
},
{
"from": "human",
"value": "import unittest\n\nfrom matrix import Matrix\n\n\nclass MatrixTest(unittest.TestCase):\n def test_extract_a_row(self):\n matrix = Matrix(\"1 2\\n10 20\")\n self.assertEqual(... | python | chosen |
[
{
"from": "system",
"value": "[tasks] Allow to modify the is_default flag\n"
},
{
"from": "human",
"value": "from zou.app.models.task_status import TaskStatus\nfrom zou.app.services import tasks_service\nfrom .base import BaseModelResource, BaseModelsResource\n\n\nclass TaskStatusesResource(Base... | python | chosen |
[
{
"from": "system",
"value": "Stop catching import errors to improve stack trace readability\n"
},
{
"from": "human",
"value": "import renpy\nimport os\nimport sys\nimport modinfo\nimport importlib\n\nprint('AWSW Mod Loader Init')\n\ndef get_mod_path():\n \"\"\"Get the mod path\n\n Returns... | python | chosen |
[
{
"from": "system",
"value": "Stop confirming ETA is 10 seconds ago, as it's possible that AutoFleetCharge\ninterrupt within that duration.\n"
},
{
"from": "human",
"value": "#!/usr/bin/env python\n\nimport logging\nimport time\n\nimport base\nfrom kcaa import screens\n\n\nlogger = logging.getLo... | python | chosen |
[
{
"from": "system",
"value": "Edit test method 'test_config_file' to check configuration network interface\n"
},
{
"from": "human",
"value": "import os\n\nimport testinfra.utils.ansible_runner\n\ntestinfra_hosts = testinfra.utils.ansible_runner.AnsibleRunner(\n os.environ['MOLECULE_INVENTORY_... | python | chosen |
[
{
"from": "system",
"value": "DOC: Standardize bar chat with labels example to use source consistent with other examples"
},
{
"from": "human",
"value": "\"\"\"\nSimple Bar Chart with Labels\n============================\nThis example shows a basic horizontal bar chart with labels created with A... | python | chosen |
[
{
"from": "system",
"value": "Allow multiple batch files for seg pipeline json\n"
},
{
"from": "human",
"value": "import json\nimport itertools as it\n\nall_sizes = [0.7, 1.0, 1.6, 3.5, 5.0]\nall_types = ['Color', 'Texture', 'Edge', 'Orientation']\n\nfull_feature_set = list(it.product(all_types,... | python | chosen |
[
{
"from": "system",
"value": "Verify rambar can do unicode\n"
},
{
"from": "human",
"value": "import os\nimport sys\n\nfrom px import px_rambar\nfrom px import px_terminal\n\n\ndef test_render_bar_happy_path():\n names_and_numbers = [(u\"apa\", 1000), (u\"bepa\", 300), (u\"cepa\", 50)] + [\n ... | python | chosen |
[
{
"from": "system",
"value": "Check forms on validator page\n\nAdd a test to check that each of the three forms exist on the\nvalidator page.\nThis test does not check whether the three forms work correctly.\n"
},
{
"from": "human",
"value": "import pytest\nfrom web_test_base import *\n\nclass T... | python | chosen |
[
{
"from": "system",
"value": "Remove south from app helper method for Django 1.7+\n"
},
{
"from": "human",
"value": "from __future__ import absolute_import\n\nimport os\n\n__version__ = VERSION = \"0.3.0\"\n\n\ndef get_fancypages_paths(path, use_with_oscar=False):\n \"\"\" Get absolute paths ... | python | chosen |
[
{
"from": "system",
"value": "Change the background to reflect the color chosen"
},
{
"from": "human",
"value": "from django import forms\nfrom django.conf import settings\nfrom django.utils.safestring import mark_safe\n\n\nclass ColorPickerWidget(forms.TextInput):\n class Media:\n css... | python | chosen |
[
{
"from": "system",
"value": "Add some tests for new decimal() params\n"
},
{
"from": "human",
"value": "from rich import filesize\n\n\ndef test_traditional():\n assert filesize.decimal(0) == \"0 bytes\"\n assert filesize.decimal(1) == \"1 byte\"\n assert filesize.decimal(2) == \"2 byte... | python | chosen |
[
{
"from": "system",
"value": "Fix a bug in unicode encoding of reprs.\n\nThe previous implementation could lead to double-decoding:\n >>> from parsimonious.utils import Token\n >>> repr(Token('asdf'))\n '<Token \"asdf\">'\n >>> repr(Token(u'💣'))\n Traceback (most recent call last):\n Fi... | python | chosen |
[
{
"from": "system",
"value": "Fix error in docstring example.\n"
},
{
"from": "human",
"value": "__all__ = (\n 'Category',\n)\n\n\nclass Category(tuple):\n \"\"\"\n This type acts as tuple with one key difference - two instances of it are\n equal only when they have the same type. Th... | python | chosen |
[
{
"from": "system",
"value": "Increase re-running limit of test_profiler\n"
},
{
"from": "human",
"value": "# -*- coding: utf-8 -*-\nfrom __future__ import division\nimport sys\n\nimport pytest\n\nfrom profiling.sampling import SamplingProfiler\nfrom profiling.sampling.samplers import ItimerSamp... | python | chosen |
[
{
"from": "system",
"value": "Use ValidationError rather than ValueError\n"
},
{
"from": "human",
"value": "\"\"\" MongoHN.forms - WTForms used by MongoHN \"\"\"\n\nfrom MongoHN.models import User\nfrom flask.ext.wtf import Form\nfrom wtforms import SubmitField, TextField, BooleanField, Password... | python | chosen |
[
{
"from": "system",
"value": "Fix some issues, because of models change\n"
},
{
"from": "human",
"value": "# coding: utf-8\nfrom django.contrib import admin\nfrom .models import Report\n\nclass ReportAdmin(admin.ModelAdmin):\n list_display = ('addressed_to', 'reported_from', 'content', 'signe... | python | chosen |
[
{
"from": "system",
"value": "Remove groups attribute from DomainInterface\n"
},
{
"from": "human",
"value": "# third party\nfrom pydantic import BaseSettings\n\n# relative\nfrom ...adp.adversarial_accountant import AdversarialAccountant\nfrom ..abstract.node_service_interface import NodeService... | python | chosen |
[
{
"from": "system",
"value": "Select features using classification model\n"
},
{
"from": "human",
"value": "import pandas as pd\nfrom sklearn.feature_selection import SelectKBest, f_classif\n\ndef select_kbest_clf(data_frame, target, k=4):\n \"\"\"\n Selecting K-Best features for classific... | python | chosen |
[
{
"from": "system",
"value": "Change sniffing to be more robust\n\nKnown bugs: Will update playing.txt when someone tries to use the speakers\nif already in use. Saving grace is it'll change to the right person a second later.\n"
},
{
"from": "human",
"value": "#!/usr/bin/env python2\nfrom scapy... | python | chosen |
[
{
"from": "system",
"value": "Fix typo is -> as\n"
},
{
"from": "human",
"value": "#!/usr/bin/env python\n\nimport os\nimport sys\nimport subprocess\nfrom importlib import import_module\n\n\nif __name__ == '__main__':\n # Test using django.test.runner.DiscoverRunner\n os.environ['DJANGO_SE... | python | chosen |
[
{
"from": "system",
"value": "Add maxlength to argument form title and abstract\n"
},
{
"from": "human",
"value": "from colander import Length\nfrom deform import Form\nfrom deform.widget import TextAreaWidget\nfrom ekklesia_portal.helper.contract import Schema, string_property\nfrom ekklesia_po... | python | chosen |
[
{
"from": "system",
"value": "[IMP] Add warehouse_id to existing onchange.\n"
},
{
"from": "human",
"value": "# Copyright (c) 2019 Open Source Integrators\n# License LGPL-3.0 or later (https://www.gnu.org/licenses/lgpl.html).\n\nfrom odoo import api, fields, models\n\n\nclass StockRequestOrder(m... | python | chosen |
[
{
"from": "system",
"value": "Remove RoleArn from Events::Rule and add to Target property\n"
},
{
"from": "human",
"value": "# Copyright (c) 2013, Mark Peek <mark@peek.org>\n# All rights reserved.\n#\n# See LICENSE file for full license.\n\nfrom . import AWSObject, AWSProperty\n\n\nclass Target(... | python | chosen |
[
{
"from": "system",
"value": "Test time related stats from current view\n"
},
{
"from": "human",
"value": "import os\n\nfrom tests.integrations.base import BaseTest\n\n\nclass TestReadCurrentView(BaseTest):\n def test_listdirs(self):\n dirs = set(os.listdir(\"%s/current\" % self.mount_... | python | chosen |
[
{
"from": "system",
"value": "Test to check cfg duplicate in local cfg.\n\nIf the factory config fail, the default is to fail safe searching to\na local cfg file, what could hide problems with the builtin cfg file.\n"
},
{
"from": "human",
"value": "#!/usr/bin/env python\n# -*- coding: utf-8 -*-... | python | chosen |
[
{
"from": "system",
"value": "Add rep and sen from address fields to Preferences model\n"
},
{
"from": "human",
"value": "import uuid\nfrom django.db import models\nfrom django.contrib.auth.models import User\nfrom opencivicdata.models.people_orgs import Person\n\n\nclass Preferences(models.Mode... | python | chosen |
[
{
"from": "system",
"value": "Refactor settings tests to use global fixture\n"
},
{
"from": "human",
"value": "import pytest\nimport npc\nimport os\nfrom tests.util import fixture_dir\n\n@pytest.fixture\ndef settings():\n return npc.settings.Settings()\n\ndef test_creation(settings):\n ass... | python | chosen |
[
{
"from": "system",
"value": "Add random and session_id fields.\n"
},
{
"from": "human",
"value": "import construct\n\nfrom tlsenum import hello_constructs\n\n\nclass ClientHello(object):\n\n @property\n def protocol_version(self):\n return self._protocol_version\n\n @protocol_ve... | python | chosen |
[
{
"from": "system",
"value": "Fix format issue with `__repr__`\n"
},
{
"from": "human",
"value": "import enum\n\nfrom sqlalchemy import Column, String, Boolean, Integer, DateTime, Enum\n\nfrom virtool.postgres import Base\n\n\nclass UploadType(str, enum.Enum):\n hmm = \"hmm\"\n reference =... | python | chosen |
[
{
"from": "system",
"value": "Make the Sifter issue matching more specific.\n\nNow it matches:\r\n\r\n* 3-5 digit numbers\r\n* Preceded by a #, whitespace, or beginning-of-line.\r\n* Followed by a comma, period, question mark, exclamation point,\r\n whitespace, or end-of-line."
},
{
"from": "human"... | python | chosen |
[
{
"from": "system",
"value": "Make compatible with CentOS 8\n"
},
{
"from": "human",
"value": "#!/usr/bin/python3\nimport re\nimport sys\nimport xml.etree.ElementTree as ET\n\nvalid_gnd = re.compile('[0-9\\-X]+')\n\ndef Main():\n if len(sys.argv) != 2:\n print(\"Usage: \" + sys.argv[0]... | python | chosen |
[
{
"from": "system",
"value": "Change ambigous variable name to be more clear what it is\n"
},
{
"from": "human",
"value": "# -*- coding: utf-8 -*-\n\n\"\"\" pykwalify \"\"\"\n\n# python stdlib\nimport logging\nimport logging.config\nimport os\n\n__author__ = 'Grokzen <Grokzen@gmail.com>'\n__vers... | python | chosen |
[
{
"from": "system",
"value": "Add regression tests for LP:744922\n\n"
},
{
"from": "human",
"value": "\"\"\"\nTest for the SoftwarePackage model\n\"\"\"\n\nfrom django.db import IntegrityError\nfrom django.test import TestCase\n\nfrom dashboard_app.models import SoftwarePackage\nfrom launch_cont... | python | chosen |
[
{
"from": "system",
"value": "Make sure slugs are unique and not integer only.\n\nThis fixes issues #1, #2 & #5\n"
},
{
"from": "human",
"value": "from django.db import models\n\n# Represents a category which articles can be part of\nclass Category(models.Model):\n name = models.CharField(max... | python | chosen |
[
{
"from": "system",
"value": "Reduce complexity and try/catch block in Logger\n"
},
{
"from": "human",
"value": "# -*- coding: utf-8 -*-\n\nimport os\nimport logging\nimport threading\n\n\nclass Logger(object):\n def configure_logging(self):\n log_level = getattr(logging, os.environ.g... | python | chosen |
[
{
"from": "system",
"value": "Fix the error that X is required for plotting\n\nThis enables money-monkey in server environment\n"
},
{
"from": "human",
"value": "import matplotlib.pyplot as plt\nfrom matplotlib.dates import DateFormatter\nfrom matplotlib.ticker import FormatStrFormatter\nfrom te... | python | chosen |
[
{
"from": "system",
"value": "Change behavior of removing an external account to persist the object\n"
},
{
"from": "human",
"value": "import httplib as http\n\nfrom flask import redirect\n\nfrom framework.auth.decorators import must_be_logged_in\nfrom framework.exceptions import HTTPError\nfrom... | python | chosen |
[
{
"from": "system",
"value": "Add format_price and format_datetime to jinja context.\n"
},
{
"from": "human",
"value": "from flask import Blueprint\n\nbp = Blueprint('admin', __name__)\n\nfrom wuvt.admin import views\n"
},
{
"from": "gpt",
"value": "from flask import Blueprint\n\nbp ... | python | chosen |
[
{
"from": "system",
"value": "Make bgl the default OpenGL implementation snice it is currently faster than PyOpenGL.\n"
},
{
"from": "human",
"value": "# This file handles differences between BGL and PyOpenGL, and provides various\n# utility functions for OpenGL\n\ntry:\n\tfrom OpenGL.GL import ... | python | chosen |
[
{
"from": "system",
"value": "test: Add amd64 architecture alias for x86_64\n\n64-bit x86 is called amd64 on FreeBSD.\n\n\ngit-svn-id: 4c4cc70b1ef44ba2b7963015e681894188cea27e@234164 91177308-0d34-0410-b5e6-96231b3b80d8\n"
},
{
"from": "human",
"value": "\"\"\" This module contains functions use... | python | chosen |
[
{
"from": "system",
"value": "Add comment clarifying how it operates."
},
{
"from": "human",
"value": "import string\ndef untokenize(tokens):\n\treturn \"\".join([\" \"+i if not i.startswith(\"'\") and i not in string.punctuation else i for i in tokens]).strip()\n"
},
{
"from": "gpt",
... | python | chosen |
[
{
"from": "system",
"value": "Add get and post functionality to the auth user stuff.\n"
},
{
"from": "human",
"value": "from django.conf.urls import patterns, include, url\nfrom django.contrib import admin\n\nfrom accounts import views as views\n\nadmin.autodiscover()\n\nurlpatterns = patterns('... | python | chosen |
[
{
"from": "system",
"value": "Use the default buffer instead of current_buffer.\n"
},
{
"from": "human",
"value": "from prompt_toolkit.layout.toolbars import Toolbar\nfrom prompt_toolkit.layout.utils import TokenList\nfrom pygments.token import Token\n\nclass PGToolbar(Toolbar):\n def __init_... | python | chosen |
[
{
"from": "system",
"value": "Add info for mandelbrot set\n"
},
{
"from": "human",
"value": "#!/usr/local/bin/python3\n# Python Challenge - 31\n# http://www.pythonchallenge.com/pc/ring/grandpa.html\n# http://www.pythonchallenge.com/pc/rock/grandpa.html\n# Username: repeat; Password: switch\n# Ke... | python | chosen |
[
{
"from": "system",
"value": "Add account adapter for allauth\n"
},
{
"from": "human",
"value": "from allauth.socialaccount import providers\nfrom allauth.socialaccount.providers.base import ProviderAccount\nfrom allauth.socialaccount.providers.oauth2.provider import OAuth2Provider\n\n\nclass He... | python | chosen |
[
{
"from": "system",
"value": "Remove attribute from domain and get from entity\n"
},
{
"from": "human",
"value": "from infosystem.database import db\nfrom infosystem.common.subsystem import entity\n\n\nclass Domain(entity.Entity, db.Model):\n\n attributes = ['active', 'name', 'parent_id']\n ... | python | chosen |
[
{
"from": "system",
"value": "TEST : gestion des exceptions de type FileNotFoundError lors de l'import des commandes d'un module\n"
},
{
"from": "human",
"value": "import os\nimport sys\n\nfrom geonature.core.command.main import main\nimport geonature.core.command.create_gn_module\n\n\n# Load mo... | python | chosen |
[
{
"from": "system",
"value": "Test database creator using syncdb instead of South\n"
},
{
"from": "human",
"value": "# coding: utf-8\n\nfrom .local import *\n\nDATABASES = {\n 'default': {\n 'ENGINE': 'django.db.backends.sqlite3',\n 'NAME': ':memory:',\n 'USER': '',\n ... | python | chosen |
[
{
"from": "system",
"value": "Fix build issue on OSX.\n\nOur script assumes the quest directory only has subdirectories of quests\nbut OSX adds DS_STORE files to each directory and these were being\npicked up and causing the assemble quests script to fail.\n"
},
{
"from": "human",
"value": "\"\"... | python | chosen |
[
{
"from": "system",
"value": "Remove some print lines from the fake server.\n"
},
{
"from": "human",
"value": "import os\nimport SimpleHTTPServer\n\n\nclass GitHubHandler(SimpleHTTPServer.SimpleHTTPRequestHandler):\n \"\"\"\n Overrides the default request handler to handle GitHub custom 40... | python | chosen |
[
{
"from": "system",
"value": "Remove the SSL default since it requires certs\n"
},
{
"from": "human",
"value": "import yaml\n\n_defaults = {\n \"bind_client\": [ \"tcp:6667:interface={::}\", \"ssl:6697:interface={::}\" ],\n \"bind_server\": []\n}\n\nclass Config(object):\n def __init__(... | python | chosen |
[
{
"from": "system",
"value": "Fix map object not subscriptable in cantera_version\n"
},
{
"from": "human",
"value": "\"\"\"\nConstants used in UConnRCMPy.\n\"\"\"\nimport cantera\n\none_atm_in_torr = 760.0\n\"\"\"Conversion between atmosphere and Torr.\"\"\"\none_atm_in_bar = 1.01325\n\"\"\"Conv... | python | chosen |
[
{
"from": "system",
"value": "Define a query on Dataset to retrive them by remote id\n"
},
{
"from": "human",
"value": "import json\nfrom flaskext.mongoalchemy import MongoAlchemy\nimport requests\n\nfrom api import app\nfrom api import db\n\n\nENDPOINT = 'http://data.nasa.gov/api/'\n\nclass Dat... | python | chosen |
[
{
"from": "system",
"value": "Use finally so connection is also closed on exception.\n"
},
{
"from": "human",
"value": "# encoding: utf-8\nfrom st2actions.runners.pythonrunner import Action\nfrom clicrud.device.generic import generic\nimport sys\n\n\nclass ConfigCommand(Action):\n\n def run(s... | python | chosen |
[
{
"from": "system",
"value": "Add `id` to `SystemHealthEndpoint` response.\n"
},
{
"from": "human",
"value": "from __future__ import absolute_import\n\nimport itertools\n\nfrom rest_framework.response import Response\n\nfrom sentry import status_checks\nfrom sentry.api.base import Endpoint\nfrom... | python | chosen |
[
{
"from": "human",
"value": "Create some more nice figures\n"
},
{
"from": "gpt",
"value": "\"\"\"\n Create nice looking publication figures\n\"\"\"\n\nimport numpy as np\nimport networkx as nx\n\nimport seaborn as sns\nimport matplotlib as mpl\nimport matplotlib.pylab as plt\n\nfrom tqdm import... | python | chosen |
[
{
"from": "system",
"value": "Move h5py import into HDF test."
},
{
"from": "human",
"value": "import tempfile\nimport h5py\nfrom numpy.testing import assert_allclose\nfrom os import path\nfrom distarray.local import LocalArray, save, load, save_hdf5\nfrom distarray.testing import comm_null_pass... | python | chosen |
[
{
"from": "system",
"value": "Fix ordering of latest models on the leader board.\n"
},
{
"from": "human",
"value": "import glob\nimport numpy as np\nimport pandas as pd\n\ndef load_df(file_name):\n model_id = file_name.split('/')[4]\n df = pd.read_csv(file_name)\n df.rename(columns={'Un... | python | chosen |
[
{
"from": "system",
"value": "Load cached graph in verify cached graphs tool if not already present.\n"
},
{
"from": "human",
"value": "#!/usr/bin/env python\n\nimport sys\nfrom pprint import pprint as pp\n\nfrom cc.payment import flow\n\ndef verify():\n for ignore_balances in (True, False):\... | python | chosen |
[
{
"from": "human",
"value": "Add a AioSparkApi class to set up the whole thing\n"
},
{
"from": "gpt",
"value": "import aiosparkapi.requests\nfrom .api.messages import Messages\nfrom .api.webhooks import Webhooks\nfrom .api.people import People\n\nimport aiohttp\n\n\nclass AioSparkApi:\n\n def... | python | chosen |
[
{
"from": "system",
"value": "Support use case where the user sent consent from the wrong email\n"
},
{
"from": "human",
"value": "# Exports all data for the particular user for the particular day\n# Used for debugging issues with trip and section generation \nimport sys\nimport logging\nlogging... | python | chosen |
[
{
"from": "system",
"value": "Add missing assignment of name in constructor"
},
{
"from": "human",
"value": "import re\n\n\nclass AttrDict(object):\n \"A case-insensitive attribute accessible dict-like object\"\n def __init__(self, name, *args, **kwargs):\n for key, value in dict(*a... | python | chosen |
[
{
"from": "system",
"value": "Add an \"up\" to list all \"up\" minions\n"
},
{
"from": "human",
"value": "'''\nGeneral management functions for salt, tools like seeing what hosts are up\nand what hosts are down\n'''\n\n# Import salt modules\nimport salt.client\nimport salt.cli.key\n\ndef down():... | python | chosen |
[
{
"from": "system",
"value": "Add user agent to reddit request\n"
},
{
"from": "human",
"value": "import requests\nfrom random import choice\n\nfrom sazabi.types import SazabiBotPlugin\n\n\nclass Joke(SazabiBotPlugin):\n async def parse(self, client, message, *args, **kwargs):\n if mes... | python | chosen |
[
{
"from": "system",
"value": "[SwiftSyntax] Replace ExpressibleAs protocols by ExpressibleBy protocols\n\nThe protocols in the standard library are called `ExpressibleBy*` and SwiftSyntax should follow the same naming convention.\n"
},
{
"from": "human",
"value": "SYNTAX_BUILDABLE_EXPRESSIBLE_AS... | python | chosen |
[
{
"from": "system",
"value": "Add placeholder settings to unit tests\n"
},
{
"from": "human",
"value": "import unittest\n\nfrom app import create_app, configure_settings, db\n\n\nclass AppTestCase(unittest.TestCase):\n def setUp(self):\n self.app = create_app('testing')\n self.a... | python | chosen |
[
{
"from": "system",
"value": "Fix test for go completor."
},
{
"from": "human",
"value": "# -*- coding: utf-8 -*-\n\nimport mock\nimport completor\nfrom completor.compat import to_unicode\nfrom completers.go import Go # noqa\n\n\ndef test_format_cmd(vim_mod):\n vim_mod.funcs['line2byte'] = m... | python | chosen |
[
{
"from": "system",
"value": "Use the cpu count for the process pool size.\n"
},
{
"from": "human",
"value": "import datetime\nimport multiprocessing\n\nfrom django.conf import settings\nfrom django.core.management.base import BaseCommand, CommandError\n\nfrom core.models import WebPage, PageScr... | python | chosen |
[
{
"from": "system",
"value": "Repair a Python compatibility test in Py3.10.\n"
},
{
"from": "human",
"value": "# cython: language_level=3\n# mode: run\n# tag: pure3.7, pep526, pep484\n\nfrom __future__ import annotations\n\ntry:\n from typing import ClassVar\nexcept ImportError: # Py<=3.5\n ... | python | chosen |
[
{
"from": "system",
"value": "Update old utils paths to use new paths\n"
},
{
"from": "human",
"value": "# -*- coding: utf-8 -*-\n'''\nTests for various minion timeouts\n'''\n\n# Import Python libs\nfrom __future__ import absolute_import\nimport os\nimport sys\n\nimport salt.utils\n\n# Import Sa... | python | chosen |
[
{
"from": "system",
"value": "Use pytest parametrize for the coefficient tests\n"
},
{
"from": "human",
"value": "import pytest\n\nslow = pytest.mark.skipif(\n not pytest.config.getoption(\"--runslow\"),\n reason=\"need --runslow option to run\"\n)\n\nTOTAL_DEGREES = 2\n\nfrom .crv_coeffs ... | python | chosen |
[
{
"from": "system",
"value": "Move instead of symlink because we blow that dir away."
},
{
"from": "human",
"value": "import re\nimport os\n\nfrom django.conf import settings\n\nfrom doc_builder.base import BaseBuilder\nfrom projects.utils import run\n\nlatex_re = re.compile('the LaTeX files are... | python | chosen |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.