conversations listlengths 2 3 | source stringclasses 1
value | stack stringclasses 1
value |
|---|---|---|
[
{
"from": "system",
"value": "Check for 2.8, not 1.8\n"
},
{
"from": "human",
"value": "# -*- Mode: Python -*-\n# vi:si:et:sw=4:sts=4:ts=4\n#\n# Flumotion - a streaming media server\n# Copyright (C) 2004,2005 Fluendo, S.L. (www.fluendo.com). All rights reserved.\n\n# This file may be distributed... | python | chosen |
[
{
"from": "system",
"value": "Sort the list for consistent output\n"
},
{
"from": "human",
"value": "from rest_framework.metadata import SimpleMetadata\nfrom django.utils.encoding import force_str\nfrom utilities.api import ContentTypeField\n\n\nclass ContentTypeMetadata(SimpleMetadata):\n\n ... | python | chosen |
[
{
"from": "system",
"value": "Increase job timeout for securely deleting files\n"
},
{
"from": "human",
"value": "import os\n\nfrom redis import Redis\nfrom rq import Queue\n\nqueue_name = 'test' if os.environ.get('SECUREDROP_ENV') == 'test' else 'default'\n\nq = Queue(name=queue_name, connectio... | python | chosen |
[
{
"from": "system",
"value": "Bump to 0.7.0 development version\n"
},
{
"from": "human",
"value": "version = __version__ = '0.6.2'\n\nfrom .defaults import *\nfrom .fields import *\nfrom .models import *\n"
},
{
"from": "gpt",
"value": "version = __version__ = '0.7.0-dev'\n\nfrom .de... | python | chosen |
[
{
"from": "system",
"value": "Make vlc exit at end of play\n"
},
{
"from": "human",
"value": "import subprocess\nfrom grooveshark import Client\n\nclient = Client()\nclient.init()\n\ndef get_song_url(song_name):\n song = client.search(song_name).next()\n return song.stream.url\n\ndef play_... | python | chosen |
[
{
"from": "system",
"value": "Add test for exception handling in flask app\n"
},
{
"from": "human",
"value": "from eachday.tests.base import BaseTestCase\nimport json\n\n\nclass TestResourceUtils(BaseTestCase):\n def test_invalid_json_error(self):\n ''' Test that an invalid JSON body h... | python | chosen |
[
{
"from": "system",
"value": "Make it just return the string if it is not base64\n"
},
{
"from": "human",
"value": "import zlib\nimport base64\n\nimport binascii\nfrom django.db import models\nfrom django.core import exceptions\n\n\nclass ZipField(models.Field):\n\n def db_type(self, connecti... | python | chosen |
[
{
"from": "system",
"value": "Correct factor for electron volt\n"
},
{
"from": "human",
"value": "from measurement.base import MeasureBase\n\n\n__all__ = [\n 'Energy'\n]\n\n\nclass Energy(MeasureBase):\n STANDARD_UNIT = 'J'\n UNITS = {\n 'c': 4.18400,\n 'C': 4184.0,\n ... | python | chosen |
[
{
"from": "system",
"value": "Fix python 3 incompatible print statement\n"
},
{
"from": "human",
"value": "import boto.ec2\nimport sys\nimport argparse\n\nparser = argparse.ArgumentParser()\nparser.add_argument('aws_access_key_id')\nparser.add_argument('aws_secret_access_key')\nparser.add_argume... | python | chosen |
[
{
"from": "system",
"value": "FIX 'render_template not defined' error\n\nThis was appearing if you try to open 'http://host:port/'\n"
},
{
"from": "human",
"value": "\nfrom . import scores\nfrom . import ui\n\n\ndef configure(config, bp, score_processor):\n\n @bp.route(\"/\", methods=[\"GET\"... | python | chosen |
[
{
"from": "system",
"value": "Write some logic for 54\n"
},
{
"from": "human",
"value": "from path import dirpath\n\n\ndef ans():\n lines = open(dirpath() + '054.txt').readlines()\n cards = [line.strip().split() for line in lines]\n \n return None\n \n\nif __name__ == '__main__':\... | python | chosen |
[
{
"from": "system",
"value": "Print help when subcommand is not supecified\n"
},
{
"from": "human",
"value": "from flicktor import subcommands\n\n\ndef main():\n parser = subcommands._argpaser()\n args = parser.parse_args()\n try: \n args.func(args)\n # except AttributeError:... | python | chosen |
[
{
"from": "system",
"value": "Add warning about real-world usage\n"
},
{
"from": "human",
"value": "# coding: utf-8\n\"\"\"\n regex\n ~~~~~\n\n This is a prototype for an implementation of regular expressions. The goal\n of this prototype is to develop a completely transparent implem... | python | chosen |
[
{
"from": "system",
"value": "Add method to query DNZ Metadata API\n"
},
{
"from": "human",
"value": "import os\nimport json\nimport random\nimport flask\n\nfrom hashlib import md5\n\nrecords = {}\n\n# Create a hash table of all records.\nfor record in json.loads(open('data/records-2015.json').r... | python | chosen |
[
{
"from": "system",
"value": "Update comment in copycontext unit test\n\nFollowing @vladimir-v-diaz's review comment this change adds\nmore information about how repr works with Python dicts and with\nrepy's SafeDict to the unit test's comments.\nEven more information can be found on the issue tracker\nSeat... | python | chosen |
[
{
"from": "system",
"value": "Fix AttributeError: 'list' object has no attribute 'lower'\n"
},
{
"from": "human",
"value": "import os\nimport json\n\nclass Wordfilter:\n def __init__(self):\n # json is in same directory as this class, given by __location__.\n __location__ = os.path.realpa... | python | chosen |
[
{
"from": "system",
"value": "Update search index to look for all objects.\n"
},
{
"from": "human",
"value": "import datetime\nfrom haystack.indexes import *\nfrom haystack import site\nfrom models import Paste, Commit\n\nclass CommitIndex(RealTimeSearchIndex):\n text = CharField(document=Tru... | python | chosen |
[
{
"from": "system",
"value": "Remove old web ui backend\n"
},
{
"from": "human",
"value": "from flask import render_template, request, Blueprint\nimport json\n\nfrom app.state import state\n\n\nindex = Blueprint('index', __name__, template_folder='templates')\n@index.route('/', methods=['POST', ... | python | chosen |
[
{
"from": "system",
"value": "Fix a warning in 1.8\n"
},
{
"from": "human",
"value": "from django.db import models\n\nfrom djangae import patches\n\n\nclass CounterShard(models.Model):\n count = models.PositiveIntegerField()\n\n# Apply our django patches\npatches.patch()\n"
},
{
"from... | python | chosen |
[
{
"from": "system",
"value": "Add project to integration credential api fields\n"
},
{
"from": "human",
"value": "# -*- coding: utf-8 -*-\nfrom __future__ import absolute_import, unicode_literals\nfrom rest_framework import viewsets, serializers\nfrom integrations.credentials.models import Integ... | python | chosen |
[
{
"from": "system",
"value": "Use explicit read buffer size in curio/streams bench\n"
},
{
"from": "human",
"value": "from curio import Kernel, new_task, run_server\nfrom socket import *\n\nasync def echo_handler(client, addr):\n print('Connection from', addr)\n try:\n client.setsoc... | python | chosen |
[
{
"from": "system",
"value": "Configure TLS for the DockerSpawner.\n"
},
{
"from": "human",
"value": "import os\nimport re\n\nc = get_config()\n\nc.JupyterHub.hub_ip = '0.0.0.0'\nc.DockerSpawner.use_docker_client_env = True\nc.DockerSpawner.tls_assert_hostname = True\n\nc.JupyterHub.spawner_clas... | python | chosen |
[
{
"from": "system",
"value": "Change the version to v0.12\n"
},
{
"from": "human",
"value": "# -*- coding: utf-8 -*-\n\nVERSION = (0, 11,)\n\n__author__ = 'Mosky <http://mosky.tw>'\n__version__ = '.'.join(str(v) for v in VERSION)\n"
},
{
"from": "gpt",
"value": "# -*- coding: utf-8 -... | python | chosen |
[
{
"from": "system",
"value": "Debug Google Cloud Run support\n"
},
{
"from": "human",
"value": "#!/usr/bin/python3\n#\n# Define containerized environment for running Diosix on Qemu\n#\n# On Google Cloud Run: Creates HTTP server on port 8080\n# or whatever was specified using the PORT system vari... | python | chosen |
[
{
"from": "system",
"value": "Change romance to outlook, outlook to volume\n"
},
{
"from": "human",
"value": "import random\nimport operator\n\ndef get_sentiment(current_user, users, threads):\n friend_msg_count = {}\n for user in users.keys():\n friend_msg_count[user] = 0\n for ... | python | chosen |
[
{
"from": "system",
"value": "Print stats highest to lowest\n"
},
{
"from": "human",
"value": "from heapq import heappush, heappushpop, heappop\nimport os\nfrom pathlib import Path\nimport sys\nfrom typing import List, Tuple\n\n\nN_LARGEST = 50\n\"\"\"Number of long file names to list.\"\"\"\n\n... | python | chosen |
[
{
"from": "system",
"value": "Add docstring for Client.all() method\n"
},
{
"from": "human",
"value": "from .rest import RestClient\n\n\nclass Client(object):\n\n \"\"\"Docstring for Client. \"\"\"\n\n def __init__(self, domain, jwt_token):\n url = 'https://%s/api/v2/clients' % doma... | python | chosen |
[
{
"from": "system",
"value": "Use gtk ui by default\n"
},
{
"from": "human",
"value": "# Copyright (c) 2012 John Reese\n# Licensed under the MIT License\n\nfrom __future__ import absolute_import, division\n\nengine = None\nui = None\n\ndef async_engine_command(command, network=None, params=None)... | python | chosen |
[
{
"from": "system",
"value": "Fix tastypie resource name issue.\n"
},
{
"from": "human",
"value": "from tastypie.authorization import DjangoAuthorization\nfrom tastypie.resources import ModelResource\nfrom req_with_auth import DjangoUserAuthentication\n\n\ndef create_tastypie_resource_class(clas... | python | chosen |
[
{
"from": "system",
"value": "Update leaflet request to be over https\n"
},
{
"from": "human",
"value": "from django.contrib.gis.forms import widgets\n\nclass LeafletPointWidget(widgets.BaseGeometryWidget):\n template_name = 'leaflet/leaflet.html'\n\n class Media:\n css = {\n ... | python | chosen |
[
{
"from": "system",
"value": "Remove test Zarr files after completion.\n"
},
{
"from": "human",
"value": "#!/usr/bin/env python\n\n\nimport os\nimport shutil\nimport sys\n\n\nif not os.environ.get(\"TEST_NOTEBOOKS\"):\n sys.exit(0)\n\nfor each in list(sys.argv[1:]) + [\n \"reg.h5\",\n \... | python | chosen |
[
{
"from": "system",
"value": "Set cookie protection mode to strong\n"
},
{
"from": "human",
"value": "import logging\nfrom logging import config\nfrom flask import Flask\nimport dateutil\nimport dateutil.parser\nimport json\nfrom flask_login import LoginManager\n\nfrom config import CONFIG_DICT\... | python | chosen |
[
{
"from": "system",
"value": "Update measurements endpoint of current patient\n"
},
{
"from": "human",
"value": "from .models import Measurement\nfrom rest_framework import viewsets\nfrom graph.serializers import MeasurementGraphSeriesSerializer\nfrom rest_framework.exceptions import ParseError\... | python | chosen |
[
{
"from": "system",
"value": "Sort import statements in another file\n"
},
{
"from": "human",
"value": "from flask import request, render_template, redirect, url_for\nfrom ldap3 import Server, Connection, ALL\nfrom ldap3.core.exceptions import LDAPSocketOpenError\n\nfrom ..models import User\nfr... | python | chosen |
[
{
"from": "system",
"value": "Add functions to manage status change timestamp better\n"
},
{
"from": "human",
"value": "'''\n@author: jnaous\n'''\nfrom django.db import models\nfrom expedient.clearinghouse.aggregate.models import Aggregate\nfrom expedient.common.extendable.models import Extendab... | python | chosen |
[
{
"from": "system",
"value": "Fix a bug (?) in detmine_package\n\nCanditates have their first character removed if it is \".\".\n"
},
{
"from": "human",
"value": "\"\"\"\nUtility that detects the package of a given object.\n\"\"\"\nfrom __future__ import division, print_function, with_statement\... | python | chosen |
[
{
"from": "system",
"value": "Test for bug: too many trimmed bases reported\n"
},
{
"from": "human",
"value": "from __future__ import print_function, division\n\nfrom cutadapt.seqio import ColorspaceSequence\nfrom cutadapt.adapters import ColorspaceAdapter, PREFIX\nfrom cutadapt.scripts.cutadapt... | python | chosen |
[
{
"from": "system",
"value": "Prepare for file concat build system\n"
},
{
"from": "human",
"value": "import os\nimport buildFirefox\nimport buildChrome\n\nos.chdir(os.path.dirname(os.path.abspath(__file__)))\nbuildFirefox.run()\nbuildChrome.run()"
},
{
"from": "gpt",
"value": "impor... | python | chosen |
[
{
"from": "system",
"value": "Add update MR method (for internal use for now)\n"
},
{
"from": "human",
"value": "from gitlabform.gitlab.core import GitLabCore\n\n\nclass GitLabMergeRequests(GitLabCore):\n\n def create_mr(self, project_and_group_name, source_branch, target_branch, title, descr... | python | chosen |
[
{
"from": "system",
"value": "Disable Frankfurt until requests is fixed\n\nref #153\n"
},
{
"from": "human",
"value": "def file_is_allowed(file):\n t = file.endswith(\".py\")\n t &= \"__Init__\" not in file.title()\n t &= \"Sample_City\" not in file.title()\n return t\n"
},
{
... | python | chosen |
[
{
"from": "system",
"value": "Update secondary collector description module\n"
},
{
"from": "human",
"value": "from __future__ import absolute_import\nimport math, utilities.operator\nfrom ...weight import WeightDict, normalize_exp\nfrom .L1 import phase_description\n\n\n# Normalised distances a... | python | chosen |
[
{
"from": "system",
"value": "Remove steps from Env Prof form\n"
},
{
"from": "human",
"value": "from django import forms\nfrom django.forms.models import ModelForm\nfrom installer_config.models import EnvironmentProfile, UserChoice\n \n\nclass EnvironmentForm(ModelForm):\n packages = forms.M... | python | chosen |
[
{
"from": "system",
"value": "Improve reliablity of python article fetcher\n"
},
{
"from": "human",
"value": "# -*- coding: utf-8 -*-\nfrom newspaper import Article\nfrom goose import Goose\nimport json\nimport sys\n\narticle = Article(sys.argv[1])\n\narticle.download()\narticle.parse()\narticle... | python | chosen |
[
{
"from": "system",
"value": "Add build step into Conan recipe.\n"
},
{
"from": "human",
"value": "from conans import ConanFile\n\n\nclass ArgsConan(ConanFile):\n name = \"cfgfile\"\n version = \"0.2.8.2\"\n url = \"https://github.com/igormironchik/cfgfile.git\"\n license = \"MIT\"\n... | python | chosen |
[
{
"from": "system",
"value": "Add nicer ids for tests\n"
},
{
"from": "human",
"value": "import os\n\nimport pytest\n\nfrom tests.consts import examples_path\nfrom valohai_yaml import parse\n\n\ndef _load_config(filename, roundtrip):\n with open(os.path.join(examples_path, filename), 'r') as ... | python | chosen |
[
{
"from": "system",
"value": "Add test for Discuss Welcome\n\nThis ensures the welcome post is sufficiently welcoming.\n\nThe XPaths are based on the page with Javascript disabled. As such,\nthey will not correctly match if Javascript is enabled.\n"
},
{
"from": "human",
"value": "import pytest\... | python | chosen |
[
{
"from": "system",
"value": "Update binaries path with private repo\n"
},
{
"from": "human",
"value": "import nose\nimport driller\n\nimport logging\nl = logging.getLogger(\"driller.tests.test_driller\")\n\nimport os\nbin_location = str(os.path.join(os.path.dirname(os.path.realpath(__file__)), ... | python | chosen |
[
{
"from": "system",
"value": "Move component_unittest to android main waterfall and cq\n\nThese are existing tests that moved to the component_unittest\ntarget. They have been running on the FYI bots for a few days\nwithout issue.\n\nBUG=\nAndroid bot script change. Ran through android trybots.\nNOTRY=true\... | python | chosen |
[
{
"from": "system",
"value": "Fix a couple of tests\n\nFix a couple of tests that were broken by commit 7e068a3.\n"
},
{
"from": "human",
"value": "\nimport json\nimport ckanapi\nimport unittest\nimport paste.fixture\n\ndef wsgi_app(environ, start_response):\n status = '200 OK'\n headers =... | python | chosen |
[
{
"from": "system",
"value": "Fix typo test case name\n"
},
{
"from": "human",
"value": "# python3 only\n#: Okay\nVAR1, *VAR2, VAR3 = 1, 2, 3\n#: Okay\n[VAR1, *VAR2, VAR3] = (1, 2, 3)\n#: N806\ndef extended_unpacking_ok():\n Var1, *Var2, Var3 = 1, 2, 3\n#: N806\ndef extended_unpacking_not_ok(... | python | chosen |
[
{
"from": "system",
"value": "Add static method for email address\n"
},
{
"from": "human",
"value": "from passlib.hash import pbkdf2_sha512\n\nclass Utils:\n\n\t@staticmethod\n\tdef hash_password(password):\n\t\t\"\"\"\n\t\tHashes a password using sha512 -> pbkdf2_sha512 encrypted password\n\t\t... | python | chosen |
[
{
"from": "system",
"value": "Tweak PayPal output to use Payee and Memo fields\n"
},
{
"from": "human",
"value": "#!/usr/bin/env python3\n\nimport argparse\nimport csv\n\nparser = argparse.ArgumentParser()\nparser.add_argument('--config', help='path to file containing column header mappings', re... | python | chosen |
[
{
"from": "system",
"value": "Set pool_recycle to deal with MySQL closing idle connections.\n\nSee http://docs.sqlalchemy.org/en/latest/dialects/mysql.html#connection-timeouts\n"
},
{
"from": "human",
"value": "from sqlalchemy import create_engine\n\nfrom inbox.sqlalchemy_ext.util import ForceSt... | python | chosen |
[
{
"from": "system",
"value": "Remove unused imports from AppConfig module.\n"
},
{
"from": "human",
"value": "\"\"\"Django DDP app config.\"\"\"\n\nfrom __future__ import print_function\n\nfrom django.apps import AppConfig\nfrom django.conf import settings, ImproperlyConfigured\nfrom django.db i... | python | chosen |
[
{
"from": "system",
"value": "Add missing facebook and google verif codes\n"
},
{
"from": "human",
"value": "\"\"\"\nExtra context processors for the CarnetDuMaker app.\n\"\"\"\n\nfrom django.contrib.sites.shortcuts import get_current_site\nfrom django.utils.translation import ugettext_lazy as _... | python | chosen |
[
{
"from": "system",
"value": "Remove out-of-date comment about snapshot UX\n"
},
{
"from": "human",
"value": "from cloudenvy.envy import Envy\n\n\nclass EnvySnapshot(object):\n \"\"\"Create a snapshot of an ENVy.\"\"\"\n\n def __init__(self, argparser):\n self._build_subparser(argpa... | python | chosen |
[
{
"from": "system",
"value": "Add test for context manager\n"
},
{
"from": "human",
"value": "import pytest\n\nimport aiohttp\nfrom aiohttp import web\n\n\n@pytest.mark.run_loop\nasync def test_await(create_server, loop):\n\n async def handler(request):\n return web.HTTPOk()\n\n app... | python | chosen |
[
{
"from": "system",
"value": "Make year range arguments optional in search\n"
},
{
"from": "human",
"value": "import scholarly\nimport requests\n\n_SEARCH = '/scholar?q=\\\"{}\\\"&as_ylo={}&as_yhi={}'\ndef search(query, start_year, end_year):\n \"\"\"Search by scholar query and return a gener... | python | chosen |
[
{
"from": "system",
"value": "Fix test output to not fail on Windows\n"
},
{
"from": "human",
"value": "#!/usr/bin/env python\n\ncommand = \"echo 'Without repeated errors:' >> out.txt 2>&1 ;\\n\"\ncommand += testshade(\"-g 2 2 test\")\n\ncommand += \"echo 'With repeated errors:' >> out.txt 2>&1 ... | python | chosen |
[
{
"from": "system",
"value": "Fix issue with uninitialised response\n"
},
{
"from": "human",
"value": "import collections\n\nimport click\n\n\ndef admin_command(fn):\n fn.__doc__ += ' [Admin only]'\n return fn\n\n\nclass PyutrackContext(object):\n def __init__(self, connection, config, ... | python | chosen |
[
{
"from": "system",
"value": "Fix WSGI middleware to call close() on the iterable instead of checking if it's callable, and reraising the exception if one results as per spec. Also call sender correctly\n"
},
{
"from": "human",
"value": "import logging\n\nfrom raygun4py import raygunprovider\n\n... | python | chosen |
[
{
"from": "system",
"value": "jobs: Remove Edge from jobs package.\n\nSigned-off-by: Michael Markert <5eb998b7ac86da375651a4cd767b88c9dad25896@googlemail.com>\n"
},
{
"from": "human",
"value": "from penchy.jobs import jvms, tools, filters, workloads\nfrom penchy.jobs.job import Job, SystemCompos... | python | chosen |
[
{
"from": "system",
"value": "Fix the raw paths for Gitorious\n\nGitorious have changed the raw orl paths, making impossible to use a Gitorious\nrepository.\n\nThis patch has been tested in production at\nhttp://reviewboard.chakra-project.org/r/27/diff/#index_header\n\nReviewed at http://reviews.reviewboard... | python | chosen |
[
{
"from": "system",
"value": "Use HTTPS URLs for MaxMind resources\n"
},
{
"from": "human",
"value": "from ooni.settings import config\nfrom ooni.utils import unzip, gunzip\n\nfrom ooni.deckgen.processors import citizenlab_test_lists\nfrom ooni.deckgen.processors import namebench_dns_servers\n\n... | python | chosen |
[
{
"from": "system",
"value": "chore: Update init sample to import inside of function.\n\nPiperOrigin-RevId: 485079470\n"
},
{
"from": "human",
"value": "# Copyright 2021 Google LLC\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may not use this file except in comp... | python | chosen |
[
{
"from": "system",
"value": "Send back announce response to client\n"
},
{
"from": "human",
"value": "#!/usr/bin/env python\nimport struct\n\nfrom twisted.internet.protocol import DatagramProtocol\nfrom twisted.internet import reactor\n\n\nclass Announce(DatagramProtocol):\n\n def parse_connec... | python | chosen |
[
{
"from": "system",
"value": "Add new fields on LogConfiguration model\n"
},
{
"from": "human",
"value": "# -*- coding: utf-8 -*-\nfrom __future__ import absolute_import, unicode_literals\nfrom django.contrib import admin\nimport logging\n\n\nLOG = logging.getLogger(__name__)\n\n\nclass LogConfi... | python | chosen |
[
{
"from": "system",
"value": "Add <chrome>/src/third_party dir to PYTHONPATH for Chrome checkouts.\n\nIf chromite is living inside the Chrome checkout under\n<chrome_root>/src/third_party/chromite, its dependencies will be\nchecked out to <chrome_root>/src/third_party instead of the normal\nchromite/third_p... | python | chosen |
[
{
"from": "system",
"value": "Remove schedule from admin too\n"
},
{
"from": "human",
"value": "from django.contrib import admin\nfrom django.forms import model_to_dict\nfrom django.utils.timezone import now\n\nfrom main.models import Lan, Event\n\n\nclass EventInline(admin.TabularInline):\n ... | python | chosen |
[
{
"from": "system",
"value": "Use of circle() instead of oval()\n"
},
{
"from": "human",
"value": "size(800, 800)\nimport time\ncolormode(RGB)\n\nspeed(60)\n\ndef setup():\n # ovallist is the list of ovals we created by moving the mouse.\n global ovallist\n stroke(0)\n strokewidth(1)... | python | chosen |
[
{
"from": "system",
"value": "Add quick error messaging for easier debugging\n"
},
{
"from": "human",
"value": "import requests, json\nimport pandas as pd\n\n\nclass AT:\n\tdef __init__(self, base, api):\n\t\tself.base = base\n\t\tself.api = api\n\t\tself.headers = {\"Authorization\": \"Bearer \... | python | chosen |
[
{
"from": "system",
"value": "Clean up module loading printing\n"
},
{
"from": "human",
"value": "import os, sys\nfrom glob import glob\nimport GlobalVars\n\ndef LoadFunction(path, loadAs=''):\n loadType = 'l'\n name = path\n src = __import__('Functions.' + name, globals(), locals(), []... | python | chosen |
[
{
"from": "system",
"value": "Add attended_meetings and absent_meetings methos to User class\n"
},
{
"from": "human",
"value": "from django.db import models\nfrom django.contrib.auth.models import AbstractUser\n\n\nclass User(AbstractUser):\n faculty_number = models.CharField(max_length=8)\n\... | python | chosen |
[
{
"from": "system",
"value": "Configure slacker on app initialization\n"
},
{
"from": "human",
"value": "from __future__ import absolute_import\nfrom __future__ import unicode_literals\n\n# Import flask and template operators\nfrom flask import Flask, request, render_template\n\n# Define the WSG... | python | chosen |
[
{
"from": "system",
"value": "Test that only stubbed methods are altered on partial doubles.\n"
},
{
"from": "human",
"value": "from doubles import allow, teardown\n\n\nclass User(object):\n def __init__(self, name):\n self.name = name\n\n def get_name(self):\n return self.na... | python | chosen |
[
{
"from": "system",
"value": "Handle posting in comments content type so the \"post comment\" stays in the cms framework instead of showing an external page from django.contrib.comments."
},
{
"from": "human",
"value": "# ------------------------------------------------------------------------\n... | python | chosen |
[
{
"from": "system",
"value": "Add dependency to azure monitor\n"
},
{
"from": "human",
"value": "from setuptools import setup, find_packages\n\nversion = '5.0.0'\n\nsetup(\n name=\"alerta-azure-monitor\",\n version=version,\n description='Alerta webhook for Azure Monitor',\n url='htt... | python | chosen |
[
{
"from": "system",
"value": "Check APP_ENGINE env var before using hard-coded path to Google AppEngine SDK.\n"
},
{
"from": "human",
"value": "#!/usr/bin/env python\n\nimport optparse\nimport sys\nfrom os import path\nfrom os.path import expanduser\nimport unittest\nimport argparse\n\n# Simple ... | python | chosen |
[
{
"from": "system",
"value": "Change version number to 2.11.0.\n"
},
{
"from": "human",
"value": "# Copyright 2017 The Forseti Security Authors. All rights reserved.\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may not use this file except in compliance with the... | python | chosen |
[
{
"from": "system",
"value": "Fix race condition in create_download\n"
},
{
"from": "human",
"value": "from celery import shared_task\nfrom django.db.models import F\n\nfrom grandchallenge.serving.models import Download\n\n\n@shared_task\ndef create_download(*_, **kwargs):\n try:\n d =... | python | chosen |
[
{
"from": "system",
"value": "Fix typo: `meight` -> `might`\n"
},
{
"from": "human",
"value": "\"\"\"\nprompt_toolkit\n==============\n\nAuthor: Jonathan Slenders\n\nDescription: prompt_toolkit is a Library for building powerful interactive\n command lines in Python. It can be a rep... | python | chosen |
[
{
"from": "system",
"value": "Use full path as album name fallback. Support all Trovebox file types.\n"
},
{
"from": "human",
"value": "import os\nimport re\nimport datetime\n\nfrom trovebox import Trovebox\n\ndef main():\n try:\n client = Trovebox()\n client.configure(api_versi... | python | chosen |
[
{
"from": "system",
"value": "Add human readable owner & categories.\n"
},
{
"from": "human",
"value": "from rest_framework import serializers\nfrom . import models\n\n\nclass Category(serializers.ModelSerializer):\n class Meta:\n model = models.Category\n\n\nclass Task(serializers.Mod... | python | chosen |
[
{
"from": "system",
"value": "Make commit_on_http_success commit for status codes from 200 to 399 and not only with 200\n\nSigned-off-by: Álvaro Arranz García <3a7352a9ec78d7d17a9240a830621a1f159ca041@conwet.com>\n"
},
{
"from": "human",
"value": "from django.db.transaction import is_dirty, leav... | python | chosen |
[
{
"from": "system",
"value": "Restructure code to avoid unnecessary list slicing by using rsplit.\n"
},
{
"from": "human",
"value": "# encoding: utf-8\n\"\"\"\nA simple utility to import something by its string name.\n\nAuthors:\n\n* Brian Granger\n\"\"\"\n\n#------------------------------------... | python | chosen |
[
{
"from": "system",
"value": "Fix: Reset GIDs works even if user has no pub_key\n"
},
{
"from": "human",
"value": "#!/usr/bin/env python\n# -*- coding:utf-8 -*-\n\nimport types\n\nfrom sfa.storage.model import *\nfrom sfa.storage.alchemy import *\nfrom sfa.trust.gid import create_uuid\nfrom sfa.... | python | chosen |
[
{
"from": "system",
"value": "Improve choose_nodes method (set problem)\n"
},
{
"from": "human",
"value": "#!/usr/bin/env python\n\n\nfrom utils import read_input\nfrom constants import EURISTIC_FACTOR\n\nfrom collections import Counter\nimport sys\n\n\ndef choose_nodes(nodes, neighbours_iterabl... | python | chosen |
[
{
"from": "system",
"value": "Revert \"remove name mangling to make testing easier\"\n\nThis reverts commit c0647badcab661e0ac6e0499c36868e516dcd2e6.\n"
},
{
"from": "human",
"value": "# -*- coding: utf-8 -*-\n\n\nclass Heap(object):\n \"\"\"Implements a heap data structure in Python.\n\n The ... | python | chosen |
[
{
"from": "system",
"value": "Drop ex12 tests for now.\n"
},
{
"from": "human",
"value": "from nose.tools import *\nfrom exercises import ex12\n\ndef test_histogram():\n '''\n Test our histogram output is correct\n '''\n\n test_histogram = ex12.histogram([1, 2, 3])\n print(test_hi... | python | chosen |
[
{
"from": "system",
"value": "Add unit test for get_redirect_target utility function\n"
},
{
"from": "human",
"value": "import unittest\n\nfrom app import create_app, db\nfrom app.utils import get_or_create, is_safe_url\nfrom app.models import User\n\n\nclass TestUtils(unittest.TestCase):\n d... | python | chosen |
[
{
"from": "system",
"value": "Fix for older versions of django"
},
{
"from": "human",
"value": "from test_plus.test import TestCase\nfrom django_private_chat.views import *\nfrom django.test import RequestFactory\nfrom django.urls import reverse\nfrom django_private_chat.models import *\n\n\ncla... | python | chosen |
[
{
"from": "system",
"value": "BUG: Fix tests on old MPL\n\nOld MPL do not have function-defined colormaps, so the corresponding\ncode path cannot be tested.\n"
},
{
"from": "human",
"value": "# emacs: -*- mode: python; py-indent-offset: 4; indent-tabs-mode: nil -*-\n# vi: set ft=python sts=4 ts=... | python | chosen |
[
{
"from": "system",
"value": "Add tests of non-scalar sigma for AddtiveOU\n"
},
{
"from": "human",
"value": "from __future__ import unicode_literals\nfrom __future__ import print_function\nfrom __future__ import division\nfrom __future__ import absolute_import\nfrom future import standard_librar... | python | chosen |
[
{
"from": "system",
"value": "Remove built-in profiling support; use cProfile from outside\n"
},
{
"from": "human",
"value": "import cmdparse\nimport commands\nimport logging\nimport optparse\nimport sys\n\nparser = cmdparse.CommandParser()\nparser.add_option(\"-b\", \"--brain\", type=\"string\"... | python | chosen |
[
{
"from": "system",
"value": "Fix flake8 errors: E123 closing bracket does not match indentation of opening bracket's line\n"
},
{
"from": "human",
"value": "import pytest\nfrom thefuck.rules.git_remote_seturl_add import match, get_new_command\nfrom tests.utils import Command\n\n\n@pytest.mark.p... | python | chosen |
[
{
"from": "system",
"value": "Add extra code to PostGIS migration to only create extensions if they're not already there. Drop on rollback only if extensions exist.\n"
},
{
"from": "human",
"value": "\"\"\"Enable PostGIS\n\nRevision ID: 4ef20b76cab1\nRevises: 55004b0f00d6\nCreate Date: 2015-02-1... | python | chosen |
[
{
"from": "system",
"value": "Add cron information, clean up old cruft that isnt needed.\n"
},
{
"from": "human",
"value": "#!/usr/bin/env python\n#\n# Periodic cleanup job for blog comments.\n# This will remove any abandoned comments that\n# may have been posted by bots and did not get\n# past ... | python | chosen |
[
{
"from": "system",
"value": "Add 'view_name' to url extra kwargs\n"
},
{
"from": "human",
"value": "from rest_framework import serializers\nfrom rest_framework.reverse import reverse\n\nfrom pages import fields, mixins, models\nfrom pages.utils import build_url\n\n\nclass PageSerializer(seriali... | python | chosen |
[
{
"from": "system",
"value": "Break get_images up to match get_tags\n"
},
{
"from": "human",
"value": "from __future__ import unicode_literals\n\nfrom catsnap import Client, HASH_KEY\nfrom boto.dynamodb.batch import BatchList\nimport json\n\nMAX_ITEMS_TO_REQUEST = 99\n\ndef get_images(filenames)... | python | chosen |
[
{
"from": "system",
"value": "Order entries in table by year, then title\n"
},
{
"from": "human",
"value": "from django.db import models\n\n\nclass Author(models.Model):\n name = models.TextField()\n\n def __str__(self):\n return self.name\n\n\nclass Paper(models.Model):\n url = ... | python | chosen |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.