conversations listlengths 2 3 | source stringclasses 1
value | stack stringclasses 1
value |
|---|---|---|
[
{
"from": "system",
"value": "Make OrganizationWorkspaceManager ignore the original workspace when sharing workspaces with groups\n"
},
{
"from": "human",
"value": "from workspace.models import GroupPublishedWorkspace, PublishedWorkSpace, WorkSpace\n\n\ndef ref_from_workspace(workspace):\n\n ... | python | chosen |
[
{
"from": "system",
"value": "Break delete_project into smaller tasks\n"
},
{
"from": "human",
"value": "\"\"\"\nsentry.tasks.deletion\n~~~~~~~~~~~~~~~~~~~~~\n\n:copyright: (c) 2010-2013 by the Sentry Team, see AUTHORS for more details.\n:license: BSD, see LICENSE for more details.\n\"\"\"\n\nfr... | python | chosen |
[
{
"from": "system",
"value": "Switch from optparase to argparse\n"
},
{
"from": "human",
"value": "# -*- coding: utf-8 -*-\n\nimport logging\nimport os\nimport signal\nimport time\n\nfrom optparse import OptionParser\nfrom watchdog.observers import Observer\nfrom pyautotest.observers import Noti... | python | chosen |
[
{
"from": "system",
"value": "Write tests for swappable model.\n\nResolves #28, #36.\n\n--HG--\nbranch : fix-swappable-model\n"
},
{
"from": "human",
"value": "from django.test import TestCase"
},
{
"from": "gpt",
"value": "from django.conf import settings\nfrom django.core.exception... | python | chosen |
[
{
"from": "system",
"value": "Fix import order to avoid circular import\n\n"
},
{
"from": "human",
"value": "r\"\"\"\n=======\nOpenPNM\n=======\n\nOpenPNM is a package for performing pore network simulations of transport in\nporous materials.\n\nOpenPNM consists of several key modules. Each modu... | python | chosen |
[
{
"from": "system",
"value": "Clean up old code no longer used\n"
},
{
"from": "human",
"value": "\"\"\"Basic views with no home\"\"\"\nimport logging\nfrom pyramid.view import view_config\n\nfrom bookie.bcelery import tasks\nfrom bookie.models import BmarkMgr\nfrom bookie.models.auth import Act... | python | chosen |
[
{
"from": "human",
"value": "Use source file with license\n"
},
{
"from": "gpt",
"value": "\n''' Copyright 2015 RTeam (Edgar Kaziahmedov, Klim Kireev, Artem Yashuhin)\n\n Licensed under the Apache License, Version 2.0 (the \"License\");\n you may not use this file except in compliance with... | python | chosen |
[
{
"from": "system",
"value": "Make optional sherry.conf optional. Oops.\n"
},
{
"from": "human",
"value": "#!/usr/bin/env python\nfrom sherry import app\n\n# Load debug config\napp.config.from_pyfile('../sherry.conf', silent=False)\n\napp.run(host='0.0.0.0', port=5000, debug=True)\n\n"
},
{
... | python | chosen |
[
{
"from": "system",
"value": "Increase the default timeout to 1s.\n"
},
{
"from": "human",
"value": "from gi.repository import Gio\nfrom .proxy import ProxyMixin\nfrom .bus_names import OwnMixin, WatchMixin\nfrom .subscription import SubscriptionMixin\nfrom .registration import RegistrationMixin... | python | chosen |
[
{
"from": "system",
"value": "Use a env var to get config\n"
},
{
"from": "human",
"value": "from flask import Flask\n\napp = Flask(__name__)\napp.config.from_object(\"config\")\n"
},
{
"from": "gpt",
"value": "import os\nfrom flask import Flask\n\napp = Flask(__name__)\napp.config.f... | python | chosen |
[
{
"from": "system",
"value": "Fix Tempest tests failing on gate-solum-devstack-dsvm\n\nDue to a new commit on tempest, devstack tests are failing. It changed\nthe signature of RestClient constructor.\n\nThis patch changes the signature of our inherited class to match the\nchange from tempest.\n\nChange-Id: ... | python | chosen |
[
{
"from": "system",
"value": "Add deprecated flag for teachers and departments\n"
},
{
"from": "human",
"value": "from django.db import models\n\nclass Departments(models.Model):\n urlid = models.IntegerField(unique = True)\n name = models.CharField(\"Department name\", max_length = 200)\n... | python | chosen |
[
{
"from": "system",
"value": "Check to see if qt is loaded; if so, export QtProgress class\n\n"
},
{
"from": "human",
"value": "__revision__ = \"$Revision$\"\n\nfrom textprogress import TextProgress\ntry:\n import qt\nexcept ImportError:\n pass # import QtProgress will cause an error\nelse... | python | chosen |
[
{
"from": "system",
"value": "Use the correct name for the run script\n\nIt may be time to go home.\n"
},
{
"from": "human",
"value": "#! /usr/bin/env python\nimport sys\nimport subprocess\n\n\nclass BmiIlamb(object):\n _command = 'run_ilamb'\n _args = None\n _env = None\n\n def __in... | python | chosen |
[
{
"from": "system",
"value": "Replace 'write' method with '__str__'\n"
},
{
"from": "human",
"value": "import collections\n\n\nclass Settings(object):\n def __init__(self):\n self._settings = collections.OrderedDict()\n\n def __setattr__(self, name, value):\n if name.startswi... | python | chosen |
[
{
"from": "system",
"value": "Rename test to match preferred naming convention for macOS.\n"
},
{
"from": "human",
"value": "import pytest\n\nimport keyring\nfrom keyring.testing.backend import BackendBasicTests\nfrom keyring.backends import macOS\n\n\n@pytest.mark.skipif(\n not keyring.backe... | python | chosen |
[
{
"from": "system",
"value": "Rewrite Vimeo to use the new scope selection system\n"
},
{
"from": "human",
"value": "import foauth.providers\n\n\nclass Vimeo(foauth.providers.OAuth1):\n # General info about the provider\n provider_url = 'http://vimeo.com/'\n docs_url = 'http://developer... | python | chosen |
[
{
"from": "system",
"value": "Check git_push matches without specifying a branch\n"
},
{
"from": "human",
"value": "import pytest\nfrom thefuck.rules.git_push import match, get_new_command\nfrom tests.utils import Command\n\n\n@pytest.fixture\ndef stderr():\n return '''fatal: The current bran... | python | chosen |
[
{
"from": "system",
"value": "Fix the extended test search\n"
},
{
"from": "human",
"value": "import pytest\nimport glob\n\nfrom html2kirby import HTML2Kirby\n\nfiles = []\n\nfor f in glob.glob(\"extended_tests/*.html\"):\n html = f\n txt = f.replace(\".html\", \".txt\")\n\n files.appen... | python | chosen |
[
{
"from": "system",
"value": "Add unit test for database scenario call\n"
},
{
"from": "human",
"value": "# coding: utf-8\n\"\"\"\nUnit tests for the base gate.\n\"\"\"\nfrom unittest.mock import MagicMock, mock_open, patch\nimport smdba.postgresqlgate\n\n\nclass TestPgGt:\n \"\"\"\n Test ... | python | chosen |
[
{
"from": "system",
"value": "Add function for getting installed plugins\n"
},
{
"from": "human",
"value": "# -*- coding: utf-8 -*-\n\n\"\"\"\n@author: Seva Zhidkov\n@contact: zhidkovseva@gmail.com\n@license: The MIT license\n\nCopyright (C) 2015\n\"\"\"\n\nimport os\n\n\nclass Config:\n def ... | python | chosen |
[
{
"from": "system",
"value": "BUG/PERF: Fix and speedup pure-Python fallback for C filter.\n"
},
{
"from": "human",
"value": "try:\n from _Cfilters import nullify_secondary_maxima\nexcept ImportError:\n import numpy as np\n # Because of the way C imports work, nullify_secondary_maxima\n... | python | chosen |
[
{
"from": "system",
"value": "Add default path to config\n"
},
{
"from": "human",
"value": "import argparse\nfrom collections import OrderedDict\nimport json\nimport logger\nimport logging\n\nfrom session import Session\nfrom simulator import Simulator\nfrom cache import Cache\nfrom client_facto... | python | chosen |
[
{
"from": "system",
"value": "Add test of storing float\n"
},
{
"from": "human",
"value": "import pyvm\nimport unittest\n\nclass PyVMTest(unittest.TestCase):\n def setUp(self):\n self.vm = pyvm.PythonVM()\n\n def test_load_const_num(self):\n self.assertEqual(\n 10,... | python | chosen |
[
{
"from": "system",
"value": "Update to prims 1.10 version"
},
{
"from": "human",
"value": "from django.conf import settings\r\n\r\n\r\ndef get_language_choices():\r\n \"\"\"\r\n Default list of language choices, if not overridden by Django.\r\n \"\"\"\r\n DEFAULT_LANGUAGES = (\r\n ... | python | chosen |
[
{
"from": "system",
"value": "Change to path, made relative\n\n\nFormer-commit-id: f00bf782fad3f6ddc6d2c97a23ff4f087ad3a22f\n"
},
{
"from": "human",
"value": "#\n# Code to load project paths\n#\n\nimport os, sys\n\nMR_BASE_PATH = os.path.abspath(os.path.join(os.path.dirname(__file__), \"/Users/d... | python | chosen |
[
{
"from": "system",
"value": "Add x, y arguments and docstring\n"
},
{
"from": "human",
"value": "\"\"\"\nUser-facing interface for plotting all dimensionality reduction algorithms\n\"\"\"\n\ndef smushplot(data, smusher='pca', n_components=2, marker='o', marker_order=None,\n text=Fa... | python | chosen |
[
{
"from": "system",
"value": "Remove unused fixture from orderer\n"
},
{
"from": "human",
"value": "\"\"\"\n:Copyright: 2006-2020 Jochen Kupperschmidt\n:License: Modified BSD, see LICENSE for details.\n\"\"\"\n\nimport pytest\n\nfrom byceps.services.shop.cart.models import Cart\nfrom byceps.serv... | python | chosen |
[
{
"from": "system",
"value": "Remove '\\' condition from test as it will not be in the file path when used on Linux.\n"
},
{
"from": "human",
"value": "import unittest\nimport os\nfrom approvaltests.Namer import Namer\n\n\nclass NamerTests(unittest.TestCase):\n def test_class(self):\n ... | python | chosen |
[
{
"from": "system",
"value": "Fix psycopg2 DataError due to bad varchar length\n"
},
{
"from": "human",
"value": "# -*- coding: utf-8 -*-\n# Generated by Django 1.11.3 on 2017-07-14 19:02\nfrom __future__ import unicode_literals\n\nfrom django.db import migrations, models\n\n\nclass Migration(mi... | python | chosen |
[
{
"from": "system",
"value": "Allow Spider to log into LinkedIn.\n\n* SearchSpider now uses InitSpider as base class,\n* SearchSpider now accepts username and password arguments,\n* username and password can also be set by SPIDER_USERNAME and SPIDER_PASSWORD env variables,\n* SearchSpider log into LinkedIn ... | python | chosen |
[
{
"from": "system",
"value": "Update example to make use of the new simplified color scheme api\n"
},
{
"from": "human",
"value": "\"\"\"\nMinimal example showing the use of the AutoCompleteMode.\n\"\"\"\nimport logging\nlogging.basicConfig(level=logging.DEBUG)\nimport sys\n\nfrom pyqode.qt impo... | python | chosen |
[
{
"from": "system",
"value": "migrations: Fix typo in 0099 reverse_sql.\n\nSigned-off-by: Anders Kaseorg <dfdb7392591db597bc41cf266a9c3bc12a2706e5@zulip.com>\n"
},
{
"from": "human",
"value": "from django.db import migrations\n\n\nclass Migration(migrations.Migration):\n\n dependencies = [\n ... | python | chosen |
[
{
"from": "system",
"value": "feat: Connect database engine to postgresql\n"
},
{
"from": "human",
"value": "from sqlalchemy import Column, ForeignKey, Integer, String\nfrom sqlalchemy.orm import relationship\nfrom sqlalchemy import create_engine\n\nfrom models.base import Base\nfrom models.user... | python | chosen |
[
{
"from": "system",
"value": "Change validators to allow additional arguments to be given to the functions they are wrapping\n"
},
{
"from": "human",
"value": "import json\nfrom functools import wraps\n\nfrom twisted.web import http\n\nfrom jsonschema import Draft4Validator\n\nfrom vumi_http_ret... | python | chosen |
[
{
"from": "system",
"value": "Test that users can access frontend when in osmaxx group\n"
},
{
"from": "human",
"value": "from django.test import TestCase\nfrom django.contrib.auth.models import User\nfrom osmaxx.contrib.auth.frontend_permissions import user_in_osmaxx_group\n\n\nclass TestFronte... | python | chosen |
[
{
"from": "system",
"value": "Fix condition in snapshot script. Argv is never 2 long, it can be 3 or 4.\n"
},
{
"from": "human",
"value": "#!/usr/bin/env python\n\nimport snapshot, sys\n\nif len(sys.argv) == 2:\n print(snapshot.make_snapshot(sys.argv[1], sys.argv[2], \"\"))\nelse:\n print(... | python | chosen |
[
{
"from": "system",
"value": "Add get_config as GPIO action\n"
},
{
"from": "human",
"value": "from rpc import RPCService\nfrom pi_pin_manager import PinManager\n\n\nALLOWED_ACTIONS = ('on', 'off', 'read')\n\n\nclass GPIOService(RPCService):\n\n def __init__(self, rabbit_url, device_key, pin_... | python | chosen |
[
{
"from": "system",
"value": "Make the tests run just via py.test\n"
},
{
"from": "human",
"value": "from factories import post_factory, post\n"
},
{
"from": "gpt",
"value": "from factories import post_factory, post\nimport os\nimport sys\n\n\nroot = os.path.join(os.path.dirname(__fi... | python | chosen |
[
{
"from": "system",
"value": "Add MIT license that shows up in `pip show rlbot`\n"
},
{
"from": "human",
"value": "import setuptools\n\n__version__ = None # This will get replaced when reading version.py\n\nexec(open('rlbot/version.py').read())\n\nwith open(\"README.md\", \"r\") as readme_file:... | python | chosen |
[
{
"from": "system",
"value": "Read from stdin if available.\n"
},
{
"from": "human",
"value": "from __future__ import print_function\n\nimport sys\n\nfrom .api import parse\n\n\ndef main():\n result = parse(sys.argv[1])\n print(result)\n"
},
{
"from": "gpt",
"value": "from __fu... | python | chosen |
[
{
"from": "system",
"value": "Add check that heartbeat timeout is integer\n"
},
{
"from": "human",
"value": "import os\nimport platform\nimport sys\n\nimport click\n\nprog = os.path.basename(sys.argv[0])\n\n\n@click.command('heartbeat', short_help='Send a heartbeat')\n@click.option('--origin', d... | python | chosen |
[
{
"from": "system",
"value": "[py] Sort files into dict with dir as key\n"
},
{
"from": "human",
"value": "#!/usr/bin/env python\n# -*- Coding: utf-8 -*-\n\nimport os\n\nclass Dirmuncher:\n def __init__(self, directory):\n self.directory = directory\n\n def directoryListing(self):\n... | python | chosen |
[
{
"from": "system",
"value": "Fix exception handling in management command. Clean up.\n"
},
{
"from": "human",
"value": "'''\nCreates an admin user if there aren't any existing superusers\n'''\n\nfrom django.core.management.base import BaseCommand, CommandError\nfrom django.contrib.auth.models i... | python | chosen |
[
{
"from": "system",
"value": "Implement test data JSON loader\n"
},
{
"from": "human",
"value": "import os\nimport pytest\nfrom pywatson.watson import Watson\n\n\n@pytest.fixture\ndef config():\n \"\"\"Get Watson configuration from the environment\n\n :return: dict with keys 'url', 'userna... | python | chosen |
[
{
"from": "system",
"value": "Add automatic sending of 900/901 numerics for account status\n"
},
{
"from": "human",
"value": "from twisted.plugin import IPlugin\nfrom txircd.module_interface import IModuleData, ModuleData\nfrom txircd.utils import ircLower\nfrom zope.interface import implements\... | python | chosen |
[
{
"from": "system",
"value": "Make loop a little more readable\n"
},
{
"from": "human",
"value": "import json\nimport codecs\nimport tempfile\nfrom django.core.management.commands.makemessages import Command as BaseCommand\n\n\nclass Command(BaseCommand):\n \"\"\" Extend the makemessages to i... | python | chosen |
[
{
"from": "system",
"value": "Refactor api test to setup test client in setup +review PLAT-127 DCORE-1109\n"
},
{
"from": "human",
"value": "from nose.tools import eq_\nimport mock\n\nfrom lcp import api\n\n\n@mock.patch('lcp.api.requests.request')\ndef _assert_calls_requests_with_url(original_u... | python | chosen |
[
{
"from": "system",
"value": "Improve API test by only comparing args and varargs.\n"
},
{
"from": "human",
"value": "# coding: utf-8\n\n\"\"\"\nTest the backend API\n\nWritten so that after creating a new backend, you can immediately see which\nparts are missing!\n\"\"\"\n\nfrom unittest import... | python | chosen |
[
{
"from": "system",
"value": "Fix error message for initdb test\n"
},
{
"from": "human",
"value": "import unittest\nfrom click.testing import CliRunner\n\nfrom scuevals_api.cmd import cli\n\n\nclass CmdsTestCase(unittest.TestCase):\n\n @classmethod\n def setUpClass(cls):\n cls.runne... | python | chosen |
[
{
"from": "system",
"value": "wsgi: Use meinheld worker (same as other Python Frameworks)\n"
},
{
"from": "human",
"value": "\nimport subprocess\nimport sys\nimport setup_util\nimport os\n\ndef start(args):\n subprocess.Popen(\"gunicorn hello:app -b 0.0.0.0:8080 -w \" + str((args.max_threads * ... | python | chosen |
[
{
"from": "system",
"value": "Add a function to retrieve roles from reactions\n"
},
{
"from": "human",
"value": "from .citation import cite_me_please\nfrom .fluxes import measure_fluxes\nfrom .gapfill_from_roles import gapfill_from_roles\nfrom .assigned_functions_to_reactions import to_reactions... | python | chosen |
[
{
"from": "system",
"value": "Remove code specific to my system\n"
},
{
"from": "human",
"value": "import os\nfrom urllib.parse import urlencode, quote\n\nfrom autobit import Client\n\n\ndef add_rarbg_feed(client, name, directory, filter_kwargs):\n url = 'http://localhost:5555/{}?{}'.format(\... | python | chosen |
[
{
"from": "system",
"value": "Add all blank parameters to sample question\n"
},
{
"from": "human",
"value": "QUESTIONS = [\n {\n 'questionText': 'What is the Labour Code?'\n },\n {\n 'questionText': 'When can a union start a strike?'\n }\n]\n"
},
{
"from": "gpt"... | python | chosen |
[
{
"from": "system",
"value": "Fix ASDF tag test helper to load schemas correctly\n"
},
{
"from": "human",
"value": "# Licensed under a 3-clause BSD style license - see LICENSE.rst\n# -*- coding: utf-8 -*-\nimport os\nimport urllib.parse\n\nimport yaml\n\nimport numpy as np\n\n\ndef run_schema_ex... | python | chosen |
[
{
"from": "system",
"value": "Fix plugin permission data migration\n"
},
{
"from": "human",
"value": "# Generated by Django 3.0.5 on 2020-04-15 09:43\n\nfrom django.db import migrations\n\n\ndef change_extension_permission_to_plugin_permission(apps, schema_editor):\n permission = apps.get_mod... | python | chosen |
[
{
"from": "system",
"value": "Add `add_group` method to `AddressBook` class - to make it possible to add groups to the address book\n"
},
{
"from": "human",
"value": "from person import Person\n\n__all__ = ['AddressBook']\n\n\nclass AddressBook(object):\n\n def __init__(self):\n self.p... | python | chosen |
[
{
"from": "system",
"value": ":fire: Clean exports from typer, remove unneeded Click components, add needed ones\n\nClean exports from typer, remove unneeded Click components"
},
{
"from": "human",
"value": "\"\"\"Typer, build great CLIs. Easy to code. Based on Python type hints.\"\"\"\n\n__vers... | python | chosen |
[
{
"from": "system",
"value": "Extend integration test to check correctness of dumped json data\n"
},
{
"from": "human",
"value": "# -*- coding: utf-8 -*-\n\nimport pathlib\n\n\ndef test_should_write_json(cli_runner, tmp_rc, tmp_templates_file):\n result = cli_runner([\n '-c', tmp_rc, '... | python | chosen |
[
{
"from": "system",
"value": "Make sure getting buckets and checking for their presence work.\n"
},
{
"from": "human",
"value": "from bukkit import Collection\n\n\ndef test_creation():\n buckets = Collection(rate=5, limit=23, timeout=31, clock=lambda: 0)\n assert buckets.rate == 5\n ass... | python | chosen |
[
{
"from": "system",
"value": "Add first test for a good response\n"
},
{
"from": "human",
"value": "from client import client\nimport pytest\n\n\ndef test_string_input():\n assert client(\"String\") == \"You sent: String\"\n\n\ndef test_int_input():\n assert client(42) == \"You sent: 42\"\... | python | chosen |
[
{
"from": "system",
"value": "Simplify state and save server URL\n"
},
{
"from": "human",
"value": "#!/usr/bin/env python\n# encoding=utf8\n\nimport requests\nfrom flexbe_core import EventState, Logger\n\n\nclass Wonderland_Request(EventState):\n\t'''\n\tMoveArm receive a ROS pose as input and l... | python | chosen |
[
{
"from": "system",
"value": "Stop ulmo caching for suds-jurko compliance\n\nPreviously we were using ulmo with suds-jurko 0.6, which is\nthe current latest release, but it is 4 years old. Most recent\nwork on suds-jurko has been done on the development branch,\nincluding optimizations to memory use (which ... | python | chosen |
[
{
"from": "system",
"value": "Change exception name to CosmicRayTestingException\n"
},
{
"from": "human",
"value": "import ast\nimport builtins\n\nfrom .operator import Operator\n\n\nclass OutOfNoWhereException(Exception):\n pass\n\nsetattr(builtins, OutOfNoWhereException.__name__, OutOfNoWhe... | python | chosen |
[
{
"from": "system",
"value": "Resolve pytest warning about TestRPCProvider\n"
},
{
"from": "human",
"value": "import pytest\n\nfrom web3.manager import (\n RequestManager,\n)\nfrom web3.providers.tester import (\n TestRPCProvider,\n is_testrpc_available,\n)\nfrom web3.utils.compat impor... | python | chosen |
[
{
"from": "system",
"value": "CL011: Fix checkboxes inform and involved\n"
},
{
"from": "human",
"value": "from django_comments.forms import CommentForm\n\nfrom django import forms\nfrom django.utils.translation import ugettext_lazy as _\nfrom bettertexts.models import TextComment\n\n\nclass Tex... | python | chosen |
[
{
"from": "human",
"value": "Check Python version upon import\n"
},
{
"from": "gpt",
"value": "\nimport sys\n\nSUPPORTED_VERSIONS = [(2, 7), (3, 6)]\n\npython_major_version = sys.version_info[0]\npython_minor_version = sys.version_info[1]\n\nif (python_major_version, python_minor_version) not in... | python | chosen |
[
{
"from": "system",
"value": "Add explicit example filtering based on the byte length of the content\n"
},
{
"from": "human",
"value": "from tempfile import TemporaryDirectory\n\nfrom expects import expect\nfrom hypothesis import given, assume, example\nfrom hypothesis.strategies import text, ch... | python | chosen |
[
{
"from": "system",
"value": "Switch to a new command-line interface\n"
},
{
"from": "human",
"value": "from collections import namedtuple\nimport sched_utils\nimport check\n\nScheduleConfiguration = namedtuple('ScheduleConfiguration',\n ['zones', 'teams', 'weig... | python | chosen |
[
{
"from": "system",
"value": "[sil-bug-reducer] Refactor adding subparsers given that all subparsers have a common swift_build_dir arg.\n"
},
{
"from": "human",
"value": "#!/usr/bin/env python\n\nimport argparse\n\nimport opt_bug_reducer\n\nimport random_bug_finder\n\n\ndef main():\n parser =... | python | chosen |
[
{
"from": "system",
"value": "Remove leftover imports from testing"
},
{
"from": "human",
"value": "import os\n\nfrom cs251tk.student import remove\nfrom cs251tk.student import clone_student\nfrom cs251tk.student import stash\nfrom cs251tk.student import pull\nfrom cs251tk.student import checkou... | python | chosen |
[
{
"from": "system",
"value": "Revert removal of necessary function\n"
},
{
"from": "human",
"value": "import numpy as np\n\n\ndef distance(u, v):\n \"\"\"\n Distance measure custom made for feature comparison.\n\n Parameters\n ----------\n u: first feature\n v: second feature\n... | python | chosen |
[
{
"from": "system",
"value": "Add Configuration to package definition\n"
},
{
"from": "human",
"value": "import os\nfrom .bmi_ilamb import BmiIlamb\n\n\n__all__ = ['BmiIlamb']\n__version__ = 0.1\n\npackage_dir = os.path.dirname(__file__)\ndata_dir = os.path.join(package_dir, 'data')\n"
},
{
... | python | chosen |
[
{
"from": "system",
"value": "Tweak the JSON we export\n"
},
{
"from": "human",
"value": "#!/usr/bin/env python\n# -*- encoding: utf-8 -*-\n\nimport json\nimport os\nimport subprocess\nimport sys\n\n\ndef find_json_files():\n for root, _, filenames in os.walk('.'):\n if any(\n ... | python | chosen |
[
{
"from": "system",
"value": "Fix channel definition in add method\n"
},
{
"from": "human",
"value": "# Module: node\n# Date: ...\n# Author: ...\n\n\"\"\"Node\n\n...\n\"\"\"\n\nfrom .client import Client\nfrom .server import Server\n\nfrom circuits import handler, BaseComponent\n\n\nclas... | python | chosen |
[
{
"from": "system",
"value": "Add Execption for invalid Integer\n\nException class created for invalid integer and raise it if a bad integer is\nfound\n"
},
{
"from": "human",
"value": "from .lexerconstants import *\nfrom .ws_token import Tokeniser\n\n\nclass Lexer(object):\n def __init__(sel... | python | chosen |
[
{
"from": "system",
"value": "Fix passing invalid None to multiprocessing Process class.\n"
},
{
"from": "human",
"value": "# :coding: utf-8\n# :copyright: Copyright (c) 2013 Martin Pengelly-Phillips\n# :license: See LICENSE.txt.\n\nimport multiprocessing\n\nfrom .base import Processor\n\n\nclas... | python | chosen |
[
{
"from": "system",
"value": "Add docstring to launch_control package\n\n"
},
{
"from": "human",
"value": "# This file is part of the ARM Validation Dashboard Project.\n# for the Linaro organization (http://linaro.org/)\n#\n# For more details see:\n# https://blueprints.launchpad.net/ubuntu/+sp... | python | chosen |
[
{
"from": "system",
"value": "ADD dependency of l10n_ar_invoice for account summary\n"
},
{
"from": "human",
"value": "# -*- coding: utf-8 -*-\n{\n 'name': 'Partner Account Summary',\n 'version': '1.0',\n 'description': \"\"\"Partner Account Summary\"\"\",\n 'category': 'Aeroo Report... | python | chosen |
[
{
"from": "system",
"value": "Use SystemRandom to generate security-viable randomness\n"
},
{
"from": "human",
"value": "import os\nimport random\nimport string\n\n\ndef secure_uuid():\n \"\"\"\n Strength: 6*3 random characters from a list of 62, approx. 64^18 possible\n strings, or 2^1... | python | chosen |
[
{
"from": "system",
"value": "Add deprecated fallback for SSLMiddleware.\n"
},
{
"from": "human",
"value": "\nfrom mezzanine.conf import settings\n\nfrom cartridge.shop.models import Cart\n\n\nclass ShopMiddleware(object):\n\n def __init__(self):\n old = (\"SHOP_SSL_ENABLED\", \"SHOP_F... | python | chosen |
[
{
"from": "system",
"value": "Fix wrong db name for travis.\n"
},
{
"from": "human",
"value": "# -*- coding: utf-8 -*-\nfrom .test import * # noqa\n\nDATABASES = {\n 'default': {\n 'ENGINE': 'django.contrib.gis.db.backends.postgis',\n 'NAME': 'gis',\n 'USER': 'postgres',... | python | chosen |
[
{
"from": "system",
"value": "Fix mypy and regex flag\n"
},
{
"from": "human",
"value": "# MIT licensed\n# Copyright (c) 2020 Felix Yan <felixonmars@archlinux.org>, et al.\n\nimport re\nfrom nvchecker_source.cmd import run_cmd\n\nasync def get_version(\n name, conf, *, cache, keymanager=None\n)... | python | chosen |
[
{
"from": "system",
"value": "Make sure there is data for the meter test\n\nThe meter tests relies on someone else creating a meter. If\nthis test happens to run on a brand new system and it runs before\nthe object store tests, it may fail. For some object store\nactivity before the test.\n\nChange-Id: Ie... | python | chosen |
[
{
"from": "system",
"value": "Add a Backwards compatibility for python 2.7 by adding a __future__ import\n"
},
{
"from": "human",
"value": "import os\nimport airpy\ndef airlist():\n\tinstalled_docs = os.listdir(airpy.data_directory)\n\tfor dir in installed_docs:\n\t\tprint(dir, end= ' ')\n\tpri... | python | chosen |
[
{
"from": "system",
"value": "Make output types consistent for policy creation purposes\n"
},
{
"from": "human",
"value": "#!/usr/bin/python\nimport json\nimport subprocess\n\nprocess = subprocess.Popen([\"yum\", \"check-update\", \"-q\"], stdout=subprocess.PIPE)\n(output, err) = process.communi... | python | chosen |
[
{
"from": "system",
"value": "Add print statements for all error types\n"
},
{
"from": "human",
"value": "from flask import render_template\nfrom app.main import main\n\n\n@main.app_errorhandler(400)\ndef page_not_found(e):\n return _render_error_page(500)\n\n\n@main.app_errorhandler(404)\nde... | python | chosen |
[
{
"from": "system",
"value": "Update py2app script for Qt 5.11\n"
},
{
"from": "human",
"value": "\"\"\"\nThis is a setup.py script generated by py2applet\n\nUsage:\n python setup.py py2app\n\"\"\"\n\nfrom setuptools import setup\nfrom glob import glob\nimport syncplay\n\nAPP = ['syncplayClie... | python | chosen |
[
{
"from": "system",
"value": "Load the spotify header file from an absolute path\n"
},
{
"from": "human",
"value": "from cffi import FFI\nffi = FFI()\n\nprint \"Loading Spotify library...\"\n#TODO: Use absolute paths for open() and stuff\n#Header generated with cpp spotify.h > spotify.processed.... | python | chosen |
[
{
"from": "system",
"value": "Remove subclassing of exception, since there is only one.\n"
},
{
"from": "human",
"value": "# -*- encoding: utf-8 -*-\n\n# Odoo, Open Source Management Solution\n# Copyright (C) 2014-2015 Grupo ESOC <www.grupoesoc.es>\n#\n# This program is free software: you can r... | python | chosen |
[
{
"from": "system",
"value": "Add code for getting and releasing a database connection\n"
},
{
"from": "human",
"value": "# -*- coding: utf-8 -*-\n\n\nfrom flask import Flask\nimport os\nimport psycopg2\nfrom contextlib import closing\n\n\nDB_SCHEMA = \"\"\"\nDROP TABLE IF EXISTS entries;\nCREAT... | python | chosen |
[
{
"from": "system",
"value": "Set celery to ignore results"
},
{
"from": "human",
"value": "import os\nimport logging\nfrom celery import Celery\n\nfrom temp_config.set_environment import DeployEnv\nruntime_env = DeployEnv()\nruntime_env.load_deployment_environment()\n\nredis_server = os.environ... | python | chosen |
[
{
"from": "system",
"value": "Add configure call to random_agent\n"
},
{
"from": "human",
"value": "#!/usr/bin/env python\nimport argparse\nimport logging\nimport sys\n\nimport gym\nimport universe # register the universe environments\n\nfrom universe import wrappers\n\nlogger = logging.getLogge... | python | chosen |
[
{
"from": "system",
"value": "Use regex to match user metrics\n"
},
{
"from": "human",
"value": "\"\"\"\n:Copyright: 2006-2020 Jochen Kupperschmidt\n:License: Modified BSD, see LICENSE for details.\n\"\"\"\n\nimport pytest\n\n\n# To be overridden by test parametrization\n@pytest.fixture\ndef con... | python | chosen |
[
{
"from": "system",
"value": "Move task results database to data dir\n"
},
{
"from": "human",
"value": "from celery import Celery\n\nfrom cref.app.terminal import run_cref\n\napp = Celery(\n 'tasks',\n backend='db+sqlite:///results.sqlite',\n broker='amqp://guest@localhost//'\n)\n\n\n@a... | python | chosen |
[
{
"from": "system",
"value": "Replace joins with list_to_number in 32\n"
},
{
"from": "human",
"value": "from itertools import permutations\n\n\ndef solve() -> int:\n pandigital = []\n\n for permutation in permutations(range(1, 10)):\n result = int(''.join(str(digit) for digit in pe... | python | chosen |
[
{
"from": "system",
"value": "Raise exception when --debug is specified to main script\n\nI.e., instead of printing the exception and then exiting.\n"
},
{
"from": "human",
"value": "import sys\n\nfrom .config import RawConfig, RunConfig\nfrom .exc import RunCommandsError\nfrom .run import run, ... | python | chosen |
[
{
"from": "system",
"value": "Refactor earth mover's distance implementation\n"
},
{
"from": "human",
"value": "import collections\n\n\ndef each(function, iterable):\n for item in iterable:\n function(item)\n\n\ndef each_unpack(function, iterable):\n for item in iterable:\n function(*ite... | python | chosen |
[
{
"from": "system",
"value": "Replace string substitution with string formatting\n"
},
{
"from": "human",
"value": "# -*- coding: utf-8 -*-\n'''\nManage launchd plist files\n'''\n\n# Import python libs\nimport os\nimport sys\n\n\ndef write_launchd_plist(program):\n '''\n Write a launchd pl... | python | chosen |
[
{
"from": "system",
"value": "Switch to recipe engine \"url\" module.\n\nBUG=None\nTEST=expectations\nR=40f3d43a28ebae3cb819288542e1c84d73d962d5@chromium.org\n\nChange-Id: I43a65405c957cb6dddd64f61846b926d81046752\nReviewed-on: https://chromium-review.googlesource.com/505278\nReviewed-by: Robbie Iannucci <4... | python | chosen |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.