conversations listlengths 2 3 | source stringclasses 1
value | stack stringclasses 1
value |
|---|---|---|
[
{
"from": "system",
"value": "Use simple_tag instead of assignment_tag\n\nThe assignment_tag is depraceted and in django-2.0 removed.\n\nSigned-off-by: Frantisek Lachman <bae095a6f6bdabf882218c81fdc3947ea1c10590@gmail.com>\n"
},
{
"from": "human",
"value": "from django import template\nfrom djan... | python | chosen |
[
{
"from": "system",
"value": "Update to version 0.1.1 (already in pypi).\n\nPiperOrigin-RevId: 391948484\nChange-Id: Idf5c7f00dbba8ffe2ca292961d4e0e0e26bcd1cb\n"
},
{
"from": "human",
"value": "# Copyright 2021 Google LLC.\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n... | python | chosen |
[
{
"from": "system",
"value": "Make the party set JS generator output keys in a predictable order\n\nThis makes it easier to check with \"git diff\" if there have been any\nchanges.\n"
},
{
"from": "human",
"value": "import json\nfrom os.path import dirname, join, realpath\n\nfrom django.conf imp... | python | chosen |
[
{
"from": "system",
"value": "Make stderr messages more interpretable\n"
},
{
"from": "human",
"value": "import camoco as co\n\ndef remove(args):\n print(co.del_dataset(args.type,args.name,safe=args.force))\n"
},
{
"from": "gpt",
"value": "import camoco as co\n\ndef remove(args):\... | python | chosen |
[
{
"from": "system",
"value": "Use `subprocess.check_output` rather than `commands.getoutput`.\n\n`commands` is deprecated.\n"
},
{
"from": "human",
"value": "# -*- coding: utf-8 -*-\n\n\"\"\" Copy + Paste in OS X\n\"\"\"\n\n\nimport subprocess\nimport commands\n\nfrom .base import *\n\n\ndef cop... | python | chosen |
[
{
"from": "system",
"value": "Update urlpatterns and remove old patterns pattern"
},
{
"from": "human",
"value": "from django.conf.urls import patterns, url\nfrom django.utils.translation import ugettext_lazy as _\n\nfrom .views import (\n RealmView,\n RealmCorrectionsView,\n EntitySear... | python | chosen |
[
{
"from": "system",
"value": "Add a custom validator to ensure email uniqueness, include ommitted fields.\n\nPreviously no check was performed to ensure that the same email wasn't used\nto register twice. Here we add a validator to perform that check.\n\nWe also noted that the domain field was omitted, but ... | python | chosen |
[
{
"from": "system",
"value": "Allow nodes not to have related environment\n"
},
{
"from": "human",
"value": "from django.db import models\nfrom django.contrib.auth.models import User\nfrom jsonfield import JSONField\n\n\nclass Environment(models.Model):\n #user = models.ForeignKey(User, relat... | python | chosen |
[
{
"from": "system",
"value": "Add a test for utils.fetch_url(..., opener=...)\n\nSigned-off-by: Ossi Herrala <37524b811d80bbe1732e3577b04d7a5fd222cfc5@gmail.com>\n"
},
{
"from": "human",
"value": "import pickle\nimport unittest\n\nfrom .. import utils\n\n\nclass TestCompressedCollection(unittest... | python | chosen |
[
{
"from": "system",
"value": "Add a properly string for outputing\n"
},
{
"from": "human",
"value": "from . import output\nimport json\nimport sys\nimport urllib.parse\nimport http.client\n\n\ndef getRequest(id, conf):\n db = conf['db']\n headers = conf['headers']\n test = db[id]\n m... | python | chosen |
[
{
"from": "system",
"value": "Use itertools.cycle for repeating digits\n"
},
{
"from": "human",
"value": "from .base import Shipper\n\n\nclass FedEx(Shipper):\n shipper = 'FedEx'\n\n\nclass FedExExpress(FedEx):\n barcode_pattern = r'^\\d{34}$'\n\n @property\n def tracking_number(self... | python | chosen |
[
{
"from": "system",
"value": "Fix formatting once more, added response parsing\n"
},
{
"from": "human",
"value": "\"\"\"\nstat-retriever by Team-95\nstat_retriever.py\n\"\"\"\n\nimport requests\n\ndef main():\n url = \"http://stats.nba.com/stats/leaguedashplayerbiostats?College=&Conference=\"... | python | chosen |
[
{
"from": "system",
"value": "Make the ScopeExtractorProcessor usable for the Primary Identifier\n\nThis patch adds support to use the ScopeExtractorProcessor on the Primary\nIdentifiert which is, in contrast to the other values, a string.\n\nCloses #348\n"
},
{
"from": "human",
"value": "from .... | python | chosen |
[
{
"from": "system",
"value": "Add further tests of the cms urls\n"
},
{
"from": "human",
"value": "from incuna_test_utils.testcases.urls import URLTestCase\n\nfrom .. import views\n\n\nclass TestCMSIndexURL(URLTestCase):\n \"\"\"Make sure that the CMSIndex view has a URL\"\"\"\n def test_u... | python | chosen |
[
{
"from": "system",
"value": "Remove deprecated fast_suite and check list for unit tests\n"
},
{
"from": "human",
"value": "# -*- coding: utf-8 -*-\n##############################################################################\n#\n# Author: Guewen Baconnier\n# Copyright 2012 Camptocamp SA... | python | chosen |
[
{
"from": "system",
"value": "Use a frozen set for constant.\n"
},
{
"from": "human",
"value": "from itertools import chain\nimport string\nfrom cymbology.alphanum import CHAR_MAP\nfrom cymbology.codes import CINS_CODES\nfrom cymbology.exceptions import CountryCodeError\nfrom cymbology.luhn impo... | python | chosen |
[
{
"from": "system",
"value": "Return deleted comments instead of throwing error\n"
},
{
"from": "human",
"value": "from rest_framework import generics\nfrom api.comments.serializers import CommentSerializer, CommentDetailSerializer\nfrom website.project.model import Comment\nfrom api.base.utils ... | python | chosen |
[
{
"from": "system",
"value": "Fix missing trailing __ in init function\n"
},
{
"from": "human",
"value": "import telegram\n\nfrom game.api import auth\n\nMAX_SCORE = 999999\n\n\nclass ScoreUpdater:\n def __init(self, bot: telegram.Bot):\n self.bot = bot\n\n def set_score(self, data,... | python | chosen |
[
{
"from": "system",
"value": "Fix deleted line during merge\n"
},
{
"from": "human",
"value": "from django.conf import settings\nfrom django.contrib import admin\n\nfrom geotrek.feedback import models as feedback_models\n\nif 'modeltranslation' in settings.INSTALLED_APPS:\n from modeltranslat... | python | chosen |
[
{
"from": "system",
"value": "Add user notifications to context processor\n"
},
{
"from": "human",
"value": "from notification.models import Notice\n\n\ndef notification(request):\n if request.user.is_authenticated():\n return {\n \"notice_unseen_count\": Notice.objects.unse... | python | chosen |
[
{
"from": "system",
"value": "Revert previous commit due to arrayfire-python bug.\n"
},
{
"from": "human",
"value": "import arrayfire\nimport pytest\n\nbackends = arrayfire.library.get_available_backends()\n# do not use opencl backend, it's kinda broken\n#backends = [x for x in backends if x != ... | python | chosen |
[
{
"from": "system",
"value": "Use the re.UNICODE flag (i.e., Python character tables) in findall()\n"
},
{
"from": "human",
"value": "# Copyright (C) 2010 Peter Teichman\n\nimport re\n\nclass MegaHALTokenizer:\n def split(self, phrase):\n if len(phrase) == 0:\n return []\n\n... | python | chosen |
[
{
"from": "system",
"value": "Update factory-boy's .generate to evaluate\n\nCo-Authored-By: Timo Halbesma <98c2d5a1e48c998bd9ba9dbc53d6857beae1c9bd@halbesma.com>\n"
},
{
"from": "human",
"value": "from typing import Any, Sequence\n\nfrom django.contrib.auth import get_user_model\nfrom factory im... | python | chosen |
[
{
"from": "system",
"value": "Rename rank field to avoid column name clash\n"
},
{
"from": "human",
"value": "\"\"\"Add ranking data to participants table\n\nRevision ID: 451d4bb125cb\nRevises: 49be2190c22d\nCreate Date: 2017-11-10 13:57:37.807238+00:00\n\n\"\"\"\nfrom alembic import op\nimport ... | python | chosen |
[
{
"from": "system",
"value": "Make importing secrets explicitly relative\n"
},
{
"from": "human",
"value": "# -*- coding: utf-8 -*-\nimport pytest\n\nfrom epo_ops.middlewares import Dogpile, Throttler\nfrom epo_ops.middlewares.throttle.storages import sqlite\nfrom inet.sources.ops import OpsClie... | python | chosen |
[
{
"from": "system",
"value": "Change full name method to stop validating for str type which is repetitive and has been tested elsewhere\n"
},
{
"from": "human",
"value": "class Person(object):\n def __init__(self, person_type, person_name, person_surname=\"\", wants_accommodation=\"N\"):\n ... | python | chosen |
[
{
"from": "system",
"value": "Remove Django importlib in favor of stdlib.\n\nDjango's copy of importlib was deprecated in 1.7 and therefore removed\nin Django 1.9:\nhttps://docs.djangoproject.com/en/1.10/releases/1.7/#django-utils-dictconfig-django-utils-importlib\n\nThis is okay, since we are using Python ... | python | chosen |
[
{
"from": "system",
"value": ":fire: Clean exports from typer, remove unneeded Click components\n\nand add Exit exception\n"
},
{
"from": "human",
"value": "\"\"\"Typer, build great CLIs. Easy to code. Based on Python type hints.\"\"\"\n\n__version__ = \"0.0.4\"\n\nfrom click.exceptions import (... | python | chosen |
[
{
"from": "system",
"value": "Package name should be searched through the same distros list\nwe use for listing installed packages. get_distribution is using\nthe global working_set which may not contain the requested package\nif the initialization(pkg_resources import time) happened before\nthe project nam... | python | chosen |
[
{
"from": "system",
"value": "Allow DocumentFactory to handle preview field.\n\nThe factory.django.FileField.DEFAULT_FILENAME == 'example.dat'.\nIt means that by default a FileField created by factoryboy is considered as a\nTrue value.\nBefore this commit, we were not defining a Document.preview field in th... | python | chosen |
[
{
"from": "system",
"value": "Fix spark mode (faulty shutdown conditional logic)\n"
},
{
"from": "human",
"value": "import os\nimport romanesco\nfrom . import pyspark_executor, spark\n\nSC_KEY = '_romanesco_spark_context'\n\n\ndef setup_pyspark_task(event):\n \"\"\"\n This is executed befo... | python | chosen |
[
{
"from": "system",
"value": "Remove `objects' group as useless\n"
},
{
"from": "human",
"value": "from collections import defaultdict\n\n\nclass EntityForm:\n def __init__(self):\n self._score = 0.\n self.forms = defaultdict(float)\n\n def add_form(self, score, normal_form):... | python | chosen |
[
{
"from": "system",
"value": "Change set to merge correctly\n"
},
{
"from": "human",
"value": "from katagawa.kg import Katagawa\n\nfrom schema.config import Guild\n\n\nclass Config:\n def __init__(self, bot):\n dsn = f'postgresql://beattie:passwd@localhost/config'\n self.db = Ka... | python | chosen |
[
{
"from": "system",
"value": "Remove un-necessary binascii module import.\n"
},
{
"from": "human",
"value": "#!/usr/bin/env python\n\"\"\"\nThis example shows how to validate addresses. Note that the validation\nclass can handle up to 100 addresses for validation.\n\"\"\"\nimport logging\nimport... | python | chosen |
[
{
"from": "system",
"value": "Allow host/port config in settings file for gevent run script\n"
},
{
"from": "human",
"value": "#!/usr/bin/env python\n\n# Import gevent monkey and patch everything\nfrom gevent import monkey\nmonkey.patch_all(httplib=True)\n\n# Import the rest\nfrom django.core.ha... | python | chosen |
[
{
"from": "system",
"value": "Fix in post_syncdb workflow registration\n"
},
{
"from": "human",
"value": "from django.db.models.signals import post_syncdb\n\nfrom gasistafelice.gas.workflow_data import workflow_dict\n\ndef init_workflows(app, created_models, verbosity, **kwargs):\n app_label ... | python | chosen |
[
{
"from": "system",
"value": "Set middleware setting according to Django version in test settings\n\nDjango 1.10 introduced new-style middleware and the corresponding\nMIDDLEWARE setting and deprecated MIDDLEWARE_CLASSES. The latter is\nignored on Django 2.\n"
},
{
"from": "human",
"value": "#!/... | python | chosen |
[
{
"from": "system",
"value": "Fix broken content from PhJS"
},
{
"from": "human",
"value": "# Copyright (C) Ivan Kravets <me@ikravets.com>\n# See LICENSE for details.\n\nfrom subprocess import check_output, CalledProcessError\nfrom urllib import unquote\n\n\ndef application(env, start_response):... | python | chosen |
[
{
"from": "system",
"value": "Make it work out of the box on the build-server and locally\n"
},
{
"from": "human",
"value": "import os\n\nconfig_dir = os.path.dirname(os.path.abspath(__file__))\n\n# Destination of built packages.\nPKG_REPO = '/tmp/'\n"
},
{
"from": "gpt",
"value": "i... | python | chosen |
[
{
"from": "system",
"value": "Fix issue with returning wrong date\n"
},
{
"from": "human",
"value": "from datetime import datetime\n\nfrom sqlalchemy import Table, Column, Integer, String, DateTime, ForeignKey\nfrom sqlalchemy.orm import relationship\nfrom sqlalchemy.ext.hybrid import hybrid_pro... | python | chosen |
[
{
"from": "system",
"value": "Use StringIO object from 'io' module instead of deprecated 'StringIO' module\n"
},
{
"from": "human",
"value": "\"\"\"\nLogging\n=======\n\"\"\"\nimport logging\n\nimport colorlog\n\n\ndef init_logger(level, printout=True):\n \"\"\"\n Initialize app logger to ... | python | chosen |
[
{
"from": "system",
"value": "Fix the inheritence of InMemoryStore\n"
},
{
"from": "human",
"value": "class BaseStore(object):\n\n def set(self, key, value):\n raise NotImplementedError\n\n def get(self, key):\n raise NotImplementedError\n\n\nclass InMemoryStore(object):\n\n ... | python | chosen |
[
{
"from": "system",
"value": "Test using tmp media root\n"
},
{
"from": "human",
"value": "\"\"\"\nTest some of the basic model use cases\n\n\"\"\"\nfrom django.test import TestCase\n\nfrom .factories import PartyFactory, PartyEmblemFactory\n\n\nclass TestPartyModels(TestCase):\n def setUp(se... | python | chosen |
[
{
"from": "system",
"value": ":art: Change Form to FlaskForm (previous is deprecated)\n"
},
{
"from": "human",
"value": "from flask_wtf import Form\nfrom wtforms import (\n StringField, PasswordField, BooleanField, SubmitField,\n ValidationError,\n)\nfrom wtforms.validators import (\n I... | python | chosen |
[
{
"from": "system",
"value": "Fix intermittent errors during test runs.\n"
},
{
"from": "human",
"value": "import logging\nimport os\nimport re\nimport unittest.mock\n\n# Default to turning off all but critical logging messages\nlogging.basicConfig(level=logging.CRITICAL)\n\ndef mock_open_url(ur... | python | chosen |
[
{
"from": "system",
"value": "Remove Mock and create \"empty\" object on the fly\n"
},
{
"from": "human",
"value": "from unittest.mock import MagicMock\nimport pytest\nfrom rocketchat_API.rocketchat import RocketChat\n\n\n@pytest.fixture(scope=\"session\")\ndef rocket():\n _rocket = RocketCha... | python | chosen |
[
{
"from": "system",
"value": "Remove accidentally left in print statement\n"
},
{
"from": "human",
"value": "import pytest\n\n\n@pytest.fixture\ndef event_loop():\n print(\"in event_loop\")\n try:\n import asyncio\n\n import uvloop\n\n asyncio.set_event_loop_policy(uvl... | python | chosen |
[
{
"from": "system",
"value": "Set fixture scope to module, so that pipes from one file dont influence tests from another\n"
},
{
"from": "human",
"value": "#!/usr/bin/env python\n# -*- coding: utf-8 -*-\n# type: ignore\n\n\"\"\"Shared fixture functions.\"\"\"\nimport pathlib\nimport pytest # py... | python | chosen |
[
{
"from": "system",
"value": "Add docstrings for load functions\n"
},
{
"from": "human",
"value": "\"\"\" Convenience functions to load example datasets \"\"\"\n\nimport os\nimport scarplet as sl\n\n\nEXAMPLE_DIRECTORY = os.path.join(os.path.dirname(os.path.abspath(__file__)),\n ... | python | chosen |
[
{
"from": "system",
"value": "Support for appending to a file\n"
},
{
"from": "human",
"value": "#!/usr/bin/python\n# -*- coding: utf-8 -*-\n\nfrom socket import socket, AF_INET, SOCK_DGRAM\n\ndef create_udp_server_socket(endpoint):\n skt = socket(AF_INET, SOCK_DGRAM)\n skt.bind(endpoint)\... | python | chosen |
[
{
"from": "system",
"value": "Correct the target info schema: docker and rsync messages are Null in case of\nsuccess. Suggested by @vinzenz and corrected by @artmello.\n"
},
{
"from": "human",
"value": "import jsl\n\n\nclass TargetInfo(jsl.Document):\n docker = jsl.ArrayField(jsl.StringField(... | python | chosen |
[
{
"from": "system",
"value": "Update query to use nodes\n"
},
{
"from": "human",
"value": "import requests\n\nGITHUB_API_URL = \"https://api.github.com/graphql\"\n\nQUERY = \"\"\"\nquery($repository_owner:String!, $repository_name: String!, $count: Int!) {\n repository(\n owner: $repository_... | python | chosen |
[
{
"from": "system",
"value": "Add preprocess to the list of modules lazy-imported in Orange\n"
},
{
"from": "human",
"value": "from .misc.lazy_module import LazyModule\nfrom .version import \\\n short_version as __version__, git_revision as __git_version__\n\nADDONS_ENTRY_POINT = 'orange.addo... | python | chosen |
[
{
"from": "system",
"value": "Format JSON to be collections of tokens\n\nWhen coreNLP returns the JSON payload, it is in an unmanageable format\nwhere multiple arrays are made for all parts of speech, tokens, and\nlemmas. It's much easier to manage when the response is formatted as a\nlist of objects:\n\n{\... | python | chosen |
[
{
"from": "system",
"value": "Change to more generic variable names in _fill_queue\n"
},
{
"from": "human",
"value": "from vumi.persist.model import VumiRiakError\nfrom go_api.collections.errors import CollectionUsageError\nfrom go_api.queue import PausingQueueCloseMarker\nfrom twisted.internet.... | python | chosen |
[
{
"from": "system",
"value": "Return 0 with the get_range filter if value is invalid instead of raise exception\n"
},
{
"from": "human",
"value": "from django import template\n\nregister = template.Library()\n\n\n@register.filter\ndef get_range(value):\n return range(value)\n\n\n@register.fil... | python | chosen |
[
{
"from": "system",
"value": "Correct module name in docstring\n"
},
{
"from": "human",
"value": "\"\"\"\nsentry\n~~~~~~\n\n:copyright: (c) 2010 by the Sentry Team, see AUTHORS for more details.\n:license: BSD, see LICENSE for more details.\n\"\"\"\n\n__all__ = ('VERSION', 'Client', 'load')\n\nt... | python | chosen |
[
{
"from": "system",
"value": "Add url and environment to payload\n"
},
{
"from": "human",
"value": "\"\"\"\nsentry_heroku.plugin\n~~~~~~~~~~~~~~~~~~~~\n\n:copyright: (c) 2015 by Sentry Team, see AUTHORS for more details.\n:license: Apache 2.0, see LICENSE for more details.\n\"\"\"\nimport sentry... | python | chosen |
[
{
"from": "system",
"value": "Add docstr to auth_required decorator.\n"
},
{
"from": "human",
"value": "import httplib2\n\nfrom decorator import decorator\nfrom django.core.urlresolvers import reverse\nfrom django.shortcuts import redirect\nfrom googleapiclient import discovery\nfrom oauth2clien... | python | chosen |
[
{
"from": "system",
"value": "Use MongoLab configuration from environment if available\n"
},
{
"from": "human",
"value": "from flask import Flask\nfrom flask.ext.mongoengine import MongoEngine\nimport logging\n# configure the logging\nlogging.basicConfig(level='DEBUG', format='%(asctime)s - %(na... | python | chosen |
[
{
"from": "system",
"value": "Update string tests to reflect new behaviour.\n"
},
{
"from": "human",
"value": "from protobuf3.fields.string import StringField\nfrom protobuf3.message import Message\nfrom unittest import TestCase\n\n\nclass TestStringField(TestCase):\n def setUp(self):\n ... | python | chosen |
[
{
"from": "system",
"value": "Handle logout on the backend\n"
},
{
"from": "human",
"value": "from django.urls import path, re_path\nfrom django.conf.urls.static import static\nfrom django.conf import settings\n\nfrom . import views\n\n\nurlpatterns = static('/compiled/', document_root=settings.... | python | chosen |
[
{
"from": "system",
"value": "Move revoke events to DocumentedRuleDefault\n\nThe overall goal is to define a richer policy for deployers\nand operators[0]. To achieve that goal a new policy\nclass was introduce that requires additional parameters\nwhen defining policy objects.\n\nThis patch switches our rev... | python | chosen |
[
{
"from": "system",
"value": "Add close method to Raw class\n\nFixes #10\n"
},
{
"from": "human",
"value": "from rawkit.libraw import libraw\n\n\nclass Raw(object):\n\n def __init__(self, filename=None):\n self.data = libraw.libraw_init(0)\n libraw.libraw_open_file(self.data, by... | python | chosen |
[
{
"from": "system",
"value": "Remove code we dont need anymore.\n"
},
{
"from": "human",
"value": "# -*- coding: utf-8 -*-\n# Licensed to the StackStorm, Inc ('StackStorm') under one or more\n# contributor license agreements. See the NOTICE file distributed with\n# this work for additional info... | python | chosen |
[
{
"from": "system",
"value": "Fix name to correct dataset JSON file\n"
},
{
"from": "human",
"value": "import json\n\nwith open('short_dataset_item.json') as dataset_file:\n dataset = json.load(dataset_file)\n\nfor i in range(len(dataset)):\n if 'Continual' == dataset[i]['frequency']:\n ... | python | chosen |
[
{
"from": "system",
"value": "Order paginated KV API results.\n"
},
{
"from": "human",
"value": "from rest_framework import viewsets\n\nfrom wafer.kv.models import KeyValue\nfrom wafer.kv.serializers import KeyValueSerializer\nfrom wafer.kv.permissions import KeyValueGroupPermission\n\nclass Key... | python | chosen |
[
{
"from": "system",
"value": "Disable antialias for GL drawing lines\n"
},
{
"from": "human",
"value": "# -*- coding: utf-8 -*-\n# Copyright (c) 2015, Vispy Development Team.\n# Distributed under the (new) BSD License. See LICENSE.txt for more info.\n\nimport numpy as np\n\nfrom vispy.visuals.li... | python | chosen |
[
{
"from": "system",
"value": "fix: Make users be inactive on creation\n"
},
{
"from": "human",
"value": "from django.contrib.auth.models import AbstractUser\nfrom django.utils.functional import cached_property\nfrom social.apps.django_app.default.models import UserSocialAuth\n\n\nclass User(Abst... | python | chosen |
[
{
"from": "system",
"value": "Fix in pricing rule patch\n"
},
{
"from": "human",
"value": "# Copyright (c) 2013, Web Notes Technologies Pvt. Ltd. and Contributors\n# License: GNU General Public License v3. See license.txt\n\nfrom __future__ import unicode_literals\nimport frappe\nfrom frappe.uti... | python | chosen |
[
{
"from": "system",
"value": "Use ENJAZACESSS when is access is provided\n"
},
{
"from": "human",
"value": "import twitter\nfrom django.core.management.base import BaseCommand\nfrom django.conf import settings\n\nfrom core.models import Tweet\n\nclass Command(BaseCommand):\n help = \"Send out... | python | chosen |
[
{
"from": "system",
"value": "Update dsub version to 0.4.5.dev0\n\nPiperOrigin-RevId: 358198209\n"
},
{
"from": "human",
"value": "# Copyright 2017 Google Inc. All Rights Reserved.\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may not use this file except in comp... | python | chosen |
[
{
"from": "system",
"value": "Replace splat import in tests.\n"
},
{
"from": "human",
"value": "import pytest\nfrom utils import *\nfrom pgcli.pgexecute import PGExecute\n\n\n@pytest.yield_fixture(scope=\"function\")\ndef connection():\n create_db('_test_db')\n connection = db_connection('... | python | chosen |
[
{
"from": "system",
"value": "Allow unsafe change of backend for testing\n"
},
{
"from": "human",
"value": "import arrayfire\nimport pytest\n\nbackends = arrayfire.library.get_available_backends()\n# do not use opencl backend, it's kinda broken\n#backends = [x for x in backends if x != 'opencl']... | python | chosen |
[
{
"from": "system",
"value": "Clean up test helper, add example\n"
},
{
"from": "human",
"value": "import pytest\n\n\n@pytest.fixture\ndef observe(monkeypatch):\n def patch(module, func):\n original_func = getattr(module, func)\n\n def wrapper(*args, **kwargs):\n resu... | python | chosen |
[
{
"from": "system",
"value": "Change scale range to normalization with source and target min max\n"
},
{
"from": "human",
"value": "import numpy as np\n\nimport skimage.io\nimport skimage.util\n\nimport os\n\n\ndef extract_region_from_image(image, region_bounding_box):\n return image[region_b... | python | chosen |
[
{
"from": "system",
"value": "Handle when /grid ends with a period, since Twitter let apgwoz link to it that way\n"
},
{
"from": "human",
"value": "from django.conf.urls.defaults import *\n\nfrom motion.feeds import PublicEventsFeed\n\n\nurlpatterns = patterns('',\n url(r'^$', 'makeaface.view... | python | chosen |
[
{
"from": "system",
"value": "Fix typo in the Discord plugin.\n"
},
{
"from": "human",
"value": "from plumeria.command import commands, channel_only\nfrom plumeria.message import Response\n\n\n@commands.register('roles', category='Discord')\n@channel_only\nasync def roles(message):\n \"\"\"\n... | python | chosen |
[
{
"from": "system",
"value": "Add right tip structure tests\n"
},
{
"from": "human",
"value": "import pytest\n\nfrom boink.dbg_tests import (_test_add_single_kmer,\n _test_add_two_kmers,\n _test_kmer_degree,\n _t... | python | chosen |
[
{
"from": "system",
"value": "Update timestamps of generated feeds as well\n"
},
{
"from": "human",
"value": "from pelican import signals\n\nimport logging\nimport os\nimport time\n\n\nlogger = logging.getLogger(__name__)\n\n\ndef set_file_utime(path, datetime):\n mtime = time.mktime(datetime... | python | chosen |
[
{
"from": "system",
"value": "Set version to 1.1.0 final\n"
},
{
"from": "human",
"value": "# file eulfedora/__init__.py\n#\n# Copyright 2010,2011 Emory University Libraries\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may not use this file except in compl... | python | chosen |
[
{
"from": "system",
"value": "Remove Unused Length imported from wtforms.validators, pylint.\n"
},
{
"from": "human",
"value": "from flask_wtf import FlaskForm\nfrom wtforms import StringField\nfrom wtforms.validators import DataRequired, Length\n\n\nclass AddSubjectForm(FlaskForm):\n code = ... | python | chosen |
[
{
"from": "system",
"value": "Add test to show login form is broken\n"
},
{
"from": "human",
"value": "from django.core import management\nfrom django.test import TestCase\nfrom django.contrib.contenttypes.models import ContentType\n\nfrom post.models import Post\n\nfrom foundry.models import Me... | python | chosen |
[
{
"from": "system",
"value": "Add url to RTRating object\n"
},
{
"from": "human",
"value": "import requests\n\nfrom bs4 import BeautifulSoup\nfrom source.models.rt_rating import RTRating\n\n\nclass OmdbService:\n\n __API_URL = 'http://www.omdbapi.com/?'\n\n def __init__(self, movie_id):\n ... | python | chosen |
[
{
"from": "system",
"value": "Use common colors, Reset after message.\n\nSwitch to colors that don't mess up on using light color schemes."
},
{
"from": "human",
"value": "import os\nimport logging\nimport types\nimport json\n\nimport six\n\n\nclass JsonFormatter(logging.Formatter):\n\n def f... | python | chosen |
[
{
"from": "system",
"value": "Solve problem to detect linked list cycle\n\nhttps://www.hackerrank.com/challenges/ctci-linked-list-cycle\n"
},
{
"from": "human",
"value": "# https://www.hackerrank.com/challenges/ctci-linked-list-cycle\n# Python 3\n\n\"\"\"\nDetect a cycle in a linked list. Note t... | python | chosen |
[
{
"from": "system",
"value": "TST: Use itemgetter instead of lambda\n"
},
{
"from": "human",
"value": "import hypothesis_jsonschema\nfrom hypothesis import HealthCheck, given, settings\nfrom hypothesis import strategies as st\n\nfrom amostra.utils import load_schema\n\nsample_dict = load_schema(... | python | chosen |
[
{
"from": "system",
"value": "Add my classic Struct \"class.\"\n\nThat's right, I embrace the lazy.\n"
},
{
"from": "human",
"value": "# Giles: utils.py\n# Copyright 2012 Phil Bordelon\n#\n# This program is free software: you can redistribute it and/or modify\n# it under the terms of the GNU Aff... | python | chosen |
[
{
"from": "system",
"value": "Add GET for idea and refactor vote\n"
},
{
"from": "human",
"value": "from .models import Idea\nfrom .serializers import IdeaSerializer\nfrom rest_framework import status\nfrom rest_framework.decorators import api_view\nfrom rest_framework.response import Response\n... | python | chosen |
[
{
"from": "system",
"value": "Add temporary bootstrapping to get the service working with how the charm presently expects to run the app.\n"
},
{
"from": "human",
"value": "#!/usr/bin/env python\nimport os\nimport sys\n\nif __name__ == \"__main__\":\n os.environ.setdefault(\"DJANGO_SETTINGS_M... | python | chosen |
[
{
"from": "system",
"value": "Hide .env behind a development environment.\n"
},
{
"from": "human",
"value": "#!/usr/bin/env python\nimport os\nimport sys\n\n\nif __name__ == '__main__':\n os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'base.settings')\n os.environ.setdefault('DJANGO_CONFI... | python | chosen |
[
{
"from": "system",
"value": "Use socket connection to get own IP.\n\n\nFormer-commit-id: ebec31105582235c8aa74e9bbfd608b9bf103ad1"
},
{
"from": "human",
"value": "import sh\nfrom sh import docker\n\n\ndef get_ip():\n \"\"\"Return a string of the IP of the hosts eth0 interface.\"\"\"\n int... | python | chosen |
[
{
"from": "system",
"value": "parselogs: Update the error regexps to 5.10 kernel\n\nThe old messages are no longer necessary\n\nSigned-off-by: Khem Raj <729d64b6f67515e258459a5f6d20ec88b2caf8df@gmail.com>\n"
},
{
"from": "human",
"value": "from oeqa.runtime.cases.parselogs import *\n\nrpi_errors... | python | chosen |
[
{
"from": "system",
"value": "Use new (?) repository transferred hook.\n"
},
{
"from": "human",
"value": "import json\nimport uuid\n\nfrom flask_hookserver import Hooks\n\nfrom .db import redis\nfrom .members.models import User\nfrom .projects.tasks import update_project_by_hook\nfrom .tasks imp... | python | chosen |
[
{
"from": "system",
"value": "Add length validator to name.\nAdd dob validator can't be higher than current year.\n"
},
{
"from": "human",
"value": "from django.db import models\n\nclass Animal(models.Model):\n MALE = 'male'\n FEMALE = 'female'\n\n GENDER_CHOICES = ((MALE, 'Male'), (FEM... | python | chosen |
[
{
"from": "system",
"value": "Work around when fqdn is not defined for a node.\n"
},
{
"from": "human",
"value": "from chef import Search\nfrom chef.api import ChefAPI, autoconfigure\nfrom chef.exceptions import ChefError\n\nclass Roledef(object):\n def __init__(self, name, api, hostname_attr... | python | chosen |
[
{
"from": "system",
"value": "Add repr and str to our token model\n"
},
{
"from": "human",
"value": "from django.contrib.auth.models import User\nfrom django.db import models\n\n\nclass Token(models.Model):\n fitbit_id = models.CharField(max_length=50)\n refresh_token = models.CharField(ma... | python | chosen |
[
{
"from": "system",
"value": "Use a list for main elements\n"
},
{
"from": "human",
"value": "from urllib.request import Request, urlopen\n\nfrom .renderers import XMLRenderer\n\n\nclass Client:\n def __init__(self, hostname, auth_info):\n self.base_url = 'http://{}/MRWEnvio.asmx'.form... | python | chosen |
[
{
"from": "system",
"value": "Add units to brady and tachy strings.\n"
},
{
"from": "human",
"value": "def summarizeECG(instHR, avgHR, brady, tachy):\n \"\"\"Create txt file summarizing ECG analysis\n :param instHR: (int)\n :param avgHR: (int)\n :param brady: (int)\n :param tachy:... | python | chosen |
[
{
"from": "system",
"value": "Use better variable names for algorithmic determination\n"
},
{
"from": "human",
"value": "def levenshtein(s1, s2):\n if len(s1) < len(s2):\n return levenshtein(s2, s1)\n\n # len(s1) >= len(s2)\n if len(s2) == 0:\n return len(s1)\n\n previo... | python | chosen |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.