conversations listlengths 2 3 | source stringclasses 1
value | stack stringclasses 1
value |
|---|---|---|
[
{
"from": "system",
"value": "Add unit test for test_runner _get_tax_benefit_system\n"
},
{
"from": "human",
"value": "from openfisca_core.tools.test_runner import _run_test\nfrom openfisca_core.errors import VariableNotFound\n\n\nimport pytest\n\n\nclass TaxBenefitSystem:\n def __init__(self... | python | chosen |
[
{
"from": "system",
"value": "Move import to the top of the file\n"
},
{
"from": "human",
"value": "# -*- coding: utf-8 -*-\n\"\"\"Elastic Search Index & Search.\"\"\"\n\n__author__ = 'Javier Collado'\n__email__ = 'jcollado@nowsecure.com'\n__version__ = '0.2.0'\n\nfrom esis.es import Client\n"
... | python | chosen |
[
{
"from": "system",
"value": "Create assert true in teste_view\n"
},
{
"from": "human",
"value": "from django.test import TestCase, Client\nfrom should_dsl import should, should_not\nfrom django.db.models.query import QuerySet\n\nclass TestVies(TestCase):\n\n def setUp(self):\n self.cl... | python | chosen |
[
{
"from": "system",
"value": "Update module with timeit testing for best and worst case scenarios.\n"
},
{
"from": "human",
"value": "def insertion_sort(un_list):\n for idx in range(1, len(un_list)):\n current = un_list[idx]\n position = idx\n\n while position > 0 and un_... | python | chosen |
[
{
"from": "system",
"value": "Adjust day size to 100k. Change status flag placement.\n"
},
{
"from": "human",
"value": "import capture\nfrom picamera import PiCamera\nimport time\n\n\ndef image_cap_loop(camera):\n \"\"\"Set image parameters, capture image, set wait time, repeat\"\"\"\n\n i... | python | chosen |
[
{
"from": "system",
"value": "Add HTML representation of chat\n"
},
{
"from": "human",
"value": "from django.db import models\nfrom django.contrib.auth.models import User\nfrom django.utils.text import truncate_words\n\nfrom automatic_timestamps.models import TimestampModel\n\n\nclass Chat(Times... | python | chosen |
[
{
"from": "system",
"value": "Clean up Quote model code\n"
},
{
"from": "human",
"value": "from django.db import models\nfrom django.contrib.auth.models import User\nfrom django.utils.text import truncate_words\n\nfrom automatic_timestamps.models import TimestampModel\n\n\nclass Chat(TimestampMo... | python | chosen |
[
{
"from": "system",
"value": "Add NumpyFeature to top-level exports\n"
},
{
"from": "human",
"value": "from model import BaseModel\n\nfrom feature import Feature, JSONFeature, TextFeature, CompressedFeature, \\\n PickleFeature\n\nfrom extractor import Node, Graph, Aggregator, NotEnoughData\n\... | python | chosen |
[
{
"from": "system",
"value": "Add force option for testing.\n"
},
{
"from": "human",
"value": "#!/usr/env/python3\n\nimport os\nimport configparser\n\n\nglobal cf\n\n\ncf = configparser.ConfigParser()\ncf._interpolation = configparser.ExtendedInterpolation()\n\ncf_file = os.path.expanduser('~/.c... | python | chosen |
[
{
"from": "system",
"value": "gui: Move global map url before session url.\n"
},
{
"from": "human",
"value": "from django.conf.urls import url\n\nfrom . import views\n\nurlpatterns = [\n url(r'^$', views.MainPage.as_view(), name='index'),\n url(r'^(?P<ses_id>[a-zA-Z0-9]+)/$', views... | python | chosen |
[
{
"from": "system",
"value": "Update PyPi package information to reflect rebranding.\n"
},
{
"from": "human",
"value": "#!/usr/bin/env python\n\"\"\"Packaging, distributing, and installing the ConsumerSurveys lib.\"\"\"\n\nimport setuptools\n\n# To debug, set DISTUTILS_DEBUG env var to anything.... | python | chosen |
[
{
"from": "system",
"value": "Fix small issue with `--top-n` command switch\n"
},
{
"from": "human",
"value": "import logger\nimport datetime\n\ndef out(counter, argv, elapsed_time = None):\n\n sum_lines = sum(counter.values())\n\n blue = '\\033[94m'\n grey = '\\033[0m'\n endcolor = ... | python | chosen |
[
{
"from": "system",
"value": "Add two lists with square and grain numbers\n"
},
{
"from": "human",
"value": "# File: grains.py\n# Purpose: Write a program that calculates the number of grains of wheat\n# on a chessboard given that the number on each square doubles.\n# Pr... | python | chosen |
[
{
"from": "system",
"value": "Use \"DjangoTestSuiteRunner\" to in Django 1.6.\n"
},
{
"from": "human",
"value": "# -*- coding: utf-8 -*-\n\n\nDATABASES = {\n 'default': {\n 'ENGINE': 'django.db.backends.sqlite3',\n },\n}\n\n\nCACHES = {\n 'default': {\n 'BACKEND': 'django.... | python | chosen |
[
{
"from": "system",
"value": "Fix github top_events if events empty\n"
},
{
"from": "human",
"value": "import json, requests\nfrom wagtail.wagtailadmin.edit_handlers import FieldPanel\nfrom wagtail.wagtailcore.models import Page, Orderable\nimport django.utils.dateparse as dateparse\nfrom django... | python | chosen |
[
{
"from": "system",
"value": "Add server alive and shutdown api endpoints\n"
},
{
"from": "human",
"value": "\"\"\"\nThe /server api blueprint is used by cea-worker processes to manage jobs and files.\n\"\"\"\n\nfrom __future__ import print_function\nfrom __future__ import division\n\nfrom flask... | python | chosen |
[
{
"from": "system",
"value": "refactor: Set values in a single query\n"
},
{
"from": "human",
"value": "import frappe\n\ndef execute():\n\tfrappe.db.set_value(\"System Settings\", \"System Settings\", \"document_share_key_expiry\", 30)\n\tfrappe.db.set_value(\"System Settings\", \"System Setting... | python | chosen |
[
{
"from": "system",
"value": "Fix wrong path for helusers AdminSite\n"
},
{
"from": "human",
"value": "from django.apps import AppConfig\nfrom django.utils.translation import ugettext_lazy as _\nfrom django.contrib.admin.apps import AdminConfig\n\n\nclass HelusersConfig(AppConfig):\n name = '... | python | chosen |
[
{
"from": "system",
"value": "Add comment about constant values\n"
},
{
"from": "human",
"value": "import unittest, boto, os\nfrom bucketeer import commit\n\nclass BuckeeterTest(unittest.TestCase):\n\n global existing_bucket, test_dir, test_file\n existing_bucket = 'bucket.exists'\n test_dir ... | python | chosen |
[
{
"from": "system",
"value": "Add a slash to law urls"
},
{
"from": "human",
"value": "from django.conf.urls.defaults import patterns, url\n\n\nurlpatterns = patterns(\"\",\n url(r\"^(?P<slug>[-\\w]+)$\", 'publicbody.views.show_foilaw', name=\"publicbody-foilaw-show\"),\n)\n"
},
{
"fr... | python | chosen |
[
{
"from": "system",
"value": "trivial: Fix compile when using python 3.7 or older\n\nSigned-off-by: Richard Hughes <320bca71fc381a4a025636043ca86e734e31cf8b@hughsie.com>\n"
},
{
"from": "human",
"value": "#!/usr/bin/python3\n# pylint: disable=invalid-name,missing-docstring\n#\n# Copyright (C) 20... | python | chosen |
[
{
"from": "system",
"value": "Add missing redirect after POST in product details\n"
},
{
"from": "human",
"value": "from __future__ import unicode_literals\n\nfrom django.http import HttpResponsePermanentRedirect\nfrom django.contrib import messages\nfrom django.shortcuts import get_object_or_40... | python | chosen |
[
{
"from": "system",
"value": "Fix a massive bug in EdgeIntensityRatio\n\nDue to a typo, the code was dividing by the mean of a mask,\nnot the mean of the image sliced by the mask\n"
},
{
"from": "human",
"value": "import numpy as np\nfrom . import Measurement\nfrom ..util.cleanup import cell_bou... | python | chosen |
[
{
"from": "system",
"value": "Fix unnecessary recomputation of file targets\n"
},
{
"from": "human",
"value": "import os\nfrom ..target import Target\n\nclass LocalFile(Target):\n def __init__(self, path):\n self._path = path\n super(LocalFile, self).__init__()\n self._ti... | python | chosen |
[
{
"from": "system",
"value": "Add tests around ObjectType Meta\n"
},
{
"from": "human",
"value": "from collections import OrderedDict\nfrom unittest import TestCase\n\nfrom graphql.type.definition import GraphQLField, GraphQLObjectType\nfrom graphql.type.scalars import GraphQLString\n\nfrom poly... | python | chosen |
[
{
"from": "system",
"value": "Add type declartions and docstrings\n"
},
{
"from": "human",
"value": "from flask import Response\n\nfrom flask_login import login_user\nfrom server.models import User\nfrom server.login_manager import login_manager\n\n\n@login_manager.user_loader\ndef load_user(use... | python | chosen |
[
{
"from": "system",
"value": "Fix import Linter from pylam_pylint\n"
},
{
"from": "human",
"value": "\"\"\"Load extensions.\"\"\"\n\nimport os\nimport sys\n\nCURDIR = os.path.abspath(os.path.dirname(__file__))\nsys.path.insert(0, os.path.join(CURDIR, '..', '..', 'deps'))\n\n\nLINTERS = {}\n\ntry... | python | chosen |
[
{
"from": "system",
"value": "Set input type to phone for phone.\n"
},
{
"from": "human",
"value": "# -*- coding:utf-8 -*-\nfrom django import forms\nfrom django.utils.translation import ugettext as _\n\nfrom .models import Item, Group, Profile, Area\n\n\nclass SearchForm(forms.Form):\n area ... | python | chosen |
[
{
"from": "system",
"value": "Remove deprecated comment about nxml2text\n"
},
{
"from": "human",
"value": "\"\"\"\nThis module provides an input interface and processor to the ISI reading\nsystem.\n\nThe reader is set up to run within a Docker container.\nFor the ISI reader to run, set the Docke... | python | chosen |
[
{
"from": "system",
"value": "Add functionality to find rubocop config\n\nOnce it's found, we set it as an environment variable for the rubocop\nlinter to pick up.\n"
},
{
"from": "human",
"value": "#\n# linter.py\n# Linter for SublimeLinter3, a code checking framework for Sublime Text 3\n#\n# W... | python | chosen |
[
{
"from": "system",
"value": "Fix to correctly check for publication status\n"
},
{
"from": "human",
"value": "\nfrom django.core.management.base import BaseCommand\nfrom metashare.repository.models import resourceInfoType_model\n\nclass Command(BaseCommand):\n def handle(self, *args, **optio... | python | chosen |
[
{
"from": "system",
"value": "Add draft of spectrogram computions.\n"
},
{
"from": "human",
"value": "def noise_mask(spectrogram):\n print(\"noise_mask is undefined\")\n\ndef structure_mask(spectrogram):\n print(\"structure_mask is undefined\")\n\ndef extract_signal(mask, spectrogram):\n ... | python | chosen |
[
{
"from": "system",
"value": "Update manifest files being bumped.\n"
},
{
"from": "human",
"value": "# Update uProxy version in all relevant places.\n#\n# Run with:\n# python version.py <new version>\n# e.g. python version.py 0.8.10\n\nimport json\nimport collections\nimport sys\nimport re\n\nma... | python | chosen |
[
{
"from": "system",
"value": "Add note on Varda server start\n"
},
{
"from": "human",
"value": "#!/usr/bin/env python\n\"\"\"\nRun the Varda REST server.\n\nTo setup the database:\n\n create database varda;\n create database vardacelery;\n create database vardaresults;\n grant all pr... | python | chosen |
[
{
"from": "system",
"value": "Use smart text editor in tej.SubmitShellJob\n"
},
{
"from": "human",
"value": "from __future__ import division\n\nfrom PyQt4 import QtGui\n\nfrom vistrails.gui.modules.source_configure import SourceConfigurationWidget\n\n\nclass ShellSourceConfigurationWidget(Source... | python | chosen |
[
{
"from": "system",
"value": "Add iverilog flags reference URL\n\nSigned-off-by: Jack Cherng <159f0f32a62cc912ca55f89bb5e06807cf019bc7@gmail.com>\n"
},
{
"from": "human",
"value": "#\n# linter.py\n# Linter for SublimeLinter4, a code checking framework for Sublime Text 3\n#\n# Written by Jack Che... | python | chosen |
[
{
"from": "system",
"value": "Revert \"Re-raise even when capturing by Sentry\"\n\nThis reverts commit 3fe290fe02390e79910e7ded87070d6e03a705a5.\n"
},
{
"from": "human",
"value": "import logging\nimport os\n\nfrom apscheduler.schedulers.blocking import BlockingScheduler\nfrom raven.base import C... | python | chosen |
[
{
"from": "system",
"value": "Use stats.select() instead of re-implementing all of this.\n\nThis is preparation for being able to squash statistics in different ways.\n\n\ngit-svn-id: 81e381228600e5752b80483efd2b45b26c451ea2@6563 e27351fd-9f3e-4f54-a53b-843176b1656c\n"
},
{
"from": "human",
"val... | python | chosen |
[
{
"from": "system",
"value": "Allow double return to execute query\n\nIf there’s a double return the text will end with “\\n”. Closes #5.\n"
},
{
"from": "human",
"value": "from prompt_toolkit.buffer import Buffer\nfrom prompt_toolkit.filters import Condition\n\nclass CypherBuffer(Buffer):\n\n ... | python | chosen |
[
{
"from": "system",
"value": "Check the existence of the images_path\n\nERROR:planetstack.log:[Errno 2] No such file or directory: '/opt/xos/images' BEG TRACEBACK\nTraceback (most recent call last):\n File \"/opt/xos/observer/event_loop.py\", line 349, in sync\n failed_objects = sync_step(failed=list(se... | python | chosen |
[
{
"from": "system",
"value": "Add absolute tolerance to allclose test\n"
},
{
"from": "human",
"value": "#!/usr/bin/env python\n# -*- coding: utf-8 -*-\n#\n# Author: Dominik Gresch <greschd@gmx.ch>\n\nimport os\n\nimport pytest\nimport tempfile\nimport numpy as np\nimport bandstructure_utils as... | python | chosen |
[
{
"from": "system",
"value": "Fix up output by including endls.\n"
},
{
"from": "human",
"value": "# -*- coding: utf-8 -*-\n\n'''A CMakeLists parser using funcparserlib.\n\nThe parser is based on [examples of the CMakeLists format][1].\n\n [1]: http://www.vtk.org/Wiki/CMake/Examples\n\n'''\n\nf... | python | chosen |
[
{
"from": "system",
"value": "Fix a regression inserted previously.\n"
},
{
"from": "human",
"value": "#-*- coding:utf-8 -*-\n\n## @package Core\n# Core module contains everything required to SQLinject.\n# @author Damien \"virtualabs\" Cauquil <virtualabs@gmail.com>\n\nfrom context import Contex... | python | chosen |
[
{
"from": "system",
"value": "Simplify main method, wait until status logger completes\n\nHint: It never will.\n"
},
{
"from": "human",
"value": "import logging\nfrom flist import account_login, start_chat, opcode\nimport asyncio\n\nlogger = logging.getLogger('status_watcher')\nlogging.getLogger... | python | chosen |
[
{
"from": "system",
"value": "Add query capture in flask.\n"
},
{
"from": "human",
"value": "from flask import Flask, Response\n\napp = Flask(__name__)\n\n@app.route('/')\ndef hello_world():\n return 'Hello, World!'\n\n@app.route('/<id>')\ndef example(id=None):\n resp = Response(id)\n r... | python | chosen |
[
{
"from": "system",
"value": "ADD constant test variables OWNER_EMAIL / OWNER_PWD\n"
},
{
"from": "human",
"value": "# stdlib\nfrom typing import Dict\n\n# third party\nfrom fastapi import FastAPI\nfrom httpx import AsyncClient\n\n\nasync def authenticate_user(\n app: FastAPI, client: AsyncCl... | python | chosen |
[
{
"from": "system",
"value": "Remove autoincrement sqlite paramether from model\n"
},
{
"from": "human",
"value": "from tvseries.ext import db\n\n\nclass TVSerie(db.Model):\n __table_args__ = {'sqlite_autoincrement': True}\n id = db.Column(db.Integer(),\n nullable=False, ... | python | chosen |
[
{
"from": "system",
"value": "Support for 'deed.pl' license URL.\n"
},
{
"from": "human",
"value": "# -*- coding: utf-8 -*-\n# This file is part of Wolnelektury, licensed under GNU Affero GPLv3 or later.\n# Copyright © Fundacja Nowoczesna Polska. See NOTICE for more information.\n#\nfrom django.... | python | chosen |
[
{
"from": "system",
"value": "Add default votes and topscores\n"
},
{
"from": "human",
"value": "import datetime\nfrom flask import url_for\nfrom Simpoll import db\n\n\nclass Poll(db.Document):\n created_at = db.DateTimeField(default=datetime.datetime.now, required=True)\n question = db.St... | python | chosen |
[
{
"from": "system",
"value": "Upgrade VERSION 0.1.2 to 0.1.3 on @oppsproject\nMilestones 2 (github)\n"
},
{
"from": "human",
"value": "#!/usr/bin/env python\n# -*- coding: utf-8 -*-\n\nVERSION = (0, 1, 2)\n\n__version__ = \".\".join(map(str, VERSION))\n__status__ = \"Development\"\n__description... | python | chosen |
[
{
"from": "system",
"value": "Add login/logout for DRF web interface\n"
},
{
"from": "human",
"value": "from xpserver_api import views\nfrom django.conf.urls import url, include\nfrom rest_framework import routers\nfrom xpserver_api.serializers import UserViewSet\n\nrouter = routers.DefaultRoute... | python | chosen |
[
{
"from": "system",
"value": "Remove logged in user test from forumuser\n"
},
{
"from": "human",
"value": "from django.core.urlresolvers import reverse\n\nfrom forumuser.tests.factories import UserFactory\nfrom thatforum.test_helpers import ThatForumTestCase\n\n\nclass TestUserListView(ThatForum... | python | chosen |
[
{
"from": "system",
"value": "Fix encoding (thanks to Yasushi Masuda)\n"
},
{
"from": "human",
"value": "#$HeadURL$\r\n#$LastChangedDate$\r\n#$LastChangedRevision$\r\nimport sys\r\nfrom reportlab.platypus import PageBreak, Spacer\r\nfrom flowables import *\r\nimport shlex\r\nfrom log import log\... | python | chosen |
[
{
"from": "system",
"value": "Fix shell syntax for non bash shells\n\nThe custom make command in mono.py is executed with the default shell,\nwhich on some systems doesn't support the fancy for loop syntax, like\ndash on Ubuntu.\n"
},
{
"from": "human",
"value": "class MonoPackage (Package):\n\t... | python | chosen |
[
{
"from": "system",
"value": "Add dots to pale things\n"
},
{
"from": "human",
"value": "import inspect\nimport types\n\nimport adapters\nimport arguments\nimport config\nimport context\nfrom endpoint import Endpoint\nfrom resource import NoContentResource, Resource, ResourceList\n\nImplementati... | python | chosen |
[
{
"from": "system",
"value": "Add log file name to command line.\n"
},
{
"from": "human",
"value": "#!/usr/bin/env python3\n\nimport sys\n\n_args = sys.argv\n\nif __name__ == \"__main__\":\n if len(_args) == 4:\n keys_file = _args[1]\n target_file = _args[2]\n result_file... | python | chosen |
[
{
"from": "system",
"value": "Enable search whenever a user profile is saved (to allow easier recovery from accounts created incorrectly).\n"
},
{
"from": "human",
"value": "from django.db import models\nfrom django.db.models.signals import post_save\nfrom django.contrib.auth.models import User\... | python | chosen |
[
{
"from": "system",
"value": "Fix migration for fixing AlertFlavor.allowed_tokens\n\nRecently, I changed AlertFlavor.allowed_tokens so that you could create\na flavor without specifying the tokens that go with it (i.e. I added\nblank=True).\n\nThe resulting migration for that change does a bunch of SQL, but... | python | chosen |
[
{
"from": "system",
"value": "Work with custom user models in django >= 1.5"
},
{
"from": "human",
"value": "from django.contrib import admin\nfrom django.conf import settings\nfrom django.db.models import get_model\n\nfrom django.contrib.auth.models import Group\nfrom django.contrib.auth.admin ... | python | chosen |
[
{
"from": "system",
"value": "ca_mb: Fix for new divisions and parties\n"
},
{
"from": "human",
"value": "from utils import CanadianJurisdiction\n\n\nclass Manitoba(CanadianJurisdiction):\n classification = 'legislature'\n division_id = 'ocd-division/country:ca/province:mb'\n division_n... | python | chosen |
[
{
"from": "system",
"value": "Use a dict representation of the GET QueryDict\n"
},
{
"from": "human",
"value": "from __future__ import unicode_literals\n\nimport base32_crockford\nimport logging\n\nfrom django.http import Http404\nfrom django.http import HttpResponsePermanentRedirect\nfrom djang... | python | chosen |
[
{
"from": "system",
"value": "Comment re: API usage to clarify quotas.\n\n"
},
{
"from": "human",
"value": "\"\"\"Support for Skytap API access to the company quotas.\n\nIf accessed via the command line (``python -m skytap.Quotas``) this will\nreturn the quotas from Skytap in a JSON format.\n\"\... | python | chosen |
[
{
"from": "system",
"value": "Fix unit test of voice function\n"
},
{
"from": "human",
"value": "import unittest\nfrom tests import PluginTest\nfrom plugins import voice\nfrom CmdInterpreter import JarvisAPI\nfrom Jarvis import Jarvis\n\n# this test class contains test cases for the plugins \"gt... | python | chosen |
[
{
"from": "system",
"value": "Add project stats to docs\n"
},
{
"from": "human",
"value": "from __future__ import absolute_import\n\nfrom rest_framework.response import Response\n\nfrom sentry.app import tsdb\nfrom sentry.api.base import BaseStatsEndpoint\nfrom sentry.api.permissions import asse... | python | chosen |
[
{
"from": "system",
"value": "Fix missing import and bad query for screenshots\n"
},
{
"from": "human",
"value": "from django.db.models import Manager\n\n\nclass ScreenshotManager(Manager):\n def published(self, user=None, is_staff=False):\n query = self.get_query_set()\n query ... | python | chosen |
[
{
"from": "system",
"value": "Ch23: Set User Admin default ordering.\n"
},
{
"from": "human",
"value": "from django.contrib import admin\n\nfrom .models import User\n\n\n@admin.register(User)\nclass UserAdmin(admin.ModelAdmin):\n # list view\n list_display = (\n 'email',\n 'i... | python | chosen |
[
{
"from": "system",
"value": "Fix installation of numarray headers on Windows.\n"
},
{
"from": "human",
"value": "from os.path import join\n\ndef configuration(parent_package='',top_path=None):\n from numpy.distutils.misc_util import Configuration\n config = Configuration('numarray',parent... | python | chosen |
[
{
"from": "system",
"value": "[FIX] sale_commission_pricelist: Make this to work on button recompute\n"
},
{
"from": "human",
"value": "# -*- coding: utf-8 -*-\n# Copyright 2018 Carlos Dauden - Tecnativa <carlos.dauden@tecnativa.com>\n# License AGPL-3.0 or later (https://www.gnu.org/licenses/agp... | python | chosen |
[
{
"from": "system",
"value": "Make sure to use abspath when adding dynamic_choices to sys.path\n"
},
{
"from": "human",
"value": "#!/usr/bin/env python\nfrom django.core.management import execute_manager\ntry:\n import settings # Assumed to be in the same directory.\nexcept ImportError:\n ... | python | chosen |
[
{
"from": "system",
"value": "Add sleeps to test to avoid eutils issues\n"
},
{
"from": "human",
"value": "import sys\nimport pubrunner\nimport pubrunner.command_line\nimport os\n\ndef test_countwords():\n\tparentDir = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))\n\tprojectPath = ... | python | chosen |
[
{
"from": "system",
"value": "Stop skipping Bench on ChromeOS\n\n(RunBuilders:Skia_ChromeOS_Alex_Debug_32)\nUnreviewed.\n\ngit-svn-id: 32fc27f4dcfb6c0385cd9719852b95fe6680452d@8094 2bbb7eff-a529-9590-31e7-b0007b416f81\n"
},
{
"from": "human",
"value": "#!/usr/bin/env python\n# Copyright (c) 2013... | python | chosen |
[
{
"from": "system",
"value": "Handle exceptions better in enqueuer\n\nWe don't care too much, so just swallow them. People will complain at me\nif their \"pushed\" jobs don't get run (eventually).\n"
},
{
"from": "human",
"value": "#!/usr/bin/env python\n# This Source Code Form is subject to the... | python | chosen |
[
{
"from": "system",
"value": "Revert to old master 2\n"
},
{
"from": "human",
"value": "from django.conf.urls import include, url\nfrom django.contrib import admin\nfrom django.views.generic import TemplateView\n\nurlpatterns = [\n url(r'^admin/', include(admin.site.urls)),\n url(r'^users/... | python | chosen |
[
{
"from": "system",
"value": "Make all users get logged in through the OpenIdBackend\n\nBy routing all the logins through the OpenIdBackend, we can handle the\npermissions checking on our own. This allows us use apps (like comments) which\ndepend on the Django authentication system, but with our own permis... | python | chosen |
[
{
"from": "system",
"value": "Fix lookup in survey view\n"
},
{
"from": "human",
"value": "from rest_framework import serializers\nfrom django.contrib.auth.models import User\n\nfrom .models import Alert, HouseholdSurveyJSON, TeamMember\n\n\n\nclass UserSerializer(serializers.HyperlinkedModelSer... | python | chosen |
[
{
"from": "system",
"value": "Disable linter in in-progress code\n"
},
{
"from": "human",
"value": "def upload(upload_info):\n \"\"\"\n :type upload_info: dict\n\n \"\"\"\n client_id = upload_info['client_id']\n resource_id = upload_info['resource_id']\n resource_type = upload_... | python | chosen |
[
{
"from": "system",
"value": "Add a UserFactory for images test\n"
},
{
"from": "human",
"value": "from __future__ import unicode_literals\nfrom django.contrib.auth.models import User\nfrom django.test import TestCase\nimport factory\nfrom faker import Faker\n\nfrom imager_profile.models import ... | python | chosen |
[
{
"from": "system",
"value": "Raise error if any in IPythonParallelRunner.wait_tasks\n"
},
{
"from": "human",
"value": "\"\"\"\nTask runner using IPython parallel interface.\n\nSee `The IPython task interface`_ and `IPython Documentation`_\nin `IPython Documentation`_.\n\n.. _The IPython task in... | python | chosen |
[
{
"from": "system",
"value": "Add Janeus settings to local_settings example\n"
},
{
"from": "human",
"value": "\nLDAP_NAME = 'ldap://'\nLDAP_PASSWORD = ''\nLDAP_DN = 'cn=writeuser,ou=sysUsers,dc=jd,dc=nl'\n\nSECRET_KEY = ''\n\nDATABASES = {\n \"default\": {\n # Add \"postgresql_psycopg... | python | chosen |
[
{
"from": "system",
"value": "Handle HttpError when sending email\n"
},
{
"from": "human",
"value": "# coding: utf8\n\nimport json\nimport logging\n\nfrom labonneboite.conf import settings\n\n\nlogger = logging.getLogger('main')\n\n\nclass MailNoSendException(Exception):\n pass\n\nclass Email... | python | chosen |
[
{
"from": "system",
"value": "Use an update view instead of form view\n"
},
{
"from": "human",
"value": "from django.conf import settings\nfrom django.contrib.auth.decorators import login_required\nfrom django.contrib.sites.models import Site\nfrom django.core.urlresolvers import reverse\nfrom d... | python | chosen |
[
{
"from": "system",
"value": "Use id instead of name\n"
},
{
"from": "human",
"value": "\"\"\"Tests for plugin.py.\"\"\"\nimport pytest\n\nfrom ckan.tests import factories\nimport ckan.tests.helpers as helpers\nfrom ckan.plugins.toolkit import NotAuthorized\n\n@pytest.mark.ckan_config('ckan.plug... | python | chosen |
[
{
"from": "system",
"value": "Add a custom 'extra' field to idb_col_llavadelsaber\n"
},
{
"from": "human",
"value": "\"\"\"Configuration for Llave Del Saber, Colombia\"\"\"\nfrom .idb import * # noqa\n\nLANGUAGE_CODE = 'es'\nDOMAIN = 'bibliotecamovil.lan'\nALLOWED_HOSTS = ['.bibliotecamovil.lan... | python | chosen |
[
{
"from": "system",
"value": "Fix the assumption that options.vcf_file is a string.\n"
},
{
"from": "human",
"value": "#!/usr/bin/python\nimport vcf\nimport os\nfrom optparse import OptionParser\n\nparser = OptionParser()\nparser.add_option(\"--vcf\",\tdest=\"vcf_file\", help=\"Path to VCF t... | python | chosen |
[
{
"from": "system",
"value": "Fix locale paths when pulling from transifex\n"
},
{
"from": "human",
"value": "\"\"\"\nThis file provides zest.releaser entrypoints using when releasing new\ndjango-countries versions.\n\"\"\"\nimport os\n\nfrom txclib.commands import cmd_pull\nfrom txclib.utils im... | python | chosen |
[
{
"from": "system",
"value": "Adjust test settings to be in line with jmbo-skeleton\n"
},
{
"from": "human",
"value": "from foundry.settings import *\n\n\n# We cannot use ssqlite or spatialite because it cannot handle the 'distinct'\n# in admin.py.\nDATABASES = {\n 'default': {\n 'ENGI... | python | chosen |
[
{
"from": "system",
"value": "Use simpler rules file for testing with tiles subset\n"
},
{
"from": "human",
"value": "import unittest\n\nimport numpy as np\n\nimport desisurvey.tiles\nfrom desisurvey.test.base import Tester\nfrom desisurvey.rules import Rules\n\n\nclass TestRules(Tester):\n\n ... | python | chosen |
[
{
"from": "system",
"value": "Fix typo in for_guest function.\n\n`**kwrags**` should be `**kwargs**`\n"
},
{
"from": "human",
"value": "from functools import wraps\nfrom flask import flash, redirect, url_for, session\nfrom app import views\n\ndef login_required(f):\n @wraps(f)\n def decora... | python | chosen |
[
{
"from": "system",
"value": "Use strings to allow setup.py to import this.\n\nThis should never import depencencies, or else setup.py will fail when\ngetting the version because the dependencies don't exist yet.\n"
},
{
"from": "human",
"value": "__VERSION__ = '1.0.8'\n\n\nimport pyramid.tweens... | python | chosen |
[
{
"from": "system",
"value": "Use real states in StateFactory\n"
},
{
"from": "human",
"value": "from datetime import datetime\n\nimport factory\n\nfrom polling.models import State\nfrom polling.models import CANDIDATE_NONE\n\n\nclass StateFactory(factory.DjangoModelFactory):\n class Meta:\n ... | python | chosen |
[
{
"from": "system",
"value": "Make errors a bit easier to copy\n"
},
{
"from": "human",
"value": "import sys\nclass ConfigError(Exception):\n def __init__(self, message):\n self.message = message\n \n sys.stdout.write(\"\\nERROR: \" + str(message) + \"\\n\\n\")\n\nclass P... | python | chosen |
[
{
"from": "system",
"value": "Fix url pattern for main\n"
},
{
"from": "human",
"value": "\"\"\"cv URL Configuration\n\nThe `urlpatterns` list routes URLs to views. For more information please see:\n https://docs.djangoproject.com/en/1.9/topics/http/urls/\nExamples:\nFunction views\n 1. Ad... | python | chosen |
[
{
"from": "system",
"value": "Fix ordering issue in test\n"
},
{
"from": "human",
"value": "import pytest\nimport sys\n\n\ndef test_1(m):\n m.touch(\"/somefile\") # NB: is found with or without initial /\n m.touch(\"afiles/and/anothers\")\n files = m.find(\"\")\n if \"somefile\" in ... | python | chosen |
[
{
"from": "system",
"value": "Handle ImportError at package root\n"
},
{
"from": "human",
"value": "\"\"\"Stupid simple Python configuration management\"\"\"\n\nfrom __future__ import absolute_import\n\nimport os as _os\n\n__version__ = '0.5.1'\n\n\n\n# Attempt to auto-load a default configurati... | python | chosen |
[
{
"from": "system",
"value": "Add script to download by 'set'\n"
},
{
"from": "human",
"value": "import ocpaccess.download\n\nocpaccess.download.get_data(\n token = \"kasthuri11\", zoom = 1,\n x_start = 0, x_stop = 10752,\n y_start =... | python | chosen |
[
{
"from": "system",
"value": "Add scret key for sessioning\n"
},
{
"from": "human",
"value": "from flask import request, session\nfrom . import main\nimport twilio.twiml\n\n\n@main.route(\"/report_incident\", methods=['GET', 'POST'])\ndef handle_message():\n step = session.get('step', 0)\n\n ... | python | chosen |
[
{
"from": "system",
"value": "Remove DB session after task\n"
},
{
"from": "human",
"value": "from __future__ import absolute_import\nfrom celery import Celery\n\n\n__celery = None\n\n\ndef create_celery(app):\n global __celery\n if __celery:\n return __celery\n celery = Celery(\... | python | chosen |
[
{
"from": "system",
"value": "Add a 'type()' function to resources for policy engines to lookup policies\n"
},
{
"from": "human",
"value": "from abc import ABCMeta, abstractmethod\nfrom googleapiclienthelpers.discovery import build_subresource\n\n\nclass ResourceBase(metaclass=ABCMeta):\n\n @... | python | chosen |
[
{
"from": "system",
"value": "Fix typo where get_user_model() was used rather than the user\n"
},
{
"from": "human",
"value": "import logging\n\nfrom django.core.management.base import BaseCommand\nfrom django.contrib.auth import get_user_model\n\nfrom cluster.utils import get_jobs\n\n\nlogger =... | python | chosen |
[
{
"from": "system",
"value": "Complete sol by 2 binary searches\n"
},
{
"from": "human",
"value": "\"\"\"Leetcode 34. Find First and Last Position of Element in Sorted Array\nMedium\n\nGiven an array of integers nums sorted in ascending order, \nfind the starting and ending position of a given t... | python | chosen |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.