conversations listlengths 2 3 | source stringclasses 1
value | stack stringclasses 1
value |
|---|---|---|
[
{
"from": "system",
"value": "Add an 'installed_location()' function so syweb can report its own location\n"
},
{
"from": "human",
"value": "import os\n\nwith open(os.path.join(os.path.dirname(__file__), \"webclient/VERSION\")) as f:\n __version__ = f.read().strip()\n"
},
{
"from": "g... | python | chosen |
[
{
"from": "system",
"value": "Use do_actions() instead of do() in WorkerRushBot\n"
},
{
"from": "human",
"value": "import sc2\nfrom sc2 import run_game, maps, Race, Difficulty\nfrom sc2.player import Bot, Computer\n\nclass WorkerRushBot(sc2.BotAI):\n async def on_step(self, iteration):\n ... | python | chosen |
[
{
"from": "system",
"value": "Add SciPy version to pytest header\n"
},
{
"from": "human",
"value": "\nimport numba\nimport numpy\nimport pkg_resources\nimport pytest\n\n\n# The first version of numpy that broke backwards compat and improved printing.\n#\n# We set the printing format to legacy to... | python | chosen |
[
{
"from": "system",
"value": "Add Virtualbox's/Vagrant's IP to Internal IP\n"
},
{
"from": "human",
"value": "# -*- coding: utf-8 -*-\n'''\nLocal Configurations\n\n- Runs in Debug mode\n- Uses console backend for emails\n- Use Django Debug Toolbar\n'''\nfrom configurations import values\nfrom .c... | python | chosen |
[
{
"from": "system",
"value": "Mark resuable uploads as broken if they are\n"
},
{
"from": "human",
"value": "\nimport logging\nLOGGER = logging.getLogger('apps.uploads')\n\nfrom django.core.management.base import BaseCommand, CommandError\nfrom apps.uploads.models import DropboxUploadFile, Manua... | python | chosen |
[
{
"from": "system",
"value": "BUG: Fix a bug introduced in rebasing\n"
},
{
"from": "human",
"value": "\"\"\"Test the 20news downloader, if the data is available.\"\"\"\nimport numpy as np\nfrom nose.tools import assert_equal\nfrom nose.tools import assert_true\nfrom nose.plugins.skip import Ski... | python | chosen |
[
{
"from": "system",
"value": "Move pyclamav import inside of clean method on RWValidatedFileField so that it doesn't get imported by streamscript or unless as needed for field validation\n"
},
{
"from": "human",
"value": "from django.forms import forms\nfrom south.modelsinspector import add_intr... | python | chosen |
[
{
"from": "system",
"value": "Disable check for .gcode file extension when preprocessing gcode.\n"
},
{
"from": "human",
"value": "\"\"\"\nAn interface that all future preprocessors should inherit from\n\"\"\"\n\nimport os\nimport re\n\nfrom errors import *\nfrom .. import Gcode\n\nclass Preproc... | python | chosen |
[
{
"from": "system",
"value": "Prepare for next development iteration\n"
},
{
"from": "human",
"value": "# -*- coding: utf-8 -*-\n__version__ = '1.0.2'\n__all__ = ['ApplicationMaster', 'HistoryServer', 'NodeManager', 'ResourceManager']\n\nfrom .application_master import ApplicationMaster\nfrom .h... | python | chosen |
[
{
"from": "system",
"value": "Add RESULT_M and RESULT_B to environment varaible [ci skip]\n"
},
{
"from": "human",
"value": "#/usr/bin/python\n\n\"\"\" Baseline example that needs to be beaten \"\"\"\n\nimport numpy as np\nimport matplotlib.pyplot as plt\n\nx, y, yerr = np.loadtxt(\"data/data.tx... | python | chosen |
[
{
"from": "system",
"value": "Remove Django 1.8/1.9 warnings; much better supported now.\n"
},
{
"from": "human",
"value": "# django-salesforce\n#\n# by Phil Christensen\n# (c) 2012-2013 Freelancers Union (http://www.freelancersunion.org)\n# See LICENSE.md for details\n#\n\n\"\"\"\nA database ba... | python | chosen |
[
{
"from": "system",
"value": "Fix custom widget to raise correct exception type.\n"
},
{
"from": "human",
"value": "\"\"\"\nGeneral purpose formish extensions.\n\"\"\"\n\nfrom formish import validation, widgets, Form\n\n\nclass DateParts(widgets.DateParts):\n\n def __init__(self, **k):\n ... | python | chosen |
[
{
"from": "human",
"value": "Add decorator for timing functions\n"
},
{
"from": "gpt",
"value": "import time\n\ndef time_func(f):\n def wrap(*args, **kwargs):\n time1 = time.time()\n ret = f(*args, **kwargs)\n time2 = time.time()\n print '%s function took %0.3f ms'... | python | chosen |
[
{
"from": "system",
"value": "Support enabling tsan and ubsan from Xcode UI\n\nXcode won't let you enable ubsan from the UI as it requires a\n'Compile Sources' phase with (Objective-)C(++) sources, but if you\nmanually edit the scheme and enable it or equivalently add the phase\nwith a dummy file, enable it... | python | chosen |
[
{
"from": "system",
"value": "Add restriction for specialization string in db\n"
},
{
"from": "human",
"value": "from storage.models.base import *\n\n\nclass Fighter(Base):\n __tablename__ = 'fighters'\n\n id = Column(Integer, primary_key=True)\n ref = Column(String(STR_SIZE), unique=Tr... | python | chosen |
[
{
"from": "system",
"value": "Automate transfers: archivesspace example checks if output file already exists\n\nCheck if archivesspaceids.csv already exists (presumably user provided). Do\nnot generate one automatically in that case.\n"
},
{
"from": "human",
"value": "#!/usr/bin/env python\n\nfr... | python | chosen |
[
{
"from": "system",
"value": "Return a sane error if there is no Nodes with that name instead of IndexError\n"
},
{
"from": "human",
"value": "from lib.softlayer import SoftlayerBaseAction\n\n\nclass SoftlayerDeleteInstance(SoftlayerBaseAction):\n def run(self, name):\n driver = self._... | python | chosen |
[
{
"from": "system",
"value": "Add _assert_eq_nan to compare arrays that have NaN\n\nAs comparisons with NaN are false even if both values are NaN, using the\n`assert_eq` does not work correctly in this case. To fix it, we add this\nshim function around `assert_eq`. First we verify that they have the\nsame N... | python | chosen |
[
{
"from": "system",
"value": "Refactor image open to with block\n"
},
{
"from": "human",
"value": "#!/usr/local/bin/python3\n# Python Challenge - 22\n# http://www.pythonchallenge.com/pc/hex/copper.html\n# http://www.pythonchallenge.com/pc/hex/white.gif\n# Username: butter; Password: fly\n# Keywo... | python | chosen |
[
{
"from": "system",
"value": "Doc: Add ignore info for secret-key env-test\n"
},
{
"from": "human",
"value": "import logging\n\nfrom .base import *\n\n\n# SECURITY WARNING: keep the secret key used in production secret!\nif 'SECRET_KEY' not in os.environ:\n logging.warning(\n \"No SECR... | python | chosen |
[
{
"from": "system",
"value": "Fix grammar in doc comments\n"
},
{
"from": "human",
"value": "# -*- coding: utf-8 -*-\n\nfrom app import create_app, db\n\napp = create_app('development')\n\n\n@app.cli.command()\ndef test():\n \"\"\"Run the unit tests.\"\"\"\n import unittest\n tests = un... | python | chosen |
[
{
"from": "system",
"value": "Update distutils version to 0.3.3"
},
{
"from": "human",
"value": "CLASSIFIERS = \"\"\"\\\nDevelopment Status :: 3 - Alpha\nIntended Audience :: Science/Research\nIntended Audience :: Developers\nLicense :: OSI Approved\nProgramming Language :: Python\nTopic :: Soft... | python | chosen |
[
{
"from": "system",
"value": "Add two more fields to StatsBase\n"
},
{
"from": "human",
"value": "# -*- coding: utf-8 -*-\nfrom __future__ import absolute_import, unicode_literals\n\nfrom django.db import models\nfrom django.utils.encoding import python_2_unicode_compatible\n\n\n@python_2_unicod... | python | chosen |
[
{
"from": "system",
"value": "Add property status in Prepare\n"
},
{
"from": "human",
"value": "\n\nclass Prepare(object):\n \"\"\"\n Prepare the champions for the battle!\n\n Usage:\n hero = Prepare(name=\"Aragorn\", base_attack=100, base_hp=100)\n or like this:\n arag... | python | chosen |
[
{
"from": "system",
"value": "Include randomized string for secret key\n"
},
{
"from": "human",
"value": "import os\n\n# Grabs the folder where the script runs.\nbasedir = os.path.abspath(os.path.dirname(__file__))\n\n# Enable debug mode.\nDEBUG = True\n\n# Secret key for session management. You... | python | chosen |
[
{
"from": "system",
"value": "Set research level in ticker\n"
},
{
"from": "human",
"value": "\"\"\"Process queues.\"\"\"\nfrom datetime import datetime\n\nfrom server.extensions import db\nfrom server.models import QueueEntry\n\n\ndef finished_entries():\n \"\"\"Process finished entries.\"\"... | python | chosen |
[
{
"from": "system",
"value": "Change location of development data file.\n"
},
{
"from": "human",
"value": "import os\nROOT_DIR = os.path.dirname(os.path.realpath(__file__))\n\nclass BaseConfig(object):\n DEBUG = False\n TESTING = False\n FREEZER_REMOVE_EXTRA_FILES = True\n\n FREEZER_... | python | chosen |
[
{
"from": "system",
"value": "Add a TDD funct to test the solution (only kings)"
},
{
"from": "human",
"value": "# -*- coding: utf-8 -*-\n\n\nfrom app.chess.chess import Chess\nimport unittest\n\n\nclass TestBuildChess(unittest.TestCase):\n \"\"\"\n `TestBuildChess()` class is unit-testing... | python | chosen |
[
{
"from": "system",
"value": "Bump version to beta 3\n\n"
},
{
"from": "human",
"value": "# Copyright (C) 2010, 2011 Linaro Limited\n#\n# Author: Zygmunt Krynicki <zygmunt.krynicki@linaro.org>\n#\n# This file is part of LAVA Server.\n#\n# LAVA Server is free software: you can redistribute it and... | python | chosen |
[
{
"from": "system",
"value": "Handle OPTION requests for generate\n\nJust return nothing. Chrome seems to be happy with that response.\n"
},
{
"from": "human",
"value": "#!/usr/bin/env python3\n# -*- coding: utf-8 -*-\n\nfrom flask import Flask, request, json\nfrom flask.ext.cors import CORS\nim... | python | chosen |
[
{
"from": "system",
"value": "Revert to debug=false for deployment\n"
},
{
"from": "human",
"value": "\"\"\"Development settings and globals.\"\"\"\n\n\nfrom common import *\nimport dj_database_url\n\n########## DEBUG CONFIGURATION\nDEBUG = True\nTEMPLATE_DEBUG = DEBUG\n########## END DEBUG CONF... | python | chosen |
[
{
"from": "system",
"value": "Add a deprecation message to the docstring of image_bytes()\n"
},
{
"from": "human",
"value": "\"\"\"\nFunctions for displaying images inline in iTerm2.\n\nSee https://iterm2.com/images.html.\n\"\"\"\nfrom __future__ import print_function, division, absolute_import\... | python | chosen |
[
{
"from": "system",
"value": "Simplify deprecation machinery: don't cache previous messages, and use warnings instead of logging.\n"
},
{
"from": "human",
"value": "\"\"\" A decorator for marking methods/functions as deprecated. \"\"\"\n\n\n# Standard library imports.\nimport logging\n\n# We onl... | python | chosen |
[
{
"from": "system",
"value": "Add ability to check is the Person in AddressBook or not\n"
},
{
"from": "human",
"value": "__all__ = ['AddressBook']\n\n\nclass AddressBook(object):\n\n def __init__(self):\n self.persons = []\n\n def add_person(self, person):\n self.persons.app... | python | chosen |
[
{
"from": "system",
"value": "Move all 'connect' logic into a private method\n"
},
{
"from": "human",
"value": "import socket\nimport sys\n\n\nclass SerfConnectionError(Exception):\n pass\n\n\nclass SerfConnection(object):\n \"\"\"\n Manages RPC communication to and from a Serf agent.\n... | python | chosen |
[
{
"from": "system",
"value": "[ATMO-1200] Add '?active=' filter for Maintenance Record\n"
},
{
"from": "human",
"value": "from rest_framework.serializers import ValidationError\n\nfrom core.models import MaintenanceRecord\n\nfrom api.permissions import CanEditOrReadOnly\nfrom api.v2.serializers.... | python | chosen |
[
{
"from": "system",
"value": "Remove lambda test. Add dask array tests.\n"
},
{
"from": "human",
"value": "from dask.distributed import dask_client_from_ipclient\n\ndef test_dask_client_from_ipclient():\n from IPython.parallel import Client\n c = Client()\n dc = dask_client_from_ipclien... | python | chosen |
[
{
"from": "system",
"value": "Append source path in WSGI mode.\n"
},
{
"from": "human",
"value": "\"\"\"\nWSGI config for openservices project.\n\nIt exposes the WSGI callable as a module-level variable named ``application``.\n\"\"\"\n\nimport os\n\nfrom django.core.wsgi import get_wsgi_applicat... | python | chosen |
[
{
"from": "system",
"value": "Remove commented-out line in testcase"
},
{
"from": "human",
"value": "from mpi4py import MPI\nimport mpiunittest as unittest\n\nclass GReqCtx(object):\n source = 1\n tag = 7\n completed = False\n free_called = False\n\n def query(self, status):\n ... | python | chosen |
[
{
"from": "system",
"value": "Add out directory to path to new sqlite lookup\n"
},
{
"from": "human",
"value": "from app.lookups import base as lookups\nfrom app.drivers.base import BaseDriver\n\n\nclass LookupDriver(BaseDriver):\n def __init__(self, **kwargs):\n super().__init__(**kwa... | python | chosen |
[
{
"from": "system",
"value": "Write a sensible (if post hoc) test.\n\nI had a hard time getting this test to fail so I could prove it works, but\nit's a simple test and its main purpose is to provide an example for\nlater tests, so I'm calling it Good Enough.\n"
},
{
"from": "human",
"value": "i... | python | chosen |
[
{
"from": "system",
"value": "Add a simple search controller which wraps around the Github code search API\n"
},
{
"from": "human",
"value": "import requests\nimport simplejson as json\n\nclass GithubSearch(object):\n def __init__(self):\n self.api_url = \"https://api.github.com/search... | python | chosen |
[
{
"from": "human",
"value": "Set the connection to Dropbox API\n"
},
{
"from": "gpt",
"value": "#!/usr/bin/python\n#lets import the dropbox module\nimport dropbox\n\n#taking the app key and secret \nkey=raw_input('Enter your app key : ')\nsecret=raw_input('Enter your app secret : ')\n#initializi... | python | chosen |
[
{
"from": "system",
"value": "Change tuple concatenation to be py3 compatible\n"
},
{
"from": "human",
"value": "# -*- coding: utf-8 -*-\nimport scipy.stats as ss\nimport numpy.random as npr\nfrom functools import partial\n\nfrom . import core\n\n\ndef npr_op(distribution, size, input):\n prn... | python | chosen |
[
{
"from": "system",
"value": "Move from python anywhere to webfaction\n"
},
{
"from": "human",
"value": "import datetime\nimport os\nimport requests\n\n\ndef update():\n requests.packages.urllib3.disable_warnings()\n resp = requests.get('http://api.tfl.gov.uk/Line/Mode/tube/Status').json()... | python | chosen |
[
{
"from": "system",
"value": "Add wos-only option to script\n"
},
{
"from": "human",
"value": "#!/usr/bin/env python3\nfrom parsers.wos import WOSStream\nfrom util.PajekFactory import PajekFactory\nfrom util.misc import open_file, Checkpoint\n\nif __name__ == \"__main__\":\n import argparse\n... | python | chosen |
[
{
"from": "system",
"value": "Attach app to SQLAlchemy properly\n"
},
{
"from": "human",
"value": "\"\"\" Database Module \"\"\"\n\nfrom flask_sqlalchemy import SQLAlchemy\ndb = SQLAlchemy()\n"
},
{
"from": "gpt",
"value": "\"\"\" Database Module \"\"\"\n\nfrom flask_sqlalchemy impor... | python | chosen |
[
{
"from": "system",
"value": "Add empty middleware setting to quiet warning\n\nBefore this change, starting a dev server would give this warning:\n\n```\nPerforming system checks...\n\nSystem check identified some issues:\n\nWARNINGS:\n?: (1_7.W001) MIDDLEWARE_CLASSES is not set.\n HINT: Django 1.7 c... | python | chosen |
[
{
"from": "system",
"value": "Remove pytest plugins from archiver\n"
},
{
"from": "human",
"value": "# -*- coding: utf-8 -*-\n\npytest_plugins = [\n u'ckan.tests.pytest_ckan.ckan_setup',\n u'ckan.tests.pytest_ckan.fixtures',\n]\n"
},
{
"from": "gpt",
"value": "# -*- coding: utf... | python | chosen |
[
{
"from": "system",
"value": "Allow for extra slashes in project paths, such as mq patch queues.\n"
},
{
"from": "human",
"value": "\n# Mimic the hggit extension.\ntry:\n from hggit import *\n hggit_reposetup = reposetup\nexcept ImportError:\n # Allow this module to be imported without\... | python | chosen |
[
{
"from": "system",
"value": "Allow to specify initial items on DictionaryObject constructor\n"
},
{
"from": "human",
"value": "class AttributeObject:\n def __init__(self, *excluded_keys):\n self._excluded_keys = excluded_keys\n\n def __getattr__(self, item):\n return self._g... | python | chosen |
[
{
"from": "system",
"value": "Fix get_rating in Book model\n"
},
{
"from": "human",
"value": "from django.db import models\n\nfrom apps.categories.models import Category\nfrom apps.users.models import UserProfile\nfrom apps.reviews.models import Review\n\n\nclass Book(models.Model):\n title =... | python | chosen |
[
{
"from": "system",
"value": "Fix up failing boilerplate test\n"
},
{
"from": "human",
"value": "#!/usr/bin/env python\n\n# Copyright 2016 The Kubernetes Authors.\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may not use this file except in compliance with the Li... | python | chosen |
[
{
"from": "system",
"value": "Use new plugin classes for management\n"
},
{
"from": "human",
"value": "\nfrom __future__ import absolute_import, print_function, unicode_literals\n\nfrom kolibri.plugins.base import KolibriFrontEndPluginBase\n\n\nclass ManagementModule(KolibriFrontEndPluginBase):\... | python | chosen |
[
{
"from": "system",
"value": "Update exception handling in LxmlParser\n\nSigned-off-by: Stein Magnus Jodal <e14d2e665cf0bcfd7f54daa10a36c228abaf843a@jodal.no>"
},
{
"from": "human",
"value": "#encoding: utf-8\n\nfrom lxml.html import parse, fromstring\n\nclass LxmlParser(object):\n def __init... | python | chosen |
[
{
"from": "system",
"value": "Fix CORS to allow for credentials\n\nSomething changed in the client code requiring this\nsetting.\n"
},
{
"from": "human",
"value": "import logging\nimport os\n\nimport flask\nimport flask_cors\nfrom sqlalchemy_jsonapi import flaskext as flask_jsonapi\n\nfrom swd6 ... | python | chosen |
[
{
"from": "system",
"value": "Fix path to API doc\n"
},
{
"from": "human",
"value": "# Lint as: python3\n# Copyright 2020 Google LLC. 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 License.\n... | python | chosen |
[
{
"from": "system",
"value": "Move configuration details to docs\n"
},
{
"from": "human",
"value": "\"\"\"\nhomeassistant.components.device_tracker.mqtt\n~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\n\nMQTT platform for the device tracker.\n\ndevice_tracker:\n platform: mqtt\n qos: 1\n device... | python | chosen |
[
{
"from": "system",
"value": "Add delete old sessions command\n"
},
{
"from": "human",
"value": "from datetime import datetime\n\nfrom django.core.management.base import BaseCommand\nfrom django.contrib.sessions.models import Session\n\n\"\"\"\n>>> def clean(count):\n... for idx, s in enumerat... | python | chosen |
[
{
"from": "system",
"value": "Add function to get files for playlist\n"
},
{
"from": "human",
"value": "import youtube_dl, os\nfrom multiprocessing.pool import ThreadPool\nfrom youtube_dl.utils import DownloadError\nfrom datetime import datetime\nfrom uuid import uuid4\n\n\nclass Download:\n ... | python | chosen |
[
{
"from": "system",
"value": "Set version to 1.2.3 release\n"
},
{
"from": "human",
"value": "__version_info__ = (1, 3, 0, 'dev')\n\n\n# Dot-connect all but the last. Last is dash-connected if not None.\n__version__ = '.'.join([str(i) for i in __version_info__[:-1]])\nif __version_info__[-1] is ... | python | chosen |
[
{
"from": "system",
"value": "Send third soh also to web users\n"
},
{
"from": "human",
"value": "from corehq.apps.locations.models import SQLLocation\nfrom corehq.apps.users.models import CommCareUser\nfrom custom.ewsghana.reminders.second_soh_reminder import SecondSOHReminder\n\n\nclass ThirdS... | python | chosen |
[
{
"from": "system",
"value": "Fix breakage: conversion of tf.data was allowed too soon and broke the autograph notebook.\n\nPiperOrigin-RevId: 250764059\n"
},
{
"from": "human",
"value": "# Copyright 2016 The TensorFlow Authors. All Rights Reserved.\n#\n# Licensed under the Apache License, Versi... | python | chosen |
[
{
"from": "system",
"value": "Fix flake8 error (too long line)\n"
},
{
"from": "human",
"value": "class DockerError(Exception):\n\n def __init__(self, status, data, *args):\n super().__init__(*args)\n self.status = status\n self.message = data['message']\n\n def __repr... | python | chosen |
[
{
"from": "system",
"value": "Create directory in case not exist"
},
{
"from": "human",
"value": "#! /usr/bin/python3\n\nimport win32gui\nfrom urllib.request import urlopen, urlretrieve\nfrom xml.dom import minidom\nfrom PIL import Image\nimport os\n\n\n#Variables:\nsaveDir = 'C:\\BingWallPaper\... | python | chosen |
[
{
"from": "system",
"value": "Refactor out the re. It's not necessary to regex the replacement of an explicitly checked string in an explicit location. This should be simpler.\n"
},
{
"from": "human",
"value": "import os\nimport re\n\ndef mkdir_p(path):\n if not os.path.exists(path):\n os.ma... | python | chosen |
[
{
"from": "system",
"value": "ADD MISSING FILE TO PREV COMMIT \"modify BMC plugin: overwrite URL for CC-BY license. We have a MORE specific URL (from the license statement on the BMC pages) than the Open Definition one\"\n"
},
{
"from": "human",
"value": "import requests\nfrom copy import deepco... | python | chosen |
[
{
"from": "system",
"value": "Add initialize() method to ShopifyAuth, which sets up the API key and secret of the app."
},
{
"from": "human",
"value": "VERSION = (0, 1, 0)\n__version__ = '.'.join(map(str, VERSION))\n__author__ = 'Gavin Ballard'"
},
{
"from": "gpt",
"value": "imp... | python | chosen |
[
{
"from": "system",
"value": "Set a seed for the simple neural network\n"
},
{
"from": "human",
"value": "# This code is inspired from this post:\n# http://www.kdnuggets.com/2015/10/neural-network-python-tutorial.html?utm_content=buffer2cfea&utm_medium=social&utm_source=twitter.com&utm_campaign=... | python | chosen |
[
{
"from": "system",
"value": "Use urljoin to form urls.\n"
},
{
"from": "human",
"value": "import json\nimport requests\n\nclass Client(object):\n\n LAUNCHPAD_URL = 'https://launchpad.37signals.com'\n BASE_URL = 'https://basecamp.com/%s/api/v1'\n\n def __init__(self, access_token, user_... | python | chosen |
[
{
"from": "system",
"value": "Add argument parser to allow for debug mode\n"
},
{
"from": "human",
"value": "\"\"\"This is the main function of twitter-news-bot project\n\nIt is intended to be run as a cronjob to periodically scan\nfor news of interest and Tweet about it\n\"\"\"\nimport random\n... | python | chosen |
[
{
"from": "system",
"value": "Reduce time window between posts to 3 hours\n"
},
{
"from": "human",
"value": "import json\nimport logging\nimport os\nimport subprocess\n\nfrom celery import Celery\nfrom celery.schedules import crontab\n\nfrom whistleblower.targets.twitter import Post as TwitterPo... | python | chosen |
[
{
"from": "system",
"value": "Update find owner to work with promises.\n"
},
{
"from": "human",
"value": "\"\"\"\nCommand that will allow for a user to inject triples into a database.\n\"\"\"\nfrom rhobot.components.commands.base_command import BaseCommand\nfrom rdflib.namespace import FOAF\nfro... | python | chosen |
[
{
"from": "system",
"value": "Print diff stats for each domain\n"
},
{
"from": "human",
"value": "from __future__ import absolute_import\nfrom __future__ import print_function\nfrom __future__ import unicode_literals\n\nfrom operator import attrgetter\n\nimport six\nfrom django.core.management.b... | python | chosen |
[
{
"from": "system",
"value": "Change double quotes to single.\n"
},
{
"from": "human",
"value": "from .base import *\n\nSITE_ID = 1\n\nDATABASES = {\n 'default': {\n 'ENGINE': 'django.db.backends.mysql',\n 'NAME': 'coda_local',\n 'USER': os.getenv('DB_MYSQL_USER', default... | python | chosen |
[
{
"from": "system",
"value": "Fix FAT constant for TI-83+\n"
},
{
"from": "human",
"value": "import os\nimport requests\nfrom sys import stderr, exit\nfrom resources import get_resource_root\n\ndef get_key(platform):\n if platform == \"TI73\": return 0x02\n if platform == \"TI83p\" or plat... | python | chosen |
[
{
"from": "system",
"value": "Allow base=PeriodicTask argument to task decorator\n"
},
{
"from": "human",
"value": "from celery.task.base import Task\nfrom celery.registry import tasks\nfrom inspect import getargspec\n\n\ndef task(**options):\n \"\"\"Make a task out of any callable.\n\n ... | python | chosen |
[
{
"from": "system",
"value": "Implement high def pictures for python tutorials.\n"
},
{
"from": "human",
"value": "#! /usr/bin/env python\n\nimport ROOT\nimport shutil\nimport os\n\ndef makeimage(MacroName, ImageName, OutDir, cp, py, batch):\n '''Generates the ImageName output of the macro Ma... | python | chosen |
[
{
"from": "system",
"value": "Add impl. of stop on obstacle"
},
{
"from": "human",
"value": "#!/usr/bin/env python\n\n# TODO is it necessary here?\nimport roslib; roslib.load_manifest('practica_turtlebot')\nimport rospy\n\nfrom driver import Driver\nfrom driver import Point\n\nif __name__ == '__... | python | chosen |
[
{
"from": "system",
"value": "Add setup method to base serf handler\n"
},
{
"from": "human",
"value": "import os\n\nfrom serf_master import SerfHandler\nfrom utils import with_payload, truncated_stdout\n\n\nclass BaseHandler(SerfHandler):\n\n @truncated_stdout\n @with_payload\n def wher... | python | chosen |
[
{
"from": "system",
"value": "Tag commit for v0.0.21-master generated by gitmake.py\n"
},
{
"from": "human",
"value": "major = 0\nminor=0\npatch=20\nbranch=\"master\"\ntimestamp=1376526219.94"
},
{
"from": "gpt",
"value": "major = 0\nminor=0\npatch=21\nbranch=\"master\"\ntimestamp=13... | python | chosen |
[
{
"from": "system",
"value": "Update summary to fix flake in website_snippet_data_slider\n"
},
{
"from": "human",
"value": "# -*- coding: utf-8 -*-\n# © 2016-TODAY LasLabs Inc.\n# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).\n\n{\n \"name\": \"Website Snippet - Data Slid... | python | chosen |
[
{
"from": "system",
"value": "Use proper settings for httpd server.\n"
},
{
"from": "human",
"value": "import http.server\nfrom threading import Thread\nimport os.path\n\n\nclass HTTPHandler:\n def __init__(self, config):\n self.config = config\n\n handler = HTTPHandler.make_htt... | python | chosen |
[
{
"from": "system",
"value": "Add an additional test for Venue model to cover all the factory cases.\n"
},
{
"from": "human",
"value": "\"\"\"\nThis file demonstrates writing tests using the unittest module. These will pass\nwhen you run \"./manage.py test --settings=workshopvenues.settings_test... | python | chosen |
[
{
"from": "system",
"value": "Remove import of Selenium RC\n"
},
{
"from": "human",
"value": "# Licensed to the Software Freedom Conservancy (SFC) under one\n# or more contributor license agreements. See the NOTICE file\n# distributed with this work for additional information\n# regarding copyr... | python | chosen |
[
{
"from": "system",
"value": "Add computation on energy and power (mean and total).\n"
},
{
"from": "human",
"value": "import numpy as np\n\ndef mean_energy(x_blocks):\n return np.sqrt(np.mean(x_blocks**2, axis=1))\n\nif __name__ == '__main__':\n\n import matplotlib.pyplot as plt\n from... | python | chosen |
[
{
"from": "system",
"value": "Change verbosity of testes. To fix travis\n"
},
{
"from": "human",
"value": "from settings import * # noqa\nimport os\n\n\nTEST_DISCOVER_ROOT = os.path.abspath(os.path.join(__file__, '../..'))\n\n# Comment this line for turn on debug on tests\nLOGGING = {}\nDEBUG =... | python | chosen |
[
{
"from": "system",
"value": "Fix receiving an error message for python2 & 3\n"
},
{
"from": "human",
"value": "# -*- coding: utf-8 -*-\n\nimport subprocess\n\nTYPE_WARN_MSG = 'WARNING! A string \"%s\" passed to a numeric variable. ' \\\n 'Change the variable type or the passed va... | python | chosen |
[
{
"from": "system",
"value": "Add nc and state as attributes. Change name of gpio_num to gpio\n"
},
{
"from": "human",
"value": "import RPi.GPIO as GPIO\n\n\nclass relay():\n def __init__(self, gpio_num, NC=False):\n self.gpio_num = gpio_num\n GPIO.setmode(GPIO.BCM)\n try... | python | chosen |
[
{
"from": "system",
"value": "Include the first bullet svg\n"
},
{
"from": "human",
"value": "#!/usr/bin/env python\n\nimport svgwrite\n\ndef main():\n print 'test'\n\nif __name__ == '__main__':\n main()\n"
},
{
"from": "gpt",
"value": "#!/usr/bin/env python\n\nimport sys\nimport s... | python | chosen |
[
{
"from": "system",
"value": "Fix range of values in example code\n"
},
{
"from": "human",
"value": "#!/usr/bin/env python\n\"\"\"Generate fixtures.\"\"\"\n\nimport os\nimport json\nimport numpy as np\nfrom scipy import special\n\n\n# Get the file path:\nFILE = os.path.realpath(__file__)\n\n# Ex... | python | chosen |
[
{
"from": "system",
"value": "Update preprocessor for 4.x: New imports and make it more robust\n"
},
{
"from": "human",
"value": "\"\"\"This preprocessor replaces Python code in markdowncell with the result\nstored in cell metadata\n\"\"\"\n\n#----------------------------------------------------... | python | chosen |
[
{
"from": "system",
"value": "Fix for a small bug\n"
},
{
"from": "human",
"value": "# Contains a lot of one-offs that aren't easy to deal with.\nimport logging\nimport Hand\ndef reset():\n global overload, resources, combo, turn, turnOffset, us, them, numMinions\n overload = 0\n resour... | python | chosen |
[
{
"from": "system",
"value": "Update integration test: docs, add more checks, rename\n"
},
{
"from": "human",
"value": "# -*- coding: utf-8 -*-\n'''\ntests for host state\n'''\n\n# Import Python libs\nfrom __future__ import absolute_import\n\n# Import Salt Testing libs\nfrom tests.support.case i... | python | chosen |
[
{
"from": "system",
"value": "Set the module as auto_install\n\nSo it installs when both sale_payment_method and sale_automatic_workflow are installed.\nThis module acts as the glue between them\n"
},
{
"from": "human",
"value": "# -*- coding: utf-8 -*-\n#########################################... | python | chosen |
[
{
"from": "system",
"value": "Remove Yices test from RPC prover test\n"
},
{
"from": "human",
"value": "from cryptol import cryptoltypes\nfrom cryptol.bitvector import BV\nimport saw\nfrom saw.proofscript import *\n\nimport unittest\nfrom pathlib import Path\n\n\ndef cry(exp):\n return crypto... | python | chosen |
[
{
"from": "system",
"value": "Fix typo: allargs -> allalgs. Add missing import of shuffle().\n"
},
{
"from": "human",
"value": "from lib.test_config import AUTH_CREDS as AUTH_CREDS_orig\n\nallargs = (('SHA-512-256', 'SHA-256', 'MD5', 'MD5-sess'), \\\n ('SHA-512-256', 'SHA-256', 'SHA-256-sess', ... | python | chosen |
[
{
"from": "system",
"value": "Change HostRoute to a plain model\n\nSince HostRoute doesn't have id, store it as a plain db model.\n\nChange-Id: I3dbb9e5ffa42bf48f47b7010ee6baf470b55e85e\nPartially-Implements: bp refactor-nb-api\n"
},
{
"from": "human",
"value": "# Licensed under the Apache Li... | python | chosen |
[
{
"from": "system",
"value": "Add example of date type in Python\n"
},
{
"from": "human",
"value": "# Many built-in types have built-in names\nassert(type(5) == int)\nassert(type(True) == bool)\nassert(type(5.7) == float)\nassert(type(9 + 5j) == complex)\nassert(type((8, 'dog', False)) == tuple)... | python | chosen |
[
{
"from": "system",
"value": "Fix python 2 error when dumping expected test results\n"
},
{
"from": "human",
"value": "from __future__ import print_function, absolute_import\n\nimport json\nimport os\nimport sys\nfrom imp import reload\nfrom io import StringIO\n\nimport pytest\nimport yaml\n\nfr... | python | chosen |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.