conversations
listlengths
2
3
source
stringclasses
1 value
stack
stringclasses
1 value
[ { "from": "system", "value": "Add add function taking a functor as input to process connected primitives\n" }, { "from": "human", "value": "\"\"\"@package Primitive\nThis module provides an abstraction of the relationGraph using networkX\n\n\"\"\"\n\nimport networkx as nx\nimport packages.primit...
python
chosen
[ { "from": "system", "value": "Allow the url to be accessed with or without a / on the end\n" }, { "from": "human", "value": "# !/usr/bin/env python\n# encoding: utf-8\n#\n# This file is part of ckanext-nhm\n# Created by the Natural History Museum in London, UK\n\nfrom flask import Blueprint\n\nf...
python
chosen
[ { "from": "system", "value": "Add a comment for the get_password_emacs function\n\nComment necessary because the format of authinfo needs to match the\nsemi-brittle regex (ah, regexes...)\n\nThis also moves the file to a proper dotfile, similar to commit\n42f2b513a7949edf901b18233c1229bfcc24b706\n" }, {...
python
chosen
[ { "from": "system", "value": "Add parent(), left() & right()\n" }, { "from": "human", "value": "from __future__ import absolute_import\nfrom __future__ import division\nfrom __future__ import print_function\n\n\nclass MaxPriorityQueue(object):\n\t\"\"\"Max Priority Queue.\"\"\"\n\tdef __init__(s...
python
chosen
[ { "from": "system", "value": "TODO: ADD FUNCTIONS AND ARGUMENTS. YOU'LL PROBABLY NEED TO DEBUG\n" }, { "from": "human", "value": " #!/ usr/bin/python\n\n#Black Hat Python\n#SSH with Paramiko\n#pg 26\n\nimport threading, paramiko, subprocess\n\ndef ssh_command(ip, user, passwd, command):\n\tclie...
python
chosen
[ { "from": "system", "value": "Add some tests that don't pass yet\n" }, { "from": "human", "value": "def test_distribution():\n from mle import Normal, var, par\n import theano.tensor as T\n\n x = var('x')\n mu = par('mu')\n sigma = par('sigma')\n\n dist = Normal(x, mu, sigma)\n...
python
chosen
[ { "from": "system", "value": "Bump version: 0.0.6 -> 0.0.7\n\n[ci skip]\n" }, { "from": "human", "value": "from conans import ConanFile\nfrom conans.tools import download, unzip\nimport os\n\nVERSION = \"0.0.6\"\n\n\nclass ToolingCMakeUtilConan(ConanFile):\n name = \"tooling-cmake-util\"\n ...
python
chosen
[ { "from": "system", "value": "Replace \"lambda blob: blob\" with \"bool\".\n\nThis is legitimate (and even an improvement) since the function is\npassed to filter, which will use its return value in a boolean\ncontext anyway.\n\nThis also cleans up a lint warning.\n" }, { "from": "human", "value...
python
chosen
[ { "from": "system", "value": "Add line at the end of example\n" }, { "from": "human", "value": "import time\n\nfrom osbrain import run_nameserver\nfrom osbrain import run_agent\n\n\n# Simple handler for example purposes\ndef set_received(agent, message, topic=None):\n agent.received = message...
python
chosen
[ { "from": "system", "value": "Write deeper test of equality for recovered dict.\n" }, { "from": "human", "value": "from kqml import cl_json, KQMLList\n\n\ndef test_parse():\n json_dict = {'a': 1, 'b': 2,\n 'c': ['foo', {'bar': None, 'done': False}],\n 'this_is_...
python
chosen
[ { "from": "system", "value": "TST: Test case for newly reported bug\n\nThis was reported by Alexandre Harano.\n" }, { "from": "human", "value": "import pymorph\nimport numpy as np\ndef test_patspec():\n f = np.array([\n [0,0,0,0,0,0,0,0],\n [0,0,1,1,1,1,0,0],\n [0,1,0,1,1...
python
chosen
[ { "from": "system", "value": "Update to use partial instead of lambda function" }, { "from": "human", "value": "import six\nfrom graphql.core.type import GraphQLUnionType\n\nfrom .base import FieldsClassType, FieldsClassTypeMeta, FieldsOptions\n\n\nclass UnionTypeOptions(FieldsOptions):\n\n d...
python
chosen
[ { "from": "system", "value": "Allow querysets to be jsonified\n" }, { "from": "human", "value": "\nfrom django.core.serializers.json import DjangoJSONEncoder\nfrom django.views.decorators.cache import cache_page\nfrom django.views.generic import View\n\nfrom django.http import JsonResponse, Http...
python
chosen
[ { "from": "system", "value": "Print count summaries for Hansard by year\n" }, { "from": "human", "value": "#!/usr/bin/env python\n#\n# Give a quick summary of data which has been retrieved\n#\n\nimport argparse\nimport json\nfrom collections import Counter\nfrom pprint import pprint\n\nparser = ...
python
chosen
[ { "from": "system", "value": "Disable broken (\"for now\") views\n" }, { "from": "human", "value": "from django.conf.urls.defaults import *\n\n# Uncomment the next two lines to enable the admin:\nfrom django.contrib import admin\nadmin.autodiscover()\n\nurlpatterns = patterns('',\n (r'^search...
python
chosen
[ { "from": "system", "value": "Remove printing of topics in bridge\n" }, { "from": "human", "value": "import zmq\n\nfrom argparse import ArgumentParser\nfrom pymavlink import mavutil\n\ndef main():\n parser = ArgumentParser()\n parser.add_argument(\"--device\", help=\"MAVLink device to add ...
python
chosen
[ { "from": "system", "value": "Fix up deprecated lazy import\n" }, { "from": "human", "value": "# Copyright (c) 2008, Aldo Cortesi. All rights reserved.\n#\n# Permission is hereby granted, free of charge, to any person obtaining a copy\n# of this software and associated documentation files (the \...
python
chosen
[ { "from": "system", "value": "Complete unfinished code committed by mistake.\n" }, { "from": "human", "value": "\ndef test_filter_strings(wish):\n accept_names = wish\n names = ['has MARK', 'does not have']\n accept_pattern = '.*MARK.*'" }, { "from": "gpt", "value": "\ndef t...
python
chosen
[ { "from": "system", "value": "Update SoftwarePackageTestCase to use ObjectFactoryMixIn\n\n" }, { "from": "human", "value": "\"\"\"\nUnit tests of the Dashboard application\n\"\"\"\n\nfrom django.test import TestCase\nfrom django.db import IntegrityError\n\nfrom launch_control.dashboard_app.model...
python
chosen
[ { "from": "system", "value": "Fix group id query case\n" }, { "from": "human", "value": "import graphene\n\nfrom falmer.schema.schema import DjangoConnectionField\nfrom falmer.studentgroups.types import StudentGroup\nfrom . import types\nfrom . import models\n\n\nclass Query(graphene.ObjectType)...
python
chosen
[ { "from": "system", "value": "Fix Pymunk crash on older versions of Android\n\nSeems to be required to link -lm on at least 5.1, but not on 8.0\n" }, { "from": "human", "value": "from pythonforandroid.recipe import CompiledComponentsPythonRecipe\n\n\nclass PymunkRecipe(CompiledComponentsPythonRe...
python
chosen
[ { "from": "system", "value": "Remove the hardcode from the settings.\n" }, { "from": "human", "value": "from django.conf import settings as django_settings\nfrom django.utils.translation import ugettext_lazy as _\n\ndef settings(request):\n if not getattr(django_settings, \"SOCIAL\", None):\n...
python
chosen
[ { "from": "system", "value": "Add option to download via SSH\n" }, { "from": "human", "value": "# THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n# FITNESS FOR A PARTICULAR PURPOSE AND NONIN...
python
chosen
[ { "from": "system", "value": "Add new method to read correspondances files\n" }, { "from": "human", "value": "\"\"\"@package IO\nGeneric input/output functions\n\"\"\"\nimport numpy as np\n\ndef readPointCloudFromPly(path):\n f = open(path, 'r')\n \n points = []\n \n headerSkipped...
python
chosen
[ { "from": "system", "value": "Add environmental settings for basic authentication.\n" }, { "from": "human", "value": "import sys\n\nfrom colour_runner.django_runner import ColourRunnerMixin\nfrom django.conf import settings\n\n\nsettings.configure(\n INSTALLED_APPS=(\n # Put contenttyp...
python
chosen
[ { "from": "system", "value": "Reorder imports to dodge a settings problem.\n" }, { "from": "human", "value": "#! /usr/bin/env python3\nfrom os import path\nimport sys\n\nfrom colour_runner.django_runner import ColourRunnerMixin\nfrom django.conf import settings\nfrom django.test.runner import Di...
python
chosen
[ { "from": "system", "value": "Clarify docstring from previous PR suggestion\n" }, { "from": "human", "value": "import datetime\n\nfrom django.http import JsonResponse\nfrom django.shortcuts import render\nfrom django.views.generic import View\nfrom cla_common.smoketest import smoketest\n\nfrom ....
python
chosen
[ { "from": "system", "value": "Cover this exception with a test\n" }, { "from": "human", "value": "import unittest\n\nfrom jacquard.storage.dummy import DummyStore\nfrom jacquard.storage.testing_utils import StorageGauntlet\n\n\nclass DummyGauntletTest(StorageGauntlet, unittest.TestCase):\n de...
python
chosen
[ { "from": "system", "value": "Add the test REDIS database." }, { "from": "human", "value": "\nDATABASES['default'] = dj_database_url.config(\n default='postgres://oneflow:8jxcWaAfPJT3mV@{0}'\n '/oneflow'.format(MAIN_SERVER))\n\nmongoengine.connect('oneflow', host=MAIN_SERVER)\n\nREDIS_DB =...
python
chosen
[ { "from": "system", "value": "Remove internal fields form from" }, { "from": "human", "value": "from django.forms import ModelForm\nfrom .models import Account, Site\n\nclass SiteForm(ModelForm):\n class Meta(object):\n model = Site\n exclude = ('verified',)\n\nclass AccountForm...
python
chosen
[ { "from": "system", "value": "Update VERSION to 0.12.6 final\n" }, { "from": "human", "value": "\"\"\"\nCAUTION! Keep everything here at at minimum. Do not import stuff.\nThis module is imported in setup.py, so you cannot for instance\nimport a dependency.\n\"\"\"\nfrom __future__ import absolut...
python
chosen
[ { "from": "system", "value": "Use classes to create constraints.\n" }, { "from": "human", "value": "#!/usr/bin/python3\n\n\"\"\"\nMaximize\n 1 x1 + 2 x2\nSubject To\n C1: x1 + x2 <= 40\n Nickel: 2 x1 + 1 x2 <= 60\nBounds\n x1 >= 0\n x2 >= 0\nEnd\n\"\"\"\n\nfrom gurobipy import * \n\nm = Mod...
python
chosen
[ { "from": "system", "value": "Use a filter field lookup\n\nLooks like I forgot to do this when JR suggested it.\n" }, { "from": "human", "value": "from django.db import models\nfrom django.urls import reverse\n\nTALK_STATUS_CHOICES = (\n ('S', 'Submitted'),\n ('A', 'Approved'),\n ('R', ...
python
chosen
[ { "from": "system", "value": "Handle the possibility of other tests failing in Python code called from C\n" }, { "from": "human", "value": "#! /usr/bin/env python\n# -*- coding: iso-8859-1 -*-\n# vi:ts=4:et\n\nimport os.path\nimport pycurl\nimport sys\nimport unittest\n\nclass WriteAbortTest(uni...
python
chosen
[ { "from": "system", "value": "Remove shebang from top-level init file\n" }, { "from": "human", "value": "#!/usr/bin/env python\n# flake8: noqa: E402,F401\n__version__ = '0.6.1'\n\ntry:\n from .response import AnyResponse, CachedHTTPResponse, CachedResponse, ExpirationTime\n from .session i...
python
chosen
[ { "from": "system", "value": "Remove extra space for method call.\n" }, { "from": "human", "value": "# encoding: utf-8\nimport mimetypes\nimport re\nfrom django.core.urlresolvers import reverse\n\n\ndef order_name(name):\n \"\"\"order_name -- Limit the name to 20 chars length, and convert to ...
python
chosen
[ { "from": "system", "value": "Fix syntax warning in `smart_open`\n\nFixes #20\n" }, { "from": "human", "value": "import sys\nimport contextlib\n\n\n@contextlib.contextmanager\ndef smart_open(filename, mode=\"Ur\"):\n \"\"\"Open stdin or stdout using a contextmanager\n\n From: http://stacko...
python
chosen
[ { "from": "system", "value": "Add whitespace on problem 22\n" }, { "from": "human", "value": "# Names scores\n# Total names scores from names.txt\n\ndef get_names():\n f = open('files/names.txt', 'r')\n names = f.read()\n return sorted(names.split(','))\n\n\ndef names_scores():\n tot...
python
chosen
[ { "from": "system", "value": "Add drink order passing in Raspberry Pi code\n" }, { "from": "human", "value": "#!env/bin/python3\n\nimport argparse\nimport asyncio\nimport json\nimport socket\nimport websockets\n\nimport teensy\nimport messages\n\nasync def contact_server():\n async with webso...
python
chosen
[ { "from": "system", "value": "Make the bot track nicks in the channel and maintain exactly one IrcMissionSession per nick.\n" }, { "from": "human", "value": "from django.conf import settings\n\nfrom ircbot import SingleServerIRCBot\n\nclass IrcMissionBot(SingleServerIRCBot):\n\n def __init__(...
python
chosen
[ { "from": "system", "value": "Change crontab finished message to include the current time." }, { "from": "human", "value": "#\n# run the cron service (intended to be executed from a cron job)\n#\n# usage: manage.py cronjobs\n\nfrom django.conf import settings\nfrom django.core.management.base im...
python
chosen
[ { "from": "system", "value": "Attach custom result popup menu to widget\n\nCall gtk.Menu.attach_to_widget() on the popup menu for custom results.\nThis should have little practical result one way or the other, though\nit is theoretically \"right\", but it has the useful side-effect of getting\nthe menu into...
python
chosen
[ { "from": "system", "value": "Add a DEVELOPMENT settings for URL mapping for static and media files.\n" }, { "from": "human", "value": "from django.conf.urls.defaults import *\n\nfrom registration.views import register\nfrom registration.backends.default import DefaultBackend\nimport pytask.prof...
python
chosen
[ { "from": "system", "value": "Remove label and add placeholder to Query field.\n" }, { "from": "human", "value": "\"\"\"\nForms for the rdap_explorer project, query app.\n\"\"\"\n\nfrom django import forms\n\n\nclass QueryForm(forms.Form):\n query = forms.CharField(max_length=100)\n" }, {...
python
chosen
[ { "from": "system", "value": "Add rating to api serializer\n" }, { "from": "human", "value": "from rest_framework import serializers\n\nfrom api.models import Menu, Rating\n\n\nclass RatingSerializer(serializers.ModelSerializer):\n\n class Meta:\n model = Rating\n fields = ('id'...
python
chosen
[ { "from": "system", "value": "Fix the scheduling / tracking check\n" }, { "from": "human", "value": "def on_enter(event_data):\n \"\"\" \"\"\"\n pocs = event_data.model\n\n pocs.say(\"Analyzing image...\")\n\n try:\n observation = pocs.observatory.current_observation\n\n ...
python
chosen
[ { "from": "system", "value": "Include \"filecache\" and \"alembicarchive\" selection.\n\n" }, { "from": "human", "value": "# -*- coding: utf-8 -*-\n#-------------------------------------------------------------------------------\n## Description\n\"\"\"\nDefine file for Cache Manager Tool.\n\"\"\...
python
chosen
[ { "from": "system", "value": "Fix error with app prefix. We will assume all urls fall under the same root as the landing page\n" }, { "from": "human", "value": "from django.conf import settings\nfrom regulations.generator import generator\nfrom django.core.urlresolvers import get_script_prefix\n...
python
chosen
[ { "from": "system", "value": "8: Create documentation of DataSource Settings \n\nTask-Url: http://github.com/stoeps13/ibmcnx2/issues/issue/8" }, { "from": "human", "value": "######\n# Check ExId (GUID) by Email through JDBC\n#\n# Author: Christoph Stoettner\n# Mail: christoph....
python
chosen
[ { "from": "system", "value": "Remove intentional unused import to clean branch\n" }, { "from": "human", "value": "import time\nfrom django.conf.urls import patterns, url, include\n\n\nurlpatterns = patterns('',\n url(r'', include(patterns('',\n url(r'^$', include('serrano.resources')),...
python
chosen
[ { "from": "system", "value": "Fix encoding problems with py2\n" }, { "from": "human", "value": "# coding: utf-8\nfrom __future__ import unicode_literals\n\nimport os\n\n\ndef get_path(filename):\n return os.path.join(os.path.dirname(__file__), filename)\n\n\ndef maybe_strip_comment(line):\n ...
python
chosen
[ { "from": "system", "value": "Fix issue with spacing when inserting gmt link\n\nMake the entry a single line to avoid leading white space problems.\n" }, { "from": "human", "value": "\"\"\"\nUtilities and common tasks for wrapping the GMT modules.\n\"\"\"\n\nGMT_DOCS = 'http://gmt.soest.hawaii.e...
python
chosen
[ { "from": "system", "value": "Remove unused newsletter DTO `Subscription`\n" }, { "from": "human", "value": "\"\"\"\nbyceps.services.newsletter.transfer.models\n~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\n\n:Copyright: 2006-2020 Jochen Kupperschmidt\n:License: Modified BSD, see LICENSE for detai...
python
chosen
[ { "from": "system", "value": "Use render_async and a template env with jinja2\n" }, { "from": "human", "value": "## To use this example:\n# curl -d '{\"name\": \"John Doe\"}' localhost:8000\n\nfrom sanic import Sanic\nfrom sanic import response\nfrom jinja2 import Template\n\ntemplate = Template...
python
chosen
[ { "from": "system", "value": "Fix import and call render() on vis\n" }, { "from": "human", "value": "import IPython.core.displaypub as displaypub\nimport json\nimport DataFrame from pandas\n\nclass DataFrameEncoder(json.JSONEncoder):\n def default(self, obj):\n if isinstance(obj, DataF...
python
chosen
[ { "from": "system", "value": "Fix a bug while handling invalid values\n" }, { "from": "human", "value": "from ....fields import DecimalField\nfrom .widgets import BRDecimalInput\n\nfrom decimal import Decimal\n\n\nclass BRDecimalField(DecimalField):\n widget = BRDecimalInput\n\n def to_pyt...
python
chosen
[ { "from": "system", "value": "Use max polling delay to avoid OSErrors\n" }, { "from": "human", "value": "# Just to insure requirement\nimport colorlog # noqa\n\n# Development mode: use a local OSF dev version and more granular logging\nDEV_MODE = False # TODO (abought): auto-set flag when usin...
python
chosen
[ { "from": "system", "value": "Make Component.spec calls raise TypeError directly\n" }, { "from": "human", "value": "\"\"\"\nModule to add streamparse-specific extensions to pystorm Component classes\n\"\"\"\nimport pystorm\nfrom pystorm.component import StormHandler # This is used by other code...
python
chosen
[ { "from": "system", "value": "Fix error where book id wasn't cast to string\n" }, { "from": "human", "value": "from datetime import datetime\nfrom django.db import models\n\nclass Author(models.Model):\n '''Object for book author'''\n\n first_name = models.CharField(max_length=128)\n last_nam...
python
chosen
[ { "from": "system", "value": "Customize lookup get_query to account for looking up a portion of User.get_full_name\n" }, { "from": "human", "value": "from django.contrib.auth.models import User\n\nfrom selectable.base import ModelLookup\nfrom selectable.registry import registry\n\n\nclass UserLo...
python
chosen
[ { "from": "system", "value": "Test iteration stops at empty bytes\n" }, { "from": "human", "value": "\"\"\"\nunit tests for the script engine\n\"\"\"\n\nimport pytest\nimport salt.config\nimport salt.engines.script as script\nfrom salt.exceptions import CommandExecutionError\nfrom tests.support....
python
chosen
[ { "from": "system", "value": "Fix custom URLs masking admin URL\n" }, { "from": "human", "value": "from django.conf.urls import patterns, include, url\nfrom django.conf.urls.i18n import i18n_patterns\nfrom django.conf import settings\nfrom django.contrib import admin\nfrom django.views.generic i...
python
chosen
[ { "from": "system", "value": "Add max limit to api pagination" }, { "from": "human", "value": "from collections import OrderedDict\n\nfrom rest_framework.pagination import LimitOffsetPagination\nfrom rest_framework.response import Response\nfrom rest_framework.serializers import ListSerializer\n...
python
chosen
[ { "from": "system", "value": "Fix the issue: \"session\" shared in different connections\n" }, { "from": "human", "value": "# Copyright (c) 2014, Henry Huang\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...
python
chosen
[ { "from": "system", "value": "Modify the interpnd cython generator to allow .NET output\n" }, { "from": "human", "value": "#!/usr/bin/env python\nimport tempfile\nimport subprocess\nimport os\nimport sys\nimport re\nimport shutil\n\nfrom mako.template import Template\n\nf = open('interpnd.pyx', ...
python
chosen
[ { "from": "system", "value": "Load feats with zero length\n" }, { "from": "human", "value": "__all__ = []\n\nfrom lib.exp.featx.base import Feats\nfrom lib.exp.tools.slider import Slider\nfrom lib.exp.tools.video import Video\nfrom lib.exp.pre import Reducer\n\n\nclass Featx(Feats):\n def __i...
python
chosen
[ { "from": "system", "value": "Debug Google Cloud Run support\n" }, { "from": "human", "value": "#!/usr/bin/python3\n#\n# Define containerized environment for running Diosix on Qemu\n#\n# On Google Cloud Run: Creates HTTP server on port 8080\n# or whatever was specified using the PORT system vari...
python
chosen
[ { "from": "system", "value": "Change goals passage with service (from message)\n" }, { "from": "human", "value": "#!/usr/bin/env python\n# coding UTF-8\n\nimport yaml\nimport rospy\n\nfrom goal_sender_msgs.msg import GoalSequence\nfrom goal_sender_msgs.msg import Waypoint\n\ndef read_yaml(path):...
python
chosen
[ { "from": "system", "value": "Fix trouble about the output filename\n" }, { "from": "human", "value": "import logging\nimport subprocess\n\n\nclass Tcpdump:\n def __init__(self, interface, buffer_size, pcap_size, pcap_timeout, output_filename, post_process=None):\n self._interface = in...
python
chosen
[ { "from": "system", "value": "Change bool_formatter() to be backward compatible with bootstrap2\n" }, { "from": "human", "value": "from jinja2 import Markup\nfrom flask.ext.admin._compat import text_type\n\n\ndef null_formatter(view, value):\n \"\"\"\n Return `NULL` as the string for `...
python
chosen
[ { "from": "system", "value": "Allow IP to be blank in form\n\n--HG--\nbranch : bookmarks\n" }, { "from": "human", "value": "from lingcod.features.forms import FeatureForm\nfrom lingcod.bookmarks.models import Bookmark\nfrom django import forms\n\nclass BookmarkForm(FeatureForm):\n name = form...
python
chosen
[ { "from": "system", "value": "Update import in db creation script\n" }, { "from": "human", "value": "\"\"\"\"\nIn case of exception:\n InvalidRequestError: Table '(some name)' is\n already defined for this MetaData instance\njust comment out part of app.py where import of views (and what c...
python
chosen
[ { "from": "system", "value": "Add Unit-Test For Scanner Problem\n" }, { "from": "human", "value": "import os\n\nfrom unittest import TestCase\nfrom thunderdome.gremlin import parse\n\nclass GroovyScannerTest(TestCase):\n \"\"\"\n Test Groovy language scanner\n \"\"\"\n \n def test...
python
chosen
[ { "from": "system", "value": "import: Use ObjectId from bson instead of pymongo\n\npymongo >= 2.2 stops importing ObjectId from bson\nso it need to be pulled in directly." }, { "from": "human", "value": "# -*- coding: utf-8 -*-\n\nfrom pymongo.objectid import ObjectId\n\nfrom scalymongo.document...
python
chosen
[ { "from": "system", "value": "Change params to suit and rank\n" }, { "from": "human", "value": "\"\"\"\nCreated on Dec 24, 2016\n\n@author: john papa\n\nCopyright 2016 John Papa. All rights reserved.\nThis work is licensed under the MIT License.\n\"\"\"\nfrom .card import Card\n\nclass BjCard(C...
python
chosen
[ { "from": "system", "value": "Add reprensation method for Money class\n" }, { "from": "human", "value": "\nclass Money(object):\n\n def __init__(self, amount, currency):\n self.amount = amount\n self.currency = currency.upper()\n\n" }, { "from": "gpt", "value": "\ncl...
python
chosen
[ { "from": "system", "value": "Call superclass constructor for Workspace\n" }, { "from": "human", "value": "from geoserver.support import atom_link, xml_property, write_bool, ResourceInfo\nimport string\n\ndef workspace_from_index(catalog, node):\n name = node.find(\"name\")\n return Worksp...
python
chosen
[ { "from": "system", "value": "Fix in case s3boto is not installed\n" }, { "from": "human", "value": "# -*- coding: utf-8 -*-\nfrom django.conf import settings\nfrom django.contrib.staticfiles.finders import get_finders\nfrom django.core.files.storage import FileSystemStorage\n\n\nclass SassFileS...
python
chosen
[ { "from": "system", "value": "Remove final references to application\n" }, { "from": "human", "value": "from core.models.user import AtmosphereUser\nfrom core.query import only_current, only_current_source\nfrom rest_framework import serializers\nfrom .application_serializer import ApplicationSe...
python
chosen
[ { "from": "system", "value": "Move n_days back to 60 so social distancing can be seen in the plots\n" }, { "from": "human", "value": "#!/usr/bin/env python\n\nfrom datetime import date\n\nfrom .parameters import Parameters, Regions, RateLos\n\nDEFAULTS = Parameters(\n region=Regions(\n ...
python
chosen
[ { "from": "system", "value": "Increase global lock holding duration due to new network transactions\n" }, { "from": "human", "value": "import threading\nimport contextlib\nimport time\nimport traceback\nimport logging\n\n\n_lock = threading.Lock()\n\n\n@contextlib.contextmanager\ndef lock():\n ...
python
chosen
[ { "from": "system", "value": "Set settings for e2e tests correctly\n" }, { "from": "human", "value": "#!/usr/bin/env python\nimport os\nimport sys\n\nimport dotenv\n\nif __name__ == \"__main__\":\n # We can't do read_dotenv('../environment') because that assumes that when\n # manage.py we ...
python
chosen
[ { "from": "system", "value": "Make BGZF test a real unittest\n" }, { "from": "human", "value": "import bx.misc.bgzf\n\ndef test_bgzf():\n f = bx.misc.bgzf.BGZFFile( \"../test_data/bgzf_tests/test.txt.gz\" )\n print f.read( 10 )\n print f.seek( 0 )\n print f.read( 10 )\n \ntest_bgz...
python
chosen
[ { "from": "system", "value": "Return JSON in the autocomplete view\n" }, { "from": "human", "value": "import unicodedata\n\nfrom django.http import HttpResponse\nfrom django.template.defaultfilters import slugify\nfrom django.utils.translation import ugettext as _\n\nfrom .models import Town\n\n...
python
chosen
[ { "from": "system", "value": "Add food to the perception handler\n" }, { "from": "human", "value": "\"\"\"\nModule that holds classes that represent an agent's perception handler.\n\"\"\"\n\nimport abc\nimport world\nimport structure\n\nclass PerceptionHandler(object):\n \"\"\"\n Abstract ...
python
chosen
[ { "from": "system", "value": "Make the probe actually do something with monitors\n\nUses the execute_monitors method of the nodes now, which doesn't really\ndo much, but will in the future.\n" }, { "from": "human", "value": "import time\nimport logging\n\nfrom nanomon.queue import QueueWorker\n\...
python
chosen
[ { "from": "system", "value": "Solve typo in xtreme testing\n\nPiperOrigin-RevId: 477195014\n" }, { "from": "human", "value": "# coding=utf-8\n# Copyright 2022 The TensorFlow Datasets Authors.\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may not use this file exc...
python
chosen
[ { "from": "system", "value": "tests/negation: Test that negation is the additive inverse\n" }, { "from": "human", "value": "from hypothesis import given\n\nfrom ppb_vector import Vector2\nfrom utils import vectors\n\n@given(vector=vectors())\ndef test_negation_scalar(vector: Vector2):\n asser...
python
chosen
[ { "from": "system", "value": "Use seed function in constructor since some LCGs might overwrite it.\n" }, { "from": "human", "value": "from collections import namedtuple\nfrom ..prng import PRNG\n\n\nclass LCG(PRNG):\n LCGConstants = namedtuple('LCGConstants', ['a', # Multiplier\n ...
python
chosen
[ { "from": "system", "value": "Remove some object representation clobbering code\n" }, { "from": "human", "value": "# -*- coding: utf-8 -*-\n\n\"\"\"\nObject layout.\n\"\"\"\n\nfrom __future__ import print_function, division, absolute_import\n\nfrom numba2 import conversion\n\nfrom pykit import t...
python
chosen
[ { "from": "system", "value": "Allow to config log level\n" }, { "from": "human", "value": "import click\n\nfrom dotenv import load_dotenv, find_dotenv\nfrom grazer.config import Config\nfrom grazer.core import crawler\n\n\n@click.command()\n@click.option(\"--env\", default=find_dotenv())\n@click...
python
chosen
[ { "from": "system", "value": "Bump version: 0.21.1 → 0.21.2\n" }, { "from": "human", "value": "\"\"\" version info for pyvista \"\"\"\n# major, minor, patch\nversion_info = 0, 21, 1\n\n# Nice string for the version\n__version__ = '.'.join(map(str, version_info))\n" }, { "from": "gpt", ...
python
chosen
[ { "from": "system", "value": "Use new translated string placeholder style\n" }, { "from": "human", "value": "# coding: utf-8\nfrom django.conf import settings\nfrom django.utils.translation import gettext as _\nfrom rest_framework import exceptions\n\nfrom onadata.apps.main.models.user_profile i...
python
chosen
[ { "from": "system", "value": "Update CC Object to limit fields, use custom exception and rules\n" }, { "from": "human", "value": "\"\"\"\ncontacts.api\n~~~~~~~~~~~~\nThis module implements the Contacts 📕 API.\n:copyright: (c) 2017 by David Heimann.\n:license: MIT, see LICENSE for more details.\...
python
chosen
[ { "from": "system", "value": "Fix actual type error in test code\n" }, { "from": "human", "value": "from bedrock import *\n\n@annot('void -> int')\ndef main():\n a = hint(Cons(0, Cons(1, Nil())), a='int')\n a = hint(Cons(1, Cons(2, Cons(3, Nil))), a='int')\n #b = hint(match(a, (\"Cons(_...
python
chosen
[ { "from": "system", "value": "Add import statements breaking linter\n" }, { "from": "human", "value": "# -*- coding: utf-8 -*-\n\"\"\"Basic test suite.\n\nThere are some 'noqa: F401' in this file to just test the isort import sorting.\n\"\"\"\n\nimport __future__ # noqa: F401\n\nimport json # ...
python
chosen
[ { "from": "system", "value": "Make sure the 'user' object is available in the UserProfile queryset in the view.\n" }, { "from": "human", "value": "from django.views.generic.list import ListView\nfrom django.views.generic.detail import DetailView\n\nfrom .models import UserProfile\n\n\nclass User...
python
chosen
[ { "from": "system", "value": "Add a log to Exp2\n" }, { "from": "human", "value": "#!/usr/bin/python3.4\n\"\"\"\n Exp2_DriveForward -- RedBot Experiment 2\n\n Drive forward and stop.\n\n Hardware setup:\n The Power switch must be on, the motors must be connected, and the board must be receiv...
python
chosen
[ { "from": "system", "value": "Remove superflous line, remove duplicate data\n" }, { "from": "human", "value": "import json\n\n\ndef _send_message(message, content: dict, close: bool):\n message.reply_channel.send({\n 'text': json.dumps(content),\n 'close': close,\n })\n\n\nde...
python
chosen
[ { "from": "system", "value": "Update str() and add comments\n" }, { "from": "human", "value": "\"\"\"\noperation.py\n~~~~~~~~~~~~~\nThis stores the information of each individual operation in the\nproduction line.\n - machine is the machine in which that operation will be executed\n - duration i...
python
chosen