conversations
listlengths
2
3
source
stringclasses
1 value
stack
stringclasses
1 value
[ { "from": "system", "value": "Fix flake8 indentation issues with classifiers\n" }, { "from": "human", "value": "#!/usr/bin/env python\n\n# Copyright 2011 Andrew Ryrie (amr66)\n\nfrom distutils.core import setup\n\nsetup(name='django-pyroven',\n description='A Django authentication backend f...
python
chosen
[ { "from": "system", "value": "Add click and click-plugins dependencies\n" }, { "from": "human", "value": "from setuptools import setup\n\nurl = \"\"\nversion = \"0.1.0\"\nreadme = open('README.rst').read()\n\nsetup(\n name=\"dtool-create\",\n packages=[\"dtool_create\"],\n version=versi...
python
chosen
[ { "from": "system", "value": "Update package\npip install hackr\n" }, { "from": "human", "value": "from setuptools import setup, find_packages\n\nwith open('requirements.txt') as f:\n required = f.read().splitlines()\n\nsetup(name='hackr',\n\n version='0.1.1',\n\n url='https://githu...
python
chosen
[ { "from": "system", "value": "Remove obsolete requirement of pyexiv2.\n" }, { "from": "human", "value": "#! /usr/bin/python\n\nfrom distutils.core import setup\ntry:\n from distutils.command.build_py import build_py_2to3 as build_py\nexcept ImportError:\n # Python 2.x\n from distutils.c...
python
chosen
[ { "from": "system", "value": "Add python_Requires, per @davidfischer suggestion\n" }, { "from": "human", "value": "import os\nimport codecs\n#from distutils.core import setup\nfrom setuptools import setup\n\ndef read(fname):\n return open(os.path.join(os.path.dirname(__file__), fname)).read()...
python
chosen
[ { "from": "system", "value": "Remove wrong directory and let it build\n" }, { "from": "human", "value": "from setuptools import setup\n\nsetup(\n name='ploodood',\n version='0.1',\n description='Generates words that \"sound like real words\"',\n author = 'Matteo Giordano',\n autho...
python
chosen
[ { "from": "system", "value": "Fix the require Python version\n" }, { "from": "human", "value": "#!/usr/bin/python\n# -*-coding:UTF-8 -*-\n\nfrom setuptools import setup, find_packages\nfrom os import path\nimport sys\n\nif sys.version_info[0] >= 3:\n install_requires = [\"PyMySQL\"]\nelse:\n ...
python
chosen
[ { "from": "system", "value": "Use find_packages instead of manually specifying modules." }, { "from": "human", "value": "#!/usr/bin/env python\nfrom setuptools import setup\n\nsetup(\n name='asset_bender',\n version='0.1.5',\n description=\"A django runtime implementation for Asset Bend...
python
chosen
[ { "from": "system", "value": "Add a description for PyPI\n" }, { "from": "human", "value": "from setuptools import setup\n\nsetup(name='biosignal',\n version='0.0.1',\n description='',\n url='http://github.com/EmlynC/python-biosignal',\n author='Emlyn Clay',\n author_ema...
python
chosen
[ { "from": "system", "value": "Comment the new library requirement\n" }, { "from": "human", "value": "\"\"\"Mailmerge build and install configuration.\"\"\"\nimport os\n\ntry:\n from setuptools import setup\nexcept ImportError:\n from distutils.core import setup\n\nwith open(os.path.join(os...
python
chosen
[ { "from": "system", "value": "Use long description from README.md\n" }, { "from": "human", "value": "\"\"\"\nFlask-CacheControl\n------------------\n\nA light-weight library to conveniently set Cache-Control\nheaders on the response. Decorate view functions with\ncache_for, cache, or dont_cache ...
python
chosen
[ { "from": "system", "value": "Allow specifying test.py flags in 'inv test'\n" }, { "from": "human", "value": "from os import mkdir\nfrom os.path import join\nfrom shutil import rmtree, copytree\n\nfrom invoke import Collection, ctask as task\nfrom invocations.docs import docs, www\nfrom invocati...
python
chosen
[ { "from": "system", "value": "Fix vx.expose to not crash when None,None is passed\n\nAlso reformat it using functools.partial\n" }, { "from": "human", "value": "import vx\n\ndef _expose(f=None, name=None):\n if name is None:\n name = f.__name__.lstrip('_')\n if getattr(vx, name, Non...
python
chosen
[ { "from": "system", "value": "Correct github URL for chessmoves module\n" }, { "from": "human", "value": "\nimport chessmoves # Source: https://github.com/kervinck/floyd.git\nimport floyd as engine\nimport sys\n\ndef parseEpd(rawLine):\n\n # 4-field FEN\n line = rawLine.strip().spl...
python
chosen
[ { "from": "system", "value": "Use 'diff_base' for pycodestyle check, if set.\n\nSpeeds it up, plus reduces spew when testing locally.\n" }, { "from": "human", "value": "# Copyright 2016 Google Inc.\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may not use this fi...
python
chosen
[ { "from": "system", "value": "Delete the related ColumnElement when a BlogCategory is deleted.\n" }, { "from": "human", "value": "import logging\nlogger = logging.getLogger(__name__)\n\nfrom django.contrib.contenttypes.models import ContentType\nfrom django.db.models.signals import post_save\nfr...
python
chosen
[ { "from": "system", "value": "Fix issue where interfaces pass in _out\n" }, { "from": "human", "value": "'''\nUsed to manage the outputter system. This package is the modular system used\nfor managing outputters.\n'''\n\n# Import salt utils\nimport salt.loader\n\n\ndef display_output(data, out, ...
python
chosen
[ { "from": "system", "value": "Fix access restriction to /accounts/profile/\n\nLoginRequiredMixin needs to come first for it to be applied. Otherwise,\n/accounts/profile/ is accessible even when the user is not\nauthenticated.\n" }, { "from": "human", "value": "from django.contrib import messages...
python
chosen
[ { "from": "system", "value": "[f] Add failure message test for not_to.be.true()\n" }, { "from": "human", "value": "from robber import expect\nfrom robber.matchers.boolean import TrueMatcher, FalseMatcher\n\n\nclass TestTrueMatcher:\n def test_matches(self):\n expect(TrueMatcher(True).m...
python
chosen
[ { "from": "system", "value": "Check that population_size is even, and set half_population_size.\n\nThis will be used by genetic algorithms.\n" }, { "from": "human", "value": "#\n# Copyright (c) 2016, Gabriel Linder <linder.gabriel@gmail.com>\n#\n# Permission to use, copy, modify, and/or distribu...
python
chosen
[ { "from": "system", "value": "Fix the case of using `get_by_id` when there's not state\n\nPrevious to this commit, if there's no state we would return raw data,\nwhich would break object chaining. Now we check the state one last time\nbefore giving up and returning the raw data because it may have been\npop...
python
chosen
[ { "from": "system", "value": "Add bag of words representation and simple naive bayes classification\n" }, { "from": "human", "value": "#! /usr/bin/python\n\nimport numpy as np\nimport os\nfrom sklearn import datasets\n\nMESSAGES_DIR = \"data/messages/\"\nJUDGMENTS_PATH = \"data/judgments/judgmen...
python
chosen
[ { "from": "system", "value": "Update FileStreamReader to use async generator\n" }, { "from": "human", "value": "import os\n\nfrom waterbutler.core.streams import BaseStream\n\n\nclass FileStreamReader(BaseStream):\n\n def __init__(self, file_pointer):\n super().__init__()\n self...
python
chosen
[ { "from": "system", "value": "Make a bz2 for the release.\n" }, { "from": "human", "value": "import os\nimport sys\nimport tarfile\n\n\nPROJECT_ROOT = os.path.join(os.path.dirname(__file__), os.path.pardir, os.path.pardir)\n\n\ndef main(argv):\n target = argv[0]\n t = tarfile.open(target, ...
python
chosen
[ { "from": "system", "value": "Add missing slash so that Forward config error is rendered properly\n\nCloses centerforopenscience/openscienceframework.org#941\n" }, { "from": "human", "value": "# -*- coding: utf-8 -*-\n\"\"\"Forward addon routes.\"\"\"\nfrom framework.routing import Rule, json_re...
python
chosen
[ { "from": "human", "value": "Write test for template matching of synthetic scarp\n" }, { "from": "gpt", "value": "import unittest\nimport dem\nimport WindowedTemplate as wt\nimport filecmp\n\nclass TemplateMatchingTestCase(unittest.TestCase):\n \n \n def setUp(self):\n \n ...
python
chosen
[ { "from": "system", "value": "Fix the functional testcase name\n" }, { "from": "human", "value": "# Copyright Hybrid Logic Ltd. See LICENSE file for details.\n\n\"\"\"\nFunctional tests for the ``flocker-changestate`` command line tool.\n\"\"\"\nfrom subprocess import check_output\nfrom unittes...
python
chosen
[ { "from": "system", "value": "Implement labels on group tag values\n" }, { "from": "human", "value": "from __future__ import absolute_import\n\nfrom sentry.api.serializers import Serializer, register\nfrom sentry.models import GroupTagValue\n\n\n@register(GroupTagValue)\nclass GroupTagValueSeria...
python
chosen
[ { "from": "system", "value": "Fix wordon filtering when calculating the value\n" }, { "from": "human", "value": "class Letter(object):\n _values = {\n '#': 0, # Wildcard\n 'ENIOA': 1,\n 'SDTR': 2,\n 'MLKPBG': 3,\n 'ZVUFJH': 4,\n 'CW': 5,\n 'XY...
python
chosen
[ { "from": "system", "value": "Change formate of top 5 list\n" }, { "from": "human", "value": "import pyglet\nfrom pyglet.window.key import SPACE\n\nfrom .levels import Level\n\n\nclass IntroScreen(Level):\n def __init__(self, window):\n self.welcome = pyglet.text.Label('WELCOME\\n\\tTO\\nCLA...
python
chosen
[ { "from": "system", "value": "Allow use inside zip bundled package" }, { "from": "human", "value": "# -*- coding: utf-8 -*-\n\n\"\"\"\nyaspin.spinners\n~~~~~~~~~~~~~~~\n\nA collection of cli spinners.\n\"\"\"\n\nimport codecs\nimport os\nfrom collections import namedtuple\n\ntry:\n import sim...
python
chosen
[ { "from": "system", "value": "Allow overriding the ManyRelatedField for image fields\n" }, { "from": "human", "value": "# -*- coding: utf-8 -*-\nfrom functools import lru_cache\n\nfrom rest_framework import serializers\n\n\nclass AbstractFieldSerializer(serializers.RelatedField):\n parent_ser...
python
chosen
[ { "from": "system", "value": "Fix empty pixel set list message\n" }, { "from": "human", "value": "from django.core.urlresolvers import reverse\n\nfrom apps.core.factories import PIXELER_PASSWORD, PixelerFactory\nfrom apps.core.tests import CoreFixturesTestCase\nfrom apps.core.management.commands...
python
chosen
[ { "from": "system", "value": "Add note in docu about Shapely\n" }, { "from": "human", "value": "\"\"\"\nThis module provides utility functions for integrating with Shapely.\n\"\"\"\n\nimport shapely.wkb\nimport shapely.wkt\n\nfrom .elements import WKBElement, WKTElement\nfrom .compat import buff...
python
chosen
[ { "from": "system", "value": "Add MEDIA_ROOT to dev settings\n" }, { "from": "human", "value": "import os\n\nimport dj_database_url\n\nfrom .base import *\n\n\nDATABASE_URL = os.environ.get('DATABASE_URL')\n\nDATABASES = {\n 'default': dj_database_url.config()\n}\n\nSTATIC_ROOT = 'static_sour...
python
chosen
[ { "from": "system", "value": "Put things in in alphabetical order.\n" }, { "from": "human", "value": "\"\"\"\nThe FVCOM Python toolbox (PyFVCOM)\n\n\"\"\"\n\n__version__ = '1.6.2'\n__author__ = 'Pierre Cazenave'\n__credits__ = ['Pierre Cazenave']\n__license__ = 'MIT'\n__maintainer__ = 'Pierre Ca...
python
chosen
[ { "from": "system", "value": "Remove empty lines in comments.\n" }, { "from": "human", "value": "import unittest\n\nimport numpy\n\nimport chainer.functions as F\nfrom chainer import testing\n\n\n#\n# sqrt\n\ndef make_data(shape, dtype):\n x = numpy.random.uniform(0.1, 5, shape).astype(dtype)...
python
chosen
[ { "from": "system", "value": "Improve real time throttle so that it can start immediate the first time.\n" }, { "from": "human", "value": "import time\r\n\r\nclass RealtimeInterval:\r\n startTime = 0\r\n interval = 0\r\n\r\n def __init__(self, intervalInSeconds):\r\n self.startTi...
python
chosen
[ { "from": "system", "value": "Fix import for renaming of Properties to Properties_INterface\n\n\n20070206124719-53eee-3edd233f30e8a6c5ae1cbaaa1a39a7bbdfb8373c.gz\n" }, { "from": "human", "value": "# telepathy-spec - Base classes defining the interfaces of the Telepathy framework\n#\n# Copyright ...
python
chosen
[ { "from": "system", "value": "Disable AliasPlugin since it can accidentally\n\ncause problems if an alias is placed within itself\n" }, { "from": "human", "value": "from __future__ import unicode_literals\n\nfrom django.apps import AppConfig\n\n\nclass SiteconfigConfig(AppConfig):\n name = 's...
python
chosen
[ { "from": "system", "value": "Fix is new check in User.save()\n" }, { "from": "human", "value": "# -*- coding: utf8 -*-\nfrom django.contrib.auth.models import AbstractUser\nfrom django.utils.functional import cached_property\nfrom social.apps.django_app.default.models import UserSocialAuth\n\nf...
python
chosen
[ { "from": "system", "value": "Add method for getting the default transformations.\n" }, { "from": "human", "value": "\"\"\"\nAppResources\n\n:Authors:\n\tBerend Klein Haneveld\n\"\"\"\n\nimport os\nfrom AppVars import AppVars\n\n\nclass AppResources(object):\n\t\"\"\"\n\tAppResources is a static...
python
chosen
[ { "from": "system", "value": "Add another way to solve the problem.\n" }, { "from": "human", "value": "#!/usr/local/bin/python\ndef divide1(x,y):\n try:\n return True,x/y\n except Exception , e:\n print e\n return False,None\n\nx1=5\ny1=0\nx2=2\ny2=1\nsuccess1,result1= divide1(x1,y1)\...
python
chosen
[ { "from": "system", "value": "Test for the chrome attach_file disallowance removed" }, { "from": "human", "value": "# -*- coding: utf-8 -*-\n\ntry:\n import unittest2 as unittest\nexcept ImportError:\n import unittest\n\nfrom splinter import Browser\nfrom fake_webapp import EXAMPLE_APP\nfr...
python
chosen
[ { "from": "system", "value": "Set default lambda value to 0\n" }, { "from": "human", "value": "#!/usr/bin/python3\n\nfrom tensorflow.examples.tutorials.mnist import input_data\nimport tensorflow as tf\nimport numpy as np\n\n\nDATASET_PATH = 'data/fashion'\n\ndef load_dataset():\n \"\"\"Loads ...
python
chosen
[ { "from": "system", "value": "Use API key in URL" }, { "from": "human", "value": "#!/usr/bin/python3\n#Pysarus\n#A python wrapper for Big Huge Thesarus\n#Jacob Adams\n\nimport urllib.request\nimport json\n\n#where to save reteived defintions\n#if None than no files are saved\nsavepath = \".\"\n\...
python
chosen
[ { "from": "human", "value": "Add initial implementation of a Distribution class\n" }, { "from": "gpt", "value": "import os\nimport sys\nimport glob\n\n\nclass Distribution:\n def __init__(self, path):\n \"\"\"\n Construct a distribution from a path to the metadata dir\n \...
python
chosen
[ { "from": "system", "value": "Add newline before custom error header\n" }, { "from": "human", "value": "\"\"\"Base error used to create custom errors for loaders.\"\"\"\n\nERROR_TITLE_TEMPLATE = \"****************************ERROR****************************\\n\"\nERROR_FILENAME_TEMPLATE = \"Fil...
python
chosen
[ { "from": "system", "value": "Add regex for parsing password url parameter\n" }, { "from": "human", "value": "# Sarah M. - 2017\n\nimport sys\nimport datetime\nfrom colors import farben\n\ndef request(flow):\n now = datetime.datetime.now()\n content = flow.request.get_text()\n host = fl...
python
chosen
[ { "from": "system", "value": "Add new line at end of python script" }, { "from": "human", "value": "import sounddevice as sd\nimport matplotlib.pyplot as plt\nimport numpy as np\n\nif __name__ == '__main__':\n\n # devList = sd.query_devices()\n # print(devList)\n\n fs = 48000 # Sample ra...
python
chosen
[ { "from": "system", "value": "palindrome-product: Add parameter to exercise placeholder\n" }, { "from": "human", "value": "def largest_palindrome():\n pass\n\n\ndef smallest_palindrome():\n pass\n" }, { "from": "gpt", "value": "def largest_palindrome(max_factor, min_factor):\n ...
python
chosen
[ { "from": "system", "value": "Load config when loading dallinger.experiments\n" }, { "from": "human", "value": "\"\"\"A home for all Dallinger Experiments. Experiments should be registered\nwith a ``setuptools`` ``entry_point`` for the ``dallinger.experiments`` group.\n\"\"\"\nimport logging\nfr...
python
chosen
[ { "from": "system", "value": "Make messages show in delete view.\n" }, { "from": "human", "value": "from django.views.generic import DetailView, ListView\nfrom django.views.generic.edit import CreateView, UpdateView, DeleteView\nfrom django.urls import reverse_lazy\nfrom django.shortcuts import ...
python
chosen
[ { "from": "system", "value": "Update dendro tests and specify no periodic boundaries to be consistent w/ previous unit testing\n" }, { "from": "human", "value": "# Licensed under an MIT open source license - see LICENSE\n\n\n'''\nTests for Dendrogram statistics\n'''\n\nfrom unittest import TestC...
python
chosen
[ { "from": "system", "value": "Add optional 3 option to ImportSymbolScript.py to allow importing\nfunction names.\n\nAdd python script to import functions and labels\n\nUse print() instead of print\n\nMerge ImportSymbolsScript.py and ImportFunctionAndLabels.py\n\nMade third token optional\n" }, { "fr...
python
chosen
[ { "from": "system", "value": "Fix for py26 and expectedFailure" }, { "from": "human", "value": "import unittest\n\nclass TestWithExpectedFailures(unittest.TestCase):\n\n @unittest.expectedFailure\n def test_should_fail(self):\n assert False\n \n @unittest.expectedFailure\n ...
python
chosen
[ { "from": "system", "value": "Fix GitLab profile_url (html_url -> web_url)\n" }, { "from": "human", "value": "# -*- coding: utf-8 -*-\nfrom allauth.socialaccount.providers.base import ProviderAccount\nfrom allauth.socialaccount.providers.oauth2.provider import OAuth2Provider\n\n\nclass GitLabAcc...
python
chosen
[ { "from": "system", "value": "Update existing test for icon class changes\n" }, { "from": "human", "value": "# -*- coding: utf-8 -*-\nfrom django import template\nfrom django.utils.safestring import mark_safe\n\nregister = template.Library()\n\n\n@register.filter()\ndef bool_icon(value):\n \"...
python
chosen
[ { "from": "system", "value": "Make context name for a filter form configurable\n" }, { "from": "human", "value": "from django.views.generic.list import MultipleObjectMixin\n\n__all__ = ('FilterFormMixin',)\n\n\nclass FilterFormMixin(MultipleObjectMixin):\n \"\"\"\n Mixin that adds filterin...
python
chosen
[ { "from": "system", "value": "Set SO_REUSEADDR in client test.\n" }, { "from": "human", "value": "#!/usr/bin/python\n\n# Test whether a client produces a correct connect and subsequent disconnect.\n\nimport os\nimport subprocess\nimport socket\nimport sys\nimport time\nfrom struct import *\n\nrc...
python
chosen
[ { "from": "system", "value": "[ADD] Rename table _model_renames and _table_renames\n\nSigned-off-by: Luis Felipe Mileo <c9a5b4d335634d99740001a1172b3e56e4fc5aa8@kmee.com.br>\n" }, { "from": "human", "value": "# -*- coding: utf-8 -*-\n# Copyright 2018 KMEE INFORMATICA LTDA - Gabriel Cardoso de Fa...
python
chosen
[ { "from": "system", "value": "Disable dns rebinding protection for dev mode notebook\n" }, { "from": "human", "value": "c.ServerProxy.servers = {\n 'lab-dev': {\n 'command': [\n 'jupyter',\n 'lab',\n '--debug',\n '--no-browser',\n ...
python
chosen
[ { "from": "system", "value": "Remove bogus semicolons, thanks justinlilly\n" }, { "from": "human", "value": "from django.db import models\n\ntry:\n from django_extensions.db.fields.encrypted import EncryptedTextField, EncryptedCharField\nexcept ImportError:\n\n class EncryptedCharField():\...
python
chosen
[ { "from": "system", "value": "Increment version number to 0.2.5\n" }, { "from": "human", "value": "__version__ = '0.2.4'\n\n# This list defines all the modules that will be loaded if a user invokes\n# from climLab import *\n\n# totally out of date!\n\n#__all__ = [\"constants\", \"thermo\", \"...
python
chosen
[ { "from": "system", "value": "Clean signal handler from example app\n" }, { "from": "human", "value": "# Define a custom User class to work with django-social-auth\nfrom django.db import models\n\n\nclass CustomUserManager(models.Manager):\n def create_user(self, username, email):\n re...
python
chosen
[ { "from": "system", "value": "Add filter_horizontal for for allowed and disallowed\n" }, { "from": "human", "value": "from django.contrib import admin\nfrom django.utils.translation import ugettext_lazy as _\n\nfrom robots.models import Url, Rule\nfrom robots.forms import RuleAdminForm\n\n\nclas...
python
chosen
[ { "from": "system", "value": "Change data dir to ~/.local/share/classer\n" }, { "from": "human", "value": "import os\n\n\ndef open_lastrun_file(mode='r'):\n '''Open and return lastrun file.'''\n\n # path to data directory\n data_dir = os.path.join(os.path.dirname(os.path.dirname(__file_...
python
chosen
[ { "from": "system", "value": "Put the model back the way it was\n" }, { "from": "human", "value": "from django.db import models\nfrom legacy.models import Constituency\n\nclass Boundary(models.Model):\n id = models.IntegerField(primary_key=True)\n constituency_id = models.IntegerField()\n ...
python
chosen
[ { "from": "system", "value": "Use global ioloop as we don't pass test ioloop to tornado redis\n" }, { "from": "human", "value": "# -*- coding: utf-8 -*-\nimport json\nfrom mock import MagicMock\nfrom tornado.testing import AsyncHTTPTestCase\nfrom insight_reloaded.api import application\nfrom ins...
python
chosen
[ { "from": "system", "value": "Check that contributor exist in the source feed.\n\nOtherwise things will break sooner or later.\n" }, { "from": "human", "value": "import feedparser, sys, urllib2\n\nfrom bs4 import BeautifulSoup as BS\nfrom feedgen.feed import FeedGenerator\nfrom flask import Flas...
python
chosen
[ { "from": "system", "value": "Disable daemonised mode so that Supervisor can properly control gunicorn\n" }, { "from": "human", "value": "import multiprocessing\r\n\r\nbind = \"127.0.0.1:9000\"\r\n\r\n# Run cores * 4 + 1 workers in gunicorn\r\n# This is set deliberately high in case of long Orac...
python
chosen
[ { "from": "system", "value": "FIx a bug in exposed attribute keyword\n" }, { "from": "human", "value": "# -*- coding: utf-8 -*-\n\"\"\"\nAn extension for keywords which expose pieces of native python objects.\n\"\"\"\nfrom __future__ import absolute_import\n\nfrom Cauldron.types import Integer, ...
python
chosen
[ { "from": "system", "value": "Change LastSeenMiddleware to store last_seen as utcnow() instead of now()\n" }, { "from": "human", "value": "import datetime\n\nclass LastSeenMiddleware(object):\n def process_request(self, request):\n if not request.user.is_authenticated():\n r...
python
chosen
[ { "from": "system", "value": "Fix incorrect TorusBorder wrapping in negative direction\n" }, { "from": "human", "value": "from hecate.core.topology.mixins import DimensionsMixin\n\n\nclass Border(DimensionsMixin):\n \"\"\"\n Base class for all types of borders.\n\n \"\"\"\n def __ini...
python
chosen
[ { "from": "system", "value": "Implement an origin on MockStation\n" }, { "from": "human", "value": "import unittest\nimport tempfile\nimport shutil\n\nimport groundstation.node\nimport groundstation.transfer.response\nimport groundstation.transfer.request\nfrom groundstation.station import Stati...
python
chosen
[ { "from": "system", "value": "Remove another piece of unreachable code.\n" }, { "from": "human", "value": "from logging import getLogger\n\ntry:\n from logging import NullHandler\n# For Python 2.7 compatibility.\nexcept ImportError:\n from logging import Handler\n\n class NullHandler(Ha...
python
chosen
[ { "from": "system", "value": "Update an example test that uses deferred asserts\n" }, { "from": "human", "value": "\"\"\"\nThis test demonstrates the use of deferred asserts.\nDeferred asserts won't raise exceptions from failures until either\nprocess_deferred_asserts() is called, or the test re...
python
chosen
[ { "from": "system", "value": "[AC-9046] Fix the query for updating the people and mentor urls to community url\n" }, { "from": "human", "value": "# Generated by Django 2.2.10 on 2021-11-05 12:29\n\nfrom django.db import migrations\nfrom django.db.models.query_utils import Q\n\n\ndef update_url_t...
python
chosen
[ { "from": "system", "value": "pyges: Fix the timeline_file_source test suite\n\nCan't create a GESTimelineFileSource if you don't have the protocol in the uri\n" }, { "from": "human", "value": "import gst\n\nfrom common import TestCase\nimport ges\n\nclass TimelineFileSource(TestCase):\n\n de...
python
chosen
[ { "from": "system", "value": "Make the K2onSilicon unit test more comprehensive\n" }, { "from": "human", "value": "\"\"\"Test whether the K2onSilicon command-line tool works.\"\"\"\nimport tempfile\n\nfrom ..K2onSilicon import K2onSilicon_main\n\n\ndef test_K2onSilicon():\n \"\"\"Test the bas...
python
chosen
[ { "from": "system", "value": "Allow publisher conditions to be imported from text\n" }, { "from": "human", "value": "\n# IATI Data Quality, tools for Data QA on IATI-formatted publications\n# by Mark Brough, Martin Keegan, Ben Webb and Jennifer Smith\n#\n# Copyright (C) 2013 Publish What Yo...
python
chosen
[ { "from": "system", "value": "Add timer to follow bot\n" }, { "from": "human", "value": "\nfrom botchallenge import *\n\nUSERNAME = \"\" # Put your minecraft username here\nSERVER = \"\" # Put the address of the minecraft server here\n\nrobot = Robot(USERNAME, SERVER)\n\nwhile True:\n me = ro...
python
chosen
[ { "from": "system", "value": "Remove batching code. (not in celery contrib)\n" }, { "from": "human", "value": "import os\nimport sys\n# Append .. to sys path\nsys.path.append(os.path.dirname(os.path.dirname(os.path.abspath(__file__))))\nimport multiscanner\n\nfrom celery import Celery\nfrom cele...
python
chosen
[ { "from": "system", "value": "Remove MyUser in favor of AdminProfile and OSFUser\n\nAdmin users are now the same as the OSFUser - AdminProfile gives access\nto a few extra fields related to desk keys. AdminProfile has a one to\none relationship with a OSFUser.\n" }, { "from": "human", "value": "...
python
chosen
[ { "from": "system", "value": "Implement alg to remove useless symbols\n" }, { "from": "human", "value": "#!/usr/bin/env python\n\"\"\"\n:Author Patrik Valkovic\n:Created 10.08.2017 20:33\n:Licence GNUv3\nPart of grammpy-transforms\n\n\"\"\"\n\nfrom grammpy import Grammar\nfrom .NongeneratingSymb...
python
chosen
[ { "from": "system", "value": "Add 'comment_id' parameter in 'delete_comment' url\n" }, { "from": "human", "value": "# Created by JHJ on 2016. 10. 5.\n\nfrom django.conf.urls import url\n\nfrom . import views\n\napp_name = 'board'\nurlpatterns = [\n url(r'^$', views.board_list, name='board_lis...
python
chosen
[ { "from": "system", "value": "Add Config weather - (DARKSKY API KEY, HOME, WORK_PLACE\n" }, { "from": "human", "value": "\nfrom utils.data_handler import DataHandler\n\nclass Config(object):\n class __Config:\n def __init__(self):\n self.data_handler = DataHandler()\n ...
python
chosen
[ { "from": "system", "value": "example: Simplify markdown example using pathlib\n" }, { "from": "human", "value": "#!/usr/bin/env python3\n# build.py\nimport os\n\n# Markdown to HTML library\n# https://pypi.org/project/Markdown/\nimport markdown\n\nfrom staticjinja import Site\n\nmarkdowner = mar...
python
chosen
[ { "from": "system", "value": "Append note to Description indicating the Alert was created programmatically\n" }, { "from": "human", "value": "#!/usr/bin/env python\n#\n# Restore Alerts of the format in a JSON dumpfile from the list_alerts.py example.\n#\n\nimport os\nimport sys\nimport json\nsys...
python
chosen
[ { "from": "system", "value": "Fix to allow overriding subject formatting\n" }, { "from": "human", "value": "import logging\nfrom subprocess import Popen, PIPE\n\n\nclass EximHandler(logging.Handler):\n \"\"\"\n A handler class which sends an email using exim for each logging event.\n \"...
python
chosen
[ { "from": "system", "value": "Set STRICT_ALL_TABLES on connection to prevent MySQL from silently truncating data.\n" }, { "from": "human", "value": "from manoseimas.settings.base import * # noqa\nfrom manoseimas.settings.development import * # noqa\n\nINTERNAL_IPS = (\n '127.0.0.1',\n '1...
python
chosen
[ { "from": "system", "value": "Clean up page context processor check.\n" }, { "from": "human", "value": "from mezzanine.pages.models import Page\n\n\ndef page(request):\n \"\"\"\n Adds the current page to the template context and runs its\n ``set_helper`` method. This was previously part...
python
chosen
[ { "from": "system", "value": "Hide stderr output when calling get to get version\n" }, { "from": "human", "value": "#\n# Copyright 2015 Yasser Gonzalez Fernandez\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may not use this file except in compliance with the ...
python
chosen
[ { "from": "system", "value": "Change type from text to UnicodeText\n" }, { "from": "human", "value": "from sqlalchemy import ForeignKey, Column\nfrom sqlalchemy import String\nfrom sqlalchemy import Text\nfrom sqlalchemy.ext.declarative import declarative_base\nfrom sqlalchemy.types import Unico...
python
chosen
[ { "from": "system", "value": "Delete the document from the disk on delete\n" }, { "from": "human", "value": "# -*- coding: utf-8 -*-\n\n# This file is part of wger Workout Manager.\n#\n# wger Workout Manager is free software: you can redistribute it and/or modify\n# it under the terms of the GNU...
python
chosen
[ { "from": "system", "value": "Use appropriate order of classes\n" }, { "from": "human", "value": "# -*- coding: utf-8 -*-\nfrom adminsortable.admin import SortableAdmin\nfrom cms.admin.placeholderadmin import PlaceholderAdmin\nfrom django.contrib import admin\nfrom distutils.version import Loose...
python
chosen
[ { "from": "system", "value": "Add acks late to task\n" }, { "from": "human", "value": "import os\n\nfrom celery.schedules import crontab\nfrom celery.task import periodic_task\nfrom django.conf import settings\n\nfrom django.db import connections\n\n\n@periodic_task(run_every=crontab(minute=0, h...
python
chosen
[ { "from": "system", "value": "Remove unnecessary compat code from ActiveManager\n" }, { "from": "human", "value": "# -*- coding: utf-8 -*-\n\n# Standard library imports\nfrom __future__ import unicode_literals\n\n# Third party imports\nfrom django.db import models\nfrom django.utils.translation ...
python
chosen
[ { "from": "system", "value": "Move api config outside of manager commands\n" }, { "from": "human", "value": "from flask_script import Manager\nfrom flask_restful import Api\nfrom config import app\nfrom api import api\n\nmanager = Manager(app)\n\ndef setup_api(app):\n \"\"\"\n Config resou...
python
chosen
[ { "from": "system", "value": "Fix for python without _multiarch support\n" }, { "from": "human", "value": "from distutils.sysconfig import get_config_var\nimport sys\nfor var in ('executable', 'exec_prefix', 'prefix'):\n print(var + ': ' + str(getattr(sys, var)))\nprint('multiarch: ' + str(geta...
python
chosen