conversations listlengths 2 3 | source stringclasses 1
value | stack stringclasses 1
value |
|---|---|---|
[
{
"from": "system",
"value": "Set up defaults using tag syntax\n"
},
{
"from": "human",
"value": "import npc\nimport pytest\n\n@pytest.fixture(scope=\"module\")\ndef character():\n char = npc.character.Character()\n char.append('description', 'Fee fie foe fum')\n char.append('type', 'hu... | python | chosen |
[
{
"from": "system",
"value": "Make it more obvious that you need to use a local repository as an argument, not a url\n"
},
{
"from": "human",
"value": "#!/usr/bin/env python \n\n# Display authors which appear as contributors in both (two) repositories.\n\n\nimport os,sys\n\ndef usage():\n\tprint... | python | chosen |
[
{
"from": "system",
"value": "Update PowerShell alias to handle no history\n\nIf history is cleared (or the shell is new and there is no history),\ninvoking thefuck results in an error because the alias attempts to execute\nthe usage string.\n\nThe fix is to check if Get-History returns anything before invo... | python | chosen |
[
{
"from": "system",
"value": "Reset pointer to the beginning of file once read it\n\nBe polite, put things back in the place you found them\n"
},
{
"from": "human",
"value": "import random\n\ndef random_line(afile, max_chars = 123, min_chars = 5):\n line = next(afile)\n for num, aline in ... | python | chosen |
[
{
"from": "system",
"value": "Add wrapdevtools to restricted projects\n"
},
{
"from": "human",
"value": "_ORGANIZATION = 'mesonbuild'\n_RESTRICTED_PROJECTS = [\n 'meson',\n 'meson-ci',\n 'mesonwrap',\n 'wrapweb',\n]\n_RESTRICTED_ORG_PROJECTS = [\n _ORGANIZATION + '/' + proj for pr... | python | chosen |
[
{
"from": "system",
"value": "Read module version from setup.py\n"
},
{
"from": "human",
"value": "\"\"\"GCloud API access in idiomatic Python.\"\"\"\n\n\n__version__ = '0.02.2'\n"
},
{
"from": "gpt",
"value": "\"\"\"GCloud API access in idiomatic Python.\"\"\"\n\nfrom pkg_resources ... | python | chosen |
[
{
"from": "system",
"value": "Add option to import neo4j for latest version\n"
},
{
"from": "human",
"value": "#!/usr/bin/env python\n# -*- encoding: utf-8 -*-\n\n# Copyright (c) 2002-2016 \"Neo Technology,\"\n# Network Engine for Objects in Lund AB [http://neotechnology.com]\n#\n# This file is ... | python | chosen |
[
{
"from": "system",
"value": "Remove TODO from settings example.\n\nThis work has been started with the Yaml settings file.\n"
},
{
"from": "human",
"value": "\"\"\"\nExample settings module.\n\nThis should be copied as `settings.py` and the values modified there.\n\nThat file is ignored by the ... | python | chosen |
[
{
"from": "system",
"value": "Include gzipped fits files in test data\n"
},
{
"from": "human",
"value": "# Licensed under a 3-clause BSD style license - see LICENSE.rst\nimport os\n# setup paths to the test data\n# can specify a single file or a list of files\n\n\ndef get_package_data():\n pa... | python | chosen |
[
{
"from": "system",
"value": "Use the new Deck class\n"
},
{
"from": "human",
"value": "#Cards Against Humanity game engine\n\nclass CAHGame:\n def __init__(self):\n \n self.status = \"Loaded CAHGame.\"\n \n #flag to keep track o... | python | chosen |
[
{
"from": "system",
"value": "Test reading config from disk again\n"
},
{
"from": "human",
"value": "import pytest\n\nfrom tsstats.config import load\n\n\n@pytest.fixture\ndef config():\n return load()\n\n\ndef test_config(config):\n assert not config.getboolean('General', 'debug')\n as... | python | chosen |
[
{
"from": "system",
"value": "Add test for part 2 of day 5.\n"
},
{
"from": "human",
"value": "import unittest\n\nfrom find_password import find_password\n\n\nclass TestFindPassword(unittest.TestCase):\n def test_find_password(self):\n assert find_password('abc', length=8) == '18f47a30... | python | chosen |
[
{
"from": "system",
"value": "Remove my awesome default audio path\n"
},
{
"from": "human",
"value": "\"\"\"\nRepresents the default values for all Sentry settings.\n\"\"\"\n\nimport logging\nimport os\nimport os.path\n\nclass PlayaConfig(object):\n ROOT = os.path.normpath(os.path.dirname(__f... | python | chosen |
[
{
"from": "system",
"value": "Upgrade libchromiumcontent to use the static_library build\n"
},
{
"from": "human",
"value": "#!/usr/bin/env python\n\nimport platform\nimport sys\n\nBASE_URL = 'http://gh-contractor-zcbenz.s3.amazonaws.com/libchromiumcontent'\nLIBCHROMIUMCONTENT_COMMIT = 'c01b10faf... | python | chosen |
[
{
"from": "system",
"value": "Add additional codes used by server implementation\n"
},
{
"from": "human",
"value": "\n\nclass ResponseCodes(object):\n SUCCESS = 0\n\n USER_CODE_START = 1\n USER_CODE_END = 0x7fffffff\n\n RESERVED_CODE_START = 0x80000000\n MALFORMED_RESPONSE = RESER... | python | chosen |
[
{
"from": "system",
"value": "Update index error in _sort method\n"
},
{
"from": "human",
"value": "\"\"\"Doc string to end all doc strings\"\"\"\n\n\ndef quick_srt(un_list):\n _helper(un_list, 0, len(un_list)-1)\n\n\ndef _helper(un_list, first, last):\n if first < last:\n split = _... | python | chosen |
[
{
"from": "system",
"value": "Test for page existing on master branch\n"
},
{
"from": "human",
"value": "import time\nimport unittest\n\nfrom hamcrest import *\nfrom splinter import Browser\n\nfrom support.stub_server import HttpStub\n\n\nclass test_create_pages(unittest.TestCase):\n\n def se... | python | chosen |
[
{
"from": "system",
"value": "Fix invalid next() call on api result\n"
},
{
"from": "human",
"value": "from dataclasses import dataclass\nfrom typing import List, Tuple\n\nfrom zeus.exceptions import UnknownRevision\nfrom zeus.models import Repository, Revision\nfrom zeus.vcs import vcs_client\n... | python | chosen |
[
{
"from": "system",
"value": "Fix email sending in production environment\n"
},
{
"from": "human",
"value": "from flask_mail import Message\n\nfrom zou.app import mail\n\n\ndef send_email(subject, body, recipient_email, html=None):\n \"\"\"\n Send an email with given subject and body to gi... | python | chosen |
[
{
"from": "system",
"value": "Replace thread killing with SIGALRM\n"
},
{
"from": "human",
"value": "import logging\nimport time\nfrom enum import Enum\nfrom threading import Thread\nfrom typing import NewType\n\nimport _thread\nfrom robot.board import Board\n\nZone = NewType('Zone', int)\n\nLOG... | python | chosen |
[
{
"from": "system",
"value": "Add a method to also easily find what app an api object was found in\n"
},
{
"from": "human",
"value": "from django.conf import settings\nimport importlib\nimport inspect\n\ndef find_api_classes(module, superclass, test=lambda x: True):\n for app in map(lambda x:'%... | python | chosen |
[
{
"from": "system",
"value": "Use json rather than simplejson\n"
},
{
"from": "human",
"value": "import simplejson as json\n\nfrom django.http import HttpResponse\n\nclass JSONResponseMixin(object):\n \"\"\"\n A Mixin that renders context as a JSON response\n \"\"\"\n def render_to_r... | python | chosen |
[
{
"from": "system",
"value": "Add test cases for FieldComponent class.\n"
},
{
"from": "human",
"value": "import numpy as np\nimport pyfds as fds\n\n\ndef test_dimension():\n dim = fds.Dimension(3, 0.1)\n assert np.allclose(dim.vector, np.asarray([0, 0.1, 0.2]))\n assert dim.get_index(0... | python | chosen |
[
{
"from": "system",
"value": "Modify repr of model Essay\n"
},
{
"from": "human",
"value": "from . import db\n\n\nclass Essay(db.Model):\n __tablename__ = 'essays'\n id = db.Column(db.Integer, primary_key=True)\n text = db.Column(db.Text)\n time = db.Column(db.DateTime(True))\n sc... | python | chosen |
[
{
"from": "system",
"value": "Stop trying imports after something has been successfully loaded.\n"
},
{
"from": "human",
"value": "\"\"\"\ndialogKit: easy bake dialogs\n\"\"\"\n\n# determine the environment\ntry:\n import FL\n haveFL = True\nexcept ImportError:\n haveFL = False\ntry:\n ... | python | chosen |
[
{
"from": "system",
"value": "Make the tearDown method of the mpath test case better visible\n\nBy moving it to the beginning of the file.\n"
},
{
"from": "human",
"value": "import unittest\nimport os\n\nfrom utils import create_sparse_tempfile\nfrom gi.repository import BlockDev\nif not BlockDe... | python | chosen |
[
{
"from": "human",
"value": "Add js2xml.parse() method that wraps the slimit visitor/xml-builder\n"
},
{
"from": "gpt",
"value": "import lxml.etree\nfrom slimit.parser import Parser\nfrom js2xml.xmlvisitor import XmlVisitor\n\n_parser = Parser()\n_visitor = XmlVisitor()\n\ndef parse(text, debug=... | python | chosen |
[
{
"from": "system",
"value": "Set sqlalchemy option shortnames to True by default.\n"
},
{
"from": "human",
"value": "# encoding: utf-8\n'''Model in MVC\n\n:requires: `elixir <http://elixir.ematia.de/>`__\n'''\n\n# Ignore the SA string type depr warning\nfrom sqlalchemy.exceptions import SADepre... | python | chosen |
[
{
"from": "system",
"value": "Add test for incorrect password auth view\n"
},
{
"from": "human",
"value": "from tests.scoring_engine.web.web_test import WebTest\n\n\nclass TestAuth(WebTest):\n\n def test_login_page_auth_required(self):\n resp = self.client.get('/login')\n assert... | python | chosen |
[
{
"from": "system",
"value": "Add possibility to set celeryconfig module with ENV[\"CELERY_CONFIG_MODULE\"] + always add celery to INSTALLED_APPS\n"
},
{
"from": "human",
"value": "from celery.loaders.base import BaseLoader\n\nDEFAULT_SETTINGS = {\n \"DEBUG\": False,\n \"DATABASE_ENGINE\":... | python | chosen |
[
{
"from": "system",
"value": "Enable Calendar integration on App Engine deployments\n"
},
{
"from": "human",
"value": "# Copyright (C) 2013 Google Inc., authors, and contributors <see AUTHORS file>\n# Licensed under http://www.apache.org/licenses/LICENSE-2.0 <see LICENSE file>\n# Created By: dan... | python | chosen |
[
{
"from": "system",
"value": "Remove django < 1.4 code\n"
},
{
"from": "human",
"value": "# -*- coding: utf-8 -*-\n# urls.py used as base for developing wirecloud.\n\ntry:\n from django.conf.urls import patterns, include, url\nexcept ImportError: # pragma: no cover\n # for Django version ... | python | chosen |
[
{
"from": "system",
"value": "Add `is_runable` to Producer base class.\n\nSigned-off-by: Michael Markert <5eb998b7ac86da375651a4cd767b88c9dad25896@googlemail.com>\n"
},
{
"from": "human",
"value": "class Producer(object):\n \"\"\"\n Base class for producers. __init__ must be called by inhe... | python | chosen |
[
{
"from": "system",
"value": "Add workaround for failing unlink on Windows"
},
{
"from": "human",
"value": "from __future__ import absolute_import, division, print_function\n\nimport tempfile\nfrom contextlib import contextmanager\nimport os\nimport zlib\n\nfrom mock import MagicMock\n\nfrom ...... | python | chosen |
[
{
"from": "system",
"value": "Add missing import of the exporters module\n"
},
{
"from": "human",
"value": "from .interface import get_method\nfrom .archive import *\nfrom .importers import *\nfrom .readers import *\n"
},
{
"from": "gpt",
"value": "from .interface import get_method\n... | python | chosen |
[
{
"from": "system",
"value": "Update org URL for issue linkage\n"
},
{
"from": "human",
"value": "#!/usr/bin/env python3\n# -*- coding: utf-8 -*-\n\nimport setuptools_scm\n\nextensions = [\n 'sphinx.ext.autodoc',\n 'rst.linker',\n]\n\n# General information about the project.\nproject = 'py... | python | chosen |
[
{
"from": "system",
"value": "Fix doc building endpoint for gettext."
},
{
"from": "human",
"value": "import os\n\nfrom nova import utils\n\ndef setup(app):\n rootdir = os.path.abspath(app.srcdir + '/..')\n print \"**Autodocumenting from %s\" % rootdir\n rv = utils.execute('cd %s && ./g... | python | chosen |
[
{
"from": "system",
"value": "Allow people to send messages in our basic HelloWorldWidget demo\n"
},
{
"from": "human",
"value": "from moksha.api.widgets.live import LiveWidget\n\nclass HelloWorldWidget(LiveWidget):\n topic = \"helloworld\"\n template = \"\"\"\n <b>Hello World Widge... | python | chosen |
[
{
"from": "system",
"value": "Fix test for Elm files lookup\n"
},
{
"from": "human",
"value": "from django.test import TestCase\nfrom webassets.bundle import get_all_bundle_files\n\nfrom jarbas.frontend.assets import elm\n\n\nclass TestDependencies(TestCase):\n\n def test_dependencies(self):\... | python | chosen |
[
{
"from": "system",
"value": "Make test script more extensive (conda, notebook, matplotlib)\n"
},
{
"from": "human",
"value": "#!/usr/bin/env python\n\nfrom sys import exit\n\ntry:\n import sympy\nexcept ImportError:\n print(\"SymPy must be installed for the tutorial\")\n\nif sympy.__versi... | python | chosen |
[
{
"from": "system",
"value": "Remove code which automatically created settings objects on server launch\n"
},
{
"from": "human",
"value": "from django.apps import AppConfig\nfrom django.db.utils import OperationalError, ProgrammingError, IntegrityError\n\n\nclass CommonConfig(AppConfig):\n na... | python | chosen |
[
{
"from": "system",
"value": "Comment out the debug tool bar\n"
},
{
"from": "human",
"value": "from settings_common import *\n\nDEBUG = TEMPLATE_DEBUG = True\n\nDATABASE_ENGINE = 'postgresql_psycopg2'\nDATABASE_NAME = 'daisyproducer_dev'\nDATABASE_USER = 'eglic'\nDATABASE_PASSWORD = ''\n\nDAISY... | python | chosen |
[
{
"from": "system",
"value": "Work on testing, bulk indexing, etc\n"
},
{
"from": "human",
"value": "from django.core import management\nimport pytest\nfrom model_mommy import mommy\nimport time\n\nfrom example.app.models import SimpleObject\n\n\n@pytest.mark.django_db\ndef test_get(es_client):\... | python | chosen |
[
{
"from": "system",
"value": "Add volume claims to scheduler\n"
},
{
"from": "human",
"value": "from polyaxon.config_settings.cors import *\nfrom polyaxon.config_settings.dirs import *\nfrom polyaxon.config_settings.k8s import *\nfrom polyaxon.config_settings.spawner import *\nfrom polyaxon.conf... | python | chosen |
[
{
"from": "system",
"value": "Remove call to setTimeout and use callLater instead.\n"
},
{
"from": "human",
"value": "# coding: utf-8\nfrom twisted.internet.defer import DeferredQueue\n\nclass Empty(Exception):\n pass\n\nclass Closed(Exception):\n pass\n\nclass TimeoutDeferredQueue(Deferre... | python | chosen |
[
{
"from": "system",
"value": "Check at least one file was provided\n"
},
{
"from": "human",
"value": "#!/usr/bin/python\nfrom style_grader_functions import *\n\n#TODO: Set up standard error to print properly\ndef main():\n student_file_names = get_arguments(sys.argv[1:])\n sys.stderr = cod... | python | chosen |
[
{
"from": "system",
"value": "Fix imports for Django >= 1.6\n"
},
{
"from": "human",
"value": "from django.conf.urls.defaults import patterns, url\n\nurlpatterns = patterns(\n 'goog.views',\n url('^__goog__/(?P<path>.*)$', 'serve_closure',\n name='goog_serve_closure'),\n # FIXME(... | python | chosen |
[
{
"from": "system",
"value": "Add test fixture for docker tests\n"
},
{
"from": "human",
"value": "import docker\n\nfrom webcomix.docker import DockerManager\n\ndef test_no_javascript_spawns_no_container():\n manager = DockerManager(False)\n manager.__enter__()\n manager.client = docker... | python | chosen |
[
{
"from": "system",
"value": "Replace old config IDs with the new ones\n"
},
{
"from": "human",
"value": "from __future__ import absolute_import, print_function, unicode_literals\n\nfrom django.core.management import BaseCommand\n\nfrom corehq.apps.app_manager.dbaccessors import get_build_doc_by... | python | chosen |
[
{
"from": "system",
"value": "Make sure that 'stop' works from everywhere"
},
{
"from": "human",
"value": "\"\"\"\n\nVery basic implementation of an event loop\n==========================================\n\nThe eventloop is a singleton to schedule and run events.\n\nExports\n-------\n\n- ``Event... | python | chosen |
[
{
"from": "system",
"value": "Add a missing test for param-parsing\n"
},
{
"from": "human",
"value": "from django.test import TestCase\nfrom django.db import OperationalError\n\n\nclass ApiTestUtils(TestCase):\n def test_db_timeout(self):\n from api.view_utils import db_timeout\n\n ... | python | chosen |
[
{
"from": "human",
"value": "Add function to load data from nodes files\n"
},
{
"from": "gpt",
"value": "import os\nimport json\n\nfrom kitchen.settings import KITCHEN_LOCATION\n\ndef load_nodes():\n retval = {}\n nodes_dir = os.path.join(KITCHEN_LOCATION, 'nodes')\n for filename in os.... | python | chosen |
[
{
"from": "system",
"value": "Sort files before choosing one to upload\n"
},
{
"from": "human",
"value": "#!/usr/bin/python3\n\nfrom __future__ import print_function\n\nimport os\nimport time\nimport subprocess\nimport sys\n\nWAIT = 30\n\ndef main():\n directory = sys.argv[1]\n url = os.en... | python | chosen |
[
{
"from": "system",
"value": "Move module level import to top of file (PEP8)\n\nError: E402 module level import not at top of file\n"
},
{
"from": "human",
"value": "from pkg_resources import get_distribution\n\n__version__ = get_distribution('serfclient').version\n\nfrom serfclient.client impor... | python | chosen |
[
{
"from": "system",
"value": "Increment the version in the test too\n"
},
{
"from": "human",
"value": "# coding=UTF-8\nfrom squarespace import Squarespace\n\n\ndef test_squarespace():\n store = Squarespace('test')\n assert store.api_key == 'test'\n assert store.useragent == 'Squarespace... | python | chosen |
[
{
"from": "system",
"value": "Change from is_Stepping to is_Derived wherever appropriate\n"
},
{
"from": "human",
"value": "from devito import SubsampledDimension, Grid, TimeFunction, Eq, Operator\nfrom devito.tools import pprint\n\n\ndef test_subsampled_dimension():\n nt = 10\n grid = Gri... | python | chosen |
[
{
"from": "system",
"value": "Use readline() instead of next() to detect changes.\n\ntilequeue/queue/file.py\n\t-`readline()` will pick up new lines appended to the file,\n\twhereas `next()` will not since the iterator will just hit\n\t`StopIteration` and stop generating new lines. Use `readline()`\n\tinste... | python | chosen |
[
{
"from": "system",
"value": "Add ImposterBase mixin class so we can add methods and properties to the sqlalchemy based models\n"
},
{
"from": "human",
"value": "from sqlalchemy import create_engine\nfrom sqlalchemy.orm import scoped_session, sessionmaker\nfrom sqlalchemy.ext.declarative import ... | python | chosen |
[
{
"from": "system",
"value": "auditlog: Remove pre_init_hook reference from openerp, no pre_init hook exists any more\n"
},
{
"from": "human",
"value": "# -*- coding: utf-8 -*-\n# © 2015 ABF OSIELL <http://osiell.com>\n# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).\n\n{\n 'na... | python | chosen |
[
{
"from": "system",
"value": "Remove unused import of pytest\n"
},
{
"from": "human",
"value": "import pytest\n\nfrom serfclient import result\n\n\nclass TestSerfResult(object):\n def test_initialises_to_none(self):\n r = result.SerfResult()\n assert r.head is None\n asse... | python | chosen |
[
{
"from": "system",
"value": "Use SQLite in an attempt to speed up the tests.\n"
},
{
"from": "human",
"value": "# -*- coding: utf-8 -*-\nfrom .base import Base as Settings\n\n\nclass Testing(Settings):\n # Database Configuration.\n # -------------------------------------------------------... | python | chosen |
[
{
"from": "system",
"value": "Set session cookie flag `SameSite` to `Lax` (instead of `None`)\n"
},
{
"from": "human",
"value": "\"\"\"\nbyceps.config_defaults\n~~~~~~~~~~~~~~~~~~~~~~\n\nDefault configuration values\n\n:Copyright: 2006-2021 Jochen Kupperschmidt\n:License: Revised BSD (see `LICEN... | python | chosen |
[
{
"from": "system",
"value": "Add a M2M table for the subscription relation between users and comics\n"
},
{
"from": "human",
"value": "import uuid\n\nfrom django.contrib.auth.models import User\nfrom django.db import models\nfrom django.dispatch import receiver\n\nfrom comics.core.models import... | python | chosen |
[
{
"from": "system",
"value": "REFACTOR : Removed unnecessary code.\n"
},
{
"from": "human",
"value": "from hitchstory import utils, exceptions\nfrom ruamel.yaml.comments import CommentedMap, CommentedSeq\n\n\nclass Arguments(object):\n \"\"\"A null-argument, single argument or group of argume... | python | chosen |
[
{
"from": "system",
"value": "Fix errors in test file\n\nFix errors and typos in 'test_queue.py'\n"
},
{
"from": "human",
"value": "#!/usr/bin/env python\n# -*- coding: utf-8 -*-\n\"\"\"A series of pytest tests to test the quality\nof our Queue class and its methods\n\"\"\"\n\nfrom __future__ im... | python | chosen |
[
{
"from": "system",
"value": "Add test for pop and adjust element init test\n"
},
{
"from": "human",
"value": "import pytest\nfrom stack import Element\nfrom stack import Stack\n\n\ndef test_element_init():\n n = Element()\n assert n.val is None\n assert n.next is None\n n = Element(... | python | chosen |
[
{
"from": "system",
"value": "Allow apps to be specified from the command line\n"
},
{
"from": "human",
"value": "import os\n\nos.environ['DJANGO_SETTINGS_MODULE'] = 'tests.settings'\n\nfrom django.core import management\nmanagement.call_command('test', 'resources', 'forms', 'tokens')\n"
},
... | python | chosen |
[
{
"from": "system",
"value": "Add TASK_QUEUED to default notifier events\n"
},
{
"from": "human",
"value": "from __future__ import absolute_import\n\n__all__ = ['Notifier', 'NotifierEvent']\n\n\nclass NotifierEvent(object):\n TASK_STARTED = 0\n TASK_FINISHED = 1\n TASK_QUEUED = 2\n\n\nc... | python | chosen |
[
{
"from": "system",
"value": "[CHORE] Add authorization and content-type headers to request for tests\n"
},
{
"from": "human",
"value": "import unittest\nfrom app import create_app, db\n\n\nclass Base(unittest.TestCase):\n def setUp(self):\n self.app = create_app(\"testing\")\n ... | python | chosen |
[
{
"from": "system",
"value": "Update expected number of tas statements in test\n"
},
{
"from": "human",
"value": "from indra.sources.tas import process_from_web\n\n\ndef test_processor():\n tp = process_from_web(affinity_class_limit=10)\n assert tp\n assert tp.statements\n num_stmts ... | python | chosen |
[
{
"from": "system",
"value": "Fix proxy URIs with credentials in them\n"
},
{
"from": "human",
"value": "#!/usr/bin/python\n\n\"\"\"\nSet the firewall to allow access to configured HTTP(S) proxies.\nThis is only necessary until rBuilder handles the EC2 image posting\nand registration process.\n\... | python | chosen |
[
{
"from": "system",
"value": "Add string representation to GuestPair\n\nSigned-off-by: Jan Losinski <577c4104c61edf9f052c616c0c23e67bef4a9955@wh2.tu-dresden.de>\n"
},
{
"from": "human",
"value": "from _pymue import peng, Team, DistanceMatrix, SeenTable, GuestTupleGenerator\n"
},
{
"from"... | python | chosen |
[
{
"from": "system",
"value": "Tag an image based on detected visual content"
},
{
"from": "human",
"value": "import requests\nimport json\n\n# Tag an image based on detected visual content which mean running a CNN on top of it.\n# https://pixlab.io/#/cmd?id=tagimg for more info.\n\n# Target Imag... | python | chosen |
[
{
"from": "system",
"value": "Use Python 3.6 compatible API for threading\n"
},
{
"from": "human",
"value": "import spark\nimport motion\nfrom bot import process_command\nfrom config import config\nfrom flask import Flask\nfrom flask import request\nfrom flask import jsonify\nfrom threading impo... | python | chosen |
[
{
"from": "system",
"value": "Remove dataframe error we were testing\n"
},
{
"from": "human",
"value": "### Import our stuff\nimport matplotlib.pyplot as plt\nimport numpy as np\nimport pandas as pd\n\n### Set up initial values\nposition = 555 # feet\nvelocity = 0 # feet/second\nacceleration = -... | python | chosen |
[
{
"from": "system",
"value": "Create permission for admin and user can access GET, PUT, DELETE method, user can access is instance only\n"
},
{
"from": "human",
"value": "from rest_framework import permissions\n\nclass CustomUserAPIPermission(permissions.BasePermission):\n \"\"\"\n Set cus... | python | chosen |
[
{
"from": "system",
"value": "Choose tip from *all* results.\n\nBefore, we were just choosing from the first page of results. Now, we perform\na query to get the full number of results, calculate the page number and\nposition on the page of a random result, and then pull that result for the\ntip.\n"
},
... | python | chosen |
[
{
"from": "system",
"value": "Add heroku app url to ALLOWED_HOSTS\n"
},
{
"from": "human",
"value": "from .base_settings import *\nimport dj_database_url\nimport os\n\nALLOWED_HOSTS = ['0.0.0.0']\n\ndb_from_env = dj_database_url.config(conn_max_age=500)\nDATABASES['default'].update(db_from_env)\... | python | chosen |
[
{
"from": "system",
"value": "Allow importing oscar_adyen.mixins without importing oscar_adyen.views\n"
},
{
"from": "human",
"value": "# -*- coding: utf-8 -*-\n\nfrom __future__ import unicode_literals\n\nfrom django.conf.urls import url\n\nfrom django_adyen import urlpatterns\n\nfrom . import ... | python | chosen |
[
{
"from": "system",
"value": "Add param doc of SAEKVStorage\n"
},
{
"from": "human",
"value": "# -*- coding: utf-8 -*-\n\nfrom . import SessionStorage\n\n\nclass SaeKVDBStorage(SessionStorage):\n \"\"\"\n SaeKVDBStorage 使用SAE 的 KVDB 来保存你的session ::\n\n import werobot\n from w... | python | chosen |
[
{
"from": "system",
"value": "Use the default 404/500 handlers for i.cc.net.\n"
},
{
"from": "human",
"value": "from django.conf.urls.defaults import patterns, include, handler500, url\nfrom django.conf import settings\n\nfrom django.contrib import admin\n\nhandler500 # Pyflakes\n\nurlpatterns =... | python | chosen |
[
{
"from": "system",
"value": "Add SecureModeRedirectURL attribute to PayInExecutionDetailsDirect\n"
},
{
"from": "human",
"value": "from mangopaysdk.types.payinexecutiondetails import PayInExecutionDetails\n\n\nclass PayInExecutionDetailsDirect(PayInExecutionDetails):\n \n def __init__... | python | chosen |
[
{
"from": "system",
"value": "Add hub user info to page\n"
},
{
"from": "human",
"value": "from .labapp import LabApp\n\ntry:\n from jupyterhub.singleuser import SingleUserNotebookApp\nexcept ImportError:\n SingleUserLabApp = None\n raise ImportError('You must have jupyterhub installed ... | python | chosen |
[
{
"from": "system",
"value": "Add a method for plugins to add their own URL handlers\n"
},
{
"from": "human",
"value": "import asyncio\nimport re\n\nimport aiohttp\nimport lxml.html\n\nfrom seabird.plugin import Plugin\n\n\nclass URLPlugin(Plugin):\n url_regex = re.compile(r'https?://[^ ]+')\... | python | chosen |
[
{
"from": "system",
"value": "Add all documented result codes\n"
},
{
"from": "human",
"value": "\"\"\"\nConstants used to make the VWS mock and wrapper.\n\"\"\"\n\nfrom constantly import ValueConstant, Values\n\n\nclass ResultCodes(Values):\n \"\"\"\n Constants representing various VWS re... | python | chosen |
[
{
"from": "system",
"value": "Add NOQA to make flake8 happy\n"
},
{
"from": "human",
"value": "\"\"\"\nThese settings are used by the ``manage.py`` command.\n\nWith normal tests we want to use the fastest possible way which is an\nin-memory sqlite database but if you want to create South migrati... | python | chosen |
[
{
"from": "system",
"value": "Fix usage of `url_title` in TeamAdmin.\n"
},
{
"from": "human",
"value": "from cms.admin import PageBaseAdmin, SearchMetaBaseAdmin\nfrom django.contrib import admin\n\nfrom .models import Person, Team\n\n\n@admin.register(Person)\nclass PersonAdmin(SearchMetaBaseAdm... | python | chosen |
[
{
"from": "system",
"value": "Update usage string for min\n"
},
{
"from": "human",
"value": "\"\"\"calc.py: A simple calculator.\"\"\"\n\nimport sys\n\ndef add_all(nums):\n return sum(nums)\n\ndef multiply_all(nums):\n return reduce(lambda a, b: a * b, nums)\n\nif __name__ == '__main__':\n... | python | chosen |
[
{
"from": "system",
"value": "Reduce frequency to 10 Hz instead of 2.\n"
},
{
"from": "human",
"value": "#!/usr/bin/env python\n# -*- coding: utf-8 -*-\n# (C) 2015 Jean Nassar\n# Released under BSD version 4\n\"\"\"\nReduce /ardrone/image_color framerate from 30 Hz to 2 Hz.\n\n\"\"\"\nimport ro... | python | chosen |
[
{
"from": "system",
"value": "Use proper cache directory in error view\n\nFixes #1254\n\nSigned-off-by: Adam Stokes <49c255c1d074742f60d19fdba5e2aa5a34add567@users.noreply.github.com>\n"
},
{
"from": "human",
"value": "from ubuntui.frame import Frame # noqa\nfrom ubuntui.views import ErrorView\... | python | chosen |
[
{
"from": "system",
"value": "Drop the TLS tests for a moment to see if we can get a success for timing.\n"
},
{
"from": "human",
"value": "from kat.harness import Runner\n\nfrom abstract_tests import AmbassadorTest\n\n# Import all the real tests from other files, to make it easier to pick and c... | python | chosen |
[
{
"from": "system",
"value": "Bump minor version to 0.5.0\n"
},
{
"from": "human",
"value": "#!/usr/bin/env python\n# -*- coding: utf-8 -*-\n\n__version__ = '0.4.6'\n"
},
{
"from": "gpt",
"value": "#!/usr/bin/env python\n# -*- coding: utf-8 -*-\n\n__version__ = '0.5.0'\n"
}
] | python | chosen |
[
{
"from": "system",
"value": "Disable SQLALCHEMY_TRACK_MODIFICATIONS to fix deprecation warning and meet recommendation\n"
},
{
"from": "human",
"value": "from flask import Flask\nfrom flask_talisman import Talisman\nfrom flask_seasurf import SeaSurf\nfrom redditflair.redditflair import redditfl... | python | chosen |
[
{
"from": "system",
"value": "Remove unused import in test\n"
},
{
"from": "human",
"value": "import urlparse\n\nfrom django.test import TestCase, override_settings\nfrom django.conf import settings\nfrom mock import patch, Mock\n\nfrom opendebates.context_processors import global_vars\nfrom ope... | python | chosen |
[
{
"from": "system",
"value": "Set def arguments to immutable to avoid nasty side effect.\n"
},
{
"from": "human",
"value": "# Last Change: Sat Jun 09 07:00 PM 2007 J\n\n#========================================================\n# Constants used throughout the module (def args, etc...)\n#========... | python | chosen |
[
{
"from": "system",
"value": "Use field name instead of field instance\n"
},
{
"from": "human",
"value": "from django.db import models\nfrom location_field.models.plain import PlainLocationField\n\n\nclass Place(models.Model):\n parent_place = models.ForeignKey('self', null=True, blank=True)\... | python | chosen |
[
{
"from": "system",
"value": "Modify and add tests for the revised connection.close\n"
},
{
"from": "human",
"value": "from unittest import mock\n\nimport pytest\n\nimport aiozk.connection\n\n\n@pytest.fixture\ndef connection(event_loop):\n connection = aiozk.connection.Connection(\n h... | python | chosen |
[
{
"from": "system",
"value": "Create table \"tests\" as well\n"
},
{
"from": "human",
"value": "# -*- coding: utf-8 -*-\n\ndef init_db():\n from cms.db import Base\n from .socialtask import SocialTask\n from .socialuser import SocialUser\n\n # Issue CREATE queries\n Base.metadata.... | python | chosen |
[
{
"from": "system",
"value": "Change dict declaration to inline\n"
},
{
"from": "human",
"value": "from __future__ import print_function, unicode_literals\n\nimport logging\n\nfrom celery.task import task\nfrom temba.orgs.models import Org\nfrom .models import Chatbase\n\n\nlogger = logging.getL... | python | chosen |
[
{
"from": "system",
"value": "Fix GenericForeignKey typo in examples"
},
{
"from": "human",
"value": "from __future__ import unicode_literals\n\nfrom django.db import models\nfrom django.contrib.contenttypes.models import ContentType\nfrom django.contrib.contenttypes.fields import GenericForeign... | python | chosen |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.