conversations listlengths 2 3 | source stringclasses 1 value | stack stringclasses 1 value |
|---|---|---|
[
{
"from": "system",
"value": "Use variable module instead of var_init\n"
},
{
"from": "human",
"value": "import tensorflow as tf\n\nfrom .. import var_init\n\n\n\ndef embeddings(*, id_space_size, embedding_size):\n return tf.Variable(var_init.normal([id_space_size, embedding_size]))\n"
},
{... | python | chosen |
[
{
"from": "system",
"value": "Make freeling configuration available independent of execution path\n"
},
{
"from": "human",
"value": "#!/usr/bin/env python3\n\nfrom subprocess import Popen, PIPE\nimport subprocess as subp\nimport json\nimport re\n\nregex = re.compile('}\\s*{')\n\ndef parse (sente... | python | chosen |
[
{
"from": "system",
"value": "Add support for -debug=true when testing clouds. --debug is still unsafe.\nWe need to redirect sdtout to a log."
},
{
"from": "human",
"value": "#!/usr/bin/env python\n__metaclass__ = type\n\n\nfrom argparse import ArgumentParser\nimport subprocess\nimport sys\n\nfr... | python | chosen |
[
{
"from": "system",
"value": "Use format for string formatting\n"
},
{
"from": "human",
"value": "from django.conf import settings\n\nimport factory\nfrom factory.fuzzy import FuzzyText\n\nfrom ..models import Book, BookSpecimen\n\n\nclass BookFactory(factory.django.DjangoModelFactory):\n tit... | python | chosen |
[
{
"from": "system",
"value": "Speed up the telnet process for HORIZONS\n\nBe very patient waiting for the other end to start its reply, but then\nonly wait 1s for the rest of the data.\n"
},
{
"from": "human",
"value": "#!/usr/bin/env python2.7\n\n#import argparse\nfrom telnetlib import Telnet\n... | python | chosen |
[
{
"from": "system",
"value": "Use -platform:anycpu while compiling .NET assemblies\n\ngit-svn-id: 8d82213adbbc6b1538a984bace977d31fcb31691@349 2f5d681c-ba19-11dd-a503-ed2d4bea8bb5\n"
},
{
"from": "human",
"value": "import os.path\nimport SCons.Builder\nimport SCons.Node.FS\nimport SCons.Util\n\n... | python | chosen |
[
{
"from": "system",
"value": "Add note regarding use of bool in validation\n"
},
{
"from": "human",
"value": "import re\n\n\nclass InvalidBoard(ValueError):\n pass\n\n\ndef board(b):\n if not is_valid_board(b):\n raise InvalidBoard(\"Board is malformed and thus invalid\")\n b = [... | python | chosen |
[
{
"from": "system",
"value": "Fix mistaken document about token pos\n"
},
{
"from": "human",
"value": "\nclass Token:\n\t\"\"\"\n\tIndividual word with lemma, part-of-speech and location in text.\n\t\n\t:ivar word: Unprocessed word\n\t:ivar lemma: Lemmatized word\n\t:ivar partofspeech: Part-of-s... | python | chosen |
[
{
"from": "system",
"value": "Add a doc to the migration\n\nThis should probably be encoded better somehow.\n"
},
{
"from": "human",
"value": "from __future__ import unicode_literals\n\nfrom django.db import models, migrations\n\n\nclass Migration(migrations.Migration):\n\n dependencies = [\n... | python | chosen |
[
{
"from": "system",
"value": "Update datetime with timezone\nadd more print statements for debugging\n"
},
{
"from": "human",
"value": "import datetime\n\nfrom django.core.management.base import BaseCommand\n\nfrom oysterapp.oyster.models import TaskRule\n\n\nclass Command(BaseCommand):\n hel... | python | chosen |
[
{
"from": "system",
"value": "Create a collect method for get droppable items\n"
},
{
"from": "human",
"value": "\n\nclass Prepare(object):\n \"\"\"\n Prepare the champions for the battle!\n\n Usage:\n hero = Prepare(name=\"Aragorn\", base_attack=100, base_hp=100)\n or like th... | python | chosen |
[
{
"from": "system",
"value": "Remove unused icons of the PlotWindow\n"
},
{
"from": "human",
"value": "# coding: utf-8\n\nfrom silx.gui.plot import PlotWindow\n\nclass PlotWidget(PlotWindow):\n def __init__(self, *args):\n super(PlotWidget, self).__init__()\n self.setActiveCurve... | python | chosen |
[
{
"from": "system",
"value": "Update copyright check to accept a new, more inclusive, copyright.\n\nIn order to address concerns over community copyright of the source code they modify. All authors are still subject to the terms of the CLA they sign when contributing.\n\nThis new format was approved by Micr... | python | chosen |
[
{
"from": "system",
"value": "Move font size in the theme\n"
},
{
"from": "human",
"value": "import gtk\n\nfrom sugar.graphics.grid import Grid\n\nsettings = gtk.settings_get_default()\n\ngrid = Grid()\nsizes = 'gtk-large-toolbar=%d, %d' % (grid.dimension(1), grid.dimension(1))\nsettings.set_str... | python | chosen |
[
{
"from": "system",
"value": "Handle failing to publish to pulse\n"
},
{
"from": "human",
"value": "\"\"\"\nThis module is currently an experiment in publishing messages to pulse.\n\nIt might become a real pulse publisher one day.\n\"\"\"\nimport os\nimport sys\n\nfrom pulse_actions.authenticati... | python | chosen |
[
{
"from": "system",
"value": "joystick: Add missing '* ' in example\n\nSigned-off-by: Francois Berder <59eaf4bb0211c66c3d7532da6d77ecf42a779d82@outlook.fr>\n"
},
{
"from": "human",
"value": "#!/usr/bin/env python3\n\"\"\"This example shows how to use the Joystick Click wrapper of the LetMeCreate... | python | chosen |
[
{
"from": "system",
"value": "Implement 2019 day 13 part 2\n"
},
{
"from": "human",
"value": "from typing import TextIO\n\nfrom aoc2019.intcode import Computer, read_program\n\n\ndef part1(data: TextIO) -> int:\n computer = Computer(read_program(data))\n\n computer.run()\n\n screen = {}... | python | chosen |
[
{
"from": "system",
"value": "Use XCHAINER_TEST_CUDA_LIMIT env int pytest\n"
},
{
"from": "human",
"value": "import pytest\n\n\ndef pytest_addoption(parser):\n _add_cuda_option(parser)\n\n\ndef pytest_configure(config):\n _register_cuda_marker(config)\n\n\ndef pytest_runtest_setup(item):\n... | python | chosen |
[
{
"from": "system",
"value": "Fix legacy use of action result\n"
},
{
"from": "human",
"value": "#!/usr/bin/env python\n#\n# Get the sysdig secure user rules file.\n#\n\nimport os\nimport sys\nsys.path.insert(0, os.path.join(os.path.dirname(os.path.realpath(sys.argv[0])), '..'))\nfrom sdcclient ... | python | chosen |
[
{
"from": "system",
"value": "Mark feedback comments starting with a html tag as spammy\n"
},
{
"from": "human",
"value": "from django.shortcuts import render_to_response\nfrom django.template import RequestContext\nfrom django.views.decorators.csrf import csrf_protect\n\nfrom models import Feed... | python | chosen |
[
{
"from": "system",
"value": "Allow prefixed templates for different cart types\n"
},
{
"from": "human",
"value": "from django.core.urlresolvers import reverse\nfrom django.http import HttpResponseRedirect\nfrom django.views.generic.simple import direct_to_template\nfrom . import models\nfrom . ... | python | chosen |
[
{
"from": "system",
"value": "Set period to 24 hours now that it works\n"
},
{
"from": "human",
"value": "\"\"\"Updates atom feeds.\"\"\"\r\nimport datetime\r\nimport time\r\n\r\nimport db\r\nimport tools\r\n\r\n\r\n# Time in seconds between re-processing a domain.\r\nPERIOD = 60#86400\r\n\r\n\r... | python | chosen |
[
{
"from": "system",
"value": "Improve the examples in the package root docstring\n"
},
{
"from": "human",
"value": "# -*- coding: utf-8 -*-\n\"\"\"Easy network discovery & messaging\n\nAimed at a classrom or club situation, networkzero makes it simpler to\nhave several machines or several proces... | python | chosen |
[
{
"from": "system",
"value": "Add short description to edge filter example\n"
},
{
"from": "human",
"value": "import matplotlib.pyplot as plt\n\nfrom skimage.data import camera\nfrom skimage.filter import roberts, sobel\n\nimage = camera()\nedge_roberts = roberts(image)\nedge_sobel = sobel(image... | python | chosen |
[
{
"from": "system",
"value": "Revert \"Create GEM filter to get BBM App ID\"\n\nThis reverts commit 2805eb26865d7a12cbc0e6f7a71dbd99ba49224e.\n"
},
{
"from": "human",
"value": "from django.template import Library\nfrom django.conf import settings\n\nfrom gem.models import GemSettings\n\nregister... | python | chosen |
[
{
"from": "system",
"value": "Fix url reversing in Python 3\n"
},
{
"from": "human",
"value": "\"\"\"\nDjango Storage interface\n\"\"\"\nfrom django.core.files.storage import FileSystemStorage\nfrom django.core.urlresolvers import reverse_lazy\nfrom . import appconfig\n\n__all__ = (\n 'privat... | python | chosen |
[
{
"from": "system",
"value": "Configure graceful_timeout to actually do something\n"
},
{
"from": "human",
"value": "import multiprocessing\nfrom os import getenv\nbind = '127.0.0.1:8001'\n\nworkers = multiprocessing.cpu_count() * 3\n# graceful_timeout = 600\n# timeout = 60\nthreads = multiproce... | python | chosen |
[
{
"from": "system",
"value": "Add tests for numbers 11 to 19"
},
{
"from": "human",
"value": "import unittest\nfrom number_to_words import NumberToWords\n\n\nclass TestNumberToWords(unittest.TestCase):\n def setUp(self):\n self.n2w = NumberToWords()\n\n def tearDown(self):\n ... | python | chosen |
[
{
"from": "system",
"value": "Fix api mobile only with geotrek flatpages trekking tourism\n"
},
{
"from": "human",
"value": "from __future__ import unicode_literals\n\nfrom django.conf import settings\nfrom django.conf.urls import url, include\nfrom rest_framework import routers\n\nfrom geotrek.... | python | chosen |
[
{
"from": "system",
"value": "Add some methods to employee api, delete needs more work\n"
},
{
"from": "human",
"value": "# -*- coding: utf-8 -*-\n\nfrom flask import jsonify, request, url_for\nfrom nbs.models import Employee, AttendanceRecord\nfrom nbs.schema import EmployeeSchema, AttendanceRe... | python | chosen |
[
{
"from": "system",
"value": "Add : database handler list and del methods\n"
},
{
"from": "human",
"value": "import os\nimport md5\nimport leveldb\n\n\nclass DatabasesHandler(dict):\n def __init__(self, dest, *args, **kwargs):\n self['index'] = {}\n self.dest = dest\n sel... | python | chosen |
[
{
"from": "system",
"value": "Change the default logging level to error\n"
},
{
"from": "human",
"value": "import logging\n\nimport click\n\nfrom detectem.response import get_har\nfrom detectem.plugin import load_plugins\nfrom detectem.core import Detector\n\n# Set up logging\nlogger = logging.g... | python | chosen |
[
{
"from": "system",
"value": "Add both domains to hostsfile.\n"
},
{
"from": "human",
"value": "\"\"\"\nDynamic host file management.\n\"\"\"\nimport docker\nfrom subprocess import call\nimport re\n\n\ndef refresh():\n \"\"\"\n Ensure that all running containers have a valid entry in /etc/... | python | chosen |
[
{
"from": "system",
"value": "Include directory name for python 2 compatibility\n"
},
{
"from": "human",
"value": "import os\nimport sys\n\nfrom .. import run_nbgrader, run_command\nfrom .base import BaseTestApp\n\n\nclass TestNbGrader(BaseTestApp):\n\n def test_help(self):\n \"\"\"Doe... | python | chosen |
[
{
"from": "system",
"value": "Use .views instead of views\n"
},
{
"from": "human",
"value": "from django.conf.urls import patterns, url\n\nfrom views import ajax_render\n\nurlpatterns = patterns(\n '',\n url(r'^render/(?P<plugin_id>[-\\w]+)/$', ajax_render, name='ajax-render')\n)\n"
},
... | python | chosen |
[
{
"from": "system",
"value": "Fix for matrixmultiply != dot on Numeric < 23.4\n"
},
{
"from": "human",
"value": "\nfrom info_scipy_base import __doc__\nfrom scipy_base_version import scipy_base_version as __version__\n\nfrom ppimport import ppimport, ppimport_attr\n\n# The following statement is... | python | chosen |
[
{
"from": "system",
"value": "Add Verbose name plurar for inbox and __str__ method\n"
},
{
"from": "human",
"value": "from django.db import models\nfrom django.utils.encoding import python_2_unicode_compatible\nfrom django.utils import timezone\n\nfrom .compat import AUTH_USER_MODEL\nfrom .setti... | python | chosen |
[
{
"from": "system",
"value": "Add importorskip('asdf') to test for TimeDelta tag\n"
},
{
"from": "human",
"value": "# Licensed under a 3-clause BSD style license - see LICENSE.rst\n# -*- coding: utf-8 -*-\n\nimport pytest\n\nfrom asdf.tests.helpers import assert_roundtrip_tree\n\nfrom astropy.ti... | python | chosen |
[
{
"from": "system",
"value": "Delete test db after a run\n"
},
{
"from": "human",
"value": "#!/usr/bin/python\n\nimport unittest\n\nimport pentai.base.t_all as b_t\nimport pentai.ai.t_all as ai_t\nimport pentai.db.t_all as db_t\nimport pentai.db.zodb_dict as z_m\n\nimport os\n\ndef suite():\n ... | python | chosen |
[
{
"from": "system",
"value": "Load code paths into the fedmsg dict.\n"
},
{
"from": "human",
"value": "import socket\nhostname = socket.gethostname().split('.')[-1]\n\nconfig = {\n # Consumer stuff\n \"fmn.consumer.enabled\": True,\n \"fmn.sqlalchemy.uri\": \"sqlite:////var/tmp/fmn-dev-... | python | chosen |
[
{
"from": "system",
"value": "Add functions to process tweets\n"
},
{
"from": "human",
"value": "__author__ = 'Antony Cherepanov'\n\nimport tweepy\nfrom src import dbhandler\nfrom src import generator\n\n\nclass RandBot(object):\n def __init__(self):\n self.db = dbhandler.DBHandler()\n... | python | chosen |
[
{
"from": "system",
"value": "Remove lines that cause error in Sublime Text console\n\nLogs:\n\npuglint: Defining 'cls.version_args' has no effect. Please cleanup and remove this setting.\npuglint: Defining 'cls.version_re' has no effect. Please cleanup and remove this setting.\npuglint: Defining 'cls.versi... | python | chosen |
[
{
"from": "system",
"value": "Add cart quantity exception, remove old handler\n"
},
{
"from": "human",
"value": "from django.conf import settings\nfrom django.core.exceptions import ImproperlyConfigured\n\nfrom .handler import AddToCartHandler\n\nadd_to_cart_handler = AddToCartHandler('cart')\n\... | python | chosen |
[
{
"from": "system",
"value": "Fix crash when no commandline args are passed\n\nRegression from 3513da19363b8b4564f199b469d13486996ede57\n"
},
{
"from": "human",
"value": "# Copyright 2017 Codethink Ltd.\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may not use th... | python | chosen |
[
{
"from": "system",
"value": "Use builtin function to find last month\n"
},
{
"from": "human",
"value": "from datetime import timedelta\nfrom datetime import date\n\n\ndef diff_month(d1: date, d2: date) -> int:\n \"\"\"Calculate the difference in months ignoring the days\n\n If d1 > d2, th... | python | chosen |
[
{
"from": "system",
"value": "Use collection instead of project\n"
},
{
"from": "human",
"value": "from django import dispatch\nfrom django.db import transaction\nfrom django.db.models import signals as model_signals\n\nfrom . import client\nfrom .pool import pool\nfrom resolwe.flow import model... | python | chosen |
[
{
"from": "system",
"value": "Move gallery urlpatterns to Django 2.0 preferred method\n"
},
{
"from": "human",
"value": "from django.conf.urls import url\n\nfrom . import views\n\napp_name = 'gallery'\nurlpatterns = [\n url(r'^$', views.IndexView.as_view(), name='index'),\n url(r'^(?P<slug... | python | chosen |
[
{
"from": "system",
"value": "Add better enumeration for Notification\n\nThe previous 'Kind' enumeration for Notification were using a\nhome-made-cooked way of dealing with enumeration. The code were got\nfrom an article from the http://sametmax.com/ website (great website\nby the way). This new version use... | python | chosen |
[
{
"from": "system",
"value": "Change s/apt/apt_pkg/g (follow up to previous commit)\n"
},
{
"from": "human",
"value": "\"\"\"\nMake python-apt available in the Python virtual environment without using the\nsystem site-packages support built into Travis CI because this doesn't work\nfor Python 3.... | python | chosen |
[
{
"from": "system",
"value": "Update template render example for Django 1.8+\n"
},
{
"from": "human",
"value": "import django.template.loader\nimport django.conf\nimport sys\n\nsys.path.append('django_test')\ndjango.conf.settings.configure(INSTALLED_APPS=(), TEMPLATE_DIRS=('.', 'examples',))\n\n... | python | chosen |
[
{
"from": "system",
"value": "Use dictionary update instead of addition\n"
},
{
"from": "human",
"value": "import re\n\nfrom regparser.layer.layer import Layer\nimport settings\n\n\nclass Meta(Layer):\n shorthand = 'meta'\n\n def __init__(self, tree, cfr_title, version, **context):\n ... | python | chosen |
[
{
"from": "system",
"value": "Stop publishing compiler_unsupported.\nStart publishing fixnum.\n\nR=sigmund@google.com\n\nReview URL: https://codereview.chromium.org//19757010\n\ngit-svn-id: c93d8a2297af3b929165606efe145742a534bc71@25217 260f80e4-7a28-3924-810f-c04153c831b5\n"
},
{
"from": "human",
... | python | chosen |
[
{
"from": "system",
"value": "Make git describe --always return a value\n\nThis means that the latest commit will be stamped if there are no tags."
},
{
"from": "human",
"value": "#! /usr/bin/env python3\n\n# Note that this file should work in both Python 2 and 3.\n\nfrom __future__ import print... | python | chosen |
[
{
"from": "system",
"value": "Update context processer to check for custom hybrid user agent.\n"
},
{
"from": "human",
"value": "# Determins if the requesting device is a native hybrid app (android/ios)\n\n\ndef is_hybrid(request):\n\n return {\n 'is_hybrid': 'HTTP_MYUW_HYBRID' in requ... | python | chosen |
[
{
"from": "system",
"value": "Fix ES index setup in XFormManagementTest\n"
},
{
"from": "human",
"value": "from django.contrib.sessions.middleware import SessionMiddleware\nfrom django.http import HttpRequest, QueryDict\nfrom django.test import TestCase, Client\n\nfrom corehq.apps.data_interface... | python | chosen |
[
{
"from": "system",
"value": "Update uptest for Python 3\n"
},
{
"from": "human",
"value": "#!/usr/bin/env python\n\nimport urllib2\nimport argparse\n\nimport portend\n\nparser = argparse.ArgumentParser()\nparser.add_argument('host')\nparser.add_argument('port', type=int)\nargs = parser.parse_ar... | python | chosen |
[
{
"from": "system",
"value": "Remove tmp file created by test\n"
},
{
"from": "human",
"value": "\"\"\"\nTest the wrappers for the API functions\n\"\"\"\nimport os\n\nfrom .. import create_session, call_module\n\n\ndef test_create_session():\n \"Test that create_session is called without erro... | python | chosen |
[
{
"from": "system",
"value": "Fix import error (oscar.app.shop doesn't exist anymore)\n"
},
{
"from": "human",
"value": "from django.conf import settings\nfrom django.contrib import admin\nfrom django.conf.urls.static import static\nfrom django.conf.urls import patterns, include, url\nfrom djang... | python | chosen |
[
{
"from": "system",
"value": "Resolve import issue in color_normalization_test\n"
},
{
"from": "human",
"value": "from .ReinhardNorm import ReinhardNorm\nfrom .ReinhardSample import ReinhardSample\n\n__all__ = (\n 'FeatureExtraction'\n)\n"
},
{
"from": "gpt",
"value": "__all__ = (... | python | chosen |
[
{
"from": "system",
"value": "Add routes for login,signup and logout in backend\n"
},
{
"from": "human",
"value": "from flask import Flask, jsonify, render_template, url_for\napp = Flask(__name__)\n\n@app.route(\"/\")\ndef index():\n return render_template('index.html')\n\nif __name__ == '__m... | python | chosen |
[
{
"from": "system",
"value": "Clear global state/caching handled by Django so the test passes when run in the full suite.\n"
},
{
"from": "human",
"value": "import os\n\nfrom django.conf import settings\nfrom django.contrib.staticfiles.testing import StaticLiveServerTestCase\nfrom django.test.ut... | python | chosen |
[
{
"from": "system",
"value": "Change Python version check to use sys.version_info"
},
{
"from": "human",
"value": "# Python 2/3 compat\nimport sys\nif sys.version < '3':\n import codecs\n def u(x):\n return codecs.unicode_escape_decode(x)[0]\nelse:\n def u(x):\n return x\n... | python | chosen |
[
{
"from": "system",
"value": "Fix highlighting of \"IP Networks\" menu entry\n"
},
{
"from": "human",
"value": "# This file is part of Indico.\n# Copyright (C) 2002 - 2016 European Organization for Nuclear Research (CERN).\n#\n# Indico is free software; you can redistribute it and/or\n# modify i... | python | chosen |
[
{
"from": "system",
"value": "Use `vk.VKError` instead of `vk.error.VKError`\n"
},
{
"from": "human",
"value": "# coding=utf-8\nfrom .auth import *\nfrom .groups import *\nfrom .messages import *\nfrom .users import *\n"
},
{
"from": "gpt",
"value": "# coding=utf-8\nfrom .auth import... | python | chosen |
[
{
"from": "system",
"value": "Fix the location of the SVN repository\n\ngit-svn-id: 05b73559aeb8bace4cf49b5ea964569f1305eff8@618 4cde692c-a291-49d1-8350-778aa11640f8\n"
},
{
"from": "human",
"value": "#! /usr/bin/env python\n\nimport os, sys\n\nfontToolsDir = os.path.dirname(os.path.dirname(os.p... | python | chosen |
[
{
"from": "system",
"value": "Increment the max length of random strings.\n"
},
{
"from": "human",
"value": "#!/usr/bin/env python\n\nfrom fastcomp import compare\nimport random\nimport string\n\ndef randomstr(minlen=5, maxlen=7):\n charset = '01'\n length = random.randint(minlen, maxlen)\... | python | chosen |
[
{
"from": "system",
"value": "Revert bad renaming of route url parameter\n"
},
{
"from": "human",
"value": "# -*- coding: utf-8 -*-\n##############################################################################\n#\n# Copyright (C) 2018 Compassion CH (http://www.compassion.ch)\n# Releasing... | python | chosen |
[
{
"from": "system",
"value": "Return res in inherit (even if res is empty in this case)\n"
},
{
"from": "human",
"value": "# -*- encoding: utf-8 -*-\n##############################################################################\n#\n# Account Payment Partner module for OpenERP\n# Copyright... | python | chosen |
[
{
"from": "system",
"value": "Add installed app on opps init\n"
},
{
"from": "human",
"value": "#!/usr/bin/env python\n# -*- coding: utf-8 -*-\n\nVERSION = (0, 0, 1)\n\n__version__ = \".\".join(map(str, VERSION))\n__status__ = \"Development\"\n__description__ = u\"Opps CMS websites magazines and... | python | chosen |
[
{
"from": "system",
"value": "Fix send count and add debug logging\n"
},
{
"from": "human",
"value": "import logging\n\nfrom promgen.models import Project, Service\n\nlogger = logging.getLogger(__name__)\n\n\nclass SenderBase(object):\n def send(self, data):\n for alert in data['alerts... | python | chosen |
[
{
"from": "system",
"value": "Use a broad-brush filter for the signal handlers\n"
},
{
"from": "human",
"value": "# -*- coding: utf-8 -*-\n\nfrom django.db.models.signals import post_save, pre_delete\nfrom django.dispatch import receiver\nfrom django.core.exceptions import ImproperlyConfigured\n... | python | chosen |
[
{
"from": "system",
"value": "Test keys and values separately."
},
{
"from": "human",
"value": "import unittest\nimport distarray as da\nfrom distarray.mpi.mpibase import create_comm_of_size, InvalidCommSizeError\n\n\nclass TestDistributedArrayProtocol(unittest.TestCase):\n\n def setUp(self):... | python | chosen |
[
{
"from": "system",
"value": "Implement Flamewaker and correct Dragon's Breath id\n"
},
{
"from": "human",
"value": "from ..utils import *\n\n\n##\n# Spells\n\n# Dragon's Breath\nclass DragonsBreath:\n\taction = [Hit(TARGET, 4)]\n\n\tdef cost(self, value):\n\t\treturn value - self.game.minionsKi... | python | chosen |
[
{
"from": "system",
"value": "Add marker to indicate backend error\n"
},
{
"from": "human",
"value": "def printerr(msg, e=''):\n print(msg.format(e), file=sys.stderr)\n\nclass CommunicationError(Exception):\n def __str__(self):\n return \"Communication error: {}\".format(self.args)\... | python | chosen |
[
{
"from": "system",
"value": "Implement the trip description classes\n\nAnd a default list for trips has also been written.\n"
},
{
"from": "human",
"value": "\"\"\"\nTrip generation\n===============\n\n\"\"\"\n\n"
},
{
"from": "gpt",
"value": "\"\"\"\nTrip generation\n==============... | python | chosen |
[
{
"from": "system",
"value": "Include Interface in public API.\n"
},
{
"from": "human",
"value": "from .implicit import implicit\nfrom .registry import ClassRegistry, Registry\nfrom .lookup import Lookup, CachedLookup\n"
},
{
"from": "gpt",
"value": "from .implicit import implicit\nf... | python | chosen |
[
{
"from": "system",
"value": "Add rba url, since it's normally taken from the config\n"
},
{
"from": "human",
"value": "# Filename: test_srv.py\n# pylint: disable=locally-disabled,C0111,R0904,C0103\nfrom km3pipe.testing import TestCase, patch\nfrom km3pipe.dataclasses import Table\nfrom km3pipe.... | python | chosen |
[
{
"from": "system",
"value": "Improve get_workflow_history so it returns the last execution if no run_id given\n\nThis helper method didn't seem to be used directly in simpleflow\ncodebase but it's actually useful. For a nicer usage in the \"--repair\"\nfeature we will introduce, we need to retrieve the lat... | python | chosen |
[
{
"from": "system",
"value": "Read settings from the environment.\n"
},
{
"from": "human",
"value": "import os\nimport dj_database_url\n\nfrom microdash.settings.base import *\n\nenv = os.getenv\nPROJECT_ROOT = os.path.dirname(os.path.realpath(__file__))\n# settings is one directory up now\nhere... | python | chosen |
[
{
"from": "system",
"value": "Add caching to ligand statistics\n"
},
{
"from": "human",
"value": "from django.conf.urls import url\nfrom django.views.decorators.cache import cache_page\nfrom django.views.generic import TemplateView\nfrom ligand.views import *\n\nurlpatterns = [\n url(r'^$', c... | python | chosen |
[
{
"from": "system",
"value": "Add support for part loading\n"
},
{
"from": "human",
"value": "#import os, json\n#from jasy.core.Util import executeCommand\n#import jasy.core.Console as Console\n#import urllib.parse\n\n# Little helper to allow python modules in current jasylibrarys path\nimport s... | python | chosen |
[
{
"from": "system",
"value": "Refactor encoders to have base class\n"
},
{
"from": "human",
"value": "import logging\nimport datetime\nimport decimal\n\nimport elasticsearch\nfrom bson import ObjectId, DBRef\n\nfrom nefertari.renderers import _JSONEncoder\n\n\nlog = logging.getLogger(__name__)\n... | python | chosen |
[
{
"from": "system",
"value": "Generalize the logout a bit\n\nThis is on the road to removing auth from this file.\n"
},
{
"from": "human",
"value": "from wavvy import app\nfrom flask import Flask, url_for, render_template, request, session, escape\n\n\n@app.route('/hello')\n@app.route('/hello/<n... | python | chosen |
[
{
"from": "system",
"value": "Refactor to use pyramdas complement function. The initial set implementaion did not respect the order of elements and removed duplicates\n"
},
{
"from": "human",
"value": "from pyramda.function.curry import curry\nfrom . import filter\n\n\n@curry\ndef reject(p, xs):... | python | chosen |
[
{
"from": "system",
"value": "Use API route in promotion tests\n"
},
{
"from": "human",
"value": "import os\n\nimport pytest\nimport requests\n\n\n@pytest.fixture\ndef url():\n return os.getenv(\"SITE\", \"http://localhost:5000\")\n\n\ndef test_post_images(expect, url):\n params = {\"key\"... | python | chosen |
[
{
"from": "system",
"value": "Change default format to normal longitude/latitude.\n"
},
{
"from": "human",
"value": "import requests\nfrom .api_exception import RakutenApiException\nfrom .base_api import BaseApi\n\nclass TravelApi(BaseApi):\n def __init__(self, options):\n super(Travel... | python | chosen |
[
{
"from": "system",
"value": "Add documentation to SenderBase plugin\n"
},
{
"from": "human",
"value": "import logging\n\nfrom promgen.models import Project, Service\n\nlogger = logging.getLogger(__name__)\n\n\nclass SenderBase(object):\n MAPPING = [\n ('project', Project),\n ('... | python | chosen |
[
{
"from": "system",
"value": "Add error handling on module import at initilization time\n"
},
{
"from": "human",
"value": "import importlib\nfrom django.utils.translation import ugettext_lazy as _\nfrom django.apps import AppConfig\n\n\nclass MqueueConfig(AppConfig):\n name = \"mqueue\"\n ... | python | chosen |
[
{
"from": "system",
"value": "Allow to restart the account center cache script without reloading everything\n"
},
{
"from": "human",
"value": "from django.core.management.base import BaseCommand, CommandError\nfrom django.db.models import F, Q\nfrom api import models\n\ndef update_account_center... | python | chosen |
[
{
"from": "system",
"value": "Fix 3rd body tests for Moon, simplify interpolant code\n"
},
{
"from": "human",
"value": "import numpy as np\nfrom scipy.interpolate import interp1d\n\nfrom astropy import units as u\nfrom astropy.time import Time\n\nfrom poliastro.bodies import Moon\nfrom poliastro... | python | chosen |
[
{
"from": "system",
"value": "Fix debug flag to actually work\n"
},
{
"from": "human",
"value": "__author__ = 'nhumrich'\nimport os\nimport socket\n\nsyslog_host = os.getenv('SYSLOG_HOST', 'localhost')\nsyslog_port = os.getenv('SYSLOG_PORT', 514)\ndebug = os.getenv('DEBUG', 'False')\n\n\ndef sen... | python | chosen |
[
{
"from": "system",
"value": "Add fullname in REST response\n"
},
{
"from": "human",
"value": "from .models import MakerScienceProfile\nfrom tastypie.resources import ModelResource\nfrom tastypie.authorization import DjangoAuthorization\nfrom tastypie import fields\nfrom tastypie.constants impor... | python | chosen |
[
{
"from": "system",
"value": "Sort the database order in the inspect page.\n"
},
{
"from": "human",
"value": "from django.shortcuts import render\n\ndef _get_key_details(conn, db):\n conn.execute_command('SELECT', db)\n keys = conn.keys()\n key_details = {}\n for key in keys:\n ... | python | chosen |
[
{
"from": "system",
"value": "Replace try..except with get_policy_option call\n"
},
{
"from": "human",
"value": "from vint.ast.node_type import NodeType\nfrom vint.linting.level import Level\nfrom vint.linting.policy.abstract_policy import AbstractPolicy\nfrom vint.linting.policy_registry import... | python | chosen |
[
{
"from": "system",
"value": "Add M&E Expert to polls entries permissions\n"
},
{
"from": "human",
"value": "from django.conf.urls import url\nfrom molo.polls.admin import QuestionsModelAdmin\nfrom molo.polls.admin_views import QuestionResultsAdminView\nfrom wagtail.wagtailcore import hooks\nfro... | python | chosen |
[
{
"from": "system",
"value": "Add metadata ready field to IdP serializer\n"
},
{
"from": "human",
"value": "import json\n\nfrom third_party_auth.models import SAMLConfiguration, SAMLProviderConfig\n\nfrom rest_framework import serializers\n\n\nclass JSONSerializerField(serializers.Field):\n \... | python | chosen |
[
{
"from": "system",
"value": "Add explanation about using __slots__\n"
},
{
"from": "human",
"value": "\"\"\"Models for the response of the configuration object.\"\"\"\n\nfrom __future__ import division, print_function, unicode_literals\n\nfrom readthedocs.config.utils import to_dict\n\n\nclass ... | python | chosen |
[
{
"from": "system",
"value": "Fix __all__ using objects instead of strings\n\nSigned-off-by: Branko Vukelic <26059cc39872530f89fec69552bb1050e1cc2caa@outernet.is>\n"
},
{
"from": "human",
"value": "from .base import RouteBase, NonIterableRouteBase\nfrom .template import TemplateRoute, XHRPartial... | python | chosen |
[
{
"from": "system",
"value": "Revert back to kickoff for landing page\n"
},
{
"from": "human",
"value": "import json\nimport os\n\nDEBUG = os.environ.get('SERVER_SOFTWARE', '').startswith('Dev')\n\n# For choosing what the main landing page displays\nKICKOFF = 1\nBUILDSEASON = 2\nCOMPETITIONSEASO... | python | chosen |
[
{
"from": "system",
"value": "Make backup failures not disruptive\n"
},
{
"from": "human",
"value": "'''\r\nBackup es index to S3 and refresh\r\n'''\r\n\r\nfrom tornado.ioloop import IOLoop\r\n\r\nfrom web.api.es import ESQuery\r\n\r\n\r\nasync def backup_and_refresh():\r\n '''\r\n Run per... | python | chosen |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.