conversations listlengths 2 3 | source stringclasses 1
value | stack stringclasses 1
value |
|---|---|---|
[
{
"from": "system",
"value": "Raise a more useful error for circular deps.\n"
},
{
"from": "human",
"value": "from spyc.graph import Vertex, find_cycle, topological_sort\n\n\nclass Scheduler(object):\n\n def __init__(self):\n self.specs = {}\n\n def ensure(self, spec):\n \"\"... | python | chosen |
[
{
"from": "system",
"value": "Split long import line up into two.\n"
},
{
"from": "human",
"value": "import unittest\n\nfrom datetime import date as vanilla_date\n\nfrom calexicon.internal.julian import distant_julian_to_gregorian, julian_to_gregorian, is_julian_leap_year\n\n\nclass TestJulian(u... | python | chosen |
[
{
"from": "system",
"value": "Fix first io adapter being called twice.\n"
},
{
"from": "human",
"value": "from .io import IOAdapter\n\n\nclass MultiIOAdapter(IOAdapter):\n\n def __init__(self, **kwargs):\n super(MultiIOAdapter, self).__init__(**kwargs)\n\n self.adapters = []\n\n... | python | chosen |
[
{
"from": "system",
"value": "Remove patching of upload_names (dist_files) - Python 2.6 already does the right thing.\n"
},
{
"from": "human",
"value": "from distutils.command.bdist_wininst import bdist_wininst as _bdist_wininst\n\nclass bdist_wininst(_bdist_wininst):\n _good_upload = _bad_up... | python | chosen |
[
{
"from": "system",
"value": "Update script file for the season\n"
},
{
"from": "human",
"value": "from main import initiate_shame\n\n# Testing this\ninitiate_shame(1141922, 2016)\n"
},
{
"from": "gpt",
"value": "from main import initiate_shame\n\ninitiate_shame(1141922, 2017)\niniti... | python | chosen |
[
{
"from": "system",
"value": "Fix neverending creation of migrations on heroku\n"
},
{
"from": "human",
"value": "from celery import states\nfrom django.db import models\n\n\nSTATES_CHOICES = zip(states.ALL_STATES, states.ALL_STATES)\n\n\nclass TaskStatus(models.Model):\n \"\"\"\n Task sta... | python | chosen |
[
{
"from": "system",
"value": "Add test case to 014\n"
},
{
"from": "human",
"value": "\"\"\"\nWrite a function to find the longest common prefix string amongst an array of strings.\n\"\"\"\nclass Solution(object):\n def longestCommonPrefix(self, strs):\n \"\"\"\n :type strs: Lis... | python | chosen |
[
{
"from": "system",
"value": "Add lpcres in linpred namespace.\n\n\n"
},
{
"from": "human",
"value": "import levinson_lpc\nfrom levinson_lpc import *\n__all__ = levinson_lpc.__all__\n"
},
{
"from": "gpt",
"value": "import levinson_lpc\nfrom levinson_lpc import *\n__all__ = levinson_l... | python | chosen |
[
{
"from": "system",
"value": "Add setters for project, name, and description.\n"
},
{
"from": "human",
"value": "from datetime import datetime\n\nimport api\nfrom project import Project\n\n\nclass Suite(object):\n def __init__(self, content):\n self._content = content\n self.api... | python | chosen |
[
{
"from": "system",
"value": "Add comment in BaseTests tearDown\n"
},
{
"from": "human",
"value": "import sys\ntry:\n # noinspection PyPackageRequirements\n import unittest2 as unittest\n sys.modules['unittest'] = unittest\nexcept ImportError:\n import unittest\n\nfrom goless.backend... | python | chosen |
[
{
"from": "system",
"value": "Verify default arguments in parser.\n"
},
{
"from": "human",
"value": "import unittest\n\nfrom stun import cli\n\n\nclass TestCLI(unittest.TestCase):\n \"\"\"Test the CLI API.\"\"\"\n\n def test_cli_parser(self):\n cli.make_argument_parser()\n # ... | python | chosen |
[
{
"from": "system",
"value": "Fix test suite on python 3 - high level curl object returns result as bytes\n"
},
{
"from": "human",
"value": "#! /usr/bin/env python\n# -*- coding: utf-8 -*-\n# vi:ts=4:et\n\n# uses the high level interface\nimport curl\nimport unittest\n\nfrom . import appmanager\... | python | chosen |
[
{
"from": "system",
"value": "Update exception test for pytest 5+\n\npytest 3 had message for raises, this is removed in current versions.\n"
},
{
"from": "human",
"value": "# -*- coding: utf-8 -*-\n\nimport pytest\n\nfrom cihai import exc\n\n\ndef test_base_exception():\n with pytest.raises(... | python | chosen |
[
{
"from": "system",
"value": "Remove unused group counts variable\n"
},
{
"from": "human",
"value": "from collections import Counter, defaultdict\n\nimport numpy as np\n\nfrom tmhmm.model import parse\nfrom tmhmm.hmm import viterbi, forward, backward\n\n\n__all__ = ['predict']\n\n\nGROUP_NAMES ... | python | chosen |
[
{
"from": "system",
"value": "Use vopen() to make DictFile works when reading remote repository meta data\n"
},
{
"from": "human",
"value": "import os\nimport json\nimport logging\n\n\nLOGGER = logging.getLogger(__name__)\n\n\nclass DictFile(dict):\n \"\"\"A ``dict``, storable as a JSON file.... | python | chosen |
[
{
"from": "system",
"value": "Set POST/GET/COOKIES on MockRequest so repr works\n"
},
{
"from": "human",
"value": "\"\"\"\ngargoyle.helpers\n~~~~~~~~~~~~~~~~\n\n:copyright: (c) 2010 DISQUS.\n:license: Apache License 2.0, see LICENSE for more details.\n\"\"\"\n\nfrom django.http import HttpReques... | python | chosen |
[
{
"from": "system",
"value": "Add new packages to tests\n"
},
{
"from": "human",
"value": "import pytest\n\n@pytest.mark.parametrize(\"name\", [\n (\"apt-file\"),\n (\"apt-transport-https\"),\n (\"atsar\"),\n (\"blktrace\"),\n (\"ca-certificates\"),\n (\"chromium-browser\"),\n (\"cron\"),... | python | chosen |
[
{
"from": "system",
"value": "Make sure we don't include Collection when pulling collections from a module\n"
},
{
"from": "human",
"value": "import types\nfrom version import __version__\nfrom .model import Model\nfrom .collection import Collection\n\n\nclass Hammock(object):\n\t\n\tdef __init_... | python | chosen |
[
{
"from": "system",
"value": "Set it to consume rewards\n"
},
{
"from": "human",
"value": "import json\nimport httplib2\nfrom config import SERVER\n\nhttp = httplib2.Http()\n\n# print json.loads(http.request(\"http://172.28.101.30:8080/api/v1/family/1/?format=json\", 'GET')[1])\n\ndef json_resul... | python | chosen |
[
{
"from": "system",
"value": "Handle no git user configured\n"
},
{
"from": "human",
"value": "from git import Repo, exc\nimport os\n\nclass GitRepo(object):\n def __init__(self, root=None, remote=\"origin\", lazy=True):\n self.remote_name = remote\n self.root = root\n se... | python | chosen |
[
{
"from": "system",
"value": "Remove cookie support from tornado until it works in all situations\n"
},
{
"from": "human",
"value": "from tornado.web import RequestHandler\nimport bugsnag\n\nclass BugsnagRequestHandler(RequestHandler):\n def _handle_request_exception(self, e):\n # Set ... | python | chosen |
[
{
"from": "system",
"value": "Modify Config file\nPick DB_NAME, TOKEN_DURATION and SECRET from the environment\nUse the hard coded details as backup in case not in the environment\n"
},
{
"from": "human",
"value": "import os\n\n\nclass Config(object):\n \"\"\"Parent configuration class\"\"\"\... | python | chosen |
[
{
"from": "system",
"value": "Update the ignoring error message\n"
},
{
"from": "human",
"value": "from bitHopper.Website import app, flask\nimport btcnet_info\nimport bitHopper.Configuration.Workers\nimport logging\n \n@app.route(\"/worker\", methods=['POST', 'GET'])\ndef worker():\n\n #C... | python | chosen |
[
{
"from": "system",
"value": "Fix issue with management command log output and non ascii event names\n"
},
{
"from": "human",
"value": "# -*- coding: utf-8 -*-\n\nfrom django.core.management import BaseCommand\n\nfrom ...event import sync_events\n\n\nclass Command(BaseCommand):\n def handle(s... | python | chosen |
[
{
"from": "system",
"value": "Add prototype for plotting client\n"
},
{
"from": "human",
"value": "import requests\n\nr = requests.get('http://localhost:8081/monitor_results/1')\nprint(r.json())\nfor monitoring_data in r.json():\n print 'URL: ' + monitoring_data['urlToMonitor']['url']\n"
}... | python | chosen |
[
{
"from": "system",
"value": "Add test_certificate.pem to the release\n"
},
{
"from": "human",
"value": "from distutils.core import setup\nsetup(\n name = 'furs_fiscal',\n packages = ['furs_fiscal'],\n version = '0.1.0',\n description = 'Python library for simplified communication with FURS ... | python | chosen |
[
{
"from": "system",
"value": "Test that spawned process actually writes data\n"
},
{
"from": "human",
"value": "import sys\n\nfrom twisted.trial import unittest\nfrom twisted.python import failure\n\nfrom ..spawn import SpawnCommand\n\nclass DummyEvent(object):\n text = \"\"\n\nclass SpawnCom... | python | chosen |
[
{
"from": "system",
"value": "Use default argument for StreamHandler (which is what want, sys.stderr) because they changed the name of the keyword argument in 2.7\n"
},
{
"from": "human",
"value": "import sys\nimport logging\n\ndef init_logging():\n logFormat = \"%(asctime)s %(levelname)s %(f... | python | chosen |
[
{
"from": "system",
"value": "Add filter to customize which networks to test.\n"
},
{
"from": "human",
"value": "# Begin: Python 2/3 compatibility header small\n# Get Python 3 functionality:\nfrom __future__ import\\\n absolute_import, print_function, division, unicode_literals\nfrom future.u... | python | chosen |
[
{
"from": "system",
"value": "Fix typo in error message\n"
},
{
"from": "human",
"value": "\"\"\"Custom error for invalid yaml file.\"\"\"\n\nfrom .Error import Error\n\nERROR_MESSAGE = \"\"\"\nInvalid YAML file (.yaml)\n\nOptions:\n - Does the file match the expected layout?\n - Does the file... | python | chosen |
[
{
"from": "system",
"value": "Fix KeyError exception when called with no parameters\n"
},
{
"from": "human",
"value": "# coding: utf-8\n\nfrom tapioca import (JSONAdapterMixin, TapiocaAdapter,\n generate_wrapper_from_adapter)\n\nfrom .resource_mapping import RESOURCE_MAPPING\... | python | chosen |
[
{
"from": "system",
"value": "Fix bug with removing flag after \"-c\"\n\n-c does not take an argument. Why did I think it did?\n"
},
{
"from": "human",
"value": "#!/usr/bin/env python\n#\n# Copyright (C) 2011, 2012 Strahinja Val Markovic <val@markovic.io>\n#\n# This file is part of YouComplete... | python | chosen |
[
{
"from": "system",
"value": "Revert \"Add \"page_link\" to \"raw_id_fields\" to prevent the run of \"decompress\"\"\n\nThis reverts commit 4a85ecaaae1452e74acc485d032f00e8bedace47.\n"
},
{
"from": "human",
"value": "from __future__ import unicode_literals\n\nfrom cms.plugin_base import CMSPlugi... | python | chosen |
[
{
"from": "system",
"value": "Handle signals with default interface\n"
},
{
"from": "human",
"value": "from .gobject import GObject\nfrom . import signals\n\nclass Game(GObject):\n def __init__(self):\n self.maps = {}\n self.player = None\n\n def run(self):\n pass\n\n ... | python | chosen |
[
{
"from": "system",
"value": "Create first examples that used the actual API\n"
},
{
"from": "human",
"value": "from buffer.api import API\n\nfrom buffer.user import User\n\ntoken = '1/714ebdb617705ef9491a81fb21c1da42'\napi = API(client_id='51cc6dd5f882a8ba18000055', client_secret='83b019d154cae... | python | chosen |
[
{
"from": "system",
"value": "Use cell.prompt_number rather than cell['prompt_number']\n"
},
{
"from": "human",
"value": "\"\"\"Module containing a preprocessor that removes the outputs from code cells\"\"\"\n\n# Copyright (c) IPython Development Team.\n# Distributed under the terms of the Modif... | python | chosen |
[
{
"from": "system",
"value": "Add detailed error message to jsonl parsing"
},
{
"from": "human",
"value": "import json\n\n\ndef read(fn):\n if fn.endswith(\".jsonl\"):\n raise TypeError(\"JSON Newline format can only be read by iread\")\n with open(fn) as f:\n return json.loa... | python | chosen |
[
{
"from": "system",
"value": "Add welsh days ordinal suffix\n"
},
{
"from": "human",
"value": "import datetime\nfrom flask.ext.babel import lazy_gettext as _\n\n\ndef time_choice(time):\n display_format = \"%I:%M %p\"\n end = time + datetime.timedelta(minutes=30)\n display_string = time... | python | chosen |
[
{
"from": "system",
"value": "Add error logging to aid tracking down future issues.\n"
},
{
"from": "human",
"value": "\"\"\"\nScan through the Samples table for oldish entries and remove them.\n\"\"\"\n\nimport json\nimport boto3\nimport time\nimport decimal\nfrom boto3.dynamodb.conditions impo... | python | chosen |
[
{
"from": "system",
"value": "Fix tempest compatibility for cli tests\n\nCommit https://github.com/openstack/tempest/commit/2474f41f made changes to\ntempest project that are inconsistent with our plugin.\nMake our plugin use latest changes to keep compatibility.\n\nChange-Id: I08d28b40fdd9ad54a0bcce30647d7... | python | chosen |
[
{
"from": "system",
"value": "Print message on completion, to aid debugging"
},
{
"from": "human",
"value": "from gpiozero import LED\nimport time\n\n# GPIO 24 ... LED ... 470 ohm resistor ... GND\n\nled = LED(24)\ntry:\n led.blink()\n time.sleep(20)\nexcept KeyboardInterrupt:\n led.off... | python | chosen |
[
{
"from": "system",
"value": "Add __APPLIED_FIXERS set to make sure we are idempotent\n"
},
{
"from": "human",
"value": "from __future__ import absolute_import, print_function, unicode_literals\n\nfrom . import fixers, utilities, deprecation, registry\n\n\n# TODO make it idempotent with registry... | python | chosen |
[
{
"from": "system",
"value": "Use ms rather than s for process getting benchmark\n"
},
{
"from": "human",
"value": "#!/usr/bin/env python\n# -*- coding: utf-8 -*-\n\n\"\"\"Benchmark listing all processes\n\nUsage:\n benchmark_proc_get_all.py\n\"\"\"\n\nimport os\nMYDIR = os.path.dirname(os.path... | python | chosen |
[
{
"from": "system",
"value": "Add breakline to better reading\n"
},
{
"from": "human",
"value": "#!/bin/python\n\"\"\"\nreversebinary puzzle for Spotify.com\n\nv1\n\nJose Antonio Navarrete\n\nYou can find me at janavarretecristino@gmail.com\nFollow me on twitter @joseanavarrete\n\"\"\"\n\nimport... | python | chosen |
[
{
"from": "human",
"value": "Enable greenthreading for ec2api services\n\nSince ec2api and metadata services based on greenthreading, it have to\nbe initialized properly. This patch initializes it for cmd modules,\nwhich allows to debug services from IDE.\n\nChange-Id: Ic7ae69fbf5b58cfa4df822cd5d42f7c2cf45d... | python | chosen |
[
{
"from": "system",
"value": "Add functions to get/set variables addresses\n\nSince some of the jaz commands depend on the address of an variable,\nmade function to obtain it.\n"
},
{
"from": "human",
"value": "import uuid\nclass Scope:\n def __init__(self):\n self.pc = 0;\n sel... | python | chosen |
[
{
"from": "system",
"value": "Make metamodel factory methods and lang API available in textx package.\n"
},
{
"from": "human",
"value": "__version__ = \"1.6.dev\"\n"
},
{
"from": "gpt",
"value": "from textx.metamodel import metamodel_from_file, metamodel_from_str # noqa\nfrom textx.... | python | chosen |
[
{
"from": "system",
"value": "Add csv handling to module\n"
},
{
"from": "human",
"value": "\nfrom .connectors import (GithubConnector, S3Connector,\n FTPConnector, LocalConnector)\nfrom .transporters import (BaltradToS3, LocalToS3)\nfrom .s3enram import S3EnramHandler\nf... | python | chosen |
[
{
"from": "system",
"value": "BUG: Fix file URI in test (2nd attempt)\n"
},
{
"from": "human",
"value": "import os\n\nfrom numpy.testing import *\nimport numpy as np\n\nimport skimage.io as io\nfrom skimage import data_dir\n\n\ndef test_stack_basic():\n x = np.arange(12).reshape(3, 4)\n io... | python | chosen |
[
{
"from": "system",
"value": "Use source file with license 2\n"
},
{
"from": "human",
"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... | python | chosen |
[
{
"from": "system",
"value": "Fix the phone Column type\n"
},
{
"from": "human",
"value": "from datetime import datetime\nfrom sqlalchemy import Column, DateTime, Integer, Text, Boolean, Date\nfrom sqlalchemy.ext.declarative import declarative_base\nfrom sqlalchemy.orm import scoped_session, ses... | python | chosen |
[
{
"from": "system",
"value": "Remove tf_export from TraceMe Python API.\n\nPiperOrigin-RevId: 262247599\n"
},
{
"from": "human",
"value": "# Copyright 2019 The TensorFlow Authors. All Rights Reserved.\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may not use this... | python | chosen |
[
{
"from": "system",
"value": "Add in the first checkin date if it doesn't exist\n"
},
{
"from": "human",
"value": "# -*- coding: utf-8 -*-\nfrom __future__ import unicode_literals\n\nfrom django.db import models, migrations\n\n\nclass Migration(migrations.Migration):\n\n dependencies = [\n ... | python | chosen |
[
{
"from": "system",
"value": "Update pip deploy script to use twine\n"
},
{
"from": "human",
"value": "import subprocess\r\n\r\nsubprocess.call('python setup.py sdist')\r\nsubprocess.call('python setup.py sdist bdist_wheel upload')\r\n"
},
{
"from": "gpt",
"value": "import subprocess... | python | chosen |
[
{
"from": "system",
"value": "Fix author_email UNKNOWN in pip show\n\nSigned-off-by: Fabio Utzig <66676b1ceaf93296e098708c09494361103aa635@apache.org>\n"
},
{
"from": "human",
"value": "import setuptools\nfrom imgtool import imgtool_version\n\nsetuptools.setup(\n name=\"imgtool\",\n versio... | python | chosen |
[
{
"from": "system",
"value": "Switch home page to reg/home\n"
},
{
"from": "human",
"value": "from django.conf.urls import include, url\nfrom django.contrib import admin\nfrom django.contrib.auth import views\nfrom django.http import HttpResponseRedirect\n\nurlpatterns = [\n url(r'^$', lambda... | python | chosen |
[
{
"from": "system",
"value": "Check for changed files from webhook\n\nPrevents uploading everything, only the changed assets\n"
},
{
"from": "human",
"value": "\"\"\"updates subreddit css with compiled sass\"\"\"\nimport time\n\nimport sass\nimport praw\n\n\ndef css() -> str:\n \"\"\"compiles... | python | chosen |
[
{
"from": "system",
"value": "Fix functionaltests (imported tempest code has changed)\n\nget_auth_provider now takes an argument.\n\nChange-Id: I4a80ef3fdf2914854268459cf1080a46922e93d5\n"
},
{
"from": "human",
"value": "# -*- coding: utf-8 -*-\n#\n# Copyright 2013 - Noorul Islam K M\n#\n# Licen... | python | chosen |
[
{
"from": "system",
"value": "Add provision to pass extra args in auth url\n"
},
{
"from": "human",
"value": "from requests_oauthlib import OAuth2Session\n\n\nclass Session(OAuth2Session):\n\n client_id = None\n client_secret = None\n\n def __init__(self, subdomain, **kwargs):\n ... | python | chosen |
[
{
"from": "system",
"value": "Revert \"pass 'user_email' on sendRecoveryToken's context\"\n\nThis info is already sent as 'email' on context. This reverts commit a366c2ed02cd7dda54607fe5e6a317603d442b47.\n"
},
{
"from": "human",
"value": "from ovp_core.emails import BaseMail\n\nclass UserMail(Ba... | python | chosen |
[
{
"from": "system",
"value": "Add classical_transport to init file\n"
},
{
"from": "human",
"value": "# 'physics' is a tentative name for this subpackage. Another\n# possibility is 'plasma'. The organization is to be decided by v0.1.\n\nfrom .parameters import Alfven_speed, ion_sound_speed, th... | python | chosen |
[
{
"from": "system",
"value": "Fix broken registration test to handle new DeprecatedEnv error\n"
},
{
"from": "human",
"value": "# -*- coding: utf-8 -*-\nfrom gym import error, envs\nfrom gym.envs import registration\nfrom gym.envs.classic_control import cartpole\n\ndef test_make():\n env = en... | python | chosen |
[
{
"from": "system",
"value": "Add test when rule with inactive is passed\n"
},
{
"from": "human",
"value": "#!/usr/bin/env python\n\"\"\"\n:Author Patrik Valkovic\n:Created 23.06.2017 16:39\n:Licence GNUv3\nPart of grammpy\n\n\"\"\"\n\nfrom unittest import main, TestCase\nfrom grammpy import Gra... | python | chosen |
[
{
"from": "system",
"value": "Remove mention of Traits (removed in e1ced0b3)\n"
},
{
"from": "human",
"value": "# encoding: utf-8\n\"\"\"A fancy version of Python's builtin :func:`dir` function.\n\"\"\"\n\n#-----------------------------------------------------------------------------\n# Copyrig... | python | chosen |
[
{
"from": "system",
"value": "Remove \"-y\" flag from apt-get upgrade\n"
},
{
"from": "human",
"value": "from fabric.api import *\nimport subprocess\n\n__all__ = ['ssh', 'all', 'uptime', 'upgrade', 'restart']\n\n@task\ndef all():\n \"\"\"\n Select all hosts\n \"\"\"\n env.hosts = []\... | python | chosen |
[
{
"from": "system",
"value": "Fix wrong naming in generate...py\n\nSigned-off-by: Fabio Benigno <7de248c2f6c04081ad3a3569b5954b1b677fee3b@gmail.com>\n"
},
{
"from": "human",
"value": "#!/usr/bin/env python3\n\n\nimport sys\nfrom message import Message\nfrom persistence import Persistence\nfrom c... | python | chosen |
[
{
"from": "system",
"value": "Load initial fixture for the welcome email.\n\nhttps://github.com/madewithbytes/us_ignite/issues/172\n"
},
{
"from": "human",
"value": "from django.core.management.base import BaseCommand\n\nfrom us_ignite.snippets.models import Snippet\n\n\nFIXTURES = [\n {\n ... | python | chosen |
[
{
"from": "system",
"value": "Add complete field to task and timesheet api\n"
},
{
"from": "human",
"value": "# -*- coding: utf-8 -*-\nfrom __future__ import unicode_literals\n\nfrom django.contrib.auth.models import User\n\nfrom rest_framework import serializers\n\nfrom core.models import Times... | python | chosen |
[
{
"from": "system",
"value": "Test short_name for user name attributes callback\n"
},
{
"from": "human",
"value": "from django.test import TestCase\n\nfrom .factories import UserFactory\nfrom mama_cas.callbacks import user_model_attributes\nfrom mama_cas.callbacks import user_name_attributes\n\n... | python | chosen |
[
{
"from": "system",
"value": "Introduce scope_types in FIP pools\n\nAppropriate scope_type for nova case:\n- https://specs.openstack.org/openstack/nova-specs/specs/ussuri/approved/policy-defaults-refresh.html#scope\n\nThis commit introduce scope_type for FIP pools policies\nas 'system' and 'project'\n\nPart... | python | chosen |
[
{
"from": "system",
"value": "Add tests for python device\n"
},
{
"from": "human",
"value": "import pytest\n\nimport xchainer\n\n\ndef test_device():\n device = xchainer.get_current_device()\n\n xchainer.set_current_device('cpu')\n assert str(xchainer.get_current_device()) == '<Device c... | python | chosen |
[
{
"from": "system",
"value": "[FIX] Delete empty \" \" spaces in same string line\n"
},
{
"from": "human",
"value": "# Copyright 2015 AvanzOsc (http://www.avanzosc.es)\n# Copyright 2015-2017 Tecnativa - Pedro M. Baeza\n# Copyright 2018 Tecnativa - Carlos Dauden\n# License AGPL-3.0 or later (http... | python | chosen |
[
{
"from": "system",
"value": "Define new abstract methods and namedtuple\n"
},
{
"from": "human",
"value": "from abc import ABCMeta, abstractmethod\n\nimport requests\n\nfrom bs4 import BeautifulSoup\n\n\ndef make_soup(url):\n\t\tresponse = requests.get(url)\n\t\tsoup = BeautifulSoup(response.te... | python | chosen |
[
{
"from": "system",
"value": "Improve the way snakefile loading works\n"
},
{
"from": "human",
"value": "import os\nimport sys\n\nfrom snake.core import Snake\n\n\nSNAKEFILE_LOADED = False\n\n\ndef abort(msg):\n print >> sys.stderr, \"Error: %s\" % msg\n sys.exit(1)\n\n\ndef load_snakefile... | python | chosen |
[
{
"from": "system",
"value": "Add Waldo joke and simplify HAL joke\n"
},
{
"from": "human",
"value": "import re\n\nfrom pal.services.service import Service\nfrom pal.services.service import wrap_response\n\n\nclass JokeService(Service):\n _JOKES = {\n 'open the pod bay doors pal':\n ... | python | chosen |
[
{
"from": "system",
"value": "Set emitter format json in api\n"
},
{
"from": "human",
"value": "#!/usr/bin/env python\n# -*- coding: utf-8 -*-\nfrom django.conf.urls import patterns, url\n\nfrom piston.resource import Resource\n\nfrom opps.containers.api import ContainerHandler, ContainerBoxHand... | python | chosen |
[
{
"from": "system",
"value": "Fix path to data file\n"
},
{
"from": "human",
"value": "from __future__ import division\nimport time\nimport serial\nimport csv\nfrom datetime import datetime as dt\n\nDEBUG = True\n\n\ndef timestamp():\n ts = dt.now()\n return time.mktime(ts.timetuple())+(ts... | python | chosen |
[
{
"from": "system",
"value": "Check Python version at startup\n"
},
{
"from": "human",
"value": "from .v4.base import *\nfrom .v4.primitive_generators import *\nfrom .v4.derived_generators import *\nfrom .v4.dispatch_generators import *\nfrom .v4.custom_generator import CustomGenerator\nfrom .v4... | python | chosen |
[
{
"from": "system",
"value": "Store the duplicated items separately in related folder\n"
},
{
"from": "human",
"value": "#!/usr/bin/env python3\n# utility.py\n# PixPack Photo Organiser\n# It contains some useful functions to increase user experience\n\nimport locale\nimport os\n\n\ndef sys_trans... | python | chosen |
[
{
"from": "system",
"value": "Update IP address of kafka consumer\n"
},
{
"from": "human",
"value": "#!/usr/bin/env python\nimport threading, logging, time\n\nfrom kafka import KafkaConsumer\n\n\nclass Consumer(threading.Thread):\n daemon = True\n\n def run(self):\n #consumer = Kafk... | python | chosen |
[
{
"from": "system",
"value": "Remove create device step (not needed?)\n"
},
{
"from": "human",
"value": "from flow import Flow\nimport logging\n\nfrom . import settings\n\nLOG = logging.getLogger(\"flowbot.server\")\n\n\nclass Server(object):\n \"\"\"A connection to Flow.\"\"\"\n\n def __i... | python | chosen |
[
{
"from": "system",
"value": "Make output format configurable (simple, pprint, json, yaml)\n\n$ pylint django-extensions/django_extensions/management/commands/print_settings.py | grep rated\nNo config file found, using default configuration\nYour code has been rated at 10.00/10 (previous run: 10.00/10)\n"
... | python | chosen |
[
{
"from": "system",
"value": "Add max length to comment field"
},
{
"from": "human",
"value": "from django import forms\nfrom django.utils.translation import gettext_lazy as _\n\nfrom django_comments.forms import (\n CommentForm as DjangoCommentForm,\n COMMENT_MAX_LENGTH\n)\n\n\nclass Comm... | python | chosen |
[
{
"from": "system",
"value": "Add retry on timeout option to sentinel connection\n"
},
{
"from": "human",
"value": "from redis import sentinel, StrictRedis\n\n\nclass Sentinel(object):\n\n def __init__(self, app=None):\n self.app = app\n self.master = StrictRedis()\n self... | python | chosen |
[
{
"from": "system",
"value": "Disable New Relic's apdex metric on non-fetch_snippets views.\n\nNew Relic doesn't allow us to set different thresholds for different\npages across the site, so in order to get valuable metrics on the main\nview for snippets, fetch_snippets, we need to disable apdex for the\nad... | python | chosen |
[
{
"from": "system",
"value": "Set default scopes to read\n"
},
{
"from": "human",
"value": "from __future__ import absolute_import\n\nfrom django.core.urlresolvers import reverse\nfrom django.http import HttpResponseRedirect\n\nfrom sentry.models import ApiKey, OrganizationMemberType\nfrom sentr... | python | chosen |
[
{
"from": "system",
"value": "Add history columns `start_date` and `end_date` to edx builtin packages\n"
},
{
"from": "human",
"value": "# -*- coding: utf-8 -*-\nfrom __future__ import unicode_literals\n\nfrom django.db import migrations, connection\n\n#TODO: find a more better way of handling h... | python | chosen |
[
{
"from": "system",
"value": "Add \"LLP\" to company cruft\n"
},
{
"from": "human",
"value": "import re\n\nnon_alphanumeric = re.compile(r\"[^0-9a-z]+\", re.I)\n\nnon_namey = re.compile(r\"[^\\w\\-' ]+\", re.UNICODE)\n\ncomma_suffix = re.compile(r\", *(JR|SR|I+|IV|VI*)\\b\")\n\nlast_first = re.c... | python | chosen |
[
{
"from": "system",
"value": "Add routine for loading deps from a script.\n"
},
{
"from": "human",
"value": "import sys\nimport tokenize\n\n\ndef run(cmdline):\n\t\"\"\"\n\tExecute the script as if it had been invoked naturally.\n\t\"\"\"\n\tnamespace = dict()\n\tfilename = cmdline[0]\n\tnamespa... | python | chosen |
[
{
"from": "system",
"value": "Make service info available on v3 API\n"
},
{
"from": "human",
"value": "from django.conf.urls import include, url\n\nfrom normandy.base import views\nfrom normandy.base.api import views as api_views\nfrom normandy.base.api.routers import MixedViewRouter\n\n\n# API ... | python | chosen |
[
{
"from": "system",
"value": "Tag sentry event with each part of path\n"
},
{
"from": "human",
"value": "from django.views import defaults\nfrom sentry_sdk import capture_message, push_scope\n\n\ndef page_not_found(request, *args, **kwargs):\n with push_scope() as scope:\n scope.set_ta... | python | chosen |
[
{
"from": "system",
"value": "Refactor test harness file discovery\n"
},
{
"from": "human",
"value": "import unittest\n\nimport glob\nimport os\n\nimport mmstats\n\n\nclass MmstatsTestCase(unittest.TestCase):\n def setUp(self):\n super(MmstatsTestCase, self).setUp()\n self.path ... | python | chosen |
[
{
"from": "system",
"value": "Add compatibility with django < 1.7\n"
},
{
"from": "human",
"value": "from django.conf.urls import include, url\nfrom django.contrib import admin\n\nfrom . import views\n\n\nurlpatterns = [\n url(r'^admin/', include(admin.site.urls)),\n url('foo/', views.MyVi... | python | chosen |
[
{
"from": "system",
"value": "Fix sandboax builds, because of signal chains, UserProfile table must be predent before adding a User\n"
},
{
"from": "human",
"value": "# -*- coding: utf-8 -*-\n\n\nfrom django.conf import settings\nfrom django.contrib.auth import get_user_model\nfrom django.contri... | python | chosen |
[
{
"from": "system",
"value": "Change the config dictionary key validation\n"
},
{
"from": "human",
"value": "#!/usr/bin/python3\n\nimport subprocess\nimport os\nfrom time import sleep\n\nenv = {}\nHOME = os.environ.get(\"HOME\", \"/root\")\nscannerConf = open(HOME+\"/scanner.conf\", \"rt\")\nwhi... | python | chosen |
[
{
"from": "system",
"value": "Fix test for storing article without any content\n"
},
{
"from": "human",
"value": "from django.contrib.auth.models import User\nfrom django.test import TestCase, override_settings, Client\nfrom django.test import RequestFactory\nfrom mock import MagicMock\nfrom wag... | python | chosen |
[
{
"from": "system",
"value": "Fix to API Update to allow PATCH\n"
},
{
"from": "human",
"value": "from reddit.models import Blog\n\nfrom rest_framework import serializers\n\n\nclass BlogSerializer(serializers.Serializer):\n blog_id = serializers.UUIDField()\n created_at = serializers.DateT... | python | chosen |
[
{
"from": "system",
"value": "Switch from development to actual data.\n"
},
{
"from": "human",
"value": "#!/usr/bin/env python\nimport json, os, requests\nfrom awsauth import S3Auth\nfrom datetime import datetime\nfrom pytz import timezone\nfrom flask import Flask, render_template, url_for\n\nap... | python | chosen |
[
{
"from": "system",
"value": "Fix to the order of py and pyc in the regex\n"
},
{
"from": "human",
"value": "from ConfigParser import ConfigParser\nfrom environment import ENV\nimport sys\nimport os\nimport re\n\ndef get_config(environment):\n config_dir = \"%s/%s\" % (re.sub('configuration\\... | python | chosen |
[
{
"from": "system",
"value": "Use join_on_invite as @event decorator example\n"
},
{
"from": "human",
"value": "class InviteJoinPlugin(object):\n \"\"\"Simple plugin that joins a channel if an invite is given.\"\"\"\n\n callback_id = None\n \"\"\"ID generated when callback was added for... | python | chosen |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.