conversations listlengths 2 3 | source stringclasses 1
value | stack stringclasses 1
value |
|---|---|---|
[
{
"from": "system",
"value": "Remove 7 characters to get rid of \".models\"\n"
},
{
"from": "human",
"value": "from sqjobs.utils import get_jobs_from_module\n\nimport logging\nlogger = logging.getLogger('sqjobs.contrib.django.utils')\n\n\ndef get_apps_names():\n \"\"\"\n copied from django... | python | chosen |
[
{
"from": "system",
"value": "Return string instead of list\n"
},
{
"from": "human",
"value": "# encoding=utf8\nfrom lxml import html\n\n\ndef _recursive_convert(element):\n # All strings outside tags should be ignored\n if not isinstance(element, html.HtmlElement):\n return\n\n ... | python | chosen |
[
{
"from": "system",
"value": "Fix python 2.7 compatibility issue\n"
},
{
"from": "human",
"value": "import cv2\nimport itertools\nimport numpy as np\n\ndef partition(pred, iterable):\n \"\"\"\n Partition the iterable into two disjoint entries based\n on the predicate.\n\n @return: Tuple (ite... | python | chosen |
[
{
"from": "system",
"value": "Remove duplicate dot in file downloads\n"
},
{
"from": "human",
"value": "import os\n\nfrom django.http import FileResponse, HttpRequest, HttpResponse\nfrom django.shortcuts import get_object_or_404\nfrom django.utils.functional import cached_property\nfrom django.v... | python | chosen |
[
{
"from": "system",
"value": "Add backwards compatibility with pip v9"
},
{
"from": "human",
"value": "#!/usr/bin/env python\n\nimport json\nimport sys\nfrom pip._internal.req import parse_requirements\nfrom pip._internal.download import PipSession\nfrom pip._vendor import pkg_resources\nfrom pi... | python | chosen |
[
{
"from": "system",
"value": "Create commands for labextension and nbextension\n"
},
{
"from": "human",
"value": "from setuptools import setup\nfrom setupbase import create_cmdclass, install_npm\n\ncmdclass = create_cmdclass(['js'])\ncmdclass['js'] = install_npm()\n\nsetup_args = dict(\n name... | python | chosen |
[
{
"from": "system",
"value": "Fix typo: `dolphine` -> `dolphin`\n"
},
{
"from": "human",
"value": "#!/usr/bin/env python\n\"\"\"\nAutocompletion example that shows meta-information alongside the completions.\n\"\"\"\nfrom __future__ import unicode_literals\n\nfrom prompt_toolkit.contrib.complete... | python | chosen |
[
{
"from": "system",
"value": "Test link's shares retrieving using get_share method\n"
},
{
"from": "human",
"value": "from nose.tools import eq_, raises\nfrom mock import MagicMock, patch\n\nfrom buffer.models.link import Link\n\ndef test_links_shares():\n '''\n Test link's shares retrieving... | python | chosen |
[
{
"from": "system",
"value": "Add neutron client without test\n"
},
{
"from": "human",
"value": "\"\"\" OpenstackDriver for Network\n based on NetworkDriver\n\"\"\"\n\nfrom neutronclient.v2_0 import client\nfrom network_driver import NetworkDriver\n\n\nclass OpenstackNetWorkDriver(NetworkDriv... | python | chosen |
[
{
"from": "system",
"value": "BoW: Mark features to skip normalization\n\nThis fixes SVM on sparse data.\n"
},
{
"from": "human",
"value": "import numpy as np\nfrom gensim import matutils\nfrom gensim.corpora import Dictionary\n\n\nclass BaseVectorizer:\n \"\"\"Base class for vectorization ob... | python | chosen |
[
{
"from": "system",
"value": "Rename statistics handler to be more specific\n"
},
{
"from": "human",
"value": "#!/usr/bin/env python\n\nimport rospy\nimport socket\nfrom statistics.msg import StatsD\n\nclass StatsHandler():\n def __init__(self, statsd_host, statsd_port):\n self.statsd_target... | python | chosen |
[
{
"from": "system",
"value": "Replace Entry's created's auto_now_add=True with default=datetime.now\n"
},
{
"from": "human",
"value": "from django.db import models\nfrom django.conf import settings\n\nfrom tempel import utils\n\nclass Entry(models.Model):\n content = models.TextField()\n l... | python | chosen |
[
{
"from": "system",
"value": "Fix wrong import in tests\n"
},
{
"from": "human",
"value": "import os\n\nNOSQL = any([name in (os.getenv(\"DB\") or \"\")\n for name in (\"datastore\", \"mongodb\", \"imap\")])\n\nif NOSQL:\n from test_dal_nosql import *\nelse:\n from sql import *\... | python | chosen |
[
{
"from": "system",
"value": "Handle downgrade on a sqlite db\n"
},
{
"from": "human",
"value": "\"\"\"Add periodicity of script\n\nRevision ID: 147d1de2e5e4\nRevises: \nCreate Date: 2019-04-19 18:48:33.526449\n\n\"\"\"\nfrom alembic import op\nimport sqlalchemy as sa\n\n\n# revision identifiers... | python | chosen |
[
{
"from": "system",
"value": "Fix platform detection for sles <12\n"
},
{
"from": "human",
"value": "import pytest\n\n\n@pytest.fixture(autouse=True)\ndef platform(request):\n marker = request.node.get_marker('platform')\n if marker:\n expected = marker.args[0]\n minion = req... | python | chosen |
[
{
"from": "system",
"value": "Stop looking in the old fuzzing/ directory\n"
},
{
"from": "human",
"value": "#!/usr/bin/env python\n\nimport os\n\nTHIS_SCRIPT_DIRECTORY = os.path.dirname(os.path.abspath(__file__))\nTHIS_REPO_PATH = os.path.abspath(os.path.join(THIS_SCRIPT_DIRECTORY, os.pardir))\n... | python | chosen |
[
{
"from": "human",
"value": "Add tests for temperature conversions in lesson 4.\n"
},
{
"from": "gpt",
"value": "import unittest\n\nfrom lessons.lesson_4_temperature import temperature\n\n\nclass CtoFTestCase(unittest.TestCase):\n def test_handles_freezing_point(self):\n freezing = tem... | python | chosen |
[
{
"from": "system",
"value": "Fix unique contraint in capability\n"
},
{
"from": "human",
"value": "# 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 obtain\n# a copy of the License at\n#\n# http:/... | python | chosen |
[
{
"from": "system",
"value": "Update schedules app to be a Django App Plugin\n"
},
{
"from": "human",
"value": "from django.apps import AppConfig\nfrom django.utils.translation import ugettext_lazy as _\n\n\nclass SchedulesConfig(AppConfig):\n name = 'openedx.core.djangoapps.schedules'\n v... | python | chosen |
[
{
"from": "system",
"value": "Remove a resolved TODO - trace file formats now standardized.\n"
},
{
"from": "human",
"value": "\"\"\"\nThis module contains the methods for the ``openxc-dump`` command line program.\n\n`main` is executed when ``openxc-dump`` is run, and all other callables in this... | python | chosen |
[
{
"from": "system",
"value": "Configure Django REST framework URLs\n"
},
{
"from": "human",
"value": "from django.conf.urls import patterns, include, url\n\nfrom django.contrib import admin\nadmin.autodiscover()\n\nurlpatterns = patterns('',\n # Examples:\n # url(r'^$', 'oshi_rest_server.v... | python | chosen |
[
{
"from": "system",
"value": "Fix backward compatiblity for MDTrajTopology\n"
},
{
"from": "human",
"value": "def missing_openmm(*args, **kwargs):\n raise RuntimeError(\"Install OpenMM to use this feature\")\n\ntry:\n import simtk.openmm\n import simtk.openmm.app\nexcept ImportError:\n ... | python | chosen |
[
{
"from": "system",
"value": "UPDATE create_access_token to handle guest sessions\n"
},
{
"from": "human",
"value": "# stdlib\nfrom datetime import datetime\nfrom datetime import timedelta\nfrom typing import Any\nfrom typing import Optional\nfrom typing import Union\n\n# third party\nfrom jose ... | python | chosen |
[
{
"from": "system",
"value": "Add test case for user path\n\nExpect filepath joinning '.yanico.conf' under $HOME.\n"
},
{
"from": "human",
"value": "# Copyright 2015-2016 Masayuki Yamamoto\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may not use this file exc... | python | chosen |
[
{
"from": "system",
"value": "Check the url of the remote & ensure the updating commands are executed in the correct directory\n"
},
{
"from": "human",
"value": "import os.path\nimport subprocess\n\n\nclass DefaultRepositoryHandler():\n def __init__(self, cwd):\n self.cwd = cwd\n\n ... | python | chosen |
[
{
"from": "system",
"value": "Add alternative solution for 'Find all duplicates in an array'\n"
},
{
"from": "human",
"value": "# Time: O(n)\n# Space: O(1)\n\n# Given an array of integers, 1 <= a[i] <= n (n = size of array),\n# some elements appear twice and others appear once.\n# Find all the ... | python | chosen |
[
{
"from": "system",
"value": "Add \"import sys\" for sys.stdout.\n\n\ngit-svn-id: b33bab8abb5b18c12ee100cd7761ab452d00b2b0@124504 91177308-0d34-0410-b5e6-96231b3b80d8\n"
},
{
"from": "human",
"value": "\"\"\"\nTest that lldb command \"command source\" works correctly.\n\nSee also http://llvm.org... | python | chosen |
[
{
"from": "system",
"value": "Update to move and run\n"
},
{
"from": "human",
"value": "class State(object):\n def __init__(self, ix):\n self.index = ix\n self.link = None # placeholder, not None if Snake or Ladder\n\n def process(self):\n \"\"\"Action when landed upo... | python | chosen |
[
{
"from": "system",
"value": "Add tests for search interface plugins\n"
},
{
"from": "human",
"value": "from __future__ import unicode_literals, division, absolute_import\nfrom builtins import * # noqa pylint: disable=unused-import, redefined-builtin\n\nfrom flexget import plugin\n\n\nclass Tes... | python | chosen |
[
{
"from": "system",
"value": "Set perks on form save.\n"
},
{
"from": "human",
"value": "from django import forms\nfrom django.utils.translation import ugettext_lazy as _, ugettext as __\nfrom .models import Funding\nfrom .widgets import PerksAmountWidget\n\n\nclass FundingForm(forms.Form):\n ... | python | chosen |
[
{
"from": "system",
"value": "Remove startup objects when setting up the test module.\n"
},
{
"from": "human",
"value": "\"\"\"Package for regression testing of the blender nif scripts.\"\"\"\n\nimport bpy\n\ndef setup(self):\n \"\"\"Enables the nif scripts addon, so all tests can use it.\"\"... | python | chosen |
[
{
"from": "system",
"value": "Add first tests. disk and ring masks for simple cases."
},
{
"from": "human",
"value": "\"\"\"Check ringtophat results against scipy.ndimage.convolve\"\"\""
},
{
"from": "gpt",
"value": "\"\"\"Check ringtophat results against scipy.ndimage.convolve\"\"\"... | python | chosen |
[
{
"from": "system",
"value": "Change output filenaming to have .txt\n"
},
{
"from": "human",
"value": "#! /usr/bin/python3\n\nimport sys\nimport os\nimport math\nfrom astropy.io import fits\n\ninputFolder = sys.argv[1]\noutputFolder = sys.argv[2]\neLo = int(sys.argv[3])\neHi = int(sys.argv[4])\n... | python | chosen |
[
{
"from": "system",
"value": "Fix Shell tests according to css changes\n"
},
{
"from": "human",
"value": "\"\"\"\n@given:\n-------\n\n@when:\n------\nI type the \"{command}\" shell command --> shell_command\n\n@then:\n------\nI should see the \"{command}\" result in shell output --> s... | python | chosen |
[
{
"from": "system",
"value": "Improve the users odds a little\n"
},
{
"from": "human",
"value": "from risk_engine import RiskEngine\nimport unittest\n\nclass RiskEngineTestCase(unittest.TestCase):\n\n def setUp(self):\n self.engine = RiskEngine()\n\n def test_roll_is_near_even(self):\n n... | python | chosen |
[
{
"from": "system",
"value": "Use either file input or stdin for filtering length\n"
},
{
"from": "human",
"value": "#!/usr/bin/env python\n\"\"\"filter_fasta_on_length.py \n\nFilter a fasta file so that the resulting sequences are all longer \nor equal to the length threshold parameter. Only ac... | python | chosen |
[
{
"from": "system",
"value": "Fix bug that meant rendering debug info was v slow.\n"
},
{
"from": "human",
"value": "from ckan.plugins import toolkit as tk\n\n\ndef qa_openness_stars_resource_html(resource):\n qa = resource.get('qa')\n if not qa:\n return '<!-- No qa info for this r... | python | chosen |
[
{
"from": "system",
"value": "Fix typo in docstring spotted by @armadev\n"
},
{
"from": "human",
"value": "from twisted.trial import unittest\n\nimport ooni.errors\n\nclass TestErrors(unittest.TestCase):\n\n def test_catch_child_failures_before_parent_failures(self):\n \"\"\"\n ... | python | chosen |
[
{
"from": "system",
"value": "Add TestVarSnap as a TestCase\n"
},
{
"from": "human",
"value": "import unittest\n\nfrom app import serve\n\n\nclass PageCase(unittest.TestCase):\n def setUp(self):\n serve.app.config['TESTING'] = True\n self.app = serve.app.test_client()\n\n def... | python | chosen |
[
{
"from": "system",
"value": "Remove custom OpenLayers.js from LocationAdmin.\n"
},
{
"from": "human",
"value": "from django.contrib.admin import ModelAdmin, register\nfrom django.contrib.gis.admin import GeoModelAdmin\nfrom weather.models import WeatherStation, Location\n\n\n@register(Location)... | python | chosen |
[
{
"from": "system",
"value": "Normalize already returns encoded value.\n"
},
{
"from": "human",
"value": "import unicodedata\nimport urllib\n\n\ndef normalize(name):\n if not isinstance(name, unicode):\n name = name.decode('utf-8')\n\n return unicodedata.normalize('NFKC', name.repla... | python | chosen |
[
{
"from": "system",
"value": "Add TriesExceededException to the base package\n"
},
{
"from": "human",
"value": "\"\"\"\nZorp\n\"\"\"\n\nfrom zorp.client import Client\nfrom zorp.decorator import remote_method\nfrom zorp.server import Server\n"
},
{
"from": "gpt",
"value": "\"\"\"\nZo... | python | chosen |
[
{
"from": "system",
"value": "Fix CFFI test when executed multiple times\n"
},
{
"from": "human",
"value": "import os\nimport ctypes\nimport doctest\n\nfrom numba import *\nimport numba\n\ntry:\n import cffi\n ffi = cffi.FFI()\nexcept ImportError:\n ffi = None\n\n# _____________________... | python | chosen |
[
{
"from": "system",
"value": "Add the sha to the tags in a way that won't cause an error\n"
},
{
"from": "human",
"value": "import datetime\nfrom urlparse import urljoin\nimport requests\n\n# project\nfrom checks import AgentCheck\n\nclass Veneur(AgentCheck):\n\n VERSION_METRIC_NAME = 'veneur... | python | chosen |
[
{
"from": "system",
"value": "Add type conversion rule comment\n"
},
{
"from": "human",
"value": "from .converter_base import DatatypeConverterBase\nimport dateutil\n\ndef _str_to_datetime(java_obj, idx):\n return dateutil.parser.parse(java_obj.getString(idx))\n\n\n_typename_to_converter_fxn ... | python | chosen |
[
{
"from": "system",
"value": "Clean the recent files list before displaying it in the startup dialog.\n"
},
{
"from": "human",
"value": "#!/usr/bin/env python\n#coding=utf8\n\nfrom whacked4 import config\nfrom whacked4.ui import windows\n\n\nclass StartDialog(windows.StartDialogBase):\n \"\"\... | python | chosen |
[
{
"from": "system",
"value": "Use clang on mac if XCode >= 4.5\n\nReview URL: https://codereview.chromium.org//14333010\n\ngit-svn-id: c93d8a2297af3b929165606efe145742a534bc71@21950 260f80e4-7a28-3924-810f-c04153c831b5\n"
},
{
"from": "human",
"value": "#!/usr/bin/env python\n# Copyright (c) 201... | python | chosen |
[
{
"from": "system",
"value": "Make sure a user has profile\n"
},
{
"from": "human",
"value": "import six\n\nfrom django.db import models\nfrom django.contrib.auth.models import User\n\n\n@six.python_2_unicode_compatible\nclass ImagerProfile(models.Model):\n user = models.OneToOneField(User)\n... | python | chosen |
[
{
"from": "system",
"value": "Call RunSQL instead of RunPython in pagecounter data migration.\n"
},
{
"from": "human",
"value": "# -*- coding: utf-8 -*-\n# Generated by Django 1.11.15 on 2018-11-12 17:18\nfrom __future__ import unicode_literals\n\nfrom django.db import migrations, connection\n\n... | python | chosen |
[
{
"from": "system",
"value": "Define the shell of the request method.\n"
},
{
"from": "human",
"value": "# -*- coding: utf-8 -*-\n\"\"\"\nspdypy.connection\n~~~~~~~~~~~~~~~~~\n\nContains the code necessary for working with SPDY connections.\n\"\"\"\n# Define some states for SPDYConnections.\nNEW... | python | chosen |
[
{
"from": "system",
"value": "Add getitem and len support for pseudo modules.\n"
},
{
"from": "human",
"value": "# pyinfra\n# File: pyinfra/pseudo_modules.py\n# Desc: essentially a hack that provides dynamic imports for the current deploy (CLI only)\n\nimport sys\nimport pyinfra\n\n\nclass Pseud... | python | chosen |
[
{
"from": "system",
"value": "Add utf-8 in autopost example\n"
},
{
"from": "human",
"value": "import time\nimport sys\nimport os\nimport glob\n\nsys.path.append(os.path.join(sys.path[0], '../../'))\nfrom instabot import Bot\n\nposted_pic_list = []\ntry:\n with open('pics.txt', 'r') as f:\n ... | python | chosen |
[
{
"from": "system",
"value": "Set NBT tree view with correct proxy model (oops)\n"
},
{
"from": "human",
"value": "\"\"\"\n nbttreewidget\n\"\"\"\nfrom __future__ import absolute_import, division, print_function, unicode_literals\nimport logging\n\nfrom PySide import QtGui\nfrom PySide.QtCore... | python | chosen |
[
{
"from": "system",
"value": "Edit bird: Clean up render method of EditPageItem\n"
},
{
"from": "human",
"value": "from django.core.urlresolvers import reverse\nfrom django.template import RequestContext\nfrom django.template.loader import render_to_string\n\n\nclass BaseItem(object):\n templ... | python | chosen |
[
{
"from": "system",
"value": "Add some indent options in the node Jinja macro.\n"
},
{
"from": "human",
"value": "# -*- coding: utf-8 -*-\n\nfrom jinja2.utils import Markup\nfrom pprint import pformat\nimport sys\nimport types\n\n\ndef global_node(node_value):\n \"\"\"\n Used for the inclu... | python | chosen |
[
{
"from": "system",
"value": "Fix broken import in Sublime Text 2."
},
{
"from": "human",
"value": "# encoding: utf-8\n\n'''This adds a \"slugify\" command to be invoked by Sublime Text. It is made\navailable as \"Slugify\" in the command palette by Default.sublime-commands.\nParts of these comm... | python | chosen |
[
{
"from": "system",
"value": "admin_calendar: Fix to work on the latest django-imagekit\n"
},
{
"from": "human",
"value": "# -*- coding: utf-8 -*-\n\nfrom django.db import models\nfrom django.contrib import admin\nfrom django.contrib.auth.models import User\nfrom imagekit.models import ImageSpec... | python | chosen |
[
{
"from": "system",
"value": "Add easy way to grab a logger.\n"
},
{
"from": "human",
"value": "\"\"\"Image Processing SciKit (Toolbox for SciPy)\"\"\"\n\n\nimport os.path as _osp\n\ndata_dir = _osp.join(_osp.dirname(__file__), 'data')\n\nfrom version import version as __version__\n\ndef _setup_... | python | chosen |
[
{
"from": "system",
"value": "Update example according to modified Manager constructor. \n\nA scheme parameter is now required on Manager instantiation"
},
{
"from": "human",
"value": "from socketio_client.manager import Manager\n\nimport gevent\nfrom gevent import monkey\nmonkey.patch_socket()\... | python | chosen |
[
{
"from": "system",
"value": "Fix image link to anonymous user.\n"
},
{
"from": "human",
"value": "import os\n\nfrom django.db.models import get_model\nfrom django.template import Library, Node, TemplateSyntaxError, resolve_variable\nfrom django.conf import settings\n\nfrom booki.account.models ... | python | chosen |
[
{
"from": "system",
"value": "Set sensitivity of e-mail backend to 2, so notifications with 1 aren't mailed.\n"
},
{
"from": "human",
"value": "from django.conf import settings\nfrom django.core.mail import EmailMessage\n\nfrom notification.backends.base import NotificationBackend\n\n\nclass Ema... | python | chosen |
[
{
"from": "system",
"value": "Update python scripts to run on OSX.\n"
},
{
"from": "human",
"value": "#!/usr/bin/env python\n\nfrom __future__ import print_function\n\nimport os\nfrom subprocess import check_output\nfrom sys import argv, stdout\n\nRSGRP = \"travistestresourcegroup\"\nSTACC = \"t... | python | chosen |
[
{
"from": "system",
"value": "Add initialization of the service client node.\n"
},
{
"from": "human",
"value": "#!/usr/bin/env python\n\nimport rospy\nfrom std_srvs.srv import Empty\n\ndef service_client():\n rospy.loginfo('waiting service')\n rospy.wait_for_service('call_me')\n try:\n ... | python | chosen |
[
{
"from": "system",
"value": "Remove dead code in get user API endpoint\n"
},
{
"from": "human",
"value": "from flask_restful import Resource\n\nfrom pajbot.managers.redis import RedisManager\nfrom pajbot.managers.user import UserManager\nfrom pajbot.streamhelper import StreamHelper\n\n\nclass A... | python | chosen |
[
{
"from": "system",
"value": "Fix loop in alembic history\n"
},
{
"from": "human",
"value": "\"\"\"Add ckan boolean to mod table\n\nRevision ID: 35597d56e8d\nRevises: 18af22fa9e4\nCreate Date: 2014-12-12 20:11:22.250080\n\n\"\"\"\n\n# revision identifiers, used by Alembic.\nrevision = '35597d56e... | python | chosen |
[
{
"from": "system",
"value": "Fix up some key construction.\n"
},
{
"from": "human",
"value": "\nimport gevent.monkey\ngevent.monkey.patch_all()\n\nimport logging\n\nimport boto.gs.connection\nimport boto.gs.key\n\nimport cache\n\nfrom boto_base import BotoStorage\n\n\nlogger = logging.getLogger... | python | chosen |
[
{
"from": "system",
"value": "Use six for python 2/3 bytes\n"
},
{
"from": "human",
"value": "from io import BytesIO\nfrom django.core.management import call_command\nfrom django.test import TestCase\nfrom mock import patch\n\nfrom contentstore.models import Schedule\nfrom seed_stage_based_messa... | python | chosen |
[
{
"from": "system",
"value": "Handle open connections when creating the test database\n"
},
{
"from": "human",
"value": "# coding=utf-8\n\nfrom django.db.backends.postgresql_psycopg2.creation import DatabaseCreation as OriginalDatabaseCreation\n\n\nclass DatabaseCreation(OriginalDatabaseCreation... | python | chosen |
[
{
"from": "system",
"value": "Fix compiling problem for runtime variables\n"
},
{
"from": "human",
"value": "from Helpers.string import *\n\ndef binop_aexp(commands, env, op, left, right):\n left.compile_vm(commands, env)\n right.compile_vm(commands, env)\n if op == '+':\n value ... | python | chosen |
[
{
"from": "system",
"value": "Add todo list for multiprocessing branch\n"
},
{
"from": "human",
"value": "import asyncore\nimport logging\nimport os\nimport sys\n\nsys.path.insert(0,\n os.path.abspath(os.path.join(os.path.dirname(__file__), '../')))\n\nfrom mopidy import get_class, settings, ... | python | chosen |
[
{
"from": "system",
"value": "Fix for bug. Overall somewhat unfortunate.\n"
},
{
"from": "human",
"value": "\"\"\"Base class for Namespace proxies in class creation.\"\"\"\n\nimport weakref\n\nfrom . import ops\nfrom .proxy import _Proxy\n\n_PROXY_INFOS = weakref.WeakKeyDictionary()\n\n\nclass _... | python | chosen |
[
{
"from": "system",
"value": "Remove unicode literals to fix with_metaclass method\n"
},
{
"from": "human",
"value": "# -*- coding: utf-8 -*-\n\"\"\"\nPy27 Support\n~~~~~~~~~~~~\n\nLike odin this library will support Python 2.7 through to version 2.0.\n\nFrom this point onwards Python 3.5+ will ... | python | chosen |
[
{
"from": "system",
"value": "Revert \"fix deprecation warnings in mongo\"\n\nThis reverts commit 5d449ff9376e7c0a3c78f2b2d631ab0ecd08fe81.\n"
},
{
"from": "human",
"value": "import pytest\n\n\ndef test_mongo_server(mongo_server):\n assert mongo_server.check_server_up()\n assert mongo_serv... | python | chosen |
[
{
"from": "system",
"value": "Fix MiLibraryLoadedTestCase.test_lldbmi_library_loaded test on Linux (MI)\n\n\n\ngit-svn-id: 4c4cc70b1ef44ba2b7963015e681894188cea27e@236229 91177308-0d34-0410-b5e6-96231b3b80d8\n"
},
{
"from": "human",
"value": "\"\"\"\nTest lldb-mi =library-loaded notifications.\n... | python | chosen |
[
{
"from": "system",
"value": "Remove long test for now\n"
},
{
"from": "human",
"value": "import unittest\nfrom nala.bootstrapping import generate_documents\n\n\nclass TestBootstrapping(unittest.TestCase):\n def test_generate_documents_number(self):\n # commenting out for now since it ... | python | chosen |
[
{
"from": "system",
"value": "Add a handler for previewing content (ignores active, publication dates, etc).\n"
},
{
"from": "human",
"value": "from django.http import HttpResponseRedirect\nfrom django.shortcuts import render_to_response\nfrom django.template import RequestContext\nfrom django.u... | python | chosen |
[
{
"from": "system",
"value": "Make the serializer use the new create_user method\n"
},
{
"from": "human",
"value": "from rest_framework import serializers\nfrom .models import BaseAccount\n\n\nclass WholeAccountSerializer(serializers.ModelSerializer):\n password = serializers.CharField(write_... | python | chosen |
[
{
"from": "system",
"value": "Test the ability to append new email address to the person\n"
},
{
"from": "human",
"value": "from copy import copy\n\nfrom unittest import TestCase\n\nfrom address_book import Person\n\n\nclass PersonTestCase(TestCase):\n\n def test_get_groups(self):\n pa... | python | chosen |
[
{
"from": "system",
"value": "Create a factory for Thumbnails.\n"
},
{
"from": "human",
"value": "import factory\n\nfrom . import models\n\n\nclass ChannelFactory(factory.django.DjangoModelFactory):\n FACTORY_FOR = models.Channel\n\n\nclass VideoFactory(factory.django.DjangoModelFactory):\n ... | python | chosen |
[
{
"from": "system",
"value": "Add a tzinfo factory method to replica connection to create local tzinfos\n\nThis is to ensure that the datetimes returned for report generation\nare timezone aware and will thus be printed in the reports with\ntimezone information.\n"
},
{
"from": "human",
"value":... | python | chosen |
[
{
"from": "system",
"value": "Change directory of tempest config\n"
},
{
"from": "human",
"value": "import json\nimport logging\nimport os\nimport requests\n\nfrom jinja2 import Template\nfrom os.path import abspath, dirname, exists, join\n\nfrom .utils import run_cmd\n\nLOG = logging.getLogger(... | python | chosen |
[
{
"from": "system",
"value": "Add tmp dummy mail report so that the diagnoser kinda works instead of failing miserably\n"
},
{
"from": "human",
"value": "#!/usr/bin/env python\n\nimport os\n\nfrom yunohost.diagnosis import Diagnoser\n\n\nclass MailDiagnoser(Diagnoser):\n\n id_ = os.path.split... | python | chosen |
[
{
"from": "system",
"value": "Fix commit_on_http_success when an exception is raised\n"
},
{
"from": "human",
"value": "from django.db.transaction import is_dirty, leave_transaction_management, rollback, commit, enter_transaction_management, managed\nfrom django.db import DEFAULT_DB_ALIAS\nfrom ... | python | chosen |
[
{
"from": "system",
"value": "Fix to allow more flexible version numbers\n"
},
{
"from": "human",
"value": "#!/usr/bin/python\n\nfrom subprocess import check_output as co\nfrom sys import exit\n\n# Actually run bin/mn rather than importing via python path\nversion = 'Mininet ' + co( 'PYTHONPATH=... | python | chosen |
[
{
"from": "system",
"value": "Add a newline at the end of json files when writing them.\n\nThis fixes the really irritating ping-pong of newline/nonewline when editing\njson files with an editor, and with `yotta version` commands.\n"
},
{
"from": "human",
"value": "# Copyright 2014 ARM Limited\n... | python | chosen |
[
{
"from": "system",
"value": "Test for landing login now asserts against the correct path.\n"
},
{
"from": "human",
"value": "# (c) Crown Owned Copyright, 2016. Dstl.\n\nfrom django.core.urlresolvers import reverse\n\nfrom django_webtest import WebTest\n\nclass KeycloakHeaderLandAtHome(WebTest):... | python | chosen |
[
{
"from": "system",
"value": "Include check majority in first loop rather than separate loop\n"
},
{
"from": "human",
"value": "def find_majority(sequence):\n item_counter = dict()\n\n for item in sequence:\n if item not in item_counter:\n item_counter[item] = 1\n ... | python | chosen |
[
{
"from": "system",
"value": "Revert \"Add username to ID Token\"\n\nThis reverts commit 6e1126fe9a8269ff4489ee338000afc852bce922.\n"
},
{
"from": "human",
"value": "import inspect\n\nfrom .scopes import get_userinfo_by_scopes\n\n\ndef process_id_token(payload, user, scope=None):\n if scope i... | python | chosen |
[
{
"from": "system",
"value": "Fix duplicate users during tests\n"
},
{
"from": "human",
"value": "from builtins import object\nimport factory\n\nfrom django.contrib.auth.models import Group\n\nfrom bluebottle.members.models import Member\n\n\nclass BlueBottleUserFactory(factory.DjangoModelFactor... | python | chosen |
[
{
"from": "system",
"value": "Use new psql based export\n\nThis changes the function arguments to use.\n"
},
{
"from": "human",
"value": "# -*- coding: utf-8 -*-\n\n\"\"\"\nCopyright [2009-2017] EMBL-European Bioinformatics Institute\nLicensed under the Apache License, Version 2.0 (the \"License... | python | chosen |
[
{
"from": "system",
"value": "Fix missing parameter in path source\n"
},
{
"from": "human",
"value": "from .gtags_def import GtagsBase\n\nclass Source(GtagsBase):\n\n def __init__(self, vim):\n super().__init__(vim)\n\n self.name = 'gtags_path'\n self.kind = 'file'\n\n ... | python | chosen |
[
{
"from": "system",
"value": "Refactor SendClaimCodeView to be more explict, will then modify\n"
},
{
"from": "human",
"value": "from __future__ import unicode_literals\nfrom django.views.generic.edit import FormView\nfrom .forms import SendClaimCodeForm\nfrom .models import Badge\n\nclass SendC... | python | chosen |
[
{
"from": "system",
"value": "Handle the exception case in the account context_processor.\n"
},
{
"from": "human",
"value": "\nfrom account.models import Account, AnonymousAccount\n\ndef openid(request):\n return {'openid': request.openid}\n\ndef account(request):\n account = AnonymousAcco... | python | chosen |
[
{
"from": "system",
"value": "Add some utf-8 encoding due to special chars.\n"
},
{
"from": "human",
"value": "#!/usr/bin/python\n\n\ndef translate(translation_list):\n\n trans_dict = {\"merry\":\"god\", \"christmas\":\"jul\", \"and\":\"och\",\n \"happy\":\"gott\", \"new\":\"... | python | chosen |
[
{
"from": "system",
"value": "Add methods for Plugin Endpoints\n\nSigned-off-by: Huang Yaming <ce2ec9fa26f071590d1a68b9e7447b51f2c76084@gmail.com>\n"
},
{
"from": "human",
"value": "# -*- coding: utf-8 -*-\n\nURLS = {\n}\n\n\nclass Plugins(object):\n \"\"\" This class provide plugin-related m... | python | chosen |
[
{
"from": "system",
"value": "Allow disabling the autocharging behavior of the bank transfer moocher\n"
},
{
"from": "human",
"value": "from django import http\nfrom django.conf.urls import url\nfrom django.shortcuts import get_object_or_404\nfrom django.template.loader import render_to_string\n... | python | chosen |
[
{
"from": "system",
"value": "Clean up main fasta tasks\n\nThis removes the unneeded compress tasks as well as makes it easier to\nknow what task to run.\n"
},
{
"from": "human",
"value": "# -*- coding: utf-8 -*-\n\n\"\"\"\nCopyright [2009-2017] EMBL-European Bioinformatics Institute\nLicensed u... | python | chosen |
[
{
"from": "system",
"value": "Remove unnecessary `__author__` and `__license__`\n"
},
{
"from": "human",
"value": "from .schema import Schema, SchemaOpts\n\n__version__ = \"0.21.2\"\n__author__ = \"Steven Loria\"\n__license__ = \"MIT\"\n\n__all__ = (\"Schema\", \"SchemaOpts\")\n"
},
{
"f... | python | chosen |
[
{
"from": "system",
"value": "Use set to compare list of values\n"
},
{
"from": "human",
"value": "# -*- coding: utf-8 -*-\n\nimport pytest\n\nfrom junction.feedback import service\n\nfrom .. import factories\n\npytestmark = pytest.mark.django_db\n\n\ndef test_get_feedback_questions_without_conf... | python | chosen |
[
{
"from": "system",
"value": "Rename one test so it actually gets run.\n"
},
{
"from": "human",
"value": "import os\nimport morepath\nfrom webtest import TestApp as Client\nimport pytest\nfrom .fixtures import template\n\n\ndef setup_module(module):\n morepath.disable_implicit()\n\n\ndef test... | python | chosen |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.