conversations listlengths 2 3 | source stringclasses 1
value | stack stringclasses 1
value |
|---|---|---|
[
{
"from": "system",
"value": "Add a check so non-google employee don't send crash dumps.\n\nAdd a warning message in case the check ever fail.\n\nReview URL: http://codereview.chromium.org/460044\n\ngit-svn-id: fd409f4bdeea2bb50a5d34bb4d4bfc2046a5a3dd@33700 0039d316-1c4b-4281-b951-d872f2087c98\n"
},
{
... | python | chosen |
[
{
"from": "system",
"value": "Check credentials; sort repr output\n"
},
{
"from": "human",
"value": "from .endpoints import ENDPOINTS\nfrom .managers import Manager\n\n\nclass WorkflowMax:\n \"\"\"An ORM-like interface to the WorkflowMax API\"\"\"\n\n def __init__(self, credentials):\n ... | python | chosen |
[
{
"from": "system",
"value": "Fix migration for model verbose name changes\n"
},
{
"from": "human",
"value": "# -*- coding: utf-8 -*-\n# Generated by Django 1.11.1 on 2017-05-12 08:07\nfrom __future__ import unicode_literals\n\nfrom django.db import migrations, models\nimport django.db.models.de... | python | chosen |
[
{
"from": "system",
"value": "Add test for asinh in scale_image\n"
},
{
"from": "human",
"value": "import numpy as np\nfrom numpy.testing import assert_allclose\n\nfrom ..ui import scale_image\n\nDATA = np.array([0, 1., 2.])\nDATASCL = 0.5 * DATA\n\n\nclass TestImageScaling(object):\n \n d... | python | chosen |
[
{
"from": "system",
"value": "Remove index on field that no longer exists\n\n[skip ci]\n"
},
{
"from": "human",
"value": "# Indices that need to be added manually:\n#\n# invoke shell --no-transaction\n\nfrom pymongo import ASCENDING, DESCENDING\n\n\ndb['nodelog'].create_index([\n ('__backrefs... | python | chosen |
[
{
"from": "system",
"value": "Add dct and idct in scipy.fftpack namespace.\n"
},
{
"from": "human",
"value": "#\n# fftpack - Discrete Fourier Transform algorithms.\n#\n# Created: Pearu Peterson, August,September 2002\n\nfrom info import __all__,__doc__\n\nfrom fftpack_version import fftpack_vers... | python | chosen |
[
{
"from": "system",
"value": "Use aero info instead for caching info\n\nBrew requires brew info for additional information. If we instead call aero info we can at least cache the info calls for later.\n"
},
{
"from": "human",
"value": "# -*- coding: utf-8 -*-\n__author__ = 'nickl-'\n\nfrom aero.... | python | chosen |
[
{
"from": "system",
"value": "Revise docstring by adding advantage\n"
},
{
"from": "human",
"value": "from __future__ import absolute_import\nfrom __future__ import print_function\nfrom __future__ import division\n\n\ndef insertion_sort(a_list):\n \"\"\"Insertion Sort algortihm.\n\n Time c... | python | chosen |
[
{
"from": "system",
"value": "Ch05: Tag Detail: load and render template.\n"
},
{
"from": "human",
"value": "from django.http.response import HttpResponse\nfrom django.template import Context, loader\n\nfrom .models import Tag\n\n\ndef homepage(request):\n tag_list = Tag.objects.all()\n te... | python | chosen |
[
{
"from": "system",
"value": "Fix logic error in schedule filter\n"
},
{
"from": "human",
"value": "from django.contrib import admin\nfrom django.utils.translation import ugettext_lazy as _\n\nfrom wafer.talks.models import TalkType, Talk, TalkUrl\n\nclass ScheduleListFilter(admin.SimpleListFilt... | python | chosen |
[
{
"from": "system",
"value": "Fix mock of request for block rendering\n"
},
{
"from": "human",
"value": "import mock\n\nfrom django.test import TestCase\nfrom django.template import RequestContext\n\nfrom fancypages.models import Container\nfrom fancypages.models.blocks import TwoColumnLayoutBlo... | python | chosen |
[
{
"from": "system",
"value": "Fix bug in sund serializer\n"
},
{
"from": "human",
"value": "from apps.projects.serializers import ProjectSmallSerializer\nfrom rest_framework import serializers\nfrom rest_framework import relations\nfrom rest_framework import fields\nfrom .models import Donation,... | python | chosen |
[
{
"from": "system",
"value": "Make variable names more explicit\n"
},
{
"from": "human",
"value": "# -*- coding: utf-8 -*-\n\nfrom __future__ import unicode_literals, print_function, division, absolute_import\nfrom openfisca_core.commons import to_unicode\n\n\ndef build_entities(tax_benefit_syst... | python | chosen |
[
{
"from": "system",
"value": "Add method to create a normal user\n"
},
{
"from": "human",
"value": "from mailu import manager, db\nfrom mailu.admin import models\nfrom passlib import hash\n\n\n@manager.command\ndef flushdb():\n \"\"\" Flush the database\n \"\"\"\n db.drop_all()\n\n\n@ma... | python | chosen |
[
{
"from": "system",
"value": "Fix typo, even though this example is not used for anything.\n"
},
{
"from": "human",
"value": "\nimport toast\n\n# Split COMM_WORLD into groups of 4 processes each\ncm = toast.Comm(world=MPI.COMM_WORLD, groupsize=4)\n\n# Create the distributed data object\ndd = toa... | python | chosen |
[
{
"from": "system",
"value": "Clear cookies if someone's got dodgy cookie info\n"
},
{
"from": "human",
"value": "import bcrypt\nimport hashlib\n\nfrom pylons import response, request, url, config\nfrom pylons import tmpl_context as c\nfrom pylons.controllers.util import redirect\n\nimport poric... | python | chosen |
[
{
"from": "system",
"value": "Use config.log for print added in last commit\n"
},
{
"from": "human",
"value": "#! /usr/bin/env python\n#\n#\n#\n\nimport skoleintra.config\nimport skoleintra.pgContactLists\nimport skoleintra.pgDialogue\nimport skoleintra.pgDocuments\nimport skoleintra.pgFrontpage... | python | chosen |
[
{
"from": "system",
"value": "Rename the date field related to the project status\n"
},
{
"from": "human",
"value": "# -*- encoding:utf-8 -*-\nfrom django.db import models\n\n\nclass Project(models.Model):\n STATUS = (\n ('unrevised', u'Неразгледан'),\n ('returned', u'Върнат за ... | python | chosen |
[
{
"from": "system",
"value": "Add parsing for list of numbers.\n"
},
{
"from": "human",
"value": "from datetime import datetime\n\n\ndef _parse_arg(value, target, maximum):\n if value == '*':\n return True\n\n if '/' in value:\n value, interval = value.split('/')\n if ... | python | chosen |
[
{
"from": "system",
"value": "Switch to pretty printing JSON for the API.\n"
},
{
"from": "human",
"value": "from tastypie.resources import ModelResource\nfrom questions.models import Answer\n\nclass AnswerResource(ModelResource):\n class Meta:\n queryset = Answer.objects.all()\n ... | python | chosen |
[
{
"from": "system",
"value": "Fix spammy logging during IPython tab complete\n\nhttps://github.com/ipython/ipython/issues/10946\n"
},
{
"from": "human",
"value": "c.TerminalIPythonApp.display_banner = False\nc.TerminalInteractiveShell.confirm_exit = False\nc.TerminalInteractiveShell.highlighting... | python | chosen |
[
{
"from": "system",
"value": "Add unicode repr to NewsItem\n"
},
{
"from": "human",
"value": "# -*- coding: utf-8 -*-\n'''News model module\n\n@author: moschlar\n'''\n\nfrom datetime import datetime\n\nfrom sqlalchemy import ForeignKey, Column\nfrom sqlalchemy.types import Integer, Unicode, Date... | python | chosen |
[
{
"from": "system",
"value": "Refactor the task for getting token to store it in DB\n"
},
{
"from": "human",
"value": "from celery.task import Task\nfrom celery.utils.log import get_task_logger\nimport requests\n\n\nlogger = get_task_logger(__name__)\n\n\nclass Hotsocket_Login(Task):\n\n \"\"... | python | chosen |
[
{
"from": "system",
"value": "Update PageStatusMiddleware for use with Python 3\n"
},
{
"from": "human",
"value": "try:\n from django.utils.deprecation import MiddlewareMixin\nexcept ImportError:\n MiddlewareMixin = object\n\n\nclass PageStatusMiddleware(MiddlewareMixin):\n \"\"\"Add th... | python | chosen |
[
{
"from": "system",
"value": "Deal with existing symlinks and add more error checking\n"
},
{
"from": "human",
"value": "#!/usr/bin/python\n\n# FIXME Need to handle the case when symlinks already exists\n\nimport os\n\ntheme_dir = os.path.expanduser('~/.themes/olpc/gtk-2.0')\nengine_dir = os.pat... | python | chosen |
[
{
"from": "system",
"value": "Fix stupid git app committing unwanted stuff~\n"
},
{
"from": "human",
"value": "# coding: utf-8\n\n\"\"\"\nCreated on 2016-08-23\n@author: naoey\n\"\"\"\n\nVERSION = \"0.0.3\"\n\nBOT_PREFIX = \":\"\n\nPATHS = {\n \"logs_dir\": \"./../logs/\",\n\n \"database\"... | python | chosen |
[
{
"from": "system",
"value": "Use parentheses instead of \\ for multi-line import.\n"
},
{
"from": "human",
"value": "from __future__ import division, absolute_import\n\n# If we're in the source directory, don't import anything, since that\n# requires 2to3 to be run.\nfrom astropy import setup_h... | python | chosen |
[
{
"from": "system",
"value": "Update IndexFile model to have 'index' column instead of 'reference'\n"
},
{
"from": "human",
"value": "import enum\nfrom sqlalchemy import Column, Integer, String, Enum\n\nfrom virtool.pg.utils import Base, SQLEnum\n\n\nclass IndexType(str, SQLEnum):\n \"\"\"\n ... | python | chosen |
[
{
"from": "system",
"value": "Resolve path in case it involves a symlink\n\nReviewed By: ppwwyyxx\n\nDifferential Revision: D27823003\n\nfbshipit-source-id: 67e6905f3c5c7bb1f593ee004160b195925f6d39\n"
},
{
"from": "human",
"value": "# Copyright (c) Facebook, Inc. and its affiliates.\nimport impo... | python | chosen |
[
{
"from": "system",
"value": "Fix typos in tempest API tests for profile_delete\n\nThis patch fixes typos in tempest API tests for profile_delete.\n\nChange-Id: Ic6aa696f59621a5340d6cf67be76e830bbd30e67\n"
},
{
"from": "human",
"value": "# Licensed under the Apache License, Version 2.0 (the \"Li... | python | chosen |
[
{
"from": "human",
"value": "[AIRFLOW-XXX] Add license to Contrib Example DAG Init file\n"
},
{
"from": "gpt",
"value": "# -*- coding: utf-8 -*-\n#\n# Licensed to the Apache Software Foundation (ASF) under one\n# or more contributor license agreements. See the NOTICE file\n# distributed with th... | python | chosen |
[
{
"from": "system",
"value": "Remove no longer needed pylint pragma\n"
},
{
"from": "human",
"value": "\"\"\"This module implements the torrent's underlying storage.\"\"\"\n\n\nfrom .. import bencode\n\n\nclass Backbone: # pylint: disable=too-few-public-methods\n \"\"\"Torrent file low-le... | python | chosen |
[
{
"from": "system",
"value": "Add server tests for auto join plugin\n"
},
{
"from": "human",
"value": "from tests import base\n\n\ndef setUpModule():\n base.enabledPlugins.append('autojoin')\n base.startServer()\n\n\ndef tearDownModule():\n base.stopServer()\n\n\nclass AutoJoinTest(base... | python | chosen |
[
{
"from": "system",
"value": "Add another test to explicitly connect to a serial port.\n"
},
{
"from": "human",
"value": "import unittest\nimport time\nfrom Arduino import Arduino\n\n\"\"\"\nA collection of some basic tests for the Arduino library.\n\nExtensive coverage is a bit difficult, since... | python | chosen |
[
{
"from": "system",
"value": "Refactor away unnecessary multiple return None\n"
},
{
"from": "human",
"value": "from django.contrib.auth.decorators import login_required\nfrom stronghold import conf, utils\n\n\nclass LoginRequiredMiddleware(object):\n \"\"\"\n Force all views to use login ... | python | chosen |
[
{
"from": "system",
"value": "Use iterator in migration to reduce memory\n"
},
{
"from": "human",
"value": "# Generated by Django 2.0.6 on 2018-06-19 16:57\n\nfrom django.db import migrations\n\n\ndef generate_arxiv_ids(apps, schema_editor):\n SourceFile = apps.get_model('papers', 'SourceFile... | python | chosen |
[
{
"from": "system",
"value": "Improve test performance by using the md5 hasher for tests.\n"
},
{
"from": "human",
"value": "from django.conf import settings\nimport base64\nimport os\nimport os.path\n\n\ndef pytest_configure(config):\n if not settings.configured:\n os.environ['DJANGO_... | python | chosen |
[
{
"from": "system",
"value": "Make config values not case-sensitive.\n"
},
{
"from": "human",
"value": "import os\nfrom traceback import format_exc\n\nfrom apps.config.models import ConfigValue\nimport functions_general\n\"\"\"\nHandle the setting/retrieving of server config directives.\n\"\"\"\... | python | chosen |
[
{
"from": "system",
"value": "Refactor tests to use setup\n"
},
{
"from": "human",
"value": "# Copyright (c) 2017 The Regents of the University of Michigan.\n# All Rights Reserved. Licensed according to the terms of the Revised\n# BSD License. See LICENSE.txt for details.\nfrom hamcrest import *... | python | chosen |
[
{
"from": "system",
"value": "Convert for use with Django\n"
},
{
"from": "human",
"value": "#!/usr/bin/env python\nimport re\nimport sys\n\n\ndef chunk(l,n):\n return (l[i:i+n] for i in xrange(0, len(l), n))\n\n\ndef is_disposable_email(email):\n emails = [line.strip() for line in open('d... | python | chosen |
[
{
"from": "system",
"value": "Fix for assertIn method not being present in Python 2.6.\nUndo prior erroneous commit (assertIn is missing, not assertIs).\n"
},
{
"from": "human",
"value": "from datetime import datetime\nimport sys\nimport unittest\n\nimport btceapi\n\n\nclass TestScraping(unittes... | python | chosen |
[
{
"from": "system",
"value": "Check to ensure that we're dealing with \"green\" threads\n"
},
{
"from": "human",
"value": "from guv.green import threading, time\n\n\ndef f1():\n \"\"\"A simple function\n \"\"\"\n print('Hello, world!')\n\n\ndef f2():\n \"\"\"A simple function that sl... | python | chosen |
[
{
"from": "system",
"value": "Add unit test for mongofy_courses of udacity module\n"
},
{
"from": "human",
"value": "import unittest\n\nfrom mooc_aggregator_restful_api import udacity\n\n\nclass UdacityTestCase(unittest.TestCase):\n '''\n Unit Tests for module udacity\n\n '''\n\n def... | python | chosen |
[
{
"from": "system",
"value": "Use pkg_resources to resolve file paths\n"
},
{
"from": "human",
"value": "import os\n\nVERBS_PATH = os.path.join(\n os.path.dirname(os.path.abspath(__file__)), 'verbs.txt'\n )\n"
},
{
"from": "gpt",
"value": "from pkg_resources import resource... | python | chosen |
[
{
"from": "system",
"value": "Correct typo in getting BACKEND.\n\nSigned-off-by: Chris Lamb <711c73f64afdce07b7e38039a96d2224209e9a6c@thread.com>\n"
},
{
"from": "human",
"value": "from django.conf import settings\n\ndef setting(suffix, default):\n return getattr(settings, 'LIGHTWEIGHT_QUEUE_... | python | chosen |
[
{
"from": "system",
"value": "Remove special-casing of aipsppimage test\n\nWe have other dependencies on pyrap too...\n\ngit-svn-id: 71bcaaf8fac6301ed959c5094abb905057e55e2d@2123 2b73c8c1-3922-0410-90dd-bc0a5c6f2ac6\n"
},
{
"from": "human",
"value": "import unittest\n\ntestfiles = [\n 'tkp.te... | python | chosen |
[
{
"from": "system",
"value": "Disable debug output of sqla\n"
},
{
"from": "human",
"value": "from sqlalchemy import create_engine\nfrom tornado.web import Application, url\n\nfrom buildbox.config import settings\nfrom buildbox.db.backend import Backend\nfrom buildbox.web.frontend.build_list imp... | python | chosen |
[
{
"from": "system",
"value": "Make UUID a non-pk to work around problems in 3rd party apps\n"
},
{
"from": "human",
"value": "import uuid\nimport logging\nfrom django.db import models\nfrom django.contrib.auth.models import AbstractUser as DjangoAbstractUser\n\nlogger = logging.getLogger(__name_... | python | chosen |
[
{
"from": "system",
"value": "Fix typo in upgrade script\n\ngit-svn-id: 0d96b0c1a6983ccc08b3732614f4d6bfcf9cbb42@1647 af82e41b-90c4-0310-8c96-b1721e28e2e2\n"
},
{
"from": "human",
"value": "import os.path\nimport shutil\n\nsql = \"\"\"\n-- Remove empty values from the milestone list\nDELETE FROM... | python | chosen |
[
{
"from": "system",
"value": "Make sure the logger class is process aware even when running Python >= 2.6\n"
},
{
"from": "human",
"value": "import logging\nimport sys\n\n\ndef _check_logger_class():\n \"\"\"Make sure process name is recorded when loggers are used.\"\"\"\n\n from multiproc... | python | chosen |
[
{
"from": "system",
"value": "Raise SystemExit if not in virtualenv.\n"
},
{
"from": "human",
"value": "#!/usr/bin/python\n#-*- coding:utf-8 -*-\n\"\"\"\nExecutes the methos in utils.py\nThis file should be running under the original python,\nnot an env one\n\"\"\"\n\nimport sys\nfrom venv_depen... | python | chosen |
[
{
"from": "system",
"value": "Increase the timeout value for the VOMS Admin start-up from 60s to 120s.\nPrimarily, this is driven by occasional timeouts in the VMU tests, which\ncan run slowly on a heavily loaded host.\n\n\ngit-svn-id: 884a03e47e2adb735d896e55bb5ad6bc3421ba19@18485 4e558342-562e-0410-864c-e... | python | chosen |
[
{
"from": "system",
"value": "Make default width be 8.\n"
},
{
"from": "human",
"value": "import mmap\n\nfrom ipywidgets import DOMWidget\nfrom traitlets import Int, Unicode, List, Instance, Bytes, Enum\n\nimport base64\n\nclass BinaryView(DOMWidget):\n _view_module = Unicode('nbextensions/bi... | python | chosen |
[
{
"from": "system",
"value": "Move IP address to a constant at least\n\nPerhaps we need to move it to the 'configuration' file later.\n"
},
{
"from": "human",
"value": "from django.views.decorators.csrf import csrf_exempt\nfrom django.shortcuts import render\nfrom django.http import HttpResponse... | python | chosen |
[
{
"from": "system",
"value": "Make morse parser not assume that the current working directory is common/\n"
},
{
"from": "human",
"value": "f = open(\"morse_table.txt\")\n\nmorse_table = f.read()\nmorse_table = dict([(morse[0:1], morse[2:len(morse)]) for morse in morse_table.split(\"\\n\")])\n\n... | python | chosen |
[
{
"from": "system",
"value": "Support to request null string\n"
},
{
"from": "human",
"value": "import ast\n\n\ndef isEmpty(value):\n if value:\n return False\n else:\n return True\n\n\ndef isNotEmpty(value):\n if not value:\n return False\n else:\n return... | python | chosen |
[
{
"from": "system",
"value": "Use `packaging.version.parser` for version parsing"
},
{
"from": "human",
"value": "#!/usr/bin/env python\n# encoding: utf-8\n\"\"\"\n\n\"\"\"\nfrom __future__ import absolute_import\nimport sys\nimport os\n\nimport ursgal.uparams\n\n# this is for unorthodox queries... | python | chosen |
[
{
"from": "system",
"value": "Fix up unit tests so they all pass.\n"
},
{
"from": "human",
"value": "import logging\n\nclass IncludePath(object):\n def __init__(self, project_layout, project_services):\n self.project_layout = project_layout\n self.project_services = project_serv... | python | chosen |
[
{
"from": "system",
"value": "Make sure __setitem__ is available for site.register()\n"
},
{
"from": "human",
"value": "from django.contrib.admin.sites import AdminSite as DjangoAdminSite\nfrom django.contrib.admin.sites import site as django_site\n\n\nclass HatbandAndDjangoRegistry(object):\n ... | python | chosen |
[
{
"from": "system",
"value": "Ch05: Create URL pattern for Tag Detail.\n"
},
{
"from": "human",
"value": "\"\"\"suorganizer URL Configuration\n\nThe `urlpatterns` list routes URLs to views. For more information please see:\n https://docs.djangoproject.com/en/1.8/topics/http/urls/\nExamples:\n... | python | chosen |
[
{
"from": "system",
"value": "Add off file reader with 3d resampling\n"
},
{
"from": "human",
"value": "import numpy as np\n\n\ndef testOFFReader():\n path = '../sample-data/chair.off'\n raw_data = tuple(open(path, 'r'))\n header = raw_data.strip(' ')[:-1]\n n_vertices, n_faces = hea... | python | chosen |
[
{
"from": "system",
"value": "Add test to assert no access to app\n"
},
{
"from": "human",
"value": "# -*- coding: utf-8 -*-\nfrom pyramid.testing import DummyRequest\nfrom learning_journal.models import Entry, DBSession\nimport pytest\nfrom learning_journal import main\nimport webtest\nfrom lea... | python | chosen |
[
{
"from": "system",
"value": "Add a test for update correctness\n"
},
{
"from": "human",
"value": "from nose import tools\nimport numpy as np\n\nfrom trials.variations import *\n\n\nclass TestBernoulli:\n\n def setup(self):\n self.x = BernoulliVariation(1, 1)\n\n def test_update(sel... | python | chosen |
[
{
"from": "system",
"value": "Fix trailing space functional test.\n"
},
{
"from": "human",
"value": "# enable: W9010,W9011\n\n# A line with trailing space.\nprint \"this line has trailing space\" \n\n# next blank line contains a whitespace\n "
},
{
"from": "gpt",
"value": "# enable: ... | python | chosen |
[
{
"from": "system",
"value": "Add regression fix for Django < 1.11\n"
},
{
"from": "human",
"value": "from django.contrib.auth.backends import RemoteUserBackend\n\n\nclass ShopUserBackend(RemoteUserBackend):\n\n def authenticate(self, request=None, myshopify_domain=None, token=None, **kwargs)... | python | chosen |
[
{
"from": "system",
"value": "Modify format of address book dictionary\n"
},
{
"from": "human",
"value": "import logging\nimport warnings\ntry:\n import cPickle as pickle\nexcept ImportError:\n import pickle\n\nlogger = logging.getLogger(__name__)\n\ntry:\n address_book = pickle.load(op... | python | chosen |
[
{
"from": "system",
"value": "Use context as well for html page objects\n"
},
{
"from": "human",
"value": "from __future__ import absolute_import\n\nfrom django.views.generic.detail import DetailView\nfrom django.template import Template\nfrom django.template.response import TemplateResponse\nfr... | python | chosen |
[
{
"from": "system",
"value": "Load files from absolute paths so this can be run from anywhere\n"
},
{
"from": "human",
"value": "# -*- coding: utf-8 -*-\n# Minimal set of functions and variables from 0.2.1's crypto_util.py needed to\n# regenerate journalist designations from soure's filesystem i... | python | chosen |
[
{
"from": "system",
"value": "Fix docstring of error functions\n"
},
{
"from": "human",
"value": "import cupy.core.fusion\nfrom cupy.math import ufunc\n\n\n_erf = ufunc.create_math_ufunc(\n 'erf', 1, 'cupyx_scipy_erf',\n '''Error function.\n\n .. seealso:: :meth: scipy.special.erf\n\n ... | python | chosen |
[
{
"from": "system",
"value": "Remove unnecessary import that was failing a test\n"
},
{
"from": "human",
"value": "from lxml import etree\n\nfrom xmodule.x_module import XModule\nfrom xmodule.raw_module import RawDescriptor\n\nimport comment_client\n\nimport json\n\nclass DiscussionModule(XModul... | python | chosen |
[
{
"from": "system",
"value": "Add normalization to each task\n"
},
{
"from": "human",
"value": "import torch\nfrom avalanche.benchmarks import GenericCLScenario, dataset_benchmark\nfrom avalanche.benchmarks.utils import AvalancheTensorDataset\nfrom torchvision import transforms\n\nimport ctrl\n\... | python | chosen |
[
{
"from": "system",
"value": "Add code to replace custom dynamic image tag with standard markdown image syntax\n"
},
{
"from": "human",
"value": "from django.utils.safestring import mark_safe\nimport CommonMark\n\n\n# Convert a markdown string into HTML5, and prevent Django from escaping it\ndef... | python | chosen |
[
{
"from": "system",
"value": "Rename `initialize_episode` --> `__call__` in `composer.Initializer`\n\nPiperOrigin-RevId: 234775654\n"
},
{
"from": "human",
"value": "# Copyright 2018 The dm_control Authors.\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may not us... | python | chosen |
[
{
"from": "system",
"value": "Remove unused import in lmod\n"
},
{
"from": "human",
"value": "import os\nimport re\n\nfrom collections import OrderedDict\nfrom subprocess import Popen, PIPE\n\nLMOD_CMD = os.environ['LMOD_CMD']\nLMOD_SYSTEM_NAME = os.environ.get('LMOD_SYSTEM_NAME', '')\n\ndef mod... | python | chosen |
[
{
"from": "system",
"value": "Add push and pop test.\n"
},
{
"from": "human",
"value": "# Test file for stack.py\n# Authors Mark, Efrain, Henry\n\nimport pytest\nimport stack as st\n\ndef test_init():\n \"\"\"Test stack constructor.\"\"\"\n a = st.Stack()\n assert isinstance(a, st.Stack... | python | chosen |
[
{
"from": "system",
"value": "Add feature generation tests to test runner\n"
},
{
"from": "human",
"value": "#!/usr/bin/env python3.5\n\nfrom subprocess import call\nfrom os.path import dirname, abspath, join\n\n# Run all the tests using py.test\ncall([\"python3.5\", \"-m\", \"unittest\", \"-f\"... | python | chosen |
[
{
"from": "system",
"value": "Use ContentType for more abstract moderation\n"
},
{
"from": "human",
"value": "from django.db import models\nfrom django.utils.translation import ugettext as _\nfrom development.models import Project\n\nclass ModeratedProject(Project):\n \"\"\"\n Project awai... | python | chosen |
[
{
"from": "system",
"value": "Add DatabaseError to list of errors that kill a historian\n"
},
{
"from": "human",
"value": "from flow import exit_codes\nfrom flow.configuration.settings.injector import setting\nfrom flow.handler import Handler\nfrom flow.util.exit import exit_process\nfrom flow_w... | python | chosen |
[
{
"from": "system",
"value": "Set the __name__ on the traversal object\n"
},
{
"from": "human",
"value": "class Root(object):\n \"\"\" \n The main root object for any traversal\n \"\"\"\n\n __name__ = None\n __parent__ = None\n\n def __init__(self, request):\n pass\n\n ... | python | chosen |
[
{
"from": "system",
"value": "Fix model definition in signature form\n"
},
{
"from": "human",
"value": "from petition.forms import BaseSignatureForm\nfrom crispy_forms.layout import Layout\nfrom crispy_forms.bootstrap import PrependedText\n\n\nclass SignatureForm(BaseSignatureForm):\n def __i... | python | chosen |
[
{
"from": "system",
"value": "Check that the password parameter when unsetting mode k matches the password that is set\n"
},
{
"from": "human",
"value": "from twisted.words.protocols import irc\nfrom txircd.modbase import Mode\n\nclass PasswordMode(Mode):\n\tdef commandPermission(self, user, cmd... | python | chosen |
[
{
"from": "system",
"value": "Add acceptance tests for results pages (2012 and 2013)\n"
},
{
"from": "human",
"value": "import pytest\n\n\n@pytest.mark.django_db\ndef test_homepage(client):\n response = client.get('/')\n assert response.status_code == 200\n"
},
{
"from": "gpt",
... | python | chosen |
[
{
"from": "system",
"value": "Add a test for importing a nonexistent extension\n"
},
{
"from": "human",
"value": "import unittest\n\n\nclass TestExtensions(unittest.TestCase):\n def test_import_extension(self):\n import pybel.ext.test\n\n assert pybel.ext.test.an_extension_funct... | python | chosen |
[
{
"from": "system",
"value": "Check time argument as Position type.\n"
},
{
"from": "human",
"value": "\"\"\"\n\nFile: tempo_event.py\n\nPurpose: Defines a tempo as an Event \n\n\"\"\"\nfrom timemodel.event import Event\n\n\nclass TempoEvent(Event):\n \"\"\"\n Defines tempo as an Event, g... | python | chosen |
[
{
"from": "system",
"value": "Change project name to cljsbook.\n"
},
{
"from": "human",
"value": "import paver\nfrom paver.easy import *\nimport paver.setuputils\npaver.setuputils.install_distutils_tasks()\nimport os, sys\n\nfrom sphinxcontrib import paverutils\n\nsys.path.append(os.getcwd())\n\... | python | chosen |
[
{
"from": "system",
"value": "Use \"/login\" as default URL where to redirect URLs when not logged in.\n\n Could use \"/\" as alternative as well...\n"
},
{
"from": "human",
"value": "from django.contrib.auth import REDIRECT_FIELD_NAME\nfrom django.contrib.auth.decorators import login_required, ... | python | chosen |
[
{
"from": "system",
"value": "Fix stdout/stderr output location so we do not output to UM but to cura\n\nFixes #452\n"
},
{
"from": "human",
"value": "#!/usr/bin/env python3\n\n# Copyright (c) 2015 Ultimaker B.V.\n# Cura is released under the terms of the AGPLv3 or higher.\n\nimport sys\n\ndef e... | python | chosen |
[
{
"from": "system",
"value": "Fix Python syntax error in triangles_printing"
},
{
"from": "human",
"value": "// range\nr = 9\nbound = round(r/2)\n\nfor y in range(r):\n for x in range(r):\n if (x >= bound-y AND x <= bound+y):\n print(\"*\", end='')\n else:\n print(\" \", end='')... | python | chosen |
[
{
"from": "system",
"value": "feat: Add KFold cross validation and evaluation metrics to GaussianNB\n"
},
{
"from": "human",
"value": "from feature_format import featureFormat, targetFeatureSplit\nimport pickle\nfrom sklearn.naive_bayes import GaussianNB\n\n# loading the enron data dictionary\nw... | python | chosen |
[
{
"from": "system",
"value": "Fix missing argument of child embeddings\n"
},
{
"from": "human",
"value": "from .ids_to_embeddings import ids_to_embeddings\nfrom .embeddings_to_embedding import embeddings_to_embedding\nfrom ..util import static_rank\n\n\ndef id_sequecne_to_embedding(child_id_sequ... | python | chosen |
[
{
"from": "system",
"value": "[trunk] Convert line endings on Objective C/C++ test source too\n"
},
{
"from": "human",
"value": "#!/usr/bin/python\n\nimport os\nimport sys\n\ndef convert_line_endings(file):\n if '\\r\\n' in open(file, 'rb').read():\n print '%s contains DOS line endings... | python | chosen |
[
{
"from": "system",
"value": "[REF] openacademy: Add domain or and ilike\n"
},
{
"from": "human",
"value": "# -*- coding: utf-8 -*-\r\n\r\nfrom openerp import fields, models, api\r\n\r\nclass Session(models.Model):\r\n\t_name = 'openacademy.session'\r\n\t\r\n\tname = fields.Char(required=True)\r... | python | chosen |
[
{
"from": "system",
"value": "Split up some of the paver tasks so we can build and uninstall a la carte\n"
},
{
"from": "human",
"value": "import subprocess\n\nfrom paver.easy import *\n\n\ndef call(*args, **kwargs):\n return subprocess.call(args, **kwargs)\n\n\n@task\ndef push():\n \"\"\"... | python | chosen |
[
{
"from": "system",
"value": "Add search by name to dicts\n"
},
{
"from": "human",
"value": "# coding: utf-8\nfrom django.forms.models import modelform_factory\nfrom django.http import Http404\n\nfrom dartcms import get_model\nfrom dartcms.views import GridView, InsertObjectView, UpdateObjectVie... | python | chosen |
[
{
"from": "system",
"value": "Add shared code module path to Python module path\n"
},
{
"from": "human",
"value": "from google.appengine.ext import vendor\n# Add any libraries installed in the \"lib\" folder.\nvendor.add('lib')\n"
},
{
"from": "gpt",
"value": "import os\nimport sys\n... | python | chosen |
[
{
"from": "system",
"value": "Add return value stating Steam was started\n"
},
{
"from": "human",
"value": "#!flask/bin/python\nfrom flask import Flask, render_template\nfrom subprocess import Popen, PIPE\nfrom flask.ext.script import Manager, Server\n\napp = Flask(__name__)\n\nmanager = Manager... | python | chosen |
[
{
"from": "system",
"value": "Fix syntax error in test\n"
},
{
"from": "human",
"value": "#!/usr/bin/env python\n\n\"\"\"\nTest the MPS class\n\"\"\"\nimport unittest\nimport numpy as np\n\nimport parafermions as pf\n\nclass Test(unittest.TestCase):\n\n def test_pe_degeneracy(self):\n ... | python | chosen |
[
{
"from": "system",
"value": "Use a stylesheet if provided as 2nd arg\n"
},
{
"from": "human",
"value": "from ete2 import Nexml, TreeStyle\nimport sys\n\nif len(sys.argv) < 2:\n print(\"Command line argument required: NeXML file\")\n exit(-1)\n\nnexml = Nexml()\nnexml.build_from_file(sys.a... | python | chosen |
[
{
"from": "system",
"value": "Fix for the pyinstall unit test\n"
},
{
"from": "human",
"value": "import os\nimport sys\n\nimport pytest\nfrom mock import patch\nimport pytest\n\nfrom pkglib.scripts import pyinstall\n\n\n@pytest.mark.skipif('TRAVIS' in os.environ,\n reason=\"Ou... | python | chosen |
[
{
"from": "system",
"value": "Add atlas as an argument for mesh initialisation.\n"
},
{
"from": "human",
"value": "class RectangularMesh(object):\n def __init__(self, d, atlas='atlas', meshname='mesh'):\n if not isinstance(d, (tuple, list)) or len(d) != 3:\n raise ValueError... | python | chosen |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.