conversations listlengths 2 3 | source stringclasses 1
value | stack stringclasses 1
value |
|---|---|---|
[
{
"from": "system",
"value": "Allow rechttp prefix for source field.\n"
},
{
"from": "human",
"value": "import re\n\nfrom django.core import validators\n\n\nclass URLValidator(validators.URLValidator):\n \"\"\"Custom url validator to include git urls and urls with http+ like prefixes\n \"\... | python | chosen |
[
{
"from": "system",
"value": "Rename test to be more fitting\n"
},
{
"from": "human",
"value": "from scraper.tivix import get_list_of_tivix_members\nfrom scraper.tivix import get_random_tivix_member_bio\n\ndef test_get_all_tivix_members():\n members = get_list_of_tivix_members()\n assert m... | python | chosen |
[
{
"from": "system",
"value": "Remove schema validation unit tests frow whatcd\n"
},
{
"from": "human",
"value": "from __future__ import unicode_literals, division, absolute_import\n\nfrom tests import FlexGetBase, use_vcr\n\n\nclass TestInputWhatCD(FlexGetBase):\n\n __yaml__ = \"\"\"\n ... | python | chosen |
[
{
"from": "system",
"value": "Fix numerical printout in python script\n"
},
{
"from": "human",
"value": "#!/usr/bin/python\n\nimport struct, sys, os\n\nf = open(sys.argv[1])\n\nHEADER_OFFSET = 296\n\nf.seek(HEADER_OFFSET)\n\ntry:\n while True:\n x = int(struct.unpack(\"<i\", f.read(4))... | python | chosen |
[
{
"from": "system",
"value": "Duplicate small parts to make general text parser independent and simple\n"
},
{
"from": "human",
"value": "from ..tokens import BuiltToken\n\nfrom .common_parsing import pg as common_pg\n\n\ngen_txt_pg = common_pg.copy_to_extend()\n\n\n@gen_txt_pg.production('gener... | python | chosen |
[
{
"from": "system",
"value": "Manage case where api installed with --editable\n"
},
{
"from": "human",
"value": "# -*- coding: utf-8 -*-\n\n\nimport os\nimport sys\nfrom logging.config import fileConfig\nfrom wsgiref.simple_server import make_server\n\nfrom paste.deploy import loadapp\n\n\nhostn... | python | chosen |
[
{
"from": "system",
"value": "Make ExternalProgramService use async process from tornado\n"
},
{
"from": "human",
"value": "\nimport subprocess\nimport logging\n\nfrom delivery.models.execution import ExecutionResult, Execution\n\nlog = logging.getLogger(__name__)\n\n\nclass ExternalProgramServi... | python | chosen |
[
{
"from": "system",
"value": "Add flush to delete all renders print\n"
},
{
"from": "human",
"value": "from django.core.management.base import BaseCommand, CommandError\nfrom ...models import Render\n\n\nclass Command(BaseCommand):\n help = 'Deletes output of all expired renders'\n\n def h... | python | chosen |
[
{
"from": "system",
"value": "Add revid to Notification object\n\nSince most edit-related notifications include revid attributes,\nwe should include the revids in the Notification objects as we're\nbuilding them (if they exist).\n\nChange-Id: Ifdb98e7c79729a1c2f7a5c4c4366e28071a48239\n"
},
{
"from":... | python | chosen |
[
{
"from": "system",
"value": "Add pos for max_lemma_count also\n"
},
{
"from": "human",
"value": "#!/usr/bin/env python -*- coding: utf-8 -*-\n#\n# Python Word Sense Disambiguation (pyWSD): Baseline WSD\n#\n# Copyright (C) 2014-2020 alvations\n# URL:\n# For license information, see LICENSE.md\n\... | python | chosen |
[
{
"from": "system",
"value": "Make function top level importable\n"
},
{
"from": "human",
"value": "from .model_checker import ModelChecker, PathResult, PathMetric, get_path_iter\nfrom .pysb import PysbModelChecker\nfrom .signed_graph import SignedGraphModelChecker\nfrom .unsigned_graph import U... | python | chosen |
[
{
"from": "system",
"value": "Move ansi_escape to generic function\n"
},
{
"from": "human",
"value": "# coding=utf-8\nimport re\nimport os\nimport sys\n\n# Regex for matching URLs\n# See https://mathiasbynens.be/demo/url-regex\nurl_regex = re.compile(r\"((https?|ftp)://(-\\.)?([^\\s/?\\.#-]+\\.?... | python | chosen |
[
{
"from": "system",
"value": "Add MIME-handling options to s3cmd\n"
},
{
"from": "human",
"value": "import os\nimport pip\nimport tempfile\nimport subprocess\nimport openpathsampling.version\n\n\nBUCKET_NAME = 'openpathsampling.org'\nif not openpathsampling.version.release:\n PREFIX = 'latest... | python | chosen |
[
{
"from": "system",
"value": "Add a more useful representation of Shipper objects\n"
},
{
"from": "human",
"value": "import re\n\n\nclass Shipper(object):\n barcode = None\n barcode_pattern = None\n shipper = None\n\n def __init__(self, barcode):\n self.barcode = barcode\n\n ... | python | chosen |
[
{
"from": "system",
"value": "Use the best model from the leader board in the prediction web app.\n"
},
{
"from": "human",
"value": "from flask import Flask, redirect, render_template, request\nfrom gevent.wsgi import WSGIServer\n\nfrom predict import InstrumentClassifier\n\napp = Flask(__name__... | python | chosen |
[
{
"from": "system",
"value": "Use pip2pi, not dir2pi for deploys\n"
},
{
"from": "human",
"value": "from fabric.api import *\n\n\"\"\" \n Overview\n ========\n\n This fabric file automates the process of pip packaging and\n deploying your new pip package to our private pip repository... | python | chosen |
[
{
"from": "system",
"value": "Fix fake game one script\n"
},
{
"from": "human",
"value": "import random\n\nfrom django.core.management.base import BaseCommand\nfrom django.contrib.auth.models import User\n\nfrom mla_game.apps.accounts.models import Profile\n\nfrom ...models import (\n Transcr... | python | chosen |
[
{
"from": "system",
"value": "Install sun java when using cloudera\n"
},
{
"from": "human",
"value": "\nfrom kokki import *\n\napt_list_path = '/etc/apt/sources.list.d/cloudera.list'\napt = (\n \"deb http://archive.cloudera.com/debian {distro}-cdh3 contrib\\n\"\n \"deb-src http://archive.c... | python | chosen |
[
{
"from": "system",
"value": "Add new environment variable so we can create articles with different committer and author\n"
},
{
"from": "human",
"value": "\"\"\"\nFile to easily switch between configurations between production and\ndevelopment, etc.\n\"\"\"\n\nimport os\n\n\n# You must set each... | python | chosen |
[
{
"from": "system",
"value": "Remove the address_ prefix from line1 and line2 in the Address model.\n\nThe address_ prefix is redundant now that we have an Address model.\n"
},
{
"from": "human",
"value": "from django.db import models\nfrom django_countries import CountryField\n\n\nclass Address... | python | chosen |
[
{
"from": "system",
"value": "Allow local.json to be missing\n"
},
{
"from": "human",
"value": "import json\nimport os\nimport logging\n\nlogger = logging.getLogger(__name__)\n\nHERE = os.path.dirname(os.path.realpath(__file__))\n\ngroups = json.load(open('{0}/defaults.json'.format(HERE)))\ntry:... | python | chosen |
[
{
"from": "system",
"value": "Use random.choices when available for better performance\n"
},
{
"from": "human",
"value": "# coding=utf-8\n\nimport bisect\nfrom faker.generator import random\n\ndef random_sample():\n return random.uniform(0.0, 1.0)\n\n\ndef cumsum(it):\n total = 0\n for ... | python | chosen |
[
{
"from": "system",
"value": "Remove deleted test from ignore list\n"
},
{
"from": "human",
"value": "from __future__ import print_function\n\nimport os\n\nimport pytest\n\nHERE = os.path.dirname(__file__)\n\nif __name__ == '__main__':\n # Fake Rhino modules\n pytest.load_fake_module('Rhin... | python | chosen |
[
{
"from": "system",
"value": "Test we have access to envvar when we have no file\n"
},
{
"from": "human",
"value": "# coding: utf-8\nimport os\nimport pytest\nfrom mock import patch\nfrom decouple import AutoConfig\n\n\ndef test_autoconfig_env():\n config = AutoConfig()\n path = os.path.jo... | python | chosen |
[
{
"from": "system",
"value": "Make tests a little better\n"
},
{
"from": "human",
"value": "# -*- coding: utf-8 -*-\nfrom __future__ import unicode_literals\n\nimport os\nfrom pprint import pprint\nfrom django.test import TestCase\nfrom mock import Mock\n\nfrom rest_framework_webdav.serializers ... | python | chosen |
[
{
"from": "system",
"value": "Add a middleware class to fix Firefox's bad AJAX redirect handling\n"
},
{
"from": "human",
"value": "from django.conf import settings\nfrom django.contrib.sites.models import Site\n\nfrom localtv import models\n\n\ndef context_processor(request):\n sitelocation ... | python | chosen |
[
{
"from": "system",
"value": "Make sure generated usernames are unique.\n"
},
{
"from": "human",
"value": "import uuid\n\nfrom django.contrib.auth.models import User\n\n\nclass UserTestsMixin(object):\n \"\"\" Mixin base class for tests requiring users. \"\"\"\n\n def create_user(self, use... | python | chosen |
[
{
"from": "system",
"value": "Call the setup_request page method too in generic views replacements\n"
},
{
"from": "human",
"value": "try:\n from functools import wraps\nexcept ImportError:\n from django.utils.functional import wraps\n\nfrom feincms.models import Page\n\n\ndef add_page_to_... | python | chosen |
[
{
"from": "system",
"value": "Remove code which worked around a Django bug which is fixed in 1.8+\n"
},
{
"from": "human",
"value": "import os\n\nfrom django.conf import settings\nfrom django.contrib.staticfiles import finders, storage\nfrom django.contrib.staticfiles.testing import StaticLiveSe... | python | chosen |
[
{
"from": "system",
"value": "[Auth] Make bcrypt work with Unicode passwords\n"
},
{
"from": "human",
"value": "# coding=utf-8\n\nfrom plugins.auth.crypto.algo_base import BaseAlgorithm\n\nimport bcrypt\n\n__author__ = 'Gareth Coles'\n\n\nclass BcryptAlgo(BaseAlgorithm):\n def check(self, has... | python | chosen |
[
{
"from": "system",
"value": "Fix bad call to superclass method\n"
},
{
"from": "human",
"value": "import json\nimport decimal\nimport datetime\nfrom bson.dbref import DBRef\nfrom bson.objectid import ObjectId\nfrom mongoengine.base import BaseDocument\n\nisbound = lambda m: getattr(m, 'im_self'... | python | chosen |
[
{
"from": "system",
"value": "Add utility for address change functionality testing\n"
},
{
"from": "human",
"value": "#!/usr/bin/python\nimport minimalmodbus\nfrom time import sleep\nADDRESS1 = 1\nADDRESS2 = 2\n\nminimalmodbus.CLOSE_PORT_AFTER_EACH_CALL = True\nsensor = minimalmodbus.Instrument(... | python | chosen |
[
{
"from": "system",
"value": "Put in a raise for status for now\n"
},
{
"from": "human",
"value": "from django.http import HttpResponseRedirect\nfrom django.urls import reverse\nfrom django.views import generic\n\nfrom social.app.models.author import Author\n\n\nclass FriendRequestsListView(gene... | python | chosen |
[
{
"from": "system",
"value": "Add auto-login feature for demo view\n"
},
{
"from": "human",
"value": "from django.contrib import messages, auth\nfrom django.shortcuts import redirect\nfrom django.template.response import TemplateResponse\nfrom django.views.generic.base import TemplateView\n\nfro... | python | chosen |
[
{
"from": "system",
"value": "Remove version-specific exception text test\n\nSigned-off-by: Yves Bastide <3b1fe340dba76bf37270abad774f327f50b5e1d8@botify.com>\n"
},
{
"from": "human",
"value": "import unittest\n\nfrom simpleflow.utils import format_exc\n\n\nclass MyTestCase(unittest.TestCase):\n... | python | chosen |
[
{
"from": "system",
"value": "Add still_running to build result serializer\n"
},
{
"from": "human",
"value": "from rest_framework import serializers\n\nfrom frigg.projects.models import Project\n\nfrom .models import Build, BuildResult\n\n\nclass ProjectInlineSerializer(serializers.ModelSerializ... | python | chosen |
[
{
"from": "system",
"value": "Make the \"check\" command available via the Werkzeug extension.\n"
},
{
"from": "human",
"value": "import logging\nfrom webassets.script import CommandLineEnvironment\n\n\n__all__ = ('make_assets_action',)\n\n\ndef make_assets_action(environment, loaders=[]):\n ... | python | chosen |
[
{
"from": "system",
"value": "Fix for PythonAnywhere LoadBalancer IP\n"
},
{
"from": "human",
"value": "#!/usr/bin/env python\n# -*- coding: utf-8 -*-\n\n# ephemeral by st0le\n# quick way share text between your network devices \n\nfrom flask import Flask, request, render_template, redirect, url... | python | chosen |
[
{
"from": "system",
"value": "fix: Add missing variable and correct f-strings\n\nSee commented lines for changes to ex6.py:\n- add types_of_people variable assigment\n- change variable from 10 to types_of_people\n- add letter f before f-strings\n- omit unnecessary periods\n"
},
{
"from": "human",
... | python | chosen |
[
{
"from": "system",
"value": "Use bootstrap template pack by default\n"
},
{
"from": "human",
"value": "# Umessages settings file.\n#\n# Please consult the docs for more information about each setting.\n\nfrom django.conf import settings\ngettext = lambda s: s\n\n\"\"\"\nBoolean value that defin... | python | chosen |
[
{
"from": "system",
"value": "Bump version number if preparation for release.\n"
},
{
"from": "human",
"value": "# Copyright 2011-2012 Splunk, Inc.\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\"): you may\n# not use this file except in compliance with the License. You may ... | python | chosen |
[
{
"from": "system",
"value": "Add hypothesis test to randomly generate CompressionParameters"
},
{
"from": "human",
"value": "try:\n import unittest2 as unittest\nexcept ImportError:\n import unittest\n\nimport zstd\n\nclass TestCompressionParameters(unittest.TestCase):\n def test_init_... | python | chosen |
[
{
"from": "system",
"value": "Add test stubs for Model Mixin behaviour\n"
},
{
"from": "human",
"value": "# -*- coding: utf-8 -*-\n\"\"\"\nwagtail_mvc tests\n\"\"\"\nfrom __future__ import unicode_literals\nfrom django.test import TestCase\nfrom mock import Mock\nfrom wagtail_mvc.models import W... | python | chosen |
[
{
"from": "system",
"value": "Add test to check excplicitly if the attribute is set\n"
},
{
"from": "human",
"value": "#!/usr/bin/env\n# Copyright 2014 Amazon.com, Inc. or its affiliates. All Rights Reserved.\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\"). You\n# may not ... | python | chosen |
[
{
"from": "system",
"value": "Remove `pkg_resources` from the top-level package\n"
},
{
"from": "human",
"value": "import pkg_resources\n\n__author__ = \"Martin Larralde <martin.larralde@embl.de>\"\n__license__ = \"MIT\"\n__version__ = pkg_resources.resource_string(__name__, \"_version.txt\").de... | python | chosen |
[
{
"from": "system",
"value": "Add spawn method to Apply; initialise clones by calling super().__init__()\n"
},
{
"from": "human",
"value": "from .base import TohuBaseGenerator\n\nDERIVED_GENERATORS = ['Apply']\n\n__all__ = DERIVED_GENERATORS + ['DERIVED_GENERATORS']\n\n\nclass Apply(TohuBaseGene... | python | chosen |
[
{
"from": "system",
"value": "Add tools general imports to talkbox namespace.\n\n\n"
},
{
"from": "human",
"value": "from lpc import *\nimport lpc\n__all__ = lpc.__all__\n"
},
{
"from": "gpt",
"value": "from lpc import *\nimport lpc\n__all__ = lpc.__all__\n\nfrom tools import *\nimpo... | python | chosen |
[
{
"from": "system",
"value": "Add module-wide bench and test functions.\n\n\n"
},
{
"from": "human",
"value": "from linpred import *\nimport linpred\n__all__ = linpred.__all__\n\nfrom tools import *\nimport tools\n__all__ += tools.__all__\n"
},
{
"from": "gpt",
"value": "from linpred... | python | chosen |
[
{
"from": "system",
"value": "Add ability to programatically play sound after button press\n"
},
{
"from": "human",
"value": "from flask import Flask, request, redirect\nimport twilio.twiml\n\napp = Flask(__name__)\n\n@app.route(\"/\", methods=['GET', 'POST'])\ndef hello_monkey():\n \"\"\"Res... | python | chosen |
[
{
"from": "system",
"value": "Update setup.py file for numscons build.\n\ngit-svn-id: 003f22d385e25de9cff933a5ea4efd77cb5e7b28@4958 d6536bca-fef9-0310-8506-e4c0a848fbcf\n"
},
{
"from": "human",
"value": "#!/usr/bin/env python\n\nfrom os.path import join\n\ndef configuration(parent_package = '', ... | python | chosen |
[
{
"from": "system",
"value": "Set tweet limit to 30 tweets\n"
},
{
"from": "human",
"value": "\"\"\" A bunch of helper functions that, when fixed up, will return the things we\nneed to make this website work! These functions use the weather and twitter APIs!!!\n\"\"\"\n\n## Import python librari... | python | chosen |
[
{
"from": "system",
"value": "Use relative_to instead of string manipulation\n"
},
{
"from": "human",
"value": "#!/usr/bin/env python3\n\n\"\"\"Remake the ziptestdata.zip file.\n\nRun this to rebuild the importlib_resources/tests/data/ziptestdata.zip file,\ne.g. if you want to add a new file to ... | python | chosen |
[
{
"from": "system",
"value": "Allow URLs to end with spaces even if they're not defined that way in views.\n\nCloses #35\nSee http://flask.pocoo.org/mailinglist/archive/2011/2/27/re-automatic-removal-of-trailing-slashes/#043b1a0b6e841ab8e7d38bd7374cbb58\n"
},
{
"from": "human",
"value": "import ... | python | chosen |
[
{
"from": "system",
"value": "Modify login view to be a post endpoint\n"
},
{
"from": "human",
"value": "from django.shortcuts import render, redirect\nfrom django.contrib.auth import views as auth_views\n\n# Create your views here.\ndef index(request):\n\tpass\n\ndef login(request, **kwargs):\n... | python | chosen |
[
{
"from": "system",
"value": "Add a route to admin/news\n"
},
{
"from": "human",
"value": "from flask import render_template, redirect, url_for, flash, request\nfrom flask.ext.login import login_required, current_user\n\nfrom . import admin\nfrom .forms import ProfileForm\n\nfrom .. import db\nf... | python | chosen |
[
{
"from": "system",
"value": "Correct DB URI for postgres and hstore.\n"
},
{
"from": "human",
"value": "DEBUG = True\nBOOTSTRAP_USE_MINIFIED = False\nBOOTSTRAP_USE_CDN = False\nBOOTSTRAP_FONTAWESOME = True\nSECRET_KEY = \"\\xdb\\xf1\\xf6\\x14\\x88\\xd4i\\xda\\xbc/E'4\\x7f`iz\\x98r\\xb9s\\x1c\\x... | python | chosen |
[
{
"from": "system",
"value": "Fix config file path error on the server\n"
},
{
"from": "human",
"value": "# coding: utf-8\nfrom flask import Flask, abort, request, redirect, render_template, url_for\nfrom log import log\nimport util\n\napp = Flask(__name__)\napp.config.from_pyfile('config.cfg', ... | python | chosen |
[
{
"from": "system",
"value": "Remove unused render_template from import statement."
},
{
"from": "human",
"value": "# -*- coding: utf-8 -*-\n\nfrom flask import Flask, render_template, g\nfrom .container import build\nfrom .web import bp as web\nfrom .api import bp as api\nfrom .middleware impor... | python | chosen |
[
{
"from": "human",
"value": "Add tests for function to reproduce a call string\n"
},
{
"from": "gpt",
"value": "import pytest\n\nfrom ..pytest_helpers import (\n _function_call_string,\n run_test_of_function,\n)\n\n\ndef f(*args, **kwargs):\n return None\n\n\n# f, args, kwargs, expected... | python | chosen |
[
{
"from": "system",
"value": "Clear extra fields when changing items through the schedule view\n"
},
{
"from": "human",
"value": "from rest_framework import serializers\n\nfrom wafer.talks.models import Talk\nfrom wafer.pages.models import Page\nfrom wafer.schedule.models import ScheduleItem, Ve... | python | chosen |
[
{
"from": "system",
"value": "Fix for count with one partition\n"
},
{
"from": "human",
"value": "def get_kv_shape(shape, key_axes):\n func = lambda axis: shape[axis]\n return _get_kv_func(func, shape, key_axes)\n\ndef get_kv_axes(shape, key_axes):\n func = lambda axis: axis\n return... | python | chosen |
[
{
"from": "system",
"value": "Add label io.rancher.container.cattle_url=true to get CATTLE_URL env var\n"
},
{
"from": "human",
"value": "from cattle import Config\nfrom cattle.plugins.docker.util import add_to_env\nfrom urlparse import urlparse\n\n\ndef setup_cattle_config_url(instance, create_... | python | chosen |
[
{
"from": "system",
"value": "Revert \"CBD: 1686 cbagent changes for cbagent\"\n\nThis reverts commit 9fb8d1f0f9548a4a5fb5438b0e04996b9828f202.\n\nChange-Id: Ifcc2e797ba28dcc838c7dae7541e0bc325d954be\nReviewed-on: http://review.couchbase.org/59921\nReviewed-by: sandip nandi <7cd9c95c004724be086626cd470f9c01... | python | chosen |
[
{
"from": "system",
"value": "GDrive: Switch from local server to command line auth to fix upload in Docker.\n"
},
{
"from": "human",
"value": "import os.path\nimport webbrowser\nimport pydrive.auth, pydrive.drive\n\ndef upload(document):\n \"\"\"Upload .docx file to Google Drive and return a... | python | chosen |
[
{
"from": "system",
"value": "Handle instances where level_tag is undefined\n\nBetter mimics the implementation of message.tags in Django 1.7\n"
},
{
"from": "human",
"value": "from django import template\nfrom django.contrib.messages.utils import get_level_tags\nfrom django.utils.encoding impor... | python | chosen |
[
{
"from": "system",
"value": "Add logged user vote field to SubmissionType\n"
},
{
"from": "human",
"value": "import graphene\nfrom graphene_django import DjangoObjectType\n\nfrom voting.types import VoteType\n\nfrom .models import Submission\nfrom .models import SubmissionType as ModelSubmissio... | python | chosen |
[
{
"from": "system",
"value": "Change dev version to 0.50.0-dev.1\n"
},
{
"from": "human",
"value": "__version__ = '0.33.0-dev.12'\n__short_version__ = '0.33'\n__bcp_version__ = '1.1'\n__config_version__ = '4'\n__mpf_version_required__ = '0.33.0-dev.15'\n\nversion = \"MPF-MC v{} (config_version={... | python | chosen |
[
{
"from": "system",
"value": "Add myself to the module\n"
},
{
"from": "human",
"value": "# -*- coding: utf-8 -*-\n\n\n__version__ = 0, 1, 1\n\n\nfrom .core import isitbullshit, raise_for_problem, WHATEVER # NOQA\nfrom .exceptions import ItIsBullshitError # NOQA\nfrom .testcase_mixin import Is... | python | chosen |
[
{
"from": "system",
"value": "Replace werkzeug.contrib with werkzeug.middleware proxyfix.\n\nwerkzeug.contrib has been deprecated, this is the new location\nof the proxyfix.\n"
},
{
"from": "human",
"value": "'''\nThis file is the WSGI entrypoint for remote / production use.\n\nIf you are using ... | python | chosen |
[
{
"from": "human",
"value": "Add basic structure and methods for linked list\n"
},
{
"from": "gpt",
"value": "class Node(object):\n def __init__(self, val=None, pointer=None):\n self.val = val\n self.pointer = pointer\n\n\nclass LinkedList(object):\n def __init__(self, values... | python | chosen |
[
{
"from": "system",
"value": "Reorder '__all__' entries to respect import order\n"
},
{
"from": "human",
"value": "from __future__ import absolute_import\n\nimport etcd3.etcdrpc as etcdrpc\nfrom etcd3.client import Etcd3Client\nfrom etcd3.client import Transactions\nfrom etcd3.client import clie... | python | chosen |
[
{
"from": "system",
"value": "Add function that extends textwrap.wrap to multi-paragraph inputs.\n"
},
{
"from": "human",
"value": "import sys\n\ndef fill_template(temp, args, longname, filename, url):\n \"\"\"\n Takes a template string (temp) and replaces all template keywords with\n i... | python | chosen |
[
{
"from": "system",
"value": "Add project run to project result.\n"
},
{
"from": "human",
"value": "from __future__ import absolute_import\nimport logging\nimport traceback\n\nfrom celery import shared_task\nfrom celery.utils.log import get_task_logger\n\nfrom datastore.models import ProjectRun\... | python | chosen |
[
{
"from": "system",
"value": "Fix deadlock in subprocess pipes\n"
},
{
"from": "human",
"value": "import asyncio\nimport sys\n\nimport pytest\n\n\npytestmark = pytest.mark.asyncio()\n\n\nasync def test_command_line_send(smtpd_server, hostname, port):\n proc = await asyncio.create_subprocess_e... | python | chosen |
[
{
"from": "system",
"value": "[tests] Add a failing test that demonstrates wrong handling of data\n\nThe ping handler adds the data directly to the response_kwargs,\nallowing internal kwargs to be overwritten.\n\n`send_message()` and `build_message()` should not accept\n`**additional_data`, but `additional_... | python | chosen |
[
{
"from": "system",
"value": "Cover unknown time format case\n"
},
{
"from": "human",
"value": "from grazer.util import time_convert, grouper\n\n\nclass TestTimeConvert(object):\n\n def test_seconds(self):\n assert time_convert(\"10s\") == 10\n\n def test_minutes(self):\n ass... | python | chosen |
[
{
"from": "system",
"value": "Use a more descriptive test case name\n"
},
{
"from": "human",
"value": "from unittest import TestCase\nfrom prudent.mapping import Mapping\n\n\nclass MappingTest(TestCase):\n def setUp(self):\n self.mapping = Mapping([(1, 2), (2, 3), (3, 4)])\n\n def t... | python | chosen |
[
{
"from": "system",
"value": "Move VacantPosition to Election as an inline. Remove Vote.\n"
},
{
"from": "human",
"value": "from django.contrib import admin\nfrom .models import (Election, VacantPosition, Candidature, Vote)\n\n@admin.register(Election)\nclass ElectionAdmin(admin.ModelAdmin):\n ... | python | chosen |
[
{
"from": "system",
"value": "Make sure all datetimes are UTC\n"
},
{
"from": "human",
"value": "def datetime_almost_equal(datetime1, datetime2, seconds=60):\n dd = datetime1 - datetime2\n sd = (dd.days * 24 * 60 * 60) + dd.seconds\n return abs(sd) <= seconds\n"
},
{
"from": "gp... | python | chosen |
[
{
"from": "system",
"value": "Fix python 2.6 default string formatting\n"
},
{
"from": "human",
"value": "import imp\nimport json\nimport os\nimport sys\n\n\nclass Dot(dict):\n\n def __init__(self, d):\n super(dict, self).__init__()\n for k, v in iter(d.items()):\n if... | python | chosen |
[
{
"from": "system",
"value": "Cut down on logging spam from dict2xml :U\n"
},
{
"from": "human",
"value": "__author__ = 'Gareth Coles'\n\nimport logging\nimport sys\n\nlogging.basicConfig(\n format=\"%(asctime)s | %(levelname)8s | %(message)s\",\n datefmt=\"%d %b %Y - %H:%M:%S\",\n leve... | python | chosen |
[
{
"from": "system",
"value": "Change order of diff to be x,y instead of y,x\n"
},
{
"from": "human",
"value": "import re,sys\n\ndef main(argv):\t\n\tfor line in sys.stdin:\n\t\tpiece,from_location,to_location = line.split(\"\\t\")\n\t\tfrom_location = from_location.split(\",\")\n\t\tto_location ... | python | chosen |
[
{
"from": "system",
"value": "Replace TODO with comment explaining why it wasn't possible\n"
},
{
"from": "human",
"value": "# Copyright 2008-2015 Nokia Solutions and Networks\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may not use this file except in compli... | python | chosen |
[
{
"from": "system",
"value": "Use builtin sorted, reversed if available.\n"
},
{
"from": "human",
"value": "\"\"\"\nA simple module that helps unify the code between a python2 and python3 library.\n\"\"\"\nimport sys\n\ndef sorted(lst):\n newlst = list(lst)\n newlst.sort()\n return newl... | python | chosen |
[
{
"from": "system",
"value": "Use product/case id's in search rather than filter\n"
},
{
"from": "human",
"value": "from django.contrib import admin\nfrom .models import StockState\n\n\nclass StockStateAdmin(admin.ModelAdmin):\n model = StockState\n list_display = [\n 'section_id',\... | python | chosen |
[
{
"from": "system",
"value": "Fix bug in class Article, volume should be string type\n"
},
{
"from": "human",
"value": "from neomodel import (StructuredNode, StringProperty, IntegerProperty, ArrayProperty,\n RelationshipTo, RelationshipFrom)\n\n# Create your models here.\n\nclass Article(Stru... | python | chosen |
[
{
"from": "system",
"value": "Increment version number to 2.0.0-alpha.5\n"
},
{
"from": "human",
"value": "\"\"\"Module for Django system configuration.\"\"\"\n\n__version__ = \"2.0.0-alpha.4\"\n__version_english__ = \"2.0 Alpha 4\"\n"
},
{
"from": "gpt",
"value": "\"\"\"Module for D... | python | chosen |
[
{
"from": "system",
"value": "Create Post model in model.py\n"
},
{
"from": "human",
"value": "from __future__ import unicode_literals\n\nfrom django.db import models\n\n# Create your models here.\n"
},
{
"from": "gpt",
"value": "from __future__ import unicode_literals\n\nfrom django... | python | chosen |
[
{
"from": "system",
"value": "Disable loading templates from project templates (use only the app ones). Makes all the views tests pass when ran as part of the suite of a larger project like NFSA. (Eventually, eventtools should just use testtools, this functionality is built in there)"
},
{
"from": "... | python | chosen |
[
{
"from": "system",
"value": "Use skip_ok_unless instead of a comparison against 'False'\n"
},
{
"from": "human",
"value": "import osgtest.library.core as core\nimport osgtest.library.files as files\nimport osgtest.library.service as service\nimport osgtest.library.osgunittest as osgunittest\n\n... | python | chosen |
[
{
"from": "system",
"value": "Change binary name, and encode whether it uses a JIT compiler or not\n\nSigned-off-by: Stefan Marr <46f1a0bd5592a2f9244ca321b129902a06b53e03@stefan-marr.de>\n"
},
{
"from": "human",
"value": "#!/usr/bin/env python\n# -*- coding: utf-8 -*-\n\nimport sys\n\nfrom som.v... | python | chosen |
[
{
"from": "system",
"value": "Remove BitEnum class, use IntEnum\n"
},
{
"from": "human",
"value": "from enum import Enum\n\nclass BitEnum(int, Enum):\n def __new__(cls, *args):\n value = 1 << len(cls.__members__)\n return int.__new__(cls, value)\n\nformats = BitEnum(\"formats\",... | python | chosen |
[
{
"from": "system",
"value": "Cache: Index tasks by uuid as well as line number\n"
},
{
"from": "human",
"value": "import vim\n\nfrom taskwiki.task import VimwikiTask\n\nclass TaskCache(object):\n \"\"\"\n A cache that holds all the tasks in the given file and prevents\n multiple redund... | python | chosen |
[
{
"from": "system",
"value": "Change function and pkg color style.\n"
},
{
"from": "human",
"value": "class ColorStr:\n\n _HEADER = '\\033[95m'\n _OKBLUE = '\\033[94m'\n _OKGREEN = '\\033[92m'\n _WARNING = '\\033[93m'\n _FAIL = '\\033[91m'\n _ENDC = '\\033[0m'\n _BOLD = '\\0... | python | chosen |
[
{
"from": "system",
"value": "Clean up file patterns in PIPELINE_CSS setting.\n"
},
{
"from": "human",
"value": "# Copyright (c) 2011-2014 Berkeley Model United Nations. All rights reserved.\n# Use of this source code is governed by a BSD License (see LICENSE).\n\nfrom os.path import join\n\nfro... | python | chosen |
[
{
"from": "system",
"value": "Add indicator for how many datapoints have been loaded\n"
},
{
"from": "human",
"value": "import csv\n\nfrom chemtools.ml import get_decay_feature_vector\nfrom chemtools.mol_name import get_exact_name\nfrom models import DataPoint\n\n\ndef main(path):\n with open... | python | chosen |
[
{
"from": "system",
"value": "Increment lib version to 1.0.0\n"
},
{
"from": "human",
"value": "# Copyright 2013 Lars Butler & individual contributors\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may not use this file except in compliance with the License.\n#... | python | chosen |
[
{
"from": "system",
"value": "Disable Flask 12h caching in debug mode\n - prevented refreshing of Angular directive templates\n"
},
{
"from": "human",
"value": "#!/usr/bin/env python\n\n\"\"\"Main module\"\"\"\n\nfrom __future__ import print_function\nfrom __future__ import absolute_import\nimpo... | python | chosen |
[
{
"from": "system",
"value": "Revise to var n & add space line\n"
},
{
"from": "human",
"value": "\"\"\"Leetcode 1. Two Sum\nEasy\n\nURL: https://leetcode.com/problems/two-sum/description/\n\nGiven an array of integers, return indices of the two numbers such that \nthey add up to a specific targ... | python | chosen |
[
{
"from": "system",
"value": "Fix user's real ip address.\n"
},
{
"from": "human",
"value": "import IP\nfrom flask import Blueprint, request, render_template, jsonify\n\nweather = Blueprint('weather', __name__, url_prefix='/weather')\n\n\n@weather.route('/', methods=['GET'])\ndef index():\n i... | python | chosen |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.