conversations
listlengths
2
3
source
stringclasses
1 value
stack
stringclasses
1 value
[ { "from": "system", "value": "Add missing find_spec for import hook, to avoid issues when trying to set colormap" }, { "from": "human", "value": "class MatplotlibBackendSetter(object):\n \"\"\"\n Import hook to make sure the proper Qt backend is set when importing\n Matplotlib.\n \"\...
python
chosen
[ { "from": "system", "value": "Move where to post for sending emails\n" }, { "from": "human", "value": "from flask import Blueprint\nfrom flask.ext.restful import Api\n\n\napi = Blueprint(\"api\", __name__, template_folder=\"templates\")\nrest = Api(api)\n\n# Import the non-restful resources\nfro...
python
chosen
[ { "from": "system", "value": "Remove problematic file from testing\n" }, { "from": "human", "value": "# -*- coding: utf-8 -*-\n\"\"\"\nTests of neo.io.asciisignalio\n\"\"\"\n\n# needed for python 3 compatibility\nfrom __future__ import absolute_import, division\n\nimport unittest\n\nfrom neo.io ...
python
chosen
[ { "from": "system", "value": "Improve batch form return data structure.\n" }, { "from": "human", "value": "from django import forms\n\nimport csv\nfrom io import StringIO\n\nclass BatchMoonScanForm(forms.Form):\n data = forms.CharField(\n widget=forms.Textarea(attrs={'class':'form-cont...
python
chosen
[ { "from": "system", "value": "feat: Use 'pandas.read_csv' method to create dataframe\n" }, { "from": "human", "value": "# TODO: Load the csv files into dataframes here.\n\nclass data_preparer():\n def __init__():\n \n" }, { "from": "gpt", "value": "# TODO: Load the csv files in...
python
chosen
[ { "from": "system", "value": "Change .env to settings.ini file\n" }, { "from": "human", "value": "from decouple import AutoConfig\n\nfrom ereuse_workbench.test import TestDataStorageLength\n\n\nclass WorkbenchConfig:\n # Path where find .env file\n config = AutoConfig(search_path='/home/us...
python
chosen
[ { "from": "system", "value": "Change Wait time from 60 to 5 sec\n" }, { "from": "human", "value": "from selenium.webdriver.firefox.webdriver import WebDriver\nfrom fixture.session import SessionHelper\nfrom fixture.group import GroupHelper\nfrom fixture.contact import ContactHelper\n\n\nclass Ap...
python
chosen
[ { "from": "system", "value": "Fix to test crontab dir\n" }, { "from": "human", "value": "import unittest\nfrom cronquot.cronquot import has_directory\n\n\nclass CronquotTest(unittest.TestCase):\n\n def test_has_directory(self):\n self.assertTrue(has_directory('/tmp'))\n\nif __name__ ==...
python
chosen
[ { "from": "system", "value": "Add a function to drop db tables." }, { "from": "human", "value": "# -*- coding: utf-8 -*-\n\nfrom sqlalchemy import (\n Column,\n Date,\n Integer,\n MetaData,\n Numeric,\n String,\n Table,\n create_engine,\n)\n\n\nmetadata = MetaData()\n\nme...
python
chosen
[ { "from": "system", "value": "Update test to ensure attached files are present in archives.\n" }, { "from": "human", "value": "from json import load\n\nfrom django_archive import __version__\n\nfrom .base import BaseArchiveTestCase\nfrom .sample.models import Sample\n\n\nclass ArchiveTestCase(Ba...
python
chosen
[ { "from": "system", "value": "Add RenderResult to mfr namespace\n" }, { "from": "human", "value": "\"\"\"The mfr core module.\"\"\"\n# -*- coding: utf-8 -*-\nimport os\n\n__version__ = '0.1.0-alpha'\n__author__ = 'Center for Open Science'\n\n\nfrom mfr.core import (render, detect, FileHandler, g...
python
chosen
[ { "from": "system", "value": "Test lattince length for non-negative values\n" }, { "from": "human", "value": "import rml.lattice\n\ndef test_create_lattice():\n l = rml.lattice.Lattice()\n assert(len(l)) == 0\n\n" }, { "from": "gpt", "value": "import rml.lattice\n\ndef test_cre...
python
chosen
[ { "from": "system", "value": "Add routine to make surface plot from Dakota output\n" }, { "from": "human", "value": "#! /usr/bin/env python\n#\n# Dakota utility programs.\n#\n# Mark Piper (mark.piper@colorado.edu)\n\nimport numpy as np\n\n\ndef get_names(dat_file):\n '''\n Reads the header...
python
chosen
[ { "from": "system", "value": "Fix crash tasks with unicode string name (like name: héhé).\n" }, { "from": "human", "value": "class Formatter(object):\n\n def format(self, match):\n formatstr = \"[{0}] {1}\\n{2}:{3}\\n{4}\\n\"\n return formatstr.format(match.rule.id,\n ...
python
chosen
[ { "from": "system", "value": "Fix Brand and Owner public links (missing / would get a 404 on brand/ and owner/)\n\nAlso follow the same URL scheme as admin (which always have trailing\nslash)\n" }, { "from": "human", "value": "from django.conf.urls import patterns, url\nfrom manager.apps.brand.v...
python
chosen
[ { "from": "system", "value": "Correct the download url for gherkin-python\n" }, { "from": "human", "value": "# coding: utf-8\nfrom distutils.core import setup\nsetup(\n name = 'gherkin3',\n packages = ['gherkin3'],\n version = '3.0.0',\n description = 'Gherkin parser',\n author = 'Björn Ras...
python
chosen
[ { "from": "system", "value": "Make plugin loader more robust\n" }, { "from": "human", "value": "class PluginLoader:\n\n def load(self, directory):\n ret = []\n\n for plugin in directory.children:\n plugin_file = plugin.find(name=plugin.name, type='py')\n pl...
python
chosen
[ { "from": "system", "value": "Disable import so that hydromet can be used w/o hydromath.so\n\nShould make the code for finding/not working if hydromath.so isn't\navailable a bit more robust, but in the mean time disabling an import so\nthat other parts of hydromet can be used without requiring hydromath.\n"...
python
chosen
[ { "from": "system", "value": "Fix to avoid NoneType bugs\n" }, { "from": "human", "value": "#!/usr/bin/env python\n\n\nNAME = 'Expression Engine (EllisLab)'\n\n\ndef is_waf(self):\n for attack in self.attacks:\n r = attack(self)\n if r is None:\n return\n respo...
python
chosen
[ { "from": "system", "value": "Change URL pattern for contacts\n" }, { "from": "human", "value": "from django.conf.urls import url\nfrom . import views\n\nurlpatterns = [\n url(r'^$', views.home, name='home'),\n url(r'^about/$', views.about, name='about'),\n url(r'^contact/$', views.cont...
python
chosen
[ { "from": "system", "value": "Add command-line argument for server host\n" }, { "from": "human", "value": "# Copyright 2015 Cedraro Andrea <a.cedraro@gmail.com>\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may not use this file except in compliance with the Lic...
python
chosen
[ { "from": "system", "value": "Test stable channel instead of testing channel for eigen\n" }, { "from": "human", "value": "from conans.model.conan_file import ConanFile\nfrom conans import CMake\nimport os\n\nclass DefaultNameConan(ConanFile):\n name = \"DefaultName\"\n version = \"0.1\"\n ...
python
chosen
[ { "from": "system", "value": "Remove logger entry for alert plugins receiving alerts\n" }, { "from": "human", "value": "from mozdef_util.plugin_set import PluginSet\nfrom mozdef_util.utilities.logger import logger\n\n\nclass AlertPluginSet(PluginSet):\n\n def send_message_to_plugin(self, plug...
python
chosen
[ { "from": "system", "value": "Use if response since 'is not None' is unnecessary.\n" }, { "from": "human", "value": "\nfrom rest_framework import status\nfrom rest_framework.exceptions import APIException\n\n\ndef json_api_exception_handler(exc, context):\n \"\"\" Custom exception handler tha...
python
chosen
[ { "from": "system", "value": "Add a funcLog shortcut to debug\n" }, { "from": "human", "value": "import logging\nimport inspect\n\ndef funcLog():\n frame = inspect.stack()[1]\n localVars = frame[0].f_locals\n if 'self' in localVars:\n logName = '%s.%s.%s'%(localVars['self'].__class__.__mod...
python
chosen
[ { "from": "system", "value": "Add option for triggering or not the analysis\n" }, { "from": "human", "value": "\"\"\" CLI for the analysis subcommand\n\"\"\"\nimport click\nfrom taca.analysis import analysis as an\n\n\n@click.group()\ndef analysis():\n\t\"\"\" Analysis methods entry point \"\"\"...
python
chosen
[ { "from": "system", "value": "Make Reader subclass of Thread\n" }, { "from": "human", "value": "from .compat import etree\nfrom .entities import Node, Way, Relation\n\n\ndef parse(fp):\n context = etree.iterparse(fp, events=('end',))\n\n for action, elem in context:\n # Act only on ...
python
chosen
[ { "from": "system", "value": "Print the scenario when running 262-style tests.\n" }, { "from": "human", "value": "#!/usr/bin/env python3\n\nimport json\nimport sys\n\nPREFIXES = [\n [\"FAIL\", \"PASS\"],\n [\"EXPECTED FAIL\", \"UNEXPECTED PASS\"],\n]\n\n\ndef parse_expected_failures():\n ...
python
chosen
[ { "from": "system", "value": "Add Shifting Sands to benchmark tests\n" }, { "from": "human", "value": "\"\"\"Script to run performance check.\"\"\"\nimport time\n\nfrom examples.game_of_life import GameOfLife, GOLExperiment\nfrom xentica.utils.formatters import sizeof_fmt\n\n\nMODELS = [\n (\...
python
chosen
[ { "from": "system", "value": "Correct package name in httpheader test\n" }, { "from": "human", "value": "# MIT licensed\n# Copyright (c) 2021 lilydjwg <lilydjwg@gmail.com>, et al.\n\nimport pytest\n\npytestmark = pytest.mark.asyncio\n\nasync def test_redirection(get_version):\n assert await g...
python
chosen
[ { "from": "system", "value": "Add predict() path to feed-forward\n" }, { "from": "human", "value": "from .model import Model\nfrom ... import describe\n\n\ndef _run_child_hooks(model, X, y):\n for layer in model._layers:\n for hook in layer.on_data_hooks:\n hook(layer, X, y)...
python
chosen
[ { "from": "system", "value": "Check if a cube exists on disk. " }, { "from": "human", "value": "import os\nimport json\nfrom regenesis.core import app\n\ndef cube_path(cube_name, ext):\n return os.path.join(\n app.config.get('DATA_DIRECTORY'),\n cube_name + '.' + ext\n ...
python
chosen
[ { "from": "system", "value": "Add script to move secrets file\n" }, { "from": "human", "value": "\"\"\"\nMove the right secrets file into place for Travis CI.\n\"\"\"\n" }, { "from": "gpt", "value": "\"\"\"\nMove the right secrets file into place for Travis CI.\n\"\"\"\n\nimport os\n...
python
chosen
[ { "from": "system", "value": "Write out tsv embedding files instead of plotting them.\n" }, { "from": "human", "value": "#! /usr/bin/python3\n\nimport sys\nimport argparse\nimport xml_utils as u\nimport datetime\nfrom collections import defaultdict\n\n##------------------------------------------...
python
chosen
[ { "from": "system", "value": "Tweak too high textarea for RST text.\n" }, { "from": "human", "value": "from cmsplugin_rst.models import RstPluginModel, rst_help_text\nfrom django import forms\n\n\n\nclass RstPluginForm(forms.ModelForm):\n\n body = forms.CharField(\n widget=form...
python
chosen
[ { "from": "system", "value": "Extend data pipeline from baltrad\n" }, { "from": "human", "value": "\"\"\"\nBaltrad to S3 porting\n\"\"\"\n\nimport sys\n\n\nfrom creds import URL, LOGIN, PASSWORD\nimport datamover as dm\n\n\ndef main():\n \"\"\"Run data transfer from Baltrad to S3\"\"\"\n\n ...
python
chosen
[ { "from": "system", "value": "Remove unnecessary MatAdd and MatMul imports\n" }, { "from": "human", "value": "from matexpr import MatrixExpr\nfrom sympy import Basic\n\nclass Transpose(MatrixExpr):\n \"\"\"Matrix Transpose\n\n Represents the transpose of a matrix expression.\n\n Use .T ...
python
chosen
[ { "from": "system", "value": "Fix bug with self reference\n" }, { "from": "human", "value": "from datetime import datetime\nimport argparse\nimport os\n\n\ndef is_dir(string):\n \"\"\"\n Type check for a valid directory for ArgumentParser.\n \"\"\"\n if not os.path.isdir(string):\n ...
python
chosen
[ { "from": "system", "value": "Switch to PEP 440 compliant version string and bump to 0.6.7.dev0.\n" }, { "from": "human", "value": "import platform\nimport sys\n\n__version_info__ = (0, 6, 7)\n__version__ = '.'.join(map(str, __version_info__))\n\nSERVER_ID = ','.join([platform.system(),\n ...
python
chosen
[ { "from": "system", "value": "Fix link to failure tests.\n" }, { "from": "human", "value": "# -*- test-case-name: vumi.transports.intergrat.tests.test_failures -*-\n\nfrom vumi.transports.failures import FailureWorker\n\n\nclass IntegratFailureWorker(FailureWorker):\n\n def do_retry(self, mes...
python
chosen
[ { "from": "system", "value": "Add query tracking utility for use in tests.\n" }, { "from": "human", "value": "import functools\nimport unicodedata\nfrom django.core.cache import get_cache\nfrom django.conf import settings\n\n\ndef normalize_unicode(u):\n \"\"\"Replace non-ASCII characters wit...
python
chosen
[ { "from": "system", "value": "Set constant price for all filaments\n\n" }, { "from": "human", "value": "def price(printTime, filamentUsed, filament=None):\n return round((printTime/60/60)*filament['price'])\n" }, { "from": "gpt", "value": "def price(printTime, filamentUsed, filament...
python
chosen
[ { "from": "system", "value": "Use get_prep_value instead of the database related one. Closes gh-42\n" }, { "from": "human", "value": "from django.core.exceptions import ValidationError\nfrom django.db import models\nfrom django.utils import simplejson\n\n\nclass JSONField(models.TextField):\n ...
python
chosen
[ { "from": "system", "value": "Add test for cascading deletion of archive\n" }, { "from": "human", "value": "import pytest\nfrom tests.archives_tests.factories import ArchiveFactory\nfrom tests.model_helpers import do_test_factory\n\n\n@pytest.mark.django_db\nclass TestArchivesModels:\n # test...
python
chosen
[ { "from": "system", "value": "Handle undefined names in tolerant mode in the mako engine.\n" }, { "from": "human", "value": "#!/usr/bin/env python3\n\"\"\"Provide the mako templating engine.\"\"\"\n\nfrom __future__ import print_function\n\n\nfrom mako.template import Template\nfrom mako.lookup ...
python
chosen
[ { "from": "system", "value": "Set version number as 0.5.1\n" }, { "from": "human", "value": "#!/usr/bin/env python\n# -*- coding: utf-8 -*-\n\n\n\"\"\"\n Alignak REST backend client library\n\n This module is a Python library used the REST API of the Alignak backend\n\"\"\"\n# Application ...
python
chosen
[ { "from": "system", "value": "Remove silly exception inserted for testing\n" }, { "from": "human", "value": "from datetime import datetime\n\nfrom sqlalchemy import MetaData, Column, ForeignKey, Table\nfrom sqlalchemy import DateTime, Integer, Unicode, UnicodeText\n\nmetadata = MetaData()\n\nold...
python
chosen
[ { "from": "system", "value": "Fix file open/read/close - there was no close() call in previous version! Use context handler instead.\n" }, { "from": "human", "value": "__author__ = 'Chris Krycho'\n__copyright__ = '2013 Chris Krycho'\n\nfrom logging import error\nfrom os import path, walk\nfrom s...
python
chosen
[ { "from": "system", "value": "Optimize internal imports from python2 to python3.\n\nAlso, ignore images2gif import.\n" }, { "from": "human", "value": "#!/usr/bin/env python\n# -*- coding: utf-8 -*-\n\"\"\"Top-level module for RasterFairy\"\"\"\n\nfrom rasterfairy import *\nfrom coonswarp import ...
python
chosen
[ { "from": "system", "value": "Use a class filter to allow expansion\n" }, { "from": "human", "value": "import django_filters.rest_framework\nfrom rest_framework.authentication import SessionAuthentication, TokenAuthentication\nfrom rest_framework.permissions import IsAuthenticated\nfrom rest_fra...
python
chosen
[ { "from": "system", "value": "Update test to reflect changing git codebase\n" }, { "from": "human", "value": "import unittest\n\nfrom pylons import c, g\n\nfrom ming.orm import ThreadLocalORMSession\n\nfrom pyforge.tests import helpers\nfrom pyforge.lib import helpers as h\n\nclass TestGitApp(un...
python
chosen
[ { "from": "system", "value": "Add comment ot openstack test\n" }, { "from": "human", "value": "# vim: tabstop=4 shiftwidth=4 softtabstop=4\n\nfrom django import test\nfrom django.core import mail\nfrom mailer import engine\nfrom mailer import send_mail\n\n\nclass DjangoMailerPresenceTest(test.Te...
python
chosen
[ { "from": "system", "value": "Change dname of key test\n" }, { "from": "human", "value": "from ev3.ev3dev import Key\nimport unittest\nfrom util import get_input\nimport time\n\n\nclass TestTone(unittest.TestCase):\n\n def test_tone(self):\n d = Key()\n get_input('Test keyboard....
python
chosen
[ { "from": "system", "value": "Add post modifier to version\n" }, { "from": "human", "value": "# (c) 2012-2014, Michael DeHaan <michael.dehaan@gmail.com>\n#\n# This file is part of Ansible\n#\n# Ansible is free software: you can redistribute it and/or modify\n# it under the terms of the GNU Gener...
python
chosen
[ { "from": "system", "value": "Set \"Access-Control-Allow-Origin: *\" by default\n" }, { "from": "human", "value": "from typing import Iterable, List, Tuple\n\nfrom werkzeug.http import HTTP_STATUS_CODES\n\nfrom apistar import http\n\n__all__ = ['WSGIEnviron', 'WSGIResponse']\n\n\nSTATUS_CODES = ...
python
chosen
[ { "from": "system", "value": "Add EditForm that does not have 'private' field.\n" }, { "from": "human", "value": "from django import forms\n\nfrom tempel import utils\n\nclass EntryForm(forms.Form):\n language = forms.ChoiceField(choices=utils.get_languages(),\n ...
python
chosen
[ { "from": "system", "value": "Bump version to 0.11.0 and upload to pypi\n" }, { "from": "human", "value": "from ._metakernel import MetaKernel, IPythonKernel, register_ipython_magics\nfrom . import pexpect\nfrom .replwrap import REPLWrapper, u\nfrom .process_metakernel import ProcessMetaKernel\n...
python
chosen
[ { "from": "system", "value": "[Tests] Test trivia answers in parentheses with article prefixes\n\n" }, { "from": "human", "value": "\nimport unittest\n\nfrom units.trivia import check_answer\n\n\nclass TestCheckAnswer(unittest.TestCase):\n\n def test_correct_answer(self):\n self.assert...
python
chosen
[ { "from": "system", "value": "Increment dev version, expect push to PyPi\n" }, { "from": "human", "value": "# mpf-monitor\n__version__ = '0.54.0-dev.0'\n__short_version__ = '0.54'\n__bcp_version__ = '1.1'\n__config_version__ = '5'\n__mpf_version_required__ = '0.54.0-dev.0'\n\nversion = \"MPF Mon...
python
chosen
[ { "from": "system", "value": "[docs/hugo] Move to hugo version 0.82.0\n\nWhen adding more pinmux signals and pads, we run into a\nfunny error where HUGO can't read the generated pinmux register\ndocumentation anymore since the file is too big. This file\nlimitation has just recently (3 months ago) been remo...
python
chosen
[ { "from": "system", "value": "Allow `\"` to appear in string literals\n" }, { "from": "human", "value": "#!/usr/bin/env python\n\nfrom nodes import Node\n\nclass StringLiteral(Node):\n args = 0\n results = 1\n char = '\"'\n\n def __init__(self, string):\n self.string = string\...
python
chosen
[ { "from": "system", "value": "Add support for testing with pymysql\n" }, { "from": "human", "value": "#!/usr/bin/env python\nimport os\nimport sys\n\nif __name__ == \"__main__\":\n os.environ.setdefault(\"DJANGO_SETTINGS_MODULE\", \"testproject.settings\")\n\n from django.core.management i...
python
chosen
[ { "from": "system", "value": "Rework tmpdir for nose (no pytest)\n" }, { "from": "human", "value": "import fiona\n\n\ndef test_profile():\n with fiona.open('tests/data/coutwildrnp.shp') as src:\n assert src.meta['crs_wkt'] == 'GEOGCS[\"GCS_WGS_1984\",DATUM[\"WGS_1984\",SPHEROID[\"WGS_8...
python
chosen
[ { "from": "system", "value": "Fix test to specify file format\n" }, { "from": "human", "value": "# standard modules\nimport StringIO\nfrom unittest import TestCase\n\n# custom modules\nfrom iago.DatabaseProvider import DB\n\n\nclass TestDB(TestCase):\n\tdef test_read_empty(self):\n\t\ts = String...
python
chosen
[ { "from": "system", "value": "Add library property to series search index\n" }, { "from": "human", "value": "from haystack import indexes\nfrom books.models import Book, Series\n\n\nclass BookIndex(indexes.SearchIndex, indexes.Indexable):\n\n text = indexes.CharField(document=True, use_templa...
python
chosen
[ { "from": "system", "value": "Complete walk of polynomial degrees to find most balance between under and overfitting\n" }, { "from": "human", "value": "import numpy as np\nfrom sklearn.pipeline import Pipeline\nfrom sklearn.preprocessing import PolynomialFeatures\nfrom sklearn.linear_model impor...
python
chosen
[ { "from": "system", "value": "Add a test for default config settings.\n" }, { "from": "human", "value": "import os\nimport stat\n\nfrom nose.tools import *\n\nfrom lctools import config\n\nclass TestConfig(object):\n test_filename = \"bebebe\"\n\n def setup(self):\n fd = open(self.t...
python
chosen
[ { "from": "system", "value": "Update user model with confirmed and confirmed_at\n" }, { "from": "human", "value": "import datetime\n\nfrom project import db, bcrypt\n\n\nclass User(db.Model):\n\n __tablename__ = \"users\"\n\n id = db.Column(db.Integer, primary_key=True)\n email = db.Col...
python
chosen
[ { "from": "system", "value": "Fix bug with list formatting\n\nBefore it would completely fail to format any list of strings\n" }, { "from": "human", "value": "from enum import Enum, unique\nfrom inspect import signature, isclass\n\nfrom mycroft.plugin.base_plugin import BasePlugin\nfrom mycroft....
python
chosen
[ { "from": "system", "value": "Sort out the server announce message\n\nTidy up the server announce message a bit. In particular, we might as\nwell announce the absent-entries capability - we support the commands\neven if they currently aren't implemented.\n" }, { "from": "human", "value": "\nimp...
python
chosen
[ { "from": "system", "value": "Exit program if exception is raised\n" }, { "from": "human", "value": "import os, pkgutil, site\n\nif pkgutil.find_loader(\"gi\"):\n try:\n import gi\n print('Found gi:', os.path.abspath(gi.__file__))\n gi.require_version('Gst', '1.0')\n ...
python
chosen
[ { "from": "human", "value": "Write a full test suite for override_settings\n" }, { "from": "gpt", "value": "from django.conf import settings\nfrom django.test import TestCase\nfrom override_settings import (\n override_settings, SETTING_DELETED, with_apps, without_apps)\n\n@override_settings(...
python
chosen
[ { "from": "system", "value": "Add dynamic links to GMN home page from 404 and 500 HTML templates\n" }, { "from": "human", "value": "# -*- coding: utf-8 -*-\n\n# This work was created by participants in the DataONE project, and is\n# jointly copyrighted by participating institutions in DataONE. F...
python
chosen
[ { "from": "system", "value": "Update favicon on UniqueFeed update\n" }, { "from": "human", "value": "from django.conf import settings\nfrom django.db import connection\n\nfrom ..tasks import raven\n\n\n@raven\ndef update_feed(feed_url, use_etags=True):\n from .models import UniqueFeed\n Un...
python
chosen
[ { "from": "system", "value": "Remove now unnecessary quit() method from ExampleGame\n" }, { "from": "human", "value": "from pygametemplate import Game\n\n\nclass ExampleGame(Game):\n\n def logic(self):\n pass\n\n def draw(self):\n pass\n\n def quit(self):\n pass\n" ...
python
chosen
[ { "from": "system", "value": "Add tweets model to models init file, for db setup to see it.\n" }, { "from": "human", "value": "\"\"\"\nInitialisation file for models directory.\n\nThe application SQLite database model is setup in SQLObject.\n\nThe db model structure is:\n * Place\n - contains...
python
chosen
[ { "from": "system", "value": "Add links to profiles and clean up chart options\n" }, { "from": "human", "value": "import pygal\n\n\ndef horizontal_bar(sorted_streaks, sort_attrib):\n \"\"\"\n Render a horizontal bar chart of streaks.\n\n Values have already been sorted by sort_attrib.\n...
python
chosen
[ { "from": "system", "value": "Fix a broken constant name, should be CLOUDFILES_UK.\n\n\ngit-svn-id: 353d90d4d8d13dcb4e0402680a9155a727f61a5a@1101075 13f79535-47bb-0310-9956-ffa450edef68\n" }, { "from": "human", "value": "# Licensed to the Apache Software Foundation (ASF) under one or more\n# con...
python
chosen
[ { "from": "system", "value": "Revert skipif markers to use correct reasons (bug fixed in pytest)\n" }, { "from": "human", "value": "#!/usr/bin/env python\n# -*- coding: utf-8 -*-\n\n\"\"\"\nskipif_markers\n--------------\n\nContains pytest skipif markers to be used in the suite.\n\"\"\"\n\nimpor...
python
chosen
[ { "from": "system", "value": "Add test for bijection init from list of pairs\n" }, { "from": "human", "value": "\"\"\"Test bijection class.\"\"\"\nimport pytest\n\nfrom collections_extended.bijection import bijection\n\n\ndef test_bijection():\n\t\"\"\"General tests for bijection.\"\"\"\n\tb = b...
python
chosen
[ { "from": "system", "value": "Fix filename template tag docstring\n" }, { "from": "human", "value": "from pathlib import Path\n\nfrom django import template\nfrom django.template.defaultfilters import stringfilter\n\nregister = template.Library()\n\n\n@register.filter\n@stringfilter\ndef filenam...
python
chosen
[ { "from": "system", "value": "Make heroku debug settings environ dependent" }, { "from": "human", "value": "import os\n\nDEBUG = True\nASSETS_DEBUG = True\n\n# GRANO_HOST = 'http://localhost:5000'\n# GRANO_APIKEY = '7a65f180d7b898822'\n# GRANO_PROJECT = 'kompromatron_C'\n\nGRANO_HOST = os.enviro...
python
chosen
[ { "from": "system", "value": "Update module name as changed in last module version.\n" }, { "from": "human", "value": "# -*- coding: utf-8 -*-\n# © 2016 Antiun Ingeniería S.L. - Jairo Llopis\n# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).\n{\n \"name\": \"Excerpt + Image in E...
python
chosen
[ { "from": "system", "value": "Add blink LED. TODO: Test on raspberry pi hardware.\n" }, { "from": "human", "value": "#!/usr/bin/env python\n\nfrom thing import PiThing\n\n\n# Instantiate a PiThing\npi_thing = PiThing()\n\n# Get the current switch state\nswitch = pi_thing.read_switch()\nprint('Sw...
python
chosen
[ { "from": "system", "value": "Fix bdist_rpm for path names containing spaces.\n" }, { "from": "human", "value": "\nfrom distutils.command.install import *\nfrom distutils.command.install import install as old_install\n\nclass install(old_install):\n\n def finalize_options (self):\n old...
python
chosen
[ { "from": "system", "value": "Use raw_id_fields for users and snippets.\n" }, { "from": "human", "value": "from django.contrib import admin\n\nfrom cab.models import Language, Snippet, SnippetFlag\n\n\nclass LanguageAdmin(admin.ModelAdmin):\n prepopulated_fields = {'slug': ['name']}\n\n\nclas...
python
chosen
[ { "from": "system", "value": "Correct for None appearing in requirements list\n" }, { "from": "human", "value": "#!/usr/bin/env python\n\n\"\"\"\nInstall the packages you have listed in the requirements file you input as\nfirst argument.\n\"\"\"\n\nfrom __future__ import (absolute_import, divisi...
python
chosen
[ { "from": "system", "value": "Use dateutil to calculate age of container." }, { "from": "human", "value": "#!/usr/bin/env python\nfrom __future__ import print_function\n\nfrom argparse import ArgumentParser\nfrom datetime import (\n datetime,\n timedelta,\n )\nimport json\nimport os\nim...
python
chosen
[ { "from": "system", "value": "Change the search path to look locally\n\nIn order to use tools/build.py, we need to search\nlocally for imports.\n\nCloses-bug: #1592030\nChange-Id: Idfa651c1268f93366de9f4e3fa80c33be42c71c3\n" }, { "from": "human", "value": "#!/usr/bin/env python\n\n# Licensed und...
python
chosen
[ { "from": "system", "value": "Fix script for validating trees\n\n\nFormer-commit-id: e6409f5a586d34a3bcb03b2d55afc9b220aebe04" }, { "from": "human", "value": "#! /usr/bin/env python3\n\n\"\"\"Test whether given Newick/NHX trees are valid for ProPhyle.\n\nAuthor: Karel Brinda <kbrinda@hsph.harvar...
python
chosen
[ { "from": "system", "value": "Use pathlib in the target\n" }, { "from": "human", "value": "#!/usr/bin/env python\n\n\nimport json\nfrom os import scandir\nfrom os.path import (\n join as path_join,\n basename as to_basename,\n splitext,\n exists\n)\n\nimport ptt_core\nl = ptt_core.l\...
python
chosen
[ { "from": "system", "value": "[IMP][hr_family] Use the same selection like employee\n" }, { "from": "human", "value": "# -*- coding:utf-8 -*-\n#\n#\n# Copyright (C) 2011,2013 Michael Telahun Makonnen <mmakonnen@gmail.com>.\n# All Rights Reserved.\n#\n# This program is free software: you...
python
chosen
[ { "from": "system", "value": "Update frebsd-pkg-audit to rely on yaml data and take data from hubble.py\n" }, { "from": "human", "value": "# -*- encoding: utf-8 -*-\n'''\nHubble Nova plugin for FreeBSD pkgng audit\n\n:maintainer: HubbleStack\n:maturity: 20160421\n:platform: FreeBSD\n:requires: S...
python
chosen
[ { "from": "system", "value": "Change argument name to stop probable name clash.\n" }, { "from": "human", "value": "from django.contrib.contenttypes.models import ContentType\n\n\n# USEFUL FUNCTIONS FOR FLUENT CONTENTS #############################################################\n\n# Fluent Cont...
python
chosen
[ { "from": "system", "value": "Fix that damn obfuscated python\n" }, { "from": "human", "value": "#!/usr/bin/env python2\n(lambda _, __, ___, ____, _____, ______, _______, ________:\n getattr(\n __import__(True.__class__.__name__[_] + [].__class__.__name__[__]),\n ().__class__.__...
python
chosen
[ { "from": "system", "value": "Add method listing all the protocols\n" }, { "from": "human", "value": "from django.shortcuts import render\nfrom django.conf.urls import *\nfrom django.contrib.auth.decorators import user_passes_test\n\n\nfrom .forms import ProtocolForm, TopicFormSet\n\n\ndef can_a...
python
chosen
[ { "from": "system", "value": "[IMP] Set Picking Type in Create\n\n[IMP] Flake8\n" }, { "from": "human", "value": "# Copyright 2019 Open Source Integrators\n# License LGPL-3.0 or later (https://www.gnu.org/licenses/lgpl.html).\n\nfrom odoo import api, fields, models\n\n\nclass StockRequestOrder(m...
python
chosen
[ { "from": "system", "value": "Fix OBO serializer assuming `Ontology._terms` is properly ordered\n" }, { "from": "human", "value": "import io\nfrom typing import BinaryIO, ClassVar\n\nfrom ..term import Term, TermData\nfrom ..relationship import Relationship, RelationshipData\nfrom ._fastobo impo...
python
chosen
[ { "from": "system", "value": "Fix to work on Sanic 0.7\n\nSanic 0.7 changed the logger name and is now using the 'root' logger (instead of 'sanic').\r\nI think it is better to import it directly from Sanic than to use `logging.getLogger` to avoid this kind of problem in the future..." }, { "from": "...
python
chosen
[ { "from": "system", "value": "Enable support for the parallel dbscan.\n" }, { "from": "human", "value": "if __name__ == '__main__':\n from NeuroIO import NeuroIO\n from PreProcess import PreProcess\n from Cluster import Cluster\n\n neuroread = NeuroIO(r\"C:\\Users\\USERNAME\\Download...
python
chosen