conversations
listlengths
2
3
source
stringclasses
1 value
stack
stringclasses
1 value
[ { "from": "system", "value": "Implement very simple main executor\n" }, { "from": "human", "value": "import sys\n\nfrom piper.core import Piper\n\n\ndef main():\n # TODO: dat argparse\n env_key = sys.argv[1]\n set_key = sys.argv[2]\n\n piper = Piper(env_key, set_key)\n piper.setup...
python
chosen
[ { "from": "system", "value": "Fix watchmedo tests in Windows\n\nUnexpectedly, but on test_load_config_invalid running, PyYAML get_single_data() raises different execptions for Linux and Windows. This PR adds ScannerError for passing tests under Windows." }, { "from": "human", "value": "# -*- cod...
python
chosen
[ { "from": "system", "value": "Expand default testing on new object types\n" }, { "from": "human", "value": "import cybox.utils\n\n\nclass ObjectTestCase(object):\n \"\"\"A base class for testing all subclasses of ObjectProperties.\n\n Each subclass of ObjectTestCase should subclass both un...
python
chosen
[ { "from": "system", "value": "Improve import of spaCy, to prevent cycles\n" }, { "from": "human", "value": "import numpy\ntry:\n import spacy\nexcept ImportError:\n spacy = None\n\nSPACY_MODELS = {}\nVECTORS = {}\n\n\ndef get_spacy(lang, **kwargs):\n global SPACY_MODELS\n if spacy is...
python
chosen
[ { "from": "system", "value": "Add secret key for session use\n" }, { "from": "human", "value": "from flask import Flask\nfrom flask.ext.sqlalchemy import SQLAlchemy\nfrom flask.ext.socketio import SocketIO\nimport os\n\n# The main application folder\n_basedir = os.path.abspath(os.path.dirname('....
python
chosen
[ { "from": "system", "value": "Add applyPhonotactics() and use it in generation\n" }, { "from": "human", "value": "import random\n\n\ndef generateWord(meaning, form, categories, settings, formrules=None):\n '''Takes an English string, desired form, generation\n categories, settings, and opt...
python
chosen
[ { "from": "system", "value": "Add compression and integrity checks\n" }, { "from": "human", "value": "from msgpack import packb, Unpacker\nfrom snappy import compress, decompress # noqa\nfrom btree import Tree, Node, Leaf, LazyNode\n\n\ndef encode_btree(obj):\n if isinstance(obj, (Tree, Node...
python
chosen
[ { "from": "system", "value": "Use full path in case the working dir is not the same\n" }, { "from": "human", "value": "#!/usr/bin/env python\n# -*- coding: utf-8 -*-\nimport os\nimport sys\n\nimport environ\n\nif __name__ == \"__main__\":\n if os.path.isfile('.env'):\n environ.Env.read...
python
chosen
[ { "from": "system", "value": "Remove the unnecessary capturing group.\n" }, { "from": "human", "value": "# -*- coding: utf-8 -*-\nimport re\nfrom . import export\n\n@export\ndef fuzzyfinder(text, collection):\n \"\"\"\n Args:\n text (str): A partial string which is typically entered...
python
chosen
[ { "from": "system", "value": "Update tests to reflect title change\n" }, { "from": "human", "value": "from flask import url_for\nimport pytest\nfrom selenium.webdriver.common.by import By\nfrom selenium.webdriver.support import expected_conditions\nfrom selenium.webdriver.support.wait import Web...
python
chosen
[ { "from": "system", "value": "Fix variable names in __all__\n" }, { "from": "human", "value": "from luigi_td.bulk_import import BulkImport\nfrom luigi_td.client import ResultProxy\nfrom luigi_td.config import Config, get_config\nfrom luigi_td.task import DatabaseTask, TableTask, Query\nfrom luig...
python
chosen
[ { "from": "system", "value": "Remove docstring which only repeats the readme\n" }, { "from": "human", "value": "\"\"\"\nPykka is a concurrency abstraction which makes actors look like regular\nobjects.\n\nSee http://jodal.github.com/pykka/ for more information.\n\"\"\"\n\nfrom pykka.actor import...
python
chosen
[ { "from": "system", "value": "Create approval file path that works on Linux and Windows.\n" }, { "from": "human", "value": "import inspect\nimport os\n\n\nclass Namer(object):\n ClassName = ''\n MethodName = ''\n Directory = ''\n\n def setForStack(self, caller):\n stackFrame =...
python
chosen
[ { "from": "system", "value": "Add a function to normalize the feature vectors\n" }, { "from": "human", "value": "import numpy as np\n\ndef extract_features(image, measurements):\n\t\"\"\"\n\tGiven an image as a Numpy array and a set of measurement objects\n\timplementing a compute method returni...
python
chosen
[ { "from": "system", "value": "Add test for errors, but User fields need to become required first\n" }, { "from": "human", "value": "from django.test import TestCase\nfrom api.views.signup import signup\nfrom rest_framework.test import APIRequestFactory\n\nfrom api import factories, serializers\n...
python
chosen
[ { "from": "system", "value": "Add additional application for gunicorn.\n" }, { "from": "human", "value": "from app.main import bundle_app # noqa\n\n# NOTE: uncomment out while genrating migration\n# app = bundle_app({'MIGRATION': True})\n" }, { "from": "gpt", "value": "import os\nfro...
python
chosen
[ { "from": "system", "value": "Remove staging from supported profiles\n" }, { "from": "human", "value": "# -*- coding: utf-8 -*-\n\nfrom os import environ, path\n\nfrom ._settings_default import *\nfrom ..exceptions import ImproperlyConfigured\n\nPROFILE = environ.get(\"GOLD_DIGGER_PROFILE\", \"l...
python
chosen
[ { "from": "system", "value": "Revert \"Revert \"Use clang on mac if XCode >= 4.5\"\"\n\nThe V8 dependency has been removed, so we should be able to enable clang on mac\nagain.\n\nR=ricow@google.com\n\nReview URL: https://codereview.chromium.org//14751012\n\ngit-svn-id: c93d8a2297af3b929165606efe145742a534bc...
python
chosen
[ { "from": "system", "value": "Fix name of an attribute and PEP8-ify\n" }, { "from": "human", "value": "#! /usr/bin/env python3\n\"\"\" A Word class\n\nOriginally obtained from the 'pharm' repository, but modified.\n\"\"\"\n\nclass Word(object):\n \n doc_id = None\n sent_id = None\n ins...
python
chosen
[ { "from": "system", "value": "Add version placeholder for now\n" }, { "from": "human", "value": "from byteaccess.byteaccess import ByteAccess, access_over_file\nfrom byteaccess.winmemaccess import access_over_process\n" }, { "from": "gpt", "value": "from byteaccess.byteaccess import ...
python
chosen
[ { "from": "system", "value": "Set MAX_MEMORY_LIMIT_IN_BYTES to number returned by cgroups where there is no limit\n" }, { "from": "human", "value": "#!/usr/bin/python\n\nenv_vars = {}\n\n\ndef read_file(path):\n try:\n with open(path, 'r') as f:\n return f.read().strip()\n ...
python
chosen
[ { "from": "system", "value": "Create NoValue class to disambiguate getattr calls\n" }, { "from": "human", "value": "from django.db.models.signals import pre_save\nfrom django.dispatch import receiver\n\n\ndef cleans_field(field_ref):\n \"\"\"Decorator to registers a field cleaning methods on ...
python
chosen
[ { "from": "system", "value": "Add __repr__ and __str__ methods to dummy object.\n" }, { "from": "human", "value": "#!/usr/bin/env python\n\n\"\"\"Simple library for parsing deeply nested structure (dict, json)\ninto regular object. You can specify fields to extract, and argument\nnames in create...
python
chosen
[ { "from": "system", "value": "Update unit tests for packager.rpm.build.py\n" }, { "from": "human", "value": "#! /usr/bin/python\n\nfrom build_rpm import BuildModelRPM\nfrom nose.tools import *\n\n@raises(TypeError)\ndef test_fail_with_no_parameters():\n BuildModelRPM(None)\n\n@raises(TypeErro...
python
chosen
[ { "from": "system", "value": "Remove useless code from the home view\n" }, { "from": "human", "value": "from django.db.models import Count\nfrom django.shortcuts import render\nfrom django.views.generic import TemplateView\nfrom django.views.generic.base import ContextMixin\n\nfrom meupet import...
python
chosen
[ { "from": "system", "value": "Make KQMLString subclass of KQMLObject.\n" }, { "from": "human", "value": "from io import BytesIO\nfrom kqml import KQMLObject\nfrom .util import safe_decode\n\nclass KQMLString(object):\n def __init__(self, data=None):\n if data is None:\n self...
python
chosen
[ { "from": "system", "value": "Fix pickle failure in PyPy\n" }, { "from": "human", "value": "# -*- coding: utf-8 -*-\n\"\"\"\n gauge\n ~~~~~\n\n Deterministic linear gauge library.\n\n :copyright: (c) 2013-2017 by What! Studio\n :license: BSD, see LICENSE for more details.\n\n\"\"\"\nfr...
python
chosen
[ { "from": "system", "value": "Undo removing `import os` statement\n" }, { "from": "human", "value": "# Setting for template directory not found by app_directories.Loader. This\n# allows templates to be identified by two paths which enables a template to be\n# extended by a template with the sam...
python
chosen
[ { "from": "system", "value": "Fix doubled-help on main command\n\nMain command was being doubly decorated with the common options. As a\nresult, it had funky looking helptext.\n" }, { "from": "human", "value": "from globus_cli.parsing import globus_main_func\n\nfrom globus_cli.login import login...
python
chosen
[ { "from": "system", "value": "Initialize char_length with a number\n\nAnd make var name `file` less ambiguous by using `file_name` instead.\n\nSigned-off-by: Stefan Marr <46f1a0bd5592a2f9244ca321b129902a06b53e03@stefan-marr.de>\n" }, { "from": "human", "value": "class SourceCoordinate(object):\n...
python
chosen
[ { "from": "system", "value": "Remove import of deleted file\n" }, { "from": "human", "value": "from __future__ import absolute_import, division, print_function\n\nfrom .core import compile\nfrom ._info import __version__\n" }, { "from": "gpt", "value": "from __future__ import absolut...
python
chosen
[ { "from": "system", "value": "Load only the active collections instead of all accessible collections\n" }, { "from": "human", "value": "import logging\nfrom flask import Blueprint, request\n\nfrom aleph.model import Collection\nfrom aleph.queues import get_active_collection_status\nfrom aleph.vi...
python
chosen
[ { "from": "system", "value": "Add request to inside of try\n" }, { "from": "human", "value": "import requests\nimport os\n\n\nclass UnauthorizedToken(Exception):\n pass\n\n\nclass UdacityConnection:\n\n def __init__(self):\n self.certifications_url = 'https://review-api.udacity.com/...
python
chosen
[ { "from": "system", "value": "Prepare for next development version\n" }, { "from": "human", "value": "from __future__ import absolute_import\nimport deployer.logger\nfrom celery.signals import setup_logging\n\n\n__version__ = '0.3.11'\n__author__ = 'sukrit'\n\ndeployer.logger.init_logging()\nset...
python
chosen
[ { "from": "system", "value": "Use list comprehension for mailjet_users list\n" }, { "from": "human", "value": "from django.core.management.base import BaseCommand\nfrom django.db import DEFAULT_DB_ALIAS\n\nfrom optparse import make_option\n\n\nclass Command(BaseCommand):\n\n option_list = Bas...
python
chosen
[ { "from": "system", "value": "Add slash to all command aliases\n" }, { "from": "human", "value": "from lib.command import Command\n\n\nclass HelpCommand(Command):\n name = 'help'\n aliases = ['start']\n description = 'Lists all bot commands and their descriptions.'\n\n def run(self, ...
python
chosen
[ { "from": "system", "value": "WIP: Make JSON containing paths and hashs\n" }, { "from": "human", "value": "import data, json, os, sys\n\ndef make_hash_dict(top):\n \"\"\"\n Returns a dictionary with file paths and corresponding hashes.\n \n Parameters\n ----------\n data : str\...
python
chosen
[ { "from": "system", "value": "[analyzer]: Improve test handling with multiple constraint managers\n\nSummary: Modify the test infrastructure to properly handle tests that require z3, and merge together the output of all tests on success. This is required for D28954.\n\nReviewers: dcoughlin, zaks.anna, NoQ, ...
python
chosen
[ { "from": "system", "value": "Add debug mode to webservice\n\nAdd main function to avoid executing the webserver in tests\n\nReorder imports\n" }, { "from": "human", "value": "import sys\nimport json\n\nfrom detectem.exceptions import SplashError, NoPluginsError\n\ntry:\n from bottle import r...
python
chosen
[ { "from": "system", "value": "Add 'marker' to the list of tests to be run\n" }, { "from": "human", "value": "# -*- coding: utf-8 -*-\n#\n__all__ = [\n 'annotate',\n 'basic_sin',\n 'circle_patch',\n 'dual_axis',\n 'errorband',\n 'errorbar',\n 'fancybox',\n 'heat',\n 'image_plot',\n 'leg...
python
chosen
[ { "from": "system", "value": "Update to dev version 2022-04-22" }, { "from": "human", "value": "\"\"\"The version number defined here is read automatically in setup.py.\"\"\"\n\n__version__ = \"0.12.1\"\n" }, { "from": "gpt", "value": "\"\"\"The version number defined here is read au...
python
chosen
[ { "from": "system", "value": "Add povisioner and stage on env API\n" }, { "from": "human", "value": "# -*- coding: utf-8 -*-\nfrom __future__ import absolute_import, unicode_literals\nfrom rest_framework import viewsets, serializers\nfrom physical import models\n\n\nclass EnvironmentSerializer(s...
python
chosen
[ { "from": "system", "value": "Write a proper Turtle linter\n" }, { "from": "human", "value": "#!/usr/bin/env python\n# -*- encoding: utf-8 -*-\n\"\"\"\nThis script takes the path to a directory, and looks for any Turtle files\n(https://www.w3.org/TeamSubmission/turtle/), then uses RDFLib to chec...
python
chosen
[ { "from": "system", "value": "Fix bug when parse version info\n" }, { "from": "human", "value": "#!/usr/bin/env python\n\nimport os\n\nfrom .data_format import dumps\n\n\nclass RemoteRepo(object):\n def __init__(self, repo_dir):\n self.repo_dir = repo_dir\n\n # initial setup\n ...
python
chosen
[ { "from": "system", "value": "Make published mashups visibles to all users\n" }, { "from": "human", "value": "# -*- coding: utf-8 -*-\n\n# Copyright 2012 Universidad Politécnica de Madrid\n\n# This file is part of Wirecloud.\n\n# Wirecloud is free software: you can redistribute it and/or modify\...
python
chosen
[ { "from": "system", "value": "Update user, fight foreign key dependency\n" }, { "from": "human", "value": "from config import PASSWORD_LENGTH\nfrom sqlalchemy import BigInteger, Column, ForeignKey, String\nfrom sqlalchemy.ext.declarative import declarative_base\n\nBase = declarative_base()\n\n\n...
python
chosen
[ { "from": "system", "value": "Clean up for production Linux use\n" }, { "from": "human", "value": "\nfrom gi.repository import GLib, Notify as LibNotify\n\n\nclass Notification(object):\n\n def __init__(self, title, message, subtitle=None, sticky=False):\n self.title = title\n s...
python
chosen
[ { "from": "system", "value": "Change the third item of the search_field from 'mac' to 'mac1' \n\n" }, { "from": "human", "value": "from django.contrib import admin\nfrom django.db import models\n\nfrom Machine import models as mmod\n\nclass ContactInLine(admin.TabularInline):\n model = mmod....
python
chosen
[ { "from": "system", "value": "Add ui module to path\n" }, { "from": "human", "value": "__all__ = ['algorithms', 'dialogs', 'exporter', 'legend', 'mainui', 'puplot', 'tsplot', 'utils']\n" }, { "from": "gpt", "value": "__all__ = ['algorithms', 'dialogs', 'exporter', 'legend', 'mainui',...
python
chosen
[ { "from": "system", "value": "Replace the particular boolean returns with a boolean expression on is_winner\n" }, { "from": "human", "value": "#!/usr/bin/env python\nfrom abc import ABCMeta, abstractmethod\nfrom game.gameboard import GameBoard\n\nclass Player(object):\n __metaclass__ = ABCMet...
python
chosen
[ { "from": "system", "value": "Cut number of lines in half\n\n@The-Penultimate-Defenestrator use of sets is a nice optimization!\r\n\r\n# improvement liberally borrowed from:\r\n# https://forum.omz-software.com/topic/2784/feature-request-pythonista-built-in-file-picker" }, { "from": "human", "val...
python
chosen
[ { "from": "system", "value": "Simplify py 2/3 unicode string helper\n" }, { "from": "human", "value": "import datetime\nimport os\nimport sys\nimport time\n\nfrom dear_astrid.constants import *\nfrom dear_astrid.constants import __all__ as _constants_all\nfrom dear_astrid.tzinfo import *\nfrom d...
python
chosen
[ { "from": "system", "value": "Speed up deep copy of fields\n" }, { "from": "human", "value": "# -*- coding: utf-8 -*-\n'''Abstract base classes.\n\nThese are necessary to avoid circular imports between core.py and fields.py.\n'''\n\n\nclass FieldABC(object):\n '''Abstract base class from whic...
python
chosen
[ { "from": "system", "value": "Add RestPoseError and CheckPointExpiredError to top-level module symbols\n" }, { "from": "human", "value": "# -*- coding: utf-8 -\n#\n# This file is part of the restpose python module, released under the MIT\n# license. See the COPYING file for more information.\n\...
python
chosen
[ { "from": "system", "value": "Fix template var exports for directors\n" }, { "from": "human", "value": "from flask import render_template as flask_render_template\nfrom db.models import EvalSettings\n\nfrom util.ldap import ldap_is_active\nfrom util.ldap import ldap_is_alumni\nfrom util.ldap imp...
python
chosen
[ { "from": "system", "value": "Change block init test to pass bytes for hash\n" }, { "from": "human", "value": "import unittest\n\nfrom block import Block\n\n\nclass TestBlock(unittest.TestCase):\n class MerkleTreeMock:\n pass\n\n def test_init(self):\n prev = 0x123123\n ...
python
chosen
[ { "from": "system", "value": "Increase page size again in station-sensor link / reading migration, and add a percent indicator. Exclude any readings that have previously been fixed up by the migration.\n" }, { "from": "human", "value": "# -*- coding: utf-8 -*-\n# Generated by Django 1.10.6 on 20...
python
chosen
[ { "from": "system", "value": "Fix import style for Python3\n" }, { "from": "human", "value": "\"\"\"EditorConfig Python Core\"\"\"\n\nfrom versiontools import join_version\n\nVERSION = (0, 11, 0, \"final\")\n\n__all__ = ['get_properties', 'EditorConfigError', 'exceptions']\n\n__version__ = join_...
python
chosen
[ { "from": "system", "value": "Use https instead http to get secure resources content in blog over https" }, { "from": "human", "value": "\"\"\"\nGravatar plugin for Pelican\n===========================\n\nThis plugin assigns the ``author_gravatar`` variable to the Gravatar URL and\nmakes the var...
python
chosen
[ { "from": "system", "value": "Add larger scale to match C config only map\n" }, { "from": "human", "value": "\n\nimport sys\n\nfrom casa_tools import myclean\n\n'''\nCleans an MS with a single channel given a mask and a model\n'''\n\nvis_1 = sys.argv[-5]\nvis_2 = sys.argv[-4]\nmodel = sys.argv[-...
python
chosen
[ { "from": "system", "value": "Use a simple counter rather than appending booleans to a list and counting them.\n" }, { "from": "human", "value": "\"\"\"Tests for refleaks.\"\"\"\n\nfrom cherrypy._cpcompat import HTTPConnection, HTTPSConnection, ntob\nimport threading\n\nimport cherrypy\n\n\ndata...
python
chosen
[ { "from": "system", "value": "Fix regression test after EDF+ annotation fix in 60753f.\n" }, { "from": "human", "value": "import schalk_physiobank\n\ndef test_s1():\n r = schalk_physiobank.load(1)\n assert str(r) == 'Recording \"schalk-physiobank-s1\" (64 channels x 259520 '\\\n 'samples) a...
python
chosen
[ { "from": "system", "value": "Fix InstitutionForm to include jst field\n" }, { "from": "human", "value": "# -*- coding: utf-8 -*-\nfrom atom.forms import SingleButtonMixin\nfrom braces.forms import UserKwargModelFormMixin\nfrom django import forms\n\nfrom .models import Institution\n\n\nclass In...
python
chosen
[ { "from": "system", "value": "Make print_filelist sort the list before printing\n" }, { "from": "human", "value": "import click\n\ndef print_message(message):\n print message\n\n\ndef print_filelist(header, filelist, colour=None):\n click.echo(header)\n\n for line in filelist:\n ...
python
chosen
[ { "from": "system", "value": "Move api auth url to api_patterns\n" }, { "from": "human", "value": "from django.conf.urls import url, include\nfrom rest_framework.authtoken.views import obtain_auth_token\nfrom . import views\n\nurlpatterns = [\n url(r'^generate_pdf/(?P<bill_id>\\d+)$', views.g...
python
chosen
[ { "from": "system", "value": "Fix defaultRenderLayer was not included when blasting all layers.\n" }, { "from": "human", "value": "# -*- coding: utf-8 -*-\nfrom contextlib import contextmanager\n\nimport maya.app.renderSetup.model.renderSetup as renderSetup\nfrom maya import cmds\n\n\n@contextma...
python
chosen
[ { "from": "system", "value": "Use correct database name instead of None when not supplied.\n" }, { "from": "human", "value": "#!/usr/bin/env python\n\nimport os\nfrom six.moves.urllib_parse import urlparse\n\n\ndef from_docker_envvars(config):\n # linked postgres database (link name 'pg' or '...
python
chosen
[ { "from": "system", "value": "TST: Update for unit tests for PR 37\n" }, { "from": "human", "value": "\"\"\" Unit tests for grid_utils module. \"\"\"\n\nfrom datetime import datetime\nimport numpy as np\n\nfrom tint import grid_utils\nfrom tint.testing.sample_objects import grid, field\nfrom tin...
python
chosen
[ { "from": "system", "value": "Add PULLREQ_EDITMSG for hub pull requests\n" }, { "from": "human", "value": "\"\"\"Git Commit Auto Save.\n\nSublime Text 3 package to auto save commit messages when the window is closed.\nThis allows the user to close the window without having to save before,\nor ha...
python
chosen
[ { "from": "system", "value": "Address review comment: Make more APIs public.\n" }, { "from": "human", "value": "# Copyright Hybrid Logic Ltd. See LICENSE file for details.\n\n\"\"\"\nInfrastructure for publishing a REST HTTP API.\n\"\"\"\n\nfrom ._infrastructure import structured\n\n\n__all__ =...
python
chosen
[ { "from": "system", "value": "Fix CameraDevice's send method is not called\n\nAdd send method @gen.coroutine decorator" }, { "from": "human", "value": "from gateway import net\n\n\nclass CameraDevice(object):\n def __init__(self, stream, address):\n self.resolution = None\n self...
python
chosen
[ { "from": "system", "value": "Fix handling of All() exceptions. " }, { "from": "human", "value": "import re\nimport colander\nfrom colander import Invalid\n\nfrom grano.logic.references import ProjectRef\nfrom grano.core import db\nfrom grano.model import Schema, Attribute\n\n\nFORBIDDEN = ['pro...
python
chosen
[ { "from": "system", "value": "Fix method get on ApiKeyAuthentication\n" }, { "from": "human", "value": "#!/usr/bin/env python\n# -*- coding: utf-8 -*-\nfrom django.http import HttpResponse\nfrom django.contrib.auth import authenticate\n\nfrom piston.handler import BaseHandler as Handler\n\nfrom ...
python
chosen
[ { "from": "system", "value": "Add is_done filter for task\n" }, { "from": "human", "value": "# -*- coding: utf-8 -*-\nfrom atom.filters import CrispyFilterMixin, AutocompleteChoiceFilter\nfrom django.utils.translation import ugettext_lazy as _\nimport django_filters\nfrom .models import Task\n\n...
python
chosen
[ { "from": "system", "value": "Remove fields from method definition.\n" }, { "from": "human", "value": "# -*- coding: utf-8 -*-\n# © 2015 iDT LABS (http://www.@idtlabs.sl)\n# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).\n\nfrom openerp import fields, models, api\n\n\nclass ...
python
chosen
[ { "from": "system", "value": "Allow aplib to be imported when coro is not installed.\n" }, { "from": "human", "value": "# Copyright (c) 2002-2011 IronPort Systems and Cisco Systems\n# \n# Permission is hereby granted, free of charge, to any person obtaining a copy\n# of this software and associa...
python
chosen
[ { "from": "system", "value": "Return to original if cursor is already at least edit\n" }, { "from": "human", "value": "import sublime_plugin\n\n\n# the last edited Region, keyed to View.id\n_last_edits = {}\n\n\nclass RecordLastEdit(sublime_plugin.EventListener):\n def on_modified(self, view)...
python
chosen
[ { "from": "system", "value": "Add another user in fixture code\n" }, { "from": "human", "value": "#!/usr/bin/env python\n# -*- coding: utf-8 -*-\nfrom flask import Flask\nfrom flask_restful import Api\n\nfrom .db import configure_database\n\n\nclass Application:\n\n def __init__(self):\n ...
python
chosen
[ { "from": "system", "value": "Write the correct variable to disk\n\nMaybe I should get more sleep\n" }, { "from": "human", "value": "# -*- coding: utf-8 -*-\n'''\nGenerate a unique uuid for this host, storing it on disk so it persists across\nrestarts\n'''\nimport logging\nimport os\nimport uuid...
python
chosen
[ { "from": "system", "value": "Fix a typo in the pre-generation hooks\n" }, { "from": "human", "value": "project_slug = '{{ cookiecutter.project_slug }}'\n\nprint('pre gen')\n\nif hasattr(project_slug, 'isidentifier'):\n assert project_slug.isidentifier(), 'Project slug should be valid Python ...
python
chosen
[ { "from": "system", "value": "Handle review deletion when updating categories for a context\n" }, { "from": "human", "value": "from django.conf import settings\nfrom django.shortcuts import render\nfrom rest_framework import permissions\nfrom rest_framework.views import APIView\nfrom rest_framew...
python
chosen
[ { "from": "system", "value": "Implement merge component of merge_and_count_split\n\nThe merging part of merge_and_count_split was is taken right out\nof merge-sort. A test revealed a mistake in merge_and_sort where\n0 was returned instead of the array when the array has one\nelement, so that was fixed.\n" ...
python
chosen
[ { "from": "system", "value": "Use __getitem__ to improve readbility\n" }, { "from": "human", "value": "import hashlib\nimport urllib\n\nimport bencode\n\n\nclass Torrent(object):\n\n def __init__(self, path):\n self.encoded = self._get_meta(path)\n self.decoded = bencode.bdecode(self.enco...
python
chosen
[ { "from": "system", "value": "Add export for models module\n" }, { "from": "human", "value": "# Copyright 2022 The KerasCV 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 License.\n# You may obtain a copy ...
python
chosen
[ { "from": "system", "value": "Return full osascript output from getCurrentConfig\n" }, { "from": "human", "value": "import configmanager\nimport osascript\n\nAPP_CONFIG_PATH = \"../applications/\"\n\napplicationConfigs = configmanager.ConfigManager(APP_CONFIG_PATH)\n#TODO: Make this user choosab...
python
chosen
[ { "from": "system", "value": "Fix unit test for seo faces url\n" }, { "from": "human", "value": "from django.test import TestCase\nfrom functional_tests.factory import FaceFactory\n\n\nclass Facetest(TestCase):\n def setUp(self):\n self.face = FaceFactory(title='Lokesh')\n\n def tes...
python
chosen
[ { "from": "system", "value": "Use module aifc instead of module aiff.\n" }, { "from": "human", "value": "import sys\nimport readcd\nimport aiff\nimport AL\nimport CD\n\nError = 'cdaiff.Error'\n\ndef writeaudio(a, type, data):\n\ta.writesampsraw(data)\n\ndef main():\n\tif len(sys.argv) > 1:\n\t\t...
python
chosen
[ { "from": "system", "value": "Allow filtering and ordering on API\n" }, { "from": "human", "value": "from django.conf.urls.defaults import url\n\nfrom tastypie.resources import ModelResource\nfrom jmbo.api import ModelBaseResource\n\nfrom music.models import Track\n\n\nclass TrackResource(ModelB...
python
chosen
[ { "from": "system", "value": "Add version string to libcloud\n\ngit-svn-id: 353d90d4d8d13dcb4e0402680a9155a727f61a5a@895867 13f79535-47bb-0310-9956-ffa450edef68\n" }, { "from": "human", "value": "# Licensed to the Apache Software Foundation (ASF) under one or more\n# contributor license agreemen...
python
chosen
[ { "from": "system", "value": "Add awarding criteria field to configurator\n" }, { "from": "human", "value": "# -*- coding: utf-8 -*-\nfrom openprocurement.tender.openeu.adapters import TenderAboveThresholdEUConfigurator\nfrom openprocurement.tender.esco.models import Tender\n\n\nclass TenderESCO...
python
chosen
[ { "from": "system", "value": "Make the rate-limiting test more fancy\n" }, { "from": "human", "value": "from seleniumbase import BaseCase\nfrom seleniumbase.common import decorators\n\n\nclass MyTestClass(BaseCase):\n\n @decorators.rate_limited(4) # The arg is max calls per second\n def p...
python
chosen
[ { "from": "system", "value": "4: Create script to save documentation to a file \n\nTask-Url: http://github.com/stoeps13/ibmcnx2/issues/issue/4" }, { "from": "human", "value": "######\n# Check ExId (GUID) by Email through JDBC\n#\n# Author: Christoph Stoettner\n# Mail: christop...
python
chosen
[ { "from": "system", "value": "Raise UnsupportedScheduler if specific scheduler for submit is not\nsupported (Now just swf is supported).\n" }, { "from": "human", "value": "#!/usr/bin/env python3\n# -*- coding: utf-8 -*-\n\n\"\"\"Helper functions.\n\"\"\"\n\n# built-in modules\nimport json\n\n# l...
python
chosen
[ { "from": "system", "value": "Add type annotations to MockStorageAdapter methods\n" }, { "from": "human", "value": "\"\"\"adapter\n\nMock storage adapter class for unit tests\n\"\"\"\nclass MockStorageAdapter:\n \"\"\"Mock storage adapter class.\n\n Will be patched for testing purposes\n ...
python
chosen
[ { "from": "system", "value": "Fix spelling of exponential in pydoc" }, { "from": "human", "value": "# coding:utf-8\n\nimport itertools\n\n\ndef expo(base=2, factor=1, max_value=None):\n \"\"\"Generator for exponential decay.\n\n Args:\n base: The mathematical base of the exponentiat...
python
chosen
[ { "from": "system", "value": "Send the output to a tmp file\n" }, { "from": "human", "value": "\"\"\"\nCloudify plugin for running a simple bash script.\n\nOperations:\n start: Run a script\n\"\"\"\n\nfrom celery import task\nfrom cosmo.events import send_event as send_riemann_event\nfrom clo...
python
chosen
[ { "from": "system", "value": "Use Li method for thresholding instead of Otsu\n" }, { "from": "human", "value": "import numpy as np\nfrom scipy import ndimage as ndi\nfrom skimage.filters import threshold_otsu\n\n\ndef _extract_roi(image, axis=-1):\n max_frame = np.max(image, axis=axis)\n i...
python
chosen
[ { "from": "system", "value": "Allow HTTP auth during tests\n" }, { "from": "human", "value": "from django.utils.translation import ugettext as _\nfrom django_digest import HttpDigestAuthenticator\nfrom rest_framework.authentication import (\n BaseAuthentication, get_authorization_header,\n ...
python
chosen
[ { "from": "system", "value": "Set container_id and ext_ip container serf tags.\n" }, { "from": "human", "value": "#!/usr/bin/env python -B\n\nfrom optparse import OptionParser\nimport inspect\nimport json\nimport os\n\ndef get_port_mappings(container):\n script_dir = os.path.dirname(os.path.abs...
python
chosen
[ { "from": "system", "value": "Update pymake version and post twine\n" }, { "from": "human", "value": "\"\"\"cppmake auto-generates a big CMake file from C++ headers\n\"\"\"\nimport setuptools\n\ndescription = \"Python Super CMake\"\n\nsetuptools.setup(\n name='generate_cmake',\n version='1...
python
chosen